@recursyve/nice-ui-kit.v2 13.1.0-beta.86 → 13.1.0-beta.89

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.
@@ -1,10 +1,12 @@
1
1
  import * as i1$7 from '@angular/animations';
2
2
  import { animation, style, animate, trigger, transition, useAnimation, state, keyframes } from '@angular/animations';
3
- import { coerceBooleanProperty } from '@angular/cdk/coercion';
3
+ import { HttpContextToken, HttpResponse, HttpContext, HttpParams } from '@angular/common/http';
4
4
  import * as i0 from '@angular/core';
5
5
  import { Injectable, NgModule, EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Output, HostBinding, InjectionToken, Directive, HostListener, forwardRef, Optional, Inject, ViewChild, ViewChildren, Self, Pipe, ElementRef, PLATFORM_ID, TemplateRef, ContentChildren, SkipSelf } from '@angular/core';
6
- import { ReplaySubject, Subject, BehaviorSubject, mergeMap, from, isObservable, firstValueFrom, debounceTime, distinctUntilChanged, startWith, tap as tap$1, Observable, combineLatest, fromEvent, merge as merge$1 } from 'rxjs';
7
- import { filter, takeUntil, tap, map, take, debounceTime as debounceTime$1, delay, switchMap } from 'rxjs/operators';
6
+ import { plainToInstance } from 'class-transformer';
7
+ import { map, filter, takeUntil, tap, take, debounceTime as debounceTime$1, delay, switchMap } from 'rxjs/operators';
8
+ import { catchError, ReplaySubject, Subject, BehaviorSubject, mergeMap, from, isObservable, firstValueFrom, debounceTime, distinctUntilChanged, startWith, tap as tap$1, Observable, combineLatest, fromEvent, merge as merge$1 } from 'rxjs';
9
+ import { coerceBooleanProperty } from '@angular/cdk/coercion';
8
10
  import * as i3 from '@angular/material/icon';
9
11
  import { MatIconModule } from '@angular/material/icon';
10
12
  import * as i2 from '@angular/material/button';
@@ -13,7 +15,6 @@ import * as i4 from '@angular/common';
13
15
  import { CommonModule, DOCUMENT, isPlatformServer, CurrencyPipe, DatePipe } from '@angular/common';
14
16
  import * as i1$2 from '@angular/forms';
15
17
  import { NG_VALUE_ACCESSOR, FormControl, Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
16
- import { HttpParams } from '@angular/common/http';
17
18
  import * as i2$1 from '@angular/material/menu';
18
19
  import { MatMenuModule } from '@angular/material/menu';
19
20
  import * as i2$2 from '@angular/material/core';
@@ -584,6 +585,96 @@ const niceAnimations = [
584
585
  zoomIn, zoomOut
585
586
  ];
586
587
 
588
+ class NiceApiException {
589
+ }
590
+
591
+ class NiceHttpExceptionFactory {
592
+ transform(error) {
593
+ if (error.error?.message === undefined) {
594
+ return error;
595
+ }
596
+ return this.transformCodeError(error.error.message, error.error);
597
+ }
598
+ }
599
+
600
+ const TRANSFORM_TYPE = new HttpContextToken(() => null);
601
+ class NiceTransformResponseInterceptor {
602
+ intercept(req, next) {
603
+ return next.handle(req).pipe(map(event => {
604
+ if (event instanceof HttpResponse) {
605
+ const type = req.context.get(TRANSFORM_TYPE);
606
+ if (!type) {
607
+ return event;
608
+ }
609
+ return event.clone({
610
+ body: plainToInstance(type, event.body)
611
+ });
612
+ }
613
+ return event;
614
+ }));
615
+ }
616
+ }
617
+ NiceTransformResponseInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceTransformResponseInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
618
+ NiceTransformResponseInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceTransformResponseInterceptor });
619
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceTransformResponseInterceptor, decorators: [{
620
+ type: Injectable
621
+ }] });
622
+
623
+ function mixinNiceApi(base) {
624
+ return class extends base {
625
+ url(route = "") {
626
+ if (route === "" && (!this.path || this.path === "")) {
627
+ return this.apiUrl;
628
+ }
629
+ else if (route === "") {
630
+ return `${this.apiUrl}/${this.path}`;
631
+ }
632
+ return `${this.apiUrl}/${this.path}/${route}`;
633
+ }
634
+ delete(route = "", options) {
635
+ return this.httpClient.delete(this.url(route), this.transformOptions(options)).pipe(catchError(e => this.transformError(e)));
636
+ }
637
+ get(route = "", options) {
638
+ return this.httpClient.get(this.url(route), this.transformOptions(options)).pipe(catchError(e => this.transformError(e)));
639
+ }
640
+ head(route = "", options) {
641
+ return this.httpClient.head(this.url(route), this.transformOptions(options)).pipe(catchError(e => this.transformError(e)));
642
+ }
643
+ patch(route = "", body, options) {
644
+ return this.httpClient.patch(this.url(route), body, this.transformOptions(options)).pipe(catchError(e => this.transformError(e)));
645
+ }
646
+ post(route = "", body, options) {
647
+ return this.httpClient.post(this.url(route), body, this.transformOptions(options)).pipe(catchError(e => this.transformError(e)));
648
+ }
649
+ put(route = "", body, options) {
650
+ return this.httpClient.put(this.url(route), body, this.transformOptions(options)).pipe(catchError(e => this.transformError(e)));
651
+ }
652
+ transformError(error) {
653
+ if (!this.exceptionFactory) {
654
+ throw error;
655
+ }
656
+ throw this.exceptionFactory.transform(error);
657
+ }
658
+ transformOptions(options) {
659
+ if (!options) {
660
+ return options;
661
+ }
662
+ const { type, context: c, ...values } = options;
663
+ const context = c ?? new HttpContext();
664
+ if (type) {
665
+ context.set(TRANSFORM_TYPE, type);
666
+ }
667
+ return {
668
+ ...values,
669
+ context
670
+ };
671
+ }
672
+ constructor(...args) {
673
+ super(...args);
674
+ }
675
+ };
676
+ }
677
+
587
678
  class NiceUtilsService {
588
679
  // -----------------------------------------------------------------------------------------------------
589
680
  // @ Public methods
@@ -2810,7 +2901,7 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
2810
2901
  this.updateErrorState();
2811
2902
  }
