@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/esm/index.js CHANGED
@@ -1150,7 +1150,7 @@ var MovingWindow = class {
1150
1150
  }
1151
1151
  }
1152
1152
  getSelectedRows() {
1153
- return this.data.filter((row) => row[SELECTED2] === 1);
1153
+ return this.data.filter((row) => row[SELECTED2] !== 0);
1154
1154
  }
1155
1155
  };
1156
1156
 
@@ -1696,6 +1696,7 @@ var { IDX: IDX2 } = metadataKeys6;
1696
1696
  var NO_SELECTION = [];
1697
1697
  var useSelection = ({
1698
1698
  selectionModel,
1699
+ onSelect,
1699
1700
  onSelectionChange
1700
1701
  }) => {
1701
1702
  selectionModel === "extended" || selectionModel === "checkbox";
@@ -1717,11 +1718,10 @@ var useSelection = ({
1717
1718
  );
1718
1719
  selectedRef.current = newSelected;
1719
1720
  lastActiveRef.current = idx;
1720
- if (onSelectionChange) {
1721
- onSelectionChange(newSelected);
1722
- }
1721
+ onSelect == null ? void 0 : onSelect(row);
1722
+ onSelectionChange == null ? void 0 : onSelectionChange(newSelected);
1723
1723
  },
1724
- [onSelectionChange, selectionModel]
1724
+ [onSelect, onSelectionChange, selectionModel]
1725
1725
  );
1726
1726
  return handleSelectionChange;
1727
1727
  };
@@ -2460,9 +2460,6 @@ var useTable = ({
2460
2460
  rowHeight,
2461
2461
  size: containerMeasurements.innerSize
2462
2462
  });
