@hybridcore/ui 1.5.3 → 1.5.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,73 +1,75 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useTheme as
|
|
4
|
-
import { DatePicker as
|
|
1
|
+
import { jsxs as c, Fragment as y, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as F, useMemo as P } from "react";
|
|
3
|
+
import { useTheme as B, Stack as E, Box as I, IconButton as R, Menu as Z, MenuItem as $ } from "@mui/material";
|
|
4
|
+
import { DatePicker as j } from "@mui/x-date-pickers";
|
|
5
5
|
import g from "dayjs";
|
|
6
|
-
import
|
|
7
|
-
import { PatternFormat as
|
|
8
|
-
import { Schedule as
|
|
9
|
-
import
|
|
10
|
-
const
|
|
11
|
-
value:
|
|
6
|
+
import M from "lodash";
|
|
7
|
+
import { PatternFormat as v } from "react-number-format";
|
|
8
|
+
import { Schedule as z } from "@mui/icons-material";
|
|
9
|
+
import L from "../../hooks/useMenuLogic.js";
|
|
10
|
+
const U = ({
|
|
11
|
+
value: p,
|
|
12
12
|
name: D,
|
|
13
|
-
minDate:
|
|
13
|
+
minDate: m,
|
|
14
14
|
variant: r,
|
|
15
15
|
label: x,
|
|
16
|
-
size:
|
|
17
|
-
minuteStep:
|
|
18
|
-
pattern:
|
|
19
|
-
onChange:
|
|
16
|
+
size: H = "small",
|
|
17
|
+
minuteStep: d = 30,
|
|
18
|
+
pattern: b = "##:##:##",
|
|
19
|
+
onChange: u
|
|
20
20
|
}) => {
|
|
21
|
-
const n =
|
|
21
|
+
const n = L(), [t, h] = F(p ? g(p) : null), f = B(), S = P(() => {
|
|
22
22
|
const o = [];
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
let a = 0;
|
|
24
|
+
m && t && m.format("YYYY-MM-DD") === t.format("YYYY-MM-DD") && (a = Number(m.format("HH")));
|
|
25
|
+
for (let s = a; s < 24; s++)
|
|
26
|
+
for (let i = 0; i < 60 / d; i++) {
|
|
27
|
+
const l = M.padStart(s.toString(), 2, "0"), k = M.padStart(
|
|
28
|
+
(i * d).toString(),
|
|
27
29
|
2,
|
|
28
30
|
"0"
|
|
29
|
-
),
|
|
30
|
-
o.push(
|
|
31
|
+
), w = `${l}:${k}`;
|
|
32
|
+
o.push(w);
|
|
31
33
|
}
|
|
32
34
|
return o;
|
|
33
|
-
}, [
|
|
34
|
-
o && (
|
|
35
|
-
},
|
|
36
|
-
const [s, i
|
|
37
|
-
|
|
35
|
+
}, [d, t]), C = (o) => {
|
|
36
|
+
o && (h(o), u(o.format("YYYY-MM-DDTHH:mm:ssZ")));
|
|
37
|
+
}, Y = (o) => {
|
|
38
|
+
const [a, s, i] = o.target.value.split(":"), l = g(t).set("hour", a ?? 0).set("m", s ?? 0).set("s", i ?? 0);
|
|
39
|
+
h(l), u(l.format("YYYY-MM-DDTHH:mm:ssZ"));
|
|
38
40
|
}, T = (o) => () => {
|
|
39
|
-
|
|
41
|
+
Y({
|
|
40
42
|
target: {
|
|
41
43
|
value: o
|
|
42
44
|
}
|
|
43
45
|
}), n.action.close();
|
|
44
46
|
};
|
|
45
|
-
return /* @__PURE__ */
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
+
return /* @__PURE__ */ c(y, { children: [
|
|
48
|
+
/* @__PURE__ */ c(E, { direction: "row", spacing: 2, mb: 1, alignItems: "flex-end", children: [
|
|
47
49
|
/* @__PURE__ */ e(
|
|
48
|
-
|
|
50
|
+
j,
|
|
49
51
|
{
|
|
50
52
|
label: x,
|
|
51
53
|
value: t,
|
|
52
54
|
format: "DD/MM/YYYY",
|
|
53
|
-
minDate:
|
|
54
|
-
onChange:
|
|
55
|
+
minDate: m,
|
|
56
|
+
onChange: C,
|
|
55
57
|
slotProps: {
|
|
56
58
|
textField: {
|
|
57
59
|
variant: r,
|
|
58
|
-
size:
|
|
60
|
+
size: H
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
64
|
),
|
|
63
|
-
/* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */ c(I, { position: "relative", children: [
|
|
64
66
|
/* @__PURE__ */ e(
|
|
65
|
-
|
|
67
|
+
v,
|
|
66
68
|
{
|
|
67
|
-
format:
|
|
69
|
+
format: b,
|
|
68
70
|
allowEmptyFormatting: !0,
|
|
69
71
|
value: t == null ? void 0 : t.format("HH:mm:ss"),
|
|
70
|
-
onChange:
|
|
72
|
+
onChange: Y,
|
|
71
73
|
style: {
|
|
72
74
|
fontSize: 16,
|
|
73
75
|
width: 120,
|
|
@@ -80,15 +82,15 @@ const Q = ({
|
|
|
80
82
|
...r === "outlined" && {
|
|
81
83
|
height: 54,
|
|
82
84
|
border: "1px solid",
|
|
83
|
-
borderRadius:
|
|
85
|
+
borderRadius: f.shape.borderRadius,
|
|
84
86
|
padding: "0 10px"
|
|
85
87
|
},
|
|
86
|
-
borderColor:
|
|
88
|
+
borderColor: f.palette.action.disabled
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
91
|
),
|
|
90
92
|
/* @__PURE__ */ e(
|
|
91
|
-
|
|
93
|
+
R,
|
|
92
94
|
{
|
|
93
95
|
onClick: n.action.open,
|
|
94
96
|
sx: {
|
|
@@ -101,24 +103,24 @@ const Q = ({
|
|
|
101
103
|
top: 8
|
|
102
104
|
}
|
|
103
105
|
},
|
|
104
|
-
children: /* @__PURE__ */ e(
|
|
106
|
+
children: /* @__PURE__ */ e(z, {})
|
|
105
107
|
}
|
|
106
108
|
)
|
|
107
109
|
] })
|
|
108
110
|
] }),
|
|
109
111
|
/* @__PURE__ */ e(
|
|
110
|
-
|
|
112
|
+
Z,
|
|
111
113
|
{
|
|
112
114
|
id: "time-menu",
|
|
113
115
|
anchorEl: n.state.anchorEl,
|
|
114
116
|
open: n.state.isOpen,
|
|
115
117
|
onClose: n.action.close,
|
|
116
|
-
children:
|
|
118
|
+
children: S.map((o) => /* @__PURE__ */ e($, { onClick: T(o), children: o }, o))
|
|
117
119
|
}
|
|
118
120
|
),
|
|
119
121
|
/* @__PURE__ */ e("input", { type: "hidden", name: D, value: (t == null ? void 0 : t.format()) ?? "" })
|
|
120
122
|
] });
|
|
121
123
|
};
|
|
122
124
|
export {
|
|
123
|
-
|
|
125
|
+
U as DateTimePicker
|
|
124
126
|
};
|
|
@@ -4,44 +4,45 @@ import { V as x } from "../../../../index-JgBxaIU2.js";
|
|
|
4
4
|
import _ from "lodash";
|
|
5
5
|
import { Box as d } from "@mui/material";
|
|
6
6
|
function V({
|
|
7
|
-
template:
|
|
7
|
+
template: n,
|
|
8
8
|
value: i,
|
|
9
9
|
mapboxAccessToken: a,
|
|
10
10
|
variant: f = "outlined",
|
|
11
|
-
fieldOptions:
|
|
12
|
-
onChange:
|
|
11
|
+
fieldOptions: o,
|
|
12
|
+
onChange: c
|
|
13
13
|
}) {
|
|
14
|
-
const
|
|
15
|
-
let r =
|
|
14
|
+
const s = p.useMemo(() => {
|
|
15
|
+
let r = n == null ? void 0 : n.properties.filter((e) => e.visible);
|
|
16
16
|
return r = _.orderBy(r, "id"), r;
|
|
17
|
-
}, [
|
|
17
|
+
}, [n]), m = (r) => {
|
|
18
18
|
const e = {
|
|
19
19
|
target: {
|
|
20
20
|
value: { ...i, ...r }
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
c(e);
|
|
24
24
|
};
|
|
25
|
-
return
|
|
25
|
+
return n === void 0 ? /* @__PURE__ */ t(h, {}) : /* @__PURE__ */ t(d, { display: "flex", flexDirection: "column", children: s.filter((r) => {
|
|
26
26
|
var e;
|
|
27
|
-
return
|
|
27
|
+
return o ? !((e = o[r.propertyId]) != null && e.hidden) : !0;
|
|
28
28
|
}).map((r, e) => {
|
|
29
29
|
var u;
|
|
30
|
-
const
|
|
30
|
+
const l = i ? i[r.propertyId] : "";
|
|
31
31
|
return /* @__PURE__ */ t(
|
|
32
32
|
d,
|
|
33
33
|
{
|
|
34
|
-
...
|
|
35
|
-
order:
|
|
34
|
+
...o && ((u = o[r.propertyId]) == null ? void 0 : u.order) && {
|
|
35
|
+
order: o[r.propertyId].order
|
|
36
36
|
},
|
|
37
37
|
children: /* @__PURE__ */ t(
|
|
38
38
|
x,
|
|
39
39
|
{
|
|
40
40
|
property: r,
|
|
41
|
-
value:
|
|
41
|
+
value: l,
|
|
42
42
|
mapboxAccessToken: a,
|
|
43
43
|
variant: f,
|
|
44
|
-
|
|
44
|
+
fieldOptions: o,
|
|
45
|
+
onChange: m
|
|
45
46
|
}
|
|
46
47
|
)
|
|
47
48
|
},
|