json-renderers-build 1.10.2 → 1.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "json-renderers-build",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.3",
|
|
4
4
|
"description": "Headless component specification builder for json-renderers, compiling UI skeletons and data into JSON-to-DOM specs using json-to-spec",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import jsonTransformer from "@keshavsoft/json-transformer";
|
|
2
|
-
import findKey from "../findKey.js";
|
|
3
2
|
import spec from "./spec.json" with { type: "json" };
|
|
4
3
|
|
|
5
|
-
const renderTableHead = ({ inColumns = []
|
|
6
|
-
const headRow = findKey(inTagJson, "children[0].children[0]");
|
|
7
|
-
|
|
4
|
+
const renderTableHead = ({ inColumns = [] } = {}) => {
|
|
8
5
|
const input = inColumns.map(element => {
|
|
9
6
|
return {
|
|
10
7
|
columnName: element
|
|
@@ -13,7 +10,7 @@ const renderTableHead = ({ inColumns = [], inTagJson } = {}) => {
|
|
|
13
10
|
|
|
14
11
|
const row = jsonTransformer({ Rows: input }, spec);
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
return row?.Rows;
|
|
17
14
|
};
|
|
18
15
|
|
|
19
16
|
export default renderTableHead;
|
|
@@ -10,9 +10,11 @@ const renderTable = ({
|
|
|
10
10
|
} = {}) => {
|
|
11
11
|
const table = structuredClone(tagJson);
|
|
12
12
|
|
|
13
|
-
renderTableHead({ inColumns
|
|
13
|
+
const header = renderTableHead({ inColumns });
|
|
14
14
|
const body = renderTableBody({ inColumns, inData });
|
|
15
|
+
// console.log("header : ", header);
|
|
15
16
|
|
|
17
|
+
table.children[0].children = [header];
|
|
16
18
|
table.children[1] = body;
|
|
17
19
|
|
|
18
20
|
return table;
|