json-renderers 1.17.7 → 1.18.5

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.
@@ -0,0 +1,1502 @@
1
+ const Q = {
2
+ version: "v18.0.0",
3
+ description: "build table from store data and render to DOM uses json-to-spec, json-to-dom under the hood"
4
+ }, Y = (t) => {
5
+ const o = t;
6
+ typeof globalThis > "u" || !o || (globalThis.ks ?? (globalThis.ks = {}), globalThis.ks.jsonRenderers = {
7
+ meta: Q,
8
+ render: o
9
+ });
10
+ }, Z = (t) => {
11
+ const o = (t == null ? void 0 : t.inConfig) ?? t;
12
+ if (!o || typeof o != "object")
13
+ throw new TypeError("Config must be an object");
14
+ const e = o.type;
15
+ if (e === void 0)
16
+ throw new Error('Missing compulsory key: "type"');
17
+ if (typeof e != "string")
18
+ throw new TypeError("type must be a string");
19
+ return !0;
20
+ }, tt = (t) => {
21
+ const o = (t == null ? void 0 : t.inConfig) ?? t;
22
+ if (!o || typeof o != "object")
23
+ throw new TypeError("Config must be an object");
24
+ const e = o.data;
25
+ if (e === void 0)
26
+ throw new Error('Missing compulsory key: "data"');
27
+ if (!Array.isArray(e))
28
+ throw new TypeError("data must be an Array");
29
+ return !0;
30
+ }, et = (t) => {
31
+ const o = (t == null ? void 0 : t.inConfig) ?? t;
32
+ if (!o || typeof o != "object")
33
+ throw new TypeError("Config must be an object");
34
+ const e = o.columns;
35
+ if (e === void 0)
36
+ throw new Error('Missing compulsory key: "columns"');
37
+ if (!Array.isArray(e))
38
+ throw new TypeError("columns must be an Array");
39
+ return !0;
40
+ }, ot = (t) => {
41
+ const o = (t == null ? void 0 : t.inConfig) ?? t;
42
+ if (!o || typeof o != "object")
43
+ throw new TypeError("Config must be an object");
44
+ const e = o.showLog;
45
+ if (e !== void 0 && typeof e != "boolean")
46
+ throw new TypeError("showLog must be a boolean");
47
+ return !0;
48
+ }, x = (t) => {
49
+ const o = (t == null ? void 0 : t.inConfig) ?? t;
50
+ if (!o || typeof o != "object" || Array.isArray(o))
51
+ throw new TypeError("Config must be an object");
52
+ return Z(o), tt(o), et(o), ot(o), !0;
53
+ }, rt = (t) => {
54
+ const o = (t == null ? void 0 : t.inConfig) ?? t;
55
+ if (!o || typeof o != "object")
56
+ throw new TypeError("Config must be an object");
57
+ const e = o.targetHtmlId;
58
+ if (e === void 0)
59
+ throw new Error('Missing compulsory key: "targetHtmlId"');
60
+ if (typeof e != "string")
61
+ throw new TypeError("targetHtmlId must be a string");
62
+ if (e.trim().length === 0)
63
+ throw new Error("targetHtmlId must be a non-empty string");
64
+ return !0;
65
+ }, nt = (t) => {
66
+ const o = (t == null ? void 0 : t.inConfig) ?? t;
67
+ if (!o || typeof o != "object")
68
+ throw new TypeError("Config must be an object");
69
+ const e = o.appendPosition;
70
+ if (e === void 0)
71
+ throw new Error('Missing compulsory key: "appendPosition"');
72
+ if (typeof e != "string")
73
+ throw new TypeError("appendPosition must be a string");
74
+ return !0;
75
+ }, at = (t) => {
76
+ const o = (t == null ? void 0 : t.inConfig) ?? t;
77
+ if (!o || typeof o != "object")
78
+ throw new TypeError("Config must be an object");
79
+ const e = o.classToApply;
80
+ if (e === void 0)
81
+ throw new Error('Missing compulsory key: "classToApply"');
82
+ if (typeof e != "string")
83
+ throw new TypeError("classToApply must be a string");
84
+ return !0;
85
+ }, L = (t) => {
86
+ const o = (t == null ? void 0 : t.inConfig) ?? t;
87
+ if (!o || typeof o != "object" || Array.isArray(o))
88
+ throw new TypeError("Config must be an object");
89
+ return rt(o), nt(o), at(o), !0;
90
+ }, st = "table", lt = "", it = [], ct = [], ut = "", dt = "replace", bt = !1, w = {
91
+ type: st,
92
+ targetHtmlId: lt,
93
+ data: it,
94
+ columns: ct,
95
+ classToApply: ut,
96
+ appendPosition: dt,
97
+ showLog: bt
98
+ }, P = (t) => {
99
+ const o = typeof t == "object" && t !== null ? t.inKey ?? t.key : t;
100
+ return o && o in w ? w[o] : { ...w };
101
+ };
102
+ Object.assign(P, w);
103
+ const $ = (t) => {
104
+ const o = (t == null ? void 0 : t.inConfig) ?? t;
105
+ if (!o || typeof o != "object" || Array.isArray(o))
106
+ throw new TypeError("Config must be an object");
107
+ return x(o), L(o), !0;
108
+ };
109
+ $.getSpec = P;
110
+ $.configSpec = w;
111
+ $.guardSpec = x;
112
+ $.guardMount = L;
113
+ const pt = {
114
+ version: "1.22.0",
115
+ name: "json-renderers-build"
116
+ }, mt = (t) => {
117
+ t && (globalThis.ks ?? (globalThis.ks = {}), globalThis.ks.jsonRenderersBuild = {
118
+ meta: pt,
119
+ render: t
120
+ });
121
+ }, ft = (t) => typeof t == "object" && t !== null && !Array.isArray(t), ht = (t, o) => {
122
+ if (!ft(t)) return;
123
+ let e = {};
124
+ for (const [r, a] of Object.entries(t))
125
+ e[r] = m(o, a);
126
+ return e;
127
+ }, yt = (t, o) => {
128
+ const e = structuredClone(t);
129
+ return Array.isArray(e) ? e.map((a) => m(o, a)) : void 0;
130
+ }, D = (t, o, e) => {
131
+ if (t === "${agg:count}" && "rowData" in o) {
132
+ if (Array.isArray(o == null ? void 0 : o.rowData))
133
+ return o == null ? void 0 : o.rowData.length;
134
+ } else
135
+ return t === "${rowValue}" && "rowData" in o ? o == null ? void 0 : o.rowData : t.replace(/\$\{(\w+)\}/g, (r, a) => o[a] !== void 0 ? o[a] : r);
136
+ }, Ct = (t, o) => D(t, o), wt = (t, o, e) => {
137
+ if (e && console.log("inElement : ", t), e && console.log("inTemplate : ", o), o == null)
138
+ throw new TypeError("inTemplate is required");
139
+ if (typeof o != "object" && typeof o != "string")
140
+ throw new TypeError("inTemplate must be an object or string");
141
+ if (!t || typeof t != "object" || Array.isArray(t))
142
+ throw new TypeError("inElement must be an object");
143
+ return !0;
144
+ }, $t = {
145
+ name: "json-transformer-funcs-primitive",
146
+ version: "1.9.0"
147
+ }, gt = (t) => {
148
+ var o, e;
149
+ typeof globalThis > "u" || !t || (globalThis.ks ?? (globalThis.ks = {}), (o = globalThis.ks).applyTemplate ?? (o.applyTemplate = t), (e = globalThis.ks).transformerFuncs ?? (e.transformerFuncs = {}), globalThis.ks.transformerFuncs.primitive = {
150
+ meta: $t,
151
+ applyTemplate: t
152
+ });
153
+ }, m = (t, o, e) => {
154
+ const r = t, a = o;
155
+ wt(r, a, e);
156
+ const n = structuredClone(a);
157
+ return typeof n == "string" ? D(n, r) : (n === null || typeof n != "object" || ("textContent" in n && (n.textContent = Ct(n == null ? void 0 : n.textContent, r)), "attributes" in n && (n.attributes = ht(n == null ? void 0 : n.attributes, r)), "children" in n && (n.children = yt(n == null ? void 0 : n.children, r))), n);
158
+ };
159
+ gt(m);
160
+ const Nt = (t, o) => {
161
+ if (!Array.isArray(t))
162
+ throw new TypeError("inSource must be an Array");
163
+ if (t.length === 0)
164
+ throw new Error("inSource cannot be empty");
165
+ for (let e = 0; e < t.length; e++)
166
+ if (!t[e] || typeof t[e] != "object")
167
+ throw new TypeError(`inSource[${e}] must be an object`);
168
+ if (!o || typeof o != "object" && typeof o != "string")
169
+ throw new TypeError("inTemplate must be an object or string");
170
+ return !0;
171
+ }, h = (t, o) => {
172
+ const e = t, r = o;
173
+ return Nt(e, r), e.map((a) => m(a, r));
174
+ }, xt = (t, o) => t.map((r) => ({
175
+ ...r,
176
+ rowData: o[r.columnName]
177
+ })), Tt = (t, o, e) => {
178
+ var a, n, s, i, l, c;
179
+ if (!Array.isArray(t))
180
+ throw new TypeError("inColumns must be an Array");
181
+ if (t.length === 0)
182
+ throw new Error("inColumns cannot be empty");
183
+ for (let u = 0; u < t.length; u++) {
184
+ const d = t[u];
185
+ if (!d || typeof d != "object")
186
+ throw new TypeError(`inColumns[${u}] must be an object`);
187
+ if (typeof d.columnName != "string" || !d.columnName.trim())
188
+ throw new TypeError(`inColumns[${u}].columnName must be a non-empty string`);
189
+ }
190
+ if (!Array.isArray(o))
191
+ throw new TypeError("inData must be an Array");
192
+ for (let u = 0; u < o.length; u++) {
193
+ const d = o[u];
194
+ if (!d || typeof d != "object")
195
+ throw new TypeError(`inData[${u}] must be an object`);
196
+ }
197
+ if (!e || typeof e != "object" || Array.isArray(e))
198
+ throw new TypeError("inSpec must be an object");
199
+ const r = ((s = (n = (a = t[0]) == null ? void 0 : a.template) == null ? void 0 : n.body) == null ? void 0 : s.tr) || "buildBodyTr";
200
+ if (!(r in e))
201
+ throw new Error(`Row template "${r}" not found in inSpec`);
202
+ for (let u = 0; u < t.length; u++) {
203
+ const d = t[u], b = ((l = (i = d.template) == null ? void 0 : i.body) == null ? void 0 : l.cell) || ((c = d.template) == null ? void 0 : c.bodyCell) || "buildBodyCell";
204
+ if (!(b in e))
205
+ throw new Error(`Cell template "${b}" for column "${d.columnName}" not found in inSpec`);
206
+ }
207
+ return !0;
208
+ }, At = (t, o) => t.map((r) => {
209
+ var i, l, c;
210
+ const a = ((l = (i = r.template) == null ? void 0 : i.body) == null ? void 0 : l.cell) || ((c = r.template) == null ? void 0 : c.bodyCell) || "buildBodyCell", n = o[a];
211
+ return m(r, n);
212
+ }), O = (t, o, e) => {
213
+ var c, u, d;
214
+ Tt(t, o, e);
215
+ const r = t, a = o, n = e, s = ((d = (u = (c = r[0]) == null ? void 0 : c.template) == null ? void 0 : u.body) == null ? void 0 : d.tr) || "buildBodyTr", i = n[s];
216
+ return a.map((b) => {
217
+ const C = m(b, i), _ = xt(r, b), X = At(_, n);
218
+ return C.children = X, C;
219
+ });
220
+ }, y = (t, o) => {
221
+ var e;
222
+ if (((e = t == null ? void 0 : t.attributes) == null ? void 0 : e["data-role"]) === o) return t;
223
+ for (const r of (t == null ? void 0 : t.children) ?? []) {
224
+ const a = y(r, o);
225
+ if (a) return a;
226
+ }
227
+ return null;
228
+ }, It = (t, o) => {
229
+ const e = t[o.fileName], r = o.dataRole ? y(e, o.dataRole) : e;
230
+ return (o.filePath ?? []).reduce((a, n) => a[n], r);
231
+ }, kt = {
232
+ tagName: "tr",
233
+ attributes: {
234
+ class: "align-middle"
235
+ },
236
+ children: []
237
+ }, jt = {
238
+ tagName: "col",
239
+ attributes: {
240
+ width: "${width}"
241
+ }
242
+ }, Ft = {
243
+ tagName: "th",
244
+ textContent: "${columnName}",
245
+ attributes: {
246
+ class: "py-3 px-3 fw-semibold text-uppercase small"
247
+ }
248
+ }, Bt = {
249
+ tagName: "td",
250
+ children: [
251
+ {
252
+ tagName: "input",
253
+ attributes: {
254
+ type: "text",
255
+ placeholder: "enter ${columnName}",
256
+ name: "${columnName}",
257
+ class: "form-control"
258
+ }
259
+ }
260
+ ]
261
+ }, vt = {
262
+ tagName: "td",
263
+ textContent: "${rowValue}",
264
+ attributes: {
265
+ class: "py-3 px-3 text-secondary"
266
+ }
267
+ }, St = {
268
+ tagName: "button",
269
+ textContent: "${columnName}",
270
+ attributes: {
271
+ class: "btn btn-primary btn-sm"
272
+ }
273
+ }, Et = {
274
+ tagName: "td",
275
+ attributes: {
276
+ class: "py-2 px-3 text-center"
277
+ },
278
+ children: [
279
+ {
280
+ tagName: "button",
281
+ textContent: "${agg:count}",
282
+ attributes: {
283
+ class: "btn btn-primary btn-sm"
284
+ }
285
+ }
286
+ ]
287
+ }, Rt = {
288
+ tagName: "option",
289
+ textContent: "${rowValue}",
290
+ attributes: {
291
+ value: "${rowValue}"
292
+ }
293
+ }, Lt = {
294
+ tagName: "select",
295
+ attributes: {
296
+ id: "LedgerName"
297
+ },
298
+ children: []
299
+ }, Pt = {
300
+ tagName: "datalist",
301
+ attributes: {
302
+ "data-name": "${columnName}"
303
+ },
304
+ children: []
305
+ }, j = {
306
+ buildBodyTr: kt,
307
+ buildColGroup: jt,
308
+ buildHeader: Ft,
309
+ buildFooter: Bt,
310
+ buildBodyCell: vt,
311
+ button: St,
312
+ buttonCell: Et,
313
+ buildOption: Rt,
314
+ buildSelect: Lt,
315
+ buildDataList: Pt
316
+ }, Dt = "table", Ot = {
317
+ class: "table table-hover table-striped align-middle border mb-0"
318
+ }, Vt = [
319
+ {
320
+ tagName: "colgroup",
321
+ attributes: {
322
+ "data-role": "table-colgroup"
323
+ },
324
+ children: []
325
+ },
326
+ {
327
+ tagName: "thead",
328
+ attributes: {
329
+ class: "table-dark",
330
+ "data-role": "table-header"
331
+ },
332
+ children: [
333
+ {
334
+ tagName: "tr",
335
+ attributes: {
336
+ "data-role": "table-header-row"
337
+ },
338
+ children: []
339
+ }
340
+ ]
341
+ },
342
+ {
343
+ tagName: "tbody",
344
+ attributes: {
345
+ "data-role": "table-body"
346
+ },
347
+ children: []
348
+ },
349
+ {
350
+ tagName: "tfoot",
351
+ attributes: {
352
+ "data-role": "table-footer"
353
+ },
354
+ children: [
355
+ {
356
+ tagName: "tr",
357
+ attributes: {
358
+ "data-role": "table-footer-row"
359
+ },
360
+ children: []
361
+ }
362
+ ]
363
+ }
364
+ ], V = {
365
+ tagName: Dt,
366
+ attributes: Ot,
367
+ children: Vt
368
+ }, Wt = [
369
+ {
370
+ narration: "Build the column widths for the table using the configured columns.",
371
+ destinationPath: {
372
+ fileName: "base",
373
+ dataRole: "table-colgroup",
374
+ filePath: [
375
+ "children"
376
+ ]
377
+ },
378
+ sourcePath: {
379
+ fileName: "data",
380
+ filePath: [
381
+ "columns"
382
+ ]
383
+ },
384
+ templateKey: "buildColGroup",
385
+ func: "fromCollection"
386
+ },
387
+ {
388
+ narration: "Build the header row for the table using the configured columns.",
389
+ destinationPath: {
390
+ fileName: "base",
391
+ dataRole: "table-header-row",
392
+ filePath: [
393
+ "children"
394
+ ]
395
+ },
396
+ sourcePath: {
397
+ fileName: "data",
398
+ filePath: [
399
+ "columns"
400
+ ]
401
+ },
402
+ templateKey: "buildHeader",
403
+ func: "fromCollection"
404
+ }
405
+ ], qt = [
406
+ {
407
+ narration: "Build the table body rows for the table using the configured columns and data.",
408
+ destinationPath: {
409
+ fileName: "base",
410
+ dataRole: "table-body",
411
+ filePath: [
412
+ "children"
413
+ ]
414
+ },
415
+ sourcePath: {
416
+ fileName: "data",
417
+ filePath: [
418
+ "columns"
419
+ ]
420
+ },
421
+ func: "twoDimensional"
422
+ }
423
+ ], g = (t) => Array.isArray(t) ? t : [t], B = {
424
+ set: (t, o, e) => {
425
+ t[o] = e;
426
+ },
427
+ push: (t, o, e) => {
428
+ t[o].push(...g(e));
429
+ },
430
+ unshift: (t, o, e) => {
431
+ t[o].unshift(...g(e));
432
+ },
433
+ pushToRows: (t, o, e) => {
434
+ t[o].forEach((r) => {
435
+ r.children.push(...structuredClone(g(e)));
436
+ });
437
+ },
438
+ unshiftToRows: (t, o, e) => {
439
+ t[o].forEach((r) => {
440
+ r.children.unshift(...structuredClone(g(e)));
441
+ });
442
+ },
443
+ unshiftSerialToRows: (t, o, e) => {
444
+ t[o].forEach((r, a) => {
445
+ const n = structuredClone(e);
446
+ n.textContent = a + 1, r.children.unshift(n);
447
+ });
448
+ }
449
+ }, W = (t, o, e) => {
450
+ const r = o.dataRole ? y(t[o.fileName], o.dataRole) : t[o.fileName], a = [...o.filePath ?? []], n = a.pop(), s = a.reduce((l, c) => l[c], r);
451
+ (B[o.action] || B.set)(s, n, e);
452
+ }, f = { data: {}, base: V, spec: j }, q = {
453
+ fromCollection: h,
454
+ twoDimensional: O
455
+ }, Ht = (t) => {
456
+ t.forEach((o) => {
457
+ const e = It(f, o.sourcePath);
458
+ if (e) {
459
+ const r = q[o.func](e, j[o.templateKey]);
460
+ W(f, o.destinationPath, r);
461
+ } else
462
+ console.log(" !instruction : ", o), console.log(" !source : ", e);
463
+ });
464
+ }, zt = (t) => {
465
+ t.forEach((o) => {
466
+ const e = q[o.func](
467
+ f.data.columns,
468
+ f.data.data,
469
+ j
470
+ );
471
+ W(f, o.destinationPath, e);
472
+ });
473
+ }, Mt = (t) => (f.data = t, Ht(Wt), zt(qt), V), v = ({
474
+ inData: t,
475
+ inColumns: o,
476
+ inType: e,
477
+ footer: r = [],
478
+ options: a
479
+ } = {}) => Mt({
480
+ columns: o,
481
+ data: t
482
+ }), Gt = ({ inData: t = [], inColumns: o = [] } = {}) => ({
483
+ data: t,
484
+ columns: o
485
+ }), Kt = {
486
+ tagName: "option",
487
+ textContent: "${rowValue}",
488
+ attributes: {
489
+ value: "${rowValue}"
490
+ }
491
+ }, Ut = {
492
+ tagName: "select",
493
+ attributes: {
494
+ id: "LedgerName"
495
+ },
496
+ children: []
497
+ }, Jt = {
498
+ tagName: "datalist",
499
+ attributes: {
500
+ "data-name": "${columnName}"
501
+ },
502
+ children: []
503
+ }, p = {
504
+ buildOption: Kt,
505
+ buildSelect: Ut,
506
+ buildDataList: Jt
507
+ }, _t = (t, o = p.buildOption) => {
508
+ const e = structuredClone(o);
509
+ return e.textContent = e.textContent.replace("rowValue", t), e.attributes.value = e.attributes.value.replace("rowValue", t), e;
510
+ }, Xt = (t, o) => {
511
+ const e = o == null ? void 0 : o.columnName, r = structuredClone(p.buildSelect);
512
+ r.attributes.id = e, r.attributes["data-name"] = e;
513
+ const a = _t(e, p.buildOption);
514
+ return r.children = h(t, a), r;
515
+ }, Qt = ({ data: t, columns: o }) => o.map((e) => Xt(t, e)), Yt = (t = {}) => {
516
+ const { data: o, columns: e } = Gt(t);
517
+ return Qt({ data: o, columns: e });
518
+ }, Zt = ({ inData: t = [], inColumns: o = [] } = {}) => ({
519
+ data: t,
520
+ columns: o
521
+ }), te = (t, o = p.buildOption) => {
522
+ const e = structuredClone(o);
523
+ return e.textContent = e.textContent.replace("rowValue", t), e.attributes.value = e.attributes.value.replace("rowValue", t), e;
524
+ }, ee = (t, o) => {
525
+ const e = o == null ? void 0 : o.columnName, r = te(e, p.buildOption);
526
+ return h(t, r);
527
+ }, oe = ({ data: t, columns: o }) => o.map((e) => ee(t, e)), re = (t = {}) => {
528
+ const { data: o, columns: e } = Zt(t);
529
+ return oe({ data: o, columns: e });
530
+ }, ne = ({ inData: t = [], inColumns: o = [] } = {}) => ({
531
+ data: t,
532
+ columns: o
533
+ }), ae = (t, o = p.buildOption) => {
534
+ const e = structuredClone(o);
535
+ return e.textContent = e.textContent.replace("rowValue", t), e.attributes.value = e.attributes.value.replace("rowValue", t), e;
536
+ }, se = (t, o) => {
537
+ const e = o == null ? void 0 : o.columnName, r = structuredClone(p.buildDataList);
538
+ r.attributes.id = e, r.attributes["data-name"] = e;
539
+ const a = ae(e, p.buildOption);
540
+ return r.children = h(t, a), r;
541
+ }, le = ({ data: t, columns: o }) => o.map((e) => se(t, e)), S = (t = {}) => {
542
+ const { data: o, columns: e } = ne(t);
543
+ return le({ data: o, columns: e });
544
+ }, ie = {
545
+ version: "1.2.0",
546
+ name: "json-renderers-build-input-row"
547
+ }, ce = (t) => {
548
+ const o = t;
549
+ if (typeof globalThis > "u" || !o) return;
550
+ globalThis.ks ?? (globalThis.ks = {});
551
+ const e = typeof o == "function" ? o : o.render;
552
+ globalThis.ks.jsonRenderersBuildInputRow = {
553
+ meta: ie,
554
+ render: e,
555
+ ...typeof o == "object" ? o : {}
556
+ };
557
+ }, ue = "input", de = {
558
+ type: "search",
559
+ placeholder: "Search...",
560
+ class: "form-control",
561
+ id: "searchInputId"
562
+ }, be = {
563
+ tagName: ue,
564
+ attributes: de
565
+ }, N = ({ inOptions: t = {}, options: o = {} } = {}) => {
566
+ const e = t && Object.keys(t).length > 0 ? t : o, r = structuredClone(be);
567
+ return e.placeholder && (r.attributes.placeholder = e.placeholder), e.class && (r.attributes.class = e.class), e.id && (r.attributes.id = e.id), e.name && (r.attributes.name = e.name), e.type && (r.attributes.type = e.type), e.value && (r.attributes.value = e.value), r;
568
+ }, pe = "div", me = {
569
+ class: "d-flex align-items-center gap-2"
570
+ }, fe = [
571
+ {
572
+ tagName: "label",
573
+ textContent: "Search:",
574
+ attributes: {
575
+ class: "form-label mb-0 text-nowrap fw-semibold",
576
+ for: "searchInputId"
577
+ }
578
+ },
579
+ {
580
+ tagName: "input",
581
+ attributes: {
582
+ type: "search",
583
+ placeholder: "Search...",
584
+ class: "form-control",
585
+ id: "searchInputId"
586
+ }
587
+ }
588
+ ], he = {
589
+ tagName: pe,
590
+ attributes: me,
591
+ children: fe
592
+ }, T = ({ inOptions: t = {}, options: o = {} } = {}) => {
593
+ const e = t && Object.keys(t).length > 0 ? t : o, r = structuredClone(he), a = r.children[0], n = r.children[1];
594
+ return e.label && (a.textContent = e.label), e.id && (a.attributes.for = e.id, n.attributes.id = e.id), e.placeholder && (n.attributes.placeholder = e.placeholder), e.class && (n.attributes.class = e.class), e.name && (n.attributes.name = e.name), e.type && (n.attributes.type = e.type), e.wrapperClass && (r.attributes.class = e.wrapperClass), e.labelClass && (a.attributes.class = e.labelClass), r;
595
+ }, ye = "div", Ce = {
596
+ class: "d-flex align-items-center gap-2"
597
+ }, we = [
598
+ {
599
+ tagName: "label",
600
+ textContent: "Search:",
601
+ attributes: {
602
+ class: "form-label mb-0 text-nowrap fw-semibold",
603
+ for: "searchInputId"
604
+ }
605
+ },
606
+ {
607
+ tagName: "input",
608
+ attributes: {
609
+ type: "search",
610
+ placeholder: "Search...",
611
+ class: "form-control",
612
+ id: "searchInputId"
613
+ }
614
+ },
615
+ {
616
+ tagName: "button",
617
+ textContent: "Search",
618
+ attributes: {
619
+ type: "button",
620
+ class: "btn btn-primary text-nowrap",
621
+ id: "searchButtonId"
622
+ }
623
+ }
624
+ ], $e = {
625
+ tagName: ye,
626
+ attributes: Ce,
627
+ children: we
628
+ }, F = ({ inOptions: t = {}, options: o = {} } = {}) => {
629
+ const e = t && Object.keys(t).length > 0 ? t : o, r = structuredClone($e), a = r.children[0], n = r.children[1], s = r.children[2];
630
+ return e.label && (a.textContent = e.label), e.id && (a.attributes.for = e.id, n.attributes.id = e.id), e.placeholder && (n.attributes.placeholder = e.placeholder), e.class && (n.attributes.class = e.class), e.name && (n.attributes.name = e.name), e.type && (n.attributes.type = e.type), e.buttonText && (s.textContent = e.buttonText), e.buttonClass && (s.attributes.class = e.buttonClass), e.buttonId && (s.attributes.id = e.buttonId), e.wrapperClass && (r.attributes.class = e.wrapperClass), e.labelClass && (a.attributes.class = e.labelClass), r;
631
+ }, ge = {
632
+ input: N,
633
+ inputOnly: N,
634
+ inputWithLabel: T,
635
+ inputWithLabelButton: F
636
+ }, Ne = ({
637
+ type: t = "inputWithLabel",
638
+ options: o = {},
639
+ inType: e,
640
+ inOptions: r
641
+ } = {}) => {
642
+ const a = e ?? t, n = r ?? o;
643
+ return (ge[a] || T)({ inOptions: n, options: n });
644
+ };
645
+ ce({
646
+ render: Ne,
647
+ inputOnly: N,
648
+ inputWithLabel: T,
649
+ inputWithLabelButton: F
650
+ });
651
+ const A = ({ inOptions: t = {}, options: o = {} } = {}) => {
652
+ const e = t && Object.keys(t).length > 0 ? t : o;
653
+ return (e == null ? void 0 : e.label) === !1 || (e == null ? void 0 : e.flavour) === "inputOnly" ? N({ inOptions: e }) : (e == null ? void 0 : e.flavour) === "inputWithLabelButton" || e != null && e.button || e != null && e.buttonText ? F({ inOptions: e }) : T({ inOptions: e });
654
+ }, xe = {
655
+ version: "1.2.0",
656
+ name: "json-renderers-build-form"
657
+ }, Te = (t) => {
658
+ typeof globalThis > "u" || !t || (globalThis.ks ?? (globalThis.ks = {}), globalThis.ks.jsonRenderersBuildForm = { meta: xe, render: t });
659
+ }, Ae = "div", Ie = {
660
+ class: "${cardClass}",
661
+ "data-role": "form-card"
662
+ }, ke = [
663
+ {
664
+ tagName: "header",
665
+ attributes: {
666
+ class: "${headerClass}",
667
+ "data-role": "form-header"
668
+ },
669
+ children: [
670
+ {
671
+ tagName: "div",
672
+ attributes: {
673
+ class: "${headingClass}"
674
+ },
675
+ children: [
676
+ {
677
+ tagName: "h2",
678
+ textContent: "${title}",
679
+ attributes: {
680
+ class: "${titleClass}"
681
+ }
682
+ },
683
+ {
684
+ tagName: "p",
685
+ textContent: "${description}",
686
+ attributes: {
687
+ class: "${descriptionClass}"
688
+ }
689
+ }
690
+ ]
691
+ },
692
+ {
693
+ tagName: "span",
694
+ textContent: "${recordId}",
695
+ attributes: {
696
+ class: "${recordIdClass}",
697
+ "data-role": "record-id"
698
+ }
699
+ },
700
+ {
701
+ tagName: "div",
702
+ attributes: {
703
+ class: "${headerActionsClass}",
704
+ "data-role": "header-actions"
705
+ },
706
+ children: []
707
+ }
708
+ ]
709
+ },
710
+ {
711
+ tagName: "div",
712
+ attributes: {
713
+ class: "${cardBodyClass}"
714
+ },
715
+ children: [
716
+ {
717
+ tagName: "form",
718
+ attributes: {
719
+ id: "${formId}",
720
+ "data-role": "form-body"
721
+ },
722
+ children: []
723
+ }
724
+ ]
725
+ },
726
+ {
727
+ tagName: "footer",
728
+ attributes: {
729
+ class: "${footerClass}",
730
+ "data-role": "form-footer"
731
+ },
732
+ children: [
733
+ {
734
+ tagName: "div",
735
+ attributes: {
736
+ class: "${footerActionsClass}",
737
+ "data-role": "footer-actions"
738
+ },
739
+ children: []
740
+ }
741
+ ]
742
+ }
743
+ ], je = {
744
+ tagName: Ae,
745
+ attributes: Ie,
746
+ children: ke
747
+ }, Fe = () => structuredClone(je), Be = "header-actions", ve = "button", E = {
748
+ destinationRole: Be,
749
+ template: ve
750
+ }, Se = {
751
+ tagName: "button",
752
+ textContent: "${label}",
753
+ attributes: {
754
+ type: "${type}",
755
+ form: "${formId}",
756
+ class: "${buttonClass} ${buttonSizeClass} ${buttonPaddingClass}"
757
+ }
758
+ }, Ee = {
759
+ button: Se
760
+ }, Re = (t, o) => {
761
+ const e = structuredClone(t), r = h(o.header.actions, Ee[E.template]);
762
+ return y(e, E.destinationRole).children.push(...r), e;
763
+ }, Le = "form-body", Pe = {
764
+ destinationRole: Le
765
+ }, De = {
766
+ tagName: "div",
767
+ attributes: {
768
+ class: "${rowClass}"
769
+ },
770
+ children: []
771
+ }, Oe = {
772
+ tagName: "div",
773
+ attributes: {
774
+ class: "${fieldClass}"
775
+ },
776
+ children: [
777
+ {
778
+ tagName: "label",
779
+ textContent: "${label}",
780
+ attributes: {
781
+ class: "${labelClass}",
782
+ for: "${columnName}"
783
+ }
784
+ },
785
+ {
786
+ tagName: "input",
787
+ attributes: {
788
+ type: "${type}",
789
+ class: "${inputClass} ${inputSizeClass}",
790
+ id: "${columnName}",
791
+ name: "${columnName}",
792
+ placeholder: "${placeholder}",
793
+ value: "${rowValue}"
794
+ }
795
+ }
796
+ ]
797
+ }, Ve = {
798
+ tagName: "div",
799
+ attributes: {
800
+ class: "${fieldClass}"
801
+ },
802
+ children: [
803
+ {
804
+ tagName: "label",
805
+ textContent: "${label}",
806
+ attributes: {
807
+ class: "${labelClass}",
808
+ for: "${columnName}"
809
+ }
810
+ },
811
+ {
812
+ tagName: "input",
813
+ attributes: {
814
+ type: "${type}",
815
+ class: "${inputClass} ${inputSizeClass}",
816
+ id: "${columnName}",
817
+ name: "${columnName}",
818
+ placeholder: "${placeholder}",
819
+ value: "${rowValue}",
820
+ required: "required"
821
+ }
822
+ }
823
+ ]
824
+ }, We = {
825
+ tagName: "div",
826
+ attributes: {
827
+ class: "${fieldClass}"
828
+ },
829
+ children: [
830
+ {
831
+ tagName: "label",
832
+ textContent: "${label}",
833
+ attributes: {
834
+ class: "${labelClass}",
835
+ for: "${columnName}"
836
+ }
837
+ },
838
+ {
839
+ tagName: "textarea",
840
+ textContent: "${rowValue}",
841
+ attributes: {
842
+ class: "${inputClass} ${inputSizeClass}",
843
+ rows: "3",
844
+ id: "${columnName}",
845
+ name: "${columnName}",
846
+ placeholder: "${placeholder}"
847
+ }
848
+ }
849
+ ]
850
+ }, qe = {
851
+ tagName: "div",
852
+ attributes: {
853
+ class: "${checkboxWrapperClass} ${fieldClass}"
854
+ },
855
+ children: [
856
+ {
857
+ tagName: "input",
858
+ attributes: {
859
+ type: "checkbox",
860
+ class: "${checkboxInputClass}",
861
+ id: "${columnName}",
862
+ name: "${columnName}",
863
+ value: "true"
864
+ }
865
+ },
866
+ {
867
+ tagName: "label",
868
+ textContent: "${label}",
869
+ attributes: {
870
+ class: "${checkboxLabelClass}",
871
+ for: "${columnName}"
872
+ }
873
+ }
874
+ ]
875
+ }, He = {
876
+ tagName: "div",
877
+ attributes: {
878
+ class: "${fieldClass}"
879
+ },
880
+ children: [
881
+ {
882
+ tagName: "label",
883
+ textContent: "${label}",
884
+ attributes: {
885
+ class: "${inlineLabelClass}",
886
+ for: "${columnName}"
887
+ }
888
+ },
889
+ {
890
+ tagName: "input",
891
+ attributes: {
892
+ type: "${type}",
893
+ class: "${inputClass} ${inputSizeClass} ${inlineInputClass}",
894
+ id: "${columnName}",
895
+ name: "${columnName}",
896
+ placeholder: "${placeholder}",
897
+ value: "${rowValue}"
898
+ }
899
+ }
900
+ ]
901
+ }, ze = {
902
+ tagName: "div",
903
+ attributes: {
904
+ class: "${fieldClass}"
905
+ },
906
+ children: [
907
+ {
908
+ tagName: "label",
909
+ textContent: "${label}",
910
+ attributes: {
911
+ class: "${inlineLabelClass}",
912
+ for: "${columnName}"
913
+ }
914
+ },
915
+ {
916
+ tagName: "input",
917
+ attributes: {
918
+ type: "${type}",
919
+ class: "${inputClass} ${inputSizeClass} ${inlineInputClass}",
920
+ id: "${columnName}",
921
+ name: "${columnName}",
922
+ placeholder: "${placeholder}",
923
+ value: "${rowValue}",
924
+ required: "required"
925
+ }
926
+ }
927
+ ]
928
+ }, Me = {
929
+ tagName: "div",
930
+ attributes: {
931
+ class: "${fieldClass}"
932
+ },
933
+ children: [
934
+ {
935
+ tagName: "label",
936
+ textContent: "${label}",
937
+ attributes: {
938
+ class: "${inlineLabelClass}",
939
+ for: "${columnName}"
940
+ }
941
+ },
942
+ {
943
+ tagName: "input",
944
+ attributes: {
945
+ type: "${type}",
946
+ class: "${inputClass} ${inputSizeClass} ${inlineInputClass}",
947
+ id: "${columnName}",
948
+ name: "${columnName}",
949
+ placeholder: "${placeholder}",
950
+ value: "${rowValue}"
951
+ }
952
+ },
953
+ {
954
+ tagName: "button",
955
+ textContent: "${buttonText}",
956
+ attributes: {
957
+ type: "${buttonType}",
958
+ class: "${inlineButtonClass}"
959
+ }
960
+ }
961
+ ]
962
+ }, Ge = {
963
+ tagName: "div",
964
+ attributes: {
965
+ class: "${fieldClass}"
966
+ },
967
+ children: [
968
+ {
969
+ tagName: "label",
970
+ textContent: "${label}",
971
+ attributes: {
972
+ class: "${inlineLabelClass}",
973
+ for: "${columnName}"
974
+ }
975
+ },
976
+ {
977
+ tagName: "input",
978
+ attributes: {
979
+ type: "${type}",
980
+ class: "${inputClass} ${inputSizeClass} ${inlineInputClass}",
981
+ id: "${columnName}",
982
+ name: "${columnName}",
983
+ placeholder: "${placeholder}",
984
+ value: "${rowValue}",
985
+ required: "required"
986
+ }
987
+ },
988
+ {
989
+ tagName: "button",
990
+ textContent: "${buttonText}",
991
+ attributes: {
992
+ type: "${buttonType}",
993
+ class: "${inlineButtonClass}"
994
+ }
995
+ }
996
+ ]
997
+ }, Ke = {
998
+ tagName: "div",
999
+ attributes: {
1000
+ class: "${fieldClass}"
1001
+ },
1002
+ children: [
1003
+ {
1004
+ tagName: "label",
1005
+ textContent: "${label}",
1006
+ attributes: {
1007
+ class: "${inlineLabelClass}",
1008
+ for: "${columnName}"
1009
+ }
1010
+ },
1011
+ {
1012
+ tagName: "textarea",
1013
+ textContent: "${rowValue}",
1014
+ attributes: {
1015
+ class: "${inputClass} ${inputSizeClass} ${inlineInputClass}",
1016
+ rows: "3",
1017
+ id: "${columnName}",
1018
+ name: "${columnName}",
1019
+ placeholder: "${placeholder}"
1020
+ }
1021
+ }
1022
+ ]
1023
+ }, Ue = {
1024
+ tagName: "div",
1025
+ attributes: {
1026
+ class: "${inlineCheckboxWrapperClass}"
1027
+ },
1028
+ children: [
1029
+ {
1030
+ tagName: "input",
1031
+ attributes: {
1032
+ type: "checkbox",
1033
+ class: "${checkboxInputClass}",
1034
+ id: "${columnName}",
1035
+ name: "${columnName}",
1036
+ value: "true"
1037
+ }
1038
+ },
1039
+ {
1040
+ tagName: "label",
1041
+ textContent: "${label}",
1042
+ attributes: {
1043
+ class: "${checkboxLabelClass}",
1044
+ for: "${columnName}"
1045
+ }
1046
+ }
1047
+ ]
1048
+ }, Je = {
1049
+ buildBodyTr: De,
1050
+ buildBodyCell: Oe,
1051
+ buildRequiredField: Ve,
1052
+ buildTextareaField: We,
1053
+ buildCheckboxField: qe,
1054
+ buildInlineField: He,
1055
+ buildInlineRequiredField: ze,
1056
+ buildInlineFieldWithButton: Me,
1057
+ buildInlineRequiredFieldWithButton: Ge,
1058
+ buildInlineTextareaField: Ke,
1059
+ buildInlineCheckboxField: Ue
1060
+ }, _e = (t, o, e) => {
1061
+ const r = t.map((s) => {
1062
+ var c, u, d, b, C;
1063
+ const i = ((u = (c = s.template) == null ? void 0 : c.body) == null ? void 0 : u.cell) ?? (s.required ? "buildRequiredField" : "buildBodyCell");
1064
+ let l = ((d = e.fieldTemplates) == null ? void 0 : d[i]) ?? i;
1065
+ return s.buttonText && (l = ((b = e.buttonFieldTemplates) == null ? void 0 : b[l]) ?? l), {
1066
+ ...s,
1067
+ label: s.label ?? s.title ?? s.columnName,
1068
+ type: s.type ?? "text",
1069
+ placeholder: s.placeholder ?? "",
1070
+ buttonType: s.buttonType ?? "button",
1071
+ template: { ...s.template, body: { ...(C = s.template) == null ? void 0 : C.body, cell: l } }
1072
+ };
1073
+ }), a = o[0] ?? {}, n = Object.fromEntries(r.map((s) => [
1074
+ s.columnName,
1075
+ a[s.columnName] ?? s.value ?? ""
1076
+ ]));
1077
+ return { columns: r, rows: [n] };
1078
+ }, Xe = (t, o, e) => {
1079
+ const r = _e(o.columns, o.records, e.body), a = O(r.columns, r.rows, Je), n = structuredClone(t);
1080
+ return y(n, Pe.destinationRole).children.push(...Array.isArray(a) ? a : [a]), n;
1081
+ }, Qe = "footer-actions", Ye = "button", R = {
1082
+ destinationRole: Qe,
1083
+ template: Ye
1084
+ }, Ze = {
1085
+ tagName: "button",
1086
+ textContent: "${label}",
1087
+ attributes: {
1088
+ type: "${type}",
1089
+ form: "${formId}",
1090
+ class: "${buttonClass} ${buttonSizeClass} ${buttonPaddingClass}"
1091
+ }
1092
+ }, to = {
1093
+ button: Ze
1094
+ }, eo = (t, o) => {
1095
+ const e = structuredClone(t), r = h(o.footer.actions, to[R.template]);
1096
+ return y(e, R.destinationRole).children.push(...r), e;
1097
+ }, H = ({ inColumns: t, inData: o, inOptions: e, columns: r, data: a, options: n } = {}) => ({
1098
+ columns: Array.isArray(t) && t.length > 0 ? t : Array.isArray(r) ? r : [],
1099
+ records: Array.isArray(o) && o.length > 0 ? o : Array.isArray(a) ? a : [],
1100
+ options: e && Object.keys(e).length > 0 ? e : n ?? {}
1101
+ }), oo = "bigButtonsForm", ro = "Account details", no = "Update your profile information.", ao = "", so = "label", lo = "stacked", io = "saveCancel", co = {
1102
+ formId: oo,
1103
+ title: ro,
1104
+ description: no,
1105
+ recordId: ao,
1106
+ header: so,
1107
+ body: lo,
1108
+ footer: io
1109
+ }, uo = {
1110
+ actions: []
1111
+ }, bo = {
1112
+ actions: []
1113
+ }, po = {
1114
+ actions: [
1115
+ {
1116
+ label: "Refresh",
1117
+ type: "button",
1118
+ buttonClass: "${headerButtonClass}"
1119
+ }
1120
+ ]
1121
+ }, mo = {
1122
+ actions: []
1123
+ }, fo = {
1124
+ none: uo,
1125
+ label: bo,
1126
+ labelWithRefresh: po,
1127
+ labelWithId: mo
1128
+ }, ho = {
1129
+ fieldTemplates: {
1130
+ buildBodyCell: "buildInlineField",
1131
+ buildRequiredField: "buildInlineRequiredField",
1132
+ buildTextareaField: "buildInlineTextareaField",
1133
+ buildCheckboxField: "buildInlineCheckboxField"
1134
+ },
1135
+ buttonFieldTemplates: {
1136
+ buildInlineField: "buildInlineFieldWithButton",
1137
+ buildInlineRequiredField: "buildInlineRequiredFieldWithButton"
1138
+ }
1139
+ }, yo = {
1140
+ fieldTemplates: {},
1141
+ buttonFieldTemplates: {}
1142
+ }, Co = {
1143
+ fieldTemplates: {},
1144
+ buttonFieldTemplates: {}
1145
+ }, wo = {
1146
+ inline: ho,
1147
+ stacked: yo,
1148
+ threeColumns: Co
1149
+ }, $o = {
1150
+ actions: []
1151
+ }, go = {
1152
+ actions: [
1153
+ {
1154
+ label: "Save",
1155
+ type: "submit",
1156
+ buttonClass: "${primaryButtonClass}"
1157
+ },
1158
+ {
1159
+ label: "Cancel",
1160
+ type: "reset",
1161
+ buttonClass: "${secondaryButtonClass}"
1162
+ }
1163
+ ]
1164
+ }, No = {
1165
+ actions: [
1166
+ {
1167
+ label: "Edit",
1168
+ type: "button",
1169
+ buttonClass: "${infoButtonClass}"
1170
+ }
1171
+ ]
1172
+ }, xo = {
1173
+ none: $o,
1174
+ saveCancel: go,
1175
+ edit: No
1176
+ }, I = (t, o, e) => {
1177
+ const r = t[o];
1178
+ if (!r) throw new RangeError("Unknown bigButtons " + e + ": " + o);
1179
+ return r;
1180
+ }, z = (t) => {
1181
+ if (typeof t != "object" || t === null || Array.isArray(t))
1182
+ throw new TypeError("bigButtons options must be an object keyed by renderer type");
1183
+ const o = t["form.bigButtons"] ?? {};
1184
+ if (typeof o != "object" || o === null || Array.isArray(o))
1185
+ throw new TypeError('options["form.bigButtons"] must be an object');
1186
+ const e = { ...co, ...o };
1187
+ return {
1188
+ options: e,
1189
+ header: I(fo, e.header, "header"),
1190
+ body: I(wo, e.body, "body"),
1191
+ footer: I(xo, e.footer, "footer")
1192
+ };
1193
+ }, To = (t, o = {}) => {
1194
+ const e = H(o), r = z(e.options), a = Re(t, r), n = Xe(a, e, r);
1195
+ return eo(n, r);
1196
+ }, Ao = {
1197
+ none: {
1198
+ headerClass: "d-none",
1199
+ headerActionsClass: "d-none"
1200
+ },
1201
+ label: {
1202
+ headerClass: "card-header d-flex align-items-center justify-content-between gap-3",
1203
+ headingClass: "me-auto",
1204
+ titleClass: "h4 fw-semibold mb-1",
1205
+ descriptionClass: "text-muted mb-0",
1206
+ recordIdClass: "d-none",
1207
+ headerActionsClass: "d-none",
1208
+ headerButtonClass: "btn btn-outline-secondary text-nowrap"
1209
+ },
1210
+ labelWithRefresh: {
1211
+ headerClass: "card-header d-flex align-items-center justify-content-between gap-3",
1212
+ headingClass: "me-auto",
1213
+ titleClass: "h4 fw-semibold mb-1",
1214
+ descriptionClass: "text-muted mb-0",
1215
+ recordIdClass: "d-none",
1216
+ headerActionsClass: "d-flex align-items-center gap-2",
1217
+ headerButtonClass: "btn btn-outline-secondary text-nowrap"
1218
+ },
1219
+ labelWithId: {
1220
+ headerClass: "card-header d-flex align-items-center justify-content-between gap-3",
1221
+ headingClass: "me-auto",
1222
+ titleClass: "h4 fw-semibold mb-1",
1223
+ descriptionClass: "text-muted mb-0",
1224
+ recordIdClass: "badge text-bg-light border text-secondary",
1225
+ headerActionsClass: "d-none",
1226
+ headerButtonClass: "btn btn-outline-secondary text-nowrap"
1227
+ }
1228
+ }, Io = {
1229
+ bootstrap: Ao
1230
+ }, ko = (t, o) => {
1231
+ var r;
1232
+ const e = (r = Io[o]) == null ? void 0 : r[t.header];
1233
+ if (!e) throw new RangeError("Unknown bigButtons header: " + t.header);
1234
+ return e;
1235
+ }, jo = "bootstrap", Fo = {
1236
+ bootstrap: {
1237
+ base: {
1238
+ cardClass: "card border-0 shadow-sm w-100",
1239
+ cardBodyClass: "card-body p-4 p-lg-5",
1240
+ labelClass: "form-label fw-semibold",
1241
+ inputClass: "form-control",
1242
+ inputSizeClass: "form-control-lg",
1243
+ checkboxWrapperClass: "form-check mb-3",
1244
+ checkboxInputClass: "form-check-input",
1245
+ checkboxLabelClass: "form-check-label"
1246
+ },
1247
+ bodies: {
1248
+ inline: {
1249
+ rowClass: "vstack gap-3",
1250
+ fieldClass: "d-flex align-items-center gap-3",
1251
+ inlineLabelClass: "form-label fw-semibold mb-0 text-nowrap",
1252
+ inlineInputClass: "flex-grow-1",
1253
+ inlineCheckboxWrapperClass: "form-check d-flex align-items-center gap-2"
1254
+ },
1255
+ stacked: {
1256
+ rowClass: "vstack gap-3",
1257
+ fieldClass: "w-100"
1258
+ },
1259
+ threeColumns: {
1260
+ rowClass: "row g-3",
1261
+ fieldClass: "col-md-4"
1262
+ }
1263
+ }
1264
+ }
1265
+ }, k = {
1266
+ defaultFramework: jo,
1267
+ frameworks: Fo
1268
+ }, Bo = (t, o) => {
1269
+ const e = k.frameworks[o];
1270
+ if (!e) throw new RangeError("Unknown bigButtons framework: " + o);
1271
+ const r = e.bodies[t.body];
1272
+ if (!r) throw new RangeError("Unknown bigButtons body: " + t.body);
1273
+ return { ...e.base, ...r };
1274
+ }, vo = {
1275
+ base: {
1276
+ footerClass: "card-footer bg-transparent",
1277
+ footerActionsClass: "d-flex flex-wrap justify-content-end gap-2",
1278
+ buttonSizeClass: "btn-lg",
1279
+ buttonPaddingClass: "px-4 py-2",
1280
+ primaryButtonClass: "btn btn-primary text-nowrap",
1281
+ secondaryButtonClass: "btn btn-outline-secondary text-nowrap",
1282
+ infoButtonClass: "btn btn-outline-info text-nowrap",
1283
+ inlineButtonClass: "btn btn-outline-secondary text-nowrap"
1284
+ },
1285
+ footers: {
1286
+ none: {
1287
+ footerClass: "d-none"
1288
+ },
1289
+ saveCancel: {},
1290
+ edit: {}
1291
+ }
1292
+ }, So = {
1293
+ bootstrap: vo
1294
+ }, Eo = (t, o) => {
1295
+ const e = So[o], r = e == null ? void 0 : e.footers[t.footer];
1296
+ if (!e) throw new RangeError("Unknown bigButtons framework: " + o);
1297
+ if (!r) throw new RangeError("Unknown bigButtons footer: " + t.footer);
1298
+ return { ...e.base, ...r };
1299
+ }, Ro = (t, o = {}) => {
1300
+ const e = z(H(o).options), { options: r } = e, a = r.framework ?? k.defaultFramework;
1301
+ if (!k.frameworks[a]) throw new RangeError("Unknown bigButtons framework: " + a);
1302
+ const s = Object.assign(
1303
+ {},
1304
+ r,
1305
+ Bo(r, a),
1306
+ ko(r, a),
1307
+ Eo(r, a)
1308
+ );
1309
+ return m(s, structuredClone(t));
1310
+ }, Lo = (t = {}) => {
1311
+ const o = Fe(), e = To(o, t);
1312
+ return Ro(e, t);
1313
+ }, M = (t = {}) => {
1314
+ const o = { ...t, type: t.type ?? "form.bigButtons" };
1315
+ return x(o), Lo(o);
1316
+ };
1317
+ Te(M);
1318
+ const Po = ({
1319
+ inType: t = "stacked",
1320
+ inData: o,
1321
+ inColumns: e
1322
+ } = {}) => M({
1323
+ type: t,
1324
+ columns: e,
1325
+ data: o
1326
+ }), Do = {
1327
+ table: v,
1328
+ tableFromSpec: v,
1329
+ select: Yt,
1330
+ selectOptionsOnly: re,
1331
+ dataList: S,
1332
+ datalist: S,
1333
+ searchInput: A,
1334
+ search: A,
1335
+ inputRow: A,
1336
+ form: Po
1337
+ }, G = (t = {}) => {
1338
+ x(t);
1339
+ const o = t == null ? void 0 : t.showLog, e = t.type;
1340
+ let r = e, a = e;
1341
+ if (e.includes(".")) {
1342
+ const i = e.split(".");
1343
+ r = i[0], a = i[1];
1344
+ }
1345
+ const n = Do[r];
1346
+ if (!n)
1347
+ throw new Error(`Renderer for type "${r}" not found.`);
1348
+ const s = n({
1349
+ inType: a,
1350
+ inColumns: t.columns,
1351
+ inData: t.data,
1352
+ inOptions: t.options,
1353
+ options: t.options
1354
+ });
1355
+ return o && console.log("json-renderers-build output:", s), s;
1356
+ };
1357
+ mt(G);
1358
+ const Oo = ({
1359
+ inColumns: t,
1360
+ inType: o = "table",
1361
+ inData: e,
1362
+ inShowLog: r = !1
1363
+ } = {}) => G({
1364
+ type: o,
1365
+ data: e ?? [],
1366
+ columns: t,
1367
+ showLog: r
1368
+ }), Vo = {
1369
+ version: "v9",
1370
+ description: "JSON-to-DOM engine with SVG namespace support, mixed text content, and centralized traversal"
1371
+ }, Wo = (t) => {
1372
+ if (typeof globalThis > "u" || !t) return;
1373
+ globalThis.ks ?? (globalThis.ks = {});
1374
+ const o = {
1375
+ meta: Vo,
1376
+ buildSpecElement: t
1377
+ };
1378
+ globalThis.ks["json-to-tag"] = o, globalThis.ks.jsonToTag = o;
1379
+ }, qo = (t) => t == null ? null : typeof Node < "u" && t instanceof Node ? t : typeof t == "string" || typeof t == "number" ? document.createTextNode(String(t)) : typeof t == "object" && (t.nodeType === 3 || t.tagName === "#text" || !t.tagName && (t.textContent !== void 0 || t.text !== void 0)) ? document.createTextNode(t.textContent ?? t.text ?? "") : U(t), K = (t) => Array.isArray(t) ? t.map(qo).flat(1 / 0).filter(Boolean) : [], Ho = (t) => (t == null, t), zo = "http://www.w3.org/2000/svg", Mo = /* @__PURE__ */ new Set([
1380
+ "svg",
1381
+ "path",
1382
+ "symbol",
1383
+ "use",
1384
+ "g",
1385
+ "circle",
1386
+ "ellipse",
1387
+ "rect",
1388
+ "line",
1389
+ "polyline",
1390
+ "polygon",
1391
+ "text",
1392
+ "tspan",
1393
+ "defs",
1394
+ "clippath",
1395
+ "mask",
1396
+ "pattern",
1397
+ "marker",
1398
+ "lineargradient",
1399
+ "radialgradient",
1400
+ "stop",
1401
+ "image",
1402
+ "filter",
1403
+ "fegaussianblur",
1404
+ "femerge",
1405
+ "femergenode"
1406
+ ]), Go = ({ inTagName: t }) => {
1407
+ const o = t == null ? void 0 : t.toLowerCase();
1408
+ if (!o) return null;
1409
+ if (o === "checkbox") {
1410
+ const e = document.createElement("input");
1411
+ return e.type = "checkbox", e;
1412
+ }
1413
+ return Mo.has(o) ? document.createElementNS(zo, o) : document.createElement(o);
1414
+ }, Ko = ({ inElement: t, inTextContent: o }) => (!t || o === void 0 || o === null || (t.textContent = o), t), Uo = ({ inElement: t, inProperties: o }) => (t && o && typeof o == "object" && Object.assign(t, o), t), Jo = "http://www.w3.org/1999/xlink", _o = ({ inElement: t, inAttributes: o }) => {
1415
+ const e = t, r = o;
1416
+ if (!e || !r || typeof r != "object")
1417
+ return e;
1418
+ const a = typeof SVGElement < "u" ? e instanceof SVGElement : e.namespaceURI === "http://www.w3.org/2000/svg";
1419
+ return Object.entries(r).forEach(([n, s]) => {
1420
+ if (n === "class") {
1421
+ a ? e.setAttribute("class", String(s)) : e.className = s;
1422
+ return;
1423
+ }
1424
+ if (n === "xlink:href" || n === "href") {
1425
+ if (s != null) {
1426
+ const i = String(s);
1427
+ if (a)
1428
+ try {
1429
+ e.setAttributeNS(Jo, "href", i);
1430
+ } catch {
1431
+ }
1432
+ e.setAttribute("href", i), e.setAttribute("xlink:href", i);
1433
+ }
1434
+ return;
1435
+ }
1436
+ if (typeof s == "boolean") {
1437
+ s ? e.setAttribute(n, "") : e.removeAttribute(n);
1438
+ return;
1439
+ }
1440
+ s != null && e.setAttribute(n, String(s));
1441
+ }), e;
1442
+ }, Xo = ({ inElement: t, inClassList: o }) => {
1443
+ if (!t || !o) return t;
1444
+ const e = typeof o == "string" ? o.split(/\s+/).filter(Boolean) : Array.isArray(o) ? o.filter((r) => typeof r == "string" && r.trim()) : [];
1445
+ return e.length && t.classList.add(...e), t;
1446
+ }, Qo = (t) => {
1447
+ if (!t || typeof t != "object" || Array.isArray(t) || !t.tagName) return null;
1448
+ const o = Go({ inTagName: t.tagName });
1449
+ if (!o) return null;
1450
+ if (Ko({
1451
+ inElement: o,
1452
+ inTextContent: Ho(t.textContent),
1453
+ inTagName: t.tagName
1454
+ }), Uo({
1455
+ inElement: o,
1456
+ inProperties: t.properties
1457
+ }), _o({
1458
+ inElement: o,
1459
+ inAttributes: t.attributes
1460
+ }), Xo({
1461
+ inElement: o,
1462
+ inClassList: t.classList
1463
+ }), Array.isArray(t.children)) {
1464
+ const e = K(t.children);
1465
+ e.length && o.append(...e);
1466
+ }
1467
+ return o;
1468
+ }, U = (t) => t == null ? null : typeof Node < "u" && t instanceof Node ? t : Array.isArray(t) ? K(t) : typeof t == "object" ? Qo(t) : typeof t == "string" || typeof t == "number" ? document.createTextNode(String(t)) : null, J = (t = {}) => {
1469
+ const o = (t == null ? void 0 : t.spec) ?? (t == null ? void 0 : t.inSpec) ?? t;
1470
+ return U(o);
1471
+ };
1472
+ Wo(J);
1473
+ const Yo = ({
1474
+ inSpec: t,
1475
+ inTargetHtmlId: o,
1476
+ inAppendPosition: e,
1477
+ inShowLog: r = !1
1478
+ } = {}) => {
1479
+ const a = t, n = o, s = e, i = r, l = J(a);
1480
+ i && console.log("renderToDom 1 (content):", l);
1481
+ const c = document.getElementById(n);
1482
+ return c ? (Array.isArray(l) || l instanceof NodeList || l instanceof HTMLCollection ? s === "prepend" ? c.prepend(...l) : c.append(...l) : s === "prepend" ? c.prepend(l) : (c.innerHTML = "", c.append(l)), i && console.log("renderToDom 2 (mounted):", c), c) : null;
1483
+ }, Zo = (t = {}) => {
1484
+ $(t), (t == null ? void 0 : t.showLog) && console.log("first : ", t == null ? void 0 : t.columns, t == null ? void 0 : t.data, t == null ? void 0 : t.appendPosition);
1485
+ const e = Oo({
1486
+ inColumns: t.columns,
1487
+ inData: t.data,
1488
+ inType: t.type,
1489
+ inShowLog: t.showLog
1490
+ });
1491
+ return Yo({
1492
+ inSpec: e,
1493
+ inTargetHtmlId: t.targetHtmlId,
1494
+ inAppendPosition: t.appendPosition,
1495
+ inShowLog: t.showLog
1496
+ });
1497
+ };
1498
+ Y(Zo);
1499
+ export {
1500
+ Zo as default,
1501
+ Zo as render
1502
+ };