@ecodev/natural 45.3.0 → 45.4.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.
- package/esm2020/lib/modules/table-button/table-button.component.mjs +5 -4
- package/esm2020/lib/services/persistence.service.mjs +26 -18
- package/esm2020/public-api.mjs +2 -2
- package/fesm2015/ecodev-natural.mjs +31 -21
- package/fesm2015/ecodev-natural.mjs.map +1 -1
- package/fesm2020/ecodev-natural.mjs +30 -21
- package/fesm2020/ecodev-natural.mjs.map +1 -1
- package/lib/modules/table-button/table-button.component.d.ts +4 -3
- package/lib/services/persistence.service.d.ts +17 -5
- package/package.json +1 -1
- package/public-api.d.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '@angular/localize/init';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { Directive, Component, Inject, Injectable, HostBinding, HostListener, InjectionToken, Input, NgModule, EventEmitter, ChangeDetectionStrategy, Output, ContentChildren, Pipe,
|
|
3
|
+
import { Directive, Component, Inject, Injectable, HostBinding, HostListener, InjectionToken, Optional, Input, NgModule, EventEmitter, ChangeDetectionStrategy, Output, ContentChildren, Pipe, TemplateRef, ViewEncapsulation, ViewChild, Injector, Self, ContentChild, createEnvironmentInjector, createComponent, PLATFORM_ID, ErrorHandler } from '@angular/core';
|
|
4
4
|
import { Subject, BehaviorSubject, of, timer, switchMap as switchMap$1, endWith, last, EMPTY, Observable, first as first$1, combineLatest, ReplaySubject, debounceTime as debounceTime$1, raceWith, take as take$1, mergeMap, shareReplay as shareReplay$1, catchError, forkJoin, map as map$1, merge as merge$1, tap as tap$1, asyncScheduler, takeUntil as takeUntil$1 } from 'rxjs';
|
|
5
5
|
import * as i3 from '@angular/forms';
|
|
6
6
|
import { FormGroup, FormArray, Validators, UntypedFormGroup, UntypedFormArray, UntypedFormControl, FormsModule, FormControl, FormControlDirective, FormControlName, ReactiveFormsModule } from '@angular/forms';
|
|
@@ -2789,10 +2789,14 @@ const memoryLocalStorageProvider = {
|
|
|
2789
2789
|
useClass: NaturalMemoryStorage,
|
|
2790
2790
|
};
|
|
2791
2791
|
|
|
2792
|
+
const PERSISTENCE_VALIDATOR = new InjectionToken('Validator for persisted value retrieved from NaturalPersistenceService. If returns false, the persisted value will never be returned.');
|
|
2792
2793
|
class NaturalPersistenceService {
|
|
2793
|
-
constructor(router, sessionStorage) {
|
|
2794
|
+
constructor(router, sessionStorage, isValid) {
|
|
2794
2795
|
this.router = router;
|
|
2795
2796
|
this.sessionStorage = sessionStorage;
|
|
2797
|
+
this.isValid = isValid;
|
|
2798
|
+
// By default, anything is valid
|
|
2799
|
+
this.isValid = this.isValid ?? (() => true);
|
|
2796
2800
|
}
|
|
2797
2801
|
/**
|
|
2798
2802
|
* Persist in url and local storage the given value with the given key.
|
|
@@ -2829,13 +2833,7 @@ class NaturalPersistenceService {
|
|
|
2829
2833
|
*/
|
|
2830
2834
|
getFromUrl(key, route) {
|
|
2831
2835
|
const value = route.snapshot.paramMap.get(key);
|
|
2832
|
-
|
|
2833
|
-
try {
|
|
2834
|
-
return JSON.parse(value);
|
|
2835
|
-
}
|
|
2836
|
-
catch (e) { }
|
|
2837
|
-
}
|
|
2838
|
-
return null;
|
|
2836
|
+
return this.deserialize(key, null, value);
|
|
2839
2837
|
}
|
|
2840
2838
|
/**
|
|
2841
2839
|
* Add/override given pair key-value in the url
|
|
@@ -2855,13 +2853,7 @@ class NaturalPersistenceService {
|
|
|
2855
2853
|
}
|
|
2856
2854
|
getFromStorage(key, storageKey) {
|
|
2857
2855
|
const value = this.sessionStorage.getItem(this.getStorageKey(key, storageKey));
|
|
2858
|
-
|
|
2859
|
-
try {
|
|
2860
|
-
return JSON.parse(value);
|
|
2861
|
-
}
|
|
2862
|
-
catch (e) { }
|
|
2863
|
-
}
|
|
2864
|
-
return null;
|
|
2856
|
+
return this.deserialize(key, storageKey, value);
|
|
2865
2857
|
}
|
|
2866
2858
|
/**
|
|
2867
2859
|
* Store value in session storage.
|
|
@@ -2884,8 +2876,19 @@ class NaturalPersistenceService {
|
|
|
2884
2876
|
isFalseyValue(value) {
|
|
2885
2877
|
return value == null || value === ''; // == means null or undefined;
|
|
2886
2878
|
}
|
|
2879
|
+
deserialize(key, storageKey, value) {
|
|
2880
|
+
if (!value) {
|
|
2881
|
+
return null;
|
|
2882
|
+
}
|
|
2883
|
+
let result = null;
|
|
2884
|
+
try {
|
|
2885
|
+
result = JSON.parse(value);
|
|
2886
|
+
}
|
|
2887
|
+
catch (e) { }
|
|
2888
|
+
return this.isValid(key, storageKey, result) ? result : null;
|
|
2889
|
+
}
|
|
2887
2890
|
}
|
|
2888
|
-
NaturalPersistenceService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: NaturalPersistenceService, deps: [{ token: i2$1.Router }, { token: SESSION_STORAGE }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2891
|
+
NaturalPersistenceService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: NaturalPersistenceService, deps: [{ token: i2$1.Router }, { token: SESSION_STORAGE }, { token: PERSISTENCE_VALIDATOR, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2889
2892
|
NaturalPersistenceService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: NaturalPersistenceService, providedIn: 'root' });
|
|
2890
2893
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: NaturalPersistenceService, decorators: [{
|
|
2891
2894
|
type: Injectable,
|
|
@@ -2895,6 +2898,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImpor
|
|
|
2895
2898
|
}], ctorParameters: function () { return [{ type: i2$1.Router }, { type: undefined, decorators: [{
|
|
2896
2899
|
type: Inject,
|
|
2897
2900
|
args: [SESSION_STORAGE]
|
|
2901
|
+
}] }, { type: undefined, decorators: [{
|
|
2902
|
+
type: Optional
|
|
2903
|
+
}, {
|
|
2904
|
+
type: Inject,
|
|
2905
|
+
args: [PERSISTENCE_VALIDATOR]
|
|
2898
2906
|
}] }]; } });
|
|
2899
2907
|
|
|
2900
2908
|
/**
|
|
@@ -10154,10 +10162,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImpor
|
|
|
10154
10162
|
|
|
10155
10163
|
/**
|
|
10156
10164
|
* Button that fits well in a `<mat-table>` and support either
|
|
10157
|
-
* route navigation via `navigate
|
|
10165
|
+
* route navigation via `navigate`, or external URL via `href`,
|
|
10166
|
+
* or callback via `buttonClick`.
|
|
10158
10167
|
*
|
|
10159
|
-
* If neither `navigate` nor `href`
|
|
10160
|
-
* it will show the icon and/or label in `<span>` instead of a button
|
|
10168
|
+
* If neither `navigate` nor `href` nor `buttonClick` have a meaningful value, then
|
|
10169
|
+
* it will show the icon and/or label in a `<span>` instead of a button.
|
|
10161
10170
|
*
|
|
10162
10171
|
* External URL will always be opened in new tab.
|
|
10163
10172
|
*/
|
|
@@ -11113,5 +11122,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImpor
|
|
|
11113
11122
|
* Generated bundle index. Do not edit.
|
|
11114
11123
|
*/
|
|
11115
11124
|
|
|
11116
|
-
export { AvatarComponent, AvatarService, FileComponent, IconsConfigService, LOCAL_STORAGE, NATURAL_DROPDOWN_DATA, NATURAL_SEO_CONFIG, NaturalAbstractController, NaturalAbstractDetail, NaturalAbstractEditableList, NaturalAbstractList, NaturalAbstractModelService, NaturalAbstractNavigableList, NaturalAbstractPanel, NaturalAlertModule, NaturalAlertService, NaturalAvatarModule, NaturalCapitalizePipe, NaturalColumnsPickerColumnDirective, NaturalColumnsPickerComponent, NaturalColumnsPickerModule, NaturalCommonModule, NaturalConfirmComponent, NaturalDataSource, NaturalDebounceService, NaturalDetailHeaderComponent, NaturalDetailHeaderModule, NaturalDialogTriggerComponent, NaturalDialogTriggerModule, NaturalDropdownComponentsModule, NaturalDropdownRef, NaturalEllipsisPipe, NaturalEnumPipe, NaturalEnumService, NaturalErrorHandler, NaturalErrorModule, NaturalFileDropDirective, NaturalFileModule, NaturalFileSelectDirective, NaturalFileService, NaturalFixedButtonComponent, NaturalFixedButtonDetailComponent, NaturalFixedButtonDetailModule, NaturalFixedButtonModule, NaturalHierarchicSelectorComponent, NaturalHierarchicSelectorDialogComponent, NaturalHierarchicSelectorDialogService, NaturalHierarchicSelectorModule, NaturalHierarchicSelectorService, NaturalHttpPrefixDirective, NaturalIconComponent, NaturalIconModule, NaturalLinkMutationService, NaturalLinkableTabDirective, NaturalLoggerConfigExtra, NaturalLoggerConfigUrl, NaturalMatomoModule, NaturalMatomoService, NaturalMemoryStorage, NaturalPanelsComponent, NaturalPanelsModule, NaturalPanelsService, NaturalPersistenceService, NaturalQueryVariablesManager, NaturalRelationsComponent, NaturalRelationsModule, NaturalSearchComponent, NaturalSearchModule, NaturalSelectComponent, NaturalSelectEnumComponent, NaturalSelectHierarchicComponent, NaturalSelectModule, NaturalSeoService, NaturalSidenavComponent, NaturalSidenavContainerComponent, NaturalSidenavContentComponent, NaturalSidenavModule, NaturalSidenavService, NaturalSidenavStackService, NaturalSrcDensityDirective, NaturalStampComponent, NaturalStampModule, NaturalSwissDatePipe, NaturalSwissParsingDateAdapter, NaturalTableButtonComponent, NaturalTableButtonModule, NaturalTimeAgoPipe, PanelsHooksConfig, SESSION_STORAGE, SortingOrder, TypeDateComponent, TypeDateRangeComponent, TypeHierarchicSelectorComponent, TypeNaturalSelectComponent, TypeNumberComponent, TypeSelectComponent, TypeTextComponent, available, cancellableTimeout, cleanSameValues, collectErrors, copyToClipboard, debug, decimal, deepFreeze, deliverableEmail, ensureHttpPrefix, fallbackIfNoOpenedPanels, formatIsoDate, formatIsoDateTime, fromUrl, getForegroundColor, hasFilesAndProcessDate, ifValid, integer, localStorageFactory, localStorageProvider, lowerCaseFirstLetter, makePlural, memoryLocalStorageProvider, memorySessionStorageProvider, mergeOverrideArray, money, naturalPanelsUrlMatcher, relationsToIds, replaceObjectKeepingReference, replaceOperatorByField, replaceOperatorByName, sessionStorageFactory, sessionStorageProvider, toGraphQLDoctrineFilter, toNavigationParameters, toUrl, unique, upperCaseFirstLetter, urlValidator, validTlds, validateAllFormControls, wrapLike };
|
|
11125
|
+
export { AvatarComponent, AvatarService, FileComponent, IconsConfigService, LOCAL_STORAGE, NATURAL_DROPDOWN_DATA, NATURAL_SEO_CONFIG, NaturalAbstractController, NaturalAbstractDetail, NaturalAbstractEditableList, NaturalAbstractList, NaturalAbstractModelService, NaturalAbstractNavigableList, NaturalAbstractPanel, NaturalAlertModule, NaturalAlertService, NaturalAvatarModule, NaturalCapitalizePipe, NaturalColumnsPickerColumnDirective, NaturalColumnsPickerComponent, NaturalColumnsPickerModule, NaturalCommonModule, NaturalConfirmComponent, NaturalDataSource, NaturalDebounceService, NaturalDetailHeaderComponent, NaturalDetailHeaderModule, NaturalDialogTriggerComponent, NaturalDialogTriggerModule, NaturalDropdownComponentsModule, NaturalDropdownRef, NaturalEllipsisPipe, NaturalEnumPipe, NaturalEnumService, NaturalErrorHandler, NaturalErrorModule, NaturalFileDropDirective, NaturalFileModule, NaturalFileSelectDirective, NaturalFileService, NaturalFixedButtonComponent, NaturalFixedButtonDetailComponent, NaturalFixedButtonDetailModule, NaturalFixedButtonModule, NaturalHierarchicSelectorComponent, NaturalHierarchicSelectorDialogComponent, NaturalHierarchicSelectorDialogService, NaturalHierarchicSelectorModule, NaturalHierarchicSelectorService, NaturalHttpPrefixDirective, NaturalIconComponent, NaturalIconModule, NaturalLinkMutationService, NaturalLinkableTabDirective, NaturalLoggerConfigExtra, NaturalLoggerConfigUrl, NaturalMatomoModule, NaturalMatomoService, NaturalMemoryStorage, NaturalPanelsComponent, NaturalPanelsModule, NaturalPanelsService, NaturalPersistenceService, NaturalQueryVariablesManager, NaturalRelationsComponent, NaturalRelationsModule, NaturalSearchComponent, NaturalSearchModule, NaturalSelectComponent, NaturalSelectEnumComponent, NaturalSelectHierarchicComponent, NaturalSelectModule, NaturalSeoService, NaturalSidenavComponent, NaturalSidenavContainerComponent, NaturalSidenavContentComponent, NaturalSidenavModule, NaturalSidenavService, NaturalSidenavStackService, NaturalSrcDensityDirective, NaturalStampComponent, NaturalStampModule, NaturalSwissDatePipe, NaturalSwissParsingDateAdapter, NaturalTableButtonComponent, NaturalTableButtonModule, NaturalTimeAgoPipe, PERSISTENCE_VALIDATOR, PanelsHooksConfig, SESSION_STORAGE, SortingOrder, TypeDateComponent, TypeDateRangeComponent, TypeHierarchicSelectorComponent, TypeNaturalSelectComponent, TypeNumberComponent, TypeSelectComponent, TypeTextComponent, available, cancellableTimeout, cleanSameValues, collectErrors, copyToClipboard, debug, decimal, deepFreeze, deliverableEmail, ensureHttpPrefix, fallbackIfNoOpenedPanels, formatIsoDate, formatIsoDateTime, fromUrl, getForegroundColor, hasFilesAndProcessDate, ifValid, integer, localStorageFactory, localStorageProvider, lowerCaseFirstLetter, makePlural, memoryLocalStorageProvider, memorySessionStorageProvider, mergeOverrideArray, money, naturalPanelsUrlMatcher, relationsToIds, replaceObjectKeepingReference, replaceOperatorByField, replaceOperatorByName, sessionStorageFactory, sessionStorageProvider, toGraphQLDoctrineFilter, toNavigationParameters, toUrl, unique, upperCaseFirstLetter, urlValidator, validTlds, validateAllFormControls, wrapLike };
|
|
11117
11126
|
//# sourceMappingURL=ecodev-natural.mjs.map
|