@economic/taco 2.46.2 → 2.46.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (20) 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 +5 -4
  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/useTable3.js +12 -3
  9. package/dist/esm/packages/taco/src/components/Table3/useTable3.js.map +1 -1
  10. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js +23 -16
  11. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js.map +1 -1
  12. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js +2 -1
  13. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js.map +1 -1
  14. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js +4 -1
  15. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js.map +1 -1
  16. package/dist/taco.cjs.development.js +47 -26
  17. package/dist/taco.cjs.development.js.map +1 -1
  18. package/dist/taco.cjs.production.min.js +1 -1
  19. package/dist/taco.cjs.production.min.js.map +1 -1
  20. 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,
@@ -19600,7 +19611,7 @@ function DiscardChangesConfirmationDialog(props) {
19600
19611
  }, texts.table3.editing.clearChangesConfirmationDialog.confirm))))));
19601
19612
  }
19602
19613
 
19603
- function EditingActionMenu(props) {
19614
+ function EditingActionsMenu(props) {
19604
19615
  const {
19605
19616
  hasChanges,
19606
19617
  hasErrors,
@@ -19766,10 +19777,19 @@ function useTable3(props, ref) {
19766
19777
  // Display EditingActionMenu instead of row actions while editing
19767
19778
  rowActions: editing.isEditing ? [(_, rowId, table) => {
19768
19779
  const tableMeta = table.options.meta;
19769
- return /*#__PURE__*/React__default.createElement(EditingActionMenu, {
19780
+ return /*#__PURE__*/React__default.createElement(EditingActionsMenu, {
19770
19781
  hasChanges: editing.hasChanges(rowId),
19771
19782
  hasErrors: editing.hasRowErrors(rowId),
19772
- onDiscard: () => editing.discardChanges(rowId, table),
19783
+ onDiscard: () => {
19784
+ if (editing.temporaryRows.length) {
19785
+ tableMeta.rowActive.setRowActiveIndex(undefined);
19786
+ setTimeout(() => {
19787
+ var _editing$createRowBut;
19788
+ return (_editing$createRowBut = editing.createRowButtonRef.current) === null || _editing$createRowBut === void 0 ? void 0 : _editing$createRowBut.focus();
19789
+ }, 50);
19790
+ }
19791
+ editing.discardChanges(rowId, table);
19792
+ },
19773
19793
  onEditingSave: function () {
19774
19794
  try {
19775
19795
  return Promise.resolve(editing.saveChanges(table, rowId)).then(function () {});
@@ -19950,7 +19970,7 @@ function Editing(props) {
19950
19970
  }
19951
19971
 
19952
19972
  function CreateNewRow(props) {
19953
- var _temporaryRows$0$tabl, _temporaryRows$, _table$getState$colum;
19973
+ var _temporaryRows$0$tabl, _temporaryRows$, _table$getState$colum, _tableRef$current2;
19954
19974
  const {
19955
19975
  buttonRef,
19956
19976
  onEditingCreate: handleEditingCreate,
@@ -19996,16 +20016,17 @@ function CreateNewRow(props) {
19996
20016
  };
19997
20017
  // allow programmatic access to creating rows from outside the table
19998
20018
  React__default.useEffect(() => {
19999
- if (tableRef.current) {
20019
+ var _tableRef$current;
20020
+ if (tableRef !== null && tableRef !== void 0 && (_tableRef$current = tableRef.current) !== null && _tableRef$current !== void 0 && _tableRef$current.instance) {
20000
20021
  tableRef.current.instance.createRow = createRow;
20001
20022
  }
20002
- }, [tableRef.current, createRow]);
20023
+ }, [tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : _tableRef$current2.instance, createRow]);
20003
20024
  const handleCreate = function () {
20004
20025
  return createRow();
20005
20026
  };
20006
20027
  const shortcut = {
20007
20028
  key: 'Enter',
20008
- shift: true
20029
+ meta: true
20009
20030
  };
20010
20031
  let tooltip;
20011
20032
  if (isSaving) {