@ldw-framework/material-media 0.3.1 → 0.5.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.
@@ -8,6 +8,8 @@ import { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule, MatDialog } from '@angu
8
8
  import * as i2 from '@angular/material/icon';
9
9
  import { MatIconModule } from '@angular/material/icon';
10
10
  import { LDuAnguBootTranslationPipe } from '@ldu-anguboot/i18n';
11
+ import { LDuAnguBootApiService } from '@ldu-anguboot/http';
12
+ import { firstValueFrom } from 'rxjs';
11
13
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
12
14
  import * as i1$1 from '@angular/forms';
13
15
  import { FormGroup, FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
@@ -15,20 +17,21 @@ import * as i3$1 from '@angular/material/form-field';
15
17
  import { MatFormFieldModule } from '@angular/material/form-field';
16
18
  import * as i4 from '@angular/material/input';
17
19
  import { MatInputModule } from '@angular/material/input';
18
- import { LDuAnguBootApiService } from '@ldu-anguboot/http';
19
- import { firstValueFrom } from 'rxjs';
20
20
 
21
21
  class LDwMaterialImageUploadDialogComponent {
22
22
  dialogRef = inject((MatDialogRef));
23
23
  data = inject(MAT_DIALOG_DATA);
24
24
  cdr = inject(ChangeDetectorRef);
25
+ ngOnInit() {
26
+ console.log(this.data);
27
+ }
25
28
  onSaveClick() {
26
29
  this.dialogRef.close(this.data);
27
30
  }
28
31
  onCancelClick() {
29
32
  this.dialogRef.close(false);
30
33
  }
31
- onChange($event) {
34
+ onFileChange($event) {
32
35
  const files = $event?.target?.files;
33
36
  if (files?.[0]) {
34
37
  const picture = files[0];
@@ -54,32 +57,34 @@ class LDwMaterialImageUploadDialogComponent {
54
57
  }
55
58
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: LDwMaterialImageUploadDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
56
59
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.0", type: LDwMaterialImageUploadDialogComponent, isStandalone: true, selector: "ldw-mat-image-upload-dialog", host: { classAttribute: "ldw-mat-image-upload-dialog" }, ngImport: i0, template: `
57
- <mat-dialog-actions>
58
- <h2>{{ 'LDU_ANGUBOOT_IMG_UPLOAD_DIALOG.title' | i18n }}</h2>
59
- <button class="ldw-mat-image-uploader-save"
60
- matButton
61
- cdkFocusInitial
62
- (click)="onSaveClick()"
63
- >{{ 'LDU_ANGUBOOT_IMG_UPLOAD_DIALOG.btnSave' | i18n }}</button>
64
- <button class="ldw-mat-image-uploader-cancel"
65
- matButton
66
- (click)="onCancelClick()"
67
- >{{ 'LDU_ANGUBOOT_IMG_UPLOAD_DIALOG.btnCancel' | i18n }}</button>
68
- </mat-dialog-actions>
60
+ <h2 mat-dialog-title>{{ 'LDU_ANGUBOOT_IMG_UPLOAD_DIALOG.title' | i18n }}</h2>
69
61
  <mat-dialog-content>
70
62
  <input class="ldw-mat-image-uploader-hidden-input"
71
63
  #uploader type="file"
72
64
  [style.display]="'none'"
73
- (change)="onChange($event)"
65
+ (change)="onFileChange($event)"
74
66
  />
75
67
  <div class="ldw-mat-image-uploader--instance"
76
68
  [style.backgroundImage]="$backgroundImage"
77
69
  (keypress)="uploader.click()"
78
70
  (click)="uploader.click()"
79
- >@if ($noData) { <mat-icon>image</mat-icon> }
71
+ >@if ($noData) {
72
+ <mat-icon>image</mat-icon> }
80
73
  </div>
81
74
  </mat-dialog-content>
82
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i3.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i3.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "pipe", type: LDuAnguBootTranslationPipe, name: "i18n" }] });
75
+ <mat-dialog-actions>
76
+ <button
77
+ class="ldw-mat-image-uploader-save"
78
+ matButton
79
+ cdkFocusInitial
80
+ (click)="onSaveClick()"
81
+ >{{ 'LDU_ANGUBOOT_IMG_UPLOAD_DIALOG.btnSave' | i18n }}</button>
82
+ <button class="ldw-mat-image-uploader-cancel"
83
+ matButton
84
+ (click)="onCancelClick()"
85
+ >{{ 'LDU_ANGUBOOT_IMG_UPLOAD_DIALOG.btnCancel' | i18n }}</button>
86
+ </mat-dialog-actions>
87
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i3.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i3.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i3.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "pipe", type: LDuAnguBootTranslationPipe, name: "i18n" }] });
83
88
  }
84
89
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: LDwMaterialImageUploadDialogComponent, decorators: [{
85
90
  type: Component,
@@ -94,31 +99,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
94
99
  LDuAnguBootTranslationPipe,
95
100
  ],
96
101
  template: `
97
- <mat-dialog-actions>
98
- <h2>{{ 'LDU_ANGUBOOT_IMG_UPLOAD_DIALOG.title' | i18n }}</h2>
99
- <button class="ldw-mat-image-uploader-save"
100
- matButton
101
- cdkFocusInitial
102
- (click)="onSaveClick()"
103
- >{{ 'LDU_ANGUBOOT_IMG_UPLOAD_DIALOG.btnSave' | i18n }}</button>
104
- <button class="ldw-mat-image-uploader-cancel"
105
- matButton
106
- (click)="onCancelClick()"
107
- >{{ 'LDU_ANGUBOOT_IMG_UPLOAD_DIALOG.btnCancel' | i18n }}</button>
108
- </mat-dialog-actions>
102
+ <h2 mat-dialog-title>{{ 'LDU_ANGUBOOT_IMG_UPLOAD_DIALOG.title' | i18n }}</h2>
109
103
  <mat-dialog-content>
110
104
  <input class="ldw-mat-image-uploader-hidden-input"
111
105
  #uploader type="file"
112
106
  [style.display]="'none'"
113
- (change)="onChange($event)"
107
+ (change)="onFileChange($event)"
114
108
  />
115
109
  <div class="ldw-mat-image-uploader--instance"
116
110
  [style.backgroundImage]="$backgroundImage"
117
111
  (keypress)="uploader.click()"
118
112
  (click)="uploader.click()"
119
- >@if ($noData) { <mat-icon>image</mat-icon> }
113
+ >@if ($noData) {
114
+ <mat-icon>image</mat-icon> }
120
115
  </div>
121
116
  </mat-dialog-content>
117
+ <mat-dialog-actions>
118
+ <button
119
+ class="ldw-mat-image-uploader-save"
120
+ matButton
121
+ cdkFocusInitial
122
+ (click)="onSaveClick()"
123
+ >{{ 'LDU_ANGUBOOT_IMG_UPLOAD_DIALOG.btnSave' | i18n }}</button>
124
+ <button class="ldw-mat-image-uploader-cancel"
125
+ matButton
126
+ (click)="onCancelClick()"
127
+ >{{ 'LDU_ANGUBOOT_IMG_UPLOAD_DIALOG.btnCancel' | i18n }}</button>
128
+ </mat-dialog-actions>
122
129
  `
123
130
  }]
124
131
  }] });
@@ -127,27 +134,63 @@ const LDW_MAT_MEDIA_API = new InjectionToken('LDW_MAT_MEDIA_API');
127
134
 
