es-grid-template 1.3.0 → 1.3.2
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/assets/index.css +16 -0
- package/assets/index.scss +37 -3
- package/es/grid-component/CheckboxFilter.js +4 -0
- package/es/grid-component/CheckboxFilter2.d.ts +20 -0
- package/es/grid-component/CheckboxFilter2.js +248 -0
- package/es/grid-component/ColumnsGroup/ColumnsGroup.js +4 -4
- package/es/grid-component/ContextMenu.js +1 -0
- package/es/grid-component/ConvertColumnTable.js +1 -0
- package/es/grid-component/EditableCell.js +11 -8
- package/es/grid-component/InternalTable.js +47 -11
- package/es/grid-component/TableGrid.d.ts +3 -0
- package/es/grid-component/TableGrid.js +71 -7
- package/es/grid-component/hooks/columns/index.js +14 -45
- package/es/grid-component/hooks/content/HeaderContent.js +54 -58
- package/es/grid-component/hooks/useColumns.d.ts +4 -2
- package/es/grid-component/hooks/useColumns.js +32 -13
- package/es/grid-component/hooks/utils.d.ts +9 -0
- package/es/grid-component/hooks/utils.js +278 -1
- package/es/grid-component/number-range/index.d.ts +10 -0
- package/es/grid-component/number-range/index.js +59 -0
- package/es/grid-component/styles.scss +24 -0
- package/es/grid-component/table/Grid.d.ts +3 -0
- package/es/grid-component/table/GridEdit.js +360 -106
- package/es/grid-component/table/Group.d.ts +1 -0
- package/es/grid-component/table/Group.js +1 -1
- package/es/grid-component/type.d.ts +2 -1
- package/lib/grid-component/CheckboxFilter.js +4 -0
- package/lib/grid-component/CheckboxFilter2.d.ts +20 -0
- package/lib/grid-component/CheckboxFilter2.js +257 -0
- package/lib/grid-component/ColumnsGroup/ColumnsGroup.js +4 -4
- package/lib/grid-component/ContextMenu.js +1 -0
- package/lib/grid-component/ConvertColumnTable.js +1 -0
- package/lib/grid-component/EditableCell.js +11 -8
- package/lib/grid-component/InternalTable.js +41 -10
- package/lib/grid-component/TableGrid.d.ts +3 -0
- package/lib/grid-component/TableGrid.js +68 -7
- package/lib/grid-component/hooks/columns/index.js +14 -45
- package/lib/grid-component/hooks/content/HeaderContent.js +53 -55
- package/lib/grid-component/hooks/useColumns.d.ts +4 -2
- package/lib/grid-component/hooks/useColumns.js +31 -12
- package/lib/grid-component/hooks/utils.d.ts +9 -0
- package/lib/grid-component/hooks/utils.js +293 -4
- package/lib/grid-component/number-range/index.d.ts +10 -0
- package/lib/grid-component/number-range/index.js +67 -0
- package/lib/grid-component/styles.scss +24 -0
- package/lib/grid-component/table/Grid.d.ts +3 -0
- package/lib/grid-component/table/GridEdit.js +358 -104
- package/lib/grid-component/table/Group.d.ts +1 -0
- package/lib/grid-component/table/Group.js +1 -1
- package/lib/grid-component/type.d.ts +2 -1
- package/package.json +109 -108
package/assets/index.css
CHANGED
|
@@ -42,6 +42,12 @@
|
|
|
42
42
|
.ui-rc-table-wrapper .ui-rc-table-bordered .ui-rc-table-tbody-virtual .ui-rc-table-cell {
|
|
43
43
|
border-inline-end: 1px solid #e0e0e0;
|
|
44
44
|
}
|
|
45
|
+
.ui-rc-table-wrapper .ui-rc-table-tbody .ui-rc-table-cell {
|
|
46
|
+
line-height: 22px;
|
|
47
|
+
}
|
|
48
|
+
.ui-rc-table-wrapper .ui-rc-table-tbody .ui-rc-table-cell .ui-rc-table-cell-content {
|
|
49
|
+
line-height: 22px;
|
|
50
|
+
}
|
|
45
51
|
.ui-rc-table-wrapper .ui-rc-table-tbody .ui-rc-table-row.ui-rc-table-row-selected > .ui-rc-table-cell {
|
|
46
52
|
background: #FEF2EF;
|
|
47
53
|
}
|
|
@@ -102,6 +108,9 @@
|
|
|
102
108
|
border-bottom: 1px solid #e0e0e0;
|
|
103
109
|
font-weight: 500;
|
|
104
110
|
}
|
|
111
|
+
.ui-rc-table-wrapper .ui-rc-table-thead .ui-rc-table-cell .ui-rc-table-cell-content {
|
|
112
|
+
line-height: 22px;
|
|
113
|
+
}
|
|
105
114
|
.ui-rc-table-wrapper .ui-rc-table-summary .ui-rc-table-cell {
|
|
106
115
|
background-color: #fafafa;
|
|
107
116
|
height: 39px;
|
|
@@ -176,6 +185,9 @@
|
|
|
176
185
|
inset-inline-start: -1px;
|
|
177
186
|
}
|
|
178
187
|
|
|
188
|
+
.ui-rc-table-wrapper .ui-rc-table.ui-rc-table-small .ui-rc-table-thead > tr > th.ui-rc-table-selection-column {
|
|
189
|
+
padding: 0;
|
|
190
|
+
}
|
|
179
191
|
.ui-rc-table-wrapper.grid-editable .ui-rc-table .ui-rc-table-tbody .rc-ui-cell-editable {
|
|
180
192
|
overflow: unset;
|
|
181
193
|
display: flex;
|
|
@@ -276,6 +288,9 @@
|
|
|
276
288
|
.ui-rc-table-wrapper.grid-editable .ui-rc_cell-content.selected {
|
|
277
289
|
background-color: #E6EFFD;
|
|
278
290
|
}
|
|
291
|
+
.ui-rc-table-wrapper.grid-editable .ui-rc_cell-content.disable {
|
|
292
|
+
background-color: #f0f0f0;
|
|
293
|
+
}
|
|
279
294
|
.ui-rc-table-wrapper.grid-editable .ui-rc_cell-content--index.focus {
|
|
280
295
|
background-color: #CEDBEF;
|
|
281
296
|
}
|
|
@@ -471,6 +486,7 @@
|
|
|
471
486
|
transition: 0.3s;
|
|
472
487
|
white-space: nowrap;
|
|
473
488
|
overflow: hidden;
|
|
489
|
+
line-height: 22px;
|
|
474
490
|
}
|
|
475
491
|
.ui-rc-table-wrapper.grid-editable .ui-rc-table-tbody .ui-rc-table-cell.cell-editing:focus-visible {
|
|
476
492
|
outline: none;
|
package/assets/index.scss
CHANGED
|
@@ -133,6 +133,21 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
133
133
|
|
|
134
134
|
.#{$prefix}-table-tbody {
|
|
135
135
|
|
|
136
|
+
|
|
137
|
+
.#{$prefix}-table-cell {
|
|
138
|
+
line-height: 22px;
|
|
139
|
+
|
|
140
|
+
.ui-rc-table-cell-content {
|
|
141
|
+
line-height: 22px;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&.#{$prefix}-table-cell-fix-left-last {
|
|
145
|
+
.#{$prefix}-table-cell-content {
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
}
|
|
150
|
+
|
|
136
151
|
.#{$prefix}-table-row {
|
|
137
152
|
|
|
138
153
|
&.#{$prefix}-table-row-selected {
|
|
@@ -205,11 +220,17 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
205
220
|
border-bottom: 1px solid $tableBorderColor;
|
|
206
221
|
//background: #fff;
|
|
207
222
|
font-weight: 500;
|
|
223
|
+
//line-height: 23px;
|
|
224
|
+
//height: 40px;
|
|
208
225
|
}
|
|
209
226
|
}
|
|
210
227
|
|
|
211
228
|
.#{$prefix}-table-cell {
|
|
212
229
|
|
|
230
|
+
.ui-rc-table-cell-content {
|
|
231
|
+
line-height: 22px;
|
|
232
|
+
}
|
|
233
|
+
|
|
213
234
|
&.#{$prefix}-table-cell-fix-left-last {
|
|
214
235
|
.#{$prefix}-table-cell-content {
|
|
215
236
|
//overflow: visible;
|
|
@@ -336,10 +357,18 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
336
357
|
.#{$prefix}-table-wrapper {
|
|
337
358
|
|
|
338
359
|
.#{$prefix}-table.#{$prefix}-table-small {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
360
|
+
.ui-rc-table-thead {
|
|
361
|
+
>tr >th.#{$prefix}-table-selection-column{
|
|
362
|
+
//padding-block: 7px;
|
|
363
|
+
padding: 0;
|
|
364
|
+
//padding: 6px 8px;
|
|
365
|
+
}
|
|
342
366
|
}
|
|
367
|
+
//.#{$prefix}-table-selection-column{
|
|
368
|
+
// padding-block: 7px;
|
|
369
|
+
// padding: 0;
|
|
370
|
+
// //padding: 6px 8px;
|
|
371
|
+
//}
|
|
343
372
|
}
|
|
344
373
|
|
|
345
374
|
&.grid-editable {
|
|
@@ -594,6 +623,10 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
594
623
|
background-color: $cell-selected-bg;
|
|
595
624
|
}
|
|
596
625
|
|
|
626
|
+
.ui-rc_cell-content.disable {
|
|
627
|
+
background-color: #f0f0f0;
|
|
628
|
+
}
|
|
629
|
+
|
|
597
630
|
.ui-rc_cell-content--index {
|
|
598
631
|
&.focus {
|
|
599
632
|
background-color: $cell-index-focus-bg;
|
|
@@ -678,6 +711,7 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
678
711
|
transition: 0.3s;
|
|
679
712
|
white-space: nowrap;
|
|
680
713
|
overflow: hidden;
|
|
714
|
+
line-height: 22px;
|
|
681
715
|
}
|
|
682
716
|
}
|
|
683
717
|
}
|
|
@@ -79,6 +79,7 @@ const CheckboxFilter = props => {
|
|
|
79
79
|
|
|
80
80
|
// const [searchValue, setSearchValue] = React.useState('');
|
|
81
81
|
|
|
82
|
+
console.log('options', options);
|
|
82
83
|
const [openKeys, setOpenKeys] = React.useState([]);
|
|
83
84
|
|
|
84
85
|
// clear search value after close filter dropdown
|
|
@@ -171,6 +172,9 @@ const CheckboxFilter = props => {
|
|
|
171
172
|
onSelect?.(keys);
|
|
172
173
|
}
|
|
173
174
|
};
|
|
175
|
+
console.log('getTreeData({ filters: options })', getTreeData({
|
|
176
|
+
filters: options
|
|
177
|
+
}));
|
|
174
178
|
if (filterMode === 'tree') {
|
|
175
179
|
return /*#__PURE__*/React.createElement(React.Fragment, null, showFilter && /*#__PURE__*/React.createElement(FilterSearch, {
|
|
176
180
|
filterSearch: filterSearch,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { TableLocale } from "rc-master-ui/es/table/interface";
|
|
3
|
+
type Props = {
|
|
4
|
+
options: any[];
|
|
5
|
+
filterSearch?: boolean;
|
|
6
|
+
open?: boolean;
|
|
7
|
+
tablePrefixCls?: string;
|
|
8
|
+
prefixCls?: string;
|
|
9
|
+
dropdownPrefixCls?: string;
|
|
10
|
+
filterMultiple: boolean;
|
|
11
|
+
showFilter?: boolean;
|
|
12
|
+
onSelect?: (value: any) => void;
|
|
13
|
+
selectedKeys: string[];
|
|
14
|
+
locale?: TableLocale;
|
|
15
|
+
filterMode?: 'menu' | 'tree';
|
|
16
|
+
searchValue: string;
|
|
17
|
+
setSearchValue: (value: any) => void;
|
|
18
|
+
};
|
|
19
|
+
declare const CheckboxFilter: (props: Props) => React.JSX.Element;
|
|
20
|
+
export default CheckboxFilter;
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import FilterSearch from "./FilterSearch";
|
|
4
|
+
import { Checkbox, Menu, Radio, Empty } from "rc-master-ui";
|
|
5
|
+
import { Tree } from "antd";
|
|
6
|
+
import { flattenKeys } from "rc-master-ui/es/table/hooks/useFilter";
|
|
7
|
+
// import Tree from "rc-master-ui/es/tree";
|
|
8
|
+
|
|
9
|
+
function searchValueMatched(searchValue, text) {
|
|
10
|
+
if (typeof text === 'string' || typeof text === 'number') {
|
|
11
|
+
return text?.toString().toLowerCase().includes(searchValue.trim().toLowerCase());
|
|
12
|
+
}
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
function renderFilterItems({
|
|
16
|
+
filters,
|
|
17
|
+
prefixCls,
|
|
18
|
+
filteredKeys,
|
|
19
|
+
filterMultiple,
|
|
20
|
+
searchValue,
|
|
21
|
+
filterSearch
|
|
22
|
+
}) {
|
|
23
|
+
return filters.map((filter, index) => {
|
|
24
|
+
const key = String(filter.value);
|
|
25
|
+
if (filter.children) {
|
|
26
|
+
return {
|
|
27
|
+
key: key || index,
|
|
28
|
+
label: filter.text,
|
|
29
|
+
popupClassName: `${prefixCls}-dropdown-submenu`,
|
|
30
|
+
children: renderFilterItems({
|
|
31
|
+
filters: filter.children,
|
|
32
|
+
prefixCls,
|
|
33
|
+
filteredKeys,
|
|
34
|
+
filterMultiple,
|
|
35
|
+
searchValue,
|
|
36
|
+
filterSearch
|
|
37
|
+
})
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const Component = filterMultiple ? Checkbox : Radio;
|
|
41
|
+
const item = {
|
|
42
|
+
key: filter.value !== undefined ? key : index,
|
|
43
|
+
label: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Component, {
|
|
44
|
+
checked: filteredKeys.includes(key)
|
|
45
|
+
}), /*#__PURE__*/React.createElement("span", null, filter.text))
|
|
46
|
+
};
|
|
47
|
+
if (searchValue.trim()) {
|
|
48
|
+
if (typeof filterSearch === 'function') {
|
|
49
|
+
return filterSearch(searchValue, filter) ? item : null;
|
|
50
|
+
}
|
|
51
|
+
return searchValueMatched(searchValue, filter.text) ? item : null;
|
|
52
|
+
}
|
|
53
|
+
return item;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function hasSubMenu(filters) {
|
|
57
|
+
return filters.some(({
|
|
58
|
+
children
|
|
59
|
+
}) => children);
|
|
60
|
+
}
|
|
61
|
+
const CheckboxFilter = props => {
|
|
62
|
+
const {
|
|
63
|
+
// column,
|
|
64
|
+
filterSearch = true,
|
|
65
|
+
tablePrefixCls = 'ui-rc-table',
|
|
66
|
+
prefixCls = 'ui-rc-table-filter',
|
|
67
|
+
dropdownPrefixCls = 'ui-rc-dropdown',
|
|
68
|
+
filterMultiple,
|
|
69
|
+
selectedKeys,
|
|
70
|
+
locale,
|
|
71
|
+
options,
|
|
72
|
+
filterMode = 'tree',
|
|
73
|
+
// open,
|
|
74
|
+
searchValue,
|
|
75
|
+
showFilter,
|
|
76
|
+
setSearchValue,
|
|
77
|
+
onSelect
|
|
78
|
+
} = props;
|
|
79
|
+
|
|
80
|
+
// const [searchValue, setSearchValue] = React.useState('');
|
|
81
|
+
|
|
82
|
+
console.log('options', options);
|
|
83
|
+
const [openKeys, setOpenKeys] = React.useState([]);
|
|
84
|
+
|
|
85
|
+
// clear search value after close filter dropdown
|
|
86
|
+
// React.useEffect(() => {
|
|
87
|
+
// // if (visible) {
|
|
88
|
+
// setSearchValue('');
|
|
89
|
+
// // }
|
|
90
|
+
// }, [open]);
|
|
91
|
+
|
|
92
|
+
const onOpenChange = keys => {
|
|
93
|
+
setOpenKeys(keys);
|
|
94
|
+
};
|
|
95
|
+
const items = renderFilterItems({
|
|
96
|
+
// filters: column.filters || [],
|
|
97
|
+
filters: options || [],
|
|
98
|
+
filterSearch,
|
|
99
|
+
prefixCls,
|
|
100
|
+
filteredKeys: selectedKeys ?? [],
|
|
101
|
+
filterMultiple,
|
|
102
|
+
searchValue
|
|
103
|
+
});
|
|
104
|
+
const dropdownMenuClass = classNames({
|
|
105
|
+
// [`${dropdownPrefixCls}-menu-without-submenu`]: !hasSubMenu(column.filters || []),
|
|
106
|
+
[`${dropdownPrefixCls}-menu-without-submenu`]: !hasSubMenu(options || [])
|
|
107
|
+
});
|
|
108
|
+
const empty = /*#__PURE__*/React.createElement(Empty, {
|
|
109
|
+
image: Empty.PRESENTED_IMAGE_SIMPLE,
|
|
110
|
+
description: locale?.filterEmptyText,
|
|
111
|
+
imageStyle: {
|
|
112
|
+
height: 24
|
|
113
|
+
},
|
|
114
|
+
style: {
|
|
115
|
+
margin: 0,
|
|
116
|
+
padding: '16px 0'
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
const isEmpty = items.every(item => item === null);
|
|
120
|
+
const onSearch = e => {
|
|
121
|
+
const {
|
|
122
|
+
value
|
|
123
|
+
} = e.target;
|
|
124
|
+
setSearchValue(value);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// if ((column.filters || []).length === 0) {
|
|
128
|
+
// return empty;
|
|
129
|
+
// }
|
|
130
|
+
|
|
131
|
+
const getTreeData = ({
|
|
132
|
+
filters
|
|
133
|
+
}) => (filters || []).map((filter, index) => {
|
|
134
|
+
const key = String(filter.value);
|
|
135
|
+
const item = {
|
|
136
|
+
title: filter.text,
|
|
137
|
+
key: filter.value !== undefined ? key : String(index)
|
|
138
|
+
};
|
|
139
|
+
if (filter.children) {
|
|
140
|
+
item.children = getTreeData({
|
|
141
|
+
filters: filter.children
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
return item;
|
|
145
|
+
});
|
|
146
|
+
const getFilterData = node => ({
|
|
147
|
+
...node,
|
|
148
|
+
text: node.title,
|
|
149
|
+
value: node.key,
|
|
150
|
+
children: node.children?.map(item => getFilterData(item)) || []
|
|
151
|
+
});
|
|
152
|
+
const onCheckAll = e => {
|
|
153
|
+
if (e.target.checked) {
|
|
154
|
+
const allFilterKeys = flattenKeys(options).map(key => String(key));
|
|
155
|
+
|
|
156
|
+
// setFilteredKeysSync(allFilterKeys);
|
|
157
|
+
onSelect?.(allFilterKeys);
|
|
158
|
+
} else {
|
|
159
|
+
onSelect?.([]);
|
|
160
|
+
// setFilteredKeysSync([]);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
const onCheck = (keys, {
|
|
164
|
+
node,
|
|
165
|
+
checked
|
|
166
|
+
}) => {
|
|
167
|
+
if (!filterMultiple) {
|
|
168
|
+
// onSelectKeys({ selectedKeys: checked && node.key ? [node.key] : [] });
|
|
169
|
+
onSelect?.(checked && node.key ? [node.key] : []);
|
|
170
|
+
} else {
|
|
171
|
+
// onSelectKeys({ selectedKeys: keys });
|
|
172
|
+
onSelect?.(keys);
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
console.log('getTreeData({ filters: options })', getTreeData({
|
|
176
|
+
filters: options
|
|
177
|
+
}));
|
|
178
|
+
if (filterMode === 'tree') {
|
|
179
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, showFilter && /*#__PURE__*/React.createElement(FilterSearch, {
|
|
180
|
+
filterSearch: filterSearch,
|
|
181
|
+
value: searchValue,
|
|
182
|
+
onChange: onSearch,
|
|
183
|
+
tablePrefixCls: tablePrefixCls,
|
|
184
|
+
locale: locale
|
|
185
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
186
|
+
className: `${tablePrefixCls}-filter-dropdown-tree`
|
|
187
|
+
}, filterMultiple && options.length > 0 ? /*#__PURE__*/React.createElement(Checkbox
|
|
188
|
+
// checked={selectedKeys.length === flattenKeys(column.filters).length}
|
|
189
|
+
, {
|
|
190
|
+
checked: selectedKeys.length === flattenKeys(options).length
|
|
191
|
+
// indeterminate={
|
|
192
|
+
// selectedKeys.length > 0 &&
|
|
193
|
+
// selectedKeys.length < flattenKeys(column.filters).length
|
|
194
|
+
// }
|
|
195
|
+
,
|
|
196
|
+
|
|
197
|
+
indeterminate: selectedKeys.length > 0 && selectedKeys.length < flattenKeys(options).length,
|
|
198
|
+
className: `${tablePrefixCls}-filter-dropdown-checkall`,
|
|
199
|
+
onChange: onCheckAll
|
|
200
|
+
}, locale?.filterCheckall) : /*#__PURE__*/React.createElement(Empty, null), /*#__PURE__*/React.createElement(Tree, {
|
|
201
|
+
checkable: true,
|
|
202
|
+
selectable: false,
|
|
203
|
+
blockNode: true,
|
|
204
|
+
multiple: filterMultiple,
|
|
205
|
+
checkStrictly: !filterMultiple,
|
|
206
|
+
className: `${dropdownPrefixCls}-menu`,
|
|
207
|
+
onCheck: onCheck,
|
|
208
|
+
checkedKeys: selectedKeys,
|
|
209
|
+
selectedKeys: selectedKeys,
|
|
210
|
+
showIcon: false
|
|
211
|
+
// treeData={getTreeData({ filters: column.filters })}
|
|
212
|
+
,
|
|
213
|
+
treeData: getTreeData({
|
|
214
|
+
filters: options
|
|
215
|
+
}),
|
|
216
|
+
autoExpandParent: true,
|
|
217
|
+
defaultExpandAll: true,
|
|
218
|
+
filterTreeNode: searchValue.trim() ? node => {
|
|
219
|
+
if (typeof filterSearch === 'function') {
|
|
220
|
+
// @ts-ignore
|
|
221
|
+
return filterSearch(searchValue, getFilterData(node));
|
|
222
|
+
}
|
|
223
|
+
return searchValueMatched(searchValue, node.title);
|
|
224
|
+
} : undefined
|
|
225
|
+
})));
|
|
226
|
+
}
|
|
227
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FilterSearch, {
|
|
228
|
+
filterSearch: filterSearch,
|
|
229
|
+
value: searchValue,
|
|
230
|
+
onChange: onSearch,
|
|
231
|
+
tablePrefixCls: tablePrefixCls,
|
|
232
|
+
locale: locale
|
|
233
|
+
}), isEmpty ? empty : /*#__PURE__*/React.createElement(Menu, {
|
|
234
|
+
selectable: true,
|
|
235
|
+
multiple: filterMultiple,
|
|
236
|
+
prefixCls: `${dropdownPrefixCls}-menu`,
|
|
237
|
+
className: dropdownMenuClass,
|
|
238
|
+
onSelect: onSelect,
|
|
239
|
+
onDeselect: onSelect,
|
|
240
|
+
selectedKeys: selectedKeys
|
|
241
|
+
// getPopupContainer={getPopupContainer}
|
|
242
|
+
,
|
|
243
|
+
openKeys: openKeys,
|
|
244
|
+
onOpenChange: onOpenChange,
|
|
245
|
+
items: items
|
|
246
|
+
}));
|
|
247
|
+
};
|
|
248
|
+
export default CheckboxFilter;
|
|
@@ -33,7 +33,7 @@ export const ColumnsGroup = props => {
|
|
|
33
33
|
return rsCol.map(it => ({
|
|
34
34
|
...it,
|
|
35
35
|
value: it.field,
|
|
36
|
-
label: t ? t(it
|
|
36
|
+
label: t ? t(it?.columnGroupText ?? it?.headerText) : it?.columnGroupText ?? it?.headerText
|
|
37
37
|
}));
|
|
38
38
|
}, [rsCol, t]);
|
|
39
39
|
|
|
@@ -136,7 +136,7 @@ export const ColumnsGroup = props => {
|
|
|
136
136
|
,
|
|
137
137
|
labelRender: labelProps => {
|
|
138
138
|
const it = columns.find(col => col.field === labelProps.value);
|
|
139
|
-
return t ? t(it
|
|
139
|
+
return t ? t(it?.columnGroupText ?? it?.headerText) : it?.columnGroupText ?? it?.headerText;
|
|
140
140
|
}
|
|
141
141
|
// hideSelectedOptions
|
|
142
142
|
})), /*#__PURE__*/React.createElement("div", {
|
|
@@ -165,7 +165,7 @@ export const ColumnsGroup = props => {
|
|
|
165
165
|
,
|
|
166
166
|
labelRender: labelProps => {
|
|
167
167
|
const it = columns.find(col => col.field === labelProps.value);
|
|
168
|
-
return t ? t(it
|
|
168
|
+
return t ? t(it?.columnGroupText ?? it?.headerText) : it?.columnGroupText ?? it?.headerText;
|
|
169
169
|
}
|
|
170
170
|
})), /*#__PURE__*/React.createElement("div", {
|
|
171
171
|
className: 'mb-1',
|
|
@@ -192,7 +192,7 @@ export const ColumnsGroup = props => {
|
|
|
192
192
|
,
|
|
193
193
|
labelRender: labelProps => {
|
|
194
194
|
const it = columns.find(col => col.field === labelProps.value);
|
|
195
|
-
return t ? t(it
|
|
195
|
+
return t ? t(it?.columnGroupText ?? it?.headerText) : it?.columnGroupText ?? it?.headerText;
|
|
196
196
|
}
|
|
197
197
|
}))), /*#__PURE__*/React.createElement(BoxAction, {
|
|
198
198
|
className: 'px-1'
|
|
@@ -125,7 +125,7 @@ const EditableCell = props => {
|
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
127
|
},
|
|
128
|
-
placeholder: column.placeholder,
|
|
128
|
+
placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
|
|
129
129
|
disabled: isDisable(column, record) ?? false,
|
|
130
130
|
maxDate: maxDate,
|
|
131
131
|
minDate: minDate
|
|
@@ -165,7 +165,7 @@ const EditableCell = props => {
|
|
|
165
165
|
},
|
|
166
166
|
showTime: true,
|
|
167
167
|
value: date,
|
|
168
|
-
placeholder: column.placeholder,
|
|
168
|
+
placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
|
|
169
169
|
disabled: isDisable(column, record) ?? false,
|
|
170
170
|
maxDate: maxDate,
|
|
171
171
|
minDate: minDate,
|
|
@@ -216,7 +216,7 @@ const EditableCell = props => {
|
|
|
216
216
|
height: '100%'
|
|
217
217
|
},
|
|
218
218
|
picker: editType,
|
|
219
|
-
placeholder: column.placeholder,
|
|
219
|
+
placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
|
|
220
220
|
disabled: isDisable(column, record) ?? false,
|
|
221
221
|
maxDate: maxDateValue1,
|
|
222
222
|
minDate: minDateValue1,
|
|
@@ -233,7 +233,7 @@ const EditableCell = props => {
|
|
|
233
233
|
height: '100%'
|
|
234
234
|
},
|
|
235
235
|
picker: editType,
|
|
236
|
-
placeholder: column.placeholder,
|
|
236
|
+
placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
|
|
237
237
|
disabled: isDisable(column, record) ?? false,
|
|
238
238
|
maxDate: maxWeekValue,
|
|
239
239
|
minDate: minWeekValue,
|
|
@@ -253,6 +253,7 @@ const EditableCell = props => {
|
|
|
253
253
|
format: timeFormat,
|
|
254
254
|
type: 'mask'
|
|
255
255
|
},
|
|
256
|
+
placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
|
|
256
257
|
maxDate: maxTime,
|
|
257
258
|
minDate: minTime,
|
|
258
259
|
disabled: isDisable(column, record) ?? false,
|
|
@@ -326,7 +327,7 @@ const EditableCell = props => {
|
|
|
326
327
|
defaultOpen: column.field === cellEditing?.column.field
|
|
327
328
|
// autoFocus={true}
|
|
328
329
|
,
|
|
329
|
-
placeholder: t ? t('Select') : 'Select',
|
|
330
|
+
placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
|
|
330
331
|
allowClear: column.isClearable ?? false,
|
|
331
332
|
maxTagCount: 'responsive',
|
|
332
333
|
rowKey: keySelect,
|
|
@@ -406,7 +407,7 @@ const EditableCell = props => {
|
|
|
406
407
|
width: '100%',
|
|
407
408
|
height: '100%'
|
|
408
409
|
},
|
|
409
|
-
placeholder: t ? t('Select') : 'Select',
|
|
410
|
+
placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
|
|
410
411
|
allowClear: column.isClearable ?? false,
|
|
411
412
|
maxTagCount: 'responsive',
|
|
412
413
|
popupMatchSelectWidth: menuWidth ? menuWidth + 10 : undefined,
|
|
@@ -460,7 +461,7 @@ const EditableCell = props => {
|
|
|
460
461
|
width: '100%',
|
|
461
462
|
height: '100%'
|
|
462
463
|
},
|
|
463
|
-
placeholder: t ? t('Select') : 'Select',
|
|
464
|
+
placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
|
|
464
465
|
allowClear: column.isClearable ?? false,
|
|
465
466
|
maxTagCount: 'responsive',
|
|
466
467
|
popupMatchSelectWidth: menuWidth ? menuWidth + 10 : undefined,
|
|
@@ -530,7 +531,7 @@ const EditableCell = props => {
|
|
|
530
531
|
overflow: 'auto'
|
|
531
532
|
},
|
|
532
533
|
treeData: newTreeData,
|
|
533
|
-
placeholder: t ? t('Select') : 'Select',
|
|
534
|
+
placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
|
|
534
535
|
treeDefaultExpandAll: true,
|
|
535
536
|
defaultOpen: column.field === cellEditing?.column.field
|
|
536
537
|
// autoFocus={true}
|
|
@@ -744,6 +745,7 @@ const EditableCell = props => {
|
|
|
744
745
|
customInput: Input
|
|
745
746
|
// valueIsNumericString={true}
|
|
746
747
|
,
|
|
748
|
+
placeholder: t ? t(column.placeholder ?? 'Enter') : column.placeholder ?? 'Enter',
|
|
747
749
|
autoComplete: 'off',
|
|
748
750
|
className: classNames('be-cell-editing rounded-0 input-element', {
|
|
749
751
|
'is-invalid': isInvalid,
|
|
@@ -787,6 +789,7 @@ const EditableCell = props => {
|
|
|
787
789
|
,
|
|
788
790
|
disabled: isDisable(column, record) ?? false,
|
|
789
791
|
className: classNames('be-cell-editing rounded-0 input-element'),
|
|
792
|
+
placeholder: t ? t(column.placeholder ?? 'Enter') : column.placeholder ?? 'Enter',
|
|
790
793
|
value: !isNullOrUndefined(value) ? value : '',
|
|
791
794
|
onBlur: () => {
|
|
792
795
|
const formState = getValues();
|
|
@@ -3,9 +3,14 @@ import React from 'react';
|
|
|
3
3
|
import { Resizable } from "react-resizable";
|
|
4
4
|
import 'react-resizable/css/styles.css';
|
|
5
5
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
6
|
-
import { addRowIdArray,
|
|
6
|
+
import { addRowIdArray,
|
|
7
|
+
// filterDataByColumns,
|
|
8
|
+
// filterDataByColumns2,
|
|
9
|
+
// filterDataByColumns3,
|
|
10
|
+
findItemByKey,
|
|
7
11
|
// convertFlatColumn,
|
|
8
12
|
removeColumns,
|
|
13
|
+
// removeFieldRecursive,
|
|
9
14
|
// addRowIdArray,
|
|
10
15
|
updateArrayByKey, updateColumnsByGroup, updateData } from "./hooks";
|
|
11
16
|
import dayjs from "dayjs";
|
|
@@ -65,7 +70,8 @@ const InternalTable = props => {
|
|
|
65
70
|
dataSource,
|
|
66
71
|
allowResizing,
|
|
67
72
|
dataSourceFilter: propDataSourceFilter,
|
|
68
|
-
onFilterClick,
|
|
73
|
+
// onFilterClick,
|
|
74
|
+
// onFilter,
|
|
69
75
|
editAble,
|
|
70
76
|
rowKey: propRowKey,
|
|
71
77
|
format,
|
|
@@ -94,8 +100,15 @@ const InternalTable = props => {
|
|
|
94
100
|
...local.lang
|
|
95
101
|
}
|
|
96
102
|
};
|
|
103
|
+
|
|
104
|
+
// const [filterStates, setFilterState] = React.useState<any>(null)
|
|
105
|
+
// const [isFilter, setIsFilter] = React.useState<boolean>(false);
|
|
106
|
+
|
|
97
107
|
const mergerdData = React.useMemo(() => {
|
|
108
|
+
// return filterDataByColumns2(addRowIdArray(dataSource), filterStates)
|
|
109
|
+
// return filterDataByColumns3(addRowIdArray(dataSource), filterStates)
|
|
98
110
|
return addRowIdArray(dataSource);
|
|
111
|
+
// return dataSource
|
|
99
112
|
}, [dataSource]);
|
|
100
113
|
const [columns, setColumns] = React.useState([]);
|
|
101
114
|
const tableRef = React.useRef(null);
|
|
@@ -127,9 +140,21 @@ const InternalTable = props => {
|
|
|
127
140
|
const newColumns = updateArrayByKey(columns, newColumn, 'field');
|
|
128
141
|
setColumns(newColumns);
|
|
129
142
|
};
|
|
143
|
+
|
|
144
|
+
// ============================ RowKey ============================
|
|
145
|
+
const getRowKey = React.useMemo(() => {
|
|
146
|
+
if (typeof rowKey === 'function') {
|
|
147
|
+
return rowKey;
|
|
148
|
+
}
|
|
149
|
+
// @ts-ignore
|
|
150
|
+
return record => record?.[rowKey];
|
|
151
|
+
}, [rowKey]);
|
|
130
152
|
const [transformSelectionColumns] = useColumns({
|
|
131
153
|
locale,
|
|
132
154
|
t,
|
|
155
|
+
rowKey,
|
|
156
|
+
// dataSource: mergerdData,
|
|
157
|
+
dataSource,
|
|
133
158
|
buddhistLocale,
|
|
134
159
|
dataSourceFilter: propDataSourceFilter,
|
|
135
160
|
format,
|
|
@@ -143,15 +168,6 @@ const InternalTable = props => {
|
|
|
143
168
|
return transformSelectionColumns(columns);
|
|
144
169
|
}, [columns, transformSelectionColumns]);
|
|
145
170
|
|
|
146
|
-
// ============================ RowKey ============================
|
|
147
|
-
const getRowKey = React.useMemo(() => {
|
|
148
|
-
if (typeof rowKey === 'function') {
|
|
149
|
-
return rowKey;
|
|
150
|
-
}
|
|
151
|
-
// @ts-ignore
|
|
152
|
-
return record => record?.[rowKey];
|
|
153
|
-
}, [rowKey]);
|
|
154
|
-
|
|
155
171
|
// const triggerChangeColumns = (newColumns: ColumnsTable<RecordType>) => {
|
|
156
172
|
const triggerChangeColumns = (newColumns, type) => {
|
|
157
173
|
setColumns(newColumns);
|
|
@@ -206,7 +222,22 @@ const InternalTable = props => {
|
|
|
206
222
|
// setData(newData)
|
|
207
223
|
// setMergedData(newData)
|
|
208
224
|
onDataChange?.(newData);
|
|
225
|
+
// onDataChange?.(removeFieldRecursive(newData, 'isFilterState'))
|
|
209
226
|
};
|
|
227
|
+
|
|
228
|
+
// const triggerFilter = (queries: any) => {
|
|
229
|
+
// console.log('queries', queries)
|
|
230
|
+
// // console.log('data', dataSource)
|
|
231
|
+
// setFilterState(queries)
|
|
232
|
+
//
|
|
233
|
+
// if (queries && queries.length > 0) {
|
|
234
|
+
// setIsFilter(true)
|
|
235
|
+
// } else {
|
|
236
|
+
// setIsFilter(false)
|
|
237
|
+
// }
|
|
238
|
+
//
|
|
239
|
+
// }
|
|
240
|
+
|
|
210
241
|
const triggerCommandClick = args => {
|
|
211
242
|
const {
|
|
212
243
|
id,
|
|
@@ -365,6 +396,7 @@ const InternalTable = props => {
|
|
|
365
396
|
locale: locale,
|
|
366
397
|
tableRef: tableRef,
|
|
367
398
|
dataSource: mergerdData
|
|
399
|
+
// dataSource={dataSource}
|
|
368
400
|
// components={components}
|
|
369
401
|
,
|
|
370
402
|
components: {
|
|
@@ -390,6 +422,10 @@ const InternalTable = props => {
|
|
|
390
422
|
groupAble: groupAble,
|
|
391
423
|
groupColumns: groupColumns,
|
|
392
424
|
commandClick: triggerCommandClick
|
|
425
|
+
// triggerFilter={triggerFilter}
|
|
426
|
+
// isFilter={isFilter}
|
|
427
|
+
// setIsFilter={setIsFilter}
|
|
428
|
+
// onScroll={onScroll}
|
|
393
429
|
}));
|
|
394
430
|
};
|
|
395
431
|
export default InternalTable;
|