@economic/taco 2.67.0 → 2.67.1-footer-fix.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
@@ -26978,7 +26978,7 @@ const Content$4 = React__namespace.forwardRef(function HangerContent(props, ref)
26978
26978
  const context = React__namespace.useContext(HangerContext);
26979
26979
  const { texts } = useLocalization();
26980
26980
  const className = clsx(
26981
- "wcag-blue-500 border border-transparent rounded p-3 pr-12 yt-shadow focus:border-transparent max-w-sm",
26981
+ "wcag-blue-500 border border-transparent rounded p-3 pr-12 yt-shadow focus:border-transparent max-w-sm print:hidden",
26982
26982
  props.className
26983
26983
  );
26984
26984
  const handleInteractOutside = (event) => {
@@ -35564,7 +35564,7 @@ function configureReactTableOptions(options, props, localization) {
35564
35564
  if (originalRow) {
35565
35565
  return String(originalRow[props.rowIdentityAccessor]);
35566
35566
  }
35567
- return String(index2);
35567
+ return `skeleton-${index2}-${Math.random().toString(36).substr(2, 9)}`;
35568
35568
  };
35569
35569
  }
35570
35570
  const tableOptions = {
@@ -37880,6 +37880,8 @@ function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIn
37880
37880
  });
37881
37881
  const expandedState = table.getState().expanded;
37882
37882
  const previousExpandedStateRef = React.useRef(false);
37883
+ const sortingState = table.getState().sorting;
37884
+ const previousSortingStateRef = React.useRef(JSON.stringify(sortingState));
37883
37885
  React.useEffect(() => {
37884
37886
  const isEmpty = JSON.stringify(expandedState) === "{}";
37885
37887
  if (expandedState === true || isEmpty && previousExpandedStateRef.current === true) {
@@ -37887,6 +37889,13 @@ function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIn
37887
37889
  virtualiser.measure();
37888
37890
  }
37889
37891
  }, [expandedState]);
37892
+ React.useEffect(() => {
37893
+ const currentSortingString = JSON.stringify(sortingState);
37894
+ if (currentSortingString !== previousSortingStateRef.current) {
37895
+ previousSortingStateRef.current = currentSortingString;
37896
+ virtualiser.measure();
37897
+ }
37898
+ }, [sortingState]);
37890
37899
  const totalSize = virtualiser.getTotalSize();
37891
37900
  const virtualItems = virtualiser.getVirtualItems();
37892
37901
  const scrollToIndex = React.useCallback(
@@ -39030,6 +39039,9 @@ function Header$1(props) {
39030
39039
  if (canHide) {
39031
39040
  memoedProps.onHide = header.column.getToggleVisibilityHandler();
39032
39041
  }
39042
+ if (header.id === "__expansion") {
39043
+ memoedProps.isExpanded = table.getIsSomeRowsExpanded();
39044
+ }
39033
39045
  if (canPin) {
39034
39046
  memoedProps.onPin = (index2) => {
39035
39047
  table.setColumnPinning((pinningState) => {
@@ -39080,6 +39092,7 @@ const MemoedHeader = React.memo(function MemoedHeader2(props) {
39080
39092
  hasMenu,
39081
39093
  id: id2,
39082
39094
  index: index2,
39095
+ isExpanded,
39083
39096
  isFiltered,
39084
39097
  isGroup: isGroup2,
39085
39098
  isPinned,
@@ -39119,6 +39132,7 @@ const MemoedHeader = React.memo(function MemoedHeader2(props) {
39119
39132
  "data-cell-id": id2,
39120
39133
  "data-cell-pinned": isPinned ? isPinned : void 0,
39121
39134
  "data-taco": isGroup2 ? "grouped-column-header" : "column-header",
39135
+ "data-rows-expanded": isExpanded ? isExpanded : void 0,
39122
39136
  style,
39123
39137
  ref: setRef
39124
39138
  },
@@ -39313,10 +39327,10 @@ function Summary(props) {
39313
39327
  } else if (!tableMeta.server.isEnabled && (((_a = table.getState().columnFilters) == null ? void 0 : _a.length) || // filtered data
39314
39328
  !!table.getState().globalFilter && table.options.enableGlobalFilter)) {
39315
39329
  label = texts.table.footer.summary.records;
39316
- count2 = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("strong", null, new Intl.NumberFormat(locale2).format(currentLength)), " ", texts.table.footer.summary.count, " ", /* @__PURE__ */ React.createElement("strong", null, new Intl.NumberFormat(locale2).format(length)));
39330
+ count2 = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("strong", { "data-taco": "table-footer-current-count" }, new Intl.NumberFormat(locale2).format(currentLength)), " ", texts.table.footer.summary.count, " ", /* @__PURE__ */ React.createElement("strong", { "data-taco": "table-footer-total-count" }, new Intl.NumberFormat(locale2).format(length)));
39317
39331
  } else {
39318
39332
  label = texts.table.footer.summary.records;
39319
- count2 = /* @__PURE__ */ React.createElement("strong", null, new Intl.NumberFormat(locale2).format(length));
39333
+ count2 = /* @__PURE__ */ React.createElement("strong", { "data-taco": "table-footer-total-count" }, new Intl.NumberFormat(locale2).format(length));
39320
39334
  }
39321
39335
  return /* @__PURE__ */ React.createElement(
39322
39336
  "div",
@@ -45167,6 +45181,7 @@ function Print(props) {
45167
45181
  {
45168
45182
  icon: "print",
45169
45183
  "aria-label": texts.table.print.tooltip,
45184
+ id: `${tableId}-toolbar-print`,
45170
45185
  dialog: (dialogProps) => /* @__PURE__ */ React.createElement(
45171
45186
  PrintDialog,
45172
45187
  {
@@ -45503,7 +45518,7 @@ function Filter(props) {
45503
45518
  ref.current.focus();
45504
45519
  }
45505
45520
  }, [id2]);
45506
- 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);
45521
+ return /* @__PURE__ */ React.createElement("div", { className: "flex items-start gap-2", "data-taco": "filter-row" }, /* @__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);
45507
45522
  }
45508
45523
  const placeholderFilter = { id: "", value: { comparator: TableFilterComparator.Contains, value: void 0 } };
45509
45524
  function ManageFiltersPopover(props) {
@@ -45584,10 +45599,10 @@ function ManageFiltersPopover(props) {
45584
45599
  onChange: handleChangeFilter,
45585
45600
  onRemove: filters.length > 0 && filters.some((f2) => f2.id) || filters.length > 1 ? handleRemoveFilter : void 0
45586
45601
  }
45587
- )), /* @__PURE__ */ React.createElement("div", { className: "justify-start" }, /* @__PURE__ */ React.createElement(Button$4, { appearance: "discrete", onClick: handleCreate }, "+ ", texts.table.filters.buttons.addFilter))), /* @__PURE__ */ React.createElement(Group$6, { className: "ml-auto" }, /* @__PURE__ */ React.createElement(Popover.Close, null, /* @__PURE__ */ React.createElement(Button$4, null, texts.table.filters.buttons.cancel)), /* @__PURE__ */ React.createElement(Button$4, { onClick: handleClear }, texts.table.filters.buttons.clear), /* @__PURE__ */ React.createElement(Button$4, { appearance: "primary", onClick: handleApply }, texts.table.filters.buttons.apply))))));
45602
+ )), /* @__PURE__ */ React.createElement("div", { className: "justify-start" }, /* @__PURE__ */ React.createElement(Button$4, { appearance: "discrete", onClick: handleCreate, name: "add-filter" }, "+ ", texts.table.filters.buttons.addFilter))), /* @__PURE__ */ React.createElement(Group$6, { className: "ml-auto" }, /* @__PURE__ */ React.createElement(Popover.Close, null, /* @__PURE__ */ React.createElement(Button$4, { name: "close-filters" }, texts.table.filters.buttons.cancel)), /* @__PURE__ */ React.createElement(Button$4, { name: "clear-filters", onClick: handleClear }, texts.table.filters.buttons.clear), /* @__PURE__ */ React.createElement(Button$4, { appearance: "primary", name: "apply-filters", onClick: handleApply }, texts.table.filters.buttons.apply))))));
45588
45603
  }
