@hybridcore/ui 1.6.1 → 1.6.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.
Files changed (231) hide show
  1. package/CATALOG.md +179 -0
  2. package/README.md +1 -2
  3. package/dist/AccordionSummary-CJppWeqF.js +781 -0
  4. package/dist/Add-CqcD1PWb.js +403 -0
  5. package/dist/Box-DqUMmZjL.js +31 -0
  6. package/dist/Button-C5yquWAB.js +357 -0
  7. package/dist/ButtonBase-BEF7oTOe.js +887 -0
  8. package/dist/{Delete-fBLhTHbF.js → Delete-BdyYpINH.js} +9 -8
  9. package/dist/{DialogContent-CGJ7alb8.js → DialogContent-BvVjD9z3.js} +127 -122
  10. package/dist/FormGroup-CpBsIyYR.js +89 -0
  11. package/dist/{IconButton-_opV1iNK.js → IconButton-BoGwbvrP.js} +26 -26
  12. package/dist/{InputLabel-rEwwnD4_.js → InputLabel-Dd8RrneV.js} +140 -153
  13. package/dist/{MenuItem-DrE50M_p.js → MenuItem-DwqJqzuM.js} +65 -89
  14. package/dist/Modal-MUZygjmQ.js +1158 -0
  15. package/dist/Paper-BkQLdsCI.js +582 -0
  16. package/dist/Select-DHUl_uG3.js +3916 -0
  17. package/dist/SwitchBase-DTndTqI8.js +235 -0
  18. package/dist/TextField-e2oKaUN1.js +669 -0
  19. package/dist/TransitionGroupContext-BDAp2T0O.js +96 -0
  20. package/dist/{Typography-B-Z5Y0Xq.js → Typography-DgsSLCFC.js} +28 -26
  21. package/dist/assertThisInitialized-C1dAyb4j.js +7 -0
  22. package/dist/assets/index4.css +1 -0
  23. package/dist/clsx-OuTLNxxd.js +16 -0
  24. package/dist/components/access/helpers.js +1 -1
  25. package/dist/components/access/logic.js +1 -1
  26. package/dist/components/button/index.js +10 -0
  27. package/dist/components/button/logic.js +26 -0
  28. package/dist/components/button/styled.js +9 -0
  29. package/dist/components/charts/_common/chart-error.js +19 -0
  30. package/dist/components/charts/candlestick/index.js +3 -3
  31. package/dist/components/charts/candlestick/logic.js +123 -113
  32. package/dist/components/charts/chart-wrapper/index.js +5 -5
  33. package/dist/components/charts/column-line-mix/index.js +9 -8
  34. package/dist/components/charts/column-line-mix/logic.js +68 -71
  35. package/dist/components/charts/drill-down-treemap/index.js +8 -7
  36. package/dist/components/charts/drill-down-treemap/logic.js +138 -144
  37. package/dist/components/charts/drill-down-voronoi-treemap/index.js +9 -8
  38. package/dist/components/charts/drill-down-voronoi-treemap/logic.js +222 -228
  39. package/dist/components/charts/heatmap/index.js +9 -8
  40. package/dist/components/charts/heatmap/logic.js +167 -173
  41. package/dist/components/charts/highlighting-line-data/index.js +3 -3
  42. package/dist/components/charts/line/index.js +9 -8
  43. package/dist/components/charts/line/logic.js +74 -79
  44. package/dist/components/charts/logaritmic-scale/index.js +9 -8
  45. package/dist/components/charts/logaritmic-scale/logic.js +63 -69
  46. package/dist/components/charts/multiple-value-axes/index.js +9 -8
  47. package/dist/components/charts/multiple-value-axes/logic.js +101 -107
  48. package/dist/components/charts/nested-pie/index.js +9 -8
  49. package/dist/components/charts/nested-pie/logic.js +62 -68
  50. package/dist/components/charts/packed-circles/index.js +7 -6
  51. package/dist/components/charts/packed-circles/logic.js +50 -56
  52. package/dist/components/charts/pie-chart/index.js +9 -8
  53. package/dist/components/charts/pie-chart/logic.js +49 -54
  54. package/dist/components/charts/stacked-area-radar/index.js +8 -7
  55. package/dist/components/charts/stacked-area-radar/logic.js +113 -118
  56. package/dist/components/charts/stacked-column-chart/index.js +9 -8
  57. package/dist/components/charts/stacked-column-chart/logic.js +78 -84
  58. package/dist/components/charts/xy-chart/index.js +9 -8
  59. package/dist/components/charts/xy-chart/logic.js +56 -60
  60. package/dist/components/collapsible-card/index.js +11 -10
  61. package/dist/components/collapsible-card/styled.js +1 -1
  62. package/dist/components/color-picker/index.js +7120 -0
  63. package/dist/components/color-picker/logic.js +18 -0
  64. package/dist/components/color-picker/styled.js +7 -0
  65. package/dist/components/confirm/dialog.js +3 -3
  66. package/dist/components/confirm/index.js +1 -1
  67. package/dist/components/data-grid/index.js +22 -0
  68. package/dist/components/data-grid/logic.js +15 -0
  69. package/dist/components/data-grid/styled.js +20 -0
  70. package/dist/components/data-map/components/controls/index.js +4 -6
  71. package/dist/components/data-map/index.js +11 -11
  72. package/dist/components/data-security-selectors/dissemination-list/index.js +192 -191
  73. package/dist/components/data-security-selectors/dissemination-list/styled.js +12 -12
  74. package/dist/components/data-security-selectors/security-level/index.js +18 -15
  75. package/dist/components/data-security-selectors/security-level/logic.js +18 -63
  76. package/dist/components/data-security-selectors/security-level/styled.js +23 -17
  77. package/dist/components/date-picker-with-custom-range/index.js +1 -1
  78. package/dist/components/date-range-picker/index.js +2748 -0
  79. package/dist/components/date-range-picker/styled.js +14 -0
  80. package/dist/components/date-time-picker/index.js +45 -46
  81. package/dist/components/divider/index.js +11 -11
  82. package/dist/components/document-viewer/components/action-buttons/index.js +15 -15
  83. package/dist/components/document-viewer/components/navigation/index.js +9 -9
  84. package/dist/components/document-viewer/components/viewer/index.js +31 -35
  85. package/dist/components/document-viewer/index.js +31 -39
  86. package/dist/components/document-viewer/logic.js +41 -34
  87. package/dist/components/document-viewer/styled.js +115 -27
  88. package/dist/components/duration-select/index.js +27 -0
  89. package/dist/components/duration-select/logic.js +21 -0
  90. package/dist/components/duration-select/styled.js +26 -0
  91. package/dist/components/editable-text/index.js +20 -0
  92. package/dist/components/editable-text/logic.js +18 -0
  93. package/dist/components/editable-text/styled.js +22 -0
  94. package/dist/components/geometry-picker/coordinate/index.js +29 -29
  95. package/dist/components/geometry-picker/edit/index.js +18 -18
  96. package/dist/components/geometry-picker/geometry/index.js +67 -67
  97. package/dist/components/geometry-picker/geometry/map-overlay.js +6 -6
  98. package/dist/components/geometry-picker/index.js +69 -86
  99. package/dist/components/geometry-picker/kml/index.js +16 -16
  100. package/dist/components/geometry-picker/logic.js +50 -57
  101. package/dist/components/geometry-picker/map/index.js +8 -8
  102. package/dist/components/geometry-picker/parser/coordinate-input/index.js +4 -4
  103. package/dist/components/geometry-picker/parser/index.js +46 -50
  104. package/dist/components/geometry-picker/parser/styled.js +22 -4
  105. package/dist/components/geometry-picker/styled.js +97 -37
  106. package/dist/components/geometry-picker/wkt/index.js +13 -13
  107. package/dist/components/heat-map/components/controls/index.js +4 -6
  108. package/dist/components/heat-map/components/legend/index.js +15 -17
  109. package/dist/components/heat-map/index.js +7 -7
  110. package/dist/components/instance-form/components/TopLabelWrapper.js +8 -48
  111. package/dist/components/instance-form/components/composite-list/index.js +5 -3
  112. package/dist/components/instance-form/components/composite-matrix/components/editable-table/index.js +83 -74
  113. package/dist/components/instance-form/components/composite-matrix/components/editor/index.js +45 -66
  114. package/dist/components/instance-form/components/composite-matrix/components/form/index.js +60 -75
  115. package/dist/components/instance-form/components/composite-matrix/components/json-editor/index.js +2425 -2422
  116. package/dist/components/instance-form/components/composite-matrix/components/table/index.js +33 -52
  117. package/dist/components/instance-form/components/composite-matrix/index.js +30 -36
  118. package/dist/components/instance-form/components/policy-list/index.js +47 -81
  119. package/dist/components/instance-form/components/variable/index.js +6 -9
  120. package/dist/components/instance-form/components/variables/index.js +48 -55
  121. package/dist/components/instance-form/helpers.js +9 -0
  122. package/dist/components/instance-form/index.js +402 -518
  123. package/dist/components/instance-form/logic.js +115 -0
  124. package/dist/components/instance-form/styled.js +487 -0
  125. package/dist/components/instance-hierarchy-table/styled.js +1 -1
  126. package/dist/components/instance-variable-list/index.js +11 -11
  127. package/dist/components/map/index.js +28 -6
  128. package/dist/components/map/styled.js +1 -1
  129. package/dist/components/notification/index.js +67 -0
  130. package/dist/components/notification/logic.js +30 -0
  131. package/dist/components/notification/store.js +23 -0
  132. package/dist/components/notification/styled.js +52 -0
  133. package/dist/components/object-profile-card/components/avatar/index.js +9 -10
  134. package/dist/components/object-profile-card/index.js +19 -20
  135. package/dist/components/paginated-list/index.js +2 -3
  136. package/dist/components/placeholder/index.js +10 -0
  137. package/dist/components/placeholder/logic.js +12 -0
  138. package/dist/components/placeholder/styled.js +32 -0
  139. package/dist/components/positional-tooltip/index.js +24 -0
  140. package/dist/components/positional-tooltip/styled.js +17 -0
  141. package/dist/components/property-mapping/index.js +204 -423
  142. package/dist/components/property-mapping/logic.js +156 -0
  143. package/dist/components/property-mapping/styled.js +199 -0
  144. package/dist/components/prr-map/components/controls/index.js +4 -6
  145. package/dist/components/prr-map/components/legend/index.js +26 -28
  146. package/dist/components/prr-map/index.js +5 -5
  147. package/dist/components/range-selector/styled.js +1106 -1034
  148. package/dist/components/raster-grid-map/components/controls/index.js +4 -6
  149. package/dist/components/raster-grid-map/components/legend/index.js +4 -6
  150. package/dist/components/raster-grid-map/index.js +5 -5
  151. package/dist/components/scroll-drag/index.js +22 -0
  152. package/dist/components/scroll-drag/logic.js +39 -0
  153. package/dist/components/scroll-drag/styled.js +17 -0
  154. package/dist/components/search-input/logic.js +35 -33
  155. package/dist/components/simple-pivot-table/index.js +12 -12
  156. package/dist/components/sortable-list/index.js +599 -0
  157. package/dist/components/sortable-list/logic.js +18 -0
  158. package/dist/components/sortable-list/styled.js +38 -0
  159. package/dist/components/static-text/index.js +6 -6
  160. package/dist/components/stats-box/index.js +12 -0
  161. package/dist/components/stats-box/styled.js +36 -0
  162. package/dist/components/template-form/components/property-list/index.js +27 -26
  163. package/dist/components/template-form/components/property-list/property-list-columns.js +3 -3
  164. package/dist/components/template-form/components/property-list/property-list-form.js +758 -12
  165. package/dist/components/template-form/components/recognition-property-list/index.js +11 -11
  166. package/dist/components/template-form/components/recognition-property-list/recognition-property-list-columns.js +2 -2
  167. package/dist/components/template-form/components/recognition-property-list/recognition-property-list-form.js +24 -22
  168. package/dist/components/template-form/components/select-icon/index.js +24 -24
  169. package/dist/components/template-form/helpers.js +17 -0
  170. package/dist/components/template-form/index.js +270 -308
  171. package/dist/components/template-form/logic.js +69 -0
  172. package/dist/components/template-form/styled.js +84 -0
  173. package/dist/components/text-overflow/index.js +6 -0
  174. package/dist/components/text-overflow/styled.js +13 -0
  175. package/dist/components/timeline/index.js +12 -12
  176. package/dist/components/toggle-view-button/index.js +35 -0
  177. package/dist/components/toggle-view-button/logic.js +22 -0
  178. package/dist/components/toggle-view-button/styled.js +11 -0
  179. package/dist/components/tree-select/index.js +1 -1
  180. package/dist/components/visually-hidden-input/index.js +4 -0
  181. package/dist/components/visually-hidden-input/styled.js +18 -0
  182. package/dist/createChainedFunction-C0nujS3O.js +9 -0
  183. package/dist/{createSvgIcon-DX-SqL8M.js → createSvgIcon-Ch_cT8az.js} +68 -65
  184. package/dist/createSvgIcon-DuDuASu1.js +62 -0
  185. package/dist/debounce-46wSf_lW.js +15 -0
  186. package/dist/{dialog-cf4HUXXl.js → dialog-BYRnCztH.js} +30 -29
  187. package/dist/formControlState-vgaj2ksH.js +10 -0
  188. package/dist/generateUtilityClasses-C3ivN9Ie.js +2973 -0
  189. package/dist/{helpers-B4UL9NMD.js → helpers-D4uXfBfO.js} +2 -2
  190. package/dist/index-BtlzPygz.js +470 -0
  191. package/dist/index-DH6qsPBn.js +153 -0
  192. package/dist/{index-C8C3YXle.js → index-e9xTIYWt.js} +139 -137
  193. package/dist/main.d.ts +1054 -330
  194. package/dist/main.js +163 -130
  195. package/dist/ownerWindow-wg6foiOE.js +10 -0
  196. package/dist/setPrototypeOf-NPgp4cYc.js +8 -0
  197. package/dist/styled-Db1RdcPA.js +323 -0
  198. package/dist/unsupportedProp-DuqR2hj9.js +36 -0
  199. package/dist/useFormControl-CatNKXAi.js +10 -0
  200. package/dist/useId-BW-oWmul.js +19 -0
  201. package/dist/{useMobilePicker-B-M3dnTn.js → useMobilePicker-CY8ndYRL.js} +4777 -4491
  202. package/dist/useSlot-B_Q4vnX5.js +42 -0
  203. package/package.json +15 -7
  204. package/dist/AccordionSummary-CMg08YSA.js +0 -739
  205. package/dist/Add-DuVVJeQU.js +0 -380
  206. package/dist/ButtonBase-sObABYY2.js +0 -965
  207. package/dist/FormControl-BCurCxRj.js +0 -1294
  208. package/dist/FormControlLabel-BkRfrhNy.js +0 -601
  209. package/dist/InputAdornment-C7PEvvYr.js +0 -155
  210. package/dist/Modal-DlB6GH-f.js +0 -1659
  211. package/dist/Paper-q9kKjAKx.js +0 -527
  212. package/dist/TextField-DSDIEEKu.js +0 -3161
  213. package/dist/assertThisInitialized-BUtkG-md.js +0 -13
  214. package/dist/capitalize-quqpGCFu.js +0 -9
  215. package/dist/components/instance-form/components/composite-list/styled.js +0 -73
  216. package/dist/components/instance-form/components/composite-matrix/components/editor/styled.js +0 -1
  217. package/dist/components/instance-form/components/composite-matrix/styled.js +0 -69
  218. package/dist/components/key-protection/index.js +0 -47
  219. package/dist/components/key-protection/logic.js +0 -40
  220. package/dist/components/key-protection/styled.js +0 -45
  221. package/dist/components/key-protection/utils.js +0 -10
  222. package/dist/createSvgIcon-BM3-TsGy.js +0 -70
  223. package/dist/index-BMS1Otro.js +0 -183
  224. package/dist/index-DPKUmQnz.js +0 -501
  225. package/dist/index-kCJ_Zvl8.js +0 -34
  226. package/dist/isMuiElement-BkJ72LB3.js +0 -26
  227. package/dist/property-list-form-DL_dEoNn.js +0 -381
  228. package/dist/styled-Bsjp3kFh.js +0 -668
  229. package/dist/unsupportedProp-BND8AB6O.js +0 -25
  230. package/dist/useId-B4-oF9Mq.js +0 -34
  231. package/dist/utils-Cxu-fHjQ.js +0 -115
