@infinite-table/infinite-react 0.3.0 → 0.3.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
@@ -507,7 +507,6 @@ declare type InfiniteTablePropColumnPinningRecord = Record<string, true | 'start
507
507
  declare type InfiniteTablePropColumnPinning = InfiniteTablePropColumnPinningRecord | InfiniteTablePropColumnPinningMap;
508
508
  declare type InfiniteTableRowStyleFnParams<T> = {
509
509
  rowIndex: number;
510
- groupBy?: (keyof T)[];
511
510
  } & InfiniteTableRowInfoDataDiscriminator<T>;
512
511
  declare type InfiniteTableRowStyleFn<T> = (params: InfiniteTableRowStyleFnParams<T>) => undefined | React$1.CSSProperties;
513
512
  declare type InfiniteTableRowClassNameFn<T> = (params: InfiniteTableRowStyleFnParams<T>) => string | undefined;
@@ -974,7 +973,6 @@ declare type InfiniteTable_RowInfoBase<_T> = {
974
973
  id: any;
975
974
  value?: any;
976
975
  indexInAll: number;
977
- indexInGroup: number;
978
976
  };
979
977
  declare type InfiniteTable_HasGrouping_RowInfoNormal<T> = {
980
978
  dataSourceHasGrouping: true;
@@ -1024,7 +1022,7 @@ declare type InfiniteTable_HasGrouping_RowInfoGroup<T> = {
1024
1022
  * For lazy/batched grouping, this is true if the group has been expanded at least once (and if the remote call has been configured with cache: true),
1025
1023
  * since if the remote call is not cached, collapsing the row group should lose all the data that was loaded for it, and it's as if it was never loaded, so in that case, childrenAvailable is false.
1026
1024
  *
1027
- * NOTE: if this is true, it doesn't mean that (all or some of) the children have been loaded, it only means that at least some children have been requested.
1025
+ * NOTE: if this is true, it doesn't mean that all the children have been loaded, it only means that some children have been loaded and are available
1028
1026
  *
1029
1027
  * Use directChildrenCount and directChildrenLoadedCount to know if all the children have been loaded or not.
1030
1028
  */
@@ -1047,6 +1045,7 @@ declare type InfiniteTable_NoGrouping_RowInfoNormal<T> = {
1047
1045
  selfLoaded: boolean;
1048
1046
  } & InfiniteTable_RowInfoBase<T>;
1049
1047
  declare type InfiniteTable_HasGrouping_RowInfoBase<T> = {
1048
+ indexInGroup: number;
1050
1049
  /**
1051
1050
  * Available on all rowInfo objects when the datasource is grouped, otherwise, it will be undefined.
1052
1051
  *
package/index.esm.js CHANGED
@@ -4519,6 +4519,8 @@ function InfiniteTableColumnCellFn(props) {
4519
4519
  var _a;
4520
4520
  const {
4521
4521
  rowInfo,
4522
+ rowStyle,
4523
+ rowClassName,
4522
4524
  width,
4523
4525
  column,
4524
4526
  onMouseLeave,
@@ -4555,24 +4557,25 @@ function InfiniteTableColumnCellFn(props) {
4555
4557
  const { componentState: computedDataSource } = useDataSourceContextValue();
4556
4558
  const rest = rowInfo.isGroupRow ? {
4557
4559
  rowInfo,
4560
+ isGroupRow: rowInfo.isGroupRow,
4558
4561
  data: rowInfo.data
4559
4562
  } : {
4560
4563
  rowInfo,
4564
+ isGroupRow: rowInfo.isGroupRow,
4561
4565
  data: rowInfo.data
4562
4566
  };
4563
4567
  const stylingRenderParam = __spreadValues({
4564
4568
  value,
4565
- column,
4566
- isGroupRow
4569
+ column
4567
4570
  }, rest);
4568
4571
  const renderValue = value;
4569
4572
  const renderParam = __spreadProps(__spreadValues({
4570
4573
  value,
4571
4574
  column,
4572
4575
  domRef,
4573
- groupRowInfo,
4574
- isGroupRow
4576
+ groupRowInfo
4575
4577
  }, rest), {
4578
+ isGroupRow,
4576
4579
  rowIndex,
4577
4580
  toggleGroupRow,
4578
4581
  toggleCurrentGroupRow: () => {
@@ -4597,8 +4600,16 @@ function InfiniteTableColumnCellFn(props) {
4597
4600
  }
4598
4601
  return renderValue;
4599
4602
  };
4603
+ const rowPropsAndStyleArgs = __spreadProps(__spreadValues({}, rest), {
4604
+ rowIndex
4605
+ });
4606
+ const rowComputedClassName = typeof rowClassName === "function" ? rowClassName(rowPropsAndStyleArgs) : rowClassName;
4600
4607
  const colClassName = column.className ? typeof column.className === "function" ? column.className(stylingRenderParam) : column.className : void 0;
4601
- const style = column.style ? typeof column.style === "function" ? column.style(stylingRenderParam) || {} : __spreadValues({}, column.style) : {};
4608
+ let style;
4609
+ if (rowStyle) {
4610
+ style = typeof rowStyle === "function" ? __spreadValues(__spreadValues({}, style), rowStyle(rowPropsAndStyleArgs)) : __spreadValues(__spreadValues({}, style), rowStyle);
4611
+ }
4612
+ style = column.style ? typeof column.style === "function" ? __spreadValues(__spreadValues({}, style), column.style(stylingRenderParam) || {}) : __spreadValues(__spreadValues({}, style), column.style) : style || {};
4602
4613
  style.width = width;
4603
4614
  style.height = rowHeight;
4604
4615
  const odd = (rowInfo.indexInAll != null ? rowInfo.indexInAll : rowIndex) % 2 === 1;
@@ -4614,7 +4625,7 @@ function InfiniteTableColumnCellFn(props) {
4614
4625
  onMouseLeave,
4615
4626
  onMouseEnter,
4616
4627
  cssEllipsis: (_a = column.cssEllipsis) != null ? _a : true,
4617
- className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false, zebra }), colClassName),
4628
+ className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false, zebra }), colClassName, rowComputedClassName),
4618
4629
  renderChildren
4619
4630
  };
4620
4631
  const ContextProvider = InfiniteTableColumnCellContext.Provider;
@@ -4851,6 +4862,8 @@ function useCellRendering(param) {
4851
4862
  groupRenderStrategy,
4852
4863
  brain,
4853
4864
  showZebraRows,
4865
+ rowStyle,
4866
+ rowClassName,
4854
4867
  onScrollToTop,
4855
4868
  onScrollToBottom,
4856
4869
  scrollToBottomOffset
@@ -4945,7 +4958,9 @@ function useCellRendering(param) {
4945
4958
  onMouseLeave,
4946
4959
  domRef,
4947
4960
  width,
4948
- column
4961
+ column,
4962
+ rowStyle,
4963
+ rowClassName
4949
4964
  };
4950
4965
  return /* @__PURE__ */ React22.createElement(InfiniteTableColumnCell, __spreadValues({}, cellProps));
4951
4966
  }, [
@@ -4955,7 +4970,9 @@ function useCellRendering(param) {
4955
4970
  groupRenderStrategy,
4956
4971
  toggleGroupRow,
4957
4972
  showZebraRows,
4958
- repaintId
4973
+ repaintId,
4974
+ rowStyle,
4975
+ rowClassName
4959
4976
  ]);
4960
4977
  return {
4961
4978
  renderCell
@@ -6355,7 +6372,7 @@ function lazyLoadRange(options, cache) {
6355
6372
  theGroupKeys.pop();
6356
6373
  }
6357
6374
  const cacheKeys = theGroupKeys.length ? theGroupKeys : rootGroupKeys;
6358
- const indexInGroup = rowInfo.indexInGroup;
6375
+ const indexInGroup = rowInfo.isGroupRow ? rowInfo.indexInGroup : rowInfo.indexInAll;
6359
6376
  if (rowInfo.isGroupRow && !rowInfo.collapsed && !rowInfo.childrenAvailable) {
6360
6377
  const currentFnCall = {
6361
6378
  lazyLoadStartIndex: 0,
@@ -6378,7 +6395,7 @@ function lazyLoadRange(options, cache) {
6378
6395
  if (!rowLoaded) {
6379
6396
  let cachedFnCalls = perGroupFnCalls.get(cacheKeys);
6380
6397
  const batchStartIndexInGroup = Math.floor(indexInGroup / lazyLoadBatchSize) * lazyLoadBatchSize;
6381
- const offset = rowInfo.indexInGroup - batchStartIndexInGroup;
6398
+ const offset = (rowInfo.isGroupRow ? rowInfo.indexInGroup : rowInfo.indexInAll) - batchStartIndexInGroup;
6382
6399
  const absoluteIndexOfBatchStart = dataArray[rowInfo.indexInAll - offset].indexInAll;
6383
6400
  const batchStartRowLoaded = isRowLoaded(absoluteIndexOfBatchStart);
6384
6401
  const batchStartRowId = dataArray[absoluteIndexOfBatchStart].id;
@@ -6978,7 +6995,6 @@ function toRowInfo(data, id, index) {
6978
6995
  data,
6979
6996
  id,
6980
6997
  indexInAll: index,
6981
- indexInGroup: index,
6982
6998
  isGroupRow: false,
6983
6999
  selfLoaded: true
6984
7000
  };
@@ -8516,7 +8532,7 @@ var useLicense = (licenseKey = "") => {
8516
8532
  const valid = useMemo10(() => {
8517
8533
  let valid2 = isValidLicense(licenseKey, {
8518
8534
  publishedAt: 1624970570587,
8519
- version: "0.3.0"
8535
+ version: "0.3.1"
8520
8536
  });
8521
8537
  if (!licenseKey && !valid2 && isInsidePlayground) {
8522
8538
  return true;
package/index.js CHANGED
@@ -4460,6 +4460,8 @@ function InfiniteTableColumnCellFn(props) {
4460
4460
  var _a;
4461
4461
  const {
4462
4462
  rowInfo,
4463
+ rowStyle,
4464
+ rowClassName,
4463
4465
  width,
4464
4466
  column,
4465
4467
  onMouseLeave,
@@ -4496,24 +4498,25 @@ function InfiniteTableColumnCellFn(props) {
4496
4498
  const { componentState: computedDataSource } = useDataSourceContextValue();
4497
4499
  const rest = rowInfo.isGroupRow ? {
4498
4500
  rowInfo,
4501
+ isGroupRow: rowInfo.isGroupRow,
4499
4502
  data: rowInfo.data
4500
4503
  } : {
4501
4504
  rowInfo,
4505
+ isGroupRow: rowInfo.isGroupRow,
4502
4506
  data: rowInfo.data
4503
4507
  };
4504
4508
  const stylingRenderParam = __spreadValues({
4505
4509
  value,
4506
- column,
4507
- isGroupRow
4510
+ column
4508
4511
  }, rest);
4509
4512
  const renderValue = value;
4510
4513
  const renderParam = __spreadProps(__spreadValues({
4511
4514
  value,
4512
4515
  column,
4513
4516
  domRef,
4514
- groupRowInfo,
4515
- isGroupRow
4517
+ groupRowInfo
4516
4518
  }, rest), {
4519
+ isGroupRow,
4517
4520
  rowIndex,
4518
4521
  toggleGroupRow,
4519
4522
  toggleCurrentGroupRow: () => {
@@ -4538,8 +4541,16 @@ function InfiniteTableColumnCellFn(props) {
4538
4541
  }
4539
4542
  return renderValue;
4540
4543
  };
4544
+ const rowPropsAndStyleArgs = __spreadProps(__spreadValues({}, rest), {
4545
+ rowIndex
4546
+ });
4547
+ const rowComputedClassName = typeof rowClassName === "function" ? rowClassName(rowPropsAndStyleArgs) : rowClassName;
4541
4548
  const colClassName = column.className ? typeof column.className === "function" ? column.className(stylingRenderParam) : column.className : void 0;
4542
- const style = column.style ? typeof column.style === "function" ? column.style(stylingRenderParam) || {} : __spreadValues({}, column.style) : {};
4549
+ let style;
4550
+ if (rowStyle) {
4551
+ style = typeof rowStyle === "function" ? __spreadValues(__spreadValues({}, style), rowStyle(rowPropsAndStyleArgs)) : __spreadValues(__spreadValues({}, style), rowStyle);
4552
+ }
4553
+ style = column.style ? typeof column.style === "function" ? __spreadValues(__spreadValues({}, style), column.style(stylingRenderParam) || {}) : __spreadValues(__spreadValues({}, style), column.style) : style || {};
4543
4554
  style.width = width;
4544
4555
  style.height = rowHeight;
4545
4556
  const odd = (rowInfo.indexInAll != null ? rowInfo.indexInAll : rowIndex) % 2 === 1;
@@ -4555,7 +4566,7 @@ function InfiniteTableColumnCellFn(props) {
4555
4566
  onMouseLeave,
4556
4567
  onMouseEnter,
4557
4568
  cssEllipsis: (_a = column.cssEllipsis) != null ? _a : true,
4558
- className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false, zebra }), colClassName),
4569
+ className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false, zebra }), colClassName, rowComputedClassName),
4559
4570
  renderChildren
4560
4571
  };
4561
4572
  const ContextProvider = InfiniteTableColumnCellContext.Provider;
@@ -4785,6 +4796,8 @@ function useCellRendering(param) {
4785
4796
  groupRenderStrategy,
4786
4797
  brain,
4787
4798
  showZebraRows,
4799
+ rowStyle,
4800
+ rowClassName,
4788
4801
  onScrollToTop,
4789
4802
  onScrollToBottom,
4790
4803
  scrollToBottomOffset
@@ -4879,7 +4892,9 @@ function useCellRendering(param) {
4879
4892
  onMouseLeave,
4880
4893
  domRef,
4881
4894
  width,
4882
- column
4895
+ column,
4896
+ rowStyle,
4897
+ rowClassName
4883
4898
  };
4884
4899
  return /* @__PURE__ */ import_react24.default.createElement(InfiniteTableColumnCell, __spreadValues({}, cellProps));
4885
4900
  }, [
@@ -4889,7 +4904,9 @@ function useCellRendering(param) {
4889
4904
  groupRenderStrategy,
4890
4905
  toggleGroupRow,
4891
4906
  showZebraRows,
4892
- repaintId
4907
+ repaintId,
4908
+ rowStyle,
4909
+ rowClassName
4893
4910
  ]);
4894
4911
  return {
4895
4912
  renderCell
@@ -6279,7 +6296,7 @@ function lazyLoadRange(options, cache) {
6279
6296
  theGroupKeys.pop();
6280
6297
  }
6281
6298
  const cacheKeys = theGroupKeys.length ? theGroupKeys : rootGroupKeys;
6282
- const indexInGroup = rowInfo.indexInGroup;
6299
+ const indexInGroup = rowInfo.isGroupRow ? rowInfo.indexInGroup : rowInfo.indexInAll;
6283
6300
  if (rowInfo.isGroupRow && !rowInfo.collapsed && !rowInfo.childrenAvailable) {
6284
6301
  const currentFnCall = {
6285
6302
  lazyLoadStartIndex: 0,
@@ -6302,7 +6319,7 @@ function lazyLoadRange(options, cache) {
6302
6319
  if (!rowLoaded) {
6303
6320
  let cachedFnCalls = perGroupFnCalls.get(cacheKeys);
6304
6321
  const batchStartIndexInGroup = Math.floor(indexInGroup / lazyLoadBatchSize) * lazyLoadBatchSize;
6305
- const offset = rowInfo.indexInGroup - batchStartIndexInGroup;
6322
+ const offset = (rowInfo.isGroupRow ? rowInfo.indexInGroup : rowInfo.indexInAll) - batchStartIndexInGroup;
6306
6323
  const absoluteIndexOfBatchStart = dataArray[rowInfo.indexInAll - offset].indexInAll;
6307
6324
  const batchStartRowLoaded = isRowLoaded(absoluteIndexOfBatchStart);
6308
6325
  const batchStartRowId = dataArray[absoluteIndexOfBatchStart].id;
@@ -6902,7 +6919,6 @@ function toRowInfo(data, id, index) {
6902
6919
  data,
6903
6920
  id,
6904
6921
  indexInAll: index,
6905
- indexInGroup: index,
6906
6922
  isGroupRow: false,
6907
6923
  selfLoaded: true
6908
6924
  };
@@ -8440,7 +8456,7 @@ var useLicense = (licenseKey = "") => {
8440
8456
  const valid = (0, import_react39.useMemo)(() => {
8441
8457
  let valid2 = isValidLicense(licenseKey, {
8442
8458
  publishedAt: 1624970570587,
8443
- version: "0.3.0"
8459
+ version: "0.3.1"
8444
8460
  });
8445
8461
  if (!licenseKey && !valid2 && isInsidePlayground) {
8446
8462
  return true;
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.3.0",
4
+ "version": "0.3.1",
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": 1651570757283
17
+ "publishedAt": 1651578366058
18
18
  }