json-renderers 1.14.1 → 1.16.1

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