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