128
135
  class LDwMaterialMediaService {
129
136
  MEDIA_API$ = inject(LDW_MAT_MEDIA_API);
130
- lduApiService = inject(LDuAnguBootApiService);
131
- matDialog = inject(MatDialog);
132
- async uploadImage(uploadUrl, type = 'jpg', data) {
133
- const media = await firstValueFrom(this.matDialog.open(LDwMaterialImageUploadDialogComponent, {
134
- height: 'calc(100% - 1rem)',
135
- width: 'calc(100% - 1rem)',
136
- maxHeight: '100%',
137
- maxWidth: '100%',
137
+ lduApiService$ = inject(LDuAnguBootApiService);
138
+ matDialog$ = inject(MatDialog);
139
+ async uploadImage(uploadUrl, uploadConfig, type = 'jpg', data) {
140
+ const config = {
141
+ height: uploadConfig?.height ?? 'calc(100% - 1rem)',
142
+ width: uploadConfig?.width ?? 'calc(100% - 1rem)',
143
+ maxHeight: uploadConfig?.maxHeight ?? '100%',
144
+ maxWidth: uploadConfig?.maxWidth ?? '100%',
145
+ panelClass: 'ldw-mat-image-upload-dialog-panel',
138
146
  data: {
147
+ imgAlt: data?.imgAlt,
139
148
  imgSrc: data?.imgSrc,
140
149
  imgBase64: data?.imgBase64,
141
150
  },
142
- }).afterClosed());
151
+ };
152
+ const media = await firstValueFrom(this.matDialog.open(LDwMaterialImageUploadDialogComponent, config).afterClosed());
143
153
  if (media?.imgBase64) {
144
- const response = await firstValueFrom(this.lduApiService.PUT(uploadUrl, media));
154
+ const response = await firstValueFrom(this.apiService.PUT(uploadUrl, media));
155
+ if (response?.id) {
156
+ switch (type) {
157
+ case 'jpg':
158
+ return this.apiService.url(`${this.ENV.url}/${response.id}.jpg?t=${Date.now()}`);
159
+ case 'png':
160
+ return this.apiService.url(`${this.ENV.url}/${response.id}.png?t=${Date.now()}`);
161
+ default:
162
+ break;
163
+ }
164
+ }
165
+ }
166
+ return null;
167
+ }
168
+ async deleteImage(deleteUrl) {
169
+ return firstValueFrom(this.apiService.DELETE(`${deleteUrl}`));
170
+ }
171
+ async getGallery(galleryUrl) {
172
+ return firstValueFrom(this.apiService.GET(`${galleryUrl}`));
173
+ }
174
+ openGallery(galleryUrl, galleryConfig) {
175
+ const config = {
176
+ height: galleryConfig?.height ?? 'calc(100% - 1rem)',
177
+ width: galleryConfig?.width ?? 'calc(100% - 1rem)',
178
+ maxHeight: galleryConfig?.maxHeight ?? '100%',
179
+ maxWidth: galleryConfig?.maxWidth ?? '100%',
180
+ panelClass: 'ldw-mat-image-gallery-dialog-panel',
181
+ data: { galleryUrl },
182
+ };
183
+ return this.matDialog.open(LDwMaterialImageGalleryDialogComponent, config);
184
+ }
185
+ async uploadGallery(galleryUrl, imgBase64, type = 'jpg') {
186
+ if (imgBase64) {
187
+ const response = await firstValueFrom(this.apiService.PUT(galleryUrl, { imgBase64 }));
145
188
  if (response?.id) {
146
189
  switch (type) {
147
190
  case 'jpg':
148
- return this.lduApiService.url(`${this.ENV.url}/${response.id}.jpg?t=${Date.now()}`);
191
+ return this.apiService.url(`${this.ENV.url}/${response.id}.jpg?t=${Date.now()}`);
149
192
  case 'png':
150
- return this.lduApiService.url(`${this.ENV.url}/${response.id}.png?t=${Date.now()}`);
193
+ return this.apiService.url(`${this.ENV.url}/${response.id}.png?t=${Date.now()}`);
151
194
  default:
152
195
  break;
153
196
  }
@@ -155,10 +198,12 @@ class LDwMaterialMediaService {
155
198
  }
156
199
  return null;
157
200
  }
158
- async clearImage(api) {
159
- return firstValueFrom(this.lduApiService.DELETE(`${api}`));
201
+ async deleteGallery(galleryUrl) {
202
+ return firstValueFrom(this.apiService.DELETE(`${galleryUrl}`));
160
203
  }
161
204
  get ENV() { return this.MEDIA_API$; }
205
+ get apiService() { return this.lduApiService$; }
206
+ get matDialog() { return this.matDialog$; }
162
207
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: LDwMaterialMediaService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
163
208
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: LDwMaterialMediaService, providedIn: 'root' });
164
209
  }
@@ -167,6 +212,150 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
167
212
  args: [{ providedIn: 'root' }]
168
213
  }] });
169
214
 
