@economic/taco 2.61.2 → 2.61.4

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
@@ -29793,13 +29793,12 @@ const Item$2 = React__namespace.forwardRef(function MenuItem(props, ref) {
29793
29793
  className: props.className
29794
29794
  });
29795
29795
  const disabled = props.disabled ?? props["aria-disabled"];
29796
- let handleClick;
29797
- if (disabled) {
29798
- handleClick = (event) => {
29796
+ const handleClick = (event) => {
29797
+ if (disabled) {
29799
29798
  event.preventDefault();
29800
- event.stopPropagation();
29801
- };
29802
- }
29799
+ }
29800
+ event.stopPropagation();
29801
+ };
29803
29802
  if (subMenu) {
29804
29803
  return /* @__PURE__ */ React__namespace.createElement($d08ef79370b62062$export$d7a01e11500dfb6f, null, /* @__PURE__ */ React__namespace.createElement($d08ef79370b62062$export$2ea8a7a591ac5eac, { ...otherProps, className, onClick: handleClick, ref }, icon ? /* @__PURE__ */ React__namespace.createElement(Icon, { name: icon }) : null, props.children, /* @__PURE__ */ React__namespace.createElement(Icon$1, { className: "-mr-1.5 ml-auto !h-5 !w-5", name: "chevron-right" })), subMenu());
29805
29804
  }
@@ -35402,9 +35401,13 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
35402
35401
  return displayValue ?? safeValue;
35403
35402
  };
35404
35403
  const rendererArgs = (info) => ({
35405
- formattedValue: formattedValueRenderer(info.getValue(), info.row.original),
35406
35404
  row: info.row.original,
35407
- value: info.getValue()
35405
+ get value() {
35406
+ return info.getValue();
35407
+ },
35408
+ get formattedValue() {
35409
+ return formattedValueRenderer(info.getValue(), info.row.original);
35410
+ }
35408
35411
  });
35409
35412
  if (typeof renderer2 === "function") {
35410
35413
  column.cell = (info) => renderer2(rendererArgs(info));
@@ -53918,7 +53921,7 @@ function useTableEditingListener(table, tableRef, scrollToIndex) {
53918
53921
  tableMeta.editing.saveChanges(table, (_a = table.getRowModel().rows[tableMeta.rowActive.rowActiveIndex]) == null ? void 0 : _a.id);
53919
53922
  }
53920
53923
  };
53921
- }, [tableMeta.rowActive.rowActiveIndex]);
53924
+ }, [tableMeta.rowActive.rowActiveIndex, tableMeta.editing.isEditing]);
53922
53925
  const hasChanges = tableMeta.editing.hasChanges();
53923
53926
  React.useEffect(() => {
53924
53927
  function showUnsavedChangesWarning(event) {
@@ -55351,11 +55354,13 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
55351
55354
  }
55352
55355
  async function saveChanges(table, rowId = void 0) {
55353
55356
  var _a, _b, _c;
55357
+ const tableMeta = table.options.meta;
55358
+ const state2 = tableMeta.editing.getState();
55354
55359
  if (!handleSave) {
55355
55360
  console.warn("Tried to save, but Table has no onEditingSave handler");
55356
55361
  return false;
55357
55362
  }
55358
- const changes = rowId ? { [rowId]: state.changes.rows[rowId] } : state.changes.rows;
55363
+ const changes = rowId ? { [rowId]: state2.changes.rows[rowId] } : state2.changes.rows;
55359
55364
  let completed = true;
55360
55365
  for (const rowId2 of Object.keys(changes)) {
55361
55366
  const status = getRowStatus(rowId2);
@@ -55365,7 +55370,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
55365
55370
  continue;
55366
55371
  }
55367
55372
  setRowStatus(rowId2, "saving");
55368
- const changeSet = { ...state.changes.originals[rowId2], ...rowChanges };
55373
+ const changeSet = { ...state2.changes.originals[rowId2], ...rowChanges };
55369
55374
  if (isTemporaryRow(changeSet[rowIdentityAccessor])) {
55370
55375
  delete changeSet[rowIdentityAccessor];
55371
55376
  }
@@ -55435,7 +55440,11 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
55435
55440
  payload: { rowIdentityAccessor, changes, handleDiscard: handleDiscard2 }
55436
55441
  });
55437
55442
  }
