@ishibashi0112/spreadsheet-grid 0.24.0 → 0.26.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.
- package/dist/CellEditorLayer.d.ts +3 -2
- package/dist/SpreadsheetGrid.d.ts +1 -1
- package/dist/editors/DateCellEditor.d.ts +3 -2
- package/dist/editors/NumberCellEditor.d.ts +3 -2
- package/dist/editors/SelectCellEditor.d.ts +3 -2
- package/dist/editors/TextCellEditor.d.ts +3 -2
- package/dist/editors/editorKeyBindings.d.ts +4 -2
- package/dist/hooks/useFilterPopoverController.d.ts +5 -2
- package/dist/hooks/useGridEditController.d.ts +1 -2
- package/dist/hooks/useGridKeyboardInteractions.d.ts +0 -1
- package/dist/index.cjs +5 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1957 -1841
- package/dist/logic/inferFilterType.d.ts +19 -0
- package/dist/model/gridTypes.d.ts +6 -2
- package/dist/view/ColumnFilterPopover.d.ts +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ColumnFilterUiType } from '../model/gridTypes';
|
|
2
|
+
export type InferredColumnFilterType = Extract<ColumnFilterUiType, 'numberSet' | 'textSet' | 'dateSet' | 'text'>;
|
|
3
|
+
export type InferFilterTypeResult = {
|
|
4
|
+
filterType: InferredColumnFilterType;
|
|
5
|
+
source: 'editor' | 'values' | 'fallback';
|
|
6
|
+
conclusive: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const INFER_SAMPLE_LIMIT = 1000;
|
|
9
|
+
export declare const INFER_SCAN_LIMIT = 20000;
|
|
10
|
+
type InferFilterTypeInput = {
|
|
11
|
+
editorType?: string;
|
|
12
|
+
isServerSide?: boolean;
|
|
13
|
+
rowCount: number;
|
|
14
|
+
getRawValueAt: (index: number) => unknown;
|
|
15
|
+
sampleLimit?: number;
|
|
16
|
+
scanLimit?: number;
|
|
17
|
+
};
|
|
18
|
+
export declare const inferColumnFilterType: ({ editorType, isServerSide, rowCount, getRawValueAt, sampleLimit, scanLimit, }: InferFilterTypeInput) => InferFilterTypeResult;
|
|
19
|
+
export {};
|
|
@@ -105,6 +105,8 @@ export type GridSelectFilterOption = {
|
|
|
105
105
|
label: string;
|
|
106
106
|
value: string;
|
|
107
107
|
};
|
|
108
|
+
export type ColumnFilterUiType = 'text' | 'textSet' | 'number' | 'numberSet' | 'date' | 'dateSet' | 'select' | 'set' | 'custom';
|
|
109
|
+
export type ColumnFilterTypeOption = ColumnFilterUiType | 'auto';
|
|
108
110
|
export type SetColumnFilterValue = {
|
|
109
111
|
kind: 'set';
|
|
110
112
|
mode?: 'include' | 'exclude';
|
|
@@ -240,7 +242,8 @@ export type CellValueFormatterParams<T> = {
|
|
|
240
242
|
column: GridColumn<T>;
|
|
241
243
|
};
|
|
242
244
|
export type CellValueFormatter<T> = (params: CellValueFormatterParams<T>) => string;
|
|
243
|
-
export type EditorCommitDirection = 'down' | 'right' | 'left';
|
|
245
|
+
export type EditorCommitDirection = 'down' | 'up' | 'right' | 'left';
|
|
246
|
+
export type EditorEnterMove = 'down' | 'up' | 'right' | 'left' | 'none';
|
|
244
247
|
export type GridSelectEditorOption = GridSelectFilterOption;
|
|
245
248
|
export type GridColumnEditor<T> = {
|
|
246
249
|
type: 'text';
|
|
@@ -341,7 +344,7 @@ export type GridColumn<T> = {
|
|
|
341
344
|
align?: 'left' | 'center' | 'right';
|
|
342
345
|
valueFormatter?: CellValueFormatter<T>;
|
|
343
346
|
renderHeader?: (ctx: HeaderRenderContext<T>) => ReactNode;
|
|
344
|
-
filterType?:
|
|
347
|
+
filterType?: ColumnFilterTypeOption;
|
|
345
348
|
filterOptions?: GridSelectFilterOption[];
|
|
346
349
|
filterFn?: (row: T, filterValue: unknown) => boolean;
|
|
347
350
|
editor?: GridColumnEditor<T>;
|
|
@@ -626,6 +629,7 @@ export type SpreadsheetGridProps<T> = {
|
|
|
626
629
|
canEditCell?: (rowIndex: number, colIndex: number, row: T, column: GridColumn<T>) => boolean;
|
|
627
630
|
enableUndoRedo?: boolean;
|
|
628
631
|
enableClearOnDelete?: boolean;
|
|
632
|
+
editorEnterMove?: EditorEnterMove;
|
|
629
633
|
undoHistoryLimit?: number;
|
|
630
634
|
onUndoRedoStateChange?: (state: UndoRedoState) => void;
|
|
631
635
|
enableRangeSelection?: boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ColumnFilterUiType } from '../model/gridTypes';
|
|
1
2
|
import { type RefObject } from 'react';
|
|
2
3
|
import { type ColumnFilterSetSelection } from '../logic/setFilterSelection';
|
|
3
4
|
import { type NumberFilterConditionDraft } from '../logic/numberFilterCondition';
|
|
@@ -16,7 +17,7 @@ type ColumnFilterPopoverProps = {
|
|
|
16
17
|
isOpen: boolean;
|
|
17
18
|
themeClassName?: string;
|
|
18
19
|
title: string;
|
|
19
|
-
filterType:
|
|
20
|
+
filterType: ColumnFilterUiType;
|
|
20
21
|
draftValue: string;
|
|
21
22
|
numberConditionDraft: NumberFilterConditionDraft | null;
|
|
22
23
|
onNumberConditionDraftChange: (draft: NumberFilterConditionDraft) => void;
|