es-grid-template 1.1.5-3 → 1.1.6
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/InternalTable.js +39 -24
- package/es/grid-component/TableGrid.d.ts +0 -1
- package/es/grid-component/TableGrid.js +53 -65
- package/es/grid-component/hooks/constant.js +14 -14
- package/es/grid-component/hooks/useColumns/index.js +4 -7
- package/es/grid-component/styles.scss +38 -18
- package/es/grid-component/table/Grid.d.ts +1 -4
- package/es/grid-component/table/Grid.js +6 -70
- package/es/grid-component/table/GridEdit.js +37 -22
- package/es/grid-component/type.d.ts +4 -4
- package/lib/grid-component/InternalTable.js +37 -22
- package/lib/grid-component/TableGrid.d.ts +0 -1
- package/lib/grid-component/TableGrid.js +53 -67
- package/lib/grid-component/hooks/constant.js +14 -14
- package/lib/grid-component/hooks/useColumns/index.js +4 -7
- package/lib/grid-component/styles.scss +38 -18
- package/lib/grid-component/table/Grid.d.ts +1 -4
- package/lib/grid-component/table/Grid.js +5 -69
- package/lib/grid-component/table/GridEdit.js +37 -22
- package/lib/grid-component/type.d.ts +4 -4
- package/package.json +1 -1
|
@@ -5,9 +5,9 @@ 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 {
|
|
8
|
+
import { numberOperator, translateOption, updateArrayByKey } from "./hooks";
|
|
9
9
|
import { FilterFill } from "becoxy-icons";
|
|
10
|
-
import { renderFilter } from "./hooks/useColumns";
|
|
10
|
+
import { renderContent, renderFilter } from "./hooks/useColumns";
|
|
11
11
|
import dayjs from "dayjs";
|
|
12
12
|
import 'dayjs/locale/es';
|
|
13
13
|
import 'dayjs/locale/vi';
|
|
@@ -56,6 +56,7 @@ const InternalTable = props => {
|
|
|
56
56
|
onFilterClick,
|
|
57
57
|
editAble,
|
|
58
58
|
rowKey,
|
|
59
|
+
format,
|
|
59
60
|
onDataChange,
|
|
60
61
|
sortMultiple,
|
|
61
62
|
...rest
|
|
@@ -115,27 +116,23 @@ const InternalTable = props => {
|
|
|
115
116
|
setSelectedKeys,
|
|
116
117
|
selectedKeys,
|
|
117
118
|
confirm,
|
|
118
|
-
|
|
119
|
+
close,
|
|
119
120
|
setOperatorKey,
|
|
120
121
|
operatorKey,
|
|
121
122
|
visible,
|
|
122
123
|
searchValue,
|
|
123
124
|
setSearchValue
|
|
124
125
|
}) => {
|
|
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;
|
|
129
126
|
return /*#__PURE__*/React.createElement("div", {
|
|
130
127
|
style: {
|
|
131
128
|
padding: 8,
|
|
132
129
|
minWidth: 275
|
|
133
130
|
},
|
|
134
131
|
onKeyDown: e => e.stopPropagation()
|
|
135
|
-
}, column?.showOperator !== false
|
|
132
|
+
}, (column?.showOperator !== false || column?.typeFilter !== 'DateRange' && column?.typeFilter !== 'NumberRange') && /*#__PURE__*/React.createElement("div", {
|
|
136
133
|
className: 'mb-1'
|
|
137
134
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
138
|
-
options: translateOption(
|
|
135
|
+
options: translateOption(numberOperator, t),
|
|
139
136
|
style: {
|
|
140
137
|
width: '100%',
|
|
141
138
|
marginBottom: 8
|
|
@@ -166,17 +163,13 @@ const InternalTable = props => {
|
|
|
166
163
|
style: {
|
|
167
164
|
width: 90
|
|
168
165
|
}
|
|
169
|
-
},
|
|
166
|
+
}, "Filter"), /*#__PURE__*/React.createElement(Button, {
|
|
170
167
|
type: "link",
|
|
171
168
|
size: "small",
|
|
172
169
|
onClick: () => {
|
|
173
|
-
|
|
174
|
-
setSelectedKeys([]);
|
|
175
|
-
confirm();
|
|
176
|
-
// handleSearch()
|
|
177
|
-
// close()
|
|
170
|
+
close();
|
|
178
171
|
}
|
|
179
|
-
},
|
|
172
|
+
}, "close")));
|
|
180
173
|
},
|
|
181
174
|
filterIcon: filtered => /*#__PURE__*/React.createElement(FilterFill, {
|
|
182
175
|
fontSize: 12,
|
|
@@ -194,7 +187,7 @@ const InternalTable = props => {
|
|
|
194
187
|
}
|
|
195
188
|
}
|
|
196
189
|
}
|
|
197
|
-
}), [
|
|
190
|
+
}), [onFilterCallback, onFilterClick, renderFilter, t]);
|
|
198
191
|
const handleResize = indexPath => (e, {
|
|
199
192
|
size
|
|
200
193
|
}) => {
|
|
@@ -248,7 +241,7 @@ const InternalTable = props => {
|
|
|
248
241
|
key: col.field ?? col.dataIndex ?? col.key,
|
|
249
242
|
title: t ? t(col.headerText ?? col.title) : col.headerText ?? col.title,
|
|
250
243
|
ellipsis: col.ellipsis !== false,
|
|
251
|
-
align: col.textAlign ?? col.align
|
|
244
|
+
align: col.textAlign ?? col.align,
|
|
252
245
|
fixed: col.frozen ? col.frozen.toLowerCase() : col.fixed
|
|
253
246
|
};
|
|
254
247
|
if (col.children) {
|
|
@@ -257,31 +250,52 @@ const InternalTable = props => {
|
|
|
257
250
|
children: transformColumns(col.children, currentPath)
|
|
258
251
|
};
|
|
259
252
|
}
|
|
260
|
-
|
|
253
|
+
|
|
254
|
+
// @ts-ignore
|
|
255
|
+
if (["index", "#"].includes(transformedColumn.dataIndex)) {
|
|
261
256
|
return {
|
|
262
|
-
...transformedColumn
|
|
257
|
+
...transformedColumn,
|
|
258
|
+
render: (_, __, rowIndex) => rowIndex + 1
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
if (col.field === 'command') {
|
|
262
|
+
return {
|
|
263
|
+
...transformedColumn,
|
|
264
|
+
onCell: () => ({
|
|
265
|
+
className: col.field === 'command' ? "ui-rc-cell-command" : ''
|
|
266
|
+
}),
|
|
267
|
+
onHeaderCell: () => ({
|
|
268
|
+
width: col.width,
|
|
269
|
+
onResize: handleResize(currentPath)
|
|
270
|
+
})
|
|
263
271
|
};
|
|
264
272
|
}
|
|
265
273
|
return {
|
|
266
|
-
...
|
|
274
|
+
...(col.allowFiltering === false ? {} : {
|
|
275
|
+
...getColumnSearchProps(col)
|
|
276
|
+
}),
|
|
267
277
|
...transformedColumn,
|
|
268
278
|
onFilter: value => {
|
|
269
279
|
return value;
|
|
270
280
|
},
|
|
271
|
-
sorter: {
|
|
281
|
+
sorter: col.sorter === false ? undefined : {
|
|
272
282
|
compare: a => a,
|
|
273
283
|
multiple: sortMultiple ? index : undefined
|
|
274
284
|
},
|
|
275
285
|
onHeaderCell: () => ({
|
|
276
286
|
width: col.width,
|
|
277
287
|
onResize: handleResize(currentPath)
|
|
278
|
-
})
|
|
288
|
+
}),
|
|
289
|
+
render: (value, record, rowIndex) => renderContent(col, value, record, rowIndex, format)
|
|
279
290
|
};
|
|
280
291
|
});
|
|
281
|
-
}, [getColumnSearchProps
|
|
292
|
+
}, [getColumnSearchProps]);
|
|
282
293
|
const mergedColumns = React.useMemo(() => {
|
|
283
294
|
return transformColumns(columns);
|
|
284
295
|
}, [transformColumns, columns]);
|
|
296
|
+
|
|
297
|
+
// console.log('mergedColumns', mergedColumns)
|
|
298
|
+
|
|
285
299
|
const triggerChangeColumns = newColumns => {
|
|
286
300
|
setColumns(newColumns);
|
|
287
301
|
};
|
|
@@ -300,6 +314,7 @@ const InternalTable = props => {
|
|
|
300
314
|
cell: allowResizing ? ResizableTitle : undefined
|
|
301
315
|
}
|
|
302
316
|
},
|
|
317
|
+
format: format,
|
|
303
318
|
columns: mergedColumns
|
|
304
319
|
// columns={columns}
|
|
305
320
|
,
|
|
@@ -6,7 +6,6 @@ type GridProps<T> = GridTableProps<T> & {
|
|
|
6
6
|
triggerChangeColumns?: (columns: ColumnsTable<T>, type: string) => void;
|
|
7
7
|
triggerChangeData?: () => void;
|
|
8
8
|
tableRef: any;
|
|
9
|
-
getRowKey: any;
|
|
10
9
|
};
|
|
11
10
|
declare const TableGrid: <RecordType extends object>(props: GridProps<RecordType>) => React.JSX.Element;
|
|
12
11
|
export default TableGrid;
|
|
@@ -2,12 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import React, { Fragment, useLayoutEffect, useRef } from 'react';
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
4
|
import { numericFormatter } from "react-numeric-component";
|
|
5
|
-
// import type {CheckboxProps} from "rc-master-ui";
|
|
6
5
|
import { Table, Toolbar } from "rc-master-ui";
|
|
7
|
-
// import { conductCheck } from 'rc-tree/lib/utils/conductUtil';
|
|
8
|
-
// import { devUseWarning } from '../../_util/warning';
|
|
9
|
-
// import { arrAdd, arrDel } from 'rc-tree/lib/util';
|
|
10
|
-
|
|
11
6
|
import 'dayjs/locale/es';
|
|
12
7
|
import 'dayjs/locale/vi';
|
|
13
8
|
import ContextMenu from "./ContextMenu";
|
|
@@ -20,15 +15,7 @@ import { flatColumns } from "./hooks/useColumns";
|
|
|
20
15
|
import Pagination from "rc-master-ui/es/pagination";
|
|
21
16
|
import ComponentSpinner from "./LoadingSpinner";
|
|
22
17
|
import { ColumnsChoose } from "./ColumnsChoose";
|
|
23
|
-
// import {useMergedState} from "rc-util";
|
|
24
18
|
import useMergedState from "rc-util/es/hooks/useMergedState";
|
|
25
|
-
// import {convertDataToEntities} from "rc-tree/lib/utils/treeUtil";
|
|
26
|
-
// import type {DataNode} from "rc-tree/lib/interface";
|
|
27
|
-
// import {devUseWarning} from "antd/es/_util/warning";
|
|
28
|
-
// import type {GetCheckDisabled} from "rc-tree/es/interface";
|
|
29
|
-
// import useLazyKVMap from "antd/es/table/hooks/useLazyKVMap";
|
|
30
|
-
// import useMultipleSelect from "rc-master-ui/es/_util/hooks/useMultipleSelect";
|
|
31
|
-
|
|
32
19
|
const convertFilters = filters => {
|
|
33
20
|
const result = [];
|
|
34
21
|
filters.forEach(({
|
|
@@ -96,21 +83,6 @@ const useStyle = createStyles(({
|
|
|
96
83
|
// type OnChange = NonNullable<TableProps<any>['onChange']>;
|
|
97
84
|
|
|
98
85
|
const EMPTY_LIST = [];
|
|
99
|
-
|
|
100
|
-
// const flattenData = <RecordType extends AnyObject = AnyObject>(
|
|
101
|
-
// childrenColumnName: keyof RecordType,
|
|
102
|
-
// data?: RecordType[],
|
|
103
|
-
// ): RecordType[] => {
|
|
104
|
-
// let list: RecordType[] = [];
|
|
105
|
-
// (data || []).forEach((record) => {
|
|
106
|
-
// list.push(record);
|
|
107
|
-
// if (record && typeof record === 'object' && childrenColumnName in record) {
|
|
108
|
-
// list = [...list, ...flattenData<RecordType>(childrenColumnName, record[childrenColumnName])];
|
|
109
|
-
// }
|
|
110
|
-
// });
|
|
111
|
-
// return list;
|
|
112
|
-
// };
|
|
113
|
-
|
|
114
86
|
const TableGrid = props => {
|
|
115
87
|
const {
|
|
116
88
|
columns,
|
|
@@ -133,7 +105,7 @@ const TableGrid = props => {
|
|
|
133
105
|
selectionSettings,
|
|
134
106
|
rowSelection,
|
|
135
107
|
rowSelected,
|
|
136
|
-
rowKey,
|
|
108
|
+
rowKey = 'id',
|
|
137
109
|
pagination,
|
|
138
110
|
scroll,
|
|
139
111
|
onFilterClick,
|
|
@@ -141,7 +113,7 @@ const TableGrid = props => {
|
|
|
141
113
|
loading,
|
|
142
114
|
triggerChangeColumns,
|
|
143
115
|
summary,
|
|
144
|
-
|
|
116
|
+
showToolbar,
|
|
145
117
|
onSorter,
|
|
146
118
|
...rest
|
|
147
119
|
} = props;
|
|
@@ -151,13 +123,11 @@ const TableGrid = props => {
|
|
|
151
123
|
const {
|
|
152
124
|
mode,
|
|
153
125
|
type,
|
|
154
|
-
|
|
126
|
+
checkboxOnly,
|
|
155
127
|
hideSelectAll,
|
|
156
128
|
columnWidth,
|
|
157
129
|
selectedRowKeys,
|
|
158
130
|
defaultSelectedRowKeys
|
|
159
|
-
// getCheckboxProps,
|
|
160
|
-
// checkStrictly = true
|
|
161
131
|
} = selectionSettings || {};
|
|
162
132
|
const clickRef = useRef(null);
|
|
163
133
|
const menuRef = useRef(null);
|
|
@@ -172,10 +142,15 @@ const TableGrid = props => {
|
|
|
172
142
|
viewportHeight
|
|
173
143
|
});
|
|
174
144
|
|
|
145
|
+
// const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>(defaultSelected);
|
|
146
|
+
|
|
175
147
|
// ========================= Keys =========================
|
|
176
148
|
const [mergedSelectedKeys, setMergedSelectedKeys] = useMergedState(selectedRowKeys || defaultSelectedRowKeys || EMPTY_LIST, {
|
|
177
149
|
value: selectedRowKeys
|
|
178
150
|
});
|
|
151
|
+
|
|
152
|
+
// Reset if rowSelection reset
|
|
153
|
+
|
|
179
154
|
React.useEffect(() => {
|
|
180
155
|
if (!selectionSettings) {
|
|
181
156
|
setMergedSelectedKeys(EMPTY_LIST);
|
|
@@ -248,6 +223,18 @@ const TableGrid = props => {
|
|
|
248
223
|
});
|
|
249
224
|
}
|
|
250
225
|
};
|
|
226
|
+
const handleRowClick = () => () => {
|
|
227
|
+
if (checkboxOnly !== true) {
|
|
228
|
+
if (type === 'single') {}
|
|
229
|
+
}
|
|
230
|
+
if (clickRef.current) return;
|
|
231
|
+
|
|
232
|
+
// @ts-ignore
|
|
233
|
+
clickRef.current = setTimeout(() => {
|
|
234
|
+
// console.log("Single Click:", record);
|
|
235
|
+
clickRef.current = null;
|
|
236
|
+
}, 250);
|
|
237
|
+
};
|
|
251
238
|
const handleRowDoubleClick = (record, index) => e => {
|
|
252
239
|
if (clickRef.current) {
|
|
253
240
|
clearTimeout(clickRef.current);
|
|
@@ -276,10 +263,9 @@ const TableGrid = props => {
|
|
|
276
263
|
rowData: selectedRow
|
|
277
264
|
});
|
|
278
265
|
} else {
|
|
279
|
-
// @ts-ignore
|
|
280
266
|
setMergedSelectedKeys(keys);
|
|
281
267
|
rowSelected?.({
|
|
282
|
-
selected:
|
|
268
|
+
selected: selectedRows,
|
|
283
269
|
type: 'rowSelected',
|
|
284
270
|
rowData: selectedRow
|
|
285
271
|
});
|
|
@@ -288,8 +274,6 @@ const TableGrid = props => {
|
|
|
288
274
|
};
|
|
289
275
|
const handleChange = sorter => {
|
|
290
276
|
onSorter?.(sorter);
|
|
291
|
-
// setFilteredInfo(filters);
|
|
292
|
-
// setSortedInfo(sorter as Sorts);
|
|
293
277
|
};
|
|
294
278
|
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(ConfigProvider, {
|
|
295
279
|
theme: {
|
|
@@ -319,7 +303,7 @@ const TableGrid = props => {
|
|
|
319
303
|
// className={styles.customTable}
|
|
320
304
|
,
|
|
321
305
|
className: classNames(className, {
|
|
322
|
-
'table-none-column-select': mode === undefined && type !== 'multiple'
|
|
306
|
+
'table-none-column-select': selectionSettings?.mode === undefined && selectionSettings?.type !== 'multiple'
|
|
323
307
|
}, styles.customTable),
|
|
324
308
|
bordered: true,
|
|
325
309
|
virtual: virtual,
|
|
@@ -333,18 +317,17 @@ const TableGrid = props => {
|
|
|
333
317
|
onRow: (data, index) => {
|
|
334
318
|
return {
|
|
335
319
|
onDoubleClick: handleRowDoubleClick(data, index),
|
|
336
|
-
// onClick: handleRowClick
|
|
320
|
+
// onClick: handleRowClick,
|
|
321
|
+
onClick: handleRowClick(),
|
|
337
322
|
onContextMenu: onContextMenu(data)
|
|
338
323
|
};
|
|
339
324
|
},
|
|
340
325
|
rowSelection: {
|
|
341
326
|
...selectionSettings,
|
|
342
|
-
type: mode === 'checkbox' || type === 'multiple' ? 'checkbox' : "radio",
|
|
327
|
+
type: selectionSettings?.mode === 'checkbox' || type === 'multiple' ? 'checkbox' : "radio",
|
|
343
328
|
columnWidth: !mode ? 0.0000001 : columnWidth ?? 50,
|
|
344
329
|
onChange: onSelectChange,
|
|
345
330
|
// selectedRowKeys: mode === 'checkbox' && type === 'single' ? selectedRowKeys : undefined,
|
|
346
|
-
// selectedRowKeys: mode === 'checkbox' && type === 'single' ? mergedSelectedKeys : undefined,
|
|
347
|
-
|
|
348
331
|
selectedRowKeys: mergedSelectedKeys,
|
|
349
332
|
defaultSelectedRowKeys: selectionSettings?.defaultSelectedRowKeys,
|
|
350
333
|
preserveSelectedRowKeys: true,
|
|
@@ -395,43 +378,48 @@ const TableGrid = props => {
|
|
|
395
378
|
onFilter?.(convertFilters(val));
|
|
396
379
|
},
|
|
397
380
|
onChange: (paging, filters, sorter) => handleChange(sorter),
|
|
398
|
-
title: () => {
|
|
399
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, title?.(dataSource)),
|
|
381
|
+
title: showToolbar === false ? undefined : () => {
|
|
382
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, title?.(dataSource)), /*#__PURE__*/React.createElement("div", {
|
|
400
383
|
style: {
|
|
401
384
|
display: 'flex',
|
|
402
|
-
justifyContent: 'space-between'
|
|
385
|
+
justifyContent: 'space-between',
|
|
386
|
+
alignItems: 'center'
|
|
403
387
|
}
|
|
404
|
-
}, /*#__PURE__*/React.createElement(Toolbar
|
|
388
|
+
}, toolbarItems && toolbarItems?.length > 0 && /*#__PURE__*/React.createElement(Toolbar
|
|
389
|
+
// @ts-ignore
|
|
390
|
+
, {
|
|
405
391
|
style: {
|
|
406
|
-
width: '100%
|
|
392
|
+
width: pagination && pagination.onChange && pagination?.position && pagination?.position[0] === 'topRight' ? `calc(100% - 650px` : `calc(100% - 50px`
|
|
407
393
|
},
|
|
408
394
|
items: toolbarItems ?? [],
|
|
409
|
-
mode: '
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
395
|
+
mode: 'scroll'
|
|
396
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
397
|
+
style: {
|
|
398
|
+
display: 'flex',
|
|
399
|
+
justifyContent: 'space-between',
|
|
400
|
+
alignItems: 'center'
|
|
401
|
+
}
|
|
402
|
+
}, pagination && pagination.onChange && pagination?.position && pagination?.position[0] === 'topRight' && /*#__PURE__*/React.createElement(Pagination, _extends({
|
|
403
|
+
showSizeChanger: true,
|
|
404
|
+
responsive: true,
|
|
405
|
+
size: 'small',
|
|
406
|
+
rootClassName: 'top-pagination'
|
|
407
|
+
// @ts-ignore
|
|
408
|
+
,
|
|
409
|
+
showTotal: (total, range) => `${range[0]}-${range[1]} / ${total} ${t ? t(pagination?.locale?.items ?? 'items') : 'items'}`
|
|
410
|
+
}, pagination)), showColumnChoose && /*#__PURE__*/React.createElement(ColumnsChoose, {
|
|
414
411
|
columns: columns,
|
|
415
412
|
t: t,
|
|
416
413
|
triggerChangeColumns: triggerChangeColumns
|
|
417
|
-
})
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
// rowClassName={(record) => (selectionSettings?.getCheckboxProps(record).disabled ? "row-disabled" : "")}
|
|
421
|
-
,
|
|
422
|
-
rowClassName: record => {
|
|
423
|
-
const originalOnCell = selectionSettings?.getCheckboxProps?.(record) || {};
|
|
424
|
-
return originalOnCell.disabled ? 'row-disabled' : '';
|
|
414
|
+
}))));
|
|
425
415
|
}
|
|
426
|
-
}, rest)), pagination && pagination.onChange && /*#__PURE__*/React.createElement(Pagination
|
|
416
|
+
}, rest)), pagination && pagination.onChange && !pagination.position && /*#__PURE__*/React.createElement(Pagination
|
|
427
417
|
// style={{padding: '0.75rem 1rem'}}
|
|
428
418
|
, _extends({
|
|
429
419
|
showSizeChanger: true,
|
|
430
420
|
responsive: true,
|
|
431
|
-
size: 'small'
|
|
432
|
-
|
|
433
|
-
,
|
|
434
|
-
showTotal: (total, range) => `${range[0]}-${range[1]} / ${total} ${t ? t(pagination?.locale?.items ?? 'items') : 'items'}`
|
|
421
|
+
size: 'small',
|
|
422
|
+
showTotal: (total, range) => `${range[0]}-${range[1]} / ${total} items`
|
|
435
423
|
}, pagination))));
|
|
436
424
|
};
|
|
437
425
|
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 = 'DD/MM/YYYY';
|
|
100
|
-
const find = dataSourceFilter?.find(it => it.key ===
|
|
99
|
+
const dateRangeFormat = getDatepickerFormat(column?.type, column) ?? 'DD/MM/YYYY';
|
|
100
|
+
const find = dataSourceFilter?.find(it => it.key === column?.key);
|
|
101
101
|
const options = find ? find.data : [];
|
|
102
102
|
switch (type) {
|
|
103
103
|
case 'Number':
|
|
@@ -182,8 +182,7 @@ export const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, vis
|
|
|
182
182
|
format: {
|
|
183
183
|
format: dateRangeFormat,
|
|
184
184
|
type: 'mask'
|
|
185
|
-
}
|
|
186
|
-
locale: buddhistLocale
|
|
185
|
+
}
|
|
187
186
|
// defaultValue={dateRangeValue}
|
|
188
187
|
,
|
|
189
188
|
value: dateRangeValue,
|
|
@@ -405,9 +404,7 @@ export const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, vis
|
|
|
405
404
|
showFilter: column.showFilterSearch,
|
|
406
405
|
selectedKeys: selectedKeys,
|
|
407
406
|
onSelect: setSelectedKeys,
|
|
408
|
-
options: options
|
|
409
|
-
// options={[]}
|
|
410
|
-
,
|
|
407
|
+
options: options,
|
|
411
408
|
filterMultiple: true,
|
|
412
409
|
open: visible,
|
|
413
410
|
searchValue: searchValue,
|
|
@@ -506,28 +506,48 @@ $boxShadowColor: rgba(5, 5, 5, 0.09) !default;
|
|
|
506
506
|
margin: 0;
|
|
507
507
|
}
|
|
508
508
|
|
|
509
|
+
.ui-rc-table-wrapper {
|
|
510
|
+
.ui-rc-table {
|
|
511
|
+
.#{$prefix}-pagination {
|
|
512
|
+
&::before {
|
|
513
|
+
content: "";
|
|
514
|
+
position: absolute;
|
|
515
|
+
border-left: 1px solid $tableBorderColor;
|
|
516
|
+
height: 55px;
|
|
517
|
+
bottom: 0;
|
|
518
|
+
left: 0;
|
|
519
|
+
}
|
|
509
520
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
521
|
+
&::after {
|
|
522
|
+
content: "";
|
|
523
|
+
position: absolute;
|
|
524
|
+
border-left: 1px solid $tableBorderColor;
|
|
525
|
+
height: 55px;
|
|
526
|
+
bottom: 0;
|
|
527
|
+
visibility: visible;
|
|
528
|
+
right: 0;
|
|
529
|
+
}
|
|
519
530
|
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
531
|
+
&.top-pagination {
|
|
532
|
+
border: none;
|
|
533
|
+
padding-top: 0;
|
|
534
|
+
padding-bottom: 0;
|
|
535
|
+
.ui-rc-pagination-total-text {
|
|
536
|
+
margin-left: auto;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
border-bottom: 1px solid $tableBorderColor;
|
|
540
|
+
|
|
541
|
+
}
|
|
528
542
|
}
|
|
543
|
+
}
|
|
544
|
+
|
|
529
545
|
|
|
530
|
-
|
|
546
|
+
.#{$prefix}-pagination {
|
|
547
|
+
|
|
548
|
+
.ui-rc-pagination-total-text {
|
|
549
|
+
white-space: nowrap;
|
|
550
|
+
}
|
|
531
551
|
|
|
532
552
|
.#{$prefix}-pagination-item-active {
|
|
533
553
|
border-color: $primary;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ColumnsTable } from "../type";
|
|
3
|
-
import type { GridTableProps } from "../type";
|
|
2
|
+
import type { ColumnsTable, GridTableProps } from "../type";
|
|
4
3
|
type Props<T> = GridTableProps<T> & {
|
|
5
|
-
setColumns?: any;
|
|
6
4
|
tableRef: any;
|
|
7
|
-
getRowKey: any;
|
|
8
5
|
triggerChangeColumns?: (columns: ColumnsTable<T>, type: string) => void;
|
|
9
6
|
};
|
|
10
7
|
declare const Grid: <RecordType extends object>(props: Props<RecordType>) => React.JSX.Element;
|