blixify-ui-web 1.2.59 → 1.2.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/lib/components/action/radioList/index.d.ts +2 -0
  2. package/lib/components/action/radioList/index.d.ts.map +1 -1
  3. package/lib/components/action/radioList/index.js +13 -7
  4. package/lib/components/action/radioList/index.js.map +1 -1
  5. package/lib/components/data/dataTemplate/dataStateModel.d.ts +9 -0
  6. package/lib/components/data/dataTemplate/dataStateModel.d.ts.map +1 -1
  7. package/lib/components/data/dataTemplate/dataStateModel.js.map +1 -1
  8. package/lib/components/data/dataTemplate/index.d.ts.map +1 -1
  9. package/lib/components/data/dataTemplate/index.js +443 -197
  10. package/lib/components/data/dataTemplate/index.js.map +1 -1
  11. package/lib/components/data/dataTemplate/model.d.ts +4 -0
  12. package/lib/components/data/dataTemplate/model.d.ts.map +1 -1
  13. package/lib/components/data/listModule.d.ts +3 -1
  14. package/lib/components/data/listModule.d.ts.map +1 -1
  15. package/lib/components/data/listModule.js +11 -2
  16. package/lib/components/data/listModule.js.map +1 -1
  17. package/lib/components/data/moduleUtils.d.ts +1 -0
  18. package/lib/components/data/moduleUtils.d.ts.map +1 -1
  19. package/lib/components/data/moduleUtils.js +144 -114
  20. package/lib/components/data/moduleUtils.js.map +1 -1
  21. package/lib/components/data/readModule.d.ts.map +1 -1
  22. package/lib/components/data/readModule.js +24 -6
  23. package/lib/components/data/readModule.js.map +1 -1
  24. package/lib/components/data/testSchema.js +1 -1
  25. package/lib/components/data/testSchema.js.map +1 -1
  26. package/lib/components/data/updateModule.d.ts +3 -0
  27. package/lib/components/data/updateModule.d.ts.map +1 -1
  28. package/lib/components/data/updateModule.js +44 -17
  29. package/lib/components/data/updateModule.js.map +1 -1
  30. package/lib/components/data/utils.d.ts +2 -0
  31. package/lib/components/data/utils.d.ts.map +1 -1
  32. package/lib/components/data/utils.js +42 -1
  33. package/lib/components/data/utils.js.map +1 -1
  34. package/lib/components/display/flexTable/index.d.ts +14 -0
  35. package/lib/components/display/flexTable/index.d.ts.map +1 -1
  36. package/lib/components/display/flexTable/index.js +97 -17
  37. package/lib/components/display/flexTable/index.js.map +1 -1
  38. package/lib/components/display/newTable/index.d.ts +11 -0
  39. package/lib/components/display/newTable/index.d.ts.map +1 -1
  40. package/lib/components/display/newTable/index.js +448 -124
  41. package/lib/components/display/newTable/index.js.map +1 -1
  42. package/lib/components/display/notification/index.d.ts +2 -0
  43. package/lib/components/display/notification/index.d.ts.map +1 -1
  44. package/lib/components/display/notification/index.js +2 -1
  45. package/lib/components/display/notification/index.js.map +1 -1
  46. package/lib/components/display/scrollShadow/index.d.ts +9 -0
  47. package/lib/components/display/scrollShadow/index.d.ts.map +1 -0
  48. package/lib/components/display/scrollShadow/index.js +66 -0
  49. package/lib/components/display/scrollShadow/index.js.map +1 -0
  50. package/lib/components/display/stepper/index.d.ts +3 -0
  51. package/lib/components/display/stepper/index.d.ts.map +1 -1
  52. package/lib/components/display/stepper/index.js +28 -11
  53. package/lib/components/display/stepper/index.js.map +1 -1
  54. package/lib/components/display/table/index.d.ts +3 -0
  55. package/lib/components/display/table/index.d.ts.map +1 -1
  56. package/lib/components/display/table/index.js +12 -11
  57. package/lib/components/display/table/index.js.map +1 -1
  58. package/lib/components/input/datePicker/index.d.ts.map +1 -1
  59. package/lib/components/input/datePicker/index.js +5 -5
  60. package/lib/components/input/datePicker/index.js.map +1 -1
  61. package/lib/components/input/select/index.d.ts.map +1 -1
  62. package/lib/components/input/select/index.js +10 -9
  63. package/lib/components/input/select/index.js.map +1 -1
  64. package/lib/components/input/textArea/index.d.ts.map +1 -1
  65. package/lib/components/input/textArea/index.js +19 -3
  66. package/lib/components/input/textArea/index.js.map +1 -1
  67. package/lib/components/input/textInput/index.d.ts.map +1 -1
  68. package/lib/components/input/textInput/index.js +23 -10
  69. package/lib/components/input/textInput/index.js.map +1 -1
  70. package/lib/tail.css +2 -2
  71. package/package.json +1 -1
@@ -102,6 +102,7 @@ var iconButton_1 = require("../../action/iconButton");
102
102
  var link_1 = require("../../structure/link");
103
103
  var button_1 = require("../../action/button");
104
104
  var modal_1 = require("../modal");
105
+ var scrollShadow_1 = require("../scrollShadow");
105
106
  // INFO: resolve dotted key paths (e.g. "group.subKey") against a row object.
106
107
  // Required because flatColumns uses "parent.child" keys for groupData sub-columns.
107
108
  var resolveValue = function (row, key) {
@@ -157,8 +158,54 @@ var handleCheckModalEditEmpty = function (value) {
157
158
  }
158
159
  return false;
159
160
  };
