json-renderers-build-table 1.22.2 → 1.26.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.
Files changed (195) hide show
  1. package/package.json +2 -2
  2. package/src/index.js +2 -2
  3. package/src/v22/builders/spec.json +2 -0
  4. package/src/v22/builders/withFooter/index.js +2 -0
  5. package/src/v22/index.js +8 -0
  6. package/src/{v21 → v23/builders}/bodyOnly/index.js +1 -1
  7. package/src/v23/builders/footerOnly/base.json +3 -0
  8. package/src/v23/builders/footerOnly/index.js +21 -0
  9. package/src/v23/builders/footerOnly/instructions/single.json +19 -0
  10. package/src/{v21 → v23/builders}/headerOnly/index.js +1 -1
  11. package/src/{v21 → v23/builders}/simple/index.js +2 -2
  12. package/src/{v17/simple → v23/builders}/spec.json +17 -0
  13. package/src/{v20/simple → v23/builders/withFooter}/index.js +7 -5
  14. package/src/v23/builders/withFooter/instructions/single.json +56 -0
  15. package/src/v23/builders/withOptions/index.js +51 -0
  16. package/src/v23/builders/withOptions/instructions/double.json +19 -0
  17. package/src/v23/builders/withOptions/instructions/postSingle.json +22 -0
  18. package/src/v23/builders/withOptions/instructions/single.json +78 -0
  19. package/src/v23/builders/withSerial/index.js +51 -0
  20. package/src/v23/builders/withSerial/instructions/double.json +19 -0
  21. package/src/v23/builders/withSerial/instructions/postSingle.json +22 -0
  22. package/src/v23/builders/withSerial/instructions/single.json +78 -0
  23. package/src/v23/index.js +34 -0
  24. package/src/{v21 → v23}/singleInstruction/index.js +14 -1
  25. package/src/v24/actions/index.js +5 -0
  26. package/src/v24/actions/insertOptions/index.js +47 -0
  27. package/src/v24/actions/insertOptions/instructions/footer.json +22 -0
  28. package/src/v24/actions/insertOptions/instructions/single.json +62 -0
  29. package/src/v24/actions/insertSerial/index.js +47 -0
  30. package/src/v24/actions/insertSerial/instructions/footer.json +22 -0
  31. package/src/v24/actions/insertSerial/instructions/single.json +62 -0
  32. package/src/{v20 → v24/builders}/bodyOnly/index.js +3 -3
  33. package/src/v24/builders/footerOnly/base.json +3 -0
  34. package/src/v24/builders/footerOnly/index.js +21 -0
  35. package/src/v24/builders/footerOnly/instructions/single.json +19 -0
  36. package/src/{v20 → v24/builders}/headerOnly/index.js +3 -3
  37. package/src/v24/builders/simple/index.js +49 -0
  38. package/src/{v18/headerOnly → v24/builders}/spec.json +21 -0
  39. package/src/v24/builders/withFooter/index.js +49 -0
  40. package/src/v24/builders/withFooter/instructions/single.json +56 -0
  41. package/src/{v20 → v24}/doubleInstruction/index.js +5 -3
  42. package/src/v24/guards/index.js +10 -0
  43. package/src/v24/guards/references/func/index.js +8 -0
  44. package/src/v24/guards/references/index.js +9 -0
  45. package/src/v24/guards/references/templateKey/index.js +8 -0
  46. package/src/v24/guards/structure/destinationPath/index.js +8 -0
  47. package/src/v24/guards/structure/func/index.js +8 -0
  48. package/src/v24/guards/structure/index.js +15 -0
  49. package/src/v24/guards/structure/sourcePath/index.js +8 -0
  50. package/src/v24/guards/structure/templateKey/index.js +9 -0
  51. package/src/v24/index.js +71 -0
  52. package/src/v24/singleInstruction/index.js +32 -0
  53. package/src/v25/actions/index.js +20 -0
  54. package/src/v25/actions/insertOptions/index.js +47 -0
  55. package/src/v25/actions/insertOptions/instructions/footer.json +22 -0
  56. package/src/v25/actions/insertOptions/instructions/single.json +62 -0
  57. package/src/v25/actions/insertSerial/index.js +47 -0
  58. package/src/v25/actions/insertSerial/instructions/footer.json +22 -0
  59. package/src/v25/actions/insertSerial/instructions/single.json +62 -0
  60. package/src/v25/builders/bodyOnly/index.js +18 -0
  61. package/src/v25/builders/footerOnly/base.json +3 -0
  62. package/src/v25/builders/footerOnly/index.js +21 -0
  63. package/src/v25/builders/footerOnly/instructions/single.json +19 -0
  64. package/src/v25/builders/headerOnly/index.js +18 -0
  65. package/src/v25/builders/simple/base.json +53 -0
  66. package/src/v25/builders/simple/index.js +40 -0
  67. package/src/{v18/bodyOnly → v25/builders}/spec.json +21 -0
  68. package/src/v25/builders/withFooter/base.json +53 -0
  69. package/src/v25/builders/withFooter/index.js +40 -0
  70. package/src/v25/builders/withFooter/instructions/double.json +19 -0
  71. package/src/v25/builders/withFooter/instructions/single.json +56 -0
  72. package/src/v25/doubleInstruction/index.js +21 -0
  73. package/src/v25/guards/index.js +10 -0
  74. package/src/v25/guards/references/func/index.js +8 -0
  75. package/src/v25/guards/references/index.js +9 -0
  76. package/src/v25/guards/references/templateKey/index.js +8 -0
  77. package/src/v25/guards/structure/destinationPath/index.js +8 -0
  78. package/src/v25/guards/structure/func/index.js +8 -0
  79. package/src/v25/guards/structure/index.js +15 -0
  80. package/src/v25/guards/structure/sourcePath/index.js +8 -0
  81. package/src/v25/guards/structure/templateKey/index.js +9 -0
  82. package/src/v25/index.js +21 -0
  83. package/src/v25/singleInstruction/index.js +32 -0
  84. package/src/v25/writePath/index.js +62 -0
  85. package/src/v26/actions/index.js +20 -0
  86. package/src/v26/actions/insertOptions/index.js +47 -0
  87. package/src/v26/actions/insertOptions/instructions/footer.json +22 -0
  88. package/src/v26/actions/insertOptions/instructions/single.json +62 -0
  89. package/src/v26/actions/insertSerial/index.js +47 -0
  90. package/src/v26/actions/insertSerial/instructions/footer.json +22 -0
  91. package/src/v26/actions/insertSerial/instructions/single.json +62 -0
  92. package/src/v26/builders/bodyOnly/base.json +1 -0
  93. package/src/v26/builders/bodyOnly/index.js +18 -0
  94. package/src/v26/builders/footerOnly/base.json +3 -0
  95. package/src/v26/builders/footerOnly/index.js +21 -0
  96. package/src/v26/builders/footerOnly/instructions/single.json +19 -0
  97. package/src/v26/builders/headerOnly/base.json +53 -0
  98. package/src/v26/builders/headerOnly/index.js +18 -0
  99. package/src/v26/builders/simple/base.json +53 -0
  100. package/src/v26/builders/simple/index.js +40 -0
  101. package/src/v26/builders/simple/instructions/double.json +19 -0
  102. package/src/{v17 → v26/builders}/spec.json +21 -0
  103. package/src/v26/builders/withFooter/base.json +53 -0
  104. package/src/v26/builders/withFooter/index.js +40 -0
  105. package/src/v26/builders/withFooter/instructions/double.json +19 -0
  106. package/src/v26/builders/withFooter/instructions/single.json +56 -0
  107. package/src/v26/doubleInstruction/index.js +21 -0
  108. package/src/v26/guards/index.js +10 -0
  109. package/src/v26/guards/references/func/index.js +8 -0
  110. package/src/v26/guards/references/index.js +9 -0
  111. package/src/v26/guards/references/templateKey/index.js +8 -0
  112. package/src/v26/guards/structure/destinationPath/index.js +8 -0
  113. package/src/v26/guards/structure/func/index.js +8 -0
  114. package/src/v26/guards/structure/index.js +15 -0
  115. package/src/v26/guards/structure/sourcePath/index.js +8 -0
  116. package/src/v26/guards/structure/templateKey/index.js +9 -0
  117. package/src/v26/index.js +21 -0
  118. package/src/v26/singleInstruction/index.js +32 -0
  119. package/src/v26/writePath/index.js +62 -0
  120. package/src/v17/index.js +0 -5
  121. package/src/v17/simple/index.js +0 -56
  122. package/src/v17/simple/writePath/index.js +0 -47
  123. package/src/v18/bodyOnly/base.json +0 -1
  124. package/src/v18/bodyOnly/index.js +0 -36
  125. package/src/v18/bodyOnly/writePath/index.js +0 -47
  126. package/src/v18/headerOnly/index.js +0 -42
  127. package/src/v18/headerOnly/writePath/index.js +0 -47
  128. package/src/v18/index.js +0 -5
  129. package/src/v18/simple/index.js +0 -57
  130. package/src/v18/simple/spec.json +0 -86
  131. package/src/v18/simple/writePath/index.js +0 -47
  132. package/src/v18/spec.json +0 -86
  133. package/src/v19/bodyOnly/index.js +0 -36
  134. package/src/v19/bodyOnly/spec.json +0 -86
  135. package/src/v19/headerOnly/index.js +0 -42
  136. package/src/v19/headerOnly/spec.json +0 -86
  137. package/src/v19/index.js +0 -5
  138. package/src/v19/simple/index.js +0 -57
  139. package/src/v19/simple/spec.json +0 -86
  140. package/src/v19/spec.json +0 -86
  141. package/src/v19/writePath/index.js +0 -47
  142. package/src/v20/bodyOnly/spec.json +0 -86
  143. package/src/v20/headerOnly/spec.json +0 -86
  144. package/src/v20/index.js +0 -5
  145. package/src/v20/simple/spec.json +0 -86
  146. package/src/v20/singleInstruction/index.js +0 -17
  147. package/src/v20/spec.json +0 -86
  148. package/src/v21/bodyOnly/spec.json +0 -86
  149. package/src/v21/headerOnly/spec.json +0 -86
  150. package/src/v21/index.js +0 -5
  151. package/src/v21/simple/instructions/single.json +0 -38
  152. package/src/v21/simple/spec.json +0 -86
  153. package/src/v21/spec.json +0 -86
  154. package/src/v22/spec.json +0 -86
  155. /package/src/{v19 → v23/builders}/bodyOnly/base.json +0 -0
  156. /package/src/{v18 → v23/builders}/bodyOnly/instructions/double.json +0 -0
  157. /package/src/{v17/simple → v23/builders/headerOnly}/base.json +0 -0
  158. /package/src/{v17/simple → v23/builders/headerOnly}/instructions/single.json +0 -0
  159. /package/src/{v18/headerOnly → v23/builders/simple}/base.json +0 -0
  160. /package/src/{v17 → v23/builders}/simple/instructions/double.json +0 -0
  161. /package/src/{v18/headerOnly → v23/builders/simple}/instructions/single.json +0 -0
  162. /package/src/{v18/simple → v23/builders/withFooter}/base.json +0 -0
  163. /package/src/{v18/simple → v23/builders/withFooter}/instructions/double.json +0 -0
  164. /package/src/{v19/headerOnly → v23/builders/withOptions}/base.json +0 -0
  165. /package/src/{v19/simple → v23/builders/withSerial}/base.json +0 -0
  166. /package/src/{v21 → v23}/doubleInstruction/index.js +0 -0
  167. /package/src/{v21 → v23}/guards/index.js +0 -0
  168. /package/src/{v21 → v23}/guards/references/func/index.js +0 -0
  169. /package/src/{v21 → v23}/guards/references/index.js +0 -0
  170. /package/src/{v21 → v23}/guards/references/templateKey/index.js +0 -0
  171. /package/src/{v21 → v23}/guards/structure/destinationPath/index.js +0 -0
  172. /package/src/{v21 → v23}/guards/structure/func/index.js +0 -0
  173. /package/src/{v21 → v23}/guards/structure/index.js +0 -0
  174. /package/src/{v21 → v23}/guards/structure/sourcePath/index.js +0 -0
  175. /package/src/{v21 → v23}/guards/structure/templateKey/index.js +0 -0
  176. /package/src/{v20 → v23}/writePath/index.js +0 -0
  177. /package/src/{v20 → v24/builders}/bodyOnly/base.json +0 -0
  178. /package/src/{v19 → v24/builders}/bodyOnly/instructions/double.json +0 -0
  179. /package/src/{v20 → v24/builders}/headerOnly/base.json +0 -0
  180. /package/src/{v18/simple → v24/builders/headerOnly}/instructions/single.json +0 -0
  181. /package/src/{v20 → v24/builders}/simple/base.json +0 -0
  182. /package/src/{v19 → v24/builders}/simple/instructions/double.json +0 -0
  183. /package/src/{v19/headerOnly → v24/builders/simple}/instructions/single.json +0 -0
  184. /package/src/{v21/headerOnly → v24/builders/withFooter}/base.json +0 -0
  185. /package/src/{v20/simple → v24/builders/withFooter}/instructions/double.json +0 -0
  186. /package/src/{v21 → v24}/writePath/index.js +0 -0
  187. /package/src/{v21 → v25/builders}/bodyOnly/base.json +0 -0
  188. /package/src/{v20 → v25/builders}/bodyOnly/instructions/double.json +0 -0
  189. /package/src/{v21/simple → v25/builders/headerOnly}/base.json +0 -0
  190. /package/src/{v19/simple → v25/builders/headerOnly}/instructions/single.json +0 -0
  191. /package/src/{v21 → v25/builders}/simple/instructions/double.json +0 -0
  192. /package/src/{v20/headerOnly → v25/builders/simple}/instructions/single.json +0 -0
  193. /package/src/{v21 → v26/builders}/bodyOnly/instructions/double.json +0 -0
  194. /package/src/{v20/simple → v26/builders/headerOnly}/instructions/single.json +0 -0
  195. /package/src/{v21/headerOnly → v26/builders/simple}/instructions/single.json +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-renderers-build-table",
