qbs-react-grid 2.2.6 → 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.
Files changed (58) hide show
  1. package/dist/css/qbs-react-grid.css +1 -1
  2. package/dist/css/qbs-react-grid.min.css +1 -1
  3. package/dist/css/qbs-react-grid.min.css.map +1 -1
  4. package/es/index.d.ts +2 -0
  5. package/es/index.js +2 -1
  6. package/es/less/qbs-table.less +89 -6
  7. package/es/qbsTable/CustomTableCell.js +4 -2
  8. package/es/qbsTable/QbsTable.js +52 -6
  9. package/es/qbsTable/TableCardList.js +39 -5
  10. package/es/qbsTable/Toolbar.js +96 -21
  11. package/es/qbsTable/commontypes.d.ts +18 -0
  12. package/es/qbsTable/labels.d.ts +25 -0
  13. package/es/qbsTable/labels.js +32 -0
  14. package/es/qbsTable/utilities/ColumShowHide.d.ts +3 -0
  15. package/es/qbsTable/utilities/ColumShowHide.js +63 -35
  16. package/es/qbsTable/utilities/ToolTip.js +2 -1
  17. package/es/qbsTable/utilities/VerticalDropDownMenu.js +28 -7
  18. package/es/qbsTable/utilities/columnToggleCoordinator.d.ts +5 -0
  19. package/es/qbsTable/utilities/columnToggleCoordinator.js +9 -0
  20. package/es/qbsTable/utilities/icons.d.ts +3 -0
  21. package/es/qbsTable/utilities/icons.js +67 -3
  22. package/es/qbsTable/utilities/verticalMenuCoordinator.d.ts +5 -0
  23. package/es/qbsTable/utilities/verticalMenuCoordinator.js +9 -0
  24. package/lib/index.d.ts +2 -0
  25. package/lib/index.js +6 -2
  26. package/lib/less/qbs-table.less +89 -6
  27. package/lib/qbsTable/CustomTableCell.js +4 -2
  28. package/lib/qbsTable/QbsTable.js +52 -6
  29. package/lib/qbsTable/TableCardList.js +39 -5
  30. package/lib/qbsTable/Toolbar.js +94 -19
  31. package/lib/qbsTable/commontypes.d.ts +18 -0
  32. package/lib/qbsTable/labels.d.ts +25 -0
  33. package/lib/qbsTable/labels.js +40 -0
  34. package/lib/qbsTable/utilities/ColumShowHide.d.ts +3 -0
  35. package/lib/qbsTable/utilities/ColumShowHide.js +62 -34
  36. package/lib/qbsTable/utilities/ToolTip.js +2 -1
  37. package/lib/qbsTable/utilities/VerticalDropDownMenu.js +27 -6
  38. package/lib/qbsTable/utilities/columnToggleCoordinator.d.ts +5 -0
  39. package/lib/qbsTable/utilities/columnToggleCoordinator.js +15 -0
  40. package/lib/qbsTable/utilities/icons.d.ts +3 -0
  41. package/lib/qbsTable/utilities/icons.js +72 -5
  42. package/lib/qbsTable/utilities/verticalMenuCoordinator.d.ts +5 -0
  43. package/lib/qbsTable/utilities/verticalMenuCoordinator.js +15 -0
  44. package/package.json +1 -1
  45. package/src/index.ts +6 -0
  46. package/src/less/qbs-table.less +89 -6
  47. package/src/qbsTable/CustomTableCell.tsx +4 -2
  48. package/src/qbsTable/QbsTable.tsx +41 -4
  49. package/src/qbsTable/TableCardList.tsx +30 -3
  50. package/src/qbsTable/Toolbar.tsx +105 -26
  51. package/src/qbsTable/commontypes.ts +19 -0
  52. package/src/qbsTable/labels.ts +55 -0
  53. package/src/qbsTable/utilities/ColumShowHide.tsx +114 -77
  54. package/src/qbsTable/utilities/ToolTip.tsx +1 -1
  55. package/src/qbsTable/utilities/VerticalDropDownMenu.tsx +36 -5
  56. package/src/qbsTable/utilities/columnToggleCoordinator.ts +14 -0
  57. package/src/qbsTable/utilities/icons.tsx +76 -3
  58. package/src/qbsTable/utilities/verticalMenuCoordinator.ts +14 -0
