@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,20 +1,21 @@
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 { __rest, __awaiter } from 'tslib';
9
+ 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';
10
+ import { coerceBooleanProperty } from '@angular/cdk/coercion';
8
11
  import * as i3 from '@angular/material/icon';
9
12
  import { MatIconModule } from '@angular/material/icon';
10
13
  import * as i2 from '@angular/material/button';
11
14
  import { MatButtonModule } from '@angular/material/button';
12
15
  import * as i4 from '@angular/common';
13
16
  import { CommonModule, DOCUMENT, isPlatformServer, CurrencyPipe, DatePipe } from '@angular/common';
14
- import { __awaiter } from 'tslib';
15
17
  import * as i1$2 from '@angular/forms';
16
18
  import { NG_VALUE_ACCESSOR, FormControl, Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
17
- import { HttpParams } from '@angular/common/http';
18
19
  import * as i2$1 from '@angular/material/menu';
19
20
  import { MatMenuModule } from '@angular/material/menu';
20
21
  import * as i2$2 from '@angular/material/core';
@@ -585,6 +586,94 @@ const niceAnimations = [
585
586
  zoomIn, zoomOut
586
587
  ];
587
588
 
589
+ class NiceApiException {
590
+ }
591
+
592
+ class NiceHttpExceptionFactory {
593
+ transform(error) {
594
+ var _a;
595
+ if (((_a = error.error) === null || _a === void 0 ? void 0 : _a.message) === undefined) {
596
+ return error;
597
+ }
598
+ return this.transformCodeError(error.error.message, error.error);
599
+ }
600
+ }
601
+
602
+ const TRANSFORM_TYPE = new HttpContextToken(() => null);
603
+ class NiceTransformResponseInterceptor {
604
+ intercept(req, next) {
605
+ return next.handle(req).pipe(map(event => {
606
+ if (event instanceof HttpResponse) {
607
+ const type = req.context.get(TRANSFORM_TYPE);
608
+ if (!type) {
609
+ return event;
610
+ }
611
+ return event.clone({
612
+ body: plainToInstance(type, event.body)
613
+ });
614
+ }
615
+ return event;
616
+ }));
617
+ }
618
+ }
619
+ NiceTransformResponseInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceTransformResponseInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
620
+ NiceTransformResponseInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceTransformResponseInterceptor });
621
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceTransformResponseInterceptor, decorators: [{
622
+ type: Injectable
623
+ }] });
624
+
625
+ function mixinNiceApi(base) {
626
+ return class extends base {
627
+ url(route = "") {
628
+ if (route === "" && (!this.path || this.path === "")) {
629
+ return this.apiUrl;
630
+ }
631
+ else if (route === "") {
632
+ return `${this.apiUrl}/${this.path}`;
633
+ }
634
+ return `${this.apiUrl}/${this.path}/${route}`;
635
+ }
636
+ delete(route = "", options) {
637
+ return this.httpClient.delete(this.url(route), this.transformOptions(options)).pipe(catchError(e => this.transformError(e)));
638
+ }
639
+ get(route = "", options) {
640
+ return this.httpClient.get(this.url(route), this.transformOptions(options)).pipe(catchError(e => this.transformError(e)));
641
+ }
642
+ head(route = "", options) {
643
+ return this.httpClient.head(this.url(route), this.transformOptions(options)).pipe(catchError(e => this.transformError(e)));
644
+ }
645
+ patch(route = "", body, options) {
646
+ return this.httpClient.patch(this.url(route), body, this.transformOptions(options)).pipe(catchError(e => this.transformError(e)));
647
+ }
648
+ post(route = "", body, options) {
649
+ return this.httpClient.post(this.url(route), body, this.transformOptions(options)).pipe(catchError(e => this.transformError(e)));
650
+ }
651
+ put(route = "", body, options) {
652
+ return this.httpClient.put(this.url(route), body, this.transformOptions(options)).pipe(catchError(e => this.transformError(e)));
653
+ }
654
+ transformError(error) {
655
+ if (!this.exceptionFactory) {
656
+ throw error;
657
+ }
658
+ throw this.exceptionFactory.transform(error);
659
+ }
660
+ transformOptions(options) {
661
+ if (!options) {
662
+ return options;
663
+ }
664
+ const { type, context: c } = options, values = __rest(options, ["type", "context"]);
665
+ const context = c !== null && c !== void 0 ? c : new HttpContext();
666
+ if (type) {
667
+ context.set(TRANSFORM_TYPE, type);
668
+ }
669
+ return Object.assign(Object.assign({}, values), { context });
670
+ }
671
+ constructor(...args) {
672
+ super(...args);
673
+ }
674
+ };
675
+ }
676
+
588
677
  class NiceAlertService {
589
678
  constructor() {
590
679
  this._onDismiss = new ReplaySubject(1);
@@ -2803,19 +2892,23 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
2803
2892
  }
2804
2893
  }
