@economic/taco 2.33.0 → 2.34.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. package/dist/components/Table3/Table3.d.ts +3 -19
  2. package/dist/components/Table3/types.d.ts +2 -11
  3. package/dist/esm/index.css +4 -4
  4. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +4 -5
  5. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
  6. package/dist/esm/packages/taco/src/components/Menu/components/Trigger.js +9 -7
  7. package/dist/esm/packages/taco/src/components/Menu/components/Trigger.js.map +1 -1
  8. package/dist/esm/packages/taco/src/components/Select2/Select2.js +3 -1
  9. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  10. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  11. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js +2 -1
  12. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
  13. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +3 -24
  14. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
  15. package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js +1 -1
  16. package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js.map +1 -1
  17. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +0 -1
  18. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
  19. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +1 -0
  20. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
  21. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/Body.js +21 -1
  22. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/Body.js.map +1 -1
  23. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.js +12 -3
  24. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.js.map +1 -1
  25. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.js +3 -47
  26. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.js.map +1 -1
  27. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/util.js +44 -1
  28. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/util.js.map +1 -1
  29. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +1 -1
  30. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
  31. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  32. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js +5 -5
  33. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js.map +1 -1
  34. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +1 -2
  35. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
  36. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +0 -9
  37. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  38. package/dist/esm/packages/taco/src/utils/dom.js +4 -1
  39. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  40. package/dist/index.css +4 -4
  41. package/dist/primitives/Table/Core/components/Body/Body.d.ts +2 -0
  42. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/util.d.ts +2 -1
  43. package/dist/primitives/Table/types.d.ts +1 -1
  44. package/dist/primitives/Table/useTableManager/useTableManager.d.ts +1 -1
  45. package/dist/taco.cjs.development.js +102 -107
  46. package/dist/taco.cjs.development.js.map +1 -1
  47. package/dist/taco.cjs.production.min.js +1 -1
  48. package/dist/taco.cjs.production.min.js.map +1 -1
  49. package/dist/utils/dom.d.ts +1 -0
  50. package/package.json +2 -2
@@ -4122,6 +4122,9 @@ function isElementInteractive(element) {
4122
4122
  }
4123
4123
  return ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT', 'LABEL', 'OPTION'].includes(element.tagName) && !element.hidden && !element.disabled && !element.readOnly;
4124
4124
  }
4125
+ function isElementInsideTable3OrReport(element) {
4126
+ return !!(element !== null && element !== void 0 && element.closest('[data-taco^=table]'));
4127
+ }
4125
4128
 