@@ -1,4 +1,6 @@
1
- import React, { useCallback, useEffect, useRef, useState } from 'react';
1
+ import React, { useCallback, useEffect, useId, useRef, useState } from 'react';
2
+ import { mergeQbsTableLabels } from '../labels';
3
+ import { closeOtherColumnToggles, COLUMN_TOGGLE_CLOSE_OTHERS } from './columnToggleCoordinator';
2
4
  import { SettingsIcon } from './icons';
3
5
  var ColumnToggle = function ColumnToggle(_ref) {
4
6
  var columns = _ref.columns,
@@ -9,7 +11,12 @@ var ColumnToggle = function ColumnToggle(_ref) {
9
11
  handleResetColumns = _ref.handleResetColumns,
10
12
  handleColumnToggle = _ref.handleColumnToggle,
11
13
  _ref$tableHeight = _ref.tableHeight,
12
- tableHeight = _ref$tableHeight === void 0 ? 450 : _ref$tableHeight;
14
+ tableHeight = _ref$tableHeight === void 0 ? 450 : _ref$tableHeight,
15
+ labelsProp = _ref.labels,
16
+ _ref$rtl = _ref.rtl,
17
+ rtl = _ref$rtl === void 0 ? false : _ref$rtl;
18
+ var labels = mergeQbsTableLabels(labelsProp);
19
+ var toggleId = useId();
13
20
  var _useState = useState(null),
14
21
  draggedItem = _useState[0],
15
22
  setDraggedItem = _useState[1];
@@ -17,6 +24,18 @@ var ColumnToggle = function ColumnToggle(_ref) {
17
24
  var _useState2 = useState(),
18
25
  dragOverPosition = _useState2[0],
19
26
  setDragOverPosition = _useState2[1];
27
+ useEffect(function () {
28
+ var handleCloseOthers = function handleCloseOthers(event) {
29
+ var detail = event.detail;
30
+ if ((detail === null || detail === void 0 ? void 0 : detail.exceptId) !== toggleId) {
31
+ setIsOpen(false);
32
+ }
33
+ };
34
+ document.addEventListener(COLUMN_TOGGLE_CLOSE_OTHERS, handleCloseOthers);
35
+ return function () {
36
+ return document.removeEventListener(COLUMN_TOGGLE_CLOSE_OTHERS, handleCloseOthers);
37
+ };
38
+ }, [setIsOpen, toggleId]);
20
39
  var handleToggle = useCallback(function (columnName) {
21
40
  onToggle(columnName);
22
41
  }, [onToggle]);
@@ -39,18 +58,22 @@ var ColumnToggle = function ColumnToggle(_ref) {
39
58
  setDragOverPosition(null);
40
59
  }
41
60
  setDraggedItem(null);
42
- }, [columns, draggedItem]);
61
+ }, [columns, draggedItem, onReorder]);
43
62
  var handleClickOutside = useCallback(function (event) {
44
- if (popupRef.current && !popupRef.current.contains(event.target)) {
45
- setIsOpen(false);
63
+ var _popupRef$current;
64
+ var target = event.target;
65
+ if ((_popupRef$current = popupRef.current) !== null && _popupRef$current !== void 0 && _popupRef$current.contains(target)) {
66
+ return;
46
67
  }
68
+ setIsOpen(false);
47
69
  }, [setIsOpen]);
48
70
  useEffect(function () {
71
+ if (!isOpen) return;
49
72
  document.addEventListener('mousedown', handleClickOutside);
50
73
  return function () {
51
- document.removeEventListener('mousedown', handleClickOutside);
74
+ return document.removeEventListener('mousedown', handleClickOutside);
52
75
  };
53
- }, [handleClickOutside]);
76
+ }, [handleClickOutside, isOpen]);
54
77
  var renderFixedColumn = function renderFixedColumn(column, index) {
55
78
  return /*#__PURE__*/React.createElement("div", {
56
79
  key: column.title,
@@ -67,9 +90,9 @@ var ColumnToggle = function ColumnToggle(_ref) {
67
90
  return handleToggle(column.title);
68
91
  },
69
92
  className: "qbs-table-checkbox-input",
70
- id: column.title
93
+ id: toggleId + "-" + column.title
71
94
  }), /*#__PURE__*/React.createElement("label", {
72
- htmlFor: column.title
95
+ htmlFor: toggleId + "-" + column.title
73
96
  }, /*#__PURE__*/React.createElement("svg", {
74
97
  width: "8",
75
98
  height: "6",
@@ -109,9 +132,9 @@ var ColumnToggle = function ColumnToggle(_ref) {
109
132
  return handleToggle(column.title);
110
133
  },
111
134
  className: "qbs-table-checkbox-input",
112
- id: column.title
135
+ id: toggleId + "-" + column.title
113
136
  }), /*#__PURE__*/React.createElement("label", {
114
- htmlFor: column.title
137
+ htmlFor: toggleId + "-" + column.title
115
138
  }, /*#__PURE__*/React.createElement("svg", {
116
139
  width: "8",
117
140
  height: "6",
@@ -142,79 +165,84 @@ var ColumnToggle = function ColumnToggle(_ref) {
142
165
  var _columns$filter;
143
166
  return ((_columns$filter = columns.filter(function (item) {
144
167
  return !item.isVisible;
145
- })) === null || _columns$filter === void 0 ? void 0 : _columns$filter.length) > 0 ? true : false;
168
+ })) === null || _columns$filter === void 0 ? void 0 : _columns$filter.length) > 0;
146
169
  };
147
170
  var handleColToggle = function handleColToggle() {
148
171
  setIsOpen(false);
149
172
  handleColumnToggle === null || handleColumnToggle === void 0 ? void 0 : handleColumnToggle(columns);
150
173
  };
151
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("button", {
152
- onClick: function onClick() {
153
- return setIsOpen(!isOpen);
174
+ return /*#__PURE__*/React.createElement("div", {
175
+ className: "qbs-table-settings-wrapper"
176
+ }, /*#__PURE__*/React.createElement("button", {
177
+ type: "button",
178
+ onClick: function onClick(event) {
179
+ event.stopPropagation();
180
+ if (isOpen) {
181
+ setIsOpen(false);
182
+ return;
183
+ }
184
+ closeOtherColumnToggles(toggleId);
185
+ setIsOpen(true);
154
186
  }
155
- }, /*#__PURE__*/React.createElement(SettingsIcon, null)), isOpen && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
156
- className: "qbs-table-column-popup",
187
+ }, /*#__PURE__*/React.createElement(SettingsIcon, null)), isOpen && /*#__PURE__*/React.createElement("div", {
188
+ className: "qbs-table-column-popup" + (rtl ? ' qbs-table-column-popup--rtl' : ''),
157
189
  style: {
158
190
  maxHeight: tableHeight - 40
159
191
  },
160
- ref: popupRef
192
+ ref: popupRef,
193
+ dir: rtl ? 'rtl' : 'ltr'
161
194
  }, /*#__PURE__*/React.createElement("div", {
162
195
  className: "qbs-table-popup-container"
163
196
  }, /*#__PURE__*/React.createElement("div", {
164
197
  className: "qbs-table-popup-item"
165
198
  }, /*#__PURE__*/React.createElement("div", {
166
199
  className: "qbs-table-popup-label"
167
- }, "FIXED COLUMNS"), /*#__PURE__*/React.createElement("div", {
200
+ }, labels.fixedColumns), /*#__PURE__*/React.createElement("div", {
168
201
  className: "qbs-table-columns-container"
169
202
  }, /*#__PURE__*/React.createElement("div", {
170
203
  className: "qbs-table-column"
171
204
  }, columns.map(function (column, index) {
172
- return column.fixed ? renderFixedColumn(column, index) : '';
205
+ return column.fixed ? renderFixedColumn(column, index) : null;
173
206
  })))), /*#__PURE__*/React.createElement("div", {
174
207
  className: "qbs-table-divider"
175
208
  }), /*#__PURE__*/React.createElement("div", {
176
209
  className: "qbs-table-popup-item"
177
210
  }, /*#__PURE__*/React.createElement("div", {
178
211
  className: "qbs-table-popup-label"
179
- }, "VISIBLE COLUMNS"), /*#__PURE__*/React.createElement("div", {
212
+ }, labels.visibleColumns), /*#__PURE__*/React.createElement("div", {
180
213
  className: "qbs-table-columns-container"
181
214
  }, /*#__PURE__*/React.createElement("div", {
182
215
  className: "qbs-table-column"
183
216
  }, columns.map(function (column, index) {
184
- return column.isVisible && !column.fixed ? renderColumn(column, index) : '';
217
+ return column.isVisible && !column.fixed ? renderColumn(column, index) : null;
185
218
  })))), handleAvailableColumns() && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
186
219
  className: "qbs-table-divider"
187
220
  }), /*#__PURE__*/React.createElement("div", {
188
221
  className: "qbs-table-popup-item"
189
222
  }, /*#__PURE__*/React.createElement("div", {
190
223
  className: "qbs-table-popup-label"
191
- }, "AVAILABLE COLUMNS"), /*#__PURE__*/React.createElement("div", {
224
+ }, labels.availableColumns), /*#__PURE__*/React.createElement("div", {
192
225
  className: "qbs-table-columns-container"
193
226
  }, /*#__PURE__*/React.createElement("div", {
194
227
  className: "qbs-table-column"
195
228
  }, columns.map(function (column, index) {
196
- return !column.isVisible && !column.fixed ? renderFixedColumn(column, index) : '';
229
+ return !column.isVisible && !column.fixed ? renderFixedColumn(column, index) : null;
197
230
  })))))), handleResetColumns && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
198
231
  className: "qbs-table-divider"
199
232
  }), /*#__PURE__*/React.createElement("div", {
200
- className: "qbs-table-popup-item",
201
- style: {
202
- display: 'flex',
203
- flexDirection: 'row',
204
- justifyContent: 'space-between'
205
- }
206
- }, /*#__PURE__*/React.createElement("a", {
233
+ className: "qbs-table-popup-footer"
234
+ }, /*#__PURE__*/React.createElement("button", {
235
+ type: "button",
207
236
  className: "qbs-table-reset-link",
208
- href: "#",
209
237
  onClick: function onClick() {
210
238
  return handleResetColumns === null || handleResetColumns === void 0 ? void 0 : handleResetColumns();
211
239
  }
212
- }, "Reset to default"), /*#__PURE__*/React.createElement("a", {
240
+ }, labels.resetToDefault), /*#__PURE__*/React.createElement("button", {
241
+ type: "button",
213
242
  className: "qbs-table-reset-link",
214
- href: "#",
215
243
  onClick: function onClick() {
216
244
  return handleColToggle();
217
245
  }
218
- }, "Save"))))));
246
+ }, labels.save)))));
219
247
  };
