@hortiview/shared-components 0.0.5635 → 0.0.5696
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,83 +1,89 @@
|
|
|
1
1
|
import "../../../assets/FormDatePicker.css";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { Datepicker as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
const
|
|
8
|
-
datePickerContainer:
|
|
2
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
3
|
+
import { Datepicker as h } from "@element/react-components";
|
|
4
|
+
import { g as v } from "../../../get-Dyz8NMrE.js";
|
|
5
|
+
import { useMemo as n } from "react";
|
|
6
|
+
import { useFormContext as q, Controller as F } from "react-hook-form";
|
|
7
|
+
const Y = "_datePickerContainer_gkrp1_1", H = "_invalid_gkrp1_5", M = "_fromPickerText_gkrp1_9", Q = "_datePickerCalendar_gkrp1_13", s = {
|
|
8
|
+
datePickerContainer: Y,
|
|
9
9
|
invalid: H,
|
|
10
|
-
fromPickerText:
|
|
11
|
-
datePickerCalendar:
|
|
12
|
-
},
|
|
13
|
-
propertyName:
|
|
14
|
-
label:
|
|
15
|
-
className:
|
|
16
|
-
minRangeYear:
|
|
17
|
-
maxRangeYear:
|
|
18
|
-
locale:
|
|
19
|
-
rules:
|
|
10
|
+
fromPickerText: M,
|
|
11
|
+
datePickerCalendar: Q
|
|
12
|
+
}, O = ({
|
|
13
|
+
propertyName: t,
|
|
14
|
+
label: u,
|
|
15
|
+
className: g,
|
|
16
|
+
minRangeYear: l,
|
|
17
|
+
maxRangeYear: m,
|
|
18
|
+
locale: x,
|
|
19
|
+
rules: o
|
|
20
20
|
}) => {
|
|
21
21
|
const {
|
|
22
|
-
control:
|
|
23
|
-
formState: { errors: r, isValidating:
|
|
24
|
-
} =
|
|
25
|
-
() =>
|
|
26
|
-
[
|
|
27
|
-
),
|
|
28
|
-
() =>
|
|
29
|
-
[
|
|
30
|
-
),
|
|
31
|
-
() => (/* @__PURE__ */ new Date()).getFullYear() - (
|
|
32
|
-
[d]
|
|
33
|
-
), C = t(
|
|
34
|
-
() => (/* @__PURE__ */ new Date()).getFullYear() + (l ?? 15),
|
|
22
|
+
control: _,
|
|
23
|
+
formState: { errors: r, isValidating: f }
|
|
24
|
+
} = q(), k = n(
|
|
25
|
+
() => o?.required?.value,
|
|
26
|
+
[o]
|
|
27
|
+
), P = n(
|
|
28
|
+
() => o?.required?.message,
|
|
29
|
+
[o]
|
|
30
|
+
), p = n(
|
|
31
|
+
() => (/* @__PURE__ */ new Date()).getFullYear() - (l ?? 95),
|
|
35
32
|
[l]
|
|
36
|
-
),
|
|
37
|
-
() =>
|
|
38
|
-
[
|
|
39
|
-
),
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
), C = n(
|
|
34
|
+
() => (/* @__PURE__ */ new Date()).getFullYear() + (m ?? 15),
|
|
35
|
+
[m]
|
|
36
|
+
), c = n(
|
|
37
|
+
() => !f && v(r, t) !== void 0,
|
|
38
|
+
[r, t, f]
|
|
39
|
+
), T = n(() => ({
|
|
40
|
+
valid: !c,
|
|
41
|
+
helperTextPersistent: c || k,
|
|
42
42
|
helperText: (() => {
|
|
43
|
-
if (r && r[
|
|
44
|
-
const
|
|
45
|
-
return
|
|
43
|
+
if (r && r[t]) {
|
|
44
|
+
const i = r[t]?.message;
|
|
45
|
+
return i || "Invalid input";
|
|
46
46
|
}
|
|
47
|
-
return
|
|
47
|
+
return P;
|
|
48
48
|
})(),
|
|
49
|
-
className: `${
|
|
50
|
-
}), [r,
|
|
51
|
-
return /* @__PURE__ */
|
|
52
|
-
|
|
49
|
+
className: `${s.fromPickerText} ${c ? s.invalid : ""}`
|
|
50
|
+
}), [r, P, t, k, c]);
|
|
51
|
+
return /* @__PURE__ */ d(
|
|
52
|
+
F,
|
|
53
53
|
{
|
|
54
|
-
name:
|
|
55
|
-
rules:
|
|
56
|
-
control:
|
|
57
|
-
render: ({ field: { ref:
|
|
58
|
-
|
|
54
|
+
name: t,
|
|
55
|
+
rules: o,
|
|
56
|
+
control: _,
|
|
57
|
+
render: ({ field: { ref: D, onChange: i, value: a, ...S } }) => /* @__PURE__ */ d("div", { className: s.datePickerContainer, children: /* @__PURE__ */ d(
|
|
58
|
+
h,
|
|
59
59
|
{
|
|
60
|
-
...
|
|
61
|
-
className:
|
|
62
|
-
value:
|
|
60
|
+
...S,
|
|
61
|
+
className: g ?? "",
|
|
62
|
+
value: a,
|
|
63
63
|
variant: "outlined",
|
|
64
|
-
label:
|
|
65
|
-
format: (
|
|
64
|
+
label: u,
|
|
65
|
+
format: (e) => e ? e.toLocaleDateString(x ?? "en") : "",
|
|
66
66
|
disableClearing: !0,
|
|
67
|
-
onSelect: (
|
|
68
|
-
|
|
67
|
+
onSelect: (e) => {
|
|
68
|
+
i(e);
|
|
69
|
+
},
|
|
70
|
+
onSelectMonth: (e) => {
|
|
71
|
+
a && (e.setDate(a.getDate()), i(e));
|
|
72
|
+
},
|
|
73
|
+
onSelectYear: (e) => {
|
|
74
|
+
a && (e.setDate(a.getDate()), i(e));
|
|
69
75
|
},
|
|
70
76
|
hoisted: !0,
|
|
71
|
-
calendarProps: { hoisted: !0, className:
|
|
72
|
-
minQuickSelectYear:
|
|
77
|
+
calendarProps: { hoisted: !0, className: s.datePickerCalendar },
|
|
78
|
+
minQuickSelectYear: p,
|
|
73
79
|
maxQuickSelectYear: C,
|
|
74
80
|
readOnly: !0,
|
|
75
|
-
textfieldProps:
|
|
81
|
+
textfieldProps: T
|
|
76
82
|
}
|
|
77
83
|
) })
|
|
78
84
|
}
|
|
79
85
|
);
|
|
80
86
|
};
|
|
81
87
|
export {
|
|
82
|
-
|
|
88
|
+
O as FormDatePicker
|
|
83
89
|
};
|
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.5696",
|
|
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>",
|