@economic/taco 2.64.0-react-aria-overlays-alpha.0 → 2.64.0-react-aria-overlays-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/taco.cjs CHANGED
@@ -13945,8 +13945,25 @@ function isElementTriggeredFromContainer(element, container) {
13945
13945
  }
13946
13946
  return false;
13947
13947
  }
13948
+ const isDialogOpenedFromContainer = (element, container) => {
13949
+ if (!container) {
13950
+ return false;
13951
+ }
13952
+ let currentDialog = element == null ? void 0 : element.closest('[role="dialog"]');
13953
+ while (currentDialog == null ? void 0 : currentDialog.id) {
13954
+ const opener = document.querySelector(`[aria-controls="${currentDialog.id}"]`);
13955
+ if (!opener) {
13956
+ return false;
13957
+ }
13958
+ if (container.contains(opener)) {
13959
+ return true;
13960
+ }
13961
+ currentDialog = opener.closest('[role="dialog"]');
13962
+ }
13963
+ return false;
13964
+ };
13948
13965
  function isElementInsideOrTriggeredFromContainer(element, container) {
13949
- return isElementTriggeredFromContainer(element, container) || !!(container == null ? void 0 : container.contains(element));
13966
+ return isElementTriggeredFromContainer(element, container) || !!(container == null ? void 0 : container.contains(element)) || isDialogOpenedFromContainer(element, container);
13950
13967
  }
