qbs-react-grid 2.2.17 → 2.2.19

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 (79) 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/Cell.js +2 -1
  5. package/es/Pagination.d.ts +3 -0
  6. package/es/Pagination.js +8 -3
  7. package/es/Table.d.ts +3 -0
  8. package/es/Table.js +18 -12
  9. package/es/index.d.ts +1 -1
  10. package/es/index.js +1 -1
  11. package/es/less/pagination.less +9 -9
  12. package/es/qbsTable/QbsTable.js +110 -73
  13. package/es/qbsTable/TableCardList.js +2 -0
  14. package/es/qbsTable/Toolbar.js +6 -3
  15. package/es/qbsTable/commontypes.d.ts +21 -12
  16. package/es/qbsTable/labels.d.ts +6 -2
  17. package/es/qbsTable/labels.js +10 -1
  18. package/es/qbsTable/utilities/CardComponent.d.ts +2 -0
  19. package/es/qbsTable/utilities/CardComponent.js +7 -3
  20. package/es/qbsTable/utilities/CardMenuDropdown.d.ts +2 -0
  21. package/es/qbsTable/utilities/CardMenuDropdown.js +7 -7
  22. package/es/qbsTable/utilities/SearchInput.d.ts +1 -0
  23. package/es/qbsTable/utilities/SearchInput.js +3 -1
  24. package/es/qbsTable/utilities/VerticalDropDownMenu.js +36 -23
  25. package/es/qbsTable/utilities/empty.js +1 -1
  26. package/es/qbsTable/utilities/tablecalc.d.ts +1 -1
  27. package/es/qbsTable/utilities/tablecalc.js +7 -2
  28. package/es/utils/useCellDescriptor.js +0 -1
  29. package/es/utils/useScrollListener.d.ts +1 -0
  30. package/es/utils/useScrollListener.js +5 -3
  31. package/lib/Cell.js +2 -1
  32. package/lib/Pagination.d.ts +3 -0
  33. package/lib/Pagination.js +8 -3
  34. package/lib/Table.d.ts +3 -0
  35. package/lib/Table.js +18 -12
  36. package/lib/index.d.ts +1 -1
  37. package/lib/index.js +3 -1
  38. package/lib/less/pagination.less +9 -9
  39. package/lib/qbsTable/QbsTable.js +110 -73
  40. package/lib/qbsTable/TableCardList.js +2 -0
  41. package/lib/qbsTable/Toolbar.js +6 -3
  42. package/lib/qbsTable/commontypes.d.ts +21 -12
  43. package/lib/qbsTable/labels.d.ts +6 -2
  44. package/lib/qbsTable/labels.js +13 -2
  45. package/lib/qbsTable/utilities/CardComponent.d.ts +2 -0
  46. package/lib/qbsTable/utilities/CardComponent.js +7 -3
  47. package/lib/qbsTable/utilities/CardMenuDropdown.d.ts +2 -0
  48. package/lib/qbsTable/utilities/CardMenuDropdown.js +6 -5
  49. package/lib/qbsTable/utilities/SearchInput.d.ts +1 -0
  50. package/lib/qbsTable/utilities/SearchInput.js +3 -1
  51. package/lib/qbsTable/utilities/VerticalDropDownMenu.js +36 -23
  52. package/lib/qbsTable/utilities/empty.js +1 -1
  53. package/lib/qbsTable/utilities/tablecalc.d.ts +1 -1
  54. package/lib/qbsTable/utilities/tablecalc.js +7 -2
  55. package/lib/utils/useCellDescriptor.js +0 -1
  56. package/lib/utils/useScrollListener.d.ts +1 -0
  57. package/lib/utils/useScrollListener.js +5 -3
  58. package/package.json +2 -2
  59. package/src/Cell.tsx +3 -1
  60. package/src/HeaderCell.tsx +0 -1
  61. package/src/Pagination.tsx +10 -3
  62. package/src/Table.tsx +23 -10
  63. package/src/customSelect.tsx +88 -88
  64. package/src/index.ts +2 -0
  65. package/src/less/pagination.less +9 -9
  66. package/src/qbsTable/QbsTable.tsx +84 -39
  67. package/src/qbsTable/TableCardList.tsx +2 -0
  68. package/src/qbsTable/Toolbar.tsx +4 -2
  69. package/src/qbsTable/commontypes.ts +21 -12
  70. package/src/qbsTable/labels.ts +9 -2
  71. package/src/qbsTable/utilities/CardComponent.tsx +7 -2
  72. package/src/qbsTable/utilities/CardMenuDropdown.tsx +11 -6
  73. package/src/qbsTable/utilities/SearchInput.tsx +3 -1
  74. package/src/qbsTable/utilities/VerticalDropDownMenu.tsx +42 -30
  75. package/src/qbsTable/utilities/empty.tsx +2 -2
  76. package/src/qbsTable/utilities/tablecalc.ts +8 -2
  77. package/src/utils/useCellDescriptor.ts +0 -1
  78. package/src/utils/useScrollListener.ts +13 -3
  79. package/src/utils/useTableRows.ts +1 -1
