@vuu-ui/vuu-table 0.8.10-debug → 0.8.11-debug

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/index.js CHANGED
@@ -1155,7 +1155,7 @@ var MovingWindow = class {
1155
1155
  }
1156
1156
  }
1157
1157
  getSelectedRows() {
1158
- return this.data.filter((row) => row[SELECTED2] === 1);
1158
+ return this.data.filter((row) => row[SELECTED2] !== 0);
1159
1159
  }
1160
1160
  };
1161
1161
 
@@ -1690,6 +1690,7 @@ var { IDX: IDX2 } = import_vuu_utils11.metadataKeys;
1690
1690
  var NO_SELECTION = [];
1691
1691
  var useSelection = ({
1692
1692
  selectionModel,
1693
+ onSelect,
1693
1694
  onSelectionChange
1694
1695
  }) => {
1695
1696
  selectionModel === "extended" || selectionModel === "checkbox";
@@ -1711,11 +1712,10 @@ var useSelection = ({
1711
1712
  );
1712
1713
  selectedRef.current = newSelected;
1713
1714
  lastActiveRef.current = idx;
1714
- if (onSelectionChange) {
1715
- onSelectionChange(newSelected);
1716
- }
1715
+ onSelect == null ? void 0 : onSelect(row);
1716
+ onSelectionChange == null ? void 0 : onSelectionChange(newSelected);
1717
1717
  },
1718
- [onSelectionChange, selectionModel]
1718
+ [onSelect, onSelectionChange, selectionModel]
1719
1719
  );
1720
1720
  return handleSelectionChange;
1721
1721
  };
@@ -2429,9 +2429,6 @@ var useTable = ({
2429
2429
  rowHeight,
2430
2430
  size: containerMeasurements.innerSize
2431
2431
  });
