@azrico/reactgrid 1.6.12 → 1.6.13
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/CHANGELOG.md +39 -37
- package/README.md +16 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +15 -0
- package/dist/src/func/func_colsizes.d.ts +22 -0
- package/dist/src/func/func_colsizes.js +86 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +16 -1
- package/dist/src/types/types.d.ts +7 -0
- package/dist/src/views/DataGrid.js +27 -2
- package/index.ts +1 -0
- package/package.json +1 -1
- package/src/func/func_colsizes.ts +74 -0
- package/src/index.tsx +1 -0
- package/src/types/types.ts +170 -163
- package/src/views/DataGrid.tsx +405 -371
package/src/types/types.ts
CHANGED
|
@@ -1,163 +1,170 @@
|
|
|
1
|
-
import { ModifyFields } from '../func/func_grid';
|
|
2
|
-
import { ConvertableToMenuItem } from '@azrico/controls/context-menu';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import {
|
|
5
|
-
TypeCellSelection,
|
|
6
|
-
TypeColumn,
|
|
7
|
-
TypeDataGridProps,
|
|
8
|
-
TypeDataSource,
|
|
9
|
-
TypeEditInfo,
|
|
10
|
-
TypeFilterTypes,
|
|
11
|
-
TypeFilterValue,
|
|
12
|
-
TypeRowDetailsInfo,
|
|
13
|
-
TypeRowProps,
|
|
14
|
-
TypeRowSelection,
|
|
15
|
-
TypeComputedProps,
|
|
16
|
-
TypeSortInfo,
|
|
17
|
-
TypeGroupBy,
|
|
18
|
-
} from '@inovua/reactdatagrid-community/types';
|
|
19
|
-
|
|
20
|
-
import { TypeOnSelectionChangeArg } from '@inovua/reactdatagrid-community/types/TypeDataGridProps';
|
|
21
|
-
|
|
22
|
-
/* -------------------------------------------------------------------------- */
|
|
23
|
-
export type ColumnDefinition = TypeColumn;
|
|
24
|
-
export type CellDefinition = any;
|
|
25
|
-
export type RowDefinition = any;
|
|
26
|
-
export type RowProps = TypeRowProps;
|
|
27
|
-
export type RowSelectionValue = TypeRowSelection;
|
|
28
|
-
export type CellSelectionValue = TypeCellSelection;
|
|
29
|
-
export type DataRowDefinition = any;
|
|
30
|
-
export type FilterTypes = TypeFilterTypes;
|
|
31
|
-
export type FilterValues = TypeFilterValue;
|
|
32
|
-
export type DataSourceDefinition = TypeDataSource;
|
|
33
|
-
export type OnSelectionChangeFunc = (config: TypeOnSelectionChangeArg) => void;
|
|
34
|
-
export type OnCellSelectionChangeFunc = (s: { [key: string]: boolean }) => void;
|
|
35
|
-
export type RowDetailsFunc = (rowDetailsInfo: TypeRowDetailsInfo) => React.ReactNode;
|
|
36
|
-
|
|
37
|
-
export type loose_column_names = {
|
|
38
|
-
key: string;
|
|
39
|
-
field: string;
|
|
40
|
-
columnName: string;
|
|
41
|
-
name: string;
|
|
42
|
-
};
|
|
43
|
-
export type loose_column_fields = loose_column_names & {
|
|
44
|
-
title: string;
|
|
45
|
-
type: string;
|
|
46
|
-
items: any[];
|
|
47
|
-
/** accessible name for cells whose visible text isn't descriptive (icons, badges, ...), set as aria-label */
|
|
48
|
-
ariaLabel: (value: any, data: any) => string;
|
|
49
|
-
};
|
|
50
|
-
export type LooseColumnDefinition = Partial<loose_column_fields & ColumnDefinition>;
|
|
51
|
-
//
|
|
52
|
-
|
|
53
|
-
export type CustomColumnDefinition = {
|
|
54
|
-
name: string;
|
|
55
|
-
render: (cell: any, formatterParams, onRendered) => React.ReactNode | undefined | null;
|
|
56
|
-
};
|
|
57
|
-
export type AzGridOptions = Partial<TypeDataGridProps> & {
|
|
58
|
-
/** called for every rendered row, after the grid's own row attributes are set */
|
|
59
|
-
onRenderRow?: (rowProps: any) => void;
|
|
60
|
-
/** extra DOM props for the header row */
|
|
61
|
-
headerProps?: { [key: string]: any };
|
|
62
|
-
};
|
|
63
|
-
/** arguments passed to a dataSource function */
|
|
64
|
-
export type AzDataSourceParams = {
|
|
65
|
-
skip?: number;
|
|
66
|
-
limit?: number;
|
|
67
|
-
/** current header filters, filter.value is an array of selected ids for a multi-select SelectFilter */
|
|
68
|
-
filterValue?: TypeFilterValue;
|
|
69
|
-
sortInfo?: TypeSortInfo;
|
|
70
|
-
groupBy?: TypeGroupBy;
|
|
71
|
-
cached_data: React.MutableRefObject<any>;
|
|
72
|
-
last_cache_info: React.MutableRefObject<any>;
|
|
73
|
-
};
|
|
74
|
-
export type AzDataSourceFunc = (args: AzDataSourceParams) => any[] | Promise<any[] | any>;
|
|
75
|
-
/* -------------------------------------------------------------------------- */
|
|
76
|
-
export type AzGridProps = {
|
|
77
|
-
dataSource?: any[] | AzDataSourceFunc;
|
|
78
|
-
details_dataSource?: any[] | AzDataSourceFunc; //details is rendered under each row
|
|
79
|
-
details_columns?: LooseColumnDefinition[];
|
|
80
|
-
details_filter?: FilterValues;
|
|
81
|
-
|
|
82
|
-
licenseKey?: string;
|
|
83
|
-
/**
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
//
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
export type
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
>;
|
|
1
|
+
import { ModifyFields } from '../func/func_grid';
|
|
2
|
+
import { ConvertableToMenuItem } from '@azrico/controls/context-menu';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import {
|
|
5
|
+
TypeCellSelection,
|
|
6
|
+
TypeColumn,
|
|
7
|
+
TypeDataGridProps,
|
|
8
|
+
TypeDataSource,
|
|
9
|
+
TypeEditInfo,
|
|
10
|
+
TypeFilterTypes,
|
|
11
|
+
TypeFilterValue,
|
|
12
|
+
TypeRowDetailsInfo,
|
|
13
|
+
TypeRowProps,
|
|
14
|
+
TypeRowSelection,
|
|
15
|
+
TypeComputedProps,
|
|
16
|
+
TypeSortInfo,
|
|
17
|
+
TypeGroupBy,
|
|
18
|
+
} from '@inovua/reactdatagrid-community/types';
|
|
19
|
+
|
|
20
|
+
import { TypeOnSelectionChangeArg } from '@inovua/reactdatagrid-community/types/TypeDataGridProps';
|
|
21
|
+
|
|
22
|
+
/* -------------------------------------------------------------------------- */
|
|
23
|
+
export type ColumnDefinition = TypeColumn;
|
|
24
|
+
export type CellDefinition = any;
|
|
25
|
+
export type RowDefinition = any;
|
|
26
|
+
export type RowProps = TypeRowProps;
|
|
27
|
+
export type RowSelectionValue = TypeRowSelection;
|
|
28
|
+
export type CellSelectionValue = TypeCellSelection;
|
|
29
|
+
export type DataRowDefinition = any;
|
|
30
|
+
export type FilterTypes = TypeFilterTypes;
|
|
31
|
+
export type FilterValues = TypeFilterValue;
|
|
32
|
+
export type DataSourceDefinition = TypeDataSource;
|
|
33
|
+
export type OnSelectionChangeFunc = (config: TypeOnSelectionChangeArg) => void;
|
|
34
|
+
export type OnCellSelectionChangeFunc = (s: { [key: string]: boolean }) => void;
|
|
35
|
+
export type RowDetailsFunc = (rowDetailsInfo: TypeRowDetailsInfo) => React.ReactNode;
|
|
36
|
+
|
|
37
|
+
export type loose_column_names = {
|
|
38
|
+
key: string;
|
|
39
|
+
field: string;
|
|
40
|
+
columnName: string;
|
|
41
|
+
name: string;
|
|
42
|
+
};
|
|
43
|
+
export type loose_column_fields = loose_column_names & {
|
|
44
|
+
title: string;
|
|
45
|
+
type: string;
|
|
46
|
+
items: any[];
|
|
47
|
+
/** accessible name for cells whose visible text isn't descriptive (icons, badges, ...), set as aria-label */
|
|
48
|
+
ariaLabel: (value: any, data: any) => string;
|
|
49
|
+
};
|
|
50
|
+
export type LooseColumnDefinition = Partial<loose_column_fields & ColumnDefinition>;
|
|
51
|
+
//
|
|
52
|
+
|
|
53
|
+
export type CustomColumnDefinition = {
|
|
54
|
+
name: string;
|
|
55
|
+
render: (cell: any, formatterParams, onRendered) => React.ReactNode | undefined | null;
|
|
56
|
+
};
|
|
57
|
+
export type AzGridOptions = Partial<TypeDataGridProps> & {
|
|
58
|
+
/** called for every rendered row, after the grid's own row attributes are set */
|
|
59
|
+
onRenderRow?: (rowProps: any) => void;
|
|
60
|
+
/** extra DOM props for the header row */
|
|
61
|
+
headerProps?: { [key: string]: any };
|
|
62
|
+
};
|
|
63
|
+
/** arguments passed to a dataSource function */
|
|
64
|
+
export type AzDataSourceParams = {
|
|
65
|
+
skip?: number;
|
|
66
|
+
limit?: number;
|
|
67
|
+
/** current header filters, filter.value is an array of selected ids for a multi-select SelectFilter */
|
|
68
|
+
filterValue?: TypeFilterValue;
|
|
69
|
+
sortInfo?: TypeSortInfo;
|
|
70
|
+
groupBy?: TypeGroupBy;
|
|
71
|
+
cached_data: React.MutableRefObject<any>;
|
|
72
|
+
last_cache_info: React.MutableRefObject<any>;
|
|
73
|
+
};
|
|
74
|
+
export type AzDataSourceFunc = (args: AzDataSourceParams) => any[] | Promise<any[] | any>;
|
|
75
|
+
/* -------------------------------------------------------------------------- */
|
|
76
|
+
export type AzGridProps = {
|
|
77
|
+
dataSource?: any[] | AzDataSourceFunc;
|
|
78
|
+
details_dataSource?: any[] | AzDataSourceFunc; //details is rendered under each row
|
|
79
|
+
details_columns?: LooseColumnDefinition[];
|
|
80
|
+
details_filter?: FilterValues;
|
|
81
|
+
|
|
82
|
+
licenseKey?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Stable id of this grid. When set, the column widths the user resizes are saved in localStorage
|
|
85
|
+
* (see `setGridStorageScope`) and restored on the next load. Leave it out to keep the columns' own widths.
|
|
86
|
+
* Saved widths are matched to columns by name, so grids showing different column sets can share an id.
|
|
87
|
+
* Columns with `width` become resizable (`width` is used as `defaultWidth`).
|
|
88
|
+
*/
|
|
89
|
+
gridId?: string;
|
|
90
|
+
/** accessible name of the grid, set as aria-label on the grid root */
|
|
91
|
+
ariaLabel?: string;
|
|
92
|
+
|
|
93
|
+
gridRef?: React.MutableRefObject<TypeComputedProps>;
|
|
94
|
+
gridOptions?: AzGridOptions;
|
|
95
|
+
|
|
96
|
+
columns?: LooseColumnDefinition[];
|
|
97
|
+
columnExtensions?: LooseColumnDefinition[];
|
|
98
|
+
|
|
99
|
+
editableColumns?: string[];
|
|
100
|
+
leftColumns?: string[];
|
|
101
|
+
rightColumns?: string[];
|
|
102
|
+
customColumns?: CustomColumnDefinition[];
|
|
103
|
+
|
|
104
|
+
contextMenuItems?: ConvertableToMenuItem;
|
|
105
|
+
/** Keep the context menu open when clicking outside (default false). */
|
|
106
|
+
dontAutoCloseContextMenu?: boolean;
|
|
107
|
+
/** Close the context menu on Escape (default false). */
|
|
108
|
+
escapeClosesContextMenu?: boolean;
|
|
109
|
+
/** Hide the grid context menu and leave the browser's context menu available. */
|
|
110
|
+
hideContextMenu?: boolean;
|
|
111
|
+
/** Extra classes on the row context menu, which is portaled to <body> */
|
|
112
|
+
contextMenuClassName?: string;
|
|
113
|
+
|
|
114
|
+
highlightedRow?: any;
|
|
115
|
+
RowDetail?: RowDetailsFunc;
|
|
116
|
+
|
|
117
|
+
selected?: RowSelectionValue;
|
|
118
|
+
cellSelection?: CellSelectionValue;
|
|
119
|
+
/* -------------------------------------------------------------------------- */
|
|
120
|
+
onEditComplete?: (editInfo: TypeEditInfo) => void;
|
|
121
|
+
onSelectionChange?: OnSelectionChangeFunc;
|
|
122
|
+
onCellSelectionChange?: OnCellSelectionChangeFunc;
|
|
123
|
+
|
|
124
|
+
onRowClick?: (rowIndex: number, row: any) => void;
|
|
125
|
+
onRowDoubleClick?: (rowIndex: number, row: any) => void;
|
|
126
|
+
onLimitChange?: (v: number) => void;
|
|
127
|
+
onSkipChange?: (v: number) => void;
|
|
128
|
+
/* -------------------------------------------------------------------------- */
|
|
129
|
+
skip?: number;
|
|
130
|
+
limit?: number;
|
|
131
|
+
//
|
|
132
|
+
editable?: boolean | ((editValue: any, cellProps: any) => boolean);
|
|
133
|
+
advancedFilterFields?: string[];
|
|
134
|
+
/** Label of the quick-search box shown with `advancedFilterFields`. Default "Search". */
|
|
135
|
+
advancedFilterLabel?: React.ReactNode;
|
|
136
|
+
/** Placeholder of the quick-search input. A string is used as the native placeholder, any other node (custom HTML) is shown over the empty input. */
|
|
137
|
+
advancedFilterPlaceholder?: React.ReactNode;
|
|
138
|
+
//
|
|
139
|
+
|
|
140
|
+
loading?: boolean;
|
|
141
|
+
theme?: 'light' | 'dark' | (string & {});
|
|
142
|
+
/** @deprecated Use theme="dark" or theme="light" instead. */
|
|
143
|
+
dark?: boolean;
|
|
144
|
+
delayedSize?: boolean;
|
|
145
|
+
allowChildRows?: boolean;
|
|
146
|
+
looseCacheCheck?: boolean;
|
|
147
|
+
className?: string;
|
|
148
|
+
/** rendered after the grid, inside its container */
|
|
149
|
+
children?: React.ReactNode;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export type DataGridProps = ModifyFields<
|
|
153
|
+
AzGridProps,
|
|
154
|
+
{
|
|
155
|
+
columns: ColumnDefinition[];
|
|
156
|
+
dataSource: any;
|
|
157
|
+
}
|
|
158
|
+
>;
|
|
159
|
+
export type GridType = TypeComputedProps;
|
|
160
|
+
export type DataGridWrapperProps = ModifyFields<
|
|
161
|
+
DataGridProps,
|
|
162
|
+
{
|
|
163
|
+
gridRef: React.MutableRefObject<TypeComputedProps>;
|
|
164
|
+
/** internal: inovua's live computed props ref (gridRef holds a snapshot) */
|
|
165
|
+
liveGridRef: React.MutableRefObject<React.MutableRefObject<TypeComputedProps> | null>;
|
|
166
|
+
static_gridOptions: AzGridOptions;
|
|
167
|
+
dynamic_gridOptions: AzGridOptions;
|
|
168
|
+
children?: React.ReactNode;
|
|
169
|
+
}
|
|
170
|
+
>;
|