@ishibashi0112/spreadsheet-grid 0.24.0 → 0.25.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/hooks/useFilterPopoverController.d.ts +5 -2
- package/dist/index.cjs +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1263 -1179
- package/dist/logic/inferFilterType.d.ts +19 -0
- package/dist/model/gridTypes.d.ts +3 -1
- 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';
|
|
@@ -341,7 +343,7 @@ export type GridColumn<T> = {
|
|
|
341
343
|
align?: 'left' | 'center' | 'right';
|
|
342
344
|
valueFormatter?: CellValueFormatter<T>;
|
|
343
345
|
renderHeader?: (ctx: HeaderRenderContext<T>) => ReactNode;
|
|
344
|
-
filterType?:
|
|
346
|
+
filterType?: ColumnFilterTypeOption;
|
|
345
347
|
filterOptions?: GridSelectFilterOption[];
|
|
346
348
|
filterFn?: (row: T, filterValue: unknown) => boolean;
|
|
347
349
|
editor?: GridColumnEditor<T>;
|
|
@@ -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;
|