@economic/taco 2.67.0 → 2.67.1-footer-fix.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.js CHANGED
@@ -26960,7 +26960,7 @@ const Content$4 = React.forwardRef(function HangerContent(props, ref) {
26960
26960
  const context = React.useContext(HangerContext);
26961
26961
  const { texts } = useLocalization();
26962
26962
  const className = clsx(
26963
- "wcag-blue-500 border border-transparent rounded p-3 pr-12 yt-shadow focus:border-transparent max-w-sm",
26963
+ "wcag-blue-500 border border-transparent rounded p-3 pr-12 yt-shadow focus:border-transparent max-w-sm print:hidden",
26964
26964
  props.className
26965
26965
  );
26966
26966
  const handleInteractOutside = (event) => {
@@ -35546,7 +35546,7 @@ function configureReactTableOptions(options, props, localization) {
35546
35546
  if (originalRow) {
35547
35547
  return String(originalRow[props.rowIdentityAccessor]);
35548
35548
  }
35549
- return String(index2);
35549
+ return `skeleton-${index2}-${Math.random().toString(36).substr(2, 9)}`;
35550
35550
  };
35551
35551
  }
35552
35552
  const tableOptions = {
@@ -37862,6 +37862,8 @@ function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIn
37862
37862
  });
37863
37863
  const expandedState = table.getState().expanded;
37864
37864
  const previousExpandedStateRef = React__default.useRef(false);
37865
+ const sortingState = table.getState().sorting;
37866
+ const previousSortingStateRef = React__default.useRef(JSON.stringify(sortingState));
37865
37867
  React__default.useEffect(() => {
37866
37868
  const isEmpty = JSON.stringify(expandedState) === "{}";
37867
37869
  if (expandedState === true || isEmpty && previousExpandedStateRef.current === true) {
@@ -37869,6 +37871,13 @@ function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIn
37869
37871
  virtualiser.measure();
37870
37872
  }
37871
37873
  }, [expandedState]);
37874
+ React__default.useEffect(() => {
37875
+ const currentSortingString = JSON.stringify(sortingState);
37876
+ if (currentSortingString !== previousSortingStateRef.current) {
37877
+ previousSortingStateRef.current = currentSortingString;
37878
+ virtualiser.measure();
37879
+ }
37880
+ }, [sortingState]);
37872
37881
  const totalSize = virtualiser.getTotalSize();
37873
37882
  const virtualItems = virtualiser.getVirtualItems();
37874
37883
  const scrollToIndex = React__default.useCallback(
@@ -37921,10 +37930,11 @@ function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIn
37921
37930
  row = rows[virtualRow.index];
37922
37931
  }
37923
37932
  if (!(row == null ? void 0 : row.original)) {
37933
+ const skeletonKey = `skeleton-${virtualRow.index}-${JSON.stringify(table.getState().sorting).slice(0, 8)}`;
37924
37934
  return /* @__PURE__ */ React__default.createElement(
37925
37935
  SkeletonRow,
37926
37936
  {
37927
- key: virtualRow.index,
37937
+ key: skeletonKey,
37928
37938
  index: virtualRow.index,
37929
37939
  scrollDirection: virtualiser.scrollDirection ?? void 0,
37930
37940
  table
@@ -39012,6 +39022,9 @@ function Header$1(props) {
39012
39022
  if (canHide) {
39013
39023
  memoedProps.onHide = header.column.getToggleVisibilityHandler();
39014
39024
  }
39025
+ if (header.id === "__expansion") {
39026
+ memoedProps.isExpanded = table.getIsSomeRowsExpanded();
39027
+ }
39015
39028
  if (canPin) {
39016
39029
  memoedProps.onPin = (index2) => {
39017
39030
  table.setColumnPinning((pinningState) => {
@@ -39062,6 +39075,7 @@ const MemoedHeader = React__default.memo(function MemoedHeader2(props) {
39062
39075
  hasMenu,
39063
39076
  id: id2,
39064
39077
  index: index2,
39078
+ isExpanded,
39065
39079
  isFiltered,
39066
39080
  isGroup: isGroup2,
39067
39081
  isPinned,
@@ -39101,6 +39115,7 @@ const MemoedHeader = React__default.memo(function MemoedHeader2(props) {
39101
39115
  "data-cell-id": id2,
39102
39116
  "data-cell-pinned": isPinned ? isPinned : void 0,
39103
39117
  "data-taco": isGroup2 ? "grouped-column-header" : "column-header",
39118
+ "data-rows-expanded": isExpanded ? isExpanded : void 0,
39104
39119
  style,
39105
39120
  ref: setRef
39106
39121
  },
@@ -39295,10 +39310,10 @@ function Summary(props) {
39295
39310
  } else if (!tableMeta.server.isEnabled && (((_a = table.getState().columnFilters) == null ? void 0 : _a.length) || // filtered data
39296
39311
  !!table.getState().globalFilter && table.options.enableGlobalFilter)) {
39297
39312
  label = texts.table.footer.summary.records;
39298
- count2 = /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("strong", null, new Intl.NumberFormat(locale2).format(currentLength)), " ", texts.table.footer.summary.count, " ", /* @__PURE__ */ React__default.createElement("strong", null, new Intl.NumberFormat(locale2).format(length)));
39313
+ count2 = /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("strong", { "data-taco": "table-footer-current-count" }, new Intl.NumberFormat(locale2).format(currentLength)), " ", texts.table.footer.summary.count, " ", /* @__PURE__ */ React__default.createElement("strong", { "data-taco": "table-footer-total-count" }, new Intl.NumberFormat(locale2).format(length)));
39299
39314
  } else {
39300
39315
  label = texts.table.footer.summary.records;
39301
- count2 = /* @__PURE__ */ React__default.createElement("strong", null, new Intl.NumberFormat(locale2).format(length));
39316
+ count2 = /* @__PURE__ */ React__default.createElement("strong", { "data-taco": "table-footer-total-count" }, new Intl.NumberFormat(locale2).format(length));
39302
39317
  }
39303
39318
  return /* @__PURE__ */ React__default.createElement(
39304
39319
  "div",
@@ -45149,6 +45164,7 @@ function Print(props) {
45149
45164
  {
45150
45165
  icon: "print",
45151
45166
  "aria-label": texts.table.print.tooltip,
45167
+ id: `${tableId}-toolbar-print`,
45152
45168
  dialog: (dialogProps) => /* @__PURE__ */ React__default.createElement(
45153
45169
  PrintDialog,
45154
45170
  {
@@ -45485,7 +45501,7 @@ function Filter(props) {
45485
45501
  ref.current.focus();
45486
45502
  }
45487
45503
  }, [id2]);
45488
- 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);
45504
+ return /* @__PURE__ */ React__default.createElement("div", { className: "flex items-start gap-2", "data-taco": "filter-row" }, /* @__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);
45489
45505
  }
45490
45506
  const placeholderFilter = { id: "", value: { comparator: TableFilterComparator.Contains, value: void 0 } };
45491
45507
  function ManageFiltersPopover(props) {
@@ -45566,10 +45582,10 @@ function ManageFiltersPopover(props) {
45566
45582
  onChange: handleChangeFilter,
45567
45583
  onRemove: filters.length > 0 && filters.some((f2) => f2.id) || filters.length > 1 ? handleRemoveFilter : void 0
45568
45584
  }
45569
- )), /* @__PURE__ */ React__default.createElement("div", { className: "justify-start" }, /* @__PURE__ */ React__default.createElement(Button$4, { appearance: "discrete", onClick: handleCreate }, "+ ", texts.table.filters.buttons.addFilter))), /* @__PURE__ */ React__default.createElement(Group$6, { className: "ml-auto" }, /* @__PURE__ */ React__default.createElement(Popover.Close, null, /* @__PURE__ */ React__default.createElement(Button$4, null, texts.table.filters.buttons.cancel)), /* @__PURE__ */ React__default.createElement(Button$4, { onClick: handleClear }, texts.table.filters.buttons.clear), /* @__PURE__ */ React__default.createElement(Button$4, { appearance: "primary", onClick: handleApply }, texts.table.filters.buttons.apply))))));
45585
+ )), /* @__PURE__ */ React__default.createElement("div", { className: "justify-start" }, /* @__PURE__ */ React__default.createElement(Button$4, { appearance: "discrete", onClick: handleCreate, name: "add-filter" }, "+ ", texts.table.filters.buttons.addFilter))), /* @__PURE__ */ React__default.createElement(Group$6, { className: "ml-auto" }, /* @__PURE__ */ React__default.createElement(Popover.Close, null, /* @__PURE__ */ React__default.createElement(Button$4, { name: "close-filters" }, texts.table.filters.buttons.cancel)), /* @__PURE__ */ React__default.createElement(Button$4, { name: "clear-filters", onClick: handleClear }, texts.table.filters.buttons.clear), /* @__PURE__ */ React__default.createElement(Button$4, { appearance: "primary", name: "apply-filters", onClick: handleApply }, texts.table.filters.buttons.apply))))));
45570
45586
  }
