adb-shared 1.0.16 → 1.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@ngx-translate/core'), require('rxjs'), require('@angular/common/http'), require('@angular/router')) :
3
3
  typeof define === 'function' && define.amd ? define('adb-shared', ['exports', '@angular/common', '@angular/core', '@ngx-translate/core', 'rxjs', '@angular/common/http', '@angular/router'], factory) :
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["adb-shared"] = {}, global.ng.common, global.ng.core, global.i3, global.rxjs, global.ng.common.http, global.ng.router));
5
- })(this, (function (exports, i4, i0, i3, rxjs, i1, router) { 'use strict';
5
+ })(this, (function (exports, i4, i0, i3, rxjs, i1, i1$1) { 'use strict';
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -26,6 +26,7 @@
26
26
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
27
27
  var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
28
28
  var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
29
+ var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
29
30
 
30
31
  var EnvironmentService = /** @class */ (function () {
31
32
  function EnvironmentService(environment) {
@@ -132,7 +133,7 @@
132
133
  return ADBHeaderComponent;
133
134
  }());
134
135
  /** @nocollapse */ ADBHeaderComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: ADBHeaderComponent, deps: [{ token: i1__namespace.HttpClient }, { token: EnvironmentService }, { token: i3__namespace.TranslateService }], target: i0__namespace.ɵɵFactoryTarget.Component });
135
- /** @nocollapse */ ADBHeaderComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: ADBHeaderComponent, selector: "adb-header2", inputs: { userName: "userName" }, outputs: { loginClicked: "loginClicked", logoutClicked: "logoutClicked", dropMenuChange: "dropMenuChange" }, ngImport: i0__namespace, template: "<header id=\"top-header\" (clickOutside)=\"showUserMenu=false;showMenuDropdown(false);\">\r\n <nav class=\"d-flex flex-wrap px-3\">\r\n <div class=\"flex-grow-1 d-flex align-items-center justify-content-between justify-content-md-start\">\r\n <div class=\"logo d-none d-md-block\">\r\n <img src=\"/assets/images/logo.svg\" style=\"height: 3.2rem;\">\r\n </div>\r\n <div class=\"logo ps-2 d-sm-block d-md-none d-flex align-items-center\">\r\n <img src=\"/assets/images/logo_sm_white.png\" style=\"height: 2rem;\">\r\n </div>\r\n <strong class=\"bigger\">Artfakta</strong>\r\n </div>\r\n <div *ngIf=\"translationFinished\" class=\"flex-grow-1 d-flex justify-content-lg-between justify-content-end align-items-center\">\r\n <div *ngIf=\"navigation\" class=\"d-flex align-items-center\">\r\n <nav class=\"d-none align-items-center d-lg-flex pe-4 gap-4\" *ngIf=\"navigation\">\r\n <ng-container *ngFor=\"let link of navigation.links\">\r\n <a href=\"{{link.url}}?lang={{trans.currentLang}}\" *ngIf=\"link.topLink\" [ngClass]=\"{'d-none d-xl-block':link.transId==='ADB_HEADER.OBSERVATION'}\">\r\n {{link.transId|translate}}\r\n </a>\r\n </ng-container>\r\n </nav>\r\n <div>\r\n <button type=\"button\" class=\"btn btn-sm py-1 px-2 btn-primary\" (click)=\"showUserMenu = false;showMenuDropdown(!showMenu)\">\r\n {{'ADB_HEADER.MENY'|translate}}\r\n <i class=\"ms-1 fas\" [ngClass]=\"showMenu?'fa-chevron-up':'fa-chevron-down'\"></i>\r\n </button>\r\n </div>\r\n </div>\r\n <div class=\"d-none d-md-block ps-4\">\r\n <button *ngIf=\"initials\" type=\"button\" class=\"btn initials\" (click)=\"showUserMenu = !showUserMenu;showMenuDropdown(false)\">{{initials}}</button>\r\n <button *ngIf=\"!initials\" type=\"button\" (click)=\"showUserMenu = !showUserMenu;showMenuDropdown(false)\" class=\"btn btn-link\">\r\n {{'ADB_HEADER.LOGIN'|translate}}\r\n </button>\r\n </div>\r\n </div>\r\n </nav>\r\n <div class=\"menu\" *ngIf=\"showUserMenu\">\r\n <div class=\"menu-body bg-white p-3\" style=\"width:15rem\">\r\n <ng-container *ngIf=\"initials\">\r\n <div class=\"d-flex align-items-center gap-2 text-dark\">\r\n <span class=\"initials\">{{initials}}</span>\r\n <strong>{{fullName}}</strong>\r\n </div>\r\n <hr class=\"mx-n3 text-muted\">\r\n <button (click)=\"logout()\" type=\"button\" class=\"btn btn-link p-0\">\r\n <i class=\"fas fa-sign-out-alt me-1\"></i>{{'ADB_HEADER.LOGOUT'|translate}}\r\n </button>\r\n </ng-container>\r\n <ng-container *ngIf=\"!initials\">\r\n <div class=\"d-flex justify-content-center\">\r\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"login()\" id=\"start-login\">{{'ADB_HEADER.LOGIN'|translate}}</button>\r\n </div>\r\n <a *ngIf=\"navigation\" class=\"d-block mt-3\" href=\"{{navigation.createAccountLink}}?lang={{trans.currentLang}}&returnUrl={{url}}\">\r\n {{'ADB_HEADER.CREATE_USER'|translate}}\r\n </a>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <div class=\"menu\" *ngIf=\"showMenu\">\r\n <div class=\"menu-body\" *ngIf=\"navigation\">\r\n <div class=\"px-3 pt-3 mb-1\">\r\n <div class=\"d-flex justify-content-between flex-wrap gap-2 mb-2\">\r\n <div>\r\n <div class=\"d-flex d-md-none align-items-center gap-2\" *ngIf=\"initials\">\r\n <span class=\"initials me-2\">{{initials}}</span>\r\n <button type=\"button\" (click)=\"logout()\" class=\"btn btn-primary\">\r\n {{'ADB_HEADER.LOGOUT'|translate}}\r\n </button>\r\n </div>\r\n <div class=\"d-flex gap-2 d-md-none\" *ngIf=\"!initials\">\r\n <button type=\"button\" (click)=\"login()\" class=\"btn btn-primary\" id=\"login\">\r\n {{'ADB_HEADER.LOGIN'|translate}}\r\n </button>\r\n <a href=\"{{navigation.createAccountLink}}?lang={{trans.currentLang}}&returnUrl={{url}}\"\r\n class=\"btn btn-primary text-white\">\r\n {{'ADB_HEADER.CREATE_USER'|translate}}\r\n </a>\r\n </div>\r\n </div>\r\n <div>\r\n <button type=\"button\" *ngIf=\"trans.currentLang==='en'\" (click)=\"setLanguage('sv')\"\r\n class=\"btn btn-primary\">\r\n {{'ADB_HEADER.IN_SWEDISH'|translate}}\r\n </button>\r\n <button type=\"button\" *ngIf=\"trans.currentLang==='sv'\" (click)=\"setLanguage('en')\"\r\n class=\"btn btn-primary\">\r\n {{'ADB_HEADER.IN_ENGLISH'|translate}}\r\n </button>\r\n </div>\r\n </div>\r\n {{'ADB_HEADER.SERVICES'|translate}}\r\n </div>\r\n <div id=\"splash\">\r\n <div class=\"px-3 d-flex flex-column\">\r\n <ul class=\"list-group ms-0 mb-0 ps-0\">\r\n <li class=\"mb-1 list-group-item p-0 rounded\" *ngFor=\"let link of navigation.links\"\r\n [attr.aria-expanded]=\"link.transId===expandedLink?true:false\" role=\"button\">\r\n <div class=\"d-flex align-items-center justify-content-between\">\r\n <a href=\"{{link.url}}?lang={{trans.currentLang}}\" class=\"d-flex align-items-center flex-grow-1 p-2\">\r\n <small class=\"fa-stack me-1\" *ngIf=\"link.icon\">\r\n <span class=\"fas fa-circle fa-stack-2x text-primary\"></span>\r\n <span class=\"fas fa-stack-1x fa-inverse\" [ngClass]=\"link.icon\"></span>\r\n </small>\r\n {{link.transId|translate}}\r\n </a>\r\n <button class=\"btn btn-expand me-2\" *ngIf=\"link.children?.length>0\" (click)=\"onExpandLink($event,link.transId)\">\r\n <i class=\"fas fa-chevron-up\" [ngClass]=\"link.transId===expandedLink?'d-block ':'d-none'\"></i>\r\n <i class=\"fas fa-chevron-down\" [ngClass]=\"link.transId!==expandedLink?'d-block ':'d-none'\"></i>\r\n </button>\r\n </div>\r\n <ul class=\"list-unstyled\" [ngClass]=\"link.transId===expandedLink?'d-block':'d-none'\">\r\n <li class=\"py-1 m-0\" [class.pt-0]=\"first\" *ngFor=\"let subLink of link.children;let first = first\" style=\"padding-left:3rem;\">\r\n <a class=\"w-100 d-block\" href=\"{{subLink.url}}?lang={{trans.currentLang}}\">\r\n {{subLink.transId|translate}}\r\n </a>\r\n </li>\r\n </ul>\r\n </li>\r\n </ul>\r\n <div *ngIf=\"navigation.about\" class=\"mt-2 mb-auto\">\r\n <div class=\"mb-1\">{{'ADB_HEADER.CONTACT'|translate}}</div>\r\n <div class=\"mb-1 row\">\r\n <div class=\"col-sm-6 mb-2\">\r\n <div class=\"bg-white p-2 rounded\">\r\n <small class=\"fa-stack\" *ngIf=\"navigation.about.icon\">\r\n <span class=\"fas fa-circle fa-stack-2x text-primary\"></span>\r\n <span class=\"fas fa-stack-1x fa-inverse fa-envelope\"></span>\r\n </small>\r\n <a class=\"bg-white p-2\" href=\"mailto:artfakta@artdatabanken.se\">artfakta@artdatabanken.se</a>\r\n </div>\r\n </div>\r\n <div class=\"col-sm-6 mb-2\">\r\n <div class=\"bg-white p-2 rounded\">\r\n <small class=\"fa-stack\" *ngIf=\"navigation.about.icon\">\r\n <span class=\"fas fa-circle fa-stack-2x text-primary\"></span>\r\n <span class=\"fas fa-stack-1x fa-inverse\" [ngClass]=\"navigation.about.icon\"></span>\r\n </small>\r\n <a [href]=\"navigation.about.url\">{{navigation.about.transId|translate}}</a>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div style=\"height:10rem\"></div>\r\n <div class=\"mb-3\">\r\n {{'ADB_HEADER.DEVELOPED_BY'|translate}}\r\n <a href=\"https://www.artdatabanken.se/\" class=\"text-white\"><u>{{'ADB_HEADER.ARTDATABANKEN'|translate}}</u></a>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</header>\r\n", directives: [{ type: i4__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "translate": i3__namespace.TranslatePipe } });
136
+ /** @nocollapse */ ADBHeaderComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: ADBHeaderComponent, selector: "adb-header2", inputs: { userName: "userName" }, outputs: { loginClicked: "loginClicked", logoutClicked: "logoutClicked", dropMenuChange: "dropMenuChange" }, ngImport: i0__namespace, template: "<header id=\"top-header\" (clickOutside)=\"showUserMenu=false;showMenuDropdown(false);\">\r\n <nav class=\"d-flex flex-wrap px-3\">\r\n <div class=\"flex-grow-1 d-flex align-items-center justify-content-between justify-content-md-start\">\r\n <div class=\"logo d-none d-md-block\">\r\n <img src=\"/assets/images/logo.svg\" style=\"height: 3.2rem;\">\r\n </div>\r\n <div class=\"logo ps-2 d-sm-block d-md-none d-flex align-items-center\">\r\n <img src=\"/assets/images/logo_sm_white.png\" style=\"height: 2rem;\">\r\n </div>\r\n <strong class=\"bigger\">{{'ADB_HEADER.TITLE'|translate}}</strong>\r\n </div>\r\n <div *ngIf=\"translationFinished\" class=\"flex-grow-1 d-flex justify-content-lg-between justify-content-end align-items-center\">\r\n <div *ngIf=\"navigation\" class=\"d-flex align-items-center\">\r\n <nav class=\"d-none align-items-center d-lg-flex pe-4 gap-4\" *ngIf=\"navigation\">\r\n <ng-container *ngFor=\"let link of navigation.links\">\r\n <a href=\"{{link.url}}?lang={{trans.currentLang}}\" *ngIf=\"link.topLink\" [ngClass]=\"{'d-none d-xl-block':link.transId==='ADB_HEADER.OBSERVATION'}\">\r\n {{link.transId|translate}}\r\n </a>\r\n </ng-container>\r\n </nav>\r\n <div>\r\n <button type=\"button\" class=\"btn btn-sm py-1 px-2 btn-primary\" (click)=\"showUserMenu = false;showMenuDropdown(!showMenu)\">\r\n {{'ADB_HEADER.MENY'|translate}}\r\n <i class=\"ms-1 fas\" [ngClass]=\"showMenu?'fa-chevron-up':'fa-chevron-down'\"></i>\r\n </button>\r\n </div>\r\n </div>\r\n <div class=\"d-none d-md-block ps-4\">\r\n <button *ngIf=\"initials\" type=\"button\" class=\"btn initials\" (click)=\"showUserMenu = !showUserMenu;showMenuDropdown(false)\">{{initials}}</button>\r\n <button *ngIf=\"!initials\" type=\"button\" (click)=\"showUserMenu = !showUserMenu;showMenuDropdown(false)\" class=\"btn btn-link\">\r\n {{'ADB_HEADER.LOGIN'|translate}}\r\n </button>\r\n </div>\r\n </div>\r\n </nav>\r\n <div class=\"menu\" *ngIf=\"showUserMenu\">\r\n <div class=\"menu-body bg-white p-3\" style=\"width:15rem\">\r\n <ng-container *ngIf=\"initials\">\r\n <div class=\"d-flex align-items-center gap-2 text-dark\">\r\n <span class=\"initials\">{{initials}}</span>\r\n <strong>{{fullName}}</strong>\r\n </div>\r\n <hr class=\"mx-n3 text-muted\">\r\n <button (click)=\"logout()\" type=\"button\" class=\"btn btn-link p-0\">\r\n <i class=\"fas fa-sign-out-alt me-1\"></i>{{'ADB_HEADER.LOGOUT'|translate}}\r\n </button>\r\n </ng-container>\r\n <ng-container *ngIf=\"!initials\">\r\n <div class=\"d-flex justify-content-center\">\r\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"login()\" id=\"start-login\">{{'ADB_HEADER.LOGIN'|translate}}</button>\r\n </div>\r\n <a *ngIf=\"navigation\" class=\"d-block mt-3\" href=\"{{navigation.createAccountLink}}?lang={{trans.currentLang}}&returnUrl={{url}}\">\r\n {{'ADB_HEADER.CREATE_USER'|translate}}\r\n </a>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <div class=\"menu\" *ngIf=\"showMenu\">\r\n <div class=\"menu-body\" *ngIf=\"navigation\">\r\n <div class=\"px-3 pt-3 mb-1\">\r\n <div class=\"d-flex justify-content-between flex-wrap gap-2 mb-2\">\r\n <div>\r\n <div class=\"d-flex d-md-none align-items-center gap-2\" *ngIf=\"initials\">\r\n <span class=\"initials me-2\">{{initials}}</span>\r\n <button type=\"button\" (click)=\"logout()\" class=\"btn btn-primary\">\r\n {{'ADB_HEADER.LOGOUT'|translate}}\r\n </button>\r\n </div>\r\n <div class=\"d-flex gap-2 d-md-none\" *ngIf=\"!initials\">\r\n <button type=\"button\" (click)=\"login()\" class=\"btn btn-primary\" id=\"login\">\r\n {{'ADB_HEADER.LOGIN'|translate}}\r\n </button>\r\n <a href=\"{{navigation.createAccountLink}}?lang={{trans.currentLang}}&returnUrl={{url}}\"\r\n class=\"btn btn-primary text-white\">\r\n {{'ADB_HEADER.CREATE_USER'|translate}}\r\n </a>\r\n </div>\r\n </div>\r\n <div>\r\n <button type=\"button\" *ngIf=\"trans.currentLang==='en'\" (click)=\"setLanguage('sv')\"\r\n class=\"btn btn-primary\">\r\n {{'ADB_HEADER.IN_SWEDISH'|translate}}\r\n </button>\r\n <button type=\"button\" *ngIf=\"trans.currentLang==='sv'\" (click)=\"setLanguage('en')\"\r\n class=\"btn btn-primary\">\r\n {{'ADB_HEADER.IN_ENGLISH'|translate}}\r\n </button>\r\n </div>\r\n </div>\r\n {{'ADB_HEADER.SERVICES'|translate}}\r\n </div>\r\n <div id=\"splash\">\r\n <div class=\"px-3 d-flex flex-column\">\r\n <ul class=\"list-group ms-0 mb-0 ps-0\">\r\n <li class=\"mb-1 list-group-item p-0 rounded\" *ngFor=\"let link of navigation.links\"\r\n [attr.aria-expanded]=\"link.transId===expandedLink?true:false\" role=\"button\">\r\n <div class=\"d-flex align-items-center justify-content-between\">\r\n <a href=\"{{link.url}}?lang={{trans.currentLang}}\" class=\"d-flex align-items-center flex-grow-1 p-2\">\r\n <small class=\"fa-stack me-1\" *ngIf=\"link.icon\">\r\n <span class=\"fas fa-circle fa-stack-2x text-primary\"></span>\r\n <span class=\"fas fa-stack-1x fa-inverse\" [ngClass]=\"link.icon\"></span>\r\n </small>\r\n {{link.transId|translate}}\r\n </a>\r\n <button class=\"btn btn-expand me-2\" *ngIf=\"link.children?.length>0\" (click)=\"onExpandLink($event,link.transId)\">\r\n <i class=\"fas fa-chevron-up\" [ngClass]=\"link.transId===expandedLink?'d-block ':'d-none'\"></i>\r\n <i class=\"fas fa-chevron-down\" [ngClass]=\"link.transId!==expandedLink?'d-block ':'d-none'\"></i>\r\n </button>\r\n </div>\r\n <ul class=\"list-unstyled\" [ngClass]=\"link.transId===expandedLink?'d-block':'d-none'\">\r\n <li class=\"py-1 m-0\" [class.pt-0]=\"first\" *ngFor=\"let subLink of link.children;let first = first\" style=\"padding-left:3rem;\">\r\n <a class=\"w-100 d-block\" href=\"{{subLink.url}}?lang={{trans.currentLang}}\">\r\n {{subLink.transId|translate}}\r\n </a>\r\n </li>\r\n </ul>\r\n </li>\r\n </ul>\r\n <div *ngIf=\"navigation.about\" class=\"mt-2 mb-auto\">\r\n <div class=\"mb-1\">{{'ADB_HEADER.CONTACT'|translate}}</div>\r\n <div class=\"mb-1 row\">\r\n <div class=\"col-sm-6 mb-2\">\r\n <div class=\"bg-white p-2 rounded\">\r\n <small class=\"fa-stack\" *ngIf=\"navigation.about.icon\">\r\n <span class=\"fas fa-circle fa-stack-2x text-primary\"></span>\r\n <span class=\"fas fa-stack-1x fa-inverse fa-envelope\"></span>\r\n </small>\r\n <a class=\"bg-white p-2\" href=\"mailto:artfakta@artdatabanken.se\">artfakta@artdatabanken.se</a>\r\n </div>\r\n </div>\r\n <div class=\"col-sm-6 mb-2\">\r\n <div class=\"bg-white p-2 rounded\">\r\n <small class=\"fa-stack\" *ngIf=\"navigation.about.icon\">\r\n <span class=\"fas fa-circle fa-stack-2x text-primary\"></span>\r\n <span class=\"fas fa-stack-1x fa-inverse\" [ngClass]=\"navigation.about.icon\"></span>\r\n </small>\r\n <a [href]=\"navigation.about.url\">{{navigation.about.transId|translate}}</a>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div style=\"height:10rem\"></div>\r\n <div class=\"mb-3\">\r\n {{'ADB_HEADER.DEVELOPED_BY'|translate}}\r\n <a href=\"https://www.artdatabanken.se/\" class=\"text-white\"><u>{{'ADB_HEADER.ARTDATABANKEN'|translate}}</u></a>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</header>\r\n", directives: [{ type: i4__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "translate": i3__namespace.TranslatePipe } });
136
137
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: ADBHeaderComponent, decorators: [{
137
138
  type: i0.Component,
138
139
  args: [{
@@ -213,13 +214,13 @@
213
214
  /** @nocollapse */ ADBHeaderModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: ADBHeaderModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
214
215
  /** @nocollapse */ ADBHeaderModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: ADBHeaderModule, declarations: [ADBHeaderComponent], imports: [i4.CommonModule,
215
216
  i1.HttpClientModule,
216
- router.RouterModule,
217
+ i1$1.RouterModule,
217
218
  i3.TranslateModule,
218
219
  DirectivesModule], exports: [ADBHeaderComponent] });
219
220
  /** @nocollapse */ ADBHeaderModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: ADBHeaderModule, imports: [[
220
221
  i4.CommonModule,
221
222
  i1.HttpClientModule,
222
- router.RouterModule,
223
+ i1$1.RouterModule,
223
224
  i3.TranslateModule,
224
225
  DirectivesModule
225
226
  ]] });
@@ -230,7 +231,7 @@
230
231
  imports: [
231
232
  i4.CommonModule,
232
233
  i1.HttpClientModule,
233
- router.RouterModule,
234
+ i1$1.RouterModule,
234
235
  i3.TranslateModule,
235
236
  DirectivesModule
236
237
  ],
@@ -238,6 +239,48 @@
238
239
  }]
