json-renderers-build-table 1.9.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/package.json +5 -2
- package/src/index.js +2 -3
- package/src/v14/buildSpec/config/base.json +53 -0
- package/src/v14/buildSpec/config/columnInstructions.json +56 -0
- package/src/v14/buildSpec/config/optionsInstructions.json +82 -0
- package/src/v14/buildSpec/config/rowInstructions.json +20 -0
- package/src/v14/buildSpec/config/serialInstructions.json +82 -0
- package/src/v14/buildSpec/index.js +147 -0
- package/src/v14/buildSpec/writePath/index.js +55 -0
- package/src/v14/index.js +56 -0
- package/src/v14/register/index.js +30 -0
- package/src/v14/register/meta.js +6 -0
- package/src/v14/spec.json +65 -0
- package/src/v15/buildSpec/config/base.json +53 -0
- package/src/v15/buildSpec/config/columnInstructions.json +56 -0
- package/src/v15/buildSpec/config/optionsInstructions.json +82 -0
- package/src/v15/buildSpec/config/rowInstructions.json +20 -0
- package/src/v15/buildSpec/config/serialInstructions.json +82 -0
- package/src/v15/buildSpec/index.js +147 -0
- package/src/v15/buildSpec/writePath/index.js +55 -0
- package/src/v15/common/runner.js +33 -0
- package/src/v15/common/writePath.js +55 -0
- package/src/v15/index.js +85 -0
- package/src/v15/register/index.js +30 -0
- package/src/v15/register/meta.js +6 -0
- package/src/v15/simpleTable/config/base.json +31 -0
- package/src/v15/simpleTable/config/instructions.json +38 -0
- package/src/v15/simpleTable/index.js +58 -0
- package/src/v15/spec.json +65 -0
- package/src/v15/tableFullGrid/config/base.json +53 -0
- package/src/v15/tableFullGrid/config/instructions.json +234 -0
- package/src/v15/tableFullGrid/index.js +76 -0
- package/src/v15/tableHeadless/config/base.json +15 -0
- package/src/v15/tableHeadless/config/instructions.json +20 -0
- package/src/v15/tableHeadless/index.js +58 -0
- package/src/v15/tableWithButtonCell/config/base.json +38 -0
- package/src/v15/tableWithButtonCell/config/instructions.json +56 -0
- package/src/v15/tableWithButtonCell/index.js +57 -0
- package/src/v15/tableWithFooter/config/base.json +53 -0
- package/src/v15/tableWithFooter/config/instructions.json +74 -0
- package/src/v15/tableWithFooter/index.js +58 -0
- package/src/v15/tableWithOptions/config/base.json +38 -0
- package/src/v15/tableWithOptions/config/instructions.json +116 -0
- package/src/v15/tableWithOptions/index.js +66 -0
- package/src/v15/tableWithSerial/config/base.json +38 -0
- package/src/v15/tableWithSerial/config/instructions.json +116 -0
- package/src/v15/tableWithSerial/index.js +66 -0
- package/src/v15/tableWithWidths/config/base.json +38 -0
- package/src/v15/tableWithWidths/config/instructions.json +56 -0
- package/src/v15/tableWithWidths/index.js +58 -0
- package/src/v16/common/runner.js +33 -0
- package/src/v16/common/writePath.js +55 -0
- package/src/v16/index.js +7 -0
- package/src/v16/simpleTable/config/base.json +31 -0
- package/src/v16/simpleTable/config/instructions.json +38 -0
- package/src/v16/simpleTable/index.js +58 -0
- package/src/v16/spec.json +65 -0
- package/src/v16/tableWithOptions/config/base.json +38 -0
- package/src/v16/tableWithOptions/config/instructions.json +116 -0
- package/src/v16/tableWithOptions/index.js +66 -0
- package/src/v16/tableWithSerial/config/base.json +38 -0
- package/src/v16/tableWithSerial/config/instructions.json +116 -0
- package/src/v16/tableWithSerial/index.js +66 -0
- package/src/v17/index.js +5 -0
- package/src/v17/simple/base.json +53 -0
- package/src/v17/simple/index.js +56 -0
- package/src/v17/simple/instructions/double.json +19 -0
- package/src/v17/simple/instructions/single.json +38 -0
- package/src/v17/simple/spec.json +86 -0
- package/src/v17/simple/writePath/index.js +47 -0
- package/src/v17/spec.json +86 -0
- package/src/v5/index.js +0 -49
- package/src/v5/options/index.js +0 -18
- package/src/v5/options/showOptions/index.js +0 -39
- package/src/v5/options/showSerial/index.js +0 -19
- package/src/v5/render-requests.json +0 -70
- package/src/v5/table/body/cell/index.js +0 -12
- package/src/v5/table/body/cell/tag.json +0 -7
- package/src/v5/table/body/index.js +0 -17
- package/src/v5/table/body/row/index.js +0 -18
- package/src/v5/table/body/row/tag.json +0 -4
- package/src/v5/table/body/tag.json +0 -4
- package/src/v5/table/head/cell/index.js +0 -12
- package/src/v5/table/head/cell/tag.json +0 -7
- package/src/v5/table/head/index.js +0 -16
- package/src/v5/table/head/row/index.js +0 -14
- package/src/v5/table/head/row/tag.json +0 -4
- package/src/v5/table/head/tag.json +0 -4
- package/src/v5/table/index.js +0 -22
- package/src/v5/table/tag.json +0 -7
- package/src/v6/index.js +0 -29
- package/src/v6/options/index.js +0 -28
- package/src/v6/options/showFooter/cell/index.js +0 -16
- package/src/v6/options/showFooter/cell/tag.json +0 -4
- package/src/v6/options/showFooter/footer/index.js +0 -18
- package/src/v6/options/showFooter/footer/tag.json +0 -4
- package/src/v6/options/showFooter/index.js +0 -10
- package/src/v6/options/showFooter/input/index.js +0 -11
- package/src/v6/options/showFooter/input/tag.json +0 -7
- package/src/v6/options/showFooter/row/index.js +0 -35
- package/src/v6/options/showFooter/row/tag.json +0 -4
- package/src/v6/options/showFooterSave/button/tag.json +0 -7
- package/src/v6/options/showFooterSave/index.js +0 -14
- package/src/v6/options/showOptions/index.js +0 -39
- package/src/v6/options/showSerial/index.js +0 -19
- package/src/v6/render-requests.json +0 -90
- package/src/v6/table/body/cell/index.js +0 -12
- package/src/v6/table/body/cell/tag.json +0 -7
- package/src/v6/table/body/index.js +0 -17
- package/src/v6/table/body/row/index.js +0 -18
- package/src/v6/table/body/row/tag.json +0 -4
- package/src/v6/table/body/tag.json +0 -4
- package/src/v6/table/head/cell/index.js +0 -12
- package/src/v6/table/head/cell/tag.json +0 -7
- package/src/v6/table/head/index.js +0 -16
- package/src/v6/table/head/row/index.js +0 -14
- package/src/v6/table/head/row/tag.json +0 -4
- package/src/v6/table/head/tag.json +0 -4
- package/src/v6/table/index.js +0 -22
- package/src/v6/table/tag.json +0 -7
- package/src/v7/index.js +0 -29
- package/src/v7/options/index.js +0 -28
- package/src/v7/options/showFooter/cell/index.js +0 -16
- package/src/v7/options/showFooter/cell/tag.json +0 -4
- package/src/v7/options/showFooter/footer/index.js +0 -18
- package/src/v7/options/showFooter/footer/tag.json +0 -4
- package/src/v7/options/showFooter/index.js +0 -10
- package/src/v7/options/showFooter/input/index.js +0 -11
- package/src/v7/options/showFooter/input/tag.json +0 -7
- package/src/v7/options/showFooter/row/index.js +0 -35
- package/src/v7/options/showFooter/row/tag.json +0 -4
- package/src/v7/options/showFooterSave/button/tag.json +0 -7
- package/src/v7/options/showFooterSave/index.js +0 -14
- package/src/v7/options/showOptions/index.js +0 -39
- package/src/v7/options/showSerial/index.js +0 -19
- package/src/v7/render-requests.json +0 -90
- package/src/v7/table/body/cell/index.js +0 -12
- package/src/v7/table/body/cell/tag.json +0 -7
- package/src/v7/table/body/index.js +0 -17
- package/src/v7/table/body/row/index.js +0 -18
- package/src/v7/table/body/row/tag.json +0 -4
- package/src/v7/table/body/tag.json +0 -4
- package/src/v7/table/head/cell/index.js +0 -12
- package/src/v7/table/head/cell/tag.json +0 -7
- package/src/v7/table/head/index.js +0 -16
- package/src/v7/table/head/row/index.js +0 -14
- package/src/v7/table/head/row/tag.json +0 -4
- package/src/v7/table/head/tag.json +0 -4
- package/src/v7/table/index.js +0 -22
- package/src/v7/table/tag.json +0 -7
- package/src/v8/index.js +0 -29
- package/src/v8/options/index.js +0 -28
- package/src/v8/options/showFooter/cell/index.js +0 -16
- package/src/v8/options/showFooter/cell/tag.json +0 -4
- package/src/v8/options/showFooter/footer/index.js +0 -18
- package/src/v8/options/showFooter/footer/tag.json +0 -4
- package/src/v8/options/showFooter/index.js +0 -10
- package/src/v8/options/showFooter/input/index.js +0 -11
- package/src/v8/options/showFooter/input/tag.json +0 -7
- package/src/v8/options/showFooter/row/index.js +0 -35
- package/src/v8/options/showFooter/row/tag.json +0 -4
- package/src/v8/options/showFooterSave/button/tag.json +0 -7
- package/src/v8/options/showFooterSave/index.js +0 -14
- package/src/v8/options/showOptions/index.js +0 -39
- package/src/v8/options/showSerial/index.js +0 -19
- package/src/v8/render-requests.json +0 -90
- package/src/v8/table/body/cell/index.js +0 -12
- package/src/v8/table/body/cell/tag.json +0 -7
- package/src/v8/table/body/index.js +0 -17
- package/src/v8/table/body/row/index.js +0 -18
- package/src/v8/table/body/row/tag.json +0 -4
- package/src/v8/table/body/tag.json +0 -4
- package/src/v8/table/head/cell/index.js +0 -12
- package/src/v8/table/head/cell/tag.json +0 -7
- package/src/v8/table/head/index.js +0 -16
- package/src/v8/table/head/row/index.js +0 -14
- package/src/v8/table/head/row/tag.json +0 -4
- package/src/v8/table/head/tag.json +0 -4
- package/src/v8/table/index.js +0 -22
- package/src/v8/table/tag.json +0 -7
- package/src/v9/index.js +0 -28
- package/src/v9/table/index.js +0 -67
- package/src/v9/table/spec.json +0 -18
- 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,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,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,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;
|
package/src/v7/table/index.js
DELETED
|
@@ -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;
|
package/src/v7/table/tag.json
DELETED
package/src/v8/index.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import renderTable from "./table/index.js";
|
|
2
|
-
|
|
3
|
-
import applyOptions from "./options/index.js";
|
|
4
|
-
import renderRequests from "./render-requests.json" with { type: "json" };
|
|
5
|
-
|
|
6
|
-
const render = ({
|
|
7
|
-
type = "table",
|
|
8
|
-
data = [],
|
|
9
|
-
columns = [],
|
|
10
|
-
options = {}
|
|
11
|
-
} = {}) => {
|
|
12
|
-
if (type === "table") {
|
|
13
|
-
const spec = renderTable({
|
|
14
|
-
inColumns: columns,
|
|
15
|
-
inData: data
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
return applyOptions(spec, options, columns);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
throw new Error(`Unknown table renderer type "${type}".`);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export {
|
|
25
|
-
render,
|
|
26
|
-
renderRequests
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default render;
|
package/src/v8/options/index.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import applyShowSerial from "./showSerial/index.js";
|
|
2
|
-
import applyShowOptions from "./showOptions/index.js";
|
|
3
|
-
import applyShowFooter from "./showFooter/index.js";
|
|
4
|
-
import applyShowFooterSave from "./showFooterSave/index.js";
|
|
5
|
-
|
|
6
|
-
const applyOptions = (inSpec, inOptions = {}, inColumns = []) => {
|
|
7
|
-
// console.log("inOptions : ", inOptions);
|
|
8
|
-
|
|
9
|
-
if (inOptions.showSerial) {
|
|
10
|
-
applyShowSerial(inSpec);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (inOptions.showOptions) {
|
|
14
|
-
applyShowOptions(inSpec, inOptions.showOptions);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (inOptions.showFooter) {
|
|
18
|
-
applyShowFooter(inSpec, inColumns, inOptions);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (inOptions.showFooterSave) {
|
|
22
|
-
applyShowFooterSave(inSpec, inColumns, inOptions);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return inSpec;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export default applyOptions;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import tagJson from "./tag.json" with { type: "json" };
|
|
2
|
-
import buildFooterInput from "../input/index.js";
|
|
3
|
-
|
|
4
|
-
const buildFooterCell = ({ inColumn, inChildren = [] } = {}) => {
|
|
5
|
-
const td = structuredClone(tagJson);
|
|
6
|
-
|
|
7
|
-
if (inColumn !== undefined) {
|
|
8
|
-
td.children.push(buildFooterInput({ inColumn }));
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
td.children.push(...inChildren);
|
|
12
|
-
|
|
13
|
-
return td;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export default buildFooterCell;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import tagJson from "./tag.json" with { type: "json" };
|
|
2
|
-
import buildFooterRow from "../row/index.js";
|
|
3
|
-
|
|
4
|
-
const buildFooter = ({ inColumns = [], inOptions = {}, inSaveButton } = {}) => {
|
|
5
|
-
const tfoot = structuredClone(tagJson);
|
|
6
|
-
|
|
7
|
-
tfoot.children = [
|
|
8
|
-
buildFooterRow({
|
|
9
|
-
inColumns,
|
|
10
|
-
inOptions,
|
|
11
|
-
inSaveButton
|
|
12
|
-
})
|
|
13
|
-
];
|
|
14
|
-
|
|
15
|
-
return tfoot;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default buildFooter;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import tagJson from "./tag.json" with { type: "json" };
|
|
2
|
-
import buildFooterCell from "../cell/index.js";
|
|
3
|
-
|
|
4
|
-
const buildFooterRow = ({
|
|
5
|
-
inColumns = [],
|
|
6
|
-
inOptions = {},
|
|
7
|
-
inSaveButton
|
|
8
|
-
} = {}) => {
|
|
9
|
-
const tr = structuredClone(tagJson);
|
|
10
|
-
const columns = [...inColumns];
|
|
11
|
-
|
|
12
|
-
if (columns.length === 0 && inSaveButton) {
|
|
13
|
-
tr.children = [buildFooterCell({ inChildren: [inSaveButton] })];
|
|
14
|
-
return tr;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
tr.children = columns.map((column, index) => buildFooterCell({
|
|
18
|
-
inColumn: column,
|
|
19
|
-
inChildren: inSaveButton && index === columns.length - 1
|
|
20
|
-
? [inSaveButton]
|
|
21
|
-
: []
|
|
22
|
-
}));
|
|
23
|
-
|
|
24
|
-
if (inOptions.showSerial) {
|
|
25
|
-
tr.children.unshift(buildFooterCell());
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (inOptions.showOptions) {
|
|
29
|
-
tr.children.push(buildFooterCell());
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return tr;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export default buildFooterRow;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import buildFooter from "../showFooter/footer/index.js";
|
|
2
|
-
import tagJson from "./button/tag.json" with { type: "json" };
|
|
3
|
-
|
|
4
|
-
const applyShowFooterSave = (inSpec, inColumns, inOptions) => {
|
|
5
|
-
const button = structuredClone(tagJson);
|
|
6
|
-
|
|
7
|
-
inSpec.children.push(buildFooter({
|
|
8
|
-
inColumns,
|
|
9
|
-
inOptions,
|
|
10
|
-
inSaveButton: button
|
|
11
|
-
}));
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default applyShowFooterSave;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const resolveButtons = (inShowOptions) => {
|
|
2
|
-
if (inShowOptions === true) {
|
|
3
|
-
return [{ label: "Apply", type: "button" }];
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
if (Array.isArray(inShowOptions)) {
|
|
7
|
-
return inShowOptions;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
return [];
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const applyShowOptions = (inSpec, inShowOptions) => {
|
|
14
|
-
const buttons = resolveButtons(inShowOptions);
|
|
15
|
-
|
|
16
|
-
if (buttons.length === 0) return;
|
|
17
|
-
|
|
18
|
-
const [thead, tbody] = inSpec.children;
|
|
19
|
-
|
|
20
|
-
// append <th>Actions</th> to head row
|
|
21
|
-
thead.children[0].children.push({
|
|
22
|
-
tagName: "th",
|
|
23
|
-
textContent: "Actions"
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
// append <td> with buttons to each body row
|
|
27
|
-
tbody.children.forEach(tr => {
|
|
28
|
-
tr.children.push({
|
|
29
|
-
tagName: "td",
|
|
30
|
-
children: buttons.map(btn => ({
|
|
31
|
-
tagName: "button",
|
|
32
|
-
attributes: { type: btn.type || "button" },
|
|
33
|
-
textContent: btn.label
|
|
34
|
-
}))
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export default applyShowOptions;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const applyShowSerial = (inSpec) => {
|
|
2
|
-
const [thead, tbody] = inSpec.children;
|
|
3
|
-
|
|
4
|
-
// prepend <th>#</th> to head row
|
|
5
|
-
thead.children[0].children.unshift({
|
|
6
|
-
tagName: "th",
|
|
7
|
-
textContent: "#"
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
// prepend <td>{rowIndex}</td> to each body row
|
|
11
|
-
tbody.children.forEach((tr, index) => {
|
|
12
|
-
tr.children.unshift({
|
|
13
|
-
tagName: "td",
|
|
14
|
-
textContent: String(index + 1)
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export default applyShowSerial;
|
|
@@ -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,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;
|