Skip to content

Commit

Permalink
fix: support closure-compiler in the library
Browse files Browse the repository at this point in the history
  • Loading branch information
marclaval authored and pkozlowski-opensource committed Jun 15, 2017
1 parent 4d1b396 commit 5cfd9e4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
14 changes: 10 additions & 4 deletions src/datepicker/datepicker-month-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ import {DayTemplateContext} from './datepicker-day-template-context';
[class.hidden]="isHidden(day)">
<ng-template [ngIf]="!isHidden(day)">
<ng-template [ngTemplateOutlet]="dayTemplate"
[ngOutletContext]="{date: {year: day.date.year, month: day.date.month, day: day.date.day},
currentMonth: month.number,
disabled: isDisabled(day),
selected: isSelected(day.date)}">
[ngOutletContext]="_getDayContext(day, month)">
</ng-template>
</ng-template>
</div>
Expand All @@ -66,6 +63,15 @@ export class NgbDatepickerMonthView {
}
}

_getDayContext(day: any, month: any) {
return {
date: {year: day.date.year, month: day.date.month, day: day.date.day},
currentMonth: month.number,
disabled: this.isDisabled(day),
selected: this.isSelected(day.date)
};
}

isDisabled(day: DayViewModel) { return this.disabled || day.disabled; }

isSelected(date: NgbDate) { return this.selectedDate && this.selectedDate.equals(date); }
Expand Down
4 changes: 3 additions & 1 deletion src/typeahead/typeahead-window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface ResultTemplateContext {
(mouseenter)="markActive(idx)"
(click)="select(result)">
<ng-template [ngTemplateOutlet]="resultTemplate || rt"
[ngOutletContext]="{result: result, term: term, formatter: formatter}"></ng-template>
[ngOutletContext]="_getResultContext(result)"></ng-template>
</button>
</ng-template>
`
Expand Down Expand Up @@ -79,6 +79,8 @@ export class NgbTypeaheadWindow implements OnInit {

@Output('activeChange') activeChangeEvent = new EventEmitter();

_getResultContext(result: any) { return {result: result, term: this.term, formatter: this.formatter}; }

getActive() { return this.results[this.activeIdx]; }

markActive(activeIdx: number) {
Expand Down
12 changes: 6 additions & 6 deletions src/util/positioning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ export class Positioning {
const placementSecondary = placement.split('-')[1] || 'center';

let targetElPosition: ClientRect = {
height: targetElBCR.height || targetElement.offsetHeight,
width: targetElBCR.width || targetElement.offsetWidth,
top: 0,
bottom: targetElBCR.height || targetElement.offsetHeight,
left: 0,
right: targetElBCR.width || targetElement.offsetWidth
'height': targetElBCR.height || targetElement.offsetHeight,
'width': targetElBCR.width || targetElement.offsetWidth,
'top': 0,
'bottom': targetElBCR.height || targetElement.offsetHeight,
'left': 0,
'right': targetElBCR.width || targetElement.offsetWidth
};

switch (placementPrimary) {
Expand Down
2 changes: 1 addition & 1 deletion src/util/triggers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class Trigger {
}

const DEFAULT_ALIASES = {
hover: ['mouseenter', 'mouseleave']
'hover': ['mouseenter', 'mouseleave']
};

export function parseTriggers(triggers: string, aliases = DEFAULT_ALIASES): Trigger[] {
Expand Down

0 comments on commit 5cfd9e4

Please sign in to comment.