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