@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.css CHANGED
@@ -1643,6 +1643,10 @@ table[data-taco^='table'] tbody tr[data-row-create] td {
1643
1643
  table[data-taco^='table'] tbody tr[data-row-create] td button {
1644
1644
  @apply -mt-[3px];
1645
1645
  }
1646
+
1647
+ table[data-taco='table3'] td [data-taco='combobox'] {
1648
+ display: inline;
1649
+ }
1646
1650
  [data-taco='card-content'] > [data-taco='chart-wrapper']:not(:has([data-taco='chart-donut'], [data-taco='chart-pie'])) {
1647
1651
  @apply w-full;
1648
1652
  }
package/dist/taco.d.ts CHANGED
@@ -3044,7 +3044,7 @@ export declare interface Table3CommonProps<TType = unknown> extends Table3Featur
3044
3044
 
3045
3045
  export declare type Table3EditingChangeHandler<TType = unknown> = (accessor: string, value: unknown, row: TType, prevRow: TType) => Promise<Partial<TType>> | undefined;
3046
3046
 
3047
- export declare type Table3EditingCreateHandler<TType = unknown> = () => Partial<TType>;
3047
+ export declare type Table3EditingCreateHandler<TType = unknown> = () => Promise<Partial<TType>>;
3048
3048
 
3049
3049
  declare type Table3EditingDiscardHandler = () => void;
3050
3050
 
@@ -3065,7 +3065,7 @@ export declare type Table3Ref = TableRef & {
3065
3065
  editing?: {
3066
3066
  toggleEditing: (enabled: boolean | undefined) => void;
3067
3067
  createRow?: (row: unknown) => Promise<void>;
3068
- save: (rowId: string) => Promise<boolean>;
3068
+ save: (rowId?: string) => Promise<boolean>;
3069
3069
  removeRowChanges: (rowId: string) => Promise<void>;
3070
3070
  };
3071
3071
  };
@@ -3296,6 +3296,7 @@ export declare type TableCommonProps<TType = unknown> = TableFeatureProps<TType>
3296
3296
  toolbarRight?: JSX.Element;
3297
3297
  toolbarPanel?: JSX.Element;
3298
3298
  onEvent?: TableEventHandler;
3299
+ onRowActive?: TableRowActiveHandler<TType>;
3299
3300
  onRowClick?: TableRowClickHandler<TType>;
3300
3301
  onRowDrag?: TableRowDragHandler<TType>;
3301
3302
  onRowDrop?: TableRowDropHandler<TType>;
@@ -3419,6 +3420,8 @@ export declare type TableRowActionRenderer<TType = unknown> = (row: TType, helpe
3419
3420
  };
3420
3421
  }) => JSX.Element | null;
3421
3422
 
3423
+ export declare type TableRowActiveHandler<TType = unknown> = (row: TType | undefined) => void;
3424
+
3422
3425
  export declare type TableRowClickHandler<TType = unknown> = (row: TType) => void;
3423
3426
 
3424
3427
  export declare type TableRowDragHandler<TType = unknown> = (rows: TType[], showPlaceholder: (text: string) => void, setDataTransfer: (data: string) => void) => void;
