impact-nova 2.5.12 → 2.5.13
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/data-table/build-column-tree-from-grid.d.ts +1 -0
- package/dist/components/data/data-table/build-column-tree-from-grid.js +55 -50
- package/dist/components/data/data-table/column-picker-authority.d.ts +34 -0
- package/dist/components/data/data-table/column-picker-authority.js +116 -0
- package/dist/components/data/data-table/column-picker-drop-validation.d.ts +7 -0
- package/dist/components/data/data-table/column-picker-drop-validation.js +37 -0
- package/dist/components/data/data-table/data-table-column-apply.d.ts +2 -0
- package/dist/components/data/data-table/data-table-column-apply.js +84 -73
- package/dist/components/data/data-table/data-table-column-list-tree-apply.d.ts +10 -0
- package/dist/components/data/data-table/data-table-column-list-tree-apply.js +79 -0
- package/dist/components/data/data-table/data-table-column-list.js +94 -64
- package/dist/components/data/data-table/data-table-column-tree-cache.d.ts +12 -6
- package/dist/components/data/data-table/data-table-column-tree-cache.js +250 -131
- package/dist/components/data/data-table/data-table-flat-column-virtual-rows.d.ts +26 -0
- package/dist/components/data/data-table/data-table-flat-column-virtual-rows.js +195 -0
- package/dist/components/data/data-table/data-table-picker-column-eligibility.d.ts +1 -0
- package/dist/components/data/data-table/data-table-picker-column-eligibility.js +7 -0
- package/dist/components/data/data-table/patch-column-tree-indicators-from-grid.d.ts +5 -0
- package/dist/components/data/data-table/patch-column-tree-indicators-from-grid.js +28 -11
- package/dist/components/data/data-table/reconcile-column-tree-from-grid.d.ts +12 -0
- package/dist/components/data/data-table/reconcile-column-tree-from-grid.js +12 -0
- package/dist/components/data/data-table/use-data-table-column-list-sync.d.ts +10 -0
- package/dist/components/data/data-table/use-data-table-column-list-sync.js +250 -196
- package/dist/components/data/nested-list/components/NestedListContent.d.ts +10 -2
- package/dist/components/data/nested-list/components/NestedListContent.js +253 -138
- package/dist/components/data/nested-list/components/SortableItem.d.ts +2 -1
- package/dist/components/data/nested-list/components/SortableItem.js +62 -60
- package/dist/components/data/nested-list/hooks/useNestedListDragDrop.d.ts +10 -20
- package/dist/components/data/nested-list/hooks/useNestedListDragDrop.js +44 -233
- package/dist/components/data/nested-list/hooks/useVirtualNestedListDrag.d.ts +24 -0
- package/dist/components/data/nested-list/hooks/useVirtualNestedListDrag.js +128 -0
- package/dist/components/data/nested-list/nested-list-constants.d.ts +4 -1
- package/dist/components/data/nested-list/nested-list-constants.js +10 -4
- package/dist/components/data/nested-list/nested-list-display-utils.d.ts +11 -0
- package/dist/components/data/nested-list/nested-list-display-utils.js +74 -0
- package/dist/components/data/nested-list/nested-list-drop-engine.d.ts +31 -0
- package/dist/components/data/nested-list/nested-list-drop-engine.js +209 -0
- package/dist/components/data/nested-list/nested-list-flat-virtual-handlers.d.ts +26 -0
- package/dist/components/data/nested-list/nested-list-flat-virtual-handlers.js +67 -0
- package/dist/components/data/nested-list/nested-list-item-tree-mutations.d.ts +4 -0
- package/dist/components/data/nested-list/nested-list-item-tree-mutations.js +43 -0
- package/dist/components/data/nested-list/nested-list-lazy-flat-rows.d.ts +3 -0
- package/dist/components/data/nested-list/nested-list-lazy-flat-rows.js +34 -0
- package/dist/components/data/nested-list/nested-list-row-estimates.d.ts +9 -0
- package/dist/components/data/nested-list/nested-list-row-estimates.js +14 -0
- package/dist/components/data/nested-list/nested-list-scroll-anchor.d.ts +36 -0
- package/dist/components/data/nested-list/nested-list-scroll-anchor.js +47 -0
- package/dist/components/data/nested-list/nested-list-virtual-drop.d.ts +59 -0
- package/dist/components/data/nested-list/nested-list-virtual-drop.js +341 -0
- package/dist/components/data/nested-list/nested-list.js +322 -336
- package/dist/components/data/nested-list/nested-list.types.d.ts +17 -0
- package/dist/components/data-display/calendar/calendar-apply-validation.d.ts +0 -2
- package/dist/components/data-display/calendar/calendar-apply-validation.js +67 -64
- package/dist/components/data-display/calendar/calendar-config.js +1 -1
- package/dist/components/data-display/calendar/calendar-day-picker-components.d.ts +2 -4
- package/dist/components/data-display/calendar/calendar-day-picker-components.js +164 -234
- package/dist/components/data-display/calendar/calendar-day-picker-view.js +76 -77
- package/dist/components/data-display/calendar/calendar-fiscal-period-nav.d.ts +0 -6
- package/dist/components/data-display/calendar/calendar-fiscal-period-nav.js +18 -34
- package/dist/components/data-display/calendar/calendar-footer.js +21 -21
- package/dist/components/data-display/calendar/calendar-month-picker-panel.js +49 -50
- package/dist/components/data-display/calendar/calendar-month-utils.d.ts +0 -5
- package/dist/components/data-display/calendar/calendar-month-utils.js +64 -85
- package/dist/components/data-display/calendar/calendar-padding-week.utils.d.ts +1 -3
- package/dist/components/data-display/calendar/calendar-padding-week.utils.js +5 -7
- package/dist/components/data-display/calendar/calendar-period-cell.js +46 -45
- package/dist/components/data-display/calendar/calendar-quarter-panes.js +31 -33
- package/dist/components/data-display/calendar/calendar-selection-appearance.d.ts +0 -10
- package/dist/components/data-display/calendar/calendar-selection-appearance.js +39 -53
- package/dist/components/data-display/calendar/calendar-selection.d.ts +0 -25
- package/dist/components/data-display/calendar/calendar-selection.js +23 -52
- package/dist/components/data-display/calendar/calendar-week-number-cell.d.ts +1 -2
- package/dist/components/data-display/calendar/calendar-week-number-cell.js +45 -59
- package/dist/components/data-display/calendar/calendar-week-utils.d.ts +3 -13
- package/dist/components/data-display/calendar/calendar-week-utils.js +50 -59
- package/dist/components/data-display/calendar/calendar-year-panes.d.ts +0 -3
- package/dist/components/data-display/calendar/calendar-year-panes.js +49 -53
- package/dist/components/data-display/calendar/calendar.js +143 -146
- package/dist/components/data-display/calendar/calendar.types.d.ts +0 -5
- package/dist/components/data-display/calendar/use-calendar-day-picker-config.d.ts +1 -2
- package/dist/components/data-display/calendar/use-calendar-day-picker-config.js +74 -79
- package/dist/components/data-display/calendar/use-calendar-state.d.ts +1 -3
- package/dist/components/data-display/calendar/use-calendar-state.js +325 -403
- package/dist/components/forms/date-picker/date-picker.js +58 -60
- package/dist/components/forms/date-picker/date-picker.types.d.ts +0 -5
- package/dist/components/forms/date-picker/date-range-picker.js +64 -66
- package/dist/components/forms/date-picker/fiscal-pass-through.d.ts +0 -1
- package/dist/components/forms/date-picker/fiscal-pass-through.js +2 -3
- package/dist/components/forms/date-picker/month-picker.js +59 -61
- package/dist/components/forms/date-picker/month-range-picker.js +61 -63
- package/dist/components/forms/date-picker/multi-date-picker.js +49 -51
- package/dist/components/forms/date-picker/multi-month-picker.js +47 -49
- package/dist/components/forms/date-picker/multi-quarter-picker.js +47 -51
- package/dist/components/forms/date-picker/multi-week-picker.js +51 -53
- package/dist/components/forms/date-picker/multi-year-picker.js +49 -53
- package/dist/components/forms/date-picker/quarter-picker.js +47 -51
- package/dist/components/forms/date-picker/quarter-range-picker.js +46 -50
- package/dist/components/forms/date-picker/week-picker.js +66 -68
- package/dist/components/forms/date-picker/week-range-picker.js +80 -82
- package/dist/components/forms/date-picker/year-picker.js +48 -52
- package/dist/components/forms/date-picker/year-range-picker.js +48 -52
- package/dist/form-react/Fields/DateInputField.js +50 -51
- package/dist/form-react/Fields/DateRangeField.js +13 -14
- package/dist/form-react/Fields/MonthRangeField.js +28 -29
- package/dist/form-react/Fields/MultiMonthPickerField.js +12 -13
- package/dist/form-react/Fields/MultiWeekPickerField.js +27 -35
- package/dist/form-react/Fields/WeekRangePicker.js +32 -33
- package/dist/form-react/types/fields.types.d.ts +0 -14
- package/dist/impact-nova-components.css +6 -13
- package/dist/impact-nova.css +1 -1
- package/dist/lib/fiscal-calendar/week-selection.js +2 -2
- package/dist/lib/hash/fnv1a128.d.ts +16 -0
- package/dist/lib/hash/fnv1a128.js +21 -0
- package/dist/llms/rules/ag-grid.js +1 -1
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- package/package.json +1 -1
- package/dist/components/data-display/calendar/calendar-available-view.d.ts +0 -27
- package/dist/components/data-display/calendar/calendar-available-view.js +0 -85
- package/dist/components/data-display/calendar/calendar-fiscal-day-cell.d.ts +0 -9
- package/dist/components/data-display/calendar/calendar-fiscal-day-cell.js +0 -45
- package/dist/components/data-display/calendar/calendar-injected-week-row.d.ts +0 -5
- package/dist/components/data-display/calendar/calendar-injected-week-row.js +0 -92
- package/dist/components/data-display/calendar/calendar-leading-week.utils.d.ts +0 -16
- package/dist/components/data-display/calendar/calendar-leading-week.utils.js +0 -51
- package/dist/components/data-display/calendar/calendar-orphan-week.d.ts +0 -23
- package/dist/components/forms/date-picker/fiscal-picker-fixtures.d.ts +0 -17
|
@@ -1,18 +1,18 @@
|
|
|
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
|
|
3
|
+
import { Cross as _, CalendarMonth as ee } from "impact-nova-icons";
|
|
4
|
+
import { cn as re } from "../../../lib/utils.js";
|
|
5
|
+
import { Input as te } from "../input/input.js";
|
|
6
|
+
import { Calendar as ne } from "../../data-display/calendar/calendar.js";
|
|
7
7
|
import { Tooltip as x, TooltipTrigger as D, TooltipContent as Y } from "../../feedback/tooltip/tooltip.js";
|
|
8
|
-
import { useImpactNovaI18n as
|
|
9
|
-
import { buildDateBoundsMatcher as
|
|
10
|
-
import { fiscalCalendarPassThrough as
|
|
11
|
-
import { DatePickerShell as
|
|
12
|
-
import { usePickerDismissActionsRef as
|
|
8
|
+
import { useImpactNovaI18n as oe } from "../../../i18n/use-impact-nova-i18n.js";
|
|
9
|
+
import { buildDateBoundsMatcher as ae } from "../../../lib/date-bounds-matcher.js";
|
|
10
|
+
import { fiscalCalendarPassThrough as ie } from "./fiscal-pass-through.js";
|
|
11
|
+
import { DatePickerShell as ce } from "./date-picker-shell.js";
|
|
12
|
+
import { usePickerDismissActionsRef as se, usePickerFooterDismissNudge as le, handleReadonlyPickerKeyDown as fe, handlePickerSurfacePointerDown as pe } 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 de } from "../../data-display/calendar/calendar-year-utils.js";
|
|
15
|
+
const me = t.forwardRef(
|
|
16
16
|
({
|
|
17
17
|
value: n,
|
|
18
18
|
onChange: d,
|
|
@@ -30,34 +30,30 @@ const he = t.forwardRef(
|
|
|
30
30
|
fiscalMonthPattern: j,
|
|
31
31
|
fiscalYearStartMonth: F,
|
|
32
32
|
fiscalConfig: y,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
t.useImperativeHandle(B, () => m.current);
|
|
42
|
-
const [i, c] = t.useState(!1), u = t.useRef(!1), R = fe(), { footerFlashKey: G, footerFlashTarget: J, popoverHandlers: Q } = pe(l, i, R, P), [C, f] = t.useState(n), [U, W] = t.useState(ue(n?.from));
|
|
33
|
+
showPresets: L,
|
|
34
|
+
showPeriodBoundaries: $,
|
|
35
|
+
showIntervalCaption: z = !1,
|
|
36
|
+
...E
|
|
37
|
+
}, H) => {
|
|
38
|
+
const { t: a } = oe(), V = S ?? a("datePicker.selectYearRange"), k = y?.fyLabel ?? "fy-long", m = t.useRef(null), P = t.useRef(null);
|
|
39
|
+
t.useImperativeHandle(H, () => m.current);
|
|
40
|
+
const [i, c] = t.useState(!1), u = t.useRef(!1), R = se(), { footerFlashKey: B, footerFlashTarget: q, popoverHandlers: G } = le(l, i, R, P), [C, f] = t.useState(n), [J, Q] = t.useState(de(n?.from));
|
|
43
41
|
t.useEffect(() => {
|
|
44
42
|
i || f(n);
|
|
45
43
|
}, [i, n]);
|
|
46
|
-
const p = t.useCallback(() => c(!1), []),
|
|
44
|
+
const p = t.useCallback(() => c(!1), []), U = ie({
|
|
47
45
|
calendarKind: T,
|
|
48
46
|
fiscalMode: w,
|
|
49
47
|
granularity: K,
|
|
50
48
|
fiscalMonthPattern: j,
|
|
51
49
|
fiscalYearStartMonth: F,
|
|
52
50
|
fiscalConfig: y,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
autoNavigateToAvailable: E
|
|
57
|
-
}), Z = (e) => {
|
|
51
|
+
showPresets: L,
|
|
52
|
+
showPeriodBoundaries: $
|
|
53
|
+
}), W = (e) => {
|
|
58
54
|
const s = e && !Array.isArray(e) && ("from" in e || "to" in e) ? e : void 0;
|
|
59
55
|
f(s), l || (d?.(s), s?.to && p());
|
|
60
|
-
},
|
|
56
|
+
}, X = () => {
|
|
61
57
|
d?.(C), p();
|
|
62
58
|
}, h = () => {
|
|
63
59
|
f(n), p();
|
|
@@ -67,9 +63,9 @@ const he = t.forwardRef(
|
|
|
67
63
|
t.useLayoutEffect(() => {
|
|
68
64
|
R.current = { onDismiss: h, resolveFlash: () => "cancel" };
|
|
69
65
|
});
|
|
70
|
-
const
|
|
66
|
+
const Z = n?.from ? `${N(n.from, k)}${n.to ? ` – ${N(n.to, k)}` : ""}` : "";
|
|
71
67
|
return /* @__PURE__ */ r(
|
|
72
|
-
|
|
68
|
+
ce,
|
|
73
69
|
{
|
|
74
70
|
open: i,
|
|
75
71
|
disabled: o,
|
|
@@ -80,26 +76,26 @@ const he = t.forwardRef(
|
|
|
80
76
|
onOpenAutoFocus: (e) => {
|
|
81
77
|
u.current || e.preventDefault(), u.current = !1;
|
|
82
78
|
},
|
|
83
|
-
popoverHandlers:
|
|
79
|
+
popoverHandlers: G,
|
|
84
80
|
trigger: /* @__PURE__ */ r(
|
|
85
81
|
"div",
|
|
86
82
|
{
|
|
87
83
|
ref: P,
|
|
88
84
|
"data-component": "year-range-picker",
|
|
89
85
|
"data-state": i ? "open" : "closed",
|
|
90
|
-
onPointerDown: (e) =>
|
|
86
|
+
onPointerDown: (e) => pe({
|
|
91
87
|
disabled: o,
|
|
92
88
|
event: e,
|
|
93
89
|
onOpen: () => c(!0),
|
|
94
90
|
focusField: () => m.current?.focus()
|
|
95
91
|
}),
|
|
96
92
|
children: /* @__PURE__ */ r(
|
|
97
|
-
|
|
93
|
+
te,
|
|
98
94
|
{
|
|
99
95
|
ref: m,
|
|
100
|
-
value:
|
|
96
|
+
value: Z,
|
|
101
97
|
readOnly: !0,
|
|
102
|
-
onKeyDown: (e) =>
|
|
98
|
+
onKeyDown: (e) => fe(e, {
|
|
103
99
|
disabled: o,
|
|
104
100
|
open: i,
|
|
105
101
|
onOpen: () => c(!0),
|
|
@@ -109,10 +105,10 @@ const he = t.forwardRef(
|
|
|
109
105
|
}
|
|
110
106
|
}),
|
|
111
107
|
onClick: () => !o && c(!0),
|
|
112
|
-
placeholder:
|
|
108
|
+
placeholder: V,
|
|
113
109
|
disabled: o,
|
|
114
110
|
"data-form-control": "input",
|
|
115
|
-
className:
|
|
111
|
+
className: re("cursor-pointer", O),
|
|
116
112
|
suffix: /* @__PURE__ */ g("div", { className: "flex items-center gap-1", children: [
|
|
117
113
|
n?.from && !o ? /* @__PURE__ */ g(x, { children: [
|
|
118
114
|
/* @__PURE__ */ r(D, { asChild: !0, children: /* @__PURE__ */ r(
|
|
@@ -125,7 +121,7 @@ const he = t.forwardRef(
|
|
|
125
121
|
e.stopPropagation(), b();
|
|
126
122
|
},
|
|
127
123
|
className: "inline-flex size-4 items-center justify-center border-none bg-transparent p-0",
|
|
128
|
-
children: /* @__PURE__ */ r(
|
|
124
|
+
children: /* @__PURE__ */ r(_, { className: "size-3 hover:text-content" })
|
|
129
125
|
}
|
|
130
126
|
) }),
|
|
131
127
|
/* @__PURE__ */ r(Y, { variant: "tertiary", side: "top", children: a("calendar.clear") })
|
|
@@ -142,44 +138,44 @@ const he = t.forwardRef(
|
|
|
142
138
|
e.stopPropagation(), o || c((s) => !s);
|
|
143
139
|
},
|
|
144
140
|
className: "inline-flex items-center justify-center border-none bg-transparent p-0",
|
|
145
|
-
children: /* @__PURE__ */ r(
|
|
141
|
+
children: /* @__PURE__ */ r(ee, { className: "h-4 w-4 text-secondary-foreground" })
|
|
146
142
|
}
|
|
147
143
|
) }),
|
|
148
144
|
/* @__PURE__ */ r(Y, { variant: "tertiary", side: "top", children: a("datePicker.selectYearRange") })
|
|
149
145
|
] })
|
|
150
146
|
] }),
|
|
151
|
-
...
|
|
147
|
+
...E
|
|
152
148
|
}
|
|
153
149
|
)
|
|
154
150
|
}
|
|
155
151
|
),
|
|
156
152
|
children: /* @__PURE__ */ r(
|
|
157
|
-
|
|
153
|
+
ne,
|
|
158
154
|
{
|
|
159
155
|
pickerType: "year",
|
|
160
156
|
yearMode: "range",
|
|
161
157
|
selectedYear: C,
|
|
162
|
-
footerFlashKey:
|
|
163
|
-
footerFlashTarget:
|
|
164
|
-
onYearSelect:
|
|
165
|
-
month:
|
|
166
|
-
onMonthChange:
|
|
167
|
-
disabled:
|
|
158
|
+
footerFlashKey: B,
|
|
159
|
+
footerFlashTarget: q,
|
|
160
|
+
onYearSelect: W,
|
|
161
|
+
month: J,
|
|
162
|
+
onMonthChange: Q,
|
|
163
|
+
disabled: ae(v, A),
|
|
168
164
|
startMonth: I,
|
|
169
165
|
endMonth: M,
|
|
170
166
|
showFooter: l,
|
|
171
|
-
onApply:
|
|
167
|
+
onApply: X,
|
|
172
168
|
onCancel: h,
|
|
173
169
|
onClear: b,
|
|
174
|
-
showIntervalCaption:
|
|
175
|
-
...
|
|
170
|
+
showIntervalCaption: z,
|
|
171
|
+
...U
|
|
176
172
|
}
|
|
177
173
|
)
|
|
178
174
|
}
|
|
179
175
|
);
|
|
180
176
|
}
|
|
181
177
|
);
|
|
182
|
-
|
|
178
|
+
me.displayName = "YearRangePicker";
|
|
183
179
|
export {
|
|
184
|
-
|
|
180
|
+
me as YearRangePicker
|
|
185
181
|
};
|
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { useWatch as
|
|
1
|
+
import { jsx as F, jsxs as M } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as I, useRef as K, useEffect as Y } from "react";
|
|
3
|
+
import { useWatch as W, Controller as k } from "react-hook-form";
|
|
4
4
|
import { DatePicker as q } from "../../components/forms/date-picker/date-picker.js";
|
|
5
5
|
import { getEffectiveMinOffsetDaysFromToday as O } from "../utils/formDate.utils.js";
|
|
6
|
-
import { startOfDayDate as
|
|
6
|
+
import { startOfDayDate as v, addDaysDate as y, handleDateFnsFormat as L } from "../utils/date.utils.js";
|
|
7
7
|
import { parseYmdString as f, formatYmd as $ } from "../utils/calendar-boundary.js";
|
|
8
|
-
const
|
|
8
|
+
const b = "__dateInputPairedSentinel__", H = ({
|
|
9
9
|
field: n,
|
|
10
|
-
validationRules:
|
|
10
|
+
validationRules: N,
|
|
11
11
|
isDisabled: u,
|
|
12
12
|
formHelpers: h
|
|
13
13
|
}) => {
|
|
14
|
-
const m = n.fieldType === "date", e = m ? n : null, g = h.form.control,
|
|
14
|
+
const m = n.fieldType === "date", e = m ? n : null, g = h.form.control, A = h.form.trigger, P = h.getValues, s = I(() => e?.dateAfterFieldId ? Array.isArray(e.dateAfterFieldId) ? e.dateAfterFieldId : [e.dateAfterFieldId] : [], [e]), i = I(() => e?.dateBeforeFieldId ? Array.isArray(e.dateBeforeFieldId) ? e.dateBeforeFieldId : [e.dateBeforeFieldId] : [], [e]), B = s.length > 0 ? s : [b], p = W({
|
|
15
15
|
control: g,
|
|
16
16
|
name: B,
|
|
17
|
-
disabled: !m ||
|
|
18
|
-
}), E =
|
|
17
|
+
disabled: !m || s.length === 0
|
|
18
|
+
}), E = i.length > 0 ? i : [b], D = W({
|
|
19
19
|
control: g,
|
|
20
20
|
name: E,
|
|
21
|
-
disabled: !m ||
|
|
22
|
-
}),
|
|
21
|
+
disabled: !m || i.length === 0
|
|
22
|
+
}), T = s.length > 0 || i.length > 0, w = K(!0), _ = s.length > 0 ? p.join("|") : "", C = i.length > 0 ? D.join("|") : "";
|
|
23
23
|
Y(() => {
|
|
24
|
-
if (!e || !
|
|
25
|
-
if (
|
|
26
|
-
|
|
24
|
+
if (!e || !T) return;
|
|
25
|
+
if (w.current) {
|
|
26
|
+
w.current = !1;
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
const
|
|
30
|
-
|
|
29
|
+
const r = P()[e.id];
|
|
30
|
+
r != null && String(r).trim() !== "" && A(e.id);
|
|
31
31
|
}, [
|
|
32
32
|
_,
|
|
33
33
|
C,
|
|
34
34
|
e,
|
|
35
|
-
T,
|
|
36
35
|
P,
|
|
37
|
-
|
|
36
|
+
T,
|
|
37
|
+
A
|
|
38
38
|
]);
|
|
39
|
-
const { minDate: R, maxDate: V } =
|
|
39
|
+
const { minDate: R, maxDate: V } = I(() => {
|
|
40
40
|
if (!e)
|
|
41
41
|
return {
|
|
42
42
|
minDate: void 0,
|
|
43
43
|
maxDate: void 0
|
|
44
44
|
};
|
|
45
|
-
const
|
|
46
|
-
if (l != null && l >= 0 &&
|
|
45
|
+
const r = [], l = O(e);
|
|
46
|
+
if (l != null && l >= 0 && r.push(v(y(/* @__PURE__ */ new Date(), l))), e.minDate) {
|
|
47
47
|
const t = f(e.minDate);
|
|
48
|
-
t &&
|
|
48
|
+
t && r.push(t);
|
|
49
49
|
}
|
|
50
|
-
if (
|
|
51
|
-
const t =
|
|
52
|
-
for (const
|
|
53
|
-
if (!
|
|
54
|
-
const c = f(String(
|
|
50
|
+
if (s.length > 0) {
|
|
51
|
+
const t = s.length > 0 ? p : [];
|
|
52
|
+
for (const a of t) {
|
|
53
|
+
if (!a) continue;
|
|
54
|
+
const c = f(String(a));
|
|
55
55
|
if (c) {
|
|
56
|
-
const
|
|
57
|
-
|
|
56
|
+
const x = e.dateAfterFieldIdInclusive ? 0 : 1;
|
|
57
|
+
r.push(v(y(c, x)));
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
let d;
|
|
62
|
-
|
|
63
|
-
(t,
|
|
62
|
+
r.length > 0 && (d = r.reduce(
|
|
63
|
+
(t, a) => t.getTime() >= a.getTime() ? t : a
|
|
64
64
|
));
|
|
65
65
|
let o;
|
|
66
66
|
if (e.maxDate) {
|
|
67
67
|
const t = f(e.maxDate);
|
|
68
68
|
t && (o = t);
|
|
69
69
|
}
|
|
70
|
-
if (
|
|
71
|
-
const t =
|
|
72
|
-
for (const
|
|
73
|
-
if (!
|
|
74
|
-
const c = f(String(
|
|
70
|
+
if (i.length > 0) {
|
|
71
|
+
const t = i.length > 0 ? D : [];
|
|
72
|
+
for (const a of t) {
|
|
73
|
+
if (!a) continue;
|
|
74
|
+
const c = f(String(a));
|
|
75
75
|
if (c) {
|
|
76
|
-
const
|
|
77
|
-
o = o == null ||
|
|
76
|
+
const x = e.dateBeforeFieldIdInclusive ? 0 : -1, S = v(y(c, x));
|
|
77
|
+
o = o == null || S.getTime() < o.getTime() ? S : o;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
return { minDate: d, maxDate: o };
|
|
82
|
-
}, [e,
|
|
82
|
+
}, [e, s, i, p, D]);
|
|
83
83
|
if (!m || !e) return null;
|
|
84
84
|
const j = L(e.dateFormat);
|
|
85
|
-
return /* @__PURE__ */
|
|
85
|
+
return /* @__PURE__ */ F(
|
|
86
86
|
k,
|
|
87
87
|
{
|
|
88
88
|
name: n.id,
|
|
89
89
|
control: g,
|
|
90
90
|
disabled: u,
|
|
91
|
-
rules:
|
|
92
|
-
render: ({ field:
|
|
93
|
-
const d = !!l.error, o =
|
|
94
|
-
return /* @__PURE__ */
|
|
95
|
-
/* @__PURE__ */
|
|
91
|
+
rules: N,
|
|
92
|
+
render: ({ field: r, fieldState: l }) => {
|
|
93
|
+
const d = !!l.error, o = r.value, t = o ? f(String(o)) : void 0;
|
|
94
|
+
return /* @__PURE__ */ M("div", { className: "flex w-full min-w-0 flex-col gap-[6px]", children: [
|
|
95
|
+
/* @__PURE__ */ M(
|
|
96
96
|
"label",
|
|
97
97
|
{
|
|
98
98
|
htmlFor: n.id,
|
|
@@ -100,11 +100,11 @@ const M = "__dateInputPairedSentinel__", H = ({
|
|
|
100
100
|
children: [
|
|
101
101
|
n.label,
|
|
102
102
|
" ",
|
|
103
|
-
n.isRequired ? /* @__PURE__ */
|
|
103
|
+
n.isRequired ? /* @__PURE__ */ F("span", { className: "text-[red]", children: "*" }) : null
|
|
104
104
|
]
|
|
105
105
|
}
|
|
106
106
|
),
|
|
107
|
-
/* @__PURE__ */
|
|
107
|
+
/* @__PURE__ */ F(
|
|
108
108
|
q,
|
|
109
109
|
{
|
|
110
110
|
id: n.id,
|
|
@@ -113,8 +113,8 @@ const M = "__dateInputPairedSentinel__", H = ({
|
|
|
113
113
|
minDate: R,
|
|
114
114
|
maxDate: V,
|
|
115
115
|
value: t,
|
|
116
|
-
onChange: (
|
|
117
|
-
|
|
116
|
+
onChange: (a) => {
|
|
117
|
+
r.onChange(a ? $(a) : "");
|
|
118
118
|
},
|
|
119
119
|
placeholder: n.placeholder,
|
|
120
120
|
required: n.isRequired,
|
|
@@ -126,8 +126,7 @@ const M = "__dateInputPairedSentinel__", H = ({
|
|
|
126
126
|
fiscalMode: e.fiscalMode,
|
|
127
127
|
fiscalYearStartMonth: e.fiscalYearStartMonth,
|
|
128
128
|
fiscalMonthPattern: e.fiscalMonthPattern,
|
|
129
|
-
showPresets: e.showPresets
|
|
130
|
-
autoNavigateToAvailable: e.autoNavigateToAvailable
|
|
129
|
+
showPresets: e.showPresets
|
|
131
130
|
}
|
|
132
131
|
)
|
|
133
132
|
] });
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { Controller as
|
|
4
|
-
import { DateRangePicker as
|
|
3
|
+
import { Controller as S } from "react-hook-form";
|
|
4
|
+
import { DateRangePicker as g } from "../../components/forms/date-picker/date-range-picker.js";
|
|
5
5
|
import { toLocalDate as a } from "../utils/calendar-boundary.js";
|
|
6
|
-
import { handleMinMaxProp as
|
|
7
|
-
const
|
|
6
|
+
import { handleMinMaxProp as D } from "../utils/date.utils.js";
|
|
7
|
+
const Y = ({
|
|
8
8
|
field: r,
|
|
9
9
|
validationRules: h,
|
|
10
10
|
isDisabled: l,
|
|
@@ -12,18 +12,18 @@ const T = ({
|
|
|
12
12
|
}) => {
|
|
13
13
|
const t = r.fieldType === "date_range" ? r : null;
|
|
14
14
|
if (!t) return null;
|
|
15
|
-
const c = s.form.control, { minDate: m, maxDate: u } =
|
|
15
|
+
const c = s.form.control, { minDate: m, maxDate: u } = D(t);
|
|
16
16
|
return /* @__PURE__ */ n(
|
|
17
|
-
|
|
17
|
+
S,
|
|
18
18
|
{
|
|
19
19
|
name: r.id,
|
|
20
20
|
control: c,
|
|
21
21
|
disabled: l,
|
|
22
22
|
rules: h,
|
|
23
|
-
render: ({ field: p, fieldState:
|
|
24
|
-
const
|
|
23
|
+
render: ({ field: p, fieldState: d }) => {
|
|
24
|
+
const i = !!d.error, e = p.value;
|
|
25
25
|
return /* @__PURE__ */ n("div", { children: /* @__PURE__ */ n(
|
|
26
|
-
|
|
26
|
+
g,
|
|
27
27
|
{
|
|
28
28
|
label: r.label,
|
|
29
29
|
minDate: m,
|
|
@@ -43,15 +43,14 @@ const T = ({
|
|
|
43
43
|
placeholder: r.placeholder,
|
|
44
44
|
required: r.isRequired,
|
|
45
45
|
disabled: l,
|
|
46
|
-
error:
|
|
47
|
-
helperText:
|
|
46
|
+
error: i,
|
|
47
|
+
helperText: i ? d.error?.message : r.helpText,
|
|
48
48
|
showFooter: !0,
|
|
49
49
|
calendarKind: t.calendarKind,
|
|
50
50
|
fiscalMode: t.fiscalMode,
|
|
51
51
|
fiscalYearStartMonth: t.fiscalYearStartMonth,
|
|
52
52
|
fiscalMonthPattern: t.fiscalMonthPattern,
|
|
53
|
-
showPresets: t.showPresets
|
|
54
|
-
autoNavigateToAvailable: t.autoNavigateToAvailable
|
|
53
|
+
showPresets: t.showPresets
|
|
55
54
|
}
|
|
56
55
|
) });
|
|
57
56
|
}
|
|
@@ -59,5 +58,5 @@ const T = ({
|
|
|
59
58
|
);
|
|
60
59
|
};
|
|
61
60
|
export {
|
|
62
|
-
|
|
61
|
+
Y as DateRangeField
|
|
63
62
|
};
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
-
import { Controller as
|
|
3
|
-
import { MonthRangePicker as
|
|
4
|
-
import { getFieldTestId as
|
|
2
|
+
import { Controller as F } from "react-hook-form";
|
|
3
|
+
import { MonthRangePicker as v } from "../../components/forms/date-picker/month-range-picker.js";
|
|
4
|
+
import { getFieldTestId as P } from "../utils/fieldTestIds.js";
|
|
5
5
|
import { toLocalDate as o } from "../utils/calendar-boundary.js";
|
|
6
|
-
const w = (
|
|
7
|
-
if (
|
|
8
|
-
const [
|
|
9
|
-
return { year: parseInt(
|
|
6
|
+
const w = (r) => {
|
|
7
|
+
if (r.includes("/")) {
|
|
8
|
+
const [a, d] = r.split("/");
|
|
9
|
+
return { year: parseInt(d, 10), month: parseInt(a, 10) - 1 };
|
|
10
10
|
}
|
|
11
|
-
const [s, l] =
|
|
11
|
+
const [s, l] = r.split("-");
|
|
12
12
|
return { year: parseInt(s, 10), month: parseInt(l, 10) - 1 };
|
|
13
13
|
}, O = ({
|
|
14
|
-
field:
|
|
14
|
+
field: r,
|
|
15
15
|
validationRules: s,
|
|
16
16
|
isDisabled: l,
|
|
17
|
-
formHelpers:
|
|
17
|
+
formHelpers: a
|
|
18
18
|
}) => {
|
|
19
|
-
const
|
|
19
|
+
const d = a.form.control, t = r.fieldType === "month_range" ? r : null;
|
|
20
20
|
if (!t) return null;
|
|
21
21
|
const y = t.displayFormat || "MM/YYYY", c = t.minMonthsOffset != null ? new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() - t.minMonthsOffset, 1) : t.disablePastMonths ? new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1) : o(t.minDate), h = t.maxMonthsOffset != null ? new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() + t.maxMonthsOffset, 1) : o(t.maxDate);
|
|
22
22
|
return /* @__PURE__ */ u(
|
|
23
|
-
|
|
23
|
+
F,
|
|
24
24
|
{
|
|
25
|
-
name:
|
|
26
|
-
control:
|
|
25
|
+
name: r.id,
|
|
26
|
+
control: d,
|
|
27
27
|
defaultValue: t.defaultRange ? { start: t.defaultRange.start || null, end: t.defaultRange.end || null } : void 0,
|
|
28
28
|
rules: s,
|
|
29
|
-
render: ({ field:
|
|
30
|
-
const f = !!M.error, n =
|
|
31
|
-
return /* @__PURE__ */ u("div", { "data-testid":
|
|
32
|
-
|
|
29
|
+
render: ({ field: i, fieldState: M }) => {
|
|
30
|
+
const f = !!M.error, n = i.value, p = n?.start ? w(n.start) : null, m = n?.end ? w(n.end) : null, Y = p && m;
|
|
31
|
+
return /* @__PURE__ */ u("div", { "data-testid": P(r.id), children: /* @__PURE__ */ u(
|
|
32
|
+
v,
|
|
33
33
|
{
|
|
34
|
-
label:
|
|
34
|
+
label: r.label,
|
|
35
35
|
displayFormat: y,
|
|
36
36
|
...Y && {
|
|
37
37
|
value: {
|
|
@@ -41,32 +41,31 @@ const w = (a) => {
|
|
|
41
41
|
},
|
|
42
42
|
onChange: (e) => {
|
|
43
43
|
if (!e?.from || !e?.to) {
|
|
44
|
-
const
|
|
45
|
-
|
|
44
|
+
const g = { start: null, end: null };
|
|
45
|
+
i.onChange(g), a.setValue(r.id, g);
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
const $ = e.from.start ? `${e.from.start.getFullYear()}-${String(e.from.start.getMonth() + 1).padStart(2, "0")}-${String(e.from.start.getDate()).padStart(2, "0")}` : `${e.from.year}-${String(e.from.month + 1).padStart(2, "0")}-01`, D = e.to.end ? e.to.end.getDate() : new Date(e.to.year, e.to.month + 1, 0).getDate(),
|
|
48
|
+
const $ = e.from.start ? `${e.from.start.getFullYear()}-${String(e.from.start.getMonth() + 1).padStart(2, "0")}-${String(e.from.start.getDate()).padStart(2, "0")}` : `${e.from.year}-${String(e.from.month + 1).padStart(2, "0")}-01`, D = e.to.end ? e.to.end.getDate() : new Date(e.to.year, e.to.month + 1, 0).getDate(), x = e.to.end ? `${e.to.end.getFullYear()}-${String(e.to.end.getMonth() + 1).padStart(2, "0")}-${String(D).padStart(2, "0")}` : `${e.to.year}-${String(e.to.month + 1).padStart(2, "0")}-${String(D).padStart(2, "0")}`, S = {
|
|
49
49
|
start: $,
|
|
50
|
-
end:
|
|
50
|
+
end: x
|
|
51
51
|
};
|
|
52
|
-
|
|
52
|
+
i.onChange(S), a.setValue(r.id, S);
|
|
53
53
|
},
|
|
54
|
-
placeholder:
|
|
54
|
+
placeholder: r.placeholder,
|
|
55
55
|
minDate: c,
|
|
56
56
|
maxDate: h,
|
|
57
57
|
startMonth: c || o(t.startMonth),
|
|
58
58
|
endMonth: h || o(t.endMonth),
|
|
59
|
-
required:
|
|
59
|
+
required: r.isRequired,
|
|
60
60
|
disabled: l,
|
|
61
61
|
error: f,
|
|
62
|
-
helperText: f ? M.error?.message :
|
|
62
|
+
helperText: f ? M.error?.message : r.helpText,
|
|
63
63
|
showFooter: !0,
|
|
64
64
|
calendarKind: t.calendarKind,
|
|
65
65
|
fiscalMode: t.fiscalMode,
|
|
66
66
|
fiscalYearStartMonth: t.fiscalYearStartMonth,
|
|
67
67
|
fiscalMonthPattern: t.fiscalMonthPattern,
|
|
68
|
-
showPresets: t.showPresets
|
|
69
|
-
autoNavigateToAvailable: t.autoNavigateToAvailable
|
|
68
|
+
showPresets: t.showPresets
|
|
70
69
|
}
|
|
71
70
|
) });
|
|
72
71
|
}
|
|
@@ -3,39 +3,38 @@ import { Controller as d } from "react-hook-form";
|
|
|
3
3
|
import { MultiMonthPicker as p } from "../../components/forms/date-picker/multi-month-picker.js";
|
|
4
4
|
import { getFieldTestId as M } from "../utils/fieldTestIds.js";
|
|
5
5
|
import { toLocalDate as t } from "../utils/calendar-boundary.js";
|
|
6
|
-
const
|
|
6
|
+
const b = ({
|
|
7
7
|
field: r,
|
|
8
8
|
validationRules: m,
|
|
9
|
-
isDisabled:
|
|
10
|
-
formHelpers:
|
|
9
|
+
isDisabled: h,
|
|
10
|
+
formHelpers: s
|
|
11
11
|
}) => {
|
|
12
|
-
const
|
|
12
|
+
const u = s.form.control, e = r.fieldType === "multi_month_picker" ? r : null;
|
|
13
13
|
return e ? /* @__PURE__ */ o(
|
|
14
14
|
d,
|
|
15
15
|
{
|
|
16
16
|
name: r.id,
|
|
17
|
-
control:
|
|
17
|
+
control: u,
|
|
18
18
|
rules: m,
|
|
19
|
-
render: ({ field:
|
|
20
|
-
const l = !!
|
|
19
|
+
render: ({ field: n, fieldState: a }) => {
|
|
20
|
+
const l = !!a.error, i = n.value;
|
|
21
21
|
return /* @__PURE__ */ o("div", { "data-testid": M(r.id), children: /* @__PURE__ */ o(
|
|
22
22
|
p,
|
|
23
23
|
{
|
|
24
24
|
label: r.label,
|
|
25
25
|
value: Array.isArray(i) ? i : void 0,
|
|
26
26
|
onChange: (c) => {
|
|
27
|
-
|
|
27
|
+
n.onChange(c ?? []);
|
|
28
28
|
},
|
|
29
29
|
placeholder: r.placeholder,
|
|
30
30
|
required: r.isRequired,
|
|
31
|
-
disabled:
|
|
31
|
+
disabled: h,
|
|
32
32
|
error: l,
|
|
33
|
-
helperText: l ?
|
|
33
|
+
helperText: l ? a.error?.message : r.helpText,
|
|
34
34
|
minDate: t(e.minDate),
|
|
35
35
|
maxDate: t(e.maxDate),
|
|
36
36
|
startMonth: t(e.startMonth),
|
|
37
|
-
endMonth: t(e.endMonth)
|
|
38
|
-
autoNavigateToAvailable: e.autoNavigateToAvailable
|
|
37
|
+
endMonth: t(e.endMonth)
|
|
39
38
|
}
|
|
40
39
|
) });
|
|
41
40
|
}
|
|
@@ -43,5 +42,5 @@ const D = ({
|
|
|
43
42
|
) : null;
|
|
44
43
|
};
|
|
45
44
|
export {
|
|
46
|
-
|
|
45
|
+
b as MultiMonthPickerField
|
|
47
46
|
};
|