215
+ class LDwMaterialImageGalleryDialogComponent {
216
+ service = inject(LDwMaterialMediaService);
217
+ cdr = inject(ChangeDetectorRef);
218
+ dialogRef = inject((MatDialogRef));
219
+ data = inject(MAT_DIALOG_DATA);
220
+ gallery = [];
221
+ ngOnInit() {
222
+ this.load();
223
+ }
224
+ onSaveClick() {
225
+ this.dialogRef.close(true);
226
+ }
227
+ onCancelClick() {
228
+ this.dialogRef.close(false);
229
+ }
230
+ onFileChange($event) {
231
+ const files = $event?.target?.files;
232
+ if (files?.[0]) {
233
+ const picture = files[0];
234
+ const reader = new FileReader();
235
+ reader.readAsDataURL(picture);
236
+ reader.onload = () => {
237
+ const imgBase64 = reader.result.toString();
238
+ this.service.uploadGallery(this.data.galleryUrl, imgBase64).then(() => this.load());
239
+ };
240
+ }
241
+ }
242
+ onDeleteClick(id) {
243
+ this.service.deleteGallery(`${this.data.galleryUrl}/${id}`).then(() => this.load());
244
+ }
245
+ async load() {
246
+ const response = await this.service.getGallery(this.data.galleryUrl);
247
+ this.gallery = response;
248
+ this.cdr.detectChanges();
249
+ }
250
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: LDwMaterialImageGalleryDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
251
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.0", type: LDwMaterialImageGalleryDialogComponent, isStandalone: true, selector: "ldw-mat-image-gallery-dialog", host: { classAttribute: "ldw-mat-image-gallery-dialog" }, ngImport: i0, template: `
252
+ <h2 mat-dialog-title>{{ 'LDU_ANGUBOOT_IMG_GALLERY_DIALOG.title' | i18n }}</h2>
253
+ <mat-dialog-content>
254
+ <input class="ldw-mat-image-gallery-hidden-input"
255
+ #uploader type="file"
256
+ [style.display]="'none'"
257
+ (change)="onFileChange($event)"
258
+ />
259
+ <div class="ldw-mat-image-gallery--instance">
260
+ <div class="ldw-mat-image-gallery-item ldw-mat-image-gallery-item--upload">
261
+ <mat-icon
262
+ (keypress)="uploader.click()"
263
+ (click)="uploader.click()"
264
+ >add</mat-icon>
265
+ </div>
266
+ @for (image of gallery; track image.id)
267
+ {
268
+ <div class="ldw-mat-image-gallery-item">
269
+ <a [href]="image.imgSrc" target="_blank">
270
+ <img [src]="image.imgSrc" [alt]="image.imgAlt" />
271
+ </a>
272
+ <mat-icon
273
+ (keypress)="onDeleteClick(image.id)"
274
+ (click)="onDeleteClick(image.id)"
275
+ >delete</mat-icon>
276
+ </div>
277
+ }
278
+ @empty
279
+ {
280
+ <mat-icon>image</mat-icon>
281
+ }
282
+ </div>
283
+ </mat-dialog-content>
284
+ <mat-dialog-actions>
285
+ <button
286
+ class="ldw-mat-image-gallery-save"
287
+ matButton
288
+ (click)="onSaveClick()"
289
+ >{{ 'LDU_ANGUBOOT_IMG_GALLERY_DIALOG.btnSave' | i18n }}</button>
290
+ <button
291
+ class="ldw-mat-image-gallery-cancel"
292
+ matButton
293
+ (click)="onCancelClick()"
294
+ >{{ 'LDU_ANGUBOOT_IMG_GALLERY_DIALOG.btnCancel' | i18n }}</button>
295
+ </mat-dialog-actions>
296
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i3.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i3.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i3.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "pipe", type: LDuAnguBootTranslationPipe, name: "i18n" }] });
297
+ }
298
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: LDwMaterialImageGalleryDialogComponent, decorators: [{
299
+ type: Component,
300
+ args: [{
301
+ selector: 'ldw-mat-image-gallery-dialog',
302
+ host: { class: 'ldw-mat-image-gallery-dialog' },
303
+ imports: [
304
+ CommonModule,
305
+ MatButtonModule,
306
+ MatIconModule,
307
+ MatDialogModule,
308
+ LDuAnguBootTranslationPipe,
309
+ ],
310
+ template: `
311
+ <h2 mat-dialog-title>{{ 'LDU_ANGUBOOT_IMG_GALLERY_DIALOG.title' | i18n }}</h2>
312
+ <mat-dialog-content>
313
+ <input class="ldw-mat-image-gallery-hidden-input"
314
+ #uploader type="file"
315
+ [style.display]="'none'"
316
+ (change)="onFileChange($event)"
317
+ />
318
+ <div class="ldw-mat-image-gallery--instance">
319
+ <div class="ldw-mat-image-gallery-item ldw-mat-image-gallery-item--upload">
320
+ <mat-icon
321
+ (keypress)="uploader.click()"
322
+ (click)="uploader.click()"
323
+ >add</mat-icon>
324
+ </div>
325
+ @for (image of gallery; track image.id)
326
+ {
327
+ <div class="ldw-mat-image-gallery-item">
328
+ <a [href]="image.imgSrc" target="_blank">
329
+ <img [src]="image.imgSrc" [alt]="image.imgAlt" />
330
+ </a>
331
+ <mat-icon
332
+ (keypress)="onDeleteClick(image.id)"
333
+ (click)="onDeleteClick(image.id)"
334
+ >delete</mat-icon>
335
+ </div>
336
+ }
337
+ @empty
338
+ {
339
+ <mat-icon>image</mat-icon>
340
+ }
341
+ </div>
342
+ </mat-dialog-content>
343
+ <mat-dialog-actions>
344
+ <button
345
+ class="ldw-mat-image-gallery-save"
346
+ matButton
347
+ (click)="onSaveClick()"
348
+ >{{ 'LDU_ANGUBOOT_IMG_GALLERY_DIALOG.btnSave' | i18n }}</button>
349
+ <button
350
+ class="ldw-mat-image-gallery-cancel"
351
+ matButton
352
+ (click)="onCancelClick()"
353
+ >{{ 'LDU_ANGUBOOT_IMG_GALLERY_DIALOG.btnCancel' | i18n }}</button>
354
+ </mat-dialog-actions>
355
+ `
356
+ }]
357
+ }] });
358
+
170
359
  class LDwMaterialImageUploaderComponent {
171
360
  service = inject(LDwMaterialMediaService);
172
361
  readonly$ = false;
@@ -193,7 +382,7 @@ class LDwMaterialImageUploaderComponent {
193
382
  }
194
383
  async onDeleteClick() {
195
384
  if (this.api) {
196
- await this.service.clearImage(this.api);
385
+ await this.service.deleteImage(this.api);
197
386
  }
198
387
  this.control.setValue(null);
199
388
  }
@@ -326,6 +515,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
326
515
  type: Input
327
516
  }] } });
328
517
 
