@meshmakers/shared-ui 3.1.147-0 → 3.1.148-0

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, Inject, EventEmitter, forwardRef, HostBinding, ViewChild, Input, NgModule, Injectable } from '@angular/core';
2
+ import { Component, Inject, EventEmitter, forwardRef, HostBinding, ViewChild, Input, Injectable, signal, NgModule } from '@angular/core';
3
3
  import * as i2$1 from '@angular/common';
4
4
  import { CommonModule } from '@angular/common';
5
5
  import * as i1 from '@angular/material/dialog';
@@ -11,14 +11,15 @@ import { IsoDateTime } from '@meshmakers/shared-services';
11
11
  import * as i3 from '@angular/material/toolbar';
12
12
  import { MatToolbarModule } from '@angular/material/toolbar';
13
13
  import * as i5 from '@angular/material/icon';
14
- import { MatIconModule } from '@angular/material/icon';
14
+ import { MatIconModule, MatIcon } from '@angular/material/icon';
15
+ import * as i2$2 from '@angular/material/snack-bar';
15
16
  import { MatSnackBarModule } from '@angular/material/snack-bar';
16
17
  import { MatFormFieldControl } from '@angular/material/form-field';
17
18
  import * as i7 from '@angular/forms';
18
19
  import { FormControl, NgControl, NG_VALUE_ACCESSOR, NG_VALIDATORS, ReactiveFormsModule, Validators } from '@angular/forms';
19
20
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
20
21
  import { debounceTime, filter, tap, map, switchMap } from 'rxjs/operators';
21
- import { Subject, of, BehaviorSubject } from 'rxjs';
22
+ import { Subject, of, BehaviorSubject, firstValueFrom } from 'rxjs';
22
23
  import * as i1$2 from '@angular/cdk/a11y';
23
24
  import * as i3$1 from '@angular/material/autocomplete';
24
25
  import { MatAutocompleteModule } from '@angular/material/autocomplete';
@@ -79,11 +80,11 @@ class MmNotificationBarComponent {
79
80
  });
80
81
  }
