@ldw-framework/material-media 0.1.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.
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, ChangeDetectorRef, Component, Injectable } from '@angular/core';
|
|
4
|
+
import * as i1 from '@angular/material/button';
|
|
5
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
6
|
+
import * as i3 from '@angular/material/dialog';
|
|
7
|
+
import { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule, MatDialog } from '@angular/material/dialog';
|
|
8
|
+
import * as i2 from '@angular/material/icon';
|
|
9
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
10
|
+
import { LDuAnguBootTranslationPipe } from '@ldu-anguboot/i18n';
|
|
11
|
+
import { LDuAnguBootApiService } from '@ldu-anguboot/http';
|
|
12
|
+
import { firstValueFrom } from 'rxjs';
|
|
13
|
+
|
|
14
|
+
class LDwMaterialImageUploadDialogComponent {
|
|
15
|
+
dialogRef = inject((MatDialogRef));
|
|
16
|
+
data = inject(MAT_DIALOG_DATA);
|
|
17
|
+
cdr = inject(ChangeDetectorRef);
|
|
18
|
+
onSaveClick() {
|
|
19
|
+
this.dialogRef.close(this.data);
|
|
20
|
+
}
|
|
21
|
+
onCancelClick() {
|
|
22
|
+
this.dialogRef.close(false);
|
|
23
|
+
}
|
|
24
|
+
onChange($event) {
|
|
25
|
+
const files = $event?.target?.files;
|
|
26
|
+
if (files?.[0]) {
|
|
27
|
+
const picture = files[0];
|
|
28
|
+
const reader = new FileReader();
|
|
29
|
+
reader.readAsDataURL(picture);
|
|
30
|
+
reader.onload = () => {
|
|
31
|
+
this.data.imgBase64 = reader.result.toString();
|
|
32
|
+
this.cdr.detectChanges();
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
get $backgroundImage() {
|
|
37
|
+
if (this.data.imgBase64) {
|
|
38
|
+
return 'url(' + this.data.imgBase64 + ')';
|
|
39
|
+
}
|
|
40
|
+
if (this.data.imgSrc) {
|
|
41
|
+
return 'url(' + this.data.imgSrc + ')';
|
|
42
|
+
}
|
|
43
|
+
return '';
|
|
44
|
+
}
|
|
45
|
+
get $noData() {
|
|
46
|
+
return !this.data?.imgBase64 && !this.data?.imgSrc;
|
|
47
|
+
}
|
|
48
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: LDwMaterialImageUploadDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
49
|
+
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: `
|
|
50
|
+
<mat-dialog-actions>
|
|
51
|
+
<h2>{{ 'LDU_ANGUBOOT_IMG_UPLOAD_DIALOG.title' | i18n }}</h2>
|
|
52
|
+
<button class="ldw-mat-image-uploader-save"
|
|
53
|
+
matButton
|
|
54
|
+
cdkFocusInitial
|
|
55
|
+
(click)="onSaveClick()"
|
|
56
|
+
>{{ 'LDU_ANGUBOOT_IMG_UPLOAD_DIALOG.btnSave' | i18n }}</button>
|
|
57
|
+
<button class="ldw-mat-image-uploader-cancel"
|
|
58
|
+
matButton
|
|
59
|
+
(click)="onCancelClick()"
|
|
60
|
+
>{{ 'LDU_ANGUBOOT_IMG_UPLOAD_DIALOG.btnCancel' | i18n }}</button>
|
|
61
|
+
</mat-dialog-actions>
|
|
62
|
+
<mat-dialog-content>
|
|
63
|
+
<input class="ldw-mat-image-uploader-hidden-input"
|
|
64
|
+
#uploader type="file"
|
|
65
|
+
[style.display]="'none'"
|
|
66
|
+
(change)="onChange($event)"
|
|
67
|
+
/>
|
|
68
|
+
<div class="ldw-mat-image-uploader"
|
|
69
|
+
[style.backgroundImage]="$backgroundImage"
|
|
70
|
+
(keypress)="uploader.click()"
|
|
71
|
+
(click)="uploader.click()"
|
|
72
|
+
>@if ($noData) { <mat-icon>image</mat-icon> }
|
|
73
|
+
</div>
|
|
74
|
+
</mat-dialog-content>
|
|
75
|
+
`, 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" }] });
|
|
76
|
+
}
|
|
77
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: LDwMaterialImageUploadDialogComponent, decorators: [{
|
|
78
|
+
type: Component,
|
|
79
|
+
args: [{
|
|
80
|
+
selector: 'ldw-mat-image-upload-dialog',
|
|
81
|
+
host: { class: 'ldw-mat-image-upload-dialog' },
|
|
82
|
+
imports: [
|
|
83
|
+
CommonModule,
|
|
84
|
+
MatButtonModule,
|
|
85
|
+
MatIconModule,
|
|
86
|
+
MatDialogModule,
|
|
87
|
+
LDuAnguBootTranslationPipe,
|
|
88
|
+
],
|
|
89
|
+
template: `
|
|
90
|
+
<mat-dialog-actions>
|
|
91
|
+
<h2>{{ 'LDU_ANGUBOOT_IMG_UPLOAD_DIALOG.title' | i18n }}</h2>
|
|
92
|
+
<button class="ldw-mat-image-uploader-save"
|
|
93
|
+
matButton
|
|
94
|
+
cdkFocusInitial
|
|
95
|
+
(click)="onSaveClick()"
|
|
96
|
+
>{{ 'LDU_ANGUBOOT_IMG_UPLOAD_DIALOG.btnSave' | i18n }}</button>
|
|
97
|
+
<button class="ldw-mat-image-uploader-cancel"
|
|
98
|
+
matButton
|
|
99
|
+
(click)="onCancelClick()"
|
|
100
|
+
>{{ 'LDU_ANGUBOOT_IMG_UPLOAD_DIALOG.btnCancel' | i18n }}</button>
|
|
101
|
+
</mat-dialog-actions>
|
|
102
|
+
<mat-dialog-content>
|
|
103
|
+
<input class="ldw-mat-image-uploader-hidden-input"
|
|
104
|
+
#uploader type="file"
|
|
105
|
+
[style.display]="'none'"
|
|
106
|
+
(change)="onChange($event)"
|
|
107
|
+
/>
|
|
108
|
+
<div class="ldw-mat-image-uploader"
|
|
109
|
+
[style.backgroundImage]="$backgroundImage"
|
|
110
|
+
(keypress)="uploader.click()"
|
|
111
|
+
(click)="uploader.click()"
|
|
112
|
+
>@if ($noData) { <mat-icon>image</mat-icon> }
|
|
113
|
+
</div>
|
|
114
|
+
</mat-dialog-content>
|
|
115
|
+
`
|
|
116
|
+
}]
|
|
117
|
+
}] });
|
|
118
|
+
|
|
119
|
+
class LDwMaterialMediaService {
|
|
120
|
+
lduApiService = inject(LDuAnguBootApiService);
|
|
121
|
+
matDialog = inject(MatDialog);
|
|
122
|
+
async uploadImage(url, data) {
|
|
123
|
+
const media = await firstValueFrom(this.matDialog.open(LDwMaterialImageUploadDialogComponent, {
|
|
124
|
+
height: 'calc(100% - 1rem)',
|
|
125
|
+
width: 'calc(100% - 1rem)',
|
|
126
|
+
maxHeight: '100%',
|
|
127
|
+
maxWidth: '100%',
|
|
128
|
+
data: {
|
|
129
|
+
imgSrc: data?.imgSrc,
|
|
130
|
+
imgBase64: data?.imgBase64,
|
|
131
|
+
},
|
|
132
|
+
}).afterClosed());
|
|
133
|
+
if (media?.imgBase64) {
|
|
134
|
+
const response = await firstValueFrom(this.lduApiService.PUT(url, media));
|
|
135
|
+
if (response?.id) {
|
|
136
|
+
return `${url}/${response.id}.jpg?t=${Date.now()}`;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: LDwMaterialMediaService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
142
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: LDwMaterialMediaService, providedIn: 'root' });
|
|
143
|
+
}
|
|
144
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: LDwMaterialMediaService, decorators: [{
|
|
145
|
+
type: Injectable,
|
|
146
|
+
args: [{ providedIn: 'root' }]
|
|
147
|
+
}] });
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Generated bundle index. Do not edit.
|
|
151
|
+
*/
|
|
152
|
+
|
|
153
|
+
export { LDwMaterialImageUploadDialogComponent, LDwMaterialMediaService };
|
|
154
|
+
//# sourceMappingURL=ldw-framework-material-media.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ldw-framework-material-media.mjs","sources":["../../../lib/src/components/ldw-mat-image-upload-dialog.component.ts","../../../lib/src/services/ldw-mat-media.service.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\"\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 { 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 { LDwMaterialMediaModel } from '../models/ldw-mat-media.model';\n\n@Injectable({ providedIn: 'root' })\nexport class LDwMaterialMediaService {\n\n private readonly lduApiService = inject(LDuAnguBootApiService);\n\n private readonly matDialog = inject(MatDialog);\n\n async uploadImage(url: string, 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>(url, media));\n if (response?.id) {\n return `${url}/${response.id}.jpg?t=${Date.now()}`;\n }\n }\n return null;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"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,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC;IAC/B;AAEA,IA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M,EAAE;;;ACPlC;;AAEG;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ldw-framework/material-media",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^21.0.0",
|
|
6
|
+
"@angular/core": "^21.0.0",
|
|
7
|
+
"@angular/material": "^21.0.0",
|
|
8
|
+
"@ldu-anguboot/http": "latest",
|
|
9
|
+
"@ldu-anguboot/i18n": "latest",
|
|
10
|
+
"rxjs": "~7.8.0"
|
|
11
|
+
},
|
|
12
|
+
"module": "fesm2022/ldw-framework-material-media.mjs",
|
|
13
|
+
"typings": "types/ldw-framework-material-media.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
"./package.json": {
|
|
16
|
+
"default": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./types/ldw-framework-material-media.d.ts",
|
|
20
|
+
"default": "./fesm2022/ldw-framework-material-media.mjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"tslib": "^2.3.0"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.ldw-mat-image-uploader {
|
|
2
|
+
background-color: #eaeaea;
|
|
3
|
+
background-position: center;
|
|
4
|
+
background-repeat: no-repeat;
|
|
5
|
+
background-size: contain;
|
|
6
|
+
border-width: 1px;
|
|
7
|
+
border-style: dotted;
|
|
8
|
+
border-color: inherit;
|
|
9
|
+
height: calc(100% - 2px);
|
|
10
|
+
width: calc(100% - 2px);
|
|
11
|
+
position: relative;
|
|
12
|
+
|
|
13
|
+
.mat-icon {
|
|
14
|
+
top: 50%;
|
|
15
|
+
left: 50%;
|
|
16
|
+
transform: translate(-50%, -50%);
|
|
17
|
+
position: absolute;
|
|
18
|
+
font-size: 48px;
|
|
19
|
+
height: 48px;
|
|
20
|
+
width: 48px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&:hover {
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
opacity: 0.925;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.ldw-mat-image-upload-dialog {
|
|
30
|
+
|
|
31
|
+
.mat-mdc-dialog-actions {
|
|
32
|
+
h2 {
|
|
33
|
+
margin-right: auto;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.mat-mdc-dialog-content {
|
|
38
|
+
max-height: 100%;
|
|
39
|
+
padding-top: 0px !important;
|
|
40
|
+
margin-bottom: 2rem;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { ChangeDetectorRef } from '@angular/core';
|
|
3
|
+
import { MatDialogRef } from '@angular/material/dialog';
|
|
4
|
+
|
|
5
|
+
interface LDwMaterialMediaModel {
|
|
6
|
+
id?: number;
|
|
7
|
+
imgSrc?: string;
|
|
8
|
+
imgBase64?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare class LDwMaterialImageUploadDialogComponent {
|
|
12
|
+
readonly dialogRef: MatDialogRef<any, any>;
|
|
13
|
+
readonly data: LDwMaterialMediaModel;
|
|
14
|
+
readonly cdr: ChangeDetectorRef;
|
|
15
|
+
onSaveClick(): void;
|
|
16
|
+
onCancelClick(): void;
|
|
17
|
+
onChange($event: any): void;
|
|
18
|
+
get $backgroundImage(): string;
|
|
19
|
+
get $noData(): boolean;
|
|
20
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LDwMaterialImageUploadDialogComponent, never>;
|
|
21
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LDwMaterialImageUploadDialogComponent, "ldw-mat-image-upload-dialog", never, {}, {}, never, never, true, never>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare class LDwMaterialMediaService {
|
|
25
|
+
private readonly lduApiService;
|
|
26
|
+
private readonly matDialog;
|
|
27
|
+
uploadImage(url: string, data?: LDwMaterialMediaModel): Promise<string | null>;
|
|
28
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LDwMaterialMediaService, never>;
|
|
29
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<LDwMaterialMediaService>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { LDwMaterialImageUploadDialogComponent, LDwMaterialMediaService };
|
|
33
|
+
export type { LDwMaterialMediaModel };
|