220
248
  export default ColumnToggle;
@@ -35,7 +35,8 @@ var TooltipComponent = function TooltipComponent(_ref) {
35
35
  }
36
36
  }, children), /*#__PURE__*/React.createElement("span", {
37
37
  ref: dropRef,
38
- className: 'tooltiptext'
38
+ className: "tooltiptext",
39
+ dir: "auto"
39
40
  }, title));
40
41
  };
41
42
  export default TooltipComponent;
@@ -1,10 +1,11 @@
1
1
  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."); }
2
2
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
3
3
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
4
- import React, { useEffect, useRef, useState } from 'react';
4
+ import React, { useEffect, useId, useRef, useState } from 'react';
5
5
  import ReactDOM from 'react-dom';
6
6
  import { ThreeDotIcon } from './icons';
7
7
  import TooltipComponent from './ToolTip';
8
+ import { closeOtherVerticalMenus, VERTICAL_MENU_CLOSE_OTHERS } from './verticalMenuCoordinator';
8
9
  var VerticalMenuDropdown = function VerticalMenuDropdown(_ref) {
9
10
  var _actionDropDown$filte2, _document$getElementB;
10
11
  var actionDropDown = _ref.actionDropDown,
@@ -21,8 +22,21 @@ var VerticalMenuDropdown = function VerticalMenuDropdown(_ref) {
21
22
  }),
