@infinite-table/infinite-react 0.4.5 → 0.4.6

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 (3) hide show
  1. package/index.esm.js +13 -7
  2. package/index.js +13 -7
  3. package/package.json +2 -2
package/index.esm.js CHANGED
@@ -9582,7 +9582,7 @@ function getLivePaginationCursorValue(livePaginationCursorProp, state) {
9582
9582
  return livePaginationCursor;
9583
9583
  }
9584
9584
  function mapPropsToState(params) {
9585
- var _a, _b;
9585
+ var _a;
9586
9586
  const { props, state, oldState } = params;
9587
9587
  const controlledSort = isControlledValue(props.sortInfo);
9588
9588
  const controlledFilter = isControlledValue(props.filterValue);
@@ -9601,7 +9601,7 @@ function mapPropsToState(params) {
9601
9601
  if (props.cellSelection !== void 0 || props.defaultCellSelection !== void 0) {
9602
9602
  selectionMode = "multi-cell";
9603
9603
  } else {
9604
- const rowSelectionProp = (_a = props.rowSelection) != null ? _a : props.defaultRowSelection;
9604
+ const rowSelectionProp = props.rowSelection !== void 0 ? props.rowSelection : props.defaultRowSelection;
9605
9605
  if (rowSelectionProp !== void 0) {
9606
9606
  if (rowSelectionProp && typeof rowSelectionProp === "object") {
9607
9607
  selectionMode = "multi-row";
@@ -9636,7 +9636,7 @@ function mapPropsToState(params) {
9636
9636
  operatorsByFilterType,
9637
9637
  controlledSort,
9638
9638
  controlledFilter,
9639
- filterMode: ((_b = props.filterMode) != null ? _b : props.filterFunction != null) ? "local" : typeof props.data === "function" ? "remote" : "local",
9639
+ filterMode: ((_a = props.filterMode) != null ? _a : props.filterFunction != null) ? "local" : typeof props.data === "function" ? "remote" : "local",
9640
9640
  multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo),
9641
9641
  lazyLoadBatchSize: typeof props.lazyLoad === "object" ? props.lazyLoad.batchSize : void 0
9642
9642
  };
@@ -12374,7 +12374,7 @@ var useLicense = (licenseKey = "") => {
12374
12374
  const valid = useMemo11(() => {
12375
12375
  let valid2 = isValidLicense(licenseKey, {
12376
12376
  publishedAt: 1624970570587,
12377
- version: "0.4.5"
12377
+ version: "0.4.6"
12378
12378
  });
12379
12379
  if (!licenseKey && !valid2 && isInsidePlayground) {
12380
12380
  return true;
@@ -12709,11 +12709,10 @@ function onCellClick(context, event) {
12709
12709
  updateRowSelectionOnCellClick(context, event);
12710
12710
  }
12711
12711
  function updateRowSelectionOnCellClick(context, event) {
12712
- const { rowIndex, getDataSourceState, getComputed, dataSourceActions } = context;
12712
+ const { rowIndex, getDataSourceState, getComputed, dataSourceActions, api } = context;
12713
12713
  const { multiRowSelector, renderSelectionCheckBox } = getComputed();
12714
12714
  const dataSourceState = getDataSourceState();
12715
- const { selectionMode, groupBy } = dataSourceState;
12716
- let { rowSelection: rowSelectionState } = dataSourceState;
12715
+ const { selectionMode, groupBy, dataArray } = dataSourceState;
12717
12716
  if (groupBy.length) {
12718
12717
  return false;
12719
12718
  }
@@ -12721,6 +12720,7 @@ function updateRowSelectionOnCellClick(context, event) {
12721
12720
  if (renderSelectionCheckBox && !event.key) {
12722
12721
  return false;
12723
12722
  }
12723
+ let { rowSelection: rowSelectionState } = dataSourceState;
12724
12724
  rowSelectionState = new RowSelectionState(rowSelectionState, rowSelectionStateConfigGetter(getDataSourceState));
12725
12725
  multiRowSelector.rowSelectionState = rowSelectionState;
12726
12726
  if (rowSelectionState && typeof rowSelectionState === "object") {
@@ -12735,6 +12735,12 @@ function updateRowSelectionOnCellClick(context, event) {
12735
12735
  return true;
12736
12736
  }
12737
12737
  } else if (selectionMode === "single-row") {
12738
+ const id = dataArray[rowIndex].id;
12739
+ if (event.metaKey || event.ctrlKey) {
12740
+ api.selectionApi.toggleRowSelection(id);
12741
+ } else {
12742
+ api.selectionApi.selectRow(id);
12743
+ }
12738
12744
  }
12739
12745
  return false;
12740
12746
  }
package/index.js CHANGED
@@ -9489,7 +9489,7 @@ function getLivePaginationCursorValue(livePaginationCursorProp, state) {
9489
9489
  return livePaginationCursor;
9490
9490
  }
9491
9491
  function mapPropsToState(params) {
9492
- var _a, _b;
9492
+ var _a;
9493
9493
  const { props, state, oldState } = params;
9494
9494
  const controlledSort = isControlledValue(props.sortInfo);
9495
9495
  const controlledFilter = isControlledValue(props.filterValue);
@@ -9508,7 +9508,7 @@ function mapPropsToState(params) {
9508
9508
  if (props.cellSelection !== void 0 || props.defaultCellSelection !== void 0) {
9509
9509
  selectionMode = "multi-cell";
9510
9510
  } else {
9511
- const rowSelectionProp = (_a = props.rowSelection) != null ? _a : props.defaultRowSelection;
9511
+ const rowSelectionProp = props.rowSelection !== void 0 ? props.rowSelection : props.defaultRowSelection;
9512
9512
  if (rowSelectionProp !== void 0) {
9513
9513
  if (rowSelectionProp && typeof rowSelectionProp === "object") {
9514
9514
  selectionMode = "multi-row";
@@ -9543,7 +9543,7 @@ function mapPropsToState(params) {
9543
9543
  operatorsByFilterType,
9544
9544
  controlledSort,
9545
9545
  controlledFilter,
9546
- filterMode: ((_b = props.filterMode) != null ? _b : props.filterFunction != null) ? "local" : typeof props.data === "function" ? "remote" : "local",
9546
+ filterMode: ((_a = props.filterMode) != null ? _a : props.filterFunction != null) ? "local" : typeof props.data === "function" ? "remote" : "local",
9547
9547
  multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo),
9548
9548
  lazyLoadBatchSize: typeof props.lazyLoad === "object" ? props.lazyLoad.batchSize : void 0
9549
9549
  };
@@ -12275,7 +12275,7 @@ var useLicense = (licenseKey = "") => {
12275
12275
  const valid = (0, import_react44.useMemo)(() => {
12276
12276
  let valid2 = isValidLicense(licenseKey, {
12277
12277
  publishedAt: 1624970570587,
12278
- version: "0.4.5"
12278
+ version: "0.4.6"
12279
12279
  });
12280
12280
  if (!licenseKey && !valid2 && isInsidePlayground) {
12281
12281
  return true;
@@ -12610,11 +12610,10 @@ function onCellClick(context, event) {
12610
12610
  updateRowSelectionOnCellClick(context, event);
12611
12611
  }
12612
12612
  function updateRowSelectionOnCellClick(context, event) {
12613
- const { rowIndex, getDataSourceState, getComputed, dataSourceActions } = context;
12613
+ const { rowIndex, getDataSourceState, getComputed, dataSourceActions, api } = context;
12614
12614
  const { multiRowSelector, renderSelectionCheckBox } = getComputed();
12615
12615
  const dataSourceState = getDataSourceState();
12616
- const { selectionMode, groupBy } = dataSourceState;
12617
- let { rowSelection: rowSelectionState } = dataSourceState;
12616
+ const { selectionMode, groupBy, dataArray } = dataSourceState;
12618
12617
  if (groupBy.length) {
12619
12618
  return false;
12620
12619
  }
@@ -12622,6 +12621,7 @@ function updateRowSelectionOnCellClick(context, event) {
12622
12621
  if (renderSelectionCheckBox && !event.key) {
12623
12622
  return false;
12624
12623
  }
12624
+ let { rowSelection: rowSelectionState } = dataSourceState;
12625
12625
  rowSelectionState = new RowSelectionState(rowSelectionState, rowSelectionStateConfigGetter(getDataSourceState));
12626
12626
  multiRowSelector.rowSelectionState = rowSelectionState;
12627
12627
  if (rowSelectionState && typeof rowSelectionState === "object") {
@@ -12636,6 +12636,12 @@ function updateRowSelectionOnCellClick(context, event) {
12636
12636
  return true;
12637
12637
  }
12638
12638
  } else if (selectionMode === "single-row") {
12639
+ const id = dataArray[rowIndex].id;
12640
+ if (event.metaKey || event.ctrlKey) {
12641
+ api.selectionApi.toggleRowSelection(id);
12642
+ } else {
12643
+ api.selectionApi.selectRow(id);
12644
+ }
12639
12645
  }
12640
12646
  return false;
12641
12647
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@infinite-table/infinite-react",
3
3
  "description": "Infinite Table for React",
4
- "version": "0.4.5",
4
+ "version": "0.4.6",
5
5
  "main": "index.js",
6
6
  "module": "index.esm.js",
7
7
  "typings": "index.d.ts",
@@ -14,5 +14,5 @@
14
14
  },
15
15
  "license": "Commercial & Open Source",
16
16
  "//": "will be updated at build time",
17
- "publishedAt": 1660890090935
17
+ "publishedAt": 1660896701925
18
18
  }