qbs-react-grid 2.2.1 → 2.2.4
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/dist/css/qbs-react-grid.css +1 -1
- package/dist/css/qbs-react-grid.min.css +1 -1
- package/dist/css/qbs-react-grid.min.css.map +1 -1
- package/es/less/pagination.less +9 -9
- package/es/less/qbs-table.less +64 -37
- package/es/qbsTable/utilities/CardMenuDropdown.js +1 -2
- package/es/qbsTable/utilities/ToolTip.d.ts +8 -1
- package/es/qbsTable/utilities/ToolTip.js +106 -76
- package/es/qbsTable/utilities/VerticalDropDownMenu.d.ts +1 -1
- package/es/qbsTable/utilities/VerticalDropDownMenu.js +26 -35
- package/es/qbsTable/utilities/icons.js +1 -1
- package/lib/less/pagination.less +9 -9
- package/lib/less/qbs-table.less +64 -37
- package/lib/qbsTable/utilities/CardMenuDropdown.js +1 -2
- package/lib/qbsTable/utilities/ToolTip.d.ts +8 -1
- package/lib/qbsTable/utilities/ToolTip.js +106 -76
- package/lib/qbsTable/utilities/VerticalDropDownMenu.d.ts +1 -1
- package/lib/qbsTable/utilities/VerticalDropDownMenu.js +26 -35
- package/lib/qbsTable/utilities/icons.js +1 -1
- package/package.json +1 -1
- package/src/less/pagination.less +9 -9
- package/src/less/qbs-table.less +64 -37
- package/src/qbsTable/utilities/CardMenuDropdown.tsx +1 -1
- package/src/qbsTable/utilities/ToolTip.tsx +138 -77
- package/src/qbsTable/utilities/VerticalDropDownMenu.tsx +26 -35
- package/src/qbsTable/utilities/icons.tsx +1 -1
package/lib/less/qbs-table.less
CHANGED
|
@@ -387,71 +387,98 @@
|
|
|
387
387
|
.qbs-table-tooltip {
|
|
388
388
|
cursor: pointer;
|
|
389
389
|
position: relative;
|
|
390
|
-
|
|
391
|
-
display: flex;
|
|
390
|
+
display: inline-flex;
|
|
392
391
|
}
|
|
393
392
|
|
|
394
393
|
.qbs-table-tooltip .tooltiptext {
|
|
395
394
|
visibility: hidden;
|
|
396
|
-
background-color:
|
|
397
|
-
color:
|
|
395
|
+
background-color: var(--tooltip-bg, #222);
|
|
396
|
+
color: var(--tooltip-text, #fff);
|
|
398
397
|
text-align: center;
|
|
399
|
-
padding: 6px;
|
|
400
|
-
border-radius:
|
|
398
|
+
padding: 6px 10px;
|
|
399
|
+
border-radius: 6px;
|
|
401
400
|
position: absolute;
|
|
402
|
-
z-index:
|
|
401
|
+
z-index: 10050;
|
|
403
402
|
opacity: 0;
|
|
404
|
-
transition: opacity 0.
|
|
403
|
+
transition: opacity 0.15s ease;
|
|
405
404
|
font-size: 12px;
|
|
406
|
-
font-
|
|
407
|
-
font-weight: 400;
|
|
405
|
+
font-weight: 500;
|
|
408
406
|
line-height: 16px;
|
|
409
|
-
|
|
410
|
-
max-width:
|
|
407
|
+
white-space: nowrap;
|
|
408
|
+
max-width: min(280px, 90vw);
|
|
409
|
+
pointer-events: none;
|
|
410
|
+
inset-inline-start: 50%;
|
|
411
|
+
translate: -50% 0;
|
|
411
412
|
}
|
|
412
413
|
|
|
413
414
|
.qbs-table-tooltip.up .tooltiptext {
|
|
414
|
-
bottom: calc(100% +
|
|
415
|
-
|
|
416
|
-
left: unset;
|
|
415
|
+
bottom: calc(100% + 8px);
|
|
416
|
+
top: auto;
|
|
417
417
|
}
|
|
418
418
|
|
|
419
419
|
.qbs-table-tooltip.down .tooltiptext {
|
|
420
|
-
right: -10px;
|
|
421
420
|
top: calc(100% + 8px);
|
|
421
|
+
bottom: auto;
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
-
// .qbs-table-tooltip:hover .tooltiptext {
|
|
425
|
-
// visibility: visible;
|
|
426
|
-
// opacity: 1;
|
|
427
|
-
// }
|
|
428
|
-
|
|
429
424
|
.qbs-table-tooltip .tooltiptext::after {
|
|
430
425
|
content: '';
|
|
431
426
|
position: absolute;
|
|
432
|
-
|
|
433
|
-
|
|
427
|
+
inset-inline-start: 50%;
|
|
428
|
+
translate: -50% 0;
|
|
429
|
+
border: 5px solid transparent;
|
|
434
430
|
}
|
|
435
431
|
|
|
436
432
|
.qbs-table-tooltip.up .tooltiptext::after {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
margin-left: -5px !important;
|
|
440
|
-
top: 100% !important;
|
|
441
|
-
left: unset !important;
|
|
433
|
+
top: 100%;
|
|
434
|
+
border-top-color: var(--tooltip-bg, #222);
|
|
442
435
|
}
|
|
443
436
|
|
|
444
437
|
.qbs-table-tooltip.down .tooltiptext::after {
|
|
445
|
-
|
|
446
|
-
bottom:
|
|
447
|
-
right: 12px !important;
|
|
448
|
-
margin-left: -5px !important;
|
|
449
|
-
left: unset !important;
|
|
438
|
+
bottom: 100%;
|
|
439
|
+
border-bottom-color: var(--tooltip-bg, #222);
|
|
450
440
|
}
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
441
|
+
|
|
442
|
+
.qbs-table-tooltip-floating.tooltiptext {
|
|
443
|
+
position: fixed;
|
|
444
|
+
z-index: 10050;
|
|
445
|
+
visibility: hidden;
|
|
446
|
+
opacity: 0;
|
|
447
|
+
pointer-events: none;
|
|
448
|
+
background-color: var(--tooltip-bg, #222);
|
|
449
|
+
color: var(--tooltip-text, #fff);
|
|
450
|
+
text-align: center;
|
|
451
|
+
padding: 6px 10px;
|
|
452
|
+
border-radius: 6px;
|
|
453
|
+
font-size: 12px;
|
|
454
|
+
font-weight: 500;
|
|
455
|
+
line-height: 16px;
|
|
456
|
+
white-space: nowrap;
|
|
457
|
+
max-width: min(280px, 90vw);
|
|
458
|
+
transition: opacity 0.15s ease;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
.qbs-table-tooltip-floating.tooltiptext.is-positioned {
|
|
462
|
+
visibility: visible;
|
|
463
|
+
opacity: 1;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
.qbs-table-tooltip-floating.tooltiptext::after {
|
|
467
|
+
content: '';
|
|
468
|
+
position: absolute;
|
|
469
|
+
left: var(--tooltip-arrow-offset, 50%);
|
|
470
|
+
translate: -50% 0;
|
|
471
|
+
border: 5px solid transparent;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
.qbs-table-tooltip-floating--down.tooltiptext::after {
|
|
475
|
+
bottom: 100%;
|
|
476
|
+
border-bottom-color: var(--tooltip-bg, #222);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
.qbs-table-tooltip-floating--up.tooltiptext::after {
|
|
480
|
+
top: 100%;
|
|
481
|
+
border-top-color: var(--tooltip-bg, #222);
|
|
455
482
|
}
|
|
456
483
|
.rs-table-row {
|
|
457
484
|
overflow: visible !important;
|
|
@@ -74,8 +74,7 @@ var CardMenuDropdown = function CardMenuDropdown(_ref) {
|
|
|
74
74
|
ref: menuButtonRef
|
|
75
75
|
}, /*#__PURE__*/_react["default"].createElement(_ToolTip["default"], {
|
|
76
76
|
title: labels.actions,
|
|
77
|
-
enabled: false
|
|
78
|
-
ref: menuButtonRef
|
|
77
|
+
enabled: false
|
|
79
78
|
}, /*#__PURE__*/_react["default"].createElement(_icons.ThreeDotIcon, null))), openMenu && /*#__PURE__*/_react["default"].createElement("div", {
|
|
80
79
|
className: " qbs-card-dropdown rounded absolute right-0 mt-2 w-auto min-w-11 z-10 shadow-modalShadow bg-white dark:bg-[#424242] dark:text-white",
|
|
81
80
|
style: menuPositionStyles
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
type TooltipComponentProps = {
|
|
3
|
+
title?: React.ReactNode;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
tableBodyRef?: React.RefObject<HTMLDivElement | null>;
|
|
6
|
+
/** When false, renders children only (no tooltip). */
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const TooltipComponent: React.FC<TooltipComponentProps>;
|
|
3
10
|
export default TooltipComponent;
|
|
@@ -1,95 +1,125 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
exports.__esModule = true;
|
|
4
5
|
exports["default"] = void 0;
|
|
5
6
|
var _react = _interopRequireWildcard(require("react"));
|
|
7
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
6
8
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
7
9
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
// const TooltipComponent: React.FC<any> = ({ title, children, tableBodyRef }) => {
|
|
11
|
-
// const [dropdownPosition, setDropdownPosition] = useState('bottom-position');
|
|
12
|
-
// const dropRef = useRef(null);
|
|
13
|
-
// const menuButtonRef = useRef<HTMLElement>(null);
|
|
14
|
-
// const adjustDropdownPosition = () => {
|
|
15
|
-
// if (menuButtonRef.current && tableBodyRef?.current) {
|
|
16
|
-
// const inputBoxRect = menuButtonRef.current?.getBoundingClientRect();
|
|
17
|
-
// const tableRect = tableBodyRef.current.getBoundingClientRect();
|
|
18
|
-
// // Calculate positions relative to the table
|
|
19
|
-
// const spaceAbove = inputBoxRect.top - tableRect.top;
|
|
20
|
-
// const spaceBelow = tableRect.bottom - inputBoxRect.bottom;
|
|
21
|
-
|
|
22
|
-
// if (spaceAbove > spaceBelow) {
|
|
23
|
-
// setDropdownPosition('top-position');
|
|
24
|
-
// } else {
|
|
25
|
-
// setDropdownPosition('bottom-position');
|
|
26
|
-
// }
|
|
27
|
-
// }
|
|
28
|
-
// };
|
|
29
|
-
|
|
30
|
-
// return (
|
|
31
|
-
// <div className={`qbs-table-tooltip ${dropdownPosition == 'bottom-position' ? 'down' : 'up'} `}>
|
|
32
|
-
// <span
|
|
33
|
-
// ref={menuButtonRef}
|
|
34
|
-
// style={{ display: 'flex' }}
|
|
35
|
-
// onMouseEnter={() => adjustDropdownPosition()}
|
|
36
|
-
// >
|
|
37
|
-
// {children}
|
|
38
|
-
// </span>
|
|
39
|
-
// <span ref={dropRef} className={'tooltiptext'}>
|
|
40
|
-
// {title}
|
|
41
|
-
// </span>
|
|
42
|
-
// </div>
|
|
43
|
-
// );
|
|
44
|
-
// };
|
|
45
|
-
|
|
46
|
-
// export default TooltipComponent;
|
|
47
|
-
|
|
10
|
+
var VIEWPORT_PADDING = 8;
|
|
11
|
+
var TOOLTIP_GAP = 8;
|
|
48
12
|
var TooltipComponent = function TooltipComponent(_ref) {
|
|
49
13
|
var title = _ref.title,
|
|
50
14
|
children = _ref.children,
|
|
51
|
-
tableBodyRef = _ref.tableBodyRef
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
15
|
+
tableBodyRef = _ref.tableBodyRef,
|
|
16
|
+
_ref$enabled = _ref.enabled,
|
|
17
|
+
enabled = _ref$enabled === void 0 ? true : _ref$enabled;
|
|
18
|
+
var _useState = (0, _react.useState)(false),
|
|
19
|
+
visible = _useState[0],
|
|
20
|
+
setVisible = _useState[1];
|
|
21
|
+
var _useState2 = (0, _react.useState)(false),
|
|
22
|
+
positioned = _useState2[0],
|
|
23
|
+
setPositioned = _useState2[1];
|
|
24
|
+
var _useState3 = (0, _react.useState)('down'),
|
|
25
|
+
placement = _useState3[0],
|
|
26
|
+
setPlacement = _useState3[1];
|
|
27
|
+
var _useState4 = (0, _react.useState)({
|
|
28
|
+
top: 0,
|
|
29
|
+
left: 0
|
|
30
|
+
}),
|
|
31
|
+
coords = _useState4[0],
|
|
32
|
+
setCoords = _useState4[1];
|
|
33
|
+
var _useState5 = (0, _react.useState)(0),
|
|
34
|
+
arrowOffset = _useState5[0],
|
|
35
|
+
setArrowOffset = _useState5[1];
|
|
36
|
+
var triggerRef = (0, _react.useRef)(null);
|
|
37
|
+
var tooltipRef = (0, _react.useRef)(null);
|
|
38
|
+
var updatePosition = (0, _react.useCallback)(function () {
|
|
39
|
+
var _tableBodyRef$current, _tableBodyRef$current2, _trigger$closest;
|
|
40
|
+
var trigger = triggerRef.current;
|
|
41
|
+
var tooltip = tooltipRef.current;
|
|
42
|
+
if (!trigger || !tooltip) {
|
|
43
|
+
return;
|
|
63
44
|
}
|
|
45
|
+
var triggerRect = trigger.getBoundingClientRect();
|
|
46
|
+
var tooltipRect = tooltip.getBoundingClientRect();
|
|
47
|
+
var boundaryRect = (_tableBodyRef$current = tableBodyRef === null || tableBodyRef === void 0 ? void 0 : (_tableBodyRef$current2 = tableBodyRef.current) === null || _tableBodyRef$current2 === void 0 ? void 0 : _tableBodyRef$current2.getBoundingClientRect()) != null ? _tableBodyRef$current : (_trigger$closest = trigger.closest('.qbs-table')) === null || _trigger$closest === void 0 ? void 0 : _trigger$closest.getBoundingClientRect();
|
|
48
|
+
var spaceAbove = boundaryRect ? triggerRect.top - boundaryRect.top : triggerRect.top;
|
|
49
|
+
var spaceBelow = boundaryRect ? boundaryRect.bottom - triggerRect.bottom : window.innerHeight - triggerRect.bottom;
|
|
50
|
+
var nextPlacement = spaceBelow >= tooltipRect.height + TOOLTIP_GAP || spaceBelow >= spaceAbove ? 'down' : 'up';
|
|
51
|
+
var triggerCenter = triggerRect.left + triggerRect.width / 2;
|
|
52
|
+
var left = triggerCenter - tooltipRect.width / 2;
|
|
53
|
+
if (left < VIEWPORT_PADDING) {
|
|
54
|
+
left = VIEWPORT_PADDING;
|
|
55
|
+
} else if (left + tooltipRect.width > window.innerWidth - VIEWPORT_PADDING) {
|
|
56
|
+
left = window.innerWidth - VIEWPORT_PADDING - tooltipRect.width;
|
|
57
|
+
}
|
|
58
|
+
var top = nextPlacement === 'down' ? triggerRect.bottom + TOOLTIP_GAP : triggerRect.top - tooltipRect.height - TOOLTIP_GAP;
|
|
59
|
+
setPlacement(nextPlacement);
|
|
60
|
+
setCoords({
|
|
61
|
+
top: top,
|
|
62
|
+
left: left
|
|
63
|
+
});
|
|
64
|
+
setArrowOffset(triggerCenter - left);
|
|
65
|
+
setPositioned(true);
|
|
66
|
+
}, [tableBodyRef]);
|
|
67
|
+
var showTooltip = function showTooltip() {
|
|
68
|
+
setPositioned(false);
|
|
69
|
+
setVisible(true);
|
|
70
|
+
};
|
|
71
|
+
var hideTooltip = function hideTooltip() {
|
|
72
|
+
setVisible(false);
|
|
73
|
+
setPositioned(false);
|
|
64
74
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
onMouseLeave: function onMouseLeave() {
|
|
69
|
-
var _menuButtonRef$curren;
|
|
70
|
-
var tooltip = menuButtonRef === null || menuButtonRef === void 0 ? void 0 : (_menuButtonRef$curren = menuButtonRef.current) === null || _menuButtonRef$curren === void 0 ? void 0 : _menuButtonRef$curren.querySelector('.tooltiptext');
|
|
71
|
-
if (tooltip) {
|
|
72
|
-
tooltip.style.visibility = 'hidden';
|
|
73
|
-
tooltip.style.opacity = '0';
|
|
74
|
-
}
|
|
75
|
+
(0, _react.useLayoutEffect)(function () {
|
|
76
|
+
if (!visible) {
|
|
77
|
+
return;
|
|
75
78
|
}
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
updatePosition();
|
|
80
|
+
var frame = window.requestAnimationFrame(updatePosition);
|
|
81
|
+
return function () {
|
|
82
|
+
return window.cancelAnimationFrame(frame);
|
|
83
|
+
};
|
|
84
|
+
}, [visible, title, updatePosition]);
|
|
85
|
+
(0, _react.useEffect)(function () {
|
|
86
|
+
if (!visible) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
var handleReposition = function handleReposition() {
|
|
90
|
+
return updatePosition();
|
|
91
|
+
};
|
|
92
|
+
window.addEventListener('resize', handleReposition);
|
|
93
|
+
window.addEventListener('scroll', handleReposition, true);
|
|
94
|
+
return function () {
|
|
95
|
+
window.removeEventListener('resize', handleReposition);
|
|
96
|
+
window.removeEventListener('scroll', handleReposition, true);
|
|
97
|
+
};
|
|
98
|
+
}, [visible, updatePosition]);
|
|
99
|
+
if (!title || enabled === false) {
|
|
100
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, children);
|
|
101
|
+
}
|
|
102
|
+
var portalRoot = typeof document !== 'undefined' ? document.body : null;
|
|
103
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("span", {
|
|
104
|
+
ref: triggerRef,
|
|
105
|
+
className: "qbs-table-tooltip-trigger",
|
|
78
106
|
style: {
|
|
79
|
-
display: 'flex'
|
|
107
|
+
display: 'inline-flex'
|
|
80
108
|
},
|
|
81
|
-
onMouseEnter:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
109
|
+
onMouseEnter: showTooltip,
|
|
110
|
+
onMouseLeave: hideTooltip,
|
|
111
|
+
onFocus: showTooltip,
|
|
112
|
+
onBlur: hideTooltip
|
|
113
|
+
}, children), visible && portalRoot && /*#__PURE__*/_reactDom["default"].createPortal(/*#__PURE__*/_react["default"].createElement("span", {
|
|
114
|
+
ref: tooltipRef,
|
|
115
|
+
role: "tooltip",
|
|
116
|
+
className: "qbs-table-tooltip-floating tooltiptext qbs-table-tooltip-floating--" + placement + " " + (positioned ? 'is-positioned' : ''),
|
|
117
|
+
style: {
|
|
118
|
+
top: coords.top,
|
|
119
|
+
left: coords.left,
|
|
120
|
+
'--tooltip-arrow-offset': arrowOffset + "px"
|
|
89
121
|
}
|
|
90
|
-
},
|
|
91
|
-
className: "tooltiptext"
|
|
92
|
-
}, title)));
|
|
122
|
+
}, title), portalRoot));
|
|
93
123
|
};
|
|
94
124
|
var _default = TooltipComponent;
|
|
95
125
|
exports["default"] = _default;
|
|
@@ -5,7 +5,7 @@ type Props = {
|
|
|
5
5
|
handleMenuActions?: (slug: ActionProps, rowData?: any) => void;
|
|
6
6
|
rowData?: any;
|
|
7
7
|
dataTheme?: string;
|
|
8
|
-
tableBodyRef: React.RefObject<HTMLDivElement>;
|
|
8
|
+
tableBodyRef: React.RefObject<HTMLDivElement | null>;
|
|
9
9
|
rowIndex?: number;
|
|
10
10
|
wheelWrapperRef?: React.RefObject<HTMLDivElement>;
|
|
11
11
|
};
|
|
@@ -84,43 +84,34 @@ var VerticalMenuDropdown = function VerticalMenuDropdown(_ref) {
|
|
|
84
84
|
};
|
|
85
85
|
var toggleMenu = function toggleMenu() {
|
|
86
86
|
if (!openMenu && menuButtonRef.current) {
|
|
87
|
-
var
|
|
87
|
+
var _actionDropDown$filte3;
|
|
88
88
|
var rect = menuButtonRef.current.getBoundingClientRect();
|
|
89
|
-
var
|
|
90
|
-
var
|
|
89
|
+
var viewportPadding = 8;
|
|
90
|
+
var menuGap = 4;
|
|
91
|
+
var dropdownWidth = 200;
|
|
92
|
+
var visibleItems = (_actionDropDown$filte3 = actionDropDown === null || actionDropDown === void 0 ? void 0 : actionDropDown.filter(function (item) {
|
|
91
93
|
var _item$hide2;
|
|
92
94
|
return !item.hidden && !(item !== null && item !== void 0 && (_item$hide2 = item.hide) !== null && _item$hide2 !== void 0 && _item$hide2.call(item, rowData, rowIndex));
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
var
|
|
97
|
-
var dropdownWidth = 200;
|
|
95
|
+
})) != null ? _actionDropDown$filte3 : [];
|
|
96
|
+
var menuHeight = visibleItems.length * 40;
|
|
97
|
+
var spaceBelow = window.innerHeight - rect.bottom;
|
|
98
|
+
var openBelow = spaceBelow >= menuHeight + menuGap;
|
|
98
99
|
|
|
99
|
-
//
|
|
100
|
-
var
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
var rightEdge = rect.right;
|
|
107
|
-
leftPosition = Math.min(rightEdge, tableRect.right - dropdownWidth);
|
|
108
|
-
// Ensure it doesn't go beyond the left edge of the table
|
|
109
|
-
leftPosition = Math.max(leftPosition, tableRect.left);
|
|
100
|
+
// Anchor to trigger; prefer opening toward inline-start (left in LTR).
|
|
101
|
+
var left = rect.right - dropdownWidth;
|
|
102
|
+
if (left < viewportPadding) {
|
|
103
|
+
left = rect.left;
|
|
104
|
+
}
|
|
105
|
+
if (left + dropdownWidth > window.innerWidth - viewportPadding) {
|
|
106
|
+
left = Math.max(viewportPadding, rect.left - dropdownWidth);
|
|
110
107
|
}
|
|
111
|
-
if (
|
|
112
|
-
|
|
113
|
-
setPosition({
|
|
114
|
-
top: rect.bottom + window.scrollY - rect.height,
|
|
115
|
-
left: leftPosition
|
|
116
|
-
});
|
|
117
|
-
} else {
|
|
118
|
-
// Open above
|
|
119
|
-
setPosition({
|
|
120
|
-
top: rect.top + window.scrollY - menuHeight,
|
|
121
|
-
left: leftPosition
|
|
122
|
-
});
|
|
108
|
+
if (left + dropdownWidth > window.innerWidth - viewportPadding) {
|
|
109
|
+
left = window.innerWidth - viewportPadding - dropdownWidth;
|
|
123
110
|
}
|
|
111
|
+
setPosition({
|
|
112
|
+
top: openBelow ? rect.bottom + menuGap : rect.top - menuHeight - menuGap,
|
|
113
|
+
left: left
|
|
114
|
+
});
|
|
124
115
|
}
|
|
125
116
|
setTimeout(function () {
|
|
126
117
|
setOpenMenu(function (prev) {
|
|
@@ -130,13 +121,13 @@ var VerticalMenuDropdown = function VerticalMenuDropdown(_ref) {
|
|
|
130
121
|
};
|
|
131
122
|
var portalTarget = document.getElementById('portal-root');
|
|
132
123
|
var dropdownContent = /*#__PURE__*/_react["default"].createElement("div", {
|
|
133
|
-
className: "absolute z-
|
|
124
|
+
className: "absolute z-[60] min-w-48 rounded-md vertical-menu-dropdown-content",
|
|
134
125
|
ref: menuRef,
|
|
135
126
|
style: {
|
|
136
127
|
width: 200,
|
|
137
128
|
top: position.top,
|
|
138
129
|
left: position.left,
|
|
139
|
-
position: '
|
|
130
|
+
position: 'fixed'
|
|
140
131
|
}
|
|
141
132
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
142
133
|
className: "py-1"
|
|
@@ -144,7 +135,7 @@ var VerticalMenuDropdown = function VerticalMenuDropdown(_ref) {
|
|
|
144
135
|
var _item$hide3;
|
|
145
136
|
return !(item !== null && item !== void 0 && item.hidden) && !(item !== null && item !== void 0 && (_item$hide3 = item.hide) !== null && _item$hide3 !== void 0 && _item$hide3.call(item, rowData, rowIndex)) ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
146
137
|
key: item.title,
|
|
147
|
-
className: "vertical-menu-item px-4 py-2 text-sm text-
|
|
138
|
+
className: "vertical-menu-item px-4 py-2 text-sm text-base-black hover:bg-gray-light-1 cursor-pointer flex items-center gap-2 transition-colors",
|
|
148
139
|
onClick: function onClick(e) {
|
|
149
140
|
var _item$action;
|
|
150
141
|
e.preventDefault();
|
|
@@ -165,7 +156,7 @@ var VerticalMenuDropdown = function VerticalMenuDropdown(_ref) {
|
|
|
165
156
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
166
157
|
className: "inline-block vertical-menu-dropdown-wrapper"
|
|
167
158
|
}, handleShowHideMenu() > 0 && /*#__PURE__*/_react["default"].createElement("button", {
|
|
168
|
-
className: "vertical-menu-trigger-button p-2 rounded hover:bg-gray-
|
|
159
|
+
className: "vertical-menu-trigger-button p-2 rounded text-base-gray hover:bg-gray-light-1 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",
|
|
169
160
|
onClick: toggleMenu,
|
|
170
161
|
ref: menuButtonRef
|
|
171
162
|
}, /*#__PURE__*/_react["default"].createElement(_icons.ThreeDotIcon, null))), openMenu && portalTarget && /*#__PURE__*/_reactDom["default"].createPortal(dropdownContent, portalTarget));
|
|
@@ -13,7 +13,7 @@ var ThreeDotIcon = function ThreeDotIcon() {
|
|
|
13
13
|
xmlns: "http://www.w3.org/2000/svg"
|
|
14
14
|
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
15
15
|
d: "M2 2.16665L2 2.17498M2 7.99998L2 8.00831M2 13.8333L2 13.8416M2 2.99998C1.53976 2.99998 1.16667 2.62688 1.16667 2.16665C1.16667 1.70641 1.53976 1.33331 2 1.33331C2.46024 1.33331 2.83333 1.70641 2.83333 2.16665C2.83333 2.62688 2.46024 2.99998 2 2.99998ZM2 8.83331C1.53976 8.83331 1.16667 8.46022 1.16667 7.99998C1.16667 7.53974 1.53976 7.16665 2 7.16665C2.46024 7.16665 2.83333 7.53974 2.83333 7.99998C2.83333 8.46022 2.46024 8.83331 2 8.83331ZM2 14.6666C1.53976 14.6666 1.16666 14.2935 1.16666 13.8333C1.16666 13.3731 1.53976 13 2 13C2.46024 13 2.83333 13.3731 2.83333 13.8333C2.83333 14.2935 2.46024 14.6666 2 14.6666Z",
|
|
16
|
-
stroke: "
|
|
16
|
+
stroke: "currentColor",
|
|
17
17
|
strokeWidth: "1.5",
|
|
18
18
|
strokeLinecap: "round",
|
|
19
19
|
strokeLinejoin: "round"
|
package/package.json
CHANGED
package/src/less/pagination.less
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
min-height: 40px;
|
|
6
6
|
align-items: center;
|
|
7
7
|
border-radius: 0 0 4px 4px;
|
|
8
|
-
border-top: 1px solid #d6d8dc;
|
|
9
|
-
background: #fff;
|
|
8
|
+
border-top: 1px solid var(--base-gray-border, #d6d8dc);
|
|
9
|
+
background: var(--table-bg, #fff);
|
|
10
10
|
&-header {
|
|
11
11
|
border-bottom: 1px solid #eee;
|
|
12
12
|
position: absolute;
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
font-weight: 500;
|
|
28
28
|
line-height: 20px;
|
|
29
29
|
border-radius: 6px;
|
|
30
|
-
border: 1px solid #d6d8dc;
|
|
31
|
-
background: #fff;
|
|
30
|
+
border: 1px solid var(--base-gray-border, #d6d8dc);
|
|
31
|
+
background: var(--gray-light-1, #fff);
|
|
32
32
|
}
|
|
33
33
|
.qbs-table-icon-container {
|
|
34
34
|
padding: 0;
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
font-style: normal;
|
|
110
110
|
font-weight: 500;
|
|
111
111
|
line-height: 20px;
|
|
112
|
-
color: #313131;
|
|
112
|
+
color: var(--gray-dark-3, #313131);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
.custom-select-trigger {
|
|
126
126
|
padding: 2px 8px;
|
|
127
127
|
cursor: pointer;
|
|
128
|
-
border: 1px solid #d6d8dc;
|
|
128
|
+
border: 1px solid var(--base-gray-border, #d6d8dc);
|
|
129
129
|
border-radius: 4px;
|
|
130
130
|
min-width: 65px;
|
|
131
131
|
position: relative;
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
list-style: none;
|
|
141
141
|
margin: 2px 0 0;
|
|
142
142
|
padding: 0;
|
|
143
|
-
background: #fff;
|
|
143
|
+
background: var(--gray-light-1, #fff);
|
|
144
144
|
border-radius: 8px;
|
|
145
145
|
box-shadow: 0 8px 20px 0 #00000026;
|
|
146
146
|
}
|
|
@@ -158,7 +158,7 @@ ul.custom-select-options.top {
|
|
|
158
158
|
|
|
159
159
|
.custom-select-option:hover,
|
|
160
160
|
.custom-select-option.selected {
|
|
161
|
-
background-color: #f0f0f0;
|
|
161
|
+
background-color: var(--table-row-hover-bg, #f0f0f0);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
.custom-select-trigger:before {
|
|
@@ -167,7 +167,7 @@ ul.custom-select-options.top {
|
|
|
167
167
|
right: 10px;
|
|
168
168
|
top: 6px;
|
|
169
169
|
font-weight: bold;
|
|
170
|
-
border: solid black;
|
|
170
|
+
border: solid var(--gray-dark-3, black);
|
|
171
171
|
border-width: 0 1px 1px 0;
|
|
172
172
|
display: inline-block;
|
|
173
173
|
padding: 3px;
|