rowBelow.js 611 B

12345678910111213141516171819202122
  1. import { getValidSelection } from './../utils';
  2. export var KEY = 'row_below';
  3. export default function rowBelowItem() {
  4. return {
  5. key: KEY,
  6. name: 'Insert row below',
  7. callback: function callback(key, selection) {
  8. this.alter('insert_row', selection.end.row + 1, 1, 'ContextMenu.rowBelow');
  9. },
  10. disabled: function disabled() {
  11. var selected = getValidSelection(this);
  12. return !selected || this.selection.selectedHeader.cols || this.countRows() >= this.getSettings().maxRows;
  13. },
  14. hidden: function hidden() {
  15. return !this.getSettings().allowInsertRow;
  16. }
  17. };
  18. }