UNPKG

ferngully-aurelia-tools

Version:

Ferngully Tools for Aurelia

101 lines 5.01 kB
System.register(["aurelia-framework", "aurelia-i18n"], 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, aurelia_i18n_1, Tooltip; return { setters: [ function (aurelia_framework_1_1) { aurelia_framework_1 = aurelia_framework_1_1; }, function (aurelia_i18n_1_1) { aurelia_i18n_1 = aurelia_i18n_1_1; } ], execute: function () { Tooltip = (function () { function Tooltip(element, i18n) { this.element = element; this.i18n = i18n; } Tooltip.prototype.bind = function () { this.title = this.i18n.tr(this.title); if (this.enable) { this.configureTooltip(); } }; Tooltip.prototype.titleChanged = function (newValue, oldValue) { this.title = newValue; }; Tooltip.prototype.enableChanged = function (newValue, oldValue) { if (newValue) { this.configureTooltip(); } else { $(this.element) .tooltip("destroy"); } }; Tooltip.prototype.configureTooltip = function () { var _this = this; $(this.element) .tooltip({ title: function () { return _this.title; }, placement: this.placement, trigger: this.trigger, container: this.container, animation: this.animation, html: this.html }); if (!this.clickHandler) { this.clickHandler = $(this.element).on("click", function () { $(_this.element).tooltip("hide"); }); } }; __decorate([ aurelia_framework_1.bindable({ primaryProperty: true }), __metadata("design:type", String) ], Tooltip.prototype, "title", void 0); __decorate([ aurelia_framework_1.bindable({ defaultValue: "top" }), __metadata("design:type", String) ], Tooltip.prototype, "placement", void 0); __decorate([ aurelia_framework_1.bindable({ defaultValue: "body" }), __metadata("design:type", Object) ], Tooltip.prototype, "container", void 0); __decorate([ aurelia_framework_1.bindable({ defaultValue: "hover" }), __metadata("design:type", String) ], Tooltip.prototype, "trigger", void 0); __decorate([ aurelia_framework_1.bindable({ defaultValue: false }), __metadata("design:type", Boolean) ], Tooltip.prototype, "html", void 0); __decorate([ aurelia_framework_1.bindable({ defaultValue: true }), __metadata("design:type", Boolean) ], Tooltip.prototype, "enable", void 0); __decorate([ aurelia_framework_1.bindable({ defaultValue: true }), __metadata("design:type", Boolean) ], Tooltip.prototype, "animation", void 0); Tooltip = __decorate([ aurelia_framework_1.customAttribute('tooltip'), aurelia_framework_1.inject(Element, aurelia_i18n_1.I18N), __metadata("design:paramtypes", [HTMLElement, aurelia_i18n_1.I18N]) ], Tooltip); return Tooltip; }()); exports_1("Tooltip", Tooltip); } }; }); //# sourceMappingURL=tooltip.js.map