blixify-ui-web 1.2.246 → 1.2.250

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 (71) hide show
  1. package/lib/components/advanced/collapse/index.d.ts.map +1 -1
  2. package/lib/components/advanced/collapse/index.js +11 -1
  3. package/lib/components/advanced/collapse/index.js.map +1 -1
  4. package/lib/components/chart/DateRange.js +10 -11
  5. package/lib/components/chart/DateRange.js.map +1 -1
  6. package/lib/components/chart/areaChart/index.js +1 -1
  7. package/lib/components/chart/areaChart/index.js.map +1 -1
  8. package/lib/components/chart/barChart/index.d.ts +139 -0
  9. package/lib/components/chart/barChart/index.d.ts.map +1 -1
  10. package/lib/components/chart/barChart/index.js +520 -106
  11. package/lib/components/chart/barChart/index.js.map +1 -1
  12. package/lib/components/chart/boxPlotChart/index.js +1 -1
  13. package/lib/components/chart/boxPlotChart/index.js.map +1 -1
  14. package/lib/components/chart/bubbleChart/index.js +1 -1
  15. package/lib/components/chart/bubbleChart/index.js.map +1 -1
  16. package/lib/components/chart/card/index.js +1 -1
  17. package/lib/components/chart/card/index.js.map +1 -1
  18. package/lib/components/chart/heatmapChart/index.js +1 -1
  19. package/lib/components/chart/heatmapChart/index.js.map +1 -1
  20. package/lib/components/chart/lineChart/index.js +1 -1
  21. package/lib/components/chart/lineChart/index.js.map +1 -1
  22. package/lib/components/chart/pieChart/index.d.ts +40 -0
  23. package/lib/components/chart/pieChart/index.d.ts.map +1 -1
  24. package/lib/components/chart/pieChart/index.js +184 -44
  25. package/lib/components/chart/pieChart/index.js.map +1 -1
  26. package/lib/components/chart/polarAreaChart/index.js +1 -1
  27. package/lib/components/chart/polarAreaChart/index.js.map +1 -1
  28. package/lib/components/chart/radarChart/index.js +1 -1
  29. package/lib/components/chart/radarChart/index.js.map +1 -1
  30. package/lib/components/chart/radialBar/index.js +1 -1
  31. package/lib/components/chart/radialBar/index.js.map +1 -1
  32. package/lib/components/chart/rangeBarChart/index.js +1 -1
  33. package/lib/components/chart/rangeBarChart/index.js.map +1 -1
  34. package/lib/components/chart/treemapChart/index.js +1 -1
  35. package/lib/components/chart/treemapChart/index.js.map +1 -1
  36. package/lib/components/data/dataGraph/chartResults.d.ts +41 -0
  37. package/lib/components/data/dataGraph/chartResults.d.ts.map +1 -1
  38. package/lib/components/data/dataGraph/chartResults.js +72 -2
  39. package/lib/components/data/dataGraph/chartResults.js.map +1 -1
  40. package/lib/components/data/dataGraph/index.d.ts.map +1 -1
  41. package/lib/components/data/dataGraph/index.js +54 -21
  42. package/lib/components/data/dataGraph/index.js.map +1 -1
  43. package/lib/components/data/dataTemplate/chartBuilder.d.ts +6 -0
  44. package/lib/components/data/dataTemplate/chartBuilder.d.ts.map +1 -1
  45. package/lib/components/data/dataTemplate/chartBuilder.js +19 -10
  46. package/lib/components/data/dataTemplate/chartBuilder.js.map +1 -1
  47. package/lib/components/data/dataTemplate/chartView.d.ts +7 -1
  48. package/lib/components/data/dataTemplate/chartView.d.ts.map +1 -1
  49. package/lib/components/data/dataTemplate/chartView.js +291 -32
  50. package/lib/components/data/dataTemplate/chartView.js.map +1 -1
  51. package/lib/components/data/dataTemplate/index.d.ts.map +1 -1
  52. package/lib/components/data/dataTemplate/index.js +14 -4
  53. package/lib/components/data/dataTemplate/index.js.map +1 -1
  54. package/lib/components/data/dataTemplate/spaceModel.d.ts +15 -0
  55. package/lib/components/data/dataTemplate/spaceModel.d.ts.map +1 -1
  56. package/lib/components/data/dataTemplate/spaceModel.js +10 -1
  57. package/lib/components/data/dataTemplate/spaceModel.js.map +1 -1
  58. package/lib/components/display/newTable/index.d.ts +2 -1
  59. package/lib/components/display/newTable/index.d.ts.map +1 -1
  60. package/lib/components/display/newTable/index.js +396 -108
  61. package/lib/components/display/newTable/index.js.map +1 -1
  62. package/lib/components/display/newTable/rowRendering.d.ts +66 -0
  63. package/lib/components/display/newTable/rowRendering.d.ts.map +1 -0
  64. package/lib/components/display/newTable/rowRendering.js +219 -0
  65. package/lib/components/display/newTable/rowRendering.js.map +1 -0
  66. package/lib/components/display/recordActions/index.d.ts +2 -0
  67. package/lib/components/display/recordActions/index.d.ts.map +1 -1
  68. package/lib/components/display/recordActions/index.js +8 -2
  69. package/lib/components/display/recordActions/index.js.map +1 -1
  70. package/lib/tail.css +2 -2
  71. package/package.json +1 -1
@@ -130,6 +130,7 @@ var tag_1 = require("../tag");
130
130
  var defaultColours_1 = require("../../data/columnTypes/defaultColours");
131
131
  var personAvatar_1 = require("../../data/columnTypes/personAvatar");
132
132
  var utils_2 = require("../../input/utils");
133
+ var rowRendering_1 = require("./rowRendering");
133
134
  // INFO: rows a section draws before its "Show more" — a 2,000-row section
134
135
  // would otherwise mount every row (and every cell's controls) at once
135
136
  exports.NEW_TABLE_GROUP_ROW_BATCH = 50;
@@ -365,9 +366,31 @@ var BAND_CLASS = groupSection_1.GROUP_BAND_CLASS;
365
366
  // padding, so the room for the title's actions is an !important class too —
366
367
  // without it a squeezed title (a pinned column on a phone) runs under them
367
368
  var TITLE_ACTIONS_PADDING_CLASS = {
369
+ 8: "!pr-[8px]",
368
370
  48: "!pr-[48px]",
369
- 84: "!pr-[84px]",
371
+ 52: "!pr-[52px]",
372
+ 92: "!pr-[92px]",
373
+ 96: "!pr-[96px]",
374
+ 136: "!pr-[136px]",
370
375
  };
