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/v8/min.js
CHANGED
|
@@ -1,1787 +1,1787 @@
|
|
|
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
|
-
}, startFunc$s = ({
|
|
11
|
-
inColumns: t,
|
|
12
|
-
inData: e,
|
|
13
|
-
inColGroup: n,
|
|
14
|
-
inFooterData: o = [],
|
|
15
|
-
inConfig: r = {}
|
|
16
|
-
} = {}) => {
|
|
17
|
-
var u;
|
|
18
|
-
const l = t, s = e, c = n, d = o, b = r;
|
|
19
|
-
return {
|
|
20
|
-
columns: l,
|
|
21
|
-
data: s,
|
|
22
|
-
colGroup: c,
|
|
23
|
-
foot: d,
|
|
24
|
-
title: (b == null ? void 0 : b.title) ?? ((u = b == null ? void 0 : b.caption) == null ? void 0 : u.text) ?? "",
|
|
25
|
-
footerText: (b == null ? void 0 : b.footerText) ?? ""
|
|
26
|
-
};
|
|
27
|
-
}, isNullOrUndefined$2 = ({ inSpec: t }) => {
|
|
28
|
-
const e = t;
|
|
29
|
-
return e == null;
|
|
30
|
-
}, isDomNode$2 = ({ inSpec: t }) => typeof Node < "u" && t instanceof Node, isSpecArray$2 = ({ inSpecJson: t }) => {
|
|
31
|
-
const e = t;
|
|
32
|
-
return Array.isArray(e);
|
|
33
|
-
}, buildSpecArray$2 = ({
|
|
34
|
-
inArray: t = [],
|
|
35
|
-
inFragments: e,
|
|
36
|
-
inShowLog: n = !1
|
|
37
|
-
} = {}) => {
|
|
38
|
-
const o = t, r = e;
|
|
39
|
-
return n && console.log("buildSpecArray 1 : ", o, r), Array.isArray(o) ? o.map((l) => dispatchSpec$2({
|
|
40
|
-
inSpecJson: l,
|
|
41
|
-
inFragments: r
|
|
42
|
-
})).flat().filter(Boolean) : [];
|
|
43
|
-
}, dispatchSpec$2 = ({
|
|
44
|
-
inSpecJson: t,
|
|
45
|
-
inFragments: e,
|
|
46
|
-
inShowLog: n = !1
|
|
47
|
-
} = {}) => {
|
|
48
|
-
const o = t, r = e;
|
|
49
|
-
if (n && console.log("dispatchSpec : ", o, r), isNullOrUndefined$2({ inSpec: o }))
|
|
50
|
-
return null;
|
|
51
|
-
if (isDomNode$2({ inSpec: o }))
|
|
52
|
-
return o;
|
|
53
|
-
if (isSpecArray$2({ inSpecJson: o }))
|
|
54
|
-
return buildSpecArray$2({
|
|
55
|
-
inArray: o,
|
|
56
|
-
inFragments: r
|
|
57
|
-
});
|
|
58
|
-
if (typeof o != "object")
|
|
59
|
-
return o;
|
|
60
|
-
if ("slots" in o) {
|
|
61
|
-
const {
|
|
62
|
-
slots: l,
|
|
63
|
-
children: s = [],
|
|
64
|
-
...c
|
|
65
|
-
} = o, d = Array.isArray(l) ? l.map((b) => r && b in r ? dispatchSpec$2({
|
|
66
|
-
inSpecJson: r[b],
|
|
67
|
-
inFragments: r
|
|
68
|
-
}) : null).flat().filter(Boolean) : [];
|
|
69
|
-
return {
|
|
70
|
-
...structuredClone(c),
|
|
71
|
-
children: [
|
|
72
|
-
...buildSpecArray$2({ inArray: s, inFragments: r }),
|
|
73
|
-
...d
|
|
74
|
-
]
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
return "children" in o && Array.isArray(o.children) ? {
|
|
78
|
-
...structuredClone(o),
|
|
79
|
-
children: buildSpecArray$2({
|
|
80
|
-
inArray: o.children,
|
|
81
|
-
inFragments: r
|
|
82
|
-
})
|
|
83
|
-
} : structuredClone(o);
|
|
84
|
-
}, buildSpecElement$2 = ({ inSkeleton: t, inFragments: e } = {}) => {
|
|
85
|
-
const n = t, o = e;
|
|
86
|
-
try {
|
|
87
|
-
return dispatchSpec$2({
|
|
88
|
-
inSpecJson: n,
|
|
89
|
-
inFragments: o
|
|
90
|
-
});
|
|
91
|
-
} catch (r) {
|
|
92
|
-
console.log("error : ", r);
|
|
93
|
-
}
|
|
94
|
-
}, tableSimple = {
|
|
95
|
-
tagName: "table",
|
|
96
|
-
attributes: {
|
|
97
|
-
class: "table table-hover table-striped mb-0"
|
|
98
|
-
},
|
|
99
|
-
slots: [
|
|
100
|
-
"colGroup",
|
|
101
|
-
"thead",
|
|
102
|
-
"tbody",
|
|
103
|
-
"tfoot"
|
|
104
|
-
]
|
|
105
|
-
}, bodyOnly = {
|
|
106
|
-
tagName: "table",
|
|
107
|
-
attributes: {
|
|
108
|
-
class: "table table-hover table-striped mb-0"
|
|
109
|
-
},
|
|
110
|
-
slots: [
|
|
111
|
-
"tbody"
|
|
112
|
-
]
|
|
113
|
-
}, tableOnly = {
|
|
114
|
-
tagName: "table",
|
|
115
|
-
attributes: {
|
|
116
|
-
class: "table table-hover table-striped mb-0"
|
|
117
|
-
},
|
|
118
|
-
slots: [
|
|
119
|
-
"colGroup",
|
|
120
|
-
"thead",
|
|
121
|
-
"tbody",
|
|
122
|
-
"tfoot"
|
|
123
|
-
]
|
|
124
|
-
}, tableResponsive = {
|
|
125
|
-
tagName: "div",
|
|
126
|
-
attributes: {
|
|
127
|
-
class: "table-responsive"
|
|
128
|
-
},
|
|
129
|
-
children: [
|
|
130
|
-
{
|
|
131
|
-
tagName: "table",
|
|
132
|
-
attributes: {
|
|
133
|
-
class: "table table-hover table-striped mb-0"
|
|
134
|
-
},
|
|
135
|
-
slots: [
|
|
136
|
-
"colGroup",
|
|
137
|
-
"thead",
|
|
138
|
-
"tbody",
|
|
139
|
-
"tfoot"
|
|
140
|
-
]
|
|
141
|
-
}
|
|
142
|
-
]
|
|
143
|
-
}, cardWithHeader = {
|
|
144
|
-
tagName: "div",
|
|
145
|
-
attributes: {
|
|
146
|
-
class: "card shadow-sm"
|
|
147
|
-
},
|
|
148
|
-
children: [
|
|
149
|
-
{
|
|
150
|
-
tagName: "div",
|
|
151
|
-
attributes: {
|
|
152
|
-
class: "card-header bg-white py-3"
|
|
153
|
-
},
|
|
154
|
-
slots: [
|
|
155
|
-
"cardHeader"
|
|
156
|
-
]
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
tagName: "div",
|
|
160
|
-
attributes: {
|
|
161
|
-
class: "table-responsive"
|
|
162
|
-
},
|
|
163
|
-
children: [
|
|
164
|
-
{
|
|
165
|
-
tagName: "table",
|
|
166
|
-
attributes: {
|
|
167
|
-
class: "table table-hover table-striped mb-0"
|
|
168
|
-
},
|
|
169
|
-
slots: [
|
|
170
|
-
"colGroup",
|
|
171
|
-
"thead",
|
|
172
|
-
"tbody",
|
|
173
|
-
"tfoot"
|
|
174
|
-
]
|
|
175
|
-
}
|
|
176
|
-
]
|
|
177
|
-
}
|
|
178
|
-
]
|
|
179
|
-
}, cardWithFooter = {
|
|
180
|
-
tagName: "div",
|
|
181
|
-
attributes: {
|
|
182
|
-
class: "card shadow-sm"
|
|
183
|
-
},
|
|
184
|
-
children: [
|
|
185
|
-
{
|
|
186
|
-
tagName: "div",
|
|
187
|
-
attributes: {
|
|
188
|
-
class: "table-responsive"
|
|
189
|
-
},
|
|
190
|
-
children: [
|
|
191
|
-
{
|
|
192
|
-
tagName: "table",
|
|
193
|
-
attributes: {
|
|
194
|
-
class: "table table-hover table-striped mb-0"
|
|
195
|
-
},
|
|
196
|
-
slots: [
|
|
197
|
-
"colGroup",
|
|
198
|
-
"thead",
|
|
199
|
-
"tbody",
|
|
200
|
-
"tfoot"
|
|
201
|
-
]
|
|
202
|
-
}
|
|
203
|
-
]
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
tagName: "div",
|
|
207
|
-
attributes: {
|
|
208
|
-
class: "card-footer bg-white py-2"
|
|
209
|
-
},
|
|
210
|
-
slots: [
|
|
211
|
-
"cardFooter"
|
|
212
|
-
]
|
|
213
|
-
}
|
|
214
|
-
]
|
|
215
|
-
}, cardWithHeaderAndFooter = {
|
|
216
|
-
tagName: "div",
|
|
217
|
-
attributes: {
|
|
218
|
-
class: "card shadow-sm"
|
|
219
|
-
},
|
|
220
|
-
children: [
|
|
221
|
-
{
|
|
222
|
-
tagName: "div",
|
|
223
|
-
attributes: {
|
|
224
|
-
class: "card-header bg-white py-3"
|
|
225
|
-
},
|
|
226
|
-
slots: [
|
|
227
|
-
"cardHeader"
|
|
228
|
-
]
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
tagName: "div",
|
|
232
|
-
attributes: {
|
|
233
|
-
class: "table-responsive"
|
|
234
|
-
},
|
|
235
|
-
children: [
|
|
236
|
-
{
|
|
237
|
-
tagName: "table",
|
|
238
|
-
attributes: {
|
|
239
|
-
class: "table table-hover table-striped mb-0"
|
|
240
|
-
},
|
|
241
|
-
slots: [
|
|
242
|
-
"colGroup",
|
|
243
|
-
"thead",
|
|
244
|
-
"tbody",
|
|
245
|
-
"tfoot"
|
|
246
|
-
]
|
|
247
|
-
}
|
|
248
|
-
]
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
tagName: "div",
|
|
252
|
-
attributes: {
|
|
253
|
-
class: "card-footer bg-white py-2"
|
|
254
|
-
},
|
|
255
|
-
slots: [
|
|
256
|
-
"cardFooter"
|
|
257
|
-
]
|
|
258
|
-
}
|
|
259
|
-
]
|
|
260
|
-
}, bordered = {
|
|
261
|
-
tagName: "div",
|
|
262
|
-
attributes: {
|
|
263
|
-
class: "card shadow-sm"
|
|
264
|
-
},
|
|
265
|
-
children: [
|
|
266
|
-
{
|
|
267
|
-
tagName: "div",
|
|
268
|
-
attributes: {
|
|
269
|
-
class: "table-responsive"
|
|
270
|
-
},
|
|
271
|
-
children: [
|
|
272
|
-
{
|
|
273
|
-
tagName: "table",
|
|
274
|
-
attributes: {
|
|
275
|
-
class: "table table-bordered table-hover mb-0"
|
|
276
|
-
},
|
|
277
|
-
slots: [
|
|
278
|
-
"colGroup",
|
|
279
|
-
"thead",
|
|
280
|
-
"tbody",
|
|
281
|
-
"tfoot"
|
|
282
|
-
]
|
|
283
|
-
}
|
|
284
|
-
]
|
|
285
|
-
}
|
|
286
|
-
]
|
|
287
|
-
}, borderless = {
|
|
288
|
-
tagName: "div",
|
|
289
|
-
attributes: {
|
|
290
|
-
class: "card shadow-sm"
|
|
291
|
-
},
|
|
292
|
-
children: [
|
|
293
|
-
{
|
|
294
|
-
tagName: "div",
|
|
295
|
-
attributes: {
|
|
296
|
-
class: "table-responsive"
|
|
297
|
-
},
|
|
298
|
-
children: [
|
|
299
|
-
{
|
|
300
|
-
tagName: "table",
|
|
301
|
-
attributes: {
|
|
302
|
-
class: "table table-borderless table-hover mb-0"
|
|
303
|
-
},
|
|
304
|
-
slots: [
|
|
305
|
-
"colGroup",
|
|
306
|
-
"thead",
|
|
307
|
-
"tbody",
|
|
308
|
-
"tfoot"
|
|
309
|
-
]
|
|
310
|
-
}
|
|
311
|
-
]
|
|
312
|
-
}
|
|
313
|
-
]
|
|
314
|
-
}, compact = {
|
|
315
|
-
tagName: "div",
|
|
316
|
-
attributes: {
|
|
317
|
-
class: "card shadow-sm"
|
|
318
|
-
},
|
|
319
|
-
children: [
|
|
320
|
-
{
|
|
321
|
-
tagName: "div",
|
|
322
|
-
attributes: {
|
|
323
|
-
class: "table-responsive"
|
|
324
|
-
},
|
|
325
|
-
children: [
|
|
326
|
-
{
|
|
327
|
-
tagName: "table",
|
|
328
|
-
attributes: {
|
|
329
|
-
class: "table table-sm table-hover table-striped mb-0"
|
|
330
|
-
},
|
|
331
|
-
slots: [
|
|
332
|
-
"colGroup",
|
|
333
|
-
"thead",
|
|
334
|
-
"tbody",
|
|
335
|
-
"tfoot"
|
|
336
|
-
]
|
|
337
|
-
}
|
|
338
|
-
]
|
|
339
|
-
}
|
|
340
|
-
]
|
|
341
|
-
}, dark = {
|
|
342
|
-
tagName: "div",
|
|
343
|
-
attributes: {
|
|
344
|
-
class: "card shadow-sm bg-dark text-white border-secondary"
|
|
345
|
-
},
|
|
346
|
-
children: [
|
|
347
|
-
{
|
|
348
|
-
tagName: "div",
|
|
349
|
-
attributes: {
|
|
350
|
-
class: "table-responsive"
|
|
351
|
-
},
|
|
352
|
-
children: [
|
|
353
|
-
{
|
|
354
|
-
tagName: "table",
|
|
355
|
-
attributes: {
|
|
356
|
-
class: "table table-dark table-hover mb-0"
|
|
357
|
-
},
|
|
358
|
-
slots: [
|
|
359
|
-
"colGroup",
|
|
360
|
-
"thead",
|
|
361
|
-
"tbody",
|
|
362
|
-
"tfoot"
|
|
363
|
-
]
|
|
364
|
-
}
|
|
365
|
-
]
|
|
366
|
-
}
|
|
367
|
-
]
|
|
368
|
-
}, striped = {
|
|
369
|
-
tagName: "div",
|
|
370
|
-
attributes: {
|
|
371
|
-
class: "card shadow-sm"
|
|
372
|
-
},
|
|
373
|
-
children: [
|
|
374
|
-
{
|
|
375
|
-
tagName: "div",
|
|
376
|
-
attributes: {
|
|
377
|
-
class: "table-responsive"
|
|
378
|
-
},
|
|
379
|
-
children: [
|
|
380
|
-
{
|
|
381
|
-
tagName: "table",
|
|
382
|
-
attributes: {
|
|
383
|
-
class: "table table-striped mb-0"
|
|
384
|
-
},
|
|
385
|
-
slots: [
|
|
386
|
-
"colGroup",
|
|
387
|
-
"thead",
|
|
388
|
-
"tbody",
|
|
389
|
-
"tfoot"
|
|
390
|
-
]
|
|
391
|
-
}
|
|
392
|
-
]
|
|
393
|
-
}
|
|
394
|
-
]
|
|
395
|
-
}, flush = {
|
|
396
|
-
tagName: "div",
|
|
397
|
-
attributes: {
|
|
398
|
-
class: "card border-0 shadow-none"
|
|
399
|
-
},
|
|
400
|
-
children: [
|
|
401
|
-
{
|
|
402
|
-
tagName: "div",
|
|
403
|
-
attributes: {
|
|
404
|
-
class: "table-responsive"
|
|
405
|
-
},
|
|
406
|
-
children: [
|
|
407
|
-
{
|
|
408
|
-
tagName: "table",
|
|
409
|
-
attributes: {
|
|
410
|
-
class: "table table-hover table-striped mb-0"
|
|
411
|
-
},
|
|
412
|
-
slots: [
|
|
413
|
-
"colGroup",
|
|
414
|
-
"thead",
|
|
415
|
-
"tbody",
|
|
416
|
-
"tfoot"
|
|
417
|
-
]
|
|
418
|
-
}
|
|
419
|
-
]
|
|
420
|
-
}
|
|
421
|
-
]
|
|
422
|
-
}, skeletonJson$2 = {
|
|
423
|
-
tableSimple,
|
|
424
|
-
bodyOnly,
|
|
425
|
-
default: {
|
|
426
|
-
tagName: "div",
|
|
427
|
-
attributes: {
|
|
428
|
-
class: "card shadow-sm"
|
|
429
|
-
},
|
|
430
|
-
children: [
|
|
431
|
-
{
|
|
432
|
-
tagName: "div",
|
|
433
|
-
attributes: {
|
|
434
|
-
class: "table-responsive"
|
|
435
|
-
},
|
|
436
|
-
children: [
|
|
437
|
-
{
|
|
438
|
-
tagName: "table",
|
|
439
|
-
attributes: {
|
|
440
|
-
class: "table table-hover table-striped mb-0"
|
|
441
|
-
},
|
|
442
|
-
slots: [
|
|
443
|
-
"colGroup",
|
|
444
|
-
"thead",
|
|
445
|
-
"tbody",
|
|
446
|
-
"tfoot"
|
|
447
|
-
]
|
|
448
|
-
}
|
|
449
|
-
]
|
|
450
|
-
}
|
|
451
|
-
]
|
|
452
|
-
},
|
|
453
|
-
tableOnly,
|
|
454
|
-
tableResponsive,
|
|
455
|
-
cardWithHeader,
|
|
456
|
-
cardWithFooter,
|
|
457
|
-
cardWithHeaderAndFooter,
|
|
458
|
-
bordered,
|
|
459
|
-
borderless,
|
|
460
|
-
compact,
|
|
461
|
-
dark,
|
|
462
|
-
striped,
|
|
463
|
-
flush
|
|
464
|
-
}, colGroup = {
|
|
465
|
-
tagName: "colgroup",
|
|
466
|
-
jsonToSpec: {
|
|
467
|
-
operation: "loopArray",
|
|
468
|
-
source: "colGroup",
|
|
469
|
-
template: {
|
|
470
|
-
tagName: "col",
|
|
471
|
-
attributes: {
|
|
472
|
-
style: "${style}"
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
},
|
|
476
|
-
children: []
|
|
477
|
-
}, thead$1 = {
|
|
478
|
-
tagName: "thead",
|
|
479
|
-
attributes: {
|
|
480
|
-
class: "table-dark"
|
|
481
|
-
},
|
|
482
|
-
children: [
|
|
483
|
-
{
|
|
484
|
-
tagName: "tr",
|
|
485
|
-
jsonToSpec: {
|
|
486
|
-
operation: "loopArray",
|
|
487
|
-
source: "columns",
|
|
488
|
-
template: {
|
|
489
|
-
tagName: "th",
|
|
490
|
-
textContent: "${label}"
|
|
491
|
-
}
|
|
492
|
-
},
|
|
493
|
-
children: []
|
|
494
|
-
}
|
|
495
|
-
]
|
|
496
|
-
}, tbody$1 = {
|
|
497
|
-
tagName: "tbody",
|
|
498
|
-
attributes: {
|
|
499
|
-
id: "table-body"
|
|
500
|
-
},
|
|
501
|
-
jsonToSpec: {
|
|
502
|
-
operation: "loopArray",
|
|
503
|
-
source: "data",
|
|
504
|
-
template: {
|
|
505
|
-
tagName: "tr",
|
|
506
|
-
jsonToSpec: {
|
|
507
|
-
operation: "loopObject",
|
|
508
|
-
source: "data",
|
|
509
|
-
template: {
|
|
510
|
-
tagName: "td",
|
|
511
|
-
attributes: {
|
|
512
|
-
class: "tdddddd ${value}"
|
|
513
|
-
},
|
|
514
|
-
textContent: "${value}"
|
|
515
|
-
}
|
|
516
|
-
},
|
|
517
|
-
children: []
|
|
518
|
-
}
|
|
519
|
-
},
|
|
520
|
-
children: []
|
|
521
|
-
}, tfoot$1 = {
|
|
522
|
-
tagName: "tfoot",
|
|
523
|
-
attributes: {
|
|
524
|
-
class: "table-light fw-bold"
|
|
525
|
-
},
|
|
526
|
-
jsonToSpec: {
|
|
527
|
-
operation: "loopArray",
|
|
528
|
-
source: "foot",
|
|
529
|
-
template: {
|
|
530
|
-
tagName: "tr",
|
|
531
|
-
jsonToSpec: {
|
|
532
|
-
operation: "loopObject",
|
|
533
|
-
source: "foot",
|
|
534
|
-
template: {
|
|
535
|
-
tagName: "td",
|
|
536
|
-
textContent: "${value}"
|
|
537
|
-
}
|
|
538
|
-
},
|
|
539
|
-
children: []
|
|
540
|
-
}
|
|
541
|
-
},
|
|
542
|
-
children: []
|
|
543
|
-
}, cardHeader = {
|
|
544
|
-
tagName: "div",
|
|
545
|
-
attributes: {
|
|
546
|
-
class: "d-flex justify-content-between align-items-center"
|
|
547
|
-
},
|
|
548
|
-
children: [
|
|
549
|
-
{
|
|
550
|
-
tagName: "h5",
|
|
551
|
-
attributes: {
|
|
552
|
-
class: "card-title mb-0"
|
|
553
|
-
},
|
|
554
|
-
textContent: "${title}"
|
|
555
|
-
}
|
|
556
|
-
]
|
|
557
|
-
}, cardFooter = {
|
|
558
|
-
tagName: "div",
|
|
559
|
-
attributes: {
|
|
560
|
-
class: "d-flex justify-content-between align-items-center text-muted small"
|
|
561
|
-
},
|
|
562
|
-
children: [
|
|
563
|
-
{
|
|
564
|
-
tagName: "span",
|
|
565
|
-
textContent: "${footerText}"
|
|
566
|
-
}
|
|
567
|
-
]
|
|
568
|
-
}, fragmentsJson = {
|
|
569
|
-
colGroup,
|
|
570
|
-
thead: thead$1,
|
|
571
|
-
tbody: tbody$1,
|
|
572
|
-
tfoot: tfoot$1,
|
|
573
|
-
cardHeader,
|
|
574
|
-
cardFooter
|
|
575
|
-
}, startFunc$r = ({
|
|
576
|
-
inSkeletonType: t = "default",
|
|
577
|
-
inSkeletonJson: e = skeletonJson$2,
|
|
578
|
-
inFragmentsJson: n = fragmentsJson,
|
|
579
|
-
inShowLog: o = !1
|
|
580
|
-
} = {}) => {
|
|
581
|
-
const r = t, l = e, s = n, c = o, d = l[r] ?? l.default ?? l, b = structuredClone(d);
|
|
582
|
-
c && console.log("targetSkeleton : ", b);
|
|
583
|
-
const u = buildSpecElement$2({
|
|
584
|
-
inSkeleton: b,
|
|
585
|
-
inFragments: s
|
|
586
|
-
});
|
|
587
|
-
return c && console.log("structureJson : ", u), u;
|
|
588
|
-
}, meta$1 = {
|
|
589
|
-
version: "v24.0",
|
|
590
|
-
description: "Pure spec engine no document at all"
|
|
591
|
-
}, registerGlobal$1 = (t) => {
|
|
592
|
-
typeof globalThis > "u" || !t || (globalThis.ks ?? (globalThis.ks = {}), globalThis.ks["json-to-spec"] = {
|
|
593
|
-
meta: meta$1,
|
|
594
|
-
buildSpecElement: t
|
|
595
|
-
}, globalThis.ks.jsonToSpec = {
|
|
596
|
-
meta: meta$1,
|
|
597
|
-
buildSpecElement: t
|
|
598
|
-
});
|
|
599
|
-
}, isNullOrUndefined$1 = ({ inSpec: t }) => {
|
|
600
|
-
const e = t;
|
|
601
|
-
return e == null;
|
|
602
|
-
}, isDomNode$1 = ({ inSpec: t }) => typeof Node < "u" && t instanceof Node, isSpecArray$1 = ({ inSpecJson: t }) => {
|
|
603
|
-
const e = t;
|
|
604
|
-
return Array.isArray(e);
|
|
605
|
-
}, buildSpecArray$1 = ({ inArray: t = [], inShowLog: e = !1, inDataJson: n }) => {
|
|
606
|
-
const o = t, r = e, l = n;
|
|
607
|
-
return Array.isArray(o) ? o.map((s) => dispatchSpec$1({
|
|
608
|
-
inSpecJson: s,
|
|
609
|
-
inShowLog: r,
|
|
610
|
-
inDataJson: l
|
|
611
|
-
})).flat().filter(Boolean) : [];
|
|
612
|
-
}, startFunc$q = ({ inTemplate: t, inData: e, inRowIndex: n }) => {
|
|
613
|
-
if (Number.isFinite(n)) {
|
|
614
|
-
debugger;
|
|
615
|
-
console.log("vvvvvvvvvvvvvv : ", n);
|
|
616
|
-
let o = forHashResolve({ inTemplate: t, inRowIndex: n });
|
|
617
|
-
return forDollarResolve({ inTemplate: o, inData: e });
|
|
618
|
-
} else
|
|
619
|
-
return forDollarResolve({ inTemplate: t, inData: e });
|
|
620
|
-
}, forDollarResolve = ({ inTemplate: t, inData: e }) => {
|
|
621
|
-
const n = t, o = e;
|
|
622
|
-
return typeof n != "string" ? n : n.replace(/\$\{([^}]+)\}/g, (r, l) => {
|
|
623
|
-
const s = l.trim().split(".");
|
|
624
|
-
let c = o;
|
|
625
|
-
for (const d of s) {
|
|
626
|
-
if (c == null) return "";
|
|
627
|
-
c = c[d];
|
|
628
|
-
}
|
|
629
|
-
return c == null ? "" : typeof c == "string" || typeof c == "number" || typeof c == "boolean" ? String(c ?? "") : c;
|
|
630
|
-
});
|
|
631
|
-
}, forHashResolve = ({ inTemplate: t, inRowIndex: e }) => {
|
|
632
|
-
const n = t, o = e;
|
|
633
|
-
return n.replace(/\#\{([^}]+)\}/g, (r, l) => {
|
|
634
|
-
const s = l.trim().split(".");
|
|
635
|
-
let c = o;
|
|
636
|
-
console.log("aaaaaaa : ", e, t, s);
|
|
637
|
-
for (const d of s) {
|
|
638
|
-
if (c == null) return "";
|
|
639
|
-
c = c[d];
|
|
640
|
-
}
|
|
641
|
-
return c === null || typeof c == "string" || typeof c == "number" || typeof c == "boolean" ? String(c ?? "") : c;
|
|
642
|
-
});
|
|
643
|
-
}, handleObjectData = ({ inSpec: t, inData: e, inShowLog: n }) => {
|
|
644
|
-
const o = t, r = e, l = n;
|
|
645
|
-
return "textContent" in o && (o.textContent = startFunc$q({ inTemplate: o.textContent, inData: r })), "attributes" in o && typeof o.attributes == "object" && o.attributes && (o.attributes = Object.fromEntries(
|
|
646
|
-
Object.entries(o.attributes).map(([s, c]) => [
|
|
647
|
-
s,
|
|
648
|
-
startFunc$q({ inTemplate: c, inData: r })
|
|
649
|
-
])
|
|
650
|
-
)), Array.isArray(o.children) && (o.children = o.children.map(
|
|
651
|
-
(s) => dispatchSpec$1({
|
|
652
|
-
inSpecJson: s,
|
|
653
|
-
inShowLog: l,
|
|
654
|
-
inDataJson: r
|
|
655
|
-
})
|
|
656
|
-
)), o;
|
|
657
|
-
}, startFunc$p = ({ inSpec: t, inData: e }) => {
|
|
658
|
-
const n = t, o = e, r = o.value;
|
|
659
|
-
return isSpecArray$1({ inSpecJson: r }) ? (n.children = [{
|
|
660
|
-
tagName: "button",
|
|
661
|
-
attributes: {
|
|
662
|
-
class: "btn btn-primary btn-sm"
|
|
663
|
-
},
|
|
664
|
-
textContent: r.length
|
|
665
|
-
}], delete n.textContent, n) : typeof r == "object" && r !== null && r.tagName ? (n.children = [r], delete n.textContent, n) : ("textContent" in n && (n.textContent = startFunc$q({ inTemplate: n.textContent, inData: o })), "attributes" in n && typeof n.attributes == "object" && n.attributes && (n.attributes = Object.fromEntries(
|
|
666
|
-
Object.entries(n.attributes).map(([l, s]) => [
|
|
667
|
-
l,
|
|
668
|
-
startFunc$q({ inTemplate: s, inData: o })
|
|
669
|
-
])
|
|
670
|
-
)), n);
|
|
671
|
-
}, handleStringData = ({ inSpec: t, inData: e }) => {
|
|
672
|
-
const n = t, o = e;
|
|
673
|
-
return "textContent" in n && (n.textContent === "${}" ? n.textContent = o : typeof n.textContent == "string" && (n.textContent = n.textContent.replaceAll("${}", () => o))), "attributes" in n && typeof n.attributes == "object" && n.attributes && (n.attributes = Object.fromEntries(
|
|
674
|
-
Object.entries(n.attributes).map(([r, l]) => [
|
|
675
|
-
r,
|
|
676
|
-
l === "${}" ? o : typeof l == "string" ? l.replaceAll("${}", () => o) : l
|
|
677
|
-
])
|
|
678
|
-
)), n;
|
|
679
|
-
}, startFunc$o = ({ inSpecJson: t, inData: e, inRowIndex: n, inShowLog: o = !1 } = {}) => {
|
|
680
|
-
const r = t, l = e, s = o, c = structuredClone(r);
|
|
681
|
-
return s && console.log("buildSingleElement start : ", r, l), typeof l == "string" ? handleStringData({ inSpec: c, inData: l }) : typeof l == "object" && l !== null && "key" in l && "value" in l && !("children" in c && Array.isArray(c.children) && c.children.length > 0) ? startFunc$p({ inSpec: c, inData: l }) : handleObjectData({
|
|
682
|
-
inSpec: c,
|
|
683
|
-
inData: l,
|
|
684
|
-
inShowLog: s
|
|
685
|
-
});
|
|
686
|
-
}, startFunc$n = ({ inTemplate: t, inDataAsArray: e }) => {
|
|
687
|
-
const n = e, o = t;
|
|
688
|
-
return Array.isArray(n) ? n.map((l, s) => {
|
|
689
|
-
const c = structuredClone(o);
|
|
690
|
-
return dispatchSpec$1({
|
|
691
|
-
inSpecJson: c,
|
|
692
|
-
inDataJson: l,
|
|
693
|
-
inRowIndex: s
|
|
694
|
-
});
|
|
695
|
-
}) : [];
|
|
696
|
-
}, startFunc$m = ({ inTemplate: t, inDataAsObject: e }) => {
|
|
697
|
-
const n = e, o = t;
|
|
698
|
-
if (n === null || typeof n != "object")
|
|
699
|
-
return [];
|
|
700
|
-
const r = [];
|
|
701
|
-
for (const [l, s] of Object.entries(n)) {
|
|
702
|
-
const c = structuredClone(o), d = dispatchSpec$1({
|
|
703
|
-
inSpecJson: c,
|
|
704
|
-
inDataJson: {
|
|
705
|
-
key: l,
|
|
706
|
-
value: s
|
|
707
|
-
}
|
|
708
|
-
});
|
|
709
|
-
r.push(d);
|
|
710
|
-
}
|
|
711
|
-
return r;
|
|
712
|
-
}, startFunc$l = ({
|
|
713
|
-
inSpecJson: t,
|
|
714
|
-
inShowLog: e = !1,
|
|
715
|
-
inDataJson: n,
|
|
716
|
-
inRowIndex: o
|
|
717
|
-
} = {}) => {
|
|
718
|
-
if (Number.isFinite(o) && ("attributes" in t ? t.attributes.rowIndex = o : t.attributes = {
|
|
719
|
-
rowIndex: o
|
|
720
|
-
}), !["loopArray", "loopObject"].includes(t.jsonToSpec.operation)) {
|
|
721
|
-
console.log(`inSpecJson.jsonToSpec.operation : can be loopArray or loopObject : ${t.jsonToSpec.operation}`);
|
|
722
|
-
return;
|
|
723
|
-
}
|
|
724
|
-
if (t.jsonToSpec.operation === "loopArray") {
|
|
725
|
-
const r = startFunc$n({
|
|
726
|
-
inTemplate: t.jsonToSpec.template,
|
|
727
|
-
inDataAsArray: n[t.jsonToSpec.source]
|
|
728
|
-
}), {
|
|
729
|
-
jsonToSpec: l,
|
|
730
|
-
...s
|
|
731
|
-
} = t, c = {
|
|
732
|
-
...s,
|
|
733
|
-
children: r
|
|
734
|
-
};
|
|
735
|
-
return startFunc$o({
|
|
736
|
-
inSpecJson: c,
|
|
737
|
-
inShowLog: e,
|
|
738
|
-
inData: n
|
|
739
|
-
});
|
|
740
|
-
}
|
|
741
|
-
if (t.jsonToSpec.operation === "loopObject") {
|
|
742
|
-
const r = startFunc$m({
|
|
743
|
-
inTemplate: t.jsonToSpec.template,
|
|
744
|
-
inDataAsObject: n
|
|
745
|
-
}), {
|
|
746
|
-
jsonToSpec: l,
|
|
747
|
-
...s
|
|
748
|
-
} = t, c = {
|
|
749
|
-
...s,
|
|
750
|
-
children: r
|
|
751
|
-
};
|
|
752
|
-
return startFunc$o({
|
|
753
|
-
inSpecJson: c,
|
|
754
|
-
inShowLog: e,
|
|
755
|
-
inData: n
|
|
756
|
-
});
|
|
757
|
-
}
|
|
758
|
-
}, dispatchSpec$1 = ({
|
|
759
|
-
inSpecJson: t,
|
|
760
|
-
inShowLog: e = !0,
|
|
761
|
-
inDataJson: n,
|
|
762
|
-
inRowIndex: o
|
|
763
|
-
} = {}) => isNullOrUndefined$1({ inSpec: t }) ? null : isDomNode$1({ inSpec: t }) ? t : (e && console.log("dispatchSpec 3 : ", t, n), isSpecArray$1({ inSpecJson: t }) ? buildSpecArray$1({
|
|
764
|
-
inArray: t,
|
|
765
|
-
inShowLog: e,
|
|
766
|
-
inDataJson: n
|
|
767
|
-
}) : "jsonToSpec" in t ? startFunc$l({
|
|
768
|
-
inSpecJson: t,
|
|
769
|
-
inShowLog: e,
|
|
770
|
-
inDataJson: n,
|
|
771
|
-
inRowIndex: o
|
|
772
|
-
}) : startFunc$o({
|
|
773
|
-
inSpecJson: t,
|
|
774
|
-
inShowLog: e,
|
|
775
|
-
inRowIndex: o,
|
|
776
|
-
inData: n
|
|
777
|
-
})), buildSpecElement$1 = ({
|
|
778
|
-
specJson: t,
|
|
779
|
-
showLog: e = !1,
|
|
780
|
-
dataJson: n
|
|
781
|
-
}) => {
|
|
782
|
-
try {
|
|
783
|
-
return e && console.log("jsonToSpec 1 : ", t), dispatchSpec$1({
|
|
784
|
-
inSpecJson: t,
|
|
785
|
-
inShowLog: e,
|
|
786
|
-
inDataJson: n
|
|
787
|
-
});
|
|
788
|
-
} catch (o) {
|
|
789
|
-
console.log("error : ", o);
|
|
790
|
-
}
|
|
791
|
-
};
|
|
792
|
-
registerGlobal$1(buildSpecElement$1);
|
|
793
|
-
const meta = {
|
|
794
|
-
version: "v3.0",
|
|
795
|
-
description: "Pure DOM engine with JSON review and tags.json catalog verification"
|
|
796
|
-
}, registerGlobal = (t) => {
|
|
797
|
-
const e = t, n = typeof e == "function" ? e : e == null ? void 0 : e.inFuncDefinition, o = e == null ? void 0 : e.inReviewSpec;
|
|
798
|
-
typeof globalThis > "u" || !n || (globalThis.ks ?? (globalThis.ks = {}), globalThis.ks["json-to-tag"] = {
|
|
799
|
-
meta,
|
|
800
|
-
buildSpecElement: n,
|
|
801
|
-
reviewSpec: o
|
|
802
|
-
}, globalThis.ks.jsonToTag = {
|
|
803
|
-
meta,
|
|
804
|
-
buildSpecElement: n,
|
|
805
|
-
reviewSpec: o
|
|
806
|
-
});
|
|
807
|
-
}, isNullOrUndefined = ({ inSpec: t }) => {
|
|
808
|
-
const e = t;
|
|
809
|
-
return e == null;
|
|
810
|
-
}, isDomNode = ({ inSpec: t }) => typeof Node < "u" && t instanceof Node, isSpecArray = ({ inSpec: t }) => {
|
|
811
|
-
const e = t;
|
|
812
|
-
return Array.isArray(e);
|
|
813
|
-
}, buildSpecArray = ({ inSpec: t, inShowLog: e = !1 }) => {
|
|
814
|
-
const n = t, o = e;
|
|
815
|
-
return Array.isArray(n) ? n.map((r) => dispatchSpec({
|
|
816
|
-
inSpec: r,
|
|
817
|
-
inShowLog: o
|
|
818
|
-
})).flat().filter(Boolean) : [];
|
|
819
|
-
}, createElement = ({ inTagName: t }) => {
|
|
820
|
-
const e = t == null ? void 0 : t.toLowerCase();
|
|
821
|
-
if (!e) return null;
|
|
822
|
-
if (e === "checkbox") {
|
|
823
|
-
const n = document.createElement("input");
|
|
824
|
-
return n.type = "checkbox", n;
|
|
825
|
-
}
|
|
826
|
-
return document.createElement(e);
|
|
827
|
-
}, applyTextContent = ({ inElement: t, inTextContent: e, inAllowsTextContent: n = !0, inTagName: o, inShowLog: r = !1 }) => {
|
|
828
|
-
const l = t, s = e, c = n, d = o, b = r;
|
|
829
|
-
return !l || s === void 0 || s === null ? l : c ? (l.textContent = s, l) : (b && console.warn(`[json-to-tag v3] textContent is not allowed on <${d}>; discarded "${s}"`), l);
|
|
830
|
-
}, applyProperties = ({ inElement: t, inProperties: e }) => {
|
|
831
|
-
const n = t, o = e;
|
|
832
|
-
return n && o && typeof o == "object" && Object.assign(n, o), n;
|
|
833
|
-
}, applyAttributes = ({ inElement: t, inAttributes: e }) => {
|
|
834
|
-
const n = t, o = e;
|
|
835
|
-
return !n || !o || typeof o != "object" || Object.entries(o).forEach(([r, l]) => {
|
|
836
|
-
r === "class" ? n.className = l : typeof l == "boolean" ? l ? n.setAttribute(r, "") : n.removeAttribute(r) : l != null && n.setAttribute(r, String(l));
|
|
837
|
-
}), n;
|
|
838
|
-
}, applyClassList = ({ inElement: t, inClassList: e }) => {
|
|
839
|
-
const n = t, o = e;
|
|
840
|
-
if (!n || !o) return n;
|
|
841
|
-
let r = [];
|
|
842
|
-
return typeof o == "string" ? r = o.split(/\s+/).filter(Boolean) : Array.isArray(o) && (r = o.filter((l) => typeof l == "string" && l.trim().length > 0)), r.length > 0 && n.classList.add(...r), n;
|
|
843
|
-
}, appendChildren = ({ inElement: t, inChildren: e, inAllowsChildren: n = !0, inTagName: o, inShowLog: r = !1 }) => {
|
|
844
|
-
const l = t, s = e, c = n, d = o, b = r;
|
|
845
|
-
return !l || !Array.isArray(s) || s.length === 0 ? l : c ? (s.forEach((u) => {
|
|
846
|
-
typeof Node < "u" && u instanceof Node ? l.appendChild(u) : (typeof u == "string" || typeof u == "number") && l.appendChild(document.createTextNode(String(u)));
|
|
847
|
-
}), l) : (b && console.warn(`[json-to-tag v3] Children are not allowed on void tag <${d}>; discarded ${s.length} child nodes.`), l);
|
|
848
|
-
}, domElementBuilder = ({ inSpec: t, inClassList: e }) => {
|
|
849
|
-
const n = t, o = e || (n == null ? void 0 : n.classList);
|
|
850
|
-
if (!n || !n.tagName) return null;
|
|
851
|
-
const r = createElement({ inTagName: n.tagName });
|
|
852
|
-
return r ? (applyTextContent({
|
|
853
|
-
inElement: r,
|
|
854
|
-
inTextContent: n.textContent,
|
|
855
|
-
inTagName: n.tagName
|
|
856
|
-
}), applyProperties({
|
|
857
|
-
inElement: r,
|
|
858
|
-
inProperties: n.properties
|
|
859
|
-
}), applyAttributes({
|
|
860
|
-
inElement: r,
|
|
861
|
-
inAttributes: n.attributes
|
|
862
|
-
}), applyClassList({
|
|
863
|
-
inElement: r,
|
|
864
|
-
inClassList: o
|
|
865
|
-
}), appendChildren({
|
|
866
|
-
inElement: r,
|
|
867
|
-
inChildren: n.children,
|
|
868
|
-
inTagName: n.tagName
|
|
869
|
-
}), r) : null;
|
|
870
|
-
}, buildChildrenNodes = ({ inChildren: t, inShowLog: e = !1 }) => {
|
|
871
|
-
const n = t, o = e;
|
|
872
|
-
return Array.isArray(n) ? n.map((l) => dispatchSpec({
|
|
873
|
-
inSpec: l,
|
|
874
|
-
inShowLog: o
|
|
875
|
-
})).flat().filter(Boolean) : [];
|
|
876
|
-
}, buildSingleElement = ({ inSpec: t, inShowLog: e = !1 }) => {
|
|
877
|
-
const n = t, o = e, r = domElementBuilder({ inSpec: n });
|
|
878
|
-
let l = [];
|
|
879
|
-
return "children" in n && (l = Array.isArray(n.children) && n.children.length > 0 ? buildChildrenNodes({
|
|
880
|
-
inChildren: n.children,
|
|
881
|
-
inShowLog: o
|
|
882
|
-
}) : [], r.append(...l)), r;
|
|
883
|
-
}, dispatchSpec = ({ inSpec: t, inShowLog: e = !1 } = {}) => {
|
|
884
|
-
const n = t, o = e;
|
|
885
|
-
return isNullOrUndefined({ inSpec: n }) ? null : isDomNode({ inSpec: n }) ? n : isSpecArray({ inSpec: n }) ? buildSpecArray({
|
|
886
|
-
inSpec: n,
|
|
887
|
-
inShowLog: o
|
|
888
|
-
}) : buildSingleElement({
|
|
889
|
-
inSpec: n,
|
|
890
|
-
inShowLog: o
|
|
891
|
-
});
|
|
892
|
-
}, $schema = "./tags.schema.json", div = {
|
|
893
|
-
allowsTextContent: !1,
|
|
894
|
-
allowsChildren: !0,
|
|
895
|
-
allowedAttributes: [
|
|
896
|
-
"title",
|
|
897
|
-
"role"
|
|
898
|
-
],
|
|
899
|
-
childTags: []
|
|
900
|
-
}, input = {
|
|
901
|
-
allowsTextContent: !1,
|
|
902
|
-
allowsChildren: !1,
|
|
903
|
-
allowedAttributes: [
|
|
904
|
-
"type",
|
|
905
|
-
"placeholder",
|
|
906
|
-
"value",
|
|
907
|
-
"name",
|
|
908
|
-
"disabled",
|
|
909
|
-
"readonly",
|
|
910
|
-
"required",
|
|
911
|
-
"list"
|
|
912
|
-
]
|
|
913
|
-
}, checkbox = {
|
|
914
|
-
allowsTextContent: !1,
|
|
915
|
-
allowsChildren: !1,
|
|
916
|
-
allowedAttributes: [
|
|
917
|
-
"type",
|
|
918
|
-
"checked",
|
|
919
|
-
"name",
|
|
920
|
-
"value",
|
|
921
|
-
"disabled",
|
|
922
|
-
"required"
|
|
923
|
-
]
|
|
924
|
-
}, colgroup = {
|
|
925
|
-
allowsTextContent: !1,
|
|
926
|
-
allowsChildren: !0,
|
|
927
|
-
allowedAttributes: [
|
|
928
|
-
"span"
|
|
929
|
-
],
|
|
930
|
-
childTags: [
|
|
931
|
-
"col"
|
|
932
|
-
]
|
|
933
|
-
}, col = {
|
|
934
|
-
allowsTextContent: !1,
|
|
935
|
-
allowsChildren: !1,
|
|
936
|
-
allowedAttributes: [
|
|
937
|
-
"span",
|
|
938
|
-
"style",
|
|
939
|
-
"width"
|
|
940
|
-
]
|
|
941
|
-
}, label = {
|
|
942
|
-
allowsTextContent: !0,
|
|
943
|
-
allowsChildren: !0,
|
|
944
|
-
allowedAttributes: [
|
|
945
|
-
"for"
|
|
946
|
-
],
|
|
947
|
-
childTags: []
|
|
948
|
-
}, form = {
|
|
949
|
-
allowsTextContent: !1,
|
|
950
|
-
allowsChildren: !0,
|
|
951
|
-
allowedAttributes: [
|
|
952
|
-
"action",
|
|
953
|
-
"method",
|
|
954
|
-
"autocomplete",
|
|
955
|
-
"enctype",
|
|
956
|
-
"name",
|
|
957
|
-
"novalidate",
|
|
958
|
-
"target"
|
|
959
|
-
],
|
|
960
|
-
childTags: []
|
|
961
|
-
}, select = {
|
|
962
|
-
allowsTextContent: !1,
|
|
963
|
-
allowsChildren: !0,
|
|
964
|
-
allowedAttributes: [
|
|
965
|
-
"name",
|
|
966
|
-
"disabled",
|
|
967
|
-
"required",
|
|
968
|
-
"multiple",
|
|
969
|
-
"size"
|
|
970
|
-
],
|
|
971
|
-
childTags: [
|
|
972
|
-
"option"
|
|
973
|
-
]
|
|
974
|
-
}, p = {
|
|
975
|
-
allowsTextContent: !0,
|
|
976
|
-
allowsChildren: !0,
|
|
977
|
-
allowedAttributes: [],
|
|
978
|
-
childTags: []
|
|
979
|
-
}, h1 = {
|
|
980
|
-
allowsTextContent: !0,
|
|
981
|
-
allowsChildren: !0,
|
|
982
|
-
allowedAttributes: [],
|
|
983
|
-
childTags: []
|
|
984
|
-
}, h2 = {
|
|
985
|
-
allowsTextContent: !0,
|
|
986
|
-
allowsChildren: !0,
|
|
987
|
-
allowedAttributes: [],
|
|
988
|
-
childTags: []
|
|
989
|
-
}, span = {
|
|
990
|
-
allowsTextContent: !0,
|
|
991
|
-
allowsChildren: !0,
|
|
992
|
-
allowedAttributes: [],
|
|
993
|
-
childTags: []
|
|
994
|
-
}, img = {
|
|
995
|
-
allowsTextContent: !1,
|
|
996
|
-
allowsChildren: !1,
|
|
997
|
-
allowedAttributes: [
|
|
998
|
-
"src",
|
|
999
|
-
"alt",
|
|
1000
|
-
"width",
|
|
1001
|
-
"height",
|
|
1002
|
-
"loading"
|
|
1003
|
-
]
|
|
1004
|
-
}, button = {
|
|
1005
|
-
allowsTextContent: !0,
|
|
1006
|
-
allowsChildren: !0,
|
|
1007
|
-
allowedAttributes: [
|
|
1008
|
-
"type",
|
|
1009
|
-
"disabled",
|
|
1010
|
-
"name",
|
|
1011
|
-
"value"
|
|
1012
|
-
],
|
|
1013
|
-
childTags: []
|
|
1014
|
-
}, table = {
|
|
1015
|
-
allowsTextContent: !1,
|
|
1016
|
-
allowsChildren: !0,
|
|
1017
|
-
allowedAttributes: [
|
|
1018
|
-
"border",
|
|
1019
|
-
"cellpadding",
|
|
1020
|
-
"cellspacing"
|
|
1021
|
-
],
|
|
1022
|
-
childTags: [
|
|
1023
|
-
"caption",
|
|
1024
|
-
"colgroup",
|
|
1025
|
-
"thead",
|
|
1026
|
-
"tbody",
|
|
1027
|
-
"tfoot",
|
|
1028
|
-
"tr"
|
|
1029
|
-
]
|
|
1030
|
-
}, thead = {
|
|
1031
|
-
allowsTextContent: !1,
|
|
1032
|
-
allowsChildren: !0,
|
|
1033
|
-
allowedAttributes: [],
|
|
1034
|
-
childTags: [
|
|
1035
|
-
"tr"
|
|
1036
|
-
]
|
|
1037
|
-
}, tbody = {
|
|
1038
|
-
allowsTextContent: !1,
|
|
1039
|
-
allowsChildren: !0,
|
|
1040
|
-
allowedAttributes: [],
|
|
1041
|
-
childTags: [
|
|
1042
|
-
"tr"
|
|
1043
|
-
]
|
|
1044
|
-
}, tfoot = {
|
|
1045
|
-
allowsTextContent: !1,
|
|
1046
|
-
allowsChildren: !0,
|
|
1047
|
-
allowedAttributes: [],
|
|
1048
|
-
childTags: [
|
|
1049
|
-
"tr"
|
|
1050
|
-
]
|
|
1051
|
-
}, tr = {
|
|
1052
|
-
allowsTextContent: !1,
|
|
1053
|
-
allowsChildren: !0,
|
|
1054
|
-
allowedAttributes: [],
|
|
1055
|
-
childTags: [
|
|
1056
|
-
"td",
|
|
1057
|
-
"th"
|
|
1058
|
-
]
|
|
1059
|
-
}, th = {
|
|
1060
|
-
allowsTextContent: !0,
|
|
1061
|
-
allowsChildren: !0,
|
|
1062
|
-
allowedAttributes: [
|
|
1063
|
-
"scope",
|
|
1064
|
-
"colspan",
|
|
1065
|
-
"rowspan"
|
|
1066
|
-
],
|
|
1067
|
-
childTags: []
|
|
1068
|
-
}, td = {
|
|
1069
|
-
allowsTextContent: !0,
|
|
1070
|
-
allowsChildren: !0,
|
|
1071
|
-
allowedAttributes: [
|
|
1072
|
-
"colspan",
|
|
1073
|
-
"rowspan"
|
|
1074
|
-
],
|
|
1075
|
-
childTags: []
|
|
1076
|
-
}, datalist = {
|
|
1077
|
-
allowsTextContent: !1,
|
|
1078
|
-
allowsChildren: !0,
|
|
1079
|
-
allowedAttributes: [],
|
|
1080
|
-
childTags: [
|
|
1081
|
-
"option"
|
|
1082
|
-
]
|
|
1083
|
-
}, option = {
|
|
1084
|
-
allowsTextContent: !0,
|
|
1085
|
-
allowsChildren: !1,
|
|
1086
|
-
allowedAttributes: [
|
|
1087
|
-
"value",
|
|
1088
|
-
"label",
|
|
1089
|
-
"selected",
|
|
1090
|
-
"disabled"
|
|
1091
|
-
]
|
|
1092
|
-
}, header = {
|
|
1093
|
-
allowsTextContent: !1,
|
|
1094
|
-
allowsChildren: !0,
|
|
1095
|
-
allowedAttributes: [
|
|
1096
|
-
"role"
|
|
1097
|
-
],
|
|
1098
|
-
childTags: []
|
|
1099
|
-
}, a = {
|
|
1100
|
-
allowsTextContent: !0,
|
|
1101
|
-
allowsChildren: !0,
|
|
1102
|
-
allowedAttributes: [
|
|
1103
|
-
"href",
|
|
1104
|
-
"target",
|
|
1105
|
-
"rel",
|
|
1106
|
-
"title",
|
|
1107
|
-
"download"
|
|
1108
|
-
],
|
|
1109
|
-
childTags: []
|
|
1110
|
-
}, i = {
|
|
1111
|
-
allowsTextContent: !0,
|
|
1112
|
-
allowsChildren: !0,
|
|
1113
|
-
allowedAttributes: [
|
|
1114
|
-
"aria-hidden"
|
|
1115
|
-
],
|
|
1116
|
-
childTags: []
|
|
1117
|
-
}, small = {
|
|
1118
|
-
allowsTextContent: !0,
|
|
1119
|
-
allowsChildren: !0,
|
|
1120
|
-
allowedAttributes: [],
|
|
1121
|
-
childTags: []
|
|
1122
|
-
}, ul = {
|
|
1123
|
-
allowsTextContent: !1,
|
|
1124
|
-
allowsChildren: !0,
|
|
1125
|
-
allowedAttributes: [
|
|
1126
|
-
"type"
|
|
1127
|
-
],
|
|
1128
|
-
childTags: [
|
|
1129
|
-
"li"
|
|
1130
|
-
]
|
|
1131
|
-
}, li = {
|
|
1132
|
-
allowsTextContent: !0,
|
|
1133
|
-
allowsChildren: !0,
|
|
1134
|
-
allowedAttributes: [
|
|
1135
|
-
"value"
|
|
1136
|
-
],
|
|
1137
|
-
childTags: []
|
|
1138
|
-
}, hr = {
|
|
1139
|
-
allowsTextContent: !1,
|
|
1140
|
-
allowsChildren: !1,
|
|
1141
|
-
allowedAttributes: []
|
|
1142
|
-
}, defaultTags = {
|
|
1143
|
-
$schema,
|
|
1144
|
-
div,
|
|
1145
|
-
input,
|
|
1146
|
-
checkbox,
|
|
1147
|
-
colgroup,
|
|
1148
|
-
col,
|
|
1149
|
-
label,
|
|
1150
|
-
form,
|
|
1151
|
-
select,
|
|
1152
|
-
p,
|
|
1153
|
-
h1,
|
|
1154
|
-
h2,
|
|
1155
|
-
span,
|
|
1156
|
-
img,
|
|
1157
|
-
button,
|
|
1158
|
-
table,
|
|
1159
|
-
thead,
|
|
1160
|
-
tbody,
|
|
1161
|
-
tfoot,
|
|
1162
|
-
tr,
|
|
1163
|
-
th,
|
|
1164
|
-
td,
|
|
1165
|
-
datalist,
|
|
1166
|
-
option,
|
|
1167
|
-
header,
|
|
1168
|
-
a,
|
|
1169
|
-
i,
|
|
1170
|
-
small,
|
|
1171
|
-
ul,
|
|
1172
|
-
li,
|
|
1173
|
-
hr
|
|
1174
|
-
}, extractTags = ({ inSpec: t }) => {
|
|
1175
|
-
const e = t;
|
|
1176
|
-
if (!e) return [];
|
|
1177
|
-
if (Array.isArray(e))
|
|
1178
|
-
return e.flatMap((o) => extractTags({ inSpec: o }));
|
|
1179
|
-
if (typeof e != "object") return [];
|
|
1180
|
-
const n = [];
|
|
1181
|
-
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((o) => {
|
|
1182
|
-
const r = extractTags({ inSpec: o });
|
|
1183
|
-
n.push(...r);
|
|
1184
|
-
}), n;
|
|
1185
|
-
}, checkTags = ({ inTagsFound: t, inAllowedTags: e }) => {
|
|
1186
|
-
const n = t ?? [], o = e ?? {}, r = new Set(
|
|
1187
|
-
Object.keys(o).filter((u) => u !== "$schema").map((u) => u.toLowerCase())
|
|
1188
|
-
), l = {}, s = [], c = [];
|
|
1189
|
-
n.forEach((u) => {
|
|
1190
|
-
l[u] = (l[u] || 0) + 1, r.has(u) ? s.includes(u) || s.push(u) : c.includes(u) || c.push(u);
|
|
1191
|
-
});
|
|
1192
|
-
const d = n.length, b = c.length === 0;
|
|
1193
|
-
return {
|
|
1194
|
-
totalTags: d,
|
|
1195
|
-
tagCounts: l,
|
|
1196
|
-
uniqueTags: Object.keys(l),
|
|
1197
|
-
recognizedTags: s,
|
|
1198
|
-
unrecognizedTags: c,
|
|
1199
|
-
areAllTagsPresent: b
|
|
1200
|
-
};
|
|
1201
|
-
}, reviewSpec = ({ inSpec: t, inTags: e = defaultTags } = {}) => {
|
|
1202
|
-
const n = t, o = e, r = extractTags({ inSpec: n }), l = checkTags({
|
|
1203
|
-
inTagsFound: r,
|
|
1204
|
-
inAllowedTags: o
|
|
1205
|
-
});
|
|
1206
|
-
return {
|
|
1207
|
-
areAllTagsPresent: l.areAllTagsPresent,
|
|
1208
|
-
totalTags: l.totalTags,
|
|
1209
|
-
tagCounts: l.tagCounts,
|
|
1210
|
-
uniqueTags: l.uniqueTags,
|
|
1211
|
-
recognizedTags: l.recognizedTags,
|
|
1212
|
-
unrecognizedTags: l.unrecognizedTags
|
|
1213
|
-
};
|
|
1214
|
-
}, buildSpecElement = (t = {}) => {
|
|
1215
|
-
try {
|
|
1216
|
-
const e = t, n = (e == null ? void 0 : e.spec) ?? (e == null ? void 0 : e.inSpec) ?? e;
|
|
1217
|
-
return dispatchSpec({
|
|
1218
|
-
inSpec: n
|
|
1219
|
-
});
|
|
1220
|
-
} catch (e) {
|
|
1221
|
-
throw console.error("error : ", e), e;
|
|
1222
|
-
}
|
|
1223
|
-
};
|
|
1224
|
-
registerGlobal({
|
|
1225
|
-
inFuncDefinition: buildSpecElement,
|
|
1226
|
-
inReviewSpec: reviewSpec
|
|
1227
|
-
});
|
|
1228
|
-
const startFunc$k = ({
|
|
1229
|
-
inStructureJson: t,
|
|
1230
|
-
inDataAsJson: e,
|
|
1231
|
-
inShowLog: n = !1
|
|
1232
|
-
} = {}) => {
|
|
1233
|
-
const o = t, r = e, l = n, s = buildSpecElement$1({
|
|
1234
|
-
specJson: o,
|
|
1235
|
-
dataJson: r,
|
|
1236
|
-
showLog: l
|
|
1237
|
-
});
|
|
1238
|
-
return l && console.log("specAsJsonToDom : ", s), buildSpecElement(s);
|
|
1239
|
-
}, startFunc$j = ({ inTargetHtmlId: t } = {}) => {
|
|
1240
|
-
const e = t;
|
|
1241
|
-
return typeof e == "string" ? document.getElementById(e) : e ?? null;
|
|
1242
|
-
}, startFunc$i = ({ inEvent: t, inColumns: e, inData: n } = {}) => {
|
|
1243
|
-
var T, S, A;
|
|
1244
|
-
const o = t, r = e, l = n, s = (T = o == null ? void 0 : o.target) == null ? void 0 : T.closest("button");
|
|
1245
|
-
if (!s) return null;
|
|
1246
|
-
const c = s.closest("tr"), d = s.closest("td");
|
|
1247
|
-
if (!c || !d) return null;
|
|
1248
|
-
const b = c.sectionRowIndex, u = (S = r == null ? void 0 : r[d.cellIndex]) == null ? void 0 : S.key, h = (A = l == null ? void 0 : l[b]) == null ? void 0 : A[u];
|
|
1249
|
-
return !Array.isArray(h) || h.length === 0 ? null : {
|
|
1250
|
-
parentRowIndex: b,
|
|
1251
|
-
childColumnKey: u,
|
|
1252
|
-
childTableData: h
|
|
1253
|
-
};
|
|
1254
|
-
}, startFunc$h = ({ inTargetHtmlId: t, inChildColumnKey: e } = {}) => {
|
|
1255
|
-
const n = t, o = e, r = typeof n == "string" ? document.getElementById(n) : n;
|
|
1256
|
-
if (!r) return null;
|
|
1257
|
-
const l = `${r.id || "table"}-${o}`;
|
|
1258
|
-
let s = document.getElementById(l);
|
|
1259
|
-
return s || (s = document.createElement("div"), s.id = l, s.className = "child-table-container mt-3", r.insertAdjacentElement("afterend", s)), s;
|
|
1260
|
-
}, startFunc$g = ({ inChildTableContainer: t, inParentRowIndex: e } = {}) => {
|
|
1261
|
-
const n = t, o = e, r = n.dataset.activeRow === String(o), l = n.style.display !== "none";
|
|
1262
|
-
return r && l ? (n.style.display = "none", !0) : !1;
|
|
1263
|
-
}, startFunc$f = ({ inChildTableContainer: t, inClickedRowDetails: e } = {}) => {
|
|
1264
|
-
const n = t, o = e;
|
|
1265
|
-
return n.style.display = "", n.dataset.activeRow = String(o.parentRowIndex), n.dataset.fieldName = o.childColumnKey, n.innerHTML = "", n.childData = o.childTableData, n;
|
|
1266
|
-
}, startFunc$e = ({ inEvent: t, inTargetHtmlId: e, inColumns: n, inData: o } = {}) => {
|
|
1267
|
-
const r = t, l = e, d = startFunc$i({
|
|
1268
|
-
inEvent: r,
|
|
1269
|
-
inColumns: n,
|
|
1270
|
-
inData: o
|
|
1271
|
-
});
|
|
1272
|
-
if (!d) return null;
|
|
1273
|
-
const b = startFunc$h({
|
|
1274
|
-
inTargetHtmlId: l,
|
|
1275
|
-
inChildColumnKey: d.childColumnKey
|
|
1276
|
-
});
|
|
1277
|
-
return !b || startFunc$g({
|
|
1278
|
-
inChildTableContainer: b,
|
|
1279
|
-
inParentRowIndex: d.parentRowIndex
|
|
1280
|
-
}) ? null : startFunc$f({
|
|
1281
|
-
inChildTableContainer: b,
|
|
1282
|
-
inClickedRowDetails: d
|
|
1283
|
-
});
|
|
1284
|
-
}, deriveColumnsFromData = ({ inData: t = [] } = {}) => {
|
|
1285
|
-
const e = t;
|
|
1286
|
-
if (!Array.isArray(e) || e.length === 0)
|
|
1287
|
-
return [];
|
|
1288
|
-
const n = e[0];
|
|
1289
|
-
return !n || typeof n != "object" ? [] : Object.keys(n).map((o) => ({
|
|
1290
|
-
key: o,
|
|
1291
|
-
label: o
|
|
1292
|
-
}));
|
|
1293
|
-
}, startFunc$d = ({ inChildTableContainer: t, inContainer: e, inRenderFunc: n } = {}) => {
|
|
1294
|
-
const o = t, r = e, l = n, s = o || r, c = s == null ? void 0 : s.childData;
|
|
1295
|
-
l({
|
|
1296
|
-
inTargetHtmlId: s,
|
|
1297
|
-
inColumns: deriveColumnsFromData({ inData: c }),
|
|
1298
|
-
inData: c,
|
|
1299
|
-
inSkeletonType: "tableOnly"
|
|
1300
|
-
});
|
|
1301
|
-
}, clickFunc = ({
|
|
1302
|
-
inEvent: t,
|
|
1303
|
-
inData: e,
|
|
1304
|
-
inColumns: n,
|
|
1305
|
-
inRenderFunc: o,
|
|
1306
|
-
inTargetHtmlId: r
|
|
1307
|
-
} = {}) => {
|
|
1308
|
-
const l = t, s = e, c = n, d = o, u = startFunc$e({
|
|
1309
|
-
inEvent: l,
|
|
1310
|
-
inTargetHtmlId: r,
|
|
1311
|
-
inColumns: c,
|
|
1312
|
-
inData: s
|
|
1313
|
-
});
|
|
1314
|
-
u && startFunc$d({
|
|
1315
|
-
inChildTableContainer: u,
|
|
1316
|
-
inRenderFunc: d
|
|
1317
|
-
});
|
|
1318
|
-
}, startFunc$c = ({
|
|
1319
|
-
inTargetContainer: t,
|
|
1320
|
-
inData: e,
|
|
1321
|
-
inColumns: n,
|
|
1322
|
-
inRenderFunc: o,
|
|
1323
|
-
inTargetHtmlId: r
|
|
1324
|
-
} = {}) => {
|
|
1325
|
-
const l = t, s = e, c = n, d = o, b = r;
|
|
1326
|
-
l.addEventListener("click", (u) => {
|
|
1327
|
-
clickFunc({
|
|
1328
|
-
inEvent: u,
|
|
1329
|
-
inData: s,
|
|
1330
|
-
inColumns: c,
|
|
1331
|
-
inRenderFunc: d,
|
|
1332
|
-
inTargetHtmlId: b
|
|
1333
|
-
});
|
|
1334
|
-
});
|
|
1335
|
-
}, startFunc$b = ({
|
|
1336
|
-
targetHtmlId: t,
|
|
1337
|
-
inTargetHtmlId: e,
|
|
1338
|
-
inColumns: n,
|
|
1339
|
-
inData: o,
|
|
1340
|
-
inColGroup: r,
|
|
1341
|
-
inFooterData: l = [],
|
|
1342
|
-
inConfig: s = {},
|
|
1343
|
-
inSkeletonType: c = "default",
|
|
1344
|
-
inShowLog: d = !1
|
|
1345
|
-
} = {}) => {
|
|
1346
|
-
const b = e ?? t, u = o ?? [], h = n ?? deriveColumnsFromData({ inData: u }), T = r, S = l, A = s, D = c, v = d;
|
|
1347
|
-
try {
|
|
1348
|
-
const E = startFunc$s({
|
|
1349
|
-
inColumns: h,
|
|
1350
|
-
inData: u,
|
|
1351
|
-
inColGroup: T,
|
|
1352
|
-
inFooterData: S,
|
|
1353
|
-
inConfig: A
|
|
1354
|
-
}), I = startFunc$r({
|
|
1355
|
-
inSkeletonType: D,
|
|
1356
|
-
inSkeletonJson: skeletonJson$2,
|
|
1357
|
-
inFragmentsJson: fragmentsJson,
|
|
1358
|
-
inShowLog: v
|
|
1359
|
-
}), R = startFunc$k({
|
|
1360
|
-
inStructureJson: I,
|
|
1361
|
-
inDataAsJson: E,
|
|
1362
|
-
inShowLog: v
|
|
1363
|
-
}), w = startFunc$j({
|
|
1364
|
-
inTargetHtmlId: b
|
|
1365
|
-
});
|
|
1366
|
-
if (!w) return;
|
|
1367
|
-
w.innerHTML = "", startFunc$c({
|
|
1368
|
-
inTargetContainer: w,
|
|
1369
|
-
inData: u,
|
|
1370
|
-
inColumns: h,
|
|
1371
|
-
inRenderFunc: startFunc$b,
|
|
1372
|
-
inTargetHtmlId: b
|
|
1373
|
-
}), w.append(R);
|
|
1374
|
-
} catch (E) {
|
|
1375
|
-
console.log("error : ", E);
|
|
1376
|
-
}
|
|
1377
|
-
}, IDENTIFIERS = {
|
|
1378
|
-
HARD_CODED: "$",
|
|
1379
|
-
PARENT: "^",
|
|
1380
|
-
TYPE_START: "(",
|
|
1381
|
-
TYPE_END: ")",
|
|
1382
|
-
ACTION_START: "{",
|
|
1383
|
-
ACTION_END: "}",
|
|
1384
|
-
ARRAY_INDEX: "#eq(",
|
|
1385
|
-
ARRAY_START: "#eq(",
|
|
1386
|
-
ARRAY_END: ")"
|
|
1387
|
-
}, VALUES = {
|
|
1388
|
-
DEFAULT: void 0
|
|
1389
|
-
}, resolvePath = (t, e) => {
|
|
1390
|
-
if (t === "")
|
|
1391
|
-
return e;
|
|
1392
|
-
const o = t.replace(/\[(\w+)\]/g, ". $1".replace(" ", "")).replace(/^\./, "").split(".");
|
|
1393
|
-
for (let r = 0; r < o.length; ) {
|
|
1394
|
-
if (Array.isArray(e)) {
|
|
1395
|
-
const c = o.slice(r).join(".");
|
|
1396
|
-
return e.map((d) => resolvePath(c, d));
|
|
1397
|
-
}
|
|
1398
|
-
if (typeof e != "object" || e === null)
|
|
1399
|
-
return VALUES.DEFAULT;
|
|
1400
|
-
let l, s = 0;
|
|
1401
|
-
for (let c = o.length; c > r; c -= 1) {
|
|
1402
|
-
const d = o.slice(r, c).join(".");
|
|
1403
|
-
if (Object.prototype.hasOwnProperty.call(e, d)) {
|
|
1404
|
-
l = d, s = c - r;
|
|
1405
|
-
break;
|
|
1406
|
-
}
|
|
1407
|
-
}
|
|
1408
|
-
if (l === void 0)
|
|
1409
|
-
return VALUES.DEFAULT;
|
|
1410
|
-
e = e[l], r += s;
|
|
1411
|
-
}
|
|
1412
|
-
return e;
|
|
1413
|
-
}, 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) => {
|
|
1414
|
-
if (!t) return t;
|
|
1415
|
-
try {
|
|
1416
|
-
return new Date(t).getTime();
|
|
1417
|
-
} catch {
|
|
1418
|
-
return t;
|
|
1419
|
-
}
|
|
1420
|
-
}, deleteKey = () => {
|
|
1421
|
-
}, deleteIfNotPresent = (t) => typeof t > "u" ? void 0 : t, typeToFn = {
|
|
1422
|
-
STRING: convertToString,
|
|
1423
|
-
NUMBER: convertToNumber,
|
|
1424
|
-
DATE: convertToDate,
|
|
1425
|
-
UPPER: convertToUpperCase
|
|
1426
|
-
}, extractSpecial = (t) => {
|
|
1427
|
-
const e = t.indexOf(IDENTIFIERS.TYPE_START) > -1 ? IDENTIFIERS.TYPE_START : t.indexOf(IDENTIFIERS.ACTION_START) > -1 ? IDENTIFIERS.ACTION_START : null;
|
|
1428
|
-
if (!e) return null;
|
|
1429
|
-
const n = e === IDENTIFIERS.TYPE_START ? IDENTIFIERS.TYPE_END : IDENTIFIERS.ACTION_END;
|
|
1430
|
-
return {
|
|
1431
|
-
kind: e,
|
|
1432
|
-
type: t.substring(t.indexOf(e) + 1, t.lastIndexOf(n)),
|
|
1433
|
-
path: t.substring(0, t.indexOf(e))
|
|
1434
|
-
};
|
|
1435
|
-
}, evaluateExpression = (value, key, source, config) => {
|
|
1436
|
-
const resolvedKey = resolvePath(key, source);
|
|
1437
|
-
if (!config[resolvedKey]) return resolvedKey;
|
|
1438
|
-
const { operator, value: expressionValue } = config[resolvedKey];
|
|
1439
|
-
return !operators.includes(operator) || !isNumber(expressionValue) ? resolvedKey : eval(`${value}${operator}${expressionValue}`);
|
|
1440
|
-
}, createActionMap = ({ convertValue: t }) => ({
|
|
1441
|
-
APPEND: (e, n, o, r) => {
|
|
1442
|
-
const l = r == null ? void 0 : r.appendMap;
|
|
1443
|
-
if (!l || typeof l[n] > "u") return e;
|
|
1444
|
-
const { path: s, separator: c } = l[n];
|
|
1445
|
-
return e + (c || "") + t(s, o);
|
|
1446
|
-
},
|
|
1447
|
-
DELETE: deleteKey,
|
|
1448
|
-
DELETE_IF_NOT_PRESENT: deleteIfNotPresent,
|
|
1449
|
-
DEPENDS: (e, n, o, r) => {
|
|
1450
|
-
if (typeof n > "u") return r.dependentMap[e];
|
|
1451
|
-
const l = extractSpecial(n);
|
|
1452
|
-
return l && actionMap[l.type] ? actionMap[l.type](e, l.path, o, r) : n;
|
|
1453
|
-
},
|
|
1454
|
-
EVAL: evaluateExpression
|
|
1455
|
-
});
|
|
1456
|
-
let actionMap = {};
|
|
1457
|
-
const convertType = (t, e) => typeToFn[t] ? typeToFn[t](e) : e, performAction = (t, e, n, o, r, l) => {
|
|
1458
|
-
actionMap = createActionMap({ convertValue: l });
|
|
1459
|
-
const s = extractSpecial(t);
|
|
1460
|
-
return s && actionMap[s.type] ? actionMap[s.type](e, s.path, o, r) : actionMap[t] ? actionMap[t](e, void 0, o, r) : e;
|
|
1461
|
-
}, resolveValue = (t, e, n, o) => {
|
|
1462
|
-
if (t.startsWith(IDENTIFIERS.HARD_CODED))
|
|
1463
|
-
return t.substring(1);
|
|
1464
|
-
if (t.startsWith(IDENTIFIERS.PARENT))
|
|
1465
|
-
return resolvePath(t.substring(1), n);
|
|
1466
|
-
const r = extractSpecial(t);
|
|
1467
|
-
if (!r)
|
|
1468
|
-
return resolvePath(t, e);
|
|
1469
|
-
const l = resolvePath(r.path, e);
|
|
1470
|
-
return typeof l > "u" ? VALUES.DEFAULT : r.kind === IDENTIFIERS.TYPE_START ? convertType(r.type, l) : performAction(
|
|
1471
|
-
r.type,
|
|
1472
|
-
l,
|
|
1473
|
-
r.path,
|
|
1474
|
-
e,
|
|
1475
|
-
o,
|
|
1476
|
-
(s, c) => resolveValue(s, c, n, o)
|
|
1477
|
-
);
|
|
1478
|
-
}, startFunc$a = (t, e, n) => {
|
|
1479
|
-
const o = {};
|
|
1480
|
-
return Object.keys(t).forEach((r) => {
|
|
1481
|
-
const l = t[r];
|
|
1482
|
-
if (typeof l == "string") {
|
|
1483
|
-
o[r] = resolveValue(
|
|
1484
|
-
l,
|
|
1485
|
-
e,
|
|
1486
|
-
n.rootSource,
|
|
1487
|
-
n.configuration
|
|
1488
|
-
);
|
|
1489
|
-
return;
|
|
1490
|
-
}
|
|
1491
|
-
if (Array.isArray(l) && l.length > 0) {
|
|
1492
|
-
o[r] = startFunc$3(l[0], e, n);
|
|
1493
|
-
return;
|
|
1494
|
-
}
|
|
1495
|
-
l && typeof l == "object" && (o[r] = traverse(l, e, n));
|
|
1496
|
-
}), o;
|
|
1497
|
-
}, startFunc$9 = (t, e, n) => {
|
|
1498
|
-
const o = [];
|
|
1499
|
-
return t.forEach((r) => {
|
|
1500
|
-
if (typeof r == "string") {
|
|
1501
|
-
const l = resolveValue(
|
|
1502
|
-
r,
|
|
1503
|
-
e,
|
|
1504
|
-
n.rootSource,
|
|
1505
|
-
n.configuration
|
|
1506
|
-
);
|
|
1507
|
-
isNonEmptyArray(l) ? o.push(...l) : o.push(l);
|
|
1508
|
-
return;
|
|
1509
|
-
}
|
|
1510
|
-
if (Array.isArray(r)) {
|
|
1511
|
-
o.push(
|
|
1512
|
-
...startFunc$9(
|
|
1513
|
-
r[0],
|
|
1514
|
-
e,
|
|
1515
|
-
n
|
|
1516
|
-
)
|
|
1517
|
-
);
|
|
1518
|
-
return;
|
|
1519
|
-
}
|
|
1520
|
-
r && typeof r == "object" && o.push(
|
|
1521
|
-
startFunc$a(
|
|
1522
|
-
r,
|
|
1523
|
-
e,
|
|
1524
|
-
n
|
|
1525
|
-
)
|
|
1526
|
-
);
|
|
1527
|
-
}), o;
|
|
1528
|
-
}, startFunc$8 = (t, e, n) => [
|
|
1529
|
-
startFunc$a(
|
|
1530
|
-
e,
|
|
1531
|
-
t,
|
|
1532
|
-
n
|
|
1533
|
-
)
|
|
1534
|
-
], startFunc$7 = (t, e, n) => t.map((o) => startFunc$a(
|
|
1535
|
-
e,
|
|
1536
|
-
o,
|
|
1537
|
-
n
|
|
1538
|
-
));
|
|
1539
|
-
function isPlainObject(t) {
|
|
1540
|
-
return t !== null && typeof t == "object" && Object.getPrototypeOf(t) === Object.prototype;
|
|
1541
|
-
}
|
|
1542
|
-
const startFunc$6 = (t, e, n) => Array.isArray(t) ? startFunc$7(
|
|
1543
|
-
t,
|
|
1544
|
-
e,
|
|
1545
|
-
n
|
|
1546
|
-
) : isPlainObject(t) ? startFunc$8(
|
|
1547
|
-
t,
|
|
1548
|
-
e,
|
|
1549
|
-
n
|
|
1550
|
-
) : [], isArrayIndexMapping = (t) => {
|
|
1551
|
-
const e = t.list;
|
|
1552
|
-
return e.startsWith(IDENTIFIERS.ARRAY_INDEX) && e.includes(IDENTIFIERS.ARRAY_START) && e.includes(IDENTIFIERS.ARRAY_END);
|
|
1553
|
-
}, getItemMapping$1 = (t) => Array.isArray(t.item) ? t.item[0] : t.item, resolveListSource = (t, e) => resolvePath(
|
|
1554
|
-
t.list,
|
|
1555
|
-
e
|
|
1556
|
-
), startFunc$5 = (t, e, n) => {
|
|
1557
|
-
const o = getItemMapping$1(t);
|
|
1558
|
-
if (isArrayIndexMapping(t))
|
|
1559
|
-
return [
|
|
1560
|
-
startFunc$a(
|
|
1561
|
-
o,
|
|
1562
|
-
e,
|
|
1563
|
-
n
|
|
1564
|
-
)
|
|
1565
|
-
];
|
|
1566
|
-
const r = resolveListSource(
|
|
1567
|
-
t,
|
|
1568
|
-
e
|
|
1569
|
-
);
|
|
1570
|
-
return startFunc$6(
|
|
1571
|
-
r,
|
|
1572
|
-
o,
|
|
1573
|
-
n
|
|
1574
|
-
);
|
|
1575
|
-
}, getItemMapping = (t) => Array.isArray(t.item) ? t.item[0] : t.item, resolveObjectifySource = (t, e) => resolvePath(
|
|
1576
|
-
t.objectify,
|
|
1577
|
-
e
|
|
1578
|
-
), startFunc$4 = (t, e, n) => {
|
|
1579
|
-
const o = resolveObjectifySource(
|
|
1580
|
-
t,
|
|
1581
|
-
e
|
|
1582
|
-
);
|
|
1583
|
-
return startFunc$8(
|
|
1584
|
-
o,
|
|
1585
|
-
getItemMapping(t),
|
|
1586
|
-
n
|
|
1587
|
-
);
|
|
1588
|
-
}, startFunc$3 = (t, e, n) => typeof t.collect < "u" ? startFunc$9(
|
|
1589
|
-
t.item,
|
|
1590
|
-
e,
|
|
1591
|
-
n
|
|
1592
|
-
) : typeof t.list < "u" ? startFunc$5(
|
|
1593
|
-
t,
|
|
1594
|
-
e,
|
|
1595
|
-
n
|
|
1596
|
-
) : typeof t.objectify < "u" ? startFunc$4(
|
|
1597
|
-
t,
|
|
1598
|
-
e,
|
|
1599
|
-
n
|
|
1600
|
-
) : [], startFunc$2 = (t, e) => {
|
|
1601
|
-
if (!t.includes(IDENTIFIERS.ARRAY_INDEX)) return {};
|
|
1602
|
-
const n = t.lastIndexOf(IDENTIFIERS.ARRAY_INDEX) + 4, o = t.lastIndexOf(IDENTIFIERS.ARRAY_END), r = t.substring(n, o), l = t.substring(0, t.lastIndexOf(IDENTIFIERS.ARRAY_INDEX)), s = l ? resolvePath(l, e) : e;
|
|
1603
|
-
return s == null ? void 0 : s[r];
|
|
1604
|
-
}, traverse = (t, e, n) => {
|
|
1605
|
-
if (typeof t.list < "u" || typeof t.objectify < "u" || typeof t.collect < "u")
|
|
1606
|
-
return startFunc$3(t, e, n);
|
|
1607
|
-
if (typeof t.flat < "u") {
|
|
1608
|
-
const o = startFunc$2(t.flat, e);
|
|
1609
|
-
return startFunc$a(t.item, o, n);
|
|
1610
|
-
}
|
|
1611
|
-
return typeof t.item < "u" ? startFunc$a(t.item, e, n) : startFunc$a(t, e, n);
|
|
1612
|
-
}, transform = (t, e) => {
|
|
1613
|
-
let n = t, o = e;
|
|
1614
|
-
t !== null && typeof t == "object" && "inData" in t && e === void 0 && (n = t.inData, o = t.inTransformation);
|
|
1615
|
-
const { mapping: r, config: l = {} } = o;
|
|
1616
|
-
return traverse(r, n, {
|
|
1617
|
-
rootSource: n,
|
|
1618
|
-
configuration: l
|
|
1619
|
-
});
|
|
1620
|
-
}, transformHelper = { transform }, old = {
|
|
1621
|
-
tagName: "datalist",
|
|
1622
|
-
attributes: {
|
|
1623
|
-
id: "LedgerName"
|
|
1624
|
-
},
|
|
1625
|
-
jsonToSpec: {
|
|
1626
|
-
operation: "loopArray",
|
|
1627
|
-
source: "LedgerName",
|
|
1628
|
-
template: {
|
|
1629
|
-
tagName: "option",
|
|
1630
|
-
attributes: {
|
|
1631
|
-
value: "${}"
|
|
1632
|
-
},
|
|
1633
|
-
textContent: "${}"
|
|
1634
|
-
}
|
|
1635
|
-
},
|
|
1636
|
-
children: []
|
|
1637
|
-
}, skeletonJson$1 = {
|
|
1638
|
-
old,
|
|
1639
|
-
default: {
|
|
1640
|
-
mapping: {
|
|
1641
|
-
tagName: "$datalist",
|
|
1642
|
-
attributes: {
|
|
1643
|
-
id: "$LedgerName"
|
|
1644
|
-
},
|
|
1645
|
-
children: {
|
|
1646
|
-
list: "LedgerName",
|
|
1647
|
-
item: {
|
|
1648
|
-
tagName: "$option",
|
|
1649
|
-
attributes: {
|
|
1650
|
-
value: ""
|
|
1651
|
-
},
|
|
1652
|
-
textContent: ""
|
|
1653
|
-
}
|
|
1654
|
-
}
|
|
1655
|
-
}
|
|
1656
|
-
}
|
|
1657
|
-
}, startFunc$1 = ({ targetHtmlId: t, inData: e, inSkeletonType: n = "default" } = {}) => {
|
|
1658
|
-
const o = skeletonJson$1[n], r = transformHelper.transform(e, o), l = document.getElementById(t);
|
|
1659
|
-
l && (l.innerHTML = "");
|
|
1660
|
-
const s = buildSpecElement(r);
|
|
1661
|
-
Array.isArray(s) ? s.forEach((c) => l.append(c)) : l.append(s);
|
|
1662
|
-
}, skeletonJson = {
|
|
1663
|
-
default: {
|
|
1664
|
-
mapping: {
|
|
1665
|
-
tagName: "$select",
|
|
1666
|
-
attributes: {
|
|
1667
|
-
id: "$LedgerName",
|
|
1668
|
-
class: "$keshav"
|
|
1669
|
-
},
|
|
1670
|
-
children: [
|
|
1671
|
-
{
|
|
1672
|
-
list: "LedgerName",
|
|
1673
|
-
item: {
|
|
1674
|
-
tagName: "$option",
|
|
1675
|
-
attributes: {
|
|
1676
|
-
value: ""
|
|
1677
|
-
},
|
|
1678
|
-
textContent: ""
|
|
1679
|
-
}
|
|
1680
|
-
}
|
|
1681
|
-
]
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1684
|
-
}, startFunc = ({
|
|
1685
|
-
targetHtmlId: t,
|
|
1686
|
-
inData: e,
|
|
1687
|
-
inSkeletonType: n = "default",
|
|
1688
|
-
inClassToApply: o
|
|
1689
|
-
} = {}) => {
|
|
1690
|
-
console.log("aaaaaaaaaa");
|
|
1691
|
-
const r = skeletonJson[n];
|
|
1692
|
-
r.mapping.attributes.class = `$${o}`;
|
|
1693
|
-
debugger;
|
|
1694
|
-
const l = transformHelper.transform(e, r), s = document.getElementById(t);
|
|
1695
|
-
s && (s.innerHTML = "");
|
|
1696
|
-
const c = buildSpecElement(l);
|
|
1697
|
-
Array.isArray(c) ? c.forEach((d) => s.append(d)) : s.append(c);
|
|
1698
|
-
}, RENDERER_MAP = {
|
|
1699
|
-
table: startFunc$b,
|
|
1700
|
-
datalist: startFunc$1,
|
|
1701
|
-
select: startFunc
|
|
1702
|
-
}, render = ({
|
|
1703
|
-
type: t = "table",
|
|
1704
|
-
targetHtmlId: e,
|
|
1705
|
-
data: n,
|
|
1706
|
-
classToApply: o,
|
|
1707
|
-
inTargetHtmlId: r,
|
|
1708
|
-
inData: l,
|
|
1709
|
-
columns: s,
|
|
1710
|
-
inColumns: c,
|
|
1711
|
-
fields: d,
|
|
1712
|
-
inFields: b,
|
|
1713
|
-
tabs: u,
|
|
1714
|
-
inTabs: h,
|
|
1715
|
-
options: T,
|
|
1716
|
-
inOptions: S,
|
|
1717
|
-
datalistId: A,
|
|
1718
|
-
inDatalistId: D,
|
|
1719
|
-
listId: v,
|
|
1720
|
-
inListId: E,
|
|
1721
|
-
id: I,
|
|
1722
|
-
valueField: R,
|
|
1723
|
-
inValueField: w,
|
|
1724
|
-
labelField: W,
|
|
1725
|
-
inLabelField: q,
|
|
1726
|
-
colGroup: j,
|
|
1727
|
-
inColGroup: O,
|
|
1728
|
-
footerData: L,
|
|
1729
|
-
inFooterData: k,
|
|
1730
|
-
config: H,
|
|
1731
|
-
inConfig: P,
|
|
1732
|
-
variant: _,
|
|
1733
|
-
skeletonType: M,
|
|
1734
|
-
inSkeletonType: G,
|
|
1735
|
-
showLog: J = !1,
|
|
1736
|
-
inShowLog: U,
|
|
1737
|
-
...f
|
|
1738
|
-
} = {}) => {
|
|
1739
|
-
const F = t, m = typeof F == "string" ? F.toLowerCase() : "table", g = RENDERER_MAP[m];
|
|
1740
|
-
if (!g)
|
|
1741
|
-
return console.error(
|
|
1742
|
-
`[Renderer] Unknown renderer type "${F}". Available types: ${Object.keys(RENDERER_MAP).join(", ")}`
|
|
1743
|
-
), null;
|
|
1744
|
-
const C = r ?? e, $ = l ?? n, x = c ?? s, Y = b ?? d, B = h ?? u, y = G ?? M ?? _ ?? "default", N = U ?? J ?? !1;
|
|
1745
|
-
return g(m === "form" ? {
|
|
1746
|
-
targetHtmlId: C,
|
|
1747
|
-
inFields: Y,
|
|
1748
|
-
inData: $,
|
|
1749
|
-
inColumns: x,
|
|
1750
|
-
inVariant: y,
|
|
1751
|
-
inSkeletonType: y,
|
|
1752
|
-
inShowLog: N,
|
|
1753
|
-
onSave: f == null ? void 0 : f.onSave,
|
|
1754
|
-
afterSave: f == null ? void 0 : f.afterSave,
|
|
1755
|
-
onNew: f == null ? void 0 : f.onNew
|
|
1756
|
-
} : m === "navtabs" || m === "nav" || m === "tabs" ? {
|
|
1757
|
-
targetHtmlId: C,
|
|
1758
|
-
inTabs: B,
|
|
1759
|
-
inData: $,
|
|
1760
|
-
inSkeletonType: y,
|
|
1761
|
-
inShowLog: N
|
|
1762
|
-
} : m === "datalist" || m === "data-list" ? {
|
|
1763
|
-
targetHtmlId: C,
|
|
1764
|
-
inData: $,
|
|
1765
|
-
inSkeletonType: y,
|
|
1766
|
-
inShowLog: N
|
|
1767
|
-
} : m === "select" ? {
|
|
1768
|
-
targetHtmlId: C,
|
|
1769
|
-
inData: $,
|
|
1770
|
-
inSkeletonType: y,
|
|
1771
|
-
inShowLog: N,
|
|
1772
|
-
inClassToApply: o
|
|
1773
|
-
} : {
|
|
1774
|
-
targetHtmlId: C,
|
|
1775
|
-
inColumns: x,
|
|
1776
|
-
inData: $,
|
|
1777
|
-
inColGroup: O ?? j,
|
|
1778
|
-
inFooterData: k ?? L ?? [],
|
|
1779
|
-
inConfig: P ?? H ?? {},
|
|
1780
|
-
inSkeletonType: y,
|
|
1781
|
-
inShowLog: N
|
|
1782
|
-
});
|
|
1783
|
-
};
|
|
1784
|
-
registerGlobal$2(render);
|
|
1785
|
-
export {
|
|
1786
|
-
render as default
|
|
1787
|
-
};
|
|
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
|
+
}, startFunc$s = ({
|
|
11
|
+
inColumns: t,
|
|
12
|
+
inData: e,
|
|
13
|
+
inColGroup: n,
|
|
14
|
+
inFooterData: o = [],
|
|
15
|
+
inConfig: r = {}
|
|
16
|
+
} = {}) => {
|
|
17
|
+
var u;
|
|
18
|
+
const l = t, s = e, c = n, d = o, b = r;
|
|
19
|
+
return {
|
|
20
|
+
columns: l,
|
|
21
|
+
data: s,
|
|
22
|
+
colGroup: c,
|
|
23
|
+
foot: d,
|
|
24
|
+
title: (b == null ? void 0 : b.title) ?? ((u = b == null ? void 0 : b.caption) == null ? void 0 : u.text) ?? "",
|
|
25
|
+
footerText: (b == null ? void 0 : b.footerText) ?? ""
|
|
26
|
+
};
|
|
27
|
+
}, isNullOrUndefined$2 = ({ inSpec: t }) => {
|
|
28
|
+
const e = t;
|
|
29
|
+
return e == null;
|
|
30
|
+
}, isDomNode$2 = ({ inSpec: t }) => typeof Node < "u" && t instanceof Node, isSpecArray$2 = ({ inSpecJson: t }) => {
|
|
31
|
+
const e = t;
|
|
32
|
+
return Array.isArray(e);
|
|
33
|
+
}, buildSpecArray$2 = ({
|
|
34
|
+
inArray: t = [],
|
|
35
|
+
inFragments: e,
|
|
36
|
+
inShowLog: n = !1
|
|
37
|
+
} = {}) => {
|
|
38
|
+
const o = t, r = e;
|
|
39
|
+
return n && console.log("buildSpecArray 1 : ", o, r), Array.isArray(o) ? o.map((l) => dispatchSpec$2({
|
|
40
|
+
inSpecJson: l,
|
|
41
|
+
inFragments: r
|
|
42
|
+
})).flat().filter(Boolean) : [];
|
|
43
|
+
}, dispatchSpec$2 = ({
|
|
44
|
+
inSpecJson: t,
|
|
45
|
+
inFragments: e,
|
|
46
|
+
inShowLog: n = !1
|
|
47
|
+
} = {}) => {
|
|
48
|
+
const o = t, r = e;
|
|
49
|
+
if (n && console.log("dispatchSpec : ", o, r), isNullOrUndefined$2({ inSpec: o }))
|
|
50
|
+
return null;
|
|
51
|
+
if (isDomNode$2({ inSpec: o }))
|
|
52
|
+
return o;
|
|
53
|
+
if (isSpecArray$2({ inSpecJson: o }))
|
|
54
|
+
return buildSpecArray$2({
|
|
55
|
+
inArray: o,
|
|
56
|
+
inFragments: r
|
|
57
|
+
});
|
|
58
|
+
if (typeof o != "object")
|
|
59
|
+
return o;
|
|
60
|
+
if ("slots" in o) {
|
|
61
|
+
const {
|
|
62
|
+
slots: l,
|
|
63
|
+
children: s = [],
|
|
64
|
+
...c
|
|
65
|
+
} = o, d = Array.isArray(l) ? l.map((b) => r && b in r ? dispatchSpec$2({
|
|
66
|
+
inSpecJson: r[b],
|
|
67
|
+
inFragments: r
|
|
68
|
+
}) : null).flat().filter(Boolean) : [];
|
|
69
|
+
return {
|
|
70
|
+
...structuredClone(c),
|
|
71
|
+
children: [
|
|
72
|
+
...buildSpecArray$2({ inArray: s, inFragments: r }),
|
|
73
|
+
...d
|
|
74
|
+
]
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
return "children" in o && Array.isArray(o.children) ? {
|
|
78
|
+
...structuredClone(o),
|
|
79
|
+
children: buildSpecArray$2({
|
|
80
|
+
inArray: o.children,
|
|
81
|
+
inFragments: r
|
|
82
|
+
})
|
|
83
|
+
} : structuredClone(o);
|
|
84
|
+
}, buildSpecElement$2 = ({ inSkeleton: t, inFragments: e } = {}) => {
|
|
85
|
+
const n = t, o = e;
|
|
86
|
+
try {
|
|
87
|
+
return dispatchSpec$2({
|
|
88
|
+
inSpecJson: n,
|
|
89
|
+
inFragments: o
|
|
90
|
+
});
|
|
91
|
+
} catch (r) {
|
|
92
|
+
console.log("error : ", r);
|
|
93
|
+
}
|
|
94
|
+
}, tableSimple = {
|
|
95
|
+
tagName: "table",
|
|
96
|
+
attributes: {
|
|
97
|
+
class: "table table-hover table-striped mb-0"
|
|
98
|
+
},
|
|
99
|
+
slots: [
|
|
100
|
+
"colGroup",
|
|
101
|
+
"thead",
|
|
102
|
+
"tbody",
|
|
103
|
+
"tfoot"
|
|
104
|
+
]
|
|
105
|
+
}, bodyOnly = {
|
|
106
|
+
tagName: "table",
|
|
107
|
+
attributes: {
|
|
108
|
+
class: "table table-hover table-striped mb-0"
|
|
109
|
+
},
|
|
110
|
+
slots: [
|
|
111
|
+
"tbody"
|
|
112
|
+
]
|
|
113
|
+
}, tableOnly = {
|
|
114
|
+
tagName: "table",
|
|
115
|
+
attributes: {
|
|
116
|
+
class: "table table-hover table-striped mb-0"
|
|
117
|
+
},
|
|
118
|
+
slots: [
|
|
119
|
+
"colGroup",
|
|
120
|
+
"thead",
|
|
121
|
+
"tbody",
|
|
122
|
+
"tfoot"
|
|
123
|
+
]
|
|
124
|
+
}, tableResponsive = {
|
|
125
|
+
tagName: "div",
|
|
126
|
+
attributes: {
|
|
127
|
+
class: "table-responsive"
|
|
128
|
+
},
|
|
129
|
+
children: [
|
|
130
|
+
{
|
|
131
|
+
tagName: "table",
|
|
132
|
+
attributes: {
|
|
133
|
+
class: "table table-hover table-striped mb-0"
|
|
134
|
+
},
|
|
135
|
+
slots: [
|
|
136
|
+
"colGroup",
|
|
137
|
+
"thead",
|
|
138
|
+
"tbody",
|
|
139
|
+
"tfoot"
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
}, cardWithHeader = {
|
|
144
|
+
tagName: "div",
|
|
145
|
+
attributes: {
|
|
146
|
+
class: "card shadow-sm"
|
|
147
|
+
},
|
|
148
|
+
children: [
|
|
149
|
+
{
|
|
150
|
+
tagName: "div",
|
|
151
|
+
attributes: {
|
|
152
|
+
class: "card-header bg-white py-3"
|
|
153
|
+
},
|
|
154
|
+
slots: [
|
|
155
|
+
"cardHeader"
|
|
156
|
+
]
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
tagName: "div",
|
|
160
|
+
attributes: {
|
|
161
|
+
class: "table-responsive"
|
|
162
|
+
},
|
|
163
|
+
children: [
|
|
164
|
+
{
|
|
165
|
+
tagName: "table",
|
|
166
|
+
attributes: {
|
|
167
|
+
class: "table table-hover table-striped mb-0"
|
|
168
|
+
},
|
|
169
|
+
slots: [
|
|
170
|
+
"colGroup",
|
|
171
|
+
"thead",
|
|
172
|
+
"tbody",
|
|
173
|
+
"tfoot"
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
}, cardWithFooter = {
|
|
180
|
+
tagName: "div",
|
|
181
|
+
attributes: {
|
|
182
|
+
class: "card shadow-sm"
|
|
183
|
+
},
|
|
184
|
+
children: [
|
|
185
|
+
{
|
|
186
|
+
tagName: "div",
|
|
187
|
+
attributes: {
|
|
188
|
+
class: "table-responsive"
|
|
189
|
+
},
|
|
190
|
+
children: [
|
|
191
|
+
{
|
|
192
|
+
tagName: "table",
|
|
193
|
+
attributes: {
|
|
194
|
+
class: "table table-hover table-striped mb-0"
|
|
195
|
+
},
|
|
196
|
+
slots: [
|
|
197
|
+
"colGroup",
|
|
198
|
+
"thead",
|
|
199
|
+
"tbody",
|
|
200
|
+
"tfoot"
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
tagName: "div",
|
|
207
|
+
attributes: {
|
|
208
|
+
class: "card-footer bg-white py-2"
|
|
209
|
+
},
|
|
210
|
+
slots: [
|
|
211
|
+
"cardFooter"
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
]
|
|
215
|
+
}, cardWithHeaderAndFooter = {
|
|
216
|
+
tagName: "div",
|
|
217
|
+
attributes: {
|
|
218
|
+
class: "card shadow-sm"
|
|
219
|
+
},
|
|
220
|
+
children: [
|
|
221
|
+
{
|
|
222
|
+
tagName: "div",
|
|
223
|
+
attributes: {
|
|
224
|
+
class: "card-header bg-white py-3"
|
|
225
|
+
},
|
|
226
|
+
slots: [
|
|
227
|
+
"cardHeader"
|
|
228
|
+
]
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
tagName: "div",
|
|
232
|
+
attributes: {
|
|
233
|
+
class: "table-responsive"
|
|
234
|
+
},
|
|
235
|
+
children: [
|
|
236
|
+
{
|
|
237
|
+
tagName: "table",
|
|
238
|
+
attributes: {
|
|
239
|
+
class: "table table-hover table-striped mb-0"
|
|
240
|
+
},
|
|
241
|
+
slots: [
|
|
242
|
+
"colGroup",
|
|
243
|
+
"thead",
|
|
244
|
+
"tbody",
|
|
245
|
+
"tfoot"
|
|
246
|
+
]
|
|
247
|
+
}
|
|
248
|
+
]
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
tagName: "div",
|
|
252
|
+
attributes: {
|
|
253
|
+
class: "card-footer bg-white py-2"
|
|
254
|
+
},
|
|
255
|
+
slots: [
|
|
256
|
+
"cardFooter"
|
|
257
|
+
]
|
|
258
|
+
}
|
|
259
|
+
]
|
|
260
|
+
}, bordered = {
|
|
261
|
+
tagName: "div",
|
|
262
|
+
attributes: {
|
|
263
|
+
class: "card shadow-sm"
|
|
264
|
+
},
|
|
265
|
+
children: [
|
|
266
|
+
{
|
|
267
|
+
tagName: "div",
|
|
268
|
+
attributes: {
|
|
269
|
+
class: "table-responsive"
|
|
270
|
+
},
|
|
271
|
+
children: [
|
|
272
|
+
{
|
|
273
|
+
tagName: "table",
|
|
274
|
+
attributes: {
|
|
275
|
+
class: "table table-bordered table-hover mb-0"
|
|
276
|
+
},
|
|
277
|
+
slots: [
|
|
278
|
+
"colGroup",
|
|
279
|
+
"thead",
|
|
280
|
+
"tbody",
|
|
281
|
+
"tfoot"
|
|
282
|
+
]
|
|
283
|
+
}
|
|
284
|
+
]
|
|
285
|
+
}
|
|
286
|
+
]
|
|
287
|
+
}, borderless = {
|
|
288
|
+
tagName: "div",
|
|
289
|
+
attributes: {
|
|
290
|
+
class: "card shadow-sm"
|
|
291
|
+
},
|
|
292
|
+
children: [
|
|
293
|
+
{
|
|
294
|
+
tagName: "div",
|
|
295
|
+
attributes: {
|
|
296
|
+
class: "table-responsive"
|
|
297
|
+
},
|
|
298
|
+
children: [
|
|
299
|
+
{
|
|
300
|
+
tagName: "table",
|
|
301
|
+
attributes: {
|
|
302
|
+
class: "table table-borderless table-hover mb-0"
|
|
303
|
+
},
|
|
304
|
+
slots: [
|
|
305
|
+
"colGroup",
|
|
306
|
+
"thead",
|
|
307
|
+
"tbody",
|
|
308
|
+
"tfoot"
|
|
309
|
+
]
|
|
310
|
+
}
|
|
311
|
+
]
|
|
312
|
+
}
|
|
313
|
+
]
|
|
314
|
+
}, compact = {
|
|
315
|
+
tagName: "div",
|
|
316
|
+
attributes: {
|
|
317
|
+
class: "card shadow-sm"
|
|
318
|
+
},
|
|
319
|
+
children: [
|
|
320
|
+
{
|
|
321
|
+
tagName: "div",
|
|
322
|
+
attributes: {
|
|
323
|
+
class: "table-responsive"
|
|
324
|
+
},
|
|
325
|
+
children: [
|
|
326
|
+
{
|
|
327
|
+
tagName: "table",
|
|
328
|
+
attributes: {
|
|
329
|
+
class: "table table-sm table-hover table-striped mb-0"
|
|
330
|
+
},
|
|
331
|
+
slots: [
|
|
332
|
+
"colGroup",
|
|
333
|
+
"thead",
|
|
334
|
+
"tbody",
|
|
335
|
+
"tfoot"
|
|
336
|
+
]
|
|
337
|
+
}
|
|
338
|
+
]
|
|
339
|
+
}
|
|
340
|
+
]
|
|
341
|
+
}, dark = {
|
|
342
|
+
tagName: "div",
|
|
343
|
+
attributes: {
|
|
344
|
+
class: "card shadow-sm bg-dark text-white border-secondary"
|
|
345
|
+
},
|
|
346
|
+
children: [
|
|
347
|
+
{
|
|
348
|
+
tagName: "div",
|
|
349
|
+
attributes: {
|
|
350
|
+
class: "table-responsive"
|
|
351
|
+
},
|
|
352
|
+
children: [
|
|
353
|
+
{
|
|
354
|
+
tagName: "table",
|
|
355
|
+
attributes: {
|
|
356
|
+
class: "table table-dark table-hover mb-0"
|
|
357
|
+
},
|
|
358
|
+
slots: [
|
|
359
|
+
"colGroup",
|
|
360
|
+
"thead",
|
|
361
|
+
"tbody",
|
|
362
|
+
"tfoot"
|
|
363
|
+
]
|
|
364
|
+
}
|
|
365
|
+
]
|
|
366
|
+
}
|
|
367
|
+
]
|
|
368
|
+
}, striped = {
|
|
369
|
+
tagName: "div",
|
|
370
|
+
attributes: {
|
|
371
|
+
class: "card shadow-sm"
|
|
372
|
+
},
|
|
373
|
+
children: [
|
|
374
|
+
{
|
|
375
|
+
tagName: "div",
|
|
376
|
+
attributes: {
|
|
377
|
+
class: "table-responsive"
|
|
378
|
+
},
|
|
379
|
+
children: [
|
|
380
|
+
{
|
|
381
|
+
tagName: "table",
|
|
382
|
+
attributes: {
|
|
383
|
+
class: "table table-striped mb-0"
|
|
384
|
+
},
|
|
385
|
+
slots: [
|
|
386
|
+
"colGroup",
|
|
387
|
+
"thead",
|
|
388
|
+
"tbody",
|
|
389
|
+
"tfoot"
|
|
390
|
+
]
|
|
391
|
+
}
|
|
392
|
+
]
|
|
393
|
+
}
|
|
394
|
+
]
|
|
395
|
+
}, flush = {
|
|
396
|
+
tagName: "div",
|
|
397
|
+
attributes: {
|
|
398
|
+
class: "card border-0 shadow-none"
|
|
399
|
+
},
|
|
400
|
+
children: [
|
|
401
|
+
{
|
|
402
|
+
tagName: "div",
|
|
403
|
+
attributes: {
|
|
404
|
+
class: "table-responsive"
|
|
405
|
+
},
|
|
406
|
+
children: [
|
|
407
|
+
{
|
|
408
|
+
tagName: "table",
|
|
409
|
+
attributes: {
|
|
410
|
+
class: "table table-hover table-striped mb-0"
|
|
411
|
+
},
|
|
412
|
+
slots: [
|
|
413
|
+
"colGroup",
|
|
414
|
+
"thead",
|
|
415
|
+
"tbody",
|
|
416
|
+
"tfoot"
|
|
417
|
+
]
|
|
418
|
+
}
|
|
419
|
+
]
|
|
420
|
+
}
|
|
421
|
+
]
|
|
422
|
+
}, skeletonJson$2 = {
|
|
423
|
+
tableSimple,
|
|
424
|
+
bodyOnly,
|
|
425
|
+
default: {
|
|
426
|
+
tagName: "div",
|
|
427
|
+
attributes: {
|
|
428
|
+
class: "card shadow-sm"
|
|
429
|
+
},
|
|
430
|
+
children: [
|
|
431
|
+
{
|
|
432
|
+
tagName: "div",
|
|
433
|
+
attributes: {
|
|
434
|
+
class: "table-responsive"
|
|
435
|
+
},
|
|
436
|
+
children: [
|
|
437
|
+
{
|
|
438
|
+
tagName: "table",
|
|
439
|
+
attributes: {
|
|
440
|
+
class: "table table-hover table-striped mb-0"
|
|
441
|
+
},
|
|
442
|
+
slots: [
|
|
443
|
+
"colGroup",
|
|
444
|
+
"thead",
|
|
445
|
+
"tbody",
|
|
446
|
+
"tfoot"
|
|
447
|
+
]
|
|
448
|
+
}
|
|
449
|
+
]
|
|
450
|
+
}
|
|
451
|
+
]
|
|
452
|
+
},
|
|
453
|
+
tableOnly,
|
|
454
|
+
tableResponsive,
|
|
455
|
+
cardWithHeader,
|
|
456
|
+
cardWithFooter,
|
|
457
|
+
cardWithHeaderAndFooter,
|
|
458
|
+
bordered,
|
|
459
|
+
borderless,
|
|
460
|
+
compact,
|
|
461
|
+
dark,
|
|
462
|
+
striped,
|
|
463
|
+
flush
|
|
464
|
+
}, colGroup = {
|
|
465
|
+
tagName: "colgroup",
|
|
466
|
+
jsonToSpec: {
|
|
467
|
+
operation: "loopArray",
|
|
468
|
+
source: "colGroup",
|
|
469
|
+
template: {
|
|
470
|
+
tagName: "col",
|
|
471
|
+
attributes: {
|
|
472
|
+
style: "${style}"
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
children: []
|
|
477
|
+
}, thead$1 = {
|
|
478
|
+
tagName: "thead",
|
|
479
|
+
attributes: {
|
|
480
|
+
class: "table-dark"
|
|
481
|
+
},
|
|
482
|
+
children: [
|
|
483
|
+
{
|
|
484
|
+
tagName: "tr",
|
|
485
|
+
jsonToSpec: {
|
|
486
|
+
operation: "loopArray",
|
|
487
|
+
source: "columns",
|
|
488
|
+
template: {
|
|
489
|
+
tagName: "th",
|
|
490
|
+
textContent: "${label}"
|
|
491
|
+
}
|
|
492
|
+
},
|
|
493
|
+
children: []
|
|
494
|
+
}
|
|
495
|
+
]
|
|
496
|
+
}, tbody$1 = {
|
|
497
|
+
tagName: "tbody",
|
|
498
|
+
attributes: {
|
|
499
|
+
id: "table-body"
|
|
500
|
+
},
|
|
501
|
+
jsonToSpec: {
|
|
502
|
+
operation: "loopArray",
|
|
503
|
+
source: "data",
|
|
504
|
+
template: {
|
|
505
|
+
tagName: "tr",
|
|
506
|
+
jsonToSpec: {
|
|
507
|
+
operation: "loopObject",
|
|
508
|
+
source: "data",
|
|
509
|
+
template: {
|
|
510
|
+
tagName: "td",
|
|
511
|
+
attributes: {
|
|
512
|
+
class: "tdddddd ${value}"
|
|
513
|
+
},
|
|
514
|
+
textContent: "${value}"
|
|
515
|
+
}
|
|
516
|
+
},
|
|
517
|
+
children: []
|
|
518
|
+
}
|
|
519
|
+
},
|
|
520
|
+
children: []
|
|
521
|
+
}, tfoot$1 = {
|
|
522
|
+
tagName: "tfoot",
|
|
523
|
+
attributes: {
|
|
524
|
+
class: "table-light fw-bold"
|
|
525
|
+
},
|
|
526
|
+
jsonToSpec: {
|
|
527
|
+
operation: "loopArray",
|
|
528
|
+
source: "foot",
|
|
529
|
+
template: {
|
|
530
|
+
tagName: "tr",
|
|
531
|
+
jsonToSpec: {
|
|
532
|
+
operation: "loopObject",
|
|
533
|
+
source: "foot",
|
|
534
|
+
template: {
|
|
535
|
+
tagName: "td",
|
|
536
|
+
textContent: "${value}"
|
|
537
|
+
}
|
|
538
|
+
},
|
|
539
|
+
children: []
|
|
540
|
+
}
|
|
541
|
+
},
|
|
542
|
+
children: []
|
|
543
|
+
}, cardHeader = {
|
|
544
|
+
tagName: "div",
|
|
545
|
+
attributes: {
|
|
546
|
+
class: "d-flex justify-content-between align-items-center"
|
|
547
|
+
},
|
|
548
|
+
children: [
|
|
549
|
+
{
|
|
550
|
+
tagName: "h5",
|
|
551
|
+
attributes: {
|
|
552
|
+
class: "card-title mb-0"
|
|
553
|
+
},
|
|
554
|
+
textContent: "${title}"
|
|
555
|
+
}
|
|
556
|
+
]
|
|
557
|
+
}, cardFooter = {
|
|
558
|
+
tagName: "div",
|
|
559
|
+
attributes: {
|
|
560
|
+
class: "d-flex justify-content-between align-items-center text-muted small"
|
|
561
|
+
},
|
|
562
|
+
children: [
|
|
563
|
+
{
|
|
564
|
+
tagName: "span",
|
|
565
|
+
textContent: "${footerText}"
|
|
566
|
+
}
|
|
567
|
+
]
|
|
568
|
+
}, fragmentsJson = {
|
|
569
|
+
colGroup,
|
|
570
|
+
thead: thead$1,
|
|
571
|
+
tbody: tbody$1,
|
|
572
|
+
tfoot: tfoot$1,
|
|
573
|
+
cardHeader,
|
|
574
|
+
cardFooter
|
|
575
|
+
}, startFunc$r = ({
|
|
576
|
+
inSkeletonType: t = "default",
|
|
577
|
+
inSkeletonJson: e = skeletonJson$2,
|
|
578
|
+
inFragmentsJson: n = fragmentsJson,
|
|
579
|
+
inShowLog: o = !1
|
|
580
|
+
} = {}) => {
|
|
581
|
+
const r = t, l = e, s = n, c = o, d = l[r] ?? l.default ?? l, b = structuredClone(d);
|
|
582
|
+
c && console.log("targetSkeleton : ", b);
|
|
583
|
+
const u = buildSpecElement$2({
|
|
584
|
+
inSkeleton: b,
|
|
585
|
+
inFragments: s
|
|
586
|
+
});
|
|
587
|
+
return c && console.log("structureJson : ", u), u;
|
|
588
|
+
}, meta$1 = {
|
|
589
|
+
version: "v24.0",
|
|
590
|
+
description: "Pure spec engine no document at all"
|
|
591
|
+
}, registerGlobal$1 = (t) => {
|
|
592
|
+
typeof globalThis > "u" || !t || (globalThis.ks ?? (globalThis.ks = {}), globalThis.ks["json-to-spec"] = {
|
|
593
|
+
meta: meta$1,
|
|
594
|
+
buildSpecElement: t
|
|
595
|
+
}, globalThis.ks.jsonToSpec = {
|
|
596
|
+
meta: meta$1,
|
|
597
|
+
buildSpecElement: t
|
|
598
|
+
});
|
|
599
|
+
}, isNullOrUndefined$1 = ({ inSpec: t }) => {
|
|
600
|
+
const e = t;
|
|
601
|
+
return e == null;
|
|
602
|
+
}, isDomNode$1 = ({ inSpec: t }) => typeof Node < "u" && t instanceof Node, isSpecArray$1 = ({ inSpecJson: t }) => {
|
|
603
|
+
const e = t;
|
|
604
|
+
return Array.isArray(e);
|
|
605
|
+
}, buildSpecArray$1 = ({ inArray: t = [], inShowLog: e = !1, inDataJson: n }) => {
|
|
606
|
+
const o = t, r = e, l = n;
|
|
607
|
+
return Array.isArray(o) ? o.map((s) => dispatchSpec$1({
|
|
608
|
+
inSpecJson: s,
|
|
609
|
+
inShowLog: r,
|
|
610
|
+
inDataJson: l
|
|
611
|
+
})).flat().filter(Boolean) : [];
|
|
612
|
+
}, startFunc$q = ({ inTemplate: t, inData: e, inRowIndex: n }) => {
|
|
613
|
+
if (Number.isFinite(n)) {
|
|
614
|
+
debugger;
|
|
615
|
+
console.log("vvvvvvvvvvvvvv : ", n);
|
|
616
|
+
let o = forHashResolve({ inTemplate: t, inRowIndex: n });
|
|
617
|
+
return forDollarResolve({ inTemplate: o, inData: e });
|
|
618
|
+
} else
|
|
619
|
+
return forDollarResolve({ inTemplate: t, inData: e });
|
|
620
|
+
}, forDollarResolve = ({ inTemplate: t, inData: e }) => {
|
|
621
|
+
const n = t, o = e;
|
|
622
|
+
return typeof n != "string" ? n : n.replace(/\$\{([^}]+)\}/g, (r, l) => {
|
|
623
|
+
const s = l.trim().split(".");
|
|
624
|
+
let c = o;
|
|
625
|
+
for (const d of s) {
|
|
626
|
+
if (c == null) return "";
|
|
627
|
+
c = c[d];
|
|
628
|
+
}
|
|
629
|
+
return c == null ? "" : typeof c == "string" || typeof c == "number" || typeof c == "boolean" ? String(c ?? "") : c;
|
|
630
|
+
});
|
|
631
|
+
}, forHashResolve = ({ inTemplate: t, inRowIndex: e }) => {
|
|
632
|
+
const n = t, o = e;
|
|
633
|
+
return n.replace(/\#\{([^}]+)\}/g, (r, l) => {
|
|
634
|
+
const s = l.trim().split(".");
|
|
635
|
+
let c = o;
|
|
636
|
+
console.log("aaaaaaa : ", e, t, s);
|
|
637
|
+
for (const d of s) {
|
|
638
|
+
if (c == null) return "";
|
|
639
|
+
c = c[d];
|
|
640
|
+
}
|
|
641
|
+
return c === null || typeof c == "string" || typeof c == "number" || typeof c == "boolean" ? String(c ?? "") : c;
|
|
642
|
+
});
|
|
643
|
+
}, handleObjectData = ({ inSpec: t, inData: e, inShowLog: n }) => {
|
|
644
|
+
const o = t, r = e, l = n;
|
|
645
|
+
return "textContent" in o && (o.textContent = startFunc$q({ inTemplate: o.textContent, inData: r })), "attributes" in o && typeof o.attributes == "object" && o.attributes && (o.attributes = Object.fromEntries(
|
|
646
|
+
Object.entries(o.attributes).map(([s, c]) => [
|
|
647
|
+
s,
|
|
648
|
+
startFunc$q({ inTemplate: c, inData: r })
|
|
649
|
+
])
|
|
650
|
+
)), Array.isArray(o.children) && (o.children = o.children.map(
|
|
651
|
+
(s) => dispatchSpec$1({
|
|
652
|
+
inSpecJson: s,
|
|
653
|
+
inShowLog: l,
|
|
654
|
+
inDataJson: r
|
|
655
|
+
})
|
|
656
|
+
)), o;
|
|
657
|
+
}, startFunc$p = ({ inSpec: t, inData: e }) => {
|
|
658
|
+
const n = t, o = e, r = o.value;
|
|
659
|
+
return isSpecArray$1({ inSpecJson: r }) ? (n.children = [{
|
|
660
|
+
tagName: "button",
|
|
661
|
+
attributes: {
|
|
662
|
+
class: "btn btn-primary btn-sm"
|
|
663
|
+
},
|
|
664
|
+
textContent: r.length
|
|
665
|
+
}], delete n.textContent, n) : typeof r == "object" && r !== null && r.tagName ? (n.children = [r], delete n.textContent, n) : ("textContent" in n && (n.textContent = startFunc$q({ inTemplate: n.textContent, inData: o })), "attributes" in n && typeof n.attributes == "object" && n.attributes && (n.attributes = Object.fromEntries(
|
|
666
|
+
Object.entries(n.attributes).map(([l, s]) => [
|
|
667
|
+
l,
|
|
668
|
+
startFunc$q({ inTemplate: s, inData: o })
|
|
669
|
+
])
|
|
670
|
+
)), n);
|
|
671
|
+
}, handleStringData = ({ inSpec: t, inData: e }) => {
|
|
672
|
+
const n = t, o = e;
|
|
673
|
+
return "textContent" in n && (n.textContent === "${}" ? n.textContent = o : typeof n.textContent == "string" && (n.textContent = n.textContent.replaceAll("${}", () => o))), "attributes" in n && typeof n.attributes == "object" && n.attributes && (n.attributes = Object.fromEntries(
|
|
674
|
+
Object.entries(n.attributes).map(([r, l]) => [
|
|
675
|
+
r,
|
|
676
|
+
l === "${}" ? o : typeof l == "string" ? l.replaceAll("${}", () => o) : l
|
|
677
|
+
])
|
|
678
|
+
)), n;
|
|
679
|
+
}, startFunc$o = ({ inSpecJson: t, inData: e, inRowIndex: n, inShowLog: o = !1 } = {}) => {
|
|
680
|
+
const r = t, l = e, s = o, c = structuredClone(r);
|
|
681
|
+
return s && console.log("buildSingleElement start : ", r, l), typeof l == "string" ? handleStringData({ inSpec: c, inData: l }) : typeof l == "object" && l !== null && "key" in l && "value" in l && !("children" in c && Array.isArray(c.children) && c.children.length > 0) ? startFunc$p({ inSpec: c, inData: l }) : handleObjectData({
|
|
682
|
+
inSpec: c,
|
|
683
|
+
inData: l,
|
|
684
|
+
inShowLog: s
|
|
685
|
+
});
|
|
686
|
+
}, startFunc$n = ({ inTemplate: t, inDataAsArray: e }) => {
|
|
687
|
+
const n = e, o = t;
|
|
688
|
+
return Array.isArray(n) ? n.map((l, s) => {
|
|
689
|
+
const c = structuredClone(o);
|
|
690
|
+
return dispatchSpec$1({
|
|
691
|
+
inSpecJson: c,
|
|
692
|
+
inDataJson: l,
|
|
693
|
+
inRowIndex: s
|
|
694
|
+
});
|
|
695
|
+
}) : [];
|
|
696
|
+
}, startFunc$m = ({ inTemplate: t, inDataAsObject: e }) => {
|
|
697
|
+
const n = e, o = t;
|
|
698
|
+
if (n === null || typeof n != "object")
|
|
699
|
+
return [];
|
|
700
|
+
const r = [];
|
|
701
|
+
for (const [l, s] of Object.entries(n)) {
|
|
702
|
+
const c = structuredClone(o), d = dispatchSpec$1({
|
|
703
|
+
inSpecJson: c,
|
|
704
|
+
inDataJson: {
|
|
705
|
+
key: l,
|
|
706
|
+
value: s
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
r.push(d);
|
|
710
|
+
}
|
|
711
|
+
return r;
|
|
712
|
+
}, startFunc$l = ({
|
|
713
|
+
inSpecJson: t,
|
|
714
|
+
inShowLog: e = !1,
|
|
715
|
+
inDataJson: n,
|
|
716
|
+
inRowIndex: o
|
|
717
|
+
} = {}) => {
|
|
718
|
+
if (Number.isFinite(o) && ("attributes" in t ? t.attributes.rowIndex = o : t.attributes = {
|
|
719
|
+
rowIndex: o
|
|
720
|
+
}), !["loopArray", "loopObject"].includes(t.jsonToSpec.operation)) {
|
|
721
|
+
console.log(`inSpecJson.jsonToSpec.operation : can be loopArray or loopObject : ${t.jsonToSpec.operation}`);
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
if (t.jsonToSpec.operation === "loopArray") {
|
|
725
|
+
const r = startFunc$n({
|
|
726
|
+
inTemplate: t.jsonToSpec.template,
|
|
727
|
+
inDataAsArray: n[t.jsonToSpec.source]
|
|
728
|
+
}), {
|
|
729
|
+
jsonToSpec: l,
|
|
730
|
+
...s
|
|
731
|
+
} = t, c = {
|
|
732
|
+
...s,
|
|
733
|
+
children: r
|
|
734
|
+
};
|
|
735
|
+
return startFunc$o({
|
|
736
|
+
inSpecJson: c,
|
|
737
|
+
inShowLog: e,
|
|
738
|
+
inData: n
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
if (t.jsonToSpec.operation === "loopObject") {
|
|
742
|
+
const r = startFunc$m({
|
|
743
|
+
inTemplate: t.jsonToSpec.template,
|
|
744
|
+
inDataAsObject: n
|
|
745
|
+
}), {
|
|
746
|
+
jsonToSpec: l,
|
|
747
|
+
...s
|
|
748
|
+
} = t, c = {
|
|
749
|
+
...s,
|
|
750
|
+
children: r
|
|
751
|
+
};
|
|
752
|
+
return startFunc$o({
|
|
753
|
+
inSpecJson: c,
|
|
754
|
+
inShowLog: e,
|
|
755
|
+
inData: n
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
}, dispatchSpec$1 = ({
|
|
759
|
+
inSpecJson: t,
|
|
760
|
+
inShowLog: e = !0,
|
|
761
|
+
inDataJson: n,
|
|
762
|
+
inRowIndex: o
|
|
763
|
+
} = {}) => isNullOrUndefined$1({ inSpec: t }) ? null : isDomNode$1({ inSpec: t }) ? t : (e && console.log("dispatchSpec 3 : ", t, n), isSpecArray$1({ inSpecJson: t }) ? buildSpecArray$1({
|
|
764
|
+
inArray: t,
|
|
765
|
+
inShowLog: e,
|
|
766
|
+
inDataJson: n
|
|
767
|
+
}) : "jsonToSpec" in t ? startFunc$l({
|
|
768
|
+
inSpecJson: t,
|
|
769
|
+
inShowLog: e,
|
|
770
|
+
inDataJson: n,
|
|
771
|
+
inRowIndex: o
|
|
772
|
+
}) : startFunc$o({
|
|
773
|
+
inSpecJson: t,
|
|
774
|
+
inShowLog: e,
|
|
775
|
+
inRowIndex: o,
|
|
776
|
+
inData: n
|
|
777
|
+
})), buildSpecElement$1 = ({
|
|
778
|
+
specJson: t,
|
|
779
|
+
showLog: e = !1,
|
|
780
|
+
dataJson: n
|
|
781
|
+
}) => {
|
|
782
|
+
try {
|
|
783
|
+
return e && console.log("jsonToSpec 1 : ", t), dispatchSpec$1({
|
|
784
|
+
inSpecJson: t,
|
|
785
|
+
inShowLog: e,
|
|
786
|
+
inDataJson: n
|
|
787
|
+
});
|
|
788
|
+
} catch (o) {
|
|
789
|
+
console.log("error : ", o);
|
|
790
|
+
}
|
|
791
|
+
};
|
|
792
|
+
registerGlobal$1(buildSpecElement$1);
|
|
793
|
+
const meta = {
|
|
794
|
+
version: "v3.0",
|
|
795
|
+
description: "Pure DOM engine with JSON review and tags.json catalog verification"
|
|
796
|
+
}, registerGlobal = (t) => {
|
|
797
|
+
const e = t, n = typeof e == "function" ? e : e == null ? void 0 : e.inFuncDefinition, o = e == null ? void 0 : e.inReviewSpec;
|
|
798
|
+
typeof globalThis > "u" || !n || (globalThis.ks ?? (globalThis.ks = {}), globalThis.ks["json-to-tag"] = {
|
|
799
|
+
meta,
|
|
800
|
+
buildSpecElement: n,
|
|
801
|
+
reviewSpec: o
|
|
802
|
+
}, globalThis.ks.jsonToTag = {
|
|
803
|
+
meta,
|
|
804
|
+
buildSpecElement: n,
|
|
805
|
+
reviewSpec: o
|
|
806
|
+
});
|
|
807
|
+
}, isNullOrUndefined = ({ inSpec: t }) => {
|
|
808
|
+
const e = t;
|
|
809
|
+
return e == null;
|
|
810
|
+
}, isDomNode = ({ inSpec: t }) => typeof Node < "u" && t instanceof Node, isSpecArray = ({ inSpec: t }) => {
|
|
811
|
+
const e = t;
|
|
812
|
+
return Array.isArray(e);
|
|
813
|
+
}, buildSpecArray = ({ inSpec: t, inShowLog: e = !1 }) => {
|
|
814
|
+
const n = t, o = e;
|
|
815
|
+
return Array.isArray(n) ? n.map((r) => dispatchSpec({
|
|
816
|
+
inSpec: r,
|
|
817
|
+
inShowLog: o
|
|
818
|
+
})).flat().filter(Boolean) : [];
|
|
819
|
+
}, createElement = ({ inTagName: t }) => {
|
|
820
|
+
const e = t == null ? void 0 : t.toLowerCase();
|
|
821
|
+
if (!e) return null;
|
|
822
|
+
if (e === "checkbox") {
|
|
823
|
+
const n = document.createElement("input");
|
|
824
|
+
return n.type = "checkbox", n;
|
|
825
|
+
}
|
|
826
|
+
return document.createElement(e);
|
|
827
|
+
}, applyTextContent = ({ inElement: t, inTextContent: e, inAllowsTextContent: n = !0, inTagName: o, inShowLog: r = !1 }) => {
|
|
828
|
+
const l = t, s = e, c = n, d = o, b = r;
|
|
829
|
+
return !l || s === void 0 || s === null ? l : c ? (l.textContent = s, l) : (b && console.warn(`[json-to-tag v3] textContent is not allowed on <${d}>; discarded "${s}"`), l);
|
|
830
|
+
}, applyProperties = ({ inElement: t, inProperties: e }) => {
|
|
831
|
+
const n = t, o = e;
|
|
832
|
+
return n && o && typeof o == "object" && Object.assign(n, o), n;
|
|
833
|
+
}, applyAttributes = ({ inElement: t, inAttributes: e }) => {
|
|
834
|
+
const n = t, o = e;
|
|
835
|
+
return !n || !o || typeof o != "object" || Object.entries(o).forEach(([r, l]) => {
|
|
836
|
+
r === "class" ? n.className = l : typeof l == "boolean" ? l ? n.setAttribute(r, "") : n.removeAttribute(r) : l != null && n.setAttribute(r, String(l));
|
|
837
|
+
}), n;
|
|
838
|
+
}, applyClassList = ({ inElement: t, inClassList: e }) => {
|
|
839
|
+
const n = t, o = e;
|
|
840
|
+
if (!n || !o) return n;
|
|
841
|
+
let r = [];
|
|
842
|
+
return typeof o == "string" ? r = o.split(/\s+/).filter(Boolean) : Array.isArray(o) && (r = o.filter((l) => typeof l == "string" && l.trim().length > 0)), r.length > 0 && n.classList.add(...r), n;
|
|
843
|
+
}, appendChildren = ({ inElement: t, inChildren: e, inAllowsChildren: n = !0, inTagName: o, inShowLog: r = !1 }) => {
|
|
844
|
+
const l = t, s = e, c = n, d = o, b = r;
|
|
845
|
+
return !l || !Array.isArray(s) || s.length === 0 ? l : c ? (s.forEach((u) => {
|
|
846
|
+
typeof Node < "u" && u instanceof Node ? l.appendChild(u) : (typeof u == "string" || typeof u == "number") && l.appendChild(document.createTextNode(String(u)));
|
|
847
|
+
}), l) : (b && console.warn(`[json-to-tag v3] Children are not allowed on void tag <${d}>; discarded ${s.length} child nodes.`), l);
|
|
848
|
+
}, domElementBuilder = ({ inSpec: t, inClassList: e }) => {
|
|
849
|
+
const n = t, o = e || (n == null ? void 0 : n.classList);
|
|
850
|
+
if (!n || !n.tagName) return null;
|
|
851
|
+
const r = createElement({ inTagName: n.tagName });
|
|
852
|
+
return r ? (applyTextContent({
|
|
853
|
+
inElement: r,
|
|
854
|
+
inTextContent: n.textContent,
|
|
855
|
+
inTagName: n.tagName
|
|
856
|
+
}), applyProperties({
|
|
857
|
+
inElement: r,
|
|
858
|
+
inProperties: n.properties
|
|
859
|
+
}), applyAttributes({
|
|
860
|
+
inElement: r,
|
|
861
|
+
inAttributes: n.attributes
|
|
862
|
+
}), applyClassList({
|
|
863
|
+
inElement: r,
|
|
864
|
+
inClassList: o
|
|
865
|
+
}), appendChildren({
|
|
866
|
+
inElement: r,
|
|
867
|
+
inChildren: n.children,
|
|
868
|
+
inTagName: n.tagName
|
|
869
|
+
}), r) : null;
|
|
870
|
+
}, buildChildrenNodes = ({ inChildren: t, inShowLog: e = !1 }) => {
|
|
871
|
+
const n = t, o = e;
|
|
872
|
+
return Array.isArray(n) ? n.map((l) => dispatchSpec({
|
|
873
|
+
inSpec: l,
|
|
874
|
+
inShowLog: o
|
|
875
|
+
})).flat().filter(Boolean) : [];
|
|
876
|
+
}, buildSingleElement = ({ inSpec: t, inShowLog: e = !1 }) => {
|
|
877
|
+
const n = t, o = e, r = domElementBuilder({ inSpec: n });
|
|
878
|
+
let l = [];
|
|
879
|
+
return "children" in n && (l = Array.isArray(n.children) && n.children.length > 0 ? buildChildrenNodes({
|
|
880
|
+
inChildren: n.children,
|
|
881
|
+
inShowLog: o
|
|
882
|
+
}) : [], r.append(...l)), r;
|
|
883
|
+
}, dispatchSpec = ({ inSpec: t, inShowLog: e = !1 } = {}) => {
|
|
884
|
+
const n = t, o = e;
|
|
885
|
+
return isNullOrUndefined({ inSpec: n }) ? null : isDomNode({ inSpec: n }) ? n : isSpecArray({ inSpec: n }) ? buildSpecArray({
|
|
886
|
+
inSpec: n,
|
|
887
|
+
inShowLog: o
|
|
888
|
+
}) : buildSingleElement({
|
|
889
|
+
inSpec: n,
|
|
890
|
+
inShowLog: o
|
|
891
|
+
});
|
|
892
|
+
}, $schema = "./tags.schema.json", div = {
|
|
893
|
+
allowsTextContent: !1,
|
|
894
|
+
allowsChildren: !0,
|
|
895
|
+
allowedAttributes: [
|
|
896
|
+
"title",
|
|
897
|
+
"role"
|
|
898
|
+
],
|
|
899
|
+
childTags: []
|
|
900
|
+
}, input = {
|
|
901
|
+
allowsTextContent: !1,
|
|
902
|
+
allowsChildren: !1,
|
|
903
|
+
allowedAttributes: [
|
|
904
|
+
"type",
|
|
905
|
+
"placeholder",
|
|
906
|
+
"value",
|
|
907
|
+
"name",
|
|
908
|
+
"disabled",
|
|
909
|
+
"readonly",
|
|
910
|
+
"required",
|
|
911
|
+
"list"
|
|
912
|
+
]
|
|
913
|
+
}, checkbox = {
|
|
914
|
+
allowsTextContent: !1,
|
|
915
|
+
allowsChildren: !1,
|
|
916
|
+
allowedAttributes: [
|
|
917
|
+
"type",
|
|
918
|
+
"checked",
|
|
919
|
+
"name",
|
|
920
|
+
"value",
|
|
921
|
+
"disabled",
|
|
922
|
+
"required"
|
|
923
|
+
]
|
|
924
|
+
}, colgroup = {
|
|
925
|
+
allowsTextContent: !1,
|
|
926
|
+
allowsChildren: !0,
|
|
927
|
+
allowedAttributes: [
|
|
928
|
+
"span"
|
|
929
|
+
],
|
|
930
|
+
childTags: [
|
|
931
|
+
"col"
|
|
932
|
+
]
|
|
933
|
+
}, col = {
|
|
934
|
+
allowsTextContent: !1,
|
|
935
|
+
allowsChildren: !1,
|
|
936
|
+
allowedAttributes: [
|
|
937
|
+
"span",
|
|
938
|
+
"style",
|
|
939
|
+
"width"
|
|
940
|
+
]
|
|
941
|
+
}, label = {
|
|
942
|
+
allowsTextContent: !0,
|
|
943
|
+
allowsChildren: !0,
|
|
944
|
+
allowedAttributes: [
|
|
945
|
+
"for"
|
|
946
|
+
],
|
|
947
|
+
childTags: []
|
|
948
|
+
}, form = {
|
|
949
|
+
allowsTextContent: !1,
|
|
950
|
+
allowsChildren: !0,
|
|
951
|
+
allowedAttributes: [
|
|
952
|
+
"action",
|
|
953
|
+
"method",
|
|
954
|
+
"autocomplete",
|
|
955
|
+
"enctype",
|
|
956
|
+
"name",
|
|
957
|
+
"novalidate",
|
|
958
|
+
"target"
|
|
959
|
+
],
|
|
960
|
+
childTags: []
|
|
961
|
+
}, select = {
|
|
962
|
+
allowsTextContent: !1,
|
|
963
|
+
allowsChildren: !0,
|
|
964
|
+
allowedAttributes: [
|
|
965
|
+
"name",
|
|
966
|
+
"disabled",
|
|
967
|
+
"required",
|
|
968
|
+
"multiple",
|
|
969
|
+
"size"
|
|
970
|
+
],
|
|
971
|
+
childTags: [
|
|
972
|
+
"option"
|
|
973
|
+
]
|
|
974
|
+
}, p = {
|
|
975
|
+
allowsTextContent: !0,
|
|
976
|
+
allowsChildren: !0,
|
|
977
|
+
allowedAttributes: [],
|
|
978
|
+
childTags: []
|
|
979
|
+
}, h1 = {
|
|
980
|
+
allowsTextContent: !0,
|
|
981
|
+
allowsChildren: !0,
|
|
982
|
+
allowedAttributes: [],
|
|
983
|
+
childTags: []
|
|
984
|
+
}, h2 = {
|
|
985
|
+
allowsTextContent: !0,
|
|
986
|
+
allowsChildren: !0,
|
|
987
|
+
allowedAttributes: [],
|
|
988
|
+
childTags: []
|
|
989
|
+
}, span = {
|
|
990
|
+
allowsTextContent: !0,
|
|
991
|
+
allowsChildren: !0,
|
|
992
|
+
allowedAttributes: [],
|
|
993
|
+
childTags: []
|
|
994
|
+
}, img = {
|
|
995
|
+
allowsTextContent: !1,
|
|
996
|
+
allowsChildren: !1,
|
|
997
|
+
allowedAttributes: [
|
|
998
|
+
"src",
|
|
999
|
+
"alt",
|
|
1000
|
+
"width",
|
|
1001
|
+
"height",
|
|
1002
|
+
"loading"
|
|
1003
|
+
]
|
|
1004
|
+
}, button = {
|
|
1005
|
+
allowsTextContent: !0,
|
|
1006
|
+
allowsChildren: !0,
|
|
1007
|
+
allowedAttributes: [
|
|
1008
|
+
"type",
|
|
1009
|
+
"disabled",
|
|
1010
|
+
"name",
|
|
1011
|
+
"value"
|
|
1012
|
+
],
|
|
1013
|
+
childTags: []
|
|
1014
|
+
}, table = {
|
|
1015
|
+
allowsTextContent: !1,
|
|
1016
|
+
allowsChildren: !0,
|
|
1017
|
+
allowedAttributes: [
|
|
1018
|
+
"border",
|
|
1019
|
+
"cellpadding",
|
|
1020
|
+
"cellspacing"
|
|
1021
|
+
],
|
|
1022
|
+
childTags: [
|
|
1023
|
+
"caption",
|
|
1024
|
+
"colgroup",
|
|
1025
|
+
"thead",
|
|
1026
|
+
"tbody",
|
|
1027
|
+
"tfoot",
|
|
1028
|
+
"tr"
|
|
1029
|
+
]
|
|
1030
|
+
}, thead = {
|
|
1031
|
+
allowsTextContent: !1,
|
|
1032
|
+
allowsChildren: !0,
|
|
1033
|
+
allowedAttributes: [],
|
|
1034
|
+
childTags: [
|
|
1035
|
+
"tr"
|
|
1036
|
+
]
|
|
1037
|
+
}, tbody = {
|
|
1038
|
+
allowsTextContent: !1,
|
|
1039
|
+
allowsChildren: !0,
|
|
1040
|
+
allowedAttributes: [],
|
|
1041
|
+
childTags: [
|
|
1042
|
+
"tr"
|
|
1043
|
+
]
|
|
1044
|
+
}, tfoot = {
|
|
1045
|
+
allowsTextContent: !1,
|
|
1046
|
+
allowsChildren: !0,
|
|
1047
|
+
allowedAttributes: [],
|
|
1048
|
+
childTags: [
|
|
1049
|
+
"tr"
|
|
1050
|
+
]
|
|
1051
|
+
}, tr = {
|
|
1052
|
+
allowsTextContent: !1,
|
|
1053
|
+
allowsChildren: !0,
|
|
1054
|
+
allowedAttributes: [],
|
|
1055
|
+
childTags: [
|
|
1056
|
+
"td",
|
|
1057
|
+
"th"
|
|
1058
|
+
]
|
|
1059
|
+
}, th = {
|
|
1060
|
+
allowsTextContent: !0,
|
|
1061
|
+
allowsChildren: !0,
|
|
1062
|
+
allowedAttributes: [
|
|
1063
|
+
"scope",
|
|
1064
|
+
"colspan",
|
|
1065
|
+
"rowspan"
|
|
1066
|
+
],
|
|
1067
|
+
childTags: []
|
|
1068
|
+
}, td = {
|
|
1069
|
+
allowsTextContent: !0,
|
|
1070
|
+
allowsChildren: !0,
|
|
1071
|
+
allowedAttributes: [
|
|
1072
|
+
"colspan",
|
|
1073
|
+
"rowspan"
|
|
1074
|
+
],
|
|
1075
|
+
childTags: []
|
|
1076
|
+
}, datalist = {
|
|
1077
|
+
allowsTextContent: !1,
|
|
1078
|
+
allowsChildren: !0,
|
|
1079
|
+
allowedAttributes: [],
|
|
1080
|
+
childTags: [
|
|
1081
|
+
"option"
|
|
1082
|
+
]
|
|
1083
|
+
}, option = {
|
|
1084
|
+
allowsTextContent: !0,
|
|
1085
|
+
allowsChildren: !1,
|
|
1086
|
+
allowedAttributes: [
|
|
1087
|
+
"value",
|
|
1088
|
+
"label",
|
|
1089
|
+
"selected",
|
|
1090
|
+
"disabled"
|
|
1091
|
+
]
|
|
1092
|
+
}, header = {
|
|
1093
|
+
allowsTextContent: !1,
|
|
1094
|
+
allowsChildren: !0,
|
|
1095
|
+
allowedAttributes: [
|
|
1096
|
+
"role"
|
|
1097
|
+
],
|
|
1098
|
+
childTags: []
|
|
1099
|
+
}, a = {
|
|
1100
|
+
allowsTextContent: !0,
|
|
1101
|
+
allowsChildren: !0,
|
|
1102
|
+
allowedAttributes: [
|
|
1103
|
+
"href",
|
|
1104
|
+
"target",
|
|
1105
|
+
"rel",
|
|
1106
|
+
"title",
|
|
1107
|
+
"download"
|
|
1108
|
+
],
|
|
1109
|
+
childTags: []
|
|
1110
|
+
}, i = {
|
|
1111
|
+
allowsTextContent: !0,
|
|
1112
|
+
allowsChildren: !0,
|
|
1113
|
+
allowedAttributes: [
|
|
1114
|
+
"aria-hidden"
|
|
1115
|
+
],
|
|
1116
|
+
childTags: []
|
|
1117
|
+
}, small = {
|
|
1118
|
+
allowsTextContent: !0,
|
|
1119
|
+
allowsChildren: !0,
|
|
1120
|
+
allowedAttributes: [],
|
|
1121
|
+
childTags: []
|
|
1122
|
+
}, ul = {
|
|
1123
|
+
allowsTextContent: !1,
|
|
1124
|
+
allowsChildren: !0,
|
|
1125
|
+
allowedAttributes: [
|
|
1126
|
+
"type"
|
|
1127
|
+
],
|
|
1128
|
+
childTags: [
|
|
1129
|
+
"li"
|
|
1130
|
+
]
|
|
1131
|
+
}, li = {
|
|
1132
|
+
allowsTextContent: !0,
|
|
1133
|
+
allowsChildren: !0,
|
|
1134
|
+
allowedAttributes: [
|
|
1135
|
+
"value"
|
|
1136
|
+
],
|
|
1137
|
+
childTags: []
|
|
1138
|
+
}, hr = {
|
|
1139
|
+
allowsTextContent: !1,
|
|
1140
|
+
allowsChildren: !1,
|
|
1141
|
+
allowedAttributes: []
|
|
1142
|
+
}, defaultTags = {
|
|
1143
|
+
$schema,
|
|
1144
|
+
div,
|
|
1145
|
+
input,
|
|
1146
|
+
checkbox,
|
|
1147
|
+
colgroup,
|
|
1148
|
+
col,
|
|
1149
|
+
label,
|
|
1150
|
+
form,
|
|
1151
|
+
select,
|
|
1152
|
+
p,
|
|
1153
|
+
h1,
|
|
1154
|
+
h2,
|
|
1155
|
+
span,
|
|
1156
|
+
img,
|
|
1157
|
+
button,
|
|
1158
|
+
table,
|
|
1159
|
+
thead,
|
|
1160
|
+
tbody,
|
|
1161
|
+
tfoot,
|
|
1162
|
+
tr,
|
|
1163
|
+
th,
|
|
1164
|
+
td,
|
|
1165
|
+
datalist,
|
|
1166
|
+
option,
|
|
1167
|
+
header,
|
|
1168
|
+
a,
|
|
1169
|
+
i,
|
|
1170
|
+
small,
|
|
1171
|
+
ul,
|
|
1172
|
+
li,
|
|
1173
|
+
hr
|
|
1174
|
+
}, extractTags = ({ inSpec: t }) => {
|
|
1175
|
+
const e = t;
|
|
1176
|
+
if (!e) return [];
|
|
1177
|
+
if (Array.isArray(e))
|
|
1178
|
+
return e.flatMap((o) => extractTags({ inSpec: o }));
|
|
1179
|
+
if (typeof e != "object") return [];
|
|
1180
|
+
const n = [];
|
|
1181
|
+
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((o) => {
|
|
1182
|
+
const r = extractTags({ inSpec: o });
|
|
1183
|
+
n.push(...r);
|
|
1184
|
+
}), n;
|
|
1185
|
+
}, checkTags = ({ inTagsFound: t, inAllowedTags: e }) => {
|
|
1186
|
+
const n = t ?? [], o = e ?? {}, r = new Set(
|
|
1187
|
+
Object.keys(o).filter((u) => u !== "$schema").map((u) => u.toLowerCase())
|
|
1188
|
+
), l = {}, s = [], c = [];
|
|
1189
|
+
n.forEach((u) => {
|
|
1190
|
+
l[u] = (l[u] || 0) + 1, r.has(u) ? s.includes(u) || s.push(u) : c.includes(u) || c.push(u);
|
|
1191
|
+
});
|
|
1192
|
+
const d = n.length, b = c.length === 0;
|
|
1193
|
+
return {
|
|
1194
|
+
totalTags: d,
|
|
1195
|
+
tagCounts: l,
|
|
1196
|
+
uniqueTags: Object.keys(l),
|
|
1197
|
+
recognizedTags: s,
|
|
1198
|
+
unrecognizedTags: c,
|
|
1199
|
+
areAllTagsPresent: b
|
|
1200
|
+
};
|
|
1201
|
+
}, reviewSpec = ({ inSpec: t, inTags: e = defaultTags } = {}) => {
|
|
1202
|
+
const n = t, o = e, r = extractTags({ inSpec: n }), l = checkTags({
|
|
1203
|
+
inTagsFound: r,
|
|
1204
|
+
inAllowedTags: o
|
|
1205
|
+
});
|
|
1206
|
+
return {
|
|
1207
|
+
areAllTagsPresent: l.areAllTagsPresent,
|
|
1208
|
+
totalTags: l.totalTags,
|
|
1209
|
+
tagCounts: l.tagCounts,
|
|
1210
|
+
uniqueTags: l.uniqueTags,
|
|
1211
|
+
recognizedTags: l.recognizedTags,
|
|
1212
|
+
unrecognizedTags: l.unrecognizedTags
|
|
1213
|
+
};
|
|
1214
|
+
}, buildSpecElement = (t = {}) => {
|
|
1215
|
+
try {
|
|
1216
|
+
const e = t, n = (e == null ? void 0 : e.spec) ?? (e == null ? void 0 : e.inSpec) ?? e;
|
|
1217
|
+
return dispatchSpec({
|
|
1218
|
+
inSpec: n
|
|
1219
|
+
});
|
|
1220
|
+
} catch (e) {
|
|
1221
|
+
throw console.error("error : ", e), e;
|
|
1222
|
+
}
|
|
1223
|
+
};
|
|
1224
|
+
registerGlobal({
|
|
1225
|
+
inFuncDefinition: buildSpecElement,
|
|
1226
|
+
inReviewSpec: reviewSpec
|
|
1227
|
+
});
|
|
1228
|
+
const startFunc$k = ({
|
|
1229
|
+
inStructureJson: t,
|
|
1230
|
+
inDataAsJson: e,
|
|
1231
|
+
inShowLog: n = !1
|
|
1232
|
+
} = {}) => {
|
|
1233
|
+
const o = t, r = e, l = n, s = buildSpecElement$1({
|
|
1234
|
+
specJson: o,
|
|
1235
|
+
dataJson: r,
|
|
1236
|
+
showLog: l
|
|
1237
|
+
});
|
|
1238
|
+
return l && console.log("specAsJsonToDom : ", s), buildSpecElement(s);
|
|
1239
|
+
}, startFunc$j = ({ inTargetHtmlId: t } = {}) => {
|
|
1240
|
+
const e = t;
|
|
1241
|
+
return typeof e == "string" ? document.getElementById(e) : e ?? null;
|
|
1242
|
+
}, startFunc$i = ({ inEvent: t, inColumns: e, inData: n } = {}) => {
|
|
1243
|
+
var T, S, A;
|
|
1244
|
+
const o = t, r = e, l = n, s = (T = o == null ? void 0 : o.target) == null ? void 0 : T.closest("button");
|
|
1245
|
+
if (!s) return null;
|
|
1246
|
+
const c = s.closest("tr"), d = s.closest("td");
|
|
1247
|
+
if (!c || !d) return null;
|
|
1248
|
+
const b = c.sectionRowIndex, u = (S = r == null ? void 0 : r[d.cellIndex]) == null ? void 0 : S.key, h = (A = l == null ? void 0 : l[b]) == null ? void 0 : A[u];
|
|
1249
|
+
return !Array.isArray(h) || h.length === 0 ? null : {
|
|
1250
|
+
parentRowIndex: b,
|
|
1251
|
+
childColumnKey: u,
|
|
1252
|
+
childTableData: h
|
|
1253
|
+
};
|
|
1254
|
+
}, startFunc$h = ({ inTargetHtmlId: t, inChildColumnKey: e } = {}) => {
|
|
1255
|
+
const n = t, o = e, r = typeof n == "string" ? document.getElementById(n) : n;
|
|
1256
|
+
if (!r) return null;
|
|
1257
|
+
const l = `${r.id || "table"}-${o}`;
|
|
1258
|
+
let s = document.getElementById(l);
|
|
1259
|
+
return s || (s = document.createElement("div"), s.id = l, s.className = "child-table-container mt-3", r.insertAdjacentElement("afterend", s)), s;
|
|
1260
|
+
}, startFunc$g = ({ inChildTableContainer: t, inParentRowIndex: e } = {}) => {
|
|
1261
|
+
const n = t, o = e, r = n.dataset.activeRow === String(o), l = n.style.display !== "none";
|
|
1262
|
+
return r && l ? (n.style.display = "none", !0) : !1;
|
|
1263
|
+
}, startFunc$f = ({ inChildTableContainer: t, inClickedRowDetails: e } = {}) => {
|
|
1264
|
+
const n = t, o = e;
|
|
1265
|
+
return n.style.display = "", n.dataset.activeRow = String(o.parentRowIndex), n.dataset.fieldName = o.childColumnKey, n.innerHTML = "", n.childData = o.childTableData, n;
|
|
1266
|
+
}, startFunc$e = ({ inEvent: t, inTargetHtmlId: e, inColumns: n, inData: o } = {}) => {
|
|
1267
|
+
const r = t, l = e, d = startFunc$i({
|
|
1268
|
+
inEvent: r,
|
|
1269
|
+
inColumns: n,
|
|
1270
|
+
inData: o
|
|
1271
|
+
});
|
|
1272
|
+
if (!d) return null;
|
|
1273
|
+
const b = startFunc$h({
|
|
1274
|
+
inTargetHtmlId: l,
|
|
1275
|
+
inChildColumnKey: d.childColumnKey
|
|
1276
|
+
});
|
|
1277
|
+
return !b || startFunc$g({
|
|
1278
|
+
inChildTableContainer: b,
|
|
1279
|
+
inParentRowIndex: d.parentRowIndex
|
|
1280
|
+
}) ? null : startFunc$f({
|
|
1281
|
+
inChildTableContainer: b,
|
|
1282
|
+
inClickedRowDetails: d
|
|
1283
|
+
});
|
|
1284
|
+
}, deriveColumnsFromData = ({ inData: t = [] } = {}) => {
|
|
1285
|
+
const e = t;
|
|
1286
|
+
if (!Array.isArray(e) || e.length === 0)
|
|
1287
|
+
return [];
|
|
1288
|
+
const n = e[0];
|
|
1289
|
+
return !n || typeof n != "object" ? [] : Object.keys(n).map((o) => ({
|
|
1290
|
+
key: o,
|
|
1291
|
+
label: o
|
|
1292
|
+
}));
|
|
1293
|
+
}, startFunc$d = ({ inChildTableContainer: t, inContainer: e, inRenderFunc: n } = {}) => {
|
|
1294
|
+
const o = t, r = e, l = n, s = o || r, c = s == null ? void 0 : s.childData;
|
|
1295
|
+
l({
|
|
1296
|
+
inTargetHtmlId: s,
|
|
1297
|
+
inColumns: deriveColumnsFromData({ inData: c }),
|
|
1298
|
+
inData: c,
|
|
1299
|
+
inSkeletonType: "tableOnly"
|
|
1300
|
+
});
|
|
1301
|
+
}, clickFunc = ({
|
|
1302
|
+
inEvent: t,
|
|
1303
|
+
inData: e,
|
|
1304
|
+
inColumns: n,
|
|
1305
|
+
inRenderFunc: o,
|
|
1306
|
+
inTargetHtmlId: r
|
|
1307
|
+
} = {}) => {
|
|
1308
|
+
const l = t, s = e, c = n, d = o, u = startFunc$e({
|
|
1309
|
+
inEvent: l,
|
|
1310
|
+
inTargetHtmlId: r,
|
|
1311
|
+
inColumns: c,
|
|
1312
|
+
inData: s
|
|
1313
|
+
});
|
|
1314
|
+
u && startFunc$d({
|
|
1315
|
+
inChildTableContainer: u,
|
|
1316
|
+
inRenderFunc: d
|
|
1317
|
+
});
|
|
1318
|
+
}, startFunc$c = ({
|
|
1319
|
+
inTargetContainer: t,
|
|
1320
|
+
inData: e,
|
|
1321
|
+
inColumns: n,
|
|
1322
|
+
inRenderFunc: o,
|
|
1323
|
+
inTargetHtmlId: r
|
|
1324
|
+
} = {}) => {
|
|
1325
|
+
const l = t, s = e, c = n, d = o, b = r;
|
|
1326
|
+
l.addEventListener("click", (u) => {
|
|
1327
|
+
clickFunc({
|
|
1328
|
+
inEvent: u,
|
|
1329
|
+
inData: s,
|
|
1330
|
+
inColumns: c,
|
|
1331
|
+
inRenderFunc: d,
|
|
1332
|
+
inTargetHtmlId: b
|
|
1333
|
+
});
|
|
1334
|
+
});
|
|
1335
|
+
}, startFunc$b = ({
|
|
1336
|
+
targetHtmlId: t,
|
|
1337
|
+
inTargetHtmlId: e,
|
|
1338
|
+
inColumns: n,
|
|
1339
|
+
inData: o,
|
|
1340
|
+
inColGroup: r,
|
|
1341
|
+
inFooterData: l = [],
|
|
1342
|
+
inConfig: s = {},
|
|
1343
|
+
inSkeletonType: c = "default",
|
|
1344
|
+
inShowLog: d = !1
|
|
1345
|
+
} = {}) => {
|
|
1346
|
+
const b = e ?? t, u = o ?? [], h = n ?? deriveColumnsFromData({ inData: u }), T = r, S = l, A = s, D = c, v = d;
|
|
1347
|
+
try {
|
|
1348
|
+
const E = startFunc$s({
|
|
1349
|
+
inColumns: h,
|
|
1350
|
+
inData: u,
|
|
1351
|
+
inColGroup: T,
|
|
1352
|
+
inFooterData: S,
|
|
1353
|
+
inConfig: A
|
|
1354
|
+
}), I = startFunc$r({
|
|
1355
|
+
inSkeletonType: D,
|
|
1356
|
+
inSkeletonJson: skeletonJson$2,
|
|
1357
|
+
inFragmentsJson: fragmentsJson,
|
|
1358
|
+
inShowLog: v
|
|
1359
|
+
}), R = startFunc$k({
|
|
1360
|
+
inStructureJson: I,
|
|
1361
|
+
inDataAsJson: E,
|
|
1362
|
+
inShowLog: v
|
|
1363
|
+
}), w = startFunc$j({
|
|
1364
|
+
inTargetHtmlId: b
|
|
1365
|
+
});
|
|
1366
|
+
if (!w) return;
|
|
1367
|
+
w.innerHTML = "", startFunc$c({
|
|
1368
|
+
inTargetContainer: w,
|
|
1369
|
+
inData: u,
|
|
1370
|
+
inColumns: h,
|
|
1371
|
+
inRenderFunc: startFunc$b,
|
|
1372
|
+
inTargetHtmlId: b
|
|
1373
|
+
}), w.append(R);
|
|
1374
|
+
} catch (E) {
|
|
1375
|
+
console.log("error : ", E);
|
|
1376
|
+
}
|
|
1377
|
+
}, IDENTIFIERS = {
|
|
1378
|
+
HARD_CODED: "$",
|
|
1379
|
+
PARENT: "^",
|
|
1380
|
+
TYPE_START: "(",
|
|
1381
|
+
TYPE_END: ")",
|
|
1382
|
+
ACTION_START: "{",
|
|
1383
|
+
ACTION_END: "}",
|
|
1384
|
+
ARRAY_INDEX: "#eq(",
|
|
1385
|
+
ARRAY_START: "#eq(",
|
|
1386
|
+
ARRAY_END: ")"
|
|
1387
|
+
}, VALUES = {
|
|
1388
|
+
DEFAULT: void 0
|
|
1389
|
+
}, resolvePath = (t, e) => {
|
|
1390
|
+
if (t === "")
|
|
1391
|
+
return e;
|
|
1392
|
+
const o = t.replace(/\[(\w+)\]/g, ". $1".replace(" ", "")).replace(/^\./, "").split(".");
|
|
1393
|
+
for (let r = 0; r < o.length; ) {
|
|
1394
|
+
if (Array.isArray(e)) {
|
|
1395
|
+
const c = o.slice(r).join(".");
|
|
1396
|
+
return e.map((d) => resolvePath(c, d));
|
|
1397
|
+
}
|
|
1398
|
+
if (typeof e != "object" || e === null)
|
|
1399
|
+
return VALUES.DEFAULT;
|
|
1400
|
+
let l, s = 0;
|
|
1401
|
+
for (let c = o.length; c > r; c -= 1) {
|
|
1402
|
+
const d = o.slice(r, c).join(".");
|
|
1403
|
+
if (Object.prototype.hasOwnProperty.call(e, d)) {
|
|
1404
|
+
l = d, s = c - r;
|
|
1405
|
+
break;
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
if (l === void 0)
|
|
1409
|
+
return VALUES.DEFAULT;
|
|
1410
|
+
e = e[l], r += s;
|
|
1411
|
+
}
|
|
1412
|
+
return e;
|
|
1413
|
+
}, 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) => {
|
|
1414
|
+
if (!t) return t;
|
|
1415
|
+
try {
|
|
1416
|
+
return new Date(t).getTime();
|
|
1417
|
+
} catch {
|
|
1418
|
+
return t;
|
|
1419
|
+
}
|
|
1420
|
+
}, deleteKey = () => {
|
|
1421
|
+
}, deleteIfNotPresent = (t) => typeof t > "u" ? void 0 : t, typeToFn = {
|
|
1422
|
+
STRING: convertToString,
|
|
1423
|
+
NUMBER: convertToNumber,
|
|
1424
|
+
DATE: convertToDate,
|
|
1425
|
+
UPPER: convertToUpperCase
|
|
1426
|
+
}, extractSpecial = (t) => {
|
|
1427
|
+
const e = t.indexOf(IDENTIFIERS.TYPE_START) > -1 ? IDENTIFIERS.TYPE_START : t.indexOf(IDENTIFIERS.ACTION_START) > -1 ? IDENTIFIERS.ACTION_START : null;
|
|
1428
|
+
if (!e) return null;
|
|
1429
|
+
const n = e === IDENTIFIERS.TYPE_START ? IDENTIFIERS.TYPE_END : IDENTIFIERS.ACTION_END;
|
|
1430
|
+
return {
|
|
1431
|
+
kind: e,
|
|
1432
|
+
type: t.substring(t.indexOf(e) + 1, t.lastIndexOf(n)),
|
|
1433
|
+
path: t.substring(0, t.indexOf(e))
|
|
1434
|
+
};
|
|
1435
|
+
}, evaluateExpression = (value, key, source, config) => {
|
|
1436
|
+
const resolvedKey = resolvePath(key, source);
|
|
1437
|
+
if (!config[resolvedKey]) return resolvedKey;
|
|
1438
|
+
const { operator, value: expressionValue } = config[resolvedKey];
|
|
1439
|
+
return !operators.includes(operator) || !isNumber(expressionValue) ? resolvedKey : eval(`${value}${operator}${expressionValue}`);
|
|
1440
|
+
}, createActionMap = ({ convertValue: t }) => ({
|
|
1441
|
+
APPEND: (e, n, o, r) => {
|
|
1442
|
+
const l = r == null ? void 0 : r.appendMap;
|
|
1443
|
+
if (!l || typeof l[n] > "u") return e;
|
|
1444
|
+
const { path: s, separator: c } = l[n];
|
|
1445
|
+
return e + (c || "") + t(s, o);
|
|
1446
|
+
},
|
|
1447
|
+
DELETE: deleteKey,
|
|
1448
|
+
DELETE_IF_NOT_PRESENT: deleteIfNotPresent,
|
|
1449
|
+
DEPENDS: (e, n, o, r) => {
|
|
1450
|
+
if (typeof n > "u") return r.dependentMap[e];
|
|
1451
|
+
const l = extractSpecial(n);
|
|
1452
|
+
return l && actionMap[l.type] ? actionMap[l.type](e, l.path, o, r) : n;
|
|
1453
|
+
},
|
|
1454
|
+
EVAL: evaluateExpression
|
|
1455
|
+
});
|
|
1456
|
+
let actionMap = {};
|
|
1457
|
+
const convertType = (t, e) => typeToFn[t] ? typeToFn[t](e) : e, performAction = (t, e, n, o, r, l) => {
|
|
1458
|
+
actionMap = createActionMap({ convertValue: l });
|
|
1459
|
+
const s = extractSpecial(t);
|
|
1460
|
+
return s && actionMap[s.type] ? actionMap[s.type](e, s.path, o, r) : actionMap[t] ? actionMap[t](e, void 0, o, r) : e;
|
|
1461
|
+
}, resolveValue = (t, e, n, o) => {
|
|
1462
|
+
if (t.startsWith(IDENTIFIERS.HARD_CODED))
|
|
1463
|
+
return t.substring(1);
|
|
1464
|
+
if (t.startsWith(IDENTIFIERS.PARENT))
|
|
1465
|
+
return resolvePath(t.substring(1), n);
|
|
1466
|
+
const r = extractSpecial(t);
|
|
1467
|
+
if (!r)
|
|
1468
|
+
return resolvePath(t, e);
|
|
1469
|
+
const l = resolvePath(r.path, e);
|
|
1470
|
+
return typeof l > "u" ? VALUES.DEFAULT : r.kind === IDENTIFIERS.TYPE_START ? convertType(r.type, l) : performAction(
|
|
1471
|
+
r.type,
|
|
1472
|
+
l,
|
|
1473
|
+
r.path,
|
|
1474
|
+
e,
|
|
1475
|
+
o,
|
|
1476
|
+
(s, c) => resolveValue(s, c, n, o)
|
|
1477
|
+
);
|
|
1478
|
+
}, startFunc$a = (t, e, n) => {
|
|
1479
|
+
const o = {};
|
|
1480
|
+
return Object.keys(t).forEach((r) => {
|
|
1481
|
+
const l = t[r];
|
|
1482
|
+
if (typeof l == "string") {
|
|
1483
|
+
o[r] = resolveValue(
|
|
1484
|
+
l,
|
|
1485
|
+
e,
|
|
1486
|
+
n.rootSource,
|
|
1487
|
+
n.configuration
|
|
1488
|
+
);
|
|
1489
|
+
return;
|
|
1490
|
+
}
|
|
1491
|
+
if (Array.isArray(l) && l.length > 0) {
|
|
1492
|
+
o[r] = startFunc$3(l[0], e, n);
|
|
1493
|
+
return;
|
|
1494
|
+
}
|
|
1495
|
+
l && typeof l == "object" && (o[r] = traverse(l, e, n));
|
|
1496
|
+
}), o;
|
|
1497
|
+
}, startFunc$9 = (t, e, n) => {
|
|
1498
|
+
const o = [];
|
|
1499
|
+
return t.forEach((r) => {
|
|
1500
|
+
if (typeof r == "string") {
|
|
1501
|
+
const l = resolveValue(
|
|
1502
|
+
r,
|
|
1503
|
+
e,
|
|
1504
|
+
n.rootSource,
|
|
1505
|
+
n.configuration
|
|
1506
|
+
);
|
|
1507
|
+
isNonEmptyArray(l) ? o.push(...l) : o.push(l);
|
|
1508
|
+
return;
|
|
1509
|
+
}
|
|
1510
|
+
if (Array.isArray(r)) {
|
|
1511
|
+
o.push(
|
|
1512
|
+
...startFunc$9(
|
|
1513
|
+
r[0],
|
|
1514
|
+
e,
|
|
1515
|
+
n
|
|
1516
|
+
)
|
|
1517
|
+
);
|
|
1518
|
+
return;
|
|
1519
|
+
}
|
|
1520
|
+
r && typeof r == "object" && o.push(
|
|
1521
|
+
startFunc$a(
|
|
1522
|
+
r,
|
|
1523
|
+
e,
|
|
1524
|
+
n
|
|
1525
|
+
)
|
|
1526
|
+
);
|
|
1527
|
+
}), o;
|
|
1528
|
+
}, startFunc$8 = (t, e, n) => [
|
|
1529
|
+
startFunc$a(
|
|
1530
|
+
e,
|
|
1531
|
+
t,
|
|
1532
|
+
n
|
|
1533
|
+
)
|
|
1534
|
+
], startFunc$7 = (t, e, n) => t.map((o) => startFunc$a(
|
|
1535
|
+
e,
|
|
1536
|
+
o,
|
|
1537
|
+
n
|
|
1538
|
+
));
|
|
1539
|
+
function isPlainObject(t) {
|
|
1540
|
+
return t !== null && typeof t == "object" && Object.getPrototypeOf(t) === Object.prototype;
|
|
1541
|
+
}
|
|
1542
|
+
const startFunc$6 = (t, e, n) => Array.isArray(t) ? startFunc$7(
|
|
1543
|
+
t,
|
|
1544
|
+
e,
|
|
1545
|
+
n
|
|
1546
|
+
) : isPlainObject(t) ? startFunc$8(
|
|
1547
|
+
t,
|
|
1548
|
+
e,
|
|
1549
|
+
n
|
|
1550
|
+
) : [], isArrayIndexMapping = (t) => {
|
|
1551
|
+
const e = t.list;
|
|
1552
|
+
return e.startsWith(IDENTIFIERS.ARRAY_INDEX) && e.includes(IDENTIFIERS.ARRAY_START) && e.includes(IDENTIFIERS.ARRAY_END);
|
|
1553
|
+
}, getItemMapping$1 = (t) => Array.isArray(t.item) ? t.item[0] : t.item, resolveListSource = (t, e) => resolvePath(
|
|
1554
|
+
t.list,
|
|
1555
|
+
e
|
|
1556
|
+
), startFunc$5 = (t, e, n) => {
|
|
1557
|
+
const o = getItemMapping$1(t);
|
|
1558
|
+
if (isArrayIndexMapping(t))
|
|
1559
|
+
return [
|
|
1560
|
+
startFunc$a(
|
|
1561
|
+
o,
|
|
1562
|
+
e,
|
|
1563
|
+
n
|
|
1564
|
+
)
|
|
1565
|
+
];
|
|
1566
|
+
const r = resolveListSource(
|
|
1567
|
+
t,
|
|
1568
|
+
e
|
|
1569
|
+
);
|
|
1570
|
+
return startFunc$6(
|
|
1571
|
+
r,
|
|
1572
|
+
o,
|
|
1573
|
+
n
|
|
1574
|
+
);
|
|
1575
|
+
}, getItemMapping = (t) => Array.isArray(t.item) ? t.item[0] : t.item, resolveObjectifySource = (t, e) => resolvePath(
|
|
1576
|
+
t.objectify,
|
|
1577
|
+
e
|
|
1578
|
+
), startFunc$4 = (t, e, n) => {
|
|
1579
|
+
const o = resolveObjectifySource(
|
|
1580
|
+
t,
|
|
1581
|
+
e
|
|
1582
|
+
);
|
|
1583
|
+
return startFunc$8(
|
|
1584
|
+
o,
|
|
1585
|
+
getItemMapping(t),
|
|
1586
|
+
n
|
|
1587
|
+
);
|
|
1588
|
+
}, startFunc$3 = (t, e, n) => typeof t.collect < "u" ? startFunc$9(
|
|
1589
|
+
t.item,
|
|
1590
|
+
e,
|
|
1591
|
+
n
|
|
1592
|
+
) : typeof t.list < "u" ? startFunc$5(
|
|
1593
|
+
t,
|
|
1594
|
+
e,
|
|
1595
|
+
n
|
|
1596
|
+
) : typeof t.objectify < "u" ? startFunc$4(
|
|
1597
|
+
t,
|
|
1598
|
+
e,
|
|
1599
|
+
n
|
|
1600
|
+
) : [], startFunc$2 = (t, e) => {
|
|
1601
|
+
if (!t.includes(IDENTIFIERS.ARRAY_INDEX)) return {};
|
|
1602
|
+
const n = t.lastIndexOf(IDENTIFIERS.ARRAY_INDEX) + 4, o = t.lastIndexOf(IDENTIFIERS.ARRAY_END), r = t.substring(n, o), l = t.substring(0, t.lastIndexOf(IDENTIFIERS.ARRAY_INDEX)), s = l ? resolvePath(l, e) : e;
|
|
1603
|
+
return s == null ? void 0 : s[r];
|
|
1604
|
+
}, traverse = (t, e, n) => {
|
|
1605
|
+
if (typeof t.list < "u" || typeof t.objectify < "u" || typeof t.collect < "u")
|
|
1606
|
+
return startFunc$3(t, e, n);
|
|
1607
|
+
if (typeof t.flat < "u") {
|
|
1608
|
+
const o = startFunc$2(t.flat, e);
|
|
1609
|
+
return startFunc$a(t.item, o, n);
|
|
1610
|
+
}
|
|
1611
|
+
return typeof t.item < "u" ? startFunc$a(t.item, e, n) : startFunc$a(t, e, n);
|
|
1612
|
+
}, transform = (t, e) => {
|
|
1613
|
+
let n = t, o = e;
|
|
1614
|
+
t !== null && typeof t == "object" && "inData" in t && e === void 0 && (n = t.inData, o = t.inTransformation);
|
|
1615
|
+
const { mapping: r, config: l = {} } = o;
|
|
1616
|
+
return traverse(r, n, {
|
|
1617
|
+
rootSource: n,
|
|
1618
|
+
configuration: l
|
|
1619
|
+
});
|
|
1620
|
+
}, transformHelper = { transform }, old = {
|
|
1621
|
+
tagName: "datalist",
|
|
1622
|
+
attributes: {
|
|
1623
|
+
id: "LedgerName"
|
|
1624
|
+
},
|
|
1625
|
+
jsonToSpec: {
|
|
1626
|
+
operation: "loopArray",
|
|
1627
|
+
source: "LedgerName",
|
|
1628
|
+
template: {
|
|
1629
|
+
tagName: "option",
|
|
1630
|
+
attributes: {
|
|
1631
|
+
value: "${}"
|
|
1632
|
+
},
|
|
1633
|
+
textContent: "${}"
|
|
1634
|
+
}
|
|
1635
|
+
},
|
|
1636
|
+
children: []
|
|
1637
|
+
}, skeletonJson$1 = {
|
|
1638
|
+
old,
|
|
1639
|
+
default: {
|
|
1640
|
+
mapping: {
|
|
1641
|
+
tagName: "$datalist",
|
|
1642
|
+
attributes: {
|
|
1643
|
+
id: "$LedgerName"
|
|
1644
|
+
},
|
|
1645
|
+
children: {
|
|
1646
|
+
list: "LedgerName",
|
|
1647
|
+
item: {
|
|
1648
|
+
tagName: "$option",
|
|
1649
|
+
attributes: {
|
|
1650
|
+
value: ""
|
|
1651
|
+
},
|
|
1652
|
+
textContent: ""
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
}, startFunc$1 = ({ targetHtmlId: t, inData: e, inSkeletonType: n = "default" } = {}) => {
|
|
1658
|
+
const o = skeletonJson$1[n], r = transformHelper.transform(e, o), l = document.getElementById(t);
|
|
1659
|
+
l && (l.innerHTML = "");
|
|
1660
|
+
const s = buildSpecElement(r);
|
|
1661
|
+
Array.isArray(s) ? s.forEach((c) => l.append(c)) : l.append(s);
|
|
1662
|
+
}, skeletonJson = {
|
|
1663
|
+
default: {
|
|
1664
|
+
mapping: {
|
|
1665
|
+
tagName: "$select",
|
|
1666
|
+
attributes: {
|
|
1667
|
+
id: "$LedgerName",
|
|
1668
|
+
class: "$keshav"
|
|
1669
|
+
},
|
|
1670
|
+
children: [
|
|
1671
|
+
{
|
|
1672
|
+
list: "LedgerName",
|
|
1673
|
+
item: {
|
|
1674
|
+
tagName: "$option",
|
|
1675
|
+
attributes: {
|
|
1676
|
+
value: ""
|
|
1677
|
+
},
|
|
1678
|
+
textContent: ""
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
]
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
}, startFunc = ({
|
|
1685
|
+
targetHtmlId: t,
|
|
1686
|
+
inData: e,
|
|
1687
|
+
inSkeletonType: n = "default",
|
|
1688
|
+
inClassToApply: o
|
|
1689
|
+
} = {}) => {
|
|
1690
|
+
console.log("aaaaaaaaaa");
|
|
1691
|
+
const r = skeletonJson[n];
|
|
1692
|
+
r.mapping.attributes.class = `$${o}`;
|
|
1693
|
+
debugger;
|
|
1694
|
+
const l = transformHelper.transform(e, r), s = document.getElementById(t);
|
|
1695
|
+
s && (s.innerHTML = "");
|
|
1696
|
+
const c = buildSpecElement(l);
|
|
1697
|
+
Array.isArray(c) ? c.forEach((d) => s.append(d)) : s.append(c);
|
|
1698
|
+
}, RENDERER_MAP = {
|
|
1699
|
+
table: startFunc$b,
|
|
1700
|
+
datalist: startFunc$1,
|
|
1701
|
+
select: startFunc
|
|
1702
|
+
}, render = ({
|
|
1703
|
+
type: t = "table",
|
|
1704
|
+
targetHtmlId: e,
|
|
1705
|
+
data: n,
|
|
1706
|
+
classToApply: o,
|
|
1707
|
+
inTargetHtmlId: r,
|
|
1708
|
+
inData: l,
|
|
1709
|
+
columns: s,
|
|
1710
|
+
inColumns: c,
|
|
1711
|
+
fields: d,
|
|
1712
|
+
inFields: b,
|
|
1713
|
+
tabs: u,
|
|
1714
|
+
inTabs: h,
|
|
1715
|
+
options: T,
|
|
1716
|
+
inOptions: S,
|
|
1717
|
+
datalistId: A,
|
|
1718
|
+
inDatalistId: D,
|
|
1719
|
+
listId: v,
|
|
1720
|
+
inListId: E,
|
|
1721
|
+
id: I,
|
|
1722
|
+
valueField: R,
|
|
1723
|
+
inValueField: w,
|
|
1724
|
+
labelField: W,
|
|
1725
|
+
inLabelField: q,
|
|
1726
|
+
colGroup: j,
|
|
1727
|
+
inColGroup: O,
|
|
1728
|
+
footerData: L,
|
|
1729
|
+
inFooterData: k,
|
|
1730
|
+
config: H,
|
|
1731
|
+
inConfig: P,
|
|
1732
|
+
variant: _,
|
|
1733
|
+
skeletonType: M,
|
|
1734
|
+
inSkeletonType: G,
|
|
1735
|
+
showLog: J = !1,
|
|
1736
|
+
inShowLog: U,
|
|
1737
|
+
...f
|
|
1738
|
+
} = {}) => {
|
|
1739
|
+
const F = t, m = typeof F == "string" ? F.toLowerCase() : "table", g = RENDERER_MAP[m];
|
|
1740
|
+
if (!g)
|
|
1741
|
+
return console.error(
|
|
1742
|
+
`[Renderer] Unknown renderer type "${F}". Available types: ${Object.keys(RENDERER_MAP).join(", ")}`
|
|
1743
|
+
), null;
|
|
1744
|
+
const C = r ?? e, $ = l ?? n, x = c ?? s, Y = b ?? d, B = h ?? u, y = G ?? M ?? _ ?? "default", N = U ?? J ?? !1;
|
|
1745
|
+
return g(m === "form" ? {
|
|
1746
|
+
targetHtmlId: C,
|
|
1747
|
+
inFields: Y,
|
|
1748
|
+
inData: $,
|
|
1749
|
+
inColumns: x,
|
|
1750
|
+
inVariant: y,
|
|
1751
|
+
inSkeletonType: y,
|
|
1752
|
+
inShowLog: N,
|
|
1753
|
+
onSave: f == null ? void 0 : f.onSave,
|
|
1754
|
+
afterSave: f == null ? void 0 : f.afterSave,
|
|
1755
|
+
onNew: f == null ? void 0 : f.onNew
|
|
1756
|
+
} : m === "navtabs" || m === "nav" || m === "tabs" ? {
|
|
1757
|
+
targetHtmlId: C,
|
|
1758
|
+
inTabs: B,
|
|
1759
|
+
inData: $,
|
|
1760
|
+
inSkeletonType: y,
|
|
1761
|
+
inShowLog: N
|
|
1762
|
+
} : m === "datalist" || m === "data-list" ? {
|
|
1763
|
+
targetHtmlId: C,
|
|
1764
|
+
inData: $,
|
|
1765
|
+
inSkeletonType: y,
|
|
1766
|
+
inShowLog: N
|
|
1767
|
+
} : m === "select" ? {
|
|
1768
|
+
targetHtmlId: C,
|
|
1769
|
+
inData: $,
|
|
1770
|
+
inSkeletonType: y,
|
|
1771
|
+
inShowLog: N,
|
|
1772
|
+
inClassToApply: o
|
|
1773
|
+
} : {
|
|
1774
|
+
targetHtmlId: C,
|
|
1775
|
+
inColumns: x,
|
|
1776
|
+
inData: $,
|
|
1777
|
+
inColGroup: O ?? j,
|
|
1778
|
+
inFooterData: k ?? L ?? [],
|
|
1779
|
+
inConfig: P ?? H ?? {},
|
|
1780
|
+
inSkeletonType: y,
|
|
1781
|
+
inShowLog: N
|
|
1782
|
+
});
|
|
1783
|
+
};
|
|
1784
|
+
registerGlobal$2(render);
|
|
1785
|
+
export {
|
|
1786
|
+
render as default
|
|
1787
|
+
};
|