81
82
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: MmNotificationBarComponent, deps: [{ token: i1$1.MessageService }, { token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
82
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.3", type: MmNotificationBarComponent, selector: "mm-notification-bar", ngImport: i0, template: "<mat-toolbar [hidden]=\"!errorMessage\" class=\"mm-notification-bar-background\">\n <a (click)=\"onShowDetails()\"><span class=\"mat-small\"><u>{{ errorMessage?.title }}</u></span></a>\n\n <!-- This fills the remaining space of the current row -->\n <span class=\"notification-fill-remaining-space\"></span>\n\n <button (click)=\"onHide()\" class=\"mm-notification-bar-button\" mat-fab><mat-icon>close</mat-icon></button>\n</mat-toolbar>\n", styles: [".notification-fill-remaining-space{flex:1 1 auto}\n"], dependencies: [{ kind: "component", type: i3.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "component", type: i2.MatFabButton, selector: "button[mat-fab]", inputs: ["extended"], exportAs: ["matButton"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
83
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.3", type: MmNotificationBarComponent, selector: "mm-notification-bar", ngImport: i0, template: "<mat-toolbar [hidden]=\"!errorMessage\" class=\"mm-notification-bar-background\">\n <a (click)=\"onShowDetails()\"><span class=\"mat-small\"><u>{{ errorMessage?.title }}</u></span></a>\n\n <!-- This fills the remaining space of the current row -->\n <span class=\"notification-fill-remaining-space\"></span>\n\n <button (click)=\"onHide()\" class=\"mm-notification-bar-button\" mat-fab><mat-icon class=\"material-symbols-outlined\">close</mat-icon></button>\n</mat-toolbar>\n", styles: [".notification-fill-remaining-space{flex:1 1 auto}\n"], dependencies: [{ kind: "component", type: i3.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "component", type: i2.MatFabButton, selector: "button[mat-fab]", inputs: ["extended"], exportAs: ["matButton"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
83
84
  }
84
85
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: MmNotificationBarComponent, decorators: [{
85
86
  type: Component,
86
- args: [{ selector: 'mm-notification-bar', template: "<mat-toolbar [hidden]=\"!errorMessage\" class=\"mm-notification-bar-background\">\n <a (click)=\"onShowDetails()\"><span class=\"mat-small\"><u>{{ errorMessage?.title }}</u></span></a>\n\n <!-- This fills the remaining space of the current row -->\n <span class=\"notification-fill-remaining-space\"></span>\n\n <button (click)=\"onHide()\" class=\"mm-notification-bar-button\" mat-fab><mat-icon>close</mat-icon></button>\n</mat-toolbar>\n", styles: [".notification-fill-remaining-space{flex:1 1 auto}\n"] }]
87
+ args: [{ selector: 'mm-notification-bar', template: "<mat-toolbar [hidden]=\"!errorMessage\" class=\"mm-notification-bar-background\">\n <a (click)=\"onShowDetails()\"><span class=\"mat-small\"><u>{{ errorMessage?.title }}</u></span></a>\n\n <!-- This fills the remaining space of the current row -->\n <span class=\"notification-fill-remaining-space\"></span>\n\n <button (click)=\"onHide()\" class=\"mm-notification-bar-button\" mat-fab><mat-icon class=\"material-symbols-outlined\">close</mat-icon></button>\n</mat-toolbar>\n", styles: [".notification-fill-remaining-space{flex:1 1 auto}\n"] }]
87
88
  }], ctorParameters: () => [{ type: i1$1.MessageService }, { type: i1.MatDialog }] });
88
89
 
89
90
  class MmAutocompleteInputComponent {
@@ -906,7 +907,7 @@ class MmMultipleEntitySelectInputComponent {
906
907
  useExisting: forwardRef(() => MmMultipleEntitySelectInputComponent),
907
908
  multi: true
908
909
  }
909
- ], viewQueries: [{ propertyName: "inputField", first: true, predicate: ["input"], descendants: true }], ngImport: i0, template: "<mat-chip-grid #list>\n <mat-chip-row *ngFor=\"let entity of valuesFormControl.value\"\n (removed)=\"remove(entity)\"\n [editable]=\"false\"\n [aria-description]=\"'press enter to edit ' + dataSource?.onDisplayEntity(entity) ?? null\">\n {{dataSource?.onDisplayEntity(entity) ?? null}}\n <button matChipRemove [attr.aria-label]=\"'remove ' + dataSource?.onDisplayEntity(entity) ?? null\">\n <mat-icon>cancel</mat-icon>\n </button>\n </mat-chip-row>\n <input #input (blur)=\"onTouched()\" (focusout)=\"onFocusOut()\" [formControl]=\"searchFormControl\"\n [matAutocomplete]=\"auto\"\n [matChipInputFor]=\"list\"\n matChipInputAddOnBlur=\"true\"\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\n [placeholder]=\"placeholder\" matInput>\n <mat-autocomplete #auto=\"matAutocomplete\" (closed)=\"onEntityClosed()\"\n (optionActivated)=\"onEntityActivated($event)\" (optionSelected)=\"onEntitySelected($event)\"\n [displayWith]=\"dataSource?.onDisplayEntity ?? null\">\n <mat-option *ngIf=\"isLoading\" class=\"is-loading\">\n <mat-spinner diameter=\"50\"></mat-spinner>\n </mat-option>\n <ng-container *ngIf=\"!isLoading\">\n <mat-option *ngFor=\"let entity of filteredEntities\" [value]=\"entity\">\n {{dataSource?.onDisplayEntity(entity) ?? null}}\n </mat-option>\n </ng-container>\n </mat-autocomplete>\n</mat-chip-grid>\n", styles: [""], dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$1.MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i4.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i3$1.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "directive", type: i5$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i6.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: i7$1.MatChipGrid, selector: "mat-chip-grid", inputs: ["disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "directive", type: i7$1.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: i7$1.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i7$1.MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["editable"], outputs: ["edited"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i7.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: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] });
910
+ ], viewQueries: [{ propertyName: "inputField", first: true, predicate: ["input"], descendants: true }], ngImport: i0, template: "<mat-chip-grid #list>\n <mat-chip-row *ngFor=\"let entity of valuesFormControl.value\"\n (removed)=\"remove(entity)\"\n [editable]=\"false\"\n [aria-description]=\"'press enter to edit ' + dataSource?.onDisplayEntity(entity) ?? null\">\n {{dataSource?.onDisplayEntity(entity) ?? null}}\n <button matChipRemove [attr.aria-label]=\"'remove ' + dataSource?.onDisplayEntity(entity) ?? null\">\n <mat-icon class=\"material-symbols-outlined\">cancel</mat-icon>\n </button>\n </mat-chip-row>\n <input #input (blur)=\"onTouched()\" (focusout)=\"onFocusOut()\" [formControl]=\"searchFormControl\"\n [matAutocomplete]=\"auto\"\n [matChipInputFor]=\"list\"\n matChipInputAddOnBlur=\"true\"\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\n [placeholder]=\"placeholder\" matInput>\n <mat-autocomplete #auto=\"matAutocomplete\" (closed)=\"onEntityClosed()\"\n (optionActivated)=\"onEntityActivated($event)\" (optionSelected)=\"onEntitySelected($event)\"\n [displayWith]=\"dataSource?.onDisplayEntity ?? null\">\n <mat-option *ngIf=\"isLoading\" class=\"is-loading\">\n <mat-spinner diameter=\"50\"></mat-spinner>\n </mat-option>\n <ng-container *ngIf=\"!isLoading\">\n <mat-option *ngFor=\"let entity of filteredEntities\" [value]=\"entity\">\n {{dataSource?.onDisplayEntity(entity) ?? null}}\n </mat-option>\n </ng-container>\n </mat-autocomplete>\n</mat-chip-grid>\n", styles: [""], dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$1.MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i4.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i3$1.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "directive", type: i5$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i6.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: i7$1.MatChipGrid, selector: "mat-chip-grid", inputs: ["disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "directive", type: i7$1.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: i7$1.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i7$1.MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["editable"], outputs: ["edited"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i7.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: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] });
910
911
  }
911
912
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: MmMultipleEntitySelectInputComponent, decorators: [{
912
913
  type: Component,
@@ -928,7 +929,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.3", ngImpor
928
929
  useExisting: forwardRef(() => MmMultipleEntitySelectInputComponent),
929
930
  multi: true
930
931
  }
931
- ], template: "<mat-chip-grid #list>\n <mat-chip-row *ngFor=\"let entity of valuesFormControl.value\"\n (removed)=\"remove(entity)\"\n [editable]=\"false\"\n [aria-description]=\"'press enter to edit ' + dataSource?.onDisplayEntity(entity) ?? null\">\n {{dataSource?.onDisplayEntity(entity) ?? null}}\n <button matChipRemove [attr.aria-label]=\"'remove ' + dataSource?.onDisplayEntity(entity) ?? null\">\n <mat-icon>cancel</mat-icon>\n </button>\n </mat-chip-row>\n <input #input (blur)=\"onTouched()\" (focusout)=\"onFocusOut()\" [formControl]=\"searchFormControl\"\n [matAutocomplete]=\"auto\"\n [matChipInputFor]=\"list\"\n matChipInputAddOnBlur=\"true\"\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\n [placeholder]=\"placeholder\" matInput>\n <mat-autocomplete #auto=\"matAutocomplete\" (closed)=\"onEntityClosed()\"\n (optionActivated)=\"onEntityActivated($event)\" (optionSelected)=\"onEntitySelected($event)\"\n [displayWith]=\"dataSource?.onDisplayEntity ?? null\">\n <mat-option *ngIf=\"isLoading\" class=\"is-loading\">\n <mat-spinner diameter=\"50\"></mat-spinner>\n </mat-option>\n <ng-container *ngIf=\"!isLoading\">\n <mat-option *ngFor=\"let entity of filteredEntities\" [value]=\"entity\">\n {{dataSource?.onDisplayEntity(entity) ?? null}}\n </mat-option>\n </ng-container>\n </mat-autocomplete>\n</mat-chip-grid>\n" }]
932
+ ], template: "<mat-chip-grid #list>\n <mat-chip-row *ngFor=\"let entity of valuesFormControl.value\"\n (removed)=\"remove(entity)\"\n [editable]=\"false\"\n [aria-description]=\"'press enter to edit ' + dataSource?.onDisplayEntity(entity) ?? null\">\n {{dataSource?.onDisplayEntity(entity) ?? null}}\n <button matChipRemove [attr.aria-label]=\"'remove ' + dataSource?.onDisplayEntity(entity) ?? null\">\n <mat-icon class=\"material-symbols-outlined\">cancel</mat-icon>\n </button>\n </mat-chip-row>\n <input #input (blur)=\"onTouched()\" (focusout)=\"onFocusOut()\" [formControl]=\"searchFormControl\"\n [matAutocomplete]=\"auto\"\n [matChipInputFor]=\"list\"\n matChipInputAddOnBlur=\"true\"\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\n [placeholder]=\"placeholder\" matInput>\n <mat-autocomplete #auto=\"matAutocomplete\" (closed)=\"onEntityClosed()\"\n (optionActivated)=\"onEntityActivated($event)\" (optionSelected)=\"onEntitySelected($event)\"\n [displayWith]=\"dataSource?.onDisplayEntity ?? null\">\n <mat-option *ngIf=\"isLoading\" class=\"is-loading\">\n <mat-spinner diameter=\"50\"></mat-spinner>\n </mat-option>\n <ng-container *ngIf=\"!isLoading\">\n <mat-option *ngFor=\"let entity of filteredEntities\" [value]=\"entity\">\n {{dataSource?.onDisplayEntity(entity) ?? null}}\n </mat-option>\n </ng-container>\n </mat-autocomplete>\n</mat-chip-grid>\n" }]
932
933
  }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Injector }, { type: i1$2.FocusMonitor }], propDecorators: { id: [{
933
934
  type: HostBinding
934
935
  }], inputField: [{
@@ -1164,68 +1165,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.3", ngImpor
1164
1165
  args: [MAT_DIALOG_DATA]
1165
1166
  }] }] });
