@economic/taco 2.66.1-test.0 → 2.67.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/taco.cjs CHANGED
@@ -35651,7 +35651,7 @@ function useReactTableInitialState(props, columns, persistedSettings, defaults2)
35651
35651
  columnOrder
35652
35652
  );
35653
35653
  } else {
35654
- if (props.defaultColumnFreezingIndex) {
35654
+ if (props.defaultColumnFreezingIndex !== void 0) {
35655
35655
  columnPinning.left = freezeUptoExternalColumn(props.defaultColumnFreezingIndex, columnOrder);
35656
35656
  } else {
35657
35657
  columnPinning.left = unfreezeAllExternalColumns(columnOrder);
@@ -37852,12 +37852,12 @@ function getScrollPaddingEndOffset(table) {
37852
37852
  }
37853
37853
  return height;
37854
37854
  }
37855
- function getPaddingEndOffset(table, options) {
37855
+ function getPaddingEndOffset(table) {
37856
37856
  const bottomRows = table.getBottomRows() ?? [];
37857
- return ROW_HEIGHT_ESTIMATES.medium * 1 * bottomRows.length + ((options == null ? void 0 : options.virtualiserPaddingEndOffset) ?? 0);
37857
+ return ROW_HEIGHT_ESTIMATES.medium * 1 * bottomRows.length;
37858
37858
  }
37859
37859
  const OVERSCAN_ROW_COUNT = 8;
37860
- function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIndex, options) {
37860
+ function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIndex) {
37861
37861
  var _a, _b, _c, _d, _e;
37862
37862
  const tableMeta = table.options.meta;
37863
37863
  const isTableRowGrouped = !!((_a = table.getState().grouping) == null ? void 0 : _a.length);
@@ -37876,7 +37876,7 @@ function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIn
37876
37876
  // correctly sets the scroll padding offset, e.g. when keyboard navigating rows in the list
37877
37877
  scrollPaddingStart,
37878
37878
  scrollPaddingEnd: getScrollPaddingEndOffset(table),
37879
- paddingEnd: getPaddingEndOffset(table, options)
37879
+ paddingEnd: getPaddingEndOffset(table)
37880
37880
  });
37881
37881
  const expandedState = table.getState().expanded;
37882
37882
  const previousExpandedStateRef = React.useRef(false);
@@ -37890,15 +37890,15 @@ function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIn
37890
37890
  const totalSize = virtualiser.getTotalSize();
37891
37891
  const virtualItems = virtualiser.getVirtualItems();
37892
37892
  const scrollToIndex = React.useCallback(
37893
- (index2, options2 = { align: "auto", behavior: "smooth" }) => {
37894
- const notSmooth = { ...options2, behavior: "auto" };
37893
+ (index2, options = { align: "auto", behavior: "smooth" }) => {
37894
+ const notSmooth = { ...options, behavior: "auto" };
37895
37895
  if (tableRef.current) {
37896
37896
  if (index2 === 0) {
37897
37897
  virtualiser.scrollToOffset(0, notSmooth);
37898
37898
  } else if (index2 === count2 - 1) {
37899
37899
  tableRef.current.scrollTop = tableRef.current.scrollHeight;
37900
37900
  } else {
37901
- virtualiser.scrollToIndex(index2, options2);
37901
+ virtualiser.scrollToIndex(index2, options);
37902
37902
  }
37903
37903
  }
37904
37904
  },
@@ -38336,17 +38336,10 @@ const INTERNAL_RENDERERS = {
38336
38336
  rowExpansion: renderer$1,
38337
38337
  rowSelection: renderer
38338
38338
  };
38339
- function useTable$1(props, externalRef, renderers, meta, options) {
38339
+ function useTable$1(props, externalRef, renderers, meta) {
38340
38340
  const ref = useMergedRef(externalRef);
38341
38341
  const manager = useTableManager(props, ref, meta, INTERNAL_RENDERERS);
38342
- const renderer2 = useTableRenderer(
38343
- renderers,
38344
- manager.instance,
38345
- ref,
38346
- manager.meta.length,
38347
- props.defaultRowActiveIndex,
38348
- options
38349
- );
38342
+ const renderer2 = useTableRenderer(renderers, manager.instance, ref, manager.meta.length, props.defaultRowActiveIndex);
38350
38343
  const { style, stylesheet } = useTableStyle(manager.id, manager.instance);
38351
38344
  useTableGlobalShortcuts(manager.instance, ref, renderer2.scrollToIndex, props.enableLocalKeyboardShortcuts);
38352
38345
  useTableRef(manager.instance, ref);
@@ -39482,7 +39475,7 @@ const SearchInput22 = React.forwardRef(function SearchInput222(props, ref) {
39482
39475
  );
39483
39476
  }
39484
39477
  if (hasFind && isActive) {
39485
- postfix = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", { className: "text-grey-700 flex h-4 items-center" }, loading ? /* @__PURE__ */ React.createElement(Spinner, { className: "h-4 w-4" }) : showTotal ? /* @__PURE__ */ React.createElement("span", { className: "border-r border-black/[0.25] pr-2" }, `${findCurrent ?? 0}/${findTotal ?? 0}`) : null), findCurrent ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
39478
+ postfix = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", { className: "text-grey-700 flex h-4 items-center" }, loading ? /* @__PURE__ */ React.createElement(Spinner, { className: "h-4 w-4" }) : showTotal ? /* @__PURE__ */ React.createElement("span", { className: "border-r border-black/[0.25] pr-2", "data-taco": "search-matches-counter" }, `${findCurrent ?? 0}/${findTotal ?? 0}`) : null), findCurrent ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
39486
39479
  IconButton,
39487
39480
  {
39488
39481
  "aria-label": texts.searchInput.findPrevious,
@@ -55285,6 +55278,13 @@ function reducer(state, action) {
55285
55278
  indexes: setWith(state.indexes, rowId, index2, Object)
55286
55279
  };
55287
55280
  }
55281
+ case "forceValidate": {
55282
+ const { newState } = payload;
55283
+ return {
55284
+ ...state,
55285
+ ...newState
55286
+ };
55287
+ }
55288
55288
  default:
55289
55289
  return state;
55290
55290
  }
@@ -55444,6 +55444,46 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
55444
55444
  }
55445
55445
  });
55446
55446
  }
55447
+ async function forceValidate(table) {
55448
+ if (validator && table.getRowModel().rows.length) {
55449
+ const newState = { ...state };
55450
+ const returnIds = [];
55451
+ await Promise.all(
55452
+ table.getRowModel().rows.map(async (row, index2) => {
55453
+ var _a, _b;
55454
+ const rowWithChanges = { ...row.original, ...state.changes.rows[row.id] };
55455
+ if (rowWithChanges) {
55456
+ const cellErrors = await validator(rowWithChanges);
55457
+ if (cellErrors) {
55458
+ newState.changes.dirty[row.id] = true;
55459
+ newState.changes.originals[row.id] = row.original;
55460
+ newState.changes.moveReasons[row.id] = { ...newState.changes.moveReasons[row.id] };
55461
+ newState.changes.rows[row.id] = { ...newState.changes.rows[row.id] };
55462
+ newState.changes.status[row.id] = "errored";
55463
+ newState.indexes[row.id] = index2;
55464
+ newState.changes.errors[row.id] = {
55465
+ cells: cellErrors,
55466
+ row: ((_a = newState.changes.errors[row.id]) == null ? void 0 : _a.row) ?? void 0,
55467
+ shouldShowErrorAlert: ((_b = newState.changes.errors[row.id]) == null ? void 0 : _b.shouldShowErrorAlert) ?? false
55468
+ };
55469
+ Object.keys(cellErrors).forEach((columnId) => {
55470
+ newState.changes.rows[row.id][columnId] = rowWithChanges[columnId];
55471
+ });
55472
+ returnIds.push(row.id);
55473
+ }
55474
+ }
55475
+ })
55476
+ );
55477
+ dispatch({
55478
+ type: "forceValidate",
55479
+ payload: {
55480
+ newState
55481
+ }
55482
+ });
55483
+ return returnIds;
55484
+ }
55485
+ return [];
55486
+ }
55447
55487
  function getErrors() {
55448
55488
  return Object.keys(state.changes.errors);
55449
55489
  }
@@ -55572,6 +55612,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
55572
55612
  hasTemporaryRowErrors,
55573
55613
  getRowStatus,
55574
55614
  setRowStatus,
55615
+ forceValidate,
55575
55616
  // cells
55576
55617
  setCellValue,
55577
55618
  getCellValue,
@@ -56325,14 +56366,7 @@ function useTable3(props, ref) {
56325
56366
  ]) : props.rowActions