22
23
  position = _useState2[0],
23
24
  setPosition = _useState2[1];
25
+ var menuId = useId();
24
26
  var menuButtonRef = useRef(null);
25
27
  var menuRef = useRef(null);
28
+ useEffect(function () {
29
+ var handleCloseOthers = function handleCloseOthers(event) {
30
+ var detail = event.detail;
31
+ if ((detail === null || detail === void 0 ? void 0 : detail.exceptId) !== menuId) {
32
+ setOpenMenu(false);
33
+ }
34
+ };
35
+ document.addEventListener(VERTICAL_MENU_CLOSE_OTHERS, handleCloseOthers);
36
+ return function () {
37
+ return document.removeEventListener(VERTICAL_MENU_CLOSE_OTHERS, handleCloseOthers);
38
+ };
39
+ }, [menuId]);
26
40
  var updateMenuPosition = function updateMenuPosition() {
27
41
  var _actionDropDown$filte;
28
42
  if (!menuButtonRef.current) return;
@@ -37,7 +51,11 @@ var VerticalMenuDropdown = function VerticalMenuDropdown(_ref) {
37
51
  var menuHeight = visibleItems.length * 40;
38
52
  var spaceBelow = window.innerHeight - rect.bottom;
39
53
  var openBelow = spaceBelow >= menuHeight + menuGap;
40
- var left = rect.left;
54
+ var isRtl = (document.documentElement.getAttribute('dir') || document.body.getAttribute('dir') || getComputedStyle(document.documentElement).direction) === 'rtl';
55
+ var left = isRtl ? rect.left : rect.left - menuWidth;
56
+ if (!isRtl && left < viewportPadding) {
57
+ left = rect.left;
58
+ }
41
59
  if (left + menuWidth > window.innerWidth - viewportPadding) {
42
60
  left = Math.max(viewportPadding, rect.right - menuWidth);
43
61
  }
@@ -151,13 +169,16 @@ var VerticalMenuDropdown = function VerticalMenuDropdown(_ref) {
151
169
  className: "inline-block vertical-menu-dropdown-wrapper"
152
170
  }, visibleCount > 0 && /*#__PURE__*/React.createElement("button", {
153
171
  type: "button",
154
- 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",
172
+ className: "vertical-menu-trigger-button",
155
173
  onClick: function onClick(event) {
156
174
  event.stopPropagation();
157
- if (!openMenu) updateMenuPosition();
158
- setOpenMenu(function (prev) {
159
- return !prev;
160
- });
175
+ if (openMenu) {
176
+ setOpenMenu(false);
177
+ return;
178
+ }
179
+ closeOtherVerticalMenus(menuId);
180
+ updateMenuPosition();
181
+ setOpenMenu(true);
161
182
  },
162
183
  ref: menuButtonRef
163
184
  }, /*#__PURE__*/React.createElement(ThreeDotIcon, null))), openMenu && portalTarget && /*#__PURE__*/ReactDOM.createPortal(dropdownContent, portalTarget));