1166
1167
 
1167
- class MmSharedUiModule {
1168
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: MmSharedUiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1169
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.1.3", ngImport: i0, type: MmSharedUiModule, declarations: [MmBreadcrumbComponent,
1170
- MmConfirmationWindowComponent,
1171
- MmProgressWindowComponent,
1172
- MmNotificationBarComponent,
1173
- MmMessageDetailsComponent,
1174
- MmAutocompleteInputComponent,
1175
- MmEntitySelectInputComponent,
1176
- MmMultipleEntitySelectInputComponent], imports: [CommonModule,
1177
- MatToolbarModule,
1178
- MatButtonModule,
1179
- MatSnackBarModule,
1180
- MatDialogModule,
1181
- MatAutocompleteModule,
1182
- MatInputModule,
1183
- MatProgressSpinnerModule,
1184
- MatChipsModule,
1185
- MatIconModule,
1186
- ReactiveFormsModule], exports: [MmBreadcrumbComponent, MmConfirmationWindowComponent, MmNotificationBarComponent, MmAutocompleteInputComponent, MmEntitySelectInputComponent, MmMultipleEntitySelectInputComponent] });
1187
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: MmSharedUiModule, imports: [CommonModule,
1188
- MatToolbarModule,
1189
- MatButtonModule,
1190
- MatSnackBarModule,
1191
- MatDialogModule,
1192
- MatAutocompleteModule,
1193
- MatInputModule,
1194
- MatProgressSpinnerModule,
1195
- MatChipsModule,
1196
- MatIconModule,
1197
- ReactiveFormsModule] });
1198
- }
1199
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: MmSharedUiModule, decorators: [{
1200
- type: NgModule,
1201
- args: [{
1202
- declarations: [
1203
- MmBreadcrumbComponent,
1204
- MmConfirmationWindowComponent,
1205
- MmProgressWindowComponent,
1206
- MmNotificationBarComponent,
1207
- MmMessageDetailsComponent,
1208
- MmAutocompleteInputComponent,
1209
- MmEntitySelectInputComponent,
1210
- MmMultipleEntitySelectInputComponent,
1211
- ],
1212
- exports: [MmBreadcrumbComponent, MmConfirmationWindowComponent, MmNotificationBarComponent, MmAutocompleteInputComponent, MmEntitySelectInputComponent, MmMultipleEntitySelectInputComponent],
1213
- imports: [
1214
- CommonModule,
1215
- MatToolbarModule,
1216
- MatButtonModule,
1217
- MatSnackBarModule,
1218
- MatDialogModule,
1219
- MatAutocompleteModule,
1220
- MatInputModule,
1221
- MatProgressSpinnerModule,
1222
- MatChipsModule,
1223
- MatIconModule,
1224
- ReactiveFormsModule
1225
- ]
1226
- }]
1227
- }] });
1228
-
1229
1168
  class ConfirmationService {
1230
1169
  dialog;
1231
1170
  constructor(dialog) {
@@ -1347,6 +1286,222 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.3", ngImpor
1347
1286
  type: Injectable
1348
1287
  }], ctorParameters: () => [{ type: i1.MatDialog }] });
