json-renderers 1.16.1 → 1.17.7

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.
Files changed (43) hide show
  1. package/README.md +6 -1
  2. package/docs/dist/min.js +716 -1179
  3. package/docs/dist/v16/min.js +1576 -0
  4. package/docs/dist/v17/min.js +1047 -0
  5. package/package.json +2 -2
  6. package/src/index.js +2 -2
  7. package/src/v16/buildSpec/index.js +40 -40
  8. package/src/v16/common/deriveColumnsFromData.js +20 -20
  9. package/src/v16/guard.js +38 -38
  10. package/src/v16/index.js +106 -110
  11. package/src/v16/meta.js +6 -6
  12. package/src/v16/registerGlobal.js +27 -27
  13. package/src/v17/buildSpec/index.js +25 -0
  14. package/src/v17/configSpec.json +9 -0
  15. package/src/v17/getSpec.js +12 -0
  16. package/src/v17/guard.js +41 -0
  17. package/src/v17/index.js +32 -0
  18. package/src/{v11 → v17}/meta.js +1 -1
  19. package/src/v17/registerGlobal.js +28 -0
  20. package/src/v17/renderToDom/index.js +47 -0
  21. package/src/v17/validateConfig.js +37 -0
  22. package/src/v11/dataLists/fragments.json +0 -1
  23. package/src/v11/dataLists/index.js +0 -32
  24. package/src/v11/dataLists/skeleton.json +0 -38
  25. package/src/v11/index.js +0 -62
  26. package/src/v11/registerGlobal.js +0 -14
  27. package/src/v11/select/fragments.json +0 -1
  28. package/src/v11/select/index.js +0 -34
  29. package/src/v11/select/skeleton.json +0 -23
  30. package/src/v11/table/index.js +0 -35
  31. package/src/v11/table/skeleton.json +0 -47
  32. package/src/v12/common/deriveColumnsFromData.js +0 -20
  33. package/src/v12/index.js +0 -62
  34. package/src/v12/meta.js +0 -6
  35. package/src/v12/registerGlobal.js +0 -14
  36. package/src/v12/table/index.js +0 -35
  37. package/src/v12/table/skeleton.json +0 -47
  38. package/src/v13/buildSpec/index.js +0 -39
  39. package/src/v13/common/deriveColumnsFromData.js +0 -20
  40. package/src/v13/index.js +0 -81
  41. package/src/v13/meta.js +0 -6
  42. package/src/v13/registerGlobal.js +0 -14
  43. /package/src/{v11 → v17}/common/deriveColumnsFromData.js +0 -0
package/docs/dist/min.js CHANGED
@@ -1,1047 +1,597 @@
1
- const k = {
2
- version: "v15.0.0",
1
+ const q = {
2
+ version: "v17.0.0",
3
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())
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())
16
39
  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
40
  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 = []
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
207
49
  } = {}) => {
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"
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`);
281
96
  }
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"
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`);
296
101
  }
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"
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);
311
107
  }