@@ -0,0 +1,5 @@
1
+ export declare const COLUMN_TOGGLE_CLOSE_OTHERS = "qbs-column-toggle-close-others";
2
+ export type ColumnToggleCloseDetail = {
3
+ exceptId: string;
4
+ };
5
+ export declare const closeOtherColumnToggles: (exceptId: string) => void;
@@ -0,0 +1,9 @@
1
+ export var COLUMN_TOGGLE_CLOSE_OTHERS = 'qbs-column-toggle-close-others';
2
+ export var closeOtherColumnToggles = function closeOtherColumnToggles(exceptId) {
3
+ if (typeof document === 'undefined') return;
4
+ document.dispatchEvent(new CustomEvent(COLUMN_TOGGLE_CLOSE_OTHERS, {
5
+ detail: {
6
+ exceptId: exceptId
7
+ }
8
+ }));
9
+ };
@@ -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>;
@@ -8,7 +8,7 @@ export var ThreeDotIcon = function ThreeDotIcon() {
8
8
  xmlns: "http://www.w3.org/2000/svg"
9
9
  }, /*#__PURE__*/React.createElement("path", {
10
10
  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",
11
- stroke: "#313131",
11
+ stroke: "currentColor",
12
12
  strokeWidth: "1.5",
13
13
  strokeLinecap: "round",
14
14
  strokeLinejoin: "round"
@@ -25,13 +25,13 @@ export var SettingsIcon = function SettingsIcon() {
25
25
  fillRule: "evenodd",
26
26
  clipRule: "evenodd",
27
27
  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",
28
- stroke: "#313131",
28
+ stroke: "currentColor",
29
29
  strokeWidth: "1.5",
30
30
  strokeLinecap: "round",
31
31
  strokeLinejoin: "round"
32
32
  }), /*#__PURE__*/React.createElement("path", {
33
33
  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",
34
- stroke: "#313131",
34
+ stroke: "currentColor",
35
35
  strokeWidth: "1.5",
36
36
  strokeLinecap: "round",
37
37
  strokeLinejoin: "round"
@@ -125,4 +125,68 @@ export var TableView = function TableView(_ref5) {
125
125
  stroke: "currentColor",
126
126
  strokeWidth: "1.5"
127
127
  }));
128
+ };
129
+ export var ExpandIcon = function ExpandIcon(_ref6) {
130
+ var className = _ref6.className;
131
+ return /*#__PURE__*/React.createElement("svg", {
132
+ width: "16",
133
+ height: "16",
134
+ className: className,
135
+ viewBox: "0 0 16 16",
136
+ fill: "none",
137
+ xmlns: "http://www.w3.org/2000/svg"
138
+ }, /*#__PURE__*/React.createElement("path", {
139
+ 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",
140
+ stroke: "currentColor",
141
+ strokeWidth: "1.5",
142
+ strokeLinecap: "round",
143
+ strokeLinejoin: "round"
144
+ }));
145
+ };
146
+ export var ContentView = function ContentView(_ref7) {
147
+ var className = _ref7.className;
148
+ return /*#__PURE__*/React.createElement("svg", {
149
+ width: "16",
150
+ height: "17",
151
+ className: className,
152
+ viewBox: "0 0 16 17",
153
+ fill: "none",
154
+ xmlns: "http://www.w3.org/2000/svg"
155
+ }, /*#__PURE__*/React.createElement("path", {
156
+ 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",
157
+ stroke: "currentColor",
158
+ strokeLinecap: "round",
159
+ strokeLinejoin: "round"
160
+ }), /*#__PURE__*/React.createElement("path", {
161
+ 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",
162
+ stroke: "currentColor",
163
+ strokeLinecap: "round",
164
+ strokeLinejoin: "round"
165
+ }));
166
+ };
167
+ export var DefaultView = function DefaultView(_ref8) {
168
+ var className = _ref8.className;
169
+ return /*#__PURE__*/React.createElement("svg", {
170
+ width: "16",
171
+ height: "17",
172
+ className: className,
173
+ viewBox: "0 0 16 17",
174
+ fill: "none",
175
+ xmlns: "http://www.w3.org/2000/svg"
176
+ }, /*#__PURE__*/React.createElement("path", {
177
+ fillRule: "evenodd",
178
+ clipRule: "evenodd",
179
+ 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",
180
+ fill: "currentColor"
181
+ }), /*#__PURE__*/React.createElement("path", {
182
+ fillRule: "evenodd",
183
+ clipRule: "evenodd",
184
+ 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",
185
+ fill: "currentColor"
186
+ }), /*#__PURE__*/React.createElement("path", {
187
+ fillRule: "evenodd",
188
+ clipRule: "evenodd",
189
+ 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",
190
+ fill: "currentColor"
191
+ }));
128
192
  };
