blixify-ui-web 1.2.249 → 1.2.251
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.
- package/lib/components/data/columnTypes/index.d.ts +1 -0
- package/lib/components/data/columnTypes/index.d.ts.map +1 -1
- package/lib/components/data/columnTypes/index.js +1 -0
- package/lib/components/data/columnTypes/index.js.map +1 -1
- package/lib/components/data/columnTypes/lookup.d.ts +29 -0
- package/lib/components/data/columnTypes/lookup.d.ts.map +1 -0
- package/lib/components/data/columnTypes/lookup.js +80 -0
- package/lib/components/data/columnTypes/lookup.js.map +1 -0
- package/lib/components/data/dataTemplate/index.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/index.js +78 -21
- package/lib/components/data/dataTemplate/index.js.map +1 -1
- package/lib/components/data/dataTemplate/model.d.ts +8 -2
- package/lib/components/data/dataTemplate/model.d.ts.map +1 -1
- package/lib/components/display/newList/compactRow.d.ts +30 -0
- package/lib/components/display/newList/compactRow.d.ts.map +1 -0
- package/lib/components/display/newList/compactRow.js +81 -0
- package/lib/components/display/newList/compactRow.js.map +1 -0
- package/lib/components/display/newList/index.d.ts +6 -0
- package/lib/components/display/newList/index.d.ts.map +1 -1
- package/lib/components/display/newList/index.js +32 -3
- package/lib/components/display/newList/index.js.map +1 -1
- package/lib/components/display/newList/listRowFields.d.ts +24 -0
- package/lib/components/display/newList/listRowFields.d.ts.map +1 -0
- package/lib/components/display/newList/listRowFields.js +86 -0
- package/lib/components/display/newList/listRowFields.js.map +1 -0
- package/lib/components/display/newTable/index.d.ts +4 -2
- package/lib/components/display/newTable/index.d.ts.map +1 -1
- package/lib/components/display/newTable/index.js +714 -295
- package/lib/components/display/newTable/index.js.map +1 -1
- package/lib/components/display/newTable/rowRendering.d.ts +66 -0
- package/lib/components/display/newTable/rowRendering.d.ts.map +1 -0
- package/lib/components/display/newTable/rowRendering.js +219 -0
- package/lib/components/display/newTable/rowRendering.js.map +1 -0
- package/lib/components/display/recordActions/index.d.ts +2 -0
- package/lib/components/display/recordActions/index.d.ts.map +1 -1
- package/lib/components/display/recordActions/index.js +8 -2
- package/lib/components/display/recordActions/index.js.map +1 -1
- package/lib/tail.css +2 -2
- 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");
|
|
@@ -130,6 +132,7 @@ var tag_1 = require("../tag");
|
|
|
130
132
|
var defaultColours_1 = require("../../data/columnTypes/defaultColours");
|
|
131
133
|
var personAvatar_1 = require("../../data/columnTypes/personAvatar");
|
|
132
134
|
var utils_2 = require("../../input/utils");
|
|
135
|
+
var rowRendering_1 = require("./rowRendering");
|
|
133
136
|
// INFO: rows a section draws before its "Show more" — a 2,000-row section
|
|
134
137
|
// would otherwise mount every row (and every cell's controls) at once
|
|
135
138
|
exports.NEW_TABLE_GROUP_ROW_BATCH = 50;
|
|
@@ -239,6 +242,7 @@ var ALL_COLUMN_TYPES = [
|
|
|
239
242
|
{ key: "dateRange", label: "Timeline" },
|
|
240
243
|
{ key: "timeTracking", label: "Time tracking" },
|
|
241
244
|
{ key: "button", label: "Button" },
|
|
245
|
+
{ key: "lookup", label: "Lookup" },
|
|
242
246
|
];
|
|
243
247
|
// INFO: never drawn as a table cell, so a column of these added from the
|
|
244
248
|
// table would be invisible the moment it was made; one that exists can still
|
|
@@ -254,9 +258,11 @@ var LIST_TYPES = ["list", "multipleList"];
|
|
|
254
258
|
// INFO: DataTemplate checks a new row against the first unique column only,
|
|
255
259
|
// and only a typed value can be compared, so Unique is offered for these
|
|
256
260
|
var UNIQUE_TYPES = ["string", "email", "contact", "number"];
|
|
257
|
-
// INFO: a formula is computed
|
|
258
|
-
//
|
|
259
|
-
var UNLOCKABLE_TYPES = ["formula", "button"];
|
|
261
|
+
// INFO: a formula is computed, a button stores nothing and a lookup is always
|
|
262
|
+
// read-only — the host's server fills it in — so none has a value to lock
|
|
263
|
+
var UNLOCKABLE_TYPES = ["formula", "button", "lookup"];
|
|
264
|
+
// INFO: no value is typed into these, so there is nothing to require
|
|
265
|
+
var UNREQUIRABLE_TYPES = ["formula", "lookup"];
|
|
260
266
|
// INFO: asset columns need a storage path, which the consumer fills in from its
|
|
261
267
|
// own settings — nothing for the user to type
|
|
262
268
|
var ASSET_TYPES = ["image", "file", "multipleImage", "multipleFile"];
|
|
@@ -365,9 +371,31 @@ var BAND_CLASS = groupSection_1.GROUP_BAND_CLASS;
|
|
|
365
371
|
// padding, so the room for the title's actions is an !important class too —
|
|
366
372
|
// without it a squeezed title (a pinned column on a phone) runs under them
|
|
367
373
|
var TITLE_ACTIONS_PADDING_CLASS = {
|
|
374
|
+
8: "!pr-[8px]",
|
|
368
375
|
48: "!pr-[48px]",
|
|
369
|
-
|
|
376
|
+
52: "!pr-[52px]",
|
|
377
|
+
92: "!pr-[92px]",
|
|
378
|
+
96: "!pr-[96px]",
|
|
379
|
+
136: "!pr-[136px]",
|
|
370
380
|
};
|
|
381
|
+
// INFO: wherever the chevron shows — a hovered row, a focused chevron, or
|
|
382
|
+
// always on a touch screen, which cannot hover — the title and its inline
|
|
383
|
+
// editor make room for it instead of running under it
|
|
384
|
+
var TITLE_CHEVRON_PADDING_CLASS = {
|
|
385
|
+
48: "group-hover:!pr-[48px] focus-within:!pr-[48px] [@media(hover:none)]:!pr-[48px]",
|
|
386
|
+
92: "group-hover:!pr-[92px] focus-within:!pr-[92px] [@media(hover:none)]:!pr-[92px]",
|
|
387
|
+
136: "group-hover:!pr-[136px] focus-within:!pr-[136px] [@media(hover:none)]:!pr-[136px]",
|
|
388
|
+
};
|
|
389
|
+
// INFO: the chevron's width plus its gap from the strips
|
|
390
|
+
var CHEVRON_ROOM = 40;
|
|
391
|
+
// INFO: the title text a narrowed title column always keeps beside its actions
|
|
392
|
+
var MIN_TITLE_TEXT_WIDTH = 48;
|
|
393
|
+
// INFO: the cell padding's left side (!px-6)
|
|
394
|
+
var TITLE_LEFT_PADDING = 24;
|
|
395
|
+
// INFO: the pencil and the comment bubble each sit in their own full-height
|
|
396
|
+
// strip at the title cell's right edge, split by dividers like columns of
|
|
397
|
+
// their own — pencil, then bubble at the edge
|
|
398
|
+
var ACTION_STRIP_WIDTH = 44;
|
|
371
399
|
var ACCENT_CLASS = {
|
|
372
400
|
default: "border-primary-500",
|
|
373
401
|
primary: "border-primary-500",
|
|
@@ -402,8 +430,25 @@ var handleGetListColour = function (col, value) {
|
|
|
402
430
|
return undefined;
|
|
403
431
|
return column.listSelectionColour[index] || undefined;
|
|
404
432
|
};
|
|
405
|
-
var NewTable = function (
|
|
433
|
+
var NewTable = function (rawProps) {
|
|
406
434
|
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;
|
|
435
|
+
// INFO: props are read through the latest render. A row that was not drawn
|
|
436
|
+
// again keeps the handlers of the render that drew it, and those read
|
|
437
|
+
// props.onClickRow, props.data and the rest at the time they run — so a
|
|
438
|
+
// skipped row never calls an old callback or reads an old list
|
|
439
|
+
var latestPropsRef = (0, react_2.useRef)(rawProps);
|
|
440
|
+
latestPropsRef.current = rawProps;
|
|
441
|
+
var props = (0, react_2.useMemo)(function () {
|
|
442
|
+
return new Proxy({}, {
|
|
443
|
+
get: function (_target, key) { return latestPropsRef.current[key]; },
|
|
444
|
+
has: function (_target, key) { return key in latestPropsRef.current; },
|
|
445
|
+
ownKeys: function () { return Reflect.ownKeys(latestPropsRef.current); },
|
|
446
|
+
getOwnPropertyDescriptor: function (_target, key) {
|
|
447
|
+
var descriptor = Reflect.getOwnPropertyDescriptor(latestPropsRef.current, key);
|
|
448
|
+
return descriptor ? __assign(__assign({}, descriptor), { configurable: true }) : undefined;
|
|
449
|
+
},
|
|
450
|
+
});
|
|
451
|
+
}, []);
|
|
407
452
|
var columns = (_b = (_a = props.columns) !== null && _a !== void 0 ? _a : props.header) !== null && _b !== void 0 ? _b : [];
|
|
408
453
|
var defaultLimit = 10;
|
|
409
454
|
// INFO: flatten groupData columns so both mobile and desktop share the same
|
|
@@ -453,7 +498,7 @@ var NewTable = function (props) {
|
|
|
453
498
|
groupData.forEach(function (sub) { return groupedKeys.add("".concat(col.key, ".").concat(sub.key)); });
|
|
454
499
|
}
|
|
455
500
|
});
|
|
456
|
-
var activityPin = (props.onRowActivity || props.onRowEdit) &&
|
|
501
|
+
var activityPin = (props.onRowActivity || props.onRowEdit || props.onRowOpen) &&
|
|
457
502
|
!((_d = (_c = props.pinColumns) === null || _c === void 0 ? void 0 : _c.left) === null || _d === void 0 ? void 0 : _d.length) &&
|
|
458
503
|
flatColumns[0] &&
|
|
459
504
|
!((_f = (_e = props.pinColumns) === null || _e === void 0 ? void 0 : _e.right) === null || _f === void 0 ? void 0 : _f.includes(flatColumns[0].key))
|
|
@@ -475,15 +520,21 @@ var NewTable = function (props) {
|
|
|
475
520
|
flatColumns.push.apply(flatColumns, __spreadArray(__spreadArray(__spreadArray([], leftCols, false), middleCols, false), rightCols, false));
|
|
476
521
|
}
|
|
477
522
|
var _6 = (0, react_2.useState)(props.fixedPagination ? true : false), isFixed = _6[0], setIsFixed = _6[1];
|
|
478
|
-
// INFO: the
|
|
479
|
-
//
|
|
480
|
-
// they never cover the title, and added to the cell's measured
|
|
481
|
-
// title keeps its own width instead of wrapping
|
|
482
|
-
|
|
523
|
+
// INFO: the actions sit over the title cell's right padding: the pencil and
|
|
524
|
+
// the bubble in divided strips at the edge, then 8px from the text — kept
|
|
525
|
+
// clear so they never cover the title, and added to the cell's measured
|
|
526
|
+
// width so the title keeps its own width instead of wrapping. The chevron
|
|
527
|
+
// shows only on a hovered row (always on a touch screen); the padding grows
|
|
528
|
+
// to take it then, so it never covers the title or its inline editor, and
|
|
529
|
+
// the column is sized and floored for that wider padding.
|
|
530
|
+
var hasRowActions = !!props.onRowEdit || !!props.onRowOpen || !!props.onRowActivity;
|
|
483
531
|
var canDragRows = !!props.onMoveRowToGroup && !!((_l = props.groups) === null || _l === void 0 ? void 0 : _l.length);
|
|
532
|
+
var activityStripWidth = props.onRowActivity ? ACTION_STRIP_WIDTH : 0;
|
|
533
|
+
var editStripWidth = props.onRowEdit ? ACTION_STRIP_WIDTH : 0;
|
|
484
534
|
var titleActionsWidth = hasRowActions
|
|
485
|
-
?
|
|
535
|
+
? activityStripWidth + editStripWidth + 8
|
|
486
536
|
: 0;
|
|
537
|
+
var titleChevronActionsWidth = titleActionsWidth + (props.onRowOpen ? CHEVRON_ROOM : 0);
|
|
487
538
|
//=====================================================================================
|
|
488
539
|
// SECTION: Advanced Settings
|
|
489
540
|
//=====================================================================================
|
|
@@ -495,43 +546,46 @@ var NewTable = function (props) {
|
|
|
495
546
|
var _10 = (0, react_2.useState)("string"), newColumnType = _10[0], setNewColumnType = _10[1];
|
|
496
547
|
var _11 = (0, react_2.useState)(""), newColumnRefSpace = _11[0], setNewColumnRefSpace = _11[1];
|
|
497
548
|
var _12 = (0, react_2.useState)(""), newColumnRefLabel = _12[0], setNewColumnRefLabel = _12[1];
|
|
498
|
-
var _13 = (0, react_2.useState)(
|
|
549
|
+
var _13 = (0, react_2.useState)(""), newColumnLookupReference = _13[0], setNewColumnLookupReference = _13[1];
|
|
550
|
+
var _14 = (0, react_2.useState)(""), newColumnLookupField = _14[0], setNewColumnLookupField = _14[1];
|
|
551
|
+
var _15 = (0, react_2.useState)([]), newColumnOptions = _15[0], setNewColumnOptions = _15[1];
|
|
499
552
|
// INFO: the option row whose colour palette is open
|
|
500
|
-
var
|
|
501
|
-
var
|
|
502
|
-
var
|
|
503
|
-
var
|
|
504
|
-
var
|
|
505
|
-
var
|
|
506
|
-
var
|
|
507
|
-
var
|
|
508
|
-
var
|
|
553
|
+
var _16 = (0, react_2.useState)(null), optionColourKey = _16[0], setOptionColourKey = _16[1];
|
|
554
|
+
var _17 = (0, react_2.useState)(false), newColumnRequired = _17[0], setNewColumnRequired = _17[1];
|
|
555
|
+
var _18 = (0, react_2.useState)(false), newColumnUnique = _18[0], setNewColumnUnique = _18[1];
|
|
556
|
+
var _19 = (0, react_2.useState)(false), newColumnReadOnly = _19[0], setNewColumnReadOnly = _19[1];
|
|
557
|
+
var _20 = (0, react_2.useState)(""), newColumnRatingMax = _20[0], setNewColumnRatingMax = _20[1];
|
|
558
|
+
var _21 = (0, react_2.useState)(""), newColumnButtonLabel = _21[0], setNewColumnButtonLabel = _21[1];
|
|
559
|
+
var _22 = (0, react_2.useState)(""), newColumnButtonColour = _22[0], setNewColumnButtonColour = _22[1];
|
|
560
|
+
var _23 = (0, react_2.useState)(""), newColumnButtonConfirm = _23[0], setNewColumnButtonConfirm = _23[1];
|
|
561
|
+
var _24 = (0, react_2.useState)(false), addingColumn = _24[0], setAddingColumn = _24[1];
|
|
509
562
|
// INFO: the formula as shown in the builder — column names, not ids
|
|
510
|
-
var
|
|
563
|
+
var _25 = (0, react_2.useState)(""), newColumnFormula = _25[0], setNewColumnFormula = _25[1];
|
|
511
564
|
var addColumnPopUpRef = (0, react_2.useRef)(null);
|
|
512
565
|
// INFO: the column being changed — empty while the panel adds a new one
|
|
513
|
-
var
|
|
566
|
+
var _26 = (0, react_2.useState)(null), editingColumn = _26[0], setEditingColumn = _26[1];
|
|
514
567
|
//=====================================================================================
|
|
515
568
|
// SECTION: Editable & Addable cells
|
|
516
569
|
//=====================================================================================
|
|
517
|
-
var
|
|
518
|
-
var
|
|
570
|
+
var _27 = (0, react_2.useState)(""), editDataRowId = _27[0], setEditDataRowId = _27[1];
|
|
571
|
+
var _28 = (0, react_2.useState)(""), editDataHeaderKey = _28[0], setEditDataHeaderKey = _28[1];
|
|
519
572
|
// INFO: an editable table used to mount an input in every cell — it read as a
|
|
520
573
|
// form, and a row click always landed on a child input. Only the hovered cell
|
|
521
|
-
// becomes its input now.
|
|
522
|
-
var
|
|
523
|
-
var _28 = (0, react_2.useState)(false), modalEditVisible = _28[0], setModalEditVisible = _28[1];
|
|
574
|
+
// becomes its input now; NewTableHoverCell keeps that hover to itself.
|
|
575
|
+
var _29 = (0, react_2.useState)(false), modalEditVisible = _29[0], setModalEditVisible = _29[1];
|
|
524
576
|
// INFO: whether the modal's signature pad has been drawn on
|
|
525
|
-
var
|
|
526
|
-
var
|
|
577
|
+
var _30 = (0, react_2.useState)(false), signatureSigning = _30[0], setSignatureSigning = _30[1];
|
|
578
|
+
var _31 = (0, react_2.useState)([]), collapsedGroupIds = _31[0], setCollapsedGroupIds = _31[1];
|
|
527
579
|
// INFO: rows shown per section when the sections do not page themselves
|
|
528
|
-
var
|
|
580
|
+
var _32 = (0, react_2.useState)({}), groupVisibleCounts = _32[0], setGroupVisibleCounts = _32[1];
|
|
529
581
|
// INFO: per-group scroll pagination. One sentinel element per band, observed
|
|
530
582
|
// by a single IntersectionObserver that fires props.onGroupLoadMore when a
|
|
531
583
|
// band's sentinel scrolls into view. The debounce guard stops repeat fires
|
|
532
584
|
// while that group's next page is in flight.
|
|
533
585
|
var groupSentinelRefs = (0, react_2.useRef)({});
|
|
534
586
|
var groupLoadMoreDebounce = (0, react_2.useRef)({});
|
|
587
|
+
// INFO: groups whose load settled and wait to check their sentinel again
|
|
588
|
+
var groupRecheckRef = (0, react_2.useRef)(new Set());
|
|
535
589
|
var onGroupLoadMoreRef = (0, react_2.useRef)(props.onGroupLoadMore);
|
|
536
590
|
onGroupLoadMoreRef.current = props.onGroupLoadMore;
|
|
537
591
|
// INFO: sheet-style row selection — Shift-click extends from the last
|
|
@@ -541,35 +595,48 @@ var NewTable = function (props) {
|
|
|
541
595
|
var lastSelectedRowRef = (0, react_2.useRef)(null);
|
|
542
596
|
var dragSelectRef = (0, react_2.useRef)(null);
|
|
543
597
|
var suppressNextClickRef = (0, react_2.useRef)(false);
|
|
544
|
-
var
|
|
545
|
-
var
|
|
546
|
-
var
|
|
547
|
-
var
|
|
598
|
+
var _33 = (0, react_2.useState)(false), isDragSelecting = _33[0], setIsDragSelecting = _33[1];
|
|
599
|
+
var _34 = (0, react_2.useState)(0), copiedCount = _34[0], setCopiedCount = _34[1];
|
|
600
|
+
var _35 = (0, react_2.useState)({}), editDataValue = _35[0], setEditDataValue = _35[1];
|
|
601
|
+
var _36 = (0, react_2.useState)(false), editDataIsLoading = _36[0], setEditDataIsLoading = _36[1];
|
|
548
602
|
// INFO: true while the empty bottom row is being filled in; the row itself is
|
|
549
603
|
// always there in an addable table
|
|
550
|
-
var
|
|
604
|
+
var _37 = (0, react_2.useState)(false), addData = _37[0], setAddData = _37[1];
|
|
551
605
|
var isAddRowPinned = props.paginationType === "scroll";
|
|
552
|
-
var
|
|
606
|
+
var _38 = (0, react_2.useState)({}), addDataValue = _38[0], setAddDataValue = _38[1];
|
|
553
607
|
// INFO: bumped after each saved row, so the next one starts with fresh
|
|
554
608
|
// inputs and its first cell takes the focus
|
|
555
|
-
var
|
|
609
|
+
var _39 = (0, react_2.useState)(0), addRowKey = _39[0], setAddRowKey = _39[1];
|
|
556
610
|
// INFO: the group whose own add row is being filled in; "" = the bottom row
|
|
557
|
-
var
|
|
611
|
+
var _40 = (0, react_2.useState)(""), addGroupId = _40[0], setAddGroupId = _40[1];
|
|
558
612
|
// INFO: the row armed by a press on its handle, so only the handle — never
|
|
559
613
|
// a click or a text selection in a cell — starts a drag
|
|
560
|
-
var
|
|
561
|
-
var
|
|
562
|
-
var
|
|
563
|
-
var
|
|
614
|
+
var _41 = (0, react_2.useState)(""), dragArmedRowId = _41[0], setDragArmedRowId = _41[1];
|
|
615
|
+
var _42 = (0, react_2.useState)(""), draggingRowId = _42[0], setDraggingRowId = _42[1];
|
|
616
|
+
var _43 = (0, react_2.useState)(""), dropGroupId = _43[0], setDropGroupId = _43[1];
|
|
617
|
+
var _44 = (0, react_2.useState)({}), referencesOptions = _44[0], setReferencesOptions = _44[1];
|
|
564
618
|
// INFO: seeded options sit under the local map so a cell's own search
|
|
565
619
|
// results still win per key
|
|
566
620
|
var mergedReferencesOptions = __assign(__assign({}, ((_m = props.referencesOptions) !== null && _m !== void 0 ? _m : {})), referencesOptions);
|
|
567
|
-
var
|
|
568
|
-
var
|
|
621
|
+
var _45 = (0, react_2.useState)({}), referencesDetails = _45[0], setReferencesDetails = _45[1];
|
|
622
|
+
var _46 = (0, react_2.useState)(false), referenceLoading = _46[0], setReferenceLoading = _46[1];
|
|
569
623
|
// INFO: measured pixel widths for pinned columns without an explicit width.
|
|
570
|
-
var
|
|
624
|
+
var _47 = (0, react_2.useState)({}), measuredPinWidths = _47[0], setMeasuredPinWidths = _47[1];
|
|
571
625
|
// INFO: the scrolling view's width, which caps how much the left pins take
|
|
572
|
-
var
|
|
626
|
+
var _48 = (0, react_2.useState)(0), pinViewWidth = _48[0], setPinViewWidth = _48[1];
|
|
627
|
+
// INFO: per large group, the rows [start, end) drawn; the rest are spacers
|
|
628
|
+
var _49 = (0, react_2.useState)({}), virtualRanges = _49[0], setVirtualRanges = _49[1];
|
|
629
|
+
// INFO: each drawn row's measured height, kept so a spacer is as tall as the
|
|
630
|
+
// rows it stands in for
|
|
631
|
+
var rowHeightsRef = (0, react_2.useRef)(new Map());
|
|
632
|
+
// INFO: the large groups of the last render, in order, with their row ids
|
|
633
|
+
var virtualGroupsRef = (0, react_2.useRef)([]);
|
|
634
|
+
var virtualFrameRef = (0, react_2.useRef)(0);
|
|
635
|
+
var rowEstimateRef = (0, react_2.useRef)(rowRendering_1.VIRTUAL_DEFAULT_ROW_HEIGHT);
|
|
636
|
+
var tableVersionRef = (0, react_2.useRef)({
|
|
637
|
+
key: "",
|
|
638
|
+
version: 0,
|
|
639
|
+
});
|
|
573
640
|
var editDataValueRef = (0, react_2.useRef)({});
|
|
574
641
|
var editDataRowIdRef = (0, react_2.useRef)("");
|
|
575
642
|
var editDataHeaderKeyRef = (0, react_2.useRef)("");
|
|
@@ -587,6 +654,90 @@ var NewTable = function (props) {
|
|
|
587
654
|
// never mutated during editing so we can diff against it on blur.
|
|
588
655
|
var originalDataRef = (0, react_2.useRef)({});
|
|
589
656
|
var tableRef = (0, react_2.useRef)(null);
|
|
657
|
+
// INFO: which rows each large group draws, from where its first row sits
|
|
658
|
+
// on screen. The window's edges, widened by the overscan, bound it — the
|
|
659
|
+
// table's own scroller sits inside them, whichever element that is
|
|
660
|
+
var handleUpdateVirtualRanges = function () {
|
|
661
|
+
var table = tableRef.current;
|
|
662
|
+
var groups = virtualGroupsRef.current;
|
|
663
|
+
if (!table || groups.length === 0)
|
|
664
|
+
return;
|
|
665
|
+
var starts = new Map();
|
|
666
|
+
table
|
|
667
|
+
.querySelectorAll("tr[data-virtual-start]")
|
|
668
|
+
.forEach(function (element) {
|
|
669
|
+
var _a;
|
|
670
|
+
return starts.set((_a = element.getAttribute("data-virtual-start")) !== null && _a !== void 0 ? _a : "", element.getBoundingClientRect().top);
|
|
671
|
+
});
|
|
672
|
+
var viewTop = -rowRendering_1.VIRTUAL_OVERSCAN_PX;
|
|
673
|
+
var viewBottom = window.innerHeight + rowRendering_1.VIRTUAL_OVERSCAN_PX;
|
|
674
|
+
var next = {};
|
|
675
|
+
groups.forEach(function (group) {
|
|
676
|
+
var groupTop = starts.get(group.id);
|
|
677
|
+
if (groupTop === undefined)
|
|
678
|
+
return;
|
|
679
|
+
next[group.id] = (0, rowRendering_1.handleGetVisibleRange)((0, rowRendering_1.handleBuildRowOffsets)(group.rowIds, rowHeightsRef.current, rowEstimateRef.current), groupTop, viewTop, viewBottom);
|
|
680
|
+
});
|
|
681
|
+
setVirtualRanges(function (previous) {
|
|
682
|
+
var keys = Object.keys(next);
|
|
683
|
+
var isSame = keys.length === Object.keys(previous).length &&
|
|
684
|
+
keys.every(function (key) {
|
|
685
|
+
var _a, _b;
|
|
686
|
+
return ((_a = previous[key]) === null || _a === void 0 ? void 0 : _a[0]) === next[key][0] &&
|
|
687
|
+
((_b = previous[key]) === null || _b === void 0 ? void 0 : _b[1]) === next[key][1];
|
|
688
|
+
});
|
|
689
|
+
return isSame ? previous : next;
|
|
690
|
+
});
|
|
691
|
+
};
|
|
692
|
+
var handleScheduleVirtualRanges = function () {
|
|
693
|
+
if (virtualFrameRef.current)
|
|
694
|
+
return;
|
|
695
|
+
virtualFrameRef.current = requestAnimationFrame(function () {
|
|
696
|
+
virtualFrameRef.current = 0;
|
|
697
|
+
handleUpdateVirtualRanges();
|
|
698
|
+
});
|
|
699
|
+
};
|
|
700
|
+
// INFO: after each draw, the drawn rows of large groups are measured, so the
|
|
701
|
+
// spacers match them, and the ranges are checked against the new layout
|
|
702
|
+
(0, react_2.useLayoutEffect)(function () {
|
|
703
|
+
if (virtualGroupsRef.current.length === 0)
|
|
704
|
+
return;
|
|
705
|
+
var table = tableRef.current;
|
|
706
|
+
if (!table)
|
|
707
|
+
return;
|
|
708
|
+
var heights = rowHeightsRef.current;
|
|
709
|
+
table
|
|
710
|
+
.querySelectorAll("tbody tr[data-dtw-record-id]")
|
|
711
|
+
.forEach(function (element) {
|
|
712
|
+
var id = element.getAttribute("data-dtw-record-id");
|
|
713
|
+
var height = element.getBoundingClientRect().height;
|
|
714
|
+
if (id && height > 0)
|
|
715
|
+
heights.set(id, height);
|
|
716
|
+
});
|
|
717
|
+
if (heights.size > 0) {
|
|
718
|
+
var total_1 = 0;
|
|
719
|
+
heights.forEach(function (height) { return (total_1 += height); });
|
|
720
|
+
rowEstimateRef.current = total_1 / heights.size;
|
|
721
|
+
}
|
|
722
|
+
handleScheduleVirtualRanges();
|
|
723
|
+
});
|
|
724
|
+
// INFO: capture catches the scroll of whichever element scrolls the table
|
|
725
|
+
(0, react_2.useEffect)(function () {
|
|
726
|
+
window.addEventListener("scroll", handleScheduleVirtualRanges, {
|
|
727
|
+
capture: true,
|
|
728
|
+
passive: true,
|
|
729
|
+
});
|
|
730
|
+
window.addEventListener("resize", handleScheduleVirtualRanges);
|
|
731
|
+
return function () {
|
|
732
|
+
window.removeEventListener("scroll", handleScheduleVirtualRanges, {
|
|
733
|
+
capture: true,
|
|
734
|
+
});
|
|
735
|
+
window.removeEventListener("resize", handleScheduleVirtualRanges);
|
|
736
|
+
if (virtualFrameRef.current)
|
|
737
|
+
cancelAnimationFrame(virtualFrameRef.current);
|
|
738
|
+
};
|
|
739
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
740
|
+
}, []);
|
|
590
741
|
// INFO: ensures pinned column measurement runs only once per mount.
|
|
591
742
|
var hasMeasuredRef = (0, react_2.useRef)(false);
|
|
592
743
|
//=====================================================================================
|
|
@@ -801,21 +952,24 @@ var NewTable = function (props) {
|
|
|
801
952
|
(0, react_2.useEffect)(function () {
|
|
802
953
|
var _a;
|
|
803
954
|
var status = (_a = props.groupLoadingStatus) !== null && _a !== void 0 ? _a : {};
|
|
804
|
-
var settled = [];
|
|
805
955
|
Object.keys(groupLoadMoreDebounce.current).forEach(function (groupId) {
|
|
806
956
|
var _a;
|
|
807
957
|
if ((_a = status[groupId]) === null || _a === void 0 ? void 0 : _a.loadingMore)
|
|
808
958
|
return;
|
|
809
959
|
if (groupLoadMoreDebounce.current[groupId])
|
|
810
|
-
|
|
960
|
+
groupRecheckRef.current.add(groupId);
|
|
811
961
|
groupLoadMoreDebounce.current[groupId] = false;
|
|
812
962
|
});
|
|
813
|
-
if (
|
|
963
|
+
if (groupRecheckRef.current.size === 0)
|
|
814
964
|
return;
|
|
815
965
|
// INFO: read after the new rows are laid out and the observer has said
|
|
816
|
-
// whether the sentinel is still on screen, so a band loads no extra page
|
|
966
|
+
// whether the sentinel is still on screen, so a band loads no extra page.
|
|
967
|
+
// The bands wait in a ref, so another band settling within the delay does
|
|
968
|
+
// not drop them along with the cleared timer
|
|
817
969
|
var timer = setTimeout(function () {
|
|
818
|
-
|
|
970
|
+
var pending = Array.from(groupRecheckRef.current);
|
|
971
|
+
groupRecheckRef.current.clear();
|
|
972
|
+
pending.forEach(function (groupId) {
|
|
819
973
|
var _a, _b;
|
|
820
974
|
if (groupIntersectingRef.current[groupId] &&
|
|
821
975
|
!((_b = ((_a = props.groupLoadingStatus) !== null && _a !== void 0 ? _a : {})[groupId]) === null || _b === void 0 ? void 0 : _b.exhausted))
|
|
@@ -861,14 +1015,22 @@ var NewTable = function (props) {
|
|
|
861
1015
|
range === null || range === void 0 ? void 0 : range.selectNodeContents(inner);
|
|
862
1016
|
var textWidth = Math.ceil((_b = (_a = range === null || range === void 0 ? void 0 : range.getBoundingClientRect) === null || _a === void 0 ? void 0 : _a.call(range).width) !== null && _b !== void 0 ? _b : 0);
|
|
863
1017
|
td.style.whiteSpace = previousWhiteSpace;
|
|
1018
|
+
// INFO: a truncated link reports its clipped box to the range, so
|
|
1019
|
+
// its scrollWidth — the text's full width — is read as well
|
|
1020
|
+
var truncatedWidth = inner
|
|
1021
|
+
? Math.max.apply(Math, __spreadArray([0], Array.from(inner.querySelectorAll("*")).map(function (each) { return each.scrollWidth; }), false)) : 0;
|
|
864
1022
|
var w = inner
|
|
865
|
-
? Math.max(textWidth, inner.offsetWidth)
|
|
1023
|
+
? Math.max(textWidth, inner.offsetWidth, truncatedWidth)
|
|
866
1024
|
: td.scrollWidth;
|
|
867
|
-
// INFO: + cell padding (px-4 = 16px × 2), or the title
|
|
1025
|
+
// INFO: + cell padding (px-4 = 16px × 2), or the title cell's left
|
|
1026
|
+
// padding and the actions' room with the chevron's, so the title
|
|
1027
|
+
// still fits when a hovered row makes room for the chevron
|
|
1028
|
+
var leftPadding = parseFloat(window.getComputedStyle(td).paddingLeft) || 16;
|
|
1029
|
+
var rightPadding = titleChevronActionsWidth;
|
|
868
1030
|
if (w > 0)
|
|
869
1031
|
widths[key] =
|
|
870
1032
|
key === ((_c = flatColumns[0]) === null || _c === void 0 ? void 0 : _c.key) && titleActionsWidth
|
|
871
|
-
? w +
|
|
1033
|
+
? w + leftPadding + rightPadding
|
|
872
1034
|
: w + 32;
|
|
873
1035
|
}
|
|
874
1036
|
});
|
|
@@ -1317,20 +1479,45 @@ var NewTable = function (props) {
|
|
|
1317
1479
|
// it stays here until the table unmounts. Tailwind cannot emit a runtime
|
|
1318
1480
|
// w-[Npx], so a width drives an inline style and wins over the col.width
|
|
1319
1481
|
// class.
|
|
1320
|
-
var
|
|
1482
|
+
var _50 = (0, react_2.useState)({}), columnWidths = _50[0], setColumnWidths = _50[1];
|
|
1321
1483
|
var resizeRef = (0, react_2.useRef)(null);
|
|
1322
1484
|
// INFO: a dragged width first, else the column's own fixed width in pixels
|
|
1323
1485
|
// whatever form it is stored in ("180px", "w-[180px]", "w-48")
|
|
1324
1486
|
var getColumnWidth = function (key) {
|
|
1325
|
-
if (columnWidths[key])
|
|
1326
|
-
return columnWidths[key];
|
|
1327
1487
|
var col = flatColumns.find(function (eachCol) { return eachCol.key === key; });
|
|
1328
|
-
|
|
1488
|
+
var width = columnWidths[key] || (0, columnWidth_1.handleParseColumnWidth)(col === null || col === void 0 ? void 0 : col.width);
|
|
1489
|
+
// INFO: a title carrying its row's actions never narrows past its floor,
|
|
1490
|
+
// even from a width saved before the actions took their room
|
|
1491
|
+
var titleMin = getTitleMinWidth(key);
|
|
1492
|
+
return width !== undefined && titleMin ? Math.max(width, titleMin) : width;
|
|
1493
|
+
};
|
|
1494
|
+
// INFO: the title column's floor while it carries the row's actions: its
|
|
1495
|
+
// left padding, the actions' room and a few characters of title
|
|
1496
|
+
var getTitleMinWidth = function (key) {
|
|
1497
|
+
var _a;
|
|
1498
|
+
return key === ((_a = flatColumns[0]) === null || _a === void 0 ? void 0 : _a.key) && hasRowActions
|
|
1499
|
+
? TITLE_LEFT_PADDING + titleChevronActionsWidth + MIN_TITLE_TEXT_WIDTH
|
|
1500
|
+
: undefined;
|
|
1329
1501
|
};
|
|
1330
1502
|
// INFO: a consumer may deliberately set a column narrower than the default
|
|
1331
1503
|
// floor (a 40px icon column, say) — never force it wider than it was asked to
|
|
1332
1504
|
// be, so the floor drops to the configured width when that is smaller
|
|
1505
|
+
// INFO: the title cell can only grow its padding on hover while its column
|
|
1506
|
+
// has a set width — a pinned title, or one dragged or configured. A title
|
|
1507
|
+
// sized by its content would widen and shift the table on every hover, so
|
|
1508
|
+
// it keeps the chevron's room all the time instead.
|
|
1509
|
+
var titleKey = (_r = flatColumns[0]) === null || _r === void 0 ? void 0 : _r.key;
|
|
1510
|
+
var isTitleWidthFixed = !!titleKey &&
|
|
1511
|
+
(leftPinned.includes(titleKey) ||
|
|
1512
|
+
rightPinned.includes(titleKey) ||
|
|
1513
|
+
!!getColumnWidth(titleKey));
|
|
1514
|
+
var titleRestPadding = isTitleWidthFixed
|
|
1515
|
+
? titleActionsWidth
|
|
1516
|
+
: titleChevronActionsWidth;
|
|
1333
1517
|
var getColumnMinWidth = function (key) {
|
|
1518
|
+
var titleMin = getTitleMinWidth(key);
|
|
1519
|
+
if (titleMin)
|
|
1520
|
+
return titleMin;
|
|
1334
1521
|
var col = flatColumns.find(function (eachCol) { return eachCol.key === key; });
|
|
1335
1522
|
var configured = (0, columnWidth_1.handleParseColumnWidth)(col === null || col === void 0 ? void 0 : col.width);
|
|
1336
1523
|
return configured === undefined
|
|
@@ -1425,7 +1612,7 @@ var NewTable = function (props) {
|
|
|
1425
1612
|
? ALL_COLUMN_TYPES.filter(function (eachType) {
|
|
1426
1613
|
return (0, exports.handleGetEditableColumnTypes)(editingColumn.type).includes(eachType.key);
|
|
1427
1614
|
})
|
|
1428
|
-
:
|
|
1615
|
+
: handleGetAddColumnTypes(), disabled: !!editingColumn &&
|
|
1429
1616
|
(0, exports.handleGetEditableColumnTypes)(editingColumn.type).length < 2, portalDropdown: true, onChange: function (value) {
|
|
1430
1617
|
var _a;
|
|
1431
1618
|
setNewColumnType(value);
|
|
@@ -1445,6 +1632,7 @@ var NewTable = function (props) {
|
|
|
1445
1632
|
setNewColumnRefLabel("");
|
|
1446
1633
|
} }),
|
|
1447
1634
|
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); } }))),
|
|
1635
|
+
newColumnType === "lookup" && renderLookupPickers(),
|
|
1448
1636
|
LIST_TYPES.includes(newColumnType) && renderColumnOptions(),
|
|
1449
1637
|
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 : ""); } })),
|
|
1450
1638
|
newColumnType === "button" && (react_2.default.createElement(react_2.default.Fragment, null,
|
|
@@ -1453,13 +1641,15 @@ var NewTable = function (props) {
|
|
|
1453
1641
|
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 : ""); } }))),
|
|
1454
1642
|
ASSET_TYPES.includes(newColumnType) && (react_2.default.createElement("p", { className: "-mt-2 text-xs text-gray-500" }, "Uploads are stored against this space automatically.")),
|
|
1455
1643
|
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 })),
|
|
1456
|
-
newColumnType
|
|
1644
|
+
!UNREQUIRABLE_TYPES.includes(newColumnType) && (react_2.default.createElement(checkbox_1.Checkbox, { id: "newColumnRequired",
|
|
1457
1645
|
// INFO: the checkbox itself is not a required field — without this it
|
|
1458
1646
|
// renders "Required *", which reads as a validation error on a toggle
|
|
1459
1647
|
optional: true, darkMode: props.darkMode, itemList: [{ key: "required", label: "Required" }], selectItemList: newColumnRequired ? ["required"] : [], onChange: function (items) {
|
|
1460
1648
|
return setNewColumnRequired(items.includes("required"));
|
|
1461
1649
|
} })),
|
|
1462
|
-
|
|
1650
|
+
!UNREQUIRABLE_TYPES.includes(newColumnType) &&
|
|
1651
|
+
newColumnRequired &&
|
|
1652
|
+
!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.")),
|
|
1463
1653
|
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) {
|
|
1464
1654
|
return setNewColumnUnique(items.includes("unique"));
|
|
1465
1655
|
} })),
|
|
@@ -1532,8 +1722,51 @@ var NewTable = function (props) {
|
|
|
1532
1722
|
renderOptionColourPalette(eachOption, index)));
|
|
1533
1723
|
}),
|
|
1534
1724
|
react_2.default.createElement(textButton_1.TextButton, { text: "Add option", className: "self-start text-sm", onClick: handleAddOption }))); };
|
|
1725
|
+
// INFO: a lookup needs a datasheet's columns to choose from, which only the
|
|
1726
|
+
// reference label provider gives
|
|
1727
|
+
var handleGetAddColumnTypes = function () {
|
|
1728
|
+
var _a;
|
|
1729
|
+
return ((_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.renderReferenceLabelOptions)
|
|
1730
|
+
? ADD_COLUMN_TYPES
|
|
1731
|
+
: ADD_COLUMN_TYPES.filter(function (eachType) { return eachType.key !== "lookup"; });
|
|
1732
|
+
};
|
|
1733
|
+
// INFO: the reference columns of this datasheet a lookup can read through —
|
|
1734
|
+
// a lookup drawn as a reference is not one
|
|
1735
|
+
var handleGetLookupReferenceColumns = function () {
|
|
1736
|
+
return handleGetFormulaSchema().filter(function (eachColumn) {
|
|
1737
|
+
return lookup_1.LOOKUP_REFERENCE_TYPES.includes(eachColumn.type) &&
|
|
1738
|
+
!!eachColumn.referenceSpaceId &&
|
|
1739
|
+
!(0, lookup_1.handleIsLookupDerived)(eachColumn);
|
|
1740
|
+
});
|
|
1741
|
+
};
|
|
1742
|
+
// INFO: the linked datasheet's columns, less those the host's server
|
|
1743
|
+
// refuses to show — read from the same provider the reference label uses
|
|
1744
|
+
var handleGetLookupFieldOptions = function () {
|
|
1745
|
+
var _a, _b;
|
|
1746
|
+
var provider = (_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.renderReferenceLabelOptions;
|
|
1747
|
+
var reference = handleGetLookupReferenceColumns().find(function (eachColumn) { return eachColumn.id === newColumnLookupReference; });
|
|
1748
|
+
if (!provider || !(reference === null || reference === void 0 ? void 0 : reference.referenceSpaceId))
|
|
1749
|
+
return [];
|
|
1750
|
+
var spaceId = reference.referenceSpaceId;
|
|
1751
|
+
var refused = new Set(lookup_1.LOOKUP_UNSUPPORTED_SOURCE_TYPES.flatMap(function (eachType) {
|
|
1752
|
+
var _a;
|
|
1753
|
+
return ((_a = provider(spaceId, false, eachType)) !== null && _a !== void 0 ? _a : []).map(function (eachOption) { return eachOption.key; });
|
|
1754
|
+
}));
|
|
1755
|
+
return ((_b = provider(spaceId, true)) !== null && _b !== void 0 ? _b : []).filter(function (eachOption) { return !refused.has(eachOption.key); });
|
|
1756
|
+
};
|
|
1757
|
+
var renderLookupPickers = function () { return (react_2.default.createElement(react_2.default.Fragment, null,
|
|
1758
|
+
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 ({
|
|
1759
|
+
key: eachColumn.id,
|
|
1760
|
+
label: eachColumn.name,
|
|
1761
|
+
}); }), onChange: function (value) {
|
|
1762
|
+
setNewColumnLookupReference(value);
|
|
1763
|
+
// INFO: the shown column belongs to the linked datasheet, so a new
|
|
1764
|
+
// reference invalidates whatever was picked before
|
|
1765
|
+
setNewColumnLookupField("");
|
|
1766
|
+
} }),
|
|
1767
|
+
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); } }))); };
|
|
1535
1768
|
var handleEditColumnModal = function (columnId) {
|
|
1536
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1769
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1537
1770
|
var schema = (_b = (_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.getColumnSchema) === null || _b === void 0 ? void 0 : _b.call(_a, columnId);
|
|
1538
1771
|
if (!schema)
|
|
1539
1772
|
return;
|
|
@@ -1542,15 +1775,17 @@ var NewTable = function (props) {
|
|
|
1542
1775
|
setNewColumnType((_d = schema.type) !== null && _d !== void 0 ? _d : "string");
|
|
1543
1776
|
setNewColumnRefSpace((_e = schema.referenceSpaceId) !== null && _e !== void 0 ? _e : "");
|
|
1544
1777
|
setNewColumnRefLabel((_f = schema.referenceLabel) !== null && _f !== void 0 ? _f : "");
|
|
1778
|
+
setNewColumnLookupReference((_g = schema.referenceFieldId) !== null && _g !== void 0 ? _g : "");
|
|
1779
|
+
setNewColumnLookupField((_h = schema.lookupFieldId) !== null && _h !== void 0 ? _h : "");
|
|
1545
1780
|
setNewColumnOptions((0, exports.handleReadColumnOptions)(schema));
|
|
1546
1781
|
setOptionColourKey(null);
|
|
1547
1782
|
setNewColumnRequired(!schema.optional);
|
|
1548
1783
|
setNewColumnUnique(!!schema.unique);
|
|
1549
1784
|
setNewColumnReadOnly(!!schema.disabled);
|
|
1550
1785
|
setNewColumnRatingMax(schema.ratingMax ? String(schema.ratingMax) : "");
|
|
1551
|
-
setNewColumnButtonLabel((
|
|
1552
|
-
setNewColumnButtonColour((
|
|
1553
|
-
setNewColumnButtonConfirm((
|
|
1786
|
+
setNewColumnButtonLabel((_j = schema.buttonLabel) !== null && _j !== void 0 ? _j : "");
|
|
1787
|
+
setNewColumnButtonColour((_k = schema.buttonColour) !== null && _k !== void 0 ? _k : "");
|
|
1788
|
+
setNewColumnButtonConfirm((_l = schema.buttonConfirm) !== null && _l !== void 0 ? _l : "");
|
|
1554
1789
|
setNewColumnFormula(schema.type === "formula"
|
|
1555
1790
|
? (0, formula_1.handleGetFormulaDisplay)(schema, handleGetFormulaSchema())
|
|
1556
1791
|
: "");
|
|
@@ -1570,6 +1805,8 @@ var NewTable = function (props) {
|
|
|
1570
1805
|
setNewColumnType("string");
|
|
1571
1806
|
setNewColumnRefSpace("");
|
|
1572
1807
|
setNewColumnRefLabel("");
|
|
1808
|
+
setNewColumnLookupReference("");
|
|
1809
|
+
setNewColumnLookupField("");
|
|
1573
1810
|
setNewColumnOptions([]);
|
|
1574
1811
|
setOptionColourKey(null);
|
|
1575
1812
|
setNewColumnRequired(false);
|
|
@@ -1633,6 +1870,8 @@ var NewTable = function (props) {
|
|
|
1633
1870
|
return false;
|
|
1634
1871
|
if (REFERENCE_TYPES.includes(newColumnType))
|
|
1635
1872
|
return !!newColumnRefSpace && !!newColumnRefLabel;
|
|
1873
|
+
if (newColumnType === "lookup")
|
|
1874
|
+
return !!newColumnLookupReference && !!newColumnLookupField;
|
|
1636
1875
|
// INFO: an illegal formula would show "Error" in every row
|
|
1637
1876
|
if (newColumnType === "formula") {
|
|
1638
1877
|
if (!newColumnFormula.trim())
|
|
@@ -1736,6 +1975,11 @@ var NewTable = function (props) {
|
|
|
1736
1975
|
column.formulaExpression = (0, formula_1.handleFormulaToStorage)(newColumnFormula.trim(), handleGetFormulaSchema());
|
|
1737
1976
|
column.optional = true;
|
|
1738
1977
|
}
|
|
1978
|
+
if (newColumnType === "lookup") {
|
|
1979
|
+
column.referenceFieldId = newColumnLookupReference;
|
|
1980
|
+
column.lookupFieldId = newColumnLookupField;
|
|
1981
|
+
column.optional = true;
|
|
1982
|
+
}
|
|
1739
1983
|
handleApplyColumnSettings(column);
|
|
1740
1984
|
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))];
|
|
1741
1985
|
case 4:
|
|
@@ -1793,6 +2037,18 @@ var NewTable = function (props) {
|
|
|
1793
2037
|
column_1.formulaExpression = (0, formula_1.handleFormulaToStorage)(newColumnFormula.trim(), handleGetFormulaSchema());
|
|
1794
2038
|
column_1.optional = true;
|
|
1795
2039
|
}
|
|
2040
|
+
if (newColumnType === "lookup") {
|
|
2041
|
+
// INFO: the copied type and settings belong to the old source; the
|
|
2042
|
+
// host's server copies them again from the new one on save
|
|
2043
|
+
if (newColumnLookupReference !== original.referenceFieldId ||
|
|
2044
|
+
newColumnLookupField !== original.lookupFieldId) {
|
|
2045
|
+
delete column_1.lookupFieldType;
|
|
2046
|
+
delete column_1.lookupFieldSettings;
|
|
2047
|
+
}
|
|
2048
|
+
column_1.referenceFieldId = newColumnLookupReference;
|
|
2049
|
+
column_1.lookupFieldId = newColumnLookupField;
|
|
2050
|
+
column_1.optional = true;
|
|
2051
|
+
}
|
|
1796
2052
|
handleApplyColumnSettings(column_1);
|
|
1797
2053
|
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))];
|
|
1798
2054
|
case 2:
|
|
@@ -2046,18 +2302,21 @@ var NewTable = function (props) {
|
|
|
2046
2302
|
// INFO: extract numeric px value from a Tailwind width class (e.g. "w-[200px]" → 200, "w-48" → 192).
|
|
2047
2303
|
// Falls back to measured DOM width for columns without explicit width.
|
|
2048
2304
|
var handleGetPinWidth = function (key) {
|
|
2049
|
-
var _a;
|
|
2305
|
+
var _a, _b;
|
|
2050
2306
|
// INFO: a dragged or fixed width wins over the measured fallback
|
|
2051
2307
|
var fixedWidth = getColumnWidth(key);
|
|
2052
2308
|
if (fixedWidth)
|
|
2053
2309
|
return fixedWidth;
|
|
2054
2310
|
var col = flatColumns.find(function (c) { return c.key === key; });
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2311
|
+
var width = (col === null || col === void 0 ? void 0 : col.width)
|
|
2312
|
+
? DEFAULT_PIN_WIDTH
|
|
2313
|
+
: ((_a = measuredPinWidths[key]) !== null && _a !== void 0 ? _a : DEFAULT_PIN_WIDTH);
|
|
2314
|
+
// INFO: a measured short title still keeps its floor, so a hovered row
|
|
2315
|
+
// leaves its inline editor some room beside the chevron
|
|
2316
|
+
return Math.max(width, (_b = getTitleMinWidth(key)) !== null && _b !== void 0 ? _b : 0);
|
|
2058
2317
|
};
|
|
2059
2318
|
var pinCheckboxOffset = props.checkbox &&
|
|
2060
|
-
(props.data.length > 0 || (props.spaceData && ((
|
|
2319
|
+
(props.data.length > 0 || (props.spaceData && ((_s = props.spaceData) === null || _s === void 0 ? void 0 : _s.length) > 0))
|
|
2061
2320
|
? CHECKBOX_WIDTH
|
|
2062
2321
|
: 0;
|
|
2063
2322
|
/**
|
|
@@ -2227,20 +2486,10 @@ var NewTable = function (props) {
|
|
|
2227
2486
|
setReferencesDetails: setReferencesDetails,
|
|
2228
2487
|
});
|
|
2229
2488
|
};
|
|
2230
|
-
// INFO:
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
(editDataRowId === rowId && editDataHeaderKey === colKey);
|
|
2235
|
-
};
|
|
2236
|
-
var handleCellHoverProps = function (rowId, colKey) { return ({
|
|
2237
|
-
onMouseEnter: function () { return setHoveredCell({ rowId: rowId, colKey: colKey }); },
|
|
2238
|
-
onMouseLeave: function () {
|
|
2239
|
-
return setHoveredCell(function (current) {
|
|
2240
|
-
return (current === null || current === void 0 ? void 0 : current.rowId) === rowId && (current === null || current === void 0 ? void 0 : current.colKey) === colKey ? null : current;
|
|
2241
|
-
});
|
|
2242
|
-
},
|
|
2243
|
-
}); };
|
|
2489
|
+
// INFO: a cell being typed into stays an input after the pointer leaves it
|
|
2490
|
+
var handleIsCellEditing = function (rowId, colKey) {
|
|
2491
|
+
return editDataRowId === rowId && editDataHeaderKey === colKey;
|
|
2492
|
+
};
|
|
2244
2493
|
var renderReadCellValue = function (col, row, cellValue) {
|
|
2245
2494
|
var _a;
|
|
2246
2495
|
var value = (0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord);
|
|
@@ -2268,12 +2517,12 @@ var NewTable = function (props) {
|
|
|
2268
2517
|
var _a, _b, _c, _d;
|
|
2269
2518
|
var tempDS = __assign(__assign({}, col), { id: col.key, name: col.title, type: (_a = col.type) !== null && _a !== void 0 ? _a : "string", showTagSelections: handleColumnShowsTags(col) });
|
|
2270
2519
|
var editingRow = editDataRowId === rowId;
|
|
2271
|
-
return (react_2.default.createElement("td",
|
|
2520
|
+
return (react_2.default.createElement("td", { key: col.key + String(colIndex), "data-cell-key": col.key,
|
|
2272
2521
|
// INFO: pinned columns use whitespace-normal so text wraps within the fixed width.
|
|
2273
2522
|
// col.width must match the read-only cell's width source so a column keeps one
|
|
2274
2523
|
// width whether a row is being edited or shown read-only — without it the cell
|
|
2275
2524
|
// shrinks/grows on hover and staggers the column.
|
|
2276
|
-
className: "".concat(editCellPadding, " ").concat(handleCellMinWidth(col.type), " ").concat(col.width ? "".concat(col.width, " flex-shrink-0") : "", " ").concat(getPinProps(col.key, false) ? "whitespace-normal break-words" : col.width ? "" : "whitespace-nowrap", " text-sm ").concat(cellFontColor, " ").concat((_c = (_b = getPinProps(col.key, false, rowBgClass, isHoverable)) === null || _b === void 0 ? void 0 : _b.className) !== null && _c !== void 0 ? _c : ""), style: (_d = getPinProps(col.key, false, rowBgClass, isHoverable)) === null || _d === void 0 ? void 0 : _d.style }
|
|
2525
|
+
className: "".concat(editCellPadding, " ").concat(handleCellMinWidth(col.type), " ").concat(col.width ? "".concat(col.width, " flex-shrink-0") : "", " ").concat(getPinProps(col.key, false) ? "whitespace-normal break-words" : col.width ? "" : "whitespace-nowrap", " text-sm ").concat(cellFontColor, " ").concat((_c = (_b = getPinProps(col.key, false, rowBgClass, isHoverable)) === null || _b === void 0 ? void 0 : _b.className) !== null && _c !== void 0 ? _c : ""), style: (_d = getPinProps(col.key, false, rowBgClass, isHoverable)) === null || _d === void 0 ? void 0 : _d.style },
|
|
2277
2526
|
react_2.default.createElement("div", {
|
|
2278
2527
|
// INFO: w-0 on the control, not min-w-0 — the table is sized w-max, so
|
|
2279
2528
|
// an input's browser-default ~20ch intrinsic width feeds max-content
|
|
@@ -2297,10 +2546,23 @@ var NewTable = function (props) {
|
|
|
2297
2546
|
},
|
|
2298
2547
|
}))));
|
|
2299
2548
|
};
|
|
2300
|
-
var
|
|
2301
|
-
|
|
2549
|
+
var renderActionStrip = function (testId, right, children) { return (react_2.default.createElement("div", { "data-testid": testId, className: "absolute inset-y-0 z-20 flex items-center justify-center border-l ".concat(borderColor), style: { right: right, width: ACTION_STRIP_WIDTH } }, children)); };
|
|
2550
|
+
var renderActivityButton = function (id, positioned, chevronBgClass) {
|
|
2551
|
+
var _a, _b;
|
|
2302
2552
|
if (positioned === void 0) { positioned = false; }
|
|
2303
|
-
|
|
2553
|
+
if (chevronBgClass === void 0) { chevronBgClass = ""; }
|
|
2554
|
+
if (!hasRowActions)
|
|
2555
|
+
return null;
|
|
2556
|
+
// INFO: a mobile card opens its record from the card, so it keeps the
|
|
2557
|
+
// pencil and the bubble beside its title and drops the chevron
|
|
2558
|
+
if (!positioned)
|
|
2559
|
+
return (react_2.default.createElement(recordActions_1.RecordActions, { id: id, onEdit: props.onRowEdit, onActivity: props.onRowActivity, commentCount: (_a = props.commentCounts) === null || _a === void 0 ? void 0 : _a[id] }));
|
|
2560
|
+
return (react_2.default.createElement(react_2.default.Fragment, null,
|
|
2561
|
+
props.onRowOpen && (react_2.default.createElement(recordActions_1.RecordActions, { id: id, onOpen: props.onRowOpen, className: "absolute top-1/2 -translate-y-1/2 z-20 rounded-lg ".concat(chevronBgClass, " pointer-events-none opacity-0 transition-opacity group-hover:pointer-events-auto group-hover:opacity-100 focus-within:pointer-events-auto focus-within:opacity-100 [@media(hover:none)]:pointer-events-auto [@media(hover:none)]:opacity-100"), style: { right: editStripWidth + activityStripWidth + 4 } })),
|
|
2562
|
+
props.onRowEdit &&
|
|
2563
|
+
renderActionStrip("record-edit-strip", activityStripWidth, react_2.default.createElement(recordActions_1.RecordActions, { id: id, onEdit: props.onRowEdit })),
|
|
2564
|
+
props.onRowActivity &&
|
|
2565
|
+
renderActionStrip("record-activity-strip", 0, react_2.default.createElement(recordActions_1.RecordActions, { id: id, onActivity: props.onRowActivity, commentCount: (_b = props.commentCounts) === null || _b === void 0 ? void 0 : _b[id] }))));
|
|
2304
2566
|
};
|
|
2305
2567
|
var handleShowsActionColumn = function () { var _a; return !!((_a = props.deleteable) === null || _a === void 0 ? void 0 : _a.active) || (addData && handleValidateAddColumns()); };
|
|
2306
2568
|
/**
|
|
@@ -2369,7 +2631,7 @@ var NewTable = function (props) {
|
|
|
2369
2631
|
};
|
|
2370
2632
|
// INFO: worked out here, after the Actions and "+" helpers it reads, and
|
|
2371
2633
|
// only read by the render helpers called from the return below
|
|
2372
|
-
var
|
|
2634
|
+
var _51 = handleFitPins(), fittedLeftPins = _51.widths, narrowPins = _51.narrow;
|
|
2373
2635
|
var renderActionColumnHeader = function () {
|
|
2374
2636
|
if (handleShowsActionColumn()) {
|
|
2375
2637
|
var pin = handleGetActionCellPin(true);
|
|
@@ -2494,7 +2756,7 @@ var NewTable = function (props) {
|
|
|
2494
2756
|
};
|
|
2495
2757
|
// INFO: true when maxSelectedCount is set and the current selection has reached the limit
|
|
2496
2758
|
var isMaxReached = !!props.maxSelectedCount &&
|
|
2497
|
-
((
|
|
2759
|
+
((_u = (_t = props.selectedIds) === null || _t === void 0 ? void 0 : _t.length) !== null && _u !== void 0 ? _u : 0) >= props.maxSelectedCount;
|
|
2498
2760
|
// INFO: one desktop row. groupAccent carries the group's colour so member
|
|
2499
2761
|
// rows show the band's colour as a bar down their left edge.
|
|
2500
2762
|
var handleRowDragStart = function (event, rowId) {
|
|
@@ -2549,7 +2811,251 @@ var NewTable = function (props) {
|
|
|
2549
2811
|
event.stopPropagation();
|
|
2550
2812
|
} },
|
|
2551
2813
|
react_2.default.createElement(solid_2.EllipsisVerticalIcon, { className: "h-4 w-4" }))); };
|
|
2552
|
-
|
|
2814
|
+
// INFO: props whose change does not redraw rows — a row is told about its own
|
|
2815
|
+
// record, display row, group and selection directly
|
|
2816
|
+
var ROW_INDEPENDENT_PROPS = new Set([
|
|
2817
|
+
"data",
|
|
2818
|
+
"spaceData",
|
|
2819
|
+
"groups",
|
|
2820
|
+
"groupLoadingStatus",
|
|
2821
|
+
"children",
|
|
2822
|
+
]);
|
|
2823
|
+
// INFO: large or parent-held values compared by identity, not content
|
|
2824
|
+
var IDENTITY_PROPS = new Set(["selectedIds", "commentCounts"]);
|
|
2825
|
+
/**
|
|
2826
|
+
* A number that changes whenever anything every row draws from changes: the
|
|
2827
|
+
* table's props apart from the row data, its edit, drag and width state, and
|
|
2828
|
+
* the column type actions. Rows compare it to decide whether to draw again.
|
|
2829
|
+
*/
|
|
2830
|
+
var handleGetTableVersion = function () {
|
|
2831
|
+
var rawProps = latestPropsRef.current;
|
|
2832
|
+
var propParts = Object.keys(rawProps)
|
|
2833
|
+
.filter(function (key) { return !ROW_INDEPENDENT_PROPS.has(key); })
|
|
2834
|
+
.sort()
|
|
2835
|
+
.map(function (key) {
|
|
2836
|
+
return "".concat(key, "=").concat(IDENTITY_PROPS.has(key)
|
|
2837
|
+
? (0, rowRendering_1.handleGetIdentity)(rawProps[key])
|
|
2838
|
+
: (0, rowRendering_1.handleFingerprint)(rawProps[key]));
|
|
2839
|
+
});
|
|
2840
|
+
var key = __spreadArray(__spreadArray([], propParts, true), [
|
|
2841
|
+
(0, rowRendering_1.handleFingerprint)(columnTypeActions),
|
|
2842
|
+
isFixed,
|
|
2843
|
+
editDataRowId,
|
|
2844
|
+
editDataHeaderKey,
|
|
2845
|
+
editDataIsLoading,
|
|
2846
|
+
modalEditVisible,
|
|
2847
|
+
isDragSelecting,
|
|
2848
|
+
addData,
|
|
2849
|
+
addGroupId,
|
|
2850
|
+
dragArmedRowId,
|
|
2851
|
+
draggingRowId,
|
|
2852
|
+
dropGroupId,
|
|
2853
|
+
referenceLoading,
|
|
2854
|
+
pinViewWidth,
|
|
2855
|
+
(0, rowRendering_1.handleGetIdentity)(referencesOptions),
|
|
2856
|
+
(0, rowRendering_1.handleGetIdentity)(referencesDetails),
|
|
2857
|
+
(0, rowRendering_1.handleGetIdentity)(measuredPinWidths),
|
|
2858
|
+
(0, rowRendering_1.handleGetIdentity)(columnWidths),
|
|
2859
|
+
], false).join("|");
|
|
2860
|
+
if (key !== tableVersionRef.current.key)
|
|
2861
|
+
tableVersionRef.current = {
|
|
2862
|
+
key: key,
|
|
2863
|
+
version: tableVersionRef.current.version + 1,
|
|
2864
|
+
};
|
|
2865
|
+
return tableVersionRef.current.version;
|
|
2866
|
+
};
|
|
2867
|
+
// INFO: on a phone the first column that is not an id is the row's title
|
|
2868
|
+
var handleGetPhoneTitleColumn = function () {
|
|
2869
|
+
var _a;
|
|
2870
|
+
return (_a = flatColumns.find(function (col) { return !/^id$/i.test(col.key) && !/^_id$/i.test(col.key); })) !== null && _a !== void 0 ? _a : flatColumns[0];
|
|
2871
|
+
};
|
|
2872
|
+
var handleGetPhoneCellValue = function (row, spaceRow, key) { return (spaceRow ? spaceRow[key] : resolveValue(row, key)); };
|
|
2873
|
+
// INFO: a dotted key such as "shippingAddress.name" takes its parent
|
|
2874
|
+
// column's title
|
|
2875
|
+
var handleGetSummaryLabel = function (key) {
|
|
2876
|
+
var _a, _b, _c, _d;
|
|
2877
|
+
var parentKey = key.split(".")[0];
|
|
2878
|
+
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);
|
|
2879
|
+
};
|
|
2880
|
+
var handleIsPhoneCellEmpty = function (value) {
|
|
2881
|
+
return value === undefined ||
|
|
2882
|
+
value === null ||
|
|
2883
|
+
value === "" ||
|
|
2884
|
+
(Array.isArray(value) && value.length === 0);
|
|
2885
|
+
};
|
|
2886
|
+
// INFO: renders the hover tooltip card content — image, summary pairs, and tags
|
|
2887
|
+
var renderMobileTooltipContent = function (row, spaceRow) {
|
|
2888
|
+
var _a, _b, _c;
|
|
2889
|
+
var tt = (_a = props.mobileTooltip) === null || _a === void 0 ? void 0 : _a.tooltip;
|
|
2890
|
+
if (!tt)
|
|
2891
|
+
return null;
|
|
2892
|
+
var source = spaceRow !== null && spaceRow !== void 0 ? spaceRow : row;
|
|
2893
|
+
var imageUrl = tt.imageKey
|
|
2894
|
+
? resolveValue(source, tt.imageKey)
|
|
2895
|
+
: undefined;
|
|
2896
|
+
var summaryPairs = ((_b = tt.summaryKeys) !== null && _b !== void 0 ? _b : [])
|
|
2897
|
+
.map(function (key) {
|
|
2898
|
+
var _a;
|
|
2899
|
+
var col = flatColumns.find(function (c) { return c.key === key; });
|
|
2900
|
+
return {
|
|
2901
|
+
key: key,
|
|
2902
|
+
label: (_a = col === null || col === void 0 ? void 0 : col.title) !== null && _a !== void 0 ? _a : key,
|
|
2903
|
+
value: resolveValue(source, key),
|
|
2904
|
+
};
|
|
2905
|
+
})
|
|
2906
|
+
.filter(function (p) { return p.value !== undefined && p.value !== null && p.value !== ""; });
|
|
2907
|
+
var tagValues = ((_c = tt.tagKeys) !== null && _c !== void 0 ? _c : [])
|
|
2908
|
+
.map(function (key) {
|
|
2909
|
+
var val = resolveValueToString(key, source, row);
|
|
2910
|
+
return {
|
|
2911
|
+
key: key,
|
|
2912
|
+
value: val,
|
|
2913
|
+
color: val && tt.tagColors ? tt.tagColors[val] : undefined,
|
|
2914
|
+
};
|
|
2915
|
+
})
|
|
2916
|
+
.filter(function (t) { return !!t.value; });
|
|
2917
|
+
if (!imageUrl && summaryPairs.length === 0 && tagValues.length === 0)
|
|
2918
|
+
return null;
|
|
2919
|
+
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") },
|
|
2920
|
+
react_2.default.createElement("div", { className: "flex gap-3" },
|
|
2921
|
+
imageUrl && (react_2.default.createElement("img", { src: String(imageUrl), alt: "", className: "h-14 w-14 rounded-lg object-cover flex-shrink-0" })),
|
|
2922
|
+
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" },
|
|
2923
|
+
react_2.default.createElement("span", { className: "text-[11px] uppercase tracking-wide ".concat(props.darkMode ? "text-gray-400" : "text-gray-400") }, p.label),
|
|
2924
|
+
react_2.default.createElement("span", { className: "text-xs font-medium ".concat(props.darkMode ? "text-gray-200" : "text-gray-700", " truncate") }, typeof p.value === "object"
|
|
2925
|
+
? JSON.stringify(p.value)
|
|
2926
|
+
: String(p.value)))); }))),
|
|
2927
|
+
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) {
|
|
2928
|
+
var _a;
|
|
2929
|
+
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" }));
|
|
2930
|
+
})))));
|
|
2931
|
+
};
|
|
2932
|
+
// INFO: a phone row reads like a mail inbox — the title with a pill and a
|
|
2933
|
+
// date, a few key values under it, and an arrow that opens every field. A
|
|
2934
|
+
// host's titleAdjacent keys pick the pill, the date slot and the second
|
|
2935
|
+
// line; without them the view's column order does
|
|
2936
|
+
var renderPhoneRowContent = function (row, index, groupAccent, group) {
|
|
2937
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
2938
|
+
var spaceRow = (_a = props.spaceData) === null || _a === void 0 ? void 0 : _a[index];
|
|
2939
|
+
var titleCol = handleGetPhoneTitleColumn();
|
|
2940
|
+
var titleAdjacent = (_b = props.mobileTooltip) === null || _b === void 0 ? void 0 : _b.titleAdjacent;
|
|
2941
|
+
var isSelected = ((_d = (_c = props.selectedIds) === null || _c === void 0 ? void 0 : _c.includes(row.id)) !== null && _d !== void 0 ? _d : false) ||
|
|
2942
|
+
((_e = props.selectAll) !== null && _e !== void 0 ? _e : false);
|
|
2943
|
+
var handleRenderValue = function (key) {
|
|
2944
|
+
return (0, readModule_1.renderEachRowDataBasedOnDataType)(key, handleGetPhoneCellValue(row, spaceRow, key), props.bareSettings, true, props.disableEllipsisOnLongWord);
|
|
2945
|
+
};
|
|
2946
|
+
var cardTitle = titleCol
|
|
2947
|
+
? spaceRow
|
|
2948
|
+
? spaceRow[titleCol.key]
|
|
2949
|
+
: resolveValue(row, titleCol.key) || row.id
|
|
2950
|
+
: "";
|
|
2951
|
+
var picked = (0, listRowFields_1.handlePickListRowFields)(flatColumns.map(function (col) { return ({
|
|
2952
|
+
key: col.key,
|
|
2953
|
+
type: col.ratingMax ? "rating" : col.type,
|
|
2954
|
+
}); }), titleCol === null || titleCol === void 0 ? void 0 : titleCol.key, function (key) {
|
|
2955
|
+
// INFO: under a group header, the column the rows are grouped by only
|
|
2956
|
+
// repeats the header, so it is left off the row
|
|
2957
|
+
return (!!group && key === props.groupColumnKey) ||
|
|
2958
|
+
handleIsPhoneCellEmpty(handleGetPhoneCellValue(row, spaceRow, key));
|
|
2959
|
+
});
|
|
2960
|
+
var badge = undefined;
|
|
2961
|
+
if (titleAdjacent === null || titleAdjacent === void 0 ? void 0 : titleAdjacent.tagKey) {
|
|
2962
|
+
var tagValue = resolveValueToString(titleAdjacent.tagKey, spaceRow !== null && spaceRow !== void 0 ? spaceRow : row, row);
|
|
2963
|
+
if (tagValue)
|
|
2964
|
+
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" }));
|
|
2965
|
+
}
|
|
2966
|
+
else if (picked.badgeKey) {
|
|
2967
|
+
var badgeCol = flatColumns.find(function (col) { return col.key === picked.badgeKey; });
|
|
2968
|
+
var rawValue = resolveValue(row, picked.badgeKey);
|
|
2969
|
+
var displayValue = handleGetPhoneCellValue(row, spaceRow, picked.badgeKey);
|
|
2970
|
+
var colour = badgeCol
|
|
2971
|
+
? handleGetListColour(badgeCol, rawValue)
|
|
2972
|
+
: undefined;
|
|
2973
|
+
// INFO: a plain value is drawn as a small pill in its option's colour;
|
|
2974
|
+
// a host's own element is kept as it is
|
|
2975
|
+
badge =
|
|
2976
|
+
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));
|
|
2977
|
+
}
|
|
2978
|
+
var trailing = undefined;
|
|
2979
|
+
if (titleAdjacent === null || titleAdjacent === void 0 ? void 0 : titleAdjacent.trailingKey) {
|
|
2980
|
+
var trailingValue = resolveValueToString(titleAdjacent.trailingKey, spaceRow !== null && spaceRow !== void 0 ? spaceRow : row, row);
|
|
2981
|
+
if (trailingValue)
|
|
2982
|
+
trailing = String(trailingValue);
|
|
2983
|
+
}
|
|
2984
|
+
else if (!titleAdjacent && picked.dateKey) {
|
|
2985
|
+
// INFO: a host that formats this date itself keeps its format
|
|
2986
|
+
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)))
|
|
2987
|
+
? handleRenderValue(picked.dateKey)
|
|
2988
|
+
: (0, listRowFields_1.handleFormatListRowDate)(resolveValue(row, picked.dateKey));
|
|
2989
|
+
}
|
|
2990
|
+
// INFO: a host's summary keys keep to the columns the view shows, and the
|
|
2991
|
+
// pill's column is not repeated under the title
|
|
2992
|
+
var subtitleKeys = (titleAdjacent === null || titleAdjacent === void 0 ? void 0 : titleAdjacent.summaryKeys)
|
|
2993
|
+
? titleAdjacent.summaryKeys.filter(function (key) {
|
|
2994
|
+
var parentKey = key.split(".")[0];
|
|
2995
|
+
return (key !== (titleCol === null || titleCol === void 0 ? void 0 : titleCol.key) &&
|
|
2996
|
+
key !== titleAdjacent.tagKey &&
|
|
2997
|
+
flatColumns.some(function (col) { return col.key === key || col.key === parentKey; }) &&
|
|
2998
|
+
!!resolveValueToString(key, spaceRow !== null && spaceRow !== void 0 ? spaceRow : row, row));
|
|
2999
|
+
})
|
|
3000
|
+
: titleAdjacent
|
|
3001
|
+
? []
|
|
3002
|
+
: picked.subtitleKeys;
|
|
3003
|
+
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 },
|
|
3004
|
+
keyIndex > 0 && " · ",
|
|
3005
|
+
(titleAdjacent === null || titleAdjacent === void 0 ? void 0 : titleAdjacent.summaryKeys) ? (react_2.default.createElement(react_2.default.Fragment, null,
|
|
3006
|
+
react_2.default.createElement("span", { className: props.darkMode ? "text-gray-500" : "text-gray-400" },
|
|
3007
|
+
handleGetSummaryLabel(key),
|
|
3008
|
+
":"),
|
|
3009
|
+
" ",
|
|
3010
|
+
resolveValueToString(key, spaceRow !== null && spaceRow !== void 0 ? spaceRow : row, row))) : (handleRenderValue(key)))); }))) : undefined;
|
|
3011
|
+
var detailList = flatColumns.map(function (col) { return ({
|
|
3012
|
+
id: col.key,
|
|
3013
|
+
title: col.title,
|
|
3014
|
+
text: handleRenderValue(col.key),
|
|
3015
|
+
}); });
|
|
3016
|
+
var tooltipContent = ((_l = props.mobileTooltip) === null || _l === void 0 ? void 0 : _l.tooltip)
|
|
3017
|
+
? renderMobileTooltipContent(row, spaceRow)
|
|
3018
|
+
: null;
|
|
3019
|
+
return (react_2.default.createElement("tr", { key: row.id, "data-dtw-record-id": row.id, className: groupAccent
|
|
3020
|
+
? "border-l-4 ".concat((_m = ACCENT_CLASS[groupAccent]) !== null && _m !== void 0 ? _m : ACCENT_CLASS.default)
|
|
3021
|
+
: "" },
|
|
3022
|
+
react_2.default.createElement("td", { className: "p-0" },
|
|
3023
|
+
react_2.default.createElement("div", { className: "relative group/tooltip" },
|
|
3024
|
+
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
|
|
3025
|
+
? renderCheckbox(isSelected, function () { }, function (e) { return handleSelectRow(row.id, e); }, "w-4 h-4 ".concat(isMaxReached && !isSelected ? "opacity-50 cursor-not-allowed" : "cursor-pointer"))
|
|
3026
|
+
: undefined, actions: hasRowActions ? renderActivityButton(row.id) : undefined, renderContentWrapper: props.newTabUrl
|
|
3027
|
+
? function (content) {
|
|
3028
|
+
var _a;
|
|
3029
|
+
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) {
|
|
3030
|
+
if (props.onClickRow && !e.metaKey && !e.ctrlKey) {
|
|
3031
|
+
e.preventDefault();
|
|
3032
|
+
e.stopPropagation();
|
|
3033
|
+
props.onClickRow(row.id, row, spaceRow);
|
|
3034
|
+
}
|
|
3035
|
+
} }, content));
|
|
3036
|
+
}
|
|
3037
|
+
: undefined, onClick: function (e) {
|
|
3038
|
+
var _a, _b;
|
|
3039
|
+
// INFO: a control in the row — the checkbox, a link, a button
|
|
3040
|
+
// — does its own thing and does not open the record
|
|
3041
|
+
var target = e.target;
|
|
3042
|
+
if ((_a = target.closest) === null || _a === void 0 ? void 0 : _a.call(target, "a[href], button, input, select, textarea, label"))
|
|
3043
|
+
return;
|
|
3044
|
+
(_b = props.onClickRow) === null || _b === void 0 ? void 0 : _b.call(props, row.id, row, spaceRow);
|
|
3045
|
+
}, isClickable: !!props.onClickRow || !!props.newTabUrl, isSelected: isSelected, darkMode: props.darkMode }),
|
|
3046
|
+
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))))));
|
|
3047
|
+
};
|
|
3048
|
+
var renderDesktopRow = function (row, index, tableVersion, groupAccent, dropGroup) {
|
|
3049
|
+
var _a, _b, _c, _d;
|
|
3050
|
+
var isSelected = ((_b = (_a = props.selectedIds) === null || _a === void 0 ? void 0 : _a.includes(row.id)) !== null && _b !== void 0 ? _b : false) ||
|
|
3051
|
+
((_c = props.selectAll) !== null && _c !== void 0 ? _c : false);
|
|
3052
|
+
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 () {
|
|
3053
|
+
return props.mobileView
|
|
3054
|
+
? renderPhoneRowContent(row, index, groupAccent, dropGroup)
|
|
3055
|
+
: renderDesktopRowContent(row, index, groupAccent, dropGroup);
|
|
3056
|
+
} }));
|
|
3057
|
+
};
|
|
3058
|
+
var renderDesktopRowContent = function (row, index, groupAccent, dropGroup) {
|
|
2553
3059
|
var _a, _b, _c, _d, _e;
|
|
2554
3060
|
var spaceRow = (_a = props.spaceData) === null || _a === void 0 ? void 0 : _a[index];
|
|
2555
3061
|
var isSelected = ((_c = (_b = props.selectedIds) === null || _b === void 0 ? void 0 : _b.includes(row.id)) !== null && _c !== void 0 ? _c : false) ||
|
|
@@ -2588,7 +3094,20 @@ var NewTable = function (props) {
|
|
|
2588
3094
|
? "opacity-50 cursor-not-allowed"
|
|
2589
3095
|
: ""))),
|
|
2590
3096
|
flatColumns.map(function (col, colIndex) {
|
|
2591
|
-
var
|
|
3097
|
+
var dragHandle = colIndex === 0 && canDragRows && dropGroup
|
|
3098
|
+
? renderRowDragHandle(row.id)
|
|
3099
|
+
: null;
|
|
3100
|
+
// INFO: keep the action outside links and inline editors in every
|
|
3101
|
+
// cell variant
|
|
3102
|
+
var handleDecorateCell = function (cell) {
|
|
3103
|
+
var _a, _b, _c, _d, _e;
|
|
3104
|
+
if (colIndex !== 0 || (!hasRowActions && !dragHandle))
|
|
3105
|
+
return cell;
|
|
3106
|
+
return react_2.default.cloneElement(cell, {
|
|
3107
|
+
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 : ""),
|
|
3108
|
+
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" }),
|
|
3109
|
+
}, cell.props.children, dragHandle, renderActivityButton(row.id, true, "".concat(rowBgClass, " ").concat(isRowHoverable ? (props.darkMode ? "group-hover:bg-gray-700" : "group-hover:bg-gray-100") : "")));
|
|
3110
|
+
};
|
|
2592
3111
|
var renderDataCell = function () {
|
|
2593
3112
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9;
|
|
2594
3113
|
// INFO: a coloured list cell is this table's to render, so it takes
|
|
@@ -2741,30 +3260,27 @@ var NewTable = function (props) {
|
|
|
2741
3260
|
e.stopPropagation();
|
|
2742
3261
|
handleEditDataOnClick(row.id, col.key, rowData);
|
|
2743
3262
|
} }, renderTagLine(col, cellValue))));
|
|
2744
|
-
// INFO:
|
|
2745
|
-
//
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
}
|
|
2753
|
-
return (react_2.default.createElement("td", __assign({ key: col.key }, (isEditable ? handleCellHoverProps(row.id, col.key) : {}), { "data-cell-key": col.key, "data-pin-key": leftPinned.includes(col.key) || rightPinned.includes(col.key)
|
|
3263
|
+
// INFO: coloured list cells are exempt from the hover swap — read and
|
|
3264
|
+
// edit are the same filled pill, so there is nothing to swap to
|
|
3265
|
+
var bareOverride = isEditable
|
|
3266
|
+
? (_6 = (_5 = props.bareSettings) === null || _5 === void 0 ? void 0 : _5.bareListDescription) === null || _6 === void 0 ? void 0 : _6.call(_5, col.key, cellValue)
|
|
3267
|
+
: undefined;
|
|
3268
|
+
if (isEditable && !bareOverride && handleColumnShowsTags(col))
|
|
3269
|
+
return renderEditDataInputs(colIndex, col, rowData, row.id, rowBgClass, isRowHoverable);
|
|
3270
|
+
var readCell = (react_2.default.createElement("td", { key: col.key, "data-cell-key": col.key, "data-pin-key": leftPinned.includes(col.key) || rightPinned.includes(col.key)
|
|
2754
3271
|
? col.key
|
|
2755
|
-
: undefined, className: "".concat(cellPadding, " ").concat(isEditable ? "".concat(editCellMinHeight, " align-middle ").concat(handleCellMinWidth(col.type)) : "", " text-sm ").concat(colIndex === 0 && props.onClickRow ? titleFontColor : cellFontColor, " ").concat(handleReadCellWidthClass(col), " ").concat((_8 = (_7 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _7 === void 0 ? void 0 : _7.className) !== null && _8 !== void 0 ? _8 : ""), style: (_9 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _9 === void 0 ? void 0 : _9.style, "data-row-link-cell": props.newTabUrl && props.onClickRow ? "" : undefined }
|
|
3272
|
+
: 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))));
|
|
3273
|
+
if (!isEditable || bareOverride)
|
|
3274
|
+
return readCell;
|
|
3275
|
+
// INFO: the plain text cell until hovered or mid-edit, then its input
|
|
3276
|
+
return (react_2.default.createElement(rowRendering_1.NewTableHoverCell, { key: col.key, editing: handleIsCellEditing(row.id, col.key), renderRead: function () { return handleDecorateCell(readCell); }, renderLive: function () {
|
|
3277
|
+
return handleDecorateCell(renderEditDataInputs(colIndex, col, rowData, row.id, rowBgClass, isRowHoverable));
|
|
3278
|
+
} }));
|
|
2756
3279
|
};
|
|
2757
3280
|
var cell = renderDataCell();
|
|
2758
|
-
|
|
2759
|
-
?
|
|
2760
|
-
:
|
|
2761
|
-
if (colIndex !== 0 || (!hasRowActions && !dragHandle))
|
|
2762
|
-
return cell;
|
|
2763
|
-
// Keep the action outside links and inline editors in every cell variant.
|
|
2764
|
-
return react_2.default.cloneElement(cell, {
|
|
2765
|
-
className: "".concat(cell.props.className, " ").concat((_a = TITLE_ACTIONS_PADDING_CLASS[titleActionsWidth]) !== null && _a !== void 0 ? _a : "", " ").concat((_c = (_b = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _b === void 0 ? void 0 : _b.className) !== null && _c !== void 0 ? _c : ""),
|
|
2766
|
-
style: __assign(__assign(__assign(__assign({}, cell.props.style), { paddingRight: titleActionsWidth }), (_d = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _d === void 0 ? void 0 : _d.style), { position: getPinProps(col.key, false) ? "sticky" : "relative" }),
|
|
2767
|
-
}, cell.props.children, dragHandle, renderActivityButton(row.id, true));
|
|
3281
|
+
return cell.type === rowRendering_1.NewTableHoverCell
|
|
3282
|
+
? cell
|
|
3283
|
+
: handleDecorateCell(cell);
|
|
2768
3284
|
}),
|
|
2769
3285
|
renderAddColumnCell(rowBgClass, isRowHoverable),
|
|
2770
3286
|
renderActionColumnCell(row.id, rowBgClass, isRowHoverable)));
|
|
@@ -2772,21 +3288,63 @@ var NewTable = function (props) {
|
|
|
2772
3288
|
// INFO: with groups, each group is a tinted band row (chevron, title, count)
|
|
2773
3289
|
// followed by its member rows; collapsing a band hides them. Without groups,
|
|
2774
3290
|
// the plain row list.
|
|
3291
|
+
// INFO: a spacer row standing in for rows not drawn. The first one of a
|
|
3292
|
+
// group marks where its rows start, so it is drawn even at height 0
|
|
3293
|
+
var renderVirtualSpacer = function (key, height, columnCount, startOf) { return (react_2.default.createElement("tr", { key: key, "aria-hidden": "true", "data-virtual-spacer": "", "data-virtual-start": startOf, className: "border-0" },
|
|
3294
|
+
react_2.default.createElement("td", { colSpan: columnCount, style: { height: height, padding: 0, border: 0 } }))); };
|
|
3295
|
+
/**
|
|
3296
|
+
* A group's rows. A group with fewer than VIRTUAL_MIN_ROWS loaded rows draws
|
|
3297
|
+
* them all; a larger one draws only the rows near the screen and the row
|
|
3298
|
+
* being edited, with spacers as tall as the rows they stand in for.
|
|
3299
|
+
*/
|
|
3300
|
+
var renderMemberRows = function (groupKey, memberIndexes, tableVersion, columnCount, virtualGroups, groupAccent, group) {
|
|
3301
|
+
var _a;
|
|
3302
|
+
var renderMember = function (rowIndex) {
|
|
3303
|
+
return renderDesktopRow(props.data[rowIndex], rowIndex, tableVersion, groupAccent, group);
|
|
3304
|
+
};
|
|
3305
|
+
if (memberIndexes.length < rowRendering_1.VIRTUAL_MIN_ROWS)
|
|
3306
|
+
return memberIndexes.map(renderMember);
|
|
3307
|
+
var rowIds = memberIndexes.map(function (rowIndex) { return props.data[rowIndex].id; });
|
|
3308
|
+
virtualGroups.push({ id: groupKey, rowIds: rowIds });
|
|
3309
|
+
var offsets = (0, rowRendering_1.handleBuildRowOffsets)(rowIds, rowHeightsRef.current, rowEstimateRef.current);
|
|
3310
|
+
var editingIndex = editDataRowId ? rowIds.indexOf(editDataRowId) : -1;
|
|
3311
|
+
var segments = (0, rowRendering_1.handleBuildRowSegments)(offsets, (_a = virtualRanges[groupKey]) !== null && _a !== void 0 ? _a : [0, rowRendering_1.VIRTUAL_INITIAL_ROWS], editingIndex >= 0 ? [editingIndex] : []);
|
|
3312
|
+
var firstGap = "gap" in segments[0] ? segments[0].gap : 0;
|
|
3313
|
+
var rendered = [
|
|
3314
|
+
renderVirtualSpacer("virtual-".concat(groupKey, "-start"), firstGap, columnCount, groupKey),
|
|
3315
|
+
];
|
|
3316
|
+
segments.forEach(function (segment, segmentIndex) {
|
|
3317
|
+
if ("gap" in segment) {
|
|
3318
|
+
if (segmentIndex > 0)
|
|
3319
|
+
rendered.push(renderVirtualSpacer("virtual-".concat(groupKey, "-").concat(segmentIndex), segment.gap, columnCount));
|
|
3320
|
+
return;
|
|
3321
|
+
}
|
|
3322
|
+
segment.rows.forEach(function (memberIndex) {
|
|
3323
|
+
return rendered.push(renderMember(memberIndexes[memberIndex]));
|
|
3324
|
+
});
|
|
3325
|
+
});
|
|
3326
|
+
return rendered;
|
|
3327
|
+
};
|
|
2775
3328
|
var renderDesktopRows = function () {
|
|
2776
3329
|
var _a;
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
var indexById = new Map(props.data.map(function (row, index) { return [row.id, index]; }));
|
|
3330
|
+
var tableVersion = handleGetTableVersion();
|
|
3331
|
+
var virtualGroups = [];
|
|
3332
|
+
virtualGroupsRef.current = virtualGroups;
|
|
2781
3333
|
// INFO: a group band spans the whole row, so its colSpan has to count the
|
|
2782
3334
|
// same extra cells the rows actually render — the checkbox, the add-column
|
|
2783
3335
|
// spacer and the action cell. It was a bare +1 before, which happened to
|
|
2784
3336
|
// match a deletable table and was wrong for every other combination; with
|
|
2785
3337
|
// add-column on it left the band a column short of the row.
|
|
2786
|
-
var columnCount =
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
3338
|
+
var columnCount = props.mobileView
|
|
3339
|
+
? 1
|
|
3340
|
+
: flatColumns.length +
|
|
3341
|
+
(props.checkbox ? 1 : 0) +
|
|
3342
|
+
(((_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.addColumnEnabled) ? 1 : 0) +
|
|
3343
|
+
(handleShowsActionColumn() ? 1 : 0);
|
|
3344
|
+
if (!props.groups || props.groups.length === 0) {
|
|
3345
|
+
return renderMemberRows("all", props.data.map(function (_row, index) { return index; }), tableVersion, columnCount, virtualGroups);
|
|
3346
|
+
}
|
|
3347
|
+
var indexById = new Map(props.data.map(function (row, index) { return [row.id, index]; }));
|
|
2790
3348
|
return props.groups.map(function (group) {
|
|
2791
3349
|
var _a, _b, _c, _d, _e;
|
|
2792
3350
|
var colourKey = (_a = group.colour) !== null && _a !== void 0 ? _a : "none";
|
|
@@ -2819,16 +3377,16 @@ var NewTable = function (props) {
|
|
|
2819
3377
|
react_2.default.createElement("span", null, group.title),
|
|
2820
3378
|
react_2.default.createElement("span", { className: "rounded-full bg-white/70 px-2 py-0.5 text-[11px] font-medium normal-case tracking-normal" }, (_e = (_d = (_c = group.summary) === null || _c === void 0 ? void 0 : _c.count) !== null && _d !== void 0 ? _d : group.count) !== null && _e !== void 0 ? _e : memberIndexes.length)))),
|
|
2821
3379
|
!isCollapsed &&
|
|
2822
|
-
memberIndexes
|
|
2823
|
-
.slice(0, handleGetGroupVisibleCount(group.id))
|
|
2824
|
-
.map(function (rowIndex) {
|
|
2825
|
-
return renderDesktopRow(props.data[rowIndex], rowIndex, colourKey, group);
|
|
2826
|
-
}),
|
|
3380
|
+
renderMemberRows(group.id, memberIndexes.slice(0, handleGetGroupVisibleCount(group.id)), tableVersion, columnCount, virtualGroups, colourKey, group),
|
|
2827
3381
|
renderGroupShowMoreRow(group.id, memberIndexes.length, columnCount, isCollapsed),
|
|
2828
3382
|
renderGroupLoadMoreRow(group.id, columnCount, isCollapsed, isPending),
|
|
2829
3383
|
renderGroupPagerRow(group, columnCount, isCollapsed),
|
|
2830
|
-
!
|
|
2831
|
-
|
|
3384
|
+
!props.mobileView &&
|
|
3385
|
+
!isCollapsed &&
|
|
3386
|
+
!isPending &&
|
|
3387
|
+
renderGroupAddRow(group, colourKey),
|
|
3388
|
+
!props.mobileView &&
|
|
3389
|
+
!isCollapsed &&
|
|
2832
3390
|
!isPending &&
|
|
2833
3391
|
renderGroupSummaryRow(group, colourKey)));
|
|
2834
3392
|
});
|
|
@@ -3018,6 +3576,22 @@ var NewTable = function (props) {
|
|
|
3018
3576
|
var draggable = (advSettings === null || advSettings === void 0 ? void 0 : advSettings.dragEnabled) ? true : false;
|
|
3019
3577
|
var droppable = (advSettings === null || advSettings === void 0 ? void 0 : advSettings.dragEnabled) ? true : false;
|
|
3020
3578
|
var sortClassname = "flex-shrink-0 h-4 w-4 ml-3 cursor-pointer";
|
|
3579
|
+
// INFO: a reference column gets a solid line under its header and a
|
|
3580
|
+
// lookup a dashed one, so linked columns stand out without taking header
|
|
3581
|
+
// space; the pattern, not only the colour, tells them apart
|
|
3582
|
+
var handleGetHeaderLink = function (col) {
|
|
3583
|
+
if ((0, lookup_1.handleIsLookupDerived)(col))
|
|
3584
|
+
return "lookup";
|
|
3585
|
+
if (col.type && lookup_1.LOOKUP_REFERENCE_TYPES.includes(col.type))
|
|
3586
|
+
return "reference";
|
|
3587
|
+
return null;
|
|
3588
|
+
};
|
|
3589
|
+
var renderHeaderLink = function (col) {
|
|
3590
|
+
var link = handleGetHeaderLink(col);
|
|
3591
|
+
if (!link)
|
|
3592
|
+
return null;
|
|
3593
|
+
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") }));
|
|
3594
|
+
};
|
|
3021
3595
|
var renderHeaderIcons = function (col) {
|
|
3022
3596
|
var _a, _b, _c;
|
|
3023
3597
|
var sortIcon = null;
|
|
@@ -3115,6 +3689,7 @@ var NewTable = function (props) {
|
|
|
3115
3689
|
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 : "")) },
|
|
3116
3690
|
col.title,
|
|
3117
3691
|
renderHeaderIcons(col)),
|
|
3692
|
+
renderHeaderLink(col),
|
|
3118
3693
|
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(); } },
|
|
3119
3694
|
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") }))));
|
|
3120
3695
|
}),
|
|
@@ -3138,10 +3713,11 @@ var NewTable = function (props) {
|
|
|
3138
3713
|
if (groupData && groupData.length > 0) {
|
|
3139
3714
|
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));
|
|
3140
3715
|
}
|
|
3141
|
-
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 },
|
|
3716
|
+
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 },
|
|
3142
3717
|
react_2.default.createElement("div", { className: "group/header flex flex-row items-center ".concat((_d = col.width) !== null && _d !== void 0 ? _d : "") },
|
|
3143
3718
|
col.title,
|
|
3144
|
-
renderHeaderIcons(col))
|
|
3719
|
+
renderHeaderIcons(col)),
|
|
3720
|
+
renderHeaderLink(col)));
|
|
3145
3721
|
}),
|
|
3146
3722
|
renderAddColumnHeader(),
|
|
3147
3723
|
renderActionColumnHeader()),
|
|
@@ -3159,113 +3735,7 @@ var NewTable = function (props) {
|
|
|
3159
3735
|
};
|
|
3160
3736
|
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 : "") })); };
|
|
3161
3737
|
if (props.mobileView) {
|
|
3162
|
-
var
|
|
3163
|
-
return /^id$/i.test(c.key) || /^_id$/i.test(c.key);
|
|
3164
|
-
};
|
|
3165
|
-
var titleCol_1 = (_u = flatColumns.find(function (c) { return !isIdLike_1(c); })) !== null && _u !== void 0 ? _u : flatColumns[0];
|
|
3166
|
-
var expandHeaderBg_1 = props.darkMode ? "bg-gray-700" : "bg-gray-100";
|
|
3167
|
-
var expandHeaderFontColor_1 = props.darkMode ? "text-white" : "";
|
|
3168
|
-
var headerBgColor_1 = props.darkMode
|
|
3169
|
-
? ((_v = props.darkModeBg) !== null && _v !== void 0 ? _v : "bg-gray-900")
|
|
3170
|
-
: "";
|
|
3171
|
-
var headerFontColor_1 = props.darkMode ? "text-white" : "";
|
|
3172
|
-
// INFO: renders tag + trailing text adjacent to the Collapse title
|
|
3173
|
-
var renderMobileTitleAdjacent_1 = function (row, spaceRow) {
|
|
3174
|
-
var _a;
|
|
3175
|
-
var ta = (_a = props.mobileTooltip) === null || _a === void 0 ? void 0 : _a.titleAdjacent;
|
|
3176
|
-
if (!ta)
|
|
3177
|
-
return undefined;
|
|
3178
|
-
var source = spaceRow !== null && spaceRow !== void 0 ? spaceRow : row;
|
|
3179
|
-
var tagValue = ta.tagKey
|
|
3180
|
-
? resolveValueToString(ta.tagKey, source, row)
|
|
3181
|
-
: "";
|
|
3182
|
-
var trailingValue = ta.trailingKey
|
|
3183
|
-
? resolveValueToString(ta.trailingKey, source, row)
|
|
3184
|
-
: "";
|
|
3185
|
-
if (!tagValue && !trailingValue)
|
|
3186
|
-
return undefined;
|
|
3187
|
-
var tagColor = tagValue && ta.tagColor ? ta.tagColor[tagValue] : undefined;
|
|
3188
|
-
return (react_2.default.createElement("div", { className: "flex items-center gap-2 mr-2" },
|
|
3189
|
-
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" })),
|
|
3190
|
-
trailingValue && (react_2.default.createElement("span", { className: "text-xs whitespace-nowrap ".concat(props.darkMode ? "text-gray-300" : "text-gray-500") }, String(trailingValue)))));
|
|
3191
|
-
};
|
|
3192
|
-
// INFO: second-line label + value summary under the title (while collapsed),
|
|
3193
|
-
// driven by titleAdjacent.summaryKeys. Reuses the tooltip's summary layout.
|
|
3194
|
-
var renderMobileTitleSummary_1 = function (row, spaceRow) {
|
|
3195
|
-
var _a, _b;
|
|
3196
|
-
var ta = (_a = props.mobileTooltip) === null || _a === void 0 ? void 0 : _a.titleAdjacent;
|
|
3197
|
-
// INFO: a column the view hides, or the one already drawn as the title,
|
|
3198
|
-
// stays out of the line under the title
|
|
3199
|
-
var keys = (_b = ta === null || ta === void 0 ? void 0 : ta.summaryKeys) === null || _b === void 0 ? void 0 : _b.filter(function (key) {
|
|
3200
|
-
var parentKey = key.split(".")[0];
|
|
3201
|
-
return (key !== (titleCol_1 === null || titleCol_1 === void 0 ? void 0 : titleCol_1.key) &&
|
|
3202
|
-
flatColumns.some(function (col) { return col.key === key || col.key === parentKey; }));
|
|
3203
|
-
});
|
|
3204
|
-
if (!ta || !keys || keys.length === 0)
|
|
3205
|
-
return undefined;
|
|
3206
|
-
var source = spaceRow !== null && spaceRow !== void 0 ? spaceRow : row;
|
|
3207
|
-
var pairs = keys
|
|
3208
|
-
.map(function (key) {
|
|
3209
|
-
var _a, _b, _c, _d;
|
|
3210
|
-
// INFO: label from the column title, falling back to the parent
|
|
3211
|
-
// column for a dotted key (e.g. "shippingAddress.name").
|
|
3212
|
-
var parentKey = key.split(".")[0];
|
|
3213
|
-
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;
|
|
3214
|
-
return { key: key, label: label, value: resolveValueToString(key, source, row) };
|
|
3215
|
-
})
|
|
3216
|
-
.filter(function (p) { return p.value !== undefined && p.value !== null && p.value !== ""; });
|
|
3217
|
-
if (pairs.length === 0)
|
|
3218
|
-
return undefined;
|
|
3219
|
-
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" },
|
|
3220
|
-
react_2.default.createElement("span", { className: "text-[11px] uppercase tracking-wide text-gray-400" }, p.label),
|
|
3221
|
-
react_2.default.createElement("span", { className: "text-xs ".concat(props.darkMode ? "text-gray-200" : "text-gray-700") }, p.value))); })));
|
|
3222
|
-
};
|
|
3223
|
-
// INFO: renders the hover tooltip card content — image, summary pairs, and tags
|
|
3224
|
-
var renderMobileTooltipContent_1 = function (row, spaceRow) {
|
|
3225
|
-
var _a, _b, _c;
|
|
3226
|
-
var tt = (_a = props.mobileTooltip) === null || _a === void 0 ? void 0 : _a.tooltip;
|
|
3227
|
-
if (!tt)
|
|
3228
|
-
return null;
|
|
3229
|
-
var source = spaceRow !== null && spaceRow !== void 0 ? spaceRow : row;
|
|
3230
|
-
var imageUrl = tt.imageKey
|
|
3231
|
-
? resolveValue(source, tt.imageKey)
|
|
3232
|
-
: undefined;
|
|
3233
|
-
var summaryPairs = ((_b = tt.summaryKeys) !== null && _b !== void 0 ? _b : [])
|
|
3234
|
-
.map(function (key) {
|
|
3235
|
-
var _a;
|
|
3236
|
-
var col = flatColumns.find(function (c) { return c.key === key; });
|
|
3237
|
-
return {
|
|
3238
|
-
key: key,
|
|
3239
|
-
label: (_a = col === null || col === void 0 ? void 0 : col.title) !== null && _a !== void 0 ? _a : key,
|
|
3240
|
-
value: resolveValue(source, key),
|
|
3241
|
-
};
|
|
3242
|
-
})
|
|
3243
|
-
.filter(function (p) { return p.value !== undefined && p.value !== null && p.value !== ""; });
|
|
3244
|
-
var tagValues = ((_c = tt.tagKeys) !== null && _c !== void 0 ? _c : [])
|
|
3245
|
-
.map(function (key) {
|
|
3246
|
-
var val = resolveValueToString(key, source, row);
|
|
3247
|
-
return {
|
|
3248
|
-
key: key,
|
|
3249
|
-
value: val,
|
|
3250
|
-
color: val && tt.tagColors ? tt.tagColors[val] : undefined,
|
|
3251
|
-
};
|
|
3252
|
-
})
|
|
3253
|
-
.filter(function (t) { return !!t.value; });
|
|
3254
|
-
if (!imageUrl && summaryPairs.length === 0 && tagValues.length === 0)
|
|
3255
|
-
return null;
|
|
3256
|
-
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") },
|
|
3257
|
-
react_2.default.createElement("div", { className: "flex gap-3" },
|
|
3258
|
-
imageUrl && (react_2.default.createElement("img", { src: String(imageUrl), alt: "", className: "h-14 w-14 rounded-lg object-cover flex-shrink-0" })),
|
|
3259
|
-
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" },
|
|
3260
|
-
react_2.default.createElement("span", { className: "text-[11px] uppercase tracking-wide ".concat(props.darkMode ? "text-gray-400" : "text-gray-400") }, p.label),
|
|
3261
|
-
react_2.default.createElement("span", { className: "text-xs font-medium ".concat(props.darkMode ? "text-gray-200" : "text-gray-700", " truncate") }, typeof p.value === "object"
|
|
3262
|
-
? JSON.stringify(p.value)
|
|
3263
|
-
: String(p.value)))); }))),
|
|
3264
|
-
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) {
|
|
3265
|
-
var _a;
|
|
3266
|
-
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" }));
|
|
3267
|
-
})))));
|
|
3268
|
-
};
|
|
3738
|
+
var hasPhoneGroups = !!((_v = props.groups) === null || _v === void 0 ? void 0 : _v.length);
|
|
3269
3739
|
return (react_2.default.createElement("div", null,
|
|
3270
3740
|
react_2.default.createElement("div", { className: "w-full ".concat(((_w = props.mobileTooltip) === null || _w === void 0 ? void 0 : _w.tooltip) ? "overflow-visible" : "overflow-hidden", " ").concat(isFlat
|
|
3271
3741
|
? ""
|
|
@@ -3278,60 +3748,9 @@ var NewTable = function (props) {
|
|
|
3278
3748
|
props.loading &&
|
|
3279
3749
|
Array.from({ length: 3 }).map(function (_, i) { return (react_2.default.createElement("div", { key: "skeleton-".concat(i), className: "p-4" },
|
|
3280
3750
|
react_2.default.createElement("div", { className: "h-5 w-3/4 rounded-md animate-pulse ".concat(props.darkMode ? "bg-gray-700" : "bg-gray-200") }))); }),
|
|
3281
|
-
!props.loading && props.data.length === 0 && (react_2.default.createElement("p", { className: "p-4 text-center text-sm ".concat(cellFontColor) }, (_z = props.emptyTitle) !== null && _z !== void 0 ? _z : "No items")),
|
|
3282
|
-
!props.loading &&
|
|
3283
|
-
|
|
3284
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
3285
|
-
var spaceRow = (_a = props.spaceData) === null || _a === void 0 ? void 0 : _a[index];
|
|
3286
|
-
var cardTitle = titleCol_1
|
|
3287
|
-
? spaceRow
|
|
3288
|
-
? spaceRow[titleCol_1.key]
|
|
3289
|
-
: resolveValue(row, titleCol_1.key) || row.id
|
|
3290
|
-
: "";
|
|
3291
|
-
var isSelected = ((_c = (_b = props.selectedIds) === null || _b === void 0 ? void 0 : _b.includes(row.id)) !== null && _c !== void 0 ? _c : false) ||
|
|
3292
|
-
((_d = props.selectAll) !== null && _d !== void 0 ? _d : false);
|
|
3293
|
-
var detailList = flatColumns.map(function (col) { return ({
|
|
3294
|
-
id: col.key,
|
|
3295
|
-
title: col.title,
|
|
3296
|
-
text: (0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, spaceRow ? spaceRow[col.key] : resolveValue(row, col.key), props.bareSettings, true, props.disableEllipsisOnLongWord),
|
|
3297
|
-
}); });
|
|
3298
|
-
if (props.onClickRow || props.newTabUrl) {
|
|
3299
|
-
detailList.push({
|
|
3300
|
-
id: "".concat(row.id, "-more-details-btn"),
|
|
3301
|
-
title: "",
|
|
3302
|
-
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) {
|
|
3303
|
-
var _a;
|
|
3304
|
-
if (!e.metaKey && !e.ctrlKey) {
|
|
3305
|
-
e.preventDefault();
|
|
3306
|
-
(_a = props.onClickRow) === null || _a === void 0 ? void 0 : _a.call(props, row.id, row, spaceRow);
|
|
3307
|
-
}
|
|
3308
|
-
} },
|
|
3309
|
-
react_2.default.createElement(textButton_1.TextButton, { text: "More details", className: "text-sm", onClick: function () { } }),
|
|
3310
|
-
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" },
|
|
3311
|
-
react_2.default.createElement(textButton_1.TextButton, { text: "More details", className: "text-sm", onClick: function (e) {
|
|
3312
|
-
var _a;
|
|
3313
|
-
e.stopPropagation();
|
|
3314
|
-
(_a = props.onClickRow) === null || _a === void 0 ? void 0 : _a.call(props, row.id, row, spaceRow);
|
|
3315
|
-
} }),
|
|
3316
|
-
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 },
|
|
3317
|
-
react_2.default.createElement(textButton_1.TextButton, { text: "More details", className: "text-sm", onClick: function () { } }),
|
|
3318
|
-
react_2.default.createElement(solid_2.ChevronRightIcon, { className: "ml-1 w-3 h-3 text-primary-500" }))) : null,
|
|
3319
|
-
});
|
|
3320
|
-
}
|
|
3321
|
-
return (react_2.default.createElement("div", { key: row.id, "data-dtw-record-id": row.id, className: "relative group/tooltip" },
|
|
3322
|
-
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 ? (
|
|
3323
|
-
// INFO: the row's expand arrow sits right after this, so
|
|
3324
|
-
// the margin keeps a thumb from hitting the wrong one
|
|
3325
|
-
react_2.default.createElement("div", { className: "mr-3 flex items-center gap-2" },
|
|
3326
|
-
renderMobileTitleAdjacent_1(row, spaceRow),
|
|
3327
|
-
renderActivityButton(row.id))) : (renderMobileTitleAdjacent_1(row, spaceRow)), collapseAdditionalComp: renderMobileTitleSummary_1(row, spaceRow),
|
|
3328
|
-
// INFO: clicking the summary line expands the row, same as
|
|
3329
|
-
// the header
|
|
3330
|
-
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,
|
|
3331
|
-
react_2.default.createElement(detailList_1.DetailList, { title: "", list: detailList, size: "compact", darkMode: props.darkMode })) }),
|
|
3332
|
-
((_g = props.mobileTooltip) === null || _g === void 0 ? void 0 : _g.tooltip) &&
|
|
3333
|
-
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)))));
|
|
3334
|
-
})),
|
|
3751
|
+
!props.loading && props.data.length === 0 && !hasPhoneGroups && (react_2.default.createElement("p", { className: "p-4 text-center text-sm ".concat(cellFontColor) }, (_z = props.emptyTitle) !== null && _z !== void 0 ? _z : "No items")),
|
|
3752
|
+
!props.loading && (props.data.length > 0 || hasPhoneGroups) && (react_2.default.createElement("table", { className: "w-full table-fixed", ref: tableRef },
|
|
3753
|
+
react_2.default.createElement("tbody", { className: "divide-y ".concat(dividerColor) }, renderDesktopRows())))),
|
|
3335
3754
|
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
|
|
3336
3755
|
? "pagination-container w-full sm:px-6 ".concat(borderColor, " ").concat(isFixed ? "fixed bottom-0 left-0 z-10" : "sticky top-0 left-0")
|
|
3337
3756
|
: "") }),
|