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,147 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
fromCollection, tableBody, buildBody,
|
|
3
|
-
findByRole, resolvePath, applyTemplate
|
|
4
|
-
} from "json-transformer-funcs";
|
|
5
|
-
|
|
6
|
-
import spec from "../spec.json" with { type: "json" };
|
|
7
|
-
import base from "./config/base.json" with { type: "json" };
|
|
8
|
-
|
|
9
|
-
import columnInstructions from "./config/columnInstructions.json" with { type: "json" };
|
|
10
|
-
import rowInstructions from "./config/rowInstructions.json" with { type: "json" };
|
|
11
|
-
import serialInstructions from "./config/serialInstructions.json" with { type: "json" };
|
|
12
|
-
import optionsInstructions from "./config/optionsInstructions.json" with { type: "json" };
|
|
13
|
-
|
|
14
|
-
import writePath from "./writePath/index.js";
|
|
15
|
-
|
|
16
|
-
const functions = {
|
|
17
|
-
fromCollection,
|
|
18
|
-
tableBody,
|
|
19
|
-
buildBody,
|
|
20
|
-
applyTemplate: (inSource, inTemplate) => applyTemplate(inTemplate, inSource)
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const runInstructions = ({ inInstructions, inRegistry }) => {
|
|
24
|
-
const localInstructions = inInstructions;
|
|
25
|
-
const localRegistry = inRegistry;
|
|
26
|
-
|
|
27
|
-
localInstructions.forEach(instruction => {
|
|
28
|
-
const source = resolvePath(localRegistry, instruction.sourcePath);
|
|
29
|
-
|
|
30
|
-
if (source) {
|
|
31
|
-
const result = functions[instruction.func](source, localRegistry.spec[instruction.templateKey]);
|
|
32
|
-
writePath({
|
|
33
|
-
inRegistry: localRegistry,
|
|
34
|
-
inPath: instruction.destinationPath,
|
|
35
|
-
inValue: result
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const buildSpec = ({ inConfig }) => {
|
|
42
|
-
const localConfig = inConfig;
|
|
43
|
-
|
|
44
|
-
const localBase = structuredClone(base);
|
|
45
|
-
const localSpec = structuredClone(spec);
|
|
46
|
-
|
|
47
|
-
// Determine whether to render the footer
|
|
48
|
-
const hasFooterDisabled = localConfig?.options?.showFooter === false
|
|
49
|
-
|| localConfig?.options?.footer === false
|
|
50
|
-
|| localConfig?.showFooter === false
|
|
51
|
-
|| localConfig?.footer === false;
|
|
52
|
-
const showFooter = !hasFooterDisabled;
|
|
53
|
-
|
|
54
|
-
if (!showFooter) {
|
|
55
|
-
localBase.children = localBase.children.filter(child => child.tagName !== "tfoot");
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Default template.bodyCell to buildBodyCell if omitted
|
|
59
|
-
const normalizedColumns = (localConfig?.columns || []).map(col => {
|
|
60
|
-
const colCopy = structuredClone(col);
|
|
61
|
-
colCopy.template = {
|
|
62
|
-
bodyCell: "buildBodyCell",
|
|
63
|
-
...(colCopy.template || {})
|
|
64
|
-
};
|
|
65
|
-
return colCopy;
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
// Support explicit serial object or options.showSerial boolean
|
|
69
|
-
const hasSerial = Boolean(localConfig?.serial || localConfig?.options?.showSerial);
|
|
70
|
-
const serialConfig = localConfig?.serial || (hasSerial ? {
|
|
71
|
-
col: { width: "50px" },
|
|
72
|
-
header: { columnName: "#" },
|
|
73
|
-
body: {},
|
|
74
|
-
footer: {}
|
|
75
|
-
} : null);
|
|
76
|
-
|
|
77
|
-
const buildData = {
|
|
78
|
-
...localConfig,
|
|
79
|
-
columns: normalizedColumns,
|
|
80
|
-
...(serialConfig ? { serial: serialConfig } : {})
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const registry = {
|
|
84
|
-
data: buildData,
|
|
85
|
-
base: localBase,
|
|
86
|
-
spec: localSpec
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
// 1. Build row containers in tbody
|
|
90
|
-
runInstructions({
|
|
91
|
-
inInstructions: rowInstructions,
|
|
92
|
-
inRegistry: registry
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
// 2. Build column group, header, and optional footer
|
|
96
|
-
const activeColumnInstructions = showFooter
|
|
97
|
-
? columnInstructions
|
|
98
|
-
: columnInstructions.filter(inst => inst.templateKey !== "buildFooter");
|
|
99
|
-
|
|
100
|
-
runInstructions({
|
|
101
|
-
inInstructions: activeColumnInstructions,
|
|
102
|
-
inRegistry: registry
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
// 3. Build body cells for each row
|
|
106
|
-
const tbodyElement = findByRole(localBase, "table-body");
|
|
107
|
-
if (tbodyElement && Array.isArray(tbodyElement.children)) {
|
|
108
|
-
buildBody(tbodyElement.children, buildData, localSpec);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// 4. Optional serial column
|
|
112
|
-
if (serialConfig) {
|
|
113
|
-
const activeSerialInstructions = showFooter
|
|
114
|
-
? serialInstructions
|
|
115
|
-
: serialInstructions.filter(inst => inst.destinationPath?.dataRole !== "table-footer-row");
|
|
116
|
-
|
|
117
|
-
runInstructions({
|
|
118
|
-
inInstructions: activeSerialInstructions,
|
|
119
|
-
inRegistry: registry
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// 5. Optional action/options column
|
|
124
|
-
if (localConfig?.options && typeof localConfig.options === "object" && localConfig.options.header) {
|
|
125
|
-
const activeOptionsInstructions = showFooter
|
|
126
|
-
? optionsInstructions
|
|
127
|
-
: optionsInstructions.filter(inst => inst.destinationPath?.dataRole !== "table-footer-row");
|
|
128
|
-
|
|
129
|
-
runInstructions({
|
|
130
|
-
inInstructions: activeOptionsInstructions,
|
|
131
|
-
inRegistry: registry
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return localBase;
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
// Wrapper supporting both { inConfig } and direct object argument
|
|
139
|
-
const startFunc = (input) => {
|
|
140
|
-
const localInput = (input && typeof input === "object" && "inConfig" in input)
|
|
141
|
-
? input.inConfig
|
|
142
|
-
: input;
|
|
143
|
-
|
|
144
|
-
return buildSpec({ inConfig: localInput });
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
export default startFunc;
|
package/src/v15/common/runner.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
fromCollection, tableBody, buildBody,
|
|
3
|
-
findByRole, resolvePath, applyTemplate
|
|
4
|
-
} from "json-transformer-funcs";
|
|
5
|
-
import writePath from "./writePath.js";
|
|
6
|
-
|
|
7
|
-
const functions = {
|
|
8
|
-
fromCollection,
|
|
9
|
-
tableBody,
|
|
10
|
-
buildBody,
|
|
11
|
-
applyTemplate: (inSource, inTemplate) => applyTemplate(inTemplate, inSource)
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const runInstructions = ({ inInstructions, inRegistry }) => {
|
|
15
|
-
const localInstructions = inInstructions;
|
|
16
|
-
const localRegistry = inRegistry;
|
|
17
|
-
|
|
18
|
-
localInstructions.forEach(instruction => {
|
|
19
|
-
const source = resolvePath(localRegistry, instruction.sourcePath);
|
|
20
|
-
|
|
21
|
-
if (source) {
|
|
22
|
-
const result = functions[instruction.func](source, localRegistry.spec[instruction.templateKey]);
|
|
23
|
-
writePath({
|
|
24
|
-
inRegistry: localRegistry,
|
|
25
|
-
inPath: instruction.destinationPath,
|
|
26
|
-
inValue: result
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export { findByRole, buildBody };
|
|
33
|
-
export default runInstructions;
|
package/src/v15/index.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import buildSpec from "./buildSpec/index.js";
|
|
2
|
-
import registerGlobal from "./register/index.js";
|
|
3
|
-
import spec from "./spec.json" with { type: "json" };
|
|
4
|
-
|
|
5
|
-
import simpleTable from "./simpleTable/index.js";
|
|
6
|
-
import tableWithWidths from "./tableWithWidths/index.js";
|
|
7
|
-
import tableWithFooter from "./tableWithFooter/index.js";
|
|
8
|
-
import tableWithSerial from "./tableWithSerial/index.js";
|
|
9
|
-
import tableWithOptions from "./tableWithOptions/index.js";
|
|
10
|
-
import tableWithButtonCell from "./tableWithButtonCell/index.js";
|
|
11
|
-
import tableFullGrid from "./tableFullGrid/index.js";
|
|
12
|
-
import tableHeadless from "./tableHeadless/index.js";
|
|
13
|
-
|
|
14
|
-
const render = (input = {}) => {
|
|
15
|
-
const localInput = (input && typeof input === "object" && "inConfig" in input)
|
|
16
|
-
? input.inConfig
|
|
17
|
-
: input;
|
|
18
|
-
|
|
19
|
-
const localColumns = localInput.columns || [];
|
|
20
|
-
const localData = localInput.data || [];
|
|
21
|
-
const localOptions = localInput.options || {};
|
|
22
|
-
const localSerial = localInput.serial;
|
|
23
|
-
const localTargetHtmlId = localInput.targetHtmlId;
|
|
24
|
-
|
|
25
|
-
const tableSpec = buildSpec({
|
|
26
|
-
inConfig: {
|
|
27
|
-
columns: localColumns,
|
|
28
|
-
data: localData,
|
|
29
|
-
options: localOptions,
|
|
30
|
-
serial: localSerial
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
if (localTargetHtmlId && typeof document !== "undefined") {
|
|
35
|
-
const container = document.getElementById(localTargetHtmlId);
|
|
36
|
-
if (container) {
|
|
37
|
-
const toTag = globalThis?.ks?.jsonToTag?.buildSpecElement;
|
|
38
|
-
if (typeof toTag === "function") {
|
|
39
|
-
const element = toTag(tableSpec);
|
|
40
|
-
container.innerHTML = "";
|
|
41
|
-
container.append(element);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return tableSpec;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const scenarios = {
|
|
50
|
-
simpleTable,
|
|
51
|
-
tableWithWidths,
|
|
52
|
-
tableWithFooter,
|
|
53
|
-
tableWithSerial,
|
|
54
|
-
tableWithOptions,
|
|
55
|
-
tableWithButtonCell,
|
|
56
|
-
tableFullGrid,
|
|
57
|
-
tableHeadless
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
registerGlobal({
|
|
61
|
-
inDefinition: {
|
|
62
|
-
render,
|
|
63
|
-
renderToDom: render,
|
|
64
|
-
buildSpec,
|
|
65
|
-
spec,
|
|
66
|
-
...scenarios
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
export {
|
|
71
|
-
render,
|
|
72
|
-
render as renderToDom,
|
|
73
|
-
buildSpec,
|
|
74
|
-
spec,
|
|
75
|
-
simpleTable,
|
|
76
|
-
tableWithWidths,
|
|
77
|
-
tableWithFooter,
|
|
78
|
-
tableWithSerial,
|
|
79
|
-
tableWithOptions,
|
|
80
|
-
tableWithButtonCell,
|
|
81
|
-
tableFullGrid,
|
|
82
|
-
tableHeadless
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export default render;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import meta from "./meta.js";
|
|
2
|
-
|
|
3
|
-
export const registerGlobal = ({ inDefinition } = {}) => {
|
|
4
|
-
const localDefinition = inDefinition;
|
|
5
|
-
|
|
6
|
-
if (typeof globalThis === "undefined" || !localDefinition) return;
|
|
7
|
-
|
|
8
|
-
globalThis.ks ??= {};
|
|
9
|
-
|
|
10
|
-
const renderFunc = typeof localDefinition === "function"
|
|
11
|
-
? localDefinition
|
|
12
|
-
: localDefinition.render;
|
|
13
|
-
|
|
14
|
-
const buildSpecFunc = typeof localDefinition === "object"
|
|
15
|
-
? localDefinition.buildSpec
|
|
16
|
-
: undefined;
|
|
17
|
-
|
|
18
|
-
const tablePackage = {
|
|
19
|
-
meta,
|
|
20
|
-
renderToDom: renderFunc,
|
|
21
|
-
render: renderFunc,
|
|
22
|
-
...(buildSpecFunc ? { buildSpec: buildSpecFunc } : {}),
|
|
23
|
-
...(typeof localDefinition === "object" ? localDefinition : {})
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
globalThis.ks.jsonRenderersBuildTable = tablePackage;
|
|
27
|
-
globalThis.ks.jsonRenderersBuild ??= tablePackage;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export default registerGlobal;
|
package/src/v15/register/meta.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"tagName": "table",
|
|
3
|
-
"attributes": {
|
|
4
|
-
"class": "table table-hover table-striped align-middle border mb-0"
|
|
5
|
-
},
|
|
6
|
-
"children": [
|
|
7
|
-
{
|
|
8
|
-
"tagName": "thead",
|
|
9
|
-
"attributes": {
|
|
10
|
-
"class": "table-dark",
|
|
11
|
-
"data-role": "table-header"
|
|
12
|
-
},
|
|
13
|
-
"children": [
|
|
14
|
-
{
|
|
15
|
-
"tagName": "tr",
|
|
16
|
-
"attributes": {
|
|
17
|
-
"data-role": "table-header-row"
|
|
18
|
-
},
|
|
19
|
-
"children": []
|
|
20
|
-
}
|
|
21
|
-
]
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"tagName": "tbody",
|
|
25
|
-
"attributes": {
|
|
26
|
-
"data-role": "table-body"
|
|
27
|
-
},
|
|
28
|
-
"children": []
|
|
29
|
-
}
|
|
30
|
-
]
|
|
31
|
-
}
|
|
@@ -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,234 +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
|
-
{
|
|
75
|
-
"narration": "Prepend the serial column width to the table colgroup.",
|
|
76
|
-
"destinationPath": {
|
|
77
|
-
"fileName": "base",
|
|
78
|
-
"dataRole": "table-colgroup",
|
|
79
|
-
"filePath": [
|
|
80
|
-
"children"
|
|
81
|
-
],
|
|
82
|
-
"action": "unshift"
|
|
83
|
-
},
|
|
84
|
-
"sourcePath": {
|
|
85
|
-
"fileName": "data",
|
|
86
|
-
"filePath": [
|
|
87
|
-
"serial",
|
|
88
|
-
"col"
|
|
89
|
-
]
|
|
90
|
-
},
|
|
91
|
-
"templateKey": "buildColGroup",
|
|
92
|
-
"func": "applyTemplate"
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
"narration": "Prepend the serial header cell to the table header row.",
|
|
96
|
-
"destinationPath": {
|
|
97
|
-
"fileName": "base",
|
|
98
|
-
"dataRole": "table-header-row",
|
|
99
|
-
"filePath": [
|
|
100
|
-
"children"
|
|
101
|
-
],
|
|
102
|
-
"action": "unshift"
|
|
103
|
-
},
|
|
104
|
-
"sourcePath": {
|
|
105
|
-
"fileName": "data",
|
|
106
|
-
"filePath": [
|
|
107
|
-
"serial",
|
|
108
|
-
"header"
|
|
109
|
-
]
|
|
110
|
-
},
|
|
111
|
-
"templateKey": "buildHeader",
|
|
112
|
-
"func": "applyTemplate"
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
"narration": "Prepend the serial number cell into each table body row.",
|
|
116
|
-
"destinationPath": {
|
|
117
|
-
"fileName": "base",
|
|
118
|
-
"dataRole": "table-body",
|
|
119
|
-
"filePath": [
|
|
120
|
-
"children"
|
|
121
|
-
],
|
|
122
|
-
"action": "unshiftSerialToRows"
|
|
123
|
-
},
|
|
124
|
-
"sourcePath": {
|
|
125
|
-
"fileName": "data",
|
|
126
|
-
"filePath": [
|
|
127
|
-
"serial",
|
|
128
|
-
"body"
|
|
129
|
-
]
|
|
130
|
-
},
|
|
131
|
-
"templateKey": "buildBodyCell",
|
|
132
|
-
"func": "applyTemplate"
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
"narration": "Prepend an empty cell into the table footer row.",
|
|
136
|
-
"destinationPath": {
|
|
137
|
-
"fileName": "base",
|
|
138
|
-
"dataRole": "table-footer-row",
|
|
139
|
-
"filePath": [
|
|
140
|
-
"children"
|
|
141
|
-
],
|
|
142
|
-
"action": "unshift"
|
|
143
|
-
},
|
|
144
|
-
"sourcePath": {
|
|
145
|
-
"fileName": "data",
|
|
146
|
-
"filePath": [
|
|
147
|
-
"serial",
|
|
148
|
-
"footer"
|
|
149
|
-
]
|
|
150
|
-
},
|
|
151
|
-
"templateKey": "buildBodyCell",
|
|
152
|
-
"func": "applyTemplate"
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
"narration": "Append the options column width to the table colgroup.",
|
|
156
|
-
"destinationPath": {
|
|
157
|
-
"fileName": "base",
|
|
158
|
-
"dataRole": "table-colgroup",
|
|
159
|
-
"filePath": [
|
|
160
|
-
"children"
|
|
161
|
-
],
|
|
162
|
-
"action": "push"
|
|
163
|
-
},
|
|
164
|
-
"sourcePath": {
|
|
165
|
-
"fileName": "data",
|
|
166
|
-
"filePath": [
|
|
167
|
-
"options",
|
|
168
|
-
"col"
|
|
169
|
-
]
|
|
170
|
-
},
|
|
171
|
-
"templateKey": "buildColGroup",
|
|
172
|
-
"func": "applyTemplate"
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
"narration": "Append the options header cell to the table header row.",
|
|
176
|
-
"destinationPath": {
|
|
177
|
-
"fileName": "base",
|
|
178
|
-
"dataRole": "table-header-row",
|
|
179
|
-
"filePath": [
|
|
180
|
-
"children"
|
|
181
|
-
],
|
|
182
|
-
"action": "push"
|
|
183
|
-
},
|
|
184
|
-
"sourcePath": {
|
|
185
|
-
"fileName": "data",
|
|
186
|
-
"filePath": [
|
|
187
|
-
"options",
|
|
188
|
-
"header"
|
|
189
|
-
]
|
|
190
|
-
},
|
|
191
|
-
"templateKey": "buildHeader",
|
|
192
|
-
"func": "applyTemplate"
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
"narration": "Append the options button cell into each table body row.",
|
|
196
|
-
"destinationPath": {
|
|
197
|
-
"fileName": "base",
|
|
198
|
-
"dataRole": "table-body",
|
|
199
|
-
"filePath": [
|
|
200
|
-
"children"
|
|
201
|
-
],
|
|
202
|
-
"action": "pushToRows"
|
|
203
|
-
},
|
|
204
|
-
"sourcePath": {
|
|
205
|
-
"fileName": "data",
|
|
206
|
-
"filePath": [
|
|
207
|
-
"options",
|
|
208
|
-
"body"
|
|
209
|
-
]
|
|
210
|
-
},
|
|
211
|
-
"templateKey": "buttonCell",
|
|
212
|
-
"func": "applyTemplate"
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
"narration": "Append the save button cell into the table footer row.",
|
|
216
|
-
"destinationPath": {
|
|
217
|
-
"fileName": "base",
|
|
218
|
-
"dataRole": "table-footer-row",
|
|
219
|
-
"filePath": [
|
|
220
|
-
"children"
|
|
221
|
-
],
|
|
222
|
-
"action": "push"
|
|
223
|
-
},
|
|
224
|
-
"sourcePath": {
|
|
225
|
-
"fileName": "data",
|
|
226
|
-
"filePath": [
|
|
227
|
-
"options",
|
|
228
|
-
"footer"
|
|
229
|
-
]
|
|
230
|
-
},
|
|
231
|
-
"templateKey": "buttonCell",
|
|
232
|
-
"func": "applyTemplate"
|
|
233
|
-
}
|
|
234
|
-
]
|