json-renderers 1.16.1 → 1.17.3
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 +6 -1
- package/docs/dist/min.js +899 -832
- package/docs/dist/v16/min.js +1576 -0
- package/docs/dist/v17/min.js +1577 -0
- package/package.json +2 -2
- package/src/index.js +2 -2
- package/src/v16/buildSpec/index.js +40 -40
- package/src/v16/common/deriveColumnsFromData.js +20 -20
- package/src/v16/guard.js +38 -38
- package/src/v16/index.js +106 -110
- package/src/v16/meta.js +6 -6
- package/src/v16/registerGlobal.js +27 -27
- package/src/v17/buildSpec/index.js +25 -0
- package/src/v17/getSpec.js +12 -0
- package/src/v17/guard.js +41 -0
- package/src/v17/index.js +29 -0
- package/src/{v11 → v17}/meta.js +1 -1
- package/src/v17/registerGlobal.js +28 -0
- package/src/v17/renderToDom/index.js +47 -0
- package/src/v17/spec.json +9 -0
- package/src/v17/validateConfig.js +37 -0
- package/src/v11/dataLists/fragments.json +0 -1
- package/src/v11/dataLists/index.js +0 -32
- package/src/v11/dataLists/skeleton.json +0 -38
- package/src/v11/index.js +0 -62
- package/src/v11/registerGlobal.js +0 -14
- package/src/v11/select/fragments.json +0 -1
- package/src/v11/select/index.js +0 -34
- package/src/v11/select/skeleton.json +0 -23
- package/src/v11/table/index.js +0 -35
- package/src/v11/table/skeleton.json +0 -47
- package/src/v12/common/deriveColumnsFromData.js +0 -20
- package/src/v12/index.js +0 -62
- package/src/v12/meta.js +0 -6
- package/src/v12/registerGlobal.js +0 -14
- package/src/v12/table/index.js +0 -35
- package/src/v12/table/skeleton.json +0 -47
- package/src/v13/buildSpec/index.js +0 -39
- package/src/v13/common/deriveColumnsFromData.js +0 -20
- package/src/v13/index.js +0 -81
- package/src/v13/meta.js +0 -6
- package/src/v13/registerGlobal.js +0 -14
- /package/src/{v11 → v17}/common/deriveColumnsFromData.js +0 -0
package/src/v13/index.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import registerGlobal from "./registerGlobal.js";
|
|
2
|
-
|
|
3
|
-
import buildSpec from "./buildSpec/index.js";
|
|
4
|
-
|
|
5
|
-
const render = ({
|
|
6
|
-
type = "table",
|
|
7
|
-
targetHtmlId,
|
|
8
|
-
data,
|
|
9
|
-
classToApply,
|
|
10
|
-
columns,
|
|
11
|
-
appendPosition,
|
|
12
|
-
showLog = false
|
|
13
|
-
} = {}) => {
|
|
14
|
-
const rawType = type;
|
|
15
|
-
|
|
16
|
-
const localTargetHtmlId = targetHtmlId;
|
|
17
|
-
const localData = data;
|
|
18
|
-
const localColumns = columns;
|
|
19
|
-
|
|
20
|
-
if (showLog) console.log("showLog 1 :", rawType, targetHtmlId, data, classToApply, columns, appendPosition);
|
|
21
|
-
|
|
22
|
-
// Default to table renderer
|
|
23
|
-
const content = buildSpec({
|
|
24
|
-
inTargetHtmlId: localTargetHtmlId,
|
|
25
|
-
inColumns: localColumns, showLog,
|
|
26
|
-
inData: localData, type: rawType
|
|
27
|
-
});
|
|
28
|
-
if (showLog) console.log("showLog 2 :", content);
|
|
29
|
-
|
|
30
|
-
const container = document.getElementById(localTargetHtmlId);
|
|
31
|
-
|
|
32
|
-
if (showLog) console.log("showLog 3 :", container);
|
|
33
|
-
|
|
34
|
-
const isCollection = Array.isArray(content) ||
|
|
35
|
-
content instanceof NodeList ||
|
|
36
|
-
content instanceof HTMLCollection;
|
|
37
|
-
|
|
38
|
-
console.log("prepend ---------:", rawType, isCollection, container, content, localData);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (isCollection) {
|
|
42
|
-
if (appendPosition === "prepend") {
|
|
43
|
-
container.prepend(...content);
|
|
44
|
-
} else {
|
|
45
|
-
container.append(...content);
|
|
46
|
-
};
|
|
47
|
-
} else {
|
|
48
|
-
if (appendPosition === "prepend") {
|
|
49
|
-
container.prepend(content);
|
|
50
|
-
} else {
|
|
51
|
-
if (container) container.innerHTML = "";
|
|
52
|
-
container.append(content);
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
// if (appendPosition === "prepend") {
|
|
57
|
-
|
|
58
|
-
// container.prepend(content);
|
|
59
|
-
// } else {
|
|
60
|
-
// if (container) container.innerHTML = "";
|
|
61
|
-
|
|
62
|
-
// console.log("showLog 5 ---------:", container, content);
|
|
63
|
-
|
|
64
|
-
// container.append(content);
|
|
65
|
-
|
|
66
|
-
// // if (content != null && typeof content[Symbol.iterator] === "function") {
|
|
67
|
-
// // container.append(...content);
|
|
68
|
-
// // } else {
|
|
69
|
-
|
|
70
|
-
// // container.append(content);
|
|
71
|
-
// // };
|
|
72
|
-
// };
|
|
73
|
-
|
|
74
|
-
if (showLog) console.log("showLog 5 :", container);
|
|
75
|
-
|
|
76
|
-
return container;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
registerGlobal(render);
|
|
80
|
-
|
|
81
|
-
export default render;
|
package/src/v13/meta.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import meta from "./meta.js";
|
|
2
|
-
|
|
3
|
-
export const registerGlobal = (inFuncDefinition) => {
|
|
4
|
-
if (typeof globalThis === "undefined" || !inFuncDefinition) return;
|
|
5
|
-
|
|
6
|
-
globalThis.ks ??= {};
|
|
7
|
-
|
|
8
|
-
globalThis.ks.jsonRenderers ??= {
|
|
9
|
-
meta,
|
|
10
|
-
renderToDom: inFuncDefinition
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default registerGlobal;
|
|
File without changes
|