@web-atoms/core
Version:
78 lines (77 loc) • 3.75 kB
JavaScript
System.register(["tslib", "../../App", "../../di/Inject", "../../di/RegisterSingleton", "../../services/BusyIndicatorService", "../../services/NavigationService", "../controls/AtomControl", "../styles/StyleBuilder"], function (_export, _context) {
"use strict";
var __decorate, __metadata, App, Inject, RegisterSingleton, BusyIndicatorService, NavigationService, AtomControl, cssNumberToString, WebBusyIndicatorService;
return {
setters: [function (_tslib) {
__decorate = _tslib.__decorate;
__metadata = _tslib.__metadata;
}, function (_App) {
App = _App.App;
}, function (_diInject) {
Inject = _diInject.Inject;
}, function (_diRegisterSingleton) {
RegisterSingleton = _diRegisterSingleton.RegisterSingleton;
}, function (_servicesBusyIndicatorService) {
BusyIndicatorService = _servicesBusyIndicatorService.BusyIndicatorService;
}, function (_servicesNavigationService) {
NavigationService = _servicesNavigationService.NavigationService;
}, function (_controlsAtomControl) {
AtomControl = _controlsAtomControl.AtomControl;
}, function (_stylesStyleBuilder) {
cssNumberToString = _stylesStyleBuilder.cssNumberToString;
}],
execute: function () {
_export("WebBusyIndicatorService", WebBusyIndicatorService = class WebBusyIndicatorService extends BusyIndicatorService {
constructor() {
super(...arguments);
this.zIndex = 50000;
this.indicators = 0;
}
createIndicator() {
const host = document.createElement("div");
const popup = new AtomControl(this.app, host);
host.className = "indicator-host";
const span = document.createElement("i");
const divStyle = host.style;
divStyle.position = "absolute";
divStyle.overflow = "hidden";
divStyle.left = divStyle.right = divStyle.bottom = divStyle.top = "0";
divStyle.zIndex = this.zIndex++ + "";
const spanStyle = span.style;
spanStyle.position = "absolute";
spanStyle.margin = "auto";
spanStyle.width = "16px";
spanStyle.height = "16px";
spanStyle.overflow = "hidden";
spanStyle.maxHeight = "100%";
spanStyle.maxWidth = "100%";
spanStyle.left = spanStyle.right = spanStyle.bottom = spanStyle.top = "0";
span.className = "fas fa-spinner fa-spin";
host.appendChild(span);
const ws = this.navigationService;
const e = ws.getHostForElement();
if (e) {
e.appendChild(host);
} else {
document.body.appendChild(host);
ws.refreshScreen();
popup.bind(host, "styleLeft", [["this", "scrollLeft"]], false, cssNumberToString, ws.screen);
popup.bind(host, "styleTop", [["this", "scrollTop"]], false, cssNumberToString, ws.screen);
popup.bind(host, "styleWidth", [["this", "width"]], false, cssNumberToString, ws.screen);
popup.bind(host, "styleHeight", [["this", "height"]], false, cssNumberToString, ws.screen);
}
popup.registerDisposable({
dispose: () => {
host.remove();
}
});
return popup;
}
});
__decorate([Inject, __metadata("design:type", NavigationService)], WebBusyIndicatorService.prototype, "navigationService", void 0);
__decorate([Inject, __metadata("design:type", App)], WebBusyIndicatorService.prototype, "app", void 0);
_export("WebBusyIndicatorService", WebBusyIndicatorService = __decorate([RegisterSingleton], WebBusyIndicatorService));
}
};
});
//# sourceMappingURL=WebBusyIndicatorService.js.map