blixify-ui-web 1.2.250 → 1.2.252

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 (68) hide show
  1. package/lib/components/data/blobModule.d.ts +1 -0
  2. package/lib/components/data/blobModule.d.ts.map +1 -1
  3. package/lib/components/data/blobModule.js +24 -2
  4. package/lib/components/data/blobModule.js.map +1 -1
  5. package/lib/components/data/columnTypes/dateRangeCalendar.d.ts +36 -0
  6. package/lib/components/data/columnTypes/dateRangeCalendar.d.ts.map +1 -0
  7. package/lib/components/data/columnTypes/dateRangeCalendar.js +226 -0
  8. package/lib/components/data/columnTypes/dateRangeCalendar.js.map +1 -0
  9. package/lib/components/data/columnTypes/dateRangeCell.d.ts +2 -0
  10. package/lib/components/data/columnTypes/dateRangeCell.d.ts.map +1 -1
  11. package/lib/components/data/columnTypes/dateRangeCell.js +63 -11
  12. package/lib/components/data/columnTypes/dateRangeCell.js.map +1 -1
  13. package/lib/components/data/columnTypes/index.d.ts +1 -0
  14. package/lib/components/data/columnTypes/index.d.ts.map +1 -1
  15. package/lib/components/data/columnTypes/index.js +1 -0
  16. package/lib/components/data/columnTypes/index.js.map +1 -1
  17. package/lib/components/data/columnTypes/lookup.d.ts +29 -0
  18. package/lib/components/data/columnTypes/lookup.d.ts.map +1 -0
  19. package/lib/components/data/columnTypes/lookup.js +89 -0
  20. package/lib/components/data/columnTypes/lookup.js.map +1 -0
  21. package/lib/components/data/dataTemplate/index.d.ts.map +1 -1
  22. package/lib/components/data/dataTemplate/index.js +142 -63
  23. package/lib/components/data/dataTemplate/index.js.map +1 -1
  24. package/lib/components/data/dataTemplate/model.d.ts +9 -2
  25. package/lib/components/data/dataTemplate/model.d.ts.map +1 -1
  26. package/lib/components/data/listModule.d.ts +1 -1
  27. package/lib/components/data/listModule.d.ts.map +1 -1
  28. package/lib/components/data/listModule.js +11 -5
  29. package/lib/components/data/listModule.js.map +1 -1
  30. package/lib/components/data/updateModule.d.ts +5 -0
  31. package/lib/components/data/updateModule.d.ts.map +1 -1
  32. package/lib/components/data/updateModule.js +24 -2
  33. package/lib/components/data/updateModule.js.map +1 -1
  34. package/lib/components/display/newList/compactRow.d.ts +30 -0
  35. package/lib/components/display/newList/compactRow.d.ts.map +1 -0
  36. package/lib/components/display/newList/compactRow.js +81 -0
  37. package/lib/components/display/newList/compactRow.js.map +1 -0
  38. package/lib/components/display/newList/index.d.ts +6 -0
  39. package/lib/components/display/newList/index.d.ts.map +1 -1
  40. package/lib/components/display/newList/index.js +32 -3
  41. package/lib/components/display/newList/index.js.map +1 -1
  42. package/lib/components/display/newList/listRowFields.d.ts +24 -0
  43. package/lib/components/display/newList/listRowFields.d.ts.map +1 -0
  44. package/lib/components/display/newList/listRowFields.js +86 -0
  45. package/lib/components/display/newList/listRowFields.js.map +1 -0
  46. package/lib/components/display/newTable/index.d.ts +7 -1
  47. package/lib/components/display/newTable/index.d.ts.map +1 -1
  48. package/lib/components/display/newTable/index.js +874 -274
  49. package/lib/components/display/newTable/index.js.map +1 -1
  50. package/lib/components/display/newTable/labelPicker.d.ts +24 -0
  51. package/lib/components/display/newTable/labelPicker.d.ts.map +1 -0
  52. package/lib/components/display/newTable/labelPicker.js +228 -0
  53. package/lib/components/display/newTable/labelPicker.js.map +1 -0
  54. package/lib/components/input/datePicker/index.d.ts.map +1 -1
  55. package/lib/components/input/datePicker/index.js +18 -8
  56. package/lib/components/input/datePicker/index.js.map +1 -1
  57. package/lib/components/input/select/index.d.ts +13 -0
  58. package/lib/components/input/select/index.d.ts.map +1 -1
  59. package/lib/components/input/select/index.js +248 -31
  60. package/lib/components/input/select/index.js.map +1 -1
  61. package/lib/components/input/textInput/index.d.ts.map +1 -1
  62. package/lib/components/input/textInput/index.js +41 -6
  63. package/lib/components/input/textInput/index.js.map +1 -1
  64. package/lib/components/input/utils.d.ts +12 -0
  65. package/lib/components/input/utils.d.ts.map +1 -1
  66. package/lib/components/input/utils.js.map +1 -1
  67. package/lib/tail.css +2 -2
  68. package/package.json +1 -1
@@ -103,13 +103,13 @@ var react_2 = __importStar(require("react"));
103
103
  var button_1 = require("../../action/button");
104
104
  var iconButton_1 = require("../../action/iconButton");
105
105
  var textButton_1 = require("../../action/textButton");
106
- var collapse_1 = require("../../advanced/collapse");
107
106
  var popUp_1 = require("../../advanced/popUp");
108
107
  var formula_1 = require("../../data/formula");
109
108
  var buttonCell_1 = require("../../data/columnTypes/buttonCell");
110
109
  var context_1 = require("../../data/columnTypes/context");
111
110
  var dateRangeCell_1 = require("../../data/columnTypes/dateRangeCell");
112
111
  var systemColumns_1 = require("../../data/columnTypes/systemColumns");
112
+ var lookup_1 = require("../../data/columnTypes/lookup");
113
113
  var builder_1 = require("../../data/formula/builder");
114
114
  var readModule_1 = require("../../data/readModule");
115
115
  var updateModule_1 = require("../../data/updateModule");
@@ -119,6 +119,8 @@ var select_1 = require("../../input/select");
119
119
  var textInput_1 = require("../../input/textInput");
120
120
  var link_1 = require("../../structure/link");
121
121
  var detailList_1 = require("../detailList");
122
+ var compactRow_1 = require("../newList/compactRow");
123
+ var listRowFields_1 = require("../newList/listRowFields");
122
124
  var loading_1 = require("../loading");
123
125
  var groupSection_1 = require("../groupSection");
124
126
  var modal_1 = require("../modal");
@@ -126,6 +128,7 @@ var newPagination_1 = require("../newPagination");
126
128
  var recordActions_1 = require("../recordActions");
127
129
  var scrollShadow_1 = require("../scrollShadow");
128
130
  var columnWidth_1 = require("./columnWidth");
131
+ var labelPicker_1 = require("./labelPicker");
129
132
  var tag_1 = require("../tag");
130
133
  var defaultColours_1 = require("../../data/columnTypes/defaultColours");
131
134
  var personAvatar_1 = require("../../data/columnTypes/personAvatar");
@@ -143,6 +146,23 @@ var WIDE_EDIT_TYPES = [
143
146
  "file",
144
147
  "signature",
145
148
  ];
149
+ // INFO: markers on pinned cells for the side their own after:/before: line
150
+ // draws — a left pin its right edge, a right pin, the "+" and Actions their
151
+ // left edge. gridLines="all" reads them so it never draws a second line there.
152
+ var PIN_EDGE_RIGHT_CLASS = "newtable-pin-edge-right";
153
+ var PIN_EDGE_LEFT_CLASS = "newtable-pin-edge-left";
154
+ // INFO: vertical lines for gridLines="all", drawn on the right of each
155
+ // header and body cell of this table only (child combinators keep nested
156
+ // tables out). A cell whose right edge a pin already draws — a left pin, or
157
+ // the cell just before a right pin — is skipped. The last cell is skipped so
158
+ // it does not double the outer border. A grouped header's sub-titles all get
159
+ // a line, since the cells to their right sit in the row above.
160
+ // INFO: an inset shadow, not border-r: the table collapses its borders, and a
161
+ // collapsed border stays behind when a sticky cell (the checkbox column beside
162
+ // the pins) scrolls. A shadow is the cell's own paint, so it moves with it.
163
+ // The colours are the pins' edge colours, gray-200 and gray-700.
164
+ var GRID_LINES_ALL_CLASS = "[&>thead>tr>th:not(:last-child):not(.newtable-pin-edge-right):not(:has(+.newtable-pin-edge-left))]:shadow-[inset_-1px_0_0_#e5e7eb] [&>tbody>tr>td:not(:last-child):not(.newtable-pin-edge-right):not(:has(+.newtable-pin-edge-left))]:shadow-[inset_-1px_0_0_#e5e7eb] [&>thead>tr+tr>th]:shadow-[inset_-1px_0_0_#e5e7eb]";
165
+ var GRID_LINES_ALL_DARK_CLASS = "[&>thead>tr>th:not(:last-child):not(.newtable-pin-edge-right):not(:has(+.newtable-pin-edge-left))]:shadow-[inset_-1px_0_0_#374151] [&>tbody>tr>td:not(:last-child):not(.newtable-pin-edge-right):not(:has(+.newtable-pin-edge-left))]:shadow-[inset_-1px_0_0_#374151] [&>thead>tr+tr>th]:shadow-[inset_-1px_0_0_#374151]";
146
166
  // INFO: resolve dotted key paths (e.g. "group.subKey") against a row object.
147
167
  // Required because flatColumns uses "parent.child" keys for groupData sub-columns.
