json-renderers 1.13.6 → 1.13.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 +272 -128
- package/docs/dist/min.js +702 -0
- package/docs/index.html +679 -13
- package/package.json +17 -6
package/docs/dist/min.js
ADDED
|
@@ -0,0 +1,702 @@
|
|
|
1
|
+
const x = {
|
|
2
|
+
version: "v13.1.0",
|
|
3
|
+
description: "build table from store data and render to DOM uses json-to-spec, json-to-dom under the hood"
|
|
4
|
+
}, j = (t) => {
|
|
5
|
+
var e;
|
|
6
|
+
typeof globalThis > "u" || !t || (globalThis.ks ?? (globalThis.ks = {}), (e = globalThis.ks).jsonRenderers ?? (e.jsonRenderers = {
|
|
7
|
+
meta: x,
|
|
8
|
+
renderToDom: t
|
|
9
|
+
}));
|
|
10
|
+
}, v = {
|
|
11
|
+
version: "v3.0.0",
|
|
12
|
+
description: "build table from store data and render to DOM uses json-to-spec, json-to-dom under the hood"
|
|
13
|
+
}, N = (t) => {
|
|
14
|
+
var e;
|
|
15
|
+
typeof globalThis > "u" || !t || (globalThis.ks ?? (globalThis.ks = {}), (e = globalThis.ks).jsonRenderersBuild ?? (e.jsonRenderersBuild = {
|
|
16
|
+
meta: v,
|
|
17
|
+
renderToDom: t
|
|
18
|
+
}));
|
|
19
|
+
}, $ = {
|
|
20
|
+
version: "v32",
|
|
21
|
+
description: "JSON-to-DOM engine with centralized traversal and responsibility-focused construction"
|
|
22
|
+
}, k = ({ inFuncDefinition: t } = {}) => {
|
|
23
|
+
if (typeof globalThis > "u" || !t) return;
|
|
24
|
+
globalThis.ks ?? (globalThis.ks = {});
|
|
25
|
+
const e = {
|
|
26
|
+
meta: $,
|
|
27
|
+
buildSpecElement: t
|
|
28
|
+
};
|
|
29
|
+
globalThis.ks.jsonToSpec = e;
|
|
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
|
+
if ("source" in t && (t == null ? void 0 : t.source) in e) {
|
|
32
|
+
const l = e[t == null ? void 0 : t.source];
|
|
33
|
+
if (Array.isArray(l))
|
|
34
|
+
return l.map((n) => {
|
|
35
|
+
const r = t == null ? void 0 : t.template;
|
|
36
|
+
if (r)
|
|
37
|
+
return g(r, n);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}, E = (t, e) => {
|
|
41
|
+
let l = [];
|
|
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
|
+
value: n
|
|
48
|
+
});
|
|
49
|
+
l.push(a);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return l;
|
|
53
|
+
}, S = (t, e) => {
|
|
54
|
+
if ("source" in t && (t == null ? void 0 : t.source) in e) {
|
|
55
|
+
const l = e[t == null ? void 0 : t.source];
|
|
56
|
+
if (Array.isArray(l))
|
|
57
|
+
return l.map((n) => {
|
|
58
|
+
const r = t == null ? void 0 : t.template;
|
|
59
|
+
if (r)
|
|
60
|
+
return g(r, n);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}, L = (t, e) => {
|
|
64
|
+
if ("operation" in t) {
|
|
65
|
+
if (t.operation === "loopArray")
|
|
66
|
+
return O(t, e);
|
|
67
|
+
if (t.operation === "loopObject")
|
|
68
|
+
return E(t, e);
|
|
69
|
+
if (t.operation === "loopCollection")
|
|
70
|
+
return S(t, e);
|
|
71
|
+
}
|
|
72
|
+
}, p = (t, e) => {
|
|
73
|
+
if (typeof e == "string") return e;
|
|
74
|
+
if (typeof t != "string") return t;
|
|
75
|
+
if (t === "${value}")
|
|
76
|
+
return e.value;
|
|
77
|
+
const l = t.match(/^\$\{(.+?)\}$/);
|
|
78
|
+
if (l) {
|
|
79
|
+
const o = l[1];
|
|
80
|
+
return (e == null ? void 0 : e[o]) ?? "";
|
|
81
|
+
}
|
|
82
|
+
return t;
|
|
83
|
+
}, F = (t, e) => {
|
|
84
|
+
let l = {};
|
|
85
|
+
for (const [o, n] of Object.entries(t)) {
|
|
86
|
+
const r = p(n, e);
|
|
87
|
+
l[o] = r;
|
|
88
|
+
}
|
|
89
|
+
return l;
|
|
90
|
+
}, G = (t, e) => {
|
|
91
|
+
if ("tagName" in t) {
|
|
92
|
+
if ("textContent" in t) {
|
|
93
|
+
const l = p(t.textContent, e);
|
|
94
|
+
t.textContent = l;
|
|
95
|
+
}
|
|
96
|
+
if ("attributes" in t) {
|
|
97
|
+
const l = F(t.attributes, e);
|
|
98
|
+
t.attributes = l;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}, M = (t, e) => {
|
|
102
|
+
if (!t || typeof t != "object" || Array.isArray(t)) return null;
|
|
103
|
+
const l = structuredClone(t);
|
|
104
|
+
if (!l) return null;
|
|
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
|
+
Array.isArray(n) ? l.children = n : l.children = [n], delete l.jsonToSpec;
|
|
108
|
+
}
|
|
109
|
+
if (Array.isArray(l == null ? void 0 : l.children)) {
|
|
110
|
+
const o = m(l == null ? void 0 : l.children, e);
|
|
111
|
+
l.children = o;
|
|
112
|
+
}
|
|
113
|
+
return l;
|
|
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
|
|
117
|
+
});
|
|
118
|
+
const R = {
|
|
119
|
+
default: {
|
|
120
|
+
tagName: "table",
|
|
121
|
+
attributes: {
|
|
122
|
+
class: "table table-hover table-striped mb-0"
|
|
123
|
+
},
|
|
124
|
+
children: [
|
|
125
|
+
{
|
|
126
|
+
tagName: "thead",
|
|
127
|
+
children: [
|
|
128
|
+
{
|
|
129
|
+
tagName: "tr",
|
|
130
|
+
jsonToSpec: {
|
|
131
|
+
operation: "loopCollection",
|
|
132
|
+
source: "columns",
|
|
133
|
+
template: {
|
|
134
|
+
tagName: "th",
|
|
135
|
+
textContent: "${title}"
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
children: []
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
tagName: "tbody",
|
|
144
|
+
jsonToSpec: {
|
|
145
|
+
operation: "loopCollection",
|
|
146
|
+
source: "data",
|
|
147
|
+
template: {
|
|
148
|
+
tagName: "tr",
|
|
149
|
+
jsonToSpec: {
|
|
150
|
+
operation: "loopObject",
|
|
151
|
+
source: "data",
|
|
152
|
+
template: {
|
|
153
|
+
tagName: "td",
|
|
154
|
+
textContent: "${value}"
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
children: []
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
children: []
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
}, z = ({
|
|
165
|
+
inColumns: t,
|
|
166
|
+
inData: e
|
|
167
|
+
} = {}) => {
|
|
168
|
+
const l = e ?? [], o = t;
|
|
169
|
+
return h(R.default, {
|
|
170
|
+
columns: o,
|
|
171
|
+
data: l
|
|
172
|
+
});
|
|
173
|
+
}, I = "select", V = {
|
|
174
|
+
id: "LedgerName"
|
|
175
|
+
}, q = {
|
|
176
|
+
operation: "loopArray",
|
|
177
|
+
source: "arrayOfStrings",
|
|
178
|
+
template: {
|
|
179
|
+
tagName: "option",
|
|
180
|
+
attributes: {
|
|
181
|
+
value: "${}"
|
|
182
|
+
},
|
|
183
|
+
textContent: "${}"
|
|
184
|
+
}
|
|
185
|
+
}, B = [], P = {
|
|
186
|
+
tagName: I,
|
|
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 = ({
|
|
208
|
+
inData: t
|
|
209
|
+
} = {}) => h(K, {
|
|
210
|
+
arrayOfStrings: t ?? []
|
|
211
|
+
}), w = {
|
|
212
|
+
table: z,
|
|
213
|
+
select: H,
|
|
214
|
+
selectOptionsOnly: X
|
|
215
|
+
}, y = ({
|
|
216
|
+
type: t = "table",
|
|
217
|
+
data: e,
|
|
218
|
+
columns: l
|
|
219
|
+
} = {}) => {
|
|
220
|
+
const o = t, n = w[o];
|
|
221
|
+
return n ? n({
|
|
222
|
+
inColumns: l,
|
|
223
|
+
inData: e
|
|
224
|
+
}) : (console.error(
|
|
225
|
+
`[Renderer] Unknown renderer type "${o}". Available types: ${Object.keys(w).join(", ")}`
|
|
226
|
+
), null);
|
|
227
|
+
};
|
|
228
|
+
N(y);
|
|
229
|
+
const Q = {
|
|
230
|
+
version: "v9",
|
|
231
|
+
description: "JSON-to-DOM engine with SVG namespace support, mixed text content, and centralized traversal"
|
|
232
|
+
}, W = ({ inFuncDefinition: t, inReviewSpec: e } = {}) => {
|
|
233
|
+
if (typeof globalThis > "u" || !t) return;
|
|
234
|
+
globalThis.ks ?? (globalThis.ks = {});
|
|
235
|
+
const l = {
|
|
236
|
+
meta: Q,
|
|
237
|
+
buildSpecElement: t,
|
|
238
|
+
reviewSpec: e
|
|
239
|
+
};
|
|
240
|
+
globalThis.ks["json-to-tag"] = l, globalThis.ks.jsonToTag = l;
|
|
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([
|
|
242
|
+
"svg",
|
|
243
|
+
"path",
|
|
244
|
+
"symbol",
|
|
245
|
+
"use",
|
|
246
|
+
"g",
|
|
247
|
+
"circle",
|
|
248
|
+
"ellipse",
|
|
249
|
+
"rect",
|
|
250
|
+
"line",
|
|
251
|
+
"polyline",
|
|
252
|
+
"polygon",
|
|
253
|
+
"text",
|
|
254
|
+
"tspan",
|
|
255
|
+
"defs",
|
|
256
|
+
"clippath",
|
|
257
|
+
"mask",
|
|
258
|
+
"pattern",
|
|
259
|
+
"marker",
|
|
260
|
+
"lineargradient",
|
|
261
|
+
"radialgradient",
|
|
262
|
+
"stop",
|
|
263
|
+
"image",
|
|
264
|
+
"filter",
|
|
265
|
+
"fegaussianblur",
|
|
266
|
+
"femerge",
|
|
267
|
+
"femergenode"
|
|
268
|
+
]), et = ({ inTagName: t }) => {
|
|
269
|
+
const e = t == null ? void 0 : t.toLowerCase();
|
|
270
|
+
if (!e) return null;
|
|
271
|
+
if (e === "checkbox") {
|
|
272
|
+
const l = document.createElement("input");
|
|
273
|
+
return l.type = "checkbox", l;
|
|
274
|
+
}
|
|
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")
|
|
279
|
+
return l;
|
|
280
|
+
const n = typeof SVGElement < "u" ? l instanceof SVGElement : l.namespaceURI === "http://www.w3.org/2000/svg";
|
|
281
|
+
return Object.entries(o).forEach(([r, a]) => {
|
|
282
|
+
if (r === "class") {
|
|
283
|
+
n ? l.setAttribute("class", String(a)) : l.className = a;
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
if (r === "xlink:href" || r === "href") {
|
|
287
|
+
if (a != null) {
|
|
288
|
+
const i = String(a);
|
|
289
|
+
if (n)
|
|
290
|
+
try {
|
|
291
|
+
l.setAttributeNS(rt, "href", i);
|
|
292
|
+
} catch {
|
|
293
|
+
}
|
|
294
|
+
l.setAttribute("href", i), l.setAttribute("xlink:href", i);
|
|
295
|
+
}
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
if (typeof a == "boolean") {
|
|
299
|
+
a ? l.setAttribute(r, "") : l.removeAttribute(r);
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
a != null && l.setAttribute(r, String(a));
|
|
303
|
+
}), l;
|
|
304
|
+
}, at = ({ inElement: t, inClassList: e }) => {
|
|
305
|
+
if (!t || !e) return t;
|
|
306
|
+
const l = typeof e == "string" ? e.split(/\s+/).filter(Boolean) : Array.isArray(e) ? e.filter((o) => typeof o == "string" && o.trim()) : [];
|
|
307
|
+
return l.length && t.classList.add(...l), t;
|
|
308
|
+
}, st = (t) => {
|
|
309
|
+
if (!t || typeof t != "object" || Array.isArray(t) || !t.tagName) return null;
|
|
310
|
+
const e = et({ inTagName: t.tagName });
|
|
311
|
+
if (!e) return null;
|
|
312
|
+
if (lt({
|
|
313
|
+
inElement: e,
|
|
314
|
+
inTextContent: Z(t.textContent),
|
|
315
|
+
inTagName: t.tagName
|
|
316
|
+
}), ot({
|
|
317
|
+
inElement: e,
|
|
318
|
+
inProperties: t.properties
|
|
319
|
+
}), nt({
|
|
320
|
+
inElement: e,
|
|
321
|
+
inAttributes: t.attributes
|
|
322
|
+
}), at({
|
|
323
|
+
inElement: e,
|
|
324
|
+
inClassList: t.classList
|
|
325
|
+
}), Array.isArray(t.children)) {
|
|
326
|
+
const l = T(t.children);
|
|
327
|
+
l.length && e.append(...l);
|
|
328
|
+
}
|
|
329
|
+
return e;
|
|
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 = {
|
|
331
|
+
allowsTextContent: !1,
|
|
332
|
+
allowsChildren: !0,
|
|
333
|
+
allowedAttributes: [
|
|
334
|
+
"title",
|
|
335
|
+
"role"
|
|
336
|
+
],
|
|
337
|
+
childTags: []
|
|
338
|
+
}, ut = {
|
|
339
|
+
allowsTextContent: !1,
|
|
340
|
+
allowsChildren: !1,
|
|
341
|
+
allowedAttributes: [
|
|
342
|
+
"type",
|
|
343
|
+
"placeholder",
|
|
344
|
+
"value",
|
|
345
|
+
"name",
|
|
346
|
+
"disabled",
|
|
347
|
+
"readonly",
|
|
348
|
+
"required",
|
|
349
|
+
"list"
|
|
350
|
+
]
|
|
351
|
+
}, dt = {
|
|
352
|
+
allowsTextContent: !1,
|
|
353
|
+
allowsChildren: !1,
|
|
354
|
+
allowedAttributes: [
|
|
355
|
+
"type",
|
|
356
|
+
"checked",
|
|
357
|
+
"name",
|
|
358
|
+
"value",
|
|
359
|
+
"disabled",
|
|
360
|
+
"required"
|
|
361
|
+
]
|
|
362
|
+
}, ft = {
|
|
363
|
+
allowsTextContent: !1,
|
|
364
|
+
allowsChildren: !0,
|
|
365
|
+
allowedAttributes: [
|
|
366
|
+
"span"
|
|
367
|
+
],
|
|
368
|
+
childTags: [
|
|
369
|
+
"col"
|
|
370
|
+
]
|
|
371
|
+
}, gt = {
|
|
372
|
+
allowsTextContent: !1,
|
|
373
|
+
allowsChildren: !1,
|
|
374
|
+
allowedAttributes: [
|
|
375
|
+
"span",
|
|
376
|
+
"style",
|
|
377
|
+
"width"
|
|
378
|
+
]
|
|
379
|
+
}, ht = {
|
|
380
|
+
allowsTextContent: !0,
|
|
381
|
+
allowsChildren: !0,
|
|
382
|
+
allowedAttributes: [
|
|
383
|
+
"for"
|
|
384
|
+
],
|
|
385
|
+
childTags: []
|
|
386
|
+
}, bt = {
|
|
387
|
+
allowsTextContent: !1,
|
|
388
|
+
allowsChildren: !0,
|
|
389
|
+
allowedAttributes: [
|
|
390
|
+
"action",
|
|
391
|
+
"method",
|
|
392
|
+
"autocomplete",
|
|
393
|
+
"enctype",
|
|
394
|
+
"name",
|
|
395
|
+
"novalidate",
|
|
396
|
+
"target"
|
|
397
|
+
],
|
|
398
|
+
childTags: []
|
|
399
|
+
}, wt = {
|
|
400
|
+
allowsTextContent: !1,
|
|
401
|
+
allowsChildren: !0,
|
|
402
|
+
allowedAttributes: [
|
|
403
|
+
"name",
|
|
404
|
+
"disabled",
|
|
405
|
+
"required",
|
|
406
|
+
"multiple",
|
|
407
|
+
"size"
|
|
408
|
+
],
|
|
409
|
+
childTags: [
|
|
410
|
+
"option"
|
|
411
|
+
]
|
|
412
|
+
}, mt = {
|
|
413
|
+
allowsTextContent: !0,
|
|
414
|
+
allowsChildren: !0,
|
|
415
|
+
allowedAttributes: [],
|
|
416
|
+
childTags: []
|
|
417
|
+
}, pt = {
|
|
418
|
+
allowsTextContent: !0,
|
|
419
|
+
allowsChildren: !0,
|
|
420
|
+
allowedAttributes: [],
|
|
421
|
+
childTags: []
|
|
422
|
+
}, yt = {
|
|
423
|
+
allowsTextContent: !0,
|
|
424
|
+
allowsChildren: !0,
|
|
425
|
+
allowedAttributes: [],
|
|
426
|
+
childTags: []
|
|
427
|
+
}, Tt = {
|
|
428
|
+
allowsTextContent: !0,
|
|
429
|
+
allowsChildren: !0,
|
|
430
|
+
allowedAttributes: [],
|
|
431
|
+
childTags: []
|
|
432
|
+
}, Ct = {
|
|
433
|
+
allowsTextContent: !1,
|
|
434
|
+
allowsChildren: !1,
|
|
435
|
+
allowedAttributes: [
|
|
436
|
+
"src",
|
|
437
|
+
"alt",
|
|
438
|
+
"width",
|
|
439
|
+
"height",
|
|
440
|
+
"loading"
|
|
441
|
+
]
|
|
442
|
+
}, At = {
|
|
443
|
+
allowsTextContent: !0,
|
|
444
|
+
allowsChildren: !0,
|
|
445
|
+
allowedAttributes: [
|
|
446
|
+
"type",
|
|
447
|
+
"disabled",
|
|
448
|
+
"name",
|
|
449
|
+
"value"
|
|
450
|
+
],
|
|
451
|
+
childTags: []
|
|
452
|
+
}, xt = {
|
|
453
|
+
allowsTextContent: !1,
|
|
454
|
+
allowsChildren: !0,
|
|
455
|
+
allowedAttributes: [
|
|
456
|
+
"border",
|
|
457
|
+
"cellpadding",
|
|
458
|
+
"cellspacing"
|
|
459
|
+
],
|
|
460
|
+
childTags: [
|
|
461
|
+
"caption",
|
|
462
|
+
"colgroup",
|
|
463
|
+
"thead",
|
|
464
|
+
"tbody",
|
|
465
|
+
"tfoot",
|
|
466
|
+
"tr"
|
|
467
|
+
]
|
|
468
|
+
}, jt = {
|
|
469
|
+
allowsTextContent: !1,
|
|
470
|
+
allowsChildren: !0,
|
|
471
|
+
allowedAttributes: [],
|
|
472
|
+
childTags: [
|
|
473
|
+
"tr"
|
|
474
|
+
]
|
|
475
|
+
}, vt = {
|
|
476
|
+
allowsTextContent: !1,
|
|
477
|
+
allowsChildren: !0,
|
|
478
|
+
allowedAttributes: [],
|
|
479
|
+
childTags: [
|
|
480
|
+
"tr"
|
|
481
|
+
]
|
|
482
|
+
}, Nt = {
|
|
483
|
+
allowsTextContent: !1,
|
|
484
|
+
allowsChildren: !0,
|
|
485
|
+
allowedAttributes: [],
|
|
486
|
+
childTags: [
|
|
487
|
+
"tr"
|
|
488
|
+
]
|
|
489
|
+
}, $t = {
|
|
490
|
+
allowsTextContent: !1,
|
|
491
|
+
allowsChildren: !0,
|
|
492
|
+
allowedAttributes: [],
|
|
493
|
+
childTags: [
|
|
494
|
+
"td",
|
|
495
|
+
"th"
|
|
496
|
+
]
|
|
497
|
+
}, kt = {
|
|
498
|
+
allowsTextContent: !0,
|
|
499
|
+
allowsChildren: !0,
|
|
500
|
+
allowedAttributes: [
|
|
501
|
+
"scope",
|
|
502
|
+
"colspan",
|
|
503
|
+
"rowspan"
|
|
504
|
+
],
|
|
505
|
+
childTags: []
|
|
506
|
+
}, Dt = {
|
|
507
|
+
allowsTextContent: !0,
|
|
508
|
+
allowsChildren: !0,
|
|
509
|
+
allowedAttributes: [
|
|
510
|
+
"colspan",
|
|
511
|
+
"rowspan"
|
|
512
|
+
],
|
|
513
|
+
childTags: []
|
|
514
|
+
}, Ot = {
|
|
515
|
+
allowsTextContent: !1,
|
|
516
|
+
allowsChildren: !0,
|
|
517
|
+
allowedAttributes: [],
|
|
518
|
+
childTags: [
|
|
519
|
+
"option"
|
|
520
|
+
]
|
|
521
|
+
}, Et = {
|
|
522
|
+
allowsTextContent: !0,
|
|
523
|
+
allowsChildren: !1,
|
|
524
|
+
allowedAttributes: [
|
|
525
|
+
"value",
|
|
526
|
+
"label",
|
|
527
|
+
"selected",
|
|
528
|
+
"disabled"
|
|
529
|
+
]
|
|
530
|
+
}, St = {
|
|
531
|
+
allowsTextContent: !1,
|
|
532
|
+
allowsChildren: !0,
|
|
533
|
+
allowedAttributes: [
|
|
534
|
+
"role"
|
|
535
|
+
],
|
|
536
|
+
childTags: []
|
|
537
|
+
}, Lt = {
|
|
538
|
+
allowsTextContent: !0,
|
|
539
|
+
allowsChildren: !0,
|
|
540
|
+
allowedAttributes: [
|
|
541
|
+
"href",
|
|
542
|
+
"target",
|
|
543
|
+
"rel",
|
|
544
|
+
"title",
|
|
545
|
+
"download"
|
|
546
|
+
],
|
|
547
|
+
childTags: []
|
|
548
|
+
}, Ft = {
|
|
549
|
+
allowsTextContent: !0,
|
|
550
|
+
allowsChildren: !0,
|
|
551
|
+
allowedAttributes: [
|
|
552
|
+
"aria-hidden"
|
|
553
|
+
],
|
|
554
|
+
childTags: []
|
|
555
|
+
}, Gt = {
|
|
556
|
+
allowsTextContent: !0,
|
|
557
|
+
allowsChildren: !0,
|
|
558
|
+
allowedAttributes: [],
|
|
559
|
+
childTags: []
|
|
560
|
+
}, Mt = {
|
|
561
|
+
allowsTextContent: !1,
|
|
562
|
+
allowsChildren: !0,
|
|
563
|
+
allowedAttributes: [
|
|
564
|
+
"type"
|
|
565
|
+
],
|
|
566
|
+
childTags: [
|
|
567
|
+
"li"
|
|
568
|
+
]
|
|
569
|
+
}, Rt = {
|
|
570
|
+
allowsTextContent: !0,
|
|
571
|
+
allowsChildren: !0,
|
|
572
|
+
allowedAttributes: [
|
|
573
|
+
"value"
|
|
574
|
+
],
|
|
575
|
+
childTags: []
|
|
576
|
+
}, zt = {
|
|
577
|
+
allowsTextContent: !1,
|
|
578
|
+
allowsChildren: !1,
|
|
579
|
+
allowedAttributes: []
|
|
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 }) => {
|
|
613
|
+
const e = t;
|
|
614
|
+
if (!e) return [];
|
|
615
|
+
if (Array.isArray(e))
|
|
616
|
+
return e.flatMap((o) => b({ inSpec: o }));
|
|
617
|
+
if (typeof e != "object") return [];
|
|
618
|
+
const l = [];
|
|
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 });
|
|
621
|
+
l.push(...n);
|
|
622
|
+
}), l;
|
|
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 = [];
|
|
627
|
+
l.forEach((s) => {
|
|
628
|
+
r[s] = (r[s] || 0) + 1, n.has(s) ? a.includes(s) || a.push(s) : i.includes(s) || i.push(s);
|
|
629
|
+
});
|
|
630
|
+
const c = l.length, f = i.length === 0;
|
|
631
|
+
return {
|
|
632
|
+
totalTags: c,
|
|
633
|
+
tagCounts: r,
|
|
634
|
+
uniqueTags: Object.keys(r),
|
|
635
|
+
recognizedTags: a,
|
|
636
|
+
unrecognizedTags: i,
|
|
637
|
+
areAllTagsPresent: f
|
|
638
|
+
};
|
|
639
|
+
}, qt = ({ inSpec: t, inTags: e = It } = {}) => {
|
|
640
|
+
const l = t, o = e, n = b({ inSpec: l }), r = Vt({
|
|
641
|
+
inTagsFound: n,
|
|
642
|
+
inAllowedTags: o
|
|
643
|
+
});
|
|
644
|
+
return {
|
|
645
|
+
areAllTagsPresent: r.areAllTagsPresent,
|
|
646
|
+
totalTags: r.totalTags,
|
|
647
|
+
tagCounts: r.tagCounts,
|
|
648
|
+
uniqueTags: r.uniqueTags,
|
|
649
|
+
recognizedTags: r.recognizedTags,
|
|
650
|
+
unrecognizedTags: r.unrecognizedTags
|
|
651
|
+
};
|
|
652
|
+
}, A = (t = {}) => {
|
|
653
|
+
const e = (t == null ? void 0 : t.spec) ?? (t == null ? void 0 : t.inSpec) ?? t;
|
|
654
|
+
return C(e);
|
|
655
|
+
};
|
|
656
|
+
W({
|
|
657
|
+
inFuncDefinition: A,
|
|
658
|
+
inReviewSpec: qt
|
|
659
|
+
});
|
|
660
|
+
const Bt = ({
|
|
661
|
+
inTargetHtmlId: t,
|
|
662
|
+
inColumns: e,
|
|
663
|
+
type: l,
|
|
664
|
+
inData: o,
|
|
665
|
+
showLog: n
|
|
666
|
+
} = {}) => {
|
|
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 = ({
|
|
678
|
+
type: t = "table",
|
|
679
|
+
targetHtmlId: e,
|
|
680
|
+
data: l,
|
|
681
|
+
classToApply: o,
|
|
682
|
+
columns: n,
|
|
683
|
+
appendPosition: r,
|
|
684
|
+
showLog: a = !1
|
|
685
|
+
} = {}) => {
|
|
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;
|
|
698
|
+
};
|
|
699
|
+
j(Pt);
|
|
700
|
+
export {
|
|
701
|
+
Pt as default
|
|
702
|
+
};
|