@golemui/gui-shared 0.17.0 → 1.0.0-rc.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/CHANGELOG.md +4 -0
- package/index.d.ts +1 -8
- package/index.js +209 -729
- package/index.umd.cjs +1 -1
- package/internals.d.ts +8 -1
- package/internals.js +721 -10
- package/internals.umd.cjs +1 -1
- package/package.json +3 -3
- package/register-BCL1xvhN.js +1399 -0
- package/register-CjTULX-4.cjs +1 -0
- package/resolveFormInput-BkRkdOqj.cjs +0 -1
- package/resolveFormInput-DoBisQ5Q.js +0 -1542
package/internals.js
CHANGED
|
@@ -1,15 +1,726 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return
|
|
7
|
-
|
|
1
|
+
import { aF as I, aG as h, ah as C, aH as M, aI as B } from "./register-BCL1xvhN.js";
|
|
2
|
+
import { X as ye, W as _e, L as he, K as me, R as Se, Q as be, d as De, x as Te, w as Ae, l as Oe, k as Ue, q as Ie, r as Re, a0 as Ee, $ as xe, a2 as ke, a1 as ve, Z as we, Y as Ce, a4 as Me, a3 as Be, z as Le, y as Pe, B as je, A as Fe, P as Ne, O as We, h as ze, g as Ge, a as Ke, _ as $e, N as Ve, M as Ye, v as He, u as Xe, t as qe, T as Je, S as Qe, s as Ze, c as et, p as tt, o as st, j as at, i as nt, D as rt, C as ot, F as it, E as lt, H as ct, G as ut, J as pt, I as dt, f as ft, e as gt, U as yt, V as _t, aJ as ht, aK as mt, b as St, n as bt, m as Dt, a6 as Tt, ag as At, aC as Ot, aj as Ut, as as It, ay as Rt, av as Et, ai as xt, ae as kt, ak as vt, a5 as wt, ar as Ct, aq as Mt, aA as Bt, ad as Lt, aa as Pt, ac as jt, a9 as Ft, at as Nt, au as Wt, af as zt, aD as Gt, aw as Kt, az as $t, ap as Vt, ao as Yt, an as Ht, am as Xt, aB as qt, a7 as Jt, al as Qt, aE as Zt, ax as es, ab as ts, a8 as ss, aL as as, aM as ns, aN as rs, aO as os, aP as is } from "./register-BCL1xvhN.js";
|
|
3
|
+
import "@golemui/core";
|
|
4
|
+
import "@golemui/gui-validators";
|
|
5
|
+
function ie(i, ...e) {
|
|
6
|
+
return e.map((t) => ({
|
|
7
|
+
...t,
|
|
8
|
+
targetState: i
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
function le(i, ...e) {
|
|
12
|
+
return {
|
|
13
|
+
kind: "aggregated",
|
|
14
|
+
matcher: (t) => t.tags?.includes(i) ?? !1,
|
|
15
|
+
children: e
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const R = {
|
|
19
|
+
INPUTS: /* @__PURE__ */ new Set([
|
|
20
|
+
"INPUTS",
|
|
21
|
+
"TEXTAREA",
|
|
22
|
+
"PASSWORD",
|
|
23
|
+
"SELECT",
|
|
24
|
+
"DROPDOWN",
|
|
25
|
+
"RADIOGROUP",
|
|
26
|
+
"CHECKBOX",
|
|
27
|
+
"CALENDAR",
|
|
28
|
+
"DATE_INPUT",
|
|
29
|
+
"DATE_PICKER",
|
|
30
|
+
"RANGE_CALENDAR",
|
|
31
|
+
"RANGE_DATE_INPUT",
|
|
32
|
+
"RANGE_DATE_PICKER",
|
|
33
|
+
"CURRENCY",
|
|
34
|
+
"MARKDOWN",
|
|
35
|
+
"LIST",
|
|
36
|
+
"CUSTOM_INPUT",
|
|
37
|
+
"REPEATER",
|
|
38
|
+
"TAGS"
|
|
39
|
+
]),
|
|
40
|
+
ACTIONS: /* @__PURE__ */ new Set(["ACTIONS", "CUSTOM_ACTION"]),
|
|
41
|
+
DISPLAYS: /* @__PURE__ */ new Set(["DISPLAYS", "ALERTS", "MARKDOWN_TEXTS", "CUSTOM_DISPLAY"]),
|
|
42
|
+
LAYOUTS: /* @__PURE__ */ new Set(["LAYOUTS", "TABS", "ACCORDION", "CUSTOM_LAYOUT"])
|
|
43
|
+
};
|
|
44
|
+
function L(i, e) {
|
|
45
|
+
const t = R[i];
|
|
46
|
+
return t ? t.has(e) : i === e;
|
|
47
|
+
}
|
|
48
|
+
class P {
|
|
49
|
+
resolve(e, t) {
|
|
50
|
+
const a = [];
|
|
51
|
+
for (const n of t)
|
|
52
|
+
n.kind === "aggregated" ? this.collectFromAggregated(n, e, a) : this.collectFromLeaf(n, e, a);
|
|
53
|
+
const s = this.rollUpSensibleDefaults(a);
|
|
54
|
+
return {
|
|
55
|
+
leafSelectors: a,
|
|
56
|
+
sensibleDefaults: s
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
collectFromAggregated(e, t, a) {
|
|
60
|
+
if (e.matcher(t))
|
|
61
|
+
for (const s of e.children)
|
|
62
|
+
this.collectFromLeaf(s, t, a);
|
|
63
|
+
}
|
|
64
|
+
collectFromLeaf(e, t, a) {
|
|
65
|
+
L(e.selectorType, t.itemType ?? "") && e.matcher(t) && a.push(e);
|
|
66
|
+
}
|
|
67
|
+
rollUpSensibleDefaults(e) {
|
|
68
|
+
const t = /* @__PURE__ */ new Map(), a = (n, r) => {
|
|
69
|
+
const o = t.get(n) ?? [];
|
|
70
|
+
o.push(r), t.set(n, o);
|
|
71
|
+
};
|
|
72
|
+
for (const n of e) {
|
|
73
|
+
const r = R[n.selectorType];
|
|
74
|
+
if (r)
|
|
75
|
+
for (const o of r) a(o, n);
|
|
76
|
+
else
|
|
77
|
+
a(n.selectorType, n);
|
|
78
|
+
}
|
|
79
|
+
const s = {};
|
|
80
|
+
for (const [n, r] of t)
|
|
81
|
+
I(n) && (s[n] = h(n).rollUpSensibleDefaults(r));
|
|
82
|
+
return s;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const j = new P();
|
|
86
|
+
class F {
|
|
87
|
+
/**
|
|
88
|
+
* Deep merges two objects, with right taking precedence over left when properties conflict.
|
|
89
|
+
* Arrays are replaced, not merged.
|
|
90
|
+
* @param left - The base object
|
|
91
|
+
* @param right - The object whose properties take precedence
|
|
92
|
+
* @returns A new merged object
|
|
93
|
+
*/
|
|
94
|
+
deepMerge(e, t) {
|
|
95
|
+
if (t == null)
|
|
96
|
+
return e;
|
|
97
|
+
if (e == null || typeof e != "object" || typeof t != "object" || Array.isArray(e) || Array.isArray(t))
|
|
98
|
+
return t;
|
|
99
|
+
const a = { ...e };
|
|
100
|
+
for (const s in t)
|
|
101
|
+
Object.prototype.hasOwnProperty.call(t, s) && (typeof t[s] == "object" && !Array.isArray(t[s]) && t[s] !== null && typeof e[s] == "object" && !Array.isArray(e[s]) && e[s] !== null ? a[s] = this.deepMerge(e[s], t[s]) : a[s] = t[s]);
|
|
102
|
+
return a;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const N = new F();
|
|
106
|
+
class W {
|
|
107
|
+
constructor(e) {
|
|
108
|
+
this.objectUtils = e;
|
|
109
|
+
}
|
|
110
|
+
merge(e, t, a) {
|
|
111
|
+
let s = {}, n = null;
|
|
112
|
+
typeof e == "function" && (n = e);
|
|
113
|
+
const r = this.collectDecorators(a);
|
|
114
|
+
for (const c of r) {
|
|
115
|
+
if (n != null) {
|
|
116
|
+
n = this.composeRuntimeFunctions(n, c);
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
if (typeof c == "function") {
|
|
120
|
+
const u = c({
|
|
121
|
+
...s,
|
|
122
|
+
...typeof e == "function" ? {} : e
|
|
123
|
+
});
|
|
124
|
+
if (typeof u == "function") {
|
|
125
|
+
n = this.createPromotedFunction(
|
|
126
|
+
s,
|
|
127
|
+
e,
|
|
128
|
+
u,
|
|
129
|
+
t,
|
|
130
|
+
a
|
|
131
|
+
);
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
s = this.objectUtils.deepMerge(s, u);
|
|
135
|
+
} else
|
|
136
|
+
s = this.objectUtils.deepMerge(s, c);
|
|
137
|
+
}
|
|
138
|
+
if (n != null)
|
|
139
|
+
return {
|
|
140
|
+
kind: "dynamic",
|
|
141
|
+
fn: this.wrapWithSensibleDefaults(n, s, t, a)
|
|
142
|
+
};
|
|
143
|
+
const o = this.objectUtils.deepMerge(e, s);
|
|
144
|
+
return { kind: "static", def: this.applySensibleDefaults({ ...o }, t, a) };
|
|
145
|
+
}
|
|
146
|
+
// ── Collect all decorators in priority order ──
|
|
147
|
+
collectDecorators(e) {
|
|
148
|
+
const t = [];
|
|
149
|
+
for (const a of e.leafSelectors) {
|
|
150
|
+
const s = a.config;
|
|
151
|
+
s.override != null && t.push(s.override);
|
|
152
|
+
}
|
|
153
|
+
return t;
|
|
154
|
+
}
|
|
155
|
+
// ── Apply sensible defaults via registry ──
|
|
156
|
+
applySensibleDefaults(e, t, a) {
|
|
157
|
+
if (!I(t)) return e;
|
|
158
|
+
const s = a.sensibleDefaults[t] ?? {};
|
|
159
|
+
return h(t).applySensibleDefaults(e, s);
|
|
160
|
+
}
|
|
161
|
+
// ── Create promoted FunctionWidget ──
|
|
162
|
+
createPromotedFunction(e, t, a, s, n) {
|
|
163
|
+
return (r) => {
|
|
164
|
+
const o = a(r);
|
|
165
|
+
let l = this.objectUtils.deepMerge(e, o);
|
|
166
|
+
return l = this.objectUtils.deepMerge(l, t), this.applySensibleDefaults(l, s, n);
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
// ── Wrap runtime function with accumulated static decorators and sensible defaults ──
|
|
170
|
+
wrapWithSensibleDefaults(e, t, a, s) {
|
|
171
|
+
return (n) => {
|
|
172
|
+
let r = e(n);
|
|
173
|
+
return Object.keys(t).length > 0 && (r = this.objectUtils.deepMerge(t, r)), this.applySensibleDefaults(r, a, s);
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
// ── Compose two runtime functions ──
|
|
177
|
+
composeRuntimeFunctions(e, t) {
|
|
178
|
+
return typeof t == "function" ? (a) => {
|
|
179
|
+
const s = e(a), n = t(s);
|
|
180
|
+
return typeof n == "function" ? n(a) : this.objectUtils.deepMerge(n, s);
|
|
181
|
+
} : (a) => {
|
|
182
|
+
const s = e(a);
|
|
183
|
+
return this.objectUtils.deepMerge(s, t);
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
const z = new W(N);
|
|
188
|
+
class G {
|
|
189
|
+
mapToWidget(e, t) {
|
|
190
|
+
if (e.kind === "dynamic") {
|
|
191
|
+
const a = e.fn;
|
|
192
|
+
return ((s) => {
|
|
193
|
+
const n = a(s);
|
|
194
|
+
return this.mapStaticDef(n, t);
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
return this.mapStaticDef(e.def, t);
|
|
198
|
+
}
|
|
199
|
+
mapStaticDef(e, t) {
|
|
200
|
+
const a = h(t).mapToWidget(e);
|
|
201
|
+
return this.applyBaseWidgetFields(a, e);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Injects BaseWidget-level fields that all widget types share.
|
|
205
|
+
* Centralized here so individual mappers don't need to repeat the pattern.
|
|
206
|
+
*/
|
|
207
|
+
applyBaseWidgetFields(e, t) {
|
|
208
|
+
return t.size != null && (e.size = t.size), t.defaultValue != null && e.kind === "input" && (e.defaultValue = t.defaultValue), t.on != null && (e.on = t.on), t.include != null && (e.include = t.include), t.exclude != null && (e.exclude = t.exclude), e;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
const K = new G();
|
|
212
|
+
class $ {
|
|
213
|
+
/**
|
|
214
|
+
* Ensures the output is always a uniform GslSelector[] of aggregated selectors.
|
|
215
|
+
*
|
|
216
|
+
* Callers can pass flat leaf selectors (single styling rules) or pre-grouped
|
|
217
|
+
* aggregated selectors. This method separates them into two buckets, then wraps
|
|
218
|
+
* any bare leaves into a catch-all aggregated selector so downstream code only
|
|
219
|
+
* deals with one shape.
|
|
220
|
+
*/
|
|
221
|
+
normalizeSelectors(e) {
|
|
222
|
+
const t = Array.isArray(e) ? e : [e], a = [], s = [];
|
|
223
|
+
for (const n of t)
|
|
224
|
+
n.kind === "leaf" ? s.push(n) : a.push(n);
|
|
225
|
+
return s.length > 0 && a.unshift({
|
|
226
|
+
kind: "aggregated",
|
|
227
|
+
matcher: () => !0,
|
|
228
|
+
children: s
|
|
229
|
+
}), a;
|
|
230
|
+
}
|
|
231
|
+
extractFormConfig() {
|
|
232
|
+
return {
|
|
233
|
+
suppressAutomaticStack: !1
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
const V = new $(), Y = {
|
|
238
|
+
input: /* @__PURE__ */ new Set(["disabled", "readonly", "label", "validator", "size"]),
|
|
239
|
+
action: /* @__PURE__ */ new Set(["disabled", "label", "size"]),
|
|
240
|
+
layout: /* @__PURE__ */ new Set(["size"]),
|
|
241
|
+
display: /* @__PURE__ */ new Set([])
|
|
242
|
+
}, T = {
|
|
243
|
+
onChange: "change",
|
|
244
|
+
onLoad: "load",
|
|
245
|
+
onFilter: "filter",
|
|
246
|
+
onClick: "click"
|
|
247
|
+
};
|
|
248
|
+
class H {
|
|
249
|
+
/**
|
|
250
|
+
* Extracts `states` from a merge result, combining with state-targeted
|
|
251
|
+
* GSL leaf selectors from `_gslStates`.
|
|
252
|
+
*
|
|
253
|
+
* Returns a cleaned merge result (no states) and accumulated state data.
|
|
254
|
+
*/
|
|
255
|
+
extractFromMergeResult(e, t) {
|
|
256
|
+
const a = {};
|
|
257
|
+
for (const o of t) {
|
|
258
|
+
const l = o.targetState, c = o.config, u = c.override && typeof c.override != "function" ? c.override : c;
|
|
259
|
+
a[l] = {
|
|
260
|
+
...a[l] || {},
|
|
261
|
+
...u
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
if (e.kind === "dynamic") {
|
|
265
|
+
const o = e.fn;
|
|
266
|
+
return {
|
|
267
|
+
cleanedResult: { kind: "dynamic", fn: (c) => {
|
|
268
|
+
const u = o(c), { states: p, ...f } = u;
|
|
269
|
+
return f;
|
|
270
|
+
} },
|
|
271
|
+
stateData: { stateOverrides: a }
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
const { states: s, ...n } = e.def, r = {};
|
|
275
|
+
for (const [o, l] of Object.entries(a))
|
|
276
|
+
r[o] = { ...l };
|
|
277
|
+
if (s)
|
|
278
|
+
for (const [o, l] of Object.entries(
|
|
279
|
+
s
|
|
280
|
+
))
|
|
281
|
+
r[o] = { ...r[o] || {}, ...l };
|
|
282
|
+
return {
|
|
283
|
+
cleanedResult: { kind: "static", def: n },
|
|
284
|
+
stateData: { stateOverrides: r }
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Applies state overrides to a core widget. Each override produces:
|
|
289
|
+
* - `visible: true/false` → `include: { in }` / `exclude: { from }`
|
|
290
|
+
* - Core suffixable props → `'prop.stateName': value` at widget root
|
|
291
|
+
* - Event handlers → `on: { 'eventType.stateName': eventId }` with registry wiring
|
|
292
|
+
* - Custom props → `props: { 'prop.stateName': value }`
|
|
293
|
+
*/
|
|
294
|
+
applyToWidget(e, t, a, s) {
|
|
295
|
+
const { stateOverrides: n } = t;
|
|
296
|
+
if (Object.keys(n).length === 0)
|
|
297
|
+
return e;
|
|
298
|
+
const r = { ...e }, o = e.kind, l = Y[o] || /* @__PURE__ */ new Set();
|
|
299
|
+
e.props && (r.props = { ...e.props }), e.on && (r.on = { ...e.on });
|
|
300
|
+
for (const [c, u] of Object.entries(n))
|
|
301
|
+
for (const [p, f] of Object.entries(u))
|
|
302
|
+
p === "visible" ? this.applyVisibility(r, c, f) : T[p] ? this.applyStateEvent(r, c, p, f, a, s) : l.has(p) ? r[`${p}.${c}`] = f : (r.props || (r.props = {}), r.props[`${p}.${c}`] = f);
|
|
303
|
+
return r;
|
|
304
|
+
}
|
|
305
|
+
hasStateData(e) {
|
|
306
|
+
return Object.keys(e.stateOverrides).length > 0;
|
|
307
|
+
}
|
|
308
|
+
// ── Visibility helpers ──
|
|
309
|
+
applyVisibility(e, t, a) {
|
|
310
|
+
if (a) {
|
|
311
|
+
const s = e.include?.in || [];
|
|
312
|
+
e.include = { ...e.include || {}, in: [...s, t] };
|
|
313
|
+
} else {
|
|
314
|
+
const s = e.exclude?.from || [];
|
|
315
|
+
e.exclude = { ...e.exclude || {}, from: [...s, t] };
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
// ── State-suffixed event helpers ──
|
|
319
|
+
applyStateEvent(e, t, a, s, n, r) {
|
|
320
|
+
const o = T[a];
|
|
321
|
+
if (e.on || (e.on = {}), typeof s == "function") {
|
|
322
|
+
const l = r.next();
|
|
323
|
+
n.set(l, s), e.on[`${o}.${t}`] = l;
|
|
324
|
+
} else typeof s == "string" && (e.on[`${o}.${t}`] = s);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
const X = new H();
|
|
328
|
+
function q() {
|
|
329
|
+
let i = 0;
|
|
330
|
+
return { next: () => `event_${i++}` };
|
|
331
|
+
}
|
|
332
|
+
class J {
|
|
333
|
+
constructor(e, t, a, s, n) {
|
|
334
|
+
this.resolver = e, this.merger = t, this.mapper = a, this.eventWiring = s, this.stateExpansion = n;
|
|
335
|
+
}
|
|
336
|
+
walkAndMap(e, t, a) {
|
|
337
|
+
const s = /* @__PURE__ */ new Map(), n = q(), r = { value: 0 }, o = /* @__PURE__ */ new Set();
|
|
338
|
+
return { widgets: this.walkItems(
|
|
339
|
+
e,
|
|
340
|
+
t,
|
|
341
|
+
s,
|
|
342
|
+
a,
|
|
343
|
+
n,
|
|
344
|
+
r,
|
|
345
|
+
o
|
|
346
|
+
), eventRegistry: s };
|
|
347
|
+
}
|
|
348
|
+
walkItems(e, t, a, s, n, r, o) {
|
|
349
|
+
return e.flatMap((l) => {
|
|
350
|
+
if (l.type !== "ITEMS")
|
|
351
|
+
throw new Error("Unexpected gui shortcut type");
|
|
352
|
+
return l.items.map((c) => this.processItem(
|
|
353
|
+
c,
|
|
354
|
+
l.itemType,
|
|
355
|
+
l.tags,
|
|
356
|
+
t,
|
|
357
|
+
a,
|
|
358
|
+
s,
|
|
359
|
+
n,
|
|
360
|
+
r,
|
|
361
|
+
o
|
|
362
|
+
));
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
processItem(e, t, a, s, n, r, o, l, c) {
|
|
366
|
+
const u = t, p = h(t), f = p.parseEntry(e), _ = this.buildBaseDef(f), E = this.buildDecoratorForMatching(_, u, a), m = this.resolver.resolve(E, s), x = m.leafSelectors.filter((d) => d.targetState != null), k = {
|
|
367
|
+
leafSelectors: m.leafSelectors.filter((d) => d.targetState == null),
|
|
368
|
+
sensibleDefaults: m.sensibleDefaults
|
|
369
|
+
};
|
|
370
|
+
let y = this.merger.merge(_, u, k);
|
|
371
|
+
p.afterMerge && (y = p.afterMerge(y, {
|
|
372
|
+
eventRegistry: n,
|
|
373
|
+
formConfig: r,
|
|
374
|
+
eventIdGenerator: o
|
|
375
|
+
})), y = this.eventWiring.wireInputLayoutEvents(
|
|
376
|
+
y,
|
|
377
|
+
n,
|
|
378
|
+
o
|
|
379
|
+
);
|
|
380
|
+
const { cleanedResult: D, stateData: S } = this.stateExpansion.extractFromMergeResult(
|
|
381
|
+
y,
|
|
382
|
+
x
|
|
383
|
+
);
|
|
384
|
+
let g;
|
|
385
|
+
if (p.buildCustomWidget) {
|
|
386
|
+
const d = this.buildCustomWidgetContext(
|
|
387
|
+
f.children,
|
|
388
|
+
s,
|
|
389
|
+
n,
|
|
390
|
+
r,
|
|
391
|
+
o,
|
|
392
|
+
l,
|
|
393
|
+
c
|
|
394
|
+
);
|
|
395
|
+
g = this.buildCustomWidget(p, D, d);
|
|
396
|
+
} else
|
|
397
|
+
g = this.mapper.mapToWidget(D, u);
|
|
398
|
+
if (typeof g != "function") {
|
|
399
|
+
const d = g;
|
|
400
|
+
d.uid || (d.path && !c.has(d.path) ? (d.uid = d.path, c.add(d.path)) : d.uid = `dx_${l.value++}`);
|
|
401
|
+
}
|
|
402
|
+
if (this.stateExpansion.hasStateData(S))
|
|
403
|
+
if (typeof g == "function") {
|
|
404
|
+
const d = g;
|
|
405
|
+
g = ((v) => {
|
|
406
|
+
const w = d(v);
|
|
407
|
+
return this.stateExpansion.applyToWidget(
|
|
408
|
+
w,
|
|
409
|
+
S,
|
|
410
|
+
n,
|
|
411
|
+
o
|
|
412
|
+
);
|
|
413
|
+
});
|
|
414
|
+
} else
|
|
415
|
+
g = this.stateExpansion.applyToWidget(
|
|
416
|
+
g,
|
|
417
|
+
S,
|
|
418
|
+
n,
|
|
419
|
+
o
|
|
420
|
+
);
|
|
421
|
+
return g;
|
|
422
|
+
}
|
|
423
|
+
buildCustomWidgetContext(e, t, a, s, n, r, o) {
|
|
424
|
+
return {
|
|
425
|
+
children: e,
|
|
426
|
+
mapStaticDef: (l, c) => this.mapper.mapStaticDef(l, c),
|
|
427
|
+
walkChildren: (l) => this.walkItems(
|
|
428
|
+
l,
|
|
429
|
+
t,
|
|
430
|
+
a,
|
|
431
|
+
s,
|
|
432
|
+
n,
|
|
433
|
+
r,
|
|
434
|
+
o
|
|
435
|
+
)
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
buildCustomWidget(e, t, a) {
|
|
439
|
+
return e.buildCustomWidget(t, a);
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Resolves the base definition from a parsed entry, injecting the path for keyed entries.
|
|
443
|
+
* For runtime (function) providers, wraps them to inject the path at evaluation time.
|
|
444
|
+
*/
|
|
445
|
+
buildBaseDef(e) {
|
|
446
|
+
const t = e.baseDef;
|
|
447
|
+
return typeof t == "function" ? (a) => {
|
|
448
|
+
const n = t(a ?? {});
|
|
449
|
+
return e.path != null ? { ...n, path: e.path } : n;
|
|
450
|
+
} : e.path != null ? { ...t, path: e.path } : t;
|
|
451
|
+
}
|
|
452
|
+
buildDecoratorForMatching(e, t, a) {
|
|
453
|
+
if (typeof e == "function")
|
|
454
|
+
return { itemType: t, tags: [...a] };
|
|
455
|
+
const s = [...a, ..."tags" in e && e.tags ? e.tags : []], n = "uid" in e ? e.uid : void 0, r = "type" in e ? e.type : void 0;
|
|
456
|
+
return { itemType: t, tags: s, uid: n, type: r };
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
class Q {
|
|
460
|
+
constructor(e, t) {
|
|
461
|
+
this.selectorNormalizer = e, this.walker = t;
|
|
462
|
+
}
|
|
463
|
+
processDxFacade(e, t = [], a) {
|
|
464
|
+
const { defs: s, gslSelectors: n, formConfig: r } = this.prepareForm(
|
|
465
|
+
e,
|
|
466
|
+
t,
|
|
467
|
+
a
|
|
468
|
+
), { widgets: o, eventRegistry: l } = this.walker.walkAndMap(
|
|
469
|
+
s,
|
|
470
|
+
n,
|
|
471
|
+
r
|
|
472
|
+
), c = o[0];
|
|
473
|
+
return this.buildResult({ form: c }, l, r);
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Normalizes raw form definitions and applies form-level defaults.
|
|
477
|
+
*
|
|
478
|
+
* Steps:
|
|
479
|
+
* 1. Normalize definitions — ensure a flat array; convert bare functions to display widgets.
|
|
480
|
+
* 2. Normalize selectors — convert mixed leaf/aggregated selectors into a uniform
|
|
481
|
+
* aggregated shape, and extract form-level config (see {@link FormConfig}).
|
|
482
|
+
* 3. Auto-stack — unless suppressed, wrap all definitions in a synthetic root
|
|
483
|
+
* flex column layout so the form renders as a single vertical container.
|
|
484
|
+
*/
|
|
485
|
+
prepareForm(e, t, a) {
|
|
486
|
+
const n = (Array.isArray(e) ? [...e] : [e]).map(
|
|
487
|
+
(l) => typeof l == "function" ? C(l) : l
|
|
488
|
+
), r = this.selectorNormalizer.normalizeSelectors(t), o = {
|
|
489
|
+
...this.selectorNormalizer.extractFormConfig(),
|
|
490
|
+
...a
|
|
491
|
+
};
|
|
492
|
+
if (!o.suppressAutomaticStack) {
|
|
493
|
+
const l = {
|
|
494
|
+
def: { uid: "#root", direction: "column", widgetName: "flex" },
|
|
495
|
+
children: n
|
|
496
|
+
};
|
|
497
|
+
return {
|
|
498
|
+
defs: [{ type: "ITEMS", itemType: M.LAYOUTS, items: [l], tags: [] }],
|
|
499
|
+
gslSelectors: r,
|
|
500
|
+
formConfig: o
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
return { defs: n, gslSelectors: r, formConfig: o };
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Converts DX `$`-separated state names to core's `:`-separated names.
|
|
507
|
+
* E.g. `{ register$adult: 'expr' }` → `{ 'register:adult': 'expr' }`.
|
|
508
|
+
*/
|
|
509
|
+
convertStateNames(e) {
|
|
510
|
+
const t = {};
|
|
511
|
+
for (const [a, s] of Object.entries(e))
|
|
512
|
+
t[a.replace(/\$/g, ":")] = s;
|
|
513
|
+
return t;
|
|
514
|
+
}
|
|
515
|
+
buildResult(e, t, a) {
|
|
516
|
+
a.states && Object.keys(a.states).length > 0 && (e = {
|
|
517
|
+
...e,
|
|
518
|
+
states: this.convertStateNames(a.states)
|
|
519
|
+
});
|
|
520
|
+
const s = { form: e };
|
|
521
|
+
return t.size > 0 && (s.events = (n) => {
|
|
522
|
+
const r = t.get(n.name);
|
|
523
|
+
if (r) {
|
|
524
|
+
const o = (c) => {
|
|
525
|
+
if (c && typeof c == "object" && "path" in c && !("type" in c)) {
|
|
526
|
+
const { path: u, ...p } = c;
|
|
527
|
+
for (const [f, _] of Object.entries(p))
|
|
528
|
+
n.callback({
|
|
529
|
+
type: "OVERRIDE_WIDGET_PROP",
|
|
530
|
+
payload: { path: u, prop: f, value: _ }
|
|
531
|
+
});
|
|
532
|
+
} else
|
|
533
|
+
n.callback(c);
|
|
534
|
+
}, l = {
|
|
535
|
+
...n,
|
|
536
|
+
callback: o,
|
|
537
|
+
update: o
|
|
538
|
+
};
|
|
539
|
+
r(l);
|
|
540
|
+
}
|
|
541
|
+
}), a.dependencies && (s.dependencies = a.dependencies), a.widgetLoaders && (s.widgetLoaders = a.widgetLoaders), a.validateOn && (s.validateOn = a.validateOn), a.itemRenderers && (s.itemRenderers = a.itemRenderers), s;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
const Z = new J(
|
|
545
|
+
j,
|
|
546
|
+
z,
|
|
547
|
+
K,
|
|
548
|
+
B,
|
|
549
|
+
X
|
|
550
|
+
), ee = new Q(V, Z);
|
|
551
|
+
function te(i) {
|
|
552
|
+
return typeof i == "function" ? !0 : Array.isArray(i) ? i.length === 0 || i.every(A) : A(i);
|
|
553
|
+
}
|
|
554
|
+
function A(i) {
|
|
555
|
+
if (typeof i == "function") return !0;
|
|
556
|
+
if (i === null || typeof i != "object") return !1;
|
|
557
|
+
const e = i;
|
|
558
|
+
return e.type === "ITEMS" && typeof e.itemType == "string";
|
|
559
|
+
}
|
|
560
|
+
const O = Object.freeze({}), se = Object.freeze({}), U = /* @__PURE__ */ new WeakMap();
|
|
561
|
+
function b(i, e) {
|
|
562
|
+
return i == null ? e : typeof i == "object" ? i : {};
|
|
563
|
+
}
|
|
564
|
+
function ce(i, e, t) {
|
|
565
|
+
if (!te(i))
|
|
566
|
+
return { formDef: i };
|
|
567
|
+
const a = b(i, O), s = b(e, O), n = b(t, se);
|
|
568
|
+
let r = U.get(a);
|
|
569
|
+
r || (r = /* @__PURE__ */ new WeakMap(), U.set(a, r));
|
|
570
|
+
let o = r.get(s);
|
|
571
|
+
o || (o = /* @__PURE__ */ new WeakMap(), r.set(s, o));
|
|
572
|
+
const l = o.get(n);
|
|
573
|
+
if (l) return l;
|
|
574
|
+
const c = ee.processDxFacade(
|
|
575
|
+
i,
|
|
576
|
+
e,
|
|
577
|
+
t
|
|
578
|
+
), u = {
|
|
579
|
+
formDef: c.form,
|
|
580
|
+
formEvent: c.events,
|
|
581
|
+
dependencies: c.dependencies,
|
|
582
|
+
widgetLoaders: c.widgetLoaders,
|
|
583
|
+
validateOn: c.validateOn,
|
|
584
|
+
itemRenderers: c.itemRenderers
|
|
585
|
+
};
|
|
586
|
+
return o.set(n, u), u;
|
|
587
|
+
}
|
|
588
|
+
class ae {
|
|
589
|
+
create(e) {
|
|
590
|
+
return {
|
|
591
|
+
states: e.states,
|
|
592
|
+
form: {
|
|
593
|
+
uid: "gui-root-uid",
|
|
594
|
+
type: "flex",
|
|
595
|
+
kind: "layout",
|
|
596
|
+
children: e.form
|
|
597
|
+
}
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
function ue() {
|
|
602
|
+
return new ae();
|
|
603
|
+
}
|
|
604
|
+
const pe = (i) => i !== null && typeof i == "object" && Object.prototype.hasOwnProperty.call(i, "label") && Object.prototype.hasOwnProperty.call(i, "value");
|
|
605
|
+
function de(i, e) {
|
|
606
|
+
if (i != null && typeof i == "object" && "__rid" in i)
|
|
607
|
+
return i.__rid;
|
|
608
|
+
const t = e();
|
|
609
|
+
return Object.defineProperty(i, "__rid", {
|
|
610
|
+
value: t,
|
|
8
611
|
enumerable: !1,
|
|
9
612
|
configurable: !1
|
|
10
|
-
}),
|
|
613
|
+
}), t;
|
|
11
614
|
}
|
|
12
615
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
616
|
+
ye as _gslAccordionByUid,
|
|
617
|
+
_e as _gslAccordions,
|
|
618
|
+
he as _gslActionByUid,
|
|
619
|
+
me as _gslActions,
|
|
620
|
+
Se as _gslAlertByUid,
|
|
621
|
+
be as _gslAlerts,
|
|
622
|
+
De as _gslBooleanInputs,
|
|
623
|
+
Te as _gslCalendarByUid,
|
|
624
|
+
Ae as _gslCalendars,
|
|
625
|
+
Oe as _gslCheckboxByUid,
|
|
626
|
+
Ue as _gslCheckboxes,
|
|
627
|
+
Ie as _gslCurrencies,
|
|
628
|
+
Re as _gslCurrencyByUid,
|
|
629
|
+
Ee as _gslCustomActionByUid,
|
|
630
|
+
xe as _gslCustomActions,
|
|
631
|
+
ke as _gslCustomDisplayByUid,
|
|
632
|
+
ve as _gslCustomDisplays,
|
|
633
|
+
we as _gslCustomInputByUid,
|
|
634
|
+
Ce as _gslCustomInputs,
|
|
635
|
+
Me as _gslCustomLayoutByUid,
|
|
636
|
+
Be as _gslCustomLayouts,
|
|
637
|
+
Le as _gslDateInputByUid,
|
|
638
|
+
Pe as _gslDateInputs,
|
|
639
|
+
je as _gslDatePickerByUid,
|
|
640
|
+
Fe as _gslDatePickers,
|
|
641
|
+
Ne as _gslDisplayByUid,
|
|
642
|
+
We as _gslDisplays,
|
|
643
|
+
ze as _gslDropdownByUid,
|
|
644
|
+
Ge as _gslDropdowns,
|
|
645
|
+
Ke as _gslInputByUid,
|
|
646
|
+
$e as _gslInputs,
|
|
647
|
+
Ve as _gslLayoutByUid,
|
|
648
|
+
Ye as _gslLayouts,
|
|
649
|
+
He as _gslListByUid,
|
|
650
|
+
Xe as _gslLists,
|
|
651
|
+
qe as _gslMarkdownByUid,
|
|
652
|
+
Je as _gslMarkdownTextByUid,
|
|
653
|
+
Qe as _gslMarkdownTexts,
|
|
654
|
+
Ze as _gslMarkdowns,
|
|
655
|
+
et as _gslNumberInputs,
|
|
656
|
+
tt as _gslPasswordByUid,
|
|
657
|
+
st as _gslPasswords,
|
|
658
|
+
at as _gslRadiogroupByUid,
|
|
659
|
+
nt as _gslRadiogroups,
|
|
660
|
+
rt as _gslRangeCalendarByUid,
|
|
661
|
+
ot as _gslRangeCalendars,
|
|
662
|
+
it as _gslRangeDateInputByUid,
|
|
663
|
+
lt as _gslRangeDateInputs,
|
|
664
|
+
ct as _gslRangeDatePickerByUid,
|
|
665
|
+
ut as _gslRangeDatePickers,
|
|
666
|
+
pt as _gslRepeaterByUid,
|
|
667
|
+
dt as _gslRepeaters,
|
|
668
|
+
ft as _gslSelectByUid,
|
|
669
|
+
gt as _gslSelects,
|
|
670
|
+
ie as _gslStates,
|
|
671
|
+
yt as _gslTabs,
|
|
672
|
+
_t as _gslTabsByUid,
|
|
673
|
+
le as _gslTag,
|
|
674
|
+
ht as _gslTags,
|
|
675
|
+
mt as _gslTagsByUid,
|
|
676
|
+
St as _gslTextInputs,
|
|
677
|
+
bt as _gslTextareaByUid,
|
|
678
|
+
Dt as _gslTextareas,
|
|
679
|
+
Tt as _guiAccordion,
|
|
680
|
+
At as _guiAlert,
|
|
681
|
+
Ot as _guiBooleanInput,
|
|
682
|
+
Ut as _guiButton,
|
|
683
|
+
It as _guiCalendar,
|
|
684
|
+
Rt as _guiCheckbox,
|
|
685
|
+
Et as _guiCurrency,
|
|
686
|
+
xt as _guiCustomAction,
|
|
687
|
+
kt as _guiCustomDisplay,
|
|
688
|
+
vt as _guiCustomInput,
|
|
689
|
+
wt as _guiCustomLayout,
|
|
690
|
+
Ct as _guiDateInput,
|
|
691
|
+
Mt as _guiDatePicker,
|
|
692
|
+
C as _guiDisplay,
|
|
693
|
+
Bt as _guiDropdown,
|
|
694
|
+
Lt as _guiFlex,
|
|
695
|
+
Pt as _guiGrid,
|
|
696
|
+
jt as _guiHorizontalFlex,
|
|
697
|
+
Ft as _guiHorizontalGrid,
|
|
698
|
+
Nt as _guiList,
|
|
699
|
+
Wt as _guiMarkdown,
|
|
700
|
+
zt as _guiMarkdownText,
|
|
701
|
+
Gt as _guiNumberInput,
|
|
702
|
+
Kt as _guiPassword,
|
|
703
|
+
$t as _guiRadiogroup,
|
|
704
|
+
Vt as _guiRangeCalendar,
|
|
705
|
+
Yt as _guiRangeDateInput,
|
|
706
|
+
Ht as _guiRangeDatePicker,
|
|
707
|
+
Xt as _guiRepeater,
|
|
708
|
+
qt as _guiSelect,
|
|
709
|
+
Jt as _guiTabs,
|
|
710
|
+
Qt as _guiTags,
|
|
711
|
+
Zt as _guiTextInput,
|
|
712
|
+
es as _guiTextarea,
|
|
713
|
+
ts as _guiVerticalFlex,
|
|
714
|
+
ss as _guiVerticalGrid,
|
|
715
|
+
as as createGslSelector,
|
|
716
|
+
ns as defineShortcutType,
|
|
717
|
+
rs as extractWidgetProps,
|
|
718
|
+
ee as formDefs,
|
|
719
|
+
de as getItemKey,
|
|
720
|
+
ue as golemForm,
|
|
721
|
+
te as isDxDefinitions,
|
|
722
|
+
pe as isOption,
|
|
723
|
+
os as processAutoLabel,
|
|
724
|
+
is as processAutoPlaceholder,
|
|
725
|
+
ce as resolveFormInput
|
|
15
726
|
};
|