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,55 +1,58 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { Controller as
|
|
2
|
+
import { Controller as f } from "react-hook-form";
|
|
3
3
|
import { MultiWeekPicker as p } from "../../components/forms/date-picker/multi-week-picker.js";
|
|
4
|
-
import { fiscalCalendarPassThrough as
|
|
5
|
-
import { getFieldTestId as
|
|
6
|
-
import {
|
|
7
|
-
const
|
|
8
|
-
field:
|
|
9
|
-
validationRules:
|
|
10
|
-
isDisabled:
|
|
4
|
+
import { fiscalCalendarPassThrough as g } from "../../components/forms/date-picker/fiscal-pass-through.js";
|
|
5
|
+
import { getFieldTestId as k } from "../utils/fieldTestIds.js";
|
|
6
|
+
import { resolveWeekRangeMinMax as M } from "../utils/date.utils.js";
|
|
7
|
+
const b = ({
|
|
8
|
+
field: r,
|
|
9
|
+
validationRules: l,
|
|
10
|
+
isDisabled: s,
|
|
11
11
|
formHelpers: c
|
|
12
12
|
}) => {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const u = c.form.control, e = r.fieldType === "multi_week_picker" ? r : null;
|
|
14
|
+
if (!e) return null;
|
|
15
|
+
const { minDate: d, maxDate: m } = M(e);
|
|
16
|
+
return /* @__PURE__ */ a(
|
|
17
|
+
f,
|
|
16
18
|
{
|
|
17
|
-
name:
|
|
18
|
-
control:
|
|
19
|
-
rules:
|
|
20
|
-
render: ({ field:
|
|
21
|
-
const i = !!
|
|
22
|
-
return /* @__PURE__ */ a("div", { "data-testid":
|
|
19
|
+
name: r.id,
|
|
20
|
+
control: u,
|
|
21
|
+
rules: l,
|
|
22
|
+
render: ({ field: o, fieldState: t }) => {
|
|
23
|
+
const i = !!t.error, n = o.value;
|
|
24
|
+
return /* @__PURE__ */ a("div", { "data-testid": k(r.id), children: /* @__PURE__ */ a(
|
|
23
25
|
p,
|
|
24
26
|
{
|
|
25
|
-
label:
|
|
26
|
-
value: Array.isArray(
|
|
27
|
-
onChange: (
|
|
28
|
-
|
|
27
|
+
label: r.label,
|
|
28
|
+
value: Array.isArray(n) ? n : void 0,
|
|
29
|
+
onChange: (h) => {
|
|
30
|
+
o.onChange(h ?? []);
|
|
29
31
|
},
|
|
30
|
-
placeholder:
|
|
31
|
-
required:
|
|
32
|
-
disabled:
|
|
32
|
+
placeholder: r.placeholder,
|
|
33
|
+
required: r.isRequired,
|
|
34
|
+
disabled: s,
|
|
33
35
|
error: i,
|
|
34
|
-
helperText: i ?
|
|
35
|
-
minDate:
|
|
36
|
-
maxDate:
|
|
37
|
-
...
|
|
38
|
-
calendarKind:
|
|
39
|
-
fiscalMode:
|
|
40
|
-
granularity:
|
|
41
|
-
fiscalMonthPattern:
|
|
42
|
-
fiscalYearStartMonth:
|
|
43
|
-
weekStartsOn:
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
helperText: i ? t.error?.message : r.helpText,
|
|
37
|
+
minDate: d,
|
|
38
|
+
maxDate: m,
|
|
39
|
+
...g({
|
|
40
|
+
calendarKind: e.calendarKind,
|
|
41
|
+
fiscalMode: e.fiscalMode,
|
|
42
|
+
granularity: e.granularity,
|
|
43
|
+
fiscalMonthPattern: e.fiscalMonthPattern,
|
|
44
|
+
fiscalYearStartMonth: e.fiscalYearStartMonth,
|
|
45
|
+
weekStartsOn: e.weekStartsOn,
|
|
46
|
+
fiscalConfig: e.fiscalConfig,
|
|
47
|
+
showPeriodBoundaries: e.showPeriodBoundaries,
|
|
48
|
+
autoNavigateToAvailable: e.autoNavigateToAvailable
|
|
46
49
|
})
|
|
47
50
|
}
|
|
48
51
|
) });
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
|
-
)
|
|
54
|
+
);
|
|
52
55
|
};
|
|
53
56
|
export {
|
|
54
|
-
|
|
57
|
+
b as MultiWeekPickerField
|
|
55
58
|
};
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Controller as
|
|
3
|
-
import { MultiYearPicker as
|
|
4
|
-
import { getFieldTestId as
|
|
5
|
-
import {
|
|
6
|
-
const
|
|
7
|
-
field:
|
|
8
|
-
validationRules:
|
|
9
|
-
isDisabled:
|
|
10
|
-
formHelpers:
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { Controller as v } from "react-hook-form";
|
|
3
|
+
import { MultiYearPicker as P } from "../../components/forms/date-picker/multi-year-picker.js";
|
|
4
|
+
import { getFieldTestId as Y } from "../utils/fieldTestIds.js";
|
|
5
|
+
import { resolveYearRangeMinMax as g } from "../utils/date.utils.js";
|
|
6
|
+
const T = ({
|
|
7
|
+
field: e,
|
|
8
|
+
validationRules: u,
|
|
9
|
+
isDisabled: c,
|
|
10
|
+
formHelpers: a
|
|
11
11
|
}) => {
|
|
12
|
-
const
|
|
13
|
-
if (!
|
|
14
|
-
const
|
|
15
|
-
return /* @__PURE__ */
|
|
16
|
-
|
|
12
|
+
const r = e.fieldType === "multi_year_picker" ? e : null;
|
|
13
|
+
if (!r) return null;
|
|
14
|
+
const { minDate: h, maxDate: d, startMonth: m, endMonth: p } = g(r), M = a.form.control, w = r.defaultValue?.map((t) => ({ year: t }));
|
|
15
|
+
return /* @__PURE__ */ o(
|
|
16
|
+
v,
|
|
17
17
|
{
|
|
18
|
-
name:
|
|
19
|
-
control:
|
|
20
|
-
defaultValue:
|
|
21
|
-
rules:
|
|
22
|
-
render: ({ field:
|
|
23
|
-
const
|
|
24
|
-
return /* @__PURE__ */
|
|
25
|
-
|
|
18
|
+
name: e.id,
|
|
19
|
+
control: M,
|
|
20
|
+
defaultValue: w,
|
|
21
|
+
rules: u,
|
|
22
|
+
render: ({ field: t, fieldState: n }) => {
|
|
23
|
+
const l = !!n.error, s = t.value, f = Array.isArray(s) ? s : void 0;
|
|
24
|
+
return /* @__PURE__ */ o("div", { "data-testid": Y(e.id), children: /* @__PURE__ */ o(
|
|
25
|
+
P,
|
|
26
26
|
{
|
|
27
|
-
label:
|
|
28
|
-
value:
|
|
27
|
+
label: e.label,
|
|
28
|
+
value: f,
|
|
29
29
|
onChange: (i) => {
|
|
30
|
-
|
|
30
|
+
t.onChange(i ?? null), a.setValue(e.id, i ?? null);
|
|
31
31
|
},
|
|
32
|
-
placeholder:
|
|
33
|
-
minDate:
|
|
34
|
-
maxDate:
|
|
35
|
-
startMonth:
|
|
36
|
-
endMonth:
|
|
37
|
-
required:
|
|
38
|
-
disabled:
|
|
39
|
-
error:
|
|
40
|
-
helperText:
|
|
41
|
-
showFooter:
|
|
42
|
-
showIntervalCaption:
|
|
43
|
-
calendarKind:
|
|
44
|
-
fiscalMode:
|
|
45
|
-
fiscalYearStartMonth:
|
|
46
|
-
fiscalMonthPattern:
|
|
47
|
-
weekStartsOn:
|
|
48
|
-
showPresets:
|
|
49
|
-
...
|
|
32
|
+
placeholder: e.placeholder,
|
|
33
|
+
minDate: h,
|
|
34
|
+
maxDate: d,
|
|
35
|
+
startMonth: m,
|
|
36
|
+
endMonth: p,
|
|
37
|
+
required: e.isRequired,
|
|
38
|
+
disabled: c,
|
|
39
|
+
error: l,
|
|
40
|
+
helperText: l ? n.error?.message : e.helpText,
|
|
41
|
+
showFooter: r.showFooter,
|
|
42
|
+
showIntervalCaption: r.showIntervalCaption,
|
|
43
|
+
calendarKind: r.calendarKind,
|
|
44
|
+
fiscalMode: r.fiscalMode,
|
|
45
|
+
fiscalYearStartMonth: r.fiscalYearStartMonth,
|
|
46
|
+
fiscalMonthPattern: r.fiscalMonthPattern,
|
|
47
|
+
weekStartsOn: r.weekStartsOn,
|
|
48
|
+
showPresets: r.showPresets,
|
|
49
|
+
...r.componentProps
|
|
50
50
|
}
|
|
51
51
|
) });
|
|
52
52
|
}
|
|
@@ -54,5 +54,5 @@ const g = ({
|
|
|
54
54
|
);
|
|
55
55
|
};
|
|
56
56
|
export {
|
|
57
|
-
|
|
57
|
+
T as MultiYearPickerField
|
|
58
58
|
};
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
-
import { Controller as
|
|
3
|
-
import { WeekRangePicker as
|
|
4
|
-
import { toLocalDate as
|
|
5
|
-
import { resolveWeekSelection as
|
|
6
|
-
import { resolveWeekRangeMinMax as
|
|
7
|
-
const S = (e, a) =>
|
|
2
|
+
import { Controller as T } from "react-hook-form";
|
|
3
|
+
import { WeekRangePicker as b } from "../../components/forms/date-picker/week-range-picker.js";
|
|
4
|
+
import { toLocalDate as M } from "../utils/calendar-boundary.js";
|
|
5
|
+
import { resolveWeekSelection as x } from "../../lib/fiscal-calendar/week-selection.js";
|
|
6
|
+
import { resolveWeekRangeMinMax as Y } from "../utils/date.utils.js";
|
|
7
|
+
const S = (e, a) => x(e, {
|
|
8
8
|
calendarKind: a.calendarKind,
|
|
9
9
|
fiscalMode: a.fiscalMode ?? "basic",
|
|
10
10
|
granularity: a.granularity,
|
|
11
11
|
fiscalMonthPattern: a.fiscalMonthPattern,
|
|
12
12
|
fiscalYearStartMonth: a.fiscalYearStartMonth ?? 1,
|
|
13
|
-
weekStartsOn: a.weekStartsOn
|
|
14
|
-
|
|
13
|
+
weekStartsOn: a.weekStartsOn,
|
|
14
|
+
fiscalConfig: a.fiscalConfig
|
|
15
|
+
}), B = ({
|
|
15
16
|
field: e,
|
|
16
17
|
validationRules: a,
|
|
17
18
|
isDisabled: p,
|
|
@@ -19,26 +20,26 @@ const S = (e, a) => Y(e, {
|
|
|
19
20
|
}) => {
|
|
20
21
|
const t = e.fieldType === "week_range" ? e : null;
|
|
21
22
|
if (!t) return null;
|
|
22
|
-
const { minDate: u, maxDate: m, startMonth: D, endMonth: k } =
|
|
23
|
+
const { minDate: u, maxDate: m, startMonth: D, endMonth: k } = Y(t), v = d.form.control;
|
|
23
24
|
return /* @__PURE__ */ c(
|
|
24
|
-
|
|
25
|
+
T,
|
|
25
26
|
{
|
|
26
27
|
name: e.id,
|
|
27
28
|
control: v,
|
|
28
29
|
rules: a,
|
|
29
30
|
render: ({ field: w, fieldState: h }) => {
|
|
30
|
-
const g = !!h.error, r = w.value, s = r?.start ?
|
|
31
|
+
const g = !!h.error, r = w.value, s = r?.start ? M(r.start) ?? null : null, i = r?.end ? M(r.end) ?? null : null, C = !!(s && i);
|
|
31
32
|
return /* @__PURE__ */ c("div", { children: /* @__PURE__ */ c(
|
|
32
|
-
|
|
33
|
+
b,
|
|
33
34
|
{
|
|
34
35
|
label: e.label,
|
|
35
|
-
value:
|
|
36
|
+
value: C && s && i ? {
|
|
36
37
|
from: S(s, t),
|
|
37
38
|
to: S(i, t)
|
|
38
39
|
} : void 0,
|
|
39
40
|
onChange: (o) => {
|
|
40
|
-
const
|
|
41
|
-
d.setValue(e.id, { start:
|
|
41
|
+
const f = o?.from ? { from: o.from, to: o.to ?? o.from } : void 0, n = f?.from?.startDate, l = f?.to?.endDate, F = n ? `${n.getFullYear()}-${String(n.getMonth() + 1).padStart(2, "0")}-${String(n.getDate()).padStart(2, "0")}` : null, P = l ? `${l.getFullYear()}-${String(l.getMonth() + 1).padStart(2, "0")}-${String(l.getDate()).padStart(2, "0")}` : null;
|
|
42
|
+
d.setValue(e.id, { start: F, end: P });
|
|
42
43
|
},
|
|
43
44
|
placeholder: t.placeholder,
|
|
44
45
|
startMonth: u ?? D,
|
|
@@ -55,6 +56,7 @@ const S = (e, a) => Y(e, {
|
|
|
55
56
|
granularity: t.granularity,
|
|
56
57
|
fiscalMonthPattern: t.fiscalMonthPattern,
|
|
57
58
|
fiscalYearStartMonth: t.fiscalYearStartMonth,
|
|
59
|
+
fiscalConfig: t.fiscalConfig,
|
|
58
60
|
showFooter: t.showFooter,
|
|
59
61
|
showPeriodBoundaries: t.showPeriodBoundaries,
|
|
60
62
|
autoNavigateToAvailable: t.autoNavigateToAvailable,
|
|
@@ -66,5 +68,5 @@ const S = (e, a) => Y(e, {
|
|
|
66
68
|
);
|
|
67
69
|
};
|
|
68
70
|
export {
|
|
69
|
-
|
|
71
|
+
B as WeekRangeField
|
|
70
72
|
};
|
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { Controller as
|
|
3
|
-
import { YearPicker as
|
|
4
|
-
import { getFieldTestId as
|
|
5
|
-
import {
|
|
6
|
-
const
|
|
2
|
+
import { Controller as f } from "react-hook-form";
|
|
3
|
+
import { YearPicker as w } from "../../components/forms/date-picker/year-picker.js";
|
|
4
|
+
import { getFieldTestId as v } from "../utils/fieldTestIds.js";
|
|
5
|
+
import { resolveYearRangeMinMax as P } from "../utils/date.utils.js";
|
|
6
|
+
const Y = ({
|
|
7
7
|
field: r,
|
|
8
|
-
validationRules:
|
|
9
|
-
isDisabled:
|
|
10
|
-
formHelpers:
|
|
8
|
+
validationRules: i,
|
|
9
|
+
isDisabled: c,
|
|
10
|
+
formHelpers: t
|
|
11
11
|
}) => {
|
|
12
12
|
const e = r.fieldType === "year_picker" ? r : null;
|
|
13
13
|
if (!e) return null;
|
|
14
|
-
const
|
|
14
|
+
const { minDate: d, maxDate: u, startMonth: h, endMonth: m } = P(e), p = t.form.control;
|
|
15
15
|
return /* @__PURE__ */ o(
|
|
16
|
-
|
|
16
|
+
f,
|
|
17
17
|
{
|
|
18
18
|
name: r.id,
|
|
19
|
-
control:
|
|
19
|
+
control: p,
|
|
20
20
|
defaultValue: e.defaultValue != null ? { year: e.defaultValue } : void 0,
|
|
21
|
-
rules:
|
|
22
|
-
render: ({ field:
|
|
23
|
-
const
|
|
24
|
-
return /* @__PURE__ */ o("div", { "data-testid":
|
|
25
|
-
|
|
21
|
+
rules: i,
|
|
22
|
+
render: ({ field: a, fieldState: n }) => {
|
|
23
|
+
const l = !!n.error, M = a.value;
|
|
24
|
+
return /* @__PURE__ */ o("div", { "data-testid": v(r.id), children: /* @__PURE__ */ o(
|
|
25
|
+
w,
|
|
26
26
|
{
|
|
27
27
|
label: r.label,
|
|
28
|
-
value:
|
|
29
|
-
onChange: (
|
|
30
|
-
|
|
28
|
+
value: M ?? void 0,
|
|
29
|
+
onChange: (s) => {
|
|
30
|
+
a.onChange(s ?? null), t.setValue(r.id, s ?? null);
|
|
31
31
|
},
|
|
32
32
|
placeholder: r.placeholder,
|
|
33
|
-
minDate:
|
|
34
|
-
maxDate:
|
|
35
|
-
startMonth:
|
|
36
|
-
endMonth:
|
|
33
|
+
minDate: d,
|
|
34
|
+
maxDate: u,
|
|
35
|
+
startMonth: h,
|
|
36
|
+
endMonth: m,
|
|
37
37
|
required: r.isRequired,
|
|
38
|
-
disabled:
|
|
39
|
-
error:
|
|
40
|
-
helperText:
|
|
38
|
+
disabled: c,
|
|
39
|
+
error: l,
|
|
40
|
+
helperText: l ? n.error?.message : r.helpText,
|
|
41
41
|
showFooter: e.showFooter,
|
|
42
42
|
showIntervalCaption: e.showIntervalCaption,
|
|
43
43
|
calendarKind: e.calendarKind,
|
|
@@ -54,5 +54,5 @@ const x = ({
|
|
|
54
54
|
);
|
|
55
55
|
};
|
|
56
56
|
export {
|
|
57
|
-
|
|
57
|
+
Y as YearPickerField
|
|
58
58
|
};
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Controller as
|
|
3
|
-
import { YearRangePicker as
|
|
4
|
-
import { getFieldTestId as
|
|
5
|
-
import {
|
|
6
|
-
const
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { Controller as w } from "react-hook-form";
|
|
3
|
+
import { YearRangePicker as v } from "../../components/forms/date-picker/year-range-picker.js";
|
|
4
|
+
import { getFieldTestId as y } from "../utils/fieldTestIds.js";
|
|
5
|
+
import { resolveYearRangeMinMax as R } from "../utils/date.utils.js";
|
|
6
|
+
const k = ({
|
|
7
7
|
field: r,
|
|
8
|
-
validationRules:
|
|
9
|
-
isDisabled:
|
|
10
|
-
formHelpers:
|
|
8
|
+
validationRules: c,
|
|
9
|
+
isDisabled: d,
|
|
10
|
+
formHelpers: t
|
|
11
11
|
}) => {
|
|
12
12
|
const e = r.fieldType === "year_range" ? r : null;
|
|
13
13
|
if (!e) return null;
|
|
14
|
-
const
|
|
15
|
-
return /* @__PURE__ */
|
|
16
|
-
|
|
14
|
+
const { minDate: h, maxDate: u, startMonth: m, endMonth: p } = R(e), g = t.form.control, f = e.defaultRange ? { from: { year: e.defaultRange.start }, to: { year: e.defaultRange.end } } : void 0;
|
|
15
|
+
return /* @__PURE__ */ o(
|
|
16
|
+
w,
|
|
17
17
|
{
|
|
18
18
|
name: r.id,
|
|
19
|
-
control:
|
|
20
|
-
defaultValue:
|
|
21
|
-
rules:
|
|
22
|
-
render: ({ field: n, fieldState:
|
|
23
|
-
const
|
|
24
|
-
return /* @__PURE__ */
|
|
25
|
-
|
|
19
|
+
control: g,
|
|
20
|
+
defaultValue: f,
|
|
21
|
+
rules: c,
|
|
22
|
+
render: ({ field: n, fieldState: s }) => {
|
|
23
|
+
const l = !!s.error, a = n.value, M = a && typeof a == "object" && !Array.isArray(a) && ("from" in a || "to" in a) ? a : void 0;
|
|
24
|
+
return /* @__PURE__ */ o("div", { "data-testid": y(r.id), children: /* @__PURE__ */ o(
|
|
25
|
+
v,
|
|
26
26
|
{
|
|
27
27
|
label: r.label,
|
|
28
|
-
value:
|
|
28
|
+
value: M,
|
|
29
29
|
onChange: (i) => {
|
|
30
|
-
n.onChange(i ?? null),
|
|
30
|
+
n.onChange(i ?? null), t.setValue(r.id, i ?? null);
|
|
31
31
|
},
|
|
32
32
|
placeholder: r.placeholder,
|
|
33
|
-
minDate:
|
|
34
|
-
maxDate:
|
|
35
|
-
startMonth:
|
|
36
|
-
endMonth:
|
|
33
|
+
minDate: h,
|
|
34
|
+
maxDate: u,
|
|
35
|
+
startMonth: m,
|
|
36
|
+
endMonth: p,
|
|
37
37
|
required: r.isRequired,
|
|
38
|
-
disabled:
|
|
39
|
-
error:
|
|
40
|
-
helperText:
|
|
38
|
+
disabled: d,
|
|
39
|
+
error: l,
|
|
40
|
+
helperText: l ? s.error?.message : r.helpText,
|
|
41
41
|
showFooter: e.showFooter,
|
|
42
42
|
showIntervalCaption: e.showIntervalCaption,
|
|
43
43
|
calendarKind: e.calendarKind,
|
|
@@ -54,5 +54,5 @@ const C = ({
|
|
|
54
54
|
);
|
|
55
55
|
};
|
|
56
56
|
export {
|
|
57
|
-
|
|
57
|
+
k as YearRangePickerField
|
|
58
58
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Option } from '../../components/forms/select';
|
|
2
2
|
import { HTMLInputTypeAttribute } from 'react';
|
|
3
3
|
import { FieldOutputValue } from './fieldsOutput.types';
|
|
4
|
+
import { FiscalCalendarConfig } from '../../lib/fiscal-calendar';
|
|
4
5
|
export type ValidationRule = {
|
|
5
6
|
/** Regex pattern string to test against */
|
|
6
7
|
regex?: string;
|
|
@@ -219,6 +220,8 @@ export type WeekRangeField = BaseField & {
|
|
|
219
220
|
granularity?: "day" | "week" | "period" | "quarter" | "year";
|
|
220
221
|
fiscalMonthPattern?: number[];
|
|
221
222
|
fiscalYearStartMonth?: number;
|
|
223
|
+
/** Canonical retail/NRF config. Wins over fiscalYearStartMonth and fiscalMonthPattern. */
|
|
224
|
+
fiscalConfig?: FiscalCalendarConfig;
|
|
222
225
|
showFooter?: boolean;
|
|
223
226
|
/** Draw `(` / `)` on fiscal period start/end days. Default false. */
|
|
224
227
|
showPeriodBoundaries?: boolean;
|
|
@@ -235,12 +238,25 @@ export type MultiWeekRangeField = BaseField & {
|
|
|
235
238
|
fieldType: "multi_week_picker";
|
|
236
239
|
minDate?: string;
|
|
237
240
|
maxDate?: string;
|
|
241
|
+
/** Minimum selectable start date = today + N days (0 = today, blocks past dates). */
|
|
242
|
+
minStartOffsetDays?: number;
|
|
243
|
+
/** When true, blocks weeks before the current week (minDate = current week start). */
|
|
244
|
+
disablePastWeeks?: boolean;
|
|
245
|
+
/** First month shown in the picker navigation (ISO date string). */
|
|
246
|
+
startMonth?: string;
|
|
247
|
+
/** Last month shown in the picker navigation (ISO date string). */
|
|
248
|
+
endMonth?: string;
|
|
249
|
+
/** Earliest week: week start of the week N weeks before the current week (0 = current week). */
|
|
250
|
+
minWeeksOffset?: number;
|
|
251
|
+
/** Latest week: week end of the week N weeks after the current week. */
|
|
252
|
+
maxWeeksOffset?: number;
|
|
238
253
|
calendarKind?: "gregorian" | "fiscal";
|
|
239
254
|
fiscalMode?: "basic" | "advanced" | "custom";
|
|
240
255
|
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
241
256
|
granularity?: "day" | "week" | "period" | "quarter" | "year";
|
|
242
257
|
fiscalMonthPattern?: number[];
|
|
243
258
|
fiscalYearStartMonth?: number;
|
|
259
|
+
fiscalConfig?: FiscalCalendarConfig;
|
|
244
260
|
showPeriodBoundaries?: boolean;
|
|
245
261
|
/** When true, open on the first enabled week. Navigate only. */
|
|
246
262
|
autoNavigateToAvailable?: boolean;
|
|
@@ -281,6 +297,12 @@ export type MultiMonthPickerField = BaseField & {
|
|
|
281
297
|
maxDate?: string;
|
|
282
298
|
startMonth?: string;
|
|
283
299
|
endMonth?: string;
|
|
300
|
+
/** Number of months before the current month to set as the minimum selectable month */
|
|
301
|
+
minMonthsOffset?: number;
|
|
302
|
+
/** Number of months after the current month to set as the maximum selectable month */
|
|
303
|
+
maxMonthsOffset?: number;
|
|
304
|
+
/** When true, blocks months before the current month. */
|
|
305
|
+
disablePastMonths?: boolean;
|
|
284
306
|
/** When true, open on the first enabled month. Navigate only. */
|
|
285
307
|
autoNavigateToAvailable?: boolean;
|
|
286
308
|
};
|
|
@@ -289,6 +311,10 @@ export type YearPickerField = BaseField & {
|
|
|
289
311
|
defaultValue?: number;
|
|
290
312
|
minDate?: string;
|
|
291
313
|
maxDate?: string;
|
|
314
|
+
/** Earliest year: year start of the year N years before today (0 = current year). Takes precedence over `minDate`. */
|
|
315
|
+
minYearsOffset?: number;
|
|
316
|
+
/** Latest year: year end of the year N years after today (0 = current year). Takes precedence over `maxDate`. */
|
|
317
|
+
maxYearsOffset?: number;
|
|
292
318
|
startMonth?: string;
|
|
293
319
|
endMonth?: string;
|
|
294
320
|
showFooter?: boolean;
|
|
@@ -307,6 +333,10 @@ export type MultiYearPickerField = BaseField & {
|
|
|
307
333
|
defaultValue?: number[];
|
|
308
334
|
minDate?: string;
|
|
309
335
|
maxDate?: string;
|
|
336
|
+
/** Earliest year: year start of the year N years before today (0 = current year). Takes precedence over `minDate`. */
|
|
337
|
+
minYearsOffset?: number;
|
|
338
|
+
/** Latest year: year end of the year N years after today (0 = current year). Takes precedence over `maxDate`. */
|
|
339
|
+
maxYearsOffset?: number;
|
|
310
340
|
startMonth?: string;
|
|
311
341
|
endMonth?: string;
|
|
312
342
|
showFooter?: boolean;
|
|
@@ -328,6 +358,10 @@ export type YearRangePickerField = BaseField & {
|
|
|
328
358
|
};
|
|
329
359
|
minDate?: string;
|
|
330
360
|
maxDate?: string;
|
|
361
|
+
/** Earliest year: year start of the year N years before today (0 = current year). Takes precedence over `minDate`. */
|
|
362
|
+
minYearsOffset?: number;
|
|
363
|
+
/** Latest year: year end of the year N years after today (0 = current year). Takes precedence over `maxDate`. */
|
|
364
|
+
maxYearsOffset?: number;
|
|
331
365
|
startMonth?: string;
|
|
332
366
|
endMonth?: string;
|
|
333
367
|
showFooter?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DateRangeField, WeekRangeField } from '../types/fields.types';
|
|
1
|
+
import { DateRangeField, MonthRangeField, MultiMonthPickerField, WeekRangeField, YearRangePickerField } from '../types/fields.types';
|
|
2
2
|
export declare const DEFAULT_PICKER_DATE_FORMAT = "yyyy-MM-dd";
|
|
3
3
|
/**
|
|
4
4
|
* Makes a remote-config date format safe for the date-fns based pickers.
|
|
@@ -19,15 +19,65 @@ export declare function handleDateFnsFormat(configFormat?: string): string;
|
|
|
19
19
|
export declare function formatDateByConfigFormat(d: Date, df?: string): string;
|
|
20
20
|
export declare function startOfDayDate(d: Date): Date;
|
|
21
21
|
export declare function addDaysDate(d: Date, n: number): Date;
|
|
22
|
-
|
|
22
|
+
export declare function addYearsDate(d: Date, n: number): Date;
|
|
23
|
+
type DateRangeBoundsField = Pick<DateRangeField, "minDate" | "maxDate" | "minStartOffsetDays" | "startMonth" | "endMonth">;
|
|
24
|
+
type WeekRangeBoundsField = {
|
|
25
|
+
minDate?: string;
|
|
26
|
+
maxDate?: string;
|
|
27
|
+
minStartOffsetDays?: number;
|
|
28
|
+
disablePastWeeks?: boolean;
|
|
29
|
+
minWeeksOffset?: number;
|
|
30
|
+
maxWeeksOffset?: number;
|
|
31
|
+
startMonth?: string;
|
|
32
|
+
endMonth?: string;
|
|
33
|
+
calendarKind?: WeekRangeField["calendarKind"];
|
|
34
|
+
fiscalMode?: WeekRangeField["fiscalMode"];
|
|
35
|
+
granularity?: WeekRangeField["granularity"];
|
|
36
|
+
fiscalMonthPattern?: WeekRangeField["fiscalMonthPattern"];
|
|
37
|
+
fiscalYearStartMonth?: WeekRangeField["fiscalYearStartMonth"];
|
|
38
|
+
weekStartsOn?: WeekRangeField["weekStartsOn"];
|
|
39
|
+
fiscalConfig?: WeekRangeField["fiscalConfig"];
|
|
40
|
+
};
|
|
23
41
|
export declare const handleMinMaxProp: (dateRangeField: DateRangeField) => {
|
|
24
42
|
minDate: Date | undefined;
|
|
25
43
|
maxDate: Date | undefined;
|
|
26
44
|
};
|
|
45
|
+
export declare const resolveDateRangeMinMax: (dateRangeField: DateRangeBoundsField) => {
|
|
46
|
+
minDate: Date | undefined;
|
|
47
|
+
maxDate: Date | undefined;
|
|
48
|
+
startMonth: Date | undefined;
|
|
49
|
+
endMonth: Date | undefined;
|
|
50
|
+
};
|
|
27
51
|
export declare const resolveWeekRangeMinMax: (weekRangeField: WeekRangeBoundsField) => {
|
|
28
52
|
minDate: Date | undefined;
|
|
29
53
|
maxDate: Date | undefined;
|
|
30
54
|
startMonth: Date | undefined;
|
|
31
55
|
endMonth: Date | undefined;
|
|
32
56
|
};
|
|
57
|
+
type MonthRangeBoundsField = Pick<MonthRangeField | MultiMonthPickerField, "minDate" | "maxDate" | "startMonth" | "endMonth" | "minMonthsOffset" | "maxMonthsOffset" | "disablePastMonths">;
|
|
58
|
+
export declare const resolveMonthRangeMinMax: (monthRangeField: MonthRangeBoundsField) => {
|
|
59
|
+
minDate: Date | undefined;
|
|
60
|
+
maxDate: Date | undefined;
|
|
61
|
+
startMonth: Date | undefined;
|
|
62
|
+
endMonth: Date | undefined;
|
|
63
|
+
};
|
|
64
|
+
type YearRangeBoundsField = Pick<YearRangePickerField, "minDate" | "maxDate" | "minYearsOffset" | "maxYearsOffset" | "startMonth" | "endMonth" | "calendarKind" | "fiscalMode" | "fiscalMonthPattern" | "fiscalYearStartMonth" | "weekStartsOn">;
|
|
65
|
+
/**
|
|
66
|
+
* Resolves selectable year bounds. `minYearsOffset` / `maxYearsOffset` win over
|
|
67
|
+
* static `minDate` / `maxDate` so existing hardcoded configs keep working when
|
|
68
|
+
* offsets are omitted.
|
|
69
|
+
*/
|
|
70
|
+
export declare const resolveYearRangeMinMax: (yearRangeField: YearRangeBoundsField) => {
|
|
71
|
+
minDate: Date | undefined;
|
|
72
|
+
maxDate: Date | undefined;
|
|
73
|
+
startMonth: Date | undefined;
|
|
74
|
+
endMonth: Date | undefined;
|
|
75
|
+
};
|
|
76
|
+
/** Quarter pickers navigate by year — reuse year-bound resolution for min/max/month caps. */
|
|
77
|
+
export declare const resolveQuarterRangeMinMax: (yearRangeField: YearRangeBoundsField) => {
|
|
78
|
+
minDate: Date | undefined;
|
|
79
|
+
maxDate: Date | undefined;
|
|
80
|
+
startMonth: Date | undefined;
|
|
81
|
+
endMonth: Date | undefined;
|
|
82
|
+
};
|
|
33
83
|
export {};
|