qbs-react-grid 2.2.9 → 2.2.11
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/qbs-table.less +35 -6
- package/es/qbsTable/QbsTable.js +18 -5
- package/es/qbsTable/TableCardList.js +7 -4
- package/es/qbsTable/Toolbar.js +32 -21
- package/es/qbsTable/utilities/ColumShowHide.js +22 -73
- package/es/qbsTable/utilities/ToolTip.js +2 -1
- package/es/qbsTable/utilities/VerticalDropDownMenu.js +6 -2
- package/lib/less/qbs-table.less +35 -6
- package/lib/qbsTable/QbsTable.js +18 -5
- package/lib/qbsTable/TableCardList.js +7 -4
- package/lib/qbsTable/Toolbar.js +32 -21
- package/lib/qbsTable/utilities/ColumShowHide.js +22 -74
- package/lib/qbsTable/utilities/ToolTip.js +2 -1
- package/lib/qbsTable/utilities/VerticalDropDownMenu.js +6 -2
- package/package.json +1 -1
- package/src/less/qbs-table.less +35 -6
- package/src/qbsTable/QbsTable.tsx +16 -5
- package/src/qbsTable/TableCardList.tsx +7 -4
- package/src/qbsTable/Toolbar.tsx +36 -27
- package/src/qbsTable/utilities/ColumShowHide.tsx +69 -118
- package/src/qbsTable/utilities/ToolTip.tsx +1 -1
- package/src/qbsTable/utilities/VerticalDropDownMenu.tsx +10 -2
package/lib/qbsTable/Toolbar.js
CHANGED
|
@@ -46,9 +46,7 @@ var ToolBar = function ToolBar(_ref) {
|
|
|
46
46
|
setRowViewToggle = _ref.setRowViewToggle,
|
|
47
47
|
_ref$isFullScreen = _ref.isFullScreen,
|
|
48
48
|
isFullScreen = _ref$isFullScreen === void 0 ? false : _ref$isFullScreen,
|
|
49
|
-
labelsProp = _ref.labels
|
|
50
|
-
_ref$rtl = _ref.rtl,
|
|
51
|
-
rtl = _ref$rtl === void 0 ? false : _ref$rtl;
|
|
49
|
+
labelsProp = _ref.labels;
|
|
52
50
|
var labels = (0, _react.useMemo)(function () {
|
|
53
51
|
return (0, _labels.mergeQbsTableLabels)(labelsProp);
|
|
54
52
|
}, [labelsProp]);
|
|
@@ -88,8 +86,7 @@ var ToolBar = function ToolBar(_ref) {
|
|
|
88
86
|
};
|
|
89
87
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
90
88
|
className: "qbs-table-toolbar-container",
|
|
91
|
-
ref: toolbarRef
|
|
92
|
-
dir: rtl ? 'rtl' : 'ltr'
|
|
89
|
+
ref: toolbarRef
|
|
93
90
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
94
91
|
className: "qbs-table-toolbar " + (className != null ? className : '')
|
|
95
92
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -124,28 +121,40 @@ var ToolBar = function ToolBar(_ref) {
|
|
|
124
121
|
}))), tableHeaderActions, /*#__PURE__*/_react["default"].createElement("div", {
|
|
125
122
|
className: "pr-1 cursor-pointer relative table_custom_ctions"
|
|
126
123
|
}, (rowViewToggle || isFullScreen) && /*#__PURE__*/_react["default"].createElement("div", {
|
|
127
|
-
className: "flex gap-2 qbs-row-switch-
|
|
124
|
+
className: "flex gap-2 qbs-row-switch-cntainer"
|
|
128
125
|
}, rowViewToggle && /*#__PURE__*/_react["default"].createElement("div", {
|
|
129
126
|
className: "flex gap-2 table_cell_style qbs-table-top-icons"
|
|
130
127
|
}, /*#__PURE__*/_react["default"].createElement(_ToolTip["default"], {
|
|
131
128
|
tableBodyRef: toolbarRef,
|
|
132
129
|
title: (_labels$switchToDefau = labels.switchToDefaultView) != null ? _labels$switchToDefau : ''
|
|
133
|
-
}, /*#__PURE__*/_react["default"].createElement("
|
|
134
|
-
|
|
135
|
-
|
|
130
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
131
|
+
role: "button",
|
|
132
|
+
tabIndex: 0,
|
|
133
|
+
title: labels.switchToDefaultView,
|
|
136
134
|
onClick: function onClick() {
|
|
137
135
|
return setRowViewToggle === null || setRowViewToggle === void 0 ? void 0 : setRowViewToggle(true);
|
|
136
|
+
},
|
|
137
|
+
onKeyDown: function onKeyDown(e) {
|
|
138
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
139
|
+
setRowViewToggle === null || setRowViewToggle === void 0 ? void 0 : setRowViewToggle(true);
|
|
140
|
+
}
|
|
138
141
|
}
|
|
139
142
|
}, /*#__PURE__*/_react["default"].createElement(_icons.DefaultView, {
|
|
140
143
|
className: "" + (defaultRowView ? 'active' : '')
|
|
141
144
|
}))), /*#__PURE__*/_react["default"].createElement(_ToolTip["default"], {
|
|
142
145
|
tableBodyRef: toolbarRef,
|
|
143
146
|
title: (_labels$switchToRelax = labels.switchToRelaxedView) != null ? _labels$switchToRelax : ''
|
|
144
|
-
}, /*#__PURE__*/_react["default"].createElement("
|
|
145
|
-
|
|
146
|
-
|
|
147
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
148
|
+
role: "button",
|
|
149
|
+
tabIndex: 0,
|
|
150
|
+
title: labels.switchToRelaxedView,
|
|
147
151
|
onClick: function onClick() {
|
|
148
152
|
return setRowViewToggle === null || setRowViewToggle === void 0 ? void 0 : setRowViewToggle(false);
|
|
153
|
+
},
|
|
154
|
+
onKeyDown: function onKeyDown(e) {
|
|
155
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
156
|
+
setRowViewToggle === null || setRowViewToggle === void 0 ? void 0 : setRowViewToggle(false);
|
|
157
|
+
}
|
|
149
158
|
}
|
|
150
159
|
}, /*#__PURE__*/_react["default"].createElement(_icons.ContentView, {
|
|
151
160
|
className: "" + (!defaultRowView ? 'active' : '')
|
|
@@ -154,11 +163,17 @@ var ToolBar = function ToolBar(_ref) {
|
|
|
154
163
|
}, /*#__PURE__*/_react["default"].createElement(_ToolTip["default"], {
|
|
155
164
|
tableBodyRef: toolbarRef,
|
|
156
165
|
title: (_labels$switchToFullS = labels.switchToFullScreen) != null ? _labels$switchToFullS : ''
|
|
157
|
-
}, /*#__PURE__*/_react["default"].createElement("
|
|
158
|
-
|
|
159
|
-
|
|
166
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
167
|
+
role: "button",
|
|
168
|
+
tabIndex: 0,
|
|
169
|
+
title: labels.switchToFullScreen,
|
|
160
170
|
onClick: function onClick() {
|
|
161
171
|
return setTableFullView === null || setTableFullView === void 0 ? void 0 : setTableFullView(!fullWidthView);
|
|
172
|
+
},
|
|
173
|
+
onKeyDown: function onKeyDown(e) {
|
|
174
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
175
|
+
setTableFullView === null || setTableFullView === void 0 ? void 0 : setTableFullView(!fullWidthView);
|
|
176
|
+
}
|
|
162
177
|
}
|
|
163
178
|
}, /*#__PURE__*/_react["default"].createElement(_icons.ExpandIcon, {
|
|
164
179
|
className: "" + (fullWidthView ? 'active' : '')
|
|
@@ -167,9 +182,7 @@ var ToolBar = function ToolBar(_ref) {
|
|
|
167
182
|
}, /*#__PURE__*/_react["default"].createElement(_ToolTip["default"], {
|
|
168
183
|
tableBodyRef: toolbarRef,
|
|
169
184
|
title: (_labels$switchToTable = labels.switchToTableView) != null ? _labels$switchToTable : ''
|
|
170
|
-
}, /*#__PURE__*/_react["default"].createElement("
|
|
171
|
-
type: "button",
|
|
172
|
-
className: "qbs-table-view-btn",
|
|
185
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
173
186
|
onClick: function onClick() {
|
|
174
187
|
return setTableViewToggle === null || setTableViewToggle === void 0 ? void 0 : setTableViewToggle(true);
|
|
175
188
|
}
|
|
@@ -180,9 +193,7 @@ var ToolBar = function ToolBar(_ref) {
|
|
|
180
193
|
}), /*#__PURE__*/_react["default"].createElement(_ToolTip["default"], {
|
|
181
194
|
tableBodyRef: toolbarRef,
|
|
182
195
|
title: (_labels$switchToCardV = labels.switchToCardView) != null ? _labels$switchToCardV : ''
|
|
183
|
-
}, /*#__PURE__*/_react["default"].createElement("
|
|
184
|
-
type: "button",
|
|
185
|
-
className: "qbs-table-view-btn",
|
|
196
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
186
197
|
onClick: function onClick() {
|
|
187
198
|
return setTableViewToggle === null || setTableViewToggle === void 0 ? void 0 : setTableViewToggle(false);
|
|
188
199
|
}
|
|
@@ -1,17 +1,14 @@
|
|
|
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
5
|
var _react = _interopRequireWildcard(require("react"));
|
|
7
|
-
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
8
6
|
var _labels = require("../labels");
|
|
9
7
|
var _columnToggleCoordinator = require("./columnToggleCoordinator");
|
|
10
8
|
var _icons = require("./icons");
|
|
11
9
|
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); }
|
|
12
10
|
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; }
|
|
13
11
|
var ColumnToggle = function ColumnToggle(_ref) {
|
|
14
|
-
var _document$getElementB;
|
|
15
12
|
var columns = _ref.columns,
|
|
16
13
|
onToggle = _ref.onToggle,
|
|
17
14
|
onReorder = _ref.onReorder,
|
|
@@ -30,39 +27,9 @@ var ColumnToggle = function ColumnToggle(_ref) {
|
|
|
30
27
|
draggedItem = _useState[0],
|
|
31
28
|
setDraggedItem = _useState[1];
|
|
32
29
|
var popupRef = (0, _react.useRef)(null);
|
|
33
|
-
var settingsBtnRef = (0, _react.useRef)(null);
|
|
34
30
|
var _useState2 = (0, _react.useState)(),
|
|
35
31
|
dragOverPosition = _useState2[0],
|
|
36
32
|
setDragOverPosition = _useState2[1];
|
|
37
|
-
var _useState3 = (0, _react.useState)({
|
|
38
|
-
top: 0,
|
|
39
|
-
left: 0
|
|
40
|
-
}),
|
|
41
|
-
position = _useState3[0],
|
|
42
|
-
setPosition = _useState3[1];
|
|
43
|
-
var updatePopupPosition = (0, _react.useCallback)(function () {
|
|
44
|
-
var _popupRef$current, _popupRef$current2;
|
|
45
|
-
if (!settingsBtnRef.current) return;
|
|
46
|
-
var rect = settingsBtnRef.current.getBoundingClientRect();
|
|
47
|
-
var viewportPadding = 8;
|
|
48
|
-
var popupWidth = ((_popupRef$current = popupRef.current) === null || _popupRef$current === void 0 ? void 0 : _popupRef$current.offsetWidth) || 272;
|
|
49
|
-
var popupHeight = ((_popupRef$current2 = popupRef.current) === null || _popupRef$current2 === void 0 ? void 0 : _popupRef$current2.offsetHeight) || 320;
|
|
50
|
-
var left = rtl ? rect.left : rect.right - popupWidth;
|
|
51
|
-
if (left + popupWidth > window.innerWidth - viewportPadding) {
|
|
52
|
-
left = Math.max(viewportPadding, window.innerWidth - popupWidth - viewportPadding);
|
|
53
|
-
}
|
|
54
|
-
if (left < viewportPadding) {
|
|
55
|
-
left = viewportPadding;
|
|
56
|
-
}
|
|
57
|
-
var top = rect.bottom + 4;
|
|
58
|
-
if (top + popupHeight > window.innerHeight - viewportPadding) {
|
|
59
|
-
top = Math.max(viewportPadding, rect.top - popupHeight - 4);
|
|
60
|
-
}
|
|
61
|
-
setPosition({
|
|
62
|
-
top: top,
|
|
63
|
-
left: left
|
|
64
|
-
});
|
|
65
|
-
}, [rtl]);
|
|
66
33
|
(0, _react.useEffect)(function () {
|
|
67
34
|
var handleCloseOthers = function handleCloseOthers(event) {
|
|
68
35
|
var detail = event.detail;
|
|
@@ -75,16 +42,6 @@ var ColumnToggle = function ColumnToggle(_ref) {
|
|
|
75
42
|
return document.removeEventListener(_columnToggleCoordinator.COLUMN_TOGGLE_CLOSE_OTHERS, handleCloseOthers);
|
|
76
43
|
};
|
|
77
44
|
}, [setIsOpen, toggleId]);
|
|
78
|
-
(0, _react.useEffect)(function () {
|
|
79
|
-
if (!isOpen) return;
|
|
80
|
-
updatePopupPosition();
|
|
81
|
-
var frame = requestAnimationFrame(function () {
|
|
82
|
-
return updatePopupPosition();
|
|
83
|
-
});
|
|
84
|
-
return function () {
|
|
85
|
-
return cancelAnimationFrame(frame);
|
|
86
|
-
};
|
|
87
|
-
}, [isOpen, updatePopupPosition]);
|
|
88
45
|
var handleToggle = (0, _react.useCallback)(function (columnName) {
|
|
89
46
|
onToggle(columnName);
|
|
90
47
|
}, [onToggle]);
|
|
@@ -109,9 +66,9 @@ var ColumnToggle = function ColumnToggle(_ref) {
|
|
|
109
66
|
setDraggedItem(null);
|
|
110
67
|
}, [columns, draggedItem, onReorder]);
|
|
111
68
|
var handleClickOutside = (0, _react.useCallback)(function (event) {
|
|
112
|
-
var _popupRef$
|
|
69
|
+
var _popupRef$current;
|
|
113
70
|
var target = event.target;
|
|
114
|
-
if ((_popupRef$
|
|
71
|
+
if ((_popupRef$current = popupRef.current) !== null && _popupRef$current !== void 0 && _popupRef$current.contains(target)) {
|
|
115
72
|
return;
|
|
116
73
|
}
|
|
117
74
|
setIsOpen(false);
|
|
@@ -139,9 +96,9 @@ var ColumnToggle = function ColumnToggle(_ref) {
|
|
|
139
96
|
return handleToggle(column.title);
|
|
140
97
|
},
|
|
141
98
|
className: "qbs-table-checkbox-input",
|
|
142
|
-
id: column.title
|
|
99
|
+
id: toggleId + "-" + column.title
|
|
143
100
|
}), /*#__PURE__*/_react["default"].createElement("label", {
|
|
144
|
-
htmlFor: column.title
|
|
101
|
+
htmlFor: toggleId + "-" + column.title
|
|
145
102
|
}, /*#__PURE__*/_react["default"].createElement("svg", {
|
|
146
103
|
width: "8",
|
|
147
104
|
height: "6",
|
|
@@ -181,9 +138,9 @@ var ColumnToggle = function ColumnToggle(_ref) {
|
|
|
181
138
|
return handleToggle(column.title);
|
|
182
139
|
},
|
|
183
140
|
className: "qbs-table-checkbox-input",
|
|
184
|
-
id: column.title
|
|
141
|
+
id: toggleId + "-" + column.title
|
|
185
142
|
}), /*#__PURE__*/_react["default"].createElement("label", {
|
|
186
|
-
htmlFor: column.title
|
|
143
|
+
htmlFor: toggleId + "-" + column.title
|
|
187
144
|
}, /*#__PURE__*/_react["default"].createElement("svg", {
|
|
188
145
|
width: "8",
|
|
189
146
|
height: "6",
|
|
@@ -220,15 +177,23 @@ var ColumnToggle = function ColumnToggle(_ref) {
|
|
|
220
177
|
setIsOpen(false);
|
|
221
178
|
handleColumnToggle === null || handleColumnToggle === void 0 ? void 0 : handleColumnToggle(columns);
|
|
222
179
|
};
|
|
223
|
-
|
|
224
|
-
|
|
180
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
181
|
+
className: "qbs-table-settings-wrapper"
|
|
182
|
+
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
183
|
+
type: "button",
|
|
184
|
+
onClick: function onClick(event) {
|
|
185
|
+
event.stopPropagation();
|
|
186
|
+
if (isOpen) {
|
|
187
|
+
setIsOpen(false);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
(0, _columnToggleCoordinator.closeOtherColumnToggles)(toggleId);
|
|
191
|
+
setIsOpen(true);
|
|
192
|
+
}
|
|
193
|
+
}, /*#__PURE__*/_react["default"].createElement(_icons.SettingsIcon, null)), isOpen && /*#__PURE__*/_react["default"].createElement("div", {
|
|
225
194
|
className: "qbs-table-column-popup" + (rtl ? ' qbs-table-column-popup--rtl' : ''),
|
|
226
195
|
style: {
|
|
227
|
-
|
|
228
|
-
top: position.top,
|
|
229
|
-
left: position.left,
|
|
230
|
-
maxHeight: tableHeight - 40,
|
|
231
|
-
zIndex: 10060
|
|
196
|
+
maxHeight: tableHeight - 40
|
|
232
197
|
},
|
|
233
198
|
ref: popupRef,
|
|
234
199
|
dir: rtl ? 'rtl' : 'ltr'
|
|
@@ -284,24 +249,7 @@ var ColumnToggle = function ColumnToggle(_ref) {
|
|
|
284
249
|
onClick: function onClick() {
|
|
285
250
|
return handleColToggle();
|
|
286
251
|
}
|
|
287
|
-
}, labels.save))));
|
|
288
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
289
|
-
className: "qbs-table-settings-wrapper"
|
|
290
|
-
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
291
|
-
type: "button",
|
|
292
|
-
className: "qbs-table-settings-btn",
|
|
293
|
-
ref: settingsBtnRef,
|
|
294
|
-
onClick: function onClick(event) {
|
|
295
|
-
event.stopPropagation();
|
|
296
|
-
if (isOpen) {
|
|
297
|
-
setIsOpen(false);
|
|
298
|
-
return;
|
|
299
|
-
}
|
|
300
|
-
(0, _columnToggleCoordinator.closeOtherColumnToggles)(toggleId);
|
|
301
|
-
updatePopupPosition();
|
|
302
|
-
setIsOpen(true);
|
|
303
|
-
}
|
|
304
|
-
}, /*#__PURE__*/_react["default"].createElement(_icons.SettingsIcon, null)), isOpen && portalTarget && /*#__PURE__*/_reactDom["default"].createPortal(popupContent, portalTarget));
|
|
252
|
+
}, labels.save)))));
|
|
305
253
|
};
|
|
306
254
|
var _default = ColumnToggle;
|
|
307
255
|
exports["default"] = _default;
|
|
@@ -41,7 +41,8 @@ var TooltipComponent = function TooltipComponent(_ref) {
|
|
|
41
41
|
}
|
|
42
42
|
}, children), /*#__PURE__*/_react["default"].createElement("span", {
|
|
43
43
|
ref: dropRef,
|
|
44
|
-
className:
|
|
44
|
+
className: "tooltiptext",
|
|
45
|
+
dir: "auto"
|
|
45
46
|
}, title));
|
|
46
47
|
};
|
|
47
48
|
var _default = TooltipComponent;
|
|
@@ -58,7 +58,11 @@ var VerticalMenuDropdown = function VerticalMenuDropdown(_ref) {
|
|
|
58
58
|
var menuHeight = visibleItems.length * 40;
|
|
59
59
|
var spaceBelow = window.innerHeight - rect.bottom;
|
|
60
60
|
var openBelow = spaceBelow >= menuHeight + menuGap;
|
|
61
|
-
var
|
|
61
|
+
var isRtl = (document.documentElement.getAttribute('dir') || document.body.getAttribute('dir') || getComputedStyle(document.documentElement).direction) === 'rtl';
|
|
62
|
+
var left = isRtl ? rect.left : rect.left - menuWidth;
|
|
63
|
+
if (!isRtl && left < viewportPadding) {
|
|
64
|
+
left = rect.left;
|
|
65
|
+
}
|
|
62
66
|
if (left + menuWidth > window.innerWidth - viewportPadding) {
|
|
63
67
|
left = Math.max(viewportPadding, rect.right - menuWidth);
|
|
64
68
|
}
|
|
@@ -172,7 +176,7 @@ var VerticalMenuDropdown = function VerticalMenuDropdown(_ref) {
|
|
|
172
176
|
className: "inline-block vertical-menu-dropdown-wrapper"
|
|
173
177
|
}, visibleCount > 0 && /*#__PURE__*/_react["default"].createElement("button", {
|
|
174
178
|
type: "button",
|
|
175
|
-
className: "vertical-menu-trigger-button
|
|
179
|
+
className: "vertical-menu-trigger-button",
|
|
176
180
|
onClick: function onClick(event) {
|
|
177
181
|
event.stopPropagation();
|
|
178
182
|
if (openMenu) {
|
package/package.json
CHANGED
package/src/less/qbs-table.less
CHANGED
|
@@ -381,16 +381,45 @@
|
|
|
381
381
|
display: inline-flex;
|
|
382
382
|
align-items: center;
|
|
383
383
|
justify-content: center;
|
|
384
|
+
width: 100%;
|
|
385
|
+
|
|
386
|
+
> button {
|
|
387
|
+
display: inline-flex;
|
|
388
|
+
align-items: center;
|
|
389
|
+
justify-content: center;
|
|
390
|
+
padding: 0;
|
|
391
|
+
margin: 0;
|
|
392
|
+
border: none;
|
|
393
|
+
background: transparent;
|
|
394
|
+
cursor: pointer;
|
|
395
|
+
color: #585858;
|
|
396
|
+
|
|
397
|
+
svg {
|
|
398
|
+
width: 20px;
|
|
399
|
+
height: 20px;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
&:hover,
|
|
403
|
+
&:focus {
|
|
404
|
+
background: transparent;
|
|
405
|
+
outline: none;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
384
408
|
}
|
|
385
409
|
|
|
386
410
|
.qbs-table-column-popup {
|
|
387
|
-
position:
|
|
411
|
+
position: absolute;
|
|
412
|
+
top: calc(100% + 4px);
|
|
413
|
+
inset-inline-end: 0;
|
|
414
|
+
inset-inline-start: auto;
|
|
388
415
|
padding: 8px;
|
|
389
416
|
z-index: 10060;
|
|
390
417
|
border-radius: 8px;
|
|
391
418
|
background: #fff;
|
|
392
419
|
box-shadow: 0px 8px 20px 0px rgba(0, 0, 0, 0.15);
|
|
393
|
-
min-width:
|
|
420
|
+
min-width: 300px;
|
|
421
|
+
width: max-content;
|
|
422
|
+
max-width: min(400px, calc(100vw - 16px));
|
|
394
423
|
gap: 4px;
|
|
395
424
|
display: flex;
|
|
396
425
|
flex-direction: column;
|
|
@@ -413,10 +442,6 @@
|
|
|
413
442
|
|
|
414
443
|
.qbs-table-columns-container {
|
|
415
444
|
display: flex;
|
|
416
|
-
flex-direction: row;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
.qbs-table-column-popup--rtl .qbs-table-columns-container {
|
|
420
445
|
flex-direction: row-reverse;
|
|
421
446
|
}
|
|
422
447
|
|
|
@@ -429,6 +454,10 @@
|
|
|
429
454
|
padding: 4px 0 0;
|
|
430
455
|
}
|
|
431
456
|
|
|
457
|
+
.qbs-table-column-popup--rtl {
|
|
458
|
+
text-align: right;
|
|
459
|
+
}
|
|
460
|
+
|
|
432
461
|
.qbs-table-column-popup--rtl .qbs-table-popup-footer {
|
|
433
462
|
flex-direction: row-reverse;
|
|
434
463
|
}
|
|
@@ -105,7 +105,10 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
105
105
|
rowHeight,
|
|
106
106
|
}) => {
|
|
107
107
|
const labels = useMemo(() => mergeQbsTableLabels(labelsProp), [labelsProp]);
|
|
108
|
-
const
|
|
108
|
+
const effectiveWordWrap = useMemo(() => {
|
|
109
|
+
if (!rowViewToggle) return wordWrap;
|
|
110
|
+
return defaultRowView ? wordWrap : 'break-word';
|
|
111
|
+
}, [rowViewToggle, defaultRowView, wordWrap]);
|
|
109
112
|
const [loading, setLoading] = useState(false);
|
|
110
113
|
const [columns, setColumns] = useState(propColumn);
|
|
111
114
|
const [checkedKeys, setCheckedKeys] = useState<(number | string)[]>([]);
|
|
@@ -115,6 +118,14 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
115
118
|
const [tableViewToggle, setTableViewToggle] = useState(tableView);
|
|
116
119
|
const isMobile = useResponsiveStore();
|
|
117
120
|
const tableBodyRef = useRef<HTMLDivElement>(null);
|
|
121
|
+
const [rowViewRefreshKey, setRowViewRefreshKey] = useState(0);
|
|
122
|
+
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
if (rowViewToggle) {
|
|
125
|
+
setRowViewRefreshKey(key => key + 1);
|
|
126
|
+
}
|
|
127
|
+
}, [defaultRowView, rowViewToggle]);
|
|
128
|
+
|
|
118
129
|
const handleSortColumn = useCallback(
|
|
119
130
|
(sortColumn: any, sortType: any) => {
|
|
120
131
|
setLoading(true);
|
|
@@ -602,13 +613,13 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
602
613
|
{tableViewToggle ? (
|
|
603
614
|
<Table
|
|
604
615
|
height={autoHeight ? undefined : height}
|
|
605
|
-
key={tableKey}
|
|
616
|
+
key={`${tableKey}-${rowViewRefreshKey}`}
|
|
606
617
|
tableKey={tableKey}
|
|
607
618
|
rtl={rtl}
|
|
608
619
|
data={data}
|
|
609
620
|
tableBodyRef={tableBodyRef as React.RefObject<HTMLDivElement>}
|
|
610
621
|
dataTheme={dataTheme}
|
|
611
|
-
wordWrap={
|
|
622
|
+
wordWrap={effectiveWordWrap}
|
|
612
623
|
autoHeight={autoHeight}
|
|
613
624
|
sortColumn={sortColumn}
|
|
614
625
|
style={{ position: 'relative' }}
|
|
@@ -728,7 +739,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
728
739
|
{columnsRendered}
|
|
729
740
|
{!actionProps ||
|
|
730
741
|
(actionProps?.length === 0 && columnToggle && (
|
|
731
|
-
<Column width={40} fixed=
|
|
742
|
+
<Column width={40} fixed="right">
|
|
732
743
|
<HeaderCell
|
|
733
744
|
verticalAlign={findGrouped() ? 'middle' : undefined}
|
|
734
745
|
className={` ${classes.headerlClass}`}
|
|
@@ -752,7 +763,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
752
763
|
</Column>
|
|
753
764
|
))}
|
|
754
765
|
{actionProps && actionProps?.length > 0 && (
|
|
755
|
-
<Column width={40} fixed=
|
|
766
|
+
<Column width={40} fixed="right">
|
|
756
767
|
<HeaderCell
|
|
757
768
|
verticalAlign={findGrouped() ? 'middle' : undefined}
|
|
758
769
|
className={` ${classes.headerlClass}`}
|
|
@@ -94,7 +94,10 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
94
94
|
isFullScreen = false,
|
|
95
95
|
}) => {
|
|
96
96
|
const labels = useMemo(() => mergeQbsTableLabels(labelsProp), [labelsProp]);
|
|
97
|
-
const
|
|
97
|
+
const effectiveWordWrap = useMemo(() => {
|
|
98
|
+
if (!rowViewToggle) return wordWrap;
|
|
99
|
+
return defaultRowView ? wordWrap : 'break-word';
|
|
100
|
+
}, [rowViewToggle, defaultRowView, wordWrap]);
|
|
98
101
|
const [loading, setLoading] = useState(false);
|
|
99
102
|
const [columns, setColumns] = useState(propColumn);
|
|
100
103
|
const [checkedKeys, setCheckedKeys] = useState<(number | string)[]>([]);
|
|
@@ -478,7 +481,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
478
481
|
data={data}
|
|
479
482
|
tableBodyRef={tableBodyRef as React.RefObject<HTMLDivElement>}
|
|
480
483
|
dataTheme={dataTheme}
|
|
481
|
-
wordWrap={
|
|
484
|
+
wordWrap={effectiveWordWrap}
|
|
482
485
|
autoHeight={autoHeight}
|
|
483
486
|
sortColumn={sortColumn}
|
|
484
487
|
style={{ position: 'relative' }}
|
|
@@ -595,7 +598,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
595
598
|
{columnsRendered}
|
|
596
599
|
{!actionProps ||
|
|
597
600
|
(actionProps?.length === 0 && columnToggle && (
|
|
598
|
-
<Column width={40} fixed=
|
|
601
|
+
<Column width={40} fixed="right">
|
|
599
602
|
<HeaderCell
|
|
600
603
|
verticalAlign={findGrouped() ? 'middle' : undefined}
|
|
601
604
|
className={` ${classes.headerlClass}`}
|
|
@@ -619,7 +622,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
619
622
|
</Column>
|
|
620
623
|
))}
|
|
621
624
|
{actionProps && actionProps?.length > 0 && (
|
|
622
|
-
<Column width={40} fixed=
|
|
625
|
+
<Column width={40} fixed="right">
|
|
623
626
|
<HeaderCell
|
|
624
627
|
verticalAlign={findGrouped() ? 'middle' : undefined}
|
|
625
628
|
className={` ${classes.headerlClass}`}
|
package/src/qbsTable/Toolbar.tsx
CHANGED
|
@@ -36,7 +36,6 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
|
|
|
36
36
|
setRowViewToggle,
|
|
37
37
|
isFullScreen = false,
|
|
38
38
|
labels: labelsProp,
|
|
39
|
-
rtl = false,
|
|
40
39
|
}) => {
|
|
41
40
|
const labels = useMemo(() => mergeQbsTableLabels(labelsProp), [labelsProp]);
|
|
42
41
|
const debouncedOnSearch = useCallback(debounce(onSearch ?? (() => {}), 1000), [onSearch]);
|
|
@@ -78,7 +77,7 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
|
|
|
78
77
|
};
|
|
79
78
|
|
|
80
79
|
return (
|
|
81
|
-
<div className="qbs-table-toolbar-container" ref={toolbarRef}
|
|
80
|
+
<div className="qbs-table-toolbar-container" ref={toolbarRef}>
|
|
82
81
|
<div className={`qbs-table-toolbar ${className ?? ''}`}>
|
|
83
82
|
<div className="start-container" style={{ display: 'flex', justifyContent: 'flex-end' }}>
|
|
84
83
|
<div className="qbs-table-primary-filter">
|
|
@@ -116,32 +115,44 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
|
|
|
116
115
|
{tableHeaderActions}
|
|
117
116
|
<div className="pr-1 cursor-pointer relative table_custom_ctions">
|
|
118
117
|
{(rowViewToggle || isFullScreen) && (
|
|
119
|
-
<div className="flex gap-2 qbs-row-switch-
|
|
118
|
+
<div className="flex gap-2 qbs-row-switch-cntainer">
|
|
120
119
|
{rowViewToggle && (
|
|
121
120
|
<div className="flex gap-2 table_cell_style qbs-table-top-icons">
|
|
122
121
|
<TooltipComponent
|
|
123
122
|
tableBodyRef={toolbarRef}
|
|
124
123
|
title={labels.switchToDefaultView ?? ''}
|
|
125
124
|
>
|
|
126
|
-
<
|
|
127
|
-
|
|
128
|
-
|
|
125
|
+
<div
|
|
126
|
+
role="button"
|
|
127
|
+
tabIndex={0}
|
|
128
|
+
title={labels.switchToDefaultView}
|
|
129
129
|
onClick={() => setRowViewToggle?.(true)}
|
|
130
|
+
onKeyDown={e => {
|
|
131
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
132
|
+
setRowViewToggle?.(true);
|
|
133
|
+
}
|
|
134
|
+
}}
|
|
130
135
|
>
|
|
131
136
|
<DefaultView className={`${defaultRowView ? 'active' : ''}`} />
|
|
132
|
-
</
|
|
137
|
+
</div>
|
|
133
138
|
</TooltipComponent>
|
|
134
139
|
<TooltipComponent
|
|
135
140
|
tableBodyRef={toolbarRef}
|
|
136
141
|
title={labels.switchToRelaxedView ?? ''}
|
|
137
142
|
>
|
|
138
|
-
<
|
|
139
|
-
|
|
140
|
-
|
|
143
|
+
<div
|
|
144
|
+
role="button"
|
|
145
|
+
tabIndex={0}
|
|
146
|
+
title={labels.switchToRelaxedView}
|
|
141
147
|
onClick={() => setRowViewToggle?.(false)}
|
|
148
|
+
onKeyDown={e => {
|
|
149
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
150
|
+
setRowViewToggle?.(false);
|
|
151
|
+
}
|
|
152
|
+
}}
|
|
142
153
|
>
|
|
143
154
|
<ContentView className={`${!defaultRowView ? 'active' : ''}`} />
|
|
144
|
-
</
|
|
155
|
+
</div>
|
|
145
156
|
</TooltipComponent>
|
|
146
157
|
</div>
|
|
147
158
|
)}
|
|
@@ -151,13 +162,19 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
|
|
|
151
162
|
tableBodyRef={toolbarRef}
|
|
152
163
|
title={labels.switchToFullScreen ?? ''}
|
|
153
164
|
>
|
|
154
|
-
<
|
|
155
|
-
|
|
156
|
-
|
|
165
|
+
<div
|
|
166
|
+
role="button"
|
|
167
|
+
tabIndex={0}
|
|
168
|
+
title={labels.switchToFullScreen}
|
|
157
169
|
onClick={() => setTableFullView?.(!fullWidthView)}
|
|
170
|
+
onKeyDown={e => {
|
|
171
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
172
|
+
setTableFullView?.(!fullWidthView);
|
|
173
|
+
}
|
|
174
|
+
}}
|
|
158
175
|
>
|
|
159
176
|
<ExpandIcon className={`${fullWidthView ? 'active' : ''}`} />
|
|
160
|
-
</
|
|
177
|
+
</div>
|
|
161
178
|
</TooltipComponent>
|
|
162
179
|
</div>
|
|
163
180
|
)}
|
|
@@ -167,25 +184,17 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
|
|
|
167
184
|
{enableTableToggle && !isMobile && (
|
|
168
185
|
<div className="qbs-table-top-icons flex gap-2">
|
|
169
186
|
<TooltipComponent tableBodyRef={toolbarRef} title={labels.switchToTableView ?? ''}>
|
|
170
|
-
<
|
|
171
|
-
type="button"
|
|
172
|
-
className="qbs-table-view-btn"
|
|
173
|
-
onClick={() => setTableViewToggle?.(true)}
|
|
174
|
-
>
|
|
187
|
+
<div onClick={() => setTableViewToggle?.(true)}>
|
|
175
188
|
<TableView className={`${tableViewToggle ? 'active' : ''}`} />
|
|
176
|
-
</
|
|
189
|
+
</div>
|
|
177
190
|
</TooltipComponent>
|
|
178
191
|
|
|
179
192
|
<div className="border-r h-4 w-1" />
|
|
180
193
|
|
|
181
194
|
<TooltipComponent tableBodyRef={toolbarRef} title={labels.switchToCardView ?? ''}>
|
|
182
|
-
<
|
|
183
|
-
type="button"
|
|
184
|
-
className="qbs-table-view-btn"
|
|
185
|
-
onClick={() => setTableViewToggle?.(false)}
|
|
186
|
-
>
|
|
195
|
+
<div onClick={() => setTableViewToggle?.(false)}>
|
|
187
196
|
<CardView className={`${!tableViewToggle ? 'active' : ''}`} />
|
|
188
|
-
</
|
|
197
|
+
</div>
|
|
189
198
|
</TooltipComponent>
|
|
190
199
|
</div>
|
|
191
200
|
)}
|