@vuu-ui/vuu-table-extras 3.3.3 → 3.3.5
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,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.3.
|
|
2
|
+
"version": "3.3.5",
|
|
3
3
|
"author": "heswell",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
@@ -11,19 +11,19 @@
|
|
|
11
11
|
"lezer-generate:column": "lezer-generator --output ./src/column-expression-input/column-language-parser/generated/column-parser.js ./src/column-expression-input/column-language-parser/grammar/column.grammar"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@vuu-ui/vuu-filter-types": "3.3.
|
|
15
|
-
"@vuu-ui/vuu-protocol-types": "3.3.
|
|
14
|
+
"@vuu-ui/vuu-filter-types": "3.3.5",
|
|
15
|
+
"@vuu-ui/vuu-protocol-types": "3.3.5"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@vuu-ui/vuu-codemirror": "3.3.
|
|
19
|
-
"@vuu-ui/vuu-data-editing": "3.3.
|
|
20
|
-
"@vuu-ui/vuu-data-react": "3.3.
|
|
21
|
-
"@vuu-ui/vuu-data-types": "3.3.
|
|
22
|
-
"@vuu-ui/vuu-table-types": "3.3.
|
|
23
|
-
"@vuu-ui/vuu-popups": "3.3.
|
|
24
|
-
"@vuu-ui/vuu-table": "3.3.
|
|
25
|
-
"@vuu-ui/vuu-utils": "3.3.
|
|
26
|
-
"@vuu-ui/vuu-ui-controls": "3.3.
|
|
18
|
+
"@vuu-ui/vuu-codemirror": "3.3.5",
|
|
19
|
+
"@vuu-ui/vuu-data-editing": "3.3.5",
|
|
20
|
+
"@vuu-ui/vuu-data-react": "3.3.5",
|
|
21
|
+
"@vuu-ui/vuu-data-types": "3.3.5",
|
|
22
|
+
"@vuu-ui/vuu-table-types": "3.3.5",
|
|
23
|
+
"@vuu-ui/vuu-popups": "3.3.5",
|
|
24
|
+
"@vuu-ui/vuu-table": "3.3.5",
|
|
25
|
+
"@vuu-ui/vuu-utils": "3.3.5",
|
|
26
|
+
"@vuu-ui/vuu-ui-controls": "3.3.5",
|
|
27
27
|
"@lezer/lr": "1.4.2",
|
|
28
28
|
"@salt-ds/core": "1.54.1",
|
|
29
29
|
"@salt-ds/lab": "1.0.0-alpha.83",
|
|
@@ -178,7 +178,7 @@ const exportSessionTableToCsv = async (dataSource, options = {})=>{
|
|
|
178
178
|
if (totalSize > maxRows) return void fail(new Error(`exportToCsv: row count ${totalSize} exceeds the ${maxRows} row limit`));
|
|
179
179
|
nextRequestedFrom = Math.min(CHUNK_SIZE, totalSize);
|
|
180
180
|
activeSessionDataSource.range = Range(0, nextRequestedFrom);
|
|
181
|
-
} else if ("batch" === message.mode && message.rows) {
|
|
181
|
+
} else if (("batch" === message.mode || "update" === message.mode) && message.rows) {
|
|
182
182
|
for (const row of message.rows){
|
|
183
183
|
const rowIndex = row[metadataKeys.IDX];
|
|
184
184
|
if ("number" == typeof rowIndex) collectedRows.set(rowIndex, row);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EditSession } from "@vuu-ui/vuu-data-editing";
|
|
2
|
-
import { isRpcError, isSessionTable, useData } from "@vuu-ui/vuu-utils";
|
|
2
|
+
import { Range, isRpcError, isSessionTable, useData } from "@vuu-ui/vuu-utils";
|
|
3
3
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { parseCsv } from "./parse/csv-parse.js";
|
|
5
5
|
import { validateCsvAgainstSchema } from "./parse/csv-schema-validation.js";
|
|
@@ -43,16 +43,31 @@ const useCsvUpload = ({ dataSource, importMode = "direct", importSchema, importT
|
|
|
43
43
|
resolvedImportSchema,
|
|
44
44
|
importTable
|
|
45
45
|
]);
|
|
46
|
-
const importDataSource = useMemo(()=>{
|
|
47
|
-
if (!sessionOverrides) return dataSource;
|
|
48
|
-
return {
|
|
46
|
+
const importDataSource = useMemo(()=>({
|
|
49
47
|
tableSchema: dataSource.tableSchema,
|
|
50
48
|
createSessionDataSource: async (copyOption, sessionType)=>{
|
|
51
49
|
if (!dataSource.createSessionDataSource) throw Error("[useCsvUpload] dataSource does not support createSessionDataSource");
|
|
52
|
-
|
|
50
|
+
const sessionDs = await dataSource.createSessionDataSource(copyOption, sessionType, sessionOverrides);
|
|
51
|
+
if (!sessionDs) throw Error("[useCsvUpload] Failed to create session datasource");
|
|
52
|
+
if (!sessionDs.columns.includes("vuuMsg")) sessionDs.columns = sessionDs.columns.concat("vuuMsg");
|
|
53
|
+
if (sessionDs.isRemote) return new Promise((resolve, reject)=>{
|
|
54
|
+
const handleSubscribed = ()=>{
|
|
55
|
+
sessionDs.removeListener("subscribed", handleSubscribed);
|
|
56
|
+
resolve(sessionDs);
|
|
57
|
+
};
|
|
58
|
+
sessionDs.on("subscribed", handleSubscribed);
|
|
59
|
+
try {
|
|
60
|
+
sessionDs.subscribe({
|
|
61
|
+
range: Range(0, 0)
|
|
62
|
+
}, ()=>{});
|
|
63
|
+
} catch (err) {
|
|
64
|
+
sessionDs.removeListener("subscribed", handleSubscribed);
|
|
65
|
+
reject(err);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
return sessionDs;
|
|
53
69
|
}
|
|
54
|
-
}
|
|
55
|
-
}, [
|
|
70
|
+
}), [
|
|
56
71
|
dataSource,
|
|
57
72
|
sessionOverrides
|
|
58
73
|
]);
|
|
@@ -95,8 +110,12 @@ const useCsvUpload = ({ dataSource, importMode = "direct", importSchema, importT
|
|
|
95
110
|
if (!sessionDataSource) throw Error("CsvUpload has no active edit session.");
|
|
96
111
|
if (!sessionDataSource.endEditSession) throw Error("CsvUpload requires the session datasource to support endEditSession.");
|
|
97
112
|
const currentSessionTable = sessionDataSource.table;
|
|
98
|
-
|
|
99
|
-
|
|
113
|
+
try {
|
|
114
|
+
await editSession.end(save);
|
|
115
|
+
} finally{
|
|
116
|
+
if ("unsubscribed" !== sessionDataSource.status) sessionDataSource.unsubscribe();
|
|
117
|
+
setActiveSessionDataSource(void 0);
|
|
118
|
+
}
|
|
100
119
|
onImportSessionEnded?.({
|
|
101
120
|
reason,
|
|
102
121
|
sessionTable: currentSessionTable && isSessionTable(currentSessionTable) ? currentSessionTable : void 0
|
|
@@ -160,7 +179,6 @@ const useCsvUpload = ({ dataSource, importMode = "direct", importSchema, importT
|
|
|
160
179
|
const sessionDataSource = await editSession.begin("Empty", "import");
|
|
161
180
|
const sessionVuuTable = sessionDataSource?.table;
|
|
162
181
|
if (void 0 === sessionDataSource || void 0 === sessionVuuTable || !isSessionTable(sessionVuuTable)) throw Error("CsvUpload createSessionDataSource returned no session datasource.");
|
|
163
|
-
if (!sessionDataSource.columns.includes("vuuMsg")) sessionDataSource.columns = sessionDataSource.columns.concat("vuuMsg");
|
|
164
182
|
setActiveSessionDataSource(sessionDataSource);
|
|
165
183
|
onImportSessionStarted?.(sessionDataSource);
|
|
166
184
|
return sessionDataSource;
|
|
@@ -52,7 +52,7 @@ const useInlineAddRow = ({ columns })=>{
|
|
|
52
52
|
cell?.querySelector("input, button, [tabindex]")?.focus();
|
|
53
53
|
}, []);
|
|
54
54
|
useEffect(()=>{
|
|
55
|
-
editSession.configureNewRow(visibleInsertColumns.map(({ name })=>name));
|
|
55
|
+
editSession.configureNewRow(visibleInsertColumns.map(({ name })=>name), visibleInsertColumns.filter((column)=>false !== column.required).map(({ name })=>name));
|
|
56
56
|
}, [
|
|
57
57
|
editSession,
|
|
58
58
|
visibleInsertColumns
|
|
@@ -62,7 +62,7 @@ export declare class ColumnModel extends EventEmitter<ColumnEvents> {
|
|
|
62
62
|
set searchPattern(pattern: string);
|
|
63
63
|
get searchPattern(): string;
|
|
64
64
|
get selectedColumns(): readonly ColumnDescriptor[];
|
|
65
|
-
setSelectedColumns(selectedColumns: ColumnDescriptor[], source: ColumnChangeSource, changeDescriptor?: SelectedColumnChangeDescriptor): void;
|
|
65
|
+
setSelectedColumns(selectedColumns: readonly ColumnDescriptor[], source: ColumnChangeSource, changeDescriptor?: SelectedColumnChangeDescriptor): void;
|
|
66
66
|
getColumn(name: string): ColumnDescriptor;
|
|
67
67
|
addItemToSelectedColumns(name: string, source: ColumnChangeSource): void;
|
|
68
68
|
removeItemFromSelectedColumns(name: string, source: ColumnChangeSource): void;
|
|
@@ -52,6 +52,7 @@ export declare const useInlineAddRow: ({ columns }: UseInlineAddRowProps) => {
|
|
|
52
52
|
status?: import("@salt-ds/core").ValidationStatus;
|
|
53
53
|
editableBulk?: import("@vuu-ui/vuu-data-types").BulkEdit;
|
|
54
54
|
name: string;
|
|
55
|
+
required?: boolean;
|
|
55
56
|
serverDataType?: import("@vuu-ui/vuu-protocol-types").VuuColumnDataType;
|
|
56
57
|
type?: import("@vuu-ui/vuu-data-types").DataValueType;
|
|
57
58
|
}[];
|