@@ -0,0 +1,5 @@
1
+ export declare const VERTICAL_MENU_CLOSE_OTHERS = "qbs-vertical-menu-close-others";
2
+ export type VerticalMenuCloseDetail = {
3
+ exceptId: string;
4
+ };
5
+ export declare const closeOtherVerticalMenus: (exceptId: string) => void;
@@ -0,0 +1,9 @@
1
+ export var VERTICAL_MENU_CLOSE_OTHERS = 'qbs-vertical-menu-close-others';
2
+ export var closeOtherVerticalMenus = function closeOtherVerticalMenus(exceptId) {
3
+ if (typeof document === 'undefined') return;
4
+ document.dispatchEvent(new CustomEvent(VERTICAL_MENU_CLOSE_OTHERS, {
5
+ detail: {
6
+ exceptId: exceptId
7
+ }
8
+ }));
9
+ };
package/lib/index.d.ts CHANGED
@@ -12,4 +12,6 @@ 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 { mergeQbsTableLabels, defaultQbsTableLabels, formatSelectedItems, } from './qbsTable/labels';
15
17
  export type { StandardProps, SortType, RowDataType, RowKeyType, TableSizeChangeEventName } from './@types/common';
package/lib/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
  exports.__esModule = true;
5
- exports.Table = exports.QbsTable = exports.Pagination = exports.HeaderCell = exports.ColumnGroup = exports.Column = exports.Cell = void 0;
5
+ exports.mergeQbsTableLabels = exports.formatSelectedItems = exports.defaultQbsTableLabels = exports.Table = exports.QbsTable = exports.Pagination = exports.HeaderCell = exports.ColumnGroup = exports.Column = exports.Cell = void 0;
6
6
  var _Table = _interopRequireDefault(require("./Table"));