518
+ const components$1 = [
519
+ LDwMaterialImageGalleryDialogComponent,
520
+ ];
521
+ class LDwMaterialImageGalleryModule {
522
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: LDwMaterialImageGalleryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
523
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.0", ngImport: i0, type: LDwMaterialImageGalleryModule, imports: [LDwMaterialImageGalleryDialogComponent], exports: [LDwMaterialImageGalleryDialogComponent] });
524
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: LDwMaterialImageGalleryModule, imports: [components$1] });
525
+ }
526
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: LDwMaterialImageGalleryModule, decorators: [{
527
+ type: NgModule,
528
+ args: [{
529
+ imports: [...components$1],
530
+ exports: [...components$1]
531
+ }]
532
+ }] });
533
+
329
534
  const components = [
330
535
  LDwMaterialImageUploadDialogComponent,
331
536
  LDwMaterialImageUploaderComponent,
@@ -349,5 +554,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
349
554
  * Generated bundle index. Do not edit.
350
555
  */
351
556
 
352
- export { LDW_MAT_MEDIA_API, LDwMaterialImageUploadDialogComponent, LDwMaterialImageUploaderComponent, LDwMaterialImageUploaderModule, LDwMaterialMediaService };
557
+ export { LDW_MAT_MEDIA_API, LDwMaterialImageGalleryDialogComponent, LDwMaterialImageGalleryModule, LDwMaterialImageUploadDialogComponent, LDwMaterialImageUploaderComponent, LDwMaterialImageUploaderModule, LDwMaterialMediaService };
353
558
  //# sourceMappingURL=ldw-framework-material-media.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ldw-framework-material-media.mjs","sources":["../../../lib/src/components/ldw-mat-image-upload-dialog.component.ts","../../../lib/src/config/ldw-mat-media.config.ts","../../../lib/src/services/ldw-mat-media.service.ts","../../../lib/src/components/ldw-mat-image-uploader.component.ts","../../../lib/src/modules/ldw-mat-image-uploader.module.ts","../../../lib/src/ldw-framework-material-media.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { ChangeDetectorRef, Component, inject } from '@angular/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';\nimport { MatIconModule } from '@angular/material/icon';\nimport { LDuAnguBootTranslationPipe } from '@ldu-anguboot/i18n';\nimport { LDwMaterialMediaModel } from '../models/ldw-mat-media.model';\n\n@Component({\n selector: 'ldw-mat-image-upload-dialog',\n host: { class: 'ldw-mat-image-upload-dialog' },\n imports: [\n CommonModule,\n MatButtonModule,\n MatIconModule,\n MatDialogModule,\n LDuAnguBootTranslationPipe,\n ],\n template: `\n <mat-dialog-actions>\n <h2>{{ 'LDU_ANGUBOOT_IMG_UPLOAD_DIALOG.title' | i18n }}</h2>\n <button class=\"ldw-mat-image-uploader-save\"\n matButton\n cdkFocusInitial\n (click)=\"onSaveClick()\"\n >{{ 'LDU_ANGUBOOT_IMG_UPLOAD_DIALOG.btnSave' | i18n }}</button>\n <button class=\"ldw-mat-image-uploader-cancel\"\n matButton\n (click)=\"onCancelClick()\"\n >{{ 'LDU_ANGUBOOT_IMG_UPLOAD_DIALOG.btnCancel' | i18n }}</button>\n </mat-dialog-actions>\n <mat-dialog-content>\n <input class=\"ldw-mat-image-uploader-hidden-input\"\n #uploader type=\"file\"\n [style.display]=\"'none'\"\n (change)=\"onChange($event)\"\n />\n <div class=\"ldw-mat-image-uploader--instance\"\n [style.backgroundImage]=\"$backgroundImage\"\n (keypress)=\"uploader.click()\"\n (click)=\"uploader.click()\"\n >@if ($noData) { <mat-icon>image</mat-icon> }\n </div>\n </mat-dialog-content>\n`})\nexport class LDwMaterialImageUploadDialogComponent {\n\n readonly dialogRef = inject(MatDialogRef<LDwMaterialImageUploadDialogComponent>);\n\n readonly data = inject<LDwMaterialMediaModel>(MAT_DIALOG_DATA);\n\n readonly cdr = inject(ChangeDetectorRef);\n\n onSaveClick() {\n this.dialogRef.close(this.data);\n }\n\n onCancelClick() {\n this.dialogRef.close(false);\n }\n\n onChange($event: any) {\n const files = $event?.target?.files;\n if (files?.[0]) {\n const picture = files[0];\n const reader = new FileReader();\n reader.readAsDataURL(picture);\n reader.onload = () => {\n this.data.imgBase64 = (reader.result as string).toString();\n this.cdr.detectChanges();\n };\n }\n }\n\n get $backgroundImage() {\n if (this.data.imgBase64) {\n return 'url(' + this.data.imgBase64 + ')';\n }\n if (this.data.imgSrc) {\n return 'url(' + this.data.imgSrc + ')';\n }\n return '';\n }\n\n get $noData() {\n return !this.data?.imgBase64 && !this.data?.imgSrc;\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const LDW_MAT_MEDIA_API = new InjectionToken<{\n url: string;\n}>('LDW_MAT_MEDIA_API');\n","import { inject, Injectable } from '@angular/core';\nimport { MatDialog } from '@angular/material/dialog';\nimport { LDuAnguBootApiService } from '@ldu-anguboot/http';\nimport { firstValueFrom } from 'rxjs';\nimport { LDwMaterialImageUploadDialogComponent } from '../components/ldw-mat-image-upload-dialog.component';\nimport { LDW_MAT_MEDIA_API } from '../config/ldw-mat-media.config';\nimport { LDwMaterialMediaModel } from '../models/ldw-mat-media.model';\n\n@Injectable({ providedIn: 'root' })\nexport class LDwMaterialMediaService {\n\n private readonly MEDIA_API$ = inject(LDW_MAT_MEDIA_API);\n\n private readonly lduApiService = inject(LDuAnguBootApiService);\n\n private readonly matDialog = inject(MatDialog);\n\n async uploadImage(uploadUrl: string, type: 'jpg' | 'png' = 'jpg', data?: LDwMaterialMediaModel) {\n const media = await firstValueFrom(this.matDialog.open(LDwMaterialImageUploadDialogComponent, {\n height: 'calc(100% - 1rem)',\n width: 'calc(100% - 1rem)',\n maxHeight: '100%',\n maxWidth: '100%',\n data: {\n imgSrc: data?.imgSrc,\n imgBase64: data?.imgBase64,\n },\n }).afterClosed());\n if (media?.imgBase64) {\n const response = await firstValueFrom(this.lduApiService.PUT<LDwMaterialMediaModel>(uploadUrl, media));\n if (response?.id) {\n switch (type) {\n case 'jpg':\n return this.lduApiService.url(`${this.ENV.url}/${response.id}.jpg?t=${Date.now()}`);\n case 'png':\n return this.lduApiService.url(`${this.ENV.url}/${response.id}.png?t=${Date.now()}`);\n default:\n break;\n }\n }\n }\n return null;\n }\n\n async clearImage(api: string) {\n return firstValueFrom(this.lduApiService.DELETE(`${api}`));\n }\n\n get ENV() { return this.MEDIA_API$; }\n}\n","import { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { CommonModule } from '@angular/common';\nimport { Component, inject, Input } from '@angular/core';\nimport { FormControl, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatInputModule } from '@angular/material/input';\nimport { LDwMaterialMediaService } from '../services/ldw-mat-media.service';\n\n@Component({\n selector: 'ldw-mat-image-uploader',\n host: { class: 'ldw-mat-image-uploader' },\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n MatButtonModule,\n MatFormFieldModule,\n MatInputModule,\n MatIconModule,\n ],\n template: `\n <form\n [formGroup]=\"formParent\"\n novalidate\n ><mat-form-field\n [appearance]=\"appearance\"\n ><mat-label\n [innerHTML]=\"label\" />\n <input matInput\n [name]=\"name\"\n [formControlName]=\"formParentControlName\"\n [readonly]=\"readonly\"\n [required]=\"required\"\n />\n @if (dimensions)\n {\n <mat-hint>{{ dimensions }}.{{ type }}</mat-hint>\n }\n <div matSuffix>\n @if (control.value)\n {\n <a matIconButton\n [href]=\"control.value\"\n target=\"_blank\"\n ><mat-icon>visibility</mat-icon>\n </a>\n }\n <button matIconButton\n (click)=\"onUploadClick()\"\n ><mat-icon>add_photo_alternate</mat-icon>\n </button>\n <button matIconButton\n (click)=\"onDeleteClick()\"\n ><mat-icon>delete</mat-icon>\n </button>\n </div>\n <ng-content/>\n </mat-form-field>\n </form>\n`})\nexport class LDwMaterialImageUploaderComponent {\n\n private readonly service = inject(LDwMaterialMediaService);\n\n private readonly$: string | boolean = false;\n\n private required$: string | boolean = false;\n\n @Input({ required: true })\n formParent: FormGroup = new FormGroup({\n value: new FormControl<string | null | undefined>(null, [])\n });\n\n @Input({ required: true })\n formParentControlName = 'value';\n\n @Input({ required: true })\n label = 'Value';\n\n @Input()\n appearance: 'fill' | 'outline' = 'outline';\n\n @Input()\n name = 'value';\n\n @Input()\n type: 'jpg' | 'png' = 'jpg';\n\n @Input()\n dimensions: string | null | undefined;\n\n @Input()\n api: string | null | undefined;\n\n @Input()\n set readonly(v) { this.readonly$ = coerceBooleanProperty(v); }\n\n @Input()\n set required(v) { this.required$ = coerceBooleanProperty(v); }\n\n async onUploadClick() {\n if (this.api) {\n const mediaUrl = await this.service.uploadImage(`${this.api}`);\n if (mediaUrl) {\n this.control.setValue(mediaUrl);\n }\n }\n }\n\n async onDeleteClick() {\n if (this.api) {\n await this.service.clearImage(this.api);\n }\n this.control.setValue(null);\n }\n\n get readonly() { return this.readonly$; };\n\n get required() { return this.required$; };\n\n get control() {\n return this.formParent?.get(this.formParentControlName) as FormControl<string | null | undefined>;\n }\n}\n","import { NgModule } from '@angular/core';\nimport { LDwMaterialImageUploadDialogComponent } from '../components/ldw-mat-image-upload-dialog.component';\nimport { LDwMaterialImageUploaderComponent } from '../components/ldw-mat-image-uploader.component';\n\nconst components = [\n LDwMaterialImageUploadDialogComponent,\n LDwMaterialImageUploaderComponent,\n];\n\n@NgModule({\n imports: [...components],\n exports: [...components]\n})\nexport class LDwMaterialImageUploaderModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1","i2","i3","i5"],"mappings":";;;;;;;;;;;;;;;;;;;;MA6Ca,qCAAqC,CAAA;AAErC,IAAA,SAAS,GAAG,MAAM,EAAC,YAAmD,EAAC;AAEvE,IAAA,IAAI,GAAG,MAAM,CAAwB,eAAe,CAAC;AAErD,IAAA,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC;IAExC,WAAW,GAAA;QACP,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;IACnC;IAEA,aAAa,GAAA;AACT,QAAA,IAAI,CAAC,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AqC;IACrC,iCAAiC;CACpC;MAMY,8BAA8B,CAAA;uGAA9B,8BAA8B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;AAA9B,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,8BAA8B,YARvC,qCAAqC;AACrC,YAAA,iCAAiC,aADjC,qCAAqC;YACrC,iCAAiC,CAAA,EAAA,CAAA;AAOxB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,8BAA8B,YAH1B,UAAU,CAAA,EAAA,CAAA;;2FAGd,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBAJ1C,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,GAAG,UAAU,CAAC;AACxB,oBAAA,OAAO,EAAE,CAAC,GAAG,UAAU;AAC1B,iBAAA;;;ACZD;;AAEG;;;;"}
1
+ {"version":3,"file":"ldw-framework-material-media.mjs","sources":["../../../lib/src/components/ldw-mat-image-upload-dialog.component.ts","../../../lib/src/config/ldw-mat-media.config.ts","../../../lib/src/services/ldw-mat-media.service.ts","../../../lib/src/components/ldw-mat-image-gallery-dialog.component.ts","../../../lib/src/components/ldw-mat-image-uploader.component.ts","../../../lib/src/modules/ldw-mat-image-gallery.module.ts","../../../lib/src/modules/ldw-mat-image-uploader.module.ts","../../../lib/src/ldw-framework-material-media.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { ChangeDetectorRef, Component, inject } from '@angular/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';\nimport { MatIconModule } from '@angular/material/icon';\nimport { LDuAnguBootTranslationPipe } from '@ldu-anguboot/i18n';\nimport { LDwMaterialMediaModel } from '../models/ldw-mat-media.model';\n\n@Component({\n selector: 'ldw-mat-image-upload-dialog',\n host: { class: 'ldw-mat-image-upload-dialog' },\n imports: [\n CommonModule,\n MatButtonModule,\n MatIconModule,\n MatDialogModule,\n LDuAnguBootTranslationPipe,\n ],\n template: `\n <h2 mat-dialog-title>{{ 'LDU_ANGUBOOT_IMG_UPLOAD_DIALOG.title' | i18n }}</h2>\n <mat-dialog-content>\n <input class=\"ldw-mat-image-uploader-hidden-input\"\n #uploader type=\"file\"\n [style.display]=\"'none'\"\n (change)=\"onFileChange($event)\"\n />\n <div class=\"ldw-mat-image-uploader--instance\"\n [style.backgroundImage]=\"$backgroundImage\"\n (keypress)=\"uploader.click()\"\n (click)=\"uploader.click()\"\n >@if ($noData) {\n <mat-icon>image</mat-icon> }\n </div>\n </mat-dialog-content>\n <mat-dialog-actions>\n <button\n class=\"ldw-mat-image-uploader-save\"\n matButton\n cdkFocusInitial\n (click)=\"onSaveClick()\"\n >{{ 'LDU_ANGUBOOT_IMG_UPLOAD_DIALOG.btnSave' | i18n }}</button>\n <button class=\"ldw-mat-image-uploader-cancel\"\n matButton\n (click)=\"onCancelClick()\"\n >{{ 'LDU_ANGUBOOT_IMG_UPLOAD_DIALOG.btnCancel' | i18n }}</button>\n </mat-dialog-actions>\n`})\nexport class LDwMaterialImageUploadDialogComponent {\n\n readonly dialogRef = inject(MatDialogRef<LDwMaterialImageUploadDialogComponent>);\n\n readonly data = inject<LDwMaterialMediaModel>(MAT_DIALOG_DATA);\n\n readonly cdr = inject(ChangeDetectorRef);\n\n ngOnInit() {\n console.log(this.data)\n }\n\n onSaveClick() {\n this.dialogRef.close(this.data);\n }\n\n onCancelClick() {\n this.dialogRef.close(false);\n }\n\n onFileChange($event: any) {\n const files = $event?.target?.files;\n if (files?.[0]) {\n const picture = files[0];\n const reader = new FileReader();\n reader.readAsDataURL(picture);\n reader.onload = () => {\n this.data.imgBase64 = (reader.result as string).toString();\n this.cdr.detectChanges();\n };\n }\n }\n\n get $backgroundImage() {\n if (this.data.imgBase64) {\n return 'url(' + this.data.imgBase64 + ')';\n }\n if (this.data.imgSrc) {\n return 'url(' + this.data.imgSrc + ')';\n }\n return '';\n }\n\n get $noData() {\n return !this.data?.imgBase64 && !this.data?.imgSrc;\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const LDW_MAT_MEDIA_API = new InjectionToken<{\n url: string;\n}>('LDW_MAT_MEDIA_API');\n","import { inject, Injectable } from '@angular/core';\nimport { MatDialog } from '@angular/material/dialog';\nimport { LDuAnguBootApiService } from '@ldu-anguboot/http';\nimport { firstValueFrom } from 'rxjs';\nimport { LDwMaterialImageGalleryDialogComponent } from '../components/ldw-mat-image-gallery-dialog.component';\nimport { LDwMaterialImageUploadDialogComponent } from '../components/ldw-mat-image-upload-dialog.component';\nimport { LDW_MAT_MEDIA_API } from '../config/ldw-mat-media.config';\nimport { LDwMaterialMediaModel } from '../models/ldw-mat-media.model';\n\n@Injectable({ providedIn: 'root' })\nexport class LDwMaterialMediaService {\n\n private readonly MEDIA_API$ = inject(LDW_MAT_MEDIA_API);\n\n private readonly lduApiService$ = inject(LDuAnguBootApiService);\n\n private readonly matDialog$ = inject(MatDialog);\n\n async uploadImage(uploadUrl: string, uploadConfig?: {\n height?: string;\n width?: string;\n maxHeight?: string;\n maxWidth?: string;\n }, type: 'jpg' | 'png' = 'jpg', data?: LDwMaterialMediaModel) {\n const config = {\n height: uploadConfig?.height ?? 'calc(100% - 1rem)',\n width: uploadConfig?.width ?? 'calc(100% - 1rem)',\n maxHeight: uploadConfig?.maxHeight ?? '100%',\n maxWidth: uploadConfig?.maxWidth ?? '100%',\n panelClass: 'ldw-mat-image-upload-dialog-panel',\n data: {\n imgAlt: data?.imgAlt,\n imgSrc: data?.imgSrc,\n imgBase64: data?.imgBase64,\n },\n };\n const media = await firstValueFrom(this.matDialog.open(LDwMaterialImageUploadDialogComponent, config).afterClosed());\n if (media?.imgBase64) {\n const response = await firstValueFrom(this.apiService.PUT<LDwMaterialMediaModel>(uploadUrl, media));\n if (response?.id) {\n switch (type) {\n case 'jpg':\n return this.apiService.url(`${this.ENV.url}/${response.id}.jpg?t=${Date.now()}`);\n case 'png':\n return this.apiService.url(`${this.ENV.url}/${response.id}.png?t=${Date.now()}`);\n default:\n break;\n }\n }\n }\n return null;\n }\n\n async deleteImage(deleteUrl: string) {\n return firstValueFrom(this.apiService.DELETE(`${deleteUrl}`));\n }\n\n async getGallery(galleryUrl: string) {\n return firstValueFrom(this.apiService.GET(`${galleryUrl}`));\n }\n\n openGallery(galleryUrl: string, galleryConfig?: {\n height?: string;\n width?: string;\n maxHeight?: string;\n maxWidth?: string;\n }) {\n const config = {\n height: galleryConfig?.height ?? 'calc(100% - 1rem)',\n width: galleryConfig?.width ?? 'calc(100% - 1rem)',\n maxHeight: galleryConfig?.maxHeight ?? '100%',\n maxWidth: galleryConfig?.maxWidth ?? '100%',\n panelClass: 'ldw-mat-image-gallery-dialog-panel',\n data: { galleryUrl },\n };\n return this.matDialog.open(LDwMaterialImageGalleryDialogComponent, config);\n }\n\n async uploadGallery(galleryUrl: string, imgBase64: string | null | undefined, type: 'jpg' | 'png' = 'jpg') {\n if (imgBase64) {\n const response = await firstValueFrom(this.apiService.PUT<LDwMaterialMediaModel>(galleryUrl, { imgBase64 }));\n if (response?.id) {\n switch (type) {\n case 'jpg':\n return this.apiService.url(`${this.ENV.url}/${response.id}.jpg?t=${Date.now()}`);\n case 'png':\n return this.apiService.url(`${this.ENV.url}/${response.id}.png?t=${Date.now()}`);\n default:\n break;\n }\n }\n }\n return null;\n }\n\n async deleteGallery(galleryUrl: string) {\n return firstValueFrom(this.apiService.DELETE(`${galleryUrl}`));\n }\n\n get ENV() { return this.MEDIA_API$; }\n\n get apiService() { return this.lduApiService$; }\n\n get matDialog() { return this.matDialog$; }\n}\n","import { CommonModule } from '@angular/common';\nimport { ChangeDetectorRef, Component, inject, OnInit } from '@angular/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';\nimport { MatIconModule } from '@angular/material/icon';\nimport { LDuAnguBootTranslationPipe } from '@ldu-anguboot/i18n';\nimport { LDwMaterialGalleryModel, LDwMaterialMediaModel } from '../models/ldw-mat-media.model';\nimport { LDwMaterialMediaService } from '../services/ldw-mat-media.service';\n\n@Component({\n selector: 'ldw-mat-image-gallery-dialog',\n host: { class: 'ldw-mat-image-gallery-dialog' },\n imports: [\n CommonModule,\n MatButtonModule,\n MatIconModule,\n MatDialogModule,\n LDuAnguBootTranslationPipe,\n ],\n template: `\n <h2 mat-dialog-title>{{ 'LDU_ANGUBOOT_IMG_GALLERY_DIALOG.title' | i18n }}</h2>\n <mat-dialog-content>\n <input class=\"ldw-mat-image-gallery-hidden-input\"\n #uploader type=\"file\"\n [style.display]=\"'none'\"\n (change)=\"onFileChange($event)\"\n />\n <div class=\"ldw-mat-image-gallery--instance\">\n <div class=\"ldw-mat-image-gallery-item ldw-mat-image-gallery-item--upload\">\n <mat-icon\n (keypress)=\"uploader.click()\"\n (click)=\"uploader.click()\"\n >add</mat-icon>\n </div>\n @for (image of gallery; track image.id)\n {\n <div class=\"ldw-mat-image-gallery-item\">\n <a [href]=\"image.imgSrc\" target=\"_blank\">\n <img [src]=\"image.imgSrc\" [alt]=\"image.imgAlt\" />\n </a>\n <mat-icon\n (keypress)=\"onDeleteClick(image.id)\"\n (click)=\"onDeleteClick(image.id)\"\n >delete</mat-icon>\n </div>\n }\n @empty\n {\n <mat-icon>image</mat-icon>\n }\n </div>\n </mat-dialog-content>\n <mat-dialog-actions>\n <button\n class=\"ldw-mat-image-gallery-save\"\n matButton\n (click)=\"onSaveClick()\"\n >{{ 'LDU_ANGUBOOT_IMG_GALLERY_DIALOG.btnSave' | i18n }}</button>\n <button\n class=\"ldw-mat-image-gallery-cancel\"\n matButton\n (click)=\"onCancelClick()\"\n >{{ 'LDU_ANGUBOOT_IMG_GALLERY_DIALOG.btnCancel' | i18n }}</button>\n </mat-dialog-actions>\n`})\nexport class LDwMaterialImageGalleryDialogComponent implements OnInit {\n\n protected readonly service = inject(LDwMaterialMediaService);\n\n protected readonly cdr = inject(ChangeDetectorRef);\n\n readonly dialogRef = inject(MatDialogRef<LDwMaterialImageGalleryDialogComponent>);\n\n readonly data = inject<LDwMaterialGalleryModel>(MAT_DIALOG_DATA);\n\n gallery: LDwMaterialMediaModel[] = [];\n\n ngOnInit() {\n this.load();\n }\n\n onSaveClick() {\n this.dialogRef.close(true);\n }\n\n onCancelClick() {\n this.dialogRef.close(false);\n }\n\n onFileChange($event: any) {\n const files = $event?.target?.files;\n if (files?.[0]) {\n const picture = files[0];\n const reader = new FileReader();\n reader.readAsDataURL(picture);\n reader.onload = () => {\n const imgBase64 = (reader.result as string).toString();\n this.service.uploadGallery(this.data.galleryUrl, imgBase64).then(() => this.load());\n };\n }\n }\n\n onDeleteClick(id: number | null | undefined) {\n this.service.deleteGallery(`${this.data.galleryUrl}/${id}`).then(() => this.load());\n }\n\n protected async load() {\n const response = await this.service.getGallery(this.data.galleryUrl);\n this.gallery = response as LDwMaterialMediaModel[];\n this.cdr.detectChanges();\n }\n}\n","import { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { CommonModule } from '@angular/common';\nimport { Component, inject, Input } from '@angular/core';\nimport { FormControl, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatInputModule } from '@angular/material/input';\nimport { LDwMaterialMediaService } from '../services/ldw-mat-media.service';\n\n@Component({\n selector: 'ldw-mat-image-uploader',\n host: { class: 'ldw-mat-image-uploader' },\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n MatButtonModule,\n MatFormFieldModule,\n MatInputModule,\n MatIconModule,\n ],\n template: `\n <form\n [formGroup]=\"formParent\"\n novalidate\n ><mat-form-field\n [appearance]=\"appearance\"\n ><mat-label\n [innerHTML]=\"label\" />\n <input matInput\n [name]=\"name\"\n [formControlName]=\"formParentControlName\"\n [readonly]=\"readonly\"\n [required]=\"required\"\n />\n @if (dimensions)\n {\n <mat-hint>{{ dimensions }}.{{ type }}</mat-hint>\n }\n <div matSuffix>\n @if (control.value)\n {\n <a matIconButton\n [href]=\"control.value\"\n target=\"_blank\"\n ><mat-icon>visibility</mat-icon>\n </a>\n }\n <button matIconButton\n (click)=\"onUploadClick()\"\n ><mat-icon>add_photo_alternate</mat-icon>\n </button>\n <button matIconButton\n (click)=\"onDeleteClick()\"\n ><mat-icon>delete</mat-icon>\n </button>\n </div>\n <ng-content/>\n </mat-form-field>\n </form>\n`})\nexport class LDwMaterialImageUploaderComponent {\n\n protected readonly service = inject(LDwMaterialMediaService);\n\n protected readonly$: string | boolean = false;\n\n protected required$: string | boolean = false;\n\n @Input({ required: true })\n formParent: FormGroup = new FormGroup({\n value: new FormControl<string | null | undefined>(null, [])\n });\n\n @Input({ required: true })\n formParentControlName = 'value';\n\n @Input({ required: true })\n label = 'Value';\n\n @Input()\n appearance: 'fill' | 'outline' = 'outline';\n\n @Input()\n name = 'value';\n\n @Input()\n type: 'jpg' | 'png' = 'jpg';\n\n @Input()\n dimensions: string | null | undefined;\n\n @Input()\n api: string | null | undefined;\n\n @Input()\n set readonly(v) { this.readonly$ = coerceBooleanProperty(v); }\n\n @Input()\n set required(v) { this.required$ = coerceBooleanProperty(v); }\n\n async onUploadClick() {\n if (this.api) {\n const mediaUrl = await this.service.uploadImage(`${this.api}`);\n if (mediaUrl) {\n this.control.setValue(mediaUrl);\n }\n }\n }\n\n async onDeleteClick() {\n if (this.api) {\n await this.service.deleteImage(this.api);\n }\n this.control.setValue(null);\n }\n\n get readonly() { return this.readonly$; };\n\n get required() { return this.required$; };\n\n get control() {\n return this.formParent?.get(this.formParentControlName) as FormControl<string | null | undefined>;\n }\n}\n","import { NgModule } from '@angular/core';\nimport { LDwMaterialImageGalleryDialogComponent } from '../components/ldw-mat-image-gallery-dialog.component';\n\nconst components = [\n LDwMaterialImageGalleryDialogComponent,\n];\n\n@NgModule({\n imports: [...components],\n exports: [...components]\n})\nexport class LDwMaterialImageGalleryModule { }\n","import { NgModule } from '@angular/core';\nimport { LDwMaterialImageUploadDialogComponent } from '../components/ldw-mat-image-upload-dialog.component';\nimport { LDwMaterialImageUploaderComponent } from '../components/ldw-mat-image-uploader.component';\n\nconst components = [\n LDwMaterialImageUploadDialogComponent,\n LDwMaterialImageUploaderComponent,\n];\n\n@NgModule({\n imports: [...components],\n exports: [...components]\n})\nexport class LDwMaterialImageUploaderModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1","i2","i3","i5","components"],"mappings":";;;;;;;;;;;;;;;;;;;;MA+Ca,qCAAqC,CAAA;AAErC,IAAA,SAAS,GAAG,MAAM,EAAC,YAAmD,EAAC;AAEvE,IAAA,IAAI,GAAG,MAAM,CAAwB,eAAe,CAAC;AAErD,IAAA,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC;IAExC,QAAQ,GAAA;AACJ,QAAA,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;IAC1B;IAEA,WAAW,GAAA;QACP,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;IACnC;IAEA,aAAa,GAAA;AACT,QAAA,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC;IAC/B;AAEA,IAAA,YAAY,CAAC,MAAW,EAAA;AACpB,QAAA,MAAM,KAAK,GAAG,MAAM,EAAE,MAAM,EAAE,KAAK;AACnC,QAAA,IAAI,KAAK,GAAG,CAAC,CAAC,EAAE;AACZ,YAAA,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC;AACxB,YAAA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
3
+ "version": "0.5.0",
4
4
  "peerDependencies": {
5
+ "@angular/cdk": "^21.0.0",
5
6
  "@angular/common": "^21.0.0",
6
7
  "@angular/core": "^21.0.0",
8
+ "@angular/forms": "^21.0.0",
7
9
  "@angular/material": "^21.0.0",
8
10
  "@ldu-anguboot/http": "latest",
9
11
  "@ldu-anguboot/i18n": "latest",
@@ -1,3 +1,15 @@
1
+ .ldw-mat-image-upload-dialog-panel,
2
+ .ldw-mat-image-gallery-dialog-panel {
3
+
4
+ .mat-mdc-dialog-surface {
5
+ border-radius: 0px !important;
6
+ }
7
+
8
+ .mat-mdc-dialog-content {
9
+ max-height: 100%;
10
+ }
11
+ }
12
+
1
13
  .ldw-mat-image-upload-dialog {
2
14
 
3
15
  .ldw-mat-image-uploader--instance {
@@ -27,16 +39,72 @@
27
39
  opacity: 0.925;
28
40
  }
29
41
  }
42
+ }
43
+
44
+ .ldw-mat-image-gallery-dialog {
30
45
 
31
- .mat-mdc-dialog-actions {
32
- h2 {
33
- margin-right: auto;
46
+ .ldw-mat-image-gallery--instance {
47
+ background-color: #eaeaea;
48
+ background-position: center;
49
+ background-repeat: no-repeat;
50
+ background-size: contain;
51
+ border-width: 1px;
52
+ border-style: dotted;
53
+ border-color: inherit;
54
+ height: calc(100% - 2px);
55
+ width: calc(100% - 2px);
56
+ position: relative;
57
+ display: flex;
58
+ flex-direction: row;
59
+ flex-wrap: wrap;
60
+ justify-content: center;
61
+ overflow: auto;
62
+
63
+ .ldw-mat-image-gallery-item {
64
+ position: relative;
65
+ width: calc(33% - 2rem);
66
+ height: calc(33% - 2rem);
67
+ margin: 1rem;
68
+
69
+ img {
70
+ width: 100%;
71
+ height: 100%;
72
+ }
73
+
74
+ mat-icon {
75
+ display: none;
76
+ position: absolute;
77
+ top: 1rem;
78
+ right: 1rem;
79
+ background-color: white;
80
+ border-radius: 50%;
81
+ padding: 1rem;
82
+ }
83
+
84
+ &:hover {
85
+ cursor: pointer;
86
+
87
+ img {
88
+ opacity: 0.5;
89
+ }
90
+
91
+ mat-icon {
92
+ display: block;
93
+ }
94
+ }
34
95
  }
35
- }
36
96
 
37
- .mat-mdc-dialog-content {
38
- max-height: 100%;
39
- padding-top: 0px !important;
40
- margin-bottom: 2rem;
97
+ .ldw-mat-image-gallery-item--upload {
98
+ background-color: white;
99
+
100
+ mat-icon {
101
+ display: block;
102
+ position: absolute;
103
+ top: 50%;
104
+ left: 50%;
105
+ transform: translate(-50%, -50%);
106
+ border-radius: 0;
107
+ }
108
+ }
41
109
  }
42
110
  }
@@ -1,21 +1,73 @@
1
1
  import * as i0 from '@angular/core';
2
- import { ChangeDetectorRef, InjectionToken } from '@angular/core';
3
- import { MatDialogRef } from '@angular/material/dialog';
2
+ import { OnInit, ChangeDetectorRef, InjectionToken } from '@angular/core';
3
+ import * as _angular_material_dialog from '@angular/material/dialog';
4
+ import { MatDialog, MatDialogRef } from '@angular/material/dialog';
5
+ import { LDuAnguBootApiService } from '@ldu-anguboot/http';
4
6
  import { FormGroup, FormControl } from '@angular/forms';
5
7
 
6
8
  interface LDwMaterialMediaModel {
7
9
  id?: number;
10
+ imgAlt?: string;
8
11
  imgSrc?: string;
9
12
  imgBase64?: string;
10
13
  }
14
+ interface LDwMaterialGalleryModel {
15
+ galleryUrl: string;
16
+ }
17
+
18
+ declare class LDwMaterialMediaService {
19
+ private readonly MEDIA_API$;
20
+ private readonly lduApiService$;
21
+ private readonly matDialog$;
22
+ uploadImage(uploadUrl: string, uploadConfig?: {
23
+ height?: string;
24
+ width?: string;
25
+ maxHeight?: string;
26
+ maxWidth?: string;
27
+ }, type?: 'jpg' | 'png', data?: LDwMaterialMediaModel): Promise<string | null>;
28
+ deleteImage(deleteUrl: string): Promise<unknown>;
29
+ getGallery(galleryUrl: string): Promise<unknown>;
30
+ openGallery(galleryUrl: string, galleryConfig?: {
31
+ height?: string;
32
+ width?: string;
33
+ maxHeight?: string;
34
+ maxWidth?: string;
35
+ }): _angular_material_dialog.MatDialogRef<LDwMaterialImageGalleryDialogComponent, any>;
36
+ uploadGallery(galleryUrl: string, imgBase64: string | null | undefined, type?: 'jpg' | 'png'): Promise<string | null>;
37
+ deleteGallery(galleryUrl: string): Promise<unknown>;
38
+ get ENV(): {
39
+ url: string;
40
+ };
41
+ get apiService(): LDuAnguBootApiService;
42
+ get matDialog(): MatDialog;
43
+ static ɵfac: i0.ɵɵFactoryDeclaration<LDwMaterialMediaService, never>;
44
+ static ɵprov: i0.ɵɵInjectableDeclaration<LDwMaterialMediaService>;
45
+ }
46
+
47
+ declare class LDwMaterialImageGalleryDialogComponent implements OnInit {
48
+ protected readonly service: LDwMaterialMediaService;
49
+ protected readonly cdr: ChangeDetectorRef;
50
+ readonly dialogRef: MatDialogRef<any, any>;
51
+ readonly data: LDwMaterialGalleryModel;
52
+ gallery: LDwMaterialMediaModel[];
53
+ ngOnInit(): void;
54
+ onSaveClick(): void;
55
+ onCancelClick(): void;
56
+ onFileChange($event: any): void;
57
+ onDeleteClick(id: number | null | undefined): void;
58
+ protected load(): Promise<void>;
59
+ static ɵfac: i0.ɵɵFactoryDeclaration<LDwMaterialImageGalleryDialogComponent, never>;
60
+ static ɵcmp: i0.ɵɵComponentDeclaration<LDwMaterialImageGalleryDialogComponent, "ldw-mat-image-gallery-dialog", never, {}, {}, never, never, true, never>;
61
+ }
11
62
 
12
63
  declare class LDwMaterialImageUploadDialogComponent {
13
64
  readonly dialogRef: MatDialogRef<any, any>;
14
65
  readonly data: LDwMaterialMediaModel;
15
66
  readonly cdr: ChangeDetectorRef;
67
+ ngOnInit(): void;
16
68
  onSaveClick(): void;
17
69
  onCancelClick(): void;
18
- onChange($event: any): void;
70
+ onFileChange($event: any): void;
19
71
  get $backgroundImage(): string;
20
72
  get $noData(): boolean;
21
73
  static ɵfac: i0.ɵɵFactoryDeclaration<LDwMaterialImageUploadDialogComponent, never>;
@@ -23,9 +75,9 @@ declare class LDwMaterialImageUploadDialogComponent {
23
75
  }
24
76
 
25
77
  declare class LDwMaterialImageUploaderComponent {
26
- private readonly service;
27
- private readonly$;
28
- private required$;
78
+ protected readonly service: LDwMaterialMediaService;
79
+ protected readonly$: string | boolean;
80
+ protected required$: string | boolean;
29
81
  formParent: FormGroup;
30
82
  formParentControlName: string;
31
83
  label: string;
@@ -49,24 +101,17 @@ declare const LDW_MAT_MEDIA_API: InjectionToken<{
49
101
  url: string;
50
102
  }>;
51
103
 
104
+ declare class LDwMaterialImageGalleryModule {
105
+ static ɵfac: i0.ɵɵFactoryDeclaration<LDwMaterialImageGalleryModule, never>;
106
+ static ɵmod: i0.ɵɵNgModuleDeclaration<LDwMaterialImageGalleryModule, never, [typeof LDwMaterialImageGalleryDialogComponent], [typeof LDwMaterialImageGalleryDialogComponent]>;
107
+ static ɵinj: i0.ɵɵInjectorDeclaration<LDwMaterialImageGalleryModule>;
108
+ }
109
+
52
110
  declare class LDwMaterialImageUploaderModule {
53
111
  static ɵfac: i0.ɵɵFactoryDeclaration<LDwMaterialImageUploaderModule, never>;
54
112
  static ɵmod: i0.ɵɵNgModuleDeclaration<LDwMaterialImageUploaderModule, never, [typeof LDwMaterialImageUploadDialogComponent, typeof LDwMaterialImageUploaderComponent], [typeof LDwMaterialImageUploadDialogComponent, typeof LDwMaterialImageUploaderComponent]>;
55
113
  static ɵinj: i0.ɵɵInjectorDeclaration<LDwMaterialImageUploaderModule>;
56
114
  }
57
115
 
58
- declare class LDwMaterialMediaService {
59
- private readonly MEDIA_API$;
60
- private readonly lduApiService;
61
- private readonly matDialog;
62
- uploadImage(uploadUrl: string, type?: 'jpg' | 'png', data?: LDwMaterialMediaModel): Promise<string | null>;
63
- clearImage(api: string): Promise<unknown>;
64
- get ENV(): {
65
- url: string;
66
- };
67
- static ɵfac: i0.ɵɵFactoryDeclaration<LDwMaterialMediaService, never>;
68
- static ɵprov: i0.ɵɵInjectableDeclaration<LDwMaterialMediaService>;
69
- }
70
-
71
- export { LDW_MAT_MEDIA_API, LDwMaterialImageUploadDialogComponent, LDwMaterialImageUploaderComponent, LDwMaterialImageUploaderModule, LDwMaterialMediaService };
72
- export type { LDwMaterialMediaModel };
116
+ export { LDW_MAT_MEDIA_API, LDwMaterialImageGalleryDialogComponent, LDwMaterialImageGalleryModule, LDwMaterialImageUploadDialogComponent, LDwMaterialImageUploaderComponent, LDwMaterialImageUploaderModule, LDwMaterialMediaService };
117
+ export type { LDwMaterialGalleryModel, LDwMaterialMediaModel };