blixify-ui-web 1.2.250 → 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 +65 -18
- 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 +2 -1
- package/lib/components/display/newTable/index.d.ts.map +1 -1
- package/lib/components/display/newTable/index.js +369 -238
- package/lib/components/display/newTable/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");
|
|
@@ -240,6 +242,7 @@ var ALL_COLUMN_TYPES = [
|
|
|
240
242
|
{ key: "dateRange", label: "Timeline" },
|
|
241
243
|
{ key: "timeTracking", label: "Time tracking" },
|
|
242
244
|
{ key: "button", label: "Button" },
|
|
245
|
+
{ key: "lookup", label: "Lookup" },
|
|
243
246
|
];
|
|
244
247
|
// INFO: never drawn as a table cell, so a column of these added from the
|
|
245
248
|
// table would be invisible the moment it was made; one that exists can still
|
|
@@ -255,9 +258,11 @@ var LIST_TYPES = ["list", "multipleList"];
|
|
|
255
258
|
// INFO: DataTemplate checks a new row against the first unique column only,
|
|
256
259
|
// and only a typed value can be compared, so Unique is offered for these
|
|
257
260
|
var UNIQUE_TYPES = ["string", "email", "contact", "number"];
|
|
258
|
-
// INFO: a formula is computed
|
|
259
|
-
//
|
|
260
|
-
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"];
|
|
261
266
|
// INFO: asset columns need a storage path, which the consumer fills in from its
|
|
262
267
|
// own settings — nothing for the user to type
|
|
263
268
|
var ASSET_TYPES = ["image", "file", "multipleImage", "multipleFile"];
|
|
@@ -426,7 +431,7 @@ var handleGetListColour = function (col, value) {
|
|
|
426
431
|
return column.listSelectionColour[index] || undefined;
|
|
427
432
|
};
|
|
428
433
|
var NewTable = function (rawProps) {
|
|
429
|
-
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
|
|
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;
|
|
430
435
|
// INFO: props are read through the latest render. A row that was not drawn
|
|
431
436
|
// again keeps the handlers of the render that drew it, and those read
|
|
432
437
|
// props.onClickRow, props.data and the rest at the time they run — so a
|
|
@@ -514,7 +519,7 @@ var NewTable = function (rawProps) {
|
|
|
514
519
|
flatColumns.length = 0;
|
|
515
520
|
flatColumns.push.apply(flatColumns, __spreadArray(__spreadArray(__spreadArray([], leftCols, false), middleCols, false), rightCols, false));
|
|
516
521
|
}
|
|
517
|
-
var
|
|
522
|
+
var _6 = (0, react_2.useState)(props.fixedPagination ? true : false), isFixed = _6[0], setIsFixed = _6[1];
|
|
518
523
|
// INFO: the actions sit over the title cell's right padding: the pencil and
|
|
519
524
|
// the bubble in divided strips at the edge, then 8px from the text — kept
|
|
520
525
|
// clear so they never cover the title, and added to the cell's measured
|
|
@@ -533,50 +538,54 @@ var NewTable = function (rawProps) {
|
|
|
533
538
|
//=====================================================================================
|
|
534
539
|
// SECTION: Advanced Settings
|
|
535
540
|
//=====================================================================================
|
|
536
|
-
var
|
|
537
|
-
var
|
|
541
|
+
var _7 = (0, react_2.useState)(""), filterModal = _7[0], setFilterModal = _7[1];
|
|
542
|
+
var _8 = (0, react_2.useState)(""), addColumnModal = _8[0], setAddColumnModal = _8[1];
|
|
538
543
|
// INFO: what a DataTemplate around the table lets a cell save
|
|
539
544
|
var columnTypeActions = (0, react_2.useContext)(context_1.ColumnTypeContext);
|
|
540
|
-
var
|
|
541
|
-
var
|
|
542
|
-
var
|
|
543
|
-
var
|
|
544
|
-
var
|
|
545
|
+
var _9 = (0, react_2.useState)(""), newColumnName = _9[0], setNewColumnName = _9[1];
|
|
546
|
+
var _10 = (0, react_2.useState)("string"), newColumnType = _10[0], setNewColumnType = _10[1];
|
|
547
|
+
var _11 = (0, react_2.useState)(""), newColumnRefSpace = _11[0], setNewColumnRefSpace = _11[1];
|
|
548
|
+
var _12 = (0, react_2.useState)(""), newColumnRefLabel = _12[0], setNewColumnRefLabel = _12[1];
|
|
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];
|
|
545
552
|
// INFO: the option row whose colour palette is open
|
|
546
|
-
var
|
|
547
|
-
var
|
|
548
|
-
var
|
|
549
|
-
var
|
|
550
|
-
var
|
|
551
|
-
var
|
|
552
|
-
var
|
|
553
|
-
var
|
|
554
|
-
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];
|
|
555
562
|
// INFO: the formula as shown in the builder — column names, not ids
|
|
556
|
-
var
|
|
563
|
+
var _25 = (0, react_2.useState)(""), newColumnFormula = _25[0], setNewColumnFormula = _25[1];
|
|
557
564
|
var addColumnPopUpRef = (0, react_2.useRef)(null);
|
|
558
565
|
// INFO: the column being changed — empty while the panel adds a new one
|
|
559
|
-
var
|
|
566
|
+
var _26 = (0, react_2.useState)(null), editingColumn = _26[0], setEditingColumn = _26[1];
|
|
560
567
|
//=====================================================================================
|
|
561
568
|
// SECTION: Editable & Addable cells
|
|
562
569
|
//=====================================================================================
|
|
563
|
-
var
|
|
564
|
-
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];
|
|
565
572
|
// INFO: an editable table used to mount an input in every cell — it read as a
|
|
566
573
|
// form, and a row click always landed on a child input. Only the hovered cell
|
|
567
574
|
// becomes its input now; NewTableHoverCell keeps that hover to itself.
|
|
568
|
-
var
|
|
575
|
+
var _29 = (0, react_2.useState)(false), modalEditVisible = _29[0], setModalEditVisible = _29[1];
|
|
569
576
|
// INFO: whether the modal's signature pad has been drawn on
|
|
570
|
-
var
|
|
571
|
-
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];
|
|
572
579
|
// INFO: rows shown per section when the sections do not page themselves
|
|
573
|
-
var
|
|
580
|
+
var _32 = (0, react_2.useState)({}), groupVisibleCounts = _32[0], setGroupVisibleCounts = _32[1];
|
|
574
581
|
// INFO: per-group scroll pagination. One sentinel element per band, observed
|
|
575
582
|
// by a single IntersectionObserver that fires props.onGroupLoadMore when a
|
|
576
583
|
// band's sentinel scrolls into view. The debounce guard stops repeat fires
|
|
577
584
|
// while that group's next page is in flight.
|
|
578
585
|
var groupSentinelRefs = (0, react_2.useRef)({});
|
|
579
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());
|
|
580
589
|
var onGroupLoadMoreRef = (0, react_2.useRef)(props.onGroupLoadMore);
|
|
581
590
|
onGroupLoadMoreRef.current = props.onGroupLoadMore;
|
|
582
591
|
// INFO: sheet-style row selection — Shift-click extends from the last
|
|
@@ -586,37 +595,37 @@ var NewTable = function (rawProps) {
|
|
|
586
595
|
var lastSelectedRowRef = (0, react_2.useRef)(null);
|
|
587
596
|
var dragSelectRef = (0, react_2.useRef)(null);
|
|
588
597
|
var suppressNextClickRef = (0, react_2.useRef)(false);
|
|
589
|
-
var
|
|
590
|
-
var
|
|
591
|
-
var
|
|
592
|
-
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];
|
|
593
602
|
// INFO: true while the empty bottom row is being filled in; the row itself is
|
|
594
603
|
// always there in an addable table
|
|
595
|
-
var
|
|
604
|
+
var _37 = (0, react_2.useState)(false), addData = _37[0], setAddData = _37[1];
|
|
596
605
|
var isAddRowPinned = props.paginationType === "scroll";
|
|
597
|
-
var
|
|
606
|
+
var _38 = (0, react_2.useState)({}), addDataValue = _38[0], setAddDataValue = _38[1];
|
|
598
607
|
// INFO: bumped after each saved row, so the next one starts with fresh
|
|
599
608
|
// inputs and its first cell takes the focus
|
|
600
|
-
var
|
|
609
|
+
var _39 = (0, react_2.useState)(0), addRowKey = _39[0], setAddRowKey = _39[1];
|
|
601
610
|
// INFO: the group whose own add row is being filled in; "" = the bottom row
|
|
602
|
-
var
|
|
611
|
+
var _40 = (0, react_2.useState)(""), addGroupId = _40[0], setAddGroupId = _40[1];
|
|
603
612
|
// INFO: the row armed by a press on its handle, so only the handle — never
|
|
604
613
|
// a click or a text selection in a cell — starts a drag
|
|
605
|
-
var
|
|
606
|
-
var
|
|
607
|
-
var
|
|
608
|
-
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];
|
|
609
618
|
// INFO: seeded options sit under the local map so a cell's own search
|
|
610
619
|
// results still win per key
|
|
611
620
|
var mergedReferencesOptions = __assign(__assign({}, ((_m = props.referencesOptions) !== null && _m !== void 0 ? _m : {})), referencesOptions);
|
|
612
|
-
var
|
|
613
|
-
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];
|
|
614
623
|
// INFO: measured pixel widths for pinned columns without an explicit width.
|
|
615
|
-
var
|
|
624
|
+
var _47 = (0, react_2.useState)({}), measuredPinWidths = _47[0], setMeasuredPinWidths = _47[1];
|
|
616
625
|
// INFO: the scrolling view's width, which caps how much the left pins take
|
|
617
|
-
var
|
|
626
|
+
var _48 = (0, react_2.useState)(0), pinViewWidth = _48[0], setPinViewWidth = _48[1];
|
|
618
627
|
// INFO: per large group, the rows [start, end) drawn; the rest are spacers
|
|
619
|
-
var
|
|
628
|
+
var _49 = (0, react_2.useState)({}), virtualRanges = _49[0], setVirtualRanges = _49[1];
|
|
620
629
|
// INFO: each drawn row's measured height, kept so a spacer is as tall as the
|
|
621
630
|
// rows it stands in for
|
|
622
631
|
var rowHeightsRef = (0, react_2.useRef)(new Map());
|
|
@@ -943,21 +952,24 @@ var NewTable = function (rawProps) {
|
|
|
943
952
|
(0, react_2.useEffect)(function () {
|
|
944
953
|
var _a;
|
|
945
954
|
var status = (_a = props.groupLoadingStatus) !== null && _a !== void 0 ? _a : {};
|
|
946
|
-
var settled = [];
|
|
947
955
|
Object.keys(groupLoadMoreDebounce.current).forEach(function (groupId) {
|
|
948
956
|
var _a;
|
|
949
957
|
if ((_a = status[groupId]) === null || _a === void 0 ? void 0 : _a.loadingMore)
|
|
950
958
|
return;
|
|
951
959
|
if (groupLoadMoreDebounce.current[groupId])
|
|
952
|
-
|
|
960
|
+
groupRecheckRef.current.add(groupId);
|
|
953
961
|
groupLoadMoreDebounce.current[groupId] = false;
|
|
954
962
|
});
|
|
955
|
-
if (
|
|
963
|
+
if (groupRecheckRef.current.size === 0)
|
|
956
964
|
return;
|
|
957
965
|
// INFO: read after the new rows are laid out and the observer has said
|
|
958
|
-
// whether the sentinel is still on screen, so a band loads no extra page
|
|
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
|
|
959
969
|
var timer = setTimeout(function () {
|
|
960
|
-
|
|
970
|
+
var pending = Array.from(groupRecheckRef.current);
|
|
971
|
+
groupRecheckRef.current.clear();
|
|
972
|
+
pending.forEach(function (groupId) {
|
|
961
973
|
var _a, _b;
|
|
962
974
|
if (groupIntersectingRef.current[groupId] &&
|
|
963
975
|
!((_b = ((_a = props.groupLoadingStatus) !== null && _a !== void 0 ? _a : {})[groupId]) === null || _b === void 0 ? void 0 : _b.exhausted))
|
|
@@ -1467,7 +1479,7 @@ var NewTable = function (rawProps) {
|
|
|
1467
1479
|
// it stays here until the table unmounts. Tailwind cannot emit a runtime
|
|
1468
1480
|
// w-[Npx], so a width drives an inline style and wins over the col.width
|
|
1469
1481
|
// class.
|
|
1470
|
-
var
|
|
1482
|
+
var _50 = (0, react_2.useState)({}), columnWidths = _50[0], setColumnWidths = _50[1];
|
|
1471
1483
|
var resizeRef = (0, react_2.useRef)(null);
|
|
1472
1484
|
// INFO: a dragged width first, else the column's own fixed width in pixels
|
|
1473
1485
|
// whatever form it is stored in ("180px", "w-[180px]", "w-48")
|
|
@@ -1600,7 +1612,7 @@ var NewTable = function (rawProps) {
|
|
|
1600
1612
|
? ALL_COLUMN_TYPES.filter(function (eachType) {
|
|
1601
1613
|
return (0, exports.handleGetEditableColumnTypes)(editingColumn.type).includes(eachType.key);
|
|
1602
1614
|
})
|
|
1603
|
-
:
|
|
1615
|
+
: handleGetAddColumnTypes(), disabled: !!editingColumn &&
|
|
1604
1616
|
(0, exports.handleGetEditableColumnTypes)(editingColumn.type).length < 2, portalDropdown: true, onChange: function (value) {
|
|
1605
1617
|
var _a;
|
|
1606
1618
|
setNewColumnType(value);
|
|
@@ -1620,6 +1632,7 @@ var NewTable = function (rawProps) {
|
|
|
1620
1632
|
setNewColumnRefLabel("");
|
|
1621
1633
|
} }),
|
|
1622
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(),
|
|
1623
1636
|
LIST_TYPES.includes(newColumnType) && renderColumnOptions(),
|
|
1624
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 : ""); } })),
|
|
1625
1638
|
newColumnType === "button" && (react_2.default.createElement(react_2.default.Fragment, null,
|
|
@@ -1628,13 +1641,15 @@ var NewTable = function (rawProps) {
|
|
|
1628
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 : ""); } }))),
|
|
1629
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.")),
|
|
1630
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 })),
|
|
1631
|
-
newColumnType
|
|
1644
|
+
!UNREQUIRABLE_TYPES.includes(newColumnType) && (react_2.default.createElement(checkbox_1.Checkbox, { id: "newColumnRequired",
|
|
1632
1645
|
// INFO: the checkbox itself is not a required field — without this it
|
|
1633
1646
|
// renders "Required *", which reads as a validation error on a toggle
|
|
1634
1647
|
optional: true, darkMode: props.darkMode, itemList: [{ key: "required", label: "Required" }], selectItemList: newColumnRequired ? ["required"] : [], onChange: function (items) {
|
|
1635
1648
|
return setNewColumnRequired(items.includes("required"));
|
|
1636
1649
|
} })),
|
|
1637
|
-
|
|
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.")),
|
|
1638
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) {
|
|
1639
1654
|
return setNewColumnUnique(items.includes("unique"));
|
|
1640
1655
|
} })),
|
|
@@ -1707,8 +1722,51 @@ var NewTable = function (rawProps) {
|
|
|
1707
1722
|
renderOptionColourPalette(eachOption, index)));
|
|
1708
1723
|
}),
|
|
1709
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); } }))); };
|
|
1710
1768
|
var handleEditColumnModal = function (columnId) {
|
|
1711
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1769
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1712
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);
|
|
1713
1771
|
if (!schema)
|
|
1714
1772
|
return;
|
|
@@ -1717,15 +1775,17 @@ var NewTable = function (rawProps) {
|
|
|
1717
1775
|
setNewColumnType((_d = schema.type) !== null && _d !== void 0 ? _d : "string");
|
|
1718
1776
|
setNewColumnRefSpace((_e = schema.referenceSpaceId) !== null && _e !== void 0 ? _e : "");
|
|
1719
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 : "");
|
|
1720
1780
|
setNewColumnOptions((0, exports.handleReadColumnOptions)(schema));
|
|
1721
1781
|
setOptionColourKey(null);
|
|
1722
1782
|
setNewColumnRequired(!schema.optional);
|
|
1723
1783
|
setNewColumnUnique(!!schema.unique);
|
|
1724
1784
|
setNewColumnReadOnly(!!schema.disabled);
|
|
1725
1785
|
setNewColumnRatingMax(schema.ratingMax ? String(schema.ratingMax) : "");
|
|
1726
|
-
setNewColumnButtonLabel((
|
|
1727
|
-
setNewColumnButtonColour((
|
|
1728
|
-
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 : "");
|
|
1729
1789
|
setNewColumnFormula(schema.type === "formula"
|
|
1730
1790
|
? (0, formula_1.handleGetFormulaDisplay)(schema, handleGetFormulaSchema())
|
|
1731
1791
|
: "");
|
|
@@ -1745,6 +1805,8 @@ var NewTable = function (rawProps) {
|
|
|
1745
1805
|
setNewColumnType("string");
|
|
1746
1806
|
setNewColumnRefSpace("");
|
|
1747
1807
|
setNewColumnRefLabel("");
|
|
1808
|
+
setNewColumnLookupReference("");
|
|
1809
|
+
setNewColumnLookupField("");
|
|
1748
1810
|
setNewColumnOptions([]);
|
|
1749
1811
|
setOptionColourKey(null);
|
|
1750
1812
|
setNewColumnRequired(false);
|
|
@@ -1808,6 +1870,8 @@ var NewTable = function (rawProps) {
|
|
|
1808
1870
|
return false;
|
|
1809
1871
|
if (REFERENCE_TYPES.includes(newColumnType))
|
|
1810
1872
|
return !!newColumnRefSpace && !!newColumnRefLabel;
|
|
1873
|
+
if (newColumnType === "lookup")
|
|
1874
|
+
return !!newColumnLookupReference && !!newColumnLookupField;
|
|
1811
1875
|
// INFO: an illegal formula would show "Error" in every row
|
|
1812
1876
|
if (newColumnType === "formula") {
|
|
1813
1877
|
if (!newColumnFormula.trim())
|
|
@@ -1911,6 +1975,11 @@ var NewTable = function (rawProps) {
|
|
|
1911
1975
|
column.formulaExpression = (0, formula_1.handleFormulaToStorage)(newColumnFormula.trim(), handleGetFormulaSchema());
|
|
1912
1976
|
column.optional = true;
|
|
1913
1977
|
}
|
|
1978
|
+
if (newColumnType === "lookup") {
|
|
1979
|
+
column.referenceFieldId = newColumnLookupReference;
|
|
1980
|
+
column.lookupFieldId = newColumnLookupField;
|
|
1981
|
+
column.optional = true;
|
|
1982
|
+
}
|
|
1914
1983
|
handleApplyColumnSettings(column);
|
|
1915
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))];
|
|
1916
1985
|
case 4:
|
|
@@ -1968,6 +2037,18 @@ var NewTable = function (rawProps) {
|
|
|
1968
2037
|
column_1.formulaExpression = (0, formula_1.handleFormulaToStorage)(newColumnFormula.trim(), handleGetFormulaSchema());
|
|
1969
2038
|
column_1.optional = true;
|
|
1970
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
|
+
}
|
|
1971
2052
|
handleApplyColumnSettings(column_1);
|
|
1972
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))];
|
|
1973
2054
|
case 2:
|
|
@@ -2550,7 +2631,7 @@ var NewTable = function (rawProps) {
|
|
|
2550
2631
|
};
|
|
2551
2632
|
// INFO: worked out here, after the Actions and "+" helpers it reads, and
|
|
2552
2633
|
// only read by the render helpers called from the return below
|
|
2553
|
-
var
|
|
2634
|
+
var _51 = handleFitPins(), fittedLeftPins = _51.widths, narrowPins = _51.narrow;
|
|
2554
2635
|
var renderActionColumnHeader = function () {
|
|
2555
2636
|
if (handleShowsActionColumn()) {
|
|
2556
2637
|
var pin = handleGetActionCellPin(true);
|
|
@@ -2783,12 +2864,195 @@ var NewTable = function (rawProps) {
|
|
|
2783
2864
|
};
|
|
2784
2865
|
return tableVersionRef.current.version;
|
|
2785
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
|
+
};
|
|
2786
3048
|
var renderDesktopRow = function (row, index, tableVersion, groupAccent, dropGroup) {
|
|
2787
3049
|
var _a, _b, _c, _d;
|
|
2788
3050
|
var isSelected = ((_b = (_a = props.selectedIds) === null || _a === void 0 ? void 0 : _a.includes(row.id)) !== null && _b !== void 0 ? _b : false) ||
|
|
2789
3051
|
((_c = props.selectAll) !== null && _c !== void 0 ? _c : false);
|
|
2790
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 () {
|
|
2791
|
-
return
|
|
3053
|
+
return props.mobileView
|
|
3054
|
+
? renderPhoneRowContent(row, index, groupAccent, dropGroup)
|
|
3055
|
+
: renderDesktopRowContent(row, index, groupAccent, dropGroup);
|
|
2792
3056
|
} }));
|
|
2793
3057
|
};
|
|
2794
3058
|
var renderDesktopRowContent = function (row, index, groupAccent, dropGroup) {
|
|
@@ -3071,10 +3335,12 @@ var NewTable = function (rawProps) {
|
|
|
3071
3335
|
// spacer and the action cell. It was a bare +1 before, which happened to
|
|
3072
3336
|
// match a deletable table and was wrong for every other combination; with
|
|
3073
3337
|
// add-column on it left the band a column short of the row.
|
|
3074
|
-
var columnCount =
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
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);
|
|
3078
3344
|
if (!props.groups || props.groups.length === 0) {
|
|
3079
3345
|
return renderMemberRows("all", props.data.map(function (_row, index) { return index; }), tableVersion, columnCount, virtualGroups);
|
|
3080
3346
|
}
|
|
@@ -3115,8 +3381,12 @@ var NewTable = function (rawProps) {
|
|
|
3115
3381
|
renderGroupShowMoreRow(group.id, memberIndexes.length, columnCount, isCollapsed),
|
|
3116
3382
|
renderGroupLoadMoreRow(group.id, columnCount, isCollapsed, isPending),
|
|
3117
3383
|
renderGroupPagerRow(group, columnCount, isCollapsed),
|
|
3118
|
-
!
|
|
3119
|
-
|
|
3384
|
+
!props.mobileView &&
|
|
3385
|
+
!isCollapsed &&
|
|
3386
|
+
!isPending &&
|
|
3387
|
+
renderGroupAddRow(group, colourKey),
|
|
3388
|
+
!props.mobileView &&
|
|
3389
|
+
!isCollapsed &&
|
|
3120
3390
|
!isPending &&
|
|
3121
3391
|
renderGroupSummaryRow(group, colourKey)));
|
|
3122
3392
|
});
|
|
@@ -3306,6 +3576,22 @@ var NewTable = function (rawProps) {
|
|
|
3306
3576
|
var draggable = (advSettings === null || advSettings === void 0 ? void 0 : advSettings.dragEnabled) ? true : false;
|
|
3307
3577
|
var droppable = (advSettings === null || advSettings === void 0 ? void 0 : advSettings.dragEnabled) ? true : false;
|
|
3308
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
|
+
};
|
|
3309
3595
|
var renderHeaderIcons = function (col) {
|
|
3310
3596
|
var _a, _b, _c;
|
|
3311
3597
|
var sortIcon = null;
|
|
@@ -3403,6 +3689,7 @@ var NewTable = function (rawProps) {
|
|
|
3403
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 : "")) },
|
|
3404
3690
|
col.title,
|
|
3405
3691
|
renderHeaderIcons(col)),
|
|
3692
|
+
renderHeaderLink(col),
|
|
3406
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(); } },
|
|
3407
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") }))));
|
|
3408
3695
|
}),
|
|
@@ -3426,10 +3713,11 @@ var NewTable = function (rawProps) {
|
|
|
3426
3713
|
if (groupData && groupData.length > 0) {
|
|
3427
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));
|
|
3428
3715
|
}
|
|
3429
|
-
return (react_2.default.createElement("th", { key: col.key, rowSpan: 2, className: "".concat(cellPadding, " text-left text-xs font-semibold uppercase tracking-wide ").concat(cursorClassname, " ").concat((_b = (_a = getPinProps(col.key, true)) === null || _a === void 0 ? void 0 : _a.className) !== null && _b !== void 0 ? _b : ""), style: (_c = getPinProps(col.key, true)) === null || _c === void 0 ? void 0 : _c.style, draggable: draggable, onDragStart: function (e) { return handleDragStart(e, col.key); }, onDrop: droppable ? function (e) { return handleDrop(e, col.key); } : undefined, onDragOver: handleDragOver },
|
|
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 },
|
|
3430
3717
|
react_2.default.createElement("div", { className: "group/header flex flex-row items-center ".concat((_d = col.width) !== null && _d !== void 0 ? _d : "") },
|
|
3431
3718
|
col.title,
|
|
3432
|
-
renderHeaderIcons(col))
|
|
3719
|
+
renderHeaderIcons(col)),
|
|
3720
|
+
renderHeaderLink(col)));
|
|
3433
3721
|
}),
|
|
3434
3722
|
renderAddColumnHeader(),
|
|
3435
3723
|
renderActionColumnHeader()),
|
|
@@ -3447,179 +3735,22 @@ var NewTable = function (rawProps) {
|
|
|
3447
3735
|
};
|
|
3448
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 : "") })); };
|
|
3449
3737
|
if (props.mobileView) {
|
|
3450
|
-
var
|
|
3451
|
-
return /^id$/i.test(c.key) || /^_id$/i.test(c.key);
|
|
3452
|
-
};
|
|
3453
|
-
var titleCol_1 = (_v = flatColumns.find(function (c) { return !isIdLike_1(c); })) !== null && _v !== void 0 ? _v : flatColumns[0];
|
|
3454
|
-
var expandHeaderBg_1 = props.darkMode ? "bg-gray-700" : "bg-gray-100";
|
|
3455
|
-
var expandHeaderFontColor_1 = props.darkMode ? "text-white" : "";
|
|
3456
|
-
var headerBgColor_1 = props.darkMode
|
|
3457
|
-
? ((_w = props.darkModeBg) !== null && _w !== void 0 ? _w : "bg-gray-900")
|
|
3458
|
-
: "";
|
|
3459
|
-
var headerFontColor_1 = props.darkMode ? "text-white" : "";
|
|
3460
|
-
// INFO: renders tag + trailing text adjacent to the Collapse title
|
|
3461
|
-
var renderMobileTitleAdjacent_1 = function (row, spaceRow) {
|
|
3462
|
-
var _a;
|
|
3463
|
-
var ta = (_a = props.mobileTooltip) === null || _a === void 0 ? void 0 : _a.titleAdjacent;
|
|
3464
|
-
if (!ta)
|
|
3465
|
-
return undefined;
|
|
3466
|
-
var source = spaceRow !== null && spaceRow !== void 0 ? spaceRow : row;
|
|
3467
|
-
var tagValue = ta.tagKey
|
|
3468
|
-
? resolveValueToString(ta.tagKey, source, row)
|
|
3469
|
-
: "";
|
|
3470
|
-
var trailingValue = ta.trailingKey
|
|
3471
|
-
? resolveValueToString(ta.trailingKey, source, row)
|
|
3472
|
-
: "";
|
|
3473
|
-
if (!tagValue && !trailingValue)
|
|
3474
|
-
return undefined;
|
|
3475
|
-
var tagColor = tagValue && ta.tagColor ? ta.tagColor[tagValue] : undefined;
|
|
3476
|
-
return (react_2.default.createElement("div", { className: "flex items-center gap-2 mr-2" },
|
|
3477
|
-
tagValue && (react_2.default.createElement(tag_1.Tag, { tagText: String(tagValue), size: "small", variant: "flat", color: tagColor !== null && tagColor !== void 0 ? tagColor : undefined, rounded: "md", className: "whitespace-nowrap" })),
|
|
3478
|
-
trailingValue && (react_2.default.createElement("span", { className: "text-xs whitespace-nowrap ".concat(props.darkMode ? "text-gray-300" : "text-gray-500") }, String(trailingValue)))));
|
|
3479
|
-
};
|
|
3480
|
-
// INFO: second-line label + value summary under the title (while collapsed),
|
|
3481
|
-
// driven by titleAdjacent.summaryKeys. Reuses the tooltip's summary layout.
|
|
3482
|
-
var renderMobileTitleSummary_1 = function (row, spaceRow) {
|
|
3483
|
-
var _a, _b;
|
|
3484
|
-
var ta = (_a = props.mobileTooltip) === null || _a === void 0 ? void 0 : _a.titleAdjacent;
|
|
3485
|
-
// INFO: a column the view hides, or the one already drawn as the title,
|
|
3486
|
-
// stays out of the line under the title
|
|
3487
|
-
var keys = (_b = ta === null || ta === void 0 ? void 0 : ta.summaryKeys) === null || _b === void 0 ? void 0 : _b.filter(function (key) {
|
|
3488
|
-
var parentKey = key.split(".")[0];
|
|
3489
|
-
return (key !== (titleCol_1 === null || titleCol_1 === void 0 ? void 0 : titleCol_1.key) &&
|
|
3490
|
-
flatColumns.some(function (col) { return col.key === key || col.key === parentKey; }));
|
|
3491
|
-
});
|
|
3492
|
-
if (!ta || !keys || keys.length === 0)
|
|
3493
|
-
return undefined;
|
|
3494
|
-
var source = spaceRow !== null && spaceRow !== void 0 ? spaceRow : row;
|
|
3495
|
-
var pairs = keys
|
|
3496
|
-
.map(function (key) {
|
|
3497
|
-
var _a, _b, _c, _d;
|
|
3498
|
-
// INFO: label from the column title, falling back to the parent
|
|
3499
|
-
// column for a dotted key (e.g. "shippingAddress.name").
|
|
3500
|
-
var parentKey = key.split(".")[0];
|
|
3501
|
-
var label = (_d = (_b = (_a = columns.find(function (col) { return col.key === key; })) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : (_c = columns.find(function (col) { return col.key === parentKey; })) === null || _c === void 0 ? void 0 : _c.title) !== null && _d !== void 0 ? _d : key;
|
|
3502
|
-
return { key: key, label: label, value: resolveValueToString(key, source, row) };
|
|
3503
|
-
})
|
|
3504
|
-
.filter(function (p) { return p.value !== undefined && p.value !== null && p.value !== ""; });
|
|
3505
|
-
if (pairs.length === 0)
|
|
3506
|
-
return undefined;
|
|
3507
|
-
return (react_2.default.createElement("div", { className: "flex flex-wrap gap-x-6 gap-y-1.5 pl-9 pr-4 pb-2 ".concat(headerBgColor_1) }, pairs.map(function (p) { return (react_2.default.createElement("div", { key: p.key, className: "flex flex-col min-w-0" },
|
|
3508
|
-
react_2.default.createElement("span", { className: "text-[11px] uppercase tracking-wide text-gray-400" }, p.label),
|
|
3509
|
-
react_2.default.createElement("span", { className: "text-xs ".concat(props.darkMode ? "text-gray-200" : "text-gray-700") }, p.value))); })));
|
|
3510
|
-
};
|
|
3511
|
-
// INFO: renders the hover tooltip card content — image, summary pairs, and tags
|
|
3512
|
-
var renderMobileTooltipContent_1 = function (row, spaceRow) {
|
|
3513
|
-
var _a, _b, _c;
|
|
3514
|
-
var tt = (_a = props.mobileTooltip) === null || _a === void 0 ? void 0 : _a.tooltip;
|
|
3515
|
-
if (!tt)
|
|
3516
|
-
return null;
|
|
3517
|
-
var source = spaceRow !== null && spaceRow !== void 0 ? spaceRow : row;
|
|
3518
|
-
var imageUrl = tt.imageKey
|
|
3519
|
-
? resolveValue(source, tt.imageKey)
|
|
3520
|
-
: undefined;
|
|
3521
|
-
var summaryPairs = ((_b = tt.summaryKeys) !== null && _b !== void 0 ? _b : [])
|
|
3522
|
-
.map(function (key) {
|
|
3523
|
-
var _a;
|
|
3524
|
-
var col = flatColumns.find(function (c) { return c.key === key; });
|
|
3525
|
-
return {
|
|
3526
|
-
key: key,
|
|
3527
|
-
label: (_a = col === null || col === void 0 ? void 0 : col.title) !== null && _a !== void 0 ? _a : key,
|
|
3528
|
-
value: resolveValue(source, key),
|
|
3529
|
-
};
|
|
3530
|
-
})
|
|
3531
|
-
.filter(function (p) { return p.value !== undefined && p.value !== null && p.value !== ""; });
|
|
3532
|
-
var tagValues = ((_c = tt.tagKeys) !== null && _c !== void 0 ? _c : [])
|
|
3533
|
-
.map(function (key) {
|
|
3534
|
-
var val = resolveValueToString(key, source, row);
|
|
3535
|
-
return {
|
|
3536
|
-
key: key,
|
|
3537
|
-
value: val,
|
|
3538
|
-
color: val && tt.tagColors ? tt.tagColors[val] : undefined,
|
|
3539
|
-
};
|
|
3540
|
-
})
|
|
3541
|
-
.filter(function (t) { return !!t.value; });
|
|
3542
|
-
if (!imageUrl && summaryPairs.length === 0 && tagValues.length === 0)
|
|
3543
|
-
return null;
|
|
3544
|
-
return (react_2.default.createElement("div", { className: "rounded-xl border shadow-lg p-3 w-72 ".concat(props.darkMode ? "bg-gray-800 border-gray-700" : "bg-white border-gray-200") },
|
|
3545
|
-
react_2.default.createElement("div", { className: "flex gap-3" },
|
|
3546
|
-
imageUrl && (react_2.default.createElement("img", { src: String(imageUrl), alt: "", className: "h-14 w-14 rounded-lg object-cover flex-shrink-0" })),
|
|
3547
|
-
react_2.default.createElement("div", { className: "flex flex-col gap-1.5 min-w-0 flex-1" }, summaryPairs.map(function (p) { return (react_2.default.createElement("div", { key: p.key, className: "flex flex-col" },
|
|
3548
|
-
react_2.default.createElement("span", { className: "text-[11px] uppercase tracking-wide ".concat(props.darkMode ? "text-gray-400" : "text-gray-400") }, p.label),
|
|
3549
|
-
react_2.default.createElement("span", { className: "text-xs font-medium ".concat(props.darkMode ? "text-gray-200" : "text-gray-700", " truncate") }, typeof p.value === "object"
|
|
3550
|
-
? JSON.stringify(p.value)
|
|
3551
|
-
: String(p.value)))); }))),
|
|
3552
|
-
tagValues.length > 0 && (react_2.default.createElement("div", { className: "flex flex-wrap gap-1 mt-2 pt-2 border-t border-gray-100" }, tagValues.map(function (t) {
|
|
3553
|
-
var _a;
|
|
3554
|
-
return (react_2.default.createElement(tag_1.Tag, { key: t.key, tagText: String(t.value), size: "small", variant: "flat", color: (_a = t.color) !== null && _a !== void 0 ? _a : undefined, rounded: "md" }));
|
|
3555
|
-
})))));
|
|
3556
|
-
};
|
|
3738
|
+
var hasPhoneGroups = !!((_v = props.groups) === null || _v === void 0 ? void 0 : _v.length);
|
|
3557
3739
|
return (react_2.default.createElement("div", null,
|
|
3558
|
-
react_2.default.createElement("div", { className: "w-full ".concat(((
|
|
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
|
|
3559
3741
|
? ""
|
|
3560
|
-
: "border ".concat(borderRadius, " ").concat(borderColor, " ").concat(bgColor, " shadow-sm"), " divide-y ").concat(dividerColor, " ").concat((
|
|
3742
|
+
: "border ".concat(borderRadius, " ").concat(borderColor, " ").concat(bgColor, " shadow-sm"), " divide-y ").concat(dividerColor, " ").concat((_x = props.className) !== null && _x !== void 0 ? _x : "") },
|
|
3561
3743
|
react_2.default.createElement("div", { className: "p-3 flex items-center justify-between" },
|
|
3562
3744
|
renderSelectAll(),
|
|
3563
3745
|
react_2.default.createElement("div", { className: "flex items-center gap-2" },
|
|
3564
3746
|
renderSelectedCount(),
|
|
3565
|
-
((
|
|
3747
|
+
((_y = props.advSettings) === null || _y === void 0 ? void 0 : _y.addColumnEnabled) && (react_2.default.createElement(iconButton_1.IconButton, { testId: "table-add-column-btn-mobile", icon: react_2.default.createElement(solid_1.PlusIcon, { className: "h-5 w-5 text-gray" }), onClick: function () { return handleAddColumnModal("new"); } })))),
|
|
3566
3748
|
props.loading &&
|
|
3567
3749
|
Array.from({ length: 3 }).map(function (_, i) { return (react_2.default.createElement("div", { key: "skeleton-".concat(i), className: "p-4" },
|
|
3568
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") }))); }),
|
|
3569
|
-
!props.loading && props.data.length === 0 && (react_2.default.createElement("p", { className: "p-4 text-center text-sm ".concat(cellFontColor) }, (
|
|
3570
|
-
!props.loading &&
|
|
3571
|
-
|
|
3572
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
3573
|
-
var spaceRow = (_a = props.spaceData) === null || _a === void 0 ? void 0 : _a[index];
|
|
3574
|
-
var cardTitle = titleCol_1
|
|
3575
|
-
? spaceRow
|
|
3576
|
-
? spaceRow[titleCol_1.key]
|
|
3577
|
-
: resolveValue(row, titleCol_1.key) || row.id
|
|
3578
|
-
: "";
|
|
3579
|
-
var isSelected = ((_c = (_b = props.selectedIds) === null || _b === void 0 ? void 0 : _b.includes(row.id)) !== null && _c !== void 0 ? _c : false) ||
|
|
3580
|
-
((_d = props.selectAll) !== null && _d !== void 0 ? _d : false);
|
|
3581
|
-
var detailList = flatColumns.map(function (col) { return ({
|
|
3582
|
-
id: col.key,
|
|
3583
|
-
title: col.title,
|
|
3584
|
-
text: (0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, spaceRow ? spaceRow[col.key] : resolveValue(row, col.key), props.bareSettings, true, props.disableEllipsisOnLongWord),
|
|
3585
|
-
}); });
|
|
3586
|
-
if (props.onClickRow || props.newTabUrl) {
|
|
3587
|
-
detailList.push({
|
|
3588
|
-
id: "".concat(row.id, "-more-details-btn"),
|
|
3589
|
-
title: "",
|
|
3590
|
-
text: props.onClickRow && props.newTabUrl ? (react_2.default.createElement(link_1.Link, { href: props.newTabUrl + row.id + ((_e = props.addNewTabUrl) !== null && _e !== void 0 ? _e : ""), className: "flex items-center", linkType: props.linkType, custom: props.custom, onClick: function (e) {
|
|
3591
|
-
var _a;
|
|
3592
|
-
if (!e.metaKey && !e.ctrlKey) {
|
|
3593
|
-
e.preventDefault();
|
|
3594
|
-
(_a = props.onClickRow) === null || _a === void 0 ? void 0 : _a.call(props, row.id, row, spaceRow);
|
|
3595
|
-
}
|
|
3596
|
-
} },
|
|
3597
|
-
react_2.default.createElement(textButton_1.TextButton, { text: "More details", className: "text-sm", onClick: function () { } }),
|
|
3598
|
-
react_2.default.createElement(solid_2.ChevronRightIcon, { className: "ml-1 w-3 h-3 text-primary-500" }))) : props.onClickRow ? (react_2.default.createElement("div", { className: "flex items-center" },
|
|
3599
|
-
react_2.default.createElement(textButton_1.TextButton, { text: "More details", className: "text-sm", onClick: function (e) {
|
|
3600
|
-
var _a;
|
|
3601
|
-
e.stopPropagation();
|
|
3602
|
-
(_a = props.onClickRow) === null || _a === void 0 ? void 0 : _a.call(props, row.id, row, spaceRow);
|
|
3603
|
-
} }),
|
|
3604
|
-
react_2.default.createElement(solid_2.ChevronRightIcon, { className: "ml-1 w-3 h-3 text-primary-500" }))) : props.newTabUrl ? (react_2.default.createElement(link_1.Link, { href: props.newTabUrl + row.id + ((_f = props.addNewTabUrl) !== null && _f !== void 0 ? _f : ""), className: "flex items-center", linkType: props.linkType, custom: props.custom },
|
|
3605
|
-
react_2.default.createElement(textButton_1.TextButton, { text: "More details", className: "text-sm", onClick: function () { } }),
|
|
3606
|
-
react_2.default.createElement(solid_2.ChevronRightIcon, { className: "ml-1 w-3 h-3 text-primary-500" }))) : null,
|
|
3607
|
-
});
|
|
3608
|
-
}
|
|
3609
|
-
return (react_2.default.createElement("div", { key: row.id, "data-dtw-record-id": row.id, className: "relative group/tooltip" },
|
|
3610
|
-
react_2.default.createElement(collapse_1.Collapse, { title: cardTitle, titleClassName: "text-sm font-medium !p-0 ".concat(props.onClickRow ? titleFontColor : ""), icon: props.checkbox ? renderCheckbox(isSelected, function () { }, function (e) { return handleSelectRow(row.id, e); }, "w-4 h-4 ".concat(isMaxReached && !isSelected ? "opacity-50 cursor-not-allowed" : "cursor-pointer")) : (react_2.default.createElement(solid_2.ListBulletIcon, { className: "w-4 h-4 ".concat(props.darkMode ? "text-gray-400" : "text-gray-500") })), defaultValue: false, additionalComp: hasRowActions ? (
|
|
3611
|
-
// INFO: the row's expand arrow sits right after this, so
|
|
3612
|
-
// the margin keeps a thumb from hitting the wrong one
|
|
3613
|
-
react_2.default.createElement("div", { className: "mr-3 flex items-center gap-2" },
|
|
3614
|
-
renderMobileTitleAdjacent_1(row, spaceRow),
|
|
3615
|
-
renderActivityButton(row.id))) : (renderMobileTitleAdjacent_1(row, spaceRow)), collapseAdditionalComp: renderMobileTitleSummary_1(row, spaceRow),
|
|
3616
|
-
// INFO: clicking the summary line expands the row, same as
|
|
3617
|
-
// the header
|
|
3618
|
-
collapseAdditionalCompToggle: true, collapseContainerCss: "".concat(isSelected ? selectedRowBg : expandHeaderBg_1, " ").concat(expandHeaderFontColor_1), notCollapseContainerCss: "".concat(isSelected ? selectedRowBg : headerBgColor_1, " ").concat(headerFontColor_1), content: react_2.default.createElement("div", null,
|
|
3619
|
-
react_2.default.createElement(detailList_1.DetailList, { title: "", list: detailList, size: "compact", darkMode: props.darkMode })) }),
|
|
3620
|
-
((_g = props.mobileTooltip) === null || _g === void 0 ? void 0 : _g.tooltip) &&
|
|
3621
|
-
renderMobileTooltipContent_1(row, spaceRow) && (react_2.default.createElement("div", { className: "absolute left-1/2 -translate-x-1/2 top-full mt-1 z-50 hidden group-hover/tooltip:block" }, renderMobileTooltipContent_1(row, spaceRow)))));
|
|
3622
|
-
})),
|
|
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())))),
|
|
3623
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
|
|
3624
3755
|
? "pagination-container w-full sm:px-6 ".concat(borderColor, " ").concat(isFixed ? "fixed bottom-0 left-0 z-10" : "sticky top-0 left-0")
|
|
3625
3756
|
: "") }),
|
|
@@ -3637,13 +3768,13 @@ var NewTable = function (rawProps) {
|
|
|
3637
3768
|
: [])[0];
|
|
3638
3769
|
return WIDE_EDIT_TYPES.includes((_a = selectedDS === null || selectedDS === void 0 ? void 0 : selectedDS.type) !== null && _a !== void 0 ? _a : "") ? "4xl" : "2xl";
|
|
3639
3770
|
};
|
|
3640
|
-
return (react_2.default.createElement("div", { className: "w-full ".concat((
|
|
3771
|
+
return (react_2.default.createElement("div", { className: "w-full ".concat((_0 = props.className) !== null && _0 !== void 0 ? _0 : "") },
|
|
3641
3772
|
react_2.default.createElement(modal_1.Modal, { open: filterModal ? true : false, title: "Filter Options", renderContent: function () {
|
|
3642
3773
|
var _a, _b;
|
|
3643
3774
|
return (react_2.default.createElement("div", { className: "pb-44" },
|
|
3644
3775
|
react_2.default.createElement("div", { className: "pb-48" }, (_b = (_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.renderFilterElements) === null || _b === void 0 ? void 0 : _b.call(_a, filterModal))));
|
|
3645
3776
|
}, onClose: function () { return setFilterModal(""); } }),
|
|
3646
|
-
react_2.default.createElement(modal_1.Modal, { open: modalEditVisible, title: (
|
|
3777
|
+
react_2.default.createElement(modal_1.Modal, { open: modalEditVisible, title: (_2 = (_1 = flatColumns.find(function (eachCol) { return eachCol.key === editDataHeaderKey; })) === null || _1 === void 0 ? void 0 : _1.title) !== null && _2 !== void 0 ? _2 : "Edit", maxWidth: handleGetEditModalWidth(), onClose: handleModalEditClose, renderContent: function () {
|
|
3647
3778
|
var _a, _b, _c, _d;
|
|
3648
3779
|
var selectedCol = flatColumns.find(function (eachCol) { return eachCol.key === editDataHeaderKey; });
|
|
3649
3780
|
if (!selectedCol)
|
|
@@ -3689,7 +3820,7 @@ var NewTable = function (rawProps) {
|
|
|
3689
3820
|
react_2.default.createElement(scrollShadow_1.ScrollShadow, { className: "w-full overflow-x-auto ".concat(isFlat
|
|
3690
3821
|
? ""
|
|
3691
3822
|
: "".concat(borderRadius, " border ").concat(borderColor, " ").concat(bgColor, " shadow-sm")), darkMode: props.darkMode },
|
|
3692
|
-
(props.selectAll || ((
|
|
3823
|
+
(props.selectAll || ((_4 = (_3 = props.selectedIds) === null || _3 === void 0 ? void 0 : _3.length) !== null && _4 !== void 0 ? _4 : 0) > 0) &&
|
|
3693
3824
|
(!props.multiActionFloatingBtns ||
|
|
3694
3825
|
(props.multiActionFloatingBtns &&
|
|
3695
3826
|
props.multiActionFloatingBtns.length <= 0)) && (react_2.default.createElement("div", { className: "sticky left-0 flex flex-row items-center px-4 py-3 gap-x-2" },
|
|
@@ -3717,7 +3848,7 @@ var NewTable = function (rawProps) {
|
|
|
3717
3848
|
(addData
|
|
3718
3849
|
? !isAddRowPinned && !addGroupId && renderAddDataRow()
|
|
3719
3850
|
: !handleHasGroupAddRows() && renderEmptyAddRow()))),
|
|
3720
|
-
!props.loading && props.data.length === 0 && (react_2.default.createElement("div", { className: "p-4 text-sm ".concat(cellFontColor, " text-center sticky left-0") }, (
|
|
3851
|
+
!props.loading && props.data.length === 0 && (react_2.default.createElement("div", { className: "p-4 text-sm ".concat(cellFontColor, " text-center sticky left-0") }, (_5 = props.emptyTitle) !== null && _5 !== void 0 ? _5 : "No items"))),
|
|
3721
3852
|
renderPinnedAddButton(),
|
|
3722
3853
|
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
|
|
3723
3854
|
? "pagination-container w-full ".concat(borderColor, " ").concat(isFixed ? "fixed bottom-0 left-0 z-10" : "sticky top-0 left-0")
|