@cleavelandprice/ngx-lib 2.1.2 → 2.2.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/README.md +615 -615
- package/esm2020/cleavelandprice-ngx-lib.mjs +5 -0
- package/{esm2015/public_api.js → esm2020/public_api.mjs} +1 -1
- package/esm2020/src/authentication/authentication.module.mjs +112 -0
- package/esm2020/src/authentication/components/login/login.component.mjs +40 -0
- package/esm2020/src/authentication/components/login-form/login-form.component.mjs +45 -0
- package/esm2020/src/authentication/model/authentication-token.mjs +2 -0
- package/{esm2015/src/authentication/model/authentication.service.config.js → esm2020/src/authentication/model/authentication.service.config.mjs} +1 -1
- package/esm2020/src/authentication/services/authentication.service.mjs +136 -0
- package/esm2020/src/dialog/components/_dialog/dialog.component.mjs +83 -0
- package/esm2020/src/dialog/components/confirmation-dialog/confirmation-dialog.component.mjs +21 -0
- package/esm2020/src/dialog/components/input-dialog/input-dialog.component.mjs +21 -0
- package/esm2020/src/dialog/components/message-dialog/message-dialog.component.mjs +21 -0
- package/esm2020/src/dialog/dialog.module.mjs +74 -0
- package/{esm2015/src/dialog/model/confirmation-dialog-mode.enum.js → esm2020/src/dialog/model/confirmation-dialog-mode.enum.mjs} +1 -1
- package/esm2020/src/email/email.module.mjs +47 -0
- package/esm2020/src/email/model/email-dto.mjs +2 -0
- package/{esm2015/src/email/model/email-sender.js → esm2020/src/email/model/email-sender.mjs} +2 -1
- package/{esm2015/src/email/model/email.js → esm2020/src/email/model/email.mjs} +2 -1
- package/{esm2015/src/email/model/email.service.config.js → esm2020/src/email/model/email.service.config.mjs} +1 -1
- package/esm2020/src/email/services/email.service.mjs +31 -0
- package/esm2020/src/employee/employee.module.mjs +91 -0
- package/esm2020/src/employee/model/employee.mjs +2 -0
- package/{esm2015/src/employee/model/employee.service.config.js → esm2020/src/employee/model/employee.service.config.mjs} +1 -1
- package/esm2020/src/employee/pipes/departments.pipe.mjs +24 -0
- package/esm2020/src/employee/pipes/employee-by-dn.pipe.mjs +17 -0
- package/esm2020/src/employee/pipes/employee-photo-url.pipe.mjs +27 -0
- package/esm2020/src/employee/pipes/employees-with-property-value.pipe.mjs +17 -0
- package/esm2020/src/employee/pipes/filter-employees.pipe.mjs +22 -0
- package/esm2020/src/employee/pipes/is-member-of.pipe.mjs +17 -0
- package/esm2020/src/employee/pipes/sort-employees.pipe.mjs +44 -0
- package/esm2020/src/employee/services/employee.service.mjs +41 -0
- package/esm2020/src/file-upload/components/upload/upload.component.mjs +34 -0
- package/esm2020/src/file-upload/components/upload-dialog/upload-dialog.component.mjs +102 -0
- package/{esm2015/src/file-upload/model/database-file-info.js → esm2020/src/file-upload/model/database-file-info.mjs} +2 -1
- package/{esm2015/src/file-upload/model/file-upload-request.js → esm2020/src/file-upload/model/file-upload-request.mjs} +2 -1
- package/esm2020/src/file-upload/model/filesystem-file-info.mjs +2 -0
- package/esm2020/src/file-upload/model/upload.service.config.mjs +3 -0
- package/esm2020/src/file-upload/services/upload.service.mjs +93 -0
- package/esm2020/src/file-upload/upload.module.mjs +93 -0
- package/{esm2015/src/sharepoint/model/sharepoint-calendar-event.js → esm2020/src/sharepoint/model/sharepoint-calendar-event.mjs} +2 -1
- package/esm2020/src/sharepoint/model/sharepoint-customer-visit.mjs +2 -0
- package/{esm2015/src/sharepoint/model/sharepoint-employee-picture.js → esm2020/src/sharepoint/model/sharepoint-employee-picture.mjs} +2 -1
- package/esm2020/src/sharepoint/model/sharepoint-list-item.mjs +2 -0
- package/esm2020/src/sharepoint/model/sharepoint-list.mjs +2 -0
- package/esm2020/src/sharepoint/model/sharepoint-person.mjs +2 -0
- package/esm2020/src/sharepoint/model/sharepoint-picture.mjs +2 -0
- package/{esm2015/src/sharepoint/model/sharepoint.service.config.js → esm2020/src/sharepoint/model/sharepoint.service.config.mjs} +1 -1
- package/esm2020/src/sharepoint/pipes/sharepoint-photo-url.pipe.mjs +16 -0
- package/esm2020/src/sharepoint/pipes/sharepoint-url.pipe.mjs +16 -0
- package/esm2020/src/sharepoint/services/sharepoint.service.mjs +77 -0
- package/esm2020/src/sharepoint/sharepoint.module.mjs +69 -0
- package/esm2020/src/url/pipes/safe-url.pipe.mjs +21 -0
- package/esm2020/src/url/pipes/uri-scheme.pipe.mjs +103 -0
- package/esm2020/src/url/url.module.mjs +38 -0
- package/fesm2015/cleavelandprice-ngx-lib.mjs +1412 -0
- package/fesm2015/cleavelandprice-ngx-lib.mjs.map +1 -0
- package/fesm2020/cleavelandprice-ngx-lib.mjs +1384 -0
- package/fesm2020/cleavelandprice-ngx-lib.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/package.json +22 -10
- package/src/authentication/authentication.module.d.ts +17 -0
- package/src/authentication/components/login/login.component.d.ts +6 -1
- package/src/authentication/components/login-form/login-form.component.d.ts +3 -0
- package/src/authentication/model/authentication-token.d.ts +1 -8
- package/src/authentication/services/authentication.service.d.ts +12 -2
- package/src/dialog/components/_dialog/dialog.component.d.ts +3 -0
- package/src/dialog/components/confirmation-dialog/confirmation-dialog.component.d.ts +3 -0
- package/src/dialog/components/input-dialog/input-dialog.component.d.ts +3 -0
- package/src/dialog/components/message-dialog/message-dialog.component.d.ts +3 -0
- package/src/dialog/dialog.module.d.ts +14 -0
- package/src/email/email.module.d.ts +5 -0
- package/src/email/services/email.service.d.ts +3 -0
- package/src/employee/employee.module.d.ts +12 -0
- package/src/employee/pipes/departments.pipe.d.ts +3 -0
- package/src/employee/pipes/employee-by-dn.pipe.d.ts +3 -0
- package/src/employee/pipes/employee-photo-url.pipe.d.ts +3 -0
- package/src/employee/pipes/employees-with-property-value.pipe.d.ts +3 -0
- package/src/employee/pipes/filter-employees.pipe.d.ts +3 -0
- package/src/employee/pipes/is-member-of.pipe.d.ts +3 -0
- package/src/employee/pipes/sort-employees.pipe.d.ts +3 -0
- package/src/employee/services/employee.service.d.ts +3 -0
- package/src/file-upload/components/upload/upload.component.d.ts +3 -0
- package/src/file-upload/components/upload-dialog/upload-dialog.component.d.ts +3 -0
- package/src/file-upload/services/upload.service.d.ts +3 -0
- package/src/file-upload/upload.module.d.ts +13 -0
- package/src/sharepoint/model/sharepoint-calendar-event.d.ts +3 -3
- package/src/sharepoint/model/sharepoint-customer-visit.d.ts +5 -5
- package/src/sharepoint/model/sharepoint-employee-picture.d.ts +2 -3
- package/src/sharepoint/model/sharepoint-list-item.d.ts +9 -9
- package/src/sharepoint/model/sharepoint-list.d.ts +8 -0
- package/src/sharepoint/model/sharepoint-person.d.ts +9 -0
- package/src/sharepoint/model/sharepoint-picture.d.ts +11 -8
- package/src/sharepoint/model/sharepoint.service.config.d.ts +2 -5
- package/src/sharepoint/pipes/sharepoint-photo-url.pipe.d.ts +3 -0
- package/src/sharepoint/pipes/sharepoint-url.pipe.d.ts +3 -0
- package/src/sharepoint/services/sharepoint.service.d.ts +11 -6
- package/src/sharepoint/sharepoint.module.d.ts +9 -4
- package/src/url/pipes/safe-url.pipe.d.ts +3 -0
- package/src/url/pipes/uri-scheme.pipe.d.ts +3 -0
- package/src/url/url.module.d.ts +7 -0
- package/bundles/cleavelandprice-ngx-lib.umd.js +0 -1360
- package/bundles/cleavelandprice-ngx-lib.umd.js.map +0 -1
- package/bundles/cleavelandprice-ngx-lib.umd.min.js +0 -2
- package/bundles/cleavelandprice-ngx-lib.umd.min.js.map +0 -1
- package/cleavelandprice-ngx-lib.d.ts +0 -5
- package/cleavelandprice-ngx-lib.metadata.json +0 -1
- package/esm2015/cleavelandprice-ngx-lib.js +0 -6
- package/esm2015/src/authentication/authentication.module.js +0 -84
- package/esm2015/src/authentication/components/login/login.component.js +0 -41
- package/esm2015/src/authentication/components/login-form/login-form.component.js +0 -41
- package/esm2015/src/authentication/model/authentication-token.js +0 -1
- package/esm2015/src/authentication/services/authentication.service.js +0 -129
- package/esm2015/src/dialog/components/_dialog/dialog.component.js +0 -75
- package/esm2015/src/dialog/components/confirmation-dialog/confirmation-dialog.component.js +0 -19
- package/esm2015/src/dialog/components/input-dialog/input-dialog.component.js +0 -19
- package/esm2015/src/dialog/components/message-dialog/message-dialog.component.js +0 -19
- package/esm2015/src/dialog/dialog.module.js +0 -54
- package/esm2015/src/email/email.module.js +0 -41
- package/esm2015/src/email/model/email-dto.js +0 -1
- package/esm2015/src/email/services/email.service.js +0 -30
- package/esm2015/src/employee/employee.module.js +0 -73
- package/esm2015/src/employee/model/employee.js +0 -1
- package/esm2015/src/employee/pipes/departments.pipe.js +0 -20
- package/esm2015/src/employee/pipes/employee-by-dn.pipe.js +0 -13
- package/esm2015/src/employee/pipes/employee-photo-url.pipe.js +0 -23
- package/esm2015/src/employee/pipes/employees-with-property-value.pipe.js +0 -13
- package/esm2015/src/employee/pipes/filter-employees.pipe.js +0 -18
- package/esm2015/src/employee/pipes/is-member-of.pipe.js +0 -13
- package/esm2015/src/employee/pipes/sort-employees.pipe.js +0 -40
- package/esm2015/src/employee/services/employee.service.js +0 -40
- package/esm2015/src/file-upload/components/upload/upload.component.js +0 -34
- package/esm2015/src/file-upload/components/upload-dialog/upload-dialog.component.js +0 -101
- package/esm2015/src/file-upload/model/filesystem-file-info.js +0 -1
- package/esm2015/src/file-upload/model/upload.service.config.js +0 -3
- package/esm2015/src/file-upload/services/upload.service.js +0 -91
- package/esm2015/src/file-upload/upload.module.js +0 -73
- package/esm2015/src/sharepoint/model/sharepoint-customer-visit.js +0 -1
- package/esm2015/src/sharepoint/model/sharepoint-list-item.js +0 -1
- package/esm2015/src/sharepoint/model/sharepoint-list-items-request.js +0 -1
- package/esm2015/src/sharepoint/model/sharepoint-picture.js +0 -1
- package/esm2015/src/sharepoint/model/sharepoint-uri-request.js +0 -1
- package/esm2015/src/sharepoint/model/sharepoint-user-request.js +0 -1
- package/esm2015/src/sharepoint/model/sharepoint-user.js +0 -1
- package/esm2015/src/sharepoint/pipes/sharepoint-photo-url.pipe.js +0 -12
- package/esm2015/src/sharepoint/pipes/sharepoint-url.pipe.js +0 -12
- package/esm2015/src/sharepoint/services/sharepoint.service.js +0 -71
- package/esm2015/src/sharepoint/sharepoint.module.js +0 -65
- package/esm2015/src/url/pipes/safe-url.pipe.js +0 -20
- package/esm2015/src/url/pipes/uri-scheme.pipe.js +0 -99
- package/esm2015/src/url/url.module.js +0 -31
- package/fesm2015/cleavelandprice-ngx-lib.js +0 -1247
- package/fesm2015/cleavelandprice-ngx-lib.js.map +0 -1
- package/src/sharepoint/model/sharepoint-list-items-request.d.ts +0 -10
- package/src/sharepoint/model/sharepoint-uri-request.d.ts +0 -5
- package/src/sharepoint/model/sharepoint-user-request.d.ts +0 -6
- package/src/sharepoint/model/sharepoint-user.d.ts +0 -8
|
@@ -1,1360 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@angular/material/button'), require('@angular/material/checkbox'), require('@angular/material/dialog'), require('@angular/material/input'), require('@angular/material/progress-bar'), require('@angular/material/progress-spinner'), require('@angular/material/select'), require('@angular/material/tooltip'), require('@angular/common/http'), require('@auth0/angular-jwt'), require('rxjs'), require('@angular/platform-browser/animations'), require('@angular/material/list'), require('@angular/platform-browser')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@cleavelandprice/ngx-lib', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@angular/material/button', '@angular/material/checkbox', '@angular/material/dialog', '@angular/material/input', '@angular/material/progress-bar', '@angular/material/progress-spinner', '@angular/material/select', '@angular/material/tooltip', '@angular/common/http', '@auth0/angular-jwt', 'rxjs', '@angular/platform-browser/animations', '@angular/material/list', '@angular/platform-browser'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.cleavelandprice = global.cleavelandprice || {}, global.cleavelandprice['ngx-lib'] = {}), global.ng.core, global.ng.common, global.ng.forms, global.ng.material.button, global.ng.material.checkbox, global.ng.material.dialog, global.ng.material.input, global.ng.material.progressBar, global.ng.material.progressSpinner, global.ng.material.select, global.ng.material.tooltip, global.ng.common.http, global.angularJwt, global.rxjs, global.ng.platformBrowser.animations, global.ng.material.list, global.ng.platformBrowser));
|
|
5
|
-
}(this, (function (exports, core, common, forms, button, checkbox, dialog, input, progressBar, progressSpinner, select, tooltip, http, angularJwt, rxjs, animations, list, platformBrowser) { 'use strict';
|
|
6
|
-
|
|
7
|
-
(function (ConfirmationDialogMode) {
|
|
8
|
-
ConfirmationDialogMode[ConfirmationDialogMode["OkCancel"] = 0] = "OkCancel";
|
|
9
|
-
ConfirmationDialogMode[ConfirmationDialogMode["YesNo"] = 1] = "YesNo";
|
|
10
|
-
ConfirmationDialogMode[ConfirmationDialogMode["TrueFalse"] = 2] = "TrueFalse";
|
|
11
|
-
ConfirmationDialogMode[ConfirmationDialogMode["Custom"] = 3] = "Custom";
|
|
12
|
-
})(exports.ConfirmationDialogMode || (exports.ConfirmationDialogMode = {}));
|
|
13
|
-
|
|
14
|
-
var DialogComponent = /** @class */ (function () {
|
|
15
|
-
function DialogComponent() {
|
|
16
|
-
this.closed = new core.EventEmitter();
|
|
17
|
-
this.ConfirmationDialogMode = exports.ConfirmationDialogMode;
|
|
18
|
-
this.mode = exports.ConfirmationDialogMode.OkCancel;
|
|
19
|
-
this.customTrueFalseText = null;
|
|
20
|
-
}
|
|
21
|
-
DialogComponent.prototype.ngOnInit = function () {
|
|
22
|
-
if (this.data) {
|
|
23
|
-
this.title = this.data.title || null;
|
|
24
|
-
this.message = this.data.message || null;
|
|
25
|
-
this.checkboxMessage = this.data.checkboxMessage || null;
|
|
26
|
-
this.placeholder = this.data.placeholder || null;
|
|
27
|
-
this.userInput = this.data.value || null;
|
|
28
|
-
this.mode = this.data.mode || exports.ConfirmationDialogMode.OkCancel;
|
|
29
|
-
this.customTrueFalseText = this.data.customTrueFalseText;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
DialogComponent.prototype.close = function () {
|
|
33
|
-
var data;
|
|
34
|
-
switch (this.dialogType) {
|
|
35
|
-
case 'message':
|
|
36
|
-
data = this.checkboxMessage ?
|
|
37
|
-
{
|
|
38
|
-
checkbox: this.checkboxValue || false
|
|
39
|
-
} :
|
|
40
|
-
null;
|
|
41
|
-
break;
|
|
42
|
-
case 'input':
|
|
43
|
-
data = this.checkboxMessage ?
|
|
44
|
-
{
|
|
45
|
-
response: this.userInput,
|
|
46
|
-
checkbox: this.checkboxValue || false
|
|
47
|
-
} :
|
|
48
|
-
this.userInput;
|
|
49
|
-
break;
|
|
50
|
-
case 'confirmation':
|
|
51
|
-
data = this.checkboxMessage ?
|
|
52
|
-
{
|
|
53
|
-
response: true,
|
|
54
|
-
checkbox: this.checkboxValue || false
|
|
55
|
-
} :
|
|
56
|
-
true;
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
this.closed.emit(data);
|
|
60
|
-
};
|
|
61
|
-
DialogComponent.prototype.cancel = function () {
|
|
62
|
-
var data;
|
|
63
|
-
if (this.dialogType === 'confirmation') {
|
|
64
|
-
data = this.checkboxMessage ?
|
|
65
|
-
{
|
|
66
|
-
response: false,
|
|
67
|
-
checkbox: this.checkboxValue || false
|
|
68
|
-
} :
|
|
69
|
-
false;
|
|
70
|
-
}
|
|
71
|
-
this.closed.emit(data);
|
|
72
|
-
};
|
|
73
|
-
return DialogComponent;
|
|
74
|
-
}());
|
|
75
|
-
DialogComponent.decorators = [
|
|
76
|
-
{ type: core.Component, args: [{
|
|
77
|
-
selector: 'cp-dialog',
|
|
78
|
-
template: "<h2 *ngIf=\"title\" mat-dialog-title [innerHTML]=\"title\"></h2>\n\n<mat-dialog-content>\n <div *ngIf=\"message\" [innerHTML]=\"message\"></div>\n\n <mat-form-field *ngIf=\"dialogType === 'input'\">\n <textarea matInput [placeholder]=\"placeholder\" [(ngModel)]=\"userInput\"></textarea>\n </mat-form-field>\n\n <div id=\"checkbox\" *ngIf=\"checkboxMessage\">\n <mat-checkbox [(ngModel)]=\"checkboxValue\">\n <span [innerHTML]=\"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 === 'input' && !userInput\">\n <span [ngSwitch]=\"mode\">\n <span *ngSwitchCase=\"ConfirmationDialogMode.YesNo\">Yes</span>\n <span *ngSwitchCase=\"ConfirmationDialogMode.TrueFalse\">True</span>\n <span *ngSwitchCase=\"ConfirmationDialogMode.Custom\">{{ customTrueFalseText[0] }}</span>\n <span *ngSwitchDefault>OK</span>\n </span>\n </button>\n <button *ngIf=\"dialogType !== 'message'\" mat-raised-button (click)=\"cancel()\">\n <span [ngSwitch]=\"mode\">\n <span *ngSwitchCase=\"ConfirmationDialogMode.YesNo\">No</span>\n <span *ngSwitchCase=\"ConfirmationDialogMode.TrueFalse\">False</span>\n <span *ngSwitchCase=\"ConfirmationDialogMode.Custom\">{{ customTrueFalseText[1] }}</span>\n <span *ngSwitchDefault>Cancel</span>\n </span>\n </button>\n</mat-dialog-actions>",
|
|
79
|
-
styles: ["mat-form-field{margin-top:2em;width:100%}#checkbox{margin:2em 0}"]
|
|
80
|
-
},] }
|
|
81
|
-
];
|
|
82
|
-
DialogComponent.propDecorators = {
|
|
83
|
-
dialogType: [{ type: core.Input }],
|
|
84
|
-
data: [{ type: core.Input }],
|
|
85
|
-
closed: [{ type: core.Output }]
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
var ConfirmationDialogComponent = /** @class */ (function () {
|
|
89
|
-
function ConfirmationDialogComponent(dialogRef, data) {
|
|
90
|
-
this.dialogRef = dialogRef;
|
|
91
|
-
this.data = data;
|
|
92
|
-
}
|
|
93
|
-
return ConfirmationDialogComponent;
|
|
94
|
-
}());
|
|
95
|
-
ConfirmationDialogComponent.decorators = [
|
|
96
|
-
{ type: core.Component, args: [{
|
|
97
|
-
selector: 'cp-confirmation-dialog',
|
|
98
|
-
template: "<cp-dialog\n [data]=\"data\"\n [dialogType]=\"'confirmation'\"\n (closed)=\"dialogRef.close($event)\">\n</cp-dialog>"
|
|
99
|
-
},] }
|
|
100
|
-
];
|
|
101
|
-
ConfirmationDialogComponent.ctorParameters = function () { return [
|
|
102
|
-
{ type: dialog.MatDialogRef },
|
|
103
|
-
{ type: undefined, decorators: [{ type: core.Inject, args: [dialog.MAT_DIALOG_DATA,] }] }
|
|
104
|
-
]; };
|
|
105
|
-
|
|
106
|
-
var InputDialogComponent = /** @class */ (function () {
|
|
107
|
-
function InputDialogComponent(dialogRef, data) {
|
|
108
|
-
this.dialogRef = dialogRef;
|
|
109
|
-
this.data = data;
|
|
110
|
-
}
|
|
111
|
-
return InputDialogComponent;
|
|
112
|
-
}());
|
|
113
|
-
InputDialogComponent.decorators = [
|
|
114
|
-
{ type: core.Component, args: [{
|
|
115
|
-
selector: 'cp-input-dialog',
|
|
116
|
-
template: "<cp-dialog\n [data]=\"data\"\n [dialogType]=\"'input'\"\n (closed)=\"dialogRef.close($event)\">\n</cp-dialog>"
|
|
117
|
-
},] }
|
|
118
|
-
];
|
|
119
|
-
InputDialogComponent.ctorParameters = function () { return [
|
|
120
|
-
{ type: dialog.MatDialogRef },
|
|
121
|
-
{ type: undefined, decorators: [{ type: core.Inject, args: [dialog.MAT_DIALOG_DATA,] }] }
|
|
122
|
-
]; };
|
|
123
|
-
|
|
124
|
-
var MessageDialogComponent = /** @class */ (function () {
|
|
125
|
-
function MessageDialogComponent(dialogRef, data) {
|
|
126
|
-
this.dialogRef = dialogRef;
|
|
127
|
-
this.data = data;
|
|
128
|
-
}
|
|
129
|
-
return MessageDialogComponent;
|
|
130
|
-
}());
|
|
131
|
-
MessageDialogComponent.decorators = [
|
|
132
|
-
{ type: core.Component, args: [{
|
|
133
|
-
selector: 'cp-message-dialog',
|
|
134
|
-
template: "<cp-dialog\n [data]=\"data\"\n [dialogType]=\"'message'\"\n (closed)=\"dialogRef.close($event)\">\n</cp-dialog>"
|
|
135
|
-
},] }
|
|
136
|
-
];
|
|
137
|
-
MessageDialogComponent.ctorParameters = function () { return [
|
|
138
|
-
{ type: dialog.MatDialogRef },
|
|
139
|
-
{ type: undefined, decorators: [{ type: core.Inject, args: [dialog.MAT_DIALOG_DATA,] }] }
|
|
140
|
-
]; };
|
|
141
|
-
|
|
142
|
-
//#region Imports
|
|
143
|
-
//#endregion
|
|
144
|
-
var DialogModule = /** @class */ (function () {
|
|
145
|
-
function DialogModule() {
|
|
146
|
-
}
|
|
147
|
-
return DialogModule;
|
|
148
|
-
}());
|
|
149
|
-
DialogModule.decorators = [
|
|
150
|
-
{ type: core.NgModule, args: [{
|
|
151
|
-
imports: [
|
|
152
|
-
common.CommonModule,
|
|
153
|
-
forms.FormsModule,
|
|
154
|
-
button.MatButtonModule,
|
|
155
|
-
checkbox.MatCheckboxModule,
|
|
156
|
-
input.MatInputModule,
|
|
157
|
-
dialog.MatDialogModule
|
|
158
|
-
],
|
|
159
|
-
declarations: [
|
|
160
|
-
DialogComponent,
|
|
161
|
-
ConfirmationDialogComponent,
|
|
162
|
-
InputDialogComponent,
|
|
163
|
-
MessageDialogComponent
|
|
164
|
-
],
|
|
165
|
-
exports: [
|
|
166
|
-
ConfirmationDialogComponent,
|
|
167
|
-
InputDialogComponent,
|
|
168
|
-
MessageDialogComponent
|
|
169
|
-
],
|
|
170
|
-
entryComponents: [
|
|
171
|
-
ConfirmationDialogComponent,
|
|
172
|
-
InputDialogComponent,
|
|
173
|
-
MessageDialogComponent
|
|
174
|
-
]
|
|
175
|
-
},] }
|
|
176
|
-
];
|
|
177
|
-
|
|
178
|
-
var AuthenticationServiceConfig = /** @class */ (function () {
|
|
179
|
-
function AuthenticationServiceConfig() {
|
|
180
|
-
}
|
|
181
|
-
return AuthenticationServiceConfig;
|
|
182
|
-
}());
|
|
183
|
-
|
|
184
|
-
var SharePointServiceConfig = /** @class */ (function () {
|
|
185
|
-
function SharePointServiceConfig() {
|
|
186
|
-
}
|
|
187
|
-
return SharePointServiceConfig;
|
|
188
|
-
}());
|
|
189
|
-
|
|
190
|
-
//#region Imports
|
|
191
|
-
//#endregion
|
|
192
|
-
var SharePointService = /** @class */ (function () {
|
|
193
|
-
//#endregion
|
|
194
|
-
function SharePointService(config, http) {
|
|
195
|
-
this.config = config;
|
|
196
|
-
this.http = http;
|
|
197
|
-
}
|
|
198
|
-
//#region Utilities
|
|
199
|
-
SharePointService.prototype.getListItems = function (request) {
|
|
200
|
-
if (!request.username) {
|
|
201
|
-
request.username = this.config.userName;
|
|
202
|
-
}
|
|
203
|
-
if (!request.password) {
|
|
204
|
-
request.password = this.config.password;
|
|
205
|
-
}
|
|
206
|
-
return this.http.post(this.config.sharePointApiUrl + "/listitems", request);
|
|
207
|
-
};
|
|
208
|
-
/*getListItemsSimple(list: string, view: string, site?: string, limit?: string): Observable<SharePointListItem[]> {
|
|
209
|
-
return this.http.get<SharePointListItem[]>(`${this.config.sharePointApiUrl}/${list}/${view}/${site}/${limit}`);
|
|
210
|
-
}*/
|
|
211
|
-
SharePointService.prototype.getPeople = function (request, storePeople) {
|
|
212
|
-
var _this = this;
|
|
213
|
-
// Do we already have people stored locally?
|
|
214
|
-
if (this.users) {
|
|
215
|
-
return rxjs.of(this.users);
|
|
216
|
-
}
|
|
217
|
-
if (!request.username) {
|
|
218
|
-
request.username = this.config.userName;
|
|
219
|
-
}
|
|
220
|
-
if (!request.password) {
|
|
221
|
-
request.password = this.config.password;
|
|
222
|
-
}
|
|
223
|
-
// Should we store people locally for subsequent calls?
|
|
224
|
-
if (storePeople) {
|
|
225
|
-
this.http.post(this.config.sharePointApiUrl + "/users", request)
|
|
226
|
-
.subscribe(function (users) { return _this.users = users; });
|
|
227
|
-
}
|
|
228
|
-
return this.http.post(this.config.sharePointApiUrl + "/users", request);
|
|
229
|
-
};
|
|
230
|
-
SharePointService.prototype.getPhotos = function (storePhotos) {
|
|
231
|
-
var _this = this;
|
|
232
|
-
// Do we already have photos stored locally?
|
|
233
|
-
if (this.photos) {
|
|
234
|
-
return rxjs.of(this.photos);
|
|
235
|
-
}
|
|
236
|
-
var request = {
|
|
237
|
-
list: this.config.employeePhotoList,
|
|
238
|
-
site: this.config.sharePointServerUrl + "/" + this.config.employeePhotoSite,
|
|
239
|
-
username: this.config.userName,
|
|
240
|
-
password: this.config.password,
|
|
241
|
-
additionalPropertiesToRetrieve: ['EncodedAbsUrl']
|
|
242
|
-
};
|
|
243
|
-
// Should we store photos locally for subsequent calls?
|
|
244
|
-
if (storePhotos) {
|
|
245
|
-
this.http.post(this.config.sharePointApiUrl + "/listitems", request)
|
|
246
|
-
.subscribe(function (photos) { return _this.photos = photos; });
|
|
247
|
-
}
|
|
248
|
-
return this.http.post(this.config.sharePointApiUrl + "/listitems", request);
|
|
249
|
-
};
|
|
250
|
-
return SharePointService;
|
|
251
|
-
}());
|
|
252
|
-
SharePointService.decorators = [
|
|
253
|
-
{ type: core.Injectable }
|
|
254
|
-
];
|
|
255
|
-
SharePointService.ctorParameters = function () { return [
|
|
256
|
-
{ type: SharePointServiceConfig, decorators: [{ type: core.Optional }] },
|
|
257
|
-
{ type: http.HttpClient }
|
|
258
|
-
]; };
|
|
259
|
-
|
|
260
|
-
//#region Imports
|
|
261
|
-
//#endregion
|
|
262
|
-
/**
|
|
263
|
-
* Authenticate Active Directory user
|
|
264
|
-
*/
|
|
265
|
-
var AuthenticationService = /** @class */ (function () {
|
|
266
|
-
//#endregion
|
|
267
|
-
//#region Lifecycle
|
|
268
|
-
/**
|
|
269
|
-
* @ignore
|
|
270
|
-
*/
|
|
271
|
-
function AuthenticationService(config, http, sharePointService) {
|
|
272
|
-
this.http = http;
|
|
273
|
-
this.sharePointService = sharePointService;
|
|
274
|
-
this.authenticatedChanged = new core.EventEmitter();
|
|
275
|
-
this.authenticatingChanged = new core.EventEmitter();
|
|
276
|
-
/**
|
|
277
|
-
* Flag set to true while the service is attempting to authenticate the user
|
|
278
|
-
*/
|
|
279
|
-
this.authenticating = false;
|
|
280
|
-
/**
|
|
281
|
-
* Flag set to true when the user is successfully authenticated
|
|
282
|
-
*/
|
|
283
|
-
this.authenticated = false;
|
|
284
|
-
this.authenticationApiUrl = config.authenticationApiUrl;
|
|
285
|
-
this.checkForExistingToken();
|
|
286
|
-
}
|
|
287
|
-
//#endregion
|
|
288
|
-
//#region Utilities
|
|
289
|
-
/**
|
|
290
|
-
* Authenticate the user and store the token in Local Storage
|
|
291
|
-
*
|
|
292
|
-
* @param username AD sAMAccountName
|
|
293
|
-
* @param password
|
|
294
|
-
* @param adminGroup AD group that determines if authenticated user is considered an administrator of the app
|
|
295
|
-
*/
|
|
296
|
-
AuthenticationService.prototype.login = function (username, password, adminGroup) {
|
|
297
|
-
var _this = this;
|
|
298
|
-
var request = {
|
|
299
|
-
username: username,
|
|
300
|
-
password: password,
|
|
301
|
-
adminGroup: adminGroup
|
|
302
|
-
};
|
|
303
|
-
this.authenticating = true;
|
|
304
|
-
this.authenticatingChanged.emit(this.authenticating);
|
|
305
|
-
this.http.request('POST', this.authenticationApiUrl, { responseType: 'text', body: request })
|
|
306
|
-
// this.http.post<string>(this.authenticationApiUrl, request)
|
|
307
|
-
.subscribe(function (token) { return _this.validateUser(token); }, function (err) {
|
|
308
|
-
_this.authenticating = false;
|
|
309
|
-
_this.authenticatingChanged.emit(_this.authenticating);
|
|
310
|
-
});
|
|
311
|
-
};
|
|
312
|
-
/**
|
|
313
|
-
* Logout the user and delete the token from Local Storage
|
|
314
|
-
*/
|
|
315
|
-
AuthenticationService.prototype.logout = function () {
|
|
316
|
-
if (localStorage.getItem('token')) {
|
|
317
|
-
localStorage.removeItem('token');
|
|
318
|
-
}
|
|
319
|
-
this.authenticatedUser = null;
|
|
320
|
-
this.authenticated = false;
|
|
321
|
-
this.authenticatedChanged.emit(false);
|
|
322
|
-
};
|
|
323
|
-
/**
|
|
324
|
-
* @ignore
|
|
325
|
-
*/
|
|
326
|
-
AuthenticationService.prototype.validateUser = function (token) {
|
|
327
|
-
if (!token) {
|
|
328
|
-
return;
|
|
329
|
-
}
|
|
330
|
-
var jwtHelper = new angularJwt.JwtHelperService();
|
|
331
|
-
var decoded = jwtHelper.decodeToken(token);
|
|
332
|
-
if (jwtHelper.isTokenExpired(token)) {
|
|
333
|
-
this.logout();
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
this.authenticatedUser = decoded;
|
|
337
|
-
this.authenticatedUser.accountName = decoded.winaccountname;
|
|
338
|
-
this.authenticatedUser.admin = decoded.role === 'Admin';
|
|
339
|
-
localStorage.setItem('token', token);
|
|
340
|
-
this.getPhoto();
|
|
341
|
-
this.authenticated = true;
|
|
342
|
-
this.authenticatedChanged.emit(this.authenticated);
|
|
343
|
-
this.authenticating = false;
|
|
344
|
-
this.authenticatingChanged.emit(this.authenticating);
|
|
345
|
-
};
|
|
346
|
-
/**
|
|
347
|
-
* @ignore
|
|
348
|
-
*/
|
|
349
|
-
AuthenticationService.prototype.getPhoto = function () {
|
|
350
|
-
var _this = this;
|
|
351
|
-
this.sharePointService.getPhotos()
|
|
352
|
-
.subscribe(function (photos) {
|
|
353
|
-
// The user may have been logged out by the time the photos came back
|
|
354
|
-
if (!_this.authenticatedUser || !_this.authenticatedUser.employeeNumber) {
|
|
355
|
-
return;
|
|
356
|
-
}
|
|
357
|
-
var photo = photos.find(function (pic) { return +pic.employeeNumber === +_this.authenticatedUser.employeeNumber; });
|
|
358
|
-
if (photo) {
|
|
359
|
-
_this.authenticatedUser.photoUrl = photo.encodedAbsUrl;
|
|
360
|
-
}
|
|
361
|
-
});
|
|
362
|
-
};
|
|
363
|
-
/**
|
|
364
|
-
* @ignore
|
|
365
|
-
*/
|
|
366
|
-
AuthenticationService.prototype.checkForExistingToken = function () {
|
|
367
|
-
if (localStorage.getItem('token')) {
|
|
368
|
-
this.validateUser(localStorage.getItem('token'));
|
|
369
|
-
}
|
|
370
|
-
};
|
|
371
|
-
return AuthenticationService;
|
|
372
|
-
}());
|
|
373
|
-
AuthenticationService.decorators = [
|
|
374
|
-
{ type: core.Injectable }
|
|
375
|
-
];
|
|
376
|
-
AuthenticationService.ctorParameters = function () { return [
|
|
377
|
-
{ type: AuthenticationServiceConfig, decorators: [{ type: core.Optional }] },
|
|
378
|
-
{ type: http.HttpClient },
|
|
379
|
-
{ type: SharePointService }
|
|
380
|
-
]; };
|
|
381
|
-
AuthenticationService.propDecorators = {
|
|
382
|
-
authenticatedChanged: [{ type: core.Output }],
|
|
383
|
-
authenticatingChanged: [{ type: core.Output }]
|
|
384
|
-
};
|
|
385
|
-
|
|
386
|
-
var LoginFormComponent = /** @class */ (function () {
|
|
387
|
-
function LoginFormComponent(dialogRef, sharePointService, authenticationService, data) {
|
|
388
|
-
this.dialogRef = dialogRef;
|
|
389
|
-
this.sharePointService = sharePointService;
|
|
390
|
-
this.authenticationService = authenticationService;
|
|
391
|
-
this.data = data;
|
|
392
|
-
this.adminGroup = data.adminGroup;
|
|
393
|
-
}
|
|
394
|
-
LoginFormComponent.prototype.ngOnInit = function () {
|
|
395
|
-
var _this = this;
|
|
396
|
-
this.authenticationService.authenticatedChanged
|
|
397
|
-
.subscribe(function (authenticated) {
|
|
398
|
-
if (authenticated) {
|
|
399
|
-
_this.dialogRef.close();
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
|
-
};
|
|
403
|
-
LoginFormComponent.prototype.authenticate = function () {
|
|
404
|
-
if (!this.sharePointService || !this.username || !this.password) {
|
|
405
|
-
return;
|
|
406
|
-
}
|
|
407
|
-
this.authenticationService.login(this.username, this.password, this.adminGroup);
|
|
408
|
-
};
|
|
409
|
-
return LoginFormComponent;
|
|
410
|
-
}());
|
|
411
|
-
LoginFormComponent.decorators = [
|
|
412
|
-
{ type: core.Component, args: [{
|
|
413
|
-
selector: 'cp-login-form',
|
|
414
|
-
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 [class.loginError]=\"loginError\">\n <div id=\"spinner\" *ngIf=\"authenticationService.authenticating\">\n <mat-progress-spinner color=\"primary\" mode=\"indeterminate\"></mat-progress-spinner>\n </div>\n\n <div *ngIf=\"!authenticationService.authenticating\">\n <div>\n <mat-form-field>\n <input matInput placeholder=\"Username\" [(ngModel)]=\"username\" name=\"username\" required (keyup.enter)=\"authenticate()\">\n </mat-form-field>\n </div>\n\n <div>\n <mat-form-field>\n <input matInput type=\"password\" placeholder=\"Password\" [(ngModel)]=\"password\" name=\"password\" required (keyup.enter)=\"authenticate()\">\n </mat-form-field>\n </div>\n </div>\n\n <div *ngIf=\"!authenticationService.authenticating && loginError\" class=\"alert alert-danger\">\n Bad username or password\n </div>\n</mat-dialog-content>\n\n<mat-dialog-actions *ngIf=\"!authenticationService.authenticating\">\n <button type=\"button\" mat-raised-button (click)=\"authenticate()\">OK</button>\n <button type=\"button\" mat-button (click)=\"dialogRef.close()\">Cancel</button>\n</mat-dialog-actions>",
|
|
415
|
-
styles: ["#spinner{align-items:center;display:flex;height:100%;justify-content:center;width:100%}mat-dialog-content{height:150px}mat-dialog-content.loginError{height:200px}"]
|
|
416
|
-
},] }
|
|
417
|
-
];
|
|
418
|
-
LoginFormComponent.ctorParameters = function () { return [
|
|
419
|
-
{ type: dialog.MatDialogRef },
|
|
420
|
-
{ type: SharePointService },
|
|
421
|
-
{ type: AuthenticationService },
|
|
422
|
-
{ type: undefined, decorators: [{ type: core.Inject, args: [dialog.MAT_DIALOG_DATA,] }] }
|
|
423
|
-
]; };
|
|
424
|
-
|
|
425
|
-
var LoginComponent = /** @class */ (function () {
|
|
426
|
-
function LoginComponent(dialog, authenticationService) {
|
|
427
|
-
this.dialog = dialog;
|
|
428
|
-
this.authenticationService = authenticationService;
|
|
429
|
-
}
|
|
430
|
-
LoginComponent.prototype.login = function () {
|
|
431
|
-
this.dialog.open(LoginFormComponent, {
|
|
432
|
-
data: { adminGroup: this.adminGroup }
|
|
433
|
-
});
|
|
434
|
-
};
|
|
435
|
-
LoginComponent.prototype.confirmLogout = function () {
|
|
436
|
-
var _this = this;
|
|
437
|
-
var dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
|
438
|
-
data: { message: "Are you sure you want to logout?" }
|
|
439
|
-
});
|
|
440
|
-
dialogRef.afterClosed().subscribe(function (result) {
|
|
441
|
-
if (result) {
|
|
442
|
-
_this.authenticationService.logout();
|
|
443
|
-
}
|
|
444
|
-
});
|
|
445
|
-
};
|
|
446
|
-
return LoginComponent;
|
|
447
|
-
}());
|
|
448
|
-
LoginComponent.decorators = [
|
|
449
|
-
{ type: core.Component, args: [{
|
|
450
|
-
selector: 'cp-login',
|
|
451
|
-
template: "<div id=\"user-id\">\n <i id=\"unauthenticated-user-image\" *ngIf=\"!authenticationService.authenticated\"\n class=\"fa fa-user-circle\"\n [class.fa-spin]=\"authenticationService.authenticating\"\n aria-hidden=\"true\"\n matTooltip=\"Login\"\n (click)=\"login()\"></i>\n\n <img id=\"authenticated-user-image\"\n *ngIf=\"authenticationService.authenticated && authenticationService.authenticatedUser.photoUrl\"\n [src]=\"authenticationService.authenticatedUser.photoUrl\"\n matTooltip=\"Logout\"\n (click)=\"confirmLogout()\" />\n\n <i id=\"authenticated-user-image\"\n *ngIf=\"authenticationService.authenticated && !authenticationService.authenticatedUser.photoUrl\"\n class=\"fa fa-user-circle\"\n matTooltip=\"Logout\"\n (click)=\"confirmLogout()\"></i>\n\n <div id=\"user-name\" *ngIf=\"authenticationService.authenticated\">\n {{ authenticationService.authenticatedUser.displayName }}\n </div>\n</div>",
|
|
452
|
-
styles: ["#user-id{display:flex;font-family:Verdana,Geneva,Tahoma,sans-serif;height:2em;padding:.3em}.fa{font-size:2em}img{border-radius:100%;height:2em;width:2em}#user-id>div{align-items:center;display:flex;font-size:1.15em;height:100%;margin-left:.75em}"]
|
|
453
|
-
},] }
|
|
454
|
-
];
|
|
455
|
-
LoginComponent.ctorParameters = function () { return [
|
|
456
|
-
{ type: dialog.MatDialog },
|
|
457
|
-
{ type: AuthenticationService }
|
|
458
|
-
]; };
|
|
459
|
-
LoginComponent.propDecorators = {
|
|
460
|
-
adminGroup: [{ type: core.Input }]
|
|
461
|
-
};
|
|
462
|
-
|
|
463
|
-
//#region Imports
|
|
464
|
-
//#endregion
|
|
465
|
-
/**
|
|
466
|
-
* Provides a component and a service that allows you to perform Active/Directory authentication
|
|
467
|
-
*/
|
|
468
|
-
var AuthenticationModule = /** @class */ (function () {
|
|
469
|
-
function AuthenticationModule(parentModule) {
|
|
470
|
-
if (parentModule) {
|
|
471
|
-
throw new Error('AuthenticationModule is already loaded. Import it in the AppModule only');
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
AuthenticationModule.forRoot = function (authenticationConfig) {
|
|
475
|
-
return {
|
|
476
|
-
ngModule: AuthenticationModule,
|
|
477
|
-
providers: [
|
|
478
|
-
AuthenticationService,
|
|
479
|
-
{ provide: AuthenticationServiceConfig, useValue: authenticationConfig }
|
|
480
|
-
]
|
|
481
|
-
};
|
|
482
|
-
};
|
|
483
|
-
return AuthenticationModule;
|
|
484
|
-
}());
|
|
485
|
-
AuthenticationModule.decorators = [
|
|
486
|
-
{ type: core.NgModule, args: [{
|
|
487
|
-
imports: [
|
|
488
|
-
common.CommonModule,
|
|
489
|
-
forms.FormsModule,
|
|
490
|
-
button.MatButtonModule,
|
|
491
|
-
checkbox.MatCheckboxModule,
|
|
492
|
-
dialog.MatDialogModule,
|
|
493
|
-
input.MatInputModule,
|
|
494
|
-
progressBar.MatProgressBarModule,
|
|
495
|
-
progressSpinner.MatProgressSpinnerModule,
|
|
496
|
-
tooltip.MatTooltipModule,
|
|
497
|
-
select.MatSelectModule,
|
|
498
|
-
DialogModule
|
|
499
|
-
],
|
|
500
|
-
declarations: [
|
|
501
|
-
LoginComponent,
|
|
502
|
-
LoginFormComponent
|
|
503
|
-
],
|
|
504
|
-
exports: [
|
|
505
|
-
LoginComponent,
|
|
506
|
-
LoginFormComponent
|
|
507
|
-
],
|
|
508
|
-
providers: [],
|
|
509
|
-
entryComponents: [
|
|
510
|
-
LoginFormComponent
|
|
511
|
-
]
|
|
512
|
-
},] }
|
|
513
|
-
];
|
|
514
|
-
AuthenticationModule.ctorParameters = function () { return [
|
|
515
|
-
{ type: AuthenticationModule, decorators: [{ type: core.Optional }, { type: core.SkipSelf }] }
|
|
516
|
-
]; };
|
|
517
|
-
|
|
518
|
-
var EmailServiceConfig = /** @class */ (function () {
|
|
519
|
-
function EmailServiceConfig() {
|
|
520
|
-
}
|
|
521
|
-
return EmailServiceConfig;
|
|
522
|
-
}());
|
|
523
|
-
|
|
524
|
-
//#region Imports
|
|
525
|
-
//#endregion
|
|
526
|
-
var EmailService = /** @class */ (function () {
|
|
527
|
-
function EmailService(config, http) {
|
|
528
|
-
this.http = http;
|
|
529
|
-
this.emailServiceConfig = config;
|
|
530
|
-
}
|
|
531
|
-
EmailService.prototype.send = function (email) {
|
|
532
|
-
var dto = {
|
|
533
|
-
server: this.emailServiceConfig.server,
|
|
534
|
-
smtpPort: this.emailServiceConfig.smtpPort,
|
|
535
|
-
sender: this.emailServiceConfig.sender,
|
|
536
|
-
subject: email.subject,
|
|
537
|
-
content: email.content,
|
|
538
|
-
recipients: email.recipients
|
|
539
|
-
};
|
|
540
|
-
return this.http.post(this.emailServiceConfig.emailApiUrl, dto);
|
|
541
|
-
};
|
|
542
|
-
return EmailService;
|
|
543
|
-
}());
|
|
544
|
-
EmailService.decorators = [
|
|
545
|
-
{ type: core.Injectable }
|
|
546
|
-
];
|
|
547
|
-
EmailService.ctorParameters = function () { return [
|
|
548
|
-
{ type: EmailServiceConfig, decorators: [{ type: core.Optional }] },
|
|
549
|
-
{ type: http.HttpClient }
|
|
550
|
-
]; };
|
|
551
|
-
|
|
552
|
-
//#region Imports
|
|
553
|
-
//#endregion
|
|
554
|
-
var EmailModule = /** @class */ (function () {
|
|
555
|
-
function EmailModule(parentModule) {
|
|
556
|
-
if (parentModule) {
|
|
557
|
-
throw new Error('EmailModule is already loaded. Import it in the AppModule only');
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
EmailModule.forRoot = function (emailConfig) {
|
|
561
|
-
return {
|
|
562
|
-
ngModule: EmailModule,
|
|
563
|
-
providers: [
|
|
564
|
-
EmailService,
|
|
565
|
-
{ provide: EmailServiceConfig, useValue: emailConfig }
|
|
566
|
-
]
|
|
567
|
-
};
|
|
568
|
-
};
|
|
569
|
-
return EmailModule;
|
|
570
|
-
}());
|
|
571
|
-
EmailModule.decorators = [
|
|
572
|
-
{ type: core.NgModule, args: [{
|
|
573
|
-
imports: [common.CommonModule],
|
|
574
|
-
declarations: [],
|
|
575
|
-
exports: []
|
|
576
|
-
},] }
|
|
577
|
-
];
|
|
578
|
-
EmailModule.ctorParameters = function () { return [
|
|
579
|
-
{ type: EmailModule, decorators: [{ type: core.Optional }, { type: core.SkipSelf }] }
|
|
580
|
-
]; };
|
|
581
|
-
|
|
582
|
-
var EmployeeServiceConfig = /** @class */ (function () {
|
|
583
|
-
function EmployeeServiceConfig() {
|
|
584
|
-
}
|
|
585
|
-
return EmployeeServiceConfig;
|
|
586
|
-
}());
|
|
587
|
-
|
|
588
|
-
//#region Imports
|
|
589
|
-
//#endregion
|
|
590
|
-
var EmployeeService = /** @class */ (function () {
|
|
591
|
-
//#endregion
|
|
592
|
-
//#region Lifecycle
|
|
593
|
-
function EmployeeService(config, http) {
|
|
594
|
-
this.http = http;
|
|
595
|
-
this.employeeApiUrl = config.employeeApiUrl;
|
|
596
|
-
}
|
|
597
|
-
//#endregion
|
|
598
|
-
//#region Utilities
|
|
599
|
-
EmployeeService.prototype.getEmployees = function (storeEmployees, includeDisabled) {
|
|
600
|
-
var _this = this;
|
|
601
|
-
if (storeEmployees === void 0) { storeEmployees = false; }
|
|
602
|
-
if (includeDisabled === void 0) { includeDisabled = false; }
|
|
603
|
-
// Do we already have employees stored locally?
|
|
604
|
-
if (this.employees) {
|
|
605
|
-
return rxjs.of(this.employees);
|
|
606
|
-
// return Observable.of(this.employees);
|
|
607
|
-
}
|
|
608
|
-
// Should we store employees locally for subsequent calls?
|
|
609
|
-
if (storeEmployees) {
|
|
610
|
-
this.http.get(this.employeeApiUrl + "/false/" + includeDisabled)
|
|
611
|
-
.subscribe(function (emps) { return _this.employees = emps; });
|
|
612
|
-
}
|
|
613
|
-
return this.http.get(this.employeeApiUrl + "/false/" + includeDisabled);
|
|
614
|
-
};
|
|
615
|
-
EmployeeService.prototype.getEmployee = function (sAMAccountName) {
|
|
616
|
-
return this.http.get(this.employeeApiUrl + "/name/" + sAMAccountName);
|
|
617
|
-
};
|
|
618
|
-
return EmployeeService;
|
|
619
|
-
}());
|
|
620
|
-
EmployeeService.decorators = [
|
|
621
|
-
{ type: core.Injectable }
|
|
622
|
-
];
|
|
623
|
-
EmployeeService.ctorParameters = function () { return [
|
|
624
|
-
{ type: EmployeeServiceConfig, decorators: [{ type: core.Optional }] },
|
|
625
|
-
{ type: http.HttpClient }
|
|
626
|
-
]; };
|
|
627
|
-
|
|
628
|
-
var DepartmentsPipe = /** @class */ (function () {
|
|
629
|
-
function DepartmentsPipe() {
|
|
630
|
-
}
|
|
631
|
-
DepartmentsPipe.prototype.transform = function (employees, args) {
|
|
632
|
-
var departments = [];
|
|
633
|
-
employees
|
|
634
|
-
.filter(function (emp) { return emp.department; })
|
|
635
|
-
.forEach(function (emp) {
|
|
636
|
-
if (departments.indexOf(emp.department) === -1) {
|
|
637
|
-
departments.push(emp.department);
|
|
638
|
-
}
|
|
639
|
-
});
|
|
640
|
-
return departments.sort();
|
|
641
|
-
};
|
|
642
|
-
return DepartmentsPipe;
|
|
643
|
-
}());
|
|
644
|
-
DepartmentsPipe.decorators = [
|
|
645
|
-
{ type: core.Pipe, args: [{
|
|
646
|
-
name: 'departments'
|
|
647
|
-
},] }
|
|
648
|
-
];
|
|
649
|
-
|
|
650
|
-
var EmployeeByDnPipe = /** @class */ (function () {
|
|
651
|
-
function EmployeeByDnPipe() {
|
|
652
|
-
}
|
|
653
|
-
EmployeeByDnPipe.prototype.transform = function (employees, dn) {
|
|
654
|
-
return employees
|
|
655
|
-
.find(function (emp) { return emp.distinguishedName.toLowerCase() === dn.toLowerCase(); });
|
|
656
|
-
};
|
|
657
|
-
return EmployeeByDnPipe;
|
|
658
|
-
}());
|
|
659
|
-
EmployeeByDnPipe.decorators = [
|
|
660
|
-
{ type: core.Pipe, args: [{
|
|
661
|
-
name: 'employeeByDn'
|
|
662
|
-
},] }
|
|
663
|
-
];
|
|
664
|
-
|
|
665
|
-
var EmployeePhotoUrlPipe = /** @class */ (function () {
|
|
666
|
-
function EmployeePhotoUrlPipe() {
|
|
667
|
-
}
|
|
668
|
-
EmployeePhotoUrlPipe.prototype.transform = function (employee, photos) {
|
|
669
|
-
if (!photos) {
|
|
670
|
-
return null;
|
|
671
|
-
}
|
|
672
|
-
// Try to match by employeeNumber, accountName, or title
|
|
673
|
-
var photo = photos
|
|
674
|
-
.find(function (pic) { return (pic.employeeNumber && employee.employeeNumber && +pic.employeeNumber === +employee.employeeNumber) ||
|
|
675
|
-
(pic.accountName && pic.accountName.toLowerCase() === employee.sAMAccountName.toLowerCase()) ||
|
|
676
|
-
(pic.title && pic.title.toLowerCase() === employee.displayName.toLowerCase()); });
|
|
677
|
-
if (!photo) {
|
|
678
|
-
console.log("No photo match for " + employee.displayName);
|
|
679
|
-
}
|
|
680
|
-
return photo ? photo.encodedAbsUrl : null;
|
|
681
|
-
};
|
|
682
|
-
return EmployeePhotoUrlPipe;
|
|
683
|
-
}());
|
|
684
|
-
EmployeePhotoUrlPipe.decorators = [
|
|
685
|
-
{ type: core.Pipe, args: [{
|
|
686
|
-
name: 'employeePhotoUrl'
|
|
687
|
-
},] }
|
|
688
|
-
];
|
|
689
|
-
|
|
690
|
-
var EmployeesWithPropertyValuePipe = /** @class */ (function () {
|
|
691
|
-
function EmployeesWithPropertyValuePipe() {
|
|
692
|
-
}
|
|
693
|
-
EmployeesWithPropertyValuePipe.prototype.transform = function (employees, propertyName, propertyValue) {
|
|
694
|
-
return employees
|
|
695
|
-
.filter(function (emp) { return emp[propertyName] && emp[propertyName] === propertyValue; });
|
|
696
|
-
};
|
|
697
|
-
return EmployeesWithPropertyValuePipe;
|
|
698
|
-
}());
|
|
699
|
-
EmployeesWithPropertyValuePipe.decorators = [
|
|
700
|
-
{ type: core.Pipe, args: [{
|
|
701
|
-
name: 'employeesWithPropertyValue'
|
|
702
|
-
},] }
|
|
703
|
-
];
|
|
704
|
-
|
|
705
|
-
var FilterEmployeesPipe = /** @class */ (function () {
|
|
706
|
-
function FilterEmployeesPipe() {
|
|
707
|
-
}
|
|
708
|
-
FilterEmployeesPipe.prototype.transform = function (employees, filter) {
|
|
709
|
-
return filter ?
|
|
710
|
-
employees
|
|
711
|
-
.filter(function (emp) { return emp.displayName.toLowerCase().indexOf(filter.toLowerCase()) !== -1 ||
|
|
712
|
-
(emp.department && emp.department.toLowerCase().indexOf(filter.toLowerCase()) !== -1) ||
|
|
713
|
-
(emp.title && emp.title.toLowerCase().indexOf(filter.toLowerCase()) !== -1) ||
|
|
714
|
-
emp.sAMAccountName.toLowerCase().indexOf(filter.toLowerCase()) !== -1; }) :
|
|
715
|
-
employees;
|
|
716
|
-
};
|
|
717
|
-
return FilterEmployeesPipe;
|
|
718
|
-
}());
|
|
719
|
-
FilterEmployeesPipe.decorators = [
|
|
720
|
-
{ type: core.Pipe, args: [{
|
|
721
|
-
name: 'filterEmployees'
|
|
722
|
-
},] }
|
|
723
|
-
];
|
|
724
|
-
|
|
725
|
-
var IsMemberOfPipe = /** @class */ (function () {
|
|
726
|
-
function IsMemberOfPipe() {
|
|
727
|
-
}
|
|
728
|
-
IsMemberOfPipe.prototype.transform = function (employee, groupName) {
|
|
729
|
-
return employee.memberOf &&
|
|
730
|
-
(employee.memberOf.find(function (m) { return m.toLowerCase().indexOf(groupName.toLowerCase()) !== -1; }) !== undefined);
|
|
731
|
-
};
|
|
732
|
-
return IsMemberOfPipe;
|
|
733
|
-
}());
|
|
734
|
-
IsMemberOfPipe.decorators = [
|
|
735
|
-
{ type: core.Pipe, args: [{
|
|
736
|
-
name: 'isMemberOf'
|
|
737
|
-
},] }
|
|
738
|
-
];
|
|
739
|
-
|
|
740
|
-
var SortEmployeesPipe = /** @class */ (function () {
|
|
741
|
-
function SortEmployeesPipe() {
|
|
742
|
-
}
|
|
743
|
-
SortEmployeesPipe.prototype.transform = function (employees, sortBy, dataType, reverse) {
|
|
744
|
-
return this.getSorted(employees, sortBy ? sortBy : 'displayName', dataType ? dataType : 'string', reverse ? reverse : false);
|
|
745
|
-
};
|
|
746
|
-
SortEmployeesPipe.prototype.getSorted = function (employees, sortBy, dataType, reverse) {
|
|
747
|
-
var sorted = employees
|
|
748
|
-
.sort(function (a, b) {
|
|
749
|
-
var valA, valB;
|
|
750
|
-
switch (dataType.toLowerCase()) {
|
|
751
|
-
case 'string':
|
|
752
|
-
valA = a[sortBy] ? a[sortBy].toString().toLowerCase() : null;
|
|
753
|
-
valB = b[sortBy] ? b[sortBy].toString().toLowerCase() : null;
|
|
754
|
-
break;
|
|
755
|
-
case 'number':
|
|
756
|
-
valA = a[sortBy] ? +a[sortBy] : null;
|
|
757
|
-
valB = b[sortBy] ? +b[sortBy] : null;
|
|
758
|
-
break;
|
|
759
|
-
case 'date':
|
|
760
|
-
valA = a[sortBy] ? a[sortBy] : null;
|
|
761
|
-
valB = b[sortBy] ? b[sortBy] : null;
|
|
762
|
-
break;
|
|
763
|
-
}
|
|
764
|
-
if (valA < valB) {
|
|
765
|
-
return -1;
|
|
766
|
-
}
|
|
767
|
-
if (valA > valB) {
|
|
768
|
-
return 1;
|
|
769
|
-
}
|
|
770
|
-
return 0;
|
|
771
|
-
});
|
|
772
|
-
return reverse ? sorted.reverse() : sorted;
|
|
773
|
-
};
|
|
774
|
-
return SortEmployeesPipe;
|
|
775
|
-
}());
|
|
776
|
-
SortEmployeesPipe.decorators = [
|
|
777
|
-
{ type: core.Pipe, args: [{
|
|
778
|
-
name: 'sortEmployees'
|
|
779
|
-
},] }
|
|
780
|
-
];
|
|
781
|
-
|
|
782
|
-
//#region Imports
|
|
783
|
-
//#endregion
|
|
784
|
-
var EmployeeModule = /** @class */ (function () {
|
|
785
|
-
function EmployeeModule(parentModule) {
|
|
786
|
-
if (parentModule) {
|
|
787
|
-
throw new Error('EmployeeModule is already loaded. Import it in the AppModule only');
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
EmployeeModule.forRoot = function (employeeConfig) {
|
|
791
|
-
return {
|
|
792
|
-
ngModule: EmployeeModule,
|
|
793
|
-
providers: [
|
|
794
|
-
EmployeeService,
|
|
795
|
-
{ provide: EmployeeServiceConfig, useValue: employeeConfig }
|
|
796
|
-
]
|
|
797
|
-
};
|
|
798
|
-
};
|
|
799
|
-
return EmployeeModule;
|
|
800
|
-
}());
|
|
801
|
-
EmployeeModule.decorators = [
|
|
802
|
-
{ type: core.NgModule, args: [{
|
|
803
|
-
imports: [common.CommonModule],
|
|
804
|
-
declarations: [
|
|
805
|
-
DepartmentsPipe,
|
|
806
|
-
EmployeeByDnPipe,
|
|
807
|
-
EmployeesWithPropertyValuePipe,
|
|
808
|
-
FilterEmployeesPipe,
|
|
809
|
-
IsMemberOfPipe,
|
|
810
|
-
EmployeePhotoUrlPipe,
|
|
811
|
-
SortEmployeesPipe
|
|
812
|
-
],
|
|
813
|
-
exports: [
|
|
814
|
-
DepartmentsPipe,
|
|
815
|
-
EmployeeByDnPipe,
|
|
816
|
-
EmployeesWithPropertyValuePipe,
|
|
817
|
-
FilterEmployeesPipe,
|
|
818
|
-
IsMemberOfPipe,
|
|
819
|
-
EmployeePhotoUrlPipe,
|
|
820
|
-
SortEmployeesPipe
|
|
821
|
-
]
|
|
822
|
-
},] }
|
|
823
|
-
];
|
|
824
|
-
EmployeeModule.ctorParameters = function () { return [
|
|
825
|
-
{ type: EmployeeModule, decorators: [{ type: core.Optional }, { type: core.SkipSelf }] }
|
|
826
|
-
]; };
|
|
827
|
-
|
|
828
|
-
var SharePointPhotoUrlPipe = /** @class */ (function () {
|
|
829
|
-
function SharePointPhotoUrlPipe() {
|
|
830
|
-
}
|
|
831
|
-
SharePointPhotoUrlPipe.prototype.transform = function (photo) {
|
|
832
|
-
return photo.encodedAbsUrl;
|
|
833
|
-
};
|
|
834
|
-
return SharePointPhotoUrlPipe;
|
|
835
|
-
}());
|
|
836
|
-
SharePointPhotoUrlPipe.decorators = [
|
|
837
|
-
{ type: core.Pipe, args: [{
|
|
838
|
-
name: 'sharePointPhotoUrl'
|
|
839
|
-
},] }
|
|
840
|
-
];
|
|
841
|
-
|
|
842
|
-
var SharePointUrlPipe = /** @class */ (function () {
|
|
843
|
-
function SharePointUrlPipe() {
|
|
844
|
-
}
|
|
845
|
-
SharePointUrlPipe.prototype.transform = function (url) {
|
|
846
|
-
return url !== null ? url.split(',')[0] : null;
|
|
847
|
-
};
|
|
848
|
-
return SharePointUrlPipe;
|
|
849
|
-
}());
|
|
850
|
-
SharePointUrlPipe.decorators = [
|
|
851
|
-
{ type: core.Pipe, args: [{
|
|
852
|
-
name: 'sharePointUrl'
|
|
853
|
-
},] }
|
|
854
|
-
];
|
|
855
|
-
|
|
856
|
-
//#region Imports
|
|
857
|
-
//#endregion
|
|
858
|
-
var SharePointModule = /** @class */ (function () {
|
|
859
|
-
function SharePointModule(parentModule) {
|
|
860
|
-
if (parentModule) {
|
|
861
|
-
throw new Error('SharePointModule is already loaded. Import it in the AppModule only');
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
SharePointModule.forRoot = function (sharePointConfig) {
|
|
865
|
-
return {
|
|
866
|
-
ngModule: SharePointModule,
|
|
867
|
-
providers: [
|
|
868
|
-
SharePointService,
|
|
869
|
-
{ provide: SharePointServiceConfig, useValue: sharePointConfig }
|
|
870
|
-
]
|
|
871
|
-
};
|
|
872
|
-
};
|
|
873
|
-
return SharePointModule;
|
|
874
|
-
}());
|
|
875
|
-
SharePointModule.decorators = [
|
|
876
|
-
{ type: core.NgModule, args: [{
|
|
877
|
-
imports: [
|
|
878
|
-
common.CommonModule
|
|
879
|
-
],
|
|
880
|
-
declarations: [
|
|
881
|
-
SharePointPhotoUrlPipe,
|
|
882
|
-
SharePointUrlPipe
|
|
883
|
-
],
|
|
884
|
-
exports: [
|
|
885
|
-
SharePointPhotoUrlPipe,
|
|
886
|
-
SharePointUrlPipe
|
|
887
|
-
]
|
|
888
|
-
},] }
|
|
889
|
-
];
|
|
890
|
-
SharePointModule.ctorParameters = function () { return [
|
|
891
|
-
{ type: SharePointModule, decorators: [{ type: core.Optional }, { type: core.SkipSelf }] }
|
|
892
|
-
]; };
|
|
893
|
-
|
|
894
|
-
var UploadServiceConfig = /** @class */ (function () {
|
|
895
|
-
function UploadServiceConfig() {
|
|
896
|
-
}
|
|
897
|
-
return UploadServiceConfig;
|
|
898
|
-
}());
|
|
899
|
-
|
|
900
|
-
// https://malcoded.com/posts/angular-file-upload-component-with-express
|
|
901
|
-
var UploadService = /** @class */ (function () {
|
|
902
|
-
function UploadService(http, config) {
|
|
903
|
-
this.http = http;
|
|
904
|
-
this.uploadApiUrl = config.uploadApiUrl;
|
|
905
|
-
this.uploadPath = config.uploadPath || '';
|
|
906
|
-
this.dbAppId = config.dbAppId || '';
|
|
907
|
-
this.externalReferenceId = config.externalReferenceId || '';
|
|
908
|
-
this.comment = config.comment || '';
|
|
909
|
-
// UI configuration
|
|
910
|
-
this.uploadButtonText = config.uploadButtonText;
|
|
911
|
-
this.uploadDialogTitle = config.uploadDialogTitle;
|
|
912
|
-
this.uploadDialogAddFilesButtonText = config.uploadDialogAddFilesButtonText;
|
|
913
|
-
this.uploadDialogCancelButtonText = config.uploadDialogCancelButtonText;
|
|
914
|
-
this.uploadDialogUploadButtonText = config.uploadDialogUploadButtonText;
|
|
915
|
-
this.uploadDialogFinishButtonText = config.uploadDialogFinishButtonText;
|
|
916
|
-
}
|
|
917
|
-
UploadService.prototype.upload = function (files) {
|
|
918
|
-
var _this = this;
|
|
919
|
-
// this will be the our resulting map
|
|
920
|
-
var status = {};
|
|
921
|
-
files.forEach(function (file) {
|
|
922
|
-
// create a new multipart-form for every file
|
|
923
|
-
var formData = new FormData();
|
|
924
|
-
formData.append('file', file, file.name);
|
|
925
|
-
// create a http-post request and pass the form
|
|
926
|
-
// tell it to report the upload progress
|
|
927
|
-
// A 'Destination' header is used to optionally configure the file upload destination (filesystem)
|
|
928
|
-
// A 'DbAppId' header is used to configure the unique identifier of database uploads
|
|
929
|
-
var req = new http.HttpRequest('POST', _this.uploadApiUrl, formData, {
|
|
930
|
-
reportProgress: true,
|
|
931
|
-
responseType: 'blob',
|
|
932
|
-
headers: new http.HttpHeaders()
|
|
933
|
-
.set('Destination', _this.uploadPath)
|
|
934
|
-
.set('DbAppId', _this.dbAppId)
|
|
935
|
-
.set('ExternalReferenceId', _this.externalReferenceId)
|
|
936
|
-
.set('Comment', _this.comment)
|
|
937
|
-
/*headers: this.uploadPath ?
|
|
938
|
-
new HttpHeaders({ 'Destination': this.uploadPath }) :
|
|
939
|
-
this.dbAppId ?
|
|
940
|
-
new HttpHeaders({ 'DbAppId': this.dbAppId }) :
|
|
941
|
-
null*/
|
|
942
|
-
});
|
|
943
|
-
// create a new progress-subject for every file
|
|
944
|
-
var progress = new rxjs.Subject();
|
|
945
|
-
// send the http-request and subscribe for progress-updates
|
|
946
|
-
_this.http.request(req).subscribe(function (event) {
|
|
947
|
-
if (event.type === http.HttpEventType.UploadProgress) {
|
|
948
|
-
// calculate the progress percentage
|
|
949
|
-
var percentDone = Math.round(100 * event.loaded / event.total);
|
|
950
|
-
// pass the percentage into the progress-stream
|
|
951
|
-
progress.next(percentDone);
|
|
952
|
-
}
|
|
953
|
-
else if (event instanceof http.HttpResponse) {
|
|
954
|
-
// Close the progress-stream if we get an answer form the API
|
|
955
|
-
// The upload is complete
|
|
956
|
-
progress.complete();
|
|
957
|
-
}
|
|
958
|
-
});
|
|
959
|
-
// Save every progress-observable in a map of all observables
|
|
960
|
-
status[file.name] = {
|
|
961
|
-
progress: progress.asObservable()
|
|
962
|
-
};
|
|
963
|
-
});
|
|
964
|
-
// return the map of progress.observables
|
|
965
|
-
return status;
|
|
966
|
-
};
|
|
967
|
-
UploadService.prototype.exists = function (fileName) {
|
|
968
|
-
var query = this.uploadApiUrl.toLowerCase().indexOf('filesystem') === -1 ?
|
|
969
|
-
{ name: fileName, dbAppId: this.dbAppId } :
|
|
970
|
-
{ name: fileName, destination: this.uploadPath };
|
|
971
|
-
return this.http.post(this.uploadApiUrl + "/exists", query);
|
|
972
|
-
};
|
|
973
|
-
UploadService.prototype.download = function (request) {
|
|
974
|
-
return this.http.post(this.uploadApiUrl + "/stream", request, { responseType: 'blob' });
|
|
975
|
-
};
|
|
976
|
-
UploadService.prototype.getUploadInfo = function (request) {
|
|
977
|
-
return this.http.post(this.uploadApiUrl + "/info", request);
|
|
978
|
-
};
|
|
979
|
-
return UploadService;
|
|
980
|
-
}());
|
|
981
|
-
UploadService.decorators = [
|
|
982
|
-
{ type: core.Injectable }
|
|
983
|
-
];
|
|
984
|
-
UploadService.ctorParameters = function () { return [
|
|
985
|
-
{ type: http.HttpClient },
|
|
986
|
-
{ type: UploadServiceConfig, decorators: [{ type: core.Optional }] }
|
|
987
|
-
]; };
|
|
988
|
-
|
|
989
|
-
var UploadDialogComponent = /** @class */ (function () {
|
|
990
|
-
function UploadDialogComponent(dialogRef, uploadService) {
|
|
991
|
-
this.dialogRef = dialogRef;
|
|
992
|
-
this.uploadService = uploadService;
|
|
993
|
-
this.files = new Set();
|
|
994
|
-
this.canBeClosed = true;
|
|
995
|
-
this.showCancelButton = true;
|
|
996
|
-
this.uploading = false;
|
|
997
|
-
this.uploadSuccessful = false;
|
|
998
|
-
}
|
|
999
|
-
UploadDialogComponent.prototype.ngOnInit = function () {
|
|
1000
|
-
this.uploadDialogTitle = this.uploadService.uploadDialogTitle ?
|
|
1001
|
-
this.uploadService.uploadDialogTitle :
|
|
1002
|
-
'Upload Files';
|
|
1003
|
-
this.uploadDialogAddFilesButtonText = this.uploadService.uploadDialogAddFilesButtonText ?
|
|
1004
|
-
this.uploadService.uploadDialogAddFilesButtonText :
|
|
1005
|
-
'Add Files';
|
|
1006
|
-
this.uploadDialogCancelButtonText = this.uploadService.uploadDialogCancelButtonText ?
|
|
1007
|
-
this.uploadService.uploadDialogCancelButtonText :
|
|
1008
|
-
'Cancel';
|
|
1009
|
-
this.uploadDialogUploadButtonText = this.uploadService.uploadDialogUploadButtonText ?
|
|
1010
|
-
this.uploadService.uploadDialogUploadButtonText :
|
|
1011
|
-
'Upload';
|
|
1012
|
-
this.uploadDialogFinishButtonText = this.uploadService.uploadDialogFinishButtonText ?
|
|
1013
|
-
this.uploadService.uploadDialogFinishButtonText :
|
|
1014
|
-
'Finish';
|
|
1015
|
-
this.primaryButtonText = this.uploadDialogUploadButtonText;
|
|
1016
|
-
};
|
|
1017
|
-
UploadDialogComponent.prototype.addFiles = function () {
|
|
1018
|
-
this.file.nativeElement.click();
|
|
1019
|
-
};
|
|
1020
|
-
UploadDialogComponent.prototype.onFilesAdded = function () {
|
|
1021
|
-
var _this = this;
|
|
1022
|
-
var files = this.file.nativeElement.files;
|
|
1023
|
-
var _loop_1 = function (key) {
|
|
1024
|
-
if (!isNaN(parseInt(key))) {
|
|
1025
|
-
// See if the file already exists
|
|
1026
|
-
this_1.uploadService.exists(files[key].name)
|
|
1027
|
-
.subscribe(function (exists) {
|
|
1028
|
-
if (exists) {
|
|
1029
|
-
_this.existingFileConflict = files[key].name;
|
|
1030
|
-
}
|
|
1031
|
-
if (!exists) {
|
|
1032
|
-
_this.files.add(files[key]);
|
|
1033
|
-
}
|
|
1034
|
-
});
|
|
1035
|
-
}
|
|
1036
|
-
};
|
|
1037
|
-
var this_1 = this;
|
|
1038
|
-
for (var key in files) {
|
|
1039
|
-
_loop_1(key);
|
|
1040
|
-
}
|
|
1041
|
-
};
|
|
1042
|
-
UploadDialogComponent.prototype.closeDialog = function () {
|
|
1043
|
-
var _this = this;
|
|
1044
|
-
// if everything was uploaded already, just close the dialog
|
|
1045
|
-
if (this.uploadSuccessful) {
|
|
1046
|
-
return this.dialogRef.close();
|
|
1047
|
-
}
|
|
1048
|
-
// set the component state to "uploading"
|
|
1049
|
-
this.uploading = true;
|
|
1050
|
-
// start the upload and save the progress map
|
|
1051
|
-
this.progress = this.uploadService.upload(this.files);
|
|
1052
|
-
// convert the progress map into an array
|
|
1053
|
-
var allProgressObservables = [];
|
|
1054
|
-
for (var key in this.progress) {
|
|
1055
|
-
allProgressObservables.push(this.progress[key].progress);
|
|
1056
|
-
}
|
|
1057
|
-
// Adjust the state variables
|
|
1058
|
-
// The OK-button should have the text "Finish" now
|
|
1059
|
-
this.primaryButtonText = this.uploadDialogFinishButtonText;
|
|
1060
|
-
// The dialog should not be closed while uploading
|
|
1061
|
-
this.canBeClosed = false;
|
|
1062
|
-
this.dialogRef.disableClose = true;
|
|
1063
|
-
// Hide the cancel-button
|
|
1064
|
-
this.showCancelButton = false;
|
|
1065
|
-
// When all progress-observables are completed...
|
|
1066
|
-
rxjs.forkJoin(allProgressObservables).subscribe(function (end) {
|
|
1067
|
-
// ... the dialog can be closed again...
|
|
1068
|
-
_this.canBeClosed = true;
|
|
1069
|
-
_this.dialogRef.disableClose = false;
|
|
1070
|
-
// ... the upload was successful...
|
|
1071
|
-
_this.uploadSuccessful = true;
|
|
1072
|
-
// ... and the component is no longer uploading
|
|
1073
|
-
_this.uploading = false;
|
|
1074
|
-
});
|
|
1075
|
-
};
|
|
1076
|
-
return UploadDialogComponent;
|
|
1077
|
-
}());
|
|
1078
|
-
UploadDialogComponent.decorators = [
|
|
1079
|
-
{ type: core.Component, args: [{
|
|
1080
|
-
selector: 'cp-upload-dialog',
|
|
1081
|
-
template: "<input type=\"file\" #file style=\"display: none\" (change)=\"onFilesAdded()\" multiple />\n\n<div mat-dialog-title id=\"title\">\n <div>{{ uploadDialogTitle }}</div>\n <button [disabled]=\"uploading || uploadSuccessful\" mat-raised-button color=\"primary\" class=\"add-files-btn\" (click)=\"addFiles()\">\n {{ uploadDialogAddFilesButtonText }}\n </button>\n</div>\n\n<div id=\"conflict\" *ngIf=\"existingFileConflict\">\n {{ existingFileConflict }} already exists on the server and cannot be overwritten\n</div>\n\n<mat-dialog-content>\n <mat-list>\n <mat-list-item *ngFor=\"let file of files\">\n <h4 mat-line>{{file.name}}</h4>\n <mat-progress-bar *ngIf=\"progress\" mode=\"determinate\" [value]=\"progress[file.name].progress | async\"></mat-progress-bar>\n </mat-list-item>\n </mat-list>\n</mat-dialog-content>\n\n<mat-dialog-actions id=\"actions\">\n <button *ngIf=\"showCancelButton\" mat-button mat-dialog-close>{{ uploadDialogCancelButtonText }}</button>\n <button *ngIf=\"files.size > 0\" mat-raised-button color=\"primary\" [disabled]=\"!canBeClosed\" (click)=\"closeDialog()\">{{ primaryButtonText }}</button>\n</mat-dialog-actions>\n",
|
|
1082
|
-
styles: ["#title{display:flex;justify-content:space-between}#actions{display:flex;justify-content:flex-end}#conflict{color:red;font-size:.8em;margin-top:.5em}"]
|
|
1083
|
-
},] }
|
|
1084
|
-
];
|
|
1085
|
-
UploadDialogComponent.ctorParameters = function () { return [
|
|
1086
|
-
{ type: dialog.MatDialogRef },
|
|
1087
|
-
{ type: UploadService }
|
|
1088
|
-
]; };
|
|
1089
|
-
UploadDialogComponent.propDecorators = {
|
|
1090
|
-
file: [{ type: core.ViewChild, args: ['file', { static: true },] }]
|
|
1091
|
-
};
|
|
1092
|
-
|
|
1093
|
-
var UploadComponent = /** @class */ (function () {
|
|
1094
|
-
function UploadComponent(dialog, uploadService) {
|
|
1095
|
-
this.dialog = dialog;
|
|
1096
|
-
this.uploadService = uploadService;
|
|
1097
|
-
this.dialogClosed = new core.EventEmitter();
|
|
1098
|
-
}
|
|
1099
|
-
UploadComponent.prototype.ngOnInit = function () {
|
|
1100
|
-
this.uploadButtonText = this.uploadService.uploadButtonText ?
|
|
1101
|
-
this.uploadService.uploadButtonText :
|
|
1102
|
-
'Upload';
|
|
1103
|
-
};
|
|
1104
|
-
UploadComponent.prototype.openUploadDialog = function () {
|
|
1105
|
-
var _this = this;
|
|
1106
|
-
this.dialog.open(UploadDialogComponent, { width: '50%' })
|
|
1107
|
-
.afterClosed().subscribe(function () { return _this.dialogClosed.emit(); });
|
|
1108
|
-
};
|
|
1109
|
-
return UploadComponent;
|
|
1110
|
-
}());
|
|
1111
|
-
UploadComponent.decorators = [
|
|
1112
|
-
{ type: core.Component, args: [{
|
|
1113
|
-
selector: 'cp-upload',
|
|
1114
|
-
template: '<button mat-raised-button (click)="openUploadDialog()">{{ uploadButtonText }}</button>'
|
|
1115
|
-
},] }
|
|
1116
|
-
];
|
|
1117
|
-
UploadComponent.ctorParameters = function () { return [
|
|
1118
|
-
{ type: dialog.MatDialog },
|
|
1119
|
-
{ type: UploadService }
|
|
1120
|
-
]; };
|
|
1121
|
-
UploadComponent.propDecorators = {
|
|
1122
|
-
dialogClosed: [{ type: core.Output }]
|
|
1123
|
-
};
|
|
1124
|
-
|
|
1125
|
-
//#region Imports
|
|
1126
|
-
//#endregion
|
|
1127
|
-
var UploadModule = /** @class */ (function () {
|
|
1128
|
-
function UploadModule(parentModule) {
|
|
1129
|
-
if (parentModule) {
|
|
1130
|
-
throw new Error('UploadModule is already loaded. Import it in the AppModule only');
|
|
1131
|
-
}
|
|
1132
|
-
}
|
|
1133
|
-
UploadModule.forRoot = function (uploadConfig) {
|
|
1134
|
-
return {
|
|
1135
|
-
ngModule: UploadModule,
|
|
1136
|
-
providers: [
|
|
1137
|
-
UploadService,
|
|
1138
|
-
{ provide: UploadServiceConfig, useValue: uploadConfig }
|
|
1139
|
-
]
|
|
1140
|
-
};
|
|
1141
|
-
};
|
|
1142
|
-
return UploadModule;
|
|
1143
|
-
}());
|
|
1144
|
-
UploadModule.decorators = [
|
|
1145
|
-
{ type: core.NgModule, args: [{
|
|
1146
|
-
imports: [
|
|
1147
|
-
common.CommonModule,
|
|
1148
|
-
animations.BrowserAnimationsModule,
|
|
1149
|
-
http.HttpClientModule,
|
|
1150
|
-
button.MatButtonModule,
|
|
1151
|
-
dialog.MatDialogModule,
|
|
1152
|
-
list.MatListModule,
|
|
1153
|
-
progressBar.MatProgressBarModule
|
|
1154
|
-
],
|
|
1155
|
-
declarations: [
|
|
1156
|
-
UploadComponent,
|
|
1157
|
-
UploadDialogComponent
|
|
1158
|
-
],
|
|
1159
|
-
exports: [
|
|
1160
|
-
UploadComponent,
|
|
1161
|
-
UploadDialogComponent
|
|
1162
|
-
],
|
|
1163
|
-
entryComponents: [
|
|
1164
|
-
UploadDialogComponent
|
|
1165
|
-
]
|
|
1166
|
-
},] }
|
|
1167
|
-
];
|
|
1168
|
-
UploadModule.ctorParameters = function () { return [
|
|
1169
|
-
{ type: UploadModule, decorators: [{ type: core.Optional }, { type: core.SkipSelf }] }
|
|
1170
|
-
]; };
|
|
1171
|
-
|
|
1172
|
-
// This pipe whitelists URLs so that they aren't prefixed with 'unsafe:' when they render in the DOM
|
|
1173
|
-
var SafeUrlPipe = /** @class */ (function () {
|
|
1174
|
-
function SafeUrlPipe(domSanitizer) {
|
|
1175
|
-
this.domSanitizer = domSanitizer;
|
|
1176
|
-
}
|
|
1177
|
-
SafeUrlPipe.prototype.transform = function (value) {
|
|
1178
|
-
return this.domSanitizer.bypassSecurityTrustUrl(value);
|
|
1179
|
-
};
|
|
1180
|
-
return SafeUrlPipe;
|
|
1181
|
-
}());
|
|
1182
|
-
SafeUrlPipe.decorators = [
|
|
1183
|
-
{ type: core.Pipe, args: [{
|
|
1184
|
-
name: 'safeUrl'
|
|
1185
|
-
},] }
|
|
1186
|
-
];
|
|
1187
|
-
SafeUrlPipe.ctorParameters = function () { return [
|
|
1188
|
-
{ type: platformBrowser.DomSanitizer }
|
|
1189
|
-
]; };
|
|
1190
|
-
|
|
1191
|
-
var UriSchemePipe = /** @class */ (function () {
|
|
1192
|
-
function UriSchemePipe() {
|
|
1193
|
-
}
|
|
1194
|
-
// https://docs.microsoft.com/en-us/office/client-developer/office-uri-schemes
|
|
1195
|
-
UriSchemePipe.prototype.transform = function (value) {
|
|
1196
|
-
if (!localStorage.getItem('useUriScheme')) {
|
|
1197
|
-
return value;
|
|
1198
|
-
}
|
|
1199
|
-
var urlSplit = value.split('.');
|
|
1200
|
-
var extension = urlSplit[urlSplit.length - 1];
|
|
1201
|
-
if (!extension) {
|
|
1202
|
-
return value;
|
|
1203
|
-
}
|
|
1204
|
-
var command = this.command(extension);
|
|
1205
|
-
var app = this.app(extension);
|
|
1206
|
-
return "ms-" + app + ":" + command + "|u|" + value;
|
|
1207
|
-
};
|
|
1208
|
-
UriSchemePipe.prototype.app = function (extension) {
|
|
1209
|
-
switch (extension.toLowerCase()) {
|
|
1210
|
-
// documents
|
|
1211
|
-
case 'doc':
|
|
1212
|
-
case 'docx':
|
|
1213
|
-
case 'docm':
|
|
1214
|
-
case 'docb':
|
|
1215
|
-
case 'dot':
|
|
1216
|
-
case 'dotx':
|
|
1217
|
-
case 'dotm': // templates
|
|
1218
|
-
return 'word';
|
|
1219
|
-
case 'xls':
|
|
1220
|
-
case 'xlsx':
|
|
1221
|
-
case 'xlm':
|
|
1222
|
-
case 'xlsm':
|
|
1223
|
-
case 'xlsb':
|
|
1224
|
-
case 'xlw':
|
|
1225
|
-
case 'xlt':
|
|
1226
|
-
case 'xltx':
|
|
1227
|
-
case 'xltm': // templates
|
|
1228
|
-
return 'excel';
|
|
1229
|
-
case 'ppt':
|
|
1230
|
-
case 'pptx':
|
|
1231
|
-
case 'pps':
|
|
1232
|
-
case 'ppsx':
|
|
1233
|
-
case 'pptm':
|
|
1234
|
-
case 'ppsm':
|
|
1235
|
-
case 'sldx':
|
|
1236
|
-
case 'sldm':
|
|
1237
|
-
case 'pot':
|
|
1238
|
-
case 'potx':
|
|
1239
|
-
case 'potm': // templates
|
|
1240
|
-
return 'powerpoint';
|
|
1241
|
-
case 'vsd':
|
|
1242
|
-
case 'vsdx':
|
|
1243
|
-
case 'vst':
|
|
1244
|
-
case 'vstx': // templates
|
|
1245
|
-
return 'visio';
|
|
1246
|
-
case 'mdb':
|
|
1247
|
-
case 'accdb':
|
|
1248
|
-
case 'accde':
|
|
1249
|
-
case 'accdr':
|
|
1250
|
-
case 'accdt': // templates
|
|
1251
|
-
return 'access';
|
|
1252
|
-
case 'mpp':
|
|
1253
|
-
case 'mppx':
|
|
1254
|
-
case 'mpt': // templates
|
|
1255
|
-
return 'project';
|
|
1256
|
-
case 'pub':
|
|
1257
|
-
return 'publisher';
|
|
1258
|
-
case 'xsn':
|
|
1259
|
-
return 'infopath';
|
|
1260
|
-
}
|
|
1261
|
-
};
|
|
1262
|
-
UriSchemePipe.prototype.command = function (extension) {
|
|
1263
|
-
switch (extension.toLowerCase()) {
|
|
1264
|
-
case 'dot':
|
|
1265
|
-
case 'dotx':
|
|
1266
|
-
case 'dotm':
|
|
1267
|
-
case 'xlt':
|
|
1268
|
-
case 'xltx':
|
|
1269
|
-
case 'xltm':
|
|
1270
|
-
case 'pot':
|
|
1271
|
-
case 'potx':
|
|
1272
|
-
case 'potm':
|
|
1273
|
-
case 'vst':
|
|
1274
|
-
case 'vstx':
|
|
1275
|
-
case 'accdt':
|
|
1276
|
-
case 'mpt':
|
|
1277
|
-
return 'nft'; // new from template
|
|
1278
|
-
default:
|
|
1279
|
-
var openMode = 'v'; // for view, or 'e' or edit
|
|
1280
|
-
return "of" + openMode; // default: open file as view/edit
|
|
1281
|
-
}
|
|
1282
|
-
};
|
|
1283
|
-
return UriSchemePipe;
|
|
1284
|
-
}());
|
|
1285
|
-
UriSchemePipe.decorators = [
|
|
1286
|
-
{ type: core.Pipe, args: [{
|
|
1287
|
-
name: 'uriScheme',
|
|
1288
|
-
pure: false
|
|
1289
|
-
},] }
|
|
1290
|
-
];
|
|
1291
|
-
|
|
1292
|
-
//#region Imports
|
|
1293
|
-
//#endregion
|
|
1294
|
-
var UrlModule = /** @class */ (function () {
|
|
1295
|
-
function UrlModule() {
|
|
1296
|
-
}
|
|
1297
|
-
return UrlModule;
|
|
1298
|
-
}());
|
|
1299
|
-
UrlModule.decorators = [
|
|
1300
|
-
{ type: core.NgModule, args: [{
|
|
1301
|
-
imports: [
|
|
1302
|
-
common.CommonModule
|
|
1303
|
-
],
|
|
1304
|
-
declarations: [
|
|
1305
|
-
SafeUrlPipe,
|
|
1306
|
-
UriSchemePipe
|
|
1307
|
-
],
|
|
1308
|
-
exports: [
|
|
1309
|
-
SafeUrlPipe,
|
|
1310
|
-
UriSchemePipe
|
|
1311
|
-
],
|
|
1312
|
-
entryComponents: []
|
|
1313
|
-
},] }
|
|
1314
|
-
];
|
|
1315
|
-
|
|
1316
|
-
/**
|
|
1317
|
-
* Generated bundle index. Do not edit.
|
|
1318
|
-
*/
|
|
1319
|
-
|
|
1320
|
-
exports.AuthenticationModule = AuthenticationModule;
|
|
1321
|
-
exports.AuthenticationService = AuthenticationService;
|
|
1322
|
-
exports.AuthenticationServiceConfig = AuthenticationServiceConfig;
|
|
1323
|
-
exports.ConfirmationDialogComponent = ConfirmationDialogComponent;
|
|
1324
|
-
exports.DepartmentsPipe = DepartmentsPipe;
|
|
1325
|
-
exports.DialogModule = DialogModule;
|
|
1326
|
-
exports.EmailModule = EmailModule;
|
|
1327
|
-
exports.EmailService = EmailService;
|
|
1328
|
-
exports.EmailServiceConfig = EmailServiceConfig;
|
|
1329
|
-
exports.EmployeeByDnPipe = EmployeeByDnPipe;
|
|
1330
|
-
exports.EmployeeModule = EmployeeModule;
|
|
1331
|
-
exports.EmployeePhotoUrlPipe = EmployeePhotoUrlPipe;
|
|
1332
|
-
exports.EmployeeService = EmployeeService;
|
|
1333
|
-
exports.EmployeeServiceConfig = EmployeeServiceConfig;
|
|
1334
|
-
exports.EmployeesWithPropertyValuePipe = EmployeesWithPropertyValuePipe;
|
|
1335
|
-
exports.FilterEmployeesPipe = FilterEmployeesPipe;
|
|
1336
|
-
exports.InputDialogComponent = InputDialogComponent;
|
|
1337
|
-
exports.IsMemberOfPipe = IsMemberOfPipe;
|
|
1338
|
-
exports.LoginComponent = LoginComponent;
|
|
1339
|
-
exports.LoginFormComponent = LoginFormComponent;
|
|
1340
|
-
exports.MessageDialogComponent = MessageDialogComponent;
|
|
1341
|
-
exports.SafeUrlPipe = SafeUrlPipe;
|
|
1342
|
-
exports.SharePointModule = SharePointModule;
|
|
1343
|
-
exports.SharePointPhotoUrlPipe = SharePointPhotoUrlPipe;
|
|
1344
|
-
exports.SharePointService = SharePointService;
|
|
1345
|
-
exports.SharePointServiceConfig = SharePointServiceConfig;
|
|
1346
|
-
exports.SharePointUrlPipe = SharePointUrlPipe;
|
|
1347
|
-
exports.SortEmployeesPipe = SortEmployeesPipe;
|
|
1348
|
-
exports.UploadComponent = UploadComponent;
|
|
1349
|
-
exports.UploadDialogComponent = UploadDialogComponent;
|
|
1350
|
-
exports.UploadModule = UploadModule;
|
|
1351
|
-
exports.UploadService = UploadService;
|
|
1352
|
-
exports.UploadServiceConfig = UploadServiceConfig;
|
|
1353
|
-
exports.UriSchemePipe = UriSchemePipe;
|
|
1354
|
-
exports.UrlModule = UrlModule;
|
|
1355
|
-
exports.ɵa = DialogComponent;
|
|
1356
|
-
|
|
1357
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1358
|
-
|
|
1359
|
-
})));
|
|
1360
|
-
//# sourceMappingURL=cleavelandprice-ngx-lib.umd.js.map
|