@unipin/angular-applet 18.6.20 → 18.7.0

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.
@@ -4,7 +4,7 @@ import * as i1 from '@ionic/angular';
4
4
  import { IonButton, IonicModule } from '@ionic/angular';
5
5
  import * as i1$2 from '@angular/router';
6
6
  import { Router, RouterLink, RouterLinkActive, NavigationEnd } from '@angular/router';
7
- import { Subject, fromEvent, distinctUntilChanged, debounceTime, tap, switchMap, map, catchError, of, concat, filter, throwError } from 'rxjs';
7
+ import { Subject, fromEvent, filter, distinctUntilChanged, debounceTime, tap, switchMap, map, catchError, of, concat, throwError } from 'rxjs';
8
8
  import { Location, DatePipe, AsyncPipe, NgStyle, NgTemplateOutlet, formatDate, JsonPipe } from '@angular/common';
9
9
  import { bootstrapApplication, createApplication } from '@angular/platform-browser';
10
10
  import { createCustomElement } from '@angular/elements';
@@ -398,13 +398,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
398
398
  }] }, { type: i0.ChangeDetectorRef }, { type: PermissionService }] });
399
399
 
400
400
  class LazyRouteDirective {
401
- constructor(vcr) {
401
+ constructor(router, vcr, route) {
402
+ this.router = router;
402
403
  this.vcr = vcr;
404
+ this.route = route;
403
405
  }
404
406
  ngOnInit() {
405
- this.loadRoute.loadComponent().then((m) => this.vcr.createComponent(m));
407
+ this.loadRoute.loadComponent().then((m) => {
408
+ const cr = this.vcr.createComponent(m);
409
+ this.setInput(cr);
410
+ this.sub?.unsubscribe();
411
+ this.sub = this.router.events.pipe(filter((e) => e instanceof NavigationEnd), distinctUntilChanged((prev, curr) => {
412
+ const prevUrl = prev.urlAfterRedirects.split('#')[0];
413
+ const currUrl = curr.urlAfterRedirects.split('#')[0];
414
+ return prevUrl === currUrl;
415
+ })).subscribe({
416
+ next: () => {
417
+ this.setInput(cr);
418
+ }
419
+ });
420
+ });
406
421
  }
407
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LazyRouteDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
422
+ ngOnDestroy() {
423
+ this.sub?.unsubscribe();
424
+ }
425
+ setInput(cr) {
426
+ const params = this.route.firstChild?.snapshot.params;
427
+ if (Object.keys(params).length === 0 &&
428
+ params.constructor === Object) {
429
+ this.sub?.unsubscribe();
430
+ return;
431
+ }
432
+ Object.keys(params).forEach((key) => {
433
+ if (key in (cr.instance)) {
434
+ cr.setInput(key, params[key]);
435
+ }
436
+ });
437
+ }
438
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LazyRouteDirective, deps: [{ token: i1$2.Router }, { token: i0.ViewContainerRef }, { token: i1$2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Directive }); }
408
439
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: LazyRouteDirective, isStandalone: true, selector: "[loadRoute]", inputs: { loadRoute: "loadRoute" }, ngImport: i0 }); }
409
440
  }
410
441
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LazyRouteDirective, decorators: [{
@@ -413,7 +444,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
413
444
  standalone: true,
414
445
  selector: '[loadRoute]'
415
446
  }]
416
- }], ctorParameters: () => [{ type: i0.ViewContainerRef }], propDecorators: { loadRoute: [{
447
+ }], ctorParameters: () => [{ type: i1$2.Router }, { type: i0.ViewContainerRef }, { type: i1$2.ActivatedRoute }], propDecorators: { loadRoute: [{
417
448
  type: Input,
418
449
  args: [{ required: true }]
419
450
  }] } });
@@ -475,7 +506,7 @@ class ColumnContainerComponent {
475
506
  this.colSize = window.innerWidth <= 768 ? 100 : 50;
476
507
  }