239
240
  }] });
240
241
 
242
+ var InfiniteScrollComponent = /** @class */ (function () {
243
+ function InfiniteScrollComponent(_element) {
244
+ var _this = this;
245
+ this._element = _element;
246
+ this.onVisible = new i0.EventEmitter();
247
+ this.height = '1px';
248
+ this.checkForIntersection = function (entries) {
249
+ entries.forEach(function (entry) {
250
+ var isIntersecting = entry.isIntersecting &&
251
+ entry.target === _this._element.nativeElement;
252
+ if (isIntersecting) {
253
+ _this.onVisible.emit();
254
+ }
255
+ });
256
+ };
257
+ }
258
+ InfiniteScrollComponent.prototype.ngAfterViewInit = function () {
259
+ var _this = this;
260
+ this._intersectionObserver = new IntersectionObserver(function (entries) {
261
+ _this.checkForIntersection(entries);
262
+ }, {});
263
+ this._intersectionObserver.observe(this._element.nativeElement);
264
+ };
265
+ InfiniteScrollComponent.prototype.ngOnDestroy = function () {
266
+ if (this._intersectionObserver) {
267
+ this._intersectionObserver.disconnect();
268
+ }
269
+ };
270
+ return InfiniteScrollComponent;
271
+ }());
272
+ /** @nocollapse */ InfiniteScrollComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: InfiniteScrollComponent, deps: [{ token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
273
+ /** @nocollapse */ InfiniteScrollComponent.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.13", type: InfiniteScrollComponent, selector: "[onVisible]", outputs: { onVisible: "onVisible" }, host: { properties: { "style.height": "this.height" } }, ngImport: i0__namespace });
274
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: InfiniteScrollComponent, decorators: [{
275
+ type: i0.Directive,
276
+ args: [{ selector: "[onVisible]" }]
277
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; }, propDecorators: { onVisible: [{
278
+ type: i0.Output
279
+ }], height: [{
280
+ type: i0.HostBinding,
281
+ args: ['style.height']
282
+ }] } });
283
+
241
284
  /*! *****************************************************************************
242
285
  Copyright (c) Microsoft Corporation.
243
286
 
@@ -556,58 +599,77 @@
556
599
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
557
600
  }
558
601
 
559
- var InfiniteScrollComponent = /** @class */ (function () {
560
- function InfiniteScrollComponent(host) {
561
- this.host = host;
562
- this.options = {};
563
- this.scrolled = new i0.EventEmitter();
602
+ var PagerBaseDirective = /** @class */ (function () {
603
+ function PagerBaseDirective() {
604
+ this.limit = PagerBaseDirective.DEFAULT_LIMIT;
605
+ this.currentPage = 1;
564
606
  }
565
- Object.defineProperty(InfiniteScrollComponent.prototype, "element", {
566
- get: function () {
567
- return this.host.nativeElement;
568
- },
569
- enumerable: false,
570
- configurable: true
571
- });
572
- InfiniteScrollComponent.prototype.ngOnInit = function () {
573
- var _this = this;
574
- var options = Object.assign({ root: this.isHostScrollable() ? this.host.nativeElement : null }, this.options);
575
- this.observer = new IntersectionObserver(function (_b) {
576
- var _c = __read(_b, 1), entry = _c[0];
577
- // eslint-disable-next-line @typescript-eslint/no-unused-expressions
578
- entry.isIntersecting && _this.scrolled.emit();
579
- }, options);
580
- };
581
- InfiniteScrollComponent.prototype.ngAfterViewInit = function () {
582
- this.observer.observe(this.anchor.nativeElement);
607
+ PagerBaseDirective.prototype.calculatePages = function () {
608
+ this.amountOfPages = Math.ceil(this.totalCount / this.limit);
609
+ if ((this.currentPage + 1) > PagerBaseDirective.VISIBLE_PAGES) {
610
+ this.pages = [
611
+ this.currentPage - 2,
612
+ this.currentPage - 1, this.currentPage
613
+ ];
614
+ var above = this.amountOfPages - this.currentPage;
615
+ if (above >= 1) {
616
+ this.pages.push(this.currentPage + 1);
617
+ }
618
+ if (above >= 2) {
619
+ this.pages.push(this.currentPage + 2);
620
+ }
621
+ }
622
+ else if (this.totalCount) {
623
+ var max = this.amountOfPages > PagerBaseDirective.VISIBLE_PAGES ? 5 : this.amountOfPages;
624
+ this.pages = Array(Math.ceil(max)).fill(1).map(function (x, i) { return i + 1; });
625
+ }
583
626
  };
584
- InfiniteScrollComponent.prototype.isHostScrollable = function () {
585
- var style = window.getComputedStyle(this.element);
586
- return style.getPropertyValue('overflow') === 'auto' ||
587
- style.getPropertyValue('overflow-y') === 'scroll';
627
+ return PagerBaseDirective;
628
+ }());
629
+ PagerBaseDirective.DEFAULT_LIMIT = 10;
630
+ PagerBaseDirective.VISIBLE_PAGES = 5;
631
+ PagerBaseDirective.SKIP_RESOURCE = 'offset';
632
+ /** @nocollapse */ PagerBaseDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: PagerBaseDirective, deps: [], target: i0__namespace.ɵɵFactoryTarget.Directive });
633
+ /** @nocollapse */ PagerBaseDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.13", type: PagerBaseDirective, inputs: { totalCount: "totalCount", limit: "limit" }, ngImport: i0__namespace });
634
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: PagerBaseDirective, decorators: [{
635
+ type: i0.Directive
636
+ }], propDecorators: { totalCount: [{
637
+ type: i0.Input
638
+ }], limit: [{
639
+ type: i0.Input
640
+ }] } });
641
+
642
+ var PagerComponent = /** @class */ (function (_super) {
643
+ __extends(PagerComponent, _super);
644
+ function PagerComponent(activatedRoute) {
645
+ var _this = _super.call(this) || this;
646
+ _this.activatedRoute = activatedRoute;
647
+ _this.subscription = new rxjs.Subscription();
648
+ return _this;
649
+ }
650
+ PagerComponent.prototype.ngOnInit = function () {
651
+ var _this = this;
652
+ this.subscription.add(this.activatedRoute.queryParams.subscribe(function (params) {
653
+ if (params.offset) {
654
+ _this.currentPage = (+params.offset / _this.limit) + 1;
655
+ }
656
+ _this.calculatePages();
657
+ }));
588
658
  };
589
- InfiniteScrollComponent.prototype.ngOnDestroy = function () {
590
- var _a;
591
- (_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
659
+ PagerComponent.prototype.ngOnDestroy = function () {
660
+ this.subscription.unsubscribe();
592
661
  };
593
- return InfiniteScrollComponent;
594
- }());
595
- /** @nocollapse */ InfiniteScrollComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: InfiniteScrollComponent, deps: [{ token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
596
- /** @nocollapse */ InfiniteScrollComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: InfiniteScrollComponent, selector: "adb-infinite-scroll", inputs: { options: "options" }, outputs: { scrolled: "scrolled" }, viewQueries: [{ propertyName: "anchor", first: true, predicate: ["anchor"], descendants: true }], ngImport: i0__namespace, template: '<ng-content></ng-content><div #anchor></div>', isInline: true });
597
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: InfiniteScrollComponent, decorators: [{
662
+ return PagerComponent;
663
+ }(PagerBaseDirective));
664
+ /** @nocollapse */ PagerComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: PagerComponent, deps: [{ token: i1__namespace$1.ActivatedRoute }], target: i0__namespace.ɵɵFactoryTarget.Component });
665
+ /** @nocollapse */ PagerComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: PagerComponent, selector: "adb-pager-nav", usesInheritance: true, ngImport: i0__namespace, template: "<nav *ngIf=\"pages&&pages.length>1&&currentPage<=amountOfPages\" class=\"d-flex justify-content-end pe-2 my-1\">\r\n <ul class=\"pagination mb-0\">\r\n <li class=\"page-item\" [class.disabled]=\"currentPage===1\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"{ offset: 0}\" queryParamsHandling=\"merge\">\r\n <i class=\"fas fa-chevron-double-left\"></i>\r\n </a>\r\n </li>\r\n <li class=\"page-item\" [class.disabled]=\"currentPage===1\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"{ offset: (currentPage-2)*limit}\"\r\n queryParamsHandling=\"merge\">\r\n <i class=\"fas fa-chevron-left\"></i>\r\n </a>\r\n </li>\r\n <li class=\"page-item\" [class.active]=\"currentPage===page\" *ngFor=\"let page of pages\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"{ offset: (page-1)*limit}\"\r\n queryParamsHandling=\"merge\">{{page}}</a>\r\n </li>\r\n <li class=\"page-item\" [class.disabled]=\"currentPage>=amountOfPages\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"{ offset: currentPage*limit}\"\r\n queryParamsHandling=\"merge\">\r\n <i class=\"fas fa-chevron-right\"></i>\r\n </a>\r\n </li>\r\n <li *ngIf=\"(amountOfPages-1)*limit<10000\" class=\"page-item\" [class.disabled]=\"currentPage>=amountOfPages\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"{ offset: (amountOfPages-1)*limit}\"\r\n queryParamsHandling=\"merge\">\r\n <i class=\"fas fa-chevron-double-right\"></i>\r\n </a>\r\n </li>\r\n </ul>\r\n</nav>", directives: [{ type: i4__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1__namespace$1.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["routerLink", "target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo"] }, { type: i4__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
666
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: PagerComponent, decorators: [{
598
667
  type: i0.Component,
599
668
  args: [{
600
- selector: 'adb-infinite-scroll',
601
- template: '<ng-content></ng-content><div #anchor></div>'
669
+ selector: 'adb-pager-nav',
670
+ templateUrl: 'pager.html'
602
671
  }]
603
- }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; }, propDecorators: { options: [{
604
- type: i0.Input
605
- }], scrolled: [{
606
- type: i0.Output
607
- }], anchor: [{
608
- type: i0.ViewChild,
609
- args: ['anchor']
610
- }] } });
672
+ }], ctorParameters: function () { return [{ type: i1__namespace$1.ActivatedRoute }]; } });
611
673
 
