@economic/taco 2.30.1 → 2.31.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.
Files changed (39) hide show
  1. package/dist/components/Table3/Table3.d.ts +18 -2
  2. package/dist/components/Table3/types.d.ts +11 -2
  3. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js +1 -1
  4. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js.map +1 -1
  5. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +5 -4
  6. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
  7. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +2 -2
  8. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
  9. package/dist/esm/packages/taco/src/components/Menu/components/Trigger.js +7 -9
  10. package/dist/esm/packages/taco/src/components/Menu/components/Trigger.js.map +1 -1
  11. package/dist/esm/packages/taco/src/components/Select/Select.js +2 -1
  12. package/dist/esm/packages/taco/src/components/Select/Select.js.map +1 -1
  13. package/dist/esm/packages/taco/src/components/Select/useSelect.js +19 -1
  14. package/dist/esm/packages/taco/src/components/Select/useSelect.js.map +1 -1
  15. package/dist/esm/packages/taco/src/components/Select2/Select2.js +1 -3
  16. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  17. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +33 -12
  18. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  19. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +24 -3
  20. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
  21. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +4 -5
  22. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
  23. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  24. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js +5 -5
  25. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js.map +1 -1
  26. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +2 -1
  27. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
  28. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +9 -0
  29. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  30. package/dist/esm/packages/taco/src/utils/dom.js +1 -4
  31. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  32. package/dist/primitives/Table/types.d.ts +1 -1
  33. package/dist/primitives/Table/useTableManager/useTableManager.d.ts +1 -1
  34. package/dist/taco.cjs.development.js +113 -47
  35. package/dist/taco.cjs.development.js.map +1 -1
  36. package/dist/taco.cjs.production.min.js +1 -1
  37. package/dist/taco.cjs.production.min.js.map +1 -1
  38. package/dist/utils/dom.d.ts +0 -1
  39. package/package.json +2 -2
@@ -4122,9 +4122,6 @@ 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
- }
4128
4125
 