3
- "version": "1.22.2",
3
+ "version": "1.26.1",
4
4
  "description": "Focused table specification builder with configurable rows and cells",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -12,7 +12,7 @@
12
12
  "README.md"
13
13
  ],
14
14
  "scripts": {
15
- "test": "node test/v1/index.js && node test/v2/index.js && node test/v3/index.js && node test/v4/index.js && node test/v5/index.js",
15
+ "test": "node test/v24/index.js",
16
16
  "dev": "vite",
17
17
  "build": "vite build"
18
18
  },
package/src/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./v22/index.js";
2
- export { default } from "./v22/index.js";
1
+ export * from "./v26/index.js";
2
+ export { default } from "./v26/index.js";
@@ -28,6 +28,8 @@
28
28
  "type": "text",
29
29
  "placeholder": "enter ${columnName}",
30
30
  "name": "${columnName}",
31
+ "id": "${columnName}",
32
+ "list": "${columnName}",
31
33
  "class": "form-control"
32
34
  }
33
35
  }
@@ -14,8 +14,10 @@ const functions = { fromCollection, twoDimensional };
14
14
 
15
15
  const startFunc = (data, showLog = false, returnLog = []) => {
16
16
  registry.data = data;
17
+
17
18
  runSingleInstructions(singleInstructions, registry, functions, spec, showLog, returnLog);
18
19
  runDoubleInstructions(doubleInstructions, registry, functions, spec, showLog, returnLog);
20
+
19
21
  return base;
20
22
  };
