@m4l/components 9.57.1-beta-hotfix-semantic-width-dynamicform.1 → 9.57.1-beta-hotfix-semantic-width-dynamicform.2
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.styles.d.ts.map +1 -1
- package/components/DynamicForm/DynamicForm.styles.js +146 -46
- package/components/DynamicForm/helpers/resolveAdaptiveFieldLayout/resolveAdaptiveFieldLayout.d.ts +23 -2
- package/components/DynamicForm/helpers/resolveAdaptiveFieldLayout/resolveAdaptiveFieldLayout.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveAdaptiveFieldLayout/resolveAdaptiveFieldLayout.js +151 -59
- package/components/DynamicForm/subcomponents/DynamicFormContent/DynamicFormContent.d.ts.map +1 -1
- package/components/DynamicForm/subcomponents/DynamicFormContent/DynamicFormContent.js +42 -41
- package/components/DynamicForm/types.d.ts +10 -10
- package/components/Label/Label.styles.d.ts.map +1 -1
- package/components/Label/Label.styles.js +7 -1
- package/components/PropertyValue/PropertyValue.d.ts.map +1 -1
- package/components/PropertyValue/PropertyValue.js +37 -37
- package/components/PropertyValue/PropertyValue.styles.d.ts.map +1 -1
- package/components/PropertyValue/PropertyValue.styles.js +53 -49
- package/components/PropertyValue/constants.d.ts +1 -0
- package/components/PropertyValue/constants.d.ts.map +1 -1
- package/components/PropertyValue/constants.js +10 -4
- package/package.json +8 -8
|
@@ -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":"AACA,OAAO,KAAK,EAGV,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAgNjB,eAAO,MAAM,eAAe,EAAE,iBA0T7B,CAAC"}
|
|
@@ -1,15 +1,96 @@
|
|
|
1
|
-
import { CHECKABLE_LIST_DEFAULT_MIN_HEIGHT as
|
|
2
|
-
import {
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
minWidth: `min(100%, ${t}px)`,
|
|
6
|
-
maxWidth: "100%"
|
|
7
|
-
}), m = {
|
|
1
|
+
import { CHECKABLE_LIST_DEFAULT_MIN_HEIGHT as m } from "../CheckableList/constants.js";
|
|
2
|
+
import { DYNAMIC_FORM_SEMANTIC_GRID_COLUMN_BREAKPOINTS as l, DYNAMIC_FORM_SEMANTIC_GRID_MAX_COLUMNS as c, resolveSemanticGridSpanForContainerWidth as f, resolveSemanticGridSpanForColumnCount as h, resolveSemanticGridContainerWidthForSpan as x } from "./helpers/resolveAdaptiveFieldLayout/resolveAdaptiveFieldLayout.js";
|
|
3
|
+
const s = "m4l-dynamic-form-content", S = {
|
|
4
|
+
gridColumn: "1 / -1",
|
|
8
5
|
maxWidth: "100%",
|
|
9
6
|
width: "100%",
|
|
10
7
|
minWidth: "0",
|
|
11
8
|
flex: "1 1 100%"
|
|
12
|
-
}, g =
|
|
9
|
+
}, g = l.reduce(
|
|
10
|
+
(t, i) => (t[`@container ${s} (max-width: ${i.maxContainerWidth}px)`] = {
|
|
11
|
+
gridTemplateColumns: `repeat(${i.columns}, minmax(0, 1fr))`
|
|
12
|
+
}, t),
|
|
13
|
+
{}
|
|
14
|
+
), w = [
|
|
15
|
+
{
|
|
16
|
+
columns: c,
|
|
17
|
+
minContainerWidth: (l[0]?.maxContainerWidth ?? 0) + 1
|
|
18
|
+
},
|
|
19
|
+
...l.map(
|
|
20
|
+
(t, i) => ({
|
|
21
|
+
columns: t.columns,
|
|
22
|
+
maxContainerWidth: t.maxContainerWidth,
|
|
23
|
+
minContainerWidth: (l[i + 1]?.maxContainerWidth ?? -1) + 1
|
|
24
|
+
})
|
|
25
|
+
)
|
|
26
|
+
];
|
|
27
|
+
function C(t) {
|
|
28
|
+
return typeof t == "number" && Number.isFinite(t) && t > 0;
|
|
29
|
+
}
|
|
30
|
+
function u(t) {
|
|
31
|
+
return {
|
|
32
|
+
gridColumn: `span ${t}`
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function p(t, i) {
|
|
36
|
+
const e = [];
|
|
37
|
+
return t > 0 && e.push(`(min-width: ${t}px)`), typeof i == "number" && e.push(`(max-width: ${i}px)`), `@container ${s} ${e.join(
|
|
38
|
+
" and "
|
|
39
|
+
)}`;
|
|
40
|
+
}
|
|
41
|
+
function y(t) {
|
|
42
|
+
return t.minContainerWidth > 0 ? t.minContainerWidth : t.maxContainerWidth ?? 1;
|
|
43
|
+
}
|
|
44
|
+
function W(t, i, e, n) {
|
|
45
|
+
for (let r = n - 1; r >= 1; r -= 1) {
|
|
46
|
+
const o = x(
|
|
47
|
+
e,
|
|
48
|
+
r,
|
|
49
|
+
i.columns
|
|
50
|
+
);
|
|
51
|
+
o <= i.minContainerWidth || typeof i.maxContainerWidth == "number" && o > i.maxContainerWidth || (t[p(
|
|
52
|
+
o,
|
|
53
|
+
i.maxContainerWidth
|
|
54
|
+
)] = u(r));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function b(t, i) {
|
|
58
|
+
if (C(i)) {
|
|
59
|
+
const e = {
|
|
60
|
+
justifySelf: "start",
|
|
61
|
+
maxWidth: "100%",
|
|
62
|
+
width: `min(100%, ${Math.ceil(i)}px)`
|
|
63
|
+
};
|
|
64
|
+
return w.forEach((n, r) => {
|
|
65
|
+
const o = f(
|
|
66
|
+
i,
|
|
67
|
+
n.columns,
|
|
68
|
+
y(n)
|
|
69
|
+
), a = u(o);
|
|
70
|
+
r === 0 ? Object.assign(e, a) : e[p(0, n.maxContainerWidth)] = a, W(
|
|
71
|
+
e,
|
|
72
|
+
n,
|
|
73
|
+
i,
|
|
74
|
+
o
|
|
75
|
+
);
|
|
76
|
+
}), e;
|
|
77
|
+
}
|
|
78
|
+
return l.reduce(
|
|
79
|
+
(e, n) => (e[`@container ${s} (max-width: ${n.maxContainerWidth}px)`] = {
|
|
80
|
+
gridColumn: `span ${h(
|
|
81
|
+
t,
|
|
82
|
+
n.columns
|
|
83
|
+
)}`
|
|
84
|
+
}, e),
|
|
85
|
+
{
|
|
86
|
+
gridColumn: `span ${h(
|
|
87
|
+
t,
|
|
88
|
+
c
|
|
89
|
+
)}`
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
const T = {
|
|
13
94
|
/**
|
|
14
95
|
* Styles for the RHFormProvider wrapper.
|
|
15
96
|
*/
|
|
@@ -24,8 +105,8 @@ const h = (t) => ({
|
|
|
24
105
|
* Styles for the form content container (inner div).
|
|
25
106
|
* Uses a vertical flex axis so growable fields can consume available height.
|
|
26
107
|
*/
|
|
27
|
-
contentRoot: ({ theme: t, ownerState:
|
|
28
|
-
const e =
|
|
108
|
+
contentRoot: ({ theme: t, ownerState: i }) => {
|
|
109
|
+
const e = i;
|
|
29
110
|
return {
|
|
30
111
|
display: "flex",
|
|
31
112
|
flexDirection: "column",
|
|
@@ -35,6 +116,8 @@ const h = (t) => ({
|
|
|
35
116
|
height: "100%",
|
|
36
117
|
minHeight: 0,
|
|
37
118
|
boxSizing: "border-box",
|
|
119
|
+
containerName: s,
|
|
120
|
+
containerType: "inline-size",
|
|
38
121
|
padding: t.vars.size.baseSpacings.sp2,
|
|
39
122
|
...e?.fieldFlow === "verticalStack" && {
|
|
40
123
|
flex: "1 1 auto"
|
|
@@ -47,20 +130,29 @@ const h = (t) => ({
|
|
|
47
130
|
/**
|
|
48
131
|
* Styles for normal-field flow segments.
|
|
49
132
|
*/
|
|
50
|
-
fieldsFlow: ({ theme: t, ownerState:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
133
|
+
fieldsFlow: ({ theme: t, ownerState: i }) => i?.fieldFlow === "verticalStack" ? {
|
|
134
|
+
display: "flex",
|
|
135
|
+
flexDirection: "column",
|
|
136
|
+
alignItems: "stretch",
|
|
137
|
+
alignContent: "stretch",
|
|
138
|
+
flexWrap: "nowrap",
|
|
139
|
+
gap: t.vars.size.baseSpacings.sp4,
|
|
140
|
+
width: "100%",
|
|
141
|
+
minWidth: 0,
|
|
142
|
+
boxSizing: "border-box",
|
|
143
|
+
flex: "0 0 auto"
|
|
144
|
+
} : {
|
|
145
|
+
display: "grid",
|
|
146
|
+
gridTemplateColumns: `repeat(${c}, minmax(0, 1fr))`,
|
|
147
|
+
gridAutoFlow: "row",
|
|
148
|
+
alignItems: "start",
|
|
149
|
+
alignContent: "start",
|
|
150
|
+
gap: t.vars.size.baseSpacings.sp4,
|
|
151
|
+
width: "100%",
|
|
152
|
+
minWidth: 0,
|
|
153
|
+
boxSizing: "border-box",
|
|
154
|
+
flex: "0 0 auto",
|
|
155
|
+
...g
|
|
64
156
|
},
|
|
65
157
|
/**
|
|
66
158
|
* Styles for the optional form header rendered before the dynamic fields.
|
|
@@ -93,38 +185,41 @@ const h = (t) => ({
|
|
|
93
185
|
}),
|
|
94
186
|
/**
|
|
95
187
|
* Styles for each form field wrapper.
|
|
96
|
-
* `ownerState.
|
|
97
|
-
*
|
|
188
|
+
* `ownerState.gridColumnSpan` places adaptive fields on the semantic grid while
|
|
189
|
+
* PropertyValue keeps the rendered control fixed to the backend semantic width.
|
|
98
190
|
*/
|
|
99
|
-
fieldWrapper: ({ theme: t, ownerState:
|
|
100
|
-
const e =
|
|
101
|
-
let
|
|
102
|
-
e?.isFullWidth !== !0 &&
|
|
103
|
-
|
|
191
|
+
fieldWrapper: ({ theme: t, ownerState: i }) => {
|
|
192
|
+
const e = i, n = e?.fieldFlow === "verticalStack";
|
|
193
|
+
let r = S;
|
|
194
|
+
e?.isFullWidth !== !0 && typeof e?.gridColumnSpan == "number" && (r = b(
|
|
195
|
+
e.gridColumnSpan,
|
|
196
|
+
e.wrapperWidth
|
|
197
|
+
));
|
|
198
|
+
const o = {
|
|
104
199
|
display: "flex",
|
|
105
200
|
flexDirection: "column",
|
|
106
201
|
gap: t.vars.size.baseSpacings.sp1,
|
|
107
202
|
minWidth: 0
|
|
108
|
-
},
|
|
203
|
+
}, a = {
|
|
109
204
|
"& > *": {
|
|
110
205
|
width: "100%",
|
|
111
206
|
maxWidth: "100%",
|
|
112
207
|
minWidth: 0
|
|
113
208
|
}
|
|
114
|
-
},
|
|
209
|
+
}, d = {
|
|
115
210
|
...e?.disabled && {
|
|
116
211
|
pointerEvents: "none",
|
|
117
212
|
opacity: 0.5
|
|
118
213
|
}
|
|
119
214
|
};
|
|
120
215
|
return e?.layout === "verticalGrow" ? {
|
|
121
|
-
...
|
|
216
|
+
...o,
|
|
122
217
|
width: "100%",
|
|
123
218
|
maxWidth: "100%",
|
|
124
|
-
flex: `1 1 ${
|
|
219
|
+
flex: `1 1 ${m}px`,
|
|
125
220
|
alignSelf: "stretch",
|
|
126
|
-
minHeight:
|
|
127
|
-
...
|
|
221
|
+
minHeight: m,
|
|
222
|
+
...a,
|
|
128
223
|
"& > .M4LPropertyValue-root": {
|
|
129
224
|
width: "100%",
|
|
130
225
|
maxWidth: "100%",
|
|
@@ -142,21 +237,26 @@ const h = (t) => ({
|
|
|
142
237
|
minHeight: 0,
|
|
143
238
|
whiteSpace: "normal"
|
|
144
239
|
},
|
|
145
|
-
...
|
|
146
|
-
} :
|
|
147
|
-
...
|
|
240
|
+
...d
|
|
241
|
+
} : n ? {
|
|
242
|
+
...o,
|
|
148
243
|
width: "100%",
|
|
149
244
|
maxWidth: "100%",
|
|
150
245
|
flex: "0 0 auto",
|
|
151
246
|
alignSelf: "stretch",
|
|
152
|
-
...
|
|
153
|
-
...
|
|
247
|
+
...a,
|
|
248
|
+
...d
|
|
154
249
|
} : {
|
|
250
|
+
...o,
|
|
251
|
+
width: "100%",
|
|
252
|
+
maxWidth: "100%",
|
|
253
|
+
alignSelf: "start",
|
|
155
254
|
...r,
|
|
156
|
-
alignSelf: "flex-start",
|
|
157
255
|
...a,
|
|
158
|
-
...
|
|
159
|
-
|
|
256
|
+
...d,
|
|
257
|
+
"&&& .M4LPropertyValue-name": {
|
|
258
|
+
width: "fit-content"
|
|
259
|
+
}
|
|
160
260
|
};
|
|
161
261
|
},
|
|
162
262
|
/**
|
|
@@ -247,5 +347,5 @@ const h = (t) => ({
|
|
|
247
347
|
})
|
|
248
348
|
};
|
|
249
349
|
export {
|
|
250
|
-
|
|
350
|
+
T as componentStyles
|
|
251
351
|
};
|
package/components/DynamicForm/helpers/resolveAdaptiveFieldLayout/resolveAdaptiveFieldLayout.d.ts
CHANGED
|
@@ -13,17 +13,38 @@ export interface ResolveAdaptiveFieldLayoutParams extends EstimateLabelWidthPxPa
|
|
|
13
13
|
export interface AdaptiveFieldLayout {
|
|
14
14
|
controlWidth?: number;
|
|
15
15
|
estimatedLabelWidth: number;
|
|
16
|
+
gridColumnSpan: number;
|
|
16
17
|
isFullWidth: boolean;
|
|
17
18
|
labelWidth?: number;
|
|
18
19
|
requestedSemanticWidth?: SemanticWidthOptions | null;
|
|
19
20
|
wrapperWidth?: number;
|
|
20
21
|
}
|
|
21
|
-
export
|
|
22
|
+
export interface SemanticGridColumnBreakpoint {
|
|
23
|
+
columns: number;
|
|
24
|
+
maxContainerWidth: number;
|
|
25
|
+
}
|
|
26
|
+
export declare const DYNAMIC_FORM_SEMANTIC_GRID_BASE_COLUMN_WIDTH = 37;
|
|
27
|
+
export declare const DYNAMIC_FORM_SEMANTIC_GRID_COLUMN_GAP = 16;
|
|
28
|
+
export declare const DYNAMIC_FORM_SEMANTIC_GRID_MAX_COLUMNS = 24;
|
|
29
|
+
export declare const DYNAMIC_FORM_SEMANTIC_GRID_SPAN_PRECISION_THRESHOLD = 0.06;
|
|
30
|
+
export declare const DYNAMIC_FORM_SEMANTIC_GRID_COLUMN_BREAKPOINTS: readonly SemanticGridColumnBreakpoint[];
|
|
22
31
|
/** Estimate the visual width needed by a single-line DynamicForm label. */
|
|
23
32
|
export declare function estimateLabelWidthPx(params: EstimateLabelWidthPxParams): number;
|
|
24
33
|
/** Resolve wrapper, label, and control widths without replacing the backend semantic width. */
|
|
25
34
|
export declare function resolveAdaptiveFieldLayout(params: ResolveAdaptiveFieldLayoutParams): AdaptiveFieldLayout;
|
|
26
|
-
/** Resolve the
|
|
35
|
+
/** Resolve the precise adaptive wrapper width allowed for a DynamicForm field. */
|
|
27
36
|
export declare function resolveAdaptiveFieldLayoutVisualTrackWidth(requiredWidth: number): number | undefined;
|
|
37
|
+
/** Resolve how many semantic grid columns a field needs to contain its visual width. */
|
|
38
|
+
export declare function resolveSemanticGridFieldColumnSpan(wrapperWidth: number, minimumExactWidth?: number): number;
|
|
39
|
+
/** Clamp a field span to the column count available in the current grid breakpoint. */
|
|
40
|
+
export declare function resolveSemanticGridSpanForColumnCount(fieldColumnSpan: number, columnCount: number): number;
|
|
41
|
+
/** Resolve the approximate rendered width of a semantic grid span. */
|
|
42
|
+
export declare function resolveSemanticGridSpanWidth(columnSpan: number): number;
|
|
43
|
+
/** Resolve the rendered width of a semantic grid span for an actual container width. */
|
|
44
|
+
export declare function resolveSemanticGridSpanWidthForContainer(columnSpan: number, columnCount: number, containerWidth: number): number;
|
|
45
|
+
/** Resolve the minimum container width required for a span to contain a field. */
|
|
46
|
+
export declare function resolveSemanticGridContainerWidthForSpan(requiredWidth: number, columnSpan: number, columnCount: number): number;
|
|
47
|
+
/** Resolve the smallest field span that can contain a width in the active container. */
|
|
48
|
+
export declare function resolveSemanticGridSpanForContainerWidth(requiredWidth: number, columnCount: number, containerWidth: number): number;
|
|
28
49
|
export {};
|
|
29
50
|
//# sourceMappingURL=resolveAdaptiveFieldLayout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveAdaptiveFieldLayout.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/DynamicForm/helpers/resolveAdaptiveFieldLayout/resolveAdaptiveFieldLayout.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,KAAK,uBAAuB,GAAG,OAAO,GAAG,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"resolveAdaptiveFieldLayout.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/DynamicForm/helpers/resolveAdaptiveFieldLayout/resolveAdaptiveFieldLayout.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,KAAK,uBAAuB,GAAG,OAAO,GAAG,QAAQ,CAAC;AAkClD,MAAM,WAAW,0BAA0B;IACzC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,EAAE,uBAAuB,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,gCACf,SAAQ,0BAA0B;IAClC,sBAAsB,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACtD;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sBAAsB,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACrD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAwCD,eAAO,MAAM,4CAA4C,KAAK,CAAC;AAC/D,eAAO,MAAM,qCAAqC,KAAK,CAAC;AACxD,eAAO,MAAM,sCAAsC,KAAK,CAAC;AACzD,eAAO,MAAM,mDAAmD,OAAO,CAAC;AACxE,eAAO,MAAM,6CAA6C,EAAE,SAAS,4BAA4B,EAerF,CAAC;AAOb,2EAA2E;AAC3E,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,0BAA0B,GACjC,MAAM,CAsBR;AAED,+FAA+F;AAC/F,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,gCAAgC,GACvC,mBAAmB,CAqDrB;AAED,kFAAkF;AAClF,wBAAgB,0CAA0C,CACxD,aAAa,EAAE,MAAM,GACpB,MAAM,GAAG,SAAS,CAUpB;AAED,wFAAwF;AACxF,wBAAgB,kCAAkC,CAChD,YAAY,EAAE,MAAM,EACpB,iBAAiB,SAAe,GAC/B,MAAM,CAgCR;AAED,uFAAuF;AACvF,wBAAgB,qCAAqC,CACnD,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,GAClB,MAAM,CAKR;AAED,sEAAsE;AACtE,wBAAgB,4BAA4B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAOvE;AAED,wFAAwF;AACxF,wBAAgB,wCAAwC,CACtD,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,GACrB,MAAM,CAoBR;AAED,kFAAkF;AAClF,wBAAgB,wCAAwC,CACtD,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,MAAM,CAiBR;AAED,wFAAwF;AACxF,wBAAgB,wCAAwC,CACtD,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,GACrB,MAAM,CAoBR"}
|
package/components/DynamicForm/helpers/resolveAdaptiveFieldLayout/resolveAdaptiveFieldLayout.js
CHANGED
|
@@ -1,82 +1,174 @@
|
|
|
1
|
-
import { isFullRowSemanticWidth as
|
|
2
|
-
const
|
|
1
|
+
import { isFullRowSemanticWidth as A, resolveSemanticWidthPx as p } from "../../../PropertyValue/semanticWidth.js";
|
|
2
|
+
const m = {
|
|
3
|
+
narrow: 0.28,
|
|
4
|
+
normal: 0.6,
|
|
5
|
+
punctuation: 0.28,
|
|
6
|
+
space: 0.26,
|
|
7
|
+
thin: 0.38,
|
|
8
|
+
uppercase: 0.68,
|
|
9
|
+
wide: 0.86
|
|
10
|
+
}, W = {
|
|
3
11
|
small: {
|
|
4
|
-
|
|
5
|
-
helperIcon:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
punctuation: 3,
|
|
10
|
-
space: 4,
|
|
11
|
-
uppercase: 8,
|
|
12
|
-
wide: 10
|
|
12
|
+
fontSize: 10,
|
|
13
|
+
helperIcon: 18,
|
|
14
|
+
letterSpacing: 0.8,
|
|
15
|
+
mandatoryMarker: 9,
|
|
16
|
+
safetyBuffer: 2
|
|
13
17
|
},
|
|
14
18
|
medium: {
|
|
15
|
-
|
|
16
|
-
helperIcon:
|
|
19
|
+
fontSize: 11,
|
|
20
|
+
helperIcon: 20,
|
|
21
|
+
letterSpacing: 0.8,
|
|
17
22
|
mandatoryMarker: 10,
|
|
18
|
-
|
|
19
|
-
normal: 8,
|
|
20
|
-
punctuation: 4,
|
|
21
|
-
space: 5,
|
|
22
|
-
uppercase: 9,
|
|
23
|
-
wide: 11
|
|
23
|
+
safetyBuffer: 2
|
|
24
24
|
}
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
}, d = 796, c = 37, s = 16, l = 24, I = 0.06, L = [
|
|
26
|
+
{ columns: 22, maxContainerWidth: 1255 },
|
|
27
|
+
{ columns: 20, maxContainerWidth: 1149 },
|
|
28
|
+
{ columns: 18, maxContainerWidth: 1043 },
|
|
29
|
+
{ columns: 16, maxContainerWidth: 937 },
|
|
30
|
+
{ columns: 14, maxContainerWidth: 831 },
|
|
31
|
+
{ columns: 12, maxContainerWidth: 725 },
|
|
32
|
+
{ columns: 10, maxContainerWidth: 619 },
|
|
33
|
+
{ columns: 8, maxContainerWidth: 513 },
|
|
34
|
+
{ columns: 6, maxContainerWidth: 407 },
|
|
35
|
+
{ columns: 4, maxContainerWidth: 359 },
|
|
36
|
+
{ columns: 3, maxContainerWidth: 343 },
|
|
37
|
+
{ columns: 2, maxContainerWidth: 335 },
|
|
38
|
+
{ columns: 1, maxContainerWidth: 319 }
|
|
39
|
+
], R = "ijlI|!", N = ".,;:'", x = "ftr()[]{}/\\", E = "mwMW@%#&";
|
|
40
|
+
function F(n) {
|
|
41
|
+
const { hasHelperMessage: t = !1, label: i, mandatory: e = !1, size: o, symbol: r } = n, u = W[o], f = typeof r == "string" && r.trim() !== "" ? `${i} (${r.trim()})` : i, C = Array.from(f), h = C.reduce((M, _) => M + O(_), 0) * u.fontSize + C.length * u.letterSpacing;
|
|
36
42
|
return Math.ceil(
|
|
37
|
-
|
|
43
|
+
h + u.safetyBuffer + (e ? u.mandatoryMarker : 0) + (t ? u.helperIcon : 0)
|
|
38
44
|
);
|
|
39
45
|
}
|
|
40
|
-
function
|
|
41
|
-
const { requestedSemanticWidth:
|
|
42
|
-
if (
|
|
46
|
+
function P(n) {
|
|
47
|
+
const { requestedSemanticWidth: t } = n, i = F(n), e = p(t);
|
|
48
|
+
if (A(t))
|
|
43
49
|
return {
|
|
44
|
-
controlWidth:
|
|
45
|
-
estimatedLabelWidth:
|
|
50
|
+
controlWidth: e,
|
|
51
|
+
estimatedLabelWidth: i,
|
|
52
|
+
gridColumnSpan: l,
|
|
46
53
|
isFullWidth: !0,
|
|
47
|
-
requestedSemanticWidth:
|
|
54
|
+
requestedSemanticWidth: t
|
|
48
55
|
};
|
|
49
|
-
if (!
|
|
56
|
+
if (!e || i > d)
|
|
50
57
|
return {
|
|
51
|
-
controlWidth:
|
|
52
|
-
estimatedLabelWidth:
|
|
58
|
+
controlWidth: e,
|
|
59
|
+
estimatedLabelWidth: i,
|
|
60
|
+
gridColumnSpan: l,
|
|
53
61
|
isFullWidth: !0,
|
|
54
|
-
requestedSemanticWidth:
|
|
62
|
+
requestedSemanticWidth: t
|
|
55
63
|
};
|
|
56
|
-
const
|
|
57
|
-
return
|
|
58
|
-
controlWidth:
|
|
59
|
-
estimatedLabelWidth:
|
|
64
|
+
const o = Math.max(e, i), r = i <= e ? e : T(o);
|
|
65
|
+
return r ? {
|
|
66
|
+
controlWidth: e,
|
|
67
|
+
estimatedLabelWidth: i,
|
|
68
|
+
gridColumnSpan: D(
|
|
69
|
+
r,
|
|
70
|
+
e
|
|
71
|
+
),
|
|
60
72
|
isFullWidth: !1,
|
|
61
|
-
labelWidth:
|
|
62
|
-
requestedSemanticWidth:
|
|
63
|
-
wrapperWidth:
|
|
73
|
+
labelWidth: r,
|
|
74
|
+
requestedSemanticWidth: t,
|
|
75
|
+
wrapperWidth: r
|
|
64
76
|
} : {
|
|
65
|
-
controlWidth:
|
|
66
|
-
estimatedLabelWidth:
|
|
77
|
+
controlWidth: e,
|
|
78
|
+
estimatedLabelWidth: i,
|
|
79
|
+
gridColumnSpan: l,
|
|
67
80
|
isFullWidth: !0,
|
|
68
|
-
requestedSemanticWidth:
|
|
81
|
+
requestedSemanticWidth: t
|
|
69
82
|
};
|
|
70
83
|
}
|
|
71
|
-
function
|
|
72
|
-
|
|
84
|
+
function T(n) {
|
|
85
|
+
if (!(!Number.isFinite(n) || n <= 0) && !(n > d))
|
|
86
|
+
return Math.ceil(n);
|
|
73
87
|
}
|
|
74
|
-
function
|
|
75
|
-
|
|
88
|
+
function D(n, t = n) {
|
|
89
|
+
if (!Number.isFinite(n))
|
|
90
|
+
return l;
|
|
91
|
+
const i = a(
|
|
92
|
+
Math.ceil(
|
|
93
|
+
(n + s) / (c + s)
|
|
94
|
+
)
|
|
95
|
+
), e = Number.isFinite(t) ? t : n, o = a(
|
|
96
|
+
Math.ceil(
|
|
97
|
+
(e + s) / (c + s)
|
|
98
|
+
)
|
|
99
|
+
), r = Math.max(o, i - 1);
|
|
100
|
+
return r < i && v(n, r) ? r : i;
|
|
101
|
+
}
|
|
102
|
+
function y(n, t) {
|
|
103
|
+
return Math.min(
|
|
104
|
+
a(n),
|
|
105
|
+
a(t)
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
function S(n) {
|
|
109
|
+
const t = a(n);
|
|
110
|
+
return t * c + (t - 1) * s;
|
|
111
|
+
}
|
|
112
|
+
function G(n, t, i) {
|
|
113
|
+
const e = a(t), o = Math.min(
|
|
114
|
+
a(n),
|
|
115
|
+
e
|
|
116
|
+
);
|
|
117
|
+
if (!Number.isFinite(i) || i <= 0)
|
|
118
|
+
return S(o);
|
|
119
|
+
const r = (e - 1) * s, u = Math.max(0, i - r) / e;
|
|
120
|
+
return o * u + (o - 1) * s;
|
|
121
|
+
}
|
|
122
|
+
function z(n, t, i) {
|
|
123
|
+
if (!Number.isFinite(n) || n <= 0)
|
|
124
|
+
return 0;
|
|
125
|
+
const e = a(i), o = Math.min(
|
|
126
|
+
a(t),
|
|
127
|
+
e
|
|
128
|
+
);
|
|
129
|
+
return Math.ceil(
|
|
130
|
+
(e * n + (e - o) * s) / o
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
function g(n, t, i) {
|
|
134
|
+
if (!Number.isFinite(n))
|
|
135
|
+
return a(t);
|
|
136
|
+
const e = a(t);
|
|
137
|
+
for (let o = 1; o <= e; o += 1)
|
|
138
|
+
if (G(
|
|
139
|
+
o,
|
|
140
|
+
e,
|
|
141
|
+
i
|
|
142
|
+
) >= n)
|
|
143
|
+
return o;
|
|
144
|
+
return e;
|
|
145
|
+
}
|
|
146
|
+
function a(n) {
|
|
147
|
+
return Number.isFinite(n) ? Math.min(
|
|
148
|
+
l,
|
|
149
|
+
Math.max(1, Math.ceil(n))
|
|
150
|
+
) : l;
|
|
151
|
+
}
|
|
152
|
+
function v(n, t) {
|
|
153
|
+
const i = S(t);
|
|
154
|
+
return i >= n ? !0 : (n - i) / n <= I;
|
|
155
|
+
}
|
|
156
|
+
function O(n) {
|
|
157
|
+
return n.trim() === "" ? m.space : R.includes(n) ? m.narrow : N.includes(n) ? m.punctuation : x.includes(n) ? m.thin : E.includes(n) ? m.wide : n >= "A" && n <= "Z" ? m.uppercase : m.normal;
|
|
76
158
|
}
|
|
77
159
|
export {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
160
|
+
c as DYNAMIC_FORM_SEMANTIC_GRID_BASE_COLUMN_WIDTH,
|
|
161
|
+
L as DYNAMIC_FORM_SEMANTIC_GRID_COLUMN_BREAKPOINTS,
|
|
162
|
+
s as DYNAMIC_FORM_SEMANTIC_GRID_COLUMN_GAP,
|
|
163
|
+
l as DYNAMIC_FORM_SEMANTIC_GRID_MAX_COLUMNS,
|
|
164
|
+
I as DYNAMIC_FORM_SEMANTIC_GRID_SPAN_PRECISION_THRESHOLD,
|
|
165
|
+
F as estimateLabelWidthPx,
|
|
166
|
+
P as resolveAdaptiveFieldLayout,
|
|
167
|
+
T as resolveAdaptiveFieldLayoutVisualTrackWidth,
|
|
168
|
+
z as resolveSemanticGridContainerWidthForSpan,
|
|
169
|
+
D as resolveSemanticGridFieldColumnSpan,
|
|
170
|
+
y as resolveSemanticGridSpanForColumnCount,
|
|
171
|
+
g as resolveSemanticGridSpanForContainerWidth,
|
|
172
|
+
S as resolveSemanticGridSpanWidth,
|
|
173
|
+
G as resolveSemanticGridSpanWidthForContainer
|
|
82
174
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicFormContent.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/DynamicForm/subcomponents/DynamicFormContent/DynamicFormContent.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EACV,uBAAuB,EAKxB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"DynamicFormContent.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/DynamicForm/subcomponents/DynamicFormContent/DynamicFormContent.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EACV,uBAAuB,EAKxB,MAAM,aAAa,CAAC;AAoKrB,eAAO,MAAM,kBAAkB,oHAwK7B,CAAC"}
|