4129
4126
  function isPressingMetaKey(event) {
4130
4127
  return isMacOs() ? event.metaKey : event.ctrlKey;
@@ -5826,7 +5823,9 @@ const useCombobox = ({
5826
5823
  }
5827
5824
  };
5828
5825
  const handleInputKeyDown = event => {
5826
+ var _inputRef$current;
5829
5827
  event.persist();
5828
+ const insideTheTable = !!((_inputRef$current = inputRef.current) !== null && _inputRef$current !== void 0 && _inputRef$current.closest('table, [role="rowgroup"]'));
5830
5829
  if (!event.ctrlKey && !event.metaKey) {
5831
5830
  switch (event.key) {
5832
5831
  case 'Backspace':
@@ -5848,7 +5847,7 @@ const useCombobox = ({
5848
5847
  }
5849
5848
  case 'Enter':
5850
5849
  {
5851
- if (isElementInsideTable3OrReport(event.currentTarget)) {
5850
+ if (insideTheTable) {
5852
5851
  event.preventDefault();
5853
5852
  if (inline && !open) {
5854
5853
  setOpen(true);
@@ -5866,7 +5865,7 @@ const useCombobox = ({
5866
5865
  if (open) {
5867
5866
  event.preventDefault();
5868
5867
  } else {
5869
- if (!inline && buttonRef.current && !isElementInsideTable3OrReport(event.currentTarget)) {
5868
+ if (!inline && buttonRef.current && !insideTheTable) {
5870
5869
  buttonRef.current.click();
5871
5870
  }
5872
5871
  }
@@ -5886,7 +5885,7 @@ const useCombobox = ({
5886
5885
  listRef.current.dispatchEvent(createCustomKeyboardEvent(event));
5887
5886
  }
5888
5887
  if (inline && !open) {
5889
- if ((event.key === 'ArrowUp' || event.key === 'ArrowDown') && !isElementInsideTable3OrReport(event.currentTarget)) {
5888
+ if ((event.key === 'ArrowUp' || event.key === 'ArrowDown') && !insideTheTable) {
5890
5889
  event.preventDefault();
5891
5890
  const initialIndex = event.key === 'ArrowUp' ? data.length - 1 : 0;
5892
5891
  setCurrentIndex(currentIndex !== undefined ? currentIndex : initialIndex);
@@ -5993,7 +5992,7 @@ const Combobox = /*#__PURE__*/React.forwardRef(function Combobox(props, ref) {
5993
5992
  ref: ref
5994
5993
  }), /*#__PURE__*/React.createElement(Input, Object.assign({}, input, {
5995
5994
  autoComplete: "off",
5996
- button: props.inline ? ( /*#__PURE__*/React.createElement(IconButton
5995
+ button: props.readOnly ? undefined : props.inline ? ( /*#__PURE__*/React.createElement(IconButton
5997
5996
  // In case of inline combobox, this icon button acts only as visual chevron representation,
5998
5997
  // so should be taken out of screen reader scope.
5999
5998
  , {
@@ -6317,7 +6316,7 @@ const Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref)
6317
6316
  "data-taco": "datepicker",
6318
6317
  style: style
6319
6318
  }, /*#__PURE__*/React.createElement(Input, Object.assign({}, input, {
6320
- button: /*#__PURE__*/React.createElement(IconButton, {
6319
+ button: input.readOnly ? undefined : ( /*#__PURE__*/React.createElement(IconButton, {
6321
6320
  "aria-label": texts.datepicker.expand,
6322
6321
  disabled: input.disabled || input.readOnly,
6323
6322
  icon: "calendar",
@@ -6355,7 +6354,7 @@ const Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref)
6355
6354
  }
6356
6355
  }, texts.datepicker.clear))))))))),
6357
6356
  tooltip: texts.datepicker.calendar
6358
- })
6357
+ }))
6359
6358
  })));
6360
6359
  });
6361
6360
  Datepicker.displayName = 'Datepicker';
@@ -8195,13 +8194,12 @@ const Link$1 = /*#__PURE__*/React.forwardRef(function MenuLink(props, ref) {
8195
8194
  const Trigger$6 = /*#__PURE__*/React.forwardRef(function MenuTrigger(props, ref) {
8196
8195
  const menu = useCurrentMenu();
8197
8196
  const internalRef = useMergedRef(ref);
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
- }
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));
8205
8203
  }
8206
8204
  };
8207
8205
  React.useEffect(() => {
@@ -8212,7 +8210,7 @@ const Trigger$6 = /*#__PURE__*/React.forwardRef(function MenuTrigger(props, ref)
8212
8210
  return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Trigger, Object.assign({}, props, {
8213
8211
  asChild: true,
8214
8212
  ref: internalRef,
8215
- onKeyDown: handleKeyDown
8213
+ onKeyDown: preventArrowDownShortcut
8216
8214
  }));
8217
8215
  });
8218
8216
 
@@ -8986,12 +8984,30 @@ const useSelect = ({
8986
8984
  onChange(event);
8987
8985
  }
8988
8986
  };
8987
+ const handleButtonClick = event => {
8988
+ if (readOnly) {
8989
+ event.preventDefault();
8990
+ }
8991
+ };
8992
+ // select the value text if the select is readonly
8993
+ const handleButtonFocus = event => {
8994
+ if (readOnly) {
8995
+ const value = event.currentTarget.querySelector(':first-child');
8996
+ if (value) {
8997
+ var _window$getSelection, _window$getSelection$;
8998
+ (_window$getSelection = window.getSelection()) === null || _window$getSelection === void 0 ? void 0 : (_window$getSelection$ = _window$getSelection.selectAllChildren) === null || _window$getSelection$ === void 0 ? void 0 : _window$getSelection$.call(_window$getSelection, value);
8999
+ }
9000
+ }
9001
+ };
8989
9002
  const button = {
8990
9003
  'aria-haspopup': 'listbox',
8991
9004
  'aria-label': ariaLabel ? `${ariaLabel} ${text}` : undefined,
8992
9005
  'aria-labelledby': ariaLabelledBy ? `${ariaLabelledBy} ${buttonId}` : undefined,
8993
- disabled: disabled || readOnly,
9006
+ 'aria-readonly': readOnly ? 'true' : undefined,
9007
+ disabled: disabled,
8994
9008
  id: buttonId,
9009
+ onClick: handleButtonClick,
9010
+ onFocus: handleButtonFocus,
8995
9011
  onKeyDown: !disabled && !readOnly ? handleButtonKeyDown : undefined,
8996
9012
  tabIndex,
8997
9013
  type: 'button'
@@ -9057,7 +9073,8 @@ const BaseSelect = /*#__PURE__*/React.forwardRef(function BaseSelect(props, ref)
9057
9073
  'yt-select--readonly': props.readOnly
9058
9074
  }, externalClassName);
9059
9075
  const inputClassname = cn(getInputClasses(props), 'h-8 text-left !pr-0', {
9060
- 'border-blue-500': popover.open
9076
+ 'border-blue-500': popover.open,
9077
+ 'select-text': otherProps.readOnly
9061
9078
  });
9062
9079
  React.useEffect(() => {
9063
9080
  if (autoFocus && internalRef.current) {
@@ -10043,6 +10060,13 @@ function mapTableChildrenToColumns(props, settings, options, internalColumns) {
10043
10060
  function configureReactTableOptions(options, props) {
10044
10061
  var _options$enableFilter, _options$enableColumn, _options$enableRowExp, _options$enableColumn2, _options$enableColumn3, _options$enableSortin;
10045
10062
  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
+ };
10046
10070
  const tableOptions = {
10047
10071
  defaultColumn: {
10048
10072
  enableColumnFilter: options.enableFiltering || true,
@@ -10067,6 +10091,8 @@ function configureReactTableOptions(options, props) {
10067
10091
  // models for default features
10068
10092
  getExpandedRowModel: reactTable.getExpandedRowModel(),
10069
10093
  getGroupedRowModel: reactTable.getGroupedRowModel(),
10094
+ // Use row indentity column values as id for each row
10095
+ getRowId: getRowIdentityColumnId(),
10070
10096
  groupedColumnMode: false
10071
10097
  };
10072
10098
  if (tableOptions.enableColumnResizing) {
@@ -10420,11 +10446,11 @@ function useTableRowActive(isEnabled = false, initialRowActiveIndex) {
10420
10446
  const [rowActiveIndex, setRowActiveIndex] = React__default.useState(initialRowActiveIndex);
10421
10447
  const [rowHoverIndex, setRowHoverIndex] = React__default.useState(undefined);
10422
10448
  const [isHoverStatePaused, setHoverStatePaused] = useIsHoverStatePaused();
10423
- const move = (direction, length, scrollToIndex) => {
10424
- const nextIndex = rowActiveIndex !== undefined ? getNextIndex(direction, rowActiveIndex, length) : 0;
10425
- scrollToIndex(nextIndex);
10426
- setTimeout(() => setRowActiveIndex(nextIndex), 50);
10427
- };
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
+ });
10428
10454
  const onKeyDown = React__default.useCallback((event, length, scrollToIndex) => {
10429
10455
  if (!isEnabled || event.defaultPrevented) {
10430
10456
  return;
@@ -11242,6 +11268,7 @@ function useTableManager(props, meta, internalColumns) {
11242
11268
  // ensure data is always valid
11243
11269
  const data = (_props$data = props.data) !== null && _props$data !== void 0 ? _props$data : [];
11244
11270
  const length = (_props$length = props.length) !== null && _props$length !== void 0 ? _props$length : data.length;
11271
+ const rowIdentityColumnId = props.rowIdentityColumnId !== undefined ? [props.rowIdentityColumnId].flat() : [];
11245
11272
  // create a react-table instance
11246
11273
  const instance = reactTable.useReactTable({
11247
11274
  data,
@@ -11269,7 +11296,7 @@ function useTableManager(props, meta, internalColumns) {
11269
11296
  rowDrag,
11270
11297
  rowDrop: rowDrop,
11271
11298
  rowExpansion: rowExpansion,
11272
- rowIdentityColumnId: props.rowIdentityColumnId,
11299
+ rowIdentityColumnId,
11273
11300
  rowGoto,
11274
11301
  rowGroups: rowGroups,
11275
11302
  rowHeight,
@@ -11646,12 +11673,11 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex) {
11646
11673
  } = useRowHeightVirtualisation(table);
11647
11674
  // row groups
11648
11675
  const rangeExtractor = useRowGroupVirtualisation(table);
11649
- // account for thead and tfoot in the scroll area - both are always medium row height
11676
+ // account for thead and tfoot in the scroll area
11650
11677
  const scrollPaddingStart = ROW_HEIGHT_ESTIMATES.medium;
11651
11678
  // column groups offset the bottom padding :shrug:, multiplying by 1.5 ensures the bottom padding remains
11652
11679
  // consistent when there are groups and when there aren't. 1.5 is relatively arbitrary, but it gives alignment
11653
11680
  const scrollPaddingEnd = ROW_HEIGHT_ESTIMATES.medium * (table.getHeaderGroups().length > 1 ? 1.5 : 1);
11654
- const scrollMargin = isTableRowGrouped ? 0 : scrollPaddingStart;
11655
11681
  const virtualiser = reactVirtual.useVirtualizer({
11656
11682
  count: rows.length,
11657
11683
  estimateSize,
@@ -11659,7 +11685,7 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex) {
11659
11685
  overscan: tableMeta.printing.isPrinting ? rows.length : undefined,
11660
11686
  rangeExtractor,
11661
11687
  // correctly sets top and bottom spacing for the scroll container - very sensitive, don't change
11662
- scrollMargin,
11688
+ scrollMargin: isTableRowGrouped ? 0 : scrollPaddingStart,
11663
11689
  // correctly sets the scroll padding offset, e.g. when keyboard navigating rows in the list
11664
11690
  scrollPaddingStart,
11665
11691
  scrollPaddingEnd: tableMeta.footer.isEnabled ? scrollPaddingEnd * 2 : scrollPaddingEnd
@@ -11688,7 +11714,7 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex) {
11688
11714
  // use row 1 not 0, because 0 might be sticky in grouped tables and it's start value will always be 0
11689
11715
  const paddingStartIndex = isTableRowGrouped && rows.length > 1 ? 1 : 0;
11690
11716
  // styling for offsetting rows - this "is" the virtualisation
11691
- const [paddingTop, paddingBottom] = virtualItems.length > 0 ? [Math.max(0, (_ref = ((_virtualItems$padding = virtualItems[paddingStartIndex]) === null || _virtualItems$padding === void 0 ? void 0 : _virtualItems$padding.start) - ((_virtualItems$padding2 = virtualItems[paddingStartIndex]) === null || _virtualItems$padding2 === void 0 ? void 0 : _virtualItems$padding2.size) - scrollMargin) !== null && _ref !== void 0 ? _ref : 0), Math.max(0, (_ref2 = totalSize - ((_virtualItems = virtualItems[virtualItems.length - 1]) === null || _virtualItems === void 0 ? void 0 : _virtualItems.end)) !== null && _ref2 !== void 0 ? _ref2 : 0)] : [0, 0];
11717
+ const [paddingTop, paddingBottom] = virtualItems.length > 0 ? [Math.max(0, (_ref = ((_virtualItems$padding = virtualItems[paddingStartIndex]) === null || _virtualItems$padding === void 0 ? void 0 : _virtualItems$padding.start) - ((_virtualItems$padding2 = virtualItems[paddingStartIndex]) === null || _virtualItems$padding2 === void 0 ? void 0 : _virtualItems$padding2.size)) !== null && _ref !== void 0 ? _ref : 0), Math.max(0, (_ref2 = totalSize - ((_virtualItems = virtualItems[virtualItems.length - 1]) === null || _virtualItems === void 0 ? void 0 : _virtualItems.end)) !== null && _ref2 !== void 0 ? _ref2 : 0)] : [0, 0];
11692
11718
  // ensure default active rows are scrolled to
11693
11719
  React__default.useEffect(() => {
11694
11720
  if (defaultRowActiveIndex) {
@@ -11703,7 +11729,7 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex) {
11703
11729
  let content = null;
11704
11730
  if (rows.length) {
11705
11731
  style = {
11706
- height: `${totalSize - scrollMargin}px`,
11732
+ height: `${totalSize}px`,
11707
11733
  paddingBottom,
11708
11734
  paddingTop
11709
11735
  };
@@ -14554,13 +14580,19 @@ const Title$5 = /*#__PURE__*/React__default.forwardRef(function Select2Title(pro
14554
14580
 
14555
14581
  const Placeholder = ({
14556
14582
  disabled,
14583
+ readOnly,
14557
14584
  ...props
14558
- }) => ( /*#__PURE__*/React__default.createElement("div", Object.assign({}, props, {
14559
- className: cn({
14560
- 'text-grey-700': disabled,
14561
- 'text-grey-500': !disabled
14562
- })
14563
- })));
14585
+ }) => {
14586
+ if (readOnly) {
14587
+ return null;
14588
+ }
14589
+ return /*#__PURE__*/React__default.createElement("div", Object.assign({}, props, {
14590
+ className: cn({
14591
+ 'text-grey-700': disabled,
14592
+ 'text-grey-500': !disabled
14593
+ })
14594
+ }));
14595
+ };
14564
14596
  const Trigger$7 = /*#__PURE__*/React__default.forwardRef(function Select2Trigger(props, ref) {
14565
14597
  const {
14566
14598
  multiple,
@@ -14594,13 +14626,14 @@ const Button$3 = /*#__PURE__*/React__default.forwardRef(function Select2TriggerB
14594
14626
  open,
14595
14627
  readOnly
14596
14628
  } = useSelect2Context();
14597
- const className = cn('cursor-pointer px-1.5 h-fit', getInputClasses({
14629
+ const className = cn('px-1.5 h-fit', getInputClasses({
14598
14630
  ...props,
14599
14631
  disabled,
14600
14632
  highlighted,
14601
14633
  invalid,
14602
14634
  readOnly
14603
14635
  }).replace('w-full', '').replace('px-2', ''), getFontSize(fontSize), {
14636
+ 'select-text': readOnly,
14604
14637
  'w-full': !((_props$className = props.className) !== null && _props$className !== void 0 && _props$className.includes('w-'))
14605
14638
  }, props.className);
14606
14639
  const handleClick = event => {
@@ -14612,17 +14645,28 @@ const Button$3 = /*#__PURE__*/React__default.forwardRef(function Select2TriggerB
14612
14645
  onClick(event);
14613
14646
  }
14614
14647
  };
14648
+ // select the value text if the select is readonly
14649
+ const handleFocus = event => {
14650
+ if (readOnly) {
14651
+ const value = event.currentTarget.querySelector(':first-child');
14652
+ if (value) {
14653
+ var _window$getSelection, _window$getSelection$;
14654
+ (_window$getSelection = window.getSelection()) === null || _window$getSelection === void 0 ? void 0 : (_window$getSelection$ = _window$getSelection.selectAllChildren) === null || _window$getSelection$ === void 0 ? void 0 : _window$getSelection$.call(_window$getSelection, value);
14655
+ }
14656
+ }
14657
+ };
14615
14658
  return /*#__PURE__*/React__default.createElement("button", Object.assign({}, otherProps, {
14616
14659
  "aria-invalid": invalid ? true : undefined,
14617
14660
  "aria-readonly": readOnly ? true : undefined,
14618
14661
  className: className,
14619
14662
  disabled: disabled,
14620
14663
  onClick: handleClick,
14664
+ onFocus: handleFocus,
14621
14665
  ref: ref,
14622
14666
  role: "combobox",
14623
- tabIndex: disabled || readOnly ? -1 : tabIndex,
14667
+ tabIndex: disabled ? -1 : tabIndex,
14624
14668
  type: "button"
14625
- }), children, /*#__PURE__*/React__default.createElement(Icon, {
14669
+ }), children, readOnly ? null : /*#__PURE__*/React__default.createElement(Icon, {
14626
14670
  name: open ? 'chevron-up' : 'chevron-down',
14627
14671
  className: "pointer-events-none -mr-1 ml-auto"
14628
14672
  }));
@@ -14645,7 +14689,8 @@ const Single = /*#__PURE__*/React__default.forwardRef(function Select2TriggerSin
14645
14689
  let output;
14646
14690
  if (placeholder && currentValue === undefined) {
14647
14691
  output = /*#__PURE__*/React__default.createElement(Placeholder, {
14648
- disabled: disabled
14692
+ disabled: disabled,
14693
+ readOnly: readOnly
14649
14694
  }, placeholder);
14650
14695
  } else if (currentValue) {
14651
14696
  if (tags && emptyValue !== value) {
@@ -14698,7 +14743,8 @@ const Multiple = /*#__PURE__*/React__default.forwardRef(function Select2TriggerM
14698
14743
  }, /*#__PURE__*/React__default.createElement("div", {
14699
14744
  className: "flex flex-wrap gap-1"
14700
14745
  }, valuesAsChildren.length === 0 ? ( /*#__PURE__*/React__default.createElement(Placeholder, {
14701
- disabled: disabled
14746
+ disabled: disabled,
14747
+ readOnly: readOnly
14702
14748
  }, placeholder)) : valuesAsChildren.map(child => ( /*#__PURE__*/React__default.createElement(Tag$1, {
14703
14749
  key: String(child.props.value),
14704
14750
  className: "truncate",
@@ -14758,7 +14804,8 @@ const MultipleValue = ({
14758
14804
  className: "flex gap-1 truncate",
14759
14805
  ref: el => setContentRef(el)
14760
14806
  }, valuesAsChildren.length === 0 ? ( /*#__PURE__*/React__default.createElement(Placeholder, {
14761
- disabled: disabled
14807
+ disabled: disabled,
14808
+ readOnly: readOnly
14762
14809
  }, placeholder)) : valuesAsChildren.map((child, index) => {
14763
14810
  const tag = /*#__PURE__*/React__default.createElement(Tag$1, {
14764
14811
  key: String(child.props.value),
@@ -15186,8 +15233,6 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
15186
15233
  var _listboxRef$current;
15187
15234
  if (open) {
15188
15235
  event.preventDefault();
15189
- } else if (isElementInsideTable3OrReport(event.currentTarget)) {
15190
- return;
15191
15236
  } else if (!event.ctrlKey && !event.metaKey && (event.key === 'ArrowDown' || /^[a-z0-9]$/i.test(event.key))) {
15192
15237
  setOpen(true);
15193
15238
  }
@@ -18809,6 +18854,22 @@ function Alert$1(props) {
18809
18854
  const tableMeta = table.options.meta;
18810
18855
  const [showFilterResetDialog, setShowFilterResetDialog] = React__default.useState(false);
18811
18856
  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]);
18812
18873
  const activeRow = React__default.useMemo(() => tableMeta.rowActive.rowActiveIndex ? table.getRowModel().rows[tableMeta.rowActive.rowActiveIndex] : undefined, [tableMeta.rowActive.rowActiveIndex]);
18813
18874
  // mark errors being rendered as seen
18814
18875
  React__default.useEffect(() => {
@@ -18837,18 +18898,23 @@ function Alert$1(props) {
18837
18898
  const title = (pendingChangesWithErrors.length === 1 ? validationTexts.alert.titleOne : validationTexts.alert.titlePlural).replace('[COUNT]', String(pendingChangesWithErrors.length));
18838
18899
  // generate links to each invalid row, to go into the error message
18839
18900
  const links = [];
18840
- const rowIdentityColumn = tableMeta.rowIdentityColumnId ? table.getColumn(tableMeta.rowIdentityColumnId) : undefined;
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;
18841
18904
  pendingChangesWithErrors.forEach((error, index) => {
18842
18905
  // if appropriate, concatenate the item with the text "and"
18843
18906
  if (pendingChangesWithErrors.length > 1 && index === pendingChangesWithErrors.length - 1) {
18844
18907
  // Add space before and after `messageAnd` text
18845
18908
  links.push(` ${validationTexts.alert.messageAnd} `);
18846
18909
  }
18847
- const rowIndex = table.getRowModel().rows.findIndex(row => row.id === error.rowId);
18910
+ const rowIndex = table.getFilteredRowModel().rows.findIndex(row => row.id === error.rowId);
18848
18911
  const handleClick = () => {
18912
+ // if row is visible
18849
18913
  if (rowIndex > -1) {
18850
18914
  scrollToRow(rowIndex);
18851
- } else {
18915
+ }
18916
+ // if row is filtered out
18917
+ else {
18852
18918
  setShowFilterResetDialog(error.rowId);
18853
18919
  }
18854
18920
  };