@vuu-ui/vuu-data-types 2.1.19-beta.2 → 2.1.19-beta.4

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.
Files changed (2) hide show
  1. package/index.d.ts +83 -17
  2. package/package.json +3 -3
package/index.d.ts CHANGED
@@ -188,7 +188,9 @@ export declare type IsSelected = number;
188
188
  type Timestamp = number;
189
189
  type IsNew = boolean;
190
190
 
191
- export declare type DataSourceRow = [
191
+ export declare type DataSourceRow<
192
+ T extends bigint | VuuRowDataItemType = VuuRowDataItemType,
193
+ > = [
192
194
  RowIndex,
193
195
  RenderKey,
194
196
  IsLeaf,
@@ -199,9 +201,13 @@ export declare type DataSourceRow = [
199
201
  IsSelected,
200
202
  Timestamp,
201
203
  IsNew,
202
- ...VuuRowDataItemType[],
204
+ ...T[],
203
205
  ];
204
206
 
207
+ export declare type DataSourceRowWithBigint = DataSourceRow<
208
+ bigint | VuuRowDataItemType
209
+ >;
210
+
205
211
  export declare type DataSourceRowObject = {
206
212
  index: number;
207
213
  key: string;
@@ -381,6 +387,7 @@ export declare type ConfigChangeMessage =
381
387
  export declare type ConfigChangeHandler = (msg: ConfigChangeMessage) => void;
382
388
 
383
389
  export declare type SchemaColumn = {
390
+ editable?: boolean;
384
391
  name: string;
385
392
  serverDataType: VuuColumnDataType;
386
393
  };
@@ -496,8 +503,17 @@ export declare type DataSourceEvents = {
496
503
  "visual-link-removed": () => void;
497
504
  };
498
505
 
506
+ /**
507
+ * Controls how a row deletion is applied.
508
+ * - `"soft"` - marks the row as pending deletion (e.g. sets `vuuMsg` to `"SOFT_DELETED"`)
509
+ * without removing it from the table. The deletion is only committed when the edit
510
+ * session ends with `saveChanges = true`.
511
+ * - `"hard"` - removes the row from the table immediately and irreversibly.
512
+ */
513
+ export declare type DeleteRowMode = "soft" | "hard";
499
514
  export declare type DataSourceDeleteHandler = (
500
515
  key: string,
516
+ mode?: DeleteRowMode,
501
517
  ) => Promise<true | string>;
502
518
  export declare type DataSourceInsertHandler = (
503
519
  key: string,
@@ -558,6 +574,7 @@ export declare type DataSourceSuspenseProps = {
558
574
  * the existing component. e.g. directly edit cells within a table.
559
575
  */
560
576
  export declare type InlineEditSessionMode = "inline-all-rows";
577
+
561
578
  /**
562
579
  * A standalone edit session re-renders editable data in an edit component.
563
580
  * e.g an edit panel may be displayed in a dialog.
@@ -566,27 +583,79 @@ export declare type StandaloneEditSessionMode =
566
583
  | "selected-rows"
567
584
  | "all-rows"
568
585
  | "empty-session-table";
586
+
587
+ /**
588
+ * Short-form values accepted by the beginEditSession RPC (remote and local).
589
+ * The client-side EditApi maps the long-form StandaloneEditSessionMode values
590
+ * to one of these before dispatching the RPC call:
591
+ * - `"All"` ← `"all-rows"`
592
+ * - `"Empty"` ← `"empty-session-table"`
593
+ * - `"Selected"` ← `"selected-rows"`
594
+ * `"inline-all-rows"` is a client-only concept and is NOT mapped — it passes
595
+ * through to the RPC unchanged so the server can create an all-rows session table.
596
+ */
597
+ export declare type CopyOption = "All" | "Empty" | "Selected";
598
+ /**
599
+ * @deprecated Prefer `CopyOption` ("All" | "Empty" | "Selected") for standalone
600
+ * edit sessions supported by vuu server. Long-form values (e.g. `"all-rows"`) are used
601
+ * by `beginEditSession`; new code should use `CopyOption` with `createSessionDataSource`.
602
+ */
569
603
  export declare type EditSessionMode =
570
604
  | InlineEditSessionMode
571
605
  | StandaloneEditSessionMode;
572
606
 
573
- export interface EditApi {
607
+ export interface EditApi<
608
+ T extends DataSourceRow | DataSourceRowWithBigint = DataSourceRow,
609
+ > {
574
610
  beginEditSession?: (
575
611
  editSessionMode?: EditSessionMode,
576
- ) => Promise<DataSource | undefined>;
612
+ ) => Promise<DataSource<T> | undefined>;
613
+ addRow?: (
614
+ rowData?: Record<string, VuuRowDataItemType>,
615
+ ) => Promise<RpcResult> | undefined;
616
+ deleteRow?: (
617
+ key: string,
618
+ mode?: DeleteRowMode,
619
+ ) => Promise<RpcResult> | undefined;
620
+ deleteSelectedRows?: (mode?: DeleteRowMode) => Promise<RpcResult> | undefined;
577
621
  editCell?: (
578
622
  rowKey: string,
579
- colun: string,
623
+ column: string,
580
624
  value: VuuRowDataItemType,
581
625
  ) => Promise<RpcResult> | undefined;
626
+ undoRowChange?: (key: string) => Promise<RpcResult> | undefined;
627
+ /**
628
+ * Create a session datasource by requesting the server to create a session table
629
+ * via the `createSessionTable` RPC and wrapping the returned table.
630
+ */
631
+ createSessionDataSource?: (
632
+ copyOption: CopyOption,
633
+ ) => Promise<DataSource<T> | undefined>;
582
634
  endEditSession?: (
583
635
  saveChanges?: boolean,
584
636
  force?: boolean,
585
637
  ) => Promise<RpcResult> | undefined;
586
638
  }
587
639
 
588
- export interface DataSource
589
- extends EditApi,
640
+ /**
641
+ * Data payload returned in RpcResultSuccess.data by the beginEditSession service.
642
+ * Contains the server-assigned session table reference used to create the session datasource.
643
+ */
644
+ export declare type BeginEditSessionResult = {
645
+ table: VuuTable;
646
+ };
647
+
648
+ export declare type DeleteSelectedRowsResult = {
649
+ deletedKeys: string[];
650
+ };
651
+
652
+ export declare type UndoRowChangeResult = {
653
+ wasInsertedRow?: boolean;
654
+ };
655
+
656
+ export interface DataSourceBase<
657
+ T extends DataSourceRow | DataSourceRowWithBigint = DataSourceRow,
658
+ > extends EditApi<T>,
590
659
  IEventEmitter<DataSourceEvents>,
591
660
  Partial<TypeaheadSuggestionProvider> {
592
661
  aggregations: VuuAggregation[];
@@ -632,13 +701,6 @@ export interface DataSource
632
701
  resume?: (callback?: DataSourceSubscribeCallback) => void;
633
702
 
634
703
  deleteRow?: DataSourceDeleteHandler;
635
- /**
636
- * create a DataSource on a session table. The concrete DataSource implementation that
637
- * implements this method will always return a session table datasource of the same concrete type.
638
- * @param table the sessionTable (module and table name)
639
- * @returns
640
- */
641
- createSessionDataSource?: (table: VuuTable) => DataSource;
642
704
  /**
643
705
  * For a dataSource that has been previously disabled and is currently in disabled state , this will restore
644
706
  * the subscription to active status. Fresh data will be dispatched to client. The enable call optionally
@@ -676,16 +738,16 @@ export interface DataSource
676
738
  * @param visibleOnly
677
739
  * @returns
678
740
  */
679
- getChildRows?: (rowKey: string) => DataSourceRow[];
741
+ getChildRows?: (rowKey: string) => T[];
680
742
 
681
- getRowAtIndex?: (rowIndex: number) => DataSourceRow | undefined;
743
+ getRowAtIndex?: (rowIndex: number) => T | undefined;
682
744
  /**
683
745
  * Only implemented on JSON DataSource
684
746
  * @param depth
685
747
  * @param visibleOnly
686
748
  * @returns
687
749
  */
688
- getRowsAtDepth?: (depth: number, visibleOnly?: boolean) => DataSourceRow[];
750
+ getRowsAtDepth?: (depth: number, visibleOnly?: boolean) => T[];
689
751
  groupBy?: VuuGroupBy;
690
752
  insertRow?: DataSourceInsertHandler;
691
753
  links?: LinkDescriptorWithLabel[];
@@ -719,6 +781,10 @@ export interface DataSource
719
781
  visualLink?: LinkDescriptorWithLabel;
720
782
  }
721
783
 
784
+ export declare type DataSource =
785
+ | DataSourceBase
786
+ | DataSourceBase<DataSourceRowWithBigint>;
787
+
722
788
  export interface MenuRpcResponse<
723
789
  TAction extends MenuRpcAction = MenuRpcAction,
724
790
  > {
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@vuu-ui/vuu-data-types",
3
- "version": "2.1.19-beta.2",
3
+ "version": "2.1.19-beta.4",
4
4
  "author": "heswell",
5
5
  "license": "Apache-2.0",
6
6
  "devDependencies": {
7
- "@vuu-ui/vuu-filter-types": "2.1.19-beta.2",
8
- "@vuu-ui/vuu-protocol-types": "2.1.19-beta.2"
7
+ "@vuu-ui/vuu-filter-types": "2.1.19-beta.4",
8
+ "@vuu-ui/vuu-protocol-types": "2.1.19-beta.4"
9
9
  },
10
10
  "dependencies": {},
11
11
  "peerDependencies": {},