56326
56367
  };
56327
56368
  const meta = { editing };
56328
- const options = {
56329
- virtualiserPaddingEndOffset: 0
56330
- };
56331
- if (props.enableEditing) {
56332
- const validationErrorLabelHeight = 17;
56333
- options.virtualiserPaddingEndOffset = editing.getErrors().length * validationErrorLabelHeight;
56334
- }
56335
- const table = useTable$1(extendedProps, ref, RENDERERS, meta, options);
56369
+ const table = useTable$1(extendedProps, ref, RENDERERS, meta);
56336
56370
  const toggleEditing = (enabled) => table.meta.editing.toggleEditing(enabled ?? ((editing2) => !editing2), table.instance, table.renderer.scrollToIndex);
56337
56371
  React.useEffect(() => {
56338
56372
  if (props.defaultToggleEditing) {
@@ -56355,6 +56389,14 @@ function useTable3(props, ref) {
56355
56389
  }
56356
56390
  }
56357
56391
  }, [table.ref.current, table.meta.editing.isEnabled]);
56392
+ React.useEffect(() => {
56393
+ if (table.ref.current) {
56394
+ const instance = table.ref.current.instance;
56395
+ if (table.meta.editing.isEnabled) {
56396
+ instance.editing.forceValidate = async () => table.meta.editing.forceValidate(table.instance);
56397
+ }
56398
+ }
56399
+ }, [table.meta.editing.forceValidate]);
56358
56400
  return table;
56359
56401
  }
56360
56402
  function Alert(props) {