UNPKG

aurelia-kendoui-bridge

Version:

A set of Telerik KendoUI wrappers for Aurelia allowing developers to easily use KendoUI components in their Aurelia application.

55 lines (45 loc) 1.38 kB
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}date-input`) @generateBindables('kendoDateInput') @inject(Element, WidgetBase) export class DateInput { @bindable kEnabled; @bindable kReadOnly; constructor(element, widgetBase) { this.element = element; this.widgetBase = widgetBase .control('kendoDateInput') .useElement(this.element) .linkViewModel(this) .bindToKendo('kEnabled', 'enable') .bindToKendo('kReadOnly', 'readonly') .useValueBinding(); } 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(); } }