blixify-ui-web 1.2.226 → 1.2.229

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 (65) hide show
  1. package/lib/components/chat/chatBase/index.d.ts +7 -0
  2. package/lib/components/chat/chatBase/index.d.ts.map +1 -1
  3. package/lib/components/chat/chatBase/index.js +44 -7
  4. package/lib/components/chat/chatBase/index.js.map +1 -1
  5. package/lib/components/data/columnTypes/context.d.ts +1 -0
  6. package/lib/components/data/columnTypes/context.d.ts.map +1 -1
  7. package/lib/components/data/columnTypes/context.js.map +1 -1
  8. package/lib/components/data/columnTypes/dateRangeCell.d.ts.map +1 -1
  9. package/lib/components/data/columnTypes/dateRangeCell.js +8 -2
  10. package/lib/components/data/columnTypes/dateRangeCell.js.map +1 -1
  11. package/lib/components/data/columnTypes/dateWarning.d.ts +6 -0
  12. package/lib/components/data/columnTypes/dateWarning.d.ts.map +1 -0
  13. package/lib/components/data/columnTypes/dateWarning.js +46 -0
  14. package/lib/components/data/columnTypes/dateWarning.js.map +1 -0
  15. package/lib/components/data/columnTypes/defaultColours.d.ts +22 -0
  16. package/lib/components/data/columnTypes/defaultColours.d.ts.map +1 -0
  17. package/lib/components/data/columnTypes/defaultColours.js +101 -0
  18. package/lib/components/data/columnTypes/defaultColours.js.map +1 -0
  19. package/lib/components/data/columnTypes/groupSections.d.ts +13 -0
  20. package/lib/components/data/columnTypes/groupSections.d.ts.map +1 -1
  21. package/lib/components/data/columnTypes/groupSections.js +19 -1
  22. package/lib/components/data/columnTypes/groupSections.js.map +1 -1
  23. package/lib/components/data/dataGraph/index.d.ts.map +1 -1
  24. package/lib/components/data/dataGraph/index.js +4 -5
  25. package/lib/components/data/dataGraph/index.js.map +1 -1
  26. package/lib/components/data/dataTemplate/activityComposer.d.ts.map +1 -1
  27. package/lib/components/data/dataTemplate/activityComposer.js +17 -2
  28. package/lib/components/data/dataTemplate/activityComposer.js.map +1 -1
  29. package/lib/components/data/dataTemplate/chartBuilder.d.ts +1 -0
  30. package/lib/components/data/dataTemplate/chartBuilder.d.ts.map +1 -1
  31. package/lib/components/data/dataTemplate/chartBuilder.js +19 -15
  32. package/lib/components/data/dataTemplate/chartBuilder.js.map +1 -1
  33. package/lib/components/data/dataTemplate/chartView.d.ts.map +1 -1
  34. package/lib/components/data/dataTemplate/chartView.js +11 -9
  35. package/lib/components/data/dataTemplate/chartView.js.map +1 -1
  36. package/lib/components/data/dataTemplate/dataStateModel.d.ts +4 -0
  37. package/lib/components/data/dataTemplate/dataStateModel.d.ts.map +1 -1
  38. package/lib/components/data/dataTemplate/dataStateModel.js.map +1 -1
  39. package/lib/components/data/dataTemplate/index.d.ts.map +1 -1
  40. package/lib/components/data/dataTemplate/index.js +450 -242
  41. package/lib/components/data/dataTemplate/index.js.map +1 -1
  42. package/lib/components/data/dataTemplate/model.d.ts +1 -0
  43. package/lib/components/data/dataTemplate/model.d.ts.map +1 -1
  44. package/lib/components/data/listModule.d.ts +1 -1
  45. package/lib/components/data/listModule.d.ts.map +1 -1
  46. package/lib/components/data/listModule.js +15 -2
  47. package/lib/components/data/listModule.js.map +1 -1
  48. package/lib/components/display/groupSection/index.d.ts +6 -0
  49. package/lib/components/display/groupSection/index.d.ts.map +1 -1
  50. package/lib/components/display/groupSection/index.js +5 -2
  51. package/lib/components/display/groupSection/index.js.map +1 -1
  52. package/lib/components/display/newTable/index.d.ts +13 -0
  53. package/lib/components/display/newTable/index.d.ts.map +1 -1
  54. package/lib/components/display/newTable/index.js +294 -121
  55. package/lib/components/display/newTable/index.js.map +1 -1
  56. package/lib/components/display/recordActions/index.d.ts +1 -0
  57. package/lib/components/display/recordActions/index.d.ts.map +1 -1
  58. package/lib/components/display/recordActions/index.js +6 -3
  59. package/lib/components/display/recordActions/index.js.map +1 -1
  60. package/lib/components/input/fileTransfer.d.ts +49 -0
  61. package/lib/components/input/fileTransfer.d.ts.map +1 -0
  62. package/lib/components/input/fileTransfer.js +122 -0
  63. package/lib/components/input/fileTransfer.js.map +1 -0
  64. package/lib/tail.css +1 -1
  65. 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 });