21
23
 
package/src/v22/index.js CHANGED
@@ -5,3 +5,11 @@ import withFooter from "./builders/withFooter/index.js";
5
5
  import footerOnly from "./builders/footerOnly/index.js";
6
6
 
7
7
  export { simple, headerOnly, bodyOnly, withFooter, footerOnly };
8
+
9
+ export default {
10
+ simple,
11
+ headerOnly,
12
+ bodyOnly,
13
+ withFooter,
14
+ footerOnly
15
+ };
@@ -4,7 +4,7 @@ import spec from "../spec.json" with { type: "json" };
4
4
  import base from "./base.json" with { type: "json" };
5
5
  import doubleInstructions from "./instructions/double.json" with { type: "json" };
6
6
 
7
- import runDoubleInstructions from "../doubleInstruction/index.js";
7
+ import runDoubleInstructions from "../../doubleInstruction/index.js";
8
8
 
9
9
  const registry = { data: {}, base, spec };
10
10
  const functions = { twoDimensional };
@@ -0,0 +1,3 @@
1
+ {
2
+ "children": []
3
+ }
@@ -0,0 +1,21 @@
1
+ import fromCollection from "json-transformer-funcs-one-dimension";
2
+ import twoDimensional from "json-transformer-funcs-two-dimensions";
3
+
4
+ import spec from "../spec.json" with { type: "json" };
5
+ import base from "./base.json" with { type: "json" };
6
+ import singleInstructions from "./instructions/single.json" with { type: "json" };
7
+
8
+ import runSingleInstructions from "../../singleInstruction/index.js";
9
+
10
+ const registry = { data: {}, base, spec };
11
+ const functions = { fromCollection, twoDimensional };
12
+
13
+ const startFunc = (data, showLog = false, returnLog = []) => {
14
+ registry.data = data;
15
+
16
+ runSingleInstructions(singleInstructions, registry, functions, spec, showLog, returnLog);
17
+
18
+ return base?.children;
19
+ };
20
+
21
+ export default startFunc;
@@ -0,0 +1,19 @@
1
+ [
2
+ {
3
+ "narration": "Build the footer row for the table using the configured columns.",
4
+ "destinationPath": {
5
+ "fileName": "base",
6
+ "filePath": [
7
+ "children"
8
+ ]
9
+ },
10
+ "sourcePath": {
11
+ "fileName": "data",
12
+ "filePath": [
13
+ "columns"
14
+ ]
15
+ },
16
+ "templateKey": "buildFooter",
17
+ "func": "fromCollection"
18
+ }
19
+ ]
@@ -4,7 +4,7 @@ import spec from "../spec.json" with { type: "json" };
4
4
  import base from "./base.json" with { type: "json" };
