impact-nova 2.5.18 → 2.5.20
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.
- package/dist/components/data-display/calendar/calendar-quarter-utils.js +12 -12
- package/dist/components/data-display/calendar/calendar-year-utils.js +9 -9
- package/dist/components/data-display/calendar/calendar.js +194 -190
- package/dist/components/forms/date-picker/fiscal-pass-through.d.ts +6 -6
- package/dist/components/forms/date-picker/fiscal-pass-through.js +7 -3
- package/dist/components/forms/date-picker/multi-quarter-picker.js +87 -87
- package/dist/components/forms/date-picker/multi-week-picker.js +1 -1
- package/dist/components/forms/date-picker/multi-year-picker.js +81 -81
- package/dist/components/forms/date-picker/quarter-range-picker.js +84 -84
- package/dist/components/forms/date-picker/week-picker.js +123 -123
- package/dist/components/forms/date-picker/week-range-picker.js +188 -188
- package/dist/components/forms/date-picker/year-range-picker.js +79 -79
- package/dist/form-react/Fields/DateRangeField.js +25 -25
- package/dist/form-react/Fields/MonthRangeField.js +57 -57
- package/dist/form-react/Fields/MultiMonthPickerField.js +28 -26
- package/dist/form-react/Fields/MultiWeekPickerField.js +41 -38
- package/dist/form-react/Fields/MultiYearPickerField.js +45 -45
- package/dist/form-react/Fields/WeekRangePicker.js +18 -16
- package/dist/form-react/Fields/YearPickerField.js +27 -27
- package/dist/form-react/Fields/YearRangePickerField.js +29 -29
- package/dist/form-react/types/fields.types.d.ts +34 -0
- package/dist/form-react/utils/date.utils.d.ts +52 -2
- package/dist/form-react/utils/date.utils.js +198 -62
- package/dist/lib/fiscal-calendar/index.d.ts +2 -2
- package/dist/lib/fiscal-calendar/index.js +26 -24
- package/dist/lib/fiscal-calendar/week-selection.d.ts +5 -0
- package/dist/lib/fiscal-calendar/week-selection.js +56 -49
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- package/package.json +1 -1
|
@@ -1,63 +1,63 @@
|
|
|
1
1
|
import { jsx as r, jsxs as g } from "react/jsx-runtime";
|
|
2
2
|
import * as t from "react";
|
|
3
|
-
import { Cross as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { Input as
|
|
6
|
-
import { Calendar as
|
|
7
|
-
import { Tooltip as x, TooltipTrigger as
|
|
8
|
-
import { useImpactNovaI18n as
|
|
9
|
-
import { buildDateBoundsMatcher as
|
|
10
|
-
import { fiscalCalendarPassThrough as
|
|
11
|
-
import { DatePickerShell as
|
|
12
|
-
import { usePickerDismissActionsRef as
|
|
3
|
+
import { Cross as te, CalendarMonth as ne } from "impact-nova-icons";
|
|
4
|
+
import { cn as oe } from "../../../lib/utils.js";
|
|
5
|
+
import { Input as ae } from "../input/input.js";
|
|
6
|
+
import { Calendar as ie } from "../../data-display/calendar/calendar.js";
|
|
7
|
+
import { Tooltip as x, TooltipTrigger as Y, TooltipContent as D } from "../../feedback/tooltip/tooltip.js";
|
|
8
|
+
import { useImpactNovaI18n as ce } from "../../../i18n/use-impact-nova-i18n.js";
|
|
9
|
+
import { buildDateBoundsMatcher as se } from "../../../lib/date-bounds-matcher.js";
|
|
10
|
+
import { fiscalCalendarPassThrough as le } from "./fiscal-pass-through.js";
|
|
11
|
+
import { DatePickerShell as fe } from "./date-picker-shell.js";
|
|
12
|
+
import { usePickerDismissActionsRef as pe, usePickerFooterDismissNudge as de, handleReadonlyPickerKeyDown as me, handlePickerSurfacePointerDown as ue } from "./date-input-behavior.js";
|
|
13
13
|
import { formatYearInput as N } from "../../data-display/calendar/calendar-fiscal-labels.js";
|
|
14
|
-
import { viewMonthFromYear as
|
|
15
|
-
const
|
|
14
|
+
import { viewMonthFromYear as he, isYearRangeSelection as ge } from "../../data-display/calendar/calendar-year-utils.js";
|
|
15
|
+
const ye = t.forwardRef(
|
|
16
16
|
({
|
|
17
|
-
value:
|
|
17
|
+
value: y,
|
|
18
18
|
onChange: d,
|
|
19
19
|
placeholder: S,
|
|
20
|
-
minDate:
|
|
21
|
-
maxDate:
|
|
22
|
-
startMonth:
|
|
23
|
-
endMonth:
|
|
20
|
+
minDate: A,
|
|
21
|
+
maxDate: I,
|
|
22
|
+
startMonth: M,
|
|
23
|
+
endMonth: O,
|
|
24
24
|
showFooter: l = !0,
|
|
25
25
|
disabled: o,
|
|
26
|
-
className:
|
|
27
|
-
calendarKind:
|
|
28
|
-
fiscalMode:
|
|
29
|
-
granularity:
|
|
30
|
-
fiscalMonthPattern:
|
|
31
|
-
fiscalYearStartMonth:
|
|
32
|
-
fiscalConfig:
|
|
33
|
-
weekStartsOn:
|
|
34
|
-
showPresets:
|
|
35
|
-
showPeriodBoundaries:
|
|
36
|
-
autoNavigateToAvailable:
|
|
37
|
-
showIntervalCaption:
|
|
38
|
-
...
|
|
39
|
-
},
|
|
40
|
-
const { t: a } =
|
|
41
|
-
t.useImperativeHandle(
|
|
42
|
-
const [i, c] = t.useState(!1), u = t.useRef(!1),
|
|
26
|
+
className: T,
|
|
27
|
+
calendarKind: w,
|
|
28
|
+
fiscalMode: K,
|
|
29
|
+
granularity: j,
|
|
30
|
+
fiscalMonthPattern: F,
|
|
31
|
+
fiscalYearStartMonth: L,
|
|
32
|
+
fiscalConfig: k,
|
|
33
|
+
weekStartsOn: $,
|
|
34
|
+
showPresets: z,
|
|
35
|
+
showPeriodBoundaries: E,
|
|
36
|
+
autoNavigateToAvailable: H,
|
|
37
|
+
showIntervalCaption: V = !1,
|
|
38
|
+
...B
|
|
39
|
+
}, q) => {
|
|
40
|
+
const { t: a } = ce(), G = S ?? a("datePicker.selectYearRange"), P = k?.fyLabel ?? "fy-long", m = t.useRef(null), R = t.useRef(null);
|
|
41
|
+
t.useImperativeHandle(q, () => m.current);
|
|
42
|
+
const [i, c] = t.useState(!1), u = t.useRef(!1), v = pe(), { footerFlashKey: J, footerFlashTarget: Q, popoverHandlers: U } = de(l, i, v, R), n = ge(y) ? y : void 0, [C, f] = t.useState(n), [W, X] = t.useState(he(n?.from));
|
|
43
43
|
t.useEffect(() => {
|
|
44
44
|
i || f(n);
|
|
45
45
|
}, [i, n]);
|
|
46
|
-
const p = t.useCallback(() => c(!1), []),
|
|
47
|
-
calendarKind:
|
|
48
|
-
fiscalMode:
|
|
49
|
-
granularity:
|
|
50
|
-
fiscalMonthPattern:
|
|
51
|
-
fiscalYearStartMonth:
|
|
52
|
-
fiscalConfig:
|
|
53
|
-
weekStartsOn:
|
|
54
|
-
showPresets:
|
|
55
|
-
showPeriodBoundaries:
|
|
56
|
-
autoNavigateToAvailable:
|
|
57
|
-
}),
|
|
46
|
+
const p = t.useCallback(() => c(!1), []), Z = le({
|
|
47
|
+
calendarKind: w,
|
|
48
|
+
fiscalMode: K,
|
|
49
|
+
granularity: j,
|
|
50
|
+
fiscalMonthPattern: F,
|
|
51
|
+
fiscalYearStartMonth: L,
|
|
52
|
+
fiscalConfig: k,
|
|
53
|
+
weekStartsOn: $,
|
|
54
|
+
showPresets: z,
|
|
55
|
+
showPeriodBoundaries: E,
|
|
56
|
+
autoNavigateToAvailable: H
|
|
57
|
+
}), _ = (e) => {
|
|
58
58
|
const s = e && !Array.isArray(e) && ("from" in e || "to" in e) ? e : void 0;
|
|
59
59
|
f(s), l || (d?.(s), s?.to && p());
|
|
60
|
-
},
|
|
60
|
+
}, ee = () => {
|
|
61
61
|
d?.(C), p();
|
|
62
62
|
}, h = () => {
|
|
63
63
|
f(n), p();
|
|
@@ -65,11 +65,11 @@ const he = t.forwardRef(
|
|
|
65
65
|
f(void 0), d?.(void 0), l || p();
|
|
66
66
|
};
|
|
67
67
|
t.useLayoutEffect(() => {
|
|
68
|
-
|
|
68
|
+
v.current = { onDismiss: h, resolveFlash: () => "cancel" };
|
|
69
69
|
});
|
|
70
|
-
const
|
|
70
|
+
const re = n?.from ? `${N(n.from, P)}${n.to ? ` – ${N(n.to, P)}` : ""}` : "";
|
|
71
71
|
return /* @__PURE__ */ r(
|
|
72
|
-
|
|
72
|
+
fe,
|
|
73
73
|
{
|
|
74
74
|
open: i,
|
|
75
75
|
disabled: o,
|
|
@@ -80,26 +80,26 @@ const he = t.forwardRef(
|
|
|
80
80
|
onOpenAutoFocus: (e) => {
|
|
81
81
|
u.current || e.preventDefault(), u.current = !1;
|
|
82
82
|
},
|
|
83
|
-
popoverHandlers:
|
|
83
|
+
popoverHandlers: U,
|
|
84
84
|
trigger: /* @__PURE__ */ r(
|
|
85
85
|
"div",
|
|
86
86
|
{
|
|
87
|
-
ref:
|
|
87
|
+
ref: R,
|
|
88
88
|
"data-component": "year-range-picker",
|
|
89
89
|
"data-state": i ? "open" : "closed",
|
|
90
|
-
onPointerDown: (e) =>
|
|
90
|
+
onPointerDown: (e) => ue({
|
|
91
91
|
disabled: o,
|
|
92
92
|
event: e,
|
|
93
93
|
onOpen: () => c(!0),
|
|
94
94
|
focusField: () => m.current?.focus()
|
|
95
95
|
}),
|
|
96
96
|
children: /* @__PURE__ */ r(
|
|
97
|
-
|
|
97
|
+
ae,
|
|
98
98
|
{
|
|
99
99
|
ref: m,
|
|
100
|
-
value:
|
|
100
|
+
value: re,
|
|
101
101
|
readOnly: !0,
|
|
102
|
-
onKeyDown: (e) =>
|
|
102
|
+
onKeyDown: (e) => me(e, {
|
|
103
103
|
disabled: o,
|
|
104
104
|
open: i,
|
|
105
105
|
onOpen: () => c(!0),
|
|
@@ -109,13 +109,13 @@ const he = t.forwardRef(
|
|
|
109
109
|
}
|
|
110
110
|
}),
|
|
111
111
|
onClick: () => !o && c(!0),
|
|
112
|
-
placeholder:
|
|
112
|
+
placeholder: G,
|
|
113
113
|
disabled: o,
|
|
114
114
|
"data-form-control": "input",
|
|
115
|
-
className:
|
|
115
|
+
className: oe("cursor-pointer", T),
|
|
116
116
|
suffix: /* @__PURE__ */ g("div", { className: "flex items-center gap-1", children: [
|
|
117
117
|
n?.from && !o ? /* @__PURE__ */ g(x, { children: [
|
|
118
|
-
/* @__PURE__ */ r(
|
|
118
|
+
/* @__PURE__ */ r(Y, { asChild: !0, children: /* @__PURE__ */ r(
|
|
119
119
|
"button",
|
|
120
120
|
{
|
|
121
121
|
type: "button",
|
|
@@ -125,13 +125,13 @@ const he = t.forwardRef(
|
|
|
125
125
|
e.stopPropagation(), b();
|
|
126
126
|
},
|
|
127
127
|
className: "inline-flex size-4 items-center justify-center border-none bg-transparent p-0",
|
|
128
|
-
children: /* @__PURE__ */ r(
|
|
128
|
+
children: /* @__PURE__ */ r(te, { className: "size-3 hover:text-content" })
|
|
129
129
|
}
|
|
130
130
|
) }),
|
|
131
|
-
/* @__PURE__ */ r(
|
|
131
|
+
/* @__PURE__ */ r(D, { variant: "tertiary", side: "top", children: a("calendar.clear") })
|
|
132
132
|
] }) : null,
|
|
133
133
|
/* @__PURE__ */ g(x, { children: [
|
|
134
|
-
/* @__PURE__ */ r(
|
|
134
|
+
/* @__PURE__ */ r(Y, { asChild: !0, children: /* @__PURE__ */ r(
|
|
135
135
|
"button",
|
|
136
136
|
{
|
|
137
137
|
type: "button",
|
|
@@ -142,44 +142,44 @@ const he = t.forwardRef(
|
|
|
142
142
|
e.stopPropagation(), o || c((s) => !s);
|
|
143
143
|
},
|
|
144
144
|
className: "inline-flex items-center justify-center border-none bg-transparent p-0",
|
|
145
|
-
children: /* @__PURE__ */ r(
|
|
145
|
+
children: /* @__PURE__ */ r(ne, { className: "h-4 w-4 text-secondary-foreground" })
|
|
146
146
|
}
|
|
147
147
|
) }),
|
|
148
|
-
/* @__PURE__ */ r(
|
|
148
|
+
/* @__PURE__ */ r(D, { variant: "tertiary", side: "top", children: a("datePicker.selectYearRange") })
|
|
149
149
|
] })
|
|
150
150
|
] }),
|
|
151
|
-
...
|
|
151
|
+
...B
|
|
152
152
|
}
|
|
153
153
|
)
|
|
154
154
|
}
|
|
155
155
|
),
|
|
156
156
|
children: /* @__PURE__ */ r(
|
|
157
|
-
|
|
157
|
+
ie,
|
|
158
158
|
{
|
|
159
159
|
pickerType: "year",
|
|
160
160
|
yearMode: "range",
|
|
161
161
|
selectedYear: C,
|
|
162
|
-
footerFlashKey:
|
|
163
|
-
footerFlashTarget:
|
|
164
|
-
onYearSelect:
|
|
165
|
-
month:
|
|
166
|
-
onMonthChange:
|
|
167
|
-
disabled:
|
|
168
|
-
startMonth:
|
|
169
|
-
endMonth:
|
|
162
|
+
footerFlashKey: J,
|
|
163
|
+
footerFlashTarget: Q,
|
|
164
|
+
onYearSelect: _,
|
|
165
|
+
month: W,
|
|
166
|
+
onMonthChange: X,
|
|
167
|
+
disabled: se(A, I),
|
|
168
|
+
startMonth: M,
|
|
169
|
+
endMonth: O,
|
|
170
170
|
showFooter: l,
|
|
171
|
-
onApply:
|
|
171
|
+
onApply: ee,
|
|
172
172
|
onCancel: h,
|
|
173
173
|
onClear: b,
|
|
174
|
-
showIntervalCaption:
|
|
175
|
-
...
|
|
174
|
+
showIntervalCaption: V,
|
|
175
|
+
...Z
|
|
176
176
|
}
|
|
177
177
|
)
|
|
178
178
|
}
|
|
179
179
|
);
|
|
180
180
|
}
|
|
181
181
|
);
|
|
182
|
-
|
|
182
|
+
ye.displayName = "YearRangePicker";
|
|
183
183
|
export {
|
|
184
|
-
|
|
184
|
+
ye as YearRangePicker
|
|
185
185
|
};
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { Controller as
|
|
3
|
+
import { Controller as S } from "react-hook-form";
|
|
4
4
|
import { DateRangePicker as v } from "../../components/forms/date-picker/date-range-picker.js";
|
|
5
|
-
import { toLocalDate as
|
|
6
|
-
import {
|
|
7
|
-
const
|
|
5
|
+
import { toLocalDate as c } from "../utils/calendar-boundary.js";
|
|
6
|
+
import { resolveDateRangeMinMax as P } from "../utils/date.utils.js";
|
|
7
|
+
const Y = ({
|
|
8
8
|
field: r,
|
|
9
|
-
validationRules:
|
|
9
|
+
validationRules: d,
|
|
10
10
|
isDisabled: l,
|
|
11
|
-
formHelpers:
|
|
11
|
+
formHelpers: n
|
|
12
12
|
}) => {
|
|
13
13
|
const t = r.fieldType === "date_range" ? r : null;
|
|
14
14
|
if (!t) return null;
|
|
15
|
-
const
|
|
16
|
-
return /* @__PURE__ */
|
|
17
|
-
|
|
15
|
+
const h = n.form.control, { minDate: m, maxDate: u, startMonth: p, endMonth: g } = P(t);
|
|
16
|
+
return /* @__PURE__ */ a(
|
|
17
|
+
S,
|
|
18
18
|
{
|
|
19
19
|
name: r.id,
|
|
20
|
-
control:
|
|
20
|
+
control: h,
|
|
21
21
|
disabled: l,
|
|
22
|
-
rules:
|
|
23
|
-
render: ({ field:
|
|
24
|
-
const
|
|
25
|
-
return /* @__PURE__ */
|
|
22
|
+
rules: d,
|
|
23
|
+
render: ({ field: f, fieldState: s }) => {
|
|
24
|
+
const i = !!s.error, o = f.value;
|
|
25
|
+
return /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
|
|
26
26
|
v,
|
|
27
27
|
{
|
|
28
28
|
label: r.label,
|
|
29
29
|
minDate: m,
|
|
30
30
|
maxDate: u,
|
|
31
|
-
startMonth:
|
|
32
|
-
endMonth:
|
|
31
|
+
startMonth: p,
|
|
32
|
+
endMonth: g,
|
|
33
33
|
value: {
|
|
34
|
-
from:
|
|
35
|
-
to:
|
|
34
|
+
from: o?.start ? c(o.start) : void 0,
|
|
35
|
+
to: o?.end ? c(o.end) : void 0
|
|
36
36
|
},
|
|
37
|
-
onChange: (
|
|
38
|
-
const M =
|
|
39
|
-
|
|
37
|
+
onChange: (e) => {
|
|
38
|
+
const M = e?.from ? `${e.from.getFullYear()}-${String(e.from.getMonth() + 1).padStart(2, "0")}-${String(e.from.getDate()).padStart(2, "0")}` : null, D = e?.to ? `${e.to.getFullYear()}-${String(e.to.getMonth() + 1).padStart(2, "0")}-${String(e.to.getDate()).padStart(2, "0")}` : null;
|
|
39
|
+
n.setValue(r.id, { start: M, end: D });
|
|
40
40
|
},
|
|
41
41
|
startPlaceholder: t.startPlaceholder || "Start Date",
|
|
42
42
|
endPlaceholder: t.endPlaceholder || "End Date",
|
|
43
43
|
placeholder: r.placeholder,
|
|
44
44
|
required: r.isRequired,
|
|
45
45
|
disabled: l,
|
|
46
|
-
error:
|
|
47
|
-
helperText:
|
|
46
|
+
error: i,
|
|
47
|
+
helperText: i ? s.error?.message : r.helpText,
|
|
48
48
|
showFooter: !0,
|
|
49
49
|
calendarKind: t.calendarKind,
|
|
50
50
|
fiscalMode: t.fiscalMode,
|
|
@@ -59,5 +59,5 @@ const T = ({
|
|
|
59
59
|
);
|
|
60
60
|
};
|
|
61
61
|
export {
|
|
62
|
-
|
|
62
|
+
Y as DateRangeField
|
|
63
63
|
};
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Controller as
|
|
3
|
-
import { MonthRangePicker as
|
|
4
|
-
import { getFieldTestId as
|
|
5
|
-
import {
|
|
6
|
-
const
|
|
7
|
-
if (
|
|
8
|
-
const [
|
|
9
|
-
return { year: parseInt(
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { Controller as F } from "react-hook-form";
|
|
3
|
+
import { MonthRangePicker as b } from "../../components/forms/date-picker/month-range-picker.js";
|
|
4
|
+
import { getFieldTestId as w } from "../utils/fieldTestIds.js";
|
|
5
|
+
import { resolveMonthRangeMinMax as I } from "../utils/date.utils.js";
|
|
6
|
+
const D = (r) => {
|
|
7
|
+
if (r.includes("/")) {
|
|
8
|
+
const [a, l] = r.split("/");
|
|
9
|
+
return { year: parseInt(l, 10), month: parseInt(a, 10) - 1 };
|
|
10
10
|
}
|
|
11
|
-
const [
|
|
12
|
-
return { year: parseInt(
|
|
13
|
-
},
|
|
14
|
-
field:
|
|
15
|
-
validationRules:
|
|
16
|
-
isDisabled:
|
|
17
|
-
formHelpers:
|
|
11
|
+
const [n, s] = r.split("-");
|
|
12
|
+
return { year: parseInt(n, 10), month: parseInt(s, 10) - 1 };
|
|
13
|
+
}, K = ({
|
|
14
|
+
field: r,
|
|
15
|
+
validationRules: n,
|
|
16
|
+
isDisabled: s,
|
|
17
|
+
formHelpers: a
|
|
18
18
|
}) => {
|
|
19
|
-
const
|
|
20
|
-
if (!
|
|
21
|
-
const y =
|
|
22
|
-
return /* @__PURE__ */
|
|
23
|
-
|
|
19
|
+
const l = a.form.control, e = r.fieldType === "month_range" ? r : null;
|
|
20
|
+
if (!e) return null;
|
|
21
|
+
const y = e.displayFormat || "MM/YYYY", { minDate: u, maxDate: c, startMonth: v, endMonth: $ } = I(e);
|
|
22
|
+
return /* @__PURE__ */ i(
|
|
23
|
+
F,
|
|
24
24
|
{
|
|
25
|
-
name:
|
|
26
|
-
control:
|
|
27
|
-
defaultValue:
|
|
28
|
-
rules:
|
|
29
|
-
render: ({ field: d, fieldState:
|
|
30
|
-
const
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
-
|
|
25
|
+
name: r.id,
|
|
26
|
+
control: l,
|
|
27
|
+
defaultValue: e.defaultRange ? { start: e.defaultRange.start || null, end: e.defaultRange.end || null } : void 0,
|
|
28
|
+
rules: n,
|
|
29
|
+
render: ({ field: d, fieldState: p }) => {
|
|
30
|
+
const M = !!p.error, o = d.value, h = o?.start ? D(o.start) : null, S = o?.end ? D(o.end) : null, x = h && S;
|
|
31
|
+
return /* @__PURE__ */ i("div", { "data-testid": w(r.id), children: /* @__PURE__ */ i(
|
|
32
|
+
b,
|
|
33
33
|
{
|
|
34
|
-
label:
|
|
34
|
+
label: r.label,
|
|
35
35
|
displayFormat: y,
|
|
36
|
-
...
|
|
36
|
+
...x && {
|
|
37
37
|
value: {
|
|
38
|
-
from:
|
|
39
|
-
to:
|
|
38
|
+
from: h,
|
|
39
|
+
to: S
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
|
-
onChange: (
|
|
43
|
-
if (!
|
|
44
|
-
const
|
|
45
|
-
d.onChange(
|
|
42
|
+
onChange: (t) => {
|
|
43
|
+
if (!t?.from || !t?.to) {
|
|
44
|
+
const g = { start: null, end: null };
|
|
45
|
+
d.onChange(g), a.setValue(r.id, g);
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
const
|
|
49
|
-
start:
|
|
50
|
-
end:
|
|
48
|
+
const Y = t.from.start ? `${t.from.start.getFullYear()}-${String(t.from.start.getMonth() + 1).padStart(2, "0")}-${String(t.from.start.getDate()).padStart(2, "0")}` : `${t.from.year}-${String(t.from.month + 1).padStart(2, "0")}-01`, m = t.to.end ? t.to.end.getDate() : new Date(t.to.year, t.to.month + 1, 0).getDate(), T = t.to.end ? `${t.to.end.getFullYear()}-${String(t.to.end.getMonth() + 1).padStart(2, "0")}-${String(m).padStart(2, "0")}` : `${t.to.year}-${String(t.to.month + 1).padStart(2, "0")}-${String(m).padStart(2, "0")}`, f = {
|
|
49
|
+
start: Y,
|
|
50
|
+
end: T
|
|
51
51
|
};
|
|
52
|
-
d.onChange(
|
|
52
|
+
d.onChange(f), a.setValue(r.id, f);
|
|
53
53
|
},
|
|
54
|
-
placeholder:
|
|
55
|
-
minDate:
|
|
56
|
-
maxDate:
|
|
57
|
-
startMonth:
|
|
58
|
-
endMonth:
|
|
59
|
-
required:
|
|
60
|
-
disabled:
|
|
61
|
-
error:
|
|
62
|
-
helperText:
|
|
54
|
+
placeholder: r.placeholder,
|
|
55
|
+
minDate: u,
|
|
56
|
+
maxDate: c,
|
|
57
|
+
startMonth: v ?? u,
|
|
58
|
+
endMonth: $ ?? c,
|
|
59
|
+
required: r.isRequired,
|
|
60
|
+
disabled: s,
|
|
61
|
+
error: M,
|
|
62
|
+
helperText: M ? p.error?.message : r.helpText,
|
|
63
63
|
showFooter: !0,
|
|
64
|
-
calendarKind:
|
|
65
|
-
fiscalMode:
|
|
66
|
-
fiscalYearStartMonth:
|
|
67
|
-
fiscalMonthPattern:
|
|
68
|
-
showPresets:
|
|
69
|
-
autoNavigateToAvailable:
|
|
64
|
+
calendarKind: e.calendarKind,
|
|
65
|
+
fiscalMode: e.fiscalMode,
|
|
66
|
+
fiscalYearStartMonth: e.fiscalYearStartMonth,
|
|
67
|
+
fiscalMonthPattern: e.fiscalMonthPattern,
|
|
68
|
+
showPresets: e.showPresets,
|
|
69
|
+
autoNavigateToAvailable: e.autoNavigateToAvailable
|
|
70
70
|
}
|
|
71
71
|
) });
|
|
72
72
|
}
|
|
@@ -74,5 +74,5 @@ const w = (a) => {
|
|
|
74
74
|
);
|
|
75
75
|
};
|
|
76
76
|
export {
|
|
77
|
-
|
|
77
|
+
K as MonthRangeField
|
|
78
78
|
};
|
|
@@ -1,47 +1,49 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { Controller as
|
|
3
|
-
import { MultiMonthPicker as
|
|
4
|
-
import { getFieldTestId as
|
|
5
|
-
import {
|
|
6
|
-
const
|
|
2
|
+
import { Controller as v } from "react-hook-form";
|
|
3
|
+
import { MultiMonthPicker as g } from "../../components/forms/date-picker/multi-month-picker.js";
|
|
4
|
+
import { getFieldTestId as x } from "../utils/fieldTestIds.js";
|
|
5
|
+
import { resolveMonthRangeMinMax as T } from "../utils/date.utils.js";
|
|
6
|
+
const q = ({
|
|
7
7
|
field: r,
|
|
8
|
-
validationRules:
|
|
8
|
+
validationRules: i,
|
|
9
9
|
isDisabled: u,
|
|
10
|
-
formHelpers:
|
|
10
|
+
formHelpers: m
|
|
11
11
|
}) => {
|
|
12
|
-
const s =
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const s = m.form.control, e = r.fieldType === "multi_month_picker" ? r : null;
|
|
13
|
+
if (!e) return null;
|
|
14
|
+
const { minDate: h, maxDate: c, startMonth: d, endMonth: p } = T(e);
|
|
15
|
+
return /* @__PURE__ */ o(
|
|
16
|
+
v,
|
|
15
17
|
{
|
|
16
18
|
name: r.id,
|
|
17
19
|
control: s,
|
|
18
|
-
rules:
|
|
19
|
-
render: ({ field:
|
|
20
|
-
const
|
|
21
|
-
return /* @__PURE__ */ o("div", { "data-testid":
|
|
22
|
-
|
|
20
|
+
rules: i,
|
|
21
|
+
render: ({ field: t, fieldState: n }) => {
|
|
22
|
+
const a = !!n.error, l = t.value;
|
|
23
|
+
return /* @__PURE__ */ o("div", { "data-testid": x(r.id), children: /* @__PURE__ */ o(
|
|
24
|
+
g,
|
|
23
25
|
{
|
|
24
26
|
label: r.label,
|
|
25
|
-
value: Array.isArray(
|
|
26
|
-
onChange: (
|
|
27
|
-
|
|
27
|
+
value: Array.isArray(l) ? l : void 0,
|
|
28
|
+
onChange: (M) => {
|
|
29
|
+
t.onChange(M ?? []);
|
|
28
30
|
},
|
|
29
31
|
placeholder: r.placeholder,
|
|
30
32
|
required: r.isRequired,
|
|
31
33
|
disabled: u,
|
|
32
|
-
error:
|
|
33
|
-
helperText:
|
|
34
|
-
minDate:
|
|
35
|
-
maxDate:
|
|
36
|
-
startMonth:
|
|
37
|
-
endMonth:
|
|
34
|
+
error: a,
|
|
35
|
+
helperText: a ? n.error?.message : r.helpText,
|
|
36
|
+
minDate: h,
|
|
37
|
+
maxDate: c,
|
|
38
|
+
startMonth: d,
|
|
39
|
+
endMonth: p,
|
|
38
40
|
autoNavigateToAvailable: e.autoNavigateToAvailable
|
|
39
41
|
}
|
|
40
42
|
) });
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
|
-
)
|
|
45
|
+
);
|
|
44
46
|
};
|
|
45
47
|
export {
|
|
46
|
-
|
|
48
|
+
q as MultiMonthPickerField
|
|
47
49
|
};
|