import { CalendarOptionsRefined } from '../options' ; export class Theme { classes : any ; iconClasses : any ; rtlIconClasses : any ; baseIconClass : string ; iconOverrideOption : any ; iconOverrideCustomButtonOption : any ; iconOverridePrefix : string ; constructor ( calendarOptions ) { if ( this . iconOverrideOption ) { this . setIconOverride ( calendarOptions [ this . iconOverrideOption ] ) ; } } setIconOverride ( iconOverrideHash ) { let iconClassesCopy ; let buttonName ; if ( typeof iconOverrideHash === 'object' && iconOverrideHash ) { iconClassesCopy = { ... this . iconClasses } ; for ( buttonName in iconOverrideHash ) { iconClassesCopy [ buttonName ] = this . applyIconOverridePrefix ( iconOverrideHash [ buttonName ] ) ; } this . iconClasses = iconClassesCopy ; } else if ( iconOverrideHash === false ) { this . iconClasses = { } ; } } applyIconOverridePrefix ( className ) { let prefix = this . iconOverridePrefix ; if ( prefix && className . indexOf ( prefix ) !== 0 ) { className = prefix + className ; } return className ; } getClass ( key ) { return this . classes [ key ] || '' ; } getIconClass ( buttonName , isRtl ? ) { let className ; if ( isRtl && this . rtlIconClasses ) { className = this . rtlIconClasses [ buttonName ] || this . iconClasses [ buttonName ] ; } else { className = this . iconClasses [ buttonName ] ; } if ( className ) { return `${ this . baseIconClass } ${ className }` ; } return '' ; } getCustomButtonIconClass ( customButtonProps ) { let className ; if ( this . iconOverrideCustomButtonOption ) { className = customButtonProps [ this . iconOverrideCustomButtonOption ] ; if ( className ) { return `${ this . baseIconClass } ${ this . applyIconOverridePrefix ( className ) }` ; } } return '' ; } } Theme . prototype . classes = { } ; Theme . prototype . iconClasses = { } ; Theme . prototype . baseIconClass = '' ; Theme . prototype . iconOverridePrefix = '' ; export type ThemeClass = { new ( calendarOptions ) : Theme ; } ;