-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(daterangepicker): added daterangepicker wrapper
- Loading branch information
1 parent
70601ab
commit 28f8c43
Showing
4 changed files
with
77 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import {inject} from 'aurelia-dependency-injection'; | ||
import {customAttribute, bindable} from 'aurelia-templating'; | ||
import {WidgetBase} from '../common/widget-base'; | ||
import {generateBindables} from '../common/decorators'; | ||
import {constants} from '../common/constants'; | ||
|
||
@customAttribute(`${constants.attributePrefix}daterangepicker`) | ||
@generateBindables('kendoDateRangePicker') | ||
@inject(Element, WidgetBase) | ||
export class DateRangePicker { | ||
@bindable kEnabled; | ||
@bindable kReadOnly; | ||
@bindable({defaultBindingMode: 2}) kRange; | ||
|
||
constructor(element, widgetBase) { | ||
this.element = element; | ||
this.widgetBase = widgetBase | ||
.control('kendoDateRangePicker') | ||
.useElement(this.element) | ||
.linkViewModel(this) | ||
.useValueBinding('kRange', 'range') | ||
.bindToKendo('kEnabled', 'enable') | ||
.bindToKendo('kReadOnly', 'readonly'); | ||
} | ||
|
||
subscribe(event, callback) { | ||
return this.widgetBase.subscribe(event, callback); | ||
} | ||
|
||
bind(ctx, overrideCtx) { | ||
this.widgetBase.useParentCtx(overrideCtx); | ||
} | ||
|
||
attached() { | ||
if (!this.kNoInit) { | ||
this.recreate(); | ||
} | ||
} | ||
|
||
recreate() { | ||
this.kWidget = this.widgetBase.recreate(); | ||
} | ||
|
||
propertyChanged(property, newValue, oldValue) { | ||
this.widgetBase.handlePropertyChanged(this.kWidget, property, newValue, oldValue); | ||
} | ||
|
||
destroy() { | ||
this.widgetBase.destroy(this.kWidget); | ||
} | ||
|
||
detached() { | ||
this.destroy(); | ||
} | ||
} |