qbs-react-grid 2.2.6 → 2.2.9
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/index.d.ts +2 -0
- package/es/index.js +2 -1
- package/es/less/qbs-table.less +58 -4
- package/es/qbsTable/CustomTableCell.js +4 -2
- package/es/qbsTable/QbsTable.js +39 -6
- package/es/qbsTable/TableCardList.js +37 -6
- package/es/qbsTable/Toolbar.js +87 -23
- package/es/qbsTable/commontypes.d.ts +18 -0
- package/es/qbsTable/labels.d.ts +25 -0
- package/es/qbsTable/labels.js +32 -0
- package/es/qbsTable/utilities/ColumShowHide.d.ts +3 -0
- package/es/qbsTable/utilities/ColumShowHide.js +112 -33
- package/es/qbsTable/utilities/VerticalDropDownMenu.js +22 -5
- package/es/qbsTable/utilities/columnToggleCoordinator.d.ts +5 -0
- package/es/qbsTable/utilities/columnToggleCoordinator.js +9 -0
- package/es/qbsTable/utilities/icons.d.ts +3 -0
- package/es/qbsTable/utilities/icons.js +67 -3
- package/es/qbsTable/utilities/verticalMenuCoordinator.d.ts +5 -0
- package/es/qbsTable/utilities/verticalMenuCoordinator.js +9 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +6 -2
- package/lib/less/qbs-table.less +58 -4
- package/lib/qbsTable/CustomTableCell.js +4 -2
- package/lib/qbsTable/QbsTable.js +39 -6
- package/lib/qbsTable/TableCardList.js +37 -6
- package/lib/qbsTable/Toolbar.js +85 -21
- package/lib/qbsTable/commontypes.d.ts +18 -0
- package/lib/qbsTable/labels.d.ts +25 -0
- package/lib/qbsTable/labels.js +40 -0
- package/lib/qbsTable/utilities/ColumShowHide.d.ts +3 -0
- package/lib/qbsTable/utilities/ColumShowHide.js +112 -32
- package/lib/qbsTable/utilities/VerticalDropDownMenu.js +21 -4
- package/lib/qbsTable/utilities/columnToggleCoordinator.d.ts +5 -0
- package/lib/qbsTable/utilities/columnToggleCoordinator.js +15 -0
- package/lib/qbsTable/utilities/icons.d.ts +3 -0
- package/lib/qbsTable/utilities/icons.js +72 -5
- package/lib/qbsTable/utilities/verticalMenuCoordinator.d.ts +5 -0
- package/lib/qbsTable/utilities/verticalMenuCoordinator.js +15 -0
- package/package.json +1 -1
- package/src/index.ts +6 -0
- package/src/less/qbs-table.less +58 -4
- package/src/qbsTable/CustomTableCell.tsx +4 -2
- package/src/qbsTable/QbsTable.tsx +30 -4
- package/src/qbsTable/TableCardList.tsx +28 -4
- package/src/qbsTable/Toolbar.tsx +99 -29
- package/src/qbsTable/commontypes.ts +19 -0
- package/src/qbsTable/labels.ts +55 -0
- package/src/qbsTable/utilities/ColumShowHide.tsx +170 -84
- package/src/qbsTable/utilities/VerticalDropDownMenu.tsx +26 -3
- package/src/qbsTable/utilities/columnToggleCoordinator.ts +14 -0
- package/src/qbsTable/utilities/icons.tsx +76 -3
- package/src/qbsTable/utilities/verticalMenuCoordinator.ts +14 -0
|
@@ -1,12 +1,17 @@
|
|
|
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"));
|
|
8
|
+
var _labels = require("../labels");
|
|
9
|
+
var _columnToggleCoordinator = require("./columnToggleCoordinator");
|
|
6
10
|
var _icons = require("./icons");
|
|
7
11
|
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); }
|
|
8
12
|
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; }
|
|
9
13
|
var ColumnToggle = function ColumnToggle(_ref) {
|
|
14
|
+
var _document$getElementB;
|
|
10
15
|
var columns = _ref.columns,
|
|
11
16
|
onToggle = _ref.onToggle,
|
|
12
17
|
onReorder = _ref.onReorder,
|
|
@@ -15,14 +20,71 @@ var ColumnToggle = function ColumnToggle(_ref) {
|
|
|
15
20
|
handleResetColumns = _ref.handleResetColumns,
|
|
16
21
|
handleColumnToggle = _ref.handleColumnToggle,
|
|
17
22
|
_ref$tableHeight = _ref.tableHeight,
|
|
18
|
-
tableHeight = _ref$tableHeight === void 0 ? 450 : _ref$tableHeight
|
|
23
|
+
tableHeight = _ref$tableHeight === void 0 ? 450 : _ref$tableHeight,
|
|
24
|
+
labelsProp = _ref.labels,
|
|
25
|
+
_ref$rtl = _ref.rtl,
|
|
26
|
+
rtl = _ref$rtl === void 0 ? false : _ref$rtl;
|
|
27
|
+
var labels = (0, _labels.mergeQbsTableLabels)(labelsProp);
|
|
28
|
+
var toggleId = (0, _react.useId)();
|
|
19
29
|
var _useState = (0, _react.useState)(null),
|
|
20
30
|
draggedItem = _useState[0],
|
|
21
31
|
setDraggedItem = _useState[1];
|
|
22
32
|
var popupRef = (0, _react.useRef)(null);
|
|
33
|
+
var settingsBtnRef = (0, _react.useRef)(null);
|
|
23
34
|
var _useState2 = (0, _react.useState)(),
|
|
24
35
|
dragOverPosition = _useState2[0],
|
|
25
36
|
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
|
+
(0, _react.useEffect)(function () {
|
|
67
|
+
var handleCloseOthers = function handleCloseOthers(event) {
|
|
68
|
+
var detail = event.detail;
|
|
69
|
+
if ((detail === null || detail === void 0 ? void 0 : detail.exceptId) !== toggleId) {
|
|
70
|
+
setIsOpen(false);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
document.addEventListener(_columnToggleCoordinator.COLUMN_TOGGLE_CLOSE_OTHERS, handleCloseOthers);
|
|
74
|
+
return function () {
|
|
75
|
+
return document.removeEventListener(_columnToggleCoordinator.COLUMN_TOGGLE_CLOSE_OTHERS, handleCloseOthers);
|
|
76
|
+
};
|
|
77
|
+
}, [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]);
|
|
26
88
|
var handleToggle = (0, _react.useCallback)(function (columnName) {
|
|
27
89
|
onToggle(columnName);
|
|
28
90
|
}, [onToggle]);
|
|
@@ -45,18 +107,22 @@ var ColumnToggle = function ColumnToggle(_ref) {
|
|
|
45
107
|
setDragOverPosition(null);
|
|
46
108
|
}
|
|
47
109
|
setDraggedItem(null);
|
|
48
|
-
}, [columns, draggedItem]);
|
|
110
|
+
}, [columns, draggedItem, onReorder]);
|
|
49
111
|
var handleClickOutside = (0, _react.useCallback)(function (event) {
|
|
50
|
-
|
|
51
|
-
|
|
112
|
+
var _popupRef$current3, _settingsBtnRef$curre;
|
|
113
|
+
var target = event.target;
|
|
114
|
+
if ((_popupRef$current3 = popupRef.current) !== null && _popupRef$current3 !== void 0 && _popupRef$current3.contains(target) || (_settingsBtnRef$curre = settingsBtnRef.current) !== null && _settingsBtnRef$curre !== void 0 && _settingsBtnRef$curre.contains(target)) {
|
|
115
|
+
return;
|
|
52
116
|
}
|
|
117
|
+
setIsOpen(false);
|
|
53
118
|
}, [setIsOpen]);
|
|
54
119
|
(0, _react.useEffect)(function () {
|
|
120
|
+
if (!isOpen) return;
|
|
55
121
|
document.addEventListener('mousedown', handleClickOutside);
|
|
56
122
|
return function () {
|
|
57
|
-
document.removeEventListener('mousedown', handleClickOutside);
|
|
123
|
+
return document.removeEventListener('mousedown', handleClickOutside);
|
|
58
124
|
};
|
|
59
|
-
}, [handleClickOutside]);
|
|
125
|
+
}, [handleClickOutside, isOpen]);
|
|
60
126
|
var renderFixedColumn = function renderFixedColumn(column, index) {
|
|
61
127
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
62
128
|
key: column.title,
|
|
@@ -148,80 +214,94 @@ var ColumnToggle = function ColumnToggle(_ref) {
|
|
|
148
214
|
var _columns$filter;
|
|
149
215
|
return ((_columns$filter = columns.filter(function (item) {
|
|
150
216
|
return !item.isVisible;
|
|
151
|
-
})) === null || _columns$filter === void 0 ? void 0 : _columns$filter.length) > 0
|
|
217
|
+
})) === null || _columns$filter === void 0 ? void 0 : _columns$filter.length) > 0;
|
|
152
218
|
};
|
|
153
219
|
var handleColToggle = function handleColToggle() {
|
|
154
220
|
setIsOpen(false);
|
|
155
221
|
handleColumnToggle === null || handleColumnToggle === void 0 ? void 0 : handleColumnToggle(columns);
|
|
156
222
|
};
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
}, /*#__PURE__*/_react["default"].createElement(_icons.SettingsIcon, null)), isOpen && /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
162
|
-
className: "qbs-table-column-popup",
|
|
223
|
+
var portalTarget = (_document$getElementB = document.getElementById('portal-root')) != null ? _document$getElementB : document.body;
|
|
224
|
+
var popupContent = /*#__PURE__*/_react["default"].createElement("div", {
|
|
225
|
+
className: "qbs-table-column-popup" + (rtl ? ' qbs-table-column-popup--rtl' : ''),
|
|
163
226
|
style: {
|
|
164
|
-
|
|
227
|
+
position: 'fixed',
|
|
228
|
+
top: position.top,
|
|
229
|
+
left: position.left,
|
|
230
|
+
maxHeight: tableHeight - 40,
|
|
231
|
+
zIndex: 10060
|
|
165
232
|
},
|
|
166
|
-
ref: popupRef
|
|
233
|
+
ref: popupRef,
|
|
234
|
+
dir: rtl ? 'rtl' : 'ltr'
|
|
167
235
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
168
236
|
className: "qbs-table-popup-container"
|
|
169
237
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
170
238
|
className: "qbs-table-popup-item"
|
|
171
239
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
172
240
|
className: "qbs-table-popup-label"
|
|
173
|
-
},
|
|
241
|
+
}, labels.fixedColumns), /*#__PURE__*/_react["default"].createElement("div", {
|
|
174
242
|
className: "qbs-table-columns-container"
|
|
175
243
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
176
244
|
className: "qbs-table-column"
|
|
177
245
|
}, columns.map(function (column, index) {
|
|
178
|
-
return column.fixed ? renderFixedColumn(column, index) :
|
|
246
|
+
return column.fixed ? renderFixedColumn(column, index) : null;
|
|
179
247
|
})))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
180
248
|
className: "qbs-table-divider"
|
|
181
249
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
182
250
|
className: "qbs-table-popup-item"
|
|
183
251
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
184
252
|
className: "qbs-table-popup-label"
|
|
185
|
-
},
|
|
253
|
+
}, labels.visibleColumns), /*#__PURE__*/_react["default"].createElement("div", {
|
|
186
254
|
className: "qbs-table-columns-container"
|
|
187
255
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
188
256
|
className: "qbs-table-column"
|
|
189
257
|
}, columns.map(function (column, index) {
|
|
190
|
-
return column.isVisible && !column.fixed ? renderColumn(column, index) :
|
|
258
|
+
return column.isVisible && !column.fixed ? renderColumn(column, index) : null;
|
|
191
259
|
})))), handleAvailableColumns() && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
192
260
|
className: "qbs-table-divider"
|
|
193
261
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
194
262
|
className: "qbs-table-popup-item"
|
|
195
263
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
196
264
|
className: "qbs-table-popup-label"
|
|
197
|
-
},
|
|
265
|
+
}, labels.availableColumns), /*#__PURE__*/_react["default"].createElement("div", {
|
|
198
266
|
className: "qbs-table-columns-container"
|
|
199
267
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
200
268
|
className: "qbs-table-column"
|
|
201
269
|
}, columns.map(function (column, index) {
|
|
202
|
-
return !column.isVisible && !column.fixed ? renderFixedColumn(column, index) :
|
|
270
|
+
return !column.isVisible && !column.fixed ? renderFixedColumn(column, index) : null;
|
|
203
271
|
})))))), handleResetColumns && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
204
272
|
className: "qbs-table-divider"
|
|
205
273
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
206
|
-
className: "qbs-table-popup-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
flexDirection: 'row',
|
|
210
|
-
justifyContent: 'space-between'
|
|
211
|
-
}
|
|
212
|
-
}, /*#__PURE__*/_react["default"].createElement("a", {
|
|
274
|
+
className: "qbs-table-popup-footer"
|
|
275
|
+
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
276
|
+
type: "button",
|
|
213
277
|
className: "qbs-table-reset-link",
|
|
214
|
-
href: "#",
|
|
215
278
|
onClick: function onClick() {
|
|
216
279
|
return handleResetColumns === null || handleResetColumns === void 0 ? void 0 : handleResetColumns();
|
|
217
280
|
}
|
|
218
|
-
},
|
|
281
|
+
}, labels.resetToDefault), /*#__PURE__*/_react["default"].createElement("button", {
|
|
282
|
+
type: "button",
|
|
219
283
|
className: "qbs-table-reset-link",
|
|
220
|
-
href: "#",
|
|
221
284
|
onClick: function onClick() {
|
|
222
285
|
return handleColToggle();
|
|
223
286
|
}
|
|
224
|
-
},
|
|
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));
|
|
225
305
|
};
|
|
226
306
|
var _default = ColumnToggle;
|
|
227
307
|
exports["default"] = _default;
|
|
@@ -7,6 +7,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
7
7
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
8
8
|
var _icons = require("./icons");
|
|
9
9
|
var _ToolTip = _interopRequireDefault(require("./ToolTip"));
|
|
10
|
+
var _verticalMenuCoordinator = require("./verticalMenuCoordinator");
|
|
10
11
|
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); }
|
|
11
12
|
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; }
|
|
12
13
|
function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -28,8 +29,21 @@ var VerticalMenuDropdown = function VerticalMenuDropdown(_ref) {
|
|
|
28
29
|
}),
|
|
29
30
|
position = _useState2[0],
|
|
30
31
|
setPosition = _useState2[1];
|
|
32
|
+
var menuId = (0, _react.useId)();
|
|
31
33
|
var menuButtonRef = (0, _react.useRef)(null);
|
|
32
34
|
var menuRef = (0, _react.useRef)(null);
|
|
35
|
+
(0, _react.useEffect)(function () {
|
|
36
|
+
var handleCloseOthers = function handleCloseOthers(event) {
|
|
37
|
+
var detail = event.detail;
|
|
38
|
+
if ((detail === null || detail === void 0 ? void 0 : detail.exceptId) !== menuId) {
|
|
39
|
+
setOpenMenu(false);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
document.addEventListener(_verticalMenuCoordinator.VERTICAL_MENU_CLOSE_OTHERS, handleCloseOthers);
|
|
43
|
+
return function () {
|
|
44
|
+
return document.removeEventListener(_verticalMenuCoordinator.VERTICAL_MENU_CLOSE_OTHERS, handleCloseOthers);
|
|
45
|
+
};
|
|
46
|
+
}, [menuId]);
|
|
33
47
|
var updateMenuPosition = function updateMenuPosition() {
|
|
34
48
|
var _actionDropDown$filte;
|
|
35
49
|
if (!menuButtonRef.current) return;
|
|
@@ -161,10 +175,13 @@ var VerticalMenuDropdown = function VerticalMenuDropdown(_ref) {
|
|
|
161
175
|
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",
|
|
162
176
|
onClick: function onClick(event) {
|
|
163
177
|
event.stopPropagation();
|
|
164
|
-
if (
|
|
165
|
-
|
|
166
|
-
return
|
|
167
|
-
}
|
|
178
|
+
if (openMenu) {
|
|
179
|
+
setOpenMenu(false);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
(0, _verticalMenuCoordinator.closeOtherVerticalMenus)(menuId);
|
|
183
|
+
updateMenuPosition();
|
|
184
|
+
setOpenMenu(true);
|
|
168
185
|
},
|
|
169
186
|
ref: menuButtonRef
|
|
170
187
|
}, /*#__PURE__*/_react["default"].createElement(_icons.ThreeDotIcon, null))), openMenu && portalTarget && /*#__PURE__*/_reactDom["default"].createPortal(dropdownContent, portalTarget));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.closeOtherColumnToggles = exports.COLUMN_TOGGLE_CLOSE_OTHERS = void 0;
|
|
5
|
+
var COLUMN_TOGGLE_CLOSE_OTHERS = 'qbs-column-toggle-close-others';
|
|
6
|
+
exports.COLUMN_TOGGLE_CLOSE_OTHERS = COLUMN_TOGGLE_CLOSE_OTHERS;
|
|
7
|
+
var closeOtherColumnToggles = function closeOtherColumnToggles(exceptId) {
|
|
8
|
+
if (typeof document === 'undefined') return;
|
|
9
|
+
document.dispatchEvent(new CustomEvent(COLUMN_TOGGLE_CLOSE_OTHERS, {
|
|
10
|
+
detail: {
|
|
11
|
+
exceptId: exceptId
|
|
12
|
+
}
|
|
13
|
+
}));
|
|
14
|
+
};
|
|
15
|
+
exports.closeOtherColumnToggles = closeOtherColumnToggles;
|
|
@@ -6,3 +6,6 @@ export declare const TableIcon: React.FC<any>;
|
|
|
6
6
|
export declare const CardIcon: React.FC<any>;
|
|
7
7
|
export declare const CardView: React.FC<any>;
|
|
8
8
|
export declare const TableView: React.FC<any>;
|
|
9
|
+
export declare const ExpandIcon: React.FC<any>;
|
|
10
|
+
export declare const ContentView: React.FC<any>;
|
|
11
|
+
export declare const DefaultView: React.FC<any>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.__esModule = true;
|
|
5
|
-
exports.ThreeDotIcon = exports.TableView = exports.TableIcon = exports.SettingsIcon = exports.CardView = exports.CardIcon = exports.ArrowUpIcon = void 0;
|
|
5
|
+
exports.ThreeDotIcon = exports.TableView = exports.TableIcon = exports.SettingsIcon = exports.ExpandIcon = exports.DefaultView = exports.ContentView = exports.CardView = exports.CardIcon = exports.ArrowUpIcon = void 0;
|
|
6
6
|
var _react = _interopRequireDefault(require("react"));
|
|
7
7
|
var ThreeDotIcon = function ThreeDotIcon() {
|
|
8
8
|
return /*#__PURE__*/_react["default"].createElement("svg", {
|
|
@@ -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"
|
|
@@ -31,13 +31,13 @@ var SettingsIcon = function SettingsIcon() {
|
|
|
31
31
|
fillRule: "evenodd",
|
|
32
32
|
clipRule: "evenodd",
|
|
33
33
|
d: "M10 12.5C8.61929 12.5 7.5 11.3807 7.5 10C7.5 8.61929 8.61929 7.5 10 7.5C11.3807 7.5 12.5 8.61929 12.5 10C12.5 11.3807 11.3807 12.5 10 12.5Z",
|
|
34
|
-
stroke: "
|
|
34
|
+
stroke: "currentColor",
|
|
35
35
|
strokeWidth: "1.5",
|
|
36
36
|
strokeLinecap: "round",
|
|
37
37
|
strokeLinejoin: "round"
|
|
38
38
|
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
39
39
|
d: "M1.66797 9.26718C1.66797 8.40052 2.3763 7.68385 3.2513 7.68385C4.75964 7.68385 5.3763 6.61718 4.61797 5.30885C4.18464 4.55885 4.44297 3.58385 5.2013 3.15052L6.64297 2.32552C7.3013 1.93385 8.1513 2.16718 8.54297 2.82552L8.63463 2.98385C9.38463 4.29218 10.618 4.29218 11.3763 2.98385L11.468 2.82552C11.8596 2.16718 12.7096 1.93385 13.368 2.32552L14.8096 3.15052C15.568 3.58385 15.8263 4.55885 15.393 5.30885C14.6346 6.61718 15.2513 7.68385 16.7596 7.68385C17.6263 7.68385 18.343 8.39218 18.343 9.26718V10.7338C18.343 11.6005 17.6346 12.3172 16.7596 12.3172C15.2513 12.3172 14.6346 13.3838 15.393 14.6922C15.8263 15.4505 15.568 16.4172 14.8096 16.8505L13.368 17.6755C12.7096 18.0672 11.8596 17.8339 11.468 17.1755L11.3763 17.0172C10.6263 15.7089 9.39297 15.7089 8.63463 17.0172L8.54297 17.1755C8.1513 17.8339 7.3013 18.0672 6.64297 17.6755L5.2013 16.8505C4.44297 16.4172 4.18464 15.4422 4.61797 14.6922C5.3763 13.3838 4.75964 12.3172 3.2513 12.3172C2.3763 12.3172 1.66797 11.6005 1.66797 10.7338V9.26718Z",
|
|
40
|
-
stroke: "
|
|
40
|
+
stroke: "currentColor",
|
|
41
41
|
strokeWidth: "1.5",
|
|
42
42
|
strokeLinecap: "round",
|
|
43
43
|
strokeLinejoin: "round"
|
|
@@ -137,4 +137,71 @@ var TableView = function TableView(_ref5) {
|
|
|
137
137
|
strokeWidth: "1.5"
|
|
138
138
|
}));
|
|
139
139
|
};
|
|
140
|
-
exports.TableView = TableView;
|
|
140
|
+
exports.TableView = TableView;
|
|
141
|
+
var ExpandIcon = function ExpandIcon(_ref6) {
|
|
142
|
+
var className = _ref6.className;
|
|
143
|
+
return /*#__PURE__*/_react["default"].createElement("svg", {
|
|
144
|
+
width: "16",
|
|
145
|
+
height: "16",
|
|
146
|
+
className: className,
|
|
147
|
+
viewBox: "0 0 16 16",
|
|
148
|
+
fill: "none",
|
|
149
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
150
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
151
|
+
d: "M2.66797 5.33073V2.66406M2.66797 2.66406H5.33464M2.66797 2.66406L6.0013 5.9974M13.3346 5.33073V2.66406M13.3346 2.66406H10.668M13.3346 2.66406L10.0013 5.9974M2.66797 10.6641V13.3307M2.66797 13.3307H5.33464M2.66797 13.3307L6.0013 9.9974M13.3346 13.3307L10.0013 9.9974M13.3346 13.3307V10.6641M13.3346 13.3307H10.668",
|
|
152
|
+
stroke: "currentColor",
|
|
153
|
+
strokeWidth: "1.5",
|
|
154
|
+
strokeLinecap: "round",
|
|
155
|
+
strokeLinejoin: "round"
|
|
156
|
+
}));
|
|
157
|
+
};
|
|
158
|
+
exports.ExpandIcon = ExpandIcon;
|
|
159
|
+
var ContentView = function ContentView(_ref7) {
|
|
160
|
+
var className = _ref7.className;
|
|
161
|
+
return /*#__PURE__*/_react["default"].createElement("svg", {
|
|
162
|
+
width: "16",
|
|
163
|
+
height: "17",
|
|
164
|
+
className: className,
|
|
165
|
+
viewBox: "0 0 16 17",
|
|
166
|
+
fill: "none",
|
|
167
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
168
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
169
|
+
d: "M4.00344 9.48438C3.24485 9.48438 2.94141 9.80804 2.94141 10.6122V12.6553C2.94141 13.4594 3.24485 13.7831 4.00344 13.7831H11.994C12.7526 13.7831 13.056 13.4594 13.056 12.6553V10.6122C13.056 9.80804 12.7526 9.48438 11.994 9.48438H4.00344Z",
|
|
170
|
+
stroke: "currentColor",
|
|
171
|
+
strokeLinecap: "round",
|
|
172
|
+
strokeLinejoin: "round"
|
|
173
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
174
|
+
d: "M4.00344 3.66406C3.24485 3.66406 2.94141 3.98773 2.94141 4.79184V6.835C2.94141 7.63911 3.24485 7.96278 4.00344 7.96278H11.994C12.7526 7.96278 13.056 7.63911 13.056 6.835V4.79184C13.056 3.98773 12.7526 3.66406 11.994 3.66406H4.00344Z",
|
|
175
|
+
stroke: "currentColor",
|
|
176
|
+
strokeLinecap: "round",
|
|
177
|
+
strokeLinejoin: "round"
|
|
178
|
+
}));
|
|
179
|
+
};
|
|
180
|
+
exports.ContentView = ContentView;
|
|
181
|
+
var DefaultView = function DefaultView(_ref8) {
|
|
182
|
+
var className = _ref8.className;
|
|
183
|
+
return /*#__PURE__*/_react["default"].createElement("svg", {
|
|
184
|
+
width: "16",
|
|
185
|
+
height: "17",
|
|
186
|
+
className: className,
|
|
187
|
+
viewBox: "0 0 16 17",
|
|
188
|
+
fill: "none",
|
|
189
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
190
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
191
|
+
fillRule: "evenodd",
|
|
192
|
+
clipRule: "evenodd",
|
|
193
|
+
d: "M2.39844 4.72969C2.39844 4.28786 2.75661 3.92969 3.19844 3.92969H12.7984C13.2403 3.92969 13.5984 4.28786 13.5984 4.72969C13.5984 5.17152 13.2403 5.52969 12.7984 5.52969H3.19844C2.75661 5.52969 2.39844 5.17152 2.39844 4.72969Z",
|
|
194
|
+
fill: "currentColor"
|
|
195
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
196
|
+
fillRule: "evenodd",
|
|
197
|
+
clipRule: "evenodd",
|
|
198
|
+
d: "M2.39844 8.72969C2.39844 8.28786 2.75661 7.92969 3.19844 7.92969H12.7984C13.2403 7.92969 13.5984 8.28786 13.5984 8.72969C13.5984 9.17152 13.2403 9.52969 12.7984 9.52969H3.19844C2.75661 9.52969 2.39844 9.17152 2.39844 8.72969Z",
|
|
199
|
+
fill: "currentColor"
|
|
200
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
201
|
+
fillRule: "evenodd",
|
|
202
|
+
clipRule: "evenodd",
|
|
203
|
+
d: "M2.39844 12.7297C2.39844 12.2879 2.75661 11.9297 3.19844 11.9297H12.7984C13.2403 11.9297 13.5984 12.2879 13.5984 12.7297C13.5984 13.1715 13.2403 13.5297 12.7984 13.5297H3.19844C2.75661 13.5297 2.39844 13.1715 2.39844 12.7297Z",
|
|
204
|
+
fill: "currentColor"
|
|
205
|
+
}));
|
|
206
|
+
};
|
|
207
|
+
exports.DefaultView = DefaultView;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.closeOtherVerticalMenus = exports.VERTICAL_MENU_CLOSE_OTHERS = void 0;
|
|
5
|
+
var VERTICAL_MENU_CLOSE_OTHERS = 'qbs-vertical-menu-close-others';
|
|
6
|
+
exports.VERTICAL_MENU_CLOSE_OTHERS = VERTICAL_MENU_CLOSE_OTHERS;
|
|
7
|
+
var closeOtherVerticalMenus = function closeOtherVerticalMenus(exceptId) {
|
|
8
|
+
if (typeof document === 'undefined') return;
|
|
9
|
+
document.dispatchEvent(new CustomEvent(VERTICAL_MENU_CLOSE_OTHERS, {
|
|
10
|
+
detail: {
|
|
11
|
+
exceptId: exceptId
|
|
12
|
+
}
|
|
13
|
+
}));
|
|
14
|
+
};
|
|
15
|
+
exports.closeOtherVerticalMenus = closeOtherVerticalMenus;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -12,6 +12,12 @@ export type { CellProps } from './Cell';
|
|
|
12
12
|
export type { HeaderCellProps } from './HeaderCell';
|
|
13
13
|
export type { ColumnGroupProps } from './ColumnGroup';
|
|
14
14
|
export type { QbsTableProps } from './qbsTable/commontypes';
|
|
15
|
+
export type { QbsTableLabels } from './qbsTable/labels';
|
|
16
|
+
export {
|
|
17
|
+
mergeQbsTableLabels,
|
|
18
|
+
defaultQbsTableLabels,
|
|
19
|
+
formatSelectedItems,
|
|
20
|
+
} from './qbsTable/labels';
|
|
15
21
|
export type {
|
|
16
22
|
StandardProps,
|
|
17
23
|
SortType,
|
package/src/less/qbs-table.less
CHANGED
|
@@ -376,11 +376,17 @@
|
|
|
376
376
|
gap: 10px;
|
|
377
377
|
align-items: center;
|
|
378
378
|
}
|
|
379
|
+
.qbs-table-settings-wrapper {
|
|
380
|
+
position: relative;
|
|
381
|
+
display: inline-flex;
|
|
382
|
+
align-items: center;
|
|
383
|
+
justify-content: center;
|
|
384
|
+
}
|
|
385
|
+
|
|
379
386
|
.qbs-table-column-popup {
|
|
380
387
|
position: fixed;
|
|
381
388
|
padding: 8px;
|
|
382
|
-
z-index:
|
|
383
|
-
right: 10px;
|
|
389
|
+
z-index: 10060;
|
|
384
390
|
border-radius: 8px;
|
|
385
391
|
background: #fff;
|
|
386
392
|
box-shadow: 0px 8px 20px 0px rgba(0, 0, 0, 0.15);
|
|
@@ -389,7 +395,6 @@
|
|
|
389
395
|
display: flex;
|
|
390
396
|
flex-direction: column;
|
|
391
397
|
max-height: 500px;
|
|
392
|
-
// overflow-y: auto;
|
|
393
398
|
}
|
|
394
399
|
.qbs-table-popup-container {
|
|
395
400
|
max-width: 400px;
|
|
@@ -408,9 +413,37 @@
|
|
|
408
413
|
|
|
409
414
|
.qbs-table-columns-container {
|
|
410
415
|
display: flex;
|
|
416
|
+
flex-direction: row;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.qbs-table-column-popup--rtl .qbs-table-columns-container {
|
|
411
420
|
flex-direction: row-reverse;
|
|
412
421
|
}
|
|
413
422
|
|
|
423
|
+
.qbs-table-popup-footer {
|
|
424
|
+
display: flex;
|
|
425
|
+
flex-direction: row;
|
|
426
|
+
justify-content: space-between;
|
|
427
|
+
align-items: center;
|
|
428
|
+
gap: 8px;
|
|
429
|
+
padding: 4px 0 0;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
.qbs-table-column-popup--rtl .qbs-table-popup-footer {
|
|
433
|
+
flex-direction: row-reverse;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
.qbs-table-reset-link {
|
|
437
|
+
background: none;
|
|
438
|
+
border: none;
|
|
439
|
+
padding: 0;
|
|
440
|
+
cursor: pointer;
|
|
441
|
+
font-size: 13px;
|
|
442
|
+
font-weight: 500;
|
|
443
|
+
color: inherit;
|
|
444
|
+
text-decoration: none;
|
|
445
|
+
}
|
|
446
|
+
|
|
414
447
|
.qbs-table-columns-label {
|
|
415
448
|
display: flex;
|
|
416
449
|
gap: 10px;
|
|
@@ -746,11 +779,32 @@
|
|
|
746
779
|
|
|
747
780
|
.qbs-table-top-icons {
|
|
748
781
|
color: #999696;
|
|
782
|
+
display: inline-flex;
|
|
783
|
+
align-items: center;
|
|
784
|
+
gap: 8px;
|
|
749
785
|
|
|
750
|
-
.active{
|
|
786
|
+
.active {
|
|
751
787
|
color: #EC6A17;
|
|
752
788
|
}
|
|
753
789
|
}
|
|
790
|
+
|
|
791
|
+
.qbs-row-switch-container {
|
|
792
|
+
display: inline-flex;
|
|
793
|
+
align-items: center;
|
|
794
|
+
gap: 8px;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
.qbs-table-view-btn {
|
|
798
|
+
display: inline-flex;
|
|
799
|
+
align-items: center;
|
|
800
|
+
justify-content: center;
|
|
801
|
+
padding: 0;
|
|
802
|
+
margin: 0;
|
|
803
|
+
border: none;
|
|
804
|
+
background: transparent;
|
|
805
|
+
cursor: pointer;
|
|
806
|
+
color: inherit;
|
|
807
|
+
}
|
|
754
808
|
.qbs-card-empty-wrapper {
|
|
755
809
|
display: flex;
|
|
756
810
|
justify-content: center;
|
|
@@ -74,6 +74,8 @@ export const ExpandCell: React.FC<any> = React.memo(
|
|
|
74
74
|
({ rowData, dataKey, expandedRowKeys, onChange, ...props }) => (
|
|
75
75
|
<Cell {...props}>
|
|
76
76
|
<button
|
|
77
|
+
type="button"
|
|
78
|
+
className="qbs-table-expand-btn"
|
|
77
79
|
onClick={() => {
|
|
78
80
|
onChange(rowData);
|
|
79
81
|
}}
|
|
@@ -90,7 +92,7 @@ export const ExpandCell: React.FC<any> = React.memo(
|
|
|
90
92
|
fillRule="evenodd"
|
|
91
93
|
clipRule="evenodd"
|
|
92
94
|
d="M0.792893 0.292893C1.18342 -0.097631 1.81658 -0.097631 2.20711 0.292893L5.5 3.58579L8.79289 0.292893C9.18342 -0.0976311 9.81658 -0.0976311 10.2071 0.292893C10.5976 0.683417 10.5976 1.31658 10.2071 1.70711L6.20711 5.70711C5.81658 6.09763 5.18342 6.09763 4.79289 5.70711L0.792893 1.70711C0.402369 1.31658 0.402369 0.683417 0.792893 0.292893Z"
|
|
93
|
-
fill="
|
|
95
|
+
fill="currentColor"
|
|
94
96
|
/>
|
|
95
97
|
</svg>
|
|
96
98
|
) : (
|
|
@@ -105,7 +107,7 @@ export const ExpandCell: React.FC<any> = React.memo(
|
|
|
105
107
|
fillRule="evenodd"
|
|
106
108
|
clipRule="evenodd"
|
|
107
109
|
d="M0.792894 9.70711C0.402369 9.31658 0.402369 8.68342 0.792894 8.29289L4.08579 5L0.792893 1.70711C0.402369 1.31658 0.402369 0.683418 0.792893 0.292894C1.18342 -0.0976312 1.81658 -0.0976312 2.20711 0.292894L6.20711 4.29289C6.59763 4.68342 6.59763 5.31658 6.20711 5.70711L2.20711 9.70711C1.81658 10.0976 1.18342 10.0976 0.792894 9.70711Z"
|
|
108
|
-
fill="
|
|
110
|
+
fill="currentColor"
|
|
109
111
|
/>
|
|
110
112
|
</svg>
|
|
111
113
|
)}
|