ferngully-aurelia-tools
Version:
Ferngully Tools for Aurelia
110 lines • 6.66 kB
JavaScript
System.register(["aurelia-framework", "../editable-input-element-service", "./editable-inline-dropdown-checkbox.css", "../dropdown-checkbox/dropdown-checkbox"], function (exports_1, context_1) {
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __moduleName = context_1 && context_1.id;
var aurelia_framework_1, editable_input_element_service_1, dropdown_checkbox_1, EditableInlineDropdownCheckbox;
return {
setters: [
function (aurelia_framework_1_1) {
aurelia_framework_1 = aurelia_framework_1_1;
},
function (editable_input_element_service_1_1) {
editable_input_element_service_1 = editable_input_element_service_1_1;
},
function (_1) {
},
function (dropdown_checkbox_1_1) {
dropdown_checkbox_1 = dropdown_checkbox_1_1;
}
],
execute: function () {
EditableInlineDropdownCheckbox = (function () {
function EditableInlineDropdownCheckbox(editableInputElementService) {
this.editableInputElementService = editableInputElementService;
this.valueType = "number";
}
EditableInlineDropdownCheckbox_1 = EditableInlineDropdownCheckbox;
Object.defineProperty(EditableInlineDropdownCheckbox.prototype, "selectedItemsStringSeparator", {
get: function () { return EditableInlineDropdownCheckbox_1.SelectedItemsStringSeparator; },
enumerable: true,
configurable: true
});
Object.defineProperty(EditableInlineDropdownCheckbox.prototype, "value", {
get: function () {
return this.items.filter(function (item) { return item.selected; }).map(function (item) { return item.value; });
},
set: function (values) {
for (var _i = 0, _a = this.items; _i < _a.length; _i++) {
var item = _a[_i];
item.selected = values.indexOf(item.value) !== -1;
}
},
enumerable: true,
configurable: true
});
EditableInlineDropdownCheckbox.prototype.bind = function () {
this.editableInputElementService.editor = $(this.dropdown);
};
EditableInlineDropdownCheckbox.prototype.onDropdownHide = function (viewmodel) {
this.onSave();
};
EditableInlineDropdownCheckbox.prototype.onKeydown = function (event, viewmodel) {
return this.onKeyPress(event);
};
EditableInlineDropdownCheckbox.computeSelectedItemsString = function (items, selectedItems) {
return dropdown_checkbox_1.DropdownCheckbox.computeSelectedItemsString(items, selectedItems, EditableInlineDropdownCheckbox_1.SelectedItemsStringSeparator);
};
EditableInlineDropdownCheckbox.prototype.show = function (element, data, currentValues, onKeyPress, onSave) {
var _this = this;
this.items = data || [];
this.value = currentValues;
this.originalSelectedItemsString = EditableInlineDropdownCheckbox_1.computeSelectedItemsString(this.items, this.value);
this.editableInputElementService._show(element);
this.onSave = onSave;
this.onKeyPress = onKeyPress;
setTimeout(function () { return _this.dropdown_vm.showDropdown(); }, 0);
};
EditableInlineDropdownCheckbox.prototype.hide = function () {
this.dropdown_vm.closeDropdown();
this.editableInputElementService._hide();
};
Object.defineProperty(EditableInlineDropdownCheckbox.prototype, "maxLength", {
get: function () {
return this.editableInputElementService.maxLength;
},
enumerable: true,
configurable: true
});
EditableInlineDropdownCheckbox.prototype.detached = function () {
this.editableInputElementService.detached();
};
EditableInlineDropdownCheckbox.prototype.attached = function () {
this.editableInputElementService.attached();
};
EditableInlineDropdownCheckbox.SelectedItemsStringSeparator = ", ";
__decorate([
aurelia_framework_1.bindable({ defaultBindingMode: aurelia_framework_1.bindingMode.oneTime }),
__metadata("design:type", String)
], EditableInlineDropdownCheckbox.prototype, "valueType", void 0);
EditableInlineDropdownCheckbox = EditableInlineDropdownCheckbox_1 = __decorate([
aurelia_framework_1.containerless,
aurelia_framework_1.autoinject,
aurelia_framework_1.customElement('editable-inline-dropdown-checkbox'),
__metadata("design:paramtypes", [editable_input_element_service_1.EditableInputElementService])
], EditableInlineDropdownCheckbox);
return EditableInlineDropdownCheckbox;
var EditableInlineDropdownCheckbox_1;
}());
exports_1("EditableInlineDropdownCheckbox", EditableInlineDropdownCheckbox);
}
};
});
//# sourceMappingURL=editable-inline-dropdown-checkbox.js.map