es-grid-template 1.8.61 → 1.8.62
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.
|
@@ -33,7 +33,7 @@ import classNames from "classnames";
|
|
|
33
33
|
import HeaderContent from "./hooks/content/HeaderContent";
|
|
34
34
|
import { ArrowDown, ArrowUp, FilterFill, SortCancel } from "becoxy-icons";
|
|
35
35
|
import { Select } from "rc-master-ui";
|
|
36
|
-
import { Button, Space } from "antd";
|
|
36
|
+
import { Button, Space, Modal } from "antd";
|
|
37
37
|
import { SearchOutlined } from "@ant-design/icons";
|
|
38
38
|
import { restrictToHorizontalAxis } from "@dnd-kit/modifiers";
|
|
39
39
|
import { closestCenter, DndContext, DragOverlay, PointerSensor, useSensor, useSensors } from "@dnd-kit/core";
|
|
@@ -42,7 +42,6 @@ import { arrayMove, horizontalListSortingStrategy, SortableContext, useSortable
|
|
|
42
42
|
import { Resizable } from "react-resizable";
|
|
43
43
|
import { faker } from "@faker-js/faker";
|
|
44
44
|
import useMergedState from "rc-util/es/hooks/useMergedState";
|
|
45
|
-
import Modal from 'antd/es/modal/Modal';
|
|
46
45
|
dayjs.extend(customParseFormat);
|
|
47
46
|
const MySwal = withReactContent(Swal);
|
|
48
47
|
const ASCEND = 'ascend';
|
|
@@ -61,9 +60,7 @@ const dragActiveStyle = (dragState, id) => {
|
|
|
61
60
|
backgroundColor: '#c0c0c0',
|
|
62
61
|
opacity: 0.3
|
|
63
62
|
};
|
|
64
|
-
}
|
|
65
|
-
// dragover dashed style
|
|
66
|
-
else if (over && id === over && active !== over) {
|
|
63
|
+
} else if (over && id === over && active !== over) {
|
|
67
64
|
style = direction === 'right' ? {
|
|
68
65
|
borderRight: '1px dashed gray'
|
|
69
66
|
} : {
|
|
@@ -88,6 +85,7 @@ const ResizableTitle = props => {
|
|
|
88
85
|
|
|
89
86
|
const style = {
|
|
90
87
|
...props.style,
|
|
88
|
+
borderBottom: '1px solid #e0e0e0',
|
|
91
89
|
// cursor: 'move',
|
|
92
90
|
// ...(isDragging ? { position: 'relative', zIndex: 9999, userSelect: 'none' } : {}),
|
|
93
91
|
...dragActiveStyle(dragState, props.id)
|
|
@@ -158,12 +156,11 @@ const InternalTable = props => {
|
|
|
158
156
|
lang,
|
|
159
157
|
locale,
|
|
160
158
|
dataSource,
|
|
161
|
-
allowResizing,
|
|
162
159
|
dataSourceFilter: propDataSourceFilter,
|
|
163
160
|
// onFilterClick,
|
|
164
161
|
// onFilter,
|
|
165
162
|
editAble,
|
|
166
|
-
rowKey: propRowKey,
|
|
163
|
+
// rowKey: propRowKey,
|
|
167
164
|
format,
|
|
168
165
|
onDataChange,
|
|
169
166
|
sortMultiple,
|
|
@@ -171,7 +168,7 @@ const InternalTable = props => {
|
|
|
171
168
|
// @ts-ignore
|
|
172
169
|
onCellPaste,
|
|
173
170
|
clickHeaderToSort = true,
|
|
174
|
-
components,
|
|
171
|
+
// components,
|
|
175
172
|
onChooseColumns,
|
|
176
173
|
groupAble,
|
|
177
174
|
groupSetting,
|
|
@@ -181,16 +178,17 @@ const InternalTable = props => {
|
|
|
181
178
|
pagination,
|
|
182
179
|
height: propsHeight,
|
|
183
180
|
summary,
|
|
184
|
-
infiniteScroll,
|
|
181
|
+
// infiniteScroll,
|
|
185
182
|
wrapSettings,
|
|
186
183
|
onFilter,
|
|
187
184
|
onSorter,
|
|
188
|
-
defaultSorter,
|
|
185
|
+
// defaultSorter,
|
|
189
186
|
toolbarItems,
|
|
190
187
|
allowSortering,
|
|
191
188
|
allowFiltering,
|
|
192
189
|
...rest
|
|
193
190
|
} = props;
|
|
191
|
+
const theadRef = React.useRef(null);
|
|
194
192
|
const id = React.useMemo(() => {
|
|
195
193
|
return tableId ?? faker.string.alpha(20);
|
|
196
194
|
// return tableId ?? newGuid()
|
|
@@ -265,15 +263,14 @@ const InternalTable = props => {
|
|
|
265
263
|
if (totalHeight) {
|
|
266
264
|
const table = document.querySelector(`#${id}`);
|
|
267
265
|
const title = table?.querySelector(`.ui-rc-table-title`);
|
|
268
|
-
const header = table?.querySelector(`.ui-rc-table-header`);
|
|
269
266
|
const paginationE = table?.querySelector(`.ui-rc-pagination`);
|
|
270
267
|
const toolbar = table?.querySelector(`.ui-rc-toolbar-bottom`);
|
|
271
268
|
const summaryE = table?.querySelector(`.ui-rc-table-summary`);
|
|
272
|
-
const
|
|
273
|
-
const hhh = (totalHeight ?? 0) - (title ? title.offsetHeight : 0) - (
|
|
269
|
+
const tableScrollRight = table?.querySelector(`.ui-rc-table-ping-right`);
|
|
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);
|
|
274
271
|
setHeight(hhh > 0 ? hhh : 0);
|
|
275
272
|
}
|
|
276
|
-
}, [id, propsHeight,
|
|
273
|
+
}, [id, propsHeight, summary, theadRef, columns]);
|
|
277
274
|
React.useEffect(() => {
|
|
278
275
|
// const totalHeight = isFullScreen ? windowSize.innerHeight - 50 : propsHeight
|
|
279
276
|
const totalHeight = windowSize.innerHeight - 60;
|
|
@@ -559,7 +556,7 @@ const InternalTable = props => {
|
|
|
559
556
|
}) : column.tooltipDescription : column.template && typeof column.template !== 'function' ? column.template : data[column.field ?? ''];
|
|
560
557
|
return {
|
|
561
558
|
id: `${column.field}`,
|
|
562
|
-
colSpan: groupColumns && data.children && column.field === firstNonGroupColumn?.field ?
|
|
559
|
+
colSpan: groupColumns && data.children && column.field === firstNonGroupColumn?.field ? 3 : groupColumns && data.children && nonGroupColumns[1].field === column.field ? 0 : 1,
|
|
563
560
|
// 'z-index': data?.children && column.field === firstNonGroupColumn?.field ? 11 : undefined,
|
|
564
561
|
...transformedColumn?.onCell?.(data, index),
|
|
565
562
|
className: classNames(transformedColumn?.onCell?.(data, index).className ?? '', {
|
|
@@ -930,6 +927,14 @@ const InternalTable = props => {
|
|
|
930
927
|
const handleFullScreen = () => {
|
|
931
928
|
setIsFullScreen(!isFullScreen);
|
|
932
929
|
};
|
|
930
|
+
const CustomThead = theadProps => {
|
|
931
|
+
const {
|
|
932
|
+
children
|
|
933
|
+
} = theadProps;
|
|
934
|
+
return /*#__PURE__*/React.createElement("thead", {
|
|
935
|
+
ref: theadRef
|
|
936
|
+
}, children);
|
|
937
|
+
};
|
|
933
938
|
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(DndContext, {
|
|
934
939
|
sensors: sensors,
|
|
935
940
|
modifiers: [restrictToHorizontalAxis],
|
|
@@ -981,9 +986,9 @@ const InternalTable = props => {
|
|
|
981
986
|
toolbarItems: toolbarItems,
|
|
982
987
|
components: {
|
|
983
988
|
header: {
|
|
984
|
-
cell: ResizableTitle
|
|
989
|
+
cell: ResizableTitle,
|
|
990
|
+
wrapper: CustomThead
|
|
985
991
|
}
|
|
986
|
-
// body: { cell: TableBodyCell }
|
|
987
992
|
},
|
|
988
993
|
onFilter: val => {
|
|
989
994
|
handleOnFilter(val);
|
|
@@ -36,7 +36,6 @@ var _sortable = require("@dnd-kit/sortable");
|
|
|
36
36
|
var _reactResizable = require("react-resizable");
|
|
37
37
|
var _faker = require("@faker-js/faker");
|
|
38
38
|
var _useMergedState = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState"));
|
|
39
|
-
var _Modal = _interopRequireDefault(require("antd/es/modal/Modal"));
|
|
40
39
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
41
40
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
42
41
|
// import GridEdit from "./table/GridEdit"
|
|
@@ -69,9 +68,7 @@ const dragActiveStyle = (dragState, id) => {
|
|
|
69
68
|
backgroundColor: '#c0c0c0',
|
|
70
69
|
opacity: 0.3
|
|
71
70
|
};
|
|
72
|
-
}
|
|
73
|
-
// dragover dashed style
|
|
74
|
-
else if (over && id === over && active !== over) {
|
|
71
|
+
} else if (over && id === over && active !== over) {
|
|
75
72
|
style = direction === 'right' ? {
|
|
76
73
|
borderRight: '1px dashed gray'
|
|
77
74
|
} : {
|
|
@@ -96,6 +93,7 @@ const ResizableTitle = props => {
|
|
|
96
93
|
|
|
97
94
|
const style = {
|
|
98
95
|
...props.style,
|
|
96
|
+
borderBottom: '1px solid #e0e0e0',
|
|
99
97
|
// cursor: 'move',
|
|
100
98
|
// ...(isDragging ? { position: 'relative', zIndex: 9999, userSelect: 'none' } : {}),
|
|
101
99
|
...dragActiveStyle(dragState, props.id)
|
|
@@ -166,12 +164,11 @@ const InternalTable = props => {
|
|
|
166
164
|
lang,
|
|
167
165
|
locale,
|
|
168
166
|
dataSource,
|
|
169
|
-
allowResizing,
|
|
170
167
|
dataSourceFilter: propDataSourceFilter,
|
|
171
168
|
// onFilterClick,
|
|
172
169
|
// onFilter,
|
|
173
170
|
editAble,
|
|
174
|
-
rowKey: propRowKey,
|
|
171
|
+
// rowKey: propRowKey,
|
|
175
172
|
format,
|
|
176
173
|
onDataChange,
|
|
177
174
|
sortMultiple,
|
|
@@ -179,7 +176,7 @@ const InternalTable = props => {
|
|
|
179
176
|
// @ts-ignore
|
|
180
177
|
onCellPaste,
|
|
181
178
|
clickHeaderToSort = true,
|
|
182
|
-
components,
|
|
179
|
+
// components,
|
|
183
180
|
onChooseColumns,
|
|
184
181
|
groupAble,
|
|
185
182
|
groupSetting,
|
|
@@ -189,16 +186,17 @@ const InternalTable = props => {
|
|
|
189
186
|
pagination,
|
|
190
187
|
height: propsHeight,
|
|
191
188
|
summary,
|
|
192
|
-
infiniteScroll,
|
|
189
|
+
// infiniteScroll,
|
|
193
190
|
wrapSettings,
|
|
194
191
|
onFilter,
|
|
195
192
|
onSorter,
|
|
196
|
-
defaultSorter,
|
|
193
|
+
// defaultSorter,
|
|
197
194
|
toolbarItems,
|
|
198
195
|
allowSortering,
|
|
199
196
|
allowFiltering,
|
|
200
197
|
...rest
|
|
201
198
|
} = props;
|
|
199
|
+
const theadRef = _react.default.useRef(null);
|
|
202
200
|
const id = _react.default.useMemo(() => {
|
|
203
201
|
return tableId ?? _faker.faker.string.alpha(20);
|
|
204
202
|
// return tableId ?? newGuid()
|
|
@@ -273,15 +271,14 @@ const InternalTable = props => {
|
|
|
273
271
|
if (totalHeight) {
|
|
274
272
|
const table = document.querySelector(`#${id}`);
|
|
275
273
|
const title = table?.querySelector(`.ui-rc-table-title`);
|
|
276
|
-
const header = table?.querySelector(`.ui-rc-table-header`);
|
|
277
274
|
const paginationE = table?.querySelector(`.ui-rc-pagination`);
|
|
278
275
|
const toolbar = table?.querySelector(`.ui-rc-toolbar-bottom`);
|
|
279
276
|
const summaryE = table?.querySelector(`.ui-rc-table-summary`);
|
|
280
|
-
const
|
|
281
|
-
const hhh = (totalHeight ?? 0) - (title ? title.offsetHeight : 0) - (
|
|
277
|
+
const tableScrollRight = table?.querySelector(`.ui-rc-table-ping-right`);
|
|
278
|
+
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);
|
|
282
279
|
setHeight(hhh > 0 ? hhh : 0);
|
|
283
280
|
}
|
|
284
|
-
}, [id, propsHeight,
|
|
281
|
+
}, [id, propsHeight, summary, theadRef, columns]);
|
|
285
282
|
_react.default.useEffect(() => {
|
|
286
283
|
// const totalHeight = isFullScreen ? windowSize.innerHeight - 50 : propsHeight
|
|
287
284
|
const totalHeight = windowSize.innerHeight - 60;
|
|
@@ -567,7 +564,7 @@ const InternalTable = props => {
|
|
|
567
564
|
}) : column.tooltipDescription : column.template && typeof column.template !== 'function' ? column.template : data[column.field ?? ''];
|
|
568
565
|
return {
|
|
569
566
|
id: `${column.field}`,
|
|
570
|
-
colSpan: groupColumns && data.children && column.field === firstNonGroupColumn?.field ?
|
|
567
|
+
colSpan: groupColumns && data.children && column.field === firstNonGroupColumn?.field ? 3 : groupColumns && data.children && nonGroupColumns[1].field === column.field ? 0 : 1,
|
|
571
568
|
// 'z-index': data?.children && column.field === firstNonGroupColumn?.field ? 11 : undefined,
|
|
572
569
|
...transformedColumn?.onCell?.(data, index),
|
|
573
570
|
className: (0, _classnames.default)(transformedColumn?.onCell?.(data, index).className ?? '', {
|
|
@@ -938,6 +935,14 @@ const InternalTable = props => {
|
|
|
938
935
|
const handleFullScreen = () => {
|
|
939
936
|
setIsFullScreen(!isFullScreen);
|
|
940
937
|
};
|
|
938
|
+
const CustomThead = theadProps => {
|
|
939
|
+
const {
|
|
940
|
+
children
|
|
941
|
+
} = theadProps;
|
|
942
|
+
return /*#__PURE__*/_react.default.createElement("thead", {
|
|
943
|
+
ref: theadRef
|
|
944
|
+
}, children);
|
|
945
|
+
};
|
|
941
946
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.DndContext, {
|
|
942
947
|
sensors: sensors,
|
|
943
948
|
modifiers: [_modifiers.restrictToHorizontalAxis],
|
|
@@ -989,9 +994,9 @@ const InternalTable = props => {
|
|
|
989
994
|
toolbarItems: toolbarItems,
|
|
990
995
|
components: {
|
|
991
996
|
header: {
|
|
992
|
-
cell: ResizableTitle
|
|
997
|
+
cell: ResizableTitle,
|
|
998
|
+
wrapper: CustomThead
|
|
993
999
|
}
|
|
994
|
-
// body: { cell: TableBodyCell }
|
|
995
1000
|
},
|
|
996
1001
|
onFilter: val => {
|
|
997
1002
|
handleOnFilter(val);
|
|
@@ -1014,7 +1019,7 @@ const InternalTable = props => {
|
|
|
1014
1019
|
borderRadius: 6,
|
|
1015
1020
|
fontWeight: 500
|
|
1016
1021
|
}
|
|
1017
|
-
}, columns[columns.findIndex(i => i.field === dragIndex.active)]?.headerText))), /*#__PURE__*/_react.default.createElement(
|
|
1022
|
+
}, columns[columns.findIndex(i => i.field === dragIndex.active)]?.headerText))), /*#__PURE__*/_react.default.createElement(_antd.Modal, {
|
|
1018
1023
|
open: isFullScreen,
|
|
1019
1024
|
footer: null,
|
|
1020
1025
|
centered: true,
|