13951
13968
  function isElementInsideOverlay(element) {
13952
13969
  return !!(element == null ? void 0 : element.closest("[role=dialog],[role=menu]"));
@@ -22943,7 +22960,7 @@ const useCombobox = (props, ref) => {
22943
22960
  React__namespace.useEffect(() => {
22944
22961
  const isCurrentValue = value !== void 0 && value !== null && inputValue === String(value);
22945
22962
  if (inputValue && data.length && !isCurrentValue) {
22946
- setCurrentIndex(0);
22963
+ setCurrentIndex(getIndexFromValue(data, inputValue) || 0);
22947
22964
  if (!open) {
22948
22965
  setOpen(true);
22949
22966
  }
@@ -41941,6 +41958,17 @@ function useTableRowDrop(isEnabled = false, onRowDrop) {
41941
41958
  handleDrop: isEnabled ? onRowDrop : void 0
41942
41959
  };
41943
41960
  }
41961
+ function useTableRowActiveListener$1(table, onRowActive) {
41962
+ var _a;
41963
+ const meta = table.options.meta;
41964
+ const rows = table.getRowModel().flatRows;
41965
+ const currentRow = meta.rowActive.rowActiveIndex !== void 0 ? (_a = rows[meta.rowActive.rowActiveIndex]) == null ? void 0 : _a.original : void 0;
41966
+ React.useEffect(() => {
41967
+ if (meta.rowActive.isEnabled && onRowActive) {
41968
+ onRowActive(currentRow);
41969
+ }
41970
+ }, [meta.rowActive.isEnabled, currentRow, onRowActive]);
41971
+ }
41944
41972
  const DEFAULT_EMPTY_ARRAY = [];
41945
41973
  function useTableManager(props, ref, meta, internalColumns) {
41946
41974
  var _a;
@@ -42041,6 +42069,7 @@ function useTableManager(props, ref, meta, internalColumns) {
42041
42069
  useTableDataListener(instance, length);
42042
42070
  useTableFilterListener(instance, props.onChangeFilter);
42043
42071
  useTableFontSizeListener(instance);
42072
+ useTableRowActiveListener$1(instance, props.onRowActive);
42044
42073
  useTableRowHeightListener(instance);
42045
42074
  useTableRowSelectionListener(instance, props.onRowSelect);
42046
42075
  useTableSearchListener(instance);
@@ -43504,7 +43533,7 @@ function Header$2(context) {
43504
43533
  tableMeta.search.enableGlobalFilter ? table.getState().globalFilter : void 0
43505
43534
  );
43506
43535
  }
43507
- table.toggleAllRowsSelected(checked);
43536
+ setTimeout(() => table.toggleAllRowsSelected(checked), 1);
43508
43537
  };
43509
43538
  return /* @__PURE__ */ React.createElement(Tooltip$3, { title }, /* @__PURE__ */ React.createElement(
43510
43539
  Checkbox$1,
@@ -43759,6 +43788,21 @@ function Cell$2(props) {
43759
43788
  }
43760
43789
  return /* @__PURE__ */ React.createElement(CellRenderer, { ...cellProps });
43761
43790
  }
43791
+ const useResizeObserver$1 = (ref, enabled = true) => {
43792
+ const [size2, setSize] = React.useState();
43793
+ React.useEffect(() => {
43794
+ if (!ref.current || !enabled) {
43795
+ return () => void 0;
43796
+ }
43797
+ const observer = new ResizeObserver((entries) => {
43798
+ const entry = entries[0];
43799
+ setSize({ height: entry.contentRect.height, width: entry.contentRect.width });
43800
+ });
43801
+ observer.observe(ref.current);
43802
+ return () => observer.disconnect();
43803
+ }, [enabled]);
43804
+ return size2;
43805
+ };
43762
43806
  const DisplayRow = React.memo(function DisplayRow2(props) {
43763
43807
  var _a, _b, _c;
43764
43808
  const { children, cellRenderer: CellRenderer, index: index2, measureRow, row, table, ...otherAttributes } = props;
@@ -43853,12 +43897,13 @@ const DisplayRow = React.memo(function DisplayRow2(props) {
43853
43897
  }
43854
43898
  const ref = React.useRef(null);
43855
43899
  const expansionRef = React.useRef(null);
43900
+ const expandedRowSize = useResizeObserver$1(expansionRef, !!expandedRow);
43856
43901
  React.useEffect(() => {
43857
43902
  var _a2, _b2;
43858
43903
  const rowHeight = ((_a2 = ref.current) == null ? void 0 : _a2.getBoundingClientRect().height) ?? 0;
43859
43904
  const expansionHeight = ((_b2 = expansionRef.current) == null ? void 0 : _b2.getBoundingClientRect().height) ?? 0;
43860
43905
  measureRow(rowHeight + expansionHeight);
43861
- }, [expansionRef.current]);
43906
+ }, [expansionRef.current, expandedRowSize == null ? void 0 : expandedRowSize.height]);
43862
43907
  const className = clsx("group/row", otherAttributes.className, {
43863
43908
  "hover:cursor-grab": tableMeta.rowDrag.isEnabled && typeof attributes.onClick !== "function",
43864
43909
  "hover:cursor-pointer": typeof attributes.onClick === "function"
@@ -44655,20 +44700,14 @@ const MemoedFooter = React.memo(function MemoedFooter2(props) {
44655
44700
  );
44656
44701
  });
44657
44702
  function EmptyStateBody(props) {
44658
- var _a, _b;
44703
+ var _a;
44659
44704
  const { emptyState: Placeholder2, isReady, reason, ...attributes } = props;
44660
44705
  const ref = React.useRef(null);
44706
+ const rect = useBoundingClientRectListener({ current: (_a = ref.current) == null ? void 0 : _a.parentNode });
44661
44707
  if (!isReady) {
44662
44708
  return /* @__PURE__ */ React.createElement("tbody", { ...attributes, className: "!auto-rows-fr" });
44663
44709
  }
44664
- return /* @__PURE__ */ React.createElement("tbody", { ...attributes, ref, className: "!auto-rows-fr", "data-taco": "empty-state" }, /* @__PURE__ */ React.createElement("tr", { className: "!auto-rows-fr " }, /* @__PURE__ */ React.createElement(
44665
- "td",
44666
- {
44667
- style: { maxWidth: (_b = (_a = ref == null ? void 0 : ref.current) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.clientWidth },
44668
- className: "col-span-full !border-0 !p-0 hover:!bg-white"
44669
- },
44670
- Placeholder2 ? /* @__PURE__ */ React.createElement(Placeholder2, { reason }) : void 0
44671
- )));
44710
+ return /* @__PURE__ */ React.createElement("tbody", { ...attributes, ref, className: "!auto-rows-fr", "data-taco": "empty-state" }, /* @__PURE__ */ React.createElement("tr", { className: "!auto-rows-fr" }, /* @__PURE__ */ React.createElement("td", { style: { maxWidth: rect == null ? void 0 : rect.width }, className: "col-span-full !border-0 !p-0 hover:!bg-white" }, Placeholder2 ? /* @__PURE__ */ React.createElement(Placeholder2, { reason }) : void 0)));
44672
44711
  }
44673
44712
  const SearchInput22 = React.forwardRef(function SearchInput222(props, ref) {
44674
44713
  const {
@@ -48295,67 +48334,6 @@ function useDroppable(_ref) {
48295
48334
  setNodeRef
48296
48335
  };
48297
48336
  }
48298
- const restrictToVerticalAxis = (_ref) => {
48299
- let {
48300
- transform
48301
- } = _ref;
48302
- return {
48303
- ...transform,
48304
- x: 0
48305
- };
48306
- };
48307
- function getContainerById(children, id2) {
48308
- var _a;
48309
- const lists = React.Children.toArray(children).filter(
48310
- (child) => child.type.displayName === "SortableList"
48311
- );
48312
- const list = lists.find(
48313
- (list2) => list2.props.id === id2
48314
- );
48315
- if (list) {
48316
- return list == null ? void 0 : list.props;
48317
- }
48318
- return (_a = lists.find((l2) => React.Children.toArray(l2.props.children).findIndex((child) => child.props.id === id2) > -1)) == null ? void 0 : _a.props;
48319
- }
48320
- function Container$1(externalProps) {
48321
- const { children, reorder, move } = externalProps;
48322
- function handleDragOver(event) {
48323
- const { active, over } = event;
48324
- if (!(active == null ? void 0 : active.id) || !(over == null ? void 0 : over.id)) {
48325
- return;
48326
- }
48327
- const activeList = getContainerById(children, active.id);
48328
- const overList = getContainerById(children, over.id);
48329
- if (!(activeList == null ? void 0 : activeList.id) || !(overList == null ? void 0 : overList.id) || activeList.id === overList.id) {
48330
- return;
48331
- }
48332
- move(active.id, activeList == null ? void 0 : activeList.id, overList.id);
48333
- }
48334
- function handleDragEnd(event) {
48335
- const { active, over } = event;
48336
- if (!(active == null ? void 0 : active.id) || !(over == null ? void 0 : over.id)) {
48337
- return;
48338
- }
48339
- const activeList = getContainerById(children, active.id);
48340
- const overList = getContainerById(children, over.id);
48341
- if (!(activeList == null ? void 0 : activeList.id) || !(overList == null ? void 0 : overList.id) || activeList.id !== overList.id) {
48342
- return;
48343
- }
48344
- reorder(active.id, over.id, overList.id);
48345
- }
48346
- return /* @__PURE__ */ React.createElement(
48347
- DndContext,
48348
- {
48349
- collisionDetection: closestCenter,
48350
- ...externalProps,
48351
- modifiers: [restrictToVerticalAxis],
48352
- onDragOver: handleDragOver,
48353
- onDragEnd: handleDragEnd
48354
- },
48355
- children
48356
- );
48357
- }
48358
- Container$1.displayName = "SortableContainer";
48359
48337
  function arrayMove(array2, from, to) {
48360
48338
  const newArray = array2.slice();
48361
48339
  newArray.splice(to < 0 ? newArray.length + to : to, 0, newArray.splice(from, 1)[0]);
@@ -48824,6 +48802,74 @@ function normalizeLocalDisabled(localDisabled, globalDisabled) {
48824
48802
  };
48825
48803
  }
48826
48804
  [KeyboardCode.Down, KeyboardCode.Right, KeyboardCode.Up, KeyboardCode.Left];
48805
+ function List(externalProps) {
48806
+ const { children, id: id2, ...props } = externalProps;
48807
+ const { setNodeRef } = useDroppable({ id: id2 });
48808
+ const items = React.Children.toArray(children).map((child) => child.props);
48809
+ return /* @__PURE__ */ React.createElement(SortableContext, { id: id2, items, strategy: verticalListSortingStrategy }, /* @__PURE__ */ React.createElement("div", { ...props, ref: id2 ? setNodeRef : void 0 }, children));
48810
+ }
48811
+ List.displayName = "SortableList";
48812
+ const restrictToVerticalAxis = (_ref) => {
48813
+ let {
48814
+ transform
48815
+ } = _ref;
48816
+ return {
48817
+ ...transform,
48818
+ x: 0
48819
+ };
48820
+ };
48821
+ function getContainerById(children, id2) {
48822
+ var _a;
48823
+ const lists = React.Children.toArray(children).filter(
48824
+ (child) => child.type === List
48825
+ );
48826
+ const list = lists.find(
48827
+ (list2) => list2.props.id === id2
48828
+ );
48829
+ if (list) {
48830
+ return list == null ? void 0 : list.props;
48831
+ }
48832
+ return (_a = lists.find((l2) => React.Children.toArray(l2.props.children).findIndex((child) => child.props.id === id2) > -1)) == null ? void 0 : _a.props;
48833
+ }
48834
+ function Container$1(externalProps) {
48835
+ const { children, reorder, move } = externalProps;
48836
+ function handleDragOver(event) {
48837
+ const { active, over } = event;
48838
+ if (!(active == null ? void 0 : active.id) || !(over == null ? void 0 : over.id)) {
48839
+ return;
48840
+ }
48841
+ const activeList = getContainerById(children, active.id);
48842
+ const overList = getContainerById(children, over.id);
48843
+ if (!(activeList == null ? void 0 : activeList.id) || !(overList == null ? void 0 : overList.id) || activeList.id === overList.id) {
48844
+ return;
48845
+ }
48846
+ move == null ? void 0 : move(active.id, activeList.id, overList.id);
48847
+ }
48848
+ function handleDragEnd(event) {
48849
+ const { active, over } = event;
48850
+ if (!(active == null ? void 0 : active.id) || !(over == null ? void 0 : over.id)) {
48851
+ return;
48852
+ }
48853
+ const activeList = getContainerById(children, active.id);
48854
+ const overList = getContainerById(children, over.id);
48855
+ if (!(activeList == null ? void 0 : activeList.id) || !(overList == null ? void 0 : overList.id) || activeList.id !== overList.id) {
48856
+ return;
48857
+ }
48858
+ reorder(active.id, over.id, overList.id);
48859
+ }
48860
+ return /* @__PURE__ */ React.createElement(
48861
+ DndContext,
48862
+ {
48863
+ collisionDetection: closestCenter,
48864
+ ...externalProps,
48865
+ modifiers: [restrictToVerticalAxis],
48866
+ onDragOver: handleDragOver,
48867
+ onDragEnd: handleDragEnd
48868
+ },
48869
+ children
48870
+ );
48871
+ }
48872
+ Container$1.displayName = "SortableContainer";
48827
48873
  const isFormElement = (element) => {
48828
48874
  const formElementNodeNames = ["BUTTON", "INPUT", "TEXTAREA", "SELECT", "FIELDSET"];
48829
48875
  return formElementNodeNames.includes(element.nodeName);
@@ -48847,13 +48893,6 @@ function Item(props) {
48847
48893
  return /* @__PURE__ */ React.createElement("div", { ...elProps }, children);
48848
48894
  }
48849
48895
  Item.displayName = "SortableListItem";
48850
- function List(externalProps) {
48851
- const { children, id: id2, ...props } = externalProps;
48852
- const { setNodeRef } = useDroppable({ id: id2 });
48853
- const items = React.Children.toArray(children).map((child) => child.props);
48854
- return /* @__PURE__ */ React.createElement(SortableContext, { id: id2, items, strategy: verticalListSortingStrategy }, /* @__PURE__ */ React.createElement("div", { ...props, ref: id2 ? setNodeRef : void 0 }, children));
48855
- }
48856
- List.displayName = "SortableList";
48857
48896
  const Column$3 = React.forwardRef(function Column2(props, ref) {
48858
48897
  var _a, _b, _c;
48859
48898
  const { column, draggable = false, ...dragAttributes } = props;
@@ -50478,11 +50517,11 @@ function guessComparatorsBasedOnControl(column) {
50478
50517
  }
50479
50518
  const FilterContext = React.createContext([]);
50480
50519
  const FilterColumn = React.forwardRef((props, ref) => {
50481
- const { allColumns, onChange: handleChange, value = null, ...attributes } = props;
50520
+ const { allHeaders, onChange: handleChange, value = null, ...attributes } = props;
50482
50521
  const { texts } = useLocalization();
50483
50522
  const filters = React.useContext(FilterContext);
50484
- const selectedColumn = allColumns.find((column) => column.id === value);
50485
- const warning2 = selectedColumn && !selectedColumn.getIsVisible();
50523
+ const selectedColumn = allHeaders.find((header) => header.id === value);
50524
+ const warning2 = selectedColumn && !selectedColumn.column.getIsVisible();
50486
50525
  return /* @__PURE__ */ React.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement(
50487
50526
  Field,
50488
50527
  {
@@ -50500,23 +50539,23 @@ const FilterColumn = React.forwardRef((props, ref) => {
50500
50539
  onChange: handleChange,
50501
50540
  value
50502
50541
  },
50503
- allColumns.map((column) => {
50504
- var _a, _b, _c;
50542
+ allHeaders.map((header) => {
50543
+ var _a, _b;
50505
50544
  return /* @__PURE__ */ React.createElement(
50506
50545
  Select22.Option,
50507
50546
  {
50508
- key: column.id,
50509
- value: column.id,
50510
- postfix: !column.getIsVisible() || column.getIsGrouped() ? /* @__PURE__ */ React.createElement(
50547
+ key: header.column.id,
50548
+ value: header.column.id,
50549
+ postfix: !header.column.getIsVisible() || header.column.getIsGrouped() ? /* @__PURE__ */ React.createElement(
50511
50550
  Tooltip$3,
50512
50551
  {
50513
- title: column.getIsGrouped() ? texts.table.filters.hiddenGroupedColumn : texts.table.filters.hiddenColumn
50552
+ title: header.column.getIsGrouped() ? texts.table.filters.hiddenGroupedColumn : texts.table.filters.hiddenColumn
50514
50553
  },
50515
50554
  /* @__PURE__ */ React.createElement(Icon$1, { name: "eye-off", className: "text-grey-500 !h-5 !w-5" })
50516
50555
  ) : void 0,
50517
- disabled: column.id !== value && (!column.getCanFilter() || !!filters.find((f2) => f2.id === column.id))
50556
+ disabled: header.column.id !== value && (!header.column.getCanFilter() || !!filters.find((f2) => f2.id === header.column.id))
50518
50557
  },
50519
- ((_a = column.columnDef.meta) == null ? void 0 : _a.header) + (column.parent ? ` (${(_c = (_b = column.parent) == null ? void 0 : _b.columnDef.meta) == null ? void 0 : _c.header})` : "")
50558
+ /* @__PURE__ */ React.createElement(React.Fragment, null, flexRender(header.column.columnDef.header, header.getContext()), header.column.parent ? ` (${flexRender((_b = (_a = header.column.parent) == null ? void 0 : _a.columnDef.meta) == null ? void 0 : _b.header, header.getContext())})` : "")
50520
50559
  );
50521
50560
  })
50522
50561
  )
@@ -50685,9 +50724,9 @@ function Control(props) {
50685
50724
  );
50686
50725
  }
50687
50726
  function Filter(props) {
50688
- const { allColumns, filter: filter2, onChange: handleChange, onRemove, position } = props;
50727
+ const { allHeaders, filter: filter2, onChange: handleChange, onRemove, position } = props;
50689
50728
  const { texts } = useLocalization();
50690
- const column = allColumns.find((c2) => c2.id === filter2.id);
50729
+ const column = allHeaders.find((header) => header.column.id === filter2.id);
50691
50730
  const ref = React.useRef(null);
50692
50731
  const {
50693
50732
  id: id2,
@@ -50695,13 +50734,13 @@ function Filter(props) {
50695
50734
  } = filter2;
50696
50735
  const handleChangeColumn = (columnId) => {
50697
50736
  var _a, _b, _c;
50698
- const previousColumn = allColumns.find((column2) => column2.id === id2);
50699
- const nextColumn = allColumns.find((column2) => column2.id === columnId);
50700
- if (((_a = previousColumn == null ? void 0 : previousColumn.columnDef.meta) == null ? void 0 : _a.dataType) && ((_b = previousColumn == null ? void 0 : previousColumn.columnDef.meta) == null ? void 0 : _b.dataType) === ((_c = nextColumn == null ? void 0 : nextColumn.columnDef.meta) == null ? void 0 : _c.dataType)) {
50737
+ const previousColumn = allHeaders.find((header) => header.column.id === id2);
50738
+ const nextColumn = allHeaders.find((header) => header.column.id === columnId);
50739
+ if (((_a = previousColumn == null ? void 0 : previousColumn.column.columnDef.meta) == null ? void 0 : _a.dataType) && ((_b = previousColumn == null ? void 0 : previousColumn.column.columnDef.meta) == null ? void 0 : _b.dataType) === ((_c = nextColumn == null ? void 0 : nextColumn.column.columnDef.meta) == null ? void 0 : _c.dataType)) {
50701
50740
  handleChange(position, { id: columnId, value: filter2.value });
50702
50741
  return;
50703
50742
  }
50704
- const validComparators = guessComparatorsBasedOnControl(nextColumn);
50743
+ const validComparators = guessComparatorsBasedOnControl(nextColumn == null ? void 0 : nextColumn.column);
50705
50744
  const value2 = {
50706
50745
  comparator: validComparators[0],
50707
50746
  value: void 0
@@ -50724,13 +50763,13 @@ function Filter(props) {
50724
50763
  ref.current.focus();
50725
50764
  }
50726
50765
  }, [id2]);
50727
- return /* @__PURE__ */ React.createElement("div", { className: "flex items-start gap-2" }, /* @__PURE__ */ React.createElement("div", { className: "flex min-h-[theme(spacing.8)] w-14 flex-shrink-0 items-center justify-end pr-2 text-right" }, position > 0 ? texts.table.filters.conditions.and : texts.table.filters.conditions.where), /* @__PURE__ */ React.createElement(FilterColumn, { allColumns, onChange: handleChangeColumn, value: id2, ref }), /* @__PURE__ */ React.createElement(FilterComparator, { column, onChange: handleChangeComparator, value: comparator }), /* @__PURE__ */ React.createElement(FilterValue, { column, comparator, onChange: handleChangeValue, value }), onRemove ? /* @__PURE__ */ React.createElement(IconButton, { appearance: "discrete", className: "ml-auto", icon: "close", onClick: handleRemove }) : null);
50766
+ return /* @__PURE__ */ React.createElement("div", { className: "flex items-start gap-2" }, /* @__PURE__ */ React.createElement("div", { className: "flex min-h-[theme(spacing.8)] w-14 flex-shrink-0 items-center justify-end pr-2 text-right" }, position > 0 ? texts.table.filters.conditions.and : texts.table.filters.conditions.where), /* @__PURE__ */ React.createElement(FilterColumn, { allHeaders, onChange: handleChangeColumn, value: id2, ref }), /* @__PURE__ */ React.createElement(FilterComparator, { column: column == null ? void 0 : column.column, onChange: handleChangeComparator, value: comparator }), /* @__PURE__ */ React.createElement(FilterValue, { column: column == null ? void 0 : column.column, comparator, onChange: handleChangeValue, value }), onRemove ? /* @__PURE__ */ React.createElement(IconButton, { appearance: "discrete", className: "ml-auto", icon: "close", onClick: handleRemove }) : null);
50728
50767
  }
50729
50768
  const placeholderFilter = { id: "", value: { comparator: TableFilterComparator.Contains, value: void 0 } };
50730
50769
  function ManageFiltersPopover(props) {
50731
50770
  const { length, table, ...popoverProps } = props;
50732
50771
  const { locale: locale2, texts } = useLocalization();
50733
- const allColumns = table.getAllLeafColumns().filter((column) => !isInternalColumn(column.id)).sort(sortByHeader);
50772
+ const allHeaders = table.getLeafHeaders().filter((column) => !isInternalColumn(column.id)).sort((headerA, headerB) => sortByHeader(headerA.column, headerB.column));
50734
50773
  const columnFilters = table.getState().columnFilters;
50735
50774
  const tableMeta = table.options.meta;
50736
50775
  const [filters, setFilters] = React.useState(columnFilters.length ? columnFilters : [placeholderFilter]);
@@ -50769,7 +50808,7 @@ function ManageFiltersPopover(props) {
50769
50808
  if (f2.id === null || f2.id === "") {
50770
50809
  return false;
50771
50810
  }
50772
- const controlRenderer = (_b = (_a = allColumns.find((c2) => c2.id === f2.id)) == null ? void 0 : _a.columnDef.meta) == null ? void 0 : _b.control;
50811
+ const controlRenderer = (_b = (_a = allHeaders.find((header) => header.column.id === f2.id)) == null ? void 0 : _a.column.columnDef.meta) == null ? void 0 : _b.control;
50773
50812
  if (f2.value.comparator === TableFilterComparator.IsEmpty || f2.value.comparator === TableFilterComparator.IsNotEmpty || controlRenderer === "switch") {
50774
50813
  return true;
50775
50814
  }
@@ -50799,7 +50838,7 @@ function ManageFiltersPopover(props) {
50799
50838
  Filter,
50800
50839
  {
50801
50840
  key: `filter_${index2}`,
50802
- allColumns,
50841
+ allHeaders,
50803
50842
  filter: filter2,
50804
50843
  position: index2,
50805
50844
  onChange: handleChangeFilter,
@@ -59239,14 +59278,6 @@ function isTableScrolled(ref) {
59239
59278
  function useTableEditingListener(table, tableRef, scrollToIndex) {
59240
59279
  const tableMeta = table.options.meta;
59241
59280
  const localization = useLocalization();
59242
- useLazyEffect(() => {
59243
- return () => {
59244
- var _a;
59245
- if (tableMeta.editing.isEditing && tableMeta.rowActive.rowActiveIndex !== void 0) {
59246
- tableMeta.editing.saveChanges(table, (_a = table.getRowModel().rows[tableMeta.rowActive.rowActiveIndex]) == null ? void 0 : _a.id);
59247
- }
59248
- };
59249
- }, [tableMeta.rowActive.rowActiveIndex, tableMeta.editing.isEditing]);
59250
59281
  const hasChanges = tableMeta.editing.hasChanges();
59251
59282
  React.useEffect(() => {
59252
59283
  function showUnsavedChangesWarning(event) {
@@ -60591,7 +60622,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
60591
60622
  var _a, _b, _c;
60592
60623
  return (_c = (_b = (_a = state.changes.errors) == null ? void 0 : _a[cell.row.id]) == null ? void 0 : _b.cells) == null ? void 0 : _c[cell.column.id];
60593
60624
  }
60594
- async function onCellChanged(cell, rowIndex, nextValue, shouldRunUpdaters = true) {
60625
+ async function onCellChanged(cell, rowIndex, nextValue, shouldRunUpdaters = true, shouldRunValidation = true) {
60595
60626
  var _a;
60596
60627
  const tableMeta = cell.getContext().table.options.meta;
60597
60628
  const state2 = tableMeta.editing.getState();
@@ -60621,7 +60652,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
60621
60652
  const nextMoveReasons = { ...state2.changes.moveReasons[cell.row.id] };
60622
60653
  const nextCellErrors = { ...(_a = state2.changes.errors[cell.row.id]) == null ? void 0 : _a.cells };
60623
60654
  let validationErrors = {};
60624
- if (validator && Object.keys(nextChanges).length && original) {
60655
+ if (validator && Object.keys(nextChanges).length && original && shouldRunValidation) {
60625
60656
  const nextRowValue = { ...original, ...changes, ...updatesForOtherCells };
60626
60657
  validationErrors = await validator(nextRowValue) ?? {};
60627
60658
  }
@@ -60749,7 +60780,9 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
60749
60780
  return completed;
60750
60781
  }
60751
60782
  async function discardChanges(rowId, table) {
60752
- table.resetRowPinning(true);
60783
+ if (rowId.startsWith(TEMPORARY_ROW_ID_PREFIX)) {
60784
+ table.resetRowPinning(true);
60785
+ }
60753
60786
  dispatch({
60754
60787
  type: "removeRow",
60755
60788
  rowId,
@@ -60845,7 +60878,7 @@ function useTableEditing(isEnabled = false, defaultToggleEditing = false, handle
60845
60878
  return;
60846
60879
  }
60847
60880
  }
60848
- const changeset = row ?? handleCreate();
60881
+ const changeset = row ?? await handleCreate();
60849
60882
  try {
60850
60883
  if (changeset) {
60851
60884
  const temporaryRows = tableMeta.editing.temporaryRows;
@@ -61103,7 +61136,7 @@ function EditingControlCell(props) {
61103
61136
  if (hasChanged) {
61104
61137
  tableMeta.editing.setCellValue(cell, rowIndex, nextValue);
61105
61138
  if (hasNonTextControl) {
61106
- requestAnimationFrame(() => tableMeta.editing.onCellChanged(cell, rowIndex, nextValue));
61139
+ requestAnimationFrame(() => tableMeta.editing.onCellChanged(cell, rowIndex, nextValue, true, false));
61107
61140
  }
61108
61141
  }
61109
61142
  },
@@ -61116,7 +61149,7 @@ function EditingControlCell(props) {
61116
61149
  }
61117
61150
  requestAnimationFrame(() => {
61118
61151
  tableMeta.editing.toggleDetailedMode(false);
61119
- tableMeta.editing.onCellChanged(cell, rowIndex, void 0, !hasNonTextControl);
61152
+ tableMeta.editing.onCellChanged(cell, rowIndex, void 0, !hasNonTextControl, true);
61120
61153
  });
61121
61154
  },
61122
61155
  [hasNonTextControl, cell.row.id, JSON.stringify(rowChanges), rowIndex, cell.column.id, cell.row.original]
@@ -61412,6 +61445,11 @@ function Row(props) {
61412
61445
  }
61413
61446
  }
61414
61447
  }, [tableMeta.editing.isEditing, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.lastFocusedCellIndex]);
61448
+ useLazyEffect(() => {
61449
+ if (tableMeta.editing.isEditing && !isActiveRow) {
61450
+ tableMeta.editing.saveChanges(table, row.id);
61451
+ }
61452
+ }, [isActiveRow]);
61415
61453
  const handleFocus = React.useCallback(
61416
61454
  (event) => {
61417
61455
  var _a;