json-renderers-build-table 1.9.1 → 1.19.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 (158) hide show
  1. package/README.md +197 -14
  2. package/package.json +5 -2
  3. package/src/index.js +2 -3
  4. package/src/v17/index.js +5 -0
  5. package/src/v17/simple/base.json +53 -0
  6. package/src/v17/simple/index.js +56 -0
  7. package/src/v17/simple/instructions/double.json +19 -0
  8. package/src/v17/simple/instructions/single.json +38 -0
  9. package/src/v17/simple/spec.json +86 -0
  10. package/src/v17/simple/writePath/index.js +47 -0
  11. package/src/v17/spec.json +86 -0
  12. package/src/v18/bodyOnly/base.json +1 -0
  13. package/src/v18/bodyOnly/index.js +36 -0
  14. package/src/v18/bodyOnly/instructions/double.json +18 -0
  15. package/src/v18/bodyOnly/spec.json +86 -0
  16. package/src/v18/bodyOnly/writePath/index.js +47 -0
  17. package/src/v18/headerOnly/base.json +53 -0
  18. package/src/v18/headerOnly/index.js +42 -0
  19. package/src/v18/headerOnly/instructions/single.json +38 -0
  20. package/src/v18/headerOnly/spec.json +86 -0
  21. package/src/v18/headerOnly/writePath/index.js +47 -0
  22. package/src/v18/index.js +5 -0
  23. package/src/v18/simple/base.json +53 -0
  24. package/src/v18/simple/index.js +57 -0
  25. package/src/v18/simple/instructions/double.json +19 -0
  26. package/src/v18/simple/instructions/single.json +38 -0
  27. package/src/v18/simple/spec.json +86 -0
  28. package/src/v18/simple/writePath/index.js +47 -0
  29. package/src/v18/spec.json +86 -0
  30. package/src/v19/bodyOnly/base.json +1 -0
  31. package/src/v19/bodyOnly/index.js +36 -0
  32. package/src/v19/bodyOnly/instructions/double.json +18 -0
  33. package/src/v19/bodyOnly/spec.json +86 -0
  34. package/src/v19/headerOnly/base.json +53 -0
  35. package/src/v19/headerOnly/index.js +42 -0
  36. package/src/v19/headerOnly/instructions/single.json +38 -0
  37. package/src/v19/headerOnly/spec.json +86 -0
  38. package/src/v19/index.js +5 -0
  39. package/src/v19/simple/base.json +53 -0
  40. package/src/v19/simple/index.js +57 -0
  41. package/src/v19/simple/instructions/double.json +19 -0
  42. package/src/v19/simple/instructions/single.json +38 -0
  43. package/src/v19/simple/spec.json +86 -0
  44. package/src/v19/spec.json +86 -0
  45. package/src/v19/writePath/index.js +47 -0
  46. package/src/v5/index.js +0 -49
  47. package/src/v5/options/index.js +0 -18
  48. package/src/v5/options/showOptions/index.js +0 -39
  49. package/src/v5/options/showSerial/index.js +0 -19
  50. package/src/v5/render-requests.json +0 -70
  51. package/src/v5/table/body/cell/index.js +0 -12
  52. package/src/v5/table/body/cell/tag.json +0 -7
  53. package/src/v5/table/body/index.js +0 -17
  54. package/src/v5/table/body/row/index.js +0 -18
  55. package/src/v5/table/body/row/tag.json +0 -4
  56. package/src/v5/table/body/tag.json +0 -4
  57. package/src/v5/table/head/cell/index.js +0 -12
  58. package/src/v5/table/head/cell/tag.json +0 -7
  59. package/src/v5/table/head/index.js +0 -16
  60. package/src/v5/table/head/row/index.js +0 -14
  61. package/src/v5/table/head/row/tag.json +0 -4
  62. package/src/v5/table/head/tag.json +0 -4
  63. package/src/v5/table/index.js +0 -22
  64. package/src/v5/table/tag.json +0 -7
  65. package/src/v6/index.js +0 -29
  66. package/src/v6/options/index.js +0 -28
  67. package/src/v6/options/showFooter/cell/index.js +0 -16
  68. package/src/v6/options/showFooter/cell/tag.json +0 -4
  69. package/src/v6/options/showFooter/footer/index.js +0 -18
  70. package/src/v6/options/showFooter/footer/tag.json +0 -4
  71. package/src/v6/options/showFooter/index.js +0 -10
  72. package/src/v6/options/showFooter/input/index.js +0 -11
  73. package/src/v6/options/showFooter/input/tag.json +0 -7
  74. package/src/v6/options/showFooter/row/index.js +0 -35
  75. package/src/v6/options/showFooter/row/tag.json +0 -4
  76. package/src/v6/options/showFooterSave/button/tag.json +0 -7
  77. package/src/v6/options/showFooterSave/index.js +0 -14
  78. package/src/v6/options/showOptions/index.js +0 -39
  79. package/src/v6/options/showSerial/index.js +0 -19
  80. package/src/v6/render-requests.json +0 -90
  81. package/src/v6/table/body/cell/index.js +0 -12
  82. package/src/v6/table/body/cell/tag.json +0 -7
  83. package/src/v6/table/body/index.js +0 -17
  84. package/src/v6/table/body/row/index.js +0 -18
  85. package/src/v6/table/body/row/tag.json +0 -4
  86. package/src/v6/table/body/tag.json +0 -4
  87. package/src/v6/table/head/cell/index.js +0 -12
  88. package/src/v6/table/head/cell/tag.json +0 -7
  89. package/src/v6/table/head/index.js +0 -16
  90. package/src/v6/table/head/row/index.js +0 -14
  91. package/src/v6/table/head/row/tag.json +0 -4
  92. package/src/v6/table/head/tag.json +0 -4
  93. package/src/v6/table/index.js +0 -22
  94. package/src/v6/table/tag.json +0 -7
  95. package/src/v7/index.js +0 -29
  96. package/src/v7/options/index.js +0 -28
  97. package/src/v7/options/showFooter/cell/index.js +0 -16
  98. package/src/v7/options/showFooter/cell/tag.json +0 -4
  99. package/src/v7/options/showFooter/footer/index.js +0 -18
  100. package/src/v7/options/showFooter/footer/tag.json +0 -4
  101. package/src/v7/options/showFooter/index.js +0 -10
  102. package/src/v7/options/showFooter/input/index.js +0 -11
  103. package/src/v7/options/showFooter/input/tag.json +0 -7
  104. package/src/v7/options/showFooter/row/index.js +0 -35
  105. package/src/v7/options/showFooter/row/tag.json +0 -4
  106. package/src/v7/options/showFooterSave/button/tag.json +0 -7
  107. package/src/v7/options/showFooterSave/index.js +0 -14
  108. package/src/v7/options/showOptions/index.js +0 -39
  109. package/src/v7/options/showSerial/index.js +0 -19
  110. package/src/v7/render-requests.json +0 -90
  111. package/src/v7/table/body/cell/index.js +0 -12
  112. package/src/v7/table/body/cell/tag.json +0 -7
  113. package/src/v7/table/body/index.js +0 -17
  114. package/src/v7/table/body/row/index.js +0 -18
  115. package/src/v7/table/body/row/tag.json +0 -4
  116. package/src/v7/table/body/tag.json +0 -4
  117. package/src/v7/table/head/cell/index.js +0 -12
  118. package/src/v7/table/head/cell/tag.json +0 -7
  119. package/src/v7/table/head/index.js +0 -16
  120. package/src/v7/table/head/row/index.js +0 -14
  121. package/src/v7/table/head/row/tag.json +0 -4
  122. package/src/v7/table/head/tag.json +0 -4
  123. package/src/v7/table/index.js +0 -22
  124. package/src/v7/table/tag.json +0 -7
  125. package/src/v8/index.js +0 -29
  126. package/src/v8/options/index.js +0 -28
  127. package/src/v8/options/showFooter/cell/index.js +0 -16
  128. package/src/v8/options/showFooter/cell/tag.json +0 -4
  129. package/src/v8/options/showFooter/footer/index.js +0 -18
  130. package/src/v8/options/showFooter/footer/tag.json +0 -4
  131. package/src/v8/options/showFooter/index.js +0 -10
  132. package/src/v8/options/showFooter/input/index.js +0 -11
  133. package/src/v8/options/showFooter/input/tag.json +0 -7
  134. package/src/v8/options/showFooter/row/index.js +0 -35
  135. package/src/v8/options/showFooter/row/tag.json +0 -4
  136. package/src/v8/options/showFooterSave/button/tag.json +0 -7
  137. package/src/v8/options/showFooterSave/index.js +0 -14
  138. package/src/v8/options/showOptions/index.js +0 -39
  139. package/src/v8/options/showSerial/index.js +0 -19
  140. package/src/v8/render-requests.json +0 -90
  141. package/src/v8/table/body/cell/index.js +0 -12
  142. package/src/v8/table/body/cell/tag.json +0 -7
  143. package/src/v8/table/body/index.js +0 -17
  144. package/src/v8/table/body/row/index.js +0 -18
  145. package/src/v8/table/body/row/tag.json +0 -4
  146. package/src/v8/table/body/tag.json +0 -4
  147. package/src/v8/table/head/cell/index.js +0 -12
  148. package/src/v8/table/head/cell/tag.json +0 -7
  149. package/src/v8/table/head/index.js +0 -16
  150. package/src/v8/table/head/row/index.js +0 -14
  151. package/src/v8/table/head/row/tag.json +0 -4
  152. package/src/v8/table/head/tag.json +0 -4
  153. package/src/v8/table/index.js +0 -22
  154. package/src/v8/table/tag.json +0 -7
  155. package/src/v9/index.js +0 -28
  156. package/src/v9/table/index.js +0 -67
  157. package/src/v9/table/spec.json +0 -18
  158. package/src/v9/table/table.json +0 -24
