@smartsoft001/angular 2.81.0 → 2.83.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,13 +4,13 @@ import { Title, DomSanitizer } from '@angular/platform-browser';
4
4
  import { Router, NavigationEnd, NavigationStart, NavigationCancel, NavigationError, RouterModule } from '@angular/router';
5
5
  import * as i1 from '@ngx-translate/core';
6
6
  import { TranslateService, TranslateModule, TranslatePipe } from '@ngx-translate/core';
7
- import { BehaviorSubject, firstValueFrom, Subscription, Subject } from 'rxjs';
7
+ import { BehaviorSubject, firstValueFrom, Subscription, Subject, isObservable } from 'rxjs';
8
8
  import { ArrayService, SPECIFICATION_ROOT_KEY, SpecificationService, PeselService, ZipCodeService, ObjectService, NipService } from '@smartsoft001/utils';
9
9
  import * as moment from 'moment';
10
10
  import moment__default from 'moment';
11
11
  import { jwtDecode } from 'jwt-decode';
12
- import { HttpClient, HttpEventType, HttpClientModule } from '@angular/common/http';
13
- import { map, filter, takeUntil, tap, delay, debounceTime, distinctUntilChanged } from 'rxjs/operators';
12
+ import { HttpClient, HttpEventType, HttpErrorResponse, HttpClientModule } from '@angular/common/http';
13
+ import { map, filter, takeUntil, tap, delay, debounceTime, distinctUntilChanged, first, catchError } from 'rxjs/operators';
14
14
  import * as i1$1 from '@angular/forms';
15
15
  import { UntypedFormGroup, UntypedFormBuilder, Validators, ReactiveFormsModule, FormsModule, NG_VALUE_ACCESSOR, UntypedFormControl } from '@angular/forms';
16
16
  import * as i2 from 'ngx-cookie';
@@ -29,6 +29,10 @@ import { CdkTableModule, CdkTable, CdkHeaderCell, CdkCell, CdkHeaderRow, CdkRow
29
29
  import * as i1$2 from 'ng-lazyload-image';
30
30
  import { LazyLoadImageModule } from 'ng-lazyload-image';
31
31
  import { DragDropModule } from '@angular/cdk/drag-drop';
32
+ import * as i1$3 from '@ngrx/effects';
33
+ import { createEffect, EffectsModule } from '@ngrx/effects';
34
+ import * as i1$4 from '@ngrx/store';
35
+ import { Guid } from 'guid-typescript';
32
36
 
33
37
  class AppService {
34
38
  titleService = inject(Title);
@@ -959,6 +963,54 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
959
963
  }]
960
964
  }] });
961
965
 
966
+ class NgrxStoreService {
967
+ static _reducers = {};
968
+ static store = undefined;
969
+ static addReducer(key, reducer) {
970
+ if (!NgrxStoreService._reducers[key]) {
971
+ NgrxStoreService._reducers[key] = reducer;
972
+ NgrxStoreService.store.addReducer(key, reducer);
973
+ console.log(`${NgrxStoreService.name} register reducer ${key}`);
974
+ }
975
+ }
976
+ connect(store) {
977
+ NgrxStoreService.store = store;
978
+ }
979
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: NgrxStoreService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
980
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: NgrxStoreService });
981
+ }
982
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: NgrxStoreService, decorators: [{
983
+ type: Injectable
984
+ }] });
985
+
986
+ class ErrorService {
987
+ toastService;
988
+ translateService;
989
+ constructor(toastService, translateService) {
990
+ this.toastService = toastService;
991
+ this.translateService = translateService;
992
+ }
993
+ async log(obj) {
994
+ let message = '';
995
+ if (obj instanceof HttpErrorResponse) {
996
+ if (obj.error && obj.error.details === 'Invalid username or password') {
997
+ message = await this.translateService
998
+ .get('ERRORS.invalidUsernameOrPassword')
999
+ .toPromise();
1000
+ }
1001
+ }
1002
+ if (!message)
1003
+ message = await this.translateService.get('ERRORS.other').toPromise();
1004
+ console.error(obj);
1005
+ await this.toastService.error({ message });
1006
+ }
1007
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ErrorService, deps: [{ token: ToastService }, { token: i1.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable });
1008
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ErrorService });
1009
+ }
1010
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ErrorService, decorators: [{
1011
+ type: Injectable
1012
+ }], ctorParameters: () => [{ type: ToastService }, { type: i1.TranslateService }] });
1013
+
962
1014
  class AccordionComponent {
963
1015
  show = model(false, ...(ngDevMode ? [{ debugName: "show" }] : []));
964
1016
  update() {
@@ -7146,9 +7198,184 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
7146
7198
  }]
