@updog/data-editor 0.1.77 → 0.1.79
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/index.css +1 -1
- package/index.d.ts +30 -19
- package/index.js +4009 -3940
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -475,7 +475,7 @@ declare var export_default = {
|
|
|
475
475
|
matchColumns: "Match columns",
|
|
476
476
|
matchColumnsOf: "Match columns ({{current}} of {{total}})",
|
|
477
477
|
matchValues: "Match values",
|
|
478
|
-
|
|
478
|
+
addOrUpdate: "Add or update",
|
|
479
479
|
},
|
|
480
480
|
uploadFile: {
|
|
481
481
|
parseError: "Failed to parse file",
|
|
@@ -560,10 +560,11 @@ declare var export_default = {
|
|
|
560
560
|
separator: "Separator",
|
|
561
561
|
separatedBy: "Values separated by",
|
|
562
562
|
},
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
"
|
|
563
|
+
addOrUpdate: {
|
|
564
|
+
addEvery: "Add every row",
|
|
565
|
+
addEveryHint:
|
|
566
|
+
"Every row becomes a new entry, even if it repeats one you already have.",
|
|
567
|
+
updateBy: "Update by {{column}}",
|
|
567
568
|
},
|
|
568
569
|
},
|
|
569
570
|
chat: {
|
|
@@ -1443,8 +1444,8 @@ type ChatErrorSummary = {
|
|
|
1443
1444
|
type ChatDataContext<TRow extends DataEditorRow = DataEditorRow> = {
|
|
1444
1445
|
/** Full column definitions. */
|
|
1445
1446
|
columns: DataEditorColumn[];
|
|
1446
|
-
/** Row identifier field. */
|
|
1447
|
-
primaryKey: keyof TRow;
|
|
1447
|
+
/** Row identifier field, or the list of fields that identify a row together. */
|
|
1448
|
+
primaryKey: keyof TRow | readonly (keyof TRow)[];
|
|
1448
1449
|
/** Total rows in the dataset. */
|
|
1449
1450
|
totalRowCount: number;
|
|
1450
1451
|
/** Rows in the current filtered view. */
|
|
@@ -1651,6 +1652,8 @@ type NormalizedColumn = DataEditorColumn & {
|
|
|
1651
1652
|
asyncConfig?: AsyncFunctionValidator[];
|
|
1652
1653
|
};
|
|
1653
1654
|
|
|
1655
|
+
type PrimaryKeyInput = string | readonly string[];
|
|
1656
|
+
|
|
1654
1657
|
type RegisterSourceOptions = {
|
|
1655
1658
|
name: string;
|
|
1656
1659
|
id?: DataSourceId;
|
|
@@ -2264,6 +2267,7 @@ type IValidator<TRow extends DataEditorRow = DataEditorRow> = {
|
|
|
2264
2267
|
validateColumn(field: string, oldValues: ReadonlyMap<TRowId, unknown>): void;
|
|
2265
2268
|
revalidateColumnChunked(field: string, oldValues: ReadonlyMap<TRowId, unknown>, newValues: ReadonlyMap<TRowId, unknown>, processor: ChunkedProcessor<TRowId>, onComplete: () => void): void;
|
|
2266
2269
|
removeRow(rowId: TRowId): void;
|
|
2270
|
+
replaceRow(rowId: TRowId): void;
|
|
2267
2271
|
setAsyncPort(port: AsyncValidationPort): void;
|
|
2268
2272
|
destroy(): void;
|
|
2269
2273
|
};
|
|
@@ -2334,7 +2338,7 @@ declare class SourceLifecycle<TRow extends DataEditorRow = DataEditorRow> {
|
|
|
2334
2338
|
restore(snapshot: SourceSnapshot<TRow>): void;
|
|
2335
2339
|
register(options: RegisterSourceOptions): DataSourceId;
|
|
2336
2340
|
trackAppend(sourceId: DataSourceId, rowIds: TRowId[], rows: TRow[], usedIdMap: boolean): void;
|
|
2337
|
-
trackPrimaryKey(sourceId: DataSourceId, primaryKey:
|
|
2341
|
+
trackPrimaryKey(sourceId: DataSourceId, primaryKey: string[]): void;
|
|
2338
2342
|
finalize(sourceId: DataSourceId): Promise<void>;
|
|
2339
2343
|
private pushImportCommandIfTracked;
|
|
2340
2344
|
private removeInternal;
|
|
@@ -2401,6 +2405,11 @@ type ApplyFormulaOptions = {
|
|
|
2401
2405
|
*/
|
|
2402
2406
|
readonly deleteColumnsAfter?: readonly string[];
|
|
2403
2407
|
};
|
|
2408
|
+
type UpsertOptions = {
|
|
2409
|
+
anchorKey?: PrimaryKeyInput;
|
|
2410
|
+
newRowIds?: TRowId[];
|
|
2411
|
+
skipRowValidation?: boolean;
|
|
2412
|
+
};
|
|
2404
2413
|
declare class DataStore<TRow extends DataEditorRow = DataEditorRow> {
|
|
2405
2414
|
private readonly _mode;
|
|
2406
2415
|
isServer(): boolean;
|
|
@@ -2421,12 +2430,13 @@ declare class DataStore<TRow extends DataEditorRow = DataEditorRow> {
|
|
|
2421
2430
|
private serverCounts;
|
|
2422
2431
|
private editBuilder;
|
|
2423
2432
|
private isUndoRedoing;
|
|
2433
|
+
private anchorMapCache;
|
|
2424
2434
|
private pendingBatchCommands;
|
|
2425
2435
|
private _version;
|
|
2426
2436
|
private _skipNotify;
|
|
2427
2437
|
private _bulkMode;
|
|
2428
2438
|
private _editedCells;
|
|
2429
|
-
private
|
|
2439
|
+
private _primaryKeyFields;
|
|
2430
2440
|
/** Columns that are currently locked (pre-locked from schema + user-locked at runtime). */
|
|
2431
2441
|
private _lockedColumns;
|
|
2432
2442
|
/** Columns locked via schema definition — user cannot unlock these. */
|
|
@@ -2463,7 +2473,7 @@ declare class DataStore<TRow extends DataEditorRow = DataEditorRow> {
|
|
|
2463
2473
|
getRowId(index: number): TRowId | undefined;
|
|
2464
2474
|
getLocalRowCount(): number;
|
|
2465
2475
|
setValidator(validator: IValidator<TRow>): void;
|
|
2466
|
-
setPrimaryKey(key:
|
|
2476
|
+
setPrimaryKey(key: PrimaryKeyInput): void;
|
|
2467
2477
|
isColumnLocked(field: string): boolean;
|
|
2468
2478
|
isColumnPreLocked(field: string): boolean;
|
|
2469
2479
|
lockColumn(field: string, mode?: ColumnLockMode): void;
|
|
@@ -2601,10 +2611,10 @@ declare class DataStore<TRow extends DataEditorRow = DataEditorRow> {
|
|
|
2601
2611
|
insertRowServer(row: TRow, localPosition: number, anchorRowId: TRowId | undefined, insertPosition: "above" | "below", columnIds: string[]): Promise<TRowId>;
|
|
2602
2612
|
appendRows(sourceId: DataSourceId, newRows: TRow[], rowIdMap?: Map<number, TRowId>): TRowId[];
|
|
2603
2613
|
seedInitialChanges(assignedRowIds: TRowId[], currentRows: TRow[], changes: InitialRowChange<TRow>[]): void;
|
|
2604
|
-
upsertRows(sourceId: DataSourceId, newRows: TRow[], options?:
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2614
|
+
upsertRows(sourceId: DataSourceId, newRows: TRow[], options?: UpsertOptions): UpsertResult<TRow>;
|
|
2615
|
+
private getAnchorMap;
|
|
2616
|
+
private clearAnchorMapCache;
|
|
2617
|
+
private upsertRowsInner;
|
|
2608
2618
|
setLoading(isLoading: boolean): void;
|
|
2609
2619
|
setPhase(phase: ProcessingPhase, info?: ProcessingInfo): void;
|
|
2610
2620
|
getPhase(): ProcessingPhase;
|
|
@@ -2675,6 +2685,7 @@ declare class DataStore<TRow extends DataEditorRow = DataEditorRow> {
|
|
|
2675
2685
|
*/
|
|
2676
2686
|
updateColumnDirect(field: string, values: ReadonlyMap<TRowId, unknown>): void;
|
|
2677
2687
|
batch(fn: () => void): number | undefined;
|
|
2688
|
+
private batched;
|
|
2678
2689
|
canUndo(): boolean;
|
|
2679
2690
|
getAllRowIds(): readonly TRowId[];
|
|
2680
2691
|
undo(): Promise<UndoRedoResult>;
|
|
@@ -2729,7 +2740,7 @@ declare class DataStore<TRow extends DataEditorRow = DataEditorRow> {
|
|
|
2729
2740
|
private _applyChatOpsViaWorker;
|
|
2730
2741
|
private _applyChatOpsSync;
|
|
2731
2742
|
private _commitChatOps;
|
|
2732
|
-
applyChatRows(incomingRows: Record<string, unknown>[], primaryKey:
|
|
2743
|
+
applyChatRows(incomingRows: Record<string, unknown>[], primaryKey: PrimaryKeyInput): Promise<void>;
|
|
2733
2744
|
private syncChatTransformToServer;
|
|
2734
2745
|
private get revertRowReader();
|
|
2735
2746
|
revertColumns(fields: string[]): Promise<void>;
|
|
@@ -3127,11 +3138,11 @@ type DataEditorBaseProps<TRow extends DataEditorRow = DataEditorRow> = {
|
|
|
3127
3138
|
/** Column definitions. Each entry describes one column in the grid. */
|
|
3128
3139
|
columns: DataEditorColumn[];
|
|
3129
3140
|
/**
|
|
3130
|
-
* The column
|
|
3131
|
-
* `"
|
|
3132
|
-
*
|
|
3141
|
+
* The column or columns that uniquely identify a row (`"id"`, or
|
|
3142
|
+
* `["orgId", "externalId"]`). Used to match imported rows against existing
|
|
3143
|
+
* data. A row matches only when every listed column matches.
|
|
3133
3144
|
*/
|
|
3134
|
-
primaryKey: keyof TRow;
|
|
3145
|
+
primaryKey: keyof TRow | readonly (keyof TRow)[];
|
|
3135
3146
|
/**
|
|
3136
3147
|
* Async function that feeds data into the editor. Called once when the editor opens.
|
|
3137
3148
|
* Call `onChunk` one or more times to stream rows in batches.
|