@economic/taco 2.17.1 → 2.18.0
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/dist/components/Select2/components/Search.d.ts +5 -1
- package/dist/components/Table3/components/columns/cell/EditingCell.d.ts +1 -0
- package/dist/components/Table3/components/columns/cell/Indicator.d.ts +5 -0
- package/dist/components/Table3/components/toolbar/Filter/filters/components/FilterValue.d.ts +1 -1
- package/dist/components/Table3/types.d.ts +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +21 -7
- package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Search.js +2 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Search.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js +12 -7
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +11 -6
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Indicator.js +15 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Indicator.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +6 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js +10 -4
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Filter.js +11 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Filter.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterValue.js +0 -2
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterValue.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js +5 -2
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Toolbar.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Toolbar.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Listbox2/components/Option.js +4 -0
- package/dist/esm/packages/taco/src/primitives/Listbox2/components/Option.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableRowSelectionListener.js +7 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableRowSelectionListener.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/dom.js +13 -1
- package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
- package/dist/taco.cjs.development.js +177 -100
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/dist/utils/dom.d.ts +1 -0
- package/package.json +2 -2
- package/types.json +5388 -5018
@@ -9594,6 +9594,10 @@ const Option = /*#__PURE__*/React__default.forwardRef(function Listbox2Option(pr
|
|
9594
9594
|
if (disabled || listboxDisabled || listboxReadOnly) {
|
9595
9595
|
event.stopPropagation();
|
9596
9596
|
return;
|
9597
|
+
}
|
9598
|
+
// UX requirement: if tab key is pressed and the current option is selected then keydown event is ignored
|
9599
|
+
else if (event.key === 'Tab' && selected) {
|
9600
|
+
return;
|
9597
9601
|
} else if (isAriaSelectionKey(event)) {
|
9598
9602
|
setValue(value);
|
9599
9603
|
}
|
@@ -10032,6 +10036,18 @@ const getIndexOfFirstChildOverflowingParent = (element, overscan = 0) => {
|
|
10032
10036
|
}
|
10033
10037
|
return boundaryChildIndex;
|
10034
10038
|
};
|
10039
|
+
const getNextFocussableElement = currentElement => {
|
10040
|
+
if (!currentElement) {
|
10041
|
+
return null;
|
10042
|
+
}
|
10043
|
+
const focussableElements = [...document.querySelectorAll('button:not([disabled]), [href]:not(link):not(script), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), details:not([disabled]), summary:not(:disabled)')];
|
10044
|
+
const currentElementIndex = focussableElements.indexOf(currentElement);
|
10045
|
+
// If the currentElement is not in the focussable elements list or it is the last element
|
10046
|
+
if (currentElementIndex !== -1 && currentElementIndex === focussableElements.length - 1) {
|
10047
|
+
return null;
|
10048
|
+
}
|
10049
|
+
return focussableElements[currentElementIndex + 1];
|
10050
|
+
};
|
10035
10051
|
|
10036
10052
|
const Trigger$7 = /*#__PURE__*/React__default.forwardRef(function Select2Trigger(props, ref) {
|
10037
10053
|
const {
|
@@ -10360,6 +10376,7 @@ const BubbleSelect = props => {
|
|
10360
10376
|
|
10361
10377
|
const Search$1 = /*#__PURE__*/React__default.forwardRef(function ListboxSearch(props, ref) {
|
10362
10378
|
const {
|
10379
|
+
onTabKeyPress,
|
10363
10380
|
...otherProps
|
10364
10381
|
} = props;
|
10365
10382
|
const {
|
@@ -10384,7 +10401,7 @@ const Search$1 = /*#__PURE__*/React__default.forwardRef(function ListboxSearch(p
|
|
10384
10401
|
// Select2 should close dropdown and receive focus, when user press Tab while searching (UX requirement to support better keyboard navigation)
|
10385
10402
|
if (event.key === 'Tab') {
|
10386
10403
|
setOpen(false);
|
10387
|
-
|
10404
|
+
onTabKeyPress();
|
10388
10405
|
}
|
10389
10406
|
if (isAriaSelectionKey(event) || event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
10390
10407
|
var _listboxRef$current;
|
@@ -10624,6 +10641,7 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
10624
10641
|
// align the listbox min width with the width of the input - it should never be smaller
|
10625
10642
|
const dimensions = useBoundingClientRectListener(internalRef);
|
10626
10643
|
// state
|
10644
|
+
const [tabTriggeredClose, setTabTriggeredClose] = React__default.useState(false);
|
10627
10645
|
const [open, setOpen] = React__default.useState(false);
|
10628
10646
|
const [value, _setValue] = reactUseControllableState.useControllableState({
|
10629
10647
|
// uncontrolled
|
@@ -10706,6 +10724,22 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
10706
10724
|
setShouldPauseHoverState(true);
|
10707
10725
|
}
|
10708
10726
|
};
|
10727
|
+
const handleCloseAutoFocus = event => {
|
10728
|
+
event.preventDefault();
|
10729
|
+
event.stopPropagation();
|
10730
|
+
if (tabTriggeredClose) {
|
10731
|
+
const nextFocussableElement = getNextFocussableElement(internalRef.current);
|
10732
|
+
if (nextFocussableElement) {
|
10733
|
+
// UX requirement: move focus to the next focussable element when tab key is pressed to select the value
|
10734
|
+
nextFocussableElement.focus();
|
10735
|
+
// Reset the tabTriggeredClose state
|
10736
|
+
setTabTriggeredClose(false);
|
10737
|
+
}
|
10738
|
+
} else {
|
10739
|
+
var _internalRef$current;
|
10740
|
+
(_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.focus();
|
10741
|
+
}
|
10742
|
+
};
|
10709
10743
|
const className = cn('border-grey-300 rounded border bg-white py-1.5 shadow-md outline-none', createCollectionClassName());
|
10710
10744
|
return /*#__PURE__*/React__default.createElement(Select2Context.Provider, {
|
10711
10745
|
value: context
|
@@ -10734,15 +10768,10 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
10734
10768
|
asChild: true,
|
10735
10769
|
align: "start",
|
10736
10770
|
onOpenAutoFocus: () => {
|
10737
|
-
var _internalRef$current;
|
10738
|
-
(_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.focus();
|
10739
|
-
},
|
10740
|
-
onCloseAutoFocus: event => {
|
10741
10771
|
var _internalRef$current2;
|
10742
|
-
event.preventDefault();
|
10743
|
-
event.stopPropagation();
|
10744
10772
|
(_internalRef$current2 = internalRef.current) === null || _internalRef$current2 === void 0 ? void 0 : _internalRef$current2.focus();
|
10745
10773
|
},
|
10774
|
+
onCloseAutoFocus: handleCloseAutoFocus,
|
10746
10775
|
sideOffset: 4,
|
10747
10776
|
tabIndex: -1
|
10748
10777
|
}, /*#__PURE__*/React__default.createElement("div", {
|
@@ -10752,7 +10781,8 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
10752
10781
|
}
|
10753
10782
|
}, flattenedChildren.length > 0 || onCreate ? ( /*#__PURE__*/React__default.createElement(Search$1, {
|
10754
10783
|
placeholder: onCreate ? texts.select2.searchOrCreate : texts.select2.search,
|
10755
|
-
ref: searchRef
|
10784
|
+
ref: searchRef,
|
10785
|
+
onTabKeyPress: () => setTabTriggeredClose(true)
|
10756
10786
|
})) : null, flattenedChildren.length <= 0 ? ( /*#__PURE__*/React__default.createElement("div", {
|
10757
10787
|
className: "text-grey-700 -mt-0.5 flex h-8 items-center px-2",
|
10758
10788
|
role: "presentation"
|
@@ -12897,7 +12927,7 @@ function DisplayCell(props) {
|
|
12897
12927
|
index,
|
12898
12928
|
tableRef
|
12899
12929
|
};
|
12900
|
-
}, [row.original, props.children, value, tableMeta.columnFreezing.frozenColumnIndex]);
|
12930
|
+
}, [row.original, props.children, value, tableMeta.columnFreezing.frozenColumnIndex, className]);
|
12901
12931
|
return /*#__PURE__*/React__default.createElement(MemoedDisplayCell, Object.assign({}, memoedProps, {
|
12902
12932
|
highlighted: highlighted,
|
12903
12933
|
highlightedAsCurrent: highlightedAsCurrent
|
@@ -13010,6 +13040,85 @@ function FontSize$1(props) {
|
|
13010
13040
|
}, texts.table3.fontSize.sizes.large)));
|
13011
13041
|
}
|
13012
13042
|
|
13043
|
+
var IndicatorReason;
|
13044
|
+
(function (IndicatorReason) {
|
13045
|
+
IndicatorReason["SEARCH"] = "SEARCH";
|
13046
|
+
IndicatorReason["SORTING"] = "SORTING";
|
13047
|
+
IndicatorReason["FILTER"] = "FILTER";
|
13048
|
+
})(IndicatorReason || (IndicatorReason = {}));
|
13049
|
+
const useIndicatorText = reason => {
|
13050
|
+
let title = '';
|
13051
|
+
let description = '';
|
13052
|
+
const {
|
13053
|
+
texts
|
13054
|
+
} = useLocalization();
|
13055
|
+
switch (reason) {
|
13056
|
+
case IndicatorReason.FILTER:
|
13057
|
+
title = texts.table3.editing.rowIndicator.rowWillBeHidden;
|
13058
|
+
description = texts.table3.editing.rowIndicator.rowWillMoveReasonFilter;
|
13059
|
+
break;
|
13060
|
+
case IndicatorReason.SEARCH:
|
13061
|
+
title = texts.table3.editing.rowIndicator.rowWillBeHidden;
|
13062
|
+
description = texts.table3.editing.rowIndicator.rowWillMoveReasonSearch;
|
13063
|
+
break;
|
13064
|
+
case IndicatorReason.SORTING:
|
13065
|
+
title = texts.table3.editing.rowIndicator.rowWillMove;
|
13066
|
+
description = texts.table3.editing.rowIndicator.rowWillMoveReasonSorting;
|
13067
|
+
break;
|
13068
|
+
}
|
13069
|
+
return {
|
13070
|
+
title,
|
13071
|
+
description
|
13072
|
+
};
|
13073
|
+
};
|
13074
|
+
const Indicator = ({
|
13075
|
+
reason,
|
13076
|
+
columnName,
|
13077
|
+
mountNode,
|
13078
|
+
validationErrors
|
13079
|
+
}) => {
|
13080
|
+
const container = React__default.useMemo(() => {
|
13081
|
+
const element = document.createElement('div');
|
13082
|
+
element.className += 'rounded-b-md items-center wcag-blue-500 absolute left-0 top-full ml-1 whitespace-nowrap px-1 py-0.5 text-xs font-bold shadow-sm';
|
13083
|
+
return element;
|
13084
|
+
}, []);
|
13085
|
+
const indicatorText = useIndicatorText(reason);
|
13086
|
+
const hasValidationErrorsInRow = !!validationErrors;
|
13087
|
+
React__default.useEffect(() => {
|
13088
|
+
// mountNode could be null when rows are filtered
|
13089
|
+
// Pinned columns has z-20 class assigned, which overlaps indicator element, need to add z-21 to overlap pinned columns.
|
13090
|
+
mountNode === null || mountNode === void 0 ? void 0 : mountNode.classList.add('!z-[21]', 'relative');
|
13091
|
+
mountNode === null || mountNode === void 0 ? void 0 : mountNode.appendChild(container);
|
13092
|
+
return () => {
|
13093
|
+
mountNode === null || mountNode === void 0 ? void 0 : mountNode.classList.remove('!z-[21]', 'relative');
|
13094
|
+
mountNode === null || mountNode === void 0 ? void 0 : mountNode.removeChild(container);
|
13095
|
+
};
|
13096
|
+
}, [hasValidationErrorsInRow, mountNode]);
|
13097
|
+
// Using react portal inside a react tree component is an unorthodox way, but in order to avoid much code refactoring
|
13098
|
+
// and being able to use Taco Tooltip component in side the visual indicator, portal is used.
|
13099
|
+
return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React__default.createElement(Tooltip, {
|
13100
|
+
title: indicatorText.description.replace('[COLUMN]', columnName)
|
13101
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
13102
|
+
className: "flex gap-1 hover:cursor-pointer"
|
13103
|
+
}, /*#__PURE__*/React__default.createElement(Icon, {
|
13104
|
+
name: "info",
|
13105
|
+
className: "!h-4 !w-4 rounded-full bg-white !p-0 text-blue-500"
|
13106
|
+
}), indicatorText.title)), container);
|
13107
|
+
};
|
13108
|
+
/**
|
13109
|
+
* Generates class names needed to highlight row cells, used when row has a move indicator
|
13110
|
+
*/
|
13111
|
+
function getIndicatorCellClassName(columnIndex, lastColumnIndex) {
|
13112
|
+
return cn('!border-blue !border-y-2 border-x-0', {
|
13113
|
+
'border-l-2 rounded-l': columnIndex === 0,
|
13114
|
+
'border-r-2 rounded-r': columnIndex === lastColumnIndex
|
13115
|
+
});
|
13116
|
+
}
|
13117
|
+
function isIndicatorVisible(rowIndex, rowActiveIndex, rowMoveReason) {
|
13118
|
+
const isActiveRow = rowActiveIndex === rowIndex;
|
13119
|
+
return isActiveRow && rowMoveReason;
|
13120
|
+
}
|
13121
|
+
|
13013
13122
|
const COLUMN_ID = '__actions';
|
13014
13123
|
const MemoedCell = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
|
13015
13124
|
const {
|
@@ -13054,7 +13163,7 @@ const MemoedCell = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
|
|
13054
13163
|
// Adjust negative margin on row actions cell to ensure that the cell aligns vertically.
|
13055
13164
|
'-mt-2': fontSize === FONT_SIZE.small,
|
13056
13165
|
'-mt-1.5': fontSize !== FONT_SIZE.small
|
13057
|
-
});
|
13166
|
+
}, props.className);
|
13058
13167
|
content = /*#__PURE__*/React__default.createElement("span", {
|
13059
13168
|
className: className,
|
13060
13169
|
ref: ref
|
@@ -13089,9 +13198,13 @@ function Cell(context) {
|
|
13089
13198
|
rowIndex
|
13090
13199
|
} = React__default.useContext(RowContext);
|
13091
13200
|
const tableMeta = context.table.options.meta;
|
13201
|
+
const allVisibleColumns = context.table.getVisibleLeafColumns();
|
13202
|
+
const lastColumnIndex = allVisibleColumns.length > 0 ? allVisibleColumns.length - 1 : 0;
|
13203
|
+
const className = isIndicatorVisible(rowIndex, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.rowMoveReason) ? getIndicatorCellClassName(context.index, lastColumnIndex) : undefined;
|
13092
13204
|
return /*#__PURE__*/React__default.createElement(MemoedCell, Object.assign({}, context, {
|
13093
13205
|
actions: tableMeta.rowActions.actionsForRow,
|
13094
13206
|
actionsLength: tableMeta.rowActions.actionsForRowLength,
|
13207
|
+
className: className,
|
13095
13208
|
fontSize: tableMeta.fontSize.size,
|
13096
13209
|
isActiveRow: tableMeta.rowActive.rowActiveIndex === rowIndex,
|
13097
13210
|
isEditing: tableMeta.editing.isEditing,
|
@@ -13526,8 +13639,9 @@ function useLazyEffect(effect, deps) {
|
|
13526
13639
|
}
|
13527
13640
|
|
13528
13641
|
function useTableRowSelectionListener(table, onRowSelect) {
|
13529
|
-
const
|
13642
|
+
const rowSelection = table.getState().rowSelection;
|
13530
13643
|
useLazyEffect(() => {
|
13644
|
+
const selectedRows = table.getSelectedRowModel().rows;
|
13531
13645
|
if (table.options.enableRowSelection && typeof onRowSelect === 'function') {
|
13532
13646
|
if (table.options.enableMultiRowSelection) {
|
13533
13647
|
onRowSelect(selectedRows.map(row => row.original));
|
@@ -13536,7 +13650,11 @@ function useTableRowSelectionListener(table, onRowSelect) {
|
|
13536
13650
|
onRowSelect((_ref = [(_selectedRows$ = selectedRows[0]) === null || _selectedRows$ === void 0 ? void 0 : _selectedRows$.original]) !== null && _ref !== void 0 ? _ref : []);
|
13537
13651
|
}
|
13538
13652
|
}
|
13539
|
-
|
13653
|
+
// It is important to stringify either rowSelection state or selectedRows, because we don't
|
13654
|
+
// know if the array or object that is returned by react-table has the same reference or not.
|
13655
|
+
// rowSelection state is used here because it will be more expensive to strigify selectedRows
|
13656
|
+
// than rowSelection state.
|
13657
|
+
}, [table.options.enableRowSelection, table.options.enableMultiRowSelection, JSON.stringify(rowSelection)]);
|
13540
13658
|
}
|
13541
13659
|
|
13542
13660
|
function useRowDrag(isEnabled) {
|
@@ -13907,72 +14025,6 @@ function useRowDrop(isEnabled, handler) {
|
|
13907
14025
|
};
|
13908
14026
|
}
|
13909
14027
|
|
13910
|
-
var IndicatorReason;
|
13911
|
-
(function (IndicatorReason) {
|
13912
|
-
IndicatorReason["SEARCH"] = "SEARCH";
|
13913
|
-
IndicatorReason["SORTING"] = "SORTING";
|
13914
|
-
IndicatorReason["FILTER"] = "FILTER";
|
13915
|
-
})(IndicatorReason || (IndicatorReason = {}));
|
13916
|
-
const useIndicatorText = reason => {
|
13917
|
-
let title = '';
|
13918
|
-
let description = '';
|
13919
|
-
const {
|
13920
|
-
texts
|
13921
|
-
} = useLocalization();
|
13922
|
-
switch (reason) {
|
13923
|
-
case IndicatorReason.FILTER:
|
13924
|
-
title = texts.table3.editing.rowIndicator.rowWillBeHidden;
|
13925
|
-
description = texts.table3.editing.rowIndicator.rowWillMoveReasonFilter;
|
13926
|
-
break;
|
13927
|
-
case IndicatorReason.SEARCH:
|
13928
|
-
title = texts.table3.editing.rowIndicator.rowWillBeHidden;
|
13929
|
-
description = texts.table3.editing.rowIndicator.rowWillMoveReasonSearch;
|
13930
|
-
break;
|
13931
|
-
case IndicatorReason.SORTING:
|
13932
|
-
title = texts.table3.editing.rowIndicator.rowWillMove;
|
13933
|
-
description = texts.table3.editing.rowIndicator.rowWillMoveReasonSorting;
|
13934
|
-
break;
|
13935
|
-
}
|
13936
|
-
return {
|
13937
|
-
title,
|
13938
|
-
description
|
13939
|
-
};
|
13940
|
-
};
|
13941
|
-
const Indicator = ({
|
13942
|
-
reason,
|
13943
|
-
columnName,
|
13944
|
-
mountNode,
|
13945
|
-
validationErrors
|
13946
|
-
}) => {
|
13947
|
-
const container = React__default.useMemo(() => {
|
13948
|
-
const element = document.createElement('div');
|
13949
|
-
element.className += 'rounded-b-md items-center wcag-blue-500 absolute left-0 top-full ml-1 whitespace-nowrap px-1 py-0.5 text-xs font-bold shadow-sm';
|
13950
|
-
return element;
|
13951
|
-
}, []);
|
13952
|
-
const indicatorText = useIndicatorText(reason);
|
13953
|
-
const hasValidationErrorsInRow = !!validationErrors;
|
13954
|
-
React__default.useEffect(() => {
|
13955
|
-
// mountNode could be null when rows are filtered
|
13956
|
-
// Pinned columns has z-20 class assigned, which overlaps indicator element, need to add z-21 to overlap pinned columns.
|
13957
|
-
mountNode === null || mountNode === void 0 ? void 0 : mountNode.classList.add('!z-[21]', 'relative');
|
13958
|
-
mountNode === null || mountNode === void 0 ? void 0 : mountNode.appendChild(container);
|
13959
|
-
return () => {
|
13960
|
-
mountNode === null || mountNode === void 0 ? void 0 : mountNode.classList.remove('!z-[21]', 'relative');
|
13961
|
-
mountNode === null || mountNode === void 0 ? void 0 : mountNode.removeChild(container);
|
13962
|
-
};
|
13963
|
-
}, [hasValidationErrorsInRow, mountNode]);
|
13964
|
-
// Using react portal inside a react tree component is an unorthodox way, but in order to avoid much code refactoring
|
13965
|
-
// and being able to use Taco Tooltip component in side the visual indicator, portal is used.
|
13966
|
-
return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React__default.createElement(Tooltip, {
|
13967
|
-
title: indicatorText.description.replace('[COLUMN]', columnName)
|
13968
|
-
}, /*#__PURE__*/React__default.createElement("span", {
|
13969
|
-
className: "flex gap-1 hover:cursor-pointer"
|
13970
|
-
}, /*#__PURE__*/React__default.createElement(Icon, {
|
13971
|
-
name: "info",
|
13972
|
-
className: "!h-4 !w-4 rounded-full bg-white !p-0 text-blue-500"
|
13973
|
-
}), indicatorText.title)), container);
|
13974
|
-
};
|
13975
|
-
|
13976
14028
|
const focussableNodeNames = ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT', 'DETAILS'];
|
13977
14029
|
const focusableSelector = /*#__PURE__*/focussableNodeNames.join(', ');
|
13978
14030
|
const hasChanged = (value, newValue) => {
|
@@ -14627,10 +14679,11 @@ const COLUMN_ID$1 = '__editing_actions';
|
|
14627
14679
|
const MemoedCell$1 = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
|
14628
14680
|
var _column$columnDef$met;
|
14629
14681
|
const {
|
14682
|
+
className,
|
14683
|
+
editing,
|
14630
14684
|
hasChanges,
|
14631
14685
|
isActiveRow,
|
14632
14686
|
row,
|
14633
|
-
editing,
|
14634
14687
|
rowIdentifier,
|
14635
14688
|
table
|
14636
14689
|
} = props;
|
@@ -14724,7 +14777,7 @@ const MemoedCell$1 = /*#__PURE__*/React__default.memo(function MemoedCell(props)
|
|
14724
14777
|
'-mb-2 -mt-2': isActiveRow
|
14725
14778
|
});
|
14726
14779
|
return /*#__PURE__*/React__default.createElement(DisplayCell, Object.assign({}, props, {
|
14727
|
-
className: cn({
|
14780
|
+
className: cn(className, {
|
14728
14781
|
'!sticky': !!content
|
14729
14782
|
})
|
14730
14783
|
}), content ? /*#__PURE__*/React__default.createElement("span", {
|
@@ -14737,10 +14790,14 @@ function Cell$1(props) {
|
|
14737
14790
|
} = React__default.useContext(RowContext);
|
14738
14791
|
const tableMeta = props.table.options.meta;
|
14739
14792
|
const changeset = tableMeta.editing.changes ? Object.keys(tableMeta.editing.changes) : [];
|
14793
|
+
const allVisibleColumns = props.table.getVisibleLeafColumns();
|
14794
|
+
const lastColumnIndex = allVisibleColumns.length > 0 ? allVisibleColumns.length - 1 : 0;
|
14795
|
+
const className = isIndicatorVisible(rowIndex, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.rowMoveReason) ? getIndicatorCellClassName(props.index, lastColumnIndex) : undefined;
|
14740
14796
|
return /*#__PURE__*/React__default.createElement(MemoedCell$1, Object.assign({}, props, {
|
14797
|
+
className: className,
|
14798
|
+
editing: tableMeta.editing,
|
14741
14799
|
hasChanges: changeset.indexOf(props.row.id) >= 0,
|
14742
|
-
isActiveRow: tableMeta.rowActive.rowActiveIndex === rowIndex
|
14743
|
-
editing: tableMeta.editing
|
14800
|
+
isActiveRow: tableMeta.rowActive.rowActiveIndex === rowIndex
|
14744
14801
|
}));
|
14745
14802
|
}
|
14746
14803
|
const EDITING_ACTIONS_WIDTH = 60;
|
@@ -15197,7 +15254,10 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
|
|
15197
15254
|
React__default.useEffect(() => {
|
15198
15255
|
// To avoid reseting move reason on another row hover,
|
15199
15256
|
// we need to check for changes only if value got changed in the current row.
|
15200
|
-
if (!isActiveRow
|
15257
|
+
if (!isActiveRow) {
|
15258
|
+
return;
|
15259
|
+
}
|
15260
|
+
if (error) {
|
15201
15261
|
if (tableMeta.editing.rowMoveReason) {
|
15202
15262
|
removeMoveReason();
|
15203
15263
|
}
|
@@ -15207,9 +15267,11 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
|
|
15207
15267
|
const moveReason = getRowMoveReason(table, rowIndex,
|
15208
15268
|
// cannot use row.index, as this is not kept in sync once a column is sorted.
|
15209
15269
|
row.original, cell, value, tableMeta.search.excludeUnmatchedResults);
|
15210
|
-
|
15211
|
-
|
15212
|
-
|
15270
|
+
if (moveReason) {
|
15271
|
+
tableMeta.editing.setRowMoveReason({
|
15272
|
+
[cell.column.id]: moveReason
|
15273
|
+
});
|
15274
|
+
}
|
15213
15275
|
} else {
|
15214
15276
|
removeMoveReason();
|
15215
15277
|
}
|
@@ -15219,7 +15281,7 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
|
|
15219
15281
|
const className = cn('py-[calc(var(--table3-cell-padding-y)_-_0.06rem)]', {
|
15220
15282
|
// Textarea control is positioned absolute, when column is in enableTruncate mode, so the cell need to be positioned relative
|
15221
15283
|
relative: controlRenderer === 'textarea' && columnMeta.enableTruncate
|
15222
|
-
}, typeof columnMeta.className === 'function' ? columnMeta.className(row.original) : columnMeta.className);
|
15284
|
+
}, props.className, typeof columnMeta.className === 'function' ? columnMeta.className(row.original) : columnMeta.className);
|
15223
15285
|
const fieldClassName = cn('!min-h-0 w-full !pb-0', {
|
15224
15286
|
'!pb-3': !!error
|
15225
15287
|
});
|
@@ -15302,7 +15364,8 @@ function Cell$2(props) {
|
|
15302
15364
|
} = props;
|
15303
15365
|
const {
|
15304
15366
|
isHovered: isHoveredRow,
|
15305
|
-
hasError
|
15367
|
+
hasError,
|
15368
|
+
rowIndex
|
15306
15369
|
} = useRowContext();
|
15307
15370
|
const rows = table.getRowModel().rows;
|
15308
15371
|
const tableMeta = table.options.meta;
|
@@ -15312,15 +15375,15 @@ function Cell$2(props) {
|
|
15312
15375
|
const rowActiveIndex = tableMeta.rowActive.rowActiveIndex;
|
15313
15376
|
const isActiveRow = rowActiveIndex !== undefined && ((_rows$rowActiveIndex = rows[rowActiveIndex]) === null || _rows$rowActiveIndex === void 0 ? void 0 : _rows$rowActiveIndex.id) === row.id;
|
15314
15377
|
let value = getValue();
|
15378
|
+
const allVisibleColumns = table.getVisibleLeafColumns();
|
15379
|
+
const lastColumnIndex = allVisibleColumns.length > 0 ? allVisibleColumns.length - 1 : 0;
|
15380
|
+
const className = isIndicatorVisible(rowIndex, rowActiveIndex, tableMeta.editing.rowMoveReason) ? getIndicatorCellClassName(index, lastColumnIndex) : undefined;
|
15315
15381
|
// When row has changes we always need to show the editing state value, end revert it to original value only when row got saved successfully.
|
15316
15382
|
// Otherwise it might confuse user because it will look like display value is getting reverted everytime user leaves the row.
|
15317
15383
|
if (tableMeta.editing.isEditing) {
|
15318
15384
|
const editingValue = tableMeta.editing.getCellValue(cell);
|
15319
15385
|
value = editingValue !== null && editingValue !== void 0 ? editingValue : value;
|
15320
15386
|
}
|
15321
|
-
const {
|
15322
|
-
rowIndex
|
15323
|
-
} = React__default.useContext(RowContext);
|
15324
15387
|
const memoedHighlight = React__default.useMemo(() => {
|
15325
15388
|
var _tableMeta$search$que;
|
15326
15389
|
if (!tableMeta.search.isHighlightingEnabled || !columnMeta.enableSearch) {
|
@@ -15348,10 +15411,13 @@ function Cell$2(props) {
|
|
15348
15411
|
if (tableMeta.editing.isEditing && columnMeta.control && (isActiveRow || isHoveredRow && !tableMeta.rowActive.isHoverStatePaused ||
|
15349
15412
|
// When cell has error, we renderimg it in edit mode (UX reqirement)
|
15350
15413
|
isColumnError)) {
|
15351
|
-
return /*#__PURE__*/React__default.createElement(EditingCell, Object.assign({}, props, highlightProps
|
15414
|
+
return /*#__PURE__*/React__default.createElement(EditingCell, Object.assign({}, props, highlightProps, {
|
15415
|
+
className: className
|
15416
|
+
}));
|
15352
15417
|
}
|
15353
15418
|
return /*#__PURE__*/React__default.createElement(DisplayCell, Object.assign({}, props, highlightProps, {
|
15354
|
-
value: value
|
15419
|
+
value: value,
|
15420
|
+
className: className
|
15355
15421
|
}));
|
15356
15422
|
}
|
15357
15423
|
|
@@ -16695,11 +16761,14 @@ function Search$2(props) {
|
|
16695
16761
|
setQuery(String(query !== null && query !== void 0 ? query : ''));
|
16696
16762
|
};
|
16697
16763
|
const handleClear = () => {
|
16698
|
-
|
16764
|
+
var _tableMeta$search$cur, _tableMeta$search$hig;
|
16765
|
+
const highlightedColumnIndex = (_tableMeta$search$cur = tableMeta.search.currentHighlightColumnIndex) !== null && _tableMeta$search$cur !== void 0 ? _tableMeta$search$cur : 0;
|
16766
|
+
const highlightedCell = (_tableMeta$search$hig = tableMeta.search.highlightedColumnIndexes[highlightedColumnIndex]) !== null && _tableMeta$search$hig !== void 0 ? _tableMeta$search$hig : [];
|
16767
|
+
const [rowIndex = null, columnIndex = null] = highlightedCell;
|
16699
16768
|
const rows = table.getRowModel().rows;
|
16700
16769
|
tableMeta.search.setQuery('');
|
16701
16770
|
// Need to save row id and cell index, to be able to find the row in the table with updated indexes, after global filter will be reset.
|
16702
|
-
lastCellIndex.value = String(
|
16771
|
+
lastCellIndex.value = String(columnIndex);
|
16703
16772
|
if (rowIndex !== null) {
|
16704
16773
|
var _rows$rowIndex;
|
16705
16774
|
const rowId = ((_rows$rowIndex = rows[rowIndex]) === null || _rows$rowIndex === void 0 ? void 0 : _rows$rowIndex.id) || null;
|
@@ -17056,7 +17125,6 @@ function FilterValue(props) {
|
|
17056
17125
|
}));
|
17057
17126
|
}
|
17058
17127
|
return /*#__PURE__*/React__default.createElement(Control, {
|
17059
|
-
comparator: comparator,
|
17060
17128
|
column: column,
|
17061
17129
|
onChange: handleChange,
|
17062
17130
|
value: value
|
@@ -17066,7 +17134,6 @@ function Control(props) {
|
|
17066
17134
|
var _column$columnDef$met2, _column$columnDef$met3;
|
17067
17135
|
const {
|
17068
17136
|
column,
|
17069
|
-
comparator,
|
17070
17137
|
onChange,
|
17071
17138
|
value,
|
17072
17139
|
...attributes
|
@@ -17133,9 +17200,19 @@ function Filter$1(props) {
|
|
17133
17200
|
}
|
17134
17201
|
} = filter;
|
17135
17202
|
const handleChangeColumn = columnId => {
|
17203
|
+
var _columnPrev$columnDef, _columnNext$columnDef;
|
17204
|
+
const columnPrev = allColumns.find(column => column.id === id);
|
17205
|
+
const columnNext = allColumns.find(column => column.id === columnId);
|
17206
|
+
// UX requirement: if old column data type is the same as next column data type,
|
17207
|
+
// then we applying the same filter value for the next column,
|
17208
|
+
// but when data types are different, we're reseting comparator ans value for the next column
|
17209
|
+
const value = (columnPrev === null || columnPrev === void 0 ? void 0 : (_columnPrev$columnDef = columnPrev.columnDef.meta) === null || _columnPrev$columnDef === void 0 ? void 0 : _columnPrev$columnDef.dataType) === (columnNext === null || columnNext === void 0 ? void 0 : (_columnNext$columnDef = columnNext.columnDef.meta) === null || _columnNext$columnDef === void 0 ? void 0 : _columnNext$columnDef.dataType) ? filter.value : {
|
17210
|
+
comparator: null,
|
17211
|
+
value: null
|
17212
|
+
};
|
17136
17213
|
handleChange(id, {
|
17137
17214
|
id: columnId,
|
17138
|
-
value
|
17215
|
+
value
|
17139
17216
|
});
|
17140
17217
|
};
|
17141
17218
|
const handleChangeComparator = comparator => {
|
@@ -18173,7 +18250,7 @@ function Toolbar(props) {
|
|
18173
18250
|
}
|
18174
18251
|
const tableMeta = table.options.meta;
|
18175
18252
|
return /*#__PURE__*/React__default.createElement("div", {
|
18176
|
-
className: "mb-4 flex flex-shrink flex-grow-0 flex-wrap gap-2",
|
18253
|
+
className: "mb-4 flex flex-shrink flex-grow-0 flex-wrap gap-2 empty:hidden",
|
18177
18254
|
"data-taco": "table3-toolbar"
|
18178
18255
|
}, left, /*#__PURE__*/React__default.createElement(Group, {
|
18179
18256
|
className: "ml-auto flex-shrink-0 print:hidden"
|
@@ -18437,7 +18514,7 @@ function ErrorAlert(props) {
|
|
18437
18514
|
// Getting the row from core rows (ignoring search and filtering)
|
18438
18515
|
const getCoreRow = React__default.useCallback(rowId => coreRows.find(coreRow => coreRow.id === rowId), [coreRows]);
|
18439
18516
|
return /*#__PURE__*/React__default.createElement("div", {
|
18440
|
-
className: "mb-4"
|
18517
|
+
className: "mb-4 empty:hidden"
|
18441
18518
|
}, errorsRowIds.length ? ( /*#__PURE__*/React__default.createElement(Alert, {
|
18442
18519
|
state: "error",
|
18443
18520
|
className: "mb-1"
|