@@ -1,90 +0,0 @@
1
- {
2
- "table": {
3
- "type": "table",
4
- "data": [
5
- { "itemName": "0.09/30mm", "baseUnit": "kgs" }
6
- ],
7
- "columns": ["itemName", "baseUnit"],
8
- "options": {}
9
- },
10
- "tableWithSerial": {
11
- "type": "table",
12
- "data": [
13
- { "itemName": "0.09/30mm", "baseUnit": "kgs" }
14
- ],
15
- "columns": ["itemName", "baseUnit"],
16
- "options": {
17
- "showSerial": true
18
- }
19
- },
20
- "tableWithDefaultAction": {
21
- "type": "table",
22
- "data": [
23
- { "itemName": "0.09/30mm", "baseUnit": "kgs" }
24
- ],
25
- "columns": ["itemName", "baseUnit"],
26
- "options": {
27
- "showOptions": true
28
- }
29
- },
30
- "tableWithCustomActions": {
31
- "type": "table",
32
- "data": [
33
- { "itemName": "0.09/30mm", "baseUnit": "kgs" }
34
- ],
35
- "columns": ["itemName", "baseUnit"],
36
- "options": {
37
- "showOptions": [
38
- { "label": "Show", "type": "button" },
39
- { "label": "Edit", "type": "button" }
40
- ]
41
- }
42
- },
43
- "tableWithSerialAndActions": {
44
- "type": "table",
45
- "data": [
46
- { "itemName": "0.09/30mm", "baseUnit": "kgs" }
47
- ],
48
- "columns": ["itemName", "baseUnit"],
49
- "options": {
50
- "showSerial": true,
51
- "showOptions": [
52
- { "label": "Show", "type": "button" }
53
- ]
54
- }
55
- },
56
- "tableWithFooter": {
57
- "type": "table",
58
- "data": [
59
- { "itemName": "0.09/30mm", "baseUnit": "kgs" }
60
- ],
61
- "columns": ["itemName", "baseUnit"],
62
- "options": {
63
- "showFooter": true
64
- }
65
- },
66
- "tableWithFooterSave": {
67
- "type": "table",
68
- "data": [
69
- { "itemName": "0.09/30mm", "baseUnit": "kgs" }
70
- ],
71
- "columns": ["itemName", "baseUnit"],
72
- "options": {
73
- "showFooterSave": true
74
- }
75
- },
76
- "tableHead": {
77
- "type": "tableHead",
78
- "data": [],
79
- "columns": ["itemName", "baseUnit"],
80
- "options": {}
81
- },
82
- "tableBody": {
83
- "type": "tableBody",
84
- "data": [
85
- { "itemName": "0.09/30mm", "baseUnit": "kgs" }
86
- ],
87
- "columns": ["itemName", "baseUnit"],
88
- "options": {}
89
- }
90
- }
@@ -1,12 +0,0 @@
1
- import tagJson from "./tag.json" with { type: "json" };
2
-
3
- const buildBodyCell = ({ inValue } = {}) => {
4
- const td = structuredClone(tagJson);
5
-
6
- td.attributes.value = inValue;
7
- td.textContent = inValue;
8
-
9
- return td;
10
- };
11
-
12
- export default buildBodyCell;
@@ -1,7 +0,0 @@
1
- {
2
- "tagName": "td",
3
- "attributes": {
4
- "value": ""
5
- },
6
- "textContent": ""
7
- }
@@ -1,17 +0,0 @@
1
- import tagJson from "./tag.json" with { type: "json" };
2
- import buildBodyRow from "./row/index.js";
3
-
4
- const renderTableBody = ({ inData = [], inColumns = [] } = {}) => {
5
- const tbody = structuredClone(tagJson);
6
-
7
- const children = inData.map(row => buildBodyRow({
8
- inRow: row,
9
- inColumns
10
- }));
11
-
12
- tbody.children = children;
13
-
14
- return tbody;
15
- };
16
-
17
- export default renderTableBody;
@@ -1,18 +0,0 @@
1
- import tagJson from "./tag.json" with { type: "json" };
2
- import buildBodyCell from "../cell/index.js";
3
-
4
- const buildBodyRow = ({ inRow, inColumns = [] } = {}) => {
5
- const tr = structuredClone(tagJson);
6
-
7
- const children = inColumns.map(column => {
8
- const value = Array.isArray(inRow) ? inRow[column] : inRow?.[column];
9
-
10
- return buildBodyCell({ inValue: value });
11
- });
12
-
13
- tr.children = children;
14
-
15
- return tr;
16
- };
17
-
18
- export default buildBodyRow;
@@ -1,4 +0,0 @@
1
- {
2
- "tagName": "tr",
3
- "children": []
4
- }
@@ -1,4 +0,0 @@
1
- {
2
- "tagName": "tbody",
3
- "children": []
4
- }
@@ -1,12 +0,0 @@
1
- import tagJson from "./tag.json" with { type: "json" };
2
-
3
- const buildHeadCell = ({ inColumn } = {}) => {
4
- const th = structuredClone(tagJson);
5
-
6
- th.attributes.value = inColumn;
7
- th.textContent = inColumn;
8
-
9
- return th;
10
- };
11
-
12
- export default buildHeadCell;
@@ -1,7 +0,0 @@
1
- {
2
- "tagName": "th",
3
- "attributes": {
4
- "value": ""
5
- },
6
- "textContent": ""
7
- }
@@ -1,16 +0,0 @@
1
- import tagJson from "./tag.json" with { type: "json" };
2
- import buildHeadRow from "./row/index.js";
3
-
4
- const renderTableHead = ({ inColumns = [] } = {}) => {
5
- const thead = structuredClone(tagJson);
6
-
7
- const children = [
8
- buildHeadRow({ inColumns })
9
- ];
10
-
11
- thead.children = children;
12
-
13
- return thead;
14
- };
15
-
16
- export default renderTableHead;
@@ -1,14 +0,0 @@
1
- import tagJson from "./tag.json" with { type: "json" };
2
- import buildHeadCell from "../cell/index.js";
3
-
4
- const buildHeadRow = ({ inColumns = [] } = {}) => {
5
- const tr = structuredClone(tagJson);
6
-
7
- const children = inColumns.map(column => buildHeadCell({ inColumn: column }));
8
-
9
- tr.children = children;
10
-
11
- return tr;
12
- };
13
-
14
- export default buildHeadRow;
@@ -1,4 +0,0 @@
1
- {
2
- "tagName": "tr",
3
- "children": []
4
- }
@@ -1,4 +0,0 @@
1
- {
2
- "tagName": "thead",
3
- "children": []
4
- }
@@ -1,22 +0,0 @@
1
- import tagJson from "./tag.json" with { type: "json" };
2
- import renderTableHead from "./head/index.js";
3
- import renderTableBody from "./body/index.js";
4
-
5
- const renderTable = ({
6
- inColumns = [],
7
- inData = []
8
- } = {}) => {
9
- const table = structuredClone(tagJson);
10
-
11
- const children = [
12
- renderTableHead({ inColumns }),
13
- renderTableBody({ inData, inColumns })
14
- ];
15
-
16
- table.children = children;
17
-
18
- return table;
19
- };
20
-
21
- export { renderTableHead, renderTableBody };
22
- export default renderTable;
@@ -1,7 +0,0 @@
1
- {
2
- "tagName": "table",
3
- "attributes": {
4
- "class": "table table-hover table-striped mb-0"
5
- },
6
- "children": []
7
- }
package/src/v9/index.js DELETED
@@ -1,28 +0,0 @@
1
-
2
- import renderTable from "./table/index.js";
3
-
4
- const render = ({
5
- inTargetHtmlId,
6
- targetHtmlId,
7
- inColumns,
8
- columns,
9
- inData,
10
- data,
11
- inColGroup,
12
- colGroup
13
- } = {}) => {
14
- const localTargetHtmlId = inTargetHtmlId || targetHtmlId;
15
- const localColumns = inColumns || columns;
16
- const localData = inData || data;
17
- const localColGroup = inColGroup || colGroup;
18
-
19
- return renderTable({
20
- inTargetHtmlId: localTargetHtmlId,
21
- inColumns: localColumns,
22
- inData: localData,
23
- inColGroup: localColGroup
24
- });
25
- };
26
-
27
- export { render, renderTable };
28
- export default render;
@@ -1,67 +0,0 @@
1
- import { tableFromData } from "json-transformer-funcs";
2
- import jsonToTag from "@keshavsoft/json-to-tag";
3
-
4
- import spec from "./spec.json" with { type: "json" };
5
- import table from "./table.json" with { type: "json" };
6
-
7
- const startFunc = ({
8
- inTargetHtmlId,
9
- targetHtmlId,
10
- inColumns = [],
11
- inData = [],
12
- inColGroup = []
13
- } = {}) => {
14
- const localTargetHtmlId = inTargetHtmlId || targetHtmlId;
15
-
16
- const tableSpec = tableFromData({
17
- inData: {
18
- columns: inColumns,
19
- rows: inData
20
- },
21
- inSpec: spec,
22
- inTable: table
23
- });
24
-
25
- if (Array.isArray(inColGroup) && inColGroup.length > 0) {
26
- const colgroupSpec = {
27
- tagName: "colgroup",
28
- children: inColGroup.map(col => {
29
- const width = typeof col === "string" ? col : col?.width;
30
- const style = typeof col === "object" ? col?.style : undefined;
31
- const attributes = {};
32
-
33
- if (style) {
34
- attributes.style = style;
35
- } else if (width) {
36
- attributes.style = `width: ${width};`;
37
- }
38
-
39
- if (typeof col === "object" && col?.class) {
40
- attributes.class = col.class;
41
- }
42
-
43
- return {
44
- tagName: "col",
45
- ...(Object.keys(attributes).length > 0 ? { attributes } : {})
46
- };
47
- })
48
- };
49
-
50
- tableSpec.children.unshift(colgroupSpec);
51
- }
52
-
53
- const element = jsonToTag(tableSpec);
54
-
55
- if (localTargetHtmlId && typeof document !== "undefined") {
56
- const container = document.getElementById(localTargetHtmlId);
57
- if (container) {
58
- container.innerHTML = "";
59
- container.append(element);
60
- }
61
- }
62
-
63
- return element;
64
- };
65
-
66
- export { startFunc as renderTable };
67
- export default startFunc;
@@ -1,18 +0,0 @@
1
- {
2
- "buildHeader": {
3
- "tagName": "th",
4
- "textContent": "${label}",
5
- "attributes": {
6
- "scope": "col"
7
- }
8
- },
9
- "buildBody": {
10
- "outerTemplate": {
11
- "tagName": "tr"
12
- },
13
- "innerTemplate": {
14
- "tagName": "td",
15
- "textContent": "${rowValue}"
16
- }
17
- }
18
- }
@@ -1,24 +0,0 @@
1
- {
2
- "tagName": "table",
3
- "attributes": {
4
- "class": "table table-hover table-striped align-middle border mb-0"
5
- },
6
- "children": [
7
- {
8
- "tagName": "thead",
9
- "attributes": {
10
- "class": "table-dark"
11
- },
12
- "children": [
13
- {
14
- "tagName": "tr",
15
- "children": []
16
- }
17
- ]
18
- },
19
- {
20
- "tagName": "tbody",
21
- "children": []
22
- }
23
- ]
24
- }