comins-table 0.1.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.
- package/CHANGELOG.md +11 -0
- package/LICENSE +21 -0
- package/README.md +219 -0
- package/dist/clipboard.d.ts +3 -0
- package/dist/clipboard.d.ts.map +1 -0
- package/dist/clipboard.js +2 -0
- package/dist/component-renderer.d.ts +5 -0
- package/dist/component-renderer.d.ts.map +1 -0
- package/dist/core.d.ts +680 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +691 -0
- package/dist/core.js.map +1 -0
- package/dist/index.d.ts +125 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1959 -0
- package/dist/index.js.map +1 -0
- package/dist/selection.d.ts +3 -0
- package/dist/selection.d.ts.map +1 -0
- package/dist/selection.js +2 -0
- package/dist/summary.d.ts +14 -0
- package/dist/summary.d.ts.map +1 -0
- package/dist/tree.d.ts +20 -0
- package/dist/tree.d.ts.map +1 -0
- package/package.json +75 -0
- package/styles.css +1059 -0
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,680 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
export type CominsRowId = string | number;
|
|
3
|
+
export type CominsTableDensity = "comfortable" | "compact" | "spacious";
|
|
4
|
+
export type CominsTableTheme = {
|
|
5
|
+
className?: string;
|
|
6
|
+
density?: CominsTableDensity;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
};
|
|
9
|
+
export type CominsSortDirection = "asc" | "desc";
|
|
10
|
+
export type CominsSortState = {
|
|
11
|
+
columnId: string;
|
|
12
|
+
direction: CominsSortDirection;
|
|
13
|
+
};
|
|
14
|
+
export type CominsCellFormatParams<TData, TValue = unknown> = {
|
|
15
|
+
column: CominsTableRuntimeColumn<TData, TValue>;
|
|
16
|
+
row: TData;
|
|
17
|
+
rowId: CominsRowId;
|
|
18
|
+
value: TValue;
|
|
19
|
+
};
|
|
20
|
+
export type CominsColumnValueResolver<TData, TValue> = TValue | ((params: CominsCellFormatParams<TData, TValue>) => TValue);
|
|
21
|
+
export type CominsComponentPrimitiveValue = string | number | boolean;
|
|
22
|
+
export type CominsComponentAlign = "center" | "end" | "start";
|
|
23
|
+
export type CominsComponentDirection = "left" | "right";
|
|
24
|
+
export type CominsComponentPlacement = {
|
|
25
|
+
align?: CominsComponentAlign;
|
|
26
|
+
direction?: CominsComponentDirection;
|
|
27
|
+
id?: string;
|
|
28
|
+
};
|
|
29
|
+
export type CominsTableComponentOption = {
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
label: React.ReactNode;
|
|
32
|
+
value: CominsComponentPrimitiveValue;
|
|
33
|
+
};
|
|
34
|
+
export type CominsVirtualListItem<TItem = unknown> = {
|
|
35
|
+
data?: TItem;
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
label: React.ReactNode;
|
|
38
|
+
searchText?: string;
|
|
39
|
+
value: CominsComponentPrimitiveValue;
|
|
40
|
+
};
|
|
41
|
+
export type CominsTableMenuItem = {
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
label: React.ReactNode;
|
|
44
|
+
type?: "item";
|
|
45
|
+
value: CominsComponentPrimitiveValue;
|
|
46
|
+
} | {
|
|
47
|
+
label: React.ReactNode;
|
|
48
|
+
type: "label";
|
|
49
|
+
} | {
|
|
50
|
+
type: "divider";
|
|
51
|
+
};
|
|
52
|
+
export type CominsComponentColumnPayload<TData, TValue = unknown> = {
|
|
53
|
+
definition: CominsTableRuntimeColumn<TData, TValue>;
|
|
54
|
+
field: string;
|
|
55
|
+
id: string;
|
|
56
|
+
index: number;
|
|
57
|
+
label: React.ReactNode;
|
|
58
|
+
};
|
|
59
|
+
export type CominsComponentRowPayload<TData> = {
|
|
60
|
+
data: TData;
|
|
61
|
+
dataIndex: number;
|
|
62
|
+
disabled: boolean;
|
|
63
|
+
id: CominsRowId;
|
|
64
|
+
index: number;
|
|
65
|
+
selected: boolean;
|
|
66
|
+
};
|
|
67
|
+
export type CominsCellComponentPayload<TData, TValue = unknown> = {
|
|
68
|
+
column: CominsComponentColumnPayload<TData, TValue>;
|
|
69
|
+
row: CominsComponentRowPayload<TData>;
|
|
70
|
+
selection: {
|
|
71
|
+
selectedRowCount: number;
|
|
72
|
+
};
|
|
73
|
+
value: TValue;
|
|
74
|
+
};
|
|
75
|
+
export type CominsHeaderComponentPayload<TData, TValue = unknown> = {
|
|
76
|
+
column: CominsComponentColumnPayload<TData, TValue>;
|
|
77
|
+
layout: {
|
|
78
|
+
hidden: boolean;
|
|
79
|
+
width?: number;
|
|
80
|
+
};
|
|
81
|
+
sort: {
|
|
82
|
+
direction: CominsSortDirection | null;
|
|
83
|
+
enabled: boolean;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
export type CominsClipboardGuard<TData, TValue = unknown> = boolean | ((params: CominsCellComponentPayload<TData, TValue>) => boolean);
|
|
87
|
+
export type CominsColumnProps<TData, TValue = unknown> = {
|
|
88
|
+
className?: string | ((params: CominsCellComponentPayload<TData, TValue>) => string | undefined);
|
|
89
|
+
copyable?: CominsClipboardGuard<TData, TValue>;
|
|
90
|
+
disabled?: CominsClipboardGuard<TData, TValue>;
|
|
91
|
+
pasteable?: CominsClipboardGuard<TData, TValue>;
|
|
92
|
+
style?: React.CSSProperties | ((params: CominsCellComponentPayload<TData, TValue>) => React.CSSProperties | undefined);
|
|
93
|
+
};
|
|
94
|
+
export type CominsTableComponentProps<TPayload, TProps> = TProps | ((payload: TPayload) => TProps);
|
|
95
|
+
export type CominsTableOptions<TPayload> = CominsTableComponentOption[] | ((payload: TPayload) => CominsTableComponentOption[]);
|
|
96
|
+
export type CominsTableMenuItems<TPayload> = CominsTableMenuItem[] | ((payload: TPayload) => CominsTableMenuItem[]);
|
|
97
|
+
export type CominsVirtualListItems<TPayload> = Array<CominsVirtualListItem> | ((payload: TPayload) => Array<CominsVirtualListItem>);
|
|
98
|
+
export type CominsButtonComponentConfig<TPayload> = {
|
|
99
|
+
onClick?: (payload: TPayload & {
|
|
100
|
+
event: React.MouseEvent<HTMLButtonElement>;
|
|
101
|
+
}) => void;
|
|
102
|
+
props?: CominsTableComponentProps<TPayload, React.ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
103
|
+
type: "button";
|
|
104
|
+
};
|
|
105
|
+
export type CominsInputCommitEvent = React.ChangeEvent<HTMLInputElement> | React.FocusEvent<HTMLInputElement> | React.KeyboardEvent<HTMLInputElement>;
|
|
106
|
+
export type CominsInputComponentConfig<TPayload> = {
|
|
107
|
+
onChange?: (payload: TPayload & {
|
|
108
|
+
event: CominsInputCommitEvent;
|
|
109
|
+
value: string;
|
|
110
|
+
}) => void;
|
|
111
|
+
onValueChange?: (payload: TPayload & {
|
|
112
|
+
value: string;
|
|
113
|
+
}) => void;
|
|
114
|
+
props?: CominsTableComponentProps<TPayload, React.InputHTMLAttributes<HTMLInputElement>>;
|
|
115
|
+
type: "input";
|
|
116
|
+
};
|
|
117
|
+
export type CominsCheckboxComponentConfig<TPayload> = {
|
|
118
|
+
onCheckedChange?: (payload: TPayload & {
|
|
119
|
+
checked: boolean;
|
|
120
|
+
}) => void;
|
|
121
|
+
props?: CominsTableComponentProps<TPayload, React.InputHTMLAttributes<HTMLInputElement>>;
|
|
122
|
+
type: "checkbox";
|
|
123
|
+
};
|
|
124
|
+
export type CominsRadioComponentConfig<TPayload> = {
|
|
125
|
+
onValueChange?: (payload: TPayload & {
|
|
126
|
+
value: string;
|
|
127
|
+
}) => void;
|
|
128
|
+
options: CominsTableOptions<TPayload>;
|
|
129
|
+
props?: CominsTableComponentProps<TPayload, React.HTMLAttributes<HTMLDivElement> & {
|
|
130
|
+
value?: CominsComponentPrimitiveValue;
|
|
131
|
+
}>;
|
|
132
|
+
type: "radio";
|
|
133
|
+
};
|
|
134
|
+
export type CominsSelectComponentConfig<TPayload> = {
|
|
135
|
+
onValueChange?: (payload: TPayload & {
|
|
136
|
+
value: string;
|
|
137
|
+
}) => void;
|
|
138
|
+
options: CominsTableOptions<TPayload>;
|
|
139
|
+
props?: CominsTableComponentProps<TPayload, React.SelectHTMLAttributes<HTMLSelectElement>>;
|
|
140
|
+
type: "select";
|
|
141
|
+
};
|
|
142
|
+
export type CominsToggleComponentConfig<TPayload> = {
|
|
143
|
+
onCheckedChange?: (payload: TPayload & {
|
|
144
|
+
checked: boolean;
|
|
145
|
+
}) => void;
|
|
146
|
+
props?: CominsTableComponentProps<TPayload, React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
147
|
+
checked?: boolean;
|
|
148
|
+
}>;
|
|
149
|
+
type: "toggle";
|
|
150
|
+
};
|
|
151
|
+
export type CominsProgressComponentConfig<TPayload> = {
|
|
152
|
+
props?: CominsTableComponentProps<TPayload, React.HTMLAttributes<HTMLDivElement> & {
|
|
153
|
+
max?: number;
|
|
154
|
+
value?: number;
|
|
155
|
+
}>;
|
|
156
|
+
type: "progress";
|
|
157
|
+
};
|
|
158
|
+
export type CominsMenuComponentConfig<TPayload> = {
|
|
159
|
+
items: CominsTableMenuItems<TPayload>;
|
|
160
|
+
onBeforeChange?: (payload: TPayload & {
|
|
161
|
+
event?: Event | React.SyntheticEvent;
|
|
162
|
+
open: boolean;
|
|
163
|
+
}) => boolean | void;
|
|
164
|
+
onOpenChange?: (payload: TPayload & {
|
|
165
|
+
event?: Event | React.SyntheticEvent;
|
|
166
|
+
open: boolean;
|
|
167
|
+
}) => void;
|
|
168
|
+
onSelect?: (payload: TPayload & {
|
|
169
|
+
event: React.MouseEvent<HTMLButtonElement>;
|
|
170
|
+
item: Extract<CominsTableMenuItem, {
|
|
171
|
+
value: CominsComponentPrimitiveValue;
|
|
172
|
+
}>;
|
|
173
|
+
value: CominsComponentPrimitiveValue;
|
|
174
|
+
}) => void;
|
|
175
|
+
props?: CominsTableComponentProps<TPayload, React.ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
176
|
+
type: "menu";
|
|
177
|
+
};
|
|
178
|
+
export type CominsVirtualListSearchFilterPayload = {
|
|
179
|
+
item: CominsVirtualListItem;
|
|
180
|
+
itemIndex: number;
|
|
181
|
+
value: string;
|
|
182
|
+
};
|
|
183
|
+
export type CominsVirtualListComponentConfig<TPayload> = {
|
|
184
|
+
items: CominsVirtualListItems<TPayload>;
|
|
185
|
+
onClickItem?: (payload: TPayload & {
|
|
186
|
+
event: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>;
|
|
187
|
+
item: CominsVirtualListItem;
|
|
188
|
+
itemIndex: number;
|
|
189
|
+
value: CominsComponentPrimitiveValue;
|
|
190
|
+
}) => void;
|
|
191
|
+
onContextMenuItem?: (payload: TPayload & {
|
|
192
|
+
event: React.MouseEvent<HTMLButtonElement>;
|
|
193
|
+
item: CominsVirtualListItem;
|
|
194
|
+
itemIndex: number;
|
|
195
|
+
value: CominsComponentPrimitiveValue;
|
|
196
|
+
}) => void;
|
|
197
|
+
props?: CominsTableComponentProps<TPayload, React.HTMLAttributes<HTMLDivElement> & {
|
|
198
|
+
height?: number | string;
|
|
199
|
+
itemHeight?: number;
|
|
200
|
+
limit?: number;
|
|
201
|
+
more?: boolean;
|
|
202
|
+
searchable?: boolean;
|
|
203
|
+
}>;
|
|
204
|
+
searchFilter?: (payload: CominsVirtualListSearchFilterPayload) => boolean;
|
|
205
|
+
type: "virtual-list";
|
|
206
|
+
};
|
|
207
|
+
export type CominsHeaderComponentConfig<TData, TValue = unknown> = CominsButtonComponentConfig<CominsHeaderComponentPayload<TData, TValue>> | CominsInputComponentConfig<CominsHeaderComponentPayload<TData, TValue>> | CominsCheckboxComponentConfig<CominsHeaderComponentPayload<TData, TValue>> | CominsRadioComponentConfig<CominsHeaderComponentPayload<TData, TValue>> | CominsSelectComponentConfig<CominsHeaderComponentPayload<TData, TValue>> | CominsToggleComponentConfig<CominsHeaderComponentPayload<TData, TValue>> | CominsProgressComponentConfig<CominsHeaderComponentPayload<TData, TValue>> | CominsMenuComponentConfig<CominsHeaderComponentPayload<TData, TValue>>;
|
|
208
|
+
export type CominsCellComponentConfig<TData, TValue = unknown> = CominsButtonComponentConfig<CominsCellComponentPayload<TData, TValue>> | CominsInputComponentConfig<CominsCellComponentPayload<TData, TValue>> | CominsCheckboxComponentConfig<CominsCellComponentPayload<TData, TValue>> | CominsRadioComponentConfig<CominsCellComponentPayload<TData, TValue>> | CominsSelectComponentConfig<CominsCellComponentPayload<TData, TValue>> | CominsToggleComponentConfig<CominsCellComponentPayload<TData, TValue>> | CominsProgressComponentConfig<CominsCellComponentPayload<TData, TValue>> | CominsVirtualListComponentConfig<CominsCellComponentPayload<TData, TValue>>;
|
|
209
|
+
export type CominsHeaderComponent<TData, TValue = unknown> = CominsComponentPlacement & CominsHeaderComponentConfig<TData, TValue>;
|
|
210
|
+
export type CominsCellComponent<TData, TValue = unknown> = CominsComponentPlacement & CominsCellComponentConfig<TData, TValue>;
|
|
211
|
+
export type CominsTableCellConfig<TData, TValue = unknown> = {
|
|
212
|
+
components?: Array<CominsCellComponent<TData, TValue>>;
|
|
213
|
+
format?: (params: CominsCellComponentPayload<TData, TValue>) => React.ReactNode;
|
|
214
|
+
props?: CominsColumnProps<TData, TValue> | ((params: CominsCellComponentPayload<TData, TValue>) => CominsColumnProps<TData, TValue>);
|
|
215
|
+
renderer?: (params: CominsCellComponentPayload<TData, TValue>) => React.ReactNode;
|
|
216
|
+
tooltip?: string | ((params: CominsCellComponentPayload<TData, TValue>) => React.ReactNode);
|
|
217
|
+
};
|
|
218
|
+
export type CominsTableHeaderConfig<TData, TValue = unknown> = {
|
|
219
|
+
components?: Array<CominsHeaderComponent<TData, TValue>>;
|
|
220
|
+
props?: React.ThHTMLAttributes<HTMLTableCellElement>;
|
|
221
|
+
renderer?: (params: CominsHeaderComponentPayload<TData, TValue>) => React.ReactNode;
|
|
222
|
+
};
|
|
223
|
+
export type CominsTableColumn<TData, TValue = unknown> = {
|
|
224
|
+
cell?: CominsTableCellConfig<TData, TValue>;
|
|
225
|
+
field: string;
|
|
226
|
+
header?: CominsTableHeaderConfig<TData, TValue>;
|
|
227
|
+
hidden?: boolean;
|
|
228
|
+
id?: string;
|
|
229
|
+
label: React.ReactNode;
|
|
230
|
+
maxWidth?: number;
|
|
231
|
+
minWidth?: number;
|
|
232
|
+
sort?: boolean | ((left: TValue, right: TValue, leftRow: TData, rightRow: TData) => number);
|
|
233
|
+
width?: number;
|
|
234
|
+
};
|
|
235
|
+
export type CominsTableColumnGroup = {
|
|
236
|
+
children: string[];
|
|
237
|
+
hidden?: boolean;
|
|
238
|
+
id: string;
|
|
239
|
+
label: React.ReactNode;
|
|
240
|
+
};
|
|
241
|
+
export type CominsTableRuntimeColumn<TData, TValue = unknown> = Omit<CominsTableColumn<TData, TValue>, "id"> & {
|
|
242
|
+
id: string;
|
|
243
|
+
};
|
|
244
|
+
export type CominsTableRuntimeColumnGroup = Omit<CominsTableColumnGroup, "children"> & {
|
|
245
|
+
children: string[];
|
|
246
|
+
};
|
|
247
|
+
export type CominsEventColumn<TData, TValue = unknown> = {
|
|
248
|
+
definition: CominsTableRuntimeColumn<TData, TValue>;
|
|
249
|
+
field: string;
|
|
250
|
+
id: string;
|
|
251
|
+
index: number;
|
|
252
|
+
label: React.ReactNode;
|
|
253
|
+
};
|
|
254
|
+
export type CominsColumnRuntimeState = {
|
|
255
|
+
hidden?: boolean;
|
|
256
|
+
width?: number;
|
|
257
|
+
};
|
|
258
|
+
export type CominsColumnGroupRuntimeState = {
|
|
259
|
+
hidden?: boolean;
|
|
260
|
+
};
|
|
261
|
+
export type CominsColumnLayout = {
|
|
262
|
+
columns: Record<string, CominsColumnRuntimeState>;
|
|
263
|
+
groups?: Record<string, CominsColumnGroupRuntimeState>;
|
|
264
|
+
order: string[];
|
|
265
|
+
};
|
|
266
|
+
export type CominsPaginationState = {
|
|
267
|
+
pageIndex: number;
|
|
268
|
+
pageSize: number;
|
|
269
|
+
};
|
|
270
|
+
export type CominsSelectionState = {
|
|
271
|
+
cell: CominsCellAddress | null;
|
|
272
|
+
range: CominsCellRange | null;
|
|
273
|
+
rowIds: CominsRowId[];
|
|
274
|
+
};
|
|
275
|
+
export type CominsTableState<TData> = {
|
|
276
|
+
columnOrder: string[];
|
|
277
|
+
columnGroups: CominsTableRuntimeColumnGroup[];
|
|
278
|
+
columnGroupState: Record<string, CominsColumnGroupRuntimeState>;
|
|
279
|
+
columns: Array<CominsTableRuntimeColumn<TData>>;
|
|
280
|
+
columnState: Record<string, CominsColumnRuntimeState>;
|
|
281
|
+
getRowId: (row: TData, index: number) => CominsRowId;
|
|
282
|
+
pagination: CominsPaginationState;
|
|
283
|
+
rowIds: CominsRowId[];
|
|
284
|
+
rows: TData[];
|
|
285
|
+
selection: CominsSelectionState;
|
|
286
|
+
showHeader: boolean;
|
|
287
|
+
sort: CominsSortState | null;
|
|
288
|
+
theme: CominsTableTheme;
|
|
289
|
+
};
|
|
290
|
+
export type CominsTableStateInput<TData> = {
|
|
291
|
+
columnLayout?: Partial<CominsColumnLayout>;
|
|
292
|
+
columnGroups?: ReadonlyArray<CominsTableColumnGroup>;
|
|
293
|
+
columns: ReadonlyArray<CominsTableColumn<TData>>;
|
|
294
|
+
getRowId?: (row: TData, index: number) => CominsRowId;
|
|
295
|
+
pagination?: Partial<CominsPaginationState>;
|
|
296
|
+
rows: readonly TData[];
|
|
297
|
+
showHeader?: boolean;
|
|
298
|
+
sort?: CominsSortState | null;
|
|
299
|
+
theme?: CominsTableTheme;
|
|
300
|
+
};
|
|
301
|
+
export type CominsRowUpdate<TData> = {
|
|
302
|
+
id: CominsRowId;
|
|
303
|
+
patch: Partial<TData> | ((row: TData) => TData);
|
|
304
|
+
};
|
|
305
|
+
export type CominsVirtualRowsOptions = {
|
|
306
|
+
overscan?: number;
|
|
307
|
+
rowHeight: number;
|
|
308
|
+
scrollTop: number;
|
|
309
|
+
viewportHeight: number;
|
|
310
|
+
};
|
|
311
|
+
export type CominsVirtualRows<TData> = {
|
|
312
|
+
bottomSpacerHeight: number;
|
|
313
|
+
endIndex: number;
|
|
314
|
+
rows: TData[];
|
|
315
|
+
startIndex: number;
|
|
316
|
+
topSpacerHeight: number;
|
|
317
|
+
totalHeight: number;
|
|
318
|
+
};
|
|
319
|
+
export type CominsHeaderColumnCell<TData> = {
|
|
320
|
+
colSpan: 1;
|
|
321
|
+
column: CominsTableRuntimeColumn<TData>;
|
|
322
|
+
columnId: string;
|
|
323
|
+
groupId?: string;
|
|
324
|
+
kind: "column";
|
|
325
|
+
rowSpan: 1 | 2;
|
|
326
|
+
};
|
|
327
|
+
export type CominsHeaderGroupCell = {
|
|
328
|
+
colSpan: number;
|
|
329
|
+
group: CominsTableRuntimeColumnGroup;
|
|
330
|
+
groupId: string;
|
|
331
|
+
kind: "group";
|
|
332
|
+
rowSpan: 1;
|
|
333
|
+
};
|
|
334
|
+
export type CominsHeaderCell<TData> = CominsHeaderColumnCell<TData> | CominsHeaderGroupCell;
|
|
335
|
+
export type CominsCopiedRow<TData> = {
|
|
336
|
+
kind: "row";
|
|
337
|
+
row: TData;
|
|
338
|
+
text: string;
|
|
339
|
+
};
|
|
340
|
+
export type CominsCopiedCell = {
|
|
341
|
+
kind: "cell";
|
|
342
|
+
text: string;
|
|
343
|
+
value: unknown;
|
|
344
|
+
};
|
|
345
|
+
export type CominsCopiedCellRangeCell = {
|
|
346
|
+
columnId: string;
|
|
347
|
+
text: string;
|
|
348
|
+
value: unknown;
|
|
349
|
+
} | null;
|
|
350
|
+
export type CominsCopiedCellRange = {
|
|
351
|
+
kind: "cell-range";
|
|
352
|
+
rows: CominsCopiedCellRangeCell[][];
|
|
353
|
+
text: string;
|
|
354
|
+
};
|
|
355
|
+
export type CominsExportFormat = "csv" | "json";
|
|
356
|
+
export type CominsExportValueSource = "formatted" | "raw";
|
|
357
|
+
export type CominsExportColumn<TData> = {
|
|
358
|
+
format?: (row: TData, rowIndex: number) => unknown;
|
|
359
|
+
id?: string;
|
|
360
|
+
label?: string;
|
|
361
|
+
value: (row: TData, rowIndex: number) => unknown;
|
|
362
|
+
};
|
|
363
|
+
export type CominsExportRowsOptions<TData> = {
|
|
364
|
+
columnOrder?: string[];
|
|
365
|
+
columns: Array<CominsExportColumn<TData>>;
|
|
366
|
+
headerOverrides?: Record<string, string>;
|
|
367
|
+
rows: readonly TData[];
|
|
368
|
+
valueSource?: CominsExportValueSource;
|
|
369
|
+
};
|
|
370
|
+
export type CominsCellAddress = {
|
|
371
|
+
columnId: string;
|
|
372
|
+
rowId: CominsRowId;
|
|
373
|
+
};
|
|
374
|
+
export type CominsCellRange = {
|
|
375
|
+
anchor: CominsCellAddress;
|
|
376
|
+
focus: CominsCellAddress;
|
|
377
|
+
};
|
|
378
|
+
export type CominsPasteRowOptions<TData> = {
|
|
379
|
+
getNewRowId?: (row: TData) => CominsRowId;
|
|
380
|
+
mode: "append";
|
|
381
|
+
} | {
|
|
382
|
+
getPastedRowId?: (row: TData) => CominsRowId;
|
|
383
|
+
mode: "insert-after";
|
|
384
|
+
targetRowId: CominsRowId;
|
|
385
|
+
} | {
|
|
386
|
+
mode: "overwrite" | "replace";
|
|
387
|
+
targetRowId: CominsRowId;
|
|
388
|
+
};
|
|
389
|
+
export type CominsRowSelectionOptions = {
|
|
390
|
+
multi?: boolean;
|
|
391
|
+
toggle?: boolean;
|
|
392
|
+
};
|
|
393
|
+
export type CominsFillCellRangeOptions = {
|
|
394
|
+
source: CominsCellAddress;
|
|
395
|
+
target: CominsCellRange;
|
|
396
|
+
};
|
|
397
|
+
export declare function createCominsTableState<TData>({ columnLayout, columnGroups, columns, getRowId, pagination, rows, showHeader, sort, theme, }: CominsTableStateInput<TData>): CominsTableState<TData>;
|
|
398
|
+
export declare function queryCominsRows<TData>(state: CominsTableState<TData>, predicate?: (row: TData, index: number) => boolean): TData[];
|
|
399
|
+
export declare function replaceCominsRows<TData>(state: CominsTableState<TData>, rows: readonly TData[]): CominsTableState<TData>;
|
|
400
|
+
export declare function addCominsRows<TData>(state: CominsTableState<TData>, rows: readonly TData[]): CominsTableState<TData>;
|
|
401
|
+
export declare function updateCominsRows<TData>(state: CominsTableState<TData>, updates: ReadonlyArray<CominsRowUpdate<TData>>): CominsTableState<TData>;
|
|
402
|
+
export declare function deleteCominsRows<TData>(state: CominsTableState<TData>, rowIds: readonly CominsRowId[]): CominsTableState<TData>;
|
|
403
|
+
export declare function setCominsTableTheme<TData>(state: CominsTableState<TData>, theme: CominsTableTheme): {
|
|
404
|
+
theme: {
|
|
405
|
+
className?: string;
|
|
406
|
+
density?: CominsTableDensity;
|
|
407
|
+
style?: React.CSSProperties;
|
|
408
|
+
};
|
|
409
|
+
columnOrder: string[];
|
|
410
|
+
columnGroups: CominsTableRuntimeColumnGroup[];
|
|
411
|
+
columnGroupState: Record<string, CominsColumnGroupRuntimeState>;
|
|
412
|
+
columns: CominsTableRuntimeColumn<TData, unknown>[];
|
|
413
|
+
columnState: Record<string, CominsColumnRuntimeState>;
|
|
414
|
+
getRowId: (row: TData, index: number) => CominsRowId;
|
|
415
|
+
pagination: CominsPaginationState;
|
|
416
|
+
rowIds: CominsRowId[];
|
|
417
|
+
rows: TData[];
|
|
418
|
+
selection: CominsSelectionState;
|
|
419
|
+
showHeader: boolean;
|
|
420
|
+
sort: CominsSortState | null;
|
|
421
|
+
};
|
|
422
|
+
export declare function setCominsHeaderVisible<TData>(state: CominsTableState<TData>, showHeader: boolean): {
|
|
423
|
+
showHeader: boolean;
|
|
424
|
+
columnOrder: string[];
|
|
425
|
+
columnGroups: CominsTableRuntimeColumnGroup[];
|
|
426
|
+
columnGroupState: Record<string, CominsColumnGroupRuntimeState>;
|
|
427
|
+
columns: CominsTableRuntimeColumn<TData, unknown>[];
|
|
428
|
+
columnState: Record<string, CominsColumnRuntimeState>;
|
|
429
|
+
getRowId: (row: TData, index: number) => CominsRowId;
|
|
430
|
+
pagination: CominsPaginationState;
|
|
431
|
+
rowIds: CominsRowId[];
|
|
432
|
+
rows: TData[];
|
|
433
|
+
selection: CominsSelectionState;
|
|
434
|
+
sort: CominsSortState | null;
|
|
435
|
+
theme: CominsTableTheme;
|
|
436
|
+
};
|
|
437
|
+
export declare function setCominsPagination<TData>(state: CominsTableState<TData>, pagination: Partial<CominsPaginationState>): {
|
|
438
|
+
pagination: {
|
|
439
|
+
pageIndex: number;
|
|
440
|
+
pageSize: number;
|
|
441
|
+
};
|
|
442
|
+
columnOrder: string[];
|
|
443
|
+
columnGroups: CominsTableRuntimeColumnGroup[];
|
|
444
|
+
columnGroupState: Record<string, CominsColumnGroupRuntimeState>;
|
|
445
|
+
columns: CominsTableRuntimeColumn<TData, unknown>[];
|
|
446
|
+
columnState: Record<string, CominsColumnRuntimeState>;
|
|
447
|
+
getRowId: (row: TData, index: number) => CominsRowId;
|
|
448
|
+
rowIds: CominsRowId[];
|
|
449
|
+
rows: TData[];
|
|
450
|
+
selection: CominsSelectionState;
|
|
451
|
+
showHeader: boolean;
|
|
452
|
+
sort: CominsSortState | null;
|
|
453
|
+
theme: CominsTableTheme;
|
|
454
|
+
};
|
|
455
|
+
export declare function setCominsSortState<TData>(state: CominsTableState<TData>, sort: CominsSortState | null): {
|
|
456
|
+
sort: CominsSortState | null;
|
|
457
|
+
columnOrder: string[];
|
|
458
|
+
columnGroups: CominsTableRuntimeColumnGroup[];
|
|
459
|
+
columnGroupState: Record<string, CominsColumnGroupRuntimeState>;
|
|
460
|
+
columns: CominsTableRuntimeColumn<TData, unknown>[];
|
|
461
|
+
columnState: Record<string, CominsColumnRuntimeState>;
|
|
462
|
+
getRowId: (row: TData, index: number) => CominsRowId;
|
|
463
|
+
pagination: CominsPaginationState;
|
|
464
|
+
rowIds: CominsRowId[];
|
|
465
|
+
rows: TData[];
|
|
466
|
+
selection: CominsSelectionState;
|
|
467
|
+
showHeader: boolean;
|
|
468
|
+
theme: CominsTableTheme;
|
|
469
|
+
};
|
|
470
|
+
export declare function clearCominsSortState<TData>(state: CominsTableState<TData>): {
|
|
471
|
+
sort: CominsSortState | null;
|
|
472
|
+
columnOrder: string[];
|
|
473
|
+
columnGroups: CominsTableRuntimeColumnGroup[];
|
|
474
|
+
columnGroupState: Record<string, CominsColumnGroupRuntimeState>;
|
|
475
|
+
columns: CominsTableRuntimeColumn<TData, unknown>[];
|
|
476
|
+
columnState: Record<string, CominsColumnRuntimeState>;
|
|
477
|
+
getRowId: (row: TData, index: number) => CominsRowId;
|
|
478
|
+
pagination: CominsPaginationState;
|
|
479
|
+
rowIds: CominsRowId[];
|
|
480
|
+
rows: TData[];
|
|
481
|
+
selection: CominsSelectionState;
|
|
482
|
+
showHeader: boolean;
|
|
483
|
+
theme: CominsTableTheme;
|
|
484
|
+
};
|
|
485
|
+
export declare function setCominsColumnWidth<TData>(state: CominsTableState<TData>, columnId: string, width: number): {
|
|
486
|
+
columnState: {
|
|
487
|
+
[x: string]: CominsColumnRuntimeState | {
|
|
488
|
+
width: number;
|
|
489
|
+
hidden?: boolean;
|
|
490
|
+
};
|
|
491
|
+
};
|
|
492
|
+
columnOrder: string[];
|
|
493
|
+
columnGroups: CominsTableRuntimeColumnGroup[];
|
|
494
|
+
columnGroupState: Record<string, CominsColumnGroupRuntimeState>;
|
|
495
|
+
columns: CominsTableRuntimeColumn<TData, unknown>[];
|
|
496
|
+
getRowId: (row: TData, index: number) => CominsRowId;
|
|
497
|
+
pagination: CominsPaginationState;
|
|
498
|
+
rowIds: CominsRowId[];
|
|
499
|
+
rows: TData[];
|
|
500
|
+
selection: CominsSelectionState;
|
|
501
|
+
showHeader: boolean;
|
|
502
|
+
sort: CominsSortState | null;
|
|
503
|
+
theme: CominsTableTheme;
|
|
504
|
+
};
|
|
505
|
+
export declare function setCominsColumnHidden<TData>(state: CominsTableState<TData>, columnId: string, hidden: boolean): {
|
|
506
|
+
columnState: {
|
|
507
|
+
[x: string]: CominsColumnRuntimeState | {
|
|
508
|
+
hidden: boolean;
|
|
509
|
+
width?: number;
|
|
510
|
+
};
|
|
511
|
+
};
|
|
512
|
+
columnOrder: string[];
|
|
513
|
+
columnGroups: CominsTableRuntimeColumnGroup[];
|
|
514
|
+
columnGroupState: Record<string, CominsColumnGroupRuntimeState>;
|
|
515
|
+
columns: CominsTableRuntimeColumn<TData, unknown>[];
|
|
516
|
+
getRowId: (row: TData, index: number) => CominsRowId;
|
|
517
|
+
pagination: CominsPaginationState;
|
|
518
|
+
rowIds: CominsRowId[];
|
|
519
|
+
rows: TData[];
|
|
520
|
+
selection: CominsSelectionState;
|
|
521
|
+
showHeader: boolean;
|
|
522
|
+
sort: CominsSortState | null;
|
|
523
|
+
theme: CominsTableTheme;
|
|
524
|
+
};
|
|
525
|
+
export declare function setCominsColumnGroupHidden<TData>(state: CominsTableState<TData>, groupId: string, hidden: boolean): CominsTableState<TData>;
|
|
526
|
+
export declare function setCominsColumnGroupWidth<TData>(state: CominsTableState<TData>, groupId: string, width: number): CominsTableState<TData>;
|
|
527
|
+
export declare function moveCominsColumn<TData>(state: CominsTableState<TData>, columnId: string, targetIndex: number): CominsTableState<TData>;
|
|
528
|
+
export declare function moveCominsColumnGroup<TData>(state: CominsTableState<TData>, groupId: string, targetIndex: number): CominsTableState<TData>;
|
|
529
|
+
export declare function serializeCominsColumnLayout<TData>(state: CominsTableState<TData>): CominsColumnLayout;
|
|
530
|
+
export declare function applyCominsColumnLayout<TData>(state: CominsTableState<TData>, layout: CominsColumnLayout): {
|
|
531
|
+
columnOrder: string[];
|
|
532
|
+
columnGroupState: Record<string, CominsColumnGroupRuntimeState>;
|
|
533
|
+
columnState: Record<string, CominsColumnRuntimeState>;
|
|
534
|
+
columnGroups: CominsTableRuntimeColumnGroup[];
|
|
535
|
+
columns: CominsTableRuntimeColumn<TData, unknown>[];
|
|
536
|
+
getRowId: (row: TData, index: number) => CominsRowId;
|
|
537
|
+
pagination: CominsPaginationState;
|
|
538
|
+
rowIds: CominsRowId[];
|
|
539
|
+
rows: TData[];
|
|
540
|
+
selection: CominsSelectionState;
|
|
541
|
+
showHeader: boolean;
|
|
542
|
+
sort: CominsSortState | null;
|
|
543
|
+
theme: CominsTableTheme;
|
|
544
|
+
};
|
|
545
|
+
export declare function selectRow<TData>(state: CominsTableState<TData>, rowId: CominsRowId, options?: CominsRowSelectionOptions): {
|
|
546
|
+
selection: {
|
|
547
|
+
rowIds: CominsRowId[];
|
|
548
|
+
cell: CominsCellAddress | null;
|
|
549
|
+
range: CominsCellRange | null;
|
|
550
|
+
};
|
|
551
|
+
columnOrder: string[];
|
|
552
|
+
columnGroups: CominsTableRuntimeColumnGroup[];
|
|
553
|
+
columnGroupState: Record<string, CominsColumnGroupRuntimeState>;
|
|
554
|
+
columns: CominsTableRuntimeColumn<TData, unknown>[];
|
|
555
|
+
columnState: Record<string, CominsColumnRuntimeState>;
|
|
556
|
+
getRowId: (row: TData, index: number) => CominsRowId;
|
|
557
|
+
pagination: CominsPaginationState;
|
|
558
|
+
rowIds: CominsRowId[];
|
|
559
|
+
rows: TData[];
|
|
560
|
+
showHeader: boolean;
|
|
561
|
+
sort: CominsSortState | null;
|
|
562
|
+
theme: CominsTableTheme;
|
|
563
|
+
};
|
|
564
|
+
export declare function selectRows<TData>(state: CominsTableState<TData>, rowIds: readonly CominsRowId[]): {
|
|
565
|
+
selection: {
|
|
566
|
+
rowIds: CominsRowId[];
|
|
567
|
+
cell: CominsCellAddress | null;
|
|
568
|
+
range: CominsCellRange | null;
|
|
569
|
+
};
|
|
570
|
+
columnOrder: string[];
|
|
571
|
+
columnGroups: CominsTableRuntimeColumnGroup[];
|
|
572
|
+
columnGroupState: Record<string, CominsColumnGroupRuntimeState>;
|
|
573
|
+
columns: CominsTableRuntimeColumn<TData, unknown>[];
|
|
574
|
+
columnState: Record<string, CominsColumnRuntimeState>;
|
|
575
|
+
getRowId: (row: TData, index: number) => CominsRowId;
|
|
576
|
+
pagination: CominsPaginationState;
|
|
577
|
+
rowIds: CominsRowId[];
|
|
578
|
+
rows: TData[];
|
|
579
|
+
showHeader: boolean;
|
|
580
|
+
sort: CominsSortState | null;
|
|
581
|
+
theme: CominsTableTheme;
|
|
582
|
+
};
|
|
583
|
+
export declare function selectCell<TData>(state: CominsTableState<TData>, cell: CominsCellAddress): {
|
|
584
|
+
selection: {
|
|
585
|
+
cell: CominsCellAddress;
|
|
586
|
+
range: null;
|
|
587
|
+
rowIds: CominsRowId[];
|
|
588
|
+
};
|
|
589
|
+
columnOrder: string[];
|
|
590
|
+
columnGroups: CominsTableRuntimeColumnGroup[];
|
|
591
|
+
columnGroupState: Record<string, CominsColumnGroupRuntimeState>;
|
|
592
|
+
columns: CominsTableRuntimeColumn<TData, unknown>[];
|
|
593
|
+
columnState: Record<string, CominsColumnRuntimeState>;
|
|
594
|
+
getRowId: (row: TData, index: number) => CominsRowId;
|
|
595
|
+
pagination: CominsPaginationState;
|
|
596
|
+
rowIds: CominsRowId[];
|
|
597
|
+
rows: TData[];
|
|
598
|
+
showHeader: boolean;
|
|
599
|
+
sort: CominsSortState | null;
|
|
600
|
+
theme: CominsTableTheme;
|
|
601
|
+
};
|
|
602
|
+
export declare function selectCellRange<TData>(state: CominsTableState<TData>, range: CominsCellRange): {
|
|
603
|
+
selection: {
|
|
604
|
+
cell: CominsCellAddress;
|
|
605
|
+
range: CominsCellRange;
|
|
606
|
+
rowIds: CominsRowId[];
|
|
607
|
+
};
|
|
608
|
+
columnOrder: string[];
|
|
609
|
+
columnGroups: CominsTableRuntimeColumnGroup[];
|
|
610
|
+
columnGroupState: Record<string, CominsColumnGroupRuntimeState>;
|
|
611
|
+
columns: CominsTableRuntimeColumn<TData, unknown>[];
|
|
612
|
+
columnState: Record<string, CominsColumnRuntimeState>;
|
|
613
|
+
getRowId: (row: TData, index: number) => CominsRowId;
|
|
614
|
+
pagination: CominsPaginationState;
|
|
615
|
+
rowIds: CominsRowId[];
|
|
616
|
+
rows: TData[];
|
|
617
|
+
showHeader: boolean;
|
|
618
|
+
sort: CominsSortState | null;
|
|
619
|
+
theme: CominsTableTheme;
|
|
620
|
+
};
|
|
621
|
+
export declare function clearCominsCellRange<TData>(state: CominsTableState<TData>): {
|
|
622
|
+
selection: {
|
|
623
|
+
range: null;
|
|
624
|
+
cell: CominsCellAddress | null;
|
|
625
|
+
rowIds: CominsRowId[];
|
|
626
|
+
};
|
|
627
|
+
columnOrder: string[];
|
|
628
|
+
columnGroups: CominsTableRuntimeColumnGroup[];
|
|
629
|
+
columnGroupState: Record<string, CominsColumnGroupRuntimeState>;
|
|
630
|
+
columns: CominsTableRuntimeColumn<TData, unknown>[];
|
|
631
|
+
columnState: Record<string, CominsColumnRuntimeState>;
|
|
632
|
+
getRowId: (row: TData, index: number) => CominsRowId;
|
|
633
|
+
pagination: CominsPaginationState;
|
|
634
|
+
rowIds: CominsRowId[];
|
|
635
|
+
rows: TData[];
|
|
636
|
+
showHeader: boolean;
|
|
637
|
+
sort: CominsSortState | null;
|
|
638
|
+
theme: CominsTableTheme;
|
|
639
|
+
};
|
|
640
|
+
export declare function clearCominsSelection<TData>(state: CominsTableState<TData>): {
|
|
641
|
+
selection: CominsSelectionState;
|
|
642
|
+
columnOrder: string[];
|
|
643
|
+
columnGroups: CominsTableRuntimeColumnGroup[];
|
|
644
|
+
columnGroupState: Record<string, CominsColumnGroupRuntimeState>;
|
|
645
|
+
columns: CominsTableRuntimeColumn<TData, unknown>[];
|
|
646
|
+
columnState: Record<string, CominsColumnRuntimeState>;
|
|
647
|
+
getRowId: (row: TData, index: number) => CominsRowId;
|
|
648
|
+
pagination: CominsPaginationState;
|
|
649
|
+
rowIds: CominsRowId[];
|
|
650
|
+
rows: TData[];
|
|
651
|
+
showHeader: boolean;
|
|
652
|
+
sort: CominsSortState | null;
|
|
653
|
+
theme: CominsTableTheme;
|
|
654
|
+
};
|
|
655
|
+
export declare function isCominsRowSelected<TData>(state: CominsTableState<TData>, rowId: CominsRowId): boolean;
|
|
656
|
+
export declare function isCominsCellSelected<TData>(state: CominsTableState<TData>, cell: CominsCellAddress): boolean;
|
|
657
|
+
export declare function getCominsSelectedCellRange<TData>(state: CominsTableState<TData>, range?: CominsCellRange | null): CominsCellAddress[];
|
|
658
|
+
export declare function isCominsCellInSelectedRange<TData>(state: CominsTableState<TData>, cell: CominsCellAddress): boolean;
|
|
659
|
+
export declare function getCominsVisibleColumns<TData>(state: CominsTableState<TData>): CominsTableRuntimeColumn<TData, unknown>[];
|
|
660
|
+
export declare function getCominsHeaderRows<TData>(state: CominsTableState<TData>): Array<Array<CominsHeaderCell<TData>>>;
|
|
661
|
+
export declare function getCominsSortedRowIndexes<TData>(state: CominsTableState<TData>): number[];
|
|
662
|
+
export declare function sortCominsRows<TData>(state: CominsTableState<TData>, sort: CominsSortState | null): CominsTableState<TData>;
|
|
663
|
+
export declare function getCominsPageRows<TData>(state: CominsTableState<TData>, pagination?: Partial<CominsPaginationState>): NonNullable<TData>[];
|
|
664
|
+
export declare function getCominsVirtualRows<TData>(state: CominsTableState<TData>, { overscan, rowHeight, scrollTop, viewportHeight }: CominsVirtualRowsOptions): CominsVirtualRows<TData>;
|
|
665
|
+
export declare function moveCominsRow<TData>(state: CominsTableState<TData>, rowId: CominsRowId, targetIndex: number): CominsTableState<TData>;
|
|
666
|
+
export declare function getCominsCellValue<TData>(state: CominsTableState<TData>, row: TData, columnId: string): unknown;
|
|
667
|
+
export declare function formatCominsCellValue<TData>(state: CominsTableState<TData>, row: TData, rowId: CominsRowId, column: CominsTableRuntimeColumn<TData>): React.ReactNode;
|
|
668
|
+
export declare function isCominsCellDisabled<TData>(state: CominsTableState<TData>, row: TData, rowId: CominsRowId, column: CominsTableRuntimeColumn<TData>): boolean;
|
|
669
|
+
export declare function getCominsCellClassName<TData>(state: CominsTableState<TData>, row: TData, rowId: CominsRowId, column: CominsTableRuntimeColumn<TData>): string | undefined;
|
|
670
|
+
export declare function getCominsCellStyle<TData>(state: CominsTableState<TData>, row: TData, rowId: CominsRowId, column: CominsTableRuntimeColumn<TData>): React.CSSProperties | undefined;
|
|
671
|
+
export declare function copyCominsRow<TData>(state: CominsTableState<TData>, rowId: CominsRowId): CominsCopiedRow<TData>;
|
|
672
|
+
export declare function pasteCominsRow<TData>(state: CominsTableState<TData>, copied: CominsCopiedRow<TData>, options: CominsPasteRowOptions<TData>): CominsTableState<TData>;
|
|
673
|
+
export declare function copyCominsCell<TData>(state: CominsTableState<TData>, { columnId, rowId }: CominsCellAddress): CominsCopiedCell | null;
|
|
674
|
+
export declare function pasteCominsCell<TData>(state: CominsTableState<TData>, { columnId, rowId }: CominsCellAddress, copied: CominsCopiedCell | null): CominsTableState<TData>;
|
|
675
|
+
export declare function copyCominsCellRange<TData>(state: CominsTableState<TData>, range?: CominsCellRange | null): CominsCopiedCellRange | null;
|
|
676
|
+
export declare function pasteCominsCellRange<TData>(state: CominsTableState<TData>, target: CominsCellAddress, copied: CominsCopiedCellRange | null): CominsTableState<TData>;
|
|
677
|
+
export declare function fillCominsCellRange<TData>(state: CominsTableState<TData>, { source, target }: CominsFillCellRangeOptions): CominsTableState<TData>;
|
|
678
|
+
export declare function exportCominsRowsToCsv<TData>({ columnOrder, columns, headerOverrides, rows, valueSource, }: CominsExportRowsOptions<TData>): string;
|
|
679
|
+
export declare function exportCominsRowsToJson<TData>({ columnOrder, columns, headerOverrides, rows, valueSource, }: CominsExportRowsOptions<TData>): string;
|
|
680
|
+
//# sourceMappingURL=core.d.ts.map
|