json-renderers-build-table 1.22.3 → 1.26.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 +2 -2
- package/src/index.js +2 -2
- package/src/{v21 → v23/builders}/bodyOnly/index.js +1 -1
- package/src/v23/builders/footerOnly/base.json +3 -0
- package/src/v23/builders/footerOnly/index.js +21 -0
- package/src/v23/builders/footerOnly/instructions/single.json +19 -0
- package/src/{v21 → v23/builders}/headerOnly/index.js +1 -1
- package/src/{v21 → v23/builders}/simple/index.js +2 -2
- package/src/{v17/simple → v23/builders}/spec.json +17 -0
- package/src/{v20/simple → v23/builders/withFooter}/index.js +7 -5
- package/src/v23/builders/withFooter/instructions/single.json +56 -0
- package/src/v23/builders/withOptions/index.js +51 -0
- package/src/v23/builders/withOptions/instructions/double.json +19 -0
- package/src/v23/builders/withOptions/instructions/postSingle.json +22 -0
- package/src/v23/builders/withOptions/instructions/single.json +78 -0
- package/src/v23/builders/withSerial/index.js +51 -0
- package/src/v23/builders/withSerial/instructions/double.json +19 -0
- package/src/v23/builders/withSerial/instructions/postSingle.json +22 -0
- package/src/v23/builders/withSerial/instructions/single.json +78 -0
- package/src/v23/index.js +34 -0
- package/src/{v21 → v23}/singleInstruction/index.js +14 -1
- package/src/v24/actions/index.js +5 -0
- package/src/v24/actions/insertOptions/index.js +47 -0
- package/src/v24/actions/insertOptions/instructions/footer.json +22 -0
- package/src/v24/actions/insertOptions/instructions/single.json +62 -0
- package/src/v24/actions/insertSerial/index.js +47 -0
- package/src/v24/actions/insertSerial/instructions/footer.json +22 -0
- package/src/v24/actions/insertSerial/instructions/single.json +62 -0
- package/src/{v20 → v24/builders}/bodyOnly/index.js +3 -3
- package/src/v24/builders/footerOnly/base.json +3 -0
- package/src/v24/builders/footerOnly/index.js +21 -0
- package/src/v24/builders/footerOnly/instructions/single.json +19 -0
- package/src/{v20 → v24/builders}/headerOnly/index.js +3 -3
- package/src/v24/builders/simple/index.js +49 -0
- package/src/{v18/headerOnly → v24/builders}/spec.json +21 -0
- package/src/v24/builders/withFooter/index.js +49 -0
- package/src/v24/builders/withFooter/instructions/single.json +56 -0
- package/src/{v20 → v24}/doubleInstruction/index.js +5 -3
- package/src/v24/guards/index.js +10 -0
- package/src/v24/guards/references/func/index.js +8 -0
- package/src/v24/guards/references/index.js +9 -0
- package/src/v24/guards/references/templateKey/index.js +8 -0
- package/src/v24/guards/structure/destinationPath/index.js +8 -0
- package/src/v24/guards/structure/func/index.js +8 -0
- package/src/v24/guards/structure/index.js +15 -0
- package/src/v24/guards/structure/sourcePath/index.js +8 -0
- package/src/v24/guards/structure/templateKey/index.js +9 -0
- package/src/v24/index.js +71 -0
- package/src/v24/singleInstruction/index.js +32 -0
- package/src/v25/actions/index.js +20 -0
- package/src/v25/actions/insertOptions/index.js +47 -0
- package/src/v25/actions/insertOptions/instructions/footer.json +22 -0
- package/src/v25/actions/insertOptions/instructions/single.json +62 -0
- package/src/v25/actions/insertSerial/index.js +47 -0
- package/src/v25/actions/insertSerial/instructions/footer.json +22 -0
- package/src/v25/actions/insertSerial/instructions/single.json +62 -0
- package/src/v25/builders/bodyOnly/index.js +18 -0
- package/src/v25/builders/footerOnly/base.json +3 -0
- package/src/v25/builders/footerOnly/index.js +21 -0
- package/src/v25/builders/footerOnly/instructions/single.json +19 -0
- package/src/v25/builders/headerOnly/index.js +18 -0
- package/src/v25/builders/simple/base.json +53 -0
- package/src/v25/builders/simple/index.js +40 -0
- package/src/{v18/bodyOnly → v25/builders}/spec.json +21 -0
- package/src/v25/builders/withFooter/base.json +53 -0
- package/src/v25/builders/withFooter/index.js +40 -0
- package/src/v25/builders/withFooter/instructions/double.json +19 -0
- package/src/v25/builders/withFooter/instructions/single.json +56 -0
- package/src/v25/doubleInstruction/index.js +21 -0
- package/src/v25/guards/index.js +10 -0
- package/src/v25/guards/references/func/index.js +8 -0
- package/src/v25/guards/references/index.js +9 -0
- package/src/v25/guards/references/templateKey/index.js +8 -0
- package/src/v25/guards/structure/destinationPath/index.js +8 -0
- package/src/v25/guards/structure/func/index.js +8 -0
- package/src/v25/guards/structure/index.js +15 -0
- package/src/v25/guards/structure/sourcePath/index.js +8 -0
- package/src/v25/guards/structure/templateKey/index.js +9 -0
- package/src/v25/index.js +21 -0
- package/src/v25/singleInstruction/index.js +32 -0
- package/src/v25/writePath/index.js +62 -0
- package/src/v26/actions/index.js +20 -0
- package/src/v26/actions/insertOptions/index.js +47 -0
- package/src/v26/actions/insertOptions/instructions/footer.json +22 -0
- package/src/v26/actions/insertOptions/instructions/single.json +62 -0
- package/src/v26/actions/insertSerial/index.js +47 -0
- package/src/v26/actions/insertSerial/instructions/footer.json +22 -0
- package/src/v26/actions/insertSerial/instructions/single.json +62 -0
- package/src/v26/builders/bodyOnly/base.json +1 -0
- package/src/v26/builders/bodyOnly/index.js +18 -0
- package/src/v26/builders/footerOnly/base.json +3 -0
- package/src/v26/builders/footerOnly/index.js +21 -0
- package/src/v26/builders/footerOnly/instructions/single.json +19 -0
- package/src/v26/builders/headerOnly/base.json +53 -0
- package/src/v26/builders/headerOnly/index.js +18 -0
- package/src/v26/builders/simple/base.json +53 -0
- package/src/v26/builders/simple/index.js +40 -0
- package/src/v26/builders/simple/instructions/double.json +19 -0
- package/src/{v17 → v26/builders}/spec.json +21 -0
- package/src/v26/builders/withFooter/base.json +53 -0
- package/src/v26/builders/withFooter/index.js +40 -0
- package/src/v26/builders/withFooter/instructions/double.json +19 -0
- package/src/v26/builders/withFooter/instructions/single.json +56 -0
- package/src/v26/doubleInstruction/index.js +21 -0
- package/src/v26/guards/index.js +10 -0
- package/src/v26/guards/references/func/index.js +8 -0
- package/src/v26/guards/references/index.js +9 -0
- package/src/v26/guards/references/templateKey/index.js +8 -0
- package/src/v26/guards/structure/destinationPath/index.js +8 -0
- package/src/v26/guards/structure/func/index.js +8 -0
- package/src/v26/guards/structure/index.js +15 -0
- package/src/v26/guards/structure/sourcePath/index.js +8 -0
- package/src/v26/guards/structure/templateKey/index.js +9 -0
- package/src/v26/index.js +21 -0
- package/src/v26/singleInstruction/index.js +32 -0
- package/src/v26/writePath/index.js +62 -0
- package/src/v17/index.js +0 -5
- package/src/v17/simple/index.js +0 -56
- package/src/v17/simple/writePath/index.js +0 -47
- package/src/v18/bodyOnly/base.json +0 -1
- package/src/v18/bodyOnly/index.js +0 -36
- package/src/v18/bodyOnly/writePath/index.js +0 -47
- package/src/v18/headerOnly/index.js +0 -42
- package/src/v18/headerOnly/writePath/index.js +0 -47
- package/src/v18/index.js +0 -5
- package/src/v18/simple/index.js +0 -57
- package/src/v18/simple/spec.json +0 -86
- package/src/v18/simple/writePath/index.js +0 -47
- package/src/v18/spec.json +0 -86
- package/src/v19/bodyOnly/index.js +0 -36
- package/src/v19/bodyOnly/spec.json +0 -86
- package/src/v19/headerOnly/index.js +0 -42
- package/src/v19/headerOnly/spec.json +0 -86
- package/src/v19/index.js +0 -5
- package/src/v19/simple/index.js +0 -57
- package/src/v19/simple/spec.json +0 -86
- package/src/v19/spec.json +0 -86
- package/src/v19/writePath/index.js +0 -47
- package/src/v20/bodyOnly/spec.json +0 -86
- package/src/v20/headerOnly/spec.json +0 -86
- package/src/v20/index.js +0 -5
- package/src/v20/simple/spec.json +0 -86
- package/src/v20/singleInstruction/index.js +0 -17
- package/src/v20/spec.json +0 -86
- package/src/v21/bodyOnly/spec.json +0 -86
- package/src/v21/headerOnly/spec.json +0 -86
- package/src/v21/index.js +0 -5
- package/src/v21/simple/instructions/single.json +0 -38
- package/src/v21/simple/spec.json +0 -86
- package/src/v21/spec.json +0 -86
- /package/src/{v19 → v23/builders}/bodyOnly/base.json +0 -0
- /package/src/{v18 → v23/builders}/bodyOnly/instructions/double.json +0 -0
- /package/src/{v17/simple → v23/builders/headerOnly}/base.json +0 -0
- /package/src/{v17/simple → v23/builders/headerOnly}/instructions/single.json +0 -0
- /package/src/{v18/headerOnly → v23/builders/simple}/base.json +0 -0
- /package/src/{v17 → v23/builders}/simple/instructions/double.json +0 -0
- /package/src/{v18/headerOnly → v23/builders/simple}/instructions/single.json +0 -0
- /package/src/{v18/simple → v23/builders/withFooter}/base.json +0 -0
- /package/src/{v18/simple → v23/builders/withFooter}/instructions/double.json +0 -0
- /package/src/{v19/headerOnly → v23/builders/withOptions}/base.json +0 -0
- /package/src/{v19/simple → v23/builders/withSerial}/base.json +0 -0
- /package/src/{v21 → v23}/doubleInstruction/index.js +0 -0
- /package/src/{v21 → v23}/guards/index.js +0 -0
- /package/src/{v21 → v23}/guards/references/func/index.js +0 -0
- /package/src/{v21 → v23}/guards/references/index.js +0 -0
- /package/src/{v21 → v23}/guards/references/templateKey/index.js +0 -0
- /package/src/{v21 → v23}/guards/structure/destinationPath/index.js +0 -0
- /package/src/{v21 → v23}/guards/structure/func/index.js +0 -0
- /package/src/{v21 → v23}/guards/structure/index.js +0 -0
- /package/src/{v21 → v23}/guards/structure/sourcePath/index.js +0 -0
- /package/src/{v21 → v23}/guards/structure/templateKey/index.js +0 -0
- /package/src/{v20 → v23}/writePath/index.js +0 -0
- /package/src/{v20 → v24/builders}/bodyOnly/base.json +0 -0
- /package/src/{v19 → v24/builders}/bodyOnly/instructions/double.json +0 -0
- /package/src/{v20 → v24/builders}/headerOnly/base.json +0 -0
- /package/src/{v18/simple → v24/builders/headerOnly}/instructions/single.json +0 -0
- /package/src/{v20 → v24/builders}/simple/base.json +0 -0
- /package/src/{v19 → v24/builders}/simple/instructions/double.json +0 -0
- /package/src/{v19/headerOnly → v24/builders/simple}/instructions/single.json +0 -0
- /package/src/{v21/headerOnly → v24/builders/withFooter}/base.json +0 -0
- /package/src/{v20/simple → v24/builders/withFooter}/instructions/double.json +0 -0
- /package/src/{v21 → v24}/writePath/index.js +0 -0
- /package/src/{v21 → v25/builders}/bodyOnly/base.json +0 -0
- /package/src/{v20 → v25/builders}/bodyOnly/instructions/double.json +0 -0
- /package/src/{v21/simple → v25/builders/headerOnly}/base.json +0 -0
- /package/src/{v19/simple → v25/builders/headerOnly}/instructions/single.json +0 -0
- /package/src/{v21 → v25/builders}/simple/instructions/double.json +0 -0
- /package/src/{v20/headerOnly → v25/builders/simple}/instructions/single.json +0 -0
- /package/src/{v21 → v26/builders}/bodyOnly/instructions/double.json +0 -0
- /package/src/{v20/simple → v26/builders/headerOnly}/instructions/single.json +0 -0
- /package/src/{v21/headerOnly → v26/builders/simple}/instructions/single.json +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const checkTemplateKey = (instruction, showLog, returnLog) => {
|
|
2
|
+
const passed = instruction.templateKey === undefined ||
|
|
3
|
+
(typeof instruction.templateKey === "string" && instruction.templateKey.length > 0);
|
|
4
|
+
const message = `structure/templateKey: ${passed ? "passed" : "failed"}`;
|
|
5
|
+
returnLog.push(message);
|
|
6
|
+
if (showLog) console.log(message);
|
|
7
|
+
return passed;
|
|
8
|
+
};
|
|
9
|
+
export default checkTemplateKey;
|
package/src/v24/index.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import simple from "./builders/simple/index.js";
|
|
2
|
+
import headerOnly from "./builders/headerOnly/index.js";
|
|
3
|
+
import bodyOnly from "./builders/bodyOnly/index.js";
|
|
4
|
+
import withFooter from "./builders/withFooter/index.js";
|
|
5
|
+
import footerOnly from "./builders/footerOnly/index.js";
|
|
6
|
+
|
|
7
|
+
import insertSerial from "./actions/insertSerial/index.js";
|
|
8
|
+
import insertOptions from "./actions/insertOptions/index.js";
|
|
9
|
+
import actions from "./actions/index.js";
|
|
10
|
+
|
|
11
|
+
const withSerial = (inConfig = {}, showLog = false, returnLog = []) => {
|
|
12
|
+
const localConfig = (inConfig && typeof inConfig === "object" && "inConfig" in inConfig)
|
|
13
|
+
? inConfig.inConfig
|
|
14
|
+
: inConfig;
|
|
15
|
+
|
|
16
|
+
return simple({
|
|
17
|
+
...localConfig,
|
|
18
|
+
options: {
|
|
19
|
+
showSerial: true,
|
|
20
|
+
serial: localConfig.serial || localConfig.inSerial,
|
|
21
|
+
...(localConfig.options || localConfig.inOptions)
|
|
22
|
+
}
|
|
23
|
+
}, showLog, returnLog);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const withOptions = (inConfig = {}, showLog = false, returnLog = []) => {
|
|
27
|
+
const localConfig = (inConfig && typeof inConfig === "object" && "inConfig" in inConfig)
|
|
28
|
+
? inConfig.inConfig
|
|
29
|
+
: inConfig;
|
|
30
|
+
|
|
31
|
+
return simple({
|
|
32
|
+
...localConfig,
|
|
33
|
+
options: {
|
|
34
|
+
showOptions: true,
|
|
35
|
+
options: localConfig.options || localConfig.inOptions
|
|
36
|
+
}
|
|
37
|
+
}, showLog, returnLog);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const tableWithSerial = withSerial;
|
|
41
|
+
const tableWithOptions = withOptions;
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
simple,
|
|
45
|
+
headerOnly,
|
|
46
|
+
bodyOnly,
|
|
47
|
+
withFooter,
|
|
48
|
+
footerOnly,
|
|
49
|
+
insertSerial,
|
|
50
|
+
insertOptions,
|
|
51
|
+
actions,
|
|
52
|
+
withSerial,
|
|
53
|
+
withOptions,
|
|
54
|
+
tableWithSerial,
|
|
55
|
+
tableWithOptions
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export default {
|
|
59
|
+
simple,
|
|
60
|
+
headerOnly,
|
|
61
|
+
bodyOnly,
|
|
62
|
+
withFooter,
|
|
63
|
+
footerOnly,
|
|
64
|
+
insertSerial,
|
|
65
|
+
insertOptions,
|
|
66
|
+
actions,
|
|
67
|
+
withSerial,
|
|
68
|
+
withOptions,
|
|
69
|
+
tableWithSerial,
|
|
70
|
+
tableWithOptions
|
|
71
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { resolvePath } from "json-transformer-funcs";
|
|
2
|
+
import writePath from "../writePath/index.js";
|
|
3
|
+
import checkInstruction from "../guards/index.js";
|
|
4
|
+
|
|
5
|
+
const runSingleInstruction = (instruction, registry, functions, spec, showLog, returnLog) => {
|
|
6
|
+
if (!checkInstruction(instruction, functions, spec, showLog, returnLog)) return;
|
|
7
|
+
|
|
8
|
+
const localSpec = spec;
|
|
9
|
+
const templateKey = instruction.templateKey;
|
|
10
|
+
const localSpecKey = localSpec[templateKey];
|
|
11
|
+
|
|
12
|
+
console.log("templateKey ; ", templateKey);
|
|
13
|
+
console.log("localSpecKey ; ", localSpecKey);
|
|
14
|
+
|
|
15
|
+
const source = resolvePath(registry, instruction.sourcePath);
|
|
16
|
+
const result = functions[instruction.func](source, localSpecKey);
|
|
17
|
+
|
|
18
|
+
if (templateKey === "buildFooter") {
|
|
19
|
+
console.log("result ; ", result);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
writePath(registry, instruction.destinationPath, result);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const runSingleInstructions = (instructions, registry, functions, spec, showLog, returnLog) => {
|
|
26
|
+
instructions.forEach(instruction => {
|
|
27
|
+
runSingleInstruction(instruction, registry, functions, spec, showLog, returnLog);
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { runSingleInstruction, runSingleInstructions };
|
|
32
|
+
export default runSingleInstructions;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import insertSerial from "./insertSerial/index.js";
|
|
2
|
+
import insertOptions from "./insertOptions/index.js";
|
|
3
|
+
|
|
4
|
+
const startFunc = ({ inOptions = {}, inBase, showLog = false, returnLog = [] }) => {
|
|
5
|
+
const localOptions = inOptions;
|
|
6
|
+
|
|
7
|
+
const localBase = inBase;
|
|
8
|
+
|
|
9
|
+
if (localOptions.showSerial || localOptions.serial) {
|
|
10
|
+
insertSerial(localBase, localOptions.serial || {}, showLog, returnLog);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (localOptions.showOptions || localOptions.options) {
|
|
14
|
+
insertOptions(localBase, localOptions.options || {}, showLog, returnLog);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return localBase;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default startFunc;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import applyTemplate from "json-transformer-funcs-primitive";
|
|
2
|
+
import { findByRole } from "json-transformer-funcs";
|
|
3
|
+
|
|
4
|
+
import spec from "../../builders/spec.json" with { type: "json" };
|
|
5
|
+
import singleInstructions from "./instructions/single.json" with { type: "json" };
|
|
6
|
+
import footerInstructions from "./instructions/footer.json" with { type: "json" };
|
|
7
|
+
|
|
8
|
+
import runSingleInstructions from "../../singleInstruction/index.js";
|
|
9
|
+
|
|
10
|
+
const functions = { applyTemplate };
|
|
11
|
+
|
|
12
|
+
const insertOptions = (input = {}, config = {}, showLog = false, returnLog = []) => {
|
|
13
|
+
let localTableSpec = input;
|
|
14
|
+
let localOptions = config;
|
|
15
|
+
|
|
16
|
+
if (input && typeof input === "object" && "inTableSpec" in input) {
|
|
17
|
+
localTableSpec = input.inTableSpec;
|
|
18
|
+
localOptions = input.inOptions || config;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const localOptionsMerged = {
|
|
22
|
+
col: { width: "100px" },
|
|
23
|
+
header: { columnName: "options" },
|
|
24
|
+
body: { columnName: "show" },
|
|
25
|
+
footer: {},
|
|
26
|
+
...localOptions
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const registry = {
|
|
30
|
+
data: {
|
|
31
|
+
options: localOptionsMerged
|
|
32
|
+
},
|
|
33
|
+
base: localTableSpec,
|
|
34
|
+
spec
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
runSingleInstructions(singleInstructions, registry, functions, spec, showLog, returnLog);
|
|
38
|
+
|
|
39
|
+
const footerRow = findByRole(localTableSpec, "table-footer-row");
|
|
40
|
+
if (footerRow && Array.isArray(footerRow.children) && footerRow.children.length > 0) {
|
|
41
|
+
runSingleInstructions(footerInstructions, registry, functions, spec, showLog, returnLog);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return localTableSpec;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default insertOptions;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"narration": "Append an empty cell into the table footer row if footer row is present.",
|
|
4
|
+
"destinationPath": {
|
|
5
|
+
"fileName": "base",
|
|
6
|
+
"dataRole": "table-footer-row",
|
|
7
|
+
"filePath": [
|
|
8
|
+
"children"
|
|
9
|
+
],
|
|
10
|
+
"action": "push"
|
|
11
|
+
},
|
|
12
|
+
"sourcePath": {
|
|
13
|
+
"fileName": "data",
|
|
14
|
+
"filePath": [
|
|
15
|
+
"options",
|
|
16
|
+
"footer"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"templateKey": "emptyCell",
|
|
20
|
+
"func": "applyTemplate"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"narration": "Append the options column width to the table colgroup.",
|
|
4
|
+
"destinationPath": {
|
|
5
|
+
"fileName": "base",
|
|
6
|
+
"dataRole": "table-colgroup",
|
|
7
|
+
"filePath": [
|
|
8
|
+
"children"
|
|
9
|
+
],
|
|
10
|
+
"action": "push"
|
|
11
|
+
},
|
|
12
|
+
"sourcePath": {
|
|
13
|
+
"fileName": "data",
|
|
14
|
+
"filePath": [
|
|
15
|
+
"options",
|
|
16
|
+
"col"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"templateKey": "buildColGroup",
|
|
20
|
+
"func": "applyTemplate"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"narration": "Append the options header cell to the table header row.",
|
|
24
|
+
"destinationPath": {
|
|
25
|
+
"fileName": "base",
|
|
26
|
+
"dataRole": "table-header-row",
|
|
27
|
+
"filePath": [
|
|
28
|
+
"children"
|
|
29
|
+
],
|
|
30
|
+
"action": "push"
|
|
31
|
+
},
|
|
32
|
+
"sourcePath": {
|
|
33
|
+
"fileName": "data",
|
|
34
|
+
"filePath": [
|
|
35
|
+
"options",
|
|
36
|
+
"header"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
"templateKey": "buildHeader",
|
|
40
|
+
"func": "applyTemplate"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"narration": "Append the options button cell into each table body row.",
|
|
44
|
+
"destinationPath": {
|
|
45
|
+
"fileName": "base",
|
|
46
|
+
"dataRole": "table-body",
|
|
47
|
+
"filePath": [
|
|
48
|
+
"children"
|
|
49
|
+
],
|
|
50
|
+
"action": "pushToRows"
|
|
51
|
+
},
|
|
52
|
+
"sourcePath": {
|
|
53
|
+
"fileName": "data",
|
|
54
|
+
"filePath": [
|
|
55
|
+
"options",
|
|
56
|
+
"body"
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
"templateKey": "optionsButtonCell",
|
|
60
|
+
"func": "applyTemplate"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import applyTemplate from "json-transformer-funcs-primitive";
|
|
2
|
+
import { findByRole } from "json-transformer-funcs";
|
|
3
|
+
|
|
4
|
+
import spec from "../../builders/spec.json" with { type: "json" };
|
|
5
|
+
import singleInstructions from "./instructions/single.json" with { type: "json" };
|
|
6
|
+
import footerInstructions from "./instructions/footer.json" with { type: "json" };
|
|
7
|
+
|
|
8
|
+
import runSingleInstructions from "../../singleInstruction/index.js";
|
|
9
|
+
|
|
10
|
+
const functions = { applyTemplate };
|
|
11
|
+
|
|
12
|
+
const insertSerial = (input = {}, config = {}, showLog = false, returnLog = []) => {
|
|
13
|
+
let localTableSpec = input;
|
|
14
|
+
let localSerial = config;
|
|
15
|
+
|
|
16
|
+
if (input && typeof input === "object" && "inTableSpec" in input) {
|
|
17
|
+
localTableSpec = input.inTableSpec;
|
|
18
|
+
localSerial = input.inSerial || config;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const localSerialMerged = {
|
|
22
|
+
col: { width: "50px" },
|
|
23
|
+
header: { columnName: "#" },
|
|
24
|
+
body: {},
|
|
25
|
+
footer: {},
|
|
26
|
+
...localSerial
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const registry = {
|
|
30
|
+
data: {
|
|
31
|
+
serial: localSerialMerged
|
|
32
|
+
},
|
|
33
|
+
base: localTableSpec,
|
|
34
|
+
spec
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
runSingleInstructions(singleInstructions, registry, functions, spec, showLog, returnLog);
|
|
38
|
+
|
|
39
|
+
const footerRow = findByRole(localTableSpec, "table-footer-row");
|
|
40
|
+
if (footerRow && Array.isArray(footerRow.children) && footerRow.children.length > 0) {
|
|
41
|
+
runSingleInstructions(footerInstructions, registry, functions, spec, showLog, returnLog);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return localTableSpec;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default insertSerial;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"narration": "Prepend an empty cell into the table footer row if footer row is present.",
|
|
4
|
+
"destinationPath": {
|
|
5
|
+
"fileName": "base",
|
|
6
|
+
"dataRole": "table-footer-row",
|
|
7
|
+
"filePath": [
|
|
8
|
+
"children"
|
|
9
|
+
],
|
|
10
|
+
"action": "unshift"
|
|
11
|
+
},
|
|
12
|
+
"sourcePath": {
|
|
13
|
+
"fileName": "data",
|
|
14
|
+
"filePath": [
|
|
15
|
+
"serial",
|
|
16
|
+
"footer"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"templateKey": "emptyCell",
|
|
20
|
+
"func": "applyTemplate"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"narration": "Prepend the serial column width to the table colgroup.",
|
|
4
|
+
"destinationPath": {
|
|
5
|
+
"fileName": "base",
|
|
6
|
+
"dataRole": "table-colgroup",
|
|
7
|
+
"filePath": [
|
|
8
|
+
"children"
|
|
9
|
+
],
|
|
10
|
+
"action": "unshift"
|
|
11
|
+
},
|
|
12
|
+
"sourcePath": {
|
|
13
|
+
"fileName": "data",
|
|
14
|
+
"filePath": [
|
|
15
|
+
"serial",
|
|
16
|
+
"col"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"templateKey": "buildColGroup",
|
|
20
|
+
"func": "applyTemplate"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"narration": "Prepend the serial header cell to the table header row.",
|
|
24
|
+
"destinationPath": {
|
|
25
|
+
"fileName": "base",
|
|
26
|
+
"dataRole": "table-header-row",
|
|
27
|
+
"filePath": [
|
|
28
|
+
"children"
|
|
29
|
+
],
|
|
30
|
+
"action": "unshift"
|
|
31
|
+
},
|
|
32
|
+
"sourcePath": {
|
|
33
|
+
"fileName": "data",
|
|
34
|
+
"filePath": [
|
|
35
|
+
"serial",
|
|
36
|
+
"header"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
"templateKey": "buildHeader",
|
|
40
|
+
"func": "applyTemplate"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"narration": "Prepend the serial number cell into each table body row.",
|
|
44
|
+
"destinationPath": {
|
|
45
|
+
"fileName": "base",
|
|
46
|
+
"dataRole": "table-body",
|
|
47
|
+
"filePath": [
|
|
48
|
+
"children"
|
|
49
|
+
],
|
|
50
|
+
"action": "unshiftSerialToRows"
|
|
51
|
+
},
|
|
52
|
+
"sourcePath": {
|
|
53
|
+
"fileName": "data",
|
|
54
|
+
"filePath": [
|
|
55
|
+
"serial",
|
|
56
|
+
"body"
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
"templateKey": "buildBodyCell",
|
|
60
|
+
"func": "applyTemplate"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
@@ -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, showLog = false, returnLog = []) => {
|
|
13
|
+
registry.data = data;
|
|
14
|
+
runDoubleInstructions(doubleInstructions, registry, functions, spec, showLog, returnLog);
|
|
15
|
+
return base.children;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default startFunc;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import fromCollection from "json-transformer-funcs-one-dimension";
|
|
2
|
+
import twoDimensional from "json-transformer-funcs-two-dimensions";
|
|
3
|
+
|
|
4
|
+
import spec from "../spec.json" with { type: "json" };
|
|
5
|
+
import base from "./base.json" with { type: "json" };
|
|
6
|
+
import singleInstructions from "./instructions/single.json" with { type: "json" };
|
|
7
|
+
|
|
8
|
+
import runSingleInstructions from "../../singleInstruction/index.js";
|
|
9
|
+
|
|
10
|
+
const registry = { data: {}, base, spec };
|
|
11
|
+
const functions = { fromCollection, twoDimensional };
|
|
12
|
+
|
|
13
|
+
const startFunc = (data, showLog = false, returnLog = []) => {
|
|
14
|
+
registry.data = data;
|
|
15
|
+
|
|
16
|
+
runSingleInstructions(singleInstructions, registry, functions, spec, showLog, returnLog);
|
|
17
|
+
|
|
18
|
+
return base?.children;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default startFunc;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"narration": "Build the footer row for the table using the configured columns.",
|
|
4
|
+
"destinationPath": {
|
|
5
|
+
"fileName": "base",
|
|
6
|
+
"filePath": [
|
|
7
|
+
"children"
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
"sourcePath": {
|
|
11
|
+
"fileName": "data",
|
|
12
|
+
"filePath": [
|
|
13
|
+
"columns"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"templateKey": "buildFooter",
|
|
17
|
+
"func": "fromCollection"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
@@ -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, showLog = false, returnLog = []) => {
|
|
13
|
+
registry.data = data;
|
|
14
|
+
runSingleInstructions(singleInstructions, registry, functions, spec, showLog, returnLog);
|
|
15
|
+
return base;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default startFunc;
|
|
@@ -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,40 @@
|
|
|
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
|
+
import actions from "../../actions/index.js";
|
|
12
|
+
|
|
13
|
+
const functions = { fromCollection, twoDimensional };
|
|
14
|
+
|
|
15
|
+
const startFunc = (inConfig = {}, showLog = false, returnLog = []) => {
|
|
16
|
+
const localConfig = inConfig;
|
|
17
|
+
|
|
18
|
+
const localColumns = localConfig.columns || [];
|
|
19
|
+
const localData = localConfig.data || [];
|
|
20
|
+
const localOptions = localConfig.options
|
|
21
|
+
|
|
22
|
+
const localBase = structuredClone(base);
|
|
23
|
+
const registry = {
|
|
24
|
+
data: {
|
|
25
|
+
columns: localColumns,
|
|
26
|
+
data: localData
|
|
27
|
+
},
|
|
28
|
+
base: localBase,
|
|
29
|
+
spec
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
runSingleInstructions(singleInstructions, registry, functions, spec, showLog, returnLog);
|
|
33
|
+
runDoubleInstructions(doubleInstructions, registry, functions, spec, showLog, returnLog);
|
|
34
|
+
|
|
35
|
+
actions({ inOptions: localOptions, inBase: localBase });
|
|
36
|
+
|
|
37
|
+
return localBase;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default startFunc;
|
|
@@ -28,6 +28,8 @@
|
|
|
28
28
|
"type": "text",
|
|
29
29
|
"placeholder": "enter ${columnName}",
|
|
30
30
|
"name": "${columnName}",
|
|
31
|
+
"id": "${columnName}",
|
|
32
|
+
"list": "${columnName}",
|
|
31
33
|
"class": "form-control"
|
|
32
34
|
}
|
|
33
35
|
}
|
|
@@ -62,6 +64,21 @@
|
|
|
62
64
|
}
|
|
63
65
|
]
|
|
64
66
|
},
|
|
67
|
+
"optionsButtonCell": {
|
|
68
|
+
"tagName": "td",
|
|
69
|
+
"attributes": {
|
|
70
|
+
"class": "py-2 px-3 text-center"
|
|
71
|
+
},
|
|
72
|
+
"children": [
|
|
73
|
+
{
|
|
74
|
+
"tagName": "button",
|
|
75
|
+
"textContent": "${columnName}",
|
|
76
|
+
"attributes": {
|
|
77
|
+
"class": "btn btn-primary btn-sm"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
},
|
|
65
82
|
"buildOption": {
|
|
66
83
|
"tagName": "option",
|
|
67
84
|
"textContent": "${rowValue}",
|
|
@@ -82,5 +99,9 @@
|
|
|
82
99
|
"data-name": "${columnName}"
|
|
83
100
|
},
|
|
84
101
|
"children": []
|
|
102
|
+
},
|
|
103
|
+
"emptyCell": {
|
|
104
|
+
"tagName": "td",
|
|
105
|
+
"children": []
|
|
85
106
|
}
|
|
86
107
|
}
|
|
@@ -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
|
+
}
|