qbs-react-grid 2.0.1 → 2.0.2

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.
@@ -112,7 +112,7 @@ export var CustomTableCell = /*#__PURE__*/React.memo(function (_ref4) {
112
112
  path = _ref4.path,
113
113
  link = _ref4.link,
114
114
  props = _objectWithoutPropertiesLoose(_ref4, _excluded3);
115
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Cell, _extends({}, props, {
115
+ return /*#__PURE__*/React.createElement(Cell, _extends({}, props, {
116
116
  dataKey: dataKey
117
117
  }), link && !path && !(hideLink !== null && hideLink !== void 0 && hideLink(rowData)) ? /*#__PURE__*/React.createElement("a", {
118
118
  onClick: function onClick() {
@@ -122,7 +122,7 @@ export var CustomTableCell = /*#__PURE__*/React.memo(function (_ref4) {
122
122
  }, renderCell ? (_renderCell = renderCell(rowData)) === null || _renderCell === void 0 ? void 0 : _renderCell.cell : handleCellFormat(rowData[dataKey], type)) : path && !(hideLink !== null && hideLink !== void 0 && hideLink(rowData)) ? /*#__PURE__*/React.createElement(Link, {
123
123
  to: (_path = path === null || path === void 0 ? void 0 : path(rowData)) != null ? _path : '',
124
124
  className: "qbs-table-row-link"
125
- }, renderCell ? (_renderCell2 = renderCell(rowData)) === null || _renderCell2 === void 0 ? void 0 : _renderCell2.cell : handleCellFormat(rowData[dataKey], type)) : /*#__PURE__*/React.createElement(React.Fragment, null, renderCell ? (_renderCell3 = renderCell(rowData)) === null || _renderCell3 === void 0 ? void 0 : _renderCell3.cell : handleCellFormat(rowData[dataKey], type))));
125
+ }, renderCell ? (_renderCell2 = renderCell(rowData)) === null || _renderCell2 === void 0 ? void 0 : _renderCell2.cell : handleCellFormat(rowData[dataKey], type)) : renderCell ? (_renderCell3 = renderCell(rowData)) === null || _renderCell3 === void 0 ? void 0 : _renderCell3.cell : handleCellFormat(rowData[dataKey], type));
126
126
  });
127
127
  export var CustomRowStatus = /*#__PURE__*/React.memo(function (_ref5) {
128
128
  var _path2;
@@ -154,7 +154,7 @@ export var CustomRowStatus = /*#__PURE__*/React.memo(function (_ref5) {
154
154
  }
155
155
  }
156
156
  };
157
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Cell, _extends({}, props, {
157
+ return /*#__PURE__*/React.createElement(Cell, _extends({}, props, {
158
158
  dataKey: dataKey,
159
159
  style: {
160
160
  padding: 0,
@@ -190,5 +190,5 @@ export var CustomRowStatus = /*#__PURE__*/React.memo(function (_ref5) {
190
190
  style: {
191
191
  position: 'fixed'
192
192
  }
193
- }, getToolTip === null || getToolTip === void 0 ? void 0 : getToolTip(rowData)))));
193
+ }, getToolTip === null || getToolTip === void 0 ? void 0 : getToolTip(rowData))));
194
194
  });
@@ -538,11 +538,11 @@ var QbsTable = function QbsTable(_ref) {
538
538
  dataKey: field,
539
539
  dataTheme: dataTheme,
540
540
  className: " " + classes.cellClass
541
- })) : /*#__PURE__*/React.createElement(React.Fragment, null);
541
+ })) : null;
542
542
  } // ✅ Fix: Return `null` instead of `false`
543
543
  ).filter(Boolean);
544
544
  },
545
- // ✅ Fix: Remove `undefined` and `false` elements
545
+ // ✅ Fix: Type assertion to ReactElement[]
546
546
  [columns, dataTheme]);
