@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.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(
@@ -39012,6 +39021,9 @@ function Header$1(props) {
39012
39021
  if (canHide) {
39013
39022
  memoedProps.onHide = header.column.getToggleVisibilityHandler();
39014
39023
  }
39024
+ if (header.id === "__expansion") {
39025
+ memoedProps.isExpanded = table.getIsSomeRowsExpanded();
39026
+ }
39015
39027
  if (canPin) {
39016
39028
  memoedProps.onPin = (index2) => {
39017
39029
  table.setColumnPinning((pinningState) => {
@@ -39062,6 +39074,7 @@ const MemoedHeader = React__default.memo(function MemoedHeader2(props) {
39062
39074
  hasMenu,
39063
39075
  id: id2,
39064
39076
  index: index2,
39077
+ isExpanded,
39065
39078
  isFiltered,
39066
39079
  isGroup: isGroup2,
39067
39080
  isPinned,
@@ -39101,6 +39114,7 @@ const MemoedHeader = React__default.memo(function MemoedHeader2(props) {
39101
39114
  "data-cell-id": id2,
39102
39115
  "data-cell-pinned": isPinned ? isPinned : void 0,
39103
39116
  "data-taco": isGroup2 ? "grouped-column-header" : "column-header",
39117
+ "data-rows-expanded": isExpanded ? isExpanded : void 0,
39104
39118
  style,
39105
39119
  ref: setRef
39106
39120
  },
@@ -39295,10 +39309,10 @@ function Summary(props) {
39295
39309
  } else if (!tableMeta.server.isEnabled && (((_a = table.getState().columnFilters) == null ? void 0 : _a.length) || // filtered data
39296
39310
  !!table.getState().globalFilter && table.options.enableGlobalFilter)) {
39297
39311
  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)));
39312
+ 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
39313
  } else {
39300
39314
  label = texts.table.footer.summary.records;
39301
- count2 = /* @__PURE__ */ React__default.createElement("strong", null, new Intl.NumberFormat(locale2).format(length));
39315
+ count2 = /* @__PURE__ */ React__default.createElement("strong", { "data-taco": "table-footer-total-count" }, new Intl.NumberFormat(locale2).format(length));
39302
39316
  }
39303
39317
  return /* @__PURE__ */ React__default.createElement(
39304
39318
  "div",
@@ -45149,6 +45163,7 @@ function Print(props) {
45149
45163
  {
45150
45164
  icon: "print",
45151
45165
  "aria-label": texts.table.print.tooltip,
45166
+ id: `${tableId}-toolbar-print`,
45152
45167
  dialog: (dialogProps) => /* @__PURE__ */ React__default.createElement(
45153
45168
  PrintDialog,
45154
45169
  {
@@ -45485,7 +45500,7 @@ function Filter(props) {
45485
45500
  ref.current.focus();
45486
45501
  }
45487
45502
  }, [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);
45503
+ 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
45504
  }
45490
45505
  const placeholderFilter = { id: "", value: { comparator: TableFilterComparator.Contains, value: void 0 } };
45491
45506
  function ManageFiltersPopover(props) {
@@ -45566,10 +45581,10 @@ function ManageFiltersPopover(props) {
45566
45581
  onChange: handleChangeFilter,
45567
45582
  onRemove: filters.length > 0 && filters.some((f2) => f2.id) || filters.length > 1 ? handleRemoveFilter : void 0
45568
45583
  }
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))))));
45584
+ )), /* @__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
45585
  }
45571
45586
  function Filters(props) {
45572
- const { length, table } = props;
45587
+ const { length, tableId, table } = props;
45573
45588
  const { texts } = useLocalization();
45574
45589
  const isLargeScreen = useIsLargeScreen();
45575
45590
  const columnFilters = table.getState().columnFilters;
@@ -45582,7 +45597,8 @@ function Filters(props) {
45582
45597
  popover: (popoverProps) => /* @__PURE__ */ React__default.createElement(ManageFiltersPopover, { ...popoverProps, length, table }),
45583
45598
  shortcut: shortcut2,
45584
45599
  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 }))
45600
+ tooltip: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, texts.table.filters.tooltip, /* @__PURE__ */ React__default.createElement(Shortcut, { className: "ml-2", keys: shortcut2 })),
45601
+ id: `${tableId}-toolbar-filters`
45586
45602
  };
45587
45603
  React__default.useEffect(() => {
45588
45604
  var _a;
@@ -45615,7 +45631,7 @@ function TableToolbar(props) {
45615
45631
  "data-taco": "table-toolbar"
45616
45632
  },
45617
45633
  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)
45634
+ /* @__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
45635
  ), table.props.toolbarPanel ? /* @__PURE__ */ React__default.createElement("div", { className: "mb-4" }, table.props.toolbarPanel) : void 0);
45620
45636
  }
45621
45637
  function canChangeSettings(table, customSettings) {