4126
4129
  function isPressingMetaKey(event) {
4127
4130
  return isMacOs() ? event.metaKey : event.ctrlKey;
@@ -5823,9 +5826,7 @@ const useCombobox = ({
5823
5826
  }
5824
5827
  };
5825
5828
  const handleInputKeyDown = event => {
5826
- var _inputRef$current;
5827
5829
  event.persist();
5828
- const insideTheTable = !!((_inputRef$current = inputRef.current) !== null && _inputRef$current !== void 0 && _inputRef$current.closest('table, [role="rowgroup"]'));
5829
5830
  if (!event.ctrlKey && !event.metaKey) {
5830
5831
  switch (event.key) {
5831
5832
  case 'Backspace':
@@ -5847,7 +5848,7 @@ const useCombobox = ({
5847
5848
  }
5848
5849
  case 'Enter':
5849
5850
  {
5850
- if (insideTheTable) {
5851
+ if (isElementInsideTable3OrReport(event.currentTarget)) {
5851
5852
  event.preventDefault();
5852
5853
  if (inline && !open) {
5853
5854
  setOpen(true);
@@ -5865,7 +5866,7 @@ const useCombobox = ({
5865
5866
  if (open) {
5866
5867
  event.preventDefault();
5867
5868
  } else {
5868
- if (!inline && buttonRef.current && !insideTheTable) {
5869
+ if (!inline && buttonRef.current && !isElementInsideTable3OrReport(event.currentTarget)) {
5869
5870
  buttonRef.current.click();
5870
5871
  }
5871
5872
  }
@@ -5885,7 +5886,7 @@ const useCombobox = ({
5885
5886
  listRef.current.dispatchEvent(createCustomKeyboardEvent(event));
5886
5887
  }
5887
5888
  if (inline && !open) {
5888
- if ((event.key === 'ArrowUp' || event.key === 'ArrowDown') && !insideTheTable) {
5889
+ if ((event.key === 'ArrowUp' || event.key === 'ArrowDown') && !isElementInsideTable3OrReport(event.currentTarget)) {
5889
5890
  event.preventDefault();
5890
5891
  const initialIndex = event.key === 'ArrowUp' ? data.length - 1 : 0;
5891
5892
  setCurrentIndex(currentIndex !== undefined ? currentIndex : initialIndex);
@@ -8194,12 +8195,13 @@ const Link$1 = /*#__PURE__*/React.forwardRef(function MenuLink(props, ref) {
8194
8195
  const Trigger$6 = /*#__PURE__*/React.forwardRef(function MenuTrigger(props, ref) {
8195
8196
  const menu = useCurrentMenu();
8196
8197
  const internalRef = useMergedRef(ref);
8197
- const preventArrowDownShortcut = event => {
8198
- var _internalRef$current;
8199
- const isRenderedInTable = !!((_internalRef$current = internalRef.current) !== null && _internalRef$current !== void 0 && _internalRef$current.closest('tbody'));
8200
- if (isRenderedInTable && event.key === 'ArrowDown') {
8201
- var _internalRef$current2, _internalRef$current3;
8202
- internalRef === null || internalRef === void 0 ? void 0 : (_internalRef$current2 = internalRef.current) === null || _internalRef$current2 === void 0 ? void 0 : (_internalRef$current3 = _internalRef$current2.parentNode) === null || _internalRef$current3 === void 0 ? void 0 : _internalRef$current3.dispatchEvent(createCustomKeyboardEvent(event));
8198
+ const handleKeyDown = event => {
8199
+ if (event.key === 'ArrowDown') {
8200
+ if (isElementInsideTable3OrReport(event.currentTarget)) {
8201
+ var _event$currentTarget$;
8202
+ event.preventDefault();
8203
+ (_event$currentTarget$ = event.currentTarget.parentNode) === null || _event$currentTarget$ === void 0 ? void 0 : _event$currentTarget$.dispatchEvent(createCustomKeyboardEvent(event));
8204
+ }
8203
8205
  }
8204
8206
  };
8205
8207
  React.useEffect(() => {
@@ -8210,7 +8212,7 @@ const Trigger$6 = /*#__PURE__*/React.forwardRef(function MenuTrigger(props, ref)
8210
8212
  return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Trigger, Object.assign({}, props, {
8211
8213
  asChild: true,
8212
8214
  ref: internalRef,
8213
- onKeyDown: preventArrowDownShortcut
8215
+ onKeyDown: handleKeyDown
8214
8216
  }));
8215
8217
  });
8216
8218
 
@@ -10060,13 +10062,6 @@ function mapTableChildrenToColumns(props, settings, options, internalColumns) {
10060
10062
  function configureReactTableOptions(options, props) {
10061
10063
  var _options$enableFilter, _options$enableColumn, _options$enableRowExp, _options$enableColumn2, _options$enableColumn3, _options$enableSortin;
10062
10064
  const enableRowSelection = options.enableRowSelection || options.enableRowSelectionSingle;
10063
- const getRowIdentityColumnId = () => {
10064
- if (!props.rowIdentityColumnId) {
10065
- return undefined;
10066
- }
10067
- const rowIdentityColumnIds = [props.rowIdentityColumnId].flat();
10068
- return originalRow => rowIdentityColumnIds.map(identityColumnId => String(originalRow[identityColumnId])).join('_');
10069
- };
10070
10065
  const tableOptions = {
10071
10066
  defaultColumn: {
10072
10067
  enableColumnFilter: options.enableFiltering || true,
@@ -10091,8 +10086,6 @@ function configureReactTableOptions(options, props) {
10091
10086
  // models for default features
10092
10087
  getExpandedRowModel: reactTable.getExpandedRowModel(),
10093
10088
  getGroupedRowModel: reactTable.getGroupedRowModel(),
10094
- // Use row indentity column values as id for each row
10095
- getRowId: getRowIdentityColumnId(),
10096
10089
  groupedColumnMode: false
10097
10090
  };
10098
10091
  if (tableOptions.enableColumnResizing) {
@@ -10446,11 +10439,11 @@ function useTableRowActive(isEnabled = false, initialRowActiveIndex) {
10446
10439
  const [rowActiveIndex, setRowActiveIndex] = React__default.useState(initialRowActiveIndex);
10447
10440
  const [rowHoverIndex, setRowHoverIndex] = React__default.useState(undefined);
10448
10441
  const [isHoverStatePaused, setHoverStatePaused] = useIsHoverStatePaused();
10449
- const move = (direction, length, scrollToIndex) => setRowActiveIndex(currentIndex => {
10450
- const nextIndex = currentIndex !== undefined ? getNextIndex(direction, currentIndex, length) : 0;
10451
- setTimeout(() => scrollToIndex(nextIndex), 1);
10452
- return nextIndex;
10453
- });
10442
+ const move = (direction, length, scrollToIndex) => {
10443
+ const nextIndex = rowActiveIndex !== undefined ? getNextIndex(direction, rowActiveIndex, length) : 0;
10444
+ scrollToIndex(nextIndex);
10445
+ setTimeout(() => setRowActiveIndex(nextIndex), 50);
10446
+ };
10454
10447
  const onKeyDown = React__default.useCallback((event, length, scrollToIndex) => {
10455
10448
  if (!isEnabled || event.defaultPrevented) {
10456
10449
  return;
@@ -11268,7 +11261,6 @@ function useTableManager(props, meta, internalColumns) {
11268
11261
  // ensure data is always valid
11269
11262
  const data = (_props$data = props.data) !== null && _props$data !== void 0 ? _props$data : [];
11270
11263
  const length = (_props$length = props.length) !== null && _props$length !== void 0 ? _props$length : data.length;
11271
- const rowIdentityColumnId = props.rowIdentityColumnId !== undefined ? [props.rowIdentityColumnId].flat() : [];
11272
11264
  // create a react-table instance
11273
11265
  const instance = reactTable.useReactTable({
11274
11266
  data,
@@ -11296,7 +11288,7 @@ function useTableManager(props, meta, internalColumns) {
11296
11288
  rowDrag,
11297
11289
  rowDrop: rowDrop,
11298
11290
  rowExpansion: rowExpansion,
11299
- rowIdentityColumnId,
11291
+ rowIdentityColumnId: props.rowIdentityColumnId,
11300
11292
  rowGoto,
11301
11293
  rowGroups: rowGroups,
11302
11294
  rowHeight,
@@ -11673,7 +11665,7 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex) {
11673
11665
  } = useRowHeightVirtualisation(table);
11674
11666
  // row groups
11675
11667
  const rangeExtractor = useRowGroupVirtualisation(table);
11676
- // account for thead and tfoot in the scroll area
11668
+ // account for thead and tfoot in the scroll area - both are always medium row height
11677
11669
  const scrollPaddingStart = ROW_HEIGHT_ESTIMATES.medium;
11678
11670
  // column groups offset the bottom padding :shrug:, multiplying by 1.5 ensures the bottom padding remains
11679
11671
  // consistent when there are groups and when there aren't. 1.5 is relatively arbitrary, but it gives alignment
@@ -13131,6 +13123,7 @@ function Body(props) {
13131
13123
  enableHorizontalArrowKeyNavigation = false,
13132
13124
  scrollToIndex,
13133
13125
  table,
13126
+ tableElement,
13134
13127
  ...attributes
13135
13128
  } = props;
13136
13129
  const ref = React__default.useRef(null);
@@ -13148,12 +13141,30 @@ function Body(props) {
13148
13141
  return;
13149
13142
  }
13150
13143
  tableMeta.rowActive.setHoverStatePaused(true);
13151
- const focusedElement = event.shiftKey || event.key === 'ArrowLeft' ? focusManager.focusPrevious() : focusManager.focusNext();
13144
+ const isMetaKeyPressed = isPressingMetaKey(event);
13145
+ let focusedElement;
13146
+ switch (event.key) {
13147
+ case 'ArrowLeft':
13148
+ focusedElement = isMetaKeyPressed ? focusManager.focusFirst() : focusManager.focusPrevious();
13149
+ break;
13150
+ case 'ArrowRight':
13151
+ focusedElement = isMetaKeyPressed ? focusManager.focusLast() : focusManager.focusNext();
13152
+ // Scrolls table all the way to the right
13153
+ if (isMetaKeyPressed && tableElement) {
13154
+ tableElement.scrollLeft = tableElement.scrollWidth;
13155
+ }
13156
+ break;
13157
+ default:
13158
+ focusedElement = event.shiftKey ? focusManager.focusPrevious() : focusManager.focusNext();
13159
+ break;
13160
+ }
13152
13161
  if (focusedElement) {
13153
13162
  // override default behaviour, since we're handling focus internally now
13154
13163
  event.preventDefault();
13155
13164
  return;
13156
13165
  }
13166
+ // The code below only executes when focusedElement was undefined/null. This happens only when arrow-left/shift+tab
13167
+ // is pressed on the first cell or arrow-right/tab is pressed on the last cell.
13157
13168
  if (event.shiftKey || event.key === 'ArrowLeft') {
13158
13169
  if (!isFirstRow) {
13159
13170
  // there are no previous elements to focus, go up a row or go outside the table
@@ -15233,6 +15244,8 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
15233
15244
  var _listboxRef$current;
15234
15245
  if (open) {
15235
15246
  event.preventDefault();
15247
+ } else if (isElementInsideTable3OrReport(event.currentTarget)) {
15248
+ return;
15236
15249
  } else if (!event.ctrlKey && !event.metaKey && (event.key === 'ArrowDown' || /^[a-z0-9]$/i.test(event.key))) {
15237
15250
  setOpen(true);
15238
15251
  }
@@ -15649,6 +15662,46 @@ function sortByHeader(a, b) {
15649
15662
  function isEmptyFilter(filter) {
15650
15663
  return !filter.value.hasOwnProperty('value'); // eslint-disable-line no-prototype-builtins
15651
15664
  }
15665
+ function guessComparatorsBasedOnControl(column) {
15666
+ var _column$columnDef$met;
15667
+ const columnMeta = (_column$columnDef$met = column === null || column === void 0 ? void 0 : column.columnDef.meta) !== null && _column$columnDef$met !== void 0 ? _column$columnDef$met : {};
15668
+ if (Array.isArray(columnMeta.filters)) {
15669
+ return columnMeta.filters;
15670
+ }
15671
+ if (typeof columnMeta.control === 'function') {
15672
+ const renderedControl = columnMeta.control({
15673
+ onBlur: () => undefined,
15674
+ onFocus: () => undefined,
15675
+ setValue: () => undefined,
15676
+ value: undefined,
15677
+ disabled: false,
15678
+ readOnly: false,
15679
+ ref: undefined
15680
+ });
15681
+ if ( /*#__PURE__*/React__default.isValidElement(renderedControl)) {
15682
+ const {
15683
+ props,
15684
+ type
15685
+ } = renderedControl;
15686
+ if (type.displayName === 'Select2') {
15687
+ if (props.multiple) {
15688
+ return [exports.TableFilterComparator.HasAnyOf, exports.TableFilterComparator.HasAllOf, exports.TableFilterComparator.IsEqualTo, exports.TableFilterComparator.HasNoneOf, exports.TableFilterComparator.IsEmpty, exports.TableFilterComparator.IsNotEmpty];
15689
+ }
15690
+ return [exports.TableFilterComparator.IsEqualTo, exports.TableFilterComparator.IsNotEqualTo, exports.TableFilterComparator.IsEmpty, exports.TableFilterComparator.IsNotEmpty];
15691
+ }
15692
+ }
15693
+ }
15694
+ if (columnMeta.dataType === 'number') {
15695
+ return [exports.TableFilterComparator.IsEqualTo, exports.TableFilterComparator.IsNotEqualTo, exports.TableFilterComparator.IsGreaterThan, exports.TableFilterComparator.IsLessThan, exports.TableFilterComparator.IsBetween, exports.TableFilterComparator.IsEmpty, exports.TableFilterComparator.IsNotEmpty];
15696
+ }
15697
+ if (columnMeta.control === 'datepicker' || columnMeta.dataType === 'datetime') {
15698
+ return [exports.TableFilterComparator.IsEqualTo, exports.TableFilterComparator.IsNotEqualTo, exports.TableFilterComparator.IsBetween, exports.TableFilterComparator.IsLessThan, exports.TableFilterComparator.IsGreaterThan, exports.TableFilterComparator.IsEmpty, exports.TableFilterComparator.IsNotEmpty, exports.TableFilterComparator.IsLessThanOrEqualTo, exports.TableFilterComparator.IsGreaterThanOrEqualTo];
15699
+ }
15700
+ if (columnMeta.control === 'switch') {
15701
+ return [exports.TableFilterComparator.IsEqualTo];
15702
+ }
15703
+ return [exports.TableFilterComparator.Contains, exports.TableFilterComparator.DoesNotContain, exports.TableFilterComparator.IsEqualTo, exports.TableFilterComparator.IsNotEqualTo, exports.TableFilterComparator.IsEmpty, exports.TableFilterComparator.IsNotEmpty];
15704
+ }
15652
15705
 
15653
15706
  const FilterColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
15654
15707
  const {
@@ -15702,11 +15755,6 @@ function FilterComparator(props) {
15702
15755
  texts
15703
15756
  } = useLocalization();
15704
15757
  const validComparators = guessComparatorsBasedOnControl(column);
15705
- React__default.useEffect(() => {
15706
- if (value === undefined || !validComparators.includes(value)) {
15707
- handleChange === null || handleChange === void 0 ? void 0 : handleChange(validComparators[0]);
15708
- }
15709
- }, [validComparators]);
15710
15758
  return /*#__PURE__*/React__default.createElement(Select2, Object.assign({}, attributes, {
15711
15759
  className: "!w-32 flex-shrink-0",
15712
15760
  disabled: !column,
@@ -15717,49 +15765,9 @@ function FilterComparator(props) {
15717
15765
  value: comparator
15718
15766
  }, getComparatorText(comparator, texts, column)))));
15719
15767
  }
15720
- function guessComparatorsBasedOnControl(column) {
15721
- var _column$columnDef$met;
15722
- const columnMeta = (_column$columnDef$met = column === null || column === void 0 ? void 0 : column.columnDef.meta) !== null && _column$columnDef$met !== void 0 ? _column$columnDef$met : {};
15723
- if (Array.isArray(columnMeta.filters)) {
15724
- return columnMeta.filters;
15725
- }
15726
- if (typeof columnMeta.control === 'function') {
15727
- const renderedControl = columnMeta.control({
15728
- onBlur: () => undefined,
15729
- onFocus: () => undefined,
15730
- setValue: () => undefined,
15731
- value: undefined,
15732
- disabled: false,
15733
- readOnly: false,
15734
- ref: undefined
15735
- });
15736
- if ( /*#__PURE__*/React__default.isValidElement(renderedControl)) {
15737
- const {
15738
- props,
15739
- type
15740
- } = renderedControl;
15741
- if (type.displayName === 'Select2') {
15742
- if (props.multiple) {
15743
- return [exports.TableFilterComparator.HasAnyOf, exports.TableFilterComparator.HasAllOf, exports.TableFilterComparator.IsEqualTo, exports.TableFilterComparator.HasNoneOf, exports.TableFilterComparator.IsEmpty, exports.TableFilterComparator.IsNotEmpty];
15744
- }
15745
- return [exports.TableFilterComparator.IsEqualTo, exports.TableFilterComparator.IsNotEqualTo, exports.TableFilterComparator.IsEmpty, exports.TableFilterComparator.IsNotEmpty];
15746
- }
15747
- }
15748
- }
15749
- if (columnMeta.dataType === 'number') {
15750
- return [exports.TableFilterComparator.IsEqualTo, exports.TableFilterComparator.IsNotEqualTo, exports.TableFilterComparator.IsGreaterThan, exports.TableFilterComparator.IsLessThan, exports.TableFilterComparator.IsBetween, exports.TableFilterComparator.IsEmpty, exports.TableFilterComparator.IsNotEmpty];
15751
- }
15752
- if (columnMeta.control === 'datepicker' || columnMeta.dataType === 'datetime') {
15753
- return [exports.TableFilterComparator.IsEqualTo, exports.TableFilterComparator.IsNotEqualTo, exports.TableFilterComparator.IsBetween, exports.TableFilterComparator.IsLessThan, exports.TableFilterComparator.IsGreaterThan, exports.TableFilterComparator.IsEmpty, exports.TableFilterComparator.IsNotEmpty, exports.TableFilterComparator.IsLessThanOrEqualTo, exports.TableFilterComparator.IsGreaterThanOrEqualTo];
15754
- }
15755
- if (columnMeta.control === 'switch') {
15756
- return [exports.TableFilterComparator.IsEqualTo];
15757
- }
15758
- return [exports.TableFilterComparator.Contains, exports.TableFilterComparator.DoesNotContain, exports.TableFilterComparator.IsEqualTo, exports.TableFilterComparator.IsNotEqualTo, exports.TableFilterComparator.IsEmpty, exports.TableFilterComparator.IsNotEmpty];
15759
- }
15760
15768
  function getComparatorText(comparator, texts, column) {
15761
- var _column$columnDef, _column$columnDef$met2;
15762
- const isDate = (column === null || column === void 0 ? void 0 : (_column$columnDef = column.columnDef) === null || _column$columnDef === void 0 ? void 0 : (_column$columnDef$met2 = _column$columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.control) === 'datepicker';
15769
+ var _column$columnDef, _column$columnDef$met;
15770
+ const isDate = (column === null || column === void 0 ? void 0 : (_column$columnDef = column.columnDef) === null || _column$columnDef === void 0 ? void 0 : (_column$columnDef$met = _column$columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.control) === 'datepicker';
15763
15771
  switch (comparator) {
15764
15772
  case exports.TableFilterComparator.Contains:
15765
15773
  return texts.table.filters.comparators.contains;
@@ -15935,14 +15943,22 @@ function Filter$1(props) {
15935
15943
  }
15936
15944
  } = filter;
15937
15945
  const handleChangeColumn = columnId => {
15938
- var _previousColumn$colum, _nextColumn$columnDef;
15946
+ var _previousColumn$colum, _previousColumn$colum2, _nextColumn$columnDef;
15939
15947
  const previousColumn = allColumns.find(column => column.id === id);
15940
15948
  const nextColumn = allColumns.find(column => column.id === columnId);
15941
15949
  // UX requirement: if old column data type is the same as next column data type,
15942
15950
  // then we applying the same filter value for the next column,
15943
15951
  // but when data types are different, we're reseting comparator ans value for the next column
15944
- const value = (previousColumn === null || previousColumn === void 0 ? void 0 : (_previousColumn$colum = previousColumn.columnDef.meta) === null || _previousColumn$colum === void 0 ? void 0 : _previousColumn$colum.dataType) === (nextColumn === null || nextColumn === void 0 ? void 0 : (_nextColumn$columnDef = nextColumn.columnDef.meta) === null || _nextColumn$columnDef === void 0 ? void 0 : _nextColumn$columnDef.dataType) ? filter.value : {
15945
- comparator: exports.TableFilterComparator.Contains,
15952
+ if (previousColumn !== null && previousColumn !== void 0 && (_previousColumn$colum = previousColumn.columnDef.meta) !== null && _previousColumn$colum !== void 0 && _previousColumn$colum.dataType && (previousColumn === null || previousColumn === void 0 ? void 0 : (_previousColumn$colum2 = previousColumn.columnDef.meta) === null || _previousColumn$colum2 === void 0 ? void 0 : _previousColumn$colum2.dataType) === (nextColumn === null || nextColumn === void 0 ? void 0 : (_nextColumn$columnDef = nextColumn.columnDef.meta) === null || _nextColumn$columnDef === void 0 ? void 0 : _nextColumn$columnDef.dataType)) {
15953
+ handleChange(position, {
15954
+ id: columnId,
15955
+ value: filter.value
15956
+ });
15957
+ return;
15958
+ }
15959
+ const validComparators = guessComparatorsBasedOnControl(nextColumn);
15960
+ const value = {
15961
+ comparator: validComparators[0],
15946
15962
  value: undefined
15947
15963
  };
15948
15964
  handleChange(position, {
@@ -16255,6 +16271,7 @@ function TableGrid(props) {
16255
16271
  }))))))), table.instance.getRowModel().rows.length ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Body, {
16256
16272
  enableHorizontalArrowKeyNavigation: enableHorizontalArrowKeyNavigation,
16257
16273
  table: table.instance,
16274
+ tableElement: table.ref.current,
16258
16275
  scrollToIndex: table.renderer.scrollToIndex,
16259
16276
  style: table.renderer.style
16260
16277
  }, table.renderer.rows), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
@@ -17890,7 +17907,6 @@ function useTableEditing(isEnabled = false, handleSave, validator) {
17890
17907
  pendingChangesFns.saveChanges();
17891
17908
  }
17892
17909
  }, [pendingChangesFns.saveChanges]);
17893
- // TODO: using useGlobalKeyDown prevents trigger when focused on inputs, but it's more "proper"
17894
17910
  useGlobalKeyDown(isEnabled && isEditing ? {
17895
17911
  key: 's',
17896
17912
  meta: true,
@@ -18585,7 +18601,7 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
18585
18601
  return;
18586
18602
  }
18587
18603
  // toggle into detailed mode when actually inputting something
18588
- if (/^[a-z0-9]$/i.test(event.key) || event.key === 'Backspace') {
18604
+ if (!isPressingMetaKey(event) && (/^[a-z0-9]$/i.test(event.key) || event.key === 'Backspace')) {
18589
18605
  toggleDetailedMode(true);
18590
18606
  }
18591
18607
  };
@@ -18793,7 +18809,7 @@ function Row$2(props) {
18793
18809
  if (tableMeta.editing.isEditing && isActiveRow) {
18794
18810
  var _event$target$closest, _event$target$closest2;
18795
18811
  const cellIndex = Number((_event$target$closest = (_event$target$closest2 = event.target.closest('td')) === null || _event$target$closest2 === void 0 ? void 0 : _event$target$closest2.getAttribute('data-cell-index')) !== null && _event$target$closest !== void 0 ? _event$target$closest : undefined);
18796
- if (!isNaN(cellIndex) && tableMeta.editing.lastFocusedCellIndex !== cellIndex) {
18812
+ if (!isNaN(cellIndex)) {
18797
18813
  tableMeta.editing.setLastFocusedCellIndex(Number(cellIndex));
18798
18814
  }
18799
18815
  }
@@ -18854,22 +18870,6 @@ function Alert$1(props) {
18854
18870
  const tableMeta = table.options.meta;
18855
18871
  const [showFilterResetDialog, setShowFilterResetDialog] = React__default.useState(false);
18856
18872
  const pendingChangesWithErrors = tableMeta.editing.getErrors();
18857
- const deletePendingChange = tableMeta.editing.resetChanges;
18858
- const allRows = table.getPreFilteredRowModel().rows;
18859
- // This effect deletes error in the alert if the row that has the error is deleted.
18860
- React__default.useEffect(() => {
18861
- pendingChangesWithErrors.forEach(errorRow => {
18862
- const errorRowId = errorRow.rowId;
18863
- try {
18864
- // getRow throws error if it fails to find the row
18865
- if (!table.getRow(errorRowId)) {
18866
- deletePendingChange(errorRowId);
18867
- }
18868
- } catch {
18869
- deletePendingChange(errorRowId);
18870
- }
18871
- });
18872
- }, [allRows.length]);
18873
18873
  const activeRow = React__default.useMemo(() => tableMeta.rowActive.rowActiveIndex ? table.getRowModel().rows[tableMeta.rowActive.rowActiveIndex] : undefined, [tableMeta.rowActive.rowActiveIndex]);
18874
18874
  // mark errors being rendered as seen
18875
18875
  React__default.useEffect(() => {
@@ -18898,23 +18898,18 @@ function Alert$1(props) {
18898
18898
  const title = (pendingChangesWithErrors.length === 1 ? validationTexts.alert.titleOne : validationTexts.alert.titlePlural).replace('[COUNT]', String(pendingChangesWithErrors.length));
18899
18899
  // generate links to each invalid row, to go into the error message
18900
18900
  const links = [];
18901
- const rowIdentityColumn = tableMeta.rowIdentityColumnId ?
18902
- // Since rowIdentityColumnId can have multiple ids, we use the first id to refer to the row in Alert
18903
- table.getColumn(tableMeta.rowIdentityColumnId[0]) : undefined;
18901
+ const rowIdentityColumn = tableMeta.rowIdentityColumnId ? table.getColumn(tableMeta.rowIdentityColumnId) : undefined;
18904
18902
  pendingChangesWithErrors.forEach((error, index) => {
18905
18903
  // if appropriate, concatenate the item with the text "and"
18906
18904
  if (pendingChangesWithErrors.length > 1 && index === pendingChangesWithErrors.length - 1) {
18907
18905
  // Add space before and after `messageAnd` text
18908
18906
  links.push(` ${validationTexts.alert.messageAnd} `);
18909
18907
  }
18910
- const rowIndex = table.getFilteredRowModel().rows.findIndex(row => row.id === error.rowId);
18908
+ const rowIndex = table.getRowModel().rows.findIndex(row => row.id === error.rowId);
18911
18909
  const handleClick = () => {
18912
- // if row is visible
18913
18910
  if (rowIndex > -1) {
18914
18911
  scrollToRow(rowIndex);
18915
- }
18916
- // if row is filtered out
18917
- else {
18912
+ } else {
18918
18913
  setShowFilterResetDialog(error.rowId);
18919
18914
  }
18920
18915
  };