@infinite-table/infinite-react 0.0.1-canary.11 → 0.0.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.esm.js CHANGED
@@ -630,6 +630,41 @@ function isControlled(propName, props) {
630
630
  return controlled;
631
631
  }
632
632
 
633
+ // src/components/VirtualBrain/ScrollListener.ts
634
+ var initialScrollPosition = {
635
+ scrollLeft: 0,
636
+ scrollTop: 0
637
+ };
638
+ var ScrollListener = class {
639
+ constructor() {
640
+ this.scrollPosition = initialScrollPosition;
641
+ this.onScrollFns = [];
642
+ this.getScrollPosition = () => {
643
+ return this.scrollPosition;
644
+ };
645
+ this.onScroll = (fn) => {
646
+ this.onScrollFns.push(fn);
647
+ return () => {
648
+ this.onScrollFns = this.onScrollFns.filter((f) => f !== fn);
649
+ };
650
+ };
651
+ this.setScrollPosition = (scrollPosition) => {
652
+ this.scrollPosition = scrollPosition;
653
+ this.notifyScrollChange();
654
+ };
655
+ this.destroy = () => {
656
+ this.onScrollFns = [];
657
+ };
658
+ }
659
+ notifyScrollChange() {
660
+ const { scrollPosition } = this;
661
+ const fns = this.onScrollFns;
662
+ for (let i = 0, len = fns.length; i < len; i++) {
663
+ fns[i](scrollPosition);
664
+ }
665
+ }
666
+ };
667
+
633
668
  // src/components/InfiniteTable/state/computeColumnGroupsDepths.ts
