@cleavelandprice/ngx-lib 3.0.2 → 3.0.6

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.
Files changed (54) hide show
  1. package/active-directory/model/user.d.ts +9 -0
  2. package/dialog/components/base/base.component.d.ts +1 -0
  3. package/dialog/components/choice/choice.component.d.ts +12 -0
  4. package/dialog/dialog.module.d.ts +12 -11
  5. package/dialog/model/dialog-base-data.d.ts +1 -1
  6. package/dialog/model/dialog-choice-data.d.ts +4 -0
  7. package/dialog/model/dialog-type.d.ts +4 -3
  8. package/dialog/public_api.d.ts +1 -0
  9. package/esm2020/active-directory/model/user.mjs +1 -1
  10. package/esm2020/active-directory/services/active-directory.service.mjs +13 -4
  11. package/esm2020/authentication/services/authentication.service.mjs +5 -2
  12. package/esm2020/dialog/components/base/base.component.mjs +8 -3
  13. package/esm2020/dialog/components/choice/choice.component.mjs +23 -0
  14. package/esm2020/dialog/dialog.module.mjs +6 -1
  15. package/esm2020/dialog/model/dialog-base-data.mjs +1 -1
  16. package/esm2020/dialog/model/dialog-choice-data.mjs +2 -0
  17. package/esm2020/dialog/model/dialog-type.mjs +5 -4
  18. package/esm2020/dialog/public_api.mjs +2 -1
  19. package/esm2020/lib/services/app-path-config.service.mjs +5 -2
  20. package/esm2020/sharepoint/services/sharepoint.service.mjs +5 -2
  21. package/esm2020/upload/components/upload/upload.component.mjs +3 -3
  22. package/esm2020/upload/components/upload-dialog/upload-dialog.component.mjs +6 -10
  23. package/esm2020/upload/model/default-config.mjs +14 -0
  24. package/esm2020/upload/model/service-config.mjs +14 -1
  25. package/esm2020/upload/services/upload.service.mjs +28 -30
  26. package/fesm2015/cleavelandprice-ngx-lib-active-directory.mjs +3 -4
  27. package/fesm2015/cleavelandprice-ngx-lib-active-directory.mjs.map +1 -1
  28. package/fesm2015/cleavelandprice-ngx-lib-authentication.mjs +1 -2
  29. package/fesm2015/cleavelandprice-ngx-lib-authentication.mjs.map +1 -1
  30. package/fesm2015/cleavelandprice-ngx-lib-dialog.mjs +35 -6
  31. package/fesm2015/cleavelandprice-ngx-lib-dialog.mjs.map +1 -1
  32. package/fesm2015/cleavelandprice-ngx-lib-sharepoint.mjs +1 -2
  33. package/fesm2015/cleavelandprice-ngx-lib-sharepoint.mjs.map +1 -1
  34. package/fesm2015/cleavelandprice-ngx-lib-upload.mjs +58 -43
  35. package/fesm2015/cleavelandprice-ngx-lib-upload.mjs.map +1 -1
  36. package/fesm2015/cleavelandprice-ngx-lib.mjs +1 -2
  37. package/fesm2015/cleavelandprice-ngx-lib.mjs.map +1 -1
  38. package/fesm2020/cleavelandprice-ngx-lib-active-directory.mjs +12 -3
  39. package/fesm2020/cleavelandprice-ngx-lib-active-directory.mjs.map +1 -1
  40. package/fesm2020/cleavelandprice-ngx-lib-authentication.mjs +4 -1
  41. package/fesm2020/cleavelandprice-ngx-lib-authentication.mjs.map +1 -1
  42. package/fesm2020/cleavelandprice-ngx-lib-dialog.mjs +33 -6
  43. package/fesm2020/cleavelandprice-ngx-lib-dialog.mjs.map +1 -1
  44. package/fesm2020/cleavelandprice-ngx-lib-sharepoint.mjs +4 -1
  45. package/fesm2020/cleavelandprice-ngx-lib-sharepoint.mjs.map +1 -1
  46. package/fesm2020/cleavelandprice-ngx-lib-upload.mjs +61 -41
  47. package/fesm2020/cleavelandprice-ngx-lib-upload.mjs.map +1 -1
  48. package/fesm2020/cleavelandprice-ngx-lib.mjs +4 -1
  49. package/fesm2020/cleavelandprice-ngx-lib.mjs.map +1 -1
  50. package/package.json +1 -1
  51. package/upload/components/upload-dialog/upload-dialog.component.d.ts +1 -6
  52. package/upload/model/default-config.d.ts +2 -0
  53. package/upload/model/service-config.d.ts +10 -10
  54. package/upload/services/upload.service.d.ts +1 -11
@@ -25,9 +25,10 @@ var ConfirmationDialogMode;
25
25
 
26
26
  var DialogType;
27
27
  (function (DialogType) {
28
- DialogType[DialogType["Confirmation"] = 0] = "Confirmation";
29
- DialogType[DialogType["Input"] = 1] = "Input";
30
- DialogType[DialogType["Message"] = 2] = "Message";
28
+ DialogType[DialogType["Choice"] = 0] = "Choice";
29
+ DialogType[DialogType["Confirmation"] = 1] = "Confirmation";
30
+ DialogType[DialogType["Input"] = 2] = "Input";
31
+ DialogType[DialogType["Message"] = 3] = "Message";
31
32
  })(DialogType || (DialogType = {}));
32
33
 
33
34
  class BaseComponent {
@@ -48,6 +49,11 @@ class BaseComponent {
48
49
  this.data.customTrueFalseText[1] :
49
50
  null;
50
51
  }
52
+ get choices() {
53
+ return this.dialogType === DialogType.Choice ?
54
+ this.data.choices :
55
+ null;
56
+ }
51
57
  close() {
52
58
  let data;
53
59
  switch (this.dialogType) {
@@ -91,10 +97,10 @@ class BaseComponent {
91
97
  }
92
98
  }
93
99
  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"] }] });
100
+ 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 <ng-container *ngIf=\"dialogType !== DialogType.Choice\">\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 </ng-container>\n\n <ng-container *ngIf=\"dialogType === DialogType.Choice\">\n <button mat-raised-button *ngFor=\"let choice of choices; let i = index\" [matDialogClose]=\"i\">\n <span>{{ choice }}</span>\n </button>\n </ng-container>\n</mat-dialog-actions>", styles: ["mat-form-field{margin-top:2em;width:100%}#checkbox{margin:2em 0}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { 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.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { 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
101
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: BaseComponent, decorators: [{
96
102
  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"] }]
103
+ 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 <ng-container *ngIf=\"dialogType !== DialogType.Choice\">\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 </ng-container>\n\n <ng-container *ngIf=\"dialogType === DialogType.Choice\">\n <button mat-raised-button *ngFor=\"let choice of choices; let i = index\" [matDialogClose]=\"i\">\n <span>{{ choice }}</span>\n </button>\n </ng-container>\n</mat-dialog-actions>", styles: ["mat-form-field{margin-top:2em;width:100%}#checkbox{margin:2em 0}\n"] }]
98
104
  }], propDecorators: { dialogType: [{
99
105
  type: Input
100
106
  }], data: [{
@@ -103,6 +109,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
103
109
  type: Output
104
110
  }] } });
105
111
 
