json-renderers 1.17.3 → 1.18.4

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