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