es-grid-template 1.8.65 → 1.8.67
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/TempTable.d.ts +2 -2
- package/es/grid-component/TempTable.js +3 -3
- package/es/grid-component/hooks/constant.d.ts +1 -0
- package/es/grid-component/hooks/constant.js +2 -1
- package/es/grid-component/hooks/index.js +0 -1
- package/es/grid-component/hooks/useLazyKVMap.d.ts +1 -1
- package/es/grid-component/hooks/useLazyKVMap.js +0 -4
- package/es/grid-component/hooks/utils.d.ts +3 -4
- package/es/grid-component/hooks/utils.js +2 -1
- package/es/grid-component/styles.scss +1394 -1394
- package/es/grid-component/type.d.ts +0 -414
- package/es/grid-component/type.js +490 -1
- package/es/table-component/TableContainerEdit.js +2 -127
- package/es/table-component/body/TableBodyCellEdit.js +2 -9
- package/es/table-component/header/TableHeadCell.js +1 -10
- package/es/table-component/header/TableHeadCell2.js +1 -1
- package/es/table-component/type.d.ts +3 -1
- package/es/table-virtuoso/ColumnsGroup/ColumnsGroup.js +1 -3
- package/es/table-virtuoso/InternalTable.js +6 -28
- package/es/table-virtuoso/body/TableBodyCell.js +0 -9
- package/es/table-virtuoso/body/TableBodyRow.js +0 -4
- package/es/table-virtuoso/style.js +2 -1
- package/es/table-virtuoso/style.scss +2 -1
- package/es/table-virtuoso/table/Grid.js +0 -4
- package/es/table-virtuoso/table/TableContainer.js +31 -44
- package/es/table-virtuoso/table/TableWrapper.d.ts +2 -0
- package/es/table-virtuoso/table/TableWrapper.js +5 -2
- package/lib/grid-component/TempTable.d.ts +2 -2
- package/lib/grid-component/TempTable.js +3 -5
- package/lib/grid-component/hooks/constant.d.ts +1 -0
- package/lib/grid-component/hooks/constant.js +3 -2
- package/lib/grid-component/hooks/useLazyKVMap.d.ts +1 -1
- package/lib/grid-component/hooks/useLazyKVMap.js +0 -3
- package/lib/grid-component/hooks/utils.d.ts +3 -4
- package/lib/grid-component/hooks/utils.js +3 -0
- package/lib/grid-component/styles.scss +1394 -1394
- package/lib/grid-component/type.d.ts +0 -414
- package/lib/grid-component/type.js +490 -4
- package/lib/table-component/TableContainerEdit.js +1 -126
- package/lib/table-component/body/TableBodyCellEdit.js +5 -11
- package/lib/table-component/header/TableHeadCell.js +4 -13
- package/lib/table-component/header/TableHeadCell2.js +4 -4
- package/lib/table-component/type.d.ts +3 -1
- package/lib/table-virtuoso/ColumnsGroup/ColumnsGroup.js +1 -3
- package/lib/table-virtuoso/InternalTable.js +6 -28
- package/lib/table-virtuoso/body/TableBodyCell.js +0 -9
- package/lib/table-virtuoso/body/TableBodyRow.js +0 -5
- package/lib/table-virtuoso/style.js +2 -1
- package/lib/table-virtuoso/style.scss +2 -1
- package/lib/table-virtuoso/table/Grid.js +0 -4
- package/lib/table-virtuoso/table/TableContainer.js +29 -42
- package/lib/table-virtuoso/table/TableWrapper.d.ts +2 -0
- package/lib/table-virtuoso/table/TableWrapper.js +4 -2
- package/package.json +1 -1
- package/es/grid-component/AdvanceFilter.d.ts +0 -14
- package/es/grid-component/AdvanceFilter.js +0 -454
- package/es/grid-component/CheckboxFilter.d.ts +0 -20
- package/es/grid-component/CheckboxFilter.js +0 -244
- package/es/grid-component/CheckboxFilter2.d.ts +0 -20
- package/es/grid-component/CheckboxFilter2.js +0 -244
- package/es/grid-component/ColumnsChoose.d.ts +0 -10
- package/es/grid-component/ColumnsChoose.js +0 -230
- package/es/grid-component/ColumnsGroup/ColumnsGroup.d.ts +0 -12
- package/es/grid-component/ColumnsGroup/ColumnsGroup.js +0 -232
- package/es/grid-component/ColumnsGroup/index.d.ts +0 -1
- package/es/grid-component/ColumnsGroup/index.js +0 -1
- package/es/grid-component/Command.d.ts +0 -8
- package/es/grid-component/Command.js +0 -80
- package/es/grid-component/ContextMenu.d.ts +0 -20
- package/es/grid-component/ContextMenu.js +0 -130
- package/es/grid-component/EditForm/EditForm.d.ts +0 -27
- package/es/grid-component/EditForm/EditForm.js +0 -394
- package/es/grid-component/EditForm/index.d.ts +0 -1
- package/es/grid-component/EditForm/index.js +0 -1
- package/es/grid-component/EditableCell.d.ts +0 -20
- package/es/grid-component/EditableCell.js +0 -1030
- package/es/grid-component/FilterSearch.d.ts +0 -12
- package/es/grid-component/FilterSearch.js +0 -33
- package/es/grid-component/GridStyle.d.ts +0 -8
- package/es/grid-component/GridStyle.js +0 -5
- package/es/grid-component/TableGrid.d.ts +0 -21
- package/es/grid-component/TableGrid.js +0 -493
- package/es/grid-component/async-select/index.d.ts +0 -11
- package/es/grid-component/async-select/index.js +0 -38
- package/es/grid-component/async-table-select/index.d.ts +0 -11
- package/es/grid-component/async-table-select/index.js +0 -40
- package/es/grid-component/checkbox-control/index.d.ts +0 -13
- package/es/grid-component/checkbox-control/index.js +0 -40
- package/es/grid-component/hooks/columns/index.d.ts +0 -10
- package/es/grid-component/hooks/columns/index.js +0 -503
- package/es/grid-component/hooks/content/ControlCheckbox.d.ts +0 -13
- package/es/grid-component/hooks/content/ControlCheckbox.js +0 -87
- package/es/grid-component/hooks/content/HeaderContent.d.ts +0 -14
- package/es/grid-component/hooks/content/HeaderContent.js +0 -44
- package/es/grid-component/hooks/content/TooltipContent.d.ts +0 -13
- package/es/grid-component/hooks/content/TooltipContent.js +0 -74
- package/es/grid-component/hooks/useColumns.d.ts +0 -19
- package/es/grid-component/hooks/useColumns.js +0 -317
- package/es/grid-component/number/index.d.ts +0 -10
- package/es/grid-component/number/index.js +0 -39
- package/es/grid-component/number-range/index.d.ts +0 -11
- package/es/grid-component/number-range/index.js +0 -63
- package/es/grid-component/useContext.d.ts +0 -34
- package/es/grid-component/useContext.js +0 -8
- package/es/table-component/hook/constant.d.ts +0 -73
- package/es/table-component/hook/constant.js +0 -240
- package/es/table-virtuoso/body/TableBody.d.ts +0 -14
- package/es/table-virtuoso/body/TableBody.js +0 -84
- package/lib/grid-component/AdvanceFilter.d.ts +0 -14
- package/lib/grid-component/AdvanceFilter.js +0 -463
- package/lib/grid-component/CheckboxFilter.d.ts +0 -20
- package/lib/grid-component/CheckboxFilter.js +0 -253
- package/lib/grid-component/CheckboxFilter2.d.ts +0 -20
- package/lib/grid-component/CheckboxFilter2.js +0 -253
- package/lib/grid-component/ColumnsChoose.d.ts +0 -10
- package/lib/grid-component/ColumnsChoose.js +0 -240
- package/lib/grid-component/ColumnsGroup/ColumnsGroup.d.ts +0 -12
- package/lib/grid-component/ColumnsGroup/ColumnsGroup.js +0 -243
- package/lib/grid-component/ColumnsGroup/index.d.ts +0 -1
- package/lib/grid-component/ColumnsGroup/index.js +0 -16
- package/lib/grid-component/Command.d.ts +0 -8
- package/lib/grid-component/Command.js +0 -88
- package/lib/grid-component/ContextMenu.d.ts +0 -20
- package/lib/grid-component/ContextMenu.js +0 -140
- package/lib/grid-component/EditForm/EditForm.d.ts +0 -27
- package/lib/grid-component/EditForm/EditForm.js +0 -404
- package/lib/grid-component/EditForm/index.d.ts +0 -1
- package/lib/grid-component/EditForm/index.js +0 -16
- package/lib/grid-component/EditableCell.d.ts +0 -20
- package/lib/grid-component/EditableCell.js +0 -1032
- package/lib/grid-component/FilterSearch.d.ts +0 -12
- package/lib/grid-component/FilterSearch.js +0 -42
- package/lib/grid-component/GridStyle.d.ts +0 -8
- package/lib/grid-component/GridStyle.js +0 -12
- package/lib/grid-component/TableGrid.d.ts +0 -21
- package/lib/grid-component/TableGrid.js +0 -493
- package/lib/grid-component/async-select/index.d.ts +0 -11
- package/lib/grid-component/async-select/index.js +0 -47
- package/lib/grid-component/async-table-select/index.d.ts +0 -11
- package/lib/grid-component/async-table-select/index.js +0 -49
- package/lib/grid-component/checkbox-control/index.d.ts +0 -13
- package/lib/grid-component/checkbox-control/index.js +0 -48
- package/lib/grid-component/hooks/columns/index.d.ts +0 -10
- package/lib/grid-component/hooks/columns/index.js +0 -518
- package/lib/grid-component/hooks/content/ControlCheckbox.d.ts +0 -13
- package/lib/grid-component/hooks/content/ControlCheckbox.js +0 -95
- package/lib/grid-component/hooks/content/HeaderContent.d.ts +0 -14
- package/lib/grid-component/hooks/content/HeaderContent.js +0 -53
- package/lib/grid-component/hooks/content/TooltipContent.d.ts +0 -13
- package/lib/grid-component/hooks/content/TooltipContent.js +0 -81
- package/lib/grid-component/hooks/useColumns.d.ts +0 -19
- package/lib/grid-component/hooks/useColumns.js +0 -328
- package/lib/grid-component/number/index.d.ts +0 -10
- package/lib/grid-component/number/index.js +0 -47
- package/lib/grid-component/number-range/index.d.ts +0 -11
- package/lib/grid-component/number-range/index.js +0 -71
- package/lib/grid-component/useContext.d.ts +0 -34
- package/lib/grid-component/useContext.js +0 -13
- package/lib/table-component/hook/constant.d.ts +0 -73
- package/lib/table-component/hook/constant.js +0 -247
- package/lib/table-virtuoso/body/TableBody.d.ts +0 -14
- package/lib/table-virtuoso/body/TableBody.js +0 -95
|
@@ -1,454 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import React, { Fragment, useState } from "react";
|
|
3
|
-
import styled from "styled-components";
|
|
4
|
-
import { Badge, Button, Tooltip } from "antd";
|
|
5
|
-
import { Filter } from "becoxy-icons";
|
|
6
|
-
import { DatePicker, TimePicker, TreeSelect, Popover, Input } from "rc-master-ui";
|
|
7
|
-
import { checkDecimalSeparator, checkThousandSeparator, convertDateToDayjs, convertDayjsToDate, isArraysEqual, isEmpty, isObjEmpty } from "./hooks";
|
|
8
|
-
import CheckboxControl from "./checkbox-control";
|
|
9
|
-
import { AsyncSelect } from "./async-select";
|
|
10
|
-
import { NumericFormat } from 'react-numeric-component';
|
|
11
|
-
import classnames from "classnames";
|
|
12
|
-
import { getDefaultOperator } from "rc-master-ui/es/table/util";
|
|
13
|
-
const {
|
|
14
|
-
RangePicker
|
|
15
|
-
} = DatePicker;
|
|
16
|
-
const MainFilter = styled.div.withConfig({
|
|
17
|
-
displayName: "MainFilter",
|
|
18
|
-
componentId: "es-grid-template__sc-zdl2xa-0"
|
|
19
|
-
})([".filter-left{display:flex;flex-direction:column;gap:1rem;width:", ";border-right:1px solid #c4c4c4;}@media (max-width:576px){flex-direction:column-reverse;gap:1rem;.filter-left{width:100%;border-right:0;}}"], props => `${props.leftFilterWidth}px`);
|
|
20
|
-
const GridFilter = styled.div.withConfig({
|
|
21
|
-
displayName: "GridFilter",
|
|
22
|
-
componentId: "es-grid-template__sc-zdl2xa-1"
|
|
23
|
-
})(["display:grid;gap:10px;padding-right:1rem;padding-left:1rem;max-height:500px;overflow:auto;overflow-x:hidden;flex-wrap:wrap;grid-template-columns:repeat(2,minmax(250px,1fr));.grid-item-filter{}.adv-form-input{height:32px;}@media (max-width:720px){grid-template-columns:repeat(1,minmax(250px,1fr));}"]);
|
|
24
|
-
const BoxAction = styled.div.withConfig({
|
|
25
|
-
displayName: "BoxAction",
|
|
26
|
-
componentId: "es-grid-template__sc-zdl2xa-2"
|
|
27
|
-
})(["border-top:1px solid #c4c4c4;padding-top:0.75rem;display:flex;justify-content:end;gap:10px;.btn-action{background:none !important;border:none !important;&.btn-action-submit{color:#df4318;&:disabled{background-color:#f0f0f0 !important;}&:hover{color:#df4318 !important;}}&:hover{background-color:#f0f0f0 !important;}}"]);
|
|
28
|
-
|
|
29
|
-
// const FilterContainer = styled.div<{ contentWidth?: number }>`
|
|
30
|
-
// .customizer {
|
|
31
|
-
// right: ${props => (props.contentWidth ? `-${props.contentWidth}px` : '-400px')};
|
|
32
|
-
// width: ${props => (props.contentWidth ? `${props.contentWidth}px` : '400px')};
|
|
33
|
-
// }
|
|
34
|
-
// .customizer.open {
|
|
35
|
-
// right: 0;
|
|
36
|
-
// }
|
|
37
|
-
// .adv-form-input {
|
|
38
|
-
// height: 32px;
|
|
39
|
-
// }
|
|
40
|
-
// .checkbox-dropdown {
|
|
41
|
-
// .ant-select-tree-treenode {
|
|
42
|
-
// .ant-select-tree-switcher.ant-select-tree-switcher-noop {
|
|
43
|
-
// width: 0 !important;
|
|
44
|
-
// }
|
|
45
|
-
// }
|
|
46
|
-
// }
|
|
47
|
-
// `
|
|
48
|
-
|
|
49
|
-
const AdvanceFilter = props => {
|
|
50
|
-
const {
|
|
51
|
-
columns: defaultColumns,
|
|
52
|
-
dataSourceFilter,
|
|
53
|
-
onFilter,
|
|
54
|
-
// mode = 'dropdown',
|
|
55
|
-
defaultFilter,
|
|
56
|
-
leftFilterWidth = 280,
|
|
57
|
-
format,
|
|
58
|
-
t
|
|
59
|
-
} = props;
|
|
60
|
-
|
|
61
|
-
// const columnsChooseRef: any = useRef(null)
|
|
62
|
-
const menuRef = React.useRef(null);
|
|
63
|
-
|
|
64
|
-
// const [selectedKeys, setSelectedKeys] = useState<string[]>([]);
|
|
65
|
-
// const [isManualUpdate, setIsManualUpdate] = useState(false);
|
|
66
|
-
|
|
67
|
-
const [prevFilter, setPrevFilter] = useState([]);
|
|
68
|
-
const [filterColumns, setFilterColumns] = useState([]);
|
|
69
|
-
const [clicked, setClicked] = useState(false);
|
|
70
|
-
const [columns, setColumns] = useState([]);
|
|
71
|
-
const count = 4;
|
|
72
|
-
// const count = useMemo(() => {
|
|
73
|
-
//
|
|
74
|
-
// const uniqueItems = prevFilter.filter((item, index, arr) => {
|
|
75
|
-
// return arr.findIndex(el => el.field === item.field) === index
|
|
76
|
-
// })
|
|
77
|
-
//
|
|
78
|
-
// return uniqueItems?.filter((quer: any) => quer.filterOption && quer.filterOption?.value).length ?? 0
|
|
79
|
-
//
|
|
80
|
-
// }, [prevFilter])
|
|
81
|
-
|
|
82
|
-
React.useEffect(() => {
|
|
83
|
-
if (defaultColumns) {
|
|
84
|
-
const filter = defaultColumns.filter(it => it.visible !== false && it.allowFiltering !== false && it.field !== '#' && it.field !== 'command');
|
|
85
|
-
const tmpFilter = filter.map(it => ({
|
|
86
|
-
...it,
|
|
87
|
-
filterOption: {
|
|
88
|
-
key: it.field,
|
|
89
|
-
field: it.field,
|
|
90
|
-
value: undefined,
|
|
91
|
-
predicate: undefined,
|
|
92
|
-
operator: it?.filterOption?.operator ? it.filterOption.operator : getDefaultOperator(it)
|
|
93
|
-
}
|
|
94
|
-
}));
|
|
95
|
-
setColumns(filter);
|
|
96
|
-
setPrevFilter(tmpFilter);
|
|
97
|
-
setFilterColumns(tmpFilter);
|
|
98
|
-
}
|
|
99
|
-
}, [defaultColumns, defaultFilter]);
|
|
100
|
-
const hide = () => {
|
|
101
|
-
setClicked(false);
|
|
102
|
-
};
|
|
103
|
-
const handleClickChange = open => {
|
|
104
|
-
setClicked(open);
|
|
105
|
-
if (defaultFilter) {
|
|
106
|
-
setFilterColumns(defaultFilter ?? []);
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
const handleAccept = () => {
|
|
110
|
-
const query = filterColumns.filter(quer => quer.filterOption && (quer.filterOption?.value || quer.filterOption?.value === 0)).map(quer => quer.filterOption);
|
|
111
|
-
if (onFilter && !isArraysEqual(filterColumns, defaultFilter ?? [])) {
|
|
112
|
-
onFilter(query, filterColumns);
|
|
113
|
-
}
|
|
114
|
-
hide();
|
|
115
|
-
setPrevFilter(filterColumns);
|
|
116
|
-
};
|
|
117
|
-
const handleReset = () => {
|
|
118
|
-
setFilterColumns(columns);
|
|
119
|
-
};
|
|
120
|
-
const handleCancel = () => {
|
|
121
|
-
hide();
|
|
122
|
-
setFilterColumns(prevFilter);
|
|
123
|
-
};
|
|
124
|
-
const renderFilter = (tmpColumn, index) => {
|
|
125
|
-
const find = filterColumns.find(it => it.field === tmpColumn.field);
|
|
126
|
-
const column = find ? find : tmpColumn;
|
|
127
|
-
let valueFilter;
|
|
128
|
-
if (column?.typeFilter === 'Checkbox' || column?.typeFilter === 'CheckboxDropdown' || tmpColumn?.filterOption?.multiple) {
|
|
129
|
-
const currentValueFilter = filterColumns.filter(it => it.field === column?.field && (it.filterOption?.value || it.filterOption?.value === 0));
|
|
130
|
-
valueFilter = currentValueFilter.map(it => it.filterOption?.value);
|
|
131
|
-
} else if (column?.typeFilter === 'DateRange') {
|
|
132
|
-
const currentValueFilter = filterColumns.filter(it => it.field === column?.field);
|
|
133
|
-
const findStartDate = currentValueFilter.find(it => it.filterOption?.operator === 'greaterthanorequal');
|
|
134
|
-
const findEndDate = currentValueFilter.find(it => it.filterOption?.operator === 'lessthanorequal');
|
|
135
|
-
const startDate = findStartDate ? convertDateToDayjs(findStartDate.filterOption?.value, column?.format?.dateFormat ?? 'DD/MM/YYYY') : '';
|
|
136
|
-
const endDate = findEndDate ? convertDateToDayjs(findEndDate.filterOption?.value, column?.format?.dateFormat ?? 'DD/MM/YYYY') : '';
|
|
137
|
-
valueFilter = [startDate, endDate];
|
|
138
|
-
} else {
|
|
139
|
-
// single Value
|
|
140
|
-
valueFilter = column?.filterOption?.value;
|
|
141
|
-
}
|
|
142
|
-
const options = dataSourceFilter?.find(it => it.key === column?.field)?.data;
|
|
143
|
-
const loadOptions = dataSourceFilter?.find(it => it.key === column?.field)?.loadOptions;
|
|
144
|
-
switch (column?.typeFilter) {
|
|
145
|
-
case "Checkbox":
|
|
146
|
-
return /*#__PURE__*/React.createElement(CheckboxControl, {
|
|
147
|
-
value: valueFilter,
|
|
148
|
-
options: options ?? [],
|
|
149
|
-
onChange: val => {
|
|
150
|
-
console.log(val);
|
|
151
|
-
// onChangeValueFilter(column, val, true)
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
case 'Dropdown':
|
|
155
|
-
return (
|
|
156
|
-
/*#__PURE__*/
|
|
157
|
-
// <Select
|
|
158
|
-
// showSearch
|
|
159
|
-
// allowClear
|
|
160
|
-
// style={{ width: '100%' }}
|
|
161
|
-
// placeholder='Search to Select'
|
|
162
|
-
// optionFilterProp='label'
|
|
163
|
-
// value={valueFilter}
|
|
164
|
-
// mode={tmpColumn.filterOption?.multiple ? 'multiple' : undefined}
|
|
165
|
-
// options={options ?? []}
|
|
166
|
-
// onChange={val => {
|
|
167
|
-
// onChangeValueFilter(column, val)
|
|
168
|
-
// }}
|
|
169
|
-
// dropdownStyle={{ zIndex: 9999 }}
|
|
170
|
-
// popupClassName={'adv-popup-container'}
|
|
171
|
-
// getPopupContainer={() => menuRef.current}
|
|
172
|
-
// className='filter-item-control'
|
|
173
|
-
// />
|
|
174
|
-
React.createElement(AsyncSelect, {
|
|
175
|
-
showSearch: true,
|
|
176
|
-
allowClear: true,
|
|
177
|
-
style: {
|
|
178
|
-
width: '100%'
|
|
179
|
-
},
|
|
180
|
-
placeholder: "Search to Select",
|
|
181
|
-
optionFilterProp: "label",
|
|
182
|
-
value: valueFilter,
|
|
183
|
-
mode: tmpColumn.filterOption?.multiple ? 'multiple' : undefined,
|
|
184
|
-
options: options ?? [],
|
|
185
|
-
defaultOptions: options ?? [],
|
|
186
|
-
onChange: val => {
|
|
187
|
-
console.log(val);
|
|
188
|
-
// onChangeValueFilter(column, val)
|
|
189
|
-
},
|
|
190
|
-
loadOptions: loadOptions,
|
|
191
|
-
dropdownStyle: {
|
|
192
|
-
zIndex: 9999
|
|
193
|
-
},
|
|
194
|
-
popupClassName: 'adv-popup-container'
|
|
195
|
-
// getPopupContainer={() => menuRef.current}
|
|
196
|
-
,
|
|
197
|
-
className: "filter-item-control"
|
|
198
|
-
})
|
|
199
|
-
);
|
|
200
|
-
case 'CheckboxDropdown':
|
|
201
|
-
return /*#__PURE__*/React.createElement(TreeSelect, {
|
|
202
|
-
showSearch: true,
|
|
203
|
-
style: {
|
|
204
|
-
width: '100%'
|
|
205
|
-
},
|
|
206
|
-
value: valueFilter,
|
|
207
|
-
multiple: true,
|
|
208
|
-
treeCheckable: true,
|
|
209
|
-
dropdownStyle: {
|
|
210
|
-
maxHeight: 400,
|
|
211
|
-
overflow: 'auto',
|
|
212
|
-
zIndex: 9999
|
|
213
|
-
},
|
|
214
|
-
placeholder: "Please select",
|
|
215
|
-
allowClear: true,
|
|
216
|
-
maxTagCount: 'responsive',
|
|
217
|
-
onChange: val => {
|
|
218
|
-
console.log(val);
|
|
219
|
-
// onChangeValueFilter(column, val, true)
|
|
220
|
-
},
|
|
221
|
-
treeData: options,
|
|
222
|
-
popupClassName: 'adv-popup-container checkbox-dropdown'
|
|
223
|
-
// getPopupContainer={() => menuRef.current}
|
|
224
|
-
});
|
|
225
|
-
case 'DateRange':
|
|
226
|
-
return /*#__PURE__*/React.createElement(RangePicker, {
|
|
227
|
-
format: {
|
|
228
|
-
format: column.format?.dateFormat ?? 'DD/MM/YYYY',
|
|
229
|
-
type: 'mask'
|
|
230
|
-
},
|
|
231
|
-
defaultValue: valueFilter,
|
|
232
|
-
value: valueFilter,
|
|
233
|
-
placeholder: ['Ngày bắt đầu', 'Ngày kết thúc'],
|
|
234
|
-
popupStyle: {
|
|
235
|
-
zIndex: 9999
|
|
236
|
-
},
|
|
237
|
-
onChange: (value, dateString) => {
|
|
238
|
-
const newDateRangeValue = [dateString[0] ? convertDayjsToDate(dateString[0], column.format?.dateFormat ?? 'DD/MM/YYYY') : '', dateString[1] ? convertDayjsToDate(dateString[1], column.format?.dateFormat ?? 'DD/MM/YYYY') : ''];
|
|
239
|
-
console.log(newDateRangeValue);
|
|
240
|
-
|
|
241
|
-
// onChangeValueFilter(column, newDateRangeValue)
|
|
242
|
-
},
|
|
243
|
-
style: {
|
|
244
|
-
width: '100%'
|
|
245
|
-
},
|
|
246
|
-
popupClassName: 'adv-popup-container'
|
|
247
|
-
// getPopupContainer={() => menuRef.current}
|
|
248
|
-
});
|
|
249
|
-
case 'Date':
|
|
250
|
-
const dateValue = valueFilter ? convertDateToDayjs(valueFilter, column.format?.dateFormat ?? 'DD/MM/YYYY') : null;
|
|
251
|
-
return /*#__PURE__*/React.createElement(DatePicker, {
|
|
252
|
-
format: {
|
|
253
|
-
format: column.format?.dateFormat ?? 'DD/MM/YYYY',
|
|
254
|
-
type: 'mask'
|
|
255
|
-
},
|
|
256
|
-
style: {
|
|
257
|
-
width: '100%'
|
|
258
|
-
},
|
|
259
|
-
defaultValue: dateValue,
|
|
260
|
-
value: dateValue,
|
|
261
|
-
placeholder: 'Chọn ngày',
|
|
262
|
-
onChange: (val, dateString) => {
|
|
263
|
-
const newDateTimeValue = dateString ? convertDayjsToDate(dateString, column.format?.dateFormat ?? 'DD/MM/YYYY') : null;
|
|
264
|
-
// onChangeValueFilter(column, newDateTimeValue)
|
|
265
|
-
console.log(newDateTimeValue);
|
|
266
|
-
},
|
|
267
|
-
popupStyle: {
|
|
268
|
-
zIndex: 9999
|
|
269
|
-
},
|
|
270
|
-
popupClassName: 'adv-popup-container'
|
|
271
|
-
// getPopupContainer={() => menuRef.current}
|
|
272
|
-
});
|
|
273
|
-
case 'Datetime':
|
|
274
|
-
const dateTimeValue = valueFilter ? convertDateToDayjs(valueFilter, column.format?.dateFormat ?? 'DD/MM/YYYY HH:mm') : null;
|
|
275
|
-
return /*#__PURE__*/React.createElement(DatePicker, {
|
|
276
|
-
format: {
|
|
277
|
-
format: column.format?.datetimeFormat ?? 'DD/MM/YYYY HH:mm',
|
|
278
|
-
type: 'mask'
|
|
279
|
-
},
|
|
280
|
-
style: {
|
|
281
|
-
width: '100%'
|
|
282
|
-
},
|
|
283
|
-
showTime: column.typeFilter === 'Datetime',
|
|
284
|
-
defaultValue: dateTimeValue,
|
|
285
|
-
value: dateTimeValue,
|
|
286
|
-
placeholder: 'Chọn ngày',
|
|
287
|
-
onChange: (val, dateString) => {
|
|
288
|
-
const newDateTimeValue = dateString ? convertDayjsToDate(dateString, column.format?.datetimeFormat ?? 'DD/MM/YYYY HH:mm') : null;
|
|
289
|
-
console.log('newDateTimeValue', newDateTimeValue);
|
|
290
|
-
// onChangeValueFilter(column, newDateTimeValue)
|
|
291
|
-
},
|
|
292
|
-
popupStyle: {
|
|
293
|
-
zIndex: 9999
|
|
294
|
-
},
|
|
295
|
-
popupClassName: 'adv-popup-container'
|
|
296
|
-
});
|
|
297
|
-
case 'DropTree':
|
|
298
|
-
return /*#__PURE__*/React.createElement(TreeSelect, {
|
|
299
|
-
showSearch: true,
|
|
300
|
-
style: {
|
|
301
|
-
width: '100%'
|
|
302
|
-
},
|
|
303
|
-
value: valueFilter,
|
|
304
|
-
multiple: tmpColumn.filterOption?.multiple,
|
|
305
|
-
treeCheckable: tmpColumn.filterOption?.treeCheckable,
|
|
306
|
-
dropdownStyle: {
|
|
307
|
-
maxHeight: 400,
|
|
308
|
-
overflow: 'auto',
|
|
309
|
-
zIndex: 9999
|
|
310
|
-
},
|
|
311
|
-
placeholder: "Please select",
|
|
312
|
-
allowClear: true,
|
|
313
|
-
onChange: () => {
|
|
314
|
-
// onChangeValueFilter(column, val, tmpColumn.filterOption?.multiple)
|
|
315
|
-
},
|
|
316
|
-
treeData: options,
|
|
317
|
-
maxTagCount: 'responsive',
|
|
318
|
-
popupClassName: 'adv-popup-container'
|
|
319
|
-
});
|
|
320
|
-
case 'Time':
|
|
321
|
-
return /*#__PURE__*/React.createElement(TimePicker, {
|
|
322
|
-
format: {
|
|
323
|
-
format: column.format?.timeFormat ?? 'HH:mm',
|
|
324
|
-
type: 'mask'
|
|
325
|
-
},
|
|
326
|
-
defaultValue: valueFilter ?? null,
|
|
327
|
-
onChange: (values, timeString) => {
|
|
328
|
-
const newTimeValue = timeString ? timeString : null;
|
|
329
|
-
console.log(newTimeValue);
|
|
330
|
-
// onChangeValueFilter(column, newTimeValue)
|
|
331
|
-
},
|
|
332
|
-
style: {
|
|
333
|
-
width: '100%'
|
|
334
|
-
},
|
|
335
|
-
popupStyle: {
|
|
336
|
-
zIndex: 9999
|
|
337
|
-
},
|
|
338
|
-
popupClassName: 'adv-popup-container'
|
|
339
|
-
});
|
|
340
|
-
case 'Number':
|
|
341
|
-
const thousandSeparator = column.format?.thousandSeparator ? column.format?.thousandSeparator : format?.thousandSeparator;
|
|
342
|
-
const decimalSeparator = column.format?.decimalSeparator ? column.format?.decimalSeparator : format?.decimalSeparator;
|
|
343
|
-
const numericFormatProps = {
|
|
344
|
-
thousandSeparator: checkThousandSeparator(thousandSeparator, decimalSeparator),
|
|
345
|
-
decimalSeparator: checkDecimalSeparator(thousandSeparator, decimalSeparator),
|
|
346
|
-
decimalScale: !isObjEmpty(column.format?.decimalScale) ? column.format?.decimalScale : undefined,
|
|
347
|
-
fixedDecimalScale: !isEmpty(column.format?.fixedDecimalScale) ? column.format?.fixedDecimalScale : false,
|
|
348
|
-
allowNegative: column.format?.allowNegative ?? false,
|
|
349
|
-
prefix: column.format?.prefix ?? undefined,
|
|
350
|
-
suffix: column.format?.suffix ?? undefined
|
|
351
|
-
};
|
|
352
|
-
const valueNumeric = valueFilter || valueFilter === 0 ? valueFilter.toString() : '';
|
|
353
|
-
return /*#__PURE__*/React.createElement(NumericFormat, _extends({}, numericFormatProps, {
|
|
354
|
-
value: valueNumeric,
|
|
355
|
-
customInput: Input
|
|
356
|
-
// valueIsNumericString={true}
|
|
357
|
-
,
|
|
358
|
-
autoComplete: 'off',
|
|
359
|
-
className: classnames('adv-form-input form-control', {}),
|
|
360
|
-
onValueChange: values => {
|
|
361
|
-
console.log('values', values);
|
|
362
|
-
// onChangeValueFilter(column as any, values.floatValue)
|
|
363
|
-
}
|
|
364
|
-
}));
|
|
365
|
-
default:
|
|
366
|
-
return /*#__PURE__*/React.createElement(Input, {
|
|
367
|
-
placeholder: 'Nhập giá trị',
|
|
368
|
-
value: valueFilter ? valueFilter : '',
|
|
369
|
-
style: {
|
|
370
|
-
padding: '0.3rem 0.5rem',
|
|
371
|
-
lineHeight: '1.25'
|
|
372
|
-
},
|
|
373
|
-
autoFocus: index === 0,
|
|
374
|
-
onChange: val => {
|
|
375
|
-
console.log(val);
|
|
376
|
-
// onChangeValueFilter(column as any, val.target.value)
|
|
377
|
-
},
|
|
378
|
-
className: "adv-form-input"
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
};
|
|
382
|
-
const content = /*#__PURE__*/React.createElement("div", {
|
|
383
|
-
ref: menuRef,
|
|
384
|
-
className: 'd-flex flex-column'
|
|
385
|
-
}, /*#__PURE__*/React.createElement(MainFilter, {
|
|
386
|
-
leftFilterWidth: leftFilterWidth,
|
|
387
|
-
className: 'd-flex pb-1'
|
|
388
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
389
|
-
style: {
|
|
390
|
-
flex: 1
|
|
391
|
-
}
|
|
392
|
-
}, /*#__PURE__*/React.createElement(GridFilter, {
|
|
393
|
-
className: 'grid-filter'
|
|
394
|
-
}, columns.map((it, index) => {
|
|
395
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
396
|
-
className: 'grid-item-filter',
|
|
397
|
-
key: index
|
|
398
|
-
}, /*#__PURE__*/React.createElement("p", {
|
|
399
|
-
className: 'm-0',
|
|
400
|
-
style: {
|
|
401
|
-
minHeight: 21
|
|
402
|
-
}
|
|
403
|
-
}, t ? t(it.headerText ?? '') : it.headerText), renderFilter(it, index));
|
|
404
|
-
})))), /*#__PURE__*/React.createElement(BoxAction, {
|
|
405
|
-
className: ''
|
|
406
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
407
|
-
className: 'btn-action btn-action-cancel',
|
|
408
|
-
variant: "outlined",
|
|
409
|
-
onClick: handleReset
|
|
410
|
-
}, t ? t('Reset') : 'Reset'), /*#__PURE__*/React.createElement(Button, {
|
|
411
|
-
className: 'btn-action btn-action-cancel',
|
|
412
|
-
variant: "outlined",
|
|
413
|
-
onClick: handleCancel
|
|
414
|
-
}, t ? t('Cancel') : 'Cancel'), /*#__PURE__*/React.createElement(Button, {
|
|
415
|
-
className: classnames('btn-action btn-action-submit', {
|
|
416
|
-
disable: !columns.find(item => item.visible !== false || item.visible)
|
|
417
|
-
}),
|
|
418
|
-
variant: "outlined",
|
|
419
|
-
onClick: handleAccept,
|
|
420
|
-
disabled: !columns.find(item => item.visible !== false || item.visible)
|
|
421
|
-
}, t ? t('Accept') : 'Accept')));
|
|
422
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Popover, {
|
|
423
|
-
placement: 'bottomLeft'
|
|
424
|
-
// content={
|
|
425
|
-
// <div style={{minWidth: 250}}>
|
|
426
|
-
//
|
|
427
|
-
// </div>
|
|
428
|
-
// }
|
|
429
|
-
,
|
|
430
|
-
content: content,
|
|
431
|
-
trigger: "click",
|
|
432
|
-
open: clicked,
|
|
433
|
-
onOpenChange: handleClickChange,
|
|
434
|
-
arrow: false
|
|
435
|
-
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
436
|
-
arrow: false,
|
|
437
|
-
title: 'Cài đặt'
|
|
438
|
-
}, count > 0 ? /*#__PURE__*/React.createElement(Badge, {
|
|
439
|
-
size: "small",
|
|
440
|
-
count: count,
|
|
441
|
-
color: "danger"
|
|
442
|
-
}, /*#__PURE__*/React.createElement(Filter, {
|
|
443
|
-
fontSize: 16,
|
|
444
|
-
style: {
|
|
445
|
-
cursor: 'pointer'
|
|
446
|
-
}
|
|
447
|
-
})) : /*#__PURE__*/React.createElement(Filter, {
|
|
448
|
-
fontSize: 16,
|
|
449
|
-
style: {
|
|
450
|
-
cursor: 'pointer'
|
|
451
|
-
}
|
|
452
|
-
}))));
|
|
453
|
-
};
|
|
454
|
-
export default AdvanceFilter;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import type { TableLocale } from "rc-master-ui/es/table/interface";
|
|
3
|
-
type Props = {
|
|
4
|
-
options: any[];
|
|
5
|
-
filterSearch?: boolean;
|
|
6
|
-
open?: boolean;
|
|
7
|
-
tablePrefixCls?: string;
|
|
8
|
-
prefixCls?: string;
|
|
9
|
-
dropdownPrefixCls?: string;
|
|
10
|
-
filterMultiple: boolean;
|
|
11
|
-
showFilter?: boolean;
|
|
12
|
-
onSelect?: (value: any) => void;
|
|
13
|
-
selectedKeys: string[];
|
|
14
|
-
locale?: TableLocale;
|
|
15
|
-
filterMode?: 'menu' | 'tree';
|
|
16
|
-
searchValue: string;
|
|
17
|
-
setSearchValue: (value: any) => void;
|
|
18
|
-
};
|
|
19
|
-
declare const CheckboxFilter: (props: Props) => React.JSX.Element;
|
|
20
|
-
export default CheckboxFilter;
|