@vuu-ui/vuu-table-types 0.8.21-debug → 0.8.22-debug
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.
- package/index.d.ts +333 -0
- package/package.json +3 -2
package/index.d.ts
ADDED
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import type { Filter } from "@vuu-ui/vuu-filter-types";
|
|
2
|
+
import type {
|
|
3
|
+
VuuAggType,
|
|
4
|
+
VuuColumnDataType,
|
|
5
|
+
VuuRowDataItemType,
|
|
6
|
+
VuuSortType,
|
|
7
|
+
VuuTable,
|
|
8
|
+
} from "@vuu-ui/vuu-protocol-types";
|
|
9
|
+
import type { VuuDataRow } from "@vuu-ui/vuu-protocol-types";
|
|
10
|
+
import type { ValueFormatter } from "@vuu-ui/vuu-table";
|
|
11
|
+
import type { ClientSideValidationChecker } from "@vuu-ui/vuu-ui-controls";
|
|
12
|
+
import type { DateTimePattern } from "@vuu-ui/vuu-utils";
|
|
13
|
+
import type { FunctionComponent, MouseEvent } from "react";
|
|
14
|
+
import type { HTMLAttributes } from "react";
|
|
15
|
+
|
|
16
|
+
export type TableSelectionModel = "none" | "single" | "checkbox" | "extended";
|
|
17
|
+
|
|
18
|
+
export type TableHeading = { label: string; width: number };
|
|
19
|
+
export type TableHeadings = TableHeading[][];
|
|
20
|
+
|
|
21
|
+
export type DataCellEditHandler = (
|
|
22
|
+
row: DataSourceRow,
|
|
23
|
+
columnName: string,
|
|
24
|
+
value: VuuRowDataItemType
|
|
25
|
+
) => Promise<string | true>;
|
|
26
|
+
|
|
27
|
+
export interface TableCellProps {
|
|
28
|
+
className?: string;
|
|
29
|
+
column: RuntimeColumnDescriptor;
|
|
30
|
+
columnMap: ColumnMap;
|
|
31
|
+
onClick?: (event: MouseEvent, column: RuntimeColumnDescriptor) => void;
|
|
32
|
+
onDataEdited?: DataCellEditHandler;
|
|
33
|
+
row: DataSourceRow;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type CommitResponse = Promise<true | string>;
|
|
37
|
+
|
|
38
|
+
export type DataItemCommitHandler<
|
|
39
|
+
T extends VuuRowDataItemType = VuuRowDataItemType
|
|
40
|
+
> = (value: T) => CommitResponse;
|
|
41
|
+
|
|
42
|
+
export type TableRowClickHandler = (row: VuuDataRow) => void;
|
|
43
|
+
|
|
44
|
+
export type RowClickHandler = (
|
|
45
|
+
row: DataSourceRow,
|
|
46
|
+
rangeSelect: boolean,
|
|
47
|
+
keepExistingSelection: boolean
|
|
48
|
+
) => void;
|
|
49
|
+
|
|
50
|
+
export interface TableCellRendererProps
|
|
51
|
+
extends Omit<TableCellProps, "onDataEdited"> {
|
|
52
|
+
onCommit?: DataItemCommitHandler;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface TableAttributes {
|
|
56
|
+
columnDefaultWidth?: number;
|
|
57
|
+
columnFormatHeader?: "capitalize" | "uppercase";
|
|
58
|
+
columnSeparators?: boolean;
|
|
59
|
+
// showHighlightedRow?: boolean;
|
|
60
|
+
rowSeparators?: boolean;
|
|
61
|
+
zebraStripes?: boolean;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* TableConfig describes the configuration used to render a Table. It is
|
|
66
|
+
* a required prop for Table and provided initially by user. It can be
|
|
67
|
+
* edited using Settings Editors (Table and Column) and can be persisted
|
|
68
|
+
* across sessions.
|
|
69
|
+
*/
|
|
70
|
+
export interface TableConfig extends TableAttributes {
|
|
71
|
+
columns: ColumnDescriptor[];
|
|
72
|
+
}
|
|
73
|
+
export interface GridConfig extends TableConfig {
|
|
74
|
+
headings: TableHeadings;
|
|
75
|
+
selectionBookendWidth?: number;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export declare type ColumnTypeFormatting = {
|
|
79
|
+
alignOnDecimals?: boolean;
|
|
80
|
+
decimals?: number;
|
|
81
|
+
pattern?: DateTimePattern;
|
|
82
|
+
zeroPad?: boolean;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export type ColumnTypeValueMap = { [key: string]: string };
|
|
86
|
+
|
|
87
|
+
export interface EditValidationRule {
|
|
88
|
+
name: string;
|
|
89
|
+
message?: string;
|
|
90
|
+
value?: string;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export type ListOption = {
|
|
94
|
+
label: string;
|
|
95
|
+
value: number | string;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Descibes a custom cell renderer for a Table column
|
|
100
|
+
*/
|
|
101
|
+
export interface ColumnTypeRendering {
|
|
102
|
+
associatedField?: string;
|
|
103
|
+
// specific to Background renderer
|
|
104
|
+
flashStyle?: "bg-only" | "arrow-bg" | "arrow";
|
|
105
|
+
name: string;
|
|
106
|
+
rules?: EditValidationRule[];
|
|
107
|
+
}
|
|
108
|
+
export interface MappedValueTypeRenderer {
|
|
109
|
+
map: ColumnTypeValueMap;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export type LookupTableDetails = {
|
|
113
|
+
labelColumn: string;
|
|
114
|
+
table: VuuTable;
|
|
115
|
+
valueColumn: string;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* This describes a serverside lookup table which will be bound to the edit control
|
|
119
|
+
* for this column. The lookup table will typically have two columns, mapping a
|
|
120
|
+
* numeric value to a User friendly display string.
|
|
121
|
+
*/
|
|
122
|
+
export interface LookupRenderer {
|
|
123
|
+
name: string;
|
|
124
|
+
lookup: LookupTableDetails;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface ValueListRenderer {
|
|
128
|
+
name: string;
|
|
129
|
+
values: string[];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export declare type DateTimeColumnTypeSimple = "date/time";
|
|
133
|
+
|
|
134
|
+
type DateTimeColumnType =
|
|
135
|
+
| DateTimeColumnTypeSimple
|
|
136
|
+
| (Omit<ColumnTypeDescriptor, "name"> & { name: DateTimeColumnTypeSimple });
|
|
137
|
+
|
|
138
|
+
export declare type DateTimeColumnDescriptor = Omit<
|
|
139
|
+
ColumnDescriptor,
|
|
140
|
+
"type"
|
|
141
|
+
> & {
|
|
142
|
+
type: DateTimeColumnType;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export declare type ColumnTypeSimple =
|
|
146
|
+
| "string"
|
|
147
|
+
| "number"
|
|
148
|
+
| "boolean"
|
|
149
|
+
| "json"
|
|
150
|
+
| DateTimeColumnTypeSimple
|
|
151
|
+
| "checkbox";
|
|
152
|
+
|
|
153
|
+
export declare type ColumnTypeDescriptor = {
|
|
154
|
+
formatting?: ColumnTypeFormatting;
|
|
155
|
+
name: ColumnTypeSimple;
|
|
156
|
+
renderer?:
|
|
157
|
+
| ColumnTypeRendering
|
|
158
|
+
| LookupRenderer
|
|
159
|
+
| MappedValueTypeRenderer
|
|
160
|
+
| ValueListRenderer;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export declare type ColumnTypeDescriptorCustomRenderer = {
|
|
164
|
+
formatting?: ColumnTypeFormatting;
|
|
165
|
+
name: ColumnTypeSimple;
|
|
166
|
+
renderer: ColumnTypeRendering;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export interface ColumnTypeRendererWithValidationRules
|
|
170
|
+
extends ColumnTypeRendering {
|
|
171
|
+
rules: EditValidationRule[];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export interface ColumnTypeWithValidationRules extends ColumnTypeDescriptor {
|
|
175
|
+
renderer: ColumnTypeRendererWithValidationRules;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export declare type ColumnType = ColumnTypeSimple | ColumnTypeDescriptor;
|
|
179
|
+
|
|
180
|
+
export type ColumnSort = VuuSortType | number;
|
|
181
|
+
|
|
182
|
+
export type PinLocation = "left" | "right" | "floating";
|
|
183
|
+
|
|
184
|
+
export type ColumnAlignment = "left" | "right";
|
|
185
|
+
|
|
186
|
+
/** This is a public description of a Column, defining all the
|
|
187
|
+
* column attributes that can be defined by client. */
|
|
188
|
+
export interface ColumnDescriptor {
|
|
189
|
+
aggregate?: VuuAggType;
|
|
190
|
+
align?: ColumnAlignment;
|
|
191
|
+
className?: string;
|
|
192
|
+
colHeaderContentRenderer?: string;
|
|
193
|
+
colHeaderLabelRenderer?: string;
|
|
194
|
+
editable?: boolean;
|
|
195
|
+
flex?: number;
|
|
196
|
+
/**
|
|
197
|
+
Optional additional level(s) of heading to display above label.
|
|
198
|
+
May span multiple columns, if multiple adjacent columns declare
|
|
199
|
+
same heading at same level.
|
|
200
|
+
*/
|
|
201
|
+
heading?: string[];
|
|
202
|
+
hidden?: boolean;
|
|
203
|
+
isSystemColumn?: boolean;
|
|
204
|
+
/** The Label to display on column in Table */
|
|
205
|
+
label?: string;
|
|
206
|
+
locked?: boolean;
|
|
207
|
+
minWidth?: number;
|
|
208
|
+
name: string;
|
|
209
|
+
pin?: PinLocation;
|
|
210
|
+
resizeable?: boolean;
|
|
211
|
+
serverDataType?: VuuColumnDataType;
|
|
212
|
+
sortable?: boolean;
|
|
213
|
+
type?: ColumnType;
|
|
214
|
+
width?: number;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export interface ColumnDescriptorCustomRenderer
|
|
218
|
+
extends Omit<ColumnDescriptor, "type"> {
|
|
219
|
+
type: ColumnTypeDescriptorCustomRenderer;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/** This is an internal description of a Column that extends the public
|
|
223
|
+
* definitin with internal state values. */
|
|
224
|
+
export interface RuntimeColumnDescriptor extends ColumnDescriptor {
|
|
225
|
+
align?: "left" | "right";
|
|
226
|
+
CellRenderer?: FunctionComponent<TableCellRendererProps>;
|
|
227
|
+
HeaderCellLabelRenderer?: FunctionComponent<HeaderCellProps>;
|
|
228
|
+
HeaderCellContentRenderer?: FunctionComponent<HeaderCellProps>;
|
|
229
|
+
className?: string;
|
|
230
|
+
clientSideEditValidationCheck?: ClientSideValidationChecker;
|
|
231
|
+
endPin?: true | undefined;
|
|
232
|
+
filter?: Filter;
|
|
233
|
+
flex?: number;
|
|
234
|
+
heading?: [...string[]];
|
|
235
|
+
isGroup?: boolean;
|
|
236
|
+
isSystemColumn?: boolean;
|
|
237
|
+
key: number;
|
|
238
|
+
label: string;
|
|
239
|
+
locked?: boolean;
|
|
240
|
+
marginLeft?: number;
|
|
241
|
+
moving?: boolean;
|
|
242
|
+
/** used only when column is a child of GroupColumn */
|
|
243
|
+
originalIdx?: number;
|
|
244
|
+
pinnedOffset?: number;
|
|
245
|
+
resizeable?: boolean;
|
|
246
|
+
resizing?: boolean;
|
|
247
|
+
sortable?: boolean;
|
|
248
|
+
sorted?: ColumnSort;
|
|
249
|
+
type?: ColumnType;
|
|
250
|
+
valueFormatter: ValueFormatter;
|
|
251
|
+
width: number;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export interface GroupColumnDescriptor extends RuntimeColumnDescriptor {
|
|
255
|
+
columns: RuntimeColumnDescriptor[];
|
|
256
|
+
groupConfirmed: boolean;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export interface Heading {
|
|
260
|
+
collapsed?: boolean;
|
|
261
|
+
key: string;
|
|
262
|
+
hidden?: boolean;
|
|
263
|
+
isHeading: true;
|
|
264
|
+
label: string;
|
|
265
|
+
name: string;
|
|
266
|
+
resizeable?: boolean;
|
|
267
|
+
resizing?: boolean;
|
|
268
|
+
width: number;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// These are the actions that eventually get routed to the DataSource itself
|
|
272
|
+
export type DataSourceAction =
|
|
273
|
+
| GridActionCloseTreeNode
|
|
274
|
+
| GridActionGroup
|
|
275
|
+
| GridActionOpenTreeNode
|
|
276
|
+
| GridActionSort;
|
|
277
|
+
|
|
278
|
+
export type ScrollAction =
|
|
279
|
+
| GridActionScrollEndHorizontal
|
|
280
|
+
| GridActionScrollStartHorizontal;
|
|
281
|
+
|
|
282
|
+
export type GridAction =
|
|
283
|
+
| DataSourceAction
|
|
284
|
+
| ScrollAction
|
|
285
|
+
| GridActionResizeCol
|
|
286
|
+
| GridActionSelection;
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Describes the props for a Column Configuration Editor, for which
|
|
290
|
+
* an implementation is provided in vuu-table-extras
|
|
291
|
+
*/
|
|
292
|
+
export interface ColumnSettingsProps {
|
|
293
|
+
column: ColumnDescriptor;
|
|
294
|
+
onConfigChange: (config: TableConfig) => void;
|
|
295
|
+
onCancelCreateColumn: () => void;
|
|
296
|
+
onCreateCalculatedColumn: (column: ColumnDescriptor) => void;
|
|
297
|
+
tableConfig: TableConfig;
|
|
298
|
+
vuuTable: VuuTable;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Describes the props for a Table Configuration Editor, for which
|
|
303
|
+
* an implementation is provided in vuu-table-extras
|
|
304
|
+
*/
|
|
305
|
+
export interface TableSettingsProps {
|
|
306
|
+
availableColumns: SchemaColumn[];
|
|
307
|
+
onAddCalculatedColumn: () => void;
|
|
308
|
+
onConfigChange: (config: TableConfig) => void;
|
|
309
|
+
onDataSourceConfigChange: (dataSOurceConfig: DataSourceConfig) => void;
|
|
310
|
+
onNavigateToColumn?: (columnName: string) => void;
|
|
311
|
+
tableConfig: TableConfig;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export type DefaultColumnConfiguration = <T extends string = string>(
|
|
315
|
+
tableName: T,
|
|
316
|
+
columnName: string
|
|
317
|
+
) => Partial<ColumnDescriptor> | undefined;
|
|
318
|
+
|
|
319
|
+
export type ResizePhase = "begin" | "resize" | "end";
|
|
320
|
+
|
|
321
|
+
export type TableColumnResizeHandler = (
|
|
322
|
+
phase: ResizePhase,
|
|
323
|
+
columnName: string,
|
|
324
|
+
width?: number
|
|
325
|
+
) => void;
|
|
326
|
+
|
|
327
|
+
export interface HeaderCellProps extends HTMLAttributes<HTMLDivElement> {
|
|
328
|
+
classBase?: string;
|
|
329
|
+
column: RuntimeColumnDescriptor;
|
|
330
|
+
onResize?: TableColumnResizeHandler;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export type TableConfigChangeHandler = (config: TableConfig) => void;
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuu-ui/vuu-table-types",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.22-debug",
|
|
4
4
|
"devDependencies": {
|
|
5
|
-
"@vuu-ui/vuu-protocol-types": "0.8.
|
|
5
|
+
"@vuu-ui/vuu-protocol-types": "0.8.22-debug"
|
|
6
6
|
},
|
|
7
7
|
"author": "heswell",
|
|
8
8
|
"license": "Apache-2.0",
|
|
9
9
|
"dependencies": {},
|
|
10
10
|
"peerDependencies": {},
|
|
11
11
|
"files": [
|
|
12
|
+
"index.d.ts",
|
|
12
13
|
"index.d.ts"
|
|
13
14
|
],
|
|
14
15
|
"types": "index.d.ts"
|