@vuu-ui/vuu-data-types 2.3.0 → 3.0.0-beta.2

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 +50 -58
  2. package/package.json +3 -3
package/index.d.ts CHANGED
@@ -1,9 +1,3 @@
1
- import type {
2
- DataSourceFilter,
3
- MenuRpcResponse,
4
- Selection,
5
- TableSchema,
6
- } from "@vuu-ui/vuu-data-types";
7
1
  import type { Filter } from "@vuu-ui/vuu-filter-types";
8
2
  import type {
9
3
  LinkDescriptorWithLabel,
@@ -60,7 +54,7 @@ export declare type DataValueValidationResult =
60
54
  | DataValueValidationFailResult;
61
55
 
62
56
  export declare type DataValueValidationChecker = (
63
- value?: VuuRowDataItemType,
57
+ value: VuuRowDataItemType | undefined,
64
58
  phase: EditPhase | "*",
65
59
  ) => DataValueValidationResult;
66
60
 
@@ -135,8 +129,19 @@ export declare type DateTimeDataValueType =
135
129
 
136
130
  export declare type BulkEdit = "bulk" | false | "read-only";
137
131
 
132
+ /**
133
+ * Controls whether a data value can be edited for row insertion and/or update.
134
+ * A boolean applies the same permission to both operations.
135
+ */
136
+ export declare type DataEditable =
137
+ | boolean
138
+ | {
139
+ insert: boolean;
140
+ update: boolean;
141
+ };
142
+
138
143
  export interface DataValueDescriptor {
139
- editable?: boolean;
144
+ editable?: DataEditable;
140
145
  /**
141
146
  There are three values for editableBulk.
142
147
  - false user will not see these values when applying a bulk edit.
@@ -222,8 +227,7 @@ export interface MessageWithClientViewportId {
222
227
  clientViewportId: string;
223
228
  }
224
229
 
225
- export interface DataSourceAggregateMessage
226
- extends MessageWithClientViewportId {
230
+ export interface DataSourceAggregateMessage extends MessageWithClientViewportId {
227
231
  aggregations: VuuAggregation[];
228
232
  type: "aggregate";
229
233
  }
@@ -280,8 +284,7 @@ export interface DataSourceGroupByMessage extends MessageWithClientViewportId {
280
284
  groupBy: VuuGroupBy | undefined;
281
285
  }
282
286
 
283
- export interface DataSourceSetConfigMessage
284
- extends MessageWithClientViewportId {
287
+ export interface DataSourceSetConfigMessage extends MessageWithClientViewportId {
285
288
  type: "config";
286
289
  config: WithFullConfig;
287
290
  }
@@ -300,14 +303,12 @@ export interface DataSourceSortMessage extends MessageWithClientViewportId {
300
303
  sort: VuuSort;
301
304
  }
302
305
 
303
- export interface DataSourceSubscribeFailedMessage
304
- extends MessageWithClientViewportId {
306
+ export interface DataSourceSubscribeFailedMessage extends MessageWithClientViewportId {
305
307
  type: "subscribe-failed";
306
308
  msg: string;
307
309
  }
308
310
 
309
- export interface DataSourceSubscribedMessage
310
- extends MessageWithClientViewportId {
311
+ export interface DataSourceSubscribedMessage extends MessageWithClientViewportId {
311
312
  aggregations: VuuAggregation[];
312
313
  columns: VuuColumns;
313
314
  filterSpec: DataSourceFilter;
@@ -318,21 +319,18 @@ export interface DataSourceSubscribedMessage
318
319
  type: "subscribed";
319
320
  }
320
321
 
321
- export interface DataSourceVisualLinkCreatedMessage
322
- extends MessageWithClientViewportId {
322
+ export interface DataSourceVisualLinkCreatedMessage extends MessageWithClientViewportId {
323
323
  colName: string;
324
324
  parentViewportId: string;
325
325
  parentColName: string;
326
326
  type: "vuu-link-created";
327
327
  }
328
328
 
329
- export interface DataSourceVisualLinkRemovedMessage
330
- extends MessageWithClientViewportId {
329
+ export interface DataSourceVisualLinkRemovedMessage extends MessageWithClientViewportId {
331
330
  type: "vuu-link-removed";
332
331
  }
333
332
 
334
- export interface DataSourceVisualLinksMessage
335
- extends MessageWithClientViewportId {
333
+ export interface DataSourceVisualLinksMessage extends MessageWithClientViewportId {
336
334
  type: "vuu-links";
337
335
  links: VuuLinkDescriptor[];
338
336
  }
@@ -441,8 +439,7 @@ export interface WithSort extends DataSourceConfig {
441
439
  sort: VuuSort;
442
440
  }
443
441
 
444
- export interface DataSourceConstructorProps
445
- extends WithBaseFilter<DataSourceConfig> {
442
+ export interface DataSourceConstructorProps extends WithBaseFilter<DataSourceConfig> {
446
443
  /**
447
444
  * If provided, these column names will always be included in subscription, even
448
445
  * if not directly requested, via columns property. Useful where columns may not
@@ -464,8 +461,15 @@ export interface DataSourceConstructorProps
464
461
  viewport?: string;
465
462
  }
466
463
 
467
- export interface DataSourceSubscribeProps
468
- extends Partial<WithBaseFilter<WithFullConfig>> {
464
+ export interface RemoteModuleConnection {
465
+ connectionId: string;
466
+ restUrl?: string;
467
+ websocketUrl?: string;
468
+ }
469
+
470
+ export interface DataSourceSubscribeProps extends Partial<
471
+ WithBaseFilter<WithFullConfig>
472
+ > {
469
473
  viewport?: string;
470
474
  range?: Range;
471
475
  revealSelected?: boolean;
@@ -578,47 +582,22 @@ export declare type DataSourceSuspenseProps = {
578
582
  escalateDelay?: number;
579
583
  };
580
584
 
581
- /**
582
- * An inline edit session allows user to apply edits directly to
583
- * the existing component. e.g. directly edit cells within a table.
584
- */
585
- export declare type InlineEditSessionMode = "inline-all-rows";
585
+ /** Controls which source rows are copied into a newly created session table. */
586
+ export declare type CopyOption = "All" | "Empty" | "Selected";
586
587
 
587
588
  /**
588
- * A standalone edit session re-renders editable data in an edit component.
589
- * e.g an edit panel may be displayed in a dialog.
589
+ * Wire-level values used by the legacy beginEditSession menu/server service.
590
+ * Client edit lifecycles use CopyOption with createSessionDataSource instead.
590
591
  */
591
- export declare type StandaloneEditSessionMode =
592
+ export declare type EditSessionMode =
593
+ | "inline-all-rows"
592
594
  | "selected-rows"
593
595
  | "all-rows"
594
596
  | "empty-session-table";
595
597
 
596
- /**
597
- * Short-form values accepted by the beginEditSession RPC (remote and local).
598
- * The client-side EditApi maps the long-form StandaloneEditSessionMode values
599
- * to one of these before dispatching the RPC call:
600
- * - `"All"` ← `"all-rows"`
601
- * - `"Empty"` ← `"empty-session-table"`
602
- * - `"Selected"` ← `"selected-rows"`
603
- * `"inline-all-rows"` is a client-only concept and is NOT mapped — it passes
604
- * through to the RPC unchanged so the server can create an all-rows session table.
605
- */
606
- export declare type CopyOption = "All" | "Empty" | "Selected";
607
- /**
608
- * @deprecated Prefer `CopyOption` ("All" | "Empty" | "Selected") for standalone
609
- * edit sessions supported by vuu server. Long-form values (e.g. `"all-rows"`) are used
610
- * by `beginEditSession`; new code should use `CopyOption` with `createSessionDataSource`.
611
- */
612
- export declare type EditSessionMode =
613
- | InlineEditSessionMode
614
- | StandaloneEditSessionMode;
615
-
616
598
  export interface EditApi<
617
599
  T extends DataSourceRow | DataSourceRowWithBigint = DataSourceRow,
618
600
  > {
619
- beginEditSession?: (
620
- editSessionMode?: EditSessionMode,
621
- ) => Promise<DataSource<T> | undefined>;
622
601
  addRow?: (
623
602
  rowData?: Record<string, VuuRowDataItemType>,
624
603
  ) => Promise<RpcResult> | undefined;
@@ -640,6 +619,12 @@ export interface EditApi<
640
619
  createSessionDataSource?: (
641
620
  copyOption: CopyOption,
642
621
  ) => Promise<DataSource<T> | undefined>;
622
+ /**
623
+ * Legacy session creation API. Prefer createSessionDataSource for new servers.
624
+ */
625
+ beginEditSession?: (
626
+ editSessionMode?: EditSessionMode,
627
+ ) => Promise<DataSource<T> | undefined>;
643
628
  endEditSession?: (
644
629
  saveChanges?: boolean,
645
630
  force?: boolean,
@@ -664,7 +649,9 @@ export declare type UndoRowChangeResult = {
664
649
 
665
650
  export interface DataSourceBase<
666
651
  T extends DataSourceRow | DataSourceRowWithBigint = DataSourceRow,
667
- > extends EditApi<T>,
652
+ >
653
+ extends
654
+ EditApi<T>,
668
655
  IEventEmitter<DataSourceEvents>,
669
656
  Partial<TypeaheadSuggestionProvider> {
670
657
  aggregations: VuuAggregation[];
@@ -708,6 +695,11 @@ export interface DataSourceBase<
708
695
  */
709
696
  suspend?: (escalateToDisable?: boolean, escalateDelay?: number) => void;
710
697
  resume?: (callback?: DataSourceSubscribeCallback) => void;
698
+ /**
699
+ * Returns true when this datasource is a transient session datasource
700
+ * created by the supplied source datasource.
701
+ */
702
+ isSessionDataSourceOf?: (dataSource: DataSource) => boolean;
711
703
 
712
704
  deleteRow?: DataSourceDeleteHandler;
713
705
  /**
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@vuu-ui/vuu-data-types",
3
- "version": "2.3.0",
3
+ "version": "3.0.0-beta.2",
4
4
  "author": "heswell",
5
5
  "license": "Apache-2.0",
6
6
  "devDependencies": {
7
- "@vuu-ui/vuu-filter-types": "2.3.0",
8
- "@vuu-ui/vuu-protocol-types": "2.3.0"
7
+ "@vuu-ui/vuu-filter-types": "3.0.0-beta.2",
8
+ "@vuu-ui/vuu-protocol-types": "3.0.0-beta.2"
9
9
  },
10
10
  "dependencies": {},
11
11
  "peerDependencies": {},