es-grid-template 1.4.6 → 1.4.8
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/GridStyle.js +1 -1
- package/es/grid-component/InternalTable.js +24 -19
- package/es/grid-component/TableGrid.js +2 -1
- package/es/grid-component/hooks/content/HeaderContent.d.ts +1 -0
- package/es/grid-component/hooks/content/HeaderContent.js +3 -50
- package/es/grid-component/styles.scss +11 -1
- package/es/grid-component/table/GridEdit.js +6 -4
- package/lib/grid-component/GridStyle.js +1 -1
- package/lib/grid-component/InternalTable.js +23 -18
- package/lib/grid-component/TableGrid.js +2 -1
- package/lib/grid-component/hooks/content/HeaderContent.d.ts +1 -0
- package/lib/grid-component/hooks/content/HeaderContent.js +3 -50
- package/lib/grid-component/styles.scss +11 -1
- package/lib/grid-component/table/GridEdit.js +5 -3
- package/package.json +1 -1
|
@@ -2,4 +2,4 @@ import styled from "styled-components";
|
|
|
2
2
|
export const GridStyle = styled.div.withConfig({
|
|
3
3
|
displayName: "GridStyle",
|
|
4
4
|
componentId: "es-grid-template__sc-sueu2e-0"
|
|
5
|
-
})(["height:", ";.ui-rc-table.ui-rc-table-virtual.ui-rc-table-scroll-horizontal{.ui-rc-table-container{padding-bottom:8px;border-bottom:1px solid #e0e0e0;}}.ui-rc-table-container{.ui-rc-table-tbody-virtual.ui-rc-table-tbody{min-height:", ";}}.ui-rc-toolbar-bottom{position:relative;padding:.25rem 1rem;background-color:#ffffff;&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;visibility:visible;right:0;}.toolbar-button{border-radius:0;.ant-btn{border-radius:0;}}}.ui-rc-pagination{border-bottom:1px solid #e0e0e0;border-top:1px solid #e0e0e0;margin:0;padding:.75rem 1rem;background-color:#ffffff;.ui-rc-pagination-total-text{order:2;margin-left:auto;}&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:50px;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:50px;bottom:0;visibility:visible;right:0;}&.pagination-template{position:relative;&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;visibility:visible;right:0;}}}.react-resizable{position:relative;background-clip:padding-box;}.rc-resizable-handle{position:absolute;right:0px;bottom:0;z-index:1;width:5px;height:100%;cursor:col-resize;&.none{cursor:auto;display:none;}}"], props => props.$heightTable ? `${props.$heightTable}px` : undefined, props => props.$heightScroll ? `${props.$heightScroll}px` : undefined);
|
|
5
|
+
})(["height:", ";.ui-rc-table.ui-rc-table-virtual.ui-rc-table-scroll-horizontal{.ui-rc-table-container{&:has(.ui-rc-table-tbody-virtual-scrollbar-horizontal){padding-bottom:8px;border-bottom:1px solid #e0e0e0;}}}.ui-rc-table-container{.ui-rc-table-tbody-virtual.ui-rc-table-tbody{min-height:", ";}}.ui-rc-toolbar-bottom{position:relative;padding:.25rem 1rem;background-color:#ffffff;&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;visibility:visible;right:0;}.toolbar-button{border-radius:0;.ant-btn{border-radius:0;}}}.ui-rc-pagination{border-bottom:1px solid #e0e0e0;border-top:1px solid #e0e0e0;margin:0;padding:.75rem 1rem;background-color:#ffffff;.ui-rc-pagination-total-text{order:2;margin-left:auto;}&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:50px;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:50px;bottom:0;visibility:visible;right:0;}&.pagination-template{position:relative;&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;visibility:visible;right:0;}}}.react-resizable{position:relative;background-clip:padding-box;}.rc-resizable-handle{position:absolute;right:0px;bottom:0;z-index:1;width:5px;height:100%;cursor:col-resize;&.none{cursor:auto;display:none;}}"], props => props.$heightTable ? `${props.$heightTable}px` : undefined, props => props.$heightScroll ? `${props.$heightScroll}px` : undefined);
|
|
@@ -21,7 +21,7 @@ import withReactContent from "sweetalert2-react-content";
|
|
|
21
21
|
import { Tooltip } from "react-tooltip";
|
|
22
22
|
import classNames from "classnames";
|
|
23
23
|
import HeaderContent from "./hooks/content/HeaderContent";
|
|
24
|
-
import { ArrowDown, ArrowUp, FilterFill } from "becoxy-icons";
|
|
24
|
+
import { ArrowDown, ArrowUp, FilterFill, SortCancel } from "becoxy-icons";
|
|
25
25
|
import { Select } from "rc-master-ui";
|
|
26
26
|
import { Button, Space } from "antd";
|
|
27
27
|
import { SearchOutlined } from "@ant-design/icons";
|
|
@@ -223,18 +223,18 @@ const InternalTable = props => {
|
|
|
223
223
|
}, [dataSource]);
|
|
224
224
|
const [columns, setColumns] = React.useState([]);
|
|
225
225
|
React.useEffect(() => {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}, [id, propsHeight, columns]);
|
|
226
|
+
if (propsHeight) {
|
|
227
|
+
const table = document.querySelector(`#${id}`);
|
|
228
|
+
const title = table?.querySelector(`.ui-rc-table-title`);
|
|
229
|
+
const header = table?.querySelector(`.ui-rc-table-header`);
|
|
230
|
+
const paginationE = table?.querySelector(`.ui-rc-pagination`);
|
|
231
|
+
const toolbar = table?.querySelector(`.ui-rc-toolbar-bottom`);
|
|
232
|
+
const summaryE = table?.querySelector(`.ui-rc-table-summary`);
|
|
233
|
+
const scrollbar = table?.querySelector(`.ui-rc-table-tbody-virtual-scrollbar.ui-rc-table-tbody-virtual-scrollbar-horizontal`);
|
|
234
|
+
const hhh = (propsHeight ?? 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);
|
|
235
|
+
setHeight(hhh > 0 ? hhh : 0);
|
|
236
|
+
}
|
|
237
|
+
}, [id, propsHeight, columns, editAble]);
|
|
238
238
|
const tableRef = React.useRef(null);
|
|
239
239
|
React.useEffect(() => {
|
|
240
240
|
setColumns(propsColumns);
|
|
@@ -382,7 +382,8 @@ const InternalTable = props => {
|
|
|
382
382
|
column: {
|
|
383
383
|
...column
|
|
384
384
|
},
|
|
385
|
-
t: t
|
|
385
|
+
t: t,
|
|
386
|
+
id: id
|
|
386
387
|
})),
|
|
387
388
|
ellipsis: column.ellipsis !== false,
|
|
388
389
|
align: column.textAlign ?? column.align,
|
|
@@ -440,7 +441,7 @@ const InternalTable = props => {
|
|
|
440
441
|
const {
|
|
441
442
|
sortOrder
|
|
442
443
|
} = args;
|
|
443
|
-
return /*#__PURE__*/React.createElement(Fragment, null, !sortOrder && /*#__PURE__*/React.createElement(
|
|
444
|
+
return /*#__PURE__*/React.createElement(Fragment, null, !sortOrder && /*#__PURE__*/React.createElement(SortCancel, {
|
|
444
445
|
fontSize: 15,
|
|
445
446
|
style: {
|
|
446
447
|
display: 'flex',
|
|
@@ -846,10 +847,14 @@ const InternalTable = props => {
|
|
|
846
847
|
// scroll={{ y: 300 - 41 - 7 }} // scroll height auto, không quá 600
|
|
847
848
|
// scroll={{ y: scrollHeight - (summary ? 0 : 7) }} // scroll height auto, không quá 600
|
|
848
849
|
,
|
|
849
|
-
|
|
850
|
-
|
|
850
|
+
|
|
851
|
+
scroll: scrollHeight - (summary ? 1 : 1) < 0 ? {
|
|
852
|
+
y: 500
|
|
853
|
+
} : {
|
|
854
|
+
y: scrollHeight - (summary ? 1 : 1)
|
|
851
855
|
} // scroll height auto, không quá 600
|
|
852
856
|
,
|
|
857
|
+
|
|
853
858
|
height: propsHeight,
|
|
854
859
|
scrollHeight: scrollHeight,
|
|
855
860
|
components: {
|
|
@@ -873,12 +878,12 @@ const InternalTable = props => {
|
|
|
873
878
|
fontWeight: 500
|
|
874
879
|
}
|
|
875
880
|
}, columns[columns.findIndex(i => i.field === dragIndex.active)]?.headerText))), /*#__PURE__*/React.createElement(Tooltip, {
|
|
876
|
-
id:
|
|
881
|
+
id: `${id}-tooltip-form-error`,
|
|
877
882
|
style: {
|
|
878
883
|
zIndex: 1999
|
|
879
884
|
}
|
|
880
885
|
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
881
|
-
id:
|
|
886
|
+
id: `${id}-tooltip-cell-content`,
|
|
882
887
|
style: {
|
|
883
888
|
zIndex: 1999
|
|
884
889
|
},
|
|
@@ -131,6 +131,7 @@ const useStyle = createStyles(({
|
|
|
131
131
|
const EMPTY_LIST = [];
|
|
132
132
|
const TableGrid = props => {
|
|
133
133
|
const {
|
|
134
|
+
id,
|
|
134
135
|
columns,
|
|
135
136
|
tableRef,
|
|
136
137
|
dataSource,
|
|
@@ -517,7 +518,7 @@ const TableGrid = props => {
|
|
|
517
518
|
,
|
|
518
519
|
showTotal: (total, range) => `${range[0]}-${range[1]} / ${total} ${t ? t(pagination?.locale?.items ?? 'items') : 'items'}`
|
|
519
520
|
}, pagination)), bottomToolbar?.(), /*#__PURE__*/React.createElement(Tooltip, {
|
|
520
|
-
id:
|
|
521
|
+
id: `${id}-tooltip-header`,
|
|
521
522
|
style: {
|
|
522
523
|
zIndex: 1999
|
|
523
524
|
}
|
|
@@ -1,23 +1,10 @@
|
|
|
1
1
|
import React, { Fragment } from "react";
|
|
2
2
|
import classnames from "classnames";
|
|
3
|
-
|
|
4
|
-
// import styled from "styled-components";
|
|
5
3
|
import { getTemplate } from "../utils";
|
|
6
|
-
// const TooltipStyle = styled.div`
|
|
7
|
-
// width: max-content;
|
|
8
|
-
// background-color: #444;
|
|
9
|
-
// color: white;
|
|
10
|
-
// font-size: 90%;
|
|
11
|
-
// padding: 4px 8px;
|
|
12
|
-
// border-radius: 4px;
|
|
13
|
-
// opacity: 0.9;
|
|
14
|
-
// z-index: 9999;
|
|
15
|
-
// max-width: 450px;
|
|
16
|
-
// `
|
|
17
|
-
|
|
18
4
|
const HeaderContent = props => {
|
|
19
5
|
const {
|
|
20
|
-
t
|
|
6
|
+
t,
|
|
7
|
+
id
|
|
21
8
|
} = props;
|
|
22
9
|
const {
|
|
23
10
|
headerTooltip,
|
|
@@ -31,43 +18,9 @@ const HeaderContent = props => {
|
|
|
31
18
|
const tooltip = React.useMemo(() => {
|
|
32
19
|
return headerTooltip ?? t ? t(columnGroupText ?? headerText) : columnGroupText ?? headerText;
|
|
33
20
|
}, [columnGroupText, headerText, headerTooltip, t]);
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
// const [isOpen, setIsOpen] = useState(false)
|
|
37
|
-
//
|
|
38
|
-
// const { refs, floatingStyles, context } = useFloating({
|
|
39
|
-
// open: isOpen,
|
|
40
|
-
// onOpenChange: setIsOpen,
|
|
41
|
-
// placement: "top",
|
|
42
|
-
// whileElementsMounted: autoUpdate,
|
|
43
|
-
// middleware: [
|
|
44
|
-
// offset(5),
|
|
45
|
-
// flip({
|
|
46
|
-
// fallbackAxisSideDirection: "start"
|
|
47
|
-
// }),
|
|
48
|
-
// shift()
|
|
49
|
-
// ]
|
|
50
|
-
// })
|
|
51
|
-
//
|
|
52
|
-
// const hover = useHover(context, { move: false })
|
|
53
|
-
// const focus = useFocus(context)
|
|
54
|
-
// const dismiss = useDismiss(context)
|
|
55
|
-
// const role = useRole(context, { role: "tooltip" })
|
|
56
|
-
//
|
|
57
|
-
// const { getReferenceProps, getFloatingProps } = useInteractions([
|
|
58
|
-
// hover,
|
|
59
|
-
// focus,
|
|
60
|
-
// dismiss,
|
|
61
|
-
// role
|
|
62
|
-
// ])
|
|
63
|
-
|
|
64
21
|
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
65
|
-
// ref={refs.setReference}
|
|
66
|
-
// tabIndex={-1}
|
|
67
|
-
// style={{flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', wordBreak: 'keep-all'}}
|
|
68
|
-
// style={{flex: 1}}
|
|
69
22
|
className: classnames('', {}),
|
|
70
|
-
"data-tooltip-id":
|
|
23
|
+
"data-tooltip-id": `${id}-tooltip-header`,
|
|
71
24
|
"data-tooltip-content": tooltip,
|
|
72
25
|
"data-tooltip-offset": 16
|
|
73
26
|
}, headerTemplate ? getTemplate(headerTemplate) : t ? t(text) : text));
|
|
@@ -85,7 +85,7 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
85
85
|
|
|
86
86
|
.ui-rc-table-tbody-virtual-scrollbar.ui-rc-table-tbody-virtual-scrollbar-horizontal {
|
|
87
87
|
visibility: visible !important;
|
|
88
|
-
|
|
88
|
+
bottom: -8px !important;
|
|
89
89
|
z-index: 5 !important;
|
|
90
90
|
background-color: #f0f0f0;
|
|
91
91
|
}
|
|
@@ -294,6 +294,16 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
294
294
|
|
|
295
295
|
.#{$prefix}-table-cell {
|
|
296
296
|
|
|
297
|
+
.ui-rc-table-column-sorter{
|
|
298
|
+
line-height: normal !important;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
&:hover {
|
|
302
|
+
.ui-rc-table-column-sorter-up.active {
|
|
303
|
+
opacity: 1 !important;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
297
307
|
.ui-rc-table-cell-content {
|
|
298
308
|
line-height: 22px;
|
|
299
309
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import React, { Fragment,
|
|
2
|
+
import React, { Fragment, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
4
4
|
import classNames from "classnames";
|
|
5
5
|
import { Button, Dropdown, Form, Modal, Typography } from "antd";
|
|
@@ -950,7 +950,7 @@ const GridEdit = props => {
|
|
|
950
950
|
const isEditing = React.useCallback(record => {
|
|
951
951
|
return record[rowKey] === editingKey;
|
|
952
952
|
}, [editingKey, rowKey]);
|
|
953
|
-
useEffect(() => {
|
|
953
|
+
React.useEffect(() => {
|
|
954
954
|
const handleClickOutside = event => {
|
|
955
955
|
const element = event.target;
|
|
956
956
|
|
|
@@ -990,9 +990,11 @@ const GridEdit = props => {
|
|
|
990
990
|
setRangeCells(new Set());
|
|
991
991
|
}
|
|
992
992
|
};
|
|
993
|
-
document.addEventListener(
|
|
993
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
994
|
+
document.addEventListener('touchstart', handleClickOutside);
|
|
994
995
|
return () => {
|
|
995
|
-
document.removeEventListener(
|
|
996
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
997
|
+
document.removeEventListener('touchstart', handleClickOutside);
|
|
996
998
|
};
|
|
997
999
|
}, [id]);
|
|
998
1000
|
const triggerDragPaste = pastesArray => {
|
|
@@ -9,4 +9,4 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
9
9
|
const GridStyle = exports.GridStyle = _styledComponents.default.div.withConfig({
|
|
10
10
|
displayName: "GridStyle",
|
|
11
11
|
componentId: "es-grid-template__sc-sueu2e-0"
|
|
12
|
-
})(["height:", ";.ui-rc-table.ui-rc-table-virtual.ui-rc-table-scroll-horizontal{.ui-rc-table-container{padding-bottom:8px;border-bottom:1px solid #e0e0e0;}}.ui-rc-table-container{.ui-rc-table-tbody-virtual.ui-rc-table-tbody{min-height:", ";}}.ui-rc-toolbar-bottom{position:relative;padding:.25rem 1rem;background-color:#ffffff;&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;visibility:visible;right:0;}.toolbar-button{border-radius:0;.ant-btn{border-radius:0;}}}.ui-rc-pagination{border-bottom:1px solid #e0e0e0;border-top:1px solid #e0e0e0;margin:0;padding:.75rem 1rem;background-color:#ffffff;.ui-rc-pagination-total-text{order:2;margin-left:auto;}&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:50px;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:50px;bottom:0;visibility:visible;right:0;}&.pagination-template{position:relative;&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;visibility:visible;right:0;}}}.react-resizable{position:relative;background-clip:padding-box;}.rc-resizable-handle{position:absolute;right:0px;bottom:0;z-index:1;width:5px;height:100%;cursor:col-resize;&.none{cursor:auto;display:none;}}"], props => props.$heightTable ? `${props.$heightTable}px` : undefined, props => props.$heightScroll ? `${props.$heightScroll}px` : undefined);
|
|
12
|
+
})(["height:", ";.ui-rc-table.ui-rc-table-virtual.ui-rc-table-scroll-horizontal{.ui-rc-table-container{&:has(.ui-rc-table-tbody-virtual-scrollbar-horizontal){padding-bottom:8px;border-bottom:1px solid #e0e0e0;}}}.ui-rc-table-container{.ui-rc-table-tbody-virtual.ui-rc-table-tbody{min-height:", ";}}.ui-rc-toolbar-bottom{position:relative;padding:.25rem 1rem;background-color:#ffffff;&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;visibility:visible;right:0;}.toolbar-button{border-radius:0;.ant-btn{border-radius:0;}}}.ui-rc-pagination{border-bottom:1px solid #e0e0e0;border-top:1px solid #e0e0e0;margin:0;padding:.75rem 1rem;background-color:#ffffff;.ui-rc-pagination-total-text{order:2;margin-left:auto;}&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:50px;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:50px;bottom:0;visibility:visible;right:0;}&.pagination-template{position:relative;&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;visibility:visible;right:0;}}}.react-resizable{position:relative;background-clip:padding-box;}.rc-resizable-handle{position:absolute;right:0px;bottom:0;z-index:1;width:5px;height:100%;cursor:col-resize;&.none{cursor:auto;display:none;}}"], props => props.$heightTable ? `${props.$heightTable}px` : undefined, props => props.$heightScroll ? `${props.$heightScroll}px` : undefined);
|
|
@@ -234,18 +234,18 @@ const InternalTable = props => {
|
|
|
234
234
|
}, [dataSource]);
|
|
235
235
|
const [columns, setColumns] = _react.default.useState([]);
|
|
236
236
|
_react.default.useEffect(() => {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}, [id, propsHeight, columns]);
|
|
237
|
+
if (propsHeight) {
|
|
238
|
+
const table = document.querySelector(`#${id}`);
|
|
239
|
+
const title = table?.querySelector(`.ui-rc-table-title`);
|
|
240
|
+
const header = table?.querySelector(`.ui-rc-table-header`);
|
|
241
|
+
const paginationE = table?.querySelector(`.ui-rc-pagination`);
|
|
242
|
+
const toolbar = table?.querySelector(`.ui-rc-toolbar-bottom`);
|
|
243
|
+
const summaryE = table?.querySelector(`.ui-rc-table-summary`);
|
|
244
|
+
const scrollbar = table?.querySelector(`.ui-rc-table-tbody-virtual-scrollbar.ui-rc-table-tbody-virtual-scrollbar-horizontal`);
|
|
245
|
+
const hhh = (propsHeight ?? 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);
|
|
246
|
+
setHeight(hhh > 0 ? hhh : 0);
|
|
247
|
+
}
|
|
248
|
+
}, [id, propsHeight, columns, editAble]);
|
|
249
249
|
const tableRef = _react.default.useRef(null);
|
|
250
250
|
_react.default.useEffect(() => {
|
|
251
251
|
setColumns(propsColumns);
|
|
@@ -393,7 +393,8 @@ const InternalTable = props => {
|
|
|
393
393
|
column: {
|
|
394
394
|
...column
|
|
395
395
|
},
|
|
396
|
-
t: t
|
|
396
|
+
t: t,
|
|
397
|
+
id: id
|
|
397
398
|
})),
|
|
398
399
|
ellipsis: column.ellipsis !== false,
|
|
399
400
|
align: column.textAlign ?? column.align,
|
|
@@ -451,7 +452,7 @@ const InternalTable = props => {
|
|
|
451
452
|
const {
|
|
452
453
|
sortOrder
|
|
453
454
|
} = args;
|
|
454
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, !sortOrder && /*#__PURE__*/_react.default.createElement(_becoxyIcons.
|
|
455
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, !sortOrder && /*#__PURE__*/_react.default.createElement(_becoxyIcons.SortCancel, {
|
|
455
456
|
fontSize: 15,
|
|
456
457
|
style: {
|
|
457
458
|
display: 'flex',
|
|
@@ -857,10 +858,14 @@ const InternalTable = props => {
|
|
|
857
858
|
// scroll={{ y: 300 - 41 - 7 }} // scroll height auto, không quá 600
|
|
858
859
|
// scroll={{ y: scrollHeight - (summary ? 0 : 7) }} // scroll height auto, không quá 600
|
|
859
860
|
,
|
|
860
|
-
|
|
861
|
-
|
|
861
|
+
|
|
862
|
+
scroll: scrollHeight - (summary ? 1 : 1) < 0 ? {
|
|
863
|
+
y: 500
|
|
864
|
+
} : {
|
|
865
|
+
y: scrollHeight - (summary ? 1 : 1)
|
|
862
866
|
} // scroll height auto, không quá 600
|
|
863
867
|
,
|
|
868
|
+
|
|
864
869
|
height: propsHeight,
|
|
865
870
|
scrollHeight: scrollHeight,
|
|
866
871
|
components: {
|
|
@@ -884,12 +889,12 @@ const InternalTable = props => {
|
|
|
884
889
|
fontWeight: 500
|
|
885
890
|
}
|
|
886
891
|
}, columns[columns.findIndex(i => i.field === dragIndex.active)]?.headerText))), /*#__PURE__*/_react.default.createElement(_reactTooltip.Tooltip, {
|
|
887
|
-
id:
|
|
892
|
+
id: `${id}-tooltip-form-error`,
|
|
888
893
|
style: {
|
|
889
894
|
zIndex: 1999
|
|
890
895
|
}
|
|
891
896
|
}), /*#__PURE__*/_react.default.createElement(_reactTooltip.Tooltip, {
|
|
892
|
-
id:
|
|
897
|
+
id: `${id}-tooltip-cell-content`,
|
|
893
898
|
style: {
|
|
894
899
|
zIndex: 1999
|
|
895
900
|
},
|
|
@@ -131,6 +131,7 @@ const useStyle = (0, _antdStyle.createStyles)(({
|
|
|
131
131
|
const EMPTY_LIST = [];
|
|
132
132
|
const TableGrid = props => {
|
|
133
133
|
const {
|
|
134
|
+
id,
|
|
134
135
|
columns,
|
|
135
136
|
tableRef,
|
|
136
137
|
dataSource,
|
|
@@ -517,7 +518,7 @@ const TableGrid = props => {
|
|
|
517
518
|
,
|
|
518
519
|
showTotal: (total, range) => `${range[0]}-${range[1]} / ${total} ${t ? t(pagination?.locale?.items ?? 'items') : 'items'}`
|
|
519
520
|
}, pagination)), bottomToolbar?.(), /*#__PURE__*/_react.default.createElement(_reactTooltip.Tooltip, {
|
|
520
|
-
id:
|
|
521
|
+
id: `${id}-tooltip-header`,
|
|
521
522
|
style: {
|
|
522
523
|
zIndex: 1999
|
|
523
524
|
}
|
|
@@ -10,23 +10,10 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
10
10
|
var _utils = require("../utils");
|
|
11
11
|
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); }
|
|
12
12
|
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; }
|
|
13
|
-
// import styled from "styled-components";
|
|
14
|
-
|
|
15
|
-
// const TooltipStyle = styled.div`
|
|
16
|
-
// width: max-content;
|
|
17
|
-
// background-color: #444;
|
|
18
|
-
// color: white;
|
|
19
|
-
// font-size: 90%;
|
|
20
|
-
// padding: 4px 8px;
|
|
21
|
-
// border-radius: 4px;
|
|
22
|
-
// opacity: 0.9;
|
|
23
|
-
// z-index: 9999;
|
|
24
|
-
// max-width: 450px;
|
|
25
|
-
// `
|
|
26
|
-
|
|
27
13
|
const HeaderContent = props => {
|
|
28
14
|
const {
|
|
29
|
-
t
|
|
15
|
+
t,
|
|
16
|
+
id
|
|
30
17
|
} = props;
|
|
31
18
|
const {
|
|
32
19
|
headerTooltip,
|
|
@@ -40,43 +27,9 @@ const HeaderContent = props => {
|
|
|
40
27
|
const tooltip = _react.default.useMemo(() => {
|
|
41
28
|
return headerTooltip ?? t ? t(columnGroupText ?? headerText) : columnGroupText ?? headerText;
|
|
42
29
|
}, [columnGroupText, headerText, headerTooltip, t]);
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
// const [isOpen, setIsOpen] = useState(false)
|
|
46
|
-
//
|
|
47
|
-
// const { refs, floatingStyles, context } = useFloating({
|
|
48
|
-
// open: isOpen,
|
|
49
|
-
// onOpenChange: setIsOpen,
|
|
50
|
-
// placement: "top",
|
|
51
|
-
// whileElementsMounted: autoUpdate,
|
|
52
|
-
// middleware: [
|
|
53
|
-
// offset(5),
|
|
54
|
-
// flip({
|
|
55
|
-
// fallbackAxisSideDirection: "start"
|
|
56
|
-
// }),
|
|
57
|
-
// shift()
|
|
58
|
-
// ]
|
|
59
|
-
// })
|
|
60
|
-
//
|
|
61
|
-
// const hover = useHover(context, { move: false })
|
|
62
|
-
// const focus = useFocus(context)
|
|
63
|
-
// const dismiss = useDismiss(context)
|
|
64
|
-
// const role = useRole(context, { role: "tooltip" })
|
|
65
|
-
//
|
|
66
|
-
// const { getReferenceProps, getFloatingProps } = useInteractions([
|
|
67
|
-
// hover,
|
|
68
|
-
// focus,
|
|
69
|
-
// dismiss,
|
|
70
|
-
// role
|
|
71
|
-
// ])
|
|
72
|
-
|
|
73
30
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
74
|
-
// ref={refs.setReference}
|
|
75
|
-
// tabIndex={-1}
|
|
76
|
-
// style={{flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', wordBreak: 'keep-all'}}
|
|
77
|
-
// style={{flex: 1}}
|
|
78
31
|
className: (0, _classnames.default)('', {}),
|
|
79
|
-
"data-tooltip-id":
|
|
32
|
+
"data-tooltip-id": `${id}-tooltip-header`,
|
|
80
33
|
"data-tooltip-content": tooltip,
|
|
81
34
|
"data-tooltip-offset": 16
|
|
82
35
|
}, headerTemplate ? (0, _utils.getTemplate)(headerTemplate) : t ? t(text) : text));
|
|
@@ -85,7 +85,7 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
85
85
|
|
|
86
86
|
.ui-rc-table-tbody-virtual-scrollbar.ui-rc-table-tbody-virtual-scrollbar-horizontal {
|
|
87
87
|
visibility: visible !important;
|
|
88
|
-
|
|
88
|
+
bottom: -8px !important;
|
|
89
89
|
z-index: 5 !important;
|
|
90
90
|
background-color: #f0f0f0;
|
|
91
91
|
}
|
|
@@ -294,6 +294,16 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
294
294
|
|
|
295
295
|
.#{$prefix}-table-cell {
|
|
296
296
|
|
|
297
|
+
.ui-rc-table-column-sorter{
|
|
298
|
+
line-height: normal !important;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
&:hover {
|
|
302
|
+
.ui-rc-table-column-sorter-up.active {
|
|
303
|
+
opacity: 1 !important;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
297
307
|
.ui-rc-table-cell-content {
|
|
298
308
|
line-height: 22px;
|
|
299
309
|
}
|
|
@@ -954,7 +954,7 @@ const GridEdit = props => {
|
|
|
954
954
|
const isEditing = _react.default.useCallback(record => {
|
|
955
955
|
return record[rowKey] === editingKey;
|
|
956
956
|
}, [editingKey, rowKey]);
|
|
957
|
-
|
|
957
|
+
_react.default.useEffect(() => {
|
|
958
958
|
const handleClickOutside = event => {
|
|
959
959
|
const element = event.target;
|
|
960
960
|
|
|
@@ -994,9 +994,11 @@ const GridEdit = props => {
|
|
|
994
994
|
setRangeCells(new Set());
|
|
995
995
|
}
|
|
996
996
|
};
|
|
997
|
-
document.addEventListener(
|
|
997
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
998
|
+
document.addEventListener('touchstart', handleClickOutside);
|
|
998
999
|
return () => {
|
|
999
|
-
document.removeEventListener(
|
|
1000
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
1001
|
+
document.removeEventListener('touchstart', handleClickOutside);
|
|
1000
1002
|
};
|
|
1001
1003
|
}, [id]);
|
|
1002
1004
|
const triggerDragPaste = pastesArray => {
|