@economic/taco 2.45.0-alpha.2 → 2.45.0-alpha.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Table3/components/Columns/Internal/EditingActionsMenu.d.ts +2 -2
- package/dist/esm/packages/taco/src/components/Button/util.js +1 -1
- package/dist/esm/packages/taco/src/components/Button/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js +5 -4
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/useTable3.js +12 -3
- package/dist/esm/packages/taco/src/components/Table3/useTable3.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +5 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js +23 -16
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js +2 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js +4 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js.map +1 -1
- package/dist/taco.cjs.development.js +52 -27
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +2 -2
@@ -4385,7 +4385,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(props, ref) {
|
|
4385
4385
|
});
|
4386
4386
|
|
4387
4387
|
const getButtonClasses = () => {
|
4388
|
-
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';
|
4388
|
+
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';
|
4389
4389
|
};
|
4390
4390
|
const getAppearanceClasses = (value, icon = false) => {
|
4391
4391
|
switch (value) {
|
@@ -12421,7 +12421,8 @@ const Cell = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
|
|
12421
12421
|
const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;
|
12422
12422
|
const isResizingColumn = !!table.getState().columnSizingInfo.isResizingColumn;
|
12423
12423
|
const isHoverStatePaused = tableMeta.rowActive.isHoverStatePaused;
|
12424
|
-
|
12424
|
+
const isRowGrouped = row.getIsGrouped();
|
12425
|
+
if (!hideRowActions && !isRowGrouped && actions !== null && actions !== void 0 && actions.length && (isActiveRow || isHovered && !isHoverStatePaused && !isResizingColumn)) {
|
12425
12426
|
return /*#__PURE__*/React__default.createElement(Actions$1, {
|
12426
12427
|
actions: actions,
|
12427
12428
|
actionsLength: actionsLength,
|
@@ -12797,7 +12798,9 @@ function GroupedCell(props) {
|
|
12797
12798
|
} = React__default.useContext(RowContext);
|
12798
12799
|
const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;
|
12799
12800
|
const canShowActions = isActiveRow || isHovered && !tableMeta.rowActive.isHoverStatePaused;
|
12800
|
-
|
12801
|
+
// Set colSpan based on the count of visible cells, including '__actions' and non-internal columns, so that
|
12802
|
+
// rowGroupActions aligns with rowActions.
|
12803
|
+
const colSpan = cell.row.getVisibleCells().filter(c => c.column.id === '__actions' || !isInternalColumn(c.column.id)).length - 1;
|
12801
12804
|
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;
|
12802
12805
|
const subRows = cell.getContext().row.subRows.map(row => row.original);
|
12803
12806
|
return /*#__PURE__*/React__default.createElement(MemoedGroupedCell, Object.assign({}, attributes, {
|
@@ -12822,21 +12825,26 @@ const MemoedGroupedCell = /*#__PURE__*/React__default.memo(function MemoedGroupe
|
|
12822
12825
|
table,
|
12823
12826
|
...attributes
|
12824
12827
|
} = props;
|
12825
|
-
return
|
12826
|
-
|
12827
|
-
|
12828
|
-
|
12829
|
-
|
12830
|
-
|
12831
|
-
|
12832
|
-
|
12833
|
-
|
12834
|
-
|
12835
|
-
|
12836
|
-
|
12837
|
-
|
12838
|
-
|
12839
|
-
|
12828
|
+
return (
|
12829
|
+
/*#__PURE__*/
|
12830
|
+
// pr-1 is needed to align group row actions with row actions in sibling rows, if present
|
12831
|
+
React__default.createElement("td", Object.assign({}, attributes, {
|
12832
|
+
className: "!pr-1",
|
12833
|
+
ref: cellRef,
|
12834
|
+
style: {
|
12835
|
+
gridColumn: `span ${colSpan} / span ${colSpan}`
|
12836
|
+
}
|
12837
|
+
}), /*#__PURE__*/React__default.createElement("span", {
|
12838
|
+
className: "grow"
|
12839
|
+
}, children), rowActions !== null && rowActions !== void 0 && rowActions.length && canShowActions ? (/*#__PURE__*/React__default.createElement(Actions$1, {
|
12840
|
+
actions: rowActions,
|
12841
|
+
actionsLength: 4,
|
12842
|
+
data: subRows,
|
12843
|
+
isActiveRow: true,
|
12844
|
+
rowId: rowId,
|
12845
|
+
table: table
|
12846
|
+
})) : null)
|
12847
|
+
);
|
12840
12848
|
});
|
12841
12849
|
|
12842
12850
|
function Cell$4(props) {
|
@@ -12979,10 +12987,13 @@ const DisplayRow = /*#__PURE__*/React__default.memo(function DisplayRow(props) {
|
|
12979
12987
|
'hover:cursor-grab': tableMeta.rowDrag.isEnabled && typeof attributes.onClick !== 'function',
|
12980
12988
|
'hover:cursor-pointer': typeof attributes.onClick === 'function'
|
12981
12989
|
});
|
12990
|
+
const isGrouped = row.getIsGrouped();
|
12982
12991
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("tr", Object.assign({}, attributes, {
|
12983
12992
|
className: className,
|
12984
12993
|
ref: ref
|
12985
|
-
}), children, row.getVisibleCells()
|
12994
|
+
}), children, row.getVisibleCells()
|
12995
|
+
// Filter out the row actions cell from rendering in Grouped Row
|
12996
|
+
.filter(cell => !(isGrouped && cell.column.id === '__actions')).map((cell, cellIndex) => (/*#__PURE__*/React__default.createElement(Cell$4, {
|
12986
12997
|
key: cell.id,
|
12987
12998
|
cell: cell,
|
12988
12999
|
index: cellIndex,
|
@@ -16859,7 +16870,11 @@ function TableGrid(props) {
|
|
16859
16870
|
style: table.style,
|
16860
16871
|
tabIndex: -1
|
16861
16872
|
}), /*#__PURE__*/React__default.createElement("thead", null, table.instance.getHeaderGroups().map(headerGroup => (/*#__PURE__*/React__default.createElement("tr", {
|
16862
|
-
key: headerGroup.id
|
16873
|
+
key: headerGroup.id,
|
16874
|
+
onFocus: event => {
|
16875
|
+
// prevents rowActive.handleFocus from running when clicking on column-header menus.
|
16876
|
+
event.stopPropagation();
|
16877
|
+
}
|
16863
16878
|
}, headerGroup.headers.map(props => (/*#__PURE__*/React__default.createElement(Header$5, {
|
16864
16879
|
key: props.id,
|
16865
16880
|
header: props,
|
@@ -19617,7 +19632,7 @@ function DiscardChangesConfirmationDialog(props) {
|
|
19617
19632
|
}, texts.table3.editing.clearChangesConfirmationDialog.confirm))))));
|
19618
19633
|
}
|
19619
19634
|
|
19620
|
-
function
|
19635
|
+
function EditingActionsMenu(props) {
|
19621
19636
|
const {
|
19622
19637
|
hasChanges,
|
19623
19638
|
hasErrors,
|
@@ -19786,10 +19801,19 @@ function useTable3(props, ref) {
|
|
19786
19801
|
// Display EditingActionMenu instead of row actions while editing
|
19787
19802
|
rowActions: editing.isEditing ? [(_, rowId, table) => {
|
19788
19803
|
const tableMeta = table.options.meta;
|
19789
|
-
return /*#__PURE__*/React__default.createElement(
|
19804
|
+
return /*#__PURE__*/React__default.createElement(EditingActionsMenu, {
|
19790
19805
|
hasChanges: editing.hasChanges(rowId),
|
19791
19806
|
hasErrors: editing.hasRowErrors(rowId),
|
19792
|
-
onDiscard: () =>
|
19807
|
+
onDiscard: () => {
|
19808
|
+
if (editing.temporaryRows.length) {
|
19809
|
+
tableMeta.rowActive.setRowActiveIndex(undefined);
|
19810
|
+
setTimeout(() => {
|
19811
|
+
var _editing$createRowBut;
|
19812
|
+
return (_editing$createRowBut = editing.createRowButtonRef.current) === null || _editing$createRowBut === void 0 ? void 0 : _editing$createRowBut.focus();
|
19813
|
+
}, 50);
|
19814
|
+
}
|
19815
|
+
editing.discardChanges(rowId, table);
|
19816
|
+
},
|
19793
19817
|
onEditingSave: function () {
|
19794
19818
|
try {
|
19795
19819
|
return Promise.resolve(editing.saveChanges(table, rowId)).then(function () {});
|
@@ -19970,7 +19994,7 @@ function Editing(props) {
|
|
19970
19994
|
}
|
19971
19995
|
|
19972
19996
|
function CreateNewRow(props) {
|
19973
|
-
var _temporaryRows$0$tabl, _temporaryRows$, _table$getState$colum;
|
19997
|
+
var _temporaryRows$0$tabl, _temporaryRows$, _table$getState$colum, _tableRef$current2;
|
19974
19998
|
const {
|
19975
19999
|
buttonRef,
|
19976
20000
|
onEditingCreate: handleEditingCreate,
|
@@ -20016,16 +20040,17 @@ function CreateNewRow(props) {
|
|
20016
20040
|
};
|
20017
20041
|
// allow programmatic access to creating rows from outside the table
|
20018
20042
|
React__default.useEffect(() => {
|
20019
|
-
|
20043
|
+
var _tableRef$current;
|
20044
|
+
if (tableRef !== null && tableRef !== void 0 && (_tableRef$current = tableRef.current) !== null && _tableRef$current !== void 0 && _tableRef$current.instance) {
|
20020
20045
|
tableRef.current.instance.createRow = createRow;
|
20021
20046
|
}
|
20022
|
-
}, [tableRef.current, createRow]);
|
20047
|
+
}, [tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : _tableRef$current2.instance, createRow]);
|
20023
20048
|
const handleCreate = function () {
|
20024
20049
|
return createRow();
|
20025
20050
|
};
|
20026
20051
|
const shortcut = {
|
20027
20052
|
key: 'Enter',
|
20028
|
-
|
20053
|
+
meta: true
|
20029
20054
|
};
|
20030
20055
|
let tooltip;
|
20031
20056
|
if (isSaving) {
|