json-renderers-build 1.6.1 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/docs/dist/min.js +541 -266
- package/docs/dist/v4/min.js +320 -320
- package/docs/dist/v5/min.js +312 -312
- package/docs/dist/v7/min.js +272 -0
- package/docs/dist/v8/min.js +268 -0
- package/docs/dist/v9/min.js +587 -0
- package/docs/index.html +2 -2
- package/package.json +2 -2
- package/src/index.js +2 -2
- package/src/v7/common/deriveColumnsFromData.js +20 -0
- package/src/v7/index.js +47 -0
- package/src/v7/meta.js +6 -0
- package/src/v7/registerGlobal.js +14 -0
- package/src/v7/select/index.js +21 -0
- package/src/v7/select/options/index.js +17 -0
- package/src/v7/select/options/skeleton.json +17 -0
- package/src/v7/select/skeleton.json +7 -0
- package/src/v7/table/body/cells/index.js +23 -0
- package/src/v7/table/body/cells/skeleton.json +17 -0
- package/src/v7/table/body/index.js +15 -0
- package/src/v7/table/body/rows/index.js +36 -0
- package/src/v7/table/body/rows/skeleton.json +4 -0
- package/src/v7/table/body/skeleton.json +4 -0
- package/src/v7/table/head/cells/index.js +23 -0
- package/src/v7/table/head/cells/skeleton.json +17 -0
- package/src/v7/table/head/index.js +15 -0
- package/src/v7/table/head/row/index.js +15 -0
- package/src/v7/table/head/row/skeleton.json +4 -0
- package/src/v7/table/head/skeleton.json +4 -0
- package/src/v7/table/index.js +26 -0
- package/src/v7/table/skeleton.json +7 -0
- package/src/v8/common/deriveColumnsFromData.js +20 -0
- package/src/v8/index.js +40 -0
- package/src/v8/meta.js +6 -0
- package/src/v8/registerGlobal.js +14 -0
- package/src/v8/select/index.js +21 -0
- package/src/v8/select/options/index.js +17 -0
- package/src/v8/select/options/skeleton.json +17 -0
- package/src/v8/select/skeleton.json +7 -0
- package/src/v8/table/body/cells/index.js +17 -0
- package/src/v8/table/body/cells/skeleton.json +17 -0
- package/src/v8/table/body/index.js +20 -0
- package/src/v8/table/body/rows/index.js +23 -0
- package/src/v8/table/body/rows/skeleton.json +4 -0
- package/src/v8/table/body/skeleton.json +4 -0
- package/src/v8/table/head/cells/index.js +17 -0
- package/src/v8/table/head/cells/skeleton.json +17 -0
- package/src/v8/table/head/index.js +15 -0
- package/src/v8/table/head/row/index.js +15 -0
- package/src/v8/table/head/row/skeleton.json +4 -0
- package/src/v8/table/head/skeleton.json +4 -0
- package/src/v8/table/index.js +26 -0
- package/src/v8/table/skeleton.json +7 -0
- package/src/v9/common/deriveColumnsFromData.js +20 -0
- package/src/v9/index.js +36 -0
- package/src/v9/meta.js +6 -0
- package/src/v9/registerGlobal.js +14 -0
- package/src/v9/select/index.js +21 -0
- package/src/v9/select/options/index.js +17 -0
- package/src/v9/select/options/skeleton.json +17 -0
- package/src/v9/select/skeleton.json +7 -0
- package/src/v9/table/footer/empty/cell/index.js +5 -0
- package/src/v9/table/footer/empty/cell/tag.json +6 -0
- package/src/v9/table/footer/empty/index.js +6 -0
- package/src/v9/table/footer/empty/row/index.js +10 -0
- package/src/v9/table/footer/empty/row/tag.json +7 -0
- package/src/v9/table/footer/index.js +28 -0
- package/src/v9/table/footer/inputs/cell/index.js +15 -0
- package/src/v9/table/footer/inputs/cell/tag.json +7 -0
- package/src/v9/table/footer/inputs/index.js +6 -0
- package/src/v9/table/footer/inputs/input/tag.json +9 -0
- package/src/v9/table/footer/inputs/row/index.js +10 -0
- package/src/v9/table/footer/inputs/row/tag.json +7 -0
- package/src/v9/table/footer/inputsWithSave/button/tag.json +8 -0
- package/src/v9/table/footer/inputsWithSave/cell/index.js +20 -0
- package/src/v9/table/footer/inputsWithSave/cell/tag.json +7 -0
- package/src/v9/table/footer/inputsWithSave/index.js +6 -0
- package/src/v9/table/footer/inputsWithSave/input/tag.json +9 -0
- package/src/v9/table/footer/inputsWithSave/row/index.js +13 -0
- package/src/v9/table/footer/inputsWithSave/row/tag.json +7 -0
- package/src/v9/table/footer/tag.json +7 -0
- package/src/v9/table/footer/totals/cell/index.js +21 -0
- package/src/v9/table/footer/totals/cell/tag.json +7 -0
- package/src/v9/table/footer/totals/index.js +6 -0
- package/src/v9/table/footer/totals/row/index.js +12 -0
- package/src/v9/table/footer/totals/row/tag.json +7 -0
- package/src/v9/table/index.js +33 -0
- package/src/v9/table/options/index.js +18 -0
- package/src/v9/table/options/showOptions/index.js +39 -0
- package/src/v9/table/options/showSerial/index.js +19 -0
- package/src/v9/table/render-requests.json +107 -0
- package/src/v9/table/table/body/cell/index.js +12 -0
- package/src/v9/table/table/body/cell/tag.json +7 -0
- package/src/v9/table/table/body/index.js +17 -0
- package/src/v9/table/table/body/row/index.js +18 -0
- package/src/v9/table/table/body/row/tag.json +4 -0
- package/src/v9/table/table/body/tag.json +4 -0
- package/src/v9/table/table/head/cell/index.js +12 -0
- package/src/v9/table/table/head/cell/tag.json +7 -0
- package/src/v9/table/table/head/index.js +16 -0
- package/src/v9/table/table/head/row/index.js +14 -0
- package/src/v9/table/table/head/row/tag.json +4 -0
- package/src/v9/table/table/head/tag.json +4 -0
- package/src/v9/table/table/index.js +36 -0
- package/src/v9/table/table/tag.json +7 -0
- package/src/v9/table_10oct/body/cells/index.js +17 -0
- package/src/v9/table_10oct/body/cells/skeleton.json +17 -0
- package/src/v9/table_10oct/body/index.js +20 -0
- package/src/v9/table_10oct/body/rows/index.js +23 -0
- package/src/v9/table_10oct/body/rows/skeleton.json +4 -0
- package/src/v9/table_10oct/body/skeleton.json +4 -0
- package/src/v9/table_10oct/head/cells/index.js +17 -0
- package/src/v9/table_10oct/head/cells/skeleton.json +17 -0
- package/src/v9/table_10oct/head/index.js +15 -0
- package/src/v9/table_10oct/head/row/index.js +15 -0
- package/src/v9/table_10oct/head/row/skeleton.json +4 -0
- package/src/v9/table_10oct/head/skeleton.json +4 -0
- package/src/v9/table_10oct/index.js +26 -0
- package/src/v9/table_10oct/skeleton.json +7 -0
package/docs/dist/v4/min.js
CHANGED
|
@@ -1,320 +1,320 @@
|
|
|
1
|
-
const g = {
|
|
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
|
-
}, j = (t) => {
|
|
5
|
-
var r;
|
|
6
|
-
typeof globalThis > "u" || !t || (globalThis.ks ?? (globalThis.ks = {}), (r = globalThis.ks).jsonRenderersBuild ?? (r.jsonRenderersBuild = {
|
|
7
|
-
meta: g,
|
|
8
|
-
renderToDom: t
|
|
9
|
-
}));
|
|
10
|
-
}, E = {
|
|
11
|
-
version: "v32",
|
|
12
|
-
description: "JSON-to-DOM engine with centralized traversal and responsibility-focused construction"
|
|
13
|
-
}, N = ({ inFuncDefinition: t } = {}) => {
|
|
14
|
-
if (typeof globalThis > "u" || !t) return;
|
|
15
|
-
globalThis.ks ?? (globalThis.ks = {});
|
|
16
|
-
const r = {
|
|
17
|
-
meta: E,
|
|
18
|
-
buildSpecElement: t
|
|
19
|
-
};
|
|
20
|
-
globalThis.ks.jsonToSpec = r;
|
|
21
|
-
}, O = (t, r) => f(t, r), b = (t, r) => Array.isArray(t) ? t.map((e) => O(e, r)).flat(1 / 0).filter(Boolean) : [], x = (t, r) => {
|
|
22
|
-
if ("source" in t && (t == null ? void 0 : t.source) in r) {
|
|
23
|
-
const e = r[t == null ? void 0 : t.source];
|
|
24
|
-
if (Array.isArray(e))
|
|
25
|
-
return e.map((o) => {
|
|
26
|
-
const c = t == null ? void 0 : t.template;
|
|
27
|
-
if (c)
|
|
28
|
-
return f(c, o);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}, F = (t, r) => {
|
|
32
|
-
let e = [];
|
|
33
|
-
for (const [n, o] of Object.entries(r)) {
|
|
34
|
-
const c = t == null ? void 0 : t.template;
|
|
35
|
-
if (c) {
|
|
36
|
-
const a = f(c, {
|
|
37
|
-
key: n,
|
|
38
|
-
value: o
|
|
39
|
-
});
|
|
40
|
-
e.push(a);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return e;
|
|
44
|
-
}, R = (t, r) => {
|
|
45
|
-
if ("source" in t && (t == null ? void 0 : t.source) in r) {
|
|
46
|
-
const e = r[t == null ? void 0 : t.source];
|
|
47
|
-
if (Array.isArray(e))
|
|
48
|
-
return e.map((o) => {
|
|
49
|
-
const c = t == null ? void 0 : t.template;
|
|
50
|
-
if (c)
|
|
51
|
-
return f(c, o);
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}, D = (t, r) => {
|
|
55
|
-
if ("operation" in t) {
|
|
56
|
-
if (t.operation === "loopArray")
|
|
57
|
-
return x(t, r);
|
|
58
|
-
if (t.operation === "loopObject")
|
|
59
|
-
return F(t, r);
|
|
60
|
-
if (t.operation === "loopCollection")
|
|
61
|
-
return R(t, r);
|
|
62
|
-
}
|
|
63
|
-
}, A = (t, r) => {
|
|
64
|
-
if (typeof r == "string") return r;
|
|
65
|
-
if (typeof t != "string") return t;
|
|
66
|
-
if (t === "${value}")
|
|
67
|
-
return r.value;
|
|
68
|
-
const e = t.match(/^\$\{(.+?)\}$/);
|
|
69
|
-
if (e) {
|
|
70
|
-
const n = e[1];
|
|
71
|
-
return (r == null ? void 0 : r[n]) ?? "";
|
|
72
|
-
}
|
|
73
|
-
return t;
|
|
74
|
-
}, k = (t, r) => {
|
|
75
|
-
let e = {};
|
|
76
|
-
for (const [n, o] of Object.entries(t)) {
|
|
77
|
-
const c = A(o, r);
|
|
78
|
-
e[n] = c;
|
|
79
|
-
}
|
|
80
|
-
return e;
|
|
81
|
-
}, C = (t, r) => {
|
|
82
|
-
if ("tagName" in t) {
|
|
83
|
-
if ("textContent" in t) {
|
|
84
|
-
const e = A(t.textContent, r);
|
|
85
|
-
t.textContent = e;
|
|
86
|
-
}
|
|
87
|
-
if ("attributes" in t) {
|
|
88
|
-
const e = k(t.attributes, r);
|
|
89
|
-
t.attributes = e;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}, w = (t, r) => {
|
|
93
|
-
if (!t || typeof t != "object" || Array.isArray(t)) return null;
|
|
94
|
-
const e = structuredClone(t);
|
|
95
|
-
if (!e) return null;
|
|
96
|
-
if ("tagName" in e && C(e, r), "jsonToSpec" in e) {
|
|
97
|
-
const n = e == null ? void 0 : e.jsonToSpec, o = D(n, r);
|
|
98
|
-
Array.isArray(o) ? e.children = o : e.children = [o], delete e.jsonToSpec;
|
|
99
|
-
}
|
|
100
|
-
if (Array.isArray(e == null ? void 0 : e.children)) {
|
|
101
|
-
const n = b(e == null ? void 0 : e.children, r);
|
|
102
|
-
e.children = n;
|
|
103
|
-
}
|
|
104
|
-
return e;
|
|
105
|
-
}, f = (t, r) => t == null ? null : typeof Node < "u" && t instanceof Node ? t : Array.isArray(t) ? b(t, r) : typeof t == "object" ? w(t, r) : typeof t == "string" || typeof t == "number" ? document.createTextNode(String(t)) : t, y = (t, r) => f(t, r);
|
|
106
|
-
N({
|
|
107
|
-
inFuncDefinition: y
|
|
108
|
-
});
|
|
109
|
-
const V = {
|
|
110
|
-
default: {
|
|
111
|
-
tagName: "table",
|
|
112
|
-
attributes: {
|
|
113
|
-
class: "table table-hover table-striped mb-0"
|
|
114
|
-
},
|
|
115
|
-
children: [
|
|
116
|
-
{
|
|
117
|
-
tagName: "thead",
|
|
118
|
-
children: [
|
|
119
|
-
{
|
|
120
|
-
tagName: "tr",
|
|
121
|
-
jsonToSpec: {
|
|
122
|
-
operation: "loopCollection",
|
|
123
|
-
source: "columns",
|
|
124
|
-
template: {
|
|
125
|
-
tagName: "th",
|
|
126
|
-
textContent: "${title}"
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
children: []
|
|
130
|
-
}
|
|
131
|
-
]
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
tagName: "tbody",
|
|
135
|
-
jsonToSpec: {
|
|
136
|
-
operation: "loopCollection",
|
|
137
|
-
source: "data",
|
|
138
|
-
template: {
|
|
139
|
-
tagName: "tr",
|
|
140
|
-
jsonToSpec: {
|
|
141
|
-
operation: "loopObject",
|
|
142
|
-
source: "data",
|
|
143
|
-
template: {
|
|
144
|
-
tagName: "td",
|
|
145
|
-
textContent: "${value}"
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
children: []
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
children: []
|
|
152
|
-
}
|
|
153
|
-
]
|
|
154
|
-
}
|
|
155
|
-
}, I = ({
|
|
156
|
-
inColumns: t,
|
|
157
|
-
inData: r
|
|
158
|
-
} = {}) => {
|
|
159
|
-
const e = r ?? [], n = t;
|
|
160
|
-
return y(V.default, {
|
|
161
|
-
columns: n,
|
|
162
|
-
data: e
|
|
163
|
-
});
|
|
164
|
-
}, K = "select", B = {
|
|
165
|
-
id: "LedgerName"
|
|
166
|
-
}, M = {
|
|
167
|
-
operation: "loopArray",
|
|
168
|
-
source: "arrayOfStrings",
|
|
169
|
-
template: {
|
|
170
|
-
tagName: "option",
|
|
171
|
-
attributes: {
|
|
172
|
-
value: "${}"
|
|
173
|
-
},
|
|
174
|
-
textContent: "${}"
|
|
175
|
-
}
|
|
176
|
-
}, T = [], G = {
|
|
177
|
-
tagName: K,
|
|
178
|
-
attributes: B,
|
|
179
|
-
jsonToSpec: M,
|
|
180
|
-
children: T
|
|
181
|
-
}, z = ({
|
|
182
|
-
inData: t
|
|
183
|
-
} = {}) => y(G, {
|
|
184
|
-
arrayOfStrings: t ?? []
|
|
185
|
-
}), $ = ({ inItems: t, inRecipe: r, inExecute: e }) => {
|
|
186
|
-
const n = t, o = r, c = e;
|
|
187
|
-
return n.map((a) => d({
|
|
188
|
-
inSource: a,
|
|
189
|
-
inRecipe: o,
|
|
190
|
-
inExecute: c
|
|
191
|
-
})).flat(1 / 0).filter(Boolean);
|
|
192
|
-
}, L = ({ inSource: t, inRecipe: r, inExecute: e }) => {
|
|
193
|
-
const n = t, o = r, c = e;
|
|
194
|
-
let a = n;
|
|
195
|
-
typeof c == "function" && (a = c({
|
|
196
|
-
inSource: n,
|
|
197
|
-
inRecipe: o
|
|
198
|
-
}));
|
|
199
|
-
for (const [l, u] of Object.entries(a))
|
|
200
|
-
Array.isArray(u) && o && l in o && (a[l] = $({
|
|
201
|
-
inItems: u,
|
|
202
|
-
inRecipe: o[l],
|
|
203
|
-
inExecute: c
|
|
204
|
-
}));
|
|
205
|
-
return a;
|
|
206
|
-
}, d = ({ inSource: t, inRecipe: r, inExecute: e }) => {
|
|
207
|
-
const n = t, o = r, c = e;
|
|
208
|
-
return Array.isArray(n) ? $({
|
|
209
|
-
inItems: n,
|
|
210
|
-
inRecipe: o,
|
|
211
|
-
inExecute: c
|
|
212
|
-
}) : typeof n == "object" && n !== null ? L({
|
|
213
|
-
inSource: n,
|
|
214
|
-
inRecipe: o,
|
|
215
|
-
inExecute: c
|
|
216
|
-
}) : n;
|
|
217
|
-
}, P = ({ inKey: t, inDirective: r }) => {
|
|
218
|
-
const e = t, n = r;
|
|
219
|
-
return (n == null ? void 0 : n.alterKey) || e;
|
|
220
|
-
}, U = ({ inValue: t, inDirective: r, inExecute: e }) => {
|
|
221
|
-
const n = t, o = r, c = e;
|
|
222
|
-
return o && "transform" in o ? d({
|
|
223
|
-
inSource: n,
|
|
224
|
-
inRecipe: o,
|
|
225
|
-
inExecute: c
|
|
226
|
-
}) : n;
|
|
227
|
-
}, _ = ({ inValue: t, inDirective: r }) => {
|
|
228
|
-
const e = t, n = r;
|
|
229
|
-
return (n == null ? void 0 : n.valueType) === "array" && !Array.isArray(e) ? [e] : e;
|
|
230
|
-
}, q = ({ inValue: t, inDirective: r }) => {
|
|
231
|
-
const e = t, n = r;
|
|
232
|
-
return n != null && n.valueKey && e && typeof e == "object" ? e[n.valueKey] : e;
|
|
233
|
-
}, H = ({ inSource: t, inTransform: r, inExecute: e }) => {
|
|
234
|
-
const n = t, o = r, c = e, a = {};
|
|
235
|
-
for (const [l, u] of Object.entries(n)) {
|
|
236
|
-
if (!(l in o))
|
|
237
|
-
continue;
|
|
238
|
-
const i = o[l], h = P({ inKey: l, inDirective: i });
|
|
239
|
-
let s = u;
|
|
240
|
-
s = U({
|
|
241
|
-
inValue: s,
|
|
242
|
-
inDirective: i,
|
|
243
|
-
inExecute: c
|
|
244
|
-
}), s = _({ inValue: s, inDirective: i }), s = q({ inValue: s, inDirective: i }), a[h] = s;
|
|
245
|
-
}
|
|
246
|
-
return a;
|
|
247
|
-
};
|
|
248
|
-
function v(t, r) {
|
|
249
|
-
for (const e in t)
|
|
250
|
-
typeof t[e] == "object" && t[e] !== null ? v(t[e], r) : typeof t[e] == "string" && t[e] === "${}" && (t[e] = r);
|
|
251
|
-
return t;
|
|
252
|
-
}
|
|
253
|
-
const Q = ({ inSource: t, inOperation: r, inExecute: e }) => {
|
|
254
|
-
const n = t, o = r;
|
|
255
|
-
for (const [c, a] of Object.entries(o))
|
|
256
|
-
if ("operationType" in a && a.operationType === "loopArray" && c in n) {
|
|
257
|
-
const l = n[c].map((u) => {
|
|
258
|
-
const i = { ...a == null ? void 0 : a.template };
|
|
259
|
-
return v(i, u), i;
|
|
260
|
-
});
|
|
261
|
-
n[c] = l;
|
|
262
|
-
}
|
|
263
|
-
return n;
|
|
264
|
-
}, m = ({ inSource: t, inRecipe: r }) => {
|
|
265
|
-
let e = t;
|
|
266
|
-
const n = r;
|
|
267
|
-
return n && typeof n == "object" && "transform" in n && (e = H({
|
|
268
|
-
inSource: e,
|
|
269
|
-
inTransform: n.transform,
|
|
270
|
-
inExecute: m
|
|
271
|
-
})), n && typeof n == "object" && "operation" in n && (e = Q({
|
|
272
|
-
inSource: e,
|
|
273
|
-
inOperation: n.operation,
|
|
274
|
-
inExecute: m
|
|
275
|
-
})), e;
|
|
276
|
-
}, W = (t, r) => d({
|
|
277
|
-
inSource: t,
|
|
278
|
-
inRecipe: r,
|
|
279
|
-
inExecute: m
|
|
280
|
-
}), X = {
|
|
281
|
-
children: ""
|
|
282
|
-
}, Y = {
|
|
283
|
-
children: {
|
|
284
|
-
operationType: "loopArray",
|
|
285
|
-
template: {
|
|
286
|
-
tagName: "option",
|
|
287
|
-
attributes: {
|
|
288
|
-
value: "${}"
|
|
289
|
-
},
|
|
290
|
-
textContent: "${}"
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}, Z = {
|
|
294
|
-
transform: X,
|
|
295
|
-
operation: Y
|
|
296
|
-
}, S = ({
|
|
297
|
-
inData: t
|
|
298
|
-
} = {}) => W({
|
|
299
|
-
Children: t ?? []
|
|
300
|
-
}, Z), p = {
|
|
301
|
-
table: I,
|
|
302
|
-
select: z,
|
|
303
|
-
selectOptionsOnly: S
|
|
304
|
-
}, J = ({
|
|
305
|
-
type: t = "table",
|
|
306
|
-
data: r,
|
|
307
|
-
columns: e
|
|
308
|
-
} = {}) => {
|
|
309
|
-
const n = t, o = p[n];
|
|
310
|
-
return o ? o({
|
|
311
|
-
inColumns: e,
|
|
312
|
-
inData: r
|
|
313
|
-
}) : (console.error(
|
|
314
|
-
`[Renderer] Unknown renderer type "${n}". Available types: ${Object.keys(p).join(", ")}`
|
|
315
|
-
), null);
|
|
316
|
-
};
|
|
317
|
-
j(J);
|
|
318
|
-
export {
|
|
319
|
-
J as default
|
|
320
|
-
};
|
|
1
|
+
const g = {
|
|
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
|
+
}, j = (t) => {
|
|
5
|
+
var r;
|
|
6
|
+
typeof globalThis > "u" || !t || (globalThis.ks ?? (globalThis.ks = {}), (r = globalThis.ks).jsonRenderersBuild ?? (r.jsonRenderersBuild = {
|
|
7
|
+
meta: g,
|
|
8
|
+
renderToDom: t
|
|
9
|
+
}));
|
|
10
|
+
}, E = {
|
|
11
|
+
version: "v32",
|
|
12
|
+
description: "JSON-to-DOM engine with centralized traversal and responsibility-focused construction"
|
|
13
|
+
}, N = ({ inFuncDefinition: t } = {}) => {
|
|
14
|
+
if (typeof globalThis > "u" || !t) return;
|
|
15
|
+
globalThis.ks ?? (globalThis.ks = {});
|
|
16
|
+
const r = {
|
|
17
|
+
meta: E,
|
|
18
|
+
buildSpecElement: t
|
|
19
|
+
};
|
|
20
|
+
globalThis.ks.jsonToSpec = r;
|
|
21
|
+
}, O = (t, r) => f(t, r), b = (t, r) => Array.isArray(t) ? t.map((e) => O(e, r)).flat(1 / 0).filter(Boolean) : [], x = (t, r) => {
|
|
22
|
+
if ("source" in t && (t == null ? void 0 : t.source) in r) {
|
|
23
|
+
const e = r[t == null ? void 0 : t.source];
|
|
24
|
+
if (Array.isArray(e))
|
|
25
|
+
return e.map((o) => {
|
|
26
|
+
const c = t == null ? void 0 : t.template;
|
|
27
|
+
if (c)
|
|
28
|
+
return f(c, o);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}, F = (t, r) => {
|
|
32
|
+
let e = [];
|
|
33
|
+
for (const [n, o] of Object.entries(r)) {
|
|
34
|
+
const c = t == null ? void 0 : t.template;
|
|
35
|
+
if (c) {
|
|
36
|
+
const a = f(c, {
|
|
37
|
+
key: n,
|
|
38
|
+
value: o
|
|
39
|
+
});
|
|
40
|
+
e.push(a);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return e;
|
|
44
|
+
}, R = (t, r) => {
|
|
45
|
+
if ("source" in t && (t == null ? void 0 : t.source) in r) {
|
|
46
|
+
const e = r[t == null ? void 0 : t.source];
|
|
47
|
+
if (Array.isArray(e))
|
|
48
|
+
return e.map((o) => {
|
|
49
|
+
const c = t == null ? void 0 : t.template;
|
|
50
|
+
if (c)
|
|
51
|
+
return f(c, o);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}, D = (t, r) => {
|
|
55
|
+
if ("operation" in t) {
|
|
56
|
+
if (t.operation === "loopArray")
|
|
57
|
+
return x(t, r);
|
|
58
|
+
if (t.operation === "loopObject")
|
|
59
|
+
return F(t, r);
|
|
60
|
+
if (t.operation === "loopCollection")
|
|
61
|
+
return R(t, r);
|
|
62
|
+
}
|
|
63
|
+
}, A = (t, r) => {
|
|
64
|
+
if (typeof r == "string") return r;
|
|
65
|
+
if (typeof t != "string") return t;
|
|
66
|
+
if (t === "${value}")
|
|
67
|
+
return r.value;
|
|
68
|
+
const e = t.match(/^\$\{(.+?)\}$/);
|
|
69
|
+
if (e) {
|
|
70
|
+
const n = e[1];
|
|
71
|
+
return (r == null ? void 0 : r[n]) ?? "";
|
|
72
|
+
}
|
|
73
|
+
return t;
|
|
74
|
+
}, k = (t, r) => {
|
|
75
|
+
let e = {};
|
|
76
|
+
for (const [n, o] of Object.entries(t)) {
|
|
77
|
+
const c = A(o, r);
|
|
78
|
+
e[n] = c;
|
|
79
|
+
}
|
|
80
|
+
return e;
|
|
81
|
+
}, C = (t, r) => {
|
|
82
|
+
if ("tagName" in t) {
|
|
83
|
+
if ("textContent" in t) {
|
|
84
|
+
const e = A(t.textContent, r);
|
|
85
|
+
t.textContent = e;
|
|
86
|
+
}
|
|
87
|
+
if ("attributes" in t) {
|
|
88
|
+
const e = k(t.attributes, r);
|
|
89
|
+
t.attributes = e;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}, w = (t, r) => {
|
|
93
|
+
if (!t || typeof t != "object" || Array.isArray(t)) return null;
|
|
94
|
+
const e = structuredClone(t);
|
|
95
|
+
if (!e) return null;
|
|
96
|
+
if ("tagName" in e && C(e, r), "jsonToSpec" in e) {
|
|
97
|
+
const n = e == null ? void 0 : e.jsonToSpec, o = D(n, r);
|
|
98
|
+
Array.isArray(o) ? e.children = o : e.children = [o], delete e.jsonToSpec;
|
|
99
|
+
}
|
|
100
|
+
if (Array.isArray(e == null ? void 0 : e.children)) {
|
|
101
|
+
const n = b(e == null ? void 0 : e.children, r);
|
|
102
|
+
e.children = n;
|
|
103
|
+
}
|
|
104
|
+
return e;
|
|
105
|
+
}, f = (t, r) => t == null ? null : typeof Node < "u" && t instanceof Node ? t : Array.isArray(t) ? b(t, r) : typeof t == "object" ? w(t, r) : typeof t == "string" || typeof t == "number" ? document.createTextNode(String(t)) : t, y = (t, r) => f(t, r);
|
|
106
|
+
N({
|
|
107
|
+
inFuncDefinition: y
|
|
108
|
+
});
|
|
109
|
+
const V = {
|
|
110
|
+
default: {
|
|
111
|
+
tagName: "table",
|
|
112
|
+
attributes: {
|
|
113
|
+
class: "table table-hover table-striped mb-0"
|
|
114
|
+
},
|
|
115
|
+
children: [
|
|
116
|
+
{
|
|
117
|
+
tagName: "thead",
|
|
118
|
+
children: [
|
|
119
|
+
{
|
|
120
|
+
tagName: "tr",
|
|
121
|
+
jsonToSpec: {
|
|
122
|
+
operation: "loopCollection",
|
|
123
|
+
source: "columns",
|
|
124
|
+
template: {
|
|
125
|
+
tagName: "th",
|
|
126
|
+
textContent: "${title}"
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
children: []
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
tagName: "tbody",
|
|
135
|
+
jsonToSpec: {
|
|
136
|
+
operation: "loopCollection",
|
|
137
|
+
source: "data",
|
|
138
|
+
template: {
|
|
139
|
+
tagName: "tr",
|
|
140
|
+
jsonToSpec: {
|
|
141
|
+
operation: "loopObject",
|
|
142
|
+
source: "data",
|
|
143
|
+
template: {
|
|
144
|
+
tagName: "td",
|
|
145
|
+
textContent: "${value}"
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
children: []
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
children: []
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
}, I = ({
|
|
156
|
+
inColumns: t,
|
|
157
|
+
inData: r
|
|
158
|
+
} = {}) => {
|
|
159
|
+
const e = r ?? [], n = t;
|
|
160
|
+
return y(V.default, {
|
|
161
|
+
columns: n,
|
|
162
|
+
data: e
|
|
163
|
+
});
|
|
164
|
+
}, K = "select", B = {
|
|
165
|
+
id: "LedgerName"
|
|
166
|
+
}, M = {
|
|
167
|
+
operation: "loopArray",
|
|
168
|
+
source: "arrayOfStrings",
|
|
169
|
+
template: {
|
|
170
|
+
tagName: "option",
|
|
171
|
+
attributes: {
|
|
172
|
+
value: "${}"
|
|
173
|
+
},
|
|
174
|
+
textContent: "${}"
|
|
175
|
+
}
|
|
176
|
+
}, T = [], G = {
|
|
177
|
+
tagName: K,
|
|
178
|
+
attributes: B,
|
|
179
|
+
jsonToSpec: M,
|
|
180
|
+
children: T
|
|
181
|
+
}, z = ({
|
|
182
|
+
inData: t
|
|
183
|
+
} = {}) => y(G, {
|
|
184
|
+
arrayOfStrings: t ?? []
|
|
185
|
+
}), $ = ({ inItems: t, inRecipe: r, inExecute: e }) => {
|
|
186
|
+
const n = t, o = r, c = e;
|
|
187
|
+
return n.map((a) => d({
|
|
188
|
+
inSource: a,
|
|
189
|
+
inRecipe: o,
|
|
190
|
+
inExecute: c
|
|
191
|
+
})).flat(1 / 0).filter(Boolean);
|
|
192
|
+
}, L = ({ inSource: t, inRecipe: r, inExecute: e }) => {
|
|
193
|
+
const n = t, o = r, c = e;
|
|
194
|
+
let a = n;
|
|
195
|
+
typeof c == "function" && (a = c({
|
|
196
|
+
inSource: n,
|
|
197
|
+
inRecipe: o
|
|
198
|
+
}));
|
|
199
|
+
for (const [l, u] of Object.entries(a))
|
|
200
|
+
Array.isArray(u) && o && l in o && (a[l] = $({
|
|
201
|
+
inItems: u,
|
|
202
|
+
inRecipe: o[l],
|
|
203
|
+
inExecute: c
|
|
204
|
+
}));
|
|
205
|
+
return a;
|
|
206
|
+
}, d = ({ inSource: t, inRecipe: r, inExecute: e }) => {
|
|
207
|
+
const n = t, o = r, c = e;
|
|
208
|
+
return Array.isArray(n) ? $({
|
|
209
|
+
inItems: n,
|
|
210
|
+
inRecipe: o,
|
|
211
|
+
inExecute: c
|
|
212
|
+
}) : typeof n == "object" && n !== null ? L({
|
|
213
|
+
inSource: n,
|
|
214
|
+
inRecipe: o,
|
|
215
|
+
inExecute: c
|
|
216
|
+
}) : n;
|
|
217
|
+
}, P = ({ inKey: t, inDirective: r }) => {
|
|
218
|
+
const e = t, n = r;
|
|
219
|
+
return (n == null ? void 0 : n.alterKey) || e;
|
|
220
|
+
}, U = ({ inValue: t, inDirective: r, inExecute: e }) => {
|
|
221
|
+
const n = t, o = r, c = e;
|
|
222
|
+
return o && "transform" in o ? d({
|
|
223
|
+
inSource: n,
|
|
224
|
+
inRecipe: o,
|
|
225
|
+
inExecute: c
|
|
226
|
+
}) : n;
|
|
227
|
+
}, _ = ({ inValue: t, inDirective: r }) => {
|
|
228
|
+
const e = t, n = r;
|
|
229
|
+
return (n == null ? void 0 : n.valueType) === "array" && !Array.isArray(e) ? [e] : e;
|
|
230
|
+
}, q = ({ inValue: t, inDirective: r }) => {
|
|
231
|
+
const e = t, n = r;
|
|
232
|
+
return n != null && n.valueKey && e && typeof e == "object" ? e[n.valueKey] : e;
|
|
233
|
+
}, H = ({ inSource: t, inTransform: r, inExecute: e }) => {
|
|
234
|
+
const n = t, o = r, c = e, a = {};
|
|
235
|
+
for (const [l, u] of Object.entries(n)) {
|
|
236
|
+
if (!(l in o))
|
|
237
|
+
continue;
|
|
238
|
+
const i = o[l], h = P({ inKey: l, inDirective: i });
|
|
239
|
+
let s = u;
|
|
240
|
+
s = U({
|
|
241
|
+
inValue: s,
|
|
242
|
+
inDirective: i,
|
|
243
|
+
inExecute: c
|
|
244
|
+
}), s = _({ inValue: s, inDirective: i }), s = q({ inValue: s, inDirective: i }), a[h] = s;
|
|
245
|
+
}
|
|
246
|
+
return a;
|
|
247
|
+
};
|
|
248
|
+
function v(t, r) {
|
|
249
|
+
for (const e in t)
|
|
250
|
+
typeof t[e] == "object" && t[e] !== null ? v(t[e], r) : typeof t[e] == "string" && t[e] === "${}" && (t[e] = r);
|
|
251
|
+
return t;
|
|
252
|
+
}
|
|
253
|
+
const Q = ({ inSource: t, inOperation: r, inExecute: e }) => {
|
|
254
|
+
const n = t, o = r;
|
|
255
|
+
for (const [c, a] of Object.entries(o))
|
|
256
|
+
if ("operationType" in a && a.operationType === "loopArray" && c in n) {
|
|
257
|
+
const l = n[c].map((u) => {
|
|
258
|
+
const i = { ...a == null ? void 0 : a.template };
|
|
259
|
+
return v(i, u), i;
|
|
260
|
+
});
|
|
261
|
+
n[c] = l;
|
|
262
|
+
}
|
|
263
|
+
return n;
|
|
264
|
+
}, m = ({ inSource: t, inRecipe: r }) => {
|
|
265
|
+
let e = t;
|
|
266
|
+
const n = r;
|
|
267
|
+
return n && typeof n == "object" && "transform" in n && (e = H({
|
|
268
|
+
inSource: e,
|
|
269
|
+
inTransform: n.transform,
|
|
270
|
+
inExecute: m
|
|
271
|
+
})), n && typeof n == "object" && "operation" in n && (e = Q({
|
|
272
|
+
inSource: e,
|
|
273
|
+
inOperation: n.operation,
|
|
274
|
+
inExecute: m
|
|
275
|
+
})), e;
|
|
276
|
+
}, W = (t, r) => d({
|
|
277
|
+
inSource: t,
|
|
278
|
+
inRecipe: r,
|
|
279
|
+
inExecute: m
|
|
280
|
+
}), X = {
|
|
281
|
+
children: ""
|
|
282
|
+
}, Y = {
|
|
283
|
+
children: {
|
|
284
|
+
operationType: "loopArray",
|
|
285
|
+
template: {
|
|
286
|
+
tagName: "option",
|
|
287
|
+
attributes: {
|
|
288
|
+
value: "${}"
|
|
289
|
+
},
|
|
290
|
+
textContent: "${}"
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}, Z = {
|
|
294
|
+
transform: X,
|
|
295
|
+
operation: Y
|
|
296
|
+
}, S = ({
|
|
297
|
+
inData: t
|
|
298
|
+
} = {}) => W({
|
|
299
|
+
Children: t ?? []
|
|
300
|
+
}, Z), p = {
|
|
301
|
+
table: I,
|
|
302
|
+
select: z,
|
|
303
|
+
selectOptionsOnly: S
|
|
304
|
+
}, J = ({
|
|
305
|
+
type: t = "table",
|
|
306
|
+
data: r,
|
|
307
|
+
columns: e
|
|
308
|
+
} = {}) => {
|
|
309
|
+
const n = t, o = p[n];
|
|
310
|
+
return o ? o({
|
|
311
|
+
inColumns: e,
|
|
312
|
+
inData: r
|
|
313
|
+
}) : (console.error(
|
|
314
|
+
`[Renderer] Unknown renderer type "${n}". Available types: ${Object.keys(p).join(", ")}`
|
|
315
|
+
), null);
|
|
316
|
+
};
|
|
317
|
+
j(J);
|
|
318
|
+
export {
|
|
319
|
+
J as default
|
|
320
|
+
};
|