148
168
  var resolveValue = function (row, key) {
@@ -240,6 +260,7 @@ var ALL_COLUMN_TYPES = [
240
260
  { key: "dateRange", label: "Timeline" },
241
261
  { key: "timeTracking", label: "Time tracking" },
242
262
  { key: "button", label: "Button" },
263
+ { key: "lookup", label: "Lookup" },
243
264
  ];
244
265
  // INFO: never drawn as a table cell, so a column of these added from the
245
266
  // table would be invisible the moment it was made; one that exists can still
@@ -255,9 +276,11 @@ var LIST_TYPES = ["list", "multipleList"];
255
276
  // INFO: DataTemplate checks a new row against the first unique column only,
256
277
  // and only a typed value can be compared, so Unique is offered for these
257
278
  var UNIQUE_TYPES = ["string", "email", "contact", "number"];
258
- // INFO: a formula is computed and a button stores nothing, so neither has a
259
- // value a form could lock
260
- var UNLOCKABLE_TYPES = ["formula", "button"];
279
+ // INFO: a formula is computed, a button stores nothing and a lookup is always
280
+ // read-only — the host's server fills it in — so none has a value to lock
281
+ var UNLOCKABLE_TYPES = ["formula", "button", "lookup"];
282
+ // INFO: no value is typed into these, so there is nothing to require
283
+ var UNREQUIRABLE_TYPES = ["formula", "lookup"];
261
284
  // INFO: asset columns need a storage path, which the consumer fills in from its
262
285
  // own settings — nothing for the user to type
263
286
  var ASSET_TYPES = ["image", "file", "multipleImage", "multipleFile"];
@@ -415,6 +438,72 @@ var TAG_LINE_MAX = 2;
415
438
  // list, grid and kanban views show them; inside a table they are held to the
416
439
  // height of a text line so a row with pictures stays one line tall
417
440
  var CELL_FIT_CLASS = "[&_[data-cell-thumb=tile]]:!h-6 [&_[data-cell-thumb=tile]]:!w-6 [&_div[data-cell-thumb=tile]]:!p-0.5 [&_[data-cell-thumb=tile]_svg]:!h-4 [&_[data-cell-thumb=tile]_svg]:!w-4 [&_[data-cell-thumb=signature]]:!h-6 [&_[data-cell-line]]:!flex-nowrap [&_[data-cell-line]]:!gap-x-1";
441
+ // INFO: column types whose cell editor is a plain text field or text area,
442
+ // a date picker's read-only field, a phone's code and number, a yes/no
443
+ // dropdown (boolean, a Select that takes no typing), a list or multiple
444
+ // list with no colours (a coloured one has its board or label picker), a
445
+ // reference or list of references, which pick another record, roles, a person
446
+ // or people, or a pick from a referenced record's list. Under
447
+ // gridLines="all" their editor fills the cell (FILL_INPUT_CLASS).
448
+ var FILL_INPUT_TYPES = [
449
+ "string",
450
+ "number",
451
+ "email",
452
+ "textArea",
453
+ "date",
454
+ "contact",
455
+ "boolean",
456
+ "list",
457
+ "multipleList",
458
+ "reference",
459
+ "listReference",
460
+ "roles",
461
+ "person",
462
+ "listPerson",
463
+ "referenceSelection",
464
+ ];
465
+ // INFO: drops the field's own box — background, rounded corners and the
466
+ // hover / focus border — so the text is typed straight into the cell; an
467
+ // errored field keeps its red border. The cell's ring shows which one is open.
468
+ // A number field also drops the browser's spinner; arrow keys still step it.
469
+ // A read-only field (the date picker's) shows no caret, as it takes no typing.
470
+ // With no box to pad, the field's right padding goes too, so its text has the
471
+ // same room as the value it replaces (a title was cut off by a few pixels).
472
+ // A phone's flag starts where the value read, and its number sits one space
473
+ // (4px, with the field's 1px border) after the code — it has no box of its
474
+ // own in a cell to keep apart.
475
+ var FILL_INPUT_CLASS = "[&_[data-composite-input]]:pl-[9px] [&_[data-composite-input]>input]:!ml-0 [&_[data-composite-input]>input]:!pl-[3px] [&_input]:!pr-0 [&_textarea]:!pr-0 [&_input[readonly]]:caret-transparent [&_input[readonly]]:cursor-pointer [&_input::-webkit-inner-spin-button]:appearance-none [&_input::-webkit-outer-spin-button]:appearance-none [&_input]:[-moz-appearance:textfield] [&_input]:!bg-transparent [&_input]:!rounded-none [&_input:not(.border-red-300)]:!border-transparent [&_textarea]:!bg-transparent [&_textarea]:!rounded-none [&_textarea:not(.border-red-300)]:!border-transparent";
476
+ var FILL_INPUT_CELL_CLASS = "focus-within:ring-2 focus-within:ring-inset focus-within:ring-primary-500";
477
+ // INFO: the ring also stays while the cell is being edited — a date picker's
478
+ // calendar takes focus once a day is picked, and the cell is still open
479
+ var FILL_INPUT_ACTIVE_CLASS = "ring-2 ring-inset ring-primary-500";
480
+ // INFO: a cell being edited is the field's own surface — white, or the dark
481
+ // field colour — rather than the row's hover or pin background showing through
482
+ var FILL_INPUT_EDIT_BG_CLASS = "focus-within:!bg-white";
483
+ var FILL_INPUT_EDIT_BG_DARK_CLASS = "focus-within:!bg-gray-800";
484
+ var FILL_INPUT_ACTIVE_BG_CLASS = "!bg-white";
485
+ var FILL_INPUT_ACTIVE_BG_DARK_CLASS = "!bg-gray-800";
486
+ // INFO: every class the two above put on a cell — the title cell lifts them
487
+ // off itself and draws its ring on an overlay clear of its action strips
488
+ var FILL_RING_TOKENS = "".concat(FILL_INPUT_CELL_CLASS, " ").concat(FILL_INPUT_ACTIVE_CLASS).split(" ");
489
+ // INFO: column id → records; the second map's record wins for the same id
490
+ var handleMergeReferencesDetails = function (local, incoming) {
491
+ if (local === void 0) { local = {}; }
492
+ if (incoming === void 0) { incoming = {}; }
493
+ var merged = __assign({}, local);
494
+ Object.entries(incoming).forEach(function (_a) {
495
+ var columnId = _a[0], records = _a[1];
496
+ var kept = merged[columnId];
497
+ if (!Array.isArray(records) || !Array.isArray(kept)) {
498
+ merged[columnId] = records;
499
+ return;
500
+ }
501
+ var handleId = function (record) { var _a, _b; return String((_b = (_a = record === null || record === void 0 ? void 0 : record._id) !== null && _a !== void 0 ? _a : record === null || record === void 0 ? void 0 : record.id) !== null && _b !== void 0 ? _b : ""); };
502
+ var incomingIds = new Set(records.map(handleId));
503
+ merged[columnId] = __spreadArray(__spreadArray([], records, true), kept.filter(function (record) { return !incomingIds.has(handleId(record)); }), true);
504
+ });
505
+ return merged;
506
+ };
418
507
  var handleGetListColour = function (col, value) {
419
508
  var column = col;
420
509
  if (!Array.isArray(column.listSelection) ||
@@ -541,42 +630,52 @@ var NewTable = function (rawProps) {
541
630
  var _11 = (0, react_2.useState)("string"), newColumnType = _11[0], setNewColumnType = _11[1];
542
631
  var _12 = (0, react_2.useState)(""), newColumnRefSpace = _12[0], setNewColumnRefSpace = _12[1];
543
632
  var _13 = (0, react_2.useState)(""), newColumnRefLabel = _13[0], setNewColumnRefLabel = _13[1];
544
- var _14 = (0, react_2.useState)([]), newColumnOptions = _14[0], setNewColumnOptions = _14[1];
633
+ var _14 = (0, react_2.useState)(""), newColumnLookupReference = _14[0], setNewColumnLookupReference = _14[1];
634
+ var _15 = (0, react_2.useState)(""), newColumnLookupField = _15[0], setNewColumnLookupField = _15[1];
635
+ var _16 = (0, react_2.useState)([]), newColumnOptions = _16[0], setNewColumnOptions = _16[1];
545
636
  // INFO: the option row whose colour palette is open
546
- var _15 = (0, react_2.useState)(null), optionColourKey = _15[0], setOptionColourKey = _15[1];
547
- var _16 = (0, react_2.useState)(false), newColumnRequired = _16[0], setNewColumnRequired = _16[1];
548
- var _17 = (0, react_2.useState)(false), newColumnUnique = _17[0], setNewColumnUnique = _17[1];
549
- var _18 = (0, react_2.useState)(false), newColumnReadOnly = _18[0], setNewColumnReadOnly = _18[1];
550
- var _19 = (0, react_2.useState)(""), newColumnRatingMax = _19[0], setNewColumnRatingMax = _19[1];
551
- var _20 = (0, react_2.useState)(""), newColumnButtonLabel = _20[0], setNewColumnButtonLabel = _20[1];
552
- var _21 = (0, react_2.useState)(""), newColumnButtonColour = _21[0], setNewColumnButtonColour = _21[1];
553
- var _22 = (0, react_2.useState)(""), newColumnButtonConfirm = _22[0], setNewColumnButtonConfirm = _22[1];
554
- var _23 = (0, react_2.useState)(false), addingColumn = _23[0], setAddingColumn = _23[1];
637
+ var _17 = (0, react_2.useState)(null), optionColourKey = _17[0], setOptionColourKey = _17[1];
638
+ var _18 = (0, react_2.useState)(false), newColumnRequired = _18[0], setNewColumnRequired = _18[1];
639
+ var _19 = (0, react_2.useState)(false), newColumnUnique = _19[0], setNewColumnUnique = _19[1];
640
+ var _20 = (0, react_2.useState)(false), newColumnReadOnly = _20[0], setNewColumnReadOnly = _20[1];
641
+ var _21 = (0, react_2.useState)(""), newColumnRatingMax = _21[0], setNewColumnRatingMax = _21[1];
642
+ var _22 = (0, react_2.useState)(""), newColumnButtonLabel = _22[0], setNewColumnButtonLabel = _22[1];
643
+ var _23 = (0, react_2.useState)(""), newColumnButtonColour = _23[0], setNewColumnButtonColour = _23[1];
644
+ var _24 = (0, react_2.useState)(""), newColumnButtonConfirm = _24[0], setNewColumnButtonConfirm = _24[1];
645
+ var _25 = (0, react_2.useState)(false), addingColumn = _25[0], setAddingColumn = _25[1];
555
646
  // INFO: the formula as shown in the builder — column names, not ids
556
- var _24 = (0, react_2.useState)(""), newColumnFormula = _24[0], setNewColumnFormula = _24[1];
647
+ var _26 = (0, react_2.useState)(""), newColumnFormula = _26[0], setNewColumnFormula = _26[1];
557
648
  var addColumnPopUpRef = (0, react_2.useRef)(null);
558
649
  // INFO: the column being changed — empty while the panel adds a new one
559
- var _25 = (0, react_2.useState)(null), editingColumn = _25[0], setEditingColumn = _25[1];
650
+ var _27 = (0, react_2.useState)(null), editingColumn = _27[0], setEditingColumn = _27[1];
560
651
  //=====================================================================================
561
652
  // SECTION: Editable & Addable cells
562
653
  //=====================================================================================
563
- var _26 = (0, react_2.useState)(""), editDataRowId = _26[0], setEditDataRowId = _26[1];
564
- var _27 = (0, react_2.useState)(""), editDataHeaderKey = _27[0], setEditDataHeaderKey = _27[1];
654
+ var _28 = (0, react_2.useState)(""), editDataRowId = _28[0], setEditDataRowId = _28[1];
655
+ var _29 = (0, react_2.useState)(""), editDataHeaderKey = _29[0], setEditDataHeaderKey = _29[1];
565
656
  // INFO: an editable table used to mount an input in every cell — it read as a
566
657
  // form, and a row click always landed on a child input. Only the hovered cell
567
658
  // becomes its input now; NewTableHoverCell keeps that hover to itself.
568
- var _28 = (0, react_2.useState)(false), modalEditVisible = _28[0], setModalEditVisible = _28[1];
659
+ // INFO: "rowId:colKey" of a gridLines="all" cell a click just opened — its
660
+ // editor takes focus as it mounts, with the caret at the end
661
+ var pendingFocusRef = (0, react_2.useRef)("");
662
+ // INFO: the cell a gridLines="all" multiple list is being picked in — its
663
+ // popover hangs from this element
664
+ var _30 = (0, react_2.useState)(null), labelPickerAnchor = _30[0], setLabelPickerAnchor = _30[1];
665
+ var _31 = (0, react_2.useState)(false), modalEditVisible = _31[0], setModalEditVisible = _31[1];
569
666
  // INFO: whether the modal's signature pad has been drawn on
570
- var _29 = (0, react_2.useState)(false), signatureSigning = _29[0], setSignatureSigning = _29[1];
571
- var _30 = (0, react_2.useState)([]), collapsedGroupIds = _30[0], setCollapsedGroupIds = _30[1];
667
+ var _32 = (0, react_2.useState)(false), signatureSigning = _32[0], setSignatureSigning = _32[1];
668
+ var _33 = (0, react_2.useState)([]), collapsedGroupIds = _33[0], setCollapsedGroupIds = _33[1];
572
669
  // INFO: rows shown per section when the sections do not page themselves
573
- var _31 = (0, react_2.useState)({}), groupVisibleCounts = _31[0], setGroupVisibleCounts = _31[1];
670
+ var _34 = (0, react_2.useState)({}), groupVisibleCounts = _34[0], setGroupVisibleCounts = _34[1];
574
671
  // INFO: per-group scroll pagination. One sentinel element per band, observed
575
672
  // by a single IntersectionObserver that fires props.onGroupLoadMore when a
576
673
  // band's sentinel scrolls into view. The debounce guard stops repeat fires
577
674
  // while that group's next page is in flight.
578
675
  var groupSentinelRefs = (0, react_2.useRef)({});
579
676
  var groupLoadMoreDebounce = (0, react_2.useRef)({});
677
+ // INFO: groups whose load settled and wait to check their sentinel again
678
+ var groupRecheckRef = (0, react_2.useRef)(new Set());
580
679
  var onGroupLoadMoreRef = (0, react_2.useRef)(props.onGroupLoadMore);
581
680
  onGroupLoadMoreRef.current = props.onGroupLoadMore;
582
681
  // INFO: sheet-style row selection — Shift-click extends from the last
@@ -586,37 +685,50 @@ var NewTable = function (rawProps) {
586
685
  var lastSelectedRowRef = (0, react_2.useRef)(null);
587
686
  var dragSelectRef = (0, react_2.useRef)(null);
588
687
  var suppressNextClickRef = (0, react_2.useRef)(false);
589
- var _32 = (0, react_2.useState)(false), isDragSelecting = _32[0], setIsDragSelecting = _32[1];
590
- var _33 = (0, react_2.useState)(0), copiedCount = _33[0], setCopiedCount = _33[1];
591
- var _34 = (0, react_2.useState)({}), editDataValue = _34[0], setEditDataValue = _34[1];
592
- var _35 = (0, react_2.useState)(false), editDataIsLoading = _35[0], setEditDataIsLoading = _35[1];
688
+ var _35 = (0, react_2.useState)(false), isDragSelecting = _35[0], setIsDragSelecting = _35[1];
689
+ var _36 = (0, react_2.useState)(0), copiedCount = _36[0], setCopiedCount = _36[1];
690
+ var _37 = (0, react_2.useState)({}), editDataValue = _37[0], setEditDataValue = _37[1];
691
+ var _38 = (0, react_2.useState)(false), editDataIsLoading = _38[0], setEditDataIsLoading = _38[1];
593
692
  // INFO: true while the empty bottom row is being filled in; the row itself is
594
693
  // always there in an addable table
595
- var _36 = (0, react_2.useState)(false), addData = _36[0], setAddData = _36[1];
694
+ var _39 = (0, react_2.useState)(false), addData = _39[0], setAddData = _39[1];
596
695
  var isAddRowPinned = props.paginationType === "scroll";
597
- var _37 = (0, react_2.useState)({}), addDataValue = _37[0], setAddDataValue = _37[1];
696
+ var _40 = (0, react_2.useState)({}), addDataValue = _40[0], setAddDataValue = _40[1];
598
697
  // INFO: bumped after each saved row, so the next one starts with fresh
599
698
  // inputs and its first cell takes the focus
600
- var _38 = (0, react_2.useState)(0), addRowKey = _38[0], setAddRowKey = _38[1];
699
+ var _41 = (0, react_2.useState)(0), addRowKey = _41[0], setAddRowKey = _41[1];
700
+ // INFO: the add row's coloured multiple list being picked under
701
+ // gridLines="all" — its label picker hangs from this cell
702
+ // INFO: the new row's required tag columns left empty on a save — their
703
+ // cells are ringed red until a label is picked
704
+ var _42 = (0, react_2.useState)([]), addTagErrors = _42[0], setAddTagErrors = _42[1];
705
+ var _43 = (0, react_2.useState)(null), addLabelPicker = _43[0], setAddLabelPicker = _43[1];
601
706
  // INFO: the group whose own add row is being filled in; "" = the bottom row
602
- var _39 = (0, react_2.useState)(""), addGroupId = _39[0], setAddGroupId = _39[1];
707
+ var _44 = (0, react_2.useState)(""), addGroupId = _44[0], setAddGroupId = _44[1];
603
708
  // INFO: the row armed by a press on its handle, so only the handle — never
604
709
  // a click or a text selection in a cell — starts a drag
605
- var _40 = (0, react_2.useState)(""), dragArmedRowId = _40[0], setDragArmedRowId = _40[1];
606
- var _41 = (0, react_2.useState)(""), draggingRowId = _41[0], setDraggingRowId = _41[1];
607
- var _42 = (0, react_2.useState)(""), dropGroupId = _42[0], setDropGroupId = _42[1];
608
- var _43 = (0, react_2.useState)({}), referencesOptions = _43[0], setReferencesOptions = _43[1];
710
+ var _45 = (0, react_2.useState)(""), dragArmedRowId = _45[0], setDragArmedRowId = _45[1];
711
+ var _46 = (0, react_2.useState)(""), draggingRowId = _46[0], setDraggingRowId = _46[1];
712
+ var _47 = (0, react_2.useState)(""), dropGroupId = _47[0], setDropGroupId = _47[1];
713
+ var _48 = (0, react_2.useState)({}), referencesOptions = _48[0], setReferencesOptions = _48[1];
609
714
  // INFO: seeded options sit under the local map so a cell's own search
610
715
  // results still win per key
611
716
  var mergedReferencesOptions = __assign(__assign({}, ((_m = props.referencesOptions) !== null && _m !== void 0 ? _m : {})), referencesOptions);
612
- var _44 = (0, react_2.useState)({}), referencesDetails = _44[0], setReferencesDetails = _44[1];
613
- var _45 = (0, react_2.useState)(false), referenceLoading = _45[0], setReferenceLoading = _45[1];
717
+ var _49 = (0, react_2.useState)({}), referencesDetails = _49[0], setReferencesDetails = _49[1];
718
+ // INFO: per column, the records a search found and the records the parent
719
+ // passes in, matched by id — a search copies the parent's records into the
720
+ // local map, so the parent's copy wins and a reload of the list reaches the
721
+ // cells, while a record only the search found is kept
722
+ // INFO: worked out once per change, not on every redraw — a cell being
723
+ // typed into redraws the table on each key
724
+ var mergedReferencesDetails = (0, react_2.useMemo)(function () { return handleMergeReferencesDetails(referencesDetails, props.referencesDetails); }, [referencesDetails, props.referencesDetails]);
725
+ var _50 = (0, react_2.useState)(false), referenceLoading = _50[0], setReferenceLoading = _50[1];
614
726
  // INFO: measured pixel widths for pinned columns without an explicit width.
615
- var _46 = (0, react_2.useState)({}), measuredPinWidths = _46[0], setMeasuredPinWidths = _46[1];
727
+ var _51 = (0, react_2.useState)({}), measuredPinWidths = _51[0], setMeasuredPinWidths = _51[1];
616
728
  // INFO: the scrolling view's width, which caps how much the left pins take
617
- var _47 = (0, react_2.useState)(0), pinViewWidth = _47[0], setPinViewWidth = _47[1];
729
+ var _52 = (0, react_2.useState)(0), pinViewWidth = _52[0], setPinViewWidth = _52[1];
618
730
  // INFO: per large group, the rows [start, end) drawn; the rest are spacers
619
- var _48 = (0, react_2.useState)({}), virtualRanges = _48[0], setVirtualRanges = _48[1];
731
+ var _53 = (0, react_2.useState)({}), virtualRanges = _53[0], setVirtualRanges = _53[1];
620
732
  // INFO: each drawn row's measured height, kept so a spacer is as tall as the
621
733
  // rows it stands in for
622
734
  var rowHeightsRef = (0, react_2.useRef)(new Map());
@@ -629,6 +741,9 @@ var NewTable = function (rawProps) {
629
741
  version: 0,
630
742
  });
631
743
  var editDataValueRef = (0, react_2.useRef)({});
744
+ // INFO: the check a cell's blur is running — under gridLines="all" the next
745
+ // cell opens only once it is done, while the field it checks still exists
746
+ var blurCheckRef = (0, react_2.useRef)(null);
632
747
  var editDataRowIdRef = (0, react_2.useRef)("");
633
748
  var editDataHeaderKeyRef = (0, react_2.useRef)("");
634
749
  var editDataInputRefs = (0, react_2.useRef)([]);
@@ -743,6 +858,40 @@ var NewTable = function (rawProps) {
743
858
  var selectedRowBg = props.darkMode ? "bg-gray-700" : "bg-primary-50";
744
859
  var rowHoverBg = props.darkMode ? "hover:bg-gray-700" : "hover:bg-gray-100";
745
860
  var dividerColor = props.darkMode ? "divide-gray-700" : "divide-gray-100";
861
+ var gridLines = (_p = props.gridLines) !== null && _p !== void 0 ? _p : "horizontal";
862
+ // INFO: under gridLines="all" a coloured list cell paints its whole table
863
+ // cell, like a spreadsheet's cell fill, instead of holding a chip. The Select
864
+ // inside is told (cellInput.fill) to keep only the label colour. Same shades
865
+ // as the Select's own fill; a hex goes inline.
866
+ var handleGetCellFill = function (col, value) {
867
+ var _a;
868
+ if (gridLines !== "all")
869
+ return undefined;
870
+ var colour = handleGetListColour(col, value);
871
+ if (!colour)
872
+ return undefined;
873
+ if (colour.startsWith("#"))
874
+ return { className: "text-white", style: { backgroundColor: colour } };
875
+ return { className: (_a = select_1.FILL_CLASS[colour]) !== null && _a !== void 0 ? _a : select_1.FILL_CLASS.default };
876
+ };
877
+ // INFO: a pinned cell carries the row's background (and its hover and
878
+ // selected shades); with a fill those would fight the fill's class by CSS
879
+ // order, so they are dropped. after:/before: keep the pin's edge line.
880
+ var handleDropCellBg = function (className) {
881
+ return (className !== null && className !== void 0 ? className : "")
882
+ .split(" ")
883
+ .filter(function (each) {
884
+ return !each.includes("bg-") ||
885
+ each.startsWith("after:") ||
886
+ each.startsWith("before:");
887
+ })
888
+ .join(" ");
889
+ };
890
+ var gridLinesClass = gridLines === "all"
891
+ ? props.darkMode
892
+ ? GRID_LINES_ALL_DARK_CLASS
893
+ : GRID_LINES_ALL_CLASS
894
+ : "";
746
895
  var cellFontColor = props.darkMode ? "text-gray-200" : "text-gray-700";
747
896
  var titleFontColor = props.darkMode
748
897
  ? "text-primary-300 font-medium"
@@ -781,8 +930,8 @@ var NewTable = function (rawProps) {
781
930
  var errorFontColor = props.darkMode ? "text-red-300" : "text-red-500";
782
931
  // INFO: an edit commits on blur, but navigating away unmounts the table
783
932
  // without one — the cell was left dirty on screen and the value never sent.
784
- var onUpdateDataRef = (0, react_2.useRef)((_p = props.editable) === null || _p === void 0 ? void 0 : _p.onUpdateData);
785
- onUpdateDataRef.current = (_q = props.editable) === null || _q === void 0 ? void 0 : _q.onUpdateData;
933
+ var onUpdateDataRef = (0, react_2.useRef)((_q = props.editable) === null || _q === void 0 ? void 0 : _q.onUpdateData);
934
+ onUpdateDataRef.current = (_r = props.editable) === null || _r === void 0 ? void 0 : _r.onUpdateData;
786
935
  (0, react_2.useEffect)(function () {
787
936
  return function () {
788
937
  var _a, _b;
@@ -806,6 +955,16 @@ var NewTable = function (rawProps) {
806
955
  document.addEventListener("mouseup", handleRelease);
807
956
  return function () { return document.removeEventListener("mouseup", handleRelease); };
808
957
  }, [dragArmedRowId, draggingRowId]);
958
+ // INFO: a closed edit lets go of its label picker's cell
959
+ (0, react_2.useEffect)(function () {
960
+ if (!editDataHeaderKey)
961
+ setLabelPickerAnchor(null);
962
+ }, [editDataHeaderKey]);
963
+ // INFO: a new or closed add row has no label picker open and no errors
964
+ (0, react_2.useEffect)(function () {
965
+ setAddLabelPicker(null);
966
+ setAddTagErrors([]);
967
+ }, [addData, addRowKey, addGroupId]);
809
968
  // INFO: the clicked cell of a new row takes the focus once its input is on
810
969
  // screen, so typing starts where the click landed
811
970
  (0, react_2.useEffect)(function () {
@@ -815,8 +974,17 @@ var NewTable = function (rawProps) {
815
974
  pendingAddFocusRef.current = "";
816
975
  var frameId = requestAnimationFrame(function () {
817
976
  var _a, _b;
818
- var field = (_b = (_a = addRowRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("[data-add-cell=\"".concat(colKey, "\"]"))) === null || _b === void 0 ? void 0 : _b.querySelector("input, textarea, button");
819
- field === null || field === void 0 ? void 0 : field.focus();
977
+ var cell = (_a = addRowRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("[data-add-cell=\"".concat(colKey, "\"]"));
978
+ // INFO: under gridLines="all" a coloured multiple list's cell is its tag
979
+ // line, which opens the label picker — the click that started the row
980
+ // opens it too, as a click on any other cell starts typing there
981
+ var tagLine = cell === null || cell === void 0 ? void 0 : cell.querySelector('[data-testid^="table-add-tag-line-"]');
982
+ if (cell && tagLine) {
983
+ tagLine.focus();
984
+ setAddLabelPicker({ key: colKey, anchor: cell });
985
+ return;
986
+ }
987
+ (_b = cell === null || cell === void 0 ? void 0 : cell.querySelector("input, textarea, button")) === null || _b === void 0 ? void 0 : _b.focus();
820
988
  });
821
989
  return function () { return cancelAnimationFrame(frameId); };
822
990
  }, [addData, addRowKey]);
@@ -943,21 +1111,24 @@ var NewTable = function (rawProps) {
943
1111
  (0, react_2.useEffect)(function () {
944
1112
  var _a;
945
1113
  var status = (_a = props.groupLoadingStatus) !== null && _a !== void 0 ? _a : {};
946
- var settled = [];
947
1114
  Object.keys(groupLoadMoreDebounce.current).forEach(function (groupId) {
948
1115
  var _a;
949
1116
  if ((_a = status[groupId]) === null || _a === void 0 ? void 0 : _a.loadingMore)
950
1117
  return;
951
1118
  if (groupLoadMoreDebounce.current[groupId])
952
- settled.push(groupId);
1119
+ groupRecheckRef.current.add(groupId);
953
1120
  groupLoadMoreDebounce.current[groupId] = false;
954
1121
  });
955
- if (settled.length === 0)
1122
+ if (groupRecheckRef.current.size === 0)
956
1123
  return;
957
1124
  // INFO: read after the new rows are laid out and the observer has said
958
- // whether the sentinel is still on screen, so a band loads no extra page
1125
+ // whether the sentinel is still on screen, so a band loads no extra page.
1126
+ // The bands wait in a ref, so another band settling within the delay does
1127
+ // not drop them along with the cleared timer
959
1128
  var timer = setTimeout(function () {
960
- settled.forEach(function (groupId) {
1129
+ var pending = Array.from(groupRecheckRef.current);
1130
+ groupRecheckRef.current.clear();
1131
+ pending.forEach(function (groupId) {
961
1132
  var _a, _b;
962
1133
  if (groupIntersectingRef.current[groupId] &&
963
1134
  !((_b = ((_a = props.groupLoadingStatus) !== null && _a !== void 0 ? _a : {})[groupId]) === null || _b === void 0 ? void 0 : _b.exhausted))
@@ -1109,7 +1280,7 @@ var NewTable = function (rawProps) {
1109
1280
  args_1[_i - 1] = arguments[_i];
1110
1281
  }
1111
1282
  return __awaiter(void 0, __spreadArray([keepAdding_1], args_1, true), void 0, function (keepAdding, leaving) {
1112
- var valid, typed, data, _a;
1283
+ var valid, missingTags, typed, data, _a;
1113
1284
  var _b, _c, _d;
1114
1285
  if (leaving === void 0) { leaving = false; }
1115
1286
  return __generator(this, function (_e) {
@@ -1123,7 +1294,20 @@ var NewTable = function (rawProps) {
1123
1294
  return [4 /*yield*/, handleCheckFormInputRefs("add")];
1124
1295
  case 1:
1125
1296
  valid = _e.sent();
1126
- if (!valid) {
1297
+ missingTags = gridLines === "all"
1298
+ ? handleGetAddColumns()
1299
+ .filter(function (col) {
1300
+ var _a;
1301
+ return handleIsAddColumn(col) &&
1302
+ col.type === "multipleList" &&
1303
+ handleColumnShowsTags(col) &&
1304
+ (0, updateModule_1.handleIsFieldRequired)(col, addDataValueRef.current) &&
1305
+ !(0, utils_1.handleIsValueFilled)((_a = addDataValueRef.current) === null || _a === void 0 ? void 0 : _a[col.key]);
1306
+ })
1307
+ .map(function (col) { return col.key; })
1308
+ : [];
1309
+ setAddTagErrors(missingTags);
1310
+ if (!valid || missingTags.length > 0) {
1127
1311
  if (leaving)
1128
1312
  setAddData(false);
1129
1313
  return [2 /*return*/];
@@ -1413,14 +1597,16 @@ var NewTable = function (rawProps) {
1413
1597
  setEditDataHeaderKey("");
1414
1598
  };
1415
1599
  var handleEditDataOnBlur = function (columnId, updateData, options) { return __awaiter(void 0, void 0, void 0, function () {
1416
- var currentRowId, valid, isDiff, previousValue, err_1;
1600
+ var currentRowId, check, valid, isDiff, previousValue, err_1;
1417
1601
  var _a, _b;
1418
1602
  var _c, _d, _e;
1419
1603
  return __generator(this, function (_f) {
1420
1604
  switch (_f.label) {
1421
1605
  case 0:
1422
1606
  currentRowId = editDataRowIdRef.current;
1423
- return [4 /*yield*/, handleCheckFormInputRefs("edit")];
1607
+ check = handleCheckFormInputRefs("edit");
1608
+ blurCheckRef.current = check;
1609
+ return [4 /*yield*/, check];
1424
1610
  case 1:
1425
1611
  valid = _f.sent();
1426
1612
  if (!valid)
@@ -1467,7 +1653,7 @@ var NewTable = function (rawProps) {
1467
1653
  // it stays here until the table unmounts. Tailwind cannot emit a runtime
1468
1654
  // w-[Npx], so a width drives an inline style and wins over the col.width
1469
1655
  // class.
1470
- var _49 = (0, react_2.useState)({}), columnWidths = _49[0], setColumnWidths = _49[1];
1656
+ var _54 = (0, react_2.useState)({}), columnWidths = _54[0], setColumnWidths = _54[1];
1471
1657
  var resizeRef = (0, react_2.useRef)(null);
1472
1658
  // INFO: a dragged width first, else the column's own fixed width in pixels
1473
1659
  // whatever form it is stored in ("180px", "w-[180px]", "w-48")
@@ -1494,7 +1680,7 @@ var NewTable = function (rawProps) {
1494
1680
  // has a set width — a pinned title, or one dragged or configured. A title
1495
1681
  // sized by its content would widen and shift the table on every hover, so
1496
1682
  // it keeps the chevron's room all the time instead.
1497
- var titleKey = (_r = flatColumns[0]) === null || _r === void 0 ? void 0 : _r.key;
1683
+ var titleKey = (_s = flatColumns[0]) === null || _s === void 0 ? void 0 : _s.key;
1498
1684
  var isTitleWidthFixed = !!titleKey &&
1499
1685
  (leftPinned.includes(titleKey) ||
1500
1686
  rightPinned.includes(titleKey) ||
@@ -1600,7 +1786,7 @@ var NewTable = function (rawProps) {
1600
1786
  ? ALL_COLUMN_TYPES.filter(function (eachType) {
1601
1787
  return (0, exports.handleGetEditableColumnTypes)(editingColumn.type).includes(eachType.key);
1602
1788
  })
1603
- : ADD_COLUMN_TYPES, disabled: !!editingColumn &&
1789
+ : handleGetAddColumnTypes(), disabled: !!editingColumn &&
1604
1790
  (0, exports.handleGetEditableColumnTypes)(editingColumn.type).length < 2, portalDropdown: true, onChange: function (value) {
1605
1791
  var _a;
1606
1792
  setNewColumnType(value);
@@ -1620,6 +1806,7 @@ var NewTable = function (rawProps) {
1620
1806
  setNewColumnRefLabel("");
1621
1807
  } }),
1622
1808
  react_2.default.createElement(select_1.Select, { id: "newColumnRefLabel", label: "Reference label", value: newColumnRefLabel, darkMode: props.darkMode, portalDropdown: true, disabled: !newColumnRefSpace, options: (_g = (_f = (_e = props.advSettings).renderReferenceLabelOptions) === null || _f === void 0 ? void 0 : _f.call(_e, newColumnRefSpace)) !== null && _g !== void 0 ? _g : [], onChange: function (value) { return setNewColumnRefLabel(value); } }))),
1809
+ newColumnType === "lookup" && renderLookupPickers(),
1623
1810
  LIST_TYPES.includes(newColumnType) && renderColumnOptions(),
1624
1811
  newColumnType === "number" && (react_2.default.createElement(textInput_1.TextInput, { id: "newColumnRatingMax", type: "number", label: "Rating Stars", placeholder: "1 - ".concat(buttonCell_1.MAX_RATING), value: newColumnRatingMax, darkMode: props.darkMode, onChange: function (event) { var _a, _b; return setNewColumnRatingMax((_b = (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : ""); } })),
1625
1812
  newColumnType === "button" && (react_2.default.createElement(react_2.default.Fragment, null,
@@ -1628,13 +1815,15 @@ var NewTable = function (rawProps) {
1628
1815
  react_2.default.createElement(textInput_1.TextInput, { id: "newColumnButtonConfirm", type: "text", label: "Confirm Message", placeholder: "Send this to the customer?", value: newColumnButtonConfirm, darkMode: props.darkMode, onChange: function (event) { var _a, _b; return setNewColumnButtonConfirm((_b = (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : ""); } }))),
1629
1816
  ASSET_TYPES.includes(newColumnType) && (react_2.default.createElement("p", { className: "-mt-2 text-xs text-gray-500" }, "Uploads are stored against this space automatically.")),
1630
1817
  newColumnType === "formula" && (react_2.default.createElement(builder_1.FormulaBuilder, { value: newColumnFormula, schema: handleGetFormulaSchema(), columnId: editingColumn === null || editingColumn === void 0 ? void 0 : editingColumn.id, previewRow: (_h = props.data) === null || _h === void 0 ? void 0 : _h[0], previewDisplayRow: (_j = props.spaceData) === null || _j === void 0 ? void 0 : _j[0], darkMode: props.darkMode, onChange: setNewColumnFormula })),
1631
- newColumnType !== "formula" && (react_2.default.createElement(checkbox_1.Checkbox, { id: "newColumnRequired",
1818
+ !UNREQUIRABLE_TYPES.includes(newColumnType) && (react_2.default.createElement(checkbox_1.Checkbox, { id: "newColumnRequired",
1632
1819
  // INFO: the checkbox itself is not a required field — without this it
1633
1820
  // renders "Required *", which reads as a validation error on a toggle
1634
1821
  optional: true, darkMode: props.darkMode, itemList: [{ key: "required", label: "Required" }], selectItemList: newColumnRequired ? ["required"] : [], onChange: function (items) {
1635
1822
  return setNewColumnRequired(items.includes("required"));
1636
1823
  } })),
1637
- newColumnType !== "formula" && newColumnRequired && !editingColumn && (react_2.default.createElement("p", { className: "-mt-3 text-xs text-gray-500" }, "Rows already in this table have no value for it yet.")),
1824
+ !UNREQUIRABLE_TYPES.includes(newColumnType) &&
1825
+ newColumnRequired &&
1826
+ !editingColumn && (react_2.default.createElement("p", { className: "-mt-3 text-xs text-gray-500" }, "Rows already in this table have no value for it yet.")),
1638
1827
  handleCanSetUnique() && (react_2.default.createElement(checkbox_1.Checkbox, { id: "newColumnUnique", optional: true, darkMode: props.darkMode, itemList: [{ key: "unique", label: "Unique" }], selectItemList: newColumnUnique ? ["unique"] : [], onChange: function (items) {
1639
1828
  return setNewColumnUnique(items.includes("unique"));
1640
1829
  } })),
@@ -1707,8 +1896,51 @@ var NewTable = function (rawProps) {
1707
1896
  renderOptionColourPalette(eachOption, index)));
1708
1897
  }),
1709
1898
  react_2.default.createElement(textButton_1.TextButton, { text: "Add option", className: "self-start text-sm", onClick: handleAddOption }))); };
1899
+ // INFO: a lookup needs a datasheet's columns to choose from, which only the
1900
+ // reference label provider gives
1901
+ var handleGetAddColumnTypes = function () {
1902
+ var _a;
1903
+ return ((_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.renderReferenceLabelOptions)
1904
+ ? ADD_COLUMN_TYPES
1905
+ : ADD_COLUMN_TYPES.filter(function (eachType) { return eachType.key !== "lookup"; });
1906
+ };
1907
+ // INFO: the reference columns of this datasheet a lookup can read through —
1908
+ // a lookup drawn as a reference is not one
1909
+ var handleGetLookupReferenceColumns = function () {
1910
+ return handleGetFormulaSchema().filter(function (eachColumn) {
1911
+ return lookup_1.LOOKUP_REFERENCE_TYPES.includes(eachColumn.type) &&
1912
+ !!eachColumn.referenceSpaceId &&
1913
+ !(0, lookup_1.handleIsLookupDerived)(eachColumn);
1914
+ });
1915
+ };
1916
+ // INFO: the linked datasheet's columns, less those the host's server
1917
+ // refuses to show — read from the same provider the reference label uses
1918
+ var handleGetLookupFieldOptions = function () {
1919
+ var _a, _b;
1920
+ var provider = (_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.renderReferenceLabelOptions;
1921
+ var reference = handleGetLookupReferenceColumns().find(function (eachColumn) { return eachColumn.id === newColumnLookupReference; });
1922
+ if (!provider || !(reference === null || reference === void 0 ? void 0 : reference.referenceSpaceId))
1923
+ return [];
1924
+ var spaceId = reference.referenceSpaceId;
1925
+ var refused = new Set(lookup_1.LOOKUP_UNSUPPORTED_SOURCE_TYPES.flatMap(function (eachType) {
1926
+ var _a;
1927
+ return ((_a = provider(spaceId, false, eachType)) !== null && _a !== void 0 ? _a : []).map(function (eachOption) { return eachOption.key; });
1928
+ }));
1929
+ return ((_b = provider(spaceId, true)) !== null && _b !== void 0 ? _b : []).filter(function (eachOption) { return !refused.has(eachOption.key); });
1930
+ };
1931
+ var renderLookupPickers = function () { return (react_2.default.createElement(react_2.default.Fragment, null,
1932
+ react_2.default.createElement(select_1.Select, { id: "newColumnLookupReference", label: "Reference column", value: newColumnLookupReference, darkMode: props.darkMode, portalDropdown: true, options: handleGetLookupReferenceColumns().map(function (eachColumn) { return ({
1933
+ key: eachColumn.id,
1934
+ label: eachColumn.name,
1935
+ }); }), onChange: function (value) {
1936
+ setNewColumnLookupReference(value);
1937
+ // INFO: the shown column belongs to the linked datasheet, so a new
1938
+ // reference invalidates whatever was picked before
1939
+ setNewColumnLookupField("");
1940
+ } }),
1941
+ react_2.default.createElement(select_1.Select, { id: "newColumnLookupField", label: "Lookup column", value: newColumnLookupField, darkMode: props.darkMode, portalDropdown: true, disabled: !newColumnLookupReference, options: handleGetLookupFieldOptions(), onChange: function (value) { return setNewColumnLookupField(value); } }))); };
1710
1942
  var handleEditColumnModal = function (columnId) {
1711
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1943
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
1712
1944
  var schema = (_b = (_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.getColumnSchema) === null || _b === void 0 ? void 0 : _b.call(_a, columnId);
1713
1945
  if (!schema)
1714
1946
  return;
@@ -1717,15 +1949,17 @@ var NewTable = function (rawProps) {
1717
1949
  setNewColumnType((_d = schema.type) !== null && _d !== void 0 ? _d : "string");
1718
1950
  setNewColumnRefSpace((_e = schema.referenceSpaceId) !== null && _e !== void 0 ? _e : "");
1719
1951
  setNewColumnRefLabel((_f = schema.referenceLabel) !== null && _f !== void 0 ? _f : "");
1952
+ setNewColumnLookupReference((_g = schema.referenceFieldId) !== null && _g !== void 0 ? _g : "");
1953
+ setNewColumnLookupField((_h = schema.lookupFieldId) !== null && _h !== void 0 ? _h : "");
1720
1954
  setNewColumnOptions((0, exports.handleReadColumnOptions)(schema));
1721
1955
  setOptionColourKey(null);
1722
1956
  setNewColumnRequired(!schema.optional);
1723
1957
  setNewColumnUnique(!!schema.unique);
1724
1958
  setNewColumnReadOnly(!!schema.disabled);
1725
1959
  setNewColumnRatingMax(schema.ratingMax ? String(schema.ratingMax) : "");
1726
- setNewColumnButtonLabel((_g = schema.buttonLabel) !== null && _g !== void 0 ? _g : "");
1727
- setNewColumnButtonColour((_h = schema.buttonColour) !== null && _h !== void 0 ? _h : "");
1728
- setNewColumnButtonConfirm((_j = schema.buttonConfirm) !== null && _j !== void 0 ? _j : "");
1960
+ setNewColumnButtonLabel((_j = schema.buttonLabel) !== null && _j !== void 0 ? _j : "");
1961
+ setNewColumnButtonColour((_k = schema.buttonColour) !== null && _k !== void 0 ? _k : "");
1962
+ setNewColumnButtonConfirm((_l = schema.buttonConfirm) !== null && _l !== void 0 ? _l : "");
1729
1963
  setNewColumnFormula(schema.type === "formula"
1730
1964
  ? (0, formula_1.handleGetFormulaDisplay)(schema, handleGetFormulaSchema())
1731
1965
  : "");
@@ -1745,6 +1979,8 @@ var NewTable = function (rawProps) {
1745
1979
  setNewColumnType("string");
1746
1980
  setNewColumnRefSpace("");
1747
1981
  setNewColumnRefLabel("");
1982
+ setNewColumnLookupReference("");
1983
+ setNewColumnLookupField("");
1748
1984
  setNewColumnOptions([]);
1749
1985
  setOptionColourKey(null);
1750
1986
  setNewColumnRequired(false);
@@ -1808,6 +2044,8 @@ var NewTable = function (rawProps) {
1808
2044
  return false;
1809
2045
  if (REFERENCE_TYPES.includes(newColumnType))
1810
2046
  return !!newColumnRefSpace && !!newColumnRefLabel;
2047
+ if (newColumnType === "lookup")
2048
+ return !!newColumnLookupReference && !!newColumnLookupField;
1811
2049
  // INFO: an illegal formula would show "Error" in every row
1812
2050
  if (newColumnType === "formula") {
1813
2051
  if (!newColumnFormula.trim())
@@ -1911,6 +2149,11 @@ var NewTable = function (rawProps) {
1911
2149
  column.formulaExpression = (0, formula_1.handleFormulaToStorage)(newColumnFormula.trim(), handleGetFormulaSchema());
1912
2150
  column.optional = true;
1913
2151
  }
2152
+ if (newColumnType === "lookup") {
2153
+ column.referenceFieldId = newColumnLookupReference;
2154
+ column.lookupFieldId = newColumnLookupField;
2155
+ column.optional = true;
2156
+ }
1914
2157
  handleApplyColumnSettings(column);
1915
2158
  return [4 /*yield*/, ((_b = (_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.onAddColumn) === null || _b === void 0 ? void 0 : _b.call(_a, column))];
1916
2159
  case 4:
@@ -1968,6 +2211,18 @@ var NewTable = function (rawProps) {
1968
2211
  column_1.formulaExpression = (0, formula_1.handleFormulaToStorage)(newColumnFormula.trim(), handleGetFormulaSchema());
1969
2212
  column_1.optional = true;
1970
2213
  }
2214
+ if (newColumnType === "lookup") {
2215
+ // INFO: the copied type and settings belong to the old source; the
2216
+ // host's server copies them again from the new one on save
2217
+ if (newColumnLookupReference !== original.referenceFieldId ||
2218
+ newColumnLookupField !== original.lookupFieldId) {
2219
+ delete column_1.lookupFieldType;
2220
+ delete column_1.lookupFieldSettings;
2221
+ }
2222
+ column_1.referenceFieldId = newColumnLookupReference;
2223
+ column_1.lookupFieldId = newColumnLookupField;
2224
+ column_1.optional = true;
2225
+ }
1971
2226
  handleApplyColumnSettings(column_1);
1972
2227
  return [4 /*yield*/, ((_c = (_b = props.advSettings) === null || _b === void 0 ? void 0 : _b.onEditColumn) === null || _c === void 0 ? void 0 : _c.call(_b, column_1))];
1973
2228
  case 2:
@@ -2235,7 +2490,7 @@ var NewTable = function (rawProps) {
2235
2490
  return Math.max(width, (_b = getTitleMinWidth(key)) !== null && _b !== void 0 ? _b : 0);
2236
2491
  };
2237
2492
  var pinCheckboxOffset = props.checkbox &&
2238
- (props.data.length > 0 || (props.spaceData && ((_s = props.spaceData) === null || _s === void 0 ? void 0 : _s.length) > 0))
2493
+ (props.data.length > 0 || (props.spaceData && ((_t = props.spaceData) === null || _t === void 0 ? void 0 : _t.length) > 0))
2239
2494
  ? CHECKBOX_WIDTH
2240
2495
  : 0;
2241
2496
  /**
@@ -2308,7 +2563,7 @@ var NewTable = function (rawProps) {
2308
2563
  minWidth: colWidth,
2309
2564
  maxWidth: colWidth,
2310
2565
  }));
2311
- borderClass = "".concat(pinBase, " ").concat(afterBase, " after:right-0 ").concat(afterColor);
2566
+ borderClass = "".concat(pinBase, " ").concat(afterBase, " after:right-0 ").concat(afterColor, " ").concat(PIN_EDGE_RIGHT_CLASS);
2312
2567
  }
2313
2568
  else if (rightIdx >= 0) {
2314
2569
  // INFO: offset = sum of widths of all right-pinned columns after this one,
@@ -2325,7 +2580,7 @@ var NewTable = function (rawProps) {
2325
2580
  minWidth: colWidth,
2326
2581
  maxWidth: colWidth,
2327
2582
  }));
2328
- borderClass = "".concat(pinBase, " ").concat(afterBase, " after:left-0 ").concat(afterColor);
2583
+ borderClass = "".concat(pinBase, " ").concat(afterBase, " after:left-0 ").concat(afterColor, " ").concat(PIN_EDGE_LEFT_CLASS);
2329
2584
  }
2330
2585
  if (!style)
2331
2586
  return undefined;
@@ -2394,11 +2649,30 @@ var NewTable = function (rawProps) {
2394
2649
  handleOnChangeText: handleOnChangeText,
2395
2650
  handleOnChangeSelect: handleOnChangeSelect,
2396
2651
  handleOnChangeDate: handleOnChangeDate,
2397
- }, false, cellInput, undefined, {
2652
+ }, false, cellInput,
2653
+ // INFO: a yes/no, plain list or reference cell under gridLines="all"
2654
+ // opens its list in dark mode too. Other cell editors are not handed
2655
+ // darkMode yet — passing it to all of them would restyle cells under
2656
+ // "horizontal" as well.
2657
+ cellInput.fill &&
2658
+ !ds.showTagSelections &&
2659
+ [
2660
+ "boolean",
2661
+ "list",
2662
+ "multipleList",
2663
+ "reference",
2664
+ "listReference",
2665
+ "roles",
2666
+ "person",
2667
+ "listPerson",
2668
+ "referenceSelection",
2669
+ ].includes(ds.type)
2670
+ ? { darkMode: props.darkMode }
2671
+ : undefined, {
2398
2672
  dbModule: axios_1.default,
2399
2673
  devSettings: props.devSettings,
2400
2674
  referencesOptions: mergedReferencesOptions,
2401
- referencesDetails: referencesDetails,
2675
+ referencesDetails: mergedReferencesDetails,
2402
2676
  referenceLoading: referenceLoading,
2403
2677
  setReferenceLoading: setReferenceLoading,
2404
2678
  setReferencesOptions: setReferencesOptions,
@@ -2406,12 +2680,60 @@ var NewTable = function (rawProps) {
2406
2680
  });
2407
2681
  };
2408
2682
  // INFO: a cell being typed into stays an input after the pointer leaves it
2683
+ // INFO: under gridLines="all" a cell's editor is drawn only while that cell
2684
+ // is open, so opening another one removes it at once. A field still being
2685
+ // typed in is left first, so its blur saves it as it always does — a tap on
2686
+ // a touch screen lands on the next cell without blurring the field
2687
+ // INFO: a field checks itself by setting its error state and waiting for
2688
+ // React to apply it — a field removed first never answers, and its save
2689
+ // never ran. So the next cell opens only after the check, and not at all
2690
+ // when the value left behind fails it; that cell keeps its error instead.
2691
+ var handleOpenAfterLeaving = function (target, open) {
2692
+ var _a, _b;
2693
+ var active = document.activeElement;
2694
+ var isLeaving = !!active &&
2695
+ active !== document.body &&
2696
+ !!((_a = tableRef.current) === null || _a === void 0 ? void 0 : _a.contains(active)) &&
2697
+ !((_b = target.closest("td")) === null || _b === void 0 ? void 0 : _b.contains(active));
2698
+ if (!isLeaving) {
2699
+ open();
2700
+ return;
2701
+ }
2702
+ blurCheckRef.current = null;
2703
+ active.blur();
2704
+ var check = blurCheckRef.current;
2705
+ if (!check) {
2706
+ open();
2707
+ return;
2708
+ }
2709
+ check.then(function (valid) {
2710
+ if (valid)
2711
+ open();
2712
+ });
2713
+ };
2409
2714
  var handleIsCellEditing = function (rowId, colKey) {
2410
2715
  return editDataRowId === rowId && editDataHeaderKey === colKey;
2411
2716
  };
2412
2717
  var renderReadCellValue = function (col, row, cellValue) {
2413
2718
  var _a;
2414
- var value = (0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord);
2719
+ // INFO: under gridLines="all" a list of names (a list of references)
2720
+ // reads "A, B", as a multiple list's picks do — the read module joins an
2721
+ // array with bare commas
2722
+ var isNameList = gridLines === "all" &&
2723
+ Array.isArray(cellValue) &&
2724
+ cellValue.every(function (each) { return typeof each === "string"; });
2725
+ // INFO: roles arrive as one string joined with bare commas, so under
2726
+ // gridLines="all" they are read from the row's keys instead
2727
+ var rawRoles = resolveValue(row, col.key);
2728
+ var roleLabels = gridLines === "all" && col.type === "roles" && Array.isArray(rawRoles)
2729
+ ? rawRoles
2730
+ .map(function (each) {
2731
+ var _a, _b, _c, _d;
2732
+ return (_d = (_c = (_b = (_a = props.devSettings) === null || _a === void 0 ? void 0 : _a.roleOptions) === null || _b === void 0 ? void 0 : _b.find(function (option) { return option.key === each; })) === null || _c === void 0 ? void 0 : _c.label) !== null && _d !== void 0 ? _d : String(each);
2733
+ })
2734
+ .join(", ")
2735
+ : undefined;
2736
+ var value = (0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, roleLabels !== null && roleLabels !== void 0 ? roleLabels : (isNameList ? cellValue.join(", ") : cellValue), props.bareSettings, true, props.disableEllipsisOnLongWord);
2415
2737
  if (!props.newTabUrl || !props.onClickRow)
2416
2738
  return value;
2417
2739
  return (react_2.default.createElement(link_1.Link, { href: props.newTabUrl + row.id + ((_a = props.addNewTabUrl) !== null && _a !== void 0 ? _a : ""), className: "w-full block ".concat(handleIsReadCellFixed(col) ? "truncate" : ""), linkType: props.linkType, custom: props.custom }, value));
@@ -2426,7 +2748,10 @@ var NewTable = function (rawProps) {
2426
2748
  return (react_2.default.createElement(react_2.default.Fragment, null,
2427
2749
  shown.map(function (pick) {
2428
2750
  var _a;
2429
- return (react_2.default.createElement(tag_1.Tag, { key: pick, tagText: pick, size: "small", variant: "flat", color: (_a = handleGetListColour(col, pick)) !== null && _a !== void 0 ? _a : "primary", rounded: "md", className: "shrink-0 whitespace-nowrap" }));
2751
+ return (react_2.default.createElement(tag_1.Tag, { key: pick, tagText: pick, size: "small", variant: "flat", color: (_a = handleGetListColour(col, pick)) !== null && _a !== void 0 ? _a : "primary", rounded: "md",
2752
+ // INFO: under gridLines="all" the row's gap-1 is the only space
2753
+ // between tags — Tag's own mx-1 doubled it to 12px
2754
+ className: "shrink-0 whitespace-nowrap ".concat(gridLines === "all" ? "!mx-0" : "") }));
2430
2755
  }),
2431
2756
  picks.length > shown.length && (react_2.default.createElement("span", { className: "shrink-0 text-xs text-gray-500" },
2432
2757
  "+",
@@ -2436,12 +2761,33 @@ var NewTable = function (rawProps) {
2436
2761
  var _a, _b, _c, _d;
2437
2762
  var tempDS = __assign(__assign({}, col), { id: col.key, name: col.title, type: (_a = col.type) !== null && _a !== void 0 ? _a : "string", showTagSelections: handleColumnShowsTags(col) });
2438
2763
  var editingRow = editDataRowId === rowId;
2439
- return (react_2.default.createElement("td", { key: col.key + String(colIndex), "data-cell-key": col.key,
2764
+ var cellFill = tempDS.showTagSelections
2765
+ ? handleGetCellFill(col, resolveValue(rowData, col.key))
2766
+ : undefined;
2767
+ // INFO: the board of colour blocks applies to every coloured cell under
2768
+ // gridLines="all", an empty one too. The cell darkens on hover and, while
2769
+ // its board is open, carries an inset ring like a sheet's active cell —
2770
+ // a shadow, as Chrome paints no outline on a collapsed table's cell, and
2771
+ // !important so it replaces the grid line's own shadow there.
2772
+ var isFillColumn = gridLines === "all" && !!tempDS.showTagSelections;
2773
+ var isFillActive = editingRow && editDataHeaderKey === col.key;
2774
+ var isFillInput = gridLines === "all" &&
2775
+ !tempDS.showTagSelections &&
2776
+ FILL_INPUT_TYPES.includes((_b = col.type) !== null && _b !== void 0 ? _b : "string");
2777
+ var fillStateClass = !isFillColumn
2778
+ ? ""
2779
+ : cellFill
2780
+ ? "cursor-pointer hover:brightness-95 ".concat(isFillActive ? "!shadow-[inset_0_0_0_2px_rgba(255,255,255,0.85)]" : "")
2781
+ : "cursor-pointer ".concat(props.darkMode ? "hover:bg-gray-800" : "hover:bg-gray-50", " ").concat(isFillActive ? "!shadow-[inset_0_0_0_2px_#9ca3af]" : "");
2782
+ var pinProps = getPinProps(col.key, false, rowBgClass, isHoverable);
2783
+ return (react_2.default.createElement("td", { key: col.key + String(colIndex), "data-cell-key": col.key, "data-edit-cell": "".concat(rowId, ":").concat(col.key), "data-cell-fill": cellFill ? "" : undefined,
2440
2784
  // INFO: pinned columns use whitespace-normal so text wraps within the fixed width.
2441
2785
  // col.width must match the read-only cell's width source so a column keeps one
2442
2786
  // width whether a row is being edited or shown read-only — without it the cell
2443
2787
  // shrinks/grows on hover and staggers the column.
2444
- className: "".concat(editCellPadding, " ").concat(handleCellMinWidth(col.type), " ").concat(col.width ? "".concat(col.width, " flex-shrink-0") : "", " ").concat(getPinProps(col.key, false) ? "whitespace-normal break-words" : col.width ? "" : "whitespace-nowrap", " text-sm ").concat(cellFontColor, " ").concat((_c = (_b = getPinProps(col.key, false, rowBgClass, isHoverable)) === null || _b === void 0 ? void 0 : _b.className) !== null && _c !== void 0 ? _c : ""), style: (_d = getPinProps(col.key, false, rowBgClass, isHoverable)) === null || _d === void 0 ? void 0 : _d.style },
2788
+ // INFO: a cell fill comes after the pin classes so its colour wins over
2789
+ // a pinned cell's row background
2790
+ className: "".concat(editCellPadding, " ").concat(handleCellMinWidth(col.type), " ").concat(col.width ? "".concat(col.width, " flex-shrink-0") : "", " ").concat(getPinProps(col.key, false) ? "whitespace-normal break-words" : col.width ? "" : "whitespace-nowrap", " text-sm ").concat(cellFontColor, " ").concat(cellFill ? handleDropCellBg(pinProps === null || pinProps === void 0 ? void 0 : pinProps.className) : ((_c = pinProps === null || pinProps === void 0 ? void 0 : pinProps.className) !== null && _c !== void 0 ? _c : ""), " ").concat((_d = cellFill === null || cellFill === void 0 ? void 0 : cellFill.className) !== null && _d !== void 0 ? _d : "", " ").concat(fillStateClass, " ").concat(isFillInput ? "".concat(FILL_INPUT_CELL_CLASS, " ").concat(props.darkMode ? FILL_INPUT_EDIT_BG_DARK_CLASS : FILL_INPUT_EDIT_BG_CLASS, " ").concat(isFillActive ? "".concat(FILL_INPUT_ACTIVE_CLASS, " ").concat(props.darkMode ? FILL_INPUT_ACTIVE_BG_DARK_CLASS : FILL_INPUT_ACTIVE_BG_CLASS) : "") : ""), style: __assign(__assign({}, pinProps === null || pinProps === void 0 ? void 0 : pinProps.style), cellFill === null || cellFill === void 0 ? void 0 : cellFill.style) },
2445
2791
  react_2.default.createElement("div", {
2446
2792
  // INFO: w-0 on the control, not min-w-0 — the table is sized w-max, so
2447
2793
  // an input's browser-default ~20ch intrinsic width feeds max-content
@@ -2453,11 +2799,41 @@ var NewTable = function (rawProps) {
2453
2799
  // min-w-full assumes one input per cell — a composite control has two,
2454
2800
  // each of which then demanded the full width. Inside one, the fields
2455
2801
  // size to the row instead.
2456
- className: "w-full p-[1px] [&>*]:w-full [&_input]:w-0 [&_input]:min-w-full [&_textarea]:w-0 [&_textarea]:min-w-full [&_input]:h-[32px] [&_textarea]:min-h-[32px] [&_[data-composite-input]_input]:min-w-0 [&_[data-composite-input]_.PhoneInputInput]:w-14", onClick: function (e) {
2802
+ ref: function (element) {
2803
+ var key = "".concat(rowId, ":").concat(col.key);
2804
+ if (!element || pendingFocusRef.current !== key)
2805
+ return;
2806
+ pendingFocusRef.current = "";
2807
+ // INFO: on the next tick — the editor renders again as the edit
2808
+ // state settles, and a field focused now would be replaced
2809
+ setTimeout(function () {
2810
+ var _a, _b, _c;
2811
+ var cell = (_a = tableRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("[data-edit-cell=\"".concat(CSS.escape(key), "\"]"));
2812
+ // INFO: the field you type in — not a phone's read-only code or
2813
+ // a date picker's field, which opens itself. A yes/no cell's
2814
+ // field is read-only and opens its list as it takes focus.
2815
+ var field = cell === null || cell === void 0 ? void 0 : cell.querySelector(col.type === "boolean"
2816
+ ? "input"
2817
+ : "input:not([readonly]):not([type=hidden]), textarea");
2818
+ if (!field)
2819
+ return;
2820
+ field.focus();
2821
+ var end = (_c = (_b = field.value) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0;
2822
+ try {
2823
+ field.setSelectionRange(end, end);
2824
+ }
2825
+ catch (_d) {
2826
+ // INFO: number and email fields have no caret position to set
2827
+ }
2828
+ }, 0);
2829
+ }, className: "".concat(isFillInput ? FILL_INPUT_CLASS : "", " w-full p-[1px] [&>*]:w-full [&_input]:w-0 [&_input]:min-w-full [&_textarea]:w-0 [&_textarea]:min-w-full [&_input]:h-[32px] [&_textarea]:min-h-[32px] [&_[data-composite-input]_input]:min-w-0 [&_[data-composite-input]_.PhoneInputInput]:w-14"), onClick: function (e) {
2457
2830
  e.stopPropagation();
2458
2831
  handleEditDataOnClick(rowId, col.key, rowData);
2459
2832
  } }, renderFormCell(rowData, tempDS, editingRow ? editDataInputRefs.current[colIndex] : null, {
2460
2833
  active: true,
2834
+ fill: isFillColumn || isFillInput,
2835
+ // INFO: this editor mounts on the click that opens it
2836
+ openOnMount: isFillInput,
2461
2837
  onBlur: function (updateData, options) {
2462
2838
  return handleEditDataOnBlur(col.key, updateData !== null && updateData !== void 0 ? updateData : (editDataRowIdRef.current === rowId
2463
2839
  ? editDataValueRef.current
@@ -2510,7 +2886,7 @@ var NewTable = function (rawProps) {
2510
2886
  : undefined,
2511
2887
  };
2512
2888
  return {
2513
- className: "sticky right-0 z-[3] ".concat(bg, " ").concat(hoverClass, " before:absolute before:inset-y-0 before:left-0 before:w-px before:pointer-events-none ").concat(divider),
2889
+ className: "sticky right-0 z-[3] ".concat(bg, " ").concat(hoverClass, " before:absolute before:inset-y-0 before:left-0 before:w-px before:pointer-events-none ").concat(divider, " ").concat(PIN_EDGE_LEFT_CLASS),
2514
2890
  // INFO: right-pinned data columns and the add-column "+" offset by this
2515
2891
  // width, so it has to be exact while either exists
2516
2892
  style: rightPinned.length > 0 || ((_b = props.advSettings) === null || _b === void 0 ? void 0 : _b.addColumnEnabled)
@@ -2540,7 +2916,7 @@ var NewTable = function (rawProps) {
2540
2916
  style: { width: ADD_COLUMN_WIDTH, minWidth: ADD_COLUMN_WIDTH },
2541
2917
  };
2542
2918
  return {
2543
- className: "sticky z-[3] ".concat(bg, " ").concat(hoverClass, " before:absolute before:inset-y-0 before:left-0 before:w-px before:pointer-events-none ").concat(divider),
2919
+ className: "sticky z-[3] ".concat(bg, " ").concat(hoverClass, " before:absolute before:inset-y-0 before:left-0 before:w-px before:pointer-events-none ").concat(divider, " ").concat(PIN_EDGE_LEFT_CLASS),
2544
2920
  style: {
2545
2921
  right: handleShowsActionColumn() ? ACTION_COLUMN_WIDTH : 0,
2546
2922
  width: ADD_COLUMN_WIDTH,
@@ -2550,7 +2926,7 @@ var NewTable = function (rawProps) {
2550
2926
  };
2551
2927
  // INFO: worked out here, after the Actions and "+" helpers it reads, and
2552
2928
  // only read by the render helpers called from the return below
2553
- var _50 = handleFitPins(), fittedLeftPins = _50.widths, narrowPins = _50.narrow;
2929
+ var _55 = handleFitPins(), fittedLeftPins = _55.widths, narrowPins = _55.narrow;
2554
2930
  var renderActionColumnHeader = function () {
2555
2931
  if (handleShowsActionColumn()) {
2556
2932
  var pin = handleGetActionCellPin(true);
@@ -2601,6 +2977,64 @@ var NewTable = function (rawProps) {
2601
2977
  }
2602
2978
  return (react_2.default.createElement("td", { className: "".concat(cellPadding, " text-sm ").concat(pin.className), style: pin.style }));
2603
2979
  };
2980
+ // INFO: under gridLines="all" a new row's cells are filled in as an edited
2981
+ // row's are — a text, number, date, phone or plain dropdown field fills its
2982
+ // cell and rings it while in focus, a coloured list opens its colour board
2983
+ // and fills the cell with the picked colour, and a coloured multiple list
2984
+ // keeps its tags in the cell and opens the label picker under it. Picks
2985
+ // stay in the new row until it is saved. "horizontal" keeps the boxed
2986
+ // fields.
2987
+ var renderAddFillCell = function (ds, col, index) {
2988
+ var _a, _b;
2989
+ var value = addDataValue === null || addDataValue === void 0 ? void 0 : addDataValue[ds.id];
2990
+ if (ds.type === "multipleList" && ds.showTagSelections) {
2991
+ var picks = (Array.isArray(value) ? value : value ? [value] : []).map(String);
2992
+ var isPicking = (addLabelPicker === null || addLabelPicker === void 0 ? void 0 : addLabelPicker.key) === ds.id;
2993
+ var isMissing = addTagErrors.includes(ds.id) && picks.length === 0;
2994
+ var handleOpen_1 = function (target) {
2995
+ var cell = target.closest("td");
2996
+ if (cell)
2997
+ setAddLabelPicker({ key: ds.id, anchor: cell });
2998
+ };
2999
+ return (react_2.default.createElement("td", { key: ds.id + String(index), "data-add-cell": ds.id, "data-add-error": isMissing ? "" : undefined, className: "".concat(editCellPadding, " ").concat(handleCellMinWidth(ds.type), " text-sm ").concat(cellFontColor, " ").concat(isPicking ? "!shadow-[inset_0_0_0_2px_#9ca3af]" : isMissing ? "!shadow-[inset_0_0_0_2px_#fca5a5]" : "") },
3000
+ react_2.default.createElement("div", { "data-testid": "table-add-tag-line-".concat(ds.id), role: "button", "aria-haspopup": "dialog", "aria-expanded": isPicking, tabIndex: 0, "aria-label": "Pick ".concat(col.title), className: "flex h-[34px] cursor-pointer items-center gap-1 overflow-hidden whitespace-nowrap", onClick: function (e) { return handleOpen_1(e.currentTarget); }, onKeyDown: function (e) {
3001
+ if (e.key !== "Enter" && e.key !== " ")
3002
+ return;
3003
+ e.preventDefault();
3004
+ e.stopPropagation();
3005
+ handleOpen_1(e.currentTarget);
3006
+ } },
3007
+ renderTagLine(col, picks),
3008
+ isMissing && react_2.default.createElement("span", { className: "sr-only" }, "Required")),
3009
+ isPicking && addLabelPicker && (react_2.default.createElement(labelPicker_1.LabelPicker, { anchor: addLabelPicker.anchor, darkMode: props.darkMode, options: ((_a = col.listSelection) !== null && _a !== void 0 ? _a : []).map(function (key) { return ({
3010
+ key: String(key),
3011
+ color: handleGetListColour(col, key),
3012
+ }); }), value: picks, required: (0, updateModule_1.handleIsFieldRequired)(col, addDataValue),
3013
+ // INFO: through the same clone every other cell's change takes,
3014
+ // so the row keeps the defaults it shows (a required date's
3015
+ // today, a required list's first option) when this is the only
3016
+ // cell changed
3017
+ onChange: function (next) {
3018
+ var cloned = handleGenerateClonedData();
3019
+ cloned[ds.id] = next;
3020
+ handleUpdateChangeData(cloned);
3021
+ }, onClose: function () { return setAddLabelPicker(null); } }))));
3022
+ }
3023
+ var isFillColumn = !!ds.showTagSelections;
3024
+ var isFillInput = !ds.showTagSelections && FILL_INPUT_TYPES.includes(ds.type);
3025
+ var cellFill = isFillColumn ? handleGetCellFill(col, value) : undefined;
3026
+ var fillStateClass = !isFillColumn
3027
+ ? ""
3028
+ : cellFill
3029
+ ? "cursor-pointer hover:brightness-95"
3030
+ : "cursor-pointer ".concat(props.darkMode ? "hover:bg-gray-800" : "hover:bg-gray-50");
3031
+ return (react_2.default.createElement("td", { key: ds.id + String(index), "data-add-cell": ds.id, "data-cell-fill": cellFill ? "" : undefined, className: "".concat(editCellPadding, " ").concat(handleCellMinWidth(ds.type), " whitespace-nowrap text-sm ").concat(cellFontColor, " ").concat((_b = cellFill === null || cellFill === void 0 ? void 0 : cellFill.className) !== null && _b !== void 0 ? _b : "", " ").concat(fillStateClass, " ").concat(isFillInput ? "".concat(FILL_INPUT_CELL_CLASS, " ").concat(props.darkMode ? FILL_INPUT_EDIT_BG_DARK_CLASS : FILL_INPUT_EDIT_BG_CLASS) : ""), style: cellFill === null || cellFill === void 0 ? void 0 : cellFill.style },
3032
+ react_2.default.createElement("div", { className: "".concat(isFillInput ? FILL_INPUT_CLASS : "", " w-full p-[1px] [&>*]:w-full [&_input]:w-0 [&_input]:min-w-full [&_textarea]:w-0 [&_textarea]:min-w-full [&_input]:h-[32px] [&_textarea]:min-h-[32px] [&_[data-composite-input]_input]:min-w-0 [&_[data-composite-input]_.PhoneInputInput]:w-14") }, renderFormCell(addDataValue, ds, addDataInputRefs.current[flatColumns.findIndex(function (each) { return each.key === ds.id; })], {
3033
+ active: true,
3034
+ fill: isFillColumn || isFillInput,
3035
+ onBlur: function () { },
3036
+ }))));
3037
+ };
2604
3038
  var renderAddDataRow = function () {
2605
3039
  var filteredCols = handleGetAddColumns();
2606
3040
  var colsAsDS = handleConvertColumnToDataStructure(filteredCols);
@@ -2608,16 +3042,18 @@ var NewTable = function (rawProps) {
2608
3042
  props.checkbox && react_2.default.createElement("td", null),
2609
3043
  colsAsDS.map(function (ds, index) {
2610
3044
  if (handleIsAddColumn(filteredCols[index])) {
3045
+ if (gridLines === "all")
3046
+ return renderAddFillCell(ds, filteredCols[index], index);
2611
3047
  return (react_2.default.createElement("td", { key: ds.id + String(index), "data-add-cell": ds.id, className: "px-4 py-4 whitespace-nowrap align-top" },
2612
3048
  react_2.default.createElement("div", { className: "min-w-[10rem]" }, renderFormCell(addDataValue, ds, addDataInputRefs.current[flatColumns.findIndex(function (col) { return col.key === ds.id; })], { active: true, onBlur: function () { } }))));
2613
3049
  }
2614
3050
  return react_2.default.createElement("td", { key: ds.id + String(index), "data-add-cell": ds.id });
2615
3051
  }),
2616
3052
  renderAddColumnCell(),
2617
- react_2.default.createElement("td", { className: "".concat(cellPadding, " text-sm ").concat(handleGetActionCellPin(false).className), style: handleGetActionCellPin(false).style },
2618
- react_2.default.createElement("div", { className: "flex flex-row gap-2" },
2619
- react_2.default.createElement(iconButton_1.IconButton, { testId: "table-add-row-confirm", icon: react_2.default.createElement(solid_2.CheckIcon, { className: "w-5 h-5 text-green-500" }), onClick: function () { return handleCommitAdd(false); } }),
2620
- react_2.default.createElement(iconButton_1.IconButton, { testId: "table-add-row-cancel", icon: react_2.default.createElement(solid_2.XMarkIcon, { className: "h-5 w-5 text-red-500" }), onClick: handleCancelAdd })))));
3053
+ react_2.default.createElement("td", { className: "".concat(gridLines === "all" ? editCellPadding : cellPadding, " text-sm ").concat(handleGetActionCellPin(false).className), style: handleGetActionCellPin(false).style },
3054
+ react_2.default.createElement("div", { className: "flex flex-row ".concat(gridLines === "all" ? "gap-1" : "gap-2") },
3055
+ react_2.default.createElement(iconButton_1.IconButton, { testId: "table-add-row-confirm", size: gridLines === "all" ? "small" : undefined, darkMode: gridLines === "all" ? props.darkMode : undefined, icon: react_2.default.createElement(solid_2.CheckIcon, { className: "".concat(gridLines === "all" ? "h-4 w-4" : "h-5 w-5", " text-green-500") }), onClick: function () { return handleCommitAdd(false); } }),
3056
+ react_2.default.createElement(iconButton_1.IconButton, { testId: "table-add-row-cancel", size: gridLines === "all" ? "small" : undefined, darkMode: gridLines === "all" ? props.darkMode : undefined, icon: react_2.default.createElement(solid_2.XMarkIcon, { className: "".concat(gridLines === "all" ? "h-4 w-4" : "h-5 w-5", " text-red-500") }), onClick: handleCancelAdd })))));
2621
3057
  };
2622
3058
  // INFO: the empty row at the bottom of an addable table — clicking any of
2623
3059
  // its cells starts a new record there, as the next empty row of a
@@ -2675,7 +3111,7 @@ var NewTable = function (rawProps) {
2675
3111
  };
2676
3112
  // INFO: true when maxSelectedCount is set and the current selection has reached the limit
2677
3113
  var isMaxReached = !!props.maxSelectedCount &&
2678
- ((_u = (_t = props.selectedIds) === null || _t === void 0 ? void 0 : _t.length) !== null && _u !== void 0 ? _u : 0) >= props.maxSelectedCount;
3114
+ ((_v = (_u = props.selectedIds) === null || _u === void 0 ? void 0 : _u.length) !== null && _v !== void 0 ? _v : 0) >= props.maxSelectedCount;
2679
3115
  // INFO: one desktop row. groupAccent carries the group's colour so member
2680
3116
  // rows show the band's colour as a bar down their left edge.
2681
3117
  var handleRowDragStart = function (event, rowId) {
@@ -2740,7 +3176,14 @@ var NewTable = function (rawProps) {
2740
3176
  "children",
2741
3177
  ]);
2742
3178
  // INFO: large or parent-held values compared by identity, not content
2743
- var IDENTITY_PROPS = new Set(["selectedIds", "commentCounts"]);
3179
+ // INFO: referencesDetails can hold every record a page referenced — it is
3180
+ // kept by the parent (DataTemplate holds it in state), so a new copy means
3181
+ // new records
3182
+ var IDENTITY_PROPS = new Set([
3183
+ "selectedIds",
3184
+ "commentCounts",
3185
+ "referencesDetails",
3186
+ ]);
2744
3187
  /**
2745
3188
  * A number that changes whenever anything every row draws from changes: the
2746
3189
  * table's props apart from the row data, its edit, drag and width state, and
@@ -2763,6 +3206,8 @@ var NewTable = function (rawProps) {
2763
3206
  editDataHeaderKey,
2764
3207
  editDataIsLoading,
2765
3208
  modalEditVisible,
3209
+ // INFO: a gridLines="all" label picker opens on its anchor alone
3210
+ (0, rowRendering_1.handleGetIdentity)(labelPickerAnchor),
2766
3211
  isDragSelecting,
2767
3212
  addData,
2768
3213
  addGroupId,
@@ -2783,12 +3228,195 @@ var NewTable = function (rawProps) {
2783
3228
  };
2784
3229
  return tableVersionRef.current.version;
2785
3230
  };
3231
+ // INFO: on a phone the first column that is not an id is the row's title
3232
+ var handleGetPhoneTitleColumn = function () {
3233
+ var _a;
3234
+ return (_a = flatColumns.find(function (col) { return !/^id$/i.test(col.key) && !/^_id$/i.test(col.key); })) !== null && _a !== void 0 ? _a : flatColumns[0];
3235
+ };
3236
+ var handleGetPhoneCellValue = function (row, spaceRow, key) { return (spaceRow ? spaceRow[key] : resolveValue(row, key)); };
3237
+ // INFO: a dotted key such as "shippingAddress.name" takes its parent
3238
+ // column's title
3239
+ var handleGetSummaryLabel = function (key) {
3240
+ var _a, _b, _c, _d;
3241
+ var parentKey = key.split(".")[0];
3242
+ return ((_d = (_b = (_a = columns.find(function (col) { return col.key === key; })) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : (_c = columns.find(function (col) { return col.key === parentKey; })) === null || _c === void 0 ? void 0 : _c.title) !== null && _d !== void 0 ? _d : key);
3243
+ };
3244
+ var handleIsPhoneCellEmpty = function (value) {
3245
+ return value === undefined ||
3246
+ value === null ||
3247
+ value === "" ||
3248
+ (Array.isArray(value) && value.length === 0);
3249
+ };
3250
+ // INFO: renders the hover tooltip card content — image, summary pairs, and tags
3251
+ var renderMobileTooltipContent = function (row, spaceRow) {
3252
+ var _a, _b, _c;
3253
+ var tt = (_a = props.mobileTooltip) === null || _a === void 0 ? void 0 : _a.tooltip;
3254
+ if (!tt)
3255
+ return null;
3256
+ var source = spaceRow !== null && spaceRow !== void 0 ? spaceRow : row;
3257
+ var imageUrl = tt.imageKey
3258
+ ? resolveValue(source, tt.imageKey)
3259
+ : undefined;
3260
+ var summaryPairs = ((_b = tt.summaryKeys) !== null && _b !== void 0 ? _b : [])
3261
+ .map(function (key) {
3262
+ var _a;
3263
+ var col = flatColumns.find(function (c) { return c.key === key; });
3264
+ return {
3265
+ key: key,
3266
+ label: (_a = col === null || col === void 0 ? void 0 : col.title) !== null && _a !== void 0 ? _a : key,
3267
+ value: resolveValue(source, key),
3268
+ };
3269
+ })
3270
+ .filter(function (p) { return p.value !== undefined && p.value !== null && p.value !== ""; });
3271
+ var tagValues = ((_c = tt.tagKeys) !== null && _c !== void 0 ? _c : [])
3272
+ .map(function (key) {
3273
+ var val = resolveValueToString(key, source, row);
3274
+ return {
3275
+ key: key,
3276
+ value: val,
3277
+ color: val && tt.tagColors ? tt.tagColors[val] : undefined,
3278
+ };
3279
+ })
3280
+ .filter(function (t) { return !!t.value; });
3281
+ if (!imageUrl && summaryPairs.length === 0 && tagValues.length === 0)
3282
+ return null;
3283
+ return (react_2.default.createElement("div", { className: "rounded-xl border shadow-lg p-3 w-72 ".concat(props.darkMode ? "bg-gray-800 border-gray-700" : "bg-white border-gray-200") },
3284
+ react_2.default.createElement("div", { className: "flex gap-3" },
3285
+ imageUrl && (react_2.default.createElement("img", { src: String(imageUrl), alt: "", className: "h-14 w-14 rounded-lg object-cover flex-shrink-0" })),
3286
+ react_2.default.createElement("div", { className: "flex flex-col gap-1.5 min-w-0 flex-1" }, summaryPairs.map(function (p) { return (react_2.default.createElement("div", { key: p.key, className: "flex flex-col" },
3287
+ react_2.default.createElement("span", { className: "text-[11px] uppercase tracking-wide ".concat(props.darkMode ? "text-gray-400" : "text-gray-400") }, p.label),
3288
+ react_2.default.createElement("span", { className: "text-xs font-medium ".concat(props.darkMode ? "text-gray-200" : "text-gray-700", " truncate") }, typeof p.value === "object"
3289
+ ? JSON.stringify(p.value)
3290
+ : String(p.value)))); }))),
3291
+ tagValues.length > 0 && (react_2.default.createElement("div", { className: "flex flex-wrap gap-1 mt-2 pt-2 border-t border-gray-100" }, tagValues.map(function (t) {
3292
+ var _a;
3293
+ return (react_2.default.createElement(tag_1.Tag, { key: t.key, tagText: String(t.value), size: "small", variant: "flat", color: (_a = t.color) !== null && _a !== void 0 ? _a : undefined, rounded: "md" }));
3294
+ })))));
3295
+ };
3296
+ // INFO: a phone row reads like a mail inbox — the title with a pill and a
3297
+ // date, a few key values under it, and an arrow that opens every field. A
3298
+ // host's titleAdjacent keys pick the pill, the date slot and the second
3299
+ // line; without them the view's column order does
3300
+ var renderPhoneRowContent = function (row, index, groupAccent, group) {
3301
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
3302
+ var spaceRow = (_a = props.spaceData) === null || _a === void 0 ? void 0 : _a[index];
3303
+ var titleCol = handleGetPhoneTitleColumn();
3304
+ var titleAdjacent = (_b = props.mobileTooltip) === null || _b === void 0 ? void 0 : _b.titleAdjacent;
3305
+ var isSelected = ((_d = (_c = props.selectedIds) === null || _c === void 0 ? void 0 : _c.includes(row.id)) !== null && _d !== void 0 ? _d : false) ||
3306
+ ((_e = props.selectAll) !== null && _e !== void 0 ? _e : false);
3307
+ var handleRenderValue = function (key) {
3308
+ return (0, readModule_1.renderEachRowDataBasedOnDataType)(key, handleGetPhoneCellValue(row, spaceRow, key), props.bareSettings, true, props.disableEllipsisOnLongWord);
3309
+ };
3310
+ var cardTitle = titleCol
3311
+ ? spaceRow
3312
+ ? spaceRow[titleCol.key]
3313
+ : resolveValue(row, titleCol.key) || row.id
3314
+ : "";
3315
+ var picked = (0, listRowFields_1.handlePickListRowFields)(flatColumns.map(function (col) { return ({
3316
+ key: col.key,
3317
+ type: col.ratingMax ? "rating" : col.type,
3318
+ }); }), titleCol === null || titleCol === void 0 ? void 0 : titleCol.key, function (key) {
3319
+ // INFO: under a group header, the column the rows are grouped by only
3320
+ // repeats the header, so it is left off the row
3321
+ return (!!group && key === props.groupColumnKey) ||
3322
+ handleIsPhoneCellEmpty(handleGetPhoneCellValue(row, spaceRow, key));
3323
+ });
3324
+ var badge = undefined;
3325
+ if (titleAdjacent === null || titleAdjacent === void 0 ? void 0 : titleAdjacent.tagKey) {
3326
+ var tagValue = resolveValueToString(titleAdjacent.tagKey, spaceRow !== null && spaceRow !== void 0 ? spaceRow : row, row);
3327
+ if (tagValue)
3328
+ badge = (react_2.default.createElement(tag_1.Tag, { tagText: String(tagValue), size: "small", variant: "flat", color: (_g = (_f = titleAdjacent.tagColor) === null || _f === void 0 ? void 0 : _f[tagValue]) !== null && _g !== void 0 ? _g : undefined, rounded: "md", className: "whitespace-nowrap" }));
3329
+ }
3330
+ else if (picked.badgeKey) {
3331
+ var badgeCol = flatColumns.find(function (col) { return col.key === picked.badgeKey; });
3332
+ var rawValue = resolveValue(row, picked.badgeKey);
3333
+ var displayValue = handleGetPhoneCellValue(row, spaceRow, picked.badgeKey);
3334
+ var colour = badgeCol
3335
+ ? handleGetListColour(badgeCol, rawValue)
3336
+ : undefined;
3337
+ // INFO: a plain value is drawn as a small pill in its option's colour;
3338
+ // a host's own element is kept as it is
3339
+ badge =
3340
+ typeof rawValue === "string" || typeof rawValue === "number" ? (react_2.default.createElement(tag_1.Tag, { tagText: String(rawValue), size: "small", variant: "flat", color: (_h = colour) !== null && _h !== void 0 ? _h : undefined, rounded: "md", className: "whitespace-nowrap" })) : react_2.default.isValidElement(displayValue) ? (displayValue) : (handleRenderValue(picked.badgeKey));
3341
+ }
3342
+ var trailing = undefined;
3343
+ if (titleAdjacent === null || titleAdjacent === void 0 ? void 0 : titleAdjacent.trailingKey) {
3344
+ var trailingValue = resolveValueToString(titleAdjacent.trailingKey, spaceRow !== null && spaceRow !== void 0 ? spaceRow : row, row);
3345
+ if (trailingValue)
3346
+ trailing = String(trailingValue);
3347
+ }
3348
+ else if (!titleAdjacent && picked.dateKey) {
3349
+ // INFO: a host that formats this date itself keeps its format
3350
+ trailing = ((_k = (_j = props.bareSettings) === null || _j === void 0 ? void 0 : _j.bareListDescription) === null || _k === void 0 ? void 0 : _k.call(_j, picked.dateKey, handleGetPhoneCellValue(row, spaceRow, picked.dateKey)))
3351
+ ? handleRenderValue(picked.dateKey)
3352
+ : (0, listRowFields_1.handleFormatListRowDate)(resolveValue(row, picked.dateKey));
3353
+ }
3354
+ // INFO: a host's summary keys keep to the columns the view shows, and the
3355
+ // pill's column is not repeated under the title
3356
+ var subtitleKeys = (titleAdjacent === null || titleAdjacent === void 0 ? void 0 : titleAdjacent.summaryKeys)
3357
+ ? titleAdjacent.summaryKeys.filter(function (key) {
3358
+ var parentKey = key.split(".")[0];
3359
+ return (key !== (titleCol === null || titleCol === void 0 ? void 0 : titleCol.key) &&
3360
+ key !== titleAdjacent.tagKey &&
3361
+ flatColumns.some(function (col) { return col.key === key || col.key === parentKey; }) &&
3362
+ !!resolveValueToString(key, spaceRow !== null && spaceRow !== void 0 ? spaceRow : row, row));
3363
+ })
3364
+ : titleAdjacent
3365
+ ? []
3366
+ : picked.subtitleKeys;
3367
+ var subtitle = subtitleKeys.length ? (react_2.default.createElement("span", null, subtitleKeys.map(function (key, keyIndex) { return (react_2.default.createElement(react_2.default.Fragment, { key: key },
3368
+ keyIndex > 0 && " · ",
3369
+ (titleAdjacent === null || titleAdjacent === void 0 ? void 0 : titleAdjacent.summaryKeys) ? (react_2.default.createElement(react_2.default.Fragment, null,
3370
+ react_2.default.createElement("span", { className: props.darkMode ? "text-gray-500" : "text-gray-400" },
3371
+ handleGetSummaryLabel(key),
3372
+ ":"),
3373
+ " ",
3374
+ resolveValueToString(key, spaceRow !== null && spaceRow !== void 0 ? spaceRow : row, row))) : (handleRenderValue(key)))); }))) : undefined;
3375
+ var detailList = flatColumns.map(function (col) { return ({
3376
+ id: col.key,
3377
+ title: col.title,
3378
+ text: handleRenderValue(col.key),
3379
+ }); });
3380
+ var tooltipContent = ((_l = props.mobileTooltip) === null || _l === void 0 ? void 0 : _l.tooltip)
3381
+ ? renderMobileTooltipContent(row, spaceRow)
3382
+ : null;
3383
+ return (react_2.default.createElement("tr", { key: row.id, "data-dtw-record-id": row.id, className: groupAccent
3384
+ ? "border-l-4 ".concat((_m = ACCENT_CLASS[groupAccent]) !== null && _m !== void 0 ? _m : ACCENT_CLASS.default)
3385
+ : "" },
3386
+ react_2.default.createElement("td", { className: "p-0" },
3387
+ react_2.default.createElement("div", { className: "relative group/tooltip" },
3388
+ react_2.default.createElement(compactRow_1.NewListCompactRow, { bare: true, title: cardTitle, titleClassName: "text-sm font-medium ".concat(props.onClickRow ? titleFontColor : cellFontColor), badge: badge, trailing: trailing, subtitle: subtitle, details: react_2.default.createElement(detailList_1.DetailList, { title: "", list: detailList, size: "compact", darkMode: props.darkMode }), checkbox: props.checkbox
3389
+ ? renderCheckbox(isSelected, function () { }, function (e) { return handleSelectRow(row.id, e); }, "w-4 h-4 ".concat(isMaxReached && !isSelected ? "opacity-50 cursor-not-allowed" : "cursor-pointer"))
3390
+ : undefined, actions: hasRowActions ? renderActivityButton(row.id) : undefined, renderContentWrapper: props.newTabUrl
3391
+ ? function (content) {
3392
+ var _a;
3393
+ return (react_2.default.createElement(link_1.Link, { href: props.newTabUrl + row.id + ((_a = props.addNewTabUrl) !== null && _a !== void 0 ? _a : ""), className: "block min-w-0 flex-1", linkType: props.linkType, custom: props.custom, onClick: function (e) {
3394
+ if (props.onClickRow && !e.metaKey && !e.ctrlKey) {
3395
+ e.preventDefault();
3396
+ e.stopPropagation();
3397
+ props.onClickRow(row.id, row, spaceRow);
3398
+ }
3399
+ } }, content));
3400
+ }
3401
+ : undefined, onClick: function (e) {
3402
+ var _a, _b;
3403
+ // INFO: a control in the row — the checkbox, a link, a button
3404
+ // — does its own thing and does not open the record
3405
+ var target = e.target;
3406
+ if ((_a = target.closest) === null || _a === void 0 ? void 0 : _a.call(target, "a[href], button, input, select, textarea, label"))
3407
+ return;
3408
+ (_b = props.onClickRow) === null || _b === void 0 ? void 0 : _b.call(props, row.id, row, spaceRow);
3409
+ }, isClickable: !!props.onClickRow || !!props.newTabUrl, isSelected: isSelected, darkMode: props.darkMode }),
3410
+ tooltipContent && (react_2.default.createElement("div", { className: "absolute left-1/2 -translate-x-1/2 top-full mt-1 z-50 hidden group-hover/tooltip:block" }, tooltipContent))))));
3411
+ };
2786
3412
  var renderDesktopRow = function (row, index, tableVersion, groupAccent, dropGroup) {
2787
3413
  var _a, _b, _c, _d;
2788
3414
  var isSelected = ((_b = (_a = props.selectedIds) === null || _a === void 0 ? void 0 : _a.includes(row.id)) !== null && _b !== void 0 ? _b : false) ||
2789
3415
  ((_c = props.selectAll) !== null && _c !== void 0 ? _c : false);
2790
3416
  return (react_2.default.createElement(rowRendering_1.NewTableMemoRow, { key: row.id, row: row, spaceRow: (_d = props.spaceData) === null || _d === void 0 ? void 0 : _d[index], index: index, groupAccent: groupAccent, dropGroupId: dropGroup === null || dropGroup === void 0 ? void 0 : dropGroup.id, isSelected: isSelected, editValue: editDataRowId === row.id ? editDataValue : undefined, tableVersion: tableVersion, render: function () {
2791
- return renderDesktopRowContent(row, index, groupAccent, dropGroup);
3417
+ return props.mobileView
3418
+ ? renderPhoneRowContent(row, index, groupAccent, dropGroup)
3419
+ : renderDesktopRowContent(row, index, groupAccent, dropGroup);
2792
3420
  } }));
2793
3421
  };
2794
3422
  var renderDesktopRowContent = function (row, index, groupAccent, dropGroup) {
@@ -2836,13 +3464,28 @@ var NewTable = function (rawProps) {
2836
3464
  // INFO: keep the action outside links and inline editors in every
2837
3465
  // cell variant
2838
3466
  var handleDecorateCell = function (cell) {
2839
- var _a, _b, _c, _d, _e;
3467
+ var _a, _b, _c, _d, _e, _f;
2840
3468
  if (colIndex !== 0 || (!hasRowActions && !dragHandle))
2841
3469
  return cell;
3470
+ // INFO: a filled text editor rings its cell, but the title cell also
3471
+ // holds the row's action strips at its right edge — so the ring
3472
+ // moves off the cell onto an overlay that stops where the strips
3473
+ // begin
3474
+ var titleStripsWidth = activityStripWidth + editStripWidth;
3475
+ var cellTokens = String((_a = cell.props.className) !== null && _a !== void 0 ? _a : "").split(" ");
3476
+ var hasFillRing = cellTokens.includes("focus-within:ring-2");
3477
+ var isFillRingActive = cellTokens.includes("ring-2");
3478
+ var titleCellClassName = hasFillRing && titleStripsWidth > 0
3479
+ ? "".concat(cellTokens
3480
+ .filter(function (each) { return !FILL_RING_TOKENS.includes(each); })
3481
+ .join(" "), " group/fillcell")
3482
+ : cell.props.className;
2842
3483
  return react_2.default.cloneElement(cell, {
2843
- className: "".concat(cell.props.className, " ").concat((_a = TITLE_ACTIONS_PADDING_CLASS[titleRestPadding]) !== null && _a !== void 0 ? _a : "", " ").concat(props.onRowOpen && isTitleWidthFixed ? ((_b = TITLE_CHEVRON_PADDING_CLASS[titleChevronActionsWidth]) !== null && _b !== void 0 ? _b : "") : "", " ").concat((_d = (_c = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _c === void 0 ? void 0 : _c.className) !== null && _d !== void 0 ? _d : ""),
2844
- style: __assign(__assign(__assign(__assign({}, cell.props.style), { paddingRight: titleRestPadding }), (_e = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _e === void 0 ? void 0 : _e.style), { position: getPinProps(col.key, false) ? "sticky" : "relative" }),
2845
- }, cell.props.children, dragHandle, renderActivityButton(row.id, true, "".concat(rowBgClass, " ").concat(isRowHoverable ? (props.darkMode ? "group-hover:bg-gray-700" : "group-hover:bg-gray-100") : "")));
3484
+ className: "".concat(titleCellClassName, " ").concat((_b = TITLE_ACTIONS_PADDING_CLASS[titleRestPadding]) !== null && _b !== void 0 ? _b : "", " ").concat(props.onRowOpen && isTitleWidthFixed ? ((_c = TITLE_CHEVRON_PADDING_CLASS[titleChevronActionsWidth]) !== null && _c !== void 0 ? _c : "") : "", " ").concat((_e = (_d = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _d === void 0 ? void 0 : _d.className) !== null && _e !== void 0 ? _e : ""),
3485
+ style: __assign(__assign(__assign(__assign({}, cell.props.style), { paddingRight: titleRestPadding }), (_f = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _f === void 0 ? void 0 : _f.style), { position: getPinProps(col.key, false) ? "sticky" : "relative" }),
3486
+ }, cell.props.children, hasFillRing && titleStripsWidth > 0 ? (react_2.default.createElement("span", { "aria-hidden": "true", "data-testid": "table-title-fill-ring", className: "pointer-events-none absolute inset-y-0 left-0 z-10 ring-2 ring-inset ring-primary-500 ".concat(isFillRingActive
3487
+ ? ""
3488
+ : "hidden group-focus-within/fillcell:block"), style: { right: titleStripsWidth } })) : null, dragHandle, renderActivityButton(row.id, true, "".concat(rowBgClass, " ").concat(isRowHoverable ? (props.darkMode ? "group-hover:bg-gray-700" : "group-hover:bg-gray-100") : "")));
2846
3489
  };
2847
3490
  var renderDataCell = function () {
2848
3491
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9;
@@ -2869,9 +3512,10 @@ var NewTable = function (rawProps) {
2869
3512
  !col.disabled)
2870
3513
  return (react_2.default.createElement("td", { key: col.key, "data-cell-key": col.key,
2871
3514
  // INFO: no padding — the cell's own button carries it, so the
2872
- // whole cell is the click target
2873
- className: "!p-0 text-sm ".concat(cellFontColor, " whitespace-nowrap ").concat((_d = (_c = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _c === void 0 ? void 0 : _c.className) !== null && _d !== void 0 ? _d : ""), style: (_e = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _e === void 0 ? void 0 : _e.style },
2874
- react_2.default.createElement(dateRangeCell_1.DateRangeCell, { column: __assign(__assign({}, col), { id: col.key, name: col.title, type: "dateRange" }), rowId: (_f = row.recordId) !== null && _f !== void 0 ? _f : row.id, value: resolveValue(row, col.key) })));
3515
+ // whole cell is the click target. Under gridLines="all" the
3516
+ // cell is the box the open cell's ring covers.
3517
+ className: "!p-0 text-sm ".concat(cellFontColor, " whitespace-nowrap ").concat(gridLines === "all" ? "relative" : "", " ").concat((_d = (_c = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _c === void 0 ? void 0 : _c.className) !== null && _d !== void 0 ? _d : ""), style: (_e = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _e === void 0 ? void 0 : _e.style },
3518
+ react_2.default.createElement(dateRangeCell_1.DateRangeCell, { column: __assign(__assign({}, col), { id: col.key, name: col.title, type: "dateRange" }), rowId: (_f = row.recordId) !== null && _f !== void 0 ? _f : row.id, value: resolveValue(row, col.key), fill: gridLines === "all", darkMode: props.darkMode })));
2875
3519
  // INFO: a cell whose value is already a React element (row action
2876
3520
  // buttons, a custom control) is rendered as-is even in an editable
2877
3521
  // table — wrapping it in an inline editor would swallow it
@@ -2931,11 +3575,14 @@ var NewTable = function (rawProps) {
2931
3575
  // table (isColumnLocked) — there a click must leave the Select alone,
2932
3576
  // not navigate — so the overlay is gated on !editable.active.
2933
3577
  var shouldNavigateOnClick = !((_q = props.editable) === null || _q === void 0 ? void 0 : _q.active);
2934
- 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 },
2935
- react_2.default.createElement("div", { className: "relative w-max whitespace-nowrap p-[1px]" },
3578
+ var cellFill = handleGetCellFill(col, rawListValue);
3579
+ var pinProps = getPinProps(col.key, false, rowBgClass, isRowHoverable);
3580
+ return (react_2.default.createElement("td", { key: col.key, "data-cell-fill": cellFill ? "" : undefined, className: "p-0 align-middle ".concat(cellFill ? handleDropCellBg(pinProps === null || pinProps === void 0 ? void 0 : pinProps.className) : ((_r = pinProps === null || pinProps === void 0 ? void 0 : pinProps.className) !== null && _r !== void 0 ? _r : ""), " ").concat((_s = cellFill === null || cellFill === void 0 ? void 0 : cellFill.className) !== null && _s !== void 0 ? _s : ""), style: __assign(__assign({}, pinProps === null || pinProps === void 0 ? void 0 : pinProps.style), cellFill === null || cellFill === void 0 ? void 0 : cellFill.style) },
3581
+ react_2.default.createElement("div", { className: "relative ".concat(cellFill ? "w-full" : "w-max", " whitespace-nowrap p-[1px]") },
2936
3582
  renderFormCell(row, readOnlyDS, null, {
2937
3583
  active: true,
2938
3584
  readOnly: true,
3585
+ fill: !!cellFill,
2939
3586
  onBlur: function () { },
2940
3587
  }),
2941
3588
  shouldNavigateOnClick && props.onClickRow && (react_2.default.createElement("div", { "data-testid": "fill-cell-nav-".concat(col.key), className: "absolute inset-0 z-10 cursor-pointer", onClick: function (e) {
@@ -2953,13 +3600,16 @@ var NewTable = function (rawProps) {
2953
3600
  // INFO: share the column width source with the read-only/edit cell
2954
3601
  // variants, otherwise an "Add" placeholder and a filled value in the
2955
3602
  // same column resolve to different widths and the column looks ragged
2956
- className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " ").concat(handleReadCellWidthClass(col), " ").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 },
3603
+ className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " ").concat(handleReadCellWidthClass(col), " ").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 },
2957
3604
  react_2.default.createElement("div", { className: "cursor-pointer group/modaledit flex items-center gap-x-2 min-h-6 ".concat(handleIsReadCellFixed(col) ? "w-0 min-w-full" : ""), "data-testid": "table-object-edit-".concat(col.key), onClick: function (e) {
2958
3605
  var _a;
2959
3606
  e.stopPropagation();
2960
3607
  (_a = props.onObjectEdit) === null || _a === void 0 ? void 0 : _a.call(props, row.id, col.key, row);
2961
3608
  } },
2962
- handleCheckModalEditEmpty(cellValue) ? (react_2.default.createElement("span", { className: "text-gray-400 italic" }, "Add")) : (react_2.default.createElement("span", { className: "min-w-0 truncate" }, (0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord))),
3609
+ handleCheckModalEditEmpty(cellValue) ? (
3610
+ // INFO: an empty cell under gridLines="all" is blank,
3611
+ // as every other empty cell of the grid is
3612
+ gridLines === "all" ? null : (react_2.default.createElement("span", { className: "text-gray-400 italic" }, "Add"))) : (react_2.default.createElement("span", { className: "min-w-0 truncate" }, (0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord))),
2963
3613
  react_2.default.createElement(outline_1.PencilIcon, { className: "w-3.5 h-3.5 text-gray-400 opacity-0 group-hover/modaledit:opacity-100 flex-shrink-0" }))));
2964
3614
  }
2965
3615
  if (isModalEdit) {
@@ -2970,32 +3620,84 @@ var NewTable = function (rawProps) {
2970
3620
  // INFO: share the column width source with the read-only/edit cell
2971
3621
  // variants, otherwise an "Add" placeholder and a filled value in the
2972
3622
  // same column resolve to different widths and the column looks ragged
2973
- className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " ").concat(handleReadCellWidthClass(col), " ").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 },
3623
+ className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " ").concat(handleReadCellWidthClass(col), " ").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 },
2974
3624
  react_2.default.createElement("div", { className: "cursor-pointer group/modaledit flex items-center gap-x-2 min-h-6 ".concat(handleIsReadCellFixed(col) ? "w-0 min-w-full" : ""), "data-testid": "table-modal-edit-".concat(col.key), onClick: function (e) {
2975
3625
  e.stopPropagation();
2976
3626
  handleModalEditOnClick(row.id, col.key, row);
2977
3627
  } },
2978
- handleCheckModalEditEmpty(cellValue) ? (react_2.default.createElement("span", { className: "text-gray-400 italic" }, "Add")) : (react_2.default.createElement("span", { className: "min-w-0 truncate" }, (0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord))),
3628
+ handleCheckModalEditEmpty(cellValue) ? (
3629
+ // INFO: an empty cell under gridLines="all" is blank,
3630
+ // as every other empty cell of the grid is
3631
+ gridLines === "all" ? null : (react_2.default.createElement("span", { className: "text-gray-400 italic" }, "Add"))) : (react_2.default.createElement("span", { className: "min-w-0 truncate" }, (0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord))),
2979
3632
  react_2.default.createElement(outline_1.PencilIcon, { className: "w-3.5 h-3.5 text-gray-400 opacity-0 group-hover/modaledit:opacity-100 flex-shrink-0" }))));
2980
3633
  }
2981
3634
  // INFO: a multi-select shows its picks as one line of tags until it is
2982
3635
  // clicked — its editor stacks the input over the tags, which made every
2983
3636
  // row two lines tall
3637
+ // INFO: under gridLines="all" a coloured multiple list never swaps to
3638
+ // that editor: the cell keeps its tags and a label picker opens
3639
+ // under it (LabelPicker), like a board's labels column
3640
+ var isLabelPickerColumn = gridLines === "all" && handleColumnShowsTags(col);
3641
+ var isCellEditing = editDataRowId === row.id && editDataHeaderKey === col.key;
2984
3642
  if (isEditable &&
2985
3643
  resolvedColType === "multipleList" &&
2986
- !(editDataRowId === row.id && editDataHeaderKey === col.key) &&
2987
- !((_1 = (_0 = props.bareSettings) === null || _0 === void 0 ? void 0 : _0.bareListDescription) === null || _1 === void 0 ? void 0 : _1.call(_0, col.key, cellValue)))
2988
- return (react_2.default.createElement("td", { key: col.key, "data-cell-key": col.key, className: "".concat(editCellPadding, " ").concat(handleCellMinWidth(col.type), " ").concat(handleReadCellWidthClass(col), " text-sm ").concat(cellFontColor, " ").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 },
2989
- react_2.default.createElement("div", { "data-testid": "table-tag-line-".concat(col.key), role: "button", tabIndex: 0, "aria-label": "Edit ".concat(col.title), className: "flex h-[34px] cursor-pointer items-center gap-1 overflow-hidden whitespace-nowrap ".concat(handleIsReadCellFixed(col) ? "w-0 min-w-full" : ""), onClick: function (e) {
3644
+ (!isCellEditing || isLabelPickerColumn) &&
3645
+ !((_0 = (_z = props.bareSettings) === null || _z === void 0 ? void 0 : _z.bareListDescription) === null || _0 === void 0 ? void 0 : _0.call(_z, col.key, cellValue))) {
3646
+ var isPicking = isLabelPickerColumn && isCellEditing && !!labelPickerAnchor;
3647
+ var handleOpenCell_1 = function (target) {
3648
+ if (gridLines === "all") {
3649
+ handleOpenAfterLeaving(target, function () { return handleOpenTagCell_1(target); });
3650
+ return;
3651
+ }
3652
+ handleOpenTagCell_1(target);
3653
+ };
3654
+ var handleOpenTagCell_1 = function (target) {
3655
+ handleEditDataOnClick(row.id, col.key, rowData);
3656
+ if (isLabelPickerColumn)
3657
+ setLabelPickerAnchor(target.closest("td"));
3658
+ // INFO: under gridLines="all" a plain multiple list's editor
3659
+ // takes focus as it opens, so one click opens its list
3660
+ else if (gridLines === "all")
3661
+ pendingFocusRef.current = "".concat(row.id, ":").concat(col.key);
3662
+ };
3663
+ var pickedValue = resolveValue((isCellEditing ? rowData : row), col.key);
3664
+ return (react_2.default.createElement("td", { key: col.key, "data-cell-key": col.key, className: "".concat(editCellPadding, " ").concat(handleCellMinWidth(col.type), " ").concat(handleReadCellWidthClass(col), " text-sm ").concat(cellFontColor, " ").concat((_2 = (_1 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _1 === void 0 ? void 0 : _1.className) !== null && _2 !== void 0 ? _2 : "", " ").concat(isPicking ? "!shadow-[inset_0_0_0_2px_#9ca3af]" : ""), style: (_3 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _3 === void 0 ? void 0 : _3.style },
3665
+ react_2.default.createElement("div", { "data-testid": "table-tag-line-".concat(col.key), role: "button", "aria-haspopup": isLabelPickerColumn ? "dialog" : undefined, "aria-expanded": isLabelPickerColumn ? isPicking : undefined, tabIndex: 0, "aria-label": "Edit ".concat(col.title), className: "flex h-[34px] cursor-pointer items-center gap-1 overflow-hidden whitespace-nowrap ".concat(handleIsReadCellFixed(col) ? "w-0 min-w-full" : ""), onClick: function (e) {
2990
3666
  e.stopPropagation();
2991
- handleEditDataOnClick(row.id, col.key, rowData);
3667
+ handleOpenCell_1(e.currentTarget);
2992
3668
  }, onKeyDown: function (e) {
2993
3669
  if (e.key !== "Enter" && e.key !== " ")
2994
3670
  return;
2995
3671
  e.preventDefault();
2996
3672
  e.stopPropagation();
2997
- handleEditDataOnClick(row.id, col.key, rowData);
2998
- } }, renderTagLine(col, cellValue))));
3673
+ handleOpenCell_1(e.currentTarget);
3674
+ } }, renderTagLine(col, isLabelPickerColumn ? pickedValue : cellValue)),
3675
+ isPicking && labelPickerAnchor && (react_2.default.createElement(labelPicker_1.LabelPicker, { anchor: labelPickerAnchor, darkMode: props.darkMode, required: (0, updateModule_1.handleIsFieldRequired)(col, rowData), options: ((_4 = col.listSelection) !== null && _4 !== void 0 ? _4 : []).map(function (key) { return ({
3676
+ key: String(key),
3677
+ color: handleGetListColour(col, key),
3678
+ }); }), value: (Array.isArray(pickedValue)
3679
+ ? pickedValue
3680
+ : pickedValue
3681
+ ? [pickedValue]
3682
+ : []).map(String),
3683
+ // INFO: each pick or removal saves at once and the
3684
+ // picker stays open, as a multi-select's picks do
3685
+ // INFO: the row goes through the clone a Select's pick
3686
+ // takes, so the save carries the same cleaned row
3687
+ onChange: function (next) {
3688
+ var _a, _b;
3689
+ var updated = (0, updateModule_1.handleClonedDataAttribute)(editDataValueRef.current, handleConvertColumnToDataStructure(flatColumns), (_b = (_a = props.devSettings) === null || _a === void 0 ? void 0 : _a.server) !== null && _b !== void 0 ? _b : "mongoServer");
3690
+ updated[col.key] = next;
3691
+ editDataValueRef.current = updated;
3692
+ setEditDataValue(updated);
3693
+ handleEditDataOnBlur(col.key, updated, {
3694
+ keepEditing: true,
3695
+ });
3696
+ }, onClose: function () {
3697
+ setLabelPickerAnchor(null);
3698
+ handleEditDataOnBlur(col.key, editDataValueRef.current);
3699
+ } }))));
3700
+ }
2999
3701
  // INFO: coloured list cells are exempt from the hover swap — read and
3000
3702
  // edit are the same filled pill, so there is nothing to swap to
3001
3703
  var bareOverride = isEditable
@@ -3003,11 +3705,42 @@ var NewTable = function (rawProps) {
3003
3705
  : undefined;
3004
3706
  if (isEditable && !bareOverride && handleColumnShowsTags(col))
3005
3707
  return renderEditDataInputs(colIndex, col, rowData, row.id, rowBgClass, isRowHoverable);
3708
+ // INFO: under gridLines="all" a text, number, email, text-area,
3709
+ // phone, date or plain dropdown cell is not swapped on hover — it
3710
+ // keeps the value as it reads (a date its format and warning
3711
+ // colour) until a click opens its editor, as a sheet or board
3712
+ // cell does
3713
+ var isClickToEditCell = isEditable &&
3714
+ !bareOverride &&
3715
+ gridLines === "all" &&
3716
+ FILL_INPUT_TYPES.includes(resolvedColType);
3006
3717
  var readCell = (react_2.default.createElement("td", { key: col.key, "data-cell-key": col.key, "data-pin-key": leftPinned.includes(col.key) || rightPinned.includes(col.key)
3007
3718
  ? col.key
3008
- : undefined, className: "".concat(cellPadding, " ").concat(isEditable ? "".concat(editCellMinHeight, " align-middle ").concat(handleCellMinWidth(col.type)) : "", " text-sm ").concat(colIndex === 0 && props.onClickRow ? titleFontColor : cellFontColor, " ").concat(handleReadCellWidthClass(col), " ").concat((_8 = (_7 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _7 === void 0 ? void 0 : _7.className) !== null && _8 !== void 0 ? _8 : ""), style: (_9 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _9 === void 0 ? void 0 : _9.style, "data-row-link-cell": props.newTabUrl && props.onClickRow ? "" : undefined }, handleIsReadCellFixed(col) ? (react_2.default.createElement("div", { className: "w-0 min-w-full truncate" }, renderReadCellValue(col, row, cellValue))) : (renderReadCellValue(col, row, cellValue))));
3719
+ : undefined, className: "".concat(cellPadding, " ").concat(isEditable ? "".concat(editCellMinHeight, " align-middle ").concat(handleCellMinWidth(col.type)) : "", " text-sm ").concat(colIndex === 0 && props.onClickRow ? titleFontColor : cellFontColor, " ").concat(handleReadCellWidthClass(col), " ").concat((_8 = (_7 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _7 === void 0 ? void 0 : _7.className) !== null && _8 !== void 0 ? _8 : ""), style: (_9 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _9 === void 0 ? void 0 : _9.style, "data-row-link-cell": props.newTabUrl && props.onClickRow ? "" : undefined,
3720
+ // INFO: a click opens the editor in place rather than following
3721
+ // the row's link
3722
+ onClickCapture: isClickToEditCell
3723
+ ? function (e) {
3724
+ var _a, _b;
3725
+ // INFO: the title cell also holds the row's pencil,
3726
+ // comments and open buttons and its drag handle —
3727
+ // a click on those does what they say, not edit
3728
+ if ((_b = (_a = e.target).closest) === null || _b === void 0 ? void 0 : _b.call(_a, 'button, [data-testid$="-strip"], [data-testid^="table-row-drag-handle-"]'))
3729
+ return;
3730
+ e.preventDefault();
3731
+ e.stopPropagation();
3732
+ handleOpenAfterLeaving(e.target, function () {
3733
+ pendingFocusRef.current = "".concat(row.id, ":").concat(col.key);
3734
+ handleEditDataOnClick(row.id, col.key, rowData);
3735
+ });
3736
+ }
3737
+ : undefined }, handleIsReadCellFixed(col) ? (react_2.default.createElement("div", { className: "w-0 min-w-full truncate" }, renderReadCellValue(col, row, cellValue))) : (renderReadCellValue(col, row, cellValue))));
3009
3738
  if (!isEditable || bareOverride)
3010
3739
  return readCell;
3740
+ if (isClickToEditCell)
3741
+ return isCellEditing
3742
+ ? renderEditDataInputs(colIndex, col, rowData, row.id, rowBgClass, isRowHoverable)
3743
+ : readCell;
3011
3744
  // INFO: the plain text cell until hovered or mid-edit, then its input
3012
3745
  return (react_2.default.createElement(rowRendering_1.NewTableHoverCell, { key: col.key, editing: handleIsCellEditing(row.id, col.key), renderRead: function () { return handleDecorateCell(readCell); }, renderLive: function () {
3013
3746
  return handleDecorateCell(renderEditDataInputs(colIndex, col, rowData, row.id, rowBgClass, isRowHoverable));
@@ -3071,10 +3804,12 @@ var NewTable = function (rawProps) {
3071
3804
  // spacer and the action cell. It was a bare +1 before, which happened to
3072
3805
  // match a deletable table and was wrong for every other combination; with
3073
3806
  // add-column on it left the band a column short of the row.
3074
- var columnCount = flatColumns.length +
3075
- (props.checkbox ? 1 : 0) +
3076
- (((_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.addColumnEnabled) ? 1 : 0) +
3077
- (handleShowsActionColumn() ? 1 : 0);
3807
+ var columnCount = props.mobileView
3808
+ ? 1
3809
+ : flatColumns.length +
3810
+ (props.checkbox ? 1 : 0) +
3811
+ (((_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.addColumnEnabled) ? 1 : 0) +
3812
+ (handleShowsActionColumn() ? 1 : 0);
3078
3813
  if (!props.groups || props.groups.length === 0) {
3079
3814
  return renderMemberRows("all", props.data.map(function (_row, index) { return index; }), tableVersion, columnCount, virtualGroups);
3080
3815
  }
@@ -3115,8 +3850,12 @@ var NewTable = function (rawProps) {
3115
3850
  renderGroupShowMoreRow(group.id, memberIndexes.length, columnCount, isCollapsed),
3116
3851
  renderGroupLoadMoreRow(group.id, columnCount, isCollapsed, isPending),
3117
3852
  renderGroupPagerRow(group, columnCount, isCollapsed),
3118
- !isCollapsed && !isPending && renderGroupAddRow(group, colourKey),
3119
- !isCollapsed &&
3853
+ !props.mobileView &&
3854
+ !isCollapsed &&
3855
+ !isPending &&
3856
+ renderGroupAddRow(group, colourKey),
3857
+ !props.mobileView &&
3858
+ !isCollapsed &&
3120
3859
  !isPending &&
3121
3860
  renderGroupSummaryRow(group, colourKey)));
3122
3861
  });
@@ -3306,6 +4045,22 @@ var NewTable = function (rawProps) {
3306
4045
  var draggable = (advSettings === null || advSettings === void 0 ? void 0 : advSettings.dragEnabled) ? true : false;
3307
4046
  var droppable = (advSettings === null || advSettings === void 0 ? void 0 : advSettings.dragEnabled) ? true : false;
3308
4047
  var sortClassname = "flex-shrink-0 h-4 w-4 ml-3 cursor-pointer";
4048
+ // INFO: a reference column gets a solid line under its header and a
4049
+ // lookup a dashed one, so linked columns stand out without taking header
4050
+ // space; the pattern, not only the colour, tells them apart
4051
+ var handleGetHeaderLink = function (col) {
4052
+ if ((0, lookup_1.handleIsLookupDerived)(col))
4053
+ return "lookup";
4054
+ if (col.type && lookup_1.LOOKUP_REFERENCE_TYPES.includes(col.type))
4055
+ return "reference";
4056
+ return null;
4057
+ };
4058
+ var renderHeaderLink = function (col) {
4059
+ var link = handleGetHeaderLink(col);
4060
+ if (!link)
4061
+ return null;
4062
+ return (react_2.default.createElement("span", { "aria-hidden": "true", "data-testid": "table-column-link-".concat(col.key), "data-link": link, className: "pointer-events-none absolute inset-x-2 bottom-0 border-b-2 ".concat(link === "lookup" ? "border-dashed" : "border-solid", " ").concat(props.darkMode ? "border-primary-300" : "border-primary-400") }));
4063
+ };
3309
4064
  var renderHeaderIcons = function (col) {
3310
4065
  var _a, _b, _c;
3311
4066
  var sortIcon = null;
@@ -3403,6 +4158,7 @@ var NewTable = function (rawProps) {
3403
4158
  react_2.default.createElement("div", { className: "group/header flex flex-row items-center ".concat(getColumnWidth(col.key) ? "" : ((_d = col.width) !== null && _d !== void 0 ? _d : "")) },
3404
4159
  col.title,
3405
4160
  renderHeaderIcons(col)),
4161
+ renderHeaderLink(col),
3406
4162
  react_2.default.createElement("span", { "data-testid": "table-column-resize-".concat(col.key), className: "group/grip absolute inset-y-0 -right-1 z-10 flex w-2 cursor-col-resize touch-none select-none items-stretch justify-center", draggable: false, onPointerDown: function (event) { return handleResizeStart(event, col.key); }, onPointerMove: handleResizeMove, onPointerUp: handleResizeEnd, onPointerCancel: handleResizeEnd, onClick: function (event) { return event.stopPropagation(); } },
3407
4163
  react_2.default.createElement("span", { "aria-hidden": "true", className: "w-0.5 rounded-full opacity-0 transition-opacity group-hover/th:opacity-60 group-hover/grip:!opacity-100 ".concat(props.darkMode ? "bg-gray-500" : "bg-gray-300", " group-hover/grip:bg-primary-400") }))));
3408
4164
  }),
@@ -3426,10 +4182,11 @@ var NewTable = function (rawProps) {
3426
4182
  if (groupData && groupData.length > 0) {
3427
4183
  return (react_2.default.createElement("th", { key: col.key, colSpan: groupData.length, className: "".concat(cellPadding, " text-left text-xs font-semibold uppercase tracking-wide border-b") }, col.title));
3428
4184
  }
3429
- return (react_2.default.createElement("th", { key: col.key, rowSpan: 2, className: "".concat(cellPadding, " text-left text-xs font-semibold uppercase tracking-wide ").concat(cursorClassname, " ").concat((_b = (_a = getPinProps(col.key, true)) === null || _a === void 0 ? void 0 : _a.className) !== null && _b !== void 0 ? _b : ""), style: (_c = getPinProps(col.key, true)) === null || _c === void 0 ? void 0 : _c.style, draggable: draggable, onDragStart: function (e) { return handleDragStart(e, col.key); }, onDrop: droppable ? function (e) { return handleDrop(e, col.key); } : undefined, onDragOver: handleDragOver },
4185
+ return (react_2.default.createElement("th", { key: col.key, rowSpan: 2, className: "relative ".concat(cellPadding, " text-left text-xs font-semibold uppercase tracking-wide ").concat(cursorClassname, " ").concat((_b = (_a = getPinProps(col.key, true)) === null || _a === void 0 ? void 0 : _a.className) !== null && _b !== void 0 ? _b : ""), style: (_c = getPinProps(col.key, true)) === null || _c === void 0 ? void 0 : _c.style, draggable: draggable, onDragStart: function (e) { return handleDragStart(e, col.key); }, onDrop: droppable ? function (e) { return handleDrop(e, col.key); } : undefined, onDragOver: handleDragOver },
3430
4186
  react_2.default.createElement("div", { className: "group/header flex flex-row items-center ".concat((_d = col.width) !== null && _d !== void 0 ? _d : "") },
3431
4187
  col.title,
3432
- renderHeaderIcons(col))));
4188
+ renderHeaderIcons(col)),
4189
+ renderHeaderLink(col)));
3433
4190
  }),
3434
4191
  renderAddColumnHeader(),
3435
4192
  renderActionColumnHeader()),
@@ -3447,113 +4204,7 @@ var NewTable = function (rawProps) {
3447
4204
  };
3448
4205
  var renderCheckbox = function (checked, onChange, onClick, extraClassName) { return (react_2.default.createElement("input", { type: "checkbox", checked: checked, onChange: onChange, onClick: onClick, className: "rounded ".concat(props.darkMode ? "border-gray-400" : "border-gray-500", " ").concat(bgColor, " focus:ring-0 focus:ring-offset-0 focus:outline-offset-0 checked:text-primary-400 ").concat(extraClassName !== null && extraClassName !== void 0 ? extraClassName : "") })); };
3449
4206
  if (props.mobileView) {
3450
- var isIdLike_1 = function (c) {
3451
- return /^id$/i.test(c.key) || /^_id$/i.test(c.key);
3452
- };
3453
- var titleCol_1 = (_v = flatColumns.find(function (c) { return !isIdLike_1(c); })) !== null && _v !== void 0 ? _v : flatColumns[0];
3454
- var expandHeaderBg_1 = props.darkMode ? "bg-gray-700" : "bg-gray-100";
3455
- var expandHeaderFontColor_1 = props.darkMode ? "text-white" : "";
3456
- var headerBgColor_1 = props.darkMode
3457
- ? ((_w = props.darkModeBg) !== null && _w !== void 0 ? _w : "bg-gray-900")
3458
- : "";
3459
- var headerFontColor_1 = props.darkMode ? "text-white" : "";
3460
- // INFO: renders tag + trailing text adjacent to the Collapse title
3461
- var renderMobileTitleAdjacent_1 = function (row, spaceRow) {
3462
- var _a;
3463
- var ta = (_a = props.mobileTooltip) === null || _a === void 0 ? void 0 : _a.titleAdjacent;
3464
- if (!ta)
3465
- return undefined;
3466
- var source = spaceRow !== null && spaceRow !== void 0 ? spaceRow : row;
3467
- var tagValue = ta.tagKey
3468
- ? resolveValueToString(ta.tagKey, source, row)
3469
- : "";
3470
- var trailingValue = ta.trailingKey
3471
- ? resolveValueToString(ta.trailingKey, source, row)
3472
- : "";
3473
- if (!tagValue && !trailingValue)
3474
- return undefined;
3475
- var tagColor = tagValue && ta.tagColor ? ta.tagColor[tagValue] : undefined;
3476
- return (react_2.default.createElement("div", { className: "flex items-center gap-2 mr-2" },
3477
- tagValue && (react_2.default.createElement(tag_1.Tag, { tagText: String(tagValue), size: "small", variant: "flat", color: tagColor !== null && tagColor !== void 0 ? tagColor : undefined, rounded: "md", className: "whitespace-nowrap" })),
3478
- trailingValue && (react_2.default.createElement("span", { className: "text-xs whitespace-nowrap ".concat(props.darkMode ? "text-gray-300" : "text-gray-500") }, String(trailingValue)))));
3479
- };
3480
- // INFO: second-line label + value summary under the title (while collapsed),
3481
- // driven by titleAdjacent.summaryKeys. Reuses the tooltip's summary layout.
3482
- var renderMobileTitleSummary_1 = function (row, spaceRow) {
3483
- var _a, _b;
3484
- var ta = (_a = props.mobileTooltip) === null || _a === void 0 ? void 0 : _a.titleAdjacent;
3485
- // INFO: a column the view hides, or the one already drawn as the title,
3486
- // stays out of the line under the title
3487
- var keys = (_b = ta === null || ta === void 0 ? void 0 : ta.summaryKeys) === null || _b === void 0 ? void 0 : _b.filter(function (key) {
3488
- var parentKey = key.split(".")[0];
3489
- return (key !== (titleCol_1 === null || titleCol_1 === void 0 ? void 0 : titleCol_1.key) &&
3490
- flatColumns.some(function (col) { return col.key === key || col.key === parentKey; }));
3491
- });
3492
- if (!ta || !keys || keys.length === 0)
3493
- return undefined;
3494
- var source = spaceRow !== null && spaceRow !== void 0 ? spaceRow : row;
3495
- var pairs = keys
3496
- .map(function (key) {
3497
- var _a, _b, _c, _d;
3498
- // INFO: label from the column title, falling back to the parent
3499
- // column for a dotted key (e.g. "shippingAddress.name").
3500
- var parentKey = key.split(".")[0];
3501
- var label = (_d = (_b = (_a = columns.find(function (col) { return col.key === key; })) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : (_c = columns.find(function (col) { return col.key === parentKey; })) === null || _c === void 0 ? void 0 : _c.title) !== null && _d !== void 0 ? _d : key;
3502
- return { key: key, label: label, value: resolveValueToString(key, source, row) };
3503
- })
3504
- .filter(function (p) { return p.value !== undefined && p.value !== null && p.value !== ""; });
3505
- if (pairs.length === 0)
3506
- return undefined;
3507
- return (react_2.default.createElement("div", { className: "flex flex-wrap gap-x-6 gap-y-1.5 pl-9 pr-4 pb-2 ".concat(headerBgColor_1) }, pairs.map(function (p) { return (react_2.default.createElement("div", { key: p.key, className: "flex flex-col min-w-0" },
3508
- react_2.default.createElement("span", { className: "text-[11px] uppercase tracking-wide text-gray-400" }, p.label),
3509
- react_2.default.createElement("span", { className: "text-xs ".concat(props.darkMode ? "text-gray-200" : "text-gray-700") }, p.value))); })));
3510
- };
3511
- // INFO: renders the hover tooltip card content — image, summary pairs, and tags
3512
- var renderMobileTooltipContent_1 = function (row, spaceRow) {
3513
- var _a, _b, _c;
3514
- var tt = (_a = props.mobileTooltip) === null || _a === void 0 ? void 0 : _a.tooltip;
3515
- if (!tt)
3516
- return null;
3517
- var source = spaceRow !== null && spaceRow !== void 0 ? spaceRow : row;
3518
- var imageUrl = tt.imageKey
3519
- ? resolveValue(source, tt.imageKey)
3520
- : undefined;
3521
- var summaryPairs = ((_b = tt.summaryKeys) !== null && _b !== void 0 ? _b : [])
3522
- .map(function (key) {
3523
- var _a;
3524
- var col = flatColumns.find(function (c) { return c.key === key; });
3525
- return {
3526
- key: key,
3527
- label: (_a = col === null || col === void 0 ? void 0 : col.title) !== null && _a !== void 0 ? _a : key,
3528
- value: resolveValue(source, key),
3529
- };
3530
- })
3531
- .filter(function (p) { return p.value !== undefined && p.value !== null && p.value !== ""; });
3532
- var tagValues = ((_c = tt.tagKeys) !== null && _c !== void 0 ? _c : [])
3533
- .map(function (key) {
3534
- var val = resolveValueToString(key, source, row);
3535
- return {
3536
- key: key,
3537
- value: val,
3538
- color: val && tt.tagColors ? tt.tagColors[val] : undefined,
3539
- };
3540
- })
3541
- .filter(function (t) { return !!t.value; });
3542
- if (!imageUrl && summaryPairs.length === 0 && tagValues.length === 0)
3543
- return null;
3544
- return (react_2.default.createElement("div", { className: "rounded-xl border shadow-lg p-3 w-72 ".concat(props.darkMode ? "bg-gray-800 border-gray-700" : "bg-white border-gray-200") },
3545
- react_2.default.createElement("div", { className: "flex gap-3" },
3546
- imageUrl && (react_2.default.createElement("img", { src: String(imageUrl), alt: "", className: "h-14 w-14 rounded-lg object-cover flex-shrink-0" })),
3547
- react_2.default.createElement("div", { className: "flex flex-col gap-1.5 min-w-0 flex-1" }, summaryPairs.map(function (p) { return (react_2.default.createElement("div", { key: p.key, className: "flex flex-col" },
3548
- react_2.default.createElement("span", { className: "text-[11px] uppercase tracking-wide ".concat(props.darkMode ? "text-gray-400" : "text-gray-400") }, p.label),
3549
- react_2.default.createElement("span", { className: "text-xs font-medium ".concat(props.darkMode ? "text-gray-200" : "text-gray-700", " truncate") }, typeof p.value === "object"
3550
- ? JSON.stringify(p.value)
3551
- : String(p.value)))); }))),
3552
- tagValues.length > 0 && (react_2.default.createElement("div", { className: "flex flex-wrap gap-1 mt-2 pt-2 border-t border-gray-100" }, tagValues.map(function (t) {
3553
- var _a;
3554
- return (react_2.default.createElement(tag_1.Tag, { key: t.key, tagText: String(t.value), size: "small", variant: "flat", color: (_a = t.color) !== null && _a !== void 0 ? _a : undefined, rounded: "md" }));
3555
- })))));
3556
- };
4207
+ var hasPhoneGroups = !!((_w = props.groups) === null || _w === void 0 ? void 0 : _w.length);
3557
4208
  return (react_2.default.createElement("div", null,
3558
4209
  react_2.default.createElement("div", { className: "w-full ".concat(((_x = props.mobileTooltip) === null || _x === void 0 ? void 0 : _x.tooltip) ? "overflow-visible" : "overflow-hidden", " ").concat(isFlat
3559
4210
  ? ""
@@ -3566,60 +4217,9 @@ var NewTable = function (rawProps) {
3566
4217
  props.loading &&
3567
4218
  Array.from({ length: 3 }).map(function (_, i) { return (react_2.default.createElement("div", { key: "skeleton-".concat(i), className: "p-4" },
3568
4219
  react_2.default.createElement("div", { className: "h-5 w-3/4 rounded-md animate-pulse ".concat(props.darkMode ? "bg-gray-700" : "bg-gray-200") }))); }),
3569
- !props.loading && props.data.length === 0 && (react_2.default.createElement("p", { className: "p-4 text-center text-sm ".concat(cellFontColor) }, (_0 = props.emptyTitle) !== null && _0 !== void 0 ? _0 : "No items")),
3570
- !props.loading &&
3571
- props.data.map(function (row, index) {
3572
- var _a, _b, _c, _d, _e, _f, _g;
3573
- var spaceRow = (_a = props.spaceData) === null || _a === void 0 ? void 0 : _a[index];
3574
- var cardTitle = titleCol_1
3575
- ? spaceRow
3576
- ? spaceRow[titleCol_1.key]
3577
- : resolveValue(row, titleCol_1.key) || row.id
3578
- : "";
3579
- var isSelected = ((_c = (_b = props.selectedIds) === null || _b === void 0 ? void 0 : _b.includes(row.id)) !== null && _c !== void 0 ? _c : false) ||
3580
- ((_d = props.selectAll) !== null && _d !== void 0 ? _d : false);
3581
- var detailList = flatColumns.map(function (col) { return ({
3582
- id: col.key,
3583
- title: col.title,
3584
- text: (0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, spaceRow ? spaceRow[col.key] : resolveValue(row, col.key), props.bareSettings, true, props.disableEllipsisOnLongWord),
3585
- }); });
3586
- if (props.onClickRow || props.newTabUrl) {
3587
- detailList.push({
3588
- id: "".concat(row.id, "-more-details-btn"),
3589
- title: "",
3590
- text: props.onClickRow && props.newTabUrl ? (react_2.default.createElement(link_1.Link, { href: props.newTabUrl + row.id + ((_e = props.addNewTabUrl) !== null && _e !== void 0 ? _e : ""), className: "flex items-center", linkType: props.linkType, custom: props.custom, onClick: function (e) {
3591
- var _a;
3592
- if (!e.metaKey && !e.ctrlKey) {
3593
- e.preventDefault();
3594
- (_a = props.onClickRow) === null || _a === void 0 ? void 0 : _a.call(props, row.id, row, spaceRow);
3595
- }
3596
- } },
3597
- react_2.default.createElement(textButton_1.TextButton, { text: "More details", className: "text-sm", onClick: function () { } }),
3598
- react_2.default.createElement(solid_2.ChevronRightIcon, { className: "ml-1 w-3 h-3 text-primary-500" }))) : props.onClickRow ? (react_2.default.createElement("div", { className: "flex items-center" },
3599
- react_2.default.createElement(textButton_1.TextButton, { text: "More details", className: "text-sm", onClick: function (e) {
3600
- var _a;
3601
- e.stopPropagation();
3602
- (_a = props.onClickRow) === null || _a === void 0 ? void 0 : _a.call(props, row.id, row, spaceRow);
3603
- } }),
3604
- react_2.default.createElement(solid_2.ChevronRightIcon, { className: "ml-1 w-3 h-3 text-primary-500" }))) : props.newTabUrl ? (react_2.default.createElement(link_1.Link, { href: props.newTabUrl + row.id + ((_f = props.addNewTabUrl) !== null && _f !== void 0 ? _f : ""), className: "flex items-center", linkType: props.linkType, custom: props.custom },
3605
- react_2.default.createElement(textButton_1.TextButton, { text: "More details", className: "text-sm", onClick: function () { } }),
3606
- react_2.default.createElement(solid_2.ChevronRightIcon, { className: "ml-1 w-3 h-3 text-primary-500" }))) : null,
3607
- });
3608
- }
3609
- return (react_2.default.createElement("div", { key: row.id, "data-dtw-record-id": row.id, className: "relative group/tooltip" },
3610
- react_2.default.createElement(collapse_1.Collapse, { title: cardTitle, titleClassName: "text-sm font-medium !p-0 ".concat(props.onClickRow ? titleFontColor : ""), icon: props.checkbox ? renderCheckbox(isSelected, function () { }, function (e) { return handleSelectRow(row.id, e); }, "w-4 h-4 ".concat(isMaxReached && !isSelected ? "opacity-50 cursor-not-allowed" : "cursor-pointer")) : (react_2.default.createElement(solid_2.ListBulletIcon, { className: "w-4 h-4 ".concat(props.darkMode ? "text-gray-400" : "text-gray-500") })), defaultValue: false, additionalComp: hasRowActions ? (
3611
- // INFO: the row's expand arrow sits right after this, so
3612
- // the margin keeps a thumb from hitting the wrong one
3613
- react_2.default.createElement("div", { className: "mr-3 flex items-center gap-2" },
3614
- renderMobileTitleAdjacent_1(row, spaceRow),
3615
- renderActivityButton(row.id))) : (renderMobileTitleAdjacent_1(row, spaceRow)), collapseAdditionalComp: renderMobileTitleSummary_1(row, spaceRow),
3616
- // INFO: clicking the summary line expands the row, same as
3617
- // the header
3618
- collapseAdditionalCompToggle: true, collapseContainerCss: "".concat(isSelected ? selectedRowBg : expandHeaderBg_1, " ").concat(expandHeaderFontColor_1), notCollapseContainerCss: "".concat(isSelected ? selectedRowBg : headerBgColor_1, " ").concat(headerFontColor_1), content: react_2.default.createElement("div", null,
3619
- react_2.default.createElement(detailList_1.DetailList, { title: "", list: detailList, size: "compact", darkMode: props.darkMode })) }),
3620
- ((_g = props.mobileTooltip) === null || _g === void 0 ? void 0 : _g.tooltip) &&
3621
- renderMobileTooltipContent_1(row, spaceRow) && (react_2.default.createElement("div", { className: "absolute left-1/2 -translate-x-1/2 top-full mt-1 z-50 hidden group-hover/tooltip:block" }, renderMobileTooltipContent_1(row, spaceRow)))));
3622
- })),
4220
+ !props.loading && props.data.length === 0 && !hasPhoneGroups && (react_2.default.createElement("p", { className: "p-4 text-center text-sm ".concat(cellFontColor) }, (_0 = props.emptyTitle) !== null && _0 !== void 0 ? _0 : "No items")),
4221
+ !props.loading && (props.data.length > 0 || hasPhoneGroups) && (react_2.default.createElement("table", { className: "w-full table-fixed", ref: tableRef },
4222
+ react_2.default.createElement("tbody", { className: "divide-y ".concat(dividerColor) }, renderDesktopRows())))),
3623
4223
  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
3624
4224
  ? "pagination-container w-full sm:px-6 ".concat(borderColor, " ").concat(isFixed ? "fixed bottom-0 left-0 z-10" : "sticky top-0 left-0")
3625
4225
  : "") }),
@@ -3671,7 +4271,7 @@ var NewTable = function (rawProps) {
3671
4271
  dbModule: axios_1.default,
3672
4272
  devSettings: props.devSettings,
3673
4273
  referencesOptions: mergedReferencesOptions,
3674
- referencesDetails: referencesDetails,
4274
+ referencesDetails: mergedReferencesDetails,
3675
4275
  referenceLoading: referenceLoading,
3676
4276
  setReferenceLoading: setReferenceLoading,
3677
4277
  setReferencesOptions: setReferencesOptions,
@@ -3699,9 +4299,9 @@ var NewTable = function (rawProps) {
3699
4299
  // INFO: width:max-content, not w-full — a table pinned to 100% never
3700
4300
  // exceeds the wrapper, so overflow-x-auto never scrolls and the columns
3701
4301
  // crush instead. min-w-full still stretches a narrow table.
3702
- className: "w-max min-w-full ".concat(isDragSelecting ? "select-none" : ""), ref: tableRef },
4302
+ className: "w-max min-w-full ".concat(isDragSelecting ? "select-none" : "", " ").concat(gridLinesClass), ref: tableRef },
3703
4303
  renderTableHeader(),
3704
- react_2.default.createElement("tbody", { className: "divide-y ".concat(dividerColor, " ").concat(CELL_FIT_CLASS) },
4304
+ react_2.default.createElement("tbody", { className: "divide-y ".concat(gridLines === "all" && !props.darkMode ? "divide-gray-200" : dividerColor, " ").concat(CELL_FIT_CLASS) },
3705
4305
  !props.loading &&
3706
4306
  isAddRowPinned &&
3707
4307
  addData &&