5
5
  import singleInstructions from "./instructions/single.json" with { type: "json" };
6
6
 
7
- import runSingleInstructions from "../singleInstruction/index.js";
7
+ import runSingleInstructions from "../../singleInstruction/index.js";
8
8
 
9
9
  const registry = { data: {}, base, spec };
10
10
  const functions = { fromCollection };
@@ -6,8 +6,8 @@ import base from "./base.json" with { type: "json" };
6
6
  import singleInstructions from "./instructions/single.json" with { type: "json" };
7
7
  import doubleInstructions from "./instructions/double.json" with { type: "json" };
8
8
 
9
- import runSingleInstructions from "../singleInstruction/index.js";
10
- import runDoubleInstructions from "../doubleInstruction/index.js";
9
+ import runSingleInstructions from "../../singleInstruction/index.js";
10
+ import runDoubleInstructions from "../../doubleInstruction/index.js";
11
11
 
12
12
  const registry = { data: {}, base, spec };
13
13
  const functions = { fromCollection, twoDimensional };
@@ -28,6 +28,8 @@
28
28
  "type": "text",
29
29
  "placeholder": "enter ${columnName}",
30
30
  "name": "${columnName}",
31
+ "id": "${columnName}",
32
+ "list": "${columnName}",
31
33
  "class": "form-control"
