es-grid-template 1.8.64 → 1.8.66
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 +5 -5
- 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 +1 -8
- package/es/grid-component/hooks/utils.js +176 -144
- package/es/grid-component/index.d.ts +1 -1
- package/es/grid-component/index.js +0 -4
- package/es/grid-component/styles.scss +1394 -1394
- package/es/grid-component/type.d.ts +0 -407
- package/es/grid-component/type.js +490 -1
- package/es/table-component/type.d.ts +10 -0
- package/es/{grid-component → table-virtuoso}/ColumnsGroup/ColumnsGroup.js +4 -3
- package/es/{grid-component → table-virtuoso}/InternalTable.d.ts +2 -3
- package/es/table-virtuoso/InternalTable.js +391 -0
- package/es/table-virtuoso/body/TableBodyCell.d.ts +14 -0
- package/es/table-virtuoso/body/TableBodyCell.js +457 -0
- package/es/table-virtuoso/body/TableBodyRow.d.ts +13 -0
- package/es/table-virtuoso/body/TableBodyRow.js +112 -0
- package/es/table-virtuoso/footer/TableFooterCell.d.ts +7 -0
- package/es/table-virtuoso/footer/TableFooterCell.js +54 -0
- package/es/table-virtuoso/header/TableHeadCell.d.ts +14 -0
- package/es/table-virtuoso/header/TableHeadCell.js +265 -0
- package/es/table-virtuoso/header/renderFilter.d.ts +20 -0
- package/es/table-virtuoso/header/renderFilter.js +289 -0
- package/es/table-virtuoso/hook/constant.d.ts +73 -0
- package/es/table-virtuoso/hook/constant.js +240 -0
- package/es/table-virtuoso/hook/convert.d.ts +1 -0
- package/es/table-virtuoso/hook/convert.js +28 -0
- package/es/table-virtuoso/hook/useColumns.d.ts +28 -0
- package/es/table-virtuoso/hook/useColumns.js +302 -0
- package/es/table-virtuoso/hook/useFilterOperator.d.ts +7 -0
- package/es/table-virtuoso/hook/useFilterOperator.js +33 -0
- package/es/table-virtuoso/hook/utils.d.ts +159 -0
- package/es/table-virtuoso/hook/utils.js +2263 -0
- package/es/table-virtuoso/index.d.ts +2 -0
- package/es/table-virtuoso/index.js +2 -0
- package/es/table-virtuoso/style.d.ts +22 -0
- package/es/table-virtuoso/style.js +12 -0
- package/es/table-virtuoso/style.scss +1441 -0
- package/es/table-virtuoso/table/Grid.d.ts +37 -0
- package/es/table-virtuoso/table/Grid.js +298 -0
- package/es/table-virtuoso/table/TableContainer.d.ts +49 -0
- package/es/table-virtuoso/table/TableContainer.js +292 -0
- package/es/table-virtuoso/table/TableWrapper.d.ts +22 -0
- package/es/table-virtuoso/table/TableWrapper.js +161 -0
- package/es/table-virtuoso/type.d.ts +0 -0
- package/es/table-virtuoso/type.js +785 -0
- package/es/table-virtuoso/useContext.d.ts +97 -0
- package/es/table-virtuoso/useContext.js +21 -0
- package/lib/grid-component/TempTable.d.ts +2 -2
- package/lib/grid-component/TempTable.js +5 -7
- 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 +1 -8
- package/lib/grid-component/hooks/utils.js +179 -152
- package/lib/grid-component/index.d.ts +1 -1
- package/lib/grid-component/index.js +0 -3
- package/lib/grid-component/styles.scss +1394 -1394
- package/lib/grid-component/type.d.ts +0 -407
- package/lib/grid-component/type.js +490 -4
- package/lib/table-component/type.d.ts +10 -0
- package/lib/{grid-component → table-virtuoso}/ColumnsGroup/ColumnsGroup.js +4 -3
- package/lib/{grid-component → table-virtuoso}/InternalTable.d.ts +2 -3
- package/lib/table-virtuoso/InternalTable.js +400 -0
- package/lib/table-virtuoso/body/TableBodyCell.d.ts +14 -0
- package/lib/table-virtuoso/body/TableBodyCell.js +464 -0
- package/lib/table-virtuoso/body/TableBodyRow.d.ts +13 -0
- package/lib/table-virtuoso/body/TableBodyRow.js +119 -0
- package/lib/table-virtuoso/footer/TableFooterCell.d.ts +7 -0
- package/lib/table-virtuoso/footer/TableFooterCell.js +63 -0
- package/lib/table-virtuoso/header/TableHeadCell.d.ts +14 -0
- package/lib/table-virtuoso/header/TableHeadCell.js +274 -0
- package/lib/table-virtuoso/header/renderFilter.d.ts +20 -0
- package/lib/table-virtuoso/header/renderFilter.js +299 -0
- package/lib/table-virtuoso/hook/constant.d.ts +73 -0
- package/lib/table-virtuoso/hook/constant.js +247 -0
- package/lib/table-virtuoso/hook/convert.d.ts +1 -0
- package/lib/table-virtuoso/hook/convert.js +34 -0
- package/lib/table-virtuoso/hook/useColumns.d.ts +28 -0
- package/lib/table-virtuoso/hook/useColumns.js +315 -0
- package/lib/table-virtuoso/hook/useFilterOperator.d.ts +7 -0
- package/lib/table-virtuoso/hook/useFilterOperator.js +40 -0
- package/lib/table-virtuoso/hook/utils.d.ts +159 -0
- package/lib/table-virtuoso/hook/utils.js +2389 -0
- package/lib/table-virtuoso/index.d.ts +2 -0
- package/lib/table-virtuoso/index.js +9 -0
- package/lib/table-virtuoso/style.d.ts +22 -0
- package/lib/table-virtuoso/style.js +19 -0
- package/lib/table-virtuoso/style.scss +1441 -0
- package/lib/table-virtuoso/table/Grid.d.ts +37 -0
- package/lib/table-virtuoso/table/Grid.js +307 -0
- package/lib/table-virtuoso/table/TableContainer.d.ts +49 -0
- package/lib/table-virtuoso/table/TableContainer.js +300 -0
- package/lib/table-virtuoso/table/TableWrapper.d.ts +22 -0
- package/lib/table-virtuoso/table/TableWrapper.js +166 -0
- package/lib/table-virtuoso/type.d.ts +0 -0
- package/lib/table-virtuoso/type.js +786 -0
- package/lib/table-virtuoso/useContext.d.ts +97 -0
- package/lib/table-virtuoso/useContext.js +27 -0
- package/package.json +2 -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/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/ConvertColumnTable.d.ts +0 -7
- package/es/grid-component/ConvertColumnTable.js +0 -144
- 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/InternalTable.js +0 -1170
- 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/table/Grid.d.ts +0 -23
- package/es/grid-component/table/Grid.js +0 -49
- package/es/grid-component/table/GridEdit.d.ts +0 -23
- package/es/grid-component/table/GridEdit.js +0 -2726
- package/es/grid-component/table/Group.d.ts +0 -21
- package/es/grid-component/table/Group.js +0 -195
- package/es/grid-component/table/InfiniteTable.d.ts +0 -23
- package/es/grid-component/table/InfiniteTable.js +0 -101
- package/es/grid-component/useContext.d.ts +0 -34
- package/es/grid-component/useContext.js +0 -8
- 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/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/ConvertColumnTable.d.ts +0 -7
- package/lib/grid-component/ConvertColumnTable.js +0 -153
- 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/InternalTable.js +0 -1178
- 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/table/Grid.d.ts +0 -23
- package/lib/grid-component/table/Grid.js +0 -58
- package/lib/grid-component/table/GridEdit.d.ts +0 -23
- package/lib/grid-component/table/GridEdit.js +0 -2723
- package/lib/grid-component/table/Group.d.ts +0 -21
- package/lib/grid-component/table/Group.js +0 -204
- package/lib/grid-component/table/InfiniteTable.d.ts +0 -23
- package/lib/grid-component/table/InfiniteTable.js +0 -109
- package/lib/grid-component/useContext.d.ts +0 -34
- package/lib/grid-component/useContext.js +0 -13
- /package/es/{grid-component → table-virtuoso}/ColumnsGroup/ColumnsGroup.d.ts +0 -0
- /package/es/{grid-component → table-virtuoso}/ColumnsGroup/index.d.ts +0 -0
- /package/es/{grid-component → table-virtuoso}/ColumnsGroup/index.js +0 -0
- /package/lib/{grid-component → table-virtuoso}/ColumnsGroup/ColumnsGroup.d.ts +0 -0
- /package/lib/{grid-component → table-virtuoso}/ColumnsGroup/index.d.ts +0 -0
- /package/lib/{grid-component → table-virtuoso}/ColumnsGroup/index.js +0 -0
|
@@ -1,1170 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import React, { createContext, Fragment, useCallback, useContext, useState } from 'react';
|
|
3
|
-
import 'react-resizable/css/styles.css';
|
|
4
|
-
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
5
|
-
import { addRowIdArray, booleanOperator, checkDecimalSeparator, checkThousandSeparator, convertFilters, convertFlatColumn, filterDataByColumns4, findItemByKey, findItemPath, flattenArray, getAllRowKey, getFormat, getTypeFilter, groupArrayByColumns, isNullOrUndefined, numberOperator, removeColumns, removeInvisibleColumns, stringOperator, sumByField, translateOption, unFlattenData, updateArrayByKey, updateColumnsByGroup,
|
|
6
|
-
// updateData,
|
|
7
|
-
updateOrInsert } from "./hooks";
|
|
8
|
-
import ReactDOMServer from 'react-dom/server';
|
|
9
|
-
import dayjs from "dayjs";
|
|
10
|
-
import 'dayjs/locale/es';
|
|
11
|
-
import 'dayjs/locale/vi';
|
|
12
|
-
|
|
13
|
-
// import GridEdit from "./table/GridEdit"
|
|
14
|
-
// import InfiniteTable from "./table/InfiniteTable";
|
|
15
|
-
|
|
16
|
-
// import Grid from "./table/Grid"
|
|
17
|
-
import en from "rc-master-ui/es/date-picker/locale/en_US";
|
|
18
|
-
import vi from "rc-master-ui/es/date-picker/locale/vi_VN";
|
|
19
|
-
import enDr from "rc-master-ui/es/locales/en_US";
|
|
20
|
-
import viDr from "rc-master-ui/es/locales/vi_VN";
|
|
21
|
-
// import useColumns from "./hooks/useColumns";
|
|
22
|
-
|
|
23
|
-
import "./styles.scss";
|
|
24
|
-
// import 'rc-master-ui/es/date-range-picker/styles/index.less'
|
|
25
|
-
// import 'rc-master-ui/assets/index.css'
|
|
26
|
-
|
|
27
|
-
import { flatColumns2, renderContent, renderFilter } from "./hooks/columns";
|
|
28
|
-
import Group from "./table/Group";
|
|
29
|
-
import Swal from "sweetalert2";
|
|
30
|
-
import withReactContent from "sweetalert2-react-content";
|
|
31
|
-
import { Tooltip } from "react-tooltip";
|
|
32
|
-
import classNames from "classnames";
|
|
33
|
-
import HeaderContent from "./hooks/content/HeaderContent";
|
|
34
|
-
import { ArrowDown, ArrowUp, FilterFill, SortCancel } from "becoxy-icons";
|
|
35
|
-
import { Select } from "rc-master-ui";
|
|
36
|
-
import { Button, Modal, Space } from "antd";
|
|
37
|
-
import { SearchOutlined } from "@ant-design/icons";
|
|
38
|
-
import { restrictToHorizontalAxis } from "@dnd-kit/modifiers";
|
|
39
|
-
import { closestCenter, DndContext, DragOverlay, PointerSensor, useSensor, useSensors } from "@dnd-kit/core";
|
|
40
|
-
import { arrayMove, horizontalListSortingStrategy, SortableContext, useSortable } from "@dnd-kit/sortable";
|
|
41
|
-
// import {CSS} from "@dnd-kit/utilities";
|
|
42
|
-
import { Resizable } from "react-resizable";
|
|
43
|
-
import { faker } from "@faker-js/faker";
|
|
44
|
-
import useMergedState from "rc-util/es/hooks/useMergedState";
|
|
45
|
-
import { numericFormatter } from 'react-numeric-component';
|
|
46
|
-
// import Modal from 'antd/es/modal/Modal'
|
|
47
|
-
|
|
48
|
-
dayjs.extend(customParseFormat);
|
|
49
|
-
const MySwal = withReactContent(Swal);
|
|
50
|
-
const ASCEND = 'ascend';
|
|
51
|
-
const DESCEND = 'descend';
|
|
52
|
-
export const SELECTION_COLUMN = {};
|
|
53
|
-
const dragActiveStyle = (dragState, id) => {
|
|
54
|
-
const {
|
|
55
|
-
active,
|
|
56
|
-
over,
|
|
57
|
-
direction
|
|
58
|
-
} = dragState;
|
|
59
|
-
// drag active style
|
|
60
|
-
let style = {};
|
|
61
|
-
if (active && active === id) {
|
|
62
|
-
style = {
|
|
63
|
-
backgroundColor: '#c0c0c0',
|
|
64
|
-
opacity: 0.3
|
|
65
|
-
};
|
|
66
|
-
} else if (over && id === over && active !== over) {
|
|
67
|
-
style = direction === 'right' ? {
|
|
68
|
-
borderRight: '1px dashed gray'
|
|
69
|
-
} : {
|
|
70
|
-
borderLeft: '1px dashed gray'
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
return style;
|
|
74
|
-
};
|
|
75
|
-
const DragIndexContext = /*#__PURE__*/createContext({
|
|
76
|
-
active: -1,
|
|
77
|
-
over: -1
|
|
78
|
-
});
|
|
79
|
-
const ResizableTitle = props => {
|
|
80
|
-
const {
|
|
81
|
-
onResize,
|
|
82
|
-
width,
|
|
83
|
-
...restProps
|
|
84
|
-
} = props;
|
|
85
|
-
const dragState = useContext(DragIndexContext);
|
|
86
|
-
const style = {
|
|
87
|
-
...props.style,
|
|
88
|
-
borderBottom: '1px solid #e0e0e0',
|
|
89
|
-
// cursor: 'move',
|
|
90
|
-
// ...(isDragging ? { position: 'relative', zIndex: 9999, userSelect: 'none' } : {}),
|
|
91
|
-
...dragActiveStyle(dragState, props.id)
|
|
92
|
-
};
|
|
93
|
-
if (!width) {
|
|
94
|
-
return /*#__PURE__*/React.createElement("th", restProps);
|
|
95
|
-
}
|
|
96
|
-
return (
|
|
97
|
-
/*#__PURE__*/
|
|
98
|
-
// @ts-ignore
|
|
99
|
-
React.createElement(Resizable, {
|
|
100
|
-
width: width,
|
|
101
|
-
height: 0,
|
|
102
|
-
handle: /*#__PURE__*/React.createElement("span", {
|
|
103
|
-
className: "rc-resizable-handle",
|
|
104
|
-
onClick: e => {
|
|
105
|
-
e.stopPropagation();
|
|
106
|
-
}
|
|
107
|
-
}),
|
|
108
|
-
onResize: onResize,
|
|
109
|
-
draggableOpts: {
|
|
110
|
-
enableUserSelectHack: false
|
|
111
|
-
}
|
|
112
|
-
}, /*#__PURE__*/React.createElement("th", _extends({}, restProps, {
|
|
113
|
-
style: style
|
|
114
|
-
})))
|
|
115
|
-
);
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
// const TableBodyCell = (props: any) => {
|
|
119
|
-
// const dragState = useContext<DragIndexState>(DragIndexContext)
|
|
120
|
-
// return <div {...props} style={{ ...props.style, ...dragActiveStyle(dragState, props.id) }} />
|
|
121
|
-
// }
|
|
122
|
-
|
|
123
|
-
const SortableHeaderCell = ({
|
|
124
|
-
children,
|
|
125
|
-
columnKey
|
|
126
|
-
}) => {
|
|
127
|
-
const {
|
|
128
|
-
attributes,
|
|
129
|
-
listeners,
|
|
130
|
-
setNodeRef,
|
|
131
|
-
isDragging
|
|
132
|
-
} = useSortable({
|
|
133
|
-
id: columnKey
|
|
134
|
-
});
|
|
135
|
-
const style = {
|
|
136
|
-
// ...props.style,
|
|
137
|
-
cursor: 'move',
|
|
138
|
-
...(isDragging ? {
|
|
139
|
-
position: 'relative',
|
|
140
|
-
zIndex: 9999,
|
|
141
|
-
userSelect: 'none'
|
|
142
|
-
} : {})
|
|
143
|
-
// ...dragActiveStyle(dragState, props.id),
|
|
144
|
-
};
|
|
145
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
|
146
|
-
ref: setNodeRef,
|
|
147
|
-
style: style
|
|
148
|
-
}, attributes, listeners), children);
|
|
149
|
-
};
|
|
150
|
-
const InternalTable = props => {
|
|
151
|
-
const {
|
|
152
|
-
t,
|
|
153
|
-
id: tableId,
|
|
154
|
-
// columns,
|
|
155
|
-
columns: propsColumns,
|
|
156
|
-
lang,
|
|
157
|
-
locale,
|
|
158
|
-
dataSource,
|
|
159
|
-
dataSourceFilter: propDataSourceFilter,
|
|
160
|
-
// onFilterClick,
|
|
161
|
-
// onFilter,
|
|
162
|
-
editAble,
|
|
163
|
-
// rowKey: propRowKey,
|
|
164
|
-
format,
|
|
165
|
-
onDataChange,
|
|
166
|
-
sortMultiple,
|
|
167
|
-
// expandable,
|
|
168
|
-
// @ts-ignore
|
|
169
|
-
onCellPaste,
|
|
170
|
-
clickHeaderToSort = true,
|
|
171
|
-
// components,
|
|
172
|
-
onChooseColumns,
|
|
173
|
-
groupAble,
|
|
174
|
-
groupSetting,
|
|
175
|
-
groupColumns,
|
|
176
|
-
commandClick,
|
|
177
|
-
commandSettings,
|
|
178
|
-
pagination,
|
|
179
|
-
height: propsHeight,
|
|
180
|
-
summary,
|
|
181
|
-
// infiniteScroll,
|
|
182
|
-
wrapSettings,
|
|
183
|
-
onFilter,
|
|
184
|
-
onSorter,
|
|
185
|
-
// defaultSorter,
|
|
186
|
-
toolbarItems,
|
|
187
|
-
allowSortering,
|
|
188
|
-
allowFiltering,
|
|
189
|
-
...rest
|
|
190
|
-
} = props;
|
|
191
|
-
const theadRef = React.useRef(null);
|
|
192
|
-
const id = React.useMemo(() => {
|
|
193
|
-
return tableId ?? faker.string.alpha(20);
|
|
194
|
-
// return tableId ?? newGuid()
|
|
195
|
-
}, [tableId]);
|
|
196
|
-
|
|
197
|
-
// const rowKey = React.useMemo(() => {
|
|
198
|
-
// return propRowKey ?? 'rowId'
|
|
199
|
-
// }, [propRowKey])
|
|
200
|
-
|
|
201
|
-
const rowKey = 'rowId';
|
|
202
|
-
const getWindowSize = () => {
|
|
203
|
-
const {
|
|
204
|
-
innerWidth,
|
|
205
|
-
innerHeight
|
|
206
|
-
} = window;
|
|
207
|
-
return {
|
|
208
|
-
innerWidth,
|
|
209
|
-
innerHeight
|
|
210
|
-
};
|
|
211
|
-
};
|
|
212
|
-
const [windowSize, setWindowSize] = useState(getWindowSize());
|
|
213
|
-
React.useEffect(() => {
|
|
214
|
-
const handleWindowResize = () => {
|
|
215
|
-
setWindowSize(getWindowSize());
|
|
216
|
-
};
|
|
217
|
-
window.addEventListener("resize", handleWindowResize);
|
|
218
|
-
return () => {
|
|
219
|
-
window.removeEventListener("resize", handleWindowResize);
|
|
220
|
-
};
|
|
221
|
-
}, []);
|
|
222
|
-
const [scrollHeight, setHeight] = useState(0);
|
|
223
|
-
const [scrollHeight1, setHeight1] = useState(0);
|
|
224
|
-
|
|
225
|
-
// const [isModalOpen, setIsModalOpen] = useState(false)
|
|
226
|
-
|
|
227
|
-
const local = lang && lang === 'en' ? en : vi;
|
|
228
|
-
const dateRangeLocale = lang && lang === 'en' ? enDr : viDr;
|
|
229
|
-
const buddhistLocale = {
|
|
230
|
-
...local,
|
|
231
|
-
lang: {
|
|
232
|
-
...local.lang
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
// const [filterStates, setFilterState] = React.useState<any>(null)
|
|
237
|
-
// const [isFilter, setIsFilter] = React.useState<boolean>(false);
|
|
238
|
-
// const [cellTooltip, seCellTooltip] = React.useState<any>(undefined);
|
|
239
|
-
|
|
240
|
-
const [dragIndex, setDragIndex] = useState({
|
|
241
|
-
active: -1,
|
|
242
|
-
over: -1
|
|
243
|
-
});
|
|
244
|
-
// const [tooltipContent, setTooltipContent] = useState<any>('')
|
|
245
|
-
|
|
246
|
-
const [filterStates, setFilterState] = React.useState(null);
|
|
247
|
-
const [isFullScreen, setIsFullScreen] = React.useState(false);
|
|
248
|
-
const [isOpenTooltip, setIsOpenTooltip] = React.useState(false);
|
|
249
|
-
const mergedData = React.useMemo(() => {
|
|
250
|
-
if (groupSetting && groupSetting.client !== false) {
|
|
251
|
-
return groupArrayByColumns(dataSource, groupColumns);
|
|
252
|
-
}
|
|
253
|
-
return addRowIdArray(dataSource);
|
|
254
|
-
}, [dataSource, groupColumns, groupSetting?.client]);
|
|
255
|
-
|
|
256
|
-
// ========================= Keys =========================
|
|
257
|
-
const [mergedFilterKeys, setMergedFilterKeys] = useMergedState(getAllRowKey(mergedData), {
|
|
258
|
-
value: undefined
|
|
259
|
-
});
|
|
260
|
-
const [columns, setColumns] = React.useState([]);
|
|
261
|
-
React.useEffect(() => {
|
|
262
|
-
const totalHeight = propsHeight;
|
|
263
|
-
if (totalHeight) {
|
|
264
|
-
const table = document.querySelector(`#${id}`);
|
|
265
|
-
const title = table?.querySelector(`.ui-rc-table-title`);
|
|
266
|
-
const tableScrollRight = table?.querySelector(`.ui-rc-table-ping-right`);
|
|
267
|
-
const paginationE = table?.querySelector(`.ui-rc-pagination`);
|
|
268
|
-
const toolbar = table?.querySelector(`.ui-rc-toolbar-bottom`);
|
|
269
|
-
const summaryE = table?.querySelector(`.ui-rc-table-summary`);
|
|
270
|
-
const hhh = (totalHeight ?? 0) - (title ? title.offsetHeight : 0) - (theadRef ? theadRef.current.clientHeight : 0) - (paginationE ? paginationE.offsetHeight : 0) - (toolbar ? toolbar.offsetHeight : 0) - (summaryE ? 40 : 0) - (tableScrollRight ? 10 : 0);
|
|
271
|
-
setHeight(hhh > 0 ? hhh : 0);
|
|
272
|
-
}
|
|
273
|
-
}, [id, propsHeight, summary, theadRef, columns]);
|
|
274
|
-
React.useEffect(() => {
|
|
275
|
-
// const totalHeight = isFullScreen ? windowSize.innerHeight - 50 : propsHeight
|
|
276
|
-
const totalHeight = windowSize.innerHeight - 60;
|
|
277
|
-
if (totalHeight && isFullScreen) {
|
|
278
|
-
const table = document.querySelector(`#${id}`);
|
|
279
|
-
const title = table?.querySelector(`.ui-rc-table-title`);
|
|
280
|
-
const header = table?.querySelector(`.ui-rc-table-header`);
|
|
281
|
-
const paginationE = table?.querySelector(`.ui-rc-pagination`);
|
|
282
|
-
const toolbar = table?.querySelector(`.ui-rc-toolbar-bottom`);
|
|
283
|
-
const summaryE = table?.querySelector(`.ui-rc-table-summary`);
|
|
284
|
-
const scrollbar = table?.querySelector(`.ui-rc-table-tbody-virtual-scrollbar.ui-rc-table-tbody-virtual-scrollbar-horizontal`);
|
|
285
|
-
const hhh = (totalHeight ?? 0) - (title ? title.offsetHeight : 0) - (header ? header.offsetHeight : 0) - (paginationE ? paginationE.offsetHeight : 0) - (toolbar ? toolbar.offsetHeight : 0) - (summaryE ? summaryE.offsetHeight : 0) - (scrollbar ? scrollbar.offsetHeight : 0);
|
|
286
|
-
setHeight1(hhh > 0 ? hhh : 0);
|
|
287
|
-
}
|
|
288
|
-
}, [id, isFullScreen, windowSize.innerHeight, toolbarItems]);
|
|
289
|
-
const tableRef = React.useRef(null);
|
|
290
|
-
React.useEffect(() => {
|
|
291
|
-
setColumns(propsColumns);
|
|
292
|
-
}, [propsColumns]);
|
|
293
|
-
const handleOnFilter = queries => {
|
|
294
|
-
if (onFilter) {
|
|
295
|
-
onFilter?.(convertFilters(queries));
|
|
296
|
-
} else {
|
|
297
|
-
setFilterState(convertFilters(queries));
|
|
298
|
-
const b = filterDataByColumns4(mergedData, convertFilters(queries), []);
|
|
299
|
-
setMergedFilterKeys(getAllRowKey(b));
|
|
300
|
-
if (queries && queries.length > 0) {
|
|
301
|
-
// setIsFilter?.(true)
|
|
302
|
-
} else {
|
|
303
|
-
// setIsFilter?.(false)
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
const handleResize = column => (e, {
|
|
308
|
-
size
|
|
309
|
-
}) => {
|
|
310
|
-
const newColumn = {
|
|
311
|
-
...column,
|
|
312
|
-
width: size.width
|
|
313
|
-
};
|
|
314
|
-
const newColumns = updateArrayByKey(columns, newColumn, 'field');
|
|
315
|
-
setColumns(newColumns);
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
// ============================ RowKey ============================
|
|
319
|
-
const getRowKey = React.useMemo(() => {
|
|
320
|
-
if (typeof rowKey === 'function') {
|
|
321
|
-
return rowKey;
|
|
322
|
-
}
|
|
323
|
-
// @ts-ignore
|
|
324
|
-
return record => record?.[rowKey];
|
|
325
|
-
}, [rowKey]);
|
|
326
|
-
const firstNonGroupColumn = flatColumns2(columns).find(col => col.field && col.field !== '#' && !groupColumns?.includes(col.field) && col.hidden !== true);
|
|
327
|
-
const nonGroupColumns = flatColumns2(columns).filter(col => col.field && col.field !== '#' && !groupColumns?.includes(col.field) && col.hidden !== true);
|
|
328
|
-
const getColumnSearchProps = useCallback(column => ({
|
|
329
|
-
filterDropdown: ({
|
|
330
|
-
setSelectedKeys,
|
|
331
|
-
selectedKeys,
|
|
332
|
-
confirm,
|
|
333
|
-
setOperatorKey,
|
|
334
|
-
operatorKey,
|
|
335
|
-
visible,
|
|
336
|
-
searchValue,
|
|
337
|
-
setSearchValue
|
|
338
|
-
}) => {
|
|
339
|
-
const type = getTypeFilter(column);
|
|
340
|
-
// const operatorOptions = type === ('Checkbox' || 'Dropdown' || 'DropTree' || 'CheckboxDropdown') ? booleanOperator : (!type || type === 'Text' ? stringOperator : numberOperator)
|
|
341
|
-
|
|
342
|
-
const operatorOptions = ['Checkbox', 'Dropdown', 'DropTree', 'CheckboxDropdown'].includes(type) ? booleanOperator : !type || type === 'Text' ? stringOperator : numberOperator;
|
|
343
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
344
|
-
style: {
|
|
345
|
-
padding: 8,
|
|
346
|
-
minWidth: 275
|
|
347
|
-
},
|
|
348
|
-
onKeyDown: e => e.stopPropagation()
|
|
349
|
-
}, column?.showOperator !== false && column?.typeFilter !== 'DateRange' && column?.typeFilter !== 'NumberRange' && /*#__PURE__*/React.createElement("div", {
|
|
350
|
-
className: 'mb-1'
|
|
351
|
-
}, /*#__PURE__*/React.createElement(Select, {
|
|
352
|
-
options: translateOption(operatorOptions, t),
|
|
353
|
-
style: {
|
|
354
|
-
width: '100%',
|
|
355
|
-
marginBottom: 8
|
|
356
|
-
},
|
|
357
|
-
value: operatorKey,
|
|
358
|
-
onChange: val => {
|
|
359
|
-
setOperatorKey(val);
|
|
360
|
-
}
|
|
361
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
362
|
-
style: {
|
|
363
|
-
marginBottom: 8
|
|
364
|
-
}
|
|
365
|
-
}, renderFilter(column, selectedKeys, setSelectedKeys, confirm, visible, searchValue, setSearchValue, propDataSourceFilter ?? [], buddhistLocale, locale, t, format, dateRangeLocale)), /*#__PURE__*/React.createElement(Space, {
|
|
366
|
-
style: {
|
|
367
|
-
justifyContent: 'end',
|
|
368
|
-
width: '100%'
|
|
369
|
-
}
|
|
370
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
371
|
-
type: "primary",
|
|
372
|
-
onClick: () => {
|
|
373
|
-
// confirm({closeDropdown: false})
|
|
374
|
-
const typeFilter = getTypeFilter(column);
|
|
375
|
-
if ((!typeFilter || typeFilter === 'Text') && isNullOrUndefined(selectedKeys[0])) {
|
|
376
|
-
setSelectedKeys(['']);
|
|
377
|
-
}
|
|
378
|
-
confirm();
|
|
379
|
-
// handleSearch(selectedKeys as string[], confirm)
|
|
380
|
-
},
|
|
381
|
-
icon: /*#__PURE__*/React.createElement(SearchOutlined, null),
|
|
382
|
-
size: "small",
|
|
383
|
-
style: {
|
|
384
|
-
width: 90
|
|
385
|
-
}
|
|
386
|
-
}, t ? t('Filter') : 'Filter'), /*#__PURE__*/React.createElement(Button, {
|
|
387
|
-
type: "link",
|
|
388
|
-
size: "small",
|
|
389
|
-
onClick: () => {
|
|
390
|
-
// setSearchValue('')
|
|
391
|
-
setSelectedKeys([]);
|
|
392
|
-
confirm();
|
|
393
|
-
// handleSearch()
|
|
394
|
-
// close()
|
|
395
|
-
}
|
|
396
|
-
}, t ? t("Clear") : 'Clear')));
|
|
397
|
-
},
|
|
398
|
-
filterIcon: filtered => /*#__PURE__*/React.createElement(FilterFill, {
|
|
399
|
-
fontSize: 12
|
|
400
|
-
// onClick={() => {
|
|
401
|
-
// onFilterClick?.(column, onFilterCallback)
|
|
402
|
-
// }}
|
|
403
|
-
,
|
|
404
|
-
style: {
|
|
405
|
-
color: filtered ? '#E3165B' : '#283046'
|
|
406
|
-
}
|
|
407
|
-
}),
|
|
408
|
-
filterDropdownProps: {
|
|
409
|
-
onOpenChange(open) {
|
|
410
|
-
if (open) {
|
|
411
|
-
// setTimeout(() => searchInput.current?.select(), 100)
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
}), [t, propDataSourceFilter, buddhistLocale, locale, format, dateRangeLocale]);
|
|
416
|
-
const convertColumns = React.useMemo(() => {
|
|
417
|
-
return flatColumns2(columns).map((column, colIndex) => {
|
|
418
|
-
if (column === SELECTION_COLUMN) {
|
|
419
|
-
return SELECTION_COLUMN;
|
|
420
|
-
}
|
|
421
|
-
const transformedColumn = {
|
|
422
|
-
...column,
|
|
423
|
-
dataIndex: column.field ?? column.dataIndex,
|
|
424
|
-
key: column.field ?? column.key,
|
|
425
|
-
// title: () => (<HeaderContent column={{...column} as any} t={t}/>),
|
|
426
|
-
title:
|
|
427
|
-
/*#__PURE__*/
|
|
428
|
-
// <SortableHeaderCell columnKey={column.field}>
|
|
429
|
-
React.createElement(HeaderContent, {
|
|
430
|
-
column: {
|
|
431
|
-
...column
|
|
432
|
-
},
|
|
433
|
-
t: t,
|
|
434
|
-
id: id,
|
|
435
|
-
wrapSettings: wrapSettings
|
|
436
|
-
})
|
|
437
|
-
// </SortableHeaderCell>
|
|
438
|
-
,
|
|
439
|
-
// ellipsis: editAble || column.ellipsis !== false && wrapSettings && wrapSettings.wrapMode !== 'Content' && wrapSettings.wrapMode !== 'Both',
|
|
440
|
-
// ellipsis: column.ellipsis !== false || (wrapSettings && wrapSettings.wrapMode !== 'Content' && wrapSettings.wrapMode !== 'Both'),
|
|
441
|
-
ellipsis: false,
|
|
442
|
-
align: column.textAlign ?? column.align,
|
|
443
|
-
fixed: column.fixedType ?? column.fixed,
|
|
444
|
-
isSummary: column.isSummary ?? column.haveSum,
|
|
445
|
-
hidden: column.hidden ?? column.visible === false
|
|
446
|
-
};
|
|
447
|
-
const headerTooltip = t ? t?.(column.headerTooltip ?? column.columnGroupText ?? column.headerText) : column.headerTooltip ?? column.columnGroupText ?? column.headerText;
|
|
448
|
-
if (transformedColumn.field === '#') {
|
|
449
|
-
return {
|
|
450
|
-
...transformedColumn,
|
|
451
|
-
title: () => /*#__PURE__*/React.createElement(HeaderContent, {
|
|
452
|
-
column: {
|
|
453
|
-
...column
|
|
454
|
-
},
|
|
455
|
-
t: t,
|
|
456
|
-
id: id,
|
|
457
|
-
wrapSettings: wrapSettings
|
|
458
|
-
}),
|
|
459
|
-
onCell: data => ({
|
|
460
|
-
// className: 'cell-number',
|
|
461
|
-
className: classNames('cell-number', {
|
|
462
|
-
'cell-group': groupColumns && data.children
|
|
463
|
-
})
|
|
464
|
-
}),
|
|
465
|
-
render: (val, record) => {
|
|
466
|
-
const tmpData = filterDataByColumns4(mergedData, filterStates, mergedFilterKeys);
|
|
467
|
-
if (pagination && pagination.onChange && pagination.currentPage && pagination.pageSize) {
|
|
468
|
-
return findItemPath(tmpData, record, rowKey, pagination.currentPage, pagination.pageSize);
|
|
469
|
-
}
|
|
470
|
-
return findItemPath(tmpData, record, rowKey);
|
|
471
|
-
}
|
|
472
|
-
};
|
|
473
|
-
}
|
|
474
|
-
if (transformedColumn.field === 'command') {
|
|
475
|
-
return {
|
|
476
|
-
...transformedColumn,
|
|
477
|
-
title: () => /*#__PURE__*/React.createElement(HeaderContent, {
|
|
478
|
-
column: {
|
|
479
|
-
...column
|
|
480
|
-
},
|
|
481
|
-
t: t,
|
|
482
|
-
id: id,
|
|
483
|
-
wrapSettings: wrapSettings
|
|
484
|
-
}),
|
|
485
|
-
onCell: data => ({
|
|
486
|
-
// className: 'cell-number',
|
|
487
|
-
className: classNames('', {
|
|
488
|
-
'cell-group': groupColumns && data.children
|
|
489
|
-
}),
|
|
490
|
-
style: {
|
|
491
|
-
padding: '2px 8px'
|
|
492
|
-
}
|
|
493
|
-
})
|
|
494
|
-
};
|
|
495
|
-
}
|
|
496
|
-
return {
|
|
497
|
-
...transformedColumn,
|
|
498
|
-
...(transformedColumn.allowFiltering === false || allowFiltering === false ? {} : {
|
|
499
|
-
...getColumnSearchProps(column)
|
|
500
|
-
}),
|
|
501
|
-
sorter: column.sorter === false || allowSortering === false ? undefined : {
|
|
502
|
-
// @ts-ignore
|
|
503
|
-
compare: (a, b) => onSorter ? a : a[column.field] - b[column.field],
|
|
504
|
-
multiple: sortMultiple ? colIndex : undefined
|
|
505
|
-
},
|
|
506
|
-
// @ts-ignore
|
|
507
|
-
// sorter: (a, b) => a[column.field] - b[column.field],
|
|
508
|
-
|
|
509
|
-
sortIcon: args => {
|
|
510
|
-
const {
|
|
511
|
-
sortOrder
|
|
512
|
-
} = args;
|
|
513
|
-
return /*#__PURE__*/React.createElement(Fragment, null, !sortOrder && /*#__PURE__*/React.createElement(SortCancel, {
|
|
514
|
-
fontSize: 15,
|
|
515
|
-
style: {
|
|
516
|
-
display: 'flex',
|
|
517
|
-
opacity: 0,
|
|
518
|
-
marginLeft: 4
|
|
519
|
-
},
|
|
520
|
-
className: classNames(`ui-rc-table-column-sorter-up`, {
|
|
521
|
-
active: true
|
|
522
|
-
})
|
|
523
|
-
}), sortOrder === ASCEND && /*#__PURE__*/React.createElement("span", {
|
|
524
|
-
className: classNames(`ui-rc-table-column-sorter-up`, {
|
|
525
|
-
active: sortOrder === ASCEND
|
|
526
|
-
}),
|
|
527
|
-
style: {
|
|
528
|
-
display: 'flex',
|
|
529
|
-
marginLeft: 4
|
|
530
|
-
}
|
|
531
|
-
}, /*#__PURE__*/React.createElement(ArrowUp, {
|
|
532
|
-
fontSize: 15,
|
|
533
|
-
color: '#000'
|
|
534
|
-
})), sortOrder === DESCEND && /*#__PURE__*/React.createElement("span", {
|
|
535
|
-
className: classNames(`ui-rc-table-column-sorter-up`, {
|
|
536
|
-
active: sortOrder === DESCEND
|
|
537
|
-
}),
|
|
538
|
-
style: {
|
|
539
|
-
display: 'flex',
|
|
540
|
-
marginLeft: 4
|
|
541
|
-
}
|
|
542
|
-
}, /*#__PURE__*/React.createElement(ArrowDown, {
|
|
543
|
-
fontSize: 15,
|
|
544
|
-
color: '#000'
|
|
545
|
-
})));
|
|
546
|
-
},
|
|
547
|
-
onHeaderCell: () => ({
|
|
548
|
-
id: `${column.field}`,
|
|
549
|
-
// width: column.width,
|
|
550
|
-
|
|
551
|
-
'data-tooltip-id': `${id}-tooltip-header`,
|
|
552
|
-
'data-tooltip-content': headerTooltip,
|
|
553
|
-
onResize: handleResize?.(column),
|
|
554
|
-
className: classNames('', {
|
|
555
|
-
'head-align-center': column.headerTextAlign === 'center',
|
|
556
|
-
'head-align-right': column.headerTextAlign === 'right',
|
|
557
|
-
'ui-rc-table-cell-ellipsis': !wrapSettings || !!(wrapSettings && wrapSettings.wrapMode === 'Content'),
|
|
558
|
-
// mặc định = true
|
|
559
|
-
'ui-rc-table-cell-wrap': wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Header')
|
|
560
|
-
})
|
|
561
|
-
}),
|
|
562
|
-
onCell: (data, index) => {
|
|
563
|
-
const tooltipContent = isOpenTooltip === false ? '' : column?.tooltipDescription ? typeof column.tooltipDescription === 'function' ? column.tooltipDescription({
|
|
564
|
-
value: data[column.field ?? ''],
|
|
565
|
-
record: data
|
|
566
|
-
}) : column.tooltipDescription : column.template && typeof column.template !== 'function' ? column.template : data[column.field ?? ''];
|
|
567
|
-
return {
|
|
568
|
-
id: `${column.field}`,
|
|
569
|
-
colSpan: groupColumns && data.children && column.field === firstNonGroupColumn?.field ? groupSetting?.groupColumnSpan ?? 2 : groupColumns && data.children && nonGroupColumns[1].field === column.field ? 0 : 1,
|
|
570
|
-
// 'z-index': data?.children && column.field === firstNonGroupColumn?.field ? 11 : undefined,
|
|
571
|
-
...transformedColumn?.onCell?.(data, index),
|
|
572
|
-
className: classNames(transformedColumn?.onCell?.(data, index).className ?? '', {
|
|
573
|
-
'cell-group': groupColumns && data.children,
|
|
574
|
-
'cell-group-fixed': groupColumns && data.children && column.field === firstNonGroupColumn?.field,
|
|
575
|
-
'ui-rc-table-cell-ellipsis': !wrapSettings || wrapSettings && (wrapSettings.wrapMode === 'Header' || wrapSettings.wrapMode !== 'Both'),
|
|
576
|
-
// mặc định = true
|
|
577
|
-
'ui-rc-table-cell-wrap': wrapSettings && (wrapSettings.wrapMode === 'Content' || wrapSettings.wrapMode === 'Both')
|
|
578
|
-
}),
|
|
579
|
-
'data-tooltip-id': `${id}-tooltip-cell-content`,
|
|
580
|
-
"data-tooltip-html": ReactDOMServer.renderToStaticMarkup( /*#__PURE__*/React.createElement(React.Fragment, null, tooltipContent)),
|
|
581
|
-
onMouseEnter: e => {
|
|
582
|
-
if (e.target.firstChild?.clientWidth <= e.target.firstChild?.scrollWidth) {
|
|
583
|
-
if (e.target.firstChild?.clientWidth < e.target.firstChild?.scrollWidth) {
|
|
584
|
-
setIsOpenTooltip(true);
|
|
585
|
-
} else {
|
|
586
|
-
setIsOpenTooltip(false);
|
|
587
|
-
}
|
|
588
|
-
} else {
|
|
589
|
-
if (e.target.clientWidth < e.target.scrollWidth) {
|
|
590
|
-
setIsOpenTooltip(true);
|
|
591
|
-
} else {
|
|
592
|
-
setIsOpenTooltip(false);
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
};
|
|
597
|
-
},
|
|
598
|
-
render: (value, record, rowIndex) => {
|
|
599
|
-
const colFormat = typeof column.format === 'function' ? column.format(record) : column.format;
|
|
600
|
-
const cellFormat = getFormat(colFormat, format);
|
|
601
|
-
if (groupAble && groupSetting && groupSetting.hiddenColumnGroup === false) {
|
|
602
|
-
if (record.children) {
|
|
603
|
-
return renderContent(column, value, record, rowIndex, colIndex, false, cellFormat);
|
|
604
|
-
}
|
|
605
|
-
if (groupColumns?.includes(column.field)) {
|
|
606
|
-
return '';
|
|
607
|
-
}
|
|
608
|
-
return renderContent(column, value, record, rowIndex, colIndex, false, cellFormat);
|
|
609
|
-
}
|
|
610
|
-
if (groupAble && column.field === firstNonGroupColumn?.field && record.children) {
|
|
611
|
-
const currentGroupColumn = flatColumns2(columns).find(it => it.field === record.field);
|
|
612
|
-
if (currentGroupColumn?.template) {
|
|
613
|
-
return renderContent(currentGroupColumn, record[record.field], record, rowIndex, colIndex, false, cellFormat);
|
|
614
|
-
}
|
|
615
|
-
return /*#__PURE__*/React.createElement("span", null, currentGroupColumn?.headerText, ": ", renderContent(currentGroupColumn, record[record.field], record, rowIndex, colIndex, false, cellFormat));
|
|
616
|
-
}
|
|
617
|
-
if (groupAble && record.children && column.sumGroup === true && column.type === 'number') {
|
|
618
|
-
const thousandSeparator = cellFormat?.thousandSeparator;
|
|
619
|
-
const decimalSeparator = cellFormat?.decimalSeparator;
|
|
620
|
-
const dec = cellFormat?.decimalScale;
|
|
621
|
-
const numericFormatProps = {
|
|
622
|
-
thousandSeparator: checkThousandSeparator(thousandSeparator, decimalSeparator),
|
|
623
|
-
decimalSeparator: checkDecimalSeparator(thousandSeparator, decimalSeparator),
|
|
624
|
-
allowNegative: cellFormat?.allowNegative ?? true,
|
|
625
|
-
prefix: cellFormat?.prefix,
|
|
626
|
-
suffix: cellFormat?.suffix,
|
|
627
|
-
decimalScale: dec,
|
|
628
|
-
fixedDecimalScale: cellFormat?.fixedDecimalScale ?? false
|
|
629
|
-
};
|
|
630
|
-
const sumValue = sumByField(filterDataByColumns4(record.children, [], []), column?.field);
|
|
631
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, numericFormatter(sumValue.toString(), numericFormatProps));
|
|
632
|
-
}
|
|
633
|
-
return renderContent(column, value, record, rowIndex, colIndex, false, cellFormat);
|
|
634
|
-
},
|
|
635
|
-
// defaultSortOrder: 'ascend',
|
|
636
|
-
|
|
637
|
-
hidden: groupSetting && groupSetting.hiddenColumnGroup === false ? transformedColumn.hidden : groupAble && groupColumns && groupColumns.includes(column.field) ? true : transformedColumn.hidden
|
|
638
|
-
};
|
|
639
|
-
});
|
|
640
|
-
}, [columns, t, id, wrapSettings, editAble, getColumnSearchProps, groupSetting, groupAble, groupColumns, mergedData, filterStates, mergedFilterKeys, pagination, handleResize, firstNonGroupColumn?.field, nonGroupColumns, format]);
|
|
641
|
-
const transformColumns = React.useCallback(cols => {
|
|
642
|
-
return cols.map(column => {
|
|
643
|
-
const find = convertColumns.find(it => it.field === column.field);
|
|
644
|
-
if (column === SELECTION_COLUMN) {
|
|
645
|
-
return SELECTION_COLUMN;
|
|
646
|
-
}
|
|
647
|
-
const tmpColumn = {
|
|
648
|
-
...column,
|
|
649
|
-
dataIndex: column.field ?? column.dataIndex,
|
|
650
|
-
key: column.field ?? column.key,
|
|
651
|
-
title: /*#__PURE__*/React.createElement(SortableHeaderCell, {
|
|
652
|
-
columnKey: column.field
|
|
653
|
-
}, /*#__PURE__*/React.createElement(HeaderContent, {
|
|
654
|
-
column: {
|
|
655
|
-
...column
|
|
656
|
-
},
|
|
657
|
-
t: t,
|
|
658
|
-
id: id,
|
|
659
|
-
wrapSettings: wrapSettings
|
|
660
|
-
})),
|
|
661
|
-
ellipsis: false,
|
|
662
|
-
// ellipsis: editAble || column.ellipsis !== false && wrapSettings && wrapSettings.wrapMode !== 'Content' && wrapSettings.wrapMode !== 'Both',
|
|
663
|
-
|
|
664
|
-
align: column.textAlign ?? column.align,
|
|
665
|
-
fixed: column.fixedType ?? column.fixed,
|
|
666
|
-
isSummary: column.isSummary ?? column.haveSum,
|
|
667
|
-
hidden: column.hidden ?? column.visible === false
|
|
668
|
-
// defaultSortOrder: 'ascend'
|
|
669
|
-
};
|
|
670
|
-
|
|
671
|
-
// Xử lý đệ quy cho children
|
|
672
|
-
if (column.children?.length) {
|
|
673
|
-
return {
|
|
674
|
-
...column,
|
|
675
|
-
...tmpColumn,
|
|
676
|
-
children: transformColumns(column.children)
|
|
677
|
-
};
|
|
678
|
-
}
|
|
679
|
-
if (find) {
|
|
680
|
-
return {
|
|
681
|
-
...find
|
|
682
|
-
};
|
|
683
|
-
}
|
|
684
|
-
if (!find) {
|
|
685
|
-
return {
|
|
686
|
-
...column,
|
|
687
|
-
...tmpColumn
|
|
688
|
-
};
|
|
689
|
-
}
|
|
690
|
-
});
|
|
691
|
-
}, [convertColumns, editAble, id, t, wrapSettings]);
|
|
692
|
-
const mergedColumns = React.useMemo(() => {
|
|
693
|
-
return transformColumns(columns);
|
|
694
|
-
}, [columns, transformColumns]);
|
|
695
|
-
const sensors = useSensors(useSensor(PointerSensor, {
|
|
696
|
-
activationConstraint: {
|
|
697
|
-
distance: 1
|
|
698
|
-
}
|
|
699
|
-
}));
|
|
700
|
-
const triggerChangeColumns = (newColumns, type) => {
|
|
701
|
-
setColumns(newColumns);
|
|
702
|
-
if (tableRef.current && type === 'columnChoose') {
|
|
703
|
-
tableRef.current.scrollTo({
|
|
704
|
-
left: 0.1,
|
|
705
|
-
behavior: "smooth"
|
|
706
|
-
});
|
|
707
|
-
}
|
|
708
|
-
onChooseColumns?.({
|
|
709
|
-
showColumns: removeInvisibleColumns([...newColumns]),
|
|
710
|
-
columns: [...newColumns],
|
|
711
|
-
flattenColumns: convertFlatColumn([...newColumns])
|
|
712
|
-
});
|
|
713
|
-
};
|
|
714
|
-
const onDragEnd = ({
|
|
715
|
-
active,
|
|
716
|
-
over
|
|
717
|
-
}) => {
|
|
718
|
-
if (active.id !== over?.id) {
|
|
719
|
-
const targetColumn = flatColumns2(columns).find(it => it.field === over?.id);
|
|
720
|
-
const activeIndex = flatColumns2(columns).findIndex(i => i.field === active?.id);
|
|
721
|
-
const overIndex = flatColumns2(columns).findIndex(i => i.field === over?.id);
|
|
722
|
-
const rs = arrayMove(columns, activeIndex, overIndex);
|
|
723
|
-
triggerChangeColumns(rs, targetColumn && targetColumn.fixed === 'left' ? 'columnChoose' : '');
|
|
724
|
-
}
|
|
725
|
-
setDragIndex({
|
|
726
|
-
active: -1,
|
|
727
|
-
over: -1
|
|
728
|
-
});
|
|
729
|
-
};
|
|
730
|
-
const onDragOver = ({
|
|
731
|
-
active,
|
|
732
|
-
over
|
|
733
|
-
}) => {
|
|
734
|
-
const activeIndex = columns.findIndex(i => i.field === active.id);
|
|
735
|
-
const overIndex = columns.findIndex(i => i.field === over?.id);
|
|
736
|
-
setDragIndex({
|
|
737
|
-
active: active.id,
|
|
738
|
-
over: over?.id,
|
|
739
|
-
direction: overIndex > activeIndex ? 'right' : 'left'
|
|
740
|
-
});
|
|
741
|
-
};
|
|
742
|
-
const triggerGroupColumns = groupedColumns => {
|
|
743
|
-
setColumns(updateColumnsByGroup(mergedColumns, groupedColumns));
|
|
744
|
-
if (groupSetting) {
|
|
745
|
-
if (groupSetting.client === false) {
|
|
746
|
-
|
|
747
|
-
// setIsTree(true)
|
|
748
|
-
|
|
749
|
-
// setGroupOpen([])
|
|
750
|
-
|
|
751
|
-
// const dt = ungroupArray(dataSource)
|
|
752
|
-
|
|
753
|
-
// const rs = groupArrayByColumns2(dt, [...value])
|
|
754
|
-
|
|
755
|
-
// setResource([...rs])
|
|
756
|
-
|
|
757
|
-
// if (groupSetting.onGroup) {
|
|
758
|
-
// groupSetting.onGroup({
|
|
759
|
-
// columnGrouped: value,
|
|
760
|
-
// columns: removeColumns(columns as any, value),
|
|
761
|
-
// flattenColumns: convertFlatColumn(removeColumns(columns as any, value)) as any
|
|
762
|
-
//
|
|
763
|
-
// })
|
|
764
|
-
// }
|
|
765
|
-
} else {
|
|
766
|
-
if (groupSetting.onGroup) {
|
|
767
|
-
groupSetting.onGroup({
|
|
768
|
-
columnGrouped: groupedColumns,
|
|
769
|
-
columns: removeColumns(columns, groupedColumns),
|
|
770
|
-
flattenColumns: flatColumns2(removeColumns(columns, groupedColumns))
|
|
771
|
-
});
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
};
|
|
776
|
-
const triggerChangeData = newData => {
|
|
777
|
-
// setIsManualUpdate(true)
|
|
778
|
-
// setData(newData)
|
|
779
|
-
// setMergedData(newData)
|
|
780
|
-
onDataChange?.(newData);
|
|
781
|
-
// onDataChange?.(removeFieldRecursive(newData, 'isFilterState'))
|
|
782
|
-
};
|
|
783
|
-
const triggerCommandClick = args => {
|
|
784
|
-
const {
|
|
785
|
-
id: idCommand,
|
|
786
|
-
rowId,
|
|
787
|
-
rowData,
|
|
788
|
-
index
|
|
789
|
-
} = args;
|
|
790
|
-
|
|
791
|
-
// const tmpData = [...mergedData]
|
|
792
|
-
const tmpData = filterDataByColumns4(mergedData, filterStates, mergedFilterKeys);
|
|
793
|
-
if (idCommand === 'DELETE') {
|
|
794
|
-
// bật modal confirm
|
|
795
|
-
if (commandSettings && commandSettings.confirmDialog) {
|
|
796
|
-
MySwal.fire({
|
|
797
|
-
title: t ? t('Confirm') : 'Confirm',
|
|
798
|
-
text: t ? t('Do you want to delete item?') : 'Do you want to delete item?',
|
|
799
|
-
// icon: 'warning',
|
|
800
|
-
allowOutsideClick: false,
|
|
801
|
-
showCancelButton: true,
|
|
802
|
-
confirmButtonText: t ? t('Delete') : 'Delete',
|
|
803
|
-
cancelButtonText: t ? t('Cancel') : 'Cancel',
|
|
804
|
-
customClass: {
|
|
805
|
-
confirmButton: 'be-button btn-primary',
|
|
806
|
-
cancelButton: 'be-button btn-danger ms-1'
|
|
807
|
-
},
|
|
808
|
-
buttonsStyling: false
|
|
809
|
-
}).then(async result => {
|
|
810
|
-
if (result.value) {
|
|
811
|
-
if (!commandSettings || commandSettings && commandSettings.client !== false) {
|
|
812
|
-
// client
|
|
813
|
-
|
|
814
|
-
// kiểm tra dòng hiện tại có parent
|
|
815
|
-
|
|
816
|
-
let newData = [];
|
|
817
|
-
if (rowData?.parentId) {
|
|
818
|
-
const parent = findItemByKey(tmpData, rowKey, rowData.parentId);
|
|
819
|
-
const childData = parent?.children ? [...parent.children] : [];
|
|
820
|
-
const findIndex = childData.findIndex(obj => obj[rowKey] === rowData[rowKey]);
|
|
821
|
-
childData.splice(Number(findIndex), 1);
|
|
822
|
-
const newRowData = {
|
|
823
|
-
...parent,
|
|
824
|
-
children: childData
|
|
825
|
-
};
|
|
826
|
-
// const newDataSource = updateArrayByKey(tmpData, newRowData, rowKey as string)
|
|
827
|
-
newData = updateArrayByKey(tmpData, newRowData, rowKey);
|
|
828
|
-
} else {
|
|
829
|
-
tmpData.splice(Number(index), 1);
|
|
830
|
-
newData = [...tmpData];
|
|
831
|
-
}
|
|
832
|
-
if (commandClick) {
|
|
833
|
-
commandClick({
|
|
834
|
-
id: idCommand,
|
|
835
|
-
rowId: rowData.rowId,
|
|
836
|
-
rowData,
|
|
837
|
-
index,
|
|
838
|
-
// rows: [...tmpData]
|
|
839
|
-
rows: [...newData]
|
|
840
|
-
});
|
|
841
|
-
}
|
|
842
|
-
} else {
|
|
843
|
-
// server ~~ không làm gì
|
|
844
|
-
if (commandClick) {
|
|
845
|
-
commandClick({
|
|
846
|
-
id: idCommand,
|
|
847
|
-
rowId: rowData.rowId,
|
|
848
|
-
rowData,
|
|
849
|
-
index,
|
|
850
|
-
rows: [...mergedData]
|
|
851
|
-
});
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
} else if (result.dismiss === MySwal.DismissReason.cancel) {}
|
|
855
|
-
});
|
|
856
|
-
} else {
|
|
857
|
-
// -------------------
|
|
858
|
-
|
|
859
|
-
if (!commandSettings || commandSettings && commandSettings.client !== false) {
|
|
860
|
-
// client
|
|
861
|
-
|
|
862
|
-
let newData2 = [];
|
|
863
|
-
if (rowData?.parentId) {
|
|
864
|
-
const parent = findItemByKey(mergedData, rowKey, rowData.parentId);
|
|
865
|
-
const childData = parent?.children ? [...parent.children] : [];
|
|
866
|
-
const findIndex = childData.findIndex(obj => obj[rowKey] === rowData[rowKey]);
|
|
867
|
-
childData.splice(Number(findIndex), 1);
|
|
868
|
-
const newRowData = {
|
|
869
|
-
...parent,
|
|
870
|
-
children: childData
|
|
871
|
-
};
|
|
872
|
-
newData2 = updateArrayByKey(tmpData, newRowData, rowKey);
|
|
873
|
-
} else {
|
|
874
|
-
tmpData.splice(Number(index), 1);
|
|
875
|
-
newData2 = [...tmpData];
|
|
876
|
-
}
|
|
877
|
-
if (commandClick) {
|
|
878
|
-
commandClick({
|
|
879
|
-
id: idCommand,
|
|
880
|
-
rowId,
|
|
881
|
-
rowData,
|
|
882
|
-
index,
|
|
883
|
-
rows: [...newData2]
|
|
884
|
-
});
|
|
885
|
-
}
|
|
886
|
-
} else {
|
|
887
|
-
// server
|
|
888
|
-
if (commandClick) {
|
|
889
|
-
commandClick({
|
|
890
|
-
id: idCommand,
|
|
891
|
-
rowId,
|
|
892
|
-
rowData,
|
|
893
|
-
index,
|
|
894
|
-
rows: [...mergedData]
|
|
895
|
-
});
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
} else {
|
|
900
|
-
if (commandClick) {
|
|
901
|
-
commandClick(args);
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
};
|
|
905
|
-
const triggerPaste = (pastedRows, pastedColumnsArray, newData, copyRows) => {
|
|
906
|
-
const handlePasteCallback = callbackData => {
|
|
907
|
-
// const newDataUpdate = updateData(mergedData, callbackData, rowKey as any)
|
|
908
|
-
|
|
909
|
-
const rsFilterData = updateOrInsert(flattenArray([...mergedData]), callbackData);
|
|
910
|
-
const rs = unFlattenData(rsFilterData);
|
|
911
|
-
triggerChangeData(rs);
|
|
912
|
-
|
|
913
|
-
// onCellPaste?.dataChange?.(newDataUpdate)
|
|
914
|
-
};
|
|
915
|
-
if (onCellPaste && onCellPaste.onPasted) {
|
|
916
|
-
if (onCellPaste.onPasted.length > 1) {
|
|
917
|
-
// có callback
|
|
918
|
-
onCellPaste.onPasted({
|
|
919
|
-
pasteData: pastedRows,
|
|
920
|
-
copyRows,
|
|
921
|
-
type: 'onPaste',
|
|
922
|
-
data: mergedData,
|
|
923
|
-
pastedColumns: pastedColumnsArray
|
|
924
|
-
}, handlePasteCallback);
|
|
925
|
-
} else {
|
|
926
|
-
// không có callback
|
|
927
|
-
onCellPaste.onPasted({
|
|
928
|
-
pasteData: pastedRows,
|
|
929
|
-
type: 'onPaste',
|
|
930
|
-
copyRows,
|
|
931
|
-
data: mergedData,
|
|
932
|
-
pastedColumns: pastedColumnsArray
|
|
933
|
-
}, handlePasteCallback);
|
|
934
|
-
triggerChangeData(newData);
|
|
935
|
-
|
|
936
|
-
// onCellPaste.dataChange?.(newData)
|
|
937
|
-
}
|
|
938
|
-
} else {
|
|
939
|
-
triggerChangeData(newData);
|
|
940
|
-
}
|
|
941
|
-
};
|
|
942
|
-
const handleChange = (paging, filters, sorter) => {
|
|
943
|
-
onSorter?.(sorter);
|
|
944
|
-
};
|
|
945
|
-
|
|
946
|
-
// const fullScreenChange = (state: boolean) => {
|
|
947
|
-
|
|
948
|
-
// setIsFullScreen(state)
|
|
949
|
-
|
|
950
|
-
// }
|
|
951
|
-
|
|
952
|
-
const handleFullScreen = () => {
|
|
953
|
-
setIsFullScreen(!isFullScreen);
|
|
954
|
-
};
|
|
955
|
-
const CustomThead = headerProps => {
|
|
956
|
-
const {
|
|
957
|
-
children,
|
|
958
|
-
className
|
|
959
|
-
} = headerProps;
|
|
960
|
-
return /*#__PURE__*/React.createElement("thead", {
|
|
961
|
-
ref: theadRef,
|
|
962
|
-
className: className
|
|
963
|
-
}, children);
|
|
964
|
-
};
|
|
965
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(DndContext, {
|
|
966
|
-
sensors: sensors,
|
|
967
|
-
modifiers: [restrictToHorizontalAxis],
|
|
968
|
-
onDragEnd: onDragEnd,
|
|
969
|
-
onDragOver: onDragOver,
|
|
970
|
-
collisionDetection: closestCenter
|
|
971
|
-
}, /*#__PURE__*/React.createElement(SortableContext, {
|
|
972
|
-
items: columns.map(i => i.field),
|
|
973
|
-
strategy: horizontalListSortingStrategy
|
|
974
|
-
}, /*#__PURE__*/React.createElement(DragIndexContext.Provider, {
|
|
975
|
-
value: dragIndex
|
|
976
|
-
}, /*#__PURE__*/React.createElement(Group, _extends({}, rest, {
|
|
977
|
-
t: t,
|
|
978
|
-
id: id,
|
|
979
|
-
locale: locale,
|
|
980
|
-
tableRef: tableRef
|
|
981
|
-
// dataSource={mergedData}
|
|
982
|
-
,
|
|
983
|
-
originData: mergedData
|
|
984
|
-
// dataSource={filterStates && filterStates.length ? filterData : mergedData}
|
|
985
|
-
,
|
|
986
|
-
dataSource: filterDataByColumns4(mergedData, filterStates, mergedFilterKeys),
|
|
987
|
-
format: format,
|
|
988
|
-
columns: mergedColumns
|
|
989
|
-
|
|
990
|
-
// showSorterTooltip={false}
|
|
991
|
-
,
|
|
992
|
-
showSorterTooltip: {
|
|
993
|
-
target: 'sorter-icon'
|
|
994
|
-
},
|
|
995
|
-
triggerChangeColumns: triggerChangeColumns,
|
|
996
|
-
triggerChangeData: triggerChangeData,
|
|
997
|
-
triggerGroupColumns: triggerGroupColumns,
|
|
998
|
-
rowKey: rowKey,
|
|
999
|
-
getRowKey: getRowKey,
|
|
1000
|
-
triggerPaste: triggerPaste,
|
|
1001
|
-
clickHeaderToSort: clickHeaderToSort,
|
|
1002
|
-
groupSetting: groupSetting,
|
|
1003
|
-
groupAble: groupAble,
|
|
1004
|
-
groupColumns: groupColumns,
|
|
1005
|
-
commandClick: triggerCommandClick,
|
|
1006
|
-
summary: summary,
|
|
1007
|
-
pagination: pagination,
|
|
1008
|
-
scroll: scrollHeight - (summary ? 1 : 1) < 0 ? {
|
|
1009
|
-
y: 500
|
|
1010
|
-
} : {
|
|
1011
|
-
y: scrollHeight - (summary ? 1 : 1)
|
|
1012
|
-
} // scroll height auto, không quá 600
|
|
1013
|
-
,
|
|
1014
|
-
height: propsHeight,
|
|
1015
|
-
scrollHeight: scrollHeight,
|
|
1016
|
-
toolbarItems: toolbarItems,
|
|
1017
|
-
components: {
|
|
1018
|
-
header: {
|
|
1019
|
-
cell: ResizableTitle,
|
|
1020
|
-
wrapper: CustomThead
|
|
1021
|
-
}
|
|
1022
|
-
},
|
|
1023
|
-
onFilter: val => {
|
|
1024
|
-
handleOnFilter(val);
|
|
1025
|
-
},
|
|
1026
|
-
setMergedFilterKeys: setMergedFilterKeys,
|
|
1027
|
-
mergedFilterKeys: mergedFilterKeys,
|
|
1028
|
-
wrapSettings: wrapSettings,
|
|
1029
|
-
onChange: handleChange,
|
|
1030
|
-
handleFullScreen: handleFullScreen,
|
|
1031
|
-
isFullScreen: isFullScreen
|
|
1032
|
-
})))), /*#__PURE__*/React.createElement(DragOverlay, {
|
|
1033
|
-
style: {
|
|
1034
|
-
minWidth: 100,
|
|
1035
|
-
width: columns[columns.findIndex(i => i.field === dragIndex.active)]?.width
|
|
1036
|
-
}
|
|
1037
|
-
}, /*#__PURE__*/React.createElement("th", {
|
|
1038
|
-
style: {
|
|
1039
|
-
backgroundColor: '#f0f0f0',
|
|
1040
|
-
padding: 6,
|
|
1041
|
-
borderRadius: 6,
|
|
1042
|
-
fontWeight: 500
|
|
1043
|
-
}
|
|
1044
|
-
}, columns[columns.findIndex(i => i.field === dragIndex.active)]?.headerText))), /*#__PURE__*/React.createElement(Modal, {
|
|
1045
|
-
open: isFullScreen,
|
|
1046
|
-
footer: null,
|
|
1047
|
-
centered: true,
|
|
1048
|
-
closable: true,
|
|
1049
|
-
width: '100%',
|
|
1050
|
-
style: {
|
|
1051
|
-
maxWidth: '100%',
|
|
1052
|
-
height: '100%'
|
|
1053
|
-
},
|
|
1054
|
-
onClose: () => setIsFullScreen(false),
|
|
1055
|
-
onCancel: () => setIsFullScreen(false)
|
|
1056
|
-
|
|
1057
|
-
// destroyOnClose
|
|
1058
|
-
,
|
|
1059
|
-
styles: {
|
|
1060
|
-
content: {
|
|
1061
|
-
height: '100vh',
|
|
1062
|
-
borderRadius: 0
|
|
1063
|
-
},
|
|
1064
|
-
wrapper: {
|
|
1065
|
-
zIndex: 1060
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
1069
|
-
style: {
|
|
1070
|
-
paddingTop: 20
|
|
1071
|
-
}
|
|
1072
|
-
}, /*#__PURE__*/React.createElement(DndContext, {
|
|
1073
|
-
sensors: sensors,
|
|
1074
|
-
modifiers: [restrictToHorizontalAxis],
|
|
1075
|
-
onDragEnd: onDragEnd,
|
|
1076
|
-
onDragOver: onDragOver,
|
|
1077
|
-
collisionDetection: closestCenter
|
|
1078
|
-
}, /*#__PURE__*/React.createElement(SortableContext, {
|
|
1079
|
-
items: columns.map(i => i.field),
|
|
1080
|
-
strategy: horizontalListSortingStrategy
|
|
1081
|
-
}, /*#__PURE__*/React.createElement(DragIndexContext.Provider, {
|
|
1082
|
-
value: dragIndex
|
|
1083
|
-
}, /*#__PURE__*/React.createElement(Group, _extends({}, rest, {
|
|
1084
|
-
t: t,
|
|
1085
|
-
id: faker.string.alpha(20),
|
|
1086
|
-
locale: locale,
|
|
1087
|
-
tableRef: tableRef
|
|
1088
|
-
// dataSource={mergedData}
|
|
1089
|
-
,
|
|
1090
|
-
originData: mergedData
|
|
1091
|
-
// dataSource={filterStates && filterStates.length ? filterData : mergedData}
|
|
1092
|
-
,
|
|
1093
|
-
dataSource: filterDataByColumns4(mergedData, filterStates, mergedFilterKeys),
|
|
1094
|
-
format: format,
|
|
1095
|
-
columns: mergedColumns,
|
|
1096
|
-
showSorterTooltip: {
|
|
1097
|
-
target: 'sorter-icon'
|
|
1098
|
-
},
|
|
1099
|
-
triggerChangeColumns: triggerChangeColumns,
|
|
1100
|
-
triggerChangeData: triggerChangeData,
|
|
1101
|
-
triggerGroupColumns: triggerGroupColumns,
|
|
1102
|
-
rowKey: rowKey,
|
|
1103
|
-
getRowKey: getRowKey,
|
|
1104
|
-
triggerPaste: triggerPaste,
|
|
1105
|
-
clickHeaderToSort: clickHeaderToSort,
|
|
1106
|
-
groupSetting: groupSetting,
|
|
1107
|
-
groupAble: groupAble,
|
|
1108
|
-
groupColumns: groupColumns,
|
|
1109
|
-
commandClick: triggerCommandClick,
|
|
1110
|
-
summary: summary,
|
|
1111
|
-
pagination: pagination,
|
|
1112
|
-
toolbarItems: toolbarItems,
|
|
1113
|
-
scroll: scrollHeight1 - (summary ? 1 : 1) < 0 ? {
|
|
1114
|
-
y: 500
|
|
1115
|
-
} : {
|
|
1116
|
-
y: scrollHeight1 - (summary ? 1 : 1)
|
|
1117
|
-
} // scroll height auto, không quá 600
|
|
1118
|
-
,
|
|
1119
|
-
|
|
1120
|
-
height: windowSize.innerHeight - 35,
|
|
1121
|
-
scrollHeight: scrollHeight1,
|
|
1122
|
-
components: {
|
|
1123
|
-
header: {
|
|
1124
|
-
cell: ResizableTitle
|
|
1125
|
-
}
|
|
1126
|
-
// body: { cell: TableBodyCell }
|
|
1127
|
-
}
|
|
1128
|
-
// setTooltipContent={setTooltipContent}
|
|
1129
|
-
,
|
|
1130
|
-
|
|
1131
|
-
onFilter: val => {
|
|
1132
|
-
handleOnFilter(val);
|
|
1133
|
-
// triggerFilter?.(convertFilters(val))
|
|
1134
|
-
// onFilter?.(convertFilters(val))
|
|
1135
|
-
},
|
|
1136
|
-
setMergedFilterKeys: setMergedFilterKeys,
|
|
1137
|
-
mergedFilterKeys: mergedFilterKeys,
|
|
1138
|
-
wrapSettings: wrapSettings,
|
|
1139
|
-
onChange: handleChange,
|
|
1140
|
-
handleFullScreen: handleFullScreen,
|
|
1141
|
-
isFullScreen: isFullScreen
|
|
1142
|
-
|
|
1143
|
-
// onChange={(paging, filters, sorter) => {
|
|
1144
|
-
// handleChange(sorter)
|
|
1145
|
-
// }}
|
|
1146
|
-
})))), /*#__PURE__*/React.createElement(DragOverlay, {
|
|
1147
|
-
style: {
|
|
1148
|
-
minWidth: 100,
|
|
1149
|
-
width: columns[columns.findIndex(i => i.field === dragIndex.active)]?.width
|
|
1150
|
-
}
|
|
1151
|
-
}, /*#__PURE__*/React.createElement("th", {
|
|
1152
|
-
style: {
|
|
1153
|
-
backgroundColor: '#f0f0f0',
|
|
1154
|
-
padding: 6,
|
|
1155
|
-
borderRadius: 6,
|
|
1156
|
-
fontWeight: 500
|
|
1157
|
-
}
|
|
1158
|
-
}, columns[columns.findIndex(i => i.field === dragIndex.active)]?.headerText))))), /*#__PURE__*/React.createElement(Tooltip, {
|
|
1159
|
-
id: `${id}-tooltip-form-error`,
|
|
1160
|
-
style: {
|
|
1161
|
-
zIndex: 1999
|
|
1162
|
-
}
|
|
1163
|
-
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
1164
|
-
id: `${id}-tooltip-cell-content`,
|
|
1165
|
-
style: {
|
|
1166
|
-
zIndex: 1999
|
|
1167
|
-
}
|
|
1168
|
-
}));
|
|
1169
|
-
};
|
|
1170
|
-
export default InternalTable;
|