@hybridcore/ui 1.3.6 → 1.4.0

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 (128) hide show
  1. package/dist/AccordionDetails-CGs6GZQK.js +454 -0
  2. package/dist/Add-eepk2WTM.js +379 -0
  3. package/dist/Box-BPyg-Ybm.js +70 -0
  4. package/dist/Button-DLwB_sKd.js +354 -0
  5. package/dist/{ButtonBase-D6qhsxB0.js → ButtonBase-D0qccOVb.js} +6 -5
  6. package/dist/{CardContent-B8hqgH-I.js → CardContent-DFsCCOWk.js} +4 -4
  7. package/dist/{Checkbox-BFWhj3s-.js → Checkbox-qy3cjvnb.js} +134 -195
  8. package/dist/{Collapse-D_TjnyE5.js → Collapse-CL6LGGZw.js} +68 -75
  9. package/dist/Delete-OHEw9lDi.js +22 -0
  10. package/dist/DialogContent-CxOSq6h9.js +519 -0
  11. package/dist/FormControlLabel-D9KFjcIx.js +193 -0
  12. package/dist/{IconButton-D8bwME9t.js → IconButton-BaiyAtmS.js} +5 -5
  13. package/dist/{Input-Dxzguyp5.js → Input-CmCkXczh.js} +6 -6
  14. package/dist/{InputAdornment-B8ERE7Zv.js → InputAdornment-CZUPEeia.js} +5 -5
  15. package/dist/{FormControl-BMRUQKHh.js → InputLabel-CWkW8NtU.js} +316 -316
  16. package/dist/{List-DEWyK9IO.js → List-PpNAWJ_I.js} +4 -4
  17. package/dist/ListItem-CZbZ91vp.js +428 -0
  18. package/dist/{MenuItem-DstAFfik.js → MenuItem-D-INSvZa.js} +7 -7
  19. package/dist/{Modal-DNGEQJ1M.js → Modal-KrI5qFIq.js} +61 -57
  20. package/dist/{OutlinedInput-w2Cj9STF.js → OutlinedInput-DkIUD30e.js} +6 -6
  21. package/dist/{Paper-BseeergJ.js → Paper-btu3j72o.js} +5 -5
  22. package/dist/{Select-NDq3WyLt.js → Select-ClaBvSqf.js} +20 -18
  23. package/dist/Tabs-BzelDJKy.js +787 -0
  24. package/dist/TextField-D87qTh1k.js +457 -0
  25. package/dist/Typography-Bm7PFqUT.js +176 -0
  26. package/dist/assets/index.css +1 -1
  27. package/dist/assets/index2.css +1 -1
  28. package/dist/components/card/index.js +6 -6
  29. package/dist/components/card/styled.js +1 -1
  30. package/dist/components/collapsible-card/style.js +20 -466
  31. package/dist/components/confirm/dialog.js +8 -149
  32. package/dist/components/confirm/index.js +1 -1
  33. package/dist/components/container/index.js +7 -7
  34. package/dist/components/context-menu/index.js +191 -604
  35. package/dist/components/data-security-selectors/dissemination-list/index.js +12 -6
  36. package/dist/components/data-security-selectors/security-level/index.js +46 -45
  37. package/dist/components/date-time-picker/index.js +85 -64
  38. package/dist/components/geometry-picker/coordinate/index.js +1 -1
  39. package/dist/components/geometry-picker/edit/index.js +16 -16
  40. package/dist/components/geometry-picker/geometry/index.js +35 -35
  41. package/dist/components/geometry-picker/index.js +60 -56
  42. package/dist/components/geometry-picker/kml/index.js +14 -14
  43. package/dist/components/geometry-picker/map/index.js +1 -1
  44. package/dist/components/geometry-picker/map/logic.js +38 -37
  45. package/dist/components/geometry-picker/parser/coordinate-input/logic.js +63 -59
  46. package/dist/components/geometry-picker/parser/logic.js +33 -32
  47. package/dist/components/geometry-picker/styled.js +22 -14
  48. package/dist/components/icon-button/index.js +1 -1
  49. package/dist/components/icon-button/styled.js +0 -2
  50. package/dist/components/{data-management/instance-form → instance-form}/components/composite-list/index.js +2 -2
  51. package/dist/components/{data-management/instance-form → instance-form}/components/composite-list/styled.js +15 -6
  52. package/dist/components/instance-form/components/variable/index.js +19 -0
  53. package/dist/components/instance-form/components/variables/index.js +40 -0
  54. package/dist/components/{data-management/instance-form → instance-form}/index.js +174 -155
  55. package/dist/components/instance-hierarchy-table/index.js +58 -0
  56. package/dist/components/instance-hierarchy-table/styled.js +29 -0
  57. package/dist/components/instance-table/index.js +125 -0
  58. package/dist/components/instance-table/styled.js +13 -0
  59. package/dist/components/map/helpers/ol.js +1 -1
  60. package/dist/components/map/index.js +1 -1
  61. package/dist/components/map/logic.js +1 -1
  62. package/dist/components/map/styled.js +1 -1
  63. package/dist/components/phone-input/index.js +1 -1
  64. package/dist/components/property-mapping/index.js +558 -0
  65. package/dist/components/range-selector/components/composite-list-range/index.js +81 -0
  66. package/dist/components/range-selector/components/date-range/index.js +9 -0
  67. package/dist/components/range-selector/components/geometry-range/index.js +26 -0
  68. package/dist/components/range-selector/components/number-range/index.js +86 -0
  69. package/dist/components/range-selector/components/string-range/index.js +31 -0
  70. package/dist/components/range-selector/index.js +59 -0
  71. package/dist/components/search-input/index.js +4 -4
  72. package/dist/components/tabs/appleTabs.style.js +55 -0
  73. package/dist/components/tabs/index.js +93 -0
  74. package/dist/components/tabs/tab-panel.js +18 -0
  75. package/dist/components/template-form/components/catalogue-instance-selector/index.js +158 -0
  76. package/dist/components/template-form/components/property-list/index.js +72 -0
  77. package/dist/components/template-form/components/property-list/property-list-columns.js +125 -0
  78. package/dist/components/template-form/components/property-list/property-list-form.js +16 -0
  79. package/dist/components/template-form/components/property-list/property-list-logic.js +66 -0
  80. package/dist/components/template-form/components/property-list/types.js +8 -0
  81. package/dist/components/template-form/components/recognition-property-list/index.js +69 -0
  82. package/dist/components/template-form/components/recognition-property-list/recognition-property-list-columns.js +50 -0
  83. package/dist/components/template-form/components/recognition-property-list/recognition-property-list-form.js +174 -0
  84. package/dist/components/template-form/components/recognition-property-list/recognition-property-list-logic.js +64 -0
  85. package/dist/components/template-form/components/recognition-property-list/types.js +8 -0
  86. package/dist/components/template-form/components/select-icon/index.js +186 -0
  87. package/dist/components/template-form/components/select-icon/styled.js +76 -0
  88. package/dist/components/template-form/index.js +338 -0
  89. package/dist/components/template-property-filters/property.js +48 -46
  90. package/dist/components/tree-select/index.js +51 -49
  91. package/dist/components/tree-select/styled.js +2 -2
  92. package/dist/components/treeview-filter/index.js +8 -8
  93. package/dist/components/treeview-filter/item/index.js +1 -1
  94. package/dist/components/treeview-filter/item-label/index.js +18 -17
  95. package/dist/constants/index.js +41 -0
  96. package/dist/{createStyled-B96gjom1.js → createStyled-BzvgQjjR.js} +487 -464
  97. package/dist/createSvgIcon-Cfm1LkEe.js +73 -0
  98. package/dist/{createSvgIcon-BNrb7rDY.js → createSvgIcon-DEXLbMwp.js} +62 -90
  99. package/dist/dialog-v5-nL5yy.js +153 -0
  100. package/dist/{exactProp-CI_rjX83.js → exactProp-DkmnwNVS.js} +3 -3
  101. package/dist/extendSxProp-qqdkfHzS.js +30 -0
  102. package/dist/{index-CSfSVkKj.js → index-B0JPwFI9.js} +6 -5
  103. package/dist/index-C1fczHEW.js +11042 -0
  104. package/dist/index-DPf5olog.js +288 -0
  105. package/dist/{index-JrtqxUdI.js → index-DlnzUkwe.js} +1 -1
  106. package/dist/{listItemTextClasses-CFiI_U7B.js → listItemTextClasses-DsHGzpPM.js} +2 -2
  107. package/dist/main.d.ts +569 -81
  108. package/dist/main.js +157 -157
  109. package/dist/{ol-BUKJ1urU.js → ol-CHaVTXvL.js} +24 -24
  110. package/dist/property-list-form-BfP9gzSo.js +391 -0
  111. package/dist/requirePropFactory-BjhhI-AW.js +18 -0
  112. package/dist/{styled-cPJbqF0E.js → styled-LNCprp4n.js} +24 -22
  113. package/dist/unsupportedProp-BuVD30Gh.js +9 -0
  114. package/dist/useControlled-BYdyS7Pn.js +31 -0
  115. package/dist/{useTheme-C-T6Qisa.js → useTheme-DBiahn6p.js} +2 -2
  116. package/dist/{useThemeProps-DeftUmqJ.js → useThemeProps-uYx_RkOH.js} +16 -14
  117. package/dist/utils/ontology.js +52 -30
  118. package/dist/{utils-CCkxV0lZ.js → utils-DNe_YYjm.js} +16 -16
  119. package/package.json +2 -1
  120. package/dist/DialogContent-BCYm_d1s.js +0 -864
  121. package/dist/FormControlLabel-DENNVXWL.js +0 -639
  122. package/dist/Typography-Dg-ROiTA.js +0 -201
  123. package/dist/components/data-management/instance-form/components/variable/index.js +0 -17
  124. package/dist/components/data-management/instance-form/components/variables/index.js +0 -39
  125. package/dist/createSvgIcon-B2WT0K4k.js +0 -87
  126. package/dist/index-B3Oj04nl.js +0 -287
  127. package/dist/components/{data-management/instance-form → instance-form}/components/policy-list/index.js +0 -0
  128. package/dist/{extends-Cyw62AD_.js → objectWithoutPropertiesLoose-BK36oJDi.js} +9 -9
