impact-nova 2.5.7 → 2.5.8
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/ag-grid-react/ag-grid.types.d.ts +2 -2
- package/dist/components/data/ag-grid-react/headers/components/date-filter-picker.d.ts +4 -2
- package/dist/components/data/ag-grid-react/headers/header-search-input.js +65 -65
- package/dist/components/data/ag-grid-react/headers/utils/date-utils.js +55 -48
- package/dist/components/data-display/calendar/calendar-apply-validation.d.ts +4 -2
- package/dist/components/data-display/calendar/calendar-apply-validation.js +80 -61
- package/dist/components/data-display/calendar/calendar-config.d.ts +13 -5
- package/dist/components/data-display/calendar/calendar-config.js +31 -20
- package/dist/components/data-display/calendar/calendar-day-button.js +43 -35
- package/dist/components/data-display/calendar/calendar-day-hover.d.ts +8 -0
- package/dist/components/data-display/calendar/calendar-day-hover.js +20 -0
- package/dist/components/data-display/calendar/calendar-day-picker-classnames.d.ts +8 -1
- package/dist/components/data-display/calendar/calendar-day-picker-classnames.js +40 -20
- package/dist/components/data-display/calendar/calendar-day-picker-components.d.ts +12 -1
- package/dist/components/data-display/calendar/calendar-day-picker-components.js +201 -108
- package/dist/components/data-display/calendar/calendar-day-picker-view.d.ts +11 -3
- package/dist/components/data-display/calendar/calendar-day-picker-view.js +136 -92
- package/dist/components/data-display/calendar/calendar-fiscal-labels.d.ts +38 -0
- package/dist/components/data-display/calendar/calendar-fiscal-labels.js +90 -0
- package/dist/components/data-display/calendar/calendar-footer-summary.d.ts +13 -4
- package/dist/components/data-display/calendar/calendar-footer-summary.js +101 -50
- package/dist/components/data-display/calendar/calendar-footer.d.ts +16 -7
- package/dist/components/data-display/calendar/calendar-footer.js +88 -66
- package/dist/components/data-display/calendar/calendar-gregorian-presets.d.ts +2 -0
- package/dist/components/data-display/calendar/calendar-gregorian-presets.js +26 -0
- package/dist/components/data-display/calendar/calendar-interval-caption.d.ts +1 -0
- package/dist/components/data-display/calendar/calendar-interval-caption.js +10 -0
- package/dist/components/data-display/calendar/calendar-interval-utils.d.ts +23 -0
- package/dist/components/data-display/calendar/calendar-interval-utils.js +154 -0
- package/dist/components/data-display/calendar/calendar-month-panes.d.ts +5 -1
- package/dist/components/data-display/calendar/calendar-month-panes.js +9 -7
- package/dist/components/data-display/calendar/calendar-month-picker-panel.d.ts +5 -1
- package/dist/components/data-display/calendar/calendar-month-picker-panel.js +76 -77
- package/dist/components/data-display/calendar/calendar-month-utils.d.ts +2 -0
- package/dist/components/data-display/calendar/calendar-month-utils.js +69 -60
- package/dist/components/data-display/calendar/calendar-padding-week.utils.d.ts +15 -0
- package/dist/components/data-display/calendar/calendar-padding-week.utils.js +22 -3
- package/dist/components/data-display/calendar/calendar-panel-context.d.ts +1 -1
- package/dist/components/data-display/calendar/calendar-period-cell.d.ts +18 -0
- package/dist/components/data-display/calendar/calendar-period-cell.js +89 -0
- package/dist/components/data-display/calendar/calendar-period-keyboard.d.ts +2 -0
- package/dist/components/data-display/calendar/calendar-period-keyboard.js +18 -0
- package/dist/components/data-display/calendar/calendar-preset-strip.d.ts +6 -0
- package/dist/components/data-display/calendar/calendar-preset-strip.js +26 -0
- package/dist/components/data-display/calendar/calendar-quarter-panes.d.ts +24 -0
- package/dist/components/data-display/calendar/calendar-quarter-panes.js +115 -0
- package/dist/components/data-display/calendar/calendar-quarter-utils.d.ts +19 -0
- package/dist/components/data-display/calendar/calendar-quarter-utils.js +95 -0
- package/dist/components/data-display/calendar/calendar-selection-appearance.d.ts +38 -0
- package/dist/components/data-display/calendar/calendar-selection-appearance.js +72 -0
- package/dist/components/data-display/calendar/calendar-selection.d.ts +20 -0
- package/dist/components/data-display/calendar/calendar-selection.js +31 -0
- package/dist/components/data-display/calendar/calendar-week-number-cell.d.ts +6 -1
- package/dist/components/data-display/calendar/calendar-week-number-cell.js +53 -38
- package/dist/components/data-display/calendar/calendar-week-number-header.d.ts +4 -0
- package/dist/components/data-display/calendar/calendar-week-number-header.js +15 -0
- package/dist/components/data-display/calendar/calendar-week-utils.d.ts +11 -3
- package/dist/components/data-display/calendar/calendar-week-utils.js +49 -42
- package/dist/components/data-display/calendar/calendar-year-panes.d.ts +18 -0
- package/dist/components/data-display/calendar/calendar-year-panes.js +98 -0
- package/dist/components/data-display/calendar/calendar-year-utils.d.ts +17 -0
- package/dist/components/data-display/calendar/calendar-year-utils.js +75 -0
- package/dist/components/data-display/calendar/calendar.d.ts +1 -1
- package/dist/components/data-display/calendar/calendar.js +303 -181
- package/dist/components/data-display/calendar/calendar.types.d.ts +53 -16
- package/dist/components/data-display/calendar/fiscal-period-caption-select.d.ts +7 -0
- package/dist/components/data-display/calendar/fiscal-period-caption-select.js +63 -0
- package/dist/components/data-display/calendar/index.d.ts +1 -1
- package/dist/components/data-display/calendar/use-calendar-day-picker-config.d.ts +12 -2
- package/dist/components/data-display/calendar/use-calendar-day-picker-config.js +92 -62
- package/dist/components/data-display/calendar/use-calendar-state.d.ts +31 -11
- package/dist/components/data-display/calendar/use-calendar-state.js +370 -163
- package/dist/components/data-display/calendar/use-fiscal-calendar.d.ts +5 -0
- package/dist/components/data-display/calendar/use-fiscal-calendar.js +24 -0
- package/dist/components/feedback/tooltip/overflow-tooltip.js +57 -57
- package/dist/components/forms/date-picker/date-input-behavior.d.ts +7 -0
- package/dist/components/forms/date-picker/date-input-behavior.js +28 -24
- package/dist/components/forms/date-picker/date-picker-shell.d.ts +13 -0
- package/dist/components/forms/date-picker/date-picker-shell.js +31 -0
- package/dist/components/forms/date-picker/date-picker.js +187 -167
- package/dist/components/forms/date-picker/date-picker.types.d.ts +90 -43
- package/dist/components/forms/date-picker/date-range-picker.js +273 -224
- package/dist/components/forms/date-picker/fiscal-pass-through.d.ts +13 -0
- package/dist/components/forms/date-picker/fiscal-pass-through.js +17 -0
- package/dist/components/forms/date-picker/fiscal-period-format.d.ts +9 -0
- package/dist/components/forms/date-picker/fiscal-period-format.js +50 -0
- package/dist/components/forms/date-picker/index.d.ts +12 -0
- package/dist/components/forms/date-picker/index.js +19 -7
- package/dist/components/forms/date-picker/month-picker.js +225 -182
- package/dist/components/forms/date-picker/month-range-picker.js +134 -110
- package/dist/components/forms/date-picker/multi-date-picker.js +77 -56
- package/dist/components/forms/date-picker/multi-month-picker.js +78 -57
- package/dist/components/forms/date-picker/multi-quarter-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/multi-quarter-picker.js +177 -0
- package/dist/components/forms/date-picker/multi-week-picker.js +81 -70
- package/dist/components/forms/date-picker/multi-year-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/multi-year-picker.js +179 -0
- package/dist/components/forms/date-picker/quarter-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/quarter-picker.js +176 -0
- package/dist/components/forms/date-picker/quarter-range-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/quarter-range-picker.js +177 -0
- package/dist/components/forms/date-picker/week-picker.js +148 -137
- package/dist/components/forms/date-picker/week-range-picker.js +216 -205
- package/dist/components/forms/date-picker/year-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/year-picker.js +176 -0
- package/dist/components/forms/date-picker/year-range-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/year-range-picker.js +179 -0
- package/dist/form-react/Fields/DateInputField.js +63 -58
- package/dist/form-react/Fields/DateRangeField.js +42 -37
- package/dist/form-react/Fields/MonthRangeField.js +50 -45
- package/dist/form-react/Fields/MultiWeekPickerField.js +7 -7
- package/dist/form-react/Fields/WeekRangePicker.js +44 -45
- package/dist/form-react/components/FieldRenderer.js +21 -23
- package/dist/form-react/registry/defaultFieldRegistrations.d.ts +9 -1
- package/dist/form-react/registry/defaultFieldRegistrations.js +27 -36
- package/dist/form-react/registry/resolveFieldComponent.d.ts +3 -2
- package/dist/form-react/registry/resolveFieldComponent.js +9 -133
- package/dist/form-react/types/fields.types.d.ts +19 -4
- package/dist/form-react/utils/date.utils.d.ts +1 -1
- package/dist/form-react/utils/date.utils.js +38 -38
- package/dist/i18n/defaultMessages.d.ts +19 -1
- package/dist/i18n/defaultMessages.js +37 -20
- package/dist/i18n/locales/de.js +18 -1
- package/dist/i18n/locales/es.js +18 -1
- package/dist/i18n/locales/hi.js +18 -1
- package/dist/i18n/locales/kn.js +18 -1
- package/dist/impact-nova-components.css +379 -3
- package/dist/impact-nova.css +1 -1
- package/dist/index.js +528 -516
- package/dist/lib/fiscal-calendar/build-year.d.ts +8 -0
- package/dist/lib/fiscal-calendar/build-year.js +173 -0
- package/dist/lib/fiscal-calendar/civil-date.d.ts +21 -0
- package/dist/lib/fiscal-calendar/civil-date.js +94 -0
- package/dist/lib/fiscal-calendar/index.d.ts +10 -0
- package/dist/lib/fiscal-calendar/index.js +40 -0
- package/dist/lib/fiscal-calendar/lookup.d.ts +4 -0
- package/dist/lib/fiscal-calendar/lookup.js +70 -0
- package/dist/lib/fiscal-calendar/presets.d.ts +8 -0
- package/dist/lib/fiscal-calendar/presets.js +99 -0
- package/dist/lib/fiscal-calendar/selection.d.ts +18 -0
- package/dist/lib/fiscal-calendar/selection.js +32 -0
- package/dist/lib/fiscal-calendar/types.d.ts +145 -0
- package/dist/lib/fiscal-calendar/types.js +10 -0
- package/dist/lib/fiscal-calendar/week-selection.d.ts +22 -0
- package/dist/lib/fiscal-calendar/week-selection.js +107 -0
- package/package.json +5 -1
- package/dist/lib/fiscal-calendar.d.ts +0 -62
- package/dist/lib/fiscal-calendar.js +0 -99
|
@@ -1,66 +1,71 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Controller as
|
|
3
|
-
import { MonthRangePicker as
|
|
4
|
-
import { getFieldTestId as
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
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
|
-
},
|
|
14
|
-
field:
|
|
13
|
+
}, O = ({
|
|
14
|
+
field: r,
|
|
15
15
|
validationRules: s,
|
|
16
16
|
isDisabled: l,
|
|
17
|
-
formHelpers:
|
|
17
|
+
formHelpers: a
|
|
18
18
|
}) => {
|
|
19
|
-
const
|
|
20
|
-
if (!
|
|
21
|
-
const y =
|
|
22
|
-
return /* @__PURE__ */
|
|
23
|
-
|
|
19
|
+
const d = a.form.control, t = r.fieldType === "month_range" ? r : null;
|
|
20
|
+
if (!t) return null;
|
|
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
|
+
return /* @__PURE__ */ u(
|
|
23
|
+
F,
|
|
24
24
|
{
|
|
25
|
-
name:
|
|
26
|
-
control:
|
|
27
|
-
defaultValue:
|
|
25
|
+
name: r.id,
|
|
26
|
+
control: d,
|
|
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
|
|
31
|
-
return /* @__PURE__ */
|
|
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: {
|
|
38
38
|
from: p,
|
|
39
|
-
to:
|
|
39
|
+
to: m
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
|
-
onChange: (
|
|
43
|
-
if (!
|
|
44
|
-
const
|
|
45
|
-
|
|
42
|
+
onChange: (e) => {
|
|
43
|
+
if (!e?.from || !e?.to) {
|
|
44
|
+
const g = { start: null, end: null };
|
|
45
|
+
i.onChange(g), a.setValue(r.id, g);
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
const
|
|
49
|
-
start:
|
|
50
|
-
end:
|
|
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
|
+
start: $,
|
|
50
|
+
end: x
|
|
51
51
|
};
|
|
52
|
-
|
|
52
|
+
i.onChange(S), a.setValue(r.id, S);
|
|
53
53
|
},
|
|
54
|
-
placeholder:
|
|
55
|
-
minDate:
|
|
56
|
-
maxDate:
|
|
57
|
-
startMonth:
|
|
58
|
-
endMonth:
|
|
59
|
-
required:
|
|
54
|
+
placeholder: r.placeholder,
|
|
55
|
+
minDate: c,
|
|
56
|
+
maxDate: h,
|
|
57
|
+
startMonth: c || o(t.startMonth),
|
|
58
|
+
endMonth: h || o(t.endMonth),
|
|
59
|
+
required: r.isRequired,
|
|
60
60
|
disabled: l,
|
|
61
|
-
error:
|
|
62
|
-
helperText:
|
|
63
|
-
showFooter: !0
|
|
61
|
+
error: f,
|
|
62
|
+
helperText: f ? M.error?.message : r.helpText,
|
|
63
|
+
showFooter: !0,
|
|
64
|
+
calendarKind: t.calendarKind,
|
|
65
|
+
fiscalMode: t.fiscalMode,
|
|
66
|
+
fiscalYearStartMonth: t.fiscalYearStartMonth,
|
|
67
|
+
fiscalMonthPattern: t.fiscalMonthPattern,
|
|
68
|
+
showPresets: t.showPresets
|
|
64
69
|
}
|
|
65
70
|
) });
|
|
66
71
|
}
|
|
@@ -68,5 +73,5 @@ const w = (t) => {
|
|
|
68
73
|
);
|
|
69
74
|
};
|
|
70
75
|
export {
|
|
71
|
-
|
|
76
|
+
O as MonthRangeField
|
|
72
77
|
};
|
|
@@ -3,18 +3,18 @@ import { Controller as p } from "react-hook-form";
|
|
|
3
3
|
import { MultiWeekPicker as h } from "../../components/forms/date-picker/multi-week-picker.js";
|
|
4
4
|
import { getFieldTestId as k } from "../utils/fieldTestIds.js";
|
|
5
5
|
import { toLocalDate as i } from "../utils/calendar-boundary.js";
|
|
6
|
-
const
|
|
6
|
+
const M = ({
|
|
7
7
|
field: e,
|
|
8
8
|
validationRules: m,
|
|
9
9
|
isDisabled: s,
|
|
10
10
|
formHelpers: c
|
|
11
11
|
}) => {
|
|
12
|
-
const
|
|
12
|
+
const d = c.form.control, r = e.fieldType === "multi_week_picker" ? e : null;
|
|
13
13
|
return r ? /* @__PURE__ */ o(
|
|
14
14
|
p,
|
|
15
15
|
{
|
|
16
16
|
name: e.id,
|
|
17
|
-
control:
|
|
17
|
+
control: d,
|
|
18
18
|
rules: m,
|
|
19
19
|
render: ({ field: t, fieldState: a }) => {
|
|
20
20
|
const l = !!a.error, n = t.value;
|
|
@@ -23,15 +23,15 @@ const v = ({
|
|
|
23
23
|
{
|
|
24
24
|
label: e.label,
|
|
25
25
|
value: Array.isArray(n) ? n : void 0,
|
|
26
|
-
onChange: (
|
|
27
|
-
t.onChange(
|
|
26
|
+
onChange: (u) => {
|
|
27
|
+
t.onChange(u ?? []);
|
|
28
28
|
},
|
|
29
29
|
placeholder: e.placeholder,
|
|
30
30
|
required: e.isRequired,
|
|
31
31
|
disabled: s,
|
|
32
32
|
error: l,
|
|
33
33
|
helperText: l ? a.error?.message : e.helpText,
|
|
34
|
-
|
|
34
|
+
calendarKind: r.calendarKind,
|
|
35
35
|
fiscalMode: r.fiscalMode,
|
|
36
36
|
weekStartsOn: r.weekStartsOn,
|
|
37
37
|
minDate: i(r.minDate),
|
|
@@ -43,5 +43,5 @@ const v = ({
|
|
|
43
43
|
) : null;
|
|
44
44
|
};
|
|
45
45
|
export {
|
|
46
|
-
|
|
46
|
+
M as MultiWeekPickerField
|
|
47
47
|
};
|
|
@@ -1,61 +1,60 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Controller as
|
|
3
|
-
import { WeekRangePicker as
|
|
4
|
-
import { toLocalDate as
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
formHelpers: i
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { Controller as x } from "react-hook-form";
|
|
3
|
+
import { WeekRangePicker as Y } from "../../components/forms/date-picker/week-range-picker.js";
|
|
4
|
+
import { toLocalDate as u } from "../utils/calendar-boundary.js";
|
|
5
|
+
import { resolveWeekSelection as $ } from "../../lib/fiscal-calendar/week-selection.js";
|
|
6
|
+
import { resolveWeekRangeMinMax as v } from "../utils/date.utils.js";
|
|
7
|
+
const M = (r, e) => $(r, {
|
|
8
|
+
calendarKind: e.calendarKind,
|
|
9
|
+
fiscalMode: e.fiscalMode ?? "basic",
|
|
10
|
+
granularity: e.granularity,
|
|
11
|
+
fiscalMonthPattern: e.fiscalMonthPattern,
|
|
12
|
+
fiscalYearStartMonth: e.fiscalYearStartMonth ?? 1,
|
|
13
|
+
weekStartsOn: e.weekStartsOn ?? 1
|
|
14
|
+
}), T = ({
|
|
15
|
+
field: r,
|
|
16
|
+
validationRules: e,
|
|
17
|
+
isDisabled: D,
|
|
18
|
+
formHelpers: l
|
|
20
19
|
}) => {
|
|
21
|
-
const t =
|
|
20
|
+
const t = r.fieldType === "week_range" ? r : null;
|
|
22
21
|
if (!t) return null;
|
|
23
|
-
const { minDate:
|
|
24
|
-
return /* @__PURE__ */
|
|
25
|
-
|
|
22
|
+
const { minDate: s, maxDate: c, startMonth: S, endMonth: f } = v(t), g = l.form.control;
|
|
23
|
+
return /* @__PURE__ */ n(
|
|
24
|
+
x,
|
|
26
25
|
{
|
|
27
|
-
name:
|
|
26
|
+
name: r.id,
|
|
28
27
|
control: g,
|
|
29
|
-
rules:
|
|
30
|
-
render: ({ field:
|
|
31
|
-
const d = !!
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
|
|
28
|
+
rules: e,
|
|
29
|
+
render: ({ field: p, fieldState: i }) => {
|
|
30
|
+
const d = !!i.error, o = p.value, h = o?.start ? u(o.start) ?? null : null, m = o?.end ? u(o.end) ?? null : null, k = h && m;
|
|
31
|
+
return /* @__PURE__ */ n("div", { children: /* @__PURE__ */ n(
|
|
32
|
+
Y,
|
|
34
33
|
{
|
|
35
|
-
label:
|
|
34
|
+
label: r.label,
|
|
36
35
|
...k && {
|
|
37
36
|
value: {
|
|
38
|
-
from:
|
|
39
|
-
to:
|
|
37
|
+
from: M(h, t),
|
|
38
|
+
to: M(m, t)
|
|
40
39
|
}
|
|
41
40
|
},
|
|
42
|
-
onChange: (
|
|
43
|
-
const w =
|
|
44
|
-
|
|
41
|
+
onChange: (a) => {
|
|
42
|
+
const w = a?.from?.startDate ? `${a.from.startDate.getFullYear()}-${String(a.from.startDate.getMonth() + 1).padStart(2, "0")}-${String(a.from.startDate.getDate()).padStart(2, "0")}` : null, F = a?.to?.endDate ? `${a.to.endDate.getFullYear()}-${String(a.to.endDate.getMonth() + 1).padStart(2, "0")}-${String(a.to.endDate.getDate()).padStart(2, "0")}` : null;
|
|
43
|
+
l.setValue(r.id, { start: w, end: F });
|
|
45
44
|
},
|
|
46
45
|
placeholder: t.placeholder,
|
|
47
|
-
startMonth:
|
|
48
|
-
endMonth:
|
|
49
|
-
required:
|
|
50
|
-
disabled:
|
|
46
|
+
startMonth: s ?? S,
|
|
47
|
+
endMonth: c ?? f,
|
|
48
|
+
required: r.isRequired,
|
|
49
|
+
disabled: D,
|
|
51
50
|
error: d,
|
|
52
|
-
helperText: d ?
|
|
53
|
-
|
|
51
|
+
helperText: d ? i.error?.message : r.helpText,
|
|
52
|
+
calendarKind: t.calendarKind,
|
|
54
53
|
fiscalMode: t.fiscalMode,
|
|
55
54
|
weekStartsOn: t.weekStartsOn,
|
|
56
|
-
minDate:
|
|
57
|
-
maxDate:
|
|
58
|
-
|
|
55
|
+
minDate: s,
|
|
56
|
+
maxDate: c,
|
|
57
|
+
granularity: t.granularity,
|
|
59
58
|
fiscalMonthPattern: t.fiscalMonthPattern,
|
|
60
59
|
fiscalYearStartMonth: t.fiscalYearStartMonth,
|
|
61
60
|
showFooter: t.showFooter,
|
|
@@ -67,5 +66,5 @@ const p = (e) => {
|
|
|
67
66
|
);
|
|
68
67
|
};
|
|
69
68
|
export {
|
|
70
|
-
|
|
69
|
+
T as WeekRangeField
|
|
71
70
|
};
|
|
@@ -1,68 +1,66 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as c } from "react";
|
|
3
3
|
import { SetToEmptyWrapper as u } from "./SetToEmptyWrapper.js";
|
|
4
4
|
import { ObjectFieldRenderer as T } from "./ObjectFieldRenderer.js";
|
|
5
5
|
import { ArrayFieldRenderer as b } from "./ArrayFieldRenderer.js";
|
|
6
6
|
import { buildFieldPath as v } from "../utils/fieldPath.utils.js";
|
|
7
7
|
import { renderRegisteredField as E } from "../registry/resolveFieldComponent.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
R();
|
|
12
|
-
const g = ({
|
|
8
|
+
import { buildFieldValidationRules as R } from "../utils/buildFieldValidationRules.js";
|
|
9
|
+
import { buildEvaluateFieldValidationOptions as S } from "../utils/evaluateFieldValidation.js";
|
|
10
|
+
const $ = ({
|
|
13
11
|
field: e,
|
|
14
12
|
formHelpers: o,
|
|
15
13
|
isVisible: s,
|
|
16
|
-
disabled:
|
|
17
|
-
formConfig:
|
|
18
|
-
supportedValues:
|
|
14
|
+
disabled: a,
|
|
15
|
+
formConfig: n,
|
|
16
|
+
supportedValues: r,
|
|
19
17
|
fieldPathPrefix: i
|
|
20
18
|
}) => {
|
|
21
19
|
const t = c(
|
|
22
20
|
() => i ? { ...e, id: v(e.id, i) } : e,
|
|
23
21
|
[e, i]
|
|
24
|
-
),
|
|
22
|
+
), p = c(() => R(
|
|
25
23
|
t,
|
|
26
|
-
|
|
24
|
+
S(o, t.id)
|
|
27
25
|
), [t, o]);
|
|
28
26
|
if (!s)
|
|
29
27
|
return null;
|
|
30
28
|
if (e.fieldType === "object")
|
|
31
|
-
return /* @__PURE__ */
|
|
29
|
+
return /* @__PURE__ */ d(
|
|
32
30
|
T,
|
|
33
31
|
{
|
|
34
32
|
field: e,
|
|
35
33
|
fieldPathPrefix: i,
|
|
36
34
|
formHelpers: o,
|
|
37
|
-
formConfig:
|
|
38
|
-
supportedValues:
|
|
35
|
+
formConfig: n,
|
|
36
|
+
supportedValues: r
|
|
39
37
|
}
|
|
40
38
|
);
|
|
41
39
|
if (e.fieldType === "array")
|
|
42
|
-
return /* @__PURE__ */
|
|
40
|
+
return /* @__PURE__ */ d(
|
|
43
41
|
b,
|
|
44
42
|
{
|
|
45
43
|
field: e,
|
|
46
44
|
fieldPathPrefix: i,
|
|
47
45
|
formHelpers: o,
|
|
48
|
-
formConfig:
|
|
49
|
-
supportedValues:
|
|
46
|
+
formConfig: n,
|
|
47
|
+
supportedValues: r
|
|
50
48
|
}
|
|
51
49
|
);
|
|
52
|
-
const l = !!t.allowSetToEmpty && o.setToEmptyFields.has(t.id), y =
|
|
50
|
+
const l = !!t.allowSetToEmpty && o.setToEmptyFields.has(t.id), y = a || l, F = {
|
|
53
51
|
field: l ? { ...t, placeholder: "Set to empty" } : t,
|
|
54
52
|
formHelpers: o,
|
|
55
|
-
validationRules:
|
|
53
|
+
validationRules: p,
|
|
56
54
|
isDisabled: y,
|
|
57
|
-
formConfig:
|
|
58
|
-
supportedValues:
|
|
55
|
+
formConfig: n,
|
|
56
|
+
supportedValues: r
|
|
59
57
|
}, m = E(
|
|
60
58
|
e.fieldType,
|
|
61
59
|
F,
|
|
62
60
|
o.formContext?.customFieldTypes
|
|
63
61
|
);
|
|
64
|
-
return /* @__PURE__ */
|
|
62
|
+
return /* @__PURE__ */ d("div", { className: `col-span-${t.colSpan || 1}`, children: t.allowSetToEmpty ? /* @__PURE__ */ d(u, { fieldId: t.id, formHelpers: o, children: m }) : m });
|
|
65
63
|
};
|
|
66
64
|
export {
|
|
67
|
-
|
|
65
|
+
$ as FieldRenderer
|
|
68
66
|
};
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Register all 23 built-in field types. Safe to call multiple times — runs once.
|
|
3
|
+
*
|
|
4
|
+
* Consumers must call this at app startup (or use `registerFieldType` selectively)
|
|
5
|
+
* before rendering any `FieldRenderer` / `ReactHooksForm`.
|
|
6
|
+
*
|
|
7
|
+
* The `rich_text` field type requires optional peer deps: `lexical`, `@lexical/react`.
|
|
8
|
+
* If you don't need rich text, register fields selectively to avoid the dependency.
|
|
9
|
+
*/
|
|
2
10
|
export declare function registerDefaultFieldTypes(): void;
|
|
@@ -1,40 +1,31 @@
|
|
|
1
|
-
import { lazy as t, createElement as r, Suspense as l } from "react";
|
|
2
1
|
import { registerFieldType as e } from "./fieldRegistry.js";
|
|
3
|
-
import { SelectField as
|
|
4
|
-
import { ButtonsGroupField as
|
|
5
|
-
import { RadioField as
|
|
6
|
-
import { TextField as
|
|
7
|
-
import { TextAreaField as
|
|
8
|
-
import { DateRangeField as
|
|
9
|
-
import { DateInputField as
|
|
10
|
-
import { WeekRangeField as
|
|
11
|
-
import { MonthRangeField as
|
|
12
|
-
import { MultiWeekPickerField as
|
|
13
|
-
import { MultiMonthPickerField as
|
|
14
|
-
import { FileUploadField as
|
|
15
|
-
import { FillFormByPasteField as
|
|
16
|
-
import { FillFormByFileUploadField as
|
|
17
|
-
import { ChipsField as
|
|
18
|
-
import { TextFieldWithBackendValidation as
|
|
19
|
-
import { SwitchField as
|
|
20
|
-
import { CheckboxField as
|
|
21
|
-
import { LabelField as
|
|
22
|
-
import { DividerField as
|
|
23
|
-
import { DividerWithLabelField as
|
|
24
|
-
import { NumericComboboxField as
|
|
25
|
-
import { SliderRangeField as
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}))
|
|
30
|
-
);
|
|
31
|
-
let o = !1;
|
|
32
|
-
function ie() {
|
|
33
|
-
o || (o = !0, e("divider", w), e("divider_with_label", v), e("label", T), e("select", m), e("button_group", d), e("radio", p), e("text", a), e("numeric_combobox", D), e("text_area", f), e("date", n), e("date_range", F), e("week_range", _), e("multi_week_picker", u), e("month_range", c), e("multi_month_picker", h), e("file_upload", s), e("fill_form_by_paste", b), e("fill_form_by_file_upload", x), e("chips", k), e("text_with_backend_validation", g), e("switch", y), e("checkbox", R), e("slider_range", B), e(
|
|
34
|
-
"rich_text",
|
|
35
|
-
(i) => r(l, { fallback: null }, r(M, i))
|
|
36
|
-
));
|
|
2
|
+
import { SelectField as r } from "../Fields/SelectField.js";
|
|
3
|
+
import { ButtonsGroupField as o } from "../Fields/ButtonsGroupField.js";
|
|
4
|
+
import { RadioField as t } from "../Fields/RadioField.js";
|
|
5
|
+
import { TextField as l } from "../Fields/TextField.js";
|
|
6
|
+
import { TextAreaField as m } from "../Fields/TextAreaField.js";
|
|
7
|
+
import { DateRangeField as d } from "../Fields/DateRangeField.js";
|
|
8
|
+
import { DateInputField as p } from "../Fields/DateInputField.js";
|
|
9
|
+
import { WeekRangeField as a } from "../Fields/WeekRangePicker.js";
|
|
10
|
+
import { MonthRangeField as f } from "../Fields/MonthRangeField.js";
|
|
11
|
+
import { MultiWeekPickerField as F } from "../Fields/MultiWeekPickerField.js";
|
|
12
|
+
import { MultiMonthPickerField as _ } from "../Fields/MultiMonthPickerField.js";
|
|
13
|
+
import { FileUploadField as n } from "../Fields/FileUploadField.js";
|
|
14
|
+
import { FillFormByPasteField as c } from "../Fields/FillFormByPasteField.js";
|
|
15
|
+
import { FillFormByFileUploadField as u } from "../Fields/FillFormByFileUploadField.js";
|
|
16
|
+
import { ChipsField as b } from "../Fields/ChipsField.js";
|
|
17
|
+
import { TextFieldWithBackendValidation as h } from "../Fields/TextFieldWithBackendValidation.js";
|
|
18
|
+
import { SwitchField as s } from "../Fields/SwitchField.js";
|
|
19
|
+
import { CheckboxField as g } from "../Fields/CheckboxField.js";
|
|
20
|
+
import { LabelField as k } from "../Fields/LabelField.js";
|
|
21
|
+
import { DividerField as x } from "../Fields/DividerField.js";
|
|
22
|
+
import { DividerWithLabelField as w } from "../Fields/DividerWithLabelField.js";
|
|
23
|
+
import { NumericComboboxField as y } from "../Fields/NumericComboboxField.js";
|
|
24
|
+
import { SliderRangeField as v } from "../Fields/SliderRangeField.js";
|
|
25
|
+
let i = !1;
|
|
26
|
+
function Q() {
|
|
27
|
+
i || (i = !0, e("divider", x), e("divider_with_label", w), e("label", k), e("select", r), e("button_group", o), e("radio", t), e("text", l), e("numeric_combobox", y), e("text_area", m), e("date", p), e("date_range", d), e("week_range", a), e("multi_week_picker", F), e("month_range", f), e("multi_month_picker", _), e("file_upload", n), e("fill_form_by_paste", c), e("fill_form_by_file_upload", u), e("chips", b), e("text_with_backend_validation", h), e("switch", s), e("checkbox", g), e("slider_range", v));
|
|
37
28
|
}
|
|
38
29
|
export {
|
|
39
|
-
|
|
30
|
+
Q as registerDefaultFieldTypes
|
|
40
31
|
};
|
|
@@ -2,8 +2,9 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { FieldType } from '../types/fields.types';
|
|
3
3
|
import { CustomFieldTypesMap, FormFieldProps } from '../types/reactHookForm.types';
|
|
4
4
|
/**
|
|
5
|
-
* Renders a
|
|
6
|
-
*
|
|
5
|
+
* Renders a registered field. Looks up from instance overrides first, then
|
|
6
|
+
* the global field registry populated by `registerDefaultFieldTypes()` or
|
|
7
|
+
* individual `registerFieldType()` calls.
|
|
7
8
|
*/
|
|
8
9
|
export declare function renderRegisteredField(fieldType: FieldType | string, commonProps: FormFieldProps, instanceOverrides?: CustomFieldTypesMap): ReactNode;
|
|
9
10
|
/** @deprecated Use {@link renderRegisteredField} — returns element, not component type. */
|
|
@@ -1,137 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { ChipsField as _ } from "../Fields/ChipsField.js";
|
|
7
|
-
import { DateInputField as s } from "../Fields/DateInputField.js";
|
|
8
|
-
import { DateRangeField as f } from "../Fields/DateRangeField.js";
|
|
9
|
-
import { DividerField as o } from "../Fields/DividerField.js";
|
|
10
|
-
import { DividerWithLabelField as F } from "../Fields/DividerWithLabelField.js";
|
|
11
|
-
import { FileUploadField as m } from "../Fields/FileUploadField.js";
|
|
12
|
-
import { FillFormByFileUploadField as b } from "../Fields/FillFormByFileUploadField.js";
|
|
13
|
-
import { FillFormByPasteField as h } from "../Fields/FillFormByPasteField.js";
|
|
14
|
-
import { LabelField as p } from "../Fields/LabelField.js";
|
|
15
|
-
import { MonthRangeField as k } from "../Fields/MonthRangeField.js";
|
|
16
|
-
import { MultiMonthPickerField as x } from "../Fields/MultiMonthPickerField.js";
|
|
17
|
-
import { MultiWeekPickerField as g } from "../Fields/MultiWeekPickerField.js";
|
|
18
|
-
import { NumericComboboxField as w } from "../Fields/NumericComboboxField.js";
|
|
19
|
-
import { RadioField as v } from "../Fields/RadioField.js";
|
|
20
|
-
import { SelectField as C } from "../Fields/SelectField.js";
|
|
21
|
-
import { SwitchField as R } from "../Fields/SwitchField.js";
|
|
22
|
-
import { TextAreaField as B } from "../Fields/TextAreaField.js";
|
|
23
|
-
import { TextField as D } from "../Fields/TextField.js";
|
|
24
|
-
import { TextFieldWithBackendValidation as M } from "../Fields/TextFieldWithBackendValidation.js";
|
|
25
|
-
import { WeekRangeField as W } from "../Fields/WeekRangePicker.js";
|
|
26
|
-
function re(t, e, i) {
|
|
27
|
-
const a = i?.[t];
|
|
28
|
-
if (a)
|
|
29
|
-
return u(a, e);
|
|
30
|
-
switch (t) {
|
|
31
|
-
case "divider":
|
|
32
|
-
return /* @__PURE__ */ r(o, { ...e });
|
|
33
|
-
case "divider_with_label":
|
|
34
|
-
return /* @__PURE__ */ r(F, { ...e });
|
|
35
|
-
case "label":
|
|
36
|
-
return /* @__PURE__ */ r(p, { ...e });
|
|
37
|
-
case "select":
|
|
38
|
-
return /* @__PURE__ */ r(C, { ...e });
|
|
39
|
-
case "button_group":
|
|
40
|
-
return /* @__PURE__ */ r(c, { ...e });
|
|
41
|
-
case "radio":
|
|
42
|
-
return /* @__PURE__ */ r(v, { ...e });
|
|
43
|
-
case "text":
|
|
44
|
-
return /* @__PURE__ */ r(D, { ...e });
|
|
45
|
-
case "numeric_combobox":
|
|
46
|
-
return /* @__PURE__ */ r(w, { ...e });
|
|
47
|
-
case "text_area":
|
|
48
|
-
return /* @__PURE__ */ r(B, { ...e });
|
|
49
|
-
case "date":
|
|
50
|
-
return /* @__PURE__ */ r(s, { ...e });
|
|
51
|
-
case "date_range":
|
|
52
|
-
return /* @__PURE__ */ r(f, { ...e });
|
|
53
|
-
case "week_range":
|
|
54
|
-
return /* @__PURE__ */ r(W, { ...e });
|
|
55
|
-
case "multi_week_picker":
|
|
56
|
-
return /* @__PURE__ */ r(g, { ...e });
|
|
57
|
-
case "month_range":
|
|
58
|
-
return /* @__PURE__ */ r(k, { ...e });
|
|
59
|
-
case "multi_month_picker":
|
|
60
|
-
return /* @__PURE__ */ r(x, { ...e });
|
|
61
|
-
case "file_upload":
|
|
62
|
-
return /* @__PURE__ */ r(m, { ...e });
|
|
63
|
-
case "fill_form_by_paste":
|
|
64
|
-
return /* @__PURE__ */ r(h, { ...e });
|
|
65
|
-
case "fill_form_by_file_upload":
|
|
66
|
-
return /* @__PURE__ */ r(b, { ...e });
|
|
67
|
-
case "chips":
|
|
68
|
-
return /* @__PURE__ */ r(_, { ...e });
|
|
69
|
-
case "text_with_backend_validation":
|
|
70
|
-
return /* @__PURE__ */ r(M, { ...e });
|
|
71
|
-
case "switch":
|
|
72
|
-
return /* @__PURE__ */ r(R, { ...e });
|
|
73
|
-
case "checkbox":
|
|
74
|
-
return /* @__PURE__ */ r(d, { ...e });
|
|
75
|
-
default: {
|
|
76
|
-
const l = n(t);
|
|
77
|
-
return l ? u(l, e) : null;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
1
|
+
import { createElement as m } from "react";
|
|
2
|
+
import { getFieldComponent as t } from "./fieldRegistry.js";
|
|
3
|
+
function l(e, n, r) {
|
|
4
|
+
const o = r?.[e] ?? t(e);
|
|
5
|
+
return o ? m(o, n) : null;
|
|
80
6
|
}
|
|
81
|
-
function
|
|
82
|
-
|
|
83
|
-
if (i)
|
|
84
|
-
return i;
|
|
85
|
-
switch (t) {
|
|
86
|
-
case "divider":
|
|
87
|
-
return o;
|
|
88
|
-
case "divider_with_label":
|
|
89
|
-
return F;
|
|
90
|
-
case "label":
|
|
91
|
-
return p;
|
|
92
|
-
case "select":
|
|
93
|
-
return C;
|
|
94
|
-
case "button_group":
|
|
95
|
-
return c;
|
|
96
|
-
case "radio":
|
|
97
|
-
return v;
|
|
98
|
-
case "text":
|
|
99
|
-
return D;
|
|
100
|
-
case "numeric_combobox":
|
|
101
|
-
return w;
|
|
102
|
-
case "text_area":
|
|
103
|
-
return B;
|
|
104
|
-
case "date":
|
|
105
|
-
return s;
|
|
106
|
-
case "date_range":
|
|
107
|
-
return f;
|
|
108
|
-
case "week_range":
|
|
109
|
-
return W;
|
|
110
|
-
case "multi_week_picker":
|
|
111
|
-
return g;
|
|
112
|
-
case "month_range":
|
|
113
|
-
return k;
|
|
114
|
-
case "multi_month_picker":
|
|
115
|
-
return x;
|
|
116
|
-
case "file_upload":
|
|
117
|
-
return m;
|
|
118
|
-
case "fill_form_by_paste":
|
|
119
|
-
return h;
|
|
120
|
-
case "fill_form_by_file_upload":
|
|
121
|
-
return b;
|
|
122
|
-
case "chips":
|
|
123
|
-
return _;
|
|
124
|
-
case "text_with_backend_validation":
|
|
125
|
-
return M;
|
|
126
|
-
case "switch":
|
|
127
|
-
return R;
|
|
128
|
-
case "checkbox":
|
|
129
|
-
return d;
|
|
130
|
-
default:
|
|
131
|
-
return n(t);
|
|
132
|
-
}
|
|
7
|
+
function u(e, n) {
|
|
8
|
+
return n?.[e] ?? t(e);
|
|
133
9
|
}
|
|
134
10
|
export {
|
|
135
|
-
|
|
136
|
-
|
|
11
|
+
l as renderRegisteredField,
|
|
12
|
+
u as resolveFieldComponent
|
|
137
13
|
};
|