@hybridcore/ui 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/template-form/index.js +27 -24
- package/dist/main.d.ts +8 -8
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as t, jsxs as u } from "react/jsx-runtime";
|
|
2
2
|
import f from "react";
|
|
3
|
-
import
|
|
4
|
-
import { useForm as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
3
|
+
import M from "lodash";
|
|
4
|
+
import { useForm as P, Controller as l } from "react-hook-form";
|
|
5
|
+
import O from "./components/property-list/index.js";
|
|
6
|
+
import j from "./components/recognition-property-list/index.js";
|
|
7
7
|
import { CatalogueInstanceSelector as K } from "./components/catalogue-instance-selector/index.js";
|
|
8
8
|
import { getNestedChildrenFromMap as L } from "../../utils/ontology.js";
|
|
9
9
|
import { Container as _ } from "../container/index.js";
|
|
@@ -14,16 +14,16 @@ import { T as m } from "../../TextField-D87qTh1k.js";
|
|
|
14
14
|
import { F as g } from "../../property-list-form-BfP9gzSo.js";
|
|
15
15
|
import { F as d } from "../../FormControlLabel-D9KFjcIx.js";
|
|
16
16
|
import { C as c } from "../../Checkbox-qy3cjvnb.js";
|
|
17
|
-
import { B as
|
|
18
|
-
function D(e,
|
|
17
|
+
import { B as p } from "../../Box-BPyg-Ybm.js";
|
|
18
|
+
function D(e, x) {
|
|
19
19
|
const {
|
|
20
20
|
register: s,
|
|
21
21
|
handleSubmit: T,
|
|
22
22
|
control: i,
|
|
23
|
-
formState: { errors:
|
|
23
|
+
formState: { errors: C },
|
|
24
24
|
getValues: h,
|
|
25
|
-
reset:
|
|
26
|
-
} =
|
|
25
|
+
reset: v
|
|
26
|
+
} = P({
|
|
27
27
|
defaultValues: e.defaultValues
|
|
28
28
|
}), [V, F] = f.useState([]), I = (n) => {
|
|
29
29
|
const a = new Map(n);
|
|
@@ -44,9 +44,9 @@ function D(e, p) {
|
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
|
-
return f.useImperativeHandle(
|
|
47
|
+
return f.useImperativeHandle(x, () => ({
|
|
48
48
|
resetForm() {
|
|
49
|
-
|
|
49
|
+
v();
|
|
50
50
|
}
|
|
51
51
|
})), f.useEffect(() => (S(), () => {
|
|
52
52
|
}), [e.mappedTemplates]), /* @__PURE__ */ t(_, { disableHeader: !0, children: /* @__PURE__ */ u("form", { onSubmit: (n, a) => {
|
|
@@ -62,7 +62,7 @@ function D(e, p) {
|
|
|
62
62
|
fullWidth: !0,
|
|
63
63
|
sx: { mb: 2 },
|
|
64
64
|
...s("name", { required: !0 }),
|
|
65
|
-
...
|
|
65
|
+
...C.name && {
|
|
66
66
|
helperText: "This field is required!",
|
|
67
67
|
error: !0
|
|
68
68
|
}
|
|
@@ -157,13 +157,16 @@ function D(e, p) {
|
|
|
157
157
|
}), e.onAgentSelect && e.onAgentSelect(a);
|
|
158
158
|
},
|
|
159
159
|
onSearchSubmit: e.onCatalogueInstanceSearchSubmit,
|
|
160
|
-
openMapping: e.openMapping,
|
|
161
|
-
mappingData: e.mappingData,
|
|
162
|
-
objectTemplate: e.objectTemplate,
|
|
163
|
-
mapboxAccessToken: e.mapboxAccessToken,
|
|
164
|
-
onMappingSubmit: e.onMappingSubmit
|
|
165
|
-
|
|
166
|
-
|
|
160
|
+
openMapping: e.openMapping ?? !1,
|
|
161
|
+
mappingData: e.mappingData ?? [],
|
|
162
|
+
objectTemplate: e.objectTemplate ?? {},
|
|
163
|
+
mapboxAccessToken: e.mapboxAccessToken ?? "",
|
|
164
|
+
onMappingSubmit: e.onMappingSubmit ? e.onMappingSubmit : () => {
|
|
165
|
+
},
|
|
166
|
+
onMappingOpen: e.onMappingOpen ? e.onMappingOpen : () => {
|
|
167
|
+
},
|
|
168
|
+
onMappingClose: e.onMappingClose ? e.onMappingClose : () => {
|
|
169
|
+
}
|
|
167
170
|
}
|
|
168
171
|
)
|
|
169
172
|
}
|
|
@@ -267,11 +270,11 @@ function D(e, p) {
|
|
|
267
270
|
name: "properties",
|
|
268
271
|
control: i,
|
|
269
272
|
render: ({ field: { value: n, onChange: a } }) => /* @__PURE__ */ t(
|
|
270
|
-
|
|
273
|
+
O,
|
|
271
274
|
{
|
|
272
275
|
list: n || [],
|
|
273
276
|
inputVariant: e.inputVariant,
|
|
274
|
-
templateId:
|
|
277
|
+
templateId: M.get(e.defaultValues, "id"),
|
|
275
278
|
disablePropertyId: e.disablePropertyId,
|
|
276
279
|
onChange: a
|
|
277
280
|
}
|
|
@@ -284,7 +287,7 @@ function D(e, p) {
|
|
|
284
287
|
name: "recognitionPropertyList",
|
|
285
288
|
control: i,
|
|
286
289
|
render: ({ field: { value: n, onChange: a } }) => /* @__PURE__ */ t(
|
|
287
|
-
|
|
290
|
+
j,
|
|
288
291
|
{
|
|
289
292
|
list: n || [],
|
|
290
293
|
getFormValues: h,
|
|
@@ -293,7 +296,7 @@ function D(e, p) {
|
|
|
293
296
|
)
|
|
294
297
|
}
|
|
295
298
|
),
|
|
296
|
-
/* @__PURE__ */ u(
|
|
299
|
+
/* @__PURE__ */ u(p, { display: "flex", justifyContent: "space-between", mt: 3, children: [
|
|
297
300
|
/* @__PURE__ */ t(
|
|
298
301
|
b,
|
|
299
302
|
{
|
|
@@ -305,7 +308,7 @@ function D(e, p) {
|
|
|
305
308
|
children: "Cancel"
|
|
306
309
|
}
|
|
307
310
|
),
|
|
308
|
-
/* @__PURE__ */ t(
|
|
311
|
+
/* @__PURE__ */ t(p, { children: e.saveButtons ? e.saveButtons.map((n, a) => /* @__PURE__ */ t(
|
|
309
312
|
b,
|
|
310
313
|
{
|
|
311
314
|
type: "submit",
|
package/dist/main.d.ts
CHANGED
|
@@ -786,15 +786,15 @@ K extends
|
|
|
786
786
|
onAgentSelect?(selectedIds: number[]): void;
|
|
787
787
|
|
|
788
788
|
//Props for mapping
|
|
789
|
-
openMapping
|
|
790
|
-
mappingData
|
|
791
|
-
objectTemplate
|
|
789
|
+
openMapping?: boolean;
|
|
790
|
+
mappingData?: POLICY.InstancePolicyMapping[];
|
|
791
|
+
objectTemplate?: ONTOLOGY.Object;
|
|
792
792
|
selectedInstances?: INSTANCE.Agent[];
|
|
793
|
-
mapboxAccessToken
|
|
794
|
-
onMappingSubmit(data: POLICY.InstancePolicyMapping[]): void;
|
|
795
|
-
onMappingOpen(event: MouseEvent<HTMLButtonElement>): void;
|
|
796
|
-
onMappingClose(): void;
|
|
797
|
-
onCatalogueInstanceSearchSubmit(value?: string): void;
|
|
793
|
+
mapboxAccessToken?: string;
|
|
794
|
+
onMappingSubmit?(data: POLICY.InstancePolicyMapping[]): void;
|
|
795
|
+
onMappingOpen?(event: MouseEvent<HTMLButtonElement>): void;
|
|
796
|
+
onMappingClose?(): void;
|
|
797
|
+
onCatalogueInstanceSearchSubmit?(value?: string): void;
|
|
798
798
|
}
|
|
799
799
|
|
|
800
800
|
export declare const TemplatePropertyFilters: FC<Props_10>;
|