7147
7199
  }], ctorParameters: () => [{ type: i1.TranslateService }] });
7148
7200
 
7201
+ class ErrorEffects {
7202
+ actions$;
7203
+ service;
7204
+ error$ = createEffect(() => this.actions$.pipe(filter((action) => {
7205
+ return action.type.indexOf(' Failure') > -1;
7206
+ }), tap((action) => {
7207
+ this.service.log(action.error).then();
7208
+ })), { dispatch: false });
7209
+ constructor(actions$, service) {
7210
+ this.actions$ = actions$;
7211
+ this.service = service;
7212
+ }
7213
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ErrorEffects, deps: [{ token: i1$3.Actions }, { token: ErrorService }], target: i0.ɵɵFactoryTarget.Injectable });
7214
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ErrorEffects });
7215
+ }
7216
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ErrorEffects, decorators: [{
7217
+ type: Injectable
7218
+ }], ctorParameters: () => [{ type: i1$3.Actions }, { type: ErrorService }] });
7219
+
7220
+ class NgrxSharedModule {
7221
+ constructor(store, storeService) {
7222
+ storeService.connect(store);
7223
+ }
7224
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: NgrxSharedModule, deps: [{ token: i1$4.Store }, { token: NgrxStoreService }], target: i0.ɵɵFactoryTarget.NgModule });
7225
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.0", ngImport: i0, type: NgrxSharedModule, imports: [SharedModule, i1$3.EffectsFeatureModule] });
7226
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: NgrxSharedModule, providers: [NgrxStoreService], imports: [SharedModule, EffectsModule.forFeature([ErrorEffects])] });
7227
+ }
7228
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: NgrxSharedModule, decorators: [{
7229
+ type: NgModule,
7230
+ args: [{
7231
+ providers: [NgrxStoreService],
7232
+ imports: [SharedModule, EffectsModule.forFeature([ErrorEffects])],
7233
+ }]
7234
+ }], ctorParameters: () => [{ type: i1$4.Store }, { type: NgrxStoreService }] });
7235
+
7236
+ const ReduxAction = ReduxActionDecorator;
7237
+ function ReduxActionDecorator(options = {}) {
7238
+ function getActionsNames(target, key) {
7239
+ const base = `${target.constructor.name} ${key}`;
7240
+ return {
7241
+ begin: base,
7242
+ success: `${base} Success`,
7243
+ failure: `${base} Failure`,
7244
+ };
7245
+ }
7246
+ function beginAction(executionId, names, params) {
7247
+ NgrxStoreService.store.dispatch({
7248
+ executionId,
7249
+ type: names.begin,
7250
+ params,
7251
+ });
7252
+ }
7253
+ function errorAction(executionId, names, params, error) {
7254
+ NgrxStoreService.store.dispatch({
7255
+ executionId,
7256
+ type: names.failure,
7257
+ params,
7258
+ error,
7259
+ });
7260
+ }
7261
+ function successAction(executionId, names, result) {
7262
+ NgrxStoreService.store.dispatch({
7263
+ executionId,
7264
+ type: names.success,
7265
+ result,
7266
+ });
7267
+ }
7268
+ return (target, key, desc) => {
7269
+ const names = getActionsNames(target, key);
7270
+ const baseAction = target[key];
7271
+ desc.value = function (...params) {
7272
+ const executionId = Guid.raw();
7273
+ beginAction(executionId, names, params);
7274
+ let result;
7275
+ try {
7276
+ result = baseAction.apply(this, params);
7277
+ }
7278
+ catch (error) {
7279
+ errorAction(executionId, names, params, error);
7280
+ throw error;
7281
+ }
7282
+ if (result instanceof Promise) {
7283
+ result = result
7284
+ .then((r) => {
7285
+ successAction(executionId, names, r);
7286
+ return r;
7287
+ })
7288
+ .catch((e) => {
7289
+ errorAction(executionId, names, params, e);
7290
+ throw e;
7291
+ });
7292
+ }
7293
+ else if (isObservable(result)) {
7294
+ result = result.pipe(first(), tap((r) => {
7295
+ successAction(executionId, names, r);
7296
+ }), catchError((e) => {
7297
+ errorAction(executionId, names, params, e);
7298
+ throw e;
7299
+ }));
7300
+ }
7301
+ else {
7302
+ successAction(executionId, names, result);
7303
+ }
7304
+ return result;
7305
+ };
7306
+ };
7307
+ }
7308
+
7309
+ function ReduxSelect(selectorOrFeature, ...paths) {
7310
+ return function (target, name) {
7311
+ const selectorFnName = '__' + name + '__selector';
7312
+ let fn;
7313
+ // Nothing here? Use propery name as selector
7314
+ if (!selectorOrFeature) {
7315
+ selectorOrFeature = name;
7316
+ }
7317
+ // Handle string vs Selector<TState, TValue>
7318
+ if (typeof selectorOrFeature === 'string') {
7319
+ const propsArray = paths.length
7320
+ ? [selectorOrFeature, ...paths]
7321
+ : selectorOrFeature.split('.');
7322
+ fn = fastPropGetter(propsArray);
7323
+ }
7324
+ else {
7325
+ fn = selectorOrFeature;
7326
+ }
7327
+ const createSelect = () => {
7328
+ const store = NgrxStoreService.store;
7329
+ if (!store) {
7330
+ throw new Error('NgrxSelect not connected to store!');
7331
+ }
7332
+ return store.select(fn);
7333
+ };
7334
+ if (target[selectorFnName]) {
7335
+ throw new Error('You cannot use @Select decorator and a ' +
7336
+ selectorFnName +
7337
+ ' property.');
7338
+ }
7339
+ // Redefine property
7340
+ if (delete target[name]) {
7341
+ Object.defineProperty(target, selectorFnName, {
7342
+ writable: true,
7343
+ enumerable: false,
7344
+ configurable: true,
7345
+ });
7346
+ Object.defineProperty(target, name, {
7347
+ get: function () {
7348
+ return (this[selectorFnName] ||
7349
+ (this[selectorFnName] = createSelect.apply(this)));
7350
+ },
7351
+ enumerable: true,
7352
+ configurable: true,
7353
+ });
7354
+ }
7355
+ };
7356
+ }
7357
+ function fastPropGetter(paths) {
7358
+ const segments = paths;
7359
+ let seg = 'store.' + segments[0], i = 0;
7360
+ const l = segments.length;
7361
+ let expr = seg;
7362
+ while (++i < l) {
7363
+ expr = expr + ' && ' + (seg = seg + '.' + segments[i]);
7364
+ }
7365
+ const fn = new Function('store', 'return ' + expr + ';');
7366
+ return fn;
7367
+ }
7368
+
7369
+ const SmartNgModule = SmartNgModuleDecorator;
7370
+ function SmartNgModuleDecorator(options) {
7371
+ return (constructor) => {
7372
+ return NgModule(options)(constructor);
7373
+ };
7374
+ }
7375
+
7149
7376
  /**
7150
7377
  * Generated bundle index. Do not edit.
7151
7378
  */
