blixify-ui-web 1.2.261 → 1.2.263
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/dataStateModel.d.ts +1 -0
- package/lib/components/data/dataTemplate/dataStateModel.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/dataStateModel.js.map +1 -1
- package/lib/components/data/dataTemplate/index.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/index.js +33 -20
- package/lib/components/data/dataTemplate/index.js.map +1 -1
- package/lib/components/data/dataTemplate/model.d.ts +2 -0
- package/lib/components/data/dataTemplate/model.d.ts.map +1 -1
- package/lib/components/data/dataWrapper/index.d.ts +1 -0
- package/lib/components/data/dataWrapper/index.d.ts.map +1 -1
- package/lib/components/data/dataWrapper/index.js +2 -2
- package/lib/components/data/dataWrapper/index.js.map +1 -1
- package/lib/components/display/drawer/index.d.ts +25 -0
- package/lib/components/display/drawer/index.d.ts.map +1 -1
- package/lib/components/display/drawer/index.js +223 -4
- package/lib/components/display/drawer/index.js.map +1 -1
- package/lib/components/display/newTable/columnMenu.d.ts +28 -0
- package/lib/components/display/newTable/columnMenu.d.ts.map +1 -0
- package/lib/components/display/newTable/columnMenu.js +197 -0
- package/lib/components/display/newTable/columnMenu.js.map +1 -0
- package/lib/components/display/newTable/columnWidth.d.ts +7 -0
- package/lib/components/display/newTable/columnWidth.d.ts.map +1 -1
- package/lib/components/display/newTable/columnWidth.js +12 -1
- package/lib/components/display/newTable/columnWidth.js.map +1 -1
- package/lib/components/display/newTable/columnWindow.d.ts +42 -0
- package/lib/components/display/newTable/columnWindow.d.ts.map +1 -0
- package/lib/components/display/newTable/columnWindow.js +84 -0
- package/lib/components/display/newTable/columnWindow.js.map +1 -0
- package/lib/components/display/newTable/index.d.ts +2 -0
- package/lib/components/display/newTable/index.d.ts.map +1 -1
- package/lib/components/display/newTable/index.js +568 -168
- package/lib/components/display/newTable/index.js.map +1 -1
- package/lib/components/display/newTable/rowRendering.d.ts +13 -0
- package/lib/components/display/newTable/rowRendering.d.ts.map +1 -1
- package/lib/components/display/newTable/rowRendering.js +28 -1
- package/lib/components/display/newTable/rowRendering.js.map +1 -1
- package/lib/components/input/select/index.d.ts +1 -0
- package/lib/components/input/select/index.d.ts.map +1 -1
- package/lib/components/input/select/index.js +24 -4
- package/lib/components/input/select/index.js.map +1 -1
- package/lib/components/navigation/bars/index.d.ts +5 -0
- package/lib/components/navigation/bars/index.d.ts.map +1 -1
- package/lib/components/navigation/bars/index.js +64 -3
- package/lib/components/navigation/bars/index.js.map +1 -1
- package/lib/components/navigation/leftNav/index.d.ts +55 -0
- package/lib/components/navigation/leftNav/index.d.ts.map +1 -1
- package/lib/components/navigation/leftNav/index.js +286 -23
- package/lib/components/navigation/leftNav/index.js.map +1 -1
- package/lib/tail.css +2 -2
- package/package.json +1 -1
|
@@ -128,7 +128,9 @@ var modal_1 = require("../modal");
|
|
|
128
128
|
var newPagination_1 = require("../newPagination");
|
|
129
129
|
var recordActions_1 = require("../recordActions");
|
|
130
130
|
var scrollShadow_1 = require("../scrollShadow");
|
|
131
|
+
var columnMenu_1 = require("./columnMenu");
|
|
131
132
|
var columnWidth_1 = require("./columnWidth");
|
|
133
|
+
var columnWindow_1 = require("./columnWindow");
|
|
132
134
|
var labelPicker_1 = require("./labelPicker");
|
|
133
135
|
var tagLine_1 = require("./tagLine");
|
|
134
136
|
var tag_1 = require("../tag");
|
|
@@ -545,7 +547,7 @@ var handleGetListColour = function (col, value) {
|
|
|
545
547
|
return column.listSelectionColour[index] || undefined;
|
|
546
548
|
};
|
|
547
549
|
var NewTable = function (rawProps) {
|
|
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;
|
|
550
|
+
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;
|
|
549
551
|
// INFO: props are read through the latest render. A row that was not drawn
|
|
550
552
|
// again keeps the handlers of the render that drew it, and those read
|
|
551
553
|
// props.onClickRow, props.data and the rest at the time they run — so a
|
|
@@ -646,7 +648,7 @@ var NewTable = function (rawProps) {
|
|
|
646
648
|
flatColumns.length = 0;
|
|
647
649
|
flatColumns.push.apply(flatColumns, __spreadArray(__spreadArray(__spreadArray([], leftCols, false), middleCols, false), rightCols, false));
|
|
648
650
|
}
|
|
649
|
-
var
|
|
651
|
+
var _4 = (0, react_2.useState)(props.fixedPagination ? true : false), isFixed = _4[0], setIsFixed = _4[1];
|
|
650
652
|
// INFO: the actions sit over the title cell's right padding: the pencil and
|
|
651
653
|
// the bubble in divided strips at the edge, the eye just left of them, then
|
|
652
654
|
// 8px from the text — kept clear so they never cover the title, and added to
|
|
@@ -664,38 +666,38 @@ var NewTable = function (rawProps) {
|
|
|
664
666
|
//=====================================================================================
|
|
665
667
|
// SECTION: Advanced Settings
|
|
666
668
|
//=====================================================================================
|
|
667
|
-
var
|
|
668
|
-
var
|
|
669
|
+
var _5 = (0, react_2.useState)(""), filterModal = _5[0], setFilterModal = _5[1];
|
|
670
|
+
var _6 = (0, react_2.useState)(""), addColumnModal = _6[0], setAddColumnModal = _6[1];
|
|
669
671
|
// INFO: what a DataTemplate around the table lets a cell save
|
|
670
672
|
var columnTypeActions = (0, react_2.useContext)(context_1.ColumnTypeContext);
|
|
671
|
-
var
|
|
672
|
-
var
|
|
673
|
-
var
|
|
674
|
-
var
|
|
675
|
-
var
|
|
676
|
-
var
|
|
677
|
-
var
|
|
673
|
+
var _7 = (0, react_2.useState)(""), newColumnName = _7[0], setNewColumnName = _7[1];
|
|
674
|
+
var _8 = (0, react_2.useState)("string"), newColumnType = _8[0], setNewColumnType = _8[1];
|
|
675
|
+
var _9 = (0, react_2.useState)(""), newColumnRefSpace = _9[0], setNewColumnRefSpace = _9[1];
|
|
676
|
+
var _10 = (0, react_2.useState)(""), newColumnRefLabel = _10[0], setNewColumnRefLabel = _10[1];
|
|
677
|
+
var _11 = (0, react_2.useState)(""), newColumnLookupReference = _11[0], setNewColumnLookupReference = _11[1];
|
|
678
|
+
var _12 = (0, react_2.useState)(""), newColumnLookupField = _12[0], setNewColumnLookupField = _12[1];
|
|
679
|
+
var _13 = (0, react_2.useState)([]), newColumnOptions = _13[0], setNewColumnOptions = _13[1];
|
|
678
680
|
// INFO: the option row whose colour palette is open
|
|
679
|
-
var
|
|
680
|
-
var
|
|
681
|
-
var
|
|
682
|
-
var
|
|
683
|
-
var
|
|
684
|
-
var
|
|
685
|
-
var
|
|
686
|
-
var
|
|
687
|
-
var
|
|
688
|
-
var
|
|
681
|
+
var _14 = (0, react_2.useState)(null), optionColourKey = _14[0], setOptionColourKey = _14[1];
|
|
682
|
+
var _15 = (0, react_2.useState)(false), newColumnRequired = _15[0], setNewColumnRequired = _15[1];
|
|
683
|
+
var _16 = (0, react_2.useState)(false), newColumnUnique = _16[0], setNewColumnUnique = _16[1];
|
|
684
|
+
var _17 = (0, react_2.useState)(false), newColumnReadOnly = _17[0], setNewColumnReadOnly = _17[1];
|
|
685
|
+
var _18 = (0, react_2.useState)(""), newColumnRatingMax = _18[0], setNewColumnRatingMax = _18[1];
|
|
686
|
+
var _19 = (0, react_2.useState)(""), newColumnButtonLabel = _19[0], setNewColumnButtonLabel = _19[1];
|
|
687
|
+
var _20 = (0, react_2.useState)(""), newColumnButtonColour = _20[0], setNewColumnButtonColour = _20[1];
|
|
688
|
+
var _21 = (0, react_2.useState)(""), newColumnButtonConfirm = _21[0], setNewColumnButtonConfirm = _21[1];
|
|
689
|
+
var _22 = (0, react_2.useState)(false), addingColumn = _22[0], setAddingColumn = _22[1];
|
|
690
|
+
var _23 = (0, react_2.useState)(false), confirmDeleteColumn = _23[0], setConfirmDeleteColumn = _23[1];
|
|
689
691
|
// INFO: the formula as shown in the builder — column names, not ids
|
|
690
|
-
var
|
|
692
|
+
var _24 = (0, react_2.useState)(""), newColumnFormula = _24[0], setNewColumnFormula = _24[1];
|
|
691
693
|
var addColumnPopUpRef = (0, react_2.useRef)(null);
|
|
692
694
|
// INFO: the column being changed — empty while the panel adds a new one
|
|
693
|
-
var
|
|
695
|
+
var _25 = (0, react_2.useState)(null), editingColumn = _25[0], setEditingColumn = _25[1];
|
|
694
696
|
//=====================================================================================
|
|
695
697
|
// SECTION: Editable & Addable cells
|
|
696
698
|
//=====================================================================================
|
|
697
|
-
var
|
|
698
|
-
var
|
|
699
|
+
var _26 = (0, react_2.useState)(""), editDataRowId = _26[0], setEditDataRowId = _26[1];
|
|
700
|
+
var _27 = (0, react_2.useState)(""), editDataHeaderKey = _27[0], setEditDataHeaderKey = _27[1];
|
|
699
701
|
// INFO: an editable table used to mount an input in every cell — it read as a
|
|
700
702
|
// form, and a row click always landed on a child input. Only the hovered cell
|
|
701
703
|
// becomes its input now; NewTableHoverCell keeps that hover to itself.
|
|
@@ -704,13 +706,13 @@ var NewTable = function (rawProps) {
|
|
|
704
706
|
var pendingFocusRef = (0, react_2.useRef)("");
|
|
705
707
|
// INFO: the cell a gridLines="all" multiple list is being picked in — its
|
|
706
708
|
// popover hangs from this element
|
|
707
|
-
var
|
|
708
|
-
var
|
|
709
|
+
var _28 = (0, react_2.useState)(null), labelPickerAnchor = _28[0], setLabelPickerAnchor = _28[1];
|
|
710
|
+
var _29 = (0, react_2.useState)(false), modalEditVisible = _29[0], setModalEditVisible = _29[1];
|
|
709
711
|
// INFO: whether the modal's signature pad has been drawn on
|
|
710
|
-
var
|
|
711
|
-
var
|
|
712
|
+
var _30 = (0, react_2.useState)(false), signatureSigning = _30[0], setSignatureSigning = _30[1];
|
|
713
|
+
var _31 = (0, react_2.useState)([]), collapsedGroupIds = _31[0], setCollapsedGroupIds = _31[1];
|
|
712
714
|
// INFO: rows shown per section when the sections do not page themselves
|
|
713
|
-
var
|
|
715
|
+
var _32 = (0, react_2.useState)({}), groupVisibleCounts = _32[0], setGroupVisibleCounts = _32[1];
|
|
714
716
|
// INFO: per-group scroll pagination. One sentinel element per band, observed
|
|
715
717
|
// by a single IntersectionObserver that fires props.onGroupLoadMore when a
|
|
716
718
|
// band's sentinel scrolls into view. The debounce guard stops repeat fires
|
|
@@ -728,36 +730,36 @@ var NewTable = function (rawProps) {
|
|
|
728
730
|
var lastSelectedRowRef = (0, react_2.useRef)(null);
|
|
729
731
|
var dragSelectRef = (0, react_2.useRef)(null);
|
|
730
732
|
var suppressNextClickRef = (0, react_2.useRef)(false);
|
|
731
|
-
var
|
|
732
|
-
var
|
|
733
|
-
var
|
|
734
|
-
var
|
|
733
|
+
var _33 = (0, react_2.useState)(false), isDragSelecting = _33[0], setIsDragSelecting = _33[1];
|
|
734
|
+
var _34 = (0, react_2.useState)(0), copiedCount = _34[0], setCopiedCount = _34[1];
|
|
735
|
+
var _35 = (0, react_2.useState)({}), editDataValue = _35[0], setEditDataValue = _35[1];
|
|
736
|
+
var _36 = (0, react_2.useState)(false), editDataIsLoading = _36[0], setEditDataIsLoading = _36[1];
|
|
735
737
|
// INFO: true while the empty bottom row is being filled in; the row itself is
|
|
736
738
|
// always there in an addable table
|
|
737
|
-
var
|
|
739
|
+
var _37 = (0, react_2.useState)(false), addData = _37[0], setAddData = _37[1];
|
|
738
740
|
var isAddRowPinned = props.paginationType === "scroll";
|
|
739
|
-
var
|
|
741
|
+
var _38 = (0, react_2.useState)({}), addDataValue = _38[0], setAddDataValue = _38[1];
|
|
740
742
|
// INFO: bumped after each saved row, so the next one starts with fresh
|
|
741
743
|
// inputs and its first cell takes the focus
|
|
742
|
-
var
|
|
744
|
+
var _39 = (0, react_2.useState)(0), addRowKey = _39[0], setAddRowKey = _39[1];
|
|
743
745
|
// INFO: the add row's coloured multiple list being picked under
|
|
744
746
|
// gridLines="all" — its label picker hangs from this cell
|
|
745
747
|
// INFO: the new row's required tag columns left empty on a save — their
|
|
746
748
|
// cells are ringed red until a label is picked
|
|
747
|
-
var
|
|
748
|
-
var
|
|
749
|
+
var _40 = (0, react_2.useState)([]), addTagErrors = _40[0], setAddTagErrors = _40[1];
|
|
750
|
+
var _41 = (0, react_2.useState)(null), addLabelPicker = _41[0], setAddLabelPicker = _41[1];
|
|
749
751
|
// INFO: the group whose own add row is being filled in; "" = the bottom row
|
|
750
|
-
var
|
|
752
|
+
var _42 = (0, react_2.useState)(""), addGroupId = _42[0], setAddGroupId = _42[1];
|
|
751
753
|
// INFO: the row armed by a press on its handle, so only the handle — never
|
|
752
754
|
// a click or a text selection in a cell — starts a drag
|
|
753
|
-
var
|
|
754
|
-
var
|
|
755
|
-
var
|
|
756
|
-
var
|
|
755
|
+
var _43 = (0, react_2.useState)(""), dragArmedRowId = _43[0], setDragArmedRowId = _43[1];
|
|
756
|
+
var _44 = (0, react_2.useState)(""), draggingRowId = _44[0], setDraggingRowId = _44[1];
|
|
757
|
+
var _45 = (0, react_2.useState)(""), dropGroupId = _45[0], setDropGroupId = _45[1];
|
|
758
|
+
var _46 = (0, react_2.useState)({}), referencesOptions = _46[0], setReferencesOptions = _46[1];
|
|
757
759
|
// INFO: seeded options sit under the local map so a cell's own search
|
|
758
760
|
// results still win per key
|
|
759
761
|
var mergedReferencesOptions = __assign(__assign({}, ((_h = props.referencesOptions) !== null && _h !== void 0 ? _h : {})), referencesOptions);
|
|
760
|
-
var
|
|
762
|
+
var _47 = (0, react_2.useState)({}), referencesDetails = _47[0], setReferencesDetails = _47[1];
|
|
761
763
|
// INFO: per column, the records a search found and the records the parent
|
|
762
764
|
// passes in, matched by id — a search copies the parent's records into the
|
|
763
765
|
// local map, so the parent's copy wins and a reload of the list reaches the
|
|
@@ -767,13 +769,13 @@ var NewTable = function (rawProps) {
|
|
|
767
769
|
var mergedReferencesDetails = (0, react_2.useMemo)(function () {
|
|
768
770
|
return handleMergeReferencesDetails(referencesDetails, props.referencesDetails);
|
|
769
771
|
}, [referencesDetails, props.referencesDetails]);
|
|
770
|
-
var
|
|
772
|
+
var _48 = (0, react_2.useState)(false), referenceLoading = _48[0], setReferenceLoading = _48[1];
|
|
771
773
|
// INFO: measured pixel widths for pinned columns without an explicit width.
|
|
772
|
-
var
|
|
774
|
+
var _49 = (0, react_2.useState)({}), measuredPinWidths = _49[0], setMeasuredPinWidths = _49[1];
|
|
773
775
|
// INFO: the scrolling view's width, which caps how much the left pins take
|
|
774
|
-
var
|
|
776
|
+
var _50 = (0, react_2.useState)(0), pinViewWidth = _50[0], setPinViewWidth = _50[1];
|
|
775
777
|
// INFO: per large group, the rows [start, end) drawn; the rest are spacers
|
|
776
|
-
var
|
|
778
|
+
var _51 = (0, react_2.useState)({}), virtualRanges = _51[0], setVirtualRanges = _51[1];
|
|
777
779
|
// INFO: each drawn row's measured height, kept so a spacer is as tall as the
|
|
778
780
|
// rows it stands in for
|
|
779
781
|
var rowHeightsRef = (0, react_2.useRef)(new Map());
|
|
@@ -781,10 +783,28 @@ var NewTable = function (rawProps) {
|
|
|
781
783
|
var virtualGroupsRef = (0, react_2.useRef)([]);
|
|
782
784
|
var virtualFrameRef = (0, react_2.useRef)(0);
|
|
783
785
|
var rowEstimateRef = (0, react_2.useRef)(rowRendering_1.VIRTUAL_DEFAULT_ROW_HEIGHT);
|
|
786
|
+
// INFO: on a wide table, where the scroller shows the unpinned columns —
|
|
787
|
+
// its left edge as an offset from the first of them, and its width. Set only
|
|
788
|
+
// when the drawn columns no longer cover it, so scrolling inside them draws
|
|
789
|
+
// nothing
|
|
790
|
+
var _52 = (0, react_2.useState)(null), columnView = _52[0], setColumnView = _52[1];
|
|
791
|
+
// INFO: each drawn unpinned column's measured width, so a spacer is as wide
|
|
792
|
+
// as the columns it stands in for
|
|
793
|
+
var columnWidthsMeasuredRef = (0, react_2.useRef)({});
|
|
794
|
+
var columnFrameRef = (0, react_2.useRef)(0);
|
|
795
|
+
// INFO: set each draw — the scroll listener is set up once and reads these
|
|
796
|
+
var isColumnVirtualRef = (0, react_2.useRef)(false);
|
|
797
|
+
var columnWindowForRef = (0, react_2.useRef)(function () { return null; });
|
|
784
798
|
var tableVersionRef = (0, react_2.useRef)({
|
|
785
799
|
key: "",
|
|
786
800
|
version: 0,
|
|
787
801
|
});
|
|
802
|
+
// INFO: the table version without the column window — a body cell compares
|
|
803
|
+
// it, so moving the window redraws rows but not the cells they keep
|
|
804
|
+
var cellVersionRef = (0, react_2.useRef)({
|
|
805
|
+
key: "",
|
|
806
|
+
version: 0,
|
|
807
|
+
});
|
|
788
808
|
var editDataValueRef = (0, react_2.useRef)({});
|
|
789
809
|
// INFO: the check a cell's blur is running — under gridLines="all" the next
|
|
790
810
|
// cell opens only once it is done, while the field it checks still exists
|
|
@@ -848,6 +868,36 @@ var NewTable = function (rawProps) {
|
|
|
848
868
|
handleUpdateVirtualRanges();
|
|
849
869
|
});
|
|
850
870
|
};
|
|
871
|
+
// INFO: which unpinned columns a wide table draws, from where its scroller
|
|
872
|
+
// sits. The pinned columns before them may stick over its left edge or
|
|
873
|
+
// scroll away, so the view is widened by their width to cover either case
|
|
874
|
+
var handleUpdateColumnWindow = function () {
|
|
875
|
+
var table = tableRef.current;
|
|
876
|
+
if (!table || !isColumnVirtualRef.current)
|
|
877
|
+
return;
|
|
878
|
+
var scroller = table.parentElement;
|
|
879
|
+
var spacer = table.querySelector('thead th[data-column-spacer="before"]');
|
|
880
|
+
if (!scroller || !spacer)
|
|
881
|
+
return;
|
|
882
|
+
var next = {
|
|
883
|
+
start: scroller.scrollLeft - spacer.offsetLeft,
|
|
884
|
+
width: scroller.clientWidth + spacer.offsetLeft,
|
|
885
|
+
};
|
|
886
|
+
setColumnView(function (previous) {
|
|
887
|
+
if (!previous)
|
|
888
|
+
return next;
|
|
889
|
+
var drawn = columnWindowForRef.current(previous);
|
|
890
|
+
return drawn && (0, columnWindow_1.handleIsViewCovered)(drawn, next) ? previous : next;
|
|
891
|
+
});
|
|
892
|
+
};
|
|
893
|
+
var handleScheduleColumnWindow = function () {
|
|
894
|
+
if (columnFrameRef.current)
|
|
895
|
+
return;
|
|
896
|
+
columnFrameRef.current = requestAnimationFrame(function () {
|
|
897
|
+
columnFrameRef.current = 0;
|
|
898
|
+
handleUpdateColumnWindow();
|
|
899
|
+
});
|
|
900
|
+
};
|
|
851
901
|
// INFO: after each draw, the drawn rows of large groups are measured, so the
|
|
852
902
|
// spacers match them, and the ranges are checked against the new layout
|
|
853
903
|
(0, react_2.useLayoutEffect)(function () {
|
|
@@ -872,20 +922,44 @@ var NewTable = function (rawProps) {
|
|
|
872
922
|
}
|
|
873
923
|
handleScheduleVirtualRanges();
|
|
874
924
|
});
|
|
925
|
+
// INFO: after each draw of a wide table, its drawn columns are measured, so
|
|
926
|
+
// the spacers match them, and the window is checked against the new layout
|
|
927
|
+
(0, react_2.useLayoutEffect)(function () {
|
|
928
|
+
if (!isColumnVirtualRef.current)
|
|
929
|
+
return;
|
|
930
|
+
var table = tableRef.current;
|
|
931
|
+
if (!table)
|
|
932
|
+
return;
|
|
933
|
+
table
|
|
934
|
+
.querySelectorAll("thead th[data-column-key]")
|
|
935
|
+
.forEach(function (element) {
|
|
936
|
+
var key = element.getAttribute("data-column-key");
|
|
937
|
+
var width = element.getBoundingClientRect().width;
|
|
938
|
+
if (key && width > 0)
|
|
939
|
+
columnWidthsMeasuredRef.current[key] = width;
|
|
940
|
+
});
|
|
941
|
+
handleScheduleColumnWindow();
|
|
942
|
+
});
|
|
875
943
|
// INFO: capture catches the scroll of whichever element scrolls the table
|
|
876
944
|
(0, react_2.useEffect)(function () {
|
|
877
|
-
|
|
945
|
+
var handleScroll = function () {
|
|
946
|
+
handleScheduleVirtualRanges();
|
|
947
|
+
handleScheduleColumnWindow();
|
|
948
|
+
};
|
|
949
|
+
window.addEventListener("scroll", handleScroll, {
|
|
878
950
|
capture: true,
|
|
879
951
|
passive: true,
|
|
880
952
|
});
|
|
881
|
-
window.addEventListener("resize",
|
|
953
|
+
window.addEventListener("resize", handleScroll);
|
|
882
954
|
return function () {
|
|
883
|
-
window.removeEventListener("scroll",
|
|
955
|
+
window.removeEventListener("scroll", handleScroll, {
|
|
884
956
|
capture: true,
|
|
885
957
|
});
|
|
886
|
-
window.removeEventListener("resize",
|
|
958
|
+
window.removeEventListener("resize", handleScroll);
|
|
887
959
|
if (virtualFrameRef.current)
|
|
888
960
|
cancelAnimationFrame(virtualFrameRef.current);
|
|
961
|
+
if (columnFrameRef.current)
|
|
962
|
+
cancelAnimationFrame(columnFrameRef.current);
|
|
889
963
|
};
|
|
890
964
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
891
965
|
}, []);
|
|
@@ -1719,13 +1793,17 @@ var NewTable = function (rawProps) {
|
|
|
1719
1793
|
// it stays here until the table unmounts. Tailwind cannot emit a runtime
|
|
1720
1794
|
// w-[Npx], so a width drives an inline style and wins over the col.width
|
|
1721
1795
|
// class.
|
|
1722
|
-
var
|
|
1796
|
+
var _53 = (0, react_2.useState)({}), columnWidths = _53[0], setColumnWidths = _53[1];
|
|
1797
|
+
// INFO: caps measured for content-sized columns — see handleMeasureCaps
|
|
1798
|
+
var _54 = (0, react_2.useState)({}), cappedWidths = _54[0], setCappedWidths = _54[1];
|
|
1723
1799
|
var resizeRef = (0, react_2.useRef)(null);
|
|
1724
1800
|
// INFO: a dragged width first, else the column's own fixed width in pixels
|
|
1725
1801
|
// whatever form it is stored in ("180px", "w-[180px]", "w-48")
|
|
1726
1802
|
var getColumnWidth = function (key) {
|
|
1727
1803
|
var col = flatColumns.find(function (eachCol) { return eachCol.key === key; });
|
|
1728
|
-
var width = columnWidths[key] ||
|
|
1804
|
+
var width = columnWidths[key] ||
|
|
1805
|
+
(0, columnWidth_1.handleParseColumnWidth)(col === null || col === void 0 ? void 0 : col.width) ||
|
|
1806
|
+
cappedWidths[key];
|
|
1729
1807
|
// INFO: a title carrying its row's actions never narrows past its floor,
|
|
1730
1808
|
// even from a width saved before the actions took their room
|
|
1731
1809
|
var titleMin = getTitleMinWidth(key);
|
|
@@ -1752,6 +1830,126 @@ var NewTable = function (rawProps) {
|
|
|
1752
1830
|
? MIN_COLUMN_WIDTH
|
|
1753
1831
|
: Math.min(MIN_COLUMN_WIDTH, configured);
|
|
1754
1832
|
};
|
|
1833
|
+
// INFO: determines whether any column uses groupData — if so, a two-row
|
|
1834
|
+
// thead with colSpan/rowSpan is rendered for proper visual grouping.
|
|
1835
|
+
var hasGroupHeaders = columns.some(function (col) {
|
|
1836
|
+
return !col.hide &&
|
|
1837
|
+
col.groupData &&
|
|
1838
|
+
col.groupData.length > 0;
|
|
1839
|
+
});
|
|
1840
|
+
//=====================================================================================
|
|
1841
|
+
// SECTION: Column window
|
|
1842
|
+
//=====================================================================================
|
|
1843
|
+
// INFO: pinned columns come first and last in flatColumns, so the unpinned
|
|
1844
|
+
// ones are the run [middleStart, middleEnd)
|
|
1845
|
+
var middleStart = flatColumns.filter(function (col) {
|
|
1846
|
+
return leftPinned.includes(col.key);
|
|
1847
|
+
}).length;
|
|
1848
|
+
var middleEnd = flatColumns.length -
|
|
1849
|
+
flatColumns.filter(function (col) { return rightPinned.includes(col.key); }).length;
|
|
1850
|
+
// INFO: a row being added is typed across every column, and a two-row
|
|
1851
|
+
// header spans groups of columns, so either draws all of them
|
|
1852
|
+
var isColumnVirtual = !props.mobileView &&
|
|
1853
|
+
!hasGroupHeaders &&
|
|
1854
|
+
!addData &&
|
|
1855
|
+
middleEnd - middleStart >= columnWindow_1.COLUMN_VIRTUAL_MIN;
|
|
1856
|
+
// INFO: a column not drawn yet is assumed as wide as the average of those
|
|
1857
|
+
// measured, so the scroller's width barely moves as each one is drawn
|
|
1858
|
+
var handleGetMiddleWidths = function () {
|
|
1859
|
+
var measured = Object.values(columnWidthsMeasuredRef.current);
|
|
1860
|
+
var estimate = measured.length
|
|
1861
|
+
? measured.reduce(function (total, width) { return total + width; }, 0) / measured.length
|
|
1862
|
+
: columnWindow_1.COLUMN_VIRTUAL_ESTIMATE_PX;
|
|
1863
|
+
return flatColumns
|
|
1864
|
+
.slice(middleStart, middleEnd)
|
|
1865
|
+
.map(function (col) {
|
|
1866
|
+
var _a, _b;
|
|
1867
|
+
return (_b = (_a = getColumnWidth(col.key)) !== null && _a !== void 0 ? _a : columnWidthsMeasuredRef.current[col.key]) !== null && _b !== void 0 ? _b : estimate;
|
|
1868
|
+
});
|
|
1869
|
+
};
|
|
1870
|
+
var handleGetColumnWindowFor = function (view) {
|
|
1871
|
+
if (!isColumnVirtual)
|
|
1872
|
+
return null;
|
|
1873
|
+
var editIndex = flatColumns.findIndex(function (col) { return col.key === editDataHeaderKey; }) -
|
|
1874
|
+
middleStart;
|
|
1875
|
+
return (0, columnWindow_1.handleGetColumnWindow)({
|
|
1876
|
+
widths: handleGetMiddleWidths(),
|
|
1877
|
+
viewStart: view.start,
|
|
1878
|
+
viewWidth: view.width,
|
|
1879
|
+
keepIndex: editDataHeaderKey &&
|
|
1880
|
+
editIndex >= 0 &&
|
|
1881
|
+
editIndex < middleEnd - middleStart
|
|
1882
|
+
? editIndex
|
|
1883
|
+
: undefined,
|
|
1884
|
+
});
|
|
1885
|
+
};
|
|
1886
|
+
isColumnVirtualRef.current = isColumnVirtual;
|
|
1887
|
+
columnWindowForRef.current = handleGetColumnWindowFor;
|
|
1888
|
+
// INFO: before the scroller is measured, the window assumes it starts at the
|
|
1889
|
+
// first unpinned column and is as wide as the screen
|
|
1890
|
+
var drawnColumnWindow = handleGetColumnWindowFor(columnView !== null && columnView !== void 0 ? columnView : {
|
|
1891
|
+
start: 0,
|
|
1892
|
+
width: typeof window === "undefined" ? 1280 : window.innerWidth,
|
|
1893
|
+
});
|
|
1894
|
+
// INFO: a column drawn as the window moves is read for its cap like those
|
|
1895
|
+
// drawn at first, so a long value scrolled into view is capped too
|
|
1896
|
+
(0, react_2.useLayoutEffect)(function () {
|
|
1897
|
+
if (drawnColumnWindow)
|
|
1898
|
+
setCapCheck(function (previous) { return previous + 1; });
|
|
1899
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1900
|
+
}, [drawnColumnWindow === null || drawnColumnWindow === void 0 ? void 0 : drawnColumnWindow.start, drawnColumnWindow === null || drawnColumnWindow === void 0 ? void 0 : drawnColumnWindow.end]);
|
|
1901
|
+
var handleIsColumnDrawn = function (colIndex) {
|
|
1902
|
+
return !drawnColumnWindow ||
|
|
1903
|
+
colIndex < middleStart ||
|
|
1904
|
+
colIndex >= middleEnd ||
|
|
1905
|
+
(colIndex - middleStart >= drawnColumnWindow.start &&
|
|
1906
|
+
colIndex - middleStart < drawnColumnWindow.end);
|
|
1907
|
+
};
|
|
1908
|
+
/**
|
|
1909
|
+
* The cells a row draws for its columns — on a wide table a spacer on each
|
|
1910
|
+
* side stands in for the columns skipped. colIndex stays the column's place
|
|
1911
|
+
* in flatColumns, which the per-column refs are indexed by.
|
|
1912
|
+
*
|
|
1913
|
+
* @options.wrapCell - wraps each drawn cell, as a body row does to keep a cell it
|
|
1914
|
+
* already drew when the window moves
|
|
1915
|
+
*/
|
|
1916
|
+
var handleMapDrawnColumns = function (options, renderCell) {
|
|
1917
|
+
var _a = options.tag, tag = _a === void 0 ? "td" : _a, wrapCell = options.wrapCell;
|
|
1918
|
+
var cells = [];
|
|
1919
|
+
// INFO: the header's spacer sets the skipped columns' width; a row's
|
|
1920
|
+
// spacer only fills that column, so a row need not redraw when the widths
|
|
1921
|
+
// it stands in for are measured or capped
|
|
1922
|
+
var renderSpacer = function (side, width) {
|
|
1923
|
+
var spacerProps = {
|
|
1924
|
+
key: "column-spacer-".concat(side),
|
|
1925
|
+
"data-column-spacer": side,
|
|
1926
|
+
"aria-hidden": true,
|
|
1927
|
+
style: tag === "th"
|
|
1928
|
+
? { width: width, minWidth: width, maxWidth: width, padding: 0, border: 0 }
|
|
1929
|
+
: { padding: 0, border: 0 },
|
|
1930
|
+
};
|
|
1931
|
+
return tag === "th" ? react_2.default.createElement("th", __assign({}, spacerProps)) : react_2.default.createElement("td", __assign({}, spacerProps));
|
|
1932
|
+
};
|
|
1933
|
+
flatColumns.forEach(function (col, colIndex) {
|
|
1934
|
+
if (drawnColumnWindow && colIndex === middleStart)
|
|
1935
|
+
cells.push(renderSpacer("before", drawnColumnWindow.before));
|
|
1936
|
+
if (handleIsColumnDrawn(colIndex))
|
|
1937
|
+
cells.push(wrapCell
|
|
1938
|
+
? wrapCell(col, colIndex, function () { return renderCell(col, colIndex); })
|
|
1939
|
+
: renderCell(col, colIndex));
|
|
1940
|
+
if (drawnColumnWindow && colIndex === middleEnd - 1)
|
|
1941
|
+
cells.push(renderSpacer("after", drawnColumnWindow.after));
|
|
1942
|
+
});
|
|
1943
|
+
return cells;
|
|
1944
|
+
};
|
|
1945
|
+
// INFO: the cells a row draws for its columns, spacers included — a band
|
|
1946
|
+
// spanning the row counts the same
|
|
1947
|
+
var drawnColumnCount = drawnColumnWindow
|
|
1948
|
+
? flatColumns.length -
|
|
1949
|
+
(middleEnd - middleStart) +
|
|
1950
|
+
(drawnColumnWindow.end - drawnColumnWindow.start) +
|
|
1951
|
+
2
|
|
1952
|
+
: flatColumns.length;
|
|
1755
1953
|
var handleResizeStart = function (event, key) {
|
|
1756
1954
|
var _a, _b, _c, _d, _e;
|
|
1757
1955
|
event.preventDefault();
|
|
@@ -1761,11 +1959,20 @@ var NewTable = function (rawProps) {
|
|
|
1761
1959
|
resizeRef.current = { key: key, startX: event.clientX, startWidth: startWidth };
|
|
1762
1960
|
(_e = (_d = event.currentTarget).setPointerCapture) === null || _e === void 0 ? void 0 : _e.call(_d, event.pointerId);
|
|
1763
1961
|
};
|
|
1962
|
+
// INFO: the widest a drag may take a column. One already wider (its content
|
|
1963
|
+
// or a configured width made it so) keeps its width as the ceiling, so
|
|
1964
|
+
// grabbing it never snaps it narrower — it can only be dragged in. Never
|
|
1965
|
+
// below the floor, so a contact or title column is still draggable.
|
|
1966
|
+
var getColumnMaxWidth = function (key, startWidth) {
|
|
1967
|
+
var _a;
|
|
1968
|
+
var cap = (0, columnWidth_1.handleGetColumnWidthCap)(key === ((_a = flatColumns[0]) === null || _a === void 0 ? void 0 : _a.key), props.advSettings);
|
|
1969
|
+
return Math.max(cap, Math.round(startWidth), getColumnMinWidth(key));
|
|
1970
|
+
};
|
|
1764
1971
|
var handleResizeMove = function (event) {
|
|
1765
1972
|
var resizing = resizeRef.current;
|
|
1766
1973
|
if (!resizing)
|
|
1767
1974
|
return;
|
|
1768
|
-
var next = Math.max(getColumnMinWidth(resizing.key), resizing.startWidth + (event.clientX - resizing.startX));
|
|
1975
|
+
var next = Math.min(getColumnMaxWidth(resizing.key, resizing.startWidth), Math.max(getColumnMinWidth(resizing.key), resizing.startWidth + (event.clientX - resizing.startX)));
|
|
1769
1976
|
setColumnWidths(function (previous) {
|
|
1770
1977
|
var _a;
|
|
1771
1978
|
return (__assign(__assign({}, previous), (_a = {}, _a[resizing.key] = next, _a)));
|
|
@@ -1789,6 +1996,100 @@ var NewTable = function (rawProps) {
|
|
|
1789
1996
|
return rest;
|
|
1790
1997
|
});
|
|
1791
1998
|
};
|
|
1999
|
+
// INFO: a column sized by its content (no configured or dragged width) that
|
|
2000
|
+
// comes out wider than its cap is held at the cap, the same as a fixed
|
|
2001
|
+
// width, so its title and values are cut off with an ellipsis instead of
|
|
2002
|
+
// stretching it. disableEllipsisOnLongWord asks for whole values, so then
|
|
2003
|
+
// content sizes the column as before. Not under grouped headers, which draw
|
|
2004
|
+
// without fixed widths.
|
|
2005
|
+
var _55 = (0, react_2.useState)(0), capCheck = _55[0], setCapCheck = _55[1];
|
|
2006
|
+
var capsKey = [
|
|
2007
|
+
(_o = props.advSettings) === null || _o === void 0 ? void 0 : _o.maxFirstColumnWidth,
|
|
2008
|
+
(_p = props.advSettings) === null || _p === void 0 ? void 0 : _p.maxColumnWidth,
|
|
2009
|
+
props.disableEllipsisOnLongWord,
|
|
2010
|
+
flatColumns.map(function (col) { var _a; return "".concat(col.key, ":").concat((_a = col.width) !== null && _a !== void 0 ? _a : ""); }).join(","),
|
|
2011
|
+
].join("|");
|
|
2012
|
+
// INFO: only adds caps — a column already capped is at its widest. Run on
|
|
2013
|
+
// every resize too, since a value resolved later (a reference's name, say)
|
|
2014
|
+
// can widen a column after the rows arrive.
|
|
2015
|
+
var handleMeasureCaps = function () {
|
|
2016
|
+
var table = tableRef.current;
|
|
2017
|
+
if (!table || props.disableEllipsisOnLongWord)
|
|
2018
|
+
return;
|
|
2019
|
+
var hasGroupedHeaders = columns.some(function (col) { var _a, _b; return !col.hide && ((_b = (_a = col.groupData) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0; });
|
|
2020
|
+
if (hasGroupedHeaders)
|
|
2021
|
+
return;
|
|
2022
|
+
var headers = {};
|
|
2023
|
+
table
|
|
2024
|
+
.querySelectorAll("thead th[data-column-key]")
|
|
2025
|
+
.forEach(function (th) {
|
|
2026
|
+
if (th.dataset.columnKey)
|
|
2027
|
+
headers[th.dataset.columnKey] = th;
|
|
2028
|
+
});
|
|
2029
|
+
// INFO: only columns sized by their content and not yet capped — when
|
|
2030
|
+
// every column is set, dragged or capped there is nothing to read
|
|
2031
|
+
var pending = flatColumns
|
|
2032
|
+
.map(function (col, index) { return ({ col: col, index: index, th: headers[col.key] }); })
|
|
2033
|
+
.filter(function (_a) {
|
|
2034
|
+
var col = _a.col, th = _a.th;
|
|
2035
|
+
return !!th &&
|
|
2036
|
+
!columnWidths[col.key] &&
|
|
2037
|
+
!(0, columnWidth_1.handleParseColumnWidth)(col.width) &&
|
|
2038
|
+
!cappedWidths[col.key];
|
|
2039
|
+
});
|
|
2040
|
+
if (pending.length === 0)
|
|
2041
|
+
return;
|
|
2042
|
+
// INFO: a table narrower than its view is stretched to fill it, which
|
|
2043
|
+
// widens every column past what its content needs — a short table on a
|
|
2044
|
+
// wide screen would then be capped everywhere and stay that wide when the
|
|
2045
|
+
// window narrows. Such a table is drawn at its content's width for the
|
|
2046
|
+
// read, then put back, all before paint. A table already wider than its
|
|
2047
|
+
// view is drawn at its content's width, so it is read as it is, without
|
|
2048
|
+
// laying out a large table twice.
|
|
2049
|
+
var view = table.parentElement;
|
|
2050
|
+
var isStretched = !view || table.getBoundingClientRect().width <= view.clientWidth + 1;
|
|
2051
|
+
var previousWidth = table.style.width;
|
|
2052
|
+
var previousMinWidth = table.style.minWidth;
|
|
2053
|
+
if (isStretched) {
|
|
2054
|
+
table.style.width = "max-content";
|
|
2055
|
+
table.style.minWidth = "0";
|
|
2056
|
+
}
|
|
2057
|
+
var next = {};
|
|
2058
|
+
pending.forEach(function (_a) {
|
|
2059
|
+
var col = _a.col, index = _a.index, th = _a.th;
|
|
2060
|
+
var cap = Math.max((0, columnWidth_1.handleGetColumnWidthCap)(index === 0, props.advSettings), getColumnMinWidth(col.key));
|
|
2061
|
+
if (th.getBoundingClientRect().width > cap + 1)
|
|
2062
|
+
next[col.key] = cap;
|
|
2063
|
+
});
|
|
2064
|
+
if (isStretched) {
|
|
2065
|
+
table.style.width = previousWidth;
|
|
2066
|
+
table.style.minWidth = previousMinWidth;
|
|
2067
|
+
}
|
|
2068
|
+
if (Object.keys(next).length > 0)
|
|
2069
|
+
setCappedWidths(function (previous) { return (__assign(__assign({}, previous), next)); });
|
|
2070
|
+
};
|
|
2071
|
+
// INFO: new rows, columns or caps let every column size itself again, then
|
|
2072
|
+
// measure — both before paint, so a column never shows stretched
|
|
2073
|
+
(0, react_2.useLayoutEffect)(function () {
|
|
2074
|
+
setCappedWidths(function (previous) {
|
|
2075
|
+
return Object.keys(previous).length > 0 ? {} : previous;
|
|
2076
|
+
});
|
|
2077
|
+
setCapCheck(function (previous) { return previous + 1; });
|
|
2078
|
+
}, [props.data, capsKey]);
|
|
2079
|
+
(0, react_2.useLayoutEffect)(function () {
|
|
2080
|
+
handleMeasureCaps();
|
|
2081
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2082
|
+
}, [capCheck]);
|
|
2083
|
+
var measureCapsRef = (0, react_2.useRef)(handleMeasureCaps);
|
|
2084
|
+
measureCapsRef.current = handleMeasureCaps;
|
|
2085
|
+
(0, react_2.useEffect)(function () {
|
|
2086
|
+
var table = tableRef.current;
|
|
2087
|
+
if (!table || typeof ResizeObserver === "undefined")
|
|
2088
|
+
return;
|
|
2089
|
+
var observer = new ResizeObserver(function () { return measureCapsRef.current(); });
|
|
2090
|
+
observer.observe(table);
|
|
2091
|
+
return function () { return observer.disconnect(); };
|
|
2092
|
+
}, []);
|
|
1792
2093
|
var handleDragStart = function (e, id) {
|
|
1793
2094
|
e.dataTransfer.setData("itemId", id);
|
|
1794
2095
|
};
|
|
@@ -1860,10 +2161,7 @@ var NewTable = function (rawProps) {
|
|
|
1860
2161
|
};
|
|
1861
2162
|
var handleSort = function (id, type) {
|
|
1862
2163
|
var _a, _b;
|
|
1863
|
-
(_b = (_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.onSortColumn) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
1864
|
-
sortId: id,
|
|
1865
|
-
type: type === "new" ? "asc" : type,
|
|
1866
|
-
});
|
|
2164
|
+
(_b = (_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.onSortColumn) === null || _b === void 0 ? void 0 : _b.call(_a, { sortId: id, type: type });
|
|
1867
2165
|
};
|
|
1868
2166
|
var renderAddColumnPanel = function () {
|
|
1869
2167
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
@@ -2625,7 +2923,7 @@ var NewTable = function (rawProps) {
|
|
|
2625
2923
|
return Math.max(width, (_b = getTitleMinWidth(key)) !== null && _b !== void 0 ? _b : 0);
|
|
2626
2924
|
};
|
|
2627
2925
|
var pinCheckboxOffset = props.checkbox &&
|
|
2628
|
-
(props.data.length > 0 || (props.spaceData && ((
|
|
2926
|
+
(props.data.length > 0 || (props.spaceData && ((_q = props.spaceData) === null || _q === void 0 ? void 0 : _q.length) > 0))
|
|
2629
2927
|
? CHECKBOX_WIDTH
|
|
2630
2928
|
: 0;
|
|
2631
2929
|
/**
|
|
@@ -2865,7 +3163,7 @@ var NewTable = function (rawProps) {
|
|
|
2865
3163
|
var handleIsCellEditing = function (rowId, colKey) {
|
|
2866
3164
|
return editDataRowId === rowId && editDataHeaderKey === colKey;
|
|
2867
3165
|
};
|
|
2868
|
-
var renderReadCellValue = function (col, row, cellValue) {
|
|
3166
|
+
var renderReadCellValue = function (col, row, cellValue, noRowLink) {
|
|
2869
3167
|
var _a;
|
|
2870
3168
|
// INFO: under gridLines="all" a list of names (a list of references)
|
|
2871
3169
|
// reads "A, B", as a multiple list's picks do — the read module joins an
|
|
@@ -2885,7 +3183,7 @@ var NewTable = function (rawProps) {
|
|
|
2885
3183
|
.join(", ")
|
|
2886
3184
|
: undefined;
|
|
2887
3185
|
var value = (0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, roleLabels !== null && roleLabels !== void 0 ? roleLabels : (isNameList ? cellValue.join(", ") : cellValue), props.bareSettings, true, props.disableEllipsisOnLongWord);
|
|
2888
|
-
if (!props.newTabUrl || !props.onClickRow)
|
|
3186
|
+
if (noRowLink || !props.newTabUrl || !props.onClickRow)
|
|
2889
3187
|
return value;
|
|
2890
3188
|
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));
|
|
2891
3189
|
};
|
|
@@ -3116,7 +3414,7 @@ var NewTable = function (rawProps) {
|
|
|
3116
3414
|
};
|
|
3117
3415
|
// INFO: worked out here, after the Actions and "+" helpers it reads, and
|
|
3118
3416
|
// only read by the render helpers called from the return below
|
|
3119
|
-
var
|
|
3417
|
+
var _56 = handleFitPins(), fittedLeftPins = _56.widths, narrowPins = _56.narrow;
|
|
3120
3418
|
var renderActionColumnHeader = function () {
|
|
3121
3419
|
if (handleShowsActionColumn()) {
|
|
3122
3420
|
var pin = handleGetActionCellPin(true);
|
|
@@ -3256,7 +3554,7 @@ var NewTable = function (rawProps) {
|
|
|
3256
3554
|
return null;
|
|
3257
3555
|
return (react_2.default.createElement("tr", { "data-testid": "table-add-row", className: "group cursor-text ".concat(props.darkMode ? "hover:bg-gray-800" : "hover:bg-gray-50") },
|
|
3258
3556
|
props.checkbox && react_2.default.createElement("td", { className: "w-10 ".concat(cellPadding) }),
|
|
3259
|
-
|
|
3557
|
+
handleMapDrawnColumns({}, function (col, index) { return (react_2.default.createElement("td", { key: col.key, "data-add-cell": col.key, className: "".concat(cellPadding, " h-10"), onClick: function () { return handleStartAdd(col.key); } }, index === 0 && (react_2.default.createElement(solid_1.PlusIcon, { className: "h-4 w-4 ".concat(props.darkMode ? "text-gray-500" : "text-gray-400"), "aria-hidden": "true" })))); }),
|
|
3260
3558
|
renderAddColumnCell(),
|
|
3261
3559
|
handleShowsActionColumn() && (react_2.default.createElement("td", { className: "".concat(cellPadding, " ").concat(handleGetActionCellPin(false).className, " ").concat(props.darkMode ? "group-hover:bg-gray-800" : "group-hover:bg-gray-50"), style: handleGetActionCellPin(false).style }))));
|
|
3262
3560
|
};
|
|
@@ -3304,7 +3602,7 @@ var NewTable = function (rawProps) {
|
|
|
3304
3602
|
};
|
|
3305
3603
|
// INFO: true when maxSelectedCount is set and the current selection has reached the limit
|
|
3306
3604
|
var isMaxReached = !!props.maxSelectedCount &&
|
|
3307
|
-
((
|
|
3605
|
+
((_s = (_r = props.selectedIds) === null || _r === void 0 ? void 0 : _r.length) !== null && _s !== void 0 ? _s : 0) >= props.maxSelectedCount;
|
|
3308
3606
|
// INFO: one desktop row. groupAccent carries the group's colour so member
|
|
3309
3607
|
// rows show the band's colour as a bar down their left edge.
|
|
3310
3608
|
var handleRowDragStart = function (event, rowId) {
|
|
@@ -3392,7 +3690,7 @@ var NewTable = function (rawProps) {
|
|
|
3392
3690
|
? (0, rowRendering_1.handleGetIdentity)(rawProps[key])
|
|
3393
3691
|
: (0, rowRendering_1.handleFingerprint)(rawProps[key]));
|
|
3394
3692
|
});
|
|
3395
|
-
var
|
|
3693
|
+
var cellKey = __spreadArray(__spreadArray([], propParts, true), [
|
|
3396
3694
|
(0, rowRendering_1.handleFingerprint)(columnTypeActions),
|
|
3397
3695
|
isFixed,
|
|
3398
3696
|
editDataRowId,
|
|
@@ -3414,6 +3712,14 @@ var NewTable = function (rawProps) {
|
|
|
3414
3712
|
(0, rowRendering_1.handleGetIdentity)(measuredPinWidths),
|
|
3415
3713
|
(0, rowRendering_1.handleGetIdentity)(columnWidths),
|
|
3416
3714
|
], false).join("|");
|
|
3715
|
+
if (cellKey !== cellVersionRef.current.key)
|
|
3716
|
+
cellVersionRef.current = {
|
|
3717
|
+
key: cellKey,
|
|
3718
|
+
version: cellVersionRef.current.version + 1,
|
|
3719
|
+
};
|
|
3720
|
+
var key = "".concat(cellKey, "|").concat(drawnColumnWindow
|
|
3721
|
+
? "".concat(drawnColumnWindow.start, "-").concat(drawnColumnWindow.end)
|
|
3722
|
+
: "");
|
|
3417
3723
|
if (key !== tableVersionRef.current.key)
|
|
3418
3724
|
tableVersionRef.current = {
|
|
3419
3725
|
key: key,
|
|
@@ -3619,6 +3925,11 @@ var NewTable = function (rawProps) {
|
|
|
3619
3925
|
((_d = props.selectAll) !== null && _d !== void 0 ? _d : false);
|
|
3620
3926
|
var rowBgClass = isSelected ? selectedRowBg : bgColor;
|
|
3621
3927
|
var isRowHoverable = !!props.onClickRow && !isSelected;
|
|
3928
|
+
// INFO: each body cell is kept on the same terms as its row, so the drawn
|
|
3929
|
+
// columns moving mounts only those coming into view
|
|
3930
|
+
var memoCells = {
|
|
3931
|
+
wrapCell: function (col, _colIndex, render) { return (react_2.default.createElement(rowRendering_1.NewTableMemoCell, { key: col.key, row: row, spaceRow: spaceRow, colKey: col.key, index: index, groupAccent: groupAccent, dropGroupId: dropGroup === null || dropGroup === void 0 ? void 0 : dropGroup.id, isSelected: isSelected, editValue: editDataRowId === row.id ? editDataValue : undefined, cellVersion: cellVersionRef.current.version, render: render })); },
|
|
3932
|
+
};
|
|
3622
3933
|
return (react_2.default.createElement("tr", __assign({ key: row.id, "data-dtw-record-id": row.id, draggable: canDragRows && dragArmedRowId === row.id, onDragStart: function (e) { return handleRowDragStart(e, row.id); }, onDragEnd: handleRowDragEnd }, (dropGroup ? handleGroupDropProps(dropGroup) : {}), { onClick: function (e) {
|
|
3623
3934
|
var _a, _b;
|
|
3624
3935
|
// INFO: a link or form field placed in a cell does its own default
|
|
@@ -3650,7 +3961,7 @@ var NewTable = function (rawProps) {
|
|
|
3650
3961
|
props.checkbox && (react_2.default.createElement("td", { className: "w-10 ".concat(cellPadding, " ").concat(hasPinColumns ? "".concat(rowBgClass, " ").concat(isRowHoverable ? (props.darkMode ? "group-hover:bg-gray-700" : "group-hover:bg-gray-100") : "") : ""), style: handleGetCheckboxPinStyle(1), onClick: function (e) { return handleSelectRow(row.id, e); }, onMouseDown: function (e) { return handleDragSelectStart(row.id, e); }, onMouseEnter: function () { return handleDragSelectOver(row.id); } }, renderCheckbox(isSelected, function () { }, undefined, isMaxReached && !isSelected
|
|
3651
3962
|
? "opacity-50 cursor-not-allowed"
|
|
3652
3963
|
: ""))),
|
|
3653
|
-
|
|
3964
|
+
handleMapDrawnColumns(memoCells, function (col, colIndex) {
|
|
3654
3965
|
var dragHandle = colIndex === 0 && canDragRows && dropGroup
|
|
3655
3966
|
? renderRowDragHandle(row.id)
|
|
3656
3967
|
: null;
|
|
@@ -3680,7 +3991,7 @@ var NewTable = function (rawProps) {
|
|
|
3680
3991
|
: "hidden group-focus-within/fillcell:block"), style: { right: titleStripsWidth } })) : null, dragHandle, renderActivityButton(row.id, true));
|
|
3681
3992
|
};
|
|
3682
3993
|
var renderDataCell = function () {
|
|
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;
|
|
3994
|
+
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, _11, _12;
|
|
3684
3995
|
// INFO: a coloured list cell is this table's to render, so it takes
|
|
3685
3996
|
// the raw value even when a display row is supplied. The list view
|
|
3686
3997
|
// builds those rows and puts a Tag in for a coloured value — an
|
|
@@ -3767,9 +4078,15 @@ var NewTable = function (rawProps) {
|
|
|
3767
4078
|
// table (isColumnLocked) — there a click must leave the Select alone,
|
|
3768
4079
|
// not navigate — so the overlay is gated on !editable.active.
|
|
3769
4080
|
var shouldNavigateOnClick = !((_q = props.editable) === null || _q === void 0 ? void 0 : _q.active);
|
|
4081
|
+
var isLockedFillCell = !!((_r = props.editable) === null || _r === void 0 ? void 0 : _r.active) &&
|
|
4082
|
+
gridLines === "all" &&
|
|
4083
|
+
!isActionColumn;
|
|
3770
4084
|
var cellFill = handleGetCellFill(col, rawListValue);
|
|
3771
4085
|
var pinProps = getPinProps(col.key, false, rowBgClass, isRowHoverable);
|
|
3772
|
-
return (react_2.default.createElement("td", { key: col.key, "data-cell-key": col.key, "data-pin-key": handleGetPinKey(col.key), "data-cell-fill": cellFill ? "" : undefined, className: "p-0 align-middle ".concat(cellFill ? handleDropCellBg(pinProps === null || pinProps === void 0 ? void 0 : pinProps.className) : ((
|
|
4086
|
+
return (react_2.default.createElement("td", { key: col.key, "data-cell-key": col.key, "data-pin-key": handleGetPinKey(col.key), "data-cell-fill": cellFill ? "" : undefined, "data-cell-locked": isLockedFillCell ? "" : undefined, className: "p-0 align-middle ".concat(isLockedFillCell ? "cursor-default" : "", " ").concat(cellFill ? handleDropCellBg(pinProps === null || pinProps === void 0 ? void 0 : pinProps.className) : ((_s = pinProps === null || pinProps === void 0 ? void 0 : pinProps.className) !== null && _s !== void 0 ? _s : ""), " ").concat((_t = cellFill === null || cellFill === void 0 ? void 0 : cellFill.className) !== null && _t !== void 0 ? _t : ""), style: __assign(__assign({}, pinProps === null || pinProps === void 0 ? void 0 : pinProps.style), cellFill === null || cellFill === void 0 ? void 0 : cellFill.style),
|
|
4087
|
+
// INFO: a locked coloured cell in the full grid keeps its
|
|
4088
|
+
// click, as a locked text cell does
|
|
4089
|
+
onClick: isLockedFillCell ? function (e) { return e.stopPropagation(); } : undefined },
|
|
3773
4090
|
react_2.default.createElement("div", { className: "relative ".concat(cellFill ? "w-full" : "w-max", " whitespace-nowrap p-[1px]") },
|
|
3774
4091
|
renderFormCell(row, readOnlyDS, null, {
|
|
3775
4092
|
active: true,
|
|
@@ -3793,7 +4110,7 @@ var NewTable = function (rawProps) {
|
|
|
3793
4110
|
// INFO: share the column width source with the read-only/edit cell
|
|
3794
4111
|
// variants, otherwise an "Add" placeholder and a filled value in the
|
|
3795
4112
|
// same column resolve to different widths and the column looks ragged
|
|
3796
|
-
className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " ").concat(handleReadCellWidthClass(col), " ").concat((
|
|
4113
|
+
className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " ").concat(handleReadCellWidthClass(col), " ").concat((_v = (_u = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _u === void 0 ? void 0 : _u.className) !== null && _v !== void 0 ? _v : ""), style: (_w = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _w === void 0 ? void 0 : _w.style },
|
|
3797
4114
|
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) {
|
|
3798
4115
|
var _a;
|
|
3799
4116
|
e.stopPropagation();
|
|
@@ -3813,7 +4130,7 @@ var NewTable = function (rawProps) {
|
|
|
3813
4130
|
// INFO: share the column width source with the read-only/edit cell
|
|
3814
4131
|
// variants, otherwise an "Add" placeholder and a filled value in the
|
|
3815
4132
|
// same column resolve to different widths and the column looks ragged
|
|
3816
|
-
className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " ").concat(handleReadCellWidthClass(col), " ").concat((
|
|
4133
|
+
className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " ").concat(handleReadCellWidthClass(col), " ").concat((_y = (_x = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _x === void 0 ? void 0 : _x.className) !== null && _y !== void 0 ? _y : ""), style: (_z = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _z === void 0 ? void 0 : _z.style },
|
|
3817
4134
|
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) {
|
|
3818
4135
|
e.stopPropagation();
|
|
3819
4136
|
handleModalEditOnClick(row.id, col.key, row);
|
|
@@ -3835,7 +4152,7 @@ var NewTable = function (rawProps) {
|
|
|
3835
4152
|
if (isEditable &&
|
|
3836
4153
|
resolvedColType === "multipleList" &&
|
|
3837
4154
|
(!isCellEditing || isLabelPickerColumn) &&
|
|
3838
|
-
!((
|
|
4155
|
+
!((_1 = (_0 = props.bareSettings) === null || _0 === void 0 ? void 0 : _0.bareListDescription) === null || _1 === void 0 ? void 0 : _1.call(_0, col.key, cellValue))) {
|
|
3839
4156
|
var isPicking = isLabelPickerColumn && isCellEditing && !!labelPickerAnchor;
|
|
3840
4157
|
var handleOpenCell_1 = function (target) {
|
|
3841
4158
|
if (gridLines === "all") {
|
|
@@ -3858,11 +4175,11 @@ var NewTable = function (rawProps) {
|
|
|
3858
4175
|
var pickedValue = resolveValue((isCellEditing ? rowData : row), col.key);
|
|
3859
4176
|
// INFO: a plain multiple list under gridLines="all" gets the
|
|
3860
4177
|
// cell's "x" on hover; a coloured one clears in its label picker
|
|
3861
|
-
var tagPinClass = (
|
|
4178
|
+
var tagPinClass = (_3 = (_2 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _2 === void 0 ? void 0 : _2.className) !== null && _3 !== void 0 ? _3 : "";
|
|
3862
4179
|
var isTagClearable = gridLines === "all" &&
|
|
3863
4180
|
!isLabelPickerColumn &&
|
|
3864
4181
|
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: (
|
|
4182
|
+
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: (_4 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _4 === void 0 ? void 0 : _4.style },
|
|
3866
4183
|
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) {
|
|
3867
4184
|
e.stopPropagation();
|
|
3868
4185
|
handleOpenCell_1(e.currentTarget);
|
|
@@ -3875,7 +4192,7 @@ var NewTable = function (rawProps) {
|
|
|
3875
4192
|
} }, renderTagLine(col, isLabelPickerColumn ? pickedValue : cellValue)),
|
|
3876
4193
|
isTagClearable &&
|
|
3877
4194
|
renderClearCellButton(col, row.id, rowData, true),
|
|
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: ((
|
|
4195
|
+
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: ((_5 = col.listSelection) !== null && _5 !== void 0 ? _5 : []).map(function (key) { return ({
|
|
3879
4196
|
key: String(key),
|
|
3880
4197
|
color: handleGetListColour(col, key),
|
|
3881
4198
|
}); }), value: (Array.isArray(pickedValue)
|
|
@@ -3904,7 +4221,7 @@ var NewTable = function (rawProps) {
|
|
|
3904
4221
|
// INFO: coloured list cells are exempt from the hover swap — read and
|
|
3905
4222
|
// edit are the same filled pill, so there is nothing to swap to
|
|
3906
4223
|
var bareOverride = isEditable
|
|
3907
|
-
? (
|
|
4224
|
+
? (_7 = (_6 = props.bareSettings) === null || _6 === void 0 ? void 0 : _6.bareListDescription) === null || _7 === void 0 ? void 0 : _7.call(_6, col.key, cellValue)
|
|
3908
4225
|
: undefined;
|
|
3909
4226
|
if (isEditable && !bareOverride && handleColumnShowsTags(col))
|
|
3910
4227
|
return renderEditDataInputs(colIndex, col, rowData, row.id, rowBgClass, isRowHoverable);
|
|
@@ -3917,15 +4234,37 @@ var NewTable = function (rawProps) {
|
|
|
3917
4234
|
!bareOverride &&
|
|
3918
4235
|
gridLines === "all" &&
|
|
3919
4236
|
FILL_INPUT_TYPES.includes(resolvedColType);
|
|
3920
|
-
var readPinClass = (
|
|
4237
|
+
var readPinClass = (_9 = (_8 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _8 === void 0 ? void 0 : _8.className) !== null && _9 !== void 0 ? _9 : "";
|
|
3921
4238
|
var isReadClearable = isClickToEditCell &&
|
|
3922
4239
|
!handleColumnShowsTags(col) &&
|
|
3923
4240
|
// INFO: the title's right edge holds the row's own actions
|
|
3924
|
-
!(hasRowActions && col.key === ((
|
|
4241
|
+
!(hasRowActions && col.key === ((_10 = flatColumns[0]) === null || _10 === void 0 ? void 0 : _10.key)) &&
|
|
3925
4242
|
handleIsCellClearable(col, rowData === null || rowData === void 0 ? void 0 : rowData[col.key], rowData);
|
|
4243
|
+
// INFO: under gridLines="all" every editable cell's click opens
|
|
4244
|
+
// its editor, so a locked cell opening the record was the odd one
|
|
4245
|
+
// out. Its click stays in the cell; the record opens from the
|
|
4246
|
+
// title's open button. The partial grid keeps the row click, since
|
|
4247
|
+
// there the row (not the cell) is what is clicked.
|
|
4248
|
+
var isLockedGridCell = !!((_11 = props.editable) === null || _11 === void 0 ? void 0 : _11.active) &&
|
|
4249
|
+
gridLines === "all" &&
|
|
4250
|
+
isColumnLocked &&
|
|
4251
|
+
!isActionColumn;
|
|
3926
4252
|
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)
|
|
3927
4253
|
? col.key
|
|
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: (
|
|
4254
|
+
: undefined, className: "".concat(isReadClearable ? "group/clear ".concat(readPinClass.includes("sticky") ? "" : "relative") : "", " ").concat(cellPadding, " ").concat(isEditable ? "".concat(editCellMinHeight, " align-middle ").concat(handleCellMinWidth(col.type)) : "", " ").concat(isLockedGridCell ? "cursor-default" : "", " text-sm ").concat(colIndex === 0 && props.onClickRow ? titleFontColor : cellFontColor, " ").concat(handleReadCellWidthClass(col), " ").concat(readPinClass), style: (_12 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _12 === void 0 ? void 0 : _12.style, "data-row-link-cell": props.newTabUrl && props.onClickRow && !isLockedGridCell
|
|
4255
|
+
? ""
|
|
4256
|
+
: undefined, "data-cell-locked": isLockedGridCell ? "" : undefined,
|
|
4257
|
+
// INFO: bubble phase, so a button in the cell (the title's
|
|
4258
|
+
// open, comment and drag controls) runs first; those still
|
|
4259
|
+
// reach the row as they did, anything else stops here
|
|
4260
|
+
onClick: isLockedGridCell
|
|
4261
|
+
? function (e) {
|
|
4262
|
+
var _a, _b;
|
|
4263
|
+
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-"]'))
|
|
4264
|
+
return;
|
|
4265
|
+
e.stopPropagation();
|
|
4266
|
+
}
|
|
4267
|
+
: undefined,
|
|
3929
4268
|
// INFO: a click opens the editor in place rather than following
|
|
3930
4269
|
// the row's link
|
|
3931
4270
|
onClickCapture: isClickToEditCell
|
|
@@ -3944,7 +4283,7 @@ var NewTable = function (rawProps) {
|
|
|
3944
4283
|
});
|
|
3945
4284
|
}
|
|
3946
4285
|
: 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)),
|
|
4286
|
+
handleIsReadCellFixed(col) ? (react_2.default.createElement(hoverTooltip_1.HoverTooltip, { as: "div", className: "w-0 min-w-full truncate", onlyWhenClipped: true }, renderReadCellValue(col, row, cellValue, isLockedGridCell))) : (renderReadCellValue(col, row, cellValue, isLockedGridCell)),
|
|
3948
4287
|
isReadClearable &&
|
|
3949
4288
|
renderClearCellButton(col, row.id, rowData, true)));
|
|
3950
4289
|
if (!isEditable || bareOverride)
|
|
@@ -4018,7 +4357,7 @@ var NewTable = function (rawProps) {
|
|
|
4018
4357
|
// add-column on it left the band a column short of the row.
|
|
4019
4358
|
var columnCount = props.mobileView
|
|
4020
4359
|
? 1
|
|
4021
|
-
:
|
|
4360
|
+
: drawnColumnCount +
|
|
4022
4361
|
(props.checkbox ? 1 : 0) +
|
|
4023
4362
|
(((_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.addColumnEnabled) ? 1 : 0) +
|
|
4024
4363
|
(handleShowsActionColumn() ? 1 : 0);
|
|
@@ -4100,7 +4439,7 @@ var NewTable = function (rawProps) {
|
|
|
4100
4439
|
? "pointer-events-none"
|
|
4101
4440
|
: "cursor-text ".concat(props.darkMode ? "hover:bg-gray-800" : "hover:bg-gray-50")) }, handleGroupDropProps(group)),
|
|
4102
4441
|
props.checkbox && react_2.default.createElement("td", { className: "w-10 ".concat(cellPadding) }),
|
|
4103
|
-
|
|
4442
|
+
handleMapDrawnColumns({}, function (col, index) { return (react_2.default.createElement("td", { key: col.key, "data-add-cell": col.key, className: "".concat(cellPadding, " h-10 text-sm ").concat(props.darkMode ? "text-gray-500" : "text-gray-400", " ").concat(isBlank ? "invisible" : ""), onClick: function () {
|
|
4104
4443
|
return handleStartAdd(handleIsAddColumn(col) ? col.key : (firstAddKey !== null && firstAddKey !== void 0 ? firstAddKey : col.key), group);
|
|
4105
4444
|
} }, index === 0 && (react_2.default.createElement("span", { className: "inline-flex items-center gap-x-1 whitespace-nowrap" },
|
|
4106
4445
|
react_2.default.createElement(solid_1.PlusIcon, { className: "h-4 w-4", "aria-hidden": "true" }),
|
|
@@ -4120,7 +4459,7 @@ var NewTable = function (rawProps) {
|
|
|
4120
4459
|
return null;
|
|
4121
4460
|
return (react_2.default.createElement("tr", { "data-testid": "table-group-summary-".concat(group.id), className: "border-l-4 ".concat((_a = ACCENT_CLASS[colourKey]) !== null && _a !== void 0 ? _a : ACCENT_CLASS.default, " ").concat(props.darkMode ? "bg-gray-800" : "bg-gray-50") },
|
|
4122
4461
|
props.checkbox && react_2.default.createElement("td", { className: "w-10 ".concat(cellPadding) }),
|
|
4123
|
-
|
|
4462
|
+
handleMapDrawnColumns({}, function (col, colIndex) {
|
|
4124
4463
|
var _a, _b;
|
|
4125
4464
|
var pin = getPinProps(col.key, false, props.darkMode ? "bg-gray-800" : "bg-gray-50");
|
|
4126
4465
|
var sum = (_a = summary.sums) === null || _a === void 0 ? void 0 : _a[col.key];
|
|
@@ -4244,19 +4583,14 @@ var NewTable = function (rawProps) {
|
|
|
4244
4583
|
react_2.default.createElement("div", { className: "flex items-center overflow-x-auto mx-1 border-l ".concat(props.darkMode ? "border-gray-500" : "") }, renderActionBtns()),
|
|
4245
4584
|
renderCloseBtn())));
|
|
4246
4585
|
};
|
|
4247
|
-
// INFO: determines whether any column uses groupData — if so, a two-row
|
|
4248
|
-
// thead with colSpan/rowSpan is rendered for proper visual grouping.
|
|
4249
|
-
var hasGroupHeaders = columns.some(function (col) {
|
|
4250
|
-
return !col.hide &&
|
|
4251
|
-
col.groupData &&
|
|
4252
|
-
col.groupData.length > 0;
|
|
4253
|
-
});
|
|
4254
4586
|
var renderTableHeader = function () {
|
|
4255
4587
|
var advSettings = props.advSettings;
|
|
4256
4588
|
var cursorClassname = (advSettings === null || advSettings === void 0 ? void 0 : advSettings.dragEnabled) ? "cursor-grab" : "";
|
|
4257
4589
|
var draggable = (advSettings === null || advSettings === void 0 ? void 0 : advSettings.dragEnabled) ? true : false;
|
|
4258
4590
|
var droppable = (advSettings === null || advSettings === void 0 ? void 0 : advSettings.dragEnabled) ? true : false;
|
|
4259
|
-
|
|
4591
|
+
// INFO: no margin of its own — the icons sit in one row (see
|
|
4592
|
+
// renderHeaderIcons) that keeps the title's gap and packs them closer
|
|
4593
|
+
var sortClassname = "flex-shrink-0 h-4 w-4 cursor-pointer";
|
|
4260
4594
|
// INFO: a reference column gets a solid line under its header and a
|
|
4261
4595
|
// lookup a dashed one, so linked columns stand out without taking header
|
|
4262
4596
|
// space; the pattern, not only the colour, tells them apart
|
|
@@ -4273,77 +4607,141 @@ var NewTable = function (rawProps) {
|
|
|
4273
4607
|
return null;
|
|
4274
4608
|
return (react_2.default.createElement("span", { "aria-hidden": "true", "data-testid": "table-column-link-".concat(col.key), "data-link": link, className: "pointer-events-none absolute inset-x-2 bottom-0 border-b-2 ".concat(link === "lookup" ? "border-dashed" : "border-solid", " ").concat(props.darkMode ? "border-primary-300" : "border-primary-400") }));
|
|
4275
4609
|
};
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
var
|
|
4296
|
-
|
|
4297
|
-
event.stopPropagation();
|
|
4298
|
-
(_a = advSettings === null || advSettings === void 0 ? void 0 : advSettings.onDeleteColumn) === null || _a === void 0 ? void 0 : _a.call(advSettings, col.key);
|
|
4299
|
-
} })) : null;
|
|
4300
|
-
var editIcon = handleCanEditColumn(col) ? (react_2.default.createElement(outline_1.PencilSquareIcon, { "data-testid": "table-column-edit-".concat(col.key), className: "".concat(sortClassname, " ").concat(revealClassname), onClick: function (event) {
|
|
4301
|
-
event.stopPropagation();
|
|
4302
|
-
handleEditColumnModal(col.key);
|
|
4303
|
-
} })) : null;
|
|
4304
|
-
var sortColumnEnabled = (_a = advSettings === null || advSettings === void 0 ? void 0 : advSettings.sortOptions) === null || _a === void 0 ? void 0 : _a.some(function (eachOption) { return eachOption.key === col.key; });
|
|
4305
|
-
var filterColumnEnabled = utils_1.supportedAQList.includes((_b = col.type) !== null && _b !== void 0 ? _b : "");
|
|
4306
|
-
if (sortColumnEnabled && (advSettings === null || advSettings === void 0 ? void 0 : advSettings.sortEnabled)) {
|
|
4307
|
-
if (col.key !== ((_c = advSettings.sortId) === null || _c === void 0 ? void 0 : _c.sortId)) {
|
|
4308
|
-
sortIcon = (react_2.default.createElement(solid_2.ArrowsUpDownIcon, { "data-testid": "table-column-sort-".concat(col.key), className: sortClassname, onClick: function () { return handleSort(col.key, "new"); } }));
|
|
4309
|
-
}
|
|
4310
|
-
else if (col.key === advSettings.sortId.sortId) {
|
|
4311
|
-
if (advSettings.sortId.type === "desc") {
|
|
4312
|
-
sortIcon = (react_2.default.createElement(solid_2.BarsArrowDownIcon, { "data-testid": "table-column-sort-".concat(col.key), className: sortClassname, onClick: function () { return handleSort(col.key, "asc"); } }));
|
|
4313
|
-
}
|
|
4314
|
-
else if (advSettings.sortId.type === "asc") {
|
|
4315
|
-
sortIcon = (react_2.default.createElement(solid_2.BarsArrowUpIcon, { "data-testid": "table-column-sort-".concat(col.key), className: sortClassname, onClick: function () { return handleSort(col.key, "desc"); } }));
|
|
4316
|
-
}
|
|
4317
|
-
}
|
|
4318
|
-
}
|
|
4319
|
-
if (filterColumnEnabled && (advSettings === null || advSettings === void 0 ? void 0 : advSettings.filterEnabled)) {
|
|
4320
|
-
filterIcon = (react_2.default.createElement(outline_1.FunnelIcon, { className: sortClassname, onClick: function () { return handleFilterModal(col.key); } }));
|
|
4321
|
-
}
|
|
4322
|
-
// INFO: revealed on hover like hide; a frozen column keeps its lock in
|
|
4323
|
-
// view, so the reader sees which columns are frozen and where to undo it
|
|
4610
|
+
// INFO: a column with a set width keeps its title on one line, cut off
|
|
4611
|
+
// with an ellipsis, so the title never pushes the icons into the next
|
|
4612
|
+
// column. A cut title reads in full in the table's hover tooltip — only
|
|
4613
|
+
// when it is cut, and to a mouse only, as a cut cell value does. A column
|
|
4614
|
+
// sized by its content wraps its title as before.
|
|
4615
|
+
var renderHeaderTitle = function (col, fixed) {
|
|
4616
|
+
return fixed ? (react_2.default.createElement(hoverTooltip_1.HoverTooltip, { className: "min-w-0 truncate", text: typeof col.title === "string" ? col.title : undefined, onlyWhenClipped: true, "data-testid": "table-column-title-".concat(col.key) }, col.title)) : (col.title);
|
|
4617
|
+
};
|
|
4618
|
+
var renderHeaderIcons = function (col, fixedWidth) {
|
|
4619
|
+
var _a, _b, _c, _d;
|
|
4620
|
+
if (fixedWidth === void 0) { fixedWidth = false; }
|
|
4621
|
+
// INFO: only a column's active states stay in view — read only, its
|
|
4622
|
+
// sort, its freeze — so a narrow column keeps room for its title. Every
|
|
4623
|
+
// action sits behind the ⋯ menu, which shows on header hover.
|
|
4624
|
+
var isSortable = !!(advSettings === null || advSettings === void 0 ? void 0 : advSettings.sortEnabled) &&
|
|
4625
|
+
!!((_a = advSettings === null || advSettings === void 0 ? void 0 : advSettings.sortOptions) === null || _a === void 0 ? void 0 : _a.some(function (eachOption) { return eachOption.key === col.key; }));
|
|
4626
|
+
var activeSort = isSortable && ((_b = advSettings === null || advSettings === void 0 ? void 0 : advSettings.sortId) === null || _b === void 0 ? void 0 : _b.sortId) === col.key
|
|
4627
|
+
? advSettings.sortId.type
|
|
4628
|
+
: undefined;
|
|
4629
|
+
var isFilterable = !!(advSettings === null || advSettings === void 0 ? void 0 : advSettings.filterEnabled) &&
|
|
4630
|
+
utils_1.supportedAQList.includes((_c = col.type) !== null && _c !== void 0 ? _c : "");
|
|
4324
4631
|
var drawnFrozenKeys = handleGetDrawnFrozenKeys();
|
|
4325
4632
|
var isFrozen = drawnFrozenKeys.includes(col.key);
|
|
4326
4633
|
var isLastFrozen = drawnFrozenKeys[drawnFrozenKeys.length - 1] === col.key;
|
|
4327
|
-
var FreezeIcon = isFrozen ? outline_1.LockClosedIcon : outline_1.LockOpenIcon;
|
|
4328
4634
|
var freezeLabel = isLastFrozen
|
|
4329
4635
|
? "Unfreeze columns"
|
|
4330
4636
|
: "Freeze up to this column";
|
|
4331
|
-
var
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4637
|
+
var activeColour = props.darkMode
|
|
4638
|
+
? "text-primary-300"
|
|
4639
|
+
: "text-primary-600";
|
|
4640
|
+
// INFO: an editable table marks the columns it will not let you edit —
|
|
4641
|
+
// their cells look like every other cell otherwise. Not clickable; a
|
|
4642
|
+
// hover tooltip says why, to a mouse only. A read-only table needs no
|
|
4643
|
+
// marker, since none of its columns can be edited.
|
|
4644
|
+
var readOnlyLabel = "Editing disabled";
|
|
4645
|
+
var readOnlyIcon = ((_d = props.editable) === null || _d === void 0 ? void 0 : _d.active) && col.disabled ? (react_2.default.createElement(hoverTooltip_1.HoverTooltip, { text: readOnlyLabel, className: "inline-flex flex-shrink-0", "data-testid": "table-column-readonly-tooltip-".concat(col.key) },
|
|
4646
|
+
react_2.default.createElement(outline_1.NoSymbolIcon, { "data-testid": "table-column-readonly-".concat(col.key), role: "img", "aria-label": readOnlyLabel, className: "flex-shrink-0 h-4 w-4 cursor-default ".concat(props.darkMode ? "text-gray-500" : "text-gray-400") }))) : null;
|
|
4647
|
+
// INFO: the current sort reports itself and flips on a click, as it did
|
|
4648
|
+
var SortIcon = activeSort === "desc" ? outline_1.BarsArrowDownIcon : outline_1.BarsArrowUpIcon;
|
|
4649
|
+
var sortIcon = activeSort ? (react_2.default.createElement(SortIcon, { "data-testid": "table-column-sort-".concat(col.key), "data-sort": activeSort, role: "button", "aria-label": activeSort === "desc" ? "Sorted descending" : "Sorted ascending", title: activeSort === "desc" ? "Sorted descending" : "Sorted ascending", className: "".concat(sortClassname, " ").concat(activeColour), onClick: function (event) {
|
|
4650
|
+
event.stopPropagation();
|
|
4651
|
+
handleSort(col.key, activeSort === "desc" ? "asc" : "desc");
|
|
4652
|
+
} })) : null;
|
|
4653
|
+
// INFO: a frozen column keeps its lock in view, so the reader sees which
|
|
4654
|
+
// columns are frozen and where to undo it
|
|
4655
|
+
var freezeIcon = isFrozen && handleCanFreezeColumn(col) ? (react_2.default.createElement(outline_1.LockClosedIcon, { "data-testid": "table-column-freeze-".concat(col.key), "data-frozen": "true", role: "button", "aria-label": freezeLabel, title: freezeLabel, className: "".concat(sortClassname, " ").concat(activeColour), onClick: function (event) {
|
|
4336
4656
|
event.stopPropagation();
|
|
4337
4657
|
handleFreezeColumn(col.key);
|
|
4338
4658
|
} })) : null;
|
|
4339
|
-
|
|
4659
|
+
var menuItems = [];
|
|
4660
|
+
if (isSortable) {
|
|
4661
|
+
menuItems.push({
|
|
4662
|
+
key: "sortAsc",
|
|
4663
|
+
label: "Sort ascending",
|
|
4664
|
+
icon: outline_1.BarsArrowUpIcon,
|
|
4665
|
+
testId: "table-column-sort-asc-".concat(col.key),
|
|
4666
|
+
checked: activeSort === "asc",
|
|
4667
|
+
onClick: function () { return handleSort(col.key, "asc"); },
|
|
4668
|
+
}, {
|
|
4669
|
+
key: "sortDesc",
|
|
4670
|
+
label: "Sort descending",
|
|
4671
|
+
icon: outline_1.BarsArrowDownIcon,
|
|
4672
|
+
testId: "table-column-sort-desc-".concat(col.key),
|
|
4673
|
+
checked: activeSort === "desc",
|
|
4674
|
+
onClick: function () { return handleSort(col.key, "desc"); },
|
|
4675
|
+
});
|
|
4676
|
+
}
|
|
4677
|
+
if (isFilterable)
|
|
4678
|
+
menuItems.push({
|
|
4679
|
+
key: "filter",
|
|
4680
|
+
label: "Filter",
|
|
4681
|
+
icon: outline_1.FunnelIcon,
|
|
4682
|
+
testId: "table-column-filter-".concat(col.key),
|
|
4683
|
+
onClick: function () { return handleFilterModal(col.key); },
|
|
4684
|
+
});
|
|
4685
|
+
// INFO: a frozen column is unfrozen from its lock; the menu offers the
|
|
4686
|
+
// freeze only to a column not yet frozen
|
|
4687
|
+
if (!isFrozen && handleCanFreezeColumn(col))
|
|
4688
|
+
menuItems.push({
|
|
4689
|
+
key: "freeze",
|
|
4690
|
+
// INFO: freezes this column and every column before it
|
|
4691
|
+
label: "Freeze column",
|
|
4692
|
+
icon: outline_1.LockClosedIcon,
|
|
4693
|
+
testId: "table-column-freeze-".concat(col.key),
|
|
4694
|
+
onClick: function () { return handleFreezeColumn(col.key); },
|
|
4695
|
+
});
|
|
4696
|
+
var viewGroupStart = menuItems.length;
|
|
4697
|
+
if (advSettings === null || advSettings === void 0 ? void 0 : advSettings.onHideColumn)
|
|
4698
|
+
menuItems.push({
|
|
4699
|
+
key: "hide",
|
|
4700
|
+
label: "Hide column",
|
|
4701
|
+
icon: outline_1.EyeSlashIcon,
|
|
4702
|
+
testId: "table-column-hide-".concat(col.key),
|
|
4703
|
+
onClick: function () { var _a; return (_a = advSettings === null || advSettings === void 0 ? void 0 : advSettings.onHideColumn) === null || _a === void 0 ? void 0 : _a.call(advSettings, col.key); },
|
|
4704
|
+
});
|
|
4705
|
+
if (handleCanEditColumn(col))
|
|
4706
|
+
menuItems.push({
|
|
4707
|
+
key: "edit",
|
|
4708
|
+
label: "Edit column",
|
|
4709
|
+
icon: outline_1.PencilSquareIcon,
|
|
4710
|
+
testId: "table-column-edit-".concat(col.key),
|
|
4711
|
+
onClick: function () { return handleEditColumnModal(col.key); },
|
|
4712
|
+
});
|
|
4713
|
+
if (col.type === "math")
|
|
4714
|
+
menuItems.push({
|
|
4715
|
+
key: "math",
|
|
4716
|
+
label: "Edit calculation",
|
|
4717
|
+
icon: outline_1.PencilIcon,
|
|
4718
|
+
testId: "table-column-math-".concat(col.key),
|
|
4719
|
+
onClick: function () { return handleAddColumnModal(col.key); },
|
|
4720
|
+
});
|
|
4721
|
+
// INFO: a column the edit panel can open is deleted from inside it; the
|
|
4722
|
+
// menu keeps a delete only for the columns that panel cannot show, so a
|
|
4723
|
+
// column added from the table can still be removed from it
|
|
4724
|
+
if ((advSettings === null || advSettings === void 0 ? void 0 : advSettings.onDeleteColumn) && !handleCanEditColumn(col))
|
|
4725
|
+
menuItems.push({
|
|
4726
|
+
key: "delete",
|
|
4727
|
+
label: "Delete column",
|
|
4728
|
+
icon: outline_1.TrashIcon,
|
|
4729
|
+
testId: "table-column-delete-".concat(col.key),
|
|
4730
|
+
danger: true,
|
|
4731
|
+
divider: true,
|
|
4732
|
+
onClick: function () { var _a; return (_a = advSettings === null || advSettings === void 0 ? void 0 : advSettings.onDeleteColumn) === null || _a === void 0 ? void 0 : _a.call(advSettings, col.key); },
|
|
4733
|
+
});
|
|
4734
|
+
if (viewGroupStart > 0 && menuItems[viewGroupStart])
|
|
4735
|
+
menuItems[viewGroupStart] = __assign(__assign({}, menuItems[viewGroupStart]), { divider: true });
|
|
4736
|
+
if (!readOnlyIcon && !sortIcon && !freezeIcon && menuItems.length === 0)
|
|
4737
|
+
return null;
|
|
4738
|
+
// INFO: the icons sit at the header's right edge, as one group, at least
|
|
4739
|
+
// 12px clear of the title, so every column's icons line up the same way
|
|
4740
|
+
return (react_2.default.createElement("span", { className: "ml-auto flex flex-shrink-0 items-center gap-1.5 pl-3" },
|
|
4741
|
+
readOnlyIcon,
|
|
4340
4742
|
sortIcon,
|
|
4341
|
-
filterIcon,
|
|
4342
4743
|
freezeIcon,
|
|
4343
|
-
|
|
4344
|
-
editIcon,
|
|
4345
|
-
deleteIcon,
|
|
4346
|
-
col.type === "math" && (react_2.default.createElement(outline_1.PencilIcon, { className: sortClassname, onClick: function () { return handleAddColumnModal(col.key); } }))));
|
|
4744
|
+
react_2.default.createElement(columnMenu_1.ColumnMenu, { columnKey: col.key, columnTitle: typeof col.title === "string" ? col.title : col.key, items: menuItems, darkMode: props.darkMode, collapsed: fixedWidth })));
|
|
4347
4745
|
};
|
|
4348
4746
|
var renderAddColumnHeader = function () {
|
|
4349
4747
|
if (!(advSettings === null || advSettings === void 0 ? void 0 : advSettings.addColumnEnabled))
|
|
@@ -4369,18 +4767,20 @@ var NewTable = function (rawProps) {
|
|
|
4369
4767
|
return (react_2.default.createElement("thead", null,
|
|
4370
4768
|
react_2.default.createElement("tr", { className: "border-b ".concat(dividerColor, " ").concat(tableHeaderBgColor, " ").concat(tableHeaderFontColor) },
|
|
4371
4769
|
props.checkbox && (react_2.default.createElement("th", { className: "w-10 ".concat(cellPadding, " ").concat(hasPinColumns ? tableHeaderBgColor : ""), style: handleGetCheckboxPinStyle(3) }, renderSelectAll())),
|
|
4372
|
-
|
|
4770
|
+
handleMapDrawnColumns({ tag: "th" }, function (col) {
|
|
4373
4771
|
var _a, _b, _c, _d;
|
|
4374
|
-
return (react_2.default.createElement("th", { key: col.key, className: "group/th relative ".concat(cellPadding, " text-left text-xs font-semibold uppercase tracking-wide ").concat(cursorClassname, " ").concat((_b = (_a = getPinProps(col.key, true)) === null || _a === void 0 ? void 0 : _a.className) !== null && _b !== void 0 ? _b : ""), style: __assign(__assign({}, (_c = getPinProps(col.key, true)) === null || _c === void 0 ? void 0 : _c.style), (getColumnWidth(col.key)
|
|
4772
|
+
return (react_2.default.createElement("th", { key: col.key, "data-column-key": col.key, className: "group/th relative ".concat(cellPadding, " text-left text-xs font-semibold uppercase tracking-wide ").concat(cursorClassname, " ").concat((_b = (_a = getPinProps(col.key, true)) === null || _a === void 0 ? void 0 : _a.className) !== null && _b !== void 0 ? _b : ""), style: __assign(__assign({}, (_c = getPinProps(col.key, true)) === null || _c === void 0 ? void 0 : _c.style), (getColumnWidth(col.key)
|
|
4375
4773
|
? {
|
|
4376
4774
|
width: getColumnWidth(col.key),
|
|
4377
4775
|
minWidth: getColumnWidth(col.key),
|
|
4378
4776
|
maxWidth: getColumnWidth(col.key),
|
|
4379
4777
|
}
|
|
4380
4778
|
: {})), draggable: draggable, onDragStart: function (e) { return handleDragStart(e, col.key); }, onDrop: droppable ? function (e) { return handleDrop(e, col.key); } : undefined, onDragOver: handleDragOver },
|
|
4381
|
-
react_2.default.createElement("div", { className: "group/header flex flex-row items-center ".concat(getColumnWidth(col.key)
|
|
4382
|
-
|
|
4383
|
-
|
|
4779
|
+
react_2.default.createElement("div", { className: "group/header flex flex-row items-center ".concat(getColumnWidth(col.key)
|
|
4780
|
+
? "min-w-0 overflow-hidden"
|
|
4781
|
+
: ((_d = col.width) !== null && _d !== void 0 ? _d : "")) },
|
|
4782
|
+
renderHeaderTitle(col, !!getColumnWidth(col.key)),
|
|
4783
|
+
renderHeaderIcons(col, !!getColumnWidth(col.key))),
|
|
4384
4784
|
renderHeaderLink(col),
|
|
4385
4785
|
react_2.default.createElement("span", { "data-testid": "table-column-resize-".concat(col.key), className: "group/grip absolute inset-y-0 -right-1 z-10 flex w-2 cursor-col-resize touch-none select-none items-stretch justify-center", draggable: false, onPointerDown: function (event) { return handleResizeStart(event, col.key); }, onPointerMove: handleResizeMove, onPointerUp: handleResizeEnd, onPointerCancel: handleResizeEnd, onClick: function (event) { return event.stopPropagation(); } },
|
|
4386
4786
|
react_2.default.createElement("span", { "aria-hidden": "true", className: "w-0.5 rounded-full opacity-0 transition-opacity group-hover/th:opacity-60 group-hover/grip:!opacity-100 ".concat(props.darkMode ? "bg-gray-500" : "bg-gray-300", " group-hover/grip:bg-primary-400") }))));
|
|
@@ -4407,7 +4807,7 @@ var NewTable = function (rawProps) {
|
|
|
4407
4807
|
}
|
|
4408
4808
|
return (react_2.default.createElement("th", { key: col.key, rowSpan: 2, className: "relative ".concat(cellPadding, " text-left text-xs font-semibold uppercase tracking-wide ").concat(cursorClassname, " ").concat((_b = (_a = getPinProps(col.key, true)) === null || _a === void 0 ? void 0 : _a.className) !== null && _b !== void 0 ? _b : ""), style: (_c = getPinProps(col.key, true)) === null || _c === void 0 ? void 0 : _c.style, draggable: draggable, onDragStart: function (e) { return handleDragStart(e, col.key); }, onDrop: droppable ? function (e) { return handleDrop(e, col.key); } : undefined, onDragOver: handleDragOver },
|
|
4409
4809
|
react_2.default.createElement("div", { className: "group/header flex flex-row items-center ".concat((_d = col.width) !== null && _d !== void 0 ? _d : "") },
|
|
4410
|
-
col
|
|
4810
|
+
renderHeaderTitle(col, false),
|
|
4411
4811
|
renderHeaderIcons(col)),
|
|
4412
4812
|
renderHeaderLink(col)));
|
|
4413
4813
|
}),
|
|
@@ -4427,20 +4827,20 @@ var NewTable = function (rawProps) {
|
|
|
4427
4827
|
};
|
|
4428
4828
|
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 : "") })); };
|
|
4429
4829
|
if (props.mobileView) {
|
|
4430
|
-
var hasPhoneGroups = !!((
|
|
4830
|
+
var hasPhoneGroups = !!((_t = props.groups) === null || _t === void 0 ? void 0 : _t.length);
|
|
4431
4831
|
return (react_2.default.createElement("div", null,
|
|
4432
|
-
react_2.default.createElement("div", { className: "w-full ".concat(((
|
|
4832
|
+
react_2.default.createElement("div", { className: "w-full ".concat(((_u = props.mobileTooltip) === null || _u === void 0 ? void 0 : _u.tooltip) ? "overflow-visible" : "overflow-hidden", " ").concat(isFlat
|
|
4433
4833
|
? ""
|
|
4434
|
-
: "border ".concat(borderRadius, " ").concat(borderColor, " ").concat(bgColor, " shadow-sm"), " divide-y ").concat(dividerColor, " ").concat((
|
|
4834
|
+
: "border ".concat(borderRadius, " ").concat(borderColor, " ").concat(bgColor, " shadow-sm"), " divide-y ").concat(dividerColor, " ").concat((_v = props.className) !== null && _v !== void 0 ? _v : "") },
|
|
4435
4835
|
react_2.default.createElement("div", { className: "p-3 flex items-center justify-between" },
|
|
4436
4836
|
renderSelectAll(),
|
|
4437
4837
|
react_2.default.createElement("div", { className: "flex items-center gap-2" },
|
|
4438
4838
|
renderSelectedCount(),
|
|
4439
|
-
((
|
|
4839
|
+
((_w = props.advSettings) === null || _w === void 0 ? void 0 : _w.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"); } })))),
|
|
4440
4840
|
props.loading &&
|
|
4441
4841
|
Array.from({ length: 3 }).map(function (_, i) { return (react_2.default.createElement("div", { key: "skeleton-".concat(i), className: "p-4" },
|
|
4442
4842
|
react_2.default.createElement("div", { className: "h-5 w-3/4 rounded-md animate-pulse ".concat(props.darkMode ? "bg-gray-700" : "bg-gray-200") }))); }),
|
|
4443
|
-
!props.loading && props.data.length === 0 && !hasPhoneGroups && (react_2.default.createElement("p", { className: "p-4 text-center text-sm ".concat(cellFontColor) }, (
|
|
4843
|
+
!props.loading && props.data.length === 0 && !hasPhoneGroups && (react_2.default.createElement("p", { className: "p-4 text-center text-sm ".concat(cellFontColor) }, (_x = props.emptyTitle) !== null && _x !== void 0 ? _x : "No items")),
|
|
4444
4844
|
!props.loading && (props.data.length > 0 || hasPhoneGroups) && (react_2.default.createElement("table", { className: "w-full table-fixed", ref: tableRef },
|
|
4445
4845
|
react_2.default.createElement("tbody", { className: "divide-y ".concat(dividerColor) }, renderDesktopRows())))),
|
|
4446
4846
|
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
|
|
@@ -4460,13 +4860,13 @@ var NewTable = function (rawProps) {
|
|
|
4460
4860
|
: [])[0];
|
|
4461
4861
|
return WIDE_EDIT_TYPES.includes((_a = selectedDS === null || selectedDS === void 0 ? void 0 : selectedDS.type) !== null && _a !== void 0 ? _a : "") ? "4xl" : "2xl";
|
|
4462
4862
|
};
|
|
4463
|
-
return (react_2.default.createElement("div", { className: "w-full ".concat((
|
|
4863
|
+
return (react_2.default.createElement("div", { className: "w-full ".concat((_y = props.className) !== null && _y !== void 0 ? _y : "") },
|
|
4464
4864
|
react_2.default.createElement(modal_1.Modal, { open: filterModal ? true : false, title: "Filter Options", renderContent: function () {
|
|
4465
4865
|
var _a, _b;
|
|
4466
4866
|
return (react_2.default.createElement("div", { className: "pb-44" },
|
|
4467
4867
|
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))));
|
|
4468
4868
|
}, onClose: function () { return setFilterModal(""); } }),
|
|
4469
|
-
react_2.default.createElement(modal_1.Modal, { open: modalEditVisible, title: (
|
|
4869
|
+
react_2.default.createElement(modal_1.Modal, { open: modalEditVisible, title: (_0 = (_z = flatColumns.find(function (eachCol) { return eachCol.key === editDataHeaderKey; })) === null || _z === void 0 ? void 0 : _z.title) !== null && _0 !== void 0 ? _0 : "Edit", maxWidth: handleGetEditModalWidth(), onClose: handleModalEditClose, renderContent: function () {
|
|
4470
4870
|
var _a, _b, _c, _d;
|
|
4471
4871
|
var selectedCol = flatColumns.find(function (eachCol) { return eachCol.key === editDataHeaderKey; });
|
|
4472
4872
|
if (!selectedCol)
|
|
@@ -4512,7 +4912,7 @@ var NewTable = function (rawProps) {
|
|
|
4512
4912
|
react_2.default.createElement(scrollShadow_1.ScrollShadow, { className: "w-full overflow-x-auto ".concat(isFlat
|
|
4513
4913
|
? ""
|
|
4514
4914
|
: "".concat(borderRadius, " border ").concat(borderColor, " ").concat(bgColor, " shadow-sm")), darkMode: props.darkMode },
|
|
4515
|
-
(props.selectAll || ((
|
|
4915
|
+
(props.selectAll || ((_2 = (_1 = props.selectedIds) === null || _1 === void 0 ? void 0 : _1.length) !== null && _2 !== void 0 ? _2 : 0) > 0) &&
|
|
4516
4916
|
(!props.multiActionFloatingBtns ||
|
|
4517
4917
|
(props.multiActionFloatingBtns &&
|
|
4518
4918
|
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" },
|
|
@@ -4533,14 +4933,14 @@ var NewTable = function (rawProps) {
|
|
|
4533
4933
|
props.loading &&
|
|
4534
4934
|
Array.from({ length: 3 }).map(function (_, i) { return (react_2.default.createElement("tr", { key: "skeleton-".concat(i) },
|
|
4535
4935
|
props.checkbox && react_2.default.createElement("td", { className: "w-10 ".concat(cellPadding) }),
|
|
4536
|
-
|
|
4936
|
+
handleMapDrawnColumns({}, function (col) { return (react_2.default.createElement("td", { key: col.key, className: cellPadding },
|
|
4537
4937
|
react_2.default.createElement("div", { className: "h-5 rounded-md animate-pulse ".concat(props.darkMode ? "bg-gray-700" : "bg-gray-200") }))); }))); }),
|
|
4538
4938
|
!props.loading && renderDesktopRows(),
|
|
4539
4939
|
!props.loading &&
|
|
4540
4940
|
(addData
|
|
4541
4941
|
? !isAddRowPinned && !addGroupId && renderAddDataRow()
|
|
4542
4942
|
: !handleHasGroupAddRows() && renderEmptyAddRow()))),
|
|
4543
|
-
!props.loading && props.data.length === 0 && (react_2.default.createElement("div", { className: "p-4 text-sm ".concat(cellFontColor, " text-center sticky left-0") }, (
|
|
4943
|
+
!props.loading && props.data.length === 0 && (react_2.default.createElement("div", { className: "p-4 text-sm ".concat(cellFontColor, " text-center sticky left-0") }, (_3 = props.emptyTitle) !== null && _3 !== void 0 ? _3 : "No items"))),
|
|
4544
4944
|
renderPinnedAddButton(),
|
|
4545
4945
|
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
|
|
4546
4946
|
? "pagination-container w-full ".concat(borderColor, " ").concat(isFixed ? "fixed bottom-0 left-0 z-10" : "sticky top-0 left-0")
|