impact-nova 2.2.9 → 2.4.0
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/headers/utils/filter-utils.js +9 -9
- package/dist/components/data-display/calendar/calendar-day-picker-components.js +69 -56
- package/dist/components/data-display/calendar/calendar-padding-week.utils.d.ts +5 -0
- package/dist/components/data-display/calendar/calendar-padding-week.utils.js +6 -0
- package/dist/components/data-display/calendar/calendar.types.d.ts +1 -1
- package/dist/components/forms/combobox/combobox.js +185 -160
- package/dist/components/forms/combobox/combobox.types.d.ts +2 -0
- package/dist/filter-shell/index.d.ts +12 -0
- package/dist/filter-shell/index.js +9 -0
- package/dist/filter-shell/utils/buildFilterFieldValidationRules.d.ts +1 -0
- package/dist/filter-shell/utils/validateVisibleRequiredFilterFields.d.ts +1 -0
- package/dist/filter-shell/utils/validationNavigation.utils.d.ts +26 -0
- package/dist/filter-shell/utils/validationNavigation.utils.js +38 -0
- package/dist/form-engine/field-dependency-graph.d.ts +17 -0
- package/dist/form-engine/field-dependency-graph.js +90 -0
- package/dist/form-engine/index.d.ts +9 -0
- package/dist/form-engine/index.js +16 -0
- package/dist/form-engine/is-empty-value.d.ts +1 -0
- package/dist/form-engine/is-empty-value.js +8 -0
- package/dist/form-engine/types.d.ts +17 -0
- package/dist/form-react/Fields/ButtonsGroupField.d.ts +3 -0
- package/dist/form-react/Fields/ButtonsGroupField.js +52 -0
- package/dist/form-react/Fields/CheckboxField.d.ts +3 -0
- package/dist/form-react/Fields/CheckboxField.js +46 -0
- package/dist/form-react/Fields/ChipsField.d.ts +3 -0
- package/dist/form-react/Fields/ChipsField.js +146 -0
- package/dist/form-react/Fields/DateInputField.d.ts +8 -0
- package/dist/form-react/Fields/DateInputField.js +134 -0
- package/dist/form-react/Fields/DateRangeField.d.ts +8 -0
- package/dist/form-react/Fields/DateRangeField.js +57 -0
- package/dist/form-react/Fields/DividerField.d.ts +3 -0
- package/dist/form-react/Fields/DividerField.js +9 -0
- package/dist/form-react/Fields/DividerWithLabelField.d.ts +3 -0
- package/dist/form-react/Fields/DividerWithLabelField.js +31 -0
- package/dist/form-react/Fields/FileUploadField.d.ts +3 -0
- package/dist/form-react/Fields/FileUploadField.js +42 -0
- package/dist/form-react/Fields/FillFormByFileUploadField.d.ts +3 -0
- package/dist/form-react/Fields/FillFormByFileUploadField.js +65 -0
- package/dist/form-react/Fields/FillFormByPasteField.d.ts +3 -0
- package/dist/form-react/Fields/FillFormByPasteField.js +106 -0
- package/dist/form-react/Fields/LabelField.d.ts +3 -0
- package/dist/form-react/Fields/LabelField.js +14 -0
- package/dist/form-react/Fields/MonthRangeField.d.ts +8 -0
- package/dist/form-react/Fields/MonthRangeField.js +72 -0
- package/dist/form-react/Fields/MultiMonthPickerField.d.ts +8 -0
- package/dist/form-react/Fields/MultiMonthPickerField.js +46 -0
- package/dist/form-react/Fields/MultiWeekPickerField.d.ts +8 -0
- package/dist/form-react/Fields/MultiWeekPickerField.js +47 -0
- package/dist/form-react/Fields/NumericComboboxField.d.ts +18 -0
- package/dist/form-react/Fields/NumericComboboxField.js +51 -0
- package/dist/form-react/Fields/RadioField.d.ts +3 -0
- package/dist/form-react/Fields/RadioField.js +68 -0
- package/dist/form-react/Fields/SelectField.d.ts +3 -0
- package/dist/form-react/Fields/SelectField.js +76 -0
- package/dist/form-react/Fields/SwitchField.d.ts +3 -0
- package/dist/form-react/Fields/SwitchField.js +47 -0
- package/dist/form-react/Fields/TextAreaField.d.ts +3 -0
- package/dist/form-react/Fields/TextAreaField.js +41 -0
- package/dist/form-react/Fields/TextField.d.ts +3 -0
- package/dist/form-react/Fields/TextField.js +75 -0
- package/dist/form-react/Fields/TextFieldWithBackendValidation.d.ts +3 -0
- package/dist/form-react/Fields/TextFieldWithBackendValidation.js +117 -0
- package/dist/form-react/Fields/WeekRangePicker.d.ts +8 -0
- package/dist/form-react/Fields/WeekRangePicker.js +71 -0
- package/dist/form-react/ReactHooksForm.d.ts +3 -0
- package/dist/form-react/ReactHooksForm.js +132 -0
- package/dist/form-react/components/ArrayFieldRenderer.d.ts +13 -0
- package/dist/form-react/components/ArrayFieldRenderer.js +90 -0
- package/dist/form-react/components/FieldRenderer.d.ts +16 -0
- package/dist/form-react/components/FieldRenderer.js +68 -0
- package/dist/form-react/components/FormFieldRow.d.ts +13 -0
- package/dist/form-react/components/FormFieldRow.js +47 -0
- package/dist/form-react/components/FormFileUploadWrapper.d.ts +22 -0
- package/dist/form-react/components/FormFileUploadWrapper.js +88 -0
- package/dist/form-react/components/ObjectFieldRenderer.d.ts +13 -0
- package/dist/form-react/components/ObjectFieldRenderer.js +46 -0
- package/dist/form-react/components/SetToEmptyWrapper.d.ts +16 -0
- package/dist/form-react/components/SetToEmptyWrapper.js +49 -0
- package/dist/form-react/fields.d.ts +23 -0
- package/dist/form-react/fields.js +40 -0
- package/dist/form-react/hooks/useCascadingForm.d.ts +17 -0
- package/dist/form-react/hooks/useCascadingForm.js +122 -0
- package/dist/form-react/hooks/useFieldVisibility.d.ts +14 -0
- package/dist/form-react/hooks/useFieldVisibility.js +60 -0
- package/dist/form-react/hooks/useFillFormByFileUpload.d.ts +33 -0
- package/dist/form-react/hooks/useFillFormByFileUpload.js +199 -0
- package/dist/form-react/hooks/useFillFormByPaste.d.ts +33 -0
- package/dist/form-react/hooks/useFillFormByPaste.js +104 -0
- package/dist/form-react/hooks/useFormFieldChangeSubscription.d.ts +13 -0
- package/dist/form-react/hooks/useFormFieldChangeSubscription.js +42 -0
- package/dist/form-react/hooks/useReactHookForm.d.ts +3 -0
- package/dist/form-react/hooks/useReactHookForm.js +161 -0
- package/dist/form-react/hooks/useSelectOptions.d.ts +8 -0
- package/dist/form-react/hooks/useSelectOptions.js +116 -0
- package/dist/form-react/index.d.ts +62 -0
- package/dist/form-react/index.js +97 -0
- package/dist/form-react/registry/defaultFieldRegistrations.d.ts +2 -0
- package/dist/form-react/registry/defaultFieldRegistrations.js +30 -0
- package/dist/form-react/registry/fieldRegistry.d.ts +14 -0
- package/dist/form-react/registry/fieldRegistry.js +19 -0
- package/dist/form-react/registry/resolveFieldComponent.d.ts +10 -0
- package/dist/form-react/registry/resolveFieldComponent.js +137 -0
- package/dist/form-react/types/fields.types.d.ts +402 -0
- package/dist/form-react/types/fieldsOutput.types.d.ts +73 -0
- package/dist/form-react/types/reactHookForm.types.d.ts +196 -0
- package/dist/form-react/utils/batchFormFieldUpdates.d.ts +14 -0
- package/dist/form-react/utils/batchFormFieldUpdates.js +13 -0
- package/dist/form-react/utils/buildFieldValidationRules.d.ts +6 -0
- package/dist/form-react/utils/buildFieldValidationRules.js +13 -0
- package/dist/form-react/utils/buildSelectRemountKey.d.ts +14 -0
- package/dist/form-react/utils/buildSelectRemountKey.js +14 -0
- package/dist/form-react/utils/calendar-boundary.d.ts +3 -0
- package/dist/form-react/utils/calendar-boundary.js +33 -0
- package/dist/form-react/utils/date.utils.d.ts +31 -0
- package/dist/form-react/utils/date.utils.js +86 -0
- package/dist/form-react/utils/evaluateFieldValidation.d.ts +19 -0
- package/dist/form-react/utils/evaluateFieldValidation.js +53 -0
- package/dist/form-react/utils/fieldDefaults.utils.d.ts +6 -0
- package/dist/form-react/utils/fieldDefaults.utils.js +25 -0
- package/dist/form-react/utils/fieldPath.utils.d.ts +23 -0
- package/dist/form-react/utils/fieldPath.utils.js +26 -0
- package/dist/form-react/utils/fieldRangeValidation.utils.d.ts +3 -0
- package/dist/form-react/utils/fieldRangeValidation.utils.js +24 -0
- package/dist/form-react/utils/fieldRendererUtils.d.ts +10 -0
- package/dist/form-react/utils/fieldRendererUtils.js +47 -0
- package/dist/form-react/utils/fieldTestIds.d.ts +3 -0
- package/dist/form-react/utils/fieldTestIds.js +13 -0
- package/dist/form-react/utils/formDate.utils.d.ts +13 -0
- package/dist/form-react/utils/formDate.utils.js +9 -0
- package/dist/form-react/utils/formValidationFeedback.utils.d.ts +32 -0
- package/dist/form-react/utils/formValidationFeedback.utils.js +153 -0
- package/dist/form-react/utils/icons.d.ts +5 -0
- package/dist/form-react/utils/icons.js +10 -0
- package/dist/form-react/utils/optionFlag.d.ts +11 -0
- package/dist/form-react/utils/optionFlag.js +17 -0
- package/dist/form-react/utils/pastedValues.d.ts +1 -0
- package/dist/form-react/utils/resolveFormSubmittable.d.ts +18 -0
- package/dist/form-react/utils/resolveFormSubmittable.js +32 -0
- package/dist/form-react/utils/select-option-filter-values.d.ts +5 -0
- package/dist/form-react/utils/select-option-filter-values.js +30 -0
- package/dist/form-react/utils/serializeFormStateForQueryKey.d.ts +1 -0
- package/dist/form-react/utils/serializeFormStateForQueryKey.js +21 -0
- package/dist/form-react/utils/stableSerialize.d.ts +5 -0
- package/dist/form-react/utils/stableSerialize.js +11 -0
- package/dist/form-react/utils/validateVisibleRequiredFormFields.d.ts +21 -0
- package/dist/form-react/utils/validateVisibleRequiredFormFields.js +64 -0
- package/dist/form-react/utils/validationUtils.d.ts +3 -0
- package/dist/form-react/utils/validationUtils.js +77 -0
- package/dist/impact-nova.css +1 -1
- package/dist/lib/primitives/use-field-chrome.js +16 -16
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/real-world-patterns.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- package/package.json +21 -2
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { useMemo as V, useState as v, useRef as l, useEffect as N, useCallback as P } from "react";
|
|
2
|
+
import { useWatch as j } from "react-hook-form";
|
|
3
|
+
import { serializeFormStateForQueryKey as q } from "../utils/serializeFormStateForQueryKey.js";
|
|
4
|
+
const X = ({
|
|
5
|
+
apiConfig: t,
|
|
6
|
+
formHelpers: o,
|
|
7
|
+
formConfig: k,
|
|
8
|
+
initialOptions: d = [],
|
|
9
|
+
id: r,
|
|
10
|
+
isEnabled: D,
|
|
11
|
+
getSelectOptionsName: i,
|
|
12
|
+
fieldSupportedValues: u
|
|
13
|
+
}) => {
|
|
14
|
+
const h = !!(k?.isCascading || t?.isCascading), p = o?.getEarlierFieldsIds, E = o?.form.getValues, y = j({
|
|
15
|
+
control: o?.form.control,
|
|
16
|
+
name: t?.cascadeFromFields ?? [],
|
|
17
|
+
disabled: !h || !o?.form.control || !t?.cascadeFromFields?.length
|
|
18
|
+
}), f = V(() => {
|
|
19
|
+
if (!h || !p || !E)
|
|
20
|
+
return {};
|
|
21
|
+
const e = {};
|
|
22
|
+
if (t?.cascadeFromFields && t.cascadeFromFields.length > 0) {
|
|
23
|
+
const c = Array.isArray(y) ? y : [];
|
|
24
|
+
return t.cascadeFromFields.forEach((s, m) => {
|
|
25
|
+
const a = c[m];
|
|
26
|
+
a != null && a !== "" && (e[s] = a);
|
|
27
|
+
}), e;
|
|
28
|
+
}
|
|
29
|
+
const n = E(), O = t?.includeOnlyMandatoryFieldsInPayload || !1;
|
|
30
|
+
return p(r, O).forEach((c) => {
|
|
31
|
+
const s = n[c];
|
|
32
|
+
s != null && s !== "" && (e[c] = s);
|
|
33
|
+
}), e;
|
|
34
|
+
}, [
|
|
35
|
+
t,
|
|
36
|
+
h,
|
|
37
|
+
y,
|
|
38
|
+
p,
|
|
39
|
+
E,
|
|
40
|
+
r
|
|
41
|
+
]), G = V(
|
|
42
|
+
() => q(f),
|
|
43
|
+
[f]
|
|
44
|
+
), J = V(
|
|
45
|
+
() => u ? JSON.stringify(u) : "",
|
|
46
|
+
[u]
|
|
47
|
+
), [S, w] = v(d), [K, x] = v(!1), [Q, I] = v(null), R = l(o), g = l(t), b = l(f), C = l(u), z = l(d), A = l(i);
|
|
48
|
+
N(() => {
|
|
49
|
+
R.current = o, g.current = t, b.current = f, C.current = u, z.current = d, A.current = i;
|
|
50
|
+
});
|
|
51
|
+
const F = P(async () => {
|
|
52
|
+
const e = R.current, n = g.current, O = b.current, L = C.current, c = z.current, s = A.current;
|
|
53
|
+
if (e) {
|
|
54
|
+
const a = s ? e.formContext?.getSelectOptions?.[s] : void 0;
|
|
55
|
+
if (a)
|
|
56
|
+
return await a({
|
|
57
|
+
formHelpers: e,
|
|
58
|
+
fieldId: r,
|
|
59
|
+
newValue: e.form.getValues(r),
|
|
60
|
+
oldValue: e.getPreviousFieldValue(r)
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (!n?.apiEndpoint)
|
|
64
|
+
return c;
|
|
65
|
+
const m = e?.formContext?.transport?.fetchSelectOptions;
|
|
66
|
+
return m ? m({
|
|
67
|
+
fieldId: r,
|
|
68
|
+
apiConfig: n,
|
|
69
|
+
earlierFieldsValues: O,
|
|
70
|
+
fieldSupportedValues: L
|
|
71
|
+
}) : (process.env.NODE_ENV !== "production" && console.warn(
|
|
72
|
+
`[form-react] Select field "${r}" has apiConfig but no formContext.transport.fetchSelectOptions was provided.`
|
|
73
|
+
), c);
|
|
74
|
+
}, [r]), W = !!(i && o?.formContext?.getSelectOptions?.[i]), M = D && (W || !!t?.apiEndpoint && !!o?.formContext?.transport?.fetchSelectOptions), _ = t?.apiEndpoint;
|
|
75
|
+
N(() => {
|
|
76
|
+
if (!M)
|
|
77
|
+
return;
|
|
78
|
+
let e = !1;
|
|
79
|
+
return (async () => {
|
|
80
|
+
x(!0), I(null);
|
|
81
|
+
try {
|
|
82
|
+
const n = await F();
|
|
83
|
+
e || w(n);
|
|
84
|
+
} catch (n) {
|
|
85
|
+
e || I(
|
|
86
|
+
n instanceof Error ? n : new Error("Failed to fetch options")
|
|
87
|
+
);
|
|
88
|
+
} finally {
|
|
89
|
+
e || x(!1);
|
|
90
|
+
}
|
|
91
|
+
})(), () => {
|
|
92
|
+
e = !0;
|
|
93
|
+
};
|
|
94
|
+
}, [
|
|
95
|
+
M,
|
|
96
|
+
F,
|
|
97
|
+
G,
|
|
98
|
+
J,
|
|
99
|
+
i,
|
|
100
|
+
_,
|
|
101
|
+
r
|
|
102
|
+
]);
|
|
103
|
+
const $ = P(async () => {
|
|
104
|
+
const e = await F();
|
|
105
|
+
return w(e), e;
|
|
106
|
+
}, [F]);
|
|
107
|
+
return {
|
|
108
|
+
options: S.length > 0 ? S : d,
|
|
109
|
+
isLoading: K,
|
|
110
|
+
error: Q,
|
|
111
|
+
refetch: $
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
export {
|
|
115
|
+
X as useSelectOptions
|
|
116
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Impact Nova — dynamic form framework (React adapter).
|
|
3
|
+
*
|
|
4
|
+
* Layers:
|
|
5
|
+
* - `impact-nova/form-engine` — headless dependency graph (no React, no I/O)
|
|
6
|
+
* - `impact-nova/form-react` — field registry, RHF integration, field components
|
|
7
|
+
* - `impact-nova/filter-shell` — optional filter validation helpers
|
|
8
|
+
*
|
|
9
|
+
* Network I/O is never performed here. Host apps inject `formContext.transport`.
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
export { ReactHooksForm } from './ReactHooksForm';
|
|
14
|
+
export type { ReactHooksFormRef } from './types/reactHookForm.types';
|
|
15
|
+
export { useReactHookForm } from './hooks/useReactHookForm';
|
|
16
|
+
export type { ReactHookFormState, UseReactHookFormReturn, } from './types/reactHookForm.types';
|
|
17
|
+
export { useFieldVisibility } from './hooks/useFieldVisibility';
|
|
18
|
+
export type { UseFieldVisibilityReturn } from './hooks/useFieldVisibility';
|
|
19
|
+
export { useCascadingForm } from './hooks/useCascadingForm';
|
|
20
|
+
export type { UseCascadingFormReturn } from './hooks/useCascadingForm';
|
|
21
|
+
export { useSelectOptions } from './hooks/useSelectOptions';
|
|
22
|
+
export { useFillFormByPaste } from './hooks/useFillFormByPaste';
|
|
23
|
+
export { useFillFormByFileUpload } from './hooks/useFillFormByFileUpload';
|
|
24
|
+
export type { FillFormByFileUploadSupportedValues } from './hooks/useFillFormByFileUpload';
|
|
25
|
+
export { FieldRenderer } from './components/FieldRenderer';
|
|
26
|
+
export type { FieldRendererProps,
|
|
27
|
+
/** @deprecated Use FieldRendererProps */
|
|
28
|
+
FilterFieldComponentProps, } from './components/FieldRenderer';
|
|
29
|
+
export { FormFieldRow } from './components/FormFieldRow';
|
|
30
|
+
export { ObjectFieldRenderer } from './components/ObjectFieldRenderer';
|
|
31
|
+
export { ArrayFieldRenderer } from './components/ArrayFieldRenderer';
|
|
32
|
+
export { SetToEmptyWrapper } from './components/SetToEmptyWrapper';
|
|
33
|
+
export { FormFileUploadWrapper } from './components/FormFileUploadWrapper';
|
|
34
|
+
export { registerFieldType, getFieldComponent, hasRegisteredFieldType, listRegisteredFieldTypes, } from './registry/fieldRegistry';
|
|
35
|
+
export { registerDefaultFieldTypes } from './registry/defaultFieldRegistrations';
|
|
36
|
+
export { resolveFieldComponent, renderRegisteredField } from './registry/resolveFieldComponent';
|
|
37
|
+
export type { IFormConfig, FormFieldProps, FieldVisibilityBase, ReactHooksFormProps, UseSelectOptionsProps, FormContext, FormValidationMeta, FormTransport, CustomFieldTypesMap, FetchSelectOptionsParams, PastedValuesValidationResult, ValidatePastedValuesParams, ValidateUploadedFileParams, UploadedFileValidationResult, ValidateTextFieldWithBackendParams, TextFieldBackendValidationResult, SupportedValuesMap, } from './types/reactHookForm.types';
|
|
38
|
+
export type { IField } from './types/fields.types';
|
|
39
|
+
export type * from './types/fields.types';
|
|
40
|
+
export type * from './types/fieldsOutput.types';
|
|
41
|
+
export { isEmptyValue, buildCascadeParentFormState, collectFieldDependencyIds, collectFormWatchFieldIds, collectFilterSidebarWatchFieldIds, collectSectionWatchFieldIds, collectVisibleFieldIds, computeIsCascadingDisabled, computeIsFieldDisabled, computeIsFieldVisible, getDependentFieldIds, hasVisibleFieldErrors, } from '../form-engine';
|
|
42
|
+
export type { FieldDependency, FormValuesSnapshot, } from '../form-engine';
|
|
43
|
+
export { getFieldDefaultValue } from './utils/fieldDefaults.utils';
|
|
44
|
+
export { batchSetFormFieldValues } from './utils/batchFormFieldUpdates';
|
|
45
|
+
export { serializeFormStateForQueryKey } from './utils/serializeFormStateForQueryKey';
|
|
46
|
+
export { buildFormValidationToastMessage, focusFirstFormValidationError, showFormValidationFailureFeedback, } from './utils/formValidationFeedback.utils';
|
|
47
|
+
export { buildFieldValidationRules, isFieldValueValid, buildRangeIncompleteMessage, isRangeIncompleteValidationMessage, } from './utils/buildFieldValidationRules';
|
|
48
|
+
export type { EvaluateFieldValidationOptions, FieldValidationShape, } from './utils/evaluateFieldValidation';
|
|
49
|
+
export { evaluateFieldValidation, fieldNeedsValidationRules, buildEvaluateFieldValidationOptions, } from './utils/evaluateFieldValidation';
|
|
50
|
+
export { validateVisibleRequiredFormFields } from './utils/validateVisibleRequiredFormFields';
|
|
51
|
+
export type { FormValidationValues, ValidateVisibleRequiredFormFieldsResult, } from './utils/validateVisibleRequiredFormFields';
|
|
52
|
+
export { evaluateVisibleRequiredFormFields, } from './utils/validateVisibleRequiredFormFields';
|
|
53
|
+
export { resolveFormSubmittable } from './utils/resolveFormSubmittable';
|
|
54
|
+
export type { BuildFormValidationToastMessageOptions, FormValidationToastMessage, } from './utils/formValidationFeedback.utils';
|
|
55
|
+
export { buildSelectRemountKey, buildParentCascadeKey } from './utils/buildSelectRemountKey';
|
|
56
|
+
export { runFieldValidation } from './utils/validationUtils';
|
|
57
|
+
export { buildFieldPath, flattenFieldIds, findFieldByPath, } from './utils/fieldPath.utils';
|
|
58
|
+
export { stableSerialize } from './utils/stableSerialize';
|
|
59
|
+
export { toCascadedFilterValues } from './utils/select-option-filter-values';
|
|
60
|
+
export { formatYmd, toLocalDate } from './utils/calendar-boundary';
|
|
61
|
+
export { handleDateFnsFormat, startOfDayDate, } from './utils/date.utils';
|
|
62
|
+
export { ReactHooksForm as default } from './ReactHooksForm';
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { ReactHooksForm as r, ReactHooksForm as t } from "./ReactHooksForm.js";
|
|
2
|
+
import { useReactHookForm as l } from "./hooks/useReactHookForm.js";
|
|
3
|
+
import { useFieldVisibility as d } from "./hooks/useFieldVisibility.js";
|
|
4
|
+
import { useCascadingForm as m } from "./hooks/useCascadingForm.js";
|
|
5
|
+
import { useSelectOptions as p } from "./hooks/useSelectOptions.js";
|
|
6
|
+
import { useFillFormByPaste as n } from "./hooks/useFillFormByPaste.js";
|
|
7
|
+
import { useFillFormByFileUpload as c } from "./hooks/useFillFormByFileUpload.js";
|
|
8
|
+
import { FieldRenderer as b } from "./components/FieldRenderer.js";
|
|
9
|
+
import { FormFieldRow as y } from "./components/FormFieldRow.js";
|
|
10
|
+
import { ObjectFieldRenderer as g } from "./components/ObjectFieldRenderer.js";
|
|
11
|
+
import { ArrayFieldRenderer as h } from "./components/ArrayFieldRenderer.js";
|
|
12
|
+
import { SetToEmptyWrapper as S } from "./components/SetToEmptyWrapper.js";
|
|
13
|
+
import { FormFileUploadWrapper as v } from "./components/FormFileUploadWrapper.js";
|
|
14
|
+
import { getFieldComponent as E, hasRegisteredFieldType as P, listRegisteredFieldTypes as W, registerFieldType as k } from "./registry/fieldRegistry.js";
|
|
15
|
+
import { registerDefaultFieldTypes as B } from "./registry/defaultFieldRegistrations.js";
|
|
16
|
+
import { renderRegisteredField as K, resolveFieldComponent as M } from "./registry/resolveFieldComponent.js";
|
|
17
|
+
import { isEmptyValue as w } from "../form-engine/is-empty-value.js";
|
|
18
|
+
import { buildCascadeParentFormState as U, collectFieldDependencyIds as j, collectFilterSidebarWatchFieldIds as A, collectFormWatchFieldIds as L, collectSectionWatchFieldIds as N, collectVisibleFieldIds as Q, computeIsCascadingDisabled as Y, computeIsFieldDisabled as G, computeIsFieldVisible as J, getDependentFieldIds as X, hasVisibleFieldErrors as Z } from "../form-engine/field-dependency-graph.js";
|
|
19
|
+
import { getFieldDefaultValue as $ } from "./utils/fieldDefaults.utils.js";
|
|
20
|
+
import { batchSetFormFieldValues as oe } from "./utils/batchFormFieldUpdates.js";
|
|
21
|
+
import { serializeFormStateForQueryKey as te } from "./utils/serializeFormStateForQueryKey.js";
|
|
22
|
+
import { buildFormValidationToastMessage as le, focusFirstFormValidationError as ae, showFormValidationFailureFeedback as de } from "./utils/formValidationFeedback.utils.js";
|
|
23
|
+
import { buildFieldValidationRules as me, isFieldValueValid as Fe } from "./utils/buildFieldValidationRules.js";
|
|
24
|
+
import { buildEvaluateFieldValidationOptions as fe, evaluateFieldValidation as ne, fieldNeedsValidationRules as ue } from "./utils/evaluateFieldValidation.js";
|
|
25
|
+
import { evaluateVisibleRequiredFormFields as xe, validateVisibleRequiredFormFields as be } from "./utils/validateVisibleRequiredFormFields.js";
|
|
26
|
+
import { resolveFormSubmittable as ye } from "./utils/resolveFormSubmittable.js";
|
|
27
|
+
import { buildParentCascadeKey as ge, buildSelectRemountKey as Ie } from "./utils/buildSelectRemountKey.js";
|
|
28
|
+
import { runFieldValidation as De } from "./utils/validationUtils.js";
|
|
29
|
+
import { buildFieldPath as Ce, findFieldByPath as ve, flattenFieldIds as Te } from "./utils/fieldPath.utils.js";
|
|
30
|
+
import { stableSerialize as Pe } from "./utils/stableSerialize.js";
|
|
31
|
+
import { toCascadedFilterValues as ke } from "./utils/select-option-filter-values.js";
|
|
32
|
+
import { formatYmd as Be, toLocalDate as He } from "./utils/calendar-boundary.js";
|
|
33
|
+
import { handleDateFnsFormat as Me, startOfDayDate as qe } from "./utils/date.utils.js";
|
|
34
|
+
import { buildRangeIncompleteMessage as ze, isRangeIncompleteValidationMessage as Ue } from "./utils/fieldRangeValidation.utils.js";
|
|
35
|
+
export {
|
|
36
|
+
h as ArrayFieldRenderer,
|
|
37
|
+
b as FieldRenderer,
|
|
38
|
+
y as FormFieldRow,
|
|
39
|
+
v as FormFileUploadWrapper,
|
|
40
|
+
g as ObjectFieldRenderer,
|
|
41
|
+
r as ReactHooksForm,
|
|
42
|
+
S as SetToEmptyWrapper,
|
|
43
|
+
oe as batchSetFormFieldValues,
|
|
44
|
+
U as buildCascadeParentFormState,
|
|
45
|
+
fe as buildEvaluateFieldValidationOptions,
|
|
46
|
+
Ce as buildFieldPath,
|
|
47
|
+
me as buildFieldValidationRules,
|
|
48
|
+
le as buildFormValidationToastMessage,
|
|
49
|
+
ge as buildParentCascadeKey,
|
|
50
|
+
ze as buildRangeIncompleteMessage,
|
|
51
|
+
Ie as buildSelectRemountKey,
|
|
52
|
+
j as collectFieldDependencyIds,
|
|
53
|
+
A as collectFilterSidebarWatchFieldIds,
|
|
54
|
+
L as collectFormWatchFieldIds,
|
|
55
|
+
N as collectSectionWatchFieldIds,
|
|
56
|
+
Q as collectVisibleFieldIds,
|
|
57
|
+
Y as computeIsCascadingDisabled,
|
|
58
|
+
G as computeIsFieldDisabled,
|
|
59
|
+
J as computeIsFieldVisible,
|
|
60
|
+
t as default,
|
|
61
|
+
ne as evaluateFieldValidation,
|
|
62
|
+
xe as evaluateVisibleRequiredFormFields,
|
|
63
|
+
ue as fieldNeedsValidationRules,
|
|
64
|
+
ve as findFieldByPath,
|
|
65
|
+
Te as flattenFieldIds,
|
|
66
|
+
ae as focusFirstFormValidationError,
|
|
67
|
+
Be as formatYmd,
|
|
68
|
+
X as getDependentFieldIds,
|
|
69
|
+
E as getFieldComponent,
|
|
70
|
+
$ as getFieldDefaultValue,
|
|
71
|
+
Me as handleDateFnsFormat,
|
|
72
|
+
P as hasRegisteredFieldType,
|
|
73
|
+
Z as hasVisibleFieldErrors,
|
|
74
|
+
w as isEmptyValue,
|
|
75
|
+
Fe as isFieldValueValid,
|
|
76
|
+
Ue as isRangeIncompleteValidationMessage,
|
|
77
|
+
W as listRegisteredFieldTypes,
|
|
78
|
+
B as registerDefaultFieldTypes,
|
|
79
|
+
k as registerFieldType,
|
|
80
|
+
K as renderRegisteredField,
|
|
81
|
+
M as resolveFieldComponent,
|
|
82
|
+
ye as resolveFormSubmittable,
|
|
83
|
+
De as runFieldValidation,
|
|
84
|
+
te as serializeFormStateForQueryKey,
|
|
85
|
+
de as showFormValidationFailureFeedback,
|
|
86
|
+
Pe as stableSerialize,
|
|
87
|
+
qe as startOfDayDate,
|
|
88
|
+
ke as toCascadedFilterValues,
|
|
89
|
+
He as toLocalDate,
|
|
90
|
+
m as useCascadingForm,
|
|
91
|
+
d as useFieldVisibility,
|
|
92
|
+
c as useFillFormByFileUpload,
|
|
93
|
+
n as useFillFormByPaste,
|
|
94
|
+
l as useReactHookForm,
|
|
95
|
+
p as useSelectOptions,
|
|
96
|
+
be as validateVisibleRequiredFormFields
|
|
97
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { registerFieldType as e } from "./fieldRegistry.js";
|
|
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 m } from "../Fields/TextField.js";
|
|
6
|
+
import { TextAreaField as l } 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 k } from "../Fields/SwitchField.js";
|
|
19
|
+
import { CheckboxField as s } from "../Fields/CheckboxField.js";
|
|
20
|
+
import { LabelField as x } from "../Fields/LabelField.js";
|
|
21
|
+
import { DividerField as g } from "../Fields/DividerField.js";
|
|
22
|
+
import { DividerWithLabelField as w } from "../Fields/DividerWithLabelField.js";
|
|
23
|
+
import { NumericComboboxField as y } from "../Fields/NumericComboboxField.js";
|
|
24
|
+
let i = !1;
|
|
25
|
+
function K() {
|
|
26
|
+
i || (i = !0, e("divider", g), e("divider_with_label", w), e("label", x), e("select", r), e("button_group", o), e("radio", t), e("text", m), e("numeric_combobox", y), e("text_area", l), 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", k), e("checkbox", s));
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
K as registerDefaultFieldTypes
|
|
30
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { FieldType } from '../types/fields.types';
|
|
3
|
+
import { CustomFieldTypesMap, FormFieldProps } from '../types/reactHookForm.types';
|
|
4
|
+
/** Register a field component for a `fieldType` (call at app startup or per module). */
|
|
5
|
+
export declare function registerFieldType(fieldType: FieldType | string, component: ComponentType<FormFieldProps>): void;
|
|
6
|
+
/** Returns whether a field type is registered globally. */
|
|
7
|
+
export declare function hasRegisteredFieldType(fieldType: string): boolean;
|
|
8
|
+
/** Lists globally registered field type keys (stable sort for tests and tooling). */
|
|
9
|
+
export declare function listRegisteredFieldTypes(): string[];
|
|
10
|
+
/**
|
|
11
|
+
* Look up a field component by type.
|
|
12
|
+
* Instance overrides (`formContext.customFieldTypes`) take precedence.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getFieldComponent(fieldType: FieldType | string, instanceOverrides?: CustomFieldTypesMap): ComponentType<FormFieldProps> | undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const t = /* @__PURE__ */ new Map();
|
|
2
|
+
function n(e, r) {
|
|
3
|
+
t.set(e, r);
|
|
4
|
+
}
|
|
5
|
+
function i(e) {
|
|
6
|
+
return t.has(e);
|
|
7
|
+
}
|
|
8
|
+
function s() {
|
|
9
|
+
return Array.from(t.keys()).sort();
|
|
10
|
+
}
|
|
11
|
+
function o(e, r) {
|
|
12
|
+
return r?.[e] ?? t.get(e);
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
o as getFieldComponent,
|
|
16
|
+
i as hasRegisteredFieldType,
|
|
17
|
+
s as listRegisteredFieldTypes,
|
|
18
|
+
n as registerFieldType
|
|
19
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { FieldType } from '../types/fields.types';
|
|
3
|
+
import { CustomFieldTypesMap, FormFieldProps } from '../types/reactHookForm.types';
|
|
4
|
+
/**
|
|
5
|
+
* Renders a built-in or registered field. Module-level switch keeps static analysis happy.
|
|
6
|
+
* Custom instance overrides and late-registered types use createElement.
|
|
7
|
+
*/
|
|
8
|
+
export declare function renderRegisteredField(fieldType: FieldType | string, commonProps: FormFieldProps, instanceOverrides?: CustomFieldTypesMap): ReactNode;
|
|
9
|
+
/** @deprecated Use {@link renderRegisteredField} — returns element, not component type. */
|
|
10
|
+
export declare function resolveFieldComponent(fieldType: FieldType | string, instanceOverrides?: CustomFieldTypesMap): import('react').ComponentType<FormFieldProps> | undefined;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { createElement as u } from "react";
|
|
3
|
+
import { getFieldComponent as n } from "./fieldRegistry.js";
|
|
4
|
+
import { ButtonsGroupField as c } from "../Fields/ButtonsGroupField.js";
|
|
5
|
+
import { CheckboxField as d } from "../Fields/CheckboxField.js";
|
|
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
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function te(t, e) {
|
|
82
|
+
const i = e?.[t];
|
|
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
|
+
}
|
|
133
|
+
}
|
|
134
|
+
export {
|
|
135
|
+
re as renderRegisteredField,
|
|
136
|
+
te as resolveFieldComponent
|
|
137
|
+
};
|