634
669
  function computeColumnGroupsDepths(columnGroups) {
635
670
  const map = new Map();
@@ -687,6 +722,8 @@ function getInitialState(params) {
687
722
  generatedColumns,
688
723
  columnOrder: (_c = isControlled("columnOrder", props) ? props.columnOrder : props.defaultColumnOrder) != null ? _c : true,
689
724
  computedColumnGroups,
725
+ pinnedStartScrollListener: new ScrollListener(),
726
+ pinnedEndScrollListener: new ScrollListener(),
690
727
  columnGroups,
691
728
  collapsedColumnGroups,
692
729
  columnGroupsDepthsMap,
@@ -718,6 +755,8 @@ function deriveReadOnlyState(params) {
718
755
  rowStyle: props.rowStyle,
719
756
  rowProps: props.rowProps,
720
757
  rowClassName: props.rowClassName,
758
+ pinnedStartMaxWidth: props.pinnedStartMaxWidth,
759
+ pinnedEndMaxWidth: props.pinnedEndMaxWidth,
721
760
  groupRenderStrategy: (_e = props.groupRenderStrategy) != null ? _e : "multi-column",
722
761
  pivotTotalColumnPosition,
723
762
  columnMinWidth: (_f = props.columnMinWidth) != null ? _f : 30,
@@ -1019,6 +1058,8 @@ var getComputedVisibleColumns = ({
1019
1058
  columnMinWidth,
1020
1059
  columnMaxWidth,
1021
1060
  columnDefaultWidth,
1061
+ pinnedStartMaxWidth,
1062
+ pinnedEndMaxWidth,
1022
1063
  sortable,
1023
1064
  sortInfo,
1024
1065
  setSortInfo,
@@ -1200,6 +1241,8 @@ var getComputedVisibleColumns = ({
1200
1241
  }
1201
1242
  prevPinned = computedPinned;
1202
1243
  });
1244
+ const computedPinnedStartWidth = pinnedStartMaxWidth != null ? Math.min(pinnedStartMaxWidth, computedPinnedStartColumnsWidth) : computedPinnedStartColumnsWidth;
1245
+ const computedPinnedEndWidth = pinnedEndMaxWidth != null ? Math.min(pinnedEndMaxWidth, computedPinnedEndColumnsWidth) : computedPinnedEndColumnsWidth;
1203
1246
  const result = {
1204
1247
  computedRemainingSpace: bodySize.width - (totalPinnedStartWidth + totalPinnedEndWidth + totalUnpinnedWidth),
1205
1248
  computedPinnedStartColumnsWidth,
@@ -1212,7 +1255,9 @@ var getComputedVisibleColumns = ({
1212
1255
  computedPinnedEndOffset: computedPinnedStartColumnsWidth + computedUnpinnedColumnsWidth,
1213
1256
  computedUnpinnedColumns,
1214
1257
  computedVisibleColumns,
1215
- computedVisibleColumnsMap
1258
+ computedVisibleColumnsMap,
1259
+ computedPinnedEndWidth,
1260
+ computedPinnedStartWidth
1216
1261
  };
1217
1262
  return result;
1218
1263
  };
@@ -1318,6 +1363,8 @@ var useComputedVisibleColumns = ({
1318
1363
  setSortInfo,
1319
1364
  columnOrder,
1320
1365
  columnPinning,
1366
+ pinnedEndMaxWidth,
1367
+ pinnedStartMaxWidth,
1321
1368
  columnVisibility,
1322
1369
  columnVisibilityAssumeVisible
1323
1370
  }) => {
@@ -1336,7 +1383,9 @@ var useComputedVisibleColumns = ({
1336
1383
  computedPinnedEndColumnsWidth,
1337
1384
  computedUnpinnedColumnsWidth,
1338
1385
  computedUnpinnedOffset,
1339
- computedPinnedEndOffset
1386
+ computedPinnedEndOffset,
1387
+ computedPinnedEndWidth,
1388
+ computedPinnedStartWidth
1340
1389
  } = useMemo2(() => {
1341
1390
  return getComputedVisibleColumns({
1342
1391
  columns,
@@ -1349,6 +1398,8 @@ var useComputedVisibleColumns = ({
1349
1398
  sortInfo,
1350
1399
  setSortInfo,
1351
1400
  multiSort,
1401
+ pinnedEndMaxWidth,
1402
+ pinnedStartMaxWidth,
1352
1403
  draggableColumns,
1353
1404
  columnOrder,
1354
1405
  columnPinning,
@@ -1369,6 +1420,8 @@ var useComputedVisibleColumns = ({
1369
1420
  columnOrder,
1370
1421
  columnVisibility,
1371
1422
  columnVisibilityAssumeVisible,
1423
+ pinnedEndMaxWidth,
1424
+ pinnedStartMaxWidth,
1372
1425
  columnPinning,
1373
1426
  columnsRenderId,
1374
1427
  visibilityRenderId,
@@ -1376,6 +1429,8 @@ var useComputedVisibleColumns = ({
1376
1429
  ]);
1377
1430
  const result = {
1378
1431
  columns,
1432
+ computedPinnedEndWidth,
1433
+ computedPinnedStartWidth,
1379
1434
  computedRemainingSpace,
1380
1435
  computedUnpinnedOffset,
1381
1436
  computedPinnedEndOffset,
@@ -3172,13 +3227,17 @@ function useComputed() {
3172
3227
  computedUnpinnedColumnsWidth,
3173
3228
  computedUnpinnedOffset,
3174
3229
  computedPinnedEndOffset,
3175
- computedRemainingSpace
3230
+ computedRemainingSpace,
3231
+ computedPinnedStartWidth,
3232
+ computedPinnedEndWidth
3176
3233
  } = useComputedVisibleColumns({
3177
3234
  columns: componentState.computedPivotColumns || componentState.columns,
3178
3235
  generatedColumns: componentState.generatedColumns,
3179
3236
  columnMinWidth: componentState.columnMinWidth,
3180
3237
  columnMaxWidth: componentState.columnMaxWidth,
3181
3238
  columnDefaultWidth: componentState.columnDefaultWidth,
3239
+ pinnedStartMaxWidth: componentState.pinnedStartMaxWidth,
3240
+ pinnedEndMaxWidth: componentState.pinnedEndMaxWidth,
3182
3241
  bodySize,
3183
3242
  sortable: componentState.sortable,
3184
3243
  draggableColumns: componentState.draggableColumns,
@@ -3213,7 +3272,13 @@ function useComputed() {
3213
3272
  if (colWidthSum > scrollLeft) {
3214
3273
  columnRenderStartIndex--;
3215
3274
  }
3275
+ const computedPinnedStartOverflow = computedPinnedStartWidth ? computedPinnedStartColumnsWidth > computedPinnedStartWidth : false;
3276
+ const computedPinnedEndOverflow = computedPinnedEndWidth ? computedPinnedEndColumnsWidth > computedPinnedEndWidth : false;
3216
3277
  return {
3278
+ computedPinnedStartOverflow,
3279
+ computedPinnedEndOverflow,
3280
+ computedPinnedStartWidth,
3281
+ computedPinnedEndWidth,
3217
3282
  computedVisibleColumns,
3218
3283
  computedColumnOrder,
3219
3284
  computedRemainingSpace,
@@ -3291,8 +3356,8 @@ import {
3291
3356
  memo as memo2
3292
3357
  } from "react";
3293
3358
  function HorizontalScrollbarPlaceholderFn(props) {
3294
- const height = getScrollbarWidth();
3295
- if (!height) {
3359
+ const scrollbarWidth2 = getScrollbarWidth();
3360
+ if (!scrollbarWidth2) {
3296
3361
  return null;
3297
3362
  }
3298
3363
  return /* @__PURE__ */ createElement8("div", {
@@ -3301,15 +3366,14 @@ function HorizontalScrollbarPlaceholderFn(props) {
3301
3366
  position: "absolute",
3302
3367
  overflow: "visible",
3303
3368
  overflowX: "scroll",
3304
- height,
3305
3369
  bottom: 0
3306
3370
  }, props.style)
3307
3371
  });
3308
3372
  }
3309
3373
  var HorizontalScrollbarPlaceholder = memo2(HorizontalScrollbarPlaceholderFn);
3310
3374
  function VerticalScrollbarPlaceholderFn(props) {
3311
- const width = getScrollbarWidth();
3312
- if (!width) {
3375
+ const scrollbarWidth2 = getScrollbarWidth();
3376
+ if (!scrollbarWidth2) {
3313
3377
  return null;
3314
3378
  }
3315
3379
  return /* @__PURE__ */ createElement8("div", {
@@ -3318,7 +3382,6 @@ function VerticalScrollbarPlaceholderFn(props) {
3318
3382
  position: "absolute",
3319
3383
  overflow: "visible",
3320
3384
  overflowY: "scroll",
3321
- width,
3322
3385
  bottom: 0
3323
3386
  }, props.style)
3324
3387
  });
@@ -4334,7 +4397,23 @@ var UPDATE_SCROLL = (node, scrollPosition) => {
4334
4397
  node.style.transform = `translate3d(${-scrollPosition.scrollLeft}px, 0px, 0px)`;
4335
4398
  };
4336
4399
  function InfiniteTableHeaderUnvirtualizedFn(props) {
4337
- const _a = props, { columns, scrollable, brain, totalWidth } = _a, domProps = __objRest(_a, ["columns", "scrollable", "brain", "totalWidth"]);
4400
+ const _a = props, {
4401
+ columns,
4402
+ scrollable,
4403
+ classNameModifiers,
4404
+ brain,
4405
+ scrollListener,
4406
+ totalWidth,
4407
+ availableWidth
4408
+ } = _a, domProps = __objRest(_a, [
4409
+ "columns",
4410
+ "scrollable",
4411
+ "classNameModifiers",
4412
+ "brain",
4413
+ "scrollListener",
4414
+ "totalWidth",
4415
+ "availableWidth"
4416
+ ]);
4338
4417
  const {
4339
4418
  componentState: {
4340
4419
  computedColumnGroups,
@@ -4375,23 +4454,27 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
4375
4454
  });
4376
4455
  const style = __spreadValues({}, domProps == null ? void 0 : domProps.style);
4377
4456
  if (totalWidth != null) {
4378
- style.width = totalWidth;
4457
+ style.width = availableWidth;
4379
4458
  }
4380
4459
  useEffect13(() => {
4381
- if (!brain || !scrollable) {
4460
+ const scroller = brain || scrollListener;
4461
+ if (!scroller || !scrollable) {
4382
4462
  return;
4383
4463
  }
4384
4464
  const onScroll = (scrollPosition) => {
4385
4465
  UPDATE_SCROLL(domRef.current, scrollPosition);
4386
4466
  };
4387
- const removeOnScroll = brain.onScroll(onScroll);
4467
+ const removeOnScroll = scroller.onScroll(onScroll);
4388
4468
  return removeOnScroll;
4389
- }, [brain]);
4469
+ }, [brain, scrollListener]);
4390
4470
  return /* @__PURE__ */ createElement18("div", __spreadProps(__spreadValues({}, domProps), {
4391
- ref: domRef,
4392
- className: join(ICSS.flexFlow.row, ICSS.display.flex, TableHeaderClassName2, `${TableHeaderClassName2}--unvirtualized`, domProps.className),
4471
+ className: join(TableHeaderClassName2, `${TableHeaderClassName2}--unvirtualized`, domProps.className, ...(classNameModifiers || []).filter(Boolean).map((modifier) => `${TableHeaderClassName2}--${modifier}`)),
4393
4472
  style
4394
- }), children);
4473
+ }), /* @__PURE__ */ createElement18("div", {
4474
+ style: { width: totalWidth },
4475
+ className: join(ICSS.flexFlow.row, ICSS.display.flex),
4476
+ ref: domRef
4477
+ }, children));
4395
4478
  }
4396
4479
  var InfiniteTableHeaderUnvirtualized = memo7(InfiniteTableHeaderUnvirtualizedFn);
4397
4480
 
@@ -4404,11 +4487,21 @@ function TableHeaderWrapper(props) {
4404
4487
  computedPinnedStartColumns,
4405
4488
  computedPinnedEndColumns,
4406
4489
  computedPinnedStartColumnsWidth,
4490
+ computedPinnedStartWidth,
4491
+ computedPinnedEndWidth,
4407
4492
  computedPinnedEndColumnsWidth,
4408
- computedUnpinnedColumnsWidth
4493
+ computedUnpinnedColumnsWidth,
4494
+ computedPinnedStartOverflow,
4495
+ computedPinnedEndOverflow
4409
4496
  } = tableContextValue.computed;
4410
4497
  const {
4411
- componentState: { virtualizeHeader, headerHeight, columnGroupsMaxDepth }
4498
+ componentState: {
4499
+ virtualizeHeader,
4500
+ headerHeight,
4501
+ columnGroupsMaxDepth,
4502
+ pinnedStartScrollListener,
4503
+ pinnedEndScrollListener
4504
+ }
4412
4505
  } = tableContextValue;
4413
4506
  const hasPinnedStart = computedPinnedStartColumns.length > 0;
4414
4507
  const hasPinnedEnd = computedPinnedEndColumns.length > 0;
@@ -4419,15 +4512,17 @@ function TableHeaderWrapper(props) {
4419
4512
  brain,
4420
4513
  style: {
4421
4514
  position: "absolute",
4422
- left: computedPinnedStartColumnsWidth,
4515
+ left: computedPinnedStartWidth,
4423
4516
  width: computedUnpinnedColumnsWidth,
4424
4517
  height: columnGroupsMaxDepth || headerHeight
4425
4518
  },
4519
+ availableWidth: computedUnpinnedColumnsWidth,
4426
4520
  totalWidth: computedUnpinnedColumnsWidth
4427
4521
  }) : /* @__PURE__ */ createElement19(InfiniteTableHeaderUnvirtualized, {
4428
4522
  brain,
4429
4523
  scrollable: true,
4430
4524
  columns: computedUnpinnedColumns,
4525
+ availableWidth: computedUnpinnedColumnsWidth,
4431
4526
  totalWidth: computedUnpinnedColumnsWidth
4432
4527
  });
4433
4528
  return /* @__PURE__ */ createElement19("div", {
@@ -4440,18 +4535,34 @@ function TableHeaderWrapper(props) {
4440
4535
  style: {
4441
4536
  left: 0,
4442
4537
  position: "absolute",
4443
- width: computedPinnedStartColumnsWidth
4538
+ width: computedPinnedStartWidth
4444
4539
  },
4540
+ availableWidth: computedPinnedStartWidth,
4541
+ totalWidth: computedPinnedStartColumnsWidth,
4445
4542
  columns: computedPinnedStartColumns,
4446
- totalWidth: computedPinnedStartColumnsWidth
4543
+ scrollable: computedPinnedStartOverflow,
4544
+ classNameModifiers: [
4545
+ "pinned",
4546
+ "pinned-start",
4547
+ computedPinnedStartOverflow ? "overflow" : ""
4548
+ ],
4549
+ scrollListener: computedPinnedStartOverflow ? pinnedStartScrollListener : void 0
4447
4550
  }) : null, header, hasPinnedEnd ? /* @__PURE__ */ createElement19(InfiniteTableHeaderUnvirtualized, {
4448
4551
  style: {
4449
4552
  right: scrollbars.vertical ? getScrollbarWidth() : 0,
4450
4553
  position: "absolute",
4451
- width: computedPinnedEndColumnsWidth
4554
+ width: computedPinnedEndWidth
4452
4555
  },
4453
4556
  columns: computedPinnedEndColumns,
4454
- totalWidth: computedPinnedEndColumnsWidth
4557
+ availableWidth: computedPinnedEndWidth,
4558
+ totalWidth: computedPinnedEndColumnsWidth,
4559
+ scrollable: computedPinnedEndOverflow,
4560
+ classNameModifiers: [
4561
+ "pinned",
4562
+ "pinned-end",
4563
+ computedPinnedEndOverflow ? "overflow" : ""
4564
+ ],
4565
+ scrollListener: computedPinnedEndOverflow ? pinnedEndScrollListener : void 0
4455
4566
  }) : null, scrollbars.vertical ? /* @__PURE__ */ createElement19(VerticalScrollbarPlaceholder, {
4456
4567
  style: {
4457
4568
  height: "100%",
@@ -4504,13 +4615,6 @@ var getScrollableClassName = (scrollable) => {
4504
4615
 
4505
4616
  // src/components/VirtualScrollContainer/index.tsx
4506
4617
  var rootClassName6 = "IT-VirtualScrollContainer";
4507
- var defaultClasName = [
4508
- ICSS.position.fixed,
4509
- ICSS.height["100%"],
4510
- ICSS.width["100%"],
4511
- ICSS.left[0],
4512
- ICSS.top[0]
4513
- ].join(" ");
4514
4618
  var VirtualScrollContainer = forwardRef2(function VirtualScrollContainer2(props, ref) {
4515
4619
  const {
4516
4620
  children,
@@ -4527,7 +4631,6 @@ var VirtualScrollContainer = forwardRef2(function VirtualScrollContainer2(props,
4527
4631
  className: [
4528
4632
  className,
4529
4633
  rootClassName6,
4530
- defaultClasName,
4531
4634
  getScrollableClassName(scrollable)
4532
4635
  ].join(" ")
4533
4636
  }, children);
@@ -4558,7 +4661,7 @@ function SpacePlaceholderFn(props) {
4558
4661
  var SpacePlaceholder = memo8(SpacePlaceholderFn);
4559
4662
 
4560
4663
  // src/components/InfiniteTable/hooks/useListRendering.tsx
4561
- import { useCallback as useCallback17, useEffect as useEffect19, useMemo as useMemo8, useRef as useRef14 } from "react";
4664
+ import { useCallback as useCallback17, useEffect as useEffect19, useMemo as useMemo9, useRef as useRef14 } from "react";
4562
4665
 
4563
4666
  // src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
4564
4667
  import {
@@ -4584,7 +4687,6 @@ var UPDATE_SCROLL2 = (node, scrollPosition) => {
4584
4687
  var CLASSES = join(ICSS.height["0"], ICSS.width["0"], ICSS.willChange.transform);
4585
4688
  var debug4 = dbg("VirtuaList");
4586
4689
  var rootClassName7 = "IList";
4587
- var defaultClasses = [ICSS.position.relative, ICSS.transform.translate3D000];
4588
4690
  var VirtualList = (props) => {
4589
4691
  const _a = props, {
4590
4692
  scrollable,
@@ -4648,7 +4750,7 @@ var VirtualList = (props) => {
4648
4750
  const width = mainAxis === "horizontal" ? totalSize : itemCrossAxisSize != null ? itemCrossAxisSize : 0;
4649
4751
  const height = mainAxis === "vertical" ? totalSize : itemCrossAxisSize != null ? itemCrossAxisSize : 0;
4650
4752
  const domProps = __spreadProps(__spreadValues({}, restDOMProps), {
4651
- className: join(props.className, rootClassName7, `${rootClassName7}--${mainAxis}`, ...defaultClasses)
4753
+ className: join(props.className, rootClassName7, `${rootClassName7}--${mainAxis}`, ICSS.transform.translate3D000)
4652
4754
  });
4653
4755
  if (false) {
4654
4756
  domProps["data-cmp-name"] = `VirtualList`;
@@ -4658,7 +4760,8 @@ var VirtualList = (props) => {
4658
4760
  onContainerScroll
4659
4761
  }, /* @__PURE__ */ createElement22("div", {
4660
4762
  ref: domRef,
4661
- className: CLASSES
4763
+ className: CLASSES,
4764
+ "data-name": "scroll-transform-target"
4662
4765
  }, /* @__PURE__ */ createElement22(RawList, {
4663
4766
  brain: virtualBrain,
4664
4767
  renderItem,
@@ -4945,8 +5048,8 @@ function useUnpinnedRendering(params) {
4945
5048
  verticalVirtualBrain,
4946
5049
  horizontalVirtualBrain,
4947
5050
  computedUnpinnedColumnsWidth,
4948
- computedPinnedStartColumnsWidth,
4949
- computedPinnedEndColumnsWidth,
5051
+ computedPinnedStartWidth,
5052
+ computedPinnedEndWidth,
4950
5053
  computedUnpinnedColumns,
4951
5054
  getState
4952
5055
  } = params;
@@ -5001,8 +5104,8 @@ function useUnpinnedRendering(params) {
5001
5104
  height: bodySize.height,
5002
5105
  top: 0,
5003
5106
  position: "absolute",
5004
- left: computedPinnedStartColumnsWidth,
5005
- right: computedPinnedEndColumnsWidth
5107
+ left: computedPinnedStartWidth,
5108
+ right: computedPinnedEndWidth
5006
5109
  },
5007
5110
  count: getData().length,
5008
5111
  rowHeight,
@@ -5080,7 +5183,8 @@ var useOnContainerScroll = ({
5080
5183
 
5081
5184
  // src/components/InfiniteTable/hooks/usePinnedRendering.tsx
5082
5185
  import {
5083
- createElement as createElement29
5186
+ createElement as createElement29,
5187
+ useMemo as useMemo8
5084
5188
  } from "react";
5085
5189
  import { useCallback as useCallback15 } from "react";
5086
5190
 
@@ -5105,7 +5209,7 @@ function useOnMount(domRef, props) {
5105
5209
 
5106
5210
  // src/components/VirtualList/RowListWithExternalScrolling.tsx
5107
5211
  var rootClassName10 = "IList";
5108
- var defaultClasses2 = [
5212
+ var defaultClasses = [
5109
5213
  ICSS.willChange.transform,
5110
5214
  ICSS.position.relative,
5111
5215
  ICSS.transform.translate3D000
@@ -5139,8 +5243,6 @@ var RowListWithExternalScrolling = (props) => {
5139
5243
  const { renderStartIndex, renderEndIndex } = brain.getRenderRange();
5140
5244
  node.dataset.renderStartIndex = renderStartIndex;
5141
5245
  node.dataset.renderEndIndex = renderEndIndex;
5142
- node.dataset.scrollLeft = scrollPosition.scrollLeft;
5143
- node.dataset.scrollTop = scrollPosition.scrollTop;
5144
5246
  }
5145
5247
  if (updateScroll) {
5146
5248
  updateScroll(node, scrollPosition);
@@ -5157,7 +5259,7 @@ var RowListWithExternalScrolling = (props) => {
5157
5259
  const domProps = {
5158
5260
  ref: domRef,
5159
5261
  style,
5160
- className: join(className, rootClassName10, `${rootClassName10}--vertical`, ...defaultClasses2)
5262
+ className: join(className, rootClassName10, `${rootClassName10}--vertical`, ...defaultClasses)
5161
5263
  };
5162
5264
  if (false) {
5163
5265
  domProps["data-cmp-name"] = "RowListWithExternalScrolling";
@@ -5170,9 +5272,74 @@ var RowListWithExternalScrolling = (props) => {
5170
5272
  };
5171
5273
 
5172
5274
  // src/components/InfiniteTable/hooks/usePinnedRendering.tsx
5173
- var UPDATE_SCROLL3 = (node, scrollPosition) => {
5174
- node.style.transform = `translate3d(0px, ${-scrollPosition.scrollTop}px, 0px)`;
5275
+ var UPDATE_SCROLL3 = (node, brainScrollPosition, horizontalPinnedScrollPosition) => {
5276
+ node.style.transform = `translate3d(${horizontalPinnedScrollPosition ? -horizontalPinnedScrollPosition.scrollLeft : 0}px, ${-brainScrollPosition.scrollTop}px, 0px)`;
5175
5277
  };
5278
+ var PinnedRowsContainerClassName = `ITablePinnedRows`;
5279
+ function PinnedRowsContainer(props) {
5280
+ const {
5281
+ maxWidth,
5282
+ pinning,
5283
+ rowWidth,
5284
+ height,
5285
+ pinnedScrollListener,
5286
+ hasOverflow,
5287
+ brain,
5288
+ renderRow
5289
+ } = props;
5290
+ const style = useMemo8(() => {
5291
+ const result = pinning === "end" ? {
5292
+ width: rowWidth,
5293
+ height,
5294
+ right: 0
5295
+ } : {};
5296
+ if (!hasOverflow && pinning === "end") {
5297
+ result.position = "absolute";
5298
+ }
5299
+ if (hasOverflow) {
5300
+ result.height = getScrollbarWidth();
5301
+ result.width = getScrollbarWidth();
5302
+ }
5303
+ return result;
5304
+ }, [height, rowWidth, pinning, hasOverflow]);
5305
+ const updateScroll = useCallback15((node, scrollPosition) => {
5306
+ UPDATE_SCROLL3(node, scrollPosition, hasOverflow ? pinnedScrollListener.getScrollPosition() : void 0);
5307
+ }, [hasOverflow, pinnedScrollListener]);
5308
+ const rowListProps = {
5309
+ style,
5310
+ brain,
5311
+ renderRow,
5312
+ updateScroll,
5313
+ className: join(`${PinnedRowsContainerClassName}`, `${PinnedRowsContainerClassName}--pinned-${pinning}`, `${PinnedRowsContainerClassName}--overflow`)
5314
+ };
5315
+ if (hasOverflow) {
5316
+ return /* @__PURE__ */ createElement29(VirtualScrollContainer, {
5317
+ scrollable: {
5318
+ horizontal: true,
5319
+ vertical: false
5320
+ },
5321
+ style: {
5322
+ width: maxWidth,
5323
+ height,
5324
+ position: "absolute",
5325
+ [pinning === "start" ? "left" : "right"]: 0,
5326
+ [pinning === "start" ? "right" : "left"]: "unset"
5327
+ },
5328
+ onContainerScroll: pinnedScrollListener == null ? void 0 : pinnedScrollListener.setScrollPosition,
5329
+ className: join(`${PinnedRowsContainerClassName}Container`, `${PinnedRowsContainerClassName}Container--pinned-${pinning}`)
5330
+ }, /* @__PURE__ */ createElement29(RowListWithExternalScrolling, __spreadProps(__spreadValues({}, rowListProps), {
5331
+ onMount: (node) => {
5332
+ pinnedScrollListener == null ? void 0 : pinnedScrollListener.onScroll((scrollPosition) => {
5333
+ updateScroll(node, brain.getScrollPosition(), scrollPosition);
5334
+ });
5335
+ }
5336
+ })), /* @__PURE__ */ createElement29(SpacePlaceholder, {
5337
+ width: rowWidth,
5338
+ height: 1
5339
+ }));
5340
+ }
5341
+ return /* @__PURE__ */ createElement29(RowListWithExternalScrolling, __spreadValues({}, rowListProps));
5342
+ }
5176
5343
  function useRenderPinnedRow(params) {
5177
5344
  const { getData, getState, columnsWidth, columns } = params;
5178
5345
  const renderPinnedRow = useCallback15((rowInfo) => {
@@ -5192,7 +5359,7 @@ function useRenderPinnedRow(params) {
5192
5359
  }, [columnsWidth, columns]);
5193
5360
  return renderPinnedRow;
5194
5361
  }
5195
- function usePinnedEndRendering(params) {
5362
+ function usePinnedRenderingForSide(side, params) {
5196
5363
  const {
5197
5364
  getState,
5198
5365
  getData,
@@ -5200,7 +5367,15 @@ function usePinnedEndRendering(params) {
5200
5367
  bodySize,
5201
5368
  computedPinnedEndColumns,
5202
5369
  computedPinnedEndColumnsWidth,
5370
+ computedPinnedStartColumns,
5371
+ computedPinnedStartColumnsWidth,
5203
5372
  verticalVirtualBrain,
5373
+ computedPinnedEndWidth,
5374
+ computedPinnedEndOverflow,
5375
+ computedPinnedStartWidth,
5376
+ computedPinnedStartOverflow,
5377
+ pinnedStartScrollListener,
5378
+ pinnedEndScrollListener,
5204
5379
  repaintId,
5205
5380
  toggleGroupRow,
5206
5381
  scrollbars: {
@@ -5208,31 +5383,54 @@ function usePinnedEndRendering(params) {
5208
5383
  horizontal: hasHorizontalScrollbar
5209
5384
  }
5210
5385
  } = params;
5211
- const renderRowPinnedEnd = useRenderPinnedRow({
5386
+ const count = getData().length;
5387
+ const rowWidth = side === "start" ? computedPinnedStartColumnsWidth : computedPinnedEndColumnsWidth;
5388
+ const columns = side === "start" ? computedPinnedStartColumns : computedPinnedEndColumns;
5389
+ const columnsWidth = side === "start" ? computedPinnedStartColumnsWidth : computedPinnedEndColumnsWidth;
5390
+ const maxWidth = side === "start" ? computedPinnedStartWidth : computedPinnedEndWidth;
5391
+ const hasOverflow = side === "start" ? computedPinnedStartOverflow : computedPinnedEndOverflow;
5392
+ const pinnedScrollListener = side === "start" ? pinnedStartScrollListener : pinnedEndScrollListener;
5393
+ const renderRowPinned = useRenderPinnedRow({
5212
5394
  getData,
5213
5395
  getState,
5214
5396
  toggleGroupRow,
5215
- columns: computedPinnedEndColumns,
5216
- columnsWidth: computedPinnedEndColumnsWidth
5397
+ columns,
5398
+ columnsWidth
5217
5399
  });
5218
- const pinnedEndList = computedPinnedEndColumns.length && rowHeight !== 0 ? /* @__PURE__ */ createElement29(RowListWithExternalScrolling, {
5219
- repaintId: `${repaintId}-pin-end-${rowHeight}`,
5400
+ const pinnedList = columns.length && rowHeight !== 0 ? /* @__PURE__ */ createElement29(PinnedRowsContainer, {
5401
+ pinning: side,
5402
+ pinnedScrollListener,
5403
+ hasOverflow,
5404
+ rowHeight,
5405
+ rowWidth,
5406
+ maxWidth,
5407
+ height: bodySize.height,
5408
+ count,
5409
+ repaintId: `${repaintId}-pin-${side}-${rowHeight}`,
5220
5410
  brain: verticalVirtualBrain,
5221
- renderRow: renderRowPinnedEnd,
5222
- style: {
5223
- position: "absolute",
5224
- height: bodySize.height,
5225
- width: computedPinnedEndColumnsWidth,
5226
- right: 0
5227
- },
5228
- updateScroll: UPDATE_SCROLL3
5411
+ renderRow: renderRowPinned
5229
5412
  }) : null;
5230
- const pinnedEndScrollbarPlaceholder = pinnedEndList && hasHorizontalScrollbar ? /* @__PURE__ */ createElement29(HorizontalScrollbarPlaceholder, {
5231
- style: {
5232
- width: computedPinnedEndColumnsWidth,
5413
+ const pinnedScrollbarPlaceholder = pinnedList && hasHorizontalScrollbar && !hasOverflow ? /* @__PURE__ */ createElement29(HorizontalScrollbarPlaceholder, {
5414
+ style: side === "end" ? {
5415
+ width: columnsWidth,
5233
5416
  right: hasVerticalScrollbar ? getScrollbarWidth() : 0
5417
+ } : {
5418
+ width: columnsWidth,
5419
+ left: 0
5234
5420
  }
5235
5421
  }) : null;
5422
+ return {
5423
+ renderRowPinned,
5424
+ pinnedList,
5425
+ pinnedScrollbarPlaceholder
5426
+ };
5427
+ }
5428
+ function usePinnedEndRendering(params) {
5429
+ const {
5430
+ renderRowPinned: renderRowPinnedEnd,
5431
+ pinnedList: pinnedEndList,
5432
+ pinnedScrollbarPlaceholder: pinnedEndScrollbarPlaceholder
5433
+ } = usePinnedRenderingForSide("end", params);
5236
5434
  return {
5237
5435
  renderRowPinnedEnd,
5238
5436
  pinnedEndList,
@@ -5241,40 +5439,16 @@ function usePinnedEndRendering(params) {
5241
5439
  }
5242
5440
  function usePinnedStartRendering(params) {
5243
5441
  const {
5244
- getData,
5245
- getState,
5246
- rowHeight,
5247
- computedPinnedStartColumns,
5248
- computedPinnedStartColumnsWidth,
5249
- verticalVirtualBrain,
5250
- toggleGroupRow,
5251
- repaintId,
5252
- scrollbars: { horizontal: hasHorizontalScrollbar }
5253
- } = params;
5254
- const renderRowPinnedStart = useRenderPinnedRow({
5255
- getData,
5256
- getState,
5257
- toggleGroupRow,
5258
- columns: computedPinnedStartColumns,
5259
- columnsWidth: computedPinnedStartColumnsWidth
5260
- });
5261
- const pinnedStartList = computedPinnedStartColumns.length && rowHeight !== 0 ? /* @__PURE__ */ createElement29(RowListWithExternalScrolling, {
5262
- repaintId: `${repaintId}-pin-start-${rowHeight}`,
5263
- brain: verticalVirtualBrain,
5264
- renderRow: renderRowPinnedStart,
5265
- updateScroll: UPDATE_SCROLL3
5266
- }) : null;
5267
- const pinnedStartScrollbarPlaceholder = pinnedStartList && hasHorizontalScrollbar ? /* @__PURE__ */ createElement29(HorizontalScrollbarPlaceholder, {
5268
- style: {
5269
- width: computedPinnedStartColumnsWidth,
5270
- left: 0
5271
- }
5272
- }) : null;
5273
- return {
5442
+ renderRowPinned: renderRowPinnedStart,
5443
+ pinnedList: pinnedStartList,
5444
+ pinnedScrollbarPlaceholder: pinnedStartScrollbarPlaceholder
5445
+ } = usePinnedRenderingForSide("start", params);
5446
+ const result = {
5274
5447
  renderRowPinnedStart,
5275
5448
  pinnedStartList,
5276
5449
  pinnedStartScrollbarPlaceholder
5277
5450
  };
5451
+ return result;
5278
5452
  }
5279
5453
 
5280
5454
  // src/components/InfiniteTable/hooks/useYourBrain.ts
@@ -5282,7 +5456,7 @@ import { useEffect as useEffect18 } from "react";
5282
5456
 
5283
5457
  // src/components/VirtualBrain/index.ts
5284
5458
  var import_binary_search2 = __toModule(require_binary_search());
5285
- var initialScrollPosition = {
5459
+ var initialScrollPosition2 = {
5286
5460
  scrollLeft: 0,
5287
5461
  scrollTop: 0
5288
5462
  };
@@ -5291,7 +5465,7 @@ var SORT_ASC = (a, b) => a - b;
5291
5465
  var VirtualBrain = class extends Logger {
5292
5466
  constructor(options) {
5293
5467
  super(`VirtualBrain:${options.mainAxis}`);
5294
- this.scrollPosition = initialScrollPosition;
5468
+ this.scrollPosition = initialScrollPosition2;
5295
5469
  this.scrollPositionOnMainAxis = 0;
5296
5470
  this.totalSize = 0;
5297
5471
  this.onScrollFns = [];
@@ -5645,8 +5819,8 @@ function useYourBrain(param) {
5645
5819
  const {
5646
5820
  dataArray,
5647
5821
  computedUnpinnedColumns,
5648
- computedPinnedStartColumnsWidth,
5649
- computedPinnedEndColumnsWidth,
5822
+ computedPinnedStartWidth,
5823
+ computedPinnedEndWidth,
5650
5824
  rowHeight,
5651
5825
  bodySize
5652
5826
  } = param;
@@ -5679,13 +5853,9 @@ function useYourBrain(param) {
5679
5853
  useEffect18(() => {
5680
5854
  horizontalVirtualBrain.setAvailableSize({
5681
5855
  height: 0,
5682
- width: Math.max(bodySize.width - computedPinnedStartColumnsWidth - computedPinnedEndColumnsWidth, 0)
5856
+ width: Math.max(bodySize.width - computedPinnedStartWidth - computedPinnedEndWidth, 0)
5683
5857
  });
5684
- }, [
5685
- bodySize.width,
5686
- computedPinnedStartColumnsWidth,
5687
- computedPinnedEndColumnsWidth
5688
- ]);
5858
+ }, [bodySize.width, computedPinnedStartWidth, computedPinnedEndWidth]);
5689
5859
  return { horizontalVirtualBrain, verticalVirtualBrain };
5690
5860
  }
5691
5861
 
@@ -5722,13 +5892,23 @@ function useListRendering(param) {
5722
5892
  computedPinnedEndColumns,
5723
5893
  computedPinnedStartColumnsWidth,
5724
5894
  computedPinnedEndColumnsWidth,
5895
+ computedPinnedStartWidth,
5896
+ computedPinnedEndWidth,
5725
5897
  computedUnpinnedColumns,
5726
- computedUnpinnedColumnsWidth
5898
+ computedUnpinnedColumnsWidth,
5899
+ computedPinnedStartOverflow,
5900
+ computedPinnedEndOverflow
5727
5901
  } = computed;
5728
- const { componentState: dataSourceState } = useDataSourceContextValue();
5902
+ const { componentState: dataSourceState, getState: getDataSourceState } = useDataSourceContextValue();
5729
5903
  const { dataArray } = dataSourceState;
5730
5904
  const getData = useLatest(dataArray);
5731
- const { rowHeightComputed: rowHeight } = componentState;
5905
+ const {
5906
+ rowHeightComputed: rowHeight,
5907
+ pinnedStartMaxWidth,
5908
+ pinnedEndMaxWidth,
5909
+ pinnedStartScrollListener,
5910
+ pinnedEndScrollListener
5911
+ } = componentState;
5732
5912
  const prevDataSourceTimestamp = usePrevious(dataSourceState.updatedAt);
5733
5913
  const repaintIdRef = useRef14(0);
5734
5914
  if (!shallowEqualObjects(prevComputed, computed) || prevDataSourceTimestamp !== dataSourceState.updatedAt) {
@@ -5736,9 +5916,9 @@ function useListRendering(param) {
5736
5916
  }
5737
5917
  const repaintId = repaintIdRef.current;
5738
5918
  const { horizontalVirtualBrain, verticalVirtualBrain } = useYourBrain({
5919
+ computedPinnedStartWidth: computed.computedPinnedStartWidth,
5920
+ computedPinnedEndWidth: computed.computedPinnedEndWidth,
5739
5921
  computedUnpinnedColumns: computed.computedUnpinnedColumns,
5740
- computedPinnedStartColumnsWidth: computed.computedPinnedStartColumnsWidth,
5741
- computedPinnedEndColumnsWidth: computed.computedPinnedEndColumnsWidth,
5742
5922
  rowHeight,
5743
5923
  dataArray,
5744
5924
  bodySize
@@ -5746,7 +5926,7 @@ function useListRendering(param) {
5746
5926
  const hasHorizontalScrollbar = computedUnpinnedColumnsWidth > bodySize.width - computedPinnedStartColumnsWidth - computedPinnedEndColumnsWidth;
5747
5927
  const reservedContentHeight = verticalVirtualBrain.getTotalSize() + (hasHorizontalScrollbar ? getScrollbarWidth() : 0);
5748
5928
  const hasVerticalScrollbar = bodySize.height < reservedContentHeight;
5749
- const scrollbars = useMemo8(() => ({
5929
+ const scrollbars = useMemo9(() => ({
5750
5930
  vertical: hasVerticalScrollbar,
5751
5931
  horizontal: hasHorizontalScrollbar
5752
5932
  }), [hasVerticalScrollbar, hasHorizontalScrollbar]);
@@ -5763,7 +5943,9 @@ function useListRendering(param) {
5763
5943
  setColumnVisibility: (columnVisibility) => {
5764
5944
  componentActions.columnVisibility = columnVisibility;
5765
5945
  },
5766
- setColumnAggregations: (columnAggregations) => componentActions.columnAggregations = columnAggregations
5946
+ setColumnAggregations: (columnAggregations) => componentActions.columnAggregations = columnAggregations,
5947
+ getState,
5948
+ getDataSourceState
5767
5949
  };
5768
5950
  onReady(imperativeApi);
5769
5951
  }
@@ -5773,7 +5955,7 @@ function useListRendering(param) {
5773
5955
  horizontalVirtualBrain,
5774
5956
  domRef
5775
5957
  });
5776
- const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
5958
+ const { componentActions: dataSourceActions } = useDataSourceContextValue();
5777
5959
  const toggleGroupRow = useCallback17((groupKeys) => {
5778
5960
  const newState = new GroupRowsState(getDataSourceState().groupRowsState);
5779
5961
  newState.toggleGroupRow(groupKeys);
@@ -5784,14 +5966,22 @@ function useListRendering(param) {
5784
5966
  scrollbars,
5785
5967
  computedPinnedStartColumns,
5786
5968
  computedPinnedEndColumns,
5969
+ computedPinnedStartWidth,
5970
+ computedPinnedEndWidth,
5971
+ computedPinnedStartOverflow,
5972
+ computedPinnedEndOverflow,
5787
5973
  computedPinnedStartColumnsWidth,
5788
5974
  computedPinnedEndColumnsWidth,
5789
5975
  getData,
5790
5976
  getState,
5791
5977
  toggleGroupRow,
5978
+ pinnedStartMaxWidth,
5979
+ pinnedEndMaxWidth,
5792
5980
  repaintId,
5793
5981
  rowHeight,
5794
- verticalVirtualBrain
5982
+ verticalVirtualBrain,
5983
+ pinnedStartScrollListener,
5984
+ pinnedEndScrollListener
5795
5985
  };
5796
5986
  const centerRenderingParams = __spreadProps(__spreadValues({}, pinnedRenderingParams), {
5797
5987
  columnShifts,
@@ -5908,7 +6098,7 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
5908
6098
  });
5909
6099
 
5910
6100
  // src/components/InfiniteTable/hooks/useLicense/useLicense.ts
5911
- import { useMemo as useMemo9 } from "react";
6101
+ import { useMemo as useMemo10 } from "react";
5912
6102
 
5913
6103
  // src/components/InfiniteTable/hooks/useLicense/crc32.ts
5914
6104
  var DEFAULT_ReversedPolynomial = 3988292384;
@@ -6054,10 +6244,10 @@ var decode = (licenseKey) => {
6054
6244
 
6055
6245
  // src/components/InfiniteTable/hooks/useLicense/useLicense.ts
6056
6246
  var useLicense = (licenseKey) => {
6057
- const valid = useMemo9(() => {
6247
+ const valid = useMemo10(() => {
6058
6248
  return isValidLicense(licenseKey, {
6059
6249
  publishedAt: 1624970570587,
6060
- version: "0.0.1-canary.11"
6250
+ version: "0.0.1"
6061
6251
  });
6062
6252
  }, [licenseKey]);
6063
6253
  return valid;
@@ -6147,7 +6337,6 @@ var InfiniteTableComponent = memo12(function InfiniteTableComponent2() {
6147
6337
  headerHeightCSSVar
6148
6338
  } = componentState;
6149
6339
  const { columnShifts, bodySize } = componentState;
6150
- const className = join(InfiniteTableClassName, columnShifts ? `${InfiniteTableClassName}--shifting` : "", domProps == null ? void 0 : domProps.className);
6151
6340
  const {
6152
6341
  pinnedStartList,
6153
6342
  pinnedEndList,
@@ -6167,6 +6356,7 @@ var InfiniteTableComponent = memo12(function InfiniteTableComponent2() {
6167
6356
  computed
6168
6357
  });
6169
6358
  const licenseValid = useLicense(licenseKey);
6359
+ const className = join(InfiniteTableClassName, columnShifts ? `${InfiniteTableClassName}--shifting` : "", domProps == null ? void 0 : domProps.className, pinnedStartList ? `${InfiniteTableClassName}--has-pinned-start` : null, pinnedEndList ? `${InfiniteTableClassName}--has-pinned-end` : null, computed.computedPinnedStartOverflow ? `${InfiniteTableClassName}--has-pinned-start-overflow` : null, computed.computedPinnedEndOverflow ? `${InfiniteTableClassName}--has-pinned-end-overflow` : null);
6170
6360
  return /* @__PURE__ */ createElement32("div", __spreadProps(__spreadValues({
6171
6361
  ref: domRef
6172
6362
  }, domProps), {
@@ -6202,7 +6392,10 @@ function InfiniteTableContextProvider() {
6202
6392
  const computed = useComputed();
6203
6393
  const getComputed = useLatest(computed);
6204
6394
  const getState = useLatest(componentState);
6205
- globalThis.getState = getState;
6395
+ if (false) {
6396
+ globalThis.getState = getState;
6397
+ globalThis.getComputed = getComputed;
6398
+ }
6206
6399
  const contextValue = {
6207
6400
  componentActions,
6208
6401
  componentState,