es-grid-template 0.1.2 → 0.1.3
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/es/grid-component/CheckboxFilter.d.ts +1 -0
- package/es/grid-component/CheckboxFilter.js +4 -3
- package/es/grid-component/ColumnsChoose.js +4 -4
- package/es/grid-component/InternalTable.js +25 -19
- package/es/grid-component/TableGrid.d.ts +1 -0
- package/es/grid-component/TableGrid.js +13 -13
- package/es/grid-component/hooks/constant.js +14 -14
- package/es/grid-component/hooks/useColumns/index.js +8 -4
- package/es/grid-component/styles.scss +10 -0
- package/es/grid-component/table/Grid.d.ts +1 -0
- package/es/grid-component/table/Grid.js +3 -1
- package/es/grid-component/table/GridEdit.js +2 -1
- package/es/grid-component/type.d.ts +3 -1
- package/lib/grid-component/CheckboxFilter.d.ts +1 -0
- package/lib/grid-component/CheckboxFilter.js +4 -3
- package/lib/grid-component/ColumnsChoose.js +4 -4
- package/lib/grid-component/InternalTable.js +24 -18
- package/lib/grid-component/TableGrid.d.ts +1 -0
- package/lib/grid-component/TableGrid.js +13 -13
- package/lib/grid-component/hooks/constant.js +14 -14
- package/lib/grid-component/hooks/useColumns/index.js +8 -4
- package/lib/grid-component/styles.scss +10 -0
- package/lib/grid-component/table/Grid.d.ts +1 -0
- package/lib/grid-component/table/Grid.js +3 -1
- package/lib/grid-component/table/GridEdit.js +2 -1
- package/lib/grid-component/type.d.ts +3 -1
- package/package.json +102 -102
|
@@ -72,6 +72,7 @@ const CheckboxFilter = props => {
|
|
|
72
72
|
filterMode = 'tree',
|
|
73
73
|
// open,
|
|
74
74
|
searchValue,
|
|
75
|
+
showFilter,
|
|
75
76
|
setSearchValue,
|
|
76
77
|
onSelect
|
|
77
78
|
} = props;
|
|
@@ -173,7 +174,7 @@ const CheckboxFilter = props => {
|
|
|
173
174
|
}
|
|
174
175
|
};
|
|
175
176
|
if (filterMode === 'tree') {
|
|
176
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FilterSearch, {
|
|
177
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, showFilter && /*#__PURE__*/React.createElement(FilterSearch, {
|
|
177
178
|
filterSearch: filterSearch,
|
|
178
179
|
value: searchValue,
|
|
179
180
|
onChange: onSearch,
|
|
@@ -181,7 +182,7 @@ const CheckboxFilter = props => {
|
|
|
181
182
|
locale: locale
|
|
182
183
|
}), /*#__PURE__*/React.createElement("div", {
|
|
183
184
|
className: `${tablePrefixCls}-filter-dropdown-tree`
|
|
184
|
-
}, filterMultiple ? /*#__PURE__*/React.createElement(Checkbox
|
|
185
|
+
}, filterMultiple && options.length > 0 ? /*#__PURE__*/React.createElement(Checkbox
|
|
185
186
|
// checked={selectedKeys.length === flattenKeys(column.filters).length}
|
|
186
187
|
, {
|
|
187
188
|
checked: selectedKeys.length === flattenKeys(options).length
|
|
@@ -194,7 +195,7 @@ const CheckboxFilter = props => {
|
|
|
194
195
|
indeterminate: selectedKeys.length > 0 && selectedKeys.length < flattenKeys(options).length,
|
|
195
196
|
className: `${tablePrefixCls}-filter-dropdown-checkall`,
|
|
196
197
|
onChange: onCheckAll
|
|
197
|
-
}, locale.filterCheckall) : null, /*#__PURE__*/React.createElement(Tree, {
|
|
198
|
+
}, locale.filterCheckall) : /*#__PURE__*/React.createElement(Empty, null), /*#__PURE__*/React.createElement(Tree, {
|
|
198
199
|
checkable: true,
|
|
199
200
|
selectable: false,
|
|
200
201
|
blockNode: true,
|
|
@@ -14,8 +14,8 @@ const BoxAction = styled.div.withConfig({
|
|
|
14
14
|
export const ColumnsChoose = props => {
|
|
15
15
|
const {
|
|
16
16
|
columns: propsColumns,
|
|
17
|
-
triggerChangeColumns
|
|
18
|
-
|
|
17
|
+
triggerChangeColumns,
|
|
18
|
+
t
|
|
19
19
|
} = props;
|
|
20
20
|
|
|
21
21
|
// const dataList: { key: React.Key; title: string }[] = [];
|
|
@@ -207,10 +207,10 @@ export const ColumnsChoose = props => {
|
|
|
207
207
|
, {
|
|
208
208
|
onClick: handleAccept
|
|
209
209
|
// disabled={!columns.find((item) => item.visible !== false || item.visible)}
|
|
210
|
-
}, 'OK'), /*#__PURE__*/React.createElement(Button, {
|
|
210
|
+
}, t ? t('OK') : 'OK'), /*#__PURE__*/React.createElement(Button, {
|
|
211
211
|
className: 'btn-action btn-action-cancel',
|
|
212
212
|
onClick: handleCancel
|
|
213
|
-
}, 'Cancel'))),
|
|
213
|
+
}, t ? t('Cancel') : 'Cancel'))),
|
|
214
214
|
trigger: "click",
|
|
215
215
|
open: clicked,
|
|
216
216
|
onOpenChange: handleClickChange,
|
|
@@ -5,7 +5,7 @@ import { Button, Space } from "antd";
|
|
|
5
5
|
import { SearchOutlined } from "@ant-design/icons";
|
|
6
6
|
import { Resizable } from "react-resizable";
|
|
7
7
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
8
|
-
import { numberOperator, translateOption, updateArrayByKey } from "./hooks";
|
|
8
|
+
import { booleanOperator, getTypeFilter, numberOperator, stringOperator, translateOption, updateArrayByKey } from "./hooks";
|
|
9
9
|
import { FilterFill } from "becoxy-icons";
|
|
10
10
|
import { renderFilter } from "./hooks/useColumns";
|
|
11
11
|
import dayjs from "dayjs";
|
|
@@ -57,6 +57,7 @@ const InternalTable = props => {
|
|
|
57
57
|
editAble,
|
|
58
58
|
rowKey,
|
|
59
59
|
onDataChange,
|
|
60
|
+
sortMultiple,
|
|
60
61
|
...rest
|
|
61
62
|
} = props;
|
|
62
63
|
const locale = lang && lang === 'en' ? en : vi;
|
|
@@ -114,23 +115,27 @@ const InternalTable = props => {
|
|
|
114
115
|
setSelectedKeys,
|
|
115
116
|
selectedKeys,
|
|
116
117
|
confirm,
|
|
117
|
-
close,
|
|
118
|
+
// close,
|
|
118
119
|
setOperatorKey,
|
|
119
120
|
operatorKey,
|
|
120
121
|
visible,
|
|
121
122
|
searchValue,
|
|
122
123
|
setSearchValue
|
|
123
124
|
}) => {
|
|
125
|
+
const type = getTypeFilter(column);
|
|
126
|
+
// const operatorOptions = !type || type === 'Text' ? stringOperator : numberOperator
|
|
127
|
+
// const operatorOptions = type === 'Checkbox' || type === 'Dropdown' || type === 'DropTree' || ty
|
|
128
|
+
const operatorOptions = type === ('Checkbox' || 'Dropdown' || 'DropTree' || 'CheckboxDropdown') ? booleanOperator : !type || type === 'Text' ? stringOperator : numberOperator;
|
|
124
129
|
return /*#__PURE__*/React.createElement("div", {
|
|
125
130
|
style: {
|
|
126
131
|
padding: 8,
|
|
127
132
|
minWidth: 275
|
|
128
133
|
},
|
|
129
134
|
onKeyDown: e => e.stopPropagation()
|
|
130
|
-
},
|
|
135
|
+
}, column?.showOperator !== false && column?.typeFilter !== 'DateRange' && column?.typeFilter !== 'NumberRange' && /*#__PURE__*/React.createElement("div", {
|
|
131
136
|
className: 'mb-1'
|
|
132
137
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
133
|
-
options: translateOption(
|
|
138
|
+
options: translateOption(operatorOptions, t),
|
|
134
139
|
style: {
|
|
135
140
|
width: '100%',
|
|
136
141
|
marginBottom: 8
|
|
@@ -161,13 +166,17 @@ const InternalTable = props => {
|
|
|
161
166
|
style: {
|
|
162
167
|
width: 90
|
|
163
168
|
}
|
|
164
|
-
},
|
|
169
|
+
}, t ? t('Filter') : 'Filter'), /*#__PURE__*/React.createElement(Button, {
|
|
165
170
|
type: "link",
|
|
166
171
|
size: "small",
|
|
167
172
|
onClick: () => {
|
|
168
|
-
|
|
173
|
+
// setSearchValue('')
|
|
174
|
+
setSelectedKeys([]);
|
|
175
|
+
confirm();
|
|
176
|
+
// handleSearch()
|
|
177
|
+
// close()
|
|
169
178
|
}
|
|
170
|
-
}, "
|
|
179
|
+
}, t ? t("Clear") : 'Clear')));
|
|
171
180
|
},
|
|
172
181
|
filterIcon: filtered => /*#__PURE__*/React.createElement(FilterFill, {
|
|
173
182
|
fontSize: 12,
|
|
@@ -185,7 +194,7 @@ const InternalTable = props => {
|
|
|
185
194
|
}
|
|
186
195
|
}
|
|
187
196
|
}
|
|
188
|
-
}), [onFilterCallback, onFilterClick,
|
|
197
|
+
}), [buddhistLocale, dataSourceFilter, onFilterCallback, onFilterClick, t]);
|
|
189
198
|
const handleResize = indexPath => (e, {
|
|
190
199
|
size
|
|
191
200
|
}) => {
|
|
@@ -248,7 +257,7 @@ const InternalTable = props => {
|
|
|
248
257
|
children: transformColumns(col.children, currentPath)
|
|
249
258
|
};
|
|
250
259
|
}
|
|
251
|
-
if (col.dataIndex === 'index' || col.field === 'index' || col.dataIndex === '#' || col.field === '#' || col.allowFiltering === false) {
|
|
260
|
+
if (col.dataIndex === 'index' || col.field === 'index' || col.dataIndex === '#' || col.field === '#' || col.allowFiltering === false || col.field === 'command') {
|
|
252
261
|
return {
|
|
253
262
|
...transformedColumn
|
|
254
263
|
};
|
|
@@ -256,15 +265,12 @@ const InternalTable = props => {
|
|
|
256
265
|
return {
|
|
257
266
|
...getColumnSearchProps(col),
|
|
258
267
|
...transformedColumn,
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
onFilter: (value, record) => {
|
|
266
|
-
// @ts-ignore
|
|
267
|
-
return record[col.field ?? col.dataIndex];
|
|
268
|
+
onFilter: value => {
|
|
269
|
+
return value;
|
|
270
|
+
},
|
|
271
|
+
sorter: {
|
|
272
|
+
compare: a => a,
|
|
273
|
+
multiple: sortMultiple ? index : undefined
|
|
268
274
|
},
|
|
269
275
|
onHeaderCell: () => ({
|
|
270
276
|
width: col.width,
|
|
@@ -272,7 +278,7 @@ const InternalTable = props => {
|
|
|
272
278
|
})
|
|
273
279
|
};
|
|
274
280
|
});
|
|
275
|
-
}, [getColumnSearchProps]);
|
|
281
|
+
}, [getColumnSearchProps, sortMultiple, t]);
|
|
276
282
|
const mergedColumns = React.useMemo(() => {
|
|
277
283
|
return transformColumns(columns);
|
|
278
284
|
}, [transformColumns, columns]);
|
|
@@ -6,6 +6,7 @@ type GridProps<T> = GridTableProps<T> & {
|
|
|
6
6
|
triggerChangeColumns?: () => void;
|
|
7
7
|
triggerChangeData?: () => void;
|
|
8
8
|
tableRef: any;
|
|
9
|
+
getRowKey: any;
|
|
9
10
|
};
|
|
10
11
|
declare const TableGrid: <RecordType extends object>(props: GridProps<RecordType>) => React.JSX.Element;
|
|
11
12
|
export default TableGrid;
|
|
@@ -108,7 +108,7 @@ const TableGrid = props => {
|
|
|
108
108
|
selectionSettings,
|
|
109
109
|
rowSelection,
|
|
110
110
|
rowSelected,
|
|
111
|
-
rowKey
|
|
111
|
+
rowKey,
|
|
112
112
|
pagination,
|
|
113
113
|
scroll,
|
|
114
114
|
onFilterClick,
|
|
@@ -116,6 +116,8 @@ const TableGrid = props => {
|
|
|
116
116
|
loading,
|
|
117
117
|
triggerChangeColumns,
|
|
118
118
|
summary,
|
|
119
|
+
getRowKey,
|
|
120
|
+
onSorter,
|
|
119
121
|
...rest
|
|
120
122
|
} = props;
|
|
121
123
|
const {
|
|
@@ -134,12 +136,6 @@ const TableGrid = props => {
|
|
|
134
136
|
const menuRef = useRef(null);
|
|
135
137
|
const viewportWidth = window.innerWidth;
|
|
136
138
|
const viewportHeight = window.innerHeight;
|
|
137
|
-
|
|
138
|
-
// const defaultSelected = useMemo(() => {
|
|
139
|
-
// return defaultSelectedRowKeys ?? []
|
|
140
|
-
//
|
|
141
|
-
// }, [defaultSelectedRowKeys])
|
|
142
|
-
|
|
143
139
|
const [menuVisible, setMenuVisible] = React.useState(false);
|
|
144
140
|
const [selectedRowData, setSelectedRowData] = React.useState(null);
|
|
145
141
|
const [position, setPosition] = React.useState({
|
|
@@ -159,6 +155,8 @@ const TableGrid = props => {
|
|
|
159
155
|
// },
|
|
160
156
|
// );
|
|
161
157
|
|
|
158
|
+
// console.log('mergedSelectedKeys', mergedSelectedKeys)
|
|
159
|
+
|
|
162
160
|
// Reset if rowSelection reset
|
|
163
161
|
|
|
164
162
|
// React.useEffect(() => {
|
|
@@ -235,11 +233,10 @@ const TableGrid = props => {
|
|
|
235
233
|
}
|
|
236
234
|
};
|
|
237
235
|
const handleRowClick = () => () => {
|
|
238
|
-
// console.log(data)
|
|
239
|
-
// console.log(index)
|
|
240
|
-
|
|
241
236
|
// const key = getRowKey(record, index);
|
|
242
237
|
|
|
238
|
+
// const keySet = new Set(derivedSelectedKeySet);
|
|
239
|
+
|
|
243
240
|
// console.log('key', key)
|
|
244
241
|
|
|
245
242
|
if (checkboxOnly !== true) {
|
|
@@ -293,7 +290,7 @@ const TableGrid = props => {
|
|
|
293
290
|
}
|
|
294
291
|
};
|
|
295
292
|
const handleChange = sorter => {
|
|
296
|
-
|
|
293
|
+
onSorter?.(sorter);
|
|
297
294
|
// setFilteredInfo(filters);
|
|
298
295
|
// setSortedInfo(sorter as Sorts);
|
|
299
296
|
};
|
|
@@ -415,6 +412,7 @@ const TableGrid = props => {
|
|
|
415
412
|
// }}
|
|
416
413
|
}), showColumnChoose && /*#__PURE__*/React.createElement(ColumnsChoose, {
|
|
417
414
|
columns: columns,
|
|
415
|
+
t: t,
|
|
418
416
|
triggerChangeColumns: triggerChangeColumns
|
|
419
417
|
}), /*#__PURE__*/React.createElement("div", null)));
|
|
420
418
|
}
|
|
@@ -423,8 +421,10 @@ const TableGrid = props => {
|
|
|
423
421
|
, _extends({
|
|
424
422
|
showSizeChanger: true,
|
|
425
423
|
responsive: true,
|
|
426
|
-
size: 'small'
|
|
427
|
-
|
|
424
|
+
size: 'small'
|
|
425
|
+
// @ts-ignore
|
|
426
|
+
,
|
|
427
|
+
showTotal: (total, range) => `${range[0]}-${range[1]} / ${total} ${t ? t(pagination?.locale?.items ?? 'items') : 'items'}`
|
|
428
428
|
}, pagination))));
|
|
429
429
|
};
|
|
430
430
|
export default TableGrid;
|
|
@@ -10,29 +10,29 @@ export const numberOperator = [{
|
|
|
10
10
|
key: '>'
|
|
11
11
|
}, {
|
|
12
12
|
value: 'greaterthanorequal',
|
|
13
|
-
label: 'Greater
|
|
13
|
+
label: 'Greater than or equal',
|
|
14
14
|
key: '>='
|
|
15
15
|
}, {
|
|
16
16
|
value: 'lessthan',
|
|
17
|
-
label: 'Less
|
|
17
|
+
label: 'Less than',
|
|
18
18
|
key: '<'
|
|
19
19
|
}, {
|
|
20
20
|
value: 'lessthanorequal',
|
|
21
|
-
label: 'Less
|
|
21
|
+
label: 'Less than or equal',
|
|
22
22
|
key: '<='
|
|
23
23
|
}, {
|
|
24
24
|
value: 'notequal',
|
|
25
|
-
label: 'Not
|
|
25
|
+
label: 'Not equal',
|
|
26
26
|
key: '!='
|
|
27
27
|
}];
|
|
28
28
|
export const stringOperator = [{
|
|
29
29
|
value: 'startswith',
|
|
30
30
|
key: '_=',
|
|
31
|
-
label: 'Starts
|
|
31
|
+
label: 'Starts with'
|
|
32
32
|
}, {
|
|
33
33
|
value: 'endswith',
|
|
34
34
|
key: '|=',
|
|
35
|
-
label: 'Ends
|
|
35
|
+
label: 'Ends with'
|
|
36
36
|
}, {
|
|
37
37
|
value: 'contains',
|
|
38
38
|
key: '~=',
|
|
@@ -44,7 +44,7 @@ export const stringOperator = [{
|
|
|
44
44
|
}, {
|
|
45
45
|
value: 'notequal',
|
|
46
46
|
key: '!=',
|
|
47
|
-
label: 'Not
|
|
47
|
+
label: 'Not equal'
|
|
48
48
|
}];
|
|
49
49
|
export const dateOperator = [{
|
|
50
50
|
value: 'equal',
|
|
@@ -53,15 +53,15 @@ export const dateOperator = [{
|
|
|
53
53
|
}, {
|
|
54
54
|
value: 'notequal',
|
|
55
55
|
key: '!=',
|
|
56
|
-
label: 'Not
|
|
56
|
+
label: 'Not equal'
|
|
57
57
|
}, {
|
|
58
58
|
value: 'greaterthan',
|
|
59
59
|
key: '>',
|
|
60
|
-
label: 'Greater
|
|
60
|
+
label: 'Greater than'
|
|
61
61
|
}, {
|
|
62
62
|
value: 'lessthan',
|
|
63
63
|
key: '<',
|
|
64
|
-
label: 'Less
|
|
64
|
+
label: 'Less than'
|
|
65
65
|
}];
|
|
66
66
|
export const dateTimeOperator = [{
|
|
67
67
|
value: 'equal',
|
|
@@ -70,15 +70,15 @@ export const dateTimeOperator = [{
|
|
|
70
70
|
}, {
|
|
71
71
|
value: 'notequal',
|
|
72
72
|
key: '!=',
|
|
73
|
-
label: 'Not
|
|
73
|
+
label: 'Not equal'
|
|
74
74
|
}, {
|
|
75
75
|
value: 'greaterthan',
|
|
76
76
|
key: '>',
|
|
77
|
-
label: 'Greater
|
|
77
|
+
label: 'Greater than'
|
|
78
78
|
}, {
|
|
79
79
|
value: 'lessthan',
|
|
80
80
|
key: '<',
|
|
81
|
-
label: 'Less
|
|
81
|
+
label: 'Less than'
|
|
82
82
|
}];
|
|
83
83
|
export const booleanOperator = [{
|
|
84
84
|
value: 'equal',
|
|
@@ -87,7 +87,7 @@ export const booleanOperator = [{
|
|
|
87
87
|
}, {
|
|
88
88
|
value: 'notequal',
|
|
89
89
|
key: '!=',
|
|
90
|
-
label: 'Not
|
|
90
|
+
label: 'Not equal'
|
|
91
91
|
}];
|
|
92
92
|
export const translateOption = (options, t) => {
|
|
93
93
|
if (!t) {
|
|
@@ -96,8 +96,8 @@ export const renderContent = (column, value, record, index, format) => {
|
|
|
96
96
|
export const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, visible, searchValue, setSearchValue, dataSourceFilter, buddhistLocale) => {
|
|
97
97
|
const type = getTypeFilter(column);
|
|
98
98
|
const dateFormat = getDatepickerFormat(column?.typeFilter ?? column?.type, column) ?? 'DD/MM/YYYY';
|
|
99
|
-
const dateRangeFormat =
|
|
100
|
-
const find = dataSourceFilter?.find(it => it.key === column?.
|
|
99
|
+
const dateRangeFormat = 'DD/MM/YYYY';
|
|
100
|
+
const find = dataSourceFilter?.find(it => it.key === (column?.field || column.dataIndex));
|
|
101
101
|
const options = find ? find.data : [];
|
|
102
102
|
switch (type) {
|
|
103
103
|
case 'Number':
|
|
@@ -182,7 +182,8 @@ export const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, vis
|
|
|
182
182
|
format: {
|
|
183
183
|
format: dateRangeFormat,
|
|
184
184
|
type: 'mask'
|
|
185
|
-
}
|
|
185
|
+
},
|
|
186
|
+
locale: buddhistLocale
|
|
186
187
|
// defaultValue={dateRangeValue}
|
|
187
188
|
,
|
|
188
189
|
value: dateRangeValue,
|
|
@@ -401,9 +402,12 @@ export const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, vis
|
|
|
401
402
|
filterTitle: 'Chọn tất cả',
|
|
402
403
|
filterCheckall: 'Chọn tất cả'
|
|
403
404
|
},
|
|
405
|
+
showFilter: column.showFilterSearch,
|
|
404
406
|
selectedKeys: selectedKeys,
|
|
405
407
|
onSelect: setSelectedKeys,
|
|
406
|
-
options: options
|
|
408
|
+
options: options
|
|
409
|
+
// options={[]}
|
|
410
|
+
,
|
|
407
411
|
filterMultiple: true,
|
|
408
412
|
open: visible,
|
|
409
413
|
searchValue: searchValue,
|
|
@@ -83,6 +83,16 @@ $rowSelectedHoverBg: 'ui-rc' !default;
|
|
|
83
83
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
+
.ui-rc-table-placeholder {
|
|
87
|
+
.ui-rc-table-cell {
|
|
88
|
+
padding-top: 0 !important;
|
|
89
|
+
padding-bottom: 0 !important;
|
|
90
|
+
.ui-rc-table-expanded-row-fixed {
|
|
91
|
+
margin-top: 0 !important;
|
|
92
|
+
margin-bottom: 0 !important;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
86
96
|
}
|
|
87
97
|
|
|
88
98
|
.#{$prefix}-table-thead {
|
|
@@ -13,6 +13,7 @@ const Grid = props => {
|
|
|
13
13
|
components,
|
|
14
14
|
style,
|
|
15
15
|
format,
|
|
16
|
+
getRowKey,
|
|
16
17
|
...rest
|
|
17
18
|
} = props;
|
|
18
19
|
const transformColumns = React.useCallback(cols => {
|
|
@@ -81,7 +82,8 @@ const Grid = props => {
|
|
|
81
82
|
style: {
|
|
82
83
|
...style,
|
|
83
84
|
minHeight: height
|
|
84
|
-
}
|
|
85
|
+
},
|
|
86
|
+
getRowKey: getRowKey
|
|
85
87
|
}))));
|
|
86
88
|
};
|
|
87
89
|
export default Grid;
|
|
@@ -91,6 +91,7 @@ export type ColumnType<RecordType> = Omit<RcColumnType<RecordType>, 'headerTempl
|
|
|
91
91
|
placeholder?: string;
|
|
92
92
|
showInColumnChoose?: boolean;
|
|
93
93
|
typeFilter?: TypeFilter;
|
|
94
|
+
showFilterSearch?: boolean;
|
|
94
95
|
headerText?: string;
|
|
95
96
|
textAlign?: ITextAlign;
|
|
96
97
|
frozen?: Frozen;
|
|
@@ -120,6 +121,7 @@ export type ColumnTable<RecordType = AnyObject> = ColumnEditType<RecordType> | C
|
|
|
120
121
|
export type ColumnsTable<RecordType = AnyObject> = (ColumnType<RecordType> | ColumnEditType<RecordType>)[];
|
|
121
122
|
export interface TableProps<RecordType> extends Omit<RcTableProps<RecordType>, 'columns' | 'rowSelection' | 'loading' | 'dataSource' | 'summary'> {
|
|
122
123
|
editAble?: boolean;
|
|
124
|
+
sortMultiple?: boolean;
|
|
123
125
|
dataSource: RecordType[];
|
|
124
126
|
columns: ColumnsTable<RecordType>;
|
|
125
127
|
height?: number;
|
|
@@ -174,7 +176,7 @@ export interface CommandItem {
|
|
|
174
176
|
title: string;
|
|
175
177
|
color?: 'blue' | 'purple' | 'cyan' | 'green' | 'magenta' | 'pink' | 'red' | 'orange' | 'yellow' | 'volcano' | 'geekblue' | 'lime' | 'gold';
|
|
176
178
|
tooltip?: string;
|
|
177
|
-
icon?:
|
|
179
|
+
icon?: any;
|
|
178
180
|
template?: ReactNode | ReactElement | (() => ReactNode | ReactElement);
|
|
179
181
|
client?: boolean;
|
|
180
182
|
confirmDialog?: boolean;
|
|
@@ -81,6 +81,7 @@ const CheckboxFilter = props => {
|
|
|
81
81
|
filterMode = 'tree',
|
|
82
82
|
// open,
|
|
83
83
|
searchValue,
|
|
84
|
+
showFilter,
|
|
84
85
|
setSearchValue,
|
|
85
86
|
onSelect
|
|
86
87
|
} = props;
|
|
@@ -182,7 +183,7 @@ const CheckboxFilter = props => {
|
|
|
182
183
|
}
|
|
183
184
|
};
|
|
184
185
|
if (filterMode === 'tree') {
|
|
185
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_FilterSearch.default, {
|
|
186
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, showFilter && /*#__PURE__*/React.createElement(_FilterSearch.default, {
|
|
186
187
|
filterSearch: filterSearch,
|
|
187
188
|
value: searchValue,
|
|
188
189
|
onChange: onSearch,
|
|
@@ -190,7 +191,7 @@ const CheckboxFilter = props => {
|
|
|
190
191
|
locale: locale
|
|
191
192
|
}), /*#__PURE__*/React.createElement("div", {
|
|
192
193
|
className: `${tablePrefixCls}-filter-dropdown-tree`
|
|
193
|
-
}, filterMultiple ? /*#__PURE__*/React.createElement(_rcMasterUi.Checkbox
|
|
194
|
+
}, filterMultiple && options.length > 0 ? /*#__PURE__*/React.createElement(_rcMasterUi.Checkbox
|
|
194
195
|
// checked={selectedKeys.length === flattenKeys(column.filters).length}
|
|
195
196
|
, {
|
|
196
197
|
checked: selectedKeys.length === (0, _useFilter.flattenKeys)(options).length
|
|
@@ -203,7 +204,7 @@ const CheckboxFilter = props => {
|
|
|
203
204
|
indeterminate: selectedKeys.length > 0 && selectedKeys.length < (0, _useFilter.flattenKeys)(options).length,
|
|
204
205
|
className: `${tablePrefixCls}-filter-dropdown-checkall`,
|
|
205
206
|
onChange: onCheckAll
|
|
206
|
-
}, locale.filterCheckall) : null, /*#__PURE__*/React.createElement(_antd.Tree, {
|
|
207
|
+
}, locale.filterCheckall) : /*#__PURE__*/React.createElement(_rcMasterUi.Empty, null), /*#__PURE__*/React.createElement(_antd.Tree, {
|
|
207
208
|
checkable: true,
|
|
208
209
|
selectable: false,
|
|
209
210
|
blockNode: true,
|
|
@@ -23,8 +23,8 @@ const BoxAction = _styledComponents.default.div.withConfig({
|
|
|
23
23
|
const ColumnsChoose = props => {
|
|
24
24
|
const {
|
|
25
25
|
columns: propsColumns,
|
|
26
|
-
triggerChangeColumns
|
|
27
|
-
|
|
26
|
+
triggerChangeColumns,
|
|
27
|
+
t
|
|
28
28
|
} = props;
|
|
29
29
|
|
|
30
30
|
// const dataList: { key: React.Key; title: string }[] = [];
|
|
@@ -216,10 +216,10 @@ const ColumnsChoose = props => {
|
|
|
216
216
|
, {
|
|
217
217
|
onClick: handleAccept
|
|
218
218
|
// disabled={!columns.find((item) => item.visible !== false || item.visible)}
|
|
219
|
-
}, 'OK'), /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
219
|
+
}, t ? t('OK') : 'OK'), /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
220
220
|
className: 'btn-action btn-action-cancel',
|
|
221
221
|
onClick: handleCancel
|
|
222
|
-
}, 'Cancel'))),
|
|
222
|
+
}, t ? t('Cancel') : 'Cancel'))),
|
|
223
223
|
trigger: "click",
|
|
224
224
|
open: clicked,
|
|
225
225
|
onOpenChange: handleClickChange,
|
|
@@ -66,6 +66,7 @@ const InternalTable = props => {
|
|
|
66
66
|
editAble,
|
|
67
67
|
rowKey,
|
|
68
68
|
onDataChange,
|
|
69
|
+
sortMultiple,
|
|
69
70
|
...rest
|
|
70
71
|
} = props;
|
|
71
72
|
const locale = lang && lang === 'en' ? _en_US.default : _vi_VN.default;
|
|
@@ -123,23 +124,27 @@ const InternalTable = props => {
|
|
|
123
124
|
setSelectedKeys,
|
|
124
125
|
selectedKeys,
|
|
125
126
|
confirm,
|
|
126
|
-
close,
|
|
127
|
+
// close,
|
|
127
128
|
setOperatorKey,
|
|
128
129
|
operatorKey,
|
|
129
130
|
visible,
|
|
130
131
|
searchValue,
|
|
131
132
|
setSearchValue
|
|
132
133
|
}) => {
|
|
134
|
+
const type = (0, _hooks.getTypeFilter)(column);
|
|
135
|
+
// const operatorOptions = !type || type === 'Text' ? stringOperator : numberOperator
|
|
136
|
+
// const operatorOptions = type === 'Checkbox' || type === 'Dropdown' || type === 'DropTree' || ty
|
|
137
|
+
const operatorOptions = type === ('Checkbox' || 'Dropdown' || 'DropTree' || 'CheckboxDropdown') ? _hooks.booleanOperator : !type || type === 'Text' ? _hooks.stringOperator : _hooks.numberOperator;
|
|
133
138
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
134
139
|
style: {
|
|
135
140
|
padding: 8,
|
|
136
141
|
minWidth: 275
|
|
137
142
|
},
|
|
138
143
|
onKeyDown: e => e.stopPropagation()
|
|
139
|
-
},
|
|
144
|
+
}, column?.showOperator !== false && column?.typeFilter !== 'DateRange' && column?.typeFilter !== 'NumberRange' && /*#__PURE__*/_react.default.createElement("div", {
|
|
140
145
|
className: 'mb-1'
|
|
141
146
|
}, /*#__PURE__*/_react.default.createElement(_rcMasterUi.Select, {
|
|
142
|
-
options: (0, _hooks.translateOption)(
|
|
147
|
+
options: (0, _hooks.translateOption)(operatorOptions, t),
|
|
143
148
|
style: {
|
|
144
149
|
width: '100%',
|
|
145
150
|
marginBottom: 8
|
|
@@ -170,13 +175,17 @@ const InternalTable = props => {
|
|
|
170
175
|
style: {
|
|
171
176
|
width: 90
|
|
172
177
|
}
|
|
173
|
-
},
|
|
178
|
+
}, t ? t('Filter') : 'Filter'), /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
174
179
|
type: "link",
|
|
175
180
|
size: "small",
|
|
176
181
|
onClick: () => {
|
|
177
|
-
|
|
182
|
+
// setSearchValue('')
|
|
183
|
+
setSelectedKeys([]);
|
|
184
|
+
confirm();
|
|
185
|
+
// handleSearch()
|
|
186
|
+
// close()
|
|
178
187
|
}
|
|
179
|
-
}, "
|
|
188
|
+
}, t ? t("Clear") : 'Clear')));
|
|
180
189
|
},
|
|
181
190
|
filterIcon: filtered => /*#__PURE__*/_react.default.createElement(_becoxyIcons.FilterFill, {
|
|
182
191
|
fontSize: 12,
|
|
@@ -194,7 +203,7 @@ const InternalTable = props => {
|
|
|
194
203
|
}
|
|
195
204
|
}
|
|
196
205
|
}
|
|
197
|
-
}), [onFilterCallback, onFilterClick,
|
|
206
|
+
}), [buddhistLocale, dataSourceFilter, onFilterCallback, onFilterClick, t]);
|
|
198
207
|
const handleResize = indexPath => (e, {
|
|
199
208
|
size
|
|
200
209
|
}) => {
|
|
@@ -257,7 +266,7 @@ const InternalTable = props => {
|
|
|
257
266
|
children: transformColumns(col.children, currentPath)
|
|
258
267
|
};
|
|
259
268
|
}
|
|
260
|
-
if (col.dataIndex === 'index' || col.field === 'index' || col.dataIndex === '#' || col.field === '#' || col.allowFiltering === false) {
|
|
269
|
+
if (col.dataIndex === 'index' || col.field === 'index' || col.dataIndex === '#' || col.field === '#' || col.allowFiltering === false || col.field === 'command') {
|
|
261
270
|
return {
|
|
262
271
|
...transformedColumn
|
|
263
272
|
};
|
|
@@ -265,15 +274,12 @@ const InternalTable = props => {
|
|
|
265
274
|
return {
|
|
266
275
|
...getColumnSearchProps(col),
|
|
267
276
|
...transformedColumn,
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
onFilter: (value, record) => {
|
|
275
|
-
// @ts-ignore
|
|
276
|
-
return record[col.field ?? col.dataIndex];
|
|
277
|
+
onFilter: value => {
|
|
278
|
+
return value;
|
|
279
|
+
},
|
|
280
|
+
sorter: {
|
|
281
|
+
compare: a => a,
|
|
282
|
+
multiple: sortMultiple ? index : undefined
|
|
277
283
|
},
|
|
278
284
|
onHeaderCell: () => ({
|
|
279
285
|
width: col.width,
|
|
@@ -281,7 +287,7 @@ const InternalTable = props => {
|
|
|
281
287
|
})
|
|
282
288
|
};
|
|
283
289
|
});
|
|
284
|
-
}, [getColumnSearchProps]);
|
|
290
|
+
}, [getColumnSearchProps, sortMultiple, t]);
|
|
285
291
|
const mergedColumns = _react.default.useMemo(() => {
|
|
286
292
|
return transformColumns(columns);
|
|
287
293
|
}, [transformColumns, columns]);
|
|
@@ -6,6 +6,7 @@ type GridProps<T> = GridTableProps<T> & {
|
|
|
6
6
|
triggerChangeColumns?: () => void;
|
|
7
7
|
triggerChangeData?: () => void;
|
|
8
8
|
tableRef: any;
|
|
9
|
+
getRowKey: any;
|
|
9
10
|
};
|
|
10
11
|
declare const TableGrid: <RecordType extends object>(props: GridProps<RecordType>) => React.JSX.Element;
|
|
11
12
|
export default TableGrid;
|
|
@@ -115,7 +115,7 @@ const TableGrid = props => {
|
|
|
115
115
|
selectionSettings,
|
|
116
116
|
rowSelection,
|
|
117
117
|
rowSelected,
|
|
118
|
-
rowKey
|
|
118
|
+
rowKey,
|
|
119
119
|
pagination,
|
|
120
120
|
scroll,
|
|
121
121
|
onFilterClick,
|
|
@@ -123,6 +123,8 @@ const TableGrid = props => {
|
|
|
123
123
|
loading,
|
|
124
124
|
triggerChangeColumns,
|
|
125
125
|
summary,
|
|
126
|
+
getRowKey,
|
|
127
|
+
onSorter,
|
|
126
128
|
...rest
|
|
127
129
|
} = props;
|
|
128
130
|
const {
|
|
@@ -141,12 +143,6 @@ const TableGrid = props => {
|
|
|
141
143
|
const menuRef = (0, _react.useRef)(null);
|
|
142
144
|
const viewportWidth = window.innerWidth;
|
|
143
145
|
const viewportHeight = window.innerHeight;
|
|
144
|
-
|
|
145
|
-
// const defaultSelected = useMemo(() => {
|
|
146
|
-
// return defaultSelectedRowKeys ?? []
|
|
147
|
-
//
|
|
148
|
-
// }, [defaultSelectedRowKeys])
|
|
149
|
-
|
|
150
146
|
const [menuVisible, setMenuVisible] = _react.default.useState(false);
|
|
151
147
|
const [selectedRowData, setSelectedRowData] = _react.default.useState(null);
|
|
152
148
|
const [position, setPosition] = _react.default.useState({
|
|
@@ -166,6 +162,8 @@ const TableGrid = props => {
|
|
|
166
162
|
// },
|
|
167
163
|
// );
|
|
168
164
|
|
|
165
|
+
// console.log('mergedSelectedKeys', mergedSelectedKeys)
|
|
166
|
+
|
|
169
167
|
// Reset if rowSelection reset
|
|
170
168
|
|
|
171
169
|
// React.useEffect(() => {
|
|
@@ -242,11 +240,10 @@ const TableGrid = props => {
|
|
|
242
240
|
}
|
|
243
241
|
};
|
|
244
242
|
const handleRowClick = () => () => {
|
|
245
|
-
// console.log(data)
|
|
246
|
-
// console.log(index)
|
|
247
|
-
|
|
248
243
|
// const key = getRowKey(record, index);
|
|
249
244
|
|
|
245
|
+
// const keySet = new Set(derivedSelectedKeySet);
|
|
246
|
+
|
|
250
247
|
// console.log('key', key)
|
|
251
248
|
|
|
252
249
|
if (checkboxOnly !== true) {
|
|
@@ -300,7 +297,7 @@ const TableGrid = props => {
|
|
|
300
297
|
}
|
|
301
298
|
};
|
|
302
299
|
const handleChange = sorter => {
|
|
303
|
-
|
|
300
|
+
onSorter?.(sorter);
|
|
304
301
|
// setFilteredInfo(filters);
|
|
305
302
|
// setSortedInfo(sorter as Sorts);
|
|
306
303
|
};
|
|
@@ -422,6 +419,7 @@ const TableGrid = props => {
|
|
|
422
419
|
// }}
|
|
423
420
|
}), showColumnChoose && /*#__PURE__*/_react.default.createElement(_ColumnsChoose.ColumnsChoose, {
|
|
424
421
|
columns: columns,
|
|
422
|
+
t: t,
|
|
425
423
|
triggerChangeColumns: triggerChangeColumns
|
|
426
424
|
}), /*#__PURE__*/_react.default.createElement("div", null)));
|
|
427
425
|
}
|
|
@@ -430,8 +428,10 @@ const TableGrid = props => {
|
|
|
430
428
|
, (0, _extends2.default)({
|
|
431
429
|
showSizeChanger: true,
|
|
432
430
|
responsive: true,
|
|
433
|
-
size: 'small'
|
|
434
|
-
|
|
431
|
+
size: 'small'
|
|
432
|
+
// @ts-ignore
|
|
433
|
+
,
|
|
434
|
+
showTotal: (total, range) => `${range[0]}-${range[1]} / ${total} ${t ? t(pagination?.locale?.items ?? 'items') : 'items'}`
|
|
435
435
|
}, pagination))));
|
|
436
436
|
};
|
|
437
437
|
var _default = exports.default = TableGrid;
|
|
@@ -16,29 +16,29 @@ const numberOperator = exports.numberOperator = [{
|
|
|
16
16
|
key: '>'
|
|
17
17
|
}, {
|
|
18
18
|
value: 'greaterthanorequal',
|
|
19
|
-
label: 'Greater
|
|
19
|
+
label: 'Greater than or equal',
|
|
20
20
|
key: '>='
|
|
21
21
|
}, {
|
|
22
22
|
value: 'lessthan',
|
|
23
|
-
label: 'Less
|
|
23
|
+
label: 'Less than',
|
|
24
24
|
key: '<'
|
|
25
25
|
}, {
|
|
26
26
|
value: 'lessthanorequal',
|
|
27
|
-
label: 'Less
|
|
27
|
+
label: 'Less than or equal',
|
|
28
28
|
key: '<='
|
|
29
29
|
}, {
|
|
30
30
|
value: 'notequal',
|
|
31
|
-
label: 'Not
|
|
31
|
+
label: 'Not equal',
|
|
32
32
|
key: '!='
|
|
33
33
|
}];
|
|
34
34
|
const stringOperator = exports.stringOperator = [{
|
|
35
35
|
value: 'startswith',
|
|
36
36
|
key: '_=',
|
|
37
|
-
label: 'Starts
|
|
37
|
+
label: 'Starts with'
|
|
38
38
|
}, {
|
|
39
39
|
value: 'endswith',
|
|
40
40
|
key: '|=',
|
|
41
|
-
label: 'Ends
|
|
41
|
+
label: 'Ends with'
|
|
42
42
|
}, {
|
|
43
43
|
value: 'contains',
|
|
44
44
|
key: '~=',
|
|
@@ -50,7 +50,7 @@ const stringOperator = exports.stringOperator = [{
|
|
|
50
50
|
}, {
|
|
51
51
|
value: 'notequal',
|
|
52
52
|
key: '!=',
|
|
53
|
-
label: 'Not
|
|
53
|
+
label: 'Not equal'
|
|
54
54
|
}];
|
|
55
55
|
const dateOperator = exports.dateOperator = [{
|
|
56
56
|
value: 'equal',
|
|
@@ -59,15 +59,15 @@ const dateOperator = exports.dateOperator = [{
|
|
|
59
59
|
}, {
|
|
60
60
|
value: 'notequal',
|
|
61
61
|
key: '!=',
|
|
62
|
-
label: 'Not
|
|
62
|
+
label: 'Not equal'
|
|
63
63
|
}, {
|
|
64
64
|
value: 'greaterthan',
|
|
65
65
|
key: '>',
|
|
66
|
-
label: 'Greater
|
|
66
|
+
label: 'Greater than'
|
|
67
67
|
}, {
|
|
68
68
|
value: 'lessthan',
|
|
69
69
|
key: '<',
|
|
70
|
-
label: 'Less
|
|
70
|
+
label: 'Less than'
|
|
71
71
|
}];
|
|
72
72
|
const dateTimeOperator = exports.dateTimeOperator = [{
|
|
73
73
|
value: 'equal',
|
|
@@ -76,15 +76,15 @@ const dateTimeOperator = exports.dateTimeOperator = [{
|
|
|
76
76
|
}, {
|
|
77
77
|
value: 'notequal',
|
|
78
78
|
key: '!=',
|
|
79
|
-
label: 'Not
|
|
79
|
+
label: 'Not equal'
|
|
80
80
|
}, {
|
|
81
81
|
value: 'greaterthan',
|
|
82
82
|
key: '>',
|
|
83
|
-
label: 'Greater
|
|
83
|
+
label: 'Greater than'
|
|
84
84
|
}, {
|
|
85
85
|
value: 'lessthan',
|
|
86
86
|
key: '<',
|
|
87
|
-
label: 'Less
|
|
87
|
+
label: 'Less than'
|
|
88
88
|
}];
|
|
89
89
|
const booleanOperator = exports.booleanOperator = [{
|
|
90
90
|
value: 'equal',
|
|
@@ -93,7 +93,7 @@ const booleanOperator = exports.booleanOperator = [{
|
|
|
93
93
|
}, {
|
|
94
94
|
value: 'notequal',
|
|
95
95
|
key: '!=',
|
|
96
|
-
label: 'Not
|
|
96
|
+
label: 'Not equal'
|
|
97
97
|
}];
|
|
98
98
|
const translateOption = (options, t) => {
|
|
99
99
|
if (!t) {
|
|
@@ -108,8 +108,8 @@ exports.renderContent = renderContent;
|
|
|
108
108
|
const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, visible, searchValue, setSearchValue, dataSourceFilter, buddhistLocale) => {
|
|
109
109
|
const type = (0, _utils.getTypeFilter)(column);
|
|
110
110
|
const dateFormat = (0, _utils.getDatepickerFormat)(column?.typeFilter ?? column?.type, column) ?? 'DD/MM/YYYY';
|
|
111
|
-
const dateRangeFormat =
|
|
112
|
-
const find = dataSourceFilter?.find(it => it.key === column?.
|
|
111
|
+
const dateRangeFormat = 'DD/MM/YYYY';
|
|
112
|
+
const find = dataSourceFilter?.find(it => it.key === (column?.field || column.dataIndex));
|
|
113
113
|
const options = find ? find.data : [];
|
|
114
114
|
switch (type) {
|
|
115
115
|
case 'Number':
|
|
@@ -194,7 +194,8 @@ const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, visible, s
|
|
|
194
194
|
format: {
|
|
195
195
|
format: dateRangeFormat,
|
|
196
196
|
type: 'mask'
|
|
197
|
-
}
|
|
197
|
+
},
|
|
198
|
+
locale: buddhistLocale
|
|
198
199
|
// defaultValue={dateRangeValue}
|
|
199
200
|
,
|
|
200
201
|
value: dateRangeValue,
|
|
@@ -413,9 +414,12 @@ const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, visible, s
|
|
|
413
414
|
filterTitle: 'Chọn tất cả',
|
|
414
415
|
filterCheckall: 'Chọn tất cả'
|
|
415
416
|
},
|
|
417
|
+
showFilter: column.showFilterSearch,
|
|
416
418
|
selectedKeys: selectedKeys,
|
|
417
419
|
onSelect: setSelectedKeys,
|
|
418
|
-
options: options
|
|
420
|
+
options: options
|
|
421
|
+
// options={[]}
|
|
422
|
+
,
|
|
419
423
|
filterMultiple: true,
|
|
420
424
|
open: visible,
|
|
421
425
|
searchValue: searchValue,
|
|
@@ -83,6 +83,16 @@ $rowSelectedHoverBg: 'ui-rc' !default;
|
|
|
83
83
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
+
.ui-rc-table-placeholder {
|
|
87
|
+
.ui-rc-table-cell {
|
|
88
|
+
padding-top: 0 !important;
|
|
89
|
+
padding-bottom: 0 !important;
|
|
90
|
+
.ui-rc-table-expanded-row-fixed {
|
|
91
|
+
margin-top: 0 !important;
|
|
92
|
+
margin-bottom: 0 !important;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
86
96
|
}
|
|
87
97
|
|
|
88
98
|
.#{$prefix}-table-thead {
|
|
@@ -22,6 +22,7 @@ const Grid = props => {
|
|
|
22
22
|
components,
|
|
23
23
|
style,
|
|
24
24
|
format,
|
|
25
|
+
getRowKey,
|
|
25
26
|
...rest
|
|
26
27
|
} = props;
|
|
27
28
|
const transformColumns = _react.default.useCallback(cols => {
|
|
@@ -90,7 +91,8 @@ const Grid = props => {
|
|
|
90
91
|
style: {
|
|
91
92
|
...style,
|
|
92
93
|
minHeight: height
|
|
93
|
-
}
|
|
94
|
+
},
|
|
95
|
+
getRowKey: getRowKey
|
|
94
96
|
}))));
|
|
95
97
|
};
|
|
96
98
|
var _default = exports.default = Grid;
|
|
@@ -792,7 +792,8 @@ const GridEdit = props => {
|
|
|
792
792
|
...style,
|
|
793
793
|
minHeight: height
|
|
794
794
|
},
|
|
795
|
-
rowHoverable: false
|
|
795
|
+
rowHoverable: false,
|
|
796
|
+
getRowKey: getRowKey
|
|
796
797
|
}))))), /*#__PURE__*/_react.default.createElement(_reactHotToast.Toaster, {
|
|
797
798
|
position: toast,
|
|
798
799
|
toastOptions: {
|
|
@@ -91,6 +91,7 @@ export type ColumnType<RecordType> = Omit<RcColumnType<RecordType>, 'headerTempl
|
|
|
91
91
|
placeholder?: string;
|
|
92
92
|
showInColumnChoose?: boolean;
|
|
93
93
|
typeFilter?: TypeFilter;
|
|
94
|
+
showFilterSearch?: boolean;
|
|
94
95
|
headerText?: string;
|
|
95
96
|
textAlign?: ITextAlign;
|
|
96
97
|
frozen?: Frozen;
|
|
@@ -120,6 +121,7 @@ export type ColumnTable<RecordType = AnyObject> = ColumnEditType<RecordType> | C
|
|
|
120
121
|
export type ColumnsTable<RecordType = AnyObject> = (ColumnType<RecordType> | ColumnEditType<RecordType>)[];
|
|
121
122
|
export interface TableProps<RecordType> extends Omit<RcTableProps<RecordType>, 'columns' | 'rowSelection' | 'loading' | 'dataSource' | 'summary'> {
|
|
122
123
|
editAble?: boolean;
|
|
124
|
+
sortMultiple?: boolean;
|
|
123
125
|
dataSource: RecordType[];
|
|
124
126
|
columns: ColumnsTable<RecordType>;
|
|
125
127
|
height?: number;
|
|
@@ -174,7 +176,7 @@ export interface CommandItem {
|
|
|
174
176
|
title: string;
|
|
175
177
|
color?: 'blue' | 'purple' | 'cyan' | 'green' | 'magenta' | 'pink' | 'red' | 'orange' | 'yellow' | 'volcano' | 'geekblue' | 'lime' | 'gold';
|
|
176
178
|
tooltip?: string;
|
|
177
|
-
icon?:
|
|
179
|
+
icon?: any;
|
|
178
180
|
template?: ReactNode | ReactElement | (() => ReactNode | ReactElement);
|
|
179
181
|
client?: boolean;
|
|
180
182
|
confirmDialog?: boolean;
|
package/package.json
CHANGED
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "es-grid-template",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "es-grid-template",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"react",
|
|
7
|
-
"react-component",
|
|
8
|
-
"grid",
|
|
9
|
-
"table"
|
|
10
|
-
],
|
|
11
|
-
"license": "MIT",
|
|
12
|
-
"main": "lib/index",
|
|
13
|
-
"module": "es/index",
|
|
14
|
-
"files": [
|
|
15
|
-
"lib",
|
|
16
|
-
"es",
|
|
17
|
-
"assets/*.css",
|
|
18
|
-
"assets/*.less"
|
|
19
|
-
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"compile": "father build",
|
|
22
|
-
"docs:build": "dumi build",
|
|
23
|
-
"__docs:deploy": "gh-pages -d dist",
|
|
24
|
-
"lint": "eslint src/ --ext .tsx,.ts,.jsx,.js",
|
|
25
|
-
"now-build": "npm run docs:build",
|
|
26
|
-
"prepare": "dumi setup",
|
|
27
|
-
"prepublishOnly": "npm run compile",
|
|
28
|
-
"postpublish": "npm run docs:build",
|
|
29
|
-
"__postpublish": "npm run docs:build && npm run docs:deploy",
|
|
30
|
-
"start": "dumi dev",
|
|
31
|
-
"test": "vitest --watch false",
|
|
32
|
-
"coverage": "vitest run --coverage"
|
|
33
|
-
},
|
|
34
|
-
"dependencies": {
|
|
35
|
-
"@ant-design/colors": "^8.0.0",
|
|
36
|
-
"@ant-design/cssinjs": "^1.22.0",
|
|
37
|
-
"@ant-design/cssinjs-utils": "^1.1.1",
|
|
38
|
-
"@ant-design/icons": "^5.5.2",
|
|
39
|
-
"@babel/runtime": "^7.11.2",
|
|
40
|
-
"@core-rc/rc-select": "^0.0.8",
|
|
41
|
-
"@ctrl/tinycolor": "^3.6.1",
|
|
42
|
-
"@faker-js/faker": "^9.5.0",
|
|
43
|
-
"@floating-ui/react": "^0.27.5",
|
|
44
|
-
"@rc-component/color-picker": "^2.0.1",
|
|
45
|
-
"@rc-component/father-plugin": "^2.0.1",
|
|
46
|
-
"@rc-component/trigger": "^2.0.0",
|
|
47
|
-
"@rc-component/util": "^1.0.1",
|
|
48
|
-
"@types/react-resizable": "^3.0.8",
|
|
49
|
-
"@types/styled-components": "^5.1.34",
|
|
50
|
-
"@vitest/coverage-v8": "^2.0.5",
|
|
51
|
-
"antd": "^5.24.1",
|
|
52
|
-
"antd-style": "^3.7.1",
|
|
53
|
-
"becoxy-icons": "^1.9.9",
|
|
54
|
-
"classnames": "^2.3.1",
|
|
55
|
-
"dayjs": "^1.11.13",
|
|
56
|
-
"lodash": "^4.17.21",
|
|
57
|
-
"moment": "^2.30.1",
|
|
58
|
-
"postcss": "^8.4.35",
|
|
59
|
-
"rc-checkbox": "^3.5.0",
|
|
60
|
-
"rc-dropdown": "^4.2.1",
|
|
61
|
-
"rc-field-form": "^2.6.0",
|
|
62
|
-
"rc-master-ui": "^1.1.
|
|
63
|
-
"rc-select": "^14.16.3",
|
|
64
|
-
"rc-tooltip": "^6.3.0",
|
|
65
|
-
"rc-tree": "^5.10.1",
|
|
66
|
-
"rc-tree-select": "^5.24.5",
|
|
67
|
-
"react-hook-form": "^7.54.2",
|
|
68
|
-
"react-hot-toast": "^2.5.2",
|
|
69
|
-
"react-numeric-component": "^1.0.7",
|
|
70
|
-
"react-resizable": "^3.0.5",
|
|
71
|
-
"sass": "^1.81.0",
|
|
72
|
-
"styled-components": "^6.1.15",
|
|
73
|
-
"throttle-debounce": "^5.0.2",
|
|
74
|
-
"vitest": "^2.0.5"
|
|
75
|
-
},
|
|
76
|
-
"devDependencies": {
|
|
77
|
-
"@babel/cli": "^7.26.4",
|
|
78
|
-
"@babel/preset-env": "^7.26.9",
|
|
79
|
-
"@rc-component/np": "^1.0.3",
|
|
80
|
-
"@testing-library/react": "^14.0.0",
|
|
81
|
-
"@types/jest": "^29.4.0",
|
|
82
|
-
"@types/react": "^18.0.26",
|
|
83
|
-
"@types/react-dom": "^18.0.10",
|
|
84
|
-
"@types/warning": "^3.0.0",
|
|
85
|
-
"cross-env": "^7.0.0",
|
|
86
|
-
"dumi": "^2.2.13",
|
|
87
|
-
"eslint": "^8.56.0",
|
|
88
|
-
"eslint-plugin-unicorn": "^55.0.0",
|
|
89
|
-
"father": "^4.0.0",
|
|
90
|
-
"gh-pages": "^3.1.0",
|
|
91
|
-
"less": "^4.1.1",
|
|
92
|
-
"np": "^7.1.0",
|
|
93
|
-
"rc-test": "^7.0.9",
|
|
94
|
-
"react": "^18.2.0",
|
|
95
|
-
"react-dom": "^18.2.0",
|
|
96
|
-
"typescript": "^4.0.5"
|
|
97
|
-
},
|
|
98
|
-
"peerDependencies": {
|
|
99
|
-
"react": ">=16.9.0",
|
|
100
|
-
"react-dom": ">=16.9.0"
|
|
101
|
-
}
|
|
102
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "es-grid-template",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "es-grid-template",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react",
|
|
7
|
+
"react-component",
|
|
8
|
+
"grid",
|
|
9
|
+
"table"
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"main": "lib/index",
|
|
13
|
+
"module": "es/index",
|
|
14
|
+
"files": [
|
|
15
|
+
"lib",
|
|
16
|
+
"es",
|
|
17
|
+
"assets/*.css",
|
|
18
|
+
"assets/*.less"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"compile": "father build",
|
|
22
|
+
"docs:build": "dumi build",
|
|
23
|
+
"__docs:deploy": "gh-pages -d dist",
|
|
24
|
+
"lint": "eslint src/ --ext .tsx,.ts,.jsx,.js",
|
|
25
|
+
"now-build": "npm run docs:build",
|
|
26
|
+
"prepare": "dumi setup",
|
|
27
|
+
"prepublishOnly": "npm run compile",
|
|
28
|
+
"postpublish": "npm run docs:build",
|
|
29
|
+
"__postpublish": "npm run docs:build && npm run docs:deploy",
|
|
30
|
+
"start": "dumi dev",
|
|
31
|
+
"test": "vitest --watch false",
|
|
32
|
+
"coverage": "vitest run --coverage"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@ant-design/colors": "^8.0.0",
|
|
36
|
+
"@ant-design/cssinjs": "^1.22.0",
|
|
37
|
+
"@ant-design/cssinjs-utils": "^1.1.1",
|
|
38
|
+
"@ant-design/icons": "^5.5.2",
|
|
39
|
+
"@babel/runtime": "^7.11.2",
|
|
40
|
+
"@core-rc/rc-select": "^0.0.8",
|
|
41
|
+
"@ctrl/tinycolor": "^3.6.1",
|
|
42
|
+
"@faker-js/faker": "^9.5.0",
|
|
43
|
+
"@floating-ui/react": "^0.27.5",
|
|
44
|
+
"@rc-component/color-picker": "^2.0.1",
|
|
45
|
+
"@rc-component/father-plugin": "^2.0.1",
|
|
46
|
+
"@rc-component/trigger": "^2.0.0",
|
|
47
|
+
"@rc-component/util": "^1.0.1",
|
|
48
|
+
"@types/react-resizable": "^3.0.8",
|
|
49
|
+
"@types/styled-components": "^5.1.34",
|
|
50
|
+
"@vitest/coverage-v8": "^2.0.5",
|
|
51
|
+
"antd": "^5.24.1",
|
|
52
|
+
"antd-style": "^3.7.1",
|
|
53
|
+
"becoxy-icons": "^1.9.9",
|
|
54
|
+
"classnames": "^2.3.1",
|
|
55
|
+
"dayjs": "^1.11.13",
|
|
56
|
+
"lodash": "^4.17.21",
|
|
57
|
+
"moment": "^2.30.1",
|
|
58
|
+
"postcss": "^8.4.35",
|
|
59
|
+
"rc-checkbox": "^3.5.0",
|
|
60
|
+
"rc-dropdown": "^4.2.1",
|
|
61
|
+
"rc-field-form": "^2.6.0",
|
|
62
|
+
"rc-master-ui": "^1.1.10-0",
|
|
63
|
+
"rc-select": "^14.16.3",
|
|
64
|
+
"rc-tooltip": "^6.3.0",
|
|
65
|
+
"rc-tree": "^5.10.1",
|
|
66
|
+
"rc-tree-select": "^5.24.5",
|
|
67
|
+
"react-hook-form": "^7.54.2",
|
|
68
|
+
"react-hot-toast": "^2.5.2",
|
|
69
|
+
"react-numeric-component": "^1.0.7",
|
|
70
|
+
"react-resizable": "^3.0.5",
|
|
71
|
+
"sass": "^1.81.0",
|
|
72
|
+
"styled-components": "^6.1.15",
|
|
73
|
+
"throttle-debounce": "^5.0.2",
|
|
74
|
+
"vitest": "^2.0.5"
|
|
75
|
+
},
|
|
76
|
+
"devDependencies": {
|
|
77
|
+
"@babel/cli": "^7.26.4",
|
|
78
|
+
"@babel/preset-env": "^7.26.9",
|
|
79
|
+
"@rc-component/np": "^1.0.3",
|
|
80
|
+
"@testing-library/react": "^14.0.0",
|
|
81
|
+
"@types/jest": "^29.4.0",
|
|
82
|
+
"@types/react": "^18.0.26",
|
|
83
|
+
"@types/react-dom": "^18.0.10",
|
|
84
|
+
"@types/warning": "^3.0.0",
|
|
85
|
+
"cross-env": "^7.0.0",
|
|
86
|
+
"dumi": "^2.2.13",
|
|
87
|
+
"eslint": "^8.56.0",
|
|
88
|
+
"eslint-plugin-unicorn": "^55.0.0",
|
|
89
|
+
"father": "^4.0.0",
|
|
90
|
+
"gh-pages": "^3.1.0",
|
|
91
|
+
"less": "^4.1.1",
|
|
92
|
+
"np": "^7.1.0",
|
|
93
|
+
"rc-test": "^7.0.9",
|
|
94
|
+
"react": "^18.2.0",
|
|
95
|
+
"react-dom": "^18.2.0",
|
|
96
|
+
"typescript": "^4.0.5"
|
|
97
|
+
},
|
|
98
|
+
"peerDependencies": {
|
|
99
|
+
"react": ">=16.9.0",
|
|
100
|
+
"react-dom": ">=16.9.0"
|
|
101
|
+
}
|
|
102
|
+
}
|