477
508
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ColumnContainerComponent, deps: [{ token: i1$2.Router }, { token: i1$2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component }); }
478
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: ColumnContainerComponent, isStandalone: true, selector: "up-column-container", host: { listeners: { "window:resize": "checkScreen($event)" }, classAttribute: "d-block h-100 w-100" }, ngImport: i0, template: "<as-split \n [gutterSize]=\"0\"\n [disabled]=\"true\" \n [useTransition]=\"true\" \n>\n @for (a of areas; track $index; let i = $index) {\n <as-split-area \n class=\"border-start\"\n [attr.order]=\"i\"\n [size]=\"colSize\" \n [visible]=\"a.visible\"\n >\n <ng-container [loadRoute]=\"a.route\" />\n </as-split-area>\n }\n</as-split>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: AngularSplitModule }, { kind: "component", type: i2.SplitComponent, selector: "as-split", inputs: ["gutterSize", "gutterStep", "disabled", "gutterClickDeltaPx", "direction", "dir", "unit", "gutterAriaLabel", "restrictMove", "useTransition", "gutterDblClickDuration"], outputs: ["gutterClick", "gutterDblClick", "dragStart", "dragEnd", "transitionEnd"], exportAs: ["asSplit"] }, { kind: "component", type: i2.SplitAreaComponent, selector: "as-split-area", inputs: ["size", "minSize", "maxSize", "lockSize", "visible"], exportAs: ["asSplitArea"] }, { kind: "directive", type: LazyRouteDirective, selector: "[loadRoute]", inputs: ["loadRoute"] }] }); }
509
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: ColumnContainerComponent, isStandalone: true, selector: "up-column-container", host: { listeners: { "window:resize": "checkScreen($event)" }, classAttribute: "d-block h-100 w-100" }, ngImport: i0, template: "<as-split \n [gutterSize]=\"0\"\n [disabled]=\"true\" \n [useTransition]=\"true\"\n>\n @for (a of areas; track $index; let i = $index) {\n <as-split-area \n class=\"border-start\"\n [size]=\"colSize\"\n [visible]=\"a.visible\"\n >\n <ng-container [loadRoute]=\"a.route\" />\n </as-split-area>\n }\n</as-split>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: AngularSplitModule }, { kind: "component", type: i2.SplitComponent, selector: "as-split", inputs: ["gutterSize", "gutterStep", "disabled", "gutterClickDeltaPx", "direction", "dir", "unit", "gutterAriaLabel", "restrictMove", "useTransition", "gutterDblClickDuration"], outputs: ["gutterClick", "gutterDblClick", "dragStart", "dragEnd", "transitionEnd"], exportAs: ["asSplit"] }, { kind: "component", type: i2.SplitAreaComponent, selector: "as-split-area", inputs: ["size", "minSize", "maxSize", "lockSize", "visible"], exportAs: ["asSplitArea"] }, { kind: "directive", type: LazyRouteDirective, selector: "[loadRoute]", inputs: ["loadRoute"] }] }); }
479
510
  }
