json-renderers 1.17.7 → 1.18.5

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