32
34
  }
33
35
  }
@@ -62,6 +64,21 @@
62
64
  }
63
65
  ]
64
66
  },
67
+ "optionsButtonCell": {
68
+ "tagName": "td",
69
+ "attributes": {
70
+ "class": "py-2 px-3 text-center"
71
+ },
72
+ "children": [
73
+ {
74
+ "tagName": "button",
75
+ "textContent": "${columnName}",
76
+ "attributes": {
77
+ "class": "btn btn-primary btn-sm"
78
+ }
79
+ }
80
+ ]
81
+ },
65
82
  "buildOption": {
66
83
  "tagName": "option",
67
84
  "textContent": "${rowValue}",
@@ -6,16 +6,18 @@ import base from "./base.json" with { type: "json" };
6
6
  import singleInstructions from "./instructions/single.json" with { type: "json" };
7
7
  import doubleInstructions from "./instructions/double.json" with { type: "json" };
8
8
 
9
- import runSingleInstructions from "../singleInstruction/index.js";
10
- import runDoubleInstructions from "../doubleInstruction/index.js";
9
+ import runSingleInstructions from "../../singleInstruction/index.js";
10
+ import runDoubleInstructions from "../../doubleInstruction/index.js";
11
11
 
12
12
  const registry = { data: {}, base, spec };
13
13
  const functions = { fromCollection, twoDimensional };
14
14
 
15
- const startFunc = data => {
15
+ const startFunc = (data, showLog = false, returnLog = []) => {
16
16
  registry.data = data;
17
- runSingleInstructions(singleInstructions, registry, functions, spec);
18
- runDoubleInstructions(doubleInstructions, registry, functions, spec);
17
+
18
+ runSingleInstructions(singleInstructions, registry, functions, spec, showLog, returnLog);
19
+ runDoubleInstructions(doubleInstructions, registry, functions, spec, showLog, returnLog);
20
+
19
21
  return base;
20
22
  };
21
23
 
@@ -0,0 +1,56 @@
1
+ [
2
+ {
3
+ "narration": "Build the column widths for the table using the configured columns.",
4
+ "destinationPath": {
5
+ "fileName": "base",
6
+ "dataRole": "table-colgroup",
7
+ "filePath": [
8
+ "children"
9
+ ]
10
+ },
11
+ "sourcePath": {
12
+ "fileName": "data",
13
+ "filePath": [
14
+ "columns"
15
+ ]
16
+ },
17
+ "templateKey": "buildColGroup",
18
+ "func": "fromCollection"
19
+ },
20
+ {
21
+ "narration": "Build the header row for the table using the configured columns.",
22
+ "destinationPath": {
23
+ "fileName": "base",
24
+ "dataRole": "table-header-row",
25
+ "filePath": [
26
+ "children"
27
+ ]
28
+ },
29
+ "sourcePath": {
30
+ "fileName": "data",
31
+ "filePath": [
32
+ "columns"
33
+ ]
34
+ },
35
+ "templateKey": "buildHeader",
36
+ "func": "fromCollection"
37
+ },
38
+ {
39
+ "narration": "Build the footer row for the table using the configured columns.",
40
+ "destinationPath": {
41
+ "fileName": "base",
42
+ "dataRole": "table-footer-row",
43
+ "filePath": [
44
+ "children"
45
+ ]
46
+ },
47
+ "sourcePath": {
48
+ "fileName": "data",
49
+ "filePath": [
50
+ "columns"
51
+ ]
52
+ },
53
+ "templateKey": "buildFooter",
54
+ "func": "fromCollection"
55
+ }
56
+ ]
@@ -0,0 +1,51 @@
1
+ import applyTemplate from "json-transformer-funcs-primitive";
2
+ import fromCollection from "json-transformer-funcs-one-dimension";
3
+ import twoDimensional from "json-transformer-funcs-two-dimensions";
4
+
5
+ import spec from "../spec.json" with { type: "json" };
6
+ import base from "./base.json" with { type: "json" };
7
+ import singleInstructions from "./instructions/single.json" with { type: "json" };
8
+ import doubleInstructions from "./instructions/double.json" with { type: "json" };
9
+ import postSingleInstructions from "./instructions/postSingle.json" with { type: "json" };
10
+
11
+ import runSingleInstructions from "../../singleInstruction/index.js";
12
+ import runDoubleInstructions from "../../doubleInstruction/index.js";
13
+
14
+ const functions = { fromCollection, twoDimensional, applyTemplate };
15
+
16
+ const startFunc = (data = {}, showLog = false, returnLog = []) => {
17
+ const localInput = (data && typeof data === "object" && "inConfig" in data)
18
+ ? data.inConfig
19
+ : data;
20
+
21
+ const columns = localInput.inColumns || localInput.columns || [];
22
+ const tableData = localInput.inData || localInput.data || [];
23
+ const optionsInput = localInput.inOptions || localInput.options || {};
24
+
25
+ const localOptions = {
26
+ col: { width: "100px" },
27
+ header: { columnName: "options" },
28
+ body: { columnName: "show" },
29
+ ...optionsInput
30
+ };
31
+
32
+ const localBase = structuredClone(base);
33
+
34
+ const registry = {
35
+ data: {
36
+ columns,
37
+ data: tableData,
38
+ options: localOptions
39
+ },
40
+ base: localBase,
41
+ spec
42
+ };
43
+
44
+ runSingleInstructions(singleInstructions, registry, functions, spec, showLog, returnLog);
45
+ runDoubleInstructions(doubleInstructions, registry, functions, spec, showLog, returnLog);
46
+ runSingleInstructions(postSingleInstructions, registry, functions, spec, showLog, returnLog);
47
+
48
+ return localBase;
49
+ };
50
+
51
+ export default startFunc;
@@ -0,0 +1,19 @@
1
+ [
2
+ {
3
+ "narration": "Build the table body rows for the table using the configured columns and data.",
4
+ "destinationPath": {
5
+ "fileName": "base",
6
+ "dataRole": "table-body",
7
+ "filePath": [
8
+ "children"
9
+ ]
10
+ },
11
+ "sourcePath": {
12
+ "fileName": "data",
13
+ "filePath": [
14
+ "columns"
15
+ ]
16
+ },
17
+ "func": "twoDimensional"
18
+ }
19
+ ]
@@ -0,0 +1,22 @@
1
+ [
2
+ {
3
+ "narration": "Append the options button cell into each table body row.",
4
+ "destinationPath": {
5
+ "fileName": "base",
6
+ "dataRole": "table-body",
7
+ "filePath": [
8
+ "children"
9
+ ],
10
+ "action": "pushToRows"
11
+ },
12
+ "sourcePath": {
13
+ "fileName": "data",
14
+ "filePath": [
15
+ "options",
16
+ "body"
17
+ ]
18
+ },
19
+ "templateKey": "optionsButtonCell",
20
+ "func": "applyTemplate"
21
+ }
22
+ ]
@@ -0,0 +1,78 @@
1
+ [
2
+ {
3
+ "narration": "Build the column widths for the table using the configured columns.",
4
+ "destinationPath": {
5
+ "fileName": "base",
6
+ "dataRole": "table-colgroup",
7
+ "filePath": [
8
+ "children"
9
+ ]
10
+ },
11
+ "sourcePath": {
12
+ "fileName": "data",
13
+ "filePath": [
14
+ "columns"
15
+ ]
16
+ },
17
+ "templateKey": "buildColGroup",
18
+ "func": "fromCollection"
19
+ },
20
+ {
21
+ "narration": "Build the header row for the table using the configured columns.",
22
+ "destinationPath": {
23
+ "fileName": "base",
24
+ "dataRole": "table-header-row",
25
+ "filePath": [
26
+ "children"
27
+ ]
28
+ },
29
+ "sourcePath": {
30
+ "fileName": "data",
31
+ "filePath": [
32
+ "columns"
33
+ ]
34
+ },
35
+ "templateKey": "buildHeader",
36
+ "func": "fromCollection"
37
+ },
38
+ {
39
+ "narration": "Append the options column width to the table colgroup.",
40
+ "destinationPath": {
41
+ "fileName": "base",
42
+ "dataRole": "table-colgroup",
43
+ "filePath": [
44
+ "children"
45
+ ],
46
+ "action": "push"
47
+ },
48
+ "sourcePath": {
49
+ "fileName": "data",
50
+ "filePath": [
51
+ "options",
52
+ "col"
53
+ ]
54
+ },
55
+ "templateKey": "buildColGroup",
56
+ "func": "applyTemplate"
57
+ },
58
+ {
59
+ "narration": "Append the options header cell to the table header row.",
60
+ "destinationPath": {
61
+ "fileName": "base",
62
+ "dataRole": "table-header-row",
63
+ "filePath": [
64
+ "children"
65
+ ],
66
+ "action": "push"
67
+ },
68
+ "sourcePath": {
69
+ "fileName": "data",
70
+ "filePath": [
71
+ "options",
72
+ "header"
73
+ ]
74
+ },
75
+ "templateKey": "buildHeader",
76
+ "func": "applyTemplate"
77
+ }
78
+ ]
@@ -0,0 +1,51 @@
1
+ import applyTemplate from "json-transformer-funcs-primitive";
2
+ import fromCollection from "json-transformer-funcs-one-dimension";
3
+ import twoDimensional from "json-transformer-funcs-two-dimensions";
4
+
5
+ import spec from "../spec.json" with { type: "json" };
6
+ import base from "./base.json" with { type: "json" };
7
+ import singleInstructions from "./instructions/single.json" with { type: "json" };
8
+ import doubleInstructions from "./instructions/double.json" with { type: "json" };
9
+ import postSingleInstructions from "./instructions/postSingle.json" with { type: "json" };
10
+
11
+ import runSingleInstructions from "../../singleInstruction/index.js";
12
+ import runDoubleInstructions from "../../doubleInstruction/index.js";
13
+
14
+ const functions = { fromCollection, twoDimensional, applyTemplate };
15
+
16
+ const startFunc = (data = {}, showLog = false, returnLog = []) => {
17
+ const localInput = (data && typeof data === "object" && "inConfig" in data)
18
+ ? data.inConfig
19
+ : data;
20
+
21
+ const columns = localInput.inColumns || localInput.columns || [];
22
+ const tableData = localInput.inData || localInput.data || [];
23
+ const serialInput = localInput.inSerial || localInput.serial || {};
24
+
25
+ const localSerial = {
26
+ col: { width: "50px" },
27
+ header: { columnName: "#" },
28
+ body: {},
29
+ ...serialInput
30
+ };
31
+
32
+ const localBase = structuredClone(base);
33
+
34
+ const registry = {
35
+ data: {
36
+ columns,
37
+ data: tableData,
38
+ serial: localSerial
39
+ },
40
+ base: localBase,
41
+ spec
42
+ };
43
+
44
+ runSingleInstructions(singleInstructions, registry, functions, spec, showLog, returnLog);
45
+ runDoubleInstructions(doubleInstructions, registry, functions, spec, showLog, returnLog);
46
+ runSingleInstructions(postSingleInstructions, registry, functions, spec, showLog, returnLog);
47
+
48
+ return localBase;
49
+ };
50
+
51
+ export default startFunc;
@@ -0,0 +1,19 @@
1
+ [
2
+ {
3
+ "narration": "Build the table body rows for the table using the configured columns and data.",
4
+ "destinationPath": {
5
+ "fileName": "base",
6
+ "dataRole": "table-body",
7
+ "filePath": [
8
+ "children"
9
+ ]
10
+ },
11
+ "sourcePath": {
12
+ "fileName": "data",
13
+ "filePath": [
14
+ "columns"
15
+ ]
16
+ },
17
+ "func": "twoDimensional"
18
+ }
19
+ ]
@@ -0,0 +1,22 @@
1
+ [
2
+ {
3
+ "narration": "Prepend the serial number cell into each table body row.",
4
+ "destinationPath": {
5
+ "fileName": "base",
6
+ "dataRole": "table-body",
7
+ "filePath": [
8
+ "children"
9
+ ],
10
+ "action": "unshiftSerialToRows"
11
+ },
12
+ "sourcePath": {
13
+ "fileName": "data",
14
+ "filePath": [
15
+ "serial",
16
+ "body"
17
+ ]
18
+ },
19
+ "templateKey": "buildBodyCell",
20
+ "func": "applyTemplate"
21
+ }
22
+ ]
@@ -0,0 +1,78 @@
1
+ [
2
+ {
3
+ "narration": "Build the column widths for the table using the configured columns.",
4
+ "destinationPath": {
5
+ "fileName": "base",
6
+ "dataRole": "table-colgroup",
7
+ "filePath": [
8
+ "children"
9
+ ]
10
+ },
11
+ "sourcePath": {
12
+ "fileName": "data",
13
+ "filePath": [
14
+ "columns"
15
+ ]
16
+ },
17
+ "templateKey": "buildColGroup",
18
+ "func": "fromCollection"
19
+ },
20
+ {
21
+ "narration": "Build the header row for the table using the configured columns.",
22
+ "destinationPath": {
23
+ "fileName": "base",
24
+ "dataRole": "table-header-row",
25
+ "filePath": [
26
+ "children"
27
+ ]
28
+ },
29
+ "sourcePath": {
30
+ "fileName": "data",
31
+ "filePath": [
32
+ "columns"
33
+ ]
34
+ },
35
+ "templateKey": "buildHeader",
36
+ "func": "fromCollection"
37
+ },
38
+ {
39
+ "narration": "Prepend the serial column width to the table colgroup.",
40
+ "destinationPath": {
41
+ "fileName": "base",
42
+ "dataRole": "table-colgroup",
43
+ "filePath": [
44
+ "children"
45
+ ],
46
+ "action": "unshift"
47
+ },
48
+ "sourcePath": {
49
+ "fileName": "data",
50
+ "filePath": [
51
+ "serial",
52
+ "col"
53
+ ]
54
+ },
55
+ "templateKey": "buildColGroup",
56
+ "func": "applyTemplate"
57
+ },
58
+ {
59
+ "narration": "Prepend the serial header cell to the table header row.",
60
+ "destinationPath": {
61
+ "fileName": "base",
62
+ "dataRole": "table-header-row",
63
+ "filePath": [
64
+ "children"
65
+ ],
66
+ "action": "unshift"
67
+ },
68
+ "sourcePath": {
69
+ "fileName": "data",
70
+ "filePath": [
71
+ "serial",
72
+ "header"
73
+ ]
74
+ },
75
+ "templateKey": "buildHeader",
76
+ "func": "applyTemplate"
77
+ }
78
+ ]
@@ -0,0 +1,34 @@
1
+ import simple from "./builders/simple/index.js";
2
+ import headerOnly from "./builders/headerOnly/index.js";
3
+ import bodyOnly from "./builders/bodyOnly/index.js";
4
+ import withFooter from "./builders/withFooter/index.js";
5
+ import footerOnly from "./builders/footerOnly/index.js";
6
+ import withSerial from "./builders/withSerial/index.js";
7
+ import withOptions from "./builders/withOptions/index.js";
8
+
9
+ const tableWithSerial = withSerial;
10
+ const tableWithOptions = withOptions;
11
+
12
+ export {
13
+ simple,
14
+ headerOnly,
15
+ bodyOnly,
16
+ withFooter,
17
+ footerOnly,
18
+ withSerial,
19
+ withOptions,
20
+ tableWithSerial,
21
+ tableWithOptions
22
+ };
23
+
24
+ export default {
25
+ simple,
26
+ headerOnly,
27
+ bodyOnly,
28
+ withFooter,
29
+ footerOnly,
30
+ withSerial,
31
+ withOptions,
32
+ tableWithSerial,
33
+ tableWithOptions
34
+ };
@@ -4,8 +4,21 @@ import checkInstruction from "../guards/index.js";
4
4
 
5
5
  const runSingleInstruction = (instruction, registry, functions, spec, showLog, returnLog) => {
6
6
  if (!checkInstruction(instruction, functions, spec, showLog, returnLog)) return;
7
+
8
+ const localSpec = spec;
9
+ const templateKey = instruction.templateKey;
10
+ const localSpecKey = localSpec[templateKey];
11
+
12
+ console.log("templateKey ; ", templateKey);
13
+ console.log("localSpecKey ; ", localSpecKey);
14
+
7
15
  const source = resolvePath(registry, instruction.sourcePath);
8
- const result = functions[instruction.func](source, spec[instruction.templateKey]);
16
+ const result = functions[instruction.func](source, localSpecKey);
17
+
18
+ if (templateKey === "buildFooter") {
19
+ console.log("result ; ", result);
20
+ };
21
+
9
22
  writePath(registry, instruction.destinationPath, result);
10
23
  };
11
24
 
@@ -0,0 +1,5 @@
1
+ import insertSerial from "./insertSerial/index.js";
2
+ import insertOptions from "./insertOptions/index.js";
3
+
4
+ export { insertSerial, insertOptions };
5
+ export default { insertSerial, insertOptions };