112
+ class ChoiceComponent {
113
+ constructor(data, dialogRef) {
114
+ this.data = data;
115
+ this.dialogRef = dialogRef;
116
+ this.dialogType = DialogType.Choice;
117
+ }
118
+ }
119
+ ChoiceComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ChoiceComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1$1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
120
+ ChoiceComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: ChoiceComponent, selector: "dialog-choice", 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"] }] });
121
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ChoiceComponent, decorators: [{
122
+ type: Component,
123
+ args: [{ selector: 'dialog-choice', template: "<dialog-base\n [data]=\"data\"\n [dialogType]=\"dialogType\"\n (closed)=\"dialogRef.close($event)\">\n</dialog-base>" }]
124
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
125
+ type: Inject,
126
+ args: [MAT_DIALOG_DATA]
127
+ }] }, { type: i1$1.MatDialogRef }]; } });
128
+
106
129
  class ConfirmationComponent {
107
130
  constructor(data, dialogRef) {
108
131
  this.data = data;
@@ -158,6 +181,7 @@ class DialogModule {
158
181
  }
159
182
  DialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: DialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
160
183
  DialogModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0", ngImport: i0, type: DialogModule, declarations: [BaseComponent,
184
+ ChoiceComponent,
161
185
  ConfirmationComponent,
162
186
  InputComponent,
163
187
  MessageComponent], imports: [CommonModule,
@@ -167,6 +191,7 @@ DialogModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
167
191
  MatDialogModule,
168
192
  MatFormFieldModule,
169
193
  MatInputModule], exports: [BaseComponent,
194
+ ChoiceComponent,
170
195
  ConfirmationComponent,
171
196
  InputComponent,
172
197
  MessageComponent] });