7
7
  exports.Table = _Table["default"];
8
8
  var _Column = _interopRequireDefault(require("./Column"));
@@ -16,4 +16,8 @@ exports.HeaderCell = _HeaderCell["default"];
16
16
  var _ColumnGroup = _interopRequireDefault(require("./ColumnGroup"));
17
17
  exports.ColumnGroup = _ColumnGroup["default"];
18
18
  var _Pagination = _interopRequireDefault(require("./Pagination"));
19
- exports.Pagination = _Pagination["default"];
19
+ exports.Pagination = _Pagination["default"];
20
+ var _labels = require("./qbsTable/labels");
21
+ exports.mergeQbsTableLabels = _labels.mergeQbsTableLabels;
22
+ exports.defaultQbsTableLabels = _labels.defaultQbsTableLabels;
23
+ exports.formatSelectedItems = _labels.formatSelectedItems;
@@ -376,20 +376,54 @@
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
+ 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
+ }
408
+ }
409
+
379
410
  .qbs-table-column-popup {
380
- position: fixed;
411
+ position: absolute;
412
+ top: calc(100% + 4px);
413
+ inset-inline-end: 0;
414
+ inset-inline-start: auto;
381
415
  padding: 8px;
382
- z-index: 999;
383
- right: 10px;
416
+ z-index: 10060;
384
417
  border-radius: 8px;
385
418
  background: #fff;
386
419
  box-shadow: 0px 8px 20px 0px rgba(0, 0, 0, 0.15);
387
- min-width: 272px;
420
+ min-width: 300px;
421
+ width: max-content;
422
+ max-width: min(400px, calc(100vw - 16px));
388
423
  gap: 4px;
389
424
  display: flex;
390
425
  flex-direction: column;
391
426
  max-height: 500px;
392
- // overflow-y: auto;
393
427
  }