612
674
  var PagersModule = /** @class */ (function () {
613
675
  function PagersModule() {
@@ -615,14 +677,21 @@
615
677
  return PagersModule;
616
678
  }());
617
679
  /** @nocollapse */ PagersModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: PagersModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
618
- /** @nocollapse */ PagersModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: PagersModule, declarations: [InfiniteScrollComponent], exports: [InfiniteScrollComponent] });
619
- /** @nocollapse */ PagersModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: PagersModule, imports: [[]] });
680
+ /** @nocollapse */ PagersModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: PagersModule, declarations: [InfiniteScrollComponent, PagerComponent], imports: [i4.CommonModule,
681
+ i1$1.RouterModule], exports: [InfiniteScrollComponent, PagerComponent] });
682
+ /** @nocollapse */ PagersModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: PagersModule, imports: [[
683
+ i4.CommonModule,
684
+ i1$1.RouterModule
685
+ ]] });
620
686
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: PagersModule, decorators: [{
621
687
  type: i0.NgModule,
622
688
  args: [{
623
- imports: [],
624
- declarations: [InfiniteScrollComponent],
625
- exports: [InfiniteScrollComponent],
689
+ imports: [
690
+ i4.CommonModule,
691
+ i1$1.RouterModule
692
+ ],
693
+ declarations: [InfiniteScrollComponent, PagerComponent],
694
+ exports: [InfiniteScrollComponent, PagerComponent]
626
695
  }]
627
696
  }] });
628
697
 
@@ -639,6 +708,7 @@
639
708
  exports.ClickOutsideDirective = ClickOutsideDirective;
640
709
  exports.DirectivesModule = DirectivesModule;
641
710
  exports.InfiniteScrollComponent = InfiniteScrollComponent;
711
+ exports.PagerComponent = PagerComponent;
642
712
  exports.PagersModule = PagersModule;
643
713
 
644
714
  Object.defineProperty(exports, '__esModule', { value: true });