zek 14.2.74 → 14.2.76

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.
package/fesm2020/zek.mjs CHANGED
@@ -1630,25 +1630,10 @@ class HttpErrorHandler {
1630
1630
  else {
1631
1631
  error = response.error;
1632
1632
  }
1633
- let data;
1634
1633
  if (error instanceof ErrorEvent) {
1635
- data = {
1636
- errors: [
1637
- { '': [response.error.message] }
1638
- ]
1639
- };
1640
- }
1641
- if (typeof error === 'string') {
1642
- data = {
1643
- errors: [
1644
- { '': [response.error] }
1645
- ]
1646
- };
1647
- }
1648
- else if (typeof error === 'object') {
1649
- data = error;
1634
+ error = response.error.message;
1650
1635
  }
1651
- return ObjectHelper.isDefined(data) ? of(data) : of(result);
1636
+ return ObjectHelper.isDefined(error) ? of(error) : of(result);
1652
1637
  };
1653
1638
  }
1654
1639
  showError(serviceName, operation, response) {
@@ -1944,15 +1929,18 @@ class BaseComponent extends CoreComponent {
1944
1929
  getParam(name) {
1945
1930
  return this.route.snapshot.paramMap.get(name);
1946
1931
  }
1932
+ getQueryParam(name) {
1933
+ return this.route.snapshot.queryParamMap.get(name);
1934
+ }
1947
1935
  navigateReturnUrl() {
1948
- const returnUrl = this.route.snapshot.paramMap.get('returnUrl');
1936
+ const returnUrl = this.getQueryParam('returnUrl') || this.getParam('returnUrl');
1949
1937
  if (returnUrl) {
1950
1938
  let urlTree = this.router.parseUrl(returnUrl);
1951
1939
  const urlWithoutParams = urlTree.root.children[PRIMARY_OUTLET].segments.map(it => it.path).join('/');
1952
1940
  this.router.navigate([urlWithoutParams, urlTree.root.children[PRIMARY_OUTLET].segments[urlTree.root.children[PRIMARY_OUTLET].segments.length - 1].parameters]);
1953
1941
  return;
1954
1942
  }
1955
- this.router.navigate([this.router.url.substr(0, this.router.url.lastIndexOf('/'))]);
1943
+ this.router.navigate([this.router.url.substring(0, this.router.url.lastIndexOf('/'))]);
1956
1944
  }
1957
1945
  cancel() {
1958
1946
  this.navigateReturnUrl();
@@ -2211,10 +2199,10 @@ class EditFormComponent extends BaseComponent {
2211
2199
  // @ViewChild('submitModal', { static: false }) protected readonly submitModal?: ModalComponent;
2212
2200
  init() {
2213
2201
  super.init();
2214
- const idParam = this.getParam('id');
2202
+ const idParam = this.getParam('id') || this.getQueryParam('id');
2215
2203
  if (idParam)
2216
2204
  this.id = +idParam;
2217
- const id2Param = this.getParam('id2');
2205
+ const id2Param = this.getParam('id2') || this.getQueryParam('id2');
2218
2206
  if (id2Param)
2219
2207
  this.id2 = +id2Param;
2220
2208
  }
@@ -2241,18 +2229,9 @@ class EditFormComponent extends BaseComponent {
2241
2229
  }
2242
2230
  return false;
2243
2231
  }
2244
- // saveAndNavigateToReturnUrl(f: NgForm) {
2245
- // if (!f || f.valid) {
2246
- // this.internalSave(true);
2247
- // }
2248
- // }
2249
2232
  internalSave(navigateToReturnUrl) {
2250
2233
  throw 'Not implemented internalSave';
2251
2234
  }
2252
- // protected navigateEditUrl() {
2253
- // if (this.getAction().toLowerCase() === 'create')
2254
- // this.router.navigate([this.router.url.substr(0, this.router.url.lastIndexOf('/') + 1), this.id]);
2255
- // }
2256
2235
  showApproveModal() {
2257
2236
  this.approveModel = {};
2258
2237
  if (this.approveModal) {
@@ -2311,14 +2290,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
2311
2290
  args: ['disapproveModal', { static: false }]
2312
2291
  }] } });
