json-renderers 1.13.3 → 1.13.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/dist/v12/min.js +646 -646
- package/docs/dist/v13/min.js +227 -203
- package/package.json +3 -3
- package/src/v13/buildSpec/index.js +15 -5
- package/src/v13/index.js +23 -6
- package/src/v13/meta.js +1 -1
package/docs/dist/v13/min.js
CHANGED
|
@@ -1,125 +1,121 @@
|
|
|
1
|
-
const
|
|
2
|
-
version: "
|
|
1
|
+
const x = {
|
|
2
|
+
version: "v13.1.0",
|
|
3
3
|
description: "build table from store data and render to DOM uses json-to-spec, json-to-dom under the hood"
|
|
4
|
-
},
|
|
4
|
+
}, j = (t) => {
|
|
5
5
|
var e;
|
|
6
6
|
typeof globalThis > "u" || !t || (globalThis.ks ?? (globalThis.ks = {}), (e = globalThis.ks).jsonRenderers ?? (e.jsonRenderers = {
|
|
7
|
-
meta:
|
|
7
|
+
meta: x,
|
|
8
8
|
renderToDom: t
|
|
9
9
|
}));
|
|
10
10
|
}, v = {
|
|
11
11
|
version: "v3.0.0",
|
|
12
12
|
description: "build table from store data and render to DOM uses json-to-spec, json-to-dom under the hood"
|
|
13
|
-
},
|
|
13
|
+
}, N = (t) => {
|
|
14
14
|
var e;
|
|
15
15
|
typeof globalThis > "u" || !t || (globalThis.ks ?? (globalThis.ks = {}), (e = globalThis.ks).jsonRenderersBuild ?? (e.jsonRenderersBuild = {
|
|
16
16
|
meta: v,
|
|
17
17
|
renderToDom: t
|
|
18
18
|
}));
|
|
19
|
-
},
|
|
19
|
+
}, $ = {
|
|
20
20
|
version: "v32",
|
|
21
21
|
description: "JSON-to-DOM engine with centralized traversal and responsibility-focused construction"
|
|
22
|
-
},
|
|
22
|
+
}, k = ({ inFuncDefinition: t } = {}) => {
|
|
23
23
|
if (typeof globalThis > "u" || !t) return;
|
|
24
24
|
globalThis.ks ?? (globalThis.ks = {});
|
|
25
25
|
const e = {
|
|
26
|
-
meta:
|
|
26
|
+
meta: $,
|
|
27
27
|
buildSpecElement: t
|
|
28
28
|
};
|
|
29
29
|
globalThis.ks.jsonToSpec = e;
|
|
30
|
-
},
|
|
30
|
+
}, D = (t, e) => g(t, e), m = (t, e) => Array.isArray(t) ? t.map((l) => D(l, e)).flat(1 / 0).filter(Boolean) : [], O = (t, e) => {
|
|
31
31
|
if ("source" in t && (t == null ? void 0 : t.source) in e) {
|
|
32
32
|
const l = e[t == null ? void 0 : t.source];
|
|
33
33
|
if (Array.isArray(l))
|
|
34
34
|
return l.map((n) => {
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
37
|
-
return
|
|
35
|
+
const r = t == null ? void 0 : t.template;
|
|
36
|
+
if (r)
|
|
37
|
+
return g(r, n);
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
}, E = (t, e) => {
|
|
41
41
|
let l = [];
|
|
42
|
-
for (const [
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
const a =
|
|
46
|
-
key:
|
|
42
|
+
for (const [o, n] of Object.entries(e)) {
|
|
43
|
+
const r = t == null ? void 0 : t.template;
|
|
44
|
+
if (r) {
|
|
45
|
+
const a = g(r, {
|
|
46
|
+
key: o,
|
|
47
47
|
value: n
|
|
48
48
|
});
|
|
49
49
|
l.push(a);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
return l;
|
|
53
|
-
},
|
|
53
|
+
}, S = (t, e) => {
|
|
54
54
|
if ("source" in t && (t == null ? void 0 : t.source) in e) {
|
|
55
55
|
const l = e[t == null ? void 0 : t.source];
|
|
56
56
|
if (Array.isArray(l))
|
|
57
57
|
return l.map((n) => {
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
60
|
-
return
|
|
58
|
+
const r = t == null ? void 0 : t.template;
|
|
59
|
+
if (r)
|
|
60
|
+
return g(r, n);
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
},
|
|
63
|
+
}, L = (t, e) => {
|
|
64
64
|
if ("operation" in t) {
|
|
65
65
|
if (t.operation === "loopArray")
|
|
66
|
-
return
|
|
66
|
+
return O(t, e);
|
|
67
67
|
if (t.operation === "loopObject")
|
|
68
68
|
return E(t, e);
|
|
69
69
|
if (t.operation === "loopCollection")
|
|
70
|
-
return
|
|
70
|
+
return S(t, e);
|
|
71
71
|
}
|
|
72
|
-
},
|
|
72
|
+
}, p = (t, e) => {
|
|
73
73
|
if (typeof e == "string") return e;
|
|
74
74
|
if (typeof t != "string") return t;
|
|
75
75
|
if (t === "${value}")
|
|
76
76
|
return e.value;
|
|
77
77
|
const l = t.match(/^\$\{(.+?)\}$/);
|
|
78
78
|
if (l) {
|
|
79
|
-
const
|
|
80
|
-
return (e == null ? void 0 : e[
|
|
79
|
+
const o = l[1];
|
|
80
|
+
return (e == null ? void 0 : e[o]) ?? "";
|
|
81
81
|
}
|
|
82
82
|
return t;
|
|
83
|
-
},
|
|
83
|
+
}, F = (t, e) => {
|
|
84
84
|
let l = {};
|
|
85
|
-
for (const [
|
|
86
|
-
const
|
|
87
|
-
l[
|
|
85
|
+
for (const [o, n] of Object.entries(t)) {
|
|
86
|
+
const r = p(n, e);
|
|
87
|
+
l[o] = r;
|
|
88
88
|
}
|
|
89
89
|
return l;
|
|
90
|
-
},
|
|
90
|
+
}, G = (t, e) => {
|
|
91
91
|
if ("tagName" in t) {
|
|
92
92
|
if ("textContent" in t) {
|
|
93
|
-
const l =
|
|
93
|
+
const l = p(t.textContent, e);
|
|
94
94
|
t.textContent = l;
|
|
95
95
|
}
|
|
96
96
|
if ("attributes" in t) {
|
|
97
|
-
const l =
|
|
97
|
+
const l = F(t.attributes, e);
|
|
98
98
|
t.attributes = l;
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
},
|
|
101
|
+
}, M = (t, e) => {
|
|
102
102
|
if (!t || typeof t != "object" || Array.isArray(t)) return null;
|
|
103
103
|
const l = structuredClone(t);
|
|
104
104
|
if (!l) return null;
|
|
105
|
-
if ("tagName" in l &&
|
|
106
|
-
const
|
|
105
|
+
if ("tagName" in l && G(l, e), "jsonToSpec" in l) {
|
|
106
|
+
const o = l == null ? void 0 : l.jsonToSpec, n = L(o, e);
|
|
107
107
|
Array.isArray(n) ? l.children = n : l.children = [n], delete l.jsonToSpec;
|
|
108
108
|
}
|
|
109
109
|
if (Array.isArray(l == null ? void 0 : l.children)) {
|
|
110
|
-
const
|
|
111
|
-
l.children =
|
|
110
|
+
const o = m(l == null ? void 0 : l.children, e);
|
|
111
|
+
l.children = o;
|
|
112
112
|
}
|
|
113
113
|
return l;
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return typeof Node < "u" && t instanceof Node ? t : Array.isArray(t) ? w(t, e) : typeof t == "object" ? z(t, e) : typeof t == "string" || typeof t == "number" ? document.createTextNode(String(t)) : t;
|
|
118
|
-
}, g = (t, e) => c(t, e);
|
|
119
|
-
$({
|
|
120
|
-
inFuncDefinition: g
|
|
114
|
+
}, g = (t, e) => t == null ? null : typeof Node < "u" && t instanceof Node ? t : Array.isArray(t) ? m(t, e) : typeof t == "object" ? M(t, e) : typeof t == "string" || typeof t == "number" ? document.createTextNode(String(t)) : t, h = (t, e) => g(t, e);
|
|
115
|
+
k({
|
|
116
|
+
inFuncDefinition: h
|
|
121
117
|
});
|
|
122
|
-
const
|
|
118
|
+
const R = {
|
|
123
119
|
default: {
|
|
124
120
|
tagName: "table",
|
|
125
121
|
attributes: {
|
|
@@ -165,18 +161,18 @@ const M = {
|
|
|
165
161
|
}
|
|
166
162
|
]
|
|
167
163
|
}
|
|
168
|
-
},
|
|
164
|
+
}, z = ({
|
|
169
165
|
inColumns: t,
|
|
170
166
|
inData: e
|
|
171
167
|
} = {}) => {
|
|
172
|
-
const l = e ?? [],
|
|
173
|
-
return
|
|
174
|
-
columns:
|
|
168
|
+
const l = e ?? [], o = t;
|
|
169
|
+
return h(R.default, {
|
|
170
|
+
columns: o,
|
|
175
171
|
data: l
|
|
176
172
|
});
|
|
177
|
-
}, I = "select",
|
|
173
|
+
}, I = "select", V = {
|
|
178
174
|
id: "LedgerName"
|
|
179
|
-
},
|
|
175
|
+
}, q = {
|
|
180
176
|
operation: "loopArray",
|
|
181
177
|
source: "arrayOfStrings",
|
|
182
178
|
template: {
|
|
@@ -186,45 +182,63 @@ const M = {
|
|
|
186
182
|
},
|
|
187
183
|
textContent: "${}"
|
|
188
184
|
}
|
|
189
|
-
},
|
|
185
|
+
}, B = [], P = {
|
|
190
186
|
tagName: I,
|
|
191
|
-
attributes:
|
|
192
|
-
jsonToSpec:
|
|
193
|
-
children:
|
|
194
|
-
},
|
|
187
|
+
attributes: V,
|
|
188
|
+
jsonToSpec: q,
|
|
189
|
+
children: B
|
|
190
|
+
}, H = ({
|
|
191
|
+
inData: t
|
|
192
|
+
} = {}) => h(P, {
|
|
193
|
+
arrayOfStrings: t ?? []
|
|
194
|
+
}), _ = {
|
|
195
|
+
operation: "loopArray",
|
|
196
|
+
source: "arrayOfStrings",
|
|
197
|
+
template: {
|
|
198
|
+
tagName: "option",
|
|
199
|
+
attributes: {
|
|
200
|
+
value: "${}"
|
|
201
|
+
},
|
|
202
|
+
textContent: "${}"
|
|
203
|
+
}
|
|
204
|
+
}, U = [], K = {
|
|
205
|
+
jsonToSpec: _,
|
|
206
|
+
children: U
|
|
207
|
+
}, X = ({
|
|
195
208
|
inData: t
|
|
196
|
-
} = {}) =>
|
|
209
|
+
} = {}) => h(K, {
|
|
197
210
|
arrayOfStrings: t ?? []
|
|
198
|
-
}),
|
|
199
|
-
table:
|
|
200
|
-
select:
|
|
201
|
-
|
|
211
|
+
}), w = {
|
|
212
|
+
table: z,
|
|
213
|
+
select: H,
|
|
214
|
+
selectOptionsOnly: X
|
|
215
|
+
}, y = ({
|
|
202
216
|
type: t = "table",
|
|
203
217
|
data: e,
|
|
204
218
|
columns: l
|
|
205
219
|
} = {}) => {
|
|
206
|
-
const
|
|
207
|
-
return
|
|
220
|
+
const o = t, n = w[o];
|
|
221
|
+
return n ? n({
|
|
208
222
|
inColumns: l,
|
|
209
223
|
inData: e
|
|
210
224
|
}) : (console.error(
|
|
211
|
-
`[Renderer] Unknown renderer type "${
|
|
225
|
+
`[Renderer] Unknown renderer type "${o}". Available types: ${Object.keys(w).join(", ")}`
|
|
212
226
|
), null);
|
|
213
227
|
};
|
|
214
|
-
|
|
215
|
-
const
|
|
228
|
+
N(y);
|
|
229
|
+
const Q = {
|
|
216
230
|
version: "v9",
|
|
217
231
|
description: "JSON-to-DOM engine with SVG namespace support, mixed text content, and centralized traversal"
|
|
218
|
-
},
|
|
232
|
+
}, W = ({ inFuncDefinition: t, inReviewSpec: e } = {}) => {
|
|
219
233
|
if (typeof globalThis > "u" || !t) return;
|
|
220
234
|
globalThis.ks ?? (globalThis.ks = {});
|
|
221
235
|
const l = {
|
|
222
|
-
meta:
|
|
236
|
+
meta: Q,
|
|
223
237
|
buildSpecElement: t,
|
|
224
238
|
reviewSpec: e
|
|
225
239
|
};
|
|
226
240
|
globalThis.ks["json-to-tag"] = l, globalThis.ks.jsonToTag = l;
|
|
227
|
-
},
|
|
241
|
+
}, Y = (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 ?? "") : C(t), T = (t) => Array.isArray(t) ? t.map(Y).flat(1 / 0).filter(Boolean) : [], Z = (t) => (t == null, t), J = "http://www.w3.org/2000/svg", tt = /* @__PURE__ */ new Set([
|
|
228
242
|
"svg",
|
|
229
243
|
"path",
|
|
230
244
|
"symbol",
|
|
@@ -251,30 +265,30 @@ const H = {
|
|
|
251
265
|
"fegaussianblur",
|
|
252
266
|
"femerge",
|
|
253
267
|
"femergenode"
|
|
254
|
-
]),
|
|
268
|
+
]), et = ({ inTagName: t }) => {
|
|
255
269
|
const e = t == null ? void 0 : t.toLowerCase();
|
|
256
270
|
if (!e) return null;
|
|
257
271
|
if (e === "checkbox") {
|
|
258
272
|
const l = document.createElement("input");
|
|
259
273
|
return l.type = "checkbox", l;
|
|
260
274
|
}
|
|
261
|
-
return
|
|
262
|
-
},
|
|
263
|
-
const l = t,
|
|
264
|
-
if (!l || !
|
|
275
|
+
return tt.has(e) ? document.createElementNS(J, e) : document.createElement(e);
|
|
276
|
+
}, lt = ({ inElement: t, inTextContent: e }) => (!t || e === void 0 || e === null || (t.textContent = e), t), ot = ({ inElement: t, inProperties: e }) => (t && e && typeof e == "object" && Object.assign(t, e), t), rt = "http://www.w3.org/1999/xlink", nt = ({ inElement: t, inAttributes: e }) => {
|
|
277
|
+
const l = t, o = e;
|
|
278
|
+
if (!l || !o || typeof o != "object")
|
|
265
279
|
return l;
|
|
266
280
|
const n = typeof SVGElement < "u" ? l instanceof SVGElement : l.namespaceURI === "http://www.w3.org/2000/svg";
|
|
267
|
-
return Object.entries(
|
|
268
|
-
if (
|
|
281
|
+
return Object.entries(o).forEach(([r, a]) => {
|
|
282
|
+
if (r === "class") {
|
|
269
283
|
n ? l.setAttribute("class", String(a)) : l.className = a;
|
|
270
284
|
return;
|
|
271
285
|
}
|
|
272
|
-
if (
|
|
286
|
+
if (r === "xlink:href" || r === "href") {
|
|
273
287
|
if (a != null) {
|
|
274
288
|
const i = String(a);
|
|
275
289
|
if (n)
|
|
276
290
|
try {
|
|
277
|
-
l.setAttributeNS(
|
|
291
|
+
l.setAttributeNS(rt, "href", i);
|
|
278
292
|
} catch {
|
|
279
293
|
}
|
|
280
294
|
l.setAttribute("href", i), l.setAttribute("xlink:href", i);
|
|
@@ -282,38 +296,38 @@ const H = {
|
|
|
282
296
|
return;
|
|
283
297
|
}
|
|
284
298
|
if (typeof a == "boolean") {
|
|
285
|
-
a ? l.setAttribute(
|
|
299
|
+
a ? l.setAttribute(r, "") : l.removeAttribute(r);
|
|
286
300
|
return;
|
|
287
301
|
}
|
|
288
|
-
a != null && l.setAttribute(
|
|
302
|
+
a != null && l.setAttribute(r, String(a));
|
|
289
303
|
}), l;
|
|
290
|
-
},
|
|
304
|
+
}, at = ({ inElement: t, inClassList: e }) => {
|
|
291
305
|
if (!t || !e) return t;
|
|
292
|
-
const l = typeof e == "string" ? e.split(/\s+/).filter(Boolean) : Array.isArray(e) ? e.filter((
|
|
306
|
+
const l = typeof e == "string" ? e.split(/\s+/).filter(Boolean) : Array.isArray(e) ? e.filter((o) => typeof o == "string" && o.trim()) : [];
|
|
293
307
|
return l.length && t.classList.add(...l), t;
|
|
294
|
-
},
|
|
308
|
+
}, st = (t) => {
|
|
295
309
|
if (!t || typeof t != "object" || Array.isArray(t) || !t.tagName) return null;
|
|
296
|
-
const e =
|
|
310
|
+
const e = et({ inTagName: t.tagName });
|
|
297
311
|
if (!e) return null;
|
|
298
|
-
if (
|
|
312
|
+
if (lt({
|
|
299
313
|
inElement: e,
|
|
300
|
-
inTextContent:
|
|
314
|
+
inTextContent: Z(t.textContent),
|
|
301
315
|
inTagName: t.tagName
|
|
302
|
-
}),
|
|
316
|
+
}), ot({
|
|
303
317
|
inElement: e,
|
|
304
318
|
inProperties: t.properties
|
|
305
|
-
}),
|
|
319
|
+
}), nt({
|
|
306
320
|
inElement: e,
|
|
307
321
|
inAttributes: t.attributes
|
|
308
|
-
}),
|
|
322
|
+
}), at({
|
|
309
323
|
inElement: e,
|
|
310
324
|
inClassList: t.classList
|
|
311
325
|
}), Array.isArray(t.children)) {
|
|
312
|
-
const l =
|
|
326
|
+
const l = T(t.children);
|
|
313
327
|
l.length && e.append(...l);
|
|
314
328
|
}
|
|
315
329
|
return e;
|
|
316
|
-
},
|
|
330
|
+
}, C = (t) => t == null ? null : typeof Node < "u" && t instanceof Node ? t : Array.isArray(t) ? T(t) : typeof t == "object" ? st(t) : typeof t == "string" || typeof t == "number" ? document.createTextNode(String(t)) : null, it = "./tags.schema.json", ct = {
|
|
317
331
|
allowsTextContent: !1,
|
|
318
332
|
allowsChildren: !0,
|
|
319
333
|
allowedAttributes: [
|
|
@@ -321,7 +335,7 @@ const H = {
|
|
|
321
335
|
"role"
|
|
322
336
|
],
|
|
323
337
|
childTags: []
|
|
324
|
-
},
|
|
338
|
+
}, ut = {
|
|
325
339
|
allowsTextContent: !1,
|
|
326
340
|
allowsChildren: !1,
|
|
327
341
|
allowedAttributes: [
|
|
@@ -334,7 +348,7 @@ const H = {
|
|
|
334
348
|
"required",
|
|
335
349
|
"list"
|
|
336
350
|
]
|
|
337
|
-
},
|
|
351
|
+
}, dt = {
|
|
338
352
|
allowsTextContent: !1,
|
|
339
353
|
allowsChildren: !1,
|
|
340
354
|
allowedAttributes: [
|
|
@@ -345,7 +359,7 @@ const H = {
|
|
|
345
359
|
"disabled",
|
|
346
360
|
"required"
|
|
347
361
|
]
|
|
348
|
-
},
|
|
362
|
+
}, ft = {
|
|
349
363
|
allowsTextContent: !1,
|
|
350
364
|
allowsChildren: !0,
|
|
351
365
|
allowedAttributes: [
|
|
@@ -354,7 +368,7 @@ const H = {
|
|
|
354
368
|
childTags: [
|
|
355
369
|
"col"
|
|
356
370
|
]
|
|
357
|
-
},
|
|
371
|
+
}, gt = {
|
|
358
372
|
allowsTextContent: !1,
|
|
359
373
|
allowsChildren: !1,
|
|
360
374
|
allowedAttributes: [
|
|
@@ -362,14 +376,14 @@ const H = {
|
|
|
362
376
|
"style",
|
|
363
377
|
"width"
|
|
364
378
|
]
|
|
365
|
-
},
|
|
379
|
+
}, ht = {
|
|
366
380
|
allowsTextContent: !0,
|
|
367
381
|
allowsChildren: !0,
|
|
368
382
|
allowedAttributes: [
|
|
369
383
|
"for"
|
|
370
384
|
],
|
|
371
385
|
childTags: []
|
|
372
|
-
},
|
|
386
|
+
}, bt = {
|
|
373
387
|
allowsTextContent: !1,
|
|
374
388
|
allowsChildren: !0,
|
|
375
389
|
allowedAttributes: [
|
|
@@ -382,7 +396,7 @@ const H = {
|
|
|
382
396
|
"target"
|
|
383
397
|
],
|
|
384
398
|
childTags: []
|
|
385
|
-
},
|
|
399
|
+
}, wt = {
|
|
386
400
|
allowsTextContent: !1,
|
|
387
401
|
allowsChildren: !0,
|
|
388
402
|
allowedAttributes: [
|
|
@@ -395,27 +409,27 @@ const H = {
|
|
|
395
409
|
childTags: [
|
|
396
410
|
"option"
|
|
397
411
|
]
|
|
398
|
-
},
|
|
412
|
+
}, mt = {
|
|
399
413
|
allowsTextContent: !0,
|
|
400
414
|
allowsChildren: !0,
|
|
401
415
|
allowedAttributes: [],
|
|
402
416
|
childTags: []
|
|
403
|
-
},
|
|
417
|
+
}, pt = {
|
|
404
418
|
allowsTextContent: !0,
|
|
405
419
|
allowsChildren: !0,
|
|
406
420
|
allowedAttributes: [],
|
|
407
421
|
childTags: []
|
|
408
|
-
},
|
|
422
|
+
}, yt = {
|
|
409
423
|
allowsTextContent: !0,
|
|
410
424
|
allowsChildren: !0,
|
|
411
425
|
allowedAttributes: [],
|
|
412
426
|
childTags: []
|
|
413
|
-
},
|
|
427
|
+
}, Tt = {
|
|
414
428
|
allowsTextContent: !0,
|
|
415
429
|
allowsChildren: !0,
|
|
416
430
|
allowedAttributes: [],
|
|
417
431
|
childTags: []
|
|
418
|
-
},
|
|
432
|
+
}, Ct = {
|
|
419
433
|
allowsTextContent: !1,
|
|
420
434
|
allowsChildren: !1,
|
|
421
435
|
allowedAttributes: [
|
|
@@ -425,7 +439,7 @@ const H = {
|
|
|
425
439
|
"height",
|
|
426
440
|
"loading"
|
|
427
441
|
]
|
|
428
|
-
},
|
|
442
|
+
}, At = {
|
|
429
443
|
allowsTextContent: !0,
|
|
430
444
|
allowsChildren: !0,
|
|
431
445
|
allowedAttributes: [
|
|
@@ -435,7 +449,7 @@ const H = {
|
|
|
435
449
|
"value"
|
|
436
450
|
],
|
|
437
451
|
childTags: []
|
|
438
|
-
},
|
|
452
|
+
}, xt = {
|
|
439
453
|
allowsTextContent: !1,
|
|
440
454
|
allowsChildren: !0,
|
|
441
455
|
allowedAttributes: [
|
|
@@ -451,28 +465,28 @@ const H = {
|
|
|
451
465
|
"tfoot",
|
|
452
466
|
"tr"
|
|
453
467
|
]
|
|
454
|
-
},
|
|
468
|
+
}, jt = {
|
|
455
469
|
allowsTextContent: !1,
|
|
456
470
|
allowsChildren: !0,
|
|
457
471
|
allowedAttributes: [],
|
|
458
472
|
childTags: [
|
|
459
473
|
"tr"
|
|
460
474
|
]
|
|
461
|
-
},
|
|
475
|
+
}, vt = {
|
|
462
476
|
allowsTextContent: !1,
|
|
463
477
|
allowsChildren: !0,
|
|
464
478
|
allowedAttributes: [],
|
|
465
479
|
childTags: [
|
|
466
480
|
"tr"
|
|
467
481
|
]
|
|
468
|
-
},
|
|
482
|
+
}, Nt = {
|
|
469
483
|
allowsTextContent: !1,
|
|
470
484
|
allowsChildren: !0,
|
|
471
485
|
allowedAttributes: [],
|
|
472
486
|
childTags: [
|
|
473
487
|
"tr"
|
|
474
488
|
]
|
|
475
|
-
},
|
|
489
|
+
}, $t = {
|
|
476
490
|
allowsTextContent: !1,
|
|
477
491
|
allowsChildren: !0,
|
|
478
492
|
allowedAttributes: [],
|
|
@@ -480,7 +494,7 @@ const H = {
|
|
|
480
494
|
"td",
|
|
481
495
|
"th"
|
|
482
496
|
]
|
|
483
|
-
},
|
|
497
|
+
}, kt = {
|
|
484
498
|
allowsTextContent: !0,
|
|
485
499
|
allowsChildren: !0,
|
|
486
500
|
allowedAttributes: [
|
|
@@ -489,7 +503,7 @@ const H = {
|
|
|
489
503
|
"rowspan"
|
|
490
504
|
],
|
|
491
505
|
childTags: []
|
|
492
|
-
},
|
|
506
|
+
}, Dt = {
|
|
493
507
|
allowsTextContent: !0,
|
|
494
508
|
allowsChildren: !0,
|
|
495
509
|
allowedAttributes: [
|
|
@@ -497,14 +511,14 @@ const H = {
|
|
|
497
511
|
"rowspan"
|
|
498
512
|
],
|
|
499
513
|
childTags: []
|
|
500
|
-
},
|
|
514
|
+
}, Ot = {
|
|
501
515
|
allowsTextContent: !1,
|
|
502
516
|
allowsChildren: !0,
|
|
503
517
|
allowedAttributes: [],
|
|
504
518
|
childTags: [
|
|
505
519
|
"option"
|
|
506
520
|
]
|
|
507
|
-
},
|
|
521
|
+
}, Et = {
|
|
508
522
|
allowsTextContent: !0,
|
|
509
523
|
allowsChildren: !1,
|
|
510
524
|
allowedAttributes: [
|
|
@@ -513,14 +527,14 @@ const H = {
|
|
|
513
527
|
"selected",
|
|
514
528
|
"disabled"
|
|
515
529
|
]
|
|
516
|
-
},
|
|
530
|
+
}, St = {
|
|
517
531
|
allowsTextContent: !1,
|
|
518
532
|
allowsChildren: !0,
|
|
519
533
|
allowedAttributes: [
|
|
520
534
|
"role"
|
|
521
535
|
],
|
|
522
536
|
childTags: []
|
|
523
|
-
},
|
|
537
|
+
}, Lt = {
|
|
524
538
|
allowsTextContent: !0,
|
|
525
539
|
allowsChildren: !0,
|
|
526
540
|
allowedAttributes: [
|
|
@@ -531,19 +545,19 @@ const H = {
|
|
|
531
545
|
"download"
|
|
532
546
|
],
|
|
533
547
|
childTags: []
|
|
534
|
-
},
|
|
548
|
+
}, Ft = {
|
|
535
549
|
allowsTextContent: !0,
|
|
536
550
|
allowsChildren: !0,
|
|
537
551
|
allowedAttributes: [
|
|
538
552
|
"aria-hidden"
|
|
539
553
|
],
|
|
540
554
|
childTags: []
|
|
541
|
-
},
|
|
555
|
+
}, Gt = {
|
|
542
556
|
allowsTextContent: !0,
|
|
543
557
|
allowsChildren: !0,
|
|
544
558
|
allowedAttributes: [],
|
|
545
559
|
childTags: []
|
|
546
|
-
},
|
|
560
|
+
}, Mt = {
|
|
547
561
|
allowsTextContent: !1,
|
|
548
562
|
allowsChildren: !0,
|
|
549
563
|
allowedAttributes: [
|
|
@@ -552,127 +566,137 @@ const H = {
|
|
|
552
566
|
childTags: [
|
|
553
567
|
"li"
|
|
554
568
|
]
|
|
555
|
-
},
|
|
569
|
+
}, Rt = {
|
|
556
570
|
allowsTextContent: !0,
|
|
557
571
|
allowsChildren: !0,
|
|
558
572
|
allowedAttributes: [
|
|
559
573
|
"value"
|
|
560
574
|
],
|
|
561
575
|
childTags: []
|
|
562
|
-
},
|
|
576
|
+
}, zt = {
|
|
563
577
|
allowsTextContent: !1,
|
|
564
578
|
allowsChildren: !1,
|
|
565
579
|
allowedAttributes: []
|
|
566
|
-
},
|
|
567
|
-
$schema:
|
|
568
|
-
div:
|
|
569
|
-
input:
|
|
570
|
-
checkbox:
|
|
571
|
-
colgroup:
|
|
572
|
-
col:
|
|
573
|
-
label:
|
|
574
|
-
form:
|
|
575
|
-
select:
|
|
576
|
-
p:
|
|
577
|
-
h1:
|
|
578
|
-
h2:
|
|
579
|
-
span:
|
|
580
|
-
img:
|
|
581
|
-
button:
|
|
582
|
-
table:
|
|
583
|
-
thead:
|
|
584
|
-
tbody:
|
|
585
|
-
tfoot:
|
|
586
|
-
tr:
|
|
587
|
-
th:
|
|
588
|
-
td:
|
|
589
|
-
datalist:
|
|
590
|
-
option:
|
|
591
|
-
header:
|
|
592
|
-
a:
|
|
593
|
-
i:
|
|
594
|
-
small:
|
|
595
|
-
ul:
|
|
596
|
-
li:
|
|
597
|
-
hr:
|
|
598
|
-
},
|
|
580
|
+
}, It = {
|
|
581
|
+
$schema: it,
|
|
582
|
+
div: ct,
|
|
583
|
+
input: ut,
|
|
584
|
+
checkbox: dt,
|
|
585
|
+
colgroup: ft,
|
|
586
|
+
col: gt,
|
|
587
|
+
label: ht,
|
|
588
|
+
form: bt,
|
|
589
|
+
select: wt,
|
|
590
|
+
p: mt,
|
|
591
|
+
h1: pt,
|
|
592
|
+
h2: yt,
|
|
593
|
+
span: Tt,
|
|
594
|
+
img: Ct,
|
|
595
|
+
button: At,
|
|
596
|
+
table: xt,
|
|
597
|
+
thead: jt,
|
|
598
|
+
tbody: vt,
|
|
599
|
+
tfoot: Nt,
|
|
600
|
+
tr: $t,
|
|
601
|
+
th: kt,
|
|
602
|
+
td: Dt,
|
|
603
|
+
datalist: Ot,
|
|
604
|
+
option: Et,
|
|
605
|
+
header: St,
|
|
606
|
+
a: Lt,
|
|
607
|
+
i: Ft,
|
|
608
|
+
small: Gt,
|
|
609
|
+
ul: Mt,
|
|
610
|
+
li: Rt,
|
|
611
|
+
hr: zt
|
|
612
|
+
}, b = ({ inSpec: t }) => {
|
|
599
613
|
const e = t;
|
|
600
614
|
if (!e) return [];
|
|
601
615
|
if (Array.isArray(e))
|
|
602
|
-
return e.flatMap((
|
|
616
|
+
return e.flatMap((o) => b({ inSpec: o }));
|
|
603
617
|
if (typeof e != "object") return [];
|
|
604
618
|
const l = [];
|
|
605
|
-
return typeof e.tagName == "string" && e.tagName.trim().length > 0 && l.push(e.tagName.toLowerCase()), Array.isArray(e.children) && e.children.length > 0 && e.children.forEach((
|
|
606
|
-
const n =
|
|
619
|
+
return typeof e.tagName == "string" && e.tagName.trim().length > 0 && l.push(e.tagName.toLowerCase()), Array.isArray(e.children) && e.children.length > 0 && e.children.forEach((o) => {
|
|
620
|
+
const n = b({ inSpec: o });
|
|
607
621
|
l.push(...n);
|
|
608
622
|
}), l;
|
|
609
|
-
},
|
|
610
|
-
const l = t ?? [],
|
|
611
|
-
Object.keys(
|
|
612
|
-
),
|
|
623
|
+
}, Vt = ({ inTagsFound: t, inAllowedTags: e }) => {
|
|
624
|
+
const l = t ?? [], o = e ?? {}, n = new Set(
|
|
625
|
+
Object.keys(o).filter((s) => s !== "$schema").map((s) => s.toLowerCase())
|
|
626
|
+
), r = {}, a = [], i = [];
|
|
613
627
|
l.forEach((s) => {
|
|
614
|
-
|
|
628
|
+
r[s] = (r[s] || 0) + 1, n.has(s) ? a.includes(s) || a.push(s) : i.includes(s) || i.push(s);
|
|
615
629
|
});
|
|
616
|
-
const
|
|
630
|
+
const c = l.length, f = i.length === 0;
|
|
617
631
|
return {
|
|
618
|
-
totalTags:
|
|
619
|
-
tagCounts:
|
|
620
|
-
uniqueTags: Object.keys(
|
|
632
|
+
totalTags: c,
|
|
633
|
+
tagCounts: r,
|
|
634
|
+
uniqueTags: Object.keys(r),
|
|
621
635
|
recognizedTags: a,
|
|
622
636
|
unrecognizedTags: i,
|
|
623
|
-
areAllTagsPresent:
|
|
637
|
+
areAllTagsPresent: f
|
|
624
638
|
};
|
|
625
|
-
},
|
|
626
|
-
const l = t,
|
|
639
|
+
}, qt = ({ inSpec: t, inTags: e = It } = {}) => {
|
|
640
|
+
const l = t, o = e, n = b({ inSpec: l }), r = Vt({
|
|
627
641
|
inTagsFound: n,
|
|
628
|
-
inAllowedTags:
|
|
642
|
+
inAllowedTags: o
|
|
629
643
|
});
|
|
630
644
|
return {
|
|
631
|
-
areAllTagsPresent:
|
|
632
|
-
totalTags:
|
|
633
|
-
tagCounts:
|
|
634
|
-
uniqueTags:
|
|
635
|
-
recognizedTags:
|
|
636
|
-
unrecognizedTags:
|
|
645
|
+
areAllTagsPresent: r.areAllTagsPresent,
|
|
646
|
+
totalTags: r.totalTags,
|
|
647
|
+
tagCounts: r.tagCounts,
|
|
648
|
+
uniqueTags: r.uniqueTags,
|
|
649
|
+
recognizedTags: r.recognizedTags,
|
|
650
|
+
unrecognizedTags: r.unrecognizedTags
|
|
637
651
|
};
|
|
638
|
-
},
|
|
652
|
+
}, A = (t = {}) => {
|
|
639
653
|
const e = (t == null ? void 0 : t.spec) ?? (t == null ? void 0 : t.inSpec) ?? t;
|
|
640
|
-
return
|
|
654
|
+
return C(e);
|
|
641
655
|
};
|
|
642
|
-
|
|
643
|
-
inFuncDefinition:
|
|
644
|
-
inReviewSpec:
|
|
656
|
+
W({
|
|
657
|
+
inFuncDefinition: A,
|
|
658
|
+
inReviewSpec: qt
|
|
645
659
|
});
|
|
646
|
-
const
|
|
660
|
+
const Bt = ({
|
|
647
661
|
inTargetHtmlId: t,
|
|
648
662
|
inColumns: e,
|
|
649
663
|
type: l,
|
|
650
|
-
inData:
|
|
664
|
+
inData: o,
|
|
665
|
+
showLog: n
|
|
651
666
|
} = {}) => {
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
667
|
+
const r = t, a = o ?? [], i = e;
|
|
668
|
+
console.log("buildSpec 1 :", r, a.localColumns);
|
|
669
|
+
let c = y({
|
|
670
|
+
type: l,
|
|
671
|
+
data: a,
|
|
672
|
+
columns: i
|
|
673
|
+
}), f = c;
|
|
674
|
+
!("tagName" in c) && "children" in c && (f = c.children);
|
|
675
|
+
const s = A(f);
|
|
676
|
+
return console.log("buildSpec 3 :", s), s;
|
|
677
|
+
}, Pt = ({
|
|
660
678
|
type: t = "table",
|
|
661
679
|
targetHtmlId: e,
|
|
662
680
|
data: l,
|
|
663
|
-
classToApply:
|
|
681
|
+
classToApply: o,
|
|
664
682
|
columns: n,
|
|
665
|
-
appendPosition:
|
|
683
|
+
appendPosition: r,
|
|
684
|
+
showLog: a = !1
|
|
666
685
|
} = {}) => {
|
|
667
|
-
const
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
686
|
+
const i = t, c = e, f = l, s = n;
|
|
687
|
+
console.log("showLog 1 :", i, e, l, o, n, r);
|
|
688
|
+
const u = Bt({
|
|
689
|
+
inTargetHtmlId: c,
|
|
690
|
+
inColumns: s,
|
|
691
|
+
showLog: a,
|
|
692
|
+
inData: f,
|
|
693
|
+
type: i
|
|
694
|
+
});
|
|
695
|
+
console.log("showLog 2 :", u);
|
|
696
|
+
const d = document.getElementById(c);
|
|
697
|
+
return console.log("showLog 3 :", d), r === "prepend" ? d.prepend(u) : (d && (d.innerHTML = ""), console.log("showLog 4:1 :", u instanceof Node), console.log("showLog 4:2 :", u instanceof NodeList), console.log("showLog 4:3 :", u instanceof HTMLCollection), u != null && typeof u[Symbol.iterator] == "function" ? d.append(...u) : d.append(u)), console.log("showLog 5 :", d), d;
|
|
674
698
|
};
|
|
675
|
-
|
|
699
|
+
j(Pt);
|
|
676
700
|
export {
|
|
677
|
-
|
|
701
|
+
Pt as default
|
|
678
702
|
};
|