@hybridcore/ui 1.4.11 → 1.4.12
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,38 +1,40 @@
|
|
|
1
|
-
import { jsx as t, jsxs as u, Fragment as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsx as t, jsxs as u, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import { useState as S } from "react";
|
|
3
3
|
import r from "dayjs";
|
|
4
|
-
import { RadioButtonUnchecked as
|
|
5
|
-
import { Typography as
|
|
6
|
-
import { DatePicker as
|
|
4
|
+
import { RadioButtonUnchecked as T, CheckCircle as Y, KeyboardArrowUp as D, KeyboardArrowDown as B } from "@mui/icons-material";
|
|
5
|
+
import { Typography as y, FormLabel as W, FormGroup as z, Button as $ } from "@mui/material";
|
|
6
|
+
import { DatePicker as M } from "@mui/x-date-pickers";
|
|
7
7
|
import { T as b } from "../../TextField-D87qTh1k.js";
|
|
8
8
|
import { B as h } from "../../Box-BPyg-Ybm.js";
|
|
9
|
-
import { F as
|
|
10
|
-
import { C as
|
|
11
|
-
import { F as
|
|
9
|
+
import { F as O } from "../../FormControlLabel-D9KFjcIx.js";
|
|
10
|
+
import { C as P } from "../../Checkbox-qy3cjvnb.js";
|
|
11
|
+
import { F as j } from "../../InputLabel-CWkW8NtU.js";
|
|
12
12
|
function X({
|
|
13
13
|
property: e,
|
|
14
|
-
value:
|
|
14
|
+
value: a,
|
|
15
15
|
size: s = "medium",
|
|
16
16
|
variant: d,
|
|
17
17
|
onChange: x
|
|
18
18
|
}) {
|
|
19
|
-
var g, I, V, C,
|
|
20
|
-
const
|
|
21
|
-
let
|
|
19
|
+
var g, I, V, C, L;
|
|
20
|
+
const f = (o) => (n) => {
|
|
21
|
+
let l = { ...a };
|
|
22
22
|
const i = n.target.type === "checkbox" ? n.target.checked : n.target.value;
|
|
23
|
-
|
|
24
|
-
[n.target.name]:
|
|
23
|
+
l[o] = String(i), x({
|
|
24
|
+
[n.target.name]: l
|
|
25
25
|
});
|
|
26
|
-
},
|
|
27
|
-
var
|
|
28
|
-
const n = { ...
|
|
29
|
-
i ? (n.
|
|
26
|
+
}, k = (o) => {
|
|
27
|
+
var c;
|
|
28
|
+
const n = { ...a }, { value: l, checked: i, name: m } = o.target;
|
|
29
|
+
i ? (n.atLeastOneOf || (n.atLeastOneOf = []), n.atLeastOneOf.push(l)) : n.atLeastOneOf = (c = n.atLeastOneOf) == null ? void 0 : c.filter(
|
|
30
|
+
(w) => w !== l
|
|
31
|
+
), x({
|
|
30
32
|
[m]: n
|
|
31
33
|
});
|
|
32
34
|
}, p = (o) => (n) => {
|
|
33
|
-
let
|
|
34
|
-
|
|
35
|
-
[e.propertyId]:
|
|
35
|
+
let l = { ...a };
|
|
36
|
+
l[o] = r(n).format("YYYY-MM-DD"), x({
|
|
37
|
+
[e.propertyId]: l
|
|
36
38
|
});
|
|
37
39
|
};
|
|
38
40
|
if (["string", "text", "list"].includes(e.type))
|
|
@@ -41,9 +43,9 @@ function X({
|
|
|
41
43
|
{
|
|
42
44
|
label: e.name,
|
|
43
45
|
name: e.propertyId,
|
|
44
|
-
value:
|
|
46
|
+
value: a.exact ?? e.defaultValue ?? "",
|
|
45
47
|
size: s,
|
|
46
|
-
onChange:
|
|
48
|
+
onChange: f("exact"),
|
|
47
49
|
variant: d,
|
|
48
50
|
type: "text",
|
|
49
51
|
multiline: e.type === "text",
|
|
@@ -62,9 +64,9 @@ function X({
|
|
|
62
64
|
{
|
|
63
65
|
label: `${e.name} (Min)`,
|
|
64
66
|
name: e.propertyId,
|
|
65
|
-
value:
|
|
67
|
+
value: a.min ?? e.defaultValue ?? "",
|
|
66
68
|
size: s,
|
|
67
|
-
onChange:
|
|
69
|
+
onChange: f("min"),
|
|
68
70
|
variant: d,
|
|
69
71
|
type: "number",
|
|
70
72
|
disabled: !e.editable,
|
|
@@ -74,15 +76,15 @@ function X({
|
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
78
|
),
|
|
77
|
-
/* @__PURE__ */ t(
|
|
79
|
+
/* @__PURE__ */ t(y, { px: 1, children: "-" }),
|
|
78
80
|
/* @__PURE__ */ t(
|
|
79
81
|
b,
|
|
80
82
|
{
|
|
81
83
|
label: `${e.name} (Max)`,
|
|
82
84
|
name: e.propertyId,
|
|
83
|
-
value:
|
|
85
|
+
value: a.max ?? e.defaultValue ?? "",
|
|
84
86
|
size: s,
|
|
85
|
-
onChange:
|
|
87
|
+
onChange: f("max"),
|
|
86
88
|
variant: d,
|
|
87
89
|
type: "number",
|
|
88
90
|
disabled: !e.editable,
|
|
@@ -94,13 +96,13 @@ function X({
|
|
|
94
96
|
)
|
|
95
97
|
] });
|
|
96
98
|
if (e.type === "date") {
|
|
97
|
-
const o = "DD/MM/YYYY", n = "YYYY-MM-DD",
|
|
99
|
+
const o = "DD/MM/YYYY", n = "YYYY-MM-DD", l = a.min && r(a.min, n, !0).isValid() ? r(a.min, n) : null, i = a.max && r(a.max, n, !0).isValid() ? r(a.max, n) : null;
|
|
98
100
|
return /* @__PURE__ */ u(h, { mb: 2, display: "flex", alignItems: "end", children: [
|
|
99
101
|
/* @__PURE__ */ t(
|
|
100
|
-
|
|
102
|
+
M,
|
|
101
103
|
{
|
|
102
104
|
label: `${e.name} (Min)`,
|
|
103
|
-
value:
|
|
105
|
+
value: l,
|
|
104
106
|
format: o,
|
|
105
107
|
views: ["year", "month", "day"],
|
|
106
108
|
slotProps: {
|
|
@@ -116,14 +118,14 @@ function X({
|
|
|
116
118
|
onChange: p("min")
|
|
117
119
|
}
|
|
118
120
|
),
|
|
119
|
-
/* @__PURE__ */ t(
|
|
121
|
+
/* @__PURE__ */ t(y, { px: 1, children: "-" }),
|
|
120
122
|
/* @__PURE__ */ t(
|
|
121
|
-
|
|
123
|
+
M,
|
|
122
124
|
{
|
|
123
125
|
label: `${e.name} (Max)`,
|
|
124
126
|
value: i,
|
|
125
127
|
format: o,
|
|
126
|
-
minDate:
|
|
128
|
+
minDate: l !== null ? l : void 0,
|
|
127
129
|
views: ["year", "month", "day"],
|
|
128
130
|
slotProps: {
|
|
129
131
|
textField: {
|
|
@@ -142,18 +144,18 @@ function X({
|
|
|
142
144
|
}
|
|
143
145
|
if (e.type === "boolean")
|
|
144
146
|
return /* @__PURE__ */ t(h, { mb: 2, children: /* @__PURE__ */ t(
|
|
145
|
-
|
|
147
|
+
O,
|
|
146
148
|
{
|
|
147
149
|
label: e.name,
|
|
148
150
|
control: /* @__PURE__ */ t(
|
|
149
|
-
|
|
151
|
+
P,
|
|
150
152
|
{
|
|
151
153
|
size: s,
|
|
152
154
|
name: e.propertyId,
|
|
153
|
-
checked: !!
|
|
154
|
-
icon: /* @__PURE__ */ t(
|
|
155
|
-
checkedIcon: /* @__PURE__ */ t(
|
|
156
|
-
onChange:
|
|
155
|
+
checked: !!a,
|
|
156
|
+
icon: /* @__PURE__ */ t(T, {}),
|
|
157
|
+
checkedIcon: /* @__PURE__ */ t(Y, {}),
|
|
158
|
+
onChange: f("exact")
|
|
157
159
|
}
|
|
158
160
|
),
|
|
159
161
|
slotProps: {
|
|
@@ -164,23 +166,23 @@ function X({
|
|
|
164
166
|
}
|
|
165
167
|
) });
|
|
166
168
|
if (e.type === "enum" || e.type === "composite-list" && ((I = (g = e.dataTypeInfo) == null ? void 0 : g.innerType) == null ? void 0 : I.type) === "enum") {
|
|
167
|
-
const [o, n] =
|
|
169
|
+
const [o, n] = S(!1), l = 10;
|
|
168
170
|
let i = [];
|
|
169
|
-
return (V = e.dataTypeInfo) != null && V.enumValues && (i = e.dataTypeInfo.enumValues), (
|
|
170
|
-
/* @__PURE__ */ u(
|
|
171
|
-
/* @__PURE__ */ t(
|
|
172
|
-
/* @__PURE__ */ t(
|
|
173
|
-
|
|
171
|
+
return (V = e.dataTypeInfo) != null && V.enumValues && (i = e.dataTypeInfo.enumValues), (L = (C = e.dataTypeInfo) == null ? void 0 : C.innerType) != null && L.enumValues && (i = e.dataTypeInfo.innerType.enumValues), /* @__PURE__ */ u(h, { mb: 2, children: [
|
|
172
|
+
/* @__PURE__ */ u(j, { fullWidth: !0, component: "fieldset", variant: d, children: [
|
|
173
|
+
/* @__PURE__ */ t(W, { component: "legend", sx: { mb: 1 }, children: e.name }),
|
|
174
|
+
/* @__PURE__ */ t(z, { children: i.slice(0, o ? 9999 : l).map((m, c) => /* @__PURE__ */ t(
|
|
175
|
+
O,
|
|
174
176
|
{
|
|
175
177
|
label: m,
|
|
176
178
|
control: /* @__PURE__ */ t(
|
|
177
|
-
|
|
179
|
+
P,
|
|
178
180
|
{
|
|
179
181
|
name: e.propertyId,
|
|
180
182
|
value: m,
|
|
181
183
|
size: "small",
|
|
182
|
-
checked:
|
|
183
|
-
onChange:
|
|
184
|
+
checked: a.atLeastOneOf ? a.atLeastOneOf.includes(m) : !1,
|
|
185
|
+
onChange: k
|
|
184
186
|
}
|
|
185
187
|
),
|
|
186
188
|
componentsProps: {
|
|
@@ -189,15 +191,15 @@ function X({
|
|
|
189
191
|
}
|
|
190
192
|
}
|
|
191
193
|
},
|
|
192
|
-
|
|
194
|
+
c
|
|
193
195
|
)) })
|
|
194
196
|
] }),
|
|
195
|
-
i.length >
|
|
196
|
-
|
|
197
|
+
i.length > l && /* @__PURE__ */ u(
|
|
198
|
+
$,
|
|
197
199
|
{
|
|
198
200
|
size: "small",
|
|
199
201
|
sx: { p: 0, textTransform: "none" },
|
|
200
|
-
endIcon: o ? /* @__PURE__ */ t(
|
|
202
|
+
endIcon: o ? /* @__PURE__ */ t(D, {}) : /* @__PURE__ */ t(B, {}),
|
|
201
203
|
onClick: () => n((m) => !m),
|
|
202
204
|
children: [
|
|
203
205
|
"Show ",
|
|
@@ -207,7 +209,7 @@ function X({
|
|
|
207
209
|
)
|
|
208
210
|
] });
|
|
209
211
|
}
|
|
210
|
-
return /* @__PURE__ */ t(
|
|
212
|
+
return /* @__PURE__ */ t(F, {});
|
|
211
213
|
}
|
|
212
214
|
export {
|
|
213
215
|
X as default
|
package/dist/main.d.ts
CHANGED