547
547
  return /*#__PURE__*/React.createElement("div", {
548
548
  className: "qbs-table " + classes.tableContainerClass,
@@ -151,6 +151,7 @@ var useCellDescriptor = function useCellDescriptor(props) {
151
151
  if (treeCol) {
152
152
  hasCustomTreeCol = true;
153
153
  }
154
+ console.log(columns);
154
155
  if ((columnChildren === null || columnChildren === void 0 ? void 0 : columnChildren.length) !== 2) {
155
156
  throw new Error("Component <HeaderCell> and <Cell> is required, column index: " + index + " ");
156
157
  }
@@ -122,7 +122,7 @@ var CustomTableCell = /*#__PURE__*/_react["default"].memo(function (_ref4) {
122
122
  path = _ref4.path,
123
123
  link = _ref4.link,
124
124
  props = (0, _objectWithoutPropertiesLoose2["default"])(_ref4, _excluded3);
125
- return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Cell["default"], (0, _extends2["default"])({}, props, {
125
+ return /*#__PURE__*/_react["default"].createElement(_Cell["default"], (0, _extends2["default"])({}, props, {
126
126
  dataKey: dataKey
127
127
  }), link && !path && !(hideLink !== null && hideLink !== void 0 && hideLink(rowData)) ? /*#__PURE__*/_react["default"].createElement("a", {
128
128
  onClick: function onClick() {
@@ -132,7 +132,7 @@ var CustomTableCell = /*#__PURE__*/_react["default"].memo(function (_ref4) {
132
132
  }, renderCell ? (_renderCell = renderCell(rowData)) === null || _renderCell === void 0 ? void 0 : _renderCell.cell : (0, _handleFormatCell.handleCellFormat)(rowData[dataKey], type)) : path && !(hideLink !== null && hideLink !== void 0 && hideLink(rowData)) ? /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Link, {
133
133
  to: (_path = path === null || path === void 0 ? void 0 : path(rowData)) != null ? _path : '',
134
134
  className: "qbs-table-row-link"
135
- }, renderCell ? (_renderCell2 = renderCell(rowData)) === null || _renderCell2 === void 0 ? void 0 : _renderCell2.cell : (0, _handleFormatCell.handleCellFormat)(rowData[dataKey], type)) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, renderCell ? (_renderCell3 = renderCell(rowData)) === null || _renderCell3 === void 0 ? void 0 : _renderCell3.cell : (0, _handleFormatCell.handleCellFormat)(rowData[dataKey], type))));
135
+ }, renderCell ? (_renderCell2 = renderCell(rowData)) === null || _renderCell2 === void 0 ? void 0 : _renderCell2.cell : (0, _handleFormatCell.handleCellFormat)(rowData[dataKey], type)) : renderCell ? (_renderCell3 = renderCell(rowData)) === null || _renderCell3 === void 0 ? void 0 : _renderCell3.cell : (0, _handleFormatCell.handleCellFormat)(rowData[dataKey], type));
136
136
  });
137
137
  exports.CustomTableCell = CustomTableCell;
138
138
  var CustomRowStatus = /*#__PURE__*/_react["default"].memo(function (_ref5) {
@@ -165,7 +165,7 @@ var CustomRowStatus = /*#__PURE__*/_react["default"].memo(function (_ref5) {
165
165
  }
166
166
  }
167
167
  };
168
- return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Cell["default"], (0, _extends2["default"])({}, props, {
168
+ return /*#__PURE__*/_react["default"].createElement(_Cell["default"], (0, _extends2["default"])({}, props, {
169
169
  dataKey: dataKey,
170
170
  style: {
171
171
  padding: 0,
@@ -201,6 +201,6 @@ var CustomRowStatus = /*#__PURE__*/_react["default"].memo(function (_ref5) {
201
201
  style: {
202
202
  position: 'fixed'
203
203
  }
204
- }, getToolTip === null || getToolTip === void 0 ? void 0 : getToolTip(rowData)))));
204
+ }, getToolTip === null || getToolTip === void 0 ? void 0 : getToolTip(rowData))));
205
205
  });
206
206
  exports.CustomRowStatus = CustomRowStatus;
@@ -544,11 +544,11 @@ var QbsTable = function QbsTable(_ref) {
544
544
  dataKey: field,
545
545
  dataTheme: dataTheme,
546
546
  className: " " + classes.cellClass
547
- })) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null);
547
+ })) : null;
548
548
  } // ✅ Fix: Return `null` instead of `false`
549
549
  ).filter(Boolean);
550
550
  },
551
- // ✅ Fix: Remove `undefined` and `false` elements
551
+ // ✅ Fix: Type assertion to ReactElement[]
552
552
  [columns, dataTheme]);