45571
45587
  function Filters(props) {
45572
- const { length, table } = props;
45588
+ const { length, tableId, table } = props;
45573
45589
  const { texts } = useLocalization();
45574
45590
  const isLargeScreen = useIsLargeScreen();
45575
45591
  const columnFilters = table.getState().columnFilters;
@@ -45582,7 +45598,8 @@ function Filters(props) {
45582
45598
  popover: (popoverProps) => /* @__PURE__ */ React__default.createElement(ManageFiltersPopover, { ...popoverProps, length, table }),
45583
45599
  shortcut: shortcut2,
45584
45600
  ref,
45585
- tooltip: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, texts.table.filters.tooltip, /* @__PURE__ */ React__default.createElement(Shortcut, { className: "ml-2", keys: shortcut2 }))
45601
+ tooltip: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, texts.table.filters.tooltip, /* @__PURE__ */ React__default.createElement(Shortcut, { className: "ml-2", keys: shortcut2 })),
45602
+ id: `${tableId}-toolbar-filters`
45586
45603
  };
45587
45604
  React__default.useEffect(() => {
45588
45605
  var _a;
@@ -45615,7 +45632,7 @@ function TableToolbar(props) {
45615
45632
  "data-taco": "table-toolbar"
45616
45633
  },
45617
45634
  table.props.toolbarLeft,
45618
- /* @__PURE__ */ React__default.createElement(Group$6, { className: "ml-auto flex-shrink-0 items-center print:hidden" }, customTools, canFilter ? /* @__PURE__ */ React__default.createElement(Filters, { length: table.meta.length, table: table.instance }) : null, table.props.toolbarRight, canPrint ? /* @__PURE__ */ React__default.createElement(Print, { table: table.instance, tableId: table.id, tableRef: table.ref }) : null, canSettings ? /* @__PURE__ */ React__default.createElement(Settings, { customSettings: table.props.customSettings, id: `${id2}-settings`, table: table.instance }) : null, canSearch ? /* @__PURE__ */ React__default.createElement(Search$1, { scrollToIndex: table.renderer.scrollToIndex, table: table.instance, tableRef: table.ref }) : null)
45635
+ /* @__PURE__ */ React__default.createElement(Group$6, { className: "ml-auto flex-shrink-0 items-center print:hidden" }, customTools, canFilter ? /* @__PURE__ */ React__default.createElement(Filters, { length: table.meta.length, tableId: table.id, table: table.instance }) : null, table.props.toolbarRight, canPrint ? /* @__PURE__ */ React__default.createElement(Print, { table: table.instance, tableId: table.id, tableRef: table.ref }) : null, canSettings ? /* @__PURE__ */ React__default.createElement(Settings, { customSettings: table.props.customSettings, id: `${id2}-settings`, table: table.instance }) : null, canSearch ? /* @__PURE__ */ React__default.createElement(Search$1, { scrollToIndex: table.renderer.scrollToIndex, table: table.instance, tableRef: table.ref }) : null)
45619
45636
  ), table.props.toolbarPanel ? /* @__PURE__ */ React__default.createElement("div", { className: "mb-4" }, table.props.toolbarPanel) : void 0);
45620
45637
  }
45621
45638
  function canChangeSettings(table, customSettings) {