@vuu-ui/vuu-table-types 0.13.112 → 0.13.113-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 +51 -16
  2. package/package.json +4 -4
package/index.d.ts CHANGED
@@ -8,6 +8,7 @@ import type {
8
8
  } from "@vuu-ui/vuu-data-types";
9
9
  import type { Filter } from "@vuu-ui/vuu-filter-types";
10
10
  import type {
11
+ RpcResult,
11
12
  SelectRequest,
12
13
  VuuAggType,
13
14
  VuuRowDataItemType,
@@ -51,16 +52,17 @@ export declare type ValueFormatter<T extends string | ReactElement = string> = (
51
52
  ) => T;
52
53
 
53
54
  export interface EditEventState {
55
+ columnName?: string;
54
56
  editType?: EditType;
55
57
  isValid?: boolean;
56
- // value: unknown;
57
58
  previousValue?: VuuRowDataItemType;
59
+ row?: DataSourceRow;
58
60
  value: VuuRowDataItemType;
59
61
  }
60
62
 
61
63
  export interface DataCellEditEvent extends EditEventState {
62
- row: DataSourceRow;
63
- columnName: string;
64
+ row?: DataSourceRow;
65
+ columnName?: string;
64
66
  }
65
67
 
66
68
  export declare type DataCellEditNotification = (
@@ -72,19 +74,17 @@ export interface TableCellProps {
72
74
  column: RuntimeColumnDescriptor;
73
75
  columnMap: ColumnMap;
74
76
  onClick?: (event: MouseEvent, column: RuntimeColumnDescriptor) => void;
75
- onDataEdited?: DataCellEditHandler;
77
+ onDataEdited?: TableCellEditHandler;
76
78
  row: DataSourceRow;
77
79
  searchPattern?: Lowercase<string>;
78
80
  }
79
81
 
80
- export declare type CommitResponse = Promise<true | string>;
81
-
82
82
  export declare type EditType = "commit" | "change" | "cancel";
83
83
 
84
- declare type DataItemEditHandler<T extends EditType = EditType> = (
84
+ export declare type TableCellEditHandler<T extends EditType = EditType> = (
85
85
  editState: EditEventState,
86
86
  editPhase: T,
87
- ) => T extends "commit" ? Promise<string | true> : void;
87
+ ) => T extends "commit" ? Promise<RpcResult | undefined> : undefined;
88
88
 
89
89
  export declare type TableRowSelectHandler = (
90
90
  row: DataSourceRowObject | null,
@@ -110,7 +110,7 @@ export declare type TableRowClickHandlerInternal = (
110
110
 
111
111
  export interface TableCellRendererProps
112
112
  extends Omit<TableCellProps, "onDataEdited"> {
113
- onEdit?: DataItemEditHandler;
113
+ onEdit?: TableCellEditHandler;
114
114
  }
115
115
 
116
116
  /**
@@ -123,12 +123,21 @@ export interface TableCellRendererProps
123
123
  export declare type ColumnLayout = "static" | "fit" | "manual";
124
124
 
125
125
  export interface TableAttributes {
126
+ /**
127
+ * In the case of checkbox selection, allows width of checkbox columns to be specified
128
+ */
129
+ checkboxColumnWidth?: number;
126
130
  columnDefaultWidth?: number;
127
131
  columnFormatHeader?: "capitalize" | "uppercase";
128
132
  columnLayout?: ColumnLayout;
129
133
  columnSeparators?: boolean;
130
134
  // showHighlightedRow?: boolean;
131
135
  rowSeparators?: boolean;
136
+ /**
137
+ * Selection Bookends style the left and right edge of a selection block.
138
+ * They are optional, value currently defaults to 4.
139
+ */
140
+ selectionBookendWidth?: number;
132
141
  zebraStripes?: boolean;
133
142
  }
134
143
 
@@ -142,10 +151,6 @@ export interface TableConfig extends TableAttributes {
142
151
  columns: ColumnDescriptor[];
143
152
  rowClassNameGenerators?: string[];
144
153
  }
145
- export interface GridConfig extends TableConfig {
146
- headings: TableHeadings;
147
- selectionBookendWidth?: number;
148
- }
149
154
 
150
155
  // TODO tidy up this definition, currently split beween here and data-types
151
156
  export declare type DataValueTypeDescriptor = {
@@ -237,7 +242,7 @@ export interface ColumnTypeWithValidationRules
237
242
 
238
243
  export declare type ColumnSort = VuuSortType | number;
239
244
 
240
- export declare type PinLocation = "left" | "right" | "floating";
245
+ export declare type PinLocation = "left" | "right";
241
246
 
242
247
  export declare type ColumnAlignment = "left" | "right";
243
248
 
@@ -313,7 +318,10 @@ export interface RuntimeColumnDescriptor extends ColumnDescriptor {
313
318
  canStretch?: boolean;
314
319
  className?: string;
315
320
  clientSideEditValidationCheck?: DataValueValidationChecker;
316
- endPin?: true | undefined;
321
+ /**
322
+ * Used to mark a column as non-draggable, e.g when pinned
323
+ */
324
+ draggable?: boolean;
317
325
  filter?: Filter;
318
326
  flex?: number;
319
327
  heading?: [...string[]];
@@ -325,7 +333,14 @@ export interface RuntimeColumnDescriptor extends ColumnDescriptor {
325
333
  moving?: boolean;
326
334
  /** used only when column is a child of GroupColumn */
327
335
  originalIdx?: number;
336
+ /**
337
+ * The offset from left or right where we want to pin the column
338
+ */
328
339
  pinnedOffset?: number;
340
+ /**
341
+ * The total width of pinned columns, only required on the outermost pinned column
342
+ */
343
+ pinnedWidth?: number;
329
344
  resizeable?: boolean;
330
345
  resizing?: boolean;
331
346
  sortable?: boolean;
@@ -467,7 +482,7 @@ export interface RowProps extends BaseRowProps {
467
482
  offset: number;
468
483
  onCellEdit?: CellEditHandler;
469
484
  onClick?: TableRowClickHandlerInternal;
470
- onDataEdited?: DataCellEditHandler;
485
+ onDataEdited?: TableCellEditHandler;
471
486
  onToggleGroup?: (row: DataSourceRow, column: RuntimeColumnDescriptor) => void;
472
487
  row: DataSourceRow;
473
488
  searchPattern: Lowercase<string>;
@@ -549,3 +564,23 @@ export declare type SelectionChange = Omit<SelectRequest, "vpId">;
549
564
  export declare type SelectionChangeHandler = (
550
565
  selectionChange: SelectionChange,
551
566
  ) => void;
567
+
568
+ export interface ColumnPinAction {
569
+ type: "pinColumn";
570
+ column: ColumnDescriptor;
571
+ pin: PinLocation | false;
572
+ }
573
+
574
+ export interface ColumnHideAction {
575
+ type: "hideColumn";
576
+ column: ColumnDescriptor;
577
+ }
578
+ export interface ColumnRemoveAction {
579
+ type: "removeColumn";
580
+ column: ColumnDescriptor;
581
+ }
582
+
583
+ export type ColumnDisplayAction =
584
+ | ColumnPinAction
585
+ | ColumnHideAction
586
+ | ColumnRemoveAction;
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@vuu-ui/vuu-table-types",
3
- "version": "0.13.112",
3
+ "version": "0.13.113-alpha.1",
4
4
  "devDependencies": {
5
- "@vuu-ui/vuu-data-types": "0.13.112",
6
- "@vuu-ui/vuu-filter-types": "0.13.112",
7
- "@vuu-ui/vuu-protocol-types": "0.13.112"
5
+ "@vuu-ui/vuu-data-types": "0.13.113-alpha.1",
6
+ "@vuu-ui/vuu-filter-types": "0.13.113-alpha.1",
7
+ "@vuu-ui/vuu-protocol-types": "0.13.113-alpha.1"
8
8
  },
9
9
  "author": "heswell",
10
10
  "license": "Apache-2.0",