UNPKG

armisa-models

Version:
437 lines (430 loc) 13.5 kB
import { FontIconType } from "../../FontIconType"; import { ToolStripFactory } from "./ToolStripFactory"; import { ToolStripItemFactory } from "./ToolStripItemFactory"; export type IToolStripButtonIcon = undefined | 'none' | 'home' | 'new' | 'view' | 'edit' | 'delete' | 'cut' | 'copy' | 'past' | 'open' | 'close' | 'attach' | 'columns' | 'ok' | 'save' | 'print' | 'printCrystal' | 'sortNumber' | 'drillDown' | 'contextMenu' | 'exportToExcel' | 'importFromExcel' | 'goPreviousRow' | 'goNextRow' | 'insertRowTop' | 'insertRowBottom' | 'removeRow' | 'refresh' | 'nextPage' | 'previousPage' | 'next' | 'back' | 'nextSameLevel' | 'backSameLevel' | 'function' | 'sum' | 'up2Down' | 'toggleSelect' | 'send' | 'acceptForm' | 'declineForm' | 'cleanForm' | 'reply' | 'forward' | 'BOMThin' | 'BOMPro' | 'lock' | 'unLock' | 'shop' | 'purchaseOrder' | 'purchase' | 'sale' | 'productOrder' | 'product' | 'receipt' | 'remittance' ; export class ToolStripButtonFactory extends ToolStripItemFactory { public iconColor?: string; public iconName: FontIconType = 'New'; public iconComany: 'fontAwsome' | 'flatIcon' = 'fontAwsome'; public accessDenied: boolean = false; public focusToElement = () => { this.toolStripFactory.focusToThisToolStripItem(this); } constructor( toolStripFactory: ToolStripFactory, _fieldName: string, tabIndex: number, public icon: IToolStripButtonIcon, public onClick: (toolStripButtonFactory: ToolStripButtonFactory) => void, public fieldNameOfData: string | undefined, disabled: boolean, visible: boolean, public useAsEsc: boolean, public useAsAccept: boolean, public useAsSpaceKey: boolean, public useAsShiftKey: boolean, public size?: any, color?: string, public caption?: string, ) { super(toolStripFactory.mainStateFactory, toolStripFactory, _fieldName, tabIndex); this.disabled = disabled; this.visible = visible; this.setNameOfIcon(icon); if (typeof color === 'string') { this.iconColor = color; } else { this.setColorOfIcon(icon); } } private setNameOfIcon(icon: IToolStripButtonIcon) { switch (icon) { case 'new': this.iconName = 'New'; break; case 'edit': this.iconName = 'Edit'; break; case 'delete': this.iconName = 'Delete'; break; case 'cut': this.iconName = 'Cut'; break; case 'copy': this.iconName = 'Copy'; break; case 'past': this.iconName = 'Past'; break; case 'view': this.iconName = 'FolderOpen'; break; case 'close': this.iconName = 'Close'; break; case 'open': this.iconName = 'Open'; break; case 'columns': this.iconName = 'Columns'; break; case 'ok': this.iconComany = 'flatIcon'; break; case 'home': this.iconName = 'Home'; break; case 'save': this.iconName = 'Save'; break; case 'print': this.iconName = 'Print'; break; case 'printCrystal': this.iconName = 'PrintPro'; break; case 'sortNumber': this.iconName = 'SortNumericDown'; break; case 'exportToExcel': this.iconName = 'FileExcel'; break; case 'importFromExcel': this.iconName = 'FileExcel'; break; case 'goPreviousRow': this.iconName = 'ArrowAltCircleUpPro'; break; case 'toggleSelect': this.iconName = 'CheckSquare'; break; case 'goNextRow': this.iconName = 'ArrowAltCircleDownPro'; break; case 'insertRowTop': this.iconName = 'InsertRowTop'; break; case 'insertRowBottom': this.iconName = 'InsertRowBottom'; break; case 'refresh': this.iconName = 'SyncAlt'; break; case 'drillDown': this.iconName = 'ArrowAltToBottom'; break; case 'contextMenu': this.iconName = 'Sitemap'; break; case 'removeRow': this.iconName = 'AlignSlash'; break; case 'previousPage': this.iconName = 'ChevronCircleRight'; break; case 'nextPage': this.iconName = 'ChevronCircleLeft'; break; case 'next': this.iconName = 'StepForward'; break; case 'back': this.iconName = 'StepBackward'; break; case 'nextSameLevel': this.iconName = 'FastForward'; break; case 'backSameLevel': this.iconName = 'FastBackward'; break; case 'function': this.iconName = 'Function'; break; case 'sum': this.iconName = 'Sigma'; break; case 'up2Down': this.iconName = 'Share'; break; case 'send': this.iconName = 'PaperPlaneTop'; break; case 'acceptForm': this.iconName = 'FileSignaturePro'; break; case 'declineForm': this.iconName = 'FileSlashPro'; break; case 'cleanForm': this.iconName = 'Eraser'; break; case 'reply': this.iconName = 'Reply'; break; case 'forward': this.iconName = 'Share'; break; case 'attach': this.iconName = 'PaperClipVertical'; break; case 'BOMPro': this.iconName = 'ConveyorBeltAltPro'; break; case 'BOMThin': this.iconName = 'ConveyorBeltThin'; break; case 'lock': this.iconName = 'Lock'; break; case 'unLock': this.iconName = 'UnLock'; break; case 'shop': this.iconName = 'BagsShopping'; break; case 'productOrder': this.iconName = 'TransformerBolt'; break; case 'sale': this.iconName = 'BasketShopping'; break; case 'product': this.iconName = 'PuzzlePieceSimple'; break; case 'purchaseOrder': this.iconName = 'BagsShopping'; break; case 'purchase': this.iconName = 'FileInvoice'; break; case 'receipt': this.iconName = 'Forklift'; break; case 'remittance': this.iconName = 'BoxesStacked'; break; } } private setColorOfIcon(icon: IToolStripButtonIcon) { switch (icon) { case 'new': this.iconColor = '#ff922b'; break; case 'edit': this.iconColor = '#94d82d'; break; case 'delete': this.iconColor = '#f06595'; break; case 'cut': this.iconColor = '#721c24'; break; case 'copy': this.iconColor = '#004085'; break; case 'past': this.iconColor = '#155724'; break; case 'view': this.iconColor = undefined; break; case 'close': this.iconColor = '#c82333'; break; case 'open': this.iconColor = '#b50e4b'; break; case 'columns': this.iconColor = undefined; break; case 'ok': this.iconColor = undefined; break; case 'home': this.iconColor = '#001c40'; break; case 'save': this.iconColor = '#7691febf'; break; case 'print': this.iconColor = '#f06595'; break; case 'printCrystal': this.iconColor = undefined; break; case 'sortNumber': this.iconColor = '#15aabf'; break; case 'exportToExcel': this.iconColor = '#199819'; break; case 'importFromExcel': this.iconColor = '#001e96d9'; break; case 'toggleSelect': this.iconColor = undefined; break; case 'goPreviousRow': this.iconColor = '#001e96d9'; break; case 'goNextRow': this.iconColor = '#001e96d9'; break; case 'insertRowTop': this.iconColor = '#183153'; break; case 'insertRowBottom': this.iconColor = '#001c3d'; break; case 'refresh': this.iconColor = undefined; break; case 'drillDown': this.iconColor = '#fd7e14'; break; case 'contextMenu': this.iconColor = '#15aabf'; break; case 'removeRow': this.iconColor = '#e03131'; break; case 'previousPage': this.iconColor = '#7691febf'; break; case 'nextPage': this.iconColor = '#7691febf'; break; case 'next': this.iconColor = '#7691febf'; break; case 'back': this.iconColor = '#7691febf'; break; case 'nextSameLevel': this.iconColor = '#7691febf'; break; case 'backSameLevel': this.iconColor = '#7691febf'; break; case 'function': this.iconColor = '#15aabf'; break; case 'sum': this.iconColor = '#15aabf'; break; case 'up2Down': this.iconColor = '#15aabf'; break; case 'acceptForm': this.iconColor = '#199819'; break; case 'reply': this.iconColor = 'navy'; break; case 'forward': this.iconColor = 'green'; break; case 'cleanForm': this.iconColor = 'red'; break; case 'attach': this.iconColor = '#14A085'; break; case 'BOMPro': this.iconColor = '#3b8eff'; break; case 'BOMThin': this.iconColor = '#3B8F02'; break; case 'lock': this.iconColor = '#095709'; break; case 'unLock': this.iconColor = '#ff7c07'; break; case 'shop': this.iconColor = '#f06595'; break; case 'productOrder': this.iconColor = '#7691febf'; break; case 'sale': this.iconColor = '#fd7e14'; break; case 'product': this.iconColor = '#199819'; break; case 'purchaseOrder': this.iconColor = '#f06595'; break; case 'purchase': this.iconColor = '#fd7e14'; break; case 'receipt': this.iconColor = '#e03131'; break; case 'remittance': this.iconColor = '#7691febf'; break; } } }