blixify-ui-web 1.2.228 → 1.2.230

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 (59) hide show
  1. package/lib/components/data/columnTypes/context.d.ts +1 -0
  2. package/lib/components/data/columnTypes/context.d.ts.map +1 -1
  3. package/lib/components/data/columnTypes/context.js.map +1 -1
  4. package/lib/components/data/columnTypes/dateRangeCell.d.ts.map +1 -1
  5. package/lib/components/data/columnTypes/dateRangeCell.js +8 -2
  6. package/lib/components/data/columnTypes/dateRangeCell.js.map +1 -1
  7. package/lib/components/data/columnTypes/dateWarning.d.ts +6 -0
  8. package/lib/components/data/columnTypes/dateWarning.d.ts.map +1 -0
  9. package/lib/components/data/columnTypes/dateWarning.js +46 -0
  10. package/lib/components/data/columnTypes/dateWarning.js.map +1 -0
  11. package/lib/components/data/columnTypes/defaultColours.d.ts +22 -0
  12. package/lib/components/data/columnTypes/defaultColours.d.ts.map +1 -0
  13. package/lib/components/data/columnTypes/defaultColours.js +101 -0
  14. package/lib/components/data/columnTypes/defaultColours.js.map +1 -0
  15. package/lib/components/data/columnTypes/groupSections.d.ts +13 -0
  16. package/lib/components/data/columnTypes/groupSections.d.ts.map +1 -1
  17. package/lib/components/data/columnTypes/groupSections.js +19 -1
  18. package/lib/components/data/columnTypes/groupSections.js.map +1 -1
  19. package/lib/components/data/dataGraph/index.d.ts +1 -0
  20. package/lib/components/data/dataGraph/index.d.ts.map +1 -1
  21. package/lib/components/data/dataGraph/index.js +74 -25
  22. package/lib/components/data/dataGraph/index.js.map +1 -1
  23. package/lib/components/data/dataTemplate/chartBuilder.d.ts +1 -1
  24. package/lib/components/data/dataTemplate/chartBuilder.d.ts.map +1 -1
  25. package/lib/components/data/dataTemplate/chartBuilder.js +11 -19
  26. package/lib/components/data/dataTemplate/chartBuilder.js.map +1 -1
  27. package/lib/components/data/dataTemplate/chartView.d.ts +2 -0
  28. package/lib/components/data/dataTemplate/chartView.d.ts.map +1 -1
  29. package/lib/components/data/dataTemplate/chartView.js +8 -5
  30. package/lib/components/data/dataTemplate/chartView.js.map +1 -1
  31. package/lib/components/data/dataTemplate/dataStateModel.d.ts +10 -0
  32. package/lib/components/data/dataTemplate/dataStateModel.d.ts.map +1 -1
  33. package/lib/components/data/dataTemplate/dataStateModel.js.map +1 -1
  34. package/lib/components/data/dataTemplate/index.d.ts.map +1 -1
  35. package/lib/components/data/dataTemplate/index.js +461 -245
  36. package/lib/components/data/dataTemplate/index.js.map +1 -1
  37. package/lib/components/data/dataTemplate/model.d.ts +1 -0
  38. package/lib/components/data/dataTemplate/model.d.ts.map +1 -1
  39. package/lib/components/data/listModule.d.ts +1 -1
  40. package/lib/components/data/listModule.d.ts.map +1 -1
  41. package/lib/components/data/listModule.js +15 -2
  42. package/lib/components/data/listModule.js.map +1 -1
  43. package/lib/components/display/groupSection/index.d.ts +6 -0
  44. package/lib/components/display/groupSection/index.d.ts.map +1 -1
  45. package/lib/components/display/groupSection/index.js +5 -2
  46. package/lib/components/display/groupSection/index.js.map +1 -1
  47. package/lib/components/display/newTable/index.d.ts +13 -0
  48. package/lib/components/display/newTable/index.d.ts.map +1 -1
  49. package/lib/components/display/newTable/index.js +323 -126
  50. package/lib/components/display/newTable/index.js.map +1 -1
  51. package/lib/components/display/recordActions/index.d.ts +1 -0
  52. package/lib/components/display/recordActions/index.d.ts.map +1 -1
  53. package/lib/components/display/recordActions/index.js +6 -3
  54. package/lib/components/display/recordActions/index.js.map +1 -1
  55. package/lib/components/input/select/index.d.ts.map +1 -1
  56. package/lib/components/input/select/index.js +13 -4
  57. package/lib/components/input/select/index.js.map +1 -1
  58. package/lib/tail.css +1 -1
  59. package/package.json +1 -1
@@ -127,6 +127,8 @@ var recordActions_1 = require("../recordActions");
127
127
  var scrollShadow_1 = require("../scrollShadow");
128
128
  var columnWidth_1 = require("./columnWidth");
129
129
  var tag_1 = require("../tag");
130
+ var defaultColours_1 = require("../../data/columnTypes/defaultColours");
131
+ var personAvatar_1 = require("../../data/columnTypes/personAvatar");
130
132
  var utils_2 = require("../../input/utils");
131
133
  // INFO: rows a section draws before its "Show more" — a 2,000-row section
132
134
  // would otherwise mount every row (and every cell's controls) at once
@@ -290,20 +292,6 @@ var handleNextOptionKey = function () {
290
292
  columnOptionKey += 1;
291
293
  return columnOptionKey;
292
294
  };
293
- var OPTION_COLOURS = [
294
- "primary",
295
- "red",
296
- "blue",
297
- "green",
298
- "yellow",
299
- "indigo",
300
- "purple",
301
- "lime",
302
- "sky",
303
- "pink",
304
- "orange",
305
- "dark",
306
- ];
307
295
  // INFO: literal classes so Tailwind emits them
