@bnsights/bbsf-utilities 1.0.40 → 1.0.42
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/README.md +4 -0
- package/bnsights-bbsf-utilities-1.0.42.tgz +0 -0
- package/esm2020/lib/bbsf-utilities.module.mjs +59 -0
- package/esm2020/lib/shared/authentication/auth.service.mjs +211 -0
- package/esm2020/lib/shared/authentication/index.mjs +2 -0
- package/{esm2015/lib/shared/config/environment.js → esm2020/lib/shared/config/environment.mjs} +1 -1
- package/esm2020/lib/shared/config/word/docx-document.mjs +348 -0
- package/esm2020/lib/shared/config/word/helpers/render-document-file.mjs +154 -0
- package/esm2020/lib/shared/config/word/helpers/xml-builder.mjs +1836 -0
- package/esm2020/lib/shared/config/word/html-to-docx.mjs +187 -0
- package/esm2020/lib/shared/config/word/index.mjs +50 -0
- package/esm2020/lib/shared/config/word/namespaces.mjs +37 -0
- package/{esm2015/lib/shared/config/word/schemas/core.js → esm2020/lib/shared/config/word/schemas/core.mjs} +1 -3
- package/esm2020/lib/shared/config/word/schemas/document.template.mjs +107 -0
- package/{esm2015/lib/shared/config/word/schemas/numbering.js → esm2020/lib/shared/config/word/schemas/numbering.mjs} +1 -3
- package/esm2020/lib/shared/config/word/schemas/styles.mjs +147 -0
- package/esm2020/lib/shared/config/word/schemas/theme.mjs +198 -0
- package/{esm2015/lib/shared/config/word/utils/url.js → esm2020/lib/shared/config/word/utils/url.mjs} +1 -3
- package/esm2020/lib/shared/enums/authentication-modes-enums.mjs +8 -0
- package/esm2020/lib/shared/index.mjs +4 -0
- package/{esm2015/lib/shared/models/UserModel.js → esm2020/lib/shared/models/UserModel.mjs} +1 -1
- package/esm2020/lib/shared/models/area-model.mjs +3 -0
- package/esm2020/lib/shared/models/error-model.mjs +3 -0
- package/esm2020/lib/shared/models/index.mjs +5 -0
- package/esm2020/lib/shared/models/request-options-model.mjs +11 -0
- package/esm2020/lib/shared/models/word-document-model.mjs +8 -0
- package/esm2020/lib/shared/services/appearance-configuration.service.mjs +35 -0
- package/esm2020/lib/shared/services/configuration.service.mjs +24 -0
- package/esm2020/lib/shared/services/control-validation.service.mjs +173 -0
- package/esm2020/lib/shared/services/environment.service.mjs +75 -0
- package/esm2020/lib/shared/services/index.mjs +12 -0
- package/esm2020/lib/shared/services/master-layout.service.mjs +72 -0
- package/esm2020/lib/shared/services/request-handler.service.mjs +199 -0
- package/esm2020/lib/shared/services/styles-bundle.service.mjs +55 -0
- package/esm2020/lib/shared/services/translate.service.mjs +14 -0
- package/esm2020/lib/shared/services/translation-resolver.service.mjs +7 -0
- package/esm2020/lib/shared/services/utility.service.mjs +87 -0
- package/esm2020/lib/shared/services/word-document.service.mjs +38 -0
- package/esm2020/public-api.mjs +30 -0
- package/fesm2015/{bnsights-bbsf-utilities.js → bnsights-bbsf-utilities.mjs} +741 -787
- package/fesm2015/bnsights-bbsf-utilities.mjs.map +1 -0
- package/fesm2020/bnsights-bbsf-utilities.mjs +4589 -0
- package/fesm2020/bnsights-bbsf-utilities.mjs.map +1 -0
- package/{bnsights-bbsf-utilities.d.ts → index.d.ts} +1 -0
- package/lib/bbsf-utilities.module.d.ts +8 -4
- package/lib/shared/authentication/auth.service.d.ts +11 -8
- package/lib/shared/authentication/index.d.ts +1 -0
- package/lib/shared/config/word/docx-document.d.ts +10 -10
- package/lib/shared/config/word/helpers/render-document-file.d.ts +0 -2
- package/lib/shared/config/word/helpers/xml-builder.d.ts +12 -10
- package/lib/shared/config/word/index.d.ts +1 -1
- package/lib/shared/config/word/word-work/templates/documentTemplate.d.ts +2 -2
- package/lib/shared/enums/authentication-modes-enums.d.ts +6 -0
- package/lib/shared/index.d.ts +3 -0
- package/lib/shared/models/area-model.d.ts +4 -0
- package/lib/shared/models/index.d.ts +4 -0
- package/lib/shared/services/{AppearanceConfiguration.service.d.ts → appearance-configuration.service.d.ts} +4 -1
- package/lib/shared/services/configuration.service.d.ts +3 -0
- package/lib/shared/services/{controlvalidation.service.d.ts → control-validation.service.d.ts} +8 -5
- package/lib/shared/services/environment.service.d.ts +12 -1
- package/lib/shared/services/index.d.ts +11 -0
- package/lib/shared/services/{masterlayout.service.d.ts → master-layout.service.d.ts} +6 -6
- package/lib/shared/services/{requesthandler.service.d.ts → request-handler.service.d.ts} +8 -7
- package/lib/shared/services/{stylesbundle.service.d.ts → styles-bundle.service.d.ts} +4 -1
- package/lib/shared/services/translate.service.d.ts +3 -0
- package/lib/shared/services/translation-resolver.service.d.ts +2 -0
- package/lib/shared/services/utility.service.d.ts +7 -3
- package/lib/shared/services/word-document.service.d.ts +5 -2
- package/package.json +41 -21
- package/public-api.d.ts +10 -9
- package/bnsights-bbsf-utilities-1.0.40.tgz +0 -0
- package/bnsights-bbsf-utilities.metadata.json +0 -1
- package/bundles/bnsights-bbsf-utilities.umd.js +0 -4777
- package/bundles/bnsights-bbsf-utilities.umd.js.map +0 -1
- package/esm2015/lib/bbsf-utilities.module.js +0 -54
- package/esm2015/lib/shared/authentication/auth.service.js +0 -199
- package/esm2015/lib/shared/config/word/docx-document.js +0 -351
- package/esm2015/lib/shared/config/word/helpers/render-document-file.js +0 -278
- package/esm2015/lib/shared/config/word/helpers/xml-builder.js +0 -1765
- package/esm2015/lib/shared/config/word/html-to-docx.js +0 -195
- package/esm2015/lib/shared/config/word/index.js +0 -55
- package/esm2015/lib/shared/config/word/namespaces.js +0 -37
- package/esm2015/lib/shared/config/word/schemas/document.template.js +0 -109
- package/esm2015/lib/shared/config/word/schemas/styles.js +0 -149
- package/esm2015/lib/shared/config/word/schemas/theme.js +0 -200
- package/esm2015/lib/shared/models/AreaModel.js +0 -3
- package/esm2015/lib/shared/models/ErrorModel.js +0 -3
- package/esm2015/lib/shared/models/RequestOptionsModel.js +0 -11
- package/esm2015/lib/shared/models/WordDocumentModel.js +0 -8
- package/esm2015/lib/shared/services/AppearanceConfiguration.service.js +0 -37
- package/esm2015/lib/shared/services/configuration.service.js +0 -26
- package/esm2015/lib/shared/services/controlvalidation.service.js +0 -175
- package/esm2015/lib/shared/services/environment.service.js +0 -52
- package/esm2015/lib/shared/services/masterlayout.service.js +0 -89
- package/esm2015/lib/shared/services/requesthandler.service.js +0 -206
- package/esm2015/lib/shared/services/stylesbundle.service.js +0 -56
- package/esm2015/lib/shared/services/translate.service.js +0 -13
- package/esm2015/lib/shared/services/translationresolver.service.js +0 -20
- package/esm2015/lib/shared/services/utility.service.js +0 -92
- package/esm2015/lib/shared/services/word-document.service.js +0 -39
- package/esm2015/public-api.js +0 -20
- package/fesm2015/bnsights-bbsf-utilities.js.map +0 -1
- package/lib/shared/models/AreaModel.d.ts +0 -4
- package/lib/shared/services/translationresolver.service.d.ts +0 -8
- /package/{esm2015/bnsights-bbsf-utilities.js → esm2020/bnsights-bbsf-utilities.mjs} +0 -0
- /package/{esm2015/lib/shared/config/word/constants.js → esm2020/lib/shared/config/word/constants.mjs} +0 -0
- /package/{esm2015/lib/shared/config/word/helpers/index.js → esm2020/lib/shared/config/word/helpers/index.mjs} +0 -0
- /package/{esm2015/lib/shared/config/word/schemas/content-types.js → esm2020/lib/shared/config/word/schemas/content-types.mjs} +0 -0
- /package/{esm2015/lib/shared/config/word/schemas/document-rels.js → esm2020/lib/shared/config/word/schemas/document-rels.mjs} +0 -0
- /package/{esm2015/lib/shared/config/word/schemas/font-table.js → esm2020/lib/shared/config/word/schemas/font-table.mjs} +0 -0
- /package/{esm2015/lib/shared/config/word/schemas/generic-rels.js → esm2020/lib/shared/config/word/schemas/generic-rels.mjs} +0 -0
- /package/{esm2015/lib/shared/config/word/schemas/index.js → esm2020/lib/shared/config/word/schemas/index.mjs} +0 -0
- /package/{esm2015/lib/shared/config/word/schemas/rels.js → esm2020/lib/shared/config/word/schemas/rels.mjs} +0 -0
- /package/{esm2015/lib/shared/config/word/schemas/settings.js → esm2020/lib/shared/config/word/schemas/settings.mjs} +0 -0
- /package/{esm2015/lib/shared/config/word/schemas/web-settings.js → esm2020/lib/shared/config/word/schemas/web-settings.mjs} +0 -0
- /package/{esm2015/lib/shared/config/word/utils/color-conversion.js → esm2020/lib/shared/config/word/utils/color-conversion.mjs} +0 -0
- /package/{esm2015/lib/shared/config/word/utils/list.js → esm2020/lib/shared/config/word/utils/list.mjs} +0 -0
- /package/{esm2015/lib/shared/config/word/utils/unit-conversion.js → esm2020/lib/shared/config/word/utils/unit-conversion.mjs} +0 -0
- /package/{esm2015/lib/shared/config/word/utils/vnode.js → esm2020/lib/shared/config/word/utils/vnode.mjs} +0 -0
- /package/{esm2015/lib/shared/config/word/word-work/templates/documentTemplate.js → esm2020/lib/shared/config/word/word-work/templates/documentTemplate.mjs} +0 -0
- /package/{esm2015/lib/shared/config/word/word-work/templates/index.js → esm2020/lib/shared/config/word/word-work/templates/index.mjs} +0 -0
- /package/{esm2015/lib/shared/config/word/word-work/templates/mhtDocumentTemplate.js → esm2020/lib/shared/config/word/word-work/templates/mhtDocumentTemplate.mjs} +0 -0
- /package/{esm2015/lib/shared/config/word/word-work/templates/mhtPartTemplate.js → esm2020/lib/shared/config/word/word-work/templates/mhtPartTemplate.mjs} +0 -0
- /package/{esm2015/lib/shared/config/word/word-work/utils.js → esm2020/lib/shared/config/word/word-work/utils.mjs} +0 -0
- /package/lib/shared/models/{ErrorModel.d.ts → error-model.d.ts} +0 -0
- /package/lib/shared/models/{RequestOptionsModel.d.ts → request-options-model.d.ts} +0 -0
- /package/lib/shared/models/{WordDocumentModel.d.ts → word-document-model.d.ts} +0 -0
|
@@ -1,26 +1,26 @@
|
|
|
1
|
+
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
1
2
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable,
|
|
3
|
-
import * as
|
|
4
|
-
import {
|
|
5
|
-
import * as
|
|
3
|
+
import { Injectable, Inject, inject, NgModule } from '@angular/core';
|
|
4
|
+
import * as i1$1 from '@angular/router';
|
|
5
|
+
import { RouterModule } from '@angular/router';
|
|
6
|
+
import * as i4 from '@ngx-translate/core';
|
|
6
7
|
import { TranslateService } from '@ngx-translate/core';
|
|
8
|
+
import * as i1$2 from 'ng-block-ui';
|
|
7
9
|
import { BlockUI, BlockUIModule } from 'ng-block-ui';
|
|
10
|
+
import * as i2 from 'ngx-toastr';
|
|
8
11
|
import { ToastrService, ToastrModule } from 'ngx-toastr';
|
|
9
|
-
import
|
|
12
|
+
import * as i4$1 from 'ngx-cookie-service';
|
|
13
|
+
import { CookieService } from 'ngx-cookie-service';
|
|
10
14
|
import { __decorate, __awaiter, __rest } from 'tslib';
|
|
11
|
-
import * as i1
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
15
|
+
import * as i1 from '@angular/common/http';
|
|
16
|
+
import { HttpParams, HttpHeaders } from '@angular/common/http';
|
|
17
|
+
import { Subject, Observable, throwError, BehaviorSubject } from 'rxjs';
|
|
14
18
|
import { JwtHelperService } from '@auth0/angular-jwt';
|
|
15
|
-
import * as i5 from 'ngx-cookie-service';
|
|
16
|
-
import { CookieService } from 'ngx-cookie-service';
|
|
17
|
-
import { takeUntil, tap, map } from 'rxjs/operators';
|
|
18
19
|
import { plainToClass } from 'class-transformer';
|
|
19
|
-
import
|
|
20
|
-
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
20
|
+
import { takeUntil, tap, map } from 'rxjs/operators';
|
|
21
21
|
import JSZip from 'jszip';
|
|
22
22
|
import { fragment, create } from 'xmlbuilder2';
|
|
23
|
-
import VNode from 'virtual-dom/vnode/vnode';
|
|
23
|
+
import VNode$1 from 'virtual-dom/vnode/vnode';
|
|
24
24
|
import VText from 'virtual-dom/vnode/vtext';
|
|
25
25
|
import HTMLToVDOM from 'html-to-vdom';
|
|
26
26
|
import { cloneDeep } from 'lodash';
|
|
@@ -28,361 +28,418 @@ import { nanoid } from 'nanoid';
|
|
|
28
28
|
import isVNode from 'virtual-dom/vnode/is-vnode';
|
|
29
29
|
import isVText from 'virtual-dom/vnode/is-vtext';
|
|
30
30
|
import escape from 'escape-html';
|
|
31
|
-
import
|
|
31
|
+
import colorNames from 'color-name';
|
|
32
32
|
import imageToBase64 from 'image-to-base64';
|
|
33
33
|
import mimeTypes from 'mime-types';
|
|
34
|
-
import
|
|
34
|
+
import sizeOf from 'image-size';
|
|
35
35
|
|
|
36
|
-
class
|
|
37
|
-
}
|
|
38
|
-
BBSFTranslateService.ɵprov = i0.ɵɵdefineInjectable({ factory: function BBSFTranslateService_Factory() { return new BBSFTranslateService(i0.ɵɵinject(i1.TranslateStore), i0.ɵɵinject(i1.TranslateLoader), i0.ɵɵinject(i1.TranslateCompiler), i0.ɵɵinject(i1.TranslateParser), i0.ɵɵinject(i1.MissingTranslationHandler), i0.ɵɵinject(i1.USE_DEFAULT_LANG), i0.ɵɵinject(i1.USE_STORE), i0.ɵɵinject(i1.USE_EXTEND), i0.ɵɵinject(i1.DEFAULT_LANGUAGE)); }, token: BBSFTranslateService, providedIn: "root" });
|
|
39
|
-
BBSFTranslateService.decorators = [
|
|
40
|
-
{ type: Injectable, args: [{
|
|
41
|
-
providedIn: 'root'
|
|
42
|
-
},] }
|
|
43
|
-
];
|
|
36
|
+
class User {
|
|
37
|
+
}
|
|
44
38
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
* import the following file, but please comment it out in production mode
|
|
53
|
-
* because it will have performance impact when throw error
|
|
54
|
-
*/
|
|
55
|
-
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
|
|
39
|
+
var AuthenticationModes;
|
|
40
|
+
(function (AuthenticationModes) {
|
|
41
|
+
AuthenticationModes["Forms"] = "Forms";
|
|
42
|
+
AuthenticationModes["UAEPass"] = "UAEPass";
|
|
43
|
+
AuthenticationModes["WindowsAD"] = "WindowsAD";
|
|
44
|
+
AuthenticationModes["AzureAD"] = "AzureAD";
|
|
45
|
+
})(AuthenticationModes || (AuthenticationModes = {}));
|
|
56
46
|
|
|
57
|
-
class
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
getBaseUrl() {
|
|
62
|
-
let Url = environment["BBSF_BaseURL"];
|
|
63
|
-
return Url;
|
|
47
|
+
class AppearanceConfigurationService {
|
|
48
|
+
constructor(configService) {
|
|
49
|
+
this.configService = configService;
|
|
64
50
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return Url;
|
|
51
|
+
getLayoutTheme() {
|
|
52
|
+
return this.configService.getConfigurationValue('AnonymousLayout_Theme');
|
|
68
53
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return Mode;
|
|
54
|
+
getFooterText() {
|
|
55
|
+
return this.configService.getConfigurationValue('AnonymousLayout_FooterText');
|
|
72
56
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return Mode;
|
|
57
|
+
getPageTitle() {
|
|
58
|
+
return this.configService.getConfigurationValue('AnonymousLayout_PageTitle');
|
|
76
59
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
return Url;
|
|
60
|
+
getFavIcon() {
|
|
61
|
+
return this.configService.getConfigurationValue('AnonymousLayout_FavIcon');
|
|
80
62
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return Mode;
|
|
63
|
+
getCustomStyles() {
|
|
64
|
+
return this.configService.getConfigurationValue('AnonymousLayout_CustomStyles');
|
|
84
65
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return Mode;
|
|
66
|
+
getLogo() {
|
|
67
|
+
return this.configService.getConfigurationValue('AnonymousLayout_Logo');
|
|
88
68
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
69
|
+
}
|
|
70
|
+
AppearanceConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AppearanceConfigurationService, deps: [{ token: ConfigurationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
71
|
+
AppearanceConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AppearanceConfigurationService, providedIn: 'root' });
|
|
72
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AppearanceConfigurationService, decorators: [{
|
|
73
|
+
type: Injectable,
|
|
74
|
+
args: [{
|
|
75
|
+
providedIn: 'root'
|
|
76
|
+
}]
|
|
77
|
+
}], ctorParameters: function () { return [{ type: ConfigurationService }]; } });
|
|
78
|
+
|
|
79
|
+
class ConfigurationService {
|
|
80
|
+
constructor(httpClient) {
|
|
81
|
+
this.httpClient = httpClient;
|
|
82
|
+
this.httpClient.get("./assets/config/configurations.json").subscribe(data => {
|
|
83
|
+
ConfigurationService.JsonData = data;
|
|
84
|
+
});
|
|
92
85
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return Mode;
|
|
86
|
+
getConfigurationValue(key) {
|
|
87
|
+
return ConfigurationService.JsonData[key];
|
|
96
88
|
}
|
|
97
89
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
90
|
+
ConfigurationService.JsonData = [];
|
|
91
|
+
ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ConfigurationService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
92
|
+
ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ConfigurationService, providedIn: 'root' });
|
|
93
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ConfigurationService, decorators: [{
|
|
94
|
+
type: Injectable,
|
|
95
|
+
args: [{
|
|
96
|
+
providedIn: 'root'
|
|
97
|
+
}]
|
|
98
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
|
|
105
99
|
|
|
106
|
-
class
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
100
|
+
class AreaModel {
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
class ErrorModel {
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
class RequestOptionsModel {
|
|
107
|
+
constructor() {
|
|
108
|
+
this.disableSuccessNotification = false;
|
|
109
|
+
this.disableBlockUI = false;
|
|
110
|
+
this.disableErrorHandler = false;
|
|
111
|
+
this.responseType = "";
|
|
112
|
+
this.formGroup = null;
|
|
113
|
+
this.castResponsetoClass = true;
|
|
111
114
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
class WordDocumentModel {
|
|
118
|
+
constructor() {
|
|
119
|
+
this.options = new DocumentOptionsModel();
|
|
115
120
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
}
|
|
122
|
+
class DocumentOptionsModel {
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
class ControlValidationService {
|
|
126
|
+
constructor(utilityService) {
|
|
127
|
+
this.utilityService = utilityService;
|
|
128
|
+
this.requestOptions = new RequestOptionsModel();
|
|
129
|
+
this.isCreatedBefor = false;
|
|
124
130
|
}
|
|
125
|
-
|
|
126
|
-
|
|
131
|
+
showGlobalError(errorMessage, formId, deleteOld) {
|
|
132
|
+
let globalErorrElement = document.getElementsByClassName('alert alert-InvalidValidation bg-light-danger text-danger');
|
|
133
|
+
if (globalErorrElement.length > 0) {
|
|
134
|
+
this.removeElementsByClass('alert alert-InvalidValidation bg-light-danger text-danger');
|
|
135
|
+
}
|
|
136
|
+
if (this.isCreatedBefor == true) {
|
|
137
|
+
this.removeElementsByClass('alert alert-InvalidValidation bg-light-danger text-danger');
|
|
138
|
+
}
|
|
139
|
+
// tslint:disable-next-line: prefer-const
|
|
140
|
+
if (!formId)
|
|
141
|
+
formId = "currentForm";
|
|
142
|
+
var object = document.getElementById(formId);
|
|
143
|
+
const tagName = 'div';
|
|
144
|
+
// tslint:disable-next-line: prefer-const
|
|
145
|
+
var elementToAppend = document.createElement(tagName); // Your tag name here
|
|
146
|
+
let message = "";
|
|
147
|
+
if (!errorMessage || (typeof errorMessage == "string")) {
|
|
148
|
+
if (localStorage.getItem('language') == "ar")
|
|
149
|
+
message = errorMessage ? errorMessage : "لديك بعص الأخطاء . من فضلك قم بالمراجعه ";
|
|
150
|
+
else
|
|
151
|
+
message = errorMessage ? errorMessage : "You have some validation errors. Please check below";
|
|
152
|
+
elementToAppend.innerHTML = "<ul class='list-unstyled m-0 py-3 d-flex align-items-center fs-6'><li><i class='fa fa-times-circle text-danger me-3 fs-2'></i>" + message + "</li></ul>";
|
|
153
|
+
elementToAppend.className += 'alert alert-InvalidValidation bg-light-danger text-danger';
|
|
154
|
+
elementToAppend.id += 'errorId';
|
|
155
|
+
// tslint:disable-next-line: prefer-for-of
|
|
156
|
+
const elementToAppen = elementToAppend.cloneNode(true);
|
|
157
|
+
// let targetElement = object.getElementsByClassName("b-control")[0];
|
|
158
|
+
object.insertBefore(elementToAppen, object.firstChild);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
let ul = document.createElement("ul");
|
|
162
|
+
elementToAppend.appendChild(ul);
|
|
163
|
+
for (const iterator of errorMessage) {
|
|
164
|
+
let li = document.createElement("li");
|
|
165
|
+
li.innerHTML = iterator;
|
|
166
|
+
ul.appendChild(li);
|
|
167
|
+
}
|
|
168
|
+
elementToAppend.className += 'alert alert-InvalidValidation bg-light-danger text-danger';
|
|
169
|
+
elementToAppend.id += 'errorId';
|
|
170
|
+
// tslint:disable-next-line: prefer-for-of
|
|
171
|
+
const elementToAppen = elementToAppend.cloneNode(true);
|
|
172
|
+
// let targetElement = object.getElementsByClassName("b-control")[0];
|
|
173
|
+
object.insertBefore(elementToAppen, object.firstChild);
|
|
174
|
+
}
|
|
175
|
+
this.isCreatedBefor = true;
|
|
127
176
|
}
|
|
128
|
-
|
|
129
|
-
|
|
177
|
+
removeGlobalError() {
|
|
178
|
+
const removedList = document.getElementsByClassName('alert alert-InvalidValidation bg-light-danger text-danger');
|
|
179
|
+
// tslint:disable-next-line: prefer-for-of
|
|
180
|
+
for (let index = 0; index < removedList.length; index++) {
|
|
181
|
+
const element = removedList[index];
|
|
182
|
+
element.remove();
|
|
183
|
+
}
|
|
184
|
+
this.isCreatedBefor = false;
|
|
130
185
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
186
|
+
showInputErro(errors) {
|
|
187
|
+
// show error on top of form
|
|
188
|
+
this.showGlobalError();
|
|
189
|
+
// remove old error from server
|
|
190
|
+
this.removeElementsByClass('errortemplet');
|
|
191
|
+
// Looping in error Object
|
|
192
|
+
for (const key in errors) {
|
|
193
|
+
if (errors.hasOwnProperty(key)) {
|
|
194
|
+
for (const iterator of errors[key]) {
|
|
195
|
+
const input = document.querySelectorAll('[ng-reflect-name=' + key + ']')[0];
|
|
196
|
+
if (input.attributes['ng-reflect-name'].value === key) {
|
|
197
|
+
this.removeElementsByClass('erroclass-' + key);
|
|
198
|
+
const tagName = 'p';
|
|
199
|
+
const elementToAppend = document.createElement(tagName); // Your tag name here
|
|
200
|
+
elementToAppend.innerHTML = iterator;
|
|
201
|
+
elementToAppend.style.color = 'red';
|
|
202
|
+
elementToAppend.className += 'errortemplet erroclass-' + key;
|
|
203
|
+
const elementToappen = elementToAppend.cloneNode(true);
|
|
204
|
+
input.parentNode.insertBefore(elementToappen, input.lastChild);
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
136
209
|
}
|
|
137
|
-
|
|
138
|
-
|
|
210
|
+
}
|
|
211
|
+
removeElementsByClass(className) {
|
|
212
|
+
const elements = document.getElementsByClassName(className);
|
|
213
|
+
while (elements.length > 0) {
|
|
214
|
+
elements[0].parentNode.removeChild(elements[0]);
|
|
139
215
|
}
|
|
140
|
-
let toaster = AppInjector.get(ToastrService);
|
|
141
|
-
showHeader ? toaster.success(MessageTemplate, titleTemplate) : toaster.success(MessageTemplate);
|
|
142
216
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
if (Message) {
|
|
147
|
-
MessageTemplate = Message;
|
|
217
|
+
renderServerErrors(form, err, requestOptions, formId) {
|
|
218
|
+
if (err.error == null) {
|
|
219
|
+
return;
|
|
148
220
|
}
|
|
149
|
-
|
|
150
|
-
|
|
221
|
+
let errorsArray = [];
|
|
222
|
+
this.requestOptions = requestOptions;
|
|
223
|
+
if (err.error.validation_errors) {
|
|
224
|
+
err.error.validation_errors.forEach((element) => {
|
|
225
|
+
let fieldName = element.field;
|
|
226
|
+
let controlName = element.controlName;
|
|
227
|
+
let message = element.message;
|
|
228
|
+
if (form == null) {
|
|
229
|
+
this.requestOptions.customErrorMessage ? this.utilityService.notifyErrorMessage(this.requestOptions.customErrorMessage) : this.utilityService.notifyErrorMessage(`${message}`);
|
|
230
|
+
}
|
|
231
|
+
else if (controlName && !this.hasControlName(form, controlName)) {
|
|
232
|
+
errorsArray.push(`${fieldName}: ${message}`);
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
this.setFieldError(form, controlName, fieldName, message);
|
|
236
|
+
this.showGlobalError(null, formId);
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
if (errorsArray.length > 0)
|
|
240
|
+
this.showGlobalError(errorsArray, formId);
|
|
151
241
|
}
|
|
152
|
-
const toaster = AppInjector.get(ToastrService);
|
|
153
|
-
showHeader ? toaster.error(MessageTemplate, titleTemplate) : toaster.error(MessageTemplate);
|
|
154
242
|
}
|
|
155
|
-
|
|
156
|
-
let
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
243
|
+
hasControlName(form, controlName) {
|
|
244
|
+
let control = form.get(controlName);
|
|
245
|
+
return control != null;
|
|
246
|
+
}
|
|
247
|
+
setFieldError(form, controlName, fieldName, message) {
|
|
248
|
+
let control = null;
|
|
249
|
+
if (controlName)
|
|
250
|
+
control = this.getControlFormNameByFieldName(form, controlName);
|
|
251
|
+
else
|
|
252
|
+
control = this.getControlFormNameByFieldName(form, fieldName.split('.')[0]);
|
|
253
|
+
let errors = { "errorMassage": message };
|
|
254
|
+
let fieldNameArray = fieldName.split('.');
|
|
255
|
+
if (fieldNameArray.length >= 1) {
|
|
256
|
+
switch (fieldNameArray[fieldNameArray.length - 1].toLocaleLowerCase()) {
|
|
257
|
+
case "english":
|
|
258
|
+
let englishControl = control.get("English");
|
|
259
|
+
englishControl.setErrors(errors);
|
|
260
|
+
break;
|
|
261
|
+
case "arabic":
|
|
262
|
+
let arabicControl = control.get("Arabic");
|
|
263
|
+
arabicControl.setErrors(errors);
|
|
264
|
+
break;
|
|
265
|
+
default:
|
|
266
|
+
control.setErrors(errors);
|
|
267
|
+
}
|
|
160
268
|
}
|
|
161
|
-
|
|
162
|
-
|
|
269
|
+
else {
|
|
270
|
+
this.requestOptions.customErrorMessage ? this.utilityService.notifyErrorMessage(this.requestOptions.customErrorMessage) : this.utilityService.notifyErrorMessage(`${message}`);
|
|
163
271
|
}
|
|
164
|
-
const toaster = AppInjector.get(ToastrService);
|
|
165
|
-
showHeader ? toaster.warning(MessageTemplate, titleTemplate) : toaster.warning(MessageTemplate);
|
|
166
272
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
273
|
+
getControlFormNameByFieldName(form, fieldName) {
|
|
274
|
+
const formControls = form.controls;
|
|
275
|
+
let controlName = Object.keys(formControls).find(c => c.toLocaleLowerCase() === fieldName.toLocaleLowerCase());
|
|
276
|
+
let control = form.get(controlName);
|
|
277
|
+
return control;
|
|
172
278
|
}
|
|
173
279
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
{ type: Injectable, args: [{
|
|
177
|
-
providedIn: 'root'
|
|
178
|
-
},] }
|
|
179
|
-
];
|
|
180
|
-
UtilityService.ctorParameters = () => [
|
|
181
|
-
{ type: BBSFTranslateService },
|
|
182
|
-
{ type: EnvironmentService }
|
|
183
|
-
];
|
|
280
|
+
ControlValidationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ControlValidationService, deps: [{ token: UtilityService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
281
|
+
ControlValidationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ControlValidationService, providedIn: 'root' });
|
|
184
282
|
__decorate([
|
|
185
283
|
BlockUI()
|
|
186
|
-
],
|
|
284
|
+
], ControlValidationService.prototype, "blockUI", void 0);
|
|
285
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ControlValidationService, decorators: [{
|
|
286
|
+
type: Injectable,
|
|
287
|
+
args: [{
|
|
288
|
+
providedIn: 'root'
|
|
289
|
+
}]
|
|
290
|
+
}], ctorParameters: function () { return [{ type: UtilityService }]; }, propDecorators: { blockUI: [] } });
|
|
187
291
|
|
|
188
|
-
|
|
189
|
-
|
|
292
|
+
// This file can be replaced during build by using the `fileReplacements` array.
|
|
293
|
+
// `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`.
|
|
294
|
+
// The list of file replacements can be found in `angular.json`.
|
|
295
|
+
const environment = Object.assign({}, window.Environment);
|
|
296
|
+
/*
|
|
297
|
+
* In development mode, to ignore zone related error stack frames such as
|
|
298
|
+
* `zone.run`, `zoneDelegate.invokeTask` for easier debugging, you can
|
|
299
|
+
* import the following file, but please comment it out in production mode
|
|
300
|
+
* because it will have performance impact when throw error
|
|
301
|
+
*/
|
|
302
|
+
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
|
|
190
303
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
this.injector = injector;
|
|
195
|
-
this.http = http;
|
|
196
|
-
this.environmentService = environmentService;
|
|
197
|
-
this.translateService = translateService;
|
|
198
|
-
this.router = router;
|
|
199
|
-
this.cookieService = cookieService;
|
|
200
|
-
this.utilityService = utilityService;
|
|
201
|
-
this.redirectUrl = '';
|
|
202
|
-
this.jwtHelper = new JwtHelperService();
|
|
203
|
-
this.isAuthenticatedSubject = new BehaviorSubject(this.hasToken());
|
|
204
|
-
this.isAuthenticate$ = this.isAuthenticatedSubject.asObservable();
|
|
205
|
-
this.user = this.getUserManager();
|
|
304
|
+
class EnvironmentService {
|
|
305
|
+
getEnvironmentObject() {
|
|
306
|
+
return environment;
|
|
206
307
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
return token && !this.jwtHelper.isTokenExpired(token);
|
|
308
|
+
getBaseUrl() {
|
|
309
|
+
return environment["BBSF_BaseURL"];
|
|
210
310
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
if (token)
|
|
214
|
-
this.handleAccessTokenWithoutLanguage(token);
|
|
215
|
-
return AuthService.user;
|
|
311
|
+
getApiUrl() {
|
|
312
|
+
return environment["BBSF_ApiUrl"];
|
|
216
313
|
}
|
|
217
|
-
|
|
218
|
-
|
|
314
|
+
getProductionMode() {
|
|
315
|
+
return environment["BBSF_IsProduction"];
|
|
219
316
|
}
|
|
220
|
-
|
|
221
|
-
|
|
317
|
+
getDefaultLanguage() {
|
|
318
|
+
return environment["BBSF_DefaultLanguage"];
|
|
222
319
|
}
|
|
223
|
-
|
|
224
|
-
return
|
|
320
|
+
getIdentityServerUrl() {
|
|
321
|
+
return environment["BBSF_IdentityServerUrl"];
|
|
225
322
|
}
|
|
226
|
-
|
|
227
|
-
return
|
|
228
|
-
return AuthService.user != null && !this.jwtHelper.isTokenExpired(AuthService.user.access_token);
|
|
229
|
-
});
|
|
323
|
+
getIsIdentityServerExternal() {
|
|
324
|
+
return environment["BBSF_IsExternalIdentityServer"];
|
|
230
325
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
return allowedPermission.includes(selectedPermissionSetID);
|
|
326
|
+
getIsIdentityServerClientId() {
|
|
327
|
+
return environment["BBSF_IdentityServer_Client_Id"];
|
|
234
328
|
}
|
|
235
|
-
|
|
236
|
-
return
|
|
237
|
-
? `${AuthService.user.token_type} ${AuthService.user.access_token}`
|
|
238
|
-
: '';
|
|
329
|
+
getIsIdentityServerClientSecret() {
|
|
330
|
+
return environment["BBSF_IdentityServer_Client_Secret"];
|
|
239
331
|
}
|
|
240
|
-
|
|
241
|
-
|
|
332
|
+
getBBSFAuthenticationMode() {
|
|
333
|
+
let Mode = environment["BBSF_AuthenticationMode"];
|
|
334
|
+
return Mode;
|
|
242
335
|
}
|
|
243
|
-
|
|
244
|
-
|
|
336
|
+
getUAEPassBaseUrl() {
|
|
337
|
+
let Mode = environment["UAEPass_BaseUrl"];
|
|
338
|
+
return Mode;
|
|
245
339
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
return
|
|
340
|
+
getUAEPassClientID() {
|
|
341
|
+
let Mode = environment["UAEPass_ClientID"];
|
|
342
|
+
return Mode;
|
|
249
343
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
if (!this.isAuthenticated()) {
|
|
254
|
-
this.cookieService.delete(TOKEN_KEY);
|
|
255
|
-
this.router.navigate(['/Admin/account/login']);
|
|
256
|
-
}
|
|
257
|
-
this.logout().subscribe(res => {
|
|
258
|
-
this.cookieService.delete(TOKEN_KEY);
|
|
259
|
-
this.router.navigate(['/Admin/account/login']);
|
|
260
|
-
});
|
|
344
|
+
getUAEPassRedirectUrl() {
|
|
345
|
+
let Mode = environment["UAEPass_RedirectUrl"];
|
|
346
|
+
return Mode;
|
|
261
347
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
'Content-Type': 'application/json',
|
|
266
|
-
}),
|
|
267
|
-
};
|
|
268
|
-
let ApiUrl = '/Account/';
|
|
269
|
-
return this.http.get(this.environmentService.getApiUrl() + ApiUrl + 'Logout', httpOptions);
|
|
348
|
+
getUAEPassAuthorizationEndPoint() {
|
|
349
|
+
let Mode = environment["UAEPass_AuthorizationEndPoint"];
|
|
350
|
+
return Mode;
|
|
270
351
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
'Content-Type': 'application/json',
|
|
275
|
-
}),
|
|
276
|
-
};
|
|
277
|
-
let ApiUrl = '/api/Home/';
|
|
278
|
-
return this.http.get(this.environmentService.getBaseUrl() + ApiUrl + 'ClearCurrentUserSession', httpOptions);
|
|
352
|
+
getUAEPassRedirectLogoutUrl() {
|
|
353
|
+
let Mode = environment["UAEPass_RedirectLogoutUrl"];
|
|
354
|
+
return Mode;
|
|
279
355
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
AuthService.user = new User();
|
|
284
|
-
AuthService.user.token_type = "Bearer";
|
|
285
|
-
AuthService.user.access_token = token;
|
|
286
|
-
AuthService.user.profile = this.jwtHelper.decodeToken(token);
|
|
287
|
-
AuthService.user.expires_at = this.jwtHelper.getTokenExpirationDate(token);
|
|
288
|
-
AuthService.timers.map(t => clearInterval(t));
|
|
289
|
-
AuthService.timers = [];
|
|
290
|
-
this.setTokenSeconds();
|
|
291
|
-
AuthService.timers.push(this.checkRefreshToken());
|
|
292
|
-
this.user = AuthService.user;
|
|
293
|
-
yield this.updateLanguage();
|
|
294
|
-
this.cookieService.set(TOKEN_KEY, token, null, null, null, true, 'Strict');
|
|
295
|
-
this.isAuthenticatedSubject.next(true);
|
|
296
|
-
});
|
|
356
|
+
getUAEPassLogoutEndPoint() {
|
|
357
|
+
let Mode = environment["UAEPass_LogoutEndPoint"];
|
|
358
|
+
return Mode;
|
|
297
359
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
AuthService.user.token_type = "Bearer";
|
|
302
|
-
AuthService.user.access_token = token;
|
|
303
|
-
AuthService.user.profile = this.jwtHelper.decodeToken(token);
|
|
304
|
-
AuthService.user.expires_at = this.jwtHelper.getTokenExpirationDate(token);
|
|
305
|
-
this.setTokenSeconds();
|
|
306
|
-
this.user = AuthService.user;
|
|
307
|
-
this.cookieService.set(TOKEN_KEY, token, null, null, null, true, 'Strict');
|
|
308
|
-
this.isAuthenticatedSubject.next(true);
|
|
360
|
+
getIsEnableWindowsAuthentication() {
|
|
361
|
+
let Mode = environment["BBSF_Enable_WindowsAuthentication"];
|
|
362
|
+
return Mode.toLocaleLowerCase() == 'true';
|
|
309
363
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
364
|
+
}
|
|
365
|
+
EnvironmentService.areaList = [];
|
|
366
|
+
EnvironmentService.AreaList = [];
|
|
367
|
+
EnvironmentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EnvironmentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
368
|
+
EnvironmentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EnvironmentService, providedIn: 'root' });
|
|
369
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EnvironmentService, decorators: [{
|
|
370
|
+
type: Injectable,
|
|
371
|
+
args: [{
|
|
372
|
+
providedIn: 'root'
|
|
373
|
+
}]
|
|
374
|
+
}] });
|
|
375
|
+
|
|
376
|
+
class MasterLayoutService {
|
|
377
|
+
constructor(router, http, authService, stylesBundleService, translate, environmentService) {
|
|
378
|
+
this.router = router;
|
|
379
|
+
this.http = http;
|
|
380
|
+
this.authService = authService;
|
|
381
|
+
this.stylesBundleService = stylesBundleService;
|
|
382
|
+
this.translate = translate;
|
|
383
|
+
this.environmentService = environmentService;
|
|
384
|
+
this.apiUrl = '/api/Home/';
|
|
385
|
+
}
|
|
386
|
+
switchLang(lang, bundleEnglishName, bundleArabicName) {
|
|
387
|
+
this.changeLanguage(lang).subscribe((result) => {
|
|
388
|
+
this.updateUserInfo().subscribe((Value) => {
|
|
389
|
+
let UserInfoObject = Value;
|
|
390
|
+
this.authService.handleAccessToken(UserInfoObject.token);
|
|
391
|
+
this.stylesBundleService.loadThemes(lang, bundleEnglishName, bundleArabicName);
|
|
392
|
+
localStorage.setItem('language', lang);
|
|
393
|
+
this.translate.use(lang);
|
|
394
|
+
});
|
|
323
395
|
});
|
|
324
396
|
}
|
|
325
|
-
|
|
326
|
-
let
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
AuthService.seconds--;
|
|
331
|
-
}, 1000);
|
|
397
|
+
reloadComponent() {
|
|
398
|
+
let currentUrl = this.router.url;
|
|
399
|
+
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
|
|
400
|
+
this.router.onSameUrlNavigation = 'reload';
|
|
401
|
+
this.router.navigate([currentUrl]);
|
|
332
402
|
}
|
|
333
|
-
|
|
334
|
-
let
|
|
335
|
-
|
|
403
|
+
changeLanguage(key) {
|
|
404
|
+
let params = new HttpParams();
|
|
405
|
+
params = params.append('UserId', this.authService.user.profile.id);
|
|
406
|
+
params = params.append('LanguageKey', key);
|
|
407
|
+
return this.http.post(this.apiUrl + 'UpdateLanguage', null, null, params);
|
|
336
408
|
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
this.
|
|
409
|
+
logError(error) {
|
|
410
|
+
let params = new HttpParams();
|
|
411
|
+
params = params.append('error', error);
|
|
412
|
+
return this.http.post(this.apiUrl + 'LogError', null, null, params);
|
|
413
|
+
}
|
|
414
|
+
updateUserInfo() {
|
|
415
|
+
return this.http.get(this.apiUrl + 'UpdateUserInfo', null, null);
|
|
416
|
+
}
|
|
417
|
+
switchRole(permissionSetID) {
|
|
418
|
+
this.updateRole(permissionSetID).subscribe((result) => {
|
|
419
|
+
this.updateUserInfo().subscribe((Value) => {
|
|
420
|
+
let UserInfoObject = Value;
|
|
421
|
+
this.authService.handleAccessToken(UserInfoObject.token);
|
|
422
|
+
});
|
|
348
423
|
});
|
|
349
424
|
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
AuthService.seconds = 0;
|
|
356
|
-
AuthService.ɵprov = i0.ɵɵdefineInjectable({ factory: function AuthService_Factory() { return new AuthService(i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(EnvironmentService), i0.ɵɵinject(BBSFTranslateService), i0.ɵɵinject(i4.Router), i0.ɵɵinject(i5.CookieService), i0.ɵɵinject(UtilityService)); }, token: AuthService, providedIn: "root" });
|
|
357
|
-
AuthService.decorators = [
|
|
358
|
-
{ type: Injectable, args: [{
|
|
359
|
-
providedIn: 'root',
|
|
360
|
-
},] }
|
|
361
|
-
];
|
|
362
|
-
AuthService.ctorParameters = () => [
|
|
363
|
-
{ type: Injector },
|
|
364
|
-
{ type: HttpClient },
|
|
365
|
-
{ type: EnvironmentService },
|
|
366
|
-
{ type: BBSFTranslateService },
|
|
367
|
-
{ type: Router },
|
|
368
|
-
{ type: CookieService },
|
|
369
|
-
{ type: UtilityService }
|
|
370
|
-
];
|
|
371
|
-
|
|
372
|
-
class RequestOptionsModel {
|
|
373
|
-
constructor() {
|
|
374
|
-
this.disableSuccessNotification = false;
|
|
375
|
-
this.disableBlockUI = false;
|
|
376
|
-
this.disableErrorHandler = false;
|
|
377
|
-
this.responseType = "";
|
|
378
|
-
this.formGroup = null;
|
|
379
|
-
this.castResponsetoClass = true;
|
|
425
|
+
updateRole(permissionSetID) {
|
|
426
|
+
let params = new HttpParams();
|
|
427
|
+
params = params.append('UserId', this.authService.user.profile.id);
|
|
428
|
+
params = params.append('RoleID', permissionSetID);
|
|
429
|
+
return this.http.post(this.apiUrl + 'SwitchRole', null, null, params);
|
|
380
430
|
}
|
|
381
|
-
}
|
|
431
|
+
}
|
|
432
|
+
MasterLayoutService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MasterLayoutService, deps: [{ token: i1$1.Router }, { token: RequestHandlerService }, { token: AuthService }, { token: StylesBundleService }, { token: i4.TranslateService }, { token: EnvironmentService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
433
|
+
MasterLayoutService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MasterLayoutService, providedIn: 'root' });
|
|
434
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MasterLayoutService, decorators: [{
|
|
435
|
+
type: Injectable,
|
|
436
|
+
args: [{
|
|
437
|
+
providedIn: 'root',
|
|
438
|
+
}]
|
|
439
|
+
}], ctorParameters: function () { return [{ type: i1$1.Router }, { type: RequestHandlerService }, { type: AuthService }, { type: StylesBundleService }, { type: i4.TranslateService }, { type: EnvironmentService }]; } });
|
|
382
440
|
|
|
383
441
|
class RequestHandlerService {
|
|
384
442
|
constructor(http, authService, environmentService, utilityService, bbsfTranslateService, router) {
|
|
385
|
-
//using localStorage to avoid call getCurrentLanguage() because it is not all to use async in constructor
|
|
386
443
|
this.http = http;
|
|
387
444
|
this.authService = authService;
|
|
388
445
|
this.environmentService = environmentService;
|
|
@@ -392,6 +449,7 @@ class RequestHandlerService {
|
|
|
392
449
|
this.requestOptions = new RequestOptionsModel();
|
|
393
450
|
this.currentLanguage = "";
|
|
394
451
|
this.onDestroy$ = new Subject();
|
|
452
|
+
//using localStorage to avoid call getCurrentLanguage() because it is not all to use async in constructor
|
|
395
453
|
this.bbsfTranslateService.onLangChange.subscribe((event) => {
|
|
396
454
|
if (this.currentLanguage != event.lang) {
|
|
397
455
|
this.currentLanguage = event.lang;
|
|
@@ -413,7 +471,6 @@ class RequestHandlerService {
|
|
|
413
471
|
let headers = this.getHeaders();
|
|
414
472
|
if (!this.requestOptions.disableBlockUI)
|
|
415
473
|
this.utilityService.startBlockUI();
|
|
416
|
-
let object;
|
|
417
474
|
return this.http.get(this.environmentService.getApiUrl() + Url, { headers: headers, params: params }).pipe(takeUntil(this.onDestroy$), tap((result) => {
|
|
418
475
|
if (!this.requestOptions.disableBlockUI)
|
|
419
476
|
this.utilityService.stopBlockUI();
|
|
@@ -563,17 +620,11 @@ class RequestHandlerService {
|
|
|
563
620
|
});
|
|
564
621
|
}
|
|
565
622
|
}
|
|
566
|
-
RequestHandlerService
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
{ type: AuthService },
|
|
572
|
-
{ type: EnvironmentService },
|
|
573
|
-
{ type: UtilityService },
|
|
574
|
-
{ type: BBSFTranslateService },
|
|
575
|
-
{ type: Router }
|
|
576
|
-
];
|
|
623
|
+
RequestHandlerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RequestHandlerService, deps: [{ token: i1.HttpClient }, { token: AuthService }, { token: EnvironmentService }, { token: UtilityService }, { token: BBSFTranslateService }, { token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
624
|
+
RequestHandlerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RequestHandlerService });
|
|
625
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RequestHandlerService, decorators: [{
|
|
626
|
+
type: Injectable
|
|
627
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: AuthService }, { type: EnvironmentService }, { type: UtilityService }, { type: BBSFTranslateService }, { type: i1$1.Router }]; } });
|
|
577
628
|
|
|
578
629
|
class StylesBundleService {
|
|
579
630
|
constructor(document, translateService) {
|
|
@@ -614,366 +665,116 @@ class StylesBundleService {
|
|
|
614
665
|
head.appendChild(style);
|
|
615
666
|
}
|
|
616
667
|
}
|
|
617
|
-
StylesBundleService.ɵ
|
|
618
|
-
StylesBundleService
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
this.utilityService = utilityService;
|
|
631
|
-
this.requestOptions = new RequestOptionsModel();
|
|
632
|
-
this.isCreatedBefor = false;
|
|
633
|
-
}
|
|
634
|
-
showGlobalError(errorMessage, formId, deleteOld) {
|
|
635
|
-
let globalErorrElement = document.getElementsByClassName('alert alert-InvalidValidation bg-light-danger text-danger');
|
|
636
|
-
if (globalErorrElement.length > 0) {
|
|
637
|
-
this.removeElementsByClass('alert alert-InvalidValidation bg-light-danger text-danger');
|
|
638
|
-
}
|
|
639
|
-
if (this.isCreatedBefor == true) {
|
|
640
|
-
this.removeElementsByClass('alert alert-InvalidValidation bg-light-danger text-danger');
|
|
641
|
-
}
|
|
642
|
-
// tslint:disable-next-line: prefer-const
|
|
643
|
-
if (!formId)
|
|
644
|
-
formId = "currentForm";
|
|
645
|
-
var object = document.getElementById(formId);
|
|
646
|
-
const tagName = 'div';
|
|
647
|
-
// tslint:disable-next-line: prefer-const
|
|
648
|
-
var elementToAppend = document.createElement(tagName); // Your tag name here
|
|
649
|
-
let message = "";
|
|
650
|
-
if (!errorMessage || (typeof errorMessage == "string")) {
|
|
651
|
-
if (localStorage.getItem('language') == "ar")
|
|
652
|
-
message = errorMessage ? errorMessage : "لديك بعص الأخطاء . من فضلك قم بالمراجعه ";
|
|
653
|
-
else
|
|
654
|
-
message = errorMessage ? errorMessage : "You have some validation errors. Please check below";
|
|
655
|
-
elementToAppend.innerHTML = "<ul class='list-unstyled m-0 py-3 d-flex align-items-center fs-6'><li><i class='fa fa-times-circle text-danger me-3 fs-2'></i>" + message + "</li></ul>";
|
|
656
|
-
elementToAppend.className += 'alert alert-InvalidValidation bg-light-danger text-danger';
|
|
657
|
-
elementToAppend.id += 'errorId';
|
|
658
|
-
// tslint:disable-next-line: prefer-for-of
|
|
659
|
-
const elementToAppen = elementToAppend.cloneNode(true);
|
|
660
|
-
// let targetElement = object.getElementsByClassName("b-control")[0];
|
|
661
|
-
object.insertBefore(elementToAppen, object.firstChild);
|
|
662
|
-
}
|
|
663
|
-
else {
|
|
664
|
-
let ul = document.createElement("ul");
|
|
665
|
-
elementToAppend.appendChild(ul);
|
|
666
|
-
for (const iterator of errorMessage) {
|
|
667
|
-
let li = document.createElement("li");
|
|
668
|
-
li.innerHTML = iterator;
|
|
669
|
-
ul.appendChild(li);
|
|
670
|
-
}
|
|
671
|
-
elementToAppend.className += 'alert alert-InvalidValidation bg-light-danger text-danger';
|
|
672
|
-
elementToAppend.id += 'errorId';
|
|
673
|
-
// tslint:disable-next-line: prefer-for-of
|
|
674
|
-
const elementToAppen = elementToAppend.cloneNode(true);
|
|
675
|
-
// let targetElement = object.getElementsByClassName("b-control")[0];
|
|
676
|
-
object.insertBefore(elementToAppen, object.firstChild);
|
|
677
|
-
}
|
|
678
|
-
this.isCreatedBefor = true;
|
|
679
|
-
}
|
|
680
|
-
RemoveGlobalError() {
|
|
681
|
-
const removedList = document.getElementsByClassName('alert alert-InvalidValidation bg-light-danger text-danger');
|
|
682
|
-
// tslint:disable-next-line: prefer-for-of
|
|
683
|
-
for (let index = 0; index < removedList.length; index++) {
|
|
684
|
-
const element = removedList[index];
|
|
685
|
-
element.remove();
|
|
686
|
-
}
|
|
687
|
-
this.isCreatedBefor = false;
|
|
688
|
-
}
|
|
689
|
-
showInputErro(errors) {
|
|
690
|
-
// show error on top of form
|
|
691
|
-
this.showGlobalError();
|
|
692
|
-
// remove old error from server
|
|
693
|
-
this.removeElementsByClass('errortemplet');
|
|
694
|
-
// Looping in error Object
|
|
695
|
-
for (const key in errors) {
|
|
696
|
-
if (errors.hasOwnProperty(key)) {
|
|
697
|
-
for (const iterator of errors[key]) {
|
|
698
|
-
const input = document.querySelectorAll('[ng-reflect-name=' + key + ']')[0];
|
|
699
|
-
if (input.attributes['ng-reflect-name'].value === key) {
|
|
700
|
-
this.removeElementsByClass('erroclass-' + key);
|
|
701
|
-
const tagName = 'p';
|
|
702
|
-
const elementToAppend = document.createElement(tagName); // Your tag name here
|
|
703
|
-
elementToAppend.innerHTML = iterator;
|
|
704
|
-
elementToAppend.style.color = 'red';
|
|
705
|
-
elementToAppend.className += 'errortemplet erroclass-' + key;
|
|
706
|
-
const elementToappen = elementToAppend.cloneNode(true);
|
|
707
|
-
input.parentNode.insertBefore(elementToappen, input.lastChild);
|
|
708
|
-
break;
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
removeElementsByClass(className) {
|
|
715
|
-
const elements = document.getElementsByClassName(className);
|
|
716
|
-
while (elements.length > 0) {
|
|
717
|
-
elements[0].parentNode.removeChild(elements[0]);
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
renderServerErrors(form, err, requestOptions, formId) {
|
|
721
|
-
if (err.error == null) {
|
|
722
|
-
return;
|
|
723
|
-
}
|
|
724
|
-
let errorsArray = [];
|
|
725
|
-
this.requestOptions = requestOptions;
|
|
726
|
-
if (err.error.validation_errors) {
|
|
727
|
-
err.error.validation_errors.forEach((element) => {
|
|
728
|
-
let fieldName = element.field;
|
|
729
|
-
let controlName = element.controlName;
|
|
730
|
-
let message = element.message;
|
|
731
|
-
if (form == null) {
|
|
732
|
-
this.requestOptions.customErrorMessage ? this.utilityService.notifyErrorMessage(this.requestOptions.customErrorMessage) : this.utilityService.notifyErrorMessage(`${message}`);
|
|
733
|
-
}
|
|
734
|
-
else if (controlName && !this.hasControlName(form, controlName)) {
|
|
735
|
-
errorsArray.push(`${fieldName}: ${message}`);
|
|
736
|
-
}
|
|
737
|
-
else {
|
|
738
|
-
this.setFieldError(form, controlName, fieldName, message);
|
|
739
|
-
this.showGlobalError(null, formId);
|
|
740
|
-
}
|
|
741
|
-
});
|
|
742
|
-
if (errorsArray.length > 0)
|
|
743
|
-
this.showGlobalError(errorsArray, formId);
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
hasControlName(form, controlName) {
|
|
747
|
-
let control = form.get(controlName);
|
|
748
|
-
return control != null;
|
|
749
|
-
}
|
|
750
|
-
setFieldError(form, controlName, fieldName, message) {
|
|
751
|
-
let control = null;
|
|
752
|
-
if (controlName)
|
|
753
|
-
control = this.getControlFormNameByFieldName(form, controlName);
|
|
754
|
-
else
|
|
755
|
-
control = this.getControlFormNameByFieldName(form, fieldName.split('.')[0]);
|
|
756
|
-
let errors = { "errorMassage": message };
|
|
757
|
-
let fieldNameArray = fieldName.split('.');
|
|
758
|
-
if (fieldNameArray.length >= 1) {
|
|
759
|
-
switch (fieldNameArray[fieldNameArray.length - 1].toLocaleLowerCase()) {
|
|
760
|
-
case "english":
|
|
761
|
-
let englishControl = control.get("English");
|
|
762
|
-
englishControl.setErrors(errors);
|
|
763
|
-
break;
|
|
764
|
-
case "arabic":
|
|
765
|
-
let arabicControl = control.get("Arabic");
|
|
766
|
-
arabicControl.setErrors(errors);
|
|
767
|
-
break;
|
|
768
|
-
default:
|
|
769
|
-
control.setErrors(errors);
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
else {
|
|
773
|
-
this.requestOptions.customErrorMessage ? this.utilityService.notifyErrorMessage(this.requestOptions.customErrorMessage) : this.utilityService.notifyErrorMessage(`${message}`);
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
getControlFormNameByFieldName(form, fieldName) {
|
|
777
|
-
const formControls = form.controls;
|
|
778
|
-
let controlName = Object.keys(formControls).find(c => c.toLocaleLowerCase() === fieldName.toLocaleLowerCase());
|
|
779
|
-
let control = form.get(controlName);
|
|
780
|
-
return control;
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
ControlValidationService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ControlValidationService_Factory() { return new ControlValidationService(i0.ɵɵinject(UtilityService)); }, token: ControlValidationService, providedIn: "root" });
|
|
784
|
-
ControlValidationService.decorators = [
|
|
785
|
-
{ type: Injectable, args: [{
|
|
786
|
-
providedIn: 'root'
|
|
787
|
-
},] }
|
|
788
|
-
];
|
|
789
|
-
ControlValidationService.ctorParameters = () => [
|
|
790
|
-
{ type: UtilityService }
|
|
791
|
-
];
|
|
792
|
-
__decorate([
|
|
793
|
-
BlockUI()
|
|
794
|
-
], ControlValidationService.prototype, "blockUI", void 0);
|
|
668
|
+
StylesBundleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: StylesBundleService, deps: [{ token: DOCUMENT }, { token: BBSFTranslateService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
669
|
+
StylesBundleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: StylesBundleService, providedIn: 'root' });
|
|
670
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: StylesBundleService, decorators: [{
|
|
671
|
+
type: Injectable,
|
|
672
|
+
args: [{
|
|
673
|
+
providedIn: 'root'
|
|
674
|
+
}]
|
|
675
|
+
}], ctorParameters: function () {
|
|
676
|
+
return [{ type: Document, decorators: [{
|
|
677
|
+
type: Inject,
|
|
678
|
+
args: [DOCUMENT]
|
|
679
|
+
}] }, { type: BBSFTranslateService }];
|
|
680
|
+
} });
|
|
795
681
|
|
|
796
|
-
class
|
|
797
|
-
constructor(router, http, authService, stylesBundleService, translate, environmentService) {
|
|
798
|
-
this.router = router;
|
|
799
|
-
this.http = http;
|
|
800
|
-
this.authService = authService;
|
|
801
|
-
this.stylesBundleService = stylesBundleService;
|
|
802
|
-
this.translate = translate;
|
|
803
|
-
this.environmentService = environmentService;
|
|
804
|
-
this.ApiUrl = '/api/Home/';
|
|
805
|
-
}
|
|
806
|
-
switchLang(lang, bundleEnglishName, bundleArabicName) {
|
|
807
|
-
this.changeLanguage(lang).subscribe((result) => {
|
|
808
|
-
this.updateUserInfo().subscribe((Value) => {
|
|
809
|
-
let UserInfoObject = Value;
|
|
810
|
-
this.authService.handleAccessToken(UserInfoObject.token);
|
|
811
|
-
this.stylesBundleService.loadThemes(lang, bundleEnglishName, bundleArabicName);
|
|
812
|
-
localStorage.setItem('language', lang);
|
|
813
|
-
this.translate.use(lang);
|
|
814
|
-
});
|
|
815
|
-
});
|
|
816
|
-
}
|
|
817
|
-
reloadComponent() {
|
|
818
|
-
let currentUrl = this.router.url;
|
|
819
|
-
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
|
|
820
|
-
this.router.onSameUrlNavigation = 'reload';
|
|
821
|
-
this.router.navigate([currentUrl]);
|
|
822
|
-
}
|
|
823
|
-
changeLanguage(key) {
|
|
824
|
-
let params = new HttpParams();
|
|
825
|
-
params = params.append('UserId', this.authService.user.profile.id);
|
|
826
|
-
params = params.append('LanguageKey', key);
|
|
827
|
-
return this.http.post(this.ApiUrl + 'UpdateLanguage', null, null, params);
|
|
828
|
-
}
|
|
829
|
-
getUserClaims() {
|
|
830
|
-
return this.http.get(this.ApiUrl + 'GetUserClaims', null, null);
|
|
831
|
-
}
|
|
832
|
-
logError(error) {
|
|
833
|
-
let params = new HttpParams();
|
|
834
|
-
params = params.append('error', error);
|
|
835
|
-
return this.http.post(this.ApiUrl + 'LogError', null, null, params);
|
|
836
|
-
}
|
|
837
|
-
updateUserInfo() {
|
|
838
|
-
return this.http.get(this.ApiUrl + 'UpdateUserInfo', null, null);
|
|
839
|
-
}
|
|
840
|
-
switchRole(permissionSetID) {
|
|
841
|
-
this.updateRole(permissionSetID).subscribe((result) => {
|
|
842
|
-
this.updateUserInfo().subscribe((Value) => {
|
|
843
|
-
let UserInfoObject = Value;
|
|
844
|
-
this.authService.handleAccessToken(UserInfoObject.token);
|
|
845
|
-
});
|
|
846
|
-
});
|
|
847
|
-
}
|
|
848
|
-
updateRole(permissionSetID) {
|
|
849
|
-
let params = new HttpParams();
|
|
850
|
-
params = params.append('UserId', this.authService.user.profile.id);
|
|
851
|
-
params = params.append('RoleID', permissionSetID);
|
|
852
|
-
return this.http.post(this.ApiUrl + 'SwitchRole', null, null, params);
|
|
853
|
-
}
|
|
682
|
+
class BBSFTranslateService extends TranslateService {
|
|
854
683
|
}
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
{ type: RequestHandlerService },
|
|
864
|
-
{ type: AuthService },
|
|
865
|
-
{ type: StylesBundleService },
|
|
866
|
-
{ type: TranslateService },
|
|
867
|
-
{ type: EnvironmentService }
|
|
868
|
-
];
|
|
684
|
+
BBSFTranslateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BBSFTranslateService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
685
|
+
BBSFTranslateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BBSFTranslateService, providedIn: 'root' });
|
|
686
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BBSFTranslateService, decorators: [{
|
|
687
|
+
type: Injectable,
|
|
688
|
+
args: [{
|
|
689
|
+
providedIn: 'root'
|
|
690
|
+
}]
|
|
691
|
+
}] });
|
|
869
692
|
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
ConfigurationService.JsonData = data;
|
|
875
|
-
});
|
|
876
|
-
}
|
|
877
|
-
getConfigurationValue(key) {
|
|
878
|
-
return ConfigurationService.JsonData[key];
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
ConfigurationService.JsonData = [];
|
|
882
|
-
ConfigurationService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ConfigurationService_Factory() { return new ConfigurationService(i0.ɵɵinject(i1$1.HttpClient)); }, token: ConfigurationService, providedIn: "root" });
|
|
883
|
-
ConfigurationService.decorators = [
|
|
884
|
-
{ type: Injectable, args: [{
|
|
885
|
-
providedIn: 'root'
|
|
886
|
-
},] }
|
|
887
|
-
];
|
|
888
|
-
ConfigurationService.ctorParameters = () => [
|
|
889
|
-
{ type: HttpClient }
|
|
890
|
-
];
|
|
693
|
+
const TranslationResolverService = () => {
|
|
694
|
+
let translateService = inject(BBSFTranslateService);
|
|
695
|
+
return translateService.getTranslation(translateService.currentLang);
|
|
696
|
+
};
|
|
891
697
|
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
698
|
+
class UtilityService {
|
|
699
|
+
constructor(translator, environmentService, injector) {
|
|
700
|
+
this.translator = translator;
|
|
701
|
+
this.environmentService = environmentService;
|
|
895
702
|
this.injector = injector;
|
|
896
|
-
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
BBSFUtilitiesModule.decorators = [
|
|
900
|
-
{ type: NgModule, args: [{
|
|
901
|
-
declarations: [],
|
|
902
|
-
imports: [
|
|
903
|
-
CommonModule,
|
|
904
|
-
BlockUIModule.forRoot(),
|
|
905
|
-
HttpModule,
|
|
906
|
-
RouterModule,
|
|
907
|
-
ToastrModule.forRoot(),
|
|
908
|
-
],
|
|
909
|
-
exports: [],
|
|
910
|
-
providers: [
|
|
911
|
-
UtilityService,
|
|
912
|
-
EnvironmentService,
|
|
913
|
-
AuthService,
|
|
914
|
-
RequestHandlerService,
|
|
915
|
-
StylesBundleService,
|
|
916
|
-
TranslateService,
|
|
917
|
-
BBSFTranslateService,
|
|
918
|
-
ControlValidationService,
|
|
919
|
-
MasterLayoutService,
|
|
920
|
-
ConfigurationService,
|
|
921
|
-
CookieService
|
|
922
|
-
]
|
|
923
|
-
},] }
|
|
924
|
-
];
|
|
925
|
-
BBSFUtilitiesModule.ctorParameters = () => [
|
|
926
|
-
{ type: Injector }
|
|
927
|
-
];
|
|
928
|
-
|
|
929
|
-
class TranslationResolverService {
|
|
930
|
-
constructor(translateService) {
|
|
931
|
-
this.translateService = translateService;
|
|
703
|
+
this.isCreatedBefore = false;
|
|
932
704
|
}
|
|
933
|
-
|
|
934
|
-
|
|
705
|
+
getResourceValue(Key) {
|
|
706
|
+
let ResourceValue = this.translator.instant(Key);
|
|
707
|
+
return ResourceValue;
|
|
935
708
|
}
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
class AppearanceConfigurationService {
|
|
946
|
-
constructor(configService) {
|
|
947
|
-
this.configService = configService;
|
|
709
|
+
getCurrentLanguage() {
|
|
710
|
+
let currentLanguage = this.environmentService.getDefaultLanguage();
|
|
711
|
+
let lang = localStorage.getItem('language');
|
|
712
|
+
if (lang)
|
|
713
|
+
currentLanguage = lang;
|
|
714
|
+
else
|
|
715
|
+
localStorage.setItem('language', currentLanguage);
|
|
716
|
+
return currentLanguage;
|
|
948
717
|
}
|
|
949
|
-
|
|
950
|
-
return this.
|
|
718
|
+
isCurrentLanguageEnglish() {
|
|
719
|
+
return this.getCurrentLanguage() == "en";
|
|
951
720
|
}
|
|
952
|
-
|
|
953
|
-
return this.
|
|
721
|
+
isCurrentLanguageArabic() {
|
|
722
|
+
return this.getCurrentLanguage() == "ar";
|
|
954
723
|
}
|
|
955
|
-
|
|
956
|
-
|
|
724
|
+
notifySuccessMessage(Message, title, time, showHeader = true) {
|
|
725
|
+
let MessageTemplate = this.getResourceValue("SuccessMessage");
|
|
726
|
+
let titleTemplate;
|
|
727
|
+
if (Message) {
|
|
728
|
+
MessageTemplate = Message;
|
|
729
|
+
}
|
|
730
|
+
if (title) {
|
|
731
|
+
titleTemplate = title;
|
|
732
|
+
}
|
|
733
|
+
let toaster = this.injector.get(ToastrService);
|
|
734
|
+
showHeader ? toaster.success(MessageTemplate, titleTemplate) : toaster.success(MessageTemplate);
|
|
957
735
|
}
|
|
958
|
-
|
|
959
|
-
|
|
736
|
+
notifyErrorMessage(Message, title, time, showHeader = true) {
|
|
737
|
+
let MessageTemplate = this.getResourceValue("ErrorMessage");
|
|
738
|
+
let titleTemplate = this.getResourceValue("Error");
|
|
739
|
+
if (Message) {
|
|
740
|
+
MessageTemplate = Message;
|
|
741
|
+
}
|
|
742
|
+
if (title) {
|
|
743
|
+
titleTemplate = title;
|
|
744
|
+
}
|
|
745
|
+
const toaster = this.injector.get(ToastrService);
|
|
746
|
+
showHeader ? toaster.error(MessageTemplate, titleTemplate) : toaster.error(MessageTemplate);
|
|
960
747
|
}
|
|
961
|
-
|
|
962
|
-
|
|
748
|
+
notifyWarningMessage(Message, title, time, showHeader = true) {
|
|
749
|
+
let MessageTemplate = this.getResourceValue("WarningMessage");
|
|
750
|
+
let titleTemplate = this.getResourceValue("Warning");
|
|
751
|
+
if (Message) {
|
|
752
|
+
MessageTemplate = Message;
|
|
753
|
+
}
|
|
754
|
+
if (title) {
|
|
755
|
+
titleTemplate = title;
|
|
756
|
+
}
|
|
757
|
+
const toaster = this.injector.get(ToastrService);
|
|
758
|
+
showHeader ? toaster.warning(MessageTemplate, titleTemplate) : toaster.warning(MessageTemplate);
|
|
963
759
|
}
|
|
964
|
-
|
|
965
|
-
|
|
760
|
+
startBlockUI() {
|
|
761
|
+
this.blockUI.start();
|
|
762
|
+
}
|
|
763
|
+
stopBlockUI() {
|
|
764
|
+
this.blockUI.stop();
|
|
966
765
|
}
|
|
967
766
|
}
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
767
|
+
UtilityService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UtilityService, deps: [{ token: BBSFTranslateService }, { token: EnvironmentService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
768
|
+
UtilityService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UtilityService, providedIn: 'root' });
|
|
769
|
+
__decorate([
|
|
770
|
+
BlockUI()
|
|
771
|
+
], UtilityService.prototype, "blockUI", void 0);
|
|
772
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UtilityService, decorators: [{
|
|
773
|
+
type: Injectable,
|
|
774
|
+
args: [{
|
|
775
|
+
providedIn: 'root'
|
|
776
|
+
}]
|
|
777
|
+
}], ctorParameters: function () { return [{ type: BBSFTranslateService }, { type: EnvironmentService }, { type: i0.Injector }]; }, propDecorators: { blockUI: [] } });
|
|
977
778
|
|
|
978
779
|
const contentTypesXML = `
|
|
979
780
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
@@ -1161,8 +962,7 @@ const generateCoreXML = (title = '', subject = '', creator = applicationName, ke
|
|
|
1161
962
|
<dcterms:created xsi:type="dcterms:W3CDTF">${createdAt instanceof Date ? createdAt.toISOString() : new Date().toISOString()}</dcterms:created>
|
|
1162
963
|
<dcterms:modified xsi:type="dcterms:W3CDTF">${modifiedAt instanceof Date ? modifiedAt.toISOString() : new Date().toISOString()}</dcterms:modified>
|
|
1163
964
|
</cp:coreProperties>
|
|
1164
|
-
`;
|
|
1165
|
-
const ɵ0$8 = generateCoreXML;
|
|
965
|
+
`;
|
|
1166
966
|
|
|
1167
967
|
const documentRelsXML = `
|
|
1168
968
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
@@ -1200,8 +1000,7 @@ const generateNumberingXMLTemplate = () => `
|
|
|
1200
1000
|
xmlns:w10="${namespaces.w10}"
|
|
1201
1001
|
xmlns:wne="${namespaces.wne}">
|
|
1202
1002
|
</w:numbering>
|
|
1203
|
-
`;
|
|
1204
|
-
const ɵ0$7 = generateNumberingXMLTemplate;
|
|
1003
|
+
`;
|
|
1205
1004
|
|
|
1206
1005
|
const generateStylesXML = (font = defaultFont, fontSize = defaultFontSize, complexScriptFontSize = defaultFontSize) => `
|
|
1207
1006
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
@@ -1345,8 +1144,7 @@ const generateStylesXML = (font = defaultFont, fontSize = defaultFontSize, compl
|
|
|
1345
1144
|
</w:rPr>
|
|
1346
1145
|
</w:style>
|
|
1347
1146
|
</w:styles>
|
|
1348
|
-
`;
|
|
1349
|
-
const ɵ0$6 = generateStylesXML;
|
|
1147
|
+
`;
|
|
1350
1148
|
|
|
1351
1149
|
const fontTableXML = `
|
|
1352
1150
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
@@ -1580,8 +1378,7 @@ const generateThemeXML = (font = defaultFont) => `
|
|
|
1580
1378
|
</a:fmtScheme>
|
|
1581
1379
|
</a:themeElements>
|
|
1582
1380
|
</a:theme>
|
|
1583
|
-
`;
|
|
1584
|
-
const ɵ0$5 = generateThemeXML;
|
|
1381
|
+
`;
|
|
1585
1382
|
|
|
1586
1383
|
const settingsXML = `
|
|
1587
1384
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
@@ -1643,7 +1440,6 @@ const generateDocumentTemplate = (width, height, orientation, margins) => `
|
|
|
1643
1440
|
</w:body>
|
|
1644
1441
|
</w:document>
|
|
1645
1442
|
`;
|
|
1646
|
-
const ɵ0$4 = generateDocumentTemplate;
|
|
1647
1443
|
const generateDocumentTemplateHeader = `
|
|
1648
1444
|
<w:hdr
|
|
1649
1445
|
xmlns:a="${namespaces.a}"
|
|
@@ -1813,8 +1609,7 @@ const vNodeHasChildren = (vNode) => vNode && vNode.children && Array.isArray(vNo
|
|
|
1813
1609
|
const isValidUrl = (urlString) => {
|
|
1814
1610
|
const urlRegex = /http(s)?:\/\/(\w+:?\w*@)?(\S+)(:\d+)?((?<=\.)\w+)+(\/([\w#!:.?+=&%@!\-/])*)?/gi;
|
|
1815
1611
|
return Boolean(urlRegex.test(urlString));
|
|
1816
|
-
};
|
|
1817
|
-
const ɵ0$3 = isValidUrl;
|
|
1612
|
+
};
|
|
1818
1613
|
|
|
1819
1614
|
// eslint-disable-next-line consistent-return
|
|
1820
1615
|
const fixupColorCode = (colorCodeString) => {
|
|
@@ -1851,24 +1646,20 @@ const fixupColorCode = (colorCodeString) => {
|
|
|
1851
1646
|
return '000000';
|
|
1852
1647
|
}
|
|
1853
1648
|
};
|
|
1854
|
-
const ɵ0$2 = fixupColorCode;
|
|
1855
1649
|
const buildRunFontFragment = (fontName = defaultFont) => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
1856
1650
|
.ele('@w', 'rFonts')
|
|
1857
1651
|
.att('@w', 'ascii', fontName)
|
|
1858
1652
|
.att('@w', 'hAnsi', fontName)
|
|
1859
1653
|
.up();
|
|
1860
|
-
const ɵ1$1 = buildRunFontFragment;
|
|
1861
1654
|
const buildRunStyleFragment = (type = 'Hyperlink') => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
1862
1655
|
.ele('@w', 'rStyle')
|
|
1863
1656
|
.att('@w', 'val', type)
|
|
1864
1657
|
.up();
|
|
1865
|
-
const ɵ2$1 = buildRunStyleFragment;
|
|
1866
1658
|
const buildTableRowHeight = (tableRowHeight) => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
1867
1659
|
.ele('@w', 'trHeight')
|
|
1868
1660
|
.att('@w', 'val', tableRowHeight)
|
|
1869
1661
|
.att('@w', 'hRule', 'atLeast')
|
|
1870
1662
|
.up();
|
|
1871
|
-
const ɵ3$1 = buildTableRowHeight;
|
|
1872
1663
|
const buildVerticalAlignment = (verticalAlignment) => {
|
|
1873
1664
|
if (verticalAlignment.toLowerCase() === 'middle') {
|
|
1874
1665
|
verticalAlignment = 'center';
|
|
@@ -1878,61 +1669,49 @@ const buildVerticalAlignment = (verticalAlignment) => {
|
|
|
1878
1669
|
.att('@w', 'val', verticalAlignment)
|
|
1879
1670
|
.up();
|
|
1880
1671
|
};
|
|
1881
|
-
const ɵ4 = buildVerticalAlignment;
|
|
1882
1672
|
const buildVerticalMerge = (verticalMerge = 'continue') => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
1883
1673
|
.ele('@w', 'vMerge')
|
|
1884
1674
|
.att('@w', 'val', verticalMerge)
|
|
1885
1675
|
.up();
|
|
1886
|
-
const ɵ5 = buildVerticalMerge;
|
|
1887
1676
|
const buildColor = (colorCode) => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
1888
1677
|
.ele('@w', 'color')
|
|
1889
1678
|
.att('@w', 'val', colorCode)
|
|
1890
1679
|
.up();
|
|
1891
|
-
const ɵ6 = buildColor;
|
|
1892
1680
|
const buildFontSize = (fontSize) => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
1893
1681
|
.ele('@w', 'sz')
|
|
1894
1682
|
.att('@w', 'val', fontSize)
|
|
1895
1683
|
.up();
|
|
1896
|
-
const ɵ7 = buildFontSize;
|
|
1897
1684
|
const buildShading = (colorCode) => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
1898
1685
|
.ele('@w', 'shd')
|
|
1899
1686
|
.att('@w', 'val', 'clear')
|
|
1900
1687
|
.att('@w', 'fill', colorCode)
|
|
1901
1688
|
.up();
|
|
1902
|
-
const ɵ8 = buildShading;
|
|
1903
1689
|
const buildHighlight = (color = 'yellow') => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
1904
1690
|
.ele('@w', 'highlight')
|
|
1905
1691
|
.att('@w', 'val', color)
|
|
1906
1692
|
.up();
|
|
1907
|
-
const ɵ9 = buildHighlight;
|
|
1908
1693
|
const buildVertAlign = (type = 'baseline') => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
1909
1694
|
.ele('@w', 'vertAlign')
|
|
1910
1695
|
.att('@w', 'val', type)
|
|
1911
1696
|
.up();
|
|
1912
|
-
const ɵ10 = buildVertAlign;
|
|
1913
1697
|
const buildStrike = () => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
1914
1698
|
.ele('@w', 'strike')
|
|
1915
1699
|
.att('@w', 'val', true)
|
|
1916
1700
|
.up();
|
|
1917
|
-
const ɵ11 = buildStrike;
|
|
1918
1701
|
const buildBold = () => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
1919
1702
|
.ele('@w', 'b')
|
|
1920
1703
|
.up();
|
|
1921
|
-
const ɵ12 = buildBold;
|
|
1922
1704
|
const buildItalics = () => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
1923
1705
|
.ele('@w', 'i')
|
|
1924
1706
|
.up();
|
|
1925
|
-
const ɵ13 = buildItalics;
|
|
1926
1707
|
const buildUnderline = (type = 'single') => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
1927
1708
|
.ele('@w', 'u')
|
|
1928
1709
|
.att('@w', 'val', type)
|
|
1929
1710
|
.up();
|
|
1930
|
-
const ɵ14 = buildUnderline;
|
|
1931
1711
|
const buildLineBreak = (type = 'textWrapping') => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
1932
1712
|
.ele('@w', 'br')
|
|
1933
1713
|
.att('@w', 'type', type)
|
|
1934
1714
|
.up();
|
|
1935
|
-
const ɵ15 = buildLineBreak;
|
|
1936
1715
|
const buildBorder = (borderSide = 'top', borderSize = 0, borderSpacing = 0, borderColor = fixupColorCode('black'), borderStroke = 'single') => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
1937
1716
|
.ele('@w', borderSide)
|
|
1938
1717
|
.att('@w', 'val', borderStroke)
|
|
@@ -1940,13 +1719,11 @@ const buildBorder = (borderSide = 'top', borderSize = 0, borderSpacing = 0, bord
|
|
|
1940
1719
|
.att('@w', 'space', borderSpacing)
|
|
1941
1720
|
.att('@w', 'color', borderColor)
|
|
1942
1721
|
.up();
|
|
1943
|
-
const ɵ16 = buildBorder;
|
|
1944
1722
|
const buildTextElement = (text) => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
1945
1723
|
.ele('@w', 't')
|
|
1946
1724
|
.att('@xml', 'space', 'preserve')
|
|
1947
1725
|
.txt(text)
|
|
1948
1726
|
.up();
|
|
1949
|
-
const ɵ17 = buildTextElement;
|
|
1950
1727
|
// eslint-disable-next-line consistent-return
|
|
1951
1728
|
const fixupLineHeight = (lineHeight, fontSize) => {
|
|
1952
1729
|
// FIXME: If line height is anything other than a number
|
|
@@ -1966,7 +1743,6 @@ const fixupLineHeight = (lineHeight, fontSize) => {
|
|
|
1966
1743
|
return 240;
|
|
1967
1744
|
}
|
|
1968
1745
|
};
|
|
1969
|
-
const ɵ18 = fixupLineHeight;
|
|
1970
1746
|
// eslint-disable-next-line consistent-return
|
|
1971
1747
|
const fixupFontSize$1 = (fontSizeString) => {
|
|
1972
1748
|
if (pointRegex.test(fontSizeString)) {
|
|
@@ -1980,7 +1756,6 @@ const fixupFontSize$1 = (fontSizeString) => {
|
|
|
1980
1756
|
return pixelToHIP(matchedParts[1]);
|
|
1981
1757
|
}
|
|
1982
1758
|
};
|
|
1983
|
-
const ɵ19 = fixupFontSize$1;
|
|
1984
1759
|
// eslint-disable-next-line consistent-return
|
|
1985
1760
|
const fixupRowHeight = (rowHeightString) => {
|
|
1986
1761
|
if (pointRegex.test(rowHeightString)) {
|
|
@@ -2002,7 +1777,6 @@ const fixupRowHeight = (rowHeightString) => {
|
|
|
2002
1777
|
return inchToTWIP(matchedParts[1]);
|
|
2003
1778
|
}
|
|
2004
1779
|
};
|
|
2005
|
-
const ɵ20 = fixupRowHeight;
|
|
2006
1780
|
// eslint-disable-next-line consistent-return
|
|
2007
1781
|
const fixupColumnWidth = (columnWidthString) => {
|
|
2008
1782
|
if (pointRegex.test(columnWidthString)) {
|
|
@@ -2022,7 +1796,6 @@ const fixupColumnWidth = (columnWidthString) => {
|
|
|
2022
1796
|
return inchToTWIP(matchedParts[1]);
|
|
2023
1797
|
}
|
|
2024
1798
|
};
|
|
2025
|
-
const ɵ21 = fixupColumnWidth;
|
|
2026
1799
|
// eslint-disable-next-line consistent-return
|
|
2027
1800
|
const fixupMargin = (marginString) => {
|
|
2028
1801
|
if (pointRegex.test(marginString)) {
|
|
@@ -2036,7 +1809,6 @@ const fixupMargin = (marginString) => {
|
|
|
2036
1809
|
return pixelToTWIP(matchedParts[1]);
|
|
2037
1810
|
}
|
|
2038
1811
|
};
|
|
2039
|
-
const ɵ22 = fixupMargin;
|
|
2040
1812
|
const modifiedStyleAttributesBuilder = (vNode, attributes, options) => {
|
|
2041
1813
|
const modifiedAttributes = Object.assign({}, attributes);
|
|
2042
1814
|
// styles
|
|
@@ -2104,7 +1876,6 @@ const modifiedStyleAttributesBuilder = (vNode, attributes, options) => {
|
|
|
2104
1876
|
}
|
|
2105
1877
|
return modifiedAttributes;
|
|
2106
1878
|
};
|
|
2107
|
-
const ɵ23 = modifiedStyleAttributesBuilder;
|
|
2108
1879
|
// html tag to formatting function
|
|
2109
1880
|
// options are passed to the formatting function if needed
|
|
2110
1881
|
const buildFormatting = (htmlTag, options) => {
|
|
@@ -2147,7 +1918,6 @@ const buildFormatting = (htmlTag, options) => {
|
|
|
2147
1918
|
}
|
|
2148
1919
|
return null;
|
|
2149
1920
|
};
|
|
2150
|
-
const ɵ24 = buildFormatting;
|
|
2151
1921
|
const buildRunProperties = (attributes) => {
|
|
2152
1922
|
const runPropertiesFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'rPr');
|
|
2153
1923
|
if (attributes && attributes.constructor === Object) {
|
|
@@ -2168,7 +1938,6 @@ const buildRunProperties = (attributes) => {
|
|
|
2168
1938
|
runPropertiesFragment.up();
|
|
2169
1939
|
return runPropertiesFragment;
|
|
2170
1940
|
};
|
|
2171
|
-
const ɵ25 = buildRunProperties;
|
|
2172
1941
|
const buildRun = (vNode, attributes, docxDocumentInstance) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2173
1942
|
const runFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'r');
|
|
2174
1943
|
const runPropertiesFragment = buildRunProperties(cloneDeep(attributes));
|
|
@@ -2318,7 +2087,6 @@ const buildRun = (vNode, attributes, docxDocumentInstance) => __awaiter(void 0,
|
|
|
2318
2087
|
runFragment.up();
|
|
2319
2088
|
return runFragment;
|
|
2320
2089
|
});
|
|
2321
|
-
const ɵ26 = buildRun;
|
|
2322
2090
|
const buildRunOrRuns = (vNode, attributes, docxDocumentInstance) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2323
2091
|
if (isVNode(vNode) && vNode.tagName === 'span') {
|
|
2324
2092
|
let runFragments = [];
|
|
@@ -2335,7 +2103,6 @@ const buildRunOrRuns = (vNode, attributes, docxDocumentInstance) => __awaiter(vo
|
|
|
2335
2103
|
return tempRunFragments;
|
|
2336
2104
|
}
|
|
2337
2105
|
});
|
|
2338
|
-
const ɵ27 = buildRunOrRuns;
|
|
2339
2106
|
const buildRunOrHyperLink = (vNode, attributes, docxDocumentInstance) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2340
2107
|
if (isVNode(vNode) && vNode.tagName === 'a') {
|
|
2341
2108
|
const relationshipId = docxDocumentInstance.createDocumentRelationships(docxDocumentInstance.relationshipFilename, hyperlinkType, vNode.properties && vNode.properties.href ? vNode.properties.href : '');
|
|
@@ -2360,7 +2127,6 @@ const buildRunOrHyperLink = (vNode, attributes, docxDocumentInstance) => __await
|
|
|
2360
2127
|
const runFragments = yield buildRunOrRuns(vNode, attributes, docxDocumentInstance);
|
|
2361
2128
|
return runFragments;
|
|
2362
2129
|
});
|
|
2363
|
-
const ɵ28 = buildRunOrHyperLink;
|
|
2364
2130
|
const buildNumberingProperties = (levelId, numberingId) => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
2365
2131
|
.ele('@w', 'numPr')
|
|
2366
2132
|
.ele('@w', 'ilvl')
|
|
@@ -2370,13 +2136,11 @@ const buildNumberingProperties = (levelId, numberingId) => fragment({ namespaceA
|
|
|
2370
2136
|
.att('@w', 'val', String(numberingId))
|
|
2371
2137
|
.up()
|
|
2372
2138
|
.up();
|
|
2373
|
-
const ɵ29 = buildNumberingProperties;
|
|
2374
2139
|
const buildNumberingInstances = () => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
2375
2140
|
.ele('@w', 'num')
|
|
2376
2141
|
.ele('@w', 'abstractNumId')
|
|
2377
2142
|
.up()
|
|
2378
2143
|
.up();
|
|
2379
|
-
const ɵ30 = buildNumberingInstances;
|
|
2380
2144
|
const buildSpacing = (lineSpacing, beforeSpacing, afterSpacing) => {
|
|
2381
2145
|
const spacingFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'spacing');
|
|
2382
2146
|
if (lineSpacing) {
|
|
@@ -2391,7 +2155,6 @@ const buildSpacing = (lineSpacing, beforeSpacing, afterSpacing) => {
|
|
|
2391
2155
|
spacingFragment.att('@w', 'lineRule', 'auto').up();
|
|
2392
2156
|
return spacingFragment;
|
|
2393
2157
|
};
|
|
2394
|
-
const ɵ31 = buildSpacing;
|
|
2395
2158
|
const buildIndentation = ({ left, right }) => {
|
|
2396
2159
|
const indentationFragment = fragment({
|
|
2397
2160
|
namespaceAlias: { w: namespaces.w },
|
|
@@ -2405,12 +2168,10 @@ const buildIndentation = ({ left, right }) => {
|
|
|
2405
2168
|
indentationFragment.up();
|
|
2406
2169
|
return indentationFragment;
|
|
2407
2170
|
};
|
|
2408
|
-
const ɵ32 = buildIndentation;
|
|
2409
2171
|
const buildPStyle = (style = 'Normal') => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
2410
2172
|
.ele('@w', 'pStyle')
|
|
2411
2173
|
.att('@w', 'val', style)
|
|
2412
2174
|
.up();
|
|
2413
|
-
const ɵ33 = buildPStyle;
|
|
2414
2175
|
const buildHorizontalAlignment = (horizontalAlignment) => {
|
|
2415
2176
|
if (horizontalAlignment === 'justify') {
|
|
2416
2177
|
horizontalAlignment = 'both';
|
|
@@ -2420,7 +2181,6 @@ const buildHorizontalAlignment = (horizontalAlignment) => {
|
|
|
2420
2181
|
.att('@w', 'val', horizontalAlignment)
|
|
2421
2182
|
.up();
|
|
2422
2183
|
};
|
|
2423
|
-
const ɵ34 = buildHorizontalAlignment;
|
|
2424
2184
|
const buildParagraphBorder = () => {
|
|
2425
2185
|
const paragraphBorderFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'pBdr');
|
|
2426
2186
|
const bordersObject = cloneDeep(paragraphBordersObject);
|
|
@@ -2434,7 +2194,6 @@ const buildParagraphBorder = () => {
|
|
|
2434
2194
|
paragraphBorderFragment.up();
|
|
2435
2195
|
return paragraphBorderFragment;
|
|
2436
2196
|
};
|
|
2437
|
-
const ɵ35 = buildParagraphBorder;
|
|
2438
2197
|
const buildParagraphProperties = (attributes) => {
|
|
2439
2198
|
const paragraphPropertiesFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'pPr');
|
|
2440
2199
|
if (attributes && attributes.constructor === Object) {
|
|
@@ -2491,7 +2250,6 @@ const buildParagraphProperties = (attributes) => {
|
|
|
2491
2250
|
paragraphPropertiesFragment.up();
|
|
2492
2251
|
return paragraphPropertiesFragment;
|
|
2493
2252
|
};
|
|
2494
|
-
const ɵ36 = buildParagraphProperties;
|
|
2495
2253
|
const computeImageDimensions = (vNode, attributes) => {
|
|
2496
2254
|
const { maximumWidth, originalWidth, originalHeight } = attributes;
|
|
2497
2255
|
const aspectRatio = originalWidth / originalHeight;
|
|
@@ -2565,7 +2323,6 @@ const computeImageDimensions = (vNode, attributes) => {
|
|
|
2565
2323
|
// eslint-disable-next-line no-param-reassign
|
|
2566
2324
|
attributes.height = modifiedHeight;
|
|
2567
2325
|
};
|
|
2568
|
-
const ɵ37 = computeImageDimensions;
|
|
2569
2326
|
const buildParagraph = (vNode, attributes, docxDocumentInstance) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2570
2327
|
const paragraphFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'p');
|
|
2571
2328
|
const modifiedAttributes = modifiedStyleAttributesBuilder(vNode, attributes, {
|
|
@@ -2703,18 +2460,15 @@ const buildParagraph = (vNode, attributes, docxDocumentInstance) => __awaiter(vo
|
|
|
2703
2460
|
paragraphFragment.up();
|
|
2704
2461
|
return paragraphFragment;
|
|
2705
2462
|
});
|
|
2706
|
-
const ɵ38 = buildParagraph;
|
|
2707
2463
|
const buildGridSpanFragment = (spanValue) => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
2708
2464
|
.ele('@w', 'gridSpan')
|
|
2709
2465
|
.att('@w', 'val', spanValue)
|
|
2710
2466
|
.up();
|
|
2711
|
-
const ɵ39 = buildGridSpanFragment;
|
|
2712
2467
|
const buildTableCellSpacing = (cellSpacing = 0) => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
2713
2468
|
.ele('@w', 'tblCellSpacing')
|
|
2714
2469
|
.att('@w', 'w', cellSpacing)
|
|
2715
2470
|
.att('@w', 'type', 'dxa')
|
|
2716
2471
|
.up();
|
|
2717
|
-
const ɵ40 = buildTableCellSpacing;
|
|
2718
2472
|
const buildTableCellBorders = (tableCellBorder) => {
|
|
2719
2473
|
const tableCellBordersFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'tcBorders');
|
|
2720
2474
|
const { color, stroke } = tableCellBorder, borders = __rest(tableCellBorder, ["color", "stroke"]);
|
|
@@ -2727,13 +2481,11 @@ const buildTableCellBorders = (tableCellBorder) => {
|
|
|
2727
2481
|
tableCellBordersFragment.up();
|
|
2728
2482
|
return tableCellBordersFragment;
|
|
2729
2483
|
};
|
|
2730
|
-
const ɵ41 = buildTableCellBorders;
|
|
2731
2484
|
const buildTableCellWidth = (tableCellWidth) => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
2732
2485
|
.ele('@w', 'tcW')
|
|
2733
2486
|
.att('@w', 'w', fixupColumnWidth(tableCellWidth))
|
|
2734
2487
|
.att('@w', 'type', 'dxa')
|
|
2735
2488
|
.up();
|
|
2736
|
-
const ɵ42 = buildTableCellWidth;
|
|
2737
2489
|
const buildTableCellProperties = (attributes) => {
|
|
2738
2490
|
const tableCellPropertiesFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'tcPr');
|
|
2739
2491
|
if (attributes && attributes.constructor === Object) {
|
|
@@ -2779,7 +2531,6 @@ const buildTableCellProperties = (attributes) => {
|
|
|
2779
2531
|
tableCellPropertiesFragment.up();
|
|
2780
2532
|
return tableCellPropertiesFragment;
|
|
2781
2533
|
};
|
|
2782
|
-
const ɵ43 = buildTableCellProperties;
|
|
2783
2534
|
const fixupTableCellBorder = (vNode, attributes) => {
|
|
2784
2535
|
if (Object.prototype.hasOwnProperty.call(vNode.properties.style, 'border')) {
|
|
2785
2536
|
if (vNode.properties.style.border === 'none' || vNode.properties.style.border === 0) {
|
|
@@ -2834,7 +2585,6 @@ const fixupTableCellBorder = (vNode, attributes) => {
|
|
|
2834
2585
|
attributes.tableCellBorder = Object.assign(Object.assign({}, attributes.tableCellBorder), { right: borderSize, color: borderColor, stroke: borderStroke });
|
|
2835
2586
|
}
|
|
2836
2587
|
};
|
|
2837
|
-
const ɵ44 = fixupTableCellBorder;
|
|
2838
2588
|
const buildTableCell = (vNode, attributes, rowSpanMap, columnIndex, docxDocumentInstance) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2839
2589
|
const tableCellFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'tc');
|
|
2840
2590
|
let modifiedAttributes = Object.assign({}, attributes);
|
|
@@ -2917,7 +2667,6 @@ const buildTableCell = (vNode, attributes, rowSpanMap, columnIndex, docxDocument
|
|
|
2917
2667
|
tableCellFragment.up();
|
|
2918
2668
|
return tableCellFragment;
|
|
2919
2669
|
});
|
|
2920
|
-
const ɵ45 = buildTableCell;
|
|
2921
2670
|
const buildRowSpanCell = (rowSpanMap, columnIndex, attributes) => {
|
|
2922
2671
|
const rowSpanCellFragments = [];
|
|
2923
2672
|
let spanObject = rowSpanMap.get(columnIndex.index);
|
|
@@ -2945,7 +2694,6 @@ const buildRowSpanCell = (rowSpanMap, columnIndex, attributes) => {
|
|
|
2945
2694
|
}
|
|
2946
2695
|
return rowSpanCellFragments;
|
|
2947
2696
|
};
|
|
2948
|
-
const ɵ46 = buildRowSpanCell;
|
|
2949
2697
|
const buildTableRowProperties = (attributes) => {
|
|
2950
2698
|
const tableRowPropertiesFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'trPr');
|
|
2951
2699
|
if (attributes && attributes.constructor === Object) {
|
|
@@ -2973,7 +2721,6 @@ const buildTableRowProperties = (attributes) => {
|
|
|
2973
2721
|
tableRowPropertiesFragment.up();
|
|
2974
2722
|
return tableRowPropertiesFragment;
|
|
2975
2723
|
};
|
|
2976
|
-
const ɵ47 = buildTableRowProperties;
|
|
2977
2724
|
const buildTableRow = (vNode, attributes, rowSpanMap, docxDocumentInstance) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2978
2725
|
const tableRowFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'tr');
|
|
2979
2726
|
const modifiedAttributes = Object.assign({}, attributes);
|
|
@@ -3028,11 +2775,9 @@ const buildTableRow = (vNode, attributes, rowSpanMap, docxDocumentInstance) => _
|
|
|
3028
2775
|
tableRowFragment.up();
|
|
3029
2776
|
return tableRowFragment;
|
|
3030
2777
|
});
|
|
3031
|
-
const ɵ48 = buildTableRow;
|
|
3032
2778
|
const buildTableGridCol = (gridWidth) => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
3033
2779
|
.ele('@w', 'gridCol')
|
|
3034
2780
|
.att('@w', 'w', String(gridWidth));
|
|
3035
|
-
const ɵ49 = buildTableGridCol;
|
|
3036
2781
|
const buildTableGrid = (vNode, attributes) => {
|
|
3037
2782
|
const tableGridFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'tblGrid');
|
|
3038
2783
|
if (vNodeHasChildren(vNode)) {
|
|
@@ -3046,7 +2791,6 @@ const buildTableGrid = (vNode, attributes) => {
|
|
|
3046
2791
|
tableGridFragment.up();
|
|
3047
2792
|
return tableGridFragment;
|
|
3048
2793
|
};
|
|
3049
|
-
const ɵ50 = buildTableGrid;
|
|
3050
2794
|
const buildTableGridFromTableRow = (vNode, attributes) => {
|
|
3051
2795
|
const tableGridFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'tblGrid');
|
|
3052
2796
|
if (vNodeHasChildren(vNode)) {
|
|
@@ -3064,7 +2808,6 @@ const buildTableGridFromTableRow = (vNode, attributes) => {
|
|
|
3064
2808
|
tableGridFragment.up();
|
|
3065
2809
|
return tableGridFragment;
|
|
3066
2810
|
};
|
|
3067
|
-
const ɵ51 = buildTableGridFromTableRow;
|
|
3068
2811
|
const buildTableBorders = (tableBorder) => {
|
|
3069
2812
|
const tableBordersFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'tblBorders');
|
|
3070
2813
|
const { color, stroke } = tableBorder, borders = __rest(tableBorder, ["color", "stroke"]);
|
|
@@ -3077,19 +2820,16 @@ const buildTableBorders = (tableBorder) => {
|
|
|
3077
2820
|
tableBordersFragment.up();
|
|
3078
2821
|
return tableBordersFragment;
|
|
3079
2822
|
};
|
|
3080
|
-
const ɵ52 = buildTableBorders;
|
|
3081
2823
|
const buildTableWidth = (tableWidth) => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
3082
2824
|
.ele('@w', 'tblW')
|
|
3083
2825
|
.att('@w', 'type', 'dxa')
|
|
3084
2826
|
.att('@w', 'w', String(tableWidth))
|
|
3085
2827
|
.up();
|
|
3086
|
-
const ɵ53 = buildTableWidth;
|
|
3087
2828
|
const buildCellMargin = (side, margin) => fragment({ namespaceAlias: { w: namespaces.w } })
|
|
3088
2829
|
.ele('@w', side)
|
|
3089
2830
|
.att('@w', 'type', 'dxa')
|
|
3090
2831
|
.att('@w', 'w', String(margin))
|
|
3091
2832
|
.up();
|
|
3092
|
-
const ɵ54 = buildCellMargin;
|
|
3093
2833
|
const buildTableCellMargins = (margin) => {
|
|
3094
2834
|
const tableCellMarFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'tblCellMar');
|
|
3095
2835
|
['top', 'bottom'].forEach((side) => {
|
|
@@ -3102,7 +2842,6 @@ const buildTableCellMargins = (margin) => {
|
|
|
3102
2842
|
});
|
|
3103
2843
|
return tableCellMarFragment;
|
|
3104
2844
|
};
|
|
3105
|
-
const ɵ55 = buildTableCellMargins;
|
|
3106
2845
|
const buildTableProperties = (attributes) => {
|
|
3107
2846
|
const tablePropertiesFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'tblPr');
|
|
3108
2847
|
if (attributes && attributes.constructor === Object) {
|
|
@@ -3139,7 +2878,6 @@ const buildTableProperties = (attributes) => {
|
|
|
3139
2878
|
tablePropertiesFragment.up();
|
|
3140
2879
|
return tablePropertiesFragment;
|
|
3141
2880
|
};
|
|
3142
|
-
const ɵ56 = buildTableProperties;
|
|
3143
2881
|
const cssBorderParser = (borderString) => {
|
|
3144
2882
|
let [size, stroke, color] = borderString.split(' ');
|
|
3145
2883
|
if (pointRegex.test(size)) {
|
|
@@ -3156,7 +2894,6 @@ const cssBorderParser = (borderString) => {
|
|
|
3156
2894
|
color = color && fixupColorCode(color).toUpperCase();
|
|
3157
2895
|
return [size, stroke, color];
|
|
3158
2896
|
};
|
|
3159
|
-
const ɵ57 = cssBorderParser;
|
|
3160
2897
|
const buildTable = (vNode, attributes, docxDocumentInstance) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3161
2898
|
const tableFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'tbl');
|
|
3162
2899
|
const modifiedAttributes = Object.assign({}, attributes);
|
|
@@ -3297,24 +3034,20 @@ const buildTable = (vNode, attributes, docxDocumentInstance) => __awaiter(void 0
|
|
|
3297
3034
|
tableFragment.up();
|
|
3298
3035
|
return tableFragment;
|
|
3299
3036
|
});
|
|
3300
|
-
const ɵ58 = buildTable;
|
|
3301
3037
|
const buildPresetGeometry = () => fragment({ namespaceAlias: { a: namespaces.a } })
|
|
3302
3038
|
.ele('@a', 'prstGeom')
|
|
3303
3039
|
.att('prst', 'rect')
|
|
3304
3040
|
.up();
|
|
3305
|
-
const ɵ59 = buildPresetGeometry;
|
|
3306
3041
|
const buildExtents = ({ width, height }) => fragment({ namespaceAlias: { a: namespaces.a } })
|
|
3307
3042
|
.ele('@a', 'ext')
|
|
3308
3043
|
.att('cx', width)
|
|
3309
3044
|
.att('cy', height)
|
|
3310
3045
|
.up();
|
|
3311
|
-
const ɵ60 = buildExtents;
|
|
3312
3046
|
const buildOffset = () => fragment({ namespaceAlias: { a: namespaces.a } })
|
|
3313
3047
|
.ele('@a', 'off')
|
|
3314
3048
|
.att('x', '0')
|
|
3315
3049
|
.att('y', '0')
|
|
3316
3050
|
.up();
|
|
3317
|
-
const ɵ61 = buildOffset;
|
|
3318
3051
|
const buildGraphicFrameTransform = (attributes) => {
|
|
3319
3052
|
const graphicFrameTransformFragment = fragment({ namespaceAlias: { a: namespaces.a } }).ele('@a', 'xfrm');
|
|
3320
3053
|
const offsetFragment = buildOffset();
|
|
@@ -3324,7 +3057,6 @@ const buildGraphicFrameTransform = (attributes) => {
|
|
|
3324
3057
|
graphicFrameTransformFragment.up();
|
|
3325
3058
|
return graphicFrameTransformFragment;
|
|
3326
3059
|
};
|
|
3327
|
-
const ɵ62 = buildGraphicFrameTransform;
|
|
3328
3060
|
const buildShapeProperties = (attributes) => {
|
|
3329
3061
|
const shapeProperties = fragment({ namespaceAlias: { pic: namespaces.pic } }).ele('@pic', 'spPr');
|
|
3330
3062
|
const graphicFrameTransformFragment = buildGraphicFrameTransform(attributes);
|
|
@@ -3334,11 +3066,9 @@ const buildShapeProperties = (attributes) => {
|
|
|
3334
3066
|
shapeProperties.up();
|
|
3335
3067
|
return shapeProperties;
|
|
3336
3068
|
};
|
|
3337
|
-
const ɵ63 = buildShapeProperties;
|
|
3338
3069
|
const buildFillRect = () => fragment({ namespaceAlias: { a: namespaces.a } })
|
|
3339
3070
|
.ele('@a', 'fillRect')
|
|
3340
3071
|
.up();
|
|
3341
|
-
const ɵ64 = buildFillRect;
|
|
3342
3072
|
const buildStretch = () => {
|
|
3343
3073
|
const stretchFragment = fragment({ namespaceAlias: { a: namespaces.a } }).ele('@a', 'stretch');
|
|
3344
3074
|
const fillRectFragment = buildFillRect();
|
|
@@ -3346,7 +3076,6 @@ const buildStretch = () => {
|
|
|
3346
3076
|
stretchFragment.up();
|
|
3347
3077
|
return stretchFragment;
|
|
3348
3078
|
};
|
|
3349
|
-
const ɵ65 = buildStretch;
|
|
3350
3079
|
const buildSrcRectFragment = () => fragment({ namespaceAlias: { a: namespaces.a } })
|
|
3351
3080
|
.ele('@a', 'srcRect')
|
|
3352
3081
|
.att('b', '0')
|
|
@@ -3354,7 +3083,6 @@ const buildSrcRectFragment = () => fragment({ namespaceAlias: { a: namespaces.a
|
|
|
3354
3083
|
.att('r', '0')
|
|
3355
3084
|
.att('t', '0')
|
|
3356
3085
|
.up();
|
|
3357
|
-
const ɵ66 = buildSrcRectFragment;
|
|
3358
3086
|
const buildBinaryLargeImageOrPicture = (relationshipId) => fragment({
|
|
3359
3087
|
namespaceAlias: { a: namespaces.a, r: namespaces.r },
|
|
3360
3088
|
})
|
|
@@ -3363,7 +3091,6 @@ const buildBinaryLargeImageOrPicture = (relationshipId) => fragment({
|
|
|
3363
3091
|
// FIXME: possible values 'email', 'none', 'print', 'hqprint', 'screen'
|
|
3364
3092
|
.att('cstate', 'print')
|
|
3365
3093
|
.up();
|
|
3366
|
-
const ɵ67 = buildBinaryLargeImageOrPicture;
|
|
3367
3094
|
const buildBinaryLargeImageOrPictureFill = (relationshipId) => {
|
|
3368
3095
|
const binaryLargeImageOrPictureFillFragment = fragment({
|
|
3369
3096
|
namespaceAlias: { pic: namespaces.pic },
|
|
@@ -3377,18 +3104,15 @@ const buildBinaryLargeImageOrPictureFill = (relationshipId) => {
|
|
|
3377
3104
|
binaryLargeImageOrPictureFillFragment.up();
|
|
3378
3105
|
return binaryLargeImageOrPictureFillFragment;
|
|
3379
3106
|
};
|
|
3380
|
-
const ɵ68 = buildBinaryLargeImageOrPictureFill;
|
|
3381
3107
|
const buildNonVisualPictureDrawingProperties = () => fragment({ namespaceAlias: { pic: namespaces.pic } })
|
|
3382
3108
|
.ele('@pic', 'cNvPicPr')
|
|
3383
3109
|
.up();
|
|
3384
|
-
const ɵ69 = buildNonVisualPictureDrawingProperties;
|
|
3385
3110
|
const buildNonVisualDrawingProperties = (pictureId, pictureNameWithExtension, pictureDescription = '') => fragment({ namespaceAlias: { pic: namespaces.pic } })
|
|
3386
3111
|
.ele('@pic', 'cNvPr')
|
|
3387
3112
|
.att('id', pictureId)
|
|
3388
3113
|
.att('name', pictureNameWithExtension)
|
|
3389
3114
|
.att('descr', pictureDescription)
|
|
3390
3115
|
.up();
|
|
3391
|
-
const ɵ70 = buildNonVisualDrawingProperties;
|
|
3392
3116
|
const buildNonVisualPictureProperties = (pictureId, pictureNameWithExtension, pictureDescription) => {
|
|
3393
3117
|
const nonVisualPicturePropertiesFragment = fragment({
|
|
3394
3118
|
namespaceAlias: { pic: namespaces.pic },
|
|
@@ -3401,7 +3125,6 @@ const buildNonVisualPictureProperties = (pictureId, pictureNameWithExtension, pi
|
|
|
3401
3125
|
nonVisualPicturePropertiesFragment.up();
|
|
3402
3126
|
return nonVisualPicturePropertiesFragment;
|
|
3403
3127
|
};
|
|
3404
|
-
const ɵ71 = buildNonVisualPictureProperties;
|
|
3405
3128
|
const buildPicture = ({ id, fileNameWithExtension, description, relationshipId, width, height, }) => {
|
|
3406
3129
|
const pictureFragment = fragment({ namespaceAlias: { pic: namespaces.pic } }).ele('@pic', 'pic');
|
|
3407
3130
|
const nonVisualPicturePropertiesFragment = buildNonVisualPictureProperties(id, fileNameWithExtension, description);
|
|
@@ -3413,7 +3136,6 @@ const buildPicture = ({ id, fileNameWithExtension, description, relationshipId,
|
|
|
3413
3136
|
pictureFragment.up();
|
|
3414
3137
|
return pictureFragment;
|
|
3415
3138
|
};
|
|
3416
|
-
const ɵ72 = buildPicture;
|
|
3417
3139
|
const buildGraphicData = (graphicType, attributes) => {
|
|
3418
3140
|
const graphicDataFragment = fragment({ namespaceAlias: { a: namespaces.a } })
|
|
3419
3141
|
.ele('@a', 'graphicData')
|
|
@@ -3425,7 +3147,6 @@ const buildGraphicData = (graphicType, attributes) => {
|
|
|
3425
3147
|
graphicDataFragment.up();
|
|
3426
3148
|
return graphicDataFragment;
|
|
3427
3149
|
};
|
|
3428
|
-
const ɵ73 = buildGraphicData;
|
|
3429
3150
|
const buildGraphic = (graphicType, attributes) => {
|
|
3430
3151
|
const graphicFragment = fragment({ namespaceAlias: { a: namespaces.a } }).ele('@a', 'graphic');
|
|
3431
3152
|
// TODO: Handle drawing type
|
|
@@ -3434,13 +3155,11 @@ const buildGraphic = (graphicType, attributes) => {
|
|
|
3434
3155
|
graphicFragment.up();
|
|
3435
3156
|
return graphicFragment;
|
|
3436
3157
|
};
|
|
3437
|
-
const ɵ74 = buildGraphic;
|
|
3438
3158
|
const buildDrawingObjectNonVisualProperties = (pictureId, pictureName) => fragment({ namespaceAlias: { wp: namespaces.wp } })
|
|
3439
3159
|
.ele('@wp', 'docPr')
|
|
3440
3160
|
.att('id', pictureId)
|
|
3441
3161
|
.att('name', pictureName)
|
|
3442
3162
|
.up();
|
|
3443
|
-
const ɵ75 = buildDrawingObjectNonVisualProperties;
|
|
3444
3163
|
const buildWrapSquare = () => fragment({ namespaceAlias: { wp: namespaces.wp } })
|
|
3445
3164
|
.ele('@wp', 'wrapSquare')
|
|
3446
3165
|
.att('wrapText', 'bothSides')
|
|
@@ -3449,12 +3168,10 @@ const buildWrapSquare = () => fragment({ namespaceAlias: { wp: namespaces.wp } }
|
|
|
3449
3168
|
.att('distL', '228600')
|
|
3450
3169
|
.att('distR', '228600')
|
|
3451
3170
|
.up();
|
|
3452
|
-
const ɵ76 = buildWrapSquare;
|
|
3453
3171
|
// eslint-disable-next-line no-unused-vars
|
|
3454
3172
|
const buildWrapNone = () => fragment({ namespaceAlias: { wp: namespaces.wp } })
|
|
3455
3173
|
.ele('@wp', 'wrapNone')
|
|
3456
3174
|
.up();
|
|
3457
|
-
const ɵ77 = buildWrapNone;
|
|
3458
3175
|
const buildEffectExtentFragment = () => fragment({ namespaceAlias: { wp: namespaces.wp } })
|
|
3459
3176
|
.ele('@wp', 'effectExtent')
|
|
3460
3177
|
.att('b', '0')
|
|
@@ -3462,13 +3179,11 @@ const buildEffectExtentFragment = () => fragment({ namespaceAlias: { wp: namespa
|
|
|
3462
3179
|
.att('r', '0')
|
|
3463
3180
|
.att('t', '0')
|
|
3464
3181
|
.up();
|
|
3465
|
-
const ɵ78 = buildEffectExtentFragment;
|
|
3466
3182
|
const buildExtent = ({ width, height }) => fragment({ namespaceAlias: { wp: namespaces.wp } })
|
|
3467
3183
|
.ele('@wp', 'extent')
|
|
3468
3184
|
.att('cx', width)
|
|
3469
3185
|
.att('cy', height)
|
|
3470
3186
|
.up();
|
|
3471
|
-
const ɵ79 = buildExtent;
|
|
3472
3187
|
const buildPositionV = () => fragment({ namespaceAlias: { wp: namespaces.wp } })
|
|
3473
3188
|
.ele('@wp', 'positionV')
|
|
3474
3189
|
.att('relativeFrom', 'paragraph')
|
|
@@ -3476,7 +3191,6 @@ const buildPositionV = () => fragment({ namespaceAlias: { wp: namespaces.wp } })
|
|
|
3476
3191
|
.txt('19050')
|
|
3477
3192
|
.up()
|
|
3478
3193
|
.up();
|
|
3479
|
-
const ɵ80 = buildPositionV;
|
|
3480
3194
|
const buildPositionH = () => fragment({ namespaceAlias: { wp: namespaces.wp } })
|
|
3481
3195
|
.ele('@wp', 'positionH')
|
|
3482
3196
|
.att('relativeFrom', 'column')
|
|
@@ -3484,13 +3198,11 @@ const buildPositionH = () => fragment({ namespaceAlias: { wp: namespaces.wp } })
|
|
|
3484
3198
|
.txt('19050')
|
|
3485
3199
|
.up()
|
|
3486
3200
|
.up();
|
|
3487
|
-
const ɵ81 = buildPositionH;
|
|
3488
3201
|
const buildSimplePos = () => fragment({ namespaceAlias: { wp: namespaces.wp } })
|
|
3489
3202
|
.ele('@wp', 'simplePos')
|
|
3490
3203
|
.att('x', '0')
|
|
3491
3204
|
.att('y', '0')
|
|
3492
3205
|
.up();
|
|
3493
|
-
const ɵ82 = buildSimplePos;
|
|
3494
3206
|
const buildAnchoredDrawing = (graphicType, attributes) => {
|
|
3495
3207
|
const anchoredDrawingFragment = fragment({ namespaceAlias: { wp: namespaces.wp } })
|
|
3496
3208
|
.ele('@wp', 'anchor')
|
|
@@ -3524,7 +3236,6 @@ const buildAnchoredDrawing = (graphicType, attributes) => {
|
|
|
3524
3236
|
anchoredDrawingFragment.up();
|
|
3525
3237
|
return anchoredDrawingFragment;
|
|
3526
3238
|
};
|
|
3527
|
-
const ɵ83 = buildAnchoredDrawing;
|
|
3528
3239
|
const buildInlineDrawing = (graphicType, attributes) => {
|
|
3529
3240
|
const inlineDrawingFragment = fragment({ namespaceAlias: { wp: namespaces.wp } })
|
|
3530
3241
|
.ele('@wp', 'inline')
|
|
@@ -3543,7 +3254,6 @@ const buildInlineDrawing = (graphicType, attributes) => {
|
|
|
3543
3254
|
inlineDrawingFragment.up();
|
|
3544
3255
|
return inlineDrawingFragment;
|
|
3545
3256
|
};
|
|
3546
|
-
const ɵ84 = buildInlineDrawing;
|
|
3547
3257
|
const buildDrawing = (inlineOrAnchored = false, graphicType, attributes) => {
|
|
3548
3258
|
const drawingFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'drawing');
|
|
3549
3259
|
const inlineOrAnchoredDrawingFragment = inlineOrAnchored
|
|
@@ -3553,12 +3263,6 @@ const buildDrawing = (inlineOrAnchored = false, graphicType, attributes) => {
|
|
|
3553
3263
|
drawingFragment.up();
|
|
3554
3264
|
return drawingFragment;
|
|
3555
3265
|
};
|
|
3556
|
-
const ɵ85 = buildDrawing;
|
|
3557
|
-
|
|
3558
|
-
const convertHTML$1 = HTMLToVDOM({
|
|
3559
|
-
VNode,
|
|
3560
|
-
VText,
|
|
3561
|
-
});
|
|
3562
3266
|
// eslint-disable-next-line consistent-return, no-shadow
|
|
3563
3267
|
const buildImage = (docxDocumentInstance, vNode, maximumWidth = null) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3564
3268
|
let response = null;
|
|
@@ -3594,7 +3298,7 @@ const buildImage = (docxDocumentInstance, vNode, maximumWidth = null) => __await
|
|
|
3594
3298
|
const documentRelsId = docxDocumentInstance.createDocumentRelationships(docxDocumentInstance.relationshipFilename, imageType, `media/${response.fileNameWithExtension}`, internalRelationship);
|
|
3595
3299
|
const imageBuffer = Buffer.from(response.fileContent, 'base64');
|
|
3596
3300
|
const imageProperties = sizeOf(imageBuffer);
|
|
3597
|
-
const imageFragment = yield buildParagraph(vNode, Object.assign(Object.assign({ type: 'picture', inlineOrAnchored: true, relationshipId: documentRelsId }, response), { maximumWidth: maximumWidth || docxDocumentInstance.availableDocumentSpace, originalWidth: imageProperties.width, originalHeight: imageProperties.height }), docxDocumentInstance);
|
|
3301
|
+
const imageFragment = yield xmlBuilder.buildParagraph(vNode, Object.assign(Object.assign({ type: 'picture', inlineOrAnchored: true, relationshipId: documentRelsId }, response), { maximumWidth: maximumWidth || docxDocumentInstance.availableDocumentSpace, originalWidth: imageProperties.width, originalHeight: imageProperties.height }), docxDocumentInstance);
|
|
3598
3302
|
return imageFragment;
|
|
3599
3303
|
}
|
|
3600
3304
|
});
|
|
@@ -3612,7 +3316,7 @@ const buildList = (vNode, docxDocumentInstance, xmlFragment) => __awaiter(void 0
|
|
|
3612
3316
|
const tempVNodeObject = vNodeObjects.shift();
|
|
3613
3317
|
if (isVText(tempVNodeObject.node) ||
|
|
3614
3318
|
(isVNode(tempVNodeObject.node) && !['ul', 'ol', 'li'].includes(tempVNodeObject.node.tagName))) {
|
|
3615
|
-
const paragraphFragment = yield buildParagraph(tempVNodeObject.node, {
|
|
3319
|
+
const paragraphFragment = yield xmlBuilder.buildParagraph(tempVNodeObject.node, {
|
|
3616
3320
|
numbering: { levelId: tempVNodeObject.level, numberingId: tempVNodeObject.numberingId },
|
|
3617
3321
|
}, docxDocumentInstance);
|
|
3618
3322
|
xmlFragment.import(paragraphFragment);
|
|
@@ -3670,6 +3374,11 @@ const buildList = (vNode, docxDocumentInstance, xmlFragment) => __awaiter(void 0
|
|
|
3670
3374
|
}
|
|
3671
3375
|
}
|
|
3672
3376
|
return listElements;
|
|
3377
|
+
});
|
|
3378
|
+
|
|
3379
|
+
const convertHTML$1 = HTMLToVDOM({
|
|
3380
|
+
VNode: VNode$1,
|
|
3381
|
+
VText,
|
|
3673
3382
|
});
|
|
3674
3383
|
function findXMLEquivalent(docxDocumentInstance, vNode, xmlFragment) {
|
|
3675
3384
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -4318,11 +4027,10 @@ function _prepareImageParts(htmlSource) {
|
|
|
4318
4027
|
}
|
|
4319
4028
|
|
|
4320
4029
|
const convertHTML = HTMLToVDOM({
|
|
4321
|
-
VNode,
|
|
4030
|
+
VNode: VNode$1,
|
|
4322
4031
|
VText,
|
|
4323
4032
|
});
|
|
4324
4033
|
const mergeOptions = (options, patch) => (Object.assign(Object.assign({}, options), patch));
|
|
4325
|
-
const ɵ0$1 = mergeOptions;
|
|
4326
4034
|
const fixupFontSize = (fontSize) => {
|
|
4327
4035
|
let normalizedFontSize;
|
|
4328
4036
|
if (pointRegex.test(fontSize)) {
|
|
@@ -4338,7 +4046,6 @@ const fixupFontSize = (fontSize) => {
|
|
|
4338
4046
|
}
|
|
4339
4047
|
return normalizedFontSize;
|
|
4340
4048
|
};
|
|
4341
|
-
const ɵ1 = fixupFontSize;
|
|
4342
4049
|
const normalizeUnits = (dimensioningObject, defaultDimensionsProperty) => {
|
|
4343
4050
|
let normalizedUnitResult = {};
|
|
4344
4051
|
if (typeof dimensioningObject === 'object' && dimensioningObject !== null) {
|
|
@@ -4370,7 +4077,6 @@ const normalizeUnits = (dimensioningObject, defaultDimensionsProperty) => {
|
|
|
4370
4077
|
}
|
|
4371
4078
|
return normalizedUnitResult;
|
|
4372
4079
|
};
|
|
4373
|
-
const ɵ2 = normalizeUnits;
|
|
4374
4080
|
const normalizeDocumentOptions = (documentOptions) => {
|
|
4375
4081
|
const normalizedDocumentOptions = Object.assign({}, documentOptions);
|
|
4376
4082
|
Object.keys(documentOptions).forEach((key) => {
|
|
@@ -4388,7 +4094,6 @@ const normalizeDocumentOptions = (documentOptions) => {
|
|
|
4388
4094
|
});
|
|
4389
4095
|
return normalizedDocumentOptions;
|
|
4390
4096
|
};
|
|
4391
|
-
const ɵ3 = normalizeDocumentOptions;
|
|
4392
4097
|
// Ref: https://en.wikipedia.org/wiki/Office_Open_XML_file_formats
|
|
4393
4098
|
// http://officeopenxml.com/anatomyofOOXML.php
|
|
4394
4099
|
function addFilesToContainer(zip, htmlString, suppliedDocumentOptions, headerHTMLString, footerHTMLString) {
|
|
@@ -4515,7 +4220,6 @@ const minifyHTMLString = (htmlString) => {
|
|
|
4515
4220
|
return null;
|
|
4516
4221
|
}
|
|
4517
4222
|
};
|
|
4518
|
-
const ɵ0 = minifyHTMLString;
|
|
4519
4223
|
function generateContainer(htmlString, headerHTMLString, documentOptions = {}, footerHTMLString) {
|
|
4520
4224
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4521
4225
|
const zip = new JSZip();
|
|
@@ -4574,28 +4278,278 @@ class WordDocumentService {
|
|
|
4574
4278
|
});
|
|
4575
4279
|
}
|
|
4576
4280
|
}
|
|
4577
|
-
WordDocumentService.ɵ
|
|
4578
|
-
WordDocumentService
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4281
|
+
WordDocumentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: WordDocumentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4282
|
+
WordDocumentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: WordDocumentService, providedIn: 'root' });
|
|
4283
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: WordDocumentService, decorators: [{
|
|
4284
|
+
type: Injectable,
|
|
4285
|
+
args: [{
|
|
4286
|
+
providedIn: 'root',
|
|
4287
|
+
}]
|
|
4288
|
+
}] });
|
|
4583
4289
|
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4290
|
+
const TOKEN_KEY = 'access_token';
|
|
4291
|
+
class AuthService {
|
|
4292
|
+
constructor(injector, http, environmentService, translateService, router, cookieService, utilityService) {
|
|
4293
|
+
this.injector = injector;
|
|
4294
|
+
this.http = http;
|
|
4295
|
+
this.environmentService = environmentService;
|
|
4296
|
+
this.translateService = translateService;
|
|
4297
|
+
this.router = router;
|
|
4298
|
+
this.cookieService = cookieService;
|
|
4299
|
+
this.utilityService = utilityService;
|
|
4300
|
+
this.redirectUrl = '';
|
|
4301
|
+
this.jwtHelper = new JwtHelperService();
|
|
4302
|
+
this.isAuthenticatedSubject = new BehaviorSubject(this.hasToken());
|
|
4303
|
+
this.isAuthenticate$ = this.isAuthenticatedSubject.asObservable();
|
|
4304
|
+
this.user = this.getUserManager();
|
|
4305
|
+
}
|
|
4306
|
+
hasToken() {
|
|
4307
|
+
const token = this.cookieService.get(TOKEN_KEY);
|
|
4308
|
+
return token && !this.jwtHelper.isTokenExpired(token);
|
|
4309
|
+
}
|
|
4310
|
+
getUserManager() {
|
|
4311
|
+
const token = this.cookieService.get(TOKEN_KEY);
|
|
4312
|
+
if (token)
|
|
4313
|
+
this.handleAccessTokenWithoutLanguage(token);
|
|
4314
|
+
return AuthService.user;
|
|
4315
|
+
}
|
|
4316
|
+
getUser() {
|
|
4317
|
+
this.user = AuthService.user;
|
|
4318
|
+
}
|
|
4319
|
+
storUser(User) {
|
|
4320
|
+
AuthService.user = this.user = this.user;
|
|
4321
|
+
}
|
|
4322
|
+
getCurrentUser() {
|
|
4323
|
+
return AuthService.user;
|
|
4324
|
+
}
|
|
4325
|
+
isAuthenticated() {
|
|
4326
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4327
|
+
return AuthService.user != null && !this.jwtHelper.isTokenExpired(AuthService.user.access_token);
|
|
4328
|
+
});
|
|
4329
|
+
}
|
|
4330
|
+
isUserInRole(allowedPermission) {
|
|
4331
|
+
let selectedPermissionSetID = Number.parseInt(this.user.profile['selectedpermissionsetid']);
|
|
4332
|
+
return allowedPermission.includes(selectedPermissionSetID);
|
|
4333
|
+
}
|
|
4334
|
+
authorizationHeaderValue() {
|
|
4335
|
+
return AuthService.user
|
|
4336
|
+
? `${AuthService.user.token_type} ${AuthService.user.access_token}`
|
|
4337
|
+
: '';
|
|
4338
|
+
}
|
|
4339
|
+
name() {
|
|
4340
|
+
return AuthService.user != null ? AuthService.user.profile.given_name : '';
|
|
4341
|
+
}
|
|
4342
|
+
setUrl(url) {
|
|
4343
|
+
localStorage.setItem('redirectUrl', url);
|
|
4344
|
+
}
|
|
4345
|
+
getUrl() {
|
|
4346
|
+
var _a;
|
|
4347
|
+
return (_a = localStorage.getItem('redirectUrl')) !== null && _a !== void 0 ? _a : "/";
|
|
4348
|
+
}
|
|
4349
|
+
signOut() {
|
|
4350
|
+
AuthService.timers.map(t => clearInterval(t));
|
|
4351
|
+
AuthService.timers = [];
|
|
4352
|
+
if (!this.isAuthenticated()) {
|
|
4353
|
+
this.cookieService.delete(TOKEN_KEY);
|
|
4354
|
+
this.router.navigate(['/Admin/account/login']);
|
|
4355
|
+
}
|
|
4356
|
+
this.logout().subscribe(res => {
|
|
4357
|
+
this.cookieService.delete(TOKEN_KEY);
|
|
4358
|
+
if (this.environmentService.getBBSFAuthenticationMode() == AuthenticationModes.UAEPass)
|
|
4359
|
+
this.logoutFromUAEPass();
|
|
4360
|
+
else
|
|
4361
|
+
this.router.navigate(['/Admin/account/login']);
|
|
4362
|
+
});
|
|
4363
|
+
}
|
|
4364
|
+
logout() {
|
|
4365
|
+
const httpOptions = {
|
|
4366
|
+
headers: new HttpHeaders({
|
|
4367
|
+
'Content-Type': 'application/json',
|
|
4368
|
+
}),
|
|
4369
|
+
};
|
|
4370
|
+
let ApiUrl = '/Account/';
|
|
4371
|
+
return this.http.get(this.environmentService.getApiUrl() + ApiUrl + 'Logout', httpOptions);
|
|
4372
|
+
}
|
|
4373
|
+
clearUserSessionClaims() {
|
|
4374
|
+
const httpOptions = {
|
|
4375
|
+
headers: new HttpHeaders({
|
|
4376
|
+
'Content-Type': 'application/json',
|
|
4377
|
+
}),
|
|
4378
|
+
};
|
|
4379
|
+
let ApiUrl = '/api/Home/';
|
|
4380
|
+
return this.http.get(this.environmentService.getBaseUrl() + ApiUrl + 'ClearCurrentUserSession', httpOptions);
|
|
4381
|
+
}
|
|
4382
|
+
handleAccessToken(response) {
|
|
4383
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4384
|
+
const token = response;
|
|
4385
|
+
AuthService.user = new User();
|
|
4386
|
+
AuthService.user.token_type = "Bearer";
|
|
4387
|
+
AuthService.user.access_token = token;
|
|
4388
|
+
AuthService.user.profile = this.jwtHelper.decodeToken(token);
|
|
4389
|
+
AuthService.user.expires_at = this.jwtHelper.getTokenExpirationDate(token);
|
|
4390
|
+
AuthService.timers.map(t => clearInterval(t));
|
|
4391
|
+
AuthService.timers = [];
|
|
4392
|
+
this.setTokenSeconds();
|
|
4393
|
+
AuthService.timers.push(this.checkRefreshToken());
|
|
4394
|
+
this.user = AuthService.user;
|
|
4395
|
+
yield this.updateLanguage();
|
|
4396
|
+
this.cookieService.set(TOKEN_KEY, token, null, null, null, true, 'Strict');
|
|
4397
|
+
this.isAuthenticatedSubject.next(true);
|
|
4398
|
+
});
|
|
4399
|
+
}
|
|
4400
|
+
handleAccessTokenWithoutLanguage(response) {
|
|
4401
|
+
const token = response;
|
|
4402
|
+
AuthService.user = new User();
|
|
4403
|
+
AuthService.user.token_type = "Bearer";
|
|
4404
|
+
AuthService.user.access_token = token;
|
|
4405
|
+
AuthService.user.profile = this.jwtHelper.decodeToken(token);
|
|
4406
|
+
AuthService.user.expires_at = this.jwtHelper.getTokenExpirationDate(token);
|
|
4407
|
+
this.setTokenSeconds();
|
|
4408
|
+
this.user = AuthService.user;
|
|
4409
|
+
this.cookieService.set(TOKEN_KEY, token, null, null, null, true, 'Strict');
|
|
4410
|
+
this.isAuthenticatedSubject.next(true);
|
|
4411
|
+
}
|
|
4412
|
+
updateLanguage() {
|
|
4413
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4414
|
+
if (!localStorage.getItem('language') ||
|
|
4415
|
+
localStorage.getItem('language') == this.user.profile.locale)
|
|
4416
|
+
localStorage.setItem('language', this.user.profile.locale);
|
|
4417
|
+
if (this.translateService.currentLang != localStorage.getItem('language')) {
|
|
4418
|
+
this.translateService.resetLang(this.translateService.currentLang);
|
|
4419
|
+
yield this.translateService
|
|
4420
|
+
.reloadLang(localStorage.getItem('language'))
|
|
4421
|
+
.subscribe((res) => {
|
|
4422
|
+
console.log(res);
|
|
4423
|
+
});
|
|
4424
|
+
}
|
|
4425
|
+
});
|
|
4426
|
+
}
|
|
4427
|
+
checkRefreshToken() {
|
|
4428
|
+
let date = new Date();
|
|
4429
|
+
return setInterval(() => {
|
|
4430
|
+
if (Math.floor(AuthService.seconds) < 120 && this.isAuthenticated())
|
|
4431
|
+
this.refresh();
|
|
4432
|
+
AuthService.seconds--;
|
|
4433
|
+
}, 1000);
|
|
4434
|
+
}
|
|
4435
|
+
setTokenSeconds() {
|
|
4436
|
+
let date = new Date();
|
|
4437
|
+
AuthService.seconds = (AuthService.user.expires_at - date) / 1000;
|
|
4438
|
+
}
|
|
4439
|
+
refresh() {
|
|
4440
|
+
const httpOptions = {
|
|
4441
|
+
headers: new HttpHeaders({
|
|
4442
|
+
'Content-Type': 'application/json',
|
|
4443
|
+
'Authorization': this.authorizationHeaderValue(),
|
|
4444
|
+
}),
|
|
4445
|
+
};
|
|
4446
|
+
let ApiUrl = '/api/Home/';
|
|
4447
|
+
this.http.get(this.environmentService.getApiUrl() + ApiUrl + 'RefreshAccessToken', httpOptions).subscribe((res) => {
|
|
4448
|
+
this.cookieService.delete(TOKEN_KEY);
|
|
4449
|
+
this.handleAccessTokenWithoutLanguage(res.val);
|
|
4450
|
+
});
|
|
4451
|
+
}
|
|
4452
|
+
loginWithUAEPass() {
|
|
4453
|
+
const authEndpoint = `${this.environmentService.getUAEPassBaseUrl()}${this.environmentService.getUAEPassAuthorizationEndPoint()}`;
|
|
4454
|
+
const queryParams = {
|
|
4455
|
+
response_type: 'code',
|
|
4456
|
+
client_id: `${this.environmentService.getUAEPassClientID()}`,
|
|
4457
|
+
redirect_uri: `${this.environmentService.getBaseUrl()}${this.environmentService.getUAEPassRedirectUrl()}`,
|
|
4458
|
+
scope: 'urn:uae:digitalid:profile:general urn:uae:digitalid:profile:general:profileType urn:uae:digitalid:profile:general:unifiedId',
|
|
4459
|
+
state: 'pd3PgezRwk596u2yfRwqOgru',
|
|
4460
|
+
acr_values: 'urn:safelayer:tws:policies:authentication:level:low'
|
|
4461
|
+
};
|
|
4462
|
+
const queryParamsString = Object.entries(queryParams)
|
|
4463
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(value)}`)
|
|
4464
|
+
.join('&');
|
|
4465
|
+
const loginUrl = `${authEndpoint}?${queryParamsString}`;
|
|
4466
|
+
window.location.href = loginUrl;
|
|
4467
|
+
return;
|
|
4468
|
+
}
|
|
4469
|
+
logoutFromUAEPass() {
|
|
4470
|
+
const logoutEndpoint = `${this.environmentService.getUAEPassBaseUrl()}${this.environmentService.getUAEPassLogoutEndPoint()}`;
|
|
4471
|
+
const queryParams = {
|
|
4472
|
+
redirect_uri: `${this.environmentService.getBaseUrl()}`,
|
|
4473
|
+
};
|
|
4474
|
+
const queryParamsString = Object.entries(queryParams)
|
|
4475
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(value)}`)
|
|
4476
|
+
.join('&');
|
|
4477
|
+
const logoutUrl = `${logoutEndpoint}?${queryParamsString}`;
|
|
4478
|
+
window.location.href = logoutUrl;
|
|
4479
|
+
return;
|
|
4587
4480
|
}
|
|
4588
4481
|
}
|
|
4589
|
-
|
|
4590
|
-
|
|
4482
|
+
AuthService.user = null;
|
|
4483
|
+
AuthService.UserClaims = null;
|
|
4484
|
+
//refresh
|
|
4485
|
+
AuthService.timers = [];
|
|
4486
|
+
AuthService.seconds = 0;
|
|
4487
|
+
AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthService, deps: [{ token: i0.Injector }, { token: i1.HttpClient }, { token: EnvironmentService }, { token: BBSFTranslateService }, { token: i1$1.Router }, { token: i4$1.CookieService }, { token: UtilityService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4488
|
+
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthService, providedIn: 'root' });
|
|
4489
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthService, decorators: [{
|
|
4490
|
+
type: Injectable,
|
|
4491
|
+
args: [{
|
|
4492
|
+
providedIn: 'root',
|
|
4493
|
+
}]
|
|
4494
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1.HttpClient }, { type: EnvironmentService }, { type: BBSFTranslateService }, { type: i1$1.Router }, { type: i4$1.CookieService }, { type: UtilityService }]; } });
|
|
4495
|
+
|
|
4496
|
+
class BBSFUtilitiesModule {
|
|
4497
|
+
}
|
|
4498
|
+
BBSFUtilitiesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BBSFUtilitiesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
4499
|
+
BBSFUtilitiesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: BBSFUtilitiesModule, imports: [CommonModule,
|
|
4500
|
+
RouterModule, i1$2.BlockUIModule, i2.ToastrModule] });
|
|
4501
|
+
BBSFUtilitiesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BBSFUtilitiesModule, providers: [
|
|
4502
|
+
UtilityService,
|
|
4503
|
+
EnvironmentService,
|
|
4504
|
+
AuthService,
|
|
4505
|
+
RequestHandlerService,
|
|
4506
|
+
StylesBundleService,
|
|
4507
|
+
TranslateService,
|
|
4508
|
+
BBSFTranslateService,
|
|
4509
|
+
ControlValidationService,
|
|
4510
|
+
MasterLayoutService,
|
|
4511
|
+
ConfigurationService,
|
|
4512
|
+
CookieService
|
|
4513
|
+
], imports: [CommonModule,
|
|
4514
|
+
RouterModule,
|
|
4515
|
+
BlockUIModule.forRoot(),
|
|
4516
|
+
ToastrModule.forRoot()] });
|
|
4517
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BBSFUtilitiesModule, decorators: [{
|
|
4518
|
+
type: NgModule,
|
|
4519
|
+
args: [{
|
|
4520
|
+
declarations: [],
|
|
4521
|
+
imports: [
|
|
4522
|
+
CommonModule,
|
|
4523
|
+
RouterModule,
|
|
4524
|
+
BlockUIModule.forRoot(),
|
|
4525
|
+
ToastrModule.forRoot(),
|
|
4526
|
+
],
|
|
4527
|
+
exports: [],
|
|
4528
|
+
providers: [
|
|
4529
|
+
UtilityService,
|
|
4530
|
+
EnvironmentService,
|
|
4531
|
+
AuthService,
|
|
4532
|
+
RequestHandlerService,
|
|
4533
|
+
StylesBundleService,
|
|
4534
|
+
TranslateService,
|
|
4535
|
+
BBSFTranslateService,
|
|
4536
|
+
ControlValidationService,
|
|
4537
|
+
MasterLayoutService,
|
|
4538
|
+
ConfigurationService,
|
|
4539
|
+
CookieService
|
|
4540
|
+
]
|
|
4541
|
+
}]
|
|
4542
|
+
}] });
|
|
4591
4543
|
|
|
4592
4544
|
/*
|
|
4593
4545
|
* Public API Surface of @bnsights/bbsf-utilities
|
|
4594
|
-
*/
|
|
4546
|
+
*/
|
|
4547
|
+
//Module
|
|
4548
|
+
//#endregion
|
|
4595
4549
|
|
|
4596
4550
|
/**
|
|
4597
4551
|
* Generated bundle index. Do not edit.
|
|
4598
4552
|
*/
|
|
4599
4553
|
|
|
4600
|
-
export {
|
|
4601
|
-
//# sourceMappingURL=bnsights-bbsf-utilities.
|
|
4554
|
+
export { AppearanceConfigurationService, AuthService, AuthenticationModes, BBSFTranslateService, BBSFUtilitiesModule, ConfigurationService, ControlValidationService, DocumentOptionsModel, EnvironmentService, MasterLayoutService, RequestHandlerService, RequestOptionsModel, StylesBundleService, TranslationResolverService, UtilityService, WordDocumentModel, WordDocumentService, environment };
|
|
4555
|
+
//# sourceMappingURL=bnsights-bbsf-utilities.mjs.map
|