@@ -3999,7 +4002,7 @@ export declare type useTableDataAllFetcher2<TType = unknown> = (sorting: TableCo
3999
4002
 
4000
4003
  export declare function useTableDataLoader<TType = unknown>(fetchPage: useTableDataPageFetcher<TType>, fetchAll: useTableDataAllFetcher<TType>, options?: useTableDataLoaderOptions): [useTableDataLoaderValues<TType>, () => void];
4001
4004
 
4002
- export declare function useTableDataLoader2<TType = unknown>(fetchPage: useTableDataPageFetcher2<TType>, fetchAll: useTableDataAllFetcher2<TType>, options?: useTableDataLoaderOptions): [useTableDataLoaderValues2<TType>, () => void];
4005
+ export declare function useTableDataLoader2<TType = unknown>(fetchPage: useTableDataPageFetcher2<TType>, fetchAll: useTableDataAllFetcher2<TType>, options?: useTableDataLoaderOptions): [useTableDataLoaderValues2<TType>, () => Promise<void>];
4003
4006
 
4004
4007
  export declare type useTableDataLoaderOptions = {
4005
4008
  pageSize: number;
package/dist/taco.js CHANGED
@@ -13927,8 +13927,25 @@ function isElementTriggeredFromContainer(element, container) {
13927
13927
  }
13928
13928
  return false;
13929
13929
  }
13930
+ const isDialogOpenedFromContainer = (element, container) => {
13931
+ if (!container) {
13932
+ return false;
13933
+ }
13934
+ let currentDialog = element == null ? void 0 : element.closest('[role="dialog"]');
13935
+ while (currentDialog == null ? void 0 : currentDialog.id) {
13936
+ const opener = document.querySelector(`[aria-controls="${currentDialog.id}"]`);
13937
+ if (!opener) {
13938
+ return false;
13939
+ }
13940
+ if (container.contains(opener)) {
13941
+ return true;
13942
+ }
13943
+ currentDialog = opener.closest('[role="dialog"]');
13944
+ }
13945
+ return false;
13946
+ };
13930
13947
  function isElementInsideOrTriggeredFromContainer(element, container) {
13931
- return isElementTriggeredFromContainer(element, container) || !!(container == null ? void 0 : container.contains(element));
13948
+ return isElementTriggeredFromContainer(element, container) || !!(container == null ? void 0 : container.contains(element)) || isDialogOpenedFromContainer(element, container);
13932
13949
  }
13933
13950
  function isElementInsideOverlay(element) {
13934
13951
  return !!(element == null ? void 0 : element.closest("[role=dialog],[role=menu]"));
@@ -22925,7 +22942,7 @@ const useCombobox = (props, ref) => {
22925
22942
  React.useEffect(() => {
22926
22943
  const isCurrentValue = value !== void 0 && value !== null && inputValue === String(value);
22927
22944
  if (inputValue && data.length && !isCurrentValue) {
22928
- setCurrentIndex(0);
22945
+ setCurrentIndex(getIndexFromValue(data, inputValue) || 0);
22929
22946
  if (!open) {
22930
22947
  setOpen(true);
22931
22948
  }
@@ -41923,6 +41940,17 @@ function useTableRowDrop(isEnabled = false, onRowDrop) {
41923
41940
  handleDrop: isEnabled ? onRowDrop : void 0
41924
41941
  };
41925
41942
  }
41943
+ function useTableRowActiveListener$1(table, onRowActive) {
41944
+ var _a;
41945
+ const meta = table.options.meta;
41946
+ const rows = table.getRowModel().flatRows;
41947
+ const currentRow = meta.rowActive.rowActiveIndex !== void 0 ? (_a = rows[meta.rowActive.rowActiveIndex]) == null ? void 0 : _a.original : void 0;
41948
+ React__default.useEffect(() => {
41949
+ if (meta.rowActive.isEnabled && onRowActive) {
41950
+ onRowActive(currentRow);
41951
+ }
41952
+ }, [meta.rowActive.isEnabled, currentRow, onRowActive]);
41953
+ }
41926
41954
  const DEFAULT_EMPTY_ARRAY = [];
41927
41955
  function useTableManager(props, ref, meta, internalColumns) {
41928
41956
  var _a;
@@ -42023,6 +42051,7 @@ function useTableManager(props, ref, meta, internalColumns) {
42023
42051
  useTableDataListener(instance, length);
42024
42052
  useTableFilterListener(instance, props.onChangeFilter);
42025
42053
  useTableFontSizeListener(instance);
42054
+ useTableRowActiveListener$1(instance, props.onRowActive);
42026
42055
  useTableRowHeightListener(instance);
42027
42056
  useTableRowSelectionListener(instance, props.onRowSelect);
42028
42057
  useTableSearchListener(instance);
@@ -43486,7 +43515,7 @@ function Header$2(context) {
43486
43515
  tableMeta.search.enableGlobalFilter ? table.getState().globalFilter : void 0
43487
43516
  );
43488
43517
  }
43489
- table.toggleAllRowsSelected(checked);
43518
+ setTimeout(() => table.toggleAllRowsSelected(checked), 1);
43490
43519
  };
43491
43520
  return /* @__PURE__ */ React__default.createElement(Tooltip$3, { title }, /* @__PURE__ */ React__default.createElement(
43492
43521
  Checkbox$1,
@@ -43741,6 +43770,21 @@ function Cell$2(props) {
43741
43770
  }
43742
43771
  return /* @__PURE__ */ React__default.createElement(CellRenderer, { ...cellProps });
43743
43772
  }
43773
+ const useResizeObserver$1 = (ref, enabled = true) => {
43774
+ const [size2, setSize] = React__default.useState();
43775
+ React__default.useEffect(() => {
43776
+ if (!ref.current || !enabled) {
43777
+ return () => void 0;
43778
+ }
43779
+ const observer = new ResizeObserver((entries) => {
43780
+ const entry = entries[0];
43781
+ setSize({ height: entry.contentRect.height, width: entry.contentRect.width });
43782
+ });
43783
+ observer.observe(ref.current);
43784
+ return () => observer.disconnect();
43785
+ }, [enabled]);
43786
+ return size2;
43787
+ };
43744
43788
  const DisplayRow = React__default.memo(function DisplayRow2(props) {
43745
43789
  var _a, _b, _c;
43746
43790
  const { children, cellRenderer: CellRenderer, index: index2, measureRow, row, table, ...otherAttributes } = props;
@@ -43835,12 +43879,13 @@ const DisplayRow = React__default.memo(function DisplayRow2(props) {
43835
43879
  }
43836
43880
  const ref = React__default.useRef(null);
43837
43881
  const expansionRef = React__default.useRef(null);
43882
+ const expandedRowSize = useResizeObserver$1(expansionRef, !!expandedRow);
43838
43883
  React__default.useEffect(() => {
43839
43884
  var _a2, _b2;
43840
43885
  const rowHeight = ((_a2 = ref.current) == null ? void 0 : _a2.getBoundingClientRect().height) ?? 0;
43841
43886
  const expansionHeight = ((_b2 = expansionRef.current) == null ? void 0 : _b2.getBoundingClientRect().height) ?? 0;
43842
43887
  measureRow(rowHeight + expansionHeight);
43843
- }, [expansionRef.current]);
43888
+ }, [expansionRef.current, expandedRowSize == null ? void 0 : expandedRowSize.height]);
43844
43889
  const className = clsx("group/row", otherAttributes.className, {
43845
43890
  "hover:cursor-grab": tableMeta.rowDrag.isEnabled && typeof attributes.onClick !== "function",
43846
43891
  "hover:cursor-pointer": typeof attributes.onClick === "function"
@@ -44637,20 +44682,14 @@ const MemoedFooter = React__default.memo(function MemoedFooter2(props) {
44637
44682
  );
44638
44683
  });
44639
44684
  function EmptyStateBody(props) {
44640
- var _a, _b;
44685
+ var _a;
44641
44686
  const { emptyState: Placeholder2, isReady, reason, ...attributes } = props;
44642
44687
  const ref = React__default.useRef(null);
44688
+ const rect = useBoundingClientRectListener({ current: (_a = ref.current) == null ? void 0 : _a.parentNode });
44643
44689
  if (!isReady) {
44644
44690
  return /* @__PURE__ */ React__default.createElement("tbody", { ...attributes, className: "!auto-rows-fr" });
44645
44691
  }
44646
- return /* @__PURE__ */ React__default.createElement("tbody", { ...attributes, ref, className: "!auto-rows-fr", "data-taco": "empty-state" }, /* @__PURE__ */ React__default.createElement("tr", { className: "!auto-rows-fr " }, /* @__PURE__ */ React__default.createElement(
44647
- "td",
44648
- {
44649
- style: { maxWidth: (_b = (_a = ref == null ? void 0 : ref.current) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.clientWidth },
44650
- className: "col-span-full !border-0 !p-0 hover:!bg-white"
44651
- },
44652
- Placeholder2 ? /* @__PURE__ */ React__default.createElement(Placeholder2, { reason }) : void 0
44653
- )));
44692
+ return /* @__PURE__ */ React__default.createElement("tbody", { ...attributes, ref, className: "!auto-rows-fr", "data-taco": "empty-state" }, /* @__PURE__ */ React__default.createElement("tr", { className: "!auto-rows-fr" }, /* @__PURE__ */ React__default.createElement("td", { style: { maxWidth: rect == null ? void 0 : rect.width }, className: "col-span-full !border-0 !p-0 hover:!bg-white" }, Placeholder2 ? /* @__PURE__ */ React__default.createElement(Placeholder2, { reason }) : void 0)));
44654
44693
  }
44655
44694
  const SearchInput22 = React__default.forwardRef(function SearchInput222(props, ref) {
44656
44695
  const {
@@ -48277,67 +48316,6 @@ function useDroppable(_ref) {
48277
48316
  setNodeRef
48278
48317
  };
48279
48318
  }
48280
- const restrictToVerticalAxis = (_ref) => {
48281
- let {
48282
- transform
48283
- } = _ref;
48284
- return {
48285
- ...transform,
48286
- x: 0
48287
- };
48288
- };
48289
- function getContainerById(children, id2) {
48290
- var _a;
48291
- const lists = React__default.Children.toArray(children).filter(
48292
- (child) => child.type.displayName === "SortableList"
48293
- );
48294
- const list = lists.find(
48295
- (list2) => list2.props.id === id2
48296
- );
48297
- if (list) {
48298
- return list == null ? void 0 : list.props;
48299
- }
48300
- return (_a = lists.find((l2) => React__default.Children.toArray(l2.props.children).findIndex((child) => child.props.id === id2) > -1)) == null ? void 0 : _a.props;
48301
- }
48302
- function Container$1(externalProps) {
48303
- const { children, reorder, move } = externalProps;
48304
- function handleDragOver(event) {
48305
- const { active, over } = event;
48306
- if (!(active == null ? void 0 : active.id) || !(over == null ? void 0 : over.id)) {
48307
- return;
48308
- }
48309
- const activeList = getContainerById(children, active.id);
48310
- const overList = getContainerById(children, over.id);
48311
- if (!(activeList == null ? void 0 : activeList.id) || !(overList == null ? void 0 : overList.id) || activeList.id === overList.id) {
48312
- return;
48313
- }
48314
- move(active.id, activeList == null ? void 0 : activeList.id, overList.id);
48315
- }
48316
- function handleDragEnd(event) {
48317
- const { active, over } = event;
48318
- if (!(active == null ? void 0 : active.id) || !(over == null ? void 0 : over.id)) {
48319
- return;
48320
- }
48321
- const activeList = getContainerById(children, active.id);
48322
- const overList = getContainerById(children, over.id);
48323
- if (!(activeList == null ? void 0 : activeList.id) || !(overList == null ? void 0 : overList.id) || activeList.id !== overList.id) {
48324
- return;
48325
- }
48326
- reorder(active.id, over.id, overList.id);
48327
- }
48328
- return /* @__PURE__ */ React__default.createElement(
48329
- DndContext,
48330
- {
48331
- collisionDetection: closestCenter,
48332
- ...externalProps,
48333
- modifiers: [restrictToVerticalAxis],
48334
- onDragOver: handleDragOver,
48335
- onDragEnd: handleDragEnd
48336
- },
48337
- children
48338
- );
48339
- }
48340
- Container$1.displayName = "SortableContainer";
48341
48319
  function arrayMove(array2, from, to) {
48342
48320
  const newArray = array2.slice();
48343
48321
  newArray.splice(to < 0 ? newArray.length + to : to, 0, newArray.splice(from, 1)[0]);
@@ -48806,6 +48784,74 @@ function normalizeLocalDisabled(localDisabled, globalDisabled) {
48806
48784
  };
48807
48785
  }
48808
48786
  [KeyboardCode.Down, KeyboardCode.Right, KeyboardCode.Up, KeyboardCode.Left];
48787
+ function List(externalProps) {
48788
+ const { children, id: id2, ...props } = externalProps;
48789
+ const { setNodeRef } = useDroppable({ id: id2 });
48790
+ const items = React__default.Children.toArray(children).map((child) => child.props);
48791
+ return /* @__PURE__ */ React__default.createElement(SortableContext, { id: id2, items, strategy: verticalListSortingStrategy }, /* @__PURE__ */ React__default.createElement("div", { ...props, ref: id2 ? setNodeRef : void 0 }, children));
48792
+ }
48793
+ List.displayName = "SortableList";
48794
+ const restrictToVerticalAxis = (_ref) => {
48795
+ let {
48796
+ transform
48797
+ } = _ref;
48798
+ return {
48799
+ ...transform,
48800
+ x: 0
48801
+ };
48802
+ };
48803
+ function getContainerById(children, id2) {
48804
+ var _a;
48805
+ const lists = React__default.Children.toArray(children).filter(
48806
+ (child) => child.type === List
48807
+ );
48808
+ const list = lists.find(
48809
+ (list2) => list2.props.id === id2
48810
+ );
48811
+ if (list) {
48812
+ return list == null ? void 0 : list.props;
48813
+ }
48814
+ return (_a = lists.find((l2) => React__default.Children.toArray(l2.props.children).findIndex((child) => child.props.id === id2) > -1)) == null ? void 0 : _a.props;
48815
+ }
48816
+ function Container$1(externalProps) {
48817
+ const { children, reorder, move } = externalProps;
48818
+ function handleDragOver(event) {
48819
+ const { active, over } = event;
48820
+ if (!(active == null ? void 0 : active.id) || !(over == null ? void 0 : over.id)) {
48821
+ return;
48822
+ }
48823
+ const activeList = getContainerById(children, active.id);
48824
+ const overList = getContainerById(children, over.id);
48825
+ if (!(activeList == null ? void 0 : activeList.id) || !(overList == null ? void 0 : overList.id) || activeList.id === overList.id) {
48826
+ return;
48827
+ }
48828
+ move == null ? void 0 : move(active.id, activeList.id, overList.id);
48829
+ }
48830
+ function handleDragEnd(event) {
48831
+ const { active, over } = event;
48832
+ if (!(active == null ? void 0 : active.id) || !(over == null ? void 0 : over.id)) {
48833
+ return;
48834
+ }
48835
+ const activeList = getContainerById(children, active.id);
48836
+ const overList = getContainerById(children, over.id);
48837
+ if (!(activeList == null ? void 0 : activeList.id) || !(overList == null ? void 0 : overList.id) || activeList.id !== overList.id) {
48838
+ return;
48839
+ }
48840
+ reorder(active.id, over.id, overList.id);
48841
+ }
48842
+ return /* @__PURE__ */ React__default.createElement(
48843
+ DndContext,
48844
+ {
48845
+ collisionDetection: closestCenter,
48846
+ ...externalProps,
48847
+ modifiers: [restrictToVerticalAxis],
48848
+ onDragOver: handleDragOver,
48849
+ onDragEnd: handleDragEnd
48850
+ },
48851
+ children
48852
+ );
48853
+ }
48854
+ Container$1.displayName = "SortableContainer";
48809
48855
  const isFormElement = (element) => {
48810
48856
  const formElementNodeNames = ["BUTTON", "INPUT", "TEXTAREA", "SELECT", "FIELDSET"];
48811
48857
  return formElementNodeNames.includes(element.nodeName);
@@ -48829,13 +48875,6 @@ function Item(props) {
48829
48875
  return /* @__PURE__ */ React__default.createElement("div", { ...elProps }, children);
48830
48876
  }
48831
48877
  Item.displayName = "SortableListItem";
48832
- function List(externalProps) {
48833
- const { children, id: id2, ...props } = externalProps;
48834
- const { setNodeRef } = useDroppable({ id: id2 });
48835
- const items = React__default.Children.toArray(children).map((child) => child.props);
48836
- return /* @__PURE__ */ React__default.createElement(SortableContext, { id: id2, items, strategy: verticalListSortingStrategy }, /* @__PURE__ */ React__default.createElement("div", { ...props, ref: id2 ? setNodeRef : void 0 }, children));
48837
- }
48838
- List.displayName = "SortableList";
48839
48878
  const Column$3 = React__default.forwardRef(function Column2(props, ref) {
48840
48879
  var _a, _b, _c;
48841
48880
  const { column, draggable = false, ...dragAttributes } = props;
@@ -50460,11 +50499,11 @@ function guessComparatorsBasedOnControl(column) {
50460
50499
  }
50461
50500
  const FilterContext = React__default.createContext([]);
50462
50501
  const FilterColumn = React__default.forwardRef((props, ref) => {
50463
- const { allColumns, onChange: handleChange, value = null, ...attributes } = props;
50502
+ const { allHeaders, onChange: handleChange, value = null, ...attributes } = props;
50464
50503
  const { texts } = useLocalization();
50465
50504
  const filters = React__default.useContext(FilterContext);
50466
- const selectedColumn = allColumns.find((column) => column.id === value);
50467
- const warning2 = selectedColumn && !selectedColumn.getIsVisible();
50505
+ const selectedColumn = allHeaders.find((header) => header.id === value);
50506
+ const warning2 = selectedColumn && !selectedColumn.column.getIsVisible();
50468
50507
  return /* @__PURE__ */ React__default.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React__default.createElement(
50469
50508
  Field,
50470
50509
  {
@@ -50482,23 +50521,23 @@ const FilterColumn = React__default.forwardRef((props, ref) => {
50482
50521
  onChange: handleChange,
50483
50522
  value
50484
50523
  },
50485
- allColumns.map((column) => {
50486
- var _a, _b, _c;
50524
+ allHeaders.map((header) => {
50525
+ var _a, _b;
50487
50526
  return /* @__PURE__ */ React__default.createElement(
50488
50527
  Select22.Option,
50489
50528
  {
50490
- key: column.id,
50491
- value: column.id,
50492
- postfix: !column.getIsVisible() || column.getIsGrouped() ? /* @__PURE__ */ React__default.createElement(
50529
+ key: header.column.id,
50530
+ value: header.column.id,
50531
+ postfix: !header.column.getIsVisible() || header.column.getIsGrouped() ? /* @__PURE__ */ React__default.createElement(
50493
50532
  Tooltip$3,
50494
50533
  {
50495
- title: column.getIsGrouped() ? texts.table.filters.hiddenGroupedColumn : texts.table.filters.hiddenColumn
50534
+ title: header.column.getIsGrouped() ? texts.table.filters.hiddenGroupedColumn : texts.table.filters.hiddenColumn
50496
50535
  },
50497
50536
  /* @__PURE__ */ React__default.createElement(Icon$1, { name: "eye-off", className: "text-grey-500 !h-5 !w-5" })
50498
50537
  ) : void 0,
50499
- disabled: column.id !== value && (!column.getCanFilter() || !!filters.find((f2) => f2.id === column.id))
50538
+ disabled: header.column.id !== value && (!header.column.getCanFilter() || !!filters.find((f2) => f2.id === header.column.id))
50500
50539
  },
50501
- ((_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})` : "")
50540
+ /* @__PURE__ */ React__default.createElement(React__default.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())})` : "")
50502
50541
  );
50503
50542
  })
50504
50543
  )
@@ -50667,9 +50706,9 @@ function Control(props) {
50667
50706
  );
50668
50707
  }
50669
50708
  function Filter(props) {
50670
- const { allColumns, filter: filter2, onChange: handleChange, onRemove, position } = props;
50709
+ const { allHeaders, filter: filter2, onChange: handleChange, onRemove, position } = props;
50671
50710
  const { texts } = useLocalization();
50672
- const column = allColumns.find((c2) => c2.id === filter2.id);
50711
+ const column = allHeaders.find((header) => header.column.id === filter2.id);
50673
50712
  const ref = React__default.useRef(null);
50674
50713
  const {
50675
50714
  id: id2,
@@ -50677,13 +50716,13 @@ function Filter(props) {
50677
50716
  } = filter2;
50678
50717
  const handleChangeColumn = (columnId) => {
50679
50718
  var _a, _b, _c;
50680
- const previousColumn = allColumns.find((column2) => column2.id === id2);
50681
- const nextColumn = allColumns.find((column2) => column2.id === columnId);
50682
- 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)) {
50719
+ const previousColumn = allHeaders.find((header) => header.column.id === id2);
50720
+ const nextColumn = allHeaders.find((header) => header.column.id === columnId);
50721
+ 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)) {
50683
50722
  handleChange(position, { id: columnId, value: filter2.value });
50684
50723
  return;
50685
50724
  }
50686
- const validComparators = guessComparatorsBasedOnControl(nextColumn);
50725
+ const validComparators = guessComparatorsBasedOnControl(nextColumn == null ? void 0 : nextColumn.column);
50687
50726
  const value2 = {
50688
50727
  comparator: validComparators[0],
50689
50728
  value: void 0
@@ -50706,13 +50745,13 @@ function Filter(props) {
50706
50745
  ref.current.focus();
50707
50746
  }
50708
50747
  }, [id2]);
50709
- return /* @__PURE__ */ React__default.createElement("div", { className: "flex items-start gap-2" }, /* @__PURE__ */ React__default.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__default.createElement(FilterColumn, { allColumns, onChange: handleChangeColumn, value: id2, ref }), /* @__PURE__ */ React__default.createElement(FilterComparator, { column, onChange: handleChangeComparator, value: comparator }), /* @__PURE__ */ React__default.createElement(FilterValue, { column, comparator, onChange: handleChangeValue, value }), onRemove ? /* @__PURE__ */ React__default.createElement(IconButton, { appearance: "discrete", className: "ml-auto", icon: "close", onClick: handleRemove }) : null);
50748
+ return /* @__PURE__ */ React__default.createElement("div", { className: "flex items-start gap-2" }, /* @__PURE__ */ React__default.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__default.createElement(FilterColumn, { allHeaders, onChange: handleChangeColumn, value: id2, ref }), /* @__PURE__ */ React__default.createElement(FilterComparator, { column: column == null ? void 0 : column.column, onChange: handleChangeComparator, value: comparator }), /* @__PURE__ */ React__default.createElement(FilterValue, { column: column == null ? void 0 : column.column, comparator, onChange: handleChangeValue, value }), onRemove ? /* @__PURE__ */ React__default.createElement(IconButton, { appearance: "discrete", className: "ml-auto", icon: "close", onClick: handleRemove }) : null);
50710
50749
  }
50711
50750
  const placeholderFilter = { id: "", value: { comparator: TableFilterComparator.Contains, value: void 0 } };
50712
50751
  function ManageFiltersPopover(props) {
50713
50752
  const { length, table, ...popoverProps } = props;
50714
50753
  const { locale: locale2, texts } = useLocalization();
50715
- const allColumns = table.getAllLeafColumns().filter((column) => !isInternalColumn(column.id)).sort(sortByHeader);
50754
+ const allHeaders = table.getLeafHeaders().filter((column) => !isInternalColumn(column.id)).sort((headerA, headerB) => sortByHeader(headerA.column, headerB.column));
50716
50755
  const columnFilters = table.getState().columnFilters;
50717
50756
  const tableMeta = table.options.meta;
50718
50757
  const [filters, setFilters] = React__default.useState(columnFilters.length ? columnFilters : [placeholderFilter]);
@@ -50751,7 +50790,7 @@ function ManageFiltersPopover(props) {
50751
50790
  if (f2.id === null || f2.id === "") {
50752
50791
  return false;
50753
50792
  }
50754
- const controlRenderer = (_b = (_a = allColumns.find((c2) => c2.id === f2.id)) == null ? void 0 : _a.columnDef.meta) == null ? void 0 : _b.control;
50793
+ const controlRenderer = (_b = (_a = allHeaders.find((header) => header.column.id === f2.id)) == null ? void 0 : _a.column.columnDef.meta) == null ? void 0 : _b.control;
50755
50794
  if (f2.value.comparator === TableFilterComparator.IsEmpty || f2.value.comparator === TableFilterComparator.IsNotEmpty || controlRenderer === "switch") {
50756
50795
  return true;
50757
50796
  }
@@ -50781,7 +50820,7 @@ function ManageFiltersPopover(props) {
50781
50820
  Filter,
50782
50821
  {
50783
50822
  key: `filter_${index2}`,
50784
- allColumns,
50823
+ allHeaders,
50785
50824
  filter: filter2,
50786
50825
  position: index2,
50787
50826
  onChange: handleChangeFilter,
@@ -59221,14 +59260,6 @@ function isTableScrolled(ref) {
59221
59260
  function useTableEditingListener(table, tableRef, scrollToIndex) {
59222
59261
  const tableMeta = table.options.meta;
59223
59262
  const localization = useLocalization();
59224
- useLazyEffect(() => {
59225
- return () => {
59226
- var _a;
59227
- if (tableMeta.editing.isEditing && tableMeta.rowActive.rowActiveIndex !== void 0) {
59228
- tableMeta.editing.saveChanges(table, (_a = table.getRowModel().rows[tableMeta.rowActive.rowActiveIndex]) == null ? void 0 : _a.id);
59229
- }
59230
- };
59231
- }, [tableMeta.rowActive.rowActiveIndex, tableMeta.editing.isEditing]);
59232
59263
  const hasChanges = tableMeta.editing.hasChanges();
59233
59264
  React__default.useEffect(() => {
59234
59265
  function showUnsavedChangesWarning(event) {
@@ -60573,7 +60604,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
60573
60604
  var _a, _b, _c;
60574
60605
  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];
60575
60606
  }
60576
- async function onCellChanged(cell, rowIndex, nextValue, shouldRunUpdaters = true) {
60607
+ async function onCellChanged(cell, rowIndex, nextValue, shouldRunUpdaters = true, shouldRunValidation = true) {
60577
60608
  var _a;
60578
60609
  const tableMeta = cell.getContext().table.options.meta;
60579
60610
  const state2 = tableMeta.editing.getState();
@@ -60603,7 +60634,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
60603
60634
  const nextMoveReasons = { ...state2.changes.moveReasons[cell.row.id] };
60604
60635
  const nextCellErrors = { ...(_a = state2.changes.errors[cell.row.id]) == null ? void 0 : _a.cells };
60605
60636
  let validationErrors = {};
60606
- if (validator && Object.keys(nextChanges).length && original) {
60637
+ if (validator && Object.keys(nextChanges).length && original && shouldRunValidation) {
60607
60638
  const nextRowValue = { ...original, ...changes, ...updatesForOtherCells };
60608
60639
  validationErrors = await validator(nextRowValue) ?? {};
60609
60640
  }
@@ -60731,7 +60762,9 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
60731
60762
  return completed;
60732
60763
  }
60733
60764
  async function discardChanges(rowId, table) {
60734
- table.resetRowPinning(true);
60765
+ if (rowId.startsWith(TEMPORARY_ROW_ID_PREFIX)) {
60766
+ table.resetRowPinning(true);
60767
+ }
60735
60768
  dispatch({
60736
60769
  type: "removeRow",
60737
60770
  rowId,
@@ -60827,7 +60860,7 @@ function useTableEditing(isEnabled = false, defaultToggleEditing = false, handle
60827
60860
  return;
60828
60861
  }
60829
60862
  }
60830
- const changeset = row ?? handleCreate();
60863
+ const changeset = row ?? await handleCreate();
60831
60864
  try {
60832
60865
  if (changeset) {
60833
60866
  const temporaryRows = tableMeta.editing.temporaryRows;
@@ -61085,7 +61118,7 @@ function EditingControlCell(props) {
61085
61118
  if (hasChanged) {
61086
61119
  tableMeta.editing.setCellValue(cell, rowIndex, nextValue);
61087
61120
  if (hasNonTextControl) {
61088
- requestAnimationFrame(() => tableMeta.editing.onCellChanged(cell, rowIndex, nextValue));
61121
+ requestAnimationFrame(() => tableMeta.editing.onCellChanged(cell, rowIndex, nextValue, true, false));
61089
61122
  }
61090
61123
  }
61091
61124
  },
@@ -61098,7 +61131,7 @@ function EditingControlCell(props) {
61098
61131
  }
61099
61132
  requestAnimationFrame(() => {
61100
61133
  tableMeta.editing.toggleDetailedMode(false);
61101
- tableMeta.editing.onCellChanged(cell, rowIndex, void 0, !hasNonTextControl);
61134
+ tableMeta.editing.onCellChanged(cell, rowIndex, void 0, !hasNonTextControl, true);
61102
61135
  });
61103
61136
  },
61104
61137
  [hasNonTextControl, cell.row.id, JSON.stringify(rowChanges), rowIndex, cell.column.id, cell.row.original]
@@ -61394,6 +61427,11 @@ function Row(props) {
61394
61427
  }
61395
61428
  }
61396
61429
  }, [tableMeta.editing.isEditing, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.lastFocusedCellIndex]);
61430
+ useLazyEffect(() => {
61431
+ if (tableMeta.editing.isEditing && !isActiveRow) {
61432
+ tableMeta.editing.saveChanges(table, row.id);
61433
+ }
61434
+ }, [isActiveRow]);
61397
61435
  const handleFocus = React__default.useCallback(
61398
61436
  (event) => {
61399
61437
  var _a;