376
+ // INFO: wherever the chevron shows — a hovered row, a focused chevron, or
377
+ // always on a touch screen, which cannot hover — the title and its inline
378
+ // editor make room for it instead of running under it
379
+ var TITLE_CHEVRON_PADDING_CLASS = {
380
+ 48: "group-hover:!pr-[48px] focus-within:!pr-[48px] [@media(hover:none)]:!pr-[48px]",
381
+ 92: "group-hover:!pr-[92px] focus-within:!pr-[92px] [@media(hover:none)]:!pr-[92px]",
382
+ 136: "group-hover:!pr-[136px] focus-within:!pr-[136px] [@media(hover:none)]:!pr-[136px]",
383
+ };
384
+ // INFO: the chevron's width plus its gap from the strips
385
+ var CHEVRON_ROOM = 40;
386
+ // INFO: the title text a narrowed title column always keeps beside its actions
387
+ var MIN_TITLE_TEXT_WIDTH = 48;
388
+ // INFO: the cell padding's left side (!px-6)
389
+ var TITLE_LEFT_PADDING = 24;
390
+ // INFO: the pencil and the comment bubble each sit in their own full-height
391
+ // strip at the title cell's right edge, split by dividers like columns of
392
+ // their own — pencil, then bubble at the edge
393
+ var ACTION_STRIP_WIDTH = 44;
371
394
  var ACCENT_CLASS = {
372
395
  default: "border-primary-500",
373
396
  primary: "border-primary-500",
@@ -402,8 +425,25 @@ var handleGetListColour = function (col, value) {
402
425
  return undefined;
403
426
  return column.listSelectionColour[index] || undefined;
404
427
  };
405
- var NewTable = function (props) {
406
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
428
+ var NewTable = function (rawProps) {
429
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
430
+ // INFO: props are read through the latest render. A row that was not drawn
431
+ // again keeps the handlers of the render that drew it, and those read
432
+ // props.onClickRow, props.data and the rest at the time they run — so a
433
+ // skipped row never calls an old callback or reads an old list
434
+ var latestPropsRef = (0, react_2.useRef)(rawProps);
435
+ latestPropsRef.current = rawProps;
436
+ var props = (0, react_2.useMemo)(function () {
437
+ return new Proxy({}, {
438
+ get: function (_target, key) { return latestPropsRef.current[key]; },
439
+ has: function (_target, key) { return key in latestPropsRef.current; },
440
+ ownKeys: function () { return Reflect.ownKeys(latestPropsRef.current); },
441
+ getOwnPropertyDescriptor: function (_target, key) {
442
+ var descriptor = Reflect.getOwnPropertyDescriptor(latestPropsRef.current, key);
443
+ return descriptor ? __assign(__assign({}, descriptor), { configurable: true }) : undefined;
444
+ },
445
+ });
446
+ }, []);
407
447
  var columns = (_b = (_a = props.columns) !== null && _a !== void 0 ? _a : props.header) !== null && _b !== void 0 ? _b : [];
408
448
  var defaultLimit = 10;
409
449
  // INFO: flatten groupData columns so both mobile and desktop share the same
@@ -453,7 +493,7 @@ var NewTable = function (props) {
453
493
  groupData.forEach(function (sub) { return groupedKeys.add("".concat(col.key, ".").concat(sub.key)); });
454
494
  }
455
495
  });
456
- var activityPin = (props.onRowActivity || props.onRowEdit) &&
496
+ var activityPin = (props.onRowActivity || props.onRowEdit || props.onRowOpen) &&
457
497
  !((_d = (_c = props.pinColumns) === null || _c === void 0 ? void 0 : _c.left) === null || _d === void 0 ? void 0 : _d.length) &&
458
498
  flatColumns[0] &&
459
499
  !((_f = (_e = props.pinColumns) === null || _e === void 0 ? void 0 : _e.right) === null || _f === void 0 ? void 0 : _f.includes(flatColumns[0].key))
@@ -474,52 +514,57 @@ var NewTable = function (props) {
474
514
  flatColumns.length = 0;
475
515
  flatColumns.push.apply(flatColumns, __spreadArray(__spreadArray(__spreadArray([], leftCols, false), middleCols, false), rightCols, false));
476
516
  }
477
- var _6 = (0, react_2.useState)(props.fixedPagination ? true : false), isFixed = _6[0], setIsFixed = _6[1];
478
- // INFO: the pencil and the bubble sit over the title cell's right padding,
479
- // 36px each plus 4px from the edge and 8px from the text — kept clear so
480
- // they never cover the title, and added to the cell's measured width so the
481
- // title keeps its own width instead of wrapping
482
- var hasRowActions = !!props.onRowActivity || !!props.onRowEdit;
517
+ var _7 = (0, react_2.useState)(props.fixedPagination ? true : false), isFixed = _7[0], setIsFixed = _7[1];
518
+ // INFO: the actions sit over the title cell's right padding: the pencil and
519
+ // the bubble in divided strips at the edge, then 8px from the text — kept
520
+ // clear so they never cover the title, and added to the cell's measured
521
+ // width so the title keeps its own width instead of wrapping. The chevron
522
+ // shows only on a hovered row (always on a touch screen); the padding grows
523
+ // to take it then, so it never covers the title or its inline editor, and
524
+ // the column is sized and floored for that wider padding.
525
+ var hasRowActions = !!props.onRowEdit || !!props.onRowOpen || !!props.onRowActivity;
483
526
  var canDragRows = !!props.onMoveRowToGroup && !!((_l = props.groups) === null || _l === void 0 ? void 0 : _l.length);
527
+ var activityStripWidth = props.onRowActivity ? ACTION_STRIP_WIDTH : 0;
528
+ var editStripWidth = props.onRowEdit ? ACTION_STRIP_WIDTH : 0;
484
529
  var titleActionsWidth = hasRowActions
485
- ? (props.onRowActivity && props.onRowEdit ? 2 : 1) * 36 + 12
530
+ ? activityStripWidth + editStripWidth + 8
486
531
  : 0;
532
+ var titleChevronActionsWidth = titleActionsWidth + (props.onRowOpen ? CHEVRON_ROOM : 0);
487
533
  //=====================================================================================
488
534
  // SECTION: Advanced Settings
489
535
  //=====================================================================================
490
- var _7 = (0, react_2.useState)(""), filterModal = _7[0], setFilterModal = _7[1];
491
- var _8 = (0, react_2.useState)(""), addColumnModal = _8[0], setAddColumnModal = _8[1];
536
+ var _8 = (0, react_2.useState)(""), filterModal = _8[0], setFilterModal = _8[1];
537
+ var _9 = (0, react_2.useState)(""), addColumnModal = _9[0], setAddColumnModal = _9[1];
492
538
  // INFO: what a DataTemplate around the table lets a cell save
493
539
  var columnTypeActions = (0, react_2.useContext)(context_1.ColumnTypeContext);
494
- var _9 = (0, react_2.useState)(""), newColumnName = _9[0], setNewColumnName = _9[1];
495
- var _10 = (0, react_2.useState)("string"), newColumnType = _10[0], setNewColumnType = _10[1];
496
- var _11 = (0, react_2.useState)(""), newColumnRefSpace = _11[0], setNewColumnRefSpace = _11[1];
497
- var _12 = (0, react_2.useState)(""), newColumnRefLabel = _12[0], setNewColumnRefLabel = _12[1];
498
- var _13 = (0, react_2.useState)([]), newColumnOptions = _13[0], setNewColumnOptions = _13[1];
540
+ var _10 = (0, react_2.useState)(""), newColumnName = _10[0], setNewColumnName = _10[1];
541
+ var _11 = (0, react_2.useState)("string"), newColumnType = _11[0], setNewColumnType = _11[1];
542
+ var _12 = (0, react_2.useState)(""), newColumnRefSpace = _12[0], setNewColumnRefSpace = _12[1];
543
+ var _13 = (0, react_2.useState)(""), newColumnRefLabel = _13[0], setNewColumnRefLabel = _13[1];
544
+ var _14 = (0, react_2.useState)([]), newColumnOptions = _14[0], setNewColumnOptions = _14[1];
499
545
  // INFO: the option row whose colour palette is open
500
- var _14 = (0, react_2.useState)(null), optionColourKey = _14[0], setOptionColourKey = _14[1];
501
- var _15 = (0, react_2.useState)(false), newColumnRequired = _15[0], setNewColumnRequired = _15[1];
502
- var _16 = (0, react_2.useState)(false), newColumnUnique = _16[0], setNewColumnUnique = _16[1];
503
- var _17 = (0, react_2.useState)(false), newColumnReadOnly = _17[0], setNewColumnReadOnly = _17[1];
504
- var _18 = (0, react_2.useState)(""), newColumnRatingMax = _18[0], setNewColumnRatingMax = _18[1];
505
- var _19 = (0, react_2.useState)(""), newColumnButtonLabel = _19[0], setNewColumnButtonLabel = _19[1];
506
- var _20 = (0, react_2.useState)(""), newColumnButtonColour = _20[0], setNewColumnButtonColour = _20[1];
507
- var _21 = (0, react_2.useState)(""), newColumnButtonConfirm = _21[0], setNewColumnButtonConfirm = _21[1];
508
- var _22 = (0, react_2.useState)(false), addingColumn = _22[0], setAddingColumn = _22[1];
546
+ var _15 = (0, react_2.useState)(null), optionColourKey = _15[0], setOptionColourKey = _15[1];
547
+ var _16 = (0, react_2.useState)(false), newColumnRequired = _16[0], setNewColumnRequired = _16[1];
548
+ var _17 = (0, react_2.useState)(false), newColumnUnique = _17[0], setNewColumnUnique = _17[1];
549
+ var _18 = (0, react_2.useState)(false), newColumnReadOnly = _18[0], setNewColumnReadOnly = _18[1];
550
+ var _19 = (0, react_2.useState)(""), newColumnRatingMax = _19[0], setNewColumnRatingMax = _19[1];
551
+ var _20 = (0, react_2.useState)(""), newColumnButtonLabel = _20[0], setNewColumnButtonLabel = _20[1];
552
+ var _21 = (0, react_2.useState)(""), newColumnButtonColour = _21[0], setNewColumnButtonColour = _21[1];
553
+ var _22 = (0, react_2.useState)(""), newColumnButtonConfirm = _22[0], setNewColumnButtonConfirm = _22[1];
554
+ var _23 = (0, react_2.useState)(false), addingColumn = _23[0], setAddingColumn = _23[1];
509
555
  // INFO: the formula as shown in the builder — column names, not ids
510
- var _23 = (0, react_2.useState)(""), newColumnFormula = _23[0], setNewColumnFormula = _23[1];
556
+ var _24 = (0, react_2.useState)(""), newColumnFormula = _24[0], setNewColumnFormula = _24[1];
511
557
  var addColumnPopUpRef = (0, react_2.useRef)(null);
512
558
  // INFO: the column being changed — empty while the panel adds a new one
513
- var _24 = (0, react_2.useState)(null), editingColumn = _24[0], setEditingColumn = _24[1];
559
+ var _25 = (0, react_2.useState)(null), editingColumn = _25[0], setEditingColumn = _25[1];
514
560
  //=====================================================================================
515
561
  // SECTION: Editable & Addable cells
516
562
  //=====================================================================================
517
- var _25 = (0, react_2.useState)(""), editDataRowId = _25[0], setEditDataRowId = _25[1];
518
- var _26 = (0, react_2.useState)(""), editDataHeaderKey = _26[0], setEditDataHeaderKey = _26[1];
563
+ var _26 = (0, react_2.useState)(""), editDataRowId = _26[0], setEditDataRowId = _26[1];
564
+ var _27 = (0, react_2.useState)(""), editDataHeaderKey = _27[0], setEditDataHeaderKey = _27[1];
519
565
  // INFO: an editable table used to mount an input in every cell — it read as a
520
566
  // form, and a row click always landed on a child input. Only the hovered cell
521
- // becomes its input now.
522
- var _27 = (0, react_2.useState)(null), hoveredCell = _27[0], setHoveredCell = _27[1];
567
+ // becomes its input now; NewTableHoverCell keeps that hover to itself.
523
568
  var _28 = (0, react_2.useState)(false), modalEditVisible = _28[0], setModalEditVisible = _28[1];
524
569
  // INFO: whether the modal's signature pad has been drawn on
525
570
  var _29 = (0, react_2.useState)(false), signatureSigning = _29[0], setSignatureSigning = _29[1];
@@ -570,6 +615,19 @@ var NewTable = function (props) {
570
615
  var _46 = (0, react_2.useState)({}), measuredPinWidths = _46[0], setMeasuredPinWidths = _46[1];
571
616
  // INFO: the scrolling view's width, which caps how much the left pins take
572
617
  var _47 = (0, react_2.useState)(0), pinViewWidth = _47[0], setPinViewWidth = _47[1];
618
+ // INFO: per large group, the rows [start, end) drawn; the rest are spacers
619
+ var _48 = (0, react_2.useState)({}), virtualRanges = _48[0], setVirtualRanges = _48[1];
620
+ // INFO: each drawn row's measured height, kept so a spacer is as tall as the
621
+ // rows it stands in for
622
+ var rowHeightsRef = (0, react_2.useRef)(new Map());
623
+ // INFO: the large groups of the last render, in order, with their row ids
624
+ var virtualGroupsRef = (0, react_2.useRef)([]);
625
+ var virtualFrameRef = (0, react_2.useRef)(0);
626
+ var rowEstimateRef = (0, react_2.useRef)(rowRendering_1.VIRTUAL_DEFAULT_ROW_HEIGHT);
627
+ var tableVersionRef = (0, react_2.useRef)({
628
+ key: "",
629
+ version: 0,
630
+ });
573
631
  var editDataValueRef = (0, react_2.useRef)({});
574
632
  var editDataRowIdRef = (0, react_2.useRef)("");
575
633
  var editDataHeaderKeyRef = (0, react_2.useRef)("");
@@ -587,6 +645,90 @@ var NewTable = function (props) {
587
645
  // never mutated during editing so we can diff against it on blur.
588
646
  var originalDataRef = (0, react_2.useRef)({});
589
647
  var tableRef = (0, react_2.useRef)(null);
648
+ // INFO: which rows each large group draws, from where its first row sits
649
+ // on screen. The window's edges, widened by the overscan, bound it — the
650
+ // table's own scroller sits inside them, whichever element that is
651
+ var handleUpdateVirtualRanges = function () {
652
+ var table = tableRef.current;
653
+ var groups = virtualGroupsRef.current;
654
+ if (!table || groups.length === 0)
655
+ return;
656
+ var starts = new Map();
657
+ table
658
+ .querySelectorAll("tr[data-virtual-start]")
659
+ .forEach(function (element) {
660
+ var _a;
661
+ return starts.set((_a = element.getAttribute("data-virtual-start")) !== null && _a !== void 0 ? _a : "", element.getBoundingClientRect().top);
662
+ });
663
+ var viewTop = -rowRendering_1.VIRTUAL_OVERSCAN_PX;
664
+ var viewBottom = window.innerHeight + rowRendering_1.VIRTUAL_OVERSCAN_PX;
665
+ var next = {};
666
+ groups.forEach(function (group) {
667
+ var groupTop = starts.get(group.id);
668
+ if (groupTop === undefined)
669
+ return;
670
+ next[group.id] = (0, rowRendering_1.handleGetVisibleRange)((0, rowRendering_1.handleBuildRowOffsets)(group.rowIds, rowHeightsRef.current, rowEstimateRef.current), groupTop, viewTop, viewBottom);
671
+ });
672
+ setVirtualRanges(function (previous) {
673
+ var keys = Object.keys(next);
674
+ var isSame = keys.length === Object.keys(previous).length &&
675
+ keys.every(function (key) {
676
+ var _a, _b;
677
+ return ((_a = previous[key]) === null || _a === void 0 ? void 0 : _a[0]) === next[key][0] &&
678
+ ((_b = previous[key]) === null || _b === void 0 ? void 0 : _b[1]) === next[key][1];
679
+ });
680
+ return isSame ? previous : next;
681
+ });
682
+ };
683
+ var handleScheduleVirtualRanges = function () {
684
+ if (virtualFrameRef.current)
685
+ return;
686
+ virtualFrameRef.current = requestAnimationFrame(function () {
687
+ virtualFrameRef.current = 0;
688
+ handleUpdateVirtualRanges();
689
+ });
690
+ };
691
+ // INFO: after each draw, the drawn rows of large groups are measured, so the
692
+ // spacers match them, and the ranges are checked against the new layout
693
+ (0, react_2.useLayoutEffect)(function () {
694
+ if (virtualGroupsRef.current.length === 0)
695
+ return;
696
+ var table = tableRef.current;
697
+ if (!table)
698
+ return;
699
+ var heights = rowHeightsRef.current;
700
+ table
701
+ .querySelectorAll("tbody tr[data-dtw-record-id]")
702
+ .forEach(function (element) {
703
+ var id = element.getAttribute("data-dtw-record-id");
704
+ var height = element.getBoundingClientRect().height;
705
+ if (id && height > 0)
706
+ heights.set(id, height);
707
+ });
708
+ if (heights.size > 0) {
709
+ var total_1 = 0;
710
+ heights.forEach(function (height) { return (total_1 += height); });
711
+ rowEstimateRef.current = total_1 / heights.size;
712
+ }
713
+ handleScheduleVirtualRanges();
714
+ });
715
+ // INFO: capture catches the scroll of whichever element scrolls the table
716
+ (0, react_2.useEffect)(function () {
717
+ window.addEventListener("scroll", handleScheduleVirtualRanges, {
718
+ capture: true,
719
+ passive: true,
720
+ });
721
+ window.addEventListener("resize", handleScheduleVirtualRanges);
722
+ return function () {
723
+ window.removeEventListener("scroll", handleScheduleVirtualRanges, {
724
+ capture: true,
725
+ });
726
+ window.removeEventListener("resize", handleScheduleVirtualRanges);
727
+ if (virtualFrameRef.current)
728
+ cancelAnimationFrame(virtualFrameRef.current);
729
+ };
730
+ // eslint-disable-next-line react-hooks/exhaustive-deps
731
+ }, []);
590
732
  // INFO: ensures pinned column measurement runs only once per mount.
591
733
  var hasMeasuredRef = (0, react_2.useRef)(false);
592
734
  //=====================================================================================
@@ -861,14 +1003,22 @@ var NewTable = function (props) {
861
1003
  range === null || range === void 0 ? void 0 : range.selectNodeContents(inner);
862
1004
  var textWidth = Math.ceil((_b = (_a = range === null || range === void 0 ? void 0 : range.getBoundingClientRect) === null || _a === void 0 ? void 0 : _a.call(range).width) !== null && _b !== void 0 ? _b : 0);
863
1005
  td.style.whiteSpace = previousWhiteSpace;
1006
+ // INFO: a truncated link reports its clipped box to the range, so
1007
+ // its scrollWidth — the text's full width — is read as well
1008
+ var truncatedWidth = inner
1009
+ ? Math.max.apply(Math, __spreadArray([0], Array.from(inner.querySelectorAll("*")).map(function (each) { return each.scrollWidth; }), false)) : 0;
864
1010
  var w = inner
865
- ? Math.max(textWidth, inner.offsetWidth)
1011
+ ? Math.max(textWidth, inner.offsetWidth, truncatedWidth)
866
1012
  : td.scrollWidth;
867
- // INFO: + cell padding (px-4 = 16px × 2), or the title actions' room
1013
+ // INFO: + cell padding (px-4 = 16px × 2), or the title cell's left
1014
+ // padding and the actions' room with the chevron's, so the title
1015
+ // still fits when a hovered row makes room for the chevron
1016
+ var leftPadding = parseFloat(window.getComputedStyle(td).paddingLeft) || 16;
1017
+ var rightPadding = titleChevronActionsWidth;
868
1018
  if (w > 0)
869
1019
  widths[key] =
870
1020
  key === ((_c = flatColumns[0]) === null || _c === void 0 ? void 0 : _c.key) && titleActionsWidth
871
- ? w + 16 + titleActionsWidth
1021
+ ? w + leftPadding + rightPadding
872
1022
  : w + 32;
873
1023
  }
874
1024
  });
@@ -1317,20 +1467,45 @@ var NewTable = function (props) {
1317
1467
  // it stays here until the table unmounts. Tailwind cannot emit a runtime
1318
1468
  // w-[Npx], so a width drives an inline style and wins over the col.width
1319
1469
  // class.
1320
- var _48 = (0, react_2.useState)({}), columnWidths = _48[0], setColumnWidths = _48[1];
1470
+ var _49 = (0, react_2.useState)({}), columnWidths = _49[0], setColumnWidths = _49[1];
1321
1471
  var resizeRef = (0, react_2.useRef)(null);
1322
1472
  // INFO: a dragged width first, else the column's own fixed width in pixels
1323
1473
  // whatever form it is stored in ("180px", "w-[180px]", "w-48")
1324
1474
  var getColumnWidth = function (key) {
1325
- if (columnWidths[key])
1326
- return columnWidths[key];
1327
1475
  var col = flatColumns.find(function (eachCol) { return eachCol.key === key; });
1328
- return (0, columnWidth_1.handleParseColumnWidth)(col === null || col === void 0 ? void 0 : col.width);
1476
+ var width = columnWidths[key] || (0, columnWidth_1.handleParseColumnWidth)(col === null || col === void 0 ? void 0 : col.width);
1477
+ // INFO: a title carrying its row's actions never narrows past its floor,
1478
+ // even from a width saved before the actions took their room
1479
+ var titleMin = getTitleMinWidth(key);
1480
+ return width !== undefined && titleMin ? Math.max(width, titleMin) : width;
1481
+ };
1482
+ // INFO: the title column's floor while it carries the row's actions: its
1483
+ // left padding, the actions' room and a few characters of title
1484
+ var getTitleMinWidth = function (key) {
1485
+ var _a;
1486
+ return key === ((_a = flatColumns[0]) === null || _a === void 0 ? void 0 : _a.key) && hasRowActions
1487
+ ? TITLE_LEFT_PADDING + titleChevronActionsWidth + MIN_TITLE_TEXT_WIDTH
1488
+ : undefined;
1329
1489
  };
1330
1490
  // INFO: a consumer may deliberately set a column narrower than the default
1331
1491
  // floor (a 40px icon column, say) — never force it wider than it was asked to
1332
1492
  // be, so the floor drops to the configured width when that is smaller
1493
+ // INFO: the title cell can only grow its padding on hover while its column
1494
+ // has a set width — a pinned title, or one dragged or configured. A title
1495
+ // sized by its content would widen and shift the table on every hover, so
1496
+ // it keeps the chevron's room all the time instead.
1497
+ var titleKey = (_r = flatColumns[0]) === null || _r === void 0 ? void 0 : _r.key;
1498
+ var isTitleWidthFixed = !!titleKey &&
1499
+ (leftPinned.includes(titleKey) ||
1500
+ rightPinned.includes(titleKey) ||
1501
+ !!getColumnWidth(titleKey));
1502
+ var titleRestPadding = isTitleWidthFixed
1503
+ ? titleActionsWidth
1504
+ : titleChevronActionsWidth;
1333
1505
  var getColumnMinWidth = function (key) {
1506
+ var titleMin = getTitleMinWidth(key);
1507
+ if (titleMin)
1508
+ return titleMin;
1334
1509
  var col = flatColumns.find(function (eachCol) { return eachCol.key === key; });
1335
1510
  var configured = (0, columnWidth_1.handleParseColumnWidth)(col === null || col === void 0 ? void 0 : col.width);
1336
1511
  return configured === undefined
@@ -2046,18 +2221,21 @@ var NewTable = function (props) {
2046
2221
  // INFO: extract numeric px value from a Tailwind width class (e.g. "w-[200px]" → 200, "w-48" → 192).
2047
2222
  // Falls back to measured DOM width for columns without explicit width.
2048
2223
  var handleGetPinWidth = function (key) {
2049
- var _a;
2224
+ var _a, _b;
2050
2225
  // INFO: a dragged or fixed width wins over the measured fallback
2051
2226
  var fixedWidth = getColumnWidth(key);
2052
2227
  if (fixedWidth)
2053
2228
  return fixedWidth;
2054
2229
  var col = flatColumns.find(function (c) { return c.key === key; });
2055
- if (!(col === null || col === void 0 ? void 0 : col.width))
2056
- return (_a = measuredPinWidths[key]) !== null && _a !== void 0 ? _a : DEFAULT_PIN_WIDTH;
2057
- return DEFAULT_PIN_WIDTH;
2230
+ var width = (col === null || col === void 0 ? void 0 : col.width)
2231
+ ? DEFAULT_PIN_WIDTH
2232
+ : ((_a = measuredPinWidths[key]) !== null && _a !== void 0 ? _a : DEFAULT_PIN_WIDTH);
2233
+ // INFO: a measured short title still keeps its floor, so a hovered row
2234
+ // leaves its inline editor some room beside the chevron
2235
+ return Math.max(width, (_b = getTitleMinWidth(key)) !== null && _b !== void 0 ? _b : 0);
2058
2236
  };
2059
2237
  var pinCheckboxOffset = props.checkbox &&
2060
- (props.data.length > 0 || (props.spaceData && ((_r = props.spaceData) === null || _r === void 0 ? void 0 : _r.length) > 0))
2238
+ (props.data.length > 0 || (props.spaceData && ((_s = props.spaceData) === null || _s === void 0 ? void 0 : _s.length) > 0))
2061
2239
  ? CHECKBOX_WIDTH
2062
2240
  : 0;
2063
2241
  /**
@@ -2227,20 +2405,10 @@ var NewTable = function (props) {
2227
2405
  setReferencesDetails: setReferencesDetails,
2228
2406
  });
2229
2407
  };
2230
- // INFO: hover opens a cell, but one being typed into must survive the pointer
2231
- // leaving it — hence the editDataRowId/HeaderKey arm
2232
- var handleIsCellLive = function (rowId, colKey) {
2233
- return ((hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowId) === rowId && (hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colKey) === colKey) ||
2234
- (editDataRowId === rowId && editDataHeaderKey === colKey);
2235
- };
2236
- var handleCellHoverProps = function (rowId, colKey) { return ({
2237
- onMouseEnter: function () { return setHoveredCell({ rowId: rowId, colKey: colKey }); },
2238
- onMouseLeave: function () {
2239
- return setHoveredCell(function (current) {
2240
- return (current === null || current === void 0 ? void 0 : current.rowId) === rowId && (current === null || current === void 0 ? void 0 : current.colKey) === colKey ? null : current;
2241
- });
2242
- },
2243
- }); };
2408
+ // INFO: a cell being typed into stays an input after the pointer leaves it
2409
+ var handleIsCellEditing = function (rowId, colKey) {
2410
+ return editDataRowId === rowId && editDataHeaderKey === colKey;
2411
+ };
2244
2412
  var renderReadCellValue = function (col, row, cellValue) {
2245
2413
  var _a;
2246
2414
  var value = (0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord);
@@ -2268,12 +2436,12 @@ var NewTable = function (props) {
2268
2436
  var _a, _b, _c, _d;
2269
2437
  var tempDS = __assign(__assign({}, col), { id: col.key, name: col.title, type: (_a = col.type) !== null && _a !== void 0 ? _a : "string", showTagSelections: handleColumnShowsTags(col) });
2270
2438
  var editingRow = editDataRowId === rowId;
2271
- return (react_2.default.createElement("td", __assign({ key: col.key + String(colIndex) }, handleCellHoverProps(rowId, col.key), { "data-cell-key": col.key,
2439
+ return (react_2.default.createElement("td", { key: col.key + String(colIndex), "data-cell-key": col.key,
2272
2440
  // INFO: pinned columns use whitespace-normal so text wraps within the fixed width.
2273
2441
  // col.width must match the read-only cell's width source so a column keeps one
2274
2442
  // width whether a row is being edited or shown read-only — without it the cell
2275
2443
  // shrinks/grows on hover and staggers the column.
2276
- className: "".concat(editCellPadding, " ").concat(handleCellMinWidth(col.type), " ").concat(col.width ? "".concat(col.width, " flex-shrink-0") : "", " ").concat(getPinProps(col.key, false) ? "whitespace-normal break-words" : col.width ? "" : "whitespace-nowrap", " text-sm ").concat(cellFontColor, " ").concat((_c = (_b = getPinProps(col.key, false, rowBgClass, isHoverable)) === null || _b === void 0 ? void 0 : _b.className) !== null && _c !== void 0 ? _c : ""), style: (_d = getPinProps(col.key, false, rowBgClass, isHoverable)) === null || _d === void 0 ? void 0 : _d.style }),
2444
+ className: "".concat(editCellPadding, " ").concat(handleCellMinWidth(col.type), " ").concat(col.width ? "".concat(col.width, " flex-shrink-0") : "", " ").concat(getPinProps(col.key, false) ? "whitespace-normal break-words" : col.width ? "" : "whitespace-nowrap", " text-sm ").concat(cellFontColor, " ").concat((_c = (_b = getPinProps(col.key, false, rowBgClass, isHoverable)) === null || _b === void 0 ? void 0 : _b.className) !== null && _c !== void 0 ? _c : ""), style: (_d = getPinProps(col.key, false, rowBgClass, isHoverable)) === null || _d === void 0 ? void 0 : _d.style },
2277
2445
  react_2.default.createElement("div", {
2278
2446
  // INFO: w-0 on the control, not min-w-0 — the table is sized w-max, so
2279
2447
  // an input's browser-default ~20ch intrinsic width feeds max-content
@@ -2297,10 +2465,23 @@ var NewTable = function (props) {
2297
2465
  },
2298
2466
  }))));
2299
2467
  };
2300
- var renderActivityButton = function (id, positioned) {
2301
- var _a;
2468
+ var renderActionStrip = function (testId, right, children) { return (react_2.default.createElement("div", { "data-testid": testId, className: "absolute inset-y-0 z-20 flex items-center justify-center border-l ".concat(borderColor), style: { right: right, width: ACTION_STRIP_WIDTH } }, children)); };
2469
+ var renderActivityButton = function (id, positioned, chevronBgClass) {
2470
+ var _a, _b;
2302
2471
  if (positioned === void 0) { positioned = false; }
2303
- return hasRowActions ? (react_2.default.createElement(recordActions_1.RecordActions, { id: id, onEdit: props.onRowEdit, onActivity: props.onRowActivity, commentCount: (_a = props.commentCounts) === null || _a === void 0 ? void 0 : _a[id], className: positioned ? "absolute right-1 top-1/2 -translate-y-1/2 z-20" : "" })) : null;
2472
+ if (chevronBgClass === void 0) { chevronBgClass = ""; }
2473
+ if (!hasRowActions)
2474
+ return null;
2475
+ // INFO: a mobile card opens its record from the card, so it keeps the
2476
+ // pencil and the bubble beside its title and drops the chevron
2477
+ if (!positioned)
2478
+ return (react_2.default.createElement(recordActions_1.RecordActions, { id: id, onEdit: props.onRowEdit, onActivity: props.onRowActivity, commentCount: (_a = props.commentCounts) === null || _a === void 0 ? void 0 : _a[id] }));
2479
+ return (react_2.default.createElement(react_2.default.Fragment, null,
2480
+ props.onRowOpen && (react_2.default.createElement(recordActions_1.RecordActions, { id: id, onOpen: props.onRowOpen, className: "absolute top-1/2 -translate-y-1/2 z-20 rounded-lg ".concat(chevronBgClass, " pointer-events-none opacity-0 transition-opacity group-hover:pointer-events-auto group-hover:opacity-100 focus-within:pointer-events-auto focus-within:opacity-100 [@media(hover:none)]:pointer-events-auto [@media(hover:none)]:opacity-100"), style: { right: editStripWidth + activityStripWidth + 4 } })),
2481
+ props.onRowEdit &&
2482
+ renderActionStrip("record-edit-strip", activityStripWidth, react_2.default.createElement(recordActions_1.RecordActions, { id: id, onEdit: props.onRowEdit })),
2483
+ props.onRowActivity &&
2484
+ renderActionStrip("record-activity-strip", 0, react_2.default.createElement(recordActions_1.RecordActions, { id: id, onActivity: props.onRowActivity, commentCount: (_b = props.commentCounts) === null || _b === void 0 ? void 0 : _b[id] }))));
2304
2485
  };
2305
2486
  var handleShowsActionColumn = function () { var _a; return !!((_a = props.deleteable) === null || _a === void 0 ? void 0 : _a.active) || (addData && handleValidateAddColumns()); };
2306
2487
  /**
@@ -2369,7 +2550,7 @@ var NewTable = function (props) {
2369
2550
  };
2370
2551
  // INFO: worked out here, after the Actions and "+" helpers it reads, and
2371
2552
  // only read by the render helpers called from the return below
2372
- var _49 = handleFitPins(), fittedLeftPins = _49.widths, narrowPins = _49.narrow;
2553
+ var _50 = handleFitPins(), fittedLeftPins = _50.widths, narrowPins = _50.narrow;
2373
2554
  var renderActionColumnHeader = function () {
2374
2555
  if (handleShowsActionColumn()) {
2375
2556
  var pin = handleGetActionCellPin(true);
@@ -2494,7 +2675,7 @@ var NewTable = function (props) {
2494
2675
  };
2495
2676
  // INFO: true when maxSelectedCount is set and the current selection has reached the limit
2496
2677
  var isMaxReached = !!props.maxSelectedCount &&
2497
- ((_t = (_s = props.selectedIds) === null || _s === void 0 ? void 0 : _s.length) !== null && _t !== void 0 ? _t : 0) >= props.maxSelectedCount;
2678
+ ((_u = (_t = props.selectedIds) === null || _t === void 0 ? void 0 : _t.length) !== null && _u !== void 0 ? _u : 0) >= props.maxSelectedCount;
2498
2679
  // INFO: one desktop row. groupAccent carries the group's colour so member
2499
2680
  // rows show the band's colour as a bar down their left edge.
2500
2681
  var handleRowDragStart = function (event, rowId) {
@@ -2549,7 +2730,68 @@ var NewTable = function (props) {
2549
2730
  event.stopPropagation();
2550
2731
  } },
2551
2732
  react_2.default.createElement(solid_2.EllipsisVerticalIcon, { className: "h-4 w-4" }))); };
2552
- var renderDesktopRow = function (row, index, groupAccent, dropGroup) {
2733
+ // INFO: props whose change does not redraw rows — a row is told about its own
2734
+ // record, display row, group and selection directly
2735
+ var ROW_INDEPENDENT_PROPS = new Set([
2736
+ "data",
2737
+ "spaceData",
2738
+ "groups",
2739
+ "groupLoadingStatus",
2740
+ "children",
2741
+ ]);
2742
+ // INFO: large or parent-held values compared by identity, not content
2743
+ var IDENTITY_PROPS = new Set(["selectedIds", "commentCounts"]);
2744
+ /**
2745
+ * A number that changes whenever anything every row draws from changes: the
2746
+ * table's props apart from the row data, its edit, drag and width state, and
2747
+ * the column type actions. Rows compare it to decide whether to draw again.
2748
+ */
2749
+ var handleGetTableVersion = function () {
2750
+ var rawProps = latestPropsRef.current;
2751
+ var propParts = Object.keys(rawProps)
2752
+ .filter(function (key) { return !ROW_INDEPENDENT_PROPS.has(key); })
2753
+ .sort()
2754
+ .map(function (key) {
2755
+ return "".concat(key, "=").concat(IDENTITY_PROPS.has(key)
2756
+ ? (0, rowRendering_1.handleGetIdentity)(rawProps[key])
2757
+ : (0, rowRendering_1.handleFingerprint)(rawProps[key]));
2758
+ });
2759
+ var key = __spreadArray(__spreadArray([], propParts, true), [
2760
+ (0, rowRendering_1.handleFingerprint)(columnTypeActions),
2761
+ isFixed,
2762
+ editDataRowId,
2763
+ editDataHeaderKey,
2764
+ editDataIsLoading,
2765
+ modalEditVisible,
2766
+ isDragSelecting,
2767
+ addData,
2768
+ addGroupId,
2769
+ dragArmedRowId,
2770
+ draggingRowId,
2771
+ dropGroupId,
2772
+ referenceLoading,
2773
+ pinViewWidth,
2774
+ (0, rowRendering_1.handleGetIdentity)(referencesOptions),
2775
+ (0, rowRendering_1.handleGetIdentity)(referencesDetails),
2776
+ (0, rowRendering_1.handleGetIdentity)(measuredPinWidths),
2777
+ (0, rowRendering_1.handleGetIdentity)(columnWidths),
2778
+ ], false).join("|");
2779
+ if (key !== tableVersionRef.current.key)
2780
+ tableVersionRef.current = {
2781
+ key: key,
2782
+ version: tableVersionRef.current.version + 1,
2783
+ };
2784
+ return tableVersionRef.current.version;
2785
+ };
2786
+ var renderDesktopRow = function (row, index, tableVersion, groupAccent, dropGroup) {
2787
+ var _a, _b, _c, _d;
2788
+ var isSelected = ((_b = (_a = props.selectedIds) === null || _a === void 0 ? void 0 : _a.includes(row.id)) !== null && _b !== void 0 ? _b : false) ||
2789
+ ((_c = props.selectAll) !== null && _c !== void 0 ? _c : false);
2790
+ return (react_2.default.createElement(rowRendering_1.NewTableMemoRow, { key: row.id, row: row, spaceRow: (_d = props.spaceData) === null || _d === void 0 ? void 0 : _d[index], index: index, groupAccent: groupAccent, dropGroupId: dropGroup === null || dropGroup === void 0 ? void 0 : dropGroup.id, isSelected: isSelected, editValue: editDataRowId === row.id ? editDataValue : undefined, tableVersion: tableVersion, render: function () {
2791
+ return renderDesktopRowContent(row, index, groupAccent, dropGroup);
2792
+ } }));
2793
+ };
2794
+ var renderDesktopRowContent = function (row, index, groupAccent, dropGroup) {
2553
2795
  var _a, _b, _c, _d, _e;
2554
2796
  var spaceRow = (_a = props.spaceData) === null || _a === void 0 ? void 0 : _a[index];
2555
2797
  var isSelected = ((_c = (_b = props.selectedIds) === null || _b === void 0 ? void 0 : _b.includes(row.id)) !== null && _c !== void 0 ? _c : false) ||
@@ -2588,7 +2830,20 @@ var NewTable = function (props) {
2588
2830
  ? "opacity-50 cursor-not-allowed"
2589
2831
  : ""))),
2590
2832
  flatColumns.map(function (col, colIndex) {
2591
- var _a, _b, _c, _d;
2833
+ var dragHandle = colIndex === 0 && canDragRows && dropGroup
2834
+ ? renderRowDragHandle(row.id)
2835
+ : null;
2836
+ // INFO: keep the action outside links and inline editors in every
2837
+ // cell variant
2838
+ var handleDecorateCell = function (cell) {
2839
+ var _a, _b, _c, _d, _e;
2840
+ if (colIndex !== 0 || (!hasRowActions && !dragHandle))
2841
+ return cell;
2842
+ return react_2.default.cloneElement(cell, {
2843
+ className: "".concat(cell.props.className, " ").concat((_a = TITLE_ACTIONS_PADDING_CLASS[titleRestPadding]) !== null && _a !== void 0 ? _a : "", " ").concat(props.onRowOpen && isTitleWidthFixed ? ((_b = TITLE_CHEVRON_PADDING_CLASS[titleChevronActionsWidth]) !== null && _b !== void 0 ? _b : "") : "", " ").concat((_d = (_c = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _c === void 0 ? void 0 : _c.className) !== null && _d !== void 0 ? _d : ""),
2844
+ style: __assign(__assign(__assign(__assign({}, cell.props.style), { paddingRight: titleRestPadding }), (_e = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _e === void 0 ? void 0 : _e.style), { position: getPinProps(col.key, false) ? "sticky" : "relative" }),
2845
+ }, cell.props.children, dragHandle, renderActivityButton(row.id, true, "".concat(rowBgClass, " ").concat(isRowHoverable ? (props.darkMode ? "group-hover:bg-gray-700" : "group-hover:bg-gray-100") : "")));
2846
+ };
2592
2847
  var renderDataCell = function () {
2593
2848
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9;
2594
2849
  // INFO: a coloured list cell is this table's to render, so it takes
@@ -2741,30 +2996,27 @@ var NewTable = function (props) {
2741
2996
  e.stopPropagation();
2742
2997
  handleEditDataOnClick(row.id, col.key, rowData);
2743
2998
  } }, renderTagLine(col, cellValue))));
2744
- // INFO: falls through to the plain text cell below unless hovered or
2745
- // mid-edit. Coloured list cells are exempt — read and edit are the same
2746
- // filled pill, so there is nothing to swap to.
2747
- if (isEditable &&
2748
- (handleColumnShowsTags(col) || handleIsCellLive(row.id, col.key))) {
2749
- var bareOverride = (_6 = (_5 = props.bareSettings) === null || _5 === void 0 ? void 0 : _5.bareListDescription) === null || _6 === void 0 ? void 0 : _6.call(_5, col.key, cellValue);
2750
- if (!bareOverride)
2751
- return renderEditDataInputs(colIndex, col, rowData, row.id, rowBgClass, isRowHoverable);
2752
- }
2753
- return (react_2.default.createElement("td", __assign({ key: col.key }, (isEditable ? handleCellHoverProps(row.id, col.key) : {}), { "data-cell-key": col.key, "data-pin-key": leftPinned.includes(col.key) || rightPinned.includes(col.key)
2999
+ // INFO: coloured list cells are exempt from the hover swap — read and
3000
+ // edit are the same filled pill, so there is nothing to swap to
3001
+ var bareOverride = isEditable
3002
+ ? (_6 = (_5 = props.bareSettings) === null || _5 === void 0 ? void 0 : _5.bareListDescription) === null || _6 === void 0 ? void 0 : _6.call(_5, col.key, cellValue)
3003
+ : undefined;
3004
+ if (isEditable && !bareOverride && handleColumnShowsTags(col))
3005
+ return renderEditDataInputs(colIndex, col, rowData, row.id, rowBgClass, isRowHoverable);
3006
+ var readCell = (react_2.default.createElement("td", { key: col.key, "data-cell-key": col.key, "data-pin-key": leftPinned.includes(col.key) || rightPinned.includes(col.key)
2754
3007
  ? col.key
2755
- : undefined, className: "".concat(cellPadding, " ").concat(isEditable ? "".concat(editCellMinHeight, " align-middle ").concat(handleCellMinWidth(col.type)) : "", " text-sm ").concat(colIndex === 0 && props.onClickRow ? titleFontColor : cellFontColor, " ").concat(handleReadCellWidthClass(col), " ").concat((_8 = (_7 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _7 === void 0 ? void 0 : _7.className) !== null && _8 !== void 0 ? _8 : ""), style: (_9 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _9 === void 0 ? void 0 : _9.style, "data-row-link-cell": props.newTabUrl && props.onClickRow ? "" : undefined }), handleIsReadCellFixed(col) ? (react_2.default.createElement("div", { className: "w-0 min-w-full truncate" }, renderReadCellValue(col, row, cellValue))) : (renderReadCellValue(col, row, cellValue))));
3008
+ : undefined, className: "".concat(cellPadding, " ").concat(isEditable ? "".concat(editCellMinHeight, " align-middle ").concat(handleCellMinWidth(col.type)) : "", " text-sm ").concat(colIndex === 0 && props.onClickRow ? titleFontColor : cellFontColor, " ").concat(handleReadCellWidthClass(col), " ").concat((_8 = (_7 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _7 === void 0 ? void 0 : _7.className) !== null && _8 !== void 0 ? _8 : ""), style: (_9 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _9 === void 0 ? void 0 : _9.style, "data-row-link-cell": props.newTabUrl && props.onClickRow ? "" : undefined }, handleIsReadCellFixed(col) ? (react_2.default.createElement("div", { className: "w-0 min-w-full truncate" }, renderReadCellValue(col, row, cellValue))) : (renderReadCellValue(col, row, cellValue))));
3009
+ if (!isEditable || bareOverride)
3010
+ return readCell;
3011
+ // INFO: the plain text cell until hovered or mid-edit, then its input
3012
+ return (react_2.default.createElement(rowRendering_1.NewTableHoverCell, { key: col.key, editing: handleIsCellEditing(row.id, col.key), renderRead: function () { return handleDecorateCell(readCell); }, renderLive: function () {
3013
+ return handleDecorateCell(renderEditDataInputs(colIndex, col, rowData, row.id, rowBgClass, isRowHoverable));
3014
+ } }));
2756
3015
  };
2757
3016
  var cell = renderDataCell();
2758
- var dragHandle = colIndex === 0 && canDragRows && dropGroup
2759
- ? renderRowDragHandle(row.id)
2760
- : null;
2761
- if (colIndex !== 0 || (!hasRowActions && !dragHandle))
2762
- return cell;
2763
- // Keep the action outside links and inline editors in every cell variant.
2764
- return react_2.default.cloneElement(cell, {
2765
- className: "".concat(cell.props.className, " ").concat((_a = TITLE_ACTIONS_PADDING_CLASS[titleActionsWidth]) !== null && _a !== void 0 ? _a : "", " ").concat((_c = (_b = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _b === void 0 ? void 0 : _b.className) !== null && _c !== void 0 ? _c : ""),
2766
- style: __assign(__assign(__assign(__assign({}, cell.props.style), { paddingRight: titleActionsWidth }), (_d = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _d === void 0 ? void 0 : _d.style), { position: getPinProps(col.key, false) ? "sticky" : "relative" }),
2767
- }, cell.props.children, dragHandle, renderActivityButton(row.id, true));
3017
+ return cell.type === rowRendering_1.NewTableHoverCell
3018
+ ? cell
3019
+ : handleDecorateCell(cell);
2768
3020
  }),
2769
3021
  renderAddColumnCell(rowBgClass, isRowHoverable),
2770
3022
  renderActionColumnCell(row.id, rowBgClass, isRowHoverable)));
@@ -2772,12 +3024,48 @@ var NewTable = function (props) {
2772
3024
  // INFO: with groups, each group is a tinted band row (chevron, title, count)
2773
3025
  // followed by its member rows; collapsing a band hides them. Without groups,
2774
3026
  // the plain row list.
3027
+ // INFO: a spacer row standing in for rows not drawn. The first one of a
3028
+ // group marks where its rows start, so it is drawn even at height 0
3029
+ var renderVirtualSpacer = function (key, height, columnCount, startOf) { return (react_2.default.createElement("tr", { key: key, "aria-hidden": "true", "data-virtual-spacer": "", "data-virtual-start": startOf, className: "border-0" },
3030
+ react_2.default.createElement("td", { colSpan: columnCount, style: { height: height, padding: 0, border: 0 } }))); };
3031
+ /**
3032
+ * A group's rows. A group with fewer than VIRTUAL_MIN_ROWS loaded rows draws
3033
+ * them all; a larger one draws only the rows near the screen and the row
3034
+ * being edited, with spacers as tall as the rows they stand in for.
3035
+ */
3036
+ var renderMemberRows = function (groupKey, memberIndexes, tableVersion, columnCount, virtualGroups, groupAccent, group) {
3037
+ var _a;
3038
+ var renderMember = function (rowIndex) {
3039
+ return renderDesktopRow(props.data[rowIndex], rowIndex, tableVersion, groupAccent, group);
3040
+ };
3041
+ if (memberIndexes.length < rowRendering_1.VIRTUAL_MIN_ROWS)
3042
+ return memberIndexes.map(renderMember);
3043
+ var rowIds = memberIndexes.map(function (rowIndex) { return props.data[rowIndex].id; });
3044
+ virtualGroups.push({ id: groupKey, rowIds: rowIds });
3045
+ var offsets = (0, rowRendering_1.handleBuildRowOffsets)(rowIds, rowHeightsRef.current, rowEstimateRef.current);
3046
+ var editingIndex = editDataRowId ? rowIds.indexOf(editDataRowId) : -1;
3047
+ var segments = (0, rowRendering_1.handleBuildRowSegments)(offsets, (_a = virtualRanges[groupKey]) !== null && _a !== void 0 ? _a : [0, rowRendering_1.VIRTUAL_INITIAL_ROWS], editingIndex >= 0 ? [editingIndex] : []);
3048
+ var firstGap = "gap" in segments[0] ? segments[0].gap : 0;
3049
+ var rendered = [
3050
+ renderVirtualSpacer("virtual-".concat(groupKey, "-start"), firstGap, columnCount, groupKey),
3051
+ ];
3052
+ segments.forEach(function (segment, segmentIndex) {
3053
+ if ("gap" in segment) {
3054
+ if (segmentIndex > 0)
3055
+ rendered.push(renderVirtualSpacer("virtual-".concat(groupKey, "-").concat(segmentIndex), segment.gap, columnCount));
3056
+ return;
3057
+ }
3058
+ segment.rows.forEach(function (memberIndex) {
3059
+ return rendered.push(renderMember(memberIndexes[memberIndex]));
3060
+ });
3061
+ });
3062
+ return rendered;
3063
+ };
2775
3064
  var renderDesktopRows = function () {
2776
3065
  var _a;
2777
- if (!props.groups || props.groups.length === 0) {
2778
- return props.data.map(function (row, index) { return renderDesktopRow(row, index); });
2779
- }
2780
- var indexById = new Map(props.data.map(function (row, index) { return [row.id, index]; }));
3066
+ var tableVersion = handleGetTableVersion();
3067
+ var virtualGroups = [];
3068
+ virtualGroupsRef.current = virtualGroups;
2781
3069
  // INFO: a group band spans the whole row, so its colSpan has to count the
2782
3070
  // same extra cells the rows actually render — the checkbox, the add-column
2783
3071
  // spacer and the action cell. It was a bare +1 before, which happened to
@@ -2787,6 +3075,10 @@ var NewTable = function (props) {
2787
3075
  (props.checkbox ? 1 : 0) +
2788
3076
  (((_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.addColumnEnabled) ? 1 : 0) +
2789
3077
  (handleShowsActionColumn() ? 1 : 0);
3078
+ if (!props.groups || props.groups.length === 0) {
3079
+ return renderMemberRows("all", props.data.map(function (_row, index) { return index; }), tableVersion, columnCount, virtualGroups);
3080
+ }
3081
+ var indexById = new Map(props.data.map(function (row, index) { return [row.id, index]; }));
2790
3082
  return props.groups.map(function (group) {
2791
3083
  var _a, _b, _c, _d, _e;
2792
3084
  var colourKey = (_a = group.colour) !== null && _a !== void 0 ? _a : "none";
@@ -2819,11 +3111,7 @@ var NewTable = function (props) {
2819
3111
  react_2.default.createElement("span", null, group.title),
2820
3112
  react_2.default.createElement("span", { className: "rounded-full bg-white/70 px-2 py-0.5 text-[11px] font-medium normal-case tracking-normal" }, (_e = (_d = (_c = group.summary) === null || _c === void 0 ? void 0 : _c.count) !== null && _d !== void 0 ? _d : group.count) !== null && _e !== void 0 ? _e : memberIndexes.length)))),
2821
3113
  !isCollapsed &&
2822
- memberIndexes
2823
- .slice(0, handleGetGroupVisibleCount(group.id))
2824
- .map(function (rowIndex) {
2825
- return renderDesktopRow(props.data[rowIndex], rowIndex, colourKey, group);
2826
- }),
3114
+ renderMemberRows(group.id, memberIndexes.slice(0, handleGetGroupVisibleCount(group.id)), tableVersion, columnCount, virtualGroups, colourKey, group),
2827
3115
  renderGroupShowMoreRow(group.id, memberIndexes.length, columnCount, isCollapsed),
2828
3116
  renderGroupLoadMoreRow(group.id, columnCount, isCollapsed, isPending),
2829
3117
  renderGroupPagerRow(group, columnCount, isCollapsed),
@@ -3162,11 +3450,11 @@ var NewTable = function (props) {
3162
3450
  var isIdLike_1 = function (c) {
3163
3451
  return /^id$/i.test(c.key) || /^_id$/i.test(c.key);
3164
3452
  };
3165
- var titleCol_1 = (_u = flatColumns.find(function (c) { return !isIdLike_1(c); })) !== null && _u !== void 0 ? _u : flatColumns[0];
3453
+ var titleCol_1 = (_v = flatColumns.find(function (c) { return !isIdLike_1(c); })) !== null && _v !== void 0 ? _v : flatColumns[0];
3166
3454
  var expandHeaderBg_1 = props.darkMode ? "bg-gray-700" : "bg-gray-100";
3167
3455
  var expandHeaderFontColor_1 = props.darkMode ? "text-white" : "";
3168
3456
  var headerBgColor_1 = props.darkMode
3169
- ? ((_v = props.darkModeBg) !== null && _v !== void 0 ? _v : "bg-gray-900")
3457
+ ? ((_w = props.darkModeBg) !== null && _w !== void 0 ? _w : "bg-gray-900")
3170
3458
  : "";
3171
3459
  var headerFontColor_1 = props.darkMode ? "text-white" : "";
3172
3460
  // INFO: renders tag + trailing text adjacent to the Collapse title
@@ -3267,18 +3555,18 @@ var NewTable = function (props) {
3267
3555
  })))));
3268
3556
  };
3269
3557
  return (react_2.default.createElement("div", null,
3270
- react_2.default.createElement("div", { className: "w-full ".concat(((_w = props.mobileTooltip) === null || _w === void 0 ? void 0 : _w.tooltip) ? "overflow-visible" : "overflow-hidden", " ").concat(isFlat
3558
+ react_2.default.createElement("div", { className: "w-full ".concat(((_x = props.mobileTooltip) === null || _x === void 0 ? void 0 : _x.tooltip) ? "overflow-visible" : "overflow-hidden", " ").concat(isFlat
3271
3559
  ? ""
3272
- : "border ".concat(borderRadius, " ").concat(borderColor, " ").concat(bgColor, " shadow-sm"), " divide-y ").concat(dividerColor, " ").concat((_x = props.className) !== null && _x !== void 0 ? _x : "") },
3560
+ : "border ".concat(borderRadius, " ").concat(borderColor, " ").concat(bgColor, " shadow-sm"), " divide-y ").concat(dividerColor, " ").concat((_y = props.className) !== null && _y !== void 0 ? _y : "") },
3273
3561
  react_2.default.createElement("div", { className: "p-3 flex items-center justify-between" },
3274
3562
  renderSelectAll(),
3275
3563
  react_2.default.createElement("div", { className: "flex items-center gap-2" },
3276
3564
  renderSelectedCount(),
3277
- ((_y = props.advSettings) === null || _y === void 0 ? void 0 : _y.addColumnEnabled) && (react_2.default.createElement(iconButton_1.IconButton, { testId: "table-add-column-btn-mobile", icon: react_2.default.createElement(solid_1.PlusIcon, { className: "h-5 w-5 text-gray" }), onClick: function () { return handleAddColumnModal("new"); } })))),
3565
+ ((_z = props.advSettings) === null || _z === void 0 ? void 0 : _z.addColumnEnabled) && (react_2.default.createElement(iconButton_1.IconButton, { testId: "table-add-column-btn-mobile", icon: react_2.default.createElement(solid_1.PlusIcon, { className: "h-5 w-5 text-gray" }), onClick: function () { return handleAddColumnModal("new"); } })))),
3278
3566
  props.loading &&
3279
3567
  Array.from({ length: 3 }).map(function (_, i) { return (react_2.default.createElement("div", { key: "skeleton-".concat(i), className: "p-4" },
3280
3568
  react_2.default.createElement("div", { className: "h-5 w-3/4 rounded-md animate-pulse ".concat(props.darkMode ? "bg-gray-700" : "bg-gray-200") }))); }),
3281
- !props.loading && props.data.length === 0 && (react_2.default.createElement("p", { className: "p-4 text-center text-sm ".concat(cellFontColor) }, (_z = props.emptyTitle) !== null && _z !== void 0 ? _z : "No items")),
3569
+ !props.loading && props.data.length === 0 && (react_2.default.createElement("p", { className: "p-4 text-center text-sm ".concat(cellFontColor) }, (_0 = props.emptyTitle) !== null && _0 !== void 0 ? _0 : "No items")),
3282
3570
  !props.loading &&
3283
3571
  props.data.map(function (row, index) {
3284
3572
  var _a, _b, _c, _d, _e, _f, _g;
@@ -3349,13 +3637,13 @@ var NewTable = function (props) {
3349
3637
  : [])[0];
3350
3638
  return WIDE_EDIT_TYPES.includes((_a = selectedDS === null || selectedDS === void 0 ? void 0 : selectedDS.type) !== null && _a !== void 0 ? _a : "") ? "4xl" : "2xl";
3351
3639
  };
3352
- return (react_2.default.createElement("div", { className: "w-full ".concat((_0 = props.className) !== null && _0 !== void 0 ? _0 : "") },
3640
+ return (react_2.default.createElement("div", { className: "w-full ".concat((_1 = props.className) !== null && _1 !== void 0 ? _1 : "") },
3353
3641
  react_2.default.createElement(modal_1.Modal, { open: filterModal ? true : false, title: "Filter Options", renderContent: function () {
3354
3642
  var _a, _b;
3355
3643
  return (react_2.default.createElement("div", { className: "pb-44" },
3356
3644
  react_2.default.createElement("div", { className: "pb-48" }, (_b = (_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.renderFilterElements) === null || _b === void 0 ? void 0 : _b.call(_a, filterModal))));
3357
3645
  }, onClose: function () { return setFilterModal(""); } }),
3358
- react_2.default.createElement(modal_1.Modal, { open: modalEditVisible, title: (_2 = (_1 = flatColumns.find(function (eachCol) { return eachCol.key === editDataHeaderKey; })) === null || _1 === void 0 ? void 0 : _1.title) !== null && _2 !== void 0 ? _2 : "Edit", maxWidth: handleGetEditModalWidth(), onClose: handleModalEditClose, renderContent: function () {
3646
+ react_2.default.createElement(modal_1.Modal, { open: modalEditVisible, title: (_3 = (_2 = flatColumns.find(function (eachCol) { return eachCol.key === editDataHeaderKey; })) === null || _2 === void 0 ? void 0 : _2.title) !== null && _3 !== void 0 ? _3 : "Edit", maxWidth: handleGetEditModalWidth(), onClose: handleModalEditClose, renderContent: function () {
3359
3647
  var _a, _b, _c, _d;
3360
3648
  var selectedCol = flatColumns.find(function (eachCol) { return eachCol.key === editDataHeaderKey; });
3361
3649
  if (!selectedCol)
@@ -3401,7 +3689,7 @@ var NewTable = function (props) {
3401
3689
  react_2.default.createElement(scrollShadow_1.ScrollShadow, { className: "w-full overflow-x-auto ".concat(isFlat
3402
3690
  ? ""
3403
3691
  : "".concat(borderRadius, " border ").concat(borderColor, " ").concat(bgColor, " shadow-sm")), darkMode: props.darkMode },
3404
- (props.selectAll || ((_4 = (_3 = props.selectedIds) === null || _3 === void 0 ? void 0 : _3.length) !== null && _4 !== void 0 ? _4 : 0) > 0) &&
3692
+ (props.selectAll || ((_5 = (_4 = props.selectedIds) === null || _4 === void 0 ? void 0 : _4.length) !== null && _5 !== void 0 ? _5 : 0) > 0) &&
3405
3693
  (!props.multiActionFloatingBtns ||
3406
3694
  (props.multiActionFloatingBtns &&
3407
3695
  props.multiActionFloatingBtns.length <= 0)) && (react_2.default.createElement("div", { className: "sticky left-0 flex flex-row items-center px-4 py-3 gap-x-2" },
@@ -3429,7 +3717,7 @@ var NewTable = function (props) {
3429
3717
  (addData
3430
3718
  ? !isAddRowPinned && !addGroupId && renderAddDataRow()
3431
3719
  : !handleHasGroupAddRows() && renderEmptyAddRow()))),
3432
- !props.loading && props.data.length === 0 && (react_2.default.createElement("div", { className: "p-4 text-sm ".concat(cellFontColor, " text-center sticky left-0") }, (_5 = props.emptyTitle) !== null && _5 !== void 0 ? _5 : "No items"))),
3720
+ !props.loading && props.data.length === 0 && (react_2.default.createElement("div", { className: "p-4 text-sm ".concat(cellFontColor, " text-center sticky left-0") }, (_6 = props.emptyTitle) !== null && _6 !== void 0 ? _6 : "No items"))),
3433
3721
  renderPinnedAddButton(),
3434
3722
  react_2.default.createElement(newPagination_1.NewPagination, { paginationType: props.paginationType, pageIndex: props.pageIndex, limit: props.limit, size: props.size, cursor: props.cursor, resultCount: props.data.length, customPaginationSize: props.customPaginationSize, hidePagination: props.hidePagination, darkMode: props.darkMode, darkModeBg: props.darkModeBg, handleUpdatePageIndex: props.handleUpdatePageIndex, className: "".concat(props.fixedPagination
3435
3723
  ? "pagination-container w-full ".concat(borderColor, " ").concat(isFixed ? "fixed bottom-0 left-0 z-10" : "sticky top-0 left-0")