@seniorsistemas/platform-components 5.3.2 → 5.3.3-develop-73308358
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/esm2022/modules/advanced-filter/advanced-filter.module.mjs +75 -0
- package/esm2022/modules/advanced-filter/components/advanced-filter/advanced-filter.component.mjs +128 -0
- package/esm2022/modules/advanced-filter/components/form-filter/form-filter.component.mjs +651 -0
- package/esm2022/modules/advanced-filter/index.mjs +6 -0
- package/esm2022/modules/advanced-filter/locale/fallback.mjs +73 -0
- package/esm2022/modules/advanced-filter/models/context.mjs +2 -0
- package/esm2022/modules/advanced-filter/models/depends-on.mjs +2 -0
- package/esm2022/modules/advanced-filter/models/enum-item.mjs +2 -0
- package/esm2022/modules/advanced-filter/models/filter-type.mjs +14 -0
- package/esm2022/modules/advanced-filter/models/filter-value.mjs +2 -0
- package/esm2022/modules/advanced-filter/models/filter.mjs +41 -0
- package/esm2022/modules/advanced-filter/models/form-filter.mjs +28 -0
- package/esm2022/modules/advanced-filter/models/index.mjs +11 -0
- package/esm2022/modules/advanced-filter/models/scope.mjs +6 -0
- package/esm2022/modules/advanced-filter/models/search.mjs +2 -0
- package/esm2022/modules/advanced-filter/models/tab-view.mjs +18 -0
- package/esm2022/modules/advanced-filter/models/ticked-filter.mjs +2 -0
- package/esm2022/modules/advanced-filter/pipes/map-values.pipe.mjs +14 -0
- package/esm2022/modules/advanced-filter/pipes/translate.pipe.mjs +19 -0
- package/esm2022/modules/advanced-filter/services/advanced-filter.service.mjs +146 -0
- package/esm2022/modules/advanced-filter/services/calendar-options.service.mjs +77 -0
- package/esm2022/modules/advanced-filter/services/constants.mjs +6 -0
- package/esm2022/modules/advanced-filter/shared/constants.mjs +3 -0
- package/esm2022/modules/advanced-filter/utils/comparator.mjs +53 -0
- package/esm2022/modules/advanced-filter/utils/filter-id/index.mjs +8 -0
- package/esm2022/modules/advanced-filter/utils/filter-value/index.mjs +26 -0
- package/esm2022/modules/advanced-filter/utils/filterOperators.mjs +9 -0
- package/esm2022/modules/advanced-filter/utils/form-field/index.mjs +52 -0
- package/esm2022/modules/advanced-filter/utils/index.mjs +57 -0
- package/esm2022/modules/advanced-filter/utils/json-path.mjs +13 -0
- package/esm2022/modules/cyclic-json-interceptor/cyclic-json-interceptor.module.mjs +14 -0
- package/esm2022/modules/cyclic-json-interceptor/cyclic-json-interceptor.service.mjs +29 -0
- package/esm2022/modules/cyclic-json-interceptor/index.mjs +2 -0
- package/esm2022/modules/feature-toggle/constants/endpoint.constant.mjs +26 -0
- package/esm2022/modules/feature-toggle/feature-toggle.module.mjs +15 -0
- package/esm2022/modules/feature-toggle/feature-toggle.service.mjs +42 -0
- package/esm2022/modules/feature-toggle/index.mjs +4 -0
- package/esm2022/modules/feature-toggle/models/feature.mjs +2 -0
- package/esm2022/modules/http-interceptor/http-interceptor.module.mjs +16 -0
- package/esm2022/modules/http-interceptor/http-interceptor.service.mjs +42 -0
- package/esm2022/modules/http-interceptor/index.mjs +4 -0
- package/esm2022/modules/http-interceptor/rest-url.service.mjs +15 -0
- package/esm2022/modules/http-interceptor/x-services-url.service.mjs +18 -0
- package/esm2022/modules/permissions/permissions.config.mjs +17 -0
- package/esm2022/modules/permissions/permissions.module.mjs +43 -0
- package/esm2022/modules/permissions/permissions.service.mjs +169 -0
- package/esm2022/modules/spotlight/component/spotlight.component.mjs +274 -0
- package/esm2022/modules/spotlight/index.mjs +3 -0
- package/esm2022/modules/spotlight/locale/fallback.mjs +5 -0
- package/esm2022/modules/spotlight/models/display-type.enum.mjs +6 -0
- package/esm2022/modules/spotlight/models/index.mjs +10 -0
- package/esm2022/modules/spotlight/models/spotlight-control-list.interface.mjs +2 -0
- package/esm2022/modules/spotlight/models/spotlight-control.interface.mjs +11 -0
- package/esm2022/modules/spotlight/models/spotlight-notification.interface.mjs +2 -0
- package/esm2022/modules/spotlight/models/spotlight-screen-list.interface.mjs +2 -0
- package/esm2022/modules/spotlight/models/spotlight-screen.interface.mjs +2 -0
- package/esm2022/modules/spotlight/models/spotlight-status.enum.mjs +8 -0
- package/esm2022/modules/spotlight/models/spotlight-user.interface.mjs +2 -0
- package/esm2022/modules/spotlight/models/spotlight-users-list.interface.mjs +2 -0
- package/esm2022/modules/spotlight/models/spotlight.interface.mjs +2 -0
- package/esm2022/modules/spotlight/models/user-action.enum.mjs +7 -0
- package/esm2022/modules/spotlight/pipes/translate.pipe.mjs +19 -0
- package/esm2022/modules/spotlight/service/spotlight.service.mjs +34 -0
- package/esm2022/modules/spotlight/spotlight.module.mjs +53 -0
- package/esm2022/modules/translations/translations.module.mjs +192 -0
- package/esm2022/public-api.mjs +10 -0
- package/esm2022/seniorsistemas-platform-components.mjs +5 -0
- package/fesm2022/seniorsistemas-platform-components.mjs +2432 -0
- package/fesm2022/seniorsistemas-platform-components.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/modules/advanced-filter/advanced-filter.module.d.ts +19 -0
- package/modules/advanced-filter/components/advanced-filter/advanced-filter.component.d.ts +4 -3
- package/modules/advanced-filter/components/form-filter/form-filter.component.d.ts +15 -12
- package/modules/advanced-filter/index.d.ts +1 -0
- package/modules/advanced-filter/models/tab-view.d.ts +1 -1
- package/modules/advanced-filter/pipes/map-values.pipe.d.ts +3 -0
- package/modules/advanced-filter/pipes/translate.pipe.d.ts +4 -3
- package/modules/advanced-filter/services/advanced-filter.service.d.ts +7 -3
- package/modules/advanced-filter/services/calendar-options.service.d.ts +4 -3
- package/modules/advanced-filter/services/constants.d.ts +4 -4
- package/modules/advanced-filter/utils/comparator.d.ts +1 -1
- package/modules/advanced-filter/utils/form-field/index.d.ts +1 -1
- package/modules/advanced-filter/utils/json-path.d.ts +1 -1
- package/modules/cyclic-json-interceptor/cyclic-json-interceptor.module.d.ts +4 -0
- package/modules/cyclic-json-interceptor/cyclic-json-interceptor.service.d.ts +3 -0
- package/modules/feature-toggle/feature-toggle.module.d.ts +5 -0
- package/modules/feature-toggle/feature-toggle.service.d.ts +4 -3
- package/modules/http-interceptor/http-interceptor.module.d.ts +4 -0
- package/modules/http-interceptor/http-interceptor.service.d.ts +3 -3
- package/modules/http-interceptor/rest-url.service.d.ts +3 -0
- package/modules/http-interceptor/x-services-url.service.d.ts +3 -0
- package/modules/permissions/permissions.config.d.ts +7 -1
- package/modules/permissions/permissions.module.d.ts +4 -0
- package/modules/permissions/permissions.service.d.ts +6 -12
- package/modules/spotlight/component/spotlight.component.d.ts +6 -7
- package/modules/spotlight/pipes/translate.pipe.d.ts +4 -3
- package/modules/spotlight/service/spotlight.service.d.ts +4 -3
- package/modules/spotlight/spotlight.module.d.ts +11 -0
- package/modules/translations/translations.module.d.ts +9 -5
- package/package.json +20 -54
- package/public-api.d.ts +1 -0
- package/bundles/seniorsistemas-platform-components.umd.js +0 -2745
- package/bundles/seniorsistemas-platform-components.umd.js.map +0 -1
- package/bundles/seniorsistemas-platform-components.umd.min.js +0 -17
- package/bundles/seniorsistemas-platform-components.umd.min.js.map +0 -1
- package/esm2015/modules/advanced-filter/advanced-filter.module.js +0 -47
- package/esm2015/modules/advanced-filter/components/advanced-filter/advanced-filter.component.js +0 -136
- package/esm2015/modules/advanced-filter/components/form-filter/form-filter.component.js +0 -578
- package/esm2015/modules/advanced-filter/index.js +0 -5
- package/esm2015/modules/advanced-filter/locale/fallback.js +0 -73
- package/esm2015/modules/advanced-filter/models/context.js +0 -1
- package/esm2015/modules/advanced-filter/models/depends-on.js +0 -1
- package/esm2015/modules/advanced-filter/models/enum-item.js +0 -1
- package/esm2015/modules/advanced-filter/models/filter-type.js +0 -14
- package/esm2015/modules/advanced-filter/models/filter-value.js +0 -1
- package/esm2015/modules/advanced-filter/models/filter.js +0 -23
- package/esm2015/modules/advanced-filter/models/form-filter.js +0 -19
- package/esm2015/modules/advanced-filter/models/index.js +0 -5
- package/esm2015/modules/advanced-filter/models/scope.js +0 -6
- package/esm2015/modules/advanced-filter/models/search.js +0 -1
- package/esm2015/modules/advanced-filter/models/tab-view.js +0 -18
- package/esm2015/modules/advanced-filter/models/ticked-filter.js +0 -1
- package/esm2015/modules/advanced-filter/pipes/map-values.pipe.js +0 -12
- package/esm2015/modules/advanced-filter/pipes/translate.pipe.js +0 -22
- package/esm2015/modules/advanced-filter/services/advanced-filter.service.js +0 -141
- package/esm2015/modules/advanced-filter/services/calendar-options.service.js +0 -81
- package/esm2015/modules/advanced-filter/services/constants.js +0 -6
- package/esm2015/modules/advanced-filter/shared/constants.js +0 -3
- package/esm2015/modules/advanced-filter/utils/comparator.js +0 -55
- package/esm2015/modules/advanced-filter/utils/filter-id/index.js +0 -8
- package/esm2015/modules/advanced-filter/utils/filter-value/index.js +0 -24
- package/esm2015/modules/advanced-filter/utils/filterOperators.js +0 -11
- package/esm2015/modules/advanced-filter/utils/form-field/index.js +0 -50
- package/esm2015/modules/advanced-filter/utils/index.js +0 -57
- package/esm2015/modules/advanced-filter/utils/json-path.js +0 -12
- package/esm2015/modules/cyclic-json-interceptor/cyclic-json-interceptor.module.js +0 -14
- package/esm2015/modules/cyclic-json-interceptor/cyclic-json-interceptor.service.js +0 -27
- package/esm2015/modules/cyclic-json-interceptor/index.js +0 -2
- package/esm2015/modules/feature-toggle/constants/endpoint.constant.js +0 -26
- package/esm2015/modules/feature-toggle/feature-toggle.module.js +0 -15
- package/esm2015/modules/feature-toggle/feature-toggle.service.js +0 -48
- package/esm2015/modules/feature-toggle/index.js +0 -3
- package/esm2015/modules/feature-toggle/models/feature.js +0 -1
- package/esm2015/modules/http-interceptor/http-interceptor.module.js +0 -16
- package/esm2015/modules/http-interceptor/http-interceptor.service.js +0 -47
- package/esm2015/modules/http-interceptor/index.js +0 -4
- package/esm2015/modules/http-interceptor/rest-url.service.js +0 -14
- package/esm2015/modules/http-interceptor/x-services-url.service.js +0 -17
- package/esm2015/modules/permissions/permissions.config.js +0 -11
- package/esm2015/modules/permissions/permissions.module.js +0 -42
- package/esm2015/modules/permissions/permissions.service.js +0 -196
- package/esm2015/modules/spotlight/component/spotlight.component.js +0 -274
- package/esm2015/modules/spotlight/index.js +0 -3
- package/esm2015/modules/spotlight/locale/fallback.js +0 -5
- package/esm2015/modules/spotlight/models/display-type.enum.js +0 -6
- package/esm2015/modules/spotlight/models/index.js +0 -4
- package/esm2015/modules/spotlight/models/spotlight-control-list.interface.js +0 -1
- package/esm2015/modules/spotlight/models/spotlight-control.interface.js +0 -3
- package/esm2015/modules/spotlight/models/spotlight-notification.interface.js +0 -1
- package/esm2015/modules/spotlight/models/spotlight-screen-list.interface.js +0 -1
- package/esm2015/modules/spotlight/models/spotlight-screen.interface.js +0 -1
- package/esm2015/modules/spotlight/models/spotlight-status.enum.js +0 -8
- package/esm2015/modules/spotlight/models/spotlight-user.interface.js +0 -1
- package/esm2015/modules/spotlight/models/spotlight-users-list.interface.js +0 -1
- package/esm2015/modules/spotlight/models/spotlight.interface.js +0 -1
- package/esm2015/modules/spotlight/models/user-action.enum.js +0 -7
- package/esm2015/modules/spotlight/pipes/translate.pipe.js +0 -22
- package/esm2015/modules/spotlight/service/spotlight.service.js +0 -38
- package/esm2015/modules/spotlight/spotlight.module.js +0 -37
- package/esm2015/modules/translations/translations.module.js +0 -182
- package/esm2015/public-api.js +0 -9
- package/esm2015/seniorsistemas-platform-components.js +0 -16
- package/esm5/modules/advanced-filter/advanced-filter.module.js +0 -54
- package/esm5/modules/advanced-filter/components/advanced-filter/advanced-filter.component.js +0 -144
- package/esm5/modules/advanced-filter/components/form-filter/form-filter.component.js +0 -626
- package/esm5/modules/advanced-filter/index.js +0 -5
- package/esm5/modules/advanced-filter/locale/fallback.js +0 -73
- package/esm5/modules/advanced-filter/models/context.js +0 -1
- package/esm5/modules/advanced-filter/models/depends-on.js +0 -1
- package/esm5/modules/advanced-filter/models/enum-item.js +0 -1
- package/esm5/modules/advanced-filter/models/filter-type.js +0 -14
- package/esm5/modules/advanced-filter/models/filter-value.js +0 -1
- package/esm5/modules/advanced-filter/models/filter.js +0 -25
- package/esm5/modules/advanced-filter/models/form-filter.js +0 -25
- package/esm5/modules/advanced-filter/models/index.js +0 -5
- package/esm5/modules/advanced-filter/models/scope.js +0 -6
- package/esm5/modules/advanced-filter/models/search.js +0 -1
- package/esm5/modules/advanced-filter/models/tab-view.js +0 -29
- package/esm5/modules/advanced-filter/models/ticked-filter.js +0 -1
- package/esm5/modules/advanced-filter/pipes/map-values.pipe.js +0 -16
- package/esm5/modules/advanced-filter/pipes/translate.pipe.js +0 -23
- package/esm5/modules/advanced-filter/services/advanced-filter.service.js +0 -152
- package/esm5/modules/advanced-filter/services/calendar-options.service.js +0 -82
- package/esm5/modules/advanced-filter/services/constants.js +0 -6
- package/esm5/modules/advanced-filter/shared/constants.js +0 -3
- package/esm5/modules/advanced-filter/utils/comparator.js +0 -55
- package/esm5/modules/advanced-filter/utils/filter-id/index.js +0 -8
- package/esm5/modules/advanced-filter/utils/filter-value/index.js +0 -25
- package/esm5/modules/advanced-filter/utils/filterOperators.js +0 -11
- package/esm5/modules/advanced-filter/utils/form-field/index.js +0 -52
- package/esm5/modules/advanced-filter/utils/index.js +0 -57
- package/esm5/modules/advanced-filter/utils/json-path.js +0 -12
- package/esm5/modules/cyclic-json-interceptor/cyclic-json-interceptor.module.js +0 -17
- package/esm5/modules/cyclic-json-interceptor/cyclic-json-interceptor.service.js +0 -30
- package/esm5/modules/cyclic-json-interceptor/index.js +0 -2
- package/esm5/modules/feature-toggle/constants/endpoint.constant.js +0 -27
- package/esm5/modules/feature-toggle/feature-toggle.module.js +0 -18
- package/esm5/modules/feature-toggle/feature-toggle.service.js +0 -51
- package/esm5/modules/feature-toggle/index.js +0 -3
- package/esm5/modules/feature-toggle/models/feature.js +0 -1
- package/esm5/modules/http-interceptor/http-interceptor.module.js +0 -19
- package/esm5/modules/http-interceptor/http-interceptor.service.js +0 -49
- package/esm5/modules/http-interceptor/index.js +0 -4
- package/esm5/modules/http-interceptor/rest-url.service.js +0 -17
- package/esm5/modules/http-interceptor/x-services-url.service.js +0 -20
- package/esm5/modules/permissions/permissions.config.js +0 -17
- package/esm5/modules/permissions/permissions.module.js +0 -46
- package/esm5/modules/permissions/permissions.service.js +0 -212
- package/esm5/modules/spotlight/component/spotlight.component.js +0 -300
- package/esm5/modules/spotlight/index.js +0 -3
- package/esm5/modules/spotlight/locale/fallback.js +0 -5
- package/esm5/modules/spotlight/models/display-type.enum.js +0 -6
- package/esm5/modules/spotlight/models/index.js +0 -4
- package/esm5/modules/spotlight/models/spotlight-control-list.interface.js +0 -1
- package/esm5/modules/spotlight/models/spotlight-control.interface.js +0 -7
- package/esm5/modules/spotlight/models/spotlight-notification.interface.js +0 -1
- package/esm5/modules/spotlight/models/spotlight-screen-list.interface.js +0 -1
- package/esm5/modules/spotlight/models/spotlight-screen.interface.js +0 -1
- package/esm5/modules/spotlight/models/spotlight-status.enum.js +0 -8
- package/esm5/modules/spotlight/models/spotlight-user.interface.js +0 -1
- package/esm5/modules/spotlight/models/spotlight-users-list.interface.js +0 -1
- package/esm5/modules/spotlight/models/spotlight.interface.js +0 -1
- package/esm5/modules/spotlight/models/user-action.enum.js +0 -7
- package/esm5/modules/spotlight/pipes/translate.pipe.js +0 -23
- package/esm5/modules/spotlight/service/spotlight.service.js +0 -39
- package/esm5/modules/spotlight/spotlight.module.js +0 -40
- package/esm5/modules/translations/translations.module.js +0 -226
- package/esm5/public-api.js +0 -9
- package/esm5/seniorsistemas-platform-components.js +0 -16
- package/fesm2015/seniorsistemas-platform-components.js +0 -2284
- package/fesm2015/seniorsistemas-platform-components.js.map +0 -1
- package/fesm5/seniorsistemas-platform-components.js +0 -2507
- package/fesm5/seniorsistemas-platform-components.js.map +0 -1
- package/seniorsistemas-platform-components.d.ts +0 -15
- package/seniorsistemas-platform-components.metadata.json +0 -1
|
@@ -0,0 +1,2432 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Pipe, inject, InjectionToken, APP_INITIALIZER, Injector, NgModule, Injectable, ChangeDetectorRef, EventEmitter, Component, Input, Output, HostListener, ViewEncapsulation, ViewChild } from '@angular/core';
|
|
3
|
+
import * as i2 from '@angular/common';
|
|
4
|
+
import { LOCATION_INITIALIZED, CommonModule, DatePipe } from '@angular/common';
|
|
5
|
+
import { FormGroup, FormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
6
|
+
import * as i1$3 from 'primeng/button';
|
|
7
|
+
import { ButtonModule as ButtonModule$1 } from 'primeng/button';
|
|
8
|
+
import * as i1$2 from 'primeng/dialog';
|
|
9
|
+
import { DialogModule } from 'primeng/dialog';
|
|
10
|
+
import * as i1$1 from 'primeng/tabview';
|
|
11
|
+
import { TabViewModule } from 'primeng/tabview';
|
|
12
|
+
import * as i5 from 'primeng/toast';
|
|
13
|
+
import { ToastModule } from 'primeng/toast';
|
|
14
|
+
import * as i2$2 from 'primeng/tooltip';
|
|
15
|
+
import { TooltipModule } from 'primeng/tooltip';
|
|
16
|
+
import * as i2$1 from 'primeng/api';
|
|
17
|
+
import { MessageService } from 'primeng/api';
|
|
18
|
+
import { LocaleService } from '@seniorsistemas/angular-components/locale';
|
|
19
|
+
import * as i4 from '@seniorsistemas/angular-components/empty-state';
|
|
20
|
+
import { EmptyStateModule } from '@seniorsistemas/angular-components/empty-state';
|
|
21
|
+
import * as i3$1 from '@seniorsistemas/angular-components/button';
|
|
22
|
+
import { ButtonModule } from '@seniorsistemas/angular-components/button';
|
|
23
|
+
import * as i3 from '@seniorsistemas/angular-components/dynamic-form';
|
|
24
|
+
import { TextField, FieldType, CurrencyField, SelectField, NumberField, RadioButtonField, CalendarField, AutocompleteField, DynamicFormModule } from '@seniorsistemas/angular-components/dynamic-form';
|
|
25
|
+
import * as i1 from '@ngx-translate/core';
|
|
26
|
+
import { TranslateService, TranslateModule } from '@ngx-translate/core';
|
|
27
|
+
import { HttpClient, provideHttpClient, withInterceptorsFromDi, HttpParams, HttpHeaders, HttpResponse, HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
28
|
+
import { user, service } from '@seniorsistemas/senior-platform-data';
|
|
29
|
+
import { CookieService } from 'ngx-cookie-service';
|
|
30
|
+
import { Subject, BehaviorSubject, Observable, from, defer, forkJoin, throwError, of } from 'rxjs';
|
|
31
|
+
import { map, takeUntil, filter, tap, mergeMap, catchError, shareReplay } from 'rxjs/operators';
|
|
32
|
+
import { Router, NavigationEnd } from '@angular/router';
|
|
33
|
+
import { ToastService } from '@seniorsistemas/angular-components/toast';
|
|
34
|
+
import * as momentNs from 'moment';
|
|
35
|
+
import { contains, equals, clone } from 'ramda';
|
|
36
|
+
import * as jc from 'json-cycle';
|
|
37
|
+
|
|
38
|
+
class MapValuesPipe {
|
|
39
|
+
transform(map, args = null) {
|
|
40
|
+
return Array.from(map.values());
|
|
41
|
+
}
|
|
42
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: MapValuesPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
43
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: MapValuesPipe, name: "mapValues", pure: false });
|
|
44
|
+
}
|
|
45
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: MapValuesPipe, decorators: [{
|
|
46
|
+
type: Pipe,
|
|
47
|
+
args: [{ name: 'mapValues', pure: false }]
|
|
48
|
+
}] });
|
|
49
|
+
|
|
50
|
+
let TranslatePipe$1 = class TranslatePipe {
|
|
51
|
+
translationService = inject(TranslateService);
|
|
52
|
+
transform(value, args) {
|
|
53
|
+
return this.translationService.instant(value);
|
|
54
|
+
}
|
|
55
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TranslatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
56
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: TranslatePipe, name: "translate", pure: false });
|
|
57
|
+
};
|
|
58
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TranslatePipe$1, decorators: [{
|
|
59
|
+
type: Pipe,
|
|
60
|
+
args: [{
|
|
61
|
+
name: 'translate',
|
|
62
|
+
pure: false,
|
|
63
|
+
}]
|
|
64
|
+
}] });
|
|
65
|
+
|
|
66
|
+
const TranslationsConfig = new InjectionToken('translationConfig');
|
|
67
|
+
const USER_INFO = 'com.senior.token';
|
|
68
|
+
const LENGTH_DEFAULT = 2;
|
|
69
|
+
class TranslationsModule {
|
|
70
|
+
static forRoot(translationsConfigs) {
|
|
71
|
+
return {
|
|
72
|
+
ngModule: TranslationsModule,
|
|
73
|
+
providers: [
|
|
74
|
+
{
|
|
75
|
+
provide: APP_INITIALIZER,
|
|
76
|
+
useFactory: factory,
|
|
77
|
+
deps: [TranslateService, Injector, HttpClient, CookieService],
|
|
78
|
+
multi: true
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
provide: TranslationsConfig,
|
|
82
|
+
useValue: translationsConfigs,
|
|
83
|
+
multi: true
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
static forChild(translationsConfigs) {
|
|
89
|
+
return {
|
|
90
|
+
ngModule: TranslationsModule,
|
|
91
|
+
providers: [
|
|
92
|
+
{
|
|
93
|
+
provide: TranslationsConfig,
|
|
94
|
+
useValue: translationsConfigs,
|
|
95
|
+
multi: true
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TranslationsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
101
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: TranslationsModule, imports: [i1.TranslateModule] });
|
|
102
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TranslationsModule, providers: [CookieService, provideHttpClient(withInterceptorsFromDi())], imports: [TranslateModule.forChild()] });
|
|
103
|
+
}
|
|
104
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TranslationsModule, decorators: [{
|
|
105
|
+
type: NgModule,
|
|
106
|
+
args: [{ imports: [TranslateModule.forChild()], providers: [CookieService, provideHttpClient(withInterceptorsFromDi())] }]
|
|
107
|
+
}] });
|
|
108
|
+
function resolveImmediately(resolve) {
|
|
109
|
+
resolve();
|
|
110
|
+
}
|
|
111
|
+
function resolveAfterTranslate(translate, locale, resolve) {
|
|
112
|
+
translate.use(locale).toPromise().then(() => resolve());
|
|
113
|
+
}
|
|
114
|
+
function factory(translate, injector, http, cookieService) {
|
|
115
|
+
async function performInit() {
|
|
116
|
+
let locale = 'pt-BR';
|
|
117
|
+
try {
|
|
118
|
+
const configs = getFlatArray(injector.get(TranslationsConfig, Promise.resolve(null)));
|
|
119
|
+
try {
|
|
120
|
+
let userData = JSON.parse(cookieService.get(USER_INFO));
|
|
121
|
+
if (userDataIsNull(userData)) {
|
|
122
|
+
userData = await user.getUserData();
|
|
123
|
+
}
|
|
124
|
+
locale = getLocale(userData);
|
|
125
|
+
}
|
|
126
|
+
catch (ex) {
|
|
127
|
+
console.warn('Unable to obtain user locale');
|
|
128
|
+
}
|
|
129
|
+
const fallback = configs.reduce((result, cfg) => ({ ...result, ...cfg.fallback }), {});
|
|
130
|
+
const defaultsLanguages = configs.reduce((result, cfg) => ({ ...result, ...cfg.defaultsLanguages }), {});
|
|
131
|
+
translate.setTranslation(locale, fallback);
|
|
132
|
+
translate.setDefaultLang(locale);
|
|
133
|
+
let configTranslate = {};
|
|
134
|
+
if (defaultsLanguages) {
|
|
135
|
+
configTranslate = getConfigTranslate(defaultsLanguages, locale);
|
|
136
|
+
}
|
|
137
|
+
const translationsPromises = configs.map((config) => getTranslationsRequest(config, locale));
|
|
138
|
+
await Promise.all(translationsPromises).then((results) => {
|
|
139
|
+
const usedFallback = translate?.overriden;
|
|
140
|
+
results.forEach((file, index) => {
|
|
141
|
+
setTranslations(file['content'], usedFallback, locale, index, configTranslate.fallbackByLocale);
|
|
142
|
+
});
|
|
143
|
+
return translate.use(locale).toPromise();
|
|
144
|
+
});
|
|
145
|
+
return { success: true, locale };
|
|
146
|
+
}
|
|
147
|
+
catch (_err) {
|
|
148
|
+
return { success: false, locale };
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return () => new Promise((resolve) => {
|
|
152
|
+
const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
|
|
153
|
+
locationInitialized
|
|
154
|
+
.then(() => performInit())
|
|
155
|
+
.then(({ success, locale }) => {
|
|
156
|
+
if (success) {
|
|
157
|
+
resolveImmediately(resolve);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
resolveAfterTranslate(translate, locale, resolve);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
function setTranslations(content, usedFallback, locale, index, fallbackByLocale) {
|
|
165
|
+
if (usedFallback) {
|
|
166
|
+
content && translate.setTranslation(locale, content, true);
|
|
167
|
+
translate.setTranslation(locale, fallbackByLocale, true);
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
if (index === 0) {
|
|
171
|
+
translate.setTranslation(locale, fallbackByLocale, true);
|
|
172
|
+
}
|
|
173
|
+
content && translate.setTranslation(locale, content, true);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
function getTranslationsRequest({ domain, service }, language) {
|
|
177
|
+
return new Promise(async (resolve) => {
|
|
178
|
+
try {
|
|
179
|
+
if (!domain && !service) {
|
|
180
|
+
throw new Error(`domain and service not found`);
|
|
181
|
+
}
|
|
182
|
+
const params = new HttpParams().set('domainName', domain).set('serviceName', service).set('format', 'FLAT_JSON');
|
|
183
|
+
const headers = new HttpHeaders().set('Authorization', await user.getAuthHeader());
|
|
184
|
+
const url = 'platform/translation_hub/queries/getTranslationBundle';
|
|
185
|
+
const bundleFiles = await http
|
|
186
|
+
.get(url, { headers, params })
|
|
187
|
+
.toPromise()
|
|
188
|
+
.then((res) => res.bundleFiles);
|
|
189
|
+
let languageBundle = language && bundleFiles.find((bundle) => bundle.language === language);
|
|
190
|
+
let overriden = false;
|
|
191
|
+
if (!languageBundle) {
|
|
192
|
+
languageBundle = bundleFiles.find((bundle) => bundle.language === 'pt-BR');
|
|
193
|
+
overriden = true;
|
|
194
|
+
}
|
|
195
|
+
if (!languageBundle) {
|
|
196
|
+
return resolve({});
|
|
197
|
+
}
|
|
198
|
+
await http
|
|
199
|
+
.get(languageBundle.url)
|
|
200
|
+
.toPromise()
|
|
201
|
+
.then((result) => {
|
|
202
|
+
const translations = {
|
|
203
|
+
overriden: overriden,
|
|
204
|
+
content: result
|
|
205
|
+
};
|
|
206
|
+
resolve(translations);
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
catch (err) {
|
|
210
|
+
console.warn(`Error getting translation bundle for ${domain}/${service}. Using local fallback.`, err);
|
|
211
|
+
resolve({});
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
function getFlatArray(array) {
|
|
216
|
+
return array.reduce((result, item) => {
|
|
217
|
+
if (Array.isArray(item)) {
|
|
218
|
+
return [...result, ...item];
|
|
219
|
+
}
|
|
220
|
+
return [...result, item];
|
|
221
|
+
}, []);
|
|
222
|
+
}
|
|
223
|
+
function userDataIsNull(data) {
|
|
224
|
+
return !data || Object.keys(data).length === 0;
|
|
225
|
+
}
|
|
226
|
+
function getConfigTranslate(defaultsLanguages, locale) {
|
|
227
|
+
const languages = Object.keys(defaultsLanguages).map((key) => {
|
|
228
|
+
const language = {};
|
|
229
|
+
language['locale'] = key.replace('_', '-');
|
|
230
|
+
language['translation'] = defaultsLanguages[key];
|
|
231
|
+
return language;
|
|
232
|
+
}, []);
|
|
233
|
+
const result = { languages };
|
|
234
|
+
result['foundLocaleUser'] = languages.find((results) => results.locale === locale);
|
|
235
|
+
if (!result['foundLocaleUser']) {
|
|
236
|
+
result['foundLocaleUser'] = languages.find((results) => {
|
|
237
|
+
return results.locale.length === LENGTH_DEFAULT && results.locale === locale.split('-')[0];
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
if (result['foundLocaleUser']) {
|
|
241
|
+
result['fallbackByLocale'] = result['foundLocaleUser']['translation'];
|
|
242
|
+
}
|
|
243
|
+
return result;
|
|
244
|
+
}
|
|
245
|
+
function getLocale(userData) {
|
|
246
|
+
return userData.locale || 'pt-BR';
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const fallback$1 = {
|
|
251
|
+
'platform.filter_service.cancel': 'Cancelar',
|
|
252
|
+
'platform.filter_service.try': 'Tentar Novamente',
|
|
253
|
+
'platform.filter_service.actions': 'Ações',
|
|
254
|
+
'platform.filter_service.save': 'Salvar',
|
|
255
|
+
'platform.filter_service.filter': 'Filtrar',
|
|
256
|
+
'platform.filter_service.error_state': 'O serviço de filtro está indisponível no momento e as informações apresentadas não são as mais recentes. Tente novamente mais tarde.',
|
|
257
|
+
'platform.filter_service.saved_filters_success': 'Filtros salvos com sucesso! Clique em "Filtrar" para visualizar o resultado.',
|
|
258
|
+
'platform.filter_service.saved_filters_error': 'Ocorreu um erro ao tentar salvar os filtros. Verifique os valores e tente novamente.',
|
|
259
|
+
'platform.filter_service.applied_filter_nochange': 'Não houve alterações no filtro.',
|
|
260
|
+
'platform.filter_service.applied_filter_change': 'Filtros aplicados com sucesso!',
|
|
261
|
+
'platform.filter_service.invalid_pattern': 'O valor não atende ao padrão especificado.',
|
|
262
|
+
'platform.filter_service.error_max_value': 'O valor excede o tamanho máximo especificado.',
|
|
263
|
+
'platform.filter_service.error_min_value': 'O valor é menor que o minímo especificado.',
|
|
264
|
+
'platform.filter_service.applied_filters_message': '{{totalActiveFilters}} filtros aplicados',
|
|
265
|
+
'platform.filter_service.applied_filter_message': '{{totalActiveFilters}} filtro aplicado',
|
|
266
|
+
'platform.filter_service.find_suggestions_error': 'Erro ao encontrar sugestões!',
|
|
267
|
+
'platform.filter_service.select': 'Selecionar',
|
|
268
|
+
'platform.filter_service.filters': 'Filtros',
|
|
269
|
+
'platform.filter_service.date_format': 'dd/mm/yy',
|
|
270
|
+
'platform.filter_service.hour_format': '24',
|
|
271
|
+
'platform.filter_service.clear': 'Limpar',
|
|
272
|
+
'platform.filter_service.today': 'Hoje',
|
|
273
|
+
'platform.filter_service.name_january': 'Janeiro',
|
|
274
|
+
'platform.filter_service.name_february': 'Fevereiro',
|
|
275
|
+
'platform.filter_service.name_march': 'Março',
|
|
276
|
+
'platform.filter_service.name_april': 'Abril',
|
|
277
|
+
'platform.filter_service.name_may': 'Maio',
|
|
278
|
+
'platform.filter_service.name_june': 'Junho',
|
|
279
|
+
'platform.filter_service.name_july': 'Julho',
|
|
280
|
+
'platform.filter_service.name_august': 'Agosto',
|
|
281
|
+
'platform.filter_service.name_september': 'Setembro',
|
|
282
|
+
'platform.filter_service.name_october': 'Outubro',
|
|
283
|
+
'platform.filter_service.name_november': 'Novembro',
|
|
284
|
+
'platform.filter_service.name_december': 'Dezembro',
|
|
285
|
+
'platform.filter_service.short_january': 'Jan',
|
|
286
|
+
'platform.filter_service.short_february': 'Fev',
|
|
287
|
+
'platform.filter_service.short_march': 'Mar',
|
|
288
|
+
'platform.filter_service.short_april': 'Abr',
|
|
289
|
+
'platform.filter_service.short_may': 'Mai',
|
|
290
|
+
'platform.filter_service.short_june': 'Jun',
|
|
291
|
+
'platform.filter_service.short_july': 'Jul',
|
|
292
|
+
'platform.filter_service.short_august': 'Ago',
|
|
293
|
+
'platform.filter_service.short_september': 'Set',
|
|
294
|
+
'platform.filter_service.short_october': 'Out',
|
|
295
|
+
'platform.filter_service.short_november': 'Nov',
|
|
296
|
+
'platform.filter_service.short_december': 'Dez',
|
|
297
|
+
'platform.filter_service.name_sunday': 'Domingo',
|
|
298
|
+
'platform.filter_service.name_monday': 'Segunda',
|
|
299
|
+
'platform.filter_service.name_tuesday': 'Terça',
|
|
300
|
+
'platform.filter_service.name_wednesday': 'Quarta',
|
|
301
|
+
'platform.filter_service.name_thursday': 'Quinta',
|
|
302
|
+
'platform.filter_service.name_friday': 'Sexta',
|
|
303
|
+
'platform.filter_service.name_saturday': 'Sábado',
|
|
304
|
+
'platform.filter_service.min_sunday': 'D',
|
|
305
|
+
'platform.filter_service.min_monday': 'S',
|
|
306
|
+
'platform.filter_service.min_tuesday': 'T',
|
|
307
|
+
'platform.filter_service.min_wednesday': 'Q',
|
|
308
|
+
'platform.filter_service.min_thursday': 'Q',
|
|
309
|
+
'platform.filter_service.min_friday': 'S',
|
|
310
|
+
'platform.filter_service.min_saturday': 'S',
|
|
311
|
+
'platform.filter_service.short_sunday': 'Dom',
|
|
312
|
+
'platform.filter_service.short_monday': 'Seg',
|
|
313
|
+
'platform.filter_service.short_tuesday': 'Ter',
|
|
314
|
+
'platform.filter_service.short_wednesday': 'Qua',
|
|
315
|
+
'platform.filter_service.short_thursday': 'Qui',
|
|
316
|
+
'platform.filter_service.short_friday': 'Sex',
|
|
317
|
+
'platform.filter_service.short_saturday': 'Sab',
|
|
318
|
+
'platform.filter_service.yes': 'Sim',
|
|
319
|
+
'platform.filter_service.no': 'Não',
|
|
320
|
+
'platform.filter_service.search_empty_message': 'Nenhum resultado encontrado'
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
const URL_PREFIX = 'platform/filter_service';
|
|
324
|
+
const GET_FILTERS_URL = `${URL_PREFIX}/queries/getFilters`;
|
|
325
|
+
const SAVE_FILTERS_URL = `${URL_PREFIX}/actions/saveUserFilters`;
|
|
326
|
+
const SAVE_TICKED_FILTER_URL = `${URL_PREFIX}/actions/setTicketFilters`;
|
|
327
|
+
const GET_FILTERS_BY_TICKET = `${URL_PREFIX}/queries/getFiltersByTicket`;
|
|
328
|
+
|
|
329
|
+
const searchDisplayName = '$$__displayValue__';
|
|
330
|
+
const searchKeyName = '$$__keyValue__';
|
|
331
|
+
|
|
332
|
+
class AdvancedFilterService {
|
|
333
|
+
http = inject(HttpClient);
|
|
334
|
+
allowedOrigin = window.location.origin;
|
|
335
|
+
filtersObservable = new Subject();
|
|
336
|
+
contextsObservable = new BehaviorSubject([]);
|
|
337
|
+
ticketFilterObservable = new Subject();
|
|
338
|
+
destroy$ = new Subject();
|
|
339
|
+
ticketFilter;
|
|
340
|
+
visible;
|
|
341
|
+
contextsObserver = this.contextsObservable.asObservable();
|
|
342
|
+
filtersObserver = this.filtersObservable.asObservable();
|
|
343
|
+
ticketFilterObserver = this.ticketFilterObservable.asObservable();
|
|
344
|
+
constructor() {
|
|
345
|
+
this.contextsObservable.subscribe(contexts => contexts.length && this.getAndApplyFilters(contexts));
|
|
346
|
+
}
|
|
347
|
+
saveTickedFilters(filters) {
|
|
348
|
+
const requestBody = this.ticketFilter ? { filters, ticketFilter: this.ticketFilter } : { filters };
|
|
349
|
+
this.http
|
|
350
|
+
.post(SAVE_TICKED_FILTER_URL, requestBody)
|
|
351
|
+
.pipe(map(response => response.ticket))
|
|
352
|
+
.subscribe({
|
|
353
|
+
next: ticketFilter => {
|
|
354
|
+
this.ticketFilter = ticketFilter;
|
|
355
|
+
this.ticketFilterObservable.next({ ticketFilter });
|
|
356
|
+
// NOSONAR
|
|
357
|
+
window.parent.postMessage({ message: 'advanced-filter:success', payload: ticketFilter }, this.allowedOrigin);
|
|
358
|
+
},
|
|
359
|
+
error: err => {
|
|
360
|
+
this.ticketFilterObservable.next({ error: true, message: err });
|
|
361
|
+
// NOSONAR
|
|
362
|
+
window.parent.postMessage({ message: 'advanced-filter:error', payload: err }, this.allowedOrigin);
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
addContexts(...contexts) {
|
|
367
|
+
const currentContexts = this.contextsObservable.getValue();
|
|
368
|
+
this.contextsObservable.next([...currentContexts, ...contexts]);
|
|
369
|
+
return Observable.create(() => () => this.removeContexts(contexts));
|
|
370
|
+
}
|
|
371
|
+
removeContexts(contexts) {
|
|
372
|
+
const allContexts = this.contextsObservable.getValue();
|
|
373
|
+
const filteredContexts = allContexts.filter(context => contexts.indexOf(context) === -1);
|
|
374
|
+
this.contextsObservable.next(filteredContexts);
|
|
375
|
+
}
|
|
376
|
+
saveFilters(filters) {
|
|
377
|
+
return this.http.post(SAVE_FILTERS_URL, { filters });
|
|
378
|
+
}
|
|
379
|
+
searchFieldSuggestions(url, params, type) {
|
|
380
|
+
const headers = new HttpHeaders({ 'Content-Type': 'application/json; charset=utf-8' });
|
|
381
|
+
if (type === 'ENTITY') {
|
|
382
|
+
return this.http.get(url, { headers });
|
|
383
|
+
}
|
|
384
|
+
return this.http.post(url, params, { headers });
|
|
385
|
+
}
|
|
386
|
+
tryAgain(serviceContexts) {
|
|
387
|
+
this.getFilters(serviceContexts);
|
|
388
|
+
}
|
|
389
|
+
getAndApplyFilters(serviceContexts) {
|
|
390
|
+
this.getFilters(serviceContexts, true);
|
|
391
|
+
}
|
|
392
|
+
getFilters(serviceContexts, applyFilter) {
|
|
393
|
+
this.http
|
|
394
|
+
.post(GET_FILTERS_URL, { serviceContexts })
|
|
395
|
+
.pipe(map(response => this.mapFilters(response.filters)))
|
|
396
|
+
.subscribe(filters => this.filtersObservable.next({ filters, applyFilter }), //
|
|
397
|
+
//
|
|
398
|
+
err => this.filtersObservable.next({ error: true, message: err }));
|
|
399
|
+
}
|
|
400
|
+
mapFilters(filters) {
|
|
401
|
+
return filters.map(filter => {
|
|
402
|
+
try {
|
|
403
|
+
const value = filter.value && JSON.parse(filter.value);
|
|
404
|
+
if (value && filter.search && filter.search.basicSearch && filter.search.basicSearch.output) {
|
|
405
|
+
this.mapValues(value, filter.search.basicSearch.output.keyFields, filter.search.basicSearch.output.displayFields);
|
|
406
|
+
}
|
|
407
|
+
else if (value && filter.search && filter.search.entitySearch && filter.search.entitySearch.output) {
|
|
408
|
+
this.mapValues(value, filter.search.entitySearch.output.keyFields, filter.search.entitySearch.output.displayFields);
|
|
409
|
+
}
|
|
410
|
+
if (value) {
|
|
411
|
+
if (this.isMultiple(filter)) {
|
|
412
|
+
const valueInText = JSON.stringify(value);
|
|
413
|
+
if ((valueInText.startsWith('[{') && valueInText.endsWith('}]')) || valueInText.length <= 4) {
|
|
414
|
+
filter.value = valueInText;
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
filter.value = JSON.stringify('');
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
else {
|
|
421
|
+
filter.value = JSON.stringify(value);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
catch (ex) {
|
|
426
|
+
console.error(`Global: filter ${filter.name} has value error. `, ex);
|
|
427
|
+
filter.value = JSON.stringify('');
|
|
428
|
+
}
|
|
429
|
+
return filter;
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
isMultiple(filter) {
|
|
433
|
+
return (filter.type === 'SEARCH' &&
|
|
434
|
+
filter.search &&
|
|
435
|
+
((filter.search.basicSearch && filter.search.basicSearch.output && filter.search.basicSearch.output.maxSelectedItems > 1) ||
|
|
436
|
+
(filter.search.entitySearch && filter.search.entitySearch.output && filter.search.entitySearch.output.maxSelectedItems > 1)));
|
|
437
|
+
}
|
|
438
|
+
mapValues(value, keyFields, displayFields) {
|
|
439
|
+
if (Array.isArray(value)) {
|
|
440
|
+
value.forEach(e => {
|
|
441
|
+
this.mapValue(e, keyFields, displayFields);
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
else {
|
|
445
|
+
this.mapValue(value, keyFields, displayFields);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
mapValue(value, keyFields, displayFields) {
|
|
449
|
+
if (!value) {
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
const ids = [];
|
|
453
|
+
const displays = [];
|
|
454
|
+
keyFields.filter(e => value[e] !== undefined).forEach(e => ids.push(value[e]));
|
|
455
|
+
displayFields.filter(e => value[e] !== undefined).forEach(e => displays.push(value[e]));
|
|
456
|
+
if (ids.length > 0 && displays.length > 0) {
|
|
457
|
+
value[searchKeyName] = ids.join(', ');
|
|
458
|
+
value[searchDisplayName] = displays.join(', ');
|
|
459
|
+
}
|
|
460
|
+
else {
|
|
461
|
+
value = [''];
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AdvancedFilterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
465
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AdvancedFilterService });
|
|
466
|
+
}
|
|
467
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AdvancedFilterService, decorators: [{
|
|
468
|
+
type: Injectable
|
|
469
|
+
}], ctorParameters: () => [] });
|
|
470
|
+
|
|
471
|
+
class Filter {
|
|
472
|
+
type;
|
|
473
|
+
required;
|
|
474
|
+
label;
|
|
475
|
+
domain;
|
|
476
|
+
scope;
|
|
477
|
+
name;
|
|
478
|
+
contexts;
|
|
479
|
+
services;
|
|
480
|
+
value;
|
|
481
|
+
enumItems;
|
|
482
|
+
defaultValue;
|
|
483
|
+
search;
|
|
484
|
+
tabIndex;
|
|
485
|
+
minValue;
|
|
486
|
+
maxValue;
|
|
487
|
+
dependsOn;
|
|
488
|
+
mask;
|
|
489
|
+
regExp;
|
|
490
|
+
constructor(type, required, label, domain, scope, name, contexts, services, value, enumItems, defaultValue, search, tabIndex, minValue, maxValue, dependsOn, mask, regExp) {
|
|
491
|
+
this.type = type;
|
|
492
|
+
this.required = required;
|
|
493
|
+
this.label = label;
|
|
494
|
+
this.domain = domain;
|
|
495
|
+
this.scope = scope;
|
|
496
|
+
this.name = name;
|
|
497
|
+
this.contexts = contexts;
|
|
498
|
+
this.services = services;
|
|
499
|
+
this.value = value;
|
|
500
|
+
this.enumItems = enumItems;
|
|
501
|
+
this.defaultValue = defaultValue;
|
|
502
|
+
this.search = search;
|
|
503
|
+
this.tabIndex = tabIndex;
|
|
504
|
+
this.minValue = minValue;
|
|
505
|
+
this.maxValue = maxValue;
|
|
506
|
+
this.dependsOn = dependsOn;
|
|
507
|
+
this.mask = mask;
|
|
508
|
+
this.regExp = regExp;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
var FilterType;
|
|
513
|
+
(function (FilterType) {
|
|
514
|
+
FilterType["STRING"] = "STRING";
|
|
515
|
+
FilterType["BOOLEAN"] = "BOOLEAN";
|
|
516
|
+
FilterType["INTEGER"] = "INTEGER";
|
|
517
|
+
FilterType["DOUBLE"] = "DOUBLE";
|
|
518
|
+
FilterType["DATE"] = "DATE";
|
|
519
|
+
FilterType["DATETIME"] = "DATETIME";
|
|
520
|
+
FilterType["TIME"] = "TIME";
|
|
521
|
+
FilterType["MONEY"] = "MONEY";
|
|
522
|
+
FilterType["ENUMERATION"] = "ENUMERATION";
|
|
523
|
+
FilterType["SEARCH"] = "SEARCH";
|
|
524
|
+
})(FilterType || (FilterType = {}));
|
|
525
|
+
|
|
526
|
+
var Scope;
|
|
527
|
+
(function (Scope) {
|
|
528
|
+
Scope["DOMAIN"] = "DOMAIN";
|
|
529
|
+
Scope["SERVICE"] = "SERVICE";
|
|
530
|
+
})(Scope || (Scope = {}));
|
|
531
|
+
|
|
532
|
+
class FormFilter {
|
|
533
|
+
_value;
|
|
534
|
+
_valueObserver = new Subject();
|
|
535
|
+
valueChanges = this._valueObserver.asObservable();
|
|
536
|
+
name;
|
|
537
|
+
domain;
|
|
538
|
+
contexts;
|
|
539
|
+
services;
|
|
540
|
+
childs;
|
|
541
|
+
dependsOn;
|
|
542
|
+
filterControl;
|
|
543
|
+
type;
|
|
544
|
+
isMultiple;
|
|
545
|
+
defaultValue;
|
|
546
|
+
constructor({ value, ...config }) {
|
|
547
|
+
this._value = value;
|
|
548
|
+
Object.assign(this, config);
|
|
549
|
+
}
|
|
550
|
+
set value(value) {
|
|
551
|
+
this._value = value;
|
|
552
|
+
this._valueObserver.next(value);
|
|
553
|
+
}
|
|
554
|
+
get value() {
|
|
555
|
+
return this._value;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
class TabView {
|
|
560
|
+
fields = [];
|
|
561
|
+
form;
|
|
562
|
+
name;
|
|
563
|
+
constructor(config) {
|
|
564
|
+
this.form = new FormGroup({});
|
|
565
|
+
Object.assign(this, config);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
class ContextTab extends TabView {
|
|
569
|
+
activeFilters = 0;
|
|
570
|
+
domain;
|
|
571
|
+
get label() {
|
|
572
|
+
return `${this.name} (${this.activeFilters})`;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
const FILTER_ID_SEPARATOR = ':';
|
|
577
|
+
function getFilterId(domain, filterName) {
|
|
578
|
+
return `${domain}${FILTER_ID_SEPARATOR}${filterName}`;
|
|
579
|
+
}
|
|
580
|
+
function getTabId(domain, contextId) {
|
|
581
|
+
return `${domain}${FILTER_ID_SEPARATOR}${contextId}`;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
// NOSONAR
|
|
585
|
+
/**
|
|
586
|
+
*@description Necessary because of https://github.com/rollup/rollup/issues/670
|
|
587
|
+
*
|
|
588
|
+
* */
|
|
589
|
+
const moment$1 = momentNs.default || momentNs;
|
|
590
|
+
const { DATETIME: DATETIME$1, TIME: TIME$1, DATE: DATE$1 } = FilterType;
|
|
591
|
+
const parsers$1 = {
|
|
592
|
+
[DATE$1]: (value) => dateParser$1(value, 'YYYY-MM-DD'),
|
|
593
|
+
[TIME$1]: (value) => dateParser$1(value, 'HH:mm:ss'),
|
|
594
|
+
[DATETIME$1]: (value) => dateParser$1(value)
|
|
595
|
+
};
|
|
596
|
+
function parseFilterValue(value, type) {
|
|
597
|
+
const parser = parsers$1[type];
|
|
598
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
599
|
+
return parser ? parser(value) : value;
|
|
600
|
+
}
|
|
601
|
+
return value;
|
|
602
|
+
}
|
|
603
|
+
function dateParser$1(value, format) {
|
|
604
|
+
const date = moment$1(value);
|
|
605
|
+
return format ? date.format(format) : date.format();
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
function jsonPath(obj, path) {
|
|
609
|
+
if (!obj || !path) {
|
|
610
|
+
return undefined;
|
|
611
|
+
}
|
|
612
|
+
const parts = path.replace(/^\$\./, '').split('.');
|
|
613
|
+
const current = parts[0];
|
|
614
|
+
const value = obj[current];
|
|
615
|
+
if (parts.length > 1) {
|
|
616
|
+
return jsonPath(value, parts.slice(1).join('.'));
|
|
617
|
+
}
|
|
618
|
+
return value;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
const filterOperators = {
|
|
622
|
+
'contains': (attr, value) => `containing(${attr}, '${value}')`,
|
|
623
|
+
'=': (attr, value) => `${attr} eq ${value}`,
|
|
624
|
+
'!=': (attr, value) => `${attr} ne ${value}`,
|
|
625
|
+
'>': (attr, value) => `${attr} gt ${value}`,
|
|
626
|
+
'<': (attr, value) => `${attr} lt ${value}`,
|
|
627
|
+
'>=': (attr, value) => `${attr} ge ${value}`
|
|
628
|
+
};
|
|
629
|
+
|
|
630
|
+
function toUserFormat(value, type) {
|
|
631
|
+
let parsedValue;
|
|
632
|
+
if (type !== FilterType.SEARCH || !Array.isArray(value)) {
|
|
633
|
+
parsedValue = [(value === null || value === undefined) ? '' : value];
|
|
634
|
+
}
|
|
635
|
+
else if (Array.isArray(value)) {
|
|
636
|
+
if (value.length) {
|
|
637
|
+
parsedValue = value[0] === null ? [''] : value;
|
|
638
|
+
}
|
|
639
|
+
else {
|
|
640
|
+
parsedValue = [''];
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
else {
|
|
644
|
+
parsedValue = value ? value : [''];
|
|
645
|
+
}
|
|
646
|
+
return JSON.stringify(parsedValue);
|
|
647
|
+
}
|
|
648
|
+
function toFilterFormat(value, type) {
|
|
649
|
+
let parsedValue;
|
|
650
|
+
if (type !== FilterType.SEARCH) {
|
|
651
|
+
parsedValue = [(value === null || value === undefined) ? '' : value];
|
|
652
|
+
}
|
|
653
|
+
else if (Array.isArray(value)) {
|
|
654
|
+
/*
|
|
655
|
+
Deve enviar para o backend o valor contido no keyValue em array.
|
|
656
|
+
|
|
657
|
+
Exemplo:
|
|
658
|
+
Quando tenho dois objetos selecionados [{1,'Base'},{2,'Other'}] deve enviar no padrão: [1,'Base'], [2,'Other']
|
|
659
|
+
*/
|
|
660
|
+
parsedValue = [''];
|
|
661
|
+
if (value !== null && value.length > 0 && value[0] !== '') {
|
|
662
|
+
parsedValue = value.map(v => v[searchKeyName]);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
else {
|
|
666
|
+
parsedValue = [value === null ? '' : value[searchKeyName]];
|
|
667
|
+
}
|
|
668
|
+
return JSON.stringify(parsedValue);
|
|
669
|
+
}
|
|
670
|
+
function fromJson(value, type, isNotMultiple) {
|
|
671
|
+
const parsedValue = JSON.parse(value);
|
|
672
|
+
if (type !== FilterType.SEARCH || isNotMultiple) {
|
|
673
|
+
return parsedValue[0];
|
|
674
|
+
}
|
|
675
|
+
return parsedValue;
|
|
676
|
+
}
|
|
677
|
+
function getSearchType(search) {
|
|
678
|
+
return search.basicSearch ? search.basicSearch : search.entitySearch;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
/* sonar-ignore */
|
|
682
|
+
/**
|
|
683
|
+
*@description Necessary because of https://github.com/rollup/rollup/issues/670
|
|
684
|
+
*
|
|
685
|
+
* */
|
|
686
|
+
const moment = momentNs.default || momentNs;
|
|
687
|
+
const { DATE, DATETIME, TIME } = FilterType;
|
|
688
|
+
const parsers = {
|
|
689
|
+
[DATE]: (v) => dateParser(v),
|
|
690
|
+
[DATETIME]: (v) => dateParser(v),
|
|
691
|
+
[TIME]: (v) => dateParser(v, 'HH:mm:ss')
|
|
692
|
+
};
|
|
693
|
+
function parseFormValue(value, type, search) {
|
|
694
|
+
const parser = parsers[type];
|
|
695
|
+
const parsedValue = JSON.parse(value);
|
|
696
|
+
const isNotMultiple = search && getSearchType(search).output.maxSelectedItems === 1;
|
|
697
|
+
let formValue;
|
|
698
|
+
if ((type === FilterType.INTEGER || type === FilterType.DOUBLE || type === FilterType.MONEY) && parsedValue[0] === '') {
|
|
699
|
+
formValue = null;
|
|
700
|
+
}
|
|
701
|
+
else if (type !== FilterType.SEARCH || isNotMultiple) {
|
|
702
|
+
formValue = parsedValue[0];
|
|
703
|
+
}
|
|
704
|
+
else {
|
|
705
|
+
formValue = parsedValue[0] ? parsedValue : [];
|
|
706
|
+
}
|
|
707
|
+
if (parser) {
|
|
708
|
+
return parser(formValue);
|
|
709
|
+
}
|
|
710
|
+
return formValue;
|
|
711
|
+
}
|
|
712
|
+
function createFormControl({ minValue, maxValue, regExp, value, type, search }) {
|
|
713
|
+
const validators = createValidators(minValue, maxValue, regExp);
|
|
714
|
+
const formValue = parseFormValue(value, type, search);
|
|
715
|
+
return new FormControl(formValue, { validators });
|
|
716
|
+
}
|
|
717
|
+
function createValidators(minValue, maxValue, regExp) {
|
|
718
|
+
const { pattern, min, max } = Validators;
|
|
719
|
+
const validators = [];
|
|
720
|
+
regExp && validators.push(pattern(regExp));
|
|
721
|
+
minValue !== undefined && validators.push(min(minValue));
|
|
722
|
+
maxValue !== undefined && validators.push(max(maxValue));
|
|
723
|
+
return validators;
|
|
724
|
+
}
|
|
725
|
+
function dateParser(value, format) {
|
|
726
|
+
return value !== null && value !== '' ? moment(value, format).toDate() : '';
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
const supportedTypes = [
|
|
730
|
+
FilterType.STRING,
|
|
731
|
+
FilterType.BOOLEAN,
|
|
732
|
+
FilterType.INTEGER,
|
|
733
|
+
FilterType.ENUMERATION,
|
|
734
|
+
FilterType.TIME,
|
|
735
|
+
FilterType.MONEY,
|
|
736
|
+
FilterType.DATETIME,
|
|
737
|
+
FilterType.DATE,
|
|
738
|
+
FilterType.DOUBLE
|
|
739
|
+
];
|
|
740
|
+
const operation = {
|
|
741
|
+
'>': (value, otherValue) => {
|
|
742
|
+
return value > otherValue;
|
|
743
|
+
},
|
|
744
|
+
'<': (value, otherValue) => {
|
|
745
|
+
return value < otherValue;
|
|
746
|
+
},
|
|
747
|
+
'>=': (value, otherValue) => {
|
|
748
|
+
return value >= otherValue;
|
|
749
|
+
},
|
|
750
|
+
'<=': (value, otherValue) => {
|
|
751
|
+
return value <= otherValue;
|
|
752
|
+
},
|
|
753
|
+
'contains': (value, otherValue) => {
|
|
754
|
+
return contains(value, otherValue);
|
|
755
|
+
},
|
|
756
|
+
'=': (value, otherValue) => {
|
|
757
|
+
if (typeof otherValue === 'number') {
|
|
758
|
+
return equals(Number(value), otherValue);
|
|
759
|
+
}
|
|
760
|
+
return equals(value, otherValue);
|
|
761
|
+
},
|
|
762
|
+
'!=': (value, otherValue) => {
|
|
763
|
+
if (typeof otherValue === 'number') {
|
|
764
|
+
return !equals(Number(value), otherValue);
|
|
765
|
+
}
|
|
766
|
+
return !equals(value, otherValue);
|
|
767
|
+
}
|
|
768
|
+
};
|
|
769
|
+
function compare(operator, value, otherValue) {
|
|
770
|
+
const comparator = operation[operator];
|
|
771
|
+
return comparator(value, otherValue);
|
|
772
|
+
}
|
|
773
|
+
function isValidOperator(operator) {
|
|
774
|
+
return !!operation[operator];
|
|
775
|
+
}
|
|
776
|
+
function isSupportedType(type) {
|
|
777
|
+
return contains(type, supportedTypes);
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
const TRANSLATE_PREFIX$2 = 'platform.filter_service';
|
|
781
|
+
class CalendarOptionsService {
|
|
782
|
+
translate = inject(TranslateService);
|
|
783
|
+
getOptions() {
|
|
784
|
+
return {
|
|
785
|
+
clear: this.translate.instant(`${TRANSLATE_PREFIX$2}.clear`),
|
|
786
|
+
dateFormat: this.translate.instant(`${TRANSLATE_PREFIX$2}.date_format`),
|
|
787
|
+
dayNames: [
|
|
788
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.name_sunday`),
|
|
789
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.name_monday`),
|
|
790
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.name_tuesday`),
|
|
791
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.name_wednesday`),
|
|
792
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.name_thursday`),
|
|
793
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.name_friday`),
|
|
794
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.name_saturday`)
|
|
795
|
+
],
|
|
796
|
+
dayNamesMin: [
|
|
797
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.min_sunday`),
|
|
798
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.min_monday`),
|
|
799
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.min_tuesday`),
|
|
800
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.min_wednesday`),
|
|
801
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.min_thursday`),
|
|
802
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.min_friday`),
|
|
803
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.min_saturday`)
|
|
804
|
+
],
|
|
805
|
+
dayNamesShort: [
|
|
806
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.short_sunday`),
|
|
807
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.short_monday`),
|
|
808
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.short_tuesday`),
|
|
809
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.short_wednesday`),
|
|
810
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.short_thursday`),
|
|
811
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.short_friday`),
|
|
812
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.short_saturday`)
|
|
813
|
+
],
|
|
814
|
+
firstDayOfWeek: 0,
|
|
815
|
+
hourFormat: this.translate.instant(`${TRANSLATE_PREFIX$2}.hour_format`),
|
|
816
|
+
monthNames: [
|
|
817
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.name_january`),
|
|
818
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.name_february`),
|
|
819
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.name_march`),
|
|
820
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.name_april`),
|
|
821
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.name_may`),
|
|
822
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.name_june`),
|
|
823
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.name_july`),
|
|
824
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.name_august`),
|
|
825
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.name_september`),
|
|
826
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.name_october`),
|
|
827
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.name_november`),
|
|
828
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.name_december`),
|
|
829
|
+
],
|
|
830
|
+
monthNamesShort: [
|
|
831
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.short_january`),
|
|
832
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.short_february`),
|
|
833
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.short_march`),
|
|
834
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.short_april`),
|
|
835
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.short_may`),
|
|
836
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.short_june`),
|
|
837
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.short_july`),
|
|
838
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.short_august`),
|
|
839
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.short_september`),
|
|
840
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.short_october`),
|
|
841
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.short_november`),
|
|
842
|
+
this.translate.instant(`${TRANSLATE_PREFIX$2}.short_december`),
|
|
843
|
+
],
|
|
844
|
+
today: this.translate.instant(`${TRANSLATE_PREFIX$2}.today`)
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CalendarOptionsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
848
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CalendarOptionsService });
|
|
849
|
+
}
|
|
850
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CalendarOptionsService, decorators: [{
|
|
851
|
+
type: Injectable
|
|
852
|
+
}] });
|
|
853
|
+
|
|
854
|
+
const TRANSLATE_PREFIX$1 = 'platform.filter_service';
|
|
855
|
+
const TOAST_LIFE = 5000;
|
|
856
|
+
class FormFilterComponent {
|
|
857
|
+
filterService = inject(AdvancedFilterService);
|
|
858
|
+
translate = inject(TranslateService);
|
|
859
|
+
toastService = inject(ToastService);
|
|
860
|
+
calendarOptionsService = inject(CalendarOptionsService);
|
|
861
|
+
changeDetectorRef = inject(ChangeDetectorRef);
|
|
862
|
+
destroy$ = new Subject();
|
|
863
|
+
errorState;
|
|
864
|
+
tabs;
|
|
865
|
+
contexts = [];
|
|
866
|
+
formFilters = [];
|
|
867
|
+
oldFormFilters = [];
|
|
868
|
+
actualFormFilters = [];
|
|
869
|
+
general = new TabView({ name: 'Geral' });
|
|
870
|
+
totalFiltersActive = 0;
|
|
871
|
+
isMobile = false;
|
|
872
|
+
tabViewOrientation = 'left';
|
|
873
|
+
error = false;
|
|
874
|
+
activeIndex = 0;
|
|
875
|
+
errorMessages = {
|
|
876
|
+
min: this.translate.instant(`${TRANSLATE_PREFIX$1}.error_min_value`),
|
|
877
|
+
max: this.translate.instant(`${TRANSLATE_PREFIX$1}.error_max_value`),
|
|
878
|
+
pattern: this.translate.instant(`${TRANSLATE_PREFIX$1}.invalid_pattern`)
|
|
879
|
+
};
|
|
880
|
+
showMessages = true;
|
|
881
|
+
isModal = false;
|
|
882
|
+
contextId = '';
|
|
883
|
+
totalFiltersActiveOutput = new EventEmitter();
|
|
884
|
+
errorOutput = new EventEmitter();
|
|
885
|
+
showDialogOutput = new EventEmitter();
|
|
886
|
+
closeModalOutput = new EventEmitter();
|
|
887
|
+
onResizeWindow(event) {
|
|
888
|
+
const { innerWidth } = event.target;
|
|
889
|
+
this.isMobile = innerWidth <= 640;
|
|
890
|
+
this.tabViewOrientation = this.isMobile ? 'top' : 'left';
|
|
891
|
+
}
|
|
892
|
+
ngOnInit() {
|
|
893
|
+
this.isMobile = innerWidth <= 640;
|
|
894
|
+
this.tabViewOrientation = this.isMobile ? 'top' : 'left';
|
|
895
|
+
this.subscribeContextsObservable();
|
|
896
|
+
this.subscribeFiltersObservable();
|
|
897
|
+
window.addEventListener('message', event => {
|
|
898
|
+
const data = event.data;
|
|
899
|
+
const message = data.message && data.message.split(':')[1];
|
|
900
|
+
if (message === 'addContext') {
|
|
901
|
+
this.filterService.addContexts(...data.payload);
|
|
902
|
+
}
|
|
903
|
+
});
|
|
904
|
+
}
|
|
905
|
+
ngOnDestroy() {
|
|
906
|
+
this.destroy$.next(true);
|
|
907
|
+
}
|
|
908
|
+
hasChanges() {
|
|
909
|
+
if (!this.oldFormFilters?.length) {
|
|
910
|
+
return true;
|
|
911
|
+
}
|
|
912
|
+
const filtered = this.formFilters.filter((currentFilter, index) => {
|
|
913
|
+
const oldFilter = this.oldFormFilters[index];
|
|
914
|
+
const oldValue = oldFilter ? oldFilter.value : undefined;
|
|
915
|
+
return !equals(currentFilter.value, oldValue);
|
|
916
|
+
});
|
|
917
|
+
return filtered.length > 0;
|
|
918
|
+
}
|
|
919
|
+
onApplyFilters() {
|
|
920
|
+
this.hasChanges() && this.closeModalOutput.emit();
|
|
921
|
+
}
|
|
922
|
+
getFilters() {
|
|
923
|
+
this.hasChanges() && this.filterService.tryAgain(this.contexts);
|
|
924
|
+
}
|
|
925
|
+
applyFilters(showToast = false) {
|
|
926
|
+
if (this.hasChanges()) {
|
|
927
|
+
this.showDialogOutput.emit(false);
|
|
928
|
+
this.counterUpdate();
|
|
929
|
+
const filters = this.getFiltersValues(this.formFilters);
|
|
930
|
+
this.filterService.saveTickedFilters(filters);
|
|
931
|
+
}
|
|
932
|
+
else if (showToast) {
|
|
933
|
+
const message = {
|
|
934
|
+
severity: 'info',
|
|
935
|
+
duration: TOAST_LIFE,
|
|
936
|
+
text: this.translate.instant(`${TRANSLATE_PREFIX$1}.applied_filter_nochange`, { activeFilters: this.totalFiltersActive })
|
|
937
|
+
};
|
|
938
|
+
this.sendMessage(message);
|
|
939
|
+
}
|
|
940
|
+
this.oldFormFilters = clone(this.formFilters);
|
|
941
|
+
}
|
|
942
|
+
getDefaultValue(defaultValue, isMultiple) {
|
|
943
|
+
if (defaultValue === undefined || (isMultiple && defaultValue[0] === '')) {
|
|
944
|
+
return [];
|
|
945
|
+
}
|
|
946
|
+
return defaultValue;
|
|
947
|
+
}
|
|
948
|
+
clearFilters() {
|
|
949
|
+
const keys = Object.keys(this.formFilters);
|
|
950
|
+
keys.forEach(key => this.cleanFieldAndSetDefaultValue(key));
|
|
951
|
+
}
|
|
952
|
+
sendCloseMessage() {
|
|
953
|
+
window.parent.postMessage({
|
|
954
|
+
message: 'dashboard:close-modal',
|
|
955
|
+
payload: {
|
|
956
|
+
modalName: 'advanced-filter-1'
|
|
957
|
+
}
|
|
958
|
+
}, '*');
|
|
959
|
+
}
|
|
960
|
+
sendMessage(message) {
|
|
961
|
+
if (this.showMessages) {
|
|
962
|
+
this.toastService.show(message);
|
|
963
|
+
}
|
|
964
|
+
else {
|
|
965
|
+
window.parent.postMessage({
|
|
966
|
+
message: 'dashboard:toastr',
|
|
967
|
+
payload: {
|
|
968
|
+
type: 'success',
|
|
969
|
+
message: message.detail
|
|
970
|
+
}
|
|
971
|
+
}, '*');
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
saveFilters(forceSave = false) {
|
|
975
|
+
const filters = this.parseToUserFilters(this.formFilters);
|
|
976
|
+
const savedFilterSuccess = () => {
|
|
977
|
+
if (!forceSave) {
|
|
978
|
+
const message = {
|
|
979
|
+
severity: 'info',
|
|
980
|
+
duration: TOAST_LIFE,
|
|
981
|
+
text: this.translate.instant(`${TRANSLATE_PREFIX$1}.saved_filters_success`, { activeFilters: this.totalFiltersActive })
|
|
982
|
+
};
|
|
983
|
+
this.sendMessage(message);
|
|
984
|
+
}
|
|
985
|
+
this.counterUpdate();
|
|
986
|
+
};
|
|
987
|
+
const savedFiltersError = () => {
|
|
988
|
+
const message = {
|
|
989
|
+
severity: 'error',
|
|
990
|
+
duration: TOAST_LIFE,
|
|
991
|
+
text: this.translate.instant(`${TRANSLATE_PREFIX$1}.saved_filters_error`, { activeFilters: this.totalFiltersActive })
|
|
992
|
+
};
|
|
993
|
+
this.sendMessage(message);
|
|
994
|
+
};
|
|
995
|
+
this.filterService
|
|
996
|
+
.saveFilters(filters)
|
|
997
|
+
.subscribe(savedFilterSuccess, savedFiltersError);
|
|
998
|
+
}
|
|
999
|
+
saveFiltersWithCallbackFunction(callbackFunction) {
|
|
1000
|
+
const filters = this.parseToUserFilters(this.formFilters);
|
|
1001
|
+
this.filterService
|
|
1002
|
+
.saveFilters(filters)
|
|
1003
|
+
.subscribe(callbackFunction);
|
|
1004
|
+
}
|
|
1005
|
+
counterUpdate() {
|
|
1006
|
+
this.totalFiltersActive = this.countActiveFilters(this.tabs);
|
|
1007
|
+
this.totalFiltersActiveOutput.emit(this.totalFiltersActive);
|
|
1008
|
+
}
|
|
1009
|
+
countActiveFilters(tabs) {
|
|
1010
|
+
let totalFiltersActive = 0;
|
|
1011
|
+
tabs.forEach(tabView => {
|
|
1012
|
+
const { value } = tabView.form;
|
|
1013
|
+
tabView.activeFilters = Object.keys(value).reduce((appliedFilters, key) => {
|
|
1014
|
+
const filterValue = value[key];
|
|
1015
|
+
const isArray = Array.isArray(filterValue);
|
|
1016
|
+
const isValidArray = isArray && filterValue.length > 0;
|
|
1017
|
+
if (isValidArray || (!isArray && filterValue)) {
|
|
1018
|
+
appliedFilters++;
|
|
1019
|
+
}
|
|
1020
|
+
return appliedFilters;
|
|
1021
|
+
}, 0);
|
|
1022
|
+
totalFiltersActive += tabView.activeFilters;
|
|
1023
|
+
});
|
|
1024
|
+
return totalFiltersActive;
|
|
1025
|
+
}
|
|
1026
|
+
parseToUserFilters(filters) {
|
|
1027
|
+
return filters.reduce((all, filter) => {
|
|
1028
|
+
const { type, services, name, value, domain, contexts } = filter;
|
|
1029
|
+
const filterValue = toUserFormat(value, type);
|
|
1030
|
+
const values = services.map(service => ({ name, service, value: filterValue, domain, contexts }));
|
|
1031
|
+
return [...all, ...values];
|
|
1032
|
+
}, []);
|
|
1033
|
+
}
|
|
1034
|
+
getFiltersValues(filters) {
|
|
1035
|
+
const filtersAsObject = filters;
|
|
1036
|
+
const ids = Object.keys(filtersAsObject);
|
|
1037
|
+
return ids.reduce((all, filterId) => {
|
|
1038
|
+
const { type, services, name, value, domain } = filtersAsObject[filterId];
|
|
1039
|
+
const filterValue = toFilterFormat(value, type);
|
|
1040
|
+
const values = services.map(service => ({ name, service, value: filterValue, domain }));
|
|
1041
|
+
return [...all, ...values];
|
|
1042
|
+
}, []);
|
|
1043
|
+
}
|
|
1044
|
+
subscribeContextsObservable() {
|
|
1045
|
+
const { contextsObserver } = this.filterService;
|
|
1046
|
+
contextsObserver.pipe(takeUntil(this.destroy$)).subscribe((contexts) => (this.contexts = contexts));
|
|
1047
|
+
}
|
|
1048
|
+
errorStateAction() {
|
|
1049
|
+
this.filterService.tryAgain(this.contexts);
|
|
1050
|
+
}
|
|
1051
|
+
subscribeFiltersObservable() {
|
|
1052
|
+
const { filtersObserver } = this.filterService;
|
|
1053
|
+
filtersObserver
|
|
1054
|
+
.pipe(takeUntil(this.destroy$))
|
|
1055
|
+
.subscribe(({ filters, applyFilter, error, message }) => {
|
|
1056
|
+
this.errorOutput.emit(error);
|
|
1057
|
+
this.error = error;
|
|
1058
|
+
this.errorState = message;
|
|
1059
|
+
if (!error) {
|
|
1060
|
+
this.createForm(filters, applyFilter);
|
|
1061
|
+
}
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
createForm(filters, applyFilter) {
|
|
1065
|
+
this.tabs = this.createTabs(filters);
|
|
1066
|
+
this.counterUpdate();
|
|
1067
|
+
this.setDependencies(this.formFilters);
|
|
1068
|
+
this.createChildArray();
|
|
1069
|
+
if (filters.length > 0 && applyFilter) {
|
|
1070
|
+
this.applyFilters();
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
setDependencies(filters) {
|
|
1074
|
+
const filtersMap = {};
|
|
1075
|
+
filters.forEach(f => {
|
|
1076
|
+
const id = getFilterId(f.domain, f.name);
|
|
1077
|
+
filtersMap[id] = f;
|
|
1078
|
+
});
|
|
1079
|
+
const names = Object.keys(filtersMap);
|
|
1080
|
+
const dependencies = from(names).pipe(map(key => filtersMap[key]), filter(({ dependsOn }) => dependsOn && dependsOn.length > 0), tap(({ dependsOn, domain, filterControl }) => {
|
|
1081
|
+
const invalidFilters = dependsOn
|
|
1082
|
+
.filter(dep => dep.required)
|
|
1083
|
+
.filter(dep => {
|
|
1084
|
+
const id = getFilterId(domain, dep.filterName);
|
|
1085
|
+
const formFilter = filtersMap[id];
|
|
1086
|
+
if (!formFilter) {
|
|
1087
|
+
return true;
|
|
1088
|
+
}
|
|
1089
|
+
const { value, type } = formFilter;
|
|
1090
|
+
const { comparator } = dep;
|
|
1091
|
+
if (comparator && isValidOperator(comparator.operator) && isSupportedType(type)) {
|
|
1092
|
+
const fieldValue = parseFilterValue(value, type);
|
|
1093
|
+
return !compare(comparator.operator, comparator.value, fieldValue);
|
|
1094
|
+
}
|
|
1095
|
+
return dep.required ? !formFilter.value : formFilter.value;
|
|
1096
|
+
});
|
|
1097
|
+
if (invalidFilters.length > 0) {
|
|
1098
|
+
filterControl.disable();
|
|
1099
|
+
}
|
|
1100
|
+
}), map(({ domain, dependsOn, filterControl }) => ({ domain, dependsOn, filterControl })));
|
|
1101
|
+
dependencies.subscribe(({ dependsOn, domain, filterControl }) => from(dependsOn)
|
|
1102
|
+
.pipe(filter(dep => dep.required), map(({ filterName }) => getFilterId(domain, filterName)), map(filterId => filtersMap[filterId]), mergeMap(formFilter => from(formFilter.valueChanges || [])), map(val => {
|
|
1103
|
+
const comparation = dependsOn.every(dep => {
|
|
1104
|
+
const filterId = getFilterId(domain, dep.filterName);
|
|
1105
|
+
if (this.formFilters[filterId]) {
|
|
1106
|
+
const type = this.formFilters[filterId].type;
|
|
1107
|
+
const { comparator } = dep;
|
|
1108
|
+
if (comparator && isValidOperator(comparator.operator) && isSupportedType(type)) {
|
|
1109
|
+
const value = parseFilterValue(val, type);
|
|
1110
|
+
return compare(comparator.operator, comparator.value, value);
|
|
1111
|
+
}
|
|
1112
|
+
return true;
|
|
1113
|
+
}
|
|
1114
|
+
return true;
|
|
1115
|
+
});
|
|
1116
|
+
return !this.IsEmpty(val) && comparation ? 'enable' : 'disable';
|
|
1117
|
+
}))
|
|
1118
|
+
.subscribe(status => filterControl[status]()));
|
|
1119
|
+
}
|
|
1120
|
+
addGeneralField(filter) {
|
|
1121
|
+
const { name, domain, type } = filter;
|
|
1122
|
+
const controlName = getFilterId(domain, name);
|
|
1123
|
+
const fieldControl = createFormControl(filter);
|
|
1124
|
+
fieldControl.valueChanges
|
|
1125
|
+
.pipe(takeUntil(this.destroy$), map(v => parseFilterValue(v, type)), tap(value => (this.formFilters[controlName].value = value)))
|
|
1126
|
+
.subscribe(val => this.tabs.forEach(tab => {
|
|
1127
|
+
const control = tab.form.controls[name];
|
|
1128
|
+
if (control && tab.domain === domain) {
|
|
1129
|
+
control.setValue(val, { emitEvent: false });
|
|
1130
|
+
}
|
|
1131
|
+
}));
|
|
1132
|
+
const newFilter = { ...filter, ...{ name: controlName } };
|
|
1133
|
+
const newField = this.createField(newFilter);
|
|
1134
|
+
this.general.form.addControl(controlName, fieldControl);
|
|
1135
|
+
this.general.fields.push(newField);
|
|
1136
|
+
}
|
|
1137
|
+
/*
|
|
1138
|
+
* Verifica os contextos de cada filtro, caso todos os contextos foram informados:
|
|
1139
|
+
* @return true
|
|
1140
|
+
* Caso não tenha nenhum contexto, considera-se por padrão que é todos:
|
|
1141
|
+
* @return true
|
|
1142
|
+
*/
|
|
1143
|
+
containsAllContexts(myContexts) {
|
|
1144
|
+
if (!myContexts.length) {
|
|
1145
|
+
return true;
|
|
1146
|
+
}
|
|
1147
|
+
const allContexts = this.contexts.map(data => data.contextId);
|
|
1148
|
+
return equals(myContexts.sort(), allContexts.sort());
|
|
1149
|
+
}
|
|
1150
|
+
/**
|
|
1151
|
+
*
|
|
1152
|
+
* @todo Refatorar. O método possui muitas responsabilidades
|
|
1153
|
+
*
|
|
1154
|
+
*/
|
|
1155
|
+
createTabs(filters) {
|
|
1156
|
+
return filters.reduce((tabs, filter) => {
|
|
1157
|
+
const { domain, services, name, type, scope, contexts, dependsOn, value, search, defaultValue } = filter;
|
|
1158
|
+
const isNotMultiple = search && getSearchType(search).output.maxSelectedItems === 1;
|
|
1159
|
+
const field = this.createField(filter);
|
|
1160
|
+
const filterId = getFilterId(domain, name);
|
|
1161
|
+
const filterConfig = {
|
|
1162
|
+
domain,
|
|
1163
|
+
contexts,
|
|
1164
|
+
services,
|
|
1165
|
+
name,
|
|
1166
|
+
dependsOn,
|
|
1167
|
+
value: fromJson(value, type, isNotMultiple),
|
|
1168
|
+
type,
|
|
1169
|
+
isMultiple: !isNotMultiple,
|
|
1170
|
+
defaultValue: fromJson(defaultValue, type, isNotMultiple)
|
|
1171
|
+
};
|
|
1172
|
+
this.formFilters[filterId] = new FormFilter(filterConfig);
|
|
1173
|
+
const formFilter = this.formFilters[filterId];
|
|
1174
|
+
if (scope === Scope.DOMAIN && this.containsAllContexts(contexts)) {
|
|
1175
|
+
this.addGeneralField(filter);
|
|
1176
|
+
}
|
|
1177
|
+
contexts.forEach(contextId => {
|
|
1178
|
+
if ((contextId === this.contextId) || (this.contextId === '')) {
|
|
1179
|
+
const tabId = getTabId(domain, contextId);
|
|
1180
|
+
const fieldControl = createFormControl(filter);
|
|
1181
|
+
if (!tabs.has(tabId)) {
|
|
1182
|
+
const { contextLabel } = this.contexts.find(context => context.contextId === contextId);
|
|
1183
|
+
const tab = new ContextTab({ domain, name: contextLabel });
|
|
1184
|
+
tabs.set(tabId, tab);
|
|
1185
|
+
}
|
|
1186
|
+
fieldControl.valueChanges
|
|
1187
|
+
.pipe(takeUntil(this.destroy$))
|
|
1188
|
+
.subscribe((val) => this.updateFilterValue(tabId, name, val, domain, type));
|
|
1189
|
+
const contextTab = tabs.get(tabId);
|
|
1190
|
+
contextTab.fields.push(field);
|
|
1191
|
+
contextTab.form.addControl(filter.name, fieldControl);
|
|
1192
|
+
if (!formFilter.filterControl) {
|
|
1193
|
+
formFilter.filterControl = fieldControl;
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
});
|
|
1197
|
+
return tabs;
|
|
1198
|
+
}, new Map());
|
|
1199
|
+
}
|
|
1200
|
+
updateFilterValue(tabId, filterName, value, domain, type) {
|
|
1201
|
+
const controlOpts = { emitEvent: false };
|
|
1202
|
+
const fieldValue = parseFilterValue(value, type);
|
|
1203
|
+
const filterId = getFilterId(domain, filterName);
|
|
1204
|
+
const generalFieldControl = this.general.form.controls[filterId];
|
|
1205
|
+
this.tabs.forEach(({ form }, key) => {
|
|
1206
|
+
const control = form.controls[filterName];
|
|
1207
|
+
if (tabId !== key && control) {
|
|
1208
|
+
control.setValue(value, controlOpts);
|
|
1209
|
+
}
|
|
1210
|
+
});
|
|
1211
|
+
const { childs } = this.formFilters[filterId];
|
|
1212
|
+
childs && childs.forEach((child) => this.cleanFieldAndSetDefaultValue(child.filter.key));
|
|
1213
|
+
generalFieldControl && generalFieldControl.setValue(value, controlOpts);
|
|
1214
|
+
this.formFilters[filterId].value = fieldValue;
|
|
1215
|
+
}
|
|
1216
|
+
cleanFieldAndSetDefaultValue(key) {
|
|
1217
|
+
const { isMultiple, defaultValue, filterControl, type } = this.formFilters[key];
|
|
1218
|
+
const finalValue = this.getDefaultValue(defaultValue, isMultiple);
|
|
1219
|
+
if (filterControl) {
|
|
1220
|
+
if (type === 'DATE' || (type === 'SEARCH' && isMultiple)) {
|
|
1221
|
+
filterControl.setValue(finalValue);
|
|
1222
|
+
}
|
|
1223
|
+
if (type === 'INTEGER' || type === 'DOUBLE' || type === 'MONEY') {
|
|
1224
|
+
finalValue === '' ? filterControl.setValue(null) : filterControl.setValue(finalValue);
|
|
1225
|
+
}
|
|
1226
|
+
else {
|
|
1227
|
+
filterControl.setValue(finalValue, { onlySelf: true });
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
createChildArray() {
|
|
1232
|
+
const keys = Object.keys(this.formFilters);
|
|
1233
|
+
keys.forEach(key => {
|
|
1234
|
+
const { dependsOn, domain } = this.formFilters[key];
|
|
1235
|
+
dependsOn.forEach((field) => {
|
|
1236
|
+
const filterId = getFilterId(domain, field.filterName);
|
|
1237
|
+
if (this.formFilters[filterId]) {
|
|
1238
|
+
if (!this.formFilters[filterId].childs) {
|
|
1239
|
+
this.formFilters[filterId].childs = [];
|
|
1240
|
+
}
|
|
1241
|
+
this.formFilters[filterId].childs.push({ filter: { key, required: field.required } });
|
|
1242
|
+
}
|
|
1243
|
+
});
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1246
|
+
createField(filter) {
|
|
1247
|
+
const { name, label, enumItems, type, mask } = filter;
|
|
1248
|
+
const translatedEnumItems = enumItems && enumItems.map((item) => ({ label: this.translate.instant(item.label), value: item.value }));
|
|
1249
|
+
const field = { name, label: this.translate.instant(label), placeholder: '' };
|
|
1250
|
+
const creators = {
|
|
1251
|
+
[FilterType.STRING]: () => new TextField({ ...field, mask: mask ? () => mask : null, type: FieldType.String }),
|
|
1252
|
+
[FilterType.MONEY]: () => new CurrencyField({ ...field, type: FieldType.Money }),
|
|
1253
|
+
[FilterType.BOOLEAN]: () => this.createRadioButton({ ...field }),
|
|
1254
|
+
[FilterType.DATE]: () => this.createCalendar({ ...field, type: FieldType.Date }),
|
|
1255
|
+
[FilterType.DATETIME]: () => this.createCalendar({ ...field, type: FieldType.DateTime }),
|
|
1256
|
+
[FilterType.TIME]: () => this.createCalendar({ ...field, type: FieldType.Time }),
|
|
1257
|
+
[FilterType.ENUMERATION]: () => new SelectField({
|
|
1258
|
+
...field,
|
|
1259
|
+
placeholder: this.translate.instant('platform.filter_service.select'),
|
|
1260
|
+
options: [...translatedEnumItems],
|
|
1261
|
+
type: FieldType.Enum
|
|
1262
|
+
}),
|
|
1263
|
+
[FilterType.INTEGER]: () => new NumberField({
|
|
1264
|
+
...field,
|
|
1265
|
+
numberLocaleOptions: this.optionsInteger(),
|
|
1266
|
+
mask: mask ? () => mask : null,
|
|
1267
|
+
type: FieldType.Integer
|
|
1268
|
+
}),
|
|
1269
|
+
[FilterType.DOUBLE]: () => new CurrencyField({ ...field, type: FieldType.Double }),
|
|
1270
|
+
[FilterType.SEARCH]: () => this.createAutocompleteField(field, filter)
|
|
1271
|
+
};
|
|
1272
|
+
return creators[type]();
|
|
1273
|
+
}
|
|
1274
|
+
createRadioButton(field) {
|
|
1275
|
+
const options = [
|
|
1276
|
+
{ label: this.translate.instant(`${TRANSLATE_PREFIX$1}.yes`), value: true },
|
|
1277
|
+
{ label: this.translate.instant(`${TRANSLATE_PREFIX$1}.no`), value: false }
|
|
1278
|
+
];
|
|
1279
|
+
return new RadioButtonField({ ...field, type: FieldType.Radio, options });
|
|
1280
|
+
}
|
|
1281
|
+
createCalendar(config) {
|
|
1282
|
+
const calendar = new CalendarField(config);
|
|
1283
|
+
calendar.calendarLocaleOptions = this.calendarOptionsService.getOptions();
|
|
1284
|
+
if (!this.isModal)
|
|
1285
|
+
calendar.appendTo = 'body';
|
|
1286
|
+
return calendar;
|
|
1287
|
+
}
|
|
1288
|
+
createAutocompleteField(field, { dependsOn, search, domain, name }) {
|
|
1289
|
+
const suggestionsObservable = new BehaviorSubject([]);
|
|
1290
|
+
const { queryParam } = getSearchType(search).input;
|
|
1291
|
+
const { displayFields, keyFields, resultDataJsonPath, displayFieldConcatToken, maxSelectedItems } = getSearchType(search).output;
|
|
1292
|
+
const filterId = getFilterId(domain, name);
|
|
1293
|
+
const suggestionsError = (messageError) => {
|
|
1294
|
+
const messageDetail = messageError ? messageError : this.translate.instant(`${TRANSLATE_PREFIX$1}.find_suggestions_error`, { activeFilters: this.totalFiltersActive });
|
|
1295
|
+
const message = {
|
|
1296
|
+
severity: 'error',
|
|
1297
|
+
duration: TOAST_LIFE,
|
|
1298
|
+
text: messageDetail
|
|
1299
|
+
};
|
|
1300
|
+
this.sendMessage(message);
|
|
1301
|
+
};
|
|
1302
|
+
const onSearch = (val) => {
|
|
1303
|
+
const params = { [queryParam]: val };
|
|
1304
|
+
dependsOn && Object.assign(params, this.getDependenciesValues(dependsOn, domain));
|
|
1305
|
+
const searchUrl = search && search.type === 'ENTITY'
|
|
1306
|
+
? this.getEntitySearchUrl(search.entitySearch.input, val, dependsOn)
|
|
1307
|
+
: getSearchType(search).input.url;
|
|
1308
|
+
this.filterService
|
|
1309
|
+
.searchFieldSuggestions(searchUrl, params, search.type)
|
|
1310
|
+
.pipe(map(response => jsonPath(response, resultDataJsonPath)), map((suggestions) => this.addSuggestionFields(suggestions, displayFields, keyFields, displayFieldConcatToken, filterId)))
|
|
1311
|
+
.subscribe(result => {
|
|
1312
|
+
suggestionsObservable.next(result);
|
|
1313
|
+
this.changeDetectorRef.detectChanges();
|
|
1314
|
+
}, (error) => {
|
|
1315
|
+
let messageError = undefined;
|
|
1316
|
+
if (error && error.error.message)
|
|
1317
|
+
messageError = error.error.message;
|
|
1318
|
+
suggestionsError(messageError);
|
|
1319
|
+
});
|
|
1320
|
+
};
|
|
1321
|
+
return new AutocompleteField({
|
|
1322
|
+
...field,
|
|
1323
|
+
onSearch,
|
|
1324
|
+
appendTo: 'body',
|
|
1325
|
+
suggestionsObservable,
|
|
1326
|
+
displayField: searchDisplayName,
|
|
1327
|
+
dataKey: searchKeyName,
|
|
1328
|
+
multiple: maxSelectedItems > 1,
|
|
1329
|
+
size: { lg: 12, md: 12, xl: 12 },
|
|
1330
|
+
emptyMessage: this.translate.instant(`${TRANSLATE_PREFIX$1}.search_empty_message`)
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
safeReplaceCommas(input, operator) {
|
|
1334
|
+
let output = '';
|
|
1335
|
+
let parenCount = 0;
|
|
1336
|
+
let justAddedOperator = false;
|
|
1337
|
+
for (const char of input) {
|
|
1338
|
+
let charToAdd = char;
|
|
1339
|
+
({ parenCount, justAddedOperator } = this.updateParenAndOperatorState(char, parenCount, justAddedOperator));
|
|
1340
|
+
({ charToAdd, justAddedOperator } = this.processCommaSubstitution(char, parenCount, justAddedOperator, operator, charToAdd));
|
|
1341
|
+
justAddedOperator = this.updateNonCommaOperatorState(char, charToAdd, justAddedOperator);
|
|
1342
|
+
output += charToAdd;
|
|
1343
|
+
}
|
|
1344
|
+
return output;
|
|
1345
|
+
}
|
|
1346
|
+
updateParenAndOperatorState(char, parenCount, justAddedOperator) {
|
|
1347
|
+
if (char === '(') {
|
|
1348
|
+
parenCount++;
|
|
1349
|
+
justAddedOperator = false;
|
|
1350
|
+
}
|
|
1351
|
+
else if (char === ')') {
|
|
1352
|
+
parenCount--;
|
|
1353
|
+
justAddedOperator = false;
|
|
1354
|
+
}
|
|
1355
|
+
else {
|
|
1356
|
+
// Nenhuma ação necessária para outros caracteres
|
|
1357
|
+
}
|
|
1358
|
+
return { parenCount, justAddedOperator };
|
|
1359
|
+
}
|
|
1360
|
+
processCommaSubstitution(char, parenCount, justAddedOperator, operator, charToAdd) {
|
|
1361
|
+
if (char === ',') {
|
|
1362
|
+
if (parenCount === 0) {
|
|
1363
|
+
if (!justAddedOperator) {
|
|
1364
|
+
charToAdd = ` ${operator} `;
|
|
1365
|
+
justAddedOperator = true;
|
|
1366
|
+
}
|
|
1367
|
+
else {
|
|
1368
|
+
charToAdd = '';
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
else {
|
|
1372
|
+
justAddedOperator = false;
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
return { charToAdd, justAddedOperator };
|
|
1376
|
+
}
|
|
1377
|
+
updateNonCommaOperatorState(char, charToAdd, justAddedOperator) {
|
|
1378
|
+
if (char !== ',') {
|
|
1379
|
+
if (charToAdd !== char) {
|
|
1380
|
+
return false;
|
|
1381
|
+
}
|
|
1382
|
+
if (char !== '(' && char !== ')') {
|
|
1383
|
+
return false;
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
return justAddedOperator;
|
|
1387
|
+
}
|
|
1388
|
+
getEntitySearchUrl(search, value, dependsOn) {
|
|
1389
|
+
const { attributes, domainName, entityName, serviceName } = search;
|
|
1390
|
+
const url = `${domainName}/${serviceName}/entities/${entityName}/?filter=`;
|
|
1391
|
+
const filters = attributes.map(attr => filterOperators[attr.comparator](attr.name, value));
|
|
1392
|
+
dependsOn &&
|
|
1393
|
+
dependsOn.forEach(obj => {
|
|
1394
|
+
const filterId = getFilterId(domainName, obj.filterName);
|
|
1395
|
+
const fieldValue = this.formFilters[filterId].value[searchKeyName];
|
|
1396
|
+
filters.push(`${obj.entityAttribute} eq '${fieldValue}'`);
|
|
1397
|
+
});
|
|
1398
|
+
const filtersString = filters.join(',');
|
|
1399
|
+
const finalFilter = this.safeReplaceCommas(filtersString, search.operator);
|
|
1400
|
+
return url.concat(finalFilter);
|
|
1401
|
+
}
|
|
1402
|
+
addSuggestionFields(suggestions, displayFields, keyFields, separator, filterId) {
|
|
1403
|
+
const addValue = (acc, value, token) => (acc ? `${acc}${token}${value}` : value);
|
|
1404
|
+
const result = suggestions.map(suggestion => ({
|
|
1405
|
+
...suggestion,
|
|
1406
|
+
[searchDisplayName]: displayFields.reduce((value, display) => {
|
|
1407
|
+
return addValue(value, this.translate.instant(suggestion[display]), separator);
|
|
1408
|
+
}, ''),
|
|
1409
|
+
[searchKeyName]: keyFields.reduce((value, key) => addValue(value, suggestion[key], ', '), '')
|
|
1410
|
+
}));
|
|
1411
|
+
this.formFilters[filterId].invalidValue = result.length === 0;
|
|
1412
|
+
return result.filter(item => {
|
|
1413
|
+
const { value } = this.formFilters[filterId];
|
|
1414
|
+
if (Array.isArray(value)) {
|
|
1415
|
+
const index = value.findIndex((i) => i.$$__keyValue__ === item.$$__keyValue__);
|
|
1416
|
+
if (index === -1) {
|
|
1417
|
+
return item;
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
else {
|
|
1421
|
+
return item;
|
|
1422
|
+
}
|
|
1423
|
+
});
|
|
1424
|
+
}
|
|
1425
|
+
getDependenciesValues(dependencies, domain) {
|
|
1426
|
+
return dependencies.reduce((params, { filterName }) => {
|
|
1427
|
+
const filterId = getFilterId(domain, filterName);
|
|
1428
|
+
if (this.formFilters[filterId]) {
|
|
1429
|
+
const { value, type } = this.formFilters[filterId];
|
|
1430
|
+
if (type === 'ENUMERATION') {
|
|
1431
|
+
params[filterName] = value;
|
|
1432
|
+
}
|
|
1433
|
+
else {
|
|
1434
|
+
if (Array.isArray(value)) {
|
|
1435
|
+
params[filterName] = value.map(arr => arr[searchKeyName]);
|
|
1436
|
+
}
|
|
1437
|
+
else {
|
|
1438
|
+
params[filterName] = value ? value[searchKeyName] : [''];
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
this.IsEmpty(params[filterName]) && delete params[filterName];
|
|
1442
|
+
}
|
|
1443
|
+
return params;
|
|
1444
|
+
}, {});
|
|
1445
|
+
}
|
|
1446
|
+
/*
|
|
1447
|
+
* Verifica se o valor informado é falso, em arrays, é verificado cada item
|
|
1448
|
+
*/
|
|
1449
|
+
IsEmpty(value) {
|
|
1450
|
+
return Array.isArray(value) ? value.every(data => !data) : !value;
|
|
1451
|
+
}
|
|
1452
|
+
/**
|
|
1453
|
+
* Return format to specify for integer type field
|
|
1454
|
+
*/
|
|
1455
|
+
optionsInteger() {
|
|
1456
|
+
return { currencySymbol: '', decimalSeparator: '', thousandsSeparator: '' };
|
|
1457
|
+
}
|
|
1458
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FormFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1459
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: FormFilterComponent, selector: "s-app-form-filter", inputs: { showMessages: "showMessages", isModal: "isModal", contextId: "contextId" }, outputs: { totalFiltersActiveOutput: "totalFiltersActiveOutput", errorOutput: "errorOutput", showDialogOutput: "showDialogOutput", closeModalOutput: "closeModalOutput" }, host: { listeners: { "window:resize": "onResizeWindow($event)" } }, ngImport: i0, template: "<s-empty-state\n *ngIf=\"error\"\n iconClass=\"fa fa-exclamation-triangle\"\n title=\"{{ errorState?.status }} - {{ errorState?.statusText }}\"\n (primaryAction)=\"errorStateAction()\"\n [primaryActionLabel]=\"translate.instant('platform.filter_service.try')\"\n [description]=\"translate.instant('platform.filter_service.error_state')\"\n></s-empty-state>\n\n<div *ngIf=\"!error\">\n <p-tabView *ngIf=\"tabs && tabs.size > 1\"\n [(activeIndex)]=\"activeIndex\">\n\n <p-tabPanel header=\"{{ general.name }}\" *ngIf=\"general.fields.length\">\n <s-dynamic-form\n [errorMessages]=\"errorMessages\"\n [fields]=\"general.fields\"\n [form]=\"general.form\">\n </s-dynamic-form>\n </p-tabPanel>\n\n <p-tabPanel *ngFor=\"let tab of (tabs | mapValues)\"\n header=\"{{ tab.label }}\">\n <s-dynamic-form\n [errorMessages]=\"errorMessages\"\n [fields]=\"tab.fields\"\n [form]=\"tab.form\">\n </s-dynamic-form>\n </p-tabPanel>\n </p-tabView>\n\n <div *ngIf=\"tabs && tabs.size === 1\">\n <s-dynamic-form\n *ngFor=\"let tab of (tabs | mapValues)\"\n [errorMessages]=\"errorMessages\"\n [fields]=\"tab.fields\"\n [form]=\"tab.form\">\n </s-dynamic-form>\n </div>\n</div>\n", styles: [".filter-dialog{width:800px;top:100px}.filter-dialog>.ui-dialog-content{height:300px;padding:10px!important}@media (min-width: 641px) and (max-width: 1024px){.filter-dialog{width:75%}.filter-dialog>.ui-dialog-content{height:300px}}@media only screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation: portrait){.filter-dialog{width:75%}.filter-dialog>.ui-dialog-content{height:90%}}@media (min-width: 320px) and (max-width: 640px){.filter-dialog{width:95%;left:0;top:0;opacity:1;margin:auto;height:93%}.filter-dialog>.ui-dialog-content{height:85%}}@media (min-width: 320px) and (max-width: 640px) and (max-width: 360px){.filter-dialog button{padding:0!important}.filter-dialog>.ui-dialog-content{height:81%}}\n"], dependencies: [{ kind: "component", type: i1$1.TabView, selector: "p-tabView, p-tabview", inputs: ["style", "styleClass", "controlClose", "scrollable", "activeIndex", "selectOnFocus", "nextButtonAriaLabel", "prevButtonAriaLabel", "autoHideButtons", "tabindex"], outputs: ["onChange", "onClose", "activeIndexChange"] }, { kind: "component", type: i1$1.TabPanel, selector: "p-tabPanel, p-tabpanel", inputs: ["closable", "headerStyle", "headerStyleClass", "cache", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "selected", "disabled", "header", "leftIcon", "rightIcon"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.DynamicFormComponent, selector: "s-dynamic-form", inputs: ["id", "configs", "fields", "form", "errorMessages"] }, { kind: "component", type: i4.EmptyStateComponent, selector: "s-empty-state", inputs: ["id", "title", "iconClass", "description", "showPrimaryAction", "showSecondaryAction", "primaryActionLabel", "secondaryActionLabel", "primaryModel"], outputs: ["primaryAction", "secondaryAction"] }, { kind: "pipe", type: MapValuesPipe, name: "mapValues" }] });
|
|
1460
|
+
}
|
|
1461
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FormFilterComponent, decorators: [{
|
|
1462
|
+
type: Component,
|
|
1463
|
+
args: [{ selector: 's-app-form-filter', template: "<s-empty-state\n *ngIf=\"error\"\n iconClass=\"fa fa-exclamation-triangle\"\n title=\"{{ errorState?.status }} - {{ errorState?.statusText }}\"\n (primaryAction)=\"errorStateAction()\"\n [primaryActionLabel]=\"translate.instant('platform.filter_service.try')\"\n [description]=\"translate.instant('platform.filter_service.error_state')\"\n></s-empty-state>\n\n<div *ngIf=\"!error\">\n <p-tabView *ngIf=\"tabs && tabs.size > 1\"\n [(activeIndex)]=\"activeIndex\">\n\n <p-tabPanel header=\"{{ general.name }}\" *ngIf=\"general.fields.length\">\n <s-dynamic-form\n [errorMessages]=\"errorMessages\"\n [fields]=\"general.fields\"\n [form]=\"general.form\">\n </s-dynamic-form>\n </p-tabPanel>\n\n <p-tabPanel *ngFor=\"let tab of (tabs | mapValues)\"\n header=\"{{ tab.label }}\">\n <s-dynamic-form\n [errorMessages]=\"errorMessages\"\n [fields]=\"tab.fields\"\n [form]=\"tab.form\">\n </s-dynamic-form>\n </p-tabPanel>\n </p-tabView>\n\n <div *ngIf=\"tabs && tabs.size === 1\">\n <s-dynamic-form\n *ngFor=\"let tab of (tabs | mapValues)\"\n [errorMessages]=\"errorMessages\"\n [fields]=\"tab.fields\"\n [form]=\"tab.form\">\n </s-dynamic-form>\n </div>\n</div>\n", styles: [".filter-dialog{width:800px;top:100px}.filter-dialog>.ui-dialog-content{height:300px;padding:10px!important}@media (min-width: 641px) and (max-width: 1024px){.filter-dialog{width:75%}.filter-dialog>.ui-dialog-content{height:300px}}@media only screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation: portrait){.filter-dialog{width:75%}.filter-dialog>.ui-dialog-content{height:90%}}@media (min-width: 320px) and (max-width: 640px){.filter-dialog{width:95%;left:0;top:0;opacity:1;margin:auto;height:93%}.filter-dialog>.ui-dialog-content{height:85%}}@media (min-width: 320px) and (max-width: 640px) and (max-width: 360px){.filter-dialog button{padding:0!important}.filter-dialog>.ui-dialog-content{height:81%}}\n"] }]
|
|
1464
|
+
}], propDecorators: { showMessages: [{
|
|
1465
|
+
type: Input
|
|
1466
|
+
}], isModal: [{
|
|
1467
|
+
type: Input
|
|
1468
|
+
}], contextId: [{
|
|
1469
|
+
type: Input
|
|
1470
|
+
}], totalFiltersActiveOutput: [{
|
|
1471
|
+
type: Output
|
|
1472
|
+
}], errorOutput: [{
|
|
1473
|
+
type: Output
|
|
1474
|
+
}], showDialogOutput: [{
|
|
1475
|
+
type: Output
|
|
1476
|
+
}], closeModalOutput: [{
|
|
1477
|
+
type: Output
|
|
1478
|
+
}], onResizeWindow: [{
|
|
1479
|
+
type: HostListener,
|
|
1480
|
+
args: ['window:resize', ['$event']]
|
|
1481
|
+
}] } });
|
|
1482
|
+
|
|
1483
|
+
const TRANSLATE_PREFIX = 'platform.filter_service';
|
|
1484
|
+
class AdvancedFilterComponent {
|
|
1485
|
+
translate = inject(TranslateService);
|
|
1486
|
+
router = inject(Router);
|
|
1487
|
+
labelButton = 'Filters';
|
|
1488
|
+
onlyContent = false;
|
|
1489
|
+
hideButtons = false;
|
|
1490
|
+
canOpenFilter = true;
|
|
1491
|
+
showActiveFiltersCountBadge = true;
|
|
1492
|
+
filterAndSave = false;
|
|
1493
|
+
contextId = '';
|
|
1494
|
+
subscriptions = [];
|
|
1495
|
+
isMobile = false;
|
|
1496
|
+
tabViewOrientation = 'left';
|
|
1497
|
+
totalFiltersActive = 0;
|
|
1498
|
+
showDialog = false;
|
|
1499
|
+
error = false;
|
|
1500
|
+
currentTicket = '';
|
|
1501
|
+
modalComponent;
|
|
1502
|
+
mobileButtonActions = [
|
|
1503
|
+
{ id: 'save', label: this.translate.instant('save'), command: () => this.modalComponent.saveFilters() },
|
|
1504
|
+
{ id: 'clear', label: this.translate.instant('clear'), command: () => this.modalComponent.clearFilters() }
|
|
1505
|
+
];
|
|
1506
|
+
ngOnInit() {
|
|
1507
|
+
this.isMobile = innerWidth <= 640;
|
|
1508
|
+
this.tabViewOrientation = this.isMobile ? 'top' : 'left';
|
|
1509
|
+
const sub = this.router.events.subscribe(e => {
|
|
1510
|
+
if (e instanceof NavigationEnd) {
|
|
1511
|
+
this.modalComponent.getFilters();
|
|
1512
|
+
}
|
|
1513
|
+
});
|
|
1514
|
+
this.subscriptions.push(sub);
|
|
1515
|
+
}
|
|
1516
|
+
ngOnDestroy() {
|
|
1517
|
+
this.subscriptions.forEach(v => v.unsubscribe());
|
|
1518
|
+
}
|
|
1519
|
+
onResizeWindow(event) {
|
|
1520
|
+
const { innerWidth } = event.target;
|
|
1521
|
+
this.isMobile = innerWidth <= 640;
|
|
1522
|
+
this.tabViewOrientation = this.isMobile ? 'top' : 'left';
|
|
1523
|
+
}
|
|
1524
|
+
get appliedFiltersTooltip() {
|
|
1525
|
+
return this.totalFiltersActive > 1
|
|
1526
|
+
? this.translate.instant(`${TRANSLATE_PREFIX}.applied_filters_message`, { totalActiveFilters: this.totalFiltersActive })
|
|
1527
|
+
: this.translate.instant(`${TRANSLATE_PREFIX}.applied_filter_message`, { totalActiveFilters: this.totalFiltersActive });
|
|
1528
|
+
}
|
|
1529
|
+
onError(event) {
|
|
1530
|
+
this.error = event;
|
|
1531
|
+
}
|
|
1532
|
+
saveFilters(forceSave = false) {
|
|
1533
|
+
this.modalComponent.saveFilters(forceSave);
|
|
1534
|
+
}
|
|
1535
|
+
saveFiltersWithCallbackFunction(callbackFunction) {
|
|
1536
|
+
this.modalComponent.saveFiltersWithCallbackFunction(callbackFunction);
|
|
1537
|
+
}
|
|
1538
|
+
clearFilters() {
|
|
1539
|
+
this.modalComponent.clearFilters();
|
|
1540
|
+
}
|
|
1541
|
+
close() {
|
|
1542
|
+
this.modalComponent.getFilters();
|
|
1543
|
+
window.parent.postMessage({
|
|
1544
|
+
message: 'dashboard:close-modal',
|
|
1545
|
+
payload: {
|
|
1546
|
+
modalName: 'advanced-filter-1'
|
|
1547
|
+
}
|
|
1548
|
+
}, '*');
|
|
1549
|
+
}
|
|
1550
|
+
applyFilters() {
|
|
1551
|
+
if (this.modalComponent.hasChanges()) {
|
|
1552
|
+
this.showDialog = false;
|
|
1553
|
+
}
|
|
1554
|
+
if (this.filterAndSave) {
|
|
1555
|
+
this.modalComponent.saveFilters();
|
|
1556
|
+
}
|
|
1557
|
+
this.modalComponent.applyFilters(true);
|
|
1558
|
+
}
|
|
1559
|
+
onApplyFilters() {
|
|
1560
|
+
if (this.filterAndSave) {
|
|
1561
|
+
this.modalComponent.saveFilters();
|
|
1562
|
+
}
|
|
1563
|
+
this.modalComponent.onApplyFilters();
|
|
1564
|
+
}
|
|
1565
|
+
toggleDialog() {
|
|
1566
|
+
this.showDialog = !this.showDialog;
|
|
1567
|
+
}
|
|
1568
|
+
updateTotalFiltersActive(event) {
|
|
1569
|
+
this.totalFiltersActive = event;
|
|
1570
|
+
}
|
|
1571
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AdvancedFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1572
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: AdvancedFilterComponent, selector: "s-advanced-filter", inputs: { labelButton: "labelButton", onlyContent: "onlyContent", hideButtons: "hideButtons", canOpenFilter: "canOpenFilter", showActiveFiltersCountBadge: "showActiveFiltersCountBadge", filterAndSave: "filterAndSave", contextId: "contextId" }, host: { listeners: { "window:resize": "onResizeWindow($event)" } }, viewQueries: [{ propertyName: "modalComponent", first: true, predicate: FormFilterComponent, descendants: true }], ngImport: i0, template: "<s-button\n *ngIf=\"!onlyContent\"\n [id]=\"'filterButton'\"\n [disabled]=\"!canOpenFilter\"\n (clicked)=\"canOpenFilter ? toggleDialog() : ''\"\n iconClass=\"fa fa-filter\"\n priority=\"default\"\n [label]=\"labelButton\"\n [auxiliary]=\"true\"\n [tooltip]=\"appliedFiltersTooltip\"\n>\n <span\n *ngIf=\"totalFiltersActive && showActiveFiltersCountBadge\"\n class=\"sds-badge-number sds-color-primary custom-badge\"\n >{{ totalFiltersActive }}</span\n >\n</s-button>\n\n<section *ngIf=\"onlyContent\">\n <div class=\"only-content-wrapper\">\n <div class=\"header\">\n <h3>{{ 'platform.filter_service.filters' | translate }}</h3>\n <span (click)=\"close()\" class=\"close_btn pi pi-times\"></span>\n </div>\n <div class=\"app-form-filter\">\n <s-app-form-filter\n [showMessages]=\"false\"\n (totalFiltersActiveOutput)=\"updateTotalFiltersActive($event)\"\n (closeModalOutput)=\"close()\"\n [isModal]=\"false\"\n [contextId]=\"contextId\"\n ></s-app-form-filter>\n </div>\n <div class=\"filter-footer\" *ngIf=\"!error\">\n <s-button\n priority=\"link\"\n [label]=\"translate.instant('platform.filter_service.cancel')\"\n (clicked)=\"close()\"\n ></s-button>\n <s-button\n *ngIf=\"isMobile\"\n priority=\"default\"\n [label]=\"translate.instant('platform.filter_service.actions')\"\n [auxiliary]=\"true\"\n [menuOptions]=\"mobileButtonActions\"\n ></s-button>\n <ng-container *ngIf=\"!isMobile\">\n <s-button\n priority=\"secondary\"\n [label]=\"translate.instant('platform.filter_service.clear')\"\n (clicked)=\"clearFilters()\"\n ></s-button>\n <s-button\n priority=\"secondary\"\n [label]=\"translate.instant('platform.filter_service.save')\"\n (clicked)=\"saveFilters()\"\n ></s-button>\n </ng-container>\n <s-button\n type=\"submit\"\n priority=\"primary\"\n [label]=\"translate.instant('platform.filter_service.filter')\"\n (clicked)=\"onApplyFilters()\"\n ></s-button>\n </div>\n </div>\n</section>\n\n<p-dialog\n *ngIf=\"!onlyContent\"\n appendTo=\"body\"\n styleClass=\"filter-dialog\"\n [draggable]=\"false\"\n [modal]=\"true\"\n [(visible)]=\"showDialog\"\n [blockScroll]=\"true\"\n [closable]=\"false\"\n>\n <ng-template pTemplate=\"header\">\n <div class=\"w-full flex items-center justify-between\">\n <span>{{ 'platform.filter_service.filters' | translate }}</span>\n <span\n (click)=\"toggleDialog(); close()\"\n (keypress)=\"toggleDialog(); close()\"\n class=\"close_btn pi pi-times cursor-pointer\">\n </span>\n </div>\n </ng-template>\n\n <s-app-form-filter\n [showMessages]=\"true\"\n (errorOutput)=\"onError($event)\"\n (totalFiltersActiveOutput)=\"updateTotalFiltersActive($event)\"\n [isModal]=\"true\"\n [contextId]=\"contextId\"\n ></s-app-form-filter>\n\n <ng-template pTemplate=\"footer\">\n <ng-container *ngIf=\"!error && !hideButtons\">\n <s-button\n type=\"submit\"\n priority=\"primary\"\n [label]=\"translate.instant('platform.filter_service.filter')\"\n (clicked)=\"applyFilters()\"\n ></s-button>\n <ng-container *ngIf=\"!isMobile\">\n <s-button\n priority=\"secondary\"\n [label]=\"translate.instant('platform.filter_service.save')\"\n (clicked)=\"saveFilters()\"\n ></s-button>\n <s-button\n priority=\"secondary\"\n [label]=\"translate.instant('platform.filter_service.clear')\"\n (clicked)=\"clearFilters()\"\n ></s-button>\n </ng-container>\n <s-button\n *ngIf=\"isMobile\"\n priority=\"default\"\n [label]=\"translate.instant('platform.filter_service.actions')\"\n [auxiliary]=\"true\"\n [menuOptions]=\"mobileButtonActions\"\n ></s-button>\n <s-button\n priority=\"link\"\n [label]=\"translate.instant('platform.filter_service.cancel')\"\n (clicked)=\"toggleDialog(); close()\"\n ></s-button>\n </ng-container>\n </ng-template>\n</p-dialog>\n\n\n<p-toast key=\"filterServiceToastKey\" [baseZIndex]=\"5000\"></p-toast>\n", styles: [".custom-badge{position:absolute!important;right:-4px;top:-10px;height:20px;vertical-align:middle;display:table;min-width:22px}.filter-button{position:relative;border:solid 1px black;border-radius:1.5rem;background:transparent;padding:.5rem 1rem;cursor:pointer}.filter-dialog .ui-dialog-title{display:block!important;padding-right:0!important}.filter-footer{text-align:end;border-top:1px solid #e5eaea;padding:13px}.filter-dialog>.ui-dialog-content{height:300px;padding:10px!important}.app-form-filter{height:335px;max-height:335px;overflow:auto}.only-content-wrapper{background-color:#fff}.close_btn{align-content:center;justify-self:right;margin-left:auto}.close_btn:hover{cursor:pointer}.header{text-transform:uppercase;display:flex;width:100%;border-bottom:1px solid #e5eaea;padding:15px;margin-left:0}@media (min-width: 641px) and (max-width: 1024px){.filter-dialog{width:75%}.filter-dialog>.ui-dialog-content{height:300px}}@media only screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation: portrait){.filter-dialog{width:75%}.filter-dialog>.ui-dialog-content{height:90%}}@media (min-width: 320px) and (max-width: 640px){.filter-dialog{width:95%;left:0;top:0;opacity:1;margin:auto;height:93%}.filter-dialog>.ui-dialog-content{height:85%}}@media (min-width: 320px) and (max-width: 640px) and (max-width: 360px){.filter-dialog button{padding:0!important}.filter-dialog>.ui-dialog-content{height:81%}}\n"], dependencies: [{ kind: "component", type: i1$2.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "maskStyle", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "closeButtonProps", "maximizeButtonProps", "visible", "style", "position", "role", "content", "contentTemplate", "footerTemplate", "closeIconTemplate", "maximizeIconTemplate", "minimizeIconTemplate", "headlessTemplate"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { kind: "directive", type: i2$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "component", type: i3$1.ButtonComponent, selector: "s-button", inputs: ["id", "label", "tooltip", "tooltipPosition", "iconClass", "rightIconClass", "caret", "styleClass", "baseZIndex", "disabled", "auxiliary", "type", "priority", "menuOptions", "size", "slide", "animation", "badge", "iconColor"], outputs: ["clicked"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "life", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { kind: "component", type: FormFilterComponent, selector: "s-app-form-filter", inputs: ["showMessages", "isModal", "contextId"], outputs: ["totalFiltersActiveOutput", "errorOutput", "showDialogOutput", "closeModalOutput"] }, { kind: "pipe", type: TranslatePipe$1, name: "translate" }], encapsulation: i0.ViewEncapsulation.None });
|
|
1573
|
+
}
|
|
1574
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AdvancedFilterComponent, decorators: [{
|
|
1575
|
+
type: Component,
|
|
1576
|
+
args: [{ selector: 's-advanced-filter', encapsulation: ViewEncapsulation.None, template: "<s-button\n *ngIf=\"!onlyContent\"\n [id]=\"'filterButton'\"\n [disabled]=\"!canOpenFilter\"\n (clicked)=\"canOpenFilter ? toggleDialog() : ''\"\n iconClass=\"fa fa-filter\"\n priority=\"default\"\n [label]=\"labelButton\"\n [auxiliary]=\"true\"\n [tooltip]=\"appliedFiltersTooltip\"\n>\n <span\n *ngIf=\"totalFiltersActive && showActiveFiltersCountBadge\"\n class=\"sds-badge-number sds-color-primary custom-badge\"\n >{{ totalFiltersActive }}</span\n >\n</s-button>\n\n<section *ngIf=\"onlyContent\">\n <div class=\"only-content-wrapper\">\n <div class=\"header\">\n <h3>{{ 'platform.filter_service.filters' | translate }}</h3>\n <span (click)=\"close()\" class=\"close_btn pi pi-times\"></span>\n </div>\n <div class=\"app-form-filter\">\n <s-app-form-filter\n [showMessages]=\"false\"\n (totalFiltersActiveOutput)=\"updateTotalFiltersActive($event)\"\n (closeModalOutput)=\"close()\"\n [isModal]=\"false\"\n [contextId]=\"contextId\"\n ></s-app-form-filter>\n </div>\n <div class=\"filter-footer\" *ngIf=\"!error\">\n <s-button\n priority=\"link\"\n [label]=\"translate.instant('platform.filter_service.cancel')\"\n (clicked)=\"close()\"\n ></s-button>\n <s-button\n *ngIf=\"isMobile\"\n priority=\"default\"\n [label]=\"translate.instant('platform.filter_service.actions')\"\n [auxiliary]=\"true\"\n [menuOptions]=\"mobileButtonActions\"\n ></s-button>\n <ng-container *ngIf=\"!isMobile\">\n <s-button\n priority=\"secondary\"\n [label]=\"translate.instant('platform.filter_service.clear')\"\n (clicked)=\"clearFilters()\"\n ></s-button>\n <s-button\n priority=\"secondary\"\n [label]=\"translate.instant('platform.filter_service.save')\"\n (clicked)=\"saveFilters()\"\n ></s-button>\n </ng-container>\n <s-button\n type=\"submit\"\n priority=\"primary\"\n [label]=\"translate.instant('platform.filter_service.filter')\"\n (clicked)=\"onApplyFilters()\"\n ></s-button>\n </div>\n </div>\n</section>\n\n<p-dialog\n *ngIf=\"!onlyContent\"\n appendTo=\"body\"\n styleClass=\"filter-dialog\"\n [draggable]=\"false\"\n [modal]=\"true\"\n [(visible)]=\"showDialog\"\n [blockScroll]=\"true\"\n [closable]=\"false\"\n>\n <ng-template pTemplate=\"header\">\n <div class=\"w-full flex items-center justify-between\">\n <span>{{ 'platform.filter_service.filters' | translate }}</span>\n <span\n (click)=\"toggleDialog(); close()\"\n (keypress)=\"toggleDialog(); close()\"\n class=\"close_btn pi pi-times cursor-pointer\">\n </span>\n </div>\n </ng-template>\n\n <s-app-form-filter\n [showMessages]=\"true\"\n (errorOutput)=\"onError($event)\"\n (totalFiltersActiveOutput)=\"updateTotalFiltersActive($event)\"\n [isModal]=\"true\"\n [contextId]=\"contextId\"\n ></s-app-form-filter>\n\n <ng-template pTemplate=\"footer\">\n <ng-container *ngIf=\"!error && !hideButtons\">\n <s-button\n type=\"submit\"\n priority=\"primary\"\n [label]=\"translate.instant('platform.filter_service.filter')\"\n (clicked)=\"applyFilters()\"\n ></s-button>\n <ng-container *ngIf=\"!isMobile\">\n <s-button\n priority=\"secondary\"\n [label]=\"translate.instant('platform.filter_service.save')\"\n (clicked)=\"saveFilters()\"\n ></s-button>\n <s-button\n priority=\"secondary\"\n [label]=\"translate.instant('platform.filter_service.clear')\"\n (clicked)=\"clearFilters()\"\n ></s-button>\n </ng-container>\n <s-button\n *ngIf=\"isMobile\"\n priority=\"default\"\n [label]=\"translate.instant('platform.filter_service.actions')\"\n [auxiliary]=\"true\"\n [menuOptions]=\"mobileButtonActions\"\n ></s-button>\n <s-button\n priority=\"link\"\n [label]=\"translate.instant('platform.filter_service.cancel')\"\n (clicked)=\"toggleDialog(); close()\"\n ></s-button>\n </ng-container>\n </ng-template>\n</p-dialog>\n\n\n<p-toast key=\"filterServiceToastKey\" [baseZIndex]=\"5000\"></p-toast>\n", styles: [".custom-badge{position:absolute!important;right:-4px;top:-10px;height:20px;vertical-align:middle;display:table;min-width:22px}.filter-button{position:relative;border:solid 1px black;border-radius:1.5rem;background:transparent;padding:.5rem 1rem;cursor:pointer}.filter-dialog .ui-dialog-title{display:block!important;padding-right:0!important}.filter-footer{text-align:end;border-top:1px solid #e5eaea;padding:13px}.filter-dialog>.ui-dialog-content{height:300px;padding:10px!important}.app-form-filter{height:335px;max-height:335px;overflow:auto}.only-content-wrapper{background-color:#fff}.close_btn{align-content:center;justify-self:right;margin-left:auto}.close_btn:hover{cursor:pointer}.header{text-transform:uppercase;display:flex;width:100%;border-bottom:1px solid #e5eaea;padding:15px;margin-left:0}@media (min-width: 641px) and (max-width: 1024px){.filter-dialog{width:75%}.filter-dialog>.ui-dialog-content{height:300px}}@media only screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation: portrait){.filter-dialog{width:75%}.filter-dialog>.ui-dialog-content{height:90%}}@media (min-width: 320px) and (max-width: 640px){.filter-dialog{width:95%;left:0;top:0;opacity:1;margin:auto;height:93%}.filter-dialog>.ui-dialog-content{height:85%}}@media (min-width: 320px) and (max-width: 640px) and (max-width: 360px){.filter-dialog button{padding:0!important}.filter-dialog>.ui-dialog-content{height:81%}}\n"] }]
|
|
1577
|
+
}], propDecorators: { labelButton: [{
|
|
1578
|
+
type: Input
|
|
1579
|
+
}], onlyContent: [{
|
|
1580
|
+
type: Input
|
|
1581
|
+
}], hideButtons: [{
|
|
1582
|
+
type: Input
|
|
1583
|
+
}], canOpenFilter: [{
|
|
1584
|
+
type: Input
|
|
1585
|
+
}], showActiveFiltersCountBadge: [{
|
|
1586
|
+
type: Input
|
|
1587
|
+
}], filterAndSave: [{
|
|
1588
|
+
type: Input
|
|
1589
|
+
}], contextId: [{
|
|
1590
|
+
type: Input
|
|
1591
|
+
}], modalComponent: [{
|
|
1592
|
+
type: ViewChild,
|
|
1593
|
+
args: [FormFilterComponent]
|
|
1594
|
+
}], onResizeWindow: [{
|
|
1595
|
+
type: HostListener,
|
|
1596
|
+
args: ['window:resize', ['$event']]
|
|
1597
|
+
}] } });
|
|
1598
|
+
|
|
1599
|
+
class AppRoutingModule {
|
|
1600
|
+
}
|
|
1601
|
+
class AdvancedFilterModule {
|
|
1602
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AdvancedFilterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1603
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: AdvancedFilterModule, declarations: [AdvancedFilterComponent, FormFilterComponent, MapValuesPipe, TranslatePipe$1], imports: [DialogModule,
|
|
1604
|
+
ButtonModule,
|
|
1605
|
+
ButtonModule$1,
|
|
1606
|
+
TabViewModule,
|
|
1607
|
+
CommonModule,
|
|
1608
|
+
FormsModule,
|
|
1609
|
+
ReactiveFormsModule,
|
|
1610
|
+
DynamicFormModule,
|
|
1611
|
+
ToastModule,
|
|
1612
|
+
EmptyStateModule,
|
|
1613
|
+
TooltipModule, TranslationsModule], exports: [AdvancedFilterComponent, FormFilterComponent] });
|
|
1614
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AdvancedFilterModule, providers: [AdvancedFilterService, LocaleService, MessageService, TranslateService, CalendarOptionsService], imports: [DialogModule,
|
|
1615
|
+
ButtonModule,
|
|
1616
|
+
ButtonModule$1,
|
|
1617
|
+
TabViewModule,
|
|
1618
|
+
CommonModule,
|
|
1619
|
+
FormsModule,
|
|
1620
|
+
ReactiveFormsModule,
|
|
1621
|
+
DynamicFormModule,
|
|
1622
|
+
ToastModule,
|
|
1623
|
+
EmptyStateModule,
|
|
1624
|
+
TooltipModule,
|
|
1625
|
+
TranslationsModule.forChild([{ domain: 'platform', service: 'filter_service', fallback: fallback$1 }])] });
|
|
1626
|
+
}
|
|
1627
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AdvancedFilterModule, decorators: [{
|
|
1628
|
+
type: NgModule,
|
|
1629
|
+
args: [{
|
|
1630
|
+
imports: [
|
|
1631
|
+
DialogModule,
|
|
1632
|
+
ButtonModule,
|
|
1633
|
+
ButtonModule$1,
|
|
1634
|
+
TabViewModule,
|
|
1635
|
+
CommonModule,
|
|
1636
|
+
FormsModule,
|
|
1637
|
+
ReactiveFormsModule,
|
|
1638
|
+
DynamicFormModule,
|
|
1639
|
+
ToastModule,
|
|
1640
|
+
EmptyStateModule,
|
|
1641
|
+
TooltipModule,
|
|
1642
|
+
TranslationsModule.forChild([{ domain: 'platform', service: 'filter_service', fallback: fallback$1 }]),
|
|
1643
|
+
],
|
|
1644
|
+
providers: [AdvancedFilterService, LocaleService, MessageService, TranslateService, CalendarOptionsService],
|
|
1645
|
+
declarations: [AdvancedFilterComponent, FormFilterComponent, MapValuesPipe, TranslatePipe$1],
|
|
1646
|
+
exports: [AdvancedFilterComponent, FormFilterComponent]
|
|
1647
|
+
}]
|
|
1648
|
+
}] });
|
|
1649
|
+
|
|
1650
|
+
class CyclicJsonInterceptor {
|
|
1651
|
+
intercept(req, next) {
|
|
1652
|
+
if (req.body instanceof Blob === false && req.body instanceof FormData === false) {
|
|
1653
|
+
req = req.clone({ body: jc.decycle(req.body) });
|
|
1654
|
+
}
|
|
1655
|
+
return next.handle(req).pipe(map((event) => {
|
|
1656
|
+
if (event instanceof HttpResponse) {
|
|
1657
|
+
event = event.clone({ body: jc.retrocycle(event.body) });
|
|
1658
|
+
}
|
|
1659
|
+
return event;
|
|
1660
|
+
}));
|
|
1661
|
+
}
|
|
1662
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CyclicJsonInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1663
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CyclicJsonInterceptor, providedIn: 'root' });
|
|
1664
|
+
}
|
|
1665
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CyclicJsonInterceptor, decorators: [{
|
|
1666
|
+
type: Injectable,
|
|
1667
|
+
args: [{
|
|
1668
|
+
providedIn: 'root',
|
|
1669
|
+
}]
|
|
1670
|
+
}] });
|
|
1671
|
+
|
|
1672
|
+
class CyclicJsonInterceptorModule {
|
|
1673
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CyclicJsonInterceptorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1674
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: CyclicJsonInterceptorModule });
|
|
1675
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CyclicJsonInterceptorModule, providers: [{ provide: HTTP_INTERCEPTORS, useClass: CyclicJsonInterceptor, multi: true }, provideHttpClient(withInterceptorsFromDi())] });
|
|
1676
|
+
}
|
|
1677
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CyclicJsonInterceptorModule, decorators: [{
|
|
1678
|
+
type: NgModule,
|
|
1679
|
+
args: [{ imports: [], providers: [{ provide: HTTP_INTERCEPTORS, useClass: CyclicJsonInterceptor, multi: true }, provideHttpClient(withInterceptorsFromDi())] }]
|
|
1680
|
+
}] });
|
|
1681
|
+
|
|
1682
|
+
class RestUrl {
|
|
1683
|
+
get() {
|
|
1684
|
+
return defer(() => from(service.getRestUrl()));
|
|
1685
|
+
}
|
|
1686
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: RestUrl, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1687
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: RestUrl });
|
|
1688
|
+
}
|
|
1689
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: RestUrl, decorators: [{
|
|
1690
|
+
type: Injectable
|
|
1691
|
+
}] });
|
|
1692
|
+
|
|
1693
|
+
class XServicesUrl {
|
|
1694
|
+
get() {
|
|
1695
|
+
return defer(() => {
|
|
1696
|
+
const url = service.getXServicesUrl();
|
|
1697
|
+
return from(url);
|
|
1698
|
+
});
|
|
1699
|
+
}
|
|
1700
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: XServicesUrl, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1701
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: XServicesUrl });
|
|
1702
|
+
}
|
|
1703
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: XServicesUrl, decorators: [{
|
|
1704
|
+
type: Injectable
|
|
1705
|
+
}] });
|
|
1706
|
+
|
|
1707
|
+
class HttpInterceptor {
|
|
1708
|
+
restUrl = inject(RestUrl);
|
|
1709
|
+
xServicesUrl = inject(XServicesUrl);
|
|
1710
|
+
intercept(originalReq, next) {
|
|
1711
|
+
if (!originalReq.url.includes(`://`)) {
|
|
1712
|
+
const getAuthHeader = defer(() => from(user.getAuthHeader()));
|
|
1713
|
+
if (/^\/?[^\/]+\/[^\/]+\/api\/(?:latest|v\d+)\/.+$/g.test(originalReq.url)) {
|
|
1714
|
+
const getXServicesUrl = this.xServicesUrl.get();
|
|
1715
|
+
return forkJoin([getXServicesUrl, getAuthHeader]).pipe(mergeMap((values) => {
|
|
1716
|
+
const [xUrl, authHeader] = values;
|
|
1717
|
+
return this.injectBaseUrl(originalReq, next, xUrl, authHeader);
|
|
1718
|
+
}));
|
|
1719
|
+
}
|
|
1720
|
+
const getRestUrl = this.restUrl.get();
|
|
1721
|
+
return forkJoin([getRestUrl, getAuthHeader]).pipe(mergeMap((values) => {
|
|
1722
|
+
const [bridgeUrl, authHeader] = values;
|
|
1723
|
+
return this.injectBaseUrl(originalReq, next, bridgeUrl, authHeader);
|
|
1724
|
+
}));
|
|
1725
|
+
}
|
|
1726
|
+
return next.handle(originalReq);
|
|
1727
|
+
}
|
|
1728
|
+
injectBaseUrl(originalReq, next, baseUrl, authorization) {
|
|
1729
|
+
const request = originalReq.clone({
|
|
1730
|
+
url: baseUrl + originalReq.url,
|
|
1731
|
+
headers: originalReq.headers.set(`Authorization`, authorization)
|
|
1732
|
+
});
|
|
1733
|
+
return next.handle(request);
|
|
1734
|
+
}
|
|
1735
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: HttpInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1736
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: HttpInterceptor });
|
|
1737
|
+
}
|
|
1738
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: HttpInterceptor, decorators: [{
|
|
1739
|
+
type: Injectable
|
|
1740
|
+
}] });
|
|
1741
|
+
|
|
1742
|
+
class HttpInterceptorModule {
|
|
1743
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: HttpInterceptorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1744
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: HttpInterceptorModule });
|
|
1745
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: HttpInterceptorModule, providers: [RestUrl, XServicesUrl, { provide: HTTP_INTERCEPTORS, useClass: HttpInterceptor, multi: true }, provideHttpClient(withInterceptorsFromDi())] });
|
|
1746
|
+
}
|
|
1747
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: HttpInterceptorModule, decorators: [{
|
|
1748
|
+
type: NgModule,
|
|
1749
|
+
args: [{ imports: [], providers: [RestUrl, XServicesUrl, { provide: HTTP_INTERCEPTORS, useClass: HttpInterceptor, multi: true }, provideHttpClient(withInterceptorsFromDi())] }]
|
|
1750
|
+
}] });
|
|
1751
|
+
|
|
1752
|
+
const RESOURCES = new InjectionToken('RESOURCES');
|
|
1753
|
+
const ENVIRONMENT = new InjectionToken('ENVIRONMENT');
|
|
1754
|
+
class Resource {
|
|
1755
|
+
name;
|
|
1756
|
+
actions;
|
|
1757
|
+
uri;
|
|
1758
|
+
redirectToError = false;
|
|
1759
|
+
actionsToCheck;
|
|
1760
|
+
entity;
|
|
1761
|
+
}
|
|
1762
|
+
class Environment {
|
|
1763
|
+
domain;
|
|
1764
|
+
service;
|
|
1765
|
+
ignorePermissions;
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
let promise;
|
|
1769
|
+
class PermissionsService {
|
|
1770
|
+
resources = inject(RESOURCES);
|
|
1771
|
+
environment = inject(ENVIRONMENT);
|
|
1772
|
+
http = inject(HttpClient);
|
|
1773
|
+
router = inject(Router);
|
|
1774
|
+
toastService = inject(ToastService);
|
|
1775
|
+
translate = inject(TranslateService);
|
|
1776
|
+
checkedPermissions = {};
|
|
1777
|
+
actionUrl = 'platform/authorization/queries';
|
|
1778
|
+
// v2
|
|
1779
|
+
checkAccess(resources) {
|
|
1780
|
+
const permissions = [];
|
|
1781
|
+
resources.forEach(rec => {
|
|
1782
|
+
rec.actions.forEach(action => {
|
|
1783
|
+
if (!rec.uri) {
|
|
1784
|
+
rec.uri = this.getUriByResourceName(rec.name, rec.entity);
|
|
1785
|
+
}
|
|
1786
|
+
permissions.push({ action, resource: rec.uri });
|
|
1787
|
+
});
|
|
1788
|
+
});
|
|
1789
|
+
return this.http.post(`${this.actionUrl}/checkAccess`, { includeFilters: true, permissions }).pipe(map((response) => {
|
|
1790
|
+
const checkedPermissions = response.permissions || response;
|
|
1791
|
+
this.checkedPermissions = { ...this.checkedPermissions, ...checkedPermissions };
|
|
1792
|
+
const values = {};
|
|
1793
|
+
if (this.shouldRedirectToForbiddenPage(resources, checkedPermissions)) {
|
|
1794
|
+
this.router.navigate(['error', 403]);
|
|
1795
|
+
return throwError(() => new Error('forbidden'));
|
|
1796
|
+
}
|
|
1797
|
+
checkedPermissions.forEach((permission) => {
|
|
1798
|
+
const resource = resources.find(res => res.uri === permission.resource);
|
|
1799
|
+
if (!resource) {
|
|
1800
|
+
return;
|
|
1801
|
+
}
|
|
1802
|
+
const { name } = resource;
|
|
1803
|
+
values[name] = values[name] || {};
|
|
1804
|
+
values[name][permission.action] = permission.authorized;
|
|
1805
|
+
values[name][permission.action.toLowerCase()] = permission.authorized;
|
|
1806
|
+
if (permission.resourceFilters?.length) {
|
|
1807
|
+
values[name]['resourceFilters'] = [
|
|
1808
|
+
...(values[name]['resourceFilters'] || []),
|
|
1809
|
+
...permission.resourceFilters
|
|
1810
|
+
];
|
|
1811
|
+
}
|
|
1812
|
+
});
|
|
1813
|
+
return values;
|
|
1814
|
+
}));
|
|
1815
|
+
}
|
|
1816
|
+
// v1
|
|
1817
|
+
get(resource = '') {
|
|
1818
|
+
if (!promise) {
|
|
1819
|
+
promise = this.getPermissions();
|
|
1820
|
+
}
|
|
1821
|
+
return from(promise).pipe(map((permissions) => {
|
|
1822
|
+
this.checkedPermissions = permissions;
|
|
1823
|
+
if (resource) {
|
|
1824
|
+
const resourceKey = Object.keys(permissions)
|
|
1825
|
+
.find(key => key.toLowerCase() === resource.toLowerCase());
|
|
1826
|
+
return permissions[resourceKey];
|
|
1827
|
+
}
|
|
1828
|
+
return permissions;
|
|
1829
|
+
}), catchError(() => {
|
|
1830
|
+
promise = undefined;
|
|
1831
|
+
this.toastService.show({
|
|
1832
|
+
severity: 'error',
|
|
1833
|
+
title: this.translate.instant('permission_error_summary'),
|
|
1834
|
+
text: this.translate.instant('permission_error_detail')
|
|
1835
|
+
});
|
|
1836
|
+
return of(this.getPermissionObject(false));
|
|
1837
|
+
}));
|
|
1838
|
+
}
|
|
1839
|
+
isAuthorized(resourceName, action, isEntity) {
|
|
1840
|
+
if (!this.checkedPermissions || Object.keys(this.checkedPermissions).length === 0) {
|
|
1841
|
+
throwError(() => new Error('\'Permissions\' are not defined. You should call \'get\' or \'checkAccess\' method first.'));
|
|
1842
|
+
}
|
|
1843
|
+
const resourceKey = Object.keys(this.checkedPermissions)
|
|
1844
|
+
.find(key => key.toLowerCase() === resourceName.toLowerCase());
|
|
1845
|
+
if (!resourceKey) {
|
|
1846
|
+
return false;
|
|
1847
|
+
}
|
|
1848
|
+
const actions = this.checkedPermissions[resourceKey];
|
|
1849
|
+
return actions?.[action] ?? actions?.[action.toLowerCase()] ?? false;
|
|
1850
|
+
}
|
|
1851
|
+
getUriByResourceName(resourceName, isEntity) {
|
|
1852
|
+
const { domain, service } = this.environment;
|
|
1853
|
+
if (!domain || !service) {
|
|
1854
|
+
throwError(() => new Error('You must inform domain and service name'));
|
|
1855
|
+
}
|
|
1856
|
+
const uriBase = `res://senior.com.br/${domain}/${service}`;
|
|
1857
|
+
return isEntity ? `${uriBase}/entities/${resourceName}` : `${uriBase}/${resourceName}`;
|
|
1858
|
+
}
|
|
1859
|
+
shouldRedirectToForbiddenPage(resources = [], permissions) {
|
|
1860
|
+
const permissionsDenied = permissions.filter(perm => !perm.authorized);
|
|
1861
|
+
if (permissionsDenied.length) {
|
|
1862
|
+
const resourcesToCheck = resources.filter(r => r.redirectToError);
|
|
1863
|
+
if (resourcesToCheck.length) {
|
|
1864
|
+
return resourcesToCheck.every(resource => {
|
|
1865
|
+
const actionsToCheck = resource.actionsToCheck?.length ? resource.actionsToCheck : resource.actions;
|
|
1866
|
+
return actionsToCheck.every(action => permissionsDenied.some(p => p.resource === resource.uri && p.action === action));
|
|
1867
|
+
});
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
return false;
|
|
1871
|
+
}
|
|
1872
|
+
getFlatEnvironment() {
|
|
1873
|
+
return this.environment.ignorePermissions;
|
|
1874
|
+
}
|
|
1875
|
+
getFlatResources() {
|
|
1876
|
+
return this.resources.reduce((result, item) => {
|
|
1877
|
+
if (!item) {
|
|
1878
|
+
return result;
|
|
1879
|
+
}
|
|
1880
|
+
return Array.isArray(item) ? [...result, ...item] : [...result, item];
|
|
1881
|
+
}, []);
|
|
1882
|
+
}
|
|
1883
|
+
getPermissionObject(defaultValue) {
|
|
1884
|
+
return this.getFlatResources().reduce((resources, resource) => {
|
|
1885
|
+
resources[resource.name] = resource.actions.reduce((actions, action) => {
|
|
1886
|
+
actions[action] = defaultValue;
|
|
1887
|
+
actions[action.toLowerCase()] = defaultValue;
|
|
1888
|
+
return actions;
|
|
1889
|
+
}, {});
|
|
1890
|
+
return resources;
|
|
1891
|
+
}, {});
|
|
1892
|
+
}
|
|
1893
|
+
async getPermissions() {
|
|
1894
|
+
if (this.getFlatEnvironment()) {
|
|
1895
|
+
return this.getPermissionObject(true);
|
|
1896
|
+
}
|
|
1897
|
+
const resources = this.getFlatResources();
|
|
1898
|
+
const perm = resources
|
|
1899
|
+
.map(resource => resource.actions.map((action) => ({ action, resource: resource.uri })))
|
|
1900
|
+
.reduce((acc, val) => [...acc, ...val]);
|
|
1901
|
+
const response = await this.http
|
|
1902
|
+
.post(`${this.actionUrl}/checkAccess`, { includeFilters: false, permissions: perm })
|
|
1903
|
+
.toPromise();
|
|
1904
|
+
const permissions = response.permissions ?? response;
|
|
1905
|
+
const values = {};
|
|
1906
|
+
permissions.forEach((permission) => {
|
|
1907
|
+
const resource = resources.find((res) => res.uri === permission.resource);
|
|
1908
|
+
if (!resource) {
|
|
1909
|
+
return;
|
|
1910
|
+
}
|
|
1911
|
+
const { name } = resource;
|
|
1912
|
+
values[name] = values[name] || {};
|
|
1913
|
+
values[name][permission.action] = permission.authorized;
|
|
1914
|
+
values[name][permission.action.toLowerCase()] = permission.authorized;
|
|
1915
|
+
});
|
|
1916
|
+
return values;
|
|
1917
|
+
}
|
|
1918
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PermissionsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1919
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PermissionsService, providedIn: 'root' });
|
|
1920
|
+
}
|
|
1921
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PermissionsService, decorators: [{
|
|
1922
|
+
type: Injectable,
|
|
1923
|
+
args: [{
|
|
1924
|
+
providedIn: 'root'
|
|
1925
|
+
}]
|
|
1926
|
+
}] });
|
|
1927
|
+
|
|
1928
|
+
class PermissionsModule {
|
|
1929
|
+
static forRoot(resources, environment) {
|
|
1930
|
+
return {
|
|
1931
|
+
ngModule: PermissionsModule,
|
|
1932
|
+
providers: [
|
|
1933
|
+
PermissionsService,
|
|
1934
|
+
{
|
|
1935
|
+
provide: RESOURCES,
|
|
1936
|
+
multi: true,
|
|
1937
|
+
useValue: resources
|
|
1938
|
+
},
|
|
1939
|
+
{
|
|
1940
|
+
provide: ENVIRONMENT,
|
|
1941
|
+
multi: false,
|
|
1942
|
+
useValue: environment
|
|
1943
|
+
}
|
|
1944
|
+
]
|
|
1945
|
+
};
|
|
1946
|
+
}
|
|
1947
|
+
static forChild(resources) {
|
|
1948
|
+
return {
|
|
1949
|
+
ngModule: PermissionsModule,
|
|
1950
|
+
providers: [
|
|
1951
|
+
{
|
|
1952
|
+
provide: RESOURCES,
|
|
1953
|
+
multi: true,
|
|
1954
|
+
useValue: resources
|
|
1955
|
+
}
|
|
1956
|
+
]
|
|
1957
|
+
};
|
|
1958
|
+
}
|
|
1959
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PermissionsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1960
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: PermissionsModule });
|
|
1961
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PermissionsModule });
|
|
1962
|
+
}
|
|
1963
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PermissionsModule, decorators: [{
|
|
1964
|
+
type: NgModule
|
|
1965
|
+
}] });
|
|
1966
|
+
|
|
1967
|
+
function ResourceFactory({ domain, service, resource }) {
|
|
1968
|
+
return `res://senior.com.br/${domain}/${service}/${resource}`;
|
|
1969
|
+
}
|
|
1970
|
+
function endpointFactoryFunction(domain, service) {
|
|
1971
|
+
// The @seniorsistemas/platform-components http interceptor is handling the base url portion of the final URL
|
|
1972
|
+
const create = (method, endpoint) => `${domain}/${service}/${method}/${endpoint}`;
|
|
1973
|
+
const resource = (resource) => ResourceFactory({ domain, service, resource });
|
|
1974
|
+
return {
|
|
1975
|
+
resource,
|
|
1976
|
+
query: create.bind(null, 'queries'),
|
|
1977
|
+
action: create.bind(null, 'actions'),
|
|
1978
|
+
signal: create.bind(null, 'signals'),
|
|
1979
|
+
entity(entity) {
|
|
1980
|
+
const URL = create('entities', entity);
|
|
1981
|
+
return {
|
|
1982
|
+
create: () => URL,
|
|
1983
|
+
update: (id) => URL + '/' + id,
|
|
1984
|
+
remove: (id) => URL + '/' + id
|
|
1985
|
+
};
|
|
1986
|
+
}
|
|
1987
|
+
};
|
|
1988
|
+
}
|
|
1989
|
+
const endpointFactory = endpointFactoryFunction;
|
|
1990
|
+
// ADD HERE YOUR NEW ENDPOINT
|
|
1991
|
+
const PLATFORM_FEATURE_TOGGLE = endpointFactoryFunction('platform', 'feature_toggle');
|
|
1992
|
+
|
|
1993
|
+
class FeatureToggleService {
|
|
1994
|
+
http = inject(HttpClient);
|
|
1995
|
+
cache = {};
|
|
1996
|
+
isEnabled({ domain, service, name }, tenant) {
|
|
1997
|
+
let tenantObs;
|
|
1998
|
+
if (tenant) {
|
|
1999
|
+
tenantObs = of(tenant);
|
|
2000
|
+
}
|
|
2001
|
+
else {
|
|
2002
|
+
tenantObs = from(user.getUserData()).pipe(map(userData => userData.tenantName));
|
|
2003
|
+
}
|
|
2004
|
+
return tenantObs.pipe(mergeMap(tenant => {
|
|
2005
|
+
const key = JSON.stringify({ tenant, domain, service });
|
|
2006
|
+
if (!this.cache[key]) {
|
|
2007
|
+
this.cache[key] = this.http
|
|
2008
|
+
.post(PLATFORM_FEATURE_TOGGLE.query('getEnabledFeatures'), { tenant, domain, service })
|
|
2009
|
+
.pipe(map(output => output.features), shareReplay(1), catchError(err => {
|
|
2010
|
+
console.error(err);
|
|
2011
|
+
delete this.cache[key];
|
|
2012
|
+
return of([]);
|
|
2013
|
+
}));
|
|
2014
|
+
}
|
|
2015
|
+
return this.cache[key];
|
|
2016
|
+
}), map((features) => {
|
|
2017
|
+
return features.findIndex(f => f.name === name) !== -1;
|
|
2018
|
+
}));
|
|
2019
|
+
}
|
|
2020
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FeatureToggleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2021
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FeatureToggleService, providedIn: 'root' });
|
|
2022
|
+
}
|
|
2023
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FeatureToggleService, decorators: [{
|
|
2024
|
+
type: Injectable,
|
|
2025
|
+
args: [{ providedIn: 'root' }]
|
|
2026
|
+
}] });
|
|
2027
|
+
|
|
2028
|
+
class FeatureToggleModule {
|
|
2029
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FeatureToggleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2030
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: FeatureToggleModule, imports: [HttpInterceptorModule] });
|
|
2031
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FeatureToggleModule, providers: [FeatureToggleService, provideHttpClient(withInterceptorsFromDi())], imports: [HttpInterceptorModule] });
|
|
2032
|
+
}
|
|
2033
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FeatureToggleModule, decorators: [{
|
|
2034
|
+
type: NgModule,
|
|
2035
|
+
args: [{ imports: [HttpInterceptorModule], providers: [FeatureToggleService, provideHttpClient(withInterceptorsFromDi())] }]
|
|
2036
|
+
}] });
|
|
2037
|
+
|
|
2038
|
+
var UserAction;
|
|
2039
|
+
(function (UserAction) {
|
|
2040
|
+
UserAction["CONFIRMED"] = "CONFIRMED";
|
|
2041
|
+
UserAction["POSTPONED"] = "POSTPONED";
|
|
2042
|
+
UserAction["REFUSED"] = "REFUSED";
|
|
2043
|
+
})(UserAction || (UserAction = {}));
|
|
2044
|
+
|
|
2045
|
+
class SpotlightService {
|
|
2046
|
+
http = inject(HttpClient);
|
|
2047
|
+
API_URL = 'platform/spotlight/';
|
|
2048
|
+
getUser() {
|
|
2049
|
+
return this.http.post('platform/user/queries/getUser', {}).toPromise();
|
|
2050
|
+
}
|
|
2051
|
+
listSpotlightScreen() {
|
|
2052
|
+
return this.http.get(this.API_URL + 'queries/listSpotlightScreen');
|
|
2053
|
+
}
|
|
2054
|
+
listSpotlightUsers() {
|
|
2055
|
+
return this.http.get(this.API_URL + 'queries/listSpotlightUsers').toPromise();
|
|
2056
|
+
}
|
|
2057
|
+
listSpotlightControl() {
|
|
2058
|
+
return this.http.get(this.API_URL + 'queries/listSpotlightControl').toPromise();
|
|
2059
|
+
}
|
|
2060
|
+
saveSpotlightUser(content) {
|
|
2061
|
+
return this.http.post(this.API_URL + 'actions/saveSpotlightUsers', { content });
|
|
2062
|
+
}
|
|
2063
|
+
saveSpotlightControl(content) {
|
|
2064
|
+
return this.http.post(this.API_URL + 'actions/saveSpotlightControl', { content });
|
|
2065
|
+
}
|
|
2066
|
+
notificateSpotlight(content) {
|
|
2067
|
+
return this.http.post(this.API_URL + 'actions/notificateSpotlight', content);
|
|
2068
|
+
}
|
|
2069
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SpotlightService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2070
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SpotlightService });
|
|
2071
|
+
}
|
|
2072
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SpotlightService, decorators: [{
|
|
2073
|
+
type: Injectable
|
|
2074
|
+
}] });
|
|
2075
|
+
|
|
2076
|
+
var EnumDisplayType;
|
|
2077
|
+
(function (EnumDisplayType) {
|
|
2078
|
+
EnumDisplayType["ADVERSITING"] = "ADVERSITING";
|
|
2079
|
+
EnumDisplayType["INTEGRATION"] = "INTEGRATION";
|
|
2080
|
+
})(EnumDisplayType || (EnumDisplayType = {}));
|
|
2081
|
+
|
|
2082
|
+
class SpotlightControl {
|
|
2083
|
+
id;
|
|
2084
|
+
spotlightId;
|
|
2085
|
+
status;
|
|
2086
|
+
firstUser;
|
|
2087
|
+
createdBy;
|
|
2088
|
+
createdDate;
|
|
2089
|
+
lastModifiedBy;
|
|
2090
|
+
lastModifiedDate;
|
|
2091
|
+
}
|
|
2092
|
+
|
|
2093
|
+
var EnumSpotlightStatus;
|
|
2094
|
+
(function (EnumSpotlightStatus) {
|
|
2095
|
+
EnumSpotlightStatus["ACTIVE"] = "ACTIVE";
|
|
2096
|
+
EnumSpotlightStatus["IN_PROGRESS"] = "IN_PROGRESS";
|
|
2097
|
+
EnumSpotlightStatus["NO_STARTED"] = "NO_STARTED";
|
|
2098
|
+
EnumSpotlightStatus["REFUSED"] = "REFUSED";
|
|
2099
|
+
})(EnumSpotlightStatus || (EnumSpotlightStatus = {}));
|
|
2100
|
+
|
|
2101
|
+
class TranslatePipe {
|
|
2102
|
+
translationService = inject(TranslateService);
|
|
2103
|
+
transform(value) {
|
|
2104
|
+
return this.translationService.instant(value);
|
|
2105
|
+
}
|
|
2106
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TranslatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2107
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: TranslatePipe, name: "translate", pure: false });
|
|
2108
|
+
}
|
|
2109
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TranslatePipe, decorators: [{
|
|
2110
|
+
type: Pipe,
|
|
2111
|
+
args: [{
|
|
2112
|
+
name: 'translate',
|
|
2113
|
+
pure: false,
|
|
2114
|
+
}]
|
|
2115
|
+
}] });
|
|
2116
|
+
|
|
2117
|
+
class SpotlightComponent {
|
|
2118
|
+
spotlightService = inject(SpotlightService);
|
|
2119
|
+
cookieService = inject(CookieService);
|
|
2120
|
+
datePipe = inject(DatePipe);
|
|
2121
|
+
header;
|
|
2122
|
+
imgUrl;
|
|
2123
|
+
primaryButtonLabel;
|
|
2124
|
+
primaryButtonTooltip;
|
|
2125
|
+
canAppear = false;
|
|
2126
|
+
currentUser;
|
|
2127
|
+
spotlightUsersList;
|
|
2128
|
+
spotlightControlsList;
|
|
2129
|
+
spotlightScreen;
|
|
2130
|
+
canEmitEvent;
|
|
2131
|
+
visible = false;
|
|
2132
|
+
menuId;
|
|
2133
|
+
fade = false;
|
|
2134
|
+
visibleChange = new EventEmitter();
|
|
2135
|
+
async ngOnInit() {
|
|
2136
|
+
await this.setValues();
|
|
2137
|
+
this.fetchSpotlight();
|
|
2138
|
+
}
|
|
2139
|
+
async setValues() {
|
|
2140
|
+
const userData = JSON.parse(this.cookieService.get('com.senior.token'));
|
|
2141
|
+
this.currentUser = userData.username;
|
|
2142
|
+
this.spotlightUsersList = await this.spotlightService.listSpotlightUsers();
|
|
2143
|
+
this.spotlightControlsList = await this.spotlightService.listSpotlightControl();
|
|
2144
|
+
}
|
|
2145
|
+
setValuesInSpotlight(values) {
|
|
2146
|
+
this.header = values.spotlightTitle;
|
|
2147
|
+
this.imgUrl = values.bannerUrl;
|
|
2148
|
+
this.primaryButtonLabel = values.primaryButtonLabel;
|
|
2149
|
+
this.primaryButtonTooltip = values.primaryButtonHint;
|
|
2150
|
+
}
|
|
2151
|
+
getShowDate(days) {
|
|
2152
|
+
const currentDate = new Date();
|
|
2153
|
+
return this.datePipe.transform(currentDate.setDate(currentDate.getDate() + days).toString(), 'yyyy-MM-dd');
|
|
2154
|
+
}
|
|
2155
|
+
fetchSpotlight() {
|
|
2156
|
+
this.spotlightService.listSpotlightScreen().subscribe(value => {
|
|
2157
|
+
this.spotlightScreen = value.contents.filter(val => val.screenMenuId === this.menuId)[0];
|
|
2158
|
+
if (this.spotlightScreen) {
|
|
2159
|
+
this.showSpotlight(this.spotlightScreen.spotlight);
|
|
2160
|
+
}
|
|
2161
|
+
});
|
|
2162
|
+
}
|
|
2163
|
+
showSpotlight(spotlight) {
|
|
2164
|
+
if (this.validateDate(spotlight.initialDate) && this.validateFinalDate(spotlight.finalDate) && this.validateSpotlight(spotlight)) {
|
|
2165
|
+
this.setValuesInSpotlight(spotlight);
|
|
2166
|
+
this.canAppear = true;
|
|
2167
|
+
const control = this.getSpotlightControlFromList(this.spotlightScreen.spotlight.id);
|
|
2168
|
+
this.canEmitEvent = !control || this.currentUser !== control.firstUser;
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
validateDate(date) {
|
|
2172
|
+
if (date) {
|
|
2173
|
+
const currentDate = this.datePipe.transform(new Date().toString(), 'yyyy-MM-dd');
|
|
2174
|
+
const initialDate = this.datePipe.transform(date, 'yyyy-MM-dd');
|
|
2175
|
+
return currentDate >= initialDate;
|
|
2176
|
+
}
|
|
2177
|
+
return false;
|
|
2178
|
+
}
|
|
2179
|
+
validateFinalDate(date) {
|
|
2180
|
+
if (date) {
|
|
2181
|
+
const currentDate = this.datePipe.transform(new Date().toString(), 'yyyy-MM-dd');
|
|
2182
|
+
const finalDate = this.datePipe.transform(date, 'yyyy-MM-dd');
|
|
2183
|
+
return currentDate <= finalDate;
|
|
2184
|
+
}
|
|
2185
|
+
return true;
|
|
2186
|
+
}
|
|
2187
|
+
validateSpotlight(spotlight) {
|
|
2188
|
+
if (!this.validateControlsList(this.spotlightControlsList, spotlight, this.currentUser)) {
|
|
2189
|
+
return false;
|
|
2190
|
+
}
|
|
2191
|
+
if (!this.validateDisplayType(spotlight, this.spotlightUsersList, this.spotlightControlsList, this.currentUser)) {
|
|
2192
|
+
return false;
|
|
2193
|
+
}
|
|
2194
|
+
return true;
|
|
2195
|
+
}
|
|
2196
|
+
validateControlsList(controlsList, spotlight, currentUser) {
|
|
2197
|
+
if (controlsList.totalElements) {
|
|
2198
|
+
const notCompatibleControls = controlsList.contents.filter(control => {
|
|
2199
|
+
if (control.status === EnumSpotlightStatus.ACTIVE) {
|
|
2200
|
+
return control.spotlightId === spotlight.id;
|
|
2201
|
+
}
|
|
2202
|
+
else if (control.status === EnumSpotlightStatus.IN_PROGRESS) {
|
|
2203
|
+
return control.spotlightId === spotlight.id && control.firstUser !== currentUser;
|
|
2204
|
+
}
|
|
2205
|
+
});
|
|
2206
|
+
if (notCompatibleControls.length > 0) {
|
|
2207
|
+
return false;
|
|
2208
|
+
}
|
|
2209
|
+
}
|
|
2210
|
+
return true;
|
|
2211
|
+
}
|
|
2212
|
+
validateDisplayType(spotlight, usersList, controlsList, currentUser) {
|
|
2213
|
+
switch (spotlight.displayType) {
|
|
2214
|
+
case EnumDisplayType.ADVERSITING:
|
|
2215
|
+
return usersList.totalElements ? this.validateUser(usersList.contents, spotlight) : true;
|
|
2216
|
+
case EnumDisplayType.INTEGRATION:
|
|
2217
|
+
if (controlsList.totalElements) {
|
|
2218
|
+
const compatibleControls = controlsList.contents.filter(control => {
|
|
2219
|
+
switch (control.status) {
|
|
2220
|
+
case EnumSpotlightStatus.NO_STARTED:
|
|
2221
|
+
return control.spotlightId === spotlight.id;
|
|
2222
|
+
case EnumSpotlightStatus.REFUSED:
|
|
2223
|
+
return usersList.totalElements ? this.validateUser(usersList.contents, spotlight) : true;
|
|
2224
|
+
case EnumSpotlightStatus.IN_PROGRESS:
|
|
2225
|
+
return control.firstUser === currentUser
|
|
2226
|
+
&& control.spotlightId === spotlight.id;
|
|
2227
|
+
}
|
|
2228
|
+
});
|
|
2229
|
+
if (compatibleControls.length === 0) {
|
|
2230
|
+
return false;
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
return true;
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
validateUser(users, spotlight) {
|
|
2237
|
+
let spotlightUsers = users.filter(user => user.spotlightId === spotlight.id);
|
|
2238
|
+
if (!spotlightUsers.length) {
|
|
2239
|
+
spotlightUsers = users.filter(user => user.userOperation === this.currentUser);
|
|
2240
|
+
return spotlightUsers.length === 0;
|
|
2241
|
+
}
|
|
2242
|
+
const compatibleUserToValidate = spotlightUsers.filter(user => user.userOperation === this.currentUser)[0];
|
|
2243
|
+
return compatibleUserToValidate ? this.validateDate(compatibleUserToValidate.showDate) : true;
|
|
2244
|
+
}
|
|
2245
|
+
saveSpotlightUser(days) {
|
|
2246
|
+
const spotlight = this.spotlightScreen.spotlight;
|
|
2247
|
+
const user = this.spotlightUsersList.contents.filter(val => {
|
|
2248
|
+
return val.spotlightId === spotlight.id
|
|
2249
|
+
&& val.userOperation === this.currentUser;
|
|
2250
|
+
})[0];
|
|
2251
|
+
let spotlightUser = {
|
|
2252
|
+
spotlightId: spotlight.id,
|
|
2253
|
+
showDate: days ? this.getShowDate(days) : null,
|
|
2254
|
+
userOperation: this.currentUser
|
|
2255
|
+
};
|
|
2256
|
+
if (user) {
|
|
2257
|
+
spotlightUser = {
|
|
2258
|
+
id: user.id,
|
|
2259
|
+
...spotlightUser
|
|
2260
|
+
};
|
|
2261
|
+
}
|
|
2262
|
+
this.spotlightService.saveSpotlightUser(spotlightUser).subscribe();
|
|
2263
|
+
}
|
|
2264
|
+
onPrimary() {
|
|
2265
|
+
const spotlight = this.spotlightScreen.spotlight;
|
|
2266
|
+
const notification = this.buildNotification(UserAction.CONFIRMED);
|
|
2267
|
+
this.saveSpotlightControl();
|
|
2268
|
+
this.saveSpotlightUser();
|
|
2269
|
+
if (this.canEmitEvent) {
|
|
2270
|
+
this.spotlightService.notificateSpotlight(notification).subscribe();
|
|
2271
|
+
}
|
|
2272
|
+
if (spotlight.primaryButtonUrl) {
|
|
2273
|
+
window.open(spotlight.primaryButtonUrl);
|
|
2274
|
+
}
|
|
2275
|
+
this.close();
|
|
2276
|
+
}
|
|
2277
|
+
onSecondary() {
|
|
2278
|
+
const notification = this.buildNotification(UserAction.POSTPONED);
|
|
2279
|
+
this.saveSpotlightControl(EnumSpotlightStatus.REFUSED);
|
|
2280
|
+
this.saveSpotlightUser(this.spotlightScreen.spotlight.daysRememberLate);
|
|
2281
|
+
this.spotlightService.notificateSpotlight(notification).subscribe();
|
|
2282
|
+
this.close();
|
|
2283
|
+
}
|
|
2284
|
+
onTertiary() {
|
|
2285
|
+
const notification = this.buildNotification(UserAction.REFUSED);
|
|
2286
|
+
this.saveSpotlightControl(EnumSpotlightStatus.REFUSED);
|
|
2287
|
+
this.saveSpotlightUser(this.spotlightScreen.spotlight.daysNotInterested);
|
|
2288
|
+
this.spotlightService.notificateSpotlight(notification).subscribe();
|
|
2289
|
+
this.close();
|
|
2290
|
+
}
|
|
2291
|
+
/**
|
|
2292
|
+
* Verifica se um registro de usuário pertence ao usuário logado e corresponde ao spotlight atual
|
|
2293
|
+
* @param user SpotlightUser Objeto representando o registro do usuário para uma spotlight
|
|
2294
|
+
* @param spotlight Spotlight Spotlight
|
|
2295
|
+
* @returns boolean true se corresponder ao spotlight atual, false caso contrário
|
|
2296
|
+
*/
|
|
2297
|
+
hasThisRegister(user, spotlight) {
|
|
2298
|
+
return (user.spotlightId === spotlight.id && user.userOperation === this.currentUser);
|
|
2299
|
+
}
|
|
2300
|
+
/**
|
|
2301
|
+
* Verifica se um registro de usuário pertece ao usuário logado, mas não corresponde ao spotlight atual
|
|
2302
|
+
* @param user SpotlightUser Objeto representando o registro do usuário para uma spotlight
|
|
2303
|
+
* @param spotlight Spotlight Spotlight
|
|
2304
|
+
* @returns boolean true se corresponder ao spotlight atual, false caso contrário
|
|
2305
|
+
*/
|
|
2306
|
+
hasAnotherRegister(user, spotlight) {
|
|
2307
|
+
return user.spotlightId !== spotlight.id && user.userOperation === this.currentUser;
|
|
2308
|
+
}
|
|
2309
|
+
/**
|
|
2310
|
+
* Persiste um novo registro de controle para o spotlight atual se
|
|
2311
|
+
* não for encontrado nenhum na lista de controles carregada inicialmente
|
|
2312
|
+
* @param status EnumSpotlightStatus Status do controle do spotlight. Se nenhum for informado, IN_PROGRESS será aplicado
|
|
2313
|
+
* @returns SpotlightControl Controle do spotlight recuperado/pesistido
|
|
2314
|
+
*/
|
|
2315
|
+
saveSpotlightControl(status = EnumSpotlightStatus.IN_PROGRESS) {
|
|
2316
|
+
const spotlight = this.spotlightScreen.spotlight;
|
|
2317
|
+
let control = this.getSpotlightControlFromList(spotlight.id);
|
|
2318
|
+
if (!control) {
|
|
2319
|
+
control = {
|
|
2320
|
+
spotlightId: spotlight.id,
|
|
2321
|
+
status: status,
|
|
2322
|
+
firstUser: this.currentUser
|
|
2323
|
+
};
|
|
2324
|
+
}
|
|
2325
|
+
if (this.isNewControl(control) || control.status !== EnumSpotlightStatus.IN_PROGRESS) {
|
|
2326
|
+
control.status = status;
|
|
2327
|
+
control.firstUser = status === EnumSpotlightStatus.IN_PROGRESS ? this.currentUser : '';
|
|
2328
|
+
this.spotlightService.saveSpotlightControl(control).subscribe();
|
|
2329
|
+
}
|
|
2330
|
+
return control;
|
|
2331
|
+
}
|
|
2332
|
+
/**
|
|
2333
|
+
* Retorna o controle de spotlight correspondente ao identificador
|
|
2334
|
+
* informado na lista de controles carregada na inicialização do componente
|
|
2335
|
+
* @param id string Identificador do controle de spotlight
|
|
2336
|
+
*/
|
|
2337
|
+
getSpotlightControlFromList(id) {
|
|
2338
|
+
return this.spotlightControlsList.contents.filter(val => val.spotlightId === id)[0];
|
|
2339
|
+
}
|
|
2340
|
+
/**
|
|
2341
|
+
* Verifica se o controle de spotlight informado não foi registrado ainda
|
|
2342
|
+
* @param spotlightControl SpotlightControl Controle do spotlight
|
|
2343
|
+
* @returns boolean true se ainda não foi registrado na base, false caso contrário
|
|
2344
|
+
*/
|
|
2345
|
+
isNewControl(spotlightControl) {
|
|
2346
|
+
return !this.spotlightControlsList.contents.includes(spotlightControl);
|
|
2347
|
+
}
|
|
2348
|
+
/**
|
|
2349
|
+
* Retorna um objeto de notificação referente ao botão clicado pelo usuário.
|
|
2350
|
+
* @param userAction UserAction Ação realizada pelo usuário ao clicar nos botões da modal
|
|
2351
|
+
* @returns SpotlightNotification Objeto de notificação
|
|
2352
|
+
*/
|
|
2353
|
+
buildNotification(userAction) {
|
|
2354
|
+
const spotlight = this.spotlightScreen.spotlight;
|
|
2355
|
+
return {
|
|
2356
|
+
clickedButton: userAction,
|
|
2357
|
+
spotlightControlId: spotlight.id,
|
|
2358
|
+
primaryButtonUrl: spotlight.primaryButtonUrl
|
|
2359
|
+
};
|
|
2360
|
+
}
|
|
2361
|
+
close() {
|
|
2362
|
+
this.visibleChange.emit(false);
|
|
2363
|
+
}
|
|
2364
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SpotlightComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2365
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: SpotlightComponent, selector: "s-spotlight", inputs: { visible: "visible", menuId: "menuId", fade: "fade" }, outputs: { visibleChange: "visibleChange" }, ngImport: i0, template: "<div class=\"s-spotlight-overlay\" id=\"ol\" *ngIf=\"canAppear && visible\">\n <div class=\"s-spotlight\" id=\"sl\" [ngClass]=\"{'s-effect-fadein': fade}\">\n <div class=\"s-spotlight-header\">\n <span class=\"s-spotlight-title\">{{header.toUpperCase()}}</span>\n <a role=\"button\" class=\"s-spotlight-close\" (click)=\"close()\"><span class=\"fa fa-times\" aria-hidden=\"true\"></span></a>\n </div>\n <div class=\"s-img\">\n <img src=\"{{imgUrl}}\">\n </div>\n <div class=\"s-spotlight-footer\">\n <div class=\"s-spotlight-footer-left\">\n <button\n pButton\n type=\"submit\"\n id=\"decline-button\"\n label=\"{{'platform.spotlight.no_interest' | translate}}\"\n (click)=\"onTertiary()\"\n class=\"ui-button-link\">\n </button>\n </div>\n <div class=\"s-spotlight-footer-right\">\n <button\n pButton\n type=\"submit\"\n id=\"remember-button\"\n label=\"{{'platform.spotlight.remember_late' | translate}}\"\n (click)=\"onSecondary()\"\n class=\"ui-button-raised ui-button-secondary\">\n </button>\n <button\n pButton\n label=\"{{primaryButtonLabel}}\"\n type=\"submit\"\n id=\"submit-button\"\n (click)=\"onPrimary()\"\n [pTooltip]=\"primaryButtonTooltip\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n class=\"ui-button-raised\">\n </button>\n </div>\n </div>\n</div>\n</div>", styles: [".s-spotlight-overlay{display:flex;position:fixed;z-index:10;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:#000;background-color:#0006}.s-spotlight{border-radius:3px;background:#fff;margin:auto;overflow:hidden;animation:move .15s forwards}.s-spotlight-header,.s-spotlight-footer{display:flex;padding:15px}.s-spotlight-header{align-items:center;justify-content:space-between}.s-spotlight-footer,.s-spotlight-footer-right,.s-spotlight-footer-left{display:flex}.s-spotlight-footer-right{flex:2;justify-content:flex-end}.s-spotlight-footer-left{flex:1;justify-content:flex-start}.s-spotlight-title{font-family:Open Sans,sans-serif;font-size:16px;font-weight:400;color:#333}.s-spotlight-close{display:block;margin-left:15px;color:#000}.s-img{width:100%;display:flex;align-items:center;justify-content:center}.s-img img{width:100%}.s-effect-fadein{animation:fade .15s forwards}@keyframes fade{0%{opacity:0}to{opacity:1}}@media (max-width: 595px){.s-spotlight-footer,.s-spotlight-footer-right,.s-spotlight-footer-left{align-items:center;flex-direction:column-reverse}.s-spotlight-footer button{margin:0 0 15px!important;width:100%!important}}@media (min-width: 576px){.s-spotlight{width:100%}}@media (min-width: 768px){.s-spotlight{width:720px}.s-spotlight-footer,.s-spotlight-footer-right,.s-spotlight-footer-left{flex-direction:row}}@media (min-width: 992px){.s-spotlight{width:960px}}@media (min-width: 1200px){.s-spotlight{width:50%}}\n"], dependencies: [{ kind: "directive", type: i1$3.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "directive", type: i2$2.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }] });
|
|
2366
|
+
}
|
|
2367
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SpotlightComponent, decorators: [{
|
|
2368
|
+
type: Component,
|
|
2369
|
+
args: [{ selector: 's-spotlight', template: "<div class=\"s-spotlight-overlay\" id=\"ol\" *ngIf=\"canAppear && visible\">\n <div class=\"s-spotlight\" id=\"sl\" [ngClass]=\"{'s-effect-fadein': fade}\">\n <div class=\"s-spotlight-header\">\n <span class=\"s-spotlight-title\">{{header.toUpperCase()}}</span>\n <a role=\"button\" class=\"s-spotlight-close\" (click)=\"close()\"><span class=\"fa fa-times\" aria-hidden=\"true\"></span></a>\n </div>\n <div class=\"s-img\">\n <img src=\"{{imgUrl}}\">\n </div>\n <div class=\"s-spotlight-footer\">\n <div class=\"s-spotlight-footer-left\">\n <button\n pButton\n type=\"submit\"\n id=\"decline-button\"\n label=\"{{'platform.spotlight.no_interest' | translate}}\"\n (click)=\"onTertiary()\"\n class=\"ui-button-link\">\n </button>\n </div>\n <div class=\"s-spotlight-footer-right\">\n <button\n pButton\n type=\"submit\"\n id=\"remember-button\"\n label=\"{{'platform.spotlight.remember_late' | translate}}\"\n (click)=\"onSecondary()\"\n class=\"ui-button-raised ui-button-secondary\">\n </button>\n <button\n pButton\n label=\"{{primaryButtonLabel}}\"\n type=\"submit\"\n id=\"submit-button\"\n (click)=\"onPrimary()\"\n [pTooltip]=\"primaryButtonTooltip\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n class=\"ui-button-raised\">\n </button>\n </div>\n </div>\n</div>\n</div>", styles: [".s-spotlight-overlay{display:flex;position:fixed;z-index:10;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:#000;background-color:#0006}.s-spotlight{border-radius:3px;background:#fff;margin:auto;overflow:hidden;animation:move .15s forwards}.s-spotlight-header,.s-spotlight-footer{display:flex;padding:15px}.s-spotlight-header{align-items:center;justify-content:space-between}.s-spotlight-footer,.s-spotlight-footer-right,.s-spotlight-footer-left{display:flex}.s-spotlight-footer-right{flex:2;justify-content:flex-end}.s-spotlight-footer-left{flex:1;justify-content:flex-start}.s-spotlight-title{font-family:Open Sans,sans-serif;font-size:16px;font-weight:400;color:#333}.s-spotlight-close{display:block;margin-left:15px;color:#000}.s-img{width:100%;display:flex;align-items:center;justify-content:center}.s-img img{width:100%}.s-effect-fadein{animation:fade .15s forwards}@keyframes fade{0%{opacity:0}to{opacity:1}}@media (max-width: 595px){.s-spotlight-footer,.s-spotlight-footer-right,.s-spotlight-footer-left{align-items:center;flex-direction:column-reverse}.s-spotlight-footer button{margin:0 0 15px!important;width:100%!important}}@media (min-width: 576px){.s-spotlight{width:100%}}@media (min-width: 768px){.s-spotlight{width:720px}.s-spotlight-footer,.s-spotlight-footer-right,.s-spotlight-footer-left{flex-direction:row}}@media (min-width: 992px){.s-spotlight{width:960px}}@media (min-width: 1200px){.s-spotlight{width:50%}}\n"] }]
|
|
2370
|
+
}], propDecorators: { visible: [{
|
|
2371
|
+
type: Input
|
|
2372
|
+
}], menuId: [{
|
|
2373
|
+
type: Input
|
|
2374
|
+
}], fade: [{
|
|
2375
|
+
type: Input
|
|
2376
|
+
}], visibleChange: [{
|
|
2377
|
+
type: Output
|
|
2378
|
+
}] } });
|
|
2379
|
+
|
|
2380
|
+
const fallback = {
|
|
2381
|
+
'platform.spotlight.no_interest': 'Não tenho interesse',
|
|
2382
|
+
'platform.spotlight.remember_late': 'Lembrar mais tarde'
|
|
2383
|
+
};
|
|
2384
|
+
|
|
2385
|
+
class SpotlightModule {
|
|
2386
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SpotlightModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2387
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: SpotlightModule, declarations: [SpotlightComponent,
|
|
2388
|
+
TranslatePipe], imports: [ButtonModule$1,
|
|
2389
|
+
TooltipModule,
|
|
2390
|
+
CommonModule,
|
|
2391
|
+
HttpInterceptorModule, TranslationsModule], exports: [SpotlightComponent] });
|
|
2392
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SpotlightModule, providers: [
|
|
2393
|
+
SpotlightService,
|
|
2394
|
+
DatePipe,
|
|
2395
|
+
CookieService
|
|
2396
|
+
], imports: [ButtonModule$1,
|
|
2397
|
+
TooltipModule,
|
|
2398
|
+
CommonModule,
|
|
2399
|
+
HttpInterceptorModule,
|
|
2400
|
+
TranslationsModule.forChild([{ domain: 'platform', service: 'spotlight', fallback }])] });
|
|
2401
|
+
}
|
|
2402
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SpotlightModule, decorators: [{
|
|
2403
|
+
type: NgModule,
|
|
2404
|
+
args: [{
|
|
2405
|
+
imports: [
|
|
2406
|
+
ButtonModule$1,
|
|
2407
|
+
TooltipModule,
|
|
2408
|
+
CommonModule,
|
|
2409
|
+
HttpInterceptorModule,
|
|
2410
|
+
TranslationsModule.forChild([{ domain: 'platform', service: 'spotlight', fallback }]),
|
|
2411
|
+
],
|
|
2412
|
+
providers: [
|
|
2413
|
+
SpotlightService,
|
|
2414
|
+
DatePipe,
|
|
2415
|
+
CookieService
|
|
2416
|
+
],
|
|
2417
|
+
declarations: [
|
|
2418
|
+
SpotlightComponent,
|
|
2419
|
+
TranslatePipe
|
|
2420
|
+
],
|
|
2421
|
+
exports: [SpotlightComponent]
|
|
2422
|
+
}]
|
|
2423
|
+
}] });
|
|
2424
|
+
|
|
2425
|
+
/// <reference path="./json-cycle.d.ts" />
|
|
2426
|
+
|
|
2427
|
+
/**
|
|
2428
|
+
* Generated bundle index. Do not edit.
|
|
2429
|
+
*/
|
|
2430
|
+
|
|
2431
|
+
export { AdvancedFilterComponent, AdvancedFilterModule, AdvancedFilterService, AppRoutingModule, CyclicJsonInterceptorModule, FeatureToggleModule, FeatureToggleService, Filter, FilterType, FormFilter, FormFilterComponent, HttpInterceptorModule, LENGTH_DEFAULT, PermissionsModule, PermissionsService, RestUrl, Scope, SpotlightComponent, SpotlightModule, TranslationsConfig, TranslationsModule, USER_INFO, XServicesUrl, factory, promise };
|
|
2432
|
+
//# sourceMappingURL=seniorsistemas-platform-components.mjs.map
|