json-renderers-build-table 1.19.1 → 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/package.json +1 -1
- package/src/index.js +2 -2
- 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/v20/simple/instructions/double.json +19 -0
- 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/v22/builders/withFooter/instructions/single.json +56 -0
- 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/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export { default } from "./
|
|
1
|
+
export * from "./v22/index.js";
|
|
2
|
+
export { default } from "./v22/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "children": [] }
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import twoDimensional from "json-transformer-funcs-two-dimensions";
|
|
2
|
+
|
|
3
|
+
import spec from "../spec.json" with { type: "json" };
|
|
4
|
+
import base from "./base.json" with { type: "json" };
|
|
5
|
+
import doubleInstructions from "./instructions/double.json" with { type: "json" };
|
|
6
|
+
|
|
7
|
+
import runDoubleInstructions from "../doubleInstruction/index.js";
|
|
8
|
+
|
|
9
|
+
const registry = { data: {}, base, spec };
|
|
10
|
+
const functions = { twoDimensional };
|
|
11
|
+
|
|
12
|
+
const startFunc = data => {
|
|
13
|
+
registry.data = data;
|
|
14
|
+
runDoubleInstructions(doubleInstructions, registry, functions, spec);
|
|
15
|
+
return base.children;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default startFunc;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"narration": "Build the table body rows for the table using the configured columns and data.",
|
|
4
|
+
"destinationPath": {
|
|
5
|
+
"fileName": "base",
|
|
6
|
+
"filePath": [
|
|
7
|
+
"children"
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
"sourcePath": {
|
|
11
|
+
"fileName": "data",
|
|
12
|
+
"filePath": [
|
|
13
|
+
"columns"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"func": "twoDimensional"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"buildBodyTr": {
|
|
3
|
+
"tagName": "tr",
|
|
4
|
+
"attributes": {
|
|
5
|
+
"class": "align-middle"
|
|
6
|
+
},
|
|
7
|
+
"children": []
|
|
8
|
+
},
|
|
9
|
+
"buildColGroup": {
|
|
10
|
+
"tagName": "col",
|
|
11
|
+
"attributes": {
|
|
12
|
+
"width": "${width}"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"buildHeader": {
|
|
16
|
+
"tagName": "th",
|
|
17
|
+
"textContent": "${columnName}",
|
|
18
|
+
"attributes": {
|
|
19
|
+
"class": "py-3 px-3 fw-semibold text-uppercase small"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"buildFooter": {
|
|
23
|
+
"tagName": "td",
|
|
24
|
+
"children": [
|
|
25
|
+
{
|
|
26
|
+
"tagName": "input",
|
|
27
|
+
"attributes": {
|
|
28
|
+
"type": "text",
|
|
29
|
+
"placeholder": "enter ${columnName}",
|
|
30
|
+
"name": "${columnName}",
|
|
31
|
+
"class": "form-control"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"buildBodyCell": {
|
|
37
|
+
"tagName": "td",
|
|
38
|
+
"textContent": "${rowValue}",
|
|
39
|
+
"attributes": {
|
|
40
|
+
"class": "py-3 px-3 text-secondary"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"button": {
|
|
44
|
+
"tagName": "button",
|
|
45
|
+
"textContent": "${columnName}",
|
|
46
|
+
"attributes": {
|
|
47
|
+
"class": "btn btn-primary btn-sm"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"buttonCell": {
|
|
51
|
+
"tagName": "td",
|
|
52
|
+
"attributes": {
|
|
53
|
+
"class": "py-2 px-3 text-center"
|
|
54
|
+
},
|
|
55
|
+
"children": [
|
|
56
|
+
{
|
|
57
|
+
"tagName": "button",
|
|
58
|
+
"textContent": "${agg:count}",
|
|
59
|
+
"attributes": {
|
|
60
|
+
"class": "btn btn-primary btn-sm"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
"buildOption": {
|
|
66
|
+
"tagName": "option",
|
|
67
|
+
"textContent": "${rowValue}",
|
|
68
|
+
"attributes": {
|
|
69
|
+
"value": "${rowValue}"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"buildSelect": {
|
|
73
|
+
"tagName": "select",
|
|
74
|
+
"attributes": {
|
|
75
|
+
"id": "LedgerName"
|
|
76
|
+
},
|
|
77
|
+
"children": []
|
|
78
|
+
},
|
|
79
|
+
"buildDataList": {
|
|
80
|
+
"tagName": "datalist",
|
|
81
|
+
"attributes": {
|
|
82
|
+
"data-name": "${columnName}"
|
|
83
|
+
},
|
|
84
|
+
"children": []
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import writePath from "../writePath/index.js";
|
|
2
|
+
|
|
3
|
+
const runDoubleInstruction = (instruction, registry, functions, spec) => {
|
|
4
|
+
const result = functions[instruction.func](
|
|
5
|
+
registry.data.columns,
|
|
6
|
+
registry.data.data,
|
|
7
|
+
spec
|
|
8
|
+
);
|
|
9
|
+
writePath(registry, instruction.destinationPath, result);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const runDoubleInstructions = (instructions, registry, functions, spec) => {
|
|
13
|
+
instructions.forEach(instruction => {
|
|
14
|
+
runDoubleInstruction(instruction, registry, functions, spec);
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { runDoubleInstruction, runDoubleInstructions };
|
|
19
|
+
export default runDoubleInstructions;
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
"tagName": "tfoot",
|
|
39
|
+
"attributes": {
|
|
40
|
+
"data-role": "table-footer"
|
|
41
|
+
},
|
|
42
|
+
"children": [
|
|
43
|
+
{
|
|
44
|
+
"tagName": "tr",
|
|
45
|
+
"attributes": {
|
|
46
|
+
"data-role": "table-footer-row"
|
|
47
|
+
},
|
|
48
|
+
"children": []
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import fromCollection from "json-transformer-funcs-one-dimension";
|
|
2
|
+
|
|
3
|
+
import spec from "../spec.json" with { type: "json" };
|
|
4
|
+
import base from "./base.json" with { type: "json" };
|
|
5
|
+
import singleInstructions from "./instructions/single.json" with { type: "json" };
|
|
6
|
+
|
|
7
|
+
import runSingleInstructions from "../singleInstruction/index.js";
|
|
8
|
+
|
|
9
|
+
const registry = { data: {}, base, spec };
|
|
10
|
+
const functions = { fromCollection };
|
|
11
|
+
|
|
12
|
+
const startFunc = data => {
|
|
13
|
+
registry.data = data;
|
|
14
|
+
runSingleInstructions(singleInstructions, registry, functions, spec);
|
|
15
|
+
return base;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default startFunc;
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
]
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"buildBodyTr": {
|
|
3
|
+
"tagName": "tr",
|
|
4
|
+
"attributes": {
|
|
5
|
+
"class": "align-middle"
|
|
6
|
+
},
|
|
7
|
+
"children": []
|
|
8
|
+
},
|
|
9
|
+
"buildColGroup": {
|
|
10
|
+
"tagName": "col",
|
|
11
|
+
"attributes": {
|
|
12
|
+
"width": "${width}"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"buildHeader": {
|
|
16
|
+
"tagName": "th",
|
|
17
|
+
"textContent": "${columnName}",
|
|
18
|
+
"attributes": {
|
|
19
|
+
"class": "py-3 px-3 fw-semibold text-uppercase small"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"buildFooter": {
|
|
23
|
+
"tagName": "td",
|
|
24
|
+
"children": [
|
|
25
|
+
{
|
|
26
|
+
"tagName": "input",
|
|
27
|
+
"attributes": {
|
|
28
|
+
"type": "text",
|
|
29
|
+
"placeholder": "enter ${columnName}",
|
|
30
|
+
"name": "${columnName}",
|
|
31
|
+
"class": "form-control"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"buildBodyCell": {
|
|
37
|
+
"tagName": "td",
|
|
38
|
+
"textContent": "${rowValue}",
|
|
39
|
+
"attributes": {
|
|
40
|
+
"class": "py-3 px-3 text-secondary"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"button": {
|
|
44
|
+
"tagName": "button",
|
|
45
|
+
"textContent": "${columnName}",
|
|
46
|
+
"attributes": {
|
|
47
|
+
"class": "btn btn-primary btn-sm"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"buttonCell": {
|
|
51
|
+
"tagName": "td",
|
|
52
|
+
"attributes": {
|
|
53
|
+
"class": "py-2 px-3 text-center"
|
|
54
|
+
},
|
|
55
|
+
"children": [
|
|
56
|
+
{
|
|
57
|
+
"tagName": "button",
|
|
58
|
+
"textContent": "${agg:count}",
|
|
59
|
+
"attributes": {
|
|
60
|
+
"class": "btn btn-primary btn-sm"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
"buildOption": {
|
|
66
|
+
"tagName": "option",
|
|
67
|
+
"textContent": "${rowValue}",
|
|
68
|
+
"attributes": {
|
|
69
|
+
"value": "${rowValue}"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"buildSelect": {
|
|
73
|
+
"tagName": "select",
|
|
74
|
+
"attributes": {
|
|
75
|
+
"id": "LedgerName"
|
|
76
|
+
},
|
|
77
|
+
"children": []
|
|
78
|
+
},
|
|
79
|
+
"buildDataList": {
|
|
80
|
+
"tagName": "datalist",
|
|
81
|
+
"attributes": {
|
|
82
|
+
"data-name": "${columnName}"
|
|
83
|
+
},
|
|
84
|
+
"children": []
|
|
85
|
+
}
|
|
86
|
+
}
|
package/src/v20/index.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
"tagName": "tfoot",
|
|
39
|
+
"attributes": {
|
|
40
|
+
"data-role": "table-footer"
|
|
41
|
+
},
|
|
42
|
+
"children": [
|
|
43
|
+
{
|
|
44
|
+
"tagName": "tr",
|
|
45
|
+
"attributes": {
|
|
46
|
+
"data-role": "table-footer-row"
|
|
47
|
+
},
|
|
48
|
+
"children": []
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
import doubleInstructions from "./instructions/double.json" with { type: "json" };
|
|
8
|
+
|
|
9
|
+
import runSingleInstructions from "../singleInstruction/index.js";
|
|
10
|
+
import runDoubleInstructions from "../doubleInstruction/index.js";
|
|
11
|
+
|
|
12
|
+
const registry = { data: {}, base, spec };
|
|
13
|
+
const functions = { fromCollection, twoDimensional };
|
|
14
|
+
|
|
15
|
+
const startFunc = data => {
|
|
16
|
+
registry.data = data;
|
|
17
|
+
runSingleInstructions(singleInstructions, registry, functions, spec);
|
|
18
|
+
runDoubleInstructions(doubleInstructions, registry, functions, spec);
|
|
19
|
+
return base;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
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,38 @@
|
|
|
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
|
+
]
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"buildBodyTr": {
|
|
3
|
+
"tagName": "tr",
|
|
4
|
+
"attributes": {
|
|
5
|
+
"class": "align-middle"
|
|
6
|
+
},
|
|
7
|
+
"children": []
|
|
8
|
+
},
|
|
9
|
+
"buildColGroup": {
|
|
10
|
+
"tagName": "col",
|
|
11
|
+
"attributes": {
|
|
12
|
+
"width": "${width}"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"buildHeader": {
|
|
16
|
+
"tagName": "th",
|
|
17
|
+
"textContent": "${columnName}",
|
|
18
|
+
"attributes": {
|
|
19
|
+
"class": "py-3 px-3 fw-semibold text-uppercase small"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"buildFooter": {
|
|
23
|
+
"tagName": "td",
|
|
24
|
+
"children": [
|
|
25
|
+
{
|
|
26
|
+
"tagName": "input",
|
|
27
|
+
"attributes": {
|
|
28
|
+
"type": "text",
|
|
29
|
+
"placeholder": "enter ${columnName}",
|
|
30
|
+
"name": "${columnName}",
|
|
31
|
+
"class": "form-control"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"buildBodyCell": {
|
|
37
|
+
"tagName": "td",
|
|
38
|
+
"textContent": "${rowValue}",
|
|
39
|
+
"attributes": {
|
|
40
|
+
"class": "py-3 px-3 text-secondary"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"button": {
|
|
44
|
+
"tagName": "button",
|
|
45
|
+
"textContent": "${columnName}",
|
|
46
|
+
"attributes": {
|
|
47
|
+
"class": "btn btn-primary btn-sm"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"buttonCell": {
|
|
51
|
+
"tagName": "td",
|
|
52
|
+
"attributes": {
|
|
53
|
+
"class": "py-2 px-3 text-center"
|
|
54
|
+
},
|
|
55
|
+
"children": [
|
|
56
|
+
{
|
|
57
|
+
"tagName": "button",
|
|
58
|
+
"textContent": "${agg:count}",
|
|
59
|
+
"attributes": {
|
|
60
|
+
"class": "btn btn-primary btn-sm"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
"buildOption": {
|
|
66
|
+
"tagName": "option",
|
|
67
|
+
"textContent": "${rowValue}",
|
|
68
|
+
"attributes": {
|
|
69
|
+
"value": "${rowValue}"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"buildSelect": {
|
|
73
|
+
"tagName": "select",
|
|
74
|
+
"attributes": {
|
|
75
|
+
"id": "LedgerName"
|
|
76
|
+
},
|
|
77
|
+
"children": []
|
|
78
|
+
},
|
|
79
|
+
"buildDataList": {
|
|
80
|
+
"tagName": "datalist",
|
|
81
|
+
"attributes": {
|
|
82
|
+
"data-name": "${columnName}"
|
|
83
|
+
},
|
|
84
|
+
"children": []
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { resolvePath } from "json-transformer-funcs";
|
|
2
|
+
import writePath from "../writePath/index.js";
|
|
3
|
+
|
|
4
|
+
const runSingleInstruction = (instruction, registry, functions, spec) => {
|
|
5
|
+
const source = resolvePath(registry, instruction.sourcePath);
|
|
6
|
+
const result = functions[instruction.func](source, spec[instruction.templateKey]);
|
|
7
|
+
writePath(registry, instruction.destinationPath, result);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const runSingleInstructions = (instructions, registry, functions, spec) => {
|
|
11
|
+
instructions.forEach(instruction => {
|
|
12
|
+
runSingleInstruction(instruction, registry, functions, spec);
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { runSingleInstruction, runSingleInstructions };
|
|
17
|
+
export default runSingleInstructions;
|