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.
Files changed (43) hide show
  1. package/README.md +6 -1
  2. package/docs/dist/min.js +899 -832
  3. package/docs/dist/v16/min.js +1576 -0
  4. package/docs/dist/v17/min.js +1577 -0
  5. package/package.json +2 -2
  6. package/src/index.js +2 -2
  7. package/src/v16/buildSpec/index.js +40 -40
  8. package/src/v16/common/deriveColumnsFromData.js +20 -20
  9. package/src/v16/guard.js +38 -38
  10. package/src/v16/index.js +106 -110
  11. package/src/v16/meta.js +6 -6
  12. package/src/v16/registerGlobal.js +27 -27
  13. package/src/v17/buildSpec/index.js +25 -0
  14. package/src/v17/getSpec.js +12 -0
  15. package/src/v17/guard.js +41 -0
  16. package/src/v17/index.js +29 -0
  17. package/src/{v11 → v17}/meta.js +1 -1
  18. package/src/v17/registerGlobal.js +28 -0
  19. package/src/v17/renderToDom/index.js +47 -0
  20. package/src/v17/spec.json +9 -0
  21. package/src/v17/validateConfig.js +37 -0
  22. package/src/v11/dataLists/fragments.json +0 -1
  23. package/src/v11/dataLists/index.js +0 -32
  24. package/src/v11/dataLists/skeleton.json +0 -38
  25. package/src/v11/index.js +0 -62
  26. package/src/v11/registerGlobal.js +0 -14
  27. package/src/v11/select/fragments.json +0 -1
  28. package/src/v11/select/index.js +0 -34
  29. package/src/v11/select/skeleton.json +0 -23
  30. package/src/v11/table/index.js +0 -35
  31. package/src/v11/table/skeleton.json +0 -47
  32. package/src/v12/common/deriveColumnsFromData.js +0 -20
  33. package/src/v12/index.js +0 -62
  34. package/src/v12/meta.js +0 -6
  35. package/src/v12/registerGlobal.js +0 -14
  36. package/src/v12/table/index.js +0 -35
  37. package/src/v12/table/skeleton.json +0 -47
  38. package/src/v13/buildSpec/index.js +0 -39
  39. package/src/v13/common/deriveColumnsFromData.js +0 -20
  40. package/src/v13/index.js +0 -81
  41. package/src/v13/meta.js +0 -6
  42. package/src/v13/registerGlobal.js +0 -14
  43. /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,6 +0,0 @@
1
- export const meta = {
2
- version: "v13.1.0",
3
- description: "build table from store data and render to DOM uses json-to-spec, json-to-dom under the hood"
4
- };
5
-
6
- export default meta;
@@ -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;