json-renderers-build-table 1.17.3 → 1.22.2
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 +197 -14
- package/package.json +3 -3
- package/src/index.js +2 -2
- package/src/v17/index.js +5 -5
- package/src/v17/simple/index.js +55 -55
- package/src/v17/spec.json +85 -85
- package/src/v18/bodyOnly/base.json +1 -0
- package/src/v18/bodyOnly/index.js +36 -0
- package/src/v18/bodyOnly/instructions/double.json +18 -0
- package/src/{v16 → v18/bodyOnly}/spec.json +86 -65
- package/src/{v16/common/writePath.js → v18/bodyOnly/writePath/index.js} +47 -55
- package/src/v18/headerOnly/index.js +42 -0
- package/src/{v15/simpleTable/config/instructions.json → v18/headerOnly/instructions/single.json} +8 -8
- package/src/{v14 → v18/headerOnly}/spec.json +22 -1
- package/src/{v14/buildSpec → v18/headerOnly}/writePath/index.js +8 -16
- package/src/v18/index.js +5 -0
- package/src/v18/simple/index.js +57 -0
- package/src/{v15/buildSpec/config/rowInstructions.json → v18/simple/instructions/double.json} +4 -5
- package/src/{v16/simpleTable/config/instructions.json → v18/simple/instructions/single.json} +38 -38
- package/src/{v15 → v18/simple}/spec.json +22 -1
- package/src/{v15/buildSpec → v18/simple}/writePath/index.js +8 -16
- package/src/v18/spec.json +86 -0
- package/src/v19/bodyOnly/base.json +1 -0
- package/src/v19/bodyOnly/index.js +36 -0
- package/src/v19/bodyOnly/instructions/double.json +18 -0
- package/src/v19/bodyOnly/spec.json +86 -0
- package/src/v19/headerOnly/index.js +42 -0
- package/src/{v14/buildSpec/config/columnInstructions.json → v19/headerOnly/instructions/single.json} +2 -20
- package/src/v19/headerOnly/spec.json +86 -0
- package/src/v19/index.js +5 -0
- package/src/v19/simple/index.js +57 -0
- package/src/{v15/tableHeadless/config/instructions.json → v19/simple/instructions/double.json} +4 -5
- package/src/v19/simple/instructions/single.json +38 -0
- package/src/v19/simple/spec.json +86 -0
- package/src/v19/spec.json +86 -0
- package/src/{v15/common/writePath.js → v19/writePath/index.js} +8 -16
- package/src/v20/bodyOnly/base.json +1 -0
- package/src/v20/bodyOnly/index.js +18 -0
- package/src/v20/bodyOnly/instructions/double.json +18 -0
- package/src/v20/bodyOnly/spec.json +86 -0
- package/src/v20/doubleInstruction/index.js +19 -0
- package/src/v20/headerOnly/base.json +53 -0
- package/src/v20/headerOnly/index.js +18 -0
- package/src/v20/headerOnly/instructions/single.json +38 -0
- package/src/v20/headerOnly/spec.json +86 -0
- package/src/v20/index.js +5 -0
- package/src/v20/simple/base.json +53 -0
- package/src/v20/simple/index.js +22 -0
- package/src/{v14/buildSpec/config/rowInstructions.json → v20/simple/instructions/double.json} +4 -5
- package/src/v20/simple/instructions/single.json +38 -0
- package/src/v20/simple/spec.json +86 -0
- package/src/v20/singleInstruction/index.js +17 -0
- package/src/v20/spec.json +86 -0
- package/src/v20/writePath/index.js +62 -0
- package/src/v21/bodyOnly/base.json +1 -0
- package/src/v21/bodyOnly/index.js +18 -0
- package/src/v21/bodyOnly/instructions/double.json +18 -0
- package/src/v21/bodyOnly/spec.json +86 -0
- package/src/v21/doubleInstruction/index.js +21 -0
- package/src/v21/guards/index.js +10 -0
- package/src/v21/guards/references/func/index.js +8 -0
- package/src/v21/guards/references/index.js +9 -0
- package/src/v21/guards/references/templateKey/index.js +8 -0
- package/src/v21/guards/structure/destinationPath/index.js +8 -0
- package/src/v21/guards/structure/func/index.js +8 -0
- package/src/v21/guards/structure/index.js +15 -0
- package/src/v21/guards/structure/sourcePath/index.js +8 -0
- package/src/v21/guards/structure/templateKey/index.js +9 -0
- package/src/v21/headerOnly/base.json +53 -0
- package/src/v21/headerOnly/index.js +18 -0
- package/src/v21/headerOnly/instructions/single.json +38 -0
- package/src/v21/headerOnly/spec.json +86 -0
- package/src/v21/index.js +5 -0
- package/src/v21/simple/base.json +53 -0
- package/src/v21/simple/index.js +22 -0
- package/src/v21/simple/instructions/double.json +19 -0
- package/src/v21/simple/instructions/single.json +38 -0
- package/src/v21/simple/spec.json +86 -0
- package/src/v21/singleInstruction/index.js +19 -0
- package/src/v21/spec.json +86 -0
- package/src/v21/writePath/index.js +62 -0
- package/src/v22/builders/bodyOnly/base.json +1 -0
- package/src/v22/builders/bodyOnly/index.js +18 -0
- package/src/v22/builders/bodyOnly/instructions/double.json +18 -0
- package/src/v22/builders/footerOnly/base.json +3 -0
- package/src/v22/builders/footerOnly/index.js +21 -0
- package/src/v22/builders/footerOnly/instructions/single.json +19 -0
- package/src/v22/builders/headerOnly/base.json +53 -0
- package/src/v22/builders/headerOnly/index.js +18 -0
- package/src/v22/builders/headerOnly/instructions/single.json +38 -0
- package/src/v22/builders/simple/base.json +53 -0
- package/src/v22/builders/simple/index.js +22 -0
- package/src/v22/builders/simple/instructions/double.json +19 -0
- package/src/v22/builders/simple/instructions/single.json +38 -0
- package/src/v22/builders/spec.json +86 -0
- package/src/v22/builders/withFooter/base.json +53 -0
- package/src/v22/builders/withFooter/index.js +22 -0
- package/src/v22/builders/withFooter/instructions/double.json +19 -0
- package/src/{v15/buildSpec/config/columnInstructions.json → v22/builders/withFooter/instructions/single.json} +3 -3
- package/src/v22/doubleInstruction/index.js +21 -0
- package/src/v22/guards/index.js +10 -0
- package/src/v22/guards/references/func/index.js +8 -0
- package/src/v22/guards/references/index.js +9 -0
- package/src/v22/guards/references/templateKey/index.js +8 -0
- package/src/v22/guards/structure/destinationPath/index.js +8 -0
- package/src/v22/guards/structure/func/index.js +8 -0
- package/src/v22/guards/structure/index.js +15 -0
- package/src/v22/guards/structure/sourcePath/index.js +8 -0
- package/src/v22/guards/structure/templateKey/index.js +9 -0
- package/src/v22/index.js +7 -0
- package/src/v22/singleInstruction/index.js +32 -0
- package/src/v22/spec.json +86 -0
- package/src/v22/writePath/index.js +62 -0
- package/src/v14/buildSpec/config/optionsInstructions.json +0 -82
- package/src/v14/buildSpec/config/serialInstructions.json +0 -82
- package/src/v14/buildSpec/index.js +0 -147
- package/src/v14/index.js +0 -56
- package/src/v14/register/index.js +0 -30
- package/src/v14/register/meta.js +0 -6
- package/src/v15/buildSpec/config/optionsInstructions.json +0 -82
- package/src/v15/buildSpec/config/serialInstructions.json +0 -82
- package/src/v15/buildSpec/index.js +0 -147
- package/src/v15/common/runner.js +0 -33
- package/src/v15/index.js +0 -85
- package/src/v15/register/index.js +0 -30
- package/src/v15/register/meta.js +0 -6
- package/src/v15/simpleTable/config/base.json +0 -31
- package/src/v15/simpleTable/index.js +0 -58
- package/src/v15/tableFullGrid/config/instructions.json +0 -234
- package/src/v15/tableFullGrid/index.js +0 -76
- package/src/v15/tableHeadless/config/base.json +0 -15
- package/src/v15/tableHeadless/index.js +0 -58
- package/src/v15/tableWithButtonCell/config/base.json +0 -38
- package/src/v15/tableWithButtonCell/config/instructions.json +0 -56
- package/src/v15/tableWithButtonCell/index.js +0 -57
- package/src/v15/tableWithFooter/config/instructions.json +0 -74
- package/src/v15/tableWithFooter/index.js +0 -58
- package/src/v15/tableWithOptions/config/base.json +0 -38
- package/src/v15/tableWithOptions/config/instructions.json +0 -116
- package/src/v15/tableWithOptions/index.js +0 -66
- package/src/v15/tableWithSerial/config/base.json +0 -38
- package/src/v15/tableWithSerial/config/instructions.json +0 -116
- package/src/v15/tableWithSerial/index.js +0 -66
- package/src/v15/tableWithWidths/config/base.json +0 -38
- package/src/v15/tableWithWidths/config/instructions.json +0 -56
- package/src/v15/tableWithWidths/index.js +0 -58
- package/src/v16/common/runner.js +0 -33
- package/src/v16/index.js +0 -7
- package/src/v16/simpleTable/config/base.json +0 -31
- package/src/v16/simpleTable/index.js +0 -58
- package/src/v16/tableWithOptions/config/base.json +0 -38
- package/src/v16/tableWithOptions/config/instructions.json +0 -116
- package/src/v16/tableWithOptions/index.js +0 -66
- package/src/v16/tableWithSerial/config/base.json +0 -38
- package/src/v16/tableWithSerial/config/instructions.json +0 -116
- package/src/v16/tableWithSerial/index.js +0 -66
- /package/src/{v14/buildSpec/config → v18/headerOnly}/base.json +0 -0
- /package/src/{v15/buildSpec/config → v18/simple}/base.json +0 -0
- /package/src/{v15/tableFullGrid/config → v19/headerOnly}/base.json +0 -0
- /package/src/{v15/tableWithFooter/config → v19/simple}/base.json +0 -0
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { runInstructions, buildBody, findByRole } from "../common/runner.js";
|
|
2
|
-
import spec from "../spec.json" with { type: "json" };
|
|
3
|
-
import base from "./config/base.json" with { type: "json" };
|
|
4
|
-
import instructions from "./config/instructions.json" with { type: "json" };
|
|
5
|
-
|
|
6
|
-
const buildSpec = ({ inColumns = [], inData = [], inSerial = {}, inOptions = {} } = {}) => {
|
|
7
|
-
const localColumns = inColumns;
|
|
8
|
-
const localData = inData;
|
|
9
|
-
const localSerial = {
|
|
10
|
-
col: { width: "50px" },
|
|
11
|
-
header: { columnName: "#" },
|
|
12
|
-
body: {},
|
|
13
|
-
footer: {},
|
|
14
|
-
...inSerial
|
|
15
|
-
};
|
|
16
|
-
const localOptions = {
|
|
17
|
-
col: { width: "100px" },
|
|
18
|
-
header: { columnName: "options" },
|
|
19
|
-
body: { columnName: "show" },
|
|
20
|
-
footer: { columnName: "save" },
|
|
21
|
-
...inOptions
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const localBase = structuredClone(base);
|
|
25
|
-
const localSpec = structuredClone(spec);
|
|
26
|
-
|
|
27
|
-
const normalizedColumns = localColumns.map(col => {
|
|
28
|
-
const colCopy = structuredClone(col);
|
|
29
|
-
colCopy.template = {
|
|
30
|
-
bodyCell: "buildBodyCell",
|
|
31
|
-
...(colCopy.template || {})
|
|
32
|
-
};
|
|
33
|
-
return colCopy;
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const buildData = {
|
|
37
|
-
columns: normalizedColumns,
|
|
38
|
-
data: localData,
|
|
39
|
-
serial: localSerial,
|
|
40
|
-
options: localOptions
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const registry = {
|
|
44
|
-
data: buildData,
|
|
45
|
-
base: localBase,
|
|
46
|
-
spec: localSpec
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
runInstructions({
|
|
50
|
-
inInstructions: instructions,
|
|
51
|
-
inRegistry: registry
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const tbodyElement = findByRole(localBase, "table-body");
|
|
55
|
-
if (tbodyElement && Array.isArray(tbodyElement.children)) {
|
|
56
|
-
buildBody(tbodyElement.children, buildData, localSpec);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return localBase;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const startFunc = (input = {}) => {
|
|
63
|
-
const localInput = (input && typeof input === "object" && "inConfig" in input)
|
|
64
|
-
? input.inConfig
|
|
65
|
-
: input;
|
|
66
|
-
|
|
67
|
-
return buildSpec({
|
|
68
|
-
inColumns: localInput.columns || [],
|
|
69
|
-
inData: localInput.data || [],
|
|
70
|
-
inSerial: localInput.serial || {},
|
|
71
|
-
inOptions: localInput.options || {}
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export { buildSpec };
|
|
76
|
-
export default startFunc;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { runInstructions, buildBody, findByRole } from "../common/runner.js";
|
|
2
|
-
import spec from "../spec.json" with { type: "json" };
|
|
3
|
-
import base from "./config/base.json" with { type: "json" };
|
|
4
|
-
import instructions from "./config/instructions.json" with { type: "json" };
|
|
5
|
-
|
|
6
|
-
const buildSpec = ({ inColumns = [], inData = [] } = {}) => {
|
|
7
|
-
const localColumns = inColumns;
|
|
8
|
-
const localData = inData;
|
|
9
|
-
|
|
10
|
-
const localBase = structuredClone(base);
|
|
11
|
-
const localSpec = structuredClone(spec);
|
|
12
|
-
|
|
13
|
-
const normalizedColumns = localColumns.map(col => {
|
|
14
|
-
const colCopy = structuredClone(col);
|
|
15
|
-
colCopy.template = {
|
|
16
|
-
bodyCell: "buildBodyCell",
|
|
17
|
-
...(colCopy.template || {})
|
|
18
|
-
};
|
|
19
|
-
return colCopy;
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const buildData = {
|
|
23
|
-
columns: normalizedColumns,
|
|
24
|
-
data: localData
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const registry = {
|
|
28
|
-
data: buildData,
|
|
29
|
-
base: localBase,
|
|
30
|
-
spec: localSpec
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
runInstructions({
|
|
34
|
-
inInstructions: instructions,
|
|
35
|
-
inRegistry: registry
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const tbodyElement = findByRole(localBase, "table-body");
|
|
39
|
-
if (tbodyElement && Array.isArray(tbodyElement.children)) {
|
|
40
|
-
buildBody(tbodyElement.children, buildData, localSpec);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return localBase;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const startFunc = (input = {}) => {
|
|
47
|
-
const localInput = (input && typeof input === "object" && "inConfig" in input)
|
|
48
|
-
? input.inConfig
|
|
49
|
-
: input;
|
|
50
|
-
|
|
51
|
-
return buildSpec({
|
|
52
|
-
inColumns: localInput.columns || [],
|
|
53
|
-
inData: localInput.data || []
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export { buildSpec };
|
|
58
|
-
export default startFunc;
|
|
@@ -1,38 +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": "colgroup",
|
|
9
|
-
"attributes": {
|
|
10
|
-
"data-role": "table-colgroup"
|
|
11
|
-
},
|
|
12
|
-
"children": []
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"tagName": "thead",
|
|
16
|
-
"attributes": {
|
|
17
|
-
"class": "table-dark",
|
|
18
|
-
"data-role": "table-header"
|
|
19
|
-
},
|
|
20
|
-
"children": [
|
|
21
|
-
{
|
|
22
|
-
"tagName": "tr",
|
|
23
|
-
"attributes": {
|
|
24
|
-
"data-role": "table-header-row"
|
|
25
|
-
},
|
|
26
|
-
"children": []
|
|
27
|
-
}
|
|
28
|
-
]
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"tagName": "tbody",
|
|
32
|
-
"attributes": {
|
|
33
|
-
"data-role": "table-body"
|
|
34
|
-
},
|
|
35
|
-
"children": []
|
|
36
|
-
}
|
|
37
|
-
]
|
|
38
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
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 table header row from the column metadata.",
|
|
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": "Create one table row for each record and place it into the table body container.",
|
|
40
|
-
"destinationPath": {
|
|
41
|
-
"fileName": "base",
|
|
42
|
-
"dataRole": "table-body",
|
|
43
|
-
"filePath": [
|
|
44
|
-
"children"
|
|
45
|
-
]
|
|
46
|
-
},
|
|
47
|
-
"sourcePath": {
|
|
48
|
-
"fileName": "data",
|
|
49
|
-
"filePath": [
|
|
50
|
-
"data"
|
|
51
|
-
]
|
|
52
|
-
},
|
|
53
|
-
"templateKey": "buildBodyTr",
|
|
54
|
-
"func": "fromCollection"
|
|
55
|
-
}
|
|
56
|
-
]
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { runInstructions, buildBody, findByRole } from "../common/runner.js";
|
|
2
|
-
import spec from "../spec.json" with { type: "json" };
|
|
3
|
-
import base from "./config/base.json" with { type: "json" };
|
|
4
|
-
import instructions from "./config/instructions.json" with { type: "json" };
|
|
5
|
-
|
|
6
|
-
const buildSpec = ({ inColumns = [], inData = [] } = {}) => {
|
|
7
|
-
const localColumns = inColumns;
|
|
8
|
-
const localData = inData;
|
|
9
|
-
|
|
10
|
-
const localBase = structuredClone(base);
|
|
11
|
-
const localSpec = structuredClone(spec);
|
|
12
|
-
|
|
13
|
-
const normalizedColumns = localColumns.map(col => {
|
|
14
|
-
const colCopy = structuredClone(col);
|
|
15
|
-
colCopy.template = {
|
|
16
|
-
bodyCell: colCopy.template?.bodyCell || "buttonCell"
|
|
17
|
-
};
|
|
18
|
-
return colCopy;
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const buildData = {
|
|
22
|
-
columns: normalizedColumns,
|
|
23
|
-
data: localData
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const registry = {
|
|
27
|
-
data: buildData,
|
|
28
|
-
base: localBase,
|
|
29
|
-
spec: localSpec
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
runInstructions({
|
|
33
|
-
inInstructions: instructions,
|
|
34
|
-
inRegistry: registry
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const tbodyElement = findByRole(localBase, "table-body");
|
|
38
|
-
if (tbodyElement && Array.isArray(tbodyElement.children)) {
|
|
39
|
-
buildBody(tbodyElement.children, buildData, localSpec);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return localBase;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const startFunc = (input = {}) => {
|
|
46
|
-
const localInput = (input && typeof input === "object" && "inConfig" in input)
|
|
47
|
-
? input.inConfig
|
|
48
|
-
: input;
|
|
49
|
-
|
|
50
|
-
return buildSpec({
|
|
51
|
-
inColumns: localInput.columns || [],
|
|
52
|
-
inData: localInput.data || []
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export { buildSpec };
|
|
57
|
-
export default startFunc;
|
|
@@ -1,74 +0,0 @@
|
|
|
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 table header row from the column metadata.",
|
|
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": "Create one table row for each record and place it into the table body container.",
|
|
40
|
-
"destinationPath": {
|
|
41
|
-
"fileName": "base",
|
|
42
|
-
"dataRole": "table-body",
|
|
43
|
-
"filePath": [
|
|
44
|
-
"children"
|
|
45
|
-
]
|
|
46
|
-
},
|
|
47
|
-
"sourcePath": {
|
|
48
|
-
"fileName": "data",
|
|
49
|
-
"filePath": [
|
|
50
|
-
"data"
|
|
51
|
-
]
|
|
52
|
-
},
|
|
53
|
-
"templateKey": "buildBodyTr",
|
|
54
|
-
"func": "fromCollection"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"narration": "Build the table footer row from the column metadata.",
|
|
58
|
-
"destinationPath": {
|
|
59
|
-
"fileName": "base",
|
|
60
|
-
"dataRole": "table-footer-row",
|
|
61
|
-
"filePath": [
|
|
62
|
-
"children"
|
|
63
|
-
]
|
|
64
|
-
},
|
|
65
|
-
"sourcePath": {
|
|
66
|
-
"fileName": "data",
|
|
67
|
-
"filePath": [
|
|
68
|
-
"columns"
|
|
69
|
-
]
|
|
70
|
-
},
|
|
71
|
-
"templateKey": "buildFooter",
|
|
72
|
-
"func": "fromCollection"
|
|
73
|
-
}
|
|
74
|
-
]
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { runInstructions, buildBody, findByRole } from "../common/runner.js";
|
|
2
|
-
import spec from "../spec.json" with { type: "json" };
|
|
3
|
-
import base from "./config/base.json" with { type: "json" };
|
|
4
|
-
import instructions from "./config/instructions.json" with { type: "json" };
|
|
5
|
-
|
|
6
|
-
const buildSpec = ({ inColumns = [], inData = [] } = {}) => {
|
|
7
|
-
const localColumns = inColumns;
|
|
8
|
-
const localData = inData;
|
|
9
|
-
|
|
10
|
-
const localBase = structuredClone(base);
|
|
11
|
-
const localSpec = structuredClone(spec);
|
|
12
|
-
|
|
13
|
-
const normalizedColumns = localColumns.map(col => {
|
|
14
|
-
const colCopy = structuredClone(col);
|
|
15
|
-
colCopy.template = {
|
|
16
|
-
bodyCell: "buildBodyCell",
|
|
17
|
-
...(colCopy.template || {})
|
|
18
|
-
};
|
|
19
|
-
return colCopy;
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const buildData = {
|
|
23
|
-
columns: normalizedColumns,
|
|
24
|
-
data: localData
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const registry = {
|
|
28
|
-
data: buildData,
|
|
29
|
-
base: localBase,
|
|
30
|
-
spec: localSpec
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
runInstructions({
|
|
34
|
-
inInstructions: instructions,
|
|
35
|
-
inRegistry: registry
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const tbodyElement = findByRole(localBase, "table-body");
|
|
39
|
-
if (tbodyElement && Array.isArray(tbodyElement.children)) {
|
|
40
|
-
buildBody(tbodyElement.children, buildData, localSpec);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return localBase;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const startFunc = (input = {}) => {
|
|
47
|
-
const localInput = (input && typeof input === "object" && "inConfig" in input)
|
|
48
|
-
? input.inConfig
|
|
49
|
-
: input;
|
|
50
|
-
|
|
51
|
-
return buildSpec({
|
|
52
|
-
inColumns: localInput.columns || [],
|
|
53
|
-
inData: localInput.data || []
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export { buildSpec };
|
|
58
|
-
export default startFunc;
|
|
@@ -1,38 +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": "colgroup",
|
|
9
|
-
"attributes": {
|
|
10
|
-
"data-role": "table-colgroup"
|
|
11
|
-
},
|
|
12
|
-
"children": []
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"tagName": "thead",
|
|
16
|
-
"attributes": {
|
|
17
|
-
"class": "table-dark",
|
|
18
|
-
"data-role": "table-header"
|
|
19
|
-
},
|
|
20
|
-
"children": [
|
|
21
|
-
{
|
|
22
|
-
"tagName": "tr",
|
|
23
|
-
"attributes": {
|
|
24
|
-
"data-role": "table-header-row"
|
|
25
|
-
},
|
|
26
|
-
"children": []
|
|
27
|
-
}
|
|
28
|
-
]
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"tagName": "tbody",
|
|
32
|
-
"attributes": {
|
|
33
|
-
"data-role": "table-body"
|
|
34
|
-
},
|
|
35
|
-
"children": []
|
|
36
|
-
}
|
|
37
|
-
]
|
|
38
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
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 table header row from the column metadata.",
|
|
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": "Create one table row for each record and place it into the table body container.",
|
|
40
|
-
"destinationPath": {
|
|
41
|
-
"fileName": "base",
|
|
42
|
-
"dataRole": "table-body",
|
|
43
|
-
"filePath": [
|
|
44
|
-
"children"
|
|
45
|
-
]
|
|
46
|
-
},
|
|
47
|
-
"sourcePath": {
|
|
48
|
-
"fileName": "data",
|
|
49
|
-
"filePath": [
|
|
50
|
-
"data"
|
|
51
|
-
]
|
|
52
|
-
},
|
|
53
|
-
"templateKey": "buildBodyTr",
|
|
54
|
-
"func": "fromCollection"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"narration": "Append the options column width to the table colgroup.",
|
|
58
|
-
"destinationPath": {
|
|
59
|
-
"fileName": "base",
|
|
60
|
-
"dataRole": "table-colgroup",
|
|
61
|
-
"filePath": [
|
|
62
|
-
"children"
|
|
63
|
-
],
|
|
64
|
-
"action": "push"
|
|
65
|
-
},
|
|
66
|
-
"sourcePath": {
|
|
67
|
-
"fileName": "data",
|
|
68
|
-
"filePath": [
|
|
69
|
-
"options",
|
|
70
|
-
"col"
|
|
71
|
-
]
|
|
72
|
-
},
|
|
73
|
-
"templateKey": "buildColGroup",
|
|
74
|
-
"func": "applyTemplate"
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
"narration": "Append the options header cell to the table header row.",
|
|
78
|
-
"destinationPath": {
|
|
79
|
-
"fileName": "base",
|
|
80
|
-
"dataRole": "table-header-row",
|
|
81
|
-
"filePath": [
|
|
82
|
-
"children"
|
|
83
|
-
],
|
|
84
|
-
"action": "push"
|
|
85
|
-
},
|
|
86
|
-
"sourcePath": {
|
|
87
|
-
"fileName": "data",
|
|
88
|
-
"filePath": [
|
|
89
|
-
"options",
|
|
90
|
-
"header"
|
|
91
|
-
]
|
|
92
|
-
},
|
|
93
|
-
"templateKey": "buildHeader",
|
|
94
|
-
"func": "applyTemplate"
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
"narration": "Append the options button cell into each table body row.",
|
|
98
|
-
"destinationPath": {
|
|
99
|
-
"fileName": "base",
|
|
100
|
-
"dataRole": "table-body",
|
|
101
|
-
"filePath": [
|
|
102
|
-
"children"
|
|
103
|
-
],
|
|
104
|
-
"action": "pushToRows"
|
|
105
|
-
},
|
|
106
|
-
"sourcePath": {
|
|
107
|
-
"fileName": "data",
|
|
108
|
-
"filePath": [
|
|
109
|
-
"options",
|
|
110
|
-
"body"
|
|
111
|
-
]
|
|
112
|
-
},
|
|
113
|
-
"templateKey": "buttonCell",
|
|
114
|
-
"func": "applyTemplate"
|
|
115
|
-
}
|
|
116
|
-
]
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { runInstructions, buildBody, findByRole } from "../common/runner.js";
|
|
2
|
-
import spec from "../spec.json" with { type: "json" };
|
|
3
|
-
import base from "./config/base.json" with { type: "json" };
|
|
4
|
-
import instructions from "./config/instructions.json" with { type: "json" };
|
|
5
|
-
|
|
6
|
-
const buildSpec = ({ inColumns = [], inData = [], inOptions = {} } = {}) => {
|
|
7
|
-
const localColumns = inColumns;
|
|
8
|
-
const localData = inData;
|
|
9
|
-
const localOptions = {
|
|
10
|
-
col: { width: "100px" },
|
|
11
|
-
header: { columnName: "options" },
|
|
12
|
-
body: { columnName: "show" },
|
|
13
|
-
...inOptions
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const localBase = structuredClone(base);
|
|
17
|
-
const localSpec = structuredClone(spec);
|
|
18
|
-
|
|
19
|
-
const normalizedColumns = localColumns.map(col => {
|
|
20
|
-
const colCopy = structuredClone(col);
|
|
21
|
-
colCopy.template = {
|
|
22
|
-
bodyCell: "buildBodyCell",
|
|
23
|
-
...(colCopy.template || {})
|
|
24
|
-
};
|
|
25
|
-
return colCopy;
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const buildData = {
|
|
29
|
-
columns: normalizedColumns,
|
|
30
|
-
data: localData,
|
|
31
|
-
options: localOptions
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const registry = {
|
|
35
|
-
data: buildData,
|
|
36
|
-
base: localBase,
|
|
37
|
-
spec: localSpec
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
runInstructions({
|
|
41
|
-
inInstructions: instructions,
|
|
42
|
-
inRegistry: registry
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
const tbodyElement = findByRole(localBase, "table-body");
|
|
46
|
-
if (tbodyElement && Array.isArray(tbodyElement.children)) {
|
|
47
|
-
buildBody(tbodyElement.children, buildData, localSpec);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return localBase;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const startFunc = (input = {}) => {
|
|
54
|
-
const localInput = (input && typeof input === "object" && "inConfig" in input)
|
|
55
|
-
? input.inConfig
|
|
56
|
-
: input;
|
|
57
|
-
|
|
58
|
-
return buildSpec({
|
|
59
|
-
inColumns: localInput.columns || [],
|
|
60
|
-
inData: localInput.data || [],
|
|
61
|
-
inOptions: localInput.options || {}
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export { buildSpec };
|
|
66
|
-
export default startFunc;
|
|
@@ -1,38 +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": "colgroup",
|
|
9
|
-
"attributes": {
|
|
10
|
-
"data-role": "table-colgroup"
|
|
11
|
-
},
|
|
12
|
-
"children": []
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"tagName": "thead",
|
|
16
|
-
"attributes": {
|
|
17
|
-
"class": "table-dark",
|
|
18
|
-
"data-role": "table-header"
|
|
19
|
-
},
|
|
20
|
-
"children": [
|
|
21
|
-
{
|
|
22
|
-
"tagName": "tr",
|
|
23
|
-
"attributes": {
|
|
24
|
-
"data-role": "table-header-row"
|
|
25
|
-
},
|
|
26
|
-
"children": []
|
|
27
|
-
}
|
|
28
|
-
]
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"tagName": "tbody",
|
|
32
|
-
"attributes": {
|
|
33
|
-
"data-role": "table-body"
|
|
34
|
-
},
|
|
35
|
-
"children": []
|
|
36
|
-
}
|
|
37
|
-
]
|
|
38
|
-
}
|