dinocollab-core 2.2.54 → 2.2.56
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/README.md +1 -23
- package/dist/data-surface/index.js +1 -1
- package/dist/filter-bar/index.js +1 -1
- package/dist/src/data-surface/button-switch.js +1 -1
- package/dist/src/data-surface/button-switch.js.map +1 -1
- package/dist/src/data-surface/index.create.js +1 -1
- package/dist/src/data-surface/index.create.js.map +1 -1
- package/dist/src/data-surface/index.dino.js +1 -1
- package/dist/src/data-surface/index.dino.js.map +1 -1
- package/dist/src/data-surface/ui.units.js +1 -1
- package/dist/src/data-surface/ui.units.js.map +1 -1
- package/dist/src/data-surface/view-grid/index.js +1 -1
- package/dist/src/data-surface/view-grid/index.js.map +1 -1
- package/dist/src/data-surface/view-list/column-selector.js +2 -0
- package/dist/src/data-surface/view-list/column-selector.js.map +1 -0
- package/dist/src/data-surface/view-list/helpers.js +1 -1
- package/dist/src/data-surface/view-list/helpers.js.map +1 -1
- package/dist/src/data-surface/view-list/hooks.js +1 -1
- package/dist/src/data-surface/view-list/hooks.js.map +1 -1
- package/dist/src/data-surface/view-list/index.js +1 -1
- package/dist/src/data-surface/view-list/index.js.map +1 -1
- package/dist/src/data-surface/view-list/types.js.map +1 -1
- package/dist/src/filter-bar/components/ui.units.js +1 -1
- package/dist/src/filter-bar/components/ui.units.js.map +1 -1
- package/dist/src/filter-bar/convert-to-graphql.js +1 -1
- package/dist/src/filter-bar/convert-to-graphql.js.map +1 -1
- package/dist/src/filter-bar/filter-input.js +2 -0
- package/dist/src/filter-bar/filter-input.js.map +1 -0
- package/dist/src/filter-bar/filter-input.types.js +2 -0
- package/dist/src/filter-bar/filter-input.types.js.map +1 -0
- package/dist/src/filter-bar/filter-input.units.js +2 -0
- package/dist/src/filter-bar/filter-input.units.js.map +1 -0
- package/dist/src/filter-bar/filter-menu.helpers.js +2 -0
- package/dist/src/filter-bar/filter-menu.helpers.js.map +1 -0
- package/dist/src/filter-bar/filter-menu.js +2 -0
- package/dist/src/filter-bar/filter-menu.js.map +1 -0
- package/dist/src/filter-bar/filter-menu.styled.js +2 -0
- package/dist/src/filter-bar/filter-menu.styled.js.map +1 -0
- package/dist/src/filter-bar/filter-menu.units.js +2 -0
- package/dist/src/filter-bar/filter-menu.units.js.map +1 -0
- package/dist/src/filter-bar/filter-sort.js +2 -0
- package/dist/src/filter-bar/filter-sort.js.map +1 -0
- package/dist/src/filter-bar/filter-sort.types.js +2 -0
- package/dist/src/filter-bar/filter-sort.types.js.map +1 -0
- package/dist/src/filter-bar/filter-summary.js +2 -0
- package/dist/src/filter-bar/filter-summary.js.map +1 -0
- package/dist/src/filter-bar/form-field/create-form-field-boolean.js +2 -0
- package/dist/src/filter-bar/form-field/create-form-field-boolean.js.map +1 -0
- package/dist/src/filter-bar/form-field/create-form-field-datetime.js +2 -0
- package/dist/src/filter-bar/form-field/create-form-field-datetime.js.map +1 -0
- package/dist/src/filter-bar/form-field/create-form-field-number.js +2 -0
- package/dist/src/filter-bar/form-field/create-form-field-number.js.map +1 -0
- package/dist/src/filter-bar/form-field/create-form-field-select-with-api.js +2 -0
- package/dist/src/filter-bar/form-field/create-form-field-select-with-api.js.map +1 -0
- package/dist/src/filter-bar/form-field/create-form-field-select.fallback.js +2 -0
- package/dist/src/filter-bar/form-field/create-form-field-select.fallback.js.map +1 -0
- package/dist/src/filter-bar/form-field/create-form-field-select.js +2 -0
- package/dist/src/filter-bar/form-field/create-form-field-select.js.map +1 -0
- package/dist/src/filter-bar/form-field/create-form-field-string.js +2 -0
- package/dist/src/filter-bar/form-field/create-form-field-string.js.map +1 -0
- package/dist/src/filter-bar/helpers.js +1 -1
- package/dist/src/filter-bar/helpers.js.map +1 -1
- package/dist/src/filter-bar/index.create.js +1 -1
- package/dist/src/filter-bar/index.create.js.map +1 -1
- package/dist/src/filter-bar/index.dino.js +1 -1
- package/dist/src/filter-bar/index.dino.js.map +1 -1
- package/dist/src/filter-bar/local-filter-builder.js +1 -1
- package/dist/src/filter-bar/local-filter-builder.js.map +1 -1
- package/dist/src/filter-bar/popper-custom.js +2 -0
- package/dist/src/filter-bar/popper-custom.js.map +1 -0
- package/dist/src/filter-bar/types.js.map +1 -1
- package/dist/src/form/create.checkbox.js +1 -1
- package/dist/src/form/create.checkbox.js.map +1 -1
- package/dist/src/form/helpers.js +1 -1
- package/dist/src/form/helpers.js.map +1 -1
- package/dist/src/form/v2/create.autocomplete.chips.js +1 -1
- package/dist/src/form/v2/create.autocomplete.chips.js.map +1 -1
- package/dist/src/form/v2/create.select-with-api.js +1 -1
- package/dist/src/form/v2/create.select-with-api.js.map +1 -1
- package/dist/types/data-surface/button-switch.d.ts +4 -0
- package/dist/types/data-surface/index.create.d.ts +13 -5
- package/dist/types/data-surface/index.dino.d.ts +6 -7
- package/dist/types/data-surface/ui.units.d.ts +1 -0
- package/dist/types/data-surface/view-grid/index.d.ts +0 -1
- package/dist/types/data-surface/view-list/column-selector.d.ts +6 -0
- package/dist/types/data-surface/view-list/helpers.d.ts +3 -2
- package/dist/types/data-surface/view-list/index.d.ts +1 -1
- package/dist/types/data-surface/view-list/types.d.ts +30 -2
- package/dist/types/filter-bar/components/filter-input.mobile.d.ts +1 -7
- package/dist/types/filter-bar/components/ui.units.d.ts +7 -0
- package/dist/types/filter-bar/convert-to-graphql.d.ts +56 -28
- package/dist/types/filter-bar/{components/filter-input.d.ts → filter-input.d.ts} +5 -1
- package/dist/types/filter-bar/{components/filter-input.types.d.ts → filter-input.types.d.ts} +1 -16
- package/dist/types/filter-bar/{components/filter-input.units.d.ts → filter-input.units.d.ts} +7 -2
- package/dist/types/filter-bar/{menu/create.d.ts → filter-menu.d.ts} +4 -13
- package/dist/types/filter-bar/filter-menu.helpers.d.ts +31 -0
- package/dist/types/filter-bar/filter-menu.styled.d.ts +20 -0
- package/dist/types/filter-bar/filter-menu.types.d.ts +63 -0
- package/dist/types/filter-bar/filter-menu.units.d.ts +20 -0
- package/dist/types/filter-bar/{components/filter-sort.d.ts → filter-sort.d.ts} +21 -2
- package/dist/types/filter-bar/filter-sort.types.d.ts +30 -0
- package/dist/types/filter-bar/filter-summary.types.d.ts +14 -0
- package/dist/types/filter-bar/{menu → form-field}/create-form-field-boolean.d.ts +2 -2
- package/dist/types/filter-bar/{menu → form-field}/create-form-field-datetime.d.ts +2 -2
- package/dist/types/filter-bar/{menu → form-field}/create-form-field-number.d.ts +2 -2
- package/dist/types/filter-bar/{menu → form-field}/create-form-field-select-with-api.d.ts +2 -2
- package/dist/types/filter-bar/{menu → form-field}/create-form-field-select.d.ts +2 -2
- package/dist/types/filter-bar/form-field/create-form-field-select.fallback.d.ts +24 -0
- package/dist/types/filter-bar/{menu → form-field}/create-form-field-string.d.ts +2 -2
- package/dist/types/filter-bar/helpers.d.ts +11 -0
- package/dist/types/filter-bar/index.create.d.ts +10 -28
- package/dist/types/filter-bar/index.d.ts +9 -8
- package/dist/types/filter-bar/index.dino.d.ts +7 -7
- package/dist/types/filter-bar/local-filter-builder.d.ts +12 -3
- package/dist/types/filter-bar/types.d.ts +123 -49
- package/dist/types/form/create.checkbox.d.ts +40 -3
- package/dist/types/form/v2/create.autocomplete.chips.d.ts +14 -1
- package/dist/types/form/v2/create.select-with-api.d.ts +41 -3
- package/package.json +1 -1
- package/dist/src/filter-bar/components/filter-input.js +0 -2
- package/dist/src/filter-bar/components/filter-input.js.map +0 -1
- package/dist/src/filter-bar/components/filter-input.units.js +0 -2
- package/dist/src/filter-bar/components/filter-input.units.js.map +0 -1
- package/dist/src/filter-bar/components/filter-sort.js +0 -2
- package/dist/src/filter-bar/components/filter-sort.js.map +0 -1
- package/dist/src/filter-bar/components/filter-summary.js +0 -2
- package/dist/src/filter-bar/components/filter-summary.js.map +0 -1
- package/dist/src/filter-bar/components/popper-custom.js +0 -2
- package/dist/src/filter-bar/components/popper-custom.js.map +0 -1
- package/dist/src/filter-bar/menu/create-form-field-boolean.js +0 -2
- package/dist/src/filter-bar/menu/create-form-field-boolean.js.map +0 -1
- package/dist/src/filter-bar/menu/create-form-field-datetime.js +0 -2
- package/dist/src/filter-bar/menu/create-form-field-datetime.js.map +0 -1
- package/dist/src/filter-bar/menu/create-form-field-number.js +0 -2
- package/dist/src/filter-bar/menu/create-form-field-number.js.map +0 -1
- package/dist/src/filter-bar/menu/create-form-field-select-with-api.js +0 -2
- package/dist/src/filter-bar/menu/create-form-field-select-with-api.js.map +0 -1
- package/dist/src/filter-bar/menu/create-form-field-select.fallback.js +0 -2
- package/dist/src/filter-bar/menu/create-form-field-select.fallback.js.map +0 -1
- package/dist/src/filter-bar/menu/create-form-field-select.js +0 -2
- package/dist/src/filter-bar/menu/create-form-field-select.js.map +0 -1
- package/dist/src/filter-bar/menu/create-form-field-string.js +0 -2
- package/dist/src/filter-bar/menu/create-form-field-string.js.map +0 -1
- package/dist/src/filter-bar/menu/create.js +0 -2
- package/dist/src/filter-bar/menu/create.js.map +0 -1
- package/dist/src/filter-bar/menu/ui.units.js +0 -2
- package/dist/src/filter-bar/menu/ui.units.js.map +0 -1
- package/dist/types/filter-bar/components/filter-sort.types.d.ts +0 -49
- package/dist/types/filter-bar/components/filter-summary.types.d.ts +0 -21
- package/dist/types/filter-bar/menu/create-form-field-select.fallback.d.ts +0 -11
- package/dist/types/filter-bar/menu/types.d.ts +0 -70
- package/dist/types/filter-bar/menu/ui.units.d.ts +0 -6
- /package/dist/types/filter-bar/{components/filter-summary.d.ts → filter-summary.d.ts} +0 -0
- /package/dist/types/filter-bar/{components/popper-custom.d.ts → popper-custom.d.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TableCellProps } from '@mui/material';
|
|
2
|
-
import { ListDensity, TListColumn, TListColumns } from './types';
|
|
2
|
+
import { ListDensity, TColumnVisibility, TListColumn, TListColumns } from './types';
|
|
3
3
|
export declare const LIST_HEADER_HEIGHT = 48;
|
|
4
4
|
export declare const LIST_DEFAULT_ROW_SPACING = 4;
|
|
5
5
|
export declare const CHECKBOX_COL_WIDTH = 48;
|
|
@@ -7,8 +7,9 @@ export declare const LIST_ROW_HEIGHT_BY_DENSITY: Record<ListDensity, number>;
|
|
|
7
7
|
export declare const LIST_CELL_PADDING_BY_DENSITY: Record<ListDensity, string>;
|
|
8
8
|
/**
|
|
9
9
|
* Converts TListColumns<T> Record type to TListColumn<T>[] array for internal use.
|
|
10
|
+
* Applies columnVisibilityModel if provided for managed columns.
|
|
10
11
|
*/
|
|
11
|
-
export declare const columnsRecordToArray: <T>(value: T[], columnsRecord?: Partial<Record<keyof T, Omit<TListColumn<T>, "field">>> | undefined) => TListColumn<T>[];
|
|
12
|
+
export declare const columnsRecordToArray: <T>(value: T[], columnsRecord?: Partial<Record<keyof T, Omit<TListColumn<T>, "field">>> | undefined, visibilityModel?: Partial<Record<keyof T, boolean>> | undefined) => TListColumn<T>[];
|
|
12
13
|
export declare function resolveListRowHeight(density?: number | ListDensity): number;
|
|
13
14
|
export declare function resolveListCellPadding(density?: number | ListDensity): string;
|
|
14
15
|
export declare function resolveListRowSpacing(spacing?: number): number;
|
|
@@ -2,6 +2,7 @@ import type { ComponentType, FC } from 'react';
|
|
|
2
2
|
import type { LoadingModeRule, TPagination } from '../types';
|
|
3
3
|
import type { IViewListConfig, IViewListProps } from './types';
|
|
4
4
|
export * from './types';
|
|
5
|
+
export * from './column-selector';
|
|
5
6
|
export declare function createViewList<T>(config: IViewListConfig<T>): FC<IViewListProps<T>>;
|
|
6
7
|
export interface IViewListLoadingProps<T> extends IViewListProps<T> {
|
|
7
8
|
loadMode: LoadingModeRule;
|
|
@@ -10,4 +11,3 @@ export interface IViewListLoadingProps<T> extends IViewListProps<T> {
|
|
|
10
11
|
onPageChange?: (page: number, pageSize: number) => void | Promise<void>;
|
|
11
12
|
}
|
|
12
13
|
export declare function createViewListLoading<T>(ListComponent: ComponentType<IViewListProps<T>>): FC<IViewListLoadingProps<T>>;
|
|
13
|
-
export default createViewList;
|
|
@@ -38,8 +38,6 @@ export interface TListColumn<T> {
|
|
|
38
38
|
field: keyof T;
|
|
39
39
|
/** Column header label shown in the header. */
|
|
40
40
|
label?: string;
|
|
41
|
-
/** If true, the column is visible in the list @default true */
|
|
42
|
-
visible?: boolean;
|
|
43
41
|
/** Explicit column width. Accepts px number or CSS string (e.g. '120px', '20%'). */
|
|
44
42
|
width?: number | string;
|
|
45
43
|
/** Minimum column width in pixels. */
|
|
@@ -56,6 +54,10 @@ export interface TListColumn<T> {
|
|
|
56
54
|
valueGetter?: (value: string, row: T, index: number) => any;
|
|
57
55
|
/** Allow sorting on this column */
|
|
58
56
|
sortable?: boolean;
|
|
57
|
+
/** If true, the column is visible in the list @default true */
|
|
58
|
+
visible?: boolean;
|
|
59
|
+
/** Allow toggling visibility of this column via ColumnSelector */
|
|
60
|
+
colVisibleable?: boolean;
|
|
59
61
|
}
|
|
60
62
|
/** Columns configuration for List view. */
|
|
61
63
|
export type TListColumns<T> = Partial<Record<keyof T, Omit<TListColumn<T>, 'field'>>>;
|
|
@@ -104,6 +106,32 @@ export interface IViewListBase<T> {
|
|
|
104
106
|
sort?: TFieldSort<T>;
|
|
105
107
|
/** Callback triggered when sorting changes */
|
|
106
108
|
onSortChange?: (sort?: TFieldSort<T>) => void;
|
|
109
|
+
/** Map specifying which managed columns are visible (true) or hidden (false) */
|
|
110
|
+
columnVisibility?: TColumnVisibility<T>;
|
|
111
|
+
}
|
|
112
|
+
/** Visibility model for columns where key is field name and value is boolean. */
|
|
113
|
+
export type TColumnVisibility<T> = Partial<Record<keyof T, boolean>>;
|
|
114
|
+
/** Factory configuration for ColumnSelector */
|
|
115
|
+
export interface IColumnSelectorConfig<T> {
|
|
116
|
+
/** Unique table key for namespacing localStorage data (required) */
|
|
117
|
+
persistenceKey: string;
|
|
118
|
+
/** Global storage key in localStorage @default 'dino-view-list-column-visibility' */
|
|
119
|
+
storageKey?: string;
|
|
120
|
+
/** Target listConfig (e.g. DataSurfaceIns.listConfig) */
|
|
121
|
+
config?: IViewListConfig<T>;
|
|
122
|
+
/** Whether the column selector should be hidden */
|
|
123
|
+
hide?: boolean;
|
|
124
|
+
}
|
|
125
|
+
/** Props for ColumnSelector component */
|
|
126
|
+
export interface IColumnSelectorProps<T> {
|
|
127
|
+
/** Controlled column visibility model */
|
|
128
|
+
visibility?: TColumnVisibility<T>;
|
|
129
|
+
/** Callback when column visibility model changes */
|
|
130
|
+
onChange?: (model: TColumnVisibility<T>) => void;
|
|
131
|
+
/** Size of IconButton @default 'small' */
|
|
132
|
+
size?: 'small' | 'medium';
|
|
133
|
+
/** Whether the column selector should be hidden */
|
|
134
|
+
hide?: boolean;
|
|
107
135
|
}
|
|
108
136
|
/** Configuration for List view. */
|
|
109
137
|
export interface IViewListConfig<T> extends IViewListBase<T> {
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export interface IMobileSearchButtonProps {
|
|
3
|
-
placeholder?: string;
|
|
4
|
-
onSearching?: (keyword: string) => void;
|
|
5
|
-
}
|
|
6
|
-
export declare const MobileSearchButton: FC<IMobileSearchButtonProps>;
|
|
7
|
-
export default MobileSearchButton;
|
|
1
|
+
export {};
|
|
@@ -13,6 +13,13 @@ export declare const ButtonBack: import("@emotion/styled").StyledComponent<impor
|
|
|
13
13
|
export declare const ChipDark: import("@emotion/styled").StyledComponent<import("@mui/material").ChipOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
14
14
|
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
15
15
|
}, "classes" | "className" | "style" | "children" | "sx" | "variant" | "label" | "tabIndex" | "color" | "icon" | "disabled" | "size" | "clickable" | "avatar" | "deleteIcon" | "onDelete" | "skipFocusWhenDisabled"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
16
|
+
export declare const GroupSubheaderStyled: import("@emotion/styled").StyledComponent<import("@mui/material").ListSubheaderOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & {
|
|
17
|
+
ref?: ((instance: HTMLLIElement | null) => void) | import("react").RefObject<HTMLLIElement> | null | undefined;
|
|
18
|
+
}, "classes" | "className" | "style" | "children" | "sx" | "color" | "inset" | "disableGutters" | "disableSticky"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
19
|
+
interface IErrorPannelProps {
|
|
20
|
+
onRetry?: () => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const ErrorPannel: FC<IErrorPannelProps>;
|
|
16
23
|
export interface FilterLogicToggleProps {
|
|
17
24
|
value?: TLogic;
|
|
18
25
|
onChange?: (event: React.MouseEvent<HTMLElement>, value: TLogic) => void;
|
|
@@ -2,12 +2,8 @@ import { RequestParam } from '../http-service/graphql/request-param';
|
|
|
2
2
|
import type { TFilterState, TFieldStore, TLogic, TDirection, TFieldType, TFieldValid } from './types';
|
|
3
3
|
type TFilterScopeFn<TSource, TTarget extends object, U extends object = {}> = (currentBuilder: RequestParam<TTarget, U>, store?: TFieldStore<TSource>) => void;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* - Supports mapping filter fields to different GraphQL fields, custom filter logic, and sorting.
|
|
8
|
-
* @vi
|
|
9
|
-
* - Lớp tiện ích để chuyển đổi trạng thái filter từ filter bar thành builder truy vấn GraphQL.
|
|
10
|
-
* - Hỗ trợ ánh xạ các trường filter sang các trường GraphQL khác, logic filter tùy chỉnh và sắp xếp.
|
|
5
|
+
* Utility class to convert filter state from a filter bar into a GraphQL query builder.
|
|
6
|
+
* Supports mapping filter fields to different GraphQL fields, custom filter logic, and sorting.
|
|
11
7
|
*/
|
|
12
8
|
type TAutoMapFieldCustomFn<TSource, TTarget extends object, U extends object = {}> = (currentBuilder: RequestParam<TTarget, U>, value?: NonNullable<TFieldStore<TSource>>[keyof TFieldStore<TSource>], store?: TFieldStore<TSource>) => void;
|
|
13
9
|
type TAutoMapFieldCustomSingleFn<TSource, TTarget extends object, U extends object = {}> = (currentBuilder: RequestParam<TTarget, U>, value: TFieldValid, options?: {
|
|
@@ -15,43 +11,30 @@ type TAutoMapFieldCustomSingleFn<TSource, TTarget extends object, U extends obje
|
|
|
15
11
|
}, store?: TFieldStore<TSource>) => void;
|
|
16
12
|
type TAutoMapConfig<TSource, TTarget extends object, U extends object = {}> = {
|
|
17
13
|
/**
|
|
18
|
-
*
|
|
19
|
-
* @vi Trường đích trong schema GraphQL mà trường filter này ánh xạ tới. Nếu không cung cấp, tên trường nguồn sẽ được sử dụng làm trường đích.
|
|
14
|
+
* The target field in the GraphQL schema that this filter field maps to. If not provided, the source field name will be used as the target field.
|
|
20
15
|
*/
|
|
21
16
|
targetfield?: keyof TTarget;
|
|
22
17
|
/**
|
|
23
|
-
*
|
|
24
|
-
* @vi Thao tác áp dụng cho trường filter. @default 'contains'
|
|
18
|
+
* The operation to apply for the filter field. @default 'contains'
|
|
25
19
|
*/
|
|
26
20
|
operation?: 'equal' | 'equalAndAny' | 'contains' | 'datetime' | 'number' | 'boolean' | 'enum';
|
|
27
21
|
/**
|
|
28
|
-
*
|
|
29
|
-
* @vi Giá trị của enum schema nếu thao tác là 'enum'.
|
|
22
|
+
* Value of the enum schema if the operation is 'enum'.
|
|
30
23
|
*/
|
|
31
24
|
enumValue?: string;
|
|
32
25
|
/**
|
|
33
|
-
*
|
|
34
|
-
* @vi Định dạng giá trị bộ lọc trước khi gửi vào query builder. Nếu giá trị trả về trống, bộ lọc sẽ bị bỏ qua.
|
|
26
|
+
* Format the filter value before passing it to query builder. If the returned value is empty, the filter is ignored.
|
|
35
27
|
*/
|
|
36
28
|
valueFormater?: (value: TFieldValid) => TFieldValid | undefined | null;
|
|
37
29
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* - Receives the current GraphQL builder, the value of the filter field, and the entire filter store for context.
|
|
41
|
-
* @vi
|
|
42
|
-
* - Hàm tùy chỉnh để áp dụng logic filter phức tạp không phù hợp với các thao tác 'equal' hoặc 'contains' tiêu chuẩn.
|
|
43
|
-
* - Nhận builder GraphQL hiện tại, giá trị của trường filter và toàn bộ store filter để có ngữ cảnh.
|
|
30
|
+
* Custom function to apply complex filter logic that doesn't fit standard 'equal' or 'contains' operations.
|
|
31
|
+
* Receives the current GraphQL builder, the value of the filter field, and the entire filter store for context.
|
|
44
32
|
*/
|
|
45
33
|
custom?: TAutoMapFieldCustomFn<TSource, TTarget, U>;
|
|
46
34
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* - Note: 'custom' takes precedence over 'customField'.
|
|
51
|
-
* @vi
|
|
52
|
-
* - Hàm tùy chỉnh để áp dụng logic filter cho từng giá trị đơn lẻ của trường filter.
|
|
53
|
-
* - Nhận builder GraphQL hiện tại, một giá trị đơn lẻ và toàn bộ store filter để có ngữ cảnh.
|
|
54
|
-
* - Lưu ý: 'custom' sẽ ghi đè 'customField'.
|
|
35
|
+
* Custom function to apply filter logic for each individual value of the filter field.
|
|
36
|
+
* Receives the current GraphQL builder, a single value, and the entire filter store for context.
|
|
37
|
+
* Note: 'custom' takes precedence over 'customField'.
|
|
55
38
|
*/
|
|
56
39
|
customField?: TAutoMapFieldCustomSingleFn<TSource, TTarget, U>;
|
|
57
40
|
};
|
|
@@ -63,32 +46,77 @@ type TFilterOption = {
|
|
|
63
46
|
export declare const mapLogic: (logic?: TLogic) => 'And' | 'Or';
|
|
64
47
|
/** Map sort direction for GraphQL queries @default 'asc' */
|
|
65
48
|
export declare const mapSortDirection: (direction?: TDirection) => 'ASC' | 'DESC';
|
|
49
|
+
/**
|
|
50
|
+
* Converter class that transforms `TFilterState` into a GraphQL `RequestParam` payload.
|
|
51
|
+
*/
|
|
66
52
|
export declare class TableFileterConverter<TSource extends Record<string, any>, TTarget extends object, U extends object = {}> {
|
|
67
53
|
private state;
|
|
68
54
|
private graphqlBuilder;
|
|
69
55
|
constructor(state: TFilterState<TSource>);
|
|
56
|
+
/**
|
|
57
|
+
* Wraps filter builder execution inside a logical scope (AND / OR).
|
|
58
|
+
*/
|
|
70
59
|
filterScope(fn: TFilterScopeFn<TSource, TTarget, U>, options?: TFilterOption): this;
|
|
60
|
+
/**
|
|
61
|
+
* Helper method to retrieve, format, and validate filter values for a specific field.
|
|
62
|
+
*/
|
|
71
63
|
private getFormattedValues;
|
|
64
|
+
/**
|
|
65
|
+
* Applies exact equality (`equal`) or `isAny` array comparison filter for a field.
|
|
66
|
+
*/
|
|
72
67
|
filterEqual(field: TFieldType<TSource>, targetField?: keyof TTarget, options?: TFilterOption & {
|
|
73
68
|
isAny?: boolean;
|
|
74
69
|
}): this;
|
|
70
|
+
/**
|
|
71
|
+
* Applies string containment (`contains`) filter for a field.
|
|
72
|
+
*/
|
|
75
73
|
filterContains(field: TFieldType<TSource>, targetField?: keyof TTarget, options?: TFilterOption): this;
|
|
74
|
+
/**
|
|
75
|
+
* Applies date/time comparisons (`before`, `after`, or `range` bounds) for a field.
|
|
76
|
+
*/
|
|
76
77
|
filterDatetime(field: TFieldType<TSource>, targetField?: keyof TTarget, options?: TFilterOption): this;
|
|
78
|
+
/**
|
|
79
|
+
* Applies boolean filter evaluation (`==true` or `==false`) for a field.
|
|
80
|
+
*/
|
|
77
81
|
filterBoolean(field: TFieldType<TSource>, targetField?: keyof TTarget, options?: TFilterOption): this;
|
|
82
|
+
/**
|
|
83
|
+
* Decodes encoded numeric operators (`=`, `<`, `≤`, `>`, `≥`) and applies number filters for a field.
|
|
84
|
+
*/
|
|
78
85
|
filterNumber(field: TFieldType<TSource>, targetField?: keyof TTarget, options?: TFilterOption): this;
|
|
86
|
+
/**
|
|
87
|
+
* Applies enum comparison filter (`enumValue.VALUE`) for a field.
|
|
88
|
+
*/
|
|
79
89
|
filterEnum(field: TFieldType<TSource>, targetField?: keyof TTarget, enumValue?: string, options?: TFilterOption): this;
|
|
90
|
+
/**
|
|
91
|
+
* Configures sorting and random seed ordering state into the GraphQL query builder.
|
|
92
|
+
*/
|
|
80
93
|
sort(param?: {
|
|
81
94
|
seed: {
|
|
82
95
|
targetField?: TFieldType<TSource>;
|
|
83
96
|
autoSave?: boolean;
|
|
84
97
|
};
|
|
85
98
|
}, options?: TFilterOption): this;
|
|
99
|
+
/**
|
|
100
|
+
* Applies multi-field quick search matching across target fields.
|
|
101
|
+
*/
|
|
86
102
|
quickSearch(fields: TFieldType<TSource> | TFieldType<TSource>[], options?: TFilterOption): this;
|
|
87
103
|
private currentObjectMap?;
|
|
104
|
+
/**
|
|
105
|
+
* Maps active fields in `TFilterState` to GraphQL builder rules according to a field mapping schema.
|
|
106
|
+
*/
|
|
88
107
|
autoMap: (objMap: TAutoMapConfigs<TSource, TTarget, U>, options?: TFilterOption) => this;
|
|
89
108
|
private prebuildFunc?;
|
|
109
|
+
/**
|
|
110
|
+
* Registers a callback executed prior to final AST construction.
|
|
111
|
+
*/
|
|
90
112
|
prebuild: (func: (requestParam: RequestParam<TTarget, U>) => RequestParam<TTarget, U>) => this;
|
|
113
|
+
/**
|
|
114
|
+
* Assembles and returns the final GraphQL query parameter payload.
|
|
115
|
+
*/
|
|
91
116
|
build(): import("../http-service/graphql/request-param").IRequestParamResult<TTarget, U>;
|
|
92
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Factory function to create a `TableFileterConverter` instance for converting filter state to GraphQL queries.
|
|
120
|
+
*/
|
|
93
121
|
export declare const createConvertToGraphQL: <TSource extends Record<string, any>, TTarget extends object, U extends object = {}>(state: TFilterState<TSource>) => TableFileterConverter<TSource, TTarget, U>;
|
|
94
122
|
export {};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
|
+
import type { TFilterFieldConfigs } from './types';
|
|
2
3
|
import type { IFilterInputConfig, IFilterInputProps } from './filter-input.types';
|
|
3
|
-
export
|
|
4
|
+
export interface IFilterInputParam<T> extends IFilterInputConfig<T> {
|
|
5
|
+
fields?: TFilterFieldConfigs<T>;
|
|
6
|
+
}
|
|
7
|
+
export declare function createFilterInput<T>(config: IFilterInputParam<T>): FC<IFilterInputProps<T>>;
|
|
4
8
|
export declare const filterInputClasses: {
|
|
5
9
|
root: string;
|
|
6
10
|
rootInner: string;
|
package/dist/types/filter-bar/{components/filter-input.types.d.ts → filter-input.types.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { BoxProps, PopperProps } from '@mui/material';
|
|
3
|
-
import type { TFieldType } from '
|
|
3
|
+
import type { TFieldType } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* RuleMatch defines the matching rules for displaying fields
|
|
6
6
|
* - 'always': This field will always be displayed regardless of keywords
|
|
@@ -21,19 +21,6 @@ export type TFieldMatch = {
|
|
|
21
21
|
/** Only applies when the rule is 'custom' */
|
|
22
22
|
validate?: (value: any) => boolean;
|
|
23
23
|
};
|
|
24
|
-
export type TFieldMatchConfig<T> = {
|
|
25
|
-
field: TFieldType<T>;
|
|
26
|
-
rules?: TFieldMatch | TFieldMatch[];
|
|
27
|
-
};
|
|
28
|
-
export type TFieldMatchConfigs<T> = Partial<Record<TFieldType<T>, Omit<TFieldMatchConfig<T>, 'field'>>>;
|
|
29
|
-
export interface IFieldInputConfig<T> {
|
|
30
|
-
field: TFieldType<T>;
|
|
31
|
-
label?: string;
|
|
32
|
-
/** If true, the field is visible in the input menu @default true */
|
|
33
|
-
visible?: boolean;
|
|
34
|
-
singleValue?: boolean;
|
|
35
|
-
}
|
|
36
|
-
export type TFieldInputConfigs<T> = Partial<Record<TFieldType<T>, Omit<IFieldInputConfig<T>, 'field'>>>;
|
|
37
24
|
export interface IFilterInputLayoutSlots {
|
|
38
25
|
beforeInput?: ReactNode;
|
|
39
26
|
afterInput?: ReactNode;
|
|
@@ -44,8 +31,6 @@ export interface IFilterInputBase {
|
|
|
44
31
|
fullWidth?: boolean;
|
|
45
32
|
}
|
|
46
33
|
export interface IFilterInputConfig<T> extends IFilterInputBase, IFilterInputLayoutSlots {
|
|
47
|
-
fields: TFieldInputConfigs<T>;
|
|
48
|
-
matches?: TFieldMatchConfigs<T>;
|
|
49
34
|
/** Enable or disable quick search, @default false */
|
|
50
35
|
enableQuickSearch?: boolean;
|
|
51
36
|
/** Placeholder text for input field */
|
package/dist/types/filter-bar/{components/filter-input.units.d.ts → filter-input.units.d.ts}
RENAMED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
2
|
import type { IconButtonProps } from '@mui/material';
|
|
3
|
-
import type {
|
|
4
|
-
export
|
|
3
|
+
import type { TFieldType, TFilterFieldConfig, TFilterFieldConfigs } from './types';
|
|
4
|
+
export type TInputMatchedField<T> = TFilterFieldConfig<T> & {
|
|
5
|
+
field: TFieldType<T>;
|
|
6
|
+
};
|
|
7
|
+
export declare function getFieldsByMatches<T>(config: {
|
|
8
|
+
fields?: TFilterFieldConfigs<T>;
|
|
9
|
+
}, keywords: string): TInputMatchedField<T>[];
|
|
5
10
|
interface InputAdornmentLeftProps {
|
|
6
11
|
onSearch?: IconButtonProps['onClick'];
|
|
7
12
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
export { filterMenuClasses } from './filter-menu.styled';
|
|
1
2
|
import type { FC } from 'react';
|
|
2
|
-
import type { IFilterMenuProps } from './types';
|
|
3
|
-
import type { IFilterMenuConfig } from './types';
|
|
3
|
+
import type { IFilterMenuParam, IFilterMenuProps } from './filter-menu.types';
|
|
4
4
|
/**
|
|
5
5
|
* Factory function that creates a `FilterMenu` component from a static field configuration.
|
|
6
6
|
*
|
|
@@ -14,16 +14,7 @@ import type { IFilterMenuConfig } from './types';
|
|
|
14
14
|
* All state (open/close, selected field) is local; filter values are read/written through
|
|
15
15
|
* `FilterBarContext` via `useFilterActions`.
|
|
16
16
|
*
|
|
17
|
-
* @param
|
|
17
|
+
* @param param - Static filter-menu configuration (fields, validation, slots, etc.)
|
|
18
18
|
* @returns A React FC ready to be dropped anywhere inside a `FilterBarProvider`
|
|
19
19
|
*/
|
|
20
|
-
export declare function createFilterMenu<T>(
|
|
21
|
-
/** CSS class names used by the `FilterMenu` component for external style overrides. */
|
|
22
|
-
export declare const filterMenuClasses: {
|
|
23
|
-
root: string;
|
|
24
|
-
input: string;
|
|
25
|
-
beforeInput: string;
|
|
26
|
-
menu: string;
|
|
27
|
-
menuItem: string;
|
|
28
|
-
menuItemInner: string;
|
|
29
|
-
};
|
|
20
|
+
export declare function createFilterMenu<T>(param: IFilterMenuParam<T>): FC<IFilterMenuProps<T>>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormValidator } from '../form/validator';
|
|
3
|
+
import type { TFieldModelValid, TFieldType } from './types';
|
|
4
|
+
import type { IFilterMenuParam, IFilterMenuFormProps } from './filter-menu.types';
|
|
5
|
+
/**
|
|
6
|
+
* Builds a map of `FormValidator` instances keyed by field name.
|
|
7
|
+
* Each validator is constructed from the validation rules defined in `config.validation`.
|
|
8
|
+
* Fields with no validation config are skipped.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare function generateValidatorMap<T>(param: IFilterMenuParam<T>): Record<TFieldType<T>, FormValidator<Partial<TFieldModelValid<T>>>>;
|
|
13
|
+
/**
|
|
14
|
+
* Builds a map of form input components keyed by field name.
|
|
15
|
+
* If a field defines a custom `MenuForm`, that is used; otherwise falls back to
|
|
16
|
+
* default `createFormFieldString()` free-text component.
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare function generateFormInputMap<T>(param: IFilterMenuParam<T>): Record<TFieldType<T>, import("react").ComponentType<IFilterMenuFormProps<T>>>;
|
|
21
|
+
export declare const getQuickSearchTooltip: (currentHint?: string | ((currentHint: string) => string) | undefined) => string;
|
|
22
|
+
/**
|
|
23
|
+
* Normalises raw `IFilterMenuParam`:
|
|
24
|
+
* - Injects the quick-search pseudo-field when `enableQuickSearch` is `true`
|
|
25
|
+
* - Merges validation rules
|
|
26
|
+
*
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export declare function generateConfigs<T>(param: IFilterMenuParam<T>): IFilterMenuParam<T>;
|
|
30
|
+
export { groupFields } from './helpers';
|
|
31
|
+
export type { IFieldGroup } from './helpers';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export { GroupSubheaderStyled } from './components/ui.units';
|
|
3
|
+
/** CSS class names used by the `FilterMenu` component for external style overrides. */
|
|
4
|
+
export declare const filterMenuClasses: {
|
|
5
|
+
root: string;
|
|
6
|
+
input: string;
|
|
7
|
+
beforeInput: string;
|
|
8
|
+
menu: string;
|
|
9
|
+
menuItem: string;
|
|
10
|
+
menuItemInner: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const FilterInputStyled: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
13
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
14
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
15
|
+
export declare const MenuListCustom: import("@emotion/styled").StyledComponent<import("@mui/material").MenuListOwnProps & import("@mui/material").ListOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref"> & {
|
|
16
|
+
ref?: ((instance: HTMLUListElement | null) => void) | import("react").RefObject<HTMLUListElement> | null | undefined;
|
|
17
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | "autoFocus" | "dense" | "disablePadding" | "subheader" | "autoFocusItem" | "disabledItemsFocusable" | "disableListWrap"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
18
|
+
export declare const SubMenuPaper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
19
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
20
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { BoxProps, PopperProps } from '@mui/material';
|
|
3
|
+
import type { FormValidator, IFormValidatorConfig } from '../form/validator';
|
|
4
|
+
import type { TFieldModelValid, TFieldType, TFieldValid, TFieldValue, TFilterFieldConfig, TFilterFieldConfigs } from './types';
|
|
5
|
+
export type TFetchStatus = 'loading' | 'loaded' | 'error';
|
|
6
|
+
/** Selectable option item for subMenu mode or select form dropdowns */
|
|
7
|
+
export interface IFilterMenuOption {
|
|
8
|
+
value: TFieldValid;
|
|
9
|
+
label?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Field-level configuration for Filter Menu item and subMenu behavior */
|
|
12
|
+
export interface IFilterMenuConfig<T> {
|
|
13
|
+
/** Subtitle description for the field */
|
|
14
|
+
description?: string;
|
|
15
|
+
/** Element to render before the form component or menu item */
|
|
16
|
+
before?: ReactNode;
|
|
17
|
+
/** Element to render after the form component or menu item */
|
|
18
|
+
after?: ReactNode;
|
|
19
|
+
/** Hover tooltip displayed on the menu item */
|
|
20
|
+
tooltip?: string | ((values?: TFieldValid[]) => string);
|
|
21
|
+
/** Mode for rendering default menu form: 'view' (custom form view) or 'subMenu' (selectable list). @default 'view' */
|
|
22
|
+
mode?: 'view' | 'subMenu';
|
|
23
|
+
/** List of selectable options when mode is 'subMenu' */
|
|
24
|
+
options?: IFilterMenuOption[];
|
|
25
|
+
/** If true, closes the filter menu popover after submitting a value @default true */
|
|
26
|
+
closeAfterSubmit?: boolean;
|
|
27
|
+
/** If true, closes the filter menu popover after clearing field values @default true */
|
|
28
|
+
closeAfterClear?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface IFilterMenuSlots {
|
|
31
|
+
popperProps?: Partial<PopperProps>;
|
|
32
|
+
rootProps?: BoxProps;
|
|
33
|
+
}
|
|
34
|
+
/** Parameter passed to `createFilterMenu(param)` */
|
|
35
|
+
export interface IFilterMenuParam<T> extends IFilterMenuSlots {
|
|
36
|
+
fields?: TFilterFieldConfigs<T>;
|
|
37
|
+
validation?: IFormValidatorConfig<Partial<TFieldModelValid<T>>>;
|
|
38
|
+
quickSearchHint?: string | ((currentHint: string) => string);
|
|
39
|
+
/** Option to enable or disable quick search @default false */
|
|
40
|
+
enableQuickSearch?: boolean;
|
|
41
|
+
/** Option to close the menu after submitting a value @default true */
|
|
42
|
+
closeAfterSubmit?: boolean;
|
|
43
|
+
/** Option to close the menu after clearing a value @default true */
|
|
44
|
+
closeAfterClear?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface IFilterMenuProps<T> {
|
|
47
|
+
slots?: IFilterMenuSlots;
|
|
48
|
+
}
|
|
49
|
+
/** Props passed to custom form components rendered inside filter menu */
|
|
50
|
+
export interface IFilterMenuFormProps<T> {
|
|
51
|
+
/** Field key being configured */
|
|
52
|
+
field: TFieldType<T>;
|
|
53
|
+
/** Unified field configuration */
|
|
54
|
+
currentConfig: TFilterFieldConfig<T>;
|
|
55
|
+
isLoading?: boolean;
|
|
56
|
+
value?: TFieldValue;
|
|
57
|
+
validator?: FormValidator<Partial<TFieldModelValid<T>>>;
|
|
58
|
+
onBack: () => void;
|
|
59
|
+
onClose: () => void;
|
|
60
|
+
onSubmit: (key: TFieldType<T>, value?: TFieldValue, config?: TFilterFieldConfig<T>) => void;
|
|
61
|
+
onRemove?: (key: TFieldType<T>, value: TFieldValid) => void;
|
|
62
|
+
onRemoveField?: (key: TFieldType<T>, config?: TFilterFieldConfig<T>) => void;
|
|
63
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import type { TFieldType, TFieldValue, TFieldValid, TFilterFieldConfig } from './types';
|
|
3
|
+
export interface IFilterMenuItemProps<T> {
|
|
4
|
+
field: TFieldType<T>;
|
|
5
|
+
item: TFilterFieldConfig<T>;
|
|
6
|
+
info?: TFieldValue;
|
|
7
|
+
fieldValue?: any;
|
|
8
|
+
quickSearchHint?: string | ((currentHint: string) => string);
|
|
9
|
+
onClick: (event: React.MouseEvent<HTMLElement>, field: TFieldType<T>, item: TFilterFieldConfig<T>) => void;
|
|
10
|
+
onRemoveField?: (field: TFieldType<T>, config?: TFilterFieldConfig<T>) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function createFilterMenuItem<T>(): FC<IFilterMenuItemProps<T>>;
|
|
13
|
+
export interface IFilterSubMenuProps<T> {
|
|
14
|
+
anchorEl: HTMLElement | null;
|
|
15
|
+
field: TFieldType<T> | null;
|
|
16
|
+
item: TFilterFieldConfig<T> | null;
|
|
17
|
+
activeValues?: TFieldValid[];
|
|
18
|
+
onOptionClick: (field: TFieldType<T>, optionValue: TFieldValid, fieldConfig: TFilterFieldConfig<T>) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare function createFilterSubMenu<T>(): FC<IFilterSubMenuProps<T>>;
|
|
@@ -1,15 +1,34 @@
|
|
|
1
1
|
import { FieldSortDirection } from './filter-sort.types';
|
|
2
2
|
import type { FC, ReactNode } from 'react';
|
|
3
|
-
import type {
|
|
3
|
+
import type { IFilterSortParam, IFilterSortProps } from './filter-sort.types';
|
|
4
|
+
/** Map sort direction to human-readable tooltip label ('Ascending' | 'Descending') */
|
|
4
5
|
export declare const mapSortDirectionLabel: {
|
|
5
6
|
[key in FieldSortDirection]: string;
|
|
6
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* Returns human-readable sort direction label ('Ascending' | 'Descending') for a given sort direction.
|
|
10
|
+
*/
|
|
7
11
|
export declare const getSortDirectionLabel: (direction?: FieldSortDirection) => string;
|
|
12
|
+
/** Map sort direction to React icon component */
|
|
8
13
|
export declare const mapSortDirectionIcon: {
|
|
9
14
|
[key in FieldSortDirection]: ReactNode;
|
|
10
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Returns React icon corresponding to sort direction (`ArrowUpwardIcon` for 'asc', `ArrowDownwardIcon` for 'desc').
|
|
18
|
+
*/
|
|
11
19
|
export declare const getSortDirectionIcon: (direction?: FieldSortDirection) => ReactNode;
|
|
12
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Factory function that creates a `FilterSort` component from static field configuration.
|
|
22
|
+
*
|
|
23
|
+
* The generated component renders a sort icon button opening a popper panel with:
|
|
24
|
+
* - A list of sortable fields configured with `sortable: true`
|
|
25
|
+
* - Sorting direction toggles ('asc' | 'desc')
|
|
26
|
+
* - Optional shuffle/randomize ordering action (`enableShuffle: true`)
|
|
27
|
+
*
|
|
28
|
+
* @param config - Static sort configuration (fields schema, slots, shuffle toggle)
|
|
29
|
+
* @returns A React FC ready to be dropped into a `FilterBarProvider` context
|
|
30
|
+
*/
|
|
31
|
+
export declare function createFilterSort<T>(config: IFilterSortParam<T>): FC<IFilterSortProps<T>>;
|
|
13
32
|
export declare const filterSortClasses: {
|
|
14
33
|
root: string;
|
|
15
34
|
menu: string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { BoxProps, IconButtonProps, PopperProps } from '@mui/material';
|
|
2
|
+
import type { TFilterFieldConfigs } from './types';
|
|
3
|
+
/** Supported sort directions for column sorting ('asc' | 'desc') */
|
|
4
|
+
export declare const FieldSortDirection: {
|
|
5
|
+
readonly asc: "asc";
|
|
6
|
+
readonly desc: "desc";
|
|
7
|
+
};
|
|
8
|
+
export type FieldSortDirection = keyof typeof FieldSortDirection;
|
|
9
|
+
/** Slot overrides for sub-components of `FilterSort` */
|
|
10
|
+
export interface IFilterSortSlots {
|
|
11
|
+
popperProps?: Partial<PopperProps>;
|
|
12
|
+
rootProps?: BoxProps;
|
|
13
|
+
buttonSortProps?: IconButtonProps;
|
|
14
|
+
buttonShuffleProps?: IconButtonProps;
|
|
15
|
+
}
|
|
16
|
+
/** Props passed to the generated `FilterSort` component */
|
|
17
|
+
export interface IFilterSortProps<T> {
|
|
18
|
+
sx?: BoxProps['sx'];
|
|
19
|
+
slots?: IFilterSortSlots;
|
|
20
|
+
}
|
|
21
|
+
/** Static configuration passed to `createFilterSort(config)` factory function */
|
|
22
|
+
export interface IFilterSortConfig<T> extends IFilterSortSlots {
|
|
23
|
+
/** Optional flag to enable shuffle functionality */
|
|
24
|
+
enableShuffle?: boolean;
|
|
25
|
+
/** Position for shuffle button ('left' | 'right') @default 'right' */
|
|
26
|
+
shufflePosition?: 'left' | 'right';
|
|
27
|
+
}
|
|
28
|
+
export interface IFilterSortParam<T> extends IFilterSortConfig<T> {
|
|
29
|
+
fields?: TFilterFieldConfigs<T>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BoxProps } from '@mui/material';
|
|
2
|
+
import type { TFilterFieldConfigs } from './types';
|
|
3
|
+
/** Configuration parameters passed to `createFilterSummary(config)` factory function */
|
|
4
|
+
export interface IFilterSummaryConfig<T> {
|
|
5
|
+
/** Field configuration schema map */
|
|
6
|
+
fields?: TFilterFieldConfigs<T>;
|
|
7
|
+
/** Option to enable or disable quick search chip in summary @default true */
|
|
8
|
+
enableQuickSearch?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** Props passed to the generated `FilterSummary` component */
|
|
11
|
+
export interface IFilterSummaryProps<T> {
|
|
12
|
+
/** Custom MUI styling object for the root container */
|
|
13
|
+
sx?: BoxProps['sx'];
|
|
14
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FC, ReactNode } from 'react';
|
|
2
2
|
import type { TValueFormatterParam } from '../types';
|
|
3
|
-
import type {
|
|
3
|
+
import type { IFilterMenuConfig, IFilterMenuFormProps } from '../filter-menu.types';
|
|
4
4
|
/** Props for the `FormFieldBoolean` component returned by `createFormFieldBoolean`. Extends the base filter-menu form props. */
|
|
5
5
|
export interface IFormFieldBooleanProps<T> extends IFilterMenuFormProps<T> {
|
|
6
6
|
/** Optional content to render at the top of the form */
|
|
@@ -9,7 +9,7 @@ export interface IFormFieldBooleanProps<T> extends IFilterMenuFormProps<T> {
|
|
|
9
9
|
/** Parameters passed to `createFormFieldBoolean` to configure the generated component. */
|
|
10
10
|
export interface IFormFieldBooleanParam<T> {
|
|
11
11
|
/** Optional configuration for the form field */
|
|
12
|
-
config?:
|
|
12
|
+
config?: IFilterMenuConfig<T>;
|
|
13
13
|
/** Label for the `true` option. @default "Yes" */
|
|
14
14
|
trueLabel?: string;
|
|
15
15
|
/** Label for the `false` option. @default "No" */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
2
|
import type { TDateLogic, TValueFormatterParam } from '../types';
|
|
3
|
-
import type {
|
|
3
|
+
import type { IFilterMenuConfig, IFilterMenuFormProps } from '../filter-menu.types';
|
|
4
4
|
/** The MUI picker variant to render inside the filter menu. */
|
|
5
5
|
export type TDateTimePickerType = 'date' | 'datetime';
|
|
6
6
|
/** Props for the `FormFieldDateTime` component returned by `createFormFieldDateTime`. Extends the base filter-menu form props. */
|
|
@@ -9,7 +9,7 @@ export interface IFormFieldDateTimeProps<T> extends IFilterMenuFormProps<T> {
|
|
|
9
9
|
/** Parameters passed to `createFormFieldDateTime` to configure the generated component. */
|
|
10
10
|
export interface IFormFieldDateTimeParam<T> {
|
|
11
11
|
/** Optional field-level configuration overrides. */
|
|
12
|
-
config?:
|
|
12
|
+
config?: IFilterMenuConfig<T>;
|
|
13
13
|
/**
|
|
14
14
|
* Controls which MUI picker is rendered.
|
|
15
15
|
* - `'date'` → `DatePicker` (default)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { IFilterMenuConfig, IFilterMenuFormProps } from '../filter-menu.types';
|
|
3
3
|
import type { TFieldValid, TValueFormatterParam, TNumberOperator } from '../types';
|
|
4
4
|
/** Encodes operator + number into a single string stored in `values[]`. e.g. `"gt:18"` */
|
|
5
5
|
export declare function encodeNumberValue(operator: TNumberOperator, num: number): string;
|
|
@@ -16,7 +16,7 @@ export interface IFormFieldNumberProps<T> extends IFilterMenuFormProps<T> {
|
|
|
16
16
|
/** Parameters passed to `createFormFieldNumber` to configure the generated component. */
|
|
17
17
|
export interface IFormFieldNumberParam<T> {
|
|
18
18
|
/** Optional configuration for the form field */
|
|
19
|
-
config?:
|
|
19
|
+
config?: IFilterMenuConfig<T>;
|
|
20
20
|
/** Default operator shown when the menu first opens. @default 'eq' */
|
|
21
21
|
defaultOperator?: TNumberOperator;
|
|
22
22
|
/** Step for the number input. @default 1 */
|