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

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 +74 -12
  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,68 @@ 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 EditSessionModeAlias = "All" | "Empty" | "Selected";
569
598
  export declare type EditSessionMode =
570
599
  | InlineEditSessionMode
571
- | StandaloneEditSessionMode;
600
+ | StandaloneEditSessionMode
601
+ | EditSessionModeAlias;
572
602
 
573
- export interface EditApi {
603
+ export interface EditApi<
604
+ T extends DataSourceRow | DataSourceRowWithBigint = DataSourceRow,
605
+ > {
574
606
  beginEditSession?: (
575
607
  editSessionMode?: EditSessionMode,
576
- ) => Promise<DataSource | undefined>;
608
+ ) => Promise<DataSource<T> | undefined>;
609
+ addRow?: (
610
+ rowData?: Record<string, VuuRowDataItemType>,
611
+ ) => Promise<RpcResult> | undefined;
612
+ deleteRow?: (
613
+ key: string,
614
+ mode?: DeleteRowMode,
615
+ ) => Promise<RpcResult> | undefined;
616
+ deleteSelectedRows?: (mode?: DeleteRowMode) => Promise<RpcResult> | undefined;
577
617
  editCell?: (
578
618
  rowKey: string,
579
- colun: string,
619
+ column: string,
580
620
  value: VuuRowDataItemType,
581
621
  ) => Promise<RpcResult> | undefined;
622
+ undoRowChange?: (key: string) => Promise<RpcResult> | undefined;
582
623
  endEditSession?: (
583
624
  saveChanges?: boolean,
584
625
  force?: boolean,
585
626
  ) => Promise<RpcResult> | undefined;
586
627
  }
587
628
 
588
- export interface DataSource
589
- extends EditApi,
629
+ /**
630
+ * Data payload returned in RpcResultSuccess.data by the beginEditSession service.
631
+ * Contains the server-assigned session table reference used to create the session datasource.
632
+ */
633
+ export declare type BeginEditSessionResult = {
634
+ table: VuuTable;
635
+ };
636
+
637
+ export declare type DeleteSelectedRowsResult = {
638
+ deletedKeys: string[];
639
+ };
640
+
641
+ export declare type UndoRowChangeResult = {
642
+ wasInsertedRow?: boolean;
643
+ };
644
+
645
+ export interface DataSourceBase<
646
+ T extends DataSourceRow | DataSourceRowWithBigint = DataSourceRow,
647
+ > extends EditApi<T>,
590
648
  IEventEmitter<DataSourceEvents>,
591
649
  Partial<TypeaheadSuggestionProvider> {
592
650
  aggregations: VuuAggregation[];
@@ -638,7 +696,7 @@ export interface DataSource
638
696
  * @param table the sessionTable (module and table name)
639
697
  * @returns
640
698
  */
641
- createSessionDataSource?: (table: VuuTable) => DataSource;
699
+ createSessionDataSource?: (table: VuuTable) => DataSource<T>;
642
700
  /**
643
701
  * For a dataSource that has been previously disabled and is currently in disabled state , this will restore
644
702
  * the subscription to active status. Fresh data will be dispatched to client. The enable call optionally
@@ -676,16 +734,16 @@ export interface DataSource
676
734
  * @param visibleOnly
677
735
  * @returns
678
736
  */
679
- getChildRows?: (rowKey: string) => DataSourceRow[];
737
+ getChildRows?: (rowKey: string) => T[];
680
738
 
681
- getRowAtIndex?: (rowIndex: number) => DataSourceRow | undefined;
739
+ getRowAtIndex?: (rowIndex: number) => T | undefined;
682
740
  /**
683
741
  * Only implemented on JSON DataSource
684
742
  * @param depth
685
743
  * @param visibleOnly
686
744
  * @returns
687
745
  */
688
- getRowsAtDepth?: (depth: number, visibleOnly?: boolean) => DataSourceRow[];
746
+ getRowsAtDepth?: (depth: number, visibleOnly?: boolean) => T[];
689
747
  groupBy?: VuuGroupBy;
690
748
  insertRow?: DataSourceInsertHandler;
691
749
  links?: LinkDescriptorWithLabel[];
@@ -719,6 +777,10 @@ export interface DataSource
719
777
  visualLink?: LinkDescriptorWithLabel;
720
778
  }
721
779
 
780
+ export declare type DataSource =
781
+ | DataSourceBase
782
+ | DataSourceBase<DataSourceRowWithBigint>;
783
+
722
784
  export interface MenuRpcResponse<
723
785
  TAction extends MenuRpcAction = MenuRpcAction,
724
786
  > {
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.3",
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.3",
8
+ "@vuu-ui/vuu-protocol-types": "2.1.19-beta.3"
9
9
  },
10
10
  "dependencies": {},
11
11
  "peerDependencies": {},