schummar-table 0.18.0 → 0.20.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/cjs/index.js +2667 -2496
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/mui4Theme.js +4 -1
- package/dist/cjs/mui4Theme.js.map +1 -1
- package/dist/cjs/mui5Theme.js +5 -2
- package/dist/cjs/mui5Theme.js.map +1 -1
- package/dist/cjs/tableTheme.js +67 -48
- package/dist/cjs/tableTheme.js.map +1 -1
- package/dist/es/index.js +2670 -2499
- package/dist/es/index.js.map +1 -1
- package/dist/es/mui4Theme.js +4 -1
- package/dist/es/mui4Theme.js.map +1 -1
- package/dist/es/mui5Theme.js +5 -2
- package/dist/es/mui5Theme.js.map +1 -1
- package/dist/es/tableTheme.js +73 -55
- package/dist/es/tableTheme.js.map +1 -1
- package/dist/types/components/autoFocusTextField.d.ts +2 -2
- package/dist/types/components/cell.d.ts +3 -3
- package/dist/types/components/columnHeader.d.ts +1 -1
- package/dist/types/components/dateFilter.d.ts +2 -2
- package/dist/types/components/dateInput.d.ts +1 -1
- package/dist/types/components/datePicker.d.ts +1 -1
- package/dist/types/components/expandControl.d.ts +2 -2
- package/dist/types/components/formControlLabel.d.ts +2 -2
- package/dist/types/components/numberField.d.ts +9 -0
- package/dist/types/components/rangeFilter.d.ts +3 -0
- package/dist/types/components/resizeHandle.d.ts +1 -1
- package/dist/types/components/row.d.ts +3 -4
- package/dist/types/components/selectComponent.d.ts +1 -1
- package/dist/types/components/selectFilter.d.ts +2 -2
- package/dist/types/components/sortComponent.d.ts +1 -1
- package/dist/types/components/table.d.ts +2 -8
- package/dist/types/components/textFilter.d.ts +1 -1
- package/dist/types/components/virtualized.d.ts +2 -2
- package/dist/types/hooks/useFilter.d.ts +1 -1
- package/dist/types/hooks/useMemoMap.d.ts +2 -2
- package/dist/types/hooks/useTableMemo.d.ts +3 -3
- package/dist/types/hooks/useTheme.d.ts +1 -1
- package/dist/types/index.d.ts +5 -3
- package/dist/types/internalState/calcItems.d.ts +2 -2
- package/dist/types/internalState/calcProps.d.ts +1 -1
- package/dist/types/internalState/cleanupState.d.ts +2 -2
- package/dist/types/internalState/filterColumns.d.ts +2 -2
- package/dist/types/internalState/normalizeExpanded.d.ts +2 -2
- package/dist/types/internalState/syncSelections.d.ts +2 -2
- package/dist/types/internalState/tableStateStorage.d.ts +2 -2
- package/dist/types/internalState/useTableState.d.ts +1 -1
- package/dist/types/misc/calcClassNames.d.ts +2 -0
- package/dist/types/misc/debounce.d.ts +1 -1
- package/dist/types/misc/helpers.d.ts +6 -4
- package/dist/types/misc/tableContext.d.ts +8 -0
- package/dist/types/misc/throttle.d.ts +1 -1
- package/dist/types/theme/defaultTheme/badge.d.ts +1 -1
- package/dist/types/theme/defaultTheme/button.d.ts +1 -1
- package/dist/types/theme/defaultTheme/checkbox.d.ts +1 -1
- package/dist/types/theme/defaultTheme/defaultColors.d.ts +1 -1
- package/dist/types/theme/defaultTheme/defaultComponents.d.ts +1 -1
- package/dist/types/theme/defaultTheme/defaultIcons.d.ts +1 -1
- package/dist/types/theme/defaultTheme/defaultTexts.d.ts +1 -1
- package/dist/types/theme/defaultTheme/iconButton.d.ts +1 -1
- package/dist/types/theme/defaultTheme/index.d.ts +1 -1
- package/dist/types/theme/defaultTheme/popover.d.ts +1 -6
- package/dist/types/theme/defaultTheme/textField.d.ts +1 -1
- package/dist/types/theme/mui4Theme/index.d.ts +3 -3
- package/dist/types/theme/mui5Theme/index.d.ts +3 -3
- package/dist/types/theme/tableTheme.d.ts +5 -4
- package/dist/types/types.d.ts +18 -9
- package/package.json +51 -32
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
export declare function FormControlLabel({ control, label, disabled }: {
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export declare function FormControlLabel({ control, label, disabled, }: {
|
|
3
3
|
control: ReactNode;
|
|
4
4
|
label: ReactNode;
|
|
5
5
|
disabled?: boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TableTheme } from '../types';
|
|
3
|
+
type TextFieldProps = TableTheme['components']['TextField'] extends React.ComponentType<infer T> ? T : never;
|
|
4
|
+
export interface NumberFieldProps extends Omit<TextFieldProps, 'value' | 'onChange'> {
|
|
5
|
+
value?: number | null;
|
|
6
|
+
onChange?: (value: number | null) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function NumberField({ value: commitedValue, onChange, ...textFieldProps }: NumberFieldProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTMLProps } from 'react';
|
|
1
|
+
import type { HTMLProps } from 'react';
|
|
2
2
|
export declare function ResizeHandle(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
3
3
|
export declare function ResizeHandleView({ enabled, ...props }: HTMLProps<HTMLDivElement> & {
|
|
4
4
|
enabled?: boolean;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import { Id
|
|
3
|
-
export declare
|
|
4
|
-
export declare const Row: React.MemoExoticComponent<(<T>({ itemId, rowIndex }: {
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Id } from '../types';
|
|
3
|
+
export declare const Row: import("react").MemoExoticComponent<(<T>({ itemId, rowIndex, }: {
|
|
5
4
|
itemId: Id;
|
|
6
5
|
rowIndex: number;
|
|
7
6
|
}) => JSX.Element | null)>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { CommonFilterProps, SerializableValue } from '../types';
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { CommonFilterProps, SerializableValue } from '../types';
|
|
3
3
|
export declare function SelectFilter<T, V, F extends SerializableValue>({ options: providedOptions, stringValue, render, singleSelect, ...props }: {
|
|
4
4
|
/** Which options are provided to select. By default all unique item values are used. */
|
|
5
5
|
options?: F[];
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { Id, InternalTableState, TableProps } from '../types';
|
|
4
|
-
export declare const TableContext: React.Context<Store<InternalTableState<any>> | null>;
|
|
5
|
-
export declare const TableResetContext: React.Context<() => void>;
|
|
6
|
-
export declare const ColumnContext: React.Context<Id | null>;
|
|
7
|
-
export declare function useTableContext<T>(): Store<InternalTableState<T>>;
|
|
8
|
-
export declare function useColumnContext(): Id;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TableProps } from '../types';
|
|
9
3
|
export declare function Table<T>(props: TableProps<T>): JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { CommonFilterProps } from '../types';
|
|
2
|
+
import type { CommonFilterProps } from '../types';
|
|
3
3
|
export declare function TextFilter<T, V>({ compare, filterBy, placeholder, ...props }: {
|
|
4
4
|
/** Custom comparison function. Should return true if an item value matches the current filter value.
|
|
5
5
|
* By default a fuzzy text comparison is used.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HTMLProps, ReactNode } from 'react';
|
|
2
|
-
import { Id } from '../types';
|
|
1
|
+
import type { HTMLProps, ReactNode } from 'react';
|
|
2
|
+
import type { Id } from '../types';
|
|
3
3
|
export declare function Virtualized<T>({ header, footer, children, ...props }: {
|
|
4
4
|
header: ReactNode;
|
|
5
5
|
footer: ReactNode;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FilterImplementation, SerializableValue } from '../types';
|
|
1
|
+
import type { FilterImplementation, SerializableValue } from '../types';
|
|
2
2
|
export declare function useFilter<T, V, F, S extends SerializableValue>(impl: FilterImplementation<T, V, F, S>): {
|
|
3
3
|
isActive: boolean;
|
|
4
4
|
close: () => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { FunctionWithDeps } from '../types';
|
|
2
|
-
export declare function useMemoMap(): <
|
|
1
|
+
import type { FunctionWithDeps } from '../types';
|
|
2
|
+
export declare function useMemoMap(): <Function_ extends (...args: any[]) => any>(key: string, function_: FunctionWithDeps<Function_>) => Function_;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { FunctionWithDeps } from '../types';
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { FunctionWithDeps } from '../types';
|
|
3
3
|
export declare function TableMemoContextProvider({ children }: {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
6
|
-
export declare function useTableMemo(): <
|
|
6
|
+
export declare function useTableMemo(): <Function_ extends (...args: any[]) => any>(key: string, function_: FunctionWithDeps<Function_>) => Function_;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { MemoizedTableTheme } from '../types';
|
|
1
|
+
import type { MemoizedTableTheme } from '../types';
|
|
2
2
|
export declare function useTheme<T, S>(selector: (theme: MemoizedTableTheme<T>) => S): S;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
export { AutoFocusTextField } from './components/autoFocusTextField';
|
|
2
2
|
export { DateFilter } from './components/dateFilter';
|
|
3
|
-
export { dateIntersect, DatePicker, endOfDay, startOfDay, thisWeek, today } from './components/datePicker';
|
|
3
|
+
export { dateIntersect, DatePicker, endOfDay, startOfDay, thisWeek, today, } from './components/datePicker';
|
|
4
4
|
export type { DatePickerProps, DateRange } from './components/datePicker';
|
|
5
|
+
export { RangeFilter } from './components/rangeFilter';
|
|
5
6
|
export { SelectFilter } from './components/selectFilter';
|
|
6
|
-
export {
|
|
7
|
+
export { Table } from './components/table';
|
|
8
|
+
export { ColumnContext, TableContext, TableResetContext, useColumnContext, useTableContext, } from './misc/tableContext';
|
|
7
9
|
export { TextFilter } from './components/textFilter';
|
|
8
10
|
export { useFilter } from './hooks/useFilter';
|
|
9
11
|
export { useTheme } from './hooks/useTheme';
|
|
10
12
|
export type { TableStateStorage } from './internalState/tableStateStorage';
|
|
11
13
|
export * as helpers from './misc/helpers';
|
|
12
14
|
export { termMatch, textMatch } from './misc/textMatch';
|
|
13
|
-
export { configureTableTheme, mergeThemes, TableThemeContext, TableThemeProvider } from './theme/tableTheme';
|
|
15
|
+
export { configureTableTheme, mergeThemes, TableThemeContext, TableThemeProvider, } from './theme/tableTheme';
|
|
14
16
|
export type { Column, CommonFilterProps, FilterImplementation, FunctionWithDeps, Id, InternalColumn, PartialTableTheme, Sort, SortDirection, TableProps, } from './types';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Store } from 'schummar-state/react';
|
|
2
|
-
import { InternalTableState } from '../types';
|
|
1
|
+
import type { Store } from 'schummar-state/react';
|
|
2
|
+
import type { InternalTableState } from '../types';
|
|
3
3
|
export declare function calcItems<T>(state: Store<InternalTableState<T>>): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { InternalTableProps, TableProps } from '../types';
|
|
1
|
+
import type { InternalTableProps, TableProps } from '../types';
|
|
2
2
|
export declare function calcProps<T>(props: TableProps<T>): InternalTableProps<T>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Store } from 'schummar-state/react';
|
|
2
|
-
import { InternalTableState } from '../types';
|
|
1
|
+
import type { Store } from 'schummar-state/react';
|
|
2
|
+
import type { InternalTableState } from '../types';
|
|
3
3
|
export declare function cleanupState<T>(state: Store<InternalTableState<T>>): void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Store } from 'schummar-state/react';
|
|
2
|
-
import { InternalTableState } from '../types';
|
|
1
|
+
import type { Store } from 'schummar-state/react';
|
|
2
|
+
import type { InternalTableState } from '../types';
|
|
3
3
|
export declare function filterColumns<T>(state: Store<InternalTableState<T>>): void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Store } from 'schummar-state/react';
|
|
2
|
-
import { InternalTableState } from '../types';
|
|
1
|
+
import type { Store } from 'schummar-state/react';
|
|
2
|
+
import type { InternalTableState } from '../types';
|
|
3
3
|
export declare function normalizeExpanded<T>(table: Store<InternalTableState<T>>): void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Store } from 'schummar-state/react';
|
|
2
|
-
import { InternalTableState } from '../types';
|
|
1
|
+
import type { Store } from 'schummar-state/react';
|
|
2
|
+
import type { InternalTableState } from '../types';
|
|
3
3
|
export declare function syncSelections<T>(table: Store<InternalTableState<T>>): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Store } from 'schummar-state/react';
|
|
2
|
-
import { InternalTableState } from '../types';
|
|
1
|
+
import type { Store } from 'schummar-state/react';
|
|
2
|
+
import type { InternalTableState } from '../types';
|
|
3
3
|
export type TableStateStorage = {
|
|
4
4
|
getItem: (key: string) => string | null | Promise<string | null>;
|
|
5
5
|
setItem: (key: string, value: string) => unknown | Promise<unknown>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Store } from 'schummar-state/react';
|
|
2
|
-
import { InternalTableState, TableProps } from '../types';
|
|
2
|
+
import type { InternalTableState, TableProps } from '../types';
|
|
3
3
|
export declare function useTableState<T>(_props: TableProps<T>): [Store<InternalTableState<T>>, () => void];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Id, TableItem } from '../types';
|
|
2
|
-
export declare const flatMap: <T, S>(
|
|
3
|
-
export declare const orderBy: <T>(
|
|
4
|
-
export declare const uniq: <T>(
|
|
1
|
+
import type { Id, TableItem } from '../types';
|
|
2
|
+
export declare const flatMap: <T, S>(array: Iterable<T>, flatMap: (t: T) => S[]) => S[];
|
|
3
|
+
export declare const orderBy: <T>(array: T[], selectors?: ((t: T) => any)[], direction?: ('desc' | 'asc')[]) => T[];
|
|
4
|
+
export declare const uniq: <T>(array: T[]) => T[];
|
|
5
5
|
export declare const intersect: <T>(a: Iterable<T>, b: {
|
|
6
6
|
has(t: T): boolean;
|
|
7
7
|
}) => Set<T>;
|
|
@@ -10,6 +10,8 @@ export declare const getDescendants: <T>(...items: TableItem<T>[]) => Set<Id>;
|
|
|
10
10
|
export declare const identity: (x: unknown) => any;
|
|
11
11
|
export declare const asString: (x: unknown) => string;
|
|
12
12
|
export declare const asStringOrArray: (x: unknown) => string | string[];
|
|
13
|
+
export declare const asNumber: (x: unknown) => number | null;
|
|
14
|
+
export declare const asNumberOrArray: (x: unknown) => number | null | (number | null)[];
|
|
13
15
|
export declare const defaultEquals: (a: unknown, b: unknown) => boolean;
|
|
14
16
|
export declare const subStringMatch: (a: string, b: string) => boolean;
|
|
15
17
|
export declare const castArray: <T>(a: T | T[]) => T[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Store } from 'schummar-state/react';
|
|
3
|
+
import type { Id, InternalTableState } from '../types';
|
|
4
|
+
export declare const TableContext: import("react").Context<Store<InternalTableState<any>> | null>;
|
|
5
|
+
export declare const TableResetContext: import("react").Context<() => void>;
|
|
6
|
+
export declare const ColumnContext: import("react").Context<Id | null>;
|
|
7
|
+
export declare function useTableContext<T>(): Store<InternalTableState<T>>;
|
|
8
|
+
export declare function useColumnContext(): Id;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TableTheme } from '../../types';
|
|
1
|
+
import type { TableTheme } from '../../types';
|
|
2
2
|
export declare const Badge: TableTheme['components']['Badge'];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TableTheme } from '../../types';
|
|
1
|
+
import type { TableTheme } from '../../types';
|
|
2
2
|
export declare const Button: TableTheme['components']['Button'];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TableTheme } from '../../types';
|
|
1
|
+
import type { TableTheme } from '../../types';
|
|
2
2
|
export declare const Checkbox: TableTheme['components']['Checkbox'];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TableTheme } from '../../types';
|
|
1
|
+
import type { TableTheme } from '../../types';
|
|
2
2
|
export declare const defaultColors: TableTheme['colors'];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TableTheme } from '../../types';
|
|
1
|
+
import type { TableTheme } from '../../types';
|
|
2
2
|
export declare const defaultComponents: TableTheme['components'];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TableTheme } from '../../types';
|
|
1
|
+
import type { TableTheme } from '../../types';
|
|
2
2
|
export declare const defaultIcons: TableTheme['icons'];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TableTheme } from '../../types';
|
|
1
|
+
import type { TableTheme } from '../../types';
|
|
2
2
|
export declare const defaultTexts: TableTheme['text'];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TableTheme } from '../../types';
|
|
1
|
+
import type { TableTheme } from '../../types';
|
|
2
2
|
export declare const IconButton: TableTheme['components']['IconButton'];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TableTheme } from '../../types';
|
|
1
|
+
import type { TableTheme } from '../../types';
|
|
2
2
|
export declare const defaultTableTheme: TableTheme;
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { TableTheme } from '../../types';
|
|
3
|
-
export declare const PopoverContext: React.Context<{
|
|
4
|
-
depth: number;
|
|
5
|
-
visible: boolean;
|
|
6
|
-
}>;
|
|
1
|
+
import type { TableTheme } from '../../types';
|
|
7
2
|
export declare const Popover: TableTheme['components']['Popover'];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TableTheme } from '../../types';
|
|
1
|
+
import type { TableTheme } from '../../types';
|
|
2
2
|
export declare const TextField: TableTheme['components']['TextField'];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { PartialTableTheme } from '../../types';
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { PartialTableTheme } from '../../types';
|
|
3
3
|
export declare const mui4Theme: PartialTableTheme;
|
|
4
|
-
export declare function Mui4TableThemeProvider({ theme, children }: {
|
|
4
|
+
export declare function Mui4TableThemeProvider({ theme, children, }: {
|
|
5
5
|
theme?: PartialTableTheme;
|
|
6
6
|
children: ReactNode;
|
|
7
7
|
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { PartialTableTheme } from '../../types';
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { PartialTableTheme } from '../../types';
|
|
3
3
|
export declare const mui5Theme: PartialTableTheme;
|
|
4
|
-
export declare function Mui5TableThemeProvider({ theme, children }: {
|
|
4
|
+
export declare function Mui5TableThemeProvider({ theme, children, }: {
|
|
5
5
|
theme?: PartialTableTheme;
|
|
6
6
|
children: ReactNode;
|
|
7
7
|
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { Store } from 'schummar-state/react';
|
|
3
|
+
import type { PartialTableTheme } from '../types';
|
|
4
|
+
export declare const globalTableTheme: Store<PartialTableTheme<unknown>>;
|
|
4
5
|
export declare function configureTableTheme(tableTheme: PartialTableTheme): void;
|
|
5
6
|
export declare const TableThemeContext: import("react").Context<PartialTableTheme<unknown>>;
|
|
6
|
-
export declare function TableThemeProvider({ theme, children }: {
|
|
7
|
+
export declare function TableThemeProvider({ theme, children, }: {
|
|
7
8
|
theme: PartialTableTheme;
|
|
8
9
|
children: ReactNode;
|
|
9
10
|
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { CSSInterpolation } from '@emotion/serialize';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
1
|
+
import type { CSSInterpolation } from '@emotion/serialize';
|
|
2
|
+
import type { ComponentType, DependencyList, ReactNode, Ref } from 'react';
|
|
3
|
+
import type React from 'react';
|
|
4
|
+
import type { TableStateStorage } from './internalState/tableStateStorage';
|
|
5
|
+
import type { CsvExportOptions } from './misc/csvExport';
|
|
5
6
|
export type Sort = {
|
|
6
7
|
columnId: string | number;
|
|
7
8
|
direction: SortDirection;
|
|
@@ -34,6 +35,8 @@ export interface TableTheme<T = unknown> {
|
|
|
34
35
|
clearFilters: ReactNode;
|
|
35
36
|
deselectAll: ReactNode;
|
|
36
37
|
resetAll: ReactNode;
|
|
38
|
+
rangeMin: ReactNode;
|
|
39
|
+
rangeMax: ReactNode;
|
|
37
40
|
};
|
|
38
41
|
/** Define styles. */
|
|
39
42
|
classes?: {
|
|
@@ -43,17 +46,19 @@ export interface TableTheme<T = unknown> {
|
|
|
43
46
|
cell?: string | FunctionWithDeps<(item: T, index: number) => string | undefined>;
|
|
44
47
|
evenCell?: string;
|
|
45
48
|
oddCell?: string;
|
|
49
|
+
popover?: string;
|
|
50
|
+
popoverBackdrop?: string;
|
|
46
51
|
};
|
|
47
52
|
/** Define components to be used in the table. */
|
|
48
53
|
components: {
|
|
49
54
|
IconButton: ComponentType<{
|
|
50
55
|
children: ReactNode;
|
|
51
|
-
onClick?: (
|
|
56
|
+
onClick?: (event: React.MouseEvent<Element>) => void;
|
|
52
57
|
className?: string;
|
|
53
58
|
}>;
|
|
54
59
|
Button: ComponentType<{
|
|
55
60
|
children: ReactNode;
|
|
56
|
-
onClick?: (
|
|
61
|
+
onClick?: (event: React.MouseEvent<Element>) => void;
|
|
57
62
|
startIcon?: ReactNode;
|
|
58
63
|
variant?: 'text' | 'outlined' | 'contained';
|
|
59
64
|
disabled?: boolean;
|
|
@@ -61,7 +66,7 @@ export interface TableTheme<T = unknown> {
|
|
|
61
66
|
}>;
|
|
62
67
|
Checkbox: ComponentType<{
|
|
63
68
|
checked: boolean;
|
|
64
|
-
onChange: (
|
|
69
|
+
onChange: (event: React.ChangeEvent) => void;
|
|
65
70
|
disabled?: boolean;
|
|
66
71
|
className?: string;
|
|
67
72
|
}>;
|
|
@@ -80,8 +85,10 @@ export interface TableTheme<T = unknown> {
|
|
|
80
85
|
badgeContent: ReactNode;
|
|
81
86
|
}>;
|
|
82
87
|
TextField: ComponentType<{
|
|
83
|
-
value
|
|
84
|
-
onChange
|
|
88
|
+
value?: string | null;
|
|
89
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
90
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
91
|
+
startIcon?: ReactNode;
|
|
85
92
|
endIcon?: ReactNode;
|
|
86
93
|
className?: string;
|
|
87
94
|
inputRef?: Ref<HTMLInputElement>;
|
|
@@ -112,6 +119,8 @@ export interface TableTheme<T = unknown> {
|
|
|
112
119
|
};
|
|
113
120
|
/** Spacing. */
|
|
114
121
|
spacing: string | number;
|
|
122
|
+
/** Locale for number and date rendering */
|
|
123
|
+
locale?: string;
|
|
115
124
|
}
|
|
116
125
|
export type PartialTableTheme<T = unknown> = {
|
|
117
126
|
[K in keyof TableTheme<T>]?: TableTheme<T>[K] extends Record<string, any> ? Partial<TableTheme<T>[K]> : TableTheme<T>[K];
|
package/package.json
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "schummar-table",
|
|
3
|
-
"
|
|
4
|
-
"version": "0.18.0",
|
|
3
|
+
"version": "0.20.0",
|
|
5
4
|
"description": "",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"repository": "schummar/schummar-table",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Marco Schumacher",
|
|
9
|
+
"email": "marco@schumacher.dev"
|
|
10
|
+
},
|
|
6
11
|
"type": "module",
|
|
7
12
|
"sideEffects": false,
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
8
16
|
"main": "dist/cjs/index.js",
|
|
9
17
|
"module": "dist/es/index.js",
|
|
18
|
+
"types": "dist/types/index.d.ts",
|
|
10
19
|
"exports": {
|
|
11
20
|
".": {
|
|
12
21
|
"import": "./dist/es/index.js",
|
|
@@ -24,7 +33,6 @@
|
|
|
24
33
|
"default": "./dist/es/mui4Theme.js"
|
|
25
34
|
}
|
|
26
35
|
},
|
|
27
|
-
"types": "dist/types/index.d.ts",
|
|
28
36
|
"typesVersions": {
|
|
29
37
|
"*": {
|
|
30
38
|
"*": [
|
|
@@ -38,11 +46,6 @@
|
|
|
38
46
|
]
|
|
39
47
|
}
|
|
40
48
|
},
|
|
41
|
-
"author": {
|
|
42
|
-
"name": "Marco Schumacher",
|
|
43
|
-
"email": "marco@schumacher.dev"
|
|
44
|
-
},
|
|
45
|
-
"license": "ISC",
|
|
46
49
|
"scripts": {
|
|
47
50
|
"start": "npm -w docs start",
|
|
48
51
|
"build": "runp -k build:clean :p build:compile:* :s build:cjsPackage",
|
|
@@ -51,17 +54,11 @@
|
|
|
51
54
|
"build:compile:types": "tsc",
|
|
52
55
|
"build:cjsPackage": "echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
|
|
53
56
|
"lint": "runp lint:*",
|
|
54
|
-
"lint:eslint": "
|
|
57
|
+
"lint:eslint": "lint .",
|
|
55
58
|
"lint:tsc": "tsc --emitDeclarationOnly false --noEmit",
|
|
56
59
|
"prepublishOnly": "runp lint build",
|
|
57
60
|
"docs:build": "npm -w docs run build"
|
|
58
61
|
},
|
|
59
|
-
"dependencies": {
|
|
60
|
-
"@emotion/react": "^11.10.5",
|
|
61
|
-
"dayzed": "^3.2.3",
|
|
62
|
-
"immer": "^9.0.16",
|
|
63
|
-
"schummar-state": "0.2.1-experimental-13"
|
|
64
|
-
},
|
|
65
62
|
"peerDependencies": {
|
|
66
63
|
"@material-ui/core": ">=4",
|
|
67
64
|
"@mui/material": ">=5",
|
|
@@ -81,34 +78,56 @@
|
|
|
81
78
|
"optional": true
|
|
82
79
|
}
|
|
83
80
|
},
|
|
81
|
+
"dependencies": {
|
|
82
|
+
"@emotion/react": "11.10.5",
|
|
83
|
+
"dayzed": "3.2.3",
|
|
84
|
+
"immer": "9.0.16",
|
|
85
|
+
"nanoid": "4.0.1",
|
|
86
|
+
"schummar-state": "0.2.1-experimental-13"
|
|
87
|
+
},
|
|
84
88
|
"devDependencies": {
|
|
85
|
-
"@emotion/styled": "
|
|
89
|
+
"@emotion/styled": "11.10.5",
|
|
86
90
|
"@material-ui/core": "4.12.4",
|
|
87
|
-
"@mui/material": "
|
|
88
|
-
"@schummar/
|
|
89
|
-
"@
|
|
90
|
-
"@
|
|
91
|
-
"@
|
|
92
|
-
"@
|
|
93
|
-
"@vitejs/plugin-react": "
|
|
94
|
-
"eslint": "
|
|
95
|
-
"eslint-plugin-storybook": "
|
|
96
|
-
"prettier": "
|
|
91
|
+
"@mui/material": "5.11.0",
|
|
92
|
+
"@schummar/eslint-config": "github:schummar/eslint-config",
|
|
93
|
+
"@schummar/prettier-config": "github:schummar/prettier-config",
|
|
94
|
+
"@schummar/runp": "1.8.2",
|
|
95
|
+
"@types/react": "18.0.26",
|
|
96
|
+
"@types/react-dom": "18.0.9",
|
|
97
|
+
"@vitejs/plugin-react": "3.0.0",
|
|
98
|
+
"eslint": "8.29.0",
|
|
99
|
+
"eslint-plugin-storybook": "0.6.8",
|
|
100
|
+
"prettier": "2.8.1",
|
|
97
101
|
"react": "18.2.0",
|
|
98
102
|
"react-dom": "18.2.0",
|
|
99
103
|
"rimraf": "3.0.2",
|
|
100
104
|
"semantic-release": "19.0.5",
|
|
101
|
-
"typescript": "
|
|
102
|
-
"vite": "
|
|
105
|
+
"typescript": "4.9.4",
|
|
106
|
+
"vite": "4.0.1"
|
|
103
107
|
},
|
|
104
|
-
"files": [
|
|
105
|
-
"dist"
|
|
106
|
-
],
|
|
107
108
|
"workspaces": [
|
|
108
109
|
"docs"
|
|
109
110
|
],
|
|
110
111
|
"volta": {
|
|
111
112
|
"node": "16.17.0",
|
|
112
113
|
"npm": "8.19.2"
|
|
113
|
-
}
|
|
114
|
+
},
|
|
115
|
+
"eslintConfig": {
|
|
116
|
+
"extends": [
|
|
117
|
+
"@schummar/eslint-config",
|
|
118
|
+
"plugin:storybook/recommended"
|
|
119
|
+
],
|
|
120
|
+
"rules": {
|
|
121
|
+
"react/no-unknown-property": [
|
|
122
|
+
"error",
|
|
123
|
+
{
|
|
124
|
+
"ignore": [
|
|
125
|
+
"css"
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
],
|
|
129
|
+
"node/no-unpublished-import": "off"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"prettier": "@schummar/prettier-config"
|
|
114
133
|
}
|