@hybridcore/ui 1.4.3 → 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.
@@ -1,4 +1,4 @@
1
- import { jsx as t, jsxs as u } from "react/jsx-runtime";
1
+ import { jsxs as u, jsx as n } from "react/jsx-runtime";
2
2
  import f from "react";
3
3
  import k from "lodash";
4
4
  import { useForm as P, Controller as l } from "react-hook-form";
@@ -6,27 +6,26 @@ 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 { Container as _ } from "../container/index.js";
10
- import { TreeSelect as w } from "../tree-select/index.js";
11
- import { FormLabel as A, Button as b } from "@mui/material";
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
- import { B as y } from "../../Box-BPyg-Ybm.js";
18
- function D(e, x) {
16
+ import { B as p } from "../../Box-BPyg-Ybm.js";
17
+ function B(e, x) {
19
18
  const {
20
19
  register: s,
21
20
  handleSubmit: T,
22
21
  control: i,
23
- formState: { errors: C },
22
+ formState: { errors: v },
24
23
  getValues: h,
25
- reset: v
24
+ reset: C
26
25
  } = P({
27
26
  defaultValues: e.defaultValues
28
- }), [V, F] = f.useState([]), I = (n) => {
29
- const a = new Map(n);
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,8 +35,8 @@ function D(e, x) {
36
35
  });
37
36
  return L(a);
38
37
  }, S = () => {
39
- const n = I(e.mappedTemplates);
40
- F(n);
38
+ const t = I(e.mappedTemplates);
39
+ F(t);
41
40
  }, M = () => {
42
41
  if (e.onCancel) {
43
42
  e.onCancel();
@@ -46,15 +45,15 @@ function D(e, x) {
46
45
  };
47
46
  return f.useImperativeHandle(x, () => ({
48
47
  resetForm() {
49
- v();
48
+ C();
50
49
  }
51
50
  })), f.useEffect(() => (S(), () => {
52
- }), [e.mappedTemplates]), /* @__PURE__ */ t(_, { disableHeader: !0, children: /* @__PURE__ */ u("form", { onSubmit: (n, a) => {
53
- n == null || n.preventDefault(), T(((o) => (p) => {
54
- e.onSubmit(p, o);
51
+ }), [e.mappedTemplates]), /* @__PURE__ */ u("form", { onSubmit: (t, a) => {
52
+ t == null || t.preventDefault(), T(((o) => (y) => {
53
+ e.onSubmit(y, o);
55
54
  })(a))();
56
55
  }, children: [
57
- /* @__PURE__ */ t(
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
- ...C.name && {
64
+ ...v.name && {
66
65
  helperText: "This field is required!",
67
66
  error: !0
68
67
  }
69
68
  }
70
69
  ),
71
- /* @__PURE__ */ t(
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__ */ t(
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__ */ t(
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__ */ t(g, { sx: { mb: 2 }, children: /* @__PURE__ */ t(
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: n, onChange: a } }) => {
106
+ render: ({ field: { value: t, onChange: a } }) => {
108
107
  if (e.disableParent) {
109
- const r = n ? e.mappedTemplates.get(n) : void 0;
110
- return /* @__PURE__ */ t(
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__ */ t(
122
- w,
120
+ return /* @__PURE__ */ n(
121
+ _,
123
122
  {
124
123
  label: "Parent",
125
124
  idKey: "templateKey",
126
125
  data: V,
127
- selected: n ? [n] : "",
126
+ selected: t ? [t] : "",
128
127
  onChange: (r, o) => {
129
128
  a({
130
129
  target: {
@@ -137,12 +136,12 @@ function D(e, x) {
137
136
  }
138
137
  }
139
138
  ) }),
140
- "agentReferenceIds" in e.defaultValues && /* @__PURE__ */ t(
139
+ "agentReferenceIds" in e.defaultValues && /* @__PURE__ */ n(
141
140
  l,
142
141
  {
143
142
  name: "agentReferenceIds",
144
143
  control: i,
145
- render: ({ field: { onChange: n } }) => /* @__PURE__ */ t(
144
+ render: ({ field: { onChange: t } }) => /* @__PURE__ */ n(
146
145
  K,
147
146
  {
148
147
  templates: e.agentTemplates ?? /* @__PURE__ */ new Map(),
@@ -150,7 +149,7 @@ function D(e, x) {
150
149
  inputVariant: e.inputVariant,
151
150
  selectedInstances: e.selectedAgentInstances,
152
151
  onSelect: (a) => {
153
- n({
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__ */ t(
174
+ /* @__PURE__ */ n(
176
175
  d,
177
176
  {
178
- control: /* @__PURE__ */ t(
177
+ control: /* @__PURE__ */ n(
179
178
  l,
180
179
  {
181
180
  name: "creatable",
182
181
  control: i,
183
- render: ({ field: { value: n, ...a } }) => /* @__PURE__ */ t(c, { checked: n, ...a })
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__ */ t(
188
+ /* @__PURE__ */ n(
190
189
  d,
191
190
  {
192
- control: /* @__PURE__ */ t(
191
+ control: /* @__PURE__ */ n(
193
192
  l,
194
193
  {
195
194
  name: "editable",
196
195
  control: i,
197
- render: ({ field: { value: n, ...a } }) => /* @__PURE__ */ t(c, { checked: n, ...a })
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__ */ t(
202
+ "stationary" in e.defaultValues && /* @__PURE__ */ n(
204
203
  d,
205
204
  {
206
- control: /* @__PURE__ */ t(
205
+ control: /* @__PURE__ */ n(
207
206
  l,
208
207
  {
209
208
  name: "stationary",
210
209
  control: i,
211
- render: ({ field: { value: n, ...a } }) => /* @__PURE__ */ t(c, { checked: n, ...a })
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__ */ t(
216
+ "livingObject" in e.defaultValues && /* @__PURE__ */ n(
218
217
  d,
219
218
  {
220
- control: /* @__PURE__ */ t(
219
+ control: /* @__PURE__ */ n(
221
220
  l,
222
221
  {
223
222
  name: "livingObject",
224
223
  control: i,
225
- render: ({ field: { value: n, ...a } }) => /* @__PURE__ */ t(c, { checked: n, ...a })
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__ */ t(
230
+ "storeFile" in e.defaultValues && /* @__PURE__ */ n(
232
231
  d,
233
232
  {
234
- control: /* @__PURE__ */ t(
233
+ control: /* @__PURE__ */ n(
235
234
  l,
236
235
  {
237
236
  name: "storeFile",
238
237
  control: i,
239
- render: ({ field: { value: n, ...a } }) => /* @__PURE__ */ t(c, { checked: n, ...a })
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__ */ t(A, { children: "Icon" }),
248
- /* @__PURE__ */ t(
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: n, onChange: a } }) => /* @__PURE__ */ t(
254
- B,
252
+ render: ({ field: { value: t, onChange: a } }) => /* @__PURE__ */ n(
253
+ A,
255
254
  {
256
255
  list: [],
257
- value: n ?? "",
256
+ value: t ?? "",
258
257
  newIcon: "",
259
258
  onFileUpload: () => {
260
259
  },
@@ -264,15 +263,15 @@ function D(e, x) {
264
263
  }
265
264
  )
266
265
  ] }),
267
- /* @__PURE__ */ t(
266
+ /* @__PURE__ */ n(
268
267
  l,
269
268
  {
270
269
  name: "properties",
271
270
  control: i,
272
- render: ({ field: { value: n, onChange: a } }) => /* @__PURE__ */ t(
271
+ render: ({ field: { value: t, onChange: a } }) => /* @__PURE__ */ n(
273
272
  O,
274
273
  {
275
- list: n || [],
274
+ list: t || [],
276
275
  inputVariant: e.inputVariant,
277
276
  templateId: k.get(e.defaultValues, "id"),
278
277
  disablePropertyId: e.disablePropertyId,
@@ -281,23 +280,23 @@ function D(e, x) {
281
280
  )
282
281
  }
283
282
  ),
284
- "recognitionPropertyList" in e.defaultValues && /* @__PURE__ */ t(
283
+ "recognitionPropertyList" in e.defaultValues && /* @__PURE__ */ n(
285
284
  l,
286
285
  {
287
286
  name: "recognitionPropertyList",
288
287
  control: i,
289
- render: ({ field: { value: n, onChange: a } }) => /* @__PURE__ */ t(
288
+ render: ({ field: { value: t, onChange: a } }) => /* @__PURE__ */ n(
290
289
  j,
291
290
  {
292
- list: n || [],
291
+ list: t || [],
293
292
  getFormValues: h,
294
293
  onChange: a
295
294
  }
296
295
  )
297
296
  }
298
297
  ),
299
- /* @__PURE__ */ u(y, { display: "flex", justifyContent: "space-between", mt: 3, children: [
300
- /* @__PURE__ */ t(
298
+ /* @__PURE__ */ u(p, { display: "flex", justifyContent: "space-between", mt: 3, children: [
299
+ /* @__PURE__ */ n(
301
300
  b,
302
301
  {
303
302
  color: "primary",
@@ -308,20 +307,20 @@ function D(e, x) {
308
307
  children: "Cancel"
309
308
  }
310
309
  ),
311
- /* @__PURE__ */ t(y, { children: e.saveButtons ? e.saveButtons.map((n, a) => /* @__PURE__ */ t(
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: n.icon,
317
+ startIcon: t.icon,
319
318
  sx: { ml: 1, textTransform: "none" },
320
- onClick: n.onClick,
321
- children: n.label
319
+ onClick: t.onClick,
320
+ children: t.label
322
321
  },
323
322
  a
324
- )) : /* @__PURE__ */ t(
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 ae = f.forwardRef(D);
337
+ const te = f.forwardRef(B);
339
338
  export {
340
- ae as TemplateForm
339
+ te as TemplateForm
341
340
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hybridcore/ui",
3
3
  "description": "Hybrid Core UI Library",
4
- "version": "1.4.3",
4
+ "version": "1.4.4",
5
5
  "author": "Hybrid Core",
6
6
  "license": "ISC",
7
7
  "type": "module",