xenos
Version:
Xenos is a data grid built upon angular2 and bootstrap.
70 lines • 3.21 kB
JavaScript
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 core_1 = require("@angular/core");
var i18n_service_1 = require("./i18n.service");
var PopoverDirective = (function () {
function PopoverDirective(i18nService, elementRef) {
this.i18nService = i18nService;
this.elementRef = elementRef;
if (!PopoverDirective.initialized) {
PopoverDirective.initialize();
}
}
PopoverDirective.initialize = function () {
$("body").on("click", function (e) {
$("[xn-linked]").each(function () {
if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $(".popover").has(e.target).length === 0) {
$(this).popover("hide");
}
});
});
PopoverDirective.initialized = true;
};
Object.defineProperty(PopoverDirective.prototype, "xnPopover", {
set: function (config) {
var _this = this;
$(config.close).on("click", function (x) {
$(_this.elementRef.nativeElement).popover("hide");
});
$(this.elementRef.nativeElement).popover({
html: true,
placement: "bottom",
trigger: "manual",
title: this.i18nService.requestTranslation("xn.options.title"),
content: function (x) { return $(config.content); }
}).on("click", function (e) {
$(_this.elementRef.nativeElement).popover("show");
}).on("show.bs.popover", function (e) {
$(config.content).css("display", "block");
config.column.reset();
}).on("shown.bs.popover", function (e) {
$(config.input).focus();
});
},
enumerable: true,
configurable: true
});
PopoverDirective.initialized = false;
__decorate([
core_1.Input(),
__metadata('design:type', Object),
__metadata('design:paramtypes', [Object])
], PopoverDirective.prototype, "xnPopover", null);
PopoverDirective = __decorate([
core_1.Directive({
selector: "[xnPopover]"
}),
__metadata('design:paramtypes', [i18n_service_1.I18nService, core_1.ElementRef])
], PopoverDirective);
return PopoverDirective;
}());
exports.PopoverDirective = PopoverDirective;
//# sourceMappingURL=popover.directive.js.map
;