@@ -182,6 +207,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
182
207
  args: [{
183
208
  declarations: [
184
209
  BaseComponent,
210
+ ChoiceComponent,
185
211
  ConfirmationComponent,
186
212
  InputComponent,
187
213
  MessageComponent
@@ -197,6 +223,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
197
223
  ],
198
224
  exports: [
199
225
  BaseComponent,
226
+ ChoiceComponent,
200
227
  ConfirmationComponent,
201
228
  InputComponent,
202
229
  MessageComponent
@@ -208,5 +235,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
208
235
  * Generated bundle index. Do not edit.
209
236
  */
210
237
 
211
- export { BaseComponent, ConfirmationComponent, ConfirmationDialogMode, DialogModule, DialogType, InputComponent, MessageComponent };
238
+ export { BaseComponent, ChoiceComponent, ConfirmationComponent, ConfirmationDialogMode, DialogModule, DialogType, InputComponent, MessageComponent };
212
239
  //# sourceMappingURL=cleavelandprice-ngx-lib-dialog.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cleavelandprice-ngx-lib-dialog.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/dialog/src/model/confirmation-dialog-mode.ts","../../../../projects/cleavelandprice/ngx-lib/dialog/src/model/dialog-type.ts","../../../../projects/cleavelandprice/ngx-lib/dialog/src/components/base/base.component.ts","../../../../projects/cleavelandprice/ngx-lib/dialog/src/components/base/base.component.html","../../../../projects/cleavelandprice/ngx-lib/dialog/src/components/confirmation/confirmation.component.ts","../../../../projects/cleavelandprice/ngx-lib/dialog/src/components/confirmation/confirmation.component.html","../../../../projects/cleavelandprice/ngx-lib/dialog/src/components/input/input.component.ts","../../../../projects/cleavelandprice/ngx-lib/dialog/src/components/input/input.component.html","../../../../projects/cleavelandprice/ngx-lib/dialog/src/components/message/message.component.ts","../../../../projects/cleavelandprice/ngx-lib/dialog/src/components/message/message.component.html","../../../../projects/cleavelandprice/ngx-lib/dialog/src/dialog.module.ts","../../../../projects/cleavelandprice/ngx-lib/dialog/src/cleavelandprice-ngx-lib-dialog.ts"],"sourcesContent":["export enum ConfirmationDialogMode {\r\n OkCancel,\r\n YesNo,\r\n TrueFalse,\r\n Custom\r\n}","export enum DialogType {\r\n Confirmation,\r\n Input,\r\n Message\r\n}","import { Component, Input, Output, EventEmitter } from '@angular/core';\nimport { ConfirmationDialogMode } from '../../model/confirmation-dialog-mode';\nimport { DialogBaseData } from '../../model/dialog-base-data';\nimport { DialogType } from '../../model/dialog-type';\n\n@Component({\n selector: 'dialog-base',\n templateUrl: './base.component.html',\n styleUrls: ['./base.component.css']\n})\nexport class BaseComponent {\n // This is so that DialogType can be publish accessible from the HTML template\n DialogType = DialogType;\n @Input() dialogType = DialogType.Message;\n @Input() data!: DialogBaseData;\n @Output() closed = new EventEmitter<any>();\n\n ConfirmationDialogMode = ConfirmationDialogMode;\n\n // Form values\n userInput!: string;\n checkboxValue!: boolean;\n\n get customTrueText(): string | null {\n return this.data.customTrueFalseText ?\n this.data.customTrueFalseText[0] :\n null;\n }\n\n get customFalseText(): string | null {\n return this.data.customTrueFalseText ?\n this.data.customTrueFalseText[1] :\n null;\n }\n\n close(): void {\n let data: any;\n\n switch (this.dialogType) {\n case DialogType.Message:\n data = this.data.checkboxMessage ?\n {\n checkbox: this.checkboxValue || false\n } :\n null;\n break;\n case DialogType.Input:\n data = this.data.checkboxMessage ?\n {\n response: this.userInput,\n checkbox: this.checkboxValue || false\n } :\n this.userInput;\n break;\n case DialogType.Confirmation:\n data = this.data.checkboxMessage ?\n {\n response: true,\n checkbox: this.checkboxValue || false\n } :\n true;\n break;\n }\n\n this.closed.emit(data);\n }\n\n cancel(): void {\n let data: any;\n\n if (this.dialogType === DialogType.Confirmation) {\n data = this.data.checkboxMessage ?\n {\n response: false,\n checkbox: this.checkboxValue || false\n } :\n false;\n }\n\n this.closed.emit(data);\n }\n}\n","<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>","import { Component, Inject } from '@angular/core';\nimport { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';\nimport { DialogBaseData } from '../../model/dialog-base-data';\nimport { DialogType } from '../../model/dialog-type';\n\n@Component({\n selector: 'dialog-confirmation',\n templateUrl: './confirmation.component.html',\n styleUrls: ['./confirmation.component.css']\n})\nexport class ConfirmationComponent {\n dialogType = DialogType.Confirmation;\n\n constructor(@Inject(MAT_DIALOG_DATA) public data: DialogBaseData,\n public dialogRef: MatDialogRef<ConfirmationComponent>) {\n }\n}\n","<dialog-base\n [data]=\"data\"\n [dialogType]=\"dialogType\"\n (closed)=\"dialogRef.close($event)\">\n</dialog-base>","import { Component, Inject } from '@angular/core';\nimport { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';\nimport { DialogBaseData } from '../../model/dialog-base-data';\nimport { DialogType } from '../../model/dialog-type';\n\n@Component({\n selector: 'dialog-input',\n templateUrl: './input.component.html',\n styleUrls: ['./input.component.css']\n})\nexport class InputComponent {\n dialogType = DialogType.Input;\n\n constructor(@Inject(MAT_DIALOG_DATA) public data: DialogBaseData,\n public dialogRef: MatDialogRef<InputComponent>) {\n }\n}\n","<dialog-base\n [data]=\"data\"\n [dialogType]=\"dialogType\"\n (closed)=\"dialogRef.close($event)\">\n</dialog-base>","import { Component, Inject } from '@angular/core';\nimport { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';\nimport { DialogBaseData } from '../../model/dialog-base-data';\nimport { DialogType } from '../../model/dialog-type';\n\n@Component({\n selector: 'dialog-message',\n templateUrl: './message.component.html',\n styleUrls: ['./message.component.css']\n})\nexport class MessageComponent {\n dialogType = DialogType.Message;\n\n constructor(@Inject(MAT_DIALOG_DATA) public data: DialogBaseData,\n public dialogRef: MatDialogRef<MessageComponent>) {\n }\n}\n","<dialog-base\n [data]=\"data\"\n [dialogType]=\"dialogType\"\n (closed)=\"dialogRef.close($event)\">\n</dialog-base>","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\n\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { MatDialogModule } from '@angular/material/dialog';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\n\nimport { BaseComponent } from './components/base/base.component';\nimport { ConfirmationComponent } from './components/confirmation/confirmation.component';\nimport { InputComponent } from './components/input/input.component';\nimport { MessageComponent } from './components/message/message.component';\n\n@NgModule({\n declarations: [\n BaseComponent,\n ConfirmationComponent,\n InputComponent,\n MessageComponent\n ],\n imports: [\n CommonModule,\n FormsModule,\n\n MatButtonModule,\n MatCheckboxModule,\n MatDialogModule,\n MatFormFieldModule,\n MatInputModule\n ],\n exports: [\n BaseComponent,\n ConfirmationComponent,\n InputComponent,\n MessageComponent\n ]\n})\nexport class DialogModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i5","i1","i2.BaseComponent"],"mappings":";;;;;;;;;;;;;;;;;IAAY,uBAKX;AALD,CAAA,UAAY,sBAAsB,EAAA;AAC9B,IAAA,sBAAA,CAAA,sBAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAQ,CAAA;AACR,IAAA,sBAAA,CAAA,sBAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAK,CAAA;AACL,IAAA,sBAAA,CAAA,sBAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAS,CAAA;AACT,IAAA,sBAAA,CAAA,sBAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAM,CAAA;AACV,CAAC,EALW,sBAAsB,KAAtB,sBAAsB,GAKjC,EAAA,CAAA,CAAA;;ICLW,WAIX;AAJD,CAAA,UAAY,UAAU,EAAA;AAClB,IAAA,UAAA,CAAA,UAAA,CAAA,cAAA,CAAA,GAAA,CAAA,CAAA,GAAA,cAAY,CAAA;AACZ,IAAA,UAAA,CAAA,UAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAK,CAAA;AACL,IAAA,UAAA,CAAA,UAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAO,CAAA;AACX,CAAC,EAJW,UAAU,KAAV,UAAU,GAIrB,EAAA,CAAA,CAAA;;MCMY,aAAa,CAAA;AAL1B,IAAA,WAAA,GAAA;;QAOE,IAAU,CAAA,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,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE;wBACZ,aAAa;wBACb,qBAAqB;wBACrB,cAAc;wBACd,gBAAgB;AACjB,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,WAAW;wBAEX,eAAe;wBACf,iBAAiB;wBACjB,eAAe;wBACf,kBAAkB;wBAClB,cAAc;AACf,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,aAAa;wBACb,qBAAqB;wBACrB,cAAc;wBACd,gBAAgB;AACjB,qBAAA;AACF,iBAAA,CAAA;;;ACtCD;;AAEG;;;;"}
1
+ {"version":3,"file":"cleavelandprice-ngx-lib-dialog.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/dialog/src/model/confirmation-dialog-mode.ts","../../../../projects/cleavelandprice/ngx-lib/dialog/src/model/dialog-type.ts","../../../../projects/cleavelandprice/ngx-lib/dialog/src/components/base/base.component.ts","../../../../projects/cleavelandprice/ngx-lib/dialog/src/components/base/base.component.html","../../../../projects/cleavelandprice/ngx-lib/dialog/src/components/choice/choice.component.ts","../../../../projects/cleavelandprice/ngx-lib/dialog/src/components/choice/choice.component.html","../../../../projects/cleavelandprice/ngx-lib/dialog/src/components/confirmation/confirmation.component.ts","../../../../projects/cleavelandprice/ngx-lib/dialog/src/components/confirmation/confirmation.component.html","../../../../projects/cleavelandprice/ngx-lib/dialog/src/components/input/input.component.ts","../../../../projects/cleavelandprice/ngx-lib/dialog/src/components/input/input.component.html","../../../../projects/cleavelandprice/ngx-lib/dialog/src/components/message/message.component.ts","../../../../projects/cleavelandprice/ngx-lib/dialog/src/components/message/message.component.html","../../../../projects/cleavelandprice/ngx-lib/dialog/src/dialog.module.ts","../../../../projects/cleavelandprice/ngx-lib/dialog/src/cleavelandprice-ngx-lib-dialog.ts"],"sourcesContent":["export enum ConfirmationDialogMode {\r\n OkCancel,\r\n YesNo,\r\n TrueFalse,\r\n Custom\r\n}","export enum DialogType {\r\n Choice,\r\n Confirmation,\r\n Input,\r\n Message\r\n}","import { Component, Input, Output, EventEmitter } from '@angular/core';\nimport { ConfirmationDialogMode } from '../../model/confirmation-dialog-mode';\nimport { DialogBaseData } from '../../model/dialog-base-data';\nimport { DialogChoiceData } from '../../model/dialog-choice-data';\nimport { DialogType } from '../../model/dialog-type';\n\n@Component({\n selector: 'dialog-base',\n templateUrl: './base.component.html',\n styleUrls: ['./base.component.css']\n})\nexport class BaseComponent {\n // This is so that DialogType can be publish accessible from the HTML template\n DialogType = DialogType;\n @Input() dialogType = DialogType.Message;\n @Input() data!: DialogBaseData;\n @Output() closed = new EventEmitter<any>();\n\n ConfirmationDialogMode = ConfirmationDialogMode;\n\n // Form values\n userInput!: string;\n checkboxValue!: boolean;\n\n get customTrueText(): string | null {\n return this.data.customTrueFalseText ?\n this.data.customTrueFalseText[0] :\n null;\n }\n\n get customFalseText(): string | null {\n return this.data.customTrueFalseText ?\n this.data.customTrueFalseText[1] :\n null;\n }\n\n get choices(): string[] | null {\n return this.dialogType === DialogType.Choice ?\n (this.data as DialogChoiceData).choices :\n null;\n }\n\n close(): void {\n let data: any;\n\n switch (this.dialogType) {\n case DialogType.Message:\n data = this.data.checkboxMessage ?\n {\n checkbox: this.checkboxValue || false\n } :\n null;\n break;\n case DialogType.Input:\n data = this.data.checkboxMessage ?\n {\n response: this.userInput,\n checkbox: this.checkboxValue || false\n } :\n this.userInput;\n break;\n case DialogType.Confirmation:\n data = this.data.checkboxMessage ?\n {\n response: true,\n checkbox: this.checkboxValue || false\n } :\n true;\n break;\n }\n\n this.closed.emit(data);\n }\n\n cancel(): void {\n let data: any;\n\n if (this.dialogType === DialogType.Confirmation) {\n data = this.data.checkboxMessage ?\n {\n response: false,\n checkbox: this.checkboxValue || false\n } :\n false;\n }\n\n this.closed.emit(data);\n }\n}\n","<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 <ng-container *ngIf=\"dialogType !== DialogType.Choice\">\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 </ng-container>\n\n <ng-container *ngIf=\"dialogType === DialogType.Choice\">\n <button mat-raised-button *ngFor=\"let choice of choices; let i = index\" [matDialogClose]=\"i\">\n <span>{{ choice }}</span>\n </button>\n </ng-container>\n</mat-dialog-actions>","import { Component, Inject } from '@angular/core';\nimport { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';\nimport { DialogChoiceData } from '../../model/dialog-choice-data';\nimport { DialogType } from '../../model/dialog-type';\n\n@Component({\n selector: 'dialog-choice',\n templateUrl: './choice.component.html',\n styleUrls: ['./choice.component.css']\n})\nexport class ChoiceComponent {\n dialogType = DialogType.Choice;\n\n constructor(@Inject(MAT_DIALOG_DATA) public data: DialogChoiceData,\n public dialogRef: MatDialogRef<ChoiceComponent>) {\n }\n}\n","<dialog-base\n [data]=\"data\"\n [dialogType]=\"dialogType\"\n (closed)=\"dialogRef.close($event)\">\n</dialog-base>","import { Component, Inject } from '@angular/core';\nimport { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';\nimport { DialogBaseData } from '../../model/dialog-base-data';\nimport { DialogType } from '../../model/dialog-type';\n\n@Component({\n selector: 'dialog-confirmation',\n templateUrl: './confirmation.component.html',\n styleUrls: ['./confirmation.component.css']\n})\nexport class ConfirmationComponent {\n dialogType = DialogType.Confirmation;\n\n constructor(@Inject(MAT_DIALOG_DATA) public data: DialogBaseData,\n public dialogRef: MatDialogRef<ConfirmationComponent>) {\n }\n}\n","<dialog-base\n [data]=\"data\"\n [dialogType]=\"dialogType\"\n (closed)=\"dialogRef.close($event)\">\n</dialog-base>","import { Component, Inject } from '@angular/core';\nimport { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';\nimport { DialogBaseData } from '../../model/dialog-base-data';\nimport { DialogType } from '../../model/dialog-type';\n\n@Component({\n selector: 'dialog-input',\n templateUrl: './input.component.html',\n styleUrls: ['./input.component.css']\n})\nexport class InputComponent {\n dialogType = DialogType.Input;\n\n constructor(@Inject(MAT_DIALOG_DATA) public data: DialogBaseData,\n public dialogRef: MatDialogRef<InputComponent>) {\n }\n}\n","<dialog-base\n [data]=\"data\"\n [dialogType]=\"dialogType\"\n (closed)=\"dialogRef.close($event)\">\n</dialog-base>","import { Component, Inject } from '@angular/core';\nimport { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';\nimport { DialogBaseData } from '../../model/dialog-base-data';\nimport { DialogType } from '../../model/dialog-type';\n\n@Component({\n selector: 'dialog-message',\n templateUrl: './message.component.html',\n styleUrls: ['./message.component.css']\n})\nexport class MessageComponent {\n dialogType = DialogType.Message;\n\n constructor(@Inject(MAT_DIALOG_DATA) public data: DialogBaseData,\n public dialogRef: MatDialogRef<MessageComponent>) {\n }\n}\n","<dialog-base\n [data]=\"data\"\n [dialogType]=\"dialogType\"\n (closed)=\"dialogRef.close($event)\">\n</dialog-base>","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\n\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { MatDialogModule } from '@angular/material/dialog';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\n\nimport { BaseComponent } from './components/base/base.component';\nimport { ChoiceComponent } from './components/choice/choice.component';\nimport { ConfirmationComponent } from './components/confirmation/confirmation.component';\nimport { InputComponent } from './components/input/input.component';\nimport { MessageComponent } from './components/message/message.component';\n\n@NgModule({\n declarations: [\n BaseComponent,\n ChoiceComponent,\n ConfirmationComponent,\n InputComponent,\n MessageComponent\n ],\n imports: [\n CommonModule,\n FormsModule,\n\n MatButtonModule,\n MatCheckboxModule,\n MatDialogModule,\n MatFormFieldModule,\n MatInputModule\n ],\n exports: [\n BaseComponent,\n ChoiceComponent,\n ConfirmationComponent,\n InputComponent,\n MessageComponent\n ]\n})\nexport class DialogModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i5","i1","i2.BaseComponent"],"mappings":";;;;;;;;;;;;;;;;;IAAY,uBAKX;AALD,CAAA,UAAY,sBAAsB,EAAA;AAC9B,IAAA,sBAAA,CAAA,sBAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAQ,CAAA;AACR,IAAA,sBAAA,CAAA,sBAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAK,CAAA;AACL,IAAA,sBAAA,CAAA,sBAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAS,CAAA;AACT,IAAA,sBAAA,CAAA,sBAAA,CAAA,QAAA,CAAA,GAAA,CAA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wBACb,eAAe;wBACf,qBAAqB;wBACrB,cAAc;wBACd,gBAAgB;AACjB,qBAAA;AACF,iBAAA,CAAA;;;ACzCD;;AAEG;;;;"}
@@ -44,7 +44,10 @@ class SharepointService {
44
44
  this.http = http;
45
45
  this.cache = null;
46
46
  this.defaultCacheLifeMinutes = 720;
47
- this.config = this.config ?? defaultConfig;
47
+ this.config = {
48
+ ...defaultConfig,
49
+ ...this.config
50
+ };
48
51
  this.configureCaching();
49
52
  this.configureLogging();
50
53
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cleavelandprice-ngx-lib-sharepoint.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/sharepoint/src/model/service-config.ts","../../../../projects/cleavelandprice/ngx-lib/sharepoint/src/model/default-config.ts","../../../../projects/cleavelandprice/ngx-lib/sharepoint/src/services/sharepoint.service.ts","../../../../projects/cleavelandprice/ngx-lib/sharepoint/src/sharepoint.module.ts","../../../../projects/cleavelandprice/ngx-lib/sharepoint/src/cleavelandprice-ngx-lib-sharepoint.ts"],"sourcesContent":["import { CachingConfig } from \"./caching-config\";\r\nimport { LoggingConfig } from './logging-config';\r\n\r\nexport class ServiceConfig {\r\n apiUrl!: string;\r\n usersEndpoint!: string;\r\n listItemsEndpoint!: string;\r\n username!: string;\r\n password!: string;\r\n photos!: {\r\n site: string;\r\n list: string;\r\n additionalPropertiesToRetrieve?: string[];\r\n };\r\n caching?: CachingConfig;\r\n logging?: LoggingConfig;\r\n}\r\n","// This is the default configuration, which can be overridden by providing a ServiceConfig object to the module\r\nimport { ServiceConfig } from './service-config';\r\n\r\nexport const defaultConfig: ServiceConfig = {\r\n apiUrl: 'http://utilityapi',\r\n usersEndpoint: '/sharepoint/users',\r\n listItemsEndpoint: '/sharepoint/listitems',\r\n username: 'viewer',\r\n password: 'viewer',\r\n photos: {\r\n site: 'https://sharepoint.cleavelandprice.com/digitaldisplay',\r\n list: 'Employee Thumbnail Photos',\r\n additionalPropertiesToRetrieve: [\r\n 'EncodedAbsUrl'\r\n ]\r\n },\r\n caching: {\r\n enabled: true,\r\n lifeMinutes: 720\r\n },\r\n logging: {\r\n dataCached: true,\r\n cachedDataReturned: true,\r\n freshDataReturned: true,\r\n cacheCleared: true\r\n }\r\n};\r\n","//#region Imports\nimport { Injectable, Optional } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { Observable, of } from 'rxjs';\n\nimport { defaultConfig } from '../model/default-config';\n\nimport { CacheObject } from '../model/cache-object';\nimport { ListItem } from '../model/list-item';\nimport { ListItemsRequest } from '../model/list-items-request';\nimport { PhotoItem } from '../model/photo-item';\nimport { ServiceConfig } from '../model/service-config';\nimport { UserRequest } from '../model/user-request';\nimport { User } from '../model/user';\n\nimport moment from 'moment';\n//#endregion\n\n@Injectable({\n providedIn: 'root'\n})\nexport class SharepointService {\n private cache: {\n users: CacheObject<User> | null,\n photos: CacheObject<PhotoItem> | null\n } | null = null;\n\n private defaultCacheLifeMinutes = 720;\n\n //#region Utilities\n private cacheExpired<T>(cache: CacheObject<T>): boolean {\n if (!cache) {\n return true;\n }\n\n const lifeMinutes = this.config.caching?.lifeMinutes ?? this.defaultCacheLifeMinutes;\n const expiration = moment(cache.lastUpdate)\n .add(lifeMinutes, 'minutes');\n\n return moment().isAfter(expiration);\n }\n //#endregion\n\n //#region Initialization\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\n this.config = this.config ?? defaultConfig;\n\n this.configureCaching();\n this.configureLogging();\n }\n\n private configureCaching(): void {\n // If caching config is missing entirely, give it a default\n this.config.caching = this.config.caching ?? {\n enabled: false,\n lifeMinutes: this.defaultCacheLifeMinutes\n };\n\n this.cache = {\n photos: null,\n users: null\n };\n }\n\n private configureLogging(): void {\n // If logging config is missing entirely, give it a default\n this.config.logging = this.config.logging ?? {\n dataCached: false,\n cachedDataReturned: false,\n freshDataReturned: false,\n cacheCleared: false\n }\n }\n //#endregion\n\n getListItems(request: ListItemsRequest): Observable<ListItem[]> {\n const apiUrl = this.config?.apiUrl ?? defaultConfig.apiUrl;\n const endpoint = this.config?.listItemsEndpoint ?? defaultConfig.listItemsEndpoint;\n\n return this.http.post<ListItem[]>(`${apiUrl}${endpoint}`, request);\n }\n\n getPhotos(): Observable<PhotoItem[]> {\n const request: ListItemsRequest = {\n username: this.config?.username ?? defaultConfig.username,\n password: this.config?.password ?? defaultConfig.password,\n site: this.config?.photos.site ?? defaultConfig.photos.site,\n list: this.config?.photos.list ?? defaultConfig.photos.list,\n additionalPropertiesToRetrieve: defaultConfig.photos.additionalPropertiesToRetrieve\n };\n\n const observable$ = this.getListItems(request) as Observable<PhotoItem[]>;\n\n if (this.config.caching?.enabled) {\n if (this.cacheExpired<PhotoItem>(this.cache?.photos!)) {\n // Get the data and cache it\n observable$.subscribe(data => {\n this.cache!.photos = {\n data,\n lastUpdate: moment()\n };\n\n if (this.config.logging?.dataCached) {\n const lifeMinutes = this.config.caching?.lifeMinutes ?? this.defaultCacheLifeMinutes;\n console.log(`Photos cached for ${lifeMinutes} minutes`);\n }\n });\n } else {\n // Cache exists and hasn't expired yet\n if (this.config.logging?.cachedDataReturned) {\n console.log('Returning cached photos');\n }\n\n return of(this.cache!.photos!.data);\n }\n }\n\n // Cache is either disabled or expired, return data from API\n if (this.config.logging?.freshDataReturned) {\n console.log('Returning fresh photos');\n }\n\n return observable$;\n }\n\n getUsers(request: UserRequest, id?: number): Observable<User | User[]> {\n const apiUrl = this.config?.apiUrl ?? defaultConfig.apiUrl;\n const endpoint = this.config?.usersEndpoint ?? defaultConfig.usersEndpoint;\n \n const observable$ = this.http.post<User | User[]>(`${apiUrl}${endpoint}/${id ?? ''}`, request);\n\n //#region Single user\n if (id) {\n return observable$;\n }\n //#endregion\n\n //#region Multiple users\n if (this.config.caching?.enabled) {\n if (this.cacheExpired<User>(this.cache!.users!)) {\n // Get the data and cache it\n observable$.subscribe(data => {\n this.cache!.users = {\n data: data as User[],\n lastUpdate: moment()\n };\n\n if (this.config.logging?.dataCached) {\n const lifeMinutes = this.config.caching?.lifeMinutes ?? this.defaultCacheLifeMinutes;\n console.log(`Users cached for ${lifeMinutes} minutes`);\n }\n });\n } else {\n // Cache exists and hasn't expired yet\n if (this.config.logging?.cachedDataReturned) {\n console.log('Returning cached users');\n }\n\n return of(this.cache!.users!.data);\n }\n }\n\n // Cache is either disabled or expired, return data from API\n if (this.config.logging?.freshDataReturned) {\n console.log('Returning fresh users');\n }\n\n return observable$;\n //#endregion\n }\n\n clearCache(): void {\n this.cache = null;\n\n if (this.config.logging?.cacheCleared) {\n console.log('Cache cleared');\n }\n }\n}","import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ServiceConfig } from './model/service-config';\nimport { SharepointService } from './services/sharepoint.service';\n\n@NgModule({\n declarations: [],\n imports: [\n CommonModule\n ]\n})\nexport class SharepointModule {\n static forRoot(config: ServiceConfig): ModuleWithProviders<SharepointModule> {\n return {\n ngModule: SharepointModule,\n providers: [\n SharepointService,\n { provide: ServiceConfig, useValue: config }\n ]\n };\n }\n\n constructor( @Optional() @SkipSelf() parentModule: SharepointModule) {\n if (parentModule) {\n throw new Error(\n 'SharepointModule is already loaded. Import it in the AppModule only');\n }\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1.ServiceConfig"],"mappings":";;;;;;;MAGa,aAAa,CAAA;AAazB;;ACbM,MAAM,aAAa,GAAkB;AACxC,IAAA,MAAM,EAAE,mBAAmB;AAC3B,IAAA,aAAa,EAAE,mBAAmB;AAClC,IAAA,iBAAiB,EAAE,uBAAuB;AAC1C,IAAA,QAAQ,EAAE,QAAQ;AAClB,IAAA,QAAQ,EAAE,QAAQ;AAClB,IAAA,MAAM,EAAE;AACJ,QAAA,IAAI,EAAE,uDAAuD;AAC7D,QAAA,IAAI,EAAE,2BAA2B;AACjC,QAAA,8BAA8B,EAAE;YAC5B,eAAe;A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,EAAE,QAAQ,EAAE,MAAM,EAAE;AAC7C,aAAA;SACF,CAAC;KACH;;AATU,gBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,kBAWwB,gBAAgB,EAAA,QAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAXxD,gBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,YAHzB,YAAY,CAAA,EAAA,CAAA,CAAA;AAGH,gBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,YAHzB,YAAY,CAAA,EAAA,CAAA,CAAA;2FAGH,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAN5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;AACF,iBAAA,CAAA;0DAYoD,gBAAgB,EAAA,UAAA,EAAA,CAAA;0BAArD,QAAQ;;0BAAI,QAAQ;;;ACtBpC;;AAEG;;;;"}
1
+ {"version":3,"file":"cleavelandprice-ngx-lib-sharepoint.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/sharepoint/src/model/service-config.ts","../../../../projects/cleavelandprice/ngx-lib/sharepoint/src/model/default-config.ts","../../../../projects/cleavelandprice/ngx-lib/sharepoint/src/services/sharepoint.service.ts","../../../../projects/cleavelandprice/ngx-lib/sharepoint/src/sharepoint.module.ts","../../../../projects/cleavelandprice/ngx-lib/sharepoint/src/cleavelandprice-ngx-lib-sharepoint.ts"],"sourcesContent":["import { CachingConfig } from \"./caching-config\";\r\nimport { LoggingConfig } from './logging-config';\r\n\r\nexport class ServiceConfig {\r\n apiUrl!: string;\r\n usersEndpoint!: string;\r\n listItemsEndpoint!: string;\r\n username!: string;\r\n password!: string;\r\n photos!: {\r\n site: string;\r\n list: string;\r\n additionalPropertiesToRetrieve?: string[];\r\n };\r\n caching?: CachingConfig;\r\n logging?: LoggingConfig;\r\n}\r\n","// This is the default configuration, which can be overridden by providing a ServiceConfig object to the module\r\nimport { ServiceConfig } from './service-config';\r\n\r\nexport const defaultConfig: ServiceConfig = {\r\n apiUrl: 'http://utilityapi',\r\n usersEndpoint: '/sharepoint/users',\r\n listItemsEndpoint: '/sharepoint/listitems',\r\n username: 'viewer',\r\n password: 'viewer',\r\n photos: {\r\n site: 'https://sharepoint.cleavelandprice.com/digitaldisplay',\r\n list: 'Employee Thumbnail Photos',\r\n additionalPropertiesToRetrieve: [\r\n 'EncodedAbsUrl'\r\n ]\r\n },\r\n caching: {\r\n enabled: true,\r\n lifeMinutes: 720\r\n },\r\n logging: {\r\n dataCached: true,\r\n cachedDataReturned: true,\r\n freshDataReturned: true,\r\n cacheCleared: true\r\n }\r\n};\r\n","//#region Imports\nimport { Injectable, Optional } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { Observable, of } from 'rxjs';\n\nimport { defaultConfig } from '../model/default-config';\n\nimport { CacheObject } from '../model/cache-object';\nimport { ListItem } from '../model/list-item';\nimport { ListItemsRequest } from '../model/list-items-request';\nimport { PhotoItem } from '../model/photo-item';\nimport { ServiceConfig } from '../model/service-config';\nimport { UserRequest } from '../model/user-request';\nimport { User } from '../model/user';\n\nimport moment from 'moment';\n//#endregion\n\n@Injectable({\n providedIn: 'root'\n})\nexport class SharepointService {\n private cache: {\n users: CacheObject<User> | null,\n photos: CacheObject<PhotoItem> | null\n } | null = null;\n\n private defaultCacheLifeMinutes = 720;\n\n //#region Utilities\n private cacheExpired<T>(cache: CacheObject<T>): boolean {\n if (!cache) {\n return true;\n }\n\n const lifeMinutes = this.config.caching?.lifeMinutes ?? this.defaultCacheLifeMinutes;\n const expiration = moment(cache.lastUpdate)\n .add(lifeMinutes, 'minutes');\n\n return moment().isAfter(expiration);\n }\n //#endregion\n\n //#region Initialization\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\n this.config = {\n ...defaultConfig,\n ...this.config\n };\n\n this.configureCaching();\n this.configureLogging();\n }\n\n private configureCaching(): void {\n // If caching config is missing entirely, give it a default\n this.config.caching = this.config.caching ?? {\n enabled: false,\n lifeMinutes: this.defaultCacheLifeMinutes\n };\n\n this.cache = {\n photos: null,\n users: null\n };\n }\n\n private configureLogging(): void {\n // If logging config is missing entirely, give it a default\n this.config.logging = this.config.logging ?? {\n dataCached: false,\n cachedDataReturned: false,\n freshDataReturned: false,\n cacheCleared: false\n }\n }\n //#endregion\n\n getListItems(request: ListItemsRequest): Observable<ListItem[]> {\n const apiUrl = this.config?.apiUrl ?? defaultConfig.apiUrl;\n const endpoint = this.config?.listItemsEndpoint ?? defaultConfig.listItemsEndpoint;\n\n return this.http.post<ListItem[]>(`${apiUrl}${endpoint}`, request);\n }\n\n getPhotos(): Observable<PhotoItem[]> {\n const request: ListItemsRequest = {\n username: this.config?.username ?? defaultConfig.username,\n password: this.config?.password ?? defaultConfig.password,\n site: this.config?.photos.site ?? defaultConfig.photos.site,\n list: this.config?.photos.list ?? defaultConfig.photos.list,\n additionalPropertiesToRetrieve: defaultConfig.photos.additionalPropertiesToRetrieve\n };\n\n const observable$ = this.getListItems(request) as Observable<PhotoItem[]>;\n\n if (this.config.caching?.enabled) {\n if (this.cacheExpired<PhotoItem>(this.cache?.photos!)) {\n // Get the data and cache it\n observable$.subscribe(data => {\n this.cache!.photos = {\n data,\n lastUpdate: moment()\n };\n\n if (this.config.logging?.dataCached) {\n const lifeMinutes = this.config.caching?.lifeMinutes ?? this.defaultCacheLifeMinutes;\n console.log(`Photos cached for ${lifeMinutes} minutes`);\n }\n });\n } else {\n // Cache exists and hasn't expired yet\n if (this.config.logging?.cachedDataReturned) {\n console.log('Returning cached photos');\n }\n\n return of(this.cache!.photos!.data);\n }\n }\n\n // Cache is either disabled or expired, return data from API\n if (this.config.logging?.freshDataReturned) {\n console.log('Returning fresh photos');\n }\n\n return observable$;\n }\n\n getUsers(request: UserRequest, id?: number): Observable<User | User[]> {\n const apiUrl = this.config?.apiUrl ?? defaultConfig.apiUrl;\n const endpoint = this.config?.usersEndpoint ?? defaultConfig.usersEndpoint;\n \n const observable$ = this.http.post<User | User[]>(`${apiUrl}${endpoint}/${id ?? ''}`, request);\n\n //#region Single user\n if (id) {\n return observable$;\n }\n //#endregion\n\n //#region Multiple users\n if (this.config.caching?.enabled) {\n if (this.cacheExpired<User>(this.cache!.users!)) {\n // Get the data and cache it\n observable$.subscribe(data => {\n this.cache!.users = {\n data: data as User[],\n lastUpdate: moment()\n };\n\n if (this.config.logging?.dataCached) {\n const lifeMinutes = this.config.caching?.lifeMinutes ?? this.defaultCacheLifeMinutes;\n console.log(`Users cached for ${lifeMinutes} minutes`);\n }\n });\n } else {\n // Cache exists and hasn't expired yet\n if (this.config.logging?.cachedDataReturned) {\n console.log('Returning cached users');\n }\n\n return of(this.cache!.users!.data);\n }\n }\n\n // Cache is either disabled or expired, return data from API\n if (this.config.logging?.freshDataReturned) {\n console.log('Returning fresh users');\n }\n\n return observable$;\n //#endregion\n }\n\n clearCache(): void {\n this.cache = null;\n\n if (this.config.logging?.cacheCleared) {\n console.log('Cache cleared');\n }\n }\n}","import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ServiceConfig } from './model/service-config';\nimport { SharepointService } from './services/sharepoint.service';\n\n@NgModule({\n declarations: [],\n imports: [\n CommonModule\n ]\n})\nexport class SharepointModule {\n static forRoot(config: ServiceConfig): ModuleWithProviders<SharepointModule> {\n return {\n ngModule: SharepointModule,\n providers: [\n SharepointService,\n { provide: ServiceConfig, useValue: config }\n ]\n };\n }\n\n constructor( @Optional() @SkipSelf() parentModule: SharepointModule) {\n if (parentModule) {\n throw new Error(\n 'SharepointModule is already loaded. Import it in the AppModule only');\n }\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1.ServiceConfig"],"mappings":";;;;;;;MAGa,aAAa,CAAA;AAazB;;ACbM,MAAM,aAAa,GAAkB;AACxC,IAAA,MAAM,EAAE,mBAAmB;AAC3B,IAAA,aAAa,EAAE,mBAAmB;AAClC,IAAA,iBAAiB,EAAE,uBAAuB;AAC1C,IAAA,QAAQ,EAAE,QAAQ;AAClB,IAAA,QAAQ,EAAE,QAAQ;AAClB,IAAA,MAAM,EAAE;AACJ,QAAA,IAAI,EAAE,uDAAuD;AAC7D,QAAA,IAAI,EAAE,2BAA2B;AACjC,QAAA,8BAA8B,EAAE;YAC5B,eAAe;AAClB,SAAA;AACJ,KAAA;AACD,IAAA,OAAO,EAAE;AACL,QAAA,OAAO,EAAE,IAAI;AACb,QAAA,WAAW,EAAE,GAAG;AACnB,KAAA;AACD,IAAA,OAAO,EAAE;AACL,QAAA,UAAU,EAAE,IAAI;AAChB,QAAA,kBAAkB,EAAE,IAAI;AACxB,QAAA,iBAAiB,EAAE,IAAI;AACvB,QAAA,YAAY,EAAE,IAAI;AACrB,KAAA;CACJ;;AC1BD;AAgBA;MAKa,iBAAiB,CAAA;;;;IAwB5B,WAAgC,CAAA,MAAqB,EACjC,IAAgB,EAAA;QADJ,IAAM,CAAA,MAAA,GAAN,MAAM,CAAe;QACjC,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAY;QAxB5B,IAAK,CAAA,KAAA,GAGF,IAAI,CAAC;QAER,IAAuB,CAAA,uBAAA,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,IAAA,EAAA,gBAAgB,YAHzB,YAAY,CAAA,EAAA,CAAA,CAAA;AAGH,gBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,YAHzB,YAAY,CAAA,EAAA,CAAA,CAAA;2FAGH,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAN5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;AACF,iBAAA,CAAA;0DAYoD,gBAAgB,EAAA,UAAA,EAAA,CAAA;0BAArD,QAAQ;;0BAAI,QAAQ;;;ACtBpC;;AAEG;;;;"}
@@ -4,7 +4,7 @@ import { Subject, forkJoin } from 'rxjs';
4
4
  import * as i1$1 from '@angular/material/dialog';