553
553
  return /*#__PURE__*/_react["default"].createElement("div", {
554
554
  className: "qbs-table " + classes.tableContainerClass,
@@ -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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qbs-react-grid",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "A React table component",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -110,21 +110,21 @@ export const CustomTableCell: React.FC<any> = React.memo(
110
110
  ...props
111
111
  }) => {
112
112
  return (
113
- <>
114
- <Cell {...props} dataKey={dataKey}>
115
- {link && !path && !hideLink?.(rowData) ? (
116
- <a onClick={() => rowClick?.(rowData)} className="qbs-table-row-link">
117
- {renderCell ? renderCell(rowData)?.cell : handleCellFormat(rowData[dataKey], type)}
118
- </a>
119
- ) : path && !hideLink?.(rowData) ? (
120
- <Link to={path?.(rowData) ?? ''} className="qbs-table-row-link">
121
- {renderCell ? renderCell(rowData)?.cell : handleCellFormat(rowData[dataKey], type)}
122
- </Link>
123
- ) : (
124
- <>{renderCell ? renderCell(rowData)?.cell : handleCellFormat(rowData[dataKey], type)}</>
125
- )}
126
- </Cell>
127
- </>
113
+ <Cell {...props} dataKey={dataKey}>
114
+ {link && !path && !hideLink?.(rowData) ? (
115
+ <a onClick={() => rowClick?.(rowData)} className="qbs-table-row-link">
116
+ {renderCell ? renderCell(rowData)?.cell : handleCellFormat(rowData[dataKey], type)}
117
+ </a>
118
+ ) : path && !hideLink?.(rowData) ? (
119
+ <Link to={path?.(rowData) ?? ''} className="qbs-table-row-link">
120
+ {renderCell ? renderCell(rowData)?.cell : handleCellFormat(rowData[dataKey], type)}
121
+ </Link>
122
+ ) : renderCell ? (
123
+ renderCell(rowData)?.cell
124
+ ) : (
125
+ handleCellFormat(rowData[dataKey], type)
126
+ )}
127
+ </Cell>
128
128
  );
129
129
  }
130
130
  );
@@ -149,41 +149,39 @@ export const CustomRowStatus: React.FC<any> = React.memo(
149
149
  };
150
150
 
151
151
  return (
152
- <>
153
- <Cell
154
- {...props}
155
- dataKey={dataKey}
156
- style={{ padding: 0, display: 'flex', justifyContent: 'center', alignItems: 'center' }}
157
- onMouseEnter={() => adjustDropdownPosition()}
158
- >
159
- <div className="row-status">
160
- {!path ? (
161
- <span
162
- ref={menuButtonRef}
163
- style={{ height: 24, width: 24, display: 'flex' }}
164
- onClick={() => rowClick?.(rowData)}
165
- >
166
- {getIcon?.(rowData)}
167
- </span>
168
- ) : (
169
- <Link
170
- style={{ height: 24, width: 24 }}
171
- to={path?.(rowData) ?? ''}
172
- className="qbs-table-row-link"
173
- >
174
- {getIcon?.(rowData)}
175
- </Link>
176
- )}
177
- <div
178
- ref={dropRef}
179
- className={`row-status-tooltip ${dropdownPosition}`}
180
- style={{ position: 'fixed' }}
152
+ <Cell
153
+ {...props}
154
+ dataKey={dataKey}
155
+ style={{ padding: 0, display: 'flex', justifyContent: 'center', alignItems: 'center' }}
156
+ onMouseEnter={() => adjustDropdownPosition()}
157
+ >
158
+ <div className="row-status">
159
+ {!path ? (
160
+ <span
161
+ ref={menuButtonRef}
162
+ style={{ height: 24, width: 24, display: 'flex' }}
163
+ onClick={() => rowClick?.(rowData)}
181
164
  >
182
- {getToolTip?.(rowData)}
183
- </div>
165
+ {getIcon?.(rowData)}
166
+ </span>
167
+ ) : (
168
+ <Link
169
+ style={{ height: 24, width: 24 }}
170
+ to={path?.(rowData) ?? ''}
171
+ className="qbs-table-row-link"
172
+ >
173
+ {getIcon?.(rowData)}
174
+ </Link>
175
+ )}
176
+ <div
177
+ ref={dropRef}
178
+ className={`row-status-tooltip ${dropdownPosition}`}
179
+ style={{ position: 'fixed' }}
180
+ >
181
+ {getToolTip?.(rowData)}
184
182
  </div>
185
- </Cell>
186
- </>
183
+ </div>
184
+ </Cell>
187
185
  );
188
186
  }
189
187
  );
@@ -558,11 +558,9 @@ const QbsTable: React.FC<QbsTableProps> = ({
558
558
  )}
559
559
  </Column>
560
560
  )
561
- ) : (
562
- <></>
563
- ) // ✅ Fix: Return `null` instead of `false`
561
+ ) : null // ✅ Fix: Return `null` instead of `false`
564
562
  )
565
- .filter(Boolean), // ✅ Fix: Remove `undefined` and `false` elements
563
+ .filter(Boolean) as React.ReactElement[], // ✅ Fix: Type assertion to ReactElement[]
566
564
  [columns, dataTheme]
567
565
  );
568
566
 
@@ -202,10 +202,10 @@ const useCellDescriptor = <Row extends RowDataType>(
202
202
  const columnProps = getColumnProps(column);
203
203
 
204
204
  const { width, resizable, flexGrow, minWidth, onResize, treeCol } = columnProps;
205
-
206
205
  if (treeCol) {
207
206
  hasCustomTreeCol = true;
208
207
  }
208
+ console.log(columns);
209
209
 
210
210
  if (columnChildren?.length !== 2) {
211
211
  throw new Error(`Component <HeaderCell> and <Cell> is required, column index: ${index} `);