161
+ // INFO: literal class maps so Tailwind emits them. Keys match the Tag palette
162
+ // (tag/utils.ts) so a column's listSelectionColour drives both the chip in the
163
+ // read view and the solid fill in the table. Yellow gets dark text — white on
164
+ // yellow-500 fails contrast.
165
+ var FILL_CLASS = {
166
+ default: "bg-primary-500 text-white",
167
+ red: "bg-red-500 text-white",
168
+ blue: "bg-blue-500 text-white",
169
+ green: "bg-green-500 text-white",
170
+ yellow: "bg-yellow-400 text-yellow-950",
171
+ indigo: "bg-indigo-500 text-white",
172
+ dark: "bg-gray-800 text-white",
173
+ };
174
+ // INFO: group band (tinted) and the accent bar its member rows carry
175
+ var BAND_CLASS = {
176
+ default: "bg-primary-50 text-primary-800 border-primary-500",
177
+ red: "bg-red-50 text-red-800 border-red-500",
178
+ blue: "bg-blue-50 text-blue-800 border-blue-500",
179
+ green: "bg-green-50 text-green-800 border-green-500",
180
+ yellow: "bg-yellow-50 text-yellow-800 border-yellow-500",
181
+ indigo: "bg-indigo-50 text-indigo-800 border-indigo-500",
182
+ dark: "bg-gray-100 text-gray-800 border-gray-700",
183
+ none: "bg-gray-50 text-gray-700 border-gray-300",
184
+ };
185
+ var ACCENT_CLASS = {
186
+ default: "border-primary-500",
187
+ red: "border-red-500",
188
+ blue: "border-blue-500",
189
+ green: "border-green-500",
190
+ yellow: "border-yellow-500",
191
+ indigo: "border-indigo-500",
192
+ dark: "border-gray-700",
193
+ none: "border-gray-300",
194
+ };
195
+ // INFO: the colour a list column assigns to a value, or undefined when the
196
+ // column carries no palette — undefined means "render as before"
197
+ var handleGetListColour = function (col, value) {
198
+ var column = col;
199
+ if (!Array.isArray(column.listSelection) ||
200
+ !Array.isArray(column.listSelectionColour))
201
+ return undefined;
202
+ var index = column.listSelection.indexOf(value);
203
+ if (index < 0)
204
+ return undefined;
205
+ return column.listSelectionColour[index] || undefined;
206
+ };
160
207
  var NewTable = function (props) {
161
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
208
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
162
209
  var columns = (_b = (_a = props.columns) !== null && _a !== void 0 ? _a : props.header) !== null && _b !== void 0 ? _b : [];
163
210
  var defaultLimit = 10;
164
211
  var defaultPageSize = 5;
@@ -207,27 +254,64 @@ var NewTable = function (props) {
207
254
  flatColumns.length = 0;
208
255
  flatColumns.push.apply(flatColumns, __spreadArray(__spreadArray(__spreadArray([], leftCols, false), middleCols, false), rightCols, false));
209
256
  }
210
- var _u = (0, react_2.useState)(props.fixedPagination ? true : false), isFixed = _u[0], setIsFixed = _u[1];
257
+ var _v = (0, react_2.useState)(props.fixedPagination ? true : false), isFixed = _v[0], setIsFixed = _v[1];
211
258
  //=====================================================================================
212
259
  // SECTION: Advanced Settings
213
260
  //=====================================================================================
214
- var _v = (0, react_2.useState)(""), filterModal = _v[0], setFilterModal = _v[1];
215
- var _w = (0, react_2.useState)(""), addColumnModal = _w[0], setAddColumnModal = _w[1];
261
+ var _w = (0, react_2.useState)(""), filterModal = _w[0], setFilterModal = _w[1];
262
+ var _x = (0, react_2.useState)(""), addColumnModal = _x[0], setAddColumnModal = _x[1];
216
263
  //=====================================================================================
217
264
  // SECTION: Editable & Addable cells
218
265
  //=====================================================================================
219
- var _x = (0, react_2.useState)(""), editDataRowId = _x[0], setEditDataRowId = _x[1];
220
- var _y = (0, react_2.useState)(""), editDataHeaderKey = _y[0], setEditDataHeaderKey = _y[1];
221
- var _z = (0, react_2.useState)(false), modalEditVisible = _z[0], setModalEditVisible = _z[1];
222
- var _0 = (0, react_2.useState)({}), editDataValue = _0[0], setEditDataValue = _0[1];
223
- var _1 = (0, react_2.useState)(false), editDataIsLoading = _1[0], setEditDataIsLoading = _1[1];
224
- var _2 = (0, react_2.useState)(false), addData = _2[0], setAddData = _2[1];
225
- var _3 = (0, react_2.useState)({}), addDataValue = _3[0], setAddDataValue = _3[1];
226
- var _4 = (0, react_2.useState)({}), referencesOptions = _4[0], setReferencesOptions = _4[1];
227
- var _5 = (0, react_2.useState)({}), referencesDetails = _5[0], setReferencesDetails = _5[1];
228
- var _6 = (0, react_2.useState)(false), referenceLoading = _6[0], setReferenceLoading = _6[1];
266
+ var _y = (0, react_2.useState)(""), editDataRowId = _y[0], setEditDataRowId = _y[1];
267
+ var _z = (0, react_2.useState)(""), editDataHeaderKey = _z[0], setEditDataHeaderKey = _z[1];
268
+ var _0 = (0, react_2.useState)(false), modalEditVisible = _0[0], setModalEditVisible = _0[1];
269
+ var _1 = (0, react_2.useState)([]), collapsedGroupIds = _1[0], setCollapsedGroupIds = _1[1];
270
+ // INFO: sheet-style row selection Shift-click extends from the last
271
+ // clicked row, a mouse-down-and-drag down the checkbox column paints a
272
+ // range. The drag applies the start row itself, so the click that lands on
273
+ // mouse-up must be swallowed or it would toggle that row straight back.
274
+ var lastSelectedRowRef = (0, react_2.useRef)(null);
275
+ var dragSelectRef = (0, react_2.useRef)(null);
276
+ var suppressNextClickRef = (0, react_2.useRef)(false);
277
+ var _2 = (0, react_2.useState)(false), isDragSelecting = _2[0], setIsDragSelecting = _2[1];
278
+ var _3 = (0, react_2.useState)(0), copiedCount = _3[0], setCopiedCount = _3[1];
279
+ // INFO: the open colour palette for a filled list cell — which cell, and
280
+ // where to anchor the popover (viewport coordinates, so it escapes the
281
+ // table's overflow container)
282
+ var _4 = (0, react_2.useState)(null), paletteCell = _4[0], setPaletteCell = _4[1];
283
+ (0, react_2.useEffect)(function () {
284
+ if (!paletteCell)
285
+ return;
286
+ var handleClose = function () { return setPaletteCell(null); };
287
+ var handleKey = function (e) {
288
+ if (e.key === "Escape")
289
+ setPaletteCell(null);
290
+ };
291
+ // INFO: no scroll listener — opening the palette can itself scroll the
292
+ // table (the row switches to edit mode and its first input takes focus),
293
+ // and closing on that scroll would shut the palette as it appears
294
+ document.addEventListener("mousedown", handleClose);
295
+ document.addEventListener("keydown", handleKey);
296
+ window.addEventListener("resize", handleClose);
297
+ return function () {
298
+ document.removeEventListener("mousedown", handleClose);
299
+ document.removeEventListener("keydown", handleKey);
300
+ window.removeEventListener("resize", handleClose);
301
+ };
302
+ }, [paletteCell]);
303
+ var _5 = (0, react_2.useState)({}), editDataValue = _5[0], setEditDataValue = _5[1];
304
+ var _6 = (0, react_2.useState)(false), editDataIsLoading = _6[0], setEditDataIsLoading = _6[1];
305
+ var _7 = (0, react_2.useState)(false), addData = _7[0], setAddData = _7[1];
306
+ var _8 = (0, react_2.useState)({}), addDataValue = _8[0], setAddDataValue = _8[1];
307
+ var _9 = (0, react_2.useState)({}), referencesOptions = _9[0], setReferencesOptions = _9[1];
308
+ // INFO: seeded options sit under the local map so a cell's own search
309
+ // results still win per key
310
+ var mergedReferencesOptions = __assign(__assign({}, ((_g = props.referencesOptions) !== null && _g !== void 0 ? _g : {})), referencesOptions);
311
+ var _10 = (0, react_2.useState)({}), referencesDetails = _10[0], setReferencesDetails = _10[1];
312
+ var _11 = (0, react_2.useState)(false), referenceLoading = _11[0], setReferenceLoading = _11[1];
229
313
  // INFO: measured pixel widths for pinned columns without an explicit width.
230
- var _7 = (0, react_2.useState)({}), measuredPinWidths = _7[0], setMeasuredPinWidths = _7[1];
314
+ var _12 = (0, react_2.useState)({}), measuredPinWidths = _12[0], setMeasuredPinWidths = _12[1];
231
315
  var editDataValueRef = (0, react_2.useRef)({});
232
316
  var editDataRowIdRef = (0, react_2.useRef)("");
233
317
  var editDataInputRefs = (0, react_2.useRef)([]);
@@ -255,6 +339,10 @@ var NewTable = function (props) {
255
339
  ? "text-primary-300 font-medium"
256
340
  : "text-primary-600 font-medium";
257
341
  var cellPadding = "px-4 py-2";
342
+ // INFO: an inline input carries its own vertical padding, so the cell around
343
+ // it keeps only enough to clear the hover border — this is what holds an
344
+ // editable row to roughly the height of a read-only one
345
+ var editCellPadding = "px-4 py-0.5";
258
346
  var tableHeaderBgColor = props.tableHeaderBgColor
259
347
  ? props.tableHeaderBgColor
260
348
  : props.darkMode
@@ -607,9 +695,134 @@ var NewTable = function (props) {
607
695
  var handleFilterModal = function (id) {
608
696
  setFilterModal(id);
609
697
  };
698
+ var handleSelectRange = function (fromIndex, toIndex, mode, base) {
699
+ if (!props.handleSelectedIds)
700
+ return;
701
+ var _a = fromIndex <= toIndex ? [fromIndex, toIndex] : [toIndex, fromIndex], low = _a[0], high = _a[1];
702
+ var rangeIds = props.data
703
+ .slice(low, high + 1)
704
+ .map(function (eachRow) { return eachRow.id; });
705
+ if (mode === "remove") {
706
+ props.handleSelectedIds(base.filter(function (eachId) { return !rangeIds.includes(eachId); }));
707
+ return;
708
+ }
709
+ var next = __spreadArray([], base, true);
710
+ rangeIds.forEach(function (eachId) {
711
+ if (next.includes(eachId))
712
+ return;
713
+ if (props.maxSelectedCount && next.length >= props.maxSelectedCount)
714
+ return;
715
+ next.push(eachId);
716
+ });
717
+ props.handleSelectedIds(next);
718
+ };
719
+ var handleDragSelectStart = function (rowId, e) {
720
+ var _a;
721
+ if (props.singleSelect ||
722
+ props.selectAll ||
723
+ !props.handleSelectedIds ||
724
+ e.button !== 0 ||
725
+ e.shiftKey)
726
+ return;
727
+ // INFO: stop the browser from starting a text selection as the pointer
728
+ // sweeps down the column
729
+ e.preventDefault();
730
+ var startIndex = props.data.findIndex(function (eachRow) { return eachRow.id === rowId; });
731
+ if (startIndex < 0)
732
+ return;
733
+ var base = (_a = props.selectedIds) !== null && _a !== void 0 ? _a : [];
734
+ var mode = base.includes(rowId) ? "remove" : "add";
735
+ dragSelectRef.current = { startIndex: startIndex, mode: mode, base: base };
736
+ suppressNextClickRef.current = true;
737
+ lastSelectedRowRef.current = rowId;
738
+ setIsDragSelecting(true);
739
+ handleSelectRange(startIndex, startIndex, mode, base);
740
+ };
741
+ var handleDragSelectOver = function (rowId) {
742
+ var drag = dragSelectRef.current;
743
+ if (!drag)
744
+ return;
745
+ var overIndex = props.data.findIndex(function (eachRow) { return eachRow.id === rowId; });
746
+ if (overIndex < 0)
747
+ return;
748
+ handleSelectRange(drag.startIndex, overIndex, drag.mode, drag.base);
749
+ };
750
+ (0, react_2.useEffect)(function () {
751
+ if (!isDragSelecting)
752
+ return;
753
+ var handleEnd = function () {
754
+ dragSelectRef.current = null;
755
+ setIsDragSelecting(false);
756
+ };
757
+ document.addEventListener("mouseup", handleEnd);
758
+ return function () { return document.removeEventListener("mouseup", handleEnd); };
759
+ }, [isDragSelecting]);
760
+ // INFO: Esc drops the whole selection, the way it drops a range in a sheet.
761
+ // When the colour palette is open Esc closes that instead (its own handler).
762
+ (0, react_2.useEffect)(function () {
763
+ var _a, _b;
764
+ var hasSelection = props.selectAll || ((_b = (_a = props.selectedIds) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0;
765
+ if (!hasSelection || paletteCell)
766
+ return;
767
+ var handleKey = function (e) {
768
+ var _a, _b;
769
+ if (e.key !== "Escape")
770
+ return;
771
+ (_a = props.handleSelectAll) === null || _a === void 0 ? void 0 : _a.call(props, false);
772
+ (_b = props.handleSelectedIds) === null || _b === void 0 ? void 0 : _b.call(props, []);
773
+ lastSelectedRowRef.current = null;
774
+ };
775
+ document.addEventListener("keydown", handleKey);
776
+ return function () { return document.removeEventListener("keydown", handleKey); };
777
+ }, [props.selectAll, props.selectedIds, paletteCell]);
778
+ // INFO: visible columns of the selected rows as TSV — header row first —
779
+ // so a paste into Excel or Sheets lands one value per cell
780
+ var handleCopySelection = function () { return __awaiter(void 0, void 0, void 0, function () {
781
+ var columns, rowIndexes, lines, err_1;
782
+ return __generator(this, function (_a) {
783
+ switch (_a.label) {
784
+ case 0:
785
+ columns = flatColumns.filter(function (eachCol) { return !(eachCol.key === "update" && !eachCol.type); });
786
+ rowIndexes = props.data
787
+ .map(function (_eachRow, index) { return index; })
788
+ .filter(function (index) {
789
+ var _a;
790
+ return props.selectAll ||
791
+ ((_a = props.selectedIds) !== null && _a !== void 0 ? _a : []).includes(props.data[index].id);
792
+ });
793
+ lines = __spreadArray([
794
+ columns.map(function (eachCol) { var _a; return (_a = eachCol.title) !== null && _a !== void 0 ? _a : eachCol.key; }).join("\t")
795
+ ], rowIndexes.map(function (index) {
796
+ return columns
797
+ .map(function (eachCol) {
798
+ var _a;
799
+ return resolveValueToString(eachCol.key, (_a = props.spaceData) === null || _a === void 0 ? void 0 : _a[index], props.data[index]).replace(/[\t\n\r]+/g, " ");
800
+ })
801
+ .join("\t");
802
+ }), true);
803
+ _a.label = 1;
804
+ case 1:
805
+ _a.trys.push([1, 3, , 4]);
806
+ return [4 /*yield*/, navigator.clipboard.writeText(lines.join("\n"))];
807
+ case 2:
808
+ _a.sent();
809
+ setCopiedCount(rowIndexes.length);
810
+ setTimeout(function () { return setCopiedCount(0); }, 1500);
811
+ return [3 /*break*/, 4];
812
+ case 3:
813
+ err_1 = _a.sent();
814
+ return [3 /*break*/, 4];
815
+ case 4: return [2 /*return*/];
816
+ }
817
+ });
818
+ }); };
610
819
  var handleSelectRow = function (rowId, e) {
611
820
  var _a, _b;
612
821
  e.stopPropagation();
822
+ if (suppressNextClickRef.current) {
823
+ suppressNextClickRef.current = false;
824
+ return;
825
+ }
613
826
  // INFO: deactivate "select all pages" mode before doing individual row toggle
614
827
  if (props.selectAll) {
615
828
  (_a = props.handleSelectAll) === null || _a === void 0 ? void 0 : _a.call(props, false);
@@ -622,6 +835,15 @@ var NewTable = function (props) {
622
835
  }
623
836
  else {
624
837
  var current = (_b = props.selectedIds) !== null && _b !== void 0 ? _b : [];
838
+ if (e.shiftKey && lastSelectedRowRef.current) {
839
+ var fromIndex = props.data.findIndex(function (eachRow) { return eachRow.id === lastSelectedRowRef.current; });
840
+ var toIndex = props.data.findIndex(function (eachRow) { return eachRow.id === rowId; });
841
+ if (fromIndex >= 0 && toIndex >= 0) {
842
+ handleSelectRange(fromIndex, toIndex, "add", current);
843
+ return;
844
+ }
845
+ }
846
+ lastSelectedRowRef.current = rowId;
625
847
  var idx = current.indexOf(rowId);
626
848
  // INFO: allow deselect, block new selection when maxSelectedCount is reached
627
849
  if (idx < 0 &&
@@ -816,7 +1038,7 @@ var NewTable = function (props) {
816
1038
  }, false, cellInput, undefined, {
817
1039
  dbModule: axios_1.default,
818
1040
  devSettings: props.devSettings,
819
- referencesOptions: referencesOptions,
1041
+ referencesOptions: mergedReferencesOptions,
820
1042
  referencesDetails: referencesDetails,
821
1043
  referenceLoading: referenceLoading,
822
1044
  setReferenceLoading: setReferenceLoading,
@@ -830,7 +1052,7 @@ var NewTable = function (props) {
830
1052
  var editingRow = editDataRowId === rowId;
831
1053
  return (react_2.default.createElement("td", { key: col.key + String(colIndex),
832
1054
  // INFO: pinned columns use whitespace-normal so text wraps within the fixed width
833
- className: "".concat(cellPadding, " ").concat(getPinProps(col.key, false) ? "" : "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 },
1055
+ className: "".concat(editCellPadding, " ").concat(getPinProps(col.key, false) ? "" : "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 },
834
1056
  react_2.default.createElement("div", { className: "w-max p-[1px]", onClick: function (e) {
835
1057
  e.stopPropagation();
836
1058
  handleEditDataOnClick(rowId, col.key, rowData);
@@ -944,13 +1166,165 @@ var NewTable = function (props) {
944
1166
  };
945
1167
  // INFO: true when maxSelectedCount is set and the current selection has reached the limit
946
1168
  var isMaxReached = !!props.maxSelectedCount &&
947
- ((_h = (_g = props.selectedIds) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 0) >= props.maxSelectedCount;
1169
+ ((_j = (_h = props.selectedIds) === null || _h === void 0 ? void 0 : _h.length) !== null && _j !== void 0 ? _j : 0) >= props.maxSelectedCount;
1170
+ // INFO: one desktop row. groupAccent carries the group's colour so member
1171
+ // rows show the band's colour as a bar down their left edge.
1172
+ var renderDesktopRow = function (row, index, groupAccent) {
1173
+ var _a, _b, _c, _d, _e;
1174
+ var spaceRow = (_a = props.spaceData) === null || _a === void 0 ? void 0 : _a[index];
1175
+ var isSelected = ((_c = (_b = props.selectedIds) === null || _b === void 0 ? void 0 : _b.includes(row.id)) !== null && _c !== void 0 ? _c : false) ||
1176
+ ((_d = props.selectAll) !== null && _d !== void 0 ? _d : false);
1177
+ var rowBgClass = isSelected ? selectedRowBg : bgColor;
1178
+ var isRowHoverable = !!props.onClickRow && !isSelected;
1179
+ return (react_2.default.createElement("tr", { key: row.id, onClick: function (e) {
1180
+ if (props.onClickRow) {
1181
+ props.onClickRow(row.id, row, spaceRow);
1182
+ }
1183
+ e.preventDefault();
1184
+ }, className: "group ".concat(isSelected
1185
+ ? selectedRowBg
1186
+ : props.onClickRow
1187
+ ? "cursor-pointer ".concat(rowHoverBg)
1188
+ : editDataIsLoading && editDataRowId === row.id
1189
+ ? "animate-pulse"
1190
+ : "", " ").concat(groupAccent
1191
+ ? "border-l-4 ".concat((_e = ACCENT_CLASS[groupAccent]) !== null && _e !== void 0 ? _e : ACCENT_CLASS.default)
1192
+ : "") },
1193
+ props.checkbox && (react_2.default.createElement("td", { className: "w-10 ".concat(cellPadding, " ").concat(hasPinColumns ? "".concat(rowBgClass, " ").concat(isRowHoverable ? (props.darkMode ? "group-hover:bg-gray-700" : "group-hover:bg-gray-100") : "") : ""), style: hasPinColumns
1194
+ ? {
1195
+ position: "sticky",
1196
+ left: 0,
1197
+ zIndex: 1,
1198
+ width: CHECKBOX_WIDTH,
1199
+ minWidth: CHECKBOX_WIDTH,
1200
+ }
1201
+ : undefined, onClick: function (e) { return handleSelectRow(row.id, e); }, onMouseDown: function (e) { return handleDragSelectStart(row.id, e); }, onMouseEnter: function () { return handleDragSelectOver(row.id); } }, renderCheckbox(isSelected, function () { }, undefined, isMaxReached && !isSelected
1202
+ ? "opacity-50 cursor-not-allowed"
1203
+ : ""))),
1204
+ flatColumns.map(function (col, colIndex) {
1205
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
1206
+ var cellValue = spaceRow
1207
+ ? spaceRow[col.key]
1208
+ : resolveValue(row, col.key);
1209
+ // INFO: first col with type "string" is never made editable
1210
+ var resolvedColType = (_a = col.type) !== null && _a !== void 0 ? _a : "string";
1211
+ var isActionColumn = col.key === "update" && !col.type;
1212
+ var isModalEdit = ((_b = props.editable) === null || _b === void 0 ? void 0 : _b.active) &&
1213
+ !isActionColumn &&
1214
+ utils_1.supportedModalEditList.includes(resolvedColType);
1215
+ var isObjectEdit = ((_c = props.editable) === null || _c === void 0 ? void 0 : _c.active) &&
1216
+ !isActionColumn &&
1217
+ resolvedColType === "object" &&
1218
+ !!props.onObjectEdit;
1219
+ var isEditable = ((_d = props.editable) === null || _d === void 0 ? void 0 : _d.active) &&
1220
+ !isActionColumn &&
1221
+ !(((_f = (_e = props.selectedIds) === null || _e === void 0 ? void 0 : _e.length) !== null && _f !== void 0 ? _f : 0) > 0 ||
1222
+ props.selectAll) &&
1223
+ utils_1.supportedInlineEditList.includes(resolvedColType);
1224
+ var rowData = editDataRowId === row.id ? editDataValue : row;
1225
+ // INFO: a list column with a palette paints the whole cell —
1226
+ // a status column then reads like a heat map instead of a
1227
+ // row of chips. Editable tables open the palette on click.
1228
+ var rawListValue = resolveValue(row, col.key);
1229
+ var fillColour = resolvedColType === "list" && !isActionColumn
1230
+ ? handleGetListColour(col, rawListValue)
1231
+ : undefined;
1232
+ if (fillColour) {
1233
+ var canPickColour = !!((_g = props.editable) === null || _g === void 0 ? void 0 : _g.active) &&
1234
+ !(((_j = (_h = props.selectedIds) === null || _h === void 0 ? void 0 : _h.length) !== null && _j !== void 0 ? _j : 0) > 0 ||
1235
+ props.selectAll);
1236
+ return (react_2.default.createElement("td", { key: col.key, className: "p-0 align-middle ".concat((_l = (_k = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _k === void 0 ? void 0 : _k.className) !== null && _l !== void 0 ? _l : ""), style: (_m = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _m === void 0 ? void 0 : _m.style },
1237
+ react_2.default.createElement("div", { "data-testid": "table-fill-".concat(col.key), "data-colour": fillColour, role: canPickColour ? "button" : undefined, tabIndex: canPickColour ? 0 : undefined, onClick: canPickColour
1238
+ ? function (e) {
1239
+ e.stopPropagation();
1240
+ var rect = e.currentTarget.getBoundingClientRect();
1241
+ handleEditDataOnClick(row.id, col.key, row);
1242
+ setPaletteCell({
1243
+ rowId: row.id,
1244
+ key: col.key,
1245
+ top: rect.bottom + 4,
1246
+ left: rect.left,
1247
+ width: rect.width,
1248
+ });
1249
+ }
1250
+ : undefined, className: "flex h-full min-h-[40px] items-center justify-center px-3 text-sm font-medium ".concat((_o = FILL_CLASS[fillColour]) !== null && _o !== void 0 ? _o : FILL_CLASS.default, " ").concat(canPickColour ? "cursor-pointer hover:brightness-95" : "") }, String(rawListValue))));
1251
+ }
1252
+ if (isObjectEdit) {
1253
+ return (react_2.default.createElement("td", { key: col.key, className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " whitespace-nowrap") },
1254
+ react_2.default.createElement("div", { className: "cursor-pointer group/modaledit flex items-center gap-x-2 min-h-6", "data-testid": "table-object-edit-".concat(col.key), onClick: function (e) {
1255
+ var _a;
1256
+ e.stopPropagation();
1257
+ (_a = props.onObjectEdit) === null || _a === void 0 ? void 0 : _a.call(props, row.id, col.key, row);
1258
+ } },
1259
+ handleCheckModalEditEmpty(cellValue) ? (react_2.default.createElement("span", { className: "text-gray-400 italic" }, "Add")) : ((0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord)),
1260
+ 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" }))));
1261
+ }
1262
+ if (isModalEdit) {
1263
+ return (react_2.default.createElement("td", { key: col.key, className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " whitespace-nowrap") },
1264
+ react_2.default.createElement("div", { className: "cursor-pointer group/modaledit flex items-center gap-x-2 min-h-6", "data-testid": "table-modal-edit-".concat(col.key), onClick: function (e) {
1265
+ e.stopPropagation();
1266
+ handleModalEditOnClick(row.id, col.key, row);
1267
+ } },
1268
+ handleCheckModalEditEmpty(cellValue) ? (react_2.default.createElement("span", { className: "text-gray-400 italic" }, "Add")) : ((0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord)),
1269
+ 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" }))));
1270
+ }
1271
+ if (isEditable) {
1272
+ var bareOverride = (_q = (_p = props.bareSettings) === null || _p === void 0 ? void 0 : _p.bareListDescription) === null || _q === void 0 ? void 0 : _q.call(_p, col.key, cellValue);
1273
+ if (!bareOverride)
1274
+ return renderEditDataInputs(colIndex, col, rowData, row.id, rowBgClass, isRowHoverable);
1275
+ }
1276
+ return (
1277
+ // INFO: pinned columns use whitespace-normal so text wraps within the fixed width
1278
+ react_2.default.createElement("td", { key: col.key, "data-pin-key": leftPinned.includes(col.key) ||
1279
+ rightPinned.includes(col.key)
1280
+ ? col.key
1281
+ : undefined, className: "".concat(cellPadding, " text-sm ").concat(colIndex === 0 && props.onClickRow ? titleFontColor : cellFontColor, " ").concat(col.width ? "".concat(col.width, " flex-shrink-0") : getPinProps(col.key, false) ? "" : "whitespace-nowrap", " ").concat((_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 }, props.newTabUrl && props.onClickRow ? (react_2.default.createElement(link_1.Link, { href: props.newTabUrl +
1282
+ row.id +
1283
+ ((_u = props.addNewTabUrl) !== null && _u !== void 0 ? _u : ""), className: "w-full block", linkType: props.linkType, custom: props.custom }, (0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord))) : ((0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord))));
1284
+ }),
1285
+ renderActionColumnCell(row.id)));
1286
+ };
1287
+ // INFO: with groups, each group is a tinted band row (chevron, title, count)
1288
+ // followed by its member rows; collapsing a band hides them. Without groups,
1289
+ // the plain row list.
1290
+ var renderDesktopRows = function () {
1291
+ if (!props.groups || props.groups.length === 0) {
1292
+ return props.data.map(function (row, index) { return renderDesktopRow(row, index); });
1293
+ }
1294
+ var indexById = new Map(props.data.map(function (row, index) { return [row.id, index]; }));
1295
+ var columnCount = flatColumns.length + (props.checkbox ? 1 : 0) + 1;
1296
+ return props.groups.map(function (group) {
1297
+ var _a, _b;
1298
+ var colourKey = (_a = group.colour) !== null && _a !== void 0 ? _a : "none";
1299
+ var isCollapsed = collapsedGroupIds.includes(group.id);
1300
+ var memberIndexes = group.rowIds
1301
+ .map(function (rowId) { return indexById.get(rowId); })
1302
+ .filter(function (rowIndex) { return rowIndex !== undefined; });
1303
+ return (react_2.default.createElement(react_2.default.Fragment, { key: "group-".concat(group.id) },
1304
+ react_2.default.createElement("tr", { "data-testid": "table-group-".concat(group.id), "data-collapsed": isCollapsed ? "true" : "false", className: "border-l-4 ".concat((_b = BAND_CLASS[colourKey]) !== null && _b !== void 0 ? _b : BAND_CLASS.none) },
1305
+ react_2.default.createElement("td", { colSpan: columnCount, className: "px-3 py-2" },
1306
+ react_2.default.createElement("button", { type: "button", className: "flex w-full items-center gap-x-2 text-left text-xs font-semibold uppercase tracking-wide", onClick: function (e) {
1307
+ e.stopPropagation();
1308
+ setCollapsedGroupIds(function (previous) {
1309
+ return previous.includes(group.id)
1310
+ ? previous.filter(function (eachId) { return eachId !== group.id; })
1311
+ : __spreadArray(__spreadArray([], previous, true), [group.id], false);
1312
+ });
1313
+ } },
1314
+ isCollapsed ? (react_2.default.createElement(solid_1.ChevronRightIcon, { className: "h-4 w-4" })) : (react_2.default.createElement(solid_1.ChevronDownIcon, { className: "h-4 w-4" })),
1315
+ react_2.default.createElement("span", null, group.title),
1316
+ react_2.default.createElement("span", { className: "rounded-full bg-white/70 px-2 py-0.5 text-[11px] font-medium normal-case tracking-normal" }, memberIndexes.length)))),
1317
+ !isCollapsed &&
1318
+ memberIndexes.map(function (rowIndex) {
1319
+ return renderDesktopRow(props.data[rowIndex], rowIndex, colourKey);
1320
+ })));
1321
+ });
1322
+ };
948
1323
  var renderFloatingActionBar = function () {
949
1324
  var _a, _b, _c, _d, _e;
950
- if (!((_a = props.multiActionFloatingBtns) === null || _a === void 0 ? void 0 : _a.length))
951
- return null;
952
- var visibleBtns = props.multiActionFloatingBtns.filter(function (btn) { return !btn.hide; });
953
- if (visibleBtns.length === 0)
1325
+ var visibleBtns = ((_a = props.multiActionFloatingBtns) !== null && _a !== void 0 ? _a : []).filter(function (btn) { return !btn.hide; });
1326
+ var canCopy = props.enableCopy !== false;
1327
+ if (visibleBtns.length === 0 && !canCopy)
954
1328
  return null;
955
1329
  var hasSelection = props.selectAll || ((_c = (_b = props.selectedIds) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0) > 0;
956
1330
  if (!hasSelection)
@@ -969,11 +1343,12 @@ var NewTable = function (props) {
969
1343
  var renderCloseBtn = function () { return (react_2.default.createElement(iconButton_1.IconButton, { icon: react_2.default.createElement(solid_1.XMarkIcon, { className: "w-4 h-4" }), className: "!p-1 shrink-0 ".concat(props.darkMode
970
1344
  ? "hover:bg-gray-700 text-gray-400 hover:text-gray-200"
971
1345
  : "hover:bg-gray-100 text-gray-400 hover:text-gray-600"), onClick: function () { return handleSelectAllPages(false); } })); };
972
- var renderActionBtns = function () {
973
- return props
974
- .multiActionFloatingBtns.filter(function (btn) { return !btn.hide; })
975
- .map(function (btn) { return (react_2.default.createElement(textButton_1.TextButton, { key: btn.id, text: btn.btnText, className: "px-2 py-1 text-xs sm:text-sm whitespace-nowrap ".concat(props.darkMode ? "!text-gray-300 hover:!text-primary-300" : "!text-gray-600 hover:!text-primary-600"), onClick: function () { return btn.onClick(btn.id); } })); });
976
- };
1346
+ var actionBtnClassName = "px-2 py-1 text-xs sm:text-sm whitespace-nowrap ".concat(props.darkMode ? "!text-gray-300 hover:!text-primary-300" : "!text-gray-600 hover:!text-primary-600");
1347
+ var renderActionBtns = function () { return (react_2.default.createElement(react_2.default.Fragment, null,
1348
+ visibleBtns.map(function (btn) { return (react_2.default.createElement(textButton_1.TextButton, { key: btn.id, text: btn.btnText, className: actionBtnClassName, onClick: function () { return btn.onClick(btn.id); } })); }),
1349
+ canCopy && (react_2.default.createElement(textButton_1.TextButton, { key: "copy", id: "dtw-copy-selection", text: copiedCount > 0 ? "Copied ".concat(copiedCount) : "Copy", className: actionBtnClassName, onClick: function () {
1350
+ handleCopySelection();
1351
+ } })))); };
977
1352
  var pillBase = "shadow-xl ".concat(borderRadius, " ").concat(bgColor, " border-2 ").concat(props.darkMode ? "border-primary-300" : "border-primary-500");
978
1353
  return (react_2.default.createElement("div", { className: "fixed ".concat(props.multiActionFloatingOffset || "bottom-10", " inset-x-4 z-10 flex justify-center pointer-events-none") },
979
1354
  react_2.default.createElement("div", { className: "sm:hidden flex flex-col w-full px-4 py-2.5 pointer-events-auto ".concat(pillBase) },
@@ -1169,7 +1544,7 @@ var NewTable = function (props) {
1169
1544
  var isIdLike_1 = function (c) {
1170
1545
  return /^id$/i.test(c.key) || /^_id$/i.test(c.key);
1171
1546
  };
1172
- var titleCol_1 = (_j = flatColumns.find(function (c) { return !isIdLike_1(c); })) !== null && _j !== void 0 ? _j : flatColumns[0];
1547
+ var titleCol_1 = (_k = flatColumns.find(function (c) { return !isIdLike_1(c); })) !== null && _k !== void 0 ? _k : flatColumns[0];
1173
1548
  var expandHeaderBg_1 = props.darkMode ? "bg-gray-700" : "bg-gray-100";
1174
1549
  var expandHeaderFontColor_1 = props.darkMode ? "text-white" : "";
1175
1550
  var headerBgColor_1 = props.darkMode ? "bg-gray-900" : "";
@@ -1241,14 +1616,14 @@ var NewTable = function (props) {
1241
1616
  })))));
1242
1617
  };
1243
1618
  return (react_2.default.createElement("div", null,
1244
- react_2.default.createElement("div", { className: "w-full ".concat(((_k = props.mobileTooltip) === null || _k === void 0 ? void 0 : _k.tooltip) ? "overflow-visible" : "overflow-hidden", " border ").concat(borderRadius, " ").concat(borderColor, " ").concat(bgColor, " shadow-sm divide-y ").concat(dividerColor, " ").concat((_l = props.className) !== null && _l !== void 0 ? _l : "") },
1619
+ react_2.default.createElement("div", { className: "w-full ".concat(((_l = props.mobileTooltip) === null || _l === void 0 ? void 0 : _l.tooltip) ? "overflow-visible" : "overflow-hidden", " border ").concat(borderRadius, " ").concat(borderColor, " ").concat(bgColor, " shadow-sm divide-y ").concat(dividerColor, " ").concat((_m = props.className) !== null && _m !== void 0 ? _m : "") },
1245
1620
  react_2.default.createElement("div", { className: "p-3 flex justify-between" },
1246
1621
  renderSelectAll(),
1247
1622
  renderSelectedCount()),
1248
1623
  props.loading &&
1249
1624
  Array.from({ length: 3 }).map(function (_, i) { return (react_2.default.createElement("div", { key: "skeleton-".concat(i), className: "p-4" },
1250
1625
  react_2.default.createElement("div", { className: "h-5 w-3/4 rounded-md animate-pulse ".concat(props.darkMode ? "bg-gray-700" : "bg-gray-200") }))); }),
1251
- !props.loading && props.data.length === 0 && (react_2.default.createElement("p", { className: "p-4 text-center text-sm ".concat(cellFontColor) }, (_m = props.emptyTitle) !== null && _m !== void 0 ? _m : "No items")),
1626
+ !props.loading && props.data.length === 0 && (react_2.default.createElement("p", { className: "p-4 text-center text-sm ".concat(cellFontColor) }, (_o = props.emptyTitle) !== null && _o !== void 0 ? _o : "No items")),
1252
1627
  !props.loading &&
1253
1628
  props.data.map(function (row, index) {
1254
1629
  var _a, _b, _c, _d, _e, _f, _g;
@@ -1303,13 +1678,48 @@ var NewTable = function (props) {
1303
1678
  renderPagination())),
1304
1679
  renderFloatingActionBar()));
1305
1680
  }
1306
- return (react_2.default.createElement("div", { className: "w-full ".concat((_o = props.className) !== null && _o !== void 0 ? _o : "") },
1681
+ return (react_2.default.createElement("div", { className: "w-full ".concat((_p = props.className) !== null && _p !== void 0 ? _p : "") },
1307
1682
  react_2.default.createElement(modal_1.Modal, { open: filterModal ? true : false, title: "Filter Options", renderContent: function () {
1308
1683
  var _a, _b;
1309
1684
  return (react_2.default.createElement("div", { className: "pb-44" },
1310
1685
  react_2.default.createElement("div", { className: "pb-48" }, (_b = (_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.renderFilterElements) === null || _b === void 0 ? void 0 : _b.call(_a, filterModal))));
1311
1686
  }, onClose: function () { return setFilterModal(""); } }),
1312
- react_2.default.createElement(modal_1.Modal, { open: modalEditVisible, title: (_q = (_p = flatColumns.find(function (eachCol) { return eachCol.key === editDataHeaderKey; })) === null || _p === void 0 ? void 0 : _p.title) !== null && _q !== void 0 ? _q : "Edit", onClose: handleModalEditClose, renderContent: function () {
1687
+ paletteCell &&
1688
+ (function () {
1689
+ var _a;
1690
+ var column = flatColumns.find(function (eachCol) { return eachCol.key === paletteCell.key; });
1691
+ var row = props.data.find(function (eachRow) { return eachRow.id === paletteCell.rowId; });
1692
+ if (!column || !row)
1693
+ return null;
1694
+ var current = resolveValue(row, column.key);
1695
+ return (react_2.default.createElement("div", { "data-testid": "table-fill-palette", role: "listbox", className: "fixed z-50 grid grid-cols-2 gap-1.5 rounded-lg border border-gray-200 bg-white p-2 shadow-xl", style: {
1696
+ top: paletteCell.top,
1697
+ left: paletteCell.left,
1698
+ minWidth: Math.max(paletteCell.width, 200),
1699
+ }, onMouseDown: function (e) { return e.stopPropagation(); } }, ((_a = column.listSelection) !== null && _a !== void 0 ? _a : []).map(function (option, index) {
1700
+ var _a, _b;
1701
+ var colour = (_a = column.listSelectionColour) === null || _a === void 0 ? void 0 : _a[index];
1702
+ var fillClass = colour
1703
+ ? ((_b = FILL_CLASS[colour]) !== null && _b !== void 0 ? _b : FILL_CLASS.default)
1704
+ : "bg-gray-100 text-gray-700";
1705
+ return (react_2.default.createElement("button", { key: option, type: "button", role: "option", "aria-selected": option === current, "data-testid": "table-fill-option-".concat(option), className: "rounded-md px-3 py-2 text-center text-sm font-medium ".concat(fillClass, " hover:brightness-95 ").concat(option === current
1706
+ ? "ring-2 ring-primary-500 ring-offset-1"
1707
+ : ""), onClick: function () { return __awaiter(void 0, void 0, void 0, function () {
1708
+ var _a;
1709
+ return __generator(this, function (_b) {
1710
+ switch (_b.label) {
1711
+ case 0:
1712
+ setPaletteCell(null);
1713
+ return [4 /*yield*/, handleEditDataOnBlur(column.key, __assign(__assign({}, row), (_a = {}, _a[column.key] = option, _a)))];
1714
+ case 1:
1715
+ _b.sent();
1716
+ return [2 /*return*/];
1717
+ }
1718
+ });
1719
+ }); } }, option));
1720
+ })));
1721
+ })(),
1722
+ react_2.default.createElement(modal_1.Modal, { open: modalEditVisible, title: (_r = (_q = flatColumns.find(function (eachCol) { return eachCol.key === editDataHeaderKey; })) === null || _q === void 0 ? void 0 : _q.title) !== null && _r !== void 0 ? _r : "Edit", onClose: handleModalEditClose, renderContent: function () {
1313
1723
  var _a, _b, _c, _d;
1314
1724
  var selectedCol = flatColumns.find(function (eachCol) { return eachCol.key === editDataHeaderKey; });
1315
1725
  if (!selectedCol)
@@ -1330,7 +1740,7 @@ var NewTable = function (props) {
1330
1740
  }, {
1331
1741
  dbModule: axios_1.default,
1332
1742
  devSettings: props.devSettings,
1333
- referencesOptions: referencesOptions,
1743
+ referencesOptions: mergedReferencesOptions,
1334
1744
  referencesDetails: referencesDetails,
1335
1745
  referenceLoading: referenceLoading,
1336
1746
  setReferenceLoading: setReferenceLoading,
@@ -1349,14 +1759,14 @@ var NewTable = function (props) {
1349
1759
  var _a, _b;
1350
1760
  return (react_2.default.createElement("div", null, (_b = (_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.renderAddColumnElements) === null || _b === void 0 ? void 0 : _b.call(_a, addColumnModal, function (id) { return handleAddColumnModal(id); })));
1351
1761
  }, onClose: function () { return handleAddColumnModal(""); } }),
1352
- react_2.default.createElement("div", { className: "w-full overflow-x-auto ".concat(borderRadius, " border ").concat(borderColor, " ").concat(bgColor, " shadow-sm") },
1353
- (props.selectAll || ((_s = (_r = props.selectedIds) === null || _r === void 0 ? void 0 : _r.length) !== null && _s !== void 0 ? _s : 0) > 0) &&
1762
+ react_2.default.createElement(scrollShadow_1.ScrollShadow, { className: "w-full overflow-x-auto ".concat(borderRadius, " border ").concat(borderColor, " ").concat(bgColor, " shadow-sm"), shadowFrom: props.darkMode ? "from-gray-900" : "from-white" },
1763
+ (props.selectAll || ((_t = (_s = props.selectedIds) === null || _s === void 0 ? void 0 : _s.length) !== null && _t !== void 0 ? _t : 0) > 0) &&
1354
1764
  (!props.multiActionFloatingBtns ||
1355
1765
  (props.multiActionFloatingBtns &&
1356
1766
  props.multiActionFloatingBtns.length <= 0)) && (react_2.default.createElement("div", { className: "sticky left-0 flex flex-row items-center px-4 py-3 gap-x-2" },
1357
1767
  renderSelectedCount(),
1358
1768
  props.multiActionButton)),
1359
- react_2.default.createElement("table", { className: "w-full", ref: tableRef },
1769
+ react_2.default.createElement("table", { className: "w-full ".concat(isDragSelecting ? "select-none" : ""), ref: tableRef },
1360
1770
  renderTableHeader(),
1361
1771
  react_2.default.createElement("tbody", { className: "divide-y ".concat(dividerColor) },
1362
1772
  props.loading &&
@@ -1364,95 +1774,9 @@ var NewTable = function (props) {
1364
1774
  props.checkbox && react_2.default.createElement("td", { className: "w-10 ".concat(cellPadding) }),
1365
1775
  flatColumns.map(function (col) { return (react_2.default.createElement("td", { key: col.key, className: cellPadding },
1366
1776
  react_2.default.createElement("div", { className: "h-5 rounded-md animate-pulse ".concat(props.darkMode ? "bg-gray-700" : "bg-gray-200") }))); }))); }),
1367
- !props.loading &&
1368
- props.data.map(function (row, index) {
1369
- var _a, _b, _c, _d;
1370
- var spaceRow = (_a = props.spaceData) === null || _a === void 0 ? void 0 : _a[index];
1371
- var isSelected = ((_c = (_b = props.selectedIds) === null || _b === void 0 ? void 0 : _b.includes(row.id)) !== null && _c !== void 0 ? _c : false) ||
1372
- ((_d = props.selectAll) !== null && _d !== void 0 ? _d : false);
1373
- var rowBgClass = isSelected ? selectedRowBg : bgColor;
1374
- var isRowHoverable = !!props.onClickRow && !isSelected;
1375
- return (react_2.default.createElement("tr", { key: row.id, onClick: function (e) {
1376
- if (props.onClickRow) {
1377
- props.onClickRow(row.id, row, spaceRow);
1378
- }
1379
- e.preventDefault();
1380
- }, className: "group ".concat(isSelected
1381
- ? selectedRowBg
1382
- : props.onClickRow
1383
- ? "cursor-pointer ".concat(rowHoverBg)
1384
- : editDataIsLoading && editDataRowId === row.id
1385
- ? "animate-pulse"
1386
- : "") },
1387
- props.checkbox && (react_2.default.createElement("td", { className: "w-10 ".concat(cellPadding, " ").concat(hasPinColumns ? "".concat(rowBgClass, " ").concat(isRowHoverable ? (props.darkMode ? "group-hover:bg-gray-700" : "group-hover:bg-gray-100") : "") : ""), style: hasPinColumns
1388
- ? {
1389
- position: "sticky",
1390
- left: 0,
1391
- zIndex: 1,
1392
- width: CHECKBOX_WIDTH,
1393
- minWidth: CHECKBOX_WIDTH,
1394
- }
1395
- : undefined, onClick: function (e) { return handleSelectRow(row.id, e); } }, renderCheckbox(isSelected, function () { }, undefined, isMaxReached && !isSelected
1396
- ? "opacity-50 cursor-not-allowed"
1397
- : ""))),
1398
- flatColumns.map(function (col, colIndex) {
1399
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
1400
- var cellValue = spaceRow
1401
- ? spaceRow[col.key]
1402
- : resolveValue(row, col.key);
1403
- // INFO: first col with type "string" is never made editable
1404
- var resolvedColType = (_a = col.type) !== null && _a !== void 0 ? _a : "string";
1405
- var isActionColumn = col.key === "update" && !col.type;
1406
- var isModalEdit = ((_b = props.editable) === null || _b === void 0 ? void 0 : _b.active) &&
1407
- !isActionColumn &&
1408
- utils_1.supportedModalEditList.includes(resolvedColType);
1409
- var isObjectEdit = ((_c = props.editable) === null || _c === void 0 ? void 0 : _c.active) &&
1410
- !isActionColumn &&
1411
- resolvedColType === "object" &&
1412
- !!props.onObjectEdit;
1413
- var isEditable = ((_d = props.editable) === null || _d === void 0 ? void 0 : _d.active) &&
1414
- !isActionColumn &&
1415
- !(((_f = (_e = props.selectedIds) === null || _e === void 0 ? void 0 : _e.length) !== null && _f !== void 0 ? _f : 0) > 0 ||
1416
- props.selectAll) &&
1417
- utils_1.supportedInlineEditList.includes(resolvedColType);
1418
- var rowData = editDataRowId === row.id ? editDataValue : row;
1419
- if (isObjectEdit) {
1420
- return (react_2.default.createElement("td", { key: col.key, className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " whitespace-nowrap") },
1421
- react_2.default.createElement("div", { className: "cursor-pointer group/modaledit flex items-center gap-x-2 min-h-6", "data-testid": "table-object-edit-".concat(col.key), onClick: function (e) {
1422
- var _a;
1423
- e.stopPropagation();
1424
- (_a = props.onObjectEdit) === null || _a === void 0 ? void 0 : _a.call(props, row.id, col.key, row);
1425
- } },
1426
- handleCheckModalEditEmpty(cellValue) ? (react_2.default.createElement("span", { className: "text-gray-400 italic" }, "Add")) : ((0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord)),
1427
- 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" }))));
1428
- }
1429
- if (isModalEdit) {
1430
- return (react_2.default.createElement("td", { key: col.key, className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " whitespace-nowrap") },
1431
- react_2.default.createElement("div", { className: "cursor-pointer group/modaledit flex items-center gap-x-2 min-h-6", "data-testid": "table-modal-edit-".concat(col.key), onClick: function (e) {
1432
- e.stopPropagation();
1433
- handleModalEditOnClick(row.id, col.key, row);
1434
- } },
1435
- handleCheckModalEditEmpty(cellValue) ? (react_2.default.createElement("span", { className: "text-gray-400 italic" }, "Add")) : ((0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord)),
1436
- 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" }))));
1437
- }
1438
- if (isEditable) {
1439
- var bareOverride = (_h = (_g = props.bareSettings) === null || _g === void 0 ? void 0 : _g.bareListDescription) === null || _h === void 0 ? void 0 : _h.call(_g, col.key, cellValue);
1440
- if (!bareOverride)
1441
- return renderEditDataInputs(colIndex, col, rowData, row.id, rowBgClass, isRowHoverable);
1442
- }
1443
- return (
1444
- // INFO: pinned columns use whitespace-normal so text wraps within the fixed width
1445
- react_2.default.createElement("td", { key: col.key, "data-pin-key": leftPinned.includes(col.key) ||
1446
- rightPinned.includes(col.key)
1447
- ? col.key
1448
- : undefined, className: "".concat(cellPadding, " text-sm ").concat(colIndex === 0 && props.onClickRow ? titleFontColor : cellFontColor, " ").concat(col.width ? "".concat(col.width, " flex-shrink-0") : getPinProps(col.key, false) ? "" : "whitespace-nowrap", " ").concat((_k = (_j = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _j === void 0 ? void 0 : _j.className) !== null && _k !== void 0 ? _k : ""), style: (_l = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _l === void 0 ? void 0 : _l.style }, props.newTabUrl && props.onClickRow ? (react_2.default.createElement(link_1.Link, { href: props.newTabUrl +
1449
- row.id +
1450
- ((_m = props.addNewTabUrl) !== null && _m !== void 0 ? _m : ""), className: "w-full block", linkType: props.linkType, custom: props.custom }, (0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord))) : ((0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord))));
1451
- }),
1452
- renderActionColumnCell(row.id)));
1453
- }),
1777
+ !props.loading && renderDesktopRows(),
1454
1778
  !props.loading && addData && renderAddDataRow())),
1455
- !props.loading && props.data.length === 0 && (react_2.default.createElement("div", { className: "p-4 text-sm ".concat(cellFontColor, " text-center sticky left-0") }, (_t = props.emptyTitle) !== null && _t !== void 0 ? _t : "No items")),
1779
+ !props.loading && props.data.length === 0 && (react_2.default.createElement("div", { className: "p-4 text-sm ".concat(cellFontColor, " text-center sticky left-0") }, (_u = props.emptyTitle) !== null && _u !== void 0 ? _u : "No items")),
1456
1780
  renderAddableSection()),
1457
1781
  !props.hidePagination && props.paginationType && (react_2.default.createElement("div", { className: "mt-2 flex items-center justify-between ".concat(props.fixedPagination
1458
1782
  ? "pagination-container w-full ".concat(borderColor, " ").concat(isFixed ? "fixed bottom-0 left-0 z-10" : "sticky top-0 left-0")