@economic/taco 2.46.3 → 2.46.5

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.
Files changed (22) hide show
  1. package/dist/components/Table3/components/Columns/Internal/EditingActionsMenu.d.ts +2 -2
  2. package/dist/esm/packages/taco/src/components/Button/util.js +1 -1
  3. package/dist/esm/packages/taco/src/components/Button/util.js.map +1 -1
  4. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js +2 -2
  5. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js.map +1 -1
  6. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js +1 -1
  7. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js.map +1 -1
  8. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js +5 -3
  9. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js.map +1 -1
  10. package/dist/esm/packages/taco/src/components/Table3/useTable3.js +12 -3
  11. package/dist/esm/packages/taco/src/components/Table3/useTable3.js.map +1 -1
  12. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js +23 -16
  13. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js.map +1 -1
  14. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js +2 -1
  15. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js.map +1 -1
  16. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js +4 -1
  17. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js.map +1 -1
  18. package/dist/taco.cjs.development.js +48 -26
  19. package/dist/taco.cjs.development.js.map +1 -1
  20. package/dist/taco.cjs.production.min.js +1 -1
  21. package/dist/taco.cjs.production.min.js.map +1 -1
  22. package/package.json +2 -2
@@ -4376,7 +4376,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(props, ref) {
4376
4376
  });
4377
4377
 
4378
4378
  const getButtonClasses = () => {
4379
- return 'flex-shrink-0 min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center focus-visible:yt-focus aria-disabled:cursor-not-allowed';
4379
+ return 'flex-shrink-0 min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center focus-visible:yt-focus data-[state=instant-open]:yt-focus aria-disabled:cursor-not-allowed';
4380
4380
  };
