qbs-react-grid 2.2.3 → 2.2.5

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 (100) 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 +1 -2
  5. package/es/Pagination.d.ts +0 -3
  6. package/es/Pagination.js +3 -8
  7. package/es/Table.d.ts +0 -3
  8. package/es/Table.js +12 -18
  9. package/es/index.d.ts +1 -1
  10. package/es/less/pagination.less +9 -9
  11. package/es/less/qbs-table.less +73 -205
  12. package/es/qbsTable/CustomTableCell.js +2 -13
  13. package/es/qbsTable/QbsTable.js +46 -124
  14. package/es/qbsTable/TableCardList.js +39 -52
  15. package/es/qbsTable/Toolbar.js +13 -62
  16. package/es/qbsTable/commontypes.d.ts +2 -30
  17. package/es/qbsTable/utilities/CardComponent.d.ts +0 -2
  18. package/es/qbsTable/utilities/CardComponent.js +3 -7
  19. package/es/qbsTable/utilities/CardMenuDropdown.d.ts +0 -2
  20. package/es/qbsTable/utilities/CardMenuDropdown.js +7 -7
  21. package/es/qbsTable/utilities/ColumShowHide.d.ts +0 -4
  22. package/es/qbsTable/utilities/ColumShowHide.js +6 -9
  23. package/es/qbsTable/utilities/SearchInput.d.ts +0 -1
  24. package/es/qbsTable/utilities/SearchInput.js +1 -3
  25. package/es/qbsTable/utilities/ToolTip.d.ts +1 -8
  26. package/es/qbsTable/utilities/ToolTip.js +31 -107
  27. package/es/qbsTable/utilities/empty.js +1 -1
  28. package/es/qbsTable/utilities/icons.d.ts +0 -3
  29. package/es/qbsTable/utilities/icons.js +1 -65
  30. package/es/qbsTable/utilities/tablecalc.d.ts +1 -1
  31. package/es/qbsTable/utilities/tablecalc.js +2 -7
  32. package/es/utils/useCellDescriptor.js +1 -0
  33. package/es/utils/useScrollListener.d.ts +0 -1
  34. package/es/utils/useScrollListener.js +3 -5
  35. package/lib/Cell.js +1 -2
  36. package/lib/Pagination.d.ts +0 -3
  37. package/lib/Pagination.js +3 -8
  38. package/lib/Table.d.ts +0 -3
  39. package/lib/Table.js +12 -18
  40. package/lib/index.d.ts +1 -1
  41. package/lib/less/pagination.less +9 -9
  42. package/lib/less/qbs-table.less +73 -205
  43. package/lib/qbsTable/CustomTableCell.js +2 -13
  44. package/lib/qbsTable/QbsTable.js +46 -124
  45. package/lib/qbsTable/TableCardList.js +39 -52
  46. package/lib/qbsTable/Toolbar.js +12 -61
  47. package/lib/qbsTable/commontypes.d.ts +2 -30
  48. package/lib/qbsTable/utilities/CardComponent.d.ts +0 -2
  49. package/lib/qbsTable/utilities/CardComponent.js +3 -7
  50. package/lib/qbsTable/utilities/CardMenuDropdown.d.ts +0 -2
  51. package/lib/qbsTable/utilities/CardMenuDropdown.js +5 -6
  52. package/lib/qbsTable/utilities/ColumShowHide.d.ts +0 -4
  53. package/lib/qbsTable/utilities/ColumShowHide.js +6 -9
  54. package/lib/qbsTable/utilities/SearchInput.d.ts +0 -1
  55. package/lib/qbsTable/utilities/SearchInput.js +1 -3
  56. package/lib/qbsTable/utilities/ToolTip.d.ts +1 -8
  57. package/lib/qbsTable/utilities/ToolTip.js +30 -107
  58. package/lib/qbsTable/utilities/empty.js +1 -1
  59. package/lib/qbsTable/utilities/icons.d.ts +0 -3
  60. package/lib/qbsTable/utilities/icons.js +3 -70
  61. package/lib/qbsTable/utilities/tablecalc.d.ts +1 -1
  62. package/lib/qbsTable/utilities/tablecalc.js +2 -7
  63. package/lib/utils/useCellDescriptor.js +1 -0
  64. package/lib/utils/useScrollListener.d.ts +0 -1
  65. package/lib/utils/useScrollListener.js +3 -5
  66. package/package.json +2 -2
  67. package/src/Cell.tsx +1 -3
  68. package/src/HeaderCell.tsx +1 -0
  69. package/src/Pagination.tsx +3 -10
  70. package/src/Table.tsx +10 -23
  71. package/src/customSelect.tsx +88 -88
  72. package/src/index.ts +1 -1
  73. package/src/less/pagination.less +9 -9
  74. package/src/less/qbs-table.less +73 -205
  75. package/src/qbsTable/CustomTableCell.tsx +9 -31
  76. package/src/qbsTable/QbsTable.tsx +25 -101
  77. package/src/qbsTable/TableCardList.tsx +19 -35
  78. package/src/qbsTable/Toolbar.tsx +11 -53
  79. package/src/qbsTable/commontypes.ts +1 -32
  80. package/src/qbsTable/utilities/CardComponent.tsx +2 -7
  81. package/src/qbsTable/utilities/CardMenuDropdown.tsx +6 -11
  82. package/src/qbsTable/utilities/ColumShowHide.tsx +6 -33
  83. package/src/qbsTable/utilities/SearchInput.tsx +1 -3
  84. package/src/qbsTable/utilities/ToolTip.tsx +27 -138
  85. package/src/qbsTable/utilities/empty.tsx +2 -2
  86. package/src/qbsTable/utilities/icons.tsx +1 -78
  87. package/src/qbsTable/utilities/tablecalc.ts +2 -8
  88. package/src/utils/useCellDescriptor.ts +1 -0
  89. package/src/utils/useScrollListener.ts +3 -13
  90. package/src/utils/useTableRows.ts +1 -1
  91. package/es/qbsTable/labels.d.ts +0 -48
  92. package/es/qbsTable/labels.js +0 -34
  93. package/es/qbsTable/utilities/VerticalDropDownMenu.d.ts +0 -13
  94. package/es/qbsTable/utilities/VerticalDropDownMenu.js +0 -166
  95. package/lib/qbsTable/labels.d.ts +0 -48
  96. package/lib/qbsTable/labels.js +0 -42
  97. package/lib/qbsTable/utilities/VerticalDropDownMenu.d.ts +0 -13
  98. package/lib/qbsTable/utilities/VerticalDropDownMenu.js +0 -174
  99. package/src/qbsTable/labels.ts +0 -58
  100. package/src/qbsTable/utilities/VerticalDropDownMenu.tsx +0 -187
