@vuu-ui/vuu-table-types 0.13.113 → 0.13.115-alpha.1

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 +42 -26
  2. package/package.json +4 -4
package/index.d.ts CHANGED
@@ -1,6 +1,4 @@
1
1
  import type {
2
- DataSourceRow,
3
- DataSourceRowObject,
4
2
  DataValueDescriptor,
5
3
  DataValueTypeSimple,
6
4
  DataValueValidationChecker,
@@ -16,11 +14,7 @@ import type {
16
14
  VuuTable,
17
15
  } from "@vuu-ui/vuu-protocol-types";
18
16
  import { CellPos } from "@vuu-ui/vuu-table/src/table-dom-utils";
19
- import type {
20
- ColumnMap,
21
- DateTimePattern,
22
- RowClassNameGenerator,
23
- } from "@vuu-ui/vuu-utils";
17
+ import type { DateTimePattern, RowClassNameGenerator } from "@vuu-ui/vuu-utils";
24
18
  import type {
25
19
  ComponentType,
26
20
  CSSProperties,
@@ -37,6 +31,30 @@ export declare type ColumnMoveHandler = (
37
31
 
38
32
  export declare type GroupToggleTarget = "toggle-icon" | "group-column";
39
33
 
34
+ export interface DataRowIntrinsicAttributes {
35
+ readonly childCount: number;
36
+ readonly depth: number;
37
+ readonly index: number;
38
+ readonly isExpanded: boolean;
39
+ readonly isSelected: boolean;
40
+ readonly isLeaf: boolean;
41
+ readonly key: string;
42
+ readonly renderIndex: number;
43
+ }
44
+
45
+ export interface DataRowOperations {
46
+ hasColumn: (columnName: string) => boolean;
47
+ }
48
+
49
+ export declare type DataRowOperation = keyof DataRowOperations;
50
+
51
+ export declare type DataRowIntrinsicAttribute =
52
+ keyof DataRowIntrinsicAttributes;
53
+
54
+ export declare type DataRow = DataRowIntrinsicAttributes &
55
+ DataRowOperations &
56
+ Record<string, VuuRowDataItemType>;
57
+
40
58
  export declare type TableSelectionModel =
41
59
  | "none"
42
60
  | "single"
@@ -53,16 +71,16 @@ export declare type ValueFormatter<T extends string | ReactElement = string> = (
53
71
 
54
72
  export interface EditEventState {
55
73
  columnName?: string;
74
+ dataRow?: DataRow;
56
75
  editType?: EditType;
57
76
  isValid?: boolean;
58
77
  previousValue?: VuuRowDataItemType;
59
- row?: DataSourceRow;
60
78
  value: VuuRowDataItemType;
61
79
  }
62
80
 
63
81
  export interface DataCellEditEvent extends EditEventState {
64
- row?: DataSourceRow;
65
82
  columnName?: string;
83
+ dataRow?: DataRow;
66
84
  }
67
85
 
68
86
  export declare type DataCellEditNotification = (
@@ -72,10 +90,9 @@ export declare type DataCellEditNotification = (
72
90
  export interface TableCellProps {
73
91
  className?: string;
74
92
  column: RuntimeColumnDescriptor;
75
- columnMap: ColumnMap;
93
+ dataRow: DataRow;
76
94
  onClick?: (event: MouseEvent, column: RuntimeColumnDescriptor) => void;
77
95
  onDataEdited?: TableCellEditHandler;
78
- row: DataSourceRow;
79
96
  searchPattern?: Lowercase<string>;
80
97
  }
81
98
 
@@ -86,11 +103,9 @@ export declare type TableCellEditHandler<T extends EditType = EditType> = (
86
103
  editPhase: T,
87
104
  ) => T extends "commit" ? Promise<RpcResult | undefined> : undefined;
88
105
 
89
- export declare type TableRowSelectHandler = (
90
- row: DataSourceRowObject | null,
91
- ) => void;
106
+ export declare type TableRowSelectHandler = (dataRow: DataRow | null) => void;
92
107
  export declare type TableRowSelectHandlerInternal = (
93
- row: DataSourceRow | null,
108
+ dataRow: DataRow | null,
94
109
  ) => void;
95
110
 
96
111
  /**
@@ -98,12 +113,12 @@ export declare type TableRowSelectHandlerInternal = (
98
113
  */
99
114
  export declare type TableRowClickHandler = (
100
115
  evt: MouseEvent<HTMLDivElement>,
101
- row: DataSourceRowObject,
116
+ row: DataRow,
102
117
  ) => void;
103
118
 
104
119
  export declare type TableRowClickHandlerInternal = (
105
120
  evt: MouseEvent<HTMLDivElement>,
106
- row: DataSourceRow,
121
+ dataRow: DataRow,
107
122
  rangeSelect: boolean,
108
123
  keepExistingSelection: boolean,
109
124
  ) => void;
@@ -148,7 +163,7 @@ export interface TableAttributes {
148
163
  * across sessions.
149
164
  */
150
165
  export interface TableConfig extends TableAttributes {
151
- columns: ColumnDescriptor[];
166
+ columns: readonly ColumnDescriptor[];
152
167
  rowClassNameGenerators?: string[];
153
168
  }
154
169
 
@@ -269,7 +284,7 @@ export interface ColumnDescriptor extends DataValueDescriptor {
269
284
  * Only used when the column is included in a grouby clause.
270
285
  * The icon will be displayed alongside the group label
271
286
  */
272
- getIcon?: (row: DataSourceRow) => string | undefined;
287
+ getIcon?: (row: DataRow) => string | undefined;
273
288
  /**
274
289
  * Can this column be included in a groupBy operation ? Default is true.
275
290
  */
@@ -308,6 +323,9 @@ export interface ColumnDescriptorCustomRenderer
308
323
  export interface RuntimeColumnDescriptor extends ColumnDescriptor {
309
324
  align?: "left" | "right";
310
325
  ariaColIndex: number;
326
+ /**
327
+ * A custom Cell Renderer component, configured via the `type.renderer`
328
+ */
311
329
  CellRenderer?: FunctionComponent<TableCellRendererProps>;
312
330
  HeaderCellLabelRenderer?: FunctionComponent<
313
331
  Omit<HeaderCellProps, "id" | "index">
@@ -419,7 +437,7 @@ export interface TableSettingsProps {
419
437
  allowColumnLabelCase?: boolean;
420
438
  allowColumnDefaultWidth?: boolean;
421
439
  allowGridRowStyling?: boolean;
422
- availableColumns: SchemaColumn[];
440
+ availableColumns: readonly SchemaColumn[];
423
441
  onAddCalculatedColumn: () => void;
424
442
  onConfigChange: (config: TableConfig) => void;
425
443
  onDataSourceConfigChange: (dataSourceConfig: DataSourceConfig) => void;
@@ -476,7 +494,7 @@ export interface BaseRowProps {
476
494
 
477
495
  export interface RowProps extends BaseRowProps {
478
496
  classNameGenerator?: RowClassNameGenerator;
479
- columnMap: ColumnMap;
497
+ dataRow: DataRow;
480
498
  groupToggleTarget?: GroupToggleTarget;
481
499
  highlighted?: boolean;
482
500
  offset: number;
@@ -484,7 +502,6 @@ export interface RowProps extends BaseRowProps {
484
502
  onClick?: TableRowClickHandlerInternal;
485
503
  onDataEdited?: TableCellEditHandler;
486
504
  onToggleGroup?: (row: DataSourceRow, column: RuntimeColumnDescriptor) => void;
487
- row: DataSourceRow;
488
505
  searchPattern: Lowercase<string>;
489
506
  showBookends?: boolean;
490
507
  zebraStripes?: boolean;
@@ -541,17 +558,16 @@ export declare type CellPos = [number, number];
541
558
  */
542
559
  export declare type RowActionHandler<T extends string = string> = (
543
560
  rowActionId: T,
544
- row: DataSourceRow,
561
+ dataRow: DataRow,
545
562
  ) => void;
546
563
 
547
564
  export declare type TableMenuLocation = "grid" | "header" | "filter";
548
565
 
549
566
  export interface TableContextMenuOptions {
550
- columnMap: ColumnMap;
551
567
  column: ColumnDescriptor;
552
568
  columns?: ColumnDescriptor[];
553
- row: DataSourceRow;
554
- selectedRows: DataSourceRow[];
569
+ dataRow: DataRow;
570
+ selectedRows: DataRow[];
555
571
  viewport?: string;
556
572
  }
557
573
 
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@vuu-ui/vuu-table-types",
3
- "version": "0.13.113",
3
+ "version": "0.13.115-alpha.1",
4
4
  "devDependencies": {
5
- "@vuu-ui/vuu-data-types": "0.13.113",
6
- "@vuu-ui/vuu-filter-types": "0.13.113",
7
- "@vuu-ui/vuu-protocol-types": "0.13.113"
5
+ "@vuu-ui/vuu-data-types": "0.13.115-alpha.1",
6
+ "@vuu-ui/vuu-filter-types": "0.13.115-alpha.1",
7
+ "@vuu-ui/vuu-protocol-types": "0.13.115-alpha.1"
8
8
  },
9
9
  "author": "heswell",
10
10
  "license": "Apache-2.0",