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
package/docs/dist/v9/min.js
CHANGED
|
@@ -1,1032 +1,1032 @@
|
|
|
1
|
-
const meta$2 = {
|
|
2
|
-
version: "v4.0.0",
|
|
3
|
-
description: "build table from store data and render to DOM uses json-to-spec, json-to-dom under the hood"
|
|
4
|
-
}, registerGlobal$2 = (t) => {
|
|
5
|
-
var e;
|
|
6
|
-
typeof globalThis > "u" || !t || (globalThis.ks ?? (globalThis.ks = {}), (e = globalThis.ks).jsonRenderers ?? (e.jsonRenderers = {
|
|
7
|
-
meta: meta$2,
|
|
8
|
-
renderToDom: t
|
|
9
|
-
}));
|
|
10
|
-
}, meta$1 = {
|
|
11
|
-
version: "v32",
|
|
12
|
-
description: "JSON-to-DOM engine with centralized traversal and responsibility-focused construction"
|
|
13
|
-
}, registerGlobal$1 = ({ inFuncDefinition: t } = {}) => {
|
|
14
|
-
if (typeof globalThis > "u" || !t) return;
|
|
15
|
-
globalThis.ks ?? (globalThis.ks = {});
|
|
16
|
-
const e = {
|
|
17
|
-
meta: meta$1,
|
|
18
|
-
buildSpecElement: t
|
|
19
|
-
};
|
|
20
|
-
globalThis.ks["json-to-tag"] = e, globalThis.ks.jsonToTag = e;
|
|
21
|
-
}, resolveChild = (t, e) => traverse$1(t, e), traverseArray = (t, e) => Array.isArray(t) ? t.map((n) => resolveChild(n, e)).flat(1 / 0).filter(Boolean) : [], startFunc$i = (t, e) => {
|
|
22
|
-
if ("source" in t && (t == null ? void 0 : t.source) in e) {
|
|
23
|
-
const n = e[t == null ? void 0 : t.source];
|
|
24
|
-
if (Array.isArray(n))
|
|
25
|
-
return n.map((l) => {
|
|
26
|
-
const o = t == null ? void 0 : t.template;
|
|
27
|
-
if (o)
|
|
28
|
-
return traverse$1(o, l);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}, startFunc$h = (t, e) => {
|
|
32
|
-
let n = [];
|
|
33
|
-
for (const [r, l] of Object.entries(e)) {
|
|
34
|
-
const o = t == null ? void 0 : t.template;
|
|
35
|
-
if (o) {
|
|
36
|
-
const s = traverse$1(o, {
|
|
37
|
-
key: r,
|
|
38
|
-
value: l
|
|
39
|
-
});
|
|
40
|
-
n.push(s);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return n;
|
|
44
|
-
}, startFunc$g = (t, e) => {
|
|
45
|
-
if ("source" in t && (t == null ? void 0 : t.source) in e) {
|
|
46
|
-
const n = e[t == null ? void 0 : t.source];
|
|
47
|
-
if (Array.isArray(n))
|
|
48
|
-
return n.map((l) => {
|
|
49
|
-
const o = t == null ? void 0 : t.template;
|
|
50
|
-
if (o)
|
|
51
|
-
return traverse$1(o, l);
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}, startFunc$f = (t, e) => {
|
|
55
|
-
if ("operation" in t) {
|
|
56
|
-
if (t.operation === "loopArray")
|
|
57
|
-
return startFunc$i(t, e);
|
|
58
|
-
if (t.operation === "loopObject")
|
|
59
|
-
return startFunc$h(t, e);
|
|
60
|
-
if (t.operation === "loopCollection")
|
|
61
|
-
return startFunc$g(t, e);
|
|
62
|
-
}
|
|
63
|
-
}, startFunc$e = (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 n = t.match(/^\$\{(.+?)\}$/);
|
|
69
|
-
if (n) {
|
|
70
|
-
const r = n[1];
|
|
71
|
-
return (e == null ? void 0 : e[r]) ?? "";
|
|
72
|
-
}
|
|
73
|
-
return t;
|
|
74
|
-
}, startFunc$d = (t, e) => {
|
|
75
|
-
let n = {};
|
|
76
|
-
for (const [r, l] of Object.entries(t)) {
|
|
77
|
-
const o = startFunc$e(l, e);
|
|
78
|
-
n[r] = o;
|
|
79
|
-
}
|
|
80
|
-
return n;
|
|
81
|
-
}, startFunc$c = (t, e) => {
|
|
82
|
-
if ("tagName" in t) {
|
|
83
|
-
if ("textContent" in t) {
|
|
84
|
-
const n = startFunc$e(t.textContent, e);
|
|
85
|
-
t.textContent = n;
|
|
86
|
-
}
|
|
87
|
-
if ("attributes" in t) {
|
|
88
|
-
const n = startFunc$d(t.attributes, e);
|
|
89
|
-
t.attributes = n;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}, traverseObject = (t, e) => {
|
|
93
|
-
if (!t || typeof t != "object" || Array.isArray(t)) return null;
|
|
94
|
-
const n = structuredClone(t);
|
|
95
|
-
if (!n) return null;
|
|
96
|
-
if ("tagName" in n && startFunc$c(n, e), "jsonToSpec" in n) {
|
|
97
|
-
const r = n == null ? void 0 : n.jsonToSpec, l = startFunc$f(r, e);
|
|
98
|
-
Array.isArray(l) ? n.children = l : n.children = [l], delete n.jsonToSpec;
|
|
99
|
-
}
|
|
100
|
-
if (Array.isArray(n == null ? void 0 : n.children)) {
|
|
101
|
-
const r = traverseArray(n == null ? void 0 : n.children, e);
|
|
102
|
-
n.children = r;
|
|
103
|
-
}
|
|
104
|
-
return n;
|
|
105
|
-
}, traverse$1 = (t, e) => {
|
|
106
|
-
if (t == null) return null;
|
|
107
|
-
debugger;
|
|
108
|
-
return typeof Node < "u" && t instanceof Node ? t : Array.isArray(t) ? traverseArray(t, e) : typeof t == "object" ? traverseObject(t, e) : typeof t == "string" || typeof t == "number" ? document.createTextNode(String(t)) : t;
|
|
109
|
-
}, buildSpecElement$1 = (t, e) => traverse$1(t, e);
|
|
110
|
-
registerGlobal$1({
|
|
111
|
-
inFuncDefinition: buildSpecElement$1
|
|
112
|
-
});
|
|
113
|
-
const meta = {
|
|
114
|
-
version: "v3.0",
|
|
115
|
-
description: "Pure DOM engine with JSON review and tags.json catalog verification"
|
|
116
|
-
}, registerGlobal = (t) => {
|
|
117
|
-
const e = t, n = typeof e == "function" ? e : e == null ? void 0 : e.inFuncDefinition, r = e == null ? void 0 : e.inReviewSpec;
|
|
118
|
-
typeof globalThis > "u" || !n || (globalThis.ks ?? (globalThis.ks = {}), globalThis.ks["json-to-tag"] = {
|
|
119
|
-
meta,
|
|
120
|
-
buildSpecElement: n,
|
|
121
|
-
reviewSpec: r
|
|
122
|
-
}, globalThis.ks.jsonToTag = {
|
|
123
|
-
meta,
|
|
124
|
-
buildSpecElement: n,
|
|
125
|
-
reviewSpec: r
|
|
126
|
-
});
|
|
127
|
-
}, isNullOrUndefined = ({ inSpec: t }) => {
|
|
128
|
-
const e = t;
|
|
129
|
-
return e == null;
|
|
130
|
-
}, isDomNode = ({ inSpec: t }) => typeof Node < "u" && t instanceof Node, isSpecArray = ({ inSpec: t }) => {
|
|
131
|
-
const e = t;
|
|
132
|
-
return Array.isArray(e);
|
|
133
|
-
}, buildSpecArray = ({ inSpec: t, inShowLog: e = !1 }) => {
|
|
134
|
-
const n = t, r = e;
|
|
135
|
-
return Array.isArray(n) ? n.map((l) => dispatchSpec({
|
|
136
|
-
inSpec: l,
|
|
137
|
-
inShowLog: r
|
|
138
|
-
})).flat().filter(Boolean) : [];
|
|
139
|
-
}, createElement = ({ inTagName: t }) => {
|
|
140
|
-
const e = t == null ? void 0 : t.toLowerCase();
|
|
141
|
-
if (!e) return null;
|
|
142
|
-
if (e === "checkbox") {
|
|
143
|
-
const n = document.createElement("input");
|
|
144
|
-
return n.type = "checkbox", n;
|
|
145
|
-
}
|
|
146
|
-
return document.createElement(e);
|
|
147
|
-
}, applyTextContent = ({ inElement: t, inTextContent: e, inAllowsTextContent: n = !0, inTagName: r, inShowLog: l = !1 }) => {
|
|
148
|
-
const o = t, s = e, c = n, u = r, g = l;
|
|
149
|
-
return !o || s === void 0 || s === null ? o : c ? (o.textContent = s, o) : (g && console.warn(`[json-to-tag v3] textContent is not allowed on <${u}>; discarded "${s}"`), o);
|
|
150
|
-
}, applyProperties = ({ inElement: t, inProperties: e }) => {
|
|
151
|
-
const n = t, r = e;
|
|
152
|
-
return n && r && typeof r == "object" && Object.assign(n, r), n;
|
|
153
|
-
}, applyAttributes = ({ inElement: t, inAttributes: e }) => {
|
|
154
|
-
const n = t, r = e;
|
|
155
|
-
return !n || !r || typeof r != "object" || Object.entries(r).forEach(([l, o]) => {
|
|
156
|
-
l === "class" ? n.className = o : typeof o == "boolean" ? o ? n.setAttribute(l, "") : n.removeAttribute(l) : o != null && n.setAttribute(l, String(o));
|
|
157
|
-
}), n;
|
|
158
|
-
}, applyClassList = ({ inElement: t, inClassList: e }) => {
|
|
159
|
-
const n = t, r = e;
|
|
160
|
-
if (!n || !r) return n;
|
|
161
|
-
let l = [];
|
|
162
|
-
return typeof r == "string" ? l = r.split(/\s+/).filter(Boolean) : Array.isArray(r) && (l = r.filter((o) => typeof o == "string" && o.trim().length > 0)), l.length > 0 && n.classList.add(...l), n;
|
|
163
|
-
}, appendChildren = ({ inElement: t, inChildren: e, inAllowsChildren: n = !0, inTagName: r, inShowLog: l = !1 }) => {
|
|
164
|
-
const o = t, s = e, c = n, u = r, g = l;
|
|
165
|
-
return !o || !Array.isArray(s) || s.length === 0 ? o : c ? (s.forEach((d) => {
|
|
166
|
-
typeof Node < "u" && d instanceof Node ? o.appendChild(d) : (typeof d == "string" || typeof d == "number") && o.appendChild(document.createTextNode(String(d)));
|
|
167
|
-
}), o) : (g && console.warn(`[json-to-tag v3] Children are not allowed on void tag <${u}>; discarded ${s.length} child nodes.`), o);
|
|
168
|
-
}, domElementBuilder = ({ inSpec: t, inClassList: e }) => {
|
|
169
|
-
const n = t, r = e || (n == null ? void 0 : n.classList);
|
|
170
|
-
if (!n || !n.tagName) return null;
|
|
171
|
-
const l = createElement({ inTagName: n.tagName });
|
|
172
|
-
return l ? (applyTextContent({
|
|
173
|
-
inElement: l,
|
|
174
|
-
inTextContent: n.textContent,
|
|
175
|
-
inTagName: n.tagName
|
|
176
|
-
}), applyProperties({
|
|
177
|
-
inElement: l,
|
|
178
|
-
inProperties: n.properties
|
|
179
|
-
}), applyAttributes({
|
|
180
|
-
inElement: l,
|
|
181
|
-
inAttributes: n.attributes
|
|
182
|
-
}), applyClassList({
|
|
183
|
-
inElement: l,
|
|
184
|
-
inClassList: r
|
|
185
|
-
}), appendChildren({
|
|
186
|
-
inElement: l,
|
|
187
|
-
inChildren: n.children,
|
|
188
|
-
inTagName: n.tagName
|
|
189
|
-
}), l) : null;
|
|
190
|
-
}, buildChildrenNodes = ({ inChildren: t, inShowLog: e = !1 }) => {
|
|
191
|
-
const n = t, r = e;
|
|
192
|
-
return Array.isArray(n) ? n.map((o) => dispatchSpec({
|
|
193
|
-
inSpec: o,
|
|
194
|
-
inShowLog: r
|
|
195
|
-
})).flat().filter(Boolean) : [];
|
|
196
|
-
}, buildSingleElement = ({ inSpec: t, inShowLog: e = !1 }) => {
|
|
197
|
-
const n = t, r = e, l = domElementBuilder({ inSpec: n });
|
|
198
|
-
let o = [];
|
|
199
|
-
return "children" in n && (o = Array.isArray(n.children) && n.children.length > 0 ? buildChildrenNodes({
|
|
200
|
-
inChildren: n.children,
|
|
201
|
-
inShowLog: r
|
|
202
|
-
}) : [], l.append(...o)), l;
|
|
203
|
-
}, dispatchSpec = ({ inSpec: t, inShowLog: e = !1 } = {}) => {
|
|
204
|
-
const n = t, r = e;
|
|
205
|
-
return isNullOrUndefined({ inSpec: n }) ? null : isDomNode({ inSpec: n }) ? n : isSpecArray({ inSpec: n }) ? buildSpecArray({
|
|
206
|
-
inSpec: n,
|
|
207
|
-
inShowLog: r
|
|
208
|
-
}) : buildSingleElement({
|
|
209
|
-
inSpec: n,
|
|
210
|
-
inShowLog: r
|
|
211
|
-
});
|
|
212
|
-
}, $schema = "./tags.schema.json", div = {
|
|
213
|
-
allowsTextContent: !1,
|
|
214
|
-
allowsChildren: !0,
|
|
215
|
-
allowedAttributes: [
|
|
216
|
-
"title",
|
|
217
|
-
"role"
|
|
218
|
-
],
|
|
219
|
-
childTags: []
|
|
220
|
-
}, input = {
|
|
221
|
-
allowsTextContent: !1,
|
|
222
|
-
allowsChildren: !1,
|
|
223
|
-
allowedAttributes: [
|
|
224
|
-
"type",
|
|
225
|
-
"placeholder",
|
|
226
|
-
"value",
|
|
227
|
-
"name",
|
|
228
|
-
"disabled",
|
|
229
|
-
"readonly",
|
|
230
|
-
"required",
|
|
231
|
-
"list"
|
|
232
|
-
]
|
|
233
|
-
}, checkbox = {
|
|
234
|
-
allowsTextContent: !1,
|
|
235
|
-
allowsChildren: !1,
|
|
236
|
-
allowedAttributes: [
|
|
237
|
-
"type",
|
|
238
|
-
"checked",
|
|
239
|
-
"name",
|
|
240
|
-
"value",
|
|
241
|
-
"disabled",
|
|
242
|
-
"required"
|
|
243
|
-
]
|
|
244
|
-
}, colgroup = {
|
|
245
|
-
allowsTextContent: !1,
|
|
246
|
-
allowsChildren: !0,
|
|
247
|
-
allowedAttributes: [
|
|
248
|
-
"span"
|
|
249
|
-
],
|
|
250
|
-
childTags: [
|
|
251
|
-
"col"
|
|
252
|
-
]
|
|
253
|
-
}, col = {
|
|
254
|
-
allowsTextContent: !1,
|
|
255
|
-
allowsChildren: !1,
|
|
256
|
-
allowedAttributes: [
|
|
257
|
-
"span",
|
|
258
|
-
"style",
|
|
259
|
-
"width"
|
|
260
|
-
]
|
|
261
|
-
}, label = {
|
|
262
|
-
allowsTextContent: !0,
|
|
263
|
-
allowsChildren: !0,
|
|
264
|
-
allowedAttributes: [
|
|
265
|
-
"for"
|
|
266
|
-
],
|
|
267
|
-
childTags: []
|
|
268
|
-
}, form = {
|
|
269
|
-
allowsTextContent: !1,
|
|
270
|
-
allowsChildren: !0,
|
|
271
|
-
allowedAttributes: [
|
|
272
|
-
"action",
|
|
273
|
-
"method",
|
|
274
|
-
"autocomplete",
|
|
275
|
-
"enctype",
|
|
276
|
-
"name",
|
|
277
|
-
"novalidate",
|
|
278
|
-
"target"
|
|
279
|
-
],
|
|
280
|
-
childTags: []
|
|
281
|
-
}, select = {
|
|
282
|
-
allowsTextContent: !1,
|
|
283
|
-
allowsChildren: !0,
|
|
284
|
-
allowedAttributes: [
|
|
285
|
-
"name",
|
|
286
|
-
"disabled",
|
|
287
|
-
"required",
|
|
288
|
-
"multiple",
|
|
289
|
-
"size"
|
|
290
|
-
],
|
|
291
|
-
childTags: [
|
|
292
|
-
"option"
|
|
293
|
-
]
|
|
294
|
-
}, p = {
|
|
295
|
-
allowsTextContent: !0,
|
|
296
|
-
allowsChildren: !0,
|
|
297
|
-
allowedAttributes: [],
|
|
298
|
-
childTags: []
|
|
299
|
-
}, h1 = {
|
|
300
|
-
allowsTextContent: !0,
|
|
301
|
-
allowsChildren: !0,
|
|
302
|
-
allowedAttributes: [],
|
|
303
|
-
childTags: []
|
|
304
|
-
}, h2 = {
|
|
305
|
-
allowsTextContent: !0,
|
|
306
|
-
allowsChildren: !0,
|
|
307
|
-
allowedAttributes: [],
|
|
308
|
-
childTags: []
|
|
309
|
-
}, span = {
|
|
310
|
-
allowsTextContent: !0,
|
|
311
|
-
allowsChildren: !0,
|
|
312
|
-
allowedAttributes: [],
|
|
313
|
-
childTags: []
|
|
314
|
-
}, img = {
|
|
315
|
-
allowsTextContent: !1,
|
|
316
|
-
allowsChildren: !1,
|
|
317
|
-
allowedAttributes: [
|
|
318
|
-
"src",
|
|
319
|
-
"alt",
|
|
320
|
-
"width",
|
|
321
|
-
"height",
|
|
322
|
-
"loading"
|
|
323
|
-
]
|
|
324
|
-
}, button = {
|
|
325
|
-
allowsTextContent: !0,
|
|
326
|
-
allowsChildren: !0,
|
|
327
|
-
allowedAttributes: [
|
|
328
|
-
"type",
|
|
329
|
-
"disabled",
|
|
330
|
-
"name",
|
|
331
|
-
"value"
|
|
332
|
-
],
|
|
333
|
-
childTags: []
|
|
334
|
-
}, table = {
|
|
335
|
-
allowsTextContent: !1,
|
|
336
|
-
allowsChildren: !0,
|
|
337
|
-
allowedAttributes: [
|
|
338
|
-
"border",
|
|
339
|
-
"cellpadding",
|
|
340
|
-
"cellspacing"
|
|
341
|
-
],
|
|
342
|
-
childTags: [
|
|
343
|
-
"caption",
|
|
344
|
-
"colgroup",
|
|
345
|
-
"thead",
|
|
346
|
-
"tbody",
|
|
347
|
-
"tfoot",
|
|
348
|
-
"tr"
|
|
349
|
-
]
|
|
350
|
-
}, thead = {
|
|
351
|
-
allowsTextContent: !1,
|
|
352
|
-
allowsChildren: !0,
|
|
353
|
-
allowedAttributes: [],
|
|
354
|
-
childTags: [
|
|
355
|
-
"tr"
|
|
356
|
-
]
|
|
357
|
-
}, tbody = {
|
|
358
|
-
allowsTextContent: !1,
|
|
359
|
-
allowsChildren: !0,
|
|
360
|
-
allowedAttributes: [],
|
|
361
|
-
childTags: [
|
|
362
|
-
"tr"
|
|
363
|
-
]
|
|
364
|
-
}, tfoot = {
|
|
365
|
-
allowsTextContent: !1,
|
|
366
|
-
allowsChildren: !0,
|
|
367
|
-
allowedAttributes: [],
|
|
368
|
-
childTags: [
|
|
369
|
-
"tr"
|
|
370
|
-
]
|
|
371
|
-
}, tr = {
|
|
372
|
-
allowsTextContent: !1,
|
|
373
|
-
allowsChildren: !0,
|
|
374
|
-
allowedAttributes: [],
|
|
375
|
-
childTags: [
|
|
376
|
-
"td",
|
|
377
|
-
"th"
|
|
378
|
-
]
|
|
379
|
-
}, th = {
|
|
380
|
-
allowsTextContent: !0,
|
|
381
|
-
allowsChildren: !0,
|
|
382
|
-
allowedAttributes: [
|
|
383
|
-
"scope",
|
|
384
|
-
"colspan",
|
|
385
|
-
"rowspan"
|
|
386
|
-
],
|
|
387
|
-
childTags: []
|
|
388
|
-
}, td = {
|
|
389
|
-
allowsTextContent: !0,
|
|
390
|
-
allowsChildren: !0,
|
|
391
|
-
allowedAttributes: [
|
|
392
|
-
"colspan",
|
|
393
|
-
"rowspan"
|
|
394
|
-
],
|
|
395
|
-
childTags: []
|
|
396
|
-
}, datalist = {
|
|
397
|
-
allowsTextContent: !1,
|
|
398
|
-
allowsChildren: !0,
|
|
399
|
-
allowedAttributes: [],
|
|
400
|
-
childTags: [
|
|
401
|
-
"option"
|
|
402
|
-
]
|
|
403
|
-
}, option = {
|
|
404
|
-
allowsTextContent: !0,
|
|
405
|
-
allowsChildren: !1,
|
|
406
|
-
allowedAttributes: [
|
|
407
|
-
"value",
|
|
408
|
-
"label",
|
|
409
|
-
"selected",
|
|
410
|
-
"disabled"
|
|
411
|
-
]
|
|
412
|
-
}, header = {
|
|
413
|
-
allowsTextContent: !1,
|
|
414
|
-
allowsChildren: !0,
|
|
415
|
-
allowedAttributes: [
|
|
416
|
-
"role"
|
|
417
|
-
],
|
|
418
|
-
childTags: []
|
|
419
|
-
}, a = {
|
|
420
|
-
allowsTextContent: !0,
|
|
421
|
-
allowsChildren: !0,
|
|
422
|
-
allowedAttributes: [
|
|
423
|
-
"href",
|
|
424
|
-
"target",
|
|
425
|
-
"rel",
|
|
426
|
-
"title",
|
|
427
|
-
"download"
|
|
428
|
-
],
|
|
429
|
-
childTags: []
|
|
430
|
-
}, i = {
|
|
431
|
-
allowsTextContent: !0,
|
|
432
|
-
allowsChildren: !0,
|
|
433
|
-
allowedAttributes: [
|
|
434
|
-
"aria-hidden"
|
|
435
|
-
],
|
|
436
|
-
childTags: []
|
|
437
|
-
}, small = {
|
|
438
|
-
allowsTextContent: !0,
|
|
439
|
-
allowsChildren: !0,
|
|
440
|
-
allowedAttributes: [],
|
|
441
|
-
childTags: []
|
|
442
|
-
}, ul = {
|
|
443
|
-
allowsTextContent: !1,
|
|
444
|
-
allowsChildren: !0,
|
|
445
|
-
allowedAttributes: [
|
|
446
|
-
"type"
|
|
447
|
-
],
|
|
448
|
-
childTags: [
|
|
449
|
-
"li"
|
|
450
|
-
]
|
|
451
|
-
}, li = {
|
|
452
|
-
allowsTextContent: !0,
|
|
453
|
-
allowsChildren: !0,
|
|
454
|
-
allowedAttributes: [
|
|
455
|
-
"value"
|
|
456
|
-
],
|
|
457
|
-
childTags: []
|
|
458
|
-
}, hr = {
|
|
459
|
-
allowsTextContent: !1,
|
|
460
|
-
allowsChildren: !1,
|
|
461
|
-
allowedAttributes: []
|
|
462
|
-
}, defaultTags = {
|
|
463
|
-
$schema,
|
|
464
|
-
div,
|
|
465
|
-
input,
|
|
466
|
-
checkbox,
|
|
467
|
-
colgroup,
|
|
468
|
-
col,
|
|
469
|
-
label,
|
|
470
|
-
form,
|
|
471
|
-
select,
|
|
472
|
-
p,
|
|
473
|
-
h1,
|
|
474
|
-
h2,
|
|
475
|
-
span,
|
|
476
|
-
img,
|
|
477
|
-
button,
|
|
478
|
-
table,
|
|
479
|
-
thead,
|
|
480
|
-
tbody,
|
|
481
|
-
tfoot,
|
|
482
|
-
tr,
|
|
483
|
-
th,
|
|
484
|
-
td,
|
|
485
|
-
datalist,
|
|
486
|
-
option,
|
|
487
|
-
header,
|
|
488
|
-
a,
|
|
489
|
-
i,
|
|
490
|
-
small,
|
|
491
|
-
ul,
|
|
492
|
-
li,
|
|
493
|
-
hr
|
|
494
|
-
}, extractTags = ({ inSpec: t }) => {
|
|
495
|
-
const e = t;
|
|
496
|
-
if (!e) return [];
|
|
497
|
-
if (Array.isArray(e))
|
|
498
|
-
return e.flatMap((r) => extractTags({ inSpec: r }));
|
|
499
|
-
if (typeof e != "object") return [];
|
|
500
|
-
const n = [];
|
|
501
|
-
return typeof e.tagName == "string" && e.tagName.trim().length > 0 && n.push(e.tagName.toLowerCase()), Array.isArray(e.children) && e.children.length > 0 && e.children.forEach((r) => {
|
|
502
|
-
const l = extractTags({ inSpec: r });
|
|
503
|
-
n.push(...l);
|
|
504
|
-
}), n;
|
|
505
|
-
}, checkTags = ({ inTagsFound: t, inAllowedTags: e }) => {
|
|
506
|
-
const n = t ?? [], r = e ?? {}, l = new Set(
|
|
507
|
-
Object.keys(r).filter((d) => d !== "$schema").map((d) => d.toLowerCase())
|
|
508
|
-
), o = {}, s = [], c = [];
|
|
509
|
-
n.forEach((d) => {
|
|
510
|
-
o[d] = (o[d] || 0) + 1, l.has(d) ? s.includes(d) || s.push(d) : c.includes(d) || c.push(d);
|
|
511
|
-
});
|
|
512
|
-
const u = n.length, g = c.length === 0;
|
|
513
|
-
return {
|
|
514
|
-
totalTags: u,
|
|
515
|
-
tagCounts: o,
|
|
516
|
-
uniqueTags: Object.keys(o),
|
|
517
|
-
recognizedTags: s,
|
|
518
|
-
unrecognizedTags: c,
|
|
519
|
-
areAllTagsPresent: g
|
|
520
|
-
};
|
|
521
|
-
}, reviewSpec = ({ inSpec: t, inTags: e = defaultTags } = {}) => {
|
|
522
|
-
const n = t, r = e, l = extractTags({ inSpec: n }), o = checkTags({
|
|
523
|
-
inTagsFound: l,
|
|
524
|
-
inAllowedTags: r
|
|
525
|
-
});
|
|
526
|
-
return {
|
|
527
|
-
areAllTagsPresent: o.areAllTagsPresent,
|
|
528
|
-
totalTags: o.totalTags,
|
|
529
|
-
tagCounts: o.tagCounts,
|
|
530
|
-
uniqueTags: o.uniqueTags,
|
|
531
|
-
recognizedTags: o.recognizedTags,
|
|
532
|
-
unrecognizedTags: o.unrecognizedTags
|
|
533
|
-
};
|
|
534
|
-
}, buildSpecElement = (t = {}) => {
|
|
535
|
-
try {
|
|
536
|
-
const e = t, n = (e == null ? void 0 : e.spec) ?? (e == null ? void 0 : e.inSpec) ?? e;
|
|
537
|
-
return dispatchSpec({
|
|
538
|
-
inSpec: n
|
|
539
|
-
});
|
|
540
|
-
} catch (e) {
|
|
541
|
-
throw console.error("error : ", e), e;
|
|
542
|
-
}
|
|
543
|
-
};
|
|
544
|
-
registerGlobal({
|
|
545
|
-
inFuncDefinition: buildSpecElement,
|
|
546
|
-
inReviewSpec: reviewSpec
|
|
547
|
-
});
|
|
548
|
-
const deriveColumnsFromData = ({ inData: t = [] } = {}) => {
|
|
549
|
-
const e = t;
|
|
550
|
-
if (!Array.isArray(e) || e.length === 0)
|
|
551
|
-
return [];
|
|
552
|
-
const n = e[0];
|
|
553
|
-
return !n || typeof n != "object" ? [] : Object.keys(n).map((r) => ({
|
|
554
|
-
key: r,
|
|
555
|
-
label: r
|
|
556
|
-
}));
|
|
557
|
-
}, skeletonJson$2 = {
|
|
558
|
-
default: {
|
|
559
|
-
tagName: "table",
|
|
560
|
-
attributes: {
|
|
561
|
-
class: "table table-hover table-striped mb-0"
|
|
562
|
-
},
|
|
563
|
-
children: [
|
|
564
|
-
{
|
|
565
|
-
tagName: "thead",
|
|
566
|
-
children: [
|
|
567
|
-
{
|
|
568
|
-
tagName: "tr",
|
|
569
|
-
jsonToSpec: {
|
|
570
|
-
operation: "loopCollection",
|
|
571
|
-
source: "columns",
|
|
572
|
-
template: {
|
|
573
|
-
tagName: "th",
|
|
574
|
-
textContent: "${title}"
|
|
575
|
-
}
|
|
576
|
-
},
|
|
577
|
-
children: []
|
|
578
|
-
}
|
|
579
|
-
]
|
|
580
|
-
},
|
|
581
|
-
{
|
|
582
|
-
tagName: "tbody",
|
|
583
|
-
jsonToSpec: {
|
|
584
|
-
operation: "loopCollection",
|
|
585
|
-
source: "data",
|
|
586
|
-
template: {
|
|
587
|
-
tagName: "tr",
|
|
588
|
-
jsonToSpec: {
|
|
589
|
-
operation: "loopObject",
|
|
590
|
-
source: "data",
|
|
591
|
-
template: {
|
|
592
|
-
tagName: "td",
|
|
593
|
-
textContent: "${value}"
|
|
594
|
-
}
|
|
595
|
-
},
|
|
596
|
-
children: []
|
|
597
|
-
}
|
|
598
|
-
},
|
|
599
|
-
children: []
|
|
600
|
-
}
|
|
601
|
-
]
|
|
602
|
-
}
|
|
603
|
-
}, startFunc$b = ({
|
|
604
|
-
targetHtmlId: t,
|
|
605
|
-
inTargetHtmlId: e,
|
|
606
|
-
inColumns: n,
|
|
607
|
-
inData: r
|
|
608
|
-
} = {}) => {
|
|
609
|
-
const l = e ?? t;
|
|
610
|
-
n ?? deriveColumnsFromData({ inData: r ?? [] });
|
|
611
|
-
let s = buildSpecElement$1(skeletonJson$2.default, {
|
|
612
|
-
columns: [{
|
|
613
|
-
title: "Name"
|
|
614
|
-
}],
|
|
615
|
-
data: r
|
|
616
|
-
});
|
|
617
|
-
console.log("specAsJsonToDom : ", s), "tagName" in s || (s = s.children);
|
|
618
|
-
const c = document.getElementById(l);
|
|
619
|
-
c && (c.innerHTML = "");
|
|
620
|
-
const u = buildSpecElement(s);
|
|
621
|
-
c.append(u);
|
|
622
|
-
}, IDENTIFIERS = {
|
|
623
|
-
HARD_CODED: "$",
|
|
624
|
-
PARENT: "^",
|
|
625
|
-
TYPE_START: "(",
|
|
626
|
-
TYPE_END: ")",
|
|
627
|
-
ACTION_START: "{",
|
|
628
|
-
ACTION_END: "}",
|
|
629
|
-
ARRAY_INDEX: "#eq(",
|
|
630
|
-
ARRAY_START: "#eq(",
|
|
631
|
-
ARRAY_END: ")"
|
|
632
|
-
}, VALUES = {
|
|
633
|
-
DEFAULT: void 0
|
|
634
|
-
}, resolvePath = (t, e) => {
|
|
635
|
-
if (t === "")
|
|
636
|
-
return e;
|
|
637
|
-
const r = t.replace(/\[(\w+)\]/g, ". $1".replace(" ", "")).replace(/^\./, "").split(".");
|
|
638
|
-
for (let l = 0; l < r.length; ) {
|
|
639
|
-
if (Array.isArray(e)) {
|
|
640
|
-
const c = r.slice(l).join(".");
|
|
641
|
-
return e.map((u) => resolvePath(c, u));
|
|
642
|
-
}
|
|
643
|
-
if (typeof e != "object" || e === null)
|
|
644
|
-
return VALUES.DEFAULT;
|
|
645
|
-
let o, s = 0;
|
|
646
|
-
for (let c = r.length; c > l; c -= 1) {
|
|
647
|
-
const u = r.slice(l, c).join(".");
|
|
648
|
-
if (Object.prototype.hasOwnProperty.call(e, u)) {
|
|
649
|
-
o = u, s = c - l;
|
|
650
|
-
break;
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
if (o === void 0)
|
|
654
|
-
return VALUES.DEFAULT;
|
|
655
|
-
e = e[o], l += s;
|
|
656
|
-
}
|
|
657
|
-
return e;
|
|
658
|
-
}, isNonEmptyArray = (t) => t && Array.isArray(t) && t.length > 0, isNumber = (t) => !isNaN(t), operators = ["+", "-", "*", "/", "%"], convertToString = (t) => t ? String(t) : "", convertToNumber = (t) => t ? Number(t) : 0, convertToUpperCase = (t) => t ? t.toUpperCase() : "", convertToDate = (t) => {
|
|
659
|
-
if (!t) return t;
|
|
660
|
-
try {
|
|
661
|
-
return new Date(t).getTime();
|
|
662
|
-
} catch {
|
|
663
|
-
return t;
|
|
664
|
-
}
|
|
665
|
-
}, deleteKey = () => {
|
|
666
|
-
}, deleteIfNotPresent = (t) => typeof t > "u" ? void 0 : t, typeToFn = {
|
|
667
|
-
STRING: convertToString,
|
|
668
|
-
NUMBER: convertToNumber,
|
|
669
|
-
DATE: convertToDate,
|
|
670
|
-
UPPER: convertToUpperCase
|
|
671
|
-
}, extractSpecial = (t) => {
|
|
672
|
-
const e = t.indexOf(IDENTIFIERS.TYPE_START) > -1 ? IDENTIFIERS.TYPE_START : t.indexOf(IDENTIFIERS.ACTION_START) > -1 ? IDENTIFIERS.ACTION_START : null;
|
|
673
|
-
if (!e) return null;
|
|
674
|
-
const n = e === IDENTIFIERS.TYPE_START ? IDENTIFIERS.TYPE_END : IDENTIFIERS.ACTION_END;
|
|
675
|
-
return {
|
|
676
|
-
kind: e,
|
|
677
|
-
type: t.substring(t.indexOf(e) + 1, t.lastIndexOf(n)),
|
|
678
|
-
path: t.substring(0, t.indexOf(e))
|
|
679
|
-
};
|
|
680
|
-
}, evaluateExpression = (value, key, source, config) => {
|
|
681
|
-
const resolvedKey = resolvePath(key, source);
|
|
682
|
-
if (!config[resolvedKey]) return resolvedKey;
|
|
683
|
-
const { operator, value: expressionValue } = config[resolvedKey];
|
|
684
|
-
return !operators.includes(operator) || !isNumber(expressionValue) ? resolvedKey : eval(`${value}${operator}${expressionValue}`);
|
|
685
|
-
}, createActionMap = ({ convertValue: t }) => ({
|
|
686
|
-
APPEND: (e, n, r, l) => {
|
|
687
|
-
const o = l == null ? void 0 : l.appendMap;
|
|
688
|
-
if (!o || typeof o[n] > "u") return e;
|
|
689
|
-
const { path: s, separator: c } = o[n];
|
|
690
|
-
return e + (c || "") + t(s, r);
|
|
691
|
-
},
|
|
692
|
-
DELETE: deleteKey,
|
|
693
|
-
DELETE_IF_NOT_PRESENT: deleteIfNotPresent,
|
|
694
|
-
DEPENDS: (e, n, r, l) => {
|
|
695
|
-
if (typeof n > "u") return l.dependentMap[e];
|
|
696
|
-
const o = extractSpecial(n);
|
|
697
|
-
return o && actionMap[o.type] ? actionMap[o.type](e, o.path, r, l) : n;
|
|
698
|
-
},
|
|
699
|
-
EVAL: evaluateExpression
|
|
700
|
-
});
|
|
701
|
-
let actionMap = {};
|
|
702
|
-
const convertType = (t, e) => typeToFn[t] ? typeToFn[t](e) : e, performAction = (t, e, n, r, l, o) => {
|
|
703
|
-
actionMap = createActionMap({ convertValue: o });
|
|
704
|
-
const s = extractSpecial(t);
|
|
705
|
-
return s && actionMap[s.type] ? actionMap[s.type](e, s.path, r, l) : actionMap[t] ? actionMap[t](e, void 0, r, l) : e;
|
|
706
|
-
}, resolveValue = (t, e, n, r) => {
|
|
707
|
-
if (t.startsWith(IDENTIFIERS.HARD_CODED))
|
|
708
|
-
return t.substring(1);
|
|
709
|
-
if (t.startsWith(IDENTIFIERS.PARENT))
|
|
710
|
-
return resolvePath(t.substring(1), n);
|
|
711
|
-
const l = extractSpecial(t);
|
|
712
|
-
if (!l)
|
|
713
|
-
return resolvePath(t, e);
|
|
714
|
-
const o = resolvePath(l.path, e);
|
|
715
|
-
return typeof o > "u" ? VALUES.DEFAULT : l.kind === IDENTIFIERS.TYPE_START ? convertType(l.type, o) : performAction(
|
|
716
|
-
l.type,
|
|
717
|
-
o,
|
|
718
|
-
l.path,
|
|
719
|
-
e,
|
|
720
|
-
r,
|
|
721
|
-
(s, c) => resolveValue(s, c, n, r)
|
|
722
|
-
);
|
|
723
|
-
}, startFunc$a = (t, e, n) => {
|
|
724
|
-
const r = {};
|
|
725
|
-
return Object.keys(t).forEach((l) => {
|
|
726
|
-
const o = t[l];
|
|
727
|
-
if (typeof o == "string") {
|
|
728
|
-
r[l] = resolveValue(
|
|
729
|
-
o,
|
|
730
|
-
e,
|
|
731
|
-
n.rootSource,
|
|
732
|
-
n.configuration
|
|
733
|
-
);
|
|
734
|
-
return;
|
|
735
|
-
}
|
|
736
|
-
if (Array.isArray(o) && o.length > 0) {
|
|
737
|
-
r[l] = startFunc$3(o[0], e, n);
|
|
738
|
-
return;
|
|
739
|
-
}
|
|
740
|
-
o && typeof o == "object" && (r[l] = traverse(o, e, n));
|
|
741
|
-
}), r;
|
|
742
|
-
}, startFunc$9 = (t, e, n) => {
|
|
743
|
-
const r = [];
|
|
744
|
-
return t.forEach((l) => {
|
|
745
|
-
if (typeof l == "string") {
|
|
746
|
-
const o = resolveValue(
|
|
747
|
-
l,
|
|
748
|
-
e,
|
|
749
|
-
n.rootSource,
|
|
750
|
-
n.configuration
|
|
751
|
-
);
|
|
752
|
-
isNonEmptyArray(o) ? r.push(...o) : r.push(o);
|
|
753
|
-
return;
|
|
754
|
-
}
|
|
755
|
-
if (Array.isArray(l)) {
|
|
756
|
-
r.push(
|
|
757
|
-
...startFunc$9(
|
|
758
|
-
l[0],
|
|
759
|
-
e,
|
|
760
|
-
n
|
|
761
|
-
)
|
|
762
|
-
);
|
|
763
|
-
return;
|
|
764
|
-
}
|
|
765
|
-
l && typeof l == "object" && r.push(
|
|
766
|
-
startFunc$a(
|
|
767
|
-
l,
|
|
768
|
-
e,
|
|
769
|
-
n
|
|
770
|
-
)
|
|
771
|
-
);
|
|
772
|
-
}), r;
|
|
773
|
-
}, startFunc$8 = (t, e, n) => [
|
|
774
|
-
startFunc$a(
|
|
775
|
-
e,
|
|
776
|
-
t,
|
|
777
|
-
n
|
|
778
|
-
)
|
|
779
|
-
], startFunc$7 = (t, e, n) => t.map((r) => startFunc$a(
|
|
780
|
-
e,
|
|
781
|
-
r,
|
|
782
|
-
n
|
|
783
|
-
));
|
|
784
|
-
function isPlainObject(t) {
|
|
785
|
-
return t !== null && typeof t == "object" && Object.getPrototypeOf(t) === Object.prototype;
|
|
786
|
-
}
|
|
787
|
-
const startFunc$6 = (t, e, n) => Array.isArray(t) ? startFunc$7(
|
|
788
|
-
t,
|
|
789
|
-
e,
|
|
790
|
-
n
|
|
791
|
-
) : isPlainObject(t) ? startFunc$8(
|
|
792
|
-
t,
|
|
793
|
-
e,
|
|
794
|
-
n
|
|
795
|
-
) : [], isArrayIndexMapping = (t) => {
|
|
796
|
-
const e = t.list;
|
|
797
|
-
return e.startsWith(IDENTIFIERS.ARRAY_INDEX) && e.includes(IDENTIFIERS.ARRAY_START) && e.includes(IDENTIFIERS.ARRAY_END);
|
|
798
|
-
}, getItemMapping$1 = (t) => Array.isArray(t.item) ? t.item[0] : t.item, resolveListSource = (t, e) => resolvePath(
|
|
799
|
-
t.list,
|
|
800
|
-
e
|
|
801
|
-
), startFunc$5 = (t, e, n) => {
|
|
802
|
-
const r = getItemMapping$1(t);
|
|
803
|
-
if (isArrayIndexMapping(t))
|
|
804
|
-
return [
|
|
805
|
-
startFunc$a(
|
|
806
|
-
r,
|
|
807
|
-
e,
|
|
808
|
-
n
|
|
809
|
-
)
|
|
810
|
-
];
|
|
811
|
-
const l = resolveListSource(
|
|
812
|
-
t,
|
|
813
|
-
e
|
|
814
|
-
);
|
|
815
|
-
return startFunc$6(
|
|
816
|
-
l,
|
|
817
|
-
r,
|
|
818
|
-
n
|
|
819
|
-
);
|
|
820
|
-
}, getItemMapping = (t) => Array.isArray(t.item) ? t.item[0] : t.item, resolveObjectifySource = (t, e) => resolvePath(
|
|
821
|
-
t.objectify,
|
|
822
|
-
e
|
|
823
|
-
), startFunc$4 = (t, e, n) => {
|
|
824
|
-
const r = resolveObjectifySource(
|
|
825
|
-
t,
|
|
826
|
-
e
|
|
827
|
-
);
|
|
828
|
-
return startFunc$8(
|
|
829
|
-
r,
|
|
830
|
-
getItemMapping(t),
|
|
831
|
-
n
|
|
832
|
-
);
|
|
833
|
-
}, startFunc$3 = (t, e, n) => typeof t.collect < "u" ? startFunc$9(
|
|
834
|
-
t.item,
|
|
835
|
-
e,
|
|
836
|
-
n
|
|
837
|
-
) : typeof t.list < "u" ? startFunc$5(
|
|
838
|
-
t,
|
|
839
|
-
e,
|
|
840
|
-
n
|
|
841
|
-
) : typeof t.objectify < "u" ? startFunc$4(
|
|
842
|
-
t,
|
|
843
|
-
e,
|
|
844
|
-
n
|
|
845
|
-
) : [], startFunc$2 = (t, e) => {
|
|
846
|
-
if (!t.includes(IDENTIFIERS.ARRAY_INDEX)) return {};
|
|
847
|
-
const n = t.lastIndexOf(IDENTIFIERS.ARRAY_INDEX) + 4, r = t.lastIndexOf(IDENTIFIERS.ARRAY_END), l = t.substring(n, r), o = t.substring(0, t.lastIndexOf(IDENTIFIERS.ARRAY_INDEX)), s = o ? resolvePath(o, e) : e;
|
|
848
|
-
return s == null ? void 0 : s[l];
|
|
849
|
-
}, traverse = (t, e, n) => {
|
|
850
|
-
if (typeof t.list < "u" || typeof t.objectify < "u" || typeof t.collect < "u")
|
|
851
|
-
return startFunc$3(t, e, n);
|
|
852
|
-
if (typeof t.flat < "u") {
|
|
853
|
-
const r = startFunc$2(t.flat, e);
|
|
854
|
-
return startFunc$a(t.item, r, n);
|
|
855
|
-
}
|
|
856
|
-
return typeof t.item < "u" ? startFunc$a(t.item, e, n) : startFunc$a(t, e, n);
|
|
857
|
-
}, transform = (t, e) => {
|
|
858
|
-
let n = t, r = e;
|
|
859
|
-
t !== null && typeof t == "object" && "inData" in t && e === void 0 && (n = t.inData, r = t.inTransformation);
|
|
860
|
-
const { mapping: l, config: o = {} } = r;
|
|
861
|
-
return traverse(l, n, {
|
|
862
|
-
rootSource: n,
|
|
863
|
-
configuration: o
|
|
864
|
-
});
|
|
865
|
-
}, transformHelper = { transform }, old = {
|
|
866
|
-
tagName: "datalist",
|
|
867
|
-
attributes: {
|
|
868
|
-
id: "LedgerName"
|
|
869
|
-
},
|
|
870
|
-
jsonToSpec: {
|
|
871
|
-
operation: "loopArray",
|
|
872
|
-
source: "LedgerName",
|
|
873
|
-
template: {
|
|
874
|
-
tagName: "option",
|
|
875
|
-
attributes: {
|
|
876
|
-
value: "${}"
|
|
877
|
-
},
|
|
878
|
-
textContent: "${}"
|
|
879
|
-
}
|
|
880
|
-
},
|
|
881
|
-
children: []
|
|
882
|
-
}, skeletonJson$1 = {
|
|
883
|
-
old,
|
|
884
|
-
default: {
|
|
885
|
-
mapping: {
|
|
886
|
-
tagName: "$datalist",
|
|
887
|
-
attributes: {
|
|
888
|
-
id: "$LedgerName"
|
|
889
|
-
},
|
|
890
|
-
children: {
|
|
891
|
-
list: "LedgerName",
|
|
892
|
-
item: {
|
|
893
|
-
tagName: "$option",
|
|
894
|
-
attributes: {
|
|
895
|
-
value: ""
|
|
896
|
-
},
|
|
897
|
-
textContent: ""
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
}, startFunc$1 = ({ targetHtmlId: t, inData: e, inSkeletonType: n = "default" } = {}) => {
|
|
903
|
-
const r = skeletonJson$1[n], l = transformHelper.transform(e, r), o = document.getElementById(t);
|
|
904
|
-
o && (o.innerHTML = "");
|
|
905
|
-
const s = buildSpecElement(l);
|
|
906
|
-
Array.isArray(s) ? s.forEach((c) => o.append(c)) : o.append(s);
|
|
907
|
-
}, skeletonJson = {
|
|
908
|
-
default: {
|
|
909
|
-
mapping: {
|
|
910
|
-
tagName: "$select",
|
|
911
|
-
attributes: {
|
|
912
|
-
id: "$LedgerName",
|
|
913
|
-
class: "$keshav"
|
|
914
|
-
},
|
|
915
|
-
children: [
|
|
916
|
-
{
|
|
917
|
-
list: "LedgerName",
|
|
918
|
-
item: {
|
|
919
|
-
tagName: "$option",
|
|
920
|
-
attributes: {
|
|
921
|
-
value: ""
|
|
922
|
-
},
|
|
923
|
-
textContent: ""
|
|
924
|
-
}
|
|
925
|
-
}
|
|
926
|
-
]
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
}, startFunc = ({
|
|
930
|
-
targetHtmlId: t,
|
|
931
|
-
inData: e,
|
|
932
|
-
inSkeletonType: n = "default",
|
|
933
|
-
inClassToApply: r
|
|
934
|
-
} = {}) => {
|
|
935
|
-
console.log("aaaaaaaaaa");
|
|
936
|
-
const l = skeletonJson[n];
|
|
937
|
-
l.mapping.attributes.class = `$${r}`;
|
|
938
|
-
debugger;
|
|
939
|
-
const o = transformHelper.transform(e, l), s = document.getElementById(t);
|
|
940
|
-
s && (s.innerHTML = "");
|
|
941
|
-
const c = buildSpecElement(o);
|
|
942
|
-
Array.isArray(c) ? c.forEach((u) => s.append(u)) : s.append(c);
|
|
943
|
-
}, RENDERER_MAP = {
|
|
944
|
-
table: startFunc$b,
|
|
945
|
-
datalist: startFunc$1,
|
|
946
|
-
select: startFunc
|
|
947
|
-
}, render = ({
|
|
948
|
-
type: t = "table",
|
|
949
|
-
targetHtmlId: e,
|
|
950
|
-
data: n,
|
|
951
|
-
classToApply: r,
|
|
952
|
-
inTargetHtmlId: l,
|
|
953
|
-
inData: o,
|
|
954
|
-
columns: s,
|
|
955
|
-
inColumns: c,
|
|
956
|
-
fields: u,
|
|
957
|
-
inFields: g,
|
|
958
|
-
tabs: d,
|
|
959
|
-
inTabs: C,
|
|
960
|
-
options: M,
|
|
961
|
-
inOptions: P,
|
|
962
|
-
datalistId: _,
|
|
963
|
-
inDatalistId: Y,
|
|
964
|
-
listId: U,
|
|
965
|
-
inListId: H,
|
|
966
|
-
id: B,
|
|
967
|
-
valueField: z,
|
|
968
|
-
inValueField: V,
|
|
969
|
-
labelField: q,
|
|
970
|
-
inLabelField: G,
|
|
971
|
-
colGroup: N,
|
|
972
|
-
inColGroup: S,
|
|
973
|
-
footerData: $,
|
|
974
|
-
inFooterData: I,
|
|
975
|
-
config: v,
|
|
976
|
-
inConfig: F,
|
|
977
|
-
variant: R,
|
|
978
|
-
skeletonType: D,
|
|
979
|
-
inSkeletonType: x,
|
|
980
|
-
showLog: j = !1,
|
|
981
|
-
inShowLog: L,
|
|
982
|
-
...f
|
|
983
|
-
} = {}) => {
|
|
984
|
-
const w = t, h = typeof w == "string" ? w.toLowerCase() : "table", b = RENDERER_MAP[h];
|
|
985
|
-
if (!b)
|
|
986
|
-
return console.error(
|
|
987
|
-
`[Renderer] Unknown renderer type "${w}". Available types: ${Object.keys(RENDERER_MAP).join(", ")}`
|
|
988
|
-
), null;
|
|
989
|
-
const T = l ?? e, y = o ?? n, E = c ?? s, O = g ?? u, k = C ?? d, m = x ?? D ?? R ?? "default", A = L ?? j ?? !1;
|
|
990
|
-
return b(h === "form" ? {
|
|
991
|
-
targetHtmlId: T,
|
|
992
|
-
inFields: O,
|
|
993
|
-
inData: y,
|
|
994
|
-
inColumns: E,
|
|
995
|
-
inVariant: m,
|
|
996
|
-
inSkeletonType: m,
|
|
997
|
-
inShowLog: A,
|
|
998
|
-
onSave: f == null ? void 0 : f.onSave,
|
|
999
|
-
afterSave: f == null ? void 0 : f.afterSave,
|
|
1000
|
-
onNew: f == null ? void 0 : f.onNew
|
|
1001
|
-
} : h === "navtabs" || h === "nav" || h === "tabs" ? {
|
|
1002
|
-
targetHtmlId: T,
|
|
1003
|
-
inTabs: k,
|
|
1004
|
-
inData: y,
|
|
1005
|
-
inSkeletonType: m,
|
|
1006
|
-
inShowLog: A
|
|
1007
|
-
} : h === "datalist" || h === "data-list" ? {
|
|
1008
|
-
targetHtmlId: T,
|
|
1009
|
-
inData: y,
|
|
1010
|
-
inSkeletonType: m,
|
|
1011
|
-
inShowLog: A
|
|
1012
|
-
} : h === "select" ? {
|
|
1013
|
-
targetHtmlId: T,
|
|
1014
|
-
inData: y,
|
|
1015
|
-
inSkeletonType: m,
|
|
1016
|
-
inShowLog: A,
|
|
1017
|
-
inClassToApply: r
|
|
1018
|
-
} : {
|
|
1019
|
-
targetHtmlId: T,
|
|
1020
|
-
inColumns: E,
|
|
1021
|
-
inData: y,
|
|
1022
|
-
inColGroup: S ?? N,
|
|
1023
|
-
inFooterData: I ?? $ ?? [],
|
|
1024
|
-
inConfig: F ?? v ?? {},
|
|
1025
|
-
inSkeletonType: m,
|
|
1026
|
-
inShowLog: A
|
|
1027
|
-
});
|
|
1028
|
-
};
|
|
1029
|
-
registerGlobal$2(render);
|
|
1030
|
-
export {
|
|
1031
|
-
render as default
|
|
1032
|
-
};
|
|
1
|
+
const meta$2 = {
|
|
2
|
+
version: "v4.0.0",
|
|
3
|
+
description: "build table from store data and render to DOM uses json-to-spec, json-to-dom under the hood"
|
|
4
|
+
}, registerGlobal$2 = (t) => {
|
|
5
|
+
var e;
|
|
6
|
+
typeof globalThis > "u" || !t || (globalThis.ks ?? (globalThis.ks = {}), (e = globalThis.ks).jsonRenderers ?? (e.jsonRenderers = {
|
|
7
|
+
meta: meta$2,
|
|
8
|
+
renderToDom: t
|
|
9
|
+
}));
|
|
10
|
+
}, meta$1 = {
|
|
11
|
+
version: "v32",
|
|
12
|
+
description: "JSON-to-DOM engine with centralized traversal and responsibility-focused construction"
|
|
13
|
+
}, registerGlobal$1 = ({ inFuncDefinition: t } = {}) => {
|
|
14
|
+
if (typeof globalThis > "u" || !t) return;
|
|
15
|
+
globalThis.ks ?? (globalThis.ks = {});
|
|
16
|
+
const e = {
|
|
17
|
+
meta: meta$1,
|
|
18
|
+
buildSpecElement: t
|
|
19
|
+
};
|
|
20
|
+
globalThis.ks["json-to-tag"] = e, globalThis.ks.jsonToTag = e;
|
|
21
|
+
}, resolveChild = (t, e) => traverse$1(t, e), traverseArray = (t, e) => Array.isArray(t) ? t.map((n) => resolveChild(n, e)).flat(1 / 0).filter(Boolean) : [], startFunc$i = (t, e) => {
|
|
22
|
+
if ("source" in t && (t == null ? void 0 : t.source) in e) {
|
|
23
|
+
const n = e[t == null ? void 0 : t.source];
|
|
24
|
+
if (Array.isArray(n))
|
|
25
|
+
return n.map((l) => {
|
|
26
|
+
const o = t == null ? void 0 : t.template;
|
|
27
|
+
if (o)
|
|
28
|
+
return traverse$1(o, l);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}, startFunc$h = (t, e) => {
|
|
32
|
+
let n = [];
|
|
33
|
+
for (const [r, l] of Object.entries(e)) {
|
|
34
|
+
const o = t == null ? void 0 : t.template;
|
|
35
|
+
if (o) {
|
|
36
|
+
const s = traverse$1(o, {
|
|
37
|
+
key: r,
|
|
38
|
+
value: l
|
|
39
|
+
});
|
|
40
|
+
n.push(s);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return n;
|
|
44
|
+
}, startFunc$g = (t, e) => {
|
|
45
|
+
if ("source" in t && (t == null ? void 0 : t.source) in e) {
|
|
46
|
+
const n = e[t == null ? void 0 : t.source];
|
|
47
|
+
if (Array.isArray(n))
|
|
48
|
+
return n.map((l) => {
|
|
49
|
+
const o = t == null ? void 0 : t.template;
|
|
50
|
+
if (o)
|
|
51
|
+
return traverse$1(o, l);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}, startFunc$f = (t, e) => {
|
|
55
|
+
if ("operation" in t) {
|
|
56
|
+
if (t.operation === "loopArray")
|
|
57
|
+
return startFunc$i(t, e);
|
|
58
|
+
if (t.operation === "loopObject")
|
|
59
|
+
return startFunc$h(t, e);
|
|
60
|
+
if (t.operation === "loopCollection")
|
|
61
|
+
return startFunc$g(t, e);
|
|
62
|
+
}
|
|
63
|
+
}, startFunc$e = (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 n = t.match(/^\$\{(.+?)\}$/);
|
|
69
|
+
if (n) {
|
|
70
|
+
const r = n[1];
|
|
71
|
+
return (e == null ? void 0 : e[r]) ?? "";
|
|
72
|
+
}
|
|
73
|
+
return t;
|
|
74
|
+
}, startFunc$d = (t, e) => {
|
|
75
|
+
let n = {};
|
|
76
|
+
for (const [r, l] of Object.entries(t)) {
|
|
77
|
+
const o = startFunc$e(l, e);
|
|
78
|
+
n[r] = o;
|
|
79
|
+
}
|
|
80
|
+
return n;
|
|
81
|
+
}, startFunc$c = (t, e) => {
|
|
82
|
+
if ("tagName" in t) {
|
|
83
|
+
if ("textContent" in t) {
|
|
84
|
+
const n = startFunc$e(t.textContent, e);
|
|
85
|
+
t.textContent = n;
|
|
86
|
+
}
|
|
87
|
+
if ("attributes" in t) {
|
|
88
|
+
const n = startFunc$d(t.attributes, e);
|
|
89
|
+
t.attributes = n;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}, traverseObject = (t, e) => {
|
|
93
|
+
if (!t || typeof t != "object" || Array.isArray(t)) return null;
|
|
94
|
+
const n = structuredClone(t);
|
|
95
|
+
if (!n) return null;
|
|
96
|
+
if ("tagName" in n && startFunc$c(n, e), "jsonToSpec" in n) {
|
|
97
|
+
const r = n == null ? void 0 : n.jsonToSpec, l = startFunc$f(r, e);
|
|
98
|
+
Array.isArray(l) ? n.children = l : n.children = [l], delete n.jsonToSpec;
|
|
99
|
+
}
|
|
100
|
+
if (Array.isArray(n == null ? void 0 : n.children)) {
|
|
101
|
+
const r = traverseArray(n == null ? void 0 : n.children, e);
|
|
102
|
+
n.children = r;
|
|
103
|
+
}
|
|
104
|
+
return n;
|
|
105
|
+
}, traverse$1 = (t, e) => {
|
|
106
|
+
if (t == null) return null;
|
|
107
|
+
debugger;
|
|
108
|
+
return typeof Node < "u" && t instanceof Node ? t : Array.isArray(t) ? traverseArray(t, e) : typeof t == "object" ? traverseObject(t, e) : typeof t == "string" || typeof t == "number" ? document.createTextNode(String(t)) : t;
|
|
109
|
+
}, buildSpecElement$1 = (t, e) => traverse$1(t, e);
|
|
110
|
+
registerGlobal$1({
|
|
111
|
+
inFuncDefinition: buildSpecElement$1
|
|
112
|
+
});
|
|
113
|
+
const meta = {
|
|
114
|
+
version: "v3.0",
|
|
115
|
+
description: "Pure DOM engine with JSON review and tags.json catalog verification"
|
|
116
|
+
}, registerGlobal = (t) => {
|
|
117
|
+
const e = t, n = typeof e == "function" ? e : e == null ? void 0 : e.inFuncDefinition, r = e == null ? void 0 : e.inReviewSpec;
|
|
118
|
+
typeof globalThis > "u" || !n || (globalThis.ks ?? (globalThis.ks = {}), globalThis.ks["json-to-tag"] = {
|
|
119
|
+
meta,
|
|
120
|
+
buildSpecElement: n,
|
|
121
|
+
reviewSpec: r
|
|
122
|
+
}, globalThis.ks.jsonToTag = {
|
|
123
|
+
meta,
|
|
124
|
+
buildSpecElement: n,
|
|
125
|
+
reviewSpec: r
|
|
126
|
+
});
|
|
127
|
+
}, isNullOrUndefined = ({ inSpec: t }) => {
|
|
128
|
+
const e = t;
|
|
129
|
+
return e == null;
|
|
130
|
+
}, isDomNode = ({ inSpec: t }) => typeof Node < "u" && t instanceof Node, isSpecArray = ({ inSpec: t }) => {
|
|
131
|
+
const e = t;
|
|
132
|
+
return Array.isArray(e);
|
|
133
|
+
}, buildSpecArray = ({ inSpec: t, inShowLog: e = !1 }) => {
|
|
134
|
+
const n = t, r = e;
|
|
135
|
+
return Array.isArray(n) ? n.map((l) => dispatchSpec({
|
|
136
|
+
inSpec: l,
|
|
137
|
+
inShowLog: r
|
|
138
|
+
})).flat().filter(Boolean) : [];
|
|
139
|
+
}, createElement = ({ inTagName: t }) => {
|
|
140
|
+
const e = t == null ? void 0 : t.toLowerCase();
|
|
141
|
+
if (!e) return null;
|
|
142
|
+
if (e === "checkbox") {
|
|
143
|
+
const n = document.createElement("input");
|
|
144
|
+
return n.type = "checkbox", n;
|
|
145
|
+
}
|
|
146
|
+
return document.createElement(e);
|
|
147
|
+
}, applyTextContent = ({ inElement: t, inTextContent: e, inAllowsTextContent: n = !0, inTagName: r, inShowLog: l = !1 }) => {
|
|
148
|
+
const o = t, s = e, c = n, u = r, g = l;
|
|
149
|
+
return !o || s === void 0 || s === null ? o : c ? (o.textContent = s, o) : (g && console.warn(`[json-to-tag v3] textContent is not allowed on <${u}>; discarded "${s}"`), o);
|
|
150
|
+
}, applyProperties = ({ inElement: t, inProperties: e }) => {
|
|
151
|
+
const n = t, r = e;
|
|
152
|
+
return n && r && typeof r == "object" && Object.assign(n, r), n;
|
|
153
|
+
}, applyAttributes = ({ inElement: t, inAttributes: e }) => {
|
|
154
|
+
const n = t, r = e;
|
|
155
|
+
return !n || !r || typeof r != "object" || Object.entries(r).forEach(([l, o]) => {
|
|
156
|
+
l === "class" ? n.className = o : typeof o == "boolean" ? o ? n.setAttribute(l, "") : n.removeAttribute(l) : o != null && n.setAttribute(l, String(o));
|
|
157
|
+
}), n;
|
|
158
|
+
}, applyClassList = ({ inElement: t, inClassList: e }) => {
|
|
159
|
+
const n = t, r = e;
|
|
160
|
+
if (!n || !r) return n;
|
|
161
|
+
let l = [];
|
|
162
|
+
return typeof r == "string" ? l = r.split(/\s+/).filter(Boolean) : Array.isArray(r) && (l = r.filter((o) => typeof o == "string" && o.trim().length > 0)), l.length > 0 && n.classList.add(...l), n;
|
|
163
|
+
}, appendChildren = ({ inElement: t, inChildren: e, inAllowsChildren: n = !0, inTagName: r, inShowLog: l = !1 }) => {
|
|
164
|
+
const o = t, s = e, c = n, u = r, g = l;
|
|
165
|
+
return !o || !Array.isArray(s) || s.length === 0 ? o : c ? (s.forEach((d) => {
|
|
166
|
+
typeof Node < "u" && d instanceof Node ? o.appendChild(d) : (typeof d == "string" || typeof d == "number") && o.appendChild(document.createTextNode(String(d)));
|
|
167
|
+
}), o) : (g && console.warn(`[json-to-tag v3] Children are not allowed on void tag <${u}>; discarded ${s.length} child nodes.`), o);
|
|
168
|
+
}, domElementBuilder = ({ inSpec: t, inClassList: e }) => {
|
|
169
|
+
const n = t, r = e || (n == null ? void 0 : n.classList);
|
|
170
|
+
if (!n || !n.tagName) return null;
|
|
171
|
+
const l = createElement({ inTagName: n.tagName });
|
|
172
|
+
return l ? (applyTextContent({
|
|
173
|
+
inElement: l,
|
|
174
|
+
inTextContent: n.textContent,
|
|
175
|
+
inTagName: n.tagName
|
|
176
|
+
}), applyProperties({
|
|
177
|
+
inElement: l,
|
|
178
|
+
inProperties: n.properties
|
|
179
|
+
}), applyAttributes({
|
|
180
|
+
inElement: l,
|
|
181
|
+
inAttributes: n.attributes
|
|
182
|
+
}), applyClassList({
|
|
183
|
+
inElement: l,
|
|
184
|
+
inClassList: r
|
|
185
|
+
}), appendChildren({
|
|
186
|
+
inElement: l,
|
|
187
|
+
inChildren: n.children,
|
|
188
|
+
inTagName: n.tagName
|
|
189
|
+
}), l) : null;
|
|
190
|
+
}, buildChildrenNodes = ({ inChildren: t, inShowLog: e = !1 }) => {
|
|
191
|
+
const n = t, r = e;
|
|
192
|
+
return Array.isArray(n) ? n.map((o) => dispatchSpec({
|
|
193
|
+
inSpec: o,
|
|
194
|
+
inShowLog: r
|
|
195
|
+
})).flat().filter(Boolean) : [];
|
|
196
|
+
}, buildSingleElement = ({ inSpec: t, inShowLog: e = !1 }) => {
|
|
197
|
+
const n = t, r = e, l = domElementBuilder({ inSpec: n });
|
|
198
|
+
let o = [];
|
|
199
|
+
return "children" in n && (o = Array.isArray(n.children) && n.children.length > 0 ? buildChildrenNodes({
|
|
200
|
+
inChildren: n.children,
|
|
201
|
+
inShowLog: r
|
|
202
|
+
}) : [], l.append(...o)), l;
|
|
203
|
+
}, dispatchSpec = ({ inSpec: t, inShowLog: e = !1 } = {}) => {
|
|
204
|
+
const n = t, r = e;
|
|
205
|
+
return isNullOrUndefined({ inSpec: n }) ? null : isDomNode({ inSpec: n }) ? n : isSpecArray({ inSpec: n }) ? buildSpecArray({
|
|
206
|
+
inSpec: n,
|
|
207
|
+
inShowLog: r
|
|
208
|
+
}) : buildSingleElement({
|
|
209
|
+
inSpec: n,
|
|
210
|
+
inShowLog: r
|
|
211
|
+
});
|
|
212
|
+
}, $schema = "./tags.schema.json", div = {
|
|
213
|
+
allowsTextContent: !1,
|
|
214
|
+
allowsChildren: !0,
|
|
215
|
+
allowedAttributes: [
|
|
216
|
+
"title",
|
|
217
|
+
"role"
|
|
218
|
+
],
|
|
219
|
+
childTags: []
|
|
220
|
+
}, input = {
|
|
221
|
+
allowsTextContent: !1,
|
|
222
|
+
allowsChildren: !1,
|
|
223
|
+
allowedAttributes: [
|
|
224
|
+
"type",
|
|
225
|
+
"placeholder",
|
|
226
|
+
"value",
|
|
227
|
+
"name",
|
|
228
|
+
"disabled",
|
|
229
|
+
"readonly",
|
|
230
|
+
"required",
|
|
231
|
+
"list"
|
|
232
|
+
]
|
|
233
|
+
}, checkbox = {
|
|
234
|
+
allowsTextContent: !1,
|
|
235
|
+
allowsChildren: !1,
|
|
236
|
+
allowedAttributes: [
|
|
237
|
+
"type",
|
|
238
|
+
"checked",
|
|
239
|
+
"name",
|
|
240
|
+
"value",
|
|
241
|
+
"disabled",
|
|
242
|
+
"required"
|
|
243
|
+
]
|
|
244
|
+
}, colgroup = {
|
|
245
|
+
allowsTextContent: !1,
|
|
246
|
+
allowsChildren: !0,
|
|
247
|
+
allowedAttributes: [
|
|
248
|
+
"span"
|
|
249
|
+
],
|
|
250
|
+
childTags: [
|
|
251
|
+
"col"
|
|
252
|
+
]
|
|
253
|
+
}, col = {
|
|
254
|
+
allowsTextContent: !1,
|
|
255
|
+
allowsChildren: !1,
|
|
256
|
+
allowedAttributes: [
|
|
257
|
+
"span",
|
|
258
|
+
"style",
|
|
259
|
+
"width"
|
|
260
|
+
]
|
|
261
|
+
}, label = {
|
|
262
|
+
allowsTextContent: !0,
|
|
263
|
+
allowsChildren: !0,
|
|
264
|
+
allowedAttributes: [
|
|
265
|
+
"for"
|
|
266
|
+
],
|
|
267
|
+
childTags: []
|
|
268
|
+
}, form = {
|
|
269
|
+
allowsTextContent: !1,
|
|
270
|
+
allowsChildren: !0,
|
|
271
|
+
allowedAttributes: [
|
|
272
|
+
"action",
|
|
273
|
+
"method",
|
|
274
|
+
"autocomplete",
|
|
275
|
+
"enctype",
|
|
276
|
+
"name",
|
|
277
|
+
"novalidate",
|
|
278
|
+
"target"
|
|
279
|
+
],
|
|
280
|
+
childTags: []
|
|
281
|
+
}, select = {
|
|
282
|
+
allowsTextContent: !1,
|
|
283
|
+
allowsChildren: !0,
|
|
284
|
+
allowedAttributes: [
|
|
285
|
+
"name",
|
|
286
|
+
"disabled",
|
|
287
|
+
"required",
|
|
288
|
+
"multiple",
|
|
289
|
+
"size"
|
|
290
|
+
],
|
|
291
|
+
childTags: [
|
|
292
|
+
"option"
|
|
293
|
+
]
|
|
294
|
+
}, p = {
|
|
295
|
+
allowsTextContent: !0,
|
|
296
|
+
allowsChildren: !0,
|
|
297
|
+
allowedAttributes: [],
|
|
298
|
+
childTags: []
|
|
299
|
+
}, h1 = {
|
|
300
|
+
allowsTextContent: !0,
|
|
301
|
+
allowsChildren: !0,
|
|
302
|
+
allowedAttributes: [],
|
|
303
|
+
childTags: []
|
|
304
|
+
}, h2 = {
|
|
305
|
+
allowsTextContent: !0,
|
|
306
|
+
allowsChildren: !0,
|
|
307
|
+
allowedAttributes: [],
|
|
308
|
+
childTags: []
|
|
309
|
+
}, span = {
|
|
310
|
+
allowsTextContent: !0,
|
|
311
|
+
allowsChildren: !0,
|
|
312
|
+
allowedAttributes: [],
|
|
313
|
+
childTags: []
|
|
314
|
+
}, img = {
|
|
315
|
+
allowsTextContent: !1,
|
|
316
|
+
allowsChildren: !1,
|
|
317
|
+
allowedAttributes: [
|
|
318
|
+
"src",
|
|
319
|
+
"alt",
|
|
320
|
+
"width",
|
|
321
|
+
"height",
|
|
322
|
+
"loading"
|
|
323
|
+
]
|
|
324
|
+
}, button = {
|
|
325
|
+
allowsTextContent: !0,
|
|
326
|
+
allowsChildren: !0,
|
|
327
|
+
allowedAttributes: [
|
|
328
|
+
"type",
|
|
329
|
+
"disabled",
|
|
330
|
+
"name",
|
|
331
|
+
"value"
|
|
332
|
+
],
|
|
333
|
+
childTags: []
|
|
334
|
+
}, table = {
|
|
335
|
+
allowsTextContent: !1,
|
|
336
|
+
allowsChildren: !0,
|
|
337
|
+
allowedAttributes: [
|
|
338
|
+
"border",
|
|
339
|
+
"cellpadding",
|
|
340
|
+
"cellspacing"
|
|
341
|
+
],
|
|
342
|
+
childTags: [
|
|
343
|
+
"caption",
|
|
344
|
+
"colgroup",
|
|
345
|
+
"thead",
|
|
346
|
+
"tbody",
|
|
347
|
+
"tfoot",
|
|
348
|
+
"tr"
|
|
349
|
+
]
|
|
350
|
+
}, thead = {
|
|
351
|
+
allowsTextContent: !1,
|
|
352
|
+
allowsChildren: !0,
|
|
353
|
+
allowedAttributes: [],
|
|
354
|
+
childTags: [
|
|
355
|
+
"tr"
|
|
356
|
+
]
|
|
357
|
+
}, tbody = {
|
|
358
|
+
allowsTextContent: !1,
|
|
359
|
+
allowsChildren: !0,
|
|
360
|
+
allowedAttributes: [],
|
|
361
|
+
childTags: [
|
|
362
|
+
"tr"
|
|
363
|
+
]
|
|
364
|
+
}, tfoot = {
|
|
365
|
+
allowsTextContent: !1,
|
|
366
|
+
allowsChildren: !0,
|
|
367
|
+
allowedAttributes: [],
|
|
368
|
+
childTags: [
|
|
369
|
+
"tr"
|
|
370
|
+
]
|
|
371
|
+
}, tr = {
|
|
372
|
+
allowsTextContent: !1,
|
|
373
|
+
allowsChildren: !0,
|
|
374
|
+
allowedAttributes: [],
|
|
375
|
+
childTags: [
|
|
376
|
+
"td",
|
|
377
|
+
"th"
|
|
378
|
+
]
|
|
379
|
+
}, th = {
|
|
380
|
+
allowsTextContent: !0,
|
|
381
|
+
allowsChildren: !0,
|
|
382
|
+
allowedAttributes: [
|
|
383
|
+
"scope",
|
|
384
|
+
"colspan",
|
|
385
|
+
"rowspan"
|
|
386
|
+
],
|
|
387
|
+
childTags: []
|
|
388
|
+
}, td = {
|
|
389
|
+
allowsTextContent: !0,
|
|
390
|
+
allowsChildren: !0,
|
|
391
|
+
allowedAttributes: [
|
|
392
|
+
"colspan",
|
|
393
|
+
"rowspan"
|
|
394
|
+
],
|
|
395
|
+
childTags: []
|
|
396
|
+
}, datalist = {
|
|
397
|
+
allowsTextContent: !1,
|
|
398
|
+
allowsChildren: !0,
|
|
399
|
+
allowedAttributes: [],
|
|
400
|
+
childTags: [
|
|
401
|
+
"option"
|
|
402
|
+
]
|
|
403
|
+
}, option = {
|
|
404
|
+
allowsTextContent: !0,
|
|
405
|
+
allowsChildren: !1,
|
|
406
|
+
allowedAttributes: [
|
|
407
|
+
"value",
|
|
408
|
+
"label",
|
|
409
|
+
"selected",
|
|
410
|
+
"disabled"
|
|
411
|
+
]
|
|
412
|
+
}, header = {
|
|
413
|
+
allowsTextContent: !1,
|
|
414
|
+
allowsChildren: !0,
|
|
415
|
+
allowedAttributes: [
|
|
416
|
+
"role"
|
|
417
|
+
],
|
|
418
|
+
childTags: []
|
|
419
|
+
}, a = {
|
|
420
|
+
allowsTextContent: !0,
|
|
421
|
+
allowsChildren: !0,
|
|
422
|
+
allowedAttributes: [
|
|
423
|
+
"href",
|
|
424
|
+
"target",
|
|
425
|
+
"rel",
|
|
426
|
+
"title",
|
|
427
|
+
"download"
|
|
428
|
+
],
|
|
429
|
+
childTags: []
|
|
430
|
+
}, i = {
|
|
431
|
+
allowsTextContent: !0,
|
|
432
|
+
allowsChildren: !0,
|
|
433
|
+
allowedAttributes: [
|
|
434
|
+
"aria-hidden"
|
|
435
|
+
],
|
|
436
|
+
childTags: []
|
|
437
|
+
}, small = {
|
|
438
|
+
allowsTextContent: !0,
|
|
439
|
+
allowsChildren: !0,
|
|
440
|
+
allowedAttributes: [],
|
|
441
|
+
childTags: []
|
|
442
|
+
}, ul = {
|
|
443
|
+
allowsTextContent: !1,
|
|
444
|
+
allowsChildren: !0,
|
|
445
|
+
allowedAttributes: [
|
|
446
|
+
"type"
|
|
447
|
+
],
|
|
448
|
+
childTags: [
|
|
449
|
+
"li"
|
|
450
|
+
]
|
|
451
|
+
}, li = {
|
|
452
|
+
allowsTextContent: !0,
|
|
453
|
+
allowsChildren: !0,
|
|
454
|
+
allowedAttributes: [
|
|
455
|
+
"value"
|
|
456
|
+
],
|
|
457
|
+
childTags: []
|
|
458
|
+
}, hr = {
|
|
459
|
+
allowsTextContent: !1,
|
|
460
|
+
allowsChildren: !1,
|
|
461
|
+
allowedAttributes: []
|
|
462
|
+
}, defaultTags = {
|
|
463
|
+
$schema,
|
|
464
|
+
div,
|
|
465
|
+
input,
|
|
466
|
+
checkbox,
|
|
467
|
+
colgroup,
|
|
468
|
+
col,
|
|
469
|
+
label,
|
|
470
|
+
form,
|
|
471
|
+
select,
|
|
472
|
+
p,
|
|
473
|
+
h1,
|
|
474
|
+
h2,
|
|
475
|
+
span,
|
|
476
|
+
img,
|
|
477
|
+
button,
|
|
478
|
+
table,
|
|
479
|
+
thead,
|
|
480
|
+
tbody,
|
|
481
|
+
tfoot,
|
|
482
|
+
tr,
|
|
483
|
+
th,
|
|
484
|
+
td,
|
|
485
|
+
datalist,
|
|
486
|
+
option,
|
|
487
|
+
header,
|
|
488
|
+
a,
|
|
489
|
+
i,
|
|
490
|
+
small,
|
|
491
|
+
ul,
|
|
492
|
+
li,
|
|
493
|
+
hr
|
|
494
|
+
}, extractTags = ({ inSpec: t }) => {
|
|
495
|
+
const e = t;
|
|
496
|
+
if (!e) return [];
|
|
497
|
+
if (Array.isArray(e))
|
|
498
|
+
return e.flatMap((r) => extractTags({ inSpec: r }));
|
|
499
|
+
if (typeof e != "object") return [];
|
|
500
|
+
const n = [];
|
|
501
|
+
return typeof e.tagName == "string" && e.tagName.trim().length > 0 && n.push(e.tagName.toLowerCase()), Array.isArray(e.children) && e.children.length > 0 && e.children.forEach((r) => {
|
|
502
|
+
const l = extractTags({ inSpec: r });
|
|
503
|
+
n.push(...l);
|
|
504
|
+
}), n;
|
|
505
|
+
}, checkTags = ({ inTagsFound: t, inAllowedTags: e }) => {
|
|
506
|
+
const n = t ?? [], r = e ?? {}, l = new Set(
|
|
507
|
+
Object.keys(r).filter((d) => d !== "$schema").map((d) => d.toLowerCase())
|
|
508
|
+
), o = {}, s = [], c = [];
|
|
509
|
+
n.forEach((d) => {
|
|
510
|
+
o[d] = (o[d] || 0) + 1, l.has(d) ? s.includes(d) || s.push(d) : c.includes(d) || c.push(d);
|
|
511
|
+
});
|
|
512
|
+
const u = n.length, g = c.length === 0;
|
|
513
|
+
return {
|
|
514
|
+
totalTags: u,
|
|
515
|
+
tagCounts: o,
|
|
516
|
+
uniqueTags: Object.keys(o),
|
|
517
|
+
recognizedTags: s,
|
|
518
|
+
unrecognizedTags: c,
|
|
519
|
+
areAllTagsPresent: g
|
|
520
|
+
};
|
|
521
|
+
}, reviewSpec = ({ inSpec: t, inTags: e = defaultTags } = {}) => {
|
|
522
|
+
const n = t, r = e, l = extractTags({ inSpec: n }), o = checkTags({
|
|
523
|
+
inTagsFound: l,
|
|
524
|
+
inAllowedTags: r
|
|
525
|
+
});
|
|
526
|
+
return {
|
|
527
|
+
areAllTagsPresent: o.areAllTagsPresent,
|
|
528
|
+
totalTags: o.totalTags,
|
|
529
|
+
tagCounts: o.tagCounts,
|
|
530
|
+
uniqueTags: o.uniqueTags,
|
|
531
|
+
recognizedTags: o.recognizedTags,
|
|
532
|
+
unrecognizedTags: o.unrecognizedTags
|
|
533
|
+
};
|
|
534
|
+
}, buildSpecElement = (t = {}) => {
|
|
535
|
+
try {
|
|
536
|
+
const e = t, n = (e == null ? void 0 : e.spec) ?? (e == null ? void 0 : e.inSpec) ?? e;
|
|
537
|
+
return dispatchSpec({
|
|
538
|
+
inSpec: n
|
|
539
|
+
});
|
|
540
|
+
} catch (e) {
|
|
541
|
+
throw console.error("error : ", e), e;
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
registerGlobal({
|
|
545
|
+
inFuncDefinition: buildSpecElement,
|
|
546
|
+
inReviewSpec: reviewSpec
|
|
547
|
+
});
|
|
548
|
+
const deriveColumnsFromData = ({ inData: t = [] } = {}) => {
|
|
549
|
+
const e = t;
|
|
550
|
+
if (!Array.isArray(e) || e.length === 0)
|
|
551
|
+
return [];
|
|
552
|
+
const n = e[0];
|
|
553
|
+
return !n || typeof n != "object" ? [] : Object.keys(n).map((r) => ({
|
|
554
|
+
key: r,
|
|
555
|
+
label: r
|
|
556
|
+
}));
|
|
557
|
+
}, skeletonJson$2 = {
|
|
558
|
+
default: {
|
|
559
|
+
tagName: "table",
|
|
560
|
+
attributes: {
|
|
561
|
+
class: "table table-hover table-striped mb-0"
|
|
562
|
+
},
|
|
563
|
+
children: [
|
|
564
|
+
{
|
|
565
|
+
tagName: "thead",
|
|
566
|
+
children: [
|
|
567
|
+
{
|
|
568
|
+
tagName: "tr",
|
|
569
|
+
jsonToSpec: {
|
|
570
|
+
operation: "loopCollection",
|
|
571
|
+
source: "columns",
|
|
572
|
+
template: {
|
|
573
|
+
tagName: "th",
|
|
574
|
+
textContent: "${title}"
|
|
575
|
+
}
|
|
576
|
+
},
|
|
577
|
+
children: []
|
|
578
|
+
}
|
|
579
|
+
]
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
tagName: "tbody",
|
|
583
|
+
jsonToSpec: {
|
|
584
|
+
operation: "loopCollection",
|
|
585
|
+
source: "data",
|
|
586
|
+
template: {
|
|
587
|
+
tagName: "tr",
|
|
588
|
+
jsonToSpec: {
|
|
589
|
+
operation: "loopObject",
|
|
590
|
+
source: "data",
|
|
591
|
+
template: {
|
|
592
|
+
tagName: "td",
|
|
593
|
+
textContent: "${value}"
|
|
594
|
+
}
|
|
595
|
+
},
|
|
596
|
+
children: []
|
|
597
|
+
}
|
|
598
|
+
},
|
|
599
|
+
children: []
|
|
600
|
+
}
|
|
601
|
+
]
|
|
602
|
+
}
|
|
603
|
+
}, startFunc$b = ({
|
|
604
|
+
targetHtmlId: t,
|
|
605
|
+
inTargetHtmlId: e,
|
|
606
|
+
inColumns: n,
|
|
607
|
+
inData: r
|
|
608
|
+
} = {}) => {
|
|
609
|
+
const l = e ?? t;
|
|
610
|
+
n ?? deriveColumnsFromData({ inData: r ?? [] });
|
|
611
|
+
let s = buildSpecElement$1(skeletonJson$2.default, {
|
|
612
|
+
columns: [{
|
|
613
|
+
title: "Name"
|
|
614
|
+
}],
|
|
615
|
+
data: r
|
|
616
|
+
});
|
|
617
|
+
console.log("specAsJsonToDom : ", s), "tagName" in s || (s = s.children);
|
|
618
|
+
const c = document.getElementById(l);
|
|
619
|
+
c && (c.innerHTML = "");
|
|
620
|
+
const u = buildSpecElement(s);
|
|
621
|
+
c.append(u);
|
|
622
|
+
}, IDENTIFIERS = {
|
|
623
|
+
HARD_CODED: "$",
|
|
624
|
+
PARENT: "^",
|
|
625
|
+
TYPE_START: "(",
|
|
626
|
+
TYPE_END: ")",
|
|
627
|
+
ACTION_START: "{",
|
|
628
|
+
ACTION_END: "}",
|
|
629
|
+
ARRAY_INDEX: "#eq(",
|
|
630
|
+
ARRAY_START: "#eq(",
|
|
631
|
+
ARRAY_END: ")"
|
|
632
|
+
}, VALUES = {
|
|
633
|
+
DEFAULT: void 0
|
|
634
|
+
}, resolvePath = (t, e) => {
|
|
635
|
+
if (t === "")
|
|
636
|
+
return e;
|
|
637
|
+
const r = t.replace(/\[(\w+)\]/g, ". $1".replace(" ", "")).replace(/^\./, "").split(".");
|
|
638
|
+
for (let l = 0; l < r.length; ) {
|
|
639
|
+
if (Array.isArray(e)) {
|
|
640
|
+
const c = r.slice(l).join(".");
|
|
641
|
+
return e.map((u) => resolvePath(c, u));
|
|
642
|
+
}
|
|
643
|
+
if (typeof e != "object" || e === null)
|
|
644
|
+
return VALUES.DEFAULT;
|
|
645
|
+
let o, s = 0;
|
|
646
|
+
for (let c = r.length; c > l; c -= 1) {
|
|
647
|
+
const u = r.slice(l, c).join(".");
|
|
648
|
+
if (Object.prototype.hasOwnProperty.call(e, u)) {
|
|
649
|
+
o = u, s = c - l;
|
|
650
|
+
break;
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
if (o === void 0)
|
|
654
|
+
return VALUES.DEFAULT;
|
|
655
|
+
e = e[o], l += s;
|
|
656
|
+
}
|
|
657
|
+
return e;
|
|
658
|
+
}, isNonEmptyArray = (t) => t && Array.isArray(t) && t.length > 0, isNumber = (t) => !isNaN(t), operators = ["+", "-", "*", "/", "%"], convertToString = (t) => t ? String(t) : "", convertToNumber = (t) => t ? Number(t) : 0, convertToUpperCase = (t) => t ? t.toUpperCase() : "", convertToDate = (t) => {
|
|
659
|
+
if (!t) return t;
|
|
660
|
+
try {
|
|
661
|
+
return new Date(t).getTime();
|
|
662
|
+
} catch {
|
|
663
|
+
return t;
|
|
664
|
+
}
|
|
665
|
+
}, deleteKey = () => {
|
|
666
|
+
}, deleteIfNotPresent = (t) => typeof t > "u" ? void 0 : t, typeToFn = {
|
|
667
|
+
STRING: convertToString,
|
|
668
|
+
NUMBER: convertToNumber,
|
|
669
|
+
DATE: convertToDate,
|
|
670
|
+
UPPER: convertToUpperCase
|
|
671
|
+
}, extractSpecial = (t) => {
|
|
672
|
+
const e = t.indexOf(IDENTIFIERS.TYPE_START) > -1 ? IDENTIFIERS.TYPE_START : t.indexOf(IDENTIFIERS.ACTION_START) > -1 ? IDENTIFIERS.ACTION_START : null;
|
|
673
|
+
if (!e) return null;
|
|
674
|
+
const n = e === IDENTIFIERS.TYPE_START ? IDENTIFIERS.TYPE_END : IDENTIFIERS.ACTION_END;
|
|
675
|
+
return {
|
|
676
|
+
kind: e,
|
|
677
|
+
type: t.substring(t.indexOf(e) + 1, t.lastIndexOf(n)),
|
|
678
|
+
path: t.substring(0, t.indexOf(e))
|
|
679
|
+
};
|
|
680
|
+
}, evaluateExpression = (value, key, source, config) => {
|
|
681
|
+
const resolvedKey = resolvePath(key, source);
|
|
682
|
+
if (!config[resolvedKey]) return resolvedKey;
|
|
683
|
+
const { operator, value: expressionValue } = config[resolvedKey];
|
|
684
|
+
return !operators.includes(operator) || !isNumber(expressionValue) ? resolvedKey : eval(`${value}${operator}${expressionValue}`);
|
|
685
|
+
}, createActionMap = ({ convertValue: t }) => ({
|
|
686
|
+
APPEND: (e, n, r, l) => {
|
|
687
|
+
const o = l == null ? void 0 : l.appendMap;
|
|
688
|
+
if (!o || typeof o[n] > "u") return e;
|
|
689
|
+
const { path: s, separator: c } = o[n];
|
|
690
|
+
return e + (c || "") + t(s, r);
|
|
691
|
+
},
|
|
692
|
+
DELETE: deleteKey,
|
|
693
|
+
DELETE_IF_NOT_PRESENT: deleteIfNotPresent,
|
|
694
|
+
DEPENDS: (e, n, r, l) => {
|
|
695
|
+
if (typeof n > "u") return l.dependentMap[e];
|
|
696
|
+
const o = extractSpecial(n);
|
|
697
|
+
return o && actionMap[o.type] ? actionMap[o.type](e, o.path, r, l) : n;
|
|
698
|
+
},
|
|
699
|
+
EVAL: evaluateExpression
|
|
700
|
+
});
|
|
701
|
+
let actionMap = {};
|
|
702
|
+
const convertType = (t, e) => typeToFn[t] ? typeToFn[t](e) : e, performAction = (t, e, n, r, l, o) => {
|
|
703
|
+
actionMap = createActionMap({ convertValue: o });
|
|
704
|
+
const s = extractSpecial(t);
|
|
705
|
+
return s && actionMap[s.type] ? actionMap[s.type](e, s.path, r, l) : actionMap[t] ? actionMap[t](e, void 0, r, l) : e;
|
|
706
|
+
}, resolveValue = (t, e, n, r) => {
|
|
707
|
+
if (t.startsWith(IDENTIFIERS.HARD_CODED))
|
|
708
|
+
return t.substring(1);
|
|
709
|
+
if (t.startsWith(IDENTIFIERS.PARENT))
|
|
710
|
+
return resolvePath(t.substring(1), n);
|
|
711
|
+
const l = extractSpecial(t);
|
|
712
|
+
if (!l)
|
|
713
|
+
return resolvePath(t, e);
|
|
714
|
+
const o = resolvePath(l.path, e);
|
|
715
|
+
return typeof o > "u" ? VALUES.DEFAULT : l.kind === IDENTIFIERS.TYPE_START ? convertType(l.type, o) : performAction(
|
|
716
|
+
l.type,
|
|
717
|
+
o,
|
|
718
|
+
l.path,
|
|
719
|
+
e,
|
|
720
|
+
r,
|
|
721
|
+
(s, c) => resolveValue(s, c, n, r)
|
|
722
|
+
);
|
|
723
|
+
}, startFunc$a = (t, e, n) => {
|
|
724
|
+
const r = {};
|
|
725
|
+
return Object.keys(t).forEach((l) => {
|
|
726
|
+
const o = t[l];
|
|
727
|
+
if (typeof o == "string") {
|
|
728
|
+
r[l] = resolveValue(
|
|
729
|
+
o,
|
|
730
|
+
e,
|
|
731
|
+
n.rootSource,
|
|
732
|
+
n.configuration
|
|
733
|
+
);
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
if (Array.isArray(o) && o.length > 0) {
|
|
737
|
+
r[l] = startFunc$3(o[0], e, n);
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
o && typeof o == "object" && (r[l] = traverse(o, e, n));
|
|
741
|
+
}), r;
|
|
742
|
+
}, startFunc$9 = (t, e, n) => {
|
|
743
|
+
const r = [];
|
|
744
|
+
return t.forEach((l) => {
|
|
745
|
+
if (typeof l == "string") {
|
|
746
|
+
const o = resolveValue(
|
|
747
|
+
l,
|
|
748
|
+
e,
|
|
749
|
+
n.rootSource,
|
|
750
|
+
n.configuration
|
|
751
|
+
);
|
|
752
|
+
isNonEmptyArray(o) ? r.push(...o) : r.push(o);
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
755
|
+
if (Array.isArray(l)) {
|
|
756
|
+
r.push(
|
|
757
|
+
...startFunc$9(
|
|
758
|
+
l[0],
|
|
759
|
+
e,
|
|
760
|
+
n
|
|
761
|
+
)
|
|
762
|
+
);
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
l && typeof l == "object" && r.push(
|
|
766
|
+
startFunc$a(
|
|
767
|
+
l,
|
|
768
|
+
e,
|
|
769
|
+
n
|
|
770
|
+
)
|
|
771
|
+
);
|
|
772
|
+
}), r;
|
|
773
|
+
}, startFunc$8 = (t, e, n) => [
|
|
774
|
+
startFunc$a(
|
|
775
|
+
e,
|
|
776
|
+
t,
|
|
777
|
+
n
|
|
778
|
+
)
|
|
779
|
+
], startFunc$7 = (t, e, n) => t.map((r) => startFunc$a(
|
|
780
|
+
e,
|
|
781
|
+
r,
|
|
782
|
+
n
|
|
783
|
+
));
|
|
784
|
+
function isPlainObject(t) {
|
|
785
|
+
return t !== null && typeof t == "object" && Object.getPrototypeOf(t) === Object.prototype;
|
|
786
|
+
}
|
|
787
|
+
const startFunc$6 = (t, e, n) => Array.isArray(t) ? startFunc$7(
|
|
788
|
+
t,
|
|
789
|
+
e,
|
|
790
|
+
n
|
|
791
|
+
) : isPlainObject(t) ? startFunc$8(
|
|
792
|
+
t,
|
|
793
|
+
e,
|
|
794
|
+
n
|
|
795
|
+
) : [], isArrayIndexMapping = (t) => {
|
|
796
|
+
const e = t.list;
|
|
797
|
+
return e.startsWith(IDENTIFIERS.ARRAY_INDEX) && e.includes(IDENTIFIERS.ARRAY_START) && e.includes(IDENTIFIERS.ARRAY_END);
|
|
798
|
+
}, getItemMapping$1 = (t) => Array.isArray(t.item) ? t.item[0] : t.item, resolveListSource = (t, e) => resolvePath(
|
|
799
|
+
t.list,
|
|
800
|
+
e
|
|
801
|
+
), startFunc$5 = (t, e, n) => {
|
|
802
|
+
const r = getItemMapping$1(t);
|
|
803
|
+
if (isArrayIndexMapping(t))
|
|
804
|
+
return [
|
|
805
|
+
startFunc$a(
|
|
806
|
+
r,
|
|
807
|
+
e,
|
|
808
|
+
n
|
|
809
|
+
)
|
|
810
|
+
];
|
|
811
|
+
const l = resolveListSource(
|
|
812
|
+
t,
|
|
813
|
+
e
|
|
814
|
+
);
|
|
815
|
+
return startFunc$6(
|
|
816
|
+
l,
|
|
817
|
+
r,
|
|
818
|
+
n
|
|
819
|
+
);
|
|
820
|
+
}, getItemMapping = (t) => Array.isArray(t.item) ? t.item[0] : t.item, resolveObjectifySource = (t, e) => resolvePath(
|
|
821
|
+
t.objectify,
|
|
822
|
+
e
|
|
823
|
+
), startFunc$4 = (t, e, n) => {
|
|
824
|
+
const r = resolveObjectifySource(
|
|
825
|
+
t,
|
|
826
|
+
e
|
|
827
|
+
);
|
|
828
|
+
return startFunc$8(
|
|
829
|
+
r,
|
|
830
|
+
getItemMapping(t),
|
|
831
|
+
n
|
|
832
|
+
);
|
|
833
|
+
}, startFunc$3 = (t, e, n) => typeof t.collect < "u" ? startFunc$9(
|
|
834
|
+
t.item,
|
|
835
|
+
e,
|
|
836
|
+
n
|
|
837
|
+
) : typeof t.list < "u" ? startFunc$5(
|
|
838
|
+
t,
|
|
839
|
+
e,
|
|
840
|
+
n
|
|
841
|
+
) : typeof t.objectify < "u" ? startFunc$4(
|
|
842
|
+
t,
|
|
843
|
+
e,
|
|
844
|
+
n
|
|
845
|
+
) : [], startFunc$2 = (t, e) => {
|
|
846
|
+
if (!t.includes(IDENTIFIERS.ARRAY_INDEX)) return {};
|
|
847
|
+
const n = t.lastIndexOf(IDENTIFIERS.ARRAY_INDEX) + 4, r = t.lastIndexOf(IDENTIFIERS.ARRAY_END), l = t.substring(n, r), o = t.substring(0, t.lastIndexOf(IDENTIFIERS.ARRAY_INDEX)), s = o ? resolvePath(o, e) : e;
|
|
848
|
+
return s == null ? void 0 : s[l];
|
|
849
|
+
}, traverse = (t, e, n) => {
|
|
850
|
+
if (typeof t.list < "u" || typeof t.objectify < "u" || typeof t.collect < "u")
|
|
851
|
+
return startFunc$3(t, e, n);
|
|
852
|
+
if (typeof t.flat < "u") {
|
|
853
|
+
const r = startFunc$2(t.flat, e);
|
|
854
|
+
return startFunc$a(t.item, r, n);
|
|
855
|
+
}
|
|
856
|
+
return typeof t.item < "u" ? startFunc$a(t.item, e, n) : startFunc$a(t, e, n);
|
|
857
|
+
}, transform = (t, e) => {
|
|
858
|
+
let n = t, r = e;
|
|
859
|
+
t !== null && typeof t == "object" && "inData" in t && e === void 0 && (n = t.inData, r = t.inTransformation);
|
|
860
|
+
const { mapping: l, config: o = {} } = r;
|
|
861
|
+
return traverse(l, n, {
|
|
862
|
+
rootSource: n,
|
|
863
|
+
configuration: o
|
|
864
|
+
});
|
|
865
|
+
}, transformHelper = { transform }, old = {
|
|
866
|
+
tagName: "datalist",
|
|
867
|
+
attributes: {
|
|
868
|
+
id: "LedgerName"
|
|
869
|
+
},
|
|
870
|
+
jsonToSpec: {
|
|
871
|
+
operation: "loopArray",
|
|
872
|
+
source: "LedgerName",
|
|
873
|
+
template: {
|
|
874
|
+
tagName: "option",
|
|
875
|
+
attributes: {
|
|
876
|
+
value: "${}"
|
|
877
|
+
},
|
|
878
|
+
textContent: "${}"
|
|
879
|
+
}
|
|
880
|
+
},
|
|
881
|
+
children: []
|
|
882
|
+
}, skeletonJson$1 = {
|
|
883
|
+
old,
|
|
884
|
+
default: {
|
|
885
|
+
mapping: {
|
|
886
|
+
tagName: "$datalist",
|
|
887
|
+
attributes: {
|
|
888
|
+
id: "$LedgerName"
|
|
889
|
+
},
|
|
890
|
+
children: {
|
|
891
|
+
list: "LedgerName",
|
|
892
|
+
item: {
|
|
893
|
+
tagName: "$option",
|
|
894
|
+
attributes: {
|
|
895
|
+
value: ""
|
|
896
|
+
},
|
|
897
|
+
textContent: ""
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
}, startFunc$1 = ({ targetHtmlId: t, inData: e, inSkeletonType: n = "default" } = {}) => {
|
|
903
|
+
const r = skeletonJson$1[n], l = transformHelper.transform(e, r), o = document.getElementById(t);
|
|
904
|
+
o && (o.innerHTML = "");
|
|
905
|
+
const s = buildSpecElement(l);
|
|
906
|
+
Array.isArray(s) ? s.forEach((c) => o.append(c)) : o.append(s);
|
|
907
|
+
}, skeletonJson = {
|
|
908
|
+
default: {
|
|
909
|
+
mapping: {
|
|
910
|
+
tagName: "$select",
|
|
911
|
+
attributes: {
|
|
912
|
+
id: "$LedgerName",
|
|
913
|
+
class: "$keshav"
|
|
914
|
+
},
|
|
915
|
+
children: [
|
|
916
|
+
{
|
|
917
|
+
list: "LedgerName",
|
|
918
|
+
item: {
|
|
919
|
+
tagName: "$option",
|
|
920
|
+
attributes: {
|
|
921
|
+
value: ""
|
|
922
|
+
},
|
|
923
|
+
textContent: ""
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
]
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
}, startFunc = ({
|
|
930
|
+
targetHtmlId: t,
|
|
931
|
+
inData: e,
|
|
932
|
+
inSkeletonType: n = "default",
|
|
933
|
+
inClassToApply: r
|
|
934
|
+
} = {}) => {
|
|
935
|
+
console.log("aaaaaaaaaa");
|
|
936
|
+
const l = skeletonJson[n];
|
|
937
|
+
l.mapping.attributes.class = `$${r}`;
|
|
938
|
+
debugger;
|
|
939
|
+
const o = transformHelper.transform(e, l), s = document.getElementById(t);
|
|
940
|
+
s && (s.innerHTML = "");
|
|
941
|
+
const c = buildSpecElement(o);
|
|
942
|
+
Array.isArray(c) ? c.forEach((u) => s.append(u)) : s.append(c);
|
|
943
|
+
}, RENDERER_MAP = {
|
|
944
|
+
table: startFunc$b,
|
|
945
|
+
datalist: startFunc$1,
|
|
946
|
+
select: startFunc
|
|
947
|
+
}, render = ({
|
|
948
|
+
type: t = "table",
|
|
949
|
+
targetHtmlId: e,
|
|
950
|
+
data: n,
|
|
951
|
+
classToApply: r,
|
|
952
|
+
inTargetHtmlId: l,
|
|
953
|
+
inData: o,
|
|
954
|
+
columns: s,
|
|
955
|
+
inColumns: c,
|
|
956
|
+
fields: u,
|
|
957
|
+
inFields: g,
|
|
958
|
+
tabs: d,
|
|
959
|
+
inTabs: C,
|
|
960
|
+
options: M,
|
|
961
|
+
inOptions: P,
|
|
962
|
+
datalistId: _,
|
|
963
|
+
inDatalistId: Y,
|
|
964
|
+
listId: U,
|
|
965
|
+
inListId: H,
|
|
966
|
+
id: B,
|
|
967
|
+
valueField: z,
|
|
968
|
+
inValueField: V,
|
|
969
|
+
labelField: q,
|
|
970
|
+
inLabelField: G,
|
|
971
|
+
colGroup: N,
|
|
972
|
+
inColGroup: S,
|
|
973
|
+
footerData: $,
|
|
974
|
+
inFooterData: I,
|
|
975
|
+
config: v,
|
|
976
|
+
inConfig: F,
|
|
977
|
+
variant: R,
|
|
978
|
+
skeletonType: D,
|
|
979
|
+
inSkeletonType: x,
|
|
980
|
+
showLog: j = !1,
|
|
981
|
+
inShowLog: L,
|
|
982
|
+
...f
|
|
983
|
+
} = {}) => {
|
|
984
|
+
const w = t, h = typeof w == "string" ? w.toLowerCase() : "table", b = RENDERER_MAP[h];
|
|
985
|
+
if (!b)
|
|
986
|
+
return console.error(
|
|
987
|
+
`[Renderer] Unknown renderer type "${w}". Available types: ${Object.keys(RENDERER_MAP).join(", ")}`
|
|
988
|
+
), null;
|
|
989
|
+
const T = l ?? e, y = o ?? n, E = c ?? s, O = g ?? u, k = C ?? d, m = x ?? D ?? R ?? "default", A = L ?? j ?? !1;
|
|
990
|
+
return b(h === "form" ? {
|
|
991
|
+
targetHtmlId: T,
|
|
992
|
+
inFields: O,
|
|
993
|
+
inData: y,
|
|
994
|
+
inColumns: E,
|
|
995
|
+
inVariant: m,
|
|
996
|
+
inSkeletonType: m,
|
|
997
|
+
inShowLog: A,
|
|
998
|
+
onSave: f == null ? void 0 : f.onSave,
|
|
999
|
+
afterSave: f == null ? void 0 : f.afterSave,
|
|
1000
|
+
onNew: f == null ? void 0 : f.onNew
|
|
1001
|
+
} : h === "navtabs" || h === "nav" || h === "tabs" ? {
|
|
1002
|
+
targetHtmlId: T,
|
|
1003
|
+
inTabs: k,
|
|
1004
|
+
inData: y,
|
|
1005
|
+
inSkeletonType: m,
|
|
1006
|
+
inShowLog: A
|
|
1007
|
+
} : h === "datalist" || h === "data-list" ? {
|
|
1008
|
+
targetHtmlId: T,
|
|
1009
|
+
inData: y,
|
|
1010
|
+
inSkeletonType: m,
|
|
1011
|
+
inShowLog: A
|
|
1012
|
+
} : h === "select" ? {
|
|
1013
|
+
targetHtmlId: T,
|
|
1014
|
+
inData: y,
|
|
1015
|
+
inSkeletonType: m,
|
|
1016
|
+
inShowLog: A,
|
|
1017
|
+
inClassToApply: r
|
|
1018
|
+
} : {
|
|
1019
|
+
targetHtmlId: T,
|
|
1020
|
+
inColumns: E,
|
|
1021
|
+
inData: y,
|
|
1022
|
+
inColGroup: S ?? N,
|
|
1023
|
+
inFooterData: I ?? $ ?? [],
|
|
1024
|
+
inConfig: F ?? v ?? {},
|
|
1025
|
+
inSkeletonType: m,
|
|
1026
|
+
inShowLog: A
|
|
1027
|
+
});
|
|
1028
|
+
};
|
|
1029
|
+
registerGlobal$2(render);
|
|
1030
|
+
export {
|
|
1031
|
+
render as default
|
|
1032
|
+
};
|