@ishibashi0112/spreadsheet-grid 0.34.0 → 0.35.0

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.
@@ -1,794 +1,34 @@
1
1
  import type { CSSProperties, ReactNode, Ref } from 'react';
2
- export type GridRowKey = string | number;
3
- export type RowModel<T> = {
4
- getRowCount: () => number;
5
- getRow: (viewIndex: number) => T;
6
- getSourceIndex: (viewIndex: number) => number;
7
- getRowKey: (viewIndex: number) => GridRowKey;
8
- getGroupRow?: (viewIndex: number) => GridGroupRow | undefined;
9
- };
10
- export type ServerSideQuery = {
11
- globalText?: string;
12
- columnFilters?: Record<string, ColumnFilterValue>;
13
- sort?: GridSortState;
14
- };
15
- export type ServerSideGetRowsParams = {
16
- startIndex: number;
17
- endIndex: number;
18
- query: ServerSideQuery;
19
- signal: AbortSignal;
20
- };
21
- export type ServerSideGetRowsResult<T> = {
22
- rows: T[];
23
- totalRowCount: number;
24
- };
25
- export type ServerSideDataSource<T> = {
26
- getRows: (params: ServerSideGetRowsParams) => Promise<ServerSideGetRowsResult<T>>;
27
- updateRows?: (params: ServerSideUpdateRowsParams<T>) => Promise<ServerSideUpdateRowsResult<T> | void>;
28
- initialRowCount?: number;
29
- blockSize?: number;
30
- maxCachedBlocks?: number;
31
- };
32
- export type ServerSideCellChange = {
33
- columnKey: string;
34
- previousValue: unknown;
35
- newValue: unknown;
36
- };
37
- export type ServerSideRowUpdate<T> = {
38
- rowKey: GridRowKey;
39
- rowIndex: number;
40
- row: T;
41
- previousRow: T;
42
- changes: ServerSideCellChange[];
43
- };
44
- export type ServerSideUpdateRowsParams<T> = {
45
- updates: ServerSideRowUpdate<T>[];
46
- };
47
- export type ServerSideUpdateRowsResult<T> = {
48
- rows?: T[];
49
- };
50
- export type ServerSideLoadErrorParams = {
51
- startIndex: number;
52
- endIndex: number;
53
- };
54
- export type ServerSideWriteErrorParams<T> = {
55
- updates: ServerSideRowUpdate<T>[];
56
- };
57
- export type CellCoord = {
58
- row: number;
59
- col: number;
60
- };
61
- export type CellRange = {
62
- start: CellCoord;
63
- end: CellCoord;
64
- };
65
- export type UndoRedoState = {
66
- canUndo: boolean;
67
- canRedo: boolean;
68
- };
69
- export type GridSelection = {
70
- type: 'cell';
71
- range: CellRange;
72
- } | {
73
- type: 'row';
74
- startRow: number;
75
- endRow: number;
76
- } | {
77
- type: 'col';
78
- startCol: number;
79
- endCol: number;
80
- } | null;
81
- export type RowSelectionState = {
82
- mode: 'include' | 'exclude';
83
- keys: ReadonlySet<GridRowKey>;
84
- };
85
- export type RowSelectionModel = {
86
- type: 'include';
87
- rowKeys: GridRowKey[];
88
- } | {
89
- type: 'exclude';
90
- rowKeys: GridRowKey[];
91
- };
92
- export type RowSelectionMode = 'single' | 'multiple';
93
- export type SelectAllState = 'none' | 'some' | 'all';
94
- export type GridFilterState = {
95
- globalText: string;
96
- columnFilters: Record<string, ColumnFilterValue>;
97
- };
98
- export type GridSortDirection = 'asc' | 'desc' | null;
99
- export type GridSortEntry = {
100
- columnKey: string;
101
- direction: 'asc' | 'desc';
102
- };
103
- export type GridSortState = GridSortEntry[];
104
- export type GridSelectFilterOption = {
105
- label: string;
106
- value: string;
107
- };
108
- export type ColumnFilterUiType = 'text' | 'textSet' | 'number' | 'numberSet' | 'date' | 'dateSet' | 'select' | 'set' | 'custom';
109
- export type ColumnFilterTypeOption = ColumnFilterUiType | 'auto';
110
- export type SetColumnFilterValue = {
111
- kind: 'set';
112
- mode?: 'include' | 'exclude';
113
- values: string[];
114
- };
115
- export type ParsedNumberFilter = {
116
- mode: 'comparison';
117
- operator: '>' | '>=' | '<' | '<=' | '=' | '!=';
118
- value: number;
119
- } | {
120
- mode: 'range';
121
- min: number;
122
- max: number;
123
- } | {
124
- mode: 'blank';
125
- } | {
126
- mode: 'notBlank';
127
- };
128
- export type NumberColumnFilterValue = {
129
- kind: 'number';
130
- raw: string;
131
- parsed: ParsedNumberFilter | null;
132
- };
133
- export type TextColumnFilterValue = {
134
- kind: 'text';
135
- value: string;
136
- };
137
- export type DateColumnFilterValue = {
138
- kind: 'date';
139
- value: string;
140
- };
141
- export type NumberSetColumnFilterValue = {
142
- kind: 'numberSet';
143
- condition: ParsedNumberFilter | null;
144
- set: {
145
- mode?: 'include' | 'exclude';
146
- values: string[];
147
- } | null;
148
- };
149
- export type ParsedTextFilter = {
150
- mode: 'contains' | 'equals' | 'startsWith' | 'endsWith';
151
- value: string;
152
- } | {
153
- mode: 'blank';
154
- } | {
155
- mode: 'notBlank';
156
- };
157
- export type TextSetColumnFilterValue = {
158
- kind: 'textSet';
159
- condition: ParsedTextFilter | null;
160
- set: {
161
- mode?: 'include' | 'exclude';
162
- values: string[];
163
- } | null;
164
- };
165
- export type DateFilterPreset = 'today' | 'thisMonth' | 'last30days';
166
- export type DateFilterPresetRange = {
167
- from?: string | Date;
168
- to?: string | Date;
169
- };
170
- export type CustomDateFilterPreset = {
171
- id: string;
172
- label: string;
173
- resolve: (now: Date) => DateFilterPresetRange;
174
- };
175
- export type DateFilterPresetOption = DateFilterPreset | CustomDateFilterPreset;
176
- export type FilterDateInputContext = {
177
- value: string;
178
- onChange: (value: string | Date | null) => void;
179
- ariaLabel: string;
180
- slot: 'single' | 'from' | 'to';
181
- columnKey: string;
182
- };
183
- export type ParsedDateFilter = {
184
- mode: 'range';
185
- from: string;
186
- to: string;
187
- } | {
188
- mode: 'onOrAfter' | 'onOrBefore' | 'equals' | 'notEquals';
189
- value: string;
190
- } | {
191
- mode: 'blank';
192
- } | {
193
- mode: 'notBlank';
194
- } | {
195
- mode: 'preset';
196
- preset: string;
197
- };
198
- export type DateSetColumnFilterValue = {
199
- kind: 'dateSet';
200
- condition: ParsedDateFilter | null;
201
- set: {
202
- mode?: 'include' | 'exclude';
203
- values: string[];
204
- } | null;
205
- };
206
- export type SelectColumnFilterValue = {
207
- kind: 'select';
208
- value: string;
209
- };
210
- export type CustomColumnFilterValue = {
211
- kind: 'custom';
212
- value: unknown;
213
- };
214
- export type ColumnFilterValue = SetColumnFilterValue | NumberColumnFilterValue | NumberSetColumnFilterValue | TextColumnFilterValue | TextSetColumnFilterValue | DateColumnFilterValue | DateSetColumnFilterValue | SelectColumnFilterValue | CustomColumnFilterValue;
215
- export type CellRenderContext<T> = {
216
- row: T;
217
- rowIndex: number;
218
- sourceRowIndex: number;
219
- rowKey: GridRowKey;
220
- colIndex: number;
221
- value: unknown;
222
- column: GridColumn<T>;
223
- isActive: boolean;
224
- isSelected: boolean;
225
- isEditing: boolean;
226
- readOnly: boolean;
227
- setValue: (value: unknown) => void;
228
- detail?: CellDetailContext;
229
- };
230
- export type CellDetailContext = {
231
- expanded: boolean;
232
- expandable: boolean;
233
- toggle: () => void;
234
- setExpanded: (expanded: boolean) => void;
235
- };
236
- export type DetailRowRenderContext<T> = {
237
- row: T;
238
- rowKey: GridRowKey;
239
- rowIndex: number;
240
- sourceRowIndex: number;
241
- collapse: () => void;
242
- };
243
- export type DetailRowOptions<T> = {
244
- render: (ctx: DetailRowRenderContext<T>) => ReactNode;
245
- height?: number;
246
- isExpandable?: (row: T, ctx: {
247
- rowKey: GridRowKey;
248
- sourceRowIndex: number;
249
- }) => boolean;
250
- showToggleColumn?: boolean;
251
- className?: GridSlotProps;
252
- };
253
- export type RowDragContext = {
254
- rowKey: GridRowKey;
255
- sourceRowIndex: number;
256
- };
257
- export type RowMoveParams<T> = {
258
- rowKey: GridRowKey;
259
- fromIndex: number;
260
- toIndex: number;
261
- rows: T[];
262
- };
263
- export type CellStyleContext<T> = {
264
- row: T;
265
- rowIndex: number;
266
- sourceRowIndex: number;
267
- rowKey: GridRowKey;
268
- colIndex: number;
269
- value: unknown;
270
- column: GridColumn<T>;
271
- isActive: boolean;
272
- isSelected: boolean;
273
- isEditing: boolean;
274
- readOnly: boolean;
275
- };
276
- export type RowStyleContext<T> = {
277
- row: T;
278
- rowIndex: number;
279
- sourceRowIndex: number;
280
- rowKey: GridRowKey;
281
- isSelected: boolean;
282
- };
283
- export type CellRenderState = {
284
- isActive: boolean;
285
- isSelected: boolean;
286
- isEditing: boolean;
287
- readOnly: boolean;
288
- };
289
- export type HeaderRenderContext<T> = {
290
- colIndex: number;
291
- width: number;
292
- column: GridColumn<T>;
293
- filterValue?: unknown;
294
- isFiltered?: boolean;
295
- };
296
- export type GridColumnPinned = 'left' | 'right';
297
- export type CellValueFormatterParams<T> = {
298
- value: unknown;
299
- row: T;
300
- column: GridColumn<T>;
301
- };
302
- export type CellValueFormatter<T> = (params: CellValueFormatterParams<T>) => string;
303
- export type EditorCommitDirection = 'down' | 'up' | 'right' | 'left';
304
- export type EditorEnterMove = 'down' | 'up' | 'right' | 'left' | 'none';
305
- export type GridSelectEditorOption = GridSelectFilterOption;
306
- export type GridColumnEditor<T> = {
307
- type: 'text';
308
- } | {
309
- type: 'number';
310
- min?: number;
311
- max?: number;
312
- step?: number;
313
- } | {
314
- type: 'select';
315
- options: GridSelectEditorOption[] | ((row: T) => GridSelectEditorOption[]);
316
- } | {
317
- type: 'date';
318
- } | {
319
- type: 'checkbox';
320
- checkedValue?: unknown;
321
- uncheckedValue?: unknown;
322
- } | {
323
- type: 'custom';
324
- render: (ctx: CellEditorContext<T>) => ReactNode;
325
- };
326
- export type CellEditorContext<T> = {
327
- row: T;
328
- rowIndex: number;
329
- sourceRowIndex: number;
330
- rowKey: GridRowKey;
331
- colIndex: number;
332
- column: GridColumn<T>;
333
- value: unknown;
334
- initialText: string;
335
- align?: 'left' | 'center' | 'right';
336
- commit: (value: unknown, direction?: EditorCommitDirection) => EditorCommitResult;
337
- cancel: () => void;
338
- };
339
- export type GridValidationMode = 'mark' | 'reject';
340
- export type CellValidationContext<T> = {
341
- value: unknown;
342
- row: T;
343
- column: GridColumn<T>;
344
- };
345
- export type CellValidationResult = boolean | string | {
346
- message: string;
347
- };
348
- export type GridInvalidCell = {
349
- rowKey: GridRowKey;
350
- sourceRowIndex: number;
351
- columnKey: string;
352
- message: string;
353
- };
354
- export type EditorCommitResult = {
355
- status: 'committed';
356
- } | {
357
- status: 'rejected';
358
- message: string;
359
- } | {
360
- status: 'noop';
361
- };
362
- export type GridAggFuncName = 'sum' | 'min' | 'max' | 'avg' | 'count';
363
- export type GridAggFuncParams<T> = {
364
- values: unknown[];
365
- rows: T[];
366
- column: GridColumn<T>;
367
- };
368
- export type GridAggFunc<T> = (params: GridAggFuncParams<T>) => unknown;
369
- export type GridGroupRow = {
370
- kind: 'group';
371
- groupKey: string;
372
- columnKey: string;
373
- value: unknown;
374
- label: string;
375
- level: number;
376
- leafCount: number;
377
- aggregates: Record<string, unknown>;
378
- };
379
- export type GridColumn<T> = {
380
- key: string;
381
- title?: string;
382
- width: number;
383
- minWidth?: number;
384
- maxWidth?: number;
385
- wordBreak?: 'normal' | 'break-all' | 'keep-all' | 'break-word' | 'auto-phrase';
386
- lineBreak?: 'auto' | 'loose' | 'normal' | 'strict' | 'anywhere';
387
- flex?: number;
388
- resizable?: boolean;
389
- suppressAutoSize?: boolean;
390
- estimateCellWidth?: (row: T, column: GridColumn<T>) => number;
391
- autoHeight?: boolean;
392
- visible?: boolean;
393
- editable?: boolean;
394
- readOnly?: boolean;
395
- pinned?: GridColumnPinned;
396
- rowGroup?: boolean;
397
- aggFunc?: GridAggFuncName | GridAggFunc<T>;
398
- getValue?: (row: T) => unknown;
399
- setValue?: (row: T, value: unknown) => T;
400
- renderCell?: (ctx: CellRenderContext<T>) => ReactNode;
401
- cellClassName?: GridSlotProps | ((ctx: CellStyleContext<T>) => GridSlotProps | undefined);
402
- align?: 'left' | 'center' | 'right';
403
- valueFormatter?: CellValueFormatter<T>;
404
- renderHeader?: (ctx: HeaderRenderContext<T>) => ReactNode;
405
- filterType?: ColumnFilterTypeOption;
406
- filterOptions?: readonly GridSelectFilterOption[];
407
- dateFilterPresets?: false | readonly DateFilterPresetOption[];
408
- filterFn?: (row: T, filterValue: unknown) => boolean;
409
- editor?: GridColumnEditor<T>;
410
- validate?: (ctx: CellValidationContext<T>) => CellValidationResult;
411
- validationMode?: GridValidationMode;
412
- parseClipboardValue?: (raw: string, row: T) => unknown;
413
- formatClipboardValue?: (value: unknown, row: T) => string;
414
- };
415
- export type ColumnResizeDragState = {
416
- type: 'columnResize';
417
- columnKey: string;
418
- startX: number;
419
- startWidth: number;
420
- minWidth: number;
421
- maxWidth: number;
422
- };
423
- export type CellSelectionDragState = {
424
- type: 'selection';
425
- selectionKind: 'cell';
426
- anchor: CellCoord;
427
- };
428
- export type RowSelectionDragState = {
429
- type: 'selection';
430
- selectionKind: 'row';
431
- anchorRow: number;
432
- };
433
- export type ColumnSelectionDragState = {
434
- type: 'selection';
435
- selectionKind: 'col';
436
- anchorCol: number;
437
- };
438
- export type GridUiState = {
439
- activeCell: CellCoord | null;
440
- selection: GridSelection;
441
- rowSelection: RowSelectionState;
442
- editingCell: CellCoord | null;
443
- dragState: CellSelectionDragState | RowSelectionDragState | ColumnSelectionDragState | ColumnResizeDragState | null;
444
- columnWidths: Record<string, number>;
445
- filters: GridFilterState;
446
- sort: GridSortState;
447
- collapsedGroupKeys: ReadonlySet<string>;
448
- expandedDetailRowKeys: ReadonlySet<GridRowKey>;
449
- };
450
- export type SpreadsheetGridSelectionStats = {
451
- selectedCellCount: number;
452
- selectedRowCount: number;
453
- selectedColumnCount: number;
454
- };
455
- export type SpreadsheetGridDerivedSummary = {
456
- rowSummaryText: string;
457
- columnSummaryText: string;
458
- filterSummaryText: string;
459
- sortSummaryText: string;
460
- activeCellLabel: string;
461
- selectionLabel: string;
462
- selectionStatsText: string;
463
- selectionStats: SpreadsheetGridSelectionStats;
464
- hasGlobalFilter: boolean;
465
- globalFilterPreview: string | null;
466
- activeColumnFilterCount: number;
467
- hasAnyFilter: boolean;
468
- hasSorting: boolean;
469
- sortedColumnLabel: string | null;
470
- };
471
- export type GlobalFilterStatus = 'idle' | 'filtering' | 'ready';
472
- export type SpreadsheetGridSlotContext<T> = {
473
- rows: T[];
474
- filteredRows: T[];
475
- columns: GridColumn<T>[];
476
- visibleColumns: GridColumn<T>[];
477
- globalFilterText: string;
478
- columnFilterValues: Record<string, ColumnFilterValue>;
479
- sortState: GridSortState;
480
- setGlobalFilterText: (value: string) => void;
481
- activeCell: CellCoord | null;
482
- selection: GridSelection;
483
- derivedSummary: SpreadsheetGridDerivedSummary;
484
- globalFilterStatus: GlobalFilterStatus;
485
- globalFilterProgress: number;
486
- };
487
- export type GridContextMenuTarget<T> = {
488
- type: 'cell';
489
- rowIndex: number;
490
- colIndex: number;
491
- rowKey: GridRowKey;
492
- row: T;
493
- column: GridColumn<T>;
494
- value: unknown;
495
- } | {
496
- type: 'rowHeader';
497
- rowIndex: number;
498
- rowKey: GridRowKey;
499
- row: T;
500
- };
501
- export type GridContextMenuParams<T> = {
502
- target: GridContextMenuTarget<T>;
503
- clientX: number;
504
- clientY: number;
505
- selection: GridSelection;
506
- activeCell: CellCoord | null;
507
- isTargetSelected: boolean;
508
- };
509
- export type GridContextMenuActionItem = {
510
- kind?: 'action';
511
- id?: string;
512
- label: ReactNode;
513
- icon?: ReactNode;
514
- disabled?: boolean;
515
- danger?: boolean;
516
- onSelect: () => void;
517
- };
518
- export type GridContextMenuLabelItem = {
519
- kind: 'label';
520
- id?: string;
521
- label: ReactNode;
522
- };
523
- export type GridContextMenuSeparatorItem = {
524
- kind: 'separator';
525
- id?: string;
526
- };
527
- export type GridContextMenuCustomItem = {
528
- kind: 'custom';
529
- id?: string;
530
- render: (ctx: {
531
- close: () => void;
532
- }) => ReactNode;
533
- };
534
- export type GridContextMenuItem = GridContextMenuActionItem | GridContextMenuLabelItem | GridContextMenuSeparatorItem | GridContextMenuCustomItem;
535
- export type GridSlotProps = string | {
536
- className?: string;
537
- style?: CSSProperties;
538
- };
539
- export type GridResolvedSlot = {
540
- className?: string;
541
- style?: CSSProperties;
542
- };
543
- export type GridResolvedSlots = Partial<Record<keyof GridClassNames, GridResolvedSlot>>;
544
- export type GridClassNames = {
545
- root?: GridSlotProps;
546
- toolbar?: GridSlotProps;
547
- statusBar?: GridSlotProps;
548
- headerRow?: GridSlotProps;
549
- headerCell?: GridSlotProps;
550
- bodyRow?: GridSlotProps;
551
- bodyCell?: GridSlotProps;
552
- rowHeaderCell?: GridSlotProps;
553
- iconButton?: GridSlotProps;
554
- cornerCell?: GridSlotProps;
555
- groupRow?: GridSlotProps;
556
- groupCell?: GridSlotProps;
557
- detailBand?: GridSlotProps;
558
- detailCard?: GridSlotProps;
559
- popover?: GridSlotProps;
560
- menuItem?: GridSlotProps;
561
- tooltip?: GridSlotProps;
562
- dragGhost?: GridSlotProps;
563
- checkbox?: GridSlotProps;
564
- cellEditor?: GridSlotProps;
565
- emptyState?: GridSlotProps;
566
- filterChipBar?: GridSlotProps;
567
- errorBar?: GridSlotProps;
568
- scrollHint?: GridSlotProps;
569
- activeCellOverlay?: GridSlotProps;
570
- selectionOverlay?: GridSlotProps;
571
- };
572
- export type ScrollAlign = 'auto' | 'start' | 'center' | 'end';
573
- export type GridScrollPosition = {
574
- top: number;
575
- left: number;
576
- };
577
- export type GridScrollEventParams = {
578
- top: number;
579
- left: number;
580
- source: 'user' | 'api';
581
- };
582
- /**
583
- * エクスポートの対象範囲です(exportCsv / downloadCsv / getExportData で共通)。
584
- * - `'view'` : ビュー行全体(フィルター/ソート/列可視・固定順を反映)。**既定値**。スクロール位置に依存しません。
585
- * - `'raw'` : 全ソース行(`rows` 配列順)。フィルターもソートも無視します(列は可視列・固定順に従います)。
586
- * serverSide はソース行配列を持たないため `'view'` 相当へフォールバックします(console.warn を出力)。
587
- * - `'rendered'` : 仮想化ウィンドウ(いま描画中の行のみ・オーバースキャン込み)。結果はスクロール位置に依存します。
588
- * - `'selection'`: 現在の選択範囲(セル/行/列)。選択なしのときは空(CSV は空文字 / データは空配列)を返します。
589
- */
590
- export type CsvExportScope = 'view' | 'raw' | 'rendered' | 'selection' | DeprecatedCsvExportScope;
591
- /**
592
- * 後方互換エイリアスです(実行時挙動は新名称と完全同一): `'all'` → `'view'` / `'visible'` → `'rendered'`。
593
- * @deprecated `'visible'` は「フィルターで見えている行」ではなく「描画中の行(仮想化ウィンドウ)」を
594
- * 指すため誤読のもとになります。新規コードでは `'view'` / `'rendered'` を使用してください。
595
- */
596
- export type DeprecatedCsvExportScope = 'all' | 'visible';
597
- export type CsvExportOptions = {
598
- scope?: CsvExportScope;
599
- includeHeaders?: boolean;
600
- delimiter?: string;
601
- bom?: boolean;
602
- };
603
- export type GridExportOptions = {
604
- scope?: CsvExportScope;
605
- };
606
- export type GridExportCell = {
607
- value: unknown;
608
- text: string;
609
- };
610
- export type GridExportData = {
611
- columns: {
612
- key: string;
613
- title: string;
614
- }[];
615
- rows: GridExportCell[][];
616
- };
617
- export type GridColumnState = {
618
- key: string;
619
- visible?: boolean;
620
- pinned?: GridColumnPinned;
621
- };
622
- export type GridState = {
623
- version: number;
624
- columnWidths: Record<string, number>;
625
- filters: GridFilterState;
626
- sort: GridSortState;
627
- columns?: GridColumnState[];
628
- };
629
- export type SpreadsheetGridHandle<T> = {
630
- scrollToRow: (viewRowIndex: number, options?: {
631
- align?: ScrollAlign;
632
- }) => void;
633
- scrollToCell: (viewRowIndex: number, colIndex: number, options?: {
634
- align?: ScrollAlign;
635
- }) => void;
636
- scrollToTop: () => void;
637
- scrollToBottom: () => void;
638
- getVisibleRowRange: () => {
639
- startIndex: number;
640
- endIndex: number;
641
- } | null;
642
- getScrollPosition: () => GridScrollPosition | null;
643
- setScrollPosition: (position: {
644
- top?: number;
645
- left?: number;
646
- }, options?: {
647
- behavior?: 'auto' | 'smooth';
648
- }) => void;
649
- getActiveCell: () => CellCoord | null;
650
- setActiveCell: (cell: CellCoord | null, options?: {
651
- scrollIntoView?: boolean;
652
- }) => void;
653
- getSelection: () => GridSelection;
654
- selectCell: (viewRowIndex: number, colIndex: number, options?: {
655
- scrollIntoView?: boolean;
656
- }) => void;
657
- selectRange: (range: CellRange, options?: {
658
- scrollIntoView?: boolean;
659
- }) => void;
660
- clearSelection: () => void;
661
- getSelectedRows: () => T[];
662
- exportCsv: (options?: CsvExportOptions) => string;
663
- downloadCsv: (filename?: string, options?: CsvExportOptions) => void;
664
- getExportData: (options?: GridExportOptions) => GridExportData;
665
- getState: () => GridState;
666
- applyState: (state: GridState) => void;
667
- getRowSelection: () => RowSelectionModel;
668
- setRowSelection: (model: RowSelectionModel) => void;
669
- getSelectedRowKeys: () => GridRowKey[];
670
- getSelectedRowData: () => T[];
671
- getSelectedRowCount: () => number;
672
- isRowSelected: (rowKey: GridRowKey) => boolean;
673
- selectAllRows: () => void;
674
- clearRowSelection: () => void;
675
- undo: () => void;
676
- redo: () => void;
677
- canUndo: () => boolean;
678
- canRedo: () => boolean;
679
- clearUndoHistory: () => void;
680
- setGroupCollapsed: (groupKey: string, collapsed: boolean) => void;
681
- expandAllGroups: () => void;
682
- collapseAllGroups: () => void;
683
- getGroupRows: () => GridGroupRow[];
684
- setDetailRowExpanded: (rowKey: GridRowKey, expanded: boolean) => void;
685
- getExpandedDetailRowKeys: () => GridRowKey[];
686
- collapseAllDetailRows: () => void;
687
- moveRow: (rowKey: GridRowKey, toIndex: number) => void;
688
- getInvalidCells: () => GridInvalidCell[];
689
- refreshServerSide: () => void;
690
- openFilterManager: () => void;
691
- closeFilterManager: () => void;
692
- };
693
- export type GridDensity = 'compact' | 'standard' | 'comfortable';
694
- export type GridTheme = 'light' | 'dark' | 'auto';
695
- export type AutoSizeColumnsMode = 'onMount' | 'onDataChange' | false;
696
- export type ScrollHintTrigger = 'scroll' | 'hover' | 'always';
697
- export type ScrollHintRenderArgs<T> = {
698
- rowIndex: number;
699
- rowData: T | undefined;
700
- };
701
- export type ScrollHintOptions<T = unknown> = {
702
- bubble?: boolean;
703
- ruler?: boolean;
704
- scrollbar?: boolean;
705
- trigger?: ScrollHintTrigger;
706
- minRows?: number;
707
- hintColumn?: string;
708
- renderHint?: (args: ScrollHintRenderArgs<T>) => ReactNode;
709
- };
710
- export type SpreadsheetGridProps<T> = {
711
- ref?: Ref<SpreadsheetGridHandle<T>>;
712
- onStateChange?: (state: GridState) => void;
713
- onScroll?: (params: GridScrollEventParams) => void;
714
- rows?: readonly T[];
715
- dataSource?: ServerSideDataSource<T>;
716
- serverSideRefreshToken?: number;
717
- onServerSideLoadError?: (error: unknown, params: ServerSideLoadErrorParams) => void;
718
- onServerSideWriteError?: (error: unknown, params: ServerSideWriteErrorParams<T>) => void;
719
- columns: readonly GridColumn<T>[];
720
- onRowsChange?: (nextRows: T[]) => void;
721
- onColumnsChange?: (nextColumns: GridColumn<T>[]) => void;
722
- rowKeyGetter?: (row: T, index: number) => GridRowKey;
723
- isRowExportable?: (row: T, ctx: {
724
- viewRowIndex: number;
725
- rowKey: GridRowKey;
726
- }) => boolean;
727
- createRow?: () => T;
728
- createOverflowColumn?: (columnIndex: number) => GridColumn<T>;
729
- rowHeight?: number;
730
- autoHeight?: boolean;
731
- estimateRowHeight?: number;
732
- headerHeight?: number;
733
- density?: GridDensity;
734
- theme?: GridTheme;
735
- rowHeaderWidth?: number;
736
- height?: number | string;
737
- maxHeight?: number | string;
738
- readOnly?: boolean;
739
- dimReadOnlyCells?: boolean;
740
- canEditCell?: (rowIndex: number, colIndex: number, row: T, column: GridColumn<T>) => boolean;
741
- enableUndoRedo?: boolean;
742
- enableClearOnDelete?: boolean;
743
- editorEnterMove?: EditorEnterMove;
744
- undoHistoryLimit?: number;
745
- onUndoRedoStateChange?: (state: UndoRedoState) => void;
746
- enableRangeSelection?: boolean;
747
- enableRowSelection?: boolean;
748
- rowSelectionMode?: RowSelectionMode;
749
- enableSelectAllRows?: boolean;
750
- rowSelection?: RowSelectionModel;
751
- selectedRowKeys?: GridRowKey[];
752
- onRowSelectionChange?: (model: RowSelectionModel) => void;
753
- enableGlobalFilter?: boolean;
754
- enableColumnFilter?: boolean;
755
- renderFilterDateInput?: (ctx: FilterDateInputContext) => ReactNode;
756
- enableSorting?: boolean;
757
- enableColumnResize?: boolean;
758
- autoSizeColumns?: AutoSizeColumnsMode;
759
- showCellOverflowTooltip?: boolean;
760
- showValidationMarks?: boolean;
761
- enableRowHover?: boolean;
762
- hoveredRowIndex?: number | null;
763
- onHoveredRowChange?: (viewRowIndex: number | null, ctx: {
764
- source: 'pointer';
765
- }) => void;
766
- enableColumnHeaderHover?: boolean;
767
- enableColumnMenu?: boolean;
768
- noMatchingRowsText?: string;
769
- noRowsText?: string;
770
- showTopBar?: boolean;
771
- showTopBarSummary?: boolean;
772
- showTopBarCounts?: boolean;
773
- showTopBarFilter?: boolean;
774
- globalFilterPlaceholder?: string;
775
- globalFilterIcon?: ReactNode;
776
- showBottomBar?: boolean;
777
- showBottomBarCounts?: boolean;
778
- showFilterChipBar?: boolean;
779
- renderTopBar?: (context: SpreadsheetGridSlotContext<T>) => ReactNode;
780
- renderBottomBar?: (context: SpreadsheetGridSlotContext<T>) => ReactNode;
781
- className?: string;
782
- style?: CSSProperties;
783
- classNames?: GridClassNames;
784
- getRowClassName?: (row: T, rowIndex: number, ctx: RowStyleContext<T>) => GridSlotProps | undefined;
785
- detailRow?: DetailRowOptions<T>;
786
- onExpandedDetailRowKeysChange?: (keys: GridRowKey[]) => void;
787
- enableRowDrag?: boolean;
788
- isRowDraggable?: (row: T, ctx: RowDragContext) => boolean;
789
- onRowMove?: (params: RowMoveParams<T>) => void;
790
- enableContextMenu?: boolean;
791
- getContextMenuItems?: (params: GridContextMenuParams<T>) => GridContextMenuItem[];
792
- onContextMenuOpen?: (params: GridContextMenuParams<T>) => void;
793
- scrollHint?: boolean | ScrollHintOptions<T>;
2
+ import type * as Core from './gridTypes.core';
3
+ export type * from './gridTypes.core';
4
+ export type ReactGridTypes = {
5
+ node: ReactNode;
6
+ style: CSSProperties;
7
+ };
8
+ export type CellRenderContext<T> = Core.CellRenderContext<T, ReactGridTypes>;
9
+ export type DetailRowOptions<T> = Core.DetailRowOptions<T, ReactGridTypes>;
10
+ export type CellStyleContext<T> = Core.CellStyleContext<T, ReactGridTypes>;
11
+ export type HeaderRenderContext<T> = Core.HeaderRenderContext<T, ReactGridTypes>;
12
+ export type CellValueFormatterParams<T> = Core.CellValueFormatterParams<T, ReactGridTypes>;
13
+ export type CellValueFormatter<T> = Core.CellValueFormatter<T, ReactGridTypes>;
14
+ export type GridColumnEditor<T> = Core.GridColumnEditor<T, ReactGridTypes>;
15
+ export type CellEditorContext<T> = Core.CellEditorContext<T, ReactGridTypes>;
16
+ export type CellValidationContext<T> = Core.CellValidationContext<T, ReactGridTypes>;
17
+ export type GridAggFuncParams<T> = Core.GridAggFuncParams<T, ReactGridTypes>;
18
+ export type GridAggFunc<T> = Core.GridAggFunc<T, ReactGridTypes>;
19
+ export type GridColumn<T> = Core.GridColumn<T, ReactGridTypes>;
20
+ export type SpreadsheetGridSlotContext<T> = Core.SpreadsheetGridSlotContext<T, ReactGridTypes>;
21
+ export type GridContextMenuTarget<T> = Core.GridContextMenuTarget<T, ReactGridTypes>;
22
+ export type GridContextMenuParams<T> = Core.GridContextMenuParams<T, ReactGridTypes>;
23
+ export type ScrollHintOptions<T = unknown> = Core.ScrollHintOptions<T, ReactGridTypes>;
24
+ export type GridContextMenuActionItem = Core.GridContextMenuActionItem<ReactGridTypes>;
25
+ export type GridContextMenuLabelItem = Core.GridContextMenuLabelItem<ReactGridTypes>;
26
+ export type GridContextMenuCustomItem = Core.GridContextMenuCustomItem<ReactGridTypes>;
27
+ export type GridContextMenuItem = Core.GridContextMenuItem<ReactGridTypes>;
28
+ export type GridSlotProps = Core.GridSlotProps<ReactGridTypes>;
29
+ export type GridResolvedSlot = Core.GridResolvedSlot<ReactGridTypes>;
30
+ export type GridResolvedSlots = Core.GridResolvedSlots<ReactGridTypes>;
31
+ export type GridClassNames = Core.GridClassNames<ReactGridTypes>;
32
+ export type SpreadsheetGridProps<T> = Core.SpreadsheetGridProps<T, ReactGridTypes> & {
33
+ ref?: Ref<Core.SpreadsheetGridHandle<T>>;
794
34
  };