diff --git a/components/datepicker/daypicker.component.ts b/components/datepicker/daypicker.component.ts index 59b47ee309..d8fbf6888e 100644 --- a/components/datepicker/daypicker.component.ts +++ b/components/datepicker/daypicker.component.ts @@ -6,40 +6,10 @@ import { DatePickerInnerComponent } from './datepicker-inner.component'; // write an interface for template options const TEMPLATE_OPTIONS:any = { [Ng2BootstrapTheme.BS4]: { - DAY_TITLE: ` - {{labelz.abbr}} - `, - WEEK_ROW: ` - {{ weekNumbers[index] }} - - - - `, ARROW_LEFT: '<', ARROW_RIGHT: '>' }, [Ng2BootstrapTheme.BS3]: { - DAY_TITLE: ` - {{labelz.abbr}} - `, - WEEK_ROW: ` - {{ weekNumbers[index] }} - - - - `, ARROW_LEFT: ` `, @@ -49,8 +19,6 @@ const TEMPLATE_OPTIONS:any = { } }; -const CURRENT_THEME_TEMPLATE:any = TEMPLATE_OPTIONS[Ng2BootstrapConfig.theme || Ng2BootstrapTheme.BS3]; - @Component({ selector: 'daypicker', template: ` @@ -58,8 +26,11 @@ const CURRENT_THEME_TEMPLATE:any = TEMPLATE_OPTIONS[Ng2BootstrapConfig.theme || - @@ -72,20 +43,36 @@ const CURRENT_THEME_TEMPLATE:any = TEMPLATE_OPTIONS[Ng2BootstrapConfig.theme || - - ${CURRENT_THEME_TEMPLATE.DAY_TITLE} + + {{labelz.abbr}} + @@ -99,11 +86,16 @@ export class DayPickerComponent implements OnInit { public rows:Array = []; public weekNumbers:Array = []; public datePicker:DatePickerInnerComponent; + public CURRENT_THEME_TEMPLATE:any = TEMPLATE_OPTIONS[Ng2BootstrapConfig.theme || Ng2BootstrapTheme.BS3]; public constructor(datePicker:DatePickerInnerComponent) { this.datePicker = datePicker; } + public get isBS4():boolean { + return Ng2BootstrapConfig.theme === Ng2BootstrapTheme.BS4; + } + /*private getDaysInMonth(year:number, month:number) { return ((month === 1) && (year % 4 === 0) && ((year % 100 !== 0) || (year % 400 === 0))) ? 29 : DAYS_IN_MONTH[month]; diff --git a/components/datepicker/monthpicker.component.ts b/components/datepicker/monthpicker.component.ts index 0b8b612a1f..a6fbb500f5 100644 --- a/components/datepicker/monthpicker.component.ts +++ b/components/datepicker/monthpicker.component.ts @@ -1,30 +1,8 @@ import { Component, OnInit } from '@angular/core'; -import { Ng2BootstrapConfig } from '../ng2-bootstrap-config'; +import { Ng2BootstrapConfig, Ng2BootstrapTheme } from '../ng2-bootstrap-config'; import { DatePickerInnerComponent } from './datepicker-inner.component'; -// write an interface for template options -const TEMPLATE_OPTIONS:any = { - bs4: { - MONTH_BUTTON: ` - - ` - }, - bs3: { - MONTH_BUTTON: ` - - ` - } -}; - -const CURRENT_THEME_TEMPLATE:any = TEMPLATE_OPTIONS[Ng2BootstrapConfig.theme] || TEMPLATE_OPTIONS.bs3; - @Component({ selector: 'monthpicker', template: ` @@ -56,7 +34,12 @@ const CURRENT_THEME_TEMPLATE:any = TEMPLATE_OPTIONS[Ng2BootstrapConfig.theme] || - ${CURRENT_THEME_TEMPLATE.MONTH_BUTTON} + @@ -72,6 +55,10 @@ export class MonthPickerComponent implements OnInit { this.datePicker = datePicker; } + public get isBS4():boolean { + return Ng2BootstrapConfig.theme === Ng2BootstrapTheme.BS4; + } + public ngOnInit():void { let self = this; diff --git a/components/datepicker/yearpicker.component.ts b/components/datepicker/yearpicker.component.ts index fab330bebb..c7303ffb3d 100644 --- a/components/datepicker/yearpicker.component.ts +++ b/components/datepicker/yearpicker.component.ts @@ -1,34 +1,8 @@ import { Component, OnInit } from '@angular/core'; -import { Ng2BootstrapConfig } from '../ng2-bootstrap-config'; +import { Ng2BootstrapConfig, Ng2BootstrapTheme } from '../ng2-bootstrap-config'; import { DatePickerInnerComponent } from './datepicker-inner.component'; -// write an interface for template options -const TEMPLATE_OPTIONS:any = { - bs4: { - YEAR_BUTTON: ` - - ` - }, - bs3: { - YEAR_BUTTON: ` - - ` - } -}; - -const CURRENT_THEME_TEMPLATE:any = TEMPLATE_OPTIONS[Ng2BootstrapConfig.theme] || TEMPLATE_OPTIONS.bs3; - @Component({ selector: 'yearpicker', template: ` @@ -61,7 +35,12 @@ const CURRENT_THEME_TEMPLATE:any = TEMPLATE_OPTIONS[Ng2BootstrapConfig.theme] || - ${CURRENT_THEME_TEMPLATE.YEAR_BUTTON} + @@ -77,6 +56,10 @@ export class YearPickerComponent implements OnInit { this.datePicker = datePicker; } + public get isBS4():boolean { + return Ng2BootstrapConfig.theme === Ng2BootstrapTheme.BS4; + } + public ngOnInit():void { let self = this; diff --git a/components/modal/modal-backdrop.component.ts b/components/modal/modal-backdrop.component.ts index 505ffa5a2f..9f326fdcc8 100644 --- a/components/modal/modal-backdrop.component.ts +++ b/components/modal/modal-backdrop.component.ts @@ -13,7 +13,7 @@ export class ModalBackdropOptions { @Component({ selector: 'bs-modal-backdrop', template: '', - host: {'class': `${ClassName.BACKDROP}`} + host: {'class': ClassName.BACKDROP} }) export class ModalBackdropComponent { public get isAnimated():boolean { diff --git a/components/typeahead/typeahead-container.component.ts b/components/typeahead/typeahead-container.component.ts index 3dacf862d9..db1dc05ef7 100644 --- a/components/typeahead/typeahead-container.component.ts +++ b/components/typeahead/typeahead-container.component.ts @@ -6,36 +6,36 @@ import { TypeaheadOptions } from './typeahead-options.class'; import { TypeaheadUtils } from './typeahead-utils'; import { TypeaheadDirective } from './typeahead.directive'; -const TEMPLATE:any = { - [Ng2BootstrapTheme.BS4]: ` +const bs4 = ` - `, - [Ng2BootstrapTheme.BS3]: ` +`; + +const bs3 = ` - ` -}; +`; +let isBS4 = Ng2BootstrapConfig.theme === Ng2BootstrapTheme.BS4; + @Component({ selector: 'typeahead-container', - template: TEMPLATE[Ng2BootstrapConfig.theme], + template: isBS4 ? bs4 : bs3, encapsulation: ViewEncapsulation.None }) export class TypeaheadContainerComponent {