@economic/taco 2.45.0-alpha.7 → 2.45.0-alpha.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. package/dist/components/Alert/Alert.d.ts +1 -1
  2. package/dist/components/Calendar/Calendar.d.ts +1 -0
  3. package/dist/components/Icon/components/Experiment.d.ts +3 -0
  4. package/dist/components/Icon/components/index.d.ts +1 -1
  5. package/dist/components/Input/Input.d.ts +1 -1
  6. package/dist/components/Menu/components/Item.d.ts +1 -1
  7. package/dist/components/Menu/components/Link.d.ts +1 -1
  8. package/dist/components/Navigation2/components/Link.d.ts +1 -1
  9. package/dist/components/Select2/components/Option.d.ts +2 -2
  10. package/dist/components/Select2/components/Search.d.ts +1 -1
  11. package/dist/components/Table3/features/useEditingState.d.ts +1 -1
  12. package/dist/components/Table3/features/useTableEditing.d.ts +2 -2
  13. package/dist/components/Tag/Tag.d.ts +1 -1
  14. package/dist/esm/index.css +10 -2
  15. package/dist/esm/packages/taco/src/components/Alert/Alert.js +2 -0
  16. package/dist/esm/packages/taco/src/components/Alert/Alert.js.map +1 -1
  17. package/dist/esm/packages/taco/src/components/Banner/util.js +5 -0
  18. package/dist/esm/packages/taco/src/components/Banner/util.js.map +1 -1
  19. package/dist/esm/packages/taco/src/components/Calendar/Calendar.js +11 -10
  20. package/dist/esm/packages/taco/src/components/Calendar/Calendar.js.map +1 -1
  21. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +3 -1
  22. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
  23. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js +13 -6
  24. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js.map +1 -1
  25. package/dist/esm/packages/taco/src/components/Icon/components/Experiment.js +20 -0
  26. package/dist/esm/packages/taco/src/components/Icon/components/Experiment.js.map +1 -0
  27. package/dist/esm/packages/taco/src/components/Icon/components/index.js +2 -0
  28. package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
  29. package/dist/esm/packages/taco/src/components/Menu/components/Content.js +1 -1
  30. package/dist/esm/packages/taco/src/components/Menu/components/Content.js.map +1 -1
  31. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js +10 -4
  32. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
  33. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +3 -1
  34. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
  35. package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js +16 -8
  36. package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js.map +1 -1
  37. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +44 -30
  38. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
  39. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js +5 -8
  40. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js.map +1 -1
  41. package/dist/esm/packages/taco/src/components/Table3/useTable3.js +3 -4
  42. package/dist/esm/packages/taco/src/components/Table3/useTable3.js.map +1 -1
  43. package/dist/esm/packages/taco/src/hooks/useGlobalKeyDown.js +2 -2
  44. package/dist/esm/packages/taco/src/hooks/useGlobalKeyDown.js.map +1 -1
  45. package/dist/esm/packages/taco/src/hooks/useLazyEffect.js +1 -1
  46. package/dist/esm/packages/taco/src/hooks/useLazyEffect.js.map +1 -1
  47. package/dist/esm/packages/taco/src/primitives/BubbleSelect.js +1 -1
  48. package/dist/esm/packages/taco/src/primitives/BubbleSelect.js.map +1 -1
  49. package/dist/esm/packages/taco/src/primitives/Button.js +1 -6
  50. package/dist/esm/packages/taco/src/primitives/Button.js.map +1 -1
  51. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/EmptyStateBody.js +9 -2
  52. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/EmptyStateBody.js.map +1 -1
  53. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableServerLoading.js +1 -0
  54. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableServerLoading.js.map +1 -1
  55. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFontSizeListener.js +2 -1
  56. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFontSizeListener.js.map +1 -1
  57. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/dataTypes.js +6 -2
  58. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/dataTypes.js.map +1 -1
  59. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js +7 -1
  60. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js.map +1 -1
  61. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +8 -3
  62. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  63. package/dist/esm/packages/taco/src/types.js.map +1 -1
  64. package/dist/esm/packages/taco/src/utils/dom.js +12 -1
  65. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  66. package/dist/esm/packages/taco/src/utils/keyboard.js +5 -2
  67. package/dist/esm/packages/taco/src/utils/keyboard.js.map +1 -1
  68. package/dist/esm/packages/taco/src/utils/tailwind.js +2 -0
  69. package/dist/esm/packages/taco/src/utils/tailwind.js.map +1 -1
  70. package/dist/hooks/useGlobalKeyDown.d.ts +1 -1
  71. package/dist/index.css +10 -2
  72. package/dist/primitives/Table/useTableManager/util/dataTypes.d.ts +1 -1
  73. package/dist/taco.cjs.development.js +190 -95
  74. package/dist/taco.cjs.development.js.map +1 -1
  75. package/dist/taco.cjs.production.min.js +1 -1
  76. package/dist/taco.cjs.production.min.js.map +1 -1
  77. package/dist/types.d.ts +1 -1
  78. package/dist/utils/keyboard.d.ts +1 -1
  79. package/package.json +2 -2
