@libs-ui/components-inputs-upload 0.1.1-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/avatar/avatar.component.d.ts +16 -0
- package/defines/helper.define.d.ts +2 -0
- package/esm2022/avatar/avatar.component.mjs +44 -0
- package/esm2022/defines/helper.define.mjs +35 -0
- package/esm2022/index.mjs +6 -0
- package/esm2022/interfaces/upload.interface.mjs +2 -0
- package/esm2022/libs-ui-components-inputs-upload.mjs +5 -0
- package/esm2022/pipes/calc-duration-video.pipe.mjs +32 -0
- package/esm2022/pipes/check-file-extension.pipe.mjs +37 -0
- package/esm2022/upload-drop-file.directive.mjs +68 -0
- package/esm2022/upload-file.directive.mjs +54 -0
- package/esm2022/upload.component.mjs +444 -0
- package/fesm2022/libs-ui-components-inputs-upload.mjs +698 -0
- package/fesm2022/libs-ui-components-inputs-upload.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/interfaces/upload.interface.d.ts +26 -0
- package/package.json +40 -0
- package/pipes/calc-duration-video.pipe.d.ts +7 -0
- package/pipes/check-file-extension.pipe.d.ts +8 -0
- package/upload-drop-file.directive.d.ts +18 -0
- package/upload-file.directive.d.ts +14 -0
- package/upload.component.d.ts +90 -0
|
@@ -0,0 +1,698 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Pipe, model, input, output, Optional, Inject, ChangeDetectionStrategy, Component, Directive, inject, ElementRef, signal, computed, viewChild, effect, untracked } from '@angular/core';
|
|
3
|
+
import { LibsUiComponentsButtonsButtonComponent } from '@libs-ui/components-buttons-button';
|
|
4
|
+
import { LibsUiComponentsGalleryViewerComponent } from '@libs-ui/components-gallery';
|
|
5
|
+
import { LibsUiComponentsImageEditorComponent } from '@libs-ui/components-image-editor';
|
|
6
|
+
import { LibsUiComponentsLabelComponent } from '@libs-ui/components-label';
|
|
7
|
+
import { LibsUiComponentsPreviewFileComponent } from '@libs-ui/components-preview-file';
|
|
8
|
+
import { LibsUiComponentsScrollOverlayDirective } from '@libs-ui/components-scroll-overlay';
|
|
9
|
+
import { LibsUiDynamicComponentService } from '@libs-ui/services-dynamic-component';
|
|
10
|
+
import { LibsUiNotificationService } from '@libs-ui/services-notification';
|
|
11
|
+
import { getFileExtension, ImageExtList, VideoExtList, DocumentExtList, LINK_IMAGE_ERROR_TOKEN_INJECT, getLabelBySizeFile, checkMouseOverInContainer, isTypeFile, AudioExtList, isTypeImage, isTypeVideo, isTypeAudio, uuid, convertFileToBase64_ObjectUrl, convertBlobToFile, isIncludeImageExtList, isIncludeVideoExtList, isIncludeAudioExtList, isIncludeDocumentExtList, ERROR_MESSAGE_EMPTY_VALID, downloadFileByUrl } from '@libs-ui/utils';
|
|
12
|
+
import * as i1 from '@ngx-translate/core';
|
|
13
|
+
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
|
14
|
+
import { Subject, fromEvent, takeUntil as takeUntil$1 } from 'rxjs';
|
|
15
|
+
import { NgComponentOutlet, AsyncPipe } from '@angular/common';
|
|
16
|
+
import { LibsUiComponentsSpinnerComponent } from '@libs-ui/components-spinner';
|
|
17
|
+
import { LibsUiIconsGetIconComponentPipe } from '@libs-ui/icons';
|
|
18
|
+
import { LibsUiPipesSecurityTrustPipe } from '@libs-ui/pipes-security-trust';
|
|
19
|
+
import { takeUntil } from 'rxjs/operators';
|
|
20
|
+
|
|
21
|
+
class LibsUiPipesInputsUploadCalcDurationVideoPipe {
|
|
22
|
+
transform(duration) {
|
|
23
|
+
if (!duration) {
|
|
24
|
+
return '0:0';
|
|
25
|
+
}
|
|
26
|
+
duration = Math.round(duration);
|
|
27
|
+
if (duration >= 3600) {
|
|
28
|
+
const hour = Math.floor(duration / 3600);
|
|
29
|
+
const minute = Math.floor((duration - hour * 3600) / 60);
|
|
30
|
+
const second = duration - (hour * 3600 + minute * 60);
|
|
31
|
+
return `${hour}:${minute < 10 ? `0${minute}` : minute}:${second < 10 ? `0${second}` : second}`;
|
|
32
|
+
}
|
|
33
|
+
if (duration >= 60) {
|
|
34
|
+
const minute = Math.floor(duration / 60);
|
|
35
|
+
const second = duration - minute * 60;
|
|
36
|
+
return `${minute}:${second < 10 ? `0${second}` : second}`;
|
|
37
|
+
}
|
|
38
|
+
return `0:${duration}`;
|
|
39
|
+
}
|
|
40
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiPipesInputsUploadCalcDurationVideoPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
41
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: LibsUiPipesInputsUploadCalcDurationVideoPipe, isStandalone: true, name: "LibsUiPipesInputsUploadCalcDurationVideoPipe" });
|
|
42
|
+
}
|
|
43
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiPipesInputsUploadCalcDurationVideoPipe, decorators: [{
|
|
44
|
+
type: Pipe,
|
|
45
|
+
args: [{
|
|
46
|
+
name: 'LibsUiPipesInputsUploadCalcDurationVideoPipe',
|
|
47
|
+
standalone: true,
|
|
48
|
+
}]
|
|
49
|
+
}] });
|
|
50
|
+
|
|
51
|
+
class LibsUiPipesInputsUploadCheckFileExtensionPipe {
|
|
52
|
+
transform(file, type) {
|
|
53
|
+
const fileExtension = getFileExtension(file);
|
|
54
|
+
if (!fileExtension) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
switch (type) {
|
|
58
|
+
case 'image':
|
|
59
|
+
return ImageExtList.includes(fileExtension);
|
|
60
|
+
case 'video':
|
|
61
|
+
return VideoExtList.includes(fileExtension);
|
|
62
|
+
case 'word':
|
|
63
|
+
return ['doc', 'docx', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'].includes(fileExtension);
|
|
64
|
+
case 'xlsx':
|
|
65
|
+
return ['xls', 'xlsx', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'gsheet'].includes(fileExtension);
|
|
66
|
+
case 'pdf':
|
|
67
|
+
return ['pdf', 'application/pdf'].includes(fileExtension);
|
|
68
|
+
case 'pptx':
|
|
69
|
+
return ['ppt', 'pptx', 'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'].includes(fileExtension);
|
|
70
|
+
case 'other':
|
|
71
|
+
return ![...ImageExtList, ...VideoExtList, ...DocumentExtList].includes(fileExtension);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiPipesInputsUploadCheckFileExtensionPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
75
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: LibsUiPipesInputsUploadCheckFileExtensionPipe, isStandalone: true, name: "LibsUiPipesInputsUploadCheckFileExtensionPipe" });
|
|
76
|
+
}
|
|
77
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiPipesInputsUploadCheckFileExtensionPipe, decorators: [{
|
|
78
|
+
type: Pipe,
|
|
79
|
+
args: [{
|
|
80
|
+
name: 'LibsUiPipesInputsUploadCheckFileExtensionPipe',
|
|
81
|
+
standalone: true,
|
|
82
|
+
}]
|
|
83
|
+
}] });
|
|
84
|
+
|
|
85
|
+
class LibsUiComponentsInputsUploadAvatarComponent {
|
|
86
|
+
linkImageError;
|
|
87
|
+
item = model.required();
|
|
88
|
+
showVideoDuration = input();
|
|
89
|
+
disable = input();
|
|
90
|
+
size = input();
|
|
91
|
+
classInclude = input('', { transform: (value) => value ?? '' });
|
|
92
|
+
outOpenPreview = output();
|
|
93
|
+
constructor(linkImageError) {
|
|
94
|
+
this.linkImageError = linkImageError;
|
|
95
|
+
}
|
|
96
|
+
async handlerImageError(event) {
|
|
97
|
+
if (!this.linkImageError) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
event.target.src = this.linkImageError;
|
|
101
|
+
}
|
|
102
|
+
handlerImageClick(event) {
|
|
103
|
+
event.stopPropagation();
|
|
104
|
+
this.outOpenPreview.emit(this.item());
|
|
105
|
+
}
|
|
106
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsInputsUploadAvatarComponent, deps: [{ token: LINK_IMAGE_ERROR_TOKEN_INJECT, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
107
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: LibsUiComponentsInputsUploadAvatarComponent, isStandalone: true, selector: "libs_ui-components-inputs-upload-avatar", inputs: { item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: true, transformFunction: null }, showVideoDuration: { classPropertyName: "showVideoDuration", publicName: "showVideoDuration", isSignal: true, isRequired: false, transformFunction: null }, disable: { classPropertyName: "disable", publicName: "disable", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, classInclude: { classPropertyName: "classInclude", publicName: "classInclude", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { item: "itemChange", outOpenPreview: "outOpenPreview" }, ngImport: i0, template: "<div\n class=\"flex mr-[12px] bg-[#ffffff] rounded-[4px] {{ classInclude() }}\"\n [class.libs-ui-disable]=\"disable() || item().isUploading || item().error\">\n @if (item() | LibsUiPipesInputsUploadCheckFileExtensionPipe: 'image') {\n <div\n [style.width.px]=\"size() || 32\"\n [style.height.px]=\"size() || 32\"\n class=\"relative\">\n @if (item().url || item().origin_url; as url) {\n <img\n [src]=\"url\"\n [style.width.px]=\"size() || 32\"\n [style.height.px]=\"size() || 32\"\n class=\"rounded-[4px] cursor-pointer\"\n alt\n (error)=\"handlerImageError($event)\"\n (click)=\"handlerImageClick($event)\" />\n } @else {\n <libs_ui-components-spinner [size]=\"'medium'\" />\n }\n </div>\n } @else if (item() | LibsUiPipesInputsUploadCheckFileExtensionPipe: 'video') {\n <div\n class=\"relative\"\n [style.width.px]=\"size() || 32\"\n [style.height.px]=\"size() || 32\">\n @if (item().url || item().origin_url) {\n @let constHtmlSrc = item().url || item().origin_url || '';\n <video\n #videoRef\n [style.width.px]=\"size || 32\"\n [style.height.px]=\"size || 32\"\n class=\"rounded-[4px]\"\n preload=\"metadata\"\n [src]=\"constHtmlSrc | LibsUiPipesSecurityTrustPipe: 'resourceUrl'\"></video>\n <div class=\"absolute w-full h-full top-0 bg-[#001433] opacity-40 rounded-[4px]\"></div>\n <div class=\"absolute w-full h-full flex items-center justify-center top-0\">\n <i class=\"text-[#ffffff] libs-ui-icon-play-solid before:!text-[10px]\"></i>\n </div>\n @if (showVideoDuration()) {\n <div class=\"flex text-[5px] absolute bottom-0 right-0 py-[2px] px-[4px] rounded-[4px] bg-[#000000] text-[#ffffff]\">\n {{ videoRef.duration | LibsUiPipesInputsUploadCalcDurationVideoPipe }}\n </div>\n }\n } @else {\n <libs_ui-components-spinner [size]=\"'medium'\" />\n }\n </div>\n } @else if (item() | LibsUiPipesInputsUploadCheckFileExtensionPipe: 'pdf') {\n <ng-container *ngComponentOutlet=\"'pdf' | LibsUiIconsGetIconComponentPipe | async; inputs: { size: size() || 32 }\" />\n } @else if (item() | LibsUiPipesInputsUploadCheckFileExtensionPipe: 'word') {\n <ng-container *ngComponentOutlet=\"'word' | LibsUiIconsGetIconComponentPipe | async; inputs: { size: size() || 32 }\" />\n } @else if (item() | LibsUiPipesInputsUploadCheckFileExtensionPipe: 'pptx') {\n <ng-container *ngComponentOutlet=\"'pptx' | LibsUiIconsGetIconComponentPipe | async; inputs: { size: size() || 32 }\" />\n } @else if (item() | LibsUiPipesInputsUploadCheckFileExtensionPipe: 'xlsx') {\n <ng-container *ngComponentOutlet=\"'xlsx' | LibsUiIconsGetIconComponentPipe | async; inputs: { size: size() || 32 }\" />\n } @else {\n <div\n [style.width.px]=\"size() || 32\"\n [style.height.px]=\"size() || 32\"\n class=\"flex items-center justify-center\">\n <i\n class=\"libs-ui-icon-file before:!text-[19px]\"\n [class.text-[#6a7383]]=\"!item().isUploading && !item().error\"\n [class.text-[#071631]]=\"disable() || item().isUploading || item().error\"></i>\n </div>\n }\n</div>\n", dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "ngmodule", type: TranslateModule }, { kind: "component", type: LibsUiComponentsSpinnerComponent, selector: "libs_ui-components-spinner", inputs: ["type", "size"] }, { kind: "pipe", type: LibsUiPipesSecurityTrustPipe, name: "LibsUiPipesSecurityTrustPipe" }, { kind: "pipe", type: LibsUiPipesInputsUploadCalcDurationVideoPipe, name: "LibsUiPipesInputsUploadCalcDurationVideoPipe" }, { kind: "pipe", type: LibsUiPipesInputsUploadCheckFileExtensionPipe, name: "LibsUiPipesInputsUploadCheckFileExtensionPipe" }, { kind: "pipe", type: LibsUiIconsGetIconComponentPipe, name: "LibsUiIconsGetIconComponentPipe" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
108
|
+
}
|
|
109
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsInputsUploadAvatarComponent, decorators: [{
|
|
110
|
+
type: Component,
|
|
111
|
+
args: [{ selector: 'libs_ui-components-inputs-upload-avatar', standalone: true, imports: [NgComponentOutlet, AsyncPipe, TranslateModule, LibsUiComponentsSpinnerComponent, LibsUiPipesSecurityTrustPipe, LibsUiPipesInputsUploadCalcDurationVideoPipe, LibsUiPipesInputsUploadCheckFileExtensionPipe, LibsUiIconsGetIconComponentPipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"flex mr-[12px] bg-[#ffffff] rounded-[4px] {{ classInclude() }}\"\n [class.libs-ui-disable]=\"disable() || item().isUploading || item().error\">\n @if (item() | LibsUiPipesInputsUploadCheckFileExtensionPipe: 'image') {\n <div\n [style.width.px]=\"size() || 32\"\n [style.height.px]=\"size() || 32\"\n class=\"relative\">\n @if (item().url || item().origin_url; as url) {\n <img\n [src]=\"url\"\n [style.width.px]=\"size() || 32\"\n [style.height.px]=\"size() || 32\"\n class=\"rounded-[4px] cursor-pointer\"\n alt\n (error)=\"handlerImageError($event)\"\n (click)=\"handlerImageClick($event)\" />\n } @else {\n <libs_ui-components-spinner [size]=\"'medium'\" />\n }\n </div>\n } @else if (item() | LibsUiPipesInputsUploadCheckFileExtensionPipe: 'video') {\n <div\n class=\"relative\"\n [style.width.px]=\"size() || 32\"\n [style.height.px]=\"size() || 32\">\n @if (item().url || item().origin_url) {\n @let constHtmlSrc = item().url || item().origin_url || '';\n <video\n #videoRef\n [style.width.px]=\"size || 32\"\n [style.height.px]=\"size || 32\"\n class=\"rounded-[4px]\"\n preload=\"metadata\"\n [src]=\"constHtmlSrc | LibsUiPipesSecurityTrustPipe: 'resourceUrl'\"></video>\n <div class=\"absolute w-full h-full top-0 bg-[#001433] opacity-40 rounded-[4px]\"></div>\n <div class=\"absolute w-full h-full flex items-center justify-center top-0\">\n <i class=\"text-[#ffffff] libs-ui-icon-play-solid before:!text-[10px]\"></i>\n </div>\n @if (showVideoDuration()) {\n <div class=\"flex text-[5px] absolute bottom-0 right-0 py-[2px] px-[4px] rounded-[4px] bg-[#000000] text-[#ffffff]\">\n {{ videoRef.duration | LibsUiPipesInputsUploadCalcDurationVideoPipe }}\n </div>\n }\n } @else {\n <libs_ui-components-spinner [size]=\"'medium'\" />\n }\n </div>\n } @else if (item() | LibsUiPipesInputsUploadCheckFileExtensionPipe: 'pdf') {\n <ng-container *ngComponentOutlet=\"'pdf' | LibsUiIconsGetIconComponentPipe | async; inputs: { size: size() || 32 }\" />\n } @else if (item() | LibsUiPipesInputsUploadCheckFileExtensionPipe: 'word') {\n <ng-container *ngComponentOutlet=\"'word' | LibsUiIconsGetIconComponentPipe | async; inputs: { size: size() || 32 }\" />\n } @else if (item() | LibsUiPipesInputsUploadCheckFileExtensionPipe: 'pptx') {\n <ng-container *ngComponentOutlet=\"'pptx' | LibsUiIconsGetIconComponentPipe | async; inputs: { size: size() || 32 }\" />\n } @else if (item() | LibsUiPipesInputsUploadCheckFileExtensionPipe: 'xlsx') {\n <ng-container *ngComponentOutlet=\"'xlsx' | LibsUiIconsGetIconComponentPipe | async; inputs: { size: size() || 32 }\" />\n } @else {\n <div\n [style.width.px]=\"size() || 32\"\n [style.height.px]=\"size() || 32\"\n class=\"flex items-center justify-center\">\n <i\n class=\"libs-ui-icon-file before:!text-[19px]\"\n [class.text-[#6a7383]]=\"!item().isUploading && !item().error\"\n [class.text-[#071631]]=\"disable() || item().isUploading || item().error\"></i>\n </div>\n }\n</div>\n" }]
|
|
112
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
113
|
+
type: Optional
|
|
114
|
+
}, {
|
|
115
|
+
type: Inject,
|
|
116
|
+
args: [LINK_IMAGE_ERROR_TOKEN_INJECT]
|
|
117
|
+
}] }] });
|
|
118
|
+
|
|
119
|
+
const getDescriptionFormatAndSizeFileDefault = (type, maxImageSize, maxVideoSize, maxDocumentSize, maxAudioSize) => {
|
|
120
|
+
const image = {
|
|
121
|
+
message: 'i18n_note_upload_image_volume',
|
|
122
|
+
interpolateParams: { value: getLabelBySizeFile(maxImageSize, 0) },
|
|
123
|
+
};
|
|
124
|
+
const video = {
|
|
125
|
+
message: 'i18n_note_upload_video_volume',
|
|
126
|
+
interpolateParams: { value: getLabelBySizeFile(maxVideoSize, 0) },
|
|
127
|
+
};
|
|
128
|
+
const document = {
|
|
129
|
+
message: 'i18n_note_upload_file_volume',
|
|
130
|
+
interpolateParams: { value: getLabelBySizeFile(maxDocumentSize, 0) },
|
|
131
|
+
};
|
|
132
|
+
const audio = {
|
|
133
|
+
message: 'i18n_note_upload_audio_volume',
|
|
134
|
+
interpolateParams: { value: getLabelBySizeFile(maxAudioSize, 0) },
|
|
135
|
+
};
|
|
136
|
+
const typeSplit = type.split('_');
|
|
137
|
+
const description = [];
|
|
138
|
+
if (typeSplit.includes('image')) {
|
|
139
|
+
description.push(image);
|
|
140
|
+
}
|
|
141
|
+
if (typeSplit.includes('audio')) {
|
|
142
|
+
description.push(audio);
|
|
143
|
+
}
|
|
144
|
+
if (typeSplit.includes('video')) {
|
|
145
|
+
description.push(video);
|
|
146
|
+
}
|
|
147
|
+
if (typeSplit.includes('document')) {
|
|
148
|
+
description.push(document);
|
|
149
|
+
}
|
|
150
|
+
return description;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
class LibsUiComponentsInputsUploadDropFileDirective {
|
|
154
|
+
elementRef;
|
|
155
|
+
onDestroy = new Subject();
|
|
156
|
+
multiple = input(true, { transform: (value) => value ?? true });
|
|
157
|
+
outDragOver = output();
|
|
158
|
+
outDragLeave = output();
|
|
159
|
+
outDrop = output();
|
|
160
|
+
outDropFiles = output();
|
|
161
|
+
outDropFile = output();
|
|
162
|
+
constructor(elementRef) {
|
|
163
|
+
this.elementRef = elementRef;
|
|
164
|
+
}
|
|
165
|
+
ngAfterViewInit() {
|
|
166
|
+
fromEvent(this.elementRef.nativeElement, 'dragover')
|
|
167
|
+
.pipe(takeUntil(this.onDestroy))
|
|
168
|
+
.subscribe((e) => {
|
|
169
|
+
e.stopPropagation();
|
|
170
|
+
e.preventDefault();
|
|
171
|
+
this.outDragOver.emit(e);
|
|
172
|
+
});
|
|
173
|
+
fromEvent(this.elementRef.nativeElement, 'dragleave')
|
|
174
|
+
.pipe(takeUntil(this.onDestroy))
|
|
175
|
+
.subscribe((e) => {
|
|
176
|
+
e.stopPropagation();
|
|
177
|
+
e.preventDefault();
|
|
178
|
+
if (checkMouseOverInContainer(e, this.elementRef.nativeElement)) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
this.outDragLeave.emit(e);
|
|
182
|
+
});
|
|
183
|
+
fromEvent(this.elementRef.nativeElement, 'drop')
|
|
184
|
+
.pipe(takeUntil(this.onDestroy))
|
|
185
|
+
.subscribe((e) => {
|
|
186
|
+
e.stopPropagation();
|
|
187
|
+
e.preventDefault();
|
|
188
|
+
this.outDrop.emit(e);
|
|
189
|
+
const fileList = Array.from(e.dataTransfer?.files || e.clipboardData?.files || []).filter(isTypeFile);
|
|
190
|
+
if (!fileList || !fileList.length) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (this.multiple()) {
|
|
194
|
+
this.outDropFiles.emit(fileList);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
this.outDropFile.emit(fileList[0]);
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
ngOnDestroy() {
|
|
201
|
+
this.onDestroy.next();
|
|
202
|
+
this.onDestroy.complete();
|
|
203
|
+
}
|
|
204
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsInputsUploadDropFileDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
205
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.14", type: LibsUiComponentsInputsUploadDropFileDirective, isStandalone: true, selector: "[LibsUiComponentsInputsUploadDropFileDirective]", inputs: { multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { outDragOver: "outDragOver", outDragLeave: "outDragLeave", outDrop: "outDrop", outDropFiles: "outDropFiles", outDropFile: "outDropFile" }, ngImport: i0 });
|
|
206
|
+
}
|
|
207
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsInputsUploadDropFileDirective, decorators: [{
|
|
208
|
+
type: Directive,
|
|
209
|
+
args: [{
|
|
210
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
211
|
+
selector: '[LibsUiComponentsInputsUploadDropFileDirective]',
|
|
212
|
+
standalone: true,
|
|
213
|
+
}]
|
|
214
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }] });
|
|
215
|
+
|
|
216
|
+
class LibsUiComponentsInputsUploadDirective {
|
|
217
|
+
onDestroy = new Subject();
|
|
218
|
+
multiple = input(true, { transform: (val) => val ?? true });
|
|
219
|
+
accessFiles = input('image/x-png,image/jpg,image/jpeg,image/PNG,image/x-PNG,image/JPG,image/JPEG', { transform: (val) => val ?? 'image/x-png,image/jpg,image/jpeg,image/PNG,image/x-PNG,image/JPG,image/JPEG' });
|
|
220
|
+
outUploadFiles = output();
|
|
221
|
+
outUploadFile = output();
|
|
222
|
+
elementRef = inject(ElementRef);
|
|
223
|
+
ngAfterViewInit() {
|
|
224
|
+
fromEvent(this.elementRef.nativeElement, 'click')
|
|
225
|
+
.pipe(takeUntil$1(this.onDestroy))
|
|
226
|
+
.subscribe((e) => {
|
|
227
|
+
e.stopPropagation();
|
|
228
|
+
e.preventDefault();
|
|
229
|
+
const inputElementUpload = document.createElement('input');
|
|
230
|
+
inputElementUpload.type = 'file';
|
|
231
|
+
inputElementUpload.accept = this.accessFiles();
|
|
232
|
+
inputElementUpload.multiple = this.multiple();
|
|
233
|
+
inputElementUpload.style.display = 'none';
|
|
234
|
+
inputElementUpload.click();
|
|
235
|
+
fromEvent(inputElementUpload, 'change')
|
|
236
|
+
.pipe(takeUntil$1(this.onDestroy))
|
|
237
|
+
.subscribe((event) => {
|
|
238
|
+
const files = Array.from(event.dataTransfer?.files || event.target?.files || []);
|
|
239
|
+
inputElementUpload.remove();
|
|
240
|
+
if (!files?.length) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (this.multiple()) {
|
|
244
|
+
this.outUploadFiles.emit(files);
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
this.outUploadFile.emit(files[0]);
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
ngOnDestroy() {
|
|
252
|
+
this.onDestroy.next();
|
|
253
|
+
this.onDestroy.complete();
|
|
254
|
+
}
|
|
255
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsInputsUploadDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
256
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.14", type: LibsUiComponentsInputsUploadDirective, isStandalone: true, selector: "[LibsUiComponentsInputsUploadDirective]", inputs: { multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, accessFiles: { classPropertyName: "accessFiles", publicName: "accessFiles", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { outUploadFiles: "outUploadFiles", outUploadFile: "outUploadFile" }, ngImport: i0 });
|
|
257
|
+
}
|
|
258
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsInputsUploadDirective, decorators: [{
|
|
259
|
+
type: Directive,
|
|
260
|
+
args: [{
|
|
261
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
262
|
+
selector: '[LibsUiComponentsInputsUploadDirective]',
|
|
263
|
+
standalone: true,
|
|
264
|
+
}]
|
|
265
|
+
}] });
|
|
266
|
+
|
|
267
|
+
class LibsUiComponentsInputsUploadComponent {
|
|
268
|
+
// #region PROPERTIES
|
|
269
|
+
imageEditorComponentRef;
|
|
270
|
+
previewFileComponentRef;
|
|
271
|
+
previewFileImageComponentRef;
|
|
272
|
+
isDragOver = signal(false);
|
|
273
|
+
fileList = signal([]);
|
|
274
|
+
accessFiles = signal('');
|
|
275
|
+
messageError = signal(undefined);
|
|
276
|
+
descriptionFormatAndSizeFileComputed = computed(() => {
|
|
277
|
+
if (this.descriptionFormatAndSizeFile()?.length) {
|
|
278
|
+
return this.descriptionFormatAndSizeFile();
|
|
279
|
+
}
|
|
280
|
+
return getDescriptionFormatAndSizeFileDefault(this.fileType(), this.maxImageSize(), this.maxVideoSize(), this.maxDocumentSize(), this.maxAudioSize());
|
|
281
|
+
});
|
|
282
|
+
onDestroy = new Subject();
|
|
283
|
+
// #endregion
|
|
284
|
+
// #region INPUTS
|
|
285
|
+
originFiles = input([], { transform: (val) => val ?? [] });
|
|
286
|
+
fileType = input('image_video_document', { transform: (val) => val ?? 'image_video_document' });
|
|
287
|
+
multiple = input();
|
|
288
|
+
canUploadIfHasExistFile = input(false, { transform: (val) => val ?? false });
|
|
289
|
+
canSetAvatar = input(false);
|
|
290
|
+
limitFile = input(10, { transform: (val) => val ?? 10 });
|
|
291
|
+
maxTotalSize = input(10 * 1024 * 1024, { transform: (val) => val ?? 10 * 1024 * 1024 });
|
|
292
|
+
maxImageSize = input(5 * 1024 * 1024, { transform: (val) => val ?? 5 * 1024 * 1024 });
|
|
293
|
+
maxVideoSize = input(10 * 1024 * 1024, { transform: (val) => val ?? 10 * 1024 * 1024 });
|
|
294
|
+
maxDocumentSize = input(10 * 1024 * 1024, { transform: (val) => val ?? 10 * 1024 * 1024 });
|
|
295
|
+
maxAudioSize = input(10 * 1024 * 1024, { transform: (val) => val ?? 10 * 1024 * 1024 });
|
|
296
|
+
imageExtList = input(ImageExtList, { transform: (val) => val ?? ImageExtList });
|
|
297
|
+
videoExtList = input(VideoExtList, { transform: (val) => val ?? VideoExtList });
|
|
298
|
+
documentExtList = input(DocumentExtList, { transform: (val) => val ?? DocumentExtList });
|
|
299
|
+
audioExtList = input(AudioExtList, { transform: (val) => val ?? AudioExtList });
|
|
300
|
+
classIncludeListItem = input();
|
|
301
|
+
validRequired = input();
|
|
302
|
+
disable = input(false, { transform: (val) => val ?? false });
|
|
303
|
+
readonly = input(false, { transform: (val) => val ?? false });
|
|
304
|
+
aspectRatio = input();
|
|
305
|
+
zIndex = input(1200, { transform: (val) => val ?? 1200 });
|
|
306
|
+
ignoreShowSizeFile = input(false, { transform: (val) => val ?? false });
|
|
307
|
+
allowShowPushMessageMaxSizeError = input(false, { transform: (val) => val ?? false });
|
|
308
|
+
messageTypeFileError = input('i18n_the_file_support_format_is_not_correct', { transform: (val) => val || 'i18n_the_file_support_format_is_not_correct' });
|
|
309
|
+
messageMaxSizeError = input('i18n_file_size_exceeds_the_allowed_limit', { transform: (val) => val || 'i18n_file_size_exceeds_the_allowed_limit' });
|
|
310
|
+
messageFileUploadError = input('i18n_invalid_file_upload', { transform: (val) => val || 'i18n_invalid_file_upload' });
|
|
311
|
+
messageTotalFileExceedsError = input('i18n_file_number_exceeds_the_allowed_limit_please_delete_the_file', { transform: (val) => val || 'i18n_file_number_exceeds_the_allowed_limit_please_delete_the_file' });
|
|
312
|
+
configDescriptionInputUpload = input({ message: 'i18n_drag_file_here_to_upload_or_select_file' }, {
|
|
313
|
+
transform: (val) => val ?? { message: 'i18n_drag_file_here_to_upload_or_select_file' },
|
|
314
|
+
});
|
|
315
|
+
modeDisplayFile = input('full', { transform: (val) => val || 'full' });
|
|
316
|
+
descriptionFormatAndSizeFile = input();
|
|
317
|
+
showVideoDuration = input(false, { transform: (val) => val ?? false });
|
|
318
|
+
labelConfig = input();
|
|
319
|
+
showPopupUploadWhenHasFileAndModeSingle = input(false, { transform: (val) => val ?? false });
|
|
320
|
+
ignoreIconRemove = input(false, { transform: (val) => val ?? false });
|
|
321
|
+
ignoreIconEdit = input(false, { transform: (val) => val ?? false });
|
|
322
|
+
ignoreIconPreview = input(true, { transform: (val) => val ?? true });
|
|
323
|
+
classIncludeFileContent = input('', { transform: (value) => value ?? '' });
|
|
324
|
+
classIncludeAvatar = input('', { transform: (value) => value ?? '' });
|
|
325
|
+
showBorderErrorAllItemWhenError = input(false, { transform: (val) => val ?? false });
|
|
326
|
+
configDownloadSampleFile = input();
|
|
327
|
+
// #endregion
|
|
328
|
+
// #region OUTPUTS
|
|
329
|
+
outClose = output();
|
|
330
|
+
outFileChanged = output();
|
|
331
|
+
outFileRemoved = output();
|
|
332
|
+
outFunctionsControl = output();
|
|
333
|
+
// #endregion
|
|
334
|
+
// #region VIEW CHILDREN
|
|
335
|
+
uploadRef = viewChild('upload');
|
|
336
|
+
uploadInputRef = viewChild('uploadInput');
|
|
337
|
+
// #endregion
|
|
338
|
+
// #region INJECTIONS
|
|
339
|
+
dynamicComponentService = inject(LibsUiDynamicComponentService);
|
|
340
|
+
translateService = inject(TranslateService);
|
|
341
|
+
notificationService = inject(LibsUiNotificationService);
|
|
342
|
+
// #endregion
|
|
343
|
+
constructor() {
|
|
344
|
+
effect(() => {
|
|
345
|
+
if (this.originFiles()) {
|
|
346
|
+
untracked(() => {
|
|
347
|
+
this.fileList.set([...this.originFiles()]);
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
// #region LIFECYCLE HOOKS
|
|
353
|
+
ngOnInit() {
|
|
354
|
+
this.outFunctionsControl.emit(this.FunctionsControl);
|
|
355
|
+
}
|
|
356
|
+
ngAfterViewInit() {
|
|
357
|
+
setTimeout(() => {
|
|
358
|
+
this.initAccessFiles();
|
|
359
|
+
}, 0);
|
|
360
|
+
}
|
|
361
|
+
// #endregion
|
|
362
|
+
// #region INITIALIZATION
|
|
363
|
+
async initAccessFiles() {
|
|
364
|
+
const accessExts = [];
|
|
365
|
+
const typeSplit = this.fileType().split('_');
|
|
366
|
+
if (typeSplit.includes('image')) {
|
|
367
|
+
accessExts.push(...this.imageExtList());
|
|
368
|
+
}
|
|
369
|
+
if (typeSplit.includes('document')) {
|
|
370
|
+
accessExts.push(...this.documentExtList());
|
|
371
|
+
}
|
|
372
|
+
if (typeSplit.includes('video')) {
|
|
373
|
+
accessExts.push(...this.videoExtList());
|
|
374
|
+
}
|
|
375
|
+
if (typeSplit.includes('audio')) {
|
|
376
|
+
accessExts.push(...this.audioExtList());
|
|
377
|
+
}
|
|
378
|
+
this.accessFiles.set(accessExts.map((ext) => `.${ext}`).join(','));
|
|
379
|
+
}
|
|
380
|
+
// #endregion
|
|
381
|
+
// #region FILE OPERATIONS
|
|
382
|
+
async handlerSetClassDrag(toogle) {
|
|
383
|
+
this.uploadRef()?.nativeElement.classList.toggle('libs-ui-components-inputs-upload-drag-over', toogle);
|
|
384
|
+
}
|
|
385
|
+
async handleUploadFiles(files) {
|
|
386
|
+
if (this.maxTotalSize()) {
|
|
387
|
+
let total = 0;
|
|
388
|
+
for (let i = 0; i < files.length; i++) {
|
|
389
|
+
total += files[i].size;
|
|
390
|
+
}
|
|
391
|
+
if (this.maxTotalSize() < total) {
|
|
392
|
+
this.notificationService.showCompTypeTextError(this.translateService.instant('i18n_size_not_number_mb', { number: this.maxTotalSize() / 1024 / 1024 }), { timeRemove: 3000 });
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
let errorExceedsMaxFile = false;
|
|
397
|
+
if (!files || !files.length) {
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
if (!this.multiple() && this.fileList().length && !this.canUploadIfHasExistFile()) {
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
const remainFileTotal = this.limitFile() - this.fileList().length;
|
|
404
|
+
if (files.length > remainFileTotal) {
|
|
405
|
+
errorExceedsMaxFile = true;
|
|
406
|
+
this.messageError.set(this.messageTotalFileExceedsError());
|
|
407
|
+
}
|
|
408
|
+
for (let i = 0; i < files.length; i++) {
|
|
409
|
+
const file = files[i];
|
|
410
|
+
const isImage = isTypeImage(file);
|
|
411
|
+
const isVideo = isTypeVideo(file);
|
|
412
|
+
const isAudio = isTypeAudio(file);
|
|
413
|
+
const newFile = {
|
|
414
|
+
name: file.name,
|
|
415
|
+
file: file,
|
|
416
|
+
size: getLabelBySizeFile(file.size),
|
|
417
|
+
type: isImage ? 'image' : isVideo ? 'video' : isAudio ? 'audio' : 'document',
|
|
418
|
+
id: uuid(),
|
|
419
|
+
};
|
|
420
|
+
if (!(await this.checkValidFileExtension(file))) {
|
|
421
|
+
if (!errorExceedsMaxFile) {
|
|
422
|
+
this.messageError.set(this.multiple() ? this.messageFileUploadError() : this.messageTypeFileError());
|
|
423
|
+
}
|
|
424
|
+
newFile.error = this.messageTypeFileError();
|
|
425
|
+
await this.pushFileInList(file, newFile);
|
|
426
|
+
continue;
|
|
427
|
+
}
|
|
428
|
+
if (!(await this.checkValidFileSize(file))) {
|
|
429
|
+
if (!errorExceedsMaxFile) {
|
|
430
|
+
this.messageError.set(this.multiple() ? this.messageFileUploadError() : this.messageMaxSizeError());
|
|
431
|
+
}
|
|
432
|
+
newFile.error = this.messageMaxSizeError();
|
|
433
|
+
if (!this.multiple() && this.allowShowPushMessageMaxSizeError()) {
|
|
434
|
+
this.notificationService.showCompTypeTextError(this.messageMaxSizeError());
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
await this.pushFileInList(file, newFile);
|
|
438
|
+
continue;
|
|
439
|
+
}
|
|
440
|
+
await this.pushFileInList(file, newFile);
|
|
441
|
+
}
|
|
442
|
+
if (this.canSetAvatar() && this.fileList().length && !this.fileList().find((file) => file().isAvatar)) {
|
|
443
|
+
this.fileList.update((fileList) => {
|
|
444
|
+
const itemImage = fileList.find((file) => file().type === 'image');
|
|
445
|
+
if (itemImage) {
|
|
446
|
+
itemImage.update((file) => ({ ...file, isAvatar: true }));
|
|
447
|
+
}
|
|
448
|
+
return [...fileList];
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
this.outFileChanged.emit(this.fileList());
|
|
452
|
+
this.validate();
|
|
453
|
+
}
|
|
454
|
+
async pushFileInList(file, newFile) {
|
|
455
|
+
newFile.url = (await convertFileToBase64_ObjectUrl(file));
|
|
456
|
+
this.fileList.update((fileList) => {
|
|
457
|
+
fileList.splice(0, this.canUploadIfHasExistFile() ? 1 : 0, signal(newFile));
|
|
458
|
+
return [...fileList];
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
async handlerOpenPreviewFile(item) {
|
|
462
|
+
if (item.type === 'document') {
|
|
463
|
+
this.previewFileDocument(item);
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
this.previewFileImage(item);
|
|
467
|
+
}
|
|
468
|
+
async previewFileDocument(item) {
|
|
469
|
+
if (this.previewFileComponentRef) {
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
this.previewFileComponentRef = this.dynamicComponentService.resolveComponentFactory(LibsUiComponentsPreviewFileComponent);
|
|
473
|
+
this.previewFileComponentRef.setInput('data', item);
|
|
474
|
+
this.previewFileComponentRef.setInput('zIndex', this.zIndex() + 1);
|
|
475
|
+
this.previewFileComponentRef.instance.outClose.subscribe(() => {
|
|
476
|
+
this.dynamicComponentService.remove(this.previewFileComponentRef);
|
|
477
|
+
this.previewFileComponentRef = undefined;
|
|
478
|
+
});
|
|
479
|
+
this.dynamicComponentService.addToBody(this.previewFileComponentRef);
|
|
480
|
+
}
|
|
481
|
+
async previewFileImage(item) {
|
|
482
|
+
if (this.previewFileImageComponentRef) {
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
this.previewFileImageComponentRef = this.dynamicComponentService.resolveComponentFactory(LibsUiComponentsGalleryViewerComponent);
|
|
486
|
+
const url = item.url || item.origin_url;
|
|
487
|
+
this.previewFileImageComponentRef.setInput('images', [{ url }]);
|
|
488
|
+
this.previewFileImageComponentRef.setInput('imageSelected', { url });
|
|
489
|
+
this.previewFileImageComponentRef.setInput('fieldDisplaySrcImage', 'url');
|
|
490
|
+
this.previewFileImageComponentRef.setInput('singleImage', true);
|
|
491
|
+
this.previewFileImageComponentRef.setInput('zIndex', this.zIndex() + 1);
|
|
492
|
+
this.previewFileImageComponentRef.instance.outClose.subscribe(() => {
|
|
493
|
+
this.dynamicComponentService.remove(this.previewFileImageComponentRef);
|
|
494
|
+
this.previewFileImageComponentRef = undefined;
|
|
495
|
+
});
|
|
496
|
+
this.dynamicComponentService.addToBody(this.previewFileImageComponentRef);
|
|
497
|
+
}
|
|
498
|
+
async handlerEditImage(event, item) {
|
|
499
|
+
event.stopPropagation();
|
|
500
|
+
this.showEditModal(item);
|
|
501
|
+
}
|
|
502
|
+
async handlerRemoveFile(event, item) {
|
|
503
|
+
event.stopPropagation();
|
|
504
|
+
this.removeFile(item);
|
|
505
|
+
if (this.originFiles().find((file) => file().url === item().url)) {
|
|
506
|
+
this.outFileRemoved.emit(item);
|
|
507
|
+
}
|
|
508
|
+
this.validate();
|
|
509
|
+
if (!this.multiple() && this.showPopupUploadWhenHasFileAndModeSingle()) {
|
|
510
|
+
setTimeout(() => {
|
|
511
|
+
this.showUploadPopup();
|
|
512
|
+
}, 0);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
async removeFile(fileItem) {
|
|
516
|
+
this.fileList.update((fileList) => fileList.filter((item) => item().id !== fileItem().id));
|
|
517
|
+
if (this.canSetAvatar() && fileItem().isAvatar && this.fileList().length) {
|
|
518
|
+
this.fileList.update((fileList) => {
|
|
519
|
+
fileList[0].update((file) => ({ ...file, isAvatar: true }));
|
|
520
|
+
return [...fileList];
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
this.outFileChanged.emit(this.fileList());
|
|
524
|
+
}
|
|
525
|
+
async showEditModal(fileItem) {
|
|
526
|
+
if (this.imageEditorComponentRef) {
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
const fileDataUrl = fileItem().url || fileItem().origin_url || '';
|
|
530
|
+
this.imageEditorComponentRef = this.dynamicComponentService.resolveComponentFactory(LibsUiComponentsImageEditorComponent);
|
|
531
|
+
this.imageEditorComponentRef.setInput('imgSrc', fileDataUrl);
|
|
532
|
+
this.imageEditorComponentRef.setInput('zIndex', this.zIndex() + 1);
|
|
533
|
+
this.imageEditorComponentRef.setInput('nameFile', fileItem().name);
|
|
534
|
+
this.imageEditorComponentRef.setInput('aspectRatio', this.aspectRatio());
|
|
535
|
+
this.imageEditorComponentRef.instance.outClose.subscribe(() => {
|
|
536
|
+
this.dynamicComponentService.remove(this.imageEditorComponentRef);
|
|
537
|
+
this.imageEditorComponentRef = undefined;
|
|
538
|
+
});
|
|
539
|
+
this.imageEditorComponentRef.instance.outSaveFile.subscribe(async (result) => {
|
|
540
|
+
const messageError = !(await this.checkValidFileSize(result.file)) ? this.messageMaxSizeError() : undefined;
|
|
541
|
+
const nameFile = fileItem().file?.name || fileItem().name;
|
|
542
|
+
fileItem.update((data) => ({ ...data, file: convertBlobToFile(result.file, nameFile), name: nameFile, origin_url: undefined, size: getLabelBySizeFile(result.file.size), error: messageError, url: result.url, isUpdate: true }));
|
|
543
|
+
this.outFileChanged.emit(this.fileList());
|
|
544
|
+
this.imageEditorComponentRef?.instance.outClose.emit({ isClickButtonClose: true });
|
|
545
|
+
});
|
|
546
|
+
this.dynamicComponentService.addToBody(this.imageEditorComponentRef);
|
|
547
|
+
}
|
|
548
|
+
async checkValidFileExtension(file) {
|
|
549
|
+
const extension = getFileExtension(file);
|
|
550
|
+
if (!extension) {
|
|
551
|
+
return false;
|
|
552
|
+
}
|
|
553
|
+
const isImage = isTypeImage(file);
|
|
554
|
+
const isVideo = isTypeVideo(file);
|
|
555
|
+
const isAudio = isTypeAudio(file);
|
|
556
|
+
const validImage = isIncludeImageExtList(extension, this.imageExtList());
|
|
557
|
+
const validVideo = isIncludeVideoExtList(extension, this.videoExtList());
|
|
558
|
+
const validAudio = isIncludeAudioExtList(extension, this.audioExtList());
|
|
559
|
+
const validDocument = isIncludeDocumentExtList(extension, this.documentExtList());
|
|
560
|
+
const typeSplit = this.fileType().split('_');
|
|
561
|
+
if (isImage && typeSplit.includes('image')) {
|
|
562
|
+
return validImage;
|
|
563
|
+
}
|
|
564
|
+
if (isVideo && typeSplit.includes('video')) {
|
|
565
|
+
return validVideo;
|
|
566
|
+
}
|
|
567
|
+
if (isAudio && typeSplit.includes('audio')) {
|
|
568
|
+
return validAudio;
|
|
569
|
+
}
|
|
570
|
+
if (typeSplit.includes('document')) {
|
|
571
|
+
return validDocument;
|
|
572
|
+
}
|
|
573
|
+
return false;
|
|
574
|
+
}
|
|
575
|
+
async checkValidFileSize(file) {
|
|
576
|
+
const isImage = isTypeImage(file);
|
|
577
|
+
const isVideo = isTypeVideo(file);
|
|
578
|
+
const isAudio = isTypeAudio(file);
|
|
579
|
+
const validImage = file.size <= this.maxImageSize();
|
|
580
|
+
const validVideo = file.size <= this.maxVideoSize();
|
|
581
|
+
const validAudio = file.size <= this.maxAudioSize();
|
|
582
|
+
const validDocument = file.size <= this.maxDocumentSize();
|
|
583
|
+
const typeSplit = this.fileType().split('_');
|
|
584
|
+
if (isImage && typeSplit.includes('image')) {
|
|
585
|
+
return validImage;
|
|
586
|
+
}
|
|
587
|
+
if (isVideo && typeSplit.includes('video')) {
|
|
588
|
+
return validVideo;
|
|
589
|
+
}
|
|
590
|
+
if (isAudio && typeSplit.includes('audio')) {
|
|
591
|
+
return validAudio;
|
|
592
|
+
}
|
|
593
|
+
if (typeSplit.includes('document')) {
|
|
594
|
+
return validDocument;
|
|
595
|
+
}
|
|
596
|
+
return false;
|
|
597
|
+
}
|
|
598
|
+
async validate() {
|
|
599
|
+
if (this.validRequired()?.isRequired && !this.fileList().length) {
|
|
600
|
+
this.messageError.set(this.validRequired()?.message || ERROR_MESSAGE_EMPTY_VALID);
|
|
601
|
+
return false;
|
|
602
|
+
}
|
|
603
|
+
if (this.multiple() && this.fileList().length > this.limitFile()) {
|
|
604
|
+
this.messageError.set(this.messageTotalFileExceedsError());
|
|
605
|
+
return false;
|
|
606
|
+
}
|
|
607
|
+
const fileError = this.fileList().find((item) => item().error);
|
|
608
|
+
if (fileError) {
|
|
609
|
+
this.messageError.set(this.multiple() ? this.messageFileUploadError() : fileError().error);
|
|
610
|
+
return false;
|
|
611
|
+
}
|
|
612
|
+
this.messageError.set(undefined);
|
|
613
|
+
return true;
|
|
614
|
+
}
|
|
615
|
+
async handlerSetAvatar(event, file) {
|
|
616
|
+
event.stopPropagation();
|
|
617
|
+
this.fileList().forEach((item) => {
|
|
618
|
+
if (item().id === file().id) {
|
|
619
|
+
item.update((file) => ({ ...file, isAvatar: true }));
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
item.update((file) => ({ ...file, isAvatar: false }));
|
|
623
|
+
});
|
|
624
|
+
this.outFileChanged.emit(this.fileList());
|
|
625
|
+
}
|
|
626
|
+
async removeAllFile() {
|
|
627
|
+
this.fileList.set([]);
|
|
628
|
+
this.messageError.set(undefined);
|
|
629
|
+
}
|
|
630
|
+
async handlerDownloadSampleFile(event) {
|
|
631
|
+
event.stopPropagation();
|
|
632
|
+
const config = this.configDownloadSampleFile();
|
|
633
|
+
if (!config) {
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
if (config?.callBack) {
|
|
637
|
+
config.callBack();
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
if (config?.url) {
|
|
641
|
+
downloadFileByUrl(config.url, config.title);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
async showUploadPopup() {
|
|
645
|
+
this.uploadInputRef()?.nativeElement.click();
|
|
646
|
+
this.uploadInputRef()?.nativeElement.setAttribute('accept', this.accessFiles());
|
|
647
|
+
}
|
|
648
|
+
// #endregion
|
|
649
|
+
// #region FUNCTIONS
|
|
650
|
+
get FunctionsControl() {
|
|
651
|
+
return {
|
|
652
|
+
checkIsValid: this.validate.bind(this),
|
|
653
|
+
removeAll: this.removeAllFile.bind(this),
|
|
654
|
+
uploading: async (process, id) => {
|
|
655
|
+
const fileUploading = this.fileList().find((file) => file().id === id);
|
|
656
|
+
if (fileUploading) {
|
|
657
|
+
fileUploading.update((file) => ({ ...file, percentUploading: process.percent, isUploading: process.percent !== 100 }));
|
|
658
|
+
}
|
|
659
|
+
},
|
|
660
|
+
setMessageError: async (message, id) => {
|
|
661
|
+
this.messageError.set(message);
|
|
662
|
+
if (id) {
|
|
663
|
+
const fileError = this.fileList().find((file) => file().id === id);
|
|
664
|
+
if (fileError) {
|
|
665
|
+
fileError.update((file) => ({ ...file, error: message }));
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
},
|
|
669
|
+
handlerUploadFile: this.showUploadPopup.bind(this),
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
// #endregion
|
|
673
|
+
ngOnDestroy() {
|
|
674
|
+
this.onDestroy.next();
|
|
675
|
+
this.onDestroy.complete();
|
|
676
|
+
}
|
|
677
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsInputsUploadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
678
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: LibsUiComponentsInputsUploadComponent, isStandalone: true, selector: "libs_ui-components-inputs-upload", inputs: { originFiles: { classPropertyName: "originFiles", publicName: "originFiles", isSignal: true, isRequired: false, transformFunction: null }, fileType: { classPropertyName: "fileType", publicName: "fileType", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, canUploadIfHasExistFile: { classPropertyName: "canUploadIfHasExistFile", publicName: "canUploadIfHasExistFile", isSignal: true, isRequired: false, transformFunction: null }, canSetAvatar: { classPropertyName: "canSetAvatar", publicName: "canSetAvatar", isSignal: true, isRequired: false, transformFunction: null }, limitFile: { classPropertyName: "limitFile", publicName: "limitFile", isSignal: true, isRequired: false, transformFunction: null }, maxTotalSize: { classPropertyName: "maxTotalSize", publicName: "maxTotalSize", isSignal: true, isRequired: false, transformFunction: null }, maxImageSize: { classPropertyName: "maxImageSize", publicName: "maxImageSize", isSignal: true, isRequired: false, transformFunction: null }, maxVideoSize: { classPropertyName: "maxVideoSize", publicName: "maxVideoSize", isSignal: true, isRequired: false, transformFunction: null }, maxDocumentSize: { classPropertyName: "maxDocumentSize", publicName: "maxDocumentSize", isSignal: true, isRequired: false, transformFunction: null }, maxAudioSize: { classPropertyName: "maxAudioSize", publicName: "maxAudioSize", isSignal: true, isRequired: false, transformFunction: null }, imageExtList: { classPropertyName: "imageExtList", publicName: "imageExtList", isSignal: true, isRequired: false, transformFunction: null }, videoExtList: { classPropertyName: "videoExtList", publicName: "videoExtList", isSignal: true, isRequired: false, transformFunction: null }, documentExtList: { classPropertyName: "documentExtList", publicName: "documentExtList", isSignal: true, isRequired: false, transformFunction: null }, audioExtList: { classPropertyName: "audioExtList", publicName: "audioExtList", isSignal: true, isRequired: false, transformFunction: null }, classIncludeListItem: { classPropertyName: "classIncludeListItem", publicName: "classIncludeListItem", isSignal: true, isRequired: false, transformFunction: null }, validRequired: { classPropertyName: "validRequired", publicName: "validRequired", isSignal: true, isRequired: false, transformFunction: null }, disable: { classPropertyName: "disable", publicName: "disable", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, aspectRatio: { classPropertyName: "aspectRatio", publicName: "aspectRatio", isSignal: true, isRequired: false, transformFunction: null }, zIndex: { classPropertyName: "zIndex", publicName: "zIndex", isSignal: true, isRequired: false, transformFunction: null }, ignoreShowSizeFile: { classPropertyName: "ignoreShowSizeFile", publicName: "ignoreShowSizeFile", isSignal: true, isRequired: false, transformFunction: null }, allowShowPushMessageMaxSizeError: { classPropertyName: "allowShowPushMessageMaxSizeError", publicName: "allowShowPushMessageMaxSizeError", isSignal: true, isRequired: false, transformFunction: null }, messageTypeFileError: { classPropertyName: "messageTypeFileError", publicName: "messageTypeFileError", isSignal: true, isRequired: false, transformFunction: null }, messageMaxSizeError: { classPropertyName: "messageMaxSizeError", publicName: "messageMaxSizeError", isSignal: true, isRequired: false, transformFunction: null }, messageFileUploadError: { classPropertyName: "messageFileUploadError", publicName: "messageFileUploadError", isSignal: true, isRequired: false, transformFunction: null }, messageTotalFileExceedsError: { classPropertyName: "messageTotalFileExceedsError", publicName: "messageTotalFileExceedsError", isSignal: true, isRequired: false, transformFunction: null }, configDescriptionInputUpload: { classPropertyName: "configDescriptionInputUpload", publicName: "configDescriptionInputUpload", isSignal: true, isRequired: false, transformFunction: null }, modeDisplayFile: { classPropertyName: "modeDisplayFile", publicName: "modeDisplayFile", isSignal: true, isRequired: false, transformFunction: null }, descriptionFormatAndSizeFile: { classPropertyName: "descriptionFormatAndSizeFile", publicName: "descriptionFormatAndSizeFile", isSignal: true, isRequired: false, transformFunction: null }, showVideoDuration: { classPropertyName: "showVideoDuration", publicName: "showVideoDuration", isSignal: true, isRequired: false, transformFunction: null }, labelConfig: { classPropertyName: "labelConfig", publicName: "labelConfig", isSignal: true, isRequired: false, transformFunction: null }, showPopupUploadWhenHasFileAndModeSingle: { classPropertyName: "showPopupUploadWhenHasFileAndModeSingle", publicName: "showPopupUploadWhenHasFileAndModeSingle", isSignal: true, isRequired: false, transformFunction: null }, ignoreIconRemove: { classPropertyName: "ignoreIconRemove", publicName: "ignoreIconRemove", isSignal: true, isRequired: false, transformFunction: null }, ignoreIconEdit: { classPropertyName: "ignoreIconEdit", publicName: "ignoreIconEdit", isSignal: true, isRequired: false, transformFunction: null }, ignoreIconPreview: { classPropertyName: "ignoreIconPreview", publicName: "ignoreIconPreview", isSignal: true, isRequired: false, transformFunction: null }, classIncludeFileContent: { classPropertyName: "classIncludeFileContent", publicName: "classIncludeFileContent", isSignal: true, isRequired: false, transformFunction: null }, classIncludeAvatar: { classPropertyName: "classIncludeAvatar", publicName: "classIncludeAvatar", isSignal: true, isRequired: false, transformFunction: null }, showBorderErrorAllItemWhenError: { classPropertyName: "showBorderErrorAllItemWhenError", publicName: "showBorderErrorAllItemWhenError", isSignal: true, isRequired: false, transformFunction: null }, configDownloadSampleFile: { classPropertyName: "configDownloadSampleFile", publicName: "configDownloadSampleFile", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { outClose: "outClose", outFileChanged: "outFileChanged", outFileRemoved: "outFileRemoved", outFunctionsControl: "outFunctionsControl" }, viewQueries: [{ propertyName: "uploadRef", first: true, predicate: ["upload"], descendants: true, isSignal: true }, { propertyName: "uploadInputRef", first: true, predicate: ["uploadInput"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"flex flex-col w-full h-full\">\n <div>\n @if (labelConfig(); as labelConfig) {\n <libs_ui-components-label\n [classInclude]=\"labelConfig.classInclude\"\n [labelLeft]=\"labelConfig.labelLeft\"\n [labelLeftClass]=\"labelConfig.labelLeftClass\"\n [required]=\"labelConfig.required\"\n [description]=\"labelConfig.description\"\n [labelRight]=\"labelConfig.labelRight\"\n [labelRightClass]=\"labelConfig.labelRightClass\"\n [onlyShowCount]=\"labelConfig.onlyShowCount\"\n [buttonsLeft]=\"labelConfig.buttonsLeft\"\n [buttonsRight]=\"labelConfig.buttonsRight\"\n [disableButtonsLeft]=\"labelConfig.disableButtonsLeft || disable() || readonly()\"\n [disableButtonsRight]=\"labelConfig.disableButtonsRight || disable() || readonly()\"\n [hasToggle]=\"labelConfig.hasToggle\"\n [toggleActive]=\"labelConfig.toggleActive\"\n [toggleDisable]=\"labelConfig.toggleDisable || disable() || readonly()\"\n [popover]=\"labelConfig.popover\"\n [iconPopoverClass]=\"labelConfig.iconPopoverClass\"\n [onlyShowCount]=\"labelConfig.onlyShowCount\"\n [limitLength]=\"labelConfig.limitLength\"\n [buttonsDescription]=\"labelConfig.buttonsDescription\"\n [disableButtonsDescription]=\"labelConfig.disableButtonsDescription || disable() || readonly()\"\n [buttonsDescriptionContainerClass]=\"labelConfig.buttonsDescriptionContainerClass\"\n [count]=\"labelConfig.count\" />\n }\n @if ((!configDownloadSampleFile()?.position || configDownloadSampleFile()?.position === 'top') && configDownloadSampleFile(); as configDownloadSampleFile) {\n <libs_ui-components-buttons-button\n [type]=\"'button-link-primary'\"\n [classLabel]=\"'libs-ui-font-h7m'\"\n [classInclude]=\"'!mb-[8px] !p-0'\"\n [classIconLeft]=\"'libs-ui-icon-attachment before:!text-[12px]'\"\n [label]=\"configDownloadSampleFile?.title || ' '\"\n (outClick)=\"handlerDownloadSampleFile($event)\" />\n }\n @if (multiple() || !showPopupUploadWhenHasFileAndModeSingle() || (!fileList().length && !multiple())) {\n <div\n #upload\n LibsUiComponentsInputsUploadDirective\n LibsUiComponentsInputsUploadDropFileDirective\n class=\"libs-ui-components-inputs-upload\"\n [class.libs-ui-components-inputs-upload-disable]=\"disable() || readonly() || (!multiple() && fileList().length && !canUploadIfHasExistFile())\"\n [class.libs-ui-components-inputs-upload-readonly]=\"readonly()\"\n [class.libs-ui-components-inputs-upload-error]=\"messageError()\"\n [multiple]=\"multiple()\"\n [accessFiles]=\"accessFiles()\"\n (outUploadFiles)=\"handleUploadFiles($event)\"\n (outUploadFile)=\"handleUploadFiles([$event])\"\n (outDragOver)=\"handlerSetClassDrag(true)\"\n (outDragLeave)=\"handlerSetClassDrag(false)\"\n (outDrop)=\"handlerSetClassDrag(false)\"\n (outDropFiles)=\"handleUploadFiles($event)\"\n (outDropFile)=\"handleUploadFiles([$event])\">\n <div class=\"flex items-center\">\n <div class=\"mr-[16px]\">\n <i class=\"libs-ui-components-inputs-upload-icon libs-ui-icon-file-upload before:!text-[32px]\"></i>\n </div>\n <div class=\"libs-ui-components-inputs-upload-description\">\n @let constHtmlMessage = configDescriptionInputUpload().message || ' ';\n <div\n class=\"mb-[4px] libs-ui-font-h6m\"\n [innerHTML]=\"constHtmlMessage | translate: configDescriptionInputUpload().interpolateParams\"></div>\n @for (item of descriptionFormatAndSizeFileComputed(); track item; let last = $last) {\n <div\n class=\"libs-ui-font-h7r\"\n [class.mb-[4px]]=\"!last\"\n [innerHTML]=\"item.message | translate: item.interpolateParams\"></div>\n }\n </div>\n </div>\n @if (multiple()) {\n <input\n #uploadInput\n class=\"upload-input hidden\"\n type=\"file\"\n name=\"files[]\"\n multiple\n [accept]=\"accessFiles()\" />\n } @else {\n <input\n #uploadInput\n class=\"upload-input hidden\"\n type=\"file\"\n name=\"files[]\"\n [accept]=\"accessFiles()\" />\n }\n </div>\n }\n @if (messageError() && (multiple() || !showPopupUploadWhenHasFileAndModeSingle() || (!fileList().length && !multiple()))) {\n <div class=\"mt-[8px] text-[#ee2d41] libs-ui-font-h7r\">\n @let constHtmlMessage = messageError() || ' ';\n {{ constHtmlMessage | translate: { value: limitFile() } }}\n </div>\n }\n @if (configDownloadSampleFile()?.position === 'bottom' && configDownloadSampleFile(); as configDownloadSampleFile) {\n <libs_ui-components-buttons-button\n [type]=\"'button-link-primary'\"\n [classLabel]=\"'libs-ui-font-h7m'\"\n [classInclude]=\"'!mt-[8px] !p-0'\"\n [classIconLeft]=\"'libs-ui-icon-attachment before:!text-[12px]'\"\n [label]=\"configDownloadSampleFile.title || ' '\"\n (moClick)=\"handlerDownloadSampleFile($event)\" />\n }\n </div>\n @if (fileList().length) {\n <div\n LibsUiComponentsScrollOverlayDirective\n class=\"relative w-full h-full px-[10px] libs-ui-components-inputs-upload-view-list {{ classIncludeFileContent() || '' }}\"\n [class.mt-[12px]]=\"multiple() || !showPopupUploadWhenHasFileAndModeSingle()\">\n <ng-content select=\"[label-file]\"></ng-content>\n @for (item of fileList(); track item(); let first = $first) {\n <div\n class=\"libs-ui-components-inputs-upload-view-list-item {{ classIncludeListItem() || '' }}\"\n [class.libs-ui-components-inputs-upload-file-full]=\"modeDisplayFile() === 'full'\"\n [class.libs-ui-components-inputs-upload-file-short]=\"modeDisplayFile() === 'short'\"\n [class.libs-ui-border-error-general]=\"item().error || (messageError() && showBorderErrorAllItemWhenError())\"\n [class.mt-0]=\"first && !multiple() && !showPopupUploadWhenHasFileAndModeSingle()\">\n <div class=\"flex w-full\">\n <div class=\"flex items-center\">\n @if (canSetAvatar() && item().type === 'image') {\n <libs_ui-components-buttons-button\n [type]=\"'button-link-third'\"\n [classIconLeft]=\"\n '!mr-0' + (item().isAvatar ? ' libs-ui-icon-check-circle-solid before:!text-[#00bc62]' : ' libs-ui-icon-check-circle-outline') + (disable() || readonly() || item().isUploading || !!item().error ? ' libs-ui-disable' : '')\n \"\n [popover]=\"{ config: { content: item().isAvatar ? 'i18n_avatar' : 'i18n_choose_as_your_avatar', zIndex: zIndex() } }\"\n [classInclude]=\"'!mr-[12px] !p-0'\"\n [disable]=\"disable() || readonly() || item().isUploading || !!item().error\"\n (outClick)=\"handlerSetAvatar($event, item)\" />\n }\n </div>\n <div\n class=\"flex\"\n [class.w-[calc(100%-28px)]]=\"canSetAvatar()\"\n [class.w-full]=\"!canSetAvatar()\">\n @if (modeDisplayFile() === 'full') {\n <libs_ui-components-inputs-upload-avatar\n [classInclude]=\"classIncludeAvatar()\"\n [disable]=\"disable() || readonly()\"\n [(item)]=\"item\"\n [showVideoDuration]=\"showVideoDuration()\"\n (outOpenPreview)=\"handlerOpenPreviewFile($event)\" />\n }\n <div class=\"relative w-full\">\n <div\n class=\"flex absolute w-full h-full flex-col\"\n [class.flex-col]=\"modeDisplayFile() === 'full'\"\n [class.justify-center]=\"modeDisplayFile() === 'full'\"\n [class.items-center]=\"modeDisplayFile() === 'short'\">\n <libs_ui-components-label\n class=\"flex w-full\"\n [labelLeft]=\"item().name\"\n [zIndexPopover]=\"zIndex() + 1\"\n [labelLeftClass]=\"'libs-ui-font-h6m ' + (disable() || readonly() || item().isUploading || item().error ? 'text-[#6a7383]' : 'text-[#071631]')\"\n [classInclude]=\"modeDisplayFile() === 'short' ? '!mb-0' : ''\" />\n\n @if (!ignoreShowSizeFile()) {\n <div\n class=\"text-[#9ca2ad] libs-ui-font-h7r shrink-0\"\n [class.flex]=\"modeDisplayFile() === 'full'\"\n [class.items-center]=\"modeDisplayFile() === 'short'\"\n [class.ml-[12px]]=\"modeDisplayFile() === 'short'\">\n {{ item().size }}\n </div>\n }\n </div>\n </div>\n @if (item().isUploading && item().percentUploading) {\n <div\n class=\"flex items-center ml-[16px]\"\n [class.mr-[26px]]=\"modeDisplayFile() === 'full'\">\n <div class=\"w-[120px] h-[4px] rounded-[4px] bg-[#f8f9fa] relative\">\n <div\n class=\"absolute top-0 left-0 h-[4px] rounded-[4px] bg-[#00bc62]\"\n [style.width.px]=\"(item().percentUploading ?? 0) * 1.2\"></div>\n </div>\n </div>\n }\n </div>\n </div>\n\n <div class=\"flex ml-[16px]\">\n @if (!ignoreIconPreview()) {\n <libs_ui-components-buttons-button\n [type]=\"'button-link-third'\"\n [classIconLeft]=\"'libs-ui-icon-eye-outline !mr-0'\"\n [popover]=\"{ config: { content: 'i18n_preview', zIndex: zIndex() + 1 } }\"\n [classInclude]=\"'!p-0' + (ignoreIconRemove() && !ignoreIconEdit() ? '' : ' !mr-[12px]')\"\n [disable]=\"item().isUploading || disable() || readonly()\"\n (outClick)=\"handlerOpenPreviewFile(item())\" />\n }\n @if (item().type === 'image' && !item().error && !ignoreIconEdit()) {\n <libs_ui-components-buttons-button\n [type]=\"'button-link-third'\"\n [classIconLeft]=\"'libs-ui-icon-edit-line !mr-0'\"\n [popover]=\"{ config: { content: 'i18n_edit', zIndex: zIndex() + 1 } }\"\n [classInclude]=\"'!p-0' + (ignoreIconRemove() ? '' : ' !mr-[12px]')\"\n [disable]=\"item().isUploading || disable() || readonly()\"\n (outClick)=\"handlerEditImage($event, item)\" />\n }\n @if (!ignoreIconRemove()) {\n <libs_ui-components-buttons-button\n [type]=\"'button-link-third'\"\n [classIconLeft]=\"'libs-ui-icon-close !mr-0'\"\n [popover]=\"{ config: { content: 'i18n_delete', zIndex: zIndex() + 1 } }\"\n [classInclude]=\"'!p-0'\"\n [disable]=\"item().isUploading || disable() || readonly()\"\n (outClick)=\"handlerRemoveFile($event, item)\" />\n }\n </div>\n </div>\n @if (item().error && (multiple() || showPopupUploadWhenHasFileAndModeSingle())) {\n <div class=\"mt-[8px] text-[#ee2d41] libs-ui-font-h7r\">\n @let constHtmlMessage = item().error || ' ';\n {{ constHtmlMessage | translate }}\n </div>\n }\n }\n </div>\n }\n</div>\n", styles: [":host ::ng-deep .libs-ui-components-inputs-upload{width:100%;padding:16px;display:flex;align-items:center;justify-content:center;border-radius:8px;cursor:pointer;background-color:#fff;border:1px dashed #e6e7ea}:host ::ng-deep .libs-ui-components-inputs-upload .libs-ui-components-inputs-upload-icon:before{color:#9ca2ad}:host ::ng-deep .libs-ui-components-inputs-upload .libs-ui-components-inputs-upload-description{color:#9ca2ad}:host ::ng-deep .libs-ui-components-inputs-upload .libs-ui-components-inputs-upload-description span{color:var(--libs-ui-color-default, #226ff5)}:host ::ng-deep .libs-ui-components-inputs-upload:hover,:host ::ng-deep .libs-ui-components-inputs-upload.libs-ui-components-inputs-upload-drag-over{background-color:var(--libs-ui-color-light-3, #f4f8ff);border:1px dashed var(--libs-ui-color-light-1, #226ff5)}:host ::ng-deep .libs-ui-components-inputs-upload:hover .libs-ui-components-inputs-upload-icon:before,:host ::ng-deep .libs-ui-components-inputs-upload.libs-ui-components-inputs-upload-drag-over .libs-ui-components-inputs-upload-icon:before{color:#cdd0d6}:host ::ng-deep .libs-ui-components-inputs-upload:hover .libs-ui-components-inputs-upload-description,:host ::ng-deep .libs-ui-components-inputs-upload.libs-ui-components-inputs-upload-drag-over .libs-ui-components-inputs-upload-description{color:#cdd0d6}:host ::ng-deep .libs-ui-components-inputs-upload:hover .libs-ui-components-inputs-upload-description span,:host ::ng-deep .libs-ui-components-inputs-upload.libs-ui-components-inputs-upload-drag-over .libs-ui-components-inputs-upload-description span{color:#cdd0d6}:host ::ng-deep .libs-ui-components-inputs-upload-disable{cursor:default!important;text-decoration:none;pointer-events:none;background-color:var(--libs-ui-background-disable, #f8f9fa)!important;border:1px dashed #e6e7ea!important}:host ::ng-deep .libs-ui-components-inputs-upload-disable .libs-ui-components-inputs-upload-icon:before{color:var(--libs-ui-text-disable, #9ca2ad)}:host ::ng-deep .libs-ui-components-inputs-upload-disable .libs-ui-components-inputs-upload-description{color:var(--libs-ui-text-disable, #9ca2ad)}:host ::ng-deep .libs-ui-components-inputs-upload-disable .libs-ui-components-inputs-upload-description span{color:var(--libs-ui-text-disable, #9ca2ad)}:host ::ng-deep .libs-ui-components-inputs-upload-readonly{cursor:default!important;text-decoration:none;pointer-events:none;background-color:var(--libs-ui-backgrond-realonly, #f8f9fa)!important;border:1px dashed #e6e7ea!important}:host ::ng-deep .libs-ui-components-inputs-upload-readonly .libs-ui-components-inputs-upload-icon:before{color:#cdd0d6}:host ::ng-deep .libs-ui-components-inputs-upload-readonly .libs-ui-components-inputs-upload-description{color:var(--libs-ui-text-realonly, #071631)}:host ::ng-deep .libs-ui-components-inputs-upload-readonly .libs-ui-components-inputs-upload-description span{color:var(--libs-ui-text-realonly, #071631)}:host ::ng-deep .libs-ui-components-inputs-upload-error{background-color:#fef5f6!important;border:1px dashed #ee2d41!important}:host ::ng-deep .libs-ui-components-inputs-upload-error .libs-ui-components-inputs-upload-icon:before{color:#cdd0d6}:host ::ng-deep .libs-ui-components-inputs-upload-error .libs-ui-components-inputs-upload-description{color:#cdd0d6}:host ::ng-deep .libs-ui-components-inputs-upload-error .libs-ui-components-inputs-upload-description span{color:#cdd0d6}:host ::ng-deep .libs-ui-components-inputs-upload-file-full{background-color:#fff;padding:8px 12px}:host ::ng-deep .libs-ui-components-inputs-upload-file-short{background-color:#f4f8ff;padding:6px 12px}.libs-ui-components-inputs-upload-view-list{overflow-y:auto;max-height:100%;padding:0 10px}.libs-ui-components-inputs-upload-view-list .libs-ui-components-inputs-upload-view-list-item{width:100%;display:flex;align-items:center;justify-content:center;border-radius:4px;margin-bottom:8px}.libs-ui-components-inputs-upload-view-list .libs-ui-components-inputs-upload-view-list-item:hover{background-color:#f8f9fa}\n"], dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "component", type: LibsUiComponentsButtonsButtonComponent, selector: "libs_ui-components-buttons-button", inputs: ["flagMouse", "type", "buttonCustom", "sizeButton", "label", "disable", "isPending", "imageLeft", "classInclude", "classIconLeft", "classIconRight", "classLabel", "iconOnlyType", "popover", "ignoreStopPropagationEvent", "zIndex", "widthLabelPopover", "styleIconLeft", "styleButton", "ignoreFocusWhenInputTab", "ignoreSetClickWhenShowPopover", "ignorePointerEvent", "isActive", "isHandlerEnterDocumentClickButton"], outputs: ["outClick", "outPopoverEvent", "outFunctionsControl"] }, { kind: "component", type: LibsUiComponentsLabelComponent, selector: "libs_ui-components-label", inputs: ["iconPopoverClass", "classInclude", "labelLeft", "labelLeftClass", "labelLeftBehindToggleButton", "popover", "required", "buttonsLeft", "disableButtonsLeft", "buttonsRight", "disableButtonsRight", "labelRight", "labelRightClass", "labelRightRequired", "hasToggle", "toggleSize", "toggleActive", "toggleDisable", "description", "descriptionClass", "buttonsDescription", "disableButtonsDescription", "buttonsDescriptionContainerClass", "onlyShowCount", "zIndexPopover", "timerDestroyPopover", "count", "limitLength"], outputs: ["outClickButton", "outSwitchEvent", "outLabelRightClick", "outLabelLeftClick"] }, { kind: "component", type: LibsUiComponentsInputsUploadAvatarComponent, selector: "libs_ui-components-inputs-upload-avatar", inputs: ["item", "showVideoDuration", "disable", "size", "classInclude"], outputs: ["itemChange", "outOpenPreview"] }, { kind: "directive", type: LibsUiComponentsScrollOverlayDirective, selector: "[LibsUiComponentsScrollOverlayDirective]", inputs: ["debugMode", "ignoreInit", "classContainer", "options", "elementCheckScrollX", "elementCheckScrollY", "elementScroll"], outputs: ["outScroll", "outScrollX", "outScrollY", "outScrollTop", "outScrollBottom"] }, { kind: "directive", type: LibsUiComponentsInputsUploadDirective, selector: "[LibsUiComponentsInputsUploadDirective]", inputs: ["multiple", "accessFiles"], outputs: ["outUploadFiles", "outUploadFile"] }, { kind: "directive", type: LibsUiComponentsInputsUploadDropFileDirective, selector: "[LibsUiComponentsInputsUploadDropFileDirective]", inputs: ["multiple"], outputs: ["outDragOver", "outDragLeave", "outDrop", "outDropFiles", "outDropFile"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
679
|
+
}
|
|
680
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsInputsUploadComponent, decorators: [{
|
|
681
|
+
type: Component,
|
|
682
|
+
args: [{ selector: 'libs_ui-components-inputs-upload', standalone: true, imports: [
|
|
683
|
+
TranslateModule,
|
|
684
|
+
LibsUiComponentsButtonsButtonComponent,
|
|
685
|
+
LibsUiComponentsLabelComponent,
|
|
686
|
+
LibsUiComponentsInputsUploadAvatarComponent,
|
|
687
|
+
LibsUiComponentsScrollOverlayDirective,
|
|
688
|
+
LibsUiComponentsInputsUploadDirective,
|
|
689
|
+
LibsUiComponentsInputsUploadDropFileDirective,
|
|
690
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex flex-col w-full h-full\">\n <div>\n @if (labelConfig(); as labelConfig) {\n <libs_ui-components-label\n [classInclude]=\"labelConfig.classInclude\"\n [labelLeft]=\"labelConfig.labelLeft\"\n [labelLeftClass]=\"labelConfig.labelLeftClass\"\n [required]=\"labelConfig.required\"\n [description]=\"labelConfig.description\"\n [labelRight]=\"labelConfig.labelRight\"\n [labelRightClass]=\"labelConfig.labelRightClass\"\n [onlyShowCount]=\"labelConfig.onlyShowCount\"\n [buttonsLeft]=\"labelConfig.buttonsLeft\"\n [buttonsRight]=\"labelConfig.buttonsRight\"\n [disableButtonsLeft]=\"labelConfig.disableButtonsLeft || disable() || readonly()\"\n [disableButtonsRight]=\"labelConfig.disableButtonsRight || disable() || readonly()\"\n [hasToggle]=\"labelConfig.hasToggle\"\n [toggleActive]=\"labelConfig.toggleActive\"\n [toggleDisable]=\"labelConfig.toggleDisable || disable() || readonly()\"\n [popover]=\"labelConfig.popover\"\n [iconPopoverClass]=\"labelConfig.iconPopoverClass\"\n [onlyShowCount]=\"labelConfig.onlyShowCount\"\n [limitLength]=\"labelConfig.limitLength\"\n [buttonsDescription]=\"labelConfig.buttonsDescription\"\n [disableButtonsDescription]=\"labelConfig.disableButtonsDescription || disable() || readonly()\"\n [buttonsDescriptionContainerClass]=\"labelConfig.buttonsDescriptionContainerClass\"\n [count]=\"labelConfig.count\" />\n }\n @if ((!configDownloadSampleFile()?.position || configDownloadSampleFile()?.position === 'top') && configDownloadSampleFile(); as configDownloadSampleFile) {\n <libs_ui-components-buttons-button\n [type]=\"'button-link-primary'\"\n [classLabel]=\"'libs-ui-font-h7m'\"\n [classInclude]=\"'!mb-[8px] !p-0'\"\n [classIconLeft]=\"'libs-ui-icon-attachment before:!text-[12px]'\"\n [label]=\"configDownloadSampleFile?.title || ' '\"\n (outClick)=\"handlerDownloadSampleFile($event)\" />\n }\n @if (multiple() || !showPopupUploadWhenHasFileAndModeSingle() || (!fileList().length && !multiple())) {\n <div\n #upload\n LibsUiComponentsInputsUploadDirective\n LibsUiComponentsInputsUploadDropFileDirective\n class=\"libs-ui-components-inputs-upload\"\n [class.libs-ui-components-inputs-upload-disable]=\"disable() || readonly() || (!multiple() && fileList().length && !canUploadIfHasExistFile())\"\n [class.libs-ui-components-inputs-upload-readonly]=\"readonly()\"\n [class.libs-ui-components-inputs-upload-error]=\"messageError()\"\n [multiple]=\"multiple()\"\n [accessFiles]=\"accessFiles()\"\n (outUploadFiles)=\"handleUploadFiles($event)\"\n (outUploadFile)=\"handleUploadFiles([$event])\"\n (outDragOver)=\"handlerSetClassDrag(true)\"\n (outDragLeave)=\"handlerSetClassDrag(false)\"\n (outDrop)=\"handlerSetClassDrag(false)\"\n (outDropFiles)=\"handleUploadFiles($event)\"\n (outDropFile)=\"handleUploadFiles([$event])\">\n <div class=\"flex items-center\">\n <div class=\"mr-[16px]\">\n <i class=\"libs-ui-components-inputs-upload-icon libs-ui-icon-file-upload before:!text-[32px]\"></i>\n </div>\n <div class=\"libs-ui-components-inputs-upload-description\">\n @let constHtmlMessage = configDescriptionInputUpload().message || ' ';\n <div\n class=\"mb-[4px] libs-ui-font-h6m\"\n [innerHTML]=\"constHtmlMessage | translate: configDescriptionInputUpload().interpolateParams\"></div>\n @for (item of descriptionFormatAndSizeFileComputed(); track item; let last = $last) {\n <div\n class=\"libs-ui-font-h7r\"\n [class.mb-[4px]]=\"!last\"\n [innerHTML]=\"item.message | translate: item.interpolateParams\"></div>\n }\n </div>\n </div>\n @if (multiple()) {\n <input\n #uploadInput\n class=\"upload-input hidden\"\n type=\"file\"\n name=\"files[]\"\n multiple\n [accept]=\"accessFiles()\" />\n } @else {\n <input\n #uploadInput\n class=\"upload-input hidden\"\n type=\"file\"\n name=\"files[]\"\n [accept]=\"accessFiles()\" />\n }\n </div>\n }\n @if (messageError() && (multiple() || !showPopupUploadWhenHasFileAndModeSingle() || (!fileList().length && !multiple()))) {\n <div class=\"mt-[8px] text-[#ee2d41] libs-ui-font-h7r\">\n @let constHtmlMessage = messageError() || ' ';\n {{ constHtmlMessage | translate: { value: limitFile() } }}\n </div>\n }\n @if (configDownloadSampleFile()?.position === 'bottom' && configDownloadSampleFile(); as configDownloadSampleFile) {\n <libs_ui-components-buttons-button\n [type]=\"'button-link-primary'\"\n [classLabel]=\"'libs-ui-font-h7m'\"\n [classInclude]=\"'!mt-[8px] !p-0'\"\n [classIconLeft]=\"'libs-ui-icon-attachment before:!text-[12px]'\"\n [label]=\"configDownloadSampleFile.title || ' '\"\n (moClick)=\"handlerDownloadSampleFile($event)\" />\n }\n </div>\n @if (fileList().length) {\n <div\n LibsUiComponentsScrollOverlayDirective\n class=\"relative w-full h-full px-[10px] libs-ui-components-inputs-upload-view-list {{ classIncludeFileContent() || '' }}\"\n [class.mt-[12px]]=\"multiple() || !showPopupUploadWhenHasFileAndModeSingle()\">\n <ng-content select=\"[label-file]\"></ng-content>\n @for (item of fileList(); track item(); let first = $first) {\n <div\n class=\"libs-ui-components-inputs-upload-view-list-item {{ classIncludeListItem() || '' }}\"\n [class.libs-ui-components-inputs-upload-file-full]=\"modeDisplayFile() === 'full'\"\n [class.libs-ui-components-inputs-upload-file-short]=\"modeDisplayFile() === 'short'\"\n [class.libs-ui-border-error-general]=\"item().error || (messageError() && showBorderErrorAllItemWhenError())\"\n [class.mt-0]=\"first && !multiple() && !showPopupUploadWhenHasFileAndModeSingle()\">\n <div class=\"flex w-full\">\n <div class=\"flex items-center\">\n @if (canSetAvatar() && item().type === 'image') {\n <libs_ui-components-buttons-button\n [type]=\"'button-link-third'\"\n [classIconLeft]=\"\n '!mr-0' + (item().isAvatar ? ' libs-ui-icon-check-circle-solid before:!text-[#00bc62]' : ' libs-ui-icon-check-circle-outline') + (disable() || readonly() || item().isUploading || !!item().error ? ' libs-ui-disable' : '')\n \"\n [popover]=\"{ config: { content: item().isAvatar ? 'i18n_avatar' : 'i18n_choose_as_your_avatar', zIndex: zIndex() } }\"\n [classInclude]=\"'!mr-[12px] !p-0'\"\n [disable]=\"disable() || readonly() || item().isUploading || !!item().error\"\n (outClick)=\"handlerSetAvatar($event, item)\" />\n }\n </div>\n <div\n class=\"flex\"\n [class.w-[calc(100%-28px)]]=\"canSetAvatar()\"\n [class.w-full]=\"!canSetAvatar()\">\n @if (modeDisplayFile() === 'full') {\n <libs_ui-components-inputs-upload-avatar\n [classInclude]=\"classIncludeAvatar()\"\n [disable]=\"disable() || readonly()\"\n [(item)]=\"item\"\n [showVideoDuration]=\"showVideoDuration()\"\n (outOpenPreview)=\"handlerOpenPreviewFile($event)\" />\n }\n <div class=\"relative w-full\">\n <div\n class=\"flex absolute w-full h-full flex-col\"\n [class.flex-col]=\"modeDisplayFile() === 'full'\"\n [class.justify-center]=\"modeDisplayFile() === 'full'\"\n [class.items-center]=\"modeDisplayFile() === 'short'\">\n <libs_ui-components-label\n class=\"flex w-full\"\n [labelLeft]=\"item().name\"\n [zIndexPopover]=\"zIndex() + 1\"\n [labelLeftClass]=\"'libs-ui-font-h6m ' + (disable() || readonly() || item().isUploading || item().error ? 'text-[#6a7383]' : 'text-[#071631]')\"\n [classInclude]=\"modeDisplayFile() === 'short' ? '!mb-0' : ''\" />\n\n @if (!ignoreShowSizeFile()) {\n <div\n class=\"text-[#9ca2ad] libs-ui-font-h7r shrink-0\"\n [class.flex]=\"modeDisplayFile() === 'full'\"\n [class.items-center]=\"modeDisplayFile() === 'short'\"\n [class.ml-[12px]]=\"modeDisplayFile() === 'short'\">\n {{ item().size }}\n </div>\n }\n </div>\n </div>\n @if (item().isUploading && item().percentUploading) {\n <div\n class=\"flex items-center ml-[16px]\"\n [class.mr-[26px]]=\"modeDisplayFile() === 'full'\">\n <div class=\"w-[120px] h-[4px] rounded-[4px] bg-[#f8f9fa] relative\">\n <div\n class=\"absolute top-0 left-0 h-[4px] rounded-[4px] bg-[#00bc62]\"\n [style.width.px]=\"(item().percentUploading ?? 0) * 1.2\"></div>\n </div>\n </div>\n }\n </div>\n </div>\n\n <div class=\"flex ml-[16px]\">\n @if (!ignoreIconPreview()) {\n <libs_ui-components-buttons-button\n [type]=\"'button-link-third'\"\n [classIconLeft]=\"'libs-ui-icon-eye-outline !mr-0'\"\n [popover]=\"{ config: { content: 'i18n_preview', zIndex: zIndex() + 1 } }\"\n [classInclude]=\"'!p-0' + (ignoreIconRemove() && !ignoreIconEdit() ? '' : ' !mr-[12px]')\"\n [disable]=\"item().isUploading || disable() || readonly()\"\n (outClick)=\"handlerOpenPreviewFile(item())\" />\n }\n @if (item().type === 'image' && !item().error && !ignoreIconEdit()) {\n <libs_ui-components-buttons-button\n [type]=\"'button-link-third'\"\n [classIconLeft]=\"'libs-ui-icon-edit-line !mr-0'\"\n [popover]=\"{ config: { content: 'i18n_edit', zIndex: zIndex() + 1 } }\"\n [classInclude]=\"'!p-0' + (ignoreIconRemove() ? '' : ' !mr-[12px]')\"\n [disable]=\"item().isUploading || disable() || readonly()\"\n (outClick)=\"handlerEditImage($event, item)\" />\n }\n @if (!ignoreIconRemove()) {\n <libs_ui-components-buttons-button\n [type]=\"'button-link-third'\"\n [classIconLeft]=\"'libs-ui-icon-close !mr-0'\"\n [popover]=\"{ config: { content: 'i18n_delete', zIndex: zIndex() + 1 } }\"\n [classInclude]=\"'!p-0'\"\n [disable]=\"item().isUploading || disable() || readonly()\"\n (outClick)=\"handlerRemoveFile($event, item)\" />\n }\n </div>\n </div>\n @if (item().error && (multiple() || showPopupUploadWhenHasFileAndModeSingle())) {\n <div class=\"mt-[8px] text-[#ee2d41] libs-ui-font-h7r\">\n @let constHtmlMessage = item().error || ' ';\n {{ constHtmlMessage | translate }}\n </div>\n }\n }\n </div>\n }\n</div>\n", styles: [":host ::ng-deep .libs-ui-components-inputs-upload{width:100%;padding:16px;display:flex;align-items:center;justify-content:center;border-radius:8px;cursor:pointer;background-color:#fff;border:1px dashed #e6e7ea}:host ::ng-deep .libs-ui-components-inputs-upload .libs-ui-components-inputs-upload-icon:before{color:#9ca2ad}:host ::ng-deep .libs-ui-components-inputs-upload .libs-ui-components-inputs-upload-description{color:#9ca2ad}:host ::ng-deep .libs-ui-components-inputs-upload .libs-ui-components-inputs-upload-description span{color:var(--libs-ui-color-default, #226ff5)}:host ::ng-deep .libs-ui-components-inputs-upload:hover,:host ::ng-deep .libs-ui-components-inputs-upload.libs-ui-components-inputs-upload-drag-over{background-color:var(--libs-ui-color-light-3, #f4f8ff);border:1px dashed var(--libs-ui-color-light-1, #226ff5)}:host ::ng-deep .libs-ui-components-inputs-upload:hover .libs-ui-components-inputs-upload-icon:before,:host ::ng-deep .libs-ui-components-inputs-upload.libs-ui-components-inputs-upload-drag-over .libs-ui-components-inputs-upload-icon:before{color:#cdd0d6}:host ::ng-deep .libs-ui-components-inputs-upload:hover .libs-ui-components-inputs-upload-description,:host ::ng-deep .libs-ui-components-inputs-upload.libs-ui-components-inputs-upload-drag-over .libs-ui-components-inputs-upload-description{color:#cdd0d6}:host ::ng-deep .libs-ui-components-inputs-upload:hover .libs-ui-components-inputs-upload-description span,:host ::ng-deep .libs-ui-components-inputs-upload.libs-ui-components-inputs-upload-drag-over .libs-ui-components-inputs-upload-description span{color:#cdd0d6}:host ::ng-deep .libs-ui-components-inputs-upload-disable{cursor:default!important;text-decoration:none;pointer-events:none;background-color:var(--libs-ui-background-disable, #f8f9fa)!important;border:1px dashed #e6e7ea!important}:host ::ng-deep .libs-ui-components-inputs-upload-disable .libs-ui-components-inputs-upload-icon:before{color:var(--libs-ui-text-disable, #9ca2ad)}:host ::ng-deep .libs-ui-components-inputs-upload-disable .libs-ui-components-inputs-upload-description{color:var(--libs-ui-text-disable, #9ca2ad)}:host ::ng-deep .libs-ui-components-inputs-upload-disable .libs-ui-components-inputs-upload-description span{color:var(--libs-ui-text-disable, #9ca2ad)}:host ::ng-deep .libs-ui-components-inputs-upload-readonly{cursor:default!important;text-decoration:none;pointer-events:none;background-color:var(--libs-ui-backgrond-realonly, #f8f9fa)!important;border:1px dashed #e6e7ea!important}:host ::ng-deep .libs-ui-components-inputs-upload-readonly .libs-ui-components-inputs-upload-icon:before{color:#cdd0d6}:host ::ng-deep .libs-ui-components-inputs-upload-readonly .libs-ui-components-inputs-upload-description{color:var(--libs-ui-text-realonly, #071631)}:host ::ng-deep .libs-ui-components-inputs-upload-readonly .libs-ui-components-inputs-upload-description span{color:var(--libs-ui-text-realonly, #071631)}:host ::ng-deep .libs-ui-components-inputs-upload-error{background-color:#fef5f6!important;border:1px dashed #ee2d41!important}:host ::ng-deep .libs-ui-components-inputs-upload-error .libs-ui-components-inputs-upload-icon:before{color:#cdd0d6}:host ::ng-deep .libs-ui-components-inputs-upload-error .libs-ui-components-inputs-upload-description{color:#cdd0d6}:host ::ng-deep .libs-ui-components-inputs-upload-error .libs-ui-components-inputs-upload-description span{color:#cdd0d6}:host ::ng-deep .libs-ui-components-inputs-upload-file-full{background-color:#fff;padding:8px 12px}:host ::ng-deep .libs-ui-components-inputs-upload-file-short{background-color:#f4f8ff;padding:6px 12px}.libs-ui-components-inputs-upload-view-list{overflow-y:auto;max-height:100%;padding:0 10px}.libs-ui-components-inputs-upload-view-list .libs-ui-components-inputs-upload-view-list-item{width:100%;display:flex;align-items:center;justify-content:center;border-radius:4px;margin-bottom:8px}.libs-ui-components-inputs-upload-view-list .libs-ui-components-inputs-upload-view-list-item:hover{background-color:#f8f9fa}\n"] }]
|
|
691
|
+
}], ctorParameters: () => [] });
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* Generated bundle index. Do not edit.
|
|
695
|
+
*/
|
|
696
|
+
|
|
697
|
+
export { LibsUiComponentsInputsUploadAvatarComponent, LibsUiComponentsInputsUploadComponent, LibsUiComponentsInputsUploadDirective, LibsUiComponentsInputsUploadDropFileDirective };
|
|
698
|
+
//# sourceMappingURL=libs-ui-components-inputs-upload.mjs.map
|