@m4l/components 9.71.0 → 9.71.1-beta-improvement-786-m4l-components-dynamic-form.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/components/DynamicForm/DynamicForm.d.ts.map +1 -1
- package/components/DynamicForm/DynamicForm.js +96 -93
- package/components/DynamicForm/DynamicForm.styles.d.ts.map +1 -1
- package/components/DynamicForm/DynamicForm.styles.js +91 -68
- package/components/DynamicForm/constants.d.ts +1 -1
- package/components/DynamicForm/constants.d.ts.map +1 -1
- package/components/DynamicForm/dictionary.d.ts +9 -0
- package/components/DynamicForm/dictionary.d.ts.map +1 -1
- package/components/DynamicForm/dictionary.js +11 -3
- package/components/DynamicForm/helpers/isRenderableDynamicFormField/index.d.ts +2 -0
- package/components/DynamicForm/helpers/isRenderableDynamicFormField/index.d.ts.map +1 -0
- package/components/DynamicForm/helpers/isRenderableDynamicFormField/isRenderableDynamicFormField.d.ts +4 -0
- package/components/DynamicForm/helpers/isRenderableDynamicFormField/isRenderableDynamicFormField.d.ts.map +1 -0
- package/components/DynamicForm/helpers/isRenderableDynamicFormField/isRenderableDynamicFormField.js +8 -0
- package/components/DynamicForm/helpers/resolveEmptyStateLabel/index.d.ts +2 -0
- package/components/DynamicForm/helpers/resolveEmptyStateLabel/index.d.ts.map +1 -0
- package/components/DynamicForm/helpers/resolveEmptyStateLabel/resolveEmptyStateLabel.d.ts +4 -0
- package/components/DynamicForm/helpers/resolveEmptyStateLabel/resolveEmptyStateLabel.d.ts.map +1 -0
- package/components/DynamicForm/helpers/resolveEmptyStateLabel/resolveEmptyStateLabel.js +7 -0
- package/components/DynamicForm/slots/DynamicFormEnum.d.ts +1 -0
- package/components/DynamicForm/slots/DynamicFormEnum.d.ts.map +1 -1
- package/components/DynamicForm/slots/DynamicFormEnum.js +1 -1
- package/components/DynamicForm/slots/DynamicFormSlots.d.ts +3 -0
- package/components/DynamicForm/slots/DynamicFormSlots.d.ts.map +1 -1
- package/components/DynamicForm/slots/DynamicFormSlots.js +43 -39
- package/components/DynamicForm/subcomponents/DynamicFormContent/DynamicFormContent.d.ts.map +1 -1
- package/components/DynamicForm/subcomponents/DynamicFormContent/DynamicFormContent.js +128 -99
- package/components/DynamicForm/subcomponents/DynamicFormFieldsFlow/DynamicFormFieldsFlow.d.ts.map +1 -1
- package/components/DynamicForm/subcomponents/DynamicFormFieldsFlow/DynamicFormFieldsFlow.js +21 -20
- package/components/DynamicForm/types.d.ts +7 -3
- package/components/DynamicForm/types.d.ts.map +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicForm.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/DynamicForm/DynamicForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqF,MAAM,OAAO,CAAC;AAU1G,OAAO,EAEL,gBAAgB,EAChB,cAAc,EAGf,MAAM,SAAS,CAAC;AAYjB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"DynamicForm.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/DynamicForm/DynamicForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqF,MAAM,OAAO,CAAC;AAU1G,OAAO,EAEL,gBAAgB,EAChB,cAAc,EAGf,MAAM,SAAS,CAAC;AAYjB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,WAAW,yFA2RtB,CAAC"}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { jsx as r } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { useModuleSkeleton as
|
|
5
|
-
import { useComponentSize as
|
|
6
|
-
import { TEST_PROP_ID as
|
|
7
|
-
import { LinearProgress as
|
|
8
|
-
import { DynamicFormContentRootStyled as
|
|
9
|
-
import { DYNAMIC_FORM_CLASSES as b, EMPTY_DATA as
|
|
10
|
-
import { useDynamicForm as
|
|
11
|
-
import { useDynamicFormData as
|
|
12
|
-
import { DynamicFormContent as
|
|
13
|
-
import { useFieldsWithFetchedOptions as
|
|
14
|
-
import { filterUnknownFieldsFromSubmit as
|
|
15
|
-
import { mapOptionFieldValuesForSubmit as
|
|
16
|
-
import { normalizeDynamicFormFields as
|
|
17
|
-
const
|
|
2
|
+
import Z, { forwardRef as $, useMemo as c, useState as tt, useEffect as et, useImperativeHandle as ot, useCallback as N } from "react";
|
|
3
|
+
import P from "clsx";
|
|
4
|
+
import { useModuleSkeleton as rt } from "@m4l/core";
|
|
5
|
+
import { useComponentSize as it } from "../../hooks/useComponentSize/index.js";
|
|
6
|
+
import { TEST_PROP_ID as st } from "../../test/constants_no_mock.js";
|
|
7
|
+
import { LinearProgress as nt } from "../extended/mui/LinearProgress/index.js";
|
|
8
|
+
import { DynamicFormContentRootStyled as at, DynamicFormFormProviderStyled as mt } from "./slots/DynamicFormSlots.js";
|
|
9
|
+
import { DYNAMIC_FORM_CLASSES as b, EMPTY_DATA as ut } from "./constants.js";
|
|
10
|
+
import { useDynamicForm as dt } from "./hooks/useDynamicForm/useDynamicForm.js";
|
|
11
|
+
import { useDynamicFormData as lt } from "./hooks/useDynamicFormData/useDynamicFormData.js";
|
|
12
|
+
import { DynamicFormContent as T } from "./subcomponents/DynamicFormContent/DynamicFormContent.js";
|
|
13
|
+
import { useFieldsWithFetchedOptions as ct } from "./hooks/useFieldsWithFetchedOptions/useFieldsWithFetchedOptions.js";
|
|
14
|
+
import { filterUnknownFieldsFromSubmit as ft } from "./helpers/filterUnknownFieldsFromSubmit/filterUnknownFieldsFromSubmit.js";
|
|
15
|
+
import { mapOptionFieldValuesForSubmit as pt } from "./helpers/mapOptionFieldValuesForSubmit/mapOptionFieldValuesForSubmit.js";
|
|
16
|
+
import { normalizeDynamicFormFields as St } from "./helpers/resolveFormSections/resolveFormSections.js";
|
|
17
|
+
const Ft = $((C, k) => {
|
|
18
18
|
const {
|
|
19
|
-
formId:
|
|
20
|
-
formInstanceId:
|
|
21
|
-
inputEndpoint:
|
|
19
|
+
formId: z,
|
|
20
|
+
formInstanceId: _,
|
|
21
|
+
inputEndpoint: A,
|
|
22
22
|
outputEndpoint: i,
|
|
23
|
-
submitMode:
|
|
23
|
+
submitMode: s,
|
|
24
24
|
initialData: D,
|
|
25
|
-
formatInputData:
|
|
26
|
-
formatOutputData:
|
|
27
|
-
onSubmit:
|
|
25
|
+
formatInputData: H,
|
|
26
|
+
formatOutputData: L,
|
|
27
|
+
onSubmit: n,
|
|
28
28
|
onSubmitError: y,
|
|
29
29
|
size: g,
|
|
30
30
|
readOnly: a = !1,
|
|
@@ -35,42 +35,43 @@ const Fe = Z((T, C) => {
|
|
|
35
35
|
fieldWrapperClassName: E,
|
|
36
36
|
fieldFlow: u = "responsiveWrap",
|
|
37
37
|
coupled: p = !1,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
coupledStatusLoad: x,
|
|
39
|
+
actionFormIntroProps: W,
|
|
40
|
+
renderActions: V
|
|
41
|
+
} = C, { currentSize: d } = it(g), U = rt(), {
|
|
42
|
+
formData: Y,
|
|
43
|
+
statusLoad: I,
|
|
44
|
+
handleSubmit: w
|
|
45
|
+
} = lt({
|
|
46
|
+
formId: z,
|
|
47
|
+
formInstanceId: _,
|
|
48
|
+
inputEndpoint: A,
|
|
48
49
|
outputEndpoint: i,
|
|
49
|
-
submitMode:
|
|
50
|
+
submitMode: s,
|
|
50
51
|
initialData: D,
|
|
51
|
-
formatInputData:
|
|
52
|
-
formatOutputData:
|
|
53
|
-
onSubmit:
|
|
54
|
-
}),
|
|
55
|
-
() =>
|
|
56
|
-
[
|
|
57
|
-
), { fields:
|
|
58
|
-
fields:
|
|
59
|
-
}),
|
|
60
|
-
...
|
|
61
|
-
fields:
|
|
62
|
-
}, [
|
|
63
|
-
|
|
64
|
-
if (!
|
|
52
|
+
formatInputData: H,
|
|
53
|
+
formatOutputData: L,
|
|
54
|
+
onSubmit: n
|
|
55
|
+
}), e = Y || D, S = c(
|
|
56
|
+
() => St(e?.fields),
|
|
57
|
+
[e?.fields]
|
|
58
|
+
), { fields: O } = ct({
|
|
59
|
+
fields: S.fields
|
|
60
|
+
}), t = c(() => e && {
|
|
61
|
+
...e,
|
|
62
|
+
fields: O
|
|
63
|
+
}, [O, e]), { initialValues: j, validationSchema: B } = dt(t || ut), [F, l] = tt(null);
|
|
64
|
+
et(() => {
|
|
65
|
+
if (!F)
|
|
65
66
|
return;
|
|
66
|
-
const o = setTimeout(() =>
|
|
67
|
+
const o = setTimeout(() => l(null), 5e3);
|
|
67
68
|
return () => clearTimeout(o);
|
|
68
|
-
}, [
|
|
69
|
-
const
|
|
70
|
-
size:
|
|
69
|
+
}, [F]);
|
|
70
|
+
const q = c(() => ({
|
|
71
|
+
size: d,
|
|
71
72
|
readOnly: a,
|
|
72
73
|
fieldFlow: u
|
|
73
|
-
}), [
|
|
74
|
+
}), [d, u, a]), R = Z.useRef(null), M = c(() => ({
|
|
74
75
|
formMethods: new Proxy({}, {
|
|
75
76
|
get() {
|
|
76
77
|
throw new Error("DynamicForm ref is not available until the form provider mounts.");
|
|
@@ -79,43 +80,44 @@ const Fe = Z((T, C) => {
|
|
|
79
80
|
onSubmit: () => {
|
|
80
81
|
}
|
|
81
82
|
}), []);
|
|
82
|
-
|
|
83
|
-
const
|
|
83
|
+
ot(k, () => R.current ?? M, [M]);
|
|
84
|
+
const G = N(
|
|
84
85
|
async (o) => {
|
|
85
|
-
if (!!!(i ||
|
|
86
|
+
if (!!!(i || s === "perField" || n))
|
|
86
87
|
return;
|
|
87
|
-
const
|
|
88
|
-
}),
|
|
88
|
+
const K = i || s === "perField" ? w : n ?? (() => {
|
|
89
|
+
}), Q = ft(
|
|
89
90
|
o,
|
|
90
|
-
|
|
91
|
-
),
|
|
91
|
+
t?.fields ?? []
|
|
92
|
+
), X = pt(Q, t?.fields ?? []);
|
|
92
93
|
try {
|
|
93
|
-
await
|
|
94
|
+
await K(X), l("success");
|
|
94
95
|
} catch {
|
|
95
|
-
|
|
96
|
+
l("error");
|
|
96
97
|
}
|
|
97
98
|
},
|
|
98
|
-
[
|
|
99
|
-
),
|
|
99
|
+
[w, n, i, t?.fields, s]
|
|
100
|
+
), J = N(
|
|
100
101
|
(o) => {
|
|
101
|
-
|
|
102
|
+
l("error"), y?.(o);
|
|
102
103
|
},
|
|
103
104
|
[y]
|
|
104
105
|
);
|
|
105
|
-
return
|
|
106
|
-
|
|
106
|
+
return U ? /* @__PURE__ */ r(
|
|
107
|
+
at,
|
|
107
108
|
{
|
|
108
|
-
ownerState:
|
|
109
|
-
className:
|
|
109
|
+
ownerState: q,
|
|
110
|
+
className: P(v, b.contentRoot),
|
|
110
111
|
...typeof m == "string" ? { "data-meta": m } : {},
|
|
111
|
-
...process.env.NODE_ENV !== "production" ? { [
|
|
112
|
-
children: /* @__PURE__ */ r(
|
|
112
|
+
...process.env.NODE_ENV !== "production" ? { [st]: f } : {},
|
|
113
|
+
children: /* @__PURE__ */ r(nt, {})
|
|
113
114
|
}
|
|
114
|
-
) :
|
|
115
|
-
|
|
115
|
+
) : t ? p ? /* @__PURE__ */ r(
|
|
116
|
+
T,
|
|
116
117
|
{
|
|
117
|
-
data:
|
|
118
|
-
|
|
118
|
+
data: t,
|
|
119
|
+
statusLoad: x,
|
|
120
|
+
currentSize: d,
|
|
119
121
|
fieldWrapperClassName: E,
|
|
120
122
|
dataTestId: f,
|
|
121
123
|
dataMeta: m,
|
|
@@ -123,24 +125,25 @@ const Fe = Z((T, C) => {
|
|
|
123
125
|
readOnly: a,
|
|
124
126
|
suppressFormHeader: h,
|
|
125
127
|
fieldFlow: u,
|
|
126
|
-
contractIssues:
|
|
128
|
+
contractIssues: S.issues
|
|
127
129
|
}
|
|
128
130
|
) : /* @__PURE__ */ r(
|
|
129
|
-
|
|
131
|
+
mt,
|
|
130
132
|
{
|
|
131
|
-
ref:
|
|
132
|
-
values:
|
|
133
|
-
validationSchema:
|
|
134
|
-
onSubmit:
|
|
135
|
-
onSubmitError:
|
|
136
|
-
statusLoad:
|
|
133
|
+
ref: R,
|
|
134
|
+
values: j,
|
|
135
|
+
validationSchema: B,
|
|
136
|
+
onSubmit: G,
|
|
137
|
+
onSubmitError: J,
|
|
138
|
+
statusLoad: I,
|
|
137
139
|
mode: "onSubmit",
|
|
138
|
-
className:
|
|
140
|
+
className: P(v, b.contentRoot, b.formProvider),
|
|
139
141
|
children: /* @__PURE__ */ r(
|
|
140
|
-
|
|
142
|
+
T,
|
|
141
143
|
{
|
|
142
|
-
data:
|
|
143
|
-
|
|
144
|
+
data: t,
|
|
145
|
+
statusLoad: I,
|
|
146
|
+
currentSize: d,
|
|
144
147
|
fieldWrapperClassName: E,
|
|
145
148
|
dataTestId: f,
|
|
146
149
|
dataMeta: m,
|
|
@@ -148,16 +151,16 @@ const Fe = Z((T, C) => {
|
|
|
148
151
|
readOnly: a,
|
|
149
152
|
suppressFormHeader: h,
|
|
150
153
|
fieldFlow: u,
|
|
151
|
-
contractIssues:
|
|
152
|
-
actionFormIntroProps:
|
|
153
|
-
renderActions:
|
|
154
|
-
submitFeedbackStatus:
|
|
154
|
+
contractIssues: S.issues,
|
|
155
|
+
actionFormIntroProps: W,
|
|
156
|
+
renderActions: V,
|
|
157
|
+
submitFeedbackStatus: F
|
|
155
158
|
}
|
|
156
159
|
)
|
|
157
160
|
}
|
|
158
161
|
) : null;
|
|
159
162
|
});
|
|
160
|
-
|
|
163
|
+
Ft.displayName = "DynamicForm";
|
|
161
164
|
export {
|
|
162
|
-
|
|
165
|
+
Ft as DynamicForm
|
|
163
166
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicForm.styles.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/DynamicForm/DynamicForm.styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DynamicForm.styles.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/DynamicForm/DynamicForm.styles.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAGV,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAgNjB,eAAO,MAAM,eAAe,EAAE,iBA0W7B,CAAC"}
|
|
@@ -1,97 +1,98 @@
|
|
|
1
1
|
import { CHECKABLE_LIST_DEFAULT_MIN_HEIGHT as m } from "../CheckableList/constants.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { IMAGE_TEXT_CLASSES as h } from "../ImageText/constants.js";
|
|
3
|
+
import { createDynamicFormSectionCardStyles as x } from "./subcomponents/DynamicFormSection/cardStyles.js";
|
|
4
|
+
import { DYNAMIC_FORM_SEMANTIC_GRID_COLUMN_BREAKPOINTS as l, DYNAMIC_FORM_SEMANTIC_GRID_MAX_COLUMNS as c, resolveSemanticGridSpanForContainerWidth as S, resolveSemanticGridSpanForColumnCount as p, resolveSemanticGridContainerWidthForSpan as g } from "./helpers/resolveAdaptiveFieldLayout/resolveAdaptiveFieldLayout.js";
|
|
5
|
+
const s = "m4l-dynamic-form-content", w = {
|
|
5
6
|
gridColumn: "1 / -1",
|
|
6
7
|
maxWidth: "100%",
|
|
7
8
|
width: "100%",
|
|
8
9
|
minWidth: "0",
|
|
9
10
|
flex: "1 1 100%"
|
|
10
|
-
},
|
|
11
|
-
(
|
|
12
|
-
gridTemplateColumns: `repeat(${
|
|
13
|
-
},
|
|
11
|
+
}, y = l.reduce(
|
|
12
|
+
(t, i) => (t[`@container ${s} (max-width: ${i.maxContainerWidth}px)`] = {
|
|
13
|
+
gridTemplateColumns: `repeat(${i.columns}, minmax(0, 1fr))`
|
|
14
|
+
}, t),
|
|
14
15
|
{}
|
|
15
|
-
),
|
|
16
|
+
), C = [
|
|
16
17
|
{
|
|
17
18
|
columns: c,
|
|
18
19
|
minContainerWidth: (l[0]?.maxContainerWidth ?? 0) + 1
|
|
19
20
|
},
|
|
20
21
|
...l.map(
|
|
21
|
-
(
|
|
22
|
-
columns:
|
|
23
|
-
maxContainerWidth:
|
|
24
|
-
minContainerWidth: (l[
|
|
22
|
+
(t, i) => ({
|
|
23
|
+
columns: t.columns,
|
|
24
|
+
maxContainerWidth: t.maxContainerWidth,
|
|
25
|
+
minContainerWidth: (l[i + 1]?.maxContainerWidth ?? -1) + 1
|
|
25
26
|
})
|
|
26
27
|
)
|
|
27
28
|
];
|
|
28
|
-
function
|
|
29
|
-
return typeof
|
|
29
|
+
function W(t) {
|
|
30
|
+
return typeof t == "number" && Number.isFinite(t) && t > 0;
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
+
function u(t) {
|
|
32
33
|
return {
|
|
33
|
-
gridColumn: `span ${
|
|
34
|
+
gridColumn: `span ${t}`
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
+
function f(t, i) {
|
|
37
38
|
const e = [];
|
|
38
|
-
return
|
|
39
|
+
return t > 0 && e.push(`(min-width: ${t}px)`), typeof i == "number" && e.push(`(max-width: ${i}px)`), `@container ${s} ${e.join(
|
|
39
40
|
" and "
|
|
40
41
|
)}`;
|
|
41
42
|
}
|
|
42
|
-
function
|
|
43
|
-
return
|
|
43
|
+
function b(t) {
|
|
44
|
+
return t.minContainerWidth > 0 ? t.minContainerWidth : t.maxContainerWidth ?? 1;
|
|
44
45
|
}
|
|
45
|
-
function
|
|
46
|
+
function v(t, i, e, n) {
|
|
46
47
|
for (let r = n - 1; r >= 1; r -= 1) {
|
|
47
|
-
const o =
|
|
48
|
+
const o = g(
|
|
48
49
|
e,
|
|
49
50
|
r,
|
|
50
|
-
|
|
51
|
+
i.columns
|
|
51
52
|
);
|
|
52
|
-
o <=
|
|
53
|
+
o <= i.minContainerWidth || typeof i.maxContainerWidth == "number" && o > i.maxContainerWidth || (t[f(
|
|
53
54
|
o,
|
|
54
|
-
|
|
55
|
-
)] =
|
|
55
|
+
i.maxContainerWidth
|
|
56
|
+
)] = u(r));
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
|
-
function
|
|
59
|
-
if (
|
|
59
|
+
function T(t, i) {
|
|
60
|
+
if (W(i)) {
|
|
60
61
|
const e = {
|
|
61
62
|
justifySelf: "start",
|
|
62
63
|
maxWidth: "100%",
|
|
63
|
-
width: `min(100%, ${Math.ceil(
|
|
64
|
+
width: `min(100%, ${Math.ceil(i)}px)`
|
|
64
65
|
};
|
|
65
|
-
return
|
|
66
|
-
const o =
|
|
67
|
-
|
|
66
|
+
return C.forEach((n, r) => {
|
|
67
|
+
const o = S(
|
|
68
|
+
i,
|
|
68
69
|
n.columns,
|
|
69
|
-
|
|
70
|
-
), a =
|
|
71
|
-
r === 0 ? Object.assign(e, a) : e[
|
|
70
|
+
b(n)
|
|
71
|
+
), a = u(o);
|
|
72
|
+
r === 0 ? Object.assign(e, a) : e[f(0, n.maxContainerWidth)] = a, v(
|
|
72
73
|
e,
|
|
73
74
|
n,
|
|
74
|
-
|
|
75
|
+
i,
|
|
75
76
|
o
|
|
76
77
|
);
|
|
77
78
|
}), e;
|
|
78
79
|
}
|
|
79
80
|
return l.reduce(
|
|
80
81
|
(e, n) => (e[`@container ${s} (max-width: ${n.maxContainerWidth}px)`] = {
|
|
81
|
-
gridColumn: `span ${
|
|
82
|
-
|
|
82
|
+
gridColumn: `span ${p(
|
|
83
|
+
t,
|
|
83
84
|
n.columns
|
|
84
85
|
)}`
|
|
85
86
|
}, e),
|
|
86
87
|
{
|
|
87
|
-
gridColumn: `span ${
|
|
88
|
-
|
|
88
|
+
gridColumn: `span ${p(
|
|
89
|
+
t,
|
|
89
90
|
c
|
|
90
91
|
)}`
|
|
91
92
|
}
|
|
92
93
|
);
|
|
93
94
|
}
|
|
94
|
-
const
|
|
95
|
+
const E = {
|
|
95
96
|
/**
|
|
96
97
|
* Styles for the RHFormProvider wrapper.
|
|
97
98
|
*/
|
|
@@ -106,38 +107,60 @@ const _ = {
|
|
|
106
107
|
* Styles for the form content container (inner div).
|
|
107
108
|
* Uses a vertical flex axis so growable fields can consume available height.
|
|
108
109
|
*/
|
|
109
|
-
contentRoot: ({ theme:
|
|
110
|
-
const e =
|
|
110
|
+
contentRoot: ({ theme: t, ownerState: i }) => {
|
|
111
|
+
const e = i;
|
|
111
112
|
return {
|
|
112
113
|
display: "flex",
|
|
113
114
|
flexDirection: "column",
|
|
114
115
|
alignItems: "stretch",
|
|
115
|
-
gap:
|
|
116
|
+
gap: t.vars.size.baseSpacings.sp4,
|
|
116
117
|
width: "100%",
|
|
117
118
|
height: "100%",
|
|
118
119
|
minHeight: 0,
|
|
119
120
|
boxSizing: "border-box",
|
|
120
121
|
containerName: s,
|
|
121
122
|
containerType: "inline-size",
|
|
122
|
-
padding:
|
|
123
|
+
padding: t.vars.size.baseSpacings.sp2,
|
|
123
124
|
...e?.fieldFlow === "verticalStack" && {
|
|
124
125
|
flex: "1 1 auto"
|
|
125
126
|
},
|
|
126
127
|
"& .MuiLinearProgress-root": {
|
|
127
|
-
backgroundColor:
|
|
128
|
+
backgroundColor: t.vars.palette.primary.opacity
|
|
128
129
|
}
|
|
129
130
|
};
|
|
130
131
|
},
|
|
132
|
+
/** Center the existing empty-state composition without imposing a host height. */
|
|
133
|
+
emptyState: ({ theme: t }) => ({
|
|
134
|
+
display: "flex",
|
|
135
|
+
alignItems: "center",
|
|
136
|
+
justifyContent: "center",
|
|
137
|
+
flex: "1 0 auto",
|
|
138
|
+
width: "100%",
|
|
139
|
+
minWidth: 0,
|
|
140
|
+
paddingBlock: t.vars.size.baseSpacings.sp4,
|
|
141
|
+
boxSizing: "border-box",
|
|
142
|
+
textAlign: "center",
|
|
143
|
+
[`& .${h.root}`]: {
|
|
144
|
+
height: "auto",
|
|
145
|
+
minWidth: 0,
|
|
146
|
+
boxSizing: "border-box",
|
|
147
|
+
backgroundColor: "transparent"
|
|
148
|
+
},
|
|
149
|
+
[`& .${h.wrapperTitleMessage}`]: {
|
|
150
|
+
maxWidth: "100%",
|
|
151
|
+
overflowWrap: "anywhere"
|
|
152
|
+
}
|
|
153
|
+
}),
|
|
131
154
|
/**
|
|
132
155
|
* Styles for normal-field flow segments.
|
|
133
156
|
*/
|
|
134
|
-
fieldsFlow: ({ theme:
|
|
157
|
+
fieldsFlow: ({ theme: t, ownerState: i }) => i?.fieldFlow === "verticalStack" ? {
|
|
135
158
|
display: "flex",
|
|
136
159
|
flexDirection: "column",
|
|
137
160
|
alignItems: "stretch",
|
|
138
161
|
alignContent: "stretch",
|
|
139
162
|
flexWrap: "nowrap",
|
|
140
|
-
gap:
|
|
163
|
+
gap: t.vars.size.baseSpacings.sp4,
|
|
141
164
|
width: "100%",
|
|
142
165
|
minWidth: 0,
|
|
143
166
|
boxSizing: "border-box",
|
|
@@ -148,38 +171,38 @@ const _ = {
|
|
|
148
171
|
gridAutoFlow: "row",
|
|
149
172
|
alignItems: "start",
|
|
150
173
|
alignContent: "start",
|
|
151
|
-
gap:
|
|
174
|
+
gap: t.vars.size.baseSpacings.sp4,
|
|
152
175
|
width: "100%",
|
|
153
176
|
minWidth: 0,
|
|
154
177
|
boxSizing: "border-box",
|
|
155
178
|
flex: "0 0 auto",
|
|
156
|
-
...
|
|
179
|
+
...y
|
|
157
180
|
},
|
|
158
181
|
/** Arrange section containers without forcing narrow input columns. */
|
|
159
|
-
sectionsGrid: ({ theme:
|
|
182
|
+
sectionsGrid: ({ theme: t, ownerState: i }) => ({
|
|
160
183
|
display: "grid",
|
|
161
|
-
gridTemplateColumns:
|
|
162
|
-
gap:
|
|
184
|
+
gridTemplateColumns: i?.fieldFlow === "verticalStack" ? "minmax(0, 1fr)" : "repeat(auto-fit, minmax(min(100%, 22rem), 1fr))",
|
|
185
|
+
gap: t.vars.size.baseSpacings.sp5,
|
|
163
186
|
alignItems: "stretch",
|
|
164
187
|
width: "100%",
|
|
165
188
|
minWidth: 0,
|
|
166
189
|
boxSizing: "border-box"
|
|
167
190
|
}),
|
|
168
191
|
/** Surface for fields outside groups when at least one section is visible. */
|
|
169
|
-
ungroupedCard: ({ theme:
|
|
170
|
-
...
|
|
192
|
+
ungroupedCard: ({ theme: t }) => ({
|
|
193
|
+
...x(t),
|
|
171
194
|
containerName: s,
|
|
172
195
|
containerType: "inline-size"
|
|
173
196
|
}),
|
|
174
197
|
/**
|
|
175
198
|
* Styles for the optional form header rendered before the dynamic fields.
|
|
176
199
|
*/
|
|
177
|
-
formHeader: ({ theme:
|
|
200
|
+
formHeader: ({ theme: t }) => ({
|
|
178
201
|
width: "100%",
|
|
179
202
|
flex: "0 0 auto",
|
|
180
203
|
display: "flex",
|
|
181
204
|
flexDirection: "column",
|
|
182
|
-
gap:
|
|
205
|
+
gap: t.vars.size.baseSpacings.sp1,
|
|
183
206
|
minWidth: 0
|
|
184
207
|
}),
|
|
185
208
|
/**
|
|
@@ -205,17 +228,17 @@ const _ = {
|
|
|
205
228
|
* `ownerState.gridColumnSpan` places adaptive fields on the semantic grid while
|
|
206
229
|
* PropertyValue keeps the rendered control fixed to the backend semantic width.
|
|
207
230
|
*/
|
|
208
|
-
fieldWrapper: ({ theme:
|
|
209
|
-
const e =
|
|
210
|
-
let r =
|
|
211
|
-
e?.isFullWidth !== !0 && typeof e?.gridColumnSpan == "number" && (r =
|
|
231
|
+
fieldWrapper: ({ theme: t, ownerState: i }) => {
|
|
232
|
+
const e = i, n = e?.fieldFlow === "verticalStack";
|
|
233
|
+
let r = w;
|
|
234
|
+
e?.isFullWidth !== !0 && typeof e?.gridColumnSpan == "number" && (r = T(
|
|
212
235
|
e.gridColumnSpan,
|
|
213
236
|
e.wrapperWidth
|
|
214
237
|
));
|
|
215
238
|
const o = {
|
|
216
239
|
display: "flex",
|
|
217
240
|
flexDirection: "column",
|
|
218
|
-
gap:
|
|
241
|
+
gap: t.vars.size.baseSpacings.sp1,
|
|
219
242
|
minWidth: 0
|
|
220
243
|
}, a = {
|
|
221
244
|
"& > *": {
|
|
@@ -327,12 +350,12 @@ const _ = {
|
|
|
327
350
|
/**
|
|
328
351
|
* Styles for the section divider (for future use).
|
|
329
352
|
*/
|
|
330
|
-
sectionDivider: ({ theme:
|
|
353
|
+
sectionDivider: ({ theme: t }) => ({
|
|
331
354
|
width: "100%",
|
|
332
|
-
height:
|
|
333
|
-
backgroundColor:
|
|
334
|
-
marginTop:
|
|
335
|
-
marginBottom:
|
|
355
|
+
height: t.vars.size.borderStroke.container,
|
|
356
|
+
backgroundColor: t.vars.palette.border.main,
|
|
357
|
+
marginTop: t.vars.size.baseSpacings.sp2,
|
|
358
|
+
marginBottom: t.vars.size.baseSpacings.sp2
|
|
336
359
|
}),
|
|
337
360
|
/**
|
|
338
361
|
* Styles for the CheckableList wrapper inside the vertical grow field.
|
|
@@ -364,5 +387,5 @@ const _ = {
|
|
|
364
387
|
})
|
|
365
388
|
};
|
|
366
389
|
export {
|
|
367
|
-
|
|
390
|
+
E as componentStyles
|
|
368
391
|
};
|
|
@@ -10,7 +10,7 @@ export declare const DYNAMIC_FORM_KEY_COMPONENT = "M4LDynamicForm";
|
|
|
10
10
|
/**
|
|
11
11
|
* CSS class inventory for the component.
|
|
12
12
|
*/
|
|
13
|
-
export declare const DYNAMIC_FORM_CLASSES: Record<"label" | "helperText" | "sectionDivider" | "contentRoot" | "formProvider" | "formHeader" | "formTitle" | "formDescription" | "fieldsFlow" | "sectionsGrid" | "ungroupedCard" | "fieldWrapper" | "submitFeedback" | "actionsRow" | "checkableListWrapper" | "fallbackEndIconChip", string>;
|
|
13
|
+
export declare const DYNAMIC_FORM_CLASSES: Record<"label" | "helperText" | "emptyState" | "sectionDivider" | "contentRoot" | "formProvider" | "formHeader" | "formTitle" | "formDescription" | "fieldsFlow" | "sectionsGrid" | "ungroupedCard" | "fieldWrapper" | "submitFeedback" | "actionsRow" | "checkableListWrapper" | "fallbackEndIconChip", string>;
|
|
14
14
|
/**
|
|
15
15
|
* Default shortcut used by DynamicForm date-range fields when the backend omits or sends an invalid shortcut.
|
|
16
16
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/DynamicForm/constants.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,sBAAsB,EAGvB,MAAM,SAAS,CAAC;AAEjB;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,mBAAmB,CAAC;AAE3D;;GAEG;AACH,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/DynamicForm/constants.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,sBAAsB,EAGvB,MAAM,SAAS,CAAC;AAEjB;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,mBAAmB,CAAC;AAE3D;;GAEG;AACH,eAAO,MAAM,oBAAoB,kTAGhC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wCAAwC,UAAU,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,0BAA0B,mJAQoB,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,oCAAoC,sDAGU,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,oBAAoB,6QAG/B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,qBAAqB,6QAGhC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,mBAAmB,6QAI9B,CAAC;AAEH,eAAO,MAAM,UAAU,EAAE,sBAKxB,CAAC"}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
export declare const DYNAMIC_FORM_DICTIONARY_KEY = "dynamic_form";
|
|
2
|
+
/** Shipped copy for deployments whose dictionary has not received the new keys yet. */
|
|
3
|
+
export declare const DYNAMIC_FORM_EMPTY_STATE_LABELS: {
|
|
4
|
+
title: string;
|
|
5
|
+
message: string;
|
|
6
|
+
};
|
|
2
7
|
export declare const getDynamicFormComponentsDictionary: () => string[];
|
|
3
8
|
export declare const DYNAMIC_FORM_DICTIONARY: {
|
|
9
|
+
/** Empty-state title when no visible field can mount. */
|
|
10
|
+
NO_VISIBLE_FIELDS_TITLE: string;
|
|
11
|
+
/** Explain why the form body contains no field controls. */
|
|
12
|
+
NO_VISIBLE_FIELDS_MESSAGE: string;
|
|
4
13
|
/** Shown when `field.label` is missing or blank; use `$1` for the field id (e.g. "Label not found $1"). */
|
|
5
14
|
LABEL_NOT_FOUND_MESSAGE: string;
|
|
6
15
|
IS_REQUIRED_MESSAGE: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/DynamicForm/dictionary.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,iBAAiB,CAAC;AAE1D,eAAO,MAAM,kCAAkC,gBAE9C,CAAC;AAEF,eAAO,MAAM,uBAAuB;IAClC,2GAA2G;;;;;;;;;;;;IAY3G,oFAAoF;;IAEpF,kFAAkF;;IAElF,+EAA+E;;IAE/E,8DAA8D;;IAE9D,oEAAoE;;IAEpE,uFAAuF;;CAExF,CAAC"}
|
|
1
|
+
{"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/DynamicForm/dictionary.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,iBAAiB,CAAC;AAE1D,uFAAuF;AACvF,eAAO,MAAM,+BAA+B;;;CAG3C,CAAC;AAEF,eAAO,MAAM,kCAAkC,gBAE9C,CAAC;AAEF,eAAO,MAAM,uBAAuB;IAClC,yDAAyD;;IAEzD,4DAA4D;;IAE5D,2GAA2G;;;;;;;;;;;;IAY3G,oFAAoF;;IAEpF,kFAAkF;;IAElF,+EAA+E;;IAE/E,8DAA8D;;IAE9D,oEAAoE;;IAEpE,uFAAuF;;CAExF,CAAC"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
const _ = "dynamic_form", e =
|
|
1
|
+
const _ = "dynamic_form", e = {
|
|
2
|
+
title: "No visible fields",
|
|
3
|
+
message: "This form has no fields to display at this time."
|
|
4
|
+
}, E = () => [_], s = {
|
|
5
|
+
/** Empty-state title when no visible field can mount. */
|
|
6
|
+
NO_VISIBLE_FIELDS_TITLE: `${_}.no_visible_fields_title`,
|
|
7
|
+
/** Explain why the form body contains no field controls. */
|
|
8
|
+
NO_VISIBLE_FIELDS_MESSAGE: `${_}.no_visible_fields_message`,
|
|
2
9
|
/** Shown when `field.label` is missing or blank; use `$1` for the field id (e.g. "Label not found $1"). */
|
|
3
10
|
LABEL_NOT_FOUND_MESSAGE: `${_}.label_not_found_message`,
|
|
4
11
|
IS_REQUIRED_MESSAGE: `${_}.is_required_message`,
|
|
@@ -25,7 +32,8 @@ const _ = "dynamic_form", e = () => [_], E = {
|
|
|
25
32
|
SECTION_CONTRACT_NOTICE: `${_}.section_contract_notice`
|
|
26
33
|
};
|
|
27
34
|
export {
|
|
28
|
-
|
|
35
|
+
s as DYNAMIC_FORM_DICTIONARY,
|
|
29
36
|
_ as DYNAMIC_FORM_DICTIONARY_KEY,
|
|
30
|
-
e as
|
|
37
|
+
e as DYNAMIC_FORM_EMPTY_STATE_LABELS,
|
|
38
|
+
E as getDynamicFormComponentsDictionary
|
|
31
39
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/DynamicForm/helpers/isRenderableDynamicFormField/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isRenderableDynamicFormField.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/DynamicForm/helpers/isRenderableDynamicFormField/isRenderableDynamicFormField.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAIzC,+EAA+E;AAC/E,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAKlE"}
|