@updog/data-editor 0.1.28 → 0.1.30
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 +37 -6
- package/index.js +2377 -2354
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -2396,6 +2396,7 @@ declare class DataStore<TRow extends DataEditorRow = DataEditorRow> {
|
|
|
2396
2396
|
*/
|
|
2397
2397
|
insertRowServer(row: TRow, localPosition: number, anchorRowId: TRowId | undefined, insertPosition: 'above' | 'below', columnIds: string[]): Promise<TRowId>;
|
|
2398
2398
|
appendRows(sourceId: DataSourceId, newRows: TRow[], rowIdMap?: Map<number, TRowId>): TRowId[];
|
|
2399
|
+
seedInitialChanges(assignedRowIds: TRowId[], currentRows: TRow[], changes: InitialRowChange<TRow>[]): void;
|
|
2399
2400
|
upsertRows(sourceId: DataSourceId, newRows: TRow[], options?: {
|
|
2400
2401
|
anchorKey?: keyof TRow;
|
|
2401
2402
|
newRowIds?: TRowId[];
|
|
@@ -2662,14 +2663,37 @@ type DataEditorResult<TRow extends DataEditorRow = DataEditorRow> = {
|
|
|
2662
2663
|
invalid: number;
|
|
2663
2664
|
};
|
|
2664
2665
|
};
|
|
2666
|
+
/**
|
|
2667
|
+
* Describes the change state of a single row within a chunk, used to seed
|
|
2668
|
+
* the editor with a previously saved diff on load.
|
|
2669
|
+
*
|
|
2670
|
+
* The client passes current-state rows via `onChunk` and attaches change
|
|
2671
|
+
* descriptors to mark which rows were edited, added, or deleted in a
|
|
2672
|
+
* previous session. The SDK uses these to seed DirtyTracker so the diff
|
|
2673
|
+
* is visible from the first frame.
|
|
2674
|
+
*/
|
|
2675
|
+
type InitialRowChange<TRow extends DataEditorRow = DataEditorRow> = {
|
|
2676
|
+
/** Index of this row within the chunk's rows array. */
|
|
2677
|
+
index: number;
|
|
2678
|
+
/**
|
|
2679
|
+
* Original field values before the user's edits.
|
|
2680
|
+
* Only include fields that differ from the current row.
|
|
2681
|
+
* Presence of this field marks the row as "edited".
|
|
2682
|
+
*/
|
|
2683
|
+
originalValues?: Partial<TRow>;
|
|
2684
|
+
/** Marks this row as a new addition (not from backend). */
|
|
2685
|
+
isNew?: boolean;
|
|
2686
|
+
/** Marks this row as pending deletion. */
|
|
2687
|
+
isDeleted?: boolean;
|
|
2688
|
+
};
|
|
2665
2689
|
/**
|
|
2666
2690
|
* Options used to tag a chunk passed to `loadData`'s `onChunk` callback.
|
|
2667
|
-
* Sources are auto-registered on first encounter. Chunks without options
|
|
2668
|
-
* to "Existing Data".
|
|
2691
|
+
* Sources are auto-registered on first encounter. Chunks without options
|
|
2692
|
+
* (or options without `source`) go to "Existing Data".
|
|
2669
2693
|
*/
|
|
2670
|
-
type ChunkSourceOptions = {
|
|
2671
|
-
/** Display name for this data source.
|
|
2672
|
-
source
|
|
2694
|
+
type ChunkSourceOptions<TRow extends DataEditorRow = DataEditorRow> = {
|
|
2695
|
+
/** Display name for this data source. When omitted, chunk goes to the default backend source. */
|
|
2696
|
+
source?: string;
|
|
2673
2697
|
/** Stable identifier. Defaults to the `source` value when omitted. */
|
|
2674
2698
|
id?: string;
|
|
2675
2699
|
/** Whether the user can delete this source from the editor. @default false */
|
|
@@ -2681,6 +2705,8 @@ type ChunkSourceOptions = {
|
|
|
2681
2705
|
* @default false
|
|
2682
2706
|
*/
|
|
2683
2707
|
done?: boolean;
|
|
2708
|
+
/** Seed change state for specific rows in this chunk. Sparse: only rows that differ from backend. */
|
|
2709
|
+
changes?: InitialRowChange<TRow>[];
|
|
2684
2710
|
};
|
|
2685
2711
|
type DataSourceId = string;
|
|
2686
2712
|
type DataSourceState = {
|
|
@@ -2886,6 +2912,11 @@ type DataEditorBaseProps<TRow extends DataEditorRow = DataEditorRow> = {
|
|
|
2886
2912
|
* @default true
|
|
2887
2913
|
*/
|
|
2888
2914
|
enableAddRow?: boolean;
|
|
2915
|
+
/**
|
|
2916
|
+
* Show the "Add data source" button in the data sources panel.
|
|
2917
|
+
* @default true
|
|
2918
|
+
*/
|
|
2919
|
+
enableAddSource?: boolean;
|
|
2889
2920
|
/**
|
|
2890
2921
|
* Which file formats the user can import. `undefined` allows all formats,
|
|
2891
2922
|
* `false` disables import entirely.
|
|
@@ -3130,4 +3161,4 @@ declare function exportDataEditor<TRow extends DataEditorRow>(params: ExportPara
|
|
|
3130
3161
|
declare function DataEditor<TRow extends DataEditorRow = DataEditorRow>(allProps: DataEditorProps<TRow>): react_jsx_runtime.JSX.Element;
|
|
3131
3162
|
|
|
3132
3163
|
export { DataEditor, downloadExampleFile, exportDataEditor };
|
|
3133
|
-
export type { CellValidator, ChatContext, ChatErrorSummary, ChatResponseChunk, ChatRow, ChatRowStatus, ChunkSourceOptions, DataEditorChat, DataEditorColumn, DataEditorFormat, DataEditorInlineProps, DataEditorLocalStorage, DataEditorModalProps, DataEditorMode, DataEditorProps, DataEditorResult, DataEditorRow, DataEditorSourceResult, DataEditorTranslations, DataEditorVariant, RemoteSource, ResultRow, UpdogError, UpdogErrorCode, ValidationError, ValueMatchInput, ValueMatchOutput };
|
|
3164
|
+
export type { CellValidator, ChatContext, ChatErrorSummary, ChatResponseChunk, ChatRow, ChatRowStatus, ChunkSourceOptions, DataEditorChat, DataEditorColumn, DataEditorFormat, DataEditorInlineProps, DataEditorLocalStorage, DataEditorModalProps, DataEditorMode, DataEditorProps, DataEditorResult, DataEditorRow, DataEditorSourceResult, DataEditorTranslations, DataEditorVariant, InitialRowChange, RemoteSource, ResultRow, UpdogError, UpdogErrorCode, ValidationError, ValueMatchInput, ValueMatchOutput };
|