blixify-ui-web 1.2.251 → 1.2.253
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/blobModule.d.ts +1 -0
- package/lib/components/data/blobModule.d.ts.map +1 -1
- package/lib/components/data/blobModule.js +24 -2
- package/lib/components/data/blobModule.js.map +1 -1
- package/lib/components/data/columnTypes/dateRangeCalendar.d.ts +36 -0
- package/lib/components/data/columnTypes/dateRangeCalendar.d.ts.map +1 -0
- package/lib/components/data/columnTypes/dateRangeCalendar.js +226 -0
- package/lib/components/data/columnTypes/dateRangeCalendar.js.map +1 -0
- package/lib/components/data/columnTypes/dateRangeCell.d.ts +2 -0
- package/lib/components/data/columnTypes/dateRangeCell.d.ts.map +1 -1
- package/lib/components/data/columnTypes/dateRangeCell.js +63 -11
- package/lib/components/data/columnTypes/dateRangeCell.js.map +1 -1
- package/lib/components/data/columnTypes/lookup.d.ts.map +1 -1
- package/lib/components/data/columnTypes/lookup.js +14 -2
- package/lib/components/data/columnTypes/lookup.js.map +1 -1
- package/lib/components/data/dataTemplate/chartView.d.ts +1 -0
- package/lib/components/data/dataTemplate/chartView.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/chartView.js +9 -3
- package/lib/components/data/dataTemplate/chartView.js.map +1 -1
- package/lib/components/data/dataTemplate/index.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/index.js +78 -46
- package/lib/components/data/dataTemplate/index.js.map +1 -1
- package/lib/components/data/dataTemplate/model.d.ts +1 -0
- package/lib/components/data/dataTemplate/model.d.ts.map +1 -1
- package/lib/components/data/listModule.d.ts +1 -1
- package/lib/components/data/listModule.d.ts.map +1 -1
- package/lib/components/data/listModule.js +11 -5
- package/lib/components/data/listModule.js.map +1 -1
- package/lib/components/data/updateModule.d.ts +5 -0
- package/lib/components/data/updateModule.d.ts.map +1 -1
- package/lib/components/data/updateModule.js +24 -2
- package/lib/components/data/updateModule.js.map +1 -1
- package/lib/components/display/newTable/index.d.ts +5 -0
- package/lib/components/display/newTable/index.d.ts.map +1 -1
- package/lib/components/display/newTable/index.js +576 -107
- package/lib/components/display/newTable/index.js.map +1 -1
- package/lib/components/display/newTable/labelPicker.d.ts +24 -0
- package/lib/components/display/newTable/labelPicker.d.ts.map +1 -0
- package/lib/components/display/newTable/labelPicker.js +228 -0
- package/lib/components/display/newTable/labelPicker.js.map +1 -0
- package/lib/components/input/datePicker/index.d.ts.map +1 -1
- package/lib/components/input/datePicker/index.js +18 -8
- package/lib/components/input/datePicker/index.js.map +1 -1
- package/lib/components/input/select/index.d.ts +13 -0
- package/lib/components/input/select/index.d.ts.map +1 -1
- package/lib/components/input/select/index.js +248 -31
- package/lib/components/input/select/index.js.map +1 -1
- package/lib/components/input/textInput/index.d.ts.map +1 -1
- package/lib/components/input/textInput/index.js +41 -6
- package/lib/components/input/textInput/index.js.map +1 -1
- package/lib/components/input/utils.d.ts +12 -0
- package/lib/components/input/utils.d.ts.map +1 -1
- package/lib/components/input/utils.js.map +1 -1
- package/lib/tail.css +2 -2
- package/package.json +1 -1
|
@@ -128,6 +128,7 @@ var newPagination_1 = require("../newPagination");
|
|
|
128
128
|
var recordActions_1 = require("../recordActions");
|
|
129
129
|
var scrollShadow_1 = require("../scrollShadow");
|
|
130
130
|
var columnWidth_1 = require("./columnWidth");
|
|
131
|
+
var labelPicker_1 = require("./labelPicker");
|
|
131
132
|
var tag_1 = require("../tag");
|
|
132
133
|
var defaultColours_1 = require("../../data/columnTypes/defaultColours");
|
|
133
134
|
var personAvatar_1 = require("../../data/columnTypes/personAvatar");
|
|
@@ -145,6 +146,23 @@ var WIDE_EDIT_TYPES = [
|
|
|
145
146
|
"file",
|
|
146
147
|
"signature",
|
|
147
148
|
];
|
|
149
|
+
// INFO: markers on pinned cells for the side their own after:/before: line
|
|
150
|
+
// draws — a left pin its right edge, a right pin, the "+" and Actions their
|
|
151
|
+
// left edge. gridLines="all" reads them so it never draws a second line there.
|
|
152
|
+
var PIN_EDGE_RIGHT_CLASS = "newtable-pin-edge-right";
|
|
153
|
+
var PIN_EDGE_LEFT_CLASS = "newtable-pin-edge-left";
|
|
154
|
+
// INFO: vertical lines for gridLines="all", drawn on the right of each
|
|
155
|
+
// header and body cell of this table only (child combinators keep nested
|
|
156
|
+
// tables out). A cell whose right edge a pin already draws — a left pin, or
|
|
157
|
+
// the cell just before a right pin — is skipped. The last cell is skipped so
|
|
158
|
+
// it does not double the outer border. A grouped header's sub-titles all get
|
|
159
|
+
// a line, since the cells to their right sit in the row above.
|
|
160
|
+
// INFO: an inset shadow, not border-r: the table collapses its borders, and a
|
|
161
|
+
// collapsed border stays behind when a sticky cell (the checkbox column beside
|
|
162
|
+
// the pins) scrolls. A shadow is the cell's own paint, so it moves with it.
|
|
163
|
+
// The colours are the pins' edge colours, gray-200 and gray-700.
|
|
164
|
+
var GRID_LINES_ALL_CLASS = "[&>thead>tr>th:not(:last-child):not(.newtable-pin-edge-right):not(:has(+.newtable-pin-edge-left))]:shadow-[inset_-1px_0_0_#e5e7eb] [&>tbody>tr>td:not(:last-child):not(.newtable-pin-edge-right):not(:has(+.newtable-pin-edge-left))]:shadow-[inset_-1px_0_0_#e5e7eb] [&>thead>tr+tr>th]:shadow-[inset_-1px_0_0_#e5e7eb]";
|
|
165
|
+
var GRID_LINES_ALL_DARK_CLASS = "[&>thead>tr>th:not(:last-child):not(.newtable-pin-edge-right):not(:has(+.newtable-pin-edge-left))]:shadow-[inset_-1px_0_0_#374151] [&>tbody>tr>td:not(:last-child):not(.newtable-pin-edge-right):not(:has(+.newtable-pin-edge-left))]:shadow-[inset_-1px_0_0_#374151] [&>thead>tr+tr>th]:shadow-[inset_-1px_0_0_#374151]";
|
|
148
166
|
// INFO: resolve dotted key paths (e.g. "group.subKey") against a row object.
|
|
149
167
|
// Required because flatColumns uses "parent.child" keys for groupData sub-columns.
|
|
150
168
|
var resolveValue = function (row, key) {
|
|
@@ -420,6 +438,72 @@ var TAG_LINE_MAX = 2;
|
|
|
420
438
|
// list, grid and kanban views show them; inside a table they are held to the
|
|
421
439
|
// height of a text line so a row with pictures stays one line tall
|
|
422
440
|
var CELL_FIT_CLASS = "[&_[data-cell-thumb=tile]]:!h-6 [&_[data-cell-thumb=tile]]:!w-6 [&_div[data-cell-thumb=tile]]:!p-0.5 [&_[data-cell-thumb=tile]_svg]:!h-4 [&_[data-cell-thumb=tile]_svg]:!w-4 [&_[data-cell-thumb=signature]]:!h-6 [&_[data-cell-line]]:!flex-nowrap [&_[data-cell-line]]:!gap-x-1";
|
|
441
|
+
// INFO: column types whose cell editor is a plain text field or text area,
|
|
442
|
+
// a date picker's read-only field, a phone's code and number, a yes/no
|
|
443
|
+
// dropdown (boolean, a Select that takes no typing), a list or multiple
|
|
444
|
+
// list with no colours (a coloured one has its board or label picker), a
|
|
445
|
+
// reference or list of references, which pick another record, roles, a person
|
|
446
|
+
// or people, or a pick from a referenced record's list. Under
|
|
447
|
+
// gridLines="all" their editor fills the cell (FILL_INPUT_CLASS).
|
|
448
|
+
var FILL_INPUT_TYPES = [
|
|
449
|
+
"string",
|
|
450
|
+
"number",
|
|
451
|
+
"email",
|
|
452
|
+
"textArea",
|
|
453
|
+
"date",
|
|
454
|
+
"contact",
|
|
455
|
+
"boolean",
|
|
456
|
+
"list",
|
|
457
|
+
"multipleList",
|
|
458
|
+
"reference",
|
|
459
|
+
"listReference",
|
|
460
|
+
"roles",
|
|
461
|
+
"person",
|
|
462
|
+
"listPerson",
|
|
463
|
+
"referenceSelection",
|
|
464
|
+
];
|
|
465
|
+
// INFO: drops the field's own box — background, rounded corners and the
|
|
466
|
+
// hover / focus border — so the text is typed straight into the cell; an
|
|
467
|
+
// errored field keeps its red border. The cell's ring shows which one is open.
|
|
468
|
+
// A number field also drops the browser's spinner; arrow keys still step it.
|
|
469
|
+
// A read-only field (the date picker's) shows no caret, as it takes no typing.
|
|
470
|
+
// With no box to pad, the field's right padding goes too, so its text has the
|
|
471
|
+
// same room as the value it replaces (a title was cut off by a few pixels).
|
|
472
|
+
// A phone's flag starts where the value read, and its number sits one space
|
|
473
|
+
// (4px, with the field's 1px border) after the code — it has no box of its
|
|
474
|
+
// own in a cell to keep apart.
|
|
475
|
+
var FILL_INPUT_CLASS = "[&_[data-composite-input]]:pl-[9px] [&_[data-composite-input]>input]:!ml-0 [&_[data-composite-input]>input]:!pl-[3px] [&_input]:!pr-0 [&_textarea]:!pr-0 [&_input[readonly]]:caret-transparent [&_input[readonly]]:cursor-pointer [&_input::-webkit-inner-spin-button]:appearance-none [&_input::-webkit-outer-spin-button]:appearance-none [&_input]:[-moz-appearance:textfield] [&_input]:!bg-transparent [&_input]:!rounded-none [&_input:not(.border-red-300)]:!border-transparent [&_textarea]:!bg-transparent [&_textarea]:!rounded-none [&_textarea:not(.border-red-300)]:!border-transparent";
|
|
476
|
+
var FILL_INPUT_CELL_CLASS = "focus-within:ring-2 focus-within:ring-inset focus-within:ring-primary-500";
|
|
477
|
+
// INFO: the ring also stays while the cell is being edited — a date picker's
|
|
478
|
+
// calendar takes focus once a day is picked, and the cell is still open
|
|
479
|
+
var FILL_INPUT_ACTIVE_CLASS = "ring-2 ring-inset ring-primary-500";
|
|
480
|
+
// INFO: a cell being edited is the field's own surface — white, or the dark
|
|
481
|
+
// field colour — rather than the row's hover or pin background showing through
|
|
482
|
+
var FILL_INPUT_EDIT_BG_CLASS = "focus-within:!bg-white";
|
|
483
|
+
var FILL_INPUT_EDIT_BG_DARK_CLASS = "focus-within:!bg-gray-800";
|
|
484
|
+
var FILL_INPUT_ACTIVE_BG_CLASS = "!bg-white";
|
|
485
|
+
var FILL_INPUT_ACTIVE_BG_DARK_CLASS = "!bg-gray-800";
|
|
486
|
+
// INFO: every class the two above put on a cell — the title cell lifts them
|
|
487
|
+
// off itself and draws its ring on an overlay clear of its action strips
|
|
488
|
+
var FILL_RING_TOKENS = "".concat(FILL_INPUT_CELL_CLASS, " ").concat(FILL_INPUT_ACTIVE_CLASS).split(" ");
|
|
489
|
+
// INFO: column id → records; the second map's record wins for the same id
|
|
490
|
+
var handleMergeReferencesDetails = function (local, incoming) {
|
|
491
|
+
if (local === void 0) { local = {}; }
|
|
492
|
+
if (incoming === void 0) { incoming = {}; }
|
|
493
|
+
var merged = __assign({}, local);
|
|
494
|
+
Object.entries(incoming).forEach(function (_a) {
|
|
495
|
+
var columnId = _a[0], records = _a[1];
|
|
496
|
+
var kept = merged[columnId];
|
|
497
|
+
if (!Array.isArray(records) || !Array.isArray(kept)) {
|
|
498
|
+
merged[columnId] = records;
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
var handleId = function (record) { var _a, _b; return String((_b = (_a = record === null || record === void 0 ? void 0 : record._id) !== null && _a !== void 0 ? _a : record === null || record === void 0 ? void 0 : record.id) !== null && _b !== void 0 ? _b : ""); };
|
|
502
|
+
var incomingIds = new Set(records.map(handleId));
|
|
503
|
+
merged[columnId] = __spreadArray(__spreadArray([], records, true), kept.filter(function (record) { return !incomingIds.has(handleId(record)); }), true);
|
|
504
|
+
});
|
|
505
|
+
return merged;
|
|
506
|
+
};
|
|
423
507
|
var handleGetListColour = function (col, value) {
|
|
424
508
|
var column = col;
|
|
425
509
|
if (!Array.isArray(column.listSelection) ||
|
|
@@ -431,7 +515,7 @@ var handleGetListColour = function (col, value) {
|
|
|
431
515
|
return column.listSelectionColour[index] || undefined;
|
|
432
516
|
};
|
|
433
517
|
var NewTable = function (rawProps) {
|
|
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;
|
|
518
|
+
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;
|
|
435
519
|
// INFO: props are read through the latest render. A row that was not drawn
|
|
436
520
|
// again keeps the handlers of the render that drew it, and those read
|
|
437
521
|
// props.onClickRow, props.data and the rest at the time they run — so a
|
|
@@ -519,7 +603,7 @@ var NewTable = function (rawProps) {
|
|
|
519
603
|
flatColumns.length = 0;
|
|
520
604
|
flatColumns.push.apply(flatColumns, __spreadArray(__spreadArray(__spreadArray([], leftCols, false), middleCols, false), rightCols, false));
|
|
521
605
|
}
|
|
522
|
-
var
|
|
606
|
+
var _7 = (0, react_2.useState)(props.fixedPagination ? true : false), isFixed = _7[0], setIsFixed = _7[1];
|
|
523
607
|
// INFO: the actions sit over the title cell's right padding: the pencil and
|
|
524
608
|
// the bubble in divided strips at the edge, then 8px from the text — kept
|
|
525
609
|
// clear so they never cover the title, and added to the cell's measured
|
|
@@ -538,46 +622,52 @@ var NewTable = function (rawProps) {
|
|
|
538
622
|
//=====================================================================================
|
|
539
623
|
// SECTION: Advanced Settings
|
|
540
624
|
//=====================================================================================
|
|
541
|
-
var
|
|
542
|
-
var
|
|
625
|
+
var _8 = (0, react_2.useState)(""), filterModal = _8[0], setFilterModal = _8[1];
|
|
626
|
+
var _9 = (0, react_2.useState)(""), addColumnModal = _9[0], setAddColumnModal = _9[1];
|
|
543
627
|
// INFO: what a DataTemplate around the table lets a cell save
|
|
544
628
|
var columnTypeActions = (0, react_2.useContext)(context_1.ColumnTypeContext);
|
|
545
|
-
var
|
|
546
|
-
var
|
|
547
|
-
var
|
|
548
|
-
var
|
|
549
|
-
var
|
|
550
|
-
var
|
|
551
|
-
var
|
|
629
|
+
var _10 = (0, react_2.useState)(""), newColumnName = _10[0], setNewColumnName = _10[1];
|
|
630
|
+
var _11 = (0, react_2.useState)("string"), newColumnType = _11[0], setNewColumnType = _11[1];
|
|
631
|
+
var _12 = (0, react_2.useState)(""), newColumnRefSpace = _12[0], setNewColumnRefSpace = _12[1];
|
|
632
|
+
var _13 = (0, react_2.useState)(""), newColumnRefLabel = _13[0], setNewColumnRefLabel = _13[1];
|
|
633
|
+
var _14 = (0, react_2.useState)(""), newColumnLookupReference = _14[0], setNewColumnLookupReference = _14[1];
|
|
634
|
+
var _15 = (0, react_2.useState)(""), newColumnLookupField = _15[0], setNewColumnLookupField = _15[1];
|
|
635
|
+
var _16 = (0, react_2.useState)([]), newColumnOptions = _16[0], setNewColumnOptions = _16[1];
|
|
552
636
|
// INFO: the option row whose colour palette is open
|
|
553
|
-
var
|
|
554
|
-
var
|
|
555
|
-
var
|
|
556
|
-
var
|
|
557
|
-
var
|
|
558
|
-
var
|
|
559
|
-
var
|
|
560
|
-
var
|
|
561
|
-
var
|
|
637
|
+
var _17 = (0, react_2.useState)(null), optionColourKey = _17[0], setOptionColourKey = _17[1];
|
|
638
|
+
var _18 = (0, react_2.useState)(false), newColumnRequired = _18[0], setNewColumnRequired = _18[1];
|
|
639
|
+
var _19 = (0, react_2.useState)(false), newColumnUnique = _19[0], setNewColumnUnique = _19[1];
|
|
640
|
+
var _20 = (0, react_2.useState)(false), newColumnReadOnly = _20[0], setNewColumnReadOnly = _20[1];
|
|
641
|
+
var _21 = (0, react_2.useState)(""), newColumnRatingMax = _21[0], setNewColumnRatingMax = _21[1];
|
|
642
|
+
var _22 = (0, react_2.useState)(""), newColumnButtonLabel = _22[0], setNewColumnButtonLabel = _22[1];
|
|
643
|
+
var _23 = (0, react_2.useState)(""), newColumnButtonColour = _23[0], setNewColumnButtonColour = _23[1];
|
|
644
|
+
var _24 = (0, react_2.useState)(""), newColumnButtonConfirm = _24[0], setNewColumnButtonConfirm = _24[1];
|
|
645
|
+
var _25 = (0, react_2.useState)(false), addingColumn = _25[0], setAddingColumn = _25[1];
|
|
562
646
|
// INFO: the formula as shown in the builder — column names, not ids
|
|
563
|
-
var
|
|
647
|
+
var _26 = (0, react_2.useState)(""), newColumnFormula = _26[0], setNewColumnFormula = _26[1];
|
|
564
648
|
var addColumnPopUpRef = (0, react_2.useRef)(null);
|
|
565
649
|
// INFO: the column being changed — empty while the panel adds a new one
|
|
566
|
-
var
|
|
650
|
+
var _27 = (0, react_2.useState)(null), editingColumn = _27[0], setEditingColumn = _27[1];
|
|
567
651
|
//=====================================================================================
|
|
568
652
|
// SECTION: Editable & Addable cells
|
|
569
653
|
//=====================================================================================
|
|
570
|
-
var
|
|
571
|
-
var
|
|
654
|
+
var _28 = (0, react_2.useState)(""), editDataRowId = _28[0], setEditDataRowId = _28[1];
|
|
655
|
+
var _29 = (0, react_2.useState)(""), editDataHeaderKey = _29[0], setEditDataHeaderKey = _29[1];
|
|
572
656
|
// INFO: an editable table used to mount an input in every cell — it read as a
|
|
573
657
|
// form, and a row click always landed on a child input. Only the hovered cell
|
|
574
658
|
// becomes its input now; NewTableHoverCell keeps that hover to itself.
|
|
575
|
-
|
|
659
|
+
// INFO: "rowId:colKey" of a gridLines="all" cell a click just opened — its
|
|
660
|
+
// editor takes focus as it mounts, with the caret at the end
|
|
661
|
+
var pendingFocusRef = (0, react_2.useRef)("");
|
|
662
|
+
// INFO: the cell a gridLines="all" multiple list is being picked in — its
|
|
663
|
+
// popover hangs from this element
|
|
664
|
+
var _30 = (0, react_2.useState)(null), labelPickerAnchor = _30[0], setLabelPickerAnchor = _30[1];
|
|
665
|
+
var _31 = (0, react_2.useState)(false), modalEditVisible = _31[0], setModalEditVisible = _31[1];
|
|
576
666
|
// INFO: whether the modal's signature pad has been drawn on
|
|
577
|
-
var
|
|
578
|
-
var
|
|
667
|
+
var _32 = (0, react_2.useState)(false), signatureSigning = _32[0], setSignatureSigning = _32[1];
|
|
668
|
+
var _33 = (0, react_2.useState)([]), collapsedGroupIds = _33[0], setCollapsedGroupIds = _33[1];
|
|
579
669
|
// INFO: rows shown per section when the sections do not page themselves
|
|
580
|
-
var
|
|
670
|
+
var _34 = (0, react_2.useState)({}), groupVisibleCounts = _34[0], setGroupVisibleCounts = _34[1];
|
|
581
671
|
// INFO: per-group scroll pagination. One sentinel element per band, observed
|
|
582
672
|
// by a single IntersectionObserver that fires props.onGroupLoadMore when a
|
|
583
673
|
// band's sentinel scrolls into view. The debounce guard stops repeat fires
|
|
@@ -595,37 +685,50 @@ var NewTable = function (rawProps) {
|
|
|
595
685
|
var lastSelectedRowRef = (0, react_2.useRef)(null);
|
|
596
686
|
var dragSelectRef = (0, react_2.useRef)(null);
|
|
597
687
|
var suppressNextClickRef = (0, react_2.useRef)(false);
|
|
598
|
-
var
|
|
599
|
-
var
|
|
600
|
-
var
|
|
601
|
-
var
|
|
688
|
+
var _35 = (0, react_2.useState)(false), isDragSelecting = _35[0], setIsDragSelecting = _35[1];
|
|
689
|
+
var _36 = (0, react_2.useState)(0), copiedCount = _36[0], setCopiedCount = _36[1];
|
|
690
|
+
var _37 = (0, react_2.useState)({}), editDataValue = _37[0], setEditDataValue = _37[1];
|
|
691
|
+
var _38 = (0, react_2.useState)(false), editDataIsLoading = _38[0], setEditDataIsLoading = _38[1];
|
|
602
692
|
// INFO: true while the empty bottom row is being filled in; the row itself is
|
|
603
693
|
// always there in an addable table
|
|
604
|
-
var
|
|
694
|
+
var _39 = (0, react_2.useState)(false), addData = _39[0], setAddData = _39[1];
|
|
605
695
|
var isAddRowPinned = props.paginationType === "scroll";
|
|
606
|
-
var
|
|
696
|
+
var _40 = (0, react_2.useState)({}), addDataValue = _40[0], setAddDataValue = _40[1];
|
|
607
697
|
// INFO: bumped after each saved row, so the next one starts with fresh
|
|
608
698
|
// inputs and its first cell takes the focus
|
|
609
|
-
var
|
|
699
|
+
var _41 = (0, react_2.useState)(0), addRowKey = _41[0], setAddRowKey = _41[1];
|
|
700
|
+
// INFO: the add row's coloured multiple list being picked under
|
|
701
|
+
// gridLines="all" — its label picker hangs from this cell
|
|
702
|
+
// INFO: the new row's required tag columns left empty on a save — their
|
|
703
|
+
// cells are ringed red until a label is picked
|
|
704
|
+
var _42 = (0, react_2.useState)([]), addTagErrors = _42[0], setAddTagErrors = _42[1];
|
|
705
|
+
var _43 = (0, react_2.useState)(null), addLabelPicker = _43[0], setAddLabelPicker = _43[1];
|
|
610
706
|
// INFO: the group whose own add row is being filled in; "" = the bottom row
|
|
611
|
-
var
|
|
707
|
+
var _44 = (0, react_2.useState)(""), addGroupId = _44[0], setAddGroupId = _44[1];
|
|
612
708
|
// INFO: the row armed by a press on its handle, so only the handle — never
|
|
613
709
|
// a click or a text selection in a cell — starts a drag
|
|
614
|
-
var
|
|
615
|
-
var
|
|
616
|
-
var
|
|
617
|
-
var
|
|
710
|
+
var _45 = (0, react_2.useState)(""), dragArmedRowId = _45[0], setDragArmedRowId = _45[1];
|
|
711
|
+
var _46 = (0, react_2.useState)(""), draggingRowId = _46[0], setDraggingRowId = _46[1];
|
|
712
|
+
var _47 = (0, react_2.useState)(""), dropGroupId = _47[0], setDropGroupId = _47[1];
|
|
713
|
+
var _48 = (0, react_2.useState)({}), referencesOptions = _48[0], setReferencesOptions = _48[1];
|
|
618
714
|
// INFO: seeded options sit under the local map so a cell's own search
|
|
619
715
|
// results still win per key
|
|
620
716
|
var mergedReferencesOptions = __assign(__assign({}, ((_m = props.referencesOptions) !== null && _m !== void 0 ? _m : {})), referencesOptions);
|
|
621
|
-
var
|
|
622
|
-
|
|
717
|
+
var _49 = (0, react_2.useState)({}), referencesDetails = _49[0], setReferencesDetails = _49[1];
|
|
718
|
+
// INFO: per column, the records a search found and the records the parent
|
|
719
|
+
// passes in, matched by id — a search copies the parent's records into the
|
|
720
|
+
// local map, so the parent's copy wins and a reload of the list reaches the
|
|
721
|
+
// cells, while a record only the search found is kept
|
|
722
|
+
// INFO: worked out once per change, not on every redraw — a cell being
|
|
723
|
+
// typed into redraws the table on each key
|
|
724
|
+
var mergedReferencesDetails = (0, react_2.useMemo)(function () { return handleMergeReferencesDetails(referencesDetails, props.referencesDetails); }, [referencesDetails, props.referencesDetails]);
|
|
725
|
+
var _50 = (0, react_2.useState)(false), referenceLoading = _50[0], setReferenceLoading = _50[1];
|
|
623
726
|
// INFO: measured pixel widths for pinned columns without an explicit width.
|
|
624
|
-
var
|
|
727
|
+
var _51 = (0, react_2.useState)({}), measuredPinWidths = _51[0], setMeasuredPinWidths = _51[1];
|
|
625
728
|
// INFO: the scrolling view's width, which caps how much the left pins take
|
|
626
|
-
var
|
|
729
|
+
var _52 = (0, react_2.useState)(0), pinViewWidth = _52[0], setPinViewWidth = _52[1];
|
|
627
730
|
// INFO: per large group, the rows [start, end) drawn; the rest are spacers
|
|
628
|
-
var
|
|
731
|
+
var _53 = (0, react_2.useState)({}), virtualRanges = _53[0], setVirtualRanges = _53[1];
|
|
629
732
|
// INFO: each drawn row's measured height, kept so a spacer is as tall as the
|
|
630
733
|
// rows it stands in for
|
|
631
734
|
var rowHeightsRef = (0, react_2.useRef)(new Map());
|
|
@@ -638,6 +741,9 @@ var NewTable = function (rawProps) {
|
|
|
638
741
|
version: 0,
|
|
639
742
|
});
|
|
640
743
|
var editDataValueRef = (0, react_2.useRef)({});
|
|
744
|
+
// INFO: the check a cell's blur is running — under gridLines="all" the next
|
|
745
|
+
// cell opens only once it is done, while the field it checks still exists
|
|
746
|
+
var blurCheckRef = (0, react_2.useRef)(null);
|
|
641
747
|
var editDataRowIdRef = (0, react_2.useRef)("");
|
|
642
748
|
var editDataHeaderKeyRef = (0, react_2.useRef)("");
|
|
643
749
|
var editDataInputRefs = (0, react_2.useRef)([]);
|
|
@@ -752,6 +858,40 @@ var NewTable = function (rawProps) {
|
|
|
752
858
|
var selectedRowBg = props.darkMode ? "bg-gray-700" : "bg-primary-50";
|
|
753
859
|
var rowHoverBg = props.darkMode ? "hover:bg-gray-700" : "hover:bg-gray-100";
|
|
754
860
|
var dividerColor = props.darkMode ? "divide-gray-700" : "divide-gray-100";
|
|
861
|
+
var gridLines = (_p = props.gridLines) !== null && _p !== void 0 ? _p : "horizontal";
|
|
862
|
+
// INFO: under gridLines="all" a coloured list cell paints its whole table
|
|
863
|
+
// cell, like a spreadsheet's cell fill, instead of holding a chip. The Select
|
|
864
|
+
// inside is told (cellInput.fill) to keep only the label colour. Same shades
|
|
865
|
+
// as the Select's own fill; a hex goes inline.
|
|
866
|
+
var handleGetCellFill = function (col, value) {
|
|
867
|
+
var _a;
|
|
868
|
+
if (gridLines !== "all")
|
|
869
|
+
return undefined;
|
|
870
|
+
var colour = handleGetListColour(col, value);
|
|
871
|
+
if (!colour)
|
|
872
|
+
return undefined;
|
|
873
|
+
if (colour.startsWith("#"))
|
|
874
|
+
return { className: "text-white", style: { backgroundColor: colour } };
|
|
875
|
+
return { className: (_a = select_1.FILL_CLASS[colour]) !== null && _a !== void 0 ? _a : select_1.FILL_CLASS.default };
|
|
876
|
+
};
|
|
877
|
+
// INFO: a pinned cell carries the row's background (and its hover and
|
|
878
|
+
// selected shades); with a fill those would fight the fill's class by CSS
|
|
879
|
+
// order, so they are dropped. after:/before: keep the pin's edge line.
|
|
880
|
+
var handleDropCellBg = function (className) {
|
|
881
|
+
return (className !== null && className !== void 0 ? className : "")
|
|
882
|
+
.split(" ")
|
|
883
|
+
.filter(function (each) {
|
|
884
|
+
return !each.includes("bg-") ||
|
|
885
|
+
each.startsWith("after:") ||
|
|
886
|
+
each.startsWith("before:");
|
|
887
|
+
})
|
|
888
|
+
.join(" ");
|
|
889
|
+
};
|
|
890
|
+
var gridLinesClass = gridLines === "all"
|
|
891
|
+
? props.darkMode
|
|
892
|
+
? GRID_LINES_ALL_DARK_CLASS
|
|
893
|
+
: GRID_LINES_ALL_CLASS
|
|
894
|
+
: "";
|
|
755
895
|
var cellFontColor = props.darkMode ? "text-gray-200" : "text-gray-700";
|
|
756
896
|
var titleFontColor = props.darkMode
|
|
757
897
|
? "text-primary-300 font-medium"
|
|
@@ -790,8 +930,8 @@ var NewTable = function (rawProps) {
|
|
|
790
930
|
var errorFontColor = props.darkMode ? "text-red-300" : "text-red-500";
|
|
791
931
|
// INFO: an edit commits on blur, but navigating away unmounts the table
|
|
792
932
|
// without one — the cell was left dirty on screen and the value never sent.
|
|
793
|
-
var onUpdateDataRef = (0, react_2.useRef)((
|
|
794
|
-
onUpdateDataRef.current = (
|
|
933
|
+
var onUpdateDataRef = (0, react_2.useRef)((_q = props.editable) === null || _q === void 0 ? void 0 : _q.onUpdateData);
|
|
934
|
+
onUpdateDataRef.current = (_r = props.editable) === null || _r === void 0 ? void 0 : _r.onUpdateData;
|
|
795
935
|
(0, react_2.useEffect)(function () {
|
|
796
936
|
return function () {
|
|
797
937
|
var _a, _b;
|
|
@@ -815,6 +955,16 @@ var NewTable = function (rawProps) {
|
|
|
815
955
|
document.addEventListener("mouseup", handleRelease);
|
|
816
956
|
return function () { return document.removeEventListener("mouseup", handleRelease); };
|
|
817
957
|
}, [dragArmedRowId, draggingRowId]);
|
|
958
|
+
// INFO: a closed edit lets go of its label picker's cell
|
|
959
|
+
(0, react_2.useEffect)(function () {
|
|
960
|
+
if (!editDataHeaderKey)
|
|
961
|
+
setLabelPickerAnchor(null);
|
|
962
|
+
}, [editDataHeaderKey]);
|
|
963
|
+
// INFO: a new or closed add row has no label picker open and no errors
|
|
964
|
+
(0, react_2.useEffect)(function () {
|
|
965
|
+
setAddLabelPicker(null);
|
|
966
|
+
setAddTagErrors([]);
|
|
967
|
+
}, [addData, addRowKey, addGroupId]);
|
|
818
968
|
// INFO: the clicked cell of a new row takes the focus once its input is on
|
|
819
969
|
// screen, so typing starts where the click landed
|
|
820
970
|
(0, react_2.useEffect)(function () {
|
|
@@ -824,8 +974,17 @@ var NewTable = function (rawProps) {
|
|
|
824
974
|
pendingAddFocusRef.current = "";
|
|
825
975
|
var frameId = requestAnimationFrame(function () {
|
|
826
976
|
var _a, _b;
|
|
827
|
-
var
|
|
828
|
-
|
|
977
|
+
var cell = (_a = addRowRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("[data-add-cell=\"".concat(colKey, "\"]"));
|
|
978
|
+
// INFO: under gridLines="all" a coloured multiple list's cell is its tag
|
|
979
|
+
// line, which opens the label picker — the click that started the row
|
|
980
|
+
// opens it too, as a click on any other cell starts typing there
|
|
981
|
+
var tagLine = cell === null || cell === void 0 ? void 0 : cell.querySelector('[data-testid^="table-add-tag-line-"]');
|
|
982
|
+
if (cell && tagLine) {
|
|
983
|
+
tagLine.focus();
|
|
984
|
+
setAddLabelPicker({ key: colKey, anchor: cell });
|
|
985
|
+
return;
|
|
986
|
+
}
|
|
987
|
+
(_b = cell === null || cell === void 0 ? void 0 : cell.querySelector("input, textarea, button")) === null || _b === void 0 ? void 0 : _b.focus();
|
|
829
988
|
});
|
|
830
989
|
return function () { return cancelAnimationFrame(frameId); };
|
|
831
990
|
}, [addData, addRowKey]);
|
|
@@ -1121,7 +1280,7 @@ var NewTable = function (rawProps) {
|
|
|
1121
1280
|
args_1[_i - 1] = arguments[_i];
|
|
1122
1281
|
}
|
|
1123
1282
|
return __awaiter(void 0, __spreadArray([keepAdding_1], args_1, true), void 0, function (keepAdding, leaving) {
|
|
1124
|
-
var valid, typed, data, _a;
|
|
1283
|
+
var valid, missingTags, typed, data, _a;
|
|
1125
1284
|
var _b, _c, _d;
|
|
1126
1285
|
if (leaving === void 0) { leaving = false; }
|
|
1127
1286
|
return __generator(this, function (_e) {
|
|
@@ -1135,7 +1294,20 @@ var NewTable = function (rawProps) {
|
|
|
1135
1294
|
return [4 /*yield*/, handleCheckFormInputRefs("add")];
|
|
1136
1295
|
case 1:
|
|
1137
1296
|
valid = _e.sent();
|
|
1138
|
-
|
|
1297
|
+
missingTags = gridLines === "all"
|
|
1298
|
+
? handleGetAddColumns()
|
|
1299
|
+
.filter(function (col) {
|
|
1300
|
+
var _a;
|
|
1301
|
+
return handleIsAddColumn(col) &&
|
|
1302
|
+
col.type === "multipleList" &&
|
|
1303
|
+
handleColumnShowsTags(col) &&
|
|
1304
|
+
(0, updateModule_1.handleIsFieldRequired)(col, addDataValueRef.current) &&
|
|
1305
|
+
!(0, utils_1.handleIsValueFilled)((_a = addDataValueRef.current) === null || _a === void 0 ? void 0 : _a[col.key]);
|
|
1306
|
+
})
|
|
1307
|
+
.map(function (col) { return col.key; })
|
|
1308
|
+
: [];
|
|
1309
|
+
setAddTagErrors(missingTags);
|
|
1310
|
+
if (!valid || missingTags.length > 0) {
|
|
1139
1311
|
if (leaving)
|
|
1140
1312
|
setAddData(false);
|
|
1141
1313
|
return [2 /*return*/];
|
|
@@ -1425,14 +1597,16 @@ var NewTable = function (rawProps) {
|
|
|
1425
1597
|
setEditDataHeaderKey("");
|
|
1426
1598
|
};
|
|
1427
1599
|
var handleEditDataOnBlur = function (columnId, updateData, options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1428
|
-
var currentRowId, valid, isDiff, previousValue, err_1;
|
|
1600
|
+
var currentRowId, check, valid, isDiff, previousValue, err_1;
|
|
1429
1601
|
var _a, _b;
|
|
1430
1602
|
var _c, _d, _e;
|
|
1431
1603
|
return __generator(this, function (_f) {
|
|
1432
1604
|
switch (_f.label) {
|
|
1433
1605
|
case 0:
|
|
1434
1606
|
currentRowId = editDataRowIdRef.current;
|
|
1435
|
-
|
|
1607
|
+
check = handleCheckFormInputRefs("edit");
|
|
1608
|
+
blurCheckRef.current = check;
|
|
1609
|
+
return [4 /*yield*/, check];
|
|
1436
1610
|
case 1:
|
|
1437
1611
|
valid = _f.sent();
|
|
1438
1612
|
if (!valid)
|
|
@@ -1479,7 +1653,7 @@ var NewTable = function (rawProps) {
|
|
|
1479
1653
|
// it stays here until the table unmounts. Tailwind cannot emit a runtime
|
|
1480
1654
|
// w-[Npx], so a width drives an inline style and wins over the col.width
|
|
1481
1655
|
// class.
|
|
1482
|
-
var
|
|
1656
|
+
var _54 = (0, react_2.useState)({}), columnWidths = _54[0], setColumnWidths = _54[1];
|
|
1483
1657
|
var resizeRef = (0, react_2.useRef)(null);
|
|
1484
1658
|
// INFO: a dragged width first, else the column's own fixed width in pixels
|
|
1485
1659
|
// whatever form it is stored in ("180px", "w-[180px]", "w-48")
|
|
@@ -1506,7 +1680,7 @@ var NewTable = function (rawProps) {
|
|
|
1506
1680
|
// has a set width — a pinned title, or one dragged or configured. A title
|
|
1507
1681
|
// sized by its content would widen and shift the table on every hover, so
|
|
1508
1682
|
// it keeps the chevron's room all the time instead.
|
|
1509
|
-
var titleKey = (
|
|
1683
|
+
var titleKey = (_s = flatColumns[0]) === null || _s === void 0 ? void 0 : _s.key;
|
|
1510
1684
|
var isTitleWidthFixed = !!titleKey &&
|
|
1511
1685
|
(leftPinned.includes(titleKey) ||
|
|
1512
1686
|
rightPinned.includes(titleKey) ||
|
|
@@ -2316,7 +2490,7 @@ var NewTable = function (rawProps) {
|
|
|
2316
2490
|
return Math.max(width, (_b = getTitleMinWidth(key)) !== null && _b !== void 0 ? _b : 0);
|
|
2317
2491
|
};
|
|
2318
2492
|
var pinCheckboxOffset = props.checkbox &&
|
|
2319
|
-
(props.data.length > 0 || (props.spaceData && ((
|
|
2493
|
+
(props.data.length > 0 || (props.spaceData && ((_t = props.spaceData) === null || _t === void 0 ? void 0 : _t.length) > 0))
|
|
2320
2494
|
? CHECKBOX_WIDTH
|
|
2321
2495
|
: 0;
|
|
2322
2496
|
/**
|
|
@@ -2389,7 +2563,7 @@ var NewTable = function (rawProps) {
|
|
|
2389
2563
|
minWidth: colWidth,
|
|
2390
2564
|
maxWidth: colWidth,
|
|
2391
2565
|
}));
|
|
2392
|
-
borderClass = "".concat(pinBase, " ").concat(afterBase, " after:right-0 ").concat(afterColor);
|
|
2566
|
+
borderClass = "".concat(pinBase, " ").concat(afterBase, " after:right-0 ").concat(afterColor, " ").concat(PIN_EDGE_RIGHT_CLASS);
|
|
2393
2567
|
}
|
|
2394
2568
|
else if (rightIdx >= 0) {
|
|
2395
2569
|
// INFO: offset = sum of widths of all right-pinned columns after this one,
|
|
@@ -2406,7 +2580,7 @@ var NewTable = function (rawProps) {
|
|
|
2406
2580
|
minWidth: colWidth,
|
|
2407
2581
|
maxWidth: colWidth,
|
|
2408
2582
|
}));
|
|
2409
|
-
borderClass = "".concat(pinBase, " ").concat(afterBase, " after:left-0 ").concat(afterColor);
|
|
2583
|
+
borderClass = "".concat(pinBase, " ").concat(afterBase, " after:left-0 ").concat(afterColor, " ").concat(PIN_EDGE_LEFT_CLASS);
|
|
2410
2584
|
}
|
|
2411
2585
|
if (!style)
|
|
2412
2586
|
return undefined;
|
|
@@ -2475,11 +2649,30 @@ var NewTable = function (rawProps) {
|
|
|
2475
2649
|
handleOnChangeText: handleOnChangeText,
|
|
2476
2650
|
handleOnChangeSelect: handleOnChangeSelect,
|
|
2477
2651
|
handleOnChangeDate: handleOnChangeDate,
|
|
2478
|
-
}, false, cellInput,
|
|
2652
|
+
}, false, cellInput,
|
|
2653
|
+
// INFO: a yes/no, plain list or reference cell under gridLines="all"
|
|
2654
|
+
// opens its list in dark mode too. Other cell editors are not handed
|
|
2655
|
+
// darkMode yet — passing it to all of them would restyle cells under
|
|
2656
|
+
// "horizontal" as well.
|
|
2657
|
+
cellInput.fill &&
|
|
2658
|
+
!ds.showTagSelections &&
|
|
2659
|
+
[
|
|
2660
|
+
"boolean",
|
|
2661
|
+
"list",
|
|
2662
|
+
"multipleList",
|
|
2663
|
+
"reference",
|
|
2664
|
+
"listReference",
|
|
2665
|
+
"roles",
|
|
2666
|
+
"person",
|
|
2667
|
+
"listPerson",
|
|
2668
|
+
"referenceSelection",
|
|
2669
|
+
].includes(ds.type)
|
|
2670
|
+
? { darkMode: props.darkMode }
|
|
2671
|
+
: undefined, {
|
|
2479
2672
|
dbModule: axios_1.default,
|
|
2480
2673
|
devSettings: props.devSettings,
|
|
2481
2674
|
referencesOptions: mergedReferencesOptions,
|
|
2482
|
-
referencesDetails:
|
|
2675
|
+
referencesDetails: mergedReferencesDetails,
|
|
2483
2676
|
referenceLoading: referenceLoading,
|
|
2484
2677
|
setReferenceLoading: setReferenceLoading,
|
|
2485
2678
|
setReferencesOptions: setReferencesOptions,
|
|
@@ -2487,12 +2680,60 @@ var NewTable = function (rawProps) {
|
|
|
2487
2680
|
});
|
|
2488
2681
|
};
|
|
2489
2682
|
// INFO: a cell being typed into stays an input after the pointer leaves it
|
|
2683
|
+
// INFO: under gridLines="all" a cell's editor is drawn only while that cell
|
|
2684
|
+
// is open, so opening another one removes it at once. A field still being
|
|
2685
|
+
// typed in is left first, so its blur saves it as it always does — a tap on
|
|
2686
|
+
// a touch screen lands on the next cell without blurring the field
|
|
2687
|
+
// INFO: a field checks itself by setting its error state and waiting for
|
|
2688
|
+
// React to apply it — a field removed first never answers, and its save
|
|
2689
|
+
// never ran. So the next cell opens only after the check, and not at all
|
|
2690
|
+
// when the value left behind fails it; that cell keeps its error instead.
|
|
2691
|
+
var handleOpenAfterLeaving = function (target, open) {
|
|
2692
|
+
var _a, _b;
|
|
2693
|
+
var active = document.activeElement;
|
|
2694
|
+
var isLeaving = !!active &&
|
|
2695
|
+
active !== document.body &&
|
|
2696
|
+
!!((_a = tableRef.current) === null || _a === void 0 ? void 0 : _a.contains(active)) &&
|
|
2697
|
+
!((_b = target.closest("td")) === null || _b === void 0 ? void 0 : _b.contains(active));
|
|
2698
|
+
if (!isLeaving) {
|
|
2699
|
+
open();
|
|
2700
|
+
return;
|
|
2701
|
+
}
|
|
2702
|
+
blurCheckRef.current = null;
|
|
2703
|
+
active.blur();
|
|
2704
|
+
var check = blurCheckRef.current;
|
|
2705
|
+
if (!check) {
|
|
2706
|
+
open();
|
|
2707
|
+
return;
|
|
2708
|
+
}
|
|
2709
|
+
check.then(function (valid) {
|
|
2710
|
+
if (valid)
|
|
2711
|
+
open();
|
|
2712
|
+
});
|
|
2713
|
+
};
|
|
2490
2714
|
var handleIsCellEditing = function (rowId, colKey) {
|
|
2491
2715
|
return editDataRowId === rowId && editDataHeaderKey === colKey;
|
|
2492
2716
|
};
|
|
2493
2717
|
var renderReadCellValue = function (col, row, cellValue) {
|
|
2494
2718
|
var _a;
|
|
2495
|
-
|
|
2719
|
+
// INFO: under gridLines="all" a list of names (a list of references)
|
|
2720
|
+
// reads "A, B", as a multiple list's picks do — the read module joins an
|
|
2721
|
+
// array with bare commas
|
|
2722
|
+
var isNameList = gridLines === "all" &&
|
|
2723
|
+
Array.isArray(cellValue) &&
|
|
2724
|
+
cellValue.every(function (each) { return typeof each === "string"; });
|
|
2725
|
+
// INFO: roles arrive as one string joined with bare commas, so under
|
|
2726
|
+
// gridLines="all" they are read from the row's keys instead
|
|
2727
|
+
var rawRoles = resolveValue(row, col.key);
|
|
2728
|
+
var roleLabels = gridLines === "all" && col.type === "roles" && Array.isArray(rawRoles)
|
|
2729
|
+
? rawRoles
|
|
2730
|
+
.map(function (each) {
|
|
2731
|
+
var _a, _b, _c, _d;
|
|
2732
|
+
return (_d = (_c = (_b = (_a = props.devSettings) === null || _a === void 0 ? void 0 : _a.roleOptions) === null || _b === void 0 ? void 0 : _b.find(function (option) { return option.key === each; })) === null || _c === void 0 ? void 0 : _c.label) !== null && _d !== void 0 ? _d : String(each);
|
|
2733
|
+
})
|
|
2734
|
+
.join(", ")
|
|
2735
|
+
: undefined;
|
|
2736
|
+
var value = (0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, roleLabels !== null && roleLabels !== void 0 ? roleLabels : (isNameList ? cellValue.join(", ") : cellValue), props.bareSettings, true, props.disableEllipsisOnLongWord);
|
|
2496
2737
|
if (!props.newTabUrl || !props.onClickRow)
|
|
2497
2738
|
return value;
|
|
2498
2739
|
return (react_2.default.createElement(link_1.Link, { href: props.newTabUrl + row.id + ((_a = props.addNewTabUrl) !== null && _a !== void 0 ? _a : ""), className: "w-full block ".concat(handleIsReadCellFixed(col) ? "truncate" : ""), linkType: props.linkType, custom: props.custom }, value));
|
|
@@ -2507,7 +2748,10 @@ var NewTable = function (rawProps) {
|
|
|
2507
2748
|
return (react_2.default.createElement(react_2.default.Fragment, null,
|
|
2508
2749
|
shown.map(function (pick) {
|
|
2509
2750
|
var _a;
|
|
2510
|
-
return (react_2.default.createElement(tag_1.Tag, { key: pick, tagText: pick, size: "small", variant: "flat", color: (_a = handleGetListColour(col, pick)) !== null && _a !== void 0 ? _a : "primary", rounded: "md",
|
|
2751
|
+
return (react_2.default.createElement(tag_1.Tag, { key: pick, tagText: pick, size: "small", variant: "flat", color: (_a = handleGetListColour(col, pick)) !== null && _a !== void 0 ? _a : "primary", rounded: "md",
|
|
2752
|
+
// INFO: under gridLines="all" the row's gap-1 is the only space
|
|
2753
|
+
// between tags — Tag's own mx-1 doubled it to 12px
|
|
2754
|
+
className: "shrink-0 whitespace-nowrap ".concat(gridLines === "all" ? "!mx-0" : "") }));
|
|
2511
2755
|
}),
|
|
2512
2756
|
picks.length > shown.length && (react_2.default.createElement("span", { className: "shrink-0 text-xs text-gray-500" },
|
|
2513
2757
|
"+",
|
|
@@ -2517,12 +2761,33 @@ var NewTable = function (rawProps) {
|
|
|
2517
2761
|
var _a, _b, _c, _d;
|
|
2518
2762
|
var tempDS = __assign(__assign({}, col), { id: col.key, name: col.title, type: (_a = col.type) !== null && _a !== void 0 ? _a : "string", showTagSelections: handleColumnShowsTags(col) });
|
|
2519
2763
|
var editingRow = editDataRowId === rowId;
|
|
2520
|
-
|
|
2764
|
+
var cellFill = tempDS.showTagSelections
|
|
2765
|
+
? handleGetCellFill(col, resolveValue(rowData, col.key))
|
|
2766
|
+
: undefined;
|
|
2767
|
+
// INFO: the board of colour blocks applies to every coloured cell under
|
|
2768
|
+
// gridLines="all", an empty one too. The cell darkens on hover and, while
|
|
2769
|
+
// its board is open, carries an inset ring like a sheet's active cell —
|
|
2770
|
+
// a shadow, as Chrome paints no outline on a collapsed table's cell, and
|
|
2771
|
+
// !important so it replaces the grid line's own shadow there.
|
|
2772
|
+
var isFillColumn = gridLines === "all" && !!tempDS.showTagSelections;
|
|
2773
|
+
var isFillActive = editingRow && editDataHeaderKey === col.key;
|
|
2774
|
+
var isFillInput = gridLines === "all" &&
|
|
2775
|
+
!tempDS.showTagSelections &&
|
|
2776
|
+
FILL_INPUT_TYPES.includes((_b = col.type) !== null && _b !== void 0 ? _b : "string");
|
|
2777
|
+
var fillStateClass = !isFillColumn
|
|
2778
|
+
? ""
|
|
2779
|
+
: cellFill
|
|
2780
|
+
? "cursor-pointer hover:brightness-95 ".concat(isFillActive ? "!shadow-[inset_0_0_0_2px_rgba(255,255,255,0.85)]" : "")
|
|
2781
|
+
: "cursor-pointer ".concat(props.darkMode ? "hover:bg-gray-800" : "hover:bg-gray-50", " ").concat(isFillActive ? "!shadow-[inset_0_0_0_2px_#9ca3af]" : "");
|
|
2782
|
+
var pinProps = getPinProps(col.key, false, rowBgClass, isHoverable);
|
|
2783
|
+
return (react_2.default.createElement("td", { key: col.key + String(colIndex), "data-cell-key": col.key, "data-edit-cell": "".concat(rowId, ":").concat(col.key), "data-cell-fill": cellFill ? "" : undefined,
|
|
2521
2784
|
// INFO: pinned columns use whitespace-normal so text wraps within the fixed width.
|
|
2522
2785
|
// col.width must match the read-only cell's width source so a column keeps one
|
|
2523
2786
|
// width whether a row is being edited or shown read-only — without it the cell
|
|
2524
2787
|
// shrinks/grows on hover and staggers the column.
|
|
2525
|
-
|
|
2788
|
+
// INFO: a cell fill comes after the pin classes so its colour wins over
|
|
2789
|
+
// a pinned cell's row background
|
|
2790
|
+
className: "".concat(editCellPadding, " ").concat(handleCellMinWidth(col.type), " ").concat(col.width ? "".concat(col.width, " flex-shrink-0") : "", " ").concat(getPinProps(col.key, false) ? "whitespace-normal break-words" : col.width ? "" : "whitespace-nowrap", " text-sm ").concat(cellFontColor, " ").concat(cellFill ? handleDropCellBg(pinProps === null || pinProps === void 0 ? void 0 : pinProps.className) : ((_c = pinProps === null || pinProps === void 0 ? void 0 : pinProps.className) !== null && _c !== void 0 ? _c : ""), " ").concat((_d = cellFill === null || cellFill === void 0 ? void 0 : cellFill.className) !== null && _d !== void 0 ? _d : "", " ").concat(fillStateClass, " ").concat(isFillInput ? "".concat(FILL_INPUT_CELL_CLASS, " ").concat(props.darkMode ? FILL_INPUT_EDIT_BG_DARK_CLASS : FILL_INPUT_EDIT_BG_CLASS, " ").concat(isFillActive ? "".concat(FILL_INPUT_ACTIVE_CLASS, " ").concat(props.darkMode ? FILL_INPUT_ACTIVE_BG_DARK_CLASS : FILL_INPUT_ACTIVE_BG_CLASS) : "") : ""), style: __assign(__assign({}, pinProps === null || pinProps === void 0 ? void 0 : pinProps.style), cellFill === null || cellFill === void 0 ? void 0 : cellFill.style) },
|
|
2526
2791
|
react_2.default.createElement("div", {
|
|
2527
2792
|
// INFO: w-0 on the control, not min-w-0 — the table is sized w-max, so
|
|
2528
2793
|
// an input's browser-default ~20ch intrinsic width feeds max-content
|
|
@@ -2534,11 +2799,41 @@ var NewTable = function (rawProps) {
|
|
|
2534
2799
|
// min-w-full assumes one input per cell — a composite control has two,
|
|
2535
2800
|
// each of which then demanded the full width. Inside one, the fields
|
|
2536
2801
|
// size to the row instead.
|
|
2537
|
-
|
|
2802
|
+
ref: function (element) {
|
|
2803
|
+
var key = "".concat(rowId, ":").concat(col.key);
|
|
2804
|
+
if (!element || pendingFocusRef.current !== key)
|
|
2805
|
+
return;
|
|
2806
|
+
pendingFocusRef.current = "";
|
|
2807
|
+
// INFO: on the next tick — the editor renders again as the edit
|
|
2808
|
+
// state settles, and a field focused now would be replaced
|
|
2809
|
+
setTimeout(function () {
|
|
2810
|
+
var _a, _b, _c;
|
|
2811
|
+
var cell = (_a = tableRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("[data-edit-cell=\"".concat(CSS.escape(key), "\"]"));
|
|
2812
|
+
// INFO: the field you type in — not a phone's read-only code or
|
|
2813
|
+
// a date picker's field, which opens itself. A yes/no cell's
|
|
2814
|
+
// field is read-only and opens its list as it takes focus.
|
|
2815
|
+
var field = cell === null || cell === void 0 ? void 0 : cell.querySelector(col.type === "boolean"
|
|
2816
|
+
? "input"
|
|
2817
|
+
: "input:not([readonly]):not([type=hidden]), textarea");
|
|
2818
|
+
if (!field)
|
|
2819
|
+
return;
|
|
2820
|
+
field.focus();
|
|
2821
|
+
var end = (_c = (_b = field.value) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0;
|
|
2822
|
+
try {
|
|
2823
|
+
field.setSelectionRange(end, end);
|
|
2824
|
+
}
|
|
2825
|
+
catch (_d) {
|
|
2826
|
+
// INFO: number and email fields have no caret position to set
|
|
2827
|
+
}
|
|
2828
|
+
}, 0);
|
|
2829
|
+
}, className: "".concat(isFillInput ? FILL_INPUT_CLASS : "", " w-full p-[1px] [&>*]:w-full [&_input]:w-0 [&_input]:min-w-full [&_textarea]:w-0 [&_textarea]:min-w-full [&_input]:h-[32px] [&_textarea]:min-h-[32px] [&_[data-composite-input]_input]:min-w-0 [&_[data-composite-input]_.PhoneInputInput]:w-14"), onClick: function (e) {
|
|
2538
2830
|
e.stopPropagation();
|
|
2539
2831
|
handleEditDataOnClick(rowId, col.key, rowData);
|
|
2540
2832
|
} }, renderFormCell(rowData, tempDS, editingRow ? editDataInputRefs.current[colIndex] : null, {
|
|
2541
2833
|
active: true,
|
|
2834
|
+
fill: isFillColumn || isFillInput,
|
|
2835
|
+
// INFO: this editor mounts on the click that opens it
|
|
2836
|
+
openOnMount: isFillInput,
|
|
2542
2837
|
onBlur: function (updateData, options) {
|
|
2543
2838
|
return handleEditDataOnBlur(col.key, updateData !== null && updateData !== void 0 ? updateData : (editDataRowIdRef.current === rowId
|
|
2544
2839
|
? editDataValueRef.current
|
|
@@ -2591,7 +2886,7 @@ var NewTable = function (rawProps) {
|
|
|
2591
2886
|
: undefined,
|
|
2592
2887
|
};
|
|
2593
2888
|
return {
|
|
2594
|
-
className: "sticky right-0 z-[3] ".concat(bg, " ").concat(hoverClass, " before:absolute before:inset-y-0 before:left-0 before:w-px before:pointer-events-none ").concat(divider),
|
|
2889
|
+
className: "sticky right-0 z-[3] ".concat(bg, " ").concat(hoverClass, " before:absolute before:inset-y-0 before:left-0 before:w-px before:pointer-events-none ").concat(divider, " ").concat(PIN_EDGE_LEFT_CLASS),
|
|
2595
2890
|
// INFO: right-pinned data columns and the add-column "+" offset by this
|
|
2596
2891
|
// width, so it has to be exact while either exists
|
|
2597
2892
|
style: rightPinned.length > 0 || ((_b = props.advSettings) === null || _b === void 0 ? void 0 : _b.addColumnEnabled)
|
|
@@ -2621,7 +2916,7 @@ var NewTable = function (rawProps) {
|
|
|
2621
2916
|
style: { width: ADD_COLUMN_WIDTH, minWidth: ADD_COLUMN_WIDTH },
|
|
2622
2917
|
};
|
|
2623
2918
|
return {
|
|
2624
|
-
className: "sticky z-[3] ".concat(bg, " ").concat(hoverClass, " before:absolute before:inset-y-0 before:left-0 before:w-px before:pointer-events-none ").concat(divider),
|
|
2919
|
+
className: "sticky z-[3] ".concat(bg, " ").concat(hoverClass, " before:absolute before:inset-y-0 before:left-0 before:w-px before:pointer-events-none ").concat(divider, " ").concat(PIN_EDGE_LEFT_CLASS),
|
|
2625
2920
|
style: {
|
|
2626
2921
|
right: handleShowsActionColumn() ? ACTION_COLUMN_WIDTH : 0,
|
|
2627
2922
|
width: ADD_COLUMN_WIDTH,
|
|
@@ -2631,7 +2926,7 @@ var NewTable = function (rawProps) {
|
|
|
2631
2926
|
};
|
|
2632
2927
|
// INFO: worked out here, after the Actions and "+" helpers it reads, and
|
|
2633
2928
|
// only read by the render helpers called from the return below
|
|
2634
|
-
var
|
|
2929
|
+
var _55 = handleFitPins(), fittedLeftPins = _55.widths, narrowPins = _55.narrow;
|
|
2635
2930
|
var renderActionColumnHeader = function () {
|
|
2636
2931
|
if (handleShowsActionColumn()) {
|
|
2637
2932
|
var pin = handleGetActionCellPin(true);
|
|
@@ -2682,6 +2977,64 @@ var NewTable = function (rawProps) {
|
|
|
2682
2977
|
}
|
|
2683
2978
|
return (react_2.default.createElement("td", { className: "".concat(cellPadding, " text-sm ").concat(pin.className), style: pin.style }));
|
|
2684
2979
|
};
|
|
2980
|
+
// INFO: under gridLines="all" a new row's cells are filled in as an edited
|
|
2981
|
+
// row's are — a text, number, date, phone or plain dropdown field fills its
|
|
2982
|
+
// cell and rings it while in focus, a coloured list opens its colour board
|
|
2983
|
+
// and fills the cell with the picked colour, and a coloured multiple list
|
|
2984
|
+
// keeps its tags in the cell and opens the label picker under it. Picks
|
|
2985
|
+
// stay in the new row until it is saved. "horizontal" keeps the boxed
|
|
2986
|
+
// fields.
|
|
2987
|
+
var renderAddFillCell = function (ds, col, index) {
|
|
2988
|
+
var _a, _b;
|
|
2989
|
+
var value = addDataValue === null || addDataValue === void 0 ? void 0 : addDataValue[ds.id];
|
|
2990
|
+
if (ds.type === "multipleList" && ds.showTagSelections) {
|
|
2991
|
+
var picks = (Array.isArray(value) ? value : value ? [value] : []).map(String);
|
|
2992
|
+
var isPicking = (addLabelPicker === null || addLabelPicker === void 0 ? void 0 : addLabelPicker.key) === ds.id;
|
|
2993
|
+
var isMissing = addTagErrors.includes(ds.id) && picks.length === 0;
|
|
2994
|
+
var handleOpen_1 = function (target) {
|
|
2995
|
+
var cell = target.closest("td");
|
|
2996
|
+
if (cell)
|
|
2997
|
+
setAddLabelPicker({ key: ds.id, anchor: cell });
|
|
2998
|
+
};
|
|
2999
|
+
return (react_2.default.createElement("td", { key: ds.id + String(index), "data-add-cell": ds.id, "data-add-error": isMissing ? "" : undefined, className: "".concat(editCellPadding, " ").concat(handleCellMinWidth(ds.type), " text-sm ").concat(cellFontColor, " ").concat(isPicking ? "!shadow-[inset_0_0_0_2px_#9ca3af]" : isMissing ? "!shadow-[inset_0_0_0_2px_#fca5a5]" : "") },
|
|
3000
|
+
react_2.default.createElement("div", { "data-testid": "table-add-tag-line-".concat(ds.id), role: "button", "aria-haspopup": "dialog", "aria-expanded": isPicking, tabIndex: 0, "aria-label": "Pick ".concat(col.title), className: "flex h-[34px] cursor-pointer items-center gap-1 overflow-hidden whitespace-nowrap", onClick: function (e) { return handleOpen_1(e.currentTarget); }, onKeyDown: function (e) {
|
|
3001
|
+
if (e.key !== "Enter" && e.key !== " ")
|
|
3002
|
+
return;
|
|
3003
|
+
e.preventDefault();
|
|
3004
|
+
e.stopPropagation();
|
|
3005
|
+
handleOpen_1(e.currentTarget);
|
|
3006
|
+
} },
|
|
3007
|
+
renderTagLine(col, picks),
|
|
3008
|
+
isMissing && react_2.default.createElement("span", { className: "sr-only" }, "Required")),
|
|
3009
|
+
isPicking && addLabelPicker && (react_2.default.createElement(labelPicker_1.LabelPicker, { anchor: addLabelPicker.anchor, darkMode: props.darkMode, options: ((_a = col.listSelection) !== null && _a !== void 0 ? _a : []).map(function (key) { return ({
|
|
3010
|
+
key: String(key),
|
|
3011
|
+
color: handleGetListColour(col, key),
|
|
3012
|
+
}); }), value: picks, required: (0, updateModule_1.handleIsFieldRequired)(col, addDataValue),
|
|
3013
|
+
// INFO: through the same clone every other cell's change takes,
|
|
3014
|
+
// so the row keeps the defaults it shows (a required date's
|
|
3015
|
+
// today, a required list's first option) when this is the only
|
|
3016
|
+
// cell changed
|
|
3017
|
+
onChange: function (next) {
|
|
3018
|
+
var cloned = handleGenerateClonedData();
|
|
3019
|
+
cloned[ds.id] = next;
|
|
3020
|
+
handleUpdateChangeData(cloned);
|
|
3021
|
+
}, onClose: function () { return setAddLabelPicker(null); } }))));
|
|
3022
|
+
}
|
|
3023
|
+
var isFillColumn = !!ds.showTagSelections;
|
|
3024
|
+
var isFillInput = !ds.showTagSelections && FILL_INPUT_TYPES.includes(ds.type);
|
|
3025
|
+
var cellFill = isFillColumn ? handleGetCellFill(col, value) : undefined;
|
|
3026
|
+
var fillStateClass = !isFillColumn
|
|
3027
|
+
? ""
|
|
3028
|
+
: cellFill
|
|
3029
|
+
? "cursor-pointer hover:brightness-95"
|
|
3030
|
+
: "cursor-pointer ".concat(props.darkMode ? "hover:bg-gray-800" : "hover:bg-gray-50");
|
|
3031
|
+
return (react_2.default.createElement("td", { key: ds.id + String(index), "data-add-cell": ds.id, "data-cell-fill": cellFill ? "" : undefined, className: "".concat(editCellPadding, " ").concat(handleCellMinWidth(ds.type), " whitespace-nowrap text-sm ").concat(cellFontColor, " ").concat((_b = cellFill === null || cellFill === void 0 ? void 0 : cellFill.className) !== null && _b !== void 0 ? _b : "", " ").concat(fillStateClass, " ").concat(isFillInput ? "".concat(FILL_INPUT_CELL_CLASS, " ").concat(props.darkMode ? FILL_INPUT_EDIT_BG_DARK_CLASS : FILL_INPUT_EDIT_BG_CLASS) : ""), style: cellFill === null || cellFill === void 0 ? void 0 : cellFill.style },
|
|
3032
|
+
react_2.default.createElement("div", { className: "".concat(isFillInput ? FILL_INPUT_CLASS : "", " w-full p-[1px] [&>*]:w-full [&_input]:w-0 [&_input]:min-w-full [&_textarea]:w-0 [&_textarea]:min-w-full [&_input]:h-[32px] [&_textarea]:min-h-[32px] [&_[data-composite-input]_input]:min-w-0 [&_[data-composite-input]_.PhoneInputInput]:w-14") }, renderFormCell(addDataValue, ds, addDataInputRefs.current[flatColumns.findIndex(function (each) { return each.key === ds.id; })], {
|
|
3033
|
+
active: true,
|
|
3034
|
+
fill: isFillColumn || isFillInput,
|
|
3035
|
+
onBlur: function () { },
|
|
3036
|
+
}))));
|
|
3037
|
+
};
|
|
2685
3038
|
var renderAddDataRow = function () {
|
|
2686
3039
|
var filteredCols = handleGetAddColumns();
|
|
2687
3040
|
var colsAsDS = handleConvertColumnToDataStructure(filteredCols);
|
|
@@ -2689,16 +3042,18 @@ var NewTable = function (rawProps) {
|
|
|
2689
3042
|
props.checkbox && react_2.default.createElement("td", null),
|
|
2690
3043
|
colsAsDS.map(function (ds, index) {
|
|
2691
3044
|
if (handleIsAddColumn(filteredCols[index])) {
|
|
3045
|
+
if (gridLines === "all")
|
|
3046
|
+
return renderAddFillCell(ds, filteredCols[index], index);
|
|
2692
3047
|
return (react_2.default.createElement("td", { key: ds.id + String(index), "data-add-cell": ds.id, className: "px-4 py-4 whitespace-nowrap align-top" },
|
|
2693
3048
|
react_2.default.createElement("div", { className: "min-w-[10rem]" }, renderFormCell(addDataValue, ds, addDataInputRefs.current[flatColumns.findIndex(function (col) { return col.key === ds.id; })], { active: true, onBlur: function () { } }))));
|
|
2694
3049
|
}
|
|
2695
3050
|
return react_2.default.createElement("td", { key: ds.id + String(index), "data-add-cell": ds.id });
|
|
2696
3051
|
}),
|
|
2697
3052
|
renderAddColumnCell(),
|
|
2698
|
-
react_2.default.createElement("td", { className: "".concat(cellPadding, " text-sm ").concat(handleGetActionCellPin(false).className), style: handleGetActionCellPin(false).style },
|
|
2699
|
-
react_2.default.createElement("div", { className: "flex flex-row gap-2" },
|
|
2700
|
-
react_2.default.createElement(iconButton_1.IconButton, { testId: "table-add-row-confirm", icon: react_2.default.createElement(solid_2.CheckIcon, { className: "w-
|
|
2701
|
-
react_2.default.createElement(iconButton_1.IconButton, { testId: "table-add-row-cancel", icon: react_2.default.createElement(solid_2.XMarkIcon, { className: "h-5 w-5 text-red-500" }), onClick: handleCancelAdd })))));
|
|
3053
|
+
react_2.default.createElement("td", { className: "".concat(gridLines === "all" ? editCellPadding : cellPadding, " text-sm ").concat(handleGetActionCellPin(false).className), style: handleGetActionCellPin(false).style },
|
|
3054
|
+
react_2.default.createElement("div", { className: "flex flex-row ".concat(gridLines === "all" ? "gap-1" : "gap-2") },
|
|
3055
|
+
react_2.default.createElement(iconButton_1.IconButton, { testId: "table-add-row-confirm", size: gridLines === "all" ? "small" : undefined, darkMode: gridLines === "all" ? props.darkMode : undefined, icon: react_2.default.createElement(solid_2.CheckIcon, { className: "".concat(gridLines === "all" ? "h-4 w-4" : "h-5 w-5", " text-green-500") }), onClick: function () { return handleCommitAdd(false); } }),
|
|
3056
|
+
react_2.default.createElement(iconButton_1.IconButton, { testId: "table-add-row-cancel", size: gridLines === "all" ? "small" : undefined, darkMode: gridLines === "all" ? props.darkMode : undefined, icon: react_2.default.createElement(solid_2.XMarkIcon, { className: "".concat(gridLines === "all" ? "h-4 w-4" : "h-5 w-5", " text-red-500") }), onClick: handleCancelAdd })))));
|
|
2702
3057
|
};
|
|
2703
3058
|
// INFO: the empty row at the bottom of an addable table — clicking any of
|
|
2704
3059
|
// its cells starts a new record there, as the next empty row of a
|
|
@@ -2756,7 +3111,7 @@ var NewTable = function (rawProps) {
|
|
|
2756
3111
|
};
|
|
2757
3112
|
// INFO: true when maxSelectedCount is set and the current selection has reached the limit
|
|
2758
3113
|
var isMaxReached = !!props.maxSelectedCount &&
|
|
2759
|
-
((
|
|
3114
|
+
((_v = (_u = props.selectedIds) === null || _u === void 0 ? void 0 : _u.length) !== null && _v !== void 0 ? _v : 0) >= props.maxSelectedCount;
|
|
2760
3115
|
// INFO: one desktop row. groupAccent carries the group's colour so member
|
|
2761
3116
|
// rows show the band's colour as a bar down their left edge.
|
|
2762
3117
|
var handleRowDragStart = function (event, rowId) {
|
|
@@ -2821,7 +3176,14 @@ var NewTable = function (rawProps) {
|
|
|
2821
3176
|
"children",
|
|
2822
3177
|
]);
|
|
2823
3178
|
// INFO: large or parent-held values compared by identity, not content
|
|
2824
|
-
|
|
3179
|
+
// INFO: referencesDetails can hold every record a page referenced — it is
|
|
3180
|
+
// kept by the parent (DataTemplate holds it in state), so a new copy means
|
|
3181
|
+
// new records
|
|
3182
|
+
var IDENTITY_PROPS = new Set([
|
|
3183
|
+
"selectedIds",
|
|
3184
|
+
"commentCounts",
|
|
3185
|
+
"referencesDetails",
|
|
3186
|
+
]);
|
|
2825
3187
|
/**
|
|
2826
3188
|
* A number that changes whenever anything every row draws from changes: the
|
|
2827
3189
|
* table's props apart from the row data, its edit, drag and width state, and
|
|
@@ -2844,6 +3206,8 @@ var NewTable = function (rawProps) {
|
|
|
2844
3206
|
editDataHeaderKey,
|
|
2845
3207
|
editDataIsLoading,
|
|
2846
3208
|
modalEditVisible,
|
|
3209
|
+
// INFO: a gridLines="all" label picker opens on its anchor alone
|
|
3210
|
+
(0, rowRendering_1.handleGetIdentity)(labelPickerAnchor),
|
|
2847
3211
|
isDragSelecting,
|
|
2848
3212
|
addData,
|
|
2849
3213
|
addGroupId,
|
|
@@ -3100,13 +3464,28 @@ var NewTable = function (rawProps) {
|
|
|
3100
3464
|
// INFO: keep the action outside links and inline editors in every
|
|
3101
3465
|
// cell variant
|
|
3102
3466
|
var handleDecorateCell = function (cell) {
|
|
3103
|
-
var _a, _b, _c, _d, _e;
|
|
3467
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3104
3468
|
if (colIndex !== 0 || (!hasRowActions && !dragHandle))
|
|
3105
3469
|
return cell;
|
|
3470
|
+
// INFO: a filled text editor rings its cell, but the title cell also
|
|
3471
|
+
// holds the row's action strips at its right edge — so the ring
|
|
3472
|
+
// moves off the cell onto an overlay that stops where the strips
|
|
3473
|
+
// begin
|
|
3474
|
+
var titleStripsWidth = activityStripWidth + editStripWidth;
|
|
3475
|
+
var cellTokens = String((_a = cell.props.className) !== null && _a !== void 0 ? _a : "").split(" ");
|
|
3476
|
+
var hasFillRing = cellTokens.includes("focus-within:ring-2");
|
|
3477
|
+
var isFillRingActive = cellTokens.includes("ring-2");
|
|
3478
|
+
var titleCellClassName = hasFillRing && titleStripsWidth > 0
|
|
3479
|
+
? "".concat(cellTokens
|
|
3480
|
+
.filter(function (each) { return !FILL_RING_TOKENS.includes(each); })
|
|
3481
|
+
.join(" "), " group/fillcell")
|
|
3482
|
+
: cell.props.className;
|
|
3106
3483
|
return react_2.default.cloneElement(cell, {
|
|
3107
|
-
className: "".concat(
|
|
3108
|
-
style: __assign(__assign(__assign(__assign({}, cell.props.style), { paddingRight: titleRestPadding }), (
|
|
3109
|
-
}, cell.props.children,
|
|
3484
|
+
className: "".concat(titleCellClassName, " ").concat((_b = TITLE_ACTIONS_PADDING_CLASS[titleRestPadding]) !== null && _b !== void 0 ? _b : "", " ").concat(props.onRowOpen && isTitleWidthFixed ? ((_c = TITLE_CHEVRON_PADDING_CLASS[titleChevronActionsWidth]) !== null && _c !== void 0 ? _c : "") : "", " ").concat((_e = (_d = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _d === void 0 ? void 0 : _d.className) !== null && _e !== void 0 ? _e : ""),
|
|
3485
|
+
style: __assign(__assign(__assign(__assign({}, cell.props.style), { paddingRight: titleRestPadding }), (_f = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _f === void 0 ? void 0 : _f.style), { position: getPinProps(col.key, false) ? "sticky" : "relative" }),
|
|
3486
|
+
}, cell.props.children, hasFillRing && titleStripsWidth > 0 ? (react_2.default.createElement("span", { "aria-hidden": "true", "data-testid": "table-title-fill-ring", className: "pointer-events-none absolute inset-y-0 left-0 z-10 ring-2 ring-inset ring-primary-500 ".concat(isFillRingActive
|
|
3487
|
+
? ""
|
|
3488
|
+
: "hidden group-focus-within/fillcell:block"), style: { right: titleStripsWidth } })) : null, dragHandle, renderActivityButton(row.id, true, "".concat(rowBgClass, " ").concat(isRowHoverable ? (props.darkMode ? "group-hover:bg-gray-700" : "group-hover:bg-gray-100") : "")));
|
|
3110
3489
|
};
|
|
3111
3490
|
var renderDataCell = function () {
|
|
3112
3491
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9;
|
|
@@ -3133,9 +3512,10 @@ var NewTable = function (rawProps) {
|
|
|
3133
3512
|
!col.disabled)
|
|
3134
3513
|
return (react_2.default.createElement("td", { key: col.key, "data-cell-key": col.key,
|
|
3135
3514
|
// INFO: no padding — the cell's own button carries it, so the
|
|
3136
|
-
// whole cell is the click target
|
|
3137
|
-
|
|
3138
|
-
|
|
3515
|
+
// whole cell is the click target. Under gridLines="all" the
|
|
3516
|
+
// cell is the box the open cell's ring covers.
|
|
3517
|
+
className: "!p-0 text-sm ".concat(cellFontColor, " whitespace-nowrap ").concat(gridLines === "all" ? "relative" : "", " ").concat((_d = (_c = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _c === void 0 ? void 0 : _c.className) !== null && _d !== void 0 ? _d : ""), style: (_e = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _e === void 0 ? void 0 : _e.style },
|
|
3518
|
+
react_2.default.createElement(dateRangeCell_1.DateRangeCell, { column: __assign(__assign({}, col), { id: col.key, name: col.title, type: "dateRange" }), rowId: (_f = row.recordId) !== null && _f !== void 0 ? _f : row.id, value: resolveValue(row, col.key), fill: gridLines === "all", darkMode: props.darkMode })));
|
|
3139
3519
|
// INFO: a cell whose value is already a React element (row action
|
|
3140
3520
|
// buttons, a custom control) is rendered as-is even in an editable
|
|
3141
3521
|
// table — wrapping it in an inline editor would swallow it
|
|
@@ -3195,11 +3575,14 @@ var NewTable = function (rawProps) {
|
|
|
3195
3575
|
// table (isColumnLocked) — there a click must leave the Select alone,
|
|
3196
3576
|
// not navigate — so the overlay is gated on !editable.active.
|
|
3197
3577
|
var shouldNavigateOnClick = !((_q = props.editable) === null || _q === void 0 ? void 0 : _q.active);
|
|
3198
|
-
|
|
3199
|
-
|
|
3578
|
+
var cellFill = handleGetCellFill(col, rawListValue);
|
|
3579
|
+
var pinProps = getPinProps(col.key, false, rowBgClass, isRowHoverable);
|
|
3580
|
+
return (react_2.default.createElement("td", { key: col.key, "data-cell-fill": cellFill ? "" : undefined, className: "p-0 align-middle ".concat(cellFill ? handleDropCellBg(pinProps === null || pinProps === void 0 ? void 0 : pinProps.className) : ((_r = pinProps === null || pinProps === void 0 ? void 0 : pinProps.className) !== null && _r !== void 0 ? _r : ""), " ").concat((_s = cellFill === null || cellFill === void 0 ? void 0 : cellFill.className) !== null && _s !== void 0 ? _s : ""), style: __assign(__assign({}, pinProps === null || pinProps === void 0 ? void 0 : pinProps.style), cellFill === null || cellFill === void 0 ? void 0 : cellFill.style) },
|
|
3581
|
+
react_2.default.createElement("div", { className: "relative ".concat(cellFill ? "w-full" : "w-max", " whitespace-nowrap p-[1px]") },
|
|
3200
3582
|
renderFormCell(row, readOnlyDS, null, {
|
|
3201
3583
|
active: true,
|
|
3202
3584
|
readOnly: true,
|
|
3585
|
+
fill: !!cellFill,
|
|
3203
3586
|
onBlur: function () { },
|
|
3204
3587
|
}),
|
|
3205
3588
|
shouldNavigateOnClick && props.onClickRow && (react_2.default.createElement("div", { "data-testid": "fill-cell-nav-".concat(col.key), className: "absolute inset-0 z-10 cursor-pointer", onClick: function (e) {
|
|
@@ -3217,13 +3600,16 @@ var NewTable = function (rawProps) {
|
|
|
3217
3600
|
// INFO: share the column width source with the read-only/edit cell
|
|
3218
3601
|
// variants, otherwise an "Add" placeholder and a filled value in the
|
|
3219
3602
|
// same column resolve to different widths and the column looks ragged
|
|
3220
|
-
className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " ").concat(handleReadCellWidthClass(col), " ").concat((
|
|
3603
|
+
className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " ").concat(handleReadCellWidthClass(col), " ").concat((_u = (_t = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _t === void 0 ? void 0 : _t.className) !== null && _u !== void 0 ? _u : ""), style: (_v = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _v === void 0 ? void 0 : _v.style },
|
|
3221
3604
|
react_2.default.createElement("div", { className: "cursor-pointer group/modaledit flex items-center gap-x-2 min-h-6 ".concat(handleIsReadCellFixed(col) ? "w-0 min-w-full" : ""), "data-testid": "table-object-edit-".concat(col.key), onClick: function (e) {
|
|
3222
3605
|
var _a;
|
|
3223
3606
|
e.stopPropagation();
|
|
3224
3607
|
(_a = props.onObjectEdit) === null || _a === void 0 ? void 0 : _a.call(props, row.id, col.key, row);
|
|
3225
3608
|
} },
|
|
3226
|
-
handleCheckModalEditEmpty(cellValue) ? (
|
|
3609
|
+
handleCheckModalEditEmpty(cellValue) ? (
|
|
3610
|
+
// INFO: an empty cell under gridLines="all" is blank,
|
|
3611
|
+
// as every other empty cell of the grid is
|
|
3612
|
+
gridLines === "all" ? null : (react_2.default.createElement("span", { className: "text-gray-400 italic" }, "Add"))) : (react_2.default.createElement("span", { className: "min-w-0 truncate" }, (0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord))),
|
|
3227
3613
|
react_2.default.createElement(outline_1.PencilIcon, { className: "w-3.5 h-3.5 text-gray-400 opacity-0 group-hover/modaledit:opacity-100 flex-shrink-0" }))));
|
|
3228
3614
|
}
|
|
3229
3615
|
if (isModalEdit) {
|
|
@@ -3234,32 +3620,84 @@ var NewTable = function (rawProps) {
|
|
|
3234
3620
|
// INFO: share the column width source with the read-only/edit cell
|
|
3235
3621
|
// variants, otherwise an "Add" placeholder and a filled value in the
|
|
3236
3622
|
// same column resolve to different widths and the column looks ragged
|
|
3237
|
-
className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " ").concat(handleReadCellWidthClass(col), " ").concat((
|
|
3623
|
+
className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " ").concat(handleReadCellWidthClass(col), " ").concat((_x = (_w = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _w === void 0 ? void 0 : _w.className) !== null && _x !== void 0 ? _x : ""), style: (_y = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _y === void 0 ? void 0 : _y.style },
|
|
3238
3624
|
react_2.default.createElement("div", { className: "cursor-pointer group/modaledit flex items-center gap-x-2 min-h-6 ".concat(handleIsReadCellFixed(col) ? "w-0 min-w-full" : ""), "data-testid": "table-modal-edit-".concat(col.key), onClick: function (e) {
|
|
3239
3625
|
e.stopPropagation();
|
|
3240
3626
|
handleModalEditOnClick(row.id, col.key, row);
|
|
3241
3627
|
} },
|
|
3242
|
-
handleCheckModalEditEmpty(cellValue) ? (
|
|
3628
|
+
handleCheckModalEditEmpty(cellValue) ? (
|
|
3629
|
+
// INFO: an empty cell under gridLines="all" is blank,
|
|
3630
|
+
// as every other empty cell of the grid is
|
|
3631
|
+
gridLines === "all" ? null : (react_2.default.createElement("span", { className: "text-gray-400 italic" }, "Add"))) : (react_2.default.createElement("span", { className: "min-w-0 truncate" }, (0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord))),
|
|
3243
3632
|
react_2.default.createElement(outline_1.PencilIcon, { className: "w-3.5 h-3.5 text-gray-400 opacity-0 group-hover/modaledit:opacity-100 flex-shrink-0" }))));
|
|
3244
3633
|
}
|
|
3245
3634
|
// INFO: a multi-select shows its picks as one line of tags until it is
|
|
3246
3635
|
// clicked — its editor stacks the input over the tags, which made every
|
|
3247
3636
|
// row two lines tall
|
|
3637
|
+
// INFO: under gridLines="all" a coloured multiple list never swaps to
|
|
3638
|
+
// that editor: the cell keeps its tags and a label picker opens
|
|
3639
|
+
// under it (LabelPicker), like a board's labels column
|
|
3640
|
+
var isLabelPickerColumn = gridLines === "all" && handleColumnShowsTags(col);
|
|
3641
|
+
var isCellEditing = editDataRowId === row.id && editDataHeaderKey === col.key;
|
|
3248
3642
|
if (isEditable &&
|
|
3249
3643
|
resolvedColType === "multipleList" &&
|
|
3250
|
-
!
|
|
3251
|
-
!((
|
|
3252
|
-
|
|
3253
|
-
|
|
3644
|
+
(!isCellEditing || isLabelPickerColumn) &&
|
|
3645
|
+
!((_0 = (_z = props.bareSettings) === null || _z === void 0 ? void 0 : _z.bareListDescription) === null || _0 === void 0 ? void 0 : _0.call(_z, col.key, cellValue))) {
|
|
3646
|
+
var isPicking = isLabelPickerColumn && isCellEditing && !!labelPickerAnchor;
|
|
3647
|
+
var handleOpenCell_1 = function (target) {
|
|
3648
|
+
if (gridLines === "all") {
|
|
3649
|
+
handleOpenAfterLeaving(target, function () { return handleOpenTagCell_1(target); });
|
|
3650
|
+
return;
|
|
3651
|
+
}
|
|
3652
|
+
handleOpenTagCell_1(target);
|
|
3653
|
+
};
|
|
3654
|
+
var handleOpenTagCell_1 = function (target) {
|
|
3655
|
+
handleEditDataOnClick(row.id, col.key, rowData);
|
|
3656
|
+
if (isLabelPickerColumn)
|
|
3657
|
+
setLabelPickerAnchor(target.closest("td"));
|
|
3658
|
+
// INFO: under gridLines="all" a plain multiple list's editor
|
|
3659
|
+
// takes focus as it opens, so one click opens its list
|
|
3660
|
+
else if (gridLines === "all")
|
|
3661
|
+
pendingFocusRef.current = "".concat(row.id, ":").concat(col.key);
|
|
3662
|
+
};
|
|
3663
|
+
var pickedValue = resolveValue((isCellEditing ? rowData : row), col.key);
|
|
3664
|
+
return (react_2.default.createElement("td", { key: col.key, "data-cell-key": col.key, className: "".concat(editCellPadding, " ").concat(handleCellMinWidth(col.type), " ").concat(handleReadCellWidthClass(col), " text-sm ").concat(cellFontColor, " ").concat((_2 = (_1 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _1 === void 0 ? void 0 : _1.className) !== null && _2 !== void 0 ? _2 : "", " ").concat(isPicking ? "!shadow-[inset_0_0_0_2px_#9ca3af]" : ""), style: (_3 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _3 === void 0 ? void 0 : _3.style },
|
|
3665
|
+
react_2.default.createElement("div", { "data-testid": "table-tag-line-".concat(col.key), role: "button", "aria-haspopup": isLabelPickerColumn ? "dialog" : undefined, "aria-expanded": isLabelPickerColumn ? isPicking : undefined, tabIndex: 0, "aria-label": "Edit ".concat(col.title), className: "flex h-[34px] cursor-pointer items-center gap-1 overflow-hidden whitespace-nowrap ".concat(handleIsReadCellFixed(col) ? "w-0 min-w-full" : ""), onClick: function (e) {
|
|
3254
3666
|
e.stopPropagation();
|
|
3255
|
-
|
|
3667
|
+
handleOpenCell_1(e.currentTarget);
|
|
3256
3668
|
}, onKeyDown: function (e) {
|
|
3257
3669
|
if (e.key !== "Enter" && e.key !== " ")
|
|
3258
3670
|
return;
|
|
3259
3671
|
e.preventDefault();
|
|
3260
3672
|
e.stopPropagation();
|
|
3261
|
-
|
|
3262
|
-
} }, renderTagLine(col, cellValue))
|
|
3673
|
+
handleOpenCell_1(e.currentTarget);
|
|
3674
|
+
} }, renderTagLine(col, isLabelPickerColumn ? pickedValue : cellValue)),
|
|
3675
|
+
isPicking && labelPickerAnchor && (react_2.default.createElement(labelPicker_1.LabelPicker, { anchor: labelPickerAnchor, darkMode: props.darkMode, required: (0, updateModule_1.handleIsFieldRequired)(col, rowData), options: ((_4 = col.listSelection) !== null && _4 !== void 0 ? _4 : []).map(function (key) { return ({
|
|
3676
|
+
key: String(key),
|
|
3677
|
+
color: handleGetListColour(col, key),
|
|
3678
|
+
}); }), value: (Array.isArray(pickedValue)
|
|
3679
|
+
? pickedValue
|
|
3680
|
+
: pickedValue
|
|
3681
|
+
? [pickedValue]
|
|
3682
|
+
: []).map(String),
|
|
3683
|
+
// INFO: each pick or removal saves at once and the
|
|
3684
|
+
// picker stays open, as a multi-select's picks do
|
|
3685
|
+
// INFO: the row goes through the clone a Select's pick
|
|
3686
|
+
// takes, so the save carries the same cleaned row
|
|
3687
|
+
onChange: function (next) {
|
|
3688
|
+
var _a, _b;
|
|
3689
|
+
var updated = (0, updateModule_1.handleClonedDataAttribute)(editDataValueRef.current, handleConvertColumnToDataStructure(flatColumns), (_b = (_a = props.devSettings) === null || _a === void 0 ? void 0 : _a.server) !== null && _b !== void 0 ? _b : "mongoServer");
|
|
3690
|
+
updated[col.key] = next;
|
|
3691
|
+
editDataValueRef.current = updated;
|
|
3692
|
+
setEditDataValue(updated);
|
|
3693
|
+
handleEditDataOnBlur(col.key, updated, {
|
|
3694
|
+
keepEditing: true,
|
|
3695
|
+
});
|
|
3696
|
+
}, onClose: function () {
|
|
3697
|
+
setLabelPickerAnchor(null);
|
|
3698
|
+
handleEditDataOnBlur(col.key, editDataValueRef.current);
|
|
3699
|
+
} }))));
|
|
3700
|
+
}
|
|
3263
3701
|
// INFO: coloured list cells are exempt from the hover swap — read and
|
|
3264
3702
|
// edit are the same filled pill, so there is nothing to swap to
|
|
3265
3703
|
var bareOverride = isEditable
|
|
@@ -3267,11 +3705,42 @@ var NewTable = function (rawProps) {
|
|
|
3267
3705
|
: undefined;
|
|
3268
3706
|
if (isEditable && !bareOverride && handleColumnShowsTags(col))
|
|
3269
3707
|
return renderEditDataInputs(colIndex, col, rowData, row.id, rowBgClass, isRowHoverable);
|
|
3708
|
+
// INFO: under gridLines="all" a text, number, email, text-area,
|
|
3709
|
+
// phone, date or plain dropdown cell is not swapped on hover — it
|
|
3710
|
+
// keeps the value as it reads (a date its format and warning
|
|
3711
|
+
// colour) until a click opens its editor, as a sheet or board
|
|
3712
|
+
// cell does
|
|
3713
|
+
var isClickToEditCell = isEditable &&
|
|
3714
|
+
!bareOverride &&
|
|
3715
|
+
gridLines === "all" &&
|
|
3716
|
+
FILL_INPUT_TYPES.includes(resolvedColType);
|
|
3270
3717
|
var readCell = (react_2.default.createElement("td", { key: col.key, "data-cell-key": col.key, "data-pin-key": leftPinned.includes(col.key) || rightPinned.includes(col.key)
|
|
3271
3718
|
? col.key
|
|
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
|
|
3719
|
+
: undefined, className: "".concat(cellPadding, " ").concat(isEditable ? "".concat(editCellMinHeight, " align-middle ").concat(handleCellMinWidth(col.type)) : "", " text-sm ").concat(colIndex === 0 && props.onClickRow ? titleFontColor : cellFontColor, " ").concat(handleReadCellWidthClass(col), " ").concat((_8 = (_7 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _7 === void 0 ? void 0 : _7.className) !== null && _8 !== void 0 ? _8 : ""), style: (_9 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _9 === void 0 ? void 0 : _9.style, "data-row-link-cell": props.newTabUrl && props.onClickRow ? "" : undefined,
|
|
3720
|
+
// INFO: a click opens the editor in place rather than following
|
|
3721
|
+
// the row's link
|
|
3722
|
+
onClickCapture: isClickToEditCell
|
|
3723
|
+
? function (e) {
|
|
3724
|
+
var _a, _b;
|
|
3725
|
+
// INFO: the title cell also holds the row's pencil,
|
|
3726
|
+
// comments and open buttons and its drag handle —
|
|
3727
|
+
// a click on those does what they say, not edit
|
|
3728
|
+
if ((_b = (_a = e.target).closest) === null || _b === void 0 ? void 0 : _b.call(_a, 'button, [data-testid$="-strip"], [data-testid^="table-row-drag-handle-"]'))
|
|
3729
|
+
return;
|
|
3730
|
+
e.preventDefault();
|
|
3731
|
+
e.stopPropagation();
|
|
3732
|
+
handleOpenAfterLeaving(e.target, function () {
|
|
3733
|
+
pendingFocusRef.current = "".concat(row.id, ":").concat(col.key);
|
|
3734
|
+
handleEditDataOnClick(row.id, col.key, rowData);
|
|
3735
|
+
});
|
|
3736
|
+
}
|
|
3737
|
+
: undefined }, handleIsReadCellFixed(col) ? (react_2.default.createElement("div", { className: "w-0 min-w-full truncate" }, renderReadCellValue(col, row, cellValue))) : (renderReadCellValue(col, row, cellValue))));
|
|
3273
3738
|
if (!isEditable || bareOverride)
|
|
3274
3739
|
return readCell;
|
|
3740
|
+
if (isClickToEditCell)
|
|
3741
|
+
return isCellEditing
|
|
3742
|
+
? renderEditDataInputs(colIndex, col, rowData, row.id, rowBgClass, isRowHoverable)
|
|
3743
|
+
: readCell;
|
|
3275
3744
|
// INFO: the plain text cell until hovered or mid-edit, then its input
|
|
3276
3745
|
return (react_2.default.createElement(rowRendering_1.NewTableHoverCell, { key: col.key, editing: handleIsCellEditing(row.id, col.key), renderRead: function () { return handleDecorateCell(readCell); }, renderLive: function () {
|
|
3277
3746
|
return handleDecorateCell(renderEditDataInputs(colIndex, col, rowData, row.id, rowBgClass, isRowHoverable));
|
|
@@ -3735,20 +4204,20 @@ var NewTable = function (rawProps) {
|
|
|
3735
4204
|
};
|
|
3736
4205
|
var renderCheckbox = function (checked, onChange, onClick, extraClassName) { return (react_2.default.createElement("input", { type: "checkbox", checked: checked, onChange: onChange, onClick: onClick, className: "rounded ".concat(props.darkMode ? "border-gray-400" : "border-gray-500", " ").concat(bgColor, " focus:ring-0 focus:ring-offset-0 focus:outline-offset-0 checked:text-primary-400 ").concat(extraClassName !== null && extraClassName !== void 0 ? extraClassName : "") })); };
|
|
3737
4206
|
if (props.mobileView) {
|
|
3738
|
-
var hasPhoneGroups = !!((
|
|
4207
|
+
var hasPhoneGroups = !!((_w = props.groups) === null || _w === void 0 ? void 0 : _w.length);
|
|
3739
4208
|
return (react_2.default.createElement("div", null,
|
|
3740
|
-
react_2.default.createElement("div", { className: "w-full ".concat(((
|
|
4209
|
+
react_2.default.createElement("div", { className: "w-full ".concat(((_x = props.mobileTooltip) === null || _x === void 0 ? void 0 : _x.tooltip) ? "overflow-visible" : "overflow-hidden", " ").concat(isFlat
|
|
3741
4210
|
? ""
|
|
3742
|
-
: "border ".concat(borderRadius, " ").concat(borderColor, " ").concat(bgColor, " shadow-sm"), " divide-y ").concat(dividerColor, " ").concat((
|
|
4211
|
+
: "border ".concat(borderRadius, " ").concat(borderColor, " ").concat(bgColor, " shadow-sm"), " divide-y ").concat(dividerColor, " ").concat((_y = props.className) !== null && _y !== void 0 ? _y : "") },
|
|
3743
4212
|
react_2.default.createElement("div", { className: "p-3 flex items-center justify-between" },
|
|
3744
4213
|
renderSelectAll(),
|
|
3745
4214
|
react_2.default.createElement("div", { className: "flex items-center gap-2" },
|
|
3746
4215
|
renderSelectedCount(),
|
|
3747
|
-
((
|
|
4216
|
+
((_z = props.advSettings) === null || _z === void 0 ? void 0 : _z.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"); } })))),
|
|
3748
4217
|
props.loading &&
|
|
3749
4218
|
Array.from({ length: 3 }).map(function (_, i) { return (react_2.default.createElement("div", { key: "skeleton-".concat(i), className: "p-4" },
|
|
3750
4219
|
react_2.default.createElement("div", { className: "h-5 w-3/4 rounded-md animate-pulse ".concat(props.darkMode ? "bg-gray-700" : "bg-gray-200") }))); }),
|
|
3751
|
-
!props.loading && props.data.length === 0 && !hasPhoneGroups && (react_2.default.createElement("p", { className: "p-4 text-center text-sm ".concat(cellFontColor) }, (
|
|
4220
|
+
!props.loading && props.data.length === 0 && !hasPhoneGroups && (react_2.default.createElement("p", { className: "p-4 text-center text-sm ".concat(cellFontColor) }, (_0 = props.emptyTitle) !== null && _0 !== void 0 ? _0 : "No items")),
|
|
3752
4221
|
!props.loading && (props.data.length > 0 || hasPhoneGroups) && (react_2.default.createElement("table", { className: "w-full table-fixed", ref: tableRef },
|
|
3753
4222
|
react_2.default.createElement("tbody", { className: "divide-y ".concat(dividerColor) }, renderDesktopRows())))),
|
|
3754
4223
|
react_2.default.createElement(newPagination_1.NewPagination, { paginationType: props.paginationType, pageIndex: props.pageIndex, limit: props.limit, size: props.size, cursor: props.cursor, resultCount: props.data.length, customPaginationSize: props.customPaginationSize, hidePagination: props.hidePagination, darkMode: props.darkMode, darkModeBg: props.darkModeBg, handleUpdatePageIndex: props.handleUpdatePageIndex, className: "".concat(props.fixedPagination
|
|
@@ -3768,13 +4237,13 @@ var NewTable = function (rawProps) {
|
|
|
3768
4237
|
: [])[0];
|
|
3769
4238
|
return WIDE_EDIT_TYPES.includes((_a = selectedDS === null || selectedDS === void 0 ? void 0 : selectedDS.type) !== null && _a !== void 0 ? _a : "") ? "4xl" : "2xl";
|
|
3770
4239
|
};
|
|
3771
|
-
return (react_2.default.createElement("div", { className: "w-full ".concat((
|
|
4240
|
+
return (react_2.default.createElement("div", { className: "w-full ".concat((_1 = props.className) !== null && _1 !== void 0 ? _1 : "") },
|
|
3772
4241
|
react_2.default.createElement(modal_1.Modal, { open: filterModal ? true : false, title: "Filter Options", renderContent: function () {
|
|
3773
4242
|
var _a, _b;
|
|
3774
4243
|
return (react_2.default.createElement("div", { className: "pb-44" },
|
|
3775
4244
|
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))));
|
|
3776
4245
|
}, onClose: function () { return setFilterModal(""); } }),
|
|
3777
|
-
react_2.default.createElement(modal_1.Modal, { open: modalEditVisible, title: (
|
|
4246
|
+
react_2.default.createElement(modal_1.Modal, { open: modalEditVisible, title: (_3 = (_2 = flatColumns.find(function (eachCol) { return eachCol.key === editDataHeaderKey; })) === null || _2 === void 0 ? void 0 : _2.title) !== null && _3 !== void 0 ? _3 : "Edit", maxWidth: handleGetEditModalWidth(), onClose: handleModalEditClose, renderContent: function () {
|
|
3778
4247
|
var _a, _b, _c, _d;
|
|
3779
4248
|
var selectedCol = flatColumns.find(function (eachCol) { return eachCol.key === editDataHeaderKey; });
|
|
3780
4249
|
if (!selectedCol)
|
|
@@ -3802,7 +4271,7 @@ var NewTable = function (rawProps) {
|
|
|
3802
4271
|
dbModule: axios_1.default,
|
|
3803
4272
|
devSettings: props.devSettings,
|
|
3804
4273
|
referencesOptions: mergedReferencesOptions,
|
|
3805
|
-
referencesDetails:
|
|
4274
|
+
referencesDetails: mergedReferencesDetails,
|
|
3806
4275
|
referenceLoading: referenceLoading,
|
|
3807
4276
|
setReferenceLoading: setReferenceLoading,
|
|
3808
4277
|
setReferencesOptions: setReferencesOptions,
|
|
@@ -3820,7 +4289,7 @@ var NewTable = function (rawProps) {
|
|
|
3820
4289
|
react_2.default.createElement(scrollShadow_1.ScrollShadow, { className: "w-full overflow-x-auto ".concat(isFlat
|
|
3821
4290
|
? ""
|
|
3822
4291
|
: "".concat(borderRadius, " border ").concat(borderColor, " ").concat(bgColor, " shadow-sm")), darkMode: props.darkMode },
|
|
3823
|
-
(props.selectAll || ((
|
|
4292
|
+
(props.selectAll || ((_5 = (_4 = props.selectedIds) === null || _4 === void 0 ? void 0 : _4.length) !== null && _5 !== void 0 ? _5 : 0) > 0) &&
|
|
3824
4293
|
(!props.multiActionFloatingBtns ||
|
|
3825
4294
|
(props.multiActionFloatingBtns &&
|
|
3826
4295
|
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" },
|
|
@@ -3830,9 +4299,9 @@ var NewTable = function (rawProps) {
|
|
|
3830
4299
|
// INFO: width:max-content, not w-full — a table pinned to 100% never
|
|
3831
4300
|
// exceeds the wrapper, so overflow-x-auto never scrolls and the columns
|
|
3832
4301
|
// crush instead. min-w-full still stretches a narrow table.
|
|
3833
|
-
className: "w-max min-w-full ".concat(isDragSelecting ? "select-none" : ""), ref: tableRef },
|
|
4302
|
+
className: "w-max min-w-full ".concat(isDragSelecting ? "select-none" : "", " ").concat(gridLinesClass), ref: tableRef },
|
|
3834
4303
|
renderTableHeader(),
|
|
3835
|
-
react_2.default.createElement("tbody", { className: "divide-y ".concat(dividerColor, " ").concat(CELL_FIT_CLASS) },
|
|
4304
|
+
react_2.default.createElement("tbody", { className: "divide-y ".concat(gridLines === "all" && !props.darkMode ? "divide-gray-200" : dividerColor, " ").concat(CELL_FIT_CLASS) },
|
|
3836
4305
|
!props.loading &&
|
|
3837
4306
|
isAddRowPinned &&
|
|
3838
4307
|
addData &&
|
|
@@ -3848,7 +4317,7 @@ var NewTable = function (rawProps) {
|
|
|
3848
4317
|
(addData
|
|
3849
4318
|
? !isAddRowPinned && !addGroupId && renderAddDataRow()
|
|
3850
4319
|
: !handleHasGroupAddRows() && renderEmptyAddRow()))),
|
|
3851
|
-
!props.loading && props.data.length === 0 && (react_2.default.createElement("div", { className: "p-4 text-sm ".concat(cellFontColor, " text-center sticky left-0") }, (
|
|
4320
|
+
!props.loading && props.data.length === 0 && (react_2.default.createElement("div", { className: "p-4 text-sm ".concat(cellFontColor, " text-center sticky left-0") }, (_6 = props.emptyTitle) !== null && _6 !== void 0 ? _6 : "No items"))),
|
|
3852
4321
|
renderPinnedAddButton(),
|
|
3853
4322
|
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
|
|
3854
4323
|
? "pagination-container w-full ".concat(borderColor, " ").concat(isFixed ? "fixed bottom-0 left-0 z-10" : "sticky top-0 left-0")
|