@vuu-ui/vuu-data-local 0.13.115-alpha.2 → 0.13.115-alpha.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.
|
@@ -3,15 +3,24 @@
|
|
|
3
3
|
var vuuUtils = require('@vuu-ui/vuu-utils');
|
|
4
4
|
|
|
5
5
|
const { KEY, RENDER_IDX, SELECTED } = vuuUtils.metadataKeys;
|
|
6
|
+
const replaceBigInt = (value) => {
|
|
7
|
+
if (typeof value === "bigint") {
|
|
8
|
+
return value.toString();
|
|
9
|
+
} else {
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
6
13
|
const toClientRow = (row, keys, selectedRows, dataIndices) => {
|
|
7
14
|
const [rowIndex] = row;
|
|
8
15
|
const selectedAll = selectedRows.has("*");
|
|
9
16
|
let clientRow;
|
|
10
17
|
if (dataIndices) {
|
|
11
18
|
const { count } = vuuUtils.metadataKeys;
|
|
12
|
-
clientRow = row.slice(0, count).concat(
|
|
19
|
+
clientRow = row.slice(0, count).concat(
|
|
20
|
+
dataIndices.map((idx) => replaceBigInt(row[idx]))
|
|
21
|
+
);
|
|
13
22
|
} else {
|
|
14
|
-
clientRow = row.
|
|
23
|
+
clientRow = row.map(replaceBigInt);
|
|
15
24
|
}
|
|
16
25
|
clientRow[RENDER_IDX] = keys.keyFor(rowIndex);
|
|
17
26
|
clientRow[SELECTED] = selectedAll || selectedRows.has(row[KEY]) ? 1 : 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array-data-utils.js","sources":["../../../../packages/vuu-data-local/src/array-data-source/array-data-utils.ts"],"sourcesContent":["import type { DataSourceRow } from \"@vuu-ui/vuu-data-types\";\nimport { ColumnMap, KeySet, metadataKeys } from \"@vuu-ui/vuu-utils\";\n\nconst { KEY, RENDER_IDX, SELECTED } = metadataKeys;\n\nexport const toClientRow = (\n row: DataSourceRow,\n keys: KeySet,\n selectedRows: Set<string>,\n dataIndices?: number[],\n) => {\n const [rowIndex] = row;\n const selectedAll = selectedRows.has(\"*\");\n let clientRow;\n if (dataIndices) {\n // If client has specified a different ordering of columns from the way they are\n // ordered inn the underlying data, this is where we effect the ordering.\n const { count } = metadataKeys;\n clientRow = row\n .slice(0, count)\n .concat(dataIndices.map((idx) => row[idx])) as DataSourceRow;\n } else {\n clientRow = row.
|
|
1
|
+
{"version":3,"file":"array-data-utils.js","sources":["../../../../packages/vuu-data-local/src/array-data-source/array-data-utils.ts"],"sourcesContent":["import type { DataSourceRow } from \"@vuu-ui/vuu-data-types\";\nimport { VuuRowDataItemType } from \"@vuu-ui/vuu-protocol-types\";\nimport { ColumnMap, KeySet, metadataKeys } from \"@vuu-ui/vuu-utils\";\n\nconst { KEY, RENDER_IDX, SELECTED } = metadataKeys;\n\nconst replaceBigInt = (\n value: VuuRowDataItemType | bigint,\n): VuuRowDataItemType => {\n if (typeof value === \"bigint\") {\n return value.toString();\n } else {\n return value;\n }\n};\n\nexport const toClientRow = (\n row: DataSourceRow,\n keys: KeySet,\n selectedRows: Set<string>,\n dataIndices?: number[],\n) => {\n const [rowIndex] = row;\n const selectedAll = selectedRows.has(\"*\");\n let clientRow;\n if (dataIndices) {\n // If client has specified a different ordering of columns from the way they are\n // ordered inn the underlying data, this is where we effect the ordering.\n const { count } = metadataKeys;\n clientRow = row\n .slice(0, count)\n .concat(\n dataIndices.map((idx) => replaceBigInt(row[idx])),\n ) as DataSourceRow;\n } else {\n clientRow = row.map(replaceBigInt) as DataSourceRow;\n }\n clientRow[RENDER_IDX] = keys.keyFor(rowIndex);\n clientRow[SELECTED] = selectedAll || selectedRows.has(row[KEY]) ? 1 : 0;\n return clientRow;\n};\n\nconst divergentMaps = (columnMap: ColumnMap, dataMap?: ColumnMap) => {\n if (dataMap) {\n const { count: mapOffset } = metadataKeys;\n for (const [columnName, index] of Object.entries(columnMap)) {\n const dataIdx = dataMap[columnName];\n if (dataIdx === undefined) {\n throw Error(\n `ArrayDataSource column ${columnName} is not in underlying data set`,\n );\n } else if (dataIdx !== index - mapOffset) {\n return true;\n }\n }\n }\n return false;\n};\n\nconst getDataIndices = (columnMap: ColumnMap, dataMap: ColumnMap) => {\n const { count: mapOffset } = metadataKeys;\n const result: number[] = [];\n Object.entries(columnMap).forEach(([columnName]) => {\n result.push(dataMap[columnName] + mapOffset);\n });\n return result;\n};\n\nexport const buildDataToClientMap = (\n columnMap: ColumnMap,\n dataMap?: ColumnMap,\n): number[] | undefined => {\n if (dataMap && divergentMaps(columnMap, dataMap)) {\n return getDataIndices(columnMap, dataMap);\n }\n return undefined;\n};\n"],"names":["metadataKeys"],"mappings":";;;;AAIA,MAAM,EAAE,GAAA,EAAK,UAAY,EAAA,QAAA,EAAa,GAAAA,qBAAA;AAEtC,MAAM,aAAA,GAAgB,CACpB,KACuB,KAAA;AACvB,EAAI,IAAA,OAAO,UAAU,QAAU,EAAA;AAC7B,IAAA,OAAO,MAAM,QAAS,EAAA;AAAA,GACjB,MAAA;AACL,IAAO,OAAA,KAAA;AAAA;AAEX,CAAA;AAEO,MAAM,WAAc,GAAA,CACzB,GACA,EAAA,IAAA,EACA,cACA,WACG,KAAA;AACH,EAAM,MAAA,CAAC,QAAQ,CAAI,GAAA,GAAA;AACnB,EAAM,MAAA,WAAA,GAAc,YAAa,CAAA,GAAA,CAAI,GAAG,CAAA;AACxC,EAAI,IAAA,SAAA;AACJ,EAAA,IAAI,WAAa,EAAA;AAGf,IAAM,MAAA,EAAE,OAAU,GAAAA,qBAAA;AAClB,IAAA,SAAA,GAAY,GACT,CAAA,KAAA,CAAM,CAAG,EAAA,KAAK,CACd,CAAA,MAAA;AAAA,MACC,WAAA,CAAY,IAAI,CAAC,GAAA,KAAQ,cAAc,GAAI,CAAA,GAAG,CAAC,CAAC;AAAA,KAClD;AAAA,GACG,MAAA;AACL,IAAY,SAAA,GAAA,GAAA,CAAI,IAAI,aAAa,CAAA;AAAA;AAEnC,EAAA,SAAA,CAAU,UAAU,CAAA,GAAI,I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,EAAA;AAChD,IAAO,OAAA,cAAA,CAAe,WAAW,OAAO,CAAA;AAAA;AAE1C,EAAO,OAAA,KAAA,CAAA;AACT;;;;;"}
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
import { metadataKeys } from '@vuu-ui/vuu-utils';
|
|
2
2
|
|
|
3
3
|
const { KEY, RENDER_IDX, SELECTED } = metadataKeys;
|
|
4
|
+
const replaceBigInt = (value) => {
|
|
5
|
+
if (typeof value === "bigint") {
|
|
6
|
+
return value.toString();
|
|
7
|
+
} else {
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
4
11
|
const toClientRow = (row, keys, selectedRows, dataIndices) => {
|
|
5
12
|
const [rowIndex] = row;
|
|
6
13
|
const selectedAll = selectedRows.has("*");
|
|
7
14
|
let clientRow;
|
|
8
15
|
if (dataIndices) {
|
|
9
16
|
const { count } = metadataKeys;
|
|
10
|
-
clientRow = row.slice(0, count).concat(
|
|
17
|
+
clientRow = row.slice(0, count).concat(
|
|
18
|
+
dataIndices.map((idx) => replaceBigInt(row[idx]))
|
|
19
|
+
);
|
|
11
20
|
} else {
|
|
12
|
-
clientRow = row.
|
|
21
|
+
clientRow = row.map(replaceBigInt);
|
|
13
22
|
}
|
|
14
23
|
clientRow[RENDER_IDX] = keys.keyFor(rowIndex);
|
|
15
24
|
clientRow[SELECTED] = selectedAll || selectedRows.has(row[KEY]) ? 1 : 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array-data-utils.js","sources":["../../../../packages/vuu-data-local/src/array-data-source/array-data-utils.ts"],"sourcesContent":["import type { DataSourceRow } from \"@vuu-ui/vuu-data-types\";\nimport { ColumnMap, KeySet, metadataKeys } from \"@vuu-ui/vuu-utils\";\n\nconst { KEY, RENDER_IDX, SELECTED } = metadataKeys;\n\nexport const toClientRow = (\n row: DataSourceRow,\n keys: KeySet,\n selectedRows: Set<string>,\n dataIndices?: number[],\n) => {\n const [rowIndex] = row;\n const selectedAll = selectedRows.has(\"*\");\n let clientRow;\n if (dataIndices) {\n // If client has specified a different ordering of columns from the way they are\n // ordered inn the underlying data, this is where we effect the ordering.\n const { count } = metadataKeys;\n clientRow = row\n .slice(0, count)\n .concat(dataIndices.map((idx) => row[idx])) as DataSourceRow;\n } else {\n clientRow = row.
|
|
1
|
+
{"version":3,"file":"array-data-utils.js","sources":["../../../../packages/vuu-data-local/src/array-data-source/array-data-utils.ts"],"sourcesContent":["import type { DataSourceRow } from \"@vuu-ui/vuu-data-types\";\nimport { VuuRowDataItemType } from \"@vuu-ui/vuu-protocol-types\";\nimport { ColumnMap, KeySet, metadataKeys } from \"@vuu-ui/vuu-utils\";\n\nconst { KEY, RENDER_IDX, SELECTED } = metadataKeys;\n\nconst replaceBigInt = (\n value: VuuRowDataItemType | bigint,\n): VuuRowDataItemType => {\n if (typeof value === \"bigint\") {\n return value.toString();\n } else {\n return value;\n }\n};\n\nexport const toClientRow = (\n row: DataSourceRow,\n keys: KeySet,\n selectedRows: Set<string>,\n dataIndices?: number[],\n) => {\n const [rowIndex] = row;\n const selectedAll = selectedRows.has(\"*\");\n let clientRow;\n if (dataIndices) {\n // If client has specified a different ordering of columns from the way they are\n // ordered inn the underlying data, this is where we effect the ordering.\n const { count } = metadataKeys;\n clientRow = row\n .slice(0, count)\n .concat(\n dataIndices.map((idx) => replaceBigInt(row[idx])),\n ) as DataSourceRow;\n } else {\n clientRow = row.map(replaceBigInt) as DataSourceRow;\n }\n clientRow[RENDER_IDX] = keys.keyFor(rowIndex);\n clientRow[SELECTED] = selectedAll || selectedRows.has(row[KEY]) ? 1 : 0;\n return clientRow;\n};\n\nconst divergentMaps = (columnMap: ColumnMap, dataMap?: ColumnMap) => {\n if (dataMap) {\n const { count: mapOffset } = metadataKeys;\n for (const [columnName, index] of Object.entries(columnMap)) {\n const dataIdx = dataMap[columnName];\n if (dataIdx === undefined) {\n throw Error(\n `ArrayDataSource column ${columnName} is not in underlying data set`,\n );\n } else if (dataIdx !== index - mapOffset) {\n return true;\n }\n }\n }\n return false;\n};\n\nconst getDataIndices = (columnMap: ColumnMap, dataMap: ColumnMap) => {\n const { count: mapOffset } = metadataKeys;\n const result: number[] = [];\n Object.entries(columnMap).forEach(([columnName]) => {\n result.push(dataMap[columnName] + mapOffset);\n });\n return result;\n};\n\nexport const buildDataToClientMap = (\n columnMap: ColumnMap,\n dataMap?: ColumnMap,\n): number[] | undefined => {\n if (dataMap && divergentMaps(columnMap, dataMap)) {\n return getDataIndices(columnMap, dataMap);\n }\n return undefined;\n};\n"],"names":[],"mappings":";;AAIA,MAAM,EAAE,GAAA,EAAK,UAAY,EAAA,QAAA,EAAa,GAAA,YAAA;AAEtC,MAAM,aAAA,GAAgB,CACpB,KACuB,KAAA;AACvB,EAAI,IAAA,OAAO,UAAU,QAAU,EAAA;AAC7B,IAAA,OAAO,MAAM,QAAS,EAAA;AAAA,GACjB,MAAA;AACL,IAAO,OAAA,KAAA;AAAA;AAEX,CAAA;AAEO,MAAM,WAAc,GAAA,CACzB,GACA,EAAA,IAAA,EACA,cACA,WACG,KAAA;AACH,EAAM,MAAA,CAAC,QAAQ,CAAI,GAAA,GAAA;AACnB,EAAM,MAAA,WAAA,GAAc,YAAa,CAAA,GAAA,CAAI,GAAG,CAAA;AACxC,EAAI,IAAA,SAAA;AACJ,EAAA,IAAI,WAAa,EAAA;AAGf,IAAM,MAAA,EAAE,OAAU,GAAA,YAAA;AAClB,IAAA,SAAA,GAAY,GACT,CAAA,KAAA,CAAM,CAAG,EAAA,KAAK,CACd,CAAA,MAAA;AAAA,MACC,WAAA,CAAY,IAAI,CAAC,GAAA,KAAQ,cAAc,GAAI,CAAA,GAAG,CAAC,CAAC;AAAA,KAClD;AAAA,GACG,MAAA;AACL,IAAY,SAAA,GAAA,GAAA,CAAI,IAAI,aAAa,CAAA;AAAA;AAEnC,EAAA,SAAA,CAAU,UAAU,CAAA,GAAI,IAAK,CAAA,MAAA,CAAO,QAAQ,CAAA;AAC5C,EAAU,SAAA,C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AAE1C,EAAO,OAAA,KAAA,CAAA;AACT;;;;"}
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.13.115-alpha.
|
|
2
|
+
"version": "0.13.115-alpha.3",
|
|
3
3
|
"author": "heswell",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"devDependencies": {
|
|
6
|
-
"@vuu-ui/vuu-data-types": "0.13.115-alpha.
|
|
7
|
-
"@vuu-ui/vuu-table-types": "0.13.115-alpha.
|
|
8
|
-
"@vuu-ui/vuu-filter-types": "0.13.115-alpha.
|
|
9
|
-
"@vuu-ui/vuu-protocol-types": "0.13.115-alpha.
|
|
6
|
+
"@vuu-ui/vuu-data-types": "0.13.115-alpha.3",
|
|
7
|
+
"@vuu-ui/vuu-table-types": "0.13.115-alpha.3",
|
|
8
|
+
"@vuu-ui/vuu-filter-types": "0.13.115-alpha.3",
|
|
9
|
+
"@vuu-ui/vuu-protocol-types": "0.13.115-alpha.3"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@vuu-ui/vuu-filter-parser": "0.13.115-alpha.
|
|
13
|
-
"@vuu-ui/vuu-utils": "0.13.115-alpha.
|
|
12
|
+
"@vuu-ui/vuu-filter-parser": "0.13.115-alpha.3",
|
|
13
|
+
"@vuu-ui/vuu-utils": "0.13.115-alpha.3"
|
|
14
14
|
},
|
|
15
15
|
"sideEffects": false,
|
|
16
16
|
"files": [
|