qbs-react-grid 1.1.1 → 1.1.3
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/qbsTable/CustomTableCell.js +3 -3
- package/es/qbsTable/utilities/ToolTip.js +22 -11
- package/lib/qbsTable/CustomTableCell.js +3 -3
- package/lib/qbsTable/utilities/ToolTip.js +24 -12
- package/package.json +1 -1
- package/src/qbsTable/CustomTableCell.tsx +12 -11
- package/src/qbsTable/utilities/ToolTip.tsx +19 -13
|
@@ -5,8 +5,8 @@ var _excluded = ["rowData", "onChange", "checkedKeys", "dataKey", "dataTheme"],
|
|
|
5
5
|
_excluded3 = ["rowData", "renderCell", "toolTip", "dataKey", "onChange", "rowClick", "type", "link"];
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import Cell from '../Cell';
|
|
8
|
-
import MenuDropDown from './utilities/menuDropDown';
|
|
9
8
|
import { handleCellFormat } from './utilities/handleFormatCell';
|
|
9
|
+
import MenuDropDown from './utilities/menuDropDown';
|
|
10
10
|
var CHECKBOX_LINE_HEIGHT = '36px';
|
|
11
11
|
export var CheckCell = /*#__PURE__*/React.memo(function (_ref) {
|
|
12
12
|
var rowData = _ref.rowData,
|
|
@@ -82,12 +82,12 @@ export var CustomTableCell = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
82
82
|
type = _ref4.type,
|
|
83
83
|
link = _ref4.link,
|
|
84
84
|
props = _objectWithoutPropertiesLoose(_ref4, _excluded3);
|
|
85
|
-
return /*#__PURE__*/React.createElement(Cell, _extends({}, props, {
|
|
85
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Cell, _extends({}, props, {
|
|
86
86
|
dataKey: dataKey
|
|
87
87
|
}), link ? /*#__PURE__*/React.createElement("a", {
|
|
88
88
|
onClick: function onClick() {
|
|
89
89
|
return rowClick === null || rowClick === void 0 ? void 0 : rowClick(rowData);
|
|
90
90
|
},
|
|
91
91
|
className: "qbs-table-row-link"
|
|
92
|
-
}, renderCell ? (_renderCell = renderCell(rowData)) === null || _renderCell === void 0 ? void 0 : _renderCell.cell : handleCellFormat(rowData[dataKey], type)) : /*#__PURE__*/React.createElement(React.Fragment, null, renderCell ? (_renderCell2 = renderCell(rowData)) === null || _renderCell2 === void 0 ? void 0 : _renderCell2.cell : handleCellFormat(rowData[dataKey], type)));
|
|
92
|
+
}, renderCell ? (_renderCell = renderCell(rowData)) === null || _renderCell === void 0 ? void 0 : _renderCell.cell : handleCellFormat(rowData[dataKey], type)) : /*#__PURE__*/React.createElement(React.Fragment, null, renderCell ? (_renderCell2 = renderCell(rowData)) === null || _renderCell2 === void 0 ? void 0 : _renderCell2.cell : handleCellFormat(rowData[dataKey], type))));
|
|
93
93
|
});
|
|
@@ -1,16 +1,27 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Tooltip, Whisper } from 'rsuite';
|
|
3
|
-
var tooltip = function tooltip(titleL) {
|
|
4
|
-
return /*#__PURE__*/React.createElement(Tooltip, null, titleL);
|
|
5
|
-
};
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
6
2
|
var TooltipComponent = function TooltipComponent(_ref) {
|
|
7
3
|
var title = _ref.title,
|
|
8
4
|
children = _ref.children;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
var _useState = useState(0),
|
|
6
|
+
scrollY = _useState[0],
|
|
7
|
+
setScrollY = _useState[1];
|
|
8
|
+
var _useState2 = useState(true),
|
|
9
|
+
isScrollingUp = _useState2[0],
|
|
10
|
+
setIsScrollingUp = _useState2[1];
|
|
11
|
+
var handleScroll = function handleScroll() {
|
|
12
|
+
setIsScrollingUp(window.scrollY < scrollY);
|
|
13
|
+
setScrollY(window.scrollY);
|
|
14
|
+
};
|
|
15
|
+
useEffect(function () {
|
|
16
|
+
window.addEventListener('scroll', handleScroll);
|
|
17
|
+
return function () {
|
|
18
|
+
window.removeEventListener('scroll', handleScroll);
|
|
19
|
+
};
|
|
20
|
+
}, [scrollY]);
|
|
21
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
22
|
+
className: "qbs-table-tooltip " + (!isScrollingUp ? 'up' : 'down')
|
|
23
|
+
}, /*#__PURE__*/React.createElement("span", null, children), /*#__PURE__*/React.createElement("span", {
|
|
24
|
+
className: "tooltiptext"
|
|
25
|
+
}, title));
|
|
15
26
|
};
|
|
16
27
|
export default TooltipComponent;
|
|
@@ -7,8 +7,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
7
7
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _Cell = _interopRequireDefault(require("../Cell"));
|
|
10
|
-
var _menuDropDown = _interopRequireDefault(require("./utilities/menuDropDown"));
|
|
11
10
|
var _handleFormatCell = require("./utilities/handleFormatCell");
|
|
11
|
+
var _menuDropDown = _interopRequireDefault(require("./utilities/menuDropDown"));
|
|
12
12
|
var _excluded = ["rowData", "onChange", "checkedKeys", "dataKey", "dataTheme"],
|
|
13
13
|
_excluded2 = ["rowData", "dataKey", "expandedRowKeys", "onChange"],
|
|
14
14
|
_excluded3 = ["rowData", "renderCell", "toolTip", "dataKey", "onChange", "rowClick", "type", "link"];
|
|
@@ -90,13 +90,13 @@ var CustomTableCell = /*#__PURE__*/_react["default"].memo(function (_ref4) {
|
|
|
90
90
|
type = _ref4.type,
|
|
91
91
|
link = _ref4.link,
|
|
92
92
|
props = (0, _objectWithoutPropertiesLoose2["default"])(_ref4, _excluded3);
|
|
93
|
-
return /*#__PURE__*/_react["default"].createElement(_Cell["default"], (0, _extends2["default"])({}, props, {
|
|
93
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Cell["default"], (0, _extends2["default"])({}, props, {
|
|
94
94
|
dataKey: dataKey
|
|
95
95
|
}), link ? /*#__PURE__*/_react["default"].createElement("a", {
|
|
96
96
|
onClick: function onClick() {
|
|
97
97
|
return rowClick === null || rowClick === void 0 ? void 0 : rowClick(rowData);
|
|
98
98
|
},
|
|
99
99
|
className: "qbs-table-row-link"
|
|
100
|
-
}, renderCell ? (_renderCell = renderCell(rowData)) === null || _renderCell === void 0 ? void 0 : _renderCell.cell : (0, _handleFormatCell.handleCellFormat)(rowData[dataKey], type)) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, renderCell ? (_renderCell2 = renderCell(rowData)) === null || _renderCell2 === void 0 ? void 0 : _renderCell2.cell : (0, _handleFormatCell.handleCellFormat)(rowData[dataKey], type)));
|
|
100
|
+
}, renderCell ? (_renderCell = renderCell(rowData)) === null || _renderCell === void 0 ? void 0 : _renderCell.cell : (0, _handleFormatCell.handleCellFormat)(rowData[dataKey], type)) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, renderCell ? (_renderCell2 = renderCell(rowData)) === null || _renderCell2 === void 0 ? void 0 : _renderCell2.cell : (0, _handleFormatCell.handleCellFormat)(rowData[dataKey], type))));
|
|
101
101
|
});
|
|
102
102
|
exports.CustomTableCell = CustomTableCell;
|
|
@@ -1,22 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
exports.__esModule = true;
|
|
5
4
|
exports["default"] = void 0;
|
|
6
|
-
var _react =
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
return /*#__PURE__*/_react["default"].createElement(_rsuite.Tooltip, null, titleL);
|
|
10
|
-
};
|
|
5
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
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
|
+
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; }
|
|
11
8
|
var TooltipComponent = function TooltipComponent(_ref) {
|
|
12
9
|
var title = _ref.title,
|
|
13
10
|
children = _ref.children;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
var _useState = (0, _react.useState)(0),
|
|
12
|
+
scrollY = _useState[0],
|
|
13
|
+
setScrollY = _useState[1];
|
|
14
|
+
var _useState2 = (0, _react.useState)(true),
|
|
15
|
+
isScrollingUp = _useState2[0],
|
|
16
|
+
setIsScrollingUp = _useState2[1];
|
|
17
|
+
var handleScroll = function handleScroll() {
|
|
18
|
+
setIsScrollingUp(window.scrollY < scrollY);
|
|
19
|
+
setScrollY(window.scrollY);
|
|
20
|
+
};
|
|
21
|
+
(0, _react.useEffect)(function () {
|
|
22
|
+
window.addEventListener('scroll', handleScroll);
|
|
23
|
+
return function () {
|
|
24
|
+
window.removeEventListener('scroll', handleScroll);
|
|
25
|
+
};
|
|
26
|
+
}, [scrollY]);
|
|
27
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
28
|
+
className: "qbs-table-tooltip " + (!isScrollingUp ? 'up' : 'down')
|
|
29
|
+
}, /*#__PURE__*/_react["default"].createElement("span", null, children), /*#__PURE__*/_react["default"].createElement("span", {
|
|
30
|
+
className: "tooltiptext"
|
|
31
|
+
}, title));
|
|
20
32
|
};
|
|
21
33
|
var _default = TooltipComponent;
|
|
22
34
|
exports["default"] = _default;
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import Cell from '../Cell';
|
|
4
|
-
import MenuDropDown from './utilities/menuDropDown';
|
|
5
4
|
import { handleCellFormat } from './utilities/handleFormatCell';
|
|
5
|
+
import MenuDropDown from './utilities/menuDropDown';
|
|
6
6
|
|
|
7
7
|
const CHECKBOX_LINE_HEIGHT = '36px';
|
|
8
|
-
|
|
9
8
|
export const CheckCell: React.FC<any> = React.memo(
|
|
10
9
|
({ rowData, onChange, checkedKeys, dataKey, dataTheme, ...props }) => (
|
|
11
10
|
<Cell {...props} style={{ padding: 0 }} dataTheme={dataTheme}>
|
|
@@ -64,15 +63,17 @@ export const ExpandCell: React.FC<any> = React.memo(
|
|
|
64
63
|
export const CustomTableCell: React.FC<any> = React.memo(
|
|
65
64
|
({ rowData, renderCell, toolTip, dataKey, onChange, rowClick, type, link, ...props }) => {
|
|
66
65
|
return (
|
|
67
|
-
|
|
68
|
-
{
|
|
69
|
-
|
|
70
|
-
{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
66
|
+
<>
|
|
67
|
+
<Cell {...props} dataKey={dataKey}>
|
|
68
|
+
{link ? (
|
|
69
|
+
<a onClick={() => rowClick?.(rowData)} className="qbs-table-row-link">
|
|
70
|
+
{renderCell ? renderCell(rowData)?.cell : handleCellFormat(rowData[dataKey], type)}
|
|
71
|
+
</a>
|
|
72
|
+
) : (
|
|
73
|
+
<>{renderCell ? renderCell(rowData)?.cell : handleCellFormat(rowData[dataKey], type)}</>
|
|
74
|
+
)}
|
|
75
|
+
</Cell>
|
|
76
|
+
</>
|
|
76
77
|
);
|
|
77
78
|
}
|
|
78
79
|
);
|
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Tooltip, Whisper } from 'rsuite';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
3
2
|
|
|
4
|
-
const tooltip = (titleL: string) => {
|
|
5
|
-
return <Tooltip>{titleL}</Tooltip>;
|
|
6
|
-
};
|
|
7
3
|
const TooltipComponent: React.FC<any> = ({ title, children }) => {
|
|
4
|
+
const [scrollY, setScrollY] = useState(0);
|
|
5
|
+
const [isScrollingUp, setIsScrollingUp] = useState(true);
|
|
6
|
+
|
|
7
|
+
const handleScroll = () => {
|
|
8
|
+
setIsScrollingUp(window.scrollY < scrollY);
|
|
9
|
+
setScrollY(window.scrollY);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
window.addEventListener('scroll', handleScroll);
|
|
14
|
+
return () => {
|
|
15
|
+
window.removeEventListener('scroll', handleScroll);
|
|
16
|
+
};
|
|
17
|
+
}, [scrollY]);
|
|
8
18
|
return (
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
speaker={tooltip(title)}
|
|
14
|
-
>
|
|
15
|
-
{children}
|
|
16
|
-
</Whisper>
|
|
19
|
+
<div className={`qbs-table-tooltip ${!isScrollingUp ? 'up' : 'down'}`}>
|
|
20
|
+
<span>{children}</span>
|
|
21
|
+
<span className="tooltiptext">{title}</span>
|
|
22
|
+
</div>
|
|
17
23
|
);
|
|
18
24
|
};
|
|
19
25
|
|