2432
- console.log(
2433
- `rowCount from viewportMeasurements ${viewportMeasurements.rowCount}`
2434
- );
2435
2432
  const onSubscribed = (0, import_react20.useCallback)(
2436
2433
  ({ tableSchema }) => {
2437
2434
  if (tableSchema) {
@@ -2708,6 +2705,7 @@ var Table = ({
2708
2705
  onConfigChange,
2709
2706
  onFeatureEnabled,
2710
2707
  onFeatureInvocation,
2708
+ onSelect,
2711
2709
  onSelectionChange,
2712
2710
  onShowConfigEditor: onShowSettings,
2713
2711
  renderBufferSize = 0,
@@ -2742,6 +2740,7 @@ var Table = ({
2742
2740
  selectionModel,
2743
2741
  width
2744
2742
  });
2743
+ console.log({ tableProps });
2745
2744
  const style = {
2746
2745
  ...outerSize,
2747
2746
  "--content-height": `${viewportMeasurements.contentHeight}px`,
@@ -2862,6 +2861,7 @@ var JsonCell = ({ column, row }) => {
2862
2861
  return null;
2863
2862
  }
2864
2863
  };
2864
+ console.log("register JsonCell");
2865
2865
  (0, import_vuu_utils17.registerComponent)("json", JsonCell, "cell-renderer", {
2866
2866
  description: "JSON formatter",
2867
2867
  label: "JSON formatter",
@@ -3197,7 +3197,6 @@ var ColumnMenu = ({
3197
3197
  showContextMenu(e, "column-menu", {
3198
3198
  column,
3199
3199
  ContextMenuProps: {
3200
- className: "vuuColumnMenuList",
3201
3200
  onClose: handleMenuClose,
3202
3201
  position: getPosition(rootRef.current)
3203
3202
  }
@@ -3288,6 +3287,7 @@ var classBase11 = "vuuTableNextCell";
3288
3287
  var TableCell2 = ({
3289
3288
  column,
3290
3289
  columnMap,
3290
+ onClick,
3291
3291
  onDataEdited,
3292
3292
  row
3293
3293
  }) => {
@@ -3301,15 +3301,30 @@ var TableCell2 = ({
3301
3301
  },
3302
3302
  [name, onDataEdited, row]
3303
3303
  );
3304
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className, role: "cell", style, children: CellRenderer ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3305
- CellRenderer,
3304
+ const handleClick = (0, import_react31.useCallback)(
3305
+ (evt) => {
3306
+ onClick == null ? void 0 : onClick(evt, column);
3307
+ },
3308
+ [column, onClick]
3309
+ );
3310
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3311
+ "div",
3306
3312
  {
3307
- column,
3308
- columnMap,
3309
- onCommit: handleDataItemEdited,
3310
- row
3313
+ className,
3314
+ onClick: onClick ? handleClick : void 0,
3315
+ role: "cell",
3316
+ style,
3317
+ children: CellRenderer ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3318
+ CellRenderer,
3319
+ {
3320
+ column,
3321
+ columnMap,
3322
+ onCommit: handleDataItemEdited,
3323
+ row
3324
+ }
3325
+ ) : valueFormatter(row[dataIdx])
3311
3326
  }
3312
- ) : valueFormatter(row[dataIdx]) });
3327
+ );
3313
3328
  };
3314
3329
 
3315
3330
  // src/table-next/table-cell/TableGroupCell.tsx
@@ -3769,7 +3784,7 @@ var MovingWindow2 = class {
3769
3784
  }
3770
3785
  }
3771
3786
  getSelectedRows() {
3772
- return this.data.filter((row) => row[SELECTED4] === 1);
3787
+ return this.data.filter((row) => row[SELECTED4] !== 0);
3773
3788
  }
3774
3789
  };
3775
3790
 
@@ -4471,6 +4486,7 @@ var useTable2 = ({
4471
4486
  onFeatureEnabled,
4472
4487
  onFeatureInvocation,
4473
4488
  onRowClick: onRowClickProp,
4489
+ onSelect,
4474
4490
  onSelectionChange,
4475
4491
  renderBufferSize = 0,
4476
4492
  rowHeight = 20,
@@ -4554,9 +4570,6 @@ var useTable2 = ({
4554
4570
  });
4555
4571
  const handleConfigChanged = (0, import_react43.useCallback)(
4556
4572
  (tableConfig2) => {
4557
- console.log(`useTableNext handleConfigChanged`, {
4558
- tableConfig: tableConfig2
4559
- });
4560
4573
  dispatchColumnAction({
4561
4574
  type: "init",
4562
4575
  tableConfig: tableConfig2,
@@ -4568,9 +4581,6 @@ var useTable2 = ({
4568
4581
  );
4569
4582
  const handleDataSourceConfigChanged = (0, import_react43.useCallback)(
4570
4583
  (dataSourceConfig) => {
4571
- console.log("config changed", {
4572
- dataSourceConfig
4573
- });
4574
4584
  dataSource.config = {
4575
4585
  ...dataSource.config,
4576
4586
  ...dataSourceConfig
@@ -4580,9 +4590,6 @@ var useTable2 = ({
4580
4590
  );
4581
4591
  const handleCreateCalculatedColumn = (0, import_react43.useCallback)(
4582
4592
  (column) => {
4583
- console.log(`useTableNext handleCreateCalculatedColumn`, {
4584
- column
4585
- });
4586
4593
  dataSource.columns = dataSource.columns.concat(column.name);
4587
4594
  const newTableConfig = addColumn(tableConfig, column);
4588
4595
  dispatchColumnAction({
@@ -4798,6 +4805,7 @@ var useTable2 = ({
4798
4805
  [dataSource, onSelectionChange]
4799
4806
  );
4800
4807
  const selectionHookOnRowClick = useSelection({
4808
+ onSelect,
4801
4809
  onSelectionChange: handleSelectionChange,
4802
4810
  selectionModel
4803
4811
  });
@@ -4873,11 +4881,12 @@ var useTable2 = ({
4873
4881
 
4874
4882
  // src/table-next/TableNext.tsx
4875
4883
  var import_vuu_layout3 = require("@vuu-ui/vuu-layout");
4884
+ var import_core2 = require("@salt-ds/core");
4876
4885
  var import_jsx_runtime23 = require("react/jsx-runtime");
4877
4886
  var import_react45 = require("react");
4878
4887
  var classBase14 = "vuuTableNext";
4879
4888
  var { IDX: IDX5, RENDER_IDX: RENDER_IDX2 } = import_vuu_utils28.metadataKeys;
4880
- var TableNext = ({
4889
+ var TableNext = (0, import_react44.forwardRef)(function TableNext2({
4881
4890
  Row: Row3 = Row2,
4882
4891
  availableColumns,
4883
4892
  className: classNameProp,
@@ -4889,6 +4898,7 @@ var TableNext = ({
4889
4898
  onFeatureEnabled,
4890
4899
  onFeatureInvocation,
4891
4900
  onRowClick: onRowClickProp,
4901
+ onSelect,
4892
4902
  onSelectionChange,
4893
4903
  onShowConfigEditor: onShowSettings,
4894
4904
  renderBufferSize = 0,
@@ -4898,7 +4908,7 @@ var TableNext = ({
4898
4908
  headerHeight = showColumnHeaders ? 25 : 0,
4899
4909
  style: styleProp,
4900
4910
  ...htmlAttributes
4901
- }) => {
4911
+ }, forwardedRef) {
4902
4912
  const id = (0, import_vuu_layout3.useId)(idProp);
4903
4913
  const containerRef = (0, import_react44.useRef)(null);
4904
4914
  const {
@@ -4929,6 +4939,7 @@ var TableNext = ({
4929
4939
  onFeatureEnabled,
4930
4940
  onFeatureInvocation,
4931
4941
  onRowClick: onRowClickProp,
4942
+ onSelect,
4932
4943
  onSelectionChange,
4933
4944
  renderBufferSize,
4934
4945
  rowHeight,
@@ -4966,7 +4977,7 @@ var TableNext = ({
4966
4977
  ...htmlAttributes,
4967
4978
  className,
4968
4979
  onResize,
4969
- ref: containerRef,
4980
+ ref: (0, import_core2.useForkRef)(containerRef, forwardedRef),
4970
4981
  style: getStyle(),
4971
4982
  children: [
4972
4983
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
@@ -5032,7 +5043,7 @@ var TableNext = ({
5032
5043
  )
5033
5044
  }
5034
5045
  );
5035
- };
5046
+ });
5036
5047
 
5037
5048
  // src/table-next/cell-renderers/dropdown-cell/DropdownCell.tsx
5038
5049
  var import_vuu_ui_controls5 = require("@vuu-ui/vuu-ui-controls");
@@ -5070,7 +5081,7 @@ var DropdownCell = ({ column, columnMap, row }) => {
5070
5081
 
5071
5082
  // src/table-next/cell-renderers/input-cell/InputCell.tsx
5072
5083
  var import_vuu_utils30 = require("@vuu-ui/vuu-utils");
5073
- var import_core2 = require("@salt-ds/core");
5084
+ var import_core3 = require("@salt-ds/core");
5074
5085
  var import_vuu_ui_controls6 = require("@vuu-ui/vuu-ui-controls");
5075
5086
  var import_classnames18 = __toESM(require("classnames"));
5076
5087
  var import_jsx_runtime25 = require("react/jsx-runtime");
@@ -5101,7 +5112,7 @@ var InputCell = ({
5101
5112
  const endAdornment = warningMessage && align === "left" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: `${classBase16}-icon`, "data-icon": "error" }) : void 0;
5102
5113
  const startAdornment = warningMessage && align === "right" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: `${classBase16}-icon`, "data-icon": "error" }) : void 0;
5103
5114
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5104
- import_core2.Input,
5115
+ import_core3.Input,
5105
5116
  {
5106
5117
  ...editProps,
5107
5118
  className: (0, import_classnames18.default)(classBase16, {