@vuu-ui/vuu-utils 0.8.99 → 0.9.1
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/cjs/column-utils.js +22 -9
- package/cjs/column-utils.js.map +1 -1
- package/cjs/datasource/BaseDataSource.js +7 -0
- package/cjs/datasource/BaseDataSource.js.map +1 -1
- package/cjs/filters/filter-utils.js +28 -3
- package/cjs/filters/filter-utils.js.map +1 -1
- package/cjs/form-utils.js +28 -0
- package/cjs/form-utils.js.map +1 -1
- package/cjs/index.js +5 -2
- package/cjs/index.js.map +1 -1
- package/cjs/json-utils.js +21 -10
- package/cjs/json-utils.js.map +1 -1
- package/cjs/row-utils.js +0 -17
- package/cjs/row-utils.js.map +1 -1
- package/cjs/tree-utils.js +66 -0
- package/cjs/tree-utils.js.map +1 -0
- package/esm/column-utils.js +21 -9
- package/esm/column-utils.js.map +1 -1
- package/esm/datasource/BaseDataSource.js +7 -0
- package/esm/datasource/BaseDataSource.js.map +1 -1
- package/esm/filters/filter-utils.js +28 -3
- package/esm/filters/filter-utils.js.map +1 -1
- package/esm/form-utils.js +28 -1
- package/esm/form-utils.js.map +1 -1
- package/esm/index.js +4 -3
- package/esm/index.js.map +1 -1
- package/esm/json-utils.js +21 -10
- package/esm/json-utils.js.map +1 -1
- package/esm/row-utils.js +1 -17
- package/esm/row-utils.js.map +1 -1
- package/esm/tree-utils.js +64 -0
- package/esm/tree-utils.js.map +1 -0
- package/package.json +6 -6
- package/types/column-utils.d.ts +2 -1
- package/types/datasource/BaseDataSource.d.ts +5 -3
- package/types/filters/filter-utils.d.ts +5 -2
- package/types/form-utils.d.ts +12 -1
- package/types/index.d.ts +2 -0
- package/types/row-utils.d.ts +0 -1
- package/types/tree-types.d.ts +17 -0
- package/types/tree-utils.d.ts +5 -0
package/esm/json-utils.js
CHANGED
|
@@ -4,21 +4,30 @@ const { COUNT } = metadataKeys;
|
|
|
4
4
|
const isJsonData = (value) => typeof value === "object" && value !== null;
|
|
5
5
|
const vuuRowDataItemTypes = ["boolean", "number", "string"];
|
|
6
6
|
const isVuuRowDataItem = (value) => vuuRowDataItemTypes.includes(typeof value);
|
|
7
|
-
const typeofVuuDataItem = (value) => typeof value === "boolean" ? "boolean" : typeof value === "number" ? "number" : "string";
|
|
8
7
|
const getCellValue = (attribute, attributeValue) => {
|
|
9
|
-
if (
|
|
10
|
-
return {
|
|
8
|
+
if (Array.isArray(attributeValue)) {
|
|
9
|
+
return {
|
|
10
|
+
attribute: `${attribute}[`,
|
|
11
|
+
attributeValue: "",
|
|
12
|
+
isLeaf: false
|
|
13
|
+
};
|
|
14
|
+
} else if (isJsonData(attributeValue)) {
|
|
15
|
+
return {
|
|
16
|
+
attribute: `${attribute}{`,
|
|
17
|
+
attributeValue: "",
|
|
18
|
+
isLeaf: false
|
|
19
|
+
};
|
|
11
20
|
} else if (attributeValue === void 0) {
|
|
12
21
|
return {
|
|
13
22
|
attribute,
|
|
14
23
|
attributeValue: "undefined",
|
|
15
|
-
|
|
24
|
+
isLeaf: true
|
|
16
25
|
};
|
|
17
26
|
} else if (isVuuRowDataItem(attributeValue)) {
|
|
18
27
|
return {
|
|
19
28
|
attribute,
|
|
20
29
|
attributeValue,
|
|
21
|
-
|
|
30
|
+
isLeaf: true
|
|
22
31
|
};
|
|
23
32
|
} else {
|
|
24
33
|
throw Error(`unsupported type ${typeof attributeValue} in JSON`);
|
|
@@ -34,11 +43,13 @@ const jsonToDataSourceRows = (json) => {
|
|
|
34
43
|
const cols = [];
|
|
35
44
|
cols.push(
|
|
36
45
|
{
|
|
37
|
-
|
|
46
|
+
className: "vuuJsonCell",
|
|
47
|
+
name: "Level 1",
|
|
38
48
|
type: jsonColumnType
|
|
39
49
|
},
|
|
40
50
|
{
|
|
41
|
-
|
|
51
|
+
className: "vuuJsonCell",
|
|
52
|
+
name: "Level 2",
|
|
42
53
|
type: jsonColumnType
|
|
43
54
|
}
|
|
44
55
|
);
|
|
@@ -51,7 +62,8 @@ const addChildValues = (rows, json, cols, index = { value: 0 }, keyBase = "$root
|
|
|
51
62
|
let rowCount = 0;
|
|
52
63
|
if (depth === cols.length - 1) {
|
|
53
64
|
cols.push({
|
|
54
|
-
|
|
65
|
+
className: "vuuJsonCell",
|
|
66
|
+
name: `Level ${cols.length + 1}`,
|
|
55
67
|
hidden: true,
|
|
56
68
|
type: jsonColumnType
|
|
57
69
|
});
|
|
@@ -59,8 +71,7 @@ const addChildValues = (rows, json, cols, index = { value: 0 }, keyBase = "$root
|
|
|
59
71
|
const columnEntries = Object.entries(json);
|
|
60
72
|
for (let i = 0; i < columnEntries.length; i++, index.value += 1) {
|
|
61
73
|
const [key, value] = columnEntries[i];
|
|
62
|
-
const { attribute, attributeValue,
|
|
63
|
-
const isLeaf = type !== "json";
|
|
74
|
+
const { attribute, attributeValue, isLeaf } = getCellValue(key, value);
|
|
64
75
|
const blanks = Array(depth).fill("");
|
|
65
76
|
const fullKey = `${keyBase}|${key}`;
|
|
66
77
|
const row = [index.value, index.value, isLeaf, false, depth, 0, fullKey, 0, ...blanks, attribute, attributeValue];
|
package/esm/json-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-utils.js","sources":["../src/json-utils.ts"],"sourcesContent":["import { DataSourceRow } from \"@vuu-ui/vuu-data-types\";\nimport {\n ColumnDescriptor,\n DataValueTypeDescriptor,\n} from \"@vuu-ui/vuu-table-types\";\nimport { VuuRowDataItemType } from \"@vuu-ui/vuu-protocol-types\";\nimport { metadataKeys } from \"./column-utils\";\n\nconst { COUNT } = metadataKeys;\n\nexport type JsonData =\n | {\n [key: string]: unknown;\n }\n | JsonData[];\n\ntype Index = { value: number };\n\ntype CellValue = {\n attribute: string;\n attributeValue: JsonData | VuuRowDataItemType | null;\n
|
|
1
|
+
{"version":3,"file":"json-utils.js","sources":["../src/json-utils.ts"],"sourcesContent":["import { DataSourceRow } from \"@vuu-ui/vuu-data-types\";\nimport {\n ColumnDescriptor,\n DataValueTypeDescriptor,\n} from \"@vuu-ui/vuu-table-types\";\nimport { VuuRowDataItemType } from \"@vuu-ui/vuu-protocol-types\";\nimport { metadataKeys } from \"./column-utils\";\n\nconst { COUNT } = metadataKeys;\n\nexport type JsonData =\n | {\n [key: string]: unknown;\n }\n | JsonData[];\n\ntype Index = { value: number };\n\ntype CellValue = {\n attribute: string;\n attributeValue: JsonData | VuuRowDataItemType | null;\n isLeaf: boolean;\n};\n\nconst isJsonData = (value: unknown): value is JsonData =>\n typeof value === \"object\" && value !== null;\n\nconst vuuRowDataItemTypes = [\"boolean\", \"number\", \"string\"];\nconst isVuuRowDataItem = (value: unknown): value is VuuRowDataItemType =>\n vuuRowDataItemTypes.includes(typeof value);\n\nconst getCellValue = (\n attribute: string,\n attributeValue: unknown,\n): CellValue => {\n if (Array.isArray(attributeValue)) {\n return {\n attribute: `${attribute}[`,\n attributeValue: \"\",\n isLeaf: false,\n };\n } else if (isJsonData(attributeValue)) {\n return {\n attribute: `${attribute}{`,\n attributeValue: \"\",\n isLeaf: false,\n };\n } else if (attributeValue === undefined) {\n return {\n attribute,\n attributeValue: \"undefined\",\n isLeaf: true,\n };\n } else if (isVuuRowDataItem(attributeValue)) {\n return {\n attribute,\n attributeValue,\n isLeaf: true,\n };\n } else {\n throw Error(`unsupported type ${typeof attributeValue} in JSON`);\n }\n};\n\nconst jsonColumnType: DataValueTypeDescriptor = {\n name: \"json\",\n renderer: {\n name: \"json\",\n },\n};\n\nexport const jsonToDataSourceRows = (\n json: JsonData,\n): [ColumnDescriptor[], DataSourceRow[]] => {\n const cols: ColumnDescriptor[] = [];\n\n cols.push(\n {\n className: \"vuuJsonCell\",\n name: \"Level 1\",\n type: jsonColumnType,\n },\n {\n className: \"vuuJsonCell\",\n name: \"Level 2\",\n type: jsonColumnType,\n },\n );\n\n const rows: DataSourceRow[] = [];\n\n addChildValues(rows, json, cols);\n return [cols, rows];\n};\n\nconst addChildValues = (\n rows: DataSourceRow[],\n json: JsonData,\n cols: ColumnDescriptor[],\n index: Index = { value: 0 },\n keyBase = \"$root\",\n depth = 0,\n): [number, number] => {\n let leafCount = 0;\n let rowCount = 0;\n if (depth === cols.length - 1) {\n cols.push({\n className: \"vuuJsonCell\",\n name: `Level ${cols.length + 1}`,\n hidden: true,\n type: jsonColumnType,\n });\n }\n const columnEntries = Object.entries(json);\n for (let i = 0; i < columnEntries.length; i++, index.value += 1) {\n const [key, value] = columnEntries[i];\n const { attribute, attributeValue, isLeaf } = getCellValue(key, value);\n const blanks = Array(depth).fill(\"\");\n const fullKey = `${keyBase}|${key}`;\n // prettier-ignore\n const row = [index.value, index.value, isLeaf,false,depth,0,fullKey,0, ...blanks, attribute, attributeValue ] as DataSourceRow\n rows.push(row);\n rowCount += 1;\n\n if (isJsonData(value)) {\n const [nestedLeafCount, nestedRowCount] = addChildValues(\n rows,\n value,\n cols,\n { value: index.value + 1 },\n fullKey,\n depth + 1,\n );\n row[COUNT] = nestedLeafCount;\n leafCount += nestedLeafCount;\n rowCount += nestedRowCount;\n index.value += nestedRowCount;\n } else {\n leafCount += 1;\n }\n }\n\n return [leafCount, rowCount];\n};\n"],"names":[],"mappings":";;AAQA,MAAM,EAAE,OAAU,GAAA,YAAA,CAAA;AAgBlB,MAAM,aAAa,CAAC,KAAA,KAClB,OAAO,KAAA,KAAU,YAAY,KAAU,KAAA,IAAA,CAAA;AAEzC,MAAM,mBAAsB,GAAA,CAAC,SAAW,EAAA,QAAA,EAAU,QAAQ,CAAA,CAAA;AAC1D,MAAM,mBAAmB,CAAC,KAAA,KACxB,mBAAoB,CAAA,QAAA,CAAS,OAAO,KAAK,CAAA,CAAA;AAE3C,MAAM,YAAA,GAAe,CACnB,SAAA,EACA,cACc,KAAA;AACd,EAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,cAAc,CAAG,EAAA;AACjC,IAAO,OAAA;AAAA,MACL,SAAA,EAAW,GAAG,SAAS,CAAA,CAAA,CAAA;AAAA,MACvB,cAAgB,EAAA,EAAA;AAAA,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AAA,CAAC,KAAM,CAAA,KAAA,EAAO,MAAM,KAAO,EAAA,MAAA,EAAO,KAAM,EAAA,KAAA,EAAM,GAAE,OAAQ,EAAA,CAAA,EAAG,GAAG,MAAA,EAAQ,WAAW,cAAe,CAAA,CAAA;AAC5G,IAAA,IAAA,CAAK,KAAK,GAAG,CAAA,CAAA;AACb,IAAY,QAAA,IAAA,CAAA,CAAA;AAEZ,IAAI,IAAA,UAAA,CAAW,KAAK,CAAG,EAAA;AACrB,MAAM,MAAA,CAAC,eAAiB,EAAA,cAAc,CAAI,GAAA,cAAA;AAAA,QACxC,IAAA;AAAA,QACA,KAAA;AAAA,QACA,IAAA;AAAA,QACA,EAAE,KAAA,EAAO,KAAM,CAAA,KAAA,GAAQ,CAAE,EAAA;AAAA,QACzB,OAAA;AAAA,QACA,KAAQ,GAAA,CAAA;AAAA,OACV,CAAA;AACA,MAAA,GAAA,CAAI,KAAK,CAAI,GAAA,eAAA,CAAA;AACb,MAAa,SAAA,IAAA,eAAA,CAAA;AACb,MAAY,QAAA,IAAA,cAAA,CAAA;AACZ,MAAA,KAAA,CAAM,KAAS,IAAA,cAAA,CAAA;AAAA,KACV,MAAA;AACL,MAAa,SAAA,IAAA,CAAA,CAAA;AAAA,KACf;AAAA,GACF;AAEA,EAAO,OAAA,CAAC,WAAW,QAAQ,CAAA,CAAA;AAC7B,CAAA;;;;"}
|
package/esm/row-utils.js
CHANGED
|
@@ -21,22 +21,6 @@ const virtualRowPositioning = (rowHeight, virtualisedExtent, pctScrollTop) => [
|
|
|
21
21
|
},
|
|
22
22
|
true
|
|
23
23
|
];
|
|
24
|
-
const getRowElementAtIndex = (container, rowIndex) => {
|
|
25
|
-
if (rowIndex === -1) {
|
|
26
|
-
return null;
|
|
27
|
-
} else {
|
|
28
|
-
const activeRow = container.querySelector(
|
|
29
|
-
`[aria-rowindex="${rowIndex + 1}"]`
|
|
30
|
-
);
|
|
31
|
-
if (activeRow) {
|
|
32
|
-
return activeRow;
|
|
33
|
-
} else {
|
|
34
|
-
throw Error(
|
|
35
|
-
`getRowElementAtIndex no row found for index index ${rowIndex}`
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
24
|
const asDataSourceRowObject = (row, columnMap) => {
|
|
41
25
|
const { [IS_LEAF]: isLeaf, [KEY]: key, [IDX]: index } = row;
|
|
42
26
|
const rowObject = {
|
|
@@ -52,5 +36,5 @@ const asDataSourceRowObject = (row, columnMap) => {
|
|
|
52
36
|
return rowObject;
|
|
53
37
|
};
|
|
54
38
|
|
|
55
|
-
export { actualRowPositioning, asDataSourceRowObject,
|
|
39
|
+
export { actualRowPositioning, asDataSourceRowObject, virtualRowPositioning };
|
|
56
40
|
//# sourceMappingURL=row-utils.js.map
|
package/esm/row-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"row-utils.js","sources":["../src/row-utils.ts"],"sourcesContent":["//TODO this all probably belongs in vuu-table\nimport type {\n DataSourceRow,\n DataSourceRowObject,\n} from \"@vuu-ui/vuu-data-types\";\nimport type { MutableRefObject } from \"react\";\nimport { ColumnMap, metadataKeys } from \"./column-utils\";\nimport { isRowSelected } from \"./selection-utils\";\n\nconst { IS_LEAF, KEY, IDX } = metadataKeys;\n\nexport type RowOffsetFunc = (\n row: DataSourceRow,\n pctScrollTop?: number,\n) => number;\nexport type RowAtPositionFunc = (position: number) => number;\n\n/**\n * RowOffset function, RowAtPosition function, isVirtualScroll\n */\nexport type RowPositioning = [RowOffsetFunc, RowAtPositionFunc, boolean];\n\nexport const actualRowPositioning = (rowHeight: number): RowPositioning => [\n (row) => row[IDX] * rowHeight,\n (position) => Math.floor(position / rowHeight),\n false,\n];\n\n/**\n * return functions for determining a) the pixel offset to apply to a row, given the\n * row index and b) the index of the row at a given scroll offset. This implementation\n * is used when we are forced to 'virtualise' scrolling - because the number of rows\n * is high enough that we cannot create a large enough HTML content container.\n *\n * @param rowHeight\n * @param virtualisedExtent\n * @param pctScrollTop\n * @returns\n */\nexport const virtualRowPositioning = (\n rowHeight: number,\n virtualisedExtent: number,\n pctScrollTop: MutableRefObject<number>,\n): RowPositioning => [\n (row, offset = 0) => {\n const rowOffset = pctScrollTop.current * virtualisedExtent;\n return (row[IDX] - offset) * rowHeight - rowOffset;\n },\n /*\n Return index position of closest row \n */\n (position) => {\n const rowOffset = pctScrollTop.current * virtualisedExtent;\n return Math.round((position + rowOffset) / rowHeight);\n },\n true,\n];\n\nexport const
|
|
1
|
+
{"version":3,"file":"row-utils.js","sources":["../src/row-utils.ts"],"sourcesContent":["//TODO this all probably belongs in vuu-table\nimport type {\n DataSourceRow,\n DataSourceRowObject,\n} from \"@vuu-ui/vuu-data-types\";\nimport type { MutableRefObject } from \"react\";\nimport { ColumnMap, metadataKeys } from \"./column-utils\";\nimport { isRowSelected } from \"./selection-utils\";\n\nconst { IS_LEAF, KEY, IDX } = metadataKeys;\n\nexport type RowOffsetFunc = (\n row: DataSourceRow,\n pctScrollTop?: number,\n) => number;\nexport type RowAtPositionFunc = (position: number) => number;\n\n/**\n * RowOffset function, RowAtPosition function, isVirtualScroll\n */\nexport type RowPositioning = [RowOffsetFunc, RowAtPositionFunc, boolean];\n\nexport const actualRowPositioning = (rowHeight: number): RowPositioning => [\n (row) => row[IDX] * rowHeight,\n (position) => Math.floor(position / rowHeight),\n false,\n];\n\n/**\n * return functions for determining a) the pixel offset to apply to a row, given the\n * row index and b) the index of the row at a given scroll offset. This implementation\n * is used when we are forced to 'virtualise' scrolling - because the number of rows\n * is high enough that we cannot create a large enough HTML content container.\n *\n * @param rowHeight\n * @param virtualisedExtent\n * @param pctScrollTop\n * @returns\n */\nexport const virtualRowPositioning = (\n rowHeight: number,\n virtualisedExtent: number,\n pctScrollTop: MutableRefObject<number>,\n): RowPositioning => [\n (row, offset = 0) => {\n const rowOffset = pctScrollTop.current * virtualisedExtent;\n return (row[IDX] - offset) * rowHeight - rowOffset;\n },\n /*\n Return index position of closest row \n */\n (position) => {\n const rowOffset = pctScrollTop.current * virtualisedExtent;\n return Math.round((position + rowOffset) / rowHeight);\n },\n true,\n];\n\nexport const asDataSourceRowObject = (\n row: DataSourceRow,\n columnMap: ColumnMap,\n): DataSourceRowObject => {\n const { [IS_LEAF]: isLeaf, [KEY]: key, [IDX]: index } = row;\n\n const rowObject: DataSourceRowObject = {\n key,\n index,\n isGroupRow: !isLeaf,\n isSelected: isRowSelected(row),\n data: {},\n };\n\n for (const [colName, colIdx] of Object.entries(columnMap)) {\n rowObject.data[colName] = row[colIdx];\n }\n\n return rowObject;\n};\n"],"names":[],"mappings":";;;AASA,MAAM,EAAE,OAAA,EAAS,GAAK,EAAA,GAAA,EAAQ,GAAA,YAAA,CAAA;AAajB,MAAA,oBAAA,GAAuB,CAAC,SAAsC,KAAA;AAAA,EACzE,CAAC,GAAA,KAAQ,GAAI,CAAA,GAAG,CAAI,GAAA,SAAA;AAAA,EACpB,CAAC,QAAA,KAAa,IAAK,CAAA,KAAA,CAAM,WAAW,SAAS,CAAA;AAAA,EAC7C,KAAA;AACF,EAAA;AAaO,MAAM,qBAAwB,GAAA,CACnC,SACA,EAAA,iBAAA,EACA,YACmB,KAAA;AAAA,EACnB,CAAC,GAAK,EAAA,MAAA,GAAS,CAAM,KAAA;AACnB,IAAM,MAAA,SAAA,GAAY,aAAa,OAAU,GAAA,iBAAA,CAAA;AACzC,IAAA,OAAA,CAAQ,GAAI,CAAA,GAAG,CAAI,GAAA,MAAA,IAAU,SAAY,GAAA,SAAA,CAAA;AAAA,GAC3C;AAAA;AAAA;AAAA;AAAA,EAIA,CAAC,QAAa,KAAA;AACZ,IAAM,MAAA,SAAA,GAAY,aAAa,OAAU,GAAA,iBAAA,CAAA;AACzC,IAAA,OAAO,IAAK,CAAA,KAAA,CAAA,CAAO,QAAW,GAAA,SAAA,IAAa,SAAS,CAAA,CAAA;AAAA,GACtD;AAAA,EACA,IAAA;AACF,EAAA;AAEa,MAAA,qBAAA,GAAwB,CACnC,GAAA,EACA,SACwB,KAAA;AACxB,EAAA,MAAM,EAAE,CAAC,OAAO,GAAG,MAAQ,EAAA,CAAC,GAAG,GAAG,GAAK,EAAA,CAAC,GAAG,GAAG,OAAU,GAAA,GAAA,CAAA;AAExD,EAAA,MAAM,SAAiC,GAAA;AAAA,IACrC,GAAA;AAAA,IACA,KAAA;AAAA,IACA,YAAY,CAAC,MAAA;AAAA,IACb,UAAA,EAAY,cAAc,GAAG,CAAA;AAAA,IAC7B,MAAM,EAAC;AAAA,GACT,CAAA;AAEA,EAAA,KAAA,MAAW,CAAC,OAAS,EAAA,MAAM,KAAK,MAAO,CAAA,OAAA,CAAQ,SAAS,CAAG,EAAA;AACzD,IAAA,SAAA,CAAU,IAAK,CAAA,OAAO,CAAI,GAAA,GAAA,CAAI,MAAM,CAAA,CAAA;AAAA,GACtC;AAEA,EAAO,OAAA,SAAA,CAAA;AACT;;;;"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { metadataKeys } from './column-utils.js';
|
|
2
|
+
|
|
3
|
+
const { COUNT } = metadataKeys;
|
|
4
|
+
const treeToDataSourceRows = (treeSourceNodes, iconProvider) => {
|
|
5
|
+
const columns = [];
|
|
6
|
+
columns.push(
|
|
7
|
+
{
|
|
8
|
+
getIcon: iconProvider?.getIcon,
|
|
9
|
+
name: "Level 1",
|
|
10
|
+
type: "string"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
getIcon: iconProvider?.getIcon,
|
|
14
|
+
name: "Level 2",
|
|
15
|
+
type: "string"
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
const rows = [];
|
|
19
|
+
addChildValues(rows, treeSourceNodes, columns, iconProvider);
|
|
20
|
+
return [columns, rows];
|
|
21
|
+
};
|
|
22
|
+
const addChildValues = (rows, treeSourceNodes, cols, iconProvider, index = { value: 0 }, keyBase = "$root", depth = 1) => {
|
|
23
|
+
let leafCount = 0;
|
|
24
|
+
let rowCount = 0;
|
|
25
|
+
if (depth === cols.length - 1) {
|
|
26
|
+
cols.push({
|
|
27
|
+
getIcon: iconProvider?.getIcon,
|
|
28
|
+
name: `Level ${cols.length + 1}`,
|
|
29
|
+
type: "string"
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
for (let i = 0; i < treeSourceNodes.length; i++, index.value += 1) {
|
|
33
|
+
const { childNodes, icon, label } = treeSourceNodes[i];
|
|
34
|
+
const blanks = Array(depth - 1).fill("");
|
|
35
|
+
const fullKey = `${keyBase}|${label}`;
|
|
36
|
+
const row = [index.value, index.value, false, false, depth, 0, fullKey, 0, ...blanks, label];
|
|
37
|
+
if (icon) {
|
|
38
|
+
iconProvider?.setIcon(fullKey, icon);
|
|
39
|
+
}
|
|
40
|
+
rows.push(row);
|
|
41
|
+
rowCount += 1;
|
|
42
|
+
if (childNodes && childNodes.length > 0) {
|
|
43
|
+
const [nestedLeafCount, nestedRowCount] = addChildValues(
|
|
44
|
+
rows,
|
|
45
|
+
childNodes,
|
|
46
|
+
cols,
|
|
47
|
+
iconProvider,
|
|
48
|
+
{ value: index.value + 1 },
|
|
49
|
+
fullKey,
|
|
50
|
+
depth + 1
|
|
51
|
+
);
|
|
52
|
+
row[COUNT] = nestedLeafCount;
|
|
53
|
+
leafCount += nestedLeafCount;
|
|
54
|
+
rowCount += nestedRowCount;
|
|
55
|
+
index.value += nestedRowCount;
|
|
56
|
+
} else {
|
|
57
|
+
leafCount += 1;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return [leafCount, rowCount];
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export { treeToDataSourceRows };
|
|
64
|
+
//# sourceMappingURL=tree-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-utils.js","sources":["../src/tree-utils.ts"],"sourcesContent":["import { TreeSourceNode } from \"./tree-types\";\nimport { ColumnDescriptor } from \"@vuu-ui/vuu-table-types\";\nimport { DataSourceRow } from \"@vuu-ui/vuu-data-types\";\nimport { metadataKeys } from \"./column-utils\";\nimport { IconProvider } from \"@vuu-ui/vuu-data-local/src/tree-data-source/IconProvider\";\n\nconst { COUNT } = metadataKeys;\n\ntype Index = { value: number };\n\nexport const treeToDataSourceRows = (\n treeSourceNodes: TreeSourceNode[],\n iconProvider?: IconProvider,\n): [ColumnDescriptor[], DataSourceRow[]] => {\n const columns: ColumnDescriptor[] = [];\n\n columns.push(\n {\n getIcon: iconProvider?.getIcon,\n name: \"Level 1\",\n type: \"string\",\n },\n {\n getIcon: iconProvider?.getIcon,\n name: \"Level 2\",\n type: \"string\",\n },\n );\n\n const rows: DataSourceRow[] = [];\n\n addChildValues(rows, treeSourceNodes, columns, iconProvider);\n return [columns, rows];\n};\n\nconst addChildValues = (\n rows: DataSourceRow[],\n treeSourceNodes: TreeSourceNode[],\n cols: ColumnDescriptor[],\n iconProvider: IconProvider | undefined,\n index: Index = { value: 0 },\n keyBase = \"$root\",\n depth = 1,\n): [number, number] => {\n let leafCount = 0;\n let rowCount = 0;\n if (depth === cols.length - 1) {\n cols.push({\n getIcon: iconProvider?.getIcon,\n name: `Level ${cols.length + 1}`,\n type: \"string\",\n });\n }\n for (let i = 0; i < treeSourceNodes.length; i++, index.value += 1) {\n const { childNodes, icon, label } = treeSourceNodes[i];\n const blanks = Array(depth - 1).fill(\"\");\n const fullKey = `${keyBase}|${label}`;\n // prettier-ignore\n const row = [index.value, index.value, false,false,depth,0,fullKey,0, ...blanks, label ] as DataSourceRow;\n if (icon) {\n iconProvider?.setIcon(fullKey, icon);\n }\n rows.push(row);\n rowCount += 1;\n\n if (childNodes && childNodes.length > 0) {\n const [nestedLeafCount, nestedRowCount] = addChildValues(\n rows,\n childNodes,\n cols,\n iconProvider,\n { value: index.value + 1 },\n fullKey,\n depth + 1,\n );\n row[COUNT] = nestedLeafCount;\n leafCount += nestedLeafCount;\n rowCount += nestedRowCount;\n index.value += nestedRowCount;\n } else {\n leafCount += 1;\n }\n }\n\n return [leafCount, rowCount];\n};\n"],"names":[],"mappings":";;A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A,EAAO,OAAA,CAAC,WAAW,QAAQ,CAAA,CAAA;AAC7B,CAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.9.1",
|
|
3
3
|
"author": "heswell",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"types": "types/index.d.ts",
|
|
6
6
|
"devDependencies": {
|
|
7
|
-
"@vuu-ui/vuu-data-types": "0.
|
|
8
|
-
"@vuu-ui/vuu-table-types": "0.
|
|
9
|
-
"@vuu-ui/vuu-filter-types": "0.
|
|
10
|
-
"@vuu-ui/vuu-protocol-types": "0.
|
|
7
|
+
"@vuu-ui/vuu-data-types": "0.9.1",
|
|
8
|
+
"@vuu-ui/vuu-table-types": "0.9.1",
|
|
9
|
+
"@vuu-ui/vuu-filter-types": "0.9.1",
|
|
10
|
+
"@vuu-ui/vuu-protocol-types": "0.9.1"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
13
|
"@internationalized/date": "^3.0.0",
|
|
14
|
-
"@vuu-ui/vuu-filter-parser": "0.
|
|
14
|
+
"@vuu-ui/vuu-filter-parser": "0.9.1",
|
|
15
15
|
"clsx": "^2.0.0",
|
|
16
16
|
"react": ">=17.0.2",
|
|
17
17
|
"react-dom": ">=17.0.2"
|
package/types/column-utils.d.ts
CHANGED
|
@@ -89,7 +89,8 @@ export declare const isDataLoading: (columns: RuntimeColumnDescriptor[]) => bool
|
|
|
89
89
|
export declare const getColumnsInViewport: (columns: RuntimeColumnDescriptor[], vpStart: number, vpEnd: number) => [RuntimeColumnDescriptor[], number];
|
|
90
90
|
export declare const isNotHidden: (column: RuntimeColumnDescriptor) => boolean;
|
|
91
91
|
export declare const visibleColumnAtIndex: (columns: RuntimeColumnDescriptor[], index: number) => RuntimeColumnDescriptor | undefined;
|
|
92
|
-
export declare const
|
|
92
|
+
export declare const getGroupIcon: (columns: RuntimeColumnDescriptor[], row: DataSourceRow) => string | undefined;
|
|
93
|
+
export declare const getGroupValue: (columns: RuntimeColumnDescriptor[], row: DataSourceRow, columnMap: ColumnMap) => unknown;
|
|
93
94
|
export declare const getDefaultColumnType: (serverDataType?: VuuColumnDataType) => DataValueTypeSimple;
|
|
94
95
|
export declare const updateColumnFormatting: <T extends ColumnDescriptor = ColumnDescriptor>(column: T, formatting: ColumnTypeFormatting) => T;
|
|
95
96
|
export declare function updateColumnType<T extends ColumnDescriptor = ColumnDescriptor>(column: T, type: DataValueTypeSimple): T;
|
|
@@ -11,7 +11,7 @@ export declare abstract class BaseDataSource extends EventEmitter<DataSourceEven
|
|
|
11
11
|
protected _range: VuuRange;
|
|
12
12
|
protected _size: number;
|
|
13
13
|
protected _title: string | undefined;
|
|
14
|
-
constructor({ aggregations, baseFilterSpec, columns, filterSpec, groupBy, sort, title, viewport, }: DataSourceConstructorProps);
|
|
14
|
+
constructor({ aggregations, baseFilterSpec, columns, filterSpec, groupBy, sort, title, viewport, }: Omit<DataSourceConstructorProps, "table">);
|
|
15
15
|
subscribe({ baseFilterSpec, columns, aggregations, range, sort, groupBy, filterSpec, viewport, }: SubscribeProps, callback: SubscribeCallback): void;
|
|
16
16
|
get aggregations(): VuuAggregation[];
|
|
17
17
|
set aggregations(aggregations: VuuAggregation[]);
|
|
@@ -21,13 +21,15 @@ export declare abstract class BaseDataSource extends EventEmitter<DataSourceEven
|
|
|
21
21
|
set columns(columns: string[]);
|
|
22
22
|
get filter(): DataSourceFilter;
|
|
23
23
|
set filter(filter: DataSourceFilter);
|
|
24
|
-
get config(): WithBaseFilter<
|
|
25
|
-
set config(config: WithBaseFilter<
|
|
24
|
+
get config(): WithBaseFilter<WithFullConfig>;
|
|
25
|
+
set config(config: WithBaseFilter<WithFullConfig>);
|
|
26
26
|
get range(): VuuRange;
|
|
27
27
|
set range(range: VuuRange);
|
|
28
28
|
get size(): number;
|
|
29
29
|
get sort(): VuuSort;
|
|
30
30
|
set sort(sort: VuuSort);
|
|
31
|
+
get title(): string;
|
|
32
|
+
set title(title: string);
|
|
31
33
|
applyConfig(config: WithBaseFilter<DataSourceConfig>, preserveExistingConfigAttributes?: boolean): DataSourceConfigChanges | undefined;
|
|
32
34
|
abstract rangeRequest(range: VuuRange): void;
|
|
33
35
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { DataSourceFilter } from "@vuu-ui/vuu-data-types";
|
|
3
3
|
import { AndFilter, Filter, FilterClauseOp, FilterWithPartialClause, MultiClauseFilter, MultiValueFilterClause, OrFilter, SingleValueFilterClause } from "@vuu-ui/vuu-filter-types";
|
|
4
|
-
import { RuntimeColumnDescriptor } from "@vuu-ui/vuu-table-types";
|
|
4
|
+
import { ColumnDescriptor, RuntimeColumnDescriptor } from "@vuu-ui/vuu-table-types";
|
|
5
5
|
import { EventEmitter } from "../event-emitter";
|
|
6
6
|
import { VuuFilter } from "@vuu-ui/vuu-protocol-types";
|
|
7
7
|
export declare const isValidFilterClauseOp: (op?: string) => op is FilterClauseOp;
|
|
@@ -45,6 +45,7 @@ export declare const stripFilterFromColumns: (columns: RuntimeColumnDescriptor[]
|
|
|
45
45
|
aggregate?: import("@vuu-ui/vuu-protocol-types").VuuAggType | undefined;
|
|
46
46
|
colHeaderContentRenderer?: string | undefined;
|
|
47
47
|
colHeaderLabelRenderer?: string | undefined;
|
|
48
|
+
getIcon?: ((row: import("@vuu-ui/vuu-data-types").DataSourceRow) => string | undefined) | undefined;
|
|
48
49
|
hidden?: boolean | undefined;
|
|
49
50
|
maxWidth?: number | undefined;
|
|
50
51
|
minWidth?: number | undefined;
|
|
@@ -61,5 +62,7 @@ export type FilterEvents = {
|
|
|
61
62
|
};
|
|
62
63
|
export declare class FilterAggregator extends EventEmitter<FilterEvents> {
|
|
63
64
|
#private;
|
|
64
|
-
addFilter(column:
|
|
65
|
+
addFilter(column: ColumnDescriptor, value: string | number): void;
|
|
66
|
+
removeFilter(column: ColumnDescriptor): boolean;
|
|
67
|
+
get filter(): VuuFilter;
|
|
65
68
|
}
|
package/types/form-utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { VuuRowDataItemType } from "@vuu-ui/vuu-protocol-types";
|
|
1
|
+
import { VuuColumnDataType, VuuRowDataItemType } from "@vuu-ui/vuu-protocol-types";
|
|
2
2
|
import { KeyboardEvent, SyntheticEvent } from "react";
|
|
3
3
|
/**
|
|
4
4
|
* Use with the following convention:
|
|
@@ -8,3 +8,14 @@ import { KeyboardEvent, SyntheticEvent } from "react";
|
|
|
8
8
|
export declare const getFieldName: (target: EventTarget | HTMLElement) => string;
|
|
9
9
|
export type InputSource = "typeahead-suggestion" | "text-input";
|
|
10
10
|
export type CommitHandler<E extends HTMLElement = HTMLInputElement, T extends VuuRowDataItemType | undefined = string> = (evt: SyntheticEvent<E> | KeyboardEvent<E>, value: T, source?: InputSource) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Convert a string value to the type appropriate for the associated
|
|
13
|
+
* column or form field. Can be used when processing a string value
|
|
14
|
+
* from an input used for user editing.
|
|
15
|
+
*
|
|
16
|
+
* @param value
|
|
17
|
+
* @param type
|
|
18
|
+
* @param throwIfUndefined
|
|
19
|
+
*/
|
|
20
|
+
export declare function getTypedValue(value: string, type: VuuColumnDataType, throwIfUndefined?: false): VuuRowDataItemType | undefined;
|
|
21
|
+
export declare function getTypedValue(value: string, type: VuuColumnDataType, throwIfUndefined: true): VuuRowDataItemType;
|
package/types/index.d.ts
CHANGED
|
@@ -49,6 +49,8 @@ export * from "./sort-utils";
|
|
|
49
49
|
export * from "./table-schema-utils";
|
|
50
50
|
export * from "./text-utils";
|
|
51
51
|
export * from "./typeahead-utils";
|
|
52
|
+
export * from "./tree-types";
|
|
53
|
+
export * from "./tree-utils";
|
|
52
54
|
export * from "./ThemeProvider";
|
|
53
55
|
export * from "./ts-utils";
|
|
54
56
|
export * from "./url-utils";
|
package/types/row-utils.d.ts
CHANGED
|
@@ -20,5 +20,4 @@ export declare const actualRowPositioning: (rowHeight: number) => RowPositioning
|
|
|
20
20
|
* @returns
|
|
21
21
|
*/
|
|
22
22
|
export declare const virtualRowPositioning: (rowHeight: number, virtualisedExtent: number, pctScrollTop: MutableRefObject<number>) => RowPositioning;
|
|
23
|
-
export declare const getRowElementAtIndex: (container: HTMLDivElement | EventTarget, rowIndex: number) => HTMLElement | null;
|
|
24
23
|
export declare const asDataSourceRowObject: (row: DataSourceRow, columnMap: ColumnMap) => DataSourceRowObject;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface TreeSourceNode {
|
|
2
|
+
id: string;
|
|
3
|
+
icon?: string;
|
|
4
|
+
header?: boolean;
|
|
5
|
+
label: string;
|
|
6
|
+
childNodes?: TreeSourceNode[];
|
|
7
|
+
}
|
|
8
|
+
export interface NormalisedTreeSourceNode extends TreeSourceNode {
|
|
9
|
+
childNodes?: NormalisedTreeSourceNode[];
|
|
10
|
+
count: number;
|
|
11
|
+
expanded?: boolean;
|
|
12
|
+
index: number;
|
|
13
|
+
level: number;
|
|
14
|
+
}
|
|
15
|
+
export interface NonLeafNode extends NormalisedTreeSourceNode {
|
|
16
|
+
childNodes: NormalisedTreeSourceNode[];
|
|
17
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TreeSourceNode } from "./tree-types";
|
|
2
|
+
import { ColumnDescriptor } from "@vuu-ui/vuu-table-types";
|
|
3
|
+
import { DataSourceRow } from "@vuu-ui/vuu-data-types";
|
|
4
|
+
import { IconProvider } from "@vuu-ui/vuu-data-local/src/tree-data-source/IconProvider";
|
|
5
|
+
export declare const treeToDataSourceRows: (treeSourceNodes: TreeSourceNode[], iconProvider?: IconProvider) => [ColumnDescriptor[], DataSourceRow[]];
|