4381
4381
  const getAppearanceClasses = (value, icon = false) => {
4382
4382
  switch (value) {
@@ -12406,7 +12406,8 @@ const Cell = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
12406
12406
  const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;
12407
12407
  const isResizingColumn = !!table.getState().columnSizingInfo.isResizingColumn;
12408
12408
  const isHoverStatePaused = tableMeta.rowActive.isHoverStatePaused;
12409
- if (!hideRowActions && actions !== null && actions !== void 0 && actions.length && (isActiveRow || isHovered && !isHoverStatePaused && !isResizingColumn)) {
12409
+ const isRowGrouped = row.getIsGrouped();
12410
+ if (!hideRowActions && !isRowGrouped && actions !== null && actions !== void 0 && actions.length && (isActiveRow || isHovered && !isHoverStatePaused && !isResizingColumn)) {
12410
12411
  return /*#__PURE__*/React__default.createElement(Actions$1, {
12411
12412
  actions: actions,
12412
12413
  actionsLength: actionsLength,
@@ -12782,7 +12783,9 @@ function GroupedCell(props) {
12782
12783
  } = React__default.useContext(RowContext);
12783
12784
  const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;
12784
12785
  const canShowActions = isActiveRow || isHovered && !tableMeta.rowActive.isHoverStatePaused;
12785
- const colSpan = cell.row.getVisibleCells().filter(c => !isInternalColumn(c.column.id)).length - 1;
12786
+ // Set colSpan based on the count of visible cells, including '__actions' and non-internal columns, so that
12787
+ // rowGroupActions aligns with rowActions.
12788
+ const colSpan = cell.row.getVisibleCells().filter(c => c.column.id === '__actions' || !isInternalColumn(c.column.id)).length - 1;
12786
12789
  const content = (_ref = (_columnMeta$renderer = (_columnMeta$renderer2 = columnMeta.renderer) === null || _columnMeta$renderer2 === void 0 ? void 0 : _columnMeta$renderer2.call(columnMeta, cell.getValue(), cell.row.original)) !== null && _columnMeta$renderer !== void 0 ? _columnMeta$renderer : cell.getValue()) !== null && _ref !== void 0 ? _ref : null;
12787
12790
  const subRows = cell.getContext().row.subRows.map(row => row.original);
12788
12791
  return /*#__PURE__*/React__default.createElement(MemoedGroupedCell, Object.assign({}, attributes, {
@@ -12807,21 +12810,26 @@ const MemoedGroupedCell = /*#__PURE__*/React__default.memo(function MemoedGroupe
12807
12810
  table,
12808
12811
  ...attributes
12809
12812
  } = props;
12810
- return /*#__PURE__*/React__default.createElement("td", Object.assign({}, attributes, {
12811
- ref: cellRef,
12812
- style: {
12813
- gridColumn: `span ${colSpan} / span ${colSpan}`
12814
- }
12815
- }), /*#__PURE__*/React__default.createElement("span", {
12816
- className: "grow"
12817
- }, children), rowActions !== null && rowActions !== void 0 && rowActions.length && canShowActions ? (/*#__PURE__*/React__default.createElement(Actions$1, {
12818
- actions: rowActions,
12819
- actionsLength: 4,
12820
- data: subRows,
12821
- isActiveRow: true,
12822
- rowId: rowId,
12823
- table: table
12824
- })) : null);
12813
+ return (
12814
+ /*#__PURE__*/
12815
+ // pr-1 is needed to align group row actions with row actions in sibling rows, if present
12816
+ React__default.createElement("td", Object.assign({}, attributes, {
12817
+ className: "!pr-1",
12818
+ ref: cellRef,
12819
+ style: {
12820
+ gridColumn: `span ${colSpan} / span ${colSpan}`
12821
+ }
12822
+ }), /*#__PURE__*/React__default.createElement("span", {
12823
+ className: "grow"
12824
+ }, children), rowActions !== null && rowActions !== void 0 && rowActions.length && canShowActions ? (/*#__PURE__*/React__default.createElement(Actions$1, {
12825
+ actions: rowActions,
12826
+ actionsLength: 4,
12827
+ data: subRows,
12828
+ isActiveRow: true,
12829
+ rowId: rowId,
12830
+ table: table
12831
+ })) : null)
12832
+ );
12825
12833
  });
12826
12834
 
12827
12835
  function Cell$4(props) {
@@ -12964,10 +12972,13 @@ const DisplayRow = /*#__PURE__*/React__default.memo(function DisplayRow(props) {
12964
12972
  'hover:cursor-grab': tableMeta.rowDrag.isEnabled && typeof attributes.onClick !== 'function',
12965
12973
  'hover:cursor-pointer': typeof attributes.onClick === 'function'
12966
12974
  });
12975
+ const isGrouped = row.getIsGrouped();
12967
12976
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("tr", Object.assign({}, attributes, {
12968
12977
  className: className,
12969
12978
  ref: ref
12970
- }), children, row.getVisibleCells().map((cell, cellIndex) => (/*#__PURE__*/React__default.createElement(Cell$4, {
12979
+ }), children, row.getVisibleCells()
12980
+ // Filter out the row actions cell from rendering in Grouped Row
12981
+ .filter(cell => !(isGrouped && cell.column.id === '__actions')).map((cell, cellIndex) => (/*#__PURE__*/React__default.createElement(Cell$4, {
12971
12982
  key: cell.id,
12972
12983
  cell: cell,
12973
12984
  index: cellIndex,
@@ -18462,11 +18473,13 @@ function useTableEditingListener(table, tableRef, scrollToIndex) {
18462
18473
  // store the last row active index, otherwise everytime tableMeta.editing.saveChanges changes the hook runs again
18463
18474
  const lastRowActiveIndexRef = React__default.useRef(tableMeta.rowActive.rowActiveIndex);
18464
18475
  useLazyEffect(() => {
18465
- if (tableMeta.editing.isEditing && lastRowActiveIndexRef.current !== undefined && tableMeta.rowActive.rowActiveIndex !== lastRowActiveIndexRef.current) {
18476
+ if (tableMeta.rowActive.rowActiveIndex !== lastRowActiveIndexRef.current) {
18466
18477
  lastRowActiveIndexRef.current = tableMeta.rowActive.rowActiveIndex;
18467
- tableMeta.editing.saveChanges(table);
18478
+ if (tableMeta.editing.isEditing && lastRowActiveIndexRef.current !== undefined) {
18479
+ tableMeta.editing.saveChanges(table);
18480
+ }
18468
18481
  }
18469
- }, [tableMeta.rowActive.rowActiveIndex, tableMeta.editing.saveChanges]);
18482
+ }, [tableMeta.rowActive.rowActiveIndex]);
18470
18483
  // show a warning if the user navigates away without triggering save, such as using the browser back/forward button
18471
18484
  const hasChanges = tableMeta.editing.hasChanges();
18472
18485
  React__default.useEffect(() => {
@@ -19600,7 +19613,7 @@ function DiscardChangesConfirmationDialog(props) {
19600
19613
  }, texts.table3.editing.clearChangesConfirmationDialog.confirm))))));
19601
19614
  }
19602
19615
 
19603
- function EditingActionMenu(props) {
19616
+ function EditingActionsMenu(props) {
19604
19617
  const {
19605
19618
  hasChanges,
19606
19619
  hasErrors,
@@ -19766,10 +19779,19 @@ function useTable3(props, ref) {
19766
19779
  // Display EditingActionMenu instead of row actions while editing
19767
19780
  rowActions: editing.isEditing ? [(_, rowId, table) => {
19768
19781
  const tableMeta = table.options.meta;
19769
- return /*#__PURE__*/React__default.createElement(EditingActionMenu, {
19782
+ return /*#__PURE__*/React__default.createElement(EditingActionsMenu, {
19770
19783
  hasChanges: editing.hasChanges(rowId),
19771
19784
  hasErrors: editing.hasRowErrors(rowId),
19772
- onDiscard: () => editing.discardChanges(rowId, table),
19785
+ onDiscard: () => {
19786
+ if (editing.temporaryRows.length) {
19787
+ tableMeta.rowActive.setRowActiveIndex(undefined);
19788
+ setTimeout(() => {
19789
+ var _editing$createRowBut;
19790
+ return (_editing$createRowBut = editing.createRowButtonRef.current) === null || _editing$createRowBut === void 0 ? void 0 : _editing$createRowBut.focus();
19791
+ }, 50);
19792
+ }
19793
+ editing.discardChanges(rowId, table);
19794
+ },
19773
19795
  onEditingSave: function () {
19774
19796
  try {
19775
19797
  return Promise.resolve(editing.saveChanges(table, rowId)).then(function () {});
@@ -20006,7 +20028,7 @@ function CreateNewRow(props) {
20006
20028
  };
20007
20029
  const shortcut = {
20008
20030
  key: 'Enter',
20009
- shift: true
20031
+ meta: true
20010
20032
  };
20011
20033
  let tooltip;
20012
20034
  if (isSaving) {