@gloww/gloww 14.0.0-beta.8 → 19.0.0-beta.1
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/fesm2022/gloww-gloww.mjs +4026 -0
- package/fesm2022/gloww-gloww.mjs.map +1 -0
- package/gloww.theme.scss +97 -70
- package/index.d.ts +1049 -5
- package/package.json +11 -29
- package/esm2020/gloww-gloww.mjs +0 -5
- package/esm2020/lib/Components/auto-complete/auto-complete.component.mjs +0 -152
- package/esm2020/lib/Components/code-editor/code-editor.component.mjs +0 -155
- package/esm2020/lib/Components/confirmation/confirmation.component.mjs +0 -44
- package/esm2020/lib/Components/datetime/datetime.component.mjs +0 -84
- package/esm2020/lib/Components/display-objects/display-objects.component.mjs +0 -619
- package/esm2020/lib/Components/display-objects-configuration.mjs +0 -2
- package/esm2020/lib/Components/download-progress/download-progress.component.mjs +0 -117
- package/esm2020/lib/Components/dummy/dummy.component.mjs +0 -14
- package/esm2020/lib/Components/folders/file-edit/file-edit.component.mjs +0 -90
- package/esm2020/lib/Components/folders/folders/folders.component.mjs +0 -190
- package/esm2020/lib/Components/header/header.component.mjs +0 -14
- package/esm2020/lib/Components/html-editor/html-editor.component.mjs +0 -175
- package/esm2020/lib/Components/menu-list-item/menu-list-item.component.mjs +0 -107
- package/esm2020/lib/Components/prompt/prompt.component.mjs +0 -52
- package/esm2020/lib/Components/result-table/result-table.component.mjs +0 -21
- package/esm2020/lib/Components/search-form/search-form.component.mjs +0 -14
- package/esm2020/lib/Components/secure-a/secure-a.component.mjs +0 -31
- package/esm2020/lib/Components/secure-img/secure-img.component.mjs +0 -45
- package/esm2020/lib/Components/select/select.component.mjs +0 -132
- package/esm2020/lib/Components/upload-doc/upload-doc.component.mjs +0 -95
- package/esm2020/lib/Components/upload-file/upload-file.component.mjs +0 -146
- package/esm2020/lib/Directives/file-sink.directive.mjs +0 -52
- package/esm2020/lib/Directives/route.directive.mjs +0 -31
- package/esm2020/lib/Guards/has-unsaved-data.guard.mjs +0 -29
- package/esm2020/lib/Guards/ihas-unsaved-data.mjs +0 -2
- package/esm2020/lib/Helpers/gloww-validators.mjs +0 -116
- package/esm2020/lib/Models/nav-item.mjs +0 -2
- package/esm2020/lib/Pipes/html-format.pipe.mjs +0 -23
- package/esm2020/lib/Pipes/retry-with-delay.mjs +0 -12
- package/esm2020/lib/Pipes/safe-html.pipe.mjs +0 -22
- package/esm2020/lib/Pipes/secure.pipe.mjs +0 -34
- package/esm2020/lib/Services/dialog.service.mjs +0 -29
- package/esm2020/lib/Services/folder-service-config.mjs +0 -21
- package/esm2020/lib/Services/folder.service.mjs +0 -54
- package/esm2020/lib/Services/gloww.service.mjs +0 -83
- package/esm2020/lib/Services/nav.service.mjs +0 -28
- package/esm2020/lib/Services/snippets.service.mjs +0 -25
- package/esm2020/lib/Services/version-check.service.mjs +0 -81
- package/esm2020/lib/Services/voice-recognition.service.mjs +0 -55
- package/esm2020/lib/gloww-security/Components/change-password-dlg/change-password-dlg.component.mjs +0 -67
- package/esm2020/lib/gloww-security/Components/login/login.component.mjs +0 -173
- package/esm2020/lib/gloww-security/Components/social-network/social-network.component.mjs +0 -46
- package/esm2020/lib/gloww-security/Components/social-network-dlg/social-network-dlg.component.mjs +0 -52
- package/esm2020/lib/gloww-security/Components/user-menu/user-menu.component.mjs +0 -73
- package/esm2020/lib/gloww-security/Helpers/administrator.guard.mjs +0 -27
- package/esm2020/lib/gloww-security/Helpers/auth.guard.mjs +0 -57
- package/esm2020/lib/gloww-security/Helpers/error.interceptor.mjs +0 -29
- package/esm2020/lib/gloww-security/Helpers/index.mjs +0 -5
- package/esm2020/lib/gloww-security/Helpers/jwt.interceptor.mjs +0 -31
- package/esm2020/lib/gloww-security/Helpers/staging.interceptor.mjs +0 -24
- package/esm2020/lib/gloww-security/Models/oauthassociation.mjs +0 -6
- package/esm2020/lib/gloww-security/Models/user.mjs +0 -3
- package/esm2020/lib/gloww-security/Services/authentication-service-config.mjs +0 -25
- package/esm2020/lib/gloww-security/Services/authentication.service.mjs +0 -205
- package/esm2020/lib/gloww-security/Services/gloww-security.service.mjs +0 -14
- package/esm2020/lib/gloww-security/gloww-security.module.mjs +0 -169
- package/esm2020/lib/gloww.module.mjs +0 -282
- package/esm2020/lib/injection-token.mjs +0 -3
- package/esm2020/public-api.mjs +0 -40
- package/fesm2015/gloww-gloww.mjs +0 -3976
- package/fesm2015/gloww-gloww.mjs.map +0 -1
- package/fesm2020/gloww-gloww.mjs +0 -3917
- package/fesm2020/gloww-gloww.mjs.map +0 -1
- package/lib/Components/auto-complete/auto-complete.component.d.ts +0 -39
- package/lib/Components/code-editor/code-editor.component.d.ts +0 -45
- package/lib/Components/confirmation/confirmation.component.d.ts +0 -20
- package/lib/Components/datetime/datetime.component.d.ts +0 -22
- package/lib/Components/display-objects/display-objects.component.d.ts +0 -101
- package/lib/Components/display-objects-configuration.d.ts +0 -5
- package/lib/Components/download-progress/download-progress.component.d.ts +0 -30
- package/lib/Components/dummy/dummy.component.d.ts +0 -8
- package/lib/Components/folders/file-edit/file-edit.component.d.ts +0 -38
- package/lib/Components/folders/folders/folders.component.d.ts +0 -33
- package/lib/Components/header/header.component.d.ts +0 -8
- package/lib/Components/html-editor/html-editor.component.d.ts +0 -36
- package/lib/Components/menu-list-item/menu-list-item.component.d.ts +0 -30
- package/lib/Components/prompt/prompt.component.d.ts +0 -25
- package/lib/Components/result-table/result-table.component.d.ts +0 -11
- package/lib/Components/search-form/search-form.component.d.ts +0 -8
- package/lib/Components/secure-a/secure-a.component.d.ts +0 -13
- package/lib/Components/secure-img/secure-img.component.d.ts +0 -17
- package/lib/Components/select/select.component.d.ts +0 -35
- package/lib/Components/upload-doc/upload-doc.component.d.ts +0 -19
- package/lib/Components/upload-file/upload-file.component.d.ts +0 -34
- package/lib/Directives/file-sink.directive.d.ts +0 -11
- package/lib/Directives/route.directive.d.ts +0 -12
- package/lib/Guards/has-unsaved-data.guard.d.ts +0 -8
- package/lib/Guards/ihas-unsaved-data.d.ts +0 -3
- package/lib/Helpers/gloww-validators.d.ts +0 -39
- package/lib/Models/nav-item.d.ts +0 -9
- package/lib/Pipes/html-format.pipe.d.ts +0 -10
- package/lib/Pipes/retry-with-delay.d.ts +0 -2
- package/lib/Pipes/safe-html.pipe.d.ts +0 -10
- package/lib/Pipes/secure.pipe.d.ts +0 -13
- package/lib/Services/dialog.service.d.ts +0 -11
- package/lib/Services/folder-service-config.d.ts +0 -7
- package/lib/Services/folder.service.d.ts +0 -20
- package/lib/Services/gloww.service.d.ts +0 -28
- package/lib/Services/nav.service.d.ts +0 -13
- package/lib/Services/snippets.service.d.ts +0 -16
- package/lib/Services/version-check.service.d.ts +0 -30
- package/lib/Services/voice-recognition.service.d.ts +0 -14
- package/lib/gloww-security/Components/change-password-dlg/change-password-dlg.component.d.ts +0 -19
- package/lib/gloww-security/Components/login/login.component.d.ts +0 -43
- package/lib/gloww-security/Components/social-network/social-network.component.d.ts +0 -25
- package/lib/gloww-security/Components/social-network-dlg/social-network-dlg.component.d.ts +0 -21
- package/lib/gloww-security/Components/user-menu/user-menu.component.d.ts +0 -24
- package/lib/gloww-security/Helpers/administrator.guard.d.ts +0 -14
- package/lib/gloww-security/Helpers/auth.guard.d.ts +0 -14
- package/lib/gloww-security/Helpers/error.interceptor.d.ts +0 -11
- package/lib/gloww-security/Helpers/index.d.ts +0 -4
- package/lib/gloww-security/Helpers/jwt.interceptor.d.ts +0 -11
- package/lib/gloww-security/Helpers/staging.interceptor.d.ts +0 -9
- package/lib/gloww-security/Models/oauthassociation.d.ts +0 -7
- package/lib/gloww-security/Models/user.d.ts +0 -9
- package/lib/gloww-security/Services/authentication-service-config.d.ts +0 -17
- package/lib/gloww-security/Services/authentication.service.d.ts +0 -40
- package/lib/gloww-security/Services/gloww-security.service.d.ts +0 -6
- package/lib/gloww-security/gloww-security.module.d.ts +0 -35
- package/lib/gloww.module.d.ts +0 -77
- package/lib/injection-token.d.ts +0 -2
- package/public-api.d.ts +0 -36
|
@@ -0,0 +1,4026 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, Injectable, HostListener, Input, Directive, Pipe, Inject, Component, EventEmitter, Output, HostBinding, ViewChild, ContentChildren, PLATFORM_ID, Optional, ContentChild, ViewEncapsulation, NgModule, SecurityContext, forwardRef } from '@angular/core';
|
|
3
|
+
import { Subject, firstValueFrom, BehaviorSubject, Subscription, of, combineLatest, forkJoin, throwError } from 'rxjs';
|
|
4
|
+
import * as i1 from '@angular/common/http';
|
|
5
|
+
import { HttpClient, HttpParams, HttpEventType, HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi, HttpResponse } from '@angular/common/http';
|
|
6
|
+
import * as i3 from '@angular/common';
|
|
7
|
+
import { Location, PlatformLocation, isPlatformBrowser, CommonModule } from '@angular/common';
|
|
8
|
+
import * as i1$2 from '@angular/material/dialog';
|
|
9
|
+
import { MAT_DIALOG_DATA, MatDialogConfig, MatDialogModule } from '@angular/material/dialog';
|
|
10
|
+
import * as i4 from '@angular/material/button';
|
|
11
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
12
|
+
import * as i2 from '@angular/router';
|
|
13
|
+
import { NavigationEnd, RouterModule } from '@angular/router';
|
|
14
|
+
import * as i1$1 from '@angular/platform-browser';
|
|
15
|
+
import { BrowserModule } from '@angular/platform-browser';
|
|
16
|
+
import * as i6 from '@kolkov/angular-editor';
|
|
17
|
+
import { AngularEditorModule } from '@kolkov/angular-editor';
|
|
18
|
+
import { switchMap, map, tap, filter, catchError, take, mergeMap, retryWhen, scan, delay, first, distinctUntilChanged, debounceTime } from 'rxjs/operators';
|
|
19
|
+
import * as i14 from '@angular/material/sort';
|
|
20
|
+
import { MatSort, MatSortModule } from '@angular/material/sort';
|
|
21
|
+
import * as i13 from '@angular/material/paginator';
|
|
22
|
+
import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
|
|
23
|
+
import * as i11 from '@angular/material/table';
|
|
24
|
+
import { MatColumnDef, MatTableDataSource, MatTable, MatTableModule } from '@angular/material/table';
|
|
25
|
+
import * as i10 from '@angular/material/progress-spinner';
|
|
26
|
+
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
27
|
+
import * as i3$1 from '@angular/material/card';
|
|
28
|
+
import { MatCardModule } from '@angular/material/card';
|
|
29
|
+
import * as i1$4 from '@angular/material/icon';
|
|
30
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
31
|
+
import * as i2$1 from '@angular/material/input';
|
|
32
|
+
import { MatInputModule } from '@angular/material/input';
|
|
33
|
+
import * as i7 from '@ctrl/ngx-codemirror';
|
|
34
|
+
import { CodemirrorComponent, CodemirrorModule } from '@ctrl/ngx-codemirror';
|
|
35
|
+
import * as i1$3 from '@angular/forms';
|
|
36
|
+
import { NG_VALUE_ACCESSOR, UntypedFormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
37
|
+
import * as i4$1 from '@angular/material/progress-bar';
|
|
38
|
+
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
39
|
+
import * as i3$3 from '@angular/material/datepicker';
|
|
40
|
+
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
41
|
+
import * as i4$3 from 'ngx-mat-datetime-picker-v2';
|
|
42
|
+
import { NgxMatDatetimePickerModule, NgxMatTimepickerComponent, NgxMatNativeDateModule } from 'ngx-mat-datetime-picker-v2';
|
|
43
|
+
import * as i3$2 from '@angular/material/select';
|
|
44
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
45
|
+
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
46
|
+
import prettier from 'node_modules/prettier/esm/standalone.mjs';
|
|
47
|
+
import parserTypescript from 'node_modules/prettier/esm/parser-typescript.mjs';
|
|
48
|
+
import parserBabel from 'node_modules/prettier/esm/parser-babel.mjs';
|
|
49
|
+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
50
|
+
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
51
|
+
import { MatSidenavModule } from '@angular/material/sidenav';
|
|
52
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
53
|
+
import jwt_decode from 'jwt-decode';
|
|
54
|
+
import * as i5 from '@angular/cdk/drag-drop';
|
|
55
|
+
import { DragDropModule } from '@angular/cdk/drag-drop';
|
|
56
|
+
import FileSaver from 'file-saver';
|
|
57
|
+
import JSZip from 'jszip';
|
|
58
|
+
import { TranslateDefaultParser } from '@ngx-translate/core';
|
|
59
|
+
import * as i4$2 from '@angular/material/autocomplete';
|
|
60
|
+
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
61
|
+
import moment from 'moment';
|
|
62
|
+
import { MAT_DATE_LOCALE } from '@angular/material/core';
|
|
63
|
+
import { AngularResizeEventModule } from 'angular-resize-event';
|
|
64
|
+
|
|
65
|
+
const API_SERVER_URL = new InjectionToken('ApiServerUrl.config');
|
|
66
|
+
const GLOWW_APPLI = new InjectionToken('GlowwAppli.config');
|
|
67
|
+
class GlowwService {
|
|
68
|
+
get basePath() {
|
|
69
|
+
return this.InternalBasePath;
|
|
70
|
+
}
|
|
71
|
+
set basePath(value) {
|
|
72
|
+
//alert(`setBasePath ${value}`)
|
|
73
|
+
//if (value.match(/_mgmt(\/|$)/)) {
|
|
74
|
+
const change = this.InternalBasePath != value;
|
|
75
|
+
var oldUrl = this.location.path();
|
|
76
|
+
var newUrl = oldUrl.replace(`/${this.InternalBasePath}/`, `/${value}/`);
|
|
77
|
+
console.log(`GlowwService setBasePath (${this.InternalBasePath},${value}) ${oldUrl} -> ${newUrl}`);
|
|
78
|
+
this.InternalBasePath = value;
|
|
79
|
+
if (change) {
|
|
80
|
+
this.location.go(newUrl);
|
|
81
|
+
this.basePathChange.next(newUrl);
|
|
82
|
+
}
|
|
83
|
+
//} else {
|
|
84
|
+
//console.log(`not mgmt ${value}`);;
|
|
85
|
+
//}
|
|
86
|
+
}
|
|
87
|
+
constructor(_injector) {
|
|
88
|
+
this._injector = _injector;
|
|
89
|
+
this.InternalBasePath = '???';
|
|
90
|
+
this.basePathChange = new Subject();
|
|
91
|
+
this.baseUrl = '/';
|
|
92
|
+
this.location = _injector.get(Location);
|
|
93
|
+
this.http = _injector.get(HttpClient);
|
|
94
|
+
this.platformLocation = _injector.get(PlatformLocation);
|
|
95
|
+
try {
|
|
96
|
+
this.ApiServerUrl = _injector.get(API_SERVER_URL);
|
|
97
|
+
}
|
|
98
|
+
catch { }
|
|
99
|
+
try {
|
|
100
|
+
this.BasePath = _injector.get(GLOWW_APPLI);
|
|
101
|
+
}
|
|
102
|
+
catch { }
|
|
103
|
+
this.BasePath = this.BasePath ?? 'GlowwApi';
|
|
104
|
+
//@Optional() @Inject(API_SERVER_URL) apiServerUrl: string, @Optional() @Inject(GLOWW_APPLI) glowwAppli: string
|
|
105
|
+
this.baseHref = this.platformLocation.getBaseHrefFromDOM();
|
|
106
|
+
this.InternalBasePath = this.BasePath;
|
|
107
|
+
if (this.ApiServerUrl) {
|
|
108
|
+
this.baseUrl = this.ApiServerUrl;
|
|
109
|
+
if (!this.baseUrl.endsWith('/')) {
|
|
110
|
+
this.baseUrl += '/';
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
getParams(obj) {
|
|
115
|
+
let params = new HttpParams();
|
|
116
|
+
if (!obj) {
|
|
117
|
+
return params;
|
|
118
|
+
}
|
|
119
|
+
Object.keys(obj).forEach(p => {
|
|
120
|
+
if (obj[p]) {
|
|
121
|
+
params = params.append(p.toString(), obj[p].toString());
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
return params;
|
|
125
|
+
}
|
|
126
|
+
async noSrc() {
|
|
127
|
+
return await firstValueFrom(this.http.get(`/admin/ORMS/${this.InternalBasePath.replace(/_mgmt/, "")}/noSrc`));
|
|
128
|
+
}
|
|
129
|
+
async noRestSecurity() {
|
|
130
|
+
return await firstValueFrom(this.http.get(`/admin/ORMS/${this.InternalBasePath.replace(/_mgmt/, "")}/noRestSecurity`));
|
|
131
|
+
}
|
|
132
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: GlowwService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
133
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: GlowwService, providedIn: 'root' }); }
|
|
134
|
+
}
|
|
135
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: GlowwService, decorators: [{
|
|
136
|
+
type: Injectable,
|
|
137
|
+
args: [{
|
|
138
|
+
providedIn: 'root'
|
|
139
|
+
}]
|
|
140
|
+
}], ctorParameters: () => [{ type: i0.Injector }] });
|
|
141
|
+
|
|
142
|
+
class VersionCheckService {
|
|
143
|
+
constructor(http) {
|
|
144
|
+
this.http = http;
|
|
145
|
+
// this will be replaced by actual hash post-build.js
|
|
146
|
+
this.currentHash = '{{POST_BUILD_ENTERS_HASH_HERE}}';
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Checks in every set frequency the version of frontend application
|
|
150
|
+
* @param url the url to test (default : /version.json)
|
|
151
|
+
* @param frequency - in milliseconds, defaults to 1 minutes
|
|
152
|
+
* @param callback - function to call when the version is different, default askReloadApplication
|
|
153
|
+
*/
|
|
154
|
+
initVersionCheck(url = '/version.json', frequency = 1000 * 60, callback = this.askReloadApplication) {
|
|
155
|
+
this.callback = callback;
|
|
156
|
+
this.url = url;
|
|
157
|
+
this.checkVersion();
|
|
158
|
+
setInterval(() => {
|
|
159
|
+
this.checkVersion();
|
|
160
|
+
}, frequency);
|
|
161
|
+
}
|
|
162
|
+
askReloadApplication() {
|
|
163
|
+
console.log('askReload');
|
|
164
|
+
// ENTER YOUR CODE TO DO SOMETHING UPON VERSION CHANGE
|
|
165
|
+
if (confirm('Une nouvelle version est disponible sur le serveur. Il est nécessaire de recharger l\'application. Veuillez confirmer le rechargement de l\'application')) {
|
|
166
|
+
this.reloadApplication();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
reloadApplication() {
|
|
170
|
+
console.log('reload');
|
|
171
|
+
let search = location.search;
|
|
172
|
+
if (search) {
|
|
173
|
+
search += '&';
|
|
174
|
+
}
|
|
175
|
+
search += '___t=' + new Date().getTime();
|
|
176
|
+
console.log(`Search ${search}`);
|
|
177
|
+
location.search = search;
|
|
178
|
+
}
|
|
179
|
+
checkVersion() {
|
|
180
|
+
// timestamp these requests to invalidate caches
|
|
181
|
+
this.http.get(this.url + '?t=' + new Date().getTime())
|
|
182
|
+
// .first()
|
|
183
|
+
.subscribe((response) => {
|
|
184
|
+
console.log('get version ok');
|
|
185
|
+
const hash = response.hash;
|
|
186
|
+
const hashChanged = this.hasHashChanged(this.currentHash, hash);
|
|
187
|
+
console.log(`HASH : Current : ${this.currentHash}, New : ${hash}, Changed ${hashChanged}`);
|
|
188
|
+
// If new version, do something
|
|
189
|
+
if (hashChanged) {
|
|
190
|
+
this.callback();
|
|
191
|
+
}
|
|
192
|
+
// store the new hash so we wouldn't trigger versionChange again
|
|
193
|
+
// only necessary in case you did not force refresh
|
|
194
|
+
this.currentHash = hash;
|
|
195
|
+
}, (err) => {
|
|
196
|
+
console.error(err, 'Could not get version');
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Checks if hash has changed.
|
|
201
|
+
* This file has the JS hash, if it is a different one than in the version.json
|
|
202
|
+
* we are dealing with version change
|
|
203
|
+
* @param currentHash currenthash
|
|
204
|
+
* @param newHash newhash
|
|
205
|
+
* @returns the currenthash and newhash are different
|
|
206
|
+
*/
|
|
207
|
+
hasHashChanged(currentHash, newHash) {
|
|
208
|
+
return currentHash !== newHash;
|
|
209
|
+
}
|
|
210
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: VersionCheckService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
211
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: VersionCheckService, providedIn: 'root' }); }
|
|
212
|
+
}
|
|
213
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: VersionCheckService, decorators: [{
|
|
214
|
+
type: Injectable,
|
|
215
|
+
args: [{
|
|
216
|
+
providedIn: 'root'
|
|
217
|
+
}]
|
|
218
|
+
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
|
219
|
+
|
|
220
|
+
class RouteDirective {
|
|
221
|
+
constructor(el, router) {
|
|
222
|
+
this.el = el;
|
|
223
|
+
this.router = router;
|
|
224
|
+
}
|
|
225
|
+
onClick($event) {
|
|
226
|
+
console.info('clicked: ' + $event.getAttribute('data-link'));
|
|
227
|
+
if (this.dlg) {
|
|
228
|
+
this.dlg.close(true);
|
|
229
|
+
}
|
|
230
|
+
var goRoute = $event.getAttribute('data-link');
|
|
231
|
+
this.router.navigate([goRoute]);
|
|
232
|
+
}
|
|
233
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: RouteDirective, deps: [{ token: i0.ElementRef }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
234
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.17", type: RouteDirective, isStandalone: false, selector: "[glowwRoute]", inputs: { dlg: "dlg" }, host: { listeners: { "click": "onClick($event.target)" } }, ngImport: i0 }); }
|
|
235
|
+
}
|
|
236
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: RouteDirective, decorators: [{
|
|
237
|
+
type: Directive,
|
|
238
|
+
args: [{
|
|
239
|
+
selector: '[glowwRoute]',
|
|
240
|
+
standalone: false
|
|
241
|
+
}]
|
|
242
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i2.Router }], propDecorators: { dlg: [{
|
|
243
|
+
type: Input
|
|
244
|
+
}], onClick: [{
|
|
245
|
+
type: HostListener,
|
|
246
|
+
args: ['click', ['$event.target']]
|
|
247
|
+
}] } });
|
|
248
|
+
|
|
249
|
+
class SafeHtmlPipe {
|
|
250
|
+
constructor(sanitizer) {
|
|
251
|
+
this.sanitizer = sanitizer;
|
|
252
|
+
}
|
|
253
|
+
transform(style) {
|
|
254
|
+
return this.sanitizer.bypassSecurityTrustHtml(style);
|
|
255
|
+
// return this.sanitizer.bypassSecurityTrustStyle(style);
|
|
256
|
+
// return this.sanitizer.bypassSecurityTrustXxx(style); - see docs
|
|
257
|
+
}
|
|
258
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: SafeHtmlPipe, deps: [{ token: i1$1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
259
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.17", ngImport: i0, type: SafeHtmlPipe, isStandalone: false, name: "safeHtml" }); }
|
|
260
|
+
}
|
|
261
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: SafeHtmlPipe, decorators: [{
|
|
262
|
+
type: Pipe,
|
|
263
|
+
args: [{
|
|
264
|
+
name: 'safeHtml',
|
|
265
|
+
standalone: false
|
|
266
|
+
}]
|
|
267
|
+
}], ctorParameters: () => [{ type: i1$1.DomSanitizer }] });
|
|
268
|
+
|
|
269
|
+
class ConfirmationComponent {
|
|
270
|
+
constructor(dialogRef, data) {
|
|
271
|
+
this.dialogRef = dialogRef;
|
|
272
|
+
this.data = data;
|
|
273
|
+
// Update view with given values
|
|
274
|
+
this.title = data.title;
|
|
275
|
+
this.message = data.message;
|
|
276
|
+
this.mode = data.mode ?? 'confirmation';
|
|
277
|
+
}
|
|
278
|
+
onConfirm() {
|
|
279
|
+
// Close the dialog, return true
|
|
280
|
+
this.dialogRef.close(true);
|
|
281
|
+
}
|
|
282
|
+
onDismiss() {
|
|
283
|
+
// Close the dialog, return false
|
|
284
|
+
this.dialogRef.close(false);
|
|
285
|
+
}
|
|
286
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: ConfirmationComponent, deps: [{ token: i1$2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
287
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.17", type: ConfirmationComponent, isStandalone: false, selector: "glw-confirmation", ngImport: i0, template: "<h1 mat-dialog-title>\n {{title}}\n</h1>\n\n<div mat-dialog-content>\n <p [innerHTML]=\"message | safeHtml\" glowwRoute [dlg]=\"dialogRef\"></p>\n</div>\n\n@if (mode==='confirmation') {\n <mat-dialog-actions>\n <button mat-button (click)=\"onDismiss()\">No</button>\n <button mat-raised-button color=\"primary\" (click)=\"onConfirm()\">Yes</button>\n </mat-dialog-actions>\n}\n@if (mode==='alert') {\n <mat-dialog-actions>\n <button mat-raised-button color=\"primary\" (click)=\"onConfirm()\">OK</button>\n </mat-dialog-actions>\n}", styles: [""], dependencies: [{ kind: "directive", type: i1$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i4.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: RouteDirective, selector: "[glowwRoute]", inputs: ["dlg"] }, { kind: "pipe", type: SafeHtmlPipe, name: "safeHtml" }] }); }
|
|
288
|
+
}
|
|
289
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: ConfirmationComponent, decorators: [{
|
|
290
|
+
type: Component,
|
|
291
|
+
args: [{ selector: 'glw-confirmation', standalone: false, template: "<h1 mat-dialog-title>\n {{title}}\n</h1>\n\n<div mat-dialog-content>\n <p [innerHTML]=\"message | safeHtml\" glowwRoute [dlg]=\"dialogRef\"></p>\n</div>\n\n@if (mode==='confirmation') {\n <mat-dialog-actions>\n <button mat-button (click)=\"onDismiss()\">No</button>\n <button mat-raised-button color=\"primary\" (click)=\"onConfirm()\">Yes</button>\n </mat-dialog-actions>\n}\n@if (mode==='alert') {\n <mat-dialog-actions>\n <button mat-raised-button color=\"primary\" (click)=\"onConfirm()\">OK</button>\n </mat-dialog-actions>\n}" }]
|
|
292
|
+
}], ctorParameters: () => [{ type: i1$2.MatDialogRef }, { type: ConfirmationModel, decorators: [{
|
|
293
|
+
type: Inject,
|
|
294
|
+
args: [MAT_DIALOG_DATA]
|
|
295
|
+
}] }] });
|
|
296
|
+
// tslint:disable-next-line: max-classes-per-file
|
|
297
|
+
class ConfirmationModel {
|
|
298
|
+
constructor(title, message, mode) {
|
|
299
|
+
this.title = title;
|
|
300
|
+
this.message = message;
|
|
301
|
+
this.mode = mode;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
class DialogService {
|
|
306
|
+
constructor(dialog) {
|
|
307
|
+
this.dialog = dialog;
|
|
308
|
+
}
|
|
309
|
+
createConfirmationDialog(title, message, mode) {
|
|
310
|
+
const dialogData = new ConfirmationModel(title, message, mode);
|
|
311
|
+
return this.dialog.open(ConfirmationComponent, {
|
|
312
|
+
maxWidth: '80%',
|
|
313
|
+
data: dialogData,
|
|
314
|
+
disableClose: true
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
openConfirmationDialog(title, message, mode) {
|
|
318
|
+
return this.createConfirmationDialog(title, message, mode).afterClosed();
|
|
319
|
+
}
|
|
320
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: DialogService, deps: [{ token: i1$2.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
321
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: DialogService, providedIn: 'root' }); }
|
|
322
|
+
}
|
|
323
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: DialogService, decorators: [{
|
|
324
|
+
type: Injectable,
|
|
325
|
+
args: [{
|
|
326
|
+
providedIn: 'root'
|
|
327
|
+
}]
|
|
328
|
+
}], ctorParameters: () => [{ type: i1$2.MatDialog }] });
|
|
329
|
+
|
|
330
|
+
class NavService {
|
|
331
|
+
constructor(router) {
|
|
332
|
+
this.router = router;
|
|
333
|
+
this.currentUrl = new BehaviorSubject(undefined);
|
|
334
|
+
this.router.events.subscribe((event) => {
|
|
335
|
+
if (event instanceof NavigationEnd) {
|
|
336
|
+
this.currentUrl.next(event.urlAfterRedirects);
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
closeNav() {
|
|
341
|
+
this.appDrawer.close();
|
|
342
|
+
}
|
|
343
|
+
openNav() {
|
|
344
|
+
this.appDrawer.open();
|
|
345
|
+
}
|
|
346
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: NavService, deps: [{ token: i2.Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
347
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: NavService }); }
|
|
348
|
+
}
|
|
349
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: NavService, decorators: [{
|
|
350
|
+
type: Injectable
|
|
351
|
+
}], ctorParameters: () => [{ type: i2.Router }] });
|
|
352
|
+
|
|
353
|
+
class VoiceRecognitionService {
|
|
354
|
+
constructor() {
|
|
355
|
+
this.recognition = new webkitSpeechRecognition();
|
|
356
|
+
this.isStoppedSpeechRecog = false;
|
|
357
|
+
this.text = '';
|
|
358
|
+
}
|
|
359
|
+
init() {
|
|
360
|
+
this.recognition.interimResults = true;
|
|
361
|
+
this.recognition.lang = 'fr-be';
|
|
362
|
+
this.recognition.addEventListener('result', (e) => {
|
|
363
|
+
const transcript = Array.from(e.results)
|
|
364
|
+
.map((result) => result[0])
|
|
365
|
+
.map((result) => result.transcript)
|
|
366
|
+
.join('');
|
|
367
|
+
this.tempWords = transcript;
|
|
368
|
+
console.log(transcript);
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
start() {
|
|
372
|
+
this.isStoppedSpeechRecog = false;
|
|
373
|
+
this.recognition.start();
|
|
374
|
+
console.log("Speech recognition started");
|
|
375
|
+
this.recognition.addEventListener('end', (condition) => {
|
|
376
|
+
if (this.isStoppedSpeechRecog) {
|
|
377
|
+
this.recognition.stop();
|
|
378
|
+
console.log("End speech recognition");
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
this.wordConcat();
|
|
382
|
+
this.recognition.start();
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
stop() {
|
|
387
|
+
this.isStoppedSpeechRecog = true;
|
|
388
|
+
this.wordConcat();
|
|
389
|
+
this.recognition.stop();
|
|
390
|
+
console.log("End speech recognition");
|
|
391
|
+
}
|
|
392
|
+
wordConcat() {
|
|
393
|
+
this.text = this.text + ' ' + this.tempWords + '.';
|
|
394
|
+
this.tempWords = '';
|
|
395
|
+
}
|
|
396
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: VoiceRecognitionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
397
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: VoiceRecognitionService, providedIn: 'root' }); }
|
|
398
|
+
}
|
|
399
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: VoiceRecognitionService, decorators: [{
|
|
400
|
+
type: Injectable,
|
|
401
|
+
args: [{
|
|
402
|
+
providedIn: 'root'
|
|
403
|
+
}]
|
|
404
|
+
}], ctorParameters: () => [] });
|
|
405
|
+
|
|
406
|
+
class SecureImgComponent {
|
|
407
|
+
ngOnChanges() {
|
|
408
|
+
this.src$.next(this.src);
|
|
409
|
+
}
|
|
410
|
+
// we need HttpClient to load the image
|
|
411
|
+
constructor(httpClient, domSanitizer) {
|
|
412
|
+
this.httpClient = httpClient;
|
|
413
|
+
this.domSanitizer = domSanitizer;
|
|
414
|
+
this.src$ = new BehaviorSubject(this.src);
|
|
415
|
+
// this stream will contain the actual url that our img tag will load
|
|
416
|
+
// everytime the src changes, the previous call would be canceled and the
|
|
417
|
+
// new resource would be loaded
|
|
418
|
+
this.dataUrl$ = this.src$.pipe(switchMap(url => this.loadImage(url)));
|
|
419
|
+
}
|
|
420
|
+
loadImage(url) {
|
|
421
|
+
return this.httpClient
|
|
422
|
+
// load the image as a blob
|
|
423
|
+
.get(url, { responseType: 'blob' })
|
|
424
|
+
// create an object url of that blob that we can use in the src attribute
|
|
425
|
+
.pipe(map(e => this.domSanitizer.bypassSecurityTrustUrl(URL.createObjectURL(e))));
|
|
426
|
+
}
|
|
427
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: SecureImgComponent, deps: [{ token: i1.HttpClient }, { token: i1$1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
428
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.17", type: SecureImgComponent, isStandalone: false, selector: "secure-img", inputs: { src: "src" }, usesOnChanges: true, ngImport: i0, template: `
|
|
429
|
+
<img [src]="dataUrl$ | async" style="object-fit: contain;"/>
|
|
430
|
+
`, isInline: true, dependencies: [{ kind: "pipe", type: i3.AsyncPipe, name: "async" }] }); }
|
|
431
|
+
}
|
|
432
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: SecureImgComponent, decorators: [{
|
|
433
|
+
type: Component,
|
|
434
|
+
args: [{
|
|
435
|
+
selector: 'secure-img',
|
|
436
|
+
template: `
|
|
437
|
+
<img [src]="dataUrl$ | async" style="object-fit: contain;"/>
|
|
438
|
+
`,
|
|
439
|
+
standalone: false
|
|
440
|
+
}]
|
|
441
|
+
}], ctorParameters: () => [{ type: i1.HttpClient }, { type: i1$1.DomSanitizer }], propDecorators: { src: [{
|
|
442
|
+
type: Input
|
|
443
|
+
}] } });
|
|
444
|
+
|
|
445
|
+
class FileSinkDirective {
|
|
446
|
+
constructor() {
|
|
447
|
+
this.fileDropped = new EventEmitter();
|
|
448
|
+
}
|
|
449
|
+
// Dragover listener
|
|
450
|
+
onDragOver(evt) {
|
|
451
|
+
evt.preventDefault();
|
|
452
|
+
evt.stopPropagation();
|
|
453
|
+
this.fileOver = true;
|
|
454
|
+
}
|
|
455
|
+
// Dragleave listener
|
|
456
|
+
onDragLeave(evt) {
|
|
457
|
+
evt.preventDefault();
|
|
458
|
+
evt.stopPropagation();
|
|
459
|
+
this.fileOver = false;
|
|
460
|
+
}
|
|
461
|
+
// Drop listener
|
|
462
|
+
ondrop(evt) {
|
|
463
|
+
evt.preventDefault();
|
|
464
|
+
evt.stopPropagation();
|
|
465
|
+
this.fileOver = false;
|
|
466
|
+
let files = evt.dataTransfer.files;
|
|
467
|
+
if (files.length > 0) {
|
|
468
|
+
this.fileDropped.emit(files);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: FileSinkDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
472
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.17", type: FileSinkDirective, isStandalone: false, selector: "[glowwFileSink]", outputs: { fileDropped: "fileDropped" }, host: { listeners: { "dragover": "onDragOver($event)", "dragleave": "onDragLeave($event)", "drop": "ondrop($event)" }, properties: { "class.fileover": "this.fileOver" } }, ngImport: i0 }); }
|
|
473
|
+
}
|
|
474
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: FileSinkDirective, decorators: [{
|
|
475
|
+
type: Directive,
|
|
476
|
+
args: [{
|
|
477
|
+
selector: '[glowwFileSink]',
|
|
478
|
+
standalone: false
|
|
479
|
+
}]
|
|
480
|
+
}], propDecorators: { fileOver: [{
|
|
481
|
+
type: HostBinding,
|
|
482
|
+
args: ['class.fileover']
|
|
483
|
+
}], fileDropped: [{
|
|
484
|
+
type: Output
|
|
485
|
+
}], onDragOver: [{
|
|
486
|
+
type: HostListener,
|
|
487
|
+
args: ['dragover', ['$event']]
|
|
488
|
+
}], onDragLeave: [{
|
|
489
|
+
type: HostListener,
|
|
490
|
+
args: ['dragleave', ['$event']]
|
|
491
|
+
}], ondrop: [{
|
|
492
|
+
type: HostListener,
|
|
493
|
+
args: ['drop', ['$event']]
|
|
494
|
+
}] } });
|
|
495
|
+
|
|
496
|
+
class UploadFileComponent {
|
|
497
|
+
constructor() {
|
|
498
|
+
this.multiple = false;
|
|
499
|
+
this.allowAltFileName = false;
|
|
500
|
+
this.acceptMime = '*/*';
|
|
501
|
+
this.onChange = () => { };
|
|
502
|
+
this.onTouched = () => { };
|
|
503
|
+
this.files = [];
|
|
504
|
+
}
|
|
505
|
+
ngAfterViewInit() {
|
|
506
|
+
const fileUpload = this.fileUpload.nativeElement;
|
|
507
|
+
fileUpload.onchange = () => {
|
|
508
|
+
if (!this.multiple || !this.files) {
|
|
509
|
+
this.files = [];
|
|
510
|
+
}
|
|
511
|
+
for (const file of fileUpload.files) {
|
|
512
|
+
this.files.push({ data: file, inProgress: false, progress: 0, fileName: file.name, size: file.size, altFileName: '', status: '' });
|
|
513
|
+
//if (this.allowAltFileName) { this.fileNames.push(this.FileName(file.name)); }
|
|
514
|
+
}
|
|
515
|
+
this.onChange(this.files);
|
|
516
|
+
this.onTouched();
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
get value() {
|
|
520
|
+
return this.files;
|
|
521
|
+
//return this._value;
|
|
522
|
+
}
|
|
523
|
+
set value(val) {
|
|
524
|
+
this.files = val;
|
|
525
|
+
this.onChange(val);
|
|
526
|
+
this.onTouched();
|
|
527
|
+
}
|
|
528
|
+
writeValue(obj) {
|
|
529
|
+
this.value = obj;
|
|
530
|
+
}
|
|
531
|
+
registerOnChange(fn) {
|
|
532
|
+
this.onChange = fn;
|
|
533
|
+
}
|
|
534
|
+
registerOnTouched(fn) {
|
|
535
|
+
this.onTouched = fn;
|
|
536
|
+
}
|
|
537
|
+
setDisabledState(isDisabled) {
|
|
538
|
+
//throw new Error('Method not implemented.');
|
|
539
|
+
}
|
|
540
|
+
SelectFiles() {
|
|
541
|
+
if (this.files && this.files.length > 0 && !this.multiple) {
|
|
542
|
+
if (confirm("Do you want to replace current file ?")) {
|
|
543
|
+
this.files = [];
|
|
544
|
+
}
|
|
545
|
+
else {
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
this.fileUpload.nativeElement.click();
|
|
550
|
+
}
|
|
551
|
+
ChangeAltName(i, $event) {
|
|
552
|
+
this.files[i].altFileName = $event.target.value;
|
|
553
|
+
this.onChange(this.files);
|
|
554
|
+
this.onTouched();
|
|
555
|
+
}
|
|
556
|
+
onFileDropped($event) {
|
|
557
|
+
this.prepareFilesList($event);
|
|
558
|
+
}
|
|
559
|
+
prepareFilesList(files) {
|
|
560
|
+
if (files.length > 1 && !this.multiple) {
|
|
561
|
+
alert("You can only drop an only file at once");
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
if (this.files && this.files.length > 0 && !this.multiple) {
|
|
565
|
+
if (confirm("Do you want to replace current file ?")) {
|
|
566
|
+
this.files = [];
|
|
567
|
+
}
|
|
568
|
+
else {
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
if (!this.files)
|
|
573
|
+
this.files = [];
|
|
574
|
+
for (const file of files) {
|
|
575
|
+
this.files.push({ data: file, inProgress: false, progress: 0, fileName: file.name, size: file.size, altFileName: '', status: '' });
|
|
576
|
+
}
|
|
577
|
+
this.onChange(this.files);
|
|
578
|
+
this.onTouched();
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* format bytes
|
|
582
|
+
* @param bytes (File size in bytes)
|
|
583
|
+
* @param decimals (Decimals point)
|
|
584
|
+
*/
|
|
585
|
+
formatBytes(bytes, decimals = 2) {
|
|
586
|
+
if (bytes === 0) {
|
|
587
|
+
return "0 Bytes";
|
|
588
|
+
}
|
|
589
|
+
const k = 1024;
|
|
590
|
+
const dm = decimals <= 0 ? 0 : decimals;
|
|
591
|
+
const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
|
|
592
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
593
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
|
|
594
|
+
}
|
|
595
|
+
deleteFile(index) {
|
|
596
|
+
if (this.files[index].progress && this.files[index].progress < 100) {
|
|
597
|
+
console.log("Upload in progress.");
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
this.files.splice(index, 1);
|
|
601
|
+
this.onChange(this.files);
|
|
602
|
+
this.onTouched();
|
|
603
|
+
}
|
|
604
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: UploadFileComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
605
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.17", type: UploadFileComponent, isStandalone: false, selector: "gloww-upload-file", inputs: { multiple: "multiple", allowAltFileName: "allowAltFileName", acceptMime: "acceptMime" }, providers: [
|
|
606
|
+
{
|
|
607
|
+
provide: NG_VALUE_ACCESSOR,
|
|
608
|
+
multi: true,
|
|
609
|
+
useExisting: UploadFileComponent
|
|
610
|
+
}
|
|
611
|
+
], viewQueries: [{ propertyName: "fileUpload", first: true, predicate: ["fileUpload"], descendants: true }], ngImport: i0, template: "<mat-card appearance=\"outlined\" glowwFileSink (fileDropped)=\"onFileDropped($event)\" style=\"height:calc(100% - 40px)\">\n <mat-card-content style=\"min-height:100px;height:calc(100% - 60px)\">\n @if (files && files.length) {\n <div class=\"files-list\" style=\"height:calc(100% - 60px)\">\n @for (file of files; track file; let i = $index) {\n <div class=\"single-file\" [ngClass]=\"file.status\">\n <i class=\"fa-thin fa-file fa-lg\"></i>\n <div class=\"info\">\n <h4 class=\"name\">\n {{ file?.fileName }}\n </h4>\n <p class=\"size\">\n {{ formatBytes(file?.size) }}\n </p>\n <mat-progress-bar [value]=\"file.progress\"></mat-progress-bar>\n </div>\n <i class=\"fa-thin fa-trash fa-lg\" (click)=\"deleteFile(i)\"></i>\n </div>\n }\n </div>\n }\n @if (!files || !files.length) {\n <div style=\"height:calc(100% - 60px)\">No file(s) selected</div>\n }\n <input type=\"file\" #fileUpload id=\"fileUpload\" name=\"fileUpload\" [accept]=\"acceptMime\" style=\"display:none;\" [multiple]=\"multiple\" />\n </mat-card-content>\n <mat-card-actions style=\"text-align:center\">\n <button mat-raised-button color=\"accent\" (click)=\"SelectFiles()\">\n <i class=\"fal fa-file-upload\"></i> @if (!multiple) {\n <span>Select file or Drop a file</span>\n }\n @if (multiple) {\n <span>Select file(s) or drop file(s)</span>\n }\n </button>\n</mat-card-actions>\n</mat-card>", styles: ["ul{list-style:none;padding-left:0}ul li{padding-bottom:10px}.fileover{animation:shake 1s;animation-iteration-count:infinite}.files-list{margin-top:1.5rem}.files-list .single-file{display:flex;padding:.5rem;justify-content:space-between;align-items:center;border:dashed 1px #979797;margin-bottom:1rem;flex-grow:1}.files-list .single-file img.delete{margin-left:.5rem;cursor:pointer;align-self:flex-end}.files-list .single-file .name{font-size:14px;font-weight:500;color:#353f4a;margin:0}.files-list .single-file .size{font-size:12px;font-weight:500;color:#a4a4a4;margin:0;margin-bottom:.25rem}.files-list .single-file .info{width:100%}.Done{background-color:green}.Error{background-color:red}@keyframes shake{0%{transform:translate(1px,1px) rotate(0)}10%{transform:translate(-1px,-2px) rotate(-1deg)}20%{transform:translate(-3px) rotate(1deg)}30%{transform:translate(3px,2px) rotate(0)}40%{transform:translate(1px,-1px) rotate(1deg)}50%{transform:translate(-1px,2px) rotate(-1deg)}60%{transform:translate(-3px,1px) rotate(0)}70%{transform:translate(3px,1px) rotate(-1deg)}80%{transform:translate(-1px,-1px) rotate(1deg)}90%{transform:translate(1px,2px) rotate(0)}to{transform:translate(1px,-2px) rotate(-1deg)}}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: i4.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i3$1.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i3$1.MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { kind: "directive", type: i3$1.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: i4$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "directive", type: FileSinkDirective, selector: "[glowwFileSink]", outputs: ["fileDropped"] }] }); }
|
|
612
|
+
}
|
|
613
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: UploadFileComponent, decorators: [{
|
|
614
|
+
type: Component,
|
|
615
|
+
args: [{ selector: 'gloww-upload-file', providers: [
|
|
616
|
+
{
|
|
617
|
+
provide: NG_VALUE_ACCESSOR,
|
|
618
|
+
multi: true,
|
|
619
|
+
useExisting: UploadFileComponent
|
|
620
|
+
}
|
|
621
|
+
], standalone: false, template: "<mat-card appearance=\"outlined\" glowwFileSink (fileDropped)=\"onFileDropped($event)\" style=\"height:calc(100% - 40px)\">\n <mat-card-content style=\"min-height:100px;height:calc(100% - 60px)\">\n @if (files && files.length) {\n <div class=\"files-list\" style=\"height:calc(100% - 60px)\">\n @for (file of files; track file; let i = $index) {\n <div class=\"single-file\" [ngClass]=\"file.status\">\n <i class=\"fa-thin fa-file fa-lg\"></i>\n <div class=\"info\">\n <h4 class=\"name\">\n {{ file?.fileName }}\n </h4>\n <p class=\"size\">\n {{ formatBytes(file?.size) }}\n </p>\n <mat-progress-bar [value]=\"file.progress\"></mat-progress-bar>\n </div>\n <i class=\"fa-thin fa-trash fa-lg\" (click)=\"deleteFile(i)\"></i>\n </div>\n }\n </div>\n }\n @if (!files || !files.length) {\n <div style=\"height:calc(100% - 60px)\">No file(s) selected</div>\n }\n <input type=\"file\" #fileUpload id=\"fileUpload\" name=\"fileUpload\" [accept]=\"acceptMime\" style=\"display:none;\" [multiple]=\"multiple\" />\n </mat-card-content>\n <mat-card-actions style=\"text-align:center\">\n <button mat-raised-button color=\"accent\" (click)=\"SelectFiles()\">\n <i class=\"fal fa-file-upload\"></i> @if (!multiple) {\n <span>Select file or Drop a file</span>\n }\n @if (multiple) {\n <span>Select file(s) or drop file(s)</span>\n }\n </button>\n</mat-card-actions>\n</mat-card>", styles: ["ul{list-style:none;padding-left:0}ul li{padding-bottom:10px}.fileover{animation:shake 1s;animation-iteration-count:infinite}.files-list{margin-top:1.5rem}.files-list .single-file{display:flex;padding:.5rem;justify-content:space-between;align-items:center;border:dashed 1px #979797;margin-bottom:1rem;flex-grow:1}.files-list .single-file img.delete{margin-left:.5rem;cursor:pointer;align-self:flex-end}.files-list .single-file .name{font-size:14px;font-weight:500;color:#353f4a;margin:0}.files-list .single-file .size{font-size:12px;font-weight:500;color:#a4a4a4;margin:0;margin-bottom:.25rem}.files-list .single-file .info{width:100%}.Done{background-color:green}.Error{background-color:red}@keyframes shake{0%{transform:translate(1px,1px) rotate(0)}10%{transform:translate(-1px,-2px) rotate(-1deg)}20%{transform:translate(-3px) rotate(1deg)}30%{transform:translate(3px,2px) rotate(0)}40%{transform:translate(1px,-1px) rotate(1deg)}50%{transform:translate(-1px,2px) rotate(-1deg)}60%{transform:translate(-3px,1px) rotate(0)}70%{transform:translate(3px,1px) rotate(-1deg)}80%{transform:translate(-1px,-1px) rotate(1deg)}90%{transform:translate(1px,2px) rotate(0)}to{transform:translate(1px,-2px) rotate(-1deg)}}\n"] }]
|
|
622
|
+
}], ctorParameters: () => [], propDecorators: { fileUpload: [{
|
|
623
|
+
type: ViewChild,
|
|
624
|
+
args: ['fileUpload']
|
|
625
|
+
}], multiple: [{
|
|
626
|
+
type: Input
|
|
627
|
+
}], allowAltFileName: [{
|
|
628
|
+
type: Input
|
|
629
|
+
}], acceptMime: [{
|
|
630
|
+
type: Input
|
|
631
|
+
}] } });
|
|
632
|
+
|
|
633
|
+
class UploadDocComponent {
|
|
634
|
+
constructor(dialogRef, data, formBuilder) {
|
|
635
|
+
this.dialogRef = dialogRef;
|
|
636
|
+
this.data = data;
|
|
637
|
+
this.formBuilder = formBuilder;
|
|
638
|
+
this.multiple = false;
|
|
639
|
+
this.allowAltFileName = false;
|
|
640
|
+
this.acceptMime = '*/*';
|
|
641
|
+
this.files = [];
|
|
642
|
+
if (data && data.acceptMime) {
|
|
643
|
+
this.acceptMime = data.acceptMime;
|
|
644
|
+
}
|
|
645
|
+
if (data && data.multiple) {
|
|
646
|
+
this.multiple = data.multiple;
|
|
647
|
+
}
|
|
648
|
+
if (data && data.allowAltFileName) {
|
|
649
|
+
this.allowAltFileName = data.allowAltFileName;
|
|
650
|
+
}
|
|
651
|
+
if (data && data.callback) {
|
|
652
|
+
this.callback = data.callback;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
/*
|
|
656
|
+
get fileNames(): FormArray {
|
|
657
|
+
return this.form.get("fileNames") as FormArray
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
FileName(fn: string): FormGroup {
|
|
661
|
+
return this.formBuilder.group({
|
|
662
|
+
fileName: fn
|
|
663
|
+
})
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
ngOnInit() {
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
onClick() {
|
|
670
|
+
const fileUpload = this.fileUpload.nativeElement; fileUpload.onchange = () => {
|
|
671
|
+
if (this.multiple) {
|
|
672
|
+
this.files = [];
|
|
673
|
+
if (this.allowAltFileName) { this.fileNames.clear(); }
|
|
674
|
+
}
|
|
675
|
+
for (const file of fileUpload.files) {
|
|
676
|
+
this.files.push({ data: file, inProgress: false, progress: 0, fileName: file.name });
|
|
677
|
+
if (this.allowAltFileName) { this.fileNames.push(this.FileName(file.name)); }
|
|
678
|
+
}
|
|
679
|
+
};
|
|
680
|
+
fileUpload.click();
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
private uploadFiles() {
|
|
684
|
+
this.fileUpload.nativeElement.value = '';
|
|
685
|
+
this.files.forEach(file => {
|
|
686
|
+
alert('upload file');
|
|
687
|
+
// this.uploadFile(file);
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
*/
|
|
691
|
+
cancel() {
|
|
692
|
+
this.dialogRef.close();
|
|
693
|
+
}
|
|
694
|
+
save() {
|
|
695
|
+
console.log("save UploadDoc");
|
|
696
|
+
console.log(`this.files.length ${this.files.length}`);
|
|
697
|
+
/*if (this.allowAltFileName) {
|
|
698
|
+
for (let i = 0; i < this.files.length; i++) {
|
|
699
|
+
// Comment to be sure new version
|
|
700
|
+
this.files[i].name = this.fileNames.value[i].fileName;
|
|
701
|
+
}
|
|
702
|
+
}*/
|
|
703
|
+
if (this.callback) {
|
|
704
|
+
this.callback(this.files).subscribe(res => this.dialogRef.close(this.files));
|
|
705
|
+
}
|
|
706
|
+
else {
|
|
707
|
+
this.dialogRef.close(this.files);
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: UploadDocComponent, deps: [{ token: i1$2.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: i1$3.UntypedFormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
711
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.17", type: UploadDocComponent, isStandalone: false, selector: "gloww-upload-doc", ngImport: i0, template: "<h2 mat-dialog-title>\r\n Association d'un nouveau document</h2>\r\n\r\n<mat-dialog-content>\r\n\r\n <gloww-upload-file [(ngModel)]=\"files\" [acceptMime]=\"acceptMime\" [multiple]=\"multiple\" [allowAltFileName]=\"allowAltFileName\"></gloww-upload-file>\r\n\r\n</mat-dialog-content>\r\n<mat-dialog-actions>\r\n <button mat-raised-button (click)=\"cancel()\">Close</button>\r\n <button mat-raised-button color=\"primary\" (click)=\"save()\">Save</button>\r\n</mat-dialog-actions>\r\n", styles: ["ul{list-style:\"none\";padding-left:0}ul li{padding-bottom:10px}\n"], dependencies: [{ kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i4.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: UploadFileComponent, selector: "gloww-upload-file", inputs: ["multiple", "allowAltFileName", "acceptMime"] }] }); }
|
|
712
|
+
}
|
|
713
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: UploadDocComponent, decorators: [{
|
|
714
|
+
type: Component,
|
|
715
|
+
args: [{ selector: 'gloww-upload-doc', standalone: false, template: "<h2 mat-dialog-title>\r\n Association d'un nouveau document</h2>\r\n\r\n<mat-dialog-content>\r\n\r\n <gloww-upload-file [(ngModel)]=\"files\" [acceptMime]=\"acceptMime\" [multiple]=\"multiple\" [allowAltFileName]=\"allowAltFileName\"></gloww-upload-file>\r\n\r\n</mat-dialog-content>\r\n<mat-dialog-actions>\r\n <button mat-raised-button (click)=\"cancel()\">Close</button>\r\n <button mat-raised-button color=\"primary\" (click)=\"save()\">Save</button>\r\n</mat-dialog-actions>\r\n", styles: ["ul{list-style:\"none\";padding-left:0}ul li{padding-bottom:10px}\n"] }]
|
|
716
|
+
}], ctorParameters: () => [{ type: i1$2.MatDialogRef }, { type: undefined, decorators: [{
|
|
717
|
+
type: Inject,
|
|
718
|
+
args: [MAT_DIALOG_DATA]
|
|
719
|
+
}] }, { type: i1$3.UntypedFormBuilder }] });
|
|
720
|
+
|
|
721
|
+
class SearchFormComponent {
|
|
722
|
+
constructor() { }
|
|
723
|
+
ngOnInit() {
|
|
724
|
+
}
|
|
725
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: SearchFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
726
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.17", type: SearchFormComponent, isStandalone: false, selector: "glw-search-form", ngImport: i0, template: "<ng-content></ng-content>", styles: [""] }); }
|
|
727
|
+
}
|
|
728
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: SearchFormComponent, decorators: [{
|
|
729
|
+
type: Component,
|
|
730
|
+
args: [{ selector: 'glw-search-form', standalone: false, template: "<ng-content></ng-content>" }]
|
|
731
|
+
}], ctorParameters: () => [] });
|
|
732
|
+
|
|
733
|
+
class HeaderComponent {
|
|
734
|
+
constructor() { }
|
|
735
|
+
ngOnInit() {
|
|
736
|
+
}
|
|
737
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: HeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
738
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.17", type: HeaderComponent, isStandalone: false, selector: "glw-header", ngImport: i0, template: "<ng-content></ng-content>", styles: [""] }); }
|
|
739
|
+
}
|
|
740
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: HeaderComponent, decorators: [{
|
|
741
|
+
type: Component,
|
|
742
|
+
args: [{ selector: 'glw-header', standalone: false, template: "<ng-content></ng-content>" }]
|
|
743
|
+
}], ctorParameters: () => [] });
|
|
744
|
+
|
|
745
|
+
class ResultTableComponent {
|
|
746
|
+
constructor() { }
|
|
747
|
+
ngAfterContentInit() {
|
|
748
|
+
console.log(this.columnDefs.length);
|
|
749
|
+
}
|
|
750
|
+
ngOnInit() {
|
|
751
|
+
}
|
|
752
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: ResultTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
753
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.17", type: ResultTableComponent, isStandalone: false, selector: "glw-result-table", queries: [{ propertyName: "columnDefs", predicate: MatColumnDef }], ngImport: i0, template: "<ng-content></ng-content>", styles: [""] }); }
|
|
754
|
+
}
|
|
755
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: ResultTableComponent, decorators: [{
|
|
756
|
+
type: Component,
|
|
757
|
+
args: [{ selector: 'glw-result-table', standalone: false, template: "<ng-content></ng-content>" }]
|
|
758
|
+
}], ctorParameters: () => [], propDecorators: { columnDefs: [{
|
|
759
|
+
type: ContentChildren,
|
|
760
|
+
args: [MatColumnDef]
|
|
761
|
+
}] } });
|
|
762
|
+
|
|
763
|
+
class FilterFormComponent {
|
|
764
|
+
constructor() {
|
|
765
|
+
this.filter = new EventEmitter();
|
|
766
|
+
}
|
|
767
|
+
ngOnInit() {
|
|
768
|
+
}
|
|
769
|
+
onFilter() {
|
|
770
|
+
this.filter.emit("xxx");
|
|
771
|
+
}
|
|
772
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: FilterFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
773
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.17", type: FilterFormComponent, isStandalone: false, selector: "glw-filter-form", outputs: { filter: "filter" }, ngImport: i0, template: "<mat-card appearance=\"outlined\">\r\n <mat-card-content>\r\n <ng-content></ng-content>\r\n </mat-card-content>\r\n <mat-card-actions align=\"end\">\r\n <button mat-stroked-button color=\"accent\" (click)=\"onFilter()\">\r\n <mat-icon>search</mat-icon>\r\n Filter\r\n </button>\r\n </mat-card-actions>\r\n</mat-card>", styles: [""], dependencies: [{ kind: "component", type: i1$4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i4.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i3$1.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i3$1.MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { kind: "directive", type: i3$1.MatCardContent, selector: "mat-card-content" }] }); }
|
|
774
|
+
}
|
|
775
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: FilterFormComponent, decorators: [{
|
|
776
|
+
type: Component,
|
|
777
|
+
args: [{ selector: 'glw-filter-form', standalone: false, template: "<mat-card appearance=\"outlined\">\r\n <mat-card-content>\r\n <ng-content></ng-content>\r\n </mat-card-content>\r\n <mat-card-actions align=\"end\">\r\n <button mat-stroked-button color=\"accent\" (click)=\"onFilter()\">\r\n <mat-icon>search</mat-icon>\r\n Filter\r\n </button>\r\n </mat-card-actions>\r\n</mat-card>" }]
|
|
778
|
+
}], ctorParameters: () => [], propDecorators: { filter: [{
|
|
779
|
+
type: Output
|
|
780
|
+
}] } });
|
|
781
|
+
|
|
782
|
+
class Oauthassociation {
|
|
783
|
+
toString() {
|
|
784
|
+
return this.provider;
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
class AuthenticationServiceConfig {
|
|
789
|
+
constructor() {
|
|
790
|
+
this.currentUserVariableName = 'currentuser';
|
|
791
|
+
this.authenticationUrl = `/admin/authusers/authenticate`;
|
|
792
|
+
this.changePasswordUrl = `/admin/authusers/changePassword`;
|
|
793
|
+
this.askResetPasswordCodeUrl = `/admin/authusers/askResetPasswordCode`;
|
|
794
|
+
this.resetPassworUrl = `/admin/authusers/resetPassword`;
|
|
795
|
+
this.environment = '__GlowwSecurity__';
|
|
796
|
+
this.showDomain = false;
|
|
797
|
+
this.askGSM = false;
|
|
798
|
+
this.googleClientId = '';
|
|
799
|
+
this.facebookClientId = '';
|
|
800
|
+
this.amazonClientId = '';
|
|
801
|
+
this.microsoftClientId = '';
|
|
802
|
+
}
|
|
803
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: AuthenticationServiceConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
804
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: AuthenticationServiceConfig, providedIn: 'root' }); }
|
|
805
|
+
}
|
|
806
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: AuthenticationServiceConfig, decorators: [{
|
|
807
|
+
type: Injectable,
|
|
808
|
+
args: [{ providedIn: 'root' }]
|
|
809
|
+
}] });
|
|
810
|
+
|
|
811
|
+
class AuthenticationService {
|
|
812
|
+
constructor(http, platformId, config) {
|
|
813
|
+
this.http = http;
|
|
814
|
+
this.platformId = platformId;
|
|
815
|
+
this.hasLocalStorage = false;
|
|
816
|
+
this.hasLocalStorage = isPlatformBrowser(this.platformId);
|
|
817
|
+
if (config && config.currentUserVariableName) {
|
|
818
|
+
this.currentUserVariableName = config.currentUserVariableName;
|
|
819
|
+
}
|
|
820
|
+
else {
|
|
821
|
+
this.currentUserVariableName = 'currentUser';
|
|
822
|
+
}
|
|
823
|
+
if (config && config.authenticationUrl) {
|
|
824
|
+
this.authenticationUrl = config.authenticationUrl;
|
|
825
|
+
}
|
|
826
|
+
else {
|
|
827
|
+
this.authenticationUrl = `/admin/authusers/authenticate`;
|
|
828
|
+
}
|
|
829
|
+
if (config && config.changePasswordUrl) {
|
|
830
|
+
this.changePasswordUrl = config.changePasswordUrl;
|
|
831
|
+
}
|
|
832
|
+
else {
|
|
833
|
+
this.changePasswordUrl = this.authenticationUrl.replace('authenticate', 'changePassword');
|
|
834
|
+
}
|
|
835
|
+
if (config && config.askResetPasswordCodeUrl) {
|
|
836
|
+
this.askResetPasswordCodeUrl = config.askResetPasswordCodeUrl;
|
|
837
|
+
}
|
|
838
|
+
else {
|
|
839
|
+
this.askResetPasswordCodeUrl = this.authenticationUrl.replace('authenticate', 'askResetPasswordCode');
|
|
840
|
+
}
|
|
841
|
+
if (config && config.resetPassworUrl) {
|
|
842
|
+
this.resetPasswordUrl = config.resetPassworUrl;
|
|
843
|
+
}
|
|
844
|
+
else {
|
|
845
|
+
this.resetPasswordUrl = this.authenticationUrl.replace('authenticate', 'resetPassword');
|
|
846
|
+
}
|
|
847
|
+
this.OAuthGetProvidersUrl = this.authenticationUrl.replace('authenticate', 'OAuthGetProviders');
|
|
848
|
+
this.OAuthAskCodeUrl = this.authenticationUrl.replace('authenticate', 'OAuthAskCode');
|
|
849
|
+
this.OAuthAssociationUrl = this.authenticationUrl.replace('authenticate', 'OAuthAssociation');
|
|
850
|
+
this.OAuthGetAssociationsUrl = this.authenticationUrl.replace('authenticate', 'OAuthGetAssociations');
|
|
851
|
+
this.OAuthDeleteAssociationUrl = this.authenticationUrl.replace('authenticate', 'OAuthDeleteAssociation');
|
|
852
|
+
if (config && config.environment) {
|
|
853
|
+
this.environment = config.environment;
|
|
854
|
+
}
|
|
855
|
+
if (config && config.showDomain) {
|
|
856
|
+
this.showdomain = config.showDomain;
|
|
857
|
+
}
|
|
858
|
+
if (this.hasLocalStorage) { // Angular Universal
|
|
859
|
+
this.currentUserSubject = new BehaviorSubject(JSON.parse(localStorage.getItem(this.currentUserVariableName)));
|
|
860
|
+
this.currentUser = this.currentUserSubject.asObservable();
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
get currentUserValue() {
|
|
864
|
+
if (!this.currentUserSubject) {
|
|
865
|
+
return null;
|
|
866
|
+
} // Angular Universsal
|
|
867
|
+
return this.currentUserSubject.value;
|
|
868
|
+
}
|
|
869
|
+
get isConnected() {
|
|
870
|
+
if (!this.currentUserSubject) {
|
|
871
|
+
return null;
|
|
872
|
+
} // Angular Universsal
|
|
873
|
+
return this.currentUserSubject.value !== null;
|
|
874
|
+
}
|
|
875
|
+
login(domain, username, password) {
|
|
876
|
+
const formData = new FormData();
|
|
877
|
+
if (this.showdomain) {
|
|
878
|
+
formData.set('domain', domain);
|
|
879
|
+
}
|
|
880
|
+
formData.set('environment', this.environment);
|
|
881
|
+
formData.set('username', username);
|
|
882
|
+
formData.set('password', password);
|
|
883
|
+
return this.http.post(this.authenticationUrl, formData, { observe: 'response' })
|
|
884
|
+
.pipe(map(resp => {
|
|
885
|
+
// store user details and jwt token in local storage to keep user logged in between page refreshes
|
|
886
|
+
const user = resp.body;
|
|
887
|
+
if (this.hasLocalStorage) {
|
|
888
|
+
localStorage.setItem(this.currentUserVariableName, JSON.stringify(user));
|
|
889
|
+
}
|
|
890
|
+
this.currentUserSubject.next(user);
|
|
891
|
+
return user;
|
|
892
|
+
}));
|
|
893
|
+
}
|
|
894
|
+
changePassword(domain, username, oldpassword, newpassword) {
|
|
895
|
+
const params = new HttpParams({
|
|
896
|
+
fromObject: {
|
|
897
|
+
domain: this.currentUserValue.domain ?? '',
|
|
898
|
+
username: this.currentUserValue.username,
|
|
899
|
+
newpassword,
|
|
900
|
+
oldpassword,
|
|
901
|
+
environment: this.environment
|
|
902
|
+
}
|
|
903
|
+
});
|
|
904
|
+
return this.http.get(this.changePasswordUrl, { params });
|
|
905
|
+
}
|
|
906
|
+
logout() {
|
|
907
|
+
// remove user from local storage to log user out
|
|
908
|
+
if (this.hasLocalStorage) {
|
|
909
|
+
localStorage.removeItem(this.currentUserVariableName);
|
|
910
|
+
}
|
|
911
|
+
this.currentUserSubject.next(null);
|
|
912
|
+
}
|
|
913
|
+
askResetPasswordCode(domain, firstname, lastname, email, gsm) {
|
|
914
|
+
const params = new HttpParams({
|
|
915
|
+
fromObject: {
|
|
916
|
+
domain: '',
|
|
917
|
+
firstname,
|
|
918
|
+
lastname,
|
|
919
|
+
email,
|
|
920
|
+
gsm,
|
|
921
|
+
environment: this.environment
|
|
922
|
+
}
|
|
923
|
+
});
|
|
924
|
+
return this.http.get(this.askResetPasswordCodeUrl, { params });
|
|
925
|
+
}
|
|
926
|
+
resetPassword(email, code, password) {
|
|
927
|
+
const params = new HttpParams({
|
|
928
|
+
fromObject: {
|
|
929
|
+
email,
|
|
930
|
+
code,
|
|
931
|
+
password,
|
|
932
|
+
environment: this.environment
|
|
933
|
+
}
|
|
934
|
+
});
|
|
935
|
+
return this.http.get(this.resetPasswordUrl, { params });
|
|
936
|
+
}
|
|
937
|
+
getOAuthProviders() {
|
|
938
|
+
return this.http.get(this.OAuthGetProvidersUrl);
|
|
939
|
+
}
|
|
940
|
+
OAuthAskCode(environment, login, idOauth, provider, name, value) {
|
|
941
|
+
const params = new HttpParams({
|
|
942
|
+
fromObject: {
|
|
943
|
+
environment,
|
|
944
|
+
login,
|
|
945
|
+
idOauth,
|
|
946
|
+
provider,
|
|
947
|
+
name,
|
|
948
|
+
value
|
|
949
|
+
}
|
|
950
|
+
});
|
|
951
|
+
return this.http.get(this.OAuthAskCodeUrl, { params });
|
|
952
|
+
}
|
|
953
|
+
OAuthAssociation(environment, code, idOauth, provider, name, value) {
|
|
954
|
+
const params = new HttpParams({
|
|
955
|
+
fromObject: {
|
|
956
|
+
environment,
|
|
957
|
+
code,
|
|
958
|
+
idOauth,
|
|
959
|
+
provider,
|
|
960
|
+
name,
|
|
961
|
+
value
|
|
962
|
+
}
|
|
963
|
+
});
|
|
964
|
+
return this.http.get(this.OAuthAssociationUrl, { params }).pipe(map(resp => {
|
|
965
|
+
// store user details and jwt token in local storage to keep user logged in between page refreshes
|
|
966
|
+
console.log("OAuthAuthentication");
|
|
967
|
+
console.log(resp);
|
|
968
|
+
const user = resp;
|
|
969
|
+
if (this.hasLocalStorage) {
|
|
970
|
+
localStorage.setItem(this.currentUserVariableName, JSON.stringify(user));
|
|
971
|
+
}
|
|
972
|
+
this.currentUserSubject.next(user);
|
|
973
|
+
return user;
|
|
974
|
+
}));
|
|
975
|
+
}
|
|
976
|
+
getOAuthAssociations() {
|
|
977
|
+
const params = new HttpParams({
|
|
978
|
+
fromObject: {
|
|
979
|
+
environment: this.environment
|
|
980
|
+
}
|
|
981
|
+
});
|
|
982
|
+
return this.http.get(this.OAuthGetAssociationsUrl, { params }).pipe(tap((value) => console.log(value)), map((value) => value.map(item => Object.assign(new Oauthassociation(), item))), tap((value) => console.log(value)));
|
|
983
|
+
}
|
|
984
|
+
OAuthDeleteAssociation(provider, idOAuth) {
|
|
985
|
+
const params = new HttpParams({
|
|
986
|
+
fromObject: {
|
|
987
|
+
environment: this.environment,
|
|
988
|
+
provider,
|
|
989
|
+
idOAuth
|
|
990
|
+
}
|
|
991
|
+
});
|
|
992
|
+
return this.http.get(this.OAuthDeleteAssociationUrl, { params });
|
|
993
|
+
}
|
|
994
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: AuthenticationService, deps: [{ token: i1.HttpClient }, { token: PLATFORM_ID }, { token: AuthenticationServiceConfig, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
995
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: AuthenticationService, providedIn: 'root' }); }
|
|
996
|
+
}
|
|
997
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: AuthenticationService, decorators: [{
|
|
998
|
+
type: Injectable,
|
|
999
|
+
args: [{ providedIn: 'root' }]
|
|
1000
|
+
}], ctorParameters: () => [{ type: i1.HttpClient }, { type: undefined, decorators: [{
|
|
1001
|
+
type: Inject,
|
|
1002
|
+
args: [PLATFORM_ID]
|
|
1003
|
+
}] }, { type: AuthenticationServiceConfig, decorators: [{
|
|
1004
|
+
type: Optional
|
|
1005
|
+
}] }] });
|
|
1006
|
+
|
|
1007
|
+
;
|
|
1008
|
+
class DisplayObjectsComponent {
|
|
1009
|
+
constructor(glowwService, changeDetectorRef, dialog, router, location, authenticationService, formBuilder, route) {
|
|
1010
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
1011
|
+
this.dialog = dialog;
|
|
1012
|
+
this.router = router;
|
|
1013
|
+
this.location = location;
|
|
1014
|
+
this.authenticationService = authenticationService;
|
|
1015
|
+
this.formBuilder = formBuilder;
|
|
1016
|
+
this.route = route;
|
|
1017
|
+
this.canDisplayObj = false;
|
|
1018
|
+
this.canEdit = true;
|
|
1019
|
+
this.canDelete = true;
|
|
1020
|
+
this.canAdd = true;
|
|
1021
|
+
this.mandatoryParams = {};
|
|
1022
|
+
this.actions = [];
|
|
1023
|
+
this.dialogConfig = {};
|
|
1024
|
+
this.columnsToDisplay = [];
|
|
1025
|
+
this.displayform = true;
|
|
1026
|
+
this.displayresult = false;
|
|
1027
|
+
this.queryParams = {};
|
|
1028
|
+
this.navSubscription = new Subscription();
|
|
1029
|
+
this.currentFilter = null;
|
|
1030
|
+
this.glowwService = glowwService;
|
|
1031
|
+
const component = this;
|
|
1032
|
+
this.currentUser = this.authenticationService.currentUserValue.UserInfo;
|
|
1033
|
+
this.form2 = this.formBuilder.group({
|
|
1034
|
+
_MaxRow_: [null]
|
|
1035
|
+
});
|
|
1036
|
+
//debugger;
|
|
1037
|
+
this.data = this.route.snapshot.data;
|
|
1038
|
+
this.routeParams = this.route.snapshot.params;
|
|
1039
|
+
route.params.subscribe(routeParams => {
|
|
1040
|
+
this.routeParams = routeParams;
|
|
1041
|
+
if (this.displayresult)
|
|
1042
|
+
this.Search();
|
|
1043
|
+
});
|
|
1044
|
+
}
|
|
1045
|
+
ngOnChanges(changes) {
|
|
1046
|
+
}
|
|
1047
|
+
InitRequest() {
|
|
1048
|
+
if (!this.searchRequest) {
|
|
1049
|
+
this.searchRequest = this.glowwService[`search${this.objectName}`];
|
|
1050
|
+
}
|
|
1051
|
+
if (!this.postRequest) {
|
|
1052
|
+
this.postRequest = this.glowwService[`post${this.objectName}`];
|
|
1053
|
+
}
|
|
1054
|
+
if (!this.deleteRequest) {
|
|
1055
|
+
this.deleteRequest = this.glowwService[`delete${this.objectName}`];
|
|
1056
|
+
}
|
|
1057
|
+
if (!this.putRequest) {
|
|
1058
|
+
this.putRequest = this.glowwService[`put${this.objectName}`];
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
sortData(sort) {
|
|
1062
|
+
this.sort.sort({ id: sort.active, start: sort.direction ? sort.direction : "asc", disableClear: true });
|
|
1063
|
+
//this.sort.sortChange.emit(sort);
|
|
1064
|
+
}
|
|
1065
|
+
getValue4Sort(item, header) {
|
|
1066
|
+
let fct = "";
|
|
1067
|
+
let parts = [];
|
|
1068
|
+
if (typeof header === 'object') {
|
|
1069
|
+
fct = header["fct"];
|
|
1070
|
+
parts = header["parts"];
|
|
1071
|
+
}
|
|
1072
|
+
else {
|
|
1073
|
+
console.log(`previewMatchSortingFn ${item} - ${header}`);
|
|
1074
|
+
const headerFct = header.split("---");
|
|
1075
|
+
fct = null;
|
|
1076
|
+
if (headerFct.length === 2) {
|
|
1077
|
+
fct = headerFct[1];
|
|
1078
|
+
}
|
|
1079
|
+
parts = headerFct[0].split(".");
|
|
1080
|
+
}
|
|
1081
|
+
let res = item;
|
|
1082
|
+
for (let i = 0; i < parts.length; i++) {
|
|
1083
|
+
res = res[parts[i]];
|
|
1084
|
+
if (!res)
|
|
1085
|
+
return null;
|
|
1086
|
+
}
|
|
1087
|
+
switch (fct) {
|
|
1088
|
+
case "insensitive":
|
|
1089
|
+
return res.toString().toLowerCase();
|
|
1090
|
+
}
|
|
1091
|
+
return res;
|
|
1092
|
+
}
|
|
1093
|
+
ngAfterViewInit() {
|
|
1094
|
+
if (!this.objectName)
|
|
1095
|
+
this.objectName = this.parent.objectName;
|
|
1096
|
+
if (!this.actions || this.actions.length === 0)
|
|
1097
|
+
this.actions = this.parent.actions;
|
|
1098
|
+
if (!this.primaryKey)
|
|
1099
|
+
this.primaryKey = this.parent.primaryKey;
|
|
1100
|
+
if (!this.columns)
|
|
1101
|
+
this.columns = this.parent.columnsToDisplay;
|
|
1102
|
+
if (!this.Editor)
|
|
1103
|
+
this.Editor = this.parent.editor;
|
|
1104
|
+
if (!this.AddEditor)
|
|
1105
|
+
this.AddEditor = this.parent.addEditor ?? this.parent.editor;
|
|
1106
|
+
///////if (!this.fileFields) this.fileFields = this.parent.fileFields;
|
|
1107
|
+
if (!this.maxrows)
|
|
1108
|
+
this.maxrows = this.parent.maxrows;
|
|
1109
|
+
this.InitRequest();
|
|
1110
|
+
if (this.maxrows?.length > 0) {
|
|
1111
|
+
this.form.addControl("_MaxRow_", new UntypedFormControl(null));
|
|
1112
|
+
}
|
|
1113
|
+
//debugger;
|
|
1114
|
+
console.log(`INIT : formLayout:${this.searchFormLayout}-displayform:${this.displayform}`);
|
|
1115
|
+
if (!this.searchFormLayout && this.resultLayout) {
|
|
1116
|
+
this.displayform = false;
|
|
1117
|
+
this.displayresult = true;
|
|
1118
|
+
}
|
|
1119
|
+
if (Object.keys(this.data).length > 0 && (this.data["__mode"] !== "edit")) {
|
|
1120
|
+
this.displayform = false;
|
|
1121
|
+
this.displayresult = true;
|
|
1122
|
+
}
|
|
1123
|
+
if (Object.keys(this.route.snapshot.params).length > 0 && (this.data["__mode"] !== "edit")) {
|
|
1124
|
+
this.displayform = false;
|
|
1125
|
+
this.displayresult = true;
|
|
1126
|
+
}
|
|
1127
|
+
this.glowwService.basePathChange.subscribe(newUrl => {
|
|
1128
|
+
console.log(`basePathChange ${newUrl}: fromLayout:${this.searchFormLayout}-displayform:${this.displayform}`);
|
|
1129
|
+
this.parent.form?.reset();
|
|
1130
|
+
if (!this.searchFormLayout && this.resultLayout) {
|
|
1131
|
+
this.displayform = false;
|
|
1132
|
+
this.displayresult = true;
|
|
1133
|
+
}
|
|
1134
|
+
if (this.displayresult) {
|
|
1135
|
+
this.Search();
|
|
1136
|
+
}
|
|
1137
|
+
});
|
|
1138
|
+
if (this.displayresult) {
|
|
1139
|
+
this.Search();
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
ngAfterContentInit() {
|
|
1143
|
+
}
|
|
1144
|
+
ngOnInit() {
|
|
1145
|
+
this.navSubscription = this.router.events.subscribe((e) => {
|
|
1146
|
+
if (e instanceof NavigationEnd) {
|
|
1147
|
+
this.parent.form?.reset();
|
|
1148
|
+
this.displayform = true;
|
|
1149
|
+
this.displayresult = false;
|
|
1150
|
+
this.changeDetectorRef.detectChanges();
|
|
1151
|
+
this.dataSource = null;
|
|
1152
|
+
if (!this.searchFormLayout && this.resultLayout) {
|
|
1153
|
+
this.displayform = false;
|
|
1154
|
+
this.displayresult = true;
|
|
1155
|
+
}
|
|
1156
|
+
if (this.displayresult) {
|
|
1157
|
+
this.Search();
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
ngOnDestroy() {
|
|
1163
|
+
this.navSubscription?.unsubscribe(); // this prevents a memory leak
|
|
1164
|
+
}
|
|
1165
|
+
Init(data) {
|
|
1166
|
+
if ((data && Object.keys(data).length > 0) || this.displayresult) {
|
|
1167
|
+
this.Search(data);
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
SetFilterPredicate() {
|
|
1171
|
+
this.dataSource.filterPredicate = function (record, filterString) {
|
|
1172
|
+
console.log(filterString);
|
|
1173
|
+
var filter = JSON.parse(filterString);
|
|
1174
|
+
let isMatch = true;
|
|
1175
|
+
const keys = Object.keys(filter);
|
|
1176
|
+
for (let key of keys) {
|
|
1177
|
+
let value = filter[key];
|
|
1178
|
+
if (!value)
|
|
1179
|
+
continue;
|
|
1180
|
+
const re = /(?<Field>.+?)(?=___|$)(?:___(?<Option>.+))?/m;
|
|
1181
|
+
const keyplus = re.exec(key);
|
|
1182
|
+
let m;
|
|
1183
|
+
let option = "";
|
|
1184
|
+
if (keyplus) {
|
|
1185
|
+
console.log(`Regex OK ${keyplus}`);
|
|
1186
|
+
key = keyplus[1];
|
|
1187
|
+
option = keyplus[2] ?? "";
|
|
1188
|
+
}
|
|
1189
|
+
console.log(`${key} - ${option}`);
|
|
1190
|
+
if (key == "AllFields") {
|
|
1191
|
+
const filterValue = filter["AllFields"].trim().toLowerCase();
|
|
1192
|
+
const dataStr = Object.keys(record)
|
|
1193
|
+
.reduce((currentTerm, key) => {
|
|
1194
|
+
return currentTerm + record[key] + '◬';
|
|
1195
|
+
}, '');
|
|
1196
|
+
isMatch = (dataStr.toLowerCase().indexOf(filterValue) != -1);
|
|
1197
|
+
}
|
|
1198
|
+
else {
|
|
1199
|
+
console.log(`${key} ${record[key]} `);
|
|
1200
|
+
let fieldValue = record[key] ?? "";
|
|
1201
|
+
if (option.includes("i")) {
|
|
1202
|
+
fieldValue = fieldValue.toLowerCase();
|
|
1203
|
+
value = value.toLowerCase();
|
|
1204
|
+
}
|
|
1205
|
+
if (option.includes("c")) {
|
|
1206
|
+
isMatch = fieldValue.includes(value);
|
|
1207
|
+
}
|
|
1208
|
+
else {
|
|
1209
|
+
isMatch = (fieldValue == value);
|
|
1210
|
+
}
|
|
1211
|
+
console.log(`${key} ${record[key]} ${value} : ${isMatch}`);
|
|
1212
|
+
}
|
|
1213
|
+
if (!isMatch)
|
|
1214
|
+
return false;
|
|
1215
|
+
}
|
|
1216
|
+
return isMatch;
|
|
1217
|
+
};
|
|
1218
|
+
}
|
|
1219
|
+
Search(data) {
|
|
1220
|
+
console.log(`Search ${this.glowwService.InternalBasePath}`);
|
|
1221
|
+
if (data)
|
|
1222
|
+
this.data = data;
|
|
1223
|
+
this.displayresult = true;
|
|
1224
|
+
this.displayform = false;
|
|
1225
|
+
this.resultException = null;
|
|
1226
|
+
if (this.data) {
|
|
1227
|
+
Object.keys(this.data).forEach(name => {
|
|
1228
|
+
this.queryParams[name] = this.data[name];
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
if (this.routeParams) {
|
|
1232
|
+
Object.keys(this.routeParams).forEach(name => {
|
|
1233
|
+
this.queryParams[name] = this.routeParams[name];
|
|
1234
|
+
});
|
|
1235
|
+
}
|
|
1236
|
+
if (this.mandatoryParams) {
|
|
1237
|
+
Object.keys(this.mandatoryParams).forEach(name => {
|
|
1238
|
+
this.queryParams[name] = this.queryParams[name];
|
|
1239
|
+
});
|
|
1240
|
+
}
|
|
1241
|
+
this.queryParams['__guid'] = (Math.random().toString()).substring(2);
|
|
1242
|
+
console.log("Before searchRequest");
|
|
1243
|
+
//debugger;
|
|
1244
|
+
this.searchRequest.call(this.glowwService, this.queryParams).subscribe(r => {
|
|
1245
|
+
console.log("search done");
|
|
1246
|
+
try {
|
|
1247
|
+
this.dataSource = new MatTableDataSource(r);
|
|
1248
|
+
this.SetFilterPredicate();
|
|
1249
|
+
}
|
|
1250
|
+
catch (ex) {
|
|
1251
|
+
alert(`${ex}`);
|
|
1252
|
+
}
|
|
1253
|
+
console.log("dataSource changed");
|
|
1254
|
+
this.changeDetectorRef.detectChanges();
|
|
1255
|
+
this.UpdateTable();
|
|
1256
|
+
}, error => {
|
|
1257
|
+
this.displayresult = false;
|
|
1258
|
+
this.displayform = true;
|
|
1259
|
+
this.resultException = error;
|
|
1260
|
+
});
|
|
1261
|
+
}
|
|
1262
|
+
clean(obj) {
|
|
1263
|
+
for (const propName in obj) {
|
|
1264
|
+
if (obj[propName] === null || obj[propName] === undefined) {
|
|
1265
|
+
delete obj[propName];
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
onSearch() {
|
|
1270
|
+
this.queryParams = {};
|
|
1271
|
+
const searchData = this.parent.form.value.searchData;
|
|
1272
|
+
if (searchData) {
|
|
1273
|
+
Object.keys(searchData).forEach(name => {
|
|
1274
|
+
const val = searchData[name];
|
|
1275
|
+
this.queryParams[name] = val;
|
|
1276
|
+
});
|
|
1277
|
+
}
|
|
1278
|
+
if (this.form2.value._MaxRow_) {
|
|
1279
|
+
this.queryParams._MaxRow_ = this.form2.value._MaxRow_;
|
|
1280
|
+
}
|
|
1281
|
+
this.clean(this.queryParams);
|
|
1282
|
+
const params = new HttpParams({ fromObject: this.queryParams });
|
|
1283
|
+
const currentstate = this.location.getState();
|
|
1284
|
+
this.location.replaceState(this.router.url, params.toString());
|
|
1285
|
+
this.Search();
|
|
1286
|
+
}
|
|
1287
|
+
onFilter() {
|
|
1288
|
+
}
|
|
1289
|
+
UpdateDataSource(r) {
|
|
1290
|
+
this.dataSource = new MatTableDataSource(r);
|
|
1291
|
+
this.SetFilterPredicate();
|
|
1292
|
+
this.changeDetectorRef.detectChanges();
|
|
1293
|
+
this.UpdateTable();
|
|
1294
|
+
}
|
|
1295
|
+
UpdateTable() {
|
|
1296
|
+
console.log("UpdateTable()");
|
|
1297
|
+
if (this.dataSource) {
|
|
1298
|
+
if (!this.table) {
|
|
1299
|
+
console.log('!this.table');
|
|
1300
|
+
return;
|
|
1301
|
+
}
|
|
1302
|
+
this.resultLayout.columnDefs.forEach(columnDef => this.table.addColumnDef(columnDef));
|
|
1303
|
+
this.dataSource.paginator = this.paginator;
|
|
1304
|
+
this.dataSource.sort = this.sort;
|
|
1305
|
+
this.dataSource.sortingDataAccessor = this.getValue4Sort;
|
|
1306
|
+
console.log(`After this.dataSource.sort = ${this.parent.sort}`);
|
|
1307
|
+
this.columnsToDisplay = this.columns();
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
canDisplayObjThis(obj, action) {
|
|
1311
|
+
try {
|
|
1312
|
+
if (!this.displayObjLink) {
|
|
1313
|
+
return false;
|
|
1314
|
+
}
|
|
1315
|
+
if (typeof this.canDisplayObj === 'boolean') {
|
|
1316
|
+
return this.canDisplayObj;
|
|
1317
|
+
}
|
|
1318
|
+
return this.canDisplayObj(this.currentUser, obj, action);
|
|
1319
|
+
}
|
|
1320
|
+
catch (ex) {
|
|
1321
|
+
console.log(ex);
|
|
1322
|
+
return true;
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
canAddThis() {
|
|
1326
|
+
try {
|
|
1327
|
+
if (!this.canAdd) {
|
|
1328
|
+
return false;
|
|
1329
|
+
}
|
|
1330
|
+
if (typeof this.canAdd === 'boolean') {
|
|
1331
|
+
return this.canAdd;
|
|
1332
|
+
}
|
|
1333
|
+
return this.canAdd(this.currentUser);
|
|
1334
|
+
}
|
|
1335
|
+
catch (ex) {
|
|
1336
|
+
console.log(ex);
|
|
1337
|
+
return true;
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
canEditThis(obj) {
|
|
1341
|
+
try {
|
|
1342
|
+
if (!this.canEdit) {
|
|
1343
|
+
return false;
|
|
1344
|
+
}
|
|
1345
|
+
if (typeof this.canEdit === 'boolean') {
|
|
1346
|
+
return this.canEdit;
|
|
1347
|
+
}
|
|
1348
|
+
return this.canEdit(this.currentUser, obj);
|
|
1349
|
+
}
|
|
1350
|
+
catch (ex) {
|
|
1351
|
+
console.log(ex);
|
|
1352
|
+
return true;
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
canDeleteThis(obj) {
|
|
1356
|
+
try {
|
|
1357
|
+
if (!this.canDelete) {
|
|
1358
|
+
return false;
|
|
1359
|
+
}
|
|
1360
|
+
if (typeof this.canDelete === 'boolean') {
|
|
1361
|
+
return this.canDelete;
|
|
1362
|
+
}
|
|
1363
|
+
return this.canDelete(this.currentUser, obj);
|
|
1364
|
+
}
|
|
1365
|
+
catch (ex) {
|
|
1366
|
+
console.log(ex);
|
|
1367
|
+
return false;
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
displayObjLinkThis(obj, action) {
|
|
1371
|
+
if (!this.displayObjLink) {
|
|
1372
|
+
return null;
|
|
1373
|
+
}
|
|
1374
|
+
return this.displayObjLink(obj, action);
|
|
1375
|
+
}
|
|
1376
|
+
isString(value) {
|
|
1377
|
+
return typeof value === 'string' || value instanceof String;
|
|
1378
|
+
}
|
|
1379
|
+
getPrimaryKey(obj) {
|
|
1380
|
+
let res = [];
|
|
1381
|
+
if (this.isString(this.primaryKey)) {
|
|
1382
|
+
console.log("string");
|
|
1383
|
+
res.push(obj[this.primaryKey]);
|
|
1384
|
+
}
|
|
1385
|
+
else {
|
|
1386
|
+
console.log("string[]");
|
|
1387
|
+
this.primaryKey.forEach(key => res.push(obj[key]));
|
|
1388
|
+
}
|
|
1389
|
+
return res;
|
|
1390
|
+
}
|
|
1391
|
+
_saveObj(obj) {
|
|
1392
|
+
var subject = new Subject();
|
|
1393
|
+
this.postRequest.call(this.glowwService, obj).subscribe(data => {
|
|
1394
|
+
const tmp = this.dataSource.data;
|
|
1395
|
+
tmp.push(data);
|
|
1396
|
+
this.dataSource.data = tmp;
|
|
1397
|
+
subject.next(data);
|
|
1398
|
+
}, error => {
|
|
1399
|
+
alert(`Unable to add Object ${error.status} ${error.statusText}\n${error.Message}\n${error.error}`);
|
|
1400
|
+
subject.error(error);
|
|
1401
|
+
});
|
|
1402
|
+
return subject;
|
|
1403
|
+
}
|
|
1404
|
+
_saveFile(fileField, obj, file) {
|
|
1405
|
+
const formData = new FormData();
|
|
1406
|
+
formData.append('file', file.data);
|
|
1407
|
+
return this.glowwService[`post${this.objectName}${fileField}`].call(this.glowwService, this.getPrimaryKey(obj), formData).pipe(tap((event) => {
|
|
1408
|
+
switch (event.type) {
|
|
1409
|
+
case HttpEventType.UploadProgress:
|
|
1410
|
+
file.progress = Math.round(event.loaded * 100 / (event.total ?? 1));
|
|
1411
|
+
file.inProgress = file.progress !== 100;
|
|
1412
|
+
break;
|
|
1413
|
+
case HttpEventType.Response:
|
|
1414
|
+
file.progress = 100;
|
|
1415
|
+
file.status = "Done";
|
|
1416
|
+
file.inProgress = false;
|
|
1417
|
+
break;
|
|
1418
|
+
}
|
|
1419
|
+
}), filter((event) => {
|
|
1420
|
+
console.log(`filter ${event.type}`);
|
|
1421
|
+
return event.type === HttpEventType.Response;
|
|
1422
|
+
}), map((event) => {
|
|
1423
|
+
console.log(`map ${event.type}`);
|
|
1424
|
+
const tmp = this.dataSource.data;
|
|
1425
|
+
tmp[tmp.indexOf(obj)] = event.body;
|
|
1426
|
+
this.dataSource.data = tmp;
|
|
1427
|
+
console.log(`after replace...`);
|
|
1428
|
+
return event.body;
|
|
1429
|
+
}), catchError((error) => {
|
|
1430
|
+
file.inProgress = false;
|
|
1431
|
+
file.status = "Error";
|
|
1432
|
+
console.log(`${file.data.name} upload failed.`);
|
|
1433
|
+
//subject.error(error);
|
|
1434
|
+
return of(`${file.data.name} upload failed.`);
|
|
1435
|
+
}));
|
|
1436
|
+
}
|
|
1437
|
+
AddObj() {
|
|
1438
|
+
const dialogConfig = new MatDialogConfig();
|
|
1439
|
+
dialogConfig.disableClose = true;
|
|
1440
|
+
dialogConfig.autoFocus = true;
|
|
1441
|
+
dialogConfig.closeOnNavigation = false;
|
|
1442
|
+
dialogConfig.maxHeight = "95%";
|
|
1443
|
+
dialogConfig.maxWidth = "95%";
|
|
1444
|
+
dialogConfig.height = "100%";
|
|
1445
|
+
if (this.dialogConfig) {
|
|
1446
|
+
Object.keys(this.dialogConfig).forEach(name => {
|
|
1447
|
+
dialogConfig[name] = this.dialogConfig[name];
|
|
1448
|
+
});
|
|
1449
|
+
}
|
|
1450
|
+
let args = {};
|
|
1451
|
+
Object.keys(this.route.snapshot?.params).forEach(key => {
|
|
1452
|
+
args[key] = this.route.snapshot?.params[key];
|
|
1453
|
+
dialogConfig.data = args;
|
|
1454
|
+
});
|
|
1455
|
+
const dlg = this.dialog.open(this.AddEditor, dialogConfig);
|
|
1456
|
+
dlg.componentInstance.callback = (data => {
|
|
1457
|
+
let datacopy = { ...data };
|
|
1458
|
+
const fileFields = this.Editor.fileFields;
|
|
1459
|
+
console.log(`fileFields ${fileFields?.length}`);
|
|
1460
|
+
if (fileFields?.length == 1) {
|
|
1461
|
+
// Un seul champ, il peut être multiple
|
|
1462
|
+
const fileField = fileFields[0];
|
|
1463
|
+
console.log(`fileField ${fileField}`);
|
|
1464
|
+
const files = datacopy[fileField];
|
|
1465
|
+
delete datacopy[fileField];
|
|
1466
|
+
const allobs = {};
|
|
1467
|
+
files.forEach(file => {
|
|
1468
|
+
if (file.statut !== 'Done' && file.statut !== 'Error') {
|
|
1469
|
+
const obs = this._saveObj(datacopy).pipe(switchMap(newdata => this._saveFile(fileField, newdata, file)));
|
|
1470
|
+
console.log(`file.fileName ${file.fileName}`);
|
|
1471
|
+
allobs[file.fileName] = obs;
|
|
1472
|
+
}
|
|
1473
|
+
});
|
|
1474
|
+
return combineLatest(allobs).pipe(take(1));
|
|
1475
|
+
}
|
|
1476
|
+
else if (fileFields?.length > 1) {
|
|
1477
|
+
// Plusieurs champs file, il ne peut y avoir qu'une seul fichier par champ.
|
|
1478
|
+
const fields = {};
|
|
1479
|
+
fileFields.forEach(ff => {
|
|
1480
|
+
fields[ff] = datacopy[ff];
|
|
1481
|
+
delete datacopy[ff];
|
|
1482
|
+
return this._saveObj(datacopy).pipe(mergeMap(newdata => {
|
|
1483
|
+
var allobs = [];
|
|
1484
|
+
Object.entries(fields).forEach(([fileField, files]) => {
|
|
1485
|
+
if (files.length > 0) {
|
|
1486
|
+
allobs.push(this._saveFile(fileField, newdata, files[0]));
|
|
1487
|
+
}
|
|
1488
|
+
});
|
|
1489
|
+
return forkJoin(allobs); // TODO : PAS TERMINE... JAMAIS UTILISE...
|
|
1490
|
+
}));
|
|
1491
|
+
});
|
|
1492
|
+
}
|
|
1493
|
+
else {
|
|
1494
|
+
// Form sans fichier
|
|
1495
|
+
return this._saveObj(data);
|
|
1496
|
+
}
|
|
1497
|
+
});
|
|
1498
|
+
}
|
|
1499
|
+
DeleteObj(obj) {
|
|
1500
|
+
if (confirm('Are you sure you want to delete this objet ? ')) {
|
|
1501
|
+
this.deleteRequest.apply(this.glowwService, this.getPrimaryKey(obj)).subscribe(p => {
|
|
1502
|
+
const i = this.dataSource.data.indexOf(obj);
|
|
1503
|
+
const tmp = this.dataSource.data;
|
|
1504
|
+
tmp.splice(i, 1);
|
|
1505
|
+
this.dataSource.data = tmp;
|
|
1506
|
+
}, error => {
|
|
1507
|
+
alert(`Unable to delete Object ${error.status} ${error.statusText}\n${error.Message}\n${error.error}`);
|
|
1508
|
+
});
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
_updateObj(current, newData) {
|
|
1512
|
+
let args = this.getPrimaryKey(current);
|
|
1513
|
+
args.push(newData);
|
|
1514
|
+
var subject = new Subject();
|
|
1515
|
+
this.putRequest.apply(this.glowwService, args).subscribe(data => {
|
|
1516
|
+
const i = this.dataSource.data.indexOf(current);
|
|
1517
|
+
const tmp = this.dataSource.data;
|
|
1518
|
+
tmp[i] = data;
|
|
1519
|
+
this.dataSource.data = tmp;
|
|
1520
|
+
subject.next(data);
|
|
1521
|
+
}, error => {
|
|
1522
|
+
alert(`Unable to update Object ${error.status} ${error.statusText}\n${error.Message}\n${error.error}`);
|
|
1523
|
+
subject.error(error);
|
|
1524
|
+
});
|
|
1525
|
+
return subject;
|
|
1526
|
+
}
|
|
1527
|
+
EditObj(obj) {
|
|
1528
|
+
const dialogConfig = new MatDialogConfig();
|
|
1529
|
+
dialogConfig.disableClose = true;
|
|
1530
|
+
dialogConfig.autoFocus = true;
|
|
1531
|
+
dialogConfig.closeOnNavigation = false;
|
|
1532
|
+
dialogConfig.maxHeight = "95%";
|
|
1533
|
+
dialogConfig.maxWidth = "95%";
|
|
1534
|
+
dialogConfig.height = "100%";
|
|
1535
|
+
if (this.dialogConfig) {
|
|
1536
|
+
Object.keys(this.dialogConfig).forEach(name => {
|
|
1537
|
+
dialogConfig[name] = this.dialogConfig[name];
|
|
1538
|
+
});
|
|
1539
|
+
}
|
|
1540
|
+
const current = { ...obj };
|
|
1541
|
+
dialogConfig.data = obj;
|
|
1542
|
+
const dlg = this.dialog.open(this.Editor, dialogConfig);
|
|
1543
|
+
dlg.componentInstance.callback = (data => {
|
|
1544
|
+
let datacopy = { ...data };
|
|
1545
|
+
const fileFields = this.Editor.fileFields;
|
|
1546
|
+
if (fileFields?.length == 1) {
|
|
1547
|
+
// Un seul champ, il peut être multiple
|
|
1548
|
+
const fileField = fileFields[0];
|
|
1549
|
+
const files = datacopy[fileField];
|
|
1550
|
+
delete datacopy[fileField];
|
|
1551
|
+
const allobs = {};
|
|
1552
|
+
files.forEach(file => {
|
|
1553
|
+
if (file.statut !== 'Done' && file.statut !== 'Error') {
|
|
1554
|
+
const obs = this._updateObj(current, datacopy).pipe(switchMap(newdata => this._saveFile(fileField, newdata, file)));
|
|
1555
|
+
allobs[file.fileName] = obs;
|
|
1556
|
+
}
|
|
1557
|
+
});
|
|
1558
|
+
return combineLatest(allobs).pipe(take(1));
|
|
1559
|
+
}
|
|
1560
|
+
else if (fileFields?.length > 1) {
|
|
1561
|
+
// Plusieurs champs file, il ne peut y avoir qu'une seul fichier par champ.
|
|
1562
|
+
const fields = {};
|
|
1563
|
+
fileFields.forEach(ff => {
|
|
1564
|
+
fields[ff] = datacopy[ff];
|
|
1565
|
+
delete datacopy[ff];
|
|
1566
|
+
return this._updateObj(current, datacopy).pipe(mergeMap(newdata => {
|
|
1567
|
+
var allobs = [];
|
|
1568
|
+
Object.entries(fields).forEach(([fileField, files]) => {
|
|
1569
|
+
if (files.length > 0) {
|
|
1570
|
+
allobs.push(this._saveFile(fileField, newdata, files[0]));
|
|
1571
|
+
}
|
|
1572
|
+
});
|
|
1573
|
+
return forkJoin(allobs); // TODO : PAS TERMINE... JAMAIS UTILISE...
|
|
1574
|
+
}));
|
|
1575
|
+
});
|
|
1576
|
+
}
|
|
1577
|
+
else {
|
|
1578
|
+
// Form sans fichier
|
|
1579
|
+
return this._updateObj(current, data);
|
|
1580
|
+
}
|
|
1581
|
+
});
|
|
1582
|
+
}
|
|
1583
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: DisplayObjectsComponent, deps: [{ token: 'glowwService' }, { token: i0.ChangeDetectorRef }, { token: i1$2.MatDialog }, { token: i2.Router }, { token: i3.Location }, { token: AuthenticationService }, { token: i1$3.UntypedFormBuilder }, { token: i2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1584
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.17", type: DisplayObjectsComponent, isStandalone: false, selector: "glw-display-objects", inputs: { configuration: "configuration", displayObjLink: "displayObjLink", canDisplayObj: "canDisplayObj", canEdit: "canEdit", canDelete: "canDelete", canAdd: "canAdd", form: "form", SearchForm: "SearchForm", searchRequest: "searchRequest", postRequest: "postRequest", deleteRequest: "deleteRequest", putRequest: "putRequest", maxrows: "maxrows", mandatoryParams: "mandatoryParams", actions: "actions", dialogConfig: "dialogConfig", parent: "parent", columns: "columns", objectName: "objectName", primaryKey: "primaryKey", Editor: "Editor", AddEditor: "AddEditor" }, queries: [{ propertyName: "header", first: true, predicate: HeaderComponent, descendants: true }, { propertyName: "searchFormLayout", first: true, predicate: SearchFormComponent, descendants: true }, { propertyName: "filterFormLayout", first: true, predicate: FilterFormComponent, descendants: true }, { propertyName: "resultLayout", first: true, predicate: ResultTableComponent, descendants: true }], viewQueries: [{ propertyName: "table", first: true, predicate: MatTable, descendants: true }, { propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true }, { propertyName: "sort", first: true, predicate: MatSort, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div>\n <ng-content select=\"glw-header\"></ng-content>\n</div>\n\n@if (displayform) {\n <div>\n <mat-card appearance=\"outlined\">\n <mat-card-content>\n @if (resultException) {\n <mat-error>\n Unable to query : {{resultException}}\n </mat-error>\n }\n <ng-content select=\"glw-search-form\"></ng-content>\n <!--<ng-container *ngComponentOutlet=\"SearchForm; injector: objInjector\"></ng-container>-->\n @if (maxrows) {\n <div [formGroup]=\"form2\">\n <br />\n <mat-form-field>\n <mat-select placeholder=\"MaxRow\" formControlName=\"_MaxRow_\">\n @for (maxrow of maxrows; track maxrow) {\n <mat-option [value]=\"maxrow\">\n @if (maxrow) {\n <span>{{maxrow}} objects</span>\n }\n @if (!maxrow) {\n <span> Default</span>\n }\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n }\n </mat-card-content>\n <mat-card-actions>\n <button mat-stroked-button color=\"accent\" (click)=\"onSearch()\">\n <mat-icon>search</mat-icon>\n Search\n </button>\n </mat-card-actions>\n </mat-card>\n </div>\n}\n\n<div [hidden]=\"!displayresult\">\n <!--*ngIf=\"displayresult\"-->\n <div class=\"mat-elevation-z8\" [hidden]=\"!dataSource\">\n <ng-content select=\"[filter]\"></ng-content>\n\n <!--*ngIf=\"dataSource; else Spinner\"-->\n <table mat-table [dataSource]=\"dataSource\" matSort>\n <ng-container matColumnDef=\"action\">\n <th mat-header-cell *matHeaderCellDef>\n @if (canAddThis()) {\n <i class=\"fal fa-plus\" (click)=\"AddObj()\">\n </i>\n }\n </th>\n <td mat-cell *matCellDef=\"let obj\">\n @if (canDisplayObjThis(obj)) {\n <i class=\"fal fa-eye\" [routerLink]=\"displayObjLinkThis(obj)\">\n </i>\n }\n @for (action of actions; track action) {\n @if (action.icon.icon && (!action.display || action.display(obj, action.name))) {\n <i [ngClass]=\"action.icon\" [routerLink]=\"action.routerLinkFct(obj)\">\n </i>\n }\n @if (!action.icon.icon && (!action.display || action.display(obj, action.name))) {\n <i [ngClass]=\"action.icon\" [routerLink]=\"action.routerLinkFct(obj)\"></i>\n }\n }\n @if (canDeleteThis(obj)) {\n <i class=\"fal fa-trash-alt\" (click)=\"DeleteObj(obj)\">\n </i>\n }\n @if (canEditThis(obj)) {\n <i class=\"fal fa-pencil\" (click)=\"EditObj(obj)\">\n </i>\n }\n </td>\n </ng-container>\n <ng-content select=\"glw-result-table\"></ng-content>\n <tr mat-header-row *matHeaderRowDef=\"columnsToDisplay\"></tr>\n <tr mat-row *matRowDef=\"let myRowData; columns: columnsToDisplay\"></tr>\n </table>\n <mat-paginator pageSize=\"10\"></mat-paginator>\n </div>\n <div #Spinner [hidden]=\"dataSource\">\n <mat-spinner></mat-spinner>\n </div>\n</div>\n", styles: ["table{width:100%}i{cursor:pointer;padding:5px}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "component", type: i1$4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i4.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i3$1.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i3$1.MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { kind: "directive", type: i3$1.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: i10.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: i11.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i11.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i11.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i11.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i11.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i11.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i11.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i11.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i11.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i11.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: i3$2.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i3$2.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i13.MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "directive", type: i14.MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }] }); }
|
|
1585
|
+
}
|
|
1586
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: DisplayObjectsComponent, decorators: [{
|
|
1587
|
+
type: Component,
|
|
1588
|
+
args: [{ selector: 'glw-display-objects', standalone: false, template: "<div>\n <ng-content select=\"glw-header\"></ng-content>\n</div>\n\n@if (displayform) {\n <div>\n <mat-card appearance=\"outlined\">\n <mat-card-content>\n @if (resultException) {\n <mat-error>\n Unable to query : {{resultException}}\n </mat-error>\n }\n <ng-content select=\"glw-search-form\"></ng-content>\n <!--<ng-container *ngComponentOutlet=\"SearchForm; injector: objInjector\"></ng-container>-->\n @if (maxrows) {\n <div [formGroup]=\"form2\">\n <br />\n <mat-form-field>\n <mat-select placeholder=\"MaxRow\" formControlName=\"_MaxRow_\">\n @for (maxrow of maxrows; track maxrow) {\n <mat-option [value]=\"maxrow\">\n @if (maxrow) {\n <span>{{maxrow}} objects</span>\n }\n @if (!maxrow) {\n <span> Default</span>\n }\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n }\n </mat-card-content>\n <mat-card-actions>\n <button mat-stroked-button color=\"accent\" (click)=\"onSearch()\">\n <mat-icon>search</mat-icon>\n Search\n </button>\n </mat-card-actions>\n </mat-card>\n </div>\n}\n\n<div [hidden]=\"!displayresult\">\n <!--*ngIf=\"displayresult\"-->\n <div class=\"mat-elevation-z8\" [hidden]=\"!dataSource\">\n <ng-content select=\"[filter]\"></ng-content>\n\n <!--*ngIf=\"dataSource; else Spinner\"-->\n <table mat-table [dataSource]=\"dataSource\" matSort>\n <ng-container matColumnDef=\"action\">\n <th mat-header-cell *matHeaderCellDef>\n @if (canAddThis()) {\n <i class=\"fal fa-plus\" (click)=\"AddObj()\">\n </i>\n }\n </th>\n <td mat-cell *matCellDef=\"let obj\">\n @if (canDisplayObjThis(obj)) {\n <i class=\"fal fa-eye\" [routerLink]=\"displayObjLinkThis(obj)\">\n </i>\n }\n @for (action of actions; track action) {\n @if (action.icon.icon && (!action.display || action.display(obj, action.name))) {\n <i [ngClass]=\"action.icon\" [routerLink]=\"action.routerLinkFct(obj)\">\n </i>\n }\n @if (!action.icon.icon && (!action.display || action.display(obj, action.name))) {\n <i [ngClass]=\"action.icon\" [routerLink]=\"action.routerLinkFct(obj)\"></i>\n }\n }\n @if (canDeleteThis(obj)) {\n <i class=\"fal fa-trash-alt\" (click)=\"DeleteObj(obj)\">\n </i>\n }\n @if (canEditThis(obj)) {\n <i class=\"fal fa-pencil\" (click)=\"EditObj(obj)\">\n </i>\n }\n </td>\n </ng-container>\n <ng-content select=\"glw-result-table\"></ng-content>\n <tr mat-header-row *matHeaderRowDef=\"columnsToDisplay\"></tr>\n <tr mat-row *matRowDef=\"let myRowData; columns: columnsToDisplay\"></tr>\n </table>\n <mat-paginator pageSize=\"10\"></mat-paginator>\n </div>\n <div #Spinner [hidden]=\"dataSource\">\n <mat-spinner></mat-spinner>\n </div>\n</div>\n", styles: ["table{width:100%}i{cursor:pointer;padding:5px}\n"] }]
|
|
1589
|
+
}], ctorParameters: () => [{ type: GlowwService, decorators: [{
|
|
1590
|
+
type: Inject,
|
|
1591
|
+
args: ['glowwService']
|
|
1592
|
+
}] }, { type: i0.ChangeDetectorRef }, { type: i1$2.MatDialog }, { type: i2.Router }, { type: i3.Location }, { type: AuthenticationService }, { type: i1$3.UntypedFormBuilder }, { type: i2.ActivatedRoute }], propDecorators: { header: [{
|
|
1593
|
+
type: ContentChild,
|
|
1594
|
+
args: [HeaderComponent]
|
|
1595
|
+
}], searchFormLayout: [{
|
|
1596
|
+
type: ContentChild,
|
|
1597
|
+
args: [SearchFormComponent]
|
|
1598
|
+
}], filterFormLayout: [{
|
|
1599
|
+
type: ContentChild,
|
|
1600
|
+
args: [FilterFormComponent]
|
|
1601
|
+
}], resultLayout: [{
|
|
1602
|
+
type: ContentChild,
|
|
1603
|
+
args: [ResultTableComponent]
|
|
1604
|
+
}], table: [{
|
|
1605
|
+
type: ViewChild,
|
|
1606
|
+
args: [MatTable, { static: false }]
|
|
1607
|
+
}], paginator: [{
|
|
1608
|
+
type: ViewChild,
|
|
1609
|
+
args: [MatPaginator, { static: false }]
|
|
1610
|
+
}], sort: [{
|
|
1611
|
+
type: ViewChild,
|
|
1612
|
+
args: [MatSort, { static: false }]
|
|
1613
|
+
}], configuration: [{
|
|
1614
|
+
type: Input
|
|
1615
|
+
}], displayObjLink: [{
|
|
1616
|
+
type: Input
|
|
1617
|
+
}], canDisplayObj: [{
|
|
1618
|
+
type: Input
|
|
1619
|
+
}], canEdit: [{
|
|
1620
|
+
type: Input
|
|
1621
|
+
}], canDelete: [{
|
|
1622
|
+
type: Input
|
|
1623
|
+
}], canAdd: [{
|
|
1624
|
+
type: Input
|
|
1625
|
+
}], form: [{
|
|
1626
|
+
type: Input
|
|
1627
|
+
}], SearchForm: [{
|
|
1628
|
+
type: Input
|
|
1629
|
+
}], searchRequest: [{
|
|
1630
|
+
type: Input
|
|
1631
|
+
}], postRequest: [{
|
|
1632
|
+
type: Input
|
|
1633
|
+
}], deleteRequest: [{
|
|
1634
|
+
type: Input
|
|
1635
|
+
}], putRequest: [{
|
|
1636
|
+
type: Input
|
|
1637
|
+
}], maxrows: [{
|
|
1638
|
+
type: Input
|
|
1639
|
+
}], mandatoryParams: [{
|
|
1640
|
+
type: Input
|
|
1641
|
+
}], actions: [{
|
|
1642
|
+
type: Input
|
|
1643
|
+
}], dialogConfig: [{
|
|
1644
|
+
type: Input
|
|
1645
|
+
}], parent: [{
|
|
1646
|
+
type: Input
|
|
1647
|
+
}], columns: [{
|
|
1648
|
+
type: Input
|
|
1649
|
+
}], objectName: [{
|
|
1650
|
+
type: Input
|
|
1651
|
+
}], primaryKey: [{
|
|
1652
|
+
type: Input
|
|
1653
|
+
}], Editor: [{
|
|
1654
|
+
type: Input
|
|
1655
|
+
}], AddEditor: [{
|
|
1656
|
+
type: Input
|
|
1657
|
+
}] } });
|
|
1658
|
+
|
|
1659
|
+
class PromptComponent {
|
|
1660
|
+
constructor(dialogRef, data, formBuilder) {
|
|
1661
|
+
this.dialogRef = dialogRef;
|
|
1662
|
+
this.data = data;
|
|
1663
|
+
this.formBuilder = formBuilder;
|
|
1664
|
+
// Update view with given values
|
|
1665
|
+
this.title = data.title;
|
|
1666
|
+
this.message = data.message;
|
|
1667
|
+
this.form = this.formBuilder.group({
|
|
1668
|
+
prompt: [data.initialValue, data.required ? Validators.required : null],
|
|
1669
|
+
});
|
|
1670
|
+
}
|
|
1671
|
+
ngOnInit() {
|
|
1672
|
+
}
|
|
1673
|
+
onCancel() {
|
|
1674
|
+
// Close the dialog, return true
|
|
1675
|
+
this.dialogRef.close(false);
|
|
1676
|
+
}
|
|
1677
|
+
onOK() {
|
|
1678
|
+
// Close the dialog, return false
|
|
1679
|
+
this.dialogRef.close(this.form.value.prompt);
|
|
1680
|
+
}
|
|
1681
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: PromptComponent, deps: [{ token: i1$2.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: i1$3.UntypedFormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1682
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.17", type: PromptComponent, isStandalone: false, selector: "gloww-prompt", ngImport: i0, template: "<h1 mat-dialog-title>\r\n {{title}}\r\n</h1>\r\n\r\n<div mat-dialog-content [formGroup]=\"form\">\r\n <p [innerHTML]=\"message | safeHtml\"></p>\r\n <mat-form-field>\r\n <input matInput placeholder=\"Prompt\" formControlName=\"prompt\" style=\"width: calc(100% - 32px);\">\r\n </mat-form-field>\r\n</div>\r\n\r\n<mat-dialog-actions>\r\n <button mat-button (click)=\"onCancel()\">Cancel</button>\r\n <button mat-raised-button color=\"primary\" (click)=\"onOK()\">Yes</button>\r\n</mat-dialog-actions>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i1$3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i2$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "component", type: i4.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "pipe", type: SafeHtmlPipe, name: "safeHtml" }] }); }
|
|
1683
|
+
}
|
|
1684
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: PromptComponent, decorators: [{
|
|
1685
|
+
type: Component,
|
|
1686
|
+
args: [{ selector: 'gloww-prompt', standalone: false, template: "<h1 mat-dialog-title>\r\n {{title}}\r\n</h1>\r\n\r\n<div mat-dialog-content [formGroup]=\"form\">\r\n <p [innerHTML]=\"message | safeHtml\"></p>\r\n <mat-form-field>\r\n <input matInput placeholder=\"Prompt\" formControlName=\"prompt\" style=\"width: calc(100% - 32px);\">\r\n </mat-form-field>\r\n</div>\r\n\r\n<mat-dialog-actions>\r\n <button mat-button (click)=\"onCancel()\">Cancel</button>\r\n <button mat-raised-button color=\"primary\" (click)=\"onOK()\">Yes</button>\r\n</mat-dialog-actions>\r\n" }]
|
|
1687
|
+
}], ctorParameters: () => [{ type: i1$2.MatDialogRef }, { type: PromptModel, decorators: [{
|
|
1688
|
+
type: Inject,
|
|
1689
|
+
args: [MAT_DIALOG_DATA]
|
|
1690
|
+
}] }, { type: i1$3.UntypedFormBuilder }] });
|
|
1691
|
+
// tslint:disable-next-line: max-classes-per-file
|
|
1692
|
+
class PromptModel {
|
|
1693
|
+
constructor(title, message, initialValue, required) {
|
|
1694
|
+
this.title = title;
|
|
1695
|
+
this.message = message;
|
|
1696
|
+
this.initialValue = initialValue;
|
|
1697
|
+
this.required = required;
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
function retryWithDelay(delay$1, count = 1) {
|
|
1702
|
+
return (input) => input.pipe(retryWhen((errors) => errors.pipe(scan((acc, error) => ({ count: acc.count + 1, error }), {
|
|
1703
|
+
count: 0,
|
|
1704
|
+
error: undefined,
|
|
1705
|
+
}), tap((current) => {
|
|
1706
|
+
if (current.count > count) {
|
|
1707
|
+
throw current.error;
|
|
1708
|
+
}
|
|
1709
|
+
}), delay(delay$1))));
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
class SecurePipe {
|
|
1713
|
+
constructor(http, domSanitizer) {
|
|
1714
|
+
this.http = http;
|
|
1715
|
+
this.domSanitizer = domSanitizer;
|
|
1716
|
+
}
|
|
1717
|
+
transform(url, delayVal, retryVal) {
|
|
1718
|
+
if (!delayVal) {
|
|
1719
|
+
delayVal = 5000;
|
|
1720
|
+
}
|
|
1721
|
+
if (!retryVal) {
|
|
1722
|
+
retryVal = 0;
|
|
1723
|
+
}
|
|
1724
|
+
return this.http
|
|
1725
|
+
// load the image as a blob
|
|
1726
|
+
.get(url, { responseType: 'blob' })
|
|
1727
|
+
// create an object url of that blob that we can use in the src attribute
|
|
1728
|
+
.pipe(map(e => this.domSanitizer.bypassSecurityTrustUrl(URL.createObjectURL(e))), retryWithDelay(delayVal, retryVal));
|
|
1729
|
+
}
|
|
1730
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: SecurePipe, deps: [{ token: i1.HttpClient }, { token: i1$1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1731
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.17", ngImport: i0, type: SecurePipe, isStandalone: false, name: "secure" }); }
|
|
1732
|
+
}
|
|
1733
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: SecurePipe, decorators: [{
|
|
1734
|
+
type: Pipe,
|
|
1735
|
+
args: [{
|
|
1736
|
+
name: 'secure',
|
|
1737
|
+
standalone: false
|
|
1738
|
+
}]
|
|
1739
|
+
}], ctorParameters: () => [{ type: i1.HttpClient }, { type: i1$1.DomSanitizer }] });
|
|
1740
|
+
|
|
1741
|
+
class MenuListItemComponent {
|
|
1742
|
+
get expanded() {
|
|
1743
|
+
return this._expanded;
|
|
1744
|
+
}
|
|
1745
|
+
set expanded(value) {
|
|
1746
|
+
console.log("change expanded");
|
|
1747
|
+
this._expanded = value;
|
|
1748
|
+
}
|
|
1749
|
+
constructor(glowwService, navService, router) {
|
|
1750
|
+
this.navService = navService;
|
|
1751
|
+
this.router = router;
|
|
1752
|
+
this._expanded = false;
|
|
1753
|
+
this.ariaExpanded = this.expanded;
|
|
1754
|
+
this.falsePromise = new Promise((resolve, reject) => {
|
|
1755
|
+
resolve(false);
|
|
1756
|
+
});
|
|
1757
|
+
this.glowwService = glowwService;
|
|
1758
|
+
if (this.depth === undefined) {
|
|
1759
|
+
this.depth = 0;
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
ngAfterViewInit() {
|
|
1763
|
+
this._disabled = this.getDisabledPromise();
|
|
1764
|
+
this._hidden = this.getHiddenPromise();
|
|
1765
|
+
this.glowwService.basePathChange.subscribe(newUrl => {
|
|
1766
|
+
console.log(`basePathChange in menu ${newUrl}`);
|
|
1767
|
+
this._disabled = this.getDisabledPromise();
|
|
1768
|
+
this._hidden = this.getHiddenPromise();
|
|
1769
|
+
});
|
|
1770
|
+
}
|
|
1771
|
+
ngOnInit() {
|
|
1772
|
+
}
|
|
1773
|
+
onItemSelected(item) {
|
|
1774
|
+
if (item.children && item.children.length) {
|
|
1775
|
+
this.expanded = !this.expanded;
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
isActive(item) {
|
|
1779
|
+
let route = this.item.route;
|
|
1780
|
+
if (typeof this.item.route === 'function') {
|
|
1781
|
+
const routefct = this.item.route;
|
|
1782
|
+
route = routefct.call(this);
|
|
1783
|
+
return route ? this.router.isActive(route, true) : false;
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
routerLink(item) {
|
|
1787
|
+
//if (this.isDisabled(item)) return null;
|
|
1788
|
+
let route = this.item.route;
|
|
1789
|
+
if (typeof this.item.route === 'function') {
|
|
1790
|
+
const routefct = this.item.route;
|
|
1791
|
+
route = routefct.call(this);
|
|
1792
|
+
}
|
|
1793
|
+
return route;
|
|
1794
|
+
}
|
|
1795
|
+
getDisabledPromise() {
|
|
1796
|
+
//console.log(`isdisable item ${item.displayName} ${item.disabled}`);
|
|
1797
|
+
if (!this.item.disabled) {
|
|
1798
|
+
return this.falsePromise;
|
|
1799
|
+
}
|
|
1800
|
+
return this.item.disabled();
|
|
1801
|
+
}
|
|
1802
|
+
getHiddenPromise() {
|
|
1803
|
+
if (!this.item.hidden) {
|
|
1804
|
+
return this.falsePromise;
|
|
1805
|
+
}
|
|
1806
|
+
return this.item.hidden();
|
|
1807
|
+
}
|
|
1808
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: MenuListItemComponent, deps: [{ token: 'glowwService' }, { token: NavService }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1809
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.17", type: MenuListItemComponent, isStandalone: false, selector: "gloww-menu-list-item", inputs: { item: "item", depth: "depth" }, host: { properties: { "attr.aria-expanded": "this.ariaExpanded" } }, ngImport: i0, template: "@if (item) {\n @if (!(_hidden | async)) {\n <div class=\"thisMenu\" (click)=\"onItemSelected(item)\" [class.disabled]=\"(_disabled | async)\">\n <a mat-list-item\n [ngStyle]=\"{'padding-left': (depth * 12) + 'px'}\"\n [ngClass]=\"{'active': isActive(item) && !(_disabled | async), 'expanded': expanded}\"\n class=\"menu-list-item\"\n [routerLink]=\"routerLink(item)\">\n <mat-icon class=\"routeIcon\">\n <i [ngClass]=\"item.icon\" [ngStyle]=\"item.iconStyle\"></i>\n </mat-icon>\n <span class=\"menu-label\">{{item.displayName}}</span>\n </a>\n @if (item.children?.length && !(_disabled | async)) {\n <div class=\"expand-container\">\n <mat-icon [@indicatorRotate]=\"expanded ? 'expanded': 'collapsed'\" class=\"expandIcon\">\n expand_more\n </mat-icon>\n </div>\n }\n </div>\n }\n @if (expanded && !(_disabled | async)) {\n <div>\n @for (child of item.children; track child) {\n <gloww-menu-list-item [item]=\"child\" [depth]=\"depth+1\">\n </gloww-menu-list-item>\n }\n </div>\n }\n}", styles: [".thisMenu{display:flex;flex-direction:row;align-items:center;outline:none;width:calc(100% - 20px);margin:10px;cursor:pointer}.menu-list-item{display:flex;align-items:center;flex:1;padding:8px 0;text-decoration:none;color:inherit;min-width:0}.menu-list-item .routeIcon{margin-right:20px;flex-shrink:0}.menu-list-item .menu-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.expand-container{display:flex;align-items:center;justify-content:center;flex-shrink:0}mat-icon{height:32px;width:40px;display:flex;align-items:center;justify-content:center}.expandIcon{cursor:pointer}:disabled,.disabled{color:#d3d3d3!important;pointer-events:none}:disabled mat-icon i,.disabled mat-icon i{color:#d3d3d3!important}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i1$4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MenuListItemComponent, selector: "gloww-menu-list-item", inputs: ["item", "depth"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }], animations: [
|
|
1810
|
+
trigger('indicatorRotate', [
|
|
1811
|
+
state('collapsed', style({ transform: 'rotate(0deg)' })),
|
|
1812
|
+
state('expanded', style({ transform: 'rotate(180deg)' })),
|
|
1813
|
+
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4,0.0,0.2,1)'))
|
|
1814
|
+
])
|
|
1815
|
+
] }); }
|
|
1816
|
+
}
|
|
1817
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: MenuListItemComponent, decorators: [{
|
|
1818
|
+
type: Component,
|
|
1819
|
+
args: [{ selector: 'gloww-menu-list-item', animations: [
|
|
1820
|
+
trigger('indicatorRotate', [
|
|
1821
|
+
state('collapsed', style({ transform: 'rotate(0deg)' })),
|
|
1822
|
+
state('expanded', style({ transform: 'rotate(180deg)' })),
|
|
1823
|
+
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4,0.0,0.2,1)'))
|
|
1824
|
+
])
|
|
1825
|
+
], standalone: false, template: "@if (item) {\n @if (!(_hidden | async)) {\n <div class=\"thisMenu\" (click)=\"onItemSelected(item)\" [class.disabled]=\"(_disabled | async)\">\n <a mat-list-item\n [ngStyle]=\"{'padding-left': (depth * 12) + 'px'}\"\n [ngClass]=\"{'active': isActive(item) && !(_disabled | async), 'expanded': expanded}\"\n class=\"menu-list-item\"\n [routerLink]=\"routerLink(item)\">\n <mat-icon class=\"routeIcon\">\n <i [ngClass]=\"item.icon\" [ngStyle]=\"item.iconStyle\"></i>\n </mat-icon>\n <span class=\"menu-label\">{{item.displayName}}</span>\n </a>\n @if (item.children?.length && !(_disabled | async)) {\n <div class=\"expand-container\">\n <mat-icon [@indicatorRotate]=\"expanded ? 'expanded': 'collapsed'\" class=\"expandIcon\">\n expand_more\n </mat-icon>\n </div>\n }\n </div>\n }\n @if (expanded && !(_disabled | async)) {\n <div>\n @for (child of item.children; track child) {\n <gloww-menu-list-item [item]=\"child\" [depth]=\"depth+1\">\n </gloww-menu-list-item>\n }\n </div>\n }\n}", styles: [".thisMenu{display:flex;flex-direction:row;align-items:center;outline:none;width:calc(100% - 20px);margin:10px;cursor:pointer}.menu-list-item{display:flex;align-items:center;flex:1;padding:8px 0;text-decoration:none;color:inherit;min-width:0}.menu-list-item .routeIcon{margin-right:20px;flex-shrink:0}.menu-list-item .menu-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.expand-container{display:flex;align-items:center;justify-content:center;flex-shrink:0}mat-icon{height:32px;width:40px;display:flex;align-items:center;justify-content:center}.expandIcon{cursor:pointer}:disabled,.disabled{color:#d3d3d3!important;pointer-events:none}:disabled mat-icon i,.disabled mat-icon i{color:#d3d3d3!important}\n"] }]
|
|
1826
|
+
}], ctorParameters: () => [{ type: GlowwService, decorators: [{
|
|
1827
|
+
type: Inject,
|
|
1828
|
+
args: ['glowwService']
|
|
1829
|
+
}] }, { type: NavService }, { type: i2.Router }], propDecorators: { ariaExpanded: [{
|
|
1830
|
+
type: HostBinding,
|
|
1831
|
+
args: ['attr.aria-expanded']
|
|
1832
|
+
}], item: [{
|
|
1833
|
+
type: Input
|
|
1834
|
+
}], depth: [{
|
|
1835
|
+
type: Input
|
|
1836
|
+
}] } });
|
|
1837
|
+
|
|
1838
|
+
class SnippetsService {
|
|
1839
|
+
constructor(http) {
|
|
1840
|
+
this.http = http;
|
|
1841
|
+
}
|
|
1842
|
+
getSnippets(path) {
|
|
1843
|
+
return this.http.get(path);
|
|
1844
|
+
}
|
|
1845
|
+
getSnippetCode(path) {
|
|
1846
|
+
return this.http.get(path, {
|
|
1847
|
+
responseType: 'text'
|
|
1848
|
+
});
|
|
1849
|
+
}
|
|
1850
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: SnippetsService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1851
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: SnippetsService, providedIn: 'root' }); }
|
|
1852
|
+
}
|
|
1853
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: SnippetsService, decorators: [{
|
|
1854
|
+
type: Injectable,
|
|
1855
|
+
args: [{
|
|
1856
|
+
providedIn: 'root'
|
|
1857
|
+
}]
|
|
1858
|
+
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
|
1859
|
+
|
|
1860
|
+
class CodeEditorComponent {
|
|
1861
|
+
constructor(snippetsService, glowwService) {
|
|
1862
|
+
this.snippetsService = snippetsService;
|
|
1863
|
+
this.glowwService = glowwService;
|
|
1864
|
+
this._value = null;
|
|
1865
|
+
this.display = null;
|
|
1866
|
+
this.mode = "text/typescript";
|
|
1867
|
+
this.formatterOptions = { useTabs: true, printWidth: 160 };
|
|
1868
|
+
this.onChange = () => { };
|
|
1869
|
+
this.onTouched = () => { };
|
|
1870
|
+
this.resizable = true;
|
|
1871
|
+
this.doc = null;
|
|
1872
|
+
this.extraKeys = {
|
|
1873
|
+
"Alt-K": function (cm) { alert('Alt-K'); cm.blockComment(cm.doc.getCursor('from'), cm.doc.getCursor('to')); /*cm.toggleComment();*/ },
|
|
1874
|
+
"Shift-Alt-K": "toggleComment",
|
|
1875
|
+
"Alt-N": this.autoFormatSelection.bind(this)
|
|
1876
|
+
};
|
|
1877
|
+
}
|
|
1878
|
+
ngAfterViewInit() {
|
|
1879
|
+
console.log(this.codeMirrorComponent);
|
|
1880
|
+
console.log(this.codeMirrorComponent.codeMirror);
|
|
1881
|
+
this.doc = this.codeMirrorComponent.codeMirror?.getDoc();
|
|
1882
|
+
console.log(this.doc);
|
|
1883
|
+
if (this.snippetsPath) {
|
|
1884
|
+
this.snippetsService.getSnippets(this.snippetsPath.replace("/assets/", this.glowwService.baseHref + "/assets/")).subscribe((snippets) => {
|
|
1885
|
+
if (!this.snippets) {
|
|
1886
|
+
this.snippets = [];
|
|
1887
|
+
}
|
|
1888
|
+
snippets.forEach((snippet) => this.snippets.push(snippet));
|
|
1889
|
+
});
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
get value() {
|
|
1893
|
+
return this._value;
|
|
1894
|
+
}
|
|
1895
|
+
set value(val) {
|
|
1896
|
+
this._value = val;
|
|
1897
|
+
this.onChange(val);
|
|
1898
|
+
this.onTouched();
|
|
1899
|
+
}
|
|
1900
|
+
writeValue(obj) {
|
|
1901
|
+
if (typeof (obj) === 'object' && obj != null) {
|
|
1902
|
+
this.value = JSON.stringify(obj);
|
|
1903
|
+
}
|
|
1904
|
+
else {
|
|
1905
|
+
this.value = obj;
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
registerOnChange(fn) {
|
|
1909
|
+
this.onChange = fn;
|
|
1910
|
+
}
|
|
1911
|
+
registerOnTouched(fn) {
|
|
1912
|
+
this.onTouched = fn;
|
|
1913
|
+
}
|
|
1914
|
+
setDisabledState(isDisabled) {
|
|
1915
|
+
//throw new Error('Method not implemented.');
|
|
1916
|
+
}
|
|
1917
|
+
insert() {
|
|
1918
|
+
this.doc = this.codeMirrorComponent.codeMirror?.getDoc();
|
|
1919
|
+
var cursor = this.doc.getCursor();
|
|
1920
|
+
if (this.currentSnippet.code) {
|
|
1921
|
+
this.doc.replaceRange(this.currentSnippet.code, cursor);
|
|
1922
|
+
}
|
|
1923
|
+
if (this.currentSnippet.externfile) {
|
|
1924
|
+
this.snippetsService.getSnippetCode(this.currentSnippet.externfile).subscribe((code) => this.doc.replaceRange(code, cursor));
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
getSelectedRange(doc) {
|
|
1928
|
+
return { from: doc.getCursor('from'), to: doc.getCursor('to') };
|
|
1929
|
+
}
|
|
1930
|
+
getFormatter() {
|
|
1931
|
+
if (this.formatter)
|
|
1932
|
+
return this.formatter;
|
|
1933
|
+
if (this.mode.match(/typescript/)) {
|
|
1934
|
+
return "typescript";
|
|
1935
|
+
}
|
|
1936
|
+
return null;
|
|
1937
|
+
}
|
|
1938
|
+
autoFormatSelection(cm) {
|
|
1939
|
+
try {
|
|
1940
|
+
const formatter = this.getFormatter();
|
|
1941
|
+
if (!formatter) {
|
|
1942
|
+
alert("no formatter defined for this code");
|
|
1943
|
+
return;
|
|
1944
|
+
}
|
|
1945
|
+
let options = { ...this.formatterOptions };
|
|
1946
|
+
options.parser = formatter;
|
|
1947
|
+
options.plugins = [parserTypescript, parserBabel];
|
|
1948
|
+
cm.doc.setValue(prettier.format(cm.doc.getValue(), options));
|
|
1949
|
+
}
|
|
1950
|
+
catch (ex) {
|
|
1951
|
+
alert(`Unable to format this code, check Syntax`);
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: CodeEditorComponent, deps: [{ token: SnippetsService }, { token: GlowwService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1955
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.17", type: CodeEditorComponent, isStandalone: false, selector: "gloww-code-editor", inputs: { _value: ["value", "_value"], display: "display", mode: "mode", formatter: "formatter", formatterOptions: "formatterOptions", snippets: "snippets", snippetsPath: "snippetsPath" }, providers: [
|
|
1956
|
+
{
|
|
1957
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1958
|
+
multi: true,
|
|
1959
|
+
useExisting: CodeEditorComponent
|
|
1960
|
+
}
|
|
1961
|
+
], viewQueries: [{ propertyName: "codeMirrorComponent", first: true, predicate: CodemirrorComponent, descendants: true }], ngImport: i0, template: "<div class=\"editor-container mainDiv\">\n <mat-label>{{display}}</mat-label>\n\n @if (snippets?.length) {\n <div class=\"snippet-header\">\n <mat-select [(ngModel)]=\"currentSnippet\" class=\"snippet-select\">\n @for (snippet of snippets; track snippet) {\n <mat-option [value]=\"snippet\">{{snippet.name}}</mat-option>\n }\n </mat-select>\n <button mat-stroked-button color=\"primary\" type=\"button\" (click)=\"insert()\">Insert</button>\n </div>\n }\n\n <ngx-codemirror\n [(ngModel)]=\"value\"\n [options]=\"{lineNumbers: true, theme: 'eclipse', indentWithTabs:true, indentUnit: 4, matchBrackets: true, mode: mode, fixedGutter:false, extraKeys: extraKeys}\"\n class=\"editor-full-width\">\n </ngx-codemirror>\n</div>", styles: [".CodeMirror{resize:both;padding:0;margin:0}.sameSize{padding:0;margin:0;border:1px solid}.mainDiv{display:flex;flex-direction:column;align-items:stretch;width:100%;height:100%;min-height:100%}.snippet-header{display:flex;flex-direction:row;align-items:center;gap:8px;width:100%}.snippet-select{flex:1 1 auto}.editor-full-width{width:100%}\n"], dependencies: [{ kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "component", type: i4.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i3$2.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i3$2.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i7.CodemirrorComponent, selector: "ngx-codemirror", inputs: ["className", "name", "autoFocus", "options", "preserveScrollPosition"], outputs: ["cursorActivity", "focusChange", "scroll", "drop"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1962
|
+
}
|
|
1963
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: CodeEditorComponent, decorators: [{
|
|
1964
|
+
type: Component,
|
|
1965
|
+
args: [{ selector: 'gloww-code-editor', encapsulation: ViewEncapsulation.None, providers: [
|
|
1966
|
+
{
|
|
1967
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1968
|
+
multi: true,
|
|
1969
|
+
useExisting: CodeEditorComponent
|
|
1970
|
+
}
|
|
1971
|
+
], standalone: false, template: "<div class=\"editor-container mainDiv\">\n <mat-label>{{display}}</mat-label>\n\n @if (snippets?.length) {\n <div class=\"snippet-header\">\n <mat-select [(ngModel)]=\"currentSnippet\" class=\"snippet-select\">\n @for (snippet of snippets; track snippet) {\n <mat-option [value]=\"snippet\">{{snippet.name}}</mat-option>\n }\n </mat-select>\n <button mat-stroked-button color=\"primary\" type=\"button\" (click)=\"insert()\">Insert</button>\n </div>\n }\n\n <ngx-codemirror\n [(ngModel)]=\"value\"\n [options]=\"{lineNumbers: true, theme: 'eclipse', indentWithTabs:true, indentUnit: 4, matchBrackets: true, mode: mode, fixedGutter:false, extraKeys: extraKeys}\"\n class=\"editor-full-width\">\n </ngx-codemirror>\n</div>", styles: [".CodeMirror{resize:both;padding:0;margin:0}.sameSize{padding:0;margin:0;border:1px solid}.mainDiv{display:flex;flex-direction:column;align-items:stretch;width:100%;height:100%;min-height:100%}.snippet-header{display:flex;flex-direction:row;align-items:center;gap:8px;width:100%}.snippet-select{flex:1 1 auto}.editor-full-width{width:100%}\n"] }]
|
|
1972
|
+
}], ctorParameters: () => [{ type: SnippetsService }, { type: GlowwService }], propDecorators: { _value: [{
|
|
1973
|
+
type: Input,
|
|
1974
|
+
args: ['value']
|
|
1975
|
+
}], display: [{
|
|
1976
|
+
type: Input,
|
|
1977
|
+
args: ['display']
|
|
1978
|
+
}], mode: [{
|
|
1979
|
+
type: Input,
|
|
1980
|
+
args: ['mode']
|
|
1981
|
+
}], formatter: [{
|
|
1982
|
+
type: Input,
|
|
1983
|
+
args: ['formatter']
|
|
1984
|
+
}], formatterOptions: [{
|
|
1985
|
+
type: Input,
|
|
1986
|
+
args: ['formatterOptions']
|
|
1987
|
+
}], snippets: [{
|
|
1988
|
+
type: Input,
|
|
1989
|
+
args: ['snippets']
|
|
1990
|
+
}], snippetsPath: [{
|
|
1991
|
+
type: Input,
|
|
1992
|
+
args: ['snippetsPath']
|
|
1993
|
+
}], codeMirrorComponent: [{
|
|
1994
|
+
type: ViewChild,
|
|
1995
|
+
args: [CodemirrorComponent]
|
|
1996
|
+
}] } });
|
|
1997
|
+
|
|
1998
|
+
class SocialNetworkComponent {
|
|
1999
|
+
// oAuthAssociations: string[];
|
|
2000
|
+
// oAuthProviders: string[];
|
|
2001
|
+
constructor(authenticationService) {
|
|
2002
|
+
this.authenticationService = authenticationService;
|
|
2003
|
+
this.callback = new EventEmitter();
|
|
2004
|
+
this.icons = {
|
|
2005
|
+
Google: "fa-brands fa-google",
|
|
2006
|
+
LinkedIN: "fa-brands fa-linkedin",
|
|
2007
|
+
Facebook: "fa-brands fa-facebook",
|
|
2008
|
+
Github: "fa-brands fa-github",
|
|
2009
|
+
Amazon: "fa-brands fa-amazon",
|
|
2010
|
+
Apple: "fa-brands fa-apple",
|
|
2011
|
+
Microsoft: "fa-brands fa-microsoft",
|
|
2012
|
+
Twitter: "fa-brands fa-twitter",
|
|
2013
|
+
VK: "fa-brands fa-vk",
|
|
2014
|
+
};
|
|
2015
|
+
// this.authenticationService.getOAuthProviders().subscribe(oap => this.oAuthProviders = oap);
|
|
2016
|
+
// this.authenticationService.getOAuthAssociations().subscribe(oap => this.oAuthAssociations = oap);
|
|
2017
|
+
}
|
|
2018
|
+
ngOnInit() {
|
|
2019
|
+
}
|
|
2020
|
+
execute(provider) {
|
|
2021
|
+
this.callback.emit(provider);
|
|
2022
|
+
}
|
|
2023
|
+
writeobj(provider) {
|
|
2024
|
+
console.log(provider);
|
|
2025
|
+
}
|
|
2026
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: SocialNetworkComponent, deps: [{ token: AuthenticationService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2027
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.17", type: SocialNetworkComponent, isStandalone: false, selector: "gloww-social-network", inputs: { oAuthProviders: "oAuthProviders" }, outputs: { callback: "callback" }, ngImport: i0, template: "@if (oAuthProviders) {\n <div class=\"social-network-container\">\n @for (provider of oAuthProviders; track provider) {\n <a (click)=\"execute(provider)\" class=\"provider-link\" [title]=\"provider\">\n <i [ngClass]=\"icons[provider.toString()]\"></i>\n </a>\n }\n </div>\n}", styles: [".social-network-container{display:flex;flex-direction:row;justify-content:center;align-items:center;gap:20px;width:100%;margin:15px 0}.provider-link{cursor:pointer;transition:transform .2s ease-in-out;display:flex;align-items:center;justify-content:center}.provider-link:hover{transform:scale(1.2)}.provider-link i{font-size:24px}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
|
|
2028
|
+
}
|
|
2029
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: SocialNetworkComponent, decorators: [{
|
|
2030
|
+
type: Component,
|
|
2031
|
+
args: [{ selector: 'gloww-social-network', standalone: false, template: "@if (oAuthProviders) {\n <div class=\"social-network-container\">\n @for (provider of oAuthProviders; track provider) {\n <a (click)=\"execute(provider)\" class=\"provider-link\" [title]=\"provider\">\n <i [ngClass]=\"icons[provider.toString()]\"></i>\n </a>\n }\n </div>\n}", styles: [".social-network-container{display:flex;flex-direction:row;justify-content:center;align-items:center;gap:20px;width:100%;margin:15px 0}.provider-link{cursor:pointer;transition:transform .2s ease-in-out;display:flex;align-items:center;justify-content:center}.provider-link:hover{transform:scale(1.2)}.provider-link i{font-size:24px}\n"] }]
|
|
2032
|
+
}], ctorParameters: () => [{ type: AuthenticationService }], propDecorators: { oAuthProviders: [{
|
|
2033
|
+
type: Input
|
|
2034
|
+
}], callback: [{
|
|
2035
|
+
type: Output
|
|
2036
|
+
}] } });
|
|
2037
|
+
|
|
2038
|
+
class LoginComponent {
|
|
2039
|
+
constructor(formBuilder, route, router, authenticationService, config) {
|
|
2040
|
+
this.formBuilder = formBuilder;
|
|
2041
|
+
this.route = route;
|
|
2042
|
+
this.router = router;
|
|
2043
|
+
this.authenticationService = authenticationService;
|
|
2044
|
+
this.loading = false;
|
|
2045
|
+
this.submitted = false;
|
|
2046
|
+
this.error = '';
|
|
2047
|
+
this.showDomain = false;
|
|
2048
|
+
this.state = 1;
|
|
2049
|
+
// redirect to home if already logged in
|
|
2050
|
+
if (this.authenticationService.currentUserValue) {
|
|
2051
|
+
this.router.navigate(['/']);
|
|
2052
|
+
}
|
|
2053
|
+
this.config = config;
|
|
2054
|
+
if (config && config.showDomain) {
|
|
2055
|
+
this.showDomain = config.showDomain;
|
|
2056
|
+
}
|
|
2057
|
+
this.authenticationService.getOAuthProviders().subscribe(oap => this.oAuthProviders = oap);
|
|
2058
|
+
}
|
|
2059
|
+
MatchPassword(fg) {
|
|
2060
|
+
if (!fg) {
|
|
2061
|
+
return;
|
|
2062
|
+
}
|
|
2063
|
+
return fg.get('newpassword')?.value === fg.get('confirmationPassword')?.value;
|
|
2064
|
+
}
|
|
2065
|
+
ngOnInit() {
|
|
2066
|
+
const grp = {
|
|
2067
|
+
username: ['', Validators.required],
|
|
2068
|
+
password: ['', Validators.required]
|
|
2069
|
+
};
|
|
2070
|
+
const lostPwd = {
|
|
2071
|
+
email: ['', Validators.required],
|
|
2072
|
+
gsm: [''],
|
|
2073
|
+
firstname: ['', Validators.required],
|
|
2074
|
+
lastname: ['', Validators.required]
|
|
2075
|
+
};
|
|
2076
|
+
const resetPwd = {
|
|
2077
|
+
email: ['', Validators.required],
|
|
2078
|
+
code: ['', Validators.required],
|
|
2079
|
+
newPassword: ['', Validators.required],
|
|
2080
|
+
confirmationPassword: ['', Validators.required]
|
|
2081
|
+
};
|
|
2082
|
+
if (this.showDomain) {
|
|
2083
|
+
grp.domain = [''];
|
|
2084
|
+
}
|
|
2085
|
+
this.loginForm = this.formBuilder.group(grp);
|
|
2086
|
+
this.lostPasswordForm = this.formBuilder.group(lostPwd);
|
|
2087
|
+
this.resetPasswordForm = this.formBuilder.group(resetPwd, { validator: this.MatchPassword });
|
|
2088
|
+
// get return url from route parameters or default to '/'
|
|
2089
|
+
this.returnUrl = this.route.snapshot.queryParams.returnUrl; //|| window.location.search;
|
|
2090
|
+
this.application = this.route.snapshot.queryParams.application; //|| window.location.pathname;
|
|
2091
|
+
console.log(`returnUrl : ${this.returnUrl}`);
|
|
2092
|
+
console.log(`application : ${this.application}`);
|
|
2093
|
+
this.idOauth = this.route.snapshot.queryParams.idOauth;
|
|
2094
|
+
this.provider = this.route.snapshot.queryParams.provider;
|
|
2095
|
+
this.name = this.route.snapshot.queryParams.name;
|
|
2096
|
+
this.value = this.route.snapshot.queryParams.value;
|
|
2097
|
+
if (this.idOauth) {
|
|
2098
|
+
this.state = 4;
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
// convenience getter for easy access to form fields
|
|
2102
|
+
get f() { return this.loginForm.controls; }
|
|
2103
|
+
resetError() {
|
|
2104
|
+
this.error = "";
|
|
2105
|
+
}
|
|
2106
|
+
onConnect() {
|
|
2107
|
+
this.submitted = true;
|
|
2108
|
+
this.error = "";
|
|
2109
|
+
// stop here if form is invalid
|
|
2110
|
+
if (this.loginForm.invalid) {
|
|
2111
|
+
return;
|
|
2112
|
+
}
|
|
2113
|
+
this.loading = true;
|
|
2114
|
+
let domain = '';
|
|
2115
|
+
if (this.showDomain) {
|
|
2116
|
+
domain = this.f.domain.value;
|
|
2117
|
+
}
|
|
2118
|
+
this.authenticationService.login(domain, this.f.username.value, this.f.password.value)
|
|
2119
|
+
.pipe(first())
|
|
2120
|
+
.subscribe(data => {
|
|
2121
|
+
console.log(`navigate to ${this.returnUrl}`);
|
|
2122
|
+
this.router.navigate([this.returnUrl]);
|
|
2123
|
+
}, error => {
|
|
2124
|
+
if (error.error?.Code) {
|
|
2125
|
+
switch (error.error?.Code) {
|
|
2126
|
+
case 'BADAUTH':
|
|
2127
|
+
this.error = 'Utilisateur inconnu ou mauvais mot de passe. Veuillez vérifier vos identifiants.';
|
|
2128
|
+
break;
|
|
2129
|
+
case 'WEAKPASSWORD':
|
|
2130
|
+
this.error = 'Le mot de passe que vous avez utilisez est trop faible. S\'il s\'agit effectivement de votre mot de passe, veuillez le réinitialiser au moyen de la fonctionnalité "Mot de passe oublié". ';
|
|
2131
|
+
break;
|
|
2132
|
+
case 'BLACKLISTEDIP':
|
|
2133
|
+
this.error = `Trop de tentatives de connexion à partir de cette adresse IP(${error.error?.Params?.IP}).Vous ne pouvez plus vous connecter à partir de ce poste.`;
|
|
2134
|
+
break;
|
|
2135
|
+
case 'TOOMANYFROMIP':
|
|
2136
|
+
this.error = `Trop de tentatives de connexion, à partir de cette adresse IP(${error.error?.Params?.IP}).Vous ne pouvez pas réessayer pendant ${error.error?.Params?.nbrMinutes} minutes.`;
|
|
2137
|
+
break;
|
|
2138
|
+
case 'TOOMANYFORUSERNAME':
|
|
2139
|
+
this.error = `Trop de tentatives de connexion pour cet utilisateur(${error.error?.Params?.Username}).Vous ne pouvez pas réessayer pendant ${error.error?.Params?.nbrMinutes} minutes.`;
|
|
2140
|
+
break;
|
|
2141
|
+
}
|
|
2142
|
+
if (!this.error)
|
|
2143
|
+
this.error = error.error.Message;
|
|
2144
|
+
}
|
|
2145
|
+
else {
|
|
2146
|
+
this.error = 'Impossible de se connecter. ';
|
|
2147
|
+
}
|
|
2148
|
+
this.loading = false;
|
|
2149
|
+
});
|
|
2150
|
+
}
|
|
2151
|
+
onAskResetPasswordCode() {
|
|
2152
|
+
let gsm = this.lostPasswordForm.value.gsm;
|
|
2153
|
+
if (!this.config?.askGSM) {
|
|
2154
|
+
gsm = '--noGSM--';
|
|
2155
|
+
}
|
|
2156
|
+
this.authenticationService
|
|
2157
|
+
.askResetPasswordCode('', this.lostPasswordForm.value.firstname, this.lostPasswordForm.value.lastname, this.lostPasswordForm.value.email, gsm)
|
|
2158
|
+
.subscribe(d => { }, error => { });
|
|
2159
|
+
this.state = 3;
|
|
2160
|
+
}
|
|
2161
|
+
onResetPassword() {
|
|
2162
|
+
this.authenticationService
|
|
2163
|
+
.resetPassword(this.resetPasswordForm.value.email, this.resetPasswordForm.value.code, this.resetPasswordForm.value.newPassword)
|
|
2164
|
+
.subscribe(d => { }, error => { });
|
|
2165
|
+
this.state = 1;
|
|
2166
|
+
}
|
|
2167
|
+
OAuthSignIn(provider) {
|
|
2168
|
+
const url = `${window.location.origin}/admin/AuthUsers/OAuth/${provider}/${this.config.environment}?returnUrl=${encodeURI(this.returnUrl)}&application=${encodeURI(this.application)}&loginUrl=${encodeURI(window.location.pathname)}¤tUserVariableName=${this.authenticationService.currentUserVariableName}`;
|
|
2169
|
+
window.location.href = url;
|
|
2170
|
+
}
|
|
2171
|
+
onOAuthAskCode() {
|
|
2172
|
+
this.authenticationService
|
|
2173
|
+
.OAuthAskCode(this.authenticationService.environment, this.resetPasswordForm.value.email, this.idOauth, this.provider, this.name, this.value)
|
|
2174
|
+
.subscribe(d => {
|
|
2175
|
+
this.state = 5;
|
|
2176
|
+
}, error => { });
|
|
2177
|
+
}
|
|
2178
|
+
onOAuthAssociation() {
|
|
2179
|
+
this.authenticationService
|
|
2180
|
+
.OAuthAssociation(this.authenticationService.environment, this.resetPasswordForm.value.code, this.idOauth, this.provider, this.name, this.value)
|
|
2181
|
+
.subscribe(user => {
|
|
2182
|
+
console.log(user);
|
|
2183
|
+
window.location.href = this.returnUrl;
|
|
2184
|
+
}, error => { });
|
|
2185
|
+
}
|
|
2186
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: LoginComponent, deps: [{ token: i1$3.UntypedFormBuilder }, { token: i2.ActivatedRoute }, { token: i2.Router }, { token: AuthenticationService }, { token: AuthenticationServiceConfig, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2187
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.17", type: LoginComponent, isStandalone: false, selector: "gloww-login", ngImport: i0, template: "<div class=\"login-wrapper center-layout\">\n <mat-card appearance=\"outlined\" class=\"login-card\">\n <mat-card-header>\n <mat-card-title>Connexion</mat-card-title>\n </mat-card-header>\n\n @if (state==1) {\n <form class=\"example-form\" [formGroup]=\"loginForm\" (ngSubmit)=\"onConnect()\">\n <mat-card-content class=\"form-grid\">\n @if (error) {\n <span class=\"error-msg full-width\">{{error}}</span>\n }\n @if (showDomain) {\n <mat-form-field class=\"full-width\">\n <mat-label>Domain</mat-label>\n <input matInput formControlName=\"domain\" (change)=\"resetError()\">\n </mat-form-field>\n }\n <mat-form-field class=\"full-width\">\n <mat-label>Username</mat-label>\n <input matInput formControlName=\"username\" (change)=\"resetError()\">\n </mat-form-field>\n <mat-form-field class=\"full-width\">\n <mat-label>Password</mat-label>\n <input matInput formControlName=\"password\" type=\"password\" (change)=\"resetError()\">\n </mat-form-field>\n </mat-card-content>\n <div class=\"action-buttons-row\">\n <button mat-raised-button color=\"primary\" type=\"submit\">Me Connecter</button>\n <button mat-stroked-button color=\"primary\" type=\"button\" (click)=\"state=2; resetError();\">\n Mot de passe oubli\u00E9\n </button>\n </div>\n <div class=\"social-divider\">\n <gloww-social-network (callback)=\"OAuthSignIn($event)\" [oAuthProviders]=\"oAuthProviders\"></gloww-social-network>\n </div>\n </form>\n }\n\n @if (state==2) {\n <form class=\"example-form\" [formGroup]=\"lostPasswordForm\" (ngSubmit)=\"onAskResetPasswordCode()\">\n <mat-card-content class=\"form-grid\">\n @if (error) {\n <span class=\"error-msg full-width\">{{error}}</span>\n }\n </mat-card-content>\n <div class=\"action-buttons-column\">\n <button mat-raised-button color=\"primary\" class=\"btn-block\" type=\"submit\">Demande de r\u00E9initialisation</button>\n <button mat-stroked-button color=\"primary\" class=\"btn-block\" (click)=\"state=3\">J'ai un code</button>\n </div>\n </form>\n }\n\n </mat-card>\n</div>", styles: ["body{background-image:url(https://lh4.googleusercontent.com/-XplyTa1Za-I/VMSgIyAYkHI/AAAAAAAADxM/oL-rD6VP4ts/w1184-h666/Android-Lollipop-wallpapers-Google-Now-Wallpaper-2.png);background-position:center;background-size:cover;background-repeat:no-repeat;min-height:100vh;font-family:Roboto,sans-serif;margin:0}.login-wrapper{height:100vh;display:flex}.center-layout{justify-content:center;align-items:center}.login-card{padding:40px 70px 50px!important;max-width:500px;width:100%}.login-card mat-card-header{text-align:center;display:block;font-weight:700;margin-bottom:20px}.login-card mat-card-header mat-card-title{font-size:30px;margin:0}.form-grid{display:flex;flex-flow:row wrap;justify-content:space-between;align-items:center}.full-width{flex:1 1 100%;width:100%}.error-msg{color:red;font-weight:700;margin-bottom:10px}.action-buttons-row{display:flex;flex-direction:row;justify-content:flex-end;align-items:center;gap:20px;margin-top:20px}.action-buttons-column{display:flex;flex-direction:column;gap:10px;margin-top:20px}.action-buttons-column .btn-block{width:100%}.social-divider{margin-top:20px;padding-top:20px;border-top:1px solid #eee}.SocialNetwork a{margin:10px}.SocialNetwork a i{padding:10px}\n"], dependencies: [{ kind: "directive", type: i1$3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i4.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: i2$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "component", type: i3$1.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i3$1.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: i3$1.MatCardHeader, selector: "mat-card-header" }, { kind: "directive", type: i3$1.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "component", type: SocialNetworkComponent, selector: "gloww-social-network", inputs: ["oAuthProviders"], outputs: ["callback"] }] }); }
|
|
2188
|
+
}
|
|
2189
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: LoginComponent, decorators: [{
|
|
2190
|
+
type: Component,
|
|
2191
|
+
args: [{ selector: 'gloww-login', standalone: false, template: "<div class=\"login-wrapper center-layout\">\n <mat-card appearance=\"outlined\" class=\"login-card\">\n <mat-card-header>\n <mat-card-title>Connexion</mat-card-title>\n </mat-card-header>\n\n @if (state==1) {\n <form class=\"example-form\" [formGroup]=\"loginForm\" (ngSubmit)=\"onConnect()\">\n <mat-card-content class=\"form-grid\">\n @if (error) {\n <span class=\"error-msg full-width\">{{error}}</span>\n }\n @if (showDomain) {\n <mat-form-field class=\"full-width\">\n <mat-label>Domain</mat-label>\n <input matInput formControlName=\"domain\" (change)=\"resetError()\">\n </mat-form-field>\n }\n <mat-form-field class=\"full-width\">\n <mat-label>Username</mat-label>\n <input matInput formControlName=\"username\" (change)=\"resetError()\">\n </mat-form-field>\n <mat-form-field class=\"full-width\">\n <mat-label>Password</mat-label>\n <input matInput formControlName=\"password\" type=\"password\" (change)=\"resetError()\">\n </mat-form-field>\n </mat-card-content>\n <div class=\"action-buttons-row\">\n <button mat-raised-button color=\"primary\" type=\"submit\">Me Connecter</button>\n <button mat-stroked-button color=\"primary\" type=\"button\" (click)=\"state=2; resetError();\">\n Mot de passe oubli\u00E9\n </button>\n </div>\n <div class=\"social-divider\">\n <gloww-social-network (callback)=\"OAuthSignIn($event)\" [oAuthProviders]=\"oAuthProviders\"></gloww-social-network>\n </div>\n </form>\n }\n\n @if (state==2) {\n <form class=\"example-form\" [formGroup]=\"lostPasswordForm\" (ngSubmit)=\"onAskResetPasswordCode()\">\n <mat-card-content class=\"form-grid\">\n @if (error) {\n <span class=\"error-msg full-width\">{{error}}</span>\n }\n </mat-card-content>\n <div class=\"action-buttons-column\">\n <button mat-raised-button color=\"primary\" class=\"btn-block\" type=\"submit\">Demande de r\u00E9initialisation</button>\n <button mat-stroked-button color=\"primary\" class=\"btn-block\" (click)=\"state=3\">J'ai un code</button>\n </div>\n </form>\n }\n\n </mat-card>\n</div>", styles: ["body{background-image:url(https://lh4.googleusercontent.com/-XplyTa1Za-I/VMSgIyAYkHI/AAAAAAAADxM/oL-rD6VP4ts/w1184-h666/Android-Lollipop-wallpapers-Google-Now-Wallpaper-2.png);background-position:center;background-size:cover;background-repeat:no-repeat;min-height:100vh;font-family:Roboto,sans-serif;margin:0}.login-wrapper{height:100vh;display:flex}.center-layout{justify-content:center;align-items:center}.login-card{padding:40px 70px 50px!important;max-width:500px;width:100%}.login-card mat-card-header{text-align:center;display:block;font-weight:700;margin-bottom:20px}.login-card mat-card-header mat-card-title{font-size:30px;margin:0}.form-grid{display:flex;flex-flow:row wrap;justify-content:space-between;align-items:center}.full-width{flex:1 1 100%;width:100%}.error-msg{color:red;font-weight:700;margin-bottom:10px}.action-buttons-row{display:flex;flex-direction:row;justify-content:flex-end;align-items:center;gap:20px;margin-top:20px}.action-buttons-column{display:flex;flex-direction:column;gap:10px;margin-top:20px}.action-buttons-column .btn-block{width:100%}.social-divider{margin-top:20px;padding-top:20px;border-top:1px solid #eee}.SocialNetwork a{margin:10px}.SocialNetwork a i{padding:10px}\n"] }]
|
|
2192
|
+
}], ctorParameters: () => [{ type: i1$3.UntypedFormBuilder }, { type: i2.ActivatedRoute }, { type: i2.Router }, { type: AuthenticationService }, { type: AuthenticationServiceConfig, decorators: [{
|
|
2193
|
+
type: Optional
|
|
2194
|
+
}] }] });
|
|
2195
|
+
|
|
2196
|
+
class JwtInterceptor {
|
|
2197
|
+
constructor(authenticationService) {
|
|
2198
|
+
this.authenticationService = authenticationService;
|
|
2199
|
+
}
|
|
2200
|
+
intercept(request, next) {
|
|
2201
|
+
// add authorization header with jwt token if available
|
|
2202
|
+
try {
|
|
2203
|
+
const currentUser = this.authenticationService.currentUserValue;
|
|
2204
|
+
if (currentUser && currentUser.Token) {
|
|
2205
|
+
request = request.clone({
|
|
2206
|
+
setHeaders: {
|
|
2207
|
+
Authorization: `Bearer ${currentUser.Token}`
|
|
2208
|
+
}
|
|
2209
|
+
});
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
catch (e) {
|
|
2213
|
+
console.log(`jwt interceptor ${e}`);
|
|
2214
|
+
}
|
|
2215
|
+
return next.handle(request);
|
|
2216
|
+
}
|
|
2217
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: JwtInterceptor, deps: [{ token: AuthenticationService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2218
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: JwtInterceptor }); }
|
|
2219
|
+
}
|
|
2220
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: JwtInterceptor, decorators: [{
|
|
2221
|
+
type: Injectable
|
|
2222
|
+
}], ctorParameters: () => [{ type: AuthenticationService }] });
|
|
2223
|
+
|
|
2224
|
+
class ErrorInterceptor {
|
|
2225
|
+
constructor(authenticationService) {
|
|
2226
|
+
this.authenticationService = authenticationService;
|
|
2227
|
+
}
|
|
2228
|
+
intercept(request, next) {
|
|
2229
|
+
return next.handle(request).pipe(catchError(err => {
|
|
2230
|
+
if (err.status === 401) {
|
|
2231
|
+
// auto logout if 401 response returned from api
|
|
2232
|
+
this.authenticationService.logout();
|
|
2233
|
+
location.reload();
|
|
2234
|
+
}
|
|
2235
|
+
const error = err.error ? (err.error.message || err.StatusText) : err.statusText;
|
|
2236
|
+
if (console)
|
|
2237
|
+
console.log(err);
|
|
2238
|
+
return throwError(err);
|
|
2239
|
+
}));
|
|
2240
|
+
}
|
|
2241
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: ErrorInterceptor, deps: [{ token: AuthenticationService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2242
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: ErrorInterceptor }); }
|
|
2243
|
+
}
|
|
2244
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: ErrorInterceptor, decorators: [{
|
|
2245
|
+
type: Injectable
|
|
2246
|
+
}], ctorParameters: () => [{ type: AuthenticationService }] });
|
|
2247
|
+
|
|
2248
|
+
class ChangePasswordDlgComponent {
|
|
2249
|
+
constructor(formBuilder, dialogRef, authenticationService) {
|
|
2250
|
+
this.formBuilder = formBuilder;
|
|
2251
|
+
this.dialogRef = dialogRef;
|
|
2252
|
+
this.authenticationService = authenticationService;
|
|
2253
|
+
this.form = this.formBuilder.group({
|
|
2254
|
+
oldpassword: ['', Validators.required],
|
|
2255
|
+
newpassword: ['', Validators.required],
|
|
2256
|
+
confirmationpassword: ['', Validators.required]
|
|
2257
|
+
}, { validator: c => c.get('newpassword').value === c.get('confirmationpassword').value });
|
|
2258
|
+
}
|
|
2259
|
+
ngOnInit() {
|
|
2260
|
+
}
|
|
2261
|
+
resetError() {
|
|
2262
|
+
this.error = '';
|
|
2263
|
+
}
|
|
2264
|
+
onSubmit() {
|
|
2265
|
+
this.resetError();
|
|
2266
|
+
if (this.form.invalid) {
|
|
2267
|
+
return;
|
|
2268
|
+
}
|
|
2269
|
+
const user = this.authenticationService.currentUserValue;
|
|
2270
|
+
this.authenticationService.changePassword('', user.username, this.form.value.oldpassword, this.form.value.newpassword).subscribe(r => this.dialogRef.close(true), error => {
|
|
2271
|
+
switch (error.error?.Code) {
|
|
2272
|
+
case 'COMPLEXITY':
|
|
2273
|
+
this.error = 'Le mot de passe souhaitez n\'est pas suffisamment complexe. Veuillez utiliser un mot de passe long (8 caractères minimum) combinant des majuscules, minuscules, chiffres et caractères spéciaux.';
|
|
2274
|
+
break;
|
|
2275
|
+
case 'BADAUTH':
|
|
2276
|
+
this.error = 'Utilisateur inconnu ou mauvais mot de passe. Veuillez vérifier vos identifiants.';
|
|
2277
|
+
break;
|
|
2278
|
+
case 'WEAKPASSWORD':
|
|
2279
|
+
this.error = 'Le mot de passe que vous avez utilisez est trop faible. S\'il s\'agit effectivement de votre mot de passe, veuillez le réinitialiser au moyen de la fonctionnalité "Mot de passe oublié". ';
|
|
2280
|
+
break;
|
|
2281
|
+
case 'BLACKLISTEDIP':
|
|
2282
|
+
this.error = `Trop de tentatives de connexion à partir de cette adresse IP (${error.error?.Params?.IP}). Vous ne pouvez plus vous connecter à partir de ce poste.`;
|
|
2283
|
+
break;
|
|
2284
|
+
case 'TOOMANYFROMIP':
|
|
2285
|
+
this.error = `Trop de tentatives de connexion, à partir de cette adresse IP (${error.error?.Params?.IP}). Vous ne pouvez pas réessayer pendant ${error.error?.Params?.nbrMinutes} minutes.`;
|
|
2286
|
+
break;
|
|
2287
|
+
case 'TOOMANYFORUSERNAME':
|
|
2288
|
+
this.error = `Trop de tentatives de connexion pour cet utilisateur (${error.error?.Params?.Username}). Vous ne pouvez pas réessayer pendant ${error.error?.Params?.nbrMinutes} minutes.`;
|
|
2289
|
+
break;
|
|
2290
|
+
}
|
|
2291
|
+
this.error = error.error.Message;
|
|
2292
|
+
});
|
|
2293
|
+
}
|
|
2294
|
+
cancel() {
|
|
2295
|
+
this.dialogRef.close();
|
|
2296
|
+
}
|
|
2297
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: ChangePasswordDlgComponent, deps: [{ token: i1$3.UntypedFormBuilder }, { token: i1$2.MatDialogRef }, { token: AuthenticationService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2298
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.17", type: ChangePasswordDlgComponent, isStandalone: false, selector: "gloww-change-password-dlg", ngImport: i0, template: "<h2 mat-dialog-title>Change Password</h2>\n\n<form class=\"password-form\" [formGroup]=\"form\" (ngSubmit)=\"onSubmit()\">\n <mat-dialog-content>\n <div class=\"form-container\">\n @if (error) {\n <div class=\"error-msg full-width\">\n {{error}}\n </div>\n }\n\n <mat-form-field class=\"full-width\" appearance=\"outline\">\n <mat-label>Old Password</mat-label>\n <input matInput formControlName=\"oldpassword\" type=\"password\" (change)=\"resetError()\">\n </mat-form-field>\n\n <mat-form-field class=\"full-width\" appearance=\"outline\">\n <mat-label>New Password</mat-label>\n <input matInput formControlName=\"newpassword\" type=\"password\" (change)=\"resetError()\">\n </mat-form-field>\n\n <mat-form-field class=\"full-width\" appearance=\"outline\">\n <mat-label>Confirmation</mat-label>\n <input matInput formControlName=\"confirmationpassword\" type=\"password\" (change)=\"resetError()\">\n </mat-form-field>\n </div>\n </mat-dialog-content>\n\n <mat-dialog-actions align=\"end\">\n <button mat-button (click)=\"cancel()\">Cancel</button>\n <button mat-raised-button color=\"primary\" type=\"submit\" [disabled]=\"form.invalid\">\n Change Password\n </button>\n </mat-dialog-actions>\n</form>", styles: [".form-container{display:flex;flex-direction:column;align-items:stretch;gap:8px;padding-top:10px}.full-width{width:100%;flex:1 1 100%}.error-msg{color:red;font-weight:700;margin-bottom:10px;font-size:.9em}mat-dialog-actions{gap:12px;padding:16px 0!important}@media (max-width: 600px){.btn-block{width:100%;margin:5px 0}}\n"], dependencies: [{ kind: "directive", type: i1$3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i4.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: i2$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i1$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }] }); }
|
|
2299
|
+
}
|
|
2300
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: ChangePasswordDlgComponent, decorators: [{
|
|
2301
|
+
type: Component,
|
|
2302
|
+
args: [{ selector: 'gloww-change-password-dlg', standalone: false, template: "<h2 mat-dialog-title>Change Password</h2>\n\n<form class=\"password-form\" [formGroup]=\"form\" (ngSubmit)=\"onSubmit()\">\n <mat-dialog-content>\n <div class=\"form-container\">\n @if (error) {\n <div class=\"error-msg full-width\">\n {{error}}\n </div>\n }\n\n <mat-form-field class=\"full-width\" appearance=\"outline\">\n <mat-label>Old Password</mat-label>\n <input matInput formControlName=\"oldpassword\" type=\"password\" (change)=\"resetError()\">\n </mat-form-field>\n\n <mat-form-field class=\"full-width\" appearance=\"outline\">\n <mat-label>New Password</mat-label>\n <input matInput formControlName=\"newpassword\" type=\"password\" (change)=\"resetError()\">\n </mat-form-field>\n\n <mat-form-field class=\"full-width\" appearance=\"outline\">\n <mat-label>Confirmation</mat-label>\n <input matInput formControlName=\"confirmationpassword\" type=\"password\" (change)=\"resetError()\">\n </mat-form-field>\n </div>\n </mat-dialog-content>\n\n <mat-dialog-actions align=\"end\">\n <button mat-button (click)=\"cancel()\">Cancel</button>\n <button mat-raised-button color=\"primary\" type=\"submit\" [disabled]=\"form.invalid\">\n Change Password\n </button>\n </mat-dialog-actions>\n</form>", styles: [".form-container{display:flex;flex-direction:column;align-items:stretch;gap:8px;padding-top:10px}.full-width{width:100%;flex:1 1 100%}.error-msg{color:red;font-weight:700;margin-bottom:10px;font-size:.9em}mat-dialog-actions{gap:12px;padding:16px 0!important}@media (max-width: 600px){.btn-block{width:100%;margin:5px 0}}\n"] }]
|
|
2303
|
+
}], ctorParameters: () => [{ type: i1$3.UntypedFormBuilder }, { type: i1$2.MatDialogRef }, { type: AuthenticationService }] });
|
|
2304
|
+
|
|
2305
|
+
class SocialNetworkDlgComponent {
|
|
2306
|
+
constructor(dialogRef, authenticationService, dialog, config) {
|
|
2307
|
+
this.dialogRef = dialogRef;
|
|
2308
|
+
this.authenticationService = authenticationService;
|
|
2309
|
+
this.dialog = dialog;
|
|
2310
|
+
this.config = config;
|
|
2311
|
+
this.authenticationService.getOAuthProviders().subscribe(oap => this.oAuthProviders = oap);
|
|
2312
|
+
this.authenticationService.getOAuthAssociations().subscribe(oap => {
|
|
2313
|
+
this.oAuthAssociations = oap; //oap.map(item => Object.assign(new Oauthassociation(), item));
|
|
2314
|
+
});
|
|
2315
|
+
}
|
|
2316
|
+
ngOnInit() {
|
|
2317
|
+
}
|
|
2318
|
+
OK() {
|
|
2319
|
+
this.dialogRef.close();
|
|
2320
|
+
}
|
|
2321
|
+
OAuthAddAssociation(provider) {
|
|
2322
|
+
const url = `${window.location.origin}/admin/AuthUsers/OAuth/${provider}/${this.config.environment}`;
|
|
2323
|
+
window.location.href = url;
|
|
2324
|
+
}
|
|
2325
|
+
OAuthDeleteAssociation(association) {
|
|
2326
|
+
this.authenticationService.OAuthDeleteAssociation(association.provider, association.idOAuth).subscribe(result => {
|
|
2327
|
+
alert("Association supprimée");
|
|
2328
|
+
const index = this.oAuthAssociations.indexOf(association, 0);
|
|
2329
|
+
if (index >= 0) {
|
|
2330
|
+
this.oAuthAssociations.splice(index, 1);
|
|
2331
|
+
}
|
|
2332
|
+
else {
|
|
2333
|
+
alert("unable to delete item");
|
|
2334
|
+
}
|
|
2335
|
+
//this.oAuthAssociations.find(a => a === association
|
|
2336
|
+
}, error => {
|
|
2337
|
+
alert('Impossible d\'effacer l\'association');
|
|
2338
|
+
});
|
|
2339
|
+
}
|
|
2340
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: SocialNetworkDlgComponent, deps: [{ token: i1$2.MatDialogRef }, { token: AuthenticationService }, { token: i1$2.MatDialog }, { token: AuthenticationServiceConfig, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2341
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.17", type: SocialNetworkDlgComponent, isStandalone: false, selector: "gloww-social-network-dlg", ngImport: i0, template: "<h2 mat-dialog-title>Gestion des identifications par r\u00E9seaux sociaux</h2>\r\n<mat-dialog-content>\r\n <h3>Associations \u00E9tablies</h3>\r\n <p>Choisissez l'association que vous souhaitez supprimer</p>\r\n <gloww-social-network (callback)=\"OAuthDeleteAssociation($event)\" [oAuthProviders]=\"oAuthAssociations\"></gloww-social-network>\r\n <h3>Nouvelle association</h3>\r\n <p>Choisissez le provider</p>\r\n <gloww-social-network (callback)=\"OAuthAddAssociation($event)\" [oAuthProviders]=\"oAuthProviders\"></gloww-social-network>\r\n</mat-dialog-content>\r\n<mat-dialog-actions>\r\n <button mat-stroked-button color=\"accent\" class=\"btn-block\" (click)=\"OK() \">OK</button>\r\n</mat-dialog-actions>", styles: [".dummy{color:red}\n"], dependencies: [{ kind: "component", type: i4.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: i1$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: SocialNetworkComponent, selector: "gloww-social-network", inputs: ["oAuthProviders"], outputs: ["callback"] }] }); }
|
|
2342
|
+
}
|
|
2343
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: SocialNetworkDlgComponent, decorators: [{
|
|
2344
|
+
type: Component,
|
|
2345
|
+
args: [{ selector: 'gloww-social-network-dlg', standalone: false, template: "<h2 mat-dialog-title>Gestion des identifications par r\u00E9seaux sociaux</h2>\r\n<mat-dialog-content>\r\n <h3>Associations \u00E9tablies</h3>\r\n <p>Choisissez l'association que vous souhaitez supprimer</p>\r\n <gloww-social-network (callback)=\"OAuthDeleteAssociation($event)\" [oAuthProviders]=\"oAuthAssociations\"></gloww-social-network>\r\n <h3>Nouvelle association</h3>\r\n <p>Choisissez le provider</p>\r\n <gloww-social-network (callback)=\"OAuthAddAssociation($event)\" [oAuthProviders]=\"oAuthProviders\"></gloww-social-network>\r\n</mat-dialog-content>\r\n<mat-dialog-actions>\r\n <button mat-stroked-button color=\"accent\" class=\"btn-block\" (click)=\"OK() \">OK</button>\r\n</mat-dialog-actions>", styles: [".dummy{color:red}\n"] }]
|
|
2346
|
+
}], ctorParameters: () => [{ type: i1$2.MatDialogRef }, { type: AuthenticationService }, { type: i1$2.MatDialog }, { type: AuthenticationServiceConfig, decorators: [{
|
|
2347
|
+
type: Optional
|
|
2348
|
+
}] }] });
|
|
2349
|
+
|
|
2350
|
+
class UserMenuComponent {
|
|
2351
|
+
constructor(authenticationService, dialog, router) {
|
|
2352
|
+
this.authenticationService = authenticationService;
|
|
2353
|
+
this.dialog = dialog;
|
|
2354
|
+
this.router = router;
|
|
2355
|
+
this.size = '1x';
|
|
2356
|
+
this.imageUser = null;
|
|
2357
|
+
this.loginpage = '';
|
|
2358
|
+
this.showMenuUser = false;
|
|
2359
|
+
this.connected = false;
|
|
2360
|
+
const person = this.authenticationService.currentUserValue;
|
|
2361
|
+
if (person && person.UserInfo) {
|
|
2362
|
+
this.connected = true;
|
|
2363
|
+
if (person.UserInfo.Picture) {
|
|
2364
|
+
this.imageUser = '/' + authenticationService.environment + '/' + person.UserInfo.Picture;
|
|
2365
|
+
}
|
|
2366
|
+
}
|
|
2367
|
+
this.authenticationService.getOAuthProviders().subscribe(oap => this.oAuthProviders = oap);
|
|
2368
|
+
}
|
|
2369
|
+
ngOnInit() {
|
|
2370
|
+
}
|
|
2371
|
+
Logout() {
|
|
2372
|
+
this.showMenuUser = false;
|
|
2373
|
+
this.authenticationService.logout();
|
|
2374
|
+
this.router.navigate(['/']);
|
|
2375
|
+
}
|
|
2376
|
+
ChangePassword() {
|
|
2377
|
+
this.showMenuUser = true;
|
|
2378
|
+
const dialogConfig = new MatDialogConfig();
|
|
2379
|
+
dialogConfig.disableClose = true;
|
|
2380
|
+
dialogConfig.autoFocus = true;
|
|
2381
|
+
dialogConfig.closeOnNavigation = false;
|
|
2382
|
+
this.dialog.open(ChangePasswordDlgComponent, dialogConfig).afterClosed().subscribe(result => {
|
|
2383
|
+
if (result) {
|
|
2384
|
+
alert('Password Changed');
|
|
2385
|
+
}
|
|
2386
|
+
});
|
|
2387
|
+
}
|
|
2388
|
+
toggleMenuUser() {
|
|
2389
|
+
this.showMenuUser = !this.showMenuUser;
|
|
2390
|
+
}
|
|
2391
|
+
Configuration() {
|
|
2392
|
+
const dialogConfig = new MatDialogConfig();
|
|
2393
|
+
dialogConfig.disableClose = true;
|
|
2394
|
+
dialogConfig.autoFocus = true;
|
|
2395
|
+
dialogConfig.closeOnNavigation = false;
|
|
2396
|
+
this.dialog.open(SocialNetworkDlgComponent, dialogConfig).afterClosed().subscribe(result => {
|
|
2397
|
+
});
|
|
2398
|
+
}
|
|
2399
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: UserMenuComponent, deps: [{ token: AuthenticationService }, { token: i1$2.MatDialog }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2400
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.17", type: UserMenuComponent, isStandalone: false, selector: "gloww-user-menu", inputs: { size: "size", imageUser: "imageUser", loginpage: "loginpage" }, ngImport: i0, template: "@if (connected) {\n <div>\n <span (click)=\"toggleMenuUser()\">\n @if (imageUser) {\n <img [src]=\"imageUser\" style=\"height:40px;float:left; padding-left:20px\" />\n }\n @if (!imageUser) {\n <i [ngClass]=\"'fal fa-user '+size\" style=\"float:left; padding-left:10px\">\n <!--[size]=\"size\"-->\n </i>\n }\n </span>\n @if (showMenuUser) {\n <div class=\"menuUser\">\n <ul class=\"menuSec\" style=\"border: solid lightgrey;\">\n <li (click)=\"ChangePassword()\">\n <i class=\"fal fa-key-skeleton\"></i>Change Password\n </li>\n @if (oAuthProviders && oAuthProviders.length) {\n <li (click)=\"Configuration()\">\n <i class=\"fal fa-tools\"></i>Configuration\n </li>\n }\n <li (click)=\"Logout()\">\n <i class=\"fal fa-sign-out\"></i>D\u00E9connexion\n </li>\n </ul>\n </div>\n }\n </div>\n}\n@if (!connected && loginpage) {\n <div>\n <span style=\"height:40px;float:left; padding-left:20px\" [routerLink]=\"loginpage\">Connexion</span>\n </div>\n}\n", styles: [".menuUser{position:relative}.menuUser ul{text-align:left;position:absolute;top:30px;left:-115px;width:150px;padding:10px;z-index:20;background-color:#fff;font-size:13px;color:#000}.menuUser ul li{height:30px;list-style-type:none}.menuUser ul li i{padding-right:10px;height:30px}ul.menuSec li{cursor:pointer}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }] }); }
|
|
2401
|
+
}
|
|
2402
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: UserMenuComponent, decorators: [{
|
|
2403
|
+
type: Component,
|
|
2404
|
+
args: [{ selector: 'gloww-user-menu', standalone: false, template: "@if (connected) {\n <div>\n <span (click)=\"toggleMenuUser()\">\n @if (imageUser) {\n <img [src]=\"imageUser\" style=\"height:40px;float:left; padding-left:20px\" />\n }\n @if (!imageUser) {\n <i [ngClass]=\"'fal fa-user '+size\" style=\"float:left; padding-left:10px\">\n <!--[size]=\"size\"-->\n </i>\n }\n </span>\n @if (showMenuUser) {\n <div class=\"menuUser\">\n <ul class=\"menuSec\" style=\"border: solid lightgrey;\">\n <li (click)=\"ChangePassword()\">\n <i class=\"fal fa-key-skeleton\"></i>Change Password\n </li>\n @if (oAuthProviders && oAuthProviders.length) {\n <li (click)=\"Configuration()\">\n <i class=\"fal fa-tools\"></i>Configuration\n </li>\n }\n <li (click)=\"Logout()\">\n <i class=\"fal fa-sign-out\"></i>D\u00E9connexion\n </li>\n </ul>\n </div>\n }\n </div>\n}\n@if (!connected && loginpage) {\n <div>\n <span style=\"height:40px;float:left; padding-left:20px\" [routerLink]=\"loginpage\">Connexion</span>\n </div>\n}\n", styles: [".menuUser{position:relative}.menuUser ul{text-align:left;position:absolute;top:30px;left:-115px;width:150px;padding:10px;z-index:20;background-color:#fff;font-size:13px;color:#000}.menuUser ul li{height:30px;list-style-type:none}.menuUser ul li i{padding-right:10px;height:30px}ul.menuSec li{cursor:pointer}\n"] }]
|
|
2405
|
+
}], ctorParameters: () => [{ type: AuthenticationService }, { type: i1$2.MatDialog }, { type: i2.Router }], propDecorators: { size: [{
|
|
2406
|
+
type: Input
|
|
2407
|
+
}], imageUser: [{
|
|
2408
|
+
type: Input
|
|
2409
|
+
}], loginpage: [{
|
|
2410
|
+
type: Input
|
|
2411
|
+
}] } });
|
|
2412
|
+
|
|
2413
|
+
class StagingInterceptor {
|
|
2414
|
+
constructor() { }
|
|
2415
|
+
intercept(request, next) {
|
|
2416
|
+
// add authorization header with jwt token if available
|
|
2417
|
+
try {
|
|
2418
|
+
if (!request.url.match(/version\.json(\?|$)/ig)) {
|
|
2419
|
+
console.log(`Replace ${request.url}`);
|
|
2420
|
+
return next.handle(request.clone({ url: request.url.replace("__Staging", "") }));
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
catch (e) {
|
|
2424
|
+
console.log(`staging interceptor ${e}`);
|
|
2425
|
+
}
|
|
2426
|
+
return next.handle(request);
|
|
2427
|
+
}
|
|
2428
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: StagingInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2429
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: StagingInterceptor }); }
|
|
2430
|
+
}
|
|
2431
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: StagingInterceptor, decorators: [{
|
|
2432
|
+
type: Injectable
|
|
2433
|
+
}], ctorParameters: () => [] });
|
|
2434
|
+
|
|
2435
|
+
class AuthGuard {
|
|
2436
|
+
constructor(router, authenticationService, platformLocation
|
|
2437
|
+
//@Inject(APP_BASE_HREF) baseHref: string
|
|
2438
|
+
) {
|
|
2439
|
+
this.router = router;
|
|
2440
|
+
this.authenticationService = authenticationService;
|
|
2441
|
+
this.platformLocation = platformLocation;
|
|
2442
|
+
this.baseHref = null;
|
|
2443
|
+
this.baseHref = platformLocation.getBaseHrefFromDOM();
|
|
2444
|
+
}
|
|
2445
|
+
canActivate(route, state) {
|
|
2446
|
+
const currentUser = this.authenticationService.currentUserValue;
|
|
2447
|
+
if (currentUser) {
|
|
2448
|
+
// logged in so return true
|
|
2449
|
+
const jwtToken = jwt_decode(currentUser.Token);
|
|
2450
|
+
if (Date.now() < jwtToken.exp * 1000) {
|
|
2451
|
+
return true;
|
|
2452
|
+
}
|
|
2453
|
+
else {
|
|
2454
|
+
this.authenticationService.logout();
|
|
2455
|
+
}
|
|
2456
|
+
}
|
|
2457
|
+
const vd = window.location.pathname;
|
|
2458
|
+
if (vd.endsWith("/login")) {
|
|
2459
|
+
return true;
|
|
2460
|
+
}
|
|
2461
|
+
console.log(window.location);
|
|
2462
|
+
console.log(route);
|
|
2463
|
+
console.log(state);
|
|
2464
|
+
console.log(state.url);
|
|
2465
|
+
console.log(window.location.search);
|
|
2466
|
+
console.log(window.location.pathname);
|
|
2467
|
+
const returnUrl = window.location.pathname.substr(this.baseHref.length);
|
|
2468
|
+
//let application = window.location.pathname.substr(0, window.location.pathname.length - state.url.length);
|
|
2469
|
+
/*if (state.url === '/') {
|
|
2470
|
+
application = window.location.pathname.endsWith("/") ? application.substr(0, window.location.pathname.length - 1) : window.location.pathname;
|
|
2471
|
+
}
|
|
2472
|
+
if (!application) { application = '/'; }
|
|
2473
|
+
console.log(application);*/
|
|
2474
|
+
// not logged in so redirect to login page with the return url
|
|
2475
|
+
this.router.navigate(['/login'], { queryParams: { returnUrl: `${returnUrl}${window.location.search}`, application: `${this.baseHref}` } });
|
|
2476
|
+
return false;
|
|
2477
|
+
}
|
|
2478
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: AuthGuard, deps: [{ token: i2.Router }, { token: AuthenticationService }, { token: i3.PlatformLocation }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2479
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: AuthGuard, providedIn: 'root' }); }
|
|
2480
|
+
}
|
|
2481
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: AuthGuard, decorators: [{
|
|
2482
|
+
type: Injectable,
|
|
2483
|
+
args: [{ providedIn: 'root' }]
|
|
2484
|
+
}], ctorParameters: () => [{ type: i2.Router }, { type: AuthenticationService }, { type: i3.PlatformLocation }] });
|
|
2485
|
+
|
|
2486
|
+
class AdministratorGuard {
|
|
2487
|
+
constructor(router, authenticationService, platformLocation
|
|
2488
|
+
//@Inject(APP_BASE_HREF) baseHref: string
|
|
2489
|
+
) {
|
|
2490
|
+
this.router = router;
|
|
2491
|
+
this.authenticationService = authenticationService;
|
|
2492
|
+
this.platformLocation = platformLocation;
|
|
2493
|
+
}
|
|
2494
|
+
canActivate(route, state) {
|
|
2495
|
+
const currentUser = this.authenticationService.currentUserValue.UserInfo;
|
|
2496
|
+
return currentUser.IsAdministrator || currentUser.isAdministrator;
|
|
2497
|
+
}
|
|
2498
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: AdministratorGuard, deps: [{ token: i2.Router }, { token: AuthenticationService }, { token: i3.PlatformLocation }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2499
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: AdministratorGuard, providedIn: 'root' }); }
|
|
2500
|
+
}
|
|
2501
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: AdministratorGuard, decorators: [{
|
|
2502
|
+
type: Injectable,
|
|
2503
|
+
args: [{
|
|
2504
|
+
providedIn: 'root'
|
|
2505
|
+
}]
|
|
2506
|
+
}], ctorParameters: () => [{ type: i2.Router }, { type: AuthenticationService }, { type: i3.PlatformLocation }] });
|
|
2507
|
+
|
|
2508
|
+
class GlowwSecurityModule {
|
|
2509
|
+
static forRoot(authenticationServiceConfig) {
|
|
2510
|
+
/*
|
|
2511
|
+
var socialLoginProviders = {
|
|
2512
|
+
provide: 'SocialAuthServiceConfig',
|
|
2513
|
+
useValue: {
|
|
2514
|
+
autoLogin: false,
|
|
2515
|
+
providers: [
|
|
2516
|
+
],
|
|
2517
|
+
onError: (err) => {
|
|
2518
|
+
console.error(err);
|
|
2519
|
+
}
|
|
2520
|
+
} as SocialAuthServiceConfig,
|
|
2521
|
+
};
|
|
2522
|
+
|
|
2523
|
+
if (authenticationServiceConfig.googleClientId) {
|
|
2524
|
+
socialLoginProviders.useValue.providers.push(
|
|
2525
|
+
{
|
|
2526
|
+
id: GoogleLoginProvider.PROVIDER_ID,
|
|
2527
|
+
provider: new GoogleLoginProvider(
|
|
2528
|
+
authenticationServiceConfig.googleClientId
|
|
2529
|
+
)
|
|
2530
|
+
}
|
|
2531
|
+
)
|
|
2532
|
+
}
|
|
2533
|
+
if (authenticationServiceConfig.facebookClientId) {
|
|
2534
|
+
socialLoginProviders.useValue.providers.push(
|
|
2535
|
+
{
|
|
2536
|
+
id: FacebookLoginProvider.PROVIDER_ID,
|
|
2537
|
+
provider: new FacebookLoginProvider(
|
|
2538
|
+
authenticationServiceConfig.facebookClientId
|
|
2539
|
+
)
|
|
2540
|
+
}
|
|
2541
|
+
)
|
|
2542
|
+
}
|
|
2543
|
+
if (authenticationServiceConfig.amazonClientId) {
|
|
2544
|
+
socialLoginProviders.useValue.providers.push(
|
|
2545
|
+
{
|
|
2546
|
+
id: AmazonLoginProvider.PROVIDER_ID,
|
|
2547
|
+
provider: new AmazonLoginProvider(
|
|
2548
|
+
authenticationServiceConfig.amazonClientId
|
|
2549
|
+
)
|
|
2550
|
+
}
|
|
2551
|
+
)
|
|
2552
|
+
}
|
|
2553
|
+
if (authenticationServiceConfig.microsoftClientId) {
|
|
2554
|
+
socialLoginProviders.useValue.providers.push(
|
|
2555
|
+
{
|
|
2556
|
+
id: MicrosoftLoginProvider.PROVIDER_ID,
|
|
2557
|
+
provider: new MicrosoftLoginProvider(
|
|
2558
|
+
authenticationServiceConfig.microsoftClientId
|
|
2559
|
+
)
|
|
2560
|
+
}
|
|
2561
|
+
)
|
|
2562
|
+
}
|
|
2563
|
+
*/
|
|
2564
|
+
return {
|
|
2565
|
+
ngModule: GlowwSecurityModule,
|
|
2566
|
+
providers: [
|
|
2567
|
+
AuthenticationService,
|
|
2568
|
+
AuthenticationServiceConfig,
|
|
2569
|
+
{ provide: AuthenticationServiceConfig, useValue: authenticationServiceConfig },
|
|
2570
|
+
{ provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true },
|
|
2571
|
+
{ provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true },
|
|
2572
|
+
//{ provide: HTTP_INTERCEPTORS, useClass: StagingInterceptor, multi: true },
|
|
2573
|
+
//socialLoginProviders
|
|
2574
|
+
]
|
|
2575
|
+
};
|
|
2576
|
+
}
|
|
2577
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: GlowwSecurityModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2578
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.17", ngImport: i0, type: GlowwSecurityModule, declarations: [LoginComponent,
|
|
2579
|
+
ChangePasswordDlgComponent,
|
|
2580
|
+
UserMenuComponent,
|
|
2581
|
+
SocialNetworkDlgComponent,
|
|
2582
|
+
SocialNetworkComponent], imports: [CommonModule,
|
|
2583
|
+
FormsModule,
|
|
2584
|
+
ReactiveFormsModule,
|
|
2585
|
+
BrowserModule,
|
|
2586
|
+
BrowserAnimationsModule,
|
|
2587
|
+
MatToolbarModule,
|
|
2588
|
+
MatButtonModule,
|
|
2589
|
+
MatSidenavModule,
|
|
2590
|
+
MatInputModule,
|
|
2591
|
+
MatFormFieldModule,
|
|
2592
|
+
MatCardModule,
|
|
2593
|
+
MatDialogModule,
|
|
2594
|
+
RouterModule], exports: [LoginComponent, RouterModule, UserMenuComponent] }); }
|
|
2595
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: GlowwSecurityModule, providers: [provideHttpClient(withInterceptorsFromDi())], imports: [CommonModule,
|
|
2596
|
+
FormsModule,
|
|
2597
|
+
ReactiveFormsModule,
|
|
2598
|
+
BrowserModule,
|
|
2599
|
+
BrowserAnimationsModule,
|
|
2600
|
+
MatToolbarModule,
|
|
2601
|
+
MatButtonModule,
|
|
2602
|
+
MatSidenavModule,
|
|
2603
|
+
MatInputModule,
|
|
2604
|
+
MatFormFieldModule,
|
|
2605
|
+
MatCardModule,
|
|
2606
|
+
MatDialogModule,
|
|
2607
|
+
RouterModule, RouterModule] }); }
|
|
2608
|
+
}
|
|
2609
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: GlowwSecurityModule, decorators: [{
|
|
2610
|
+
type: NgModule,
|
|
2611
|
+
args: [{ declarations: [
|
|
2612
|
+
LoginComponent,
|
|
2613
|
+
ChangePasswordDlgComponent,
|
|
2614
|
+
UserMenuComponent,
|
|
2615
|
+
SocialNetworkDlgComponent,
|
|
2616
|
+
SocialNetworkComponent
|
|
2617
|
+
],
|
|
2618
|
+
exports: [LoginComponent, RouterModule, UserMenuComponent], imports: [CommonModule,
|
|
2619
|
+
FormsModule,
|
|
2620
|
+
ReactiveFormsModule,
|
|
2621
|
+
BrowserModule,
|
|
2622
|
+
BrowserAnimationsModule,
|
|
2623
|
+
MatToolbarModule,
|
|
2624
|
+
MatButtonModule,
|
|
2625
|
+
MatSidenavModule,
|
|
2626
|
+
MatInputModule,
|
|
2627
|
+
MatFormFieldModule,
|
|
2628
|
+
MatCardModule,
|
|
2629
|
+
MatDialogModule,
|
|
2630
|
+
RouterModule], providers: [provideHttpClient(withInterceptorsFromDi())] }]
|
|
2631
|
+
}] });
|
|
2632
|
+
|
|
2633
|
+
class HtmlFormatPipe {
|
|
2634
|
+
constructor(_sanitizer) {
|
|
2635
|
+
this._sanitizer = _sanitizer;
|
|
2636
|
+
}
|
|
2637
|
+
transform(value, ...args) {
|
|
2638
|
+
const newval = value.replace(/(^\s*\w|\.\s\w)/g, m => m.toUpperCase()).replace(/\s\./ig, '').replace(/\s*Nouvelle ligne\s*.\s*/ig, '<br/>').trim();
|
|
2639
|
+
if (!this._sanitizer)
|
|
2640
|
+
return newval;
|
|
2641
|
+
return this._sanitizer.bypassSecurityTrustHtml(newval);
|
|
2642
|
+
}
|
|
2643
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: HtmlFormatPipe, deps: [{ token: i1$1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
2644
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.17", ngImport: i0, type: HtmlFormatPipe, isStandalone: false, name: "htmlFormat" }); }
|
|
2645
|
+
}
|
|
2646
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: HtmlFormatPipe, decorators: [{
|
|
2647
|
+
type: Pipe,
|
|
2648
|
+
args: [{
|
|
2649
|
+
name: 'htmlFormat',
|
|
2650
|
+
standalone: false
|
|
2651
|
+
}]
|
|
2652
|
+
}], ctorParameters: () => [{ type: i1$1.DomSanitizer }] });
|
|
2653
|
+
|
|
2654
|
+
class HtmlEditorComponent {
|
|
2655
|
+
cancel() {
|
|
2656
|
+
this.voiceRecognitionService.stop();
|
|
2657
|
+
//CCH this.tb = undefined;
|
|
2658
|
+
this.dialogRef?.close();
|
|
2659
|
+
}
|
|
2660
|
+
paste() {
|
|
2661
|
+
//CCH this.tb?.insertHtml(new HtmlFormatPipe().transform(this.voiceRecognitionService.text));
|
|
2662
|
+
this.voiceRecognitionService.stop();
|
|
2663
|
+
//CCH this.tb = undefined;
|
|
2664
|
+
this.dialogRef?.close();
|
|
2665
|
+
}
|
|
2666
|
+
constructor(sanitizer, authenticationService, voiceRecognitionService, dialog) {
|
|
2667
|
+
this.sanitizer = sanitizer;
|
|
2668
|
+
this.authenticationService = authenticationService;
|
|
2669
|
+
this.voiceRecognitionService = voiceRecognitionService;
|
|
2670
|
+
this.dialog = dialog;
|
|
2671
|
+
//@Input() formControlName: string = "";
|
|
2672
|
+
this.placeHolder = "";
|
|
2673
|
+
this._value = null;
|
|
2674
|
+
this.onChange = () => { };
|
|
2675
|
+
this.onTouched = () => { };
|
|
2676
|
+
this.allowedStyles = ['text-align'];
|
|
2677
|
+
this.allowedTags = ['p', 'span', 'div', 'hr', 'br', 'b', 'i', 'u', 'sup', 'sub', 'strike', 'ol', 'ul', 'li'];
|
|
2678
|
+
this.editorConfig = {
|
|
2679
|
+
editable: true,
|
|
2680
|
+
spellcheck: true,
|
|
2681
|
+
height: 'auto',
|
|
2682
|
+
minHeight: '75px',
|
|
2683
|
+
maxHeight: 'auto',
|
|
2684
|
+
width: 'auto',
|
|
2685
|
+
minWidth: '0',
|
|
2686
|
+
translate: 'yes',
|
|
2687
|
+
enableToolbar: true,
|
|
2688
|
+
showToolbar: true,
|
|
2689
|
+
placeholder: 'Enter text here...',
|
|
2690
|
+
defaultParagraphSeparator: 'p',
|
|
2691
|
+
defaultFontName: '',
|
|
2692
|
+
defaultFontSize: '3',
|
|
2693
|
+
fonts: [
|
|
2694
|
+
{ class: 'arial', name: 'Arial' }
|
|
2695
|
+
],
|
|
2696
|
+
customClasses: [
|
|
2697
|
+
{
|
|
2698
|
+
name: 'quote',
|
|
2699
|
+
class: 'quote',
|
|
2700
|
+
}
|
|
2701
|
+
],
|
|
2702
|
+
uploadUrl: 'v1/image',
|
|
2703
|
+
uploadWithCredentials: false,
|
|
2704
|
+
//cch sanitize: (html: string) => this.sanitize(html),
|
|
2705
|
+
toolbarPosition: 'top',
|
|
2706
|
+
toolbarHiddenButtons: [
|
|
2707
|
+
['insertImage', 'insertVideo', 'customClasses', 'heading', 'heading',
|
|
2708
|
+
'fontName',
|
|
2709
|
+
'fontSize',
|
|
2710
|
+
'textColor',
|
|
2711
|
+
'backgroundColor', !this.isAdministrator() ? 'toggleEditorMode' : '']
|
|
2712
|
+
],
|
|
2713
|
+
/* additionalButtons: [
|
|
2714
|
+
{
|
|
2715
|
+
title: 'Speech Recognition',
|
|
2716
|
+
click: (tb: AngularEditorToolbarComponent, event) => {
|
|
2717
|
+
this.tb = tb;
|
|
2718
|
+
tb.focus();
|
|
2719
|
+
this.voiceRecognitionService.start();
|
|
2720
|
+
this.voiceRecognitionService.text = "";
|
|
2721
|
+
this.dialogRef = this.dialog.open(this.voiceRecognitionTemplate, {
|
|
2722
|
+
width: '550px'
|
|
2723
|
+
});
|
|
2724
|
+
|
|
2725
|
+
},
|
|
2726
|
+
icon: 'fas fa-comment-plus'
|
|
2727
|
+
}
|
|
2728
|
+
]*/
|
|
2729
|
+
};
|
|
2730
|
+
this.voiceRecognitionService.init();
|
|
2731
|
+
}
|
|
2732
|
+
get value() {
|
|
2733
|
+
return this._value;
|
|
2734
|
+
}
|
|
2735
|
+
set value(val) {
|
|
2736
|
+
this._value = val;
|
|
2737
|
+
this.onChange(val);
|
|
2738
|
+
this.onTouched();
|
|
2739
|
+
}
|
|
2740
|
+
writeValue(obj) {
|
|
2741
|
+
if (obj) {
|
|
2742
|
+
this.value = obj;
|
|
2743
|
+
}
|
|
2744
|
+
}
|
|
2745
|
+
registerOnChange(fn) {
|
|
2746
|
+
this.onChange = fn;
|
|
2747
|
+
}
|
|
2748
|
+
registerOnTouched(fn) {
|
|
2749
|
+
this.onTouched = fn;
|
|
2750
|
+
}
|
|
2751
|
+
sanitize(html) {
|
|
2752
|
+
let itres = this.sanitizer.sanitize(SecurityContext.STYLE, html)?.replace(new RegExp('\\</?[a-z]+:[a-z]+\\>', 'gi'), '').replace(/class="Mso[a-z]+"/ig, '');
|
|
2753
|
+
const matchTags = itres?.match(/<\s*\/?(?<tag>[a-z0-9]+)\s*[^>]*>/ig);
|
|
2754
|
+
matchTags?.forEach(m => {
|
|
2755
|
+
const matchTag = m.match(/<\s*\/?(?<tag>[a-z0-9]+)\s*[^>]*>/i);
|
|
2756
|
+
if (matchTag?.groups && this.allowedTags.indexOf(matchTag?.groups['tag']) < 0) {
|
|
2757
|
+
itres = itres?.replace(m, '');
|
|
2758
|
+
}
|
|
2759
|
+
});
|
|
2760
|
+
while (true) {
|
|
2761
|
+
const matchStyle = itres?.match(/style\s*=\s*"(?<style>[^"]+)"/i);
|
|
2762
|
+
if (!matchStyle || !matchStyle?.groups) {
|
|
2763
|
+
break;
|
|
2764
|
+
}
|
|
2765
|
+
const styles = matchStyle?.groups['style']?.replace(/"/ig, '"');
|
|
2766
|
+
const smatches = styles.match(/(?<name>[^;:]+)\s*:\s*(?<value>[^;]+);*/ig);
|
|
2767
|
+
const newStyles = [];
|
|
2768
|
+
smatches?.forEach((v, i, a) => {
|
|
2769
|
+
const ssmatches = v.match(/(?<name>[^;:]+)\s*:\s*(?<value>[^;]+);*/i);
|
|
2770
|
+
if (ssmatches?.groups) {
|
|
2771
|
+
const name = ssmatches?.groups['name'];
|
|
2772
|
+
if (this.allowedStyles.indexOf(name) >= 0) {
|
|
2773
|
+
newStyles.push(v);
|
|
2774
|
+
}
|
|
2775
|
+
const value = ssmatches.groups['value'];
|
|
2776
|
+
console.log(`${name}=${value}`);
|
|
2777
|
+
}
|
|
2778
|
+
});
|
|
2779
|
+
let attr = '';
|
|
2780
|
+
if (newStyles.length) {
|
|
2781
|
+
attr = `stylenew="${newStyles.join(';')}"`;
|
|
2782
|
+
}
|
|
2783
|
+
itres = itres?.replace(matchStyle[0], attr);
|
|
2784
|
+
}
|
|
2785
|
+
return itres?.replace(/stylenew=/ig, 'style=') ?? "";
|
|
2786
|
+
}
|
|
2787
|
+
isAdministrator() {
|
|
2788
|
+
const currentUser = this.authenticationService.currentUserValue.UserInfo;
|
|
2789
|
+
return currentUser.IsAdministrator === 1 || currentUser.isAdministrator === 1;
|
|
2790
|
+
}
|
|
2791
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: HtmlEditorComponent, deps: [{ token: i1$1.DomSanitizer }, { token: AuthenticationService }, { token: VoiceRecognitionService }, { token: i1$2.MatDialog }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2792
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.17", type: HtmlEditorComponent, isStandalone: false, selector: "gloww-html-editor", inputs: { placeHolder: "placeHolder", _value: ["value", "_value"] }, providers: [
|
|
2793
|
+
{
|
|
2794
|
+
provide: NG_VALUE_ACCESSOR,
|
|
2795
|
+
multi: true,
|
|
2796
|
+
useExisting: HtmlEditorComponent
|
|
2797
|
+
}
|
|
2798
|
+
], viewQueries: [{ propertyName: "voiceRecognitionTemplate", first: true, predicate: ["voiceRecognitionDlg"], descendants: true }], ngImport: i0, template: "<div>\r\n <angular-editor [(ngModel)]=\"value\" [config]=\"editorConfig\" [placeholder]=\"placeHolder\"></angular-editor>\r\n</div>\r\n<ng-template #voiceRecognitionDlg>\r\n <mat-dialog-content>\r\n <div>La reconnaissance vocale est activ\u00E9e. Veuillez dicter le texte \u00E0 ins\u00E9rer.</div>\r\n <div [innerHTML]=\"voiceRecognitionService.text | htmlFormat\" style=\"width:500px;height:300px;border:1px solid; border-color: blue;\"></div>\r\n </mat-dialog-content>\r\n\r\n <mat-dialog-actions>\r\n <button class=\"mat-raised-button\" (click)=\"cancel()\">Close</button>\r\n <button class=\"mat-raised-button mat-primary\" (click)=\"paste()\">Paste</button>\r\n </mat-dialog-actions>\r\n</ng-template>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i6.AngularEditorComponent, selector: "angular-editor", inputs: ["id", "config", "placeholder", "tabIndex"], outputs: ["html", "viewMode", "blur", "focus"] }, { kind: "pipe", type: HtmlFormatPipe, name: "htmlFormat" }] }); }
|
|
2799
|
+
}
|
|
2800
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: HtmlEditorComponent, decorators: [{
|
|
2801
|
+
type: Component,
|
|
2802
|
+
args: [{ selector: 'gloww-html-editor', providers: [
|
|
2803
|
+
{
|
|
2804
|
+
provide: NG_VALUE_ACCESSOR,
|
|
2805
|
+
multi: true,
|
|
2806
|
+
useExisting: HtmlEditorComponent
|
|
2807
|
+
}
|
|
2808
|
+
], standalone: false, template: "<div>\r\n <angular-editor [(ngModel)]=\"value\" [config]=\"editorConfig\" [placeholder]=\"placeHolder\"></angular-editor>\r\n</div>\r\n<ng-template #voiceRecognitionDlg>\r\n <mat-dialog-content>\r\n <div>La reconnaissance vocale est activ\u00E9e. Veuillez dicter le texte \u00E0 ins\u00E9rer.</div>\r\n <div [innerHTML]=\"voiceRecognitionService.text | htmlFormat\" style=\"width:500px;height:300px;border:1px solid; border-color: blue;\"></div>\r\n </mat-dialog-content>\r\n\r\n <mat-dialog-actions>\r\n <button class=\"mat-raised-button\" (click)=\"cancel()\">Close</button>\r\n <button class=\"mat-raised-button mat-primary\" (click)=\"paste()\">Paste</button>\r\n </mat-dialog-actions>\r\n</ng-template>\r\n" }]
|
|
2809
|
+
}], ctorParameters: () => [{ type: i1$1.DomSanitizer }, { type: AuthenticationService }, { type: VoiceRecognitionService }, { type: i1$2.MatDialog }], propDecorators: { voiceRecognitionTemplate: [{
|
|
2810
|
+
type: ViewChild,
|
|
2811
|
+
args: ['voiceRecognitionDlg']
|
|
2812
|
+
}], placeHolder: [{
|
|
2813
|
+
type: Input
|
|
2814
|
+
}], _value: [{
|
|
2815
|
+
type: Input,
|
|
2816
|
+
args: ['value']
|
|
2817
|
+
}] } });
|
|
2818
|
+
|
|
2819
|
+
class FileEditComponent {
|
|
2820
|
+
constructor(formBuilder, dialogRef, definition) {
|
|
2821
|
+
this.formBuilder = formBuilder;
|
|
2822
|
+
this.dialogRef = dialogRef;
|
|
2823
|
+
this.modes = {
|
|
2824
|
+
".txt": "null",
|
|
2825
|
+
".cs": "clike",
|
|
2826
|
+
".js": "javascript",
|
|
2827
|
+
".json": { name: "javascript", json: true },
|
|
2828
|
+
".css": "css",
|
|
2829
|
+
".scss": "scss",
|
|
2830
|
+
".htm": "html",
|
|
2831
|
+
".html": "html",
|
|
2832
|
+
".xml": "xml",
|
|
2833
|
+
".xsl": "xml",
|
|
2834
|
+
".xslt": "xml",
|
|
2835
|
+
".yml": "yaml",
|
|
2836
|
+
".yaml": "yaml",
|
|
2837
|
+
};
|
|
2838
|
+
this.initDone = false;
|
|
2839
|
+
this.form = this.formBuilder.group({
|
|
2840
|
+
path: [null, Validators.required],
|
|
2841
|
+
content: [null]
|
|
2842
|
+
});
|
|
2843
|
+
if (definition) {
|
|
2844
|
+
this.form.patchValue(definition);
|
|
2845
|
+
try {
|
|
2846
|
+
this.ext = definition.path.match(/\.(txt|js|json|ts|cs|css|scss|xml|html|htm|yml|yaml|exp|sh|pwsh|xsl|xslt)$/ig)[0];
|
|
2847
|
+
}
|
|
2848
|
+
catch {
|
|
2849
|
+
this.ext = null;
|
|
2850
|
+
}
|
|
2851
|
+
}
|
|
2852
|
+
}
|
|
2853
|
+
getMode() {
|
|
2854
|
+
try {
|
|
2855
|
+
if (this.ext && this.modes[this.ext]) {
|
|
2856
|
+
return this.modes[this.ext];
|
|
2857
|
+
}
|
|
2858
|
+
else {
|
|
2859
|
+
return "null";
|
|
2860
|
+
}
|
|
2861
|
+
}
|
|
2862
|
+
catch {
|
|
2863
|
+
return "null";
|
|
2864
|
+
}
|
|
2865
|
+
}
|
|
2866
|
+
ngOnInit() {
|
|
2867
|
+
}
|
|
2868
|
+
cancel() {
|
|
2869
|
+
this.dialogRef.close();
|
|
2870
|
+
}
|
|
2871
|
+
save() {
|
|
2872
|
+
this.dialogRef.close(this.form.value);
|
|
2873
|
+
}
|
|
2874
|
+
onResized(event) {
|
|
2875
|
+
/*console.log(`new Height ${event.newRect?.height}`);
|
|
2876
|
+
this.cmHeight = `${event.newRect?.height - 15}px`;*/
|
|
2877
|
+
if (this.initDone) {
|
|
2878
|
+
this.codeMirrorComponent.codeMirror.setSize(null, event.newRect?.height - 5);
|
|
2879
|
+
}
|
|
2880
|
+
else {
|
|
2881
|
+
this.initDone = true;
|
|
2882
|
+
}
|
|
2883
|
+
}
|
|
2884
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: FileEditComponent, deps: [{ token: i1$3.UntypedFormBuilder }, { token: i1$2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2885
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.17", type: FileEditComponent, isStandalone: false, selector: "gloww-file-edit", viewQueries: [{ propertyName: "codeMirrorComponent", first: true, predicate: CodemirrorComponent, descendants: true }], ngImport: i0, template: "<div cdkDrag cdkDragRootElement=\".cdk-overlay-pane\" class=\"dlg\">\r\n <h2 mat-dialog-title cdkDragHandle>Ajout/Edition d'un fichier</h2>\r\n \r\n <mat-dialog-content [formGroup]=\"form\" class=\"dialog-form-content\">\r\n <div class=\"column-layout fill-container\">\r\n <mat-form-field appearance=\"outline\" class=\"width-100\">\r\n <mat-label>Path</mat-label>\r\n <input matInput [readonly]=\"true\" placeholder=\"Path\" formControlName=\"path\">\r\n </mat-form-field>\r\n\r\n <div class=\"editor-flex-grow\">\r\n <gloww-code-editor [mode]=\"getMode()\" formControlName=\"content\"></gloww-code-editor>\r\n </div>\r\n </div>\r\n </mat-dialog-content>\r\n\r\n <mat-dialog-actions align=\"end\">\r\n <button mat-raised-button (click)=\"cancel()\">Close</button>\r\n <button mat-raised-button color=\"primary\" (click)=\"save()\">Save</button>\r\n </mat-dialog-actions>\r\n</div>", styles: [".cm-tab{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAMCAYAAAAkuj5RAAAAAXNSR0IArs4c6QAAAGFJREFUSMft1LsRQFAQheHPowAKoACx3IgEKtaEHujDjORSgWTH/ZOdnZOcM/sgk/kFFWY0qV8foQwS4MKBCS3qR6ixBJvElOobYAtivseIE120FaowJPN75GMu8j/LfMwNjh4HUpwg4LUAAAAASUVORK5CYII=);background-position:right;background-repeat:no-repeat}.xxCodeMirror{height:100%}.dialog-form-content{display:flex;flex-direction:column;overflow:hidden}.column-layout{display:flex;flex-direction:column;align-items:stretch}.fill-container{width:100%;height:100%;min-height:100%}.width-100{width:100%}.editor-flex-grow{flex:1 1 auto;display:flex;flex-direction:column;min-height:0}.editor-flex-grow gloww-code-editor{height:100%;width:100%}\n"], dependencies: [{ kind: "directive", type: i1$3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i2$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "component", type: i4.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: i5.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i5.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: CodeEditorComponent, selector: "gloww-code-editor", inputs: ["value", "display", "mode", "formatter", "formatterOptions", "snippets", "snippetsPath"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
2886
|
+
}
|
|
2887
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: FileEditComponent, decorators: [{
|
|
2888
|
+
type: Component,
|
|
2889
|
+
args: [{ selector: 'gloww-file-edit', encapsulation: ViewEncapsulation.None, standalone: false, template: "<div cdkDrag cdkDragRootElement=\".cdk-overlay-pane\" class=\"dlg\">\r\n <h2 mat-dialog-title cdkDragHandle>Ajout/Edition d'un fichier</h2>\r\n \r\n <mat-dialog-content [formGroup]=\"form\" class=\"dialog-form-content\">\r\n <div class=\"column-layout fill-container\">\r\n <mat-form-field appearance=\"outline\" class=\"width-100\">\r\n <mat-label>Path</mat-label>\r\n <input matInput [readonly]=\"true\" placeholder=\"Path\" formControlName=\"path\">\r\n </mat-form-field>\r\n\r\n <div class=\"editor-flex-grow\">\r\n <gloww-code-editor [mode]=\"getMode()\" formControlName=\"content\"></gloww-code-editor>\r\n </div>\r\n </div>\r\n </mat-dialog-content>\r\n\r\n <mat-dialog-actions align=\"end\">\r\n <button mat-raised-button (click)=\"cancel()\">Close</button>\r\n <button mat-raised-button color=\"primary\" (click)=\"save()\">Save</button>\r\n </mat-dialog-actions>\r\n</div>", styles: [".cm-tab{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAMCAYAAAAkuj5RAAAAAXNSR0IArs4c6QAAAGFJREFUSMft1LsRQFAQheHPowAKoACx3IgEKtaEHujDjORSgWTH/ZOdnZOcM/sgk/kFFWY0qV8foQwS4MKBCS3qR6ixBJvElOobYAtivseIE120FaowJPN75GMu8j/LfMwNjh4HUpwg4LUAAAAASUVORK5CYII=);background-position:right;background-repeat:no-repeat}.xxCodeMirror{height:100%}.dialog-form-content{display:flex;flex-direction:column;overflow:hidden}.column-layout{display:flex;flex-direction:column;align-items:stretch}.fill-container{width:100%;height:100%;min-height:100%}.width-100{width:100%}.editor-flex-grow{flex:1 1 auto;display:flex;flex-direction:column;min-height:0}.editor-flex-grow gloww-code-editor{height:100%;width:100%}\n"] }]
|
|
2890
|
+
}], ctorParameters: () => [{ type: i1$3.UntypedFormBuilder }, { type: i1$2.MatDialogRef }, { type: undefined, decorators: [{
|
|
2891
|
+
type: Inject,
|
|
2892
|
+
args: [MAT_DIALOG_DATA]
|
|
2893
|
+
}] }], propDecorators: { codeMirrorComponent: [{
|
|
2894
|
+
type: ViewChild,
|
|
2895
|
+
args: [CodemirrorComponent]
|
|
2896
|
+
}] } });
|
|
2897
|
+
|
|
2898
|
+
class FolderServiceConfig {
|
|
2899
|
+
constructor() {
|
|
2900
|
+
this.apiPath = '/';
|
|
2901
|
+
}
|
|
2902
|
+
static Create(t) {
|
|
2903
|
+
const res = new FolderServiceConfig();
|
|
2904
|
+
if (t) {
|
|
2905
|
+
Object.assign(res, t);
|
|
2906
|
+
}
|
|
2907
|
+
return res;
|
|
2908
|
+
}
|
|
2909
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: FolderServiceConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2910
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: FolderServiceConfig, providedIn: 'root' }); }
|
|
2911
|
+
}
|
|
2912
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: FolderServiceConfig, decorators: [{
|
|
2913
|
+
type: Injectable,
|
|
2914
|
+
args: [{ providedIn: 'root' }]
|
|
2915
|
+
}] });
|
|
2916
|
+
|
|
2917
|
+
class FolderService {
|
|
2918
|
+
constructor(http, folderServiceConfig, apiServerUrl) {
|
|
2919
|
+
this.http = http;
|
|
2920
|
+
this.folderServiceConfig = folderServiceConfig;
|
|
2921
|
+
console.log(`folderServiceConfig ${folderServiceConfig.apiPath}`);
|
|
2922
|
+
console.log(`apiServierUrl ${apiServerUrl}`);
|
|
2923
|
+
}
|
|
2924
|
+
async noFolders() {
|
|
2925
|
+
return await firstValueFrom(this.http.get(`${this.folderServiceConfig.apiPath}noFolders`));
|
|
2926
|
+
}
|
|
2927
|
+
getDirectoryContent(path) {
|
|
2928
|
+
return this.http.get(`${this.folderServiceConfig.apiPath}Directories/${path ?? ""}`);
|
|
2929
|
+
}
|
|
2930
|
+
postDirectoryContent(path) {
|
|
2931
|
+
const formData = new FormData();
|
|
2932
|
+
return this.http.post(`${this.folderServiceConfig.apiPath}Directories/${path}`, formData, {});
|
|
2933
|
+
}
|
|
2934
|
+
getFileContent(path) {
|
|
2935
|
+
return this.http.get(`${this.folderServiceConfig.apiPath}Files/${(path ?? "").replace(/[\/\\]/g, '%2F')}`, {
|
|
2936
|
+
responseType: 'text'
|
|
2937
|
+
});
|
|
2938
|
+
}
|
|
2939
|
+
getFileContentBlob(path) {
|
|
2940
|
+
return this.http.get(`${this.folderServiceConfig.apiPath}Files/${(path ?? "").replace(/[\/\\]/g, '%2F')}`, {
|
|
2941
|
+
responseType: 'blob'
|
|
2942
|
+
});
|
|
2943
|
+
}
|
|
2944
|
+
postFileContent(path, formData) {
|
|
2945
|
+
return this.http.post(`${this.folderServiceConfig.apiPath}Files/${(path ?? "").replace(/[\/\\]/g, '%2F')}`, formData, {
|
|
2946
|
+
reportProgress: true,
|
|
2947
|
+
observe: 'events'
|
|
2948
|
+
});
|
|
2949
|
+
}
|
|
2950
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: FolderService, deps: [{ token: i1.HttpClient }, { token: FolderServiceConfig }, { token: API_SERVER_URL, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2951
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: FolderService, providedIn: 'root' }); }
|
|
2952
|
+
}
|
|
2953
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: FolderService, decorators: [{
|
|
2954
|
+
type: Injectable,
|
|
2955
|
+
args: [{
|
|
2956
|
+
providedIn: 'root'
|
|
2957
|
+
}]
|
|
2958
|
+
}], ctorParameters: () => [{ type: i1.HttpClient }, { type: FolderServiceConfig }, { type: undefined, decorators: [{
|
|
2959
|
+
type: Optional
|
|
2960
|
+
}, {
|
|
2961
|
+
type: Inject,
|
|
2962
|
+
args: [API_SERVER_URL]
|
|
2963
|
+
}] }] });
|
|
2964
|
+
|
|
2965
|
+
class FoldersComponent {
|
|
2966
|
+
constructor(folderService, router, route, dialog) {
|
|
2967
|
+
//flowService.getDirectoryContent(route.snapshot.params.id).subscribe(r => this.directoryContent = r);
|
|
2968
|
+
this.folderService = folderService;
|
|
2969
|
+
this.router = router;
|
|
2970
|
+
this.route = route;
|
|
2971
|
+
this.dialog = dialog;
|
|
2972
|
+
this.router.events.subscribe((event) => {
|
|
2973
|
+
if (event instanceof NavigationEnd) {
|
|
2974
|
+
const urlParts = event.url.split('/');
|
|
2975
|
+
this.currentDir = urlParts.slice(2).join("/");
|
|
2976
|
+
this.directoryContent = null;
|
|
2977
|
+
folderService.getDirectoryContent(this.currentDir).subscribe(r => this.directoryContent = r);
|
|
2978
|
+
}
|
|
2979
|
+
});
|
|
2980
|
+
}
|
|
2981
|
+
ngOnInit() {
|
|
2982
|
+
}
|
|
2983
|
+
addFolder() {
|
|
2984
|
+
const dialogConfig = new MatDialogConfig();
|
|
2985
|
+
dialogConfig.disableClose = true;
|
|
2986
|
+
dialogConfig.autoFocus = true;
|
|
2987
|
+
dialogConfig.closeOnNavigation = false;
|
|
2988
|
+
dialogConfig.data = new PromptModel("New Folder", "Please give the name of the folder to create", "", true);
|
|
2989
|
+
this.dialog.open(PromptComponent, dialogConfig).afterClosed().subscribe(folder => {
|
|
2990
|
+
if (folder) {
|
|
2991
|
+
this.folderService.postDirectoryContent(this.currentDir + '/' + folder).subscribe(c => {
|
|
2992
|
+
this.router.navigate(this.getRouterLink(folder)),
|
|
2993
|
+
error => alert(error);
|
|
2994
|
+
});
|
|
2995
|
+
}
|
|
2996
|
+
});
|
|
2997
|
+
}
|
|
2998
|
+
addFile() {
|
|
2999
|
+
const dialogConfig = new MatDialogConfig();
|
|
3000
|
+
dialogConfig.disableClose = true;
|
|
3001
|
+
dialogConfig.autoFocus = true;
|
|
3002
|
+
dialogConfig.closeOnNavigation = false;
|
|
3003
|
+
dialogConfig.data = new PromptModel("New File", "Please give the name of the text file to create", "", true);
|
|
3004
|
+
this.dialog.open(PromptComponent, dialogConfig).afterClosed().subscribe(fileName => {
|
|
3005
|
+
if (fileName) {
|
|
3006
|
+
this.Edit(fileName);
|
|
3007
|
+
this.directoryContent = null;
|
|
3008
|
+
this.folderService.getDirectoryContent(this.currentDir).subscribe(r => this.directoryContent = r);
|
|
3009
|
+
}
|
|
3010
|
+
});
|
|
3011
|
+
}
|
|
3012
|
+
addFileUpload() {
|
|
3013
|
+
const dialogConfig = new MatDialogConfig();
|
|
3014
|
+
dialogConfig.disableClose = true;
|
|
3015
|
+
dialogConfig.autoFocus = true;
|
|
3016
|
+
dialogConfig.closeOnNavigation = false;
|
|
3017
|
+
dialogConfig.data = { acceptMime: 'image/*', multiple: true, allowAltFileName: true };
|
|
3018
|
+
this.dialog.open(UploadDocComponent, dialogConfig).afterClosed().subscribe(files => {
|
|
3019
|
+
if (files) {
|
|
3020
|
+
files.forEach(file => {
|
|
3021
|
+
const formData = new FormData();
|
|
3022
|
+
formData.append('file', file.data);
|
|
3023
|
+
this.UploadFile(this.currentDir + "/" + file.fileName, formData);
|
|
3024
|
+
this.directoryContent = null;
|
|
3025
|
+
this.folderService.getDirectoryContent(this.currentDir).subscribe(r => this.directoryContent = r);
|
|
3026
|
+
});
|
|
3027
|
+
}
|
|
3028
|
+
});
|
|
3029
|
+
}
|
|
3030
|
+
getRouterLink(directory) {
|
|
3031
|
+
if (!this.currentDir) {
|
|
3032
|
+
return ['/folders', directory];
|
|
3033
|
+
}
|
|
3034
|
+
if (!directory) {
|
|
3035
|
+
let res = ['/folders', ...this.currentDir.split("/")];
|
|
3036
|
+
res.pop();
|
|
3037
|
+
return res;
|
|
3038
|
+
}
|
|
3039
|
+
return ['/folders', ...this.currentDir.split("/"), directory];
|
|
3040
|
+
}
|
|
3041
|
+
getHref(f) {
|
|
3042
|
+
if (!this.currentDir) {
|
|
3043
|
+
return ['/FlowMgmt', 'folders', f].join('/');
|
|
3044
|
+
}
|
|
3045
|
+
return ['/FlowMgmt', 'folders', ...this.currentDir.split("/"), f].join('/');
|
|
3046
|
+
}
|
|
3047
|
+
dataURItoBlob(content) {
|
|
3048
|
+
const byteString = content;
|
|
3049
|
+
/*const arrayBuffer = new ArrayBuffer(byteString.length);
|
|
3050
|
+
const int8Array = new Uint8Array(arrayBuffer);
|
|
3051
|
+
let j = 0;
|
|
3052
|
+
for (let i = 0; i < byteString.length; i++) {
|
|
3053
|
+
let chr = byteString.charCodeAt(i);
|
|
3054
|
+
if (chr <= 255) {
|
|
3055
|
+
int8Array[j++] = chr;
|
|
3056
|
+
} else {
|
|
3057
|
+
console.log(`${chr}:${Math.floor(chr / 255)},${chr % 255}`)
|
|
3058
|
+
int8Array[j++] = Math.floor(chr / 255);
|
|
3059
|
+
int8Array[j++] = chr % 255;
|
|
3060
|
+
}
|
|
3061
|
+
}*/
|
|
3062
|
+
const te = new TextEncoder();
|
|
3063
|
+
const uint8array = te.encode(byteString);
|
|
3064
|
+
const blob = new Blob([uint8array], { type: 'text/plain;charset=UTF-8;' });
|
|
3065
|
+
return blob;
|
|
3066
|
+
}
|
|
3067
|
+
isEditable(filename) {
|
|
3068
|
+
return filename.match(/\.(txt|js|json|ts|cs|css|scss|xml|html|htm|exp|sh|pwsh|yml|yaml|xsl|xslt)$/ig) != null;
|
|
3069
|
+
}
|
|
3070
|
+
UploadFile(fileName, formData) {
|
|
3071
|
+
this.folderService.postFileContent(fileName, formData).pipe(map(event => {
|
|
3072
|
+
switch (event.type) {
|
|
3073
|
+
case HttpEventType.UploadProgress:
|
|
3074
|
+
//file.progress = Math.round(event.loaded * 100 / event.total);
|
|
3075
|
+
break;
|
|
3076
|
+
case HttpEventType.Response:
|
|
3077
|
+
return event.body;
|
|
3078
|
+
}
|
|
3079
|
+
}), catchError((error) => {
|
|
3080
|
+
//file.inProgress = false;
|
|
3081
|
+
return of(`${fileName} upload failed.`);
|
|
3082
|
+
})).subscribe((event) => {
|
|
3083
|
+
if (typeof (event) === 'object') {
|
|
3084
|
+
//obj.Logo = event.Logo;
|
|
3085
|
+
}
|
|
3086
|
+
});
|
|
3087
|
+
}
|
|
3088
|
+
Edit(fileName) {
|
|
3089
|
+
const dialogConfig = new MatDialogConfig();
|
|
3090
|
+
dialogConfig.disableClose = true;
|
|
3091
|
+
dialogConfig.autoFocus = true;
|
|
3092
|
+
dialogConfig.closeOnNavigation = false;
|
|
3093
|
+
let content;
|
|
3094
|
+
this.folderService.getFileContent(this.currentDir + '/' + fileName).subscribe(c => {
|
|
3095
|
+
dialogConfig.data = { path: this.currentDir + '/' + fileName, content: c };
|
|
3096
|
+
this.dialog.open(FileEditComponent, dialogConfig).afterClosed().subscribe(data => {
|
|
3097
|
+
if (data) {
|
|
3098
|
+
const formData = new FormData();
|
|
3099
|
+
const imageName = fileName;
|
|
3100
|
+
const imageBlob = this.dataURItoBlob(data.content);
|
|
3101
|
+
const file = new File([imageBlob], imageName, { type: 'text/plain;charset=UTF-8;' });
|
|
3102
|
+
formData.append('file', file);
|
|
3103
|
+
this.UploadFile(this.currentDir + '/' + fileName, formData);
|
|
3104
|
+
//file.inProgress = true;
|
|
3105
|
+
}
|
|
3106
|
+
});
|
|
3107
|
+
});
|
|
3108
|
+
}
|
|
3109
|
+
/*
|
|
3110
|
+
this.http.get(`${environment.apiUrl}`, {
|
|
3111
|
+
responseType: 'arraybuffer', headers: headers
|
|
3112
|
+
}
|
|
3113
|
+
).subscribe(response => this.downLoadFile(response, "application/ms-excel"));*/
|
|
3114
|
+
downloadFile(fileName) {
|
|
3115
|
+
this.folderService.getFileContentBlob(this.currentDir + '/' + fileName).subscribe(blob => {
|
|
3116
|
+
this.downLoadFile2(blob, blob.type);
|
|
3117
|
+
});
|
|
3118
|
+
}
|
|
3119
|
+
/**
|
|
3120
|
+
* Method is use to download file.
|
|
3121
|
+
* @param data - Array Buffer data
|
|
3122
|
+
* @param type - type of the document.
|
|
3123
|
+
*/
|
|
3124
|
+
downLoadFile2(data, type) {
|
|
3125
|
+
let blob = new Blob([data], { type: type });
|
|
3126
|
+
let url = window.URL.createObjectURL(blob);
|
|
3127
|
+
let pwa = window.open(url);
|
|
3128
|
+
if (!pwa || pwa.closed || typeof pwa.closed == 'undefined') {
|
|
3129
|
+
alert('Please disable your Pop-up blocker and try again.');
|
|
3130
|
+
}
|
|
3131
|
+
}
|
|
3132
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: FoldersComponent, deps: [{ token: FolderService }, { token: i2.Router }, { token: i2.ActivatedRoute }, { token: i1$2.MatDialog }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3133
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.17", type: FoldersComponent, isStandalone: false, selector: "gloww-folders", ngImport: i0, template: "<h1>\n <i class=\"fal fa-folder\" size=\"40px\"></i> /{{currentDir}}\n @if (currentDir) {\n <i class=\"fal fa-level-up\" [routerLink]=\"getRouterLink()\"></i>\n }\n</h1>\n@if (directoryContent) {\n <div>\n <i class=\"fal fa-folder-plus\" (click)=\"addFolder()\" size=\"30px\"></i>\n <ul>\n @for (d of directoryContent.directories; track d) {\n <li>\n <i class=\"fal fa-folder\"></i><a [routerLink]=\"getRouterLink(d)\">{{d}}</a>\n </li>\n }\n </ul>\n <i class=\"fal fa-file-plus\" (click)=\"addFile()\" size=\"30px\"></i>\n <i class=\"fal fa-file-upload\" (click)=\"addFileUpload()\" size=\"30px\"></i>\n <ul>\n @for (f of directoryContent.files; track f) {\n <li>\n @if (isEditable(f)) {\n <a (click)=\"Edit(f)\" href=\"javascript:void(0);\">\n <i class=\"fal fa-file\"></i> {{f}}\n </a>\n } @else {\n <i class=\"fal fa-file fa-disabled\"></i> <a (click)=\"downloadFile(f)\" target=\"_blank\" href=\"javascript:void(0);\">{{f}}</a>\n }\n </li>\n }\n </ul>\n </div>\n} @else {\n <mat-spinner></mat-spinner>\n}\n", styles: ["ul{list-style:none}.fa-disabled{opacity:.6;cursor:not-allowed}i{margin:5px;height:20px}\n"], dependencies: [{ kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i10.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }] }); }
|
|
3134
|
+
}
|
|
3135
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: FoldersComponent, decorators: [{
|
|
3136
|
+
type: Component,
|
|
3137
|
+
args: [{ selector: 'gloww-folders', standalone: false, template: "<h1>\n <i class=\"fal fa-folder\" size=\"40px\"></i> /{{currentDir}}\n @if (currentDir) {\n <i class=\"fal fa-level-up\" [routerLink]=\"getRouterLink()\"></i>\n }\n</h1>\n@if (directoryContent) {\n <div>\n <i class=\"fal fa-folder-plus\" (click)=\"addFolder()\" size=\"30px\"></i>\n <ul>\n @for (d of directoryContent.directories; track d) {\n <li>\n <i class=\"fal fa-folder\"></i><a [routerLink]=\"getRouterLink(d)\">{{d}}</a>\n </li>\n }\n </ul>\n <i class=\"fal fa-file-plus\" (click)=\"addFile()\" size=\"30px\"></i>\n <i class=\"fal fa-file-upload\" (click)=\"addFileUpload()\" size=\"30px\"></i>\n <ul>\n @for (f of directoryContent.files; track f) {\n <li>\n @if (isEditable(f)) {\n <a (click)=\"Edit(f)\" href=\"javascript:void(0);\">\n <i class=\"fal fa-file\"></i> {{f}}\n </a>\n } @else {\n <i class=\"fal fa-file fa-disabled\"></i> <a (click)=\"downloadFile(f)\" target=\"_blank\" href=\"javascript:void(0);\">{{f}}</a>\n }\n </li>\n }\n </ul>\n </div>\n} @else {\n <mat-spinner></mat-spinner>\n}\n", styles: ["ul{list-style:none}.fa-disabled{opacity:.6;cursor:not-allowed}i{margin:5px;height:20px}\n"] }]
|
|
3138
|
+
}], ctorParameters: () => [{ type: FolderService }, { type: i2.Router }, { type: i2.ActivatedRoute }, { type: i1$2.MatDialog }] });
|
|
3139
|
+
|
|
3140
|
+
class DownloadProgressComponent {
|
|
3141
|
+
constructor(dialogRef, arg, httpClient) {
|
|
3142
|
+
this.dialogRef = dialogRef;
|
|
3143
|
+
this.httpClient = httpClient;
|
|
3144
|
+
this.done = -1;
|
|
3145
|
+
this.name = arg.name;
|
|
3146
|
+
this.files = arg.files;
|
|
3147
|
+
this.current = [];
|
|
3148
|
+
this.message = "Download des fichiers";
|
|
3149
|
+
this.percent = -1;
|
|
3150
|
+
}
|
|
3151
|
+
ngOnInit() {
|
|
3152
|
+
if (this.name) {
|
|
3153
|
+
this.downloadZip();
|
|
3154
|
+
}
|
|
3155
|
+
else {
|
|
3156
|
+
this.download();
|
|
3157
|
+
}
|
|
3158
|
+
}
|
|
3159
|
+
async getFile(url, callback) {
|
|
3160
|
+
const httpOptions = {
|
|
3161
|
+
observe: "events",
|
|
3162
|
+
reportProgress: true,
|
|
3163
|
+
responseType: "blob" //as 'json'
|
|
3164
|
+
};
|
|
3165
|
+
const res = await this.httpClient.get(url, httpOptions).pipe(map((event) => {
|
|
3166
|
+
console.log(event);
|
|
3167
|
+
/*if (event.type === HttpEventType.DownloadProgress) {
|
|
3168
|
+
console.log(`download progress ${(event as HttpEventType.DownloadProgress).valueOf}`);
|
|
3169
|
+
}
|
|
3170
|
+
if (event.type === HttpEventType.Response) {
|
|
3171
|
+
console.log("donwload completed");
|
|
3172
|
+
}*/
|
|
3173
|
+
if (event.type === 3) {
|
|
3174
|
+
callback(url, event.loaded, event.total);
|
|
3175
|
+
}
|
|
3176
|
+
if (event instanceof HttpResponse) {
|
|
3177
|
+
callback(url, -1, -1);
|
|
3178
|
+
}
|
|
3179
|
+
return event;
|
|
3180
|
+
}), filter((event) => event instanceof HttpResponse)).toPromise().catch((err) => {
|
|
3181
|
+
const error = err.error;
|
|
3182
|
+
return error;
|
|
3183
|
+
});
|
|
3184
|
+
return res.body;
|
|
3185
|
+
}
|
|
3186
|
+
callback(url, loaded, total) {
|
|
3187
|
+
const index = this.current.findIndex(c => c.url === url);
|
|
3188
|
+
if (total === -1) {
|
|
3189
|
+
this.done += 1;
|
|
3190
|
+
this.current.splice(index, 1);
|
|
3191
|
+
}
|
|
3192
|
+
else {
|
|
3193
|
+
if (index === -1) {
|
|
3194
|
+
this.current.push({ url, loaded, total });
|
|
3195
|
+
}
|
|
3196
|
+
else {
|
|
3197
|
+
this.current[index].loaded = loaded;
|
|
3198
|
+
}
|
|
3199
|
+
}
|
|
3200
|
+
}
|
|
3201
|
+
callback_zip(metadata) {
|
|
3202
|
+
this.percent = metadata.percent;
|
|
3203
|
+
}
|
|
3204
|
+
async downloadZip() {
|
|
3205
|
+
const zip = new JSZip();
|
|
3206
|
+
// tslint:disable-next-line:prefer-for-of
|
|
3207
|
+
this.done = 0;
|
|
3208
|
+
await Promise.all(this.files.map(async (file) => {
|
|
3209
|
+
let fileData;
|
|
3210
|
+
fileData = await this.getFile(file.url, this.callback.bind(this));
|
|
3211
|
+
const b = new Blob([fileData], { type: '' + fileData.type + '' });
|
|
3212
|
+
zip.file(file.name, b);
|
|
3213
|
+
}));
|
|
3214
|
+
this.message = "Génération du fichier Zip";
|
|
3215
|
+
this.done = -1;
|
|
3216
|
+
await zip.generateAsync({ type: 'blob' }, this.callback_zip.bind(this)).then((content) => {
|
|
3217
|
+
if (content) {
|
|
3218
|
+
FileSaver.saveAs(content, this.name);
|
|
3219
|
+
}
|
|
3220
|
+
});
|
|
3221
|
+
this.dialogRef.close();
|
|
3222
|
+
}
|
|
3223
|
+
async download() {
|
|
3224
|
+
this.done = 0;
|
|
3225
|
+
await Promise.all(this.files.map(async (file) => {
|
|
3226
|
+
let fileData;
|
|
3227
|
+
fileData = await this.getFile(file.url, this.callback.bind(this));
|
|
3228
|
+
const b = new Blob([fileData], { type: '' + fileData.type + '' });
|
|
3229
|
+
if (file.name === "open") {
|
|
3230
|
+
var blobURL = URL.createObjectURL(b);
|
|
3231
|
+
window.open(blobURL);
|
|
3232
|
+
}
|
|
3233
|
+
else {
|
|
3234
|
+
FileSaver.saveAs(b, file.name);
|
|
3235
|
+
}
|
|
3236
|
+
}));
|
|
3237
|
+
this.message = "Génération du fichier Zip";
|
|
3238
|
+
this.done = -1;
|
|
3239
|
+
this.dialogRef.close();
|
|
3240
|
+
}
|
|
3241
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: DownloadProgressComponent, deps: [{ token: i1$2.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3242
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.17", type: DownloadProgressComponent, isStandalone: false, selector: "gloww-download-progress", ngImport: i0, template: "<h2 mat-dialog-title>Progression Download</h2>\n\n<mat-dialog-content>\n <H3>{{message}}</H3>\n @if (percent>0) {\n <mat-progress-bar [value]=\"percent\"></mat-progress-bar>\n }\n @if (done>=0) {\n <div>\n <mat-progress-bar [value]=\"done*100/files.length\"></mat-progress-bar> {{done}}/{{files.length}}\n <br />\n <ul>\n @for ( file of current; track file; let i = $index) {\n <li>\n <span id=\"file-label\">{{file.url}}</span>\n <mat-progress-bar [value]=\"file.loaded*100/file.total\"></mat-progress-bar>\n </li>\n }\n </ul>\n </div>\n }\n</mat-dialog-content>\n\n\n<mat-dialog-actions>\n <!--<button class=\"mat-raised-button\" (click)=\"cancel()\">Close</button>\n <button class=\"mat-raised-button mat-primary\" (click)=\"save()\">Save</button>-->\n</mat-dialog-actions>", styles: [""], dependencies: [{ kind: "directive", type: i1$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i4$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }] }); }
|
|
3243
|
+
}
|
|
3244
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: DownloadProgressComponent, decorators: [{
|
|
3245
|
+
type: Component,
|
|
3246
|
+
args: [{ selector: 'gloww-download-progress', standalone: false, template: "<h2 mat-dialog-title>Progression Download</h2>\n\n<mat-dialog-content>\n <H3>{{message}}</H3>\n @if (percent>0) {\n <mat-progress-bar [value]=\"percent\"></mat-progress-bar>\n }\n @if (done>=0) {\n <div>\n <mat-progress-bar [value]=\"done*100/files.length\"></mat-progress-bar> {{done}}/{{files.length}}\n <br />\n <ul>\n @for ( file of current; track file; let i = $index) {\n <li>\n <span id=\"file-label\">{{file.url}}</span>\n <mat-progress-bar [value]=\"file.loaded*100/file.total\"></mat-progress-bar>\n </li>\n }\n </ul>\n </div>\n }\n</mat-dialog-content>\n\n\n<mat-dialog-actions>\n <!--<button class=\"mat-raised-button\" (click)=\"cancel()\">Close</button>\n <button class=\"mat-raised-button mat-primary\" (click)=\"save()\">Save</button>-->\n</mat-dialog-actions>" }]
|
|
3247
|
+
}], ctorParameters: () => [{ type: i1$2.MatDialogRef }, { type: undefined, decorators: [{
|
|
3248
|
+
type: Inject,
|
|
3249
|
+
args: [MAT_DIALOG_DATA]
|
|
3250
|
+
}] }, { type: i1.HttpClient }] });
|
|
3251
|
+
|
|
3252
|
+
class SecureAComponent {
|
|
3253
|
+
constructor(dialog) {
|
|
3254
|
+
this.dialog = dialog;
|
|
3255
|
+
}
|
|
3256
|
+
ngOnInit() {
|
|
3257
|
+
}
|
|
3258
|
+
click() {
|
|
3259
|
+
const dialogConfig = new MatDialogConfig();
|
|
3260
|
+
dialogConfig.disableClose = true;
|
|
3261
|
+
dialogConfig.autoFocus = true;
|
|
3262
|
+
dialogConfig.closeOnNavigation = false;
|
|
3263
|
+
dialogConfig.data = { files: [{ url: this.href, name: this.name }] };
|
|
3264
|
+
this.dialog.open(DownloadProgressComponent, dialogConfig).afterClosed().subscribe();
|
|
3265
|
+
}
|
|
3266
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: SecureAComponent, deps: [{ token: i1$2.MatDialog }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3267
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.17", type: SecureAComponent, isStandalone: false, selector: "gloww-secure-a", inputs: { href: "href", name: "name" }, ngImport: i0, template: "<a (click)=\"click()\" href=\"javascript:void(0);\">\r\n <ng-content></ng-content>\r\n</a>", styles: [""] }); }
|
|
3268
|
+
}
|
|
3269
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: SecureAComponent, decorators: [{
|
|
3270
|
+
type: Component,
|
|
3271
|
+
args: [{ selector: 'gloww-secure-a', standalone: false, template: "<a (click)=\"click()\" href=\"javascript:void(0);\">\r\n <ng-content></ng-content>\r\n</a>" }]
|
|
3272
|
+
}], ctorParameters: () => [{ type: i1$2.MatDialog }], propDecorators: { href: [{
|
|
3273
|
+
type: Input
|
|
3274
|
+
}], name: [{
|
|
3275
|
+
type: Input
|
|
3276
|
+
}] } });
|
|
3277
|
+
|
|
3278
|
+
class DummyComponent {
|
|
3279
|
+
constructor() { }
|
|
3280
|
+
ngOnInit() {
|
|
3281
|
+
}
|
|
3282
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: DummyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3283
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.17", type: DummyComponent, isStandalone: false, selector: "gloww-dummy", ngImport: i0, template: "<p>dummy works!</p>\r\n", styles: [""] }); }
|
|
3284
|
+
}
|
|
3285
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: DummyComponent, decorators: [{
|
|
3286
|
+
type: Component,
|
|
3287
|
+
args: [{ selector: 'gloww-dummy', standalone: false, template: "<p>dummy works!</p>\r\n" }]
|
|
3288
|
+
}], ctorParameters: () => [] });
|
|
3289
|
+
|
|
3290
|
+
class SelectComponent {
|
|
3291
|
+
constructor(glowwService, formBuilder) {
|
|
3292
|
+
this.formBuilder = formBuilder;
|
|
3293
|
+
this._value = null;
|
|
3294
|
+
this.objectName = null;
|
|
3295
|
+
this.returnField = null;
|
|
3296
|
+
this.displayField = null;
|
|
3297
|
+
this.displayFct = null;
|
|
3298
|
+
this.placeHolder = null;
|
|
3299
|
+
this.data = null;
|
|
3300
|
+
this.compareField = null;
|
|
3301
|
+
this.onChange = () => { };
|
|
3302
|
+
this.onTouched = () => { };
|
|
3303
|
+
this.items = [];
|
|
3304
|
+
this.propagateChange = (_) => { };
|
|
3305
|
+
this.glowwService = glowwService;
|
|
3306
|
+
this.form = this.formBuilder.group({
|
|
3307
|
+
select: [null, null]
|
|
3308
|
+
});
|
|
3309
|
+
this.searchRequest = this.glowwService[`search${this.objectName}`];
|
|
3310
|
+
}
|
|
3311
|
+
ngAfterViewInit() {
|
|
3312
|
+
this.error = null;
|
|
3313
|
+
if (!this.searchRequest) {
|
|
3314
|
+
this.searchRequest = this.glowwService[`search${this.objectName}`];
|
|
3315
|
+
}
|
|
3316
|
+
let queryParams = {};
|
|
3317
|
+
if (this.data) {
|
|
3318
|
+
Object.keys(this.data).forEach(name => {
|
|
3319
|
+
queryParams[name] = this.data[name];
|
|
3320
|
+
});
|
|
3321
|
+
}
|
|
3322
|
+
//debugger;
|
|
3323
|
+
this.searchRequest.call(this.glowwService, queryParams).subscribe(items => this.items = items, error => {
|
|
3324
|
+
this.error = error;
|
|
3325
|
+
});
|
|
3326
|
+
if (!this.compareWith && this.compareField) {
|
|
3327
|
+
this.compareWith = (o1, o2) => o1[this.compareField] == o2[this.compareField];
|
|
3328
|
+
}
|
|
3329
|
+
}
|
|
3330
|
+
ngAfterContentInit() {
|
|
3331
|
+
}
|
|
3332
|
+
ngOnInit() {
|
|
3333
|
+
}
|
|
3334
|
+
writeValue(val) {
|
|
3335
|
+
val && this.form.setValue({ select: val }, { emitEvent: false });
|
|
3336
|
+
}
|
|
3337
|
+
registerOnChange(fn) {
|
|
3338
|
+
this.onChange = fn;
|
|
3339
|
+
this.form.valueChanges.subscribe(data => {
|
|
3340
|
+
if (this.returnField) {
|
|
3341
|
+
this.onChange(this.form.value.select[this.returnField]);
|
|
3342
|
+
}
|
|
3343
|
+
else {
|
|
3344
|
+
this.onChange(this.form.value.select);
|
|
3345
|
+
}
|
|
3346
|
+
});
|
|
3347
|
+
}
|
|
3348
|
+
registerOnTouched(fn) {
|
|
3349
|
+
this.onTouched = fn;
|
|
3350
|
+
}
|
|
3351
|
+
setDisabledState(isDisabled) {
|
|
3352
|
+
const status = isDisabled ? 'disable' : 'enable';
|
|
3353
|
+
//TODO
|
|
3354
|
+
}
|
|
3355
|
+
displayObj(item) {
|
|
3356
|
+
if (this.displayField) {
|
|
3357
|
+
return item[this.displayField];
|
|
3358
|
+
}
|
|
3359
|
+
else if (this.displayFct) {
|
|
3360
|
+
return this.displayFct(item);
|
|
3361
|
+
}
|
|
3362
|
+
}
|
|
3363
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: SelectComponent, deps: [{ token: 'glowwService' }, { token: i1$3.UntypedFormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3364
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.17", type: SelectComponent, isStandalone: false, selector: "gloww-select", inputs: { _value: ["value", "_value"], objectName: "objectName", returnField: "returnField", displayField: "displayField", displayFct: "displayFct", placeHolder: "placeHolder", data: "data", compareField: "compareField", compareWith: "compareWith", searchRequest: "searchRequest" }, providers: [
|
|
3365
|
+
{
|
|
3366
|
+
provide: NG_VALUE_ACCESSOR,
|
|
3367
|
+
multi: true,
|
|
3368
|
+
useExisting: SelectComponent
|
|
3369
|
+
}
|
|
3370
|
+
], ngImport: i0, template: "<form [formGroup]=\"form\">\n @if (error) {\n <div style=\"color:red\">{{error}}</div>\n }\n <mat-form-field>\n <mat-select [placeholder]=\"placeHolder\" formControlName=\"select\" [compareWith]=\"compareWith\">\n @for (item of items; track item) {\n <mat-option [value]=\"item\">{{displayObj(item)}}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n</form>", styles: [""], dependencies: [{ kind: "directive", type: i1$3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "component", type: i3$2.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i3$2.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }] }); }
|
|
3371
|
+
}
|
|
3372
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: SelectComponent, decorators: [{
|
|
3373
|
+
type: Component,
|
|
3374
|
+
args: [{ selector: 'gloww-select', providers: [
|
|
3375
|
+
{
|
|
3376
|
+
provide: NG_VALUE_ACCESSOR,
|
|
3377
|
+
multi: true,
|
|
3378
|
+
useExisting: SelectComponent
|
|
3379
|
+
}
|
|
3380
|
+
], standalone: false, template: "<form [formGroup]=\"form\">\n @if (error) {\n <div style=\"color:red\">{{error}}</div>\n }\n <mat-form-field>\n <mat-select [placeholder]=\"placeHolder\" formControlName=\"select\" [compareWith]=\"compareWith\">\n @for (item of items; track item) {\n <mat-option [value]=\"item\">{{displayObj(item)}}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n</form>" }]
|
|
3381
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
3382
|
+
type: Inject,
|
|
3383
|
+
args: ['glowwService']
|
|
3384
|
+
}] }, { type: i1$3.UntypedFormBuilder }], propDecorators: { _value: [{
|
|
3385
|
+
type: Input,
|
|
3386
|
+
args: ['value']
|
|
3387
|
+
}], objectName: [{
|
|
3388
|
+
type: Input,
|
|
3389
|
+
args: ['objectName']
|
|
3390
|
+
}], returnField: [{
|
|
3391
|
+
type: Input,
|
|
3392
|
+
args: ['returnField']
|
|
3393
|
+
}], displayField: [{
|
|
3394
|
+
type: Input,
|
|
3395
|
+
args: ['displayField']
|
|
3396
|
+
}], displayFct: [{
|
|
3397
|
+
type: Input,
|
|
3398
|
+
args: ['displayFct']
|
|
3399
|
+
}], placeHolder: [{
|
|
3400
|
+
type: Input,
|
|
3401
|
+
args: ['placeHolder']
|
|
3402
|
+
}], data: [{
|
|
3403
|
+
type: Input,
|
|
3404
|
+
args: ['data']
|
|
3405
|
+
}], compareField: [{
|
|
3406
|
+
type: Input,
|
|
3407
|
+
args: ['compareField']
|
|
3408
|
+
}], compareWith: [{
|
|
3409
|
+
type: Input
|
|
3410
|
+
}], searchRequest: [{
|
|
3411
|
+
type: Input
|
|
3412
|
+
}] } });
|
|
3413
|
+
|
|
3414
|
+
class AutoCompleteComponent {
|
|
3415
|
+
constructor(glowwService, formBuilder, ref) {
|
|
3416
|
+
this.formBuilder = formBuilder;
|
|
3417
|
+
this.ref = ref;
|
|
3418
|
+
this._value = null;
|
|
3419
|
+
this.objectName = null;
|
|
3420
|
+
this.searchField = null;
|
|
3421
|
+
this.returnField = null;
|
|
3422
|
+
this.displayField = null;
|
|
3423
|
+
this.displayExpr = null;
|
|
3424
|
+
this.displayFct = null;
|
|
3425
|
+
this.placeHolder = null;
|
|
3426
|
+
this.data = null;
|
|
3427
|
+
this.onChange = () => { };
|
|
3428
|
+
this.onTouched = () => { };
|
|
3429
|
+
this.items = [];
|
|
3430
|
+
this.parser = new TranslateDefaultParser();
|
|
3431
|
+
this.options = []; //Observable<unknown>;
|
|
3432
|
+
this.propagateChange = (_) => { };
|
|
3433
|
+
this.glowwService = glowwService;
|
|
3434
|
+
this.resultCtrl = new UntypedFormControl();
|
|
3435
|
+
this.form = this.formBuilder.group({
|
|
3436
|
+
__result: this.resultCtrl
|
|
3437
|
+
});
|
|
3438
|
+
}
|
|
3439
|
+
ngAfterViewInit() {
|
|
3440
|
+
}
|
|
3441
|
+
ngOnInit() {
|
|
3442
|
+
//debugger;
|
|
3443
|
+
this.searchRequest = this.glowwService[`search${this.objectName}`];
|
|
3444
|
+
this.resultCtrl.valueChanges.pipe(filter(res => res != null && res.length > 2), distinctUntilChanged(), debounceTime(250), tap(() => { this.error = ""; this.options = []; }), switchMap(searchStr => {
|
|
3445
|
+
let searchObj = {};
|
|
3446
|
+
if (this.data) {
|
|
3447
|
+
Object.keys(this.data).forEach(k => {
|
|
3448
|
+
searchObj[k] = this.data[k];
|
|
3449
|
+
});
|
|
3450
|
+
}
|
|
3451
|
+
searchObj[this.searchField] = searchStr;
|
|
3452
|
+
return this.searchRequest.call(this.glowwService, searchObj).pipe(map(res => res), catchError(err => {
|
|
3453
|
+
this.error = err.message;
|
|
3454
|
+
this.ref.markForCheck();
|
|
3455
|
+
return of([]);
|
|
3456
|
+
}));
|
|
3457
|
+
})).subscribe({
|
|
3458
|
+
next: (data) => {
|
|
3459
|
+
this.options = data;
|
|
3460
|
+
this.ref.markForCheck();
|
|
3461
|
+
},
|
|
3462
|
+
error: (error) => { this.error = error; }
|
|
3463
|
+
});
|
|
3464
|
+
}
|
|
3465
|
+
writeValue(val) {
|
|
3466
|
+
val && this.form.setValue({ __result: val }, { emitEvent: false });
|
|
3467
|
+
}
|
|
3468
|
+
registerOnChange(fn) {
|
|
3469
|
+
this.onChange = fn;
|
|
3470
|
+
this.form.valueChanges.subscribe(data => {
|
|
3471
|
+
if (this.returnField) {
|
|
3472
|
+
this.onChange(this.form.value.__result[this.returnField]);
|
|
3473
|
+
}
|
|
3474
|
+
else {
|
|
3475
|
+
this.onChange(this.form.value.__result);
|
|
3476
|
+
}
|
|
3477
|
+
});
|
|
3478
|
+
}
|
|
3479
|
+
registerOnTouched(fn) {
|
|
3480
|
+
this.onTouched = fn;
|
|
3481
|
+
}
|
|
3482
|
+
setDisabledState(isDisabled) {
|
|
3483
|
+
const status = isDisabled ? 'disable' : 'enable';
|
|
3484
|
+
//TODO
|
|
3485
|
+
}
|
|
3486
|
+
displayObj(item) {
|
|
3487
|
+
if (!item)
|
|
3488
|
+
return null;
|
|
3489
|
+
console.log("displayOf");
|
|
3490
|
+
if (this.displayField) {
|
|
3491
|
+
return item[this.displayField];
|
|
3492
|
+
}
|
|
3493
|
+
else if (this.displayExpr) {
|
|
3494
|
+
return this.parser.interpolate(this.displayExpr.replace(/\\\{/g, "{").replace(/\\\}/g, "}"), item);
|
|
3495
|
+
//return '?1' + this.parser.interpolate("{{Name}}", { Name: "test" }) + '?2' + this.parser.interpolate("{{Name}}", item)+'?3'+this.parser.interpolate(this.displayExpr.replace(/\\\{/g,"{").replace(/\\\}/g,"}"), item) +'?4'+ item;
|
|
3496
|
+
}
|
|
3497
|
+
else if (this.displayFct) {
|
|
3498
|
+
return this.displayFct(item);
|
|
3499
|
+
}
|
|
3500
|
+
}
|
|
3501
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: AutoCompleteComponent, deps: [{ token: 'glowwService' }, { token: i1$3.UntypedFormBuilder }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3502
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.17", type: AutoCompleteComponent, isStandalone: false, selector: "gloww-auto-complete", inputs: { _value: ["value", "_value"], objectName: "objectName", searchField: "searchField", returnField: "returnField", displayField: "displayField", displayExpr: "displayExpr", displayFct: "displayFct", placeHolder: "placeHolder", data: "data", searchRequest: "searchRequest" }, providers: [
|
|
3503
|
+
{
|
|
3504
|
+
provide: NG_VALUE_ACCESSOR,
|
|
3505
|
+
multi: true,
|
|
3506
|
+
useExisting: forwardRef(() => AutoCompleteComponent)
|
|
3507
|
+
}
|
|
3508
|
+
], ngImport: i0, template: "<div [formGroup]=\"form\" style=\"width:100%\" class=\"mainDiv\">\n <div style=\"color:red\">{{error}}</div>\n <mat-form-field style=\"width:100%\" class=\"autocff\">\n <input type=\"text\" matInput formControlName=\"__result\" [matAutocomplete]=\"auto\" [placeholder]=\"placeHolder\">\n </mat-form-field>\n <mat-autocomplete #auto=\"matAutocomplete\" [displayWith]=\"displayObj.bind(this)\">\n @for (option of options; track option) {\n <mat-option [value]=\"option\" [innerHTML]=\"displayObj(option) | safeHtml\">\n </mat-option>\n }\n </mat-autocomplete>\n</div>", styles: [""], dependencies: [{ kind: "directive", type: i1$3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i2$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "component", type: i3$2.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i4$2.MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i4$2.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "pipe", type: SafeHtmlPipe, name: "safeHtml" }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
3509
|
+
}
|
|
3510
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: AutoCompleteComponent, decorators: [{
|
|
3511
|
+
type: Component,
|
|
3512
|
+
args: [{ selector: 'gloww-auto-complete', encapsulation: ViewEncapsulation.None, providers: [
|
|
3513
|
+
{
|
|
3514
|
+
provide: NG_VALUE_ACCESSOR,
|
|
3515
|
+
multi: true,
|
|
3516
|
+
useExisting: forwardRef(() => AutoCompleteComponent)
|
|
3517
|
+
}
|
|
3518
|
+
], standalone: false, template: "<div [formGroup]=\"form\" style=\"width:100%\" class=\"mainDiv\">\n <div style=\"color:red\">{{error}}</div>\n <mat-form-field style=\"width:100%\" class=\"autocff\">\n <input type=\"text\" matInput formControlName=\"__result\" [matAutocomplete]=\"auto\" [placeholder]=\"placeHolder\">\n </mat-form-field>\n <mat-autocomplete #auto=\"matAutocomplete\" [displayWith]=\"displayObj.bind(this)\">\n @for (option of options; track option) {\n <mat-option [value]=\"option\" [innerHTML]=\"displayObj(option) | safeHtml\">\n </mat-option>\n }\n </mat-autocomplete>\n</div>" }]
|
|
3519
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
3520
|
+
type: Inject,
|
|
3521
|
+
args: ['glowwService']
|
|
3522
|
+
}] }, { type: i1$3.UntypedFormBuilder }, { type: i0.ChangeDetectorRef }], propDecorators: { _value: [{
|
|
3523
|
+
type: Input,
|
|
3524
|
+
args: ['value']
|
|
3525
|
+
}], objectName: [{
|
|
3526
|
+
type: Input,
|
|
3527
|
+
args: ['objectName']
|
|
3528
|
+
}], searchField: [{
|
|
3529
|
+
type: Input,
|
|
3530
|
+
args: ['searchField']
|
|
3531
|
+
}], returnField: [{
|
|
3532
|
+
type: Input,
|
|
3533
|
+
args: ['returnField']
|
|
3534
|
+
}], displayField: [{
|
|
3535
|
+
type: Input,
|
|
3536
|
+
args: ['displayField']
|
|
3537
|
+
}], displayExpr: [{
|
|
3538
|
+
type: Input,
|
|
3539
|
+
args: ['displayExpr']
|
|
3540
|
+
}], displayFct: [{
|
|
3541
|
+
type: Input,
|
|
3542
|
+
args: ['displayFct']
|
|
3543
|
+
}], placeHolder: [{
|
|
3544
|
+
type: Input,
|
|
3545
|
+
args: ['placeHolder']
|
|
3546
|
+
}], data: [{
|
|
3547
|
+
type: Input,
|
|
3548
|
+
args: ['data']
|
|
3549
|
+
}], searchRequest: [{
|
|
3550
|
+
type: Input
|
|
3551
|
+
}] } });
|
|
3552
|
+
|
|
3553
|
+
class DatetimeComponent {
|
|
3554
|
+
constructor() {
|
|
3555
|
+
this._value = null;
|
|
3556
|
+
this.display = null;
|
|
3557
|
+
this.placeHolder = null;
|
|
3558
|
+
this.mode = 'date';
|
|
3559
|
+
this.showSpinners = true;
|
|
3560
|
+
this.showSeconds = false;
|
|
3561
|
+
this.disableMinute = false;
|
|
3562
|
+
this.onChange = () => { };
|
|
3563
|
+
this.onTouched = () => { };
|
|
3564
|
+
}
|
|
3565
|
+
get value() {
|
|
3566
|
+
return this._value;
|
|
3567
|
+
}
|
|
3568
|
+
set value(val) {
|
|
3569
|
+
this._value = val;
|
|
3570
|
+
let dt = this._value;
|
|
3571
|
+
if (typeof (this._value) === 'string') {
|
|
3572
|
+
dt = moment(this._value).toISOString();
|
|
3573
|
+
}
|
|
3574
|
+
this.onChange(dt);
|
|
3575
|
+
this.onTouched();
|
|
3576
|
+
}
|
|
3577
|
+
writeValue(obj) {
|
|
3578
|
+
this.value = obj;
|
|
3579
|
+
}
|
|
3580
|
+
registerOnChange(fn) {
|
|
3581
|
+
this.onChange = fn;
|
|
3582
|
+
}
|
|
3583
|
+
registerOnTouched(fn) {
|
|
3584
|
+
this.onTouched = fn;
|
|
3585
|
+
}
|
|
3586
|
+
setDisabledState(isDisabled) {
|
|
3587
|
+
//throw new Error('Method not implemented.');
|
|
3588
|
+
}
|
|
3589
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: DatetimeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3590
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.17", type: DatetimeComponent, isStandalone: false, selector: "gloww-datetime", inputs: { _value: ["value", "_value"], display: "display", placeHolder: "placeHolder", mode: "mode", showSpinners: "showSpinners", showSeconds: "showSeconds", disableMinute: "disableMinute" }, providers: [
|
|
3591
|
+
{
|
|
3592
|
+
provide: NG_VALUE_ACCESSOR,
|
|
3593
|
+
multi: true,
|
|
3594
|
+
useExisting: DatetimeComponent
|
|
3595
|
+
}
|
|
3596
|
+
], ngImport: i0, template: "<div style=\"width:100%\">\n @if (mode==='date') {\n <mat-form-field>\n <mat-label>{{display}}</mat-label>\n <input matInput [matDatepicker]=\"picker\" [placeholder]=\"placeHolder\" [(ngModel)]=\"value\">\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n }\n\n @if (mode==='datetime') {\n <mat-form-field>\n <mat-label>{{display}}</mat-label>\n <input matInput [ngxMatDatetimePicker]=\"pickerDT\" [placeholder]=\"placeHolder\" [(ngModel)]=\"value\">\n <mat-datepicker-toggle matSuffix [for]=\"$any(pickerDT)\"></mat-datepicker-toggle>\n <ngx-mat-datetime-picker #pickerDT [showSpinners]=\"showSpinners\" [showSeconds]=\"showSeconds\" [touchUi]=\"true\" [disableMinute]=\"disableMinute\">\n </ngx-mat-datetime-picker>\n </mat-form-field>\n }\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1$3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: i3$3.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i3$3.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i3$3.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "component", type: i4$3.NgxMatDatetimepicker, selector: "ngx-mat-datetime-picker", exportAs: ["ngxMatDatetimePicker"] }, { kind: "directive", type: i4$3.NgxMatDatepickerInput, selector: "input[ngxMatDatetimePicker]", inputs: ["ngxMatDatetimePicker", "min", "max", "matDatepickerFilter"], exportAs: ["ngxMatDatepickerInput"] }] }); }
|
|
3597
|
+
}
|
|
3598
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: DatetimeComponent, decorators: [{
|
|
3599
|
+
type: Component,
|
|
3600
|
+
args: [{ selector: 'gloww-datetime', providers: [
|
|
3601
|
+
{
|
|
3602
|
+
provide: NG_VALUE_ACCESSOR,
|
|
3603
|
+
multi: true,
|
|
3604
|
+
useExisting: DatetimeComponent
|
|
3605
|
+
}
|
|
3606
|
+
], standalone: false, template: "<div style=\"width:100%\">\n @if (mode==='date') {\n <mat-form-field>\n <mat-label>{{display}}</mat-label>\n <input matInput [matDatepicker]=\"picker\" [placeholder]=\"placeHolder\" [(ngModel)]=\"value\">\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n }\n\n @if (mode==='datetime') {\n <mat-form-field>\n <mat-label>{{display}}</mat-label>\n <input matInput [ngxMatDatetimePicker]=\"pickerDT\" [placeholder]=\"placeHolder\" [(ngModel)]=\"value\">\n <mat-datepicker-toggle matSuffix [for]=\"$any(pickerDT)\"></mat-datepicker-toggle>\n <ngx-mat-datetime-picker #pickerDT [showSpinners]=\"showSpinners\" [showSeconds]=\"showSeconds\" [touchUi]=\"true\" [disableMinute]=\"disableMinute\">\n </ngx-mat-datetime-picker>\n </mat-form-field>\n }\n</div>\n" }]
|
|
3607
|
+
}], ctorParameters: () => [], propDecorators: { _value: [{
|
|
3608
|
+
type: Input,
|
|
3609
|
+
args: ['value']
|
|
3610
|
+
}], display: [{
|
|
3611
|
+
type: Input,
|
|
3612
|
+
args: ['display']
|
|
3613
|
+
}], placeHolder: [{
|
|
3614
|
+
type: Input,
|
|
3615
|
+
args: ['placeHolder']
|
|
3616
|
+
}], mode: [{
|
|
3617
|
+
type: Input,
|
|
3618
|
+
args: ['mode']
|
|
3619
|
+
}], showSpinners: [{
|
|
3620
|
+
type: Input
|
|
3621
|
+
}], showSeconds: [{
|
|
3622
|
+
type: Input
|
|
3623
|
+
}], disableMinute: [{
|
|
3624
|
+
type: Input
|
|
3625
|
+
}] } });
|
|
3626
|
+
|
|
3627
|
+
class BaseCollectionComponent {
|
|
3628
|
+
constructor(_formBuilder) {
|
|
3629
|
+
this._formBuilder = _formBuilder;
|
|
3630
|
+
this.filterform = this._formBuilder.group({
|
|
3631
|
+
filterData: [null, null],
|
|
3632
|
+
});
|
|
3633
|
+
}
|
|
3634
|
+
Filter(args) {
|
|
3635
|
+
const filterDictionary = new Map();
|
|
3636
|
+
var jsonString = JSON.stringify(args ?? this.filterform.value.filterData);
|
|
3637
|
+
this.GetDataSource().filter = jsonString;
|
|
3638
|
+
}
|
|
3639
|
+
}
|
|
3640
|
+
|
|
3641
|
+
/*@Injectable({
|
|
3642
|
+
providedIn: 'root'
|
|
3643
|
+
})
|
|
3644
|
+
export class HasUnsavedDataGuard implements CanDeactivate<unknown> {
|
|
3645
|
+
canDeactivate(
|
|
3646
|
+
component: unknown,
|
|
3647
|
+
currentRoute: ActivatedRouteSnapshot,
|
|
3648
|
+
currentState: RouterStateSnapshot,
|
|
3649
|
+
nextState?: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
|
|
3650
|
+
return true;
|
|
3651
|
+
}
|
|
3652
|
+
|
|
3653
|
+
}*/
|
|
3654
|
+
class HasUnsavedDataGuard {
|
|
3655
|
+
canDeactivate(component) {
|
|
3656
|
+
if (component.hasUnsavedData && component.hasUnsavedData()) {
|
|
3657
|
+
return confirm('You have some unsaved form data. Are you sure, you want to leave this page ? ');
|
|
3658
|
+
}
|
|
3659
|
+
return true;
|
|
3660
|
+
}
|
|
3661
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: HasUnsavedDataGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3662
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: HasUnsavedDataGuard }); }
|
|
3663
|
+
}
|
|
3664
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: HasUnsavedDataGuard, decorators: [{
|
|
3665
|
+
type: Injectable
|
|
3666
|
+
}] });
|
|
3667
|
+
|
|
3668
|
+
class GlowwModule {
|
|
3669
|
+
static forRoot(folderServiceConfig) {
|
|
3670
|
+
console.log(`forRoot ${folderServiceConfig}`);
|
|
3671
|
+
return {
|
|
3672
|
+
ngModule: GlowwModule,
|
|
3673
|
+
providers: [
|
|
3674
|
+
VersionCheckService,
|
|
3675
|
+
NavService,
|
|
3676
|
+
VoiceRecognitionService,
|
|
3677
|
+
{
|
|
3678
|
+
provide: FolderServiceConfig,
|
|
3679
|
+
useValue: folderServiceConfig
|
|
3680
|
+
},
|
|
3681
|
+
{ provide: MAT_DATE_LOCALE, useValue: 'fr' }
|
|
3682
|
+
]
|
|
3683
|
+
};
|
|
3684
|
+
}
|
|
3685
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: GlowwModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
3686
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.17", ngImport: i0, type: GlowwModule, declarations: [UploadDocComponent,
|
|
3687
|
+
SafeHtmlPipe,
|
|
3688
|
+
DisplayObjectsComponent,
|
|
3689
|
+
HeaderComponent,
|
|
3690
|
+
ResultTableComponent,
|
|
3691
|
+
SearchFormComponent,
|
|
3692
|
+
ConfirmationComponent,
|
|
3693
|
+
PromptComponent,
|
|
3694
|
+
SecurePipe,
|
|
3695
|
+
SecureImgComponent,
|
|
3696
|
+
MenuListItemComponent,
|
|
3697
|
+
CodeEditorComponent,
|
|
3698
|
+
HtmlEditorComponent,
|
|
3699
|
+
HtmlFormatPipe,
|
|
3700
|
+
UploadFileComponent,
|
|
3701
|
+
FileSinkDirective,
|
|
3702
|
+
FileEditComponent,
|
|
3703
|
+
FoldersComponent,
|
|
3704
|
+
DownloadProgressComponent,
|
|
3705
|
+
SecureAComponent,
|
|
3706
|
+
DummyComponent,
|
|
3707
|
+
SelectComponent,
|
|
3708
|
+
AutoCompleteComponent,
|
|
3709
|
+
DatetimeComponent,
|
|
3710
|
+
RouteDirective,
|
|
3711
|
+
FilterFormComponent], imports: [CommonModule,
|
|
3712
|
+
BrowserModule,
|
|
3713
|
+
RouterModule,
|
|
3714
|
+
FormsModule,
|
|
3715
|
+
ReactiveFormsModule,
|
|
3716
|
+
MatDialogModule,
|
|
3717
|
+
MatInputModule,
|
|
3718
|
+
MatIconModule,
|
|
3719
|
+
MatButtonModule,
|
|
3720
|
+
MatCardModule,
|
|
3721
|
+
MatProgressSpinnerModule,
|
|
3722
|
+
MatProgressBarModule,
|
|
3723
|
+
MatTableModule,
|
|
3724
|
+
MatSelectModule,
|
|
3725
|
+
MatPaginatorModule,
|
|
3726
|
+
MatSortModule,
|
|
3727
|
+
MatProgressSpinnerModule,
|
|
3728
|
+
MatAutocompleteModule,
|
|
3729
|
+
CodemirrorModule,
|
|
3730
|
+
AngularEditorModule,
|
|
3731
|
+
MatDatepickerModule,
|
|
3732
|
+
NgxMatDatetimePickerModule, // Existe selon ta liste
|
|
3733
|
+
NgxMatTimepickerComponent, // Attention : ta liste dit "NgxMatTimepickerComponent"
|
|
3734
|
+
NgxMatNativeDateModule, // Existe selon ta liste
|
|
3735
|
+
//NgxMatMomentModule,
|
|
3736
|
+
DragDropModule,
|
|
3737
|
+
AngularResizeEventModule], exports: [SafeHtmlPipe,
|
|
3738
|
+
UploadDocComponent,
|
|
3739
|
+
UploadFileComponent,
|
|
3740
|
+
DisplayObjectsComponent,
|
|
3741
|
+
HeaderComponent,
|
|
3742
|
+
ResultTableComponent,
|
|
3743
|
+
SearchFormComponent,
|
|
3744
|
+
ConfirmationComponent,
|
|
3745
|
+
PromptComponent,
|
|
3746
|
+
SecurePipe,
|
|
3747
|
+
SecureImgComponent,
|
|
3748
|
+
MenuListItemComponent,
|
|
3749
|
+
CodeEditorComponent,
|
|
3750
|
+
HtmlEditorComponent,
|
|
3751
|
+
HtmlFormatPipe,
|
|
3752
|
+
FoldersComponent,
|
|
3753
|
+
DownloadProgressComponent,
|
|
3754
|
+
SecureAComponent,
|
|
3755
|
+
DummyComponent,
|
|
3756
|
+
SelectComponent,
|
|
3757
|
+
AutoCompleteComponent,
|
|
3758
|
+
DatetimeComponent,
|
|
3759
|
+
MatDatepickerModule,
|
|
3760
|
+
NgxMatDatetimePickerModule, // Existe selon ta liste
|
|
3761
|
+
NgxMatTimepickerComponent, // Attention : ta liste dit "NgxMatTimepickerComponent"
|
|
3762
|
+
NgxMatNativeDateModule, // Existe selon ta liste
|
|
3763
|
+
//NgxMatMomentModule,
|
|
3764
|
+
FilterFormComponent] }); }
|
|
3765
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: GlowwModule, imports: [CommonModule,
|
|
3766
|
+
BrowserModule,
|
|
3767
|
+
RouterModule,
|
|
3768
|
+
FormsModule,
|
|
3769
|
+
ReactiveFormsModule,
|
|
3770
|
+
MatDialogModule,
|
|
3771
|
+
MatInputModule,
|
|
3772
|
+
MatIconModule,
|
|
3773
|
+
MatButtonModule,
|
|
3774
|
+
MatCardModule,
|
|
3775
|
+
MatProgressSpinnerModule,
|
|
3776
|
+
MatProgressBarModule,
|
|
3777
|
+
MatTableModule,
|
|
3778
|
+
MatSelectModule,
|
|
3779
|
+
MatPaginatorModule,
|
|
3780
|
+
MatSortModule,
|
|
3781
|
+
MatProgressSpinnerModule,
|
|
3782
|
+
MatAutocompleteModule,
|
|
3783
|
+
CodemirrorModule,
|
|
3784
|
+
AngularEditorModule,
|
|
3785
|
+
MatDatepickerModule,
|
|
3786
|
+
NgxMatDatetimePickerModule, // Existe selon ta liste
|
|
3787
|
+
NgxMatTimepickerComponent, // Attention : ta liste dit "NgxMatTimepickerComponent"
|
|
3788
|
+
NgxMatNativeDateModule, // Existe selon ta liste
|
|
3789
|
+
//NgxMatMomentModule,
|
|
3790
|
+
DragDropModule,
|
|
3791
|
+
AngularResizeEventModule, MatDatepickerModule,
|
|
3792
|
+
NgxMatDatetimePickerModule, // Attention : ta liste dit "NgxMatTimepickerComponent"
|
|
3793
|
+
NgxMatNativeDateModule] }); }
|
|
3794
|
+
}
|
|
3795
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: GlowwModule, decorators: [{
|
|
3796
|
+
type: NgModule,
|
|
3797
|
+
args: [{
|
|
3798
|
+
declarations: [
|
|
3799
|
+
UploadDocComponent,
|
|
3800
|
+
SafeHtmlPipe,
|
|
3801
|
+
DisplayObjectsComponent,
|
|
3802
|
+
HeaderComponent,
|
|
3803
|
+
ResultTableComponent,
|
|
3804
|
+
SearchFormComponent,
|
|
3805
|
+
ConfirmationComponent,
|
|
3806
|
+
PromptComponent,
|
|
3807
|
+
SecurePipe,
|
|
3808
|
+
SecureImgComponent,
|
|
3809
|
+
MenuListItemComponent,
|
|
3810
|
+
CodeEditorComponent,
|
|
3811
|
+
HtmlEditorComponent,
|
|
3812
|
+
HtmlFormatPipe,
|
|
3813
|
+
UploadFileComponent,
|
|
3814
|
+
FileSinkDirective,
|
|
3815
|
+
FileEditComponent,
|
|
3816
|
+
FoldersComponent,
|
|
3817
|
+
DownloadProgressComponent,
|
|
3818
|
+
SecureAComponent,
|
|
3819
|
+
DummyComponent,
|
|
3820
|
+
SelectComponent,
|
|
3821
|
+
AutoCompleteComponent,
|
|
3822
|
+
DatetimeComponent,
|
|
3823
|
+
RouteDirective,
|
|
3824
|
+
FilterFormComponent
|
|
3825
|
+
],
|
|
3826
|
+
imports: [
|
|
3827
|
+
CommonModule,
|
|
3828
|
+
BrowserModule,
|
|
3829
|
+
RouterModule,
|
|
3830
|
+
FormsModule,
|
|
3831
|
+
ReactiveFormsModule,
|
|
3832
|
+
MatDialogModule,
|
|
3833
|
+
MatInputModule,
|
|
3834
|
+
MatIconModule,
|
|
3835
|
+
MatButtonModule,
|
|
3836
|
+
MatCardModule,
|
|
3837
|
+
MatProgressSpinnerModule,
|
|
3838
|
+
MatProgressBarModule,
|
|
3839
|
+
MatTableModule,
|
|
3840
|
+
MatSelectModule,
|
|
3841
|
+
MatPaginatorModule,
|
|
3842
|
+
MatSortModule,
|
|
3843
|
+
MatProgressSpinnerModule,
|
|
3844
|
+
MatAutocompleteModule,
|
|
3845
|
+
CodemirrorModule,
|
|
3846
|
+
AngularEditorModule,
|
|
3847
|
+
MatDatepickerModule,
|
|
3848
|
+
NgxMatDatetimePickerModule, // Existe selon ta liste
|
|
3849
|
+
NgxMatTimepickerComponent, // Attention : ta liste dit "NgxMatTimepickerComponent"
|
|
3850
|
+
NgxMatNativeDateModule, // Existe selon ta liste
|
|
3851
|
+
//NgxMatMomentModule,
|
|
3852
|
+
DragDropModule,
|
|
3853
|
+
AngularResizeEventModule
|
|
3854
|
+
],
|
|
3855
|
+
providers: [],
|
|
3856
|
+
exports: [
|
|
3857
|
+
SafeHtmlPipe,
|
|
3858
|
+
UploadDocComponent,
|
|
3859
|
+
UploadFileComponent,
|
|
3860
|
+
DisplayObjectsComponent,
|
|
3861
|
+
HeaderComponent,
|
|
3862
|
+
ResultTableComponent,
|
|
3863
|
+
SearchFormComponent,
|
|
3864
|
+
ConfirmationComponent,
|
|
3865
|
+
PromptComponent,
|
|
3866
|
+
SecurePipe,
|
|
3867
|
+
SecureImgComponent,
|
|
3868
|
+
MenuListItemComponent,
|
|
3869
|
+
CodeEditorComponent,
|
|
3870
|
+
HtmlEditorComponent,
|
|
3871
|
+
HtmlFormatPipe,
|
|
3872
|
+
FoldersComponent,
|
|
3873
|
+
DownloadProgressComponent,
|
|
3874
|
+
SecureAComponent,
|
|
3875
|
+
DummyComponent,
|
|
3876
|
+
SelectComponent,
|
|
3877
|
+
AutoCompleteComponent,
|
|
3878
|
+
DatetimeComponent,
|
|
3879
|
+
MatDatepickerModule,
|
|
3880
|
+
NgxMatDatetimePickerModule, // Existe selon ta liste
|
|
3881
|
+
NgxMatTimepickerComponent, // Attention : ta liste dit "NgxMatTimepickerComponent"
|
|
3882
|
+
NgxMatNativeDateModule, // Existe selon ta liste
|
|
3883
|
+
//NgxMatMomentModule,
|
|
3884
|
+
FilterFormComponent
|
|
3885
|
+
]
|
|
3886
|
+
}]
|
|
3887
|
+
}] });
|
|
3888
|
+
|
|
3889
|
+
class GlowwSecurityService {
|
|
3890
|
+
constructor() { }
|
|
3891
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: GlowwSecurityService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3892
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: GlowwSecurityService, providedIn: 'root' }); }
|
|
3893
|
+
}
|
|
3894
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: GlowwSecurityService, decorators: [{
|
|
3895
|
+
type: Injectable,
|
|
3896
|
+
args: [{
|
|
3897
|
+
providedIn: 'root'
|
|
3898
|
+
}]
|
|
3899
|
+
}], ctorParameters: () => [] });
|
|
3900
|
+
|
|
3901
|
+
class GlowwValidators {
|
|
3902
|
+
static isObject(control) {
|
|
3903
|
+
if (typeof control.value !== 'object') {
|
|
3904
|
+
return { 'isNotObject': true };
|
|
3905
|
+
}
|
|
3906
|
+
return null;
|
|
3907
|
+
}
|
|
3908
|
+
static isEmail(control) {
|
|
3909
|
+
if (!control.value)
|
|
3910
|
+
return null;
|
|
3911
|
+
var re = /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/;
|
|
3912
|
+
if (typeof control.value !== 'string' || !control.value.toString().match(re)) {
|
|
3913
|
+
return { 'isNotEmail': true };
|
|
3914
|
+
}
|
|
3915
|
+
return null;
|
|
3916
|
+
}
|
|
3917
|
+
static isInteger(control) {
|
|
3918
|
+
if (!control.value)
|
|
3919
|
+
return null;
|
|
3920
|
+
var re = /(?:^\s*\d*\s*$)/;
|
|
3921
|
+
if ((typeof control.value !== 'number') && (typeof control.value !== 'string' || !control.value.toString().match(re))) {
|
|
3922
|
+
return { 'isNotInteger': true };
|
|
3923
|
+
}
|
|
3924
|
+
return null;
|
|
3925
|
+
}
|
|
3926
|
+
static isNumber(control) {
|
|
3927
|
+
if (!control.value)
|
|
3928
|
+
return null;
|
|
3929
|
+
var re = /(?:(?:^\s*(?:\d+(?:[\.]\d+)?)?\s*$))/;
|
|
3930
|
+
if ((typeof control.value !== 'number') && (typeof control.value !== 'string' || !control.value.toString().match(re))) {
|
|
3931
|
+
return { 'isNotNumber': true };
|
|
3932
|
+
}
|
|
3933
|
+
return null;
|
|
3934
|
+
}
|
|
3935
|
+
static isUrl(control) {
|
|
3936
|
+
if (!control.value)
|
|
3937
|
+
return null;
|
|
3938
|
+
var re = /^(((https?:(?:\/\/)?)?(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?)$/;
|
|
3939
|
+
if (typeof control.value !== 'string' || !control.value.toString().match(re)) {
|
|
3940
|
+
return { 'isNotUrl': true };
|
|
3941
|
+
}
|
|
3942
|
+
return null;
|
|
3943
|
+
}
|
|
3944
|
+
static isIPv4(control) {
|
|
3945
|
+
if (!control.value)
|
|
3946
|
+
return null;
|
|
3947
|
+
var re = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
|
|
3948
|
+
if (typeof control.value !== 'string' || !control.value.toString().match(re)) {
|
|
3949
|
+
return { 'isNotUrl': true };
|
|
3950
|
+
}
|
|
3951
|
+
return null;
|
|
3952
|
+
}
|
|
3953
|
+
static isIPv4Range(control) {
|
|
3954
|
+
if (!control.value)
|
|
3955
|
+
return null;
|
|
3956
|
+
var re = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/\d{1,2}$/;
|
|
3957
|
+
if (typeof control.value !== 'string' || !control.value.toString().match(re)) {
|
|
3958
|
+
return { 'isNotUrl': true };
|
|
3959
|
+
}
|
|
3960
|
+
return null;
|
|
3961
|
+
}
|
|
3962
|
+
static isIPv6(control) {
|
|
3963
|
+
if (!control.value)
|
|
3964
|
+
return null;
|
|
3965
|
+
var re = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
|
|
3966
|
+
if (typeof control.value !== 'string' || !control.value.toString().match(re)) {
|
|
3967
|
+
return { 'isNotUrl': true };
|
|
3968
|
+
}
|
|
3969
|
+
return null;
|
|
3970
|
+
}
|
|
3971
|
+
static isIPv6Range(control) {
|
|
3972
|
+
if (!control.value)
|
|
3973
|
+
return null;
|
|
3974
|
+
var re = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/\d{1-3}$/;
|
|
3975
|
+
if (typeof control.value !== 'string' || !control.value.toString().match(re)) {
|
|
3976
|
+
return { 'isNotUrl': true };
|
|
3977
|
+
}
|
|
3978
|
+
return null;
|
|
3979
|
+
}
|
|
3980
|
+
static isMacAddr(control) {
|
|
3981
|
+
if (!control.value)
|
|
3982
|
+
return null;
|
|
3983
|
+
var re = /^(?:[[:xdigit:]]{2}([-:]))(?:[[:xdigit:]]{2}\1){4}[[:xdigit:]]{2}$/;
|
|
3984
|
+
if (typeof control.value !== 'string' || !control.value.toString().match(re)) {
|
|
3985
|
+
return { 'isNotUrl': true };
|
|
3986
|
+
}
|
|
3987
|
+
return null;
|
|
3988
|
+
}
|
|
3989
|
+
static isInternationalPhoneNr(control) {
|
|
3990
|
+
if (!control.value)
|
|
3991
|
+
return null;
|
|
3992
|
+
var re = /^\+(9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\d{1,14}$/;
|
|
3993
|
+
if (typeof control.value !== 'string' || !control.value.toString().match(re)) {
|
|
3994
|
+
return { 'isNotUrl': true };
|
|
3995
|
+
}
|
|
3996
|
+
return null;
|
|
3997
|
+
}
|
|
3998
|
+
static isJson(control) {
|
|
3999
|
+
if (!control.value)
|
|
4000
|
+
return null;
|
|
4001
|
+
if (typeof control.value === 'object') {
|
|
4002
|
+
return null;
|
|
4003
|
+
}
|
|
4004
|
+
if (typeof control.value !== 'string') {
|
|
4005
|
+
return { 'isNotJson': true };
|
|
4006
|
+
}
|
|
4007
|
+
try {
|
|
4008
|
+
const j = JSON.parse(control.value);
|
|
4009
|
+
}
|
|
4010
|
+
catch (ex) {
|
|
4011
|
+
return { 'invalidJson': true };
|
|
4012
|
+
}
|
|
4013
|
+
return null;
|
|
4014
|
+
}
|
|
4015
|
+
}
|
|
4016
|
+
|
|
4017
|
+
/*
|
|
4018
|
+
* Public API Surface of gloww
|
|
4019
|
+
*/
|
|
4020
|
+
|
|
4021
|
+
/**
|
|
4022
|
+
* Generated bundle index. Do not edit.
|
|
4023
|
+
*/
|
|
4024
|
+
|
|
4025
|
+
export { API_SERVER_URL, AdministratorGuard, AuthGuard, AuthenticationService, AuthenticationServiceConfig, AutoCompleteComponent, BaseCollectionComponent, ChangePasswordDlgComponent, CodeEditorComponent, ConfirmationComponent, ConfirmationModel, DatetimeComponent, DialogService, DisplayObjectsComponent, DownloadProgressComponent, DummyComponent, ErrorInterceptor, FilterFormComponent, FolderService, FolderServiceConfig, FoldersComponent, GLOWW_APPLI, GlowwModule, GlowwSecurityModule, GlowwSecurityService, GlowwService, GlowwValidators, HasUnsavedDataGuard, HeaderComponent, HtmlEditorComponent, HtmlFormatPipe, JwtInterceptor, LoginComponent, MenuListItemComponent, NavService, PromptComponent, PromptModel, ResultTableComponent, SafeHtmlPipe, SearchFormComponent, SecureAComponent, SecureImgComponent, SecurePipe, SelectComponent, StagingInterceptor, UploadDocComponent, UploadFileComponent, UserMenuComponent, VersionCheckService, VoiceRecognitionService };
|
|
4026
|
+
//# sourceMappingURL=gloww-gloww.mjs.map
|