@hybridcore/ui 1.4.2 → 1.4.4
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 +69 -70
- package/dist/main.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,32 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as u, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import f from "react";
|
|
3
|
-
import
|
|
3
|
+
import k from "lodash";
|
|
4
4
|
import { useForm as P, Controller as l } from "react-hook-form";
|
|
5
5
|
import O from "./components/property-list/index.js";
|
|
6
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
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import B from "./components/select-icon/index.js";
|
|
9
|
+
import { TreeSelect as _ } from "../tree-select/index.js";
|
|
10
|
+
import { FormLabel as w, Button as b } from "@mui/material";
|
|
11
|
+
import A from "./components/select-icon/index.js";
|
|
13
12
|
import { T as m } from "../../TextField-D87qTh1k.js";
|
|
14
13
|
import { F as g } from "../../property-list-form-BfP9gzSo.js";
|
|
15
14
|
import { F as d } from "../../FormControlLabel-D9KFjcIx.js";
|
|
16
15
|
import { C as c } from "../../Checkbox-qy3cjvnb.js";
|
|
17
16
|
import { B as p } from "../../Box-BPyg-Ybm.js";
|
|
18
|
-
function
|
|
17
|
+
function B(e, x) {
|
|
19
18
|
const {
|
|
20
19
|
register: s,
|
|
21
20
|
handleSubmit: T,
|
|
22
21
|
control: i,
|
|
23
|
-
formState: { errors:
|
|
22
|
+
formState: { errors: v },
|
|
24
23
|
getValues: h,
|
|
25
|
-
reset:
|
|
24
|
+
reset: C
|
|
26
25
|
} = P({
|
|
27
26
|
defaultValues: e.defaultValues
|
|
28
|
-
}), [V, F] = f.useState([]), I = (
|
|
29
|
-
const a = new Map(
|
|
27
|
+
}), [V, F] = f.useState([]), I = (t) => {
|
|
28
|
+
const a = new Map(t);
|
|
30
29
|
for (const [r, o] of a)
|
|
31
30
|
a.set(r, {
|
|
32
31
|
...o,
|
|
@@ -36,9 +35,9 @@ function D(e, x) {
|
|
|
36
35
|
});
|
|
37
36
|
return L(a);
|
|
38
37
|
}, S = () => {
|
|
39
|
-
const
|
|
40
|
-
F(
|
|
41
|
-
},
|
|
38
|
+
const t = I(e.mappedTemplates);
|
|
39
|
+
F(t);
|
|
40
|
+
}, M = () => {
|
|
42
41
|
if (e.onCancel) {
|
|
43
42
|
e.onCancel();
|
|
44
43
|
return;
|
|
@@ -46,15 +45,15 @@ function D(e, x) {
|
|
|
46
45
|
};
|
|
47
46
|
return f.useImperativeHandle(x, () => ({
|
|
48
47
|
resetForm() {
|
|
49
|
-
|
|
48
|
+
C();
|
|
50
49
|
}
|
|
51
50
|
})), f.useEffect(() => (S(), () => {
|
|
52
|
-
}), [e.mappedTemplates]), /* @__PURE__ */
|
|
53
|
-
|
|
51
|
+
}), [e.mappedTemplates]), /* @__PURE__ */ u("form", { onSubmit: (t, a) => {
|
|
52
|
+
t == null || t.preventDefault(), T(((o) => (y) => {
|
|
54
53
|
e.onSubmit(y, o);
|
|
55
54
|
})(a))();
|
|
56
55
|
}, children: [
|
|
57
|
-
/* @__PURE__ */
|
|
56
|
+
/* @__PURE__ */ n(
|
|
58
57
|
m,
|
|
59
58
|
{
|
|
60
59
|
label: "Name *",
|
|
@@ -62,13 +61,13 @@ function D(e, x) {
|
|
|
62
61
|
fullWidth: !0,
|
|
63
62
|
sx: { mb: 2 },
|
|
64
63
|
...s("name", { required: !0 }),
|
|
65
|
-
...
|
|
64
|
+
...v.name && {
|
|
66
65
|
helperText: "This field is required!",
|
|
67
66
|
error: !0
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
),
|
|
71
|
-
/* @__PURE__ */
|
|
70
|
+
/* @__PURE__ */ n(
|
|
72
71
|
m,
|
|
73
72
|
{
|
|
74
73
|
label: "Template Key",
|
|
@@ -79,7 +78,7 @@ function D(e, x) {
|
|
|
79
78
|
...s("templateKey")
|
|
80
79
|
}
|
|
81
80
|
),
|
|
82
|
-
/* @__PURE__ */
|
|
81
|
+
/* @__PURE__ */ n(
|
|
83
82
|
m,
|
|
84
83
|
{
|
|
85
84
|
label: "Description",
|
|
@@ -89,7 +88,7 @@ function D(e, x) {
|
|
|
89
88
|
...s("description")
|
|
90
89
|
}
|
|
91
90
|
),
|
|
92
|
-
/* @__PURE__ */
|
|
91
|
+
/* @__PURE__ */ n(
|
|
93
92
|
m,
|
|
94
93
|
{
|
|
95
94
|
label: "Version",
|
|
@@ -99,15 +98,15 @@ function D(e, x) {
|
|
|
99
98
|
...s("version")
|
|
100
99
|
}
|
|
101
100
|
),
|
|
102
|
-
/* @__PURE__ */
|
|
101
|
+
/* @__PURE__ */ n(g, { sx: { mb: 2 }, children: /* @__PURE__ */ n(
|
|
103
102
|
l,
|
|
104
103
|
{
|
|
105
104
|
name: "parent",
|
|
106
105
|
control: i,
|
|
107
|
-
render: ({ field: { value:
|
|
106
|
+
render: ({ field: { value: t, onChange: a } }) => {
|
|
108
107
|
if (e.disableParent) {
|
|
109
|
-
const r =
|
|
110
|
-
return /* @__PURE__ */
|
|
108
|
+
const r = t ? e.mappedTemplates.get(t) : void 0;
|
|
109
|
+
return /* @__PURE__ */ n(
|
|
111
110
|
m,
|
|
112
111
|
{
|
|
113
112
|
label: "Parent",
|
|
@@ -118,13 +117,13 @@ function D(e, x) {
|
|
|
118
117
|
}
|
|
119
118
|
);
|
|
120
119
|
}
|
|
121
|
-
return /* @__PURE__ */
|
|
122
|
-
|
|
120
|
+
return /* @__PURE__ */ n(
|
|
121
|
+
_,
|
|
123
122
|
{
|
|
124
123
|
label: "Parent",
|
|
125
124
|
idKey: "templateKey",
|
|
126
125
|
data: V,
|
|
127
|
-
selected:
|
|
126
|
+
selected: t ? [t] : "",
|
|
128
127
|
onChange: (r, o) => {
|
|
129
128
|
a({
|
|
130
129
|
target: {
|
|
@@ -137,20 +136,20 @@ function D(e, x) {
|
|
|
137
136
|
}
|
|
138
137
|
}
|
|
139
138
|
) }),
|
|
140
|
-
"agentReferenceIds" in e.defaultValues && /* @__PURE__ */
|
|
139
|
+
"agentReferenceIds" in e.defaultValues && /* @__PURE__ */ n(
|
|
141
140
|
l,
|
|
142
141
|
{
|
|
143
142
|
name: "agentReferenceIds",
|
|
144
143
|
control: i,
|
|
145
|
-
render: ({ field: { onChange:
|
|
144
|
+
render: ({ field: { onChange: t } }) => /* @__PURE__ */ n(
|
|
146
145
|
K,
|
|
147
146
|
{
|
|
148
|
-
templates: e.agentTemplates,
|
|
147
|
+
templates: e.agentTemplates ?? /* @__PURE__ */ new Map(),
|
|
149
148
|
data: e.agentsData,
|
|
150
149
|
inputVariant: e.inputVariant,
|
|
151
150
|
selectedInstances: e.selectedAgentInstances,
|
|
152
151
|
onSelect: (a) => {
|
|
153
|
-
|
|
152
|
+
t({
|
|
154
153
|
target: {
|
|
155
154
|
value: a
|
|
156
155
|
}
|
|
@@ -172,71 +171,71 @@ function D(e, x) {
|
|
|
172
171
|
}
|
|
173
172
|
),
|
|
174
173
|
/* @__PURE__ */ u(g, { row: !0, sx: { mb: 2 }, children: [
|
|
175
|
-
/* @__PURE__ */
|
|
174
|
+
/* @__PURE__ */ n(
|
|
176
175
|
d,
|
|
177
176
|
{
|
|
178
|
-
control: /* @__PURE__ */
|
|
177
|
+
control: /* @__PURE__ */ n(
|
|
179
178
|
l,
|
|
180
179
|
{
|
|
181
180
|
name: "creatable",
|
|
182
181
|
control: i,
|
|
183
|
-
render: ({ field: { value:
|
|
182
|
+
render: ({ field: { value: t, ...a } }) => /* @__PURE__ */ n(c, { checked: t, ...a })
|
|
184
183
|
}
|
|
185
184
|
),
|
|
186
185
|
label: "Creatable"
|
|
187
186
|
}
|
|
188
187
|
),
|
|
189
|
-
/* @__PURE__ */
|
|
188
|
+
/* @__PURE__ */ n(
|
|
190
189
|
d,
|
|
191
190
|
{
|
|
192
|
-
control: /* @__PURE__ */
|
|
191
|
+
control: /* @__PURE__ */ n(
|
|
193
192
|
l,
|
|
194
193
|
{
|
|
195
194
|
name: "editable",
|
|
196
195
|
control: i,
|
|
197
|
-
render: ({ field: { value:
|
|
196
|
+
render: ({ field: { value: t, ...a } }) => /* @__PURE__ */ n(c, { checked: t, ...a })
|
|
198
197
|
}
|
|
199
198
|
),
|
|
200
199
|
label: "Editable"
|
|
201
200
|
}
|
|
202
201
|
),
|
|
203
|
-
"stationary" in e.defaultValues && /* @__PURE__ */
|
|
202
|
+
"stationary" in e.defaultValues && /* @__PURE__ */ n(
|
|
204
203
|
d,
|
|
205
204
|
{
|
|
206
|
-
control: /* @__PURE__ */
|
|
205
|
+
control: /* @__PURE__ */ n(
|
|
207
206
|
l,
|
|
208
207
|
{
|
|
209
208
|
name: "stationary",
|
|
210
209
|
control: i,
|
|
211
|
-
render: ({ field: { value:
|
|
210
|
+
render: ({ field: { value: t, ...a } }) => /* @__PURE__ */ n(c, { checked: t, ...a })
|
|
212
211
|
}
|
|
213
212
|
),
|
|
214
213
|
label: "Stationary"
|
|
215
214
|
}
|
|
216
215
|
),
|
|
217
|
-
"livingObject" in e.defaultValues && /* @__PURE__ */
|
|
216
|
+
"livingObject" in e.defaultValues && /* @__PURE__ */ n(
|
|
218
217
|
d,
|
|
219
218
|
{
|
|
220
|
-
control: /* @__PURE__ */
|
|
219
|
+
control: /* @__PURE__ */ n(
|
|
221
220
|
l,
|
|
222
221
|
{
|
|
223
222
|
name: "livingObject",
|
|
224
223
|
control: i,
|
|
225
|
-
render: ({ field: { value:
|
|
224
|
+
render: ({ field: { value: t, ...a } }) => /* @__PURE__ */ n(c, { checked: t, ...a })
|
|
226
225
|
}
|
|
227
226
|
),
|
|
228
227
|
label: "Living Object"
|
|
229
228
|
}
|
|
230
229
|
),
|
|
231
|
-
"storeFile" in e.defaultValues && /* @__PURE__ */
|
|
230
|
+
"storeFile" in e.defaultValues && /* @__PURE__ */ n(
|
|
232
231
|
d,
|
|
233
232
|
{
|
|
234
|
-
control: /* @__PURE__ */
|
|
233
|
+
control: /* @__PURE__ */ n(
|
|
235
234
|
l,
|
|
236
235
|
{
|
|
237
236
|
name: "storeFile",
|
|
238
237
|
control: i,
|
|
239
|
-
render: ({ field: { value:
|
|
238
|
+
render: ({ field: { value: t, ...a } }) => /* @__PURE__ */ n(c, { checked: t, ...a })
|
|
240
239
|
}
|
|
241
240
|
),
|
|
242
241
|
label: "Store File"
|
|
@@ -244,17 +243,17 @@ function D(e, x) {
|
|
|
244
243
|
)
|
|
245
244
|
] }),
|
|
246
245
|
/* @__PURE__ */ u(g, { children: [
|
|
247
|
-
/* @__PURE__ */
|
|
248
|
-
/* @__PURE__ */
|
|
246
|
+
/* @__PURE__ */ n(w, { children: "Icon" }),
|
|
247
|
+
/* @__PURE__ */ n(
|
|
249
248
|
l,
|
|
250
249
|
{
|
|
251
250
|
name: "icon",
|
|
252
251
|
control: i,
|
|
253
|
-
render: ({ field: { value:
|
|
254
|
-
|
|
252
|
+
render: ({ field: { value: t, onChange: a } }) => /* @__PURE__ */ n(
|
|
253
|
+
A,
|
|
255
254
|
{
|
|
256
255
|
list: [],
|
|
257
|
-
value:
|
|
256
|
+
value: t ?? "",
|
|
258
257
|
newIcon: "",
|
|
259
258
|
onFileUpload: () => {
|
|
260
259
|
},
|
|
@@ -264,32 +263,32 @@ function D(e, x) {
|
|
|
264
263
|
}
|
|
265
264
|
)
|
|
266
265
|
] }),
|
|
267
|
-
/* @__PURE__ */
|
|
266
|
+
/* @__PURE__ */ n(
|
|
268
267
|
l,
|
|
269
268
|
{
|
|
270
269
|
name: "properties",
|
|
271
270
|
control: i,
|
|
272
|
-
render: ({ field: { value:
|
|
271
|
+
render: ({ field: { value: t, onChange: a } }) => /* @__PURE__ */ n(
|
|
273
272
|
O,
|
|
274
273
|
{
|
|
275
|
-
list:
|
|
274
|
+
list: t || [],
|
|
276
275
|
inputVariant: e.inputVariant,
|
|
277
|
-
templateId:
|
|
276
|
+
templateId: k.get(e.defaultValues, "id"),
|
|
278
277
|
disablePropertyId: e.disablePropertyId,
|
|
279
278
|
onChange: a
|
|
280
279
|
}
|
|
281
280
|
)
|
|
282
281
|
}
|
|
283
282
|
),
|
|
284
|
-
"recognitionPropertyList" in e.defaultValues && /* @__PURE__ */
|
|
283
|
+
"recognitionPropertyList" in e.defaultValues && /* @__PURE__ */ n(
|
|
285
284
|
l,
|
|
286
285
|
{
|
|
287
286
|
name: "recognitionPropertyList",
|
|
288
287
|
control: i,
|
|
289
|
-
render: ({ field: { value:
|
|
288
|
+
render: ({ field: { value: t, onChange: a } }) => /* @__PURE__ */ n(
|
|
290
289
|
j,
|
|
291
290
|
{
|
|
292
|
-
list:
|
|
291
|
+
list: t || [],
|
|
293
292
|
getFormValues: h,
|
|
294
293
|
onChange: a
|
|
295
294
|
}
|
|
@@ -297,31 +296,31 @@ function D(e, x) {
|
|
|
297
296
|
}
|
|
298
297
|
),
|
|
299
298
|
/* @__PURE__ */ u(p, { display: "flex", justifyContent: "space-between", mt: 3, children: [
|
|
300
|
-
/* @__PURE__ */
|
|
299
|
+
/* @__PURE__ */ n(
|
|
301
300
|
b,
|
|
302
301
|
{
|
|
303
302
|
color: "primary",
|
|
304
303
|
variant: "text",
|
|
305
304
|
disabled: e.loading,
|
|
306
305
|
sx: { textTransform: "none" },
|
|
307
|
-
onClick:
|
|
306
|
+
onClick: M,
|
|
308
307
|
children: "Cancel"
|
|
309
308
|
}
|
|
310
309
|
),
|
|
311
|
-
/* @__PURE__ */
|
|
310
|
+
/* @__PURE__ */ n(p, { children: e.saveButtons ? e.saveButtons.map((t, a) => /* @__PURE__ */ n(
|
|
312
311
|
b,
|
|
313
312
|
{
|
|
314
313
|
type: "submit",
|
|
315
314
|
color: "primary",
|
|
316
315
|
variant: "contained",
|
|
317
316
|
disabled: e.loading,
|
|
318
|
-
startIcon:
|
|
317
|
+
startIcon: t.icon,
|
|
319
318
|
sx: { ml: 1, textTransform: "none" },
|
|
320
|
-
onClick:
|
|
321
|
-
children:
|
|
319
|
+
onClick: t.onClick,
|
|
320
|
+
children: t.label
|
|
322
321
|
},
|
|
323
322
|
a
|
|
324
|
-
)) : /* @__PURE__ */
|
|
323
|
+
)) : /* @__PURE__ */ n(
|
|
325
324
|
b,
|
|
326
325
|
{
|
|
327
326
|
type: "submit",
|
|
@@ -333,9 +332,9 @@ function D(e, x) {
|
|
|
333
332
|
}
|
|
334
333
|
) })
|
|
335
334
|
] })
|
|
336
|
-
] })
|
|
335
|
+
] });
|
|
337
336
|
}
|
|
338
|
-
const
|
|
337
|
+
const te = f.forwardRef(B);
|
|
339
338
|
export {
|
|
340
|
-
|
|
339
|
+
te as TemplateForm
|
|
341
340
|
};
|
package/dist/main.d.ts
CHANGED
|
@@ -772,8 +772,8 @@ K extends
|
|
|
772
772
|
ONTOLOGY.UpdateFileDTO &
|
|
773
773
|
ONTOLOGY.UpdateAgentDTO
|
|
774
774
|
>;
|
|
775
|
-
loading
|
|
776
|
-
agentTemplates
|
|
775
|
+
loading?: boolean;
|
|
776
|
+
agentTemplates?: Map<string | number, ONTOLOGY.Agent>;
|
|
777
777
|
agentsData?: FV.HierarchySearchResults;
|
|
778
778
|
selectedAgentInstances?: INSTANCE.Agent[];
|
|
779
779
|
inputVariant?: "standard" | "outlined" | "filled";
|