@@ -59,6 +59,8 @@ const getColorByState = state => {
59
59
  return 'yellow';
60
60
  case 'error':
61
61
  return 'red';
62
+ case 'experiment':
63
+ return 'purple';
62
64
  case 'success':
63
65
  return 'green';
64
66
  default:
@@ -1615,6 +1617,22 @@ function IconExpenses(props, svgRef) {
1615
1617
  }
1616
1618
  var Expenses = /*#__PURE__*/React.forwardRef(IconExpenses);
1617
1619
 
1620
+ function IconExperiment(props, svgRef) {
1621
+ return /*#__PURE__*/React.createElement("svg", Object.assign({
1622
+ fill: "none",
1623
+ xmlns: "http://www.w3.org/2000/svg",
1624
+ viewBox: "0 0 20 20",
1625
+ ref: svgRef
1626
+ }, props), /*#__PURE__*/React.createElement("path", {
1627
+ fillRule: "evenodd",
1628
+ clipRule: "evenodd",
1629
+ d: "M8.962 9.26V5.313h2.843V9.28c0 .376.796 1.24 1.049 1.511L14.5 12.5c-.507.218-3.166-1.19-4.341-.211C7.159 14.789 6 13 6.5 12c.316-.632 2.462-1.803 2.462-2.74zm.24-4.469a.762.762 0 00-.752.772v3.696a.61.61 0 01-.177.43l-2.592 2.6c-.911.913-.281 2.502.992 2.502h7.154c1.25 0 1.89-1.538 1.027-2.466l-2.446-2.63a.61.61 0 01-.162-.415V5.563a.762.762 0 00-.752-.772H9.202z",
1630
+ fill: "currentColor",
1631
+ stroke: "currentColor"
1632
+ }));
1633
+ }
1634
+ var Experiment = /*#__PURE__*/React.forwardRef(IconExperiment);
1635
+
1618
1636
  function IconExportToExcel(props, svgRef) {
1619
1637
  return /*#__PURE__*/React.createElement("svg", Object.assign({
1620
1638
  xmlns: "http://www.w3.org/2000/svg",
@@ -3672,6 +3690,7 @@ const icons = {
3672
3690
  envelope: Envelope,
3673
3691
  'expand-view': ExpandView,
3674
3692
  expenses: Expenses,
3693
+ experiment: Experiment,
3675
3694
  'export-to-excel': ExportToExcel,
3676
3695
  'export-to-pdf': ExportToPdf,
3677
3696
  export: Export,
@@ -3879,6 +3898,8 @@ const getIconName = state => {
3879
3898
  return 'warning';
3880
3899
  case 'error':
3881
3900
  return 'close';
3901
+ case 'experiment':
3902
+ return 'experiment';
3882
3903
  case 'success':
3883
3904
  return 'tick';
3884
3905
  default:
@@ -4214,6 +4235,11 @@ const getBannerIcon = type => {
4214
4235
  icon: "close",
4215
4236
  color: "red"
4216
4237
  });
4238
+ case 'experiment':
4239
+ return /*#__PURE__*/React__default.createElement(BadgeIcon, {
4240
+ icon: "experiment",
4241
+ color: "purple"
4242
+ });
4217
4243
  case 'warning':
4218
4244
  return /*#__PURE__*/React__default.createElement(BadgeIcon, {
4219
4245
  icon: "warning",
@@ -4306,6 +4332,9 @@ function isElementTriggeredFromContainer(element, container) {
4306
4332
  return true;
4307
4333
  }
4308
4334
  const elementInDocument = document.querySelector(escapedSelector);
4335
+ if (elementInDocument === container) {
4336
+ return true;
4337
+ }
4309
4338
  // if the element does exist, see if it is itself connected to somethng that was triggered from the container
4310
4339
  if (elementInDocument) {
4311
4340
  return isElementTriggeredFromContainer(elementInDocument, container);
@@ -4328,7 +4357,15 @@ function isElementInteractive(element) {
4328
4357
  if (!element) {
4329
4358
  return false;
4330
4359
  }
4331
- return ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT', 'LABEL', 'OPTION'].includes(element.tagName) && !element.hidden && !element.disabled && !element.readOnly;
4360
+ const interactiveElements = ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT', 'LABEL', 'OPTION'];
4361
+ const isInteractive = interactiveElements.includes(element.tagName) && !element.hidden && !element.disabled && !element.readOnly;
4362
+ // sometimes buttons contain content like an icon, and we can't rely on pointer events being disabled
4363
+ // so search for a focusable parent
4364
+ if (!isInteractive) {
4365
+ const focusableParent = element.closest(FOCUSABLE_ELEMENTS.join(','));
4366
+ return focusableParent ? interactiveElements.includes(focusableParent.tagName) : false;
4367
+ }
4368
+ return isInteractive;
4332
4369
  }
4333
4370
  function isElementInsideTable3OrReport(element) {
4334
4371
  return !!(element !== null && element !== void 0 && element.closest('[data-taco^=table]'));
@@ -4359,9 +4396,12 @@ function shouldTriggerShortcut(event, key) {
4359
4396
  }
4360
4397
  return event.key.toLowerCase() === keyOptions.key.toLowerCase();
4361
4398
  }
4362
- function createShortcutKeyDownHandler(key, handler, stopPropagation = true) {
4399
+ function createShortcutKeyDownHandler(key, handler, stopPropagation = true, element) {
4363
4400
  return function (event) {
4364
- if (event.target !== event.currentTarget && isElementInteractive(event.target) && !isPressingMetaKey(event)) {
4401
+ const dialog = document.querySelector('[role="dialog"]');
4402
+ const isOutsideDialog = element && dialog && !dialog.contains(element);
4403
+ if (event.target !== event.currentTarget && isElementInteractive(event.target) && !isPressingMetaKey(event) || isOutsideDialog // Avoid triggering shortcut if dialog is open and element is outside the dialog
4404
+ ) {
4365
4405
  return;
4366
4406
  }
4367
4407
  const condition = shouldTriggerShortcut(event, key);
@@ -4382,11 +4422,11 @@ const isMacOs = () => {
4382
4422
  return (_window = window) === null || _window === void 0 ? void 0 : _window.navigator.userAgent.includes('Mac');
4383
4423
  };
4384
4424
 
4385
- const useGlobalKeyDown = (shortcut, handler) => {
4425
+ const useGlobalKeyDown = (shortcut, handler, element) => {
4386
4426
  React__default.useEffect(() => {
4387
4427
  let handleKeyDown;
4388
4428
  if (shortcut) {
4389
- handleKeyDown = createShortcutKeyDownHandler(shortcut, handler, false);
4429
+ handleKeyDown = createShortcutKeyDownHandler(shortcut, handler, false, element);
4390
4430
  document.addEventListener('keydown', handleKeyDown);
4391
4431
  }
4392
4432
  return () => {
@@ -4409,13 +4449,8 @@ const Button = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
4409
4449
  useGlobalKeyDown(shortcut, event => {
4410
4450
  var _internalRef$current;
4411
4451
  event === null || event === void 0 ? void 0 : event.preventDefault();
4412
- const dialog = document.querySelector('[role="dialog"]');
4413
- // Don't trigger the click on the button if it is outside of the dialog
4414
- if (dialog && !(dialog !== null && dialog !== void 0 && dialog.contains(internalRef.current))) {
4415
- return;
4416
- }
4417
4452
  (_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.click();
4418
- });
4453
+ }, internalRef.current);
4419
4454
  const Tag = props.href ? 'a' : 'button';
4420
4455
  return /*#__PURE__*/React.createElement(Tag, Object.assign({}, otherProps, {
4421
4456
  href: disabled ? undefined : props.href,
@@ -5066,22 +5101,23 @@ const TodayButton = ({
5066
5101
  }, texts.calendar.actions.today);
5067
5102
  };
5068
5103
  const Calendar$1 = props => {
5104
+ var _ref;
5069
5105
  const {
5070
5106
  onChange: handleChange,
5071
5107
  value,
5072
5108
  disabledDays,
5109
+ visibleMonth,
5073
5110
  ...otherProps
5074
5111
  } = props;
5075
- const [visibleMonth, setVisibleMonth] = React.useState(value !== null && value !== void 0 ? value : new Date());
5112
+ const [internalVisibleMonth, setInternalVisibleMonth] = React.useState((_ref = visibleMonth !== null && visibleMonth !== void 0 ? visibleMonth : value) !== null && _ref !== void 0 ? _ref : new Date());
5076
5113
  const {
5077
5114
  texts
5078
5115
  } = useLocalization();
5079
5116
  React.useEffect(() => {
5080
- if (visibleMonth !== value) {
5081
- setVisibleMonth(value !== null && value !== void 0 ? value : new Date());
5117
+ if (visibleMonth && visibleMonth !== internalVisibleMonth) {
5118
+ setInternalVisibleMonth(visibleMonth);
5082
5119
  }
5083
- // visibleMonth in deps array breaking month switching logic. It should not be in deps array.
5084
- }, [value]);
5120
+ }, [visibleMonth]);
5085
5121
  const handleDayClick = (date, modifiers, event) => {
5086
5122
  if (modifiers.outside || modifiers.disabled) {
5087
5123
  return;
@@ -5095,13 +5131,13 @@ const Calendar$1 = props => {
5095
5131
  className: className,
5096
5132
  captionLayout: "dropdown-buttons",
5097
5133
  weekStartsOn: 1,
5098
- month: visibleMonth,
5134
+ month: internalVisibleMonth,
5099
5135
  numberOfMonths: 1,
5100
5136
  components: {
5101
- Caption: props => /*#__PURE__*/React.createElement(Navbar, Object.assign({}, props, {
5102
- onMonthChange: setVisibleMonth,
5103
- value: visibleMonth
5104
- })),
5137
+ Caption: props => (/*#__PURE__*/React.createElement(Navbar, Object.assign({}, props, {
5138
+ onMonthChange: setInternalVisibleMonth,
5139
+ value: internalVisibleMonth
5140
+ }))),
5105
5141
  Footer: () => (/*#__PURE__*/React.createElement("tfoot", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
5106
5142
  colSpan: 7,
5107
5143
  className: "text-center"
@@ -6042,7 +6078,9 @@ const useCombobox = ({
6042
6078
  const isComboboxChangeEvent = event => {
6043
6079
  return !event.isTrusted; // this makes sure we only take our own custom event, and not the browser default blur on tab.
6044
6080
  };
6045
- if (isComboboxChangeEvent(event)) {
6081
+ // Only trigger onChange if this is our custom event (not a browser blur event)
6082
+ // or if the input was cleared.
6083
+ if (isComboboxChangeEvent(event) || event.target.value === '' && !inline) {
6046
6084
  onChange(event);
6047
6085
  }
6048
6086
  }
@@ -6357,14 +6395,18 @@ const useDatepicker = ({
6357
6395
  } = useLocalization();
6358
6396
  const [internalValue, setInternalValue] = React.useState((_format = format(value, formatting.date)) !== null && _format !== void 0 ? _format : '');
6359
6397
  const originalValueAsDate = parse(value);
6360
- // update internal value if it changed 'externally'
6398
+ // Track the current view date (month/year) in the calendar
6399
+ const [calendarViewDate, setCalendarViewDate] = React.useState(originalValueAsDate || new Date());
6361
6400
  React.useEffect(() => {
6362
- const formattedValue = format(value, formatting.date);
6363
- if (formattedValue !== internalValue) {
6364
- setInternalValue(formattedValue !== null && formattedValue !== void 0 ? formattedValue : '');
6401
+ // Only update the internal value when the input is not focused
6402
+ // This prevents the input value from being reset while user is typing
6403
+ if (inputRef.current !== document.activeElement) {
6404
+ const formattedValue = format(value, formatting.date);
6405
+ if (formattedValue !== internalValue) {
6406
+ setInternalValue(formattedValue !== null && formattedValue !== void 0 ? formattedValue : '');
6407
+ }
6365
6408
  }
6366
6409
  }, [value]);
6367
- // event handlers
6368
6410
  const handleInputBlur = event => {
6369
6411
  event.persist();
6370
6412
  const valueAsDate = parseFromCustomString(event.target.value, 'dd.mm.yy', originalValueAsDate === null || originalValueAsDate === void 0 ? void 0 : originalValueAsDate.getMonth(), originalValueAsDate === null || originalValueAsDate === void 0 ? void 0 : originalValueAsDate.getFullYear());
@@ -6385,6 +6427,8 @@ const useDatepicker = ({
6385
6427
  setInternalValue(event.target.value);
6386
6428
  };
6387
6429
  const handleChange = date => {
6430
+ // Update both the input value and calendar view date when selecting a date
6431
+ setCalendarViewDate(date);
6388
6432
  setInputValueByRef(inputRef.current, format(date, formatting.date), 'focusout');
6389
6433
  };
6390
6434
  const handleKeyDown = event => {
@@ -6410,7 +6454,8 @@ const useDatepicker = ({
6410
6454
  const calendarProps = {
6411
6455
  ...calendar,
6412
6456
  onChange: handleChange,
6413
- value: originalValueAsDate
6457
+ value: originalValueAsDate,
6458
+ visibleMonth: calendarViewDate
6414
6459
  };
6415
6460
  return {
6416
6461
  input: inputProps,
@@ -8299,7 +8344,7 @@ const Content$8 = /*#__PURE__*/React.forwardRef(function MenuContent(props, ref)
8299
8344
  var _childrenRefs$current, _childrenRefs$current2;
8300
8345
  return (_childrenRefs$current = childrenRefs.current[index]) === null || _childrenRefs$current === void 0 ? void 0 : (_childrenRefs$current2 = _childrenRefs$current.current) === null || _childrenRefs$current2 === void 0 ? void 0 : _childrenRefs$current2.click();
8301
8346
  }, 1);
8302
- }));
8347
+ }, true, childrenRefs.current[index].current));
8303
8348
  }
8304
8349
  });
8305
8350
  shortcuts.forEach(handler => document.addEventListener('keydown', handler));
@@ -9950,9 +9995,13 @@ const dataTypes = {
9950
9995
  if (value === undefined) {
9951
9996
  return '';
9952
9997
  }
9953
- return new Intl.NumberFormat(options === null || options === void 0 ? void 0 : (_options$localization2 = options.localization) === null || _options$localization2 === void 0 ? void 0 : _options$localization2.locale, {
9998
+ const formatter = new Intl.NumberFormat(options === null || options === void 0 ? void 0 : (_options$localization2 = options.localization) === null || _options$localization2 === void 0 ? void 0 : _options$localization2.locale, {
9954
9999
  minimumFractionDigits: 2
9955
- }).format(Number(value));
10000
+ });
10001
+ const decimalSeperator = formatter.format(1.1).substring(1, 2);
10002
+ const localisedValue = formatter.format(Number(value));
10003
+ const localisedValueWithoutThousandsSeperator = decimalSeperator === '.' ? localisedValue.replace(',', '') : localisedValue.replace('.', '');
10004
+ return [localisedValue, localisedValueWithoutThousandsSeperator];
9956
10005
  }
9957
10006
  }
9958
10007
  };
@@ -10100,7 +10149,13 @@ function isMatched(searchQuery, cellValue, dataType, localization) {
10100
10149
  const cellDisplayValue = dataTypeProperties.getDisplayValue(cellValue, {
10101
10150
  localization
10102
10151
  });
10103
- if (cellDisplayValue !== undefined && isWeakContains(cellDisplayValue, searchQuery)) {
10152
+ if (Array.isArray(cellDisplayValue)) {
10153
+ for (const displayValue of cellDisplayValue) {
10154
+ if (isWeakContains(displayValue, searchQuery)) {
10155
+ return true;
10156
+ }
10157
+ }
10158
+ } else if (cellDisplayValue !== undefined && isWeakContains(cellDisplayValue, searchQuery)) {
10104
10159
  return true;
10105
10160
  }
10106
10161
  }
@@ -10398,10 +10453,15 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
10398
10453
  column.cell = info => renderer(info.getValue(), info.row.original);
10399
10454
  } else if (dataTypeProperties.getDisplayValue) {
10400
10455
  const dataTypeRenderer = value => {
10401
- var _dataTypeProperties$g, _dataTypeProperties$g2;
10402
- return (_dataTypeProperties$g = (_dataTypeProperties$g2 = dataTypeProperties.getDisplayValue) === null || _dataTypeProperties$g2 === void 0 ? void 0 : _dataTypeProperties$g2.call(dataTypeProperties, value, {
10456
+ var _dataTypeProperties$g;
10457
+ const displayValue = (_dataTypeProperties$g = dataTypeProperties.getDisplayValue) === null || _dataTypeProperties$g === void 0 ? void 0 : _dataTypeProperties$g.call(dataTypeProperties, value, {
10403
10458
  localization
10404
- })) !== null && _dataTypeProperties$g !== void 0 ? _dataTypeProperties$g : value;
10459
+ });
10460
+ if (Array.isArray(displayValue)) {
10461
+ var _displayValue$;
10462
+ return (_displayValue$ = displayValue[0]) !== null && _displayValue$ !== void 0 ? _displayValue$ : value;
10463
+ }
10464
+ return displayValue !== null && displayValue !== void 0 ? displayValue : value;
10405
10465
  };
10406
10466
  column.cell = info => dataTypeRenderer(info.getValue());
10407
10467
  column.meta.renderer = dataTypeRenderer;
@@ -11453,6 +11513,7 @@ function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE)
11453
11513
  const _temp = function () {
11454
11514
  if (typeof loadPage === 'function') {
11455
11515
  return Promise.resolve(loadPage(...args)).then(function () {
11516
+ setLoadedStatus(exports.TableServerLoadAllState.Incomplete);
11456
11517
  setReady(true);
11457
11518
  });
11458
11519
  }
@@ -11573,7 +11634,7 @@ function useLazyEffect(effect, deps) {
11573
11634
  const readyRef = React__default.useRef(false);
11574
11635
  React__default.useEffect(() => {
11575
11636
  if (readyRef.current) {
11576
- effect();
11637
+ return effect();
11577
11638
  } else {
11578
11639
  readyRef.current = true;
11579
11640
  }
@@ -11615,7 +11676,8 @@ function useTableFontSizeListener(table) {
11615
11676
  table.setColumnSizing(sizes => {
11616
11677
  return Object.fromEntries(Object.entries(sizes).map(([columnName, prevColumnSize]) => {
11617
11678
  var _column$columnDef$min;
11618
- const column = table.getColumn(columnName);
11679
+ // table.getColumn(columName) throw error in strict dev mode. Related thread: https://github.com/TanStack/table/discussions/5505
11680
+ const column = table.getAllColumns().find(x => x.id === columnName);
11619
11681
  if (isInternalColumn(columnName)) {
11620
11682
  var _column$getSize;
11621
11683
  return [columnName, (_column$getSize = column === null || column === void 0 ? void 0 : column.getSize()) !== null && _column$getSize !== void 0 ? _column$getSize : prevColumnSize];
@@ -13936,22 +13998,29 @@ const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(prop
13936
13998
  });
13937
13999
 
13938
14000
  function EmptyStateBody(props) {
14001
+ var _ref$current, _ref$current$parentNo;
13939
14002
  const {
13940
14003
  emptyState: Placeholder,
13941
14004
  isReady,
13942
14005
  reason,
13943
14006
  ...attributes
13944
14007
  } = props;
14008
+ const ref = React__default.useRef(null);
13945
14009
  if (!isReady) {
13946
14010
  return /*#__PURE__*/React__default.createElement("tbody", Object.assign({}, attributes, {
13947
14011
  className: "!auto-rows-fr"
13948
14012
  }));
13949
14013
  }
13950
14014
  return /*#__PURE__*/React__default.createElement("tbody", Object.assign({}, attributes, {
13951
- className: "!auto-rows-fr"
14015
+ ref: ref,
14016
+ className: "!auto-rows-fr",
14017
+ "data-taco": "empty-state"
13952
14018
  }), /*#__PURE__*/React__default.createElement("tr", {
13953
- className: "!auto-rows-fr"
14019
+ className: "!auto-rows-fr "
13954
14020
  }, /*#__PURE__*/React__default.createElement("td", {
14021
+ style: {
14022
+ maxWidth: ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : (_ref$current$parentNo = _ref$current.parentNode) === null || _ref$current$parentNo === void 0 ? void 0 : _ref$current$parentNo.clientWidth
14023
+ },
13955
14024
  className: "col-span-full !border-0 !p-0 hover:!bg-white"
13956
14025
  }, Placeholder ? /*#__PURE__*/React__default.createElement(Placeholder, {
13957
14026
  reason: reason
@@ -15631,7 +15700,7 @@ const BubbleSelect = props => {
15631
15700
  if (prevValue !== value && setValue) {
15632
15701
  if (Array.isArray(value)) {
15633
15702
  value.forEach(v => {
15634
- const option = select.querySelector(`option[value='${v}']`);
15703
+ const option = select.querySelector(`option[value='${CSS.escape(v)}']`);
15635
15704
  if (option) {
15636
15705
  option.selected = true;
15637
15706
  }
@@ -18657,16 +18726,13 @@ function isTableScrolled(ref) {
18657
18726
  function useTableEditingListener(table, tableRef, scrollToIndex) {
18658
18727
  const tableMeta = table.options.meta;
18659
18728
  const localization = useLocalization();
18660
- // save when the row changes
18661
- // store the last row active index, otherwise everytime tableMeta.editing.saveChanges changes the hook runs again
18662
- const lastRowActiveIndexRef = React__default.useRef(tableMeta.rowActive.rowActiveIndex);
18663
18729
  useLazyEffect(() => {
18664
- if (tableMeta.rowActive.rowActiveIndex !== lastRowActiveIndexRef.current) {
18665
- lastRowActiveIndexRef.current = tableMeta.rowActive.rowActiveIndex;
18666
- if (tableMeta.editing.isEditing && lastRowActiveIndexRef.current !== undefined) {
18667
- tableMeta.editing.saveChanges(table);
18730
+ return () => {
18731
+ if (tableMeta.editing.isEditing && tableMeta.rowActive.rowActiveIndex !== undefined) {
18732
+ var _table$getRowModel$ro;
18733
+ tableMeta.editing.saveChanges(table, (_table$getRowModel$ro = table.getRowModel().rows[tableMeta.rowActive.rowActiveIndex]) === null || _table$getRowModel$ro === void 0 ? void 0 : _table$getRowModel$ro.id);
18668
18734
  }
18669
- }
18735
+ };
18670
18736
  }, [tableMeta.rowActive.rowActiveIndex]);
18671
18737
  // show a warning if the user navigates away without triggering save, such as using the browser back/forward button
18672
18738
  const hasChanges = tableMeta.editing.hasChanges();
@@ -18881,6 +18947,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
18881
18947
  const _temp9 = _forOf(Object.keys(changes), function (rowId) {
18882
18948
  const status = getRowStatus(rowId);
18883
18949
  return _catch(function () {
18950
+ var _changes$rowId;
18884
18951
  function _temp8(_result) {
18885
18952
  return _exit ? _result : Promise.resolve(handleSave(changeSet)).then(function () {
18886
18953
  // cleanup changes, we don't need them after saving
@@ -18892,14 +18959,15 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
18892
18959
  }, DELAY_BEFORE_REMOVING_SAVE_STATUS);
18893
18960
  });
18894
18961
  }
18962
+ const rowChanges = (_changes$rowId = changes[rowId]) !== null && _changes$rowId !== void 0 ? _changes$rowId : {};
18895
18963
  // don't try to save if - already saving, or there are known errors
18896
- if (status === 'saving' || status === 'errored') {
18964
+ if (!Object.keys(rowChanges).length || status === 'saving' || status === 'errored') {
18897
18965
  return;
18898
18966
  }
18899
18967
  setRowStatus(rowId, 'saving');
18900
18968
  const changeSet = {
18901
18969
  ...state.changes.originals[rowId],
18902
- ...changes[rowId]
18970
+ ...rowChanges
18903
18971
  };
18904
18972
  // if we had to create a temporary id, delete it first - it's our data, not theirs
18905
18973
  if (isTemporaryRow(changeSet[rowIdentityAccessor])) {
@@ -18962,7 +19030,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
18962
19030
  return Promise.reject(e);
18963
19031
  }
18964
19032
  };
18965
- const onCellChanged = function (cell, rowIndex, shouldRunUpdaters = true) {
19033
+ const onCellChanged = function (cell, rowIndex, nextValue, shouldRunUpdaters = true) {
18966
19034
  try {
18967
19035
  function _temp6() {
18968
19036
  var _state$changes$errors11;
@@ -19004,7 +19072,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
19004
19072
  }
19005
19073
  // create a projection of the next state, so we can act against it
19006
19074
  const nextChanges = {
19007
- ...state.changes.rows[cell.row.id],
19075
+ ...changes,
19008
19076
  ...updatesForOtherCells
19009
19077
  };
19010
19078
  const nextMoveReasons = {
@@ -19013,10 +19081,11 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
19013
19081
  const nextCellErrors = {
19014
19082
  ...((_state$changes$errors11 = state.changes.errors[cell.row.id]) === null || _state$changes$errors11 === void 0 ? void 0 : _state$changes$errors11.cells)
19015
19083
  };
19016
- // run validation
19084
+ // run validation - if there are changes, and if there is an original stored
19017
19085
  let validationErrors = {};
19018
19086
  const _temp3 = function () {
19019
- if (validator) {
19087
+ if (validator && Object.keys(nextChanges).length && state.changes.originals[cell.row.id]) {
19088
+ // merge with the original so we get a full row
19020
19089
  const nextRowValue = {
19021
19090
  ...state.changes.originals[cell.row.id],
19022
19091
  ...changes,
@@ -19029,8 +19098,13 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
19029
19098
  }();
19030
19099
  return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
19031
19100
  }
19032
- const changes = state.changes.rows[cell.row.id];
19033
- if (!changes) {
19101
+ const changes = nextValue !== undefined ? {
19102
+ ...state.changes.rows[cell.row.id],
19103
+ [cell.column.id]: nextValue
19104
+ } : {
19105
+ ...state.changes.rows[cell.row.id]
19106
+ };
19107
+ if (!Object.keys(changes).length) {
19034
19108
  return Promise.resolve();
19035
19109
  }
19036
19110
  let updatesForOtherCells = {};
@@ -19242,32 +19316,44 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
19242
19316
  function useTableEditing(isEnabled = false, handleSave, handleChange, handleCreate, rowIdentityAccessor, validator) {
19243
19317
  const createRow = function (table, scrollToIndex, row) {
19244
19318
  try {
19245
- if (!handleCreate) {
19246
- return Promise.resolve();
19247
- }
19248
- const tableMeta = table.options.meta;
19249
- return Promise.resolve(tableMeta.editing.saveChanges(table)).then(function (saved) {
19250
- if (!saved) {
19251
- return;
19252
- }
19319
+ let _exit = false;
19320
+ function _temp2(_result) {
19321
+ if (_exit) return _result;
19253
19322
  const changeset = row !== null && row !== void 0 ? row : handleCreate();
19254
19323
  try {
19255
19324
  if (changeset) {
19256
- const rowId = pendingChangesFns.insertTemporaryRow(changeset);
19257
- window.requestAnimationFrame(() => {
19258
- table.getRow(rowId).pin('bottom');
19259
- // set the active row to the new row before toggling editing on
19260
- const temporaryRows = tableMeta.editing.temporaryRows;
19261
- const nextRowIndex = temporaryRows.length ? tableMeta.length + 1 : tableMeta.length;
19262
- tableMeta.rowActive.setRowActiveIndex(nextRowIndex);
19263
- window.requestAnimationFrame(() => toggleEditing(true, table, scrollToIndex));
19264
- setLastFocusedCellIndex(undefined);
19325
+ const newRowId = pendingChangesFns.insertTemporaryRow(changeset);
19326
+ // reset before changing row otherwise the cell changes and validation might run
19327
+ setLastFocusedCellIndex(undefined);
19328
+ // set the active row to the new row before toggling editing on
19329
+ const temporaryRows = tableMeta.editing.temporaryRows;
19330
+ const nextRowIndex = temporaryRows.length ? tableMeta.length + 1 : tableMeta.length;
19331
+ tableMeta.rowActive.setRowActiveIndex(nextRowIndex);
19332
+ // wait until set states have run
19333
+ requestAnimationFrame(() => {
19334
+ toggleEditing(true, table, scrollToIndex, false);
19335
+ table.getRow(newRowId).pin('bottom');
19265
19336
  });
19266
19337
  }
19267
19338
  } catch (error) {
19268
19339
  console.error(error);
19269
19340
  }
19270
- });
19341
+ }
19342
+ if (!handleCreate) {
19343
+ return Promise.resolve();
19344
+ }
19345
+ const tableMeta = table.options.meta;
19346
+ const _temp = function () {
19347
+ if (tableMeta.rowActive.rowActiveIndex !== undefined) {
19348
+ var _table$getRowModel$ro2;
19349
+ return Promise.resolve(tableMeta.editing.saveChanges(table, (_table$getRowModel$ro2 = table.getRowModel().rows[tableMeta.rowActive.rowActiveIndex]) === null || _table$getRowModel$ro2 === void 0 ? void 0 : _table$getRowModel$ro2.id)).then(function (saved) {
19350
+ if (!saved) {
19351
+ _exit = true;
19352
+ }
19353
+ });
19354
+ }
19355
+ }();
19356
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
19271
19357
  } catch (e) {
19272
19358
  return Promise.reject(e);
19273
19359
  }
@@ -19281,24 +19367,26 @@ function useTableEditing(isEnabled = false, handleSave, handleChange, handleCrea
19281
19367
  // store the last focused cell, so that up/down arrow key navigation remains in the same column
19282
19368
  const [lastFocusedCellIndex, setLastFocusedCellIndex] = React__default.useState(undefined);
19283
19369
  const pendingChangesFns = usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, validator);
19284
- function toggleEditing(enabled, table, scrollToIndex) {
19285
- var _tableMeta$rowActive$, _table$getRowModel$ro;
19286
- if (!enabled) {
19287
- // save
19288
- pendingChangesFns.saveChanges(table);
19370
+ function toggleEditing(enabled, table, scrollToIndex, doSave = true) {
19371
+ const tableMeta = table.options.meta;
19372
+ if (enabled) {
19373
+ var _tableMeta$rowActive$, _table$getRowModel$ro;
19374
+ const index = (_tableMeta$rowActive$ = tableMeta.rowActive.rowActiveIndex) !== null && _tableMeta$rowActive$ !== void 0 ? _tableMeta$rowActive$ : 0;
19375
+ if (tableMeta.rowActive.rowActiveIndex === undefined) {
19376
+ tableMeta.rowActive.setRowActiveIndex(index);
19377
+ }
19378
+ if (!isTemporaryRow((_table$getRowModel$ro = table.getRowModel().rows[index]) === null || _table$getRowModel$ro === void 0 ? void 0 : _table$getRowModel$ro.id)) {
19379
+ scrollToIndex(index);
19380
+ }
19381
+ } else if (!enabled) {
19289
19382
  // reset detailed mode
19290
19383
  toggleDetailedMode(false);
19291
19384
  // reset the last index back to the first focusable element, when editing gets turned off
19292
19385
  setLastFocusedCellIndex(undefined);
19293
19386
  }
19294
- const tableMeta = table.options.meta;
19295
- const index = (_tableMeta$rowActive$ = tableMeta.rowActive.rowActiveIndex) !== null && _tableMeta$rowActive$ !== void 0 ? _tableMeta$rowActive$ : 0;
19296
- if (tableMeta.rowActive.rowActiveIndex === undefined) {
19297
- tableMeta.rowActive.setRowActiveIndex(index);
19298
- }
19299
19387
  setEditing(enabled);
19300
- if (!isTemporaryRow((_table$getRowModel$ro = table.getRowModel().rows[index]) === null || _table$getRowModel$ro === void 0 ? void 0 : _table$getRowModel$ro.id)) {
19301
- scrollToIndex(index);
19388
+ if (doSave) {
19389
+ pendingChangesFns.saveChanges(table);
19302
19390
  }
19303
19391
  }
19304
19392
  return {
@@ -19570,20 +19658,26 @@ function EditingControlCell(props) {
19570
19658
  if (nextValue !== value) {
19571
19659
  tableMeta.editing.setCellValue(cell, nextValue);
19572
19660
  if (hasNonTextControl) {
19573
- tableMeta.editing.onCellChanged(cell, rowIndex);
19661
+ requestAnimationFrame(() => tableMeta.editing.onCellChanged(cell, rowIndex, nextValue));
19574
19662
  }
19575
19663
  }
19576
19664
  };
19577
- const handleBlur = () => {
19665
+ function blur() {
19578
19666
  tableMeta.editing.toggleDetailedMode(false);
19579
- tableMeta.editing.onCellChanged(cell, rowIndex, !hasNonTextControl);
19667
+ tableMeta.editing.onCellChanged(cell, rowIndex, undefined, !hasNonTextControl);
19668
+ }
19669
+ const handleBlur = event => {
19670
+ if (isElementInsideOrTriggeredFromContainer(event.relatedTarget, event.currentTarget)) {
19671
+ return;
19672
+ }
19673
+ blur();
19580
19674
  };
19581
19675
  // ensure that blur runs when the cell gets unmounted (when vertically arrow key navigating)
19582
19676
  React__default.useEffect(() => {
19583
19677
  const ref = cellRef.current;
19584
19678
  return () => {
19585
19679
  if (document.activeElement === ref || isElementInsideOrTriggeredFromContainer(document.activeElement, ref)) {
19586
- handleBlur();
19680
+ blur();
19587
19681
  }
19588
19682
  };
19589
19683
  }, []);
@@ -20007,14 +20101,13 @@ function useTable3(props, ref) {
20007
20101
  hasChanges: editing.hasChanges(rowId),
20008
20102
  hasErrors: editing.hasRowErrors(rowId),
20009
20103
  onDiscard: () => {
20104
+ editing.discardChanges(rowId, table);
20010
20105
  if (editing.temporaryRows.length) {
20011
- tableMeta.rowActive.setRowActiveIndex(undefined);
20012
- setTimeout(() => {
20106
+ requestAnimationFrame(() => {
20013
20107
  var _editing$createRowBut;
20014
20108
  return (_editing$createRowBut = editing.createRowButtonRef.current) === null || _editing$createRowBut === void 0 ? void 0 : _editing$createRowBut.focus();
20015
- }, 50);
20109
+ });
20016
20110
  }
20017
- editing.discardChanges(rowId, table);
20018
20111
  },
20019
20112
  onEditingSave: function () {
20020
20113
  try {
@@ -20080,7 +20173,9 @@ function Alert$1(props) {
20080
20173
  // generate links to each invalid row, to go into the error message
20081
20174
  const links = [];
20082
20175
  const visibleColumns = table.getVisibleFlatColumns().map(c => c.id);
20083
- const rowIdentityColumn = tableMeta.rowIdentityAccessor && visibleColumns.includes(String(tableMeta.rowIdentityAccessor)) ? table.getColumn(String(tableMeta.rowIdentityAccessor)) : undefined;
20176
+ const rowIdentityColumn = tableMeta.rowIdentityAccessor && visibleColumns.includes(String(tableMeta.rowIdentityAccessor)) ?
20177
+ // table.getColumn(columName) throw error in strict dev mode. Related thread: https://github.com/TanStack/table/discussions/5505
20178
+ table.getAllColumns().find(x => x.id === String(tableMeta.rowIdentityAccessor)) : undefined;
20084
20179
  pendingChangesWithErrors.forEach((pendingChangeWithError, index) => {
20085
20180
  // if appropriate, concatenate the item with the text "and"
20086
20181
  if (pendingChangesWithErrors.length > 1 && index === pendingChangesWithErrors.length - 1) {