schummar-table 0.40.5 → 0.40.6
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/index.cjs +4 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -16
- package/dist/index.d.ts +16 -16
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/mui4Theme.d.cts +1 -1
- package/dist/mui4Theme.d.ts +1 -1
- package/dist/mui5Theme.d.cts +1 -1
- package/dist/mui5Theme.d.ts +1 -1
- package/dist/{types-3d4ARU6a.d.ts → types-DcnzwYBU.d.ts} +55 -62
- package/dist/{types-CYMVvUGJ.d.cts → types-xTAreHv_.d.cts} +55 -62
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ComponentType, ReactNode, HTMLProps } from 'react';
|
|
4
|
-
import { T as TableTheme, C as CommonFilterProps,
|
|
5
|
-
export { e as Column, f as FunctionWithDeps, g as InternalColumn,
|
|
4
|
+
import { T as TableTheme, C as CommonFilterProps, a as TableProps, F as FilterImplementation, M as MemoizedTableTheme, I as Id, b as TableItem, c as InternalTableState, P as PartialTableTheme } from './types-xTAreHv_.cjs';
|
|
5
|
+
export { e as Column, f as FunctionWithDeps, g as InternalColumn, S as Sort, h as SortDirection, d as TableStateStorage } from './types-xTAreHv_.cjs';
|
|
6
6
|
import { Store } from 'schummar-state/react';
|
|
7
7
|
import { E as ExporterEntry } from './exporter-u6SatTo6.cjs';
|
|
8
8
|
import '@emotion/react';
|
|
@@ -92,16 +92,16 @@ declare function dateIntersect(a: Date | DateRange | null | undefined, b: Date |
|
|
|
92
92
|
declare function dateClamp(date: Date, min?: Date, max?: Date): Date;
|
|
93
93
|
declare function DatePicker(props: DatePickerProps): _emotion_react_jsx_runtime.JSX.Element;
|
|
94
94
|
|
|
95
|
-
declare function DateFilter<
|
|
95
|
+
declare function DateFilter<TItem, TColumnValue>({ locale, firstDayOfWeek, defaultDateInView, quickOptions, singleSelect, filterBy, minDate, maxDate, showCalendarWeek, ...props }: {
|
|
96
96
|
/** If enabled, only single days can be selected. Ranges otherwise. */
|
|
97
97
|
singleSelect?: boolean;
|
|
98
|
-
} & Pick<DatePickerProps, 'locale' | 'firstDayOfWeek' | 'defaultDateInView' | 'quickOptions' | 'minDate' | 'maxDate' | 'showCalendarWeek'> & CommonFilterProps<
|
|
98
|
+
} & Pick<DatePickerProps, 'locale' | 'firstDayOfWeek' | 'defaultDateInView' | 'quickOptions' | 'minDate' | 'maxDate' | 'showCalendarWeek'> & CommonFilterProps<TItem, TColumnValue, Date | DateRange | null, Date | DateRange | null>): JSX.Element;
|
|
99
99
|
|
|
100
100
|
interface RangeFilterProps<T, V> extends CommonFilterProps<T, V, number | null, [number | null, number | null] | null> {
|
|
101
101
|
min?: number;
|
|
102
102
|
max?: number;
|
|
103
103
|
}
|
|
104
|
-
declare function RangeFilter<
|
|
104
|
+
declare function RangeFilter<TItem, TColumnValue>({ min, max, filterBy, ...props }: RangeFilterProps<TItem, TColumnValue>): JSX.Element;
|
|
105
105
|
|
|
106
106
|
interface VirtualListProps<T> extends Omit<HTMLProps<HTMLDivElement>, 'children'> {
|
|
107
107
|
virtual?: boolean | {
|
|
@@ -116,13 +116,13 @@ interface VirtualListProps<T> extends Omit<HTMLProps<HTMLDivElement>, 'children'
|
|
|
116
116
|
children: (item: T, index: number) => ReactNode;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
declare function SelectFilter<
|
|
119
|
+
declare function SelectFilter<TItem, TColumnValue, TFilterBy>({ options: providedOptions, stringValue, render, singleSelect, hideSearchField, hideResetButton, ...props }: {
|
|
120
120
|
/** Which options are provided to select. By default all unique item values are used. */
|
|
121
|
-
options?:
|
|
121
|
+
options?: TFilterBy[];
|
|
122
122
|
/** String representation of a value. Used to filter options via the text field. */
|
|
123
|
-
stringValue?: (value:
|
|
123
|
+
stringValue?: (value: TFilterBy) => string;
|
|
124
124
|
/** Render values. By default a string representation of the value is used. */
|
|
125
|
-
render?: (value:
|
|
125
|
+
render?: (value: TFilterBy) => ReactNode;
|
|
126
126
|
/** If enabled, only one option can be selected at a time. */
|
|
127
127
|
singleSelect?: boolean;
|
|
128
128
|
/** If enabled, the search field is hidden. */
|
|
@@ -132,24 +132,24 @@ declare function SelectFilter<T, V, F extends SerializableValue>({ options: prov
|
|
|
132
132
|
/** Virtual list props.
|
|
133
133
|
* @default true */
|
|
134
134
|
virtual?: VirtualListProps<unknown>['virtual'];
|
|
135
|
-
} & CommonFilterProps<
|
|
135
|
+
} & CommonFilterProps<TItem, TColumnValue, TFilterBy, Set<TFilterBy>>): JSX.Element;
|
|
136
136
|
|
|
137
137
|
declare function Table<T>(props: TableProps<T>): JSX.Element;
|
|
138
138
|
|
|
139
|
-
declare function TextFilter<
|
|
139
|
+
declare function TextFilter<TItem, TColumnValue>({ compare, filterBy, placeholder, ...props }: {
|
|
140
140
|
/** Custom comparison function. Should return true if an item value matches the current filter value.
|
|
141
141
|
* By default a fuzzy text comparison is used.
|
|
142
142
|
*/
|
|
143
143
|
compare?: (itemValue: string, filterValue: string) => boolean;
|
|
144
144
|
placeholder?: string;
|
|
145
|
-
} & CommonFilterProps<
|
|
145
|
+
} & CommonFilterProps<TItem, TColumnValue, string, string>): JSX.Element;
|
|
146
146
|
|
|
147
|
-
declare function useFilter<
|
|
147
|
+
declare function useFilter<TItem, TColumnValue, TFilterBy, TFilterValue>(impl: FilterImplementation<TItem, TColumnValue, TFilterBy, TFilterValue>): {
|
|
148
148
|
isActive: boolean;
|
|
149
149
|
close: () => void;
|
|
150
|
-
value:
|
|
151
|
-
onChange: (value?:
|
|
152
|
-
filterBy: (value:
|
|
150
|
+
value: TFilterValue | undefined;
|
|
151
|
+
onChange: (value?: TFilterValue) => void;
|
|
152
|
+
filterBy: (value: TColumnValue, item: TItem) => TFilterBy | TFilterBy[];
|
|
153
153
|
};
|
|
154
154
|
|
|
155
155
|
declare function useTheme<T, S>(selector: (theme: MemoizedTableTheme<T>) => S): S;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ComponentType, ReactNode, HTMLProps } from 'react';
|
|
4
|
-
import { T as TableTheme, C as CommonFilterProps,
|
|
5
|
-
export { e as Column, f as FunctionWithDeps, g as InternalColumn,
|
|
4
|
+
import { T as TableTheme, C as CommonFilterProps, a as TableProps, F as FilterImplementation, M as MemoizedTableTheme, I as Id, b as TableItem, c as InternalTableState, P as PartialTableTheme } from './types-DcnzwYBU.js';
|
|
5
|
+
export { e as Column, f as FunctionWithDeps, g as InternalColumn, S as Sort, h as SortDirection, d as TableStateStorage } from './types-DcnzwYBU.js';
|
|
6
6
|
import { Store } from 'schummar-state/react';
|
|
7
7
|
import { E as ExporterEntry } from './exporter-u6SatTo6.js';
|
|
8
8
|
import '@emotion/react';
|
|
@@ -92,16 +92,16 @@ declare function dateIntersect(a: Date | DateRange | null | undefined, b: Date |
|
|
|
92
92
|
declare function dateClamp(date: Date, min?: Date, max?: Date): Date;
|
|
93
93
|
declare function DatePicker(props: DatePickerProps): _emotion_react_jsx_runtime.JSX.Element;
|
|
94
94
|
|
|
95
|
-
declare function DateFilter<
|
|
95
|
+
declare function DateFilter<TItem, TColumnValue>({ locale, firstDayOfWeek, defaultDateInView, quickOptions, singleSelect, filterBy, minDate, maxDate, showCalendarWeek, ...props }: {
|
|
96
96
|
/** If enabled, only single days can be selected. Ranges otherwise. */
|
|
97
97
|
singleSelect?: boolean;
|
|
98
|
-
} & Pick<DatePickerProps, 'locale' | 'firstDayOfWeek' | 'defaultDateInView' | 'quickOptions' | 'minDate' | 'maxDate' | 'showCalendarWeek'> & CommonFilterProps<
|
|
98
|
+
} & Pick<DatePickerProps, 'locale' | 'firstDayOfWeek' | 'defaultDateInView' | 'quickOptions' | 'minDate' | 'maxDate' | 'showCalendarWeek'> & CommonFilterProps<TItem, TColumnValue, Date | DateRange | null, Date | DateRange | null>): JSX.Element;
|
|
99
99
|
|
|
100
100
|
interface RangeFilterProps<T, V> extends CommonFilterProps<T, V, number | null, [number | null, number | null] | null> {
|
|
101
101
|
min?: number;
|
|
102
102
|
max?: number;
|
|
103
103
|
}
|
|
104
|
-
declare function RangeFilter<
|
|
104
|
+
declare function RangeFilter<TItem, TColumnValue>({ min, max, filterBy, ...props }: RangeFilterProps<TItem, TColumnValue>): JSX.Element;
|
|
105
105
|
|
|
106
106
|
interface VirtualListProps<T> extends Omit<HTMLProps<HTMLDivElement>, 'children'> {
|
|
107
107
|
virtual?: boolean | {
|
|
@@ -116,13 +116,13 @@ interface VirtualListProps<T> extends Omit<HTMLProps<HTMLDivElement>, 'children'
|
|
|
116
116
|
children: (item: T, index: number) => ReactNode;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
declare function SelectFilter<
|
|
119
|
+
declare function SelectFilter<TItem, TColumnValue, TFilterBy>({ options: providedOptions, stringValue, render, singleSelect, hideSearchField, hideResetButton, ...props }: {
|
|
120
120
|
/** Which options are provided to select. By default all unique item values are used. */
|
|
121
|
-
options?:
|
|
121
|
+
options?: TFilterBy[];
|
|
122
122
|
/** String representation of a value. Used to filter options via the text field. */
|
|
123
|
-
stringValue?: (value:
|
|
123
|
+
stringValue?: (value: TFilterBy) => string;
|
|
124
124
|
/** Render values. By default a string representation of the value is used. */
|
|
125
|
-
render?: (value:
|
|
125
|
+
render?: (value: TFilterBy) => ReactNode;
|
|
126
126
|
/** If enabled, only one option can be selected at a time. */
|
|
127
127
|
singleSelect?: boolean;
|
|
128
128
|
/** If enabled, the search field is hidden. */
|
|
@@ -132,24 +132,24 @@ declare function SelectFilter<T, V, F extends SerializableValue>({ options: prov
|
|
|
132
132
|
/** Virtual list props.
|
|
133
133
|
* @default true */
|
|
134
134
|
virtual?: VirtualListProps<unknown>['virtual'];
|
|
135
|
-
} & CommonFilterProps<
|
|
135
|
+
} & CommonFilterProps<TItem, TColumnValue, TFilterBy, Set<TFilterBy>>): JSX.Element;
|
|
136
136
|
|
|
137
137
|
declare function Table<T>(props: TableProps<T>): JSX.Element;
|
|
138
138
|
|
|
139
|
-
declare function TextFilter<
|
|
139
|
+
declare function TextFilter<TItem, TColumnValue>({ compare, filterBy, placeholder, ...props }: {
|
|
140
140
|
/** Custom comparison function. Should return true if an item value matches the current filter value.
|
|
141
141
|
* By default a fuzzy text comparison is used.
|
|
142
142
|
*/
|
|
143
143
|
compare?: (itemValue: string, filterValue: string) => boolean;
|
|
144
144
|
placeholder?: string;
|
|
145
|
-
} & CommonFilterProps<
|
|
145
|
+
} & CommonFilterProps<TItem, TColumnValue, string, string>): JSX.Element;
|
|
146
146
|
|
|
147
|
-
declare function useFilter<
|
|
147
|
+
declare function useFilter<TItem, TColumnValue, TFilterBy, TFilterValue>(impl: FilterImplementation<TItem, TColumnValue, TFilterBy, TFilterValue>): {
|
|
148
148
|
isActive: boolean;
|
|
149
149
|
close: () => void;
|
|
150
|
-
value:
|
|
151
|
-
onChange: (value?:
|
|
152
|
-
filterBy: (value:
|
|
150
|
+
value: TFilterValue | undefined;
|
|
151
|
+
onChange: (value?: TFilterValue) => void;
|
|
152
|
+
filterBy: (value: TColumnValue, item: TItem) => TFilterBy | TFilterBy[];
|
|
153
153
|
};
|
|
154
154
|
|
|
155
155
|
declare function useTheme<T, S>(selector: (theme: MemoizedTableTheme<T>) => S): S;
|
package/dist/index.js
CHANGED
|
@@ -908,8 +908,8 @@ function AutoFocusTextField(props) {
|
|
|
908
908
|
|
|
909
909
|
// src/hooks/useFilter.ts
|
|
910
910
|
import { castDraft } from "immer";
|
|
911
|
-
import { useContext as useContext5, useEffect, useLayoutEffect as useLayoutEffect2, useMemo as useMemo3, useRef as useRef2, useState as useState3 } from "react";
|
|
912
911
|
import { nanoid } from "nanoid";
|
|
912
|
+
import { useContext as useContext5, useEffect, useLayoutEffect as useLayoutEffect2, useMemo as useMemo3, useRef as useRef2, useState as useState3 } from "react";
|
|
913
913
|
|
|
914
914
|
// src/misc/debounce.ts
|
|
915
915
|
function debounce(function_, ms) {
|
|
@@ -973,7 +973,9 @@ function useFilter(impl) {
|
|
|
973
973
|
});
|
|
974
974
|
};
|
|
975
975
|
}, [table, columnId, impl]);
|
|
976
|
-
const value = table.useState(
|
|
976
|
+
const value = table.useState(
|
|
977
|
+
(state) => state.filterValues.get(columnId)
|
|
978
|
+
);
|
|
977
979
|
const [dirtyValue, setDirtyValue] = useState3();
|
|
978
980
|
const implRef = useRef2(impl);
|
|
979
981
|
useLayoutEffect2(() => {
|