7152
7379
 
7153
- export { AUTH_TOKEN, AccordionBodyComponent, AccordionComponent, AccordionHeaderComponent, AlertService, AppBaseComponent, AppService, AuthService, BaseComponent, ButtonBaseComponent, ButtonComponent, ButtonStandardComponent, CalendarService, CardComponent, CreateDynamicComponent, DYNAMIC_COMPONENTS_STORE, DateEditComponent, DateRangeComponent, DateRangeModalComponent, DetailAddressComponent, DetailArrayComponent, DetailAttachmentComponent, DetailBaseComponent, DetailColorComponent, DetailComponent, DetailDateRangeComponent, DetailEmailComponent, DetailEnumComponent, DetailFlagComponent, DetailImageComponent, DetailLogoComponent, DetailObjectComponent, DetailPdfComponent, DetailPhoneNumberPlComponent, DetailTextComponent, DetailVideoComponent, DetailsBaseComponent, DetailsComponent, DetailsDirective, DetailsPage, DetailsService, DetailsStandardComponent, DynamicComponentLoader, DynamicComponentStorageService, DynamicContentDirective, EnumToListPipe, ExportComponent, FILE_SERVICE_CONFIG, FileService, FileUrlPipe, FormBaseComponent, FormComponent, FormFactory, FormStandardComponent, HardwareService, IModelExportProvider, IModelImportProvider, IModelLabelProvider, IModelPossibilitiesProvider, IModelValidatorsProvider, ImportComponent, InfoComponent, InfoModalComponent, InputAddressComponent, InputArrayComponent, InputAttachmentComponent, InputBaseComponent, InputCheckComponent, InputColorComponent, InputComponent, InputCurrencyComponent, InputDateComponent, InputDateRangeComponent, InputDateWithEditComponent, InputEmailComponent, InputEnumComponent, InputErrorComponent, InputFileComponent, InputFlagComponent, InputFloatComponent, InputImageComponent, InputIntComponent, InputIntsComponent, InputLogoComponent, InputLongTextComponent, InputNipComponent, InputObjectComponent, InputPasswordComponent, InputPdfComponent, InputPeselComponent, InputPhoneNumberComponent, InputPhoneNumberPlComponent, InputRadioComponent, InputStringsComponent, InputTextComponent, InputVideoComponent, ListBaseComponent, ListCellPipe, ListComponent, ListDesktopComponent, ListHeaderPipe, ListMasonryGridComponent, ListMobileComponent, ListMode, LoaderComponent, MODEL_EXPORT_PROVIDER, MODEL_IMPORT_PROVIDER, MODEL_LABEL_PROVIDER, MODEL_POSSIBILITIES_PROVIDER, MODEL_VALIDATORS_PROVIDER, MenuService, ModalService, ModelLabelPipe, PIPES, PageBaseComponent, PageComponent, PageStandardComponent, PaginationMode, PagingComponent, PasswordStrengthComponent, PopoverService, SearchbarComponent, SharedDirectivesModule, SharedFactoriesModule, SharedModule, SharedPagesModule, SharedPipesModule, SharedServicesModule, SmartFormGroup, StorageService, StyleService, ToastService, TrustHtmlPipe, UIService };
7380
+ export { AUTH_TOKEN, AccordionBodyComponent, AccordionComponent, AccordionHeaderComponent, AlertService, AppBaseComponent, AppService, AuthService, BaseComponent, ButtonBaseComponent, ButtonComponent, ButtonStandardComponent, CalendarService, CardComponent, CreateDynamicComponent, DYNAMIC_COMPONENTS_STORE, DateEditComponent, DateRangeComponent, DateRangeModalComponent, DetailAddressComponent, DetailArrayComponent, DetailAttachmentComponent, DetailBaseComponent, DetailColorComponent, DetailComponent, DetailDateRangeComponent, DetailEmailComponent, DetailEnumComponent, DetailFlagComponent, DetailImageComponent, DetailLogoComponent, DetailObjectComponent, DetailPdfComponent, DetailPhoneNumberPlComponent, DetailTextComponent, DetailVideoComponent, DetailsBaseComponent, DetailsComponent, DetailsDirective, DetailsPage, DetailsService, DetailsStandardComponent, DynamicComponentLoader, DynamicComponentStorageService, DynamicContentDirective, EnumToListPipe, ErrorService, ExportComponent, FILE_SERVICE_CONFIG, FileService, FileUrlPipe, FormBaseComponent, FormComponent, FormFactory, FormStandardComponent, HardwareService, IModelExportProvider, IModelImportProvider, IModelLabelProvider, IModelPossibilitiesProvider, IModelValidatorsProvider, ImportComponent, InfoComponent, InfoModalComponent, InputAddressComponent, InputArrayComponent, InputAttachmentComponent, InputBaseComponent, InputCheckComponent, InputColorComponent, InputComponent, InputCurrencyComponent, InputDateComponent, InputDateRangeComponent, InputDateWithEditComponent, InputEmailComponent, InputEnumComponent, InputErrorComponent, InputFileComponent, InputFlagComponent, InputFloatComponent, InputImageComponent, InputIntComponent, InputIntsComponent, InputLogoComponent, InputLongTextComponent, InputNipComponent, InputObjectComponent, InputPasswordComponent, InputPdfComponent, InputPeselComponent, InputPhoneNumberComponent, InputPhoneNumberPlComponent, InputRadioComponent, InputStringsComponent, InputTextComponent, InputVideoComponent, ListBaseComponent, ListCellPipe, ListComponent, ListDesktopComponent, ListHeaderPipe, ListMasonryGridComponent, ListMobileComponent, ListMode, LoaderComponent, MODEL_EXPORT_PROVIDER, MODEL_IMPORT_PROVIDER, MODEL_LABEL_PROVIDER, MODEL_POSSIBILITIES_PROVIDER, MODEL_VALIDATORS_PROVIDER, MenuService, ModalService, ModelLabelPipe, NgrxSharedModule, NgrxStoreService, PIPES, PageBaseComponent, PageComponent, PageStandardComponent, PaginationMode, PagingComponent, PasswordStrengthComponent, PopoverService, ReduxAction, ReduxActionDecorator, ReduxSelect, SearchbarComponent, SharedDirectivesModule, SharedFactoriesModule, SharedModule, SharedPagesModule, SharedPipesModule, SharedServicesModule, SmartFormGroup, SmartNgModule, SmartNgModuleDecorator, StorageService, StyleService, ToastService, TrustHtmlPipe, UIService, fastPropGetter };
7154
7381
  //# sourceMappingURL=smartsoft001-angular.mjs.map