480
511
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ColumnContainerComponent, decorators: [{
481
512
  type: Component,
@@ -484,7 +515,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
484
515
  }, imports: [
485
516
  AngularSplitModule,
486
517
  LazyRouteDirective
487
- ], template: "<as-split \n [gutterSize]=\"0\"\n [disabled]=\"true\" \n [useTransition]=\"true\" \n>\n @for (a of areas; track $index; let i = $index) {\n <as-split-area \n class=\"border-start\"\n [attr.order]=\"i\"\n [size]=\"colSize\" \n [visible]=\"a.visible\"\n >\n <ng-container [loadRoute]=\"a.route\" />\n </as-split-area>\n }\n</as-split>\n" }]
518
+ ], template: "<as-split \n [gutterSize]=\"0\"\n [disabled]=\"true\" \n [useTransition]=\"true\"\n>\n @for (a of areas; track $index; let i = $index) {\n <as-split-area \n class=\"border-start\"\n [size]=\"colSize\"\n [visible]=\"a.visible\"\n >\n <ng-container [loadRoute]=\"a.route\" />\n </as-split-area>\n }\n</as-split>\n" }]
488
519
  }], ctorParameters: () => [{ type: i1$2.Router }, { type: i1$2.ActivatedRoute }], propDecorators: { checkScreen: [{
489
520
  type: HostListener,
490
521
  args: ['window:resize', ['$event']]
@@ -2058,6 +2089,16 @@ class ProfileService {
2058
2089
  isInternal
2059
2090
  status
2060
2091
  }
2092
+ departments {
2093
+ department {
2094
+ hierarchyCode
2095
+ hierarchyPath
2096
+ name
2097
+ guid
2098
+ status
2099
+ }
2100
+ isLead
2101
+ }
2061
2102
  }
2062
2103
  }
2063
2104
  `,
@@ -2110,6 +2151,16 @@ class AuthService {
2110
2151
  isInternal
2111
2152
  status
2112
2153
  }
2154
+ departments {
2155
+ department {
2156
+ hierarchyCode
2157
+ hierarchyPath
2158
+ name
2159
+ guid
2160
+ status
2161
+ }
2162
+ isLead
2163
+ }
2113
2164
  }
2114
2165
  }
2115
2166
  `
@@ -2563,12 +2614,16 @@ class FilterComponent {
2563
2614
  this.initialItems = new Map();
2564
2615
  }
2565
2616
  ngOnInit() {
2566
- this.config.fields.forEach(({ key, initialValue }) => {
2567
- if (typeof key === 'string')
2568
- this.createFormControl(key, initialValue);
2569
- else {
2617
+ this.config.fields.forEach(({ key, initialValue, initialItems }) => {
2618
+ if (typeof key !== 'string') {
2570
2619
  key.forEach((k, i) => this.createFormControl(k, initialValue?.at(i)));
2571
2620
  }
2621
+ else {
2622
+ if (initialItems) {
2623
+ this.initialItems.set(key, initialItems);
2624
+ }
2625
+ this.createFormControl(key, initialValue);
2626
+ }
2572
2627
  });
2573
2628
  const savedState = localStorage.getItem(`${this.id}`);
2574
2629
  if (savedState) {
@@ -2613,10 +2668,13 @@ class FilterComponent {
2613
2668
  this.close();
2614
2669
  }
2615
2670
  processFilter(key, value) {
2671
+ if (Array.isArray(value)) {
2672
+ value = value[0];
2673
+ }
2616
2674
  const initialItem = this.initialItems.get(key)?.find(item => item.value === value);
2617
2675
  const label = initialItem
2618
2676
  ? `${key}: ${initialItem.label}`
2619
- : `${key}: ${key.includes('date') ? formatDate(value, 'dd MMM yyyy', 'en-US') : value}`;
2677
+ : `${key}: ${key.toLowerCase().includes('date') ? formatDate(value, 'dd MMM yyyy', 'en-US') : value}`;
2620
2678
  this.activeFilter.push({ key, value, label });
2621
2679
  }
2622
2680
  add() {
@@ -2666,19 +2724,23 @@ class FilterComponent {
2666
2724
  extraAction?.(k, f[k]);
2667
2725
  });
2668
2726
  this.onSearch.emit({ mode: this.config.mode, data: flag ? data : null });
2669
- localStorage.setItem(`${this.id}`, JSON.stringify({
2670
- activeFilter: this.activeFilter,
2671
- initialItems: Object.fromEntries(this.initialItems),
2672
- formValues: this.form.getRawValue()
2673
- }));
2727
+ this.saveState();
2674
2728
  }
2675
2729
  createFormControl(key, val) {
2676
2730
  this.form.addControl(key, new FormControl(''));
2677
2731
  if (val) {
2678
2732
  this.form.controls[key].setValue(val);
2679
- this.activeFilter.push({ label: `${key}:${val}`, key, value: val });
2733
+ this.processFilter(key, val);
2734
+ this.saveState();
2680
2735
  }
2681
2736
  }
2737
+ saveState() {
2738
+ localStorage.setItem(`${this.id}`, JSON.stringify({
2739
+ activeFilter: this.activeFilter,
2740
+ initialItems: Object.fromEntries(this.initialItems),
2741
+ formValues: this.form.getRawValue()
2742
+ }));
2743
+ }
2682
2744
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FilterComponent, deps: [{ token: 'placeholder', attribute: true }, { token: i0.ChangeDetectorRef }, { token: i1.PopoverController }], target: i0.ɵɵFactoryTarget.Component }); }
2683
2745
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: FilterComponent, isStandalone: true, selector: "up-filter", inputs: { id: "id", config: "config" }, outputs: { onSearch: "onSearch" }, host: { classAttribute: "d-block position-relative" }, viewQueries: [{ propertyName: "searchBox", first: true, predicate: ["searchBox"], descendants: true }], ngImport: i0, template: "<ion-icon name=\"search\" class=\"fs-4 position-absolute\" />\n\n<div class=\"d-flex align-items-center form-control ps-5 py-0 pe-0 gap-3\">\n @if (activeFilter.length > 0) {\n <div class=\"d-flex flex-grow-1 flex-shrink-0 tag-container gap-2 text-nowrap overflow-auto\">\n @for (item of activeFilter; track item.key; let i = $index) {\n <div class=\"tag-item p-1 rounded d-flex align-items-center user-select-none\">\n <ion-icon name=\"close\" class=\"pe-1 me-1 cursor-pointer text-primary\" (click)=\"removeFilter(i);\" />\n {{ item.label }}\n </div>\n }\n </div>\n }\n\n <input #searchBox type=\"search\" placeholder=\"{{ placeholder }}\" class=\"flex-shrink-1 border-0 form-control ps-0 py-2\" [class.adv]=\"config.mode === 'advanced'\" (keyup.enter)=\"add();\" />\n</div>\n\n@if (config.mode === 'advanced') {\n <ion-icon name=\"filter\" class=\"position-absolute fs-4 cursor-pointer\" id=\"filter-{{ id }}\" />\n <ion-icon name=\"close\" class=\"position-absolute fs-4 cursor-pointer\" (click)=\"clear();\" />\n \n <ion-popover trigger=\"filter-{{ id }}\" triggerAction=\"click\">\n <ng-template>\n <div class=\"d-flex flex-column filter overflow-auto\">\n <div class=\"flex-shrink-0 border-bottom p-1 pe-4 d-flex align-items-center\">\n <ion-buttons>\n <ion-button size=\"small\" (click)=\"close()\">\n <ion-icon slot=\"icon-only\" name=\"close\" />\n </ion-button>\n </ion-buttons>\n \n <div class=\"fs-5 fw-medium\">Advanced Filter</div>\n </div>\n \n <form class=\"flex-grow-1 overflow-auto px-4\" [formGroup]=\"form\">\n @for (c of config.fields; track c.key) {\n @switch (c.type) {\n @case ('number') {\n <up-input type=\"number\" autocomplete=\"off\" class=\"my-4\" label=\"{{ c.label }}\" formControlName=\"{{ c.key }}\" /> \n }\n\n @case ('checkbox') {\n <div class=\"my-4\">\n <ion-checkbox labelPlacement=\"end\" formControlName=\"{{ c.key }}\">{{ c.label }}</ion-checkbox>\n </div>\n }\n\n @case ('date-range') {\n <div class=\"d-flex gap-3 my-4\">\n <up-date class=\"flex-grow-1\" name=\"filter-from\" label=\"{{ c.label[0] }}\" formControlName=\"{{ c.key[0] }}\" />\n <up-date class=\"flex-grow-1\" name=\"filter-to\" label=\"{{ c.label[1] }}\" formControlName=\"{{ c.key[1] }}\" />\n </div>\n }\n\n @case ('select') { \n <up-select \n class=\"my-4\"\n appendTo=\"body\" \n label=\"{{ c.label }}\" \n formControlName=\"{{ c.key }}\" \n [items]=\"c.options!\"\n [multiple]=\"c.multiple || false\"\n /> \n }\n\n @case ('searchable-select') { \n <up-searchable-select \n class=\"my-4\" \n appendTo=\"body\" \n label=\"{{ c.label }}\" \n formControlName=\"{{ c.key }}\" \n [queryFunc]=\"c.getOptions!\" \n [initialItems]=\"c.options! || initialItems.get(c.key.toString())!\"\n [multiple]=\"c.multiple || false\"\n (onChange)=\"applyInitialItems($event, c.key.toString())\"\n /> \n }\n \n @default { \n <up-input type=\"text\" autocomplete=\"off\" class=\"my-4\" label=\"{{ c.label }}\" formControlName=\"{{ c.key }}\" /> \n }\n }\n }\n </form>\n \n <div class=\"flex-shrink-0 py-3 px-4 border-top d-flex gap-3\">\n <ion-button class=\"flex-grow-1\" color=\"secondary\" (click)=\"form.reset();\">Reset</ion-button>\n <ion-button class=\"flex-grow-1\" color=\"primary\" (click)=\"search();\">Search</ion-button>\n </div>\n </div>\n </ng-template>\n </ion-popover> \n}\n", styles: ["ion-icon{top:7px}ion-icon[name=close]{right:16px}ion-icon[name=search]{left:14px}ion-icon[name=filter]{right:48px}ion-popover{--width: 80%;--max-width: 450px}.adv{padding-right:60px}.fs-5,ion-icon{color:#616161}.tag-container{max-width:45%}@media (max-width: 576px){.tag-container{max-width:35%}}.tag-container::-webkit-scrollbar{height:0px}.tag-item{color:#ed6b26;background-color:#fef3ee}.tag-item ion-icon{border-right:1px solid #fbd1be}input::-webkit-search-decoration,input::-webkit-search-cancel-button,input::-webkit-search-results-button,input::-webkit-search-results-decoration{-webkit-appearance:none}\n"], dependencies: [{ kind: "ngmodule", type: IonicModule }, { kind: "component", type: i1.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i1.IonButtons, selector: "ion-buttons", inputs: ["collapse"] }, { kind: "component", type: i1.IonCheckbox, selector: "ion-checkbox", inputs: ["alignment", "checked", "color", "disabled", "indeterminate", "justify", "labelPlacement", "legacy", "mode", "name", "value"] }, { kind: "component", type: i1.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i1.IonPopover, selector: "ion-popover" }, { kind: "directive", type: i1.BooleanValueAccessor, selector: "ion-checkbox,ion-toggle" }, { kind: "component", type: FormDateComponent, selector: "up-date", inputs: ["label", "required", "disabled", "presentation", "minDate", "maxDate"] }, { kind: "component", type: FormInputComponent, selector: "up-input", inputs: ["label", "value", "required", "disabled"], outputs: ["onInput"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: FormSelectComponent, selector: "up-select", inputs: ["items", "clearable", "label", "multiple", "required", "addTag", "disabled", "searchable", "bindLabel", "bindValue", "appendTo"] }, { kind: "component", type: FormSearchableSelectComponent, selector: "up-searchable-select", inputs: ["queryFunc", "clearable", "label", "initialItems", "required", "addTag", "disabled", "multiple", "bindLabel", "bindValue", "appendTo"], outputs: ["onChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2684
2746
  }