@@ -1,339 +1,301 @@
1
- import { jsxs as u, jsx as n } from "react/jsx-runtime";
2
- import k from "lodash";
3
- import f from "react";
4
- import { useForm as P, Controller as i } from "react-hook-form";
5
- import { CatalogueInstanceSelector as O } from "./components/catalogue-instance-selector/index.js";
6
- import j from "./components/property-list/index.js";
7
- import K from "./components/recognition-property-list/index.js";
8
- import { FormLabel as L, Button as g } from "@mui/material";
9
- import { getNestedChildrenFromMap as _ } from "../../utils/ontology.js";
10
- import { TreeSelect as w } from "../tree-select/index.js";
11
- import A from "./components/select-icon/index.js";
12
- import { T as m } from "../../TextField-DSDIEEKu.js";
13
- import { F as h } from "../../property-list-form-DL_dEoNn.js";
14
- import { F as d, C as c } from "../../FormControlLabel-BkRfrhNy.js";
15
- import { B as x } from "../../MenuItem-DrE50M_p.js";
16
- function B(e, p) {
17
- const {
18
- register: s,
19
- handleSubmit: T,
20
- control: l,
21
- formState: { errors: v },
22
- getValues: b,
23
- reset: V
24
- } = P({
25
- defaultValues: e.defaultValues
26
- }), [C, F] = f.useState([]), I = (t) => {
27
- const a = new Map(t);
28
- for (const [r, o] of a)
29
- a.set(r, {
30
- ...o,
31
- label: o.name,
32
- value: o.templateKey,
33
- checked: b("parent") === o.templateKey
34
- });
35
- return _(a, !1);
36
- }, S = () => {
37
- const t = I(e.mappedTemplates);
38
- F(t);
39
- }, M = () => {
40
- if (e.onCancel) {
41
- e.onCancel();
42
- return;
43
- }
44
- };
45
- return f.useImperativeHandle(p, () => ({
46
- getValues: b,
47
- resetForm() {
48
- V();
49
- }
50
- })), f.useEffect(() => (S(), () => {
51
- }), [e.mappedTemplates]), /* @__PURE__ */ u("form", { onSubmit: (t, a) => {
52
- t == null || t.preventDefault(), T(((o) => (y) => {
53
- e.onSubmit(y, o);
54
- })(a))();
55
- }, children: [
56
- /* @__PURE__ */ n(
57
- m,
58
- {
59
- label: "Name *",
60
- variant: e.inputVariant,
61
- fullWidth: !0,
62
- sx: { mb: 2 },
63
- ...s("name", { required: !0 }),
64
- ...v.name && {
65
- helperText: "This field is required!",
66
- error: !0
67
- }
68
- }
69
- ),
70
- /* @__PURE__ */ n(
71
- m,
72
- {
73
- label: "Template Key",
74
- variant: e.inputVariant,
75
- fullWidth: !0,
76
- disabled: e.disableTemlateKey,
77
- sx: { mb: 2 },
78
- ...s("templateKey")
79
- }
80
- ),
81
- /* @__PURE__ */ n(
82
- m,
83
- {
84
- label: "Description",
85
- variant: e.inputVariant,
86
- fullWidth: !0,
87
- sx: { mb: 2 },
88
- ...s("description")
89
- }
90
- ),
91
- /* @__PURE__ */ n(
92
- m,
93
- {
94
- label: "Version",
95
- variant: e.inputVariant,
96
- fullWidth: !0,
97
- sx: { mb: 2 },
98
- ...s("version")
99
- }
100
- ),
101
- /* @__PURE__ */ n(h, { sx: { mb: 2 }, children: /* @__PURE__ */ n(
102
- i,
103
- {
104
- name: "parent",
105
- control: l,
106
- render: ({ field: { value: t, onChange: a } }) => {
107
- if (e.disableParent) {
108
- const r = t ? e.mappedTemplates.get(t) : void 0;
109
- return /* @__PURE__ */ n(
110
- m,
111
- {
112
- label: "Parent",
113
- variant: e.inputVariant,
114
- fullWidth: !0,
115
- disabled: !0,
116
- value: (r == null ? void 0 : r.name) || "-"
117
- }
118
- );
1
+ import { jsxs as g, jsx as e } from "react/jsx-runtime";
2
+ import S from "lodash";
3
+ import p from "react";
4
+ import { Controller as o } from "react-hook-form";
5
+ import { FormControlLabel as c, Checkbox as m, FormLabel as y } from "@mui/material";
6
+ import { CatalogueInstanceSelector as C } from "./components/catalogue-instance-selector/index.js";
7
+ import { PropertyList as I } from "./components/property-list/index.js";
8
+ import { RecognitionPropertyList as V } from "./components/recognition-property-list/index.js";
9
+ import { SelectIcon as k } from "./components/select-icon/index.js";
10
+ import { TreeSelect as x } from "../tree-select/index.js";
11
+ import { LabeledField as d } from "./helpers.js";
12
+ import { useTemplateFormLogic as M } from "./logic.js";
13
+ import { TemplateFormRoot as L, TemplateFormField as s, TemplateFormFieldGroup as v, TemplateFormCheckboxesRow as R, TemplateFormActionsRow as j, TemplateFormCancelButton as w, TemplateFormActionsRight as A, TemplateFormExtraSaveButton as O, TemplateFormSaveButton as K } from "./styled.js";
14
+ function B(t, P) {
15
+ const { refs: F, state: n, form: T, actions: b } = M(t), { control: l, register: u, getValues: h } = T;
16
+ return p.useImperativeHandle(P, () => ({
17
+ getValues: h,
18
+ resetForm: b.resetForm
19
+ })), /* @__PURE__ */ g(
20
+ L,
21
+ {
22
+ ref: F.rootRef,
23
+ sx: n.sx,
24
+ onSubmit: b.handleFormSubmit,
25
+ children: [
26
+ /* @__PURE__ */ e(d, { label: "Name", required: !0, labelPosition: n.labelPosition, children: /* @__PURE__ */ e(
27
+ s,
28
+ {
29
+ label: n.labelPosition === "default" ? "Name *" : void 0,
30
+ variant: n.inputVariant,
31
+ fullWidth: !0,
32
+ ...u("name", { required: !0 }),
33
+ ...n.errors.name && {
34
+ helperText: "This field is required!",
35
+ error: !0
36
+ }
119
37
  }
120
- return /* @__PURE__ */ n(
121
- w,
122
- {
123
- label: "Parent",
124
- idKey: "templateKey",
125
- data: C,
126
- selected: t ? [t] : "",
127
- onChange: (r, o) => {
128
- a({
129
- target: {
130
- value: o ? r : ""
38
+ ) }),
39
+ /* @__PURE__ */ e(d, { label: "Template Key", labelPosition: n.labelPosition, children: /* @__PURE__ */ e(
40
+ s,
41
+ {
42
+ label: n.labelPosition === "default" ? "Template Key" : void 0,
43
+ variant: n.inputVariant,
44
+ fullWidth: !0,
45
+ disabled: t.disableTemplateKey,
46
+ ...u("templateKey")
47
+ }
48
+ ) }),
49
+ /* @__PURE__ */ e(d, { label: "Description", labelPosition: n.labelPosition, children: /* @__PURE__ */ e(
50
+ s,
51
+ {
52
+ label: n.labelPosition === "default" ? "Description" : void 0,
53
+ variant: n.inputVariant,
54
+ fullWidth: !0,
55
+ ...u("description")
56
+ }
57
+ ) }),
58
+ /* @__PURE__ */ e(d, { label: "Version", labelPosition: n.labelPosition, children: /* @__PURE__ */ e(
59
+ s,
60
+ {
61
+ label: n.labelPosition === "default" ? "Version" : void 0,
62
+ variant: n.inputVariant,
63
+ fullWidth: !0,
64
+ ...u("version")
65
+ }
66
+ ) }),
67
+ /* @__PURE__ */ e(d, { label: "Parent", labelPosition: n.labelPosition, children: /* @__PURE__ */ e(v, { children: /* @__PURE__ */ e(
68
+ o,
69
+ {
70
+ name: "parent",
71
+ control: l,
72
+ render: ({ field: { value: a, onChange: i } }) => {
73
+ if (t.disableParent) {
74
+ const r = a ? t.templates.get(a) : void 0;
75
+ return /* @__PURE__ */ e(
76
+ s,
77
+ {
78
+ label: n.labelPosition === "default" ? "Parent" : void 0,
79
+ variant: n.inputVariant,
80
+ fullWidth: !0,
81
+ disabled: !0,
82
+ value: (r == null ? void 0 : r.name) || "-"
131
83
  }
132
- }), S();
84
+ );
133
85
  }
86
+ return /* @__PURE__ */ e(
87
+ x,
88
+ {
89
+ label: n.labelPosition === "default" ? "Parent" : void 0,
90
+ idKey: "templateKey",
91
+ data: n.parents,
92
+ selected: a ? [a] : "",
93
+ onChange: (r, f) => {
94
+ i({ target: { value: f ? r : "" } }), b.refreshParents();
95
+ }
96
+ }
97
+ );
134
98
  }
135
- );
136
- }
137
- }
138
- ) }),
139
- "agentReferenceIds" in e.defaultValues && /* @__PURE__ */ n(
140
- i,
141
- {
142
- name: "agentReferenceIds",
143
- control: l,
144
- render: ({ field: { onChange: t } }) => /* @__PURE__ */ n(
145
- O,
99
+ }
100
+ ) }) }),
101
+ "agentReferenceIds" in t.values && /* @__PURE__ */ e(
102
+ o,
146
103
  {
147
- templates: e.agentTemplates ?? /* @__PURE__ */ new Map(),
148
- data: e.agentsData,
149
- inputVariant: e.inputVariant,
150
- selectedInstances: e.selectedAgentInstances,
151
- onSelect: (a) => {
152
- t({
153
- target: {
154
- value: a
104
+ name: "agentReferenceIds",
105
+ control: l,
106
+ render: ({ field: { onChange: a } }) => /* @__PURE__ */ e(
107
+ C,
108
+ {
109
+ templates: t.agentTemplates ?? /* @__PURE__ */ new Map(),
110
+ data: t.agentsData,
111
+ inputVariant: n.inputVariant,
112
+ selectedInstances: t.selectedAgentInstances,
113
+ onSelect: (i) => {
114
+ a({ target: { value: i } }), t.onAgentSelect && t.onAgentSelect(i);
115
+ },
116
+ onSearchSubmit: t.onCatalogueInstanceSearchSubmit,
117
+ openMapping: t.openMapping ?? !1,
118
+ mappingData: t.mappingData ?? [],
119
+ objectTemplate: t.objectTemplate ?? {},
120
+ mapboxAccessToken: t.mapboxAccessToken ?? "",
121
+ onMappingSubmit: t.onMappingSubmit ? t.onMappingSubmit : () => {
122
+ },
123
+ onMappingOpen: t.onMappingOpen ? t.onMappingOpen : () => {
124
+ },
125
+ onMappingClose: t.onMappingClose ? t.onMappingClose : () => {
155
126
  }
156
- }), e.onAgentSelect && e.onAgentSelect(a);
157
- },
158
- onSearchSubmit: e.onCatalogueInstanceSearchSubmit,
159
- openMapping: e.openMapping ?? !1,
160
- mappingData: e.mappingData ?? [],
161
- objectTemplate: e.objectTemplate ?? {},
162
- mapboxAccessToken: e.mapboxAccessToken ?? "",
163
- onMappingSubmit: e.onMappingSubmit ? e.onMappingSubmit : () => {
164
- },
165
- onMappingOpen: e.onMappingOpen ? e.onMappingOpen : () => {
166
- },
167
- onMappingClose: e.onMappingClose ? e.onMappingClose : () => {
168
- }
127
+ }
128
+ )
169
129
  }
170
- )
171
- }
172
- ),
173
- /* @__PURE__ */ u(h, { row: !0, sx: { mb: 2 }, children: [
174
- /* @__PURE__ */ n(
175
- d,
176
- {
177
- control: /* @__PURE__ */ n(
178
- i,
130
+ ),
131
+ /* @__PURE__ */ g(R, { row: !0, children: [
132
+ /* @__PURE__ */ e(
133
+ c,
179
134
  {
180
- name: "creatable",
181
- control: l,
182
- render: ({ field: { value: t, ...a } }) => /* @__PURE__ */ n(c, { checked: t, ...a })
135
+ control: /* @__PURE__ */ e(
136
+ o,
137
+ {
138
+ name: "creatable",
139
+ control: l,
140
+ render: ({ field: { value: a, ...i } }) => /* @__PURE__ */ e(m, { checked: a, ...i })
141
+ }
142
+ ),
143
+ label: "Creatable"
183
144
  }
184
145
  ),
185
- label: "Creatable"
186
- }
187
- ),
188
- /* @__PURE__ */ n(
189
- d,
190
- {
191
- control: /* @__PURE__ */ n(
192
- i,
146
+ /* @__PURE__ */ e(
147
+ c,
193
148
  {
194
- name: "editable",
195
- control: l,
196
- render: ({ field: { value: t, ...a } }) => /* @__PURE__ */ n(c, { checked: t, ...a })
149
+ control: /* @__PURE__ */ e(
150
+ o,
151
+ {
152
+ name: "editable",
153
+ control: l,
154
+ render: ({ field: { value: a, ...i } }) => /* @__PURE__ */ e(m, { checked: a, ...i })
155
+ }
156
+ ),
157
+ label: "Editable"
197
158
  }
198
159
  ),
199
- label: "Editable"
200
- }
201
- ),
202
- "stationary" in e.defaultValues && /* @__PURE__ */ n(
203
- d,
204
- {
205
- control: /* @__PURE__ */ n(
206
- i,
160
+ "stationary" in t.values && /* @__PURE__ */ e(
161
+ c,
207
162
  {
208
- name: "stationary",
209
- control: l,
210
- render: ({ field: { value: t, ...a } }) => /* @__PURE__ */ n(c, { checked: t, ...a })
163
+ control: /* @__PURE__ */ e(
164
+ o,
165
+ {
166
+ name: "stationary",
167
+ control: l,
168
+ render: ({ field: { value: a, ...i } }) => /* @__PURE__ */ e(m, { checked: a, ...i })
169
+ }
170
+ ),
171
+ label: "Stationary"
211
172
  }
212
173
  ),
213
- label: "Stationary"
214
- }
215
- ),
216
- "livingObject" in e.defaultValues && /* @__PURE__ */ n(
217
- d,
218
- {
219
- control: /* @__PURE__ */ n(
220
- i,
174
+ "livingObject" in t.values && /* @__PURE__ */ e(
175
+ c,
221
176
  {
222
- name: "livingObject",
223
- control: l,
224
- render: ({ field: { value: t, ...a } }) => /* @__PURE__ */ n(c, { checked: t, ...a })
177
+ control: /* @__PURE__ */ e(
178
+ o,
179
+ {
180
+ name: "livingObject",
181
+ control: l,
182
+ render: ({ field: { value: a, ...i } }) => /* @__PURE__ */ e(m, { checked: a, ...i })
183
+ }
184
+ ),
185
+ label: "Living Object"
225
186
  }
226
187
  ),
227
- label: "Living Object"
228
- }
229
- ),
230
- "storeFile" in e.defaultValues && /* @__PURE__ */ n(
231
- d,
232
- {
233
- control: /* @__PURE__ */ n(
234
- i,
188
+ "storeFile" in t.values && /* @__PURE__ */ e(
189
+ c,
235
190
  {
236
- name: "storeFile",
237
- control: l,
238
- render: ({ field: { value: t, ...a } }) => /* @__PURE__ */ n(c, { checked: t, ...a })
191
+ control: /* @__PURE__ */ e(
192
+ o,
193
+ {
194
+ name: "storeFile",
195
+ control: l,
196
+ render: ({ field: { value: a, ...i } }) => /* @__PURE__ */ e(m, { checked: a, ...i })
197
+ }
198
+ ),
199
+ label: "Store File"
239
200
  }
240
- ),
241
- label: "Store File"
242
- }
243
- )
244
- ] }),
245
- /* @__PURE__ */ u(h, { children: [
246
- /* @__PURE__ */ n(L, { children: "Icon" }),
247
- /* @__PURE__ */ n(
248
- i,
249
- {
250
- name: "icon",
251
- control: l,
252
- render: ({ field: { value: t, onChange: a } }) => /* @__PURE__ */ n(
253
- A,
201
+ )
202
+ ] }),
203
+ /* @__PURE__ */ e(d, { label: "Icon", labelPosition: n.labelPosition, children: /* @__PURE__ */ g(v, { children: [
204
+ n.labelPosition === "default" && /* @__PURE__ */ e(y, { children: "Icon" }),
205
+ /* @__PURE__ */ e(
206
+ o,
254
207
  {
255
- list: [],
256
- value: t ?? "",
257
- newIcon: "",
258
- onFileUpload: a,
259
- onChange: a
208
+ name: "icon",
209
+ control: l,
210
+ render: ({ field: { value: a, onChange: i } }) => /* @__PURE__ */ e(
211
+ k,
212
+ {
213
+ list: t.iconList ?? [],
214
+ value: a ?? "",
215
+ newIcon: t.newIcon ?? null,
216
+ loading: t.iconUploading,
217
+ onFileUpload: (r) => {
218
+ var f;
219
+ return (f = t.onIconUpload) == null ? void 0 : f.call(t, r);
220
+ },
221
+ onChange: i
222
+ }
223
+ )
260
224
  }
261
225
  )
262
- }
263
- )
264
- ] }),
265
- /* @__PURE__ */ n(
266
- i,
267
- {
268
- name: "properties",
269
- control: l,
270
- render: ({ field: { value: t, onChange: a } }) => /* @__PURE__ */ n(
271
- j,
226
+ ] }) }),
227
+ /* @__PURE__ */ e(
228
+ o,
272
229
  {
273
- list: t || [],
274
- inputVariant: e.inputVariant,
275
- templateId: k.get(e.defaultValues, "id"),
276
- disablePropertyId: e.disablePropertyId,
277
- onChange: a
230
+ name: "properties",
231
+ control: l,
232
+ render: ({ field: { value: a, onChange: i } }) => /* @__PURE__ */ e(
233
+ I,
234
+ {
235
+ list: a || [],
236
+ inputVariant: n.inputVariant,
237
+ labelPosition: n.labelPosition,
238
+ templateId: S.get(t.values, "id"),
239
+ disablePropertyId: t.disablePropertyId,
240
+ onChange: i
241
+ }
242
+ )
278
243
  }
279
- )
280
- }
281
- ),
282
- "recognitionPropertyList" in e.defaultValues && /* @__PURE__ */ n(
283
- i,
284
- {
285
- name: "recognitionPropertyList",
286
- control: l,
287
- render: ({ field: { value: t, onChange: a } }) => /* @__PURE__ */ n(
288
- K,
244
+ ),
245
+ "recognitionPropertyList" in t.values && /* @__PURE__ */ e(
246
+ o,
289
247
  {
290
- list: t || [],
291
- getFormValues: b,
292
- onChange: a
248
+ name: "recognitionPropertyList",
249
+ control: l,
250
+ render: ({ field: { value: a, onChange: i } }) => /* @__PURE__ */ e(
251
+ V,
252
+ {
253
+ list: a || [],
254
+ getFormValues: h,
255
+ onChange: i
256
+ }
257
+ )
293
258
  }
294
- )
295
- }
296
- ),
297
- /* @__PURE__ */ u(x, { display: "flex", justifyContent: "space-between", mt: 3, children: [
298
- /* @__PURE__ */ n(
299
- g,
300
- {
301
- color: "primary",
302
- variant: "text",
303
- disabled: e.loading,
304
- sx: { textTransform: "none" },
305
- onClick: M,
306
- children: "Cancel"
307
- }
308
- ),
309
- /* @__PURE__ */ n(x, { children: e.saveButtons ? e.saveButtons.map((t, a) => /* @__PURE__ */ n(
310
- g,
311
- {
312
- type: "submit",
313
- color: "primary",
314
- variant: "contained",
315
- disabled: e.loading,
316
- startIcon: t.icon,
317
- sx: { ml: 1, textTransform: "none" },
318
- onClick: t.onClick,
319
- children: t.label
320
- },
321
- a
322
- )) : /* @__PURE__ */ n(
323
- g,
324
- {
325
- type: "submit",
326
- color: "primary",
327
- variant: "contained",
328
- disabled: e.loading,
329
- sx: { textTransform: "none" },
330
- children: e.loading ? "Saving..." : "Save"
331
- }
332
- ) })
333
- ] })
334
- ] });
259
+ ),
260
+ /* @__PURE__ */ g(j, { children: [
261
+ /* @__PURE__ */ e(
262
+ w,
263
+ {
264
+ color: "primary",
265
+ variant: "text",
266
+ disabled: n.loading,
267
+ onClick: b.handleOnCancel,
268
+ children: "Cancel"
269
+ }
270
+ ),
271
+ /* @__PURE__ */ e(A, { children: t.saveButtons ? t.saveButtons.map((a, i) => /* @__PURE__ */ e(
272
+ O,
273
+ {
274
+ type: "submit",
275
+ color: "primary",
276
+ variant: "contained",
277
+ disabled: n.loading,
278
+ startIcon: a.icon,
279
+ onClick: a.onClick,
280
+ children: a.label
281
+ },
282
+ i
283
+ )) : /* @__PURE__ */ e(
284
+ K,
285
+ {
286
+ type: "submit",
287
+ color: "primary",
288
+ variant: "contained",
289
+ disabled: n.loading,
290
+ children: n.loading ? "Saving..." : "Save"
291
+ }
292
+ ) })
293
+ ] })
294
+ ]
295
+ }
296
+ );
335
297
  }
336
- const ee = f.forwardRef(B);
298
+ const Z = p.forwardRef(B);
337
299
  export {
338
- ee as TemplateForm
300
+ Z as TemplateForm
339
301
  };
@@ -0,0 +1,69 @@
1
+ import { useThemeProps as K } from "@mui/material";
2
+ import { useRef as M, useState as N, useEffect as R } from "react";
3
+ import { useForm as D } from "react-hook-form";
4
+ import { getNestedChildrenFromMap as E } from "../../utils/ontology.js";
5
+ const z = (f) => {
6
+ const s = K({ props: f, name: "HCTemplateForm" }), {
7
+ values: i,
8
+ inputVariant: a = "outlined",
9
+ labelPosition: n = "default",
10
+ loading: l = !1,
11
+ templates: m,
12
+ onCancel: c,
13
+ onSubmit: d
14
+ } = s, h = M(null), S = D({ defaultValues: i }), { control: g, formState: F, getValues: p, handleSubmit: b, register: T, reset: x } = S, [C, P] = N([]), w = (e) => {
15
+ const o = new Map(e);
16
+ for (const [r, t] of o)
17
+ o.set(r, {
18
+ ...t,
19
+ label: t.name,
20
+ value: t.templateKey,
21
+ checked: p("parent") === t.templateKey
22
+ });
23
+ return E(o, !1);
24
+ }, u = () => {
25
+ P(w(m));
26
+ };
27
+ R(() => (u(), () => {
28
+ }), [m]);
29
+ const y = () => {
30
+ c && c();
31
+ }, V = (e, o) => {
32
+ var r;
33
+ (r = e == null ? void 0 : e.preventDefault) == null || r.call(e), b((t) => {
34
+ d(t, o);
35
+ })();
36
+ }, k = () => {
37
+ x();
38
+ };
39
+ return {
40
+ refs: { rootRef: h },
41
+ state: {
42
+ ownerState: {
43
+ inputVariant: a,
44
+ labelPosition: n,
45
+ loading: l
46
+ },
47
+ parents: C,
48
+ inputVariant: a,
49
+ labelPosition: n,
50
+ loading: l,
51
+ errors: F.errors,
52
+ sx: s.sx
53
+ },
54
+ form: {
55
+ control: g,
56
+ getValues: p,
57
+ register: T
58
+ },
59
+ actions: {
60
+ refreshParents: u,
61
+ handleOnCancel: y,
62
+ handleFormSubmit: V,
63
+ resetForm: k
64
+ }
65
+ };
66
+ };
67
+ export {
68
+ z as useTemplateFormLogic
69
+ };