@progress/kendo-angular-spreadsheet
Version:
A Spreadsheet Component for Angular
50 lines (49 loc) • 1.94 kB
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { trashIcon, pencilIcon, copyIcon, arrowRightIcon, arrowLeftIcon, eyeSlashIcon } from '@progress/kendo-svg-icons';
/**
* @hidden
*/
export const getSheetActions = (items, item) => {
const visibleItems = items.filter(item => item.state === 'visible');
const itemIndex = item ? visibleItems.findIndex(i => i === item) : 0;
return [{
messageKey: 'sheetDelete',
icon: 'trash',
svgIcon: trashIcon,
commandName: 'delete',
dialogButton: 'dialogDelete',
disabled: visibleItems.length === 1
}, {
messageKey: 'sheetDuplicate',
icon: 'copy',
svgIcon: copyIcon,
commandName: 'copy'
}, {
messageKey: 'sheetRename',
icon: 'pencil',
svgIcon: pencilIcon,
commandName: 'rename',
dialogButton: 'dialogRename'
}, {
messageKey: 'sheetHide',
icon: 'eye-slash',
svgIcon: eyeSlashIcon,
commandName: 'hide',
disabled: visibleItems.length === 1
}, {
messageKey: 'sheetMoveRight',
icon: 'arrow-right',
svgIcon: arrowRightIcon,
commandName: 'move',
disabled: visibleItems.length === 1 || itemIndex === visibleItems.length - 1
}, {
messageKey: 'sheetMoveLeft',
icon: 'arrow-left',
svgIcon: arrowLeftIcon,
commandName: 'move',
disabled: visibleItems.length === 1 || itemIndex === 0
}];
};