45589
45604
  function Filters(props) {
45590
- const { length, table } = props;
45605
+ const { length, tableId, table } = props;
45591
45606
  const { texts } = useLocalization();
45592
45607
  const isLargeScreen = useIsLargeScreen();
45593
45608
  const columnFilters = table.getState().columnFilters;
@@ -45600,7 +45615,8 @@ function Filters(props) {
45600
45615
  popover: (popoverProps) => /* @__PURE__ */ React.createElement(ManageFiltersPopover, { ...popoverProps, length, table }),
45601
45616
  shortcut: shortcut2,
45602
45617
  ref,
45603
- tooltip: /* @__PURE__ */ React.createElement(React.Fragment, null, texts.table.filters.tooltip, /* @__PURE__ */ React.createElement(Shortcut, { className: "ml-2", keys: shortcut2 }))
45618
+ tooltip: /* @__PURE__ */ React.createElement(React.Fragment, null, texts.table.filters.tooltip, /* @__PURE__ */ React.createElement(Shortcut, { className: "ml-2", keys: shortcut2 })),
45619
+ id: `${tableId}-toolbar-filters`
45604
45620
  };
45605
45621
  React.useEffect(() => {
45606
45622
  var _a;
@@ -45633,7 +45649,7 @@ function TableToolbar(props) {
45633
45649
  "data-taco": "table-toolbar"
45634
45650
  },
45635
45651
  table.props.toolbarLeft,
45636
- /* @__PURE__ */ React.createElement(Group$6, { className: "ml-auto flex-shrink-0 items-center print:hidden" }, customTools, canFilter ? /* @__PURE__ */ React.createElement(Filters, { length: table.meta.length, table: table.instance }) : null, table.props.toolbarRight, canPrint ? /* @__PURE__ */ React.createElement(Print, { table: table.instance, tableId: table.id, tableRef: table.ref }) : null, canSettings ? /* @__PURE__ */ React.createElement(Settings, { customSettings: table.props.customSettings, id: `${id2}-settings`, table: table.instance }) : null, canSearch ? /* @__PURE__ */ React.createElement(Search$1, { scrollToIndex: table.renderer.scrollToIndex, table: table.instance, tableRef: table.ref }) : null)
45652
+ /* @__PURE__ */ React.createElement(Group$6, { className: "ml-auto flex-shrink-0 items-center print:hidden" }, customTools, canFilter ? /* @__PURE__ */ React.createElement(Filters, { length: table.meta.length, tableId: table.id, table: table.instance }) : null, table.props.toolbarRight, canPrint ? /* @__PURE__ */ React.createElement(Print, { table: table.instance, tableId: table.id, tableRef: table.ref }) : null, canSettings ? /* @__PURE__ */ React.createElement(Settings, { customSettings: table.props.customSettings, id: `${id2}-settings`, table: table.instance }) : null, canSearch ? /* @__PURE__ */ React.createElement(Search$1, { scrollToIndex: table.renderer.scrollToIndex, table: table.instance, tableRef: table.ref }) : null)
45637
45653
  ), table.props.toolbarPanel ? /* @__PURE__ */ React.createElement("div", { className: "mb-4" }, table.props.toolbarPanel) : void 0);
45638
45654
  }
45639
45655
  function canChangeSettings(table, customSettings) {