@@ -1941,7 +1990,7 @@ var NewTable = function (props) {
1941
1990
  return DEFAULT_PIN_WIDTH;
1942
1991
  };
1943
1992
  var pinCheckboxOffset = props.checkbox &&
1944
- (props.data.length > 0 || (props.spaceData && ((_q = props.spaceData) === null || _q === void 0 ? void 0 : _q.length) > 0))
1993
+ (props.data.length > 0 || (props.spaceData && ((_r = props.spaceData) === null || _r === void 0 ? void 0 : _r.length) > 0))
1945
1994
  ? CHECKBOX_WIDTH
1946
1995
  : 0;
1947
1996
  /**
@@ -1953,7 +2002,7 @@ var NewTable = function (props) {
1953
2002
  * fit with its text wrapping, and everything else scrolls with the table.
1954
2003
  */
1955
2004
  var handleFitPins = function () {
1956
- var _a;
2005
+ var _a, _b;
1957
2006
  // INFO: the checkbox column is drawn whenever it is on, rows or not
1958
2007
  var leftNatural = leftPinned.reduce(function (sum, key) { return sum + handleGetPinWidth(key); }, props.checkbox ? CHECKBOX_WIDTH : 0);
1959
2008
  var rightNatural = rightPinned.reduce(function (sum, key) { return sum + handleGetPinWidth(key); }, 0) +
@@ -1966,8 +2015,13 @@ var NewTable = function (props) {
1966
2015
  return { widths: widths, narrow: false };
1967
2016
  }
1968
2017
  var first = leftPinned[0];
2018
+ // INFO: a title that carries its row's actions keeps a larger share, so
2019
+ // its text is not squeezed to a few letters a line beside them
2020
+ var firstBudget = first === ((_b = flatColumns[0]) === null || _b === void 0 ? void 0 : _b.key) && titleActionsWidth && pinViewWidth
2021
+ ? pinViewWidth * TITLE_PIN_VIEW_SHARE
2022
+ : budget;
1969
2023
  if (first)
1970
- widths[first] = Math.min(handleGetPinWidth(first), Math.max(MIN_PIN_WIDTH, Math.floor(budget)));
2024
+ widths[first] = Math.min(handleGetPinWidth(first), Math.max(MIN_PIN_WIDTH, Math.floor(firstBudget)));
1971
2025
  return { widths: widths, narrow: true };
1972
2026
  };
1973
2027
  var handleGetCheckboxPinStyle = function (zIndex) {
@@ -2142,8 +2196,11 @@ var NewTable = function (props) {
2142
2196
  }))));
2143
2197
  };
2144
2198
  var renderActivityButton = function (id, positioned) {
2199
+ var _a;
2145
2200
  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;
2201
+ 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
2202
+ ? "absolute right-1 top-1/2 -translate-y-1/2 z-20"
2203
+ : "" })) : null;
2147
2204
  };
2148
2205
  var handleShowsActionColumn = function () { var _a; return !!((_a = props.deleteable) === null || _a === void 0 ? void 0 : _a.active) || (addData && handleValidateAddColumns()); };