2313
2292
  class EditBaseComponent extends EditFormComponent {
2314
- constructor(service, translateService, alertService, route, router) {
2293
+ constructor(service, translate, alert, route, router) {
2315
2294
  super(route, router);
2316
2295
  this.service = service;
2317
- this.translateService = translateService;
2318
- this.alertService = alertService;
2296
+ this.translate = translate;
2297
+ this.alert = alert;
2319
2298
  }
2320
2299
  async internalSave(navigateToReturnUrl) {
2321
- this.alertService.clear();
2300
+ this.alert.clear();
2322
2301
  let data = await firstValueFrom(this.service.save(this.model));
2323
2302
  let success = false;
2324
2303
  if (typeof data === 'number' && data > 0) {
@@ -2329,8 +2308,8 @@ class EditBaseComponent extends EditFormComponent {
2329
2308
  success = true;
2330
2309
  }
2331
2310
  if (success) {
2332
- let message = await firstValueFrom(this.translateService.get('Alert.SaveSuccess'));
2333
- this.alertService.success(message, null, 'fas fa-save');
2311
+ let message = await firstValueFrom(this.translate.get('Alert.SaveSuccess'));
2312
+ this.alert.success(message, null, 'fas fa-save');
2334
2313
  if (navigateToReturnUrl === true) {
2335
2314
  this.navigateReturnUrl();
2336
2315
  }
@@ -2342,47 +2321,47 @@ class EditBaseComponent extends EditFormComponent {
2342
2321
  // }
2343
2322
  }
2344
2323
  else {
2345
- let message = await firstValueFrom(this.translateService.get('Alert.SaveError'));
2346
- this.alertService.error(message, null, 'fas fa-save');
2324
+ let message = await firstValueFrom(this.translate.get('Alert.SaveError'));
2325
+ this.alert.error(message, null, 'fas fa-save');
2347
2326
  return false;
2348
2327
  }
2349
2328
  }
2350
2329
  async internalApprove(model) {
2351
2330
  let data = await firstValueFrom(this.service.approve(model));
2352
2331
  if (data && data.length > 0) {
2353
- let message = await firstValueFrom(this.translateService.get('Alert.Approved'));
2354
- this.alertService.success(message, null, 'fas fa-save');
2332
+ let message = await firstValueFrom(this.translate.get('Alert.Approved'));
2333
+ this.alert.success(message, null, 'fas fa-save');
2355
2334
  return true;
2356
2335
  }
2357
2336
  else {
2358
- let message = await firstValueFrom(this.translateService.get('Alert.ApproveError'));
2359
- this.alertService.error(message, null, 'fas fa-save');
2337
+ let message = await firstValueFrom(this.translate.get('Alert.ApproveError'));
2338
+ this.alert.error(message, null, 'fas fa-save');
2360
2339
  return false;
2361
2340
  }
2362
2341
  }
2363
2342
  async internalDisapprove(model) {
2364
2343
  let data = await firstValueFrom(this.service.disapprove(model));
2365
2344
  if (data && data.length > 0) {
2366
- let message = await firstValueFrom(this.translateService.get('Alert.Disapproved'));
2367
- this.alertService.success(message, null, 'fas fa-save');
2345
+ let message = await firstValueFrom(this.translate.get('Alert.Disapproved'));
2346
+ this.alert.success(message, null, 'fas fa-save');
2368
2347
  return true;
2369
2348
  }
2370
2349
  else {
2371
- let message = await firstValueFrom(this.translateService.get('Alert.DisapproveError'));
2372
- this.alertService.error(message, null, 'fas fa-save');
2350
+ let message = await firstValueFrom(this.translate.get('Alert.DisapproveError'));
2351
+ this.alert.error(message, null, 'fas fa-save');
2373
2352
  return false;
2374
2353
  }
2375
2354
  }
2376
2355
  async internalSubmit(model) {
2377
2356
  let data = await firstValueFrom(this.service.approve(model));
2378
2357
  if (data && data.length > 0) {
2379
- let message = await firstValueFrom(this.translateService.get('Alert.Submitted'));
2380
- this.alertService.success(message, null, 'fas fa-save');
2358
+ let message = await firstValueFrom(this.translate.get('Alert.Submitted'));
2359
+ this.alert.success(message, null, 'fas fa-save');
2381
2360
  return true;
2382
2361
  }
2383
2362
  else {
2384
- let message = await firstValueFrom(this.translateService.get('Alert.SubmitError'));
2385
- this.alertService.error(message, null, 'fas fa-save');
2363
+ let message = await firstValueFrom(this.translate.get('Alert.SubmitError'));
2364
+ this.alert.error(message, null, 'fas fa-save');
2386
2365
  return false;
2387
2366
  }
2388
2367
  }
@@ -2401,8 +2380,8 @@ class EditBaseComponent extends EditFormComponent {
2401
2380
  async restore() {
2402
2381
  let data = await firstValueFrom(this.service.restore(this.id));
2403
2382
  if (data?.success) {
2404
- let message = await firstValueFrom(this.translateService.get('Alert.Restored'));
2405
- this.alertService.success(message);
2383
+ let message = await firstValueFrom(this.translate.get('Alert.Restored'));
2384
+ this.alert.success(message);
2406
2385
  this.load();
2407
2386
  }
2408
2387
  }
@@ -2418,8 +2397,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
2418
2397
  type: Directive
2419
2398
  }], ctorParameters: function () { return [{ type: undefined }, { type: i1$1.TranslateService }, { type: AlertService }, { type: i1.ActivatedRoute }, { type: i1.Router }]; } });
2420
2399
  class EditComponent extends EditBaseComponent {
2421
- constructor(ctorModel, service, translateService, alertService, route, router) {
2422
- super(service, translateService, alertService, route, router);
2400
+ constructor(ctorModel, service, translate, alert, route, router) {
2401
+ super(service, translate, alert, route, router);
2423
2402
  this.ctorModel = ctorModel;
2424
2403
  }
2425
2404
  initCreate() {
@@ -2434,11 +2413,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
2434
2413
 
2435
2414
  // declare let bootstrap: any;
2436
2415
  class ListBaseComponent extends BaseComponent {
2437
- constructor(service, translateService, alertService, route, router) {
2416
+ constructor(service, translate, alert, route, router) {
2438
2417
  super(route, router);
2439
2418
  this.service = service;
2440
- this.translateService = translateService;
2441
- this.alertService = alertService;
2419
+ this.translate = translate;
2420
+ this.alert = alert;
2442
2421
  this.filter = new FilterBase();
2443
2422
  this.saveFilter = true;
2444
2423
  this.internalFilter = new FilterBase();
@@ -2468,7 +2447,7 @@ class ListBaseComponent extends BaseComponent {
2468
2447
  initDefaultFilter() {
2469
2448
  }
2470
2449
  initStoredFilter() {
2471
- let filterParam = this.getParam('filter');
2450
+ let filterParam = this.getQueryParam('filter') || this.getParam('filter');
2472
2451
  if (filterParam) {
2473
2452
  const tmp = StorageHelper.get('filter');
2474
2453
  if (tmp && tmp.url && tmp.url === this.url && tmp.filter) {
@@ -2526,31 +2505,36 @@ class ListBaseComponent extends BaseComponent {
2526
2505
  }
2527
2506
  create() {
2528
2507
  const url = UrlHelper.getNoParam(this.router.url);
2529
- this.router.navigate([url, 'create', { returnUrl: url + ';filter=1' }]);
2508
+ // this.router.navigate([url, 'create', { returnUrl: url + ';filter=1' }]);
2509
+ this.router.navigate([url, 'create'], { queryParams: { returnUrl: url + '?filter=1' } });
2530
2510
  }
2531
2511
  async delete(id) {
2532
- this.alertService.clear();
2512
+ this.alert.clear();
2533
2513
  let data = await firstValueFrom(this.service.delete(id));
2534
2514
  if (data?.success) {
2535
- let message = await firstValueFrom(this.translateService.get('Alert.Deleted'));
2536
- this.alertService.error(message, null, 'fas fa-trash');
2515
+ let message = await firstValueFrom(this.translate.get('Alert.Deleted'));
2516
+ this.alert.error(message, null, 'fas fa-trash');
2537
2517
  this.refresh();
2538
2518
  }
2539
2519
  }
2540
2520
  async delete2(id, id2) {
2541
- this.alertService.clear();
2521
+ this.alert.clear();
2542
2522
  let data = await firstValueFrom(this.service.delete2(id, id2));
2543
2523
  if (data?.success) {
2544
- let message = await firstValueFrom(this.translateService.get('Alert.Deleted'));
2545
- this.alertService.error(message, null, 'fas fa-trash');
2524
+ let message = await firstValueFrom(this.translate.get('Alert.Deleted'));
2525
+ this.alert.error(message, null, 'fas fa-trash');
2546
2526
  this.refresh();
2547
2527
  }
2548
2528
  }
2549
2529
  edit(id) {
2550
- this.router.navigate([this.url, id, { returnUrl: this.url + ';filter=1' }]);
2530
+ // this.router.navigate([this.url, id],
2531
+ // { queryParams: { returnUrl: this.url + ';filter=1' } }
2532
+ // );
2533
+ this.router.navigate([this.url, id], { queryParams: { returnUrl: this.url + '?filter=1' } });
2551
2534
  }
2552
2535
  edit2(id, id2) {
2553
- this.router.navigate([this.url, id, id2, { returnUrl: this.url + ';filter=1' }]);
2536
+ // this.router.navigate([this.url, id, id2, { returnUrl: this.url + ';filter=1' }]);
2537
+ this.router.navigate([this.url, id, id2], { queryParams: { returnUrl: this.url + '?filter=1' } });
2554
2538
  }
2555
2539
  select(item) {
2556
2540
  item.selected = !item.selected;
@@ -2581,12 +2565,12 @@ class ListBaseComponent extends BaseComponent {
2581
2565
  async approve(m) {
2582
2566
  if (!m)
2583
2567
  return;
2584
- this.alertService.clear();
2568
+ this.alert.clear();
2585
2569
  let data = await firstValueFrom(this.service.approve(m));
2586
2570
  if (!data || data.length === 0)
2587
2571
  return;
2588
- let message = await firstValueFrom(this.translateService.get('Alert.Approved'));
2589
- this.alertService.success(message, undefined, 'fas fa-thumbs-up');
2572
+ let message = await firstValueFrom(this.translate.get('Alert.Approved'));
2573
+ this.alert.success(message, undefined, 'fas fa-thumbs-up');
2590
2574
  this.refresh();
2591
2575
  }
2592
2576
  showDisapproveModal(id) {
@@ -2611,12 +2595,12 @@ class ListBaseComponent extends BaseComponent {
2611
2595
  if (!m.comment)
2612
2596
  delete m.comment;
2613
2597
  }
2614
- this.alertService.clear();
2598
+ this.alert.clear();
2615
2599
  let data = await firstValueFrom(this.service.disapprove(m));
2616
2600
  if (!data || data.length === 0)
2617
2601
  return;
2618
- let message = await firstValueFrom(this.translateService.get('Alert.Disapproved'));
2619
- this.alertService.success(message, undefined, 'fas fa-thumbs-down');
2602
+ let message = await firstValueFrom(this.translate.get('Alert.Disapproved'));
2603
+ this.alert.success(message, undefined, 'fas fa-thumbs-down');
2620
2604
  this.refresh();
2621
2605
  }
2622
2606
  getSelectedIds() {
@@ -2638,8 +2622,8 @@ class ListBaseComponent extends BaseComponent {
2638
2622
  this.showSum();
2639
2623
  }
2640
2624
  else {
2641
- let message = await firstValueFrom(this.translateService.get('Alert.SumError'));
2642
- this.alertService.error(message);
2625
+ let message = await firstValueFrom(this.translate.get('Alert.SumError'));
2626
+ this.alert.error(message);
2643
2627
  }
2644
2628
  }
2645
2629
  export(fileTypeId) {
@@ -2710,6 +2694,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
2710
2694
  class AlertComponent {
2711
2695
  constructor() {
2712
2696
  this._type = AlertType.Info;
2697
+ this._showClose = true;
2713
2698
  this.cssAlert = '';
2714
2699
  this.cssIcon = '';
2715
2700
  }
@@ -2734,12 +2719,18 @@ class AlertComponent {
2734
2719
  }
2735
2720
  }
2736
2721
  }
2722
+ get showClose() {
2723
+ return this._showClose;
2724
+ }
2725
+ set showClose(v) {
2726
+ this._showClose = Convert.toBoolean(v);
2727
+ }
2737
2728
  }
2738
2729
  AlertComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: AlertComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2739
- AlertComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: AlertComponent, selector: "zek-alert", inputs: { type: "type", title: "title" }, ngImport: i0, template: "<div class=\"alert {{cssAlert}} alert-dismissible fade show\" role=\"alert\">\r\n <button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"alert\" aria-label=\"Close\"></button>\r\n <div class=\"row\">\r\n <div class=\"col-auto pe-1\" *ngIf=\"cssIcon\">\r\n <span class=\"flex-shrink-0\"><i class=\"{{cssIcon}}\"></i></span>\r\n </div>\r\n <div class=\"col-auto\">\r\n <div *ngIf=\"title\">\r\n <h5 class=\"alert-heading\">{{title}}</h5>\r\n </div>\r\n <ng-content></ng-content>\r\n </div>\r\n </div>\r\n</div>", styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: i1$3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
2730
+ AlertComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: AlertComponent, selector: "zek-alert", inputs: { type: "type", title: "title" }, ngImport: i0, template: "<div class=\"alert {{cssAlert}} alert-dismissible fade show\" role=\"alert\">\r\n <button *ngIf=\"_showClose\" type=\"button\" class=\"btn-close\" data-bs-dismiss=\"alert\" aria-label=\"Close\"></button>\r\n <div class=\"row\">\r\n <div class=\"col-auto pe-1\" *ngIf=\"cssIcon\">\r\n <span class=\"flex-shrink-0\"><i class=\"{{cssIcon}}\"></i></span>\r\n </div>\r\n <div class=\"col-auto\">\r\n <div *ngIf=\"title\">\r\n <h5 class=\"alert-heading\">{{title}}</h5>\r\n </div>\r\n <ng-content></ng-content>\r\n </div>\r\n </div>\r\n</div>", styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: i1$3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
2740
2731
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: AlertComponent, decorators: [{
2741
2732
  type: Component,
2742
- args: [{ selector: 'zek-alert', template: "<div class=\"alert {{cssAlert}} alert-dismissible fade show\" role=\"alert\">\r\n <button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"alert\" aria-label=\"Close\"></button>\r\n <div class=\"row\">\r\n <div class=\"col-auto pe-1\" *ngIf=\"cssIcon\">\r\n <span class=\"flex-shrink-0\"><i class=\"{{cssIcon}}\"></i></span>\r\n </div>\r\n <div class=\"col-auto\">\r\n <div *ngIf=\"title\">\r\n <h5 class=\"alert-heading\">{{title}}</h5>\r\n </div>\r\n <ng-content></ng-content>\r\n </div>\r\n </div>\r\n</div>", styles: [":host{display:block}\n"] }]
2733
+ args: [{ selector: 'zek-alert', template: "<div class=\"alert {{cssAlert}} alert-dismissible fade show\" role=\"alert\">\r\n <button *ngIf=\"_showClose\" type=\"button\" class=\"btn-close\" data-bs-dismiss=\"alert\" aria-label=\"Close\"></button>\r\n <div class=\"row\">\r\n <div class=\"col-auto pe-1\" *ngIf=\"cssIcon\">\r\n <span class=\"flex-shrink-0\"><i class=\"{{cssIcon}}\"></i></span>\r\n </div>\r\n <div class=\"col-auto\">\r\n <div *ngIf=\"title\">\r\n <h5 class=\"alert-heading\">{{title}}</h5>\r\n </div>\r\n <ng-content></ng-content>\r\n </div>\r\n </div>\r\n</div>", styles: [":host{display:block}\n"] }]
2743
2734
  }], propDecorators: { type: [{
2744
2735
  type: Input
2745
2736
  }], title: [{
@@ -4584,7 +4575,8 @@ class ListToolbarComponent {
4584
4575
  }
4585
4576
  create() {
4586
4577
  const url = UrlHelper.getNoParam(this.router.url);
4587
- this.router.navigate([url, 'create', { returnUrl: url + ';filter=1' }]);
4578
+ // this.router.navigate([url, 'create', { returnUrl: url + ';filter=1' }]);
4579
+ this.router.navigate([url, 'create'], { queryParams: { returnUrl: url + '?filter=1' } });
4588
4580
  }
4589
4581
  filter() {
4590
4582
  this.onFilter.emit();