@cleavelandprice/ngx-lib 2.2.3 → 2.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +617 -615
- package/active-directory/active-directory.module.d.ts +11 -0
- package/active-directory/index.d.ts +5 -0
- package/active-directory/model/ad-object.d.ts +13 -0
- package/active-directory/model/cache-object.d.ts +4 -0
- package/active-directory/model/caching-config.d.ts +4 -0
- package/active-directory/model/default-caching-config.d.ts +2 -0
- package/active-directory/model/default-config.d.ts +2 -0
- package/active-directory/model/default-logging-config.d.ts +2 -0
- package/active-directory/model/logging-config.d.ts +6 -0
- package/active-directory/model/service-config.d.ts +7 -0
- package/active-directory/model/user-or-group.d.ts +7 -0
- package/active-directory/model/user.d.ts +23 -0
- package/active-directory/public_api.d.ts +8 -0
- package/active-directory/services/active-directory.service.d.ts +18 -0
- package/authentication/authentication.module.d.ts +20 -0
- package/authentication/components/login/login.component.d.ts +13 -0
- package/authentication/components/login-form/login-form.component.d.ts +23 -0
- package/authentication/index.d.ts +5 -0
- package/authentication/model/authenticated-user.d.ts +9 -0
- package/authentication/model/authentication-request.d.ts +6 -0
- package/{src/authentication → authentication}/model/authentication-token.d.ts +0 -0
- package/authentication/model/default-config.d.ts +2 -0
- package/authentication/model/login-form-data.d.ts +3 -0
- package/authentication/model/service-config.d.ts +3 -0
- package/authentication/public_api.d.ts +9 -0
- package/authentication/services/authentication.service.d.ts +25 -0
- package/dialog/components/base/base.component.d.ts +20 -0
- package/dialog/components/confirmation/confirmation.component.d.ts +12 -0
- package/dialog/components/input/input.component.d.ts +12 -0
- package/dialog/components/message/message.component.d.ts +12 -0
- package/dialog/dialog.module.d.ts +17 -0
- package/dialog/index.d.ts +5 -0
- package/{src/dialog/model/confirmation-dialog-mode.enum.d.ts → dialog/model/confirmation-dialog-mode.d.ts} +0 -0
- package/dialog/model/dialog-base-data.d.ts +10 -0
- package/dialog/model/dialog-type.d.ts +5 -0
- package/dialog/public_api.d.ts +8 -0
- package/esm2020/active-directory/active-directory.module.mjs +38 -0
- package/esm2020/active-directory/cleavelandprice-ngx-lib-active-directory.mjs +5 -0
- package/esm2020/active-directory/model/ad-object.mjs +2 -0
- package/esm2020/active-directory/model/cache-object.mjs +3 -0
- package/esm2020/active-directory/model/caching-config.mjs +2 -0
- package/esm2020/active-directory/model/default-caching-config.mjs +5 -0
- package/esm2020/active-directory/model/default-config.mjs +8 -0
- package/esm2020/active-directory/model/default-logging-config.mjs +7 -0
- package/esm2020/active-directory/model/logging-config.mjs +2 -0
- package/esm2020/active-directory/model/service-config.mjs +3 -0
- package/esm2020/active-directory/model/user-or-group.mjs +2 -0
- package/esm2020/active-directory/model/user.mjs +2 -0
- package/esm2020/active-directory/public_api.mjs +9 -0
- package/esm2020/active-directory/services/active-directory.service.mjs +89 -0
- package/esm2020/authentication/authentication.module.mjs +77 -0
- package/esm2020/authentication/cleavelandprice-ngx-lib-authentication.mjs +5 -0
- package/esm2020/authentication/components/login/login.component.mjs +39 -0
- package/esm2020/authentication/components/login-form/login-form.component.mjs +60 -0
- package/esm2020/authentication/model/authenticated-user.mjs +2 -0
- package/esm2020/authentication/model/authentication-request.mjs +2 -0
- package/esm2020/authentication/model/authentication-token.mjs +2 -0
- package/esm2020/authentication/model/default-config.mjs +4 -0
- package/esm2020/authentication/model/login-form-data.mjs +2 -0
- package/esm2020/authentication/model/service-config.mjs +3 -0
- package/esm2020/authentication/public_api.mjs +11 -0
- package/esm2020/authentication/services/authentication.service.mjs +120 -0
- package/esm2020/cleavelandprice-ngx-lib.mjs +2 -2
- package/esm2020/dialog/cleavelandprice-ngx-lib-dialog.mjs +5 -0
- package/esm2020/dialog/components/base/base.component.mjs +84 -0
- package/esm2020/dialog/components/confirmation/confirmation.component.mjs +23 -0
- package/esm2020/dialog/components/input/input.component.mjs +23 -0
- package/esm2020/dialog/components/message/message.component.mjs +23 -0
- package/esm2020/dialog/dialog.module.mjs +63 -0
- package/esm2020/dialog/model/confirmation-dialog-mode.mjs +8 -0
- package/esm2020/dialog/model/dialog-base-data.mjs +2 -0
- package/esm2020/dialog/model/dialog-type.mjs +7 -0
- package/esm2020/dialog/public_api.mjs +9 -0
- package/esm2020/lib/ngx-lib.module.mjs +16 -0
- package/esm2020/public-api.mjs +5 -0
- package/esm2020/sharepoint/cleavelandprice-ngx-lib-sharepoint.mjs +5 -0
- package/esm2020/sharepoint/model/base-item.mjs +2 -0
- package/esm2020/sharepoint/model/base-request-credential.mjs +2 -0
- package/esm2020/sharepoint/model/base-request.mjs +2 -0
- package/esm2020/sharepoint/model/cache-object.mjs +3 -0
- package/esm2020/sharepoint/model/caching-config.mjs +2 -0
- package/esm2020/sharepoint/model/default-config.mjs +25 -0
- package/esm2020/sharepoint/model/file-request.mjs +2 -0
- package/esm2020/sharepoint/model/folder-request.mjs +2 -0
- package/esm2020/sharepoint/model/list-item.mjs +2 -0
- package/esm2020/sharepoint/model/list-items-request.mjs +2 -0
- package/esm2020/sharepoint/model/logging-config.mjs +2 -0
- package/esm2020/sharepoint/model/photo-item.mjs +2 -0
- package/esm2020/sharepoint/model/service-config.mjs +3 -0
- package/esm2020/sharepoint/model/uri-request.mjs +2 -0
- package/esm2020/sharepoint/model/user-request.mjs +2 -0
- package/esm2020/sharepoint/model/user.mjs +2 -0
- package/esm2020/sharepoint/public_api.mjs +18 -0
- package/esm2020/sharepoint/services/sharepoint.service.mjs +152 -0
- package/esm2020/sharepoint/sharepoint.module.mjs +38 -0
- package/esm2020/upload/cleavelandprice-ngx-lib-upload.mjs +5 -0
- package/esm2020/upload/components/upload/upload.component.mjs +33 -0
- package/esm2020/upload/components/upload-dialog/upload-dialog.component.mjs +92 -0
- package/esm2020/upload/model/database-file-info.mjs +2 -0
- package/esm2020/upload/model/file-upload-request.mjs +2 -0
- package/esm2020/upload/model/filesystem-file-info.mjs +2 -0
- package/esm2020/upload/model/service-config.mjs +3 -0
- package/esm2020/upload/public_api.mjs +9 -0
- package/esm2020/upload/services/upload.service.mjs +93 -0
- package/esm2020/upload/upload.module.mjs +61 -0
- package/esm2020/url-utilities/cleavelandprice-ngx-lib-url-utilities.mjs +5 -0
- package/esm2020/url-utilities/pipes/safe-resource-url.pipe.mjs +20 -0
- package/esm2020/url-utilities/pipes/safe-url.pipe.mjs +20 -0
- package/esm2020/url-utilities/pipes/uri-scheme.pipe.mjs +105 -0
- package/esm2020/url-utilities/public_api.mjs +5 -0
- package/esm2020/url-utilities/url-utilities.module.mjs +34 -0
- package/fesm2015/cleavelandprice-ngx-lib-active-directory.mjs +156 -0
- package/fesm2015/cleavelandprice-ngx-lib-active-directory.mjs.map +1 -0
- package/fesm2015/cleavelandprice-ngx-lib-authentication.mjs +299 -0
- package/fesm2015/cleavelandprice-ngx-lib-authentication.mjs.map +1 -0
- package/fesm2015/cleavelandprice-ngx-lib-dialog.mjs +218 -0
- package/fesm2015/cleavelandprice-ngx-lib-dialog.mjs.map +1 -0
- package/fesm2015/cleavelandprice-ngx-lib-sharepoint.mjs +233 -0
- package/fesm2015/cleavelandprice-ngx-lib-sharepoint.mjs.map +1 -0
- package/fesm2015/cleavelandprice-ngx-lib-upload.mjs +280 -0
- package/fesm2015/cleavelandprice-ngx-lib-upload.mjs.map +1 -0
- package/fesm2015/cleavelandprice-ngx-lib-url-utilities.mjs +176 -0
- package/fesm2015/cleavelandprice-ngx-lib-url-utilities.mjs.map +1 -0
- package/fesm2015/cleavelandprice-ngx-lib.mjs +11 -1404
- package/fesm2015/cleavelandprice-ngx-lib.mjs.map +1 -1
- package/fesm2020/cleavelandprice-ngx-lib-active-directory.mjs +147 -0
- package/fesm2020/cleavelandprice-ngx-lib-active-directory.mjs.map +1 -0
- package/fesm2020/cleavelandprice-ngx-lib-authentication.mjs +290 -0
- package/fesm2020/cleavelandprice-ngx-lib-authentication.mjs.map +1 -0
- package/fesm2020/cleavelandprice-ngx-lib-dialog.mjs +212 -0
- package/fesm2020/cleavelandprice-ngx-lib-dialog.mjs.map +1 -0
- package/fesm2020/cleavelandprice-ngx-lib-sharepoint.mjs +219 -0
- package/fesm2020/cleavelandprice-ngx-lib-sharepoint.mjs.map +1 -0
- package/fesm2020/cleavelandprice-ngx-lib-upload.mjs +273 -0
- package/fesm2020/cleavelandprice-ngx-lib-upload.mjs.map +1 -0
- package/fesm2020/cleavelandprice-ngx-lib-url-utilities.mjs +176 -0
- package/fesm2020/cleavelandprice-ngx-lib-url-utilities.mjs.map +1 -0
- package/fesm2020/cleavelandprice-ngx-lib.mjs +11 -1376
- package/fesm2020/cleavelandprice-ngx-lib.mjs.map +1 -1
- package/index.d.ts +1 -1
- package/lib/ngx-lib.module.d.ts +6 -0
- package/package.json +57 -12
- package/public-api.d.ts +1 -0
- package/sharepoint/index.d.ts +5 -0
- package/sharepoint/model/base-item.d.ts +4 -0
- package/sharepoint/model/base-request-credential.d.ts +4 -0
- package/sharepoint/model/base-request.d.ts +8 -0
- package/sharepoint/model/cache-object.d.ts +4 -0
- package/sharepoint/model/caching-config.d.ts +4 -0
- package/sharepoint/model/default-config.d.ts +2 -0
- package/sharepoint/model/file-request.d.ts +4 -0
- package/sharepoint/model/folder-request.d.ts +4 -0
- package/sharepoint/model/list-item.d.ts +10 -0
- package/sharepoint/model/list-items-request.d.ts +5 -0
- package/sharepoint/model/logging-config.d.ts +6 -0
- package/sharepoint/model/photo-item.d.ts +11 -0
- package/sharepoint/model/service-config.d.ts +16 -0
- package/sharepoint/model/uri-request.d.ts +4 -0
- package/sharepoint/model/user-request.d.ts +4 -0
- package/sharepoint/model/user.d.ts +12 -0
- package/sharepoint/public_api.d.ts +16 -0
- package/sharepoint/services/sharepoint.service.d.ts +25 -0
- package/sharepoint/sharepoint.module.d.ts +11 -0
- package/{src/file-upload → upload}/components/upload/upload.component.d.ts +0 -0
- package/{src/file-upload → upload}/components/upload-dialog/upload-dialog.component.d.ts +3 -3
- package/upload/index.d.ts +5 -0
- package/{src/file-upload → upload}/model/database-file-info.d.ts +0 -0
- package/{src/file-upload → upload}/model/file-upload-request.d.ts +0 -0
- package/{src/file-upload → upload}/model/filesystem-file-info.d.ts +0 -0
- package/{src/file-upload/model/upload.service.config.d.ts → upload/model/service-config.d.ts} +1 -1
- package/upload/public_api.d.ts +8 -0
- package/{src/file-upload → upload}/services/upload.service.d.ts +6 -8
- package/upload/upload.module.d.ts +16 -0
- package/url-utilities/index.d.ts +5 -0
- package/url-utilities/pipes/safe-resource-url.pipe.d.ts +10 -0
- package/{src/url → url-utilities}/pipes/safe-url.pipe.d.ts +0 -0
- package/{src/url → url-utilities}/pipes/uri-scheme.pipe.d.ts +1 -1
- package/url-utilities/public_api.d.ts +4 -0
- package/url-utilities/url-utilities.module.d.ts +10 -0
- package/esm2020/public_api.mjs +0 -8
- package/esm2020/src/authentication/authentication.module.mjs +0 -112
- package/esm2020/src/authentication/components/login/login.component.mjs +0 -40
- package/esm2020/src/authentication/components/login-form/login-form.component.mjs +0 -45
- package/esm2020/src/authentication/model/authentication-token.mjs +0 -2
- package/esm2020/src/authentication/model/authentication.service.config.mjs +0 -3
- package/esm2020/src/authentication/services/authentication.service.mjs +0 -144
- package/esm2020/src/dialog/components/_dialog/dialog.component.mjs +0 -83
- package/esm2020/src/dialog/components/confirmation-dialog/confirmation-dialog.component.mjs +0 -21
- package/esm2020/src/dialog/components/input-dialog/input-dialog.component.mjs +0 -21
- package/esm2020/src/dialog/components/message-dialog/message-dialog.component.mjs +0 -21
- package/esm2020/src/dialog/dialog.module.mjs +0 -74
- package/esm2020/src/dialog/model/confirmation-dialog-mode.enum.mjs +0 -8
- package/esm2020/src/email/email.module.mjs +0 -47
- package/esm2020/src/email/model/email-dto.mjs +0 -2
- package/esm2020/src/email/model/email-sender.mjs +0 -2
- package/esm2020/src/email/model/email.mjs +0 -2
- package/esm2020/src/email/model/email.service.config.mjs +0 -3
- package/esm2020/src/email/services/email.service.mjs +0 -31
- package/esm2020/src/employee/employee.module.mjs +0 -91
- package/esm2020/src/employee/model/employee.mjs +0 -2
- package/esm2020/src/employee/model/employee.service.config.mjs +0 -3
- package/esm2020/src/employee/pipes/departments.pipe.mjs +0 -24
- package/esm2020/src/employee/pipes/employee-by-dn.pipe.mjs +0 -17
- package/esm2020/src/employee/pipes/employee-photo-url.pipe.mjs +0 -27
- package/esm2020/src/employee/pipes/employees-with-property-value.pipe.mjs +0 -17
- package/esm2020/src/employee/pipes/filter-employees.pipe.mjs +0 -22
- package/esm2020/src/employee/pipes/is-member-of.pipe.mjs +0 -17
- package/esm2020/src/employee/pipes/sort-employees.pipe.mjs +0 -44
- package/esm2020/src/employee/services/employee.service.mjs +0 -41
- package/esm2020/src/file-upload/components/upload/upload.component.mjs +0 -34
- package/esm2020/src/file-upload/components/upload-dialog/upload-dialog.component.mjs +0 -102
- package/esm2020/src/file-upload/model/database-file-info.mjs +0 -2
- package/esm2020/src/file-upload/model/file-upload-request.mjs +0 -2
- package/esm2020/src/file-upload/model/filesystem-file-info.mjs +0 -2
- package/esm2020/src/file-upload/model/upload.service.config.mjs +0 -3
- package/esm2020/src/file-upload/services/upload.service.mjs +0 -93
- package/esm2020/src/file-upload/upload.module.mjs +0 -93
- package/esm2020/src/sharepoint/model/sharepoint-calendar-event.mjs +0 -2
- package/esm2020/src/sharepoint/model/sharepoint-customer-visit.mjs +0 -2
- package/esm2020/src/sharepoint/model/sharepoint-employee-picture.mjs +0 -2
- package/esm2020/src/sharepoint/model/sharepoint-list-item.mjs +0 -2
- package/esm2020/src/sharepoint/model/sharepoint-list.mjs +0 -2
- package/esm2020/src/sharepoint/model/sharepoint-person.mjs +0 -2
- package/esm2020/src/sharepoint/model/sharepoint-picture.mjs +0 -2
- package/esm2020/src/sharepoint/model/sharepoint.service.config.mjs +0 -3
- package/esm2020/src/sharepoint/pipes/sharepoint-photo-url.pipe.mjs +0 -16
- package/esm2020/src/sharepoint/pipes/sharepoint-url.pipe.mjs +0 -16
- package/esm2020/src/sharepoint/services/sharepoint.service.mjs +0 -77
- package/esm2020/src/sharepoint/sharepoint.module.mjs +0 -69
- package/esm2020/src/url/pipes/safe-url.pipe.mjs +0 -21
- package/esm2020/src/url/pipes/uri-scheme.pipe.mjs +0 -103
- package/esm2020/src/url/url.module.mjs +0 -38
- package/public_api.d.ts +0 -7
- package/src/authentication/authentication.module.d.ts +0 -31
- package/src/authentication/components/login/login.component.d.ts +0 -15
- package/src/authentication/components/login-form/login-form.component.d.ts +0 -20
- package/src/authentication/model/authentication.service.config.d.ts +0 -3
- package/src/authentication/services/authentication.service.d.ts +0 -68
- package/src/dialog/components/_dialog/dialog.component.d.ts +0 -22
- package/src/dialog/components/confirmation-dialog/confirmation-dialog.component.d.ts +0 -9
- package/src/dialog/components/input-dialog/input-dialog.component.d.ts +0 -9
- package/src/dialog/components/message-dialog/message-dialog.component.d.ts +0 -9
- package/src/dialog/dialog.module.d.ts +0 -20
- package/src/email/email.module.d.ts +0 -14
- package/src/email/model/email-dto.d.ts +0 -13
- package/src/email/model/email-sender.d.ts +0 -6
- package/src/email/model/email.d.ts +0 -9
- package/src/email/model/email.service.config.d.ts +0 -7
- package/src/email/services/email.service.d.ts +0 -13
- package/src/employee/employee.module.d.ts +0 -28
- package/src/employee/model/employee.d.ts +0 -35
- package/src/employee/model/employee.service.config.d.ts +0 -3
- package/src/employee/pipes/departments.pipe.d.ts +0 -8
- package/src/employee/pipes/employee-by-dn.pipe.d.ts +0 -8
- package/src/employee/pipes/employee-photo-url.pipe.d.ts +0 -9
- package/src/employee/pipes/employees-with-property-value.pipe.d.ts +0 -8
- package/src/employee/pipes/filter-employees.pipe.d.ts +0 -8
- package/src/employee/pipes/is-member-of.pipe.d.ts +0 -8
- package/src/employee/pipes/sort-employees.pipe.d.ts +0 -9
- package/src/employee/services/employee.service.d.ts +0 -15
- package/src/file-upload/upload.module.d.ts +0 -26
- package/src/sharepoint/model/sharepoint-calendar-event.d.ts +0 -6
- package/src/sharepoint/model/sharepoint-customer-visit.d.ts +0 -8
- package/src/sharepoint/model/sharepoint-employee-picture.d.ts +0 -5
- package/src/sharepoint/model/sharepoint-list-item.d.ts +0 -11
- package/src/sharepoint/model/sharepoint-list.d.ts +0 -8
- package/src/sharepoint/model/sharepoint-person.d.ts +0 -9
- package/src/sharepoint/model/sharepoint-picture.d.ts +0 -14
- package/src/sharepoint/model/sharepoint.service.config.d.ts +0 -5
- package/src/sharepoint/pipes/sharepoint-photo-url.pipe.d.ts +0 -8
- package/src/sharepoint/pipes/sharepoint-url.pipe.d.ts +0 -7
- package/src/sharepoint/services/sharepoint.service.d.ts +0 -23
- package/src/sharepoint/sharepoint.module.d.ts +0 -24
- package/src/url/url.module.d.ts +0 -11
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { EventEmitter, Injectable, Optional, Output, Component, Inject, Input, NgModule, SkipSelf } from '@angular/core';
|
|
3
|
+
import { ConfirmationComponent } from '@cleavelandprice/ngx-lib/dialog';
|
|
4
|
+
import * as i4 from '@angular/forms';
|
|
5
|
+
import { UntypedFormGroup, UntypedFormControl, Validators, ReactiveFormsModule } from '@angular/forms';
|
|
6
|
+
import * as i1 from '@angular/material/dialog';
|
|
7
|
+
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
8
|
+
import { JwtHelperService } from '@auth0/angular-jwt';
|
|
9
|
+
import * as i2 from '@angular/common/http';
|
|
10
|
+
import * as i3 from '@cleavelandprice/ngx-lib/sharepoint';
|
|
11
|
+
import * as i3$1 from '@angular/common';
|
|
12
|
+
import { CommonModule } from '@angular/common';
|
|
13
|
+
import * as i5 from '@angular/material/button';
|
|
14
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
15
|
+
import * as i6 from '@angular/material/form-field';
|
|
16
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
17
|
+
import * as i7 from '@angular/material/icon';
|
|
18
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
19
|
+
import * as i8 from '@angular/material/input';
|
|
20
|
+
import { MatInputModule } from '@angular/material/input';
|
|
21
|
+
import * as i9 from '@angular/material/progress-spinner';
|
|
22
|
+
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
23
|
+
|
|
24
|
+
class ServiceConfig {
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const defaultConfig = {
|
|
28
|
+
apiUrl: 'http://utilityapi/authenticate/token'
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
//#region Imports
|
|
32
|
+
//#endregion
|
|
33
|
+
class AuthenticationService {
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region Lifecycle
|
|
36
|
+
// If a ServiceConfig object is not provided when the module is imported, then default values are pulled in from default-config.ts.
|
|
37
|
+
constructor(config, http, sharePointService) {
|
|
38
|
+
var _a;
|
|
39
|
+
this.config = config;
|
|
40
|
+
this.http = http;
|
|
41
|
+
this.sharePointService = sharePointService;
|
|
42
|
+
//#region Fields
|
|
43
|
+
this.authenticatedChanged = new EventEmitter();
|
|
44
|
+
this.authenticatingChanged = new EventEmitter();
|
|
45
|
+
this.authenticationError = new EventEmitter();
|
|
46
|
+
// Flag set to true while the service is attempting to authenticate the user
|
|
47
|
+
this.authenticating = false;
|
|
48
|
+
//Flag set to true when the user is successfully authenticated
|
|
49
|
+
this.authenticated = false;
|
|
50
|
+
this.config = (_a = this.config) !== null && _a !== void 0 ? _a : defaultConfig;
|
|
51
|
+
this.checkForExistingToken();
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region Utilities
|
|
55
|
+
//Authenticate the user and store the token in Local Storage
|
|
56
|
+
login(username, password, adminGroup) {
|
|
57
|
+
const today = new Date();
|
|
58
|
+
//const expiration = new Date().setFullYear(today.getFullYear() + 10);
|
|
59
|
+
const request = {
|
|
60
|
+
username: username,
|
|
61
|
+
password: password,
|
|
62
|
+
adminGroup: adminGroup
|
|
63
|
+
//expirationDate: expiration // moment().add(10, 'years').toDate()
|
|
64
|
+
};
|
|
65
|
+
this.authenticating = true;
|
|
66
|
+
this.authenticatingChanged.emit(this.authenticating);
|
|
67
|
+
// Sending a 'raw' POST request so that we can tell HttpClient that we are expecting text instead of Json
|
|
68
|
+
// Otherwise, it would throw an error trying to decode Json from the response
|
|
69
|
+
this.http.request('POST', this.config.apiUrl, { body: request, responseType: 'text' })
|
|
70
|
+
.subscribe(token => this.validateUser(token), err => {
|
|
71
|
+
//console.log('Authentication error', err);
|
|
72
|
+
this.authenticating = false;
|
|
73
|
+
this.authenticatingChanged.emit(this.authenticating);
|
|
74
|
+
this.authenticationError.emit(err);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
//Logout the user and delete the token from Local Storage
|
|
78
|
+
logout() {
|
|
79
|
+
if (localStorage.getItem('token')) {
|
|
80
|
+
localStorage.removeItem('token');
|
|
81
|
+
}
|
|
82
|
+
this.authenticatedUser = null;
|
|
83
|
+
this.authenticated = false;
|
|
84
|
+
this.authenticatedChanged.emit(false);
|
|
85
|
+
}
|
|
86
|
+
validateUser(token) {
|
|
87
|
+
if (!token) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const jwtHelper = new JwtHelperService();
|
|
91
|
+
const decoded = jwtHelper.decodeToken(token);
|
|
92
|
+
if (jwtHelper.isTokenExpired(token)) {
|
|
93
|
+
this.logout();
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
this.authenticatedUser = {
|
|
97
|
+
admin: decoded.role === 'Admin',
|
|
98
|
+
displayName: decoded.displayName,
|
|
99
|
+
accountName: decoded.winaccountname,
|
|
100
|
+
distinguishedName: decoded.distinguishedName,
|
|
101
|
+
employeeNumber: decoded.employeeNumber,
|
|
102
|
+
memberOf: decoded.memberOf
|
|
103
|
+
};
|
|
104
|
+
localStorage.setItem('token', token);
|
|
105
|
+
this.getPhoto();
|
|
106
|
+
this.authenticated = true;
|
|
107
|
+
this.authenticatedChanged.emit(this.authenticated);
|
|
108
|
+
this.authenticating = false;
|
|
109
|
+
this.authenticatingChanged.emit(this.authenticating);
|
|
110
|
+
}
|
|
111
|
+
getPhoto() {
|
|
112
|
+
this.sharePointService.getPhotos()
|
|
113
|
+
.subscribe(photos => {
|
|
114
|
+
var _a;
|
|
115
|
+
// The user may have been logged out by the time the photos came back
|
|
116
|
+
if (!((_a = this.authenticatedUser) === null || _a === void 0 ? void 0 : _a.employeeNumber)) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const photo = photos.find(pic => pic.employeeNumber === +this.authenticatedUser.employeeNumber);
|
|
120
|
+
if (photo) {
|
|
121
|
+
this.authenticatedUser.photoUrl = photo.encodedAbsUrl;
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
checkForExistingToken() {
|
|
126
|
+
this.validateUser(localStorage.getItem('token'));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
AuthenticationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: AuthenticationService, deps: [{ token: ServiceConfig, optional: true }, { token: i2.HttpClient }, { token: i3.SharepointService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
130
|
+
AuthenticationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: AuthenticationService, providedIn: 'root' });
|
|
131
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: AuthenticationService, decorators: [{
|
|
132
|
+
type: Injectable,
|
|
133
|
+
args: [{
|
|
134
|
+
providedIn: 'root'
|
|
135
|
+
}]
|
|
136
|
+
}], ctorParameters: function () {
|
|
137
|
+
return [{ type: ServiceConfig, decorators: [{
|
|
138
|
+
type: Optional
|
|
139
|
+
}] }, { type: i2.HttpClient }, { type: i3.SharepointService }];
|
|
140
|
+
}, propDecorators: { authenticatedChanged: [{
|
|
141
|
+
type: Output
|
|
142
|
+
}], authenticatingChanged: [{
|
|
143
|
+
type: Output
|
|
144
|
+
}], authenticationError: [{
|
|
145
|
+
type: Output
|
|
146
|
+
}] } });
|
|
147
|
+
|
|
148
|
+
class LoginFormComponent {
|
|
149
|
+
constructor(data, dialogRef, authenticationService) {
|
|
150
|
+
var _a;
|
|
151
|
+
this.dialogRef = dialogRef;
|
|
152
|
+
this.authenticationService = authenticationService;
|
|
153
|
+
this.errorMessage = null;
|
|
154
|
+
this.form = new UntypedFormGroup({
|
|
155
|
+
username: new UntypedFormControl(null, [Validators.required]),
|
|
156
|
+
password: new UntypedFormControl(null, [Validators.required]),
|
|
157
|
+
adminGroup: new UntypedFormControl()
|
|
158
|
+
});
|
|
159
|
+
(_a = this.form.get('adminGroup')) === null || _a === void 0 ? void 0 : _a.setValue(data.adminGroup);
|
|
160
|
+
}
|
|
161
|
+
ngOnInit() {
|
|
162
|
+
this.authenticatedChangedSubscription = this.authenticationService.authenticatedChanged
|
|
163
|
+
.subscribe(this.authChangedHandler.bind(this));
|
|
164
|
+
this.authenticationErrorSubscription = this.authenticationService.authenticationError
|
|
165
|
+
.subscribe(this.errorHandler.bind(this));
|
|
166
|
+
}
|
|
167
|
+
ngOnDestroy() {
|
|
168
|
+
this.authenticationErrorSubscription.unsubscribe();
|
|
169
|
+
this.authenticatedChangedSubscription.unsubscribe();
|
|
170
|
+
}
|
|
171
|
+
authenticate() {
|
|
172
|
+
this.errorMessage = null;
|
|
173
|
+
const { username, password, adminGroup } = this.form.value;
|
|
174
|
+
this.authenticationService.login(username, password, adminGroup);
|
|
175
|
+
}
|
|
176
|
+
authChangedHandler(authenticated) {
|
|
177
|
+
if (authenticated) {
|
|
178
|
+
this.dialogRef.close();
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
errorHandler(err) {
|
|
182
|
+
console.log('Authentication error', err);
|
|
183
|
+
this.errorMessage = `${err.name}: ${err.statusText}`;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
LoginFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: LoginFormComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }, { token: AuthenticationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
187
|
+
LoginFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: LoginFormComponent, selector: "authentication-login-form", ngImport: i0, template: "<h2 mat-dialog-title>\n <span *ngIf=\"!authenticationService.authenticating\">Login</span>\n <span *ngIf=\"authenticationService.authenticating\">Authenticating...</span>\n</h2>\n\n<mat-dialog-content>\n <div id=\"spinner\" *ngIf=\"authenticationService.authenticating\">\n <mat-progress-spinner color=\"primary\" mode=\"indeterminate\"></mat-progress-spinner>\n </div>\n\n <form *ngIf=\"!authenticationService.authenticating\" [formGroup]=\"form\">\n <mat-form-field>\n <input matInput formControlName=\"username\" placeholder=\"Username\" (keyup.enter)=\"authenticate()\">\n </mat-form-field>\n\n <mat-form-field>\n <input matInput formControlName=\"password\" type=\"password\" placeholder=\"Password\" (keyup.enter)=\"authenticate()\">\n </mat-form-field>\n </form>\n\n <div *ngIf=\"!authenticationService.authenticating && errorMessage\" id=\"error\">\n {{ errorMessage }}\n </div>\n</mat-dialog-content>\n\n<mat-dialog-actions *ngIf=\"!authenticationService.authenticating\">\n <button mat-raised-button color=\"primary\" (click)=\"authenticate()\"\n [disabled]=\"form.invalid\">\n <mat-icon fontIcon=\"done\"></mat-icon>\n <span>OK</span>\n </button>\n\n <button mat-raised-button (click)=\"dialogRef.close()\">\n <mat-icon fontIcon=\"close\"></mat-icon>\n <span>Cancel</span>\n </button>\n</mat-dialog-actions>", styles: ["#spinner{width:100%;height:100%;display:flex;justify-content:center;align-items:center}form{display:grid;gap:1rem}mat-dialog-actions{display:grid;justify-content:center;grid-template-columns:auto auto;gap:1rem}#error{color:red}\n", ".material-icons{font-family:Material Icons;font-weight:400;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:\"liga\"}\n"], dependencies: [{ kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4.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: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i5.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i8.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i9.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "diameter", "strokeWidth", "mode", "value"], exportAs: ["matProgressSpinner"] }] });
|
|
188
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: LoginFormComponent, decorators: [{
|
|
189
|
+
type: Component,
|
|
190
|
+
args: [{ selector: 'authentication-login-form', template: "<h2 mat-dialog-title>\n <span *ngIf=\"!authenticationService.authenticating\">Login</span>\n <span *ngIf=\"authenticationService.authenticating\">Authenticating...</span>\n</h2>\n\n<mat-dialog-content>\n <div id=\"spinner\" *ngIf=\"authenticationService.authenticating\">\n <mat-progress-spinner color=\"primary\" mode=\"indeterminate\"></mat-progress-spinner>\n </div>\n\n <form *ngIf=\"!authenticationService.authenticating\" [formGroup]=\"form\">\n <mat-form-field>\n <input matInput formControlName=\"username\" placeholder=\"Username\" (keyup.enter)=\"authenticate()\">\n </mat-form-field>\n\n <mat-form-field>\n <input matInput formControlName=\"password\" type=\"password\" placeholder=\"Password\" (keyup.enter)=\"authenticate()\">\n </mat-form-field>\n </form>\n\n <div *ngIf=\"!authenticationService.authenticating && errorMessage\" id=\"error\">\n {{ errorMessage }}\n </div>\n</mat-dialog-content>\n\n<mat-dialog-actions *ngIf=\"!authenticationService.authenticating\">\n <button mat-raised-button color=\"primary\" (click)=\"authenticate()\"\n [disabled]=\"form.invalid\">\n <mat-icon fontIcon=\"done\"></mat-icon>\n <span>OK</span>\n </button>\n\n <button mat-raised-button (click)=\"dialogRef.close()\">\n <mat-icon fontIcon=\"close\"></mat-icon>\n <span>Cancel</span>\n </button>\n</mat-dialog-actions>", styles: ["#spinner{width:100%;height:100%;display:flex;justify-content:center;align-items:center}form{display:grid;gap:1rem}mat-dialog-actions{display:grid;justify-content:center;grid-template-columns:auto auto;gap:1rem}#error{color:red}\n", ".material-icons{font-family:Material Icons;font-weight:400;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:\"liga\"}\n"] }]
|
|
191
|
+
}], ctorParameters: function () {
|
|
192
|
+
return [{ type: undefined, decorators: [{
|
|
193
|
+
type: Inject,
|
|
194
|
+
args: [MAT_DIALOG_DATA]
|
|
195
|
+
}] }, { type: i1.MatDialogRef }, { type: AuthenticationService }];
|
|
196
|
+
} });
|
|
197
|
+
|
|
198
|
+
class LoginComponent {
|
|
199
|
+
constructor(dialog, authenticationService) {
|
|
200
|
+
this.dialog = dialog;
|
|
201
|
+
this.authenticationService = authenticationService;
|
|
202
|
+
}
|
|
203
|
+
login() {
|
|
204
|
+
this.dialog.open(LoginFormComponent, {
|
|
205
|
+
data: { adminGroup: this.adminGroup }
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
confirmLogout() {
|
|
209
|
+
this.dialog.open(ConfirmationComponent, {
|
|
210
|
+
data: { message: `Are you sure you want to logout?` }
|
|
211
|
+
})
|
|
212
|
+
.afterClosed()
|
|
213
|
+
.subscribe(result => {
|
|
214
|
+
if (result) {
|
|
215
|
+
this.authenticationService.logout();
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
LoginComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: LoginComponent, deps: [{ token: i1.MatDialog }, { token: AuthenticationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
221
|
+
LoginComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: LoginComponent, selector: "authentication-login", inputs: { adminGroup: "adminGroup" }, ngImport: i0, template: "<div id=\"user-id\">\n <!-- Logged out -->\n <mat-icon *ngIf=\"!authenticationService.authenticated\"\n fontIcon=\"account_circle\"\n matTooltip=\"Login\"\n (click)=\"login()\">\n </mat-icon>\n\n <!-- Logged in -->\n <ng-container *ngIf=\"authenticationService.authenticated\">\n <!-- With photo -->\n <img *ngIf=\"authenticationService.authenticatedUser?.photoUrl\"\n id=\"authenticated-user-image\"\n [src]=\"authenticationService.authenticatedUser?.photoUrl\"\n matTooltip=\"Logout\"\n (click)=\"confirmLogout()\" />\n \n <!-- Without photo -->\n <mat-icon *ngIf=\"!authenticationService.authenticatedUser?.photoUrl\"\n fontIcon=\"account_circle\"\n matTooltip=\"Logout\"\n (click)=\"confirmLogout()\">\n </mat-icon>\n \n <!-- Name -->\n <div id=\"user-name\">\n {{ authenticationService.authenticatedUser?.displayName }}\n </div>\n </ng-container>\n</div>", styles: ["#user-id{display:flex;height:2em;padding:.3em;font-family:Verdana,Geneva,Tahoma,sans-serif}mat-icon{font-size:2em!important;height:2em!important;width:2em!important}img{border-radius:100%;width:2em;height:2em}#user-id>div{display:flex;align-items:center;height:100%;margin-left:.75em;font-size:1.15em}\n", ".material-icons{font-family:Material Icons;font-weight:400;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:\"liga\"}\n"], dependencies: [{ kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
|
|
222
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: LoginComponent, decorators: [{
|
|
223
|
+
type: Component,
|
|
224
|
+
args: [{ selector: 'authentication-login', template: "<div id=\"user-id\">\n <!-- Logged out -->\n <mat-icon *ngIf=\"!authenticationService.authenticated\"\n fontIcon=\"account_circle\"\n matTooltip=\"Login\"\n (click)=\"login()\">\n </mat-icon>\n\n <!-- Logged in -->\n <ng-container *ngIf=\"authenticationService.authenticated\">\n <!-- With photo -->\n <img *ngIf=\"authenticationService.authenticatedUser?.photoUrl\"\n id=\"authenticated-user-image\"\n [src]=\"authenticationService.authenticatedUser?.photoUrl\"\n matTooltip=\"Logout\"\n (click)=\"confirmLogout()\" />\n \n <!-- Without photo -->\n <mat-icon *ngIf=\"!authenticationService.authenticatedUser?.photoUrl\"\n fontIcon=\"account_circle\"\n matTooltip=\"Logout\"\n (click)=\"confirmLogout()\">\n </mat-icon>\n \n <!-- Name -->\n <div id=\"user-name\">\n {{ authenticationService.authenticatedUser?.displayName }}\n </div>\n </ng-container>\n</div>", styles: ["#user-id{display:flex;height:2em;padding:.3em;font-family:Verdana,Geneva,Tahoma,sans-serif}mat-icon{font-size:2em!important;height:2em!important;width:2em!important}img{border-radius:100%;width:2em;height:2em}#user-id>div{display:flex;align-items:center;height:100%;margin-left:.75em;font-size:1.15em}\n", ".material-icons{font-family:Material Icons;font-weight:400;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:\"liga\"}\n"] }]
|
|
225
|
+
}], ctorParameters: function () { return [{ type: i1.MatDialog }, { type: AuthenticationService }]; }, propDecorators: { adminGroup: [{
|
|
226
|
+
type: Input
|
|
227
|
+
}] } });
|
|
228
|
+
|
|
229
|
+
class AuthenticationModule {
|
|
230
|
+
constructor(parentModule) {
|
|
231
|
+
if (parentModule) {
|
|
232
|
+
throw new Error('AuthenticationModule is already loaded. Import it in the AppModule only');
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
static forRoot(config) {
|
|
236
|
+
return {
|
|
237
|
+
ngModule: AuthenticationModule,
|
|
238
|
+
providers: [
|
|
239
|
+
AuthenticationService,
|
|
240
|
+
{ provide: ServiceConfig, useValue: config }
|
|
241
|
+
]
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
AuthenticationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: AuthenticationModule, deps: [{ token: AuthenticationModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
246
|
+
AuthenticationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0", ngImport: i0, type: AuthenticationModule, declarations: [LoginComponent,
|
|
247
|
+
LoginFormComponent], imports: [CommonModule,
|
|
248
|
+
ReactiveFormsModule,
|
|
249
|
+
MatButtonModule,
|
|
250
|
+
MatDialogModule,
|
|
251
|
+
MatFormFieldModule,
|
|
252
|
+
MatIconModule,
|
|
253
|
+
MatInputModule,
|
|
254
|
+
MatProgressSpinnerModule], exports: [LoginComponent,
|
|
255
|
+
LoginFormComponent] });
|
|
256
|
+
AuthenticationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: AuthenticationModule, imports: [CommonModule,
|
|
257
|
+
ReactiveFormsModule,
|
|
258
|
+
MatButtonModule,
|
|
259
|
+
MatDialogModule,
|
|
260
|
+
MatFormFieldModule,
|
|
261
|
+
MatIconModule,
|
|
262
|
+
MatInputModule,
|
|
263
|
+
MatProgressSpinnerModule] });
|
|
264
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: AuthenticationModule, decorators: [{
|
|
265
|
+
type: NgModule,
|
|
266
|
+
args: [{
|
|
267
|
+
declarations: [
|
|
268
|
+
LoginComponent,
|
|
269
|
+
LoginFormComponent
|
|
270
|
+
],
|
|
271
|
+
imports: [
|
|
272
|
+
CommonModule,
|
|
273
|
+
ReactiveFormsModule,
|
|
274
|
+
MatButtonModule,
|
|
275
|
+
MatDialogModule,
|
|
276
|
+
MatFormFieldModule,
|
|
277
|
+
MatIconModule,
|
|
278
|
+
MatInputModule,
|
|
279
|
+
MatProgressSpinnerModule
|
|
280
|
+
],
|
|
281
|
+
exports: [
|
|
282
|
+
LoginComponent,
|
|
283
|
+
LoginFormComponent
|
|
284
|
+
]
|
|
285
|
+
}]
|
|
286
|
+
}], ctorParameters: function () {
|
|
287
|
+
return [{ type: AuthenticationModule, decorators: [{
|
|
288
|
+
type: Optional
|
|
289
|
+
}, {
|
|
290
|
+
type: SkipSelf
|
|
291
|
+
}] }];
|
|
292
|
+
} });
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Generated bundle index. Do not edit.
|
|
296
|
+
*/
|
|
297
|
+
|
|
298
|
+
export { AuthenticationModule, AuthenticationService, LoginComponent, LoginFormComponent, ServiceConfig };
|
|
299
|
+
//# sourceMappingURL=cleavelandprice-ngx-lib-authentication.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleavelandprice-ngx-lib-authentication.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/authentication/src/model/service-config.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/model/default-config.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/services/authentication.service.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/components/login-form/login-form.component.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/components/login-form/login-form.component.html","../../../../projects/cleavelandprice/ngx-lib/authentication/src/components/login/login.component.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/components/login/login.component.html","../../../../projects/cleavelandprice/ngx-lib/authentication/src/authentication.module.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/cleavelandprice-ngx-lib-authentication.ts"],"sourcesContent":["export class ServiceConfig {\r\n apiUrl!: string;\r\n}\r\n","import { ServiceConfig } from \"./service-config\";\r\n\r\nexport const defaultConfig: ServiceConfig = {\r\n apiUrl: 'http://utilityapi/authenticate/token'\r\n}","//#region Imports\nimport { Injectable, Output, EventEmitter, Optional } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { JwtHelperService } from '@auth0/angular-jwt';\n\nimport { defaultConfig } from '../model/default-config';\n\nimport { AuthenticationToken } from '../model/authentication-token';\nimport { ServiceConfig } from '../model/service-config';\nimport { SharepointService } from '@cleavelandprice/ngx-lib/sharepoint';\nimport { AuthenticatedUser } from '../model/authenticated-user';\nimport { AuthenticationRequest } from '../model/authentication-request';\n//#endregion\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AuthenticationService {\n //#region Fields\n @Output() authenticatedChanged = new EventEmitter<boolean>();\n @Output() authenticatingChanged = new EventEmitter<boolean>();\n @Output() authenticationError = new EventEmitter();\n \n // Flag set to true while the service is attempting to authenticate the user\n authenticating = false;\n \n //Flag set to true when the user is successfully authenticated\n authenticated = false;\n \n // Object representing the authenticated user\n authenticatedUser!: AuthenticatedUser | null;\n //#endregion\n \n //#region Lifecycle\n // If a ServiceConfig object is not provided when the module is imported, then default values are pulled in from default-config.ts.\n constructor(@Optional() private config: ServiceConfig,\n private http: HttpClient,\n private sharePointService: SharepointService) {\n\n this.config = this.config ?? defaultConfig;\n \n this.checkForExistingToken();\n }\n //#endregion\n\n //#region Utilities\n //Authenticate the user and store the token in Local Storage\n login(username: string, password: string, adminGroup?: string): void {\n const today = new Date();\n //const expiration = new Date().setFullYear(today.getFullYear() + 10);\n\n const request: AuthenticationRequest = {\n username: username,\n password: password,\n adminGroup: adminGroup\n //expirationDate: expiration // moment().add(10, 'years').toDate()\n };\n\n this.authenticating = true;\n this.authenticatingChanged.emit(this.authenticating);\n\n // Sending a 'raw' POST request so that we can tell HttpClient that we are expecting text instead of Json\n // Otherwise, it would throw an error trying to decode Json from the response\n this.http.request('POST', this.config.apiUrl, { body: request, responseType: 'text' })\n .subscribe(token => this.validateUser(token),\n err => {\n //console.log('Authentication error', err);\n this.authenticating = false;\n this.authenticatingChanged.emit(this.authenticating);\n this.authenticationError.emit(err);\n });\n }\n \n //Logout the user and delete the token from Local Storage\n logout(): void {\n if (localStorage.getItem('token')) {\n localStorage.removeItem('token');\n }\n\n this.authenticatedUser = null;\n this.authenticated = false;\n this.authenticatedChanged.emit(false);\n }\n \n private validateUser(token: string | null): void {\n if (!token) { return; }\n\n const jwtHelper = new JwtHelperService();\n const decoded = jwtHelper.decodeToken(token) as AuthenticationToken;\n\n if (jwtHelper.isTokenExpired(token)) {\n this.logout();\n return;\n }\n\n this.authenticatedUser = {\n admin: decoded.role === 'Admin',\n displayName: decoded.displayName,\n accountName: decoded.winaccountname,\n distinguishedName: decoded.distinguishedName,\n employeeNumber: decoded.employeeNumber,\n memberOf: decoded.memberOf\n };\n\n localStorage.setItem('token', token);\n\n this.getPhoto();\n \n this.authenticated = true;\n this.authenticatedChanged.emit(this.authenticated);\n\n this.authenticating = false;\n this.authenticatingChanged.emit(this.authenticating);\n }\n\n private getPhoto(): void {\n this.sharePointService.getPhotos()\n .subscribe(photos => {\n // The user may have been logged out by the time the photos came back\n if (!this.authenticatedUser?.employeeNumber) {\n return;\n }\n\n const photo = photos.find(pic => pic.employeeNumber === +this.authenticatedUser!.employeeNumber);\n\n if (photo) {\n this.authenticatedUser.photoUrl = photo.encodedAbsUrl;\n }\n });\n }\n\n private checkForExistingToken(): void {\n this.validateUser(localStorage.getItem('token'));\n }\n //#endregion\n}\n ","import { Component, Inject, OnInit, OnDestroy } from '@angular/core';\nimport { UntypedFormGroup, UntypedFormControl, Validators } from '@angular/forms';\nimport { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';\nimport { Subscription } from 'rxjs';\n\nimport { AuthenticationService } from '../../services/authentication.service';\nimport { LoginFormData } from '../../model/login-form-data';\n\n@Component({\n selector: 'authentication-login-form',\n templateUrl: './login-form.component.html',\n styleUrls: [\n './login-form.component.css',\n '../../../../styles/mat-icon.css'\n ]\n})\nexport class LoginFormComponent implements OnInit, OnDestroy {\n errorMessage: string | null = null;\n authenticatedChangedSubscription!: Subscription;\n authenticationErrorSubscription!: Subscription;\n\n form = new UntypedFormGroup({\n username: new UntypedFormControl(null, [ Validators.required ]),\n password: new UntypedFormControl(null, [ Validators.required ]),\n adminGroup: new UntypedFormControl()\n });\n\n constructor(@Inject(MAT_DIALOG_DATA) data: LoginFormData,\n public dialogRef: MatDialogRef<LoginFormComponent>,\n public authenticationService: AuthenticationService) {\n\n this.form.get('adminGroup')?.setValue(data.adminGroup);\n }\n\n ngOnInit(): void {\n this.authenticatedChangedSubscription = this.authenticationService.authenticatedChanged\n .subscribe(this.authChangedHandler.bind(this));\n\n this.authenticationErrorSubscription = this.authenticationService.authenticationError\n .subscribe(this.errorHandler.bind(this));\n }\n\n ngOnDestroy(): void {\n this.authenticationErrorSubscription.unsubscribe();\n this.authenticatedChangedSubscription.unsubscribe();\n }\n\n authenticate() {\n this.errorMessage = null;\n const { username, password, adminGroup } = this.form.value;\n this.authenticationService.login(username, password, adminGroup);\n }\n\n private authChangedHandler(authenticated: boolean): void {\n if (authenticated) {\n this.dialogRef.close();\n }\n }\n\n private errorHandler(err: any): void {\n console.log('Authentication error', err);\n this.errorMessage = `${err.name}: ${err.statusText}`;\n }\n}\n","<h2 mat-dialog-title>\n <span *ngIf=\"!authenticationService.authenticating\">Login</span>\n <span *ngIf=\"authenticationService.authenticating\">Authenticating...</span>\n</h2>\n\n<mat-dialog-content>\n <div id=\"spinner\" *ngIf=\"authenticationService.authenticating\">\n <mat-progress-spinner color=\"primary\" mode=\"indeterminate\"></mat-progress-spinner>\n </div>\n\n <form *ngIf=\"!authenticationService.authenticating\" [formGroup]=\"form\">\n <mat-form-field>\n <input matInput formControlName=\"username\" placeholder=\"Username\" (keyup.enter)=\"authenticate()\">\n </mat-form-field>\n\n <mat-form-field>\n <input matInput formControlName=\"password\" type=\"password\" placeholder=\"Password\" (keyup.enter)=\"authenticate()\">\n </mat-form-field>\n </form>\n\n <div *ngIf=\"!authenticationService.authenticating && errorMessage\" id=\"error\">\n {{ errorMessage }}\n </div>\n</mat-dialog-content>\n\n<mat-dialog-actions *ngIf=\"!authenticationService.authenticating\">\n <button mat-raised-button color=\"primary\" (click)=\"authenticate()\"\n [disabled]=\"form.invalid\">\n <mat-icon fontIcon=\"done\"></mat-icon>\n <span>OK</span>\n </button>\n\n <button mat-raised-button (click)=\"dialogRef.close()\">\n <mat-icon fontIcon=\"close\"></mat-icon>\n <span>Cancel</span>\n </button>\n</mat-dialog-actions>","import { Component, Input } from '@angular/core';\nimport { MatDialog } from '@angular/material/dialog';\nimport { ConfirmationComponent } from '@cleavelandprice/ngx-lib/dialog';\nimport { LoginFormComponent } from '../login-form/login-form.component';\nimport { AuthenticationService } from '../../services/authentication.service';\n\n@Component({\n selector: 'authentication-login',\n templateUrl: './login.component.html',\n styleUrls: [\n './login.component.css',\n '../../../../styles/mat-icon.css'\n ]\n})\nexport class LoginComponent {\n @Input() adminGroup!: string;\n\n constructor(private dialog: MatDialog,\n public authenticationService: AuthenticationService) {\n }\n\n login(): void {\n this.dialog.open(LoginFormComponent, {\n data: { adminGroup: this.adminGroup }\n });\n }\n\n confirmLogout(): void {\n this.dialog.open(ConfirmationComponent, {\n data: { message: `Are you sure you want to logout?` }\n })\n .afterClosed()\n .subscribe(result => {\n if (result) {\n this.authenticationService.logout();\n }\n });\n }\n}\n","<div id=\"user-id\">\n <!-- Logged out -->\n <mat-icon *ngIf=\"!authenticationService.authenticated\"\n fontIcon=\"account_circle\"\n matTooltip=\"Login\"\n (click)=\"login()\">\n </mat-icon>\n\n <!-- Logged in -->\n <ng-container *ngIf=\"authenticationService.authenticated\">\n <!-- With photo -->\n <img *ngIf=\"authenticationService.authenticatedUser?.photoUrl\"\n id=\"authenticated-user-image\"\n [src]=\"authenticationService.authenticatedUser?.photoUrl\"\n matTooltip=\"Logout\"\n (click)=\"confirmLogout()\" />\n \n <!-- Without photo -->\n <mat-icon *ngIf=\"!authenticationService.authenticatedUser?.photoUrl\"\n fontIcon=\"account_circle\"\n matTooltip=\"Logout\"\n (click)=\"confirmLogout()\">\n </mat-icon>\n \n <!-- Name -->\n <div id=\"user-name\">\n {{ authenticationService.authenticatedUser?.displayName }}\n </div>\n </ng-container>\n</div>","import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ReactiveFormsModule } from '@angular/forms';\n\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatDialogModule } from '@angular/material/dialog';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\n\nimport { LoginComponent } from './components/login/login.component';\nimport { LoginFormComponent } from './components/login-form/login-form.component';\nimport { ServiceConfig } from './model/service-config';\nimport { AuthenticationService } from './services/authentication.service';\n\n@NgModule({\n declarations: [\n LoginComponent,\n LoginFormComponent\n ],\n imports: [\n CommonModule,\n ReactiveFormsModule,\n \n MatButtonModule,\n MatDialogModule,\n MatFormFieldModule,\n MatIconModule,\n MatInputModule,\n MatProgressSpinnerModule\n ],\n exports: [\n LoginComponent,\n LoginFormComponent\n ]\n})\nexport class AuthenticationModule {\n static forRoot(config: ServiceConfig): ModuleWithProviders<AuthenticationModule> {\n return {\n ngModule: AuthenticationModule,\n providers: [\n AuthenticationService,\n { provide: ServiceConfig, useValue: config }\n ]\n };\n }\n\n constructor( @Optional() @SkipSelf() parentModule: AuthenticationModule) {\n if (parentModule) {\n throw new Error(\n 'AuthenticationModule is already loaded. Import it in the AppModule only');\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1.ServiceConfig","i2.AuthenticationService","i3","i4"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;MAAa,aAAa,CAAA;AAEzB;;ACAM,MAAM,aAAa,GAAkB;AACxC,I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,YAAY;QACZ,mBAAmB;QAEnB,eAAe;QACf,eAAe;QACf,kBAAkB;QAClB,aAAa;QACb,cAAc;QACd,wBAAwB,CAAA,EAAA,CAAA,CAAA;2FAOf,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBArBhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE;wBACZ,cAAc;wBACd,kBAAkB;AACnB,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,mBAAmB;wBAEnB,eAAe;wBACf,eAAe;wBACf,kBAAkB;wBAClB,aAAa;wBACb,cAAc;wBACd,wBAAwB;AACzB,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,cAAc;wBACd,kBAAkB;AACnB,qBAAA;iBACF,CAAA;;wBAYoD,oBAAoB,EAAA,UAAA,EAAA,CAAA;8BAAzD,QAAQ;;8BAAI,QAAQ;;;;AChDpC;;AAEG;;;;"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { EventEmitter, Component, Input, Output, Inject, NgModule } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import * as i2 from '@angular/forms';
|
|
6
|
+
import { FormsModule } from '@angular/forms';
|
|
7
|
+
import * as i3 from '@angular/material/button';
|
|
8
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
9
|
+
import * as i4 from '@angular/material/checkbox';
|
|
10
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
11
|
+
import * as i1$1 from '@angular/material/dialog';
|
|
12
|
+
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
13
|
+
import * as i6 from '@angular/material/form-field';
|
|
14
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
15
|
+
import * as i7 from '@angular/material/input';
|
|
16
|
+
import { MatInputModule } from '@angular/material/input';
|
|
17
|
+
|
|
18
|
+
var ConfirmationDialogMode;
|
|
19
|
+
(function (ConfirmationDialogMode) {
|
|
20
|
+
ConfirmationDialogMode[ConfirmationDialogMode["OkCancel"] = 0] = "OkCancel";
|
|
21
|
+
ConfirmationDialogMode[ConfirmationDialogMode["YesNo"] = 1] = "YesNo";
|
|
22
|
+
ConfirmationDialogMode[ConfirmationDialogMode["TrueFalse"] = 2] = "TrueFalse";
|
|
23
|
+
ConfirmationDialogMode[ConfirmationDialogMode["Custom"] = 3] = "Custom";
|
|
24
|
+
})(ConfirmationDialogMode || (ConfirmationDialogMode = {}));
|
|
25
|
+
|
|
26
|
+
var DialogType;
|
|
27
|
+
(function (DialogType) {
|
|
28
|
+
DialogType[DialogType["Confirmation"] = 0] = "Confirmation";
|
|
29
|
+
DialogType[DialogType["Input"] = 1] = "Input";
|
|
30
|
+
DialogType[DialogType["Message"] = 2] = "Message";
|
|
31
|
+
})(DialogType || (DialogType = {}));
|
|
32
|
+
|
|
33
|
+
class BaseComponent {
|
|
34
|
+
constructor() {
|
|
35
|
+
// This is so that DialogType can be publish accessible from the HTML template
|
|
36
|
+
this.DialogType = DialogType;
|
|
37
|
+
this.dialogType = DialogType.Message;
|
|
38
|
+
this.closed = new EventEmitter();
|
|
39
|
+
this.ConfirmationDialogMode = ConfirmationDialogMode;
|
|
40
|
+
}
|
|
41
|
+
get customTrueText() {
|
|
42
|
+
return this.data.customTrueFalseText ?
|
|
43
|
+
this.data.customTrueFalseText[0] :
|
|
44
|
+
null;
|
|
45
|
+
}
|
|
46
|
+
get customFalseText() {
|
|
47
|
+
return this.data.customTrueFalseText ?
|
|
48
|
+
this.data.customTrueFalseText[1] :
|
|
49
|
+
null;
|
|
50
|
+
}
|
|
51
|
+
close() {
|
|
52
|
+
let data;
|
|
53
|
+
switch (this.dialogType) {
|
|
54
|
+
case DialogType.Message:
|
|
55
|
+
data = this.data.checkboxMessage ?
|
|
56
|
+
{
|
|
57
|
+
checkbox: this.checkboxValue || false
|
|
58
|
+
} :
|
|
59
|
+
null;
|
|
60
|
+
break;
|
|
61
|
+
case DialogType.Input:
|
|
62
|
+
data = this.data.checkboxMessage ?
|
|
63
|
+
{
|
|
64
|
+
response: this.userInput,
|
|
65
|
+
checkbox: this.checkboxValue || false
|
|
66
|
+
} :
|
|
67
|
+
this.userInput;
|
|
68
|
+
break;
|
|
69
|
+
case DialogType.Confirmation:
|
|
70
|
+
data = this.data.checkboxMessage ?
|
|
71
|
+
{
|
|
72
|
+
response: true,
|
|
73
|
+
checkbox: this.checkboxValue || false
|
|
74
|
+
} :
|
|
75
|
+
true;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
this.closed.emit(data);
|
|
79
|
+
}
|
|
80
|
+
cancel() {
|
|
81
|
+
let data;
|
|
82
|
+
if (this.dialogType === DialogType.Confirmation) {
|
|
83
|
+
data = this.data.checkboxMessage ?
|
|
84
|
+
{
|
|
85
|
+
response: false,
|
|
86
|
+
checkbox: this.checkboxValue || false
|
|
87
|
+
} :
|
|
88
|
+
false;
|
|
89
|
+
}
|
|
90
|
+
this.closed.emit(data);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
BaseComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: BaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
94
|
+
BaseComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: BaseComponent, selector: "dialog-base", inputs: { dialogType: "dialogType", data: "data" }, outputs: { closed: "closed" }, ngImport: i0, template: "<h2 *ngIf=\"data?.title\" mat-dialog-title [innerHTML]=\"data.title\"></h2>\n\n<mat-dialog-content>\n <div *ngIf=\"data?.message\" [innerHTML]=\"data.message\"></div>\n\n <mat-form-field *ngIf=\"dialogType === DialogType.Input\">\n <textarea matInput [placeholder]=\"data.placeholder ?? ''\" [(ngModel)]=\"userInput\"></textarea>\n </mat-form-field>\n\n <div id=\"checkbox\" *ngIf=\"data?.checkboxMessage\">\n <mat-checkbox [(ngModel)]=\"checkboxValue\">\n <span [innerHTML]=\"data.checkboxMessage\"></span>\n </mat-checkbox>\n </div>\n</mat-dialog-content>\n\n<mat-dialog-actions>\n <button mat-raised-button (click)=\"close()\" [disabled]=\"dialogType === DialogType.Input && !userInput\">\n <span [ngSwitch]=\"data.mode\">\n <span *ngSwitchCase=\"ConfirmationDialogMode.YesNo\">Yes</span>\n <span *ngSwitchCase=\"ConfirmationDialogMode.TrueFalse\">True</span>\n <span *ngSwitchCase=\"ConfirmationDialogMode.Custom\">{{ customTrueText }}</span>\n <span *ngSwitchDefault>OK</span>\n </span>\n </button>\n <button *ngIf=\"dialogType !== DialogType.Message\" mat-raised-button (click)=\"cancel()\">\n <span [ngSwitch]=\"data.mode\">\n <span *ngSwitchCase=\"ConfirmationDialogMode.YesNo\">No</span>\n <span *ngSwitchCase=\"ConfirmationDialogMode.TrueFalse\">False</span>\n <span *ngSwitchCase=\"ConfirmationDialogMode.Custom\">{{ customFalseText }}</span>\n <span *ngSwitchDefault>Cancel</span>\n </span>\n </button>\n</mat-dialog-actions>", styles: ["mat-form-field{margin-top:2em;width:100%}#checkbox{margin:2em 0}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i4.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "directive", type: i1$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i7.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }] });
|
|
95
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: BaseComponent, decorators: [{
|
|
96
|
+
type: Component,
|
|
97
|
+
args: [{ selector: 'dialog-base', template: "<h2 *ngIf=\"data?.title\" mat-dialog-title [innerHTML]=\"data.title\"></h2>\n\n<mat-dialog-content>\n <div *ngIf=\"data?.message\" [innerHTML]=\"data.message\"></div>\n\n <mat-form-field *ngIf=\"dialogType === DialogType.Input\">\n <textarea matInput [placeholder]=\"data.placeholder ?? ''\" [(ngModel)]=\"userInput\"></textarea>\n </mat-form-field>\n\n <div id=\"checkbox\" *ngIf=\"data?.checkboxMessage\">\n <mat-checkbox [(ngModel)]=\"checkboxValue\">\n <span [innerHTML]=\"data.checkboxMessage\"></span>\n </mat-checkbox>\n </div>\n</mat-dialog-content>\n\n<mat-dialog-actions>\n <button mat-raised-button (click)=\"close()\" [disabled]=\"dialogType === DialogType.Input && !userInput\">\n <span [ngSwitch]=\"data.mode\">\n <span *ngSwitchCase=\"ConfirmationDialogMode.YesNo\">Yes</span>\n <span *ngSwitchCase=\"ConfirmationDialogMode.TrueFalse\">True</span>\n <span *ngSwitchCase=\"ConfirmationDialogMode.Custom\">{{ customTrueText }}</span>\n <span *ngSwitchDefault>OK</span>\n </span>\n </button>\n <button *ngIf=\"dialogType !== DialogType.Message\" mat-raised-button (click)=\"cancel()\">\n <span [ngSwitch]=\"data.mode\">\n <span *ngSwitchCase=\"ConfirmationDialogMode.YesNo\">No</span>\n <span *ngSwitchCase=\"ConfirmationDialogMode.TrueFalse\">False</span>\n <span *ngSwitchCase=\"ConfirmationDialogMode.Custom\">{{ customFalseText }}</span>\n <span *ngSwitchDefault>Cancel</span>\n </span>\n </button>\n</mat-dialog-actions>", styles: ["mat-form-field{margin-top:2em;width:100%}#checkbox{margin:2em 0}\n"] }]
|
|
98
|
+
}], propDecorators: { dialogType: [{
|
|
99
|
+
type: Input
|
|
100
|
+
}], data: [{
|
|
101
|
+
type: Input
|
|
102
|
+
}], closed: [{
|
|
103
|
+
type: Output
|
|
104
|
+
}] } });
|
|
105
|
+
|
|
106
|
+
class ConfirmationComponent {
|
|
107
|
+
constructor(data, dialogRef) {
|
|
108
|
+
this.data = data;
|
|
109
|
+
this.dialogRef = dialogRef;
|
|
110
|
+
this.dialogType = DialogType.Confirmation;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
ConfirmationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ConfirmationComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1$1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
114
|
+
ConfirmationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: ConfirmationComponent, selector: "dialog-confirmation", ngImport: i0, template: "<dialog-base\n [data]=\"data\"\n [dialogType]=\"dialogType\"\n (closed)=\"dialogRef.close($event)\">\n</dialog-base>", styles: [""], dependencies: [{ kind: "component", type: BaseComponent, selector: "dialog-base", inputs: ["dialogType", "data"], outputs: ["closed"] }] });
|
|
115
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ConfirmationComponent, decorators: [{
|
|
116
|
+
type: Component,
|
|
117
|
+
args: [{ selector: 'dialog-confirmation', template: "<dialog-base\n [data]=\"data\"\n [dialogType]=\"dialogType\"\n (closed)=\"dialogRef.close($event)\">\n</dialog-base>" }]
|
|
118
|
+
}], ctorParameters: function () {
|
|
119
|
+
return [{ type: undefined, decorators: [{
|
|
120
|
+
type: Inject,
|
|
121
|
+
args: [MAT_DIALOG_DATA]
|
|
122
|
+
}] }, { type: i1$1.MatDialogRef }];
|
|
123
|
+
} });
|
|
124
|
+
|
|
125
|
+
class InputComponent {
|
|
126
|
+
constructor(data, dialogRef) {
|
|
127
|
+
this.data = data;
|
|
128
|
+
this.dialogRef = dialogRef;
|
|
129
|
+
this.dialogType = DialogType.Input;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
InputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: InputComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1$1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
133
|
+
InputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: InputComponent, selector: "dialog-input", ngImport: i0, template: "<dialog-base\n [data]=\"data\"\n [dialogType]=\"dialogType\"\n (closed)=\"dialogRef.close($event)\">\n</dialog-base>", styles: [""], dependencies: [{ kind: "component", type: BaseComponent, selector: "dialog-base", inputs: ["dialogType", "data"], outputs: ["closed"] }] });
|
|
134
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: InputComponent, decorators: [{
|
|
135
|
+
type: Component,
|
|
136
|
+
args: [{ selector: 'dialog-input', template: "<dialog-base\n [data]=\"data\"\n [dialogType]=\"dialogType\"\n (closed)=\"dialogRef.close($event)\">\n</dialog-base>" }]
|
|
137
|
+
}], ctorParameters: function () {
|
|
138
|
+
return [{ type: undefined, decorators: [{
|
|
139
|
+
type: Inject,
|
|
140
|
+
args: [MAT_DIALOG_DATA]
|
|
141
|
+
}] }, { type: i1$1.MatDialogRef }];
|
|
142
|
+
} });
|
|
143
|
+
|
|
144
|
+
class MessageComponent {
|
|
145
|
+
constructor(data, dialogRef) {
|
|
146
|
+
this.data = data;
|
|
147
|
+
this.dialogRef = dialogRef;
|
|
148
|
+
this.dialogType = DialogType.Message;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
MessageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MessageComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1$1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
152
|
+
MessageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: MessageComponent, selector: "dialog-message", ngImport: i0, template: "<dialog-base\n [data]=\"data\"\n [dialogType]=\"dialogType\"\n (closed)=\"dialogRef.close($event)\">\n</dialog-base>", styles: [""], dependencies: [{ kind: "component", type: BaseComponent, selector: "dialog-base", inputs: ["dialogType", "data"], outputs: ["closed"] }] });
|
|
153
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MessageComponent, decorators: [{
|
|
154
|
+
type: Component,
|
|
155
|
+
args: [{ selector: 'dialog-message', template: "<dialog-base\n [data]=\"data\"\n [dialogType]=\"dialogType\"\n (closed)=\"dialogRef.close($event)\">\n</dialog-base>" }]
|
|
156
|
+
}], ctorParameters: function () {
|
|
157
|
+
return [{ type: undefined, decorators: [{
|
|
158
|
+
type: Inject,
|
|
159
|
+
args: [MAT_DIALOG_DATA]
|
|
160
|
+
}] }, { type: i1$1.MatDialogRef }];
|
|
161
|
+
} });
|
|
162
|
+
|
|
163
|
+
class DialogModule {
|
|
164
|
+
}
|
|
165
|
+
DialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: DialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
166
|
+
DialogModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0", ngImport: i0, type: DialogModule, declarations: [BaseComponent,
|
|
167
|
+
ConfirmationComponent,
|
|
168
|
+
InputComponent,
|
|
169
|
+
MessageComponent], imports: [CommonModule,
|
|
170
|
+
FormsModule,
|
|
171
|
+
MatButtonModule,
|
|
172
|
+
MatCheckboxModule,
|
|
173
|
+
MatDialogModule,
|
|
174
|
+
MatFormFieldModule,
|
|
175
|
+
MatInputModule], exports: [BaseComponent,
|
|
176
|
+
ConfirmationComponent,
|
|
177
|
+
InputComponent,
|
|
178
|
+
MessageComponent] });
|
|
179
|
+
DialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: DialogModule, imports: [CommonModule,
|
|
180
|
+
FormsModule,
|
|
181
|
+
MatButtonModule,
|
|
182
|
+
MatCheckboxModule,
|
|
183
|
+
MatDialogModule,
|
|
184
|
+
MatFormFieldModule,
|
|
185
|
+
MatInputModule] });
|
|
186
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: DialogModule, decorators: [{
|
|
187
|
+
type: NgModule,
|
|
188
|
+
args: [{
|
|
189
|
+
declarations: [
|
|
190
|
+
BaseComponent,
|
|
191
|
+
ConfirmationComponent,
|
|
192
|
+
InputComponent,
|
|
193
|
+
MessageComponent
|
|
194
|
+
],
|
|
195
|
+
imports: [
|
|
196
|
+
CommonModule,
|
|
197
|
+
FormsModule,
|
|
198
|
+
MatButtonModule,
|
|
199
|
+
MatCheckboxModule,
|
|
200
|
+
MatDialogModule,
|
|
201
|
+
MatFormFieldModule,
|
|
202
|
+
MatInputModule
|
|
203
|
+
],
|
|
204
|
+
exports: [
|
|
205
|
+
BaseComponent,
|
|
206
|
+
ConfirmationComponent,
|
|
207
|
+
InputComponent,
|
|
208
|
+
MessageComponent
|
|
209
|
+
]
|
|
210
|
+
}]
|
|
211
|
+
}] });
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Generated bundle index. Do not edit.
|
|
215
|
+
*/
|
|
216
|
+
|
|
217
|
+
export { BaseComponent, ConfirmationComponent, ConfirmationDialogMode, DialogModule, DialogType, InputComponent, MessageComponent };
|
|
218
|
+
//# sourceMappingURL=cleavelandprice-ngx-lib-dialog.mjs.map
|