2805
2894
  writeValue(value) {
2806
- if (this._value === value || (isNullOrUndefined(this._value) && isNullOrUndefined(value))) {
2807
- return;
2808
- }
2809
- if (!value && this._value !== value) {
2810
- this.onRemove(null);
2811
- return;
2812
- }
2813
- this.value = value;
2814
- if (value instanceof NiceTypeaheadNewValue) {
2815
- this.updateSearchInput();
2816
- return;
2817
- }
2818
- this.service.setActiveId(this.resource, value, this.searchOptions).then(() => this.updateSearchInput());
2895
+ return __awaiter(this, void 0, void 0, function* () {
2896
+ if (this._value === value || (isNullOrUndefined(this._value) && isNullOrUndefined(value))) {
2897
+ return;
2898
+ }
2899
+ if (!value && this._value !== value) {
2900
+ this.onRemove(null);
2901
+ return;
2902
+ }
2903
+ if (value instanceof NiceTypeaheadNewValue) {
2904
+ this.updateSearchInput();
2905
+ return;
2906
+ }
2907
+ else {
2908
+ yield this.service.setActiveId(this.resource, value, this.searchOptions).then(() => this.updateSearchInput());
2909
+ }
2910
+ this.value = value;
2911
+ });
2819
2912
  }
2820
2913
  registerOnChange(propagate) {
2821
2914
  this.propagate = propagate;
@@ -4265,7 +4358,7 @@ class NiceControlStatusDirective {
4265
4358
  if (this.control.pending) {
4266
4359
  return;
4267
4360
  }
4268
- if (this.control.invalid && this.control.dirty) {
4361
+ if (this.control.invalid && this.control.touched) {
4269
4362
  for (const error in this.control.errors) {
4270
4363
  if (this.control.errors.hasOwnProperty(error)) {
4271
4364
  if (this.control.errors[error]) {
@@ -5778,16 +5871,14 @@ class NiceLayoutComponent {
5778
5871
  // Set the theme and scheme based on the configuration
5779
5872
  combineLatest([
5780
5873
  this._niceConfigService.config$,
5781
- this._niceMediaWatcherService
5782
- .onMediaQueryChange$(["(prefers-color-scheme: dark)", "(prefers-color-scheme: light)"])
5783
- .pipe(startWith(null))
5874
+ this._niceMediaWatcherService.onMediaQueryChange$(["(prefers-color-scheme: dark)", "(prefers-color-scheme: light)"])
5784
5875
  ]).pipe(takeUntil(this._unsubscribeAll), map(([config, mql]) => {
5785
5876
  const options = {
5786
5877
  scheme: config.scheme,
5787
5878
  theme: config.theme
5788
5879
  };
5789
5880
  if (config.scheme === "auto") {
5790
- options.scheme = (mql === null || mql === void 0 ? void 0 : mql.breakpoints["(prefers-color-scheme: dark)"]) ? "dark" : "light";
5881
+ options.scheme = mql.breakpoints["(prefers-color-scheme: dark)"] ? "dark" : "light";
5791
5882
  }
5792
5883
  return options;
5793
5884
  })).subscribe((options) => {
@@ -5838,14 +5929,12 @@ class NiceLayoutComponent {
5838
5929
  }
5839
5930
  }
5840
5931
  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 });
5841
- NiceLayoutComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: NiceLayoutComponent, selector: "nice-layout", ngImport: i0, template: `
5842
- <ng-content></ng-content>`, isInline: true });
5932
+ 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 });
5843
5933
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceLayoutComponent, decorators: [{
5844
5934
  type: Component,
5845
5935
  args: [{
5846
5936
  selector: "nice-layout",
5847
- template: `
5848
- <ng-content></ng-content>`
5937
+ template: `<ng-content></ng-content>`
5849
5938
  }]
5850
5939
  }], ctorParameters: function () {
5851
5940
  return [{ type: undefined, decorators: [{
@@ -9592,5 +9681,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImpor
9592
9681
  * Generated bundle index. Do not edit.
9593
9682
  */
9594
9683
 
9595
- 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 };
9684
+ 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 };
9596
9685
  //# sourceMappingURL=recursyve-nice-ui-kit.v2.mjs.map