@hortiview/shared-components 0.0.8594 → 0.0.8622
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,90 +1,93 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Datepicker as
|
|
3
|
-
import { g as
|
|
4
|
-
import { useMemo as s, useState as
|
|
5
|
-
import { useFormContext as
|
|
1
|
+
import { jsx as o, jsxs as Y } from "react/jsx-runtime";
|
|
2
|
+
import { Datepicker as w, Divider as M, Padding as U, Button as b } from "@element/react-components";
|
|
3
|
+
import { g as j } from "../../../get-UxX31Aph.js";
|
|
4
|
+
import { useMemo as s, useState as H } from "react";
|
|
5
|
+
import { useFormContext as I, Controller as Q } from "react-hook-form";
|
|
6
6
|
import { s as l } from "../../../formDatePicker.module-BV3ma_7y.js";
|
|
7
|
-
const
|
|
7
|
+
const $ = (t) => {
|
|
8
|
+
const a = new Date(t), u = a.getUTCDate(), f = a.getUTCMonth(), d = a.getUTCFullYear();
|
|
9
|
+
return new Date(d, f, u);
|
|
10
|
+
}, G = ({
|
|
8
11
|
propertyName: t,
|
|
9
|
-
label:
|
|
10
|
-
closeLabel:
|
|
11
|
-
className:
|
|
12
|
-
minRangeYear:
|
|
13
|
-
maxRangeYear:
|
|
14
|
-
locale:
|
|
15
|
-
rules:
|
|
16
|
-
...
|
|
12
|
+
label: a,
|
|
13
|
+
closeLabel: u,
|
|
14
|
+
className: f,
|
|
15
|
+
minRangeYear: d,
|
|
16
|
+
maxRangeYear: g,
|
|
17
|
+
locale: h,
|
|
18
|
+
rules: i,
|
|
19
|
+
...k
|
|
17
20
|
}) => {
|
|
18
21
|
const {
|
|
19
|
-
control:
|
|
20
|
-
formState: { errors: r, isValidating:
|
|
21
|
-
} =
|
|
22
|
-
() =>
|
|
23
|
-
[
|
|
24
|
-
),
|
|
25
|
-
() =>
|
|
26
|
-
[
|
|
27
|
-
),
|
|
28
|
-
() => (/* @__PURE__ */ new Date()).getFullYear() - (
|
|
29
|
-
[
|
|
30
|
-
),
|
|
31
|
-
() => (/* @__PURE__ */ new Date()).getFullYear() + (
|
|
32
|
-
[
|
|
33
|
-
),
|
|
34
|
-
() => !
|
|
35
|
-
[r, t,
|
|
36
|
-
),
|
|
37
|
-
valid: !
|
|
38
|
-
helperTextPersistent:
|
|
22
|
+
control: p,
|
|
23
|
+
formState: { errors: r, isValidating: x }
|
|
24
|
+
} = I(), C = s(
|
|
25
|
+
() => i?.required?.value,
|
|
26
|
+
[i]
|
|
27
|
+
), S = s(
|
|
28
|
+
() => i?.required?.message,
|
|
29
|
+
[i]
|
|
30
|
+
), P = s(
|
|
31
|
+
() => (/* @__PURE__ */ new Date()).getFullYear() - (d ?? 95),
|
|
32
|
+
[d]
|
|
33
|
+
), T = s(
|
|
34
|
+
() => (/* @__PURE__ */ new Date()).getFullYear() + (g ?? 15),
|
|
35
|
+
[g]
|
|
36
|
+
), m = s(
|
|
37
|
+
() => !x && j(r, t) !== void 0,
|
|
38
|
+
[r, t, x]
|
|
39
|
+
), v = s(() => ({
|
|
40
|
+
valid: !m,
|
|
41
|
+
helperTextPersistent: m || C,
|
|
39
42
|
helperText: (() => {
|
|
40
43
|
if (r && r[t]) {
|
|
41
|
-
const
|
|
42
|
-
return
|
|
44
|
+
const n = r[t]?.message;
|
|
45
|
+
return n || "Invalid input";
|
|
43
46
|
}
|
|
44
|
-
return
|
|
47
|
+
return S;
|
|
45
48
|
})(),
|
|
46
|
-
className: `${l.fromPickerText} ${
|
|
47
|
-
}), [r,
|
|
48
|
-
return /* @__PURE__ */
|
|
49
|
-
|
|
49
|
+
className: `${l.fromPickerText} ${m ? l.invalid : ""}`
|
|
50
|
+
}), [r, S, t, C, m]), [F, D] = H(!1);
|
|
51
|
+
return /* @__PURE__ */ o(
|
|
52
|
+
Q,
|
|
50
53
|
{
|
|
51
54
|
name: t,
|
|
52
|
-
rules:
|
|
53
|
-
control:
|
|
54
|
-
render: ({ field: { ref:
|
|
55
|
-
|
|
55
|
+
rules: i,
|
|
56
|
+
control: p,
|
|
57
|
+
render: ({ field: { ref: q, onChange: n, value: c, ...O } }) => /* @__PURE__ */ o("div", { className: l.datePickerContainer, children: /* @__PURE__ */ o(
|
|
58
|
+
w,
|
|
56
59
|
{
|
|
57
|
-
...
|
|
60
|
+
...k,
|
|
58
61
|
...O,
|
|
59
|
-
className:
|
|
60
|
-
value:
|
|
62
|
+
className: f ?? "",
|
|
63
|
+
value: c,
|
|
61
64
|
variant: "outlined",
|
|
62
|
-
label:
|
|
63
|
-
format: (e) => e ? e.toLocaleDateString(
|
|
65
|
+
label: a,
|
|
66
|
+
format: (e) => e ? $(e.toISOString()).toLocaleDateString(h ?? "en") : "",
|
|
64
67
|
disableClearing: !0,
|
|
65
68
|
trailingContent: /* @__PURE__ */ Y("div", { className: l.trailingContent, children: [
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ o(M, {}),
|
|
70
|
+
/* @__PURE__ */ o(U, { variant: "dense", children: /* @__PURE__ */ o(b, { label: u, variant: "text", onClick: () => D(!1) }) })
|
|
68
71
|
] }),
|
|
69
72
|
onClick: () => {
|
|
70
|
-
|
|
73
|
+
D(!0);
|
|
71
74
|
},
|
|
72
75
|
onSelect: (e) => {
|
|
73
|
-
|
|
76
|
+
n(e), D(!1);
|
|
74
77
|
},
|
|
75
78
|
onSelectMonth: (e) => {
|
|
76
|
-
|
|
79
|
+
c && (e.setDate(c.getDate()), n(e));
|
|
77
80
|
},
|
|
78
81
|
onSelectYear: (e) => {
|
|
79
|
-
|
|
82
|
+
c && (e.setDate(c.getDate()), n(e));
|
|
80
83
|
},
|
|
81
84
|
hoisted: !0,
|
|
82
85
|
calendarProps: { hoisted: !0, className: l.datePickerCalendar },
|
|
83
|
-
minQuickSelectYear:
|
|
84
|
-
maxQuickSelectYear:
|
|
86
|
+
minQuickSelectYear: P,
|
|
87
|
+
maxQuickSelectYear: T,
|
|
85
88
|
readOnly: !0,
|
|
86
|
-
textfieldProps:
|
|
87
|
-
alwaysOpen:
|
|
89
|
+
textfieldProps: v,
|
|
90
|
+
alwaysOpen: F
|
|
88
91
|
}
|
|
89
92
|
) })
|
|
90
93
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Elevation as
|
|
3
|
-
import { useState as
|
|
1
|
+
import { jsx as t, jsxs as d, Fragment as y } from "react/jsx-runtime";
|
|
2
|
+
import { Elevation as I, Group as c, TabBar as N, Tab as $, Padding as b } from "@element/react-components";
|
|
3
|
+
import { useState as k, useEffect as x } from "react";
|
|
4
4
|
import { u as w } from "../../useBreakpoints-MzTZ0tCT.js";
|
|
5
|
-
import { s as
|
|
6
|
-
const
|
|
5
|
+
import { s as r } from "../../HashTabView.module-DUekkiTC.js";
|
|
6
|
+
const u = (n, a) => !a || !n ? 0 : n.findIndex((i) => i.hash === a.replace("#", "")) ?? 0, z = ({
|
|
7
7
|
tabs: n,
|
|
8
|
-
hasHash:
|
|
8
|
+
hasHash: a = !0,
|
|
9
9
|
hash: i = "",
|
|
10
|
-
clusterAlign:
|
|
10
|
+
clusterAlign: h = "start",
|
|
11
11
|
hasClusteredTabs: f,
|
|
12
12
|
children: s,
|
|
13
13
|
verticalGap: g = "none",
|
|
@@ -15,36 +15,36 @@ const h = (n, t) => !t || !n ? 0 : n.findIndex((i) => i.hash === t.replace("#",
|
|
|
15
15
|
backgroundColor: T = "themeBackground",
|
|
16
16
|
onChange: A
|
|
17
17
|
}) => {
|
|
18
|
-
const [m, p] =
|
|
19
|
-
|
|
20
|
-
const e =
|
|
18
|
+
const [m, p] = k(u(n, i)), { isDesktop: l } = w();
|
|
19
|
+
x(() => {
|
|
20
|
+
const e = u(n, i);
|
|
21
21
|
p(e);
|
|
22
|
-
}, [i, n,
|
|
22
|
+
}, [i, n, a]);
|
|
23
23
|
const B = (e) => {
|
|
24
24
|
const o = n[e].hash;
|
|
25
|
-
o != null &&
|
|
25
|
+
o != null && a && window.history.replaceState(null, "", `#${o}`), p(e), A?.(e);
|
|
26
26
|
};
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
|
|
27
|
+
return /* @__PURE__ */ t(
|
|
28
|
+
I,
|
|
29
29
|
{
|
|
30
30
|
elevation: v,
|
|
31
|
-
className: `${
|
|
31
|
+
className: `${r.elevation} ${T === "none" ? "" : r.themeBackground}`,
|
|
32
32
|
children: /* @__PURE__ */ d(c, { direction: "vertical", gap: g, secondaryAlign: "stretch", children: [
|
|
33
|
-
/* @__PURE__ */ d(c, { direction: l ? "horizontal" : "vertical", className:
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
-
|
|
33
|
+
/* @__PURE__ */ d(c, { direction: l ? "horizontal" : "vertical", className: r.tabWrapper, children: [
|
|
34
|
+
/* @__PURE__ */ t(
|
|
35
|
+
N,
|
|
36
36
|
{
|
|
37
|
-
className:
|
|
37
|
+
className: r.tabBar,
|
|
38
38
|
clustered: l ? f : !1,
|
|
39
|
-
clusterAlign:
|
|
39
|
+
clusterAlign: h,
|
|
40
40
|
variant: "surface",
|
|
41
41
|
activeTabIndex: m,
|
|
42
42
|
onTabActivated: B,
|
|
43
|
-
children: n.map((e, o) => /* @__PURE__ */
|
|
44
|
-
|
|
43
|
+
children: n.map((e, o) => /* @__PURE__ */ t(
|
|
44
|
+
$,
|
|
45
45
|
{
|
|
46
46
|
icon: e.leadingIcon,
|
|
47
|
-
className: s ?
|
|
47
|
+
className: s ? r.tabButton : "",
|
|
48
48
|
children: /* @__PURE__ */ d(c, { gap: "dense", children: [
|
|
49
49
|
e.title,
|
|
50
50
|
e.trailingIcon
|
|
@@ -54,14 +54,14 @@ const h = (n, t) => !t || !n ? 0 : n.findIndex((i) => i.hash === t.replace("#",
|
|
|
54
54
|
))
|
|
55
55
|
}
|
|
56
56
|
),
|
|
57
|
-
s ? /* @__PURE__ */
|
|
58
|
-
|
|
57
|
+
s ? /* @__PURE__ */ t(
|
|
58
|
+
b,
|
|
59
59
|
{
|
|
60
60
|
variant: "dense",
|
|
61
|
-
className: l ?
|
|
62
|
-
children: /* @__PURE__ */
|
|
61
|
+
className: l ? r.childContainer : r.childContainerPhone,
|
|
62
|
+
children: /* @__PURE__ */ t(c, { gap: "dense", primaryAlign: "center", secondaryAlign: "center", children: s })
|
|
63
63
|
}
|
|
64
|
-
) : /* @__PURE__ */
|
|
64
|
+
) : /* @__PURE__ */ t(y, {})
|
|
65
65
|
] }),
|
|
66
66
|
n[m]?.component
|
|
67
67
|
] })
|
|
@@ -69,5 +69,5 @@ const h = (n, t) => !t || !n ? 0 : n.findIndex((i) => i.hash === t.replace("#",
|
|
|
69
69
|
);
|
|
70
70
|
};
|
|
71
71
|
export {
|
|
72
|
-
|
|
72
|
+
z as HashTabView
|
|
73
73
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hortiview/shared-components",
|
|
3
3
|
"description": "This is a shared component library. It should used in the HortiView platform and its modules.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.8622",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared",
|
|
7
7
|
"author": "Falk Menge <falk.menge.ext@bayer.com>",
|