@economic/taco 2.67.0 → 2.67.1-alpha.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) => {
@@ -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(
@@ -37939,10 +37948,11 @@ function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIn
37939
37948
  row = rows[virtualRow.index];
37940
37949
  }
37941
37950
  if (!(row == null ? void 0 : row.original)) {
37951
+ const skeletonKey = `skeleton-${virtualRow.index}-${JSON.stringify(table.getState().sorting).slice(0, 8)}`;
37942
37952
  return /* @__PURE__ */ React.createElement(
37943
37953
  SkeletonRow,
37944
37954
  {
37945
- key: virtualRow.index,
37955
+ key: skeletonKey,
37946
37956
  index: virtualRow.index,
37947
37957
  scrollDirection: virtualiser.scrollDirection ?? void 0,
37948
37958
  table
@@ -39030,6 +39040,9 @@ function Header$1(props) {
39030
39040
  if (canHide) {
39031
39041
  memoedProps.onHide = header.column.getToggleVisibilityHandler();
39032
39042
  }
39043
+ if (header.id === "__expansion") {
39044
+ memoedProps.isExpanded = table.getIsSomeRowsExpanded();
39045
+ }
39033
39046
  if (canPin) {
39034
39047
  memoedProps.onPin = (index2) => {
39035
39048
  table.setColumnPinning((pinningState) => {
@@ -39080,6 +39093,7 @@ const MemoedHeader = React.memo(function MemoedHeader2(props) {
39080
39093
  hasMenu,
39081
39094
  id: id2,
39082
39095
  index: index2,
39096
+ isExpanded,
39083
39097
  isFiltered,
39084
39098
  isGroup: isGroup2,
39085
39099
  isPinned,
@@ -39119,6 +39133,7 @@ const MemoedHeader = React.memo(function MemoedHeader2(props) {
39119
39133
  "data-cell-id": id2,
39120
39134
  "data-cell-pinned": isPinned ? isPinned : void 0,
39121
39135
  "data-taco": isGroup2 ? "grouped-column-header" : "column-header",
39136
+ "data-rows-expanded": isExpanded ? isExpanded : void 0,
39122
39137
  style,
39123
39138
  ref: setRef
39124
39139
  },
@@ -39313,10 +39328,10 @@ function Summary(props) {
39313
39328
  } else if (!tableMeta.server.isEnabled && (((_a = table.getState().columnFilters) == null ? void 0 : _a.length) || // filtered data
39314
39329
  !!table.getState().globalFilter && table.options.enableGlobalFilter)) {
39315
39330
  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)));
39331
+ 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
39332
  } else {
39318
39333
  label = texts.table.footer.summary.records;
39319
- count2 = /* @__PURE__ */ React.createElement("strong", null, new Intl.NumberFormat(locale2).format(length));
39334
+ count2 = /* @__PURE__ */ React.createElement("strong", { "data-taco": "table-footer-total-count" }, new Intl.NumberFormat(locale2).format(length));
39320
39335
  }
39321
39336
  return /* @__PURE__ */ React.createElement(
39322
39337
  "div",
@@ -45167,6 +45182,7 @@ function Print(props) {
45167
45182
  {
45168
45183
  icon: "print",
45169
45184
  "aria-label": texts.table.print.tooltip,
45185
+ id: `${tableId}-toolbar-print`,
45170
45186
  dialog: (dialogProps) => /* @__PURE__ */ React.createElement(
45171
45187
  PrintDialog,
45172
45188
  {
@@ -45503,7 +45519,7 @@ function Filter(props) {
45503
45519
  ref.current.focus();
45504
45520
  }
45505
45521
  }, [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);
45522
+ 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
45523
  }
45508
45524
  const placeholderFilter = { id: "", value: { comparator: TableFilterComparator.Contains, value: void 0 } };
45509
45525
  function ManageFiltersPopover(props) {
@@ -45584,10 +45600,10 @@ function ManageFiltersPopover(props) {
45584
45600
  onChange: handleChangeFilter,
45585
45601
  onRemove: filters.length > 0 && filters.some((f2) => f2.id) || filters.length > 1 ? handleRemoveFilter : void 0
45586
45602
  }
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))))));
45603
+ )), /* @__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
45604
  }
45589
45605
  function Filters(props) {
45590
- const { length, table } = props;
45606
+ const { length, tableId, table } = props;
45591
45607
  const { texts } = useLocalization();
45592
45608
  const isLargeScreen = useIsLargeScreen();
45593
45609
  const columnFilters = table.getState().columnFilters;
@@ -45600,7 +45616,8 @@ function Filters(props) {
45600
45616
  popover: (popoverProps) => /* @__PURE__ */ React.createElement(ManageFiltersPopover, { ...popoverProps, length, table }),
45601
45617
  shortcut: shortcut2,
45602
45618
  ref,
45603
- tooltip: /* @__PURE__ */ React.createElement(React.Fragment, null, texts.table.filters.tooltip, /* @__PURE__ */ React.createElement(Shortcut, { className: "ml-2", keys: shortcut2 }))
45619
+ tooltip: /* @__PURE__ */ React.createElement(React.Fragment, null, texts.table.filters.tooltip, /* @__PURE__ */ React.createElement(Shortcut, { className: "ml-2", keys: shortcut2 })),
45620
+ id: `${tableId}-toolbar-filters`
45604
45621
  };
45605
45622
  React.useEffect(() => {
45606
45623
  var _a;
@@ -45633,7 +45650,7 @@ function TableToolbar(props) {
45633
45650
  "data-taco": "table-toolbar"
45634
45651
  },
45635
45652
  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)
45653
+ /* @__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
45654
  ), table.props.toolbarPanel ? /* @__PURE__ */ React.createElement("div", { className: "mb-4" }, table.props.toolbarPanel) : void 0);
45638
45655
  }
45639
45656
  function canChangeSettings(table, customSettings) {