@syook/react-tabulous 4.5.0 → 4.6.0-beta.1
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 -1
- package/lib/index.d.ts +62 -2
- package/lib/index.esm.js +2 -2
- package/lib/index.js +2 -2
- package/lib/types/reactTabulous/components/cell/columnCell.d.ts +2 -2
- package/lib/types/reactTabulous/components/filter/index.d.ts +1 -2
- package/lib/types/reactTabulous/components/toolbar/gridToolbarConditionalFormatting.d.ts +7 -0
- package/lib/types/reactTabulous/components/toolbar/index.d.ts +1 -0
- package/lib/types/reactTabulous/components/widgets/dotIndicator.d.ts +5 -0
- package/lib/types/reactTabulous/components/widgets/icon.d.ts +1 -0
- package/lib/types/reactTabulous/components/widgets/index.d.ts +1 -0
- package/lib/types/reactTabulous/helpers/getConditionalCellStyle.d.ts +10 -0
- package/lib/types/reactTabulous/helpers/getFormattedFilters.d.ts +1 -0
- package/lib/types/reactTabulous/hooks/useGridConditionalFormatting.d.ts +15 -0
- package/lib/types/reactTabulous/hooks/useGridFilter.d.ts +2 -2
- package/lib/types/reactTabulous/hooks/useGridRootProps.d.ts +2 -0
- package/lib/types/reactTabulous/models/gridConditionalFormatting.d.ts +47 -0
- package/lib/types/reactTabulous/models/gridFiltersModel.d.ts +1 -0
- package/lib/types/reactTabulous/models/index.d.ts +1 -0
- package/lib/types/reactTabulous/models/props/dataGridProps.d.ts +13 -1
- package/package.json +1 -1
|
@@ -7,8 +7,8 @@ type ColumnCellProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
7
7
|
row?: any;
|
|
8
8
|
column?: any;
|
|
9
9
|
emptyPlaceholder: string;
|
|
10
|
-
rowIndex
|
|
11
|
-
align
|
|
10
|
+
rowIndex?: number;
|
|
11
|
+
align?: ColumnAlignment;
|
|
12
12
|
};
|
|
13
13
|
declare const ColumnCell: React.FC<ColumnCellProps>;
|
|
14
14
|
export default ColumnCell;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare const filterPredicates: string[];
|
|
3
|
-
interface FilterOperators {
|
|
3
|
+
export interface FilterOperators {
|
|
4
4
|
string: string[];
|
|
5
5
|
number: string[];
|
|
6
6
|
date: string[];
|
|
@@ -10,4 +10,3 @@ interface FilterOperators {
|
|
|
10
10
|
}
|
|
11
11
|
export declare const filterOperators: FilterOperators;
|
|
12
12
|
export declare const FilterForm: React.FC;
|
|
13
|
-
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Toolbar section for Conditional Formatting.
|
|
4
|
+
* Full UI for custom rules (apply to, condition, style); priority by add order.
|
|
5
|
+
* Rules evaluated/applied independently to cells.
|
|
6
|
+
*/
|
|
7
|
+
export declare const GridToolbarConditionalFormatting: React.FC;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const DotIndicator: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -10,6 +10,7 @@ declare const icons: {
|
|
|
10
10
|
density: import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
download: import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
filter: import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
'conditional-format': import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
'filter-list': import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
sort: import("react/jsx-runtime").JSX.Element;
|
|
15
16
|
'sort-up-fill': import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import { type GridConditionalFormattingRule } from '../models';
|
|
3
|
+
import { type GridColDef } from '../models';
|
|
4
|
+
/**
|
|
5
|
+
* Computes the style for a cell based on matching conditional formatting rules.
|
|
6
|
+
* Rules are checked in order (priority by array position); last match wins for overlapping styles.
|
|
7
|
+
* Independent of filters/sorts.
|
|
8
|
+
* Applies to the rule's field (column).
|
|
9
|
+
*/
|
|
10
|
+
export declare const getConditionalCellStyle: (row: any, column: GridColDef, rowIndex: number, rules?: GridConditionalFormattingRule[]) => CSSProperties;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type GridConditionalFormattingRule } from '../models';
|
|
2
|
+
/**
|
|
3
|
+
* Hook to manage conditional formatting rules.
|
|
4
|
+
* Similar to useGridFilter.
|
|
5
|
+
* Rules stored in root state.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useGridConditionalFormatting: () => {
|
|
8
|
+
conditionalFormatting: GridConditionalFormattingRule[];
|
|
9
|
+
handleAddRule: (newRule: Omit<GridConditionalFormattingRule, 'id' | 'priority'>) => void;
|
|
10
|
+
handleRemoveRule: (ruleId: string) => void;
|
|
11
|
+
handleUpdateRule: (updatedRule: GridConditionalFormattingRule) => void;
|
|
12
|
+
handleClearRules: () => void;
|
|
13
|
+
handleSetRules: (rules: GridConditionalFormattingRule[]) => void;
|
|
14
|
+
columns: import("../models").GridColDef<any, any, any>[];
|
|
15
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type GridColDef } from '../models';
|
|
2
|
-
export declare const queryCondition: (columnValue: string, operator: string, value: string, type: string) => boolean;
|
|
2
|
+
export declare const queryCondition: (columnValue: string, operator: string, value: string, type: string, value2?: string) => boolean;
|
|
3
3
|
export declare const getQueryValue: (rowObject: any, column: string, columnDef: GridColDef) => any;
|
|
4
|
-
export declare const filterData: (data: any, column: string, operator: string, value: string, type: string, columnDef: GridColDef) => any;
|
|
4
|
+
export declare const filterData: (data: any, column: string, operator: string, value: string, type: string, columnDef: GridColDef, value2?: string) => any;
|
|
5
5
|
export declare const filterAllData: (filters: any, data: any, columns: GridColDef[]) => any;
|
|
6
6
|
export declare const useGridFilter: () => any;
|
|
@@ -45,6 +45,8 @@ export declare const DATA_GRID_PROPS_DEFAULT_VALUES: {
|
|
|
45
45
|
rowsCount: null;
|
|
46
46
|
customExport: null;
|
|
47
47
|
onFilterChange: null;
|
|
48
|
+
conditionalFormatting: never[];
|
|
49
|
+
onConditionalFormattingChange: null;
|
|
48
50
|
};
|
|
49
51
|
export declare const useGridRootProps: () => {
|
|
50
52
|
rootState: DataGridPropsWithDefaultValues;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export type ConditionalFormattingOperator = string;
|
|
2
|
+
export interface GridConditionalFormattingRule {
|
|
3
|
+
/**
|
|
4
|
+
* Unique ID for the rule.
|
|
5
|
+
*/
|
|
6
|
+
id: string;
|
|
7
|
+
/**
|
|
8
|
+
* The field (column) to evaluate condition and apply style to.
|
|
9
|
+
* (Relies on this key/value; no separate columns array needed.)
|
|
10
|
+
*/
|
|
11
|
+
field: string;
|
|
12
|
+
/**
|
|
13
|
+
* Operator for the condition (reuses filter operators).
|
|
14
|
+
*/
|
|
15
|
+
operator: ConditionalFormattingOperator;
|
|
16
|
+
/**
|
|
17
|
+
* Value for condition (e.g. threshold, text).
|
|
18
|
+
*/
|
|
19
|
+
value?: any;
|
|
20
|
+
/**
|
|
21
|
+
* Second value for operators like 'between'.
|
|
22
|
+
*/
|
|
23
|
+
value2?: any;
|
|
24
|
+
/**
|
|
25
|
+
* Styles to apply if condition matches.
|
|
26
|
+
*/
|
|
27
|
+
style: {
|
|
28
|
+
textColor?: string;
|
|
29
|
+
backgroundColor?: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Higher number = higher priority (last in array wins on ties).
|
|
33
|
+
* Managed by rule order in UI.
|
|
34
|
+
*/
|
|
35
|
+
priority: number;
|
|
36
|
+
}
|
|
37
|
+
export interface GridConditionalFormattingProps {
|
|
38
|
+
/**
|
|
39
|
+
* Array of conditional formatting rules.
|
|
40
|
+
* Rules are evaluated in order for each cell/row.
|
|
41
|
+
*/
|
|
42
|
+
conditionalFormatting?: GridConditionalFormattingRule[];
|
|
43
|
+
/**
|
|
44
|
+
* Callback when rules change (e.g. add/edit/delete).
|
|
45
|
+
*/
|
|
46
|
+
onConditionalFormattingChange?: (rules: GridConditionalFormattingRule[]) => void;
|
|
47
|
+
}
|
|
@@ -5,6 +5,7 @@ import { type GridSortDirection } from '../gridSortModel';
|
|
|
5
5
|
import { type Logger } from '../logger';
|
|
6
6
|
import { type GridRowId, type GridValidRowModel } from '../gridRows';
|
|
7
7
|
import { type FilterFieldProps } from '../gridFiltersModel';
|
|
8
|
+
import { type GridConditionalFormattingRule } from '../gridConditionalFormatting';
|
|
8
9
|
export interface DataGridPropsWithDefaultValues {
|
|
9
10
|
data: any;
|
|
10
11
|
rootData: [];
|
|
@@ -158,12 +159,23 @@ export interface DataGridPropsWithDefaultValues {
|
|
|
158
159
|
* if the export is custom.
|
|
159
160
|
*
|
|
160
161
|
*/
|
|
161
|
-
customExport: null | ((filteredAndSortedData: any, searchText: string, columns: any) => void);
|
|
162
|
+
customExport: null | ((filteredAndSortedData: any, searchText: string, columns: any, conditionalFormatting?: any) => void);
|
|
162
163
|
/**
|
|
163
164
|
* Callback fired when filter is changed with filters as arguments.
|
|
164
165
|
*
|
|
165
166
|
*/
|
|
166
167
|
onFilterChange: null | ((filters: FilterFieldProps[]) => void);
|
|
168
|
+
/**
|
|
169
|
+
* Conditional formatting rules to apply to cells/rows.
|
|
170
|
+
* Rules evaluated independently (after filters/sorts).
|
|
171
|
+
* Multiple rules; later rules override on conflicts based on order/priority.
|
|
172
|
+
* @default []
|
|
173
|
+
*/
|
|
174
|
+
conditionalFormatting: GridConditionalFormattingRule[];
|
|
175
|
+
/**
|
|
176
|
+
* Callback fired when conditional formatting rules change.
|
|
177
|
+
*/
|
|
178
|
+
onConditionalFormattingChange: null | ((rules: GridConditionalFormattingRule[]) => void);
|
|
167
179
|
/**
|
|
168
180
|
* custom placeholder for the search field.
|
|
169
181
|
*/
|