@vuu-ui/vuu-data-types 0.8.94 → 0.8.95

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 +80 -50
  2. package/package.json +3 -3
package/index.d.ts CHANGED
@@ -1,8 +1,16 @@
1
+ import type {
2
+ DataSourceFilter,
3
+ MenuRpcResponse,
4
+ Selection,
5
+ TableSchema,
6
+ } from "@vuu-ui/vuu-data-types";
1
7
  import type { Filter } from "@vuu-ui/vuu-filter-types";
2
8
  import type { MenuActionClosePopup } from "@vuu-ui/vuu-popups";
3
9
  import type {
10
+ LinkDescriptorWithLabel,
4
11
  NoAction,
5
12
  OpenDialogAction,
13
+ TypeAheadMethod,
6
14
  VuuAggregation,
7
15
  VuuColumnDataType,
8
16
  VuuColumns,
@@ -11,7 +19,10 @@ import type {
11
19
  VuuGroupBy,
12
20
  VuuLinkDescriptor,
13
21
  VuuMenu,
22
+ VuuRange,
14
23
  VuuRowDataItemType,
24
+ VuuRpcRequest,
25
+ VuuRpcViewportResponse,
15
26
  VuuSort,
16
27
  VuuTable,
17
28
  VuuRpcRequest,
@@ -32,13 +43,10 @@ import type {
32
43
  import type {
33
44
  VuuTableListRequest,
34
45
  VuuTableMetaRequest,
35
- LinkDescriptorWithLabel,
36
- VuuRpcViewportResponse,
37
- TypeAheadMethod,
38
- VuuRange,
39
46
  } from "@vuu-ui/vuu-protocol-types";
40
47
  import { DataValueTypeDescriptor } from "@vuu-ui/vuu-table-types";
41
48
  import { PostMessageToClientCallback } from "@vuu-ui/vuu-data-remote";
49
+ import type { DataSourceConfigChanges, IEventEmitter } from "@vuu-ui/vuu-utils";
42
50
 
43
51
  export declare type DataValueValidationSuccessResult = {
44
52
  ok: true;
@@ -162,9 +170,9 @@ type IsExpanded = boolean;
162
170
  type Depth = number;
163
171
  type ChildCount = number;
164
172
  type RowKey = string;
165
- export type IsSelected = number;
173
+ export declare type IsSelected = number;
166
174
 
167
- export type DataSourceRow = [
175
+ export declare type DataSourceRow = [
168
176
  RowIndex,
169
177
  RenderKey,
170
178
  IsLeaf,
@@ -176,7 +184,7 @@ export type DataSourceRow = [
176
184
  ...VuuRowDataItemType[],
177
185
  ];
178
186
 
179
- export type DataSourceRowObject = {
187
+ export declare type DataSourceRowObject = {
180
188
  index: number;
181
189
  key: string;
182
190
  isGroupRow: boolean;
@@ -184,7 +192,7 @@ export type DataSourceRowObject = {
184
192
  data: VuuDataRowDto;
185
193
  };
186
194
 
187
- export type DataSourceRowPredicate = (row: DataSourceRow) => boolean;
195
+ export declare type DataSourceRowPredicate = (row: DataSourceRow) => boolean;
188
196
 
189
197
  export interface ContextMenuItemBase {
190
198
  className?: string;
@@ -198,7 +206,7 @@ export interface ContextMenuLeafItemDescriptor extends ContextMenuItemBase {
198
206
  options?: unknown;
199
207
  }
200
208
 
201
- export type ContextMenuItemDescriptor =
209
+ export declare type ContextMenuItemDescriptor =
202
210
  | ContextMenuLeafItemDescriptor
203
211
  | ContextMenuGroupItemDescriptor;
204
212
 
@@ -216,13 +224,19 @@ export interface DataSourceAggregateMessage
216
224
  type: "aggregate";
217
225
  }
218
226
 
219
- export type DataUpdateMode = "batch" | "update" | "size-only";
227
+ export declare type DataUpdateMode = "batch" | "update" | "size-only";
220
228
 
221
229
  export interface DataSourceClearMessage extends MessageWithClientViewportId {
222
230
  type: "viewport-clear";
223
231
  }
224
232
  export interface DataSourceDataMessage extends MessageWithClientViewportId {
225
233
  mode: DataUpdateMode;
234
+ /**
235
+ * this is needed by the ArrayDataSource, biut not currently used by VuuDataSource.
236
+ * Suspect it will be valuable in any DtaSOurce and should eventually be made a
237
+ * required field.
238
+ */
239
+ range?: VuuRange;
226
240
  rows?: DataSourceRow[];
227
241
  size?: number;
228
242
  type: "viewport-update";
@@ -306,11 +320,11 @@ export interface DataSourceVisualLinksMessage
306
320
  links: VuuLinkDescriptor[];
307
321
  }
308
322
 
309
- export type VuuFeatureMessage =
323
+ export declare type VuuFeatureMessage =
310
324
  | DataSourceMenusMessage
311
325
  | DataSourceVisualLinksMessage;
312
326
 
313
- export type DataSourceConfigMessage =
327
+ export declare type DataSourceConfigMessage =
314
328
  | DataSourceAggregateMessage
315
329
  | DataSourceColumnsMessage
316
330
  | DataSourceFilterMessage
@@ -321,7 +335,7 @@ export type DataSourceConfigMessage =
321
335
  /**
322
336
  * Messages which are routed back to the DataSource
323
337
  */
324
- export type DataSourceCallbackMessage =
338
+ export declare type DataSourceCallbackMessage =
325
339
  | DataSourceConfigMessage
326
340
  | DataSourceColumnsMessage
327
341
  | DataSourceDataMessage
@@ -335,12 +349,12 @@ export type DataSourceCallbackMessage =
335
349
  | DataSourceVisualLinkRemovedMessage
336
350
  | DataSourceVisualLinksMessage;
337
351
 
338
- export type ConfigChangeColumnsMessage = {
352
+ export declare type ConfigChangeColumnsMessage = {
339
353
  type: "columns";
340
354
  columns?: ColumnDescriptor[];
341
355
  };
342
356
 
343
- export type ConfigChangeMessage =
357
+ export declare type ConfigChangeMessage =
344
358
  | ConfigChangeColumnsMessage
345
359
  | DataSourceAggregateMessage
346
360
  | DataSourceFilterMessage
@@ -349,7 +363,7 @@ export type ConfigChangeMessage =
349
363
  | DataSourceVisualLinkCreatedMessage
350
364
  | DataSourceVisualLinkRemovedMessage;
351
365
 
352
- export type ConfigChangeHandler = (msg: ConfigChangeMessage) => void;
366
+ export declare type ConfigChangeHandler = (msg: ConfigChangeMessage) => void;
353
367
 
354
368
  /**
355
369
  * MenuBuilder describes a factory function that creates
@@ -358,7 +372,7 @@ export type ConfigChangeHandler = (msg: ConfigChangeMessage) => void;
358
372
  * can be used to determine which Menu Items to include
359
373
  * in the menu. Most often used for ContextMenus.
360
374
  */
361
- export type MenuBuilder<L = string, O = unknown> = (
375
+ export declare type MenuBuilder<L = string, O = unknown> = (
362
376
  location: L,
363
377
  options: O,
364
378
  ) => ContextMenuItemDescriptor[];
@@ -371,7 +385,7 @@ export type MenuBuilder<L = string, O = unknown> = (
371
385
  * It should return true if it handled this MenuItem. This allows multiple Menu-
372
386
  * ActionHandlers to be chained.
373
387
  */
374
- export type MenuActionHandler = (
388
+ export declare type MenuActionHandler = (
375
389
  reason: MenuActionClosePopup,
376
390
  ) => boolean | undefined;
377
391
 
@@ -380,7 +394,7 @@ export interface ContextMenuContextType {
380
394
  menuActionHandler: MenuActionHandler;
381
395
  }
382
396
 
383
- export type SchemaColumn = {
397
+ export declare type SchemaColumn = {
384
398
  name: string;
385
399
  serverDataType: VuuColumnDataType;
386
400
  };
@@ -389,11 +403,11 @@ export type SchemaColumn = {
389
403
  * session will be present for session tables only, in which case the table
390
404
  * name represents the 'archetype' table name.
391
405
  */
392
- export type TableSchemaTable = VuuTable & {
406
+ export declare type TableSchemaTable = VuuTable & {
393
407
  session?: string;
394
408
  };
395
409
 
396
- export type TableSchema = {
410
+ export declare type TableSchema = {
397
411
  columns: SchemaColumn[];
398
412
  key: string;
399
413
  table: TableSchemaTable;
@@ -406,6 +420,7 @@ export type TableSchema = {
406
420
  export interface WithFullConfig {
407
421
  readonly aggregations: VuuAggregation[];
408
422
  readonly columns: VuuColumns;
423
+ readonly baseFilterSpec: DataSourceFilter;
409
424
  readonly filterSpec: DataSourceFilter;
410
425
  readonly groupBy: VuuGroupBy;
411
426
  readonly sort: VuuSort;
@@ -438,22 +453,25 @@ export interface SubscribeProps extends Partial<WithFullConfig> {
438
453
  title?: string;
439
454
  }
440
455
 
441
- export type SubscribeCallback = (message: DataSourceCallbackMessage) => void;
442
- export type OptimizeStrategy = "none" | "throttle" | "debounce";
456
+ export declare type SubscribeCallback = (
457
+ message: DataSourceCallbackMessage,
458
+ ) => void;
459
+ export declare type OptimizeStrategy = "none" | "throttle" | "debounce";
443
460
 
444
- export type DataSourceEventHandler = (viewportId: string) => void;
445
- export type RowSelectionEventHandler = (
461
+ export declare type DataSourceEventHandler = (viewportId: string) => void;
462
+ export declare type RowSelectionEventHandler = (
446
463
  selection: Selection,
447
464
  selectedRowCount: number,
448
465
  ) => void;
449
466
 
450
- export type DataSourceEvents = {
467
+ export declare type DataSourceEvents = {
451
468
  config: (
452
469
  config: DataSourceConfig | undefined,
453
470
  confirmed?: boolean,
454
471
  configChanges?: DataSourceConfigChanges,
455
472
  ) => void;
456
473
  optimize: (optimize: OptimizeStrategy) => void;
474
+ "page-count": (pageCount: number) => void;
457
475
  range: (range: VuuRange) => void;
458
476
  resize: (size: number) => void;
459
477
  "row-selection": RowSelectionEventHandler;
@@ -472,31 +490,33 @@ export type DataSourceEvents = {
472
490
  * return Promise<true> indicates success
473
491
  * return Promise<errorMessage> indicates failure
474
492
  */
475
- export type DataSourceEditHandler = (
493
+ export declare type DataSourceEditHandler = (
476
494
  rowKey: string,
477
495
  columnName: string,
478
496
  value: VuuRowDataItemType,
479
497
  ) => Promise<true | string>;
480
498
 
481
- export type DataSourceDeleteHandler = (key: string) => Promise<true | string>;
482
- export type DataSourceInsertHandler = (
499
+ export declare type DataSourceDeleteHandler = (
500
+ key: string,
501
+ ) => Promise<true | string>;
502
+ export declare type DataSourceInsertHandler = (
483
503
  key: string,
484
504
  data: VuuDataRowDto,
485
505
  ) => Promise<true | string>;
486
506
 
487
- export type RpcResponse =
507
+ export declare type RpcResponse =
488
508
  | MenuRpcResponse
489
509
  | VuuUIMessageInRPCEditReject
490
510
  | VuuUIMessageInRPCEditResponse
491
511
  | ViewportRpcResponse;
492
512
 
493
- export type RpcResponseHandler = (
513
+ export declare type RpcResponseHandler = (
494
514
  response: Omit<VuuRpcResponse, "vpId">,
495
515
  ) => boolean;
496
516
 
497
- export type RowSearchPredicate = (row: DataSourceRow) => boolean;
517
+ export declare type RowSearchPredicate = (row: DataSourceRow) => boolean;
498
518
 
499
- export type DataSourceStatus =
519
+ export declare type DataSourceStatus =
500
520
  | "disabled"
501
521
  | "disabling"
502
522
  | "enabled"
@@ -507,7 +527,14 @@ export type DataSourceStatus =
507
527
  | "suspended"
508
528
  | "unsubscribed";
509
529
 
510
- export type SuggestionFetcher = (params: TypeaheadParams) => Promise<string[]>;
530
+ /**
531
+ * Given a Vuu Table and column, returns a list of sorted distinct values
532
+ * for that column. Only first 10 values will ever be returned. User must
533
+ * type additional text to narrow down values.
534
+ */
535
+ export declare type SuggestionFetcher = (
536
+ params: TypeaheadParams,
537
+ ) => Promise<string[] | false>;
511
538
  export type SuggestionProvider = () => SuggestionFetcher;
512
539
 
513
540
  export interface TypeaheadSuggestionProvider {
@@ -517,10 +544,12 @@ export interface TypeaheadSuggestionProvider {
517
544
  ) => Promise<string[]>;
518
545
  }
519
546
 
520
- export type RangeTuple = [from: number, to: number];
521
- export type SelectionItem = number | RangeTuple;
522
- export type Selection = SelectionItem[];
523
- export type SelectionChangeHandler = (selection: Selection) => void;
547
+ export declare type RangeTuple = [from: number, to: number];
548
+ export declare type SelectionItem = number | RangeTuple;
549
+ export declare type Selection = SelectionItem[];
550
+ export declare type SelectionChangeHandler = (selection: Selection) => void;
551
+
552
+ export declare type WithBaseFilter<T> = T & { baseFilter?: DataSourceFilter };
524
553
 
525
554
  export interface DataSource
526
555
  extends IEventEmitter<DataSourceEvents>,
@@ -536,7 +565,7 @@ export interface DataSource
536
565
  * @returns true if config has been applied (will not be if existig config is same)
537
566
  */
538
567
  applyConfig: (
539
- config: DataSourceConfig,
568
+ config: WithBaseFilter<DataSourceConfig>,
540
569
  /**
541
570
  * If new config is missing attributes and these attributes are present on
542
571
  * existing config, shoule the existing attributes be preserved ?
@@ -545,7 +574,7 @@ export interface DataSource
545
574
  ) => DataSourceConfigChanges | undefined;
546
575
  closeTreeNode: (key: string, cascade?: boolean) => void;
547
576
  columns: string[];
548
- config: DataSourceConfig;
577
+ config: WithBaseFilter<DataSourceConfig>;
549
578
  status: DataSourceStatus;
550
579
  /**
551
580
  *
@@ -584,6 +613,7 @@ export interface DataSource
584
613
  * Should emit a disabled event
585
614
  */
586
615
  disable?: () => void;
616
+ baseFilter?: DataSourceFilter;
587
617
  filter: DataSourceFilter;
588
618
 
589
619
  /**
@@ -673,20 +703,20 @@ export interface ServerProxySubscribeMessage extends WithFullConfig {
673
703
  visualLink?: LinkDescriptorWithLabel;
674
704
  }
675
705
 
676
- // export type VuuUIMessageInConnectionStatus = {
706
+ // export declare type VuuUIMessageInConnectionStatus = {
677
707
  // type: 'connection-status';
678
708
  // };
679
709
 
680
- export type VuuUIMessageInConnected = {
710
+ export declare type VuuUIMessageInConnected = {
681
711
  type: "connected";
682
712
  };
683
713
 
684
- export type VuuUIMessageInConnectionFailed = {
714
+ export declare type VuuUIMessageInConnectionFailed = {
685
715
  type: "connection-failed";
686
716
  reason: string;
687
717
  };
688
718
 
689
- export type VuuUIMessageInWorkerReady = {
719
+ export declare type VuuUIMessageInWorkerReady = {
690
720
  type: "ready";
691
721
  };
692
722
 
@@ -749,7 +779,7 @@ export interface VuuUIMessageInMenuRej {
749
779
  type: "VIEW_PORT_MENU_REJ";
750
780
  }
751
781
 
752
- export type VuuUiMessageInRequestResponse =
782
+ export declare type VuuUiMessageInRequestResponse =
753
783
  | VuuUIMessageInMenuRej
754
784
  | MenuRpcResponse
755
785
  | MenuRpcReject
@@ -760,13 +790,13 @@ export type VuuUiMessageInRequestResponse =
760
790
  | VuuUIMessageInTableList
761
791
  | VuuUIMessageInTableMeta;
762
792
 
763
- export type VuuUIMessageIn =
793
+ export declare type VuuUIMessageIn =
764
794
  | VuuUiMessageInRequestResponse
765
795
  | VuuUIMessageInConnected
766
796
  | VuuUIMessageInConnectionFailed
767
797
  | VuuUIMessageInWorkerReady;
768
798
 
769
- export type WebSocketProtocol = string | string[] | undefined;
799
+ export declare type WebSocketProtocol = string | string[] | undefined;
770
800
 
771
801
  export interface VuuUIMessageOutConnect {
772
802
  protocol?: WebSocketProtocol;
@@ -872,7 +902,7 @@ export interface VuuUIMessageOutConfig extends ViewportMessageOut {
872
902
  type: "config";
873
903
  }
874
904
 
875
- export type VuuUIMessageOutViewport =
905
+ export declare type VuuUIMessageOutViewport =
876
906
  | VuuUIMessageOutAggregate
877
907
  | VuuUIMessageOutCloseTreeNode
878
908
  | VuuUIMessageOutColumns
@@ -896,9 +926,9 @@ export interface TypeAheadRpcRequest {
896
926
  type: "RPC_CALL";
897
927
  }
898
928
 
899
- export type WithRequestId<T> = T & { requestId: string };
929
+ export declare type WithRequestId<T> = T & { requestId: string };
900
930
 
901
- export type VuuUIMessageOut =
931
+ export declare type VuuUIMessageOut =
902
932
  | VuuUIMessageOutConnect
903
933
  | VuuUIMessageOutDisconnect
904
934
  | VuuUIMessageOutSubscribe
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@vuu-ui/vuu-data-types",
3
- "version": "0.8.94",
3
+ "version": "0.8.95",
4
4
  "author": "heswell",
5
5
  "license": "Apache-2.0",
6
6
  "devDependencies": {
7
- "@vuu-ui/vuu-filter-types": "0.8.94",
8
- "@vuu-ui/vuu-protocol-types": "0.8.94"
7
+ "@vuu-ui/vuu-filter-types": "0.8.95",
8
+ "@vuu-ui/vuu-protocol-types": "0.8.95"
9
9
  },
10
10
  "dependencies": {},
11
11
  "peerDependencies": {},