5
5
  import { MatDialogModule } from '@angular/material/dialog';
6
6
  import * as i1 from '@angular/common/http';
7
- import { HttpRequest, HttpHeaders, HttpEventType, HttpResponse } from '@angular/common/http';
7
+ import { HttpHeaders, HttpRequest, HttpEventType, HttpResponse } from '@angular/common/http';
8
8
  import * as i3 from '@angular/common';
9
9
  import { CommonModule } from '@angular/common';
10
10
  import * as i4 from '@angular/material/list';
@@ -14,24 +14,44 @@ import * as i6 from '@angular/material/progress-bar';
14
14
  import { MatProgressBarModule } from '@angular/material/progress-bar';
15
15
 
16
16
  class ServiceConfig {
17
+ constructor() {
18
+ this.uploadPath = null;
19
+ this.dbAppId = null;
20
+ this.externalReferenceId = null;
21
+ this.comment = null;
22
+ // UI configuration
23
+ this.uploadButtonText = null;
24
+ this.uploadDialogTitle = null;
25
+ this.uploadDialogAddFilesButtonText = null;
26
+ this.uploadDialogCancelButtonText = null;
27
+ this.uploadDialogUploadButtonText = null;
28
+ this.uploadDialogFinishButtonText = null;
29
+ }
17
30
  }
