blixify-ui-web 1.2.259 → 1.2.261
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/dataTemplate/index.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/index.js +63 -44
- package/lib/components/data/dataTemplate/index.js.map +1 -1
- package/lib/components/data/updateModule.d.ts +20 -2
- package/lib/components/data/updateModule.d.ts.map +1 -1
- package/lib/components/data/updateModule.js +155 -58
- package/lib/components/data/updateModule.js.map +1 -1
- package/lib/components/data/utils.d.ts +1 -0
- package/lib/components/data/utils.d.ts.map +1 -1
- package/lib/components/data/utils.js +36 -1
- package/lib/components/data/utils.js.map +1 -1
- package/lib/components/display/newTable/index.d.ts.map +1 -1
- package/lib/components/display/newTable/index.js +218 -119
- package/lib/components/display/newTable/index.js.map +1 -1
- package/lib/components/display/recordActions/index.d.ts.map +1 -1
- package/lib/components/display/recordActions/index.js +25 -21
- package/lib/components/display/recordActions/index.js.map +1 -1
- package/lib/tail.css +2 -2
- package/package.json +1 -1
|
@@ -389,30 +389,22 @@ exports.handleGetEditableColumnTypes = handleGetEditableColumnTypes;
|
|
|
389
389
|
// padding, so the room for the title's actions is an !important class too —
|
|
390
390
|
// without it a squeezed title (a pinned column on a phone) runs under them
|
|
391
391
|
var TITLE_ACTIONS_PADDING_CLASS = {
|
|
392
|
-
8: "!pr-[8px]",
|
|
393
392
|
48: "!pr-[48px]",
|
|
394
393
|
52: "!pr-[52px]",
|
|
395
394
|
92: "!pr-[92px]",
|
|
396
395
|
96: "!pr-[96px]",
|
|
397
396
|
136: "!pr-[136px]",
|
|
398
397
|
};
|
|
399
|
-
// INFO:
|
|
400
|
-
|
|
401
|
-
// editor make room for it instead of running under it
|
|
402
|
-
var TITLE_CHEVRON_PADDING_CLASS = {
|
|
403
|
-
48: "group-hover:!pr-[48px] focus-within:!pr-[48px] [@media(hover:none)]:!pr-[48px]",
|
|
404
|
-
92: "group-hover:!pr-[92px] focus-within:!pr-[92px] [@media(hover:none)]:!pr-[92px]",
|
|
405
|
-
136: "group-hover:!pr-[136px] focus-within:!pr-[136px] [@media(hover:none)]:!pr-[136px]",
|
|
406
|
-
};
|
|
407
|
-
// INFO: the chevron's width plus its gap from the strips
|
|
408
|
-
var CHEVRON_ROOM = 40;
|
|
398
|
+
// INFO: the eye's width plus its gap from the strips
|
|
399
|
+
var EYE_ROOM = 40;
|
|
409
400
|
// INFO: the title text a narrowed title column always keeps beside its actions
|
|
410
401
|
var MIN_TITLE_TEXT_WIDTH = 48;
|
|
411
402
|
// INFO: the cell padding's left side (!px-6)
|
|
412
403
|
var TITLE_LEFT_PADDING = 24;
|
|
413
404
|
// INFO: the pencil and the comment bubble each sit in their own full-height
|
|
414
405
|
// strip at the title cell's right edge, split by dividers like columns of
|
|
415
|
-
// their own — pencil, then bubble at the edge
|
|
406
|
+
// their own — pencil, then bubble at the edge. The eye sits just left of them
|
|
407
|
+
// with no divider of its own.
|
|
416
408
|
var ACTION_STRIP_WIDTH = 44;
|
|
417
409
|
var ACCENT_CLASS = {
|
|
418
410
|
default: "border-primary-500",
|
|
@@ -464,6 +456,42 @@ var FILL_INPUT_TYPES = [
|
|
|
464
456
|
"listPerson",
|
|
465
457
|
"referenceSelection",
|
|
466
458
|
];
|
|
459
|
+
// INFO: what each column type a cell's "x" can clear saves once cleared. A
|
|
460
|
+
// yes/no is left out — an emptied one reads as a third state beside yes and
|
|
461
|
+
// no — and so is a rating, which is cleared from its stars. A coloured list
|
|
462
|
+
// has its blank block, and pictures, files, signatures and the parts of an
|
|
463
|
+
// address or object are each removed on their own. A column's default only
|
|
464
|
+
// prefills a new record, so a cleared cell stays empty whatever its default.
|
|
465
|
+
var CLEAR_CELL_VALUES = {
|
|
466
|
+
string: function () { return ""; },
|
|
467
|
+
email: function () { return ""; },
|
|
468
|
+
textArea: function () { return ""; },
|
|
469
|
+
contact: function () { return ""; },
|
|
470
|
+
list: function () { return ""; },
|
|
471
|
+
person: function () { return ""; },
|
|
472
|
+
number: function () { return null; },
|
|
473
|
+
date: function () { return null; },
|
|
474
|
+
reference: function () { return null; },
|
|
475
|
+
referenceSelection: function () { return null; },
|
|
476
|
+
multipleList: function () { return []; },
|
|
477
|
+
listReference: function () { return []; },
|
|
478
|
+
listPerson: function () { return []; },
|
|
479
|
+
roles: function () { return []; },
|
|
480
|
+
};
|
|
481
|
+
var CLEAR_OPEN_EDITOR_TYPES = [
|
|
482
|
+
"string",
|
|
483
|
+
"email",
|
|
484
|
+
"textArea",
|
|
485
|
+
"contact",
|
|
486
|
+
"number",
|
|
487
|
+
"date",
|
|
488
|
+
];
|
|
489
|
+
var handleIsEmptyCellValue = function (value) {
|
|
490
|
+
return value === undefined ||
|
|
491
|
+
value === null ||
|
|
492
|
+
value === "" ||
|
|
493
|
+
(Array.isArray(value) && value.length === 0);
|
|
494
|
+
};
|
|
467
495
|
// INFO: drops the field's own box — background, rounded corners and the
|
|
468
496
|
// hover / focus border — so the text is typed straight into the cell; an
|
|
469
497
|
// errored field keeps its red border. The cell's ring shows which one is open.
|
|
@@ -517,7 +545,7 @@ var handleGetListColour = function (col, value) {
|
|
|
517
545
|
return column.listSelectionColour[index] || undefined;
|
|
518
546
|
};
|
|
519
547
|
var NewTable = function (rawProps) {
|
|
520
|
-
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
|
|
548
|
+
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;
|
|
521
549
|
// INFO: props are read through the latest render. A row that was not drawn
|
|
522
550
|
// again keeps the handlers of the render that drew it, and those read
|
|
523
551
|
// props.onClickRow, props.data and the rest at the time they run — so a
|
|
@@ -618,57 +646,56 @@ var NewTable = function (rawProps) {
|
|
|
618
646
|
flatColumns.length = 0;
|
|
619
647
|
flatColumns.push.apply(flatColumns, __spreadArray(__spreadArray(__spreadArray([], leftCols, false), middleCols, false), rightCols, false));
|
|
620
648
|
}
|
|
621
|
-
var
|
|
649
|
+
var _2 = (0, react_2.useState)(props.fixedPagination ? true : false), isFixed = _2[0], setIsFixed = _2[1];
|
|
622
650
|
// INFO: the actions sit over the title cell's right padding: the pencil and
|
|
623
|
-
// the bubble in divided strips at the edge,
|
|
624
|
-
// clear so they never cover the title, and added to
|
|
625
|
-
// width so the title keeps its own width instead of
|
|
626
|
-
//
|
|
627
|
-
//
|
|
628
|
-
// the column is sized and floored for that wider padding.
|
|
651
|
+
// the bubble in divided strips at the edge, the eye just left of them, then
|
|
652
|
+
// 8px from the text — kept clear so they never cover the title, and added to
|
|
653
|
+
// the cell's measured width so the title keeps its own width instead of
|
|
654
|
+
// wrapping. All of them always show: users missed an eye that showed only on
|
|
655
|
+
// hover and reached for the pencil to view a record.
|
|
629
656
|
var hasRowActions = !!props.onRowEdit || !!props.onRowOpen || !!props.onRowActivity;
|
|
630
657
|
var canDragRows = !!props.onMoveRowToGroup && !!((_g = props.groups) === null || _g === void 0 ? void 0 : _g.length);
|
|
631
658
|
var activityStripWidth = props.onRowActivity ? ACTION_STRIP_WIDTH : 0;
|
|
632
659
|
var editStripWidth = props.onRowEdit ? ACTION_STRIP_WIDTH : 0;
|
|
660
|
+
var titleStripsWidth = activityStripWidth + editStripWidth;
|
|
633
661
|
var titleActionsWidth = hasRowActions
|
|
634
|
-
?
|
|
662
|
+
? titleStripsWidth + 8 + (props.onRowOpen ? EYE_ROOM : 0)
|
|
635
663
|
: 0;
|
|
636
|
-
var titleChevronActionsWidth = titleActionsWidth + (props.onRowOpen ? CHEVRON_ROOM : 0);
|
|
637
664
|
//=====================================================================================
|
|
638
665
|
// SECTION: Advanced Settings
|
|
639
666
|
//=====================================================================================
|
|
640
|
-
var
|
|
641
|
-
var
|
|
667
|
+
var _3 = (0, react_2.useState)(""), filterModal = _3[0], setFilterModal = _3[1];
|
|
668
|
+
var _4 = (0, react_2.useState)(""), addColumnModal = _4[0], setAddColumnModal = _4[1];
|
|
642
669
|
// INFO: what a DataTemplate around the table lets a cell save
|
|
643
670
|
var columnTypeActions = (0, react_2.useContext)(context_1.ColumnTypeContext);
|
|
644
|
-
var
|
|
645
|
-
var
|
|
646
|
-
var
|
|
647
|
-
var
|
|
648
|
-
var
|
|
649
|
-
var
|
|
650
|
-
var
|
|
671
|
+
var _5 = (0, react_2.useState)(""), newColumnName = _5[0], setNewColumnName = _5[1];
|
|
672
|
+
var _6 = (0, react_2.useState)("string"), newColumnType = _6[0], setNewColumnType = _6[1];
|
|
673
|
+
var _7 = (0, react_2.useState)(""), newColumnRefSpace = _7[0], setNewColumnRefSpace = _7[1];
|
|
674
|
+
var _8 = (0, react_2.useState)(""), newColumnRefLabel = _8[0], setNewColumnRefLabel = _8[1];
|
|
675
|
+
var _9 = (0, react_2.useState)(""), newColumnLookupReference = _9[0], setNewColumnLookupReference = _9[1];
|
|
676
|
+
var _10 = (0, react_2.useState)(""), newColumnLookupField = _10[0], setNewColumnLookupField = _10[1];
|
|
677
|
+
var _11 = (0, react_2.useState)([]), newColumnOptions = _11[0], setNewColumnOptions = _11[1];
|
|
651
678
|
// INFO: the option row whose colour palette is open
|
|
652
|
-
var
|
|
653
|
-
var
|
|
654
|
-
var
|
|
655
|
-
var
|
|
656
|
-
var
|
|
657
|
-
var
|
|
658
|
-
var
|
|
659
|
-
var
|
|
660
|
-
var
|
|
661
|
-
var
|
|
679
|
+
var _12 = (0, react_2.useState)(null), optionColourKey = _12[0], setOptionColourKey = _12[1];
|
|
680
|
+
var _13 = (0, react_2.useState)(false), newColumnRequired = _13[0], setNewColumnRequired = _13[1];
|
|
681
|
+
var _14 = (0, react_2.useState)(false), newColumnUnique = _14[0], setNewColumnUnique = _14[1];
|
|
682
|
+
var _15 = (0, react_2.useState)(false), newColumnReadOnly = _15[0], setNewColumnReadOnly = _15[1];
|
|
683
|
+
var _16 = (0, react_2.useState)(""), newColumnRatingMax = _16[0], setNewColumnRatingMax = _16[1];
|
|
684
|
+
var _17 = (0, react_2.useState)(""), newColumnButtonLabel = _17[0], setNewColumnButtonLabel = _17[1];
|
|
685
|
+
var _18 = (0, react_2.useState)(""), newColumnButtonColour = _18[0], setNewColumnButtonColour = _18[1];
|
|
686
|
+
var _19 = (0, react_2.useState)(""), newColumnButtonConfirm = _19[0], setNewColumnButtonConfirm = _19[1];
|
|
687
|
+
var _20 = (0, react_2.useState)(false), addingColumn = _20[0], setAddingColumn = _20[1];
|
|
688
|
+
var _21 = (0, react_2.useState)(false), confirmDeleteColumn = _21[0], setConfirmDeleteColumn = _21[1];
|
|
662
689
|
// INFO: the formula as shown in the builder — column names, not ids
|
|
663
|
-
var
|
|
690
|
+
var _22 = (0, react_2.useState)(""), newColumnFormula = _22[0], setNewColumnFormula = _22[1];
|
|
664
691
|
var addColumnPopUpRef = (0, react_2.useRef)(null);
|
|
665
692
|
// INFO: the column being changed — empty while the panel adds a new one
|
|
666
|
-
var
|
|
693
|
+
var _23 = (0, react_2.useState)(null), editingColumn = _23[0], setEditingColumn = _23[1];
|
|
667
694
|
//=====================================================================================
|
|
668
695
|
// SECTION: Editable & Addable cells
|
|
669
696
|
//=====================================================================================
|
|
670
|
-
var
|
|
671
|
-
var
|
|
697
|
+
var _24 = (0, react_2.useState)(""), editDataRowId = _24[0], setEditDataRowId = _24[1];
|
|
698
|
+
var _25 = (0, react_2.useState)(""), editDataHeaderKey = _25[0], setEditDataHeaderKey = _25[1];
|
|
672
699
|
// INFO: an editable table used to mount an input in every cell — it read as a
|
|
673
700
|
// form, and a row click always landed on a child input. Only the hovered cell
|
|
674
701
|
// becomes its input now; NewTableHoverCell keeps that hover to itself.
|
|
@@ -677,13 +704,13 @@ var NewTable = function (rawProps) {
|
|
|
677
704
|
var pendingFocusRef = (0, react_2.useRef)("");
|
|
678
705
|
// INFO: the cell a gridLines="all" multiple list is being picked in — its
|
|
679
706
|
// popover hangs from this element
|
|
680
|
-
var
|
|
681
|
-
var
|
|
707
|
+
var _26 = (0, react_2.useState)(null), labelPickerAnchor = _26[0], setLabelPickerAnchor = _26[1];
|
|
708
|
+
var _27 = (0, react_2.useState)(false), modalEditVisible = _27[0], setModalEditVisible = _27[1];
|
|
682
709
|
// INFO: whether the modal's signature pad has been drawn on
|
|
683
|
-
var
|
|
684
|
-
var
|
|
710
|
+
var _28 = (0, react_2.useState)(false), signatureSigning = _28[0], setSignatureSigning = _28[1];
|
|
711
|
+
var _29 = (0, react_2.useState)([]), collapsedGroupIds = _29[0], setCollapsedGroupIds = _29[1];
|
|
685
712
|
// INFO: rows shown per section when the sections do not page themselves
|
|
686
|
-
var
|
|
713
|
+
var _30 = (0, react_2.useState)({}), groupVisibleCounts = _30[0], setGroupVisibleCounts = _30[1];
|
|
687
714
|
// INFO: per-group scroll pagination. One sentinel element per band, observed
|
|
688
715
|
// by a single IntersectionObserver that fires props.onGroupLoadMore when a
|
|
689
716
|
// band's sentinel scrolls into view. The debounce guard stops repeat fires
|
|
@@ -701,36 +728,36 @@ var NewTable = function (rawProps) {
|
|
|
701
728
|
var lastSelectedRowRef = (0, react_2.useRef)(null);
|
|
702
729
|
var dragSelectRef = (0, react_2.useRef)(null);
|
|
703
730
|
var suppressNextClickRef = (0, react_2.useRef)(false);
|
|
704
|
-
var
|
|
705
|
-
var
|
|
706
|
-
var
|
|
707
|
-
var
|
|
731
|
+
var _31 = (0, react_2.useState)(false), isDragSelecting = _31[0], setIsDragSelecting = _31[1];
|
|
732
|
+
var _32 = (0, react_2.useState)(0), copiedCount = _32[0], setCopiedCount = _32[1];
|
|
733
|
+
var _33 = (0, react_2.useState)({}), editDataValue = _33[0], setEditDataValue = _33[1];
|
|
734
|
+
var _34 = (0, react_2.useState)(false), editDataIsLoading = _34[0], setEditDataIsLoading = _34[1];
|
|
708
735
|
// INFO: true while the empty bottom row is being filled in; the row itself is
|
|
709
736
|
// always there in an addable table
|
|
710
|
-
var
|
|
737
|
+
var _35 = (0, react_2.useState)(false), addData = _35[0], setAddData = _35[1];
|
|
711
738
|
var isAddRowPinned = props.paginationType === "scroll";
|
|
712
|
-
var
|
|
739
|
+
var _36 = (0, react_2.useState)({}), addDataValue = _36[0], setAddDataValue = _36[1];
|
|
713
740
|
// INFO: bumped after each saved row, so the next one starts with fresh
|
|
714
741
|
// inputs and its first cell takes the focus
|
|
715
|
-
var
|
|
742
|
+
var _37 = (0, react_2.useState)(0), addRowKey = _37[0], setAddRowKey = _37[1];
|
|
716
743
|
// INFO: the add row's coloured multiple list being picked under
|
|
717
744
|
// gridLines="all" — its label picker hangs from this cell
|
|
718
745
|
// INFO: the new row's required tag columns left empty on a save — their
|
|
719
746
|
// cells are ringed red until a label is picked
|
|
720
|
-
var
|
|
721
|
-
var
|
|
747
|
+
var _38 = (0, react_2.useState)([]), addTagErrors = _38[0], setAddTagErrors = _38[1];
|
|
748
|
+
var _39 = (0, react_2.useState)(null), addLabelPicker = _39[0], setAddLabelPicker = _39[1];
|
|
722
749
|
// INFO: the group whose own add row is being filled in; "" = the bottom row
|
|
723
|
-
var
|
|
750
|
+
var _40 = (0, react_2.useState)(""), addGroupId = _40[0], setAddGroupId = _40[1];
|
|
724
751
|
// INFO: the row armed by a press on its handle, so only the handle — never
|
|
725
752
|
// a click or a text selection in a cell — starts a drag
|
|
726
|
-
var
|
|
727
|
-
var
|
|
728
|
-
var
|
|
729
|
-
var
|
|
753
|
+
var _41 = (0, react_2.useState)(""), dragArmedRowId = _41[0], setDragArmedRowId = _41[1];
|
|
754
|
+
var _42 = (0, react_2.useState)(""), draggingRowId = _42[0], setDraggingRowId = _42[1];
|
|
755
|
+
var _43 = (0, react_2.useState)(""), dropGroupId = _43[0], setDropGroupId = _43[1];
|
|
756
|
+
var _44 = (0, react_2.useState)({}), referencesOptions = _44[0], setReferencesOptions = _44[1];
|
|
730
757
|
// INFO: seeded options sit under the local map so a cell's own search
|
|
731
758
|
// results still win per key
|
|
732
759
|
var mergedReferencesOptions = __assign(__assign({}, ((_h = props.referencesOptions) !== null && _h !== void 0 ? _h : {})), referencesOptions);
|
|
733
|
-
var
|
|
760
|
+
var _45 = (0, react_2.useState)({}), referencesDetails = _45[0], setReferencesDetails = _45[1];
|
|
734
761
|
// INFO: per column, the records a search found and the records the parent
|
|
735
762
|
// passes in, matched by id — a search copies the parent's records into the
|
|
736
763
|
// local map, so the parent's copy wins and a reload of the list reaches the
|
|
@@ -740,13 +767,13 @@ var NewTable = function (rawProps) {
|
|
|
740
767
|
var mergedReferencesDetails = (0, react_2.useMemo)(function () {
|
|
741
768
|
return handleMergeReferencesDetails(referencesDetails, props.referencesDetails);
|
|
742
769
|
}, [referencesDetails, props.referencesDetails]);
|
|
743
|
-
var
|
|
770
|
+
var _46 = (0, react_2.useState)(false), referenceLoading = _46[0], setReferenceLoading = _46[1];
|
|
744
771
|
// INFO: measured pixel widths for pinned columns without an explicit width.
|
|
745
|
-
var
|
|
772
|
+
var _47 = (0, react_2.useState)({}), measuredPinWidths = _47[0], setMeasuredPinWidths = _47[1];
|
|
746
773
|
// INFO: the scrolling view's width, which caps how much the left pins take
|
|
747
|
-
var
|
|
774
|
+
var _48 = (0, react_2.useState)(0), pinViewWidth = _48[0], setPinViewWidth = _48[1];
|
|
748
775
|
// INFO: per large group, the rows [start, end) drawn; the rest are spacers
|
|
749
|
-
var
|
|
776
|
+
var _49 = (0, react_2.useState)({}), virtualRanges = _49[0], setVirtualRanges = _49[1];
|
|
750
777
|
// INFO: each drawn row's measured height, kept so a spacer is as tall as the
|
|
751
778
|
// rows it stands in for
|
|
752
779
|
var rowHeightsRef = (0, react_2.useRef)(new Map());
|
|
@@ -1199,14 +1226,12 @@ var NewTable = function (rawProps) {
|
|
|
1199
1226
|
? Math.max(textWidth, inner.offsetWidth, truncatedWidth)
|
|
1200
1227
|
: td.scrollWidth;
|
|
1201
1228
|
// INFO: + cell padding (px-4 = 16px × 2), or the title cell's left
|
|
1202
|
-
// padding and the actions' room
|
|
1203
|
-
// still fits when a hovered row makes room for the chevron
|
|
1229
|
+
// padding and the actions' room
|
|
1204
1230
|
var leftPadding = parseFloat(window.getComputedStyle(td).paddingLeft) || 16;
|
|
1205
|
-
var rightPadding = titleChevronActionsWidth;
|
|
1206
1231
|
if (w > 0)
|
|
1207
1232
|
widths[key] =
|
|
1208
1233
|
key === ((_c = flatColumns[0]) === null || _c === void 0 ? void 0 : _c.key) && titleActionsWidth
|
|
1209
|
-
? w + leftPadding +
|
|
1234
|
+
? w + leftPadding + titleActionsWidth
|
|
1210
1235
|
: w + 32;
|
|
1211
1236
|
}
|
|
1212
1237
|
});
|
|
@@ -1439,9 +1464,11 @@ var NewTable = function (rawProps) {
|
|
|
1439
1464
|
}
|
|
1440
1465
|
});
|
|
1441
1466
|
}); };
|
|
1467
|
+
// INFO: an edited row is saved — its emptied fields are not prefilled with
|
|
1468
|
+
// defaults again; the add row is a new record and keeps them
|
|
1442
1469
|
var handleGenerateClonedData = function () {
|
|
1443
1470
|
var _a, _b;
|
|
1444
|
-
return (0, updateModule_1.handleClonedDataAttribute)(addData ? addDataValueRef.current : editDataValueRef.current, handleConvertColumnToDataStructure(flatColumns), (_b = (_a = props.devSettings) === null || _a === void 0 ? void 0 : _a.server) !== null && _b !== void 0 ? _b : "mongoServer");
|
|
1471
|
+
return (0, updateModule_1.handleClonedDataAttribute)(addData ? addDataValueRef.current : editDataValueRef.current, handleConvertColumnToDataStructure(flatColumns), (_b = (_a = props.devSettings) === null || _a === void 0 ? void 0 : _a.server) !== null && _b !== void 0 ? _b : "mongoServer", false, false, !addData);
|
|
1445
1472
|
};
|
|
1446
1473
|
var handleUpdateChangeData = function (data) {
|
|
1447
1474
|
if (addData) {
|
|
@@ -1664,12 +1691,35 @@ var NewTable = function (rawProps) {
|
|
|
1664
1691
|
}
|
|
1665
1692
|
});
|
|
1666
1693
|
}); };
|
|
1694
|
+
// INFO: a cell's "x" — opens the cell as a click would, empties its value and
|
|
1695
|
+
// saves it the way leaving the field does, which closes the cell
|
|
1696
|
+
var handleClearCell = function (rowId, col, rowData) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1697
|
+
var handleEmpty, cleared;
|
|
1698
|
+
var _a;
|
|
1699
|
+
var _b;
|
|
1700
|
+
return __generator(this, function (_c) {
|
|
1701
|
+
switch (_c.label) {
|
|
1702
|
+
case 0:
|
|
1703
|
+
handleEmpty = CLEAR_CELL_VALUES[(_b = col.type) !== null && _b !== void 0 ? _b : "string"];
|
|
1704
|
+
if (!handleEmpty)
|
|
1705
|
+
return [2 /*return*/];
|
|
1706
|
+
handleEditDataOnClick(rowId, col.key, rowData);
|
|
1707
|
+
cleared = __assign(__assign({}, editDataValueRef.current), (_a = {}, _a[col.key] = handleEmpty(), _a));
|
|
1708
|
+
editDataValueRef.current = cleared;
|
|
1709
|
+
setEditDataValue(cleared);
|
|
1710
|
+
return [4 /*yield*/, handleEditDataOnBlur(col.key, cleared)];
|
|
1711
|
+
case 1:
|
|
1712
|
+
_c.sent();
|
|
1713
|
+
return [2 /*return*/];
|
|
1714
|
+
}
|
|
1715
|
+
});
|
|
1716
|
+
}); };
|
|
1667
1717
|
// INFO: the width of a column being dragged, keyed by column key, until the
|
|
1668
1718
|
// drag is released — then a caller with onResizeColumn keeps it, otherwise
|
|
1669
1719
|
// it stays here until the table unmounts. Tailwind cannot emit a runtime
|
|
1670
1720
|
// w-[Npx], so a width drives an inline style and wins over the col.width
|
|
1671
1721
|
// class.
|
|
1672
|
-
var
|
|
1722
|
+
var _50 = (0, react_2.useState)({}), columnWidths = _50[0], setColumnWidths = _50[1];
|
|
1673
1723
|
var resizeRef = (0, react_2.useRef)(null);
|
|
1674
1724
|
// INFO: a dragged width first, else the column's own fixed width in pixels
|
|
1675
1725
|
// whatever form it is stored in ("180px", "w-[180px]", "w-48")
|
|
@@ -1686,24 +1736,12 @@ var NewTable = function (rawProps) {
|
|
|
1686
1736
|
var getTitleMinWidth = function (key) {
|
|
1687
1737
|
var _a;
|
|
1688
1738
|
return key === ((_a = flatColumns[0]) === null || _a === void 0 ? void 0 : _a.key) && hasRowActions
|
|
1689
|
-
? TITLE_LEFT_PADDING +
|
|
1739
|
+
? TITLE_LEFT_PADDING + titleActionsWidth + MIN_TITLE_TEXT_WIDTH
|
|
1690
1740
|
: undefined;
|
|
1691
1741
|
};
|
|
1692
1742
|
// INFO: a consumer may deliberately set a column narrower than the default
|
|
1693
1743
|
// floor (a 40px icon column, say) — never force it wider than it was asked to
|
|
1694
1744
|
// be, so the floor drops to the configured width when that is smaller
|
|
1695
|
-
// INFO: the title cell can only grow its padding on hover while its column
|
|
1696
|
-
// has a set width — a pinned title, or one dragged or configured. A title
|
|
1697
|
-
// sized by its content would widen and shift the table on every hover, so
|
|
1698
|
-
// it keeps the chevron's room all the time instead.
|
|
1699
|
-
var titleKey = (_o = flatColumns[0]) === null || _o === void 0 ? void 0 : _o.key;
|
|
1700
|
-
var isTitleWidthFixed = !!titleKey &&
|
|
1701
|
-
(leftPinned.includes(titleKey) ||
|
|
1702
|
-
rightPinned.includes(titleKey) ||
|
|
1703
|
-
!!getColumnWidth(titleKey));
|
|
1704
|
-
var titleRestPadding = isTitleWidthFixed
|
|
1705
|
-
? titleActionsWidth
|
|
1706
|
-
: titleChevronActionsWidth;
|
|
1707
1745
|
var getColumnMinWidth = function (key) {
|
|
1708
1746
|
var titleMin = getTitleMinWidth(key);
|
|
1709
1747
|
if (titleMin)
|
|
@@ -2582,12 +2620,12 @@ var NewTable = function (rawProps) {
|
|
|
2582
2620
|
var width = (col === null || col === void 0 ? void 0 : col.width)
|
|
2583
2621
|
? DEFAULT_PIN_WIDTH
|
|
2584
2622
|
: ((_a = measuredPinWidths[key]) !== null && _a !== void 0 ? _a : DEFAULT_PIN_WIDTH);
|
|
2585
|
-
// INFO: a measured short title still keeps its floor, so
|
|
2586
|
-
//
|
|
2623
|
+
// INFO: a measured short title still keeps its floor, so its inline
|
|
2624
|
+
// editor keeps some room beside the action strips
|
|
2587
2625
|
return Math.max(width, (_b = getTitleMinWidth(key)) !== null && _b !== void 0 ? _b : 0);
|
|
2588
2626
|
};
|
|
2589
2627
|
var pinCheckboxOffset = props.checkbox &&
|
|
2590
|
-
(props.data.length > 0 || (props.spaceData && ((
|
|
2628
|
+
(props.data.length > 0 || (props.spaceData && ((_o = props.spaceData) === null || _o === void 0 ? void 0 : _o.length) > 0))
|
|
2591
2629
|
? CHECKBOX_WIDTH
|
|
2592
2630
|
: 0;
|
|
2593
2631
|
/**
|
|
@@ -2866,7 +2904,7 @@ var NewTable = function (rawProps) {
|
|
|
2866
2904
|
tagClassName: gridLines === "all" ? "!mx-0" : "" }));
|
|
2867
2905
|
};
|
|
2868
2906
|
var renderEditDataInputs = function (colIndex, col, rowData, rowId, rowBgClass, isHoverable) {
|
|
2869
|
-
var _a, _b, _c, _d;
|
|
2907
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2870
2908
|
var tempDS = __assign(__assign({}, col), { id: col.key, name: col.title, type: (_a = col.type) !== null && _a !== void 0 ? _a : "string", showTagSelections: handleColumnShowsTags(col) });
|
|
2871
2909
|
var editingRow = editDataRowId === rowId;
|
|
2872
2910
|
var cellFill = tempDS.showTagSelections
|
|
@@ -2888,6 +2926,20 @@ var NewTable = function (rawProps) {
|
|
|
2888
2926
|
? "cursor-pointer hover:brightness-95 ".concat(isFillActive ? "!shadow-[inset_0_0_0_2px_rgba(255,255,255,0.85)]" : "")
|
|
2889
2927
|
: "cursor-pointer ".concat(props.darkMode ? "hover:bg-gray-800" : "hover:bg-gray-50", " ").concat(isFillActive ? "!shadow-[inset_0_0_0_2px_#9ca3af]" : "");
|
|
2890
2928
|
var pinProps = getPinProps(col.key, false, rowBgClass, isHoverable);
|
|
2929
|
+
// INFO: the value being typed while this row is open, else the saved one
|
|
2930
|
+
var liveValue = editingRow && col.key in ((_c = editDataValueRef.current) !== null && _c !== void 0 ? _c : {})
|
|
2931
|
+
? editDataValueRef.current[col.key]
|
|
2932
|
+
: resolveValue(rowData, col.key);
|
|
2933
|
+
// INFO: an "x" that empties the cell, under gridLines="all" only — a
|
|
2934
|
+
// horizontal table's fields keep their own boxes and clear icons. A
|
|
2935
|
+
// required, read-only or grouped (dotted key) column has none. Once open,
|
|
2936
|
+
// only a typed field or a date keeps it — a dropdown's chevron sits where
|
|
2937
|
+
// the "x" would, and its open list is where a pick is changed.
|
|
2938
|
+
var isClearable = isFillInput &&
|
|
2939
|
+
CLEAR_OPEN_EDITOR_TYPES.includes((_d = col.type) !== null && _d !== void 0 ? _d : "string") &&
|
|
2940
|
+
// INFO: the title's right edge holds the row's own actions
|
|
2941
|
+
!(hasRowActions && col.key === ((_e = flatColumns[0]) === null || _e === void 0 ? void 0 : _e.key)) &&
|
|
2942
|
+
handleIsCellClearable(col, liveValue, rowData);
|
|
2891
2943
|
return (react_2.default.createElement("td", { key: col.key + String(colIndex), "data-cell-key": col.key, "data-pin-key": handleGetPinKey(col.key), "data-edit-cell": "".concat(rowId, ":").concat(col.key), "data-cell-fill": cellFill ? "" : undefined,
|
|
2892
2944
|
// INFO: pinned columns use whitespace-normal so text wraps within the fixed width.
|
|
2893
2945
|
// col.width must match the read-only cell's width source so a column keeps one
|
|
@@ -2895,7 +2947,7 @@ var NewTable = function (rawProps) {
|
|
|
2895
2947
|
// shrinks/grows on hover and staggers the column.
|
|
2896
2948
|
// INFO: a cell fill comes after the pin classes so its colour wins over
|
|
2897
2949
|
// a pinned cell's row background
|
|
2898
|
-
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) : ((
|
|
2950
|
+
className: "".concat(isClearable && !((_f = pinProps === null || pinProps === void 0 ? void 0 : pinProps.className) === null || _f === void 0 ? void 0 : _f.includes("sticky")) ? "relative" : "", " ").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) : ((_g = pinProps === null || pinProps === void 0 ? void 0 : pinProps.className) !== null && _g !== void 0 ? _g : ""), " ").concat((_h = cellFill === null || cellFill === void 0 ? void 0 : cellFill.className) !== null && _h !== void 0 ? _h : "", " ").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) },
|
|
2899
2951
|
react_2.default.createElement("div", {
|
|
2900
2952
|
// INFO: w-0 on the control, not min-w-0 — the table is sized w-max, so
|
|
2901
2953
|
// an input's browser-default ~20ch intrinsic width feeds max-content
|
|
@@ -2942,26 +2994,56 @@ var NewTable = function (rawProps) {
|
|
|
2942
2994
|
fill: isFillColumn || isFillInput,
|
|
2943
2995
|
// INFO: this editor mounts on the click that opens it
|
|
2944
2996
|
openOnMount: isFillInput,
|
|
2997
|
+
isUpdate: true,
|
|
2945
2998
|
onBlur: function (updateData, options) {
|
|
2946
2999
|
return handleEditDataOnBlur(col.key, updateData !== null && updateData !== void 0 ? updateData : (editDataRowIdRef.current === rowId
|
|
2947
3000
|
? editDataValueRef.current
|
|
2948
3001
|
: rowData), options);
|
|
2949
3002
|
},
|
|
2950
|
-
}))
|
|
3003
|
+
})),
|
|
3004
|
+
isClearable && renderClearCellButton(col, rowId, rowData, false)));
|
|
2951
3005
|
};
|
|
3006
|
+
// INFO: a cell's "x" is offered under gridLines="all" on an optional column
|
|
3007
|
+
// whose type CLEAR_CELL_VALUES lists, while the cell holds a value. A
|
|
3008
|
+
// required (or required for this row), read-only, rating or grouped (dotted
|
|
3009
|
+
// key) column has none.
|
|
3010
|
+
var handleIsCellClearable = function (col, value, rowData) {
|
|
3011
|
+
var _a, _b;
|
|
3012
|
+
return !!((_a = props.editable) === null || _a === void 0 ? void 0 : _a.active) &&
|
|
3013
|
+
!!CLEAR_CELL_VALUES[(_b = col.type) !== null && _b !== void 0 ? _b : "string"] &&
|
|
3014
|
+
!col.ratingMax &&
|
|
3015
|
+
!(0, updateModule_1.handleIsFieldRequired)(col, rowData) &&
|
|
3016
|
+
!col.readOnly &&
|
|
3017
|
+
!col.disabled &&
|
|
3018
|
+
!col.key.includes(".") &&
|
|
3019
|
+
!handleIsEmptyCellValue(value);
|
|
3020
|
+
};
|
|
3021
|
+
// INFO: shown only to a mouse — a touch screen taps the cell to edit it and
|
|
3022
|
+
// has no hover to reveal the button by. On a cell that is read it shows while
|
|
3023
|
+
// the cell is hovered; on an open text, number or date field it stays, over
|
|
3024
|
+
// the field's right edge.
|
|
3025
|
+
var renderClearCellButton = function (col, rowId, rowData, onHover) { return (react_2.default.createElement("button", { type: "button", "aria-label": "Clear ".concat(typeof col.title === "string" ? col.title : col.key), "data-testid": "cell-clear", className: "absolute right-1.5 top-1/2 z-[3] hidden h-5 w-5 -translate-y-1/2 items-center justify-center rounded ".concat(onHover ? "[@media(hover:hover)_and_(pointer:fine)]:group-hover/clear:flex" : "[@media(hover:hover)_and_(pointer:fine)]:flex", " ").concat(props.darkMode ? "bg-gray-700 text-gray-300 hover:bg-gray-600" : "bg-gray-100 text-gray-500 hover:bg-gray-200"),
|
|
3026
|
+
// INFO: a field being typed in keeps its focus, or its blur would save
|
|
3027
|
+
// the value being cleared and close the cell under the click
|
|
3028
|
+
onMouseDown: function (e) { return e.preventDefault(); }, onClick: function (e) {
|
|
3029
|
+
e.stopPropagation();
|
|
3030
|
+
handleOpenAfterLeaving(e.currentTarget, function () {
|
|
3031
|
+
handleClearCell(rowId, col, rowData);
|
|
3032
|
+
});
|
|
3033
|
+
} },
|
|
3034
|
+
react_2.default.createElement(solid_2.XMarkIcon, { className: "h-3.5 w-3.5", "aria-hidden": "true" }))); };
|
|
2952
3035
|
var renderActionStrip = function (testId, right, children) { return (react_2.default.createElement("div", { "data-testid": testId, className: "absolute inset-y-0 z-20 flex items-center justify-center border-l ".concat(borderColor), style: { right: right, width: ACTION_STRIP_WIDTH } }, children)); };
|
|
2953
|
-
var renderActivityButton = function (id, positioned
|
|
3036
|
+
var renderActivityButton = function (id, positioned) {
|
|
2954
3037
|
var _a, _b;
|
|
2955
3038
|
if (positioned === void 0) { positioned = false; }
|
|
2956
|
-
if (chevronBgClass === void 0) { chevronBgClass = ""; }
|
|
2957
3039
|
if (!hasRowActions)
|
|
2958
3040
|
return null;
|
|
2959
3041
|
// INFO: a mobile card opens its record from the card, so it keeps the
|
|
2960
|
-
// pencil and the bubble beside its title and drops the
|
|
3042
|
+
// pencil and the bubble beside its title and drops the eye
|
|
2961
3043
|
if (!positioned)
|
|
2962
3044
|
return (react_2.default.createElement(recordActions_1.RecordActions, { id: id, onEdit: props.onRowEdit, onActivity: props.onRowActivity, commentCount: (_a = props.commentCounts) === null || _a === void 0 ? void 0 : _a[id] }));
|
|
2963
3045
|
return (react_2.default.createElement(react_2.default.Fragment, null,
|
|
2964
|
-
props.onRowOpen && (react_2.default.createElement(recordActions_1.RecordActions, { id: id, onOpen: props.onRowOpen, className: "absolute top-1/2 -translate-y-1/2 z-20 rounded-lg
|
|
3046
|
+
props.onRowOpen && (react_2.default.createElement(recordActions_1.RecordActions, { id: id, onOpen: props.onRowOpen, className: "absolute top-1/2 -translate-y-1/2 z-20 rounded-lg", style: { right: titleStripsWidth + 4 } })),
|
|
2965
3047
|
props.onRowEdit &&
|
|
2966
3048
|
renderActionStrip("record-edit-strip", activityStripWidth, react_2.default.createElement(recordActions_1.RecordActions, { id: id, onEdit: props.onRowEdit })),
|
|
2967
3049
|
props.onRowActivity &&
|
|
@@ -3034,7 +3116,7 @@ var NewTable = function (rawProps) {
|
|
|
3034
3116
|
};
|
|
3035
3117
|
// INFO: worked out here, after the Actions and "+" helpers it reads, and
|
|
3036
3118
|
// only read by the render helpers called from the return below
|
|
3037
|
-
var
|
|
3119
|
+
var _51 = handleFitPins(), fittedLeftPins = _51.widths, narrowPins = _51.narrow;
|
|
3038
3120
|
var renderActionColumnHeader = function () {
|
|
3039
3121
|
if (handleShowsActionColumn()) {
|
|
3040
3122
|
var pin = handleGetActionCellPin(true);
|
|
@@ -3222,7 +3304,7 @@ var NewTable = function (rawProps) {
|
|
|
3222
3304
|
};
|
|
3223
3305
|
// INFO: true when maxSelectedCount is set and the current selection has reached the limit
|
|
3224
3306
|
var isMaxReached = !!props.maxSelectedCount &&
|
|
3225
|
-
((
|
|
3307
|
+
((_q = (_p = props.selectedIds) === null || _p === void 0 ? void 0 : _p.length) !== null && _q !== void 0 ? _q : 0) >= props.maxSelectedCount;
|
|
3226
3308
|
// INFO: one desktop row. groupAccent carries the group's colour so member
|
|
3227
3309
|
// rows show the band's colour as a bar down their left edge.
|
|
3228
3310
|
var handleRowDragStart = function (event, rowId) {
|
|
@@ -3575,14 +3657,13 @@ var NewTable = function (rawProps) {
|
|
|
3575
3657
|
// INFO: keep the action outside links and inline editors in every
|
|
3576
3658
|
// cell variant
|
|
3577
3659
|
var handleDecorateCell = function (cell) {
|
|
3578
|
-
var _a, _b, _c, _d, _e
|
|
3660
|
+
var _a, _b, _c, _d, _e;
|
|
3579
3661
|
if (colIndex !== 0 || (!hasRowActions && !dragHandle))
|
|
3580
3662
|
return cell;
|
|
3581
3663
|
// INFO: a filled text editor rings its cell, but the title cell also
|
|
3582
3664
|
// holds the row's action strips at its right edge — so the ring
|
|
3583
3665
|
// moves off the cell onto an overlay that stops where the strips
|
|
3584
3666
|
// begin
|
|
3585
|
-
var titleStripsWidth = activityStripWidth + editStripWidth;
|
|
3586
3667
|
var cellTokens = String((_a = cell.props.className) !== null && _a !== void 0 ? _a : "").split(" ");
|
|
3587
3668
|
var hasFillRing = cellTokens.includes("focus-within:ring-2");
|
|
3588
3669
|
var isFillRingActive = cellTokens.includes("ring-2");
|
|
@@ -3592,14 +3673,14 @@ var NewTable = function (rawProps) {
|
|
|
3592
3673
|
.join(" "), " group/fillcell")
|
|
3593
3674
|
: cell.props.className;
|
|
3594
3675
|
return react_2.default.cloneElement(cell, {
|
|
3595
|
-
className: "".concat(titleCellClassName, " ").concat((_b = TITLE_ACTIONS_PADDING_CLASS[
|
|
3596
|
-
style: __assign(__assign(__assign(__assign({}, cell.props.style), { paddingRight:
|
|
3676
|
+
className: "".concat(titleCellClassName, " ").concat((_b = TITLE_ACTIONS_PADDING_CLASS[titleActionsWidth]) !== null && _b !== void 0 ? _b : "", " ").concat((_d = (_c = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _c === void 0 ? void 0 : _c.className) !== null && _d !== void 0 ? _d : ""),
|
|
3677
|
+
style: __assign(__assign(__assign(__assign({}, cell.props.style), { paddingRight: titleActionsWidth }), (_e = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _e === void 0 ? void 0 : _e.style), { position: getPinProps(col.key, false) ? "sticky" : "relative" }),
|
|
3597
3678
|
}, 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
|
|
3598
3679
|
? ""
|
|
3599
|
-
: "hidden group-focus-within/fillcell:block"), style: { right: titleStripsWidth } })) : null, dragHandle, renderActivityButton(row.id, true
|
|
3680
|
+
: "hidden group-focus-within/fillcell:block"), style: { right: titleStripsWidth } })) : null, dragHandle, renderActivityButton(row.id, true));
|
|
3600
3681
|
};
|
|
3601
3682
|
var renderDataCell = function () {
|
|
3602
|
-
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;
|
|
3683
|
+
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, _10;
|
|
3603
3684
|
// INFO: a coloured list cell is this table's to render, so it takes
|
|
3604
3685
|
// the raw value even when a display row is supplied. The list view
|
|
3605
3686
|
// builds those rows and puts a Tag in for a coloured value — an
|
|
@@ -3693,6 +3774,7 @@ var NewTable = function (rawProps) {
|
|
|
3693
3774
|
renderFormCell(row, readOnlyDS, null, {
|
|
3694
3775
|
active: true,
|
|
3695
3776
|
readOnly: true,
|
|
3777
|
+
isUpdate: true,
|
|
3696
3778
|
fill: !!cellFill,
|
|
3697
3779
|
onBlur: function () { },
|
|
3698
3780
|
}),
|
|
@@ -3774,7 +3856,13 @@ var NewTable = function (rawProps) {
|
|
|
3774
3856
|
pendingFocusRef.current = "".concat(row.id, ":").concat(col.key);
|
|
3775
3857
|
};
|
|
3776
3858
|
var pickedValue = resolveValue((isCellEditing ? rowData : row), col.key);
|
|
3777
|
-
|
|
3859
|
+
// INFO: a plain multiple list under gridLines="all" gets the
|
|
3860
|
+
// cell's "x" on hover; a coloured one clears in its label picker
|
|
3861
|
+
var tagPinClass = (_2 = (_1 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _1 === void 0 ? void 0 : _1.className) !== null && _2 !== void 0 ? _2 : "";
|
|
3862
|
+
var isTagClearable = gridLines === "all" &&
|
|
3863
|
+
!isLabelPickerColumn &&
|
|
3864
|
+
handleIsCellClearable(col, pickedValue, rowData);
|
|
3865
|
+
return (react_2.default.createElement("td", { key: col.key, "data-cell-key": col.key, "data-pin-key": handleGetPinKey(col.key), className: "".concat(isTagClearable ? "group/clear ".concat(tagPinClass.includes("sticky") ? "" : "relative") : "", " ").concat(editCellPadding, " ").concat(handleCellMinWidth(col.type), " ").concat(handleReadCellWidthClass(col), " text-sm ").concat(cellFontColor, " ").concat(tagPinClass, " ").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 },
|
|
3778
3866
|
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) {
|
|
3779
3867
|
e.stopPropagation();
|
|
3780
3868
|
handleOpenCell_1(e.currentTarget);
|
|
@@ -3785,6 +3873,8 @@ var NewTable = function (rawProps) {
|
|
|
3785
3873
|
e.stopPropagation();
|
|
3786
3874
|
handleOpenCell_1(e.currentTarget);
|
|
3787
3875
|
} }, renderTagLine(col, isLabelPickerColumn ? pickedValue : cellValue)),
|
|
3876
|
+
isTagClearable &&
|
|
3877
|
+
renderClearCellButton(col, row.id, rowData, true),
|
|
3788
3878
|
isPicking && labelPickerAnchor && (react_2.default.createElement(labelPicker_1.LabelPicker, { anchor: labelPickerAnchor, darkMode: props.darkMode, required: (0, updateModule_1.handleIsFieldRequired)(col, rowData), allowNewValue: !!col.listNewValue, options: ((_4 = col.listSelection) !== null && _4 !== void 0 ? _4 : []).map(function (key) { return ({
|
|
3789
3879
|
key: String(key),
|
|
3790
3880
|
color: handleGetListColour(col, key),
|
|
@@ -3799,7 +3889,7 @@ var NewTable = function (rawProps) {
|
|
|
3799
3889
|
// takes, so the save carries the same cleaned row
|
|
3800
3890
|
onChange: function (next) {
|
|
3801
3891
|
var _a, _b;
|
|
3802
|
-
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");
|
|
3892
|
+
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", false, false, true);
|
|
3803
3893
|
updated[col.key] = next;
|
|
3804
3894
|
editDataValueRef.current = updated;
|
|
3805
3895
|
setEditDataValue(updated);
|
|
@@ -3827,9 +3917,15 @@ var NewTable = function (rawProps) {
|
|
|
3827
3917
|
!bareOverride &&
|
|
3828
3918
|
gridLines === "all" &&
|
|
3829
3919
|
FILL_INPUT_TYPES.includes(resolvedColType);
|
|
3920
|
+
var readPinClass = (_8 = (_7 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _7 === void 0 ? void 0 : _7.className) !== null && _8 !== void 0 ? _8 : "";
|
|
3921
|
+
var isReadClearable = isClickToEditCell &&
|
|
3922
|
+
!handleColumnShowsTags(col) &&
|
|
3923
|
+
// INFO: the title's right edge holds the row's own actions
|
|
3924
|
+
!(hasRowActions && col.key === ((_9 = flatColumns[0]) === null || _9 === void 0 ? void 0 : _9.key)) &&
|
|
3925
|
+
handleIsCellClearable(col, rowData === null || rowData === void 0 ? void 0 : rowData[col.key], rowData);
|
|
3830
3926
|
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)
|
|
3831
3927
|
? col.key
|
|
3832
|
-
: 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(
|
|
3928
|
+
: undefined, className: "".concat(isReadClearable ? "group/clear ".concat(readPinClass.includes("sticky") ? "" : "relative") : "", " ").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(readPinClass), style: (_10 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _10 === void 0 ? void 0 : _10.style, "data-row-link-cell": props.newTabUrl && props.onClickRow ? "" : undefined,
|
|
3833
3929
|
// INFO: a click opens the editor in place rather than following
|
|
3834
3930
|
// the row's link
|
|
3835
3931
|
onClickCapture: isClickToEditCell
|
|
@@ -3847,7 +3943,10 @@ var NewTable = function (rawProps) {
|
|
|
3847
3943
|
handleEditDataOnClick(row.id, col.key, rowData);
|
|
3848
3944
|
});
|
|
3849
3945
|
}
|
|
3850
|
-
: undefined },
|
|
3946
|
+
: undefined },
|
|
3947
|
+
handleIsReadCellFixed(col) ? (react_2.default.createElement(hoverTooltip_1.HoverTooltip, { as: "div", className: "w-0 min-w-full truncate", onlyWhenClipped: true }, renderReadCellValue(col, row, cellValue))) : (renderReadCellValue(col, row, cellValue)),
|
|
3948
|
+
isReadClearable &&
|
|
3949
|
+
renderClearCellButton(col, row.id, rowData, true)));
|
|
3851
3950
|
if (!isEditable || bareOverride)
|
|
3852
3951
|
return readCell;
|
|
3853
3952
|
if (isClickToEditCell)
|
|
@@ -4328,20 +4427,20 @@ var NewTable = function (rawProps) {
|
|
|
4328
4427
|
};
|
|
4329
4428
|
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 : "") })); };
|
|
4330
4429
|
if (props.mobileView) {
|
|
4331
|
-
var hasPhoneGroups = !!((
|
|
4430
|
+
var hasPhoneGroups = !!((_r = props.groups) === null || _r === void 0 ? void 0 : _r.length);
|
|
4332
4431
|
return (react_2.default.createElement("div", null,
|
|
4333
|
-
react_2.default.createElement("div", { className: "w-full ".concat(((
|
|
4432
|
+
react_2.default.createElement("div", { className: "w-full ".concat(((_s = props.mobileTooltip) === null || _s === void 0 ? void 0 : _s.tooltip) ? "overflow-visible" : "overflow-hidden", " ").concat(isFlat
|
|
4334
4433
|
? ""
|
|
4335
|
-
: "border ".concat(borderRadius, " ").concat(borderColor, " ").concat(bgColor, " shadow-sm"), " divide-y ").concat(dividerColor, " ").concat((
|
|
4434
|
+
: "border ".concat(borderRadius, " ").concat(borderColor, " ").concat(bgColor, " shadow-sm"), " divide-y ").concat(dividerColor, " ").concat((_t = props.className) !== null && _t !== void 0 ? _t : "") },
|
|
4336
4435
|
react_2.default.createElement("div", { className: "p-3 flex items-center justify-between" },
|
|
4337
4436
|
renderSelectAll(),
|
|
4338
4437
|
react_2.default.createElement("div", { className: "flex items-center gap-2" },
|
|
4339
4438
|
renderSelectedCount(),
|
|
4340
|
-
((
|
|
4439
|
+
((_u = props.advSettings) === null || _u === void 0 ? void 0 : _u.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"); } })))),
|
|
4341
4440
|
props.loading &&
|
|
4342
4441
|
Array.from({ length: 3 }).map(function (_, i) { return (react_2.default.createElement("div", { key: "skeleton-".concat(i), className: "p-4" },
|
|
4343
4442
|
react_2.default.createElement("div", { className: "h-5 w-3/4 rounded-md animate-pulse ".concat(props.darkMode ? "bg-gray-700" : "bg-gray-200") }))); }),
|
|
4344
|
-
!props.loading && props.data.length === 0 && !hasPhoneGroups && (react_2.default.createElement("p", { className: "p-4 text-center text-sm ".concat(cellFontColor) }, (
|
|
4443
|
+
!props.loading && props.data.length === 0 && !hasPhoneGroups && (react_2.default.createElement("p", { className: "p-4 text-center text-sm ".concat(cellFontColor) }, (_v = props.emptyTitle) !== null && _v !== void 0 ? _v : "No items")),
|
|
4345
4444
|
!props.loading && (props.data.length > 0 || hasPhoneGroups) && (react_2.default.createElement("table", { className: "w-full table-fixed", ref: tableRef },
|
|
4346
4445
|
react_2.default.createElement("tbody", { className: "divide-y ".concat(dividerColor) }, renderDesktopRows())))),
|
|
4347
4446
|
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
|
|
@@ -4361,13 +4460,13 @@ var NewTable = function (rawProps) {
|
|
|
4361
4460
|
: [])[0];
|
|
4362
4461
|
return WIDE_EDIT_TYPES.includes((_a = selectedDS === null || selectedDS === void 0 ? void 0 : selectedDS.type) !== null && _a !== void 0 ? _a : "") ? "4xl" : "2xl";
|
|
4363
4462
|
};
|
|
4364
|
-
return (react_2.default.createElement("div", { className: "w-full ".concat((
|
|
4463
|
+
return (react_2.default.createElement("div", { className: "w-full ".concat((_w = props.className) !== null && _w !== void 0 ? _w : "") },
|
|
4365
4464
|
react_2.default.createElement(modal_1.Modal, { open: filterModal ? true : false, title: "Filter Options", renderContent: function () {
|
|
4366
4465
|
var _a, _b;
|
|
4367
4466
|
return (react_2.default.createElement("div", { className: "pb-44" },
|
|
4368
4467
|
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))));
|
|
4369
4468
|
}, onClose: function () { return setFilterModal(""); } }),
|
|
4370
|
-
react_2.default.createElement(modal_1.Modal, { open: modalEditVisible, title: (
|
|
4469
|
+
react_2.default.createElement(modal_1.Modal, { open: modalEditVisible, title: (_y = (_x = flatColumns.find(function (eachCol) { return eachCol.key === editDataHeaderKey; })) === null || _x === void 0 ? void 0 : _x.title) !== null && _y !== void 0 ? _y : "Edit", maxWidth: handleGetEditModalWidth(), onClose: handleModalEditClose, renderContent: function () {
|
|
4371
4470
|
var _a, _b, _c, _d;
|
|
4372
4471
|
var selectedCol = flatColumns.find(function (eachCol) { return eachCol.key === editDataHeaderKey; });
|
|
4373
4472
|
if (!selectedCol)
|
|
@@ -4413,7 +4512,7 @@ var NewTable = function (rawProps) {
|
|
|
4413
4512
|
react_2.default.createElement(scrollShadow_1.ScrollShadow, { className: "w-full overflow-x-auto ".concat(isFlat
|
|
4414
4513
|
? ""
|
|
4415
4514
|
: "".concat(borderRadius, " border ").concat(borderColor, " ").concat(bgColor, " shadow-sm")), darkMode: props.darkMode },
|
|
4416
|
-
(props.selectAll || ((
|
|
4515
|
+
(props.selectAll || ((_0 = (_z = props.selectedIds) === null || _z === void 0 ? void 0 : _z.length) !== null && _0 !== void 0 ? _0 : 0) > 0) &&
|
|
4417
4516
|
(!props.multiActionFloatingBtns ||
|
|
4418
4517
|
(props.multiActionFloatingBtns &&
|
|
4419
4518
|
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" },
|
|
@@ -4441,7 +4540,7 @@ var NewTable = function (rawProps) {
|
|
|
4441
4540
|
(addData
|
|
4442
4541
|
? !isAddRowPinned && !addGroupId && renderAddDataRow()
|
|
4443
4542
|
: !handleHasGroupAddRows() && renderEmptyAddRow()))),
|
|
4444
|
-
!props.loading && props.data.length === 0 && (react_2.default.createElement("div", { className: "p-4 text-sm ".concat(cellFontColor, " text-center sticky left-0") }, (
|
|
4543
|
+
!props.loading && props.data.length === 0 && (react_2.default.createElement("div", { className: "p-4 text-sm ".concat(cellFontColor, " text-center sticky left-0") }, (_1 = props.emptyTitle) !== null && _1 !== void 0 ? _1 : "No items"))),
|
|
4445
4544
|
renderPinnedAddButton(),
|
|
4446
4545
|
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
|
|
4447
4546
|
? "pagination-container w-full ".concat(borderColor, " ").concat(isFixed ? "fixed bottom-0 left-0 z-10" : "sticky top-0 left-0")
|