1349
1288
 
1289
+ class MmFileUploadComponent {
1290
+ dialogRef;
1291
+ data;
1292
+ snackBar;
1293
+ fileName = signal('');
1294
+ fileSize = signal(0);
1295
+ uploadProgress = signal(0);
1296
+ fileInput;
1297
+ selectedFile = null;
1298
+ uploadSuccess;
1299
+ uploadError;
1300
+ constructor(dialogRef, data, snackBar) {
1301
+ this.dialogRef = dialogRef;
1302
+ this.data = data;
1303
+ this.snackBar = snackBar;
1304
+ this.uploadError = false;
1305
+ this.uploadSuccess = false;
1306
+ }
1307
+ // Handler for file input change
1308
+ onFileChange(event) {
1309
+ const file = event.target.files[0];
1310
+ this.uploadFile(file);
1311
+ }
1312
+ // Handler for file drop
1313
+ onFileDrop(event) {
1314
+ event.preventDefault();
1315
+ const file = event.dataTransfer?.files[0];
1316
+ this.uploadFile(file);
1317
+ }
1318
+ // Prevent default dragover behavior
1319
+ onDragOver(event) {
1320
+ event.preventDefault();
1321
+ }
1322
+ // Method to handle file upload
1323
+ uploadFile(file) {
1324
+ const allowedMimeTypes = this.data.mimeTypes.split(',').map((mimeType) => mimeType.trim());
1325
+ if (!file) {
1326
+ return;
1327
+ }
1328
+ if (allowedMimeTypes.length > 0 && allowedMimeTypes.includes(file.type)) {
1329
+ this.selectedFile = file;
1330
+ this.fileSize.set(Math.round(file.size / 1024)); // Set file size in KB
1331
+ this.uploadSuccess = true;
1332
+ this.uploadError = false;
1333
+ this.fileName.set(file.name); // Set image name
1334
+ }
1335
+ else {
1336
+ this.uploadSuccess = false;
1337
+ this.uploadError = true;
1338
+ this.snackBar.open('File type not supported!', 'Close', {
1339
+ duration: 3000,
1340
+ panelClass: 'error',
1341
+ });
1342
+ }
1343
+ }
1344
+ // Method to remove a file
1345
+ removeFile() {
1346
+ this.selectedFile = null;
1347
+ this.fileName.set('');
1348
+ this.fileSize.set(0);
1349
+ this.uploadSuccess = false;
1350
+ this.uploadError = false;
1351
+ this.uploadProgress.set(0);
1352
+ }
1353
+ onOk() {
1354
+ this.dialogRef.close({
1355
+ success: true,
1356
+ selectedFile: this.selectedFile
1357
+ });
1358
+ }
1359
+ onCancel() {
1360
+ this.dialogRef.close({
1361
+ success: false,
1362
+ selectedFile: null
1363
+ });
1364
+ }
1365
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: MmFileUploadComponent, deps: [{ token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: i2$2.MatSnackBar }], target: i0.ɵɵFactoryTarget.Component });
1366
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.3", type: MmFileUploadComponent, selector: "mm-mm-file-upload", viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true }], ngImport: i0, template: "<h1 mat-dialog-title>{{data.title}}</h1>\n<div\n class=\"file-upload-wrapper\"\n [class.success]=\"uploadSuccess\"\n [class.error]=\"uploadError\"\n (drop)=\"onFileDrop($event)\"\n (dragover)=\"onDragOver($event)\"\n>\n <input\n type=\"file\"\n accept=\"{{data.mimeTypes}}\"\n (change)=\"onFileChange($event)\"\n hidden\n #fileInput\n />\n <div class=\"file-dropper\" (click)=\"fileInput.click()\">\n <mat-icon class=\"material-symbols-outlined\">upload</mat-icon>\n <p>{{data.message}}</p>\n <div *ngIf=\"fileName()\">\n <div *ngIf=\"selectedFile\">\n <p>\n <span class=\"image-name\">{{ fileName() }}</span> ({{\n fileSize()\n }} KB)\n </p>\n <mat-icon class=\"material-symbols-outlined delete-icon\" (click)=\"removeFile()\">delete</mat-icon>\n </div>\n </div>\n </div>\n</div>\n<div style=\"justify-content: flex-end;\" mat-dialog-actions>\n <button (click)=\"onOk()\" [disabled]=\"!selectedFile\" mat-flat-button>Upload</button>\n <button (click)=\"onCancel()\" mat-button>Cancel</button>\n</div>\n\n", styles: [".file-upload-wrapper{display:flex;justify-content:center;align-items:center;flex-direction:column;border:2px dashed #ccc;padding:1rem;margin-bottom:1rem;margin-left:1rem;margin-right:1rem;border-radius:10px;cursor:pointer}.file-upload-wrapper.success{border-color:green}.file-upload-wrapper.error{border-color:red}.file-dropper{display:flex;flex-direction:column;align-items:center}.image-name{font-weight:700}.image-preview{max-width:100%;height:auto;margin-bottom:.5rem;border-radius:10px}.delete-icon{cursor:pointer;color:red}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
1367
+ }
1368
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: MmFileUploadComponent, decorators: [{
1369
+ type: Component,
1370
+ args: [{ selector: 'mm-mm-file-upload', template: "<h1 mat-dialog-title>{{data.title}}</h1>\n<div\n class=\"file-upload-wrapper\"\n [class.success]=\"uploadSuccess\"\n [class.error]=\"uploadError\"\n (drop)=\"onFileDrop($event)\"\n (dragover)=\"onDragOver($event)\"\n>\n <input\n type=\"file\"\n accept=\"{{data.mimeTypes}}\"\n (change)=\"onFileChange($event)\"\n hidden\n #fileInput\n />\n <div class=\"file-dropper\" (click)=\"fileInput.click()\">\n <mat-icon class=\"material-symbols-outlined\">upload</mat-icon>\n <p>{{data.message}}</p>\n <div *ngIf=\"fileName()\">\n <div *ngIf=\"selectedFile\">\n <p>\n <span class=\"image-name\">{{ fileName() }}</span> ({{\n fileSize()\n }} KB)\n </p>\n <mat-icon class=\"material-symbols-outlined delete-icon\" (click)=\"removeFile()\">delete</mat-icon>\n </div>\n </div>\n </div>\n</div>\n<div style=\"justify-content: flex-end;\" mat-dialog-actions>\n <button (click)=\"onOk()\" [disabled]=\"!selectedFile\" mat-flat-button>Upload</button>\n <button (click)=\"onCancel()\" mat-button>Cancel</button>\n</div>\n\n", styles: [".file-upload-wrapper{display:flex;justify-content:center;align-items:center;flex-direction:column;border:2px dashed #ccc;padding:1rem;margin-bottom:1rem;margin-left:1rem;margin-right:1rem;border-radius:10px;cursor:pointer}.file-upload-wrapper.success{border-color:green}.file-upload-wrapper.error{border-color:red}.file-dropper{display:flex;flex-direction:column;align-items:center}.image-name{font-weight:700}.image-preview{max-width:100%;height:auto;margin-bottom:.5rem;border-radius:10px}.delete-icon{cursor:pointer;color:red}\n"] }]
1371
+ }], ctorParameters: () => [{ type: i1.MatDialogRef }, { type: undefined, decorators: [{
1372
+ type: Inject,
1373
+ args: [MAT_DIALOG_DATA]
1374
+ }] }, { type: i2$2.MatSnackBar }], propDecorators: { fileInput: [{
1375
+ type: ViewChild,
1376
+ args: ['fileInput']
1377
+ }] } });
1378
+
1379
+ class FileUploadService {
1380
+ dialog;
1381
+ constructor(dialog) {
1382
+ this.dialog = dialog;
1383
+ }
1384
+ async showUploadDialog(title, message, mimeTypes) {
1385
+ const dialogRef = this.dialog.open(MmFileUploadComponent, {
1386
+ width: '50vw',
1387
+ maxWidth: '50vw',
1388
+ data: {
1389
+ title,
1390
+ message,
1391
+ mimeTypes
1392
+ }
1393
+ });
1394
+ const r = await firstValueFrom(dialogRef.afterClosed());
1395
+ const success = r?.success ?? false;
1396
+ if (success) {
1397
+ return r?.selectedFile ?? null;
1398
+ }
1399
+ return null;
1400
+ }
1401
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: FileUploadService, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
1402
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: FileUploadService, providedIn: 'root' });
1403
+ }
1404
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: FileUploadService, decorators: [{
1405
+ type: Injectable,
1406
+ args: [{
1407
+ providedIn: 'root'
1408
+ }]
1409
+ }], ctorParameters: () => [{ type: i1.MatDialog }] });
1410
+
1411
+ class MmSharedUiModule {
1412
+ static forRoot() {
1413
+ return {
1414
+ ngModule: MmSharedUiModule,
1415
+ providers: [
1416
+ FileUploadService,
1417
+ ConfirmationService,
1418
+ ProgressNotifierService
1419
+ ]
1420
+ };
1421
+ }
1422
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: MmSharedUiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1423
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.1.3", ngImport: i0, type: MmSharedUiModule, declarations: [MmBreadcrumbComponent,
1424
+ MmConfirmationWindowComponent,
1425
+ MmProgressWindowComponent,
1426
+ MmNotificationBarComponent,
1427
+ MmMessageDetailsComponent,
1428
+ MmAutocompleteInputComponent,
1429
+ MmEntitySelectInputComponent,
1430
+ MmMultipleEntitySelectInputComponent,
1431
+ MmFileUploadComponent], imports: [CommonModule,
1432
+ MatToolbarModule,
1433
+ MatButtonModule,
1434
+ MatSnackBarModule,
1435
+ MatDialogModule,
1436
+ MatAutocompleteModule,
1437
+ MatInputModule,
1438
+ MatProgressSpinnerModule,
1439
+ MatChipsModule,
1440
+ MatIconModule,
1441
+ ReactiveFormsModule,
1442
+ MatIcon,
1443
+ MatIcon], exports: [MmBreadcrumbComponent,
1444
+ MmConfirmationWindowComponent,
1445
+ MmNotificationBarComponent,
1446
+ MmAutocompleteInputComponent,
1447
+ MmEntitySelectInputComponent,
1448
+ MmMultipleEntitySelectInputComponent,
1449
+ MmFileUploadComponent] });
1450
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: MmSharedUiModule, imports: [CommonModule,
1451
+ MatToolbarModule,
1452
+ MatButtonModule,
1453
+ MatSnackBarModule,
1454
+ MatDialogModule,
1455
+ MatAutocompleteModule,
1456
+ MatInputModule,
1457
+ MatProgressSpinnerModule,
1458
+ MatChipsModule,
1459
+ MatIconModule,
1460
+ ReactiveFormsModule,
1461
+ MatIcon,
1462
+ MatIcon] });
1463
+ }
1464
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: MmSharedUiModule, decorators: [{
1465
+ type: NgModule,
1466
+ args: [{
1467
+ declarations: [
1468
+ MmBreadcrumbComponent,
1469
+ MmConfirmationWindowComponent,
1470
+ MmProgressWindowComponent,
1471
+ MmNotificationBarComponent,
1472
+ MmMessageDetailsComponent,
1473
+ MmAutocompleteInputComponent,
1474
+ MmEntitySelectInputComponent,
1475
+ MmMultipleEntitySelectInputComponent,
1476
+ MmFileUploadComponent
1477
+ ],
1478
+ exports: [
1479
+ MmBreadcrumbComponent,
1480
+ MmConfirmationWindowComponent,
1481
+ MmNotificationBarComponent,
1482
+ MmAutocompleteInputComponent,
1483
+ MmEntitySelectInputComponent,
1484
+ MmMultipleEntitySelectInputComponent,
1485
+ MmFileUploadComponent
1486
+ ],
1487
+ imports: [
1488
+ CommonModule,
1489
+ MatToolbarModule,
1490
+ MatButtonModule,
1491
+ MatSnackBarModule,
1492
+ MatDialogModule,
1493
+ MatAutocompleteModule,
1494
+ MatInputModule,
1495
+ MatProgressSpinnerModule,
1496
+ MatChipsModule,
1497
+ MatIconModule,
1498
+ ReactiveFormsModule,
1499
+ MatIcon,
1500
+ MatIcon
1501
+ ]
1502
+ }]
1503
+ }] });
1504
+
1350
1505
  function isEmptyInputValue(value) {
1351
1506
  // we don't check for string here so it also works with arrays
1352
1507
  return value == null || value.length === 0;
@@ -1442,5 +1597,5 @@ class AbstractDetailsComponent {
1442
1597
  * Generated bundle index. Do not edit.
1443
1598
  */
1444
1599
 
1445
- export { AbstractDetailsComponent, ButtonTypes, CommonValidators, ConfirmationService, DialogType, MmAutocompleteInputComponent, MmBreadcrumbComponent, MmConfirmationWindowComponent, MmEntitySelectInputComponent, MmMultipleEntitySelectInputComponent, MmNotificationBarComponent, MmSharedUiModule, ProgressNotifierService };
1600
+ export { AbstractDetailsComponent, ButtonTypes, CommonValidators, ConfirmationService, DialogType, FileUploadService, MmAutocompleteInputComponent, MmBreadcrumbComponent, MmConfirmationWindowComponent, MmEntitySelectInputComponent, MmFileUploadComponent, MmMultipleEntitySelectInputComponent, MmNotificationBarComponent, MmSharedUiModule, ProgressNotifierService };
1446
1601
  //# sourceMappingURL=meshmakers-shared-ui.mjs.map