UNPKG

ferngully-aurelia-tools

Version:

Ferngully Tools for Aurelia

63 lines 2.77 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 } from "aurelia-framework"; import { EditableInputElementService } from "../editable-input-element-service"; import "./editable-inline-input.css"; let EditableInlineInput = class EditableInlineInput { constructor(editableInputElementService) { this.editableInputElementService = editableInputElementService; this.classEx = null; } bind() { this.editableInputElementService.editor = $(this.textbox); if (this.classEx) { this.editableInputElementService.editor.addClass(this.classEx); } } show(element, data, currentValue, onKeyPress, onSave) { this.editableInputElementService._show(element); this.editableInputElementService.value = currentValue; let textbox = $(this.textbox); textbox.focus(); textbox.select(); textbox.on("keydown.editable-inline-input", onKeyPress); textbox.on("blur.editable-inline-input", onSave); } hide() { this.editableInputElementService._hide(); let textbox = $(this.textbox); textbox.off("keydown.editable-inline-input"); textbox.off("blur.editable-inline-input"); } get value() { return this.editableInputElementService.value; } get maxLength() { return this.editableInputElementService.maxLength; } detached() { this.editableInputElementService.detached(); } attached() { this.editableInputElementService.attached(); } }; __decorate([ bindable, __metadata("design:type", Object) ], EditableInlineInput.prototype, "classEx", void 0); EditableInlineInput = __decorate([ containerless, autoinject, customElement('editable-inline-input'), __metadata("design:paramtypes", [EditableInputElementService]) ], EditableInlineInput); export { EditableInlineInput }; //# sourceMappingURL=editable-inline-input.js.map