55443
+ function getState() {
55444
+ return state;
55445
+ }
55438
55446
  return {
55447
+ getState,
55439
55448
  // row
55440
55449
  getRowValue,
55441
55450
  getRowMoveReason,
@@ -55731,6 +55740,7 @@ function EditingControlCell(props) {
55731
55740
  const { cell, cellRef, isHighlighted, index: index2 } = props;
55732
55741
  const { rowIndex } = React.useContext(RowContext);
55733
55742
  const { table } = cell.getContext();
55743
+ const locale2 = useLocalization();
55734
55744
  const tableMeta = table.options.meta;
55735
55745
  const columnMeta = cell.column.columnDef.meta;
55736
55746
  const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;
@@ -55774,6 +55784,7 @@ function EditingControlCell(props) {
55774
55784
  invalid: !!error,
55775
55785
  isDetailedMode: tableMeta.editing.isDetailedMode,
55776
55786
  isTruncated: !!columnMeta.enableTruncate,
55787
+ locale: locale2.locale,
55777
55788
  onBlur: handleBlur,
55778
55789
  onChange: handleChange,
55779
55790
  row: cell.row.original,
@@ -55802,6 +55813,7 @@ const MemoedEditingCell = React.memo(function MemoedEditingCell2(props) {
55802
55813
  invalid,
55803
55814
  isDetailedMode,
55804
55815
  isTruncated,
55816
+ locale: locale2,
55805
55817
  onBlur,
55806
55818
  onChange,
55807
55819
  row,
@@ -55930,10 +55942,12 @@ const MemoedEditingCell = React.memo(function MemoedEditingCell2(props) {
55930
55942
  }
55931
55943
  );
55932
55944
  }
55945
+ const handleChange = (event) => {
55946
+ var _a;
55947
+ const dataTypeProps = getDataTypeProperties(dataType);
55948
+ onChange(((_a = dataTypeProps.parse) == null ? void 0 : _a.call(dataTypeProps, event.target.value, locale2)) ?? event.target.value);
55949
+ };
55933
55950
  if (type === "textarea") {
55934
- const handleChange2 = (event) => {
55935
- onChange(event.target.value);
55936
- };
55937
55951
  return /* @__PURE__ */ React.createElement(
55938
55952
  TextareaWithAutosizing,
55939
55953
  {
@@ -55941,7 +55955,7 @@ const MemoedEditingCell = React.memo(function MemoedEditingCell2(props) {
55941
55955
  fontSize,
55942
55956
  invalid,
55943
55957
  isTruncated,
55944
- onChange: handleChange2,
55958
+ onChange: handleChange,
55945
55959
  onFocus: handleFocus,
55946
55960
  onKeyDown: handleInputKeyDown,
55947
55961
  ref: controlRef,
@@ -55949,9 +55963,6 @@ const MemoedEditingCell = React.memo(function MemoedEditingCell2(props) {
55949
55963
  }
55950
55964
  );
55951
55965
  }
55952
- const handleChange = (event) => {
55953
- onChange(dataType === "number" && event.target.value ? Number.parseInt(event.target.value) : event.target.value);
55954
- };
55955
55966
  return /* @__PURE__ */ React.createElement(
55956
55967
  Input,
55957
55968
  {
@@ -55982,7 +55993,10 @@ function Cell$1(props) {
55982
55993
  const hasErrorAndIsEditing = cellError ? tableMeta.editing.isEditing : true;
55983
55994
  const changedValue = tableMeta.editing.getCellValue(cell);
55984
55995
  if (changedValue !== void 0 && changedValue !== cell.getValue() && hasErrorAndIsEditing) {
55985
- cell.getValue = () => changedValue;
55996
+ const getValue2 = () => changedValue;
55997
+ const context = cell.getContext();
55998
+ cell.getValue = getValue2;
55999
+ cell.getContext = () => ({ ...context, getValue: getValue2 });
55986
56000
  }
55987
56001
  if (isActiveRow || !!cellError || isHovered && !isActiveRow && !tableMeta.rowActive.isHoverStatePaused) {
55988
56002
  return /* @__PURE__ */ React.createElement(EditingControlCell, { ...props });