2812
2903
  }
2813
- writeValue(value) {
2904
+ async writeValue(value) {
2814
2905
  if (this._value === value || (isNullOrUndefined(this._value) && isNullOrUndefined(value))) {
2815
2906
  return;
2816
2907
  }
@@ -2818,12 +2909,14 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
2818
2909
  this.onRemove(null);
2819
2910
  return;
2820
2911
  }
2821
- this.value = value;
2822
2912
  if (value instanceof NiceTypeaheadNewValue) {
2823
2913
  this.updateSearchInput();
2824
2914
  return;
2825
2915
  }
2826
- this.service.setActiveId(this.resource, value, this.searchOptions).then(() => this.updateSearchInput());
2916
+ else {
2917
+ await this.service.setActiveId(this.resource, value, this.searchOptions).then(() => this.updateSearchInput());
2918
+ }
2919
+ this.value = value;
2827
2920
  }
2828
2921
  registerOnChange(propagate) {
2829
2922
  this.propagate = propagate;
@@ -4260,7 +4353,7 @@ class NiceControlStatusDirective {
4260
4353
  if (this.control.pending) {
4261
4354
  return;
4262
4355
  }
4263
- if (this.control.invalid && this.control.dirty) {
4356
+ if (this.control.invalid && this.control.touched) {
4264
4357
  for (const error in this.control.errors) {
4265
4358
  if (this.control.errors.hasOwnProperty(error)) {
4266
4359
  if (this.control.errors[error]) {
@@ -5772,16 +5865,14 @@ class NiceLayoutComponent {
5772
5865
  // Set the theme and scheme based on the configuration
5773
5866
  combineLatest([
5774
5867
  this._niceConfigService.config$,
5775
- this._niceMediaWatcherService
5776
- .onMediaQueryChange$(["(prefers-color-scheme: dark)", "(prefers-color-scheme: light)"])
5777
- .pipe(startWith(null))
5868
+ this._niceMediaWatcherService.onMediaQueryChange$(["(prefers-color-scheme: dark)", "(prefers-color-scheme: light)"])
5778
5869
  ]).pipe(takeUntil(this._unsubscribeAll), map(([config, mql]) => {
5779
5870
  const options = {
5780
5871
  scheme: config.scheme,
5781
5872
  theme: config.theme
5782
5873
  };
5783
5874
  if (config.scheme === "auto") {
5784
- options.scheme = mql?.breakpoints["(prefers-color-scheme: dark)"] ? "dark" : "light";
5875
+ options.scheme = mql.breakpoints["(prefers-color-scheme: dark)"] ? "dark" : "light";
5785
5876
  }
5786
5877
  return options;
5787
5878
  })).subscribe((options) => {
@@ -5832,14 +5923,12 @@ class NiceLayoutComponent {
5832
5923
  }
5833
5924
  }
5834
5925
  NiceLayoutComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceLayoutComponent, deps: [{ token: DOCUMENT }, { token: i0.Renderer2 }, { token: NiceConfigService }, { token: NiceMediaWatcherService }], target: i0.ɵɵFactoryTarget.Component });
5835
- NiceLayoutComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: NiceLayoutComponent, selector: "nice-layout", ngImport: i0, template: `
5836
- <ng-content></ng-content>`, isInline: true });
5926
+ NiceLayoutComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: NiceLayoutComponent, selector: "nice-layout", ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
5837
5927
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceLayoutComponent, decorators: [{
5838
5928
  type: Component,
5839
5929
  args: [{
5840
5930
  selector: "nice-layout",
5841
- template: `
5842
- <ng-content></ng-content>`
5931
+ template: `<ng-content></ng-content>`
5843
5932
  }]
5844
5933
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
5845
5934
  type: Inject,
@@ -9571,5 +9660,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImpor
9571
9660
  * Generated bundle index. Do not edit.
9572
9661
  */
9573
9662
 
9574
- export { ArrayUtils, BooleanPipe, CapitalizeFirstLetterPipe, CarouselComponent, CaseUtils, CeilPipe, ColorsUtils, DateUtils, DefaultExportBottomSheetService, EntriesPipe, ExportBottomSheetComponent, ExportBottomSheetService, FileUtils, FindByKeyPipe, FirstLetterPipe, FloorPipe, FontAwesomeUtils, FormDataUtils, HttpStatusCodes, ImgCropperConfig, ImgCropperError, ImgResolution, JoinPipe, KeyboardCodes, LinkPipe, LocalizedBooleanPipe, LocalizedCurrencyPipe, LocalizedDateOnlyPipe, LocalizedDatePipe, MinutesToTimePipe, ModalMode, NiceAlertComponent, NiceAlertModule, NiceAlertService, NiceAssetsCarouselComponent, NiceAssetsCarouselModule, NiceAsyncTypeaheadComponent, NiceAsyncTypeaheadModule, NiceAsyncTypeaheadProvider, NiceAutofocusDirective, NiceAutofocusDirectiveModule, NiceAutogrowDirective, NiceAutogrowModule, NiceBaseForm, NiceBaseFormComponent, NiceBaseFormModule, NiceCardComponent, NiceCardModule, NiceCarouselModule, NiceClickStopPropagationDirective, NiceConfigModule, NiceConfigService, NiceControlStatusDirective, NiceCropperAreaComponent, NiceDrawerComponent, NiceDrawerModule, NiceDrawerService, NiceDropzoneDirective, NiceDropzoneModule, NiceExportBottomSheetModule, NiceFormErrorComponent, NiceFormErrorModule, NiceFormSubmitDirective, NiceHorizontalNavigationBasicItemComponent, NiceHorizontalNavigationBranchItemComponent, NiceHorizontalNavigationComponent, NiceHorizontalNavigationDividerItemComponent, NiceHorizontalNavigationSpacerItemComponent, NiceHorizontalStepperComponent, NiceHorizontalStepperModule, NiceImageCropperComponent, NiceImageCropperModule, NiceImageErrorPlaceholderDirective, NiceImageErrorPlaceholderDirectiveModule, NiceLayoutComponent, NiceLayoutModule, NiceLoadingDirective, NiceLoadingSpinnerComponent, NiceLoadingSpinnerModule, NiceLottieComponent, NiceLottieModule, NiceMaterialModule, NiceMaterialStyleDirective, NiceMediaWatcherModule, NiceMediaWatcherService, NiceModalOnClickDirective, NiceModalOpenerDirective, NiceModule, NiceNavigationComponent, NiceNavigationModule, NiceNavigationService, NicePipesModule, NicePreventCloseWindowDirective, NiceRoundedStyleDirective, NiceScrollResetDirective, NiceScrollResetModule, NiceScrollbarDirective, NiceScrollbarModule, NiceSearchBarComponent, NiceSearchBarModule, NiceSplashScreenModule, NiceSplashScreenService, NiceStepComponent, NiceStopPropagationModule, NiceSweetAlertComponent, NiceSweetAlertModule, NiceSweetAlertService, NiceToastComponent, NiceToastModule, NiceToastService, NiceToggleButtonGroupModule, NiceTypeaheadComponent, NiceTypeaheadModule, NiceTypeaheadNewValue, NiceUtilsModule, NiceUtilsService, NiceVerticalNavigationAsideItemComponent, NiceVerticalNavigationBasicItemComponent, NiceVerticalNavigationCollapsableItemComponent, NiceVerticalNavigationComponent, NiceVerticalNavigationDividerItemComponent, NiceVerticalNavigationGroupItemComponent, NiceVerticalNavigationSpacerItemComponent, NiceWindowDirectiveModule, NumberToOrdinalIndicatorPipe, NumberUtils, ObjectUtils, OptionsScrollDirective, PadPipe, PhonePipe, PictureModalComponent, PictureModalService, PostalCodePipe, PromiseUtils, QueryParamsUtils, RangePipe, RegexUtils, RoundPipe, SanitizeBypassPipe, SecondsToTimePipe, ToggleButtonComponent, ToggleButtonGroupComponent, TypeUtils, UrlUtils, _normalizeDegrees, isNotNullOrUndefined, isNullOrUndefined, mergeDeep, niceAnimations, round };
9663
+ export { ArrayUtils, BooleanPipe, CapitalizeFirstLetterPipe, CarouselComponent, CaseUtils, CeilPipe, ColorsUtils, DateUtils, DefaultExportBottomSheetService, EntriesPipe, ExportBottomSheetComponent, ExportBottomSheetService, FileUtils, FindByKeyPipe, FirstLetterPipe, FloorPipe, FontAwesomeUtils, FormDataUtils, HttpStatusCodes, ImgCropperConfig, ImgCropperError, ImgResolution, JoinPipe, KeyboardCodes, LinkPipe, LocalizedBooleanPipe, LocalizedCurrencyPipe, LocalizedDateOnlyPipe, LocalizedDatePipe, MinutesToTimePipe, ModalMode, NiceAlertComponent, NiceAlertModule, NiceAlertService, NiceApiException, NiceAssetsCarouselComponent, NiceAssetsCarouselModule, NiceAsyncTypeaheadComponent, NiceAsyncTypeaheadModule, NiceAsyncTypeaheadProvider, NiceAutofocusDirective, NiceAutofocusDirectiveModule, NiceAutogrowDirective, NiceAutogrowModule, NiceBaseForm, NiceBaseFormComponent, NiceBaseFormModule, NiceCardComponent, NiceCardModule, NiceCarouselModule, NiceClickStopPropagationDirective, NiceConfigModule, NiceConfigService, NiceControlStatusDirective, NiceCropperAreaComponent, NiceDrawerComponent, NiceDrawerModule, NiceDrawerService, NiceDropzoneDirective, NiceDropzoneModule, NiceExportBottomSheetModule, NiceFormErrorComponent, NiceFormErrorModule, NiceFormSubmitDirective, NiceHorizontalNavigationBasicItemComponent, NiceHorizontalNavigationBranchItemComponent, NiceHorizontalNavigationComponent, NiceHorizontalNavigationDividerItemComponent, NiceHorizontalNavigationSpacerItemComponent, NiceHorizontalStepperComponent, NiceHorizontalStepperModule, NiceHttpExceptionFactory, NiceImageCropperComponent, NiceImageCropperModule, NiceImageErrorPlaceholderDirective, NiceImageErrorPlaceholderDirectiveModule, NiceLayoutComponent, NiceLayoutModule, NiceLoadingDirective, NiceLoadingSpinnerComponent, NiceLoadingSpinnerModule, NiceLottieComponent, NiceLottieModule, NiceMaterialModule, NiceMaterialStyleDirective, NiceMediaWatcherModule, NiceMediaWatcherService, NiceModalOnClickDirective, NiceModalOpenerDirective, NiceModule, NiceNavigationComponent, NiceNavigationModule, NiceNavigationService, NicePipesModule, NicePreventCloseWindowDirective, NiceRoundedStyleDirective, NiceScrollResetDirective, NiceScrollResetModule, NiceScrollbarDirective, NiceScrollbarModule, NiceSearchBarComponent, NiceSearchBarModule, NiceSplashScreenModule, NiceSplashScreenService, NiceStepComponent, NiceStopPropagationModule, NiceSweetAlertComponent, NiceSweetAlertModule, NiceSweetAlertService, NiceToastComponent, NiceToastModule, NiceToastService, NiceToggleButtonGroupModule, NiceTransformResponseInterceptor, NiceTypeaheadComponent, NiceTypeaheadModule, NiceTypeaheadNewValue, NiceUtilsModule, NiceUtilsService, NiceVerticalNavigationAsideItemComponent, NiceVerticalNavigationBasicItemComponent, NiceVerticalNavigationCollapsableItemComponent, NiceVerticalNavigationComponent, NiceVerticalNavigationDividerItemComponent, NiceVerticalNavigationGroupItemComponent, NiceVerticalNavigationSpacerItemComponent, NiceWindowDirectiveModule, NumberToOrdinalIndicatorPipe, NumberUtils, ObjectUtils, OptionsScrollDirective, PadPipe, PhonePipe, PictureModalComponent, PictureModalService, PostalCodePipe, PromiseUtils, QueryParamsUtils, RangePipe, RegexUtils, RoundPipe, SanitizeBypassPipe, SecondsToTimePipe, TRANSFORM_TYPE, ToggleButtonComponent, ToggleButtonGroupComponent, TypeUtils, UrlUtils, _normalizeDegrees, isNotNullOrUndefined, isNullOrUndefined, mergeDeep, mixinNiceApi, niceAnimations, round };
9575
9664
  //# sourceMappingURL=recursyve-nice-ui-kit.v2.mjs.map