18
31
 
32
+ const defaultConfig = {
33
+ apiUrl: 'http://utilityapi/upload/database',
34
+ uploadDialogTitle: 'Upload Files',
35
+ uploadPath: null,
36
+ comment: null,
37
+ dbAppId: null,
38
+ externalReferenceId: null,
39
+ uploadButtonText: 'Upload',
40
+ uploadDialogCancelButtonText: 'Cancel',
41
+ uploadDialogFinishButtonText: 'Finish',
42
+ uploadDialogUploadButtonText: 'Upload',
43
+ uploadDialogAddFilesButtonText: 'Add Files'
44
+ };
45
+
19
46
  // https://malcoded.com/posts/angular-file-upload-component-with-express
20
47
  class UploadService {
21
48
  constructor(http, config) {
22
49
  this.http = http;
23
- this.uploadApiUrl = config.apiUrl;
24
- this.uploadPath = config.uploadPath || '';
25
- this.dbAppId = config.dbAppId || '';
26
- this.externalReferenceId = config.externalReferenceId || '';
27
- this.comment = config.comment || '';
28
- // UI configuration
29
- this.uploadButtonText = config.uploadButtonText ?? '';
30
- this.uploadDialogTitle = config.uploadDialogTitle ?? '';
31
- this.uploadDialogAddFilesButtonText = config.uploadDialogAddFilesButtonText ?? '';
32
- this.uploadDialogCancelButtonText = config.uploadDialogCancelButtonText ?? '';
33
- this.uploadDialogUploadButtonText = config.uploadDialogUploadButtonText ?? '';
34
- this.uploadDialogFinishButtonText = config.uploadDialogFinishButtonText ?? '';
50
+ this.config = config;
51
+ this.config = {
52
+ ...defaultConfig,
53
+ ...this.config
54
+ };
35
55
  }
36
56
  upload(files) {
37
57
  // this will be the our resulting map
@@ -44,19 +64,23 @@ class UploadService {
44
64
  // tell it to report the upload progress
45
65
  // A 'Destination' header is used to optionally configure the file upload destination (filesystem)
46
66
  // A 'DbAppId' header is used to configure the unique identifier of database uploads
47
- const req = new HttpRequest('POST', this.uploadApiUrl, formData, {
67
+ const headers = new HttpHeaders();
68
+ if (this.config.uploadPath) {
69
+ headers.append('Destination', this.config.uploadPath);
70
+ }
71
+ if (this.config.dbAppId) {
72
+ headers.append('DbAppId', this.config.dbAppId);
73
+ }
74
+ if (this.config.externalReferenceId) {
75
+ headers.append('ExternalReferenceId', this.config.externalReferenceId);
76
+ }
77
+ if (this.config.comment) {
78
+ headers.append('Comment', this.config.comment);
79
+ }
80
+ const req = new HttpRequest('POST', this.config.apiUrl, formData, {
48
81
  reportProgress: true,
49
82
  responseType: 'blob',
50
- headers: new HttpHeaders()
51
- .set('Destination', this.uploadPath)
52
- .set('DbAppId', this.dbAppId)
53
- .set('ExternalReferenceId', this.externalReferenceId)
54
- .set('Comment', this.comment)
55
- /*headers: this.uploadPath ?
56
- new HttpHeaders({ 'Destination': this.uploadPath }) :
57
- this.dbAppId ?
58
- new HttpHeaders({ 'DbAppId': this.dbAppId }) :
59
- null*/
83
+ headers
60
84
  });
61
85
  // create a new progress-subject for every file
62
86
  const progress = new Subject();
@@ -83,16 +107,16 @@ class UploadService {
83
107
  return status;
84
108
  }
85
109
  exists(fileName) {
86
- const query = this.uploadApiUrl.toLowerCase().indexOf('filesystem') === -1 ?
87
- { name: fileName, dbAppId: this.dbAppId } :
88
- { name: fileName, destination: this.uploadPath };
89
- return this.http.post(`${this.uploadApiUrl}/exists`, query);
110
+ const query = this.config.apiUrl.toLowerCase().indexOf('filesystem') === -1 ?
111
+ { name: fileName, dbAppId: this.config.dbAppId } :
112
+ { name: fileName, destination: this.config.uploadPath };
113
+ return this.http.post(`${this.config.apiUrl}/exists`, query);
90
114
  }
91
115
  download(request) {
92
- return this.http.post(`${this.uploadApiUrl}/stream`, request, { responseType: 'blob' });
116
+ return this.http.post(`${this.config.apiUrl}/stream`, request, { responseType: 'blob' });
93
117
  }
94
118
  getUploadInfo(request) {
95
- return this.http.post(`${this.uploadApiUrl}/info`, request);
119
+ return this.http.post(`${this.config.apiUrl}/info`, request);
96
120
  }
97
121
  }
98
122
  UploadService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: UploadService, deps: [{ token: i1.HttpClient }, { token: ServiceConfig, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -110,17 +134,13 @@ class UploadDialogComponent {
110
134
  this.files = new Set();
111
135
  this.existingFileConflict = null;
112
136
  this.canBeClosed = true;
137
+ this.primaryButtonText = null;
113
138
  this.showCancelButton = true;
114
139
  this.uploading = false;
115
140
  this.uploadSuccessful = false;
116
141
  }
117
142
  ngOnInit() {
118
- this.uploadDialogTitle = this.uploadService.uploadDialogTitle ?? 'Upload Files';
119
- this.uploadDialogAddFilesButtonText = this.uploadService.uploadDialogAddFilesButtonText ?? 'Add Files';
120
- this.uploadDialogCancelButtonText = this.uploadService.uploadDialogCancelButtonText ?? 'Cancel';
121
- this.uploadDialogUploadButtonText = this.uploadService.uploadDialogUploadButtonText ?? 'Upload';
122
- this.uploadDialogFinishButtonText = this.uploadService.uploadDialogFinishButtonText ?? 'Finish';
123
- this.primaryButtonText = this.uploadDialogUploadButtonText;
143
+ this.primaryButtonText = this.uploadService.config.uploadDialogUploadButtonText;
124
144
  }
125
145
  addFiles() {
126
146
  this.file.nativeElement.click();
@@ -158,7 +178,7 @@ class UploadDialogComponent {
158
178
  }
159
179
  // Adjust the state variables
160
180
  // The OK-button should have the text "Finish" now
161
- this.primaryButtonText = this.uploadDialogFinishButtonText;
181
+ this.primaryButtonText = this.uploadService.config.uploadDialogFinishButtonText;
162
182
  // The dialog should not be closed while uploading
163
183
  this.canBeClosed = false;
164
184
  this.dialogRef.disableClose = true;
@@ -177,10 +197,10 @@ class UploadDialogComponent {
177
197
  }
178
198
  }
179
199
  UploadDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: UploadDialogComponent, deps: [{ token: i1$1.MatDialogRef }, { token: UploadService }], target: i0.ɵɵFactoryTarget.Component });
180
- UploadDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: UploadDialogComponent, selector: "cp-upload-dialog", viewQueries: [{ propertyName: "file", first: true, predicate: ["file"], descendants: true, static: true }], ngImport: i0, 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", styles: ["#title{display:flex;justify-content:space-between}#actions{display:flex;justify-content:flex-end}#conflict{font-size:.8em;color:red;margin-top:.5em}\n"], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { 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: i4.MatList, selector: "mat-list, mat-action-list", inputs: ["disableRipple", "disabled"], exportAs: ["matList"] }, { kind: "component", type: i4.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["disableRipple", "disabled"], exportAs: ["matListItem"] }, { kind: "directive", type: i5.MatLine, selector: "[mat-line], [matLine]" }, { kind: "component", type: i6.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }] });
200
+ UploadDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: UploadDialogComponent, selector: "cp-upload-dialog", viewQueries: [{ propertyName: "file", first: true, predicate: ["file"], descendants: true, static: true }], ngImport: i0, template: "<input type=\"file\" #file style=\"display: none\" (change)=\"onFilesAdded()\" multiple />\n\n<div mat-dialog-title id=\"title\">\n <div>{{ uploadService.config.uploadDialogTitle }}</div>\n <button [disabled]=\"uploading || uploadSuccessful\" mat-raised-button color=\"primary\" class=\"add-files-btn\" (click)=\"addFiles()\">\n {{ uploadService.config.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>{{ uploadService.config.uploadDialogCancelButtonText }}</button>\n <button *ngIf=\"files.size > 0\" mat-raised-button color=\"primary\" [disabled]=\"!canBeClosed\" (click)=\"closeDialog()\">{{ primaryButtonText }}</button>\n</mat-dialog-actions>\n", styles: ["#title{display:flex;justify-content:space-between}#actions{display:flex;justify-content:flex-end}#conflict{font-size:.8em;color:red;margin-top:.5em}\n"], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { 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: i4.MatList, selector: "mat-list, mat-action-list", inputs: ["disableRipple", "disabled"], exportAs: ["matList"] }, { kind: "component", type: i4.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["disableRipple", "disabled"], exportAs: ["matListItem"] }, { kind: "directive", type: i5.MatLine, selector: "[mat-line], [matLine]" }, { kind: "component", type: i6.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }] });
181
201
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: UploadDialogComponent, decorators: [{
182
202
  type: Component,
183
- args: [{ selector: 'cp-upload-dialog', 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", styles: ["#title{display:flex;justify-content:space-between}#actions{display:flex;justify-content:flex-end}#conflict{font-size:.8em;color:red;margin-top:.5em}\n"] }]
203
+ args: [{ selector: 'cp-upload-dialog', template: "<input type=\"file\" #file style=\"display: none\" (change)=\"onFilesAdded()\" multiple />\n\n<div mat-dialog-title id=\"title\">\n <div>{{ uploadService.config.uploadDialogTitle }}</div>\n <button [disabled]=\"uploading || uploadSuccessful\" mat-raised-button color=\"primary\" class=\"add-files-btn\" (click)=\"addFiles()\">\n {{ uploadService.config.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>{{ uploadService.config.uploadDialogCancelButtonText }}</button>\n <button *ngIf=\"files.size > 0\" mat-raised-button color=\"primary\" [disabled]=\"!canBeClosed\" (click)=\"closeDialog()\">{{ primaryButtonText }}</button>\n</mat-dialog-actions>\n", styles: ["#title{display:flex;justify-content:space-between}#actions{display:flex;justify-content:flex-end}#conflict{font-size:.8em;color:red;margin-top:.5em}\n"] }]
184
204
  }], ctorParameters: function () { return [{ type: i1$1.MatDialogRef }, { type: UploadService }]; }, propDecorators: { file: [{
185
205
  type: ViewChild,
186
206
  args: ['file', { static: true }]
@@ -193,8 +213,8 @@ class UploadComponent {
193
213
  this.dialogClosed = new EventEmitter();
194
214
  }
195
215
  ngOnInit() {
196
- this.uploadButtonText = this.uploadService.uploadButtonText ?
197
- this.uploadService.uploadButtonText :
216
+ this.uploadButtonText = this.uploadService.config.uploadButtonText ?
217
+ this.uploadService.config.uploadButtonText :
198
218
  'Upload';
199
219
  }
200
220
  openUploadDialog() {