aurelia-kendoui-bridge
Version:
A set of Telerik KendoUI wrappers for Aurelia allowing developers to easily use KendoUI components in their Aurelia application.
67 lines (48 loc) • 2.17 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Draggable = undefined;
var _dec, _dec2, _dec3, _class;
var _aureliaDependencyInjection = require('aurelia-dependency-injection');
var _aureliaTemplating = require('aurelia-templating');
var _widgetBase = require('../common/widget-base');
var _decorators = require('../common/decorators');
var _constants = require('../common/constants');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Draggable = exports.Draggable = (_dec = (0, _aureliaTemplating.customAttribute)(_constants.constants.attributePrefix + 'draggable'), _dec2 = (0, _decorators.generateBindables)('kendoDraggable'), _dec3 = (0, _aureliaDependencyInjection.inject)(Element, _widgetBase.WidgetBase), _dec(_class = _dec2(_class = _dec3(_class = function () {
function Draggable(element, widgetBase) {
var _this = this;
_classCallCheck(this, Draggable);
this.element = element;
this.widgetBase = widgetBase.control('kendoDraggable').useElement(this.element).beforeInitialize(function (options) {
return _this.beforeInitialize(options);
}).linkViewModel(this);
}
Draggable.prototype.subscribe = function subscribe(event, callback) {
return this.widgetBase.subscribe(event, callback);
};
Draggable.prototype.bind = function bind(ctx, overrideCtx) {
this.widgetBase.useParentCtx(overrideCtx);
};
Draggable.prototype.attached = function attached() {
if (!this.kNoInit) {
this.recreate();
}
};
Draggable.prototype.recreate = function recreate() {
this.kWidget = this.widgetBase.recreate();
};
Draggable.prototype.beforeInitialize = function beforeInitialize(options) {
if (options.container) {
Object.assign(options, { container: kendo.jQuery(options.container) });
}
};
Draggable.prototype.destroy = function destroy() {
this.widgetBase.destroy(this.kWidget);
};
Draggable.prototype.detached = function detached() {
this.destroy();
};
return Draggable;
}()) || _class) || _class) || _class);