es-grid-template 1.1.6 → 1.1.7
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 -1
- package/es/grid-component/CheckboxFilter.js +2 -2
- package/es/grid-component/ContextMenu.js +1 -3
- package/es/grid-component/FilterSearch.d.ts +1 -1
- package/es/grid-component/FilterSearch.js +1 -1
- package/es/grid-component/InternalTable.js +49 -11
- package/es/grid-component/TableGrid.js +56 -5
- package/es/grid-component/hooks/useColumns/index.d.ts +2 -1
- package/es/grid-component/hooks/useColumns/index.js +17 -12
- package/es/grid-component/hooks/utils.d.ts +3 -1
- package/es/grid-component/hooks/utils.js +12 -1
- package/es/grid-component/styles.scss +701 -671
- package/es/grid-component/table/GridEdit.js +2 -4
- package/es/grid-component/type.d.ts +2 -2
- package/lib/grid-component/CheckboxFilter.d.ts +1 -1
- package/lib/grid-component/CheckboxFilter.js +2 -2
- package/lib/grid-component/ContextMenu.js +1 -3
- package/lib/grid-component/FilterSearch.d.ts +1 -1
- package/lib/grid-component/FilterSearch.js +1 -1
- package/lib/grid-component/InternalTable.js +46 -10
- package/lib/grid-component/TableGrid.js +55 -4
- package/lib/grid-component/hooks/useColumns/index.d.ts +2 -1
- package/lib/grid-component/hooks/useColumns/index.js +16 -11
- package/lib/grid-component/hooks/utils.d.ts +3 -1
- package/lib/grid-component/hooks/utils.js +15 -2
- package/lib/grid-component/styles.scss +701 -671
- package/lib/grid-component/table/GridEdit.js +2 -4
- package/lib/grid-component/type.d.ts +2 -2
- package/package.json +2 -2
|
@@ -106,7 +106,7 @@ const CheckboxFilter = props => {
|
|
|
106
106
|
});
|
|
107
107
|
const empty = /*#__PURE__*/React.createElement(Empty, {
|
|
108
108
|
image: Empty.PRESENTED_IMAGE_SIMPLE,
|
|
109
|
-
description: locale
|
|
109
|
+
description: locale?.filterEmptyText,
|
|
110
110
|
imageStyle: {
|
|
111
111
|
height: 24
|
|
112
112
|
},
|
|
@@ -193,7 +193,7 @@ const CheckboxFilter = props => {
|
|
|
193
193
|
indeterminate: selectedKeys.length > 0 && selectedKeys.length < flattenKeys(options).length,
|
|
194
194
|
className: `${tablePrefixCls}-filter-dropdown-checkall`,
|
|
195
195
|
onChange: onCheckAll
|
|
196
|
-
}, locale
|
|
196
|
+
}, locale?.filterCheckall) : /*#__PURE__*/React.createElement(Empty, null), /*#__PURE__*/React.createElement(Tree, {
|
|
197
197
|
checkable: true,
|
|
198
198
|
selectable: false,
|
|
199
199
|
blockNode: true,
|
|
@@ -94,9 +94,7 @@ const ContextMenu = props => {
|
|
|
94
94
|
items: contextMenuItems,
|
|
95
95
|
style: {
|
|
96
96
|
minWidth: 200,
|
|
97
|
-
|
|
98
|
-
maxHeight: pos.viewportHeight - 20,
|
|
99
|
-
width: 200
|
|
97
|
+
maxHeight: pos.viewportHeight - 20
|
|
100
98
|
},
|
|
101
99
|
rootClassName: 'popup-context-menu',
|
|
102
100
|
onClick: e => {
|
|
@@ -6,7 +6,7 @@ interface FilterSearchProps<RecordType = AnyObject> {
|
|
|
6
6
|
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
7
7
|
filterSearch: FilterSearchType<RecordType>;
|
|
8
8
|
tablePrefixCls: string;
|
|
9
|
-
locale
|
|
9
|
+
locale?: TableLocale;
|
|
10
10
|
}
|
|
11
11
|
declare const FilterSearch: <RecordType extends AnyObject = AnyObject>(props: FilterSearchProps<RecordType>) => React.JSX.Element;
|
|
12
12
|
export default FilterSearch;
|
|
@@ -20,7 +20,7 @@ const FilterSearch = props => {
|
|
|
20
20
|
}
|
|
21
21
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
22
22
|
suffix: /*#__PURE__*/React.createElement(SearchOutlined, null),
|
|
23
|
-
placeholder: locale
|
|
23
|
+
placeholder: locale?.filterSearchPlaceholder,
|
|
24
24
|
onChange: onChange,
|
|
25
25
|
value: value,
|
|
26
26
|
autoFocus: true
|
|
@@ -5,7 +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 {
|
|
9
|
+
// findAllChildrenKeys,
|
|
10
|
+
numberOperator, translateOption, updateArrayByKey } from "./hooks";
|
|
9
11
|
import { FilterFill } from "becoxy-icons";
|
|
10
12
|
import { renderContent, renderFilter } from "./hooks/useColumns";
|
|
11
13
|
import dayjs from "dayjs";
|
|
@@ -16,6 +18,8 @@ import vi from 'rc-master-ui/es/date-picker/locale/vi_VN';
|
|
|
16
18
|
import "./styles.scss";
|
|
17
19
|
import GridEdit from "./table/GridEdit";
|
|
18
20
|
import Grid from "./table/Grid";
|
|
21
|
+
// import useMergedState from "rc-util/lib/hooks/useMergedState";
|
|
22
|
+
|
|
19
23
|
dayjs.extend(customParseFormat);
|
|
20
24
|
const ResizableTitle = props => {
|
|
21
25
|
const {
|
|
@@ -50,6 +54,7 @@ const InternalTable = props => {
|
|
|
50
54
|
t,
|
|
51
55
|
columns: propsColumns,
|
|
52
56
|
lang,
|
|
57
|
+
locale,
|
|
53
58
|
dataSource,
|
|
54
59
|
allowResizing,
|
|
55
60
|
dataSourceFilter: propDataSourceFilter,
|
|
@@ -59,22 +64,35 @@ const InternalTable = props => {
|
|
|
59
64
|
format,
|
|
60
65
|
onDataChange,
|
|
61
66
|
sortMultiple,
|
|
67
|
+
expandable,
|
|
62
68
|
...rest
|
|
63
69
|
} = props;
|
|
64
|
-
const
|
|
70
|
+
const local = lang && lang === 'en' ? en : vi;
|
|
65
71
|
const buddhistLocale = {
|
|
66
|
-
...
|
|
72
|
+
...local,
|
|
67
73
|
lang: {
|
|
68
|
-
...
|
|
74
|
+
...local.lang
|
|
69
75
|
}
|
|
70
76
|
};
|
|
77
|
+
|
|
78
|
+
// const [mergedColumns, setMergedColumns] = useMergedState(
|
|
79
|
+
// propsColumns,
|
|
80
|
+
// {
|
|
81
|
+
// value: propsColumns,
|
|
82
|
+
// },
|
|
83
|
+
// );
|
|
84
|
+
|
|
85
|
+
// console.log('mergedColumns', mergedColumns)
|
|
86
|
+
|
|
71
87
|
const tableRef = useRef(null);
|
|
72
|
-
const [data, setData] = useState(
|
|
88
|
+
const [data, setData] = useState([]);
|
|
73
89
|
const [columns, setColumns] = useState([]);
|
|
74
90
|
const [isManualUpdate, setIsManualUpdate] = useState(false);
|
|
91
|
+
// const [expandKeys, setExpandKeys] = useState<string[]>([]);
|
|
75
92
|
const [dataSourceFilter, setDataSourceFilter] = useState(propDataSourceFilter ?? []);
|
|
76
93
|
useEffect(() => {
|
|
77
94
|
const rs = propsColumns ? [Table.SELECTION_COLUMN, ...propsColumns] : [];
|
|
95
|
+
// const rs = propsColumns ? [...propsColumns] : []
|
|
78
96
|
setColumns(rs);
|
|
79
97
|
}, [propsColumns]);
|
|
80
98
|
useEffect(() => {
|
|
@@ -82,7 +100,14 @@ const InternalTable = props => {
|
|
|
82
100
|
setData(dataSource || []);
|
|
83
101
|
}
|
|
84
102
|
setIsManualUpdate(false);
|
|
85
|
-
}, [dataSource]);
|
|
103
|
+
}, [dataSource, isManualUpdate]);
|
|
104
|
+
|
|
105
|
+
// const [columns, setColumns] = useMergedState(
|
|
106
|
+
// propsColumns ? [Table.SELECTION_COLUMN, ...propsColumns] : [],
|
|
107
|
+
// {
|
|
108
|
+
// value: propsColumns ? [Table.SELECTION_COLUMN, ...propsColumns] : [],
|
|
109
|
+
// },
|
|
110
|
+
// );
|
|
86
111
|
|
|
87
112
|
// ============================ RowKey ============================
|
|
88
113
|
const getRowKey = React.useMemo(() => {
|
|
@@ -92,6 +117,12 @@ const InternalTable = props => {
|
|
|
92
117
|
// @ts-ignore
|
|
93
118
|
return record => record?.[rowKey];
|
|
94
119
|
}, [rowKey]);
|
|
120
|
+
|
|
121
|
+
// useEffect(() => {
|
|
122
|
+
// const rrr = findAllChildrenKeys<any>(dataSource, getRowKey, 'children');
|
|
123
|
+
// setExpandKeys(rrr as any)
|
|
124
|
+
// }, [dataSource, getRowKey])
|
|
125
|
+
|
|
95
126
|
const handleSearch = (selectedKeys, confirm) => {
|
|
96
127
|
confirm();
|
|
97
128
|
};
|
|
@@ -129,7 +160,7 @@ const InternalTable = props => {
|
|
|
129
160
|
minWidth: 275
|
|
130
161
|
},
|
|
131
162
|
onKeyDown: e => e.stopPropagation()
|
|
132
|
-
},
|
|
163
|
+
}, column?.showOperator !== false && column?.typeFilter !== 'DateRange' && column?.typeFilter !== 'NumberRange' && /*#__PURE__*/React.createElement("div", {
|
|
133
164
|
className: 'mb-1'
|
|
134
165
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
135
166
|
options: translateOption(numberOperator, t),
|
|
@@ -145,7 +176,7 @@ const InternalTable = props => {
|
|
|
145
176
|
style: {
|
|
146
177
|
marginBottom: 8
|
|
147
178
|
}
|
|
148
|
-
}, renderFilter(column, selectedKeys, setSelectedKeys, confirm, visible, searchValue, setSearchValue, dataSourceFilter, buddhistLocale)), /*#__PURE__*/React.createElement(Space, {
|
|
179
|
+
}, renderFilter(column, selectedKeys, setSelectedKeys, confirm, visible, searchValue, setSearchValue, dataSourceFilter, buddhistLocale, locale, t)), /*#__PURE__*/React.createElement(Space, {
|
|
149
180
|
style: {
|
|
150
181
|
justifyContent: 'end',
|
|
151
182
|
width: '100%'
|
|
@@ -187,7 +218,7 @@ const InternalTable = props => {
|
|
|
187
218
|
}
|
|
188
219
|
}
|
|
189
220
|
}
|
|
190
|
-
}), [onFilterCallback, onFilterClick,
|
|
221
|
+
}), [buddhistLocale, dataSourceFilter, onFilterCallback, onFilterClick, t]);
|
|
191
222
|
const handleResize = indexPath => (e, {
|
|
192
223
|
size
|
|
193
224
|
}) => {
|
|
@@ -255,6 +286,9 @@ const InternalTable = props => {
|
|
|
255
286
|
if (["index", "#"].includes(transformedColumn.dataIndex)) {
|
|
256
287
|
return {
|
|
257
288
|
...transformedColumn,
|
|
289
|
+
onCell: () => ({
|
|
290
|
+
className: 'cell-number'
|
|
291
|
+
}),
|
|
258
292
|
render: (_, __, rowIndex) => rowIndex + 1
|
|
259
293
|
};
|
|
260
294
|
}
|
|
@@ -302,13 +336,17 @@ const InternalTable = props => {
|
|
|
302
336
|
const triggerChangeData = newData => {
|
|
303
337
|
setIsManualUpdate(true);
|
|
304
338
|
setData(newData);
|
|
339
|
+
// setMergedData(newData)
|
|
305
340
|
onDataChange?.(newData);
|
|
306
341
|
};
|
|
307
342
|
const TableComponent = editAble ? GridEdit : Grid;
|
|
308
343
|
return /*#__PURE__*/React.createElement(TableComponent, _extends({}, rest, {
|
|
309
344
|
t: t,
|
|
345
|
+
locale: locale,
|
|
310
346
|
tableRef: tableRef,
|
|
311
|
-
dataSource: data
|
|
347
|
+
dataSource: data
|
|
348
|
+
// mergedData={mergedData}
|
|
349
|
+
,
|
|
312
350
|
components: {
|
|
313
351
|
header: {
|
|
314
352
|
cell: allowResizing ? ResizableTitle : undefined
|
|
@@ -316,7 +354,7 @@ const InternalTable = props => {
|
|
|
316
354
|
},
|
|
317
355
|
format: format,
|
|
318
356
|
columns: mergedColumns
|
|
319
|
-
//
|
|
357
|
+
// defaultColumns={mergedColumns}
|
|
320
358
|
,
|
|
321
359
|
showSorterTooltip: {
|
|
322
360
|
target: 'sorter-icon'
|
|
@@ -2,7 +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 { Table, Toolbar } from "rc-master-ui";
|
|
5
|
+
import { Empty, Table, Toolbar } from "rc-master-ui";
|
|
6
6
|
import 'dayjs/locale/es';
|
|
7
7
|
import 'dayjs/locale/vi';
|
|
8
8
|
import ContextMenu from "./ContextMenu";
|
|
@@ -88,6 +88,9 @@ const TableGrid = props => {
|
|
|
88
88
|
columns,
|
|
89
89
|
tableRef,
|
|
90
90
|
dataSource,
|
|
91
|
+
locale,
|
|
92
|
+
expandable,
|
|
93
|
+
// mergedData,
|
|
91
94
|
title,
|
|
92
95
|
format,
|
|
93
96
|
virtual = true,
|
|
@@ -133,6 +136,12 @@ const TableGrid = props => {
|
|
|
133
136
|
const menuRef = useRef(null);
|
|
134
137
|
const viewportWidth = window.innerWidth;
|
|
135
138
|
const viewportHeight = window.innerHeight;
|
|
139
|
+
|
|
140
|
+
// const defaultSelected = useMemo(() => {
|
|
141
|
+
// return defaultSelectedRowKeys ?? []
|
|
142
|
+
//
|
|
143
|
+
// }, [defaultSelectedRowKeys])
|
|
144
|
+
|
|
136
145
|
const [menuVisible, setMenuVisible] = React.useState(false);
|
|
137
146
|
const [selectedRowData, setSelectedRowData] = React.useState(null);
|
|
138
147
|
const [position, setPosition] = React.useState({
|
|
@@ -224,6 +233,8 @@ const TableGrid = props => {
|
|
|
224
233
|
}
|
|
225
234
|
};
|
|
226
235
|
const handleRowClick = () => () => {
|
|
236
|
+
// const key = getRowKey(record, index);
|
|
237
|
+
|
|
227
238
|
if (checkboxOnly !== true) {
|
|
228
239
|
if (type === 'single') {}
|
|
229
240
|
}
|
|
@@ -231,7 +242,6 @@ const TableGrid = props => {
|
|
|
231
242
|
|
|
232
243
|
// @ts-ignore
|
|
233
244
|
clickRef.current = setTimeout(() => {
|
|
234
|
-
// console.log("Single Click:", record);
|
|
235
245
|
clickRef.current = null;
|
|
236
246
|
}, 250);
|
|
237
247
|
};
|
|
@@ -263,6 +273,7 @@ const TableGrid = props => {
|
|
|
263
273
|
rowData: selectedRow
|
|
264
274
|
});
|
|
265
275
|
} else {
|
|
276
|
+
// @ts-ignore
|
|
266
277
|
setMergedSelectedKeys(keys);
|
|
267
278
|
rowSelected?.({
|
|
268
279
|
selected: selectedRows,
|
|
@@ -294,7 +305,15 @@ const TableGrid = props => {
|
|
|
294
305
|
contextMenuClick: contextMenuClick,
|
|
295
306
|
rowData: selectedRowData
|
|
296
307
|
}), /*#__PURE__*/React.createElement(Table, _extends({
|
|
297
|
-
ref: tableRef
|
|
308
|
+
ref: tableRef
|
|
309
|
+
}, rest, {
|
|
310
|
+
locale: {
|
|
311
|
+
...locale,
|
|
312
|
+
emptyText: /*#__PURE__*/React.createElement(Empty, {
|
|
313
|
+
image: Empty.PRESENTED_IMAGE_SIMPLE,
|
|
314
|
+
description: locale?.emptyText
|
|
315
|
+
})
|
|
316
|
+
},
|
|
298
317
|
loading: {
|
|
299
318
|
spinning: columns && columns.length === 0 || loading === true,
|
|
300
319
|
indicator: /*#__PURE__*/React.createElement(ComponentSpinner, null)
|
|
@@ -389,7 +408,7 @@ const TableGrid = props => {
|
|
|
389
408
|
// @ts-ignore
|
|
390
409
|
, {
|
|
391
410
|
style: {
|
|
392
|
-
width:
|
|
411
|
+
width: `calc(100% - 650px`
|
|
393
412
|
},
|
|
394
413
|
items: toolbarItems ?? [],
|
|
395
414
|
mode: 'scroll'
|
|
@@ -412,8 +431,40 @@ const TableGrid = props => {
|
|
|
412
431
|
t: t,
|
|
413
432
|
triggerChangeColumns: triggerChangeColumns
|
|
414
433
|
}))));
|
|
434
|
+
},
|
|
435
|
+
expandable: {
|
|
436
|
+
expandIconColumnIndex: 3,
|
|
437
|
+
defaultExpandAllRows: true,
|
|
438
|
+
indentSize: 25,
|
|
439
|
+
...expandable,
|
|
440
|
+
expandIcon: args => {
|
|
441
|
+
const {
|
|
442
|
+
record,
|
|
443
|
+
expanded,
|
|
444
|
+
onExpand
|
|
445
|
+
} = args;
|
|
446
|
+
|
|
447
|
+
// @ts-ignore
|
|
448
|
+
if (record?.children && record?.children?.length > 0 || record?.isChildren) {
|
|
449
|
+
return expanded ? /*#__PURE__*/React.createElement("button", {
|
|
450
|
+
onClick: e => {
|
|
451
|
+
e.preventDefault();
|
|
452
|
+
e.stopPropagation();
|
|
453
|
+
onExpand(record, e);
|
|
454
|
+
},
|
|
455
|
+
className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded'
|
|
456
|
+
}) : /*#__PURE__*/React.createElement("button", {
|
|
457
|
+
onClick: e => {
|
|
458
|
+
e.preventDefault();
|
|
459
|
+
e.stopPropagation();
|
|
460
|
+
onExpand(record, e);
|
|
461
|
+
},
|
|
462
|
+
className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed'
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
}
|
|
415
466
|
}
|
|
416
|
-
}
|
|
467
|
+
})), pagination && pagination.onChange && !pagination.position && /*#__PURE__*/React.createElement(Pagination
|
|
417
468
|
// style={{padding: '0.75rem 1rem'}}
|
|
418
469
|
, _extends({
|
|
419
470
|
showSizeChanger: true,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ColumnsType, ColumnType, IFormat } from "../../type";
|
|
2
2
|
import React from "react";
|
|
3
|
+
import { TableLocale } from "rc-master-ui/lib/table/interface";
|
|
3
4
|
export declare function flatColumns<RecordType>(columns: ColumnsType<RecordType>, parentKey?: string): ColumnType<RecordType>[];
|
|
4
5
|
export declare const getValueCell: <T>(column: ColumnType<T>, value: any, format?: IFormat) => any;
|
|
5
6
|
export declare const renderContent: <RecordType>(column: ColumnType<RecordType>, value: any, record: RecordType, index: number, format?: IFormat) => React.JSX.Element;
|
|
6
|
-
export declare const renderFilter: <RecordType>(column: ColumnType<RecordType>, selectedKeys: string[], setSelectedKeys: any, confirm: any, visible: boolean, searchValue: string, setSearchValue: any, dataSourceFilter: any[], buddhistLocale: any) => React.JSX.Element;
|
|
7
|
+
export declare const renderFilter: <RecordType>(column: ColumnType<RecordType>, selectedKeys: string[], setSelectedKeys: any, confirm: any, visible: boolean, searchValue: string, setSearchValue: any, dataSourceFilter: any[], buddhistLocale: any, locale?: TableLocale, t?: any) => React.JSX.Element;
|
|
@@ -5,7 +5,7 @@ import { NumericFormat, numericFormatter } from "react-numeric-component";
|
|
|
5
5
|
import dayjs from "dayjs";
|
|
6
6
|
import moment from "moment/moment";
|
|
7
7
|
import React, { Fragment } from "react";
|
|
8
|
-
import { DatePicker, Input, Select } from "rc-master-ui";
|
|
8
|
+
import { DatePicker, Empty, Input, Select } from "rc-master-ui";
|
|
9
9
|
import CheckboxFilter from "../../CheckboxFilter";
|
|
10
10
|
// import {ColorPicker} from "antd";
|
|
11
11
|
const {
|
|
@@ -93,7 +93,7 @@ export const renderContent = (column, value, record, index, format) => {
|
|
|
93
93
|
const content = getValueCell(column, cellValue, format);
|
|
94
94
|
return /*#__PURE__*/React.createElement(Fragment, null, column?.template ? typeof column.template === "function" ? column.template(value, record, index) : column.template : content);
|
|
95
95
|
};
|
|
96
|
-
export const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, visible, searchValue, setSearchValue, dataSourceFilter, buddhistLocale) => {
|
|
96
|
+
export const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, visible, searchValue, setSearchValue, dataSourceFilter, buddhistLocale, locale, t) => {
|
|
97
97
|
const type = getTypeFilter(column);
|
|
98
98
|
const dateFormat = getDatepickerFormat(column?.typeFilter ?? column?.type, column) ?? 'DD/MM/YYYY';
|
|
99
99
|
const dateRangeFormat = getDatepickerFormat(column?.type, column) ?? 'DD/MM/YYYY';
|
|
@@ -136,7 +136,7 @@ export const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, vis
|
|
|
136
136
|
// onChangeValueFilter(type, values.floatValue, 'min')
|
|
137
137
|
// }}
|
|
138
138
|
,
|
|
139
|
-
placeholder: 'Min',
|
|
139
|
+
placeholder: t ? t('Min') : 'Min',
|
|
140
140
|
autoFocus: true
|
|
141
141
|
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(NumericFormat, {
|
|
142
142
|
value: selectedKeys[1]
|
|
@@ -149,7 +149,7 @@ export const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, vis
|
|
|
149
149
|
onValueChange: () => {
|
|
150
150
|
// onChangeValueFilter(type, values.floatValue, 'max')
|
|
151
151
|
},
|
|
152
|
-
placeholder: 'Max'
|
|
152
|
+
placeholder: t ? t('Max') : 'Max'
|
|
153
153
|
})))));
|
|
154
154
|
case 'Date':
|
|
155
155
|
const dateValue = selectedKeys[0] ? convertDateToDayjs(new Date(selectedKeys[0]), dateFormat) : null;
|
|
@@ -186,7 +186,9 @@ export const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, vis
|
|
|
186
186
|
// defaultValue={dateRangeValue}
|
|
187
187
|
,
|
|
188
188
|
value: dateRangeValue,
|
|
189
|
-
|
|
189
|
+
locale: buddhistLocale
|
|
190
|
+
// placeholder={['Ngày bắt đầu', 'Ngày kết thúc']}
|
|
191
|
+
,
|
|
190
192
|
popupStyle: {
|
|
191
193
|
zIndex: 9999
|
|
192
194
|
},
|
|
@@ -337,6 +339,10 @@ export const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, vis
|
|
|
337
339
|
marginBottom: 8
|
|
338
340
|
},
|
|
339
341
|
value: selectedKeys[0],
|
|
342
|
+
notFoundContent: /*#__PURE__*/React.createElement(Empty, {
|
|
343
|
+
image: Empty.PRESENTED_IMAGE_SIMPLE,
|
|
344
|
+
description: locale?.emptyText
|
|
345
|
+
}),
|
|
340
346
|
onChange: val => {
|
|
341
347
|
// setOperatorKey(val)
|
|
342
348
|
setSelectedKeys(val ? [val] : []);
|
|
@@ -395,13 +401,12 @@ export const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, vis
|
|
|
395
401
|
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
396
402
|
className: 'mb-1'
|
|
397
403
|
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CheckboxFilter
|
|
398
|
-
//
|
|
404
|
+
// locale={{
|
|
405
|
+
// filterTitle: 'Chọn tất cả',
|
|
406
|
+
// filterCheckall: 'Chọn tất cả'
|
|
407
|
+
// }}
|
|
399
408
|
, {
|
|
400
|
-
locale:
|
|
401
|
-
filterTitle: 'Chọn tất cả',
|
|
402
|
-
filterCheckall: 'Chọn tất cả'
|
|
403
|
-
},
|
|
404
|
-
showFilter: column.showFilterSearch,
|
|
409
|
+
locale: locale,
|
|
405
410
|
selectedKeys: selectedKeys,
|
|
406
411
|
onSelect: setSelectedKeys,
|
|
407
412
|
options: options,
|
|
@@ -415,7 +420,7 @@ export const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, vis
|
|
|
415
420
|
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
416
421
|
className: 'mb-1'
|
|
417
422
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
418
|
-
placeholder: `Search`,
|
|
423
|
+
placeholder: t ? t('Search') : `Search`,
|
|
419
424
|
value: selectedKeys[0],
|
|
420
425
|
onChange: e => setSelectedKeys(e.target.value ? [e.target.value] : [])
|
|
421
426
|
// onPressEnter={() => handleSearch(selectedKeys as string[], confirm)}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type * as React from "react";
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
3
|
import type { EditType, IColumnType, TypeFilter } from "rc-master-ui";
|
|
4
|
-
import type { ColumnEditType, ColumnsType, ColumnTable } from "../type";
|
|
4
|
+
import type { ColumnEditType, ColumnsType, ColumnTable, GetRowKey } from "../type";
|
|
5
5
|
import type { SelectionSettings } from "../type";
|
|
6
6
|
import type { AnyObject } from "../type";
|
|
7
|
+
import { Key } from "react";
|
|
7
8
|
export declare const newGuid: () => any;
|
|
8
9
|
export declare const sumDataByField: (data: any[], field: string) => any;
|
|
9
10
|
export declare const checkThousandSeparator: (thousandSeparator: string | undefined, decimalSeparator: string | undefined) => string;
|
|
@@ -35,3 +36,4 @@ export declare const getColumnsVisible: <T>(columns: ColumnsType<T>, index: numb
|
|
|
35
36
|
export declare const updateData: <Record_1 = AnyObject>(initData: Record_1[], rows: Record_1[], key: keyof Record_1) => Record_1[];
|
|
36
37
|
export declare const parseBooleanToValue: (value: boolean, type: 'boolean' | 'number') => number | boolean;
|
|
37
38
|
export declare const genPresets: (presets?: import("@ant-design/colors").PalettesProps) => import("antd/es/color-picker/interface").PresetsItem[];
|
|
39
|
+
export declare function findAllChildrenKeys<RecordType>(data: readonly RecordType[], getRowKey: GetRowKey<RecordType>, childrenColumnName: string): Key[];
|
|
@@ -328,4 +328,15 @@ export const genPresets = (presets = presetPalettes) => {
|
|
|
328
328
|
colors,
|
|
329
329
|
key: label
|
|
330
330
|
}));
|
|
331
|
-
};
|
|
331
|
+
};
|
|
332
|
+
export function findAllChildrenKeys(data, getRowKey, childrenColumnName) {
|
|
333
|
+
const keys = [];
|
|
334
|
+
function dig(list) {
|
|
335
|
+
(list || []).forEach((item, index) => {
|
|
336
|
+
keys.push(getRowKey(item, index));
|
|
337
|
+
dig(item[childrenColumnName]);
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
dig(data);
|
|
341
|
+
return keys;
|
|
342
|
+
}
|