2149
2206
  /**
@@ -2212,7 +2269,7 @@ var NewTable = function (props) {
2212
2269
  };
2213
2270
  // INFO: worked out here, after the Actions and "+" helpers it reads, and
2214
2271
  // only read by the render helpers called from the return below
2215
- var _44 = handleFitPins(), fittedLeftPins = _44.widths, narrowPins = _44.narrow;
2272
+ var _49 = handleFitPins(), fittedLeftPins = _49.widths, narrowPins = _49.narrow;
2216
2273
  var renderActionColumnHeader = function () {
2217
2274
  if (handleShowsActionColumn()) {
2218
2275
  var pin = handleGetActionCellPin(true);
@@ -2337,17 +2394,69 @@ var NewTable = function (props) {
2337
2394
  };
2338
2395
  // INFO: true when maxSelectedCount is set and the current selection has reached the limit
2339
2396
  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;
2397
+ ((_t = (_s = props.selectedIds) === null || _s === void 0 ? void 0 : _s.length) !== null && _t !== void 0 ? _t : 0) >= props.maxSelectedCount;
2341
2398
  // INFO: one desktop row. groupAccent carries the group's colour so member
2342
2399
  // rows show the band's colour as a bar down their left edge.
2343
- var renderDesktopRow = function (row, index, groupAccent) {
2400
+ var handleRowDragStart = function (event, rowId) {
2401
+ var _a;
2402
+ if (!canDragRows || dragArmedRowId !== rowId)
2403
+ return;
2404
+ (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.setData("text/plain", rowId);
2405
+ if (event.dataTransfer)
2406
+ event.dataTransfer.effectAllowed = "move";
2407
+ setDraggingRowId(rowId);
2408
+ };
2409
+ var handleRowDragEnd = function () {
2410
+ setDragArmedRowId("");
2411
+ setDraggingRowId("");
2412
+ setDropGroupId("");
2413
+ };
2414
+ // INFO: a group takes a dragged row on its band and on any of its rows,
2415
+ // unless the row is already in it or the group cannot be joined
2416
+ var handleGroupDropProps = function (group) {
2417
+ if (!canDragRows || !group.joinValues)
2418
+ return {};
2419
+ var handleCanDrop = function () {
2420
+ return !!draggingRowId && !group.rowIds.includes(draggingRowId);
2421
+ };
2422
+ return {
2423
+ onDragOver: function (event) {
2424
+ if (!handleCanDrop())
2425
+ return;
2426
+ event.preventDefault();
2427
+ if (dropGroupId !== group.id)
2428
+ setDropGroupId(group.id);
2429
+ },
2430
+ onDrop: function (event) {
2431
+ var _a;
2432
+ if (!handleCanDrop())
2433
+ return;
2434
+ event.preventDefault();
2435
+ var rowId = draggingRowId;
2436
+ handleRowDragEnd();
2437
+ Promise.resolve((_a = props.onMoveRowToGroup) === null || _a === void 0 ? void 0 : _a.call(props, rowId, group.id)).catch(function () { });
2438
+ },
2439
+ };
2440
+ };
2441
+ 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) {
2442
+ event.stopPropagation();
2443
+ setDragArmedRowId(rowId);
2444
+ }, onMouseUp: function () {
2445
+ if (!draggingRowId)
2446
+ setDragArmedRowId("");
2447
+ }, onClick: function (event) {
2448
+ event.preventDefault();
2449
+ event.stopPropagation();
2450
+ } },
2451
+ react_2.default.createElement(solid_2.EllipsisVerticalIcon, { className: "h-4 w-4" }))); };
2452
+ var renderDesktopRow = function (row, index, groupAccent, dropGroup) {
2344
2453
  var _a, _b, _c, _d, _e;
2345
2454
  var spaceRow = (_a = props.spaceData) === null || _a === void 0 ? void 0 : _a[index];
2346
2455
  var isSelected = ((_c = (_b = props.selectedIds) === null || _b === void 0 ? void 0 : _b.includes(row.id)) !== null && _c !== void 0 ? _c : false) ||
2347
2456
  ((_d = props.selectAll) !== null && _d !== void 0 ? _d : false);
2348
2457
  var rowBgClass = isSelected ? selectedRowBg : bgColor;
2349
2458
  var isRowHoverable = !!props.onClickRow && !isSelected;
2350
- return (react_2.default.createElement("tr", { key: row.id, "data-dtw-record-id": row.id, onClick: function (e) {
2459
+ 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
2460
  var _a, _b;
2352
2461
  // INFO: a link or form field placed in a cell does its own default
2353
2462
  // action — following the link, ticking the box — and does not open
@@ -2374,14 +2483,14 @@ var NewTable = function (props) {
2374
2483
  ? "animate-pulse"
2375
2484
  : "", " ").concat(groupAccent
2376
2485
  ? "border-l-4 ".concat((_e = ACCENT_CLASS[groupAccent]) !== null && _e !== void 0 ? _e : ACCENT_CLASS.default)
2377
- : "") },
2486
+ : "", " ").concat(draggingRowId === row.id ? "opacity-50" : "") }),
2378
2487
  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
2488
  ? "opacity-50 cursor-not-allowed"
2380
2489
  : ""))),
2381
2490
  flatColumns.map(function (col, colIndex) {
2382
- var _a, _b, _c;
2491
+ var _a, _b, _c, _d;
2383
2492
  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;
2493
+ 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
2494
  // INFO: a coloured list cell is this table's to render, so it takes
2386
2495
  // the raw value even when a display row is supplied. The list view
2387
2496
  // builds those rows and puts a Tag in for a coloured value — an
@@ -2411,18 +2520,22 @@ var NewTable = function (props) {
2411
2520
  // INFO: a cell whose value is already a React element (row action
2412
2521
  // buttons, a custom control) is rendered as-is even in an editable
2413
2522
  // table — wrapping it in an inline editor would swallow it
2414
- var isElementCell = react_2.default.isValidElement(cellValue);
2523
+ // INFO: a late or due-today date is the list's marked text, still
2524
+ // the stored date underneath, so it edits like any other date
2525
+ var isDateWarningCell = react_2.default.isValidElement(cellValue) &&
2526
+ !!((_g = cellValue.props) === null || _g === void 0 ? void 0 : _g["data-date-warning"]);
2527
+ var isElementCell = react_2.default.isValidElement(cellValue) && !isDateWarningCell;
2415
2528
  // INFO: a column the schema marks disabled is read-only in the form,
2416
2529
  // so it stays read-only in an editable table too — without this an
2417
2530
  // admin-locked (often system-filled) column was editable on hover
2418
2531
  var isColumnLocked = !!col.disabled;
2419
2532
  // INFO: a thumbnail or a file name is still the cell of a modal
2420
2533
  // field — the click opens its editor rather than the record
2421
- var isModalEdit = ((_g = props.editable) === null || _g === void 0 ? void 0 : _g.active) &&
2534
+ var isModalEdit = ((_h = props.editable) === null || _h === void 0 ? void 0 : _h.active) &&
2422
2535
  !isColumnLocked &&
2423
2536
  !isActionColumn &&
2424
2537
  utils_1.supportedModalEditList.includes(resolvedColType);
2425
- var isObjectEdit = ((_h = props.editable) === null || _h === void 0 ? void 0 : _h.active) &&
2538
+ var isObjectEdit = ((_j = props.editable) === null || _j === void 0 ? void 0 : _j.active) &&
2426
2539
  !isColumnLocked &&
2427
2540
  !isActionColumn &&
2428
2541
  !isElementCell &&
@@ -2430,16 +2543,17 @@ var NewTable = function (props) {
2430
2543
  !!props.onObjectEdit;
2431
2544
  // INFO: the read cell renders an object, but a text field would show
2432
2545
  // [object Object] and commit that string over the real value
2433
- var isUneditableShape = typeof cellValue === "object" &&
2546
+ var isUneditableShape = !isDateWarningCell &&
2547
+ typeof cellValue === "object" &&
2434
2548
  cellValue !== null &&
2435
2549
  !(cellValue instanceof Date) &&
2436
2550
  utils_1.primitiveInlineEditList.includes(resolvedColType);
2437
- var isEditable = ((_j = props.editable) === null || _j === void 0 ? void 0 : _j.active) &&
2551
+ var isEditable = ((_k = props.editable) === null || _k === void 0 ? void 0 : _k.active) &&
2438
2552
  !isColumnLocked &&
2439
2553
  !isActionColumn &&
2440
2554
  !isElementCell &&
2441
2555
  !isUneditableShape &&
2442
- !(((_l = (_k = props.selectedIds) === null || _k === void 0 ? void 0 : _k.length) !== null && _l !== void 0 ? _l : 0) > 0 || props.selectAll) &&
2556
+ !(((_m = (_l = props.selectedIds) === null || _l === void 0 ? void 0 : _l.length) !== null && _m !== void 0 ? _m : 0) > 0 || props.selectAll) &&
2443
2557
  utils_1.supportedInlineEditList.includes(resolvedColType);
2444
2558
  var rowData = editDataRowId === row.id ? editDataValue : row;
2445
2559
  // INFO: a list column with a palette paints the whole cell —
@@ -2452,17 +2566,17 @@ var NewTable = function (props) {
2452
2566
  // INFO: an editable table renders the coloured cell as its Select in
2453
2567
  // every row (filled while closed) so the control never swaps in and
2454
2568
  // 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)) {
2569
+ if (fillColour && (!((_o = props.editable) === null || _o === void 0 ? void 0 : _o.active) || isColumnLocked)) {
2456
2570
  // INFO: a read-only table shows the same filled Select as an
2457
2571
  // editable one, just disabled — the cell looks identical in both
2458
2572
  // 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 });
2573
+ 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
2574
  // INFO: navigate on click only for a genuinely read-only table. This
2461
2575
  // branch is ALSO entered for a locked column inside an EDITABLE
2462
2576
  // table (isColumnLocked) — there a click must leave the Select alone,
2463
2577
  // 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 },
2578
+ var shouldNavigateOnClick = !((_q = props.editable) === null || _q === void 0 ? void 0 : _q.active);
2579
+ 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
2580
  react_2.default.createElement("div", { className: "relative w-max whitespace-nowrap p-[1px]" },
2467
2581
  renderFormCell(row, readOnlyDS, null, {
2468
2582
  active: true,
@@ -2484,7 +2598,7 @@ var NewTable = function (props) {
2484
2598
  // INFO: share the column width source with the read-only/edit cell
2485
2599
  // variants, otherwise an "Add" placeholder and a filled value in the
2486
2600
  // 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 },
2601
+ 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
2602
  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
2603
  var _a;
2490
2604
  e.stopPropagation();
@@ -2501,7 +2615,7 @@ var NewTable = function (props) {
2501
2615
  // INFO: share the column width source with the read-only/edit cell
2502
2616
  // variants, otherwise an "Add" placeholder and a filled value in the
2503
2617
  // 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 },
2618
+ 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
2619
  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
2620
  e.stopPropagation();
2507
2621
  handleModalEditOnClick(row.id, col.key, row);
@@ -2514,7 +2628,7 @@ var NewTable = function (props) {
2514
2628
  // filled pill, so there is nothing to swap to.
2515
2629
  if (isEditable &&
2516
2630
  (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);
2631
+ 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
2632
  if (!bareOverride)
2519
2633
  return renderEditDataInputs(colIndex, col, rowData, row.id, rowBgClass, isRowHoverable);
2520
2634
  }
@@ -2522,16 +2636,19 @@ var NewTable = function (props) {
2522
2636
  // INFO: pinned columns use whitespace-normal so text wraps within the fixed width
2523
2637
  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
2638
  ? 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))));
2639
+ : 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
2640
  };
2527
2641
  var cell = renderDataCell();
2528
- if (colIndex !== 0 || !hasRowActions)
2642
+ var dragHandle = colIndex === 0 && canDragRows && dropGroup
2643
+ ? renderRowDragHandle(row.id)
2644
+ : null;
2645
+ if (colIndex !== 0 || (!hasRowActions && !dragHandle))
2529
2646
  return cell;
2530
2647
  // Keep the action outside links and inline editors in every cell variant.
2531
2648
  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));
2649
+ 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 : ""),
2650
+ 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" }),
2651
+ }, cell.props.children, dragHandle, renderActivityButton(row.id, true));
2535
2652
  }),
2536
2653
  renderAddColumnCell(rowBgClass, isRowHoverable),
2537
2654
  renderActionColumnCell(row.id, rowBgClass, isRowHoverable)));
@@ -2555,19 +2672,19 @@ var NewTable = function (props) {
2555
2672
  (((_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.addColumnEnabled) ? 1 : 0) +
2556
2673
  (handleShowsActionColumn() ? 1 : 0);
2557
2674
  return props.groups.map(function (group) {
2558
- var _a, _b, _c;
2675
+ var _a, _b, _c, _d, _e;
2559
2676
  var colourKey = (_a = group.colour) !== null && _a !== void 0 ? _a : "none";
2560
2677
  var isCollapsed = collapsedGroupIds.includes(group.id);
2561
2678
  var memberIndexes = group.rowIds
2562
2679
  .map(function (rowId) { return indexById.get(rowId); })
2563
2680
  .filter(function (rowIndex) { return rowIndex !== undefined; });
2564
2681
  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",
2682
+ react_2.default.createElement("tr", __assign({ "data-testid": "table-group-".concat(group.id), "data-collapsed": isCollapsed ? "true" : "false",
2566
2683
  // INFO: a band with no row yet stays out of sight until its own read
2567
2684
  // says whether it holds any, so empty ones do not flash in and out
2568
2685
  hidden: !!props.onGroupLoadMore &&
2569
2686
  memberIndexes.length === 0 &&
2570
- group.count === undefined, className: "border-l-4 ".concat((_b = BAND_CLASS[colourKey]) !== null && _b !== void 0 ? _b : BAND_CLASS.none) },
2687
+ group.count === undefined, className: "border-l-4 ".concat((_b = BAND_CLASS[colourKey]) !== null && _b !== void 0 ? _b : BAND_CLASS.none, " ").concat(dropGroupId === group.id ? "ring-2 ring-inset ring-primary-400" : "") }, handleGroupDropProps(group)),
2571
2688
  react_2.default.createElement("td", { colSpan: columnCount, className: "px-3 py-2" },
2572
2689
  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
2690
  e.stopPropagation();
@@ -2578,17 +2695,20 @@ var NewTable = function (props) {
2578
2695
  });
2579
2696
  } },
2580
2697
  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" })),
2698
+ group.avatar && (react_2.default.createElement(personAvatar_1.PersonAvatar, { label: group.avatar.label, image: group.avatar.image })),
2581
2699
  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)))),
2700
+ 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
2701
  !isCollapsed &&
2584
2702
  memberIndexes
2585
2703
  .slice(0, handleGetGroupVisibleCount(group.id))
2586
2704
  .map(function (rowIndex) {
2587
- return renderDesktopRow(props.data[rowIndex], rowIndex, colourKey);
2705
+ return renderDesktopRow(props.data[rowIndex], rowIndex, colourKey, group);
2588
2706
  }),
2589
2707
  renderGroupShowMoreRow(group.id, memberIndexes.length, columnCount, isCollapsed),
2590
2708
  renderGroupLoadMoreRow(group.id, columnCount, isCollapsed),
2591
- renderGroupPagerRow(group, columnCount, isCollapsed)));
2709
+ renderGroupPagerRow(group, columnCount, isCollapsed),
2710
+ !isCollapsed && renderGroupAddRow(group, colourKey),
2711
+ !isCollapsed && renderGroupSummaryRow(group, colourKey)));
2592
2712
  });
2593
2713
  };
2594
2714
  // INFO: a section that pages itself already holds one page at a time, so
@@ -2599,6 +2719,55 @@ var NewTable = function (props) {
2599
2719
  ? Infinity
2600
2720
  : ((_a = groupVisibleCounts[groupId]) !== null && _a !== void 0 ? _a : exports.NEW_TABLE_GROUP_ROW_BATCH);
2601
2721
  };
2722
+ // INFO: a group that can be joined has its own add row, under its rows;
2723
+ // what is typed there saves with the group's value
2724
+ var handleHasGroupAddRows = function () { var _a; return !!((_a = props.groups) === null || _a === void 0 ? void 0 : _a.some(function (eachGroup) { return !!eachGroup.joinValues; })); };
2725
+ var renderGroupAddRow = function (group, colourKey) {
2726
+ var _a, _b;
2727
+ if (!group.joinValues || !handleCheckCanAddRow())
2728
+ return null;
2729
+ if (addData && addGroupId === group.id)
2730
+ return renderAddDataRow();
2731
+ var firstAddKey = (_a = handleGetAddColumns().find(handleIsAddColumn)) === null || _a === void 0 ? void 0 : _a.key;
2732
+ return (react_2.default.createElement("tr", __assign({ "data-testid": "table-group-add-".concat(group.id), className: "group cursor-text border-l-4 ".concat((_b = ACCENT_CLASS[colourKey]) !== null && _b !== void 0 ? _b : ACCENT_CLASS.default, " ").concat(props.darkMode ? "hover:bg-gray-800" : "hover:bg-gray-50") }, handleGroupDropProps(group)),
2733
+ props.checkbox && react_2.default.createElement("td", { className: "w-10 ".concat(cellPadding) }),
2734
+ 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"), onClick: function () {
2735
+ return handleStartAdd(handleIsAddColumn(col) ? col.key : (firstAddKey !== null && firstAddKey !== void 0 ? firstAddKey : col.key), group);
2736
+ } }, index === 0 && (react_2.default.createElement("span", { className: "inline-flex items-center gap-x-1 whitespace-nowrap" },
2737
+ react_2.default.createElement(solid_1.PlusIcon, { className: "h-4 w-4", "aria-hidden": "true" }),
2738
+ "Add item")))); }),
2739
+ renderAddColumnCell(),
2740
+ handleShowsActionColumn() && (react_2.default.createElement("td", { className: "".concat(cellPadding, " ").concat(handleGetActionCellPin(false).className), style: handleGetActionCellPin(false).style }))));
2741
+ };
2742
+ var handleFormatSummaryNumber = function (value) {
2743
+ return value.toLocaleString("en", { maximumFractionDigits: 2 });
2744
+ };
2745
+ // INFO: under each group, its totals over every row the filters match — the
2746
+ // count in the first column and a sum under each number column
2747
+ var renderGroupSummaryRow = function (group, colourKey) {
2748
+ var _a;
2749
+ var summary = group.summary;
2750
+ if (!summary)
2751
+ return null;
2752
+ 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") },
2753
+ props.checkbox && react_2.default.createElement("td", { className: "w-10 ".concat(cellPadding) }),
2754
+ flatColumns.map(function (col, colIndex) {
2755
+ var _a, _b;
2756
+ var pin = getPinProps(col.key, false, props.darkMode ? "bg-gray-800" : "bg-gray-50");
2757
+ var sum = (_a = summary.sums) === null || _a === void 0 ? void 0 : _a[col.key];
2758
+ var content = null;
2759
+ if (colIndex === 0 && summary.count !== undefined)
2760
+ content = (react_2.default.createElement("span", { className: "font-medium" },
2761
+ summary.count,
2762
+ " ",
2763
+ summary.count === 1 ? "item" : "items"));
2764
+ else if (typeof sum === "number")
2765
+ content = (react_2.default.createElement("span", { className: "font-semibold" }, handleFormatSummaryNumber(sum)));
2766
+ 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));
2767
+ }),
2768
+ renderAddColumnCell(),
2769
+ handleShowsActionColumn() && (react_2.default.createElement("td", { className: "".concat(cellPadding, " ").concat(handleGetActionCellPin(false).className), style: handleGetActionCellPin(false).style }))));
2770
+ };
2602
2771
  var renderGroupShowMoreRow = function (groupId, memberCount, columnCount, isCollapsed) {
2603
2772
  var visibleCount = handleGetGroupVisibleCount(groupId);
2604
2773
  if (isCollapsed || memberCount <= visibleCount)
@@ -2862,11 +3031,11 @@ var NewTable = function (props) {
2862
3031
  var isIdLike_1 = function (c) {
2863
3032
  return /^id$/i.test(c.key) || /^_id$/i.test(c.key);
2864
3033
  };
2865
- var titleCol_1 = (_t = flatColumns.find(function (c) { return !isIdLike_1(c); })) !== null && _t !== void 0 ? _t : flatColumns[0];
3034
+ var titleCol_1 = (_u = flatColumns.find(function (c) { return !isIdLike_1(c); })) !== null && _u !== void 0 ? _u : flatColumns[0];
2866
3035
  var expandHeaderBg_1 = props.darkMode ? "bg-gray-700" : "bg-gray-100";
2867
3036
  var expandHeaderFontColor_1 = props.darkMode ? "text-white" : "";
2868
3037
  var headerBgColor_1 = props.darkMode
2869
- ? ((_u = props.darkModeBg) !== null && _u !== void 0 ? _u : "bg-gray-900")
3038
+ ? ((_v = props.darkModeBg) !== null && _v !== void 0 ? _v : "bg-gray-900")
2870
3039
  : "";
2871
3040
  var headerFontColor_1 = props.darkMode ? "text-white" : "";
2872
3041
  // INFO: renders tag + trailing text adjacent to the Collapse title
@@ -2967,18 +3136,18 @@ var NewTable = function (props) {
2967
3136
  })))));
2968
3137
  };
2969
3138
  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
3139
+ 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
3140
  ? ""
2972
- : "border ".concat(borderRadius, " ").concat(borderColor, " ").concat(bgColor, " shadow-sm"), " divide-y ").concat(dividerColor, " ").concat((_w = props.className) !== null && _w !== void 0 ? _w : "") },
3141
+ : "border ".concat(borderRadius, " ").concat(borderColor, " ").concat(bgColor, " shadow-sm"), " divide-y ").concat(dividerColor, " ").concat((_x = props.className) !== null && _x !== void 0 ? _x : "") },
2973
3142
  react_2.default.createElement("div", { className: "p-3 flex items-center justify-between" },
2974
3143
  renderSelectAll(),
2975
3144
  react_2.default.createElement("div", { className: "flex items-center gap-2" },
2976
3145
  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"); } })))),
3146
+ ((_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
3147
  props.loading &&
2979
3148
  Array.from({ length: 3 }).map(function (_, i) { return (react_2.default.createElement("div", { key: "skeleton-".concat(i), className: "p-4" },
2980
3149
  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")),
3150
+ !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
3151
  !props.loading &&
2983
3152
  props.data.map(function (row, index) {
2984
3153
  var _a, _b, _c, _d, _e, _f, _g;
@@ -3038,13 +3207,13 @@ var NewTable = function (props) {
3038
3207
  renderFloatingActionBar(),
3039
3208
  renderAddColumnModal()));
3040
3209
  }
3041
- return (react_2.default.createElement("div", { className: "w-full ".concat((_z = props.className) !== null && _z !== void 0 ? _z : "") },
3210
+ return (react_2.default.createElement("div", { className: "w-full ".concat((_0 = props.className) !== null && _0 !== void 0 ? _0 : "") },
3042
3211
  react_2.default.createElement(modal_1.Modal, { open: filterModal ? true : false, title: "Filter Options", renderContent: function () {
3043
3212
  var _a, _b;
3044
3213
  return (react_2.default.createElement("div", { className: "pb-44" },
3045
3214
  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
3215
  }, 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 () {
3216
+ 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
3217
  var _a, _b, _c, _d;
3049
3218
  var selectedCol = flatColumns.find(function (eachCol) { return eachCol.key === editDataHeaderKey; });
3050
3219
  if (!selectedCol)
@@ -3086,7 +3255,7 @@ var NewTable = function (props) {
3086
3255
  react_2.default.createElement(scrollShadow_1.ScrollShadow, { className: "w-full overflow-x-auto ".concat(isFlat
3087
3256
  ? ""
3088
3257
  : "".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) &&
3258
+ (props.selectAll || ((_4 = (_3 = props.selectedIds) === null || _3 === void 0 ? void 0 : _3.length) !== null && _4 !== void 0 ? _4 : 0) > 0) &&
3090
3259
  (!props.multiActionFloatingBtns ||
3091
3260
  (props.multiActionFloatingBtns &&
3092
3261
  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 +3268,11 @@ var NewTable = function (props) {
3099
3268
  className: "w-max min-w-full ".concat(isDragSelecting ? "select-none" : ""), ref: tableRef },
3100
3269
  renderTableHeader(),
3101
3270
  react_2.default.createElement("tbody", { className: "divide-y ".concat(dividerColor) },
3102
- !props.loading && isAddRowPinned && addData && renderAddDataRow(),
3271
+ !props.loading &&
3272
+ isAddRowPinned &&
3273
+ addData &&
3274
+ !addGroupId &&
3275
+ renderAddDataRow(),
3103
3276
  props.loading &&
3104
3277
  Array.from({ length: 3 }).map(function (_, i) { return (react_2.default.createElement("tr", { key: "skeleton-".concat(i) },
3105
3278
  props.checkbox && react_2.default.createElement("td", { className: "w-10 ".concat(cellPadding) }),
@@ -3108,9 +3281,9 @@ var NewTable = function (props) {
3108
3281
  !props.loading && renderDesktopRows(),
3109
3282
  !props.loading &&
3110
3283
  (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"))),
3284
+ ? !isAddRowPinned && !addGroupId && renderAddDataRow()
3285
+ : !handleHasGroupAddRows() && renderEmptyAddRow()))),
3286
+ !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
3287
  renderPinnedAddButton(),
3115
3288
  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
3289
  ? "pagination-container w-full ".concat(borderColor, " ").concat(isFixed ? "fixed bottom-0 left-0 z-10" : "sticky top-0 left-0")