Files
railwaysystem/RuoYi-Vue/ruoyi-ui/node_modules2/handsontable/plugins/contextMenu/predefinedItems/rowBelow.mjs
T

33 lines
983 B
JavaScript
Raw Normal View History

2026-09-10 15:40:10 +08:00
import { getValidSelection } from "../utils.mjs";
import * as C from "../../../i18n/constants.mjs";
export const KEY = 'row_below';
/**
* @returns {object}
*/
export default function rowBelowItem() {
return {
key: KEY,
name() {
return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ROW_BELOW);
},
callback() {
const latestSelection = this.getSelectedRangeLast().getBottomRightCorner();
this.alter('insert_row_below', latestSelection.row, 1, 'ContextMenu.rowBelow');
},
disabled() {
const selected = getValidSelection(this);
if (!selected) {
return true;
}
if (this.selection.isSelectedByCorner()) {
// Enable "Insert row below" always when the menu is triggered by corner click.
return false;
}
return this.selection.isSelectedByColumnHeader() || this.countRows() >= this.getSettings().maxRows;
},
hidden() {
return !this.getSettings().allowInsertRow;
}
};
}