@@ -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.ExpandIcon = exports.DefaultView = exports.ContentView = exports.CardView = exports.CardIcon = exports.ArrowUpIcon = void 0;
5
+ exports.ThreeDotIcon = exports.TableView = exports.TableIcon = exports.SettingsIcon = 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: "currentColor",
16
+ stroke: "#313131",
17
17
  strokeWidth: "1.5",
18
18
  strokeLinecap: "round",
19
19
  strokeLinejoin: "round"
@@ -137,71 +137,4 @@ var TableView = function TableView(_ref5) {
137
137
  strokeWidth: "1.5"
138
138
  }));
139
139
  };
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: "#585858",
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: "#585858",
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: "#585858",
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: "#585858"
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: "#585858"
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: "#585858"
205
- }));
206
- };
207
- exports.DefaultView = DefaultView;
140
+ exports.TableView = TableView;
@@ -1 +1 @@
1
- export declare function getRowDisplayRange(totalRows: number, rowsPerPage: number, pageNumber: number, formatRange?: (start: number, end: number, total: number) => string): string;
1
+ export declare function getRowDisplayRange(totalRows: number, rowsPerPage: number, pageNumber: number): string;
@@ -2,13 +2,8 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.getRowDisplayRange = getRowDisplayRange;
5
- function getRowDisplayRange(totalRows, rowsPerPage, pageNumber, formatRange) {
6
- if (formatRange === void 0) {
7
- formatRange = function formatRange(start, end, total) {
8
- return "Showing " + start + " to " + end + " of " + total;
9
- };
10
- }
5
+ function getRowDisplayRange(totalRows, rowsPerPage, pageNumber) {
11
6
  var start = (pageNumber - 1) * rowsPerPage + 1;
12
7
  var end = Math.min(pageNumber * rowsPerPage, totalRows);
13
- return formatRange(start != null ? start : 0, end != null ? end : 0, totalRows != null ? totalRows : 0);
8
+ return "Showing " + (start != null ? start : 0) + " to " + (end != null ? end : 0) + " of " + (totalRows != null ? totalRows : 0);
14
9
  }
@@ -158,6 +158,7 @@ var useCellDescriptor = function useCellDescriptor(props) {
158
158
  if (treeCol) {
159
159
  hasCustomTreeCol = true;
160
160
  }
161
+ console.log(columns);
161
162
  if ((columnChildren === null || columnChildren === void 0 ? void 0 : columnChildren.length) !== 2) {
162
163
  throw new Error("Component <HeaderCell> and <Cell> is required, column index: " + index + " ");
163
164
  }
@@ -31,7 +31,6 @@ 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;
35
34
  }
36
35
  /**
37
36
  * Add scroll, touch, and wheel monitoring events to the table,
@@ -72,8 +72,7 @@ var useScrollListener = function useScrollListener(props) {
72
72
  contentHeight = props.contentHeight,
73
73
  headerHeight = props.headerHeight,
74
74
  rtl = props.rtl,
75
- tableKey = props.tableKey,
76
- handleInfiniteScroll = props.handleInfiniteScroll;
75
+ tableKey = props.tableKey;
77
76
  var wheelListener = (0, _react.useRef)(null);
78
77
  var touchStartListener = (0, _react.useRef)(null);
79
78
  var touchMoveListener = (0, _react.useRef)(null);
@@ -135,9 +134,6 @@ var useScrollListener = function useScrollListener(props) {
135
134
  var x = Math.min(0, nextScrollX < minScrollX.current ? minScrollX.current : nextScrollX);
136
135
  setScrollX(x);
137
136
  setScrollY(y);
138
- if (typeof handleInfiniteScroll === 'function' && deltaY !== 0 && !loading && Math.abs(y) + getTableHeight() >= contentHeight.current - 12) {
139
- handleInfiniteScroll(scrollY.current);
140
- }
141
137
  onScroll === null || onScroll === void 0 ? void 0 : onScroll(Math.abs(x), Math.abs(y));
142
138
  if (virtualized) {
143
139
  // Add a state to the table during virtualized scrolling.
@@ -215,6 +211,7 @@ var useScrollListener = function useScrollListener(props) {
215
211
  if (!isTouching.current) {
216
212
  return;
217
213
  }
214
+ console.log('handleTouchMove');
218
215
  var _event$touches$2 = event.touches[0],
219
216
  pageX = _event$touches$2.pageX,
220
217
  pageY = _event$touches$2.pageY;
@@ -248,6 +245,7 @@ var useScrollListener = function useScrollListener(props) {
248
245
  if (!isTouching.current) {
249
246
  return;
250
247
  }
248
+ console.log('handleTouchEnd');
251
249
  isTouching.current = false;
252
250
  var touchDuration = new Date().getTime() - momentumStartTime.current;
253
251
  var absDeltaY = Math.abs(scrollY.current - momentumStartY.current);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qbs-react-grid",
3
- "version": "2.2.3",
3
+ "version": "2.2.5",
4
4
  "description": "A React table component",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -72,7 +72,7 @@
72
72
  "@commitlint/cli": "^13.1.0",
73
73
  "@commitlint/config-conventional": "^13.1.0",
74
74
  "@faker-js/faker": "^7.6.0",
75
- "@testing-library/react": "^16.2.0",
75
+ "@testing-library/react": "^13.4.0",
76
76
  "@types/lodash": "^4.14.165",
77
77
  "@types/prop-types": "^15.7.1",
78
78
  "@types/react": "^19.0.11",
package/src/Cell.tsx CHANGED
@@ -144,13 +144,11 @@ const Cell = React.forwardRef((props: InnerCellProps, ref: React.Ref<HTMLDivElem
144
144
  };
145
145
 
146
146
  const paddingKey = rtl ? 'paddingRight' : 'paddingLeft';
147
- const resolvedAlign =
148
- rtl && align === 'left' ? 'right' : rtl && align === 'right' ? 'left' : align;
149
147
  const contentStyles: React.CSSProperties = {
150
148
  ...style,
151
149
  width: fullText ? width - 1 : width,
152
150
  height: nextHeight,
153
- textAlign: resolvedAlign,
151
+ textAlign: align,
154
152
  [paddingKey]: isTreeCol ? depth * LAYER_WIDTH + 10 : style?.[paddingKey] || style?.padding
155
153
  };
156
154
 
@@ -97,6 +97,7 @@ const HeaderCell = React.forwardRef((props: HeaderCellProps, ref: React.Ref<HTML
97
97
  onSortColumn?.(sortKey ?? dataKey);
98
98
  }
99
99
  }, [dataKey, onSortColumn, sortable, sortKey]);
100
+
100
101
  const handleColumnResizeStart = useCallback(() => {
101
102
  onColumnResizeStart?.(columnWidth, left, !!fixed);
102
103
  }, [columnWidth, fixed, left, onColumnResizeStart]);
@@ -1,7 +1,6 @@
1
1
  import React, { FC, useEffect, useState } from 'react';
2
2
 
3
3
  import CustomSelect from './customSelect';
4
- import { mergeLabels, type QbsTableLabels } from './qbsTable/labels';
5
4
  import { getRowDisplayRange } from './qbsTable/utilities/tablecalc';
6
5
 
7
6
  // Import the custom select component
@@ -16,8 +15,6 @@ type PageProps = {
16
15
  onRowsPerPage?: (row: number, page: number) => void;
17
16
  onPagination?: (row: number, page: number) => void;
18
17
  };
19
- labels?: QbsTableLabels;
20
- dataTheme?: string;
21
18
  };
22
19
 
23
20
  const PageIndex = ({ currentPage, handleFirst, pageCount }) => {
@@ -55,8 +52,7 @@ const PageIndex = ({ currentPage, handleFirst, pageCount }) => {
55
52
  return <>{renderPageNumbers()}</>;
56
53
  };
57
54
 
58
- const Pagination: FC<PageProps> = ({ paginationProps, labels: labelsProp, dataTheme }) => {
59
- const labels = mergeLabels(labelsProp);
55
+ const Pagination: FC<PageProps> = ({ paginationProps }) => {
60
56
  const {
61
57
  dropOptions = [10, 20, 50, 100, 200],
62
58
  currentPage = 1,
@@ -100,12 +96,9 @@ const Pagination: FC<PageProps> = ({ paginationProps, labels: labelsProp, dataTh
100
96
  return (
101
97
  <div
102
98
  className="qbs-table-custom-pagination"
103
- data-theme={dataTheme}
104
99
  style={{ display: 'flex', justifyContent: 'space-between' }}
105
100
  >
106
- <div className="rows-count">
107
- {getRowDisplayRange(total, rowsPerPageState, currentPage, labels.showingRange)}
108
- </div>
101
+ <div className="rows-count">{getRowDisplayRange(total, rowsPerPageState, currentPage)}</div>
109
102
  <div className="qbs-table-pagination-right-block">
110
103
  <button
111
104
  className="qbs-table-icon-container"
@@ -201,7 +194,7 @@ const Pagination: FC<PageProps> = ({ paginationProps, labels: labelsProp, dataTh
201
194
  </button>
202
195
  </div>
203
196
  <div className="qbs-table-pagination-flexBox">
204
- <span className="qbs-table-pagination-text">{labels.itemsPerPage}</span>
197
+ <span className="qbs-table-pagination-text">Items per page</span>
205
198
  <CustomSelect
206
199
  options={dropData}
207
200
  selectedValue={rowsPerPageState}
package/src/Table.tsx CHANGED
@@ -224,7 +224,6 @@ export interface TableProps<Row, Key> extends Omit<StandardProps, 'onScroll'> {
224
224
  expanded?: boolean
225
225
  ) => React.ReactNode;
226
226
  tableKey?: string;
227
- infiniteLoading?: boolean;
228
227
  /** Customize what you can do to expand a zone */
229
228
  renderRowExpanded?: (rowData?: Row) => React.ReactNode;
230
229
 
@@ -260,16 +259,13 @@ export interface TableProps<Row, Key> extends Omit<StandardProps, 'onScroll'> {
260
259
 
261
260
  /** Callback for the `touchend` event. */
262
261
  onTouchEnd?: (event: React.TouchEvent) => void;
263
- handleInfiniteScroll?: (value: number) => void;
262
+
264
263
  /**
265
264
  * Callback after table data update.
266
265
  * @deprecated use `shouldUpdateScroll` instead
267
266
  **/
268
267
  onDataUpdated?: (nextData: Row[], scrollTo: (coord: { x: number; y: number }) => void) => void;
269
268
  tableBodyRef: React.RefObject<HTMLDivElement>;
270
-
271
- wheelWrapperRef: React.RefObject<HTMLDivElement | null>;
272
-
273
269
  bodyRef?: (ref: HTMLElement) => void;
274
270
  }
275
271
 
@@ -306,7 +302,8 @@ const Table = React.forwardRef(<Row extends RowDataType, Key>(props: TableProps<
306
302
  loading: 'Loading...'
307
303
  },
308
304
  showHeader = true,
309
-
305
+ pagination = true,
306
+ paginationProps = {},
310
307
  sortColumn,
311
308
  rowHeight = ROW_HEIGHT,
312
309
  sortType: sortTypeProp,
@@ -338,21 +335,21 @@ const Table = React.forwardRef(<Row extends RowDataType, Key>(props: TableProps<
338
335
  onTouchStart,
339
336
  onTouchMove,
340
337
  onTouchEnd,
338
+ dataTheme,
341
339
  tableBodyHeight,
342
340
  columns,
343
341
  tableBodyRef,
344
342
  tableKey,
345
- handleInfiniteScroll,
346
- infiniteLoading,
347
- wheelWrapperRef,
348
343
  ...rest
349
344
  } = props;
345
+
350
346
  const {
351
347
  withClassPrefix,
352
348
  merge: mergeCls,
353
349
  prefix
354
350
  } = useClassNames(classPrefix, typeof classPrefix !== 'undefined');
355
351
  const childTableRef = useRef<HTMLDivElement>(null);
352
+
356
353
  // Use `forceUpdate` to force the component to re-render after manipulating the DOM.
357
354
  const [, forceUpdate] = useReducer(x => x + 1, 0);
358
355
  const [expandedRowKeys, setExpandedRowKeys] = useControlled(
@@ -411,6 +408,7 @@ const Table = React.forwardRef(<Row extends RowDataType, Key>(props: TableProps<
411
408
  const affixHeaderWrapperRef = useRef<HTMLDivElement>(null);
412
409
  const headerWrapperRef = useRef<HTMLDivElement>(null);
413
410
  // const tableBodyRef = useRef<HTMLDivElement>(null);
411
+ const wheelWrapperRef = useRef<HTMLDivElement>(null);
414
412
  const scrollbarXRef = useRef<ScrollbarInstance>(null);
415
413
  const scrollbarYRef = useRef<ScrollbarInstance>(null);
416
414
 
@@ -535,8 +533,7 @@ const Table = React.forwardRef(<Row extends RowDataType, Key>(props: TableProps<
535
533
  onScroll,
536
534
  onTouchStart,
537
535
  onTouchMove,
538
- onTouchEnd,
539
- handleInfiniteScroll
536
+ onTouchEnd
540
537
  });
541
538
 
542
539
  const { headerCells, bodyCells, allColumnsWidth, hasCustomTreeCol } = useCellDescriptor({
@@ -956,9 +953,7 @@ const Table = React.forwardRef(<Row extends RowDataType, Key>(props: TableProps<
956
953
  tableId={id}
957
954
  style={{ width: tableWidth.current }}
958
955
  length={tableWidth.current}
959
- onScroll={delta => {
960
- onScrollHorizontal(delta);
961
- }}
956
+ onScroll={onScrollHorizontal}
962
957
  scrollLength={contentWidth.current}
963
958
  ref={scrollbarXRef}
964
959
  />
@@ -1137,21 +1132,13 @@ const Table = React.forwardRef(<Row extends RowDataType, Key>(props: TableProps<
1137
1132
  role="rowgroup"
1138
1133
  className={prefix('body-row-wrapper')}
1139
1134
  style={bodyStyles}
1140
- onScroll={e => {
1141
- onScrollBody?.(e); // existing handler
1142
- }}
1135
+ onScroll={onScrollBody}
1143
1136
  >
1144
1137
  {!loading && (
1145
1138
  <div style={wheelStyles} className={prefix('body-wheel-area')} ref={wheelWrapperRef}>
1146
1139
  {topHideHeight ? <Row style={topRowStyles} className="virtualized" /> : null}
1147
1140
  {visibleRows.current}
1148
1141
  {bottomHideHeight ? <Row style={bottomRowStyles} className="virtualized" /> : null}
1149
-
1150
- {infiniteLoading && (
1151
- <div style={{ padding: 12, textAlign: 'center' }}>
1152
- <span>Loading more rows…</span>
1153
- </div>
1154
- )}
1155
1142
  </div>
1156
1143
  )}
1157
1144
 
@@ -1,88 +1,88 @@
1
- import React, { FC, useState, useEffect, useRef } from 'react';
2
-
3
- type CustomSelectProps = {
4
- options: number[];
5
- selectedValue: number;
6
- onChange: (value: number) => void;
7
- };
8
-
9
- const CustomSelect: FC<CustomSelectProps> = ({ options, selectedValue, onChange }) => {
10
- const [isOpen, setIsOpen] = useState(false);
11
- const [dropdownPosition, setDropdownPosition] = useState('bottom');
12
- const ref = useRef<HTMLDivElement>(null);
13
- const inputRef = useRef<HTMLDivElement>(null);
14
-
15
- const adjustDropdownPosition = () => {
16
- if (inputRef.current) {
17
- const inputBoxRect = inputRef.current.getBoundingClientRect();
18
- const viewportHeight = window.innerHeight;
19
-
20
- const spaceAbove = inputBoxRect.top;
21
- const spaceBelow = viewportHeight - inputBoxRect.bottom;
22
-
23
- if (spaceAbove > spaceBelow) {
24
- setDropdownPosition('top');
25
- } else {
26
- setDropdownPosition('bottom');
27
- }
28
- }
29
- };
30
-
31
- const handleToggle = () => {
32
- setIsOpen(prevIsOpen => !prevIsOpen);
33
- };
34
-
35
- const handleSelect = (value: number) => {
36
- onChange(value);
37
- setIsOpen(false);
38
- };
39
-
40
- const handleClickOutside = (event: MouseEvent) => {
41
- if (ref.current && !ref.current.contains(event.target as Node)) {
42
- setIsOpen(false);
43
- }
44
- };
45
-
46
- useEffect(() => {
47
- if (isOpen) {
48
- adjustDropdownPosition();
49
- window.addEventListener('resize', adjustDropdownPosition);
50
- } else {
51
- window.removeEventListener('resize', adjustDropdownPosition);
52
- }
53
-
54
- return () => {
55
- window.removeEventListener('resize', adjustDropdownPosition);
56
- };
57
- }, [isOpen]);
58
-
59
- useEffect(() => {
60
- document.addEventListener('mousedown', handleClickOutside);
61
- return () => {
62
- document.removeEventListener('mousedown', handleClickOutside);
63
- };
64
- }, []);
65
-
66
- return (
67
- <div className="custom-select" ref={ref}>
68
- <div className="custom-select-trigger" onClick={handleToggle} ref={inputRef}>
69
- {selectedValue}
70
- </div>
71
- {isOpen && (
72
- <ul className={`custom-select-options ${dropdownPosition}`}>
73
- {options.map(option => (
74
- <li
75
- key={option}
76
- className={`custom-select-option ${option === selectedValue ? 'selected' : ''}`}
77
- onClick={() => handleSelect(option)}
78
- >
79
- {option}
80
- </li>
81
- ))}
82
- </ul>
83
- )}
84
- </div>
85
- );
86
- };
87
-
88
- export default CustomSelect;
1
+ import React, { FC, useState, useEffect, useRef } from 'react';
2
+
3
+ type CustomSelectProps = {
4
+ options: number[];
5
+ selectedValue: number;
6
+ onChange: (value: number) => void;
7
+ };
8
+
9
+ const CustomSelect: FC<CustomSelectProps> = ({ options, selectedValue, onChange }) => {
10
+ const [isOpen, setIsOpen] = useState(false);
11
+ const [dropdownPosition, setDropdownPosition] = useState('bottom');
12
+ const ref = useRef<HTMLDivElement>(null);
13
+ const inputRef = useRef<HTMLDivElement>(null);
14
+
15
+ const adjustDropdownPosition = () => {
16
+ if (inputRef.current) {
17
+ const inputBoxRect = inputRef.current.getBoundingClientRect();
18
+ const viewportHeight = window.innerHeight;
19
+
20
+ const spaceAbove = inputBoxRect.top;
21
+ const spaceBelow = viewportHeight - inputBoxRect.bottom;
22
+
23
+ if (spaceAbove > spaceBelow) {
24
+ setDropdownPosition('top');
25
+ } else {
26
+ setDropdownPosition('bottom');
27
+ }
28
+ }
29
+ };
30
+
31
+ const handleToggle = () => {
32
+ setIsOpen(prevIsOpen => !prevIsOpen);
33
+ };
34
+
35
+ const handleSelect = (value: number) => {
36
+ onChange(value);
37
+ setIsOpen(false);
38
+ };
39
+
40
+ const handleClickOutside = (event: MouseEvent) => {
41
+ if (ref.current && !ref.current.contains(event.target as Node)) {
42
+ setIsOpen(false);
43
+ }
44
+ };
45
+
46
+ useEffect(() => {
47
+ if (isOpen) {
48
+ adjustDropdownPosition();
49
+ window.addEventListener('resize', adjustDropdownPosition);
50
+ } else {
51
+ window.removeEventListener('resize', adjustDropdownPosition);
52
+ }
53
+
54
+ return () => {
55
+ window.removeEventListener('resize', adjustDropdownPosition);
56
+ };
57
+ }, [isOpen]);
58
+
59
+ useEffect(() => {
60
+ document.addEventListener('mousedown', handleClickOutside);
61
+ return () => {
62
+ document.removeEventListener('mousedown', handleClickOutside);
63
+ };
64
+ }, []);
65
+
66
+ return (
67
+ <div className="custom-select" ref={ref}>
68
+ <div className="custom-select-trigger" onClick={handleToggle} ref={inputRef}>
69
+ {selectedValue}
70
+ </div>
71
+ {isOpen && (
72
+ <ul className={`custom-select-options ${dropdownPosition}`}>
73
+ {options.map(option => (
74
+ <li
75
+ key={option}
76
+ className={`custom-select-option ${option === selectedValue ? 'selected' : ''}`}
77
+ onClick={() => handleSelect(option)}
78
+ >
79
+ {option}
80
+ </li>
81
+ ))}
82
+ </ul>
83
+ )}
84
+ </div>
85
+ );
86
+ };
87
+
88
+ export default CustomSelect;
package/src/index.ts CHANGED
@@ -11,7 +11,7 @@ export type { ColumnProps } from './Column';
11
11
  export type { CellProps } from './Cell';
12
12
  export type { HeaderCellProps } from './HeaderCell';
13
13
  export type { ColumnGroupProps } from './ColumnGroup';
14
- export type { QbsTableProps, QbsTableLabels } from './qbsTable/commontypes';
14
+ export type { QbsTableProps } from './qbsTable/commontypes';
15
15
  export type {
16
16
  StandardProps,
17
17
  SortType,
@@ -5,8 +5,8 @@
5
5
  min-height: 40px;
6
6
  align-items: center;
7
7
  border-radius: 0 0 4px 4px;
8
- border-top: 1px solid var(--base-gray-border, #d6d8dc);
9
- background: var(--table-bg, #fff);
8
+ border-top: 1px solid #d6d8dc;
9
+ background: #fff;
10
10
  &-header {
11
11
  border-bottom: 1px solid #eee;
12
12
  position: absolute;
@@ -27,8 +27,8 @@
27
27
  font-weight: 500;
28
28
  line-height: 20px;
29
29
  border-radius: 6px;
30
- border: 1px solid var(--base-gray-border, #d6d8dc);
31
- background: var(--gray-light-1, #fff);
30
+ border: 1px solid #d6d8dc;
31
+ background: #fff;
32
32
  }
33
33
  .qbs-table-icon-container {
34
34
  padding: 0;
@@ -109,7 +109,7 @@
109
109
  font-style: normal;
110
110
  font-weight: 500;
111
111
  line-height: 20px;
112
- color: var(--gray-dark-3, #313131);
112
+ color: #313131;
113
113
  }
114
114
  }
115
115
 
@@ -125,7 +125,7 @@
125
125
  .custom-select-trigger {
126
126
  padding: 2px 8px;
127
127
  cursor: pointer;
128
- border: 1px solid var(--base-gray-border, #d6d8dc);
128
+ border: 1px solid #d6d8dc;
129
129
  border-radius: 4px;
130
130
  min-width: 65px;
131
131
  position: relative;
@@ -140,7 +140,7 @@
140
140
  list-style: none;
141
141
  margin: 2px 0 0;
142
142
  padding: 0;
143
- background: var(--gray-light-1, #fff);
143
+ background: #fff;
144
144
  border-radius: 8px;
145
145
  box-shadow: 0 8px 20px 0 #00000026;
146
146
  }
@@ -158,7 +158,7 @@ ul.custom-select-options.top {
158
158
 
159
159
  .custom-select-option:hover,
160
160
  .custom-select-option.selected {
161
- background-color: var(--table-row-hover-bg, #f0f0f0);
161
+ background-color: #f0f0f0;
162
162
  }
163
163
 
164
164
  .custom-select-trigger:before {
@@ -167,7 +167,7 @@ ul.custom-select-options.top {
167
167
  right: 10px;
168
168
  top: 6px;
169
169
  font-weight: bold;
170
- border: solid var(--gray-dark-3, black);
170
+ border: solid black;
171
171
  border-width: 0 1px 1px 0;
172
172
  display: inline-block;
173
173
  padding: 3px;