@@ -40,7 +40,7 @@ export interface PaginationProps {
40
40
  export interface ActionProps {
41
41
  title?: string;
42
42
  action?: (row: any) => void;
43
- icon: React.ReactNode;
43
+ icon?: React.ReactNode;
44
44
  toolTip?: string;
45
45
  hidden?: boolean;
46
46
  hide?: (data: any, index?: number) => boolean;
@@ -70,6 +70,7 @@ export interface QbsTableProps {
70
70
  searchValue?: string;
71
71
  handleSearchValue?: (value?: string) => void;
72
72
  theme?: string;
73
+ rtl?: boolean;
73
74
  onRowClick?: (data: any) => void;
74
75
  cellBordered?: boolean;
75
76
  bordered?: boolean;
@@ -83,9 +84,8 @@ export interface QbsTableProps {
83
84
  expandedRowKeys?: readonly number[];
84
85
  setExpandedRowKeys?: (value: readonly number[]) => void;
85
86
  handleMenuActions?: (actions: ActionProps, rowData: any) => void;
86
- dropType?: 'vertical' | string;
87
+ dropType?: 'horizondal' | 'vertical' | string;
87
88
  labels?: QbsTableLabels;
88
- rtl?: boolean;
89
89
  handleRowExpanded?: (rowData: any) => React.ReactNode;
90
90
  shouldUpdateScroll?: boolean;
91
91
  rowExpand?: boolean;
@@ -99,6 +99,8 @@ export interface QbsTableProps {
99
99
  disabled?: boolean;
100
100
  hidden?: boolean;
101
101
  customHide?: string;
102
+ buttonClassName?: string;
103
+ icon?: ReactElement | ReactNode;
102
104
  }[];
103
105
  selectedRows?: (number | string)[];
104
106
  classes?: {
@@ -131,13 +133,18 @@ export interface QbsTableProps {
131
133
  handleTableCardView?: (data: any) => React.ReactNode;
132
134
  isCustomTableCardView?: boolean;
133
135
  handleCustomCardLoader?: () => React.ReactNode;
136
+ hasMoreData?: boolean;
137
+ loadMoreData?: () => void;
138
+ infiniteScroll?: boolean;
139
+ infiniteLoading?: boolean;
140
+ viewMode?: string;
134
141
  rowViewToggle?: boolean;
135
142
  defaultRowView?: boolean;
136
143
  fullWidthView?: boolean;
137
144
  setTableFullView?: (value: boolean) => void;
138
145
  setRowViewToggle?: (value: boolean) => void;
139
- isFullScreen?: boolean;
140
146
  rowHeight?: number;
147
+ isFullScreen?: boolean;
141
148
  showHeader?: boolean;
142
149
  }
143
150
  export interface QbsTableToolbarProps {
@@ -163,24 +170,26 @@ export interface QbsTableToolbarProps {
163
170
  dataLength: number;
164
171
  headerHeight?: number;
165
172
  searchPlaceholder?: string;
173
+ labels?: QbsTableLabels;
174
+ rtl?: boolean;
166
175
  tableView?: boolean;
167
176
  enableTableToggle?: boolean;
168
177
  tableViewToggle?: boolean;
169
178
  setTableViewToggle?: (value: boolean) => void;
170
- rowViewToggle?: boolean;
171
- defaultRowView?: boolean;
172
- fullWidthView?: boolean;
173
- setTableFullView?: (value: boolean) => void;
174
- setRowViewToggle?: (value: boolean) => void;
175
- isFullScreen?: boolean;
176
- labels?: QbsTableLabels;
177
- rtl?: boolean;
178
179
  selectedRowActions?: {
179
180
  actionTitle?: string;
180
181
  action: (checked: (number | string)[]) => void;
181
182
  disabled?: boolean;
182
183
  hidden?: boolean;
183
184
  customHide?: string;
185
+ buttonClassName?: string;
186
+ icon?: ReactElement | ReactNode;
184
187
  }[];
188
+ rowViewToggle?: boolean;
189
+ defaultRowView?: boolean;
190
+ fullWidthView?: boolean;
191
+ setTableFullView?: (value: boolean) => void;
192
+ setRowViewToggle?: (value: boolean) => void;
193
+ isFullScreen?: boolean;
185
194
  }
186
195
  export {};
@@ -1,4 +1,4 @@
1
- export type QbsTableLabels = {
1
+ export interface QbsTableLabels {
2
2
  search?: string;
3
3
  searchAriaLabel?: string;
4
4
  clear?: string;
@@ -19,7 +19,11 @@ export type QbsTableLabels = {
19
19
  viewMore?: string;
20
20
  viewLess?: string;
21
21
  actions?: string;
22
- };
22
+ }
23
23
  export declare const defaultQbsTableLabels: QbsTableLabels;
24
+ /** @deprecated Use defaultQbsTableLabels */
25
+ export declare const DEFAULT_QBS_TABLE_LABELS: QbsTableLabels;
24
26
  export declare const mergeQbsTableLabels: (overrides?: QbsTableLabels) => QbsTableLabels;
27
+ /** @deprecated Use mergeQbsTableLabels */
28
+ export declare const mergeLabels: (overrides?: QbsTableLabels) => QbsTableLabels;
25
29
  export declare const formatSelectedItems: (count: number, labels?: QbsTableLabels) => string;
@@ -23,9 +23,18 @@ export var defaultQbsTableLabels = {
23
23
  viewLess: 'View Less',
24
24
  actions: 'Actions'
25
25
  };
26
+
27
+ /** @deprecated Use defaultQbsTableLabels */
28
+ export var DEFAULT_QBS_TABLE_LABELS = defaultQbsTableLabels;
26
29
  export var mergeQbsTableLabels = function mergeQbsTableLabels(overrides) {
27
- return _extends({}, defaultQbsTableLabels, overrides);
30
+ var _overrides$showingRan;
31
+ return _extends({}, defaultQbsTableLabels, overrides, {
32
+ showingRange: (_overrides$showingRan = overrides === null || overrides === void 0 ? void 0 : overrides.showingRange) != null ? _overrides$showingRan : defaultQbsTableLabels.showingRange
33
+ });
28
34
  };
35
+
36
+ /** @deprecated Use mergeQbsTableLabels */
37
+ export var mergeLabels = mergeQbsTableLabels;
29
38
  export var formatSelectedItems = function formatSelectedItems(count, labels) {
30
39
  var merged = mergeQbsTableLabels(labels);
31
40
  return merged.selectedItems + " (" + count + ")";
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { QbsColumnProps } from '../commontypes';
3
+ import { type QbsTableLabels } from '../labels';
3
4
  type Props = {
4
5
  columns: QbsColumnProps[];
5
6
  data: any;
@@ -9,6 +10,7 @@ type Props = {
9
10
  handleMenuActions?: () => void;
10
11
  cardColumLimit?: number;
11
12
  childDetailHeading?: string;
13
+ labels?: QbsTableLabels;
12
14
  };
13
15
  declare const CardComponent: React.FC<Props>;
14
16
  export default CardComponent;
@@ -1,4 +1,5 @@
1
1
  import React, { useRef, useState } from 'react';
2
+ import { mergeLabels } from '../labels';
2
3
  import CardMenuDropdown from './CardMenuDropdown';
3
4
  import { handleCellFormat } from './handleFormatCell';
4
5
  import { ArrowUpIcon } from './icons';
@@ -15,7 +16,9 @@ var CardComponent = function CardComponent(_ref) {
15
16
  cardColumLimit = _ref$cardColumLimit === void 0 ? 5 : _ref$cardColumLimit,
16
17
  handleMenuActions = _ref.handleMenuActions,
17
18
  _ref$childDetailHeadi = _ref.childDetailHeading,
18
- childDetailHeading = _ref$childDetailHeadi === void 0 ? '' : _ref$childDetailHeadi;
19
+ childDetailHeading = _ref$childDetailHeadi === void 0 ? '' : _ref$childDetailHeadi,
20
+ labelsProp = _ref.labels;
21
+ var labels = mergeLabels(labelsProp);
19
22
  var _useState = useState(false),
20
23
  viewMore = _useState[0],
21
24
  setViewMore = _useState[1];
@@ -64,10 +67,11 @@ var CardComponent = function CardComponent(_ref) {
64
67
  rowData: data,
65
68
  iconName: "more",
66
69
  rowIndex: index,
67
- handleMenuActions: handleMenuActions
70
+ handleMenuActions: handleMenuActions,
71
+ labels: labels
68
72
  })), columns.length > initialDisplayCount && /*#__PURE__*/React.createElement(TooltipComponent, {
69
73
  tableBodyRef: useCardRef,
70
- title: viewMore ? ' View Less' : 'View More',
74
+ title: viewMore ? labels.viewLess : labels.viewMore,
71
75
  enabled: false
72
76
  }, /*#__PURE__*/React.createElement("button", {
73
77
  onClick: toggleViewMore,
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { ActionProps } from '../commontypes';
3
+ import { type QbsTableLabels } from '../labels';
3
4
  type Props = {
4
5
  iconName: string;
5
6
  actionDropDown: ActionProps[];
@@ -8,6 +9,7 @@ type Props = {
8
9
  dataTheme?: string;
9
10
  tableBodyRef: React.RefObject<HTMLDivElement>;
10
11
  rowIndex?: number;
12
+ labels?: QbsTableLabels;
11
13
  };
12
14
  declare const CardMenuDropdown: React.FC<Props>;
13
15
  export default CardMenuDropdown;
@@ -1,11 +1,13 @@
1
- import { useEffect, useRef, useState } from 'react';
2
- import React from 'react';
1
+ import React, { useEffect, useRef, useState } from 'react';
2
+ import { mergeLabels } from '../labels';
3
3
  import { ThreeDotIcon } from './icons';
4
4
  import TooltipComponent from './ToolTip';
5
5
  var CardMenuDropdown = function CardMenuDropdown(_ref) {
6
6
  var actionDropDown = _ref.actionDropDown,
7
7
  handleMenuActions = _ref.handleMenuActions,
8
- rowData = _ref.rowData;
8
+ rowData = _ref.rowData,
9
+ labelsProp = _ref.labels;
10
+ var labels = mergeLabels(labelsProp);
9
11
  var _useState = useState(false),
10
12
  openMenu = _useState[0],
11
13
  setOpenMenu = _useState[1];
@@ -32,7 +34,6 @@ var CardMenuDropdown = function CardMenuDropdown(_ref) {
32
34
  var dropdownHeight = 200; // Adjust this if your dropdown height varies
33
35
  var spaceBelow = window.innerHeight - buttonRect.bottom;
34
36
  var spaceAbove = buttonRect.top;
35
- console.log(spaceAbove, spaceBelow, dropdownHeight);
36
37
  if (spaceBelow < dropdownHeight && spaceAbove > spaceBelow) {
37
38
  setMenuPositionStyles({
38
39
  bottom: '30px',
@@ -65,9 +66,8 @@ var CardMenuDropdown = function CardMenuDropdown(_ref) {
65
66
  onClick: toggleMenu,
66
67
  ref: menuButtonRef
67
68
  }, /*#__PURE__*/React.createElement(TooltipComponent, {
68
- title: "Actions",
69
- enabled: false,
70
- ref: menuButtonRef
69
+ title: labels.actions,
70
+ enabled: false
71
71
  }, /*#__PURE__*/React.createElement(ThreeDotIcon, null))), openMenu && /*#__PURE__*/React.createElement("div", {
72
72
  className: " qbs-card-dropdown rounded absolute right-0 mt-2 w-auto min-w-11 z-10 shadow-modalShadow bg-white dark:bg-[#424242] dark:text-white",
73
73
  style: menuPositionStyles
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  export interface SearchProps {
3
3
  placeholder: string;
4
+ searchAriaLabel?: string;
4
5
  handleChange: (value: string) => void;
5
6
  searchValue: string | undefined;
6
7
  handleSearch: (value?: string) => void;
@@ -1,6 +1,8 @@
1
1
  import React, { memo, useCallback } from 'react';
2
2
  var SearchInput = function SearchInput(_ref) {
3
3
  var placeholder = _ref.placeholder,
4
+ _ref$searchAriaLabel = _ref.searchAriaLabel,
5
+ searchAriaLabel = _ref$searchAriaLabel === void 0 ? 'Search' : _ref$searchAriaLabel,
4
6
  handleChange = _ref.handleChange,
5
7
  searchValue = _ref.searchValue,
6
8
  handleSearch = _ref.handleSearch;
@@ -24,7 +26,7 @@ var SearchInput = function SearchInput(_ref) {
24
26
  placeholder: placeholder,
25
27
  value: searchValue != null ? searchValue : '',
26
28
  onChange: handleInputChange,
27
- "aria-label": "Search"
29
+ "aria-label": searchAriaLabel
28
30
  }), /*#__PURE__*/React.createElement("button", {
29
31
  className: "search-button absolute left-1 bottom-1.5 bg-white text-grey-dark",
30
32
  onClick: function onClick() {
@@ -6,8 +6,12 @@ import ReactDOM from 'react-dom';
6
6
  import { ThreeDotIcon } from './icons';
7
7
  import TooltipComponent from './ToolTip';
8
8
  import { closeOtherVerticalMenus, VERTICAL_MENU_CLOSE_OTHERS } from './verticalMenuCoordinator';
9
+ var isActionVisible = function isActionVisible(item, rowData, rowIndex) {
10
+ var _item$hide, _item$hide2;
11
+ return !item.hidden && !((_item$hide = (_item$hide2 = item.hide) === null || _item$hide2 === void 0 ? void 0 : _item$hide2.call(item, rowData, rowIndex)) != null ? _item$hide : false);
12
+ };
9
13
  var VerticalMenuDropdown = function VerticalMenuDropdown(_ref) {
10
- var _actionDropDown$filte2, _document$getElementB;
14
+ var _actionDropDown$filte2;
11
15
  var actionDropDown = _ref.actionDropDown,
12
16
  handleMenuActions = _ref.handleMenuActions,
13
17
  rowData = _ref.rowData,
@@ -44,11 +48,10 @@ var VerticalMenuDropdown = function VerticalMenuDropdown(_ref) {
44
48
  var viewportPadding = 8;
45
49
  var menuGap = 4;
46
50
  var visibleItems = (_actionDropDown$filte = actionDropDown === null || actionDropDown === void 0 ? void 0 : actionDropDown.filter(function (item) {
47
- var _item$hide$call, _item$hide;
48
- return !item.hidden && !((_item$hide$call = (_item$hide = item.hide) === null || _item$hide === void 0 ? void 0 : _item$hide.call(item, rowData, rowIndex)) != null ? _item$hide$call : false);
51
+ return isActionVisible(item, rowData, rowIndex);
49
52
  })) != null ? _actionDropDown$filte : [];
50
53
  var menuWidth = menuRef.current && menuRef.current.offsetWidth > 0 ? menuRef.current.offsetWidth : Math.max(120, visibleItems.length * 48);
51
- var menuHeight = visibleItems.length * 40;
54
+ var menuHeight = Math.max(visibleItems.length, 1) * 40;
52
55
  var spaceBelow = window.innerHeight - rect.bottom;
53
56
  var openBelow = spaceBelow >= menuHeight + menuGap;
54
57
  var isRtl = (document.documentElement.getAttribute('dir') || document.body.getAttribute('dir') || getComputedStyle(document.documentElement).direction) === 'rtl';
@@ -80,10 +83,10 @@ var VerticalMenuDropdown = function VerticalMenuDropdown(_ref) {
80
83
  cancelAnimationFrame(frame);
81
84
  resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
82
85
  };
83
- }, [openMenu]);
86
+ }, [openMenu, actionDropDown, rowData, rowIndex]);
84
87
  useEffect(function () {
85
88
  if (!openMenu) return;
86
- var handleClickOutside = function handleClickOutside(event) {
89
+ var handlePointerDown = function handlePointerDown(event) {
87
90
  var _menuRef$current, _menuButtonRef$curren;
88
91
  var target = event.target;
89
92
  if ((_menuRef$current = menuRef.current) !== null && _menuRef$current !== void 0 && _menuRef$current.contains(target) || (_menuButtonRef$curren = menuButtonRef.current) !== null && _menuButtonRef$curren !== void 0 && _menuButtonRef$curren.contains(target)) {
@@ -94,14 +97,20 @@ var VerticalMenuDropdown = function VerticalMenuDropdown(_ref) {
94
97
  var handleScroll = function handleScroll() {
95
98
  return setOpenMenu(false);
96
99
  };
97
- document.addEventListener('click', handleClickOutside);
100
+
101
+ // Defer so the opening click does not immediately close the menu.
102
+ var timeoutId = window.setTimeout(function () {
103
+ document.addEventListener('mousedown', handlePointerDown);
104
+ }, 0);
98
105
  window.addEventListener('scroll', handleScroll, true);
99
106
  return function () {
100
- document.removeEventListener('click', handleClickOutside);
107
+ window.clearTimeout(timeoutId);
108
+ document.removeEventListener('mousedown', handlePointerDown);
101
109
  window.removeEventListener('scroll', handleScroll, true);
102
110
  };
103
111
  }, [openMenu]);
104
112
  useEffect(function () {
113
+ if (!openMenu) return;
105
114
  var scrollbarHandle = document.querySelector('.rs-table-scrollbar-handle');
106
115
  if (!scrollbarHandle) return;
107
116
  var observer = new MutationObserver(function (mutations) {
@@ -127,10 +136,21 @@ var VerticalMenuDropdown = function VerticalMenuDropdown(_ref) {
127
136
  setOpenMenu(false);
128
137
  };
129
138
  var visibleCount = (_actionDropDown$filte2 = actionDropDown === null || actionDropDown === void 0 ? void 0 : actionDropDown.filter(function (item) {
130
- var _item$hide$call2, _item$hide2;
131
- return !item.hidden && !((_item$hide$call2 = (_item$hide2 = item.hide) === null || _item$hide2 === void 0 ? void 0 : _item$hide2.call(item, rowData, rowIndex)) != null ? _item$hide$call2 : false);
139
+ return isActionVisible(item, rowData, rowIndex);
132
140
  }).length) != null ? _actionDropDown$filte2 : 0;
133
- var portalTarget = (_document$getElementB = document.getElementById('portal-root')) != null ? _document$getElementB : document.body;
141
+ var portalTarget = document.getElementById('portal-root');
142
+ var toggleMenu = function toggleMenu() {
143
+ if (openMenu) {
144
+ setOpenMenu(false);
145
+ return;
146
+ }
147
+ closeOtherVerticalMenus(menuId);
148
+ updateMenuPosition();
149
+ // Delay open so table/document click handlers do not close it immediately.
150
+ window.setTimeout(function () {
151
+ setOpenMenu(true);
152
+ }, 0);
153
+ };
134
154
  var dropdownContent = /*#__PURE__*/React.createElement("div", {
135
155
  className: "absolute z-[60] min-w-48 rounded-md vertical-menu-dropdown-content",
136
156
  ref: menuRef,
@@ -144,14 +164,12 @@ var VerticalMenuDropdown = function VerticalMenuDropdown(_ref) {
144
164
  }, /*#__PURE__*/React.createElement("div", {
145
165
  className: "py-1"
146
166
  }, actionDropDown === null || actionDropDown === void 0 ? void 0 : actionDropDown.map(function (item) {
147
- var _item$hide$call3, _item$hide3;
148
- return !item.hidden && !((_item$hide$call3 = (_item$hide3 = item.hide) === null || _item$hide3 === void 0 ? void 0 : _item$hide3.call(item, rowData, rowIndex)) != null ? _item$hide$call3 : false) ? /*#__PURE__*/React.createElement("div", {
167
+ return isActionVisible(item, rowData, rowIndex) ? /*#__PURE__*/React.createElement("div", {
149
168
  key: item.title,
150
169
  className: "vertical-menu-item px-4 py-2 text-sm text-base-black hover:bg-gray-light-1 cursor-pointer flex items-center gap-2 transition-colors",
151
170
  onClick: function onClick(e) {
152
- var _item$action;
153
171
  e.preventDefault();
154
- (_item$action = item.action) === null || _item$action === void 0 ? void 0 : _item$action.call(item, item);
172
+ e.stopPropagation();
155
173
  handleMenuItemClick(item);
156
174
  }
157
175
  }, /*#__PURE__*/React.createElement(TooltipComponent, {
@@ -169,16 +187,11 @@ var VerticalMenuDropdown = function VerticalMenuDropdown(_ref) {
169
187
  className: "inline-block vertical-menu-dropdown-wrapper"
170
188
  }, visibleCount > 0 && /*#__PURE__*/React.createElement("button", {
171
189
  type: "button",
172
- className: "vertical-menu-trigger-button",
190
+ 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",
173
191
  onClick: function onClick(event) {
174
192
  event.stopPropagation();
175
- if (openMenu) {
176
- setOpenMenu(false);
177
- return;
178
- }
179
- closeOtherVerticalMenus(menuId);
180
- updateMenuPosition();
181
- setOpenMenu(true);
193
+ event.preventDefault();
194
+ toggleMenu();
182
195
  },
183
196
  ref: menuButtonRef
184
197
  }, /*#__PURE__*/React.createElement(ThreeDotIcon, null))), openMenu && portalTarget && /*#__PURE__*/ReactDOM.createPortal(dropdownContent, portalTarget));
@@ -70,7 +70,7 @@ var NoData = function NoData(_ref) {
70
70
  }), /*#__PURE__*/React.createElement("path", {
71
71
  fill: "#797979",
72
72
  d: "M47.365 57.417a.926.926 0 00.926-.927v-1.777a.926.926 0 10-1.852 0v1.777c0 .512.415.927.926.927zM104.183 57.417a.926.926 0 00.926-.927v-1.777a.926.926 0 00-1.852 0v1.777c0 .512.414.927.926.927zM47.365 52.974a.926.926 0 00.926-.927V50.27a.926.926 0 00-1.852 0v1.777c0 .512.415.927.926.927zM104.183 52.974a.926.926 0 00.926-.927V50.27a.926.926 0 00-1.852 0v1.777c0 .512.414.927.926.927zM47.365 44.088a.926.926 0 00.926-.927v-1.777a.926.926 0 10-1.852 0v1.777c0 .512.415.927.926.927zM104.183 44.088a.926.926 0 00.926-.927v-1.777a.926.926 0 00-1.852 0v1.777c0 .512.414.927.926.927zM47.365 39.645a.926.926 0 00.926-.927v-1.777a.926.926 0 10-1.852 0v1.777c0 .512.415.927.926.927zM104.183 39.645a.926.926 0 00.926-.927v-1.777a.926.926 0 00-1.852 0v1.777c0 .512.414.927.926.927zM47.365 35.202a.926.926 0 00.926-.927v-1.777a.926.926 0 10-1.852 0v1.777c0 .512.415.927.926.927zM104.183 35.202a.926.926 0 00.926-.927v-1.777a.926.926 0 00-1.852 0v1.777c0 .512.414.927.926.927zM47.365 30.758a.926.926 0 00.926-.926v-.888c0-.248.02-.49.057-.726a.926.926 0 00-1.83-.288c-.052.33-.08.67-.08 1.014v.888c0 .512.416.926.927.926zM104.183 30.758a.926.926 0 00.926-.926v-.888c0-.345-.027-.683-.079-1.014a.926.926 0 10-1.83.288c.037.236.057.478.057.726v.888c0 .512.414.926.926.926zM47.881 26.426a.926.926 0 001.294-.204c.286-.394.633-.74 1.026-1.026a.926.926 0 00-1.09-1.498c-.55.4-1.034.884-1.434 1.434a.926.926 0 00.204 1.294zM103.667 26.426a.926.926 0 00.204-1.294 6.509 6.509 0 00-1.434-1.434.926.926 0 00-1.09 1.498c.393.286.74.632 1.026 1.026a.926.926 0 001.294.204zM51.138 23.597c.08.506.554.851 1.059.772a4.67 4.67 0 01.726-.057h.914a.926.926 0 000-1.852h-.914c-.344 0-.683.026-1.014.078a.926.926 0 00-.77 1.06zM100.41 23.597a.927.927 0 00-.771-1.059 6.522 6.522 0 00-1.014-.078h-.914a.926.926 0 100 1.852h.914c.248 0 .49.02.726.057a.926.926 0 001.059-.772zM55.653 23.386c0 .511.415.926.926.926h1.828a.926.926 0 000-1.852H56.58a.926.926 0 00-.926.926zM60.223 23.386c0 .511.415.926.926.926h1.828a.926.926 0 000-1.852H61.15a.926.926 0 00-.926.926zM64.793 23.386c0 .511.415.926.926.926h1.829a.926.926 0 000-1.852h-1.829a.926.926 0 00-.926.926zM69.364 23.386c0 .511.414.926.926.926h1.828a.926.926 0 000-1.852H70.29a.926.926 0 00-.927.926zM73.934 23.386c0 .511.414.926.926.926h1.828a.926.926 0 000-1.852H74.86a.926.926 0 00-.926.926zM78.504 23.386c0 .511.415.926.926.926h1.828a.926.926 0 000-1.852H79.43a.926.926 0 00-.926.926zM83.074 23.386c0 .511.415.926.927.926h1.828a.926.926 0 000-1.852H84a.926.926 0 00-.927.926zM87.644 23.386c0 .511.415.926.927.926h1.828a.926.926 0 000-1.852H88.57a.926.926 0 00-.927.926zM92.215 23.386c0 .511.414.926.926.926h1.828a.926.926 0 000-1.852h-1.828a.926.926 0 00-.926.926zM72.178 36.453a1.39 1.39 0 10-1.965 1.965l3.797 3.797-3.797 3.798a1.39 1.39 0 001.965 1.965l3.797-3.798 3.798 3.798a1.39 1.39 0 001.965-1.965l-3.798-3.798 3.798-3.797a1.39 1.39 0 10-1.965-1.965l-3.798 3.797-3.797-3.797z"
73
- })), " ", ' '), /*#__PURE__*/React.createElement("p", {
73
+ })), ' '), /*#__PURE__*/React.createElement("p", {
74
74
  className: "text-center text-common font-bold text-blackAlt nodata-title"
75
75
  }, title), /*#__PURE__*/React.createElement("span", {
76
76
  className: "text-xxs font-medium text-grey-medium nodata-sub-title"
@@ -1 +1 @@
1
- export declare function getRowDisplayRange(totalRows: number, rowsPerPage: number, pageNumber: number): string;
1
+ export declare function getRowDisplayRange(totalRows: number, rowsPerPage: number, pageNumber: number, formatRange?: (start: number, end: number, total: number) => string): string;
@@ -1,5 +1,10 @@
1
- export function getRowDisplayRange(totalRows, rowsPerPage, pageNumber) {
1
+ export function getRowDisplayRange(totalRows, rowsPerPage, pageNumber, formatRange) {
2
+ if (formatRange === void 0) {
3
+ formatRange = function formatRange(start, end, total) {
4
+ return "Showing " + start + " to " + end + " of " + total;
5
+ };
6
+ }
2
7
  var start = (pageNumber - 1) * rowsPerPage + 1;
3
8
  var end = Math.min(pageNumber * rowsPerPage, totalRows);
4
- return "Showing " + (start != null ? start : 0) + " to " + (end != null ? end : 0) + " of " + (totalRows != null ? totalRows : 0);
9
+ return formatRange(start != null ? start : 0, end != null ? end : 0, totalRows != null ? totalRows : 0);
5
10
  }
@@ -151,7 +151,6 @@ var useCellDescriptor = function useCellDescriptor(props) {
151
151
  if (treeCol) {
152
152
  hasCustomTreeCol = true;
153
153
  }
154
- console.log(columns);
155
154
  if ((columnChildren === null || columnChildren === void 0 ? void 0 : columnChildren.length) !== 2) {
156
155
  throw new Error("Component <HeaderCell> and <Cell> is required, column index: " + index + " ");
157
156
  }
@@ -31,6 +31,7 @@ interface ScrollListenerProps {
31
31
  onTouchStart?: (event: React.TouchEvent) => void;
32
32
  onTouchMove?: (event: React.TouchEvent) => void;
33
33
  onTouchEnd?: (event: React.TouchEvent) => void;
34
+ handleInfiniteScroll?: (value: number) => void;
34
35
  }
35
36
  /**
36
37
  * Add scroll, touch, and wheel monitoring events to the table,
@@ -68,7 +68,8 @@ var useScrollListener = function useScrollListener(props) {
68
68
  contentHeight = props.contentHeight,
69
69
  headerHeight = props.headerHeight,
70
70
  rtl = props.rtl,
71
- tableKey = props.tableKey;
71
+ tableKey = props.tableKey,
72
+ handleInfiniteScroll = props.handleInfiniteScroll;
72
73
  var wheelListener = useRef(null);
73
74
  var touchStartListener = useRef(null);
74
75
  var touchMoveListener = useRef(null);
@@ -130,6 +131,9 @@ var useScrollListener = function useScrollListener(props) {
130
131
  var x = Math.min(0, nextScrollX < minScrollX.current ? minScrollX.current : nextScrollX);
131
132
  setScrollX(x);
132
133
  setScrollY(y);
134
+ if (typeof handleInfiniteScroll === 'function' && deltaY !== 0 && !loading && Math.abs(y) + getTableHeight() >= contentHeight.current - 12) {
135
+ handleInfiniteScroll(scrollY.current);
136
+ }
133
137
  onScroll === null || onScroll === void 0 ? void 0 : onScroll(Math.abs(x), Math.abs(y));
134
138
  if (virtualized) {
135
139
  // Add a state to the table during virtualized scrolling.
@@ -207,7 +211,6 @@ var useScrollListener = function useScrollListener(props) {
207
211
  if (!isTouching.current) {
208
212
  return;
209
213
  }
210
- console.log('handleTouchMove');
211
214
  var _event$touches$2 = event.touches[0],
212
215
  pageX = _event$touches$2.pageX,
213
216
  pageY = _event$touches$2.pageY;
@@ -241,7 +244,6 @@ var useScrollListener = function useScrollListener(props) {
241
244
  if (!isTouching.current) {
242
245
  return;
243
246
  }
244
- console.log('handleTouchEnd');
245
247
  isTouching.current = false;
246
248
  var touchDuration = new Date().getTime() - momentumStartTime.current;
247
249
  var absDeltaY = Math.abs(scrollY.current - momentumStartY.current);
package/lib/Cell.js CHANGED
@@ -86,10 +86,11 @@ var Cell = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
86
86
  var nextHeight = isHeaderCell ? headerHeight : cellHeight;
87
87
  var styles = (0, _extends4["default"])({}, predefinedStyle, (_extends2 = {}, _extends2[fullText ? 'minWidth' : 'width'] = width, _extends2.height = nextHeight, _extends2.zIndex = depth, _extends2[rtl ? 'right' : 'left'] = left, _extends2));
88
88
  var paddingKey = rtl ? 'paddingRight' : 'paddingLeft';
89
+ var resolvedAlign = rtl && align === 'left' ? 'right' : rtl && align === 'right' ? 'left' : align;
89
90
  var contentStyles = (0, _extends4["default"])({}, style, (_extends3 = {
90
91
  width: fullText ? width - 1 : width,
91
92
  height: nextHeight,
92
- textAlign: align
93
+ textAlign: resolvedAlign
93
94
  }, _extends3[paddingKey] = isTreeCol ? depth * _constants.LAYER_WIDTH + 10 : (style === null || style === void 0 ? void 0 : style[paddingKey]) || (style === null || style === void 0 ? void 0 : style.padding), _extends3));
94
95
  if (verticalAlign) {
95
96
  contentStyles.display = 'table-cell';
@@ -1,4 +1,5 @@
1
1
  import { FC } from 'react';
2
+ import { type QbsTableLabels } from './qbsTable/labels';
2
3
  type PageProps = {
3
4
  paginationProps: {
4
5
  total?: number;
@@ -9,6 +10,8 @@ type PageProps = {
9
10
  onRowsPerPage?: (row: number, page: number) => void;
10
11
  onPagination?: (row: number, page: number) => void;
11
12
  };
13
+ labels?: QbsTableLabels;
14
+ dataTheme?: string;
12
15
  };
13
16
  declare const Pagination: FC<PageProps>;
14
17
  export default Pagination;
package/lib/Pagination.js CHANGED
@@ -5,6 +5,7 @@ exports.__esModule = true;
5
5
  exports["default"] = void 0;
6
6
  var _react = _interopRequireWildcard(require("react"));
7
7
  var _customSelect = _interopRequireDefault(require("./customSelect"));
8
+ var _labels = require("./qbsTable/labels");
8
9
  var _tablecalc = require("./qbsTable/utilities/tablecalc");
9
10
  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); }
10
11
  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; }
@@ -41,7 +42,10 @@ var PageIndex = function PageIndex(_ref) {
41
42
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, renderPageNumbers());
42
43
  };
43
44
  var Pagination = function Pagination(_ref2) {
44
- var paginationProps = _ref2.paginationProps;
45
+ var paginationProps = _ref2.paginationProps,
46
+ labelsProp = _ref2.labels,
47
+ dataTheme = _ref2.dataTheme;
48
+ var labels = (0, _labels.mergeLabels)(labelsProp);
45
49
  var _paginationProps$drop = paginationProps.dropOptions,
46
50
  dropOptions = _paginationProps$drop === void 0 ? [10, 20, 50, 100, 200] : _paginationProps$drop,
47
51
  _paginationProps$curr = paginationProps.currentPage,
@@ -82,13 +86,14 @@ var Pagination = function Pagination(_ref2) {
82
86
  };
83
87
  return /*#__PURE__*/_react["default"].createElement("div", {
84
88
  className: "qbs-table-custom-pagination",
89
+ "data-theme": dataTheme,
85
90
  style: {
86
91
  display: 'flex',
87
92
  justifyContent: 'space-between'
88
93
  }
89
94
  }, /*#__PURE__*/_react["default"].createElement("div", {
90
95
  className: "rows-count"
91
- }, (0, _tablecalc.getRowDisplayRange)(total, rowsPerPageState, currentPage)), /*#__PURE__*/_react["default"].createElement("div", {
96
+ }, (0, _tablecalc.getRowDisplayRange)(total, rowsPerPageState, currentPage, labels.showingRange)), /*#__PURE__*/_react["default"].createElement("div", {
92
97
  className: "qbs-table-pagination-right-block"
93
98
  }, /*#__PURE__*/_react["default"].createElement("button", {
94
99
  className: "qbs-table-icon-container",
@@ -167,7 +172,7 @@ var Pagination = function Pagination(_ref2) {
167
172
  className: "qbs-table-pagination-flexBox"
168
173
  }, /*#__PURE__*/_react["default"].createElement("span", {
169
174
  className: "qbs-table-pagination-text"
170
- }, "Items per page"), /*#__PURE__*/_react["default"].createElement(_customSelect["default"], {
175
+ }, labels.itemsPerPage), /*#__PURE__*/_react["default"].createElement(_customSelect["default"], {
171
176
  options: dropData,
172
177
  selectedValue: rowsPerPageState,
173
178
  onChange: handleRowsPerPage
package/lib/Table.d.ts CHANGED
@@ -99,6 +99,7 @@ export interface TableProps<Row, Key> extends Omit<StandardProps, 'onScroll'> {
99
99
  /** Tree table, the callback function in the expanded node */
100
100
  renderTreeToggle?: (expandButton: React.ReactNode, rowData?: Row, expanded?: boolean) => React.ReactNode;
101
101
  tableKey?: string;
102
+ infiniteLoading?: boolean;
102
103
  /** Customize what you can do to expand a zone */
103
104
  renderRowExpanded?: (rowData?: Row) => React.ReactNode;
104
105
  /** Custom row element */
@@ -123,6 +124,7 @@ export interface TableProps<Row, Key> extends Omit<StandardProps, 'onScroll'> {
123
124
  onTouchMove?: (event: React.TouchEvent) => void;
124
125
  /** Callback for the `touchend` event. */
125
126
  onTouchEnd?: (event: React.TouchEvent) => void;
127
+ handleInfiniteScroll?: (value: number) => void;
126
128
  /**
127
129
  * Callback after table data update.
128
130
  * @deprecated use `shouldUpdateScroll` instead
@@ -132,6 +134,7 @@ export interface TableProps<Row, Key> extends Omit<StandardProps, 'onScroll'> {
132
134
  y: number;
133
135
  }) => void) => void;
134
136
  tableBodyRef: React.RefObject<HTMLDivElement>;
137
+ wheelWrapperRef: React.RefObject<HTMLDivElement | null>;
135
138
  bodyRef?: (ref: HTMLElement) => void;
136
139
  }
137
140
  export interface TableInstance<Row, Key> extends React.FunctionComponent<TableProps<Row, Key>> {