312
- ]
313
- }
314
- }, Ae = {
315
- type: "table",
316
- data: [
317
- {
318
- itemName: "0.09/30mm",
319
- baseUnit: "kgs"
320
108
  }
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
109
  }
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);
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"
453
125
  }
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;
126
+ ], ut = [
127
+ {
128
+ Name: "Keshav",
129
+ Designation: "Founder"
517
130
  }
518
- return l;
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;
519
152
  };
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
- }
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);
535
160
  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);
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`);
566
212
  }
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;
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`);
576
219
  }
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;
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`);
589
229
  }
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
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;
595
242
  });
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);
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;
603
249
  }
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;
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}"
613
264
  }
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);
265
+ }, xt = {
266
+ tagName: "th",
267
+ textContent: "${columnName}",
268
+ attributes: {
269
+ class: "py-3 px-3 fw-semibold text-uppercase small"
627
270
  }
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;
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"
637
289
  }
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",
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}",
691
305
  attributes: {
692
- value: "${}"
693
- },
694
- textContent: "${}"
306
+ class: "btn btn-primary btn-sm"
307
+ }
695
308
  }
309
+ ]
310
+ }, Et = {
311
+ tagName: "option",
312
+ textContent: "${rowValue}",
313
+ attributes: {
314
+ value: "${rowValue}"
696
315
  }
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 = {
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 = {
722
340
  class: "table table-hover table-striped align-middle border mb-0"
723
- }, co = [
341
+ }, It = [
342
+ {
343
+ tagName: "colgroup",
344
+ attributes: {
345
+ "data-role": "table-colgroup"
346
+ },
347
+ children: []
348
+ },
724
349
  {
725
350
  tagName: "thead",
726
351
  attributes: {
727
- class: "table-dark"
352
+ class: "table-dark",
353
+ "data-role": "table-header"
728
354
  },
729
355
  children: [
730
356
  {
731
357
  tagName: "tr",
358
+ attributes: {
359
+ "data-role": "table-header-row"
360
+ },
732
361
  children: []
733
362
  }
734
363
  ]
735
364
  },
736
365
  {
737
366
  tagName: "tbody",
367
+ attributes: {
368
+ "data-role": "table-body"
369
+ },
738
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
+ ]
739
386
  }
740
- ], io = {
741
- tagName: lo,
742
- attributes: ao,
743
- children: co
744
- }, uo = {
745
- columns: {
746
- row: {
747
- tagName: "tr"
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
+ ]
748
400
  },
749
- cell: {
750
- tagName: "th",
751
- textContent: "${}"
752
- }
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"
753
427
  }
754
- }, bo = {
755
- rows: {
756
- body: {
757
- tagName: "tbody"
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
+ ]
758
437
  },
759
- row: {
760
- tagName: "tr"
438
+ sourcePath: {
439
+ fileName: "data",
440
+ filePath: [
441
+ "columns"
442
+ ]
761
443
  },
762
- cell: {
763
- tagName: "td",
764
- textContent: "${}"
765
- }
444
+ func: "twoDimensional"
766
445
  }
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)
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)));
788
459
  });
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
- }))
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);
805
470
  });
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
471
  }
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
- ]
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}"
894
509
  }
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
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
1004
552
  } = {}) => {
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
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
1029
568
  });
569
+ return l.showLog && console.log("json-renderers-build output:", p), p;
1030
570
  };
1031
- v(T);
1032
- const vo = {
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 = {
1033
583
  version: "v9",
1034
584
  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;
585
+ }, Yt = ({ inFuncDefinition: e, inReviewSpec: t } = {}) => {
586
+ if (typeof globalThis > "u" || !e) return;
1037
587
  globalThis.ks ?? (globalThis.ks = {});
1038
- const n = {
1039
- meta: vo,
1040
- buildSpecElement: t,
1041
- reviewSpec: e
588
+ const o = {
589
+ meta: Jt,
590
+ buildSpecElement: e,
591
+ reviewSpec: t
1042
592
  };
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([
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([
1045
595
  "svg",
1046
596
  "path",
1047
597
  "symbol",
@@ -1068,69 +618,69 @@ const vo = {
1068
618
  "fegaussianblur",
1069
619
  "femerge",
1070
620
  "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;
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;
1077
627
  }
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;
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;
1087
637
  return;
1088
638
  }
1089
- if (s === "xlink:href" || s === "href") {
1090
- if (l != null) {
1091
- const a = String(l);
1092
- if (r)
639
+ if (r === "xlink:href" || r === "href") {
640
+ if (s != null) {
641
+ const c = String(s);
642
+ if (a)
1093
643
  try {
1094
- n.setAttributeNS(Ho, "href", a);
644
+ o.setAttributeNS(oe, "href", c);
1095
645
  } catch {
1096
646
  }
1097
- n.setAttribute("href", a), n.setAttribute("xlink:href", a);
647
+ o.setAttribute("href", c), o.setAttribute("xlink:href", c);
1098
648
  }
1099
649
  return;
1100
650
  }
1101
- if (typeof l == "boolean") {
1102
- l ? n.setAttribute(s, "") : n.removeAttribute(s);
651
+ if (typeof s == "boolean") {
652
+ s ? o.setAttribute(r, "") : o.removeAttribute(r);
1103
653
  return;
1104
654
  }
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);
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);
1131
681
  }
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 = {
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 = {
1134
684
  allowsTextContent: !1,
1135
685
  allowsChildren: !0,
1136
686
  allowedAttributes: [
@@ -1138,7 +688,7 @@ const vo = {
1138
688
  "role"
1139
689
  ],
1140
690
  childTags: []
1141
- }, zo = {
691
+ }, ce = {
1142
692
  allowsTextContent: !1,
1143
693
  allowsChildren: !1,
1144
694
  allowedAttributes: [
@@ -1151,7 +701,7 @@ const vo = {
1151
701
  "required",
1152
702
  "list"
1153
703
  ]
1154
- }, Po = {
704
+ }, ie = {
1155
705
  allowsTextContent: !1,
1156
706
  allowsChildren: !1,
1157
707
  allowedAttributes: [
@@ -1162,7 +712,7 @@ const vo = {
1162
712
  "disabled",
1163
713
  "required"
1164
714
  ]
1165
- }, _o = {
715
+ }, ue = {
1166
716
  allowsTextContent: !1,
1167
717
  allowsChildren: !0,
1168
718
  allowedAttributes: [
@@ -1171,7 +721,7 @@ const vo = {
1171
721
  childTags: [
1172
722
  "col"
1173
723
  ]
1174
- }, Xo = {
724
+ }, de = {
1175
725
  allowsTextContent: !1,
1176
726
  allowsChildren: !1,
1177
727
  allowedAttributes: [
@@ -1179,14 +729,14 @@ const vo = {
1179
729
  "style",
1180
730
  "width"
1181
731
  ]
1182
- }, Qo = {
732
+ }, pe = {
1183
733
  allowsTextContent: !0,
1184
734
  allowsChildren: !0,
1185
735
  allowedAttributes: [
1186
736
  "for"
1187
737
  ],
1188
738
  childTags: []
1189
- }, Yo = {
739
+ }, fe = {
1190
740
  allowsTextContent: !1,
1191
741
  allowsChildren: !0,
1192
742
  allowedAttributes: [
@@ -1199,7 +749,7 @@ const vo = {
1199
749
  "target"
1200
750
  ],
1201
751
  childTags: []
1202
- }, Zo = {
752
+ }, be = {
1203
753
  allowsTextContent: !1,
1204
754
  allowsChildren: !0,
1205
755
  allowedAttributes: [
@@ -1212,27 +762,27 @@ const vo = {
1212
762
  childTags: [
1213
763
  "option"
1214
764
  ]
1215
- }, tn = {
765
+ }, he = {
1216
766
  allowsTextContent: !0,
1217
767
  allowsChildren: !0,
1218
768
  allowedAttributes: [],
1219
769
  childTags: []
1220
- }, en = {
770
+ }, me = {
1221
771
  allowsTextContent: !0,
1222
772
  allowsChildren: !0,
1223
773
  allowedAttributes: [],
1224
774
  childTags: []
1225
- }, on = {
775
+ }, ge = {
1226
776
  allowsTextContent: !0,
1227
777
  allowsChildren: !0,
1228
778
  allowedAttributes: [],
1229
779
  childTags: []
1230
- }, nn = {
780
+ }, we = {
1231
781
  allowsTextContent: !0,
1232
782
  allowsChildren: !0,
1233
783
  allowedAttributes: [],
1234
784
  childTags: []
1235
- }, rn = {
785
+ }, ye = {
1236
786
  allowsTextContent: !1,
1237
787
  allowsChildren: !1,
1238
788
  allowedAttributes: [
@@ -1242,7 +792,7 @@ const vo = {
1242
792
  "height",
1243
793
  "loading"
1244
794
  ]
1245
- }, sn = {
795
+ }, Te = {
1246
796
  allowsTextContent: !0,
1247
797
  allowsChildren: !0,
1248
798
  allowedAttributes: [
@@ -1252,7 +802,7 @@ const vo = {
1252
802
  "value"
1253
803
  ],
1254
804
  childTags: []
1255
- }, ln = {
805
+ }, Ce = {
1256
806
  allowsTextContent: !1,
1257
807
  allowsChildren: !0,
1258
808
  allowedAttributes: [
@@ -1268,28 +818,28 @@ const vo = {
1268
818
  "tfoot",
1269
819
  "tr"
1270
820
  ]
1271
- }, an = {
821
+ }, Ae = {
1272
822
  allowsTextContent: !1,
1273
823
  allowsChildren: !0,
1274
824
  allowedAttributes: [],
1275
825
  childTags: [
1276
826
  "tr"
1277
827
  ]
1278
- }, cn = {
828
+ }, Ne = {
1279
829
  allowsTextContent: !1,
1280
830
  allowsChildren: !0,
1281
831
  allowedAttributes: [],
1282
832
  childTags: [
1283
833
  "tr"
1284
834
  ]
1285
- }, un = {
835
+ }, $e = {
1286
836
  allowsTextContent: !1,
1287
837
  allowsChildren: !0,
1288
838
  allowedAttributes: [],
1289
839
  childTags: [
1290
840
  "tr"
1291
841
  ]
1292
- }, dn = {
842
+ }, xe = {
1293
843
  allowsTextContent: !1,
1294
844
  allowsChildren: !0,
1295
845
  allowedAttributes: [],
@@ -1297,7 +847,7 @@ const vo = {
1297
847
  "td",
1298
848
  "th"
1299
849
  ]
1300
- }, bn = {
850
+ }, Se = {
1301
851
  allowsTextContent: !0,
1302
852
  allowsChildren: !0,
1303
853
  allowedAttributes: [
@@ -1306,7 +856,7 @@ const vo = {
1306
856
  "rowspan"
1307
857
  ],
1308
858
  childTags: []
1309
- }, mn = {
859
+ }, je = {
1310
860
  allowsTextContent: !0,
1311
861
  allowsChildren: !0,
1312
862
  allowedAttributes: [
@@ -1314,14 +864,14 @@ const vo = {
1314
864
  "rowspan"
1315
865
  ],
1316
866
  childTags: []
1317
- }, hn = {
867
+ }, Le = {
1318
868
  allowsTextContent: !1,
1319
869
  allowsChildren: !0,
1320
870
  allowedAttributes: [],
1321
871
  childTags: [
1322
872
  "option"
1323
873
  ]
1324
- }, pn = {
874
+ }, De = {
1325
875
  allowsTextContent: !0,
1326
876
  allowsChildren: !1,
1327
877
  allowedAttributes: [
@@ -1330,14 +880,14 @@ const vo = {
1330
880
  "selected",
1331
881
  "disabled"
1332
882
  ]
1333
- }, fn = {
883
+ }, Ee = {
1334
884
  allowsTextContent: !1,
1335
885
  allowsChildren: !0,
1336
886
  allowedAttributes: [
1337
887
  "role"
1338
888
  ],
1339
889
  childTags: []
1340
- }, gn = {
890
+ }, Oe = {
1341
891
  allowsTextContent: !0,
1342
892
  allowsChildren: !0,
1343
893
  allowedAttributes: [
@@ -1348,19 +898,19 @@ const vo = {
1348
898
  "download"
1349
899
  ],
1350
900
  childTags: []
1351
- }, yn = {
901
+ }, Pe = {
1352
902
  allowsTextContent: !0,
1353
903
  allowsChildren: !0,
1354
904
  allowedAttributes: [
1355
905
  "aria-hidden"
1356
906
  ],
1357
907
  childTags: []
1358
- }, wn = {
908
+ }, Fe = {
1359
909
  allowsTextContent: !0,
1360
910
  allowsChildren: !0,
1361
911
  allowedAttributes: [],
1362
912
  childTags: []
1363
- }, Cn = {
913
+ }, ke = {
1364
914
  allowsTextContent: !1,
1365
915
  allowsChildren: !0,
1366
916
  allowedAttributes: [
@@ -1369,142 +919,129 @@ const vo = {
1369
919
  childTags: [
1370
920
  "li"
1371
921
  ]
1372
- }, $n = {
922
+ }, Ie = {
1373
923
  allowsTextContent: !0,
1374
924
  allowsChildren: !0,
1375
925
  allowedAttributes: [
1376
926
  "value"
1377
927
  ],
1378
928
  childTags: []
1379
- }, Nn = {
929
+ }, Re = {
1380
930
  allowsTextContent: !1,
1381
931
  allowsChildren: !1,
1382
932
  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);
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);
1432
982
  });
1433
- const i = n.length, u = a.length === 0;
983
+ const i = o.length, u = c.length === 0;
1434
984
  return {
1435
985
  totalTags: i,
1436
- tagCounts: s,
1437
- uniqueTags: Object.keys(s),
1438
- recognizedTags: l,
1439
- unrecognizedTags: a,
986
+ tagCounts: r,
987
+ uniqueTags: Object.keys(r),
988
+ recognizedTags: s,
989
+ unrecognizedTags: c,
1440
990
  areAllTagsPresent: u
1441
991
  };
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
992
+ }, Ve = ({ inSpec: e, inTags: t = ve } = {}) => {
993
+ const o = e, n = t, a = $({ inSpec: o }), r = He({
994
+ inTagsFound: a,
995
+ inAllowedTags: n
1446
996
  });
1447
997
  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
998
+ areAllTagsPresent: r.areAllTagsPresent,
999
+ totalTags: r.totalTags,
1000
+ tagCounts: r.tagCounts,
1001
+ uniqueTags: r.uniqueTags,
1002
+ recognizedTags: r.recognizedTags,
1003
+ unrecognizedTags: r.unrecognizedTags
1454
1004
  };
1455
- }, E = (t = {}) => {
1456
- const e = (t == null ? void 0 : t.spec) ?? (t == null ? void 0 : t.inSpec) ?? t;
1457
- return x(e);
1005
+ }, G = (e = {}) => {
1006
+ const t = (e == null ? void 0 : e.spec) ?? (e == null ? void 0 : e.inSpec) ?? e;
1007
+ return M(t);
1458
1008
  };
1459
- Oo({
1460
- inFuncDefinition: E,
1461
- inReviewSpec: Sn
1009
+ Yt({
1010
+ inFuncDefinition: G,
1011
+ inReviewSpec: Ve
1462
1012
  });
1463
- const xn = ({
1013
+ const K = ({
1014
+ inSpec: e,
1464
1015
  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
1016
+ inAppendPosition: o,
1017
+ inShowLog: n = !1
1487
1018
  } = {}) => {
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
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
1495
1031
  });
1496
- const h = xn({
1497
- inTargetHtmlId: i,
1498
- inColumns: c,
1499
- showLog: l,
1500
- inData: u,
1501
- type: a
1032
+ return K({
1033
+ inSpec: n,
1034
+ inTargetHtmlId: t.targetHtmlId,
1035
+ inAppendPosition: t.appendPosition,
1036
+ inShowLog: t.showLog
1502
1037
  });
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
1038
  };
1507
- B(En);
1039
+ _({ render: Be, getSpec: P, validateConfig: O, buildSpec: V, renderToDom: K });
1508
1040
  export {
1509
- En as default
1041
+ V as buildSpec,
1042
+ Be as default,
1043
+ P as getSpec,
1044
+ Be as render,
1045
+ K as renderToDom,
1046
+ O as validateConfig
1510
1047
  };