UNPKG

ferngully-aurelia-tools

Version:

Ferngully Tools for Aurelia

92 lines 4.87 kB
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); }; import { customElement, bindable, autoinject, containerless, bindingMode } from "aurelia-framework"; import { EditableInputElementService } from "../editable-input-element-service"; import "./editable-inline-dropdown-checkbox.css"; import { DropdownCheckbox } from "../dropdown-checkbox/dropdown-checkbox"; var 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 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([ bindable({ defaultBindingMode: bindingMode.oneTime }), __metadata("design:type", String) ], EditableInlineDropdownCheckbox.prototype, "valueType", void 0); EditableInlineDropdownCheckbox = EditableInlineDropdownCheckbox_1 = __decorate([ containerless, autoinject, customElement('editable-inline-dropdown-checkbox'), __metadata("design:paramtypes", [EditableInputElementService]) ], EditableInlineDropdownCheckbox); return EditableInlineDropdownCheckbox; var EditableInlineDropdownCheckbox_1; }()); export { EditableInlineDropdownCheckbox }; //# sourceMappingURL=editable-inline-dropdown-checkbox.js.map