2463
- console.log(
2464
- `rowCount from viewportMeasurements ${viewportMeasurements.rowCount}`
2465
- );
2466
2463
  const onSubscribed = useCallback18(
2467
2464
  ({ tableSchema }) => {
2468
2465
  if (tableSchema) {
@@ -2739,6 +2736,7 @@ var Table = ({
2739
2736
  onConfigChange,
2740
2737
  onFeatureEnabled,
2741
2738
  onFeatureInvocation,
2739
+ onSelect,
2742
2740
  onSelectionChange,
2743
2741
  onShowConfigEditor: onShowSettings,
2744
2742
  renderBufferSize = 0,
@@ -2773,6 +2771,7 @@ var Table = ({
2773
2771
  selectionModel,
2774
2772
  width
2775
2773
  });
2774
+ console.log({ tableProps });
2776
2775
  const style = {
2777
2776
  ...outerSize,
2778
2777
  "--content-height": `${viewportMeasurements.contentHeight}px`,
@@ -2897,6 +2896,7 @@ var JsonCell = ({ column, row }) => {
2897
2896
  return null;
2898
2897
  }
2899
2898
  };
2899
+ console.log("register JsonCell");
2900
2900
  registerComponent("json", JsonCell, "cell-renderer", {
2901
2901
  description: "JSON formatter",
2902
2902
  label: "JSON formatter",
@@ -3239,7 +3239,6 @@ var ColumnMenu = ({
3239
3239
  showContextMenu(e, "column-menu", {
3240
3240
  column,
3241
3241
  ContextMenuProps: {
3242
- className: "vuuColumnMenuList",
3243
3242
  onClose: handleMenuClose,
3244
3243
  position: getPosition(rootRef.current)
3245
3244
  }
@@ -3314,7 +3313,7 @@ var HeaderCell = ({
3314
3313
  import { ContextMenuProvider as ContextMenuProvider2 } from "@vuu-ui/vuu-popups";
3315
3314
  import { isGroupColumn as isGroupColumn7, metadataKeys as metadataKeys16, notHidden as notHidden4 } from "@vuu-ui/vuu-utils";
3316
3315
  import cx17 from "classnames";
3317
- import { useRef as useRef27 } from "react";
3316
+ import { forwardRef, useRef as useRef27 } from "react";
3318
3317
 
3319
3318
  // src/table-next/Row.tsx
3320
3319
  import {
@@ -3337,6 +3336,7 @@ var classBase11 = "vuuTableNextCell";
3337
3336
  var TableCell2 = ({
3338
3337
  column,
3339
3338
  columnMap,
3339
+ onClick,
3340
3340
  onDataEdited,
3341
3341
  row
3342
3342
  }) => {
@@ -3350,15 +3350,30 @@ var TableCell2 = ({
3350
3350
  },
3351
3351
  [name, onDataEdited, row]
3352
3352
  );
3353
- return /* @__PURE__ */ jsx20("div", { className, role: "cell", style, children: CellRenderer ? /* @__PURE__ */ jsx20(
3354
- CellRenderer,
3353
+ const handleClick = useCallback25(
3354
+ (evt) => {
3355
+ onClick == null ? void 0 : onClick(evt, column);
3356
+ },
3357
+ [column, onClick]
3358
+ );
3359
+ return /* @__PURE__ */ jsx20(
3360
+ "div",
3355
3361
  {
3356
- column,
3357
- columnMap,
3358
- onCommit: handleDataItemEdited,
3359
- row
3362
+ className,
3363
+ onClick: onClick ? handleClick : void 0,
3364
+ role: "cell",
3365
+ style,
3366
+ children: CellRenderer ? /* @__PURE__ */ jsx20(
3367
+ CellRenderer,
3368
+ {
3369
+ column,
3370
+ columnMap,
3371
+ onCommit: handleDataItemEdited,
3372
+ row
3373
+ }
3374
+ ) : valueFormatter(row[dataIdx])
3360
3375
  }
3361
- ) : valueFormatter(row[dataIdx]) });
3376
+ );
3362
3377
  };
3363
3378
 
3364
3379
  // src/table-next/table-cell/TableGroupCell.tsx
@@ -3840,7 +3855,7 @@ var MovingWindow2 = class {
3840
3855
  }
3841
3856
  }
3842
3857
  getSelectedRows() {
3843
- return this.data.filter((row) => row[SELECTED4] === 1);
3858
+ return this.data.filter((row) => row[SELECTED4] !== 0);
3844
3859
  }
3845
3860
  };
3846
3861
 
@@ -4560,6 +4575,7 @@ var useTable2 = ({
4560
4575
  onFeatureEnabled,
4561
4576
  onFeatureInvocation,
4562
4577
  onRowClick: onRowClickProp,
4578
+ onSelect,
4563
4579
  onSelectionChange,
4564
4580
  renderBufferSize = 0,
4565
4581
  rowHeight = 20,
@@ -4643,9 +4659,6 @@ var useTable2 = ({
4643
4659
  });
4644
4660
  const handleConfigChanged = useCallback34(
4645
4661
  (tableConfig2) => {
4646
- console.log(`useTableNext handleConfigChanged`, {
4647
- tableConfig: tableConfig2
4648
- });
4649
4662
  dispatchColumnAction({
4650
4663
  type: "init",
4651
4664
  tableConfig: tableConfig2,
@@ -4657,9 +4670,6 @@ var useTable2 = ({
4657
4670
  );
4658
4671
  const handleDataSourceConfigChanged = useCallback34(
4659
4672
  (dataSourceConfig) => {
4660
- console.log("config changed", {
4661
- dataSourceConfig
4662
- });
4663
4673
  dataSource.config = {
4664
4674
  ...dataSource.config,
4665
4675
  ...dataSourceConfig
@@ -4669,9 +4679,6 @@ var useTable2 = ({
4669
4679
  );
4670
4680
  const handleCreateCalculatedColumn = useCallback34(
4671
4681
  (column) => {
4672
- console.log(`useTableNext handleCreateCalculatedColumn`, {
4673
- column
4674
- });
4675
4682
  dataSource.columns = dataSource.columns.concat(column.name);
4676
4683
  const newTableConfig = addColumn(tableConfig, column);
4677
4684
  dispatchColumnAction({
@@ -4887,6 +4894,7 @@ var useTable2 = ({
4887
4894
  [dataSource, onSelectionChange]
4888
4895
  );
4889
4896
  const selectionHookOnRowClick = useSelection({
4897
+ onSelect,
4890
4898
  onSelectionChange: handleSelectionChange,
4891
4899
  selectionModel
4892
4900
  });
@@ -4962,11 +4970,12 @@ var useTable2 = ({
4962
4970
 
4963
4971
  // src/table-next/TableNext.tsx
4964
4972
  import { MeasuredContainer, useId } from "@vuu-ui/vuu-layout";
4973
+ import { useForkRef } from "@salt-ds/core";
4965
4974
  import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
4966
4975
  import { createElement as createElement4 } from "react";
4967
4976
  var classBase14 = "vuuTableNext";
4968
4977
  var { IDX: IDX5, RENDER_IDX: RENDER_IDX2 } = metadataKeys16;
4969
- var TableNext = ({
4978
+ var TableNext = forwardRef(function TableNext2({
4970
4979
  Row: Row3 = Row2,
4971
4980
  availableColumns,
4972
4981
  className: classNameProp,
@@ -4978,6 +4987,7 @@ var TableNext = ({
4978
4987
  onFeatureEnabled,
4979
4988
  onFeatureInvocation,
4980
4989
  onRowClick: onRowClickProp,
4990
+ onSelect,
4981
4991
  onSelectionChange,
4982
4992
  onShowConfigEditor: onShowSettings,
4983
4993
  renderBufferSize = 0,
@@ -4987,7 +4997,7 @@ var TableNext = ({
4987
4997
  headerHeight = showColumnHeaders ? 25 : 0,
4988
4998
  style: styleProp,
4989
4999
  ...htmlAttributes
4990
- }) => {
5000
+ }, forwardedRef) {
4991
5001
  const id = useId(idProp);
4992
5002
  const containerRef = useRef27(null);
4993
5003
  const {
@@ -5018,6 +5028,7 @@ var TableNext = ({
5018
5028
  onFeatureEnabled,
5019
5029
  onFeatureInvocation,
5020
5030
  onRowClick: onRowClickProp,
5031
+ onSelect,
5021
5032
  onSelectionChange,
5022
5033
  renderBufferSize,
5023
5034
  rowHeight,
@@ -5055,7 +5066,7 @@ var TableNext = ({
5055
5066
  ...htmlAttributes,
5056
5067
  className,
5057
5068
  onResize,
5058
- ref: containerRef,
5069
+ ref: useForkRef(containerRef, forwardedRef),
5059
5070
  style: getStyle(),
5060
5071
  children: [
5061
5072
  /* @__PURE__ */ jsx23(
@@ -5121,7 +5132,7 @@ var TableNext = ({
5121
5132
  )
5122
5133
  }
5123
5134
  );
5124
- };
5135
+ });
5125
5136
 
5126
5137
  // src/table-next/cell-renderers/dropdown-cell/DropdownCell.tsx
5127
5138
  import {