394
428
  .qbs-table-popup-container {
395
429
  max-width: 400px;
@@ -411,6 +445,34 @@
411
445
  flex-direction: row-reverse;
412
446
  }
413
447
 
448
+ .qbs-table-popup-footer {
449
+ display: flex;
450
+ flex-direction: row;
451
+ justify-content: space-between;
452
+ align-items: center;
453
+ gap: 8px;
454
+ padding: 4px 0 0;
455
+ }
456
+
457
+ .qbs-table-column-popup--rtl {
458
+ text-align: right;
459
+ }
460
+
461
+ .qbs-table-column-popup--rtl .qbs-table-popup-footer {
462
+ flex-direction: row-reverse;
463
+ }
464
+
465
+ .qbs-table-reset-link {
466
+ background: none;
467
+ border: none;
468
+ padding: 0;
469
+ cursor: pointer;
470
+ font-size: 13px;
471
+ font-weight: 500;
472
+ color: inherit;
473
+ text-decoration: none;
474
+ }
475
+
414
476
  .qbs-table-columns-label {
415
477
  display: flex;
416
478
  gap: 10px;
@@ -746,11 +808,32 @@
746
808
 
747
809
  .qbs-table-top-icons {
748
810
  color: #999696;
811
+ display: inline-flex;
812
+ align-items: center;
813
+ gap: 8px;
749
814
 
750
- .active{
815
+ .active {
751
816
  color: #EC6A17;
752
817
  }
753
818
  }
819
+
820
+ .qbs-row-switch-container {
821
+ display: inline-flex;
822
+ align-items: center;
823
+ gap: 8px;
824
+ }
825
+
826
+ .qbs-table-view-btn {
827
+ display: inline-flex;
828
+ align-items: center;
829
+ justify-content: center;
830
+ padding: 0;
831
+ margin: 0;
832
+ border: none;
833
+ background: transparent;
834
+ cursor: pointer;
835
+ color: inherit;
836
+ }
754
837
  .qbs-card-empty-wrapper {
755
838
  display: flex;
756
839
  justify-content: center;
@@ -94,6 +94,8 @@ var ExpandCell = /*#__PURE__*/_react["default"].memo(function (_ref3) {
94
94
  onChange = _ref3.onChange,
95
95
  props = (0, _objectWithoutPropertiesLoose2["default"])(_ref3, _excluded3);
96
96
  return /*#__PURE__*/_react["default"].createElement(_Cell["default"], props, /*#__PURE__*/_react["default"].createElement("button", {
97
+ type: "button",
98
+ className: "qbs-table-expand-btn",
97
99
  onClick: function onClick() {
98
100
  onChange(rowData);
99
101
  }
@@ -109,7 +111,7 @@ var ExpandCell = /*#__PURE__*/_react["default"].memo(function (_ref3) {
109
111
  fillRule: "evenodd",
110
112
  clipRule: "evenodd",
111
113
  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",
112
- fill: "#313131"
114
+ fill: "currentColor"
113
115
  })) : /*#__PURE__*/_react["default"].createElement("svg", {
114
116
  width: "7",
115
117
  height: "10",
@@ -120,7 +122,7 @@ var ExpandCell = /*#__PURE__*/_react["default"].memo(function (_ref3) {
120
122
  fillRule: "evenodd",
121
123
  clipRule: "evenodd",
122
124
  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",
123
- fill: "#313131"
125
+ fill: "currentColor"
124
126
  }))));
125
127
  });
126
128
  exports.ExpandCell = ExpandCell;