@golemui/gui-shared 0.13.1 → 0.13.3
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/CHANGELOG.md +20 -0
- package/index.d.ts +11 -7
- package/index.js +233 -358
- package/index.umd.cjs +1 -1
- package/internals.js +12 -2
- package/internals.umd.cjs +1 -1
- package/lib/dx/__tests__/helpers.d.ts +0 -2
- package/lib/dx/core/dx.domain.d.ts +0 -1
- package/lib/dx/core/eventWiring.service.d.ts +1 -2
- package/lib/dx/dx.service.d.ts +2 -6
- package/lib/widgets.d.ts +1 -1
- package/package.json +5 -3
- package/resolveFormInput-B3y_InQZ.js +1550 -0
- package/resolveFormInput-CyAWrNF6.cjs +1 -0
- package/lib/utils/index.d.ts +0 -3
|
@@ -0,0 +1,1550 @@
|
|
|
1
|
+
import "@golemui/core";
|
|
2
|
+
const N = {
|
|
3
|
+
INPUTS: "INPUTS",
|
|
4
|
+
ACTIONS: "ACTIONS",
|
|
5
|
+
LAYOUTS: "LAYOUTS",
|
|
6
|
+
DISPLAYS: "DISPLAYS"
|
|
7
|
+
};
|
|
8
|
+
function R(e) {
|
|
9
|
+
return function(t, s = () => !0) {
|
|
10
|
+
return {
|
|
11
|
+
kind: "leaf",
|
|
12
|
+
selectorType: e,
|
|
13
|
+
matcher: s,
|
|
14
|
+
config: t
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function g(e, t) {
|
|
19
|
+
return typeof e == "function" ? e : { type: t, ...e ?? {} };
|
|
20
|
+
}
|
|
21
|
+
class K {
|
|
22
|
+
/**
|
|
23
|
+
* Deep merges two objects, with right taking precedence over left when properties conflict.
|
|
24
|
+
* Arrays are replaced, not merged.
|
|
25
|
+
* @param left - The base object
|
|
26
|
+
* @param right - The object whose properties take precedence
|
|
27
|
+
* @returns A new merged object
|
|
28
|
+
*/
|
|
29
|
+
deepMerge(t, s) {
|
|
30
|
+
if (s == null)
|
|
31
|
+
return t;
|
|
32
|
+
if (t == null || typeof t != "object" || typeof s != "object" || Array.isArray(t) || Array.isArray(s))
|
|
33
|
+
return s;
|
|
34
|
+
const a = { ...t };
|
|
35
|
+
for (const l in s)
|
|
36
|
+
Object.prototype.hasOwnProperty.call(s, l) && (typeof s[l] == "object" && !Array.isArray(s[l]) && s[l] !== null && typeof t[l] == "object" && !Array.isArray(t[l]) && t[l] !== null ? a[l] = this.deepMerge(t[l], s[l]) : a[l] = s[l]);
|
|
37
|
+
return a;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const V = new K(), G = (e, t) => ({
|
|
41
|
+
type: "ITEMS",
|
|
42
|
+
itemType: N.DISPLAYS,
|
|
43
|
+
items: [{ render: e }],
|
|
44
|
+
tags: t ?? []
|
|
45
|
+
}), C = /* @__PURE__ */ new Map();
|
|
46
|
+
function x(e, t) {
|
|
47
|
+
if (C.has(e))
|
|
48
|
+
throw new Error(`Item type "${e}" is already registered.`);
|
|
49
|
+
C.set(e, t);
|
|
50
|
+
}
|
|
51
|
+
function f(e) {
|
|
52
|
+
const t = C.get(e);
|
|
53
|
+
if (!t)
|
|
54
|
+
throw new Error(
|
|
55
|
+
`No handler registered for item type "${e}". Did you forget to import the registration module?`
|
|
56
|
+
);
|
|
57
|
+
return t;
|
|
58
|
+
}
|
|
59
|
+
function F(e) {
|
|
60
|
+
return C.has(e);
|
|
61
|
+
}
|
|
62
|
+
function c(e) {
|
|
63
|
+
const t = (o) => {
|
|
64
|
+
if (!e.sensibleDefaults)
|
|
65
|
+
return {};
|
|
66
|
+
let r = { ...e.sensibleDefaults.base };
|
|
67
|
+
for (const u of o) {
|
|
68
|
+
const p = u.config;
|
|
69
|
+
for (const y of e.sensibleDefaults.fields) {
|
|
70
|
+
const d = y;
|
|
71
|
+
p[d] != null && (r = { ...r, [d]: p[d] });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return r;
|
|
75
|
+
}, s = (o, r) => e.sensibleDefaults ? e.sensibleDefaults.apply(o, r) : o, a = (o) => {
|
|
76
|
+
switch (e.entryShape) {
|
|
77
|
+
case "bare":
|
|
78
|
+
return { baseDef: o };
|
|
79
|
+
case "keyed": {
|
|
80
|
+
const r = o;
|
|
81
|
+
return { baseDef: r.def, path: r.key };
|
|
82
|
+
}
|
|
83
|
+
case "compound": {
|
|
84
|
+
const r = o;
|
|
85
|
+
return { baseDef: r.def, children: r.children };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}, l = {
|
|
89
|
+
rollUpSensibleDefaults: t,
|
|
90
|
+
applySensibleDefaults: s,
|
|
91
|
+
mapToWidget: e.mapToWidget,
|
|
92
|
+
parseEntry: a,
|
|
93
|
+
...e.afterMerge ? { afterMerge: e.afterMerge } : {},
|
|
94
|
+
...e.buildCustomWidget ? { buildCustomWidget: e.buildCustomWidget } : {},
|
|
95
|
+
...e.getChildren ? { getChildren: e.getChildren } : {}
|
|
96
|
+
};
|
|
97
|
+
x(e.itemType, l);
|
|
98
|
+
const n = R(e.itemType);
|
|
99
|
+
return { gsl: n, gslByUid: (o, r) => n(r, ((u) => u.uid === o)) };
|
|
100
|
+
}
|
|
101
|
+
function b(e) {
|
|
102
|
+
const {
|
|
103
|
+
uid: t,
|
|
104
|
+
path: s,
|
|
105
|
+
label: a,
|
|
106
|
+
disabled: l,
|
|
107
|
+
readonly: n,
|
|
108
|
+
defaultValue: i,
|
|
109
|
+
tags: o,
|
|
110
|
+
type: r,
|
|
111
|
+
size: u,
|
|
112
|
+
onLoad: p,
|
|
113
|
+
onChange: y,
|
|
114
|
+
onFilter: d,
|
|
115
|
+
on: T,
|
|
116
|
+
states: _,
|
|
117
|
+
include: v,
|
|
118
|
+
exclude: D,
|
|
119
|
+
validator: P,
|
|
120
|
+
...k
|
|
121
|
+
} = e;
|
|
122
|
+
return k;
|
|
123
|
+
}
|
|
124
|
+
function X(e) {
|
|
125
|
+
return e ? e.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").replace(/\s+/g, " ").trim().replace(/\b\w/g, (t) => t.toUpperCase()) : "";
|
|
126
|
+
}
|
|
127
|
+
function m(e, t) {
|
|
128
|
+
return e.label != null || t.suppressAutomaticLabels || !e.path ? e : { ...e, label: X(e.path) };
|
|
129
|
+
}
|
|
130
|
+
function A(e, t) {
|
|
131
|
+
return e.placeholder != null || t.suppressAutomaticPlaceholders || !e.path ? e : { ...e, placeholder: e.path };
|
|
132
|
+
}
|
|
133
|
+
function H(e) {
|
|
134
|
+
switch (e.type) {
|
|
135
|
+
case "text":
|
|
136
|
+
return q(e);
|
|
137
|
+
case "number":
|
|
138
|
+
return J(e);
|
|
139
|
+
case "boolean":
|
|
140
|
+
return Z(e);
|
|
141
|
+
default:
|
|
142
|
+
throw new Error(`Unsupported field type "${e.type}"`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function Z(e) {
|
|
146
|
+
const t = b(e);
|
|
147
|
+
return {
|
|
148
|
+
uid: e.uid ?? "",
|
|
149
|
+
kind: "input",
|
|
150
|
+
type: "toggle",
|
|
151
|
+
path: e.path ?? "",
|
|
152
|
+
...e.label != null ? { label: e.label } : {},
|
|
153
|
+
...e.disabled != null ? { disabled: e.disabled } : {},
|
|
154
|
+
...e.readonly != null ? { readonly: e.readonly } : {},
|
|
155
|
+
...e.validator != null ? { validator: g(e.validator, "boolean") } : {},
|
|
156
|
+
props: t
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
function q(e) {
|
|
160
|
+
const t = b(e);
|
|
161
|
+
return {
|
|
162
|
+
uid: e.uid ?? "",
|
|
163
|
+
kind: "input",
|
|
164
|
+
type: "textinput",
|
|
165
|
+
path: e.path ?? "",
|
|
166
|
+
...e.label != null ? { label: e.label } : {},
|
|
167
|
+
...e.disabled != null ? { disabled: e.disabled } : {},
|
|
168
|
+
...e.readonly != null ? { readonly: e.readonly } : {},
|
|
169
|
+
props: {
|
|
170
|
+
placeholder: t.placeholder ?? "",
|
|
171
|
+
...t
|
|
172
|
+
},
|
|
173
|
+
validator: g(e.validator, "string")
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function J(e) {
|
|
177
|
+
const t = b(e);
|
|
178
|
+
return {
|
|
179
|
+
uid: e.uid ?? "",
|
|
180
|
+
kind: "input",
|
|
181
|
+
type: "number",
|
|
182
|
+
path: e.path ?? "",
|
|
183
|
+
...e.label != null ? { label: e.label } : {},
|
|
184
|
+
...e.disabled != null ? { disabled: e.disabled } : {},
|
|
185
|
+
...e.readonly != null ? { readonly: e.readonly } : {},
|
|
186
|
+
props: {
|
|
187
|
+
placeholder: t.placeholder ?? "",
|
|
188
|
+
...t
|
|
189
|
+
},
|
|
190
|
+
validator: g(e.validator, "number")
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
const { gsl: Ye, gslByUid: ze } = c({
|
|
194
|
+
itemType: "INPUTS",
|
|
195
|
+
entryShape: "keyed",
|
|
196
|
+
sensibleDefaults: {
|
|
197
|
+
base: {
|
|
198
|
+
suppressAutomaticLabels: !1,
|
|
199
|
+
suppressAutomaticPlaceholders: !1
|
|
200
|
+
},
|
|
201
|
+
fields: ["suppressAutomaticLabels", "suppressAutomaticPlaceholders"],
|
|
202
|
+
apply: (e, t) => {
|
|
203
|
+
let s = m(e, t);
|
|
204
|
+
return s = A(s, t), s;
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
mapToWidget: H
|
|
208
|
+
}), { gsl: Ke, gslByUid: Ve } = c({
|
|
209
|
+
itemType: "SELECT",
|
|
210
|
+
entryShape: "keyed",
|
|
211
|
+
sensibleDefaults: {
|
|
212
|
+
base: { suppressAutomaticLabels: !1, suppressAutomaticPlaceholders: !1 },
|
|
213
|
+
fields: ["suppressAutomaticLabels", "suppressAutomaticPlaceholders"],
|
|
214
|
+
apply: (e, t) => A(m(e, t), t)
|
|
215
|
+
},
|
|
216
|
+
mapToWidget: (e) => ({
|
|
217
|
+
uid: e.uid ?? "",
|
|
218
|
+
kind: "input",
|
|
219
|
+
type: "select",
|
|
220
|
+
path: e.path ?? "",
|
|
221
|
+
...e.label != null ? { label: e.label } : {},
|
|
222
|
+
...e.disabled != null ? { disabled: e.disabled } : {},
|
|
223
|
+
...e.readonly != null ? { readonly: e.readonly } : {},
|
|
224
|
+
...e.validator != null ? { validator: e.validator } : {},
|
|
225
|
+
props: b(e)
|
|
226
|
+
})
|
|
227
|
+
}), { gsl: Ge, gslByUid: Xe } = c({
|
|
228
|
+
itemType: "DROPDOWN",
|
|
229
|
+
entryShape: "keyed",
|
|
230
|
+
sensibleDefaults: {
|
|
231
|
+
base: {
|
|
232
|
+
suppressAutomaticLabels: !1,
|
|
233
|
+
suppressAutomaticPlaceholders: !1
|
|
234
|
+
},
|
|
235
|
+
fields: ["suppressAutomaticLabels", "suppressAutomaticPlaceholders"],
|
|
236
|
+
apply: (e, t) => A(m(e, t), t)
|
|
237
|
+
},
|
|
238
|
+
mapToWidget: (e) => ({
|
|
239
|
+
uid: e.uid ?? "",
|
|
240
|
+
kind: "input",
|
|
241
|
+
type: "dropdown",
|
|
242
|
+
path: e.path ?? "",
|
|
243
|
+
...e.label != null ? { label: e.label } : {},
|
|
244
|
+
...e.disabled != null ? { disabled: e.disabled } : {},
|
|
245
|
+
...e.readonly != null ? { readonly: e.readonly } : {},
|
|
246
|
+
...e.validator != null ? { validator: e.validator } : {},
|
|
247
|
+
props: b(e)
|
|
248
|
+
})
|
|
249
|
+
}), { gsl: He, gslByUid: Ze } = c({
|
|
250
|
+
itemType: "RADIOGROUP",
|
|
251
|
+
entryShape: "keyed",
|
|
252
|
+
sensibleDefaults: {
|
|
253
|
+
base: { suppressAutomaticLabels: !1 },
|
|
254
|
+
fields: ["suppressAutomaticLabels"],
|
|
255
|
+
apply: (e, t) => m(e, t)
|
|
256
|
+
},
|
|
257
|
+
mapToWidget: (e) => ({
|
|
258
|
+
uid: e.uid ?? "",
|
|
259
|
+
kind: "input",
|
|
260
|
+
type: "radiogroup",
|
|
261
|
+
path: e.path ?? "",
|
|
262
|
+
...e.label != null ? { label: e.label } : {},
|
|
263
|
+
...e.disabled != null ? { disabled: e.disabled } : {},
|
|
264
|
+
...e.readonly != null ? { readonly: e.readonly } : {},
|
|
265
|
+
...e.validator != null ? { validator: e.validator } : {},
|
|
266
|
+
props: b(e)
|
|
267
|
+
})
|
|
268
|
+
}), { gsl: qe, gslByUid: Je } = c({
|
|
269
|
+
itemType: "CHECKBOX",
|
|
270
|
+
entryShape: "keyed",
|
|
271
|
+
sensibleDefaults: {
|
|
272
|
+
base: { suppressAutomaticLabels: !1 },
|
|
273
|
+
fields: ["suppressAutomaticLabels"],
|
|
274
|
+
apply: (e, t) => m(e, t)
|
|
275
|
+
},
|
|
276
|
+
mapToWidget: (e) => ({
|
|
277
|
+
uid: e.uid ?? "",
|
|
278
|
+
kind: "input",
|
|
279
|
+
type: "checkbox",
|
|
280
|
+
path: e.path ?? "",
|
|
281
|
+
...e.label != null ? { label: e.label } : {},
|
|
282
|
+
...e.disabled != null ? { disabled: e.disabled } : {},
|
|
283
|
+
...e.readonly != null ? { readonly: e.readonly } : {},
|
|
284
|
+
...e.validator != null ? { validator: g(e.validator, "boolean") } : {},
|
|
285
|
+
props: b(e)
|
|
286
|
+
})
|
|
287
|
+
}), { gsl: Qe, gslByUid: et } = c({
|
|
288
|
+
itemType: "TEXTAREA",
|
|
289
|
+
entryShape: "keyed",
|
|
290
|
+
sensibleDefaults: {
|
|
291
|
+
base: { suppressAutomaticLabels: !1, suppressAutomaticPlaceholders: !1 },
|
|
292
|
+
fields: ["suppressAutomaticLabels", "suppressAutomaticPlaceholders"],
|
|
293
|
+
apply: (e, t) => A(m(e, t), t)
|
|
294
|
+
},
|
|
295
|
+
mapToWidget: (e) => ({
|
|
296
|
+
uid: e.uid ?? "",
|
|
297
|
+
kind: "input",
|
|
298
|
+
type: "textarea",
|
|
299
|
+
path: e.path ?? "",
|
|
300
|
+
...e.label != null ? { label: e.label } : {},
|
|
301
|
+
...e.disabled != null ? { disabled: e.disabled } : {},
|
|
302
|
+
...e.readonly != null ? { readonly: e.readonly } : {},
|
|
303
|
+
...e.validator != null ? { validator: g(e.validator, "string") } : {},
|
|
304
|
+
props: b(e)
|
|
305
|
+
})
|
|
306
|
+
}), { gsl: tt, gslByUid: st } = c({
|
|
307
|
+
itemType: "PASSWORD",
|
|
308
|
+
entryShape: "keyed",
|
|
309
|
+
sensibleDefaults: {
|
|
310
|
+
base: { suppressAutomaticLabels: !1, suppressAutomaticPlaceholders: !1 },
|
|
311
|
+
fields: ["suppressAutomaticLabels", "suppressAutomaticPlaceholders"],
|
|
312
|
+
apply: (e, t) => A(m(e, t), t)
|
|
313
|
+
},
|
|
314
|
+
mapToWidget: (e) => ({
|
|
315
|
+
uid: e.uid ?? "",
|
|
316
|
+
kind: "input",
|
|
317
|
+
type: "password",
|
|
318
|
+
path: e.path ?? "",
|
|
319
|
+
...e.label != null ? { label: e.label } : {},
|
|
320
|
+
...e.disabled != null ? { disabled: e.disabled } : {},
|
|
321
|
+
...e.readonly != null ? { readonly: e.readonly } : {},
|
|
322
|
+
...e.validator != null ? { validator: g(e.validator, "string") } : {},
|
|
323
|
+
props: b(e)
|
|
324
|
+
})
|
|
325
|
+
}), { gsl: lt, gslByUid: at } = c({
|
|
326
|
+
itemType: "CURRENCY",
|
|
327
|
+
entryShape: "keyed",
|
|
328
|
+
sensibleDefaults: {
|
|
329
|
+
base: { suppressAutomaticLabels: !1, suppressAutomaticPlaceholders: !1 },
|
|
330
|
+
fields: ["suppressAutomaticLabels", "suppressAutomaticPlaceholders"],
|
|
331
|
+
apply: (e, t) => A(m(e, t), t)
|
|
332
|
+
},
|
|
333
|
+
mapToWidget: (e) => ({
|
|
334
|
+
uid: e.uid ?? "",
|
|
335
|
+
kind: "input",
|
|
336
|
+
type: "currency",
|
|
337
|
+
path: e.path ?? "",
|
|
338
|
+
...e.label != null ? { label: e.label } : {},
|
|
339
|
+
...e.disabled != null ? { disabled: e.disabled } : {},
|
|
340
|
+
...e.readonly != null ? { readonly: e.readonly } : {},
|
|
341
|
+
...e.validator != null ? { validator: g(e.validator, "number") } : {},
|
|
342
|
+
props: b(e)
|
|
343
|
+
})
|
|
344
|
+
}), { gsl: nt, gslByUid: it } = c({
|
|
345
|
+
itemType: "MARKDOWN",
|
|
346
|
+
entryShape: "keyed",
|
|
347
|
+
sensibleDefaults: {
|
|
348
|
+
base: { suppressAutomaticLabels: !1, suppressAutomaticPlaceholders: !1 },
|
|
349
|
+
fields: ["suppressAutomaticLabels", "suppressAutomaticPlaceholders"],
|
|
350
|
+
apply: (e, t) => A(m(e, t), t)
|
|
351
|
+
},
|
|
352
|
+
mapToWidget: (e) => ({
|
|
353
|
+
uid: e.uid ?? "",
|
|
354
|
+
kind: "input",
|
|
355
|
+
type: "markdown",
|
|
356
|
+
path: e.path ?? "",
|
|
357
|
+
...e.label != null ? { label: e.label } : {},
|
|
358
|
+
...e.disabled != null ? { disabled: e.disabled } : {},
|
|
359
|
+
...e.readonly != null ? { readonly: e.readonly } : {},
|
|
360
|
+
...e.validator != null ? { validator: g(e.validator, "string") } : {},
|
|
361
|
+
props: b(e)
|
|
362
|
+
})
|
|
363
|
+
}), { gsl: rt, gslByUid: ot } = c({
|
|
364
|
+
itemType: "LIST",
|
|
365
|
+
entryShape: "keyed",
|
|
366
|
+
sensibleDefaults: {
|
|
367
|
+
base: { suppressAutomaticLabels: !1 },
|
|
368
|
+
fields: ["suppressAutomaticLabels"],
|
|
369
|
+
apply: (e, t) => m(e, t)
|
|
370
|
+
},
|
|
371
|
+
mapToWidget: (e) => ({
|
|
372
|
+
uid: e.uid ?? "",
|
|
373
|
+
kind: "input",
|
|
374
|
+
type: "list",
|
|
375
|
+
path: e.path ?? "",
|
|
376
|
+
...e.label != null ? { label: e.label } : {},
|
|
377
|
+
...e.disabled != null ? { disabled: e.disabled } : {},
|
|
378
|
+
...e.readonly != null ? { readonly: e.readonly } : {},
|
|
379
|
+
...e.validator != null ? { validator: e.validator } : {},
|
|
380
|
+
props: b(e)
|
|
381
|
+
})
|
|
382
|
+
}), { gsl: ut, gslByUid: pt } = c({
|
|
383
|
+
itemType: "CALENDAR",
|
|
384
|
+
entryShape: "bare",
|
|
385
|
+
sensibleDefaults: {
|
|
386
|
+
base: { suppressAutomaticLabels: !1 },
|
|
387
|
+
fields: ["suppressAutomaticLabels"],
|
|
388
|
+
apply: (e, t) => m(e, t)
|
|
389
|
+
},
|
|
390
|
+
mapToWidget: (e) => ({
|
|
391
|
+
uid: e.uid ?? "",
|
|
392
|
+
kind: "input",
|
|
393
|
+
type: "calendar",
|
|
394
|
+
path: e.path ?? "",
|
|
395
|
+
...e.label != null ? { label: e.label } : {},
|
|
396
|
+
...e.disabled != null ? { disabled: e.disabled } : {},
|
|
397
|
+
...e.readonly != null ? { readonly: e.readonly } : {},
|
|
398
|
+
...e.validator != null ? { validator: g(e.validator, "string") } : {},
|
|
399
|
+
props: b(e)
|
|
400
|
+
})
|
|
401
|
+
}), { gsl: ct, gslByUid: dt } = c({
|
|
402
|
+
itemType: "DATE_INPUT",
|
|
403
|
+
entryShape: "keyed",
|
|
404
|
+
sensibleDefaults: {
|
|
405
|
+
base: { suppressAutomaticLabels: !1 },
|
|
406
|
+
fields: ["suppressAutomaticLabels"],
|
|
407
|
+
apply: (e, t) => m(e, t)
|
|
408
|
+
},
|
|
409
|
+
mapToWidget: (e) => ({
|
|
410
|
+
uid: e.uid ?? "",
|
|
411
|
+
kind: "input",
|
|
412
|
+
type: "dateInput",
|
|
413
|
+
path: e.path ?? "",
|
|
414
|
+
...e.label != null ? { label: e.label } : {},
|
|
415
|
+
...e.disabled != null ? { disabled: e.disabled } : {},
|
|
416
|
+
...e.readonly != null ? { readonly: e.readonly } : {},
|
|
417
|
+
...e.validator != null ? { validator: g(e.validator, "string") } : {},
|
|
418
|
+
props: b(e)
|
|
419
|
+
})
|
|
420
|
+
}), { gsl: yt, gslByUid: bt } = c({
|
|
421
|
+
itemType: "DATE_PICKER",
|
|
422
|
+
entryShape: "keyed",
|
|
423
|
+
sensibleDefaults: {
|
|
424
|
+
base: {
|
|
425
|
+
suppressAutomaticLabels: !1,
|
|
426
|
+
suppressAutomaticPlaceholders: !1
|
|
427
|
+
},
|
|
428
|
+
fields: ["suppressAutomaticLabels", "suppressAutomaticPlaceholders"],
|
|
429
|
+
apply: (e, t) => A(m(e, t), t)
|
|
430
|
+
},
|
|
431
|
+
mapToWidget: (e) => ({
|
|
432
|
+
uid: e.uid ?? "",
|
|
433
|
+
kind: "input",
|
|
434
|
+
type: "datePicker",
|
|
435
|
+
path: e.path ?? "",
|
|
436
|
+
...e.label != null ? { label: e.label } : {},
|
|
437
|
+
...e.disabled != null ? { disabled: e.disabled } : {},
|
|
438
|
+
...e.readonly != null ? { readonly: e.readonly } : {},
|
|
439
|
+
...e.validator != null ? { validator: g(e.validator, "string") } : {},
|
|
440
|
+
props: b(e)
|
|
441
|
+
})
|
|
442
|
+
}), { gsl: mt, gslByUid: ht } = c({
|
|
443
|
+
itemType: "RANGE_CALENDAR",
|
|
444
|
+
entryShape: "keyed",
|
|
445
|
+
sensibleDefaults: {
|
|
446
|
+
base: { suppressAutomaticLabels: !1 },
|
|
447
|
+
fields: ["suppressAutomaticLabels"],
|
|
448
|
+
apply: (e, t) => m(e, t)
|
|
449
|
+
},
|
|
450
|
+
mapToWidget: (e) => ({
|
|
451
|
+
uid: e.uid ?? "",
|
|
452
|
+
kind: "input",
|
|
453
|
+
type: "rangeCalendar",
|
|
454
|
+
path: e.path ?? "",
|
|
455
|
+
...e.label != null ? { label: e.label } : {},
|
|
456
|
+
...e.disabled != null ? { disabled: e.disabled } : {},
|
|
457
|
+
...e.readonly != null ? { readonly: e.readonly } : {},
|
|
458
|
+
...e.validator != null ? { validator: g(e.validator, "array") } : {},
|
|
459
|
+
props: b(e)
|
|
460
|
+
})
|
|
461
|
+
}), { gsl: gt, gslByUid: Tt } = c({
|
|
462
|
+
itemType: "RANGE_DATE_INPUT",
|
|
463
|
+
entryShape: "keyed",
|
|
464
|
+
sensibleDefaults: {
|
|
465
|
+
base: { suppressAutomaticLabels: !1 },
|
|
466
|
+
fields: ["suppressAutomaticLabels"],
|
|
467
|
+
apply: (e, t) => m(e, t)
|
|
468
|
+
},
|
|
469
|
+
mapToWidget: (e) => ({
|
|
470
|
+
uid: e.uid ?? "",
|
|
471
|
+
kind: "input",
|
|
472
|
+
type: "rangeDateInput",
|
|
473
|
+
path: e.path ?? "",
|
|
474
|
+
...e.label != null ? { label: e.label } : {},
|
|
475
|
+
...e.disabled != null ? { disabled: e.disabled } : {},
|
|
476
|
+
...e.readonly != null ? { readonly: e.readonly } : {},
|
|
477
|
+
...e.validator != null ? { validator: g(e.validator, "array") } : {},
|
|
478
|
+
props: b(e)
|
|
479
|
+
})
|
|
480
|
+
}), { gsl: St, gslByUid: At } = c({
|
|
481
|
+
itemType: "RANGE_DATE_PICKER",
|
|
482
|
+
entryShape: "keyed",
|
|
483
|
+
sensibleDefaults: {
|
|
484
|
+
base: {
|
|
485
|
+
suppressAutomaticLabels: !1,
|
|
486
|
+
suppressAutomaticPlaceholders: !1
|
|
487
|
+
},
|
|
488
|
+
fields: ["suppressAutomaticLabels", "suppressAutomaticPlaceholders"],
|
|
489
|
+
apply: (e, t) => A(m(e, t), t)
|
|
490
|
+
},
|
|
491
|
+
mapToWidget: (e) => ({
|
|
492
|
+
uid: e.uid ?? "",
|
|
493
|
+
kind: "input",
|
|
494
|
+
type: "rangeDatePicker",
|
|
495
|
+
path: e.path ?? "",
|
|
496
|
+
...e.label != null ? { label: e.label } : {},
|
|
497
|
+
...e.disabled != null ? { disabled: e.disabled } : {},
|
|
498
|
+
...e.readonly != null ? { readonly: e.readonly } : {},
|
|
499
|
+
...e.validator != null ? { validator: g(e.validator, "array") } : {},
|
|
500
|
+
props: b(e)
|
|
501
|
+
})
|
|
502
|
+
});
|
|
503
|
+
function Q(e) {
|
|
504
|
+
const t = {};
|
|
505
|
+
return e.addLabel != null && (t.addLabel = e.addLabel), e.removeLabel != null && (t.removeLabel = e.removeLabel), e.limit != null && (t.limit = e.limit), e.title != null && (t.title = e.title), e.addButtonIcon != null && (t.addButtonIcon = e.addButtonIcon), e.removeButtonIcon != null && (t.removeButtonIcon = e.removeButtonIcon), t;
|
|
506
|
+
}
|
|
507
|
+
function ee(e) {
|
|
508
|
+
return {
|
|
509
|
+
uid: e.uid ?? "",
|
|
510
|
+
kind: "input",
|
|
511
|
+
type: "repeater",
|
|
512
|
+
path: e.path ?? "",
|
|
513
|
+
...e.label != null ? { label: e.label } : {},
|
|
514
|
+
...e.disabled != null ? { disabled: e.disabled } : {},
|
|
515
|
+
...e.readonly != null ? { readonly: e.readonly } : {},
|
|
516
|
+
...e.validator != null ? { validator: g(e.validator, "array") } : {},
|
|
517
|
+
props: {
|
|
518
|
+
...Q(e),
|
|
519
|
+
template: { kind: "layout", type: "flex", children: [], props: { direction: "column" } }
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
function L(e, t) {
|
|
524
|
+
for (const s of e) {
|
|
525
|
+
if (typeof s == "function") continue;
|
|
526
|
+
const a = s;
|
|
527
|
+
typeof a.path == "string" && a.path && (a.path = t + a.path), "children" in a && Array.isArray(a.children) && L(a.children, t);
|
|
528
|
+
const l = a.props;
|
|
529
|
+
l?.template?.children && Array.isArray(l.template.children) && L(l.template.children, t);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
function te(e, t) {
|
|
533
|
+
const s = t.walkChildren(t.children ?? []), a = e.kind === "static" ? e.def.path ?? "" : e.fn({})?.path ?? "";
|
|
534
|
+
a && L(s, a + ".items.");
|
|
535
|
+
const l = {
|
|
536
|
+
kind: "layout",
|
|
537
|
+
type: "flex",
|
|
538
|
+
uid: "",
|
|
539
|
+
children: s,
|
|
540
|
+
props: { direction: "column" }
|
|
541
|
+
};
|
|
542
|
+
if (e.kind === "static") {
|
|
543
|
+
const i = t.mapStaticDef(e.def, "REPEATER");
|
|
544
|
+
return {
|
|
545
|
+
...i,
|
|
546
|
+
props: { ...i.props, template: l }
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
const n = e.fn;
|
|
550
|
+
return ((i) => {
|
|
551
|
+
const o = n(i), r = t.mapStaticDef(o, "REPEATER");
|
|
552
|
+
return {
|
|
553
|
+
...r,
|
|
554
|
+
props: { ...r.props, template: l }
|
|
555
|
+
};
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
function se(e) {
|
|
559
|
+
return {
|
|
560
|
+
baseDef: e.def,
|
|
561
|
+
path: e.key,
|
|
562
|
+
children: e.children
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
function le(e) {
|
|
566
|
+
return e.children;
|
|
567
|
+
}
|
|
568
|
+
const ae = {
|
|
569
|
+
parseEntry: se,
|
|
570
|
+
rollUpSensibleDefaults: () => ({}),
|
|
571
|
+
applySensibleDefaults: (e) => e,
|
|
572
|
+
mapToWidget: ee,
|
|
573
|
+
buildCustomWidget: te,
|
|
574
|
+
getChildren: le
|
|
575
|
+
};
|
|
576
|
+
x("REPEATER", ae);
|
|
577
|
+
const ne = R("REPEATER"), kt = (e, t) => ne(t, ((s) => s.uid === e)), j = {
|
|
578
|
+
onLoad: "load",
|
|
579
|
+
onChange: "change",
|
|
580
|
+
onFilter: "filter",
|
|
581
|
+
onBlur: "blur"
|
|
582
|
+
}, ie = Object.keys(j);
|
|
583
|
+
class re {
|
|
584
|
+
// ── Action-specific: onClick + submit ─────────────────────────
|
|
585
|
+
extractOnClickFromMergeResult(t, s, a, l) {
|
|
586
|
+
if (t.kind === "dynamic") {
|
|
587
|
+
const o = t.fn;
|
|
588
|
+
return { kind: "dynamic", fn: (u) => {
|
|
589
|
+
const p = o(u);
|
|
590
|
+
return this.wireOnClick(p, s, a, l);
|
|
591
|
+
} };
|
|
592
|
+
}
|
|
593
|
+
const n = t.def;
|
|
594
|
+
return { kind: "static", def: this.wireOnClick(n, s, a, l) };
|
|
595
|
+
}
|
|
596
|
+
wireOnClick(t, s, a, l) {
|
|
597
|
+
const n = t.uid === "#submit" || t.onClick === "submit", i = n ? "#submit" : l.next(), o = n ? "submit" : i, r = t.onClick, p = (typeof r == "function" ? r : void 0) ?? (n ? a.onSubmit : void 0);
|
|
598
|
+
if (p) {
|
|
599
|
+
s.set(o, (T) => p(T.data));
|
|
600
|
+
const { onClick: y, ...d } = t;
|
|
601
|
+
return { ...d, uid: i, on: { click: o } };
|
|
602
|
+
}
|
|
603
|
+
if (n) {
|
|
604
|
+
const { onClick: y, ...d } = t;
|
|
605
|
+
return { ...d, uid: i, on: { click: "submit" } };
|
|
606
|
+
}
|
|
607
|
+
if (typeof r == "string") {
|
|
608
|
+
const { onClick: y, ...d } = t;
|
|
609
|
+
return { ...d, uid: i, on: { click: r } };
|
|
610
|
+
}
|
|
611
|
+
return { ...t, uid: i };
|
|
612
|
+
}
|
|
613
|
+
// ── Universal: onLoad, onChange, onFilter ──────────────────────
|
|
614
|
+
wireInputLayoutEvents(t, s, a) {
|
|
615
|
+
if (t.kind === "dynamic") {
|
|
616
|
+
const n = t.fn;
|
|
617
|
+
return { kind: "dynamic", fn: (o) => {
|
|
618
|
+
const r = n(o);
|
|
619
|
+
return this.wireEventProperties(r, s, a);
|
|
620
|
+
} };
|
|
621
|
+
}
|
|
622
|
+
return { kind: "static", def: this.wireEventProperties(t.def, s, a) };
|
|
623
|
+
}
|
|
624
|
+
wireEventProperties(t, s, a) {
|
|
625
|
+
const l = { ...t.on || {} };
|
|
626
|
+
let n = !1;
|
|
627
|
+
const i = { ...t };
|
|
628
|
+
for (const o of ie) {
|
|
629
|
+
const r = t[o];
|
|
630
|
+
if (r == null) continue;
|
|
631
|
+
const u = j[o];
|
|
632
|
+
if (typeof r == "function") {
|
|
633
|
+
const p = a.next();
|
|
634
|
+
s.set(p, r), l[u] = p, n = !0;
|
|
635
|
+
} else typeof r == "string" && (l[u] = r, n = !0);
|
|
636
|
+
delete i[o];
|
|
637
|
+
}
|
|
638
|
+
return n && (i.on = l), i;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
const E = new re();
|
|
642
|
+
function oe(e) {
|
|
643
|
+
const {
|
|
644
|
+
uid: t,
|
|
645
|
+
label: s,
|
|
646
|
+
disabled: a,
|
|
647
|
+
on: l,
|
|
648
|
+
onClick: n,
|
|
649
|
+
data: i,
|
|
650
|
+
type: o,
|
|
651
|
+
tags: r,
|
|
652
|
+
size: u,
|
|
653
|
+
include: p,
|
|
654
|
+
exclude: y,
|
|
655
|
+
states: d,
|
|
656
|
+
...T
|
|
657
|
+
} = e;
|
|
658
|
+
return {
|
|
659
|
+
uid: t ?? "",
|
|
660
|
+
kind: "action",
|
|
661
|
+
type: "button",
|
|
662
|
+
disabled: a,
|
|
663
|
+
label: s,
|
|
664
|
+
...l != null ? { on: l } : {},
|
|
665
|
+
props: T
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
const { gsl: _t, gslByUid: vt } = c({
|
|
669
|
+
itemType: "ACTIONS",
|
|
670
|
+
entryShape: "bare",
|
|
671
|
+
mapToWidget: oe,
|
|
672
|
+
afterMerge: (e, t) => E.extractOnClickFromMergeResult(
|
|
673
|
+
e,
|
|
674
|
+
t.eventRegistry,
|
|
675
|
+
t.formConfig,
|
|
676
|
+
t.eventIdGenerator
|
|
677
|
+
)
|
|
678
|
+
});
|
|
679
|
+
function ue(e) {
|
|
680
|
+
const {
|
|
681
|
+
uid: t,
|
|
682
|
+
widgetName: s,
|
|
683
|
+
tags: a,
|
|
684
|
+
size: l,
|
|
685
|
+
onChange: n,
|
|
686
|
+
include: i,
|
|
687
|
+
exclude: o,
|
|
688
|
+
...r
|
|
689
|
+
} = e, { on: u, ...p } = r;
|
|
690
|
+
return {
|
|
691
|
+
uid: t ?? "",
|
|
692
|
+
kind: "layout",
|
|
693
|
+
type: s ?? "flex",
|
|
694
|
+
props: {
|
|
695
|
+
direction: p.direction ?? "column",
|
|
696
|
+
...p
|
|
697
|
+
},
|
|
698
|
+
children: []
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
function pe(e, t) {
|
|
702
|
+
const s = t.walkChildren(t.children ?? []);
|
|
703
|
+
if (e.kind === "static")
|
|
704
|
+
return { ...t.mapStaticDef(e.def, "LAYOUTS"), children: s };
|
|
705
|
+
const a = e.fn;
|
|
706
|
+
return ((l) => {
|
|
707
|
+
const n = a(l);
|
|
708
|
+
return { ...t.mapStaticDef(n, "LAYOUTS"), children: s };
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
function ce(e) {
|
|
712
|
+
return e.children;
|
|
713
|
+
}
|
|
714
|
+
const { gsl: Ct, gslByUid: ft } = c({
|
|
715
|
+
itemType: "LAYOUTS",
|
|
716
|
+
entryShape: "compound",
|
|
717
|
+
mapToWidget: ue,
|
|
718
|
+
buildCustomWidget: pe,
|
|
719
|
+
getChildren: ce
|
|
720
|
+
});
|
|
721
|
+
function de(e) {
|
|
722
|
+
return {
|
|
723
|
+
uid: "",
|
|
724
|
+
kind: "display",
|
|
725
|
+
type: "renderer",
|
|
726
|
+
props: { render: e.render }
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
function ye(e, t) {
|
|
730
|
+
if (e.kind === "static") {
|
|
731
|
+
const a = e.def;
|
|
732
|
+
return ((l) => ({
|
|
733
|
+
uid: "",
|
|
734
|
+
kind: "display",
|
|
735
|
+
type: "renderer",
|
|
736
|
+
...a.include != null ? { include: a.include } : {},
|
|
737
|
+
...a.exclude != null ? { exclude: a.exclude } : {},
|
|
738
|
+
props: { render: a.render(l ?? {}) }
|
|
739
|
+
}));
|
|
740
|
+
}
|
|
741
|
+
const s = e.fn;
|
|
742
|
+
return ((a) => {
|
|
743
|
+
const l = s(a);
|
|
744
|
+
return {
|
|
745
|
+
uid: "",
|
|
746
|
+
kind: "display",
|
|
747
|
+
type: "renderer",
|
|
748
|
+
...l.include != null ? { include: l.include } : {},
|
|
749
|
+
...l.exclude != null ? { exclude: l.exclude } : {},
|
|
750
|
+
props: { render: l.render(a ?? {}) }
|
|
751
|
+
};
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
const { gsl: Ut, gslByUid: Ot } = c({
|
|
755
|
+
itemType: "DISPLAYS",
|
|
756
|
+
entryShape: "bare",
|
|
757
|
+
mapToWidget: de,
|
|
758
|
+
buildCustomWidget: ye
|
|
759
|
+
}), { gsl: Lt, gslByUid: Et } = c({
|
|
760
|
+
itemType: "ALERTS",
|
|
761
|
+
entryShape: "bare",
|
|
762
|
+
mapToWidget: (e) => ({
|
|
763
|
+
uid: e.uid ?? "",
|
|
764
|
+
kind: "display",
|
|
765
|
+
type: "alert",
|
|
766
|
+
props: {
|
|
767
|
+
text: e.text,
|
|
768
|
+
...e.level != null ? { level: e.level } : {}
|
|
769
|
+
}
|
|
770
|
+
})
|
|
771
|
+
});
|
|
772
|
+
function be(e) {
|
|
773
|
+
return {
|
|
774
|
+
uid: e.uid ?? "",
|
|
775
|
+
kind: "layout",
|
|
776
|
+
type: "tabs",
|
|
777
|
+
props: {
|
|
778
|
+
tabs: e.tabs,
|
|
779
|
+
renderMode: e.renderMode ?? "all",
|
|
780
|
+
...e.defaultOpen != null ? { defaultOpen: e.defaultOpen } : {}
|
|
781
|
+
},
|
|
782
|
+
children: []
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
function me(e, t) {
|
|
786
|
+
const s = t.walkChildren(t.children ?? []);
|
|
787
|
+
if (e.kind === "static")
|
|
788
|
+
return { ...t.mapStaticDef(e.def, "TABS"), children: s };
|
|
789
|
+
const a = e.fn;
|
|
790
|
+
return ((l) => {
|
|
791
|
+
const n = a(l);
|
|
792
|
+
return { ...t.mapStaticDef(n, "TABS"), children: s };
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
function he(e) {
|
|
796
|
+
return e.children;
|
|
797
|
+
}
|
|
798
|
+
const { gsl: Dt, gslByUid: Pt } = c({
|
|
799
|
+
itemType: "TABS",
|
|
800
|
+
entryShape: "compound",
|
|
801
|
+
mapToWidget: be,
|
|
802
|
+
buildCustomWidget: me,
|
|
803
|
+
getChildren: he
|
|
804
|
+
});
|
|
805
|
+
function ge(e) {
|
|
806
|
+
return {
|
|
807
|
+
uid: e.uid ?? "",
|
|
808
|
+
kind: "layout",
|
|
809
|
+
type: "accordion",
|
|
810
|
+
props: {
|
|
811
|
+
sections: e.sections,
|
|
812
|
+
renderMode: e.renderMode ?? "all",
|
|
813
|
+
...e.singleOpen != null ? { singleOpen: e.singleOpen } : {},
|
|
814
|
+
...e.defaultOpen != null ? { defaultOpen: e.defaultOpen } : {}
|
|
815
|
+
},
|
|
816
|
+
children: []
|
|
817
|
+
};
|
|
818
|
+
}
|
|
819
|
+
function Te(e, t) {
|
|
820
|
+
const s = t.walkChildren(t.children ?? []);
|
|
821
|
+
if (e.kind === "static")
|
|
822
|
+
return { ...t.mapStaticDef(e.def, "ACCORDION"), children: s };
|
|
823
|
+
const a = e.fn;
|
|
824
|
+
return ((l) => {
|
|
825
|
+
const n = a(l);
|
|
826
|
+
return { ...t.mapStaticDef(n, "ACCORDION"), children: s };
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
function Se(e) {
|
|
830
|
+
return e.children;
|
|
831
|
+
}
|
|
832
|
+
const { gsl: It, gslByUid: Wt } = c({
|
|
833
|
+
itemType: "ACCORDION",
|
|
834
|
+
entryShape: "compound",
|
|
835
|
+
mapToWidget: ge,
|
|
836
|
+
buildCustomWidget: Te,
|
|
837
|
+
getChildren: Se
|
|
838
|
+
}), { gsl: wt, gslByUid: Bt } = c({
|
|
839
|
+
itemType: "CUSTOM_INPUT",
|
|
840
|
+
entryShape: "keyed",
|
|
841
|
+
sensibleDefaults: {
|
|
842
|
+
base: {
|
|
843
|
+
suppressAutomaticLabels: !1
|
|
844
|
+
},
|
|
845
|
+
fields: ["suppressAutomaticLabels"],
|
|
846
|
+
apply: (e, t) => m(e, t)
|
|
847
|
+
},
|
|
848
|
+
mapToWidget: (e) => ({
|
|
849
|
+
uid: e.uid ?? "",
|
|
850
|
+
kind: "input",
|
|
851
|
+
type: e.customType,
|
|
852
|
+
path: e.path ?? "",
|
|
853
|
+
...e.label != null ? { label: e.label } : {},
|
|
854
|
+
...e.disabled != null ? { disabled: e.disabled } : {},
|
|
855
|
+
...e.readonly != null ? { readonly: e.readonly } : {},
|
|
856
|
+
...e.defaultValue != null ? { defaultValue: e.defaultValue } : {},
|
|
857
|
+
...e.validator != null ? { validator: e.validator } : {},
|
|
858
|
+
props: e.props ?? {}
|
|
859
|
+
})
|
|
860
|
+
}), { gsl: Mt, gslByUid: Nt } = c({
|
|
861
|
+
itemType: "CUSTOM_ACTION",
|
|
862
|
+
entryShape: "bare",
|
|
863
|
+
mapToWidget: (e) => {
|
|
864
|
+
const {
|
|
865
|
+
uid: t,
|
|
866
|
+
label: s,
|
|
867
|
+
disabled: a,
|
|
868
|
+
on: l,
|
|
869
|
+
onClick: n,
|
|
870
|
+
data: i,
|
|
871
|
+
customType: o,
|
|
872
|
+
tags: r,
|
|
873
|
+
size: u,
|
|
874
|
+
include: p,
|
|
875
|
+
exclude: y,
|
|
876
|
+
states: d,
|
|
877
|
+
props: T,
|
|
878
|
+
..._
|
|
879
|
+
} = e;
|
|
880
|
+
return {
|
|
881
|
+
uid: t ?? "",
|
|
882
|
+
kind: "action",
|
|
883
|
+
type: e.customType,
|
|
884
|
+
label: s,
|
|
885
|
+
disabled: a,
|
|
886
|
+
...l != null ? { on: l } : {},
|
|
887
|
+
props: { ...T, ..._ }
|
|
888
|
+
};
|
|
889
|
+
},
|
|
890
|
+
afterMerge: (e, t) => E.extractOnClickFromMergeResult(
|
|
891
|
+
e,
|
|
892
|
+
t.eventRegistry,
|
|
893
|
+
t.formConfig,
|
|
894
|
+
t.eventIdGenerator
|
|
895
|
+
)
|
|
896
|
+
}), { gsl: Rt, gslByUid: xt } = c({
|
|
897
|
+
itemType: "CUSTOM_DISPLAY",
|
|
898
|
+
entryShape: "bare",
|
|
899
|
+
mapToWidget: (e) => ({
|
|
900
|
+
uid: e.uid ?? "",
|
|
901
|
+
kind: "display",
|
|
902
|
+
type: e.customType,
|
|
903
|
+
props: e.props ?? {}
|
|
904
|
+
})
|
|
905
|
+
});
|
|
906
|
+
function Ae(e) {
|
|
907
|
+
return {
|
|
908
|
+
uid: e.uid ?? "",
|
|
909
|
+
kind: "layout",
|
|
910
|
+
type: e.customType,
|
|
911
|
+
props: e.props ?? {},
|
|
912
|
+
children: []
|
|
913
|
+
};
|
|
914
|
+
}
|
|
915
|
+
function ke(e, t) {
|
|
916
|
+
const s = t.walkChildren(t.children ?? []);
|
|
917
|
+
if (e.kind === "static")
|
|
918
|
+
return { ...t.mapStaticDef(e.def, "CUSTOM_LAYOUT"), children: s };
|
|
919
|
+
const a = e.fn;
|
|
920
|
+
return ((l) => {
|
|
921
|
+
const n = a(l);
|
|
922
|
+
return { ...t.mapStaticDef(n, "CUSTOM_LAYOUT"), children: s };
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
function _e(e) {
|
|
926
|
+
return e.children;
|
|
927
|
+
}
|
|
928
|
+
const { gsl: Ft, gslByUid: jt } = c({
|
|
929
|
+
itemType: "CUSTOM_LAYOUT",
|
|
930
|
+
entryShape: "compound",
|
|
931
|
+
mapToWidget: Ae,
|
|
932
|
+
buildCustomWidget: ke,
|
|
933
|
+
getChildren: _e
|
|
934
|
+
}), $ = {
|
|
935
|
+
INPUTS: /* @__PURE__ */ new Set([
|
|
936
|
+
"INPUTS",
|
|
937
|
+
"TEXTAREA",
|
|
938
|
+
"PASSWORD",
|
|
939
|
+
"SELECT",
|
|
940
|
+
"DROPDOWN",
|
|
941
|
+
"RADIOGROUP",
|
|
942
|
+
"CHECKBOX",
|
|
943
|
+
"CALENDAR",
|
|
944
|
+
"DATE_INPUT",
|
|
945
|
+
"DATE_PICKER",
|
|
946
|
+
"RANGE_CALENDAR",
|
|
947
|
+
"RANGE_DATE_INPUT",
|
|
948
|
+
"RANGE_DATE_PICKER",
|
|
949
|
+
"CURRENCY",
|
|
950
|
+
"MARKDOWN",
|
|
951
|
+
"LIST",
|
|
952
|
+
"CUSTOM_INPUT",
|
|
953
|
+
"REPEATER"
|
|
954
|
+
]),
|
|
955
|
+
ACTIONS: /* @__PURE__ */ new Set(["ACTIONS", "CUSTOM_ACTION"]),
|
|
956
|
+
DISPLAYS: /* @__PURE__ */ new Set(["DISPLAYS", "ALERTS", "CUSTOM_DISPLAY"]),
|
|
957
|
+
LAYOUTS: /* @__PURE__ */ new Set(["LAYOUTS", "TABS", "ACCORDION", "CUSTOM_LAYOUT"])
|
|
958
|
+
};
|
|
959
|
+
function ve(e, t) {
|
|
960
|
+
const s = $[e];
|
|
961
|
+
return s ? s.has(t) : e === t;
|
|
962
|
+
}
|
|
963
|
+
class Ce {
|
|
964
|
+
resolve(t, s) {
|
|
965
|
+
const a = [];
|
|
966
|
+
for (const n of s)
|
|
967
|
+
n.kind === "aggregated" ? this.collectFromAggregated(n, t, a) : this.collectFromLeaf(n, t, a);
|
|
968
|
+
const l = this.rollUpSensibleDefaults(a);
|
|
969
|
+
return {
|
|
970
|
+
leafSelectors: a,
|
|
971
|
+
sensibleDefaults: l
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
collectFromAggregated(t, s, a) {
|
|
975
|
+
if (t.matcher(s))
|
|
976
|
+
for (const l of t.children)
|
|
977
|
+
this.collectFromLeaf(l, s, a);
|
|
978
|
+
}
|
|
979
|
+
collectFromLeaf(t, s, a) {
|
|
980
|
+
ve(t.selectorType, s.itemType ?? "") && t.matcher(s) && a.push(t);
|
|
981
|
+
}
|
|
982
|
+
rollUpSensibleDefaults(t) {
|
|
983
|
+
const s = /* @__PURE__ */ new Map(), a = (n, i) => {
|
|
984
|
+
const o = s.get(n) ?? [];
|
|
985
|
+
o.push(i), s.set(n, o);
|
|
986
|
+
};
|
|
987
|
+
for (const n of t) {
|
|
988
|
+
const i = $[n.selectorType];
|
|
989
|
+
if (i)
|
|
990
|
+
for (const o of i) a(o, n);
|
|
991
|
+
else
|
|
992
|
+
a(n.selectorType, n);
|
|
993
|
+
}
|
|
994
|
+
const l = {};
|
|
995
|
+
for (const [n, i] of s)
|
|
996
|
+
F(n) && (l[n] = f(n).rollUpSensibleDefaults(i));
|
|
997
|
+
return l;
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
const fe = new Ce();
|
|
1001
|
+
class Ue {
|
|
1002
|
+
constructor(t) {
|
|
1003
|
+
this.objectUtils = t;
|
|
1004
|
+
}
|
|
1005
|
+
merge(t, s, a) {
|
|
1006
|
+
let l = {}, n = null;
|
|
1007
|
+
typeof t == "function" && (n = t);
|
|
1008
|
+
const i = this.collectDecorators(a);
|
|
1009
|
+
for (const u of i) {
|
|
1010
|
+
if (n != null) {
|
|
1011
|
+
n = this.composeRuntimeFunctions(n, u);
|
|
1012
|
+
continue;
|
|
1013
|
+
}
|
|
1014
|
+
if (typeof u == "function") {
|
|
1015
|
+
const p = u({
|
|
1016
|
+
...l,
|
|
1017
|
+
...typeof t == "function" ? {} : t
|
|
1018
|
+
});
|
|
1019
|
+
if (typeof p == "function") {
|
|
1020
|
+
n = this.createPromotedFunction(
|
|
1021
|
+
l,
|
|
1022
|
+
t,
|
|
1023
|
+
p,
|
|
1024
|
+
s,
|
|
1025
|
+
a
|
|
1026
|
+
);
|
|
1027
|
+
continue;
|
|
1028
|
+
}
|
|
1029
|
+
l = this.objectUtils.deepMerge(l, p);
|
|
1030
|
+
} else
|
|
1031
|
+
l = this.objectUtils.deepMerge(l, u);
|
|
1032
|
+
}
|
|
1033
|
+
if (n != null)
|
|
1034
|
+
return {
|
|
1035
|
+
kind: "dynamic",
|
|
1036
|
+
fn: this.wrapWithSensibleDefaults(n, l, s, a)
|
|
1037
|
+
};
|
|
1038
|
+
const o = this.objectUtils.deepMerge(t, l);
|
|
1039
|
+
return { kind: "static", def: this.applySensibleDefaults({ ...o }, s, a) };
|
|
1040
|
+
}
|
|
1041
|
+
// ── Collect all decorators in priority order ──
|
|
1042
|
+
collectDecorators(t) {
|
|
1043
|
+
const s = [];
|
|
1044
|
+
for (const a of t.leafSelectors) {
|
|
1045
|
+
const l = a.config;
|
|
1046
|
+
l.override != null && s.push(l.override);
|
|
1047
|
+
}
|
|
1048
|
+
return s;
|
|
1049
|
+
}
|
|
1050
|
+
// ── Apply sensible defaults via registry ──
|
|
1051
|
+
applySensibleDefaults(t, s, a) {
|
|
1052
|
+
if (!F(s)) return t;
|
|
1053
|
+
const l = a.sensibleDefaults[s] ?? {};
|
|
1054
|
+
return f(s).applySensibleDefaults(t, l);
|
|
1055
|
+
}
|
|
1056
|
+
// ── Create promoted FunctionWidget ──
|
|
1057
|
+
createPromotedFunction(t, s, a, l, n) {
|
|
1058
|
+
return (i) => {
|
|
1059
|
+
const o = a(i);
|
|
1060
|
+
let r = this.objectUtils.deepMerge(t, o);
|
|
1061
|
+
return r = this.objectUtils.deepMerge(r, s), this.applySensibleDefaults(r, l, n);
|
|
1062
|
+
};
|
|
1063
|
+
}
|
|
1064
|
+
// ── Wrap runtime function with accumulated static decorators and sensible defaults ──
|
|
1065
|
+
wrapWithSensibleDefaults(t, s, a, l) {
|
|
1066
|
+
return (n) => {
|
|
1067
|
+
let i = t(n);
|
|
1068
|
+
return Object.keys(s).length > 0 && (i = this.objectUtils.deepMerge(s, i)), this.applySensibleDefaults(i, a, l);
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
// ── Compose two runtime functions ──
|
|
1072
|
+
composeRuntimeFunctions(t, s) {
|
|
1073
|
+
return typeof s == "function" ? (a) => {
|
|
1074
|
+
const l = t(a), n = s(l);
|
|
1075
|
+
return typeof n == "function" ? n(a) : this.objectUtils.deepMerge(n, l);
|
|
1076
|
+
} : (a) => {
|
|
1077
|
+
const l = t(a);
|
|
1078
|
+
return this.objectUtils.deepMerge(l, s);
|
|
1079
|
+
};
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
const Oe = new Ue(V);
|
|
1083
|
+
class Le {
|
|
1084
|
+
mapToWidget(t, s) {
|
|
1085
|
+
if (t.kind === "dynamic") {
|
|
1086
|
+
const a = t.fn;
|
|
1087
|
+
return ((l) => {
|
|
1088
|
+
const n = a(l);
|
|
1089
|
+
return this.mapStaticDef(n, s);
|
|
1090
|
+
});
|
|
1091
|
+
}
|
|
1092
|
+
return this.mapStaticDef(t.def, s);
|
|
1093
|
+
}
|
|
1094
|
+
mapStaticDef(t, s) {
|
|
1095
|
+
const a = f(s).mapToWidget(t);
|
|
1096
|
+
return this.applyBaseWidgetFields(a, t);
|
|
1097
|
+
}
|
|
1098
|
+
/**
|
|
1099
|
+
* Injects BaseWidget-level fields that all widget types share.
|
|
1100
|
+
* Centralized here so individual mappers don't need to repeat the pattern.
|
|
1101
|
+
*/
|
|
1102
|
+
applyBaseWidgetFields(t, s) {
|
|
1103
|
+
return s.size != null && (t.size = s.size), s.defaultValue != null && t.kind === "input" && (t.defaultValue = s.defaultValue), s.on != null && (t.on = s.on), s.include != null && (t.include = s.include), s.exclude != null && (t.exclude = s.exclude), t;
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
const Ee = new Le();
|
|
1107
|
+
class De {
|
|
1108
|
+
/**
|
|
1109
|
+
* Ensures the output is always a uniform GslSelector[] of aggregated selectors.
|
|
1110
|
+
*
|
|
1111
|
+
* Callers can pass flat leaf selectors (single styling rules) or pre-grouped
|
|
1112
|
+
* aggregated selectors. This method separates them into two buckets, then wraps
|
|
1113
|
+
* any bare leaves into a catch-all aggregated selector so downstream code only
|
|
1114
|
+
* deals with one shape.
|
|
1115
|
+
*/
|
|
1116
|
+
normalizeSelectors(t) {
|
|
1117
|
+
const s = Array.isArray(t) ? t : [t], a = [], l = [];
|
|
1118
|
+
for (const n of s)
|
|
1119
|
+
n.kind === "leaf" ? l.push(n) : a.push(n);
|
|
1120
|
+
return l.length > 0 && a.unshift({
|
|
1121
|
+
kind: "aggregated",
|
|
1122
|
+
matcher: () => !0,
|
|
1123
|
+
children: l
|
|
1124
|
+
}), a;
|
|
1125
|
+
}
|
|
1126
|
+
extractFormConfig() {
|
|
1127
|
+
return {
|
|
1128
|
+
suppressAutomaticStack: !1,
|
|
1129
|
+
onSubmit: (t) => console.log("Form submitted:", t)
|
|
1130
|
+
};
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
const Pe = new De(), Ie = {
|
|
1134
|
+
input: /* @__PURE__ */ new Set(["disabled", "readonly", "label", "validator", "size"]),
|
|
1135
|
+
action: /* @__PURE__ */ new Set(["disabled", "label", "size"]),
|
|
1136
|
+
layout: /* @__PURE__ */ new Set(["size"]),
|
|
1137
|
+
display: /* @__PURE__ */ new Set([])
|
|
1138
|
+
}, W = {
|
|
1139
|
+
onChange: "change",
|
|
1140
|
+
onLoad: "load",
|
|
1141
|
+
onFilter: "filter",
|
|
1142
|
+
onClick: "click"
|
|
1143
|
+
};
|
|
1144
|
+
class We {
|
|
1145
|
+
/**
|
|
1146
|
+
* Extracts `states` from a merge result, combining with state-targeted
|
|
1147
|
+
* GSL leaf selectors from `_gslStates`.
|
|
1148
|
+
*
|
|
1149
|
+
* Returns a cleaned merge result (no states) and accumulated state data.
|
|
1150
|
+
*/
|
|
1151
|
+
extractFromMergeResult(t, s) {
|
|
1152
|
+
const a = {};
|
|
1153
|
+
for (const o of s) {
|
|
1154
|
+
const r = o.targetState, u = o.config, p = u.override && typeof u.override != "function" ? u.override : u;
|
|
1155
|
+
a[r] = {
|
|
1156
|
+
...a[r] || {},
|
|
1157
|
+
...p
|
|
1158
|
+
};
|
|
1159
|
+
}
|
|
1160
|
+
if (t.kind === "dynamic") {
|
|
1161
|
+
const o = t.fn;
|
|
1162
|
+
return {
|
|
1163
|
+
cleanedResult: { kind: "dynamic", fn: (u) => {
|
|
1164
|
+
const p = o(u), { states: y, ...d } = p;
|
|
1165
|
+
return d;
|
|
1166
|
+
} },
|
|
1167
|
+
stateData: { stateOverrides: a }
|
|
1168
|
+
};
|
|
1169
|
+
}
|
|
1170
|
+
const { states: l, ...n } = t.def, i = {};
|
|
1171
|
+
for (const [o, r] of Object.entries(a))
|
|
1172
|
+
i[o] = { ...r };
|
|
1173
|
+
if (l)
|
|
1174
|
+
for (const [o, r] of Object.entries(
|
|
1175
|
+
l
|
|
1176
|
+
))
|
|
1177
|
+
i[o] = { ...i[o] || {}, ...r };
|
|
1178
|
+
return {
|
|
1179
|
+
cleanedResult: { kind: "static", def: n },
|
|
1180
|
+
stateData: { stateOverrides: i }
|
|
1181
|
+
};
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* Applies state overrides to a core widget. Each override produces:
|
|
1185
|
+
* - `visible: true/false` → `include: { in }` / `exclude: { from }`
|
|
1186
|
+
* - Core suffixable props → `'prop.stateName': value` at widget root
|
|
1187
|
+
* - Event handlers → `on: { 'eventType.stateName': eventId }` with registry wiring
|
|
1188
|
+
* - Custom props → `props: { 'prop.stateName': value }`
|
|
1189
|
+
*/
|
|
1190
|
+
applyToWidget(t, s, a, l) {
|
|
1191
|
+
const { stateOverrides: n } = s;
|
|
1192
|
+
if (Object.keys(n).length === 0)
|
|
1193
|
+
return t;
|
|
1194
|
+
const i = { ...t }, o = t.kind, r = Ie[o] || /* @__PURE__ */ new Set();
|
|
1195
|
+
t.props && (i.props = { ...t.props }), t.on && (i.on = { ...t.on });
|
|
1196
|
+
for (const [u, p] of Object.entries(n))
|
|
1197
|
+
for (const [y, d] of Object.entries(p))
|
|
1198
|
+
y === "visible" ? this.applyVisibility(i, u, d) : W[y] ? this.applyStateEvent(i, u, y, d, a, l) : r.has(y) ? i[`${y}.${u}`] = d : (i.props || (i.props = {}), i.props[`${y}.${u}`] = d);
|
|
1199
|
+
return i;
|
|
1200
|
+
}
|
|
1201
|
+
hasStateData(t) {
|
|
1202
|
+
return Object.keys(t.stateOverrides).length > 0;
|
|
1203
|
+
}
|
|
1204
|
+
// ── Visibility helpers ──
|
|
1205
|
+
applyVisibility(t, s, a) {
|
|
1206
|
+
if (a) {
|
|
1207
|
+
const l = t.include?.in || [];
|
|
1208
|
+
t.include = { ...t.include || {}, in: [...l, s] };
|
|
1209
|
+
} else {
|
|
1210
|
+
const l = t.exclude?.from || [];
|
|
1211
|
+
t.exclude = { ...t.exclude || {}, from: [...l, s] };
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
// ── State-suffixed event helpers ──
|
|
1215
|
+
applyStateEvent(t, s, a, l, n, i) {
|
|
1216
|
+
const o = W[a];
|
|
1217
|
+
if (t.on || (t.on = {}), typeof l == "function") {
|
|
1218
|
+
const r = i.next();
|
|
1219
|
+
n.set(r, l), t.on[`${o}.${s}`] = r;
|
|
1220
|
+
} else typeof l == "string" && (t.on[`${o}.${s}`] = l);
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
const we = new We();
|
|
1224
|
+
function Be() {
|
|
1225
|
+
let e = 0;
|
|
1226
|
+
return { next: () => `event_${e++}` };
|
|
1227
|
+
}
|
|
1228
|
+
class Me {
|
|
1229
|
+
constructor(t, s, a, l, n) {
|
|
1230
|
+
this.resolver = t, this.merger = s, this.mapper = a, this.eventWiring = l, this.stateExpansion = n;
|
|
1231
|
+
}
|
|
1232
|
+
walkAndMap(t, s, a) {
|
|
1233
|
+
const l = /* @__PURE__ */ new Map(), n = Be(), i = { value: 0 }, o = /* @__PURE__ */ new Set();
|
|
1234
|
+
return { widgets: this.walkItems(
|
|
1235
|
+
t,
|
|
1236
|
+
s,
|
|
1237
|
+
l,
|
|
1238
|
+
a,
|
|
1239
|
+
n,
|
|
1240
|
+
i,
|
|
1241
|
+
o
|
|
1242
|
+
), eventRegistry: l };
|
|
1243
|
+
}
|
|
1244
|
+
walkItems(t, s, a, l, n, i, o) {
|
|
1245
|
+
return t.flatMap((r) => {
|
|
1246
|
+
if (r.type !== "ITEMS")
|
|
1247
|
+
throw new Error("Unexpected gui shortcut type");
|
|
1248
|
+
return r.items.map((u) => this.processItem(
|
|
1249
|
+
u,
|
|
1250
|
+
r.itemType,
|
|
1251
|
+
r.tags,
|
|
1252
|
+
s,
|
|
1253
|
+
a,
|
|
1254
|
+
l,
|
|
1255
|
+
n,
|
|
1256
|
+
i,
|
|
1257
|
+
o
|
|
1258
|
+
));
|
|
1259
|
+
});
|
|
1260
|
+
}
|
|
1261
|
+
processItem(t, s, a, l, n, i, o, r, u) {
|
|
1262
|
+
const p = s, y = f(s), d = y.parseEntry(t), T = this.buildBaseDef(d), _ = this.buildDecoratorForMatching(T, p, a), v = this.resolver.resolve(_, l), D = v.leafSelectors.filter((h) => h.targetState != null), P = {
|
|
1263
|
+
leafSelectors: v.leafSelectors.filter((h) => h.targetState == null),
|
|
1264
|
+
sensibleDefaults: v.sensibleDefaults
|
|
1265
|
+
};
|
|
1266
|
+
let k = this.merger.merge(T, p, P);
|
|
1267
|
+
y.afterMerge && (k = y.afterMerge(k, {
|
|
1268
|
+
eventRegistry: n,
|
|
1269
|
+
formConfig: i,
|
|
1270
|
+
eventIdGenerator: o
|
|
1271
|
+
})), k = this.eventWiring.wireInputLayoutEvents(
|
|
1272
|
+
k,
|
|
1273
|
+
n,
|
|
1274
|
+
o
|
|
1275
|
+
);
|
|
1276
|
+
const { cleanedResult: I, stateData: U } = this.stateExpansion.extractFromMergeResult(
|
|
1277
|
+
k,
|
|
1278
|
+
D
|
|
1279
|
+
);
|
|
1280
|
+
let S;
|
|
1281
|
+
if (y.buildCustomWidget) {
|
|
1282
|
+
const h = this.buildCustomWidgetContext(
|
|
1283
|
+
d.children,
|
|
1284
|
+
l,
|
|
1285
|
+
n,
|
|
1286
|
+
i,
|
|
1287
|
+
o,
|
|
1288
|
+
r,
|
|
1289
|
+
u
|
|
1290
|
+
);
|
|
1291
|
+
S = this.buildCustomWidget(y, I, h);
|
|
1292
|
+
} else
|
|
1293
|
+
S = this.mapper.mapToWidget(I, p);
|
|
1294
|
+
if (typeof S != "function") {
|
|
1295
|
+
const h = S;
|
|
1296
|
+
h.uid || (h.path && !u.has(h.path) ? (h.uid = h.path, u.add(h.path)) : h.uid = `dx_${r.value++}`);
|
|
1297
|
+
}
|
|
1298
|
+
if (this.stateExpansion.hasStateData(U))
|
|
1299
|
+
if (typeof S == "function") {
|
|
1300
|
+
const h = S;
|
|
1301
|
+
S = ((Y) => {
|
|
1302
|
+
const z = h(Y);
|
|
1303
|
+
return this.stateExpansion.applyToWidget(
|
|
1304
|
+
z,
|
|
1305
|
+
U,
|
|
1306
|
+
n,
|
|
1307
|
+
o
|
|
1308
|
+
);
|
|
1309
|
+
});
|
|
1310
|
+
} else
|
|
1311
|
+
S = this.stateExpansion.applyToWidget(
|
|
1312
|
+
S,
|
|
1313
|
+
U,
|
|
1314
|
+
n,
|
|
1315
|
+
o
|
|
1316
|
+
);
|
|
1317
|
+
return S;
|
|
1318
|
+
}
|
|
1319
|
+
buildCustomWidgetContext(t, s, a, l, n, i, o) {
|
|
1320
|
+
return {
|
|
1321
|
+
children: t,
|
|
1322
|
+
mapStaticDef: (r, u) => this.mapper.mapStaticDef(r, u),
|
|
1323
|
+
walkChildren: (r) => this.walkItems(
|
|
1324
|
+
r,
|
|
1325
|
+
s,
|
|
1326
|
+
a,
|
|
1327
|
+
l,
|
|
1328
|
+
n,
|
|
1329
|
+
i,
|
|
1330
|
+
o
|
|
1331
|
+
)
|
|
1332
|
+
};
|
|
1333
|
+
}
|
|
1334
|
+
buildCustomWidget(t, s, a) {
|
|
1335
|
+
return t.buildCustomWidget(s, a);
|
|
1336
|
+
}
|
|
1337
|
+
/**
|
|
1338
|
+
* Resolves the base definition from a parsed entry, injecting the path for keyed entries.
|
|
1339
|
+
* For runtime (function) providers, wraps them to inject the path at evaluation time.
|
|
1340
|
+
*/
|
|
1341
|
+
buildBaseDef(t) {
|
|
1342
|
+
const s = t.baseDef;
|
|
1343
|
+
return typeof s == "function" ? (a) => {
|
|
1344
|
+
const n = s(a ?? {});
|
|
1345
|
+
return t.path != null ? { ...n, path: t.path } : n;
|
|
1346
|
+
} : t.path != null ? { ...s, path: t.path } : s;
|
|
1347
|
+
}
|
|
1348
|
+
buildDecoratorForMatching(t, s, a) {
|
|
1349
|
+
if (typeof t == "function")
|
|
1350
|
+
return { itemType: s, tags: [...a] };
|
|
1351
|
+
const l = [...a, ..."tags" in t && t.tags ? t.tags : []], n = "uid" in t ? t.uid : void 0, i = "type" in t ? t.type : void 0;
|
|
1352
|
+
return { itemType: s, tags: l, uid: n, type: i };
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
class Ne {
|
|
1356
|
+
constructor(t, s) {
|
|
1357
|
+
this.selectorNormalizer = t, this.walker = s;
|
|
1358
|
+
}
|
|
1359
|
+
processDxFacade(t, s = [], a) {
|
|
1360
|
+
const { defs: l, gslSelectors: n, formConfig: i } = this.prepareForm(
|
|
1361
|
+
t,
|
|
1362
|
+
s,
|
|
1363
|
+
a
|
|
1364
|
+
), { widgets: o, eventRegistry: r } = this.walker.walkAndMap(
|
|
1365
|
+
l,
|
|
1366
|
+
n,
|
|
1367
|
+
i
|
|
1368
|
+
), u = o[0];
|
|
1369
|
+
return this.buildResult({ form: u }, r, i);
|
|
1370
|
+
}
|
|
1371
|
+
/**
|
|
1372
|
+
* Normalizes raw form definitions and applies form-level defaults.
|
|
1373
|
+
*
|
|
1374
|
+
* Steps:
|
|
1375
|
+
* 1. Normalize definitions — ensure a flat array; convert bare functions to display widgets.
|
|
1376
|
+
* 2. Normalize selectors — convert mixed leaf/aggregated selectors into a uniform
|
|
1377
|
+
* aggregated shape, and extract form-level config (see {@link FormConfig}).
|
|
1378
|
+
* 3. Auto-stack — unless suppressed, wrap all definitions in a synthetic root
|
|
1379
|
+
* flex column layout so the form renders as a single vertical container.
|
|
1380
|
+
*/
|
|
1381
|
+
prepareForm(t, s, a) {
|
|
1382
|
+
const n = (Array.isArray(t) ? [...t] : [t]).map(
|
|
1383
|
+
(r) => typeof r == "function" ? G(r) : r
|
|
1384
|
+
), i = this.selectorNormalizer.normalizeSelectors(s), o = {
|
|
1385
|
+
...this.selectorNormalizer.extractFormConfig(),
|
|
1386
|
+
...a
|
|
1387
|
+
};
|
|
1388
|
+
if (!o.suppressAutomaticStack) {
|
|
1389
|
+
const r = {
|
|
1390
|
+
def: { uid: "#root", direction: "column", widgetName: "flex" },
|
|
1391
|
+
children: n
|
|
1392
|
+
};
|
|
1393
|
+
return {
|
|
1394
|
+
defs: [{ type: "ITEMS", itemType: N.LAYOUTS, items: [r], tags: [] }],
|
|
1395
|
+
gslSelectors: i,
|
|
1396
|
+
formConfig: o
|
|
1397
|
+
};
|
|
1398
|
+
}
|
|
1399
|
+
return { defs: n, gslSelectors: i, formConfig: o };
|
|
1400
|
+
}
|
|
1401
|
+
/**
|
|
1402
|
+
* Converts DX `$`-separated state names to core's `:`-separated names.
|
|
1403
|
+
* E.g. `{ register$adult: 'expr' }` → `{ 'register:adult': 'expr' }`.
|
|
1404
|
+
*/
|
|
1405
|
+
convertStateNames(t) {
|
|
1406
|
+
const s = {};
|
|
1407
|
+
for (const [a, l] of Object.entries(t))
|
|
1408
|
+
s[a.replace(/\$/g, ":")] = l;
|
|
1409
|
+
return s;
|
|
1410
|
+
}
|
|
1411
|
+
buildResult(t, s, a) {
|
|
1412
|
+
a.states && Object.keys(a.states).length > 0 && (t = {
|
|
1413
|
+
...t,
|
|
1414
|
+
states: this.convertStateNames(a.states)
|
|
1415
|
+
});
|
|
1416
|
+
const l = { form: t };
|
|
1417
|
+
return s.size > 0 && (l.events = (n) => {
|
|
1418
|
+
const i = s.get(n.name);
|
|
1419
|
+
if (i) {
|
|
1420
|
+
const o = (u) => {
|
|
1421
|
+
if (u && typeof u == "object" && "path" in u && !("type" in u)) {
|
|
1422
|
+
const { path: p, ...y } = u;
|
|
1423
|
+
for (const [d, T] of Object.entries(y))
|
|
1424
|
+
n.callback({
|
|
1425
|
+
type: "OVERRIDE_WIDGET_PROP",
|
|
1426
|
+
payload: { path: p, prop: d, value: T }
|
|
1427
|
+
});
|
|
1428
|
+
} else
|
|
1429
|
+
n.callback(u);
|
|
1430
|
+
}, r = {
|
|
1431
|
+
...n,
|
|
1432
|
+
callback: o,
|
|
1433
|
+
update: o
|
|
1434
|
+
};
|
|
1435
|
+
i(r);
|
|
1436
|
+
}
|
|
1437
|
+
}), a.dependencies && (l.dependencies = a.dependencies), a.widgetLoaders && (l.widgetLoaders = a.widgetLoaders), a.validateOn && (l.validateOn = a.validateOn), a.itemRenderers && (l.itemRenderers = a.itemRenderers), l;
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
const Re = new Me(
|
|
1441
|
+
fe,
|
|
1442
|
+
Oe,
|
|
1443
|
+
Ee,
|
|
1444
|
+
E,
|
|
1445
|
+
we
|
|
1446
|
+
), xe = new Ne(Pe, Re);
|
|
1447
|
+
function Fe(e) {
|
|
1448
|
+
return typeof e == "function" ? !0 : Array.isArray(e) ? e.length === 0 || e.every(w) : w(e);
|
|
1449
|
+
}
|
|
1450
|
+
function w(e) {
|
|
1451
|
+
if (typeof e == "function") return !0;
|
|
1452
|
+
if (e === null || typeof e != "object") return !1;
|
|
1453
|
+
const t = e;
|
|
1454
|
+
return t.type === "ITEMS" && typeof t.itemType == "string";
|
|
1455
|
+
}
|
|
1456
|
+
const B = Object.freeze({}), je = Object.freeze({}), M = /* @__PURE__ */ new WeakMap();
|
|
1457
|
+
function O(e, t) {
|
|
1458
|
+
return e == null ? t : typeof e == "object" ? e : {};
|
|
1459
|
+
}
|
|
1460
|
+
function $t(e, t, s) {
|
|
1461
|
+
if (!Fe(e))
|
|
1462
|
+
return { formDef: e };
|
|
1463
|
+
const a = O(e, B), l = O(t, B), n = O(s, je);
|
|
1464
|
+
let i = M.get(a);
|
|
1465
|
+
i || (i = /* @__PURE__ */ new WeakMap(), M.set(a, i));
|
|
1466
|
+
let o = i.get(l);
|
|
1467
|
+
o || (o = /* @__PURE__ */ new WeakMap(), i.set(l, o));
|
|
1468
|
+
const r = o.get(n);
|
|
1469
|
+
if (r) return r;
|
|
1470
|
+
const u = xe.processDxFacade(
|
|
1471
|
+
e,
|
|
1472
|
+
t,
|
|
1473
|
+
s
|
|
1474
|
+
), p = {
|
|
1475
|
+
formDef: u.form,
|
|
1476
|
+
formEvent: u.events,
|
|
1477
|
+
dependencies: u.dependencies,
|
|
1478
|
+
widgetLoaders: u.widgetLoaders,
|
|
1479
|
+
validateOn: u.validateOn,
|
|
1480
|
+
itemRenderers: u.itemRenderers
|
|
1481
|
+
};
|
|
1482
|
+
return o.set(n, p), p;
|
|
1483
|
+
}
|
|
1484
|
+
export {
|
|
1485
|
+
xt as $,
|
|
1486
|
+
mt as A,
|
|
1487
|
+
ht as B,
|
|
1488
|
+
gt as C,
|
|
1489
|
+
Tt as D,
|
|
1490
|
+
St as E,
|
|
1491
|
+
At as F,
|
|
1492
|
+
N as G,
|
|
1493
|
+
ne as H,
|
|
1494
|
+
kt as I,
|
|
1495
|
+
_t as J,
|
|
1496
|
+
vt as K,
|
|
1497
|
+
Ct as L,
|
|
1498
|
+
ft as M,
|
|
1499
|
+
Ut as N,
|
|
1500
|
+
Ot as O,
|
|
1501
|
+
Lt as P,
|
|
1502
|
+
Et as Q,
|
|
1503
|
+
Dt as R,
|
|
1504
|
+
Pt as S,
|
|
1505
|
+
It as T,
|
|
1506
|
+
Wt as U,
|
|
1507
|
+
wt as V,
|
|
1508
|
+
Bt as W,
|
|
1509
|
+
Mt as X,
|
|
1510
|
+
Nt as Y,
|
|
1511
|
+
Rt as Z,
|
|
1512
|
+
Ye as _,
|
|
1513
|
+
ze as a,
|
|
1514
|
+
Ft as a0,
|
|
1515
|
+
jt as a1,
|
|
1516
|
+
G as a2,
|
|
1517
|
+
R as a3,
|
|
1518
|
+
c as a4,
|
|
1519
|
+
b as a5,
|
|
1520
|
+
xe as a6,
|
|
1521
|
+
Fe as a7,
|
|
1522
|
+
m as a8,
|
|
1523
|
+
A as a9,
|
|
1524
|
+
$t as aa,
|
|
1525
|
+
Ke as b,
|
|
1526
|
+
Ve as c,
|
|
1527
|
+
Ge as d,
|
|
1528
|
+
Xe as e,
|
|
1529
|
+
He as f,
|
|
1530
|
+
Ze as g,
|
|
1531
|
+
qe as h,
|
|
1532
|
+
Je as i,
|
|
1533
|
+
Qe as j,
|
|
1534
|
+
et as k,
|
|
1535
|
+
tt as l,
|
|
1536
|
+
st as m,
|
|
1537
|
+
lt as n,
|
|
1538
|
+
V as o,
|
|
1539
|
+
at as p,
|
|
1540
|
+
nt as q,
|
|
1541
|
+
it as r,
|
|
1542
|
+
rt as s,
|
|
1543
|
+
ot as t,
|
|
1544
|
+
ut as u,
|
|
1545
|
+
pt as v,
|
|
1546
|
+
ct as w,
|
|
1547
|
+
dt as x,
|
|
1548
|
+
yt as y,
|
|
1549
|
+
bt as z
|
|
1550
|
+
};
|