@infinite-table/infinite-react 3.1.0 → 3.1.1

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/index.d.ts CHANGED
@@ -301,6 +301,7 @@ declare type InfiniteTableColumnRenderParamBase<DATA_TYPE, COL_TYPE = InfiniteTa
301
301
  toggleGroupRow: InfiniteTableToggleGroupRowFn;
302
302
  toggleCurrentGroupRowSelection: () => void;
303
303
  toggleCurrentRowSelection: () => void;
304
+ rowHasSelectedCells: boolean;
304
305
  cellSelected: boolean;
305
306
  selectCurrentRow: () => void;
306
307
  selectRow: InfiniteTableSelectRowFn;
@@ -345,16 +346,17 @@ declare type InfiniteTableColumnVerticalAlignValues = 'start' | 'center' | 'end'
345
346
  declare type InfiniteTableColumnHeader<T> = Renderable | InfiniteTableColumnHeaderRenderFunction<T>;
346
347
  declare type InfiniteTableDataTypeNames = 'string' | 'number' | 'date' | string;
347
348
  declare type InfiniteTableColumnTypeNames = 'string' | 'number' | 'date' | string;
348
- declare type InfiniteTableColumnStyleFnParams<T> = {
349
+ declare type InfiniteTableColumnStylingFnParams<T> = {
349
350
  value: Renderable;
350
351
  column: InfiniteTableComputedColumn<T>;
351
352
  inEdit: boolean;
353
+ rowHasSelectedCells: boolean;
352
354
  editError: InfiniteTableColumnRenderParamBase<T>['editError'];
353
355
  } & InfiniteTableRowInfoDataDiscriminator<T>;
354
- declare type InfiniteTableColumnStyleFn<T> = (params: InfiniteTableColumnStyleFnParams<T>) => undefined | React__default.CSSProperties;
356
+ declare type InfiniteTableColumnStyleFn<T> = (params: InfiniteTableColumnStylingFnParams<T>) => undefined | React__default.CSSProperties;
355
357
  declare type InfiniteTableColumnHeaderClassNameFn<T> = (params: InfiniteTableColumnHeaderParam<T>) => undefined | string;
356
358
  declare type InfiniteTableColumnHeaderStyleFn<T> = (params: InfiniteTableColumnHeaderParam<T>) => undefined | React__default.CSSProperties;
357
- declare type InfiniteTableColumnClassNameFn<T> = (params: InfiniteTableColumnStyleFnParams<T>) => undefined | string;
359
+ declare type InfiniteTableColumnClassNameFn<T> = (params: InfiniteTableColumnStylingFnParams<T>) => undefined | string;
358
360
  declare type InfiniteTableColumnStyle<T> = CSSProperties | InfiniteTableColumnStyleFn<T>;
359
361
  declare type InfiniteTableColumnAlign<T> = InfiniteTableColumnAlignValues | InfiniteTableColumnAlignFn<T>;
360
362
  declare type InfiniteTableColumnVerticalAlign<T> = InfiniteTableColumnVerticalAlignValues | InfiniteTableColumnVerticalAlignFn<T>;
@@ -362,7 +364,7 @@ declare type InfiniteTableColumnAlignFn<T> = (params: InfiniteTableColumnAlignFn
362
364
  declare type InfiniteTableColumnAlignFnParams<T> = XOR<{
363
365
  isHeader: true;
364
366
  column: InfiniteTableComputedColumn<T>;
365
- }, InfiniteTableColumnStyleFnParams<T> & {
367
+ }, InfiniteTableColumnStylingFnParams<T> & {
366
368
  isHeader: false;
367
369
  }>;
368
370
  declare type InfiniteTableColumnVerticalAlignFn<T> = (params: InfiniteTableColumnAlignFnParams<T>) => InfiniteTableColumnVerticalAlignValues;
@@ -819,7 +821,16 @@ declare class CellSelectionState {
819
821
  private setCellInDeselection;
820
822
  private setCellInSelection;
821
823
  update(stateObject: CellSelectionStateObject): void;
824
+ /**
825
+ * Returns whether there is at least one selected cell in the row
826
+ *
827
+ * @param rowId the row id
828
+ * @param columnIds the columns currently available in the grid
829
+ * @returns boolean
830
+ */
831
+ isCellSelectionInRow(rowId: any, columnIds: string[]): boolean;
822
832
  isCellSelected(rowId: any, colId: string): boolean;
833
+ private isCellSelected_Internal;
823
834
  getState(): CellSelectionStateObject;
824
835
  }
825
836
 
@@ -2027,6 +2038,7 @@ declare type InfiniteTable_RowInfoBase<_T> = {
2027
2038
  indexInAll: number;
2028
2039
  rowSelected: boolean | null;
2029
2040
  isCellSelected: (columnId: string) => boolean;
2041
+ hasSelectedCells: (columnIds: string[]) => boolean;
2030
2042
  };
2031
2043
  declare type InfiniteTable_HasGrouping_RowInfoNormal<T> = {
2032
2044
  dataSourceHasGrouping: true;
@@ -2407,7 +2419,7 @@ declare type MenuProps = {
2407
2419
  onHideIntent?: (state: MenuState) => void;
2408
2420
  bubbleActionsFromSubmenus?: boolean;
2409
2421
  addSubmenuColumnIfNeeded?: boolean;
2410
- onAction?: (key: string, item: MenuItemObject) => void;
2422
+ onAction?: (param: MenuItemActionContext) => void;
2411
2423
  parentMenuId?: string;
2412
2424
  parentMenuItemKey?: string;
2413
2425
  autoFocus?: boolean;
@@ -2461,11 +2473,14 @@ declare type InfiniteTablePropColumnOrder = InfiniteTablePropColumnOrderNormaliz
2461
2473
  declare type InfiniteTablePropColumnVisibility = Record<string, false>;
2462
2474
  declare type InfiniteTableColumnPinnedValues = false | 'start' | 'end';
2463
2475
  declare type InfiniteTablePropColumnPinning = Record<string, true | 'start' | 'end'>;
2464
- declare type InfiniteTableRowStyleFnParams<T> = {
2476
+ declare type InfiniteTableRowStylingFnParams<T> = {
2465
2477
  rowIndex: number;
2478
+ rowHasSelectedCells: boolean;
2479
+ visibleColumnIds: string[];
2480
+ allColumnIds: string[];
2466
2481
  } & InfiniteTableRowInfoDataDiscriminator<T>;
2467
- declare type InfiniteTableRowStyleFn<T> = (params: InfiniteTableRowStyleFnParams<T>) => undefined | React$1.CSSProperties;
2468
- declare type InfiniteTableRowClassNameFn<T> = (params: InfiniteTableRowStyleFnParams<T>) => string | undefined;
2482
+ declare type InfiniteTableRowStyleFn<T> = (params: InfiniteTableRowStylingFnParams<T>) => undefined | React$1.CSSProperties;
2483
+ declare type InfiniteTableRowClassNameFn<T> = (params: InfiniteTableRowStylingFnParams<T>) => string | undefined;
2469
2484
  declare type InfiniteTableCellClassNameFn<T> = InfiniteTableColumn<T>['className'];
2470
2485
  declare type InfiniteTablePropRowStyle<T> = React$1.CSSProperties | InfiniteTableRowStyleFn<T>;
2471
2486
  declare type InfiniteTablePropCellStyle<T> = InfiniteTableColumn<T>['style'];
@@ -2883,7 +2898,7 @@ interface InfiniteTableProps<T> {
2883
2898
  api: InfiniteTableApi<T>;
2884
2899
  dataSourceApi: DataSourceApi<T>;
2885
2900
  }) => void;
2886
- rowProps?: React$1.HTMLProps<HTMLDivElement> | ((rowArgs: InfiniteTableRowStyleFnParams<T>) => React$1.HTMLProps<HTMLDivElement>);
2901
+ rowProps?: React$1.HTMLProps<HTMLDivElement> | ((rowArgs: InfiniteTableRowStylingFnParams<T>) => React$1.HTMLProps<HTMLDivElement>);
2887
2902
  licenseKey?: string;
2888
2903
  scrollTopKey?: string | number;
2889
2904
  autoSizeColumnsKey?: InfiniteTablePropAutoSizeColumnsKey;
package/index.dev.js CHANGED
@@ -7520,7 +7520,7 @@ function getColumnValueToEdit(options) {
7520
7520
  }
7521
7521
  function getColumnRenderingParams(options) {
7522
7522
  var _a, _b;
7523
- const { column, context, rowInfo } = options;
7523
+ const { column, context, rowInfo, visibleColumnsIds } = options;
7524
7524
  const groupByColumnReference = getGroupByColumnReference({
7525
7525
  rowInfo,
7526
7526
  column,
@@ -7540,10 +7540,16 @@ function getColumnRenderingParams(options) {
7540
7540
  });
7541
7541
  const stylingParam = __spreadProps(__spreadValues({
7542
7542
  column: options.column,
7543
- inEdit
7543
+ inEdit,
7544
+ rowHasSelectedCells: false
7544
7545
  }, formattedValueContext), {
7545
7546
  editError: editingCell && editingCell.primaryKey === rowInfo.id && editingCell.columnId === column.id && !editingCell.active && editingCell.accepted instanceof Error ? editingCell.accepted : void 0
7546
7547
  });
7548
+ Object.defineProperty(stylingParam, "rowHasSelectedCells", {
7549
+ get() {
7550
+ return rowInfo.hasSelectedCells(visibleColumnsIds);
7551
+ }
7552
+ });
7547
7553
  const align2 = typeof column.align === "function" ? column.align(__spreadValues({ isHeader: false }, stylingParam)) : (_a = column.align) != null ? _a : "start";
7548
7554
  const verticalAlign = typeof column.verticalAlign === "function" ? column.verticalAlign(__spreadValues({ isHeader: false }, stylingParam)) : (_b = column.verticalAlign) != null ? _b : "center";
7549
7555
  return {
@@ -7573,6 +7579,7 @@ function getColumnRenderParam(options) {
7573
7579
  rowInfo,
7574
7580
  align: align2,
7575
7581
  verticalAlign,
7582
+ visibleColumnsIds,
7576
7583
  columnsMap,
7577
7584
  fieldsToColumn,
7578
7585
  formattedValueContext
@@ -7597,7 +7604,8 @@ function getColumnRenderParam(options) {
7597
7604
  fieldsToColumn,
7598
7605
  align: align2,
7599
7606
  verticalAlign,
7600
- cellSelected
7607
+ cellSelected,
7608
+ rowHasSelectedCells: false
7601
7609
  }, formattedValueContext), {
7602
7610
  editError: editingCell && editingCell.primaryKey === rowInfo.id && editingCell.columnId === column.id && !editingCell.active && editingCell.accepted instanceof Error ? editingCell.accepted : void 0,
7603
7611
  groupByColumn,
@@ -7662,6 +7670,11 @@ function getColumnRenderParam(options) {
7662
7670
  rootGroupBy: dataSourceState.groupBy,
7663
7671
  pivotBy: dataSourceState.pivotBy
7664
7672
  });
7673
+ Object.defineProperty(renderParam, "rowHasSelectedCells", {
7674
+ get() {
7675
+ return rowInfo.hasSelectedCells(visibleColumnsIds);
7676
+ }
7677
+ });
7665
7678
  return renderParam;
7666
7679
  }
7667
7680
  function getRawValueForCell(column, rowInfo) {
@@ -7937,10 +7950,12 @@ function InfiniteTableColumnCellFn(props) {
7937
7950
  api: imperativeApi,
7938
7951
  dataSourceApi
7939
7952
  };
7953
+ const visibleColumnsIds = computed.computedVisibleColumns.map((x) => x.id);
7940
7954
  const colRenderingParams = getColumnRenderingParams({
7941
7955
  column,
7942
7956
  rowInfo,
7943
7957
  columnsMap,
7958
+ visibleColumnsIds,
7944
7959
  fieldsToColumn,
7945
7960
  context: renderingContext
7946
7961
  });
@@ -8104,8 +8119,19 @@ function InfiniteTableColumnCellFn(props) {
8104
8119
  renderBag: true
8105
8120
  })
8106
8121
  ]);
8122
+ const visibleColumnIds = computed.computedVisibleColumns.map((x) => x.id);
8123
+ const allColumnIds = computed.computedColumnOrder;
8107
8124
  const rowPropsAndStyleArgs = __spreadProps(__spreadValues({}, formattedValueContext), {
8108
- rowIndex
8125
+ visibleColumnIds,
8126
+ allColumnIds,
8127
+ rowIndex,
8128
+ // we put it as false by default
8129
+ rowHasSelectedCells: false
8130
+ });
8131
+ Object.defineProperty(rowPropsAndStyleArgs, "rowHasSelectedCells", {
8132
+ get() {
8133
+ return rowInfo.hasSelectedCells(visibleColumnIds);
8134
+ }
8109
8135
  });
8110
8136
  const rowComputedClassName = typeof rowClassName === "function" ? rowClassName(rowPropsAndStyleArgs) : rowClassName;
8111
8137
  let colClassName = void 0;
@@ -10311,6 +10337,7 @@ function getEnhancedGroupData(options, deepMapValue) {
10311
10337
  collapsed: false,
10312
10338
  dataSourceHasGrouping: true,
10313
10339
  isCellSelected: returnFalse,
10340
+ hasSelectedCells: returnFalse,
10314
10341
  selfLoaded,
10315
10342
  error: options.error,
10316
10343
  parents,
@@ -10447,6 +10474,7 @@ function enhancedFlatten(param) {
10447
10474
  id: itemId,
10448
10475
  data: item,
10449
10476
  isCellSelected: returnFalse,
10477
+ hasSelectedCells: returnFalse,
10450
10478
  dataSourceHasGrouping: true,
10451
10479
  isGroupRow: false,
10452
10480
  selfLoaded: !!item,
@@ -11741,6 +11769,7 @@ function getRowSelectionApi(param) {
11741
11769
  }
11742
11770
 
11743
11771
  // src/components/DataSource/CellSelectionState.ts
11772
+ var debug4 = dbg("CellSelectionState");
11744
11773
  var WILDCARD = "*";
11745
11774
  var CellSelectionState = class {
11746
11775
  constructor(clone) {
@@ -11783,7 +11812,7 @@ var CellSelectionState = class {
11783
11812
  setCellSelected(rowId, colId, selected) {
11784
11813
  const wildcardRow = rowId === this.wildcard;
11785
11814
  const wildcardColumn = colId === this.wildcard;
11786
- const isSelected = this.isCellSelected(rowId, colId);
11815
+ const isSelected = this.isCellSelected_Internal(rowId, colId);
11787
11816
  if (isSelected === selected) {
11788
11817
  return;
11789
11818
  }
@@ -11961,7 +11990,54 @@ var CellSelectionState = class {
11961
11990
  }
11962
11991
  this.defaultSelection = stateObject.defaultSelection;
11963
11992
  }
11993
+ /**
11994
+ * Returns whether there is at least one selected cell in the row
11995
+ *
11996
+ * @param rowId the row id
11997
+ * @param columnIds the columns currently available in the grid
11998
+ * @returns boolean
11999
+ */
12000
+ isCellSelectionInRow(rowId, columnIds) {
12001
+ if (this.defaultSelection) {
12002
+ const cols2 = this.deselectedRowsToColumns.get(rowId);
12003
+ if (cols2) {
12004
+ if (cols2.has(this.wildcard)) {
12005
+ const explicitlySelectedCols = this.selectedRowsToColumns.get(rowId);
12006
+ return explicitlySelectedCols && explicitlySelectedCols.size > 0 ? columnIds.some((colId) => explicitlySelectedCols.has(colId)) : false;
12007
+ }
12008
+ return columnIds.some((colId) => !cols2.has(colId));
12009
+ }
12010
+ return true;
12011
+ }
12012
+ const cols = this.selectedRowsToColumns.get(rowId);
12013
+ if (cols) {
12014
+ if (cols.has(this.wildcard)) {
12015
+ const explicitlyDeselectedCols = this.deselectedRowsToColumns.get(rowId);
12016
+ if (explicitlyDeselectedCols && explicitlyDeselectedCols.size > 0) {
12017
+ const allDeselected = columnIds.every(
12018
+ (colId) => explicitlyDeselectedCols.has(colId)
12019
+ );
12020
+ return !allDeselected;
12021
+ }
12022
+ return true;
12023
+ }
12024
+ return columnIds ? columnIds.some((colId) => cols.has(colId)) : false;
12025
+ }
12026
+ return false;
12027
+ }
11964
12028
  isCellSelected(rowId, colId) {
12029
+ if (rowId === this.wildcard || colId === this.wildcard) {
12030
+ console.error(
12031
+ `CellSelectionState.isCellSelected should not be called with wildcard`
12032
+ );
12033
+ debug4(
12034
+ `CellSelectionState.isCellSelected should not be called with wildcard`
12035
+ );
12036
+ return false;
12037
+ }
12038
+ return this.isCellSelected_Internal(rowId, colId);
12039
+ }
12040
+ isCellSelected_Internal(rowId, colId) {
11965
12041
  var _a, _b;
11966
12042
  const cacheKey = [rowId, colId];
11967
12043
  const { cache } = this;
@@ -12609,7 +12685,8 @@ function toRowInfo(data, id, index, isRowSelected, cellSelectionState) {
12609
12685
  isGroupRow: false,
12610
12686
  selfLoaded: true,
12611
12687
  rowSelected: false,
12612
- isCellSelected: returnFalse2
12688
+ isCellSelected: returnFalse2,
12689
+ hasSelectedCells: returnFalse2
12613
12690
  };
12614
12691
  if (isRowSelected) {
12615
12692
  rowInfo.rowSelected = isRowSelected(rowInfo);
@@ -12618,6 +12695,9 @@ function toRowInfo(data, id, index, isRowSelected, cellSelectionState) {
12618
12695
  rowInfo.isCellSelected = (colId) => {
12619
12696
  return cellSelectionState.isCellSelected(rowInfo.id, colId);
12620
12697
  };
12698
+ rowInfo.hasSelectedCells = (columnIds) => {
12699
+ return cellSelectionState.isCellSelectionInRow(rowInfo.id, columnIds);
12700
+ };
12621
12701
  }
12622
12702
  return rowInfo;
12623
12703
  }
@@ -12748,6 +12828,7 @@ function concludeReducer(params) {
12748
12828
  const shouldGroup = groupBy.length > 0 || !!pivotBy;
12749
12829
  const selectionDepsChanged = haveDepsChanged(previousState, state, [
12750
12830
  "rowSelection",
12831
+ "cellSelection",
12751
12832
  "isRowSelected",
12752
12833
  "originalLazyGroupDataChangeDetect"
12753
12834
  ]);
@@ -15879,13 +15960,13 @@ function useColumnRowspan(computedVisibleColumns) {
15879
15960
 
15880
15961
  // src/components/InfiniteTable/hooks/useColumnSizeFn.ts
15881
15962
  var import_react42 = require("react");
15882
- var debug4 = dbg("useColumnSizeFn");
15963
+ var debug5 = dbg("useColumnSizeFn");
15883
15964
  function useColumnSizeFn(columns) {
15884
15965
  const columnSize = (0, import_react42.useCallback)(
15885
15966
  (index) => {
15886
15967
  const column = columns[index];
15887
15968
  if (false) {
15888
- debug4("cannot find column at index", index, columns);
15969
+ debug5("cannot find column at index", index, columns);
15889
15970
  }
15890
15971
  return column ? column.computedWidth : 0;
15891
15972
  },
@@ -17260,7 +17341,7 @@ var useLicense = (licenseKey = "") => {
17260
17341
  const valid = (0, import_react50.useMemo)(() => {
17261
17342
  let valid2 = isValidLicense(licenseKey, {
17262
17343
  publishedAt: 1624970570587,
17263
- version: "3.1.0"
17344
+ version: "3.1.1"
17264
17345
  });
17265
17346
  if (!licenseKey && !valid2 && isInsidePlayground) {
17266
17347
  return true;
@@ -19327,15 +19408,16 @@ function MenuComponent(props) {
19327
19408
  if (item.originalMenuItem.onClick) {
19328
19409
  item.originalMenuItem.onClick(event);
19329
19410
  }
19411
+ const onActionParam = {
19412
+ key: item.key,
19413
+ item: item.originalMenuItem,
19414
+ hideMenu: hideAll
19415
+ };
19330
19416
  if (item.originalMenuItem.onAction) {
19331
- item.originalMenuItem.onAction({
19332
- key: item.key,
19333
- item: item.originalMenuItem,
19334
- hideMenu: hideAll
19335
- });
19417
+ item.originalMenuItem.onAction(onActionParam);
19336
19418
  }
19337
19419
  if (onAction) {
19338
- onAction(item.key, item.originalMenuItem);
19420
+ onAction(onActionParam);
19339
19421
  }
19340
19422
  if (item.originalMenuItem.hideMenuOnAction) {
19341
19423
  hideAll();
package/index.dev.mjs CHANGED
@@ -7497,7 +7497,7 @@ function getColumnValueToEdit(options) {
7497
7497
  }
7498
7498
  function getColumnRenderingParams(options) {
7499
7499
  var _a, _b;
7500
- const { column, context, rowInfo } = options;
7500
+ const { column, context, rowInfo, visibleColumnsIds } = options;
7501
7501
  const groupByColumnReference = getGroupByColumnReference({
7502
7502
  rowInfo,
7503
7503
  column,
@@ -7517,10 +7517,16 @@ function getColumnRenderingParams(options) {
7517
7517
  });
7518
7518
  const stylingParam = __spreadProps(__spreadValues({
7519
7519
  column: options.column,
7520
- inEdit
7520
+ inEdit,
7521
+ rowHasSelectedCells: false
7521
7522
  }, formattedValueContext), {
7522
7523
  editError: editingCell && editingCell.primaryKey === rowInfo.id && editingCell.columnId === column.id && !editingCell.active && editingCell.accepted instanceof Error ? editingCell.accepted : void 0
7523
7524
  });
7525
+ Object.defineProperty(stylingParam, "rowHasSelectedCells", {
7526
+ get() {
7527
+ return rowInfo.hasSelectedCells(visibleColumnsIds);
7528
+ }
7529
+ });
7524
7530
  const align2 = typeof column.align === "function" ? column.align(__spreadValues({ isHeader: false }, stylingParam)) : (_a = column.align) != null ? _a : "start";
7525
7531
  const verticalAlign = typeof column.verticalAlign === "function" ? column.verticalAlign(__spreadValues({ isHeader: false }, stylingParam)) : (_b = column.verticalAlign) != null ? _b : "center";
7526
7532
  return {
@@ -7550,6 +7556,7 @@ function getColumnRenderParam(options) {
7550
7556
  rowInfo,
7551
7557
  align: align2,
7552
7558
  verticalAlign,
7559
+ visibleColumnsIds,
7553
7560
  columnsMap,
7554
7561
  fieldsToColumn,
7555
7562
  formattedValueContext
@@ -7574,7 +7581,8 @@ function getColumnRenderParam(options) {
7574
7581
  fieldsToColumn,
7575
7582
  align: align2,
7576
7583
  verticalAlign,
7577
- cellSelected
7584
+ cellSelected,
7585
+ rowHasSelectedCells: false
7578
7586
  }, formattedValueContext), {
7579
7587
  editError: editingCell && editingCell.primaryKey === rowInfo.id && editingCell.columnId === column.id && !editingCell.active && editingCell.accepted instanceof Error ? editingCell.accepted : void 0,
7580
7588
  groupByColumn,
@@ -7639,6 +7647,11 @@ function getColumnRenderParam(options) {
7639
7647
  rootGroupBy: dataSourceState.groupBy,
7640
7648
  pivotBy: dataSourceState.pivotBy
7641
7649
  });
7650
+ Object.defineProperty(renderParam, "rowHasSelectedCells", {
7651
+ get() {
7652
+ return rowInfo.hasSelectedCells(visibleColumnsIds);
7653
+ }
7654
+ });
7642
7655
  return renderParam;
7643
7656
  }
7644
7657
  function getRawValueForCell(column, rowInfo) {
@@ -7914,10 +7927,12 @@ function InfiniteTableColumnCellFn(props) {
7914
7927
  api: imperativeApi,
7915
7928
  dataSourceApi
7916
7929
  };
7930
+ const visibleColumnsIds = computed.computedVisibleColumns.map((x) => x.id);
7917
7931
  const colRenderingParams = getColumnRenderingParams({
7918
7932
  column,
7919
7933
  rowInfo,
7920
7934
  columnsMap,
7935
+ visibleColumnsIds,
7921
7936
  fieldsToColumn,
7922
7937
  context: renderingContext
7923
7938
  });
@@ -8081,8 +8096,19 @@ function InfiniteTableColumnCellFn(props) {
8081
8096
  renderBag: true
8082
8097
  })
8083
8098
  ]);
8099
+ const visibleColumnIds = computed.computedVisibleColumns.map((x) => x.id);
8100
+ const allColumnIds = computed.computedColumnOrder;
8084
8101
  const rowPropsAndStyleArgs = __spreadProps(__spreadValues({}, formattedValueContext), {
8085
- rowIndex
8102
+ visibleColumnIds,
8103
+ allColumnIds,
8104
+ rowIndex,
8105
+ // we put it as false by default
8106
+ rowHasSelectedCells: false
8107
+ });
8108
+ Object.defineProperty(rowPropsAndStyleArgs, "rowHasSelectedCells", {
8109
+ get() {
8110
+ return rowInfo.hasSelectedCells(visibleColumnIds);
8111
+ }
8086
8112
  });
8087
8113
  const rowComputedClassName = typeof rowClassName === "function" ? rowClassName(rowPropsAndStyleArgs) : rowClassName;
8088
8114
  let colClassName = void 0;
@@ -10288,6 +10314,7 @@ function getEnhancedGroupData(options, deepMapValue) {
10288
10314
  collapsed: false,
10289
10315
  dataSourceHasGrouping: true,
10290
10316
  isCellSelected: returnFalse,
10317
+ hasSelectedCells: returnFalse,
10291
10318
  selfLoaded,
10292
10319
  error: options.error,
10293
10320
  parents,
@@ -10424,6 +10451,7 @@ function enhancedFlatten(param) {
10424
10451
  id: itemId,
10425
10452
  data: item,
10426
10453
  isCellSelected: returnFalse,
10454
+ hasSelectedCells: returnFalse,
10427
10455
  dataSourceHasGrouping: true,
10428
10456
  isGroupRow: false,
10429
10457
  selfLoaded: !!item,
@@ -11718,6 +11746,7 @@ function getRowSelectionApi(param) {
11718
11746
  }
11719
11747
 
11720
11748
  // src/components/DataSource/CellSelectionState.ts
11749
+ var debug4 = dbg("CellSelectionState");
11721
11750
  var WILDCARD = "*";
11722
11751
  var CellSelectionState = class {
11723
11752
  constructor(clone) {
@@ -11760,7 +11789,7 @@ var CellSelectionState = class {
11760
11789
  setCellSelected(rowId, colId, selected) {
11761
11790
  const wildcardRow = rowId === this.wildcard;
11762
11791
  const wildcardColumn = colId === this.wildcard;
11763
- const isSelected = this.isCellSelected(rowId, colId);
11792
+ const isSelected = this.isCellSelected_Internal(rowId, colId);
11764
11793
  if (isSelected === selected) {
11765
11794
  return;
11766
11795
  }
@@ -11938,7 +11967,54 @@ var CellSelectionState = class {
11938
11967
  }
11939
11968
  this.defaultSelection = stateObject.defaultSelection;
11940
11969
  }
11970
+ /**
11971
+ * Returns whether there is at least one selected cell in the row
11972
+ *
11973
+ * @param rowId the row id
11974
+ * @param columnIds the columns currently available in the grid
11975
+ * @returns boolean
11976
+ */
11977
+ isCellSelectionInRow(rowId, columnIds) {
11978
+ if (this.defaultSelection) {
11979
+ const cols2 = this.deselectedRowsToColumns.get(rowId);
11980
+ if (cols2) {
11981
+ if (cols2.has(this.wildcard)) {
11982
+ const explicitlySelectedCols = this.selectedRowsToColumns.get(rowId);
11983
+ return explicitlySelectedCols && explicitlySelectedCols.size > 0 ? columnIds.some((colId) => explicitlySelectedCols.has(colId)) : false;
11984
+ }
11985
+ return columnIds.some((colId) => !cols2.has(colId));
11986
+ }
11987
+ return true;
11988
+ }
11989
+ const cols = this.selectedRowsToColumns.get(rowId);
11990
+ if (cols) {
11991
+ if (cols.has(this.wildcard)) {
11992
+ const explicitlyDeselectedCols = this.deselectedRowsToColumns.get(rowId);
11993
+ if (explicitlyDeselectedCols && explicitlyDeselectedCols.size > 0) {
11994
+ const allDeselected = columnIds.every(
11995
+ (colId) => explicitlyDeselectedCols.has(colId)
11996
+ );
11997
+ return !allDeselected;
11998
+ }
11999
+ return true;
12000
+ }
12001
+ return columnIds ? columnIds.some((colId) => cols.has(colId)) : false;
12002
+ }
12003
+ return false;
12004
+ }
11941
12005
  isCellSelected(rowId, colId) {
12006
+ if (rowId === this.wildcard || colId === this.wildcard) {
12007
+ console.error(
12008
+ `CellSelectionState.isCellSelected should not be called with wildcard`
12009
+ );
12010
+ debug4(
12011
+ `CellSelectionState.isCellSelected should not be called with wildcard`
12012
+ );
12013
+ return false;
12014
+ }
12015
+ return this.isCellSelected_Internal(rowId, colId);
12016
+ }
12017
+ isCellSelected_Internal(rowId, colId) {
11942
12018
  var _a, _b;
11943
12019
  const cacheKey = [rowId, colId];
11944
12020
  const { cache } = this;
@@ -12586,7 +12662,8 @@ function toRowInfo(data, id, index, isRowSelected, cellSelectionState) {
12586
12662
  isGroupRow: false,
12587
12663
  selfLoaded: true,
12588
12664
  rowSelected: false,
12589
- isCellSelected: returnFalse2
12665
+ isCellSelected: returnFalse2,
12666
+ hasSelectedCells: returnFalse2
12590
12667
  };
12591
12668
  if (isRowSelected) {
12592
12669
  rowInfo.rowSelected = isRowSelected(rowInfo);
@@ -12595,6 +12672,9 @@ function toRowInfo(data, id, index, isRowSelected, cellSelectionState) {
12595
12672
  rowInfo.isCellSelected = (colId) => {
12596
12673
  return cellSelectionState.isCellSelected(rowInfo.id, colId);
12597
12674
  };
12675
+ rowInfo.hasSelectedCells = (columnIds) => {
12676
+ return cellSelectionState.isCellSelectionInRow(rowInfo.id, columnIds);
12677
+ };
12598
12678
  }
12599
12679
  return rowInfo;
12600
12680
  }
@@ -12725,6 +12805,7 @@ function concludeReducer(params) {
12725
12805
  const shouldGroup = groupBy.length > 0 || !!pivotBy;
12726
12806
  const selectionDepsChanged = haveDepsChanged(previousState, state, [
12727
12807
  "rowSelection",
12808
+ "cellSelection",
12728
12809
  "isRowSelected",
12729
12810
  "originalLazyGroupDataChangeDetect"
12730
12811
  ]);
@@ -15860,13 +15941,13 @@ function useColumnRowspan(computedVisibleColumns) {
15860
15941
 
15861
15942
  // src/components/InfiniteTable/hooks/useColumnSizeFn.ts
15862
15943
  import { useCallback as useCallback20 } from "react";
15863
- var debug4 = dbg("useColumnSizeFn");
15944
+ var debug5 = dbg("useColumnSizeFn");
15864
15945
  function useColumnSizeFn(columns) {
15865
15946
  const columnSize = useCallback20(
15866
15947
  (index) => {
15867
15948
  const column = columns[index];
15868
15949
  if (false) {
15869
- debug4("cannot find column at index", index, columns);
15950
+ debug5("cannot find column at index", index, columns);
15870
15951
  }
15871
15952
  return column ? column.computedWidth : 0;
15872
15953
  },
@@ -17241,7 +17322,7 @@ var useLicense = (licenseKey = "") => {
17241
17322
  const valid = useMemo11(() => {
17242
17323
  let valid2 = isValidLicense(licenseKey, {
17243
17324
  publishedAt: 1624970570587,
17244
- version: "3.1.0"
17325
+ version: "3.1.1"
17245
17326
  });
17246
17327
  if (!licenseKey && !valid2 && isInsidePlayground) {
17247
17328
  return true;
@@ -19318,15 +19399,16 @@ function MenuComponent(props) {
19318
19399
  if (item.originalMenuItem.onClick) {
19319
19400
  item.originalMenuItem.onClick(event);
19320
19401
  }
19402
+ const onActionParam = {
19403
+ key: item.key,
19404
+ item: item.originalMenuItem,
19405
+ hideMenu: hideAll
19406
+ };
19321
19407
  if (item.originalMenuItem.onAction) {
19322
- item.originalMenuItem.onAction({
19323
- key: item.key,
19324
- item: item.originalMenuItem,
19325
- hideMenu: hideAll
19326
- });
19408
+ item.originalMenuItem.onAction(onActionParam);
19327
19409
  }
19328
19410
  if (onAction) {
19329
- onAction(item.key, item.originalMenuItem);
19411
+ onAction(onActionParam);
19330
19412
  }
19331
19413
  if (item.originalMenuItem.hideMenuOnAction) {
19332
19414
  hideAll();