@hybridcore/ui 1.3.5 → 1.3.7

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,39 +1,39 @@
1
- import { jsx as n, jsxs as m, Fragment as P } from "react/jsx-runtime";
2
- import { useState as k } from "react";
3
- import r from "dayjs";
4
- import { RadioButtonUnchecked as w, CheckCircle as F, KeyboardArrowUp as S, KeyboardArrowDown as Y } from "@mui/icons-material";
5
- import { Typography as p, FormLabel as y, FormGroup as D, Button as L } from "@mui/material";
1
+ import { jsx as a, jsxs as r, Fragment as k } from "react/jsx-runtime";
2
+ import { useState as w } from "react";
3
+ import m from "dayjs";
4
+ import { RadioButtonUnchecked as F, CheckCircle as S, KeyboardArrowUp as Y, KeyboardArrowDown as y } from "@mui/icons-material";
5
+ import { Typography as p, FormLabel as D, FormGroup as L, Button as B } from "@mui/material";
6
6
  import { DatePicker as I } from "@mui/x-date-pickers";
7
7
  import { T as x, F as C } from "../../FormControlLabel-DENNVXWL.js";
8
- import { B as c, C as V } from "../../Checkbox-BFWhj3s-.js";
9
- import { F as B } from "../../FormControl-BMRUQKHh.js";
10
- function G({
8
+ import { B as f, C as V } from "../../Checkbox-BFWhj3s-.js";
9
+ import { F as T } from "../../FormControl-BMRUQKHh.js";
10
+ function R({
11
11
  property: e,
12
12
  value: t,
13
13
  size: d = "medium",
14
- onChange: f
14
+ onChange: h
15
15
  }) {
16
16
  var g;
17
- const u = (o) => (a) => {
17
+ const u = (o) => (n) => {
18
18
  let l = { ...t };
19
- const i = a.target.type === "checkbox" ? a.target.checked : a.target.value;
20
- l[o] = String(i), f({
21
- [a.target.name]: l
19
+ const i = n.target.type === "checkbox" ? n.target.checked : n.target.value;
20
+ l[o] = String(i), h({
21
+ [n.target.name]: l
22
22
  });
23
23
  }, M = (o) => {
24
- var s;
25
- const a = { ...t }, { value: l, checked: i } = o.target;
26
- i ? (a.list || (a.list = []), a.list.push(l)) : a.list = (s = a.list) == null ? void 0 : s.filter((h) => h !== l), f({
27
- [o.target.name]: a
24
+ var c;
25
+ const n = { ...t }, { value: l, checked: i, name: s } = o.target;
26
+ i ? (n.list || (n.list = []), n.list.push(l)) : n.list = (c = n.list) == null ? void 0 : c.filter((P) => P !== l), h({
27
+ [s]: n
28
28
  });
29
- }, b = (o) => (a) => {
29
+ }, b = (o) => (n) => {
30
30
  let l = { ...t };
31
- l[o] = r(a).format("YYYY-MM-DD"), f({
31
+ l[o] = m(n).format("YYYY-MM-DD"), h({
32
32
  [e.propertyId]: l
33
33
  });
34
34
  };
35
35
  if (["string", "text", "list"].includes(e.type))
36
- return /* @__PURE__ */ n(
36
+ return /* @__PURE__ */ a(
37
37
  x,
38
38
  {
39
39
  label: e.name,
@@ -53,8 +53,8 @@ function G({
53
53
  }
54
54
  );
55
55
  if (["integer", "double", "long", "byte"].includes(e.type))
56
- return /* @__PURE__ */ m(c, { display: "flex", alignItems: "center", mb: 2, children: [
57
- /* @__PURE__ */ n(
56
+ return /* @__PURE__ */ r(f, { display: "flex", alignItems: "center", mb: 2, children: [
57
+ /* @__PURE__ */ a(
58
58
  x,
59
59
  {
60
60
  label: `${e.name} (Min)`,
@@ -71,8 +71,8 @@ function G({
71
71
  }
72
72
  }
73
73
  ),
74
- /* @__PURE__ */ n(p, { px: 1, children: "-" }),
75
- /* @__PURE__ */ n(
74
+ /* @__PURE__ */ a(p, { px: 1, children: "-" }),
75
+ /* @__PURE__ */ a(
76
76
  x,
77
77
  {
78
78
  label: `${e.name} (Max)`,
@@ -91,9 +91,9 @@ function G({
91
91
  )
92
92
  ] });
93
93
  if (e.type === "date") {
94
- const o = "DD/MM/YYYY", a = "YYYY-MM-DD", l = t.min && r(t.min, a, !0).isValid() ? r(t.min, a) : null, i = t.max && r(t.max, a, !0).isValid() ? r(t.max, a) : null;
95
- return /* @__PURE__ */ m(c, { mb: 2, display: "flex", alignItems: "end", children: [
96
- /* @__PURE__ */ n(
94
+ const o = "DD/MM/YYYY", n = "YYYY-MM-DD", l = t.min && m(t.min, n, !0).isValid() ? m(t.min, n) : null, i = t.max && m(t.max, n, !0).isValid() ? m(t.max, n) : null;
95
+ return /* @__PURE__ */ r(f, { mb: 2, display: "flex", alignItems: "end", children: [
96
+ /* @__PURE__ */ a(
97
97
  I,
98
98
  {
99
99
  label: `${e.name} (Min)`,
@@ -113,8 +113,8 @@ function G({
113
113
  onChange: b("min")
114
114
  }
115
115
  ),
116
- /* @__PURE__ */ n(p, { px: 1, children: "-" }),
117
- /* @__PURE__ */ n(
116
+ /* @__PURE__ */ a(p, { px: 1, children: "-" }),
117
+ /* @__PURE__ */ a(
118
118
  I,
119
119
  {
120
120
  label: `${e.name} (Max)`,
@@ -138,18 +138,18 @@ function G({
138
138
  ] });
139
139
  }
140
140
  if (e.type === "boolean")
141
- return /* @__PURE__ */ n(c, { mb: 2, children: /* @__PURE__ */ n(
141
+ return /* @__PURE__ */ a(f, { mb: 2, children: /* @__PURE__ */ a(
142
142
  C,
143
143
  {
144
144
  label: e.name,
145
- control: /* @__PURE__ */ n(
145
+ control: /* @__PURE__ */ a(
146
146
  V,
147
147
  {
148
148
  size: d,
149
149
  name: e.propertyId,
150
150
  checked: !!t,
151
- icon: /* @__PURE__ */ n(w, {}),
152
- checkedIcon: /* @__PURE__ */ n(F, {}),
151
+ icon: /* @__PURE__ */ a(F, {}),
152
+ checkedIcon: /* @__PURE__ */ a(S, {}),
153
153
  onChange: u("exact")
154
154
  }
155
155
  ),
@@ -161,19 +161,19 @@ function G({
161
161
  }
162
162
  ) });
163
163
  if (e.type === "enum") {
164
- const [o, a] = k(!1), l = 10;
164
+ const [o, n] = w(!1), l = 10;
165
165
  let i = [];
166
- return (g = e.dataTypeInfo) != null && g.enumValues && (i = e.dataTypeInfo.enumValues), /* @__PURE__ */ m(c, { mb: 2, children: [
167
- /* @__PURE__ */ m(B, { fullWidth: !0, component: "fieldset", variant: "standard", children: [
168
- /* @__PURE__ */ n(y, { component: "legend", sx: { mb: 1 }, children: e.name }),
169
- /* @__PURE__ */ n(D, { children: i.slice(0, o ? 9999 : l).map((s, h) => /* @__PURE__ */ n(
166
+ return (g = e.dataTypeInfo) != null && g.enumValues && (i = e.dataTypeInfo.enumValues), /* @__PURE__ */ r(f, { mb: 2, children: [
167
+ /* @__PURE__ */ r(T, { fullWidth: !0, component: "fieldset", variant: "standard", children: [
168
+ /* @__PURE__ */ a(D, { component: "legend", sx: { mb: 1 }, children: e.name }),
169
+ /* @__PURE__ */ a(L, { children: i.slice(0, o ? 9999 : l).map((s, c) => /* @__PURE__ */ a(
170
170
  C,
171
171
  {
172
172
  label: s,
173
- control: /* @__PURE__ */ n(
173
+ control: /* @__PURE__ */ a(
174
174
  V,
175
175
  {
176
- name: e.name,
176
+ name: e.propertyId,
177
177
  value: s,
178
178
  size: "small",
179
179
  checked: t.list ? t.list.includes(s) : !1,
@@ -186,16 +186,16 @@ function G({
186
186
  }
187
187
  }
188
188
  },
189
- h
189
+ c
190
190
  )) })
191
191
  ] }),
192
- i.length > l && /* @__PURE__ */ m(
193
- L,
192
+ i.length > l && /* @__PURE__ */ r(
193
+ B,
194
194
  {
195
195
  size: "small",
196
196
  sx: { p: 0, textTransform: "none" },
197
- endIcon: o ? /* @__PURE__ */ n(S, {}) : /* @__PURE__ */ n(Y, {}),
198
- onClick: () => a((s) => !s),
197
+ endIcon: o ? /* @__PURE__ */ a(Y, {}) : /* @__PURE__ */ a(y, {}),
198
+ onClick: () => n((s) => !s),
199
199
  children: [
200
200
  "Show ",
201
201
  o ? "Less" : "More"
@@ -204,8 +204,8 @@ function G({
204
204
  )
205
205
  ] });
206
206
  }
207
- return /* @__PURE__ */ n(P, {});
207
+ return /* @__PURE__ */ a(k, {});
208
208
  }
209
209
  export {
210
- G as default
210
+ R as default
211
211
  };
@@ -1,71 +1,72 @@
1
- import { jsxs as p, Fragment as W, jsx as n } from "react/jsx-runtime";
1
+ import { jsxs as p, Fragment as _, jsx as n } from "react/jsx-runtime";
2
2
  import f from "react";
3
- import { TreeViewFilter as _ } from "../treeview-filter/index.js";
3
+ import { TreeViewFilter as b } from "../treeview-filter/index.js";
4
4
  import r from "lodash";
5
- import { flattenNestedTemplates as b } from "../../utils/ontology.js";
6
- import { F as A, I as E } from "../../FormControl-BMRUQKHh.js";
7
- import { S as M } from "../../Select-NDq3WyLt.js";
8
- import { M as j } from "../../MenuItem-DstAFfik.js";
9
- import { D as B, a as k, b as w, B as L } from "../../DialogContent-BCYm_d1s.js";
10
- const P = ({
5
+ import { flattenNestedTemplates as A } from "../../utils/ontology.js";
6
+ import { F as E, I as M } from "../../FormControl-BMRUQKHh.js";
7
+ import { S as j } from "../../Select-NDq3WyLt.js";
8
+ import { M as B } from "../../MenuItem-DstAFfik.js";
9
+ import { D as k, a as w, b as L, B as N } from "../../DialogContent-BCYm_d1s.js";
10
+ const Q = ({
11
11
  data: h,
12
12
  label: s,
13
- selected: a,
14
- disabled: x,
15
- idKey: o = "id",
16
- onChange: v
13
+ selected: o,
14
+ disabled: C,
15
+ idKey: l = "id",
16
+ variant: u = "outlined",
17
+ onChange: S
17
18
  }) => {
18
- const [C, m] = f.useState(!1), [S, u] = f.useState([]), i = b(h), l = f.useMemo(() => r.isArray(a) ? a.map(
19
- (e) => i.find((t) => String(r.get(t, o)) === e)
20
- ) : [], [a, i]), D = (e, t) => {
21
- v(e, t);
22
- }, I = () => {
23
- m(!0), F();
24
- }, g = () => {
19
+ const [D, m] = f.useState(!1), [I, g] = f.useState([]), i = A(h), a = f.useMemo(() => r.isArray(o) ? o.map(
20
+ (e) => i.find((t) => String(r.get(t, l)) === e)
21
+ ) : [], [o, i]), v = (e, t) => {
22
+ S(e, t);
23
+ }, T = () => {
24
+ m(!0), O();
25
+ }, x = () => {
25
26
  m(!1);
26
- }, T = (e, t) => {
27
- u(t);
28
- }, F = () => {
27
+ }, F = (e, t) => {
28
+ g(t);
29
+ }, O = () => {
29
30
  let e = [];
30
- l.length > 0 && l.forEach((t) => {
31
- const d = t == null ? void 0 : t.parentKeys, O = i.filter((c) => d == null ? void 0 : d.includes(c.templateKey)).map((c) => String(r.get(c, o)));
32
- e.push(...O);
33
- }), u(e);
31
+ a.length > 0 && a.forEach((t) => {
32
+ const d = t == null ? void 0 : t.parentKeys, W = i.filter((c) => d == null ? void 0 : d.includes(c.templateKey)).map((c) => String(r.get(c, l)));
33
+ e.push(...W);
34
+ }), g(e);
34
35
  };
35
- return /* @__PURE__ */ p(W, { children: [
36
- /* @__PURE__ */ p(A, { variant: "standard", fullWidth: !0, children: [
37
- s !== void 0 && /* @__PURE__ */ n(E, { id: "select-label", children: s }),
36
+ return /* @__PURE__ */ p(_, { children: [
37
+ /* @__PURE__ */ p(E, { variant: u, fullWidth: !0, children: [
38
+ s !== void 0 && /* @__PURE__ */ n(M, { id: "select-label", children: s }),
38
39
  /* @__PURE__ */ n(
39
- M,
40
+ j,
40
41
  {
41
42
  label: s,
42
- variant: "standard",
43
+ variant: u,
43
44
  id: "select",
44
45
  labelId: "select-label",
45
- value: a,
46
+ value: o,
46
47
  open: !1,
47
- onOpen: I,
48
- children: l.length > 0 && l.map((e, t) => /* @__PURE__ */ n(j, { value: r.get(e, o) ?? "", children: e == null ? void 0 : e.name }, t))
48
+ onOpen: T,
49
+ children: a.length > 0 && a.map((e, t) => /* @__PURE__ */ n(B, { value: r.get(e, l) ?? "", children: e == null ? void 0 : e.name }, t))
49
50
  }
50
51
  )
51
52
  ] }),
52
- /* @__PURE__ */ p(B, { open: C, onClose: g, fullWidth: !0, maxWidth: "sm", children: [
53
- /* @__PURE__ */ n(k, { sx: { p: 1, pt: 2 }, children: /* @__PURE__ */ n(
54
- _,
53
+ /* @__PURE__ */ p(k, { open: D, onClose: x, fullWidth: !0, maxWidth: "sm", children: [
54
+ /* @__PURE__ */ n(w, { sx: { p: 1, pt: 2 }, children: /* @__PURE__ */ n(
55
+ b,
55
56
  {
56
57
  data: h,
57
- selected: r.isArray(a) ? a : void 0,
58
- disabled: x,
59
- expanded: S,
60
- idKey: o,
61
- onToggle: T,
62
- onChange: D
58
+ selected: r.isArray(o) ? o : void 0,
59
+ disabled: C,
60
+ expanded: I,
61
+ idKey: l,
62
+ onToggle: F,
63
+ onChange: v
63
64
  }
64
65
  ) }),
65
- /* @__PURE__ */ n(w, { children: /* @__PURE__ */ n(L, { onClick: g, variant: "contained", fullWidth: !0, children: "OK" }) })
66
+ /* @__PURE__ */ n(L, { children: /* @__PURE__ */ n(N, { onClick: x, variant: "contained", fullWidth: !0, children: "OK" }) })
66
67
  ] })
67
68
  ] });
68
69
  };
69
70
  export {
70
- P as TreeSelect
71
+ Q as TreeSelect
71
72
  };