@@ -0,0 +1,125 @@
1
+ import { jsxs as d, jsx as r, Fragment as s } from "react/jsx-runtime";
2
+ import { d as u, a as b } from "../../../../Delete-OHEw9lDi.js";
3
+ import { T as l } from "../../../../Typography-Bm7PFqUT.js";
4
+ import { I as p } from "../../../../IconButton-BaiyAtmS.js";
5
+ const y = (o) => [
6
+ { field: "name", headerName: "Name", flex: 1 },
7
+ { field: "propertyId", headerName: "Property ID", flex: 1 },
8
+ {
9
+ field: "type",
10
+ headerName: "Type",
11
+ width: 140,
12
+ renderCell: (t) => {
13
+ var n, m, f, h;
14
+ const { dataTypeInfo: e, defaultValue: a } = t.row;
15
+ let i = t.value;
16
+ return e != null && e.datePattern && (i += ` ${e.datePattern}`), e != null && e.coordinateFormat && (i += ` ${e.coordinateFormat}`), e != null && e.enumValues && (i += ` ${e.enumValues.join(",")}`), a && (i += ` ${a}`), /* @__PURE__ */ d("div", { className: "MuiDataGrid-cellContent", title: i, children: [
17
+ t.value,
18
+ ((n = t.row.dataTypeInfo) == null ? void 0 : n.datePattern) && /* @__PURE__ */ d(l, { variant: "caption", ml: 1, children: [
19
+ "(",
20
+ (m = t.row.dataTypeInfo) == null ? void 0 : m.datePattern,
21
+ ")"
22
+ ] }),
23
+ ((f = t.row.dataTypeInfo) == null ? void 0 : f.coordinateFormat) && /* @__PURE__ */ d(l, { variant: "caption", ml: 1, children: [
24
+ "(",
25
+ (h = t.row.dataTypeInfo) == null ? void 0 : h.coordinateFormat,
26
+ ")"
27
+ ] }),
28
+ t.row.defaultValue !== null && t.row.defaultValue !== "" && /* @__PURE__ */ d(l, { variant: "caption", ml: 1, children: [
29
+ "(",
30
+ t.row.defaultValue,
31
+ ")"
32
+ ] })
33
+ ] });
34
+ }
35
+ },
36
+ {
37
+ field: "inheritedFrom",
38
+ headerName: "Inherited From",
39
+ width: 120,
40
+ renderCell: (t) => {
41
+ var e, a;
42
+ return /* @__PURE__ */ r(
43
+ "div",
44
+ {
45
+ className: "MuiDataGrid-cellContent",
46
+ title: (e = t.value) == null ? void 0 : e.templateName,
47
+ children: ((a = t.value) == null ? void 0 : a.templateName) ?? "-"
48
+ }
49
+ );
50
+ }
51
+ },
52
+ {
53
+ field: "editable",
54
+ headerName: "Editable",
55
+ type: "boolean",
56
+ sortable: !1,
57
+ width: 60
58
+ },
59
+ {
60
+ field: "required",
61
+ headerName: "Required",
62
+ sortable: !1,
63
+ type: "boolean",
64
+ width: 60
65
+ },
66
+ {
67
+ field: "visible",
68
+ headerName: "Visible",
69
+ sortable: !1,
70
+ type: "boolean",
71
+ width: 60
72
+ },
73
+ {
74
+ field: "unique",
75
+ headerName: "Unique",
76
+ type: "boolean",
77
+ sortable: !1,
78
+ width: 60
79
+ },
80
+ {
81
+ field: "distinctive",
82
+ headerName: "Distinctive",
83
+ sortable: !1,
84
+ type: "boolean",
85
+ width: 60
86
+ },
87
+ {
88
+ field: "temporal",
89
+ headerName: "Temporal",
90
+ sortable: !1,
91
+ type: "boolean",
92
+ width: 60
93
+ },
94
+ {
95
+ field: "action",
96
+ headerName: " ",
97
+ width: 120,
98
+ sortable: !1,
99
+ filterable: !1,
100
+ renderCell: (t) => {
101
+ const { inheritedFrom: e } = t.row;
102
+ return !e || !e.templateId || e.templateId === o.templateId ? /* @__PURE__ */ d(s, { children: [
103
+ /* @__PURE__ */ r(
104
+ p,
105
+ {
106
+ size: "medium",
107
+ onClick: () => o.onEdit(t.row),
108
+ children: /* @__PURE__ */ r(u, { color: "primary" })
109
+ }
110
+ ),
111
+ /* @__PURE__ */ r(
112
+ p,
113
+ {
114
+ size: "medium",
115
+ onClick: () => o.onDelete(t.row),
116
+ children: /* @__PURE__ */ r(b, {})
117
+ }
118
+ )
119
+ ] }) : /* @__PURE__ */ r(s, {});
120
+ }
121
+ }
122
+ ];
123
+ export {
124
+ y as default
125
+ };
@@ -0,0 +1,16 @@
1
+ import "react/jsx-runtime";
2
+ import "react";
3
+ import "lodash";
4
+ import { a as b } from "../../../../property-list-form-BfP9gzSo.js";
5
+ import "../../../../constants/index.js";
6
+ import "../../../../TextField-D87qTh1k.js";
7
+ import "../../../../InputLabel-CWkW8NtU.js";
8
+ import "../../../../Select-ClaBvSqf.js";
9
+ import "../../../../MenuItem-D-INSvZa.js";
10
+ import "../../../../FormControlLabel-D9KFjcIx.js";
11
+ import "../../../../Checkbox-qy3cjvnb.js";
12
+ import "../../../../Box-BPyg-Ybm.js";
13
+ import "../../../../Button-DLwB_sKd.js";
14
+ export {
15
+ b as default
16
+ };
@@ -0,0 +1,66 @@
1
+ import x from "react";
2
+ import g from "../../../../hooks/useToggle.js";
3
+ import { confirm as P } from "../../../confirm/index.js";
4
+ import { PropertyFormTypeDefaults as c } from "./types.js";
5
+ function b({
6
+ list: o,
7
+ onChange: d
8
+ }) {
9
+ const { state: s, action: i } = g(!1), [t, l] = x.useState(
10
+ c
11
+ ), p = async () => {
12
+ t.type !== "add" && l(c), i.open();
13
+ }, m = (e) => {
14
+ const n = o.findIndex(
15
+ (r) => r.id === e.id && r.name === e.name
16
+ );
17
+ l({
18
+ title: "Edit Property",
19
+ defaultValues: e,
20
+ type: "edit",
21
+ index: n
22
+ }), i.open();
23
+ }, f = async (e) => {
24
+ if (await P(
25
+ "Are you sure?",
26
+ `"${e.name}" will be removed permanently!`
27
+ )) {
28
+ const n = o.findIndex(
29
+ (a) => a.id === e.id && a.name === e.name
30
+ );
31
+ let r = [...o];
32
+ r.splice(n, 1), d(r);
33
+ }
34
+ }, u = (e) => {
35
+ d([...o, e]), i.close();
36
+ }, y = (e) => {
37
+ let n = [...o];
38
+ t.index !== void 0 && (n[t.index] = e), d(n), i.close();
39
+ };
40
+ return {
41
+ state: {
42
+ propertyForm: t,
43
+ dialog: s
44
+ },
45
+ action: {
46
+ handleOnAddClick: p,
47
+ handleOnEditClick: m,
48
+ handleOnDeleteClick: f,
49
+ handleSubmit: (e) => {
50
+ if (t.type === "add") {
51
+ u(e);
52
+ return;
53
+ }
54
+ if (t.type === "edit") {
55
+ y(e);
56
+ return;
57
+ }
58
+ console.warn("Unrecognized form type value!");
59
+ },
60
+ dialog: i
61
+ }
62
+ };
63
+ }
64
+ export {
65
+ b as default
66
+ };
@@ -0,0 +1,8 @@
1
+ const e = {
2
+ title: "Add Property",
3
+ defaultValues: void 0,
4
+ type: "add"
5
+ };
6
+ export {
7
+ e as PropertyFormTypeDefaults
8
+ };
@@ -0,0 +1,69 @@
1
+ import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
+ import { DataGrid as a } from "@mui/x-data-grid";
3
+ import { A as n, a as d, d as s } from "../../../../Add-eepk2WTM.js";
4
+ import m from "./recognition-property-list-columns.js";
5
+ import c from "./recognition-property-list-form.js";
6
+ import p from "./recognition-property-list-logic.js";
7
+ import { B as g } from "../../../../Box-BPyg-Ybm.js";
8
+ import { T as u } from "../../../../Typography-Bm7PFqUT.js";
9
+ import { B as h } from "../../../../Button-DLwB_sKd.js";
10
+ import { D as f, a as y } from "../../../../DialogContent-CxOSq6h9.js";
11
+ import { D as b } from "../../../../dialog-v5-nL5yy.js";
12
+ function L(i) {
13
+ const { state: l, action: t } = p(i);
14
+ return /* @__PURE__ */ r(g, { children: [
15
+ /* @__PURE__ */ e(u, { variant: "h6", marginY: 2, children: "Recognition Property List" }),
16
+ i.list.length > 0 ? /* @__PURE__ */ e(
17
+ a,
18
+ {
19
+ rows: i.list,
20
+ columns: m({
21
+ onEdit: t.handleOnEditClick,
22
+ onDelete: t.handleOnDeleteClick
23
+ }),
24
+ getRowId: (o) => `${o.owner}-${o.termValue}-${o.termMatch}-${o.score}-${o.type}`,
25
+ autoHeight: !0
26
+ }
27
+ ) : /* @__PURE__ */ r(n, { severity: "info", children: [
28
+ /* @__PURE__ */ e(d, { children: "No Recognition Property Added!" }),
29
+ "Add least one recognition property before save the template!"
30
+ ] }),
31
+ /* @__PURE__ */ e(
32
+ h,
33
+ {
34
+ color: "primary",
35
+ onClick: t.handleOnAddClick,
36
+ sx: { mt: 2 },
37
+ startIcon: /* @__PURE__ */ e(s, {}),
38
+ children: "Add Recognition Property"
39
+ }
40
+ ),
41
+ /* @__PURE__ */ r(
42
+ f,
43
+ {
44
+ open: l.dialog.isOpen,
45
+ onClose: t.dialog.close,
46
+ "aria-labelledby": "alert-dialog-title",
47
+ "aria-describedby": "alert-dialog-description",
48
+ fullWidth: !0,
49
+ maxWidth: "sm",
50
+ scroll: "body",
51
+ children: [
52
+ /* @__PURE__ */ e(b, { id: "alert-dialog-title", children: "Add Recognition Property" }),
53
+ /* @__PURE__ */ e(y, { className: "pb-30", children: /* @__PURE__ */ e(
54
+ c,
55
+ {
56
+ defaultValues: l.recPropertyForm.defaultValues,
57
+ getFormValues: i.getFormValues,
58
+ onSubmit: t.handleSubmit,
59
+ onCancel: t.dialog.close
60
+ }
61
+ ) })
62
+ ]
63
+ }
64
+ )
65
+ ] });
66
+ }
67
+ export {
68
+ L as default
69
+ };
@@ -0,0 +1,50 @@
1
+ import { jsxs as i, Fragment as t, jsx as e } from "react/jsx-runtime";
2
+ import { d as o, a as l } from "../../../../Delete-OHEw9lDi.js";
3
+ import { I as d } from "../../../../IconButton-BaiyAtmS.js";
4
+ const h = (r) => [
5
+ { field: "ownerType", headerName: "Owner Type", width: 120 },
6
+ { field: "owner", headerName: "Owner", width: 120 },
7
+ {
8
+ field: "termMatch",
9
+ headerName: "Term Match",
10
+ width: 120
11
+ },
12
+ {
13
+ field: "termValue",
14
+ headerName: "Term",
15
+ flex: 1
16
+ },
17
+ {
18
+ field: "score",
19
+ headerName: "Score",
20
+ width: 120
21
+ },
22
+ {
23
+ field: "action",
24
+ headerName: " ",
25
+ width: 120,
26
+ sortable: !1,
27
+ filterable: !1,
28
+ renderCell: (a) => /* @__PURE__ */ i(t, { children: [
29
+ /* @__PURE__ */ e(
30
+ d,
31
+ {
32
+ size: "medium",
33
+ onClick: () => r.onEdit(a.row),
34
+ children: /* @__PURE__ */ e(o, { color: "secondary" })
35
+ }
36
+ ),
37
+ /* @__PURE__ */ e(
38
+ d,
39
+ {
40
+ size: "medium",
41
+ onClick: () => r.onDelete(a.row),
42
+ children: /* @__PURE__ */ e(l, {})
43
+ }
44
+ )
45
+ ] })
46
+ }
47
+ ];
48
+ export {
49
+ h as default
50
+ };
@@ -0,0 +1,174 @@
1
+ import V, { jsxs as i, Fragment as S, jsx as t } from "react/jsx-runtime";
2
+ import o from "react";
3
+ import { r as C, i as g } from "../../../../createSvgIcon-Cfm1LkEe.js";
4
+ import { RECOGNITION_PROPERTY_OWNER_TYPE as h, RECOGNITION_PROPERTY_TYPE as T, RECOGNITION_PROPERTY_TERM_MATCH as v } from "../../../../constants/index.js";
5
+ import { F as c, I as u } from "../../../../InputLabel-CWkW8NtU.js";
6
+ import { S as d } from "../../../../Select-ClaBvSqf.js";
7
+ import { M as m } from "../../../../MenuItem-D-INSvZa.js";
8
+ import { T as b } from "../../../../TextField-D87qTh1k.js";
9
+ import { B as M } from "../../../../Box-BPyg-Ybm.js";
10
+ import { B as y } from "../../../../Button-DLwB_sKd.js";
11
+ var p = {}, q = g;
12
+ Object.defineProperty(p, "__esModule", {
13
+ value: !0
14
+ });
15
+ var w = p.default = void 0, N = q(C()), W = V;
16
+ w = p.default = (0, N.default)(/* @__PURE__ */ (0, W.jsx)("path", {
17
+ d: "M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3m3-10H5V5h10z"
18
+ }), "Save");
19
+ function A({
20
+ defaultValues: x = {
21
+ owner: "",
22
+ ownerType: h[0],
23
+ type: T[0],
24
+ termValue: "",
25
+ termMatch: v[0],
26
+ score: 0
27
+ },
28
+ getFormValues: R,
29
+ onSubmit: E,
30
+ onCancel: O
31
+ }) {
32
+ const [r, f] = o.useState(x), [I, _] = o.useState([]), [l, s] = o.useState({
33
+ termValue: !1,
34
+ score: !1
35
+ }), n = (e) => {
36
+ f((a) => ({
37
+ ...a,
38
+ [e.target.name]: e.target.type === "checkbox" ? e.target.checked : e.target.value
39
+ }));
40
+ }, P = () => {
41
+ if (!r.termValue) {
42
+ s({ ...l, termValue: !0 });
43
+ return;
44
+ }
45
+ if (!r.score) {
46
+ s({ ...l, score: !0 });
47
+ return;
48
+ }
49
+ E(r);
50
+ };
51
+ return o.useEffect(() => (l.termValue && r.termValue && s({ ...l, termValue: !1 }), () => {
52
+ }), [r.termValue]), o.useEffect(() => (l.score && r.score && s({ ...l, score: !1 }), () => {
53
+ }), [r.score]), o.useEffect(() => {
54
+ if (r.ownerType === "PROPERTY") {
55
+ const e = R("properties");
56
+ _(e);
57
+ }
58
+ return r.ownerType === "EVENT" && r.owner !== "" && f((e) => ({
59
+ ...e,
60
+ owner: ""
61
+ })), () => {
62
+ };
63
+ }, [r.ownerType]), /* @__PURE__ */ i(S, { children: [
64
+ /* @__PURE__ */ i(c, { fullWidth: !0, variant: "standard", sx: { mb: 2 }, children: [
65
+ /* @__PURE__ */ t(u, { id: "owner-type-select-label", children: "Owner Type" }),
66
+ /* @__PURE__ */ t(
67
+ d,
68
+ {
69
+ label: "Owner Type",
70
+ name: "ownerType",
71
+ labelId: "owner-type-select-label",
72
+ id: "owner-type-select",
73
+ value: r.ownerType,
74
+ onChange: n,
75
+ children: h.map((e, a) => /* @__PURE__ */ t(m, { value: e, children: e }, a))
76
+ }
77
+ )
78
+ ] }),
79
+ r.ownerType === "PROPERTY" && /* @__PURE__ */ i(c, { fullWidth: !0, variant: "standard", sx: { mb: 2 }, children: [
80
+ /* @__PURE__ */ t(u, { id: "owner-select-label", children: "Owner" }),
81
+ /* @__PURE__ */ t(
82
+ d,
83
+ {
84
+ label: "Owner",
85
+ name: "owner",
86
+ labelId: "owner-select-label",
87
+ id: "owner-select",
88
+ value: r.owner,
89
+ onChange: n,
90
+ children: I.map((e, a) => /* @__PURE__ */ t(m, { value: e.propertyId, children: e.name }, a))
91
+ }
92
+ )
93
+ ] }),
94
+ /* @__PURE__ */ i(c, { fullWidth: !0, variant: "standard", sx: { mb: 2 }, children: [
95
+ /* @__PURE__ */ t(u, { id: "type-select-label", children: "Type" }),
96
+ /* @__PURE__ */ t(
97
+ d,
98
+ {
99
+ label: "Type",
100
+ name: "type",
101
+ labelId: "type-select-label",
102
+ id: "type-select",
103
+ value: r.type,
104
+ onChange: n,
105
+ children: T.map((e, a) => /* @__PURE__ */ t(m, { value: e, children: e }, a))
106
+ }
107
+ )
108
+ ] }),
109
+ /* @__PURE__ */ i(c, { fullWidth: !0, variant: "standard", sx: { mb: 2 }, children: [
110
+ /* @__PURE__ */ t(u, { id: "term-match-select-label", children: "Term Match" }),
111
+ /* @__PURE__ */ t(
112
+ d,
113
+ {
114
+ label: "Type",
115
+ name: "termMatch",
116
+ labelId: "term-match-select-label",
117
+ id: "term-match-select",
118
+ value: r.termMatch,
119
+ onChange: n,
120
+ children: v.map((e, a) => /* @__PURE__ */ t(m, { value: e, children: e }, a))
121
+ }
122
+ )
123
+ ] }),
124
+ /* @__PURE__ */ t(
125
+ b,
126
+ {
127
+ label: "Term",
128
+ name: "termValue",
129
+ variant: "standard",
130
+ fullWidth: !0,
131
+ sx: { mb: 2 },
132
+ value: r.termValue,
133
+ onChange: n,
134
+ required: !0,
135
+ ...l.termValue && {
136
+ error: !0,
137
+ helperText: "This field is required!"
138
+ }
139
+ }
140
+ ),
141
+ /* @__PURE__ */ t(
142
+ b,
143
+ {
144
+ label: "Score",
145
+ name: "score",
146
+ variant: "standard",
147
+ fullWidth: !0,
148
+ sx: { mb: 2 },
149
+ value: r.score,
150
+ onChange: n,
151
+ required: !0,
152
+ ...l.score && {
153
+ error: !0,
154
+ helperText: "This field is required!"
155
+ }
156
+ }
157
+ ),
158
+ /* @__PURE__ */ i(M, { display: "flex", justifyContent: "flex-end", children: [
159
+ /* @__PURE__ */ t(y, { variant: "contained", onClick: O, sx: { marginRight: 2 }, children: "Cancel" }),
160
+ /* @__PURE__ */ t(
161
+ y,
162
+ {
163
+ variant: "contained",
164
+ startIcon: /* @__PURE__ */ t(w, {}),
165
+ onClick: P,
166
+ children: "Save"
167
+ }
168
+ )
169
+ ] })
170
+ ] });
171
+ }
172
+ export {
173
+ A as default
174
+ };
@@ -0,0 +1,64 @@
1
+ import h from "react";
2
+ import g from "../../../../hooks/useToggle.js";
3
+ import { confirm as x } from "../../../confirm/index.js";
4
+ import { RecPropertyFormTypeDefaults as a } from "./types.js";
5
+ function L({
6
+ list: r,
7
+ onChange: c
8
+ }) {
9
+ const { state: s, action: n } = g(!1), [t, l] = h.useState(a), m = async () => {
10
+ t.type !== "add" && l(a), n.open();
11
+ }, p = (e) => {
12
+ const o = r.findIndex(
13
+ (i) => i.termValue === e.termValue && i.termMatch === e.termMatch
14
+ );
15
+ l({
16
+ title: "Edit Recognition Property",
17
+ defaultValues: e,
18
+ type: "edit",
19
+ index: o
20
+ }), n.open();
21
+ }, u = async (e) => {
22
+ if (await x(
23
+ "Are you sure?",
24
+ `"${e.termValue}" will be removed permanently!`
25
+ )) {
26
+ const o = r.findIndex(
27
+ (d) => d.termValue === e.termValue && d.termMatch === e.termMatch
28
+ );
29
+ let i = [...r];
30
+ i.splice(o, 1), c(i);
31
+ }
32
+ }, f = (e) => {
33
+ c([...r, e]), n.close();
34
+ }, y = (e) => {
35
+ let o = [...r];
36
+ t.index !== void 0 && (o[t.index] = e), c(o), n.close();
37
+ };
38
+ return {
39
+ state: {
40
+ recPropertyForm: t,
41
+ dialog: s
42
+ },
43
+ action: {
44
+ handleOnAddClick: m,
45
+ handleOnEditClick: p,
46
+ handleOnDeleteClick: u,
47
+ handleSubmit: (e) => {
48
+ if (t.type === "add") {
49
+ f(e);
50
+ return;
51
+ }
52
+ if (t.type === "edit") {
53
+ y(e);
54
+ return;
55
+ }
56
+ console.warn("Unrecognized form type value!");
57
+ },
58
+ dialog: n
59
+ }
60
+ };
61
+ }
62
+ export {
63
+ L as default
64
+ };
@@ -0,0 +1,8 @@
1
+ const e = {
2
+ title: "Add Property",
3
+ defaultValues: void 0,
4
+ type: "add"
5
+ };
6
+ export {
7
+ e as RecPropertyFormTypeDefaults
8
+ };