308
296
  var OPTION_SWATCH_CLASS = {
309
297
  "": "bg-white border-gray-300",
@@ -364,8 +352,16 @@ var handleGetEditableColumnTypes = function (type) {
364
352
  exports.handleGetEditableColumnTypes = handleGetEditableColumnTypes;
365
353
  // INFO: group band (tinted) — shared with the list and grid sections
366
354
  var BAND_CLASS = groupSection_1.GROUP_BAND_CLASS;
355
+ // INFO: the cell padding is an !important class, which beats an inline
356
+ // padding, so the room for the title's actions is an !important class too —
357
+ // without it a squeezed title (a pinned column on a phone) runs under them
358
+ var TITLE_ACTIONS_PADDING_CLASS = {
359
+ 48: "!pr-[48px]",
360
+ 84: "!pr-[84px]",
361
+ };
367
362
  var ACCENT_CLASS = {
368
363
  default: "border-primary-500",
364
+ primary: "border-primary-500",
369
365
  red: "border-red-500",
370
366
  blue: "border-blue-500",
371
367
  green: "border-green-500",
@@ -392,7 +388,7 @@ var handleGetListColour = function (col, value) {
392
388
  return column.listSelectionColour[index] || undefined;
393
389
  };
394
390
  var NewTable = function (props) {
395
- 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;
391
+ 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;
396
392
  var columns = (_b = (_a = props.columns) !== null && _a !== void 0 ? _a : props.header) !== null && _b !== void 0 ? _b : [];
397
393
  var defaultLimit = 10;
398
394
  // INFO: flatten groupData columns so both mobile and desktop share the same
@@ -427,6 +423,7 @@ var NewTable = function (props) {
427
423
  // INFO: the share of the scrolling view the left pins may cover, and the
428
424
  // narrowest the first pinned column is made to fit it
429
425
  var PIN_VIEW_SHARE = 0.6;
426
+ var TITLE_PIN_VIEW_SHARE = 0.7;
430
427
  var MIN_PIN_WIDTH = 96;
431
428
  // INFO: room for the add row's confirm and cancel buttons plus cell padding.
432
429
  // Only enforced when right-pinned columns need to know where to start.
@@ -462,57 +459,58 @@ var NewTable = function (props) {
462
459
  flatColumns.length = 0;
463
460
  flatColumns.push.apply(flatColumns, __spreadArray(__spreadArray(__spreadArray([], leftCols, false), middleCols, false), rightCols, false));
464
461
  }
465
- var _5 = (0, react_2.useState)(props.fixedPagination ? true : false), isFixed = _5[0], setIsFixed = _5[1];
462
+ var _6 = (0, react_2.useState)(props.fixedPagination ? true : false), isFixed = _6[0], setIsFixed = _6[1];
466
463
  // INFO: the pencil and the bubble sit over the title cell's right padding,
467
464
  // 36px each plus 4px from the edge and 8px from the text — kept clear so
468
465
  // they never cover the title, and added to the cell's measured width so the
469
466
  // title keeps its own width instead of wrapping
470
467
  var hasRowActions = !!props.onRowActivity || !!props.onRowEdit;
468
+ var canDragRows = !!props.onMoveRowToGroup && !!((_l = props.groups) === null || _l === void 0 ? void 0 : _l.length);
471
469
  var titleActionsWidth = hasRowActions
472
470
  ? (props.onRowActivity && props.onRowEdit ? 2 : 1) * 36 + 12
473
471
  : 0;
474
472
  //=====================================================================================
475
473
  // SECTION: Advanced Settings
476
474
  //=====================================================================================
477
- var _6 = (0, react_2.useState)(""), filterModal = _6[0], setFilterModal = _6[1];
478
- var _7 = (0, react_2.useState)(""), addColumnModal = _7[0], setAddColumnModal = _7[1];
475
+ var _7 = (0, react_2.useState)(""), filterModal = _7[0], setFilterModal = _7[1];
476
+ var _8 = (0, react_2.useState)(""), addColumnModal = _8[0], setAddColumnModal = _8[1];
479
477
  // INFO: what a DataTemplate around the table lets a cell save
480
478
  var columnTypeActions = (0, react_2.useContext)(context_1.ColumnTypeContext);
481
- var _8 = (0, react_2.useState)(""), newColumnName = _8[0], setNewColumnName = _8[1];
482
- var _9 = (0, react_2.useState)("string"), newColumnType = _9[0], setNewColumnType = _9[1];
483
- var _10 = (0, react_2.useState)(""), newColumnRefSpace = _10[0], setNewColumnRefSpace = _10[1];
484
- var _11 = (0, react_2.useState)(""), newColumnRefLabel = _11[0], setNewColumnRefLabel = _11[1];
485
- var _12 = (0, react_2.useState)([]), newColumnOptions = _12[0], setNewColumnOptions = _12[1];
479
+ var _9 = (0, react_2.useState)(""), newColumnName = _9[0], setNewColumnName = _9[1];
480
+ var _10 = (0, react_2.useState)("string"), newColumnType = _10[0], setNewColumnType = _10[1];
481
+ var _11 = (0, react_2.useState)(""), newColumnRefSpace = _11[0], setNewColumnRefSpace = _11[1];
482
+ var _12 = (0, react_2.useState)(""), newColumnRefLabel = _12[0], setNewColumnRefLabel = _12[1];
483
+ var _13 = (0, react_2.useState)([]), newColumnOptions = _13[0], setNewColumnOptions = _13[1];
486
484
  // INFO: the option row whose colour palette is open
487
- var _13 = (0, react_2.useState)(null), optionColourKey = _13[0], setOptionColourKey = _13[1];
488
- var _14 = (0, react_2.useState)(false), newColumnRequired = _14[0], setNewColumnRequired = _14[1];
489
- var _15 = (0, react_2.useState)(false), newColumnUnique = _15[0], setNewColumnUnique = _15[1];
490
- var _16 = (0, react_2.useState)(false), newColumnReadOnly = _16[0], setNewColumnReadOnly = _16[1];
491
- var _17 = (0, react_2.useState)(""), newColumnRatingMax = _17[0], setNewColumnRatingMax = _17[1];
492
- var _18 = (0, react_2.useState)(""), newColumnButtonLabel = _18[0], setNewColumnButtonLabel = _18[1];
493
- var _19 = (0, react_2.useState)(""), newColumnButtonColour = _19[0], setNewColumnButtonColour = _19[1];
494
- var _20 = (0, react_2.useState)(""), newColumnButtonConfirm = _20[0], setNewColumnButtonConfirm = _20[1];
495
- var _21 = (0, react_2.useState)(false), addingColumn = _21[0], setAddingColumn = _21[1];
485
+ var _14 = (0, react_2.useState)(null), optionColourKey = _14[0], setOptionColourKey = _14[1];
486
+ var _15 = (0, react_2.useState)(false), newColumnRequired = _15[0], setNewColumnRequired = _15[1];
487
+ var _16 = (0, react_2.useState)(false), newColumnUnique = _16[0], setNewColumnUnique = _16[1];
488
+ var _17 = (0, react_2.useState)(false), newColumnReadOnly = _17[0], setNewColumnReadOnly = _17[1];
489
+ var _18 = (0, react_2.useState)(""), newColumnRatingMax = _18[0], setNewColumnRatingMax = _18[1];
490
+ var _19 = (0, react_2.useState)(""), newColumnButtonLabel = _19[0], setNewColumnButtonLabel = _19[1];
491
+ var _20 = (0, react_2.useState)(""), newColumnButtonColour = _20[0], setNewColumnButtonColour = _20[1];
492
+ var _21 = (0, react_2.useState)(""), newColumnButtonConfirm = _21[0], setNewColumnButtonConfirm = _21[1];
493
+ var _22 = (0, react_2.useState)(false), addingColumn = _22[0], setAddingColumn = _22[1];
496
494
  // INFO: the formula as shown in the builder — column names, not ids
497
- var _22 = (0, react_2.useState)(""), newColumnFormula = _22[0], setNewColumnFormula = _22[1];
495
+ var _23 = (0, react_2.useState)(""), newColumnFormula = _23[0], setNewColumnFormula = _23[1];
498
496
  var addColumnPopUpRef = (0, react_2.useRef)(null);
499
497
  // INFO: the column being changed — empty while the panel adds a new one
500
- var _23 = (0, react_2.useState)(null), editingColumn = _23[0], setEditingColumn = _23[1];
498
+ var _24 = (0, react_2.useState)(null), editingColumn = _24[0], setEditingColumn = _24[1];
501
499
  //=====================================================================================
502
500
  // SECTION: Editable & Addable cells
503
501
  //=====================================================================================
504
- var _24 = (0, react_2.useState)(""), editDataRowId = _24[0], setEditDataRowId = _24[1];
505
- var _25 = (0, react_2.useState)(""), editDataHeaderKey = _25[0], setEditDataHeaderKey = _25[1];
502
+ var _25 = (0, react_2.useState)(""), editDataRowId = _25[0], setEditDataRowId = _25[1];
503
+ var _26 = (0, react_2.useState)(""), editDataHeaderKey = _26[0], setEditDataHeaderKey = _26[1];
506
504
  // INFO: an editable table used to mount an input in every cell — it read as a
507
505
  // form, and a row click always landed on a child input. Only the hovered cell
508
506
  // becomes its input now.
509
- var _26 = (0, react_2.useState)(null), hoveredCell = _26[0], setHoveredCell = _26[1];
510
- var _27 = (0, react_2.useState)(false), modalEditVisible = _27[0], setModalEditVisible = _27[1];
507
+ var _27 = (0, react_2.useState)(null), hoveredCell = _27[0], setHoveredCell = _27[1];
508
+ var _28 = (0, react_2.useState)(false), modalEditVisible = _28[0], setModalEditVisible = _28[1];
511
509
  // INFO: whether the modal's signature pad has been drawn on
512
- var _28 = (0, react_2.useState)(false), signatureSigning = _28[0], setSignatureSigning = _28[1];
513
- var _29 = (0, react_2.useState)([]), collapsedGroupIds = _29[0], setCollapsedGroupIds = _29[1];
510
+ var _29 = (0, react_2.useState)(false), signatureSigning = _29[0], setSignatureSigning = _29[1];
511
+ var _30 = (0, react_2.useState)([]), collapsedGroupIds = _30[0], setCollapsedGroupIds = _30[1];
514
512
  // INFO: rows shown per section when the sections do not page themselves
515
- var _30 = (0, react_2.useState)({}), groupVisibleCounts = _30[0], setGroupVisibleCounts = _30[1];
513
+ var _31 = (0, react_2.useState)({}), groupVisibleCounts = _31[0], setGroupVisibleCounts = _31[1];
516
514
  // INFO: per-group scroll pagination. One sentinel element per band, observed
517
515
  // by a single IntersectionObserver that fires props.onGroupLoadMore when a
518
516
  // band's sentinel scrolls into view. The debounce guard stops repeat fires
@@ -528,33 +526,42 @@ var NewTable = function (props) {
528
526
  var lastSelectedRowRef = (0, react_2.useRef)(null);
529
527
  var dragSelectRef = (0, react_2.useRef)(null);
530
528
  var suppressNextClickRef = (0, react_2.useRef)(false);
531
- var _31 = (0, react_2.useState)(false), isDragSelecting = _31[0], setIsDragSelecting = _31[1];
532
- var _32 = (0, react_2.useState)(0), copiedCount = _32[0], setCopiedCount = _32[1];
533
- var _33 = (0, react_2.useState)({}), editDataValue = _33[0], setEditDataValue = _33[1];
534
- var _34 = (0, react_2.useState)(false), editDataIsLoading = _34[0], setEditDataIsLoading = _34[1];
529
+ var _32 = (0, react_2.useState)(false), isDragSelecting = _32[0], setIsDragSelecting = _32[1];
530
+ var _33 = (0, react_2.useState)(0), copiedCount = _33[0], setCopiedCount = _33[1];
531
+ var _34 = (0, react_2.useState)({}), editDataValue = _34[0], setEditDataValue = _34[1];
532
+ var _35 = (0, react_2.useState)(false), editDataIsLoading = _35[0], setEditDataIsLoading = _35[1];
535
533
  // INFO: true while the empty bottom row is being filled in; the row itself is
536
534
  // always there in an addable table
537
- var _35 = (0, react_2.useState)(false), addData = _35[0], setAddData = _35[1];
535
+ var _36 = (0, react_2.useState)(false), addData = _36[0], setAddData = _36[1];
538
536
  var isAddRowPinned = props.paginationType === "scroll";
539
- var _36 = (0, react_2.useState)({}), addDataValue = _36[0], setAddDataValue = _36[1];
537
+ var _37 = (0, react_2.useState)({}), addDataValue = _37[0], setAddDataValue = _37[1];
540
538
  // INFO: bumped after each saved row, so the next one starts with fresh
541
539
  // inputs and its first cell takes the focus
542
- var _37 = (0, react_2.useState)(0), addRowKey = _37[0], setAddRowKey = _37[1];
543
- var _38 = (0, react_2.useState)({}), referencesOptions = _38[0], setReferencesOptions = _38[1];
540
+ var _38 = (0, react_2.useState)(0), addRowKey = _38[0], setAddRowKey = _38[1];
541
+ // INFO: the group whose own add row is being filled in; "" = the bottom row
542
+ var _39 = (0, react_2.useState)(""), addGroupId = _39[0], setAddGroupId = _39[1];
543
+ // INFO: the row armed by a press on its handle, so only the handle — never
544
+ // a click or a text selection in a cell — starts a drag
545
+ var _40 = (0, react_2.useState)(""), dragArmedRowId = _40[0], setDragArmedRowId = _40[1];
546
+ var _41 = (0, react_2.useState)(""), draggingRowId = _41[0], setDraggingRowId = _41[1];
547
+ var _42 = (0, react_2.useState)(""), dropGroupId = _42[0], setDropGroupId = _42[1];
548
+ var _43 = (0, react_2.useState)({}), referencesOptions = _43[0], setReferencesOptions = _43[1];
544
549
  // INFO: seeded options sit under the local map so a cell's own search
545
550
  // results still win per key
546
- var mergedReferencesOptions = __assign(__assign({}, ((_l = props.referencesOptions) !== null && _l !== void 0 ? _l : {})), referencesOptions);
547
- var _39 = (0, react_2.useState)({}), referencesDetails = _39[0], setReferencesDetails = _39[1];
548
- var _40 = (0, react_2.useState)(false), referenceLoading = _40[0], setReferenceLoading = _40[1];
551
+ var mergedReferencesOptions = __assign(__assign({}, ((_m = props.referencesOptions) !== null && _m !== void 0 ? _m : {})), referencesOptions);
552
+ var _44 = (0, react_2.useState)({}), referencesDetails = _44[0], setReferencesDetails = _44[1];
553
+ var _45 = (0, react_2.useState)(false), referenceLoading = _45[0], setReferenceLoading = _45[1];
549
554
  // INFO: measured pixel widths for pinned columns without an explicit width.
550
- var _41 = (0, react_2.useState)({}), measuredPinWidths = _41[0], setMeasuredPinWidths = _41[1];
555
+ var _46 = (0, react_2.useState)({}), measuredPinWidths = _46[0], setMeasuredPinWidths = _46[1];
551
556
  // INFO: the scrolling view's width, which caps how much the left pins take
552
- var _42 = (0, react_2.useState)(0), pinViewWidth = _42[0], setPinViewWidth = _42[1];
557
+ var _47 = (0, react_2.useState)(0), pinViewWidth = _47[0], setPinViewWidth = _47[1];
553
558
  var editDataValueRef = (0, react_2.useRef)({});
554
559
  var editDataRowIdRef = (0, react_2.useRef)("");
555
560
  var editDataHeaderKeyRef = (0, react_2.useRef)("");
556
561
  var editDataInputRefs = (0, react_2.useRef)([]);
557
562
  var addDataValueRef = (0, react_2.useRef)({});
563
+ // INFO: the group fields a row added inside a group saves with
564
+ var addPresetRef = (0, react_2.useRef)({});
558
565
  var addDataInputRefs = (0, react_2.useRef)([]);
559
566
  var addRowRef = (0, react_2.useRef)(null);
560
567
  // INFO: the column clicked to start a row, focused once its input mounts
@@ -573,7 +580,7 @@ var NewTable = function (props) {
573
580
  var bgColor = props.darkMode
574
581
  ? props.darkModeBg || "bg-gray-900"
575
582
  : "bg-white";
576
- var isFlat = !!((_m = props.advSettings) === null || _m === void 0 ? void 0 : _m.flat);
583
+ var isFlat = !!((_o = props.advSettings) === null || _o === void 0 ? void 0 : _o.flat);
577
584
  var borderRadius = isFlat ? "" : "rounded-2xl";
578
585
  var borderColor = props.darkMode ? "border-gray-700" : "border-gray-100";
579
586
  var selectedRowBg = props.darkMode ? "bg-gray-700" : "bg-primary-50";
@@ -617,8 +624,8 @@ var NewTable = function (props) {
617
624
  var errorFontColor = props.darkMode ? "text-red-300" : "text-red-500";
618
625
  // INFO: an edit commits on blur, but navigating away unmounts the table
619
626
  // without one — the cell was left dirty on screen and the value never sent.
620
- var onUpdateDataRef = (0, react_2.useRef)((_o = props.editable) === null || _o === void 0 ? void 0 : _o.onUpdateData);
621
- onUpdateDataRef.current = (_p = props.editable) === null || _p === void 0 ? void 0 : _p.onUpdateData;
627
+ var onUpdateDataRef = (0, react_2.useRef)((_p = props.editable) === null || _p === void 0 ? void 0 : _p.onUpdateData);
628
+ onUpdateDataRef.current = (_q = props.editable) === null || _q === void 0 ? void 0 : _q.onUpdateData;
622
629
  (0, react_2.useEffect)(function () {
623
630
  return function () {
624
631
  var _a, _b;
@@ -633,6 +640,15 @@ var NewTable = function (props) {
633
640
  Promise.resolve(onUpdateDataRef.current(rowId, columnId, editDataValueRef.current)).catch(function () { });
634
641
  };
635
642
  }, []);
643
+ // INFO: a press on a row's handle released without dragging disarms it, so
644
+ // the row does not stay draggable for the next text selection
645
+ (0, react_2.useEffect)(function () {
646
+ if (!dragArmedRowId || draggingRowId)
647
+ return;
648
+ var handleRelease = function () { return setDragArmedRowId(""); };
649
+ document.addEventListener("mouseup", handleRelease);
650
+ return function () { return document.removeEventListener("mouseup", handleRelease); };
651
+ }, [dragArmedRowId, draggingRowId]);
636
652
  // INFO: the clicked cell of a new row takes the focus once its input is on
637
653
  // screen, so typing starts where the click landed
638
654
  (0, react_2.useEffect)(function () {
@@ -773,22 +789,34 @@ var NewTable = function (props) {
773
789
  return;
774
790
  var frameId = requestAnimationFrame(function () {
775
791
  var _a;
776
- // INFO: measures only the first row — safe because pinned columns without
777
- // explicit width (e.g. "update") always render content in every row.
778
- var firstRow = (_a = tableRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("tbody tr");
792
+ // INFO: measures only the first record row — safe because pinned columns
793
+ // without explicit width (e.g. "update") always render content in every
794
+ // row. A group band comes first in a grouped table and holds no cells.
795
+ var firstRow = (_a = tableRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("tbody tr[data-dtw-record-id]");
779
796
  if (!firstRow)
780
797
  return;
781
798
  var widths = {};
782
799
  needsMeasure.forEach(function (key) {
783
- var _a;
800
+ var _a, _b, _c;
784
801
  var td = firstRow.querySelector("td[data-pin-key=\"".concat(key, "\"]"));
785
802
  if (td) {
786
803
  var inner = td.firstElementChild;
787
- var w = inner ? inner.offsetWidth : td.scrollWidth;
804
+ // INFO: a pinned cell wraps its text, so the box's own width is
805
+ // whatever it was squeezed to; the text's width on one line is the
806
+ // width it wants
807
+ var previousWhiteSpace = td.style.whiteSpace;
808
+ td.style.whiteSpace = "nowrap";
809
+ var range = inner ? document.createRange() : null;
810
+ range === null || range === void 0 ? void 0 : range.selectNodeContents(inner);
811
+ 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);
812
+ td.style.whiteSpace = previousWhiteSpace;
813
+ var w = inner
814
+ ? Math.max(textWidth, inner.offsetWidth)
815
+ : td.scrollWidth;
788
816
  // INFO: + cell padding (px-4 = 16px × 2), or the title actions' room
789
817
  if (w > 0)
790
818
  widths[key] =
791
- key === ((_a = flatColumns[0]) === null || _a === void 0 ? void 0 : _a.key) && titleActionsWidth
819
+ key === ((_c = flatColumns[0]) === null || _c === void 0 ? void 0 : _c.key) && titleActionsWidth
792
820
  ? w + 16 + titleActionsWidth
793
821
  : w + 32;
794
822
  }
@@ -818,6 +846,8 @@ var NewTable = function (props) {
818
846
  }, [hasPinColumns, props.data.length > 0]);
819
847
  var handleCancelAdd = function () {
820
848
  addDataValueRef.current = {};
849
+ addPresetRef.current = {};
850
+ setAddGroupId("");
821
851
  setAddData(false);
822
852
  setAddDataValue({});
823
853
  };
@@ -845,15 +875,23 @@ var NewTable = function (props) {
845
875
  return false;
846
876
  return !(((_c = (_b = props.selectedIds) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0) > 0 || props.selectAll);
847
877
  };
848
- var handleStartAdd = function (colKey) {
849
- var _a, _b, _c;
878
+ var handleStartAdd = function (colKey, group) {
879
+ var _a, _b, _c, _d;
850
880
  if (!((_a = props.addable) === null || _a === void 0 ? void 0 : _a.active) || !handleValidateAddColumns())
851
881
  return;
882
+ var groupId = (group === null || group === void 0 ? void 0 : group.joinValues) ? group.id : "";
883
+ // INFO: moving to another group's add row starts a fresh row there
884
+ if (groupId !== addGroupId) {
885
+ addDataValueRef.current = {};
886
+ setAddDataValue({});
887
+ }
888
+ addPresetRef.current = (_b = group === null || group === void 0 ? void 0 : group.joinValues) !== null && _b !== void 0 ? _b : {};
889
+ setAddGroupId(groupId);
852
890
  var col = handleGetAddColumns().find(function (each) { return each.key === colKey; });
853
891
  pendingAddFocusRef.current =
854
892
  col && handleIsAddColumn(col)
855
893
  ? colKey
856
- : ((_c = (_b = handleGetAddColumns().find(handleIsAddColumn)) === null || _b === void 0 ? void 0 : _b.key) !== null && _c !== void 0 ? _c : "");
894
+ : ((_d = (_c = handleGetAddColumns().find(handleIsAddColumn)) === null || _c === void 0 ? void 0 : _c.key) !== null && _d !== void 0 ? _d : "");
857
895
  handleCreateFormInputRefs("add");
858
896
  setAddData(true);
859
897
  };
@@ -870,7 +908,7 @@ var NewTable = function (props) {
870
908
  args_1[_i - 1] = arguments[_i];
871
909
  }
872
910
  return __awaiter(void 0, __spreadArray([keepAdding_1], args_1, true), void 0, function (keepAdding, leaving) {
873
- var valid, data, _a;
911
+ var valid, typed, data, _a;
874
912
  var _b, _c, _d;
875
913
  if (leaving === void 0) { leaving = false; }
876
914
  return __generator(this, function (_e) {
@@ -889,7 +927,13 @@ var NewTable = function (props) {
889
927
  setAddData(false);
890
928
  return [2 /*return*/];
891
929
  }
892
- data = addDataValueRef.current;
930
+ typed = addDataValueRef.current;
931
+ data = __assign({}, addPresetRef.current);
932
+ Object.entries(typed).forEach(function (_a) {
933
+ var key = _a[0], value = _a[1];
934
+ if ((0, utils_1.handleIsValueFilled)(value) || !(key in data))
935
+ data[key] = value;
936
+ });
893
937
  addDataValueRef.current = {};
894
938
  setAddDataValue({});
895
939
  if (keepAdding) {
@@ -911,8 +955,8 @@ var NewTable = function (props) {
911
955
  _a = _e.sent();
912
956
  if (handleHasAddValue())
913
957
  return [2 /*return*/];
914
- addDataValueRef.current = data;
915
- setAddDataValue(data);
958
+ addDataValueRef.current = typed;
959
+ setAddDataValue(typed);
916
960
  handleCreateFormInputRefs("add");
917
961
  setAddData(true);
918
962
  return [3 /*break*/, 5];
@@ -1222,7 +1266,7 @@ var NewTable = function (props) {
1222
1266
  // it stays here until the table unmounts. Tailwind cannot emit a runtime
1223
1267
  // w-[Npx], so a width drives an inline style and wins over the col.width
1224
1268
  // class.
1225
- var _43 = (0, react_2.useState)({}), columnWidths = _43[0], setColumnWidths = _43[1];
1269
+ var _48 = (0, react_2.useState)({}), columnWidths = _48[0], setColumnWidths = _48[1];
1226
1270
  var resizeRef = (0, react_2.useRef)(null);
1227
1271
  // INFO: a dragged width first, else the column's own fixed width in pixels
1228
1272
  // whatever form it is stored in ("180px", "w-[180px]", "w-48")
@@ -1393,7 +1437,12 @@ var NewTable = function (props) {
1393
1437
  };
1394
1438
  var handleAddOption = function () {
1395
1439
  return setNewColumnOptions(__spreadArray(__spreadArray([], newColumnOptions, true), [
1396
- { key: handleNextOptionKey(), text: "", colour: "" },
1440
+ {
1441
+ key: handleNextOptionKey(),
1442
+ text: "",
1443
+ // INFO: a new option takes the next palette colour
1444
+ colour: (0, defaultColours_1.handleGetDefaultColour)(newColumnOptions.length),
1445
+ },
1397
1446
  ], false));
1398
1447
  };
1399
1448
  var handleRemoveOption = function (key) {
@@ -1407,7 +1456,7 @@ var NewTable = function (props) {
1407
1456
  .filter(Boolean);
1408
1457
  return new Set(texts).size !== texts.length;
1409
1458
  };
1410
- var renderOptionColourPalette = function (option, index) { return (react_2.default.createElement("div", { className: "absolute right-0 top-full z-10 mt-1 grid w-44 grid-cols-5 gap-2 rounded-md border border-gray-200 bg-white p-2 shadow-lg", "data-testid": "column-option-palette-".concat(index) }, __spreadArray([""], OPTION_COLOURS, true).map(function (eachColour) { return (react_2.default.createElement("button", { key: eachColour || "none", type: "button", "aria-label": eachColour || "none", "aria-pressed": option.colour === eachColour, "data-testid": "column-option-colour-".concat(index, "-").concat(eachColour || "none"), className: "h-6 w-6 rounded-full border-2 ".concat(OPTION_SWATCH_CLASS[eachColour], " ").concat(option.colour === eachColour
1459
+ var renderOptionColourPalette = function (option, index) { return (react_2.default.createElement("div", { className: "absolute right-0 top-full z-10 mt-1 grid w-44 grid-cols-5 gap-2 rounded-md border border-gray-200 bg-white p-2 shadow-lg", "data-testid": "column-option-palette-".concat(index) }, __spreadArray([""], defaultColours_1.OPTION_COLOURS, true).map(function (eachColour) { return (react_2.default.createElement("button", { key: eachColour || "none", type: "button", "aria-label": eachColour || "none", "aria-pressed": option.colour === eachColour, "data-testid": "column-option-colour-".concat(index, "-").concat(eachColour || "none"), className: "h-6 w-6 rounded-full border-2 ".concat(OPTION_SWATCH_CLASS[eachColour], " ").concat(option.colour === eachColour
1411
1460
  ? "ring-2 ring-gray-500 ring-offset-1"
1412
1461
  : ""), onClick: function () {
1413
1462
  handleChangeOption(option.key, { colour: eachColour });
@@ -1709,11 +1758,26 @@ var NewTable = function (props) {
1709
1758
  var handleFilterModal = function (id) {
1710
1759
  setFilterModal(id);
1711
1760
  };
1761
+ // INFO: the rows in the order the reader sees them — group by group, with a
1762
+ // collapsed group's rows out of sight — so a swept or shift-clicked range
1763
+ // takes the rows between the two on screen, not between them in the data
1764
+ var handleGetShownRows = function () {
1765
+ if (!props.groups || props.groups.length === 0)
1766
+ return props.data;
1767
+ var rowById = new Map(props.data.map(function (row) { return [row.id, row]; }));
1768
+ return props.groups.flatMap(function (eachGroup) {
1769
+ return collapsedGroupIds.includes(eachGroup.id)
1770
+ ? []
1771
+ : eachGroup.rowIds
1772
+ .map(function (rowId) { return rowById.get(rowId); })
1773
+ .filter(function (row) { return !!row; });
1774
+ });
1775
+ };
1712
1776
  var handleSelectRange = function (fromIndex, toIndex, mode, base) {
1713
1777
  if (!props.handleSelectedIds)
1714
1778
  return;
1715
1779
  var _a = fromIndex <= toIndex ? [fromIndex, toIndex] : [toIndex, fromIndex], low = _a[0], high = _a[1];
1716
- var rangeIds = props.data
1780
+ var rangeIds = handleGetShownRows()
1717
1781
  .slice(low, high + 1)
1718
1782
  .map(function (eachRow) { return eachRow.id; });
1719
1783
  if (mode === "remove") {
@@ -1741,7 +1805,7 @@ var NewTable = function (props) {
1741
1805
  // INFO: stop the browser from starting a text selection as the pointer
1742
1806
  // sweeps down the column
1743
1807
  e.preventDefault();
1744
- var startIndex = props.data.findIndex(function (eachRow) { return eachRow.id === rowId; });
1808
+ var startIndex = handleGetShownRows().findIndex(function (eachRow) { return eachRow.id === rowId; });
1745
1809
  if (startIndex < 0)
1746
1810
  return;
1747
1811
  var base = (_a = props.selectedIds) !== null && _a !== void 0 ? _a : [];
@@ -1756,7 +1820,7 @@ var NewTable = function (props) {
1756
1820
  var drag = dragSelectRef.current;
1757
1821
  if (!drag)
1758
1822
  return;
1759
- var overIndex = props.data.findIndex(function (eachRow) { return eachRow.id === rowId; });
1823
+ var overIndex = handleGetShownRows().findIndex(function (eachRow) { return eachRow.id === rowId; });
1760
1824
  if (overIndex < 0)
1761
1825
  return;
1762
1826
  handleSelectRange(drag.startIndex, overIndex, drag.mode, drag.base);
@@ -1850,8 +1914,9 @@ var NewTable = function (props) {
1850
1914
  else {
1851
1915
  var current = (_b = props.selectedIds) !== null && _b !== void 0 ? _b : [];
1852
1916
  if (e.shiftKey && lastSelectedRowRef.current) {
1853
- var fromIndex = props.data.findIndex(function (eachRow) { return eachRow.id === lastSelectedRowRef.current; });
1854
- var toIndex = props.data.findIndex(function (eachRow) { return eachRow.id === rowId; });
1917
+ var shownRows = handleGetShownRows();
1918
+ var fromIndex = shownRows.findIndex(function (eachRow) { return eachRow.id === lastSelectedRowRef.current; });
1919
+ var toIndex = shownRows.findIndex(function (eachRow) { return eachRow.id === rowId; });
1855
1920
  if (fromIndex >= 0 && toIndex >= 0) {
1856
1921
  handleSelectRange(fromIndex, toIndex, "add", current);
1857
1922
  return;
@@ -1941,7 +2006,7 @@ var NewTable = function (props) {
1941
2006
  return DEFAULT_PIN_WIDTH;
1942
2007
  };
1943
2008
  var pinCheckboxOffset = props.checkbox &&
1944
- (props.data.length > 0 || (props.spaceData && ((_q = props.spaceData) === null || _q === void 0 ? void 0 : _q.length) > 0))
2009
+ (props.data.length > 0 || (props.spaceData && ((_r = props.spaceData) === null || _r === void 0 ? void 0 : _r.length) > 0))
1945
2010
  ? CHECKBOX_WIDTH
1946
2011
  : 0;
1947
2012
  /**
@@ -1953,7 +2018,7 @@ var NewTable = function (props) {
1953
2018
  * fit with its text wrapping, and everything else scrolls with the table.
1954
2019
  */
1955
2020
  var handleFitPins = function () {
1956
- var _a;
2021
+ var _a, _b;
1957
2022
  // INFO: the checkbox column is drawn whenever it is on, rows or not
1958
2023
  var leftNatural = leftPinned.reduce(function (sum, key) { return sum + handleGetPinWidth(key); }, props.checkbox ? CHECKBOX_WIDTH : 0);
1959
2024
  var rightNatural = rightPinned.reduce(function (sum, key) { return sum + handleGetPinWidth(key); }, 0) +
@@ -1966,8 +2031,13 @@ var NewTable = function (props) {
1966
2031
  return { widths: widths, narrow: false };
1967
2032
  }
1968
2033
  var first = leftPinned[0];
2034
+ // INFO: a title that carries its row's actions keeps a larger share, so
2035
+ // its text is not squeezed to a few letters a line beside them
2036
+ var firstBudget = first === ((_b = flatColumns[0]) === null || _b === void 0 ? void 0 : _b.key) && titleActionsWidth && pinViewWidth
2037
+ ? pinViewWidth * TITLE_PIN_VIEW_SHARE
2038
+ : budget;
1969
2039
  if (first)
1970
- widths[first] = Math.min(handleGetPinWidth(first), Math.max(MIN_PIN_WIDTH, Math.floor(budget)));
2040
+ widths[first] = Math.min(handleGetPinWidth(first), Math.max(MIN_PIN_WIDTH, Math.floor(firstBudget)));
1971
2041
  return { widths: widths, narrow: true };
1972
2042
  };
1973
2043
  var handleGetCheckboxPinStyle = function (zIndex) {
@@ -2142,8 +2212,9 @@ var NewTable = function (props) {
2142
2212
  }))));
2143
2213
  };
2144
2214
  var renderActivityButton = function (id, positioned) {
2215
+ var _a;
2145
2216
  if (positioned === void 0) { positioned = false; }
2146
- return hasRowActions ? (react_2.default.createElement(recordActions_1.RecordActions, { id: id, onEdit: props.onRowEdit, onActivity: props.onRowActivity, className: positioned ? "absolute right-1 top-1/2 -translate-y-1/2 z-20" : "" })) : null;
2217
+ 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;
2147
2218
  };
2148
2219
  var handleShowsActionColumn = function () { var _a; return !!((_a = props.deleteable) === null || _a === void 0 ? void 0 : _a.active) || (addData && handleValidateAddColumns()); };
2149
2220
  /**
@@ -2212,7 +2283,7 @@ var NewTable = function (props) {
2212
2283
  };
2213
2284
  // INFO: worked out here, after the Actions and "+" helpers it reads, and
2214
2285
  // only read by the render helpers called from the return below
2215
- var _44 = handleFitPins(), fittedLeftPins = _44.widths, narrowPins = _44.narrow;
2286
+ var _49 = handleFitPins(), fittedLeftPins = _49.widths, narrowPins = _49.narrow;
2216
2287
  var renderActionColumnHeader = function () {
2217
2288
  if (handleShowsActionColumn()) {
2218
2289
  var pin = handleGetActionCellPin(true);
@@ -2337,17 +2408,69 @@ var NewTable = function (props) {
2337
2408
  };
2338
2409
  // INFO: true when maxSelectedCount is set and the current selection has reached the limit
2339
2410
  var isMaxReached = !!props.maxSelectedCount &&
2340
- ((_s = (_r = props.selectedIds) === null || _r === void 0 ? void 0 : _r.length) !== null && _s !== void 0 ? _s : 0) >= props.maxSelectedCount;
2411
+ ((_t = (_s = props.selectedIds) === null || _s === void 0 ? void 0 : _s.length) !== null && _t !== void 0 ? _t : 0) >= props.maxSelectedCount;
2341
2412
  // INFO: one desktop row. groupAccent carries the group's colour so member
2342
2413
  // rows show the band's colour as a bar down their left edge.
2343
- var renderDesktopRow = function (row, index, groupAccent) {
2414
+ var handleRowDragStart = function (event, rowId) {
2415
+ var _a;
2416
+ if (!canDragRows || dragArmedRowId !== rowId)
2417
+ return;
2418
+ (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.setData("text/plain", rowId);
2419
+ if (event.dataTransfer)
2420
+ event.dataTransfer.effectAllowed = "move";
2421
+ setDraggingRowId(rowId);
2422
+ };
2423
+ var handleRowDragEnd = function () {
2424
+ setDragArmedRowId("");
2425
+ setDraggingRowId("");
2426
+ setDropGroupId("");
2427
+ };
2428
+ // INFO: a group takes a dragged row on its band and on any of its rows,
2429
+ // unless the row is already in it or the group cannot be joined
2430
+ var handleGroupDropProps = function (group) {
2431
+ if (!canDragRows || !group.joinValues)
2432
+ return {};
2433
+ var handleCanDrop = function () {
2434
+ return !!draggingRowId && !group.rowIds.includes(draggingRowId);
2435
+ };
2436
+ return {
2437
+ onDragOver: function (event) {
2438
+ if (!handleCanDrop())
2439
+ return;
2440
+ event.preventDefault();
2441
+ if (dropGroupId !== group.id)
2442
+ setDropGroupId(group.id);
2443
+ },
2444
+ onDrop: function (event) {
2445
+ var _a;
2446
+ if (!handleCanDrop())
2447
+ return;
2448
+ event.preventDefault();
2449
+ var rowId = draggingRowId;
2450
+ handleRowDragEnd();
2451
+ Promise.resolve((_a = props.onMoveRowToGroup) === null || _a === void 0 ? void 0 : _a.call(props, rowId, group.id)).catch(function () { });
2452
+ },
2453
+ };
2454
+ };
2455
+ var renderRowDragHandle = function (rowId) { return (react_2.default.createElement("span", { key: "row-drag-handle", "data-testid": "table-row-drag-handle-".concat(rowId), "aria-hidden": "true", className: "absolute left-0 top-1/2 z-10 -translate-y-1/2 cursor-grab px-0.5 opacity-0 group-hover:opacity-100 ".concat(props.darkMode ? "text-gray-500" : "text-gray-400"), onMouseDown: function (event) {
2456
+ event.stopPropagation();
2457
+ setDragArmedRowId(rowId);
2458
+ }, onMouseUp: function () {
2459
+ if (!draggingRowId)
2460
+ setDragArmedRowId("");
2461
+ }, onClick: function (event) {
2462
+ event.preventDefault();
2463
+ event.stopPropagation();
2464
+ } },
2465
+ react_2.default.createElement(solid_2.EllipsisVerticalIcon, { className: "h-4 w-4" }))); };
2466
+ var renderDesktopRow = function (row, index, groupAccent, dropGroup) {
2344
2467
  var _a, _b, _c, _d, _e;
2345
2468
  var spaceRow = (_a = props.spaceData) === null || _a === void 0 ? void 0 : _a[index];
2346
2469
  var isSelected = ((_c = (_b = props.selectedIds) === null || _b === void 0 ? void 0 : _b.includes(row.id)) !== null && _c !== void 0 ? _c : false) ||
2347
2470
  ((_d = props.selectAll) !== null && _d !== void 0 ? _d : false);
2348
2471
  var rowBgClass = isSelected ? selectedRowBg : bgColor;
2349
2472
  var isRowHoverable = !!props.onClickRow && !isSelected;
2350
- return (react_2.default.createElement("tr", { key: row.id, "data-dtw-record-id": row.id, onClick: function (e) {
2473
+ return (react_2.default.createElement("tr", __assign({ key: row.id, "data-dtw-record-id": row.id, draggable: canDragRows && dragArmedRowId === row.id, onDragStart: function (e) { return handleRowDragStart(e, row.id); }, onDragEnd: handleRowDragEnd }, (dropGroup ? handleGroupDropProps(dropGroup) : {}), { onClick: function (e) {
2351
2474
  var _a, _b;
2352
2475
  // INFO: a link or form field placed in a cell does its own default
2353
2476
  // action — following the link, ticking the box — and does not open
@@ -2374,14 +2497,14 @@ var NewTable = function (props) {
2374
2497
  ? "animate-pulse"
2375
2498
  : "", " ").concat(groupAccent
2376
2499
  ? "border-l-4 ".concat((_e = ACCENT_CLASS[groupAccent]) !== null && _e !== void 0 ? _e : ACCENT_CLASS.default)
2377
- : "") },
2500
+ : "", " ").concat(draggingRowId === row.id ? "opacity-50" : "") }),
2378
2501
  props.checkbox && (react_2.default.createElement("td", { className: "w-10 ".concat(cellPadding, " ").concat(hasPinColumns ? "".concat(rowBgClass, " ").concat(isRowHoverable ? (props.darkMode ? "group-hover:bg-gray-700" : "group-hover:bg-gray-100") : "") : ""), style: handleGetCheckboxPinStyle(1), onClick: function (e) { return handleSelectRow(row.id, e); }, onMouseDown: function (e) { return handleDragSelectStart(row.id, e); }, onMouseEnter: function () { return handleDragSelectOver(row.id); } }, renderCheckbox(isSelected, function () { }, undefined, isMaxReached && !isSelected
2379
2502
  ? "opacity-50 cursor-not-allowed"
2380
2503
  : ""))),
2381
2504
  flatColumns.map(function (col, colIndex) {
2382
- var _a, _b, _c;
2505
+ var _a, _b, _c, _d;
2383
2506
  var renderDataCell = function () {
2384
- 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;
2507
+ 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;
2385
2508
  // INFO: a coloured list cell is this table's to render, so it takes
2386
2509
  // the raw value even when a display row is supplied. The list view
2387
2510
  // builds those rows and puts a Tag in for a coloured value — an
@@ -2411,18 +2534,22 @@ var NewTable = function (props) {
2411
2534
  // INFO: a cell whose value is already a React element (row action
2412
2535
  // buttons, a custom control) is rendered as-is even in an editable
2413
2536
  // table — wrapping it in an inline editor would swallow it
2414
- var isElementCell = react_2.default.isValidElement(cellValue);
2537
+ // INFO: a late or due-today date is the list's marked text, still
2538
+ // the stored date underneath, so it edits like any other date
2539
+ var isDateWarningCell = react_2.default.isValidElement(cellValue) &&
2540
+ !!((_g = cellValue.props) === null || _g === void 0 ? void 0 : _g["data-date-warning"]);
2541
+ var isElementCell = react_2.default.isValidElement(cellValue) && !isDateWarningCell;
2415
2542
  // INFO: a column the schema marks disabled is read-only in the form,
2416
2543
  // so it stays read-only in an editable table too — without this an
2417
2544
  // admin-locked (often system-filled) column was editable on hover
2418
2545
  var isColumnLocked = !!col.disabled;
2419
2546
  // INFO: a thumbnail or a file name is still the cell of a modal
2420
2547
  // field — the click opens its editor rather than the record
2421
- var isModalEdit = ((_g = props.editable) === null || _g === void 0 ? void 0 : _g.active) &&
2548
+ var isModalEdit = ((_h = props.editable) === null || _h === void 0 ? void 0 : _h.active) &&
2422
2549
  !isColumnLocked &&
2423
2550
  !isActionColumn &&
2424
2551
  utils_1.supportedModalEditList.includes(resolvedColType);
2425
- var isObjectEdit = ((_h = props.editable) === null || _h === void 0 ? void 0 : _h.active) &&
2552
+ var isObjectEdit = ((_j = props.editable) === null || _j === void 0 ? void 0 : _j.active) &&
2426
2553
  !isColumnLocked &&
2427
2554
  !isActionColumn &&
2428
2555
  !isElementCell &&
@@ -2430,16 +2557,17 @@ var NewTable = function (props) {
2430
2557
  !!props.onObjectEdit;
2431
2558
  // INFO: the read cell renders an object, but a text field would show
2432
2559
  // [object Object] and commit that string over the real value
2433
- var isUneditableShape = typeof cellValue === "object" &&
2560
+ var isUneditableShape = !isDateWarningCell &&
2561
+ typeof cellValue === "object" &&
2434
2562
  cellValue !== null &&
2435
2563
  !(cellValue instanceof Date) &&
2436
2564
  utils_1.primitiveInlineEditList.includes(resolvedColType);
2437
- var isEditable = ((_j = props.editable) === null || _j === void 0 ? void 0 : _j.active) &&
2565
+ var isEditable = ((_k = props.editable) === null || _k === void 0 ? void 0 : _k.active) &&
2438
2566
  !isColumnLocked &&
2439
2567
  !isActionColumn &&
2440
2568
  !isElementCell &&
2441
2569
  !isUneditableShape &&
2442
- !(((_l = (_k = props.selectedIds) === null || _k === void 0 ? void 0 : _k.length) !== null && _l !== void 0 ? _l : 0) > 0 || props.selectAll) &&
2570
+ !(((_m = (_l = props.selectedIds) === null || _l === void 0 ? void 0 : _l.length) !== null && _m !== void 0 ? _m : 0) > 0 || props.selectAll) &&
2443
2571
  utils_1.supportedInlineEditList.includes(resolvedColType);
2444
2572
  var rowData = editDataRowId === row.id ? editDataValue : row;
2445
2573
  // INFO: a list column with a palette paints the whole cell —
@@ -2452,17 +2580,17 @@ var NewTable = function (props) {
2452
2580
  // INFO: an editable table renders the coloured cell as its Select in
2453
2581
  // every row (filled while closed) so the control never swaps in and
2454
2582
  // out; the plain block is for read-only tables and locked columns
2455
- if (fillColour && (!((_m = props.editable) === null || _m === void 0 ? void 0 : _m.active) || isColumnLocked)) {
2583
+ if (fillColour && (!((_o = props.editable) === null || _o === void 0 ? void 0 : _o.active) || isColumnLocked)) {
2456
2584
  // INFO: a read-only table shows the same filled Select as an
2457
2585
  // editable one, just disabled — the cell looks identical in both
2458
2586
  // modes and the row click still navigates
2459
- var readOnlyDS = __assign(__assign({}, col), { id: col.key, name: col.title, type: (_o = col.type) !== null && _o !== void 0 ? _o : "string", showTagSelections: handleColumnShowsTags(col), disabled: true });
2587
+ var readOnlyDS = __assign(__assign({}, col), { id: col.key, name: col.title, type: (_p = col.type) !== null && _p !== void 0 ? _p : "string", showTagSelections: handleColumnShowsTags(col), disabled: true });
2460
2588
  // INFO: navigate on click only for a genuinely read-only table. This
2461
2589
  // branch is ALSO entered for a locked column inside an EDITABLE
2462
2590
  // table (isColumnLocked) — there a click must leave the Select alone,
2463
2591
  // not navigate — so the overlay is gated on !editable.active.
2464
- var shouldNavigateOnClick = !((_p = props.editable) === null || _p === void 0 ? void 0 : _p.active);
2465
- return (react_2.default.createElement("td", { key: col.key, className: "p-0 align-middle ".concat((_r = (_q = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _q === void 0 ? void 0 : _q.className) !== null && _r !== void 0 ? _r : ""), style: (_s = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _s === void 0 ? void 0 : _s.style },
2592
+ var shouldNavigateOnClick = !((_q = props.editable) === null || _q === void 0 ? void 0 : _q.active);
2593
+ return (react_2.default.createElement("td", { key: col.key, className: "p-0 align-middle ".concat((_s = (_r = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _r === void 0 ? void 0 : _r.className) !== null && _s !== void 0 ? _s : ""), style: (_t = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _t === void 0 ? void 0 : _t.style },
2466
2594
  react_2.default.createElement("div", { className: "relative w-max whitespace-nowrap p-[1px]" },
2467
2595
  renderFormCell(row, readOnlyDS, null, {
2468
2596
  active: true,
@@ -2484,7 +2612,7 @@ var NewTable = function (props) {
2484
2612
  // INFO: share the column width source with the read-only/edit cell
2485
2613
  // variants, otherwise an "Add" placeholder and a filled value in the
2486
2614
  // same column resolve to different widths and the column looks ragged
2487
- className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " ").concat(col.width ? "".concat(col.width, " flex-shrink-0") : getPinProps(col.key, false) ? "" : "whitespace-nowrap", " ").concat((_u = (_t = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _t === void 0 ? void 0 : _t.className) !== null && _u !== void 0 ? _u : ""), style: (_v = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _v === void 0 ? void 0 : _v.style },
2615
+ className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " ").concat(col.width ? "".concat(col.width, " flex-shrink-0") : getPinProps(col.key, false) ? "" : "whitespace-nowrap", " ").concat((_v = (_u = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _u === void 0 ? void 0 : _u.className) !== null && _v !== void 0 ? _v : ""), style: (_w = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _w === void 0 ? void 0 : _w.style },
2488
2616
  react_2.default.createElement("div", { className: "cursor-pointer group/modaledit flex items-center gap-x-2 min-h-6", "data-testid": "table-object-edit-".concat(col.key), onClick: function (e) {
2489
2617
  var _a;
2490
2618
  e.stopPropagation();
@@ -2501,7 +2629,7 @@ var NewTable = function (props) {
2501
2629
  // INFO: share the column width source with the read-only/edit cell
2502
2630
  // variants, otherwise an "Add" placeholder and a filled value in the
2503
2631
  // same column resolve to different widths and the column looks ragged
2504
- className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " ").concat(col.width ? "".concat(col.width, " flex-shrink-0") : getPinProps(col.key, false) ? "" : "whitespace-nowrap", " ").concat((_x = (_w = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _w === void 0 ? void 0 : _w.className) !== null && _x !== void 0 ? _x : ""), style: (_y = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _y === void 0 ? void 0 : _y.style },
2632
+ className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " ").concat(col.width ? "".concat(col.width, " flex-shrink-0") : getPinProps(col.key, false) ? "" : "whitespace-nowrap", " ").concat((_y = (_x = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _x === void 0 ? void 0 : _x.className) !== null && _y !== void 0 ? _y : ""), style: (_z = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _z === void 0 ? void 0 : _z.style },
2505
2633
  react_2.default.createElement("div", { className: "cursor-pointer group/modaledit flex items-center gap-x-2 min-h-6", "data-testid": "table-modal-edit-".concat(col.key), onClick: function (e) {
2506
2634
  e.stopPropagation();
2507
2635
  handleModalEditOnClick(row.id, col.key, row);
@@ -2514,7 +2642,7 @@ var NewTable = function (props) {
2514
2642
  // filled pill, so there is nothing to swap to.
2515
2643
  if (isEditable &&
2516
2644
  (handleColumnShowsTags(col) || handleIsCellLive(row.id, col.key))) {
2517
- var bareOverride = (_0 = (_z = props.bareSettings) === null || _z === void 0 ? void 0 : _z.bareListDescription) === null || _0 === void 0 ? void 0 : _0.call(_z, col.key, cellValue);
2645
+ var bareOverride = (_1 = (_0 = props.bareSettings) === null || _0 === void 0 ? void 0 : _0.bareListDescription) === null || _1 === void 0 ? void 0 : _1.call(_0, col.key, cellValue);
2518
2646
  if (!bareOverride)
2519
2647
  return renderEditDataInputs(colIndex, col, rowData, row.id, rowBgClass, isRowHoverable);
2520
2648
  }
@@ -2522,16 +2650,19 @@ var NewTable = function (props) {
2522
2650
  // INFO: pinned columns use whitespace-normal so text wraps within the fixed width
2523
2651
  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)
2524
2652
  ? col.key
2525
- : undefined, className: "".concat(cellPadding, " ").concat(isEditable ? "".concat(editCellMinHeight, " align-middle ").concat(handleCellMinWidth(col.type)) : "", " text-sm ").concat(colIndex === 0 && props.onClickRow ? titleFontColor : cellFontColor, " ").concat(col.width ? "".concat(col.width, " flex-shrink-0") : getPinProps(col.key, false) ? "" : "whitespace-nowrap", " ").concat((_2 = (_1 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _1 === void 0 ? void 0 : _1.className) !== null && _2 !== void 0 ? _2 : ""), style: (_3 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _3 === void 0 ? void 0 : _3.style, "data-row-link-cell": props.newTabUrl && props.onClickRow ? "" : undefined }), props.newTabUrl && props.onClickRow ? (react_2.default.createElement(link_1.Link, { href: props.newTabUrl + row.id + ((_4 = props.addNewTabUrl) !== null && _4 !== void 0 ? _4 : ""), className: "w-full block", linkType: props.linkType, custom: props.custom }, (0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord))) : ((0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord))));
2653
+ : undefined, className: "".concat(cellPadding, " ").concat(isEditable ? "".concat(editCellMinHeight, " align-middle ").concat(handleCellMinWidth(col.type)) : "", " text-sm ").concat(colIndex === 0 && props.onClickRow ? titleFontColor : cellFontColor, " ").concat(col.width ? "".concat(col.width, " flex-shrink-0") : getPinProps(col.key, false) ? "" : "whitespace-nowrap", " ").concat((_3 = (_2 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _2 === void 0 ? void 0 : _2.className) !== null && _3 !== void 0 ? _3 : ""), style: (_4 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _4 === void 0 ? void 0 : _4.style, "data-row-link-cell": props.newTabUrl && props.onClickRow ? "" : undefined }), props.newTabUrl && props.onClickRow ? (react_2.default.createElement(link_1.Link, { href: props.newTabUrl + row.id + ((_5 = props.addNewTabUrl) !== null && _5 !== void 0 ? _5 : ""), className: "w-full block", linkType: props.linkType, custom: props.custom }, (0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord))) : ((0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord))));
2526
2654
  };
2527
2655
  var cell = renderDataCell();
2528
- if (colIndex !== 0 || !hasRowActions)
2656
+ var dragHandle = colIndex === 0 && canDragRows && dropGroup
2657
+ ? renderRowDragHandle(row.id)
2658
+ : null;
2659
+ if (colIndex !== 0 || (!hasRowActions && !dragHandle))
2529
2660
  return cell;
2530
2661
  // Keep the action outside links and inline editors in every cell variant.
2531
2662
  return react_2.default.cloneElement(cell, {
2532
- className: "".concat(cell.props.className, " ").concat((_b = (_a = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _a === void 0 ? void 0 : _a.className) !== null && _b !== void 0 ? _b : ""),
2533
- style: __assign(__assign(__assign(__assign({}, cell.props.style), { paddingRight: titleActionsWidth }), (_c = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _c === void 0 ? void 0 : _c.style), { position: getPinProps(col.key, false) ? "sticky" : "relative" }),
2534
- }, cell.props.children, renderActivityButton(row.id, true));
2663
+ 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 : ""),
2664
+ 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" }),
2665
+ }, cell.props.children, dragHandle, renderActivityButton(row.id, true));
2535
2666
  }),
2536
2667
  renderAddColumnCell(rowBgClass, isRowHoverable),
2537
2668
  renderActionColumnCell(row.id, rowBgClass, isRowHoverable)));
@@ -2555,19 +2686,21 @@ var NewTable = function (props) {
2555
2686
  (((_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.addColumnEnabled) ? 1 : 0) +
2556
2687
  (handleShowsActionColumn() ? 1 : 0);
2557
2688
  return props.groups.map(function (group) {
2558
- var _a, _b, _c;
2689
+ var _a, _b, _c, _d, _e;
2559
2690
  var colourKey = (_a = group.colour) !== null && _a !== void 0 ? _a : "none";
2560
2691
  var isCollapsed = collapsedGroupIds.includes(group.id);
2561
2692
  var memberIndexes = group.rowIds
2562
2693
  .map(function (rowId) { return indexById.get(rowId); })
2563
2694
  .filter(function (rowIndex) { return rowIndex !== undefined; });
2564
2695
  return (react_2.default.createElement(react_2.default.Fragment, { key: "group-".concat(group.id) },
2565
- react_2.default.createElement("tr", { "data-testid": "table-group-".concat(group.id), "data-collapsed": isCollapsed ? "true" : "false",
2696
+ react_2.default.createElement("tr", __assign({ "data-testid": "table-group-".concat(group.id), "data-collapsed": isCollapsed ? "true" : "false",
2566
2697
  // INFO: a band with no row yet stays out of sight until its own read
2567
2698
  // says whether it holds any, so empty ones do not flash in and out
2568
2699
  hidden: !!props.onGroupLoadMore &&
2569
2700
  memberIndexes.length === 0 &&
2570
- group.count === undefined, className: "border-l-4 ".concat((_b = BAND_CLASS[colourKey]) !== null && _b !== void 0 ? _b : BAND_CLASS.none) },
2701
+ group.count === undefined, className: "border-l-4 ".concat((_b = BAND_CLASS[colourKey]) !== null && _b !== void 0 ? _b : BAND_CLASS.none, " ").concat(dropGroupId === group.id
2702
+ ? "ring-2 ring-inset ring-primary-400"
2703
+ : "") }, handleGroupDropProps(group)),
2571
2704
  react_2.default.createElement("td", { colSpan: columnCount, className: "px-3 py-2" },
2572
2705
  react_2.default.createElement("button", { type: "button", className: "flex w-full items-center gap-x-2 text-left text-xs font-semibold uppercase tracking-wide", onClick: function (e) {
2573
2706
  e.stopPropagation();
@@ -2578,17 +2711,20 @@ var NewTable = function (props) {
2578
2711
  });
2579
2712
  } },
2580
2713
  isCollapsed ? (react_2.default.createElement(solid_2.ChevronRightIcon, { className: "h-4 w-4" })) : (react_2.default.createElement(solid_2.ChevronDownIcon, { className: "h-4 w-4" })),
2714
+ group.avatar && (react_2.default.createElement(personAvatar_1.PersonAvatar, { label: group.avatar.label, image: group.avatar.image })),
2581
2715
  react_2.default.createElement("span", null, group.title),
2582
- react_2.default.createElement("span", { className: "rounded-full bg-white/70 px-2 py-0.5 text-[11px] font-medium normal-case tracking-normal" }, (_c = group.count) !== null && _c !== void 0 ? _c : memberIndexes.length)))),
2716
+ 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)))),
2583
2717
  !isCollapsed &&
2584
2718
  memberIndexes
2585
2719
  .slice(0, handleGetGroupVisibleCount(group.id))
2586
2720
  .map(function (rowIndex) {
2587
- return renderDesktopRow(props.data[rowIndex], rowIndex, colourKey);
2721
+ return renderDesktopRow(props.data[rowIndex], rowIndex, colourKey, group);
2588
2722
  }),
2589
2723
  renderGroupShowMoreRow(group.id, memberIndexes.length, columnCount, isCollapsed),
2590
2724
  renderGroupLoadMoreRow(group.id, columnCount, isCollapsed),
2591
- renderGroupPagerRow(group, columnCount, isCollapsed)));
2725
+ renderGroupPagerRow(group, columnCount, isCollapsed),
2726
+ !isCollapsed && renderGroupAddRow(group, colourKey),
2727
+ !isCollapsed && renderGroupSummaryRow(group, colourKey)));
2592
2728
  });
2593
2729
  };
2594
2730
  // INFO: a section that pages itself already holds one page at a time, so
@@ -2599,6 +2735,63 @@ var NewTable = function (props) {
2599
2735
  ? Infinity
2600
2736
  : ((_a = groupVisibleCounts[groupId]) !== null && _a !== void 0 ? _a : exports.NEW_TABLE_GROUP_ROW_BATCH);
2601
2737
  };
2738
+ // INFO: a group that can be joined has its own add row, under its rows;
2739
+ // what is typed there saves with the group's value
2740
+ var handleHasGroupAddRows = function () { var _a; return !!((_a = props.groups) === null || _a === void 0 ? void 0 : _a.some(function (eachGroup) { return !!eachGroup.joinValues; })); };
2741
+ var renderGroupAddRow = function (group, colourKey) {
2742
+ var _a, _b, _c;
2743
+ if (!group.joinValues ||
2744
+ !((_a = props.addable) === null || _a === void 0 ? void 0 : _a.active) ||
2745
+ !handleValidateAddColumns())
2746
+ return null;
2747
+ // INFO: while rows are selected no row can be added, but the row keeps its
2748
+ // place, blank — removing it would move every row below under a pointer
2749
+ // still pressed on a checkbox, which then sweeps up the row that lands there
2750
+ var isBlank = !handleCheckCanAddRow();
2751
+ if (!isBlank && addData && addGroupId === group.id)
2752
+ return renderAddDataRow();
2753
+ var firstAddKey = (_b = handleGetAddColumns().find(handleIsAddColumn)) === null || _b === void 0 ? void 0 : _b.key;
2754
+ return (react_2.default.createElement("tr", __assign({ "data-testid": "table-group-add-".concat(group.id), "aria-hidden": isBlank ? "true" : undefined, className: "group border-l-4 ".concat((_c = ACCENT_CLASS[colourKey]) !== null && _c !== void 0 ? _c : ACCENT_CLASS.default, " ").concat(isBlank
2755
+ ? "pointer-events-none"
2756
+ : "cursor-text ".concat(props.darkMode ? "hover:bg-gray-800" : "hover:bg-gray-50")) }, handleGroupDropProps(group)),
2757
+ props.checkbox && react_2.default.createElement("td", { className: "w-10 ".concat(cellPadding) }),
2758
+ handleGetAddColumns().map(function (col, index) { return (react_2.default.createElement("td", { key: col.key, "data-add-cell": col.key, className: "".concat(cellPadding, " h-10 text-sm ").concat(props.darkMode ? "text-gray-500" : "text-gray-400", " ").concat(isBlank ? "invisible" : ""), onClick: function () {
2759
+ return handleStartAdd(handleIsAddColumn(col) ? col.key : (firstAddKey !== null && firstAddKey !== void 0 ? firstAddKey : col.key), group);
2760
+ } }, index === 0 && (react_2.default.createElement("span", { className: "inline-flex items-center gap-x-1 whitespace-nowrap" },
2761
+ react_2.default.createElement(solid_1.PlusIcon, { className: "h-4 w-4", "aria-hidden": "true" }),
2762
+ "Add item")))); }),
2763
+ renderAddColumnCell(),
2764
+ handleShowsActionColumn() && (react_2.default.createElement("td", { className: "".concat(cellPadding, " ").concat(handleGetActionCellPin(false).className), style: handleGetActionCellPin(false).style }))));
2765
+ };
2766
+ var handleFormatSummaryNumber = function (value) {
2767
+ return value.toLocaleString("en", { maximumFractionDigits: 2 });
2768
+ };
2769
+ // INFO: under each group, its totals over every row the filters match — the
2770
+ // count in the first column and a sum under each number column
2771
+ var renderGroupSummaryRow = function (group, colourKey) {
2772
+ var _a;
2773
+ var summary = group.summary;
2774
+ if (!summary)
2775
+ return null;
2776
+ return (react_2.default.createElement("tr", { "data-testid": "table-group-summary-".concat(group.id), className: "border-l-4 ".concat((_a = ACCENT_CLASS[colourKey]) !== null && _a !== void 0 ? _a : ACCENT_CLASS.default, " ").concat(props.darkMode ? "bg-gray-800" : "bg-gray-50") },
2777
+ props.checkbox && react_2.default.createElement("td", { className: "w-10 ".concat(cellPadding) }),
2778
+ flatColumns.map(function (col, colIndex) {
2779
+ var _a, _b;
2780
+ var pin = getPinProps(col.key, false, props.darkMode ? "bg-gray-800" : "bg-gray-50");
2781
+ var sum = (_a = summary.sums) === null || _a === void 0 ? void 0 : _a[col.key];
2782
+ var content = null;
2783
+ if (colIndex === 0 && summary.count !== undefined)
2784
+ content = (react_2.default.createElement("span", { className: "font-medium" },
2785
+ summary.count,
2786
+ " ",
2787
+ summary.count === 1 ? "item" : "items"));
2788
+ else if (typeof sum === "number")
2789
+ content = (react_2.default.createElement("span", { className: "font-semibold" }, handleFormatSummaryNumber(sum)));
2790
+ return (react_2.default.createElement("td", { key: col.key, "data-summary-cell": col.key, className: "".concat(cellPadding, " text-xs ").concat(cellFontColor, " whitespace-nowrap ").concat((_b = pin === null || pin === void 0 ? void 0 : pin.className) !== null && _b !== void 0 ? _b : ""), style: pin === null || pin === void 0 ? void 0 : pin.style }, content));
2791
+ }),
2792
+ renderAddColumnCell(),
2793
+ handleShowsActionColumn() && (react_2.default.createElement("td", { className: "".concat(cellPadding, " ").concat(handleGetActionCellPin(false).className), style: handleGetActionCellPin(false).style }))));
2794
+ };
2602
2795
  var renderGroupShowMoreRow = function (groupId, memberCount, columnCount, isCollapsed) {
2603
2796
  var visibleCount = handleGetGroupVisibleCount(groupId);
2604
2797
  if (isCollapsed || memberCount <= visibleCount)
@@ -2862,11 +3055,11 @@ var NewTable = function (props) {
2862
3055
  var isIdLike_1 = function (c) {
2863
3056
  return /^id$/i.test(c.key) || /^_id$/i.test(c.key);
2864
3057
  };
2865
- var titleCol_1 = (_t = flatColumns.find(function (c) { return !isIdLike_1(c); })) !== null && _t !== void 0 ? _t : flatColumns[0];
3058
+ var titleCol_1 = (_u = flatColumns.find(function (c) { return !isIdLike_1(c); })) !== null && _u !== void 0 ? _u : flatColumns[0];
2866
3059
  var expandHeaderBg_1 = props.darkMode ? "bg-gray-700" : "bg-gray-100";
2867
3060
  var expandHeaderFontColor_1 = props.darkMode ? "text-white" : "";
2868
3061
  var headerBgColor_1 = props.darkMode
2869
- ? ((_u = props.darkModeBg) !== null && _u !== void 0 ? _u : "bg-gray-900")
3062
+ ? ((_v = props.darkModeBg) !== null && _v !== void 0 ? _v : "bg-gray-900")
2870
3063
  : "";
2871
3064
  var headerFontColor_1 = props.darkMode ? "text-white" : "";
2872
3065
  // INFO: renders tag + trailing text adjacent to the Collapse title
@@ -2967,18 +3160,18 @@ var NewTable = function (props) {
2967
3160
  })))));
2968
3161
  };
2969
3162
  return (react_2.default.createElement("div", null,
2970
- react_2.default.createElement("div", { className: "w-full ".concat(((_v = props.mobileTooltip) === null || _v === void 0 ? void 0 : _v.tooltip) ? "overflow-visible" : "overflow-hidden", " ").concat(isFlat
3163
+ 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
2971
3164
  ? ""
2972
- : "border ".concat(borderRadius, " ").concat(borderColor, " ").concat(bgColor, " shadow-sm"), " divide-y ").concat(dividerColor, " ").concat((_w = props.className) !== null && _w !== void 0 ? _w : "") },
3165
+ : "border ".concat(borderRadius, " ").concat(borderColor, " ").concat(bgColor, " shadow-sm"), " divide-y ").concat(dividerColor, " ").concat((_x = props.className) !== null && _x !== void 0 ? _x : "") },
2973
3166
  react_2.default.createElement("div", { className: "p-3 flex items-center justify-between" },
2974
3167
  renderSelectAll(),
2975
3168
  react_2.default.createElement("div", { className: "flex items-center gap-2" },
2976
3169
  renderSelectedCount(),
2977
- ((_x = props.advSettings) === null || _x === void 0 ? void 0 : _x.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"); } })))),
3170
+ ((_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"); } })))),
2978
3171
  props.loading &&
2979
3172
  Array.from({ length: 3 }).map(function (_, i) { return (react_2.default.createElement("div", { key: "skeleton-".concat(i), className: "p-4" },
2980
3173
  react_2.default.createElement("div", { className: "h-5 w-3/4 rounded-md animate-pulse ".concat(props.darkMode ? "bg-gray-700" : "bg-gray-200") }))); }),
2981
- !props.loading && props.data.length === 0 && (react_2.default.createElement("p", { className: "p-4 text-center text-sm ".concat(cellFontColor) }, (_y = props.emptyTitle) !== null && _y !== void 0 ? _y : "No items")),
3174
+ !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")),
2982
3175
  !props.loading &&
2983
3176
  props.data.map(function (row, index) {
2984
3177
  var _a, _b, _c, _d, _e, _f, _g;
@@ -3038,13 +3231,13 @@ var NewTable = function (props) {
3038
3231
  renderFloatingActionBar(),
3039
3232
  renderAddColumnModal()));
3040
3233
  }
3041
- return (react_2.default.createElement("div", { className: "w-full ".concat((_z = props.className) !== null && _z !== void 0 ? _z : "") },
3234
+ return (react_2.default.createElement("div", { className: "w-full ".concat((_0 = props.className) !== null && _0 !== void 0 ? _0 : "") },
3042
3235
  react_2.default.createElement(modal_1.Modal, { open: filterModal ? true : false, title: "Filter Options", renderContent: function () {
3043
3236
  var _a, _b;
3044
3237
  return (react_2.default.createElement("div", { className: "pb-44" },
3045
3238
  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))));
3046
3239
  }, onClose: function () { return setFilterModal(""); } }),
3047
- react_2.default.createElement(modal_1.Modal, { open: modalEditVisible, title: (_1 = (_0 = flatColumns.find(function (eachCol) { return eachCol.key === editDataHeaderKey; })) === null || _0 === void 0 ? void 0 : _0.title) !== null && _1 !== void 0 ? _1 : "Edit", onClose: handleModalEditClose, renderContent: function () {
3240
+ 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", onClose: handleModalEditClose, renderContent: function () {
3048
3241
  var _a, _b, _c, _d;
3049
3242
  var selectedCol = flatColumns.find(function (eachCol) { return eachCol.key === editDataHeaderKey; });
3050
3243
  if (!selectedCol)
@@ -3086,7 +3279,7 @@ var NewTable = function (props) {
3086
3279
  react_2.default.createElement(scrollShadow_1.ScrollShadow, { className: "w-full overflow-x-auto ".concat(isFlat
3087
3280
  ? ""
3088
3281
  : "".concat(borderRadius, " border ").concat(borderColor, " ").concat(bgColor, " shadow-sm")), darkMode: props.darkMode },
3089
- (props.selectAll || ((_3 = (_2 = props.selectedIds) === null || _2 === void 0 ? void 0 : _2.length) !== null && _3 !== void 0 ? _3 : 0) > 0) &&
3282
+ (props.selectAll || ((_4 = (_3 = props.selectedIds) === null || _3 === void 0 ? void 0 : _3.length) !== null && _4 !== void 0 ? _4 : 0) > 0) &&
3090
3283
  (!props.multiActionFloatingBtns ||
3091
3284
  (props.multiActionFloatingBtns &&
3092
3285
  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" },
@@ -3099,7 +3292,11 @@ var NewTable = function (props) {
3099
3292
  className: "w-max min-w-full ".concat(isDragSelecting ? "select-none" : ""), ref: tableRef },
3100
3293
  renderTableHeader(),
3101
3294
  react_2.default.createElement("tbody", { className: "divide-y ".concat(dividerColor) },
3102
- !props.loading && isAddRowPinned && addData && renderAddDataRow(),
3295
+ !props.loading &&
3296
+ isAddRowPinned &&
3297
+ addData &&
3298
+ !addGroupId &&
3299
+ renderAddDataRow(),
3103
3300
  props.loading &&
3104
3301
  Array.from({ length: 3 }).map(function (_, i) { return (react_2.default.createElement("tr", { key: "skeleton-".concat(i) },
3105
3302
  props.checkbox && react_2.default.createElement("td", { className: "w-10 ".concat(cellPadding) }),
@@ -3108,9 +3305,9 @@ var NewTable = function (props) {
3108
3305
  !props.loading && renderDesktopRows(),
3109
3306
  !props.loading &&
3110
3307
  (addData
3111
- ? !isAddRowPinned && renderAddDataRow()
3112
- : renderEmptyAddRow()))),
3113
- !props.loading && props.data.length === 0 && (react_2.default.createElement("div", { className: "p-4 text-sm ".concat(cellFontColor, " text-center sticky left-0") }, (_4 = props.emptyTitle) !== null && _4 !== void 0 ? _4 : "No items"))),
3308
+ ? !isAddRowPinned && !addGroupId && renderAddDataRow()
3309
+ : !handleHasGroupAddRows() && renderEmptyAddRow()))),
3310
+ !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"))),
3114
3311
  renderPinnedAddButton(),
3115
3312
  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
3116
3313
  ? "pagination-container w-full ".concat(borderColor, " ").concat(isFixed ? "fixed bottom-0 left-0 z-10" : "sticky top-0 left-0")