@libs-ui/components-inputs-upload 0.2.30-6.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.
@@ -0,0 +1,687 @@
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.13", ngImport: i0, type: LibsUiPipesInputsUploadCalcDurationVideoPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
41
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: LibsUiPipesInputsUploadCalcDurationVideoPipe, isStandalone: true, name: "LibsUiPipesInputsUploadCalcDurationVideoPipe" });
42
+ }
43
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", 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'].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.13", ngImport: i0, type: LibsUiPipesInputsUploadCheckFileExtensionPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
75
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: LibsUiPipesInputsUploadCheckFileExtensionPipe, isStandalone: true, name: "LibsUiPipesInputsUploadCheckFileExtensionPipe" });
76
+ }
77
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", 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
+ outOpenPreview = output();
92
+ constructor(linkImageError) {
93
+ this.linkImageError = linkImageError;
94
+ }
95
+ async handlerImageError(event) {
96
+ if (!this.linkImageError) {
97
+ return;
98
+ }
99
+ event.target.src = this.linkImageError;
100
+ }
101
+ handlerImageClick(event) {
102
+ event.stopPropagation();
103
+ this.outOpenPreview.emit(this.item());
104
+ }
105
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsInputsUploadAvatarComponent, deps: [{ token: LINK_IMAGE_ERROR_TOKEN_INJECT, optional: true }], target: i0.ɵɵFactoryTarget.Component });
106
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", 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 } }, outputs: { item: "itemChange", outOpenPreview: "outOpenPreview" }, ngImport: i0, template: "<div class=\"flex mr-[12px] bg-[#ffffff] rounded-[4px]\"\n [class.libs-ui-disable]=\"disable() || item().isUploading || item().error\">\n @if (item() | LibsUiPipesInputsUploadCheckFileExtensionPipe:'image') {\n <div [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 [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 }\n @else if (item() | LibsUiPipesInputsUploadCheckFileExtensionPipe:'video') {\n <div class=\"relative\"\n [style.width.px]=\"size() || 32\"\n [style.height.px]=\"size() || 32\">\n @if (item().url || item().origin_url) {\n <video #videoRef\n [style.width.px]=\"size || 32\"\n [style.height.px]=\"size || 32\"\n class=\"rounded-[4px]\"\n preload=\"metadata\"\n [src]=\"(item().url || item().origin_url || '') | LibsUiPipesSecurityTrustPipe:'resourceUrl'\"></video>\n <div class=\"absolute w-full h-full top-0 bg-[#001433] opacity-40 rounded-[4px]\">\n </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\n 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 }\n @else if (item() | LibsUiPipesInputsUploadCheckFileExtensionPipe:'pdf') {\n <ng-container *ngComponentOutlet=\"'pdf'|LibsUiIconsGetIconComponentPipe|async\" />\n }\n @else if (item() | LibsUiPipesInputsUploadCheckFileExtensionPipe:'word') {\n <ng-container *ngComponentOutlet=\"'word'|LibsUiIconsGetIconComponentPipe|async\" />\n }\n @else if (item() | LibsUiPipesInputsUploadCheckFileExtensionPipe:'pptx') {\n <ng-container *ngComponentOutlet=\"'pptx'|LibsUiIconsGetIconComponentPipe|async\" />\n }\n @else if (item() | LibsUiPipesInputsUploadCheckFileExtensionPipe:'xlsx') {\n <ng-container *ngComponentOutlet=\"'xlsx'|LibsUiIconsGetIconComponentPipe|async\" />\n }\n @else {\n <div [style.width.px]=\"size() || 32\"\n [style.height.px]=\"size() || 32\"\n class=\"flex items-center justify-center\">\n <i 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 });
107
+ }
108
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsInputsUploadAvatarComponent, decorators: [{
109
+ type: Component,
110
+ args: [{ selector: 'libs_ui-components-inputs-upload-avatar', standalone: true, imports: [
111
+ NgComponentOutlet, AsyncPipe, TranslateModule,
112
+ LibsUiComponentsSpinnerComponent,
113
+ LibsUiPipesSecurityTrustPipe,
114
+ LibsUiPipesInputsUploadCalcDurationVideoPipe,
115
+ LibsUiPipesInputsUploadCheckFileExtensionPipe,
116
+ LibsUiIconsGetIconComponentPipe,
117
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex mr-[12px] bg-[#ffffff] rounded-[4px]\"\n [class.libs-ui-disable]=\"disable() || item().isUploading || item().error\">\n @if (item() | LibsUiPipesInputsUploadCheckFileExtensionPipe:'image') {\n <div [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 [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 }\n @else if (item() | LibsUiPipesInputsUploadCheckFileExtensionPipe:'video') {\n <div class=\"relative\"\n [style.width.px]=\"size() || 32\"\n [style.height.px]=\"size() || 32\">\n @if (item().url || item().origin_url) {\n <video #videoRef\n [style.width.px]=\"size || 32\"\n [style.height.px]=\"size || 32\"\n class=\"rounded-[4px]\"\n preload=\"metadata\"\n [src]=\"(item().url || item().origin_url || '') | LibsUiPipesSecurityTrustPipe:'resourceUrl'\"></video>\n <div class=\"absolute w-full h-full top-0 bg-[#001433] opacity-40 rounded-[4px]\">\n </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\n 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 }\n @else if (item() | LibsUiPipesInputsUploadCheckFileExtensionPipe:'pdf') {\n <ng-container *ngComponentOutlet=\"'pdf'|LibsUiIconsGetIconComponentPipe|async\" />\n }\n @else if (item() | LibsUiPipesInputsUploadCheckFileExtensionPipe:'word') {\n <ng-container *ngComponentOutlet=\"'word'|LibsUiIconsGetIconComponentPipe|async\" />\n }\n @else if (item() | LibsUiPipesInputsUploadCheckFileExtensionPipe:'pptx') {\n <ng-container *ngComponentOutlet=\"'pptx'|LibsUiIconsGetIconComponentPipe|async\" />\n }\n @else if (item() | LibsUiPipesInputsUploadCheckFileExtensionPipe:'xlsx') {\n <ng-container *ngComponentOutlet=\"'xlsx'|LibsUiIconsGetIconComponentPipe|async\" />\n }\n @else {\n <div [style.width.px]=\"size() || 32\"\n [style.height.px]=\"size() || 32\"\n class=\"flex items-center justify-center\">\n <i 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" }]
118
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
119
+ type: Optional
120
+ }, {
121
+ type: Inject,
122
+ args: [LINK_IMAGE_ERROR_TOKEN_INJECT]
123
+ }] }] });
124
+
125
+ const getDescriptionFormatAndSizeFileDefault = (type, maxImageSize, maxVideoSize, maxDocumentSize, maxAudioSize) => {
126
+ const image = {
127
+ message: 'i18n_note_upload_image_volume',
128
+ interpolateParams: { value: getLabelBySizeFile(maxImageSize, 0) }
129
+ };
130
+ const video = {
131
+ message: 'i18n_note_upload_video_volume',
132
+ interpolateParams: { value: getLabelBySizeFile(maxVideoSize, 0) }
133
+ };
134
+ const document = {
135
+ message: 'i18n_note_upload_file_volume',
136
+ interpolateParams: { value: getLabelBySizeFile(maxDocumentSize, 0) }
137
+ };
138
+ const audio = {
139
+ message: 'i18n_note_upload_audio_volume',
140
+ interpolateParams: { value: getLabelBySizeFile(maxAudioSize, 0) }
141
+ };
142
+ const typeSplit = type.split('_');
143
+ const description = [];
144
+ if (typeSplit.includes('image')) {
145
+ description.push(image);
146
+ }
147
+ if (typeSplit.includes('audio')) {
148
+ description.push(audio);
149
+ }
150
+ if (typeSplit.includes('video')) {
151
+ description.push(video);
152
+ }
153
+ if (typeSplit.includes('document')) {
154
+ description.push(document);
155
+ }
156
+ return description;
157
+ };
158
+
159
+ class LibsUiComponentsInputsUploadDropFileDirective {
160
+ elementRef;
161
+ onDestroy = new Subject();
162
+ multiple = input(true, { transform: (value) => value ?? true });
163
+ outDragOver = output();
164
+ outDragLeave = output();
165
+ outDrop = output();
166
+ outDropFiles = output();
167
+ outDropFile = output();
168
+ constructor(elementRef) {
169
+ this.elementRef = elementRef;
170
+ }
171
+ ngAfterViewInit() {
172
+ fromEvent(this.elementRef.nativeElement, 'dragover').pipe(takeUntil(this.onDestroy)).subscribe((e) => {
173
+ e.stopPropagation();
174
+ e.preventDefault();
175
+ this.outDragOver.emit(e);
176
+ });
177
+ fromEvent(this.elementRef.nativeElement, 'dragleave').pipe(takeUntil(this.onDestroy)).subscribe((e) => {
178
+ e.stopPropagation();
179
+ e.preventDefault();
180
+ if (checkMouseOverInContainer(e, this.elementRef.nativeElement)) {
181
+ return;
182
+ }
183
+ this.outDragLeave.emit(e);
184
+ });
185
+ fromEvent(this.elementRef.nativeElement, 'drop').pipe(takeUntil(this.onDestroy)).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.13", ngImport: i0, type: LibsUiComponentsInputsUploadDropFileDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
205
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", 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.13", 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').pipe(takeUntil$1(this.onDestroy)).subscribe((e) => {
225
+ e.stopPropagation();
226
+ e.preventDefault();
227
+ const inputElementUpload = document.createElement('input');
228
+ inputElementUpload.type = 'file';
229
+ inputElementUpload.accept = this.accessFiles();
230
+ inputElementUpload.multiple = this.multiple();
231
+ inputElementUpload.style.display = 'none';
232
+ inputElementUpload.click();
233
+ fromEvent(inputElementUpload, 'change').pipe(takeUntil$1(this.onDestroy)).subscribe((event) => {
234
+ const files = Array.from(event.dataTransfer?.files || event.target?.files || []);
235
+ inputElementUpload.remove();
236
+ if (!files?.length) {
237
+ return;
238
+ }
239
+ if (this.multiple()) {
240
+ this.outUploadFiles.emit(files);
241
+ return;
242
+ }
243
+ this.outUploadFile.emit(files[0]);
244
+ });
245
+ });
246
+ }
247
+ ngOnDestroy() {
248
+ this.onDestroy.next();
249
+ this.onDestroy.complete();
250
+ }
251
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsInputsUploadDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
252
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", 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 });
253
+ }
254
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsInputsUploadDirective, decorators: [{
255
+ type: Directive,
256
+ args: [{
257
+ // eslint-disable-next-line @angular-eslint/directive-selector
258
+ selector: '[LibsUiComponentsInputsUploadDirective]',
259
+ standalone: true
260
+ }]
261
+ }] });
262
+
263
+ class LibsUiComponentsInputsUploadComponent {
264
+ // #region PROPERTIES
265
+ imageEditorComponentRef;
266
+ previewFileComponentRef;
267
+ previewFileImageComponentRef;
268
+ isDragOver = signal(false);
269
+ fileList = signal([]);
270
+ accessFiles = signal('');
271
+ messageError = signal(undefined);
272
+ descriptionFormatAndSizeFileComputed = computed(() => {
273
+ if (this.descriptionFormatAndSizeFile()?.length) {
274
+ return this.descriptionFormatAndSizeFile();
275
+ }
276
+ return getDescriptionFormatAndSizeFileDefault(this.fileType(), this.maxImageSize(), this.maxVideoSize(), this.maxDocumentSize(), this.maxAudioSize());
277
+ });
278
+ onDestroy = new Subject();
279
+ // #endregion
280
+ // #region INPUTS
281
+ originFiles = input([], { transform: val => val ?? [] });
282
+ fileType = input('image_video_document', { transform: val => val ?? 'image_video_document' });
283
+ multiple = input();
284
+ canUploadIfHasExistFile = input(false, { transform: val => val ?? false });
285
+ canSetAvatar = input(false);
286
+ limitFile = input(10, { transform: val => val ?? 10 });
287
+ maxTotalSize = input(10 * 1024 * 1024, { transform: val => val ?? 10 * 1024 * 1024 });
288
+ maxImageSize = input(5 * 1024 * 1024, { transform: val => val ?? 5 * 1024 * 1024 });
289
+ maxVideoSize = input(10 * 1024 * 1024, { transform: val => val ?? 10 * 1024 * 1024 });
290
+ maxDocumentSize = input(10 * 1024 * 1024, { transform: val => val ?? 10 * 1024 * 1024 });
291
+ maxAudioSize = input(10 * 1024 * 1024, { transform: val => val ?? 10 * 1024 * 1024 });
292
+ imageExtList = input(ImageExtList, { transform: val => val ?? ImageExtList });
293
+ videoExtList = input(VideoExtList, { transform: val => val ?? VideoExtList });
294
+ documentExtList = input(DocumentExtList, { transform: val => val ?? DocumentExtList });
295
+ audioExtList = input(AudioExtList, { transform: val => val ?? AudioExtList });
296
+ classIncludeListItem = input();
297
+ validRequired = input();
298
+ disable = input(false, { transform: val => val ?? false });
299
+ readonly = input(false, { transform: val => val ?? false });
300
+ aspectRatio = input();
301
+ zIndex = input(1200, { transform: val => val ?? 1200 });
302
+ ignoreShowSizeFile = input(false, { transform: val => val ?? false });
303
+ allowShowPushMessageMaxSizeError = input(false, { transform: val => val ?? false });
304
+ messageTypeFileError = input('i18n_the_file_support_format_is_not_correct', { transform: val => val || 'i18n_the_file_support_format_is_not_correct' });
305
+ messageMaxSizeError = input('i18n_file_size_exceeds_the_allowed_limit', { transform: val => val || 'i18n_file_size_exceeds_the_allowed_limit' });
306
+ messageFileUploadError = input('i18n_invalid_file_upload', { transform: val => val || 'i18n_invalid_file_upload' });
307
+ 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' });
308
+ configDescriptionInputUpload = input({ message: 'i18n_drag_file_here_to_upload_or_select_file' }, {
309
+ transform: val => val ?? { message: 'i18n_drag_file_here_to_upload_or_select_file' }
310
+ });
311
+ modeDisplayFile = input('full', { transform: val => val || 'full' });
312
+ descriptionFormatAndSizeFile = input();
313
+ showVideoDuration = input(false, { transform: val => val ?? false });
314
+ labelConfig = input();
315
+ showPopupUploadWhenHasFileAndModeSingle = input(false, { transform: val => val ?? false });
316
+ ignoreIconRemove = input(false, { transform: val => val ?? false });
317
+ ignoreIconEdit = input(false, { transform: val => val ?? false });
318
+ ignoreIconPreview = input(true, { transform: val => val ?? true });
319
+ classIncludeFileContent = input();
320
+ showBorderErrorAllItemWhenError = input(false, { transform: val => val ?? false });
321
+ configDownloadSampleFile = input();
322
+ // #endregion
323
+ // #region OUTPUTS
324
+ outClose = output();
325
+ outFileChanged = output();
326
+ outFileRemoved = output();
327
+ outFunctionsControl = output();
328
+ // #endregion
329
+ // #region VIEW CHILDREN
330
+ uploadRef = viewChild('upload');
331
+ uploadInputRef = viewChild('uploadInput');
332
+ // #endregion
333
+ // #region INJECTIONS
334
+ dynamicComponentService = inject(LibsUiDynamicComponentService);
335
+ translateService = inject(TranslateService);
336
+ notificationService = inject(LibsUiNotificationService);
337
+ // #endregion
338
+ constructor() {
339
+ effect(() => {
340
+ if (this.originFiles()) {
341
+ untracked(() => {
342
+ this.fileList.set([...this.originFiles()]);
343
+ });
344
+ }
345
+ });
346
+ }
347
+ // #region LIFECYCLE HOOKS
348
+ ngOnInit() {
349
+ this.outFunctionsControl.emit({
350
+ checkIsValid: this.validate.bind(this),
351
+ removeAll: this.removeAllFile.bind(this),
352
+ uploading: async (process, id) => {
353
+ const fileUploading = this.fileList().find(file => file().id === id);
354
+ if (fileUploading) {
355
+ fileUploading.update(file => ({ ...file, percentUploading: process.percent, isUploading: process.percent !== 100 }));
356
+ }
357
+ },
358
+ setMessageError: async (message, id) => {
359
+ this.messageError.set(message);
360
+ if (id) {
361
+ const fileError = this.fileList().find(file => file().id === id);
362
+ if (fileError) {
363
+ fileError.update(file => ({ ...file, error: message }));
364
+ }
365
+ }
366
+ },
367
+ handlerUploadFile: this.showUploadPopup.bind(this)
368
+ });
369
+ }
370
+ ngAfterViewInit() {
371
+ setTimeout(() => {
372
+ this.initAccessFiles();
373
+ }, 0);
374
+ }
375
+ // #endregion
376
+ // #region INITIALIZATION
377
+ async initAccessFiles() {
378
+ const accessExts = [];
379
+ const typeSplit = this.fileType().split('_');
380
+ if (typeSplit.includes('image')) {
381
+ accessExts.push(...this.imageExtList());
382
+ }
383
+ if (typeSplit.includes('document')) {
384
+ accessExts.push(...this.documentExtList());
385
+ }
386
+ if (typeSplit.includes('video')) {
387
+ accessExts.push(...this.videoExtList());
388
+ }
389
+ if (typeSplit.includes('audio')) {
390
+ accessExts.push(...this.audioExtList());
391
+ }
392
+ this.accessFiles.set(accessExts.map(ext => `.${ext}`).join(','));
393
+ }
394
+ // #endregion
395
+ // #region FILE OPERATIONS
396
+ async handlerSetClassDrag(toogle) {
397
+ this.uploadRef()?.nativeElement.classList.toggle('libs-ui-components-inputs-upload-drag-over', toogle);
398
+ }
399
+ async handleUploadFiles(files) {
400
+ if (this.maxTotalSize()) {
401
+ let total = 0;
402
+ for (let i = 0; i < files.length; i++) {
403
+ total += files[i].size;
404
+ }
405
+ if (this.maxTotalSize() < total) {
406
+ this.notificationService.showCompTypeTextError(this.translateService.instant('i18n_size_not_number_mb', { number: this.maxTotalSize() / 1024 / 1024 }), { timeRemove: 3000 });
407
+ return;
408
+ }
409
+ }
410
+ let errorExceedsMaxFile = false;
411
+ if (!files || !files.length) {
412
+ return;
413
+ }
414
+ if (!this.multiple() && this.fileList().length && !this.canUploadIfHasExistFile()) {
415
+ return;
416
+ }
417
+ const remainFileTotal = this.limitFile() - this.fileList().length;
418
+ if (files.length > remainFileTotal) {
419
+ errorExceedsMaxFile = true;
420
+ this.messageError.set(this.messageTotalFileExceedsError());
421
+ }
422
+ for (let i = 0; i < files.length; i++) {
423
+ const file = files[i];
424
+ const isImage = isTypeImage(file);
425
+ const isVideo = isTypeVideo(file);
426
+ const isAudio = isTypeAudio(file);
427
+ const newFile = {
428
+ name: file.name,
429
+ file: file,
430
+ size: getLabelBySizeFile(file.size),
431
+ type: isImage ? 'image' : isVideo ? 'video' : isAudio ? 'audio' : 'document',
432
+ id: uuid()
433
+ };
434
+ if (!(await this.checkValidFileExtension(file))) {
435
+ if (!errorExceedsMaxFile) {
436
+ this.messageError.set(this.multiple() ? this.messageFileUploadError() : this.messageTypeFileError());
437
+ }
438
+ newFile.error = this.messageTypeFileError();
439
+ await this.pushFileInList(file, newFile);
440
+ continue;
441
+ }
442
+ if (!(await this.checkValidFileSize(file))) {
443
+ if (!errorExceedsMaxFile) {
444
+ this.messageError.set(this.multiple() ? this.messageFileUploadError() : this.messageMaxSizeError());
445
+ }
446
+ newFile.error = this.messageMaxSizeError();
447
+ if (!this.multiple() && this.allowShowPushMessageMaxSizeError()) {
448
+ this.notificationService.showCompTypeTextError(this.messageMaxSizeError());
449
+ return;
450
+ }
451
+ await this.pushFileInList(file, newFile);
452
+ continue;
453
+ }
454
+ await this.pushFileInList(file, newFile);
455
+ }
456
+ if (this.canSetAvatar() && this.fileList().length && !this.fileList().find(file => file().isAvatar)) {
457
+ this.fileList.update(fileList => {
458
+ const itemImage = fileList.find(file => file().type === 'image');
459
+ if (itemImage) {
460
+ itemImage.update(file => ({ ...file, isAvatar: true }));
461
+ }
462
+ return [...fileList];
463
+ });
464
+ }
465
+ this.outFileChanged.emit(this.fileList());
466
+ this.validate();
467
+ }
468
+ async pushFileInList(file, newFile) {
469
+ newFile.url = await convertFileToBase64_ObjectUrl(file);
470
+ this.fileList.update(fileList => {
471
+ fileList.splice(0, this.canUploadIfHasExistFile() ? 1 : 0, signal(newFile));
472
+ return [...fileList];
473
+ });
474
+ }
475
+ async handlerOpenPreviewFile(item) {
476
+ if (item.type === 'document') {
477
+ this.previewFileDocument(item);
478
+ return;
479
+ }
480
+ this.previewFileImage(item);
481
+ }
482
+ async previewFileDocument(item) {
483
+ if (this.previewFileComponentRef) {
484
+ return;
485
+ }
486
+ this.previewFileComponentRef = this.dynamicComponentService.resolveComponentFactory(LibsUiComponentsPreviewFileComponent);
487
+ this.previewFileComponentRef.setInput('data', item);
488
+ this.previewFileComponentRef.setInput('zIndex', this.zIndex() + 1);
489
+ this.previewFileComponentRef.instance.outClose.subscribe(() => {
490
+ this.dynamicComponentService.remove(this.previewFileComponentRef);
491
+ this.previewFileComponentRef = undefined;
492
+ });
493
+ this.dynamicComponentService.addToBody(this.previewFileComponentRef);
494
+ }
495
+ async previewFileImage(item) {
496
+ if (this.previewFileImageComponentRef) {
497
+ return;
498
+ }
499
+ this.previewFileImageComponentRef = this.dynamicComponentService.resolveComponentFactory(LibsUiComponentsGalleryViewerComponent);
500
+ const url = item.url || item.origin_url;
501
+ this.previewFileImageComponentRef.setInput('images', [{ url }]);
502
+ this.previewFileImageComponentRef.setInput('imageSelected', { url });
503
+ this.previewFileImageComponentRef.setInput('fieldDisplaySrcImage', 'url');
504
+ this.previewFileImageComponentRef.setInput('singleImage', true);
505
+ this.previewFileImageComponentRef.setInput('zIndex', this.zIndex() + 1);
506
+ this.previewFileImageComponentRef.instance.outClose.subscribe(() => {
507
+ this.dynamicComponentService.remove(this.previewFileImageComponentRef);
508
+ this.previewFileImageComponentRef = undefined;
509
+ });
510
+ this.dynamicComponentService.addToBody(this.previewFileImageComponentRef);
511
+ }
512
+ async handlerEditImage(event, item) {
513
+ event.stopPropagation();
514
+ this.showEditModal(item);
515
+ }
516
+ async handlerRemoveFile(event, item) {
517
+ event.stopPropagation();
518
+ this.removeFile(item);
519
+ if (this.originFiles().find(file => file().url === item().url)) {
520
+ this.outFileRemoved.emit(item);
521
+ }
522
+ this.validate();
523
+ if (!this.multiple() && this.showPopupUploadWhenHasFileAndModeSingle()) {
524
+ setTimeout(() => {
525
+ this.showUploadPopup();
526
+ }, 0);
527
+ }
528
+ }
529
+ async removeFile(fileItem) {
530
+ this.fileList.update(fileList => fileList.filter(item => item().id !== fileItem().id));
531
+ if (this.canSetAvatar() && fileItem().isAvatar && this.fileList().length) {
532
+ this.fileList.update(fileList => {
533
+ fileList[0].update(file => ({ ...file, isAvatar: true }));
534
+ return [...fileList];
535
+ });
536
+ }
537
+ this.outFileChanged.emit(this.fileList());
538
+ }
539
+ async showEditModal(fileItem) {
540
+ if (this.imageEditorComponentRef) {
541
+ return;
542
+ }
543
+ const fileDataUrl = fileItem().url || fileItem().origin_url || '';
544
+ this.imageEditorComponentRef = this.dynamicComponentService.resolveComponentFactory(LibsUiComponentsImageEditorComponent);
545
+ this.imageEditorComponentRef.setInput('imgSrc', fileDataUrl);
546
+ this.imageEditorComponentRef.setInput('zIndex', this.zIndex() + 1);
547
+ this.imageEditorComponentRef.setInput('nameFile', fileItem().name);
548
+ this.imageEditorComponentRef.setInput('aspectRatio', this.aspectRatio());
549
+ this.imageEditorComponentRef.instance.outClose.subscribe(() => {
550
+ this.dynamicComponentService.remove(this.imageEditorComponentRef);
551
+ this.imageEditorComponentRef = undefined;
552
+ });
553
+ this.imageEditorComponentRef.instance.outSaveFile.subscribe(async (result) => {
554
+ const messageError = !(await this.checkValidFileSize(result.file)) ? this.messageMaxSizeError() : undefined;
555
+ const nameFile = fileItem().file?.name || fileItem().name;
556
+ 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 }));
557
+ this.outFileChanged.emit(this.fileList());
558
+ this.imageEditorComponentRef?.instance.outClose.emit({ isClickButtonClose: true });
559
+ });
560
+ this.dynamicComponentService.addToBody(this.imageEditorComponentRef);
561
+ }
562
+ async checkValidFileExtension(file) {
563
+ const extension = getFileExtension(file);
564
+ if (!extension) {
565
+ return false;
566
+ }
567
+ const isImage = isTypeImage(file);
568
+ const isVideo = isTypeVideo(file);
569
+ const isAudio = isTypeAudio(file);
570
+ const validImage = isIncludeImageExtList(extension, this.imageExtList());
571
+ const validVideo = isIncludeVideoExtList(extension, this.videoExtList());
572
+ const validAudio = isIncludeAudioExtList(extension, this.audioExtList());
573
+ const validDocument = isIncludeDocumentExtList(extension, this.documentExtList());
574
+ const typeSplit = this.fileType().split('_');
575
+ if (isImage && typeSplit.includes('image')) {
576
+ return validImage;
577
+ }
578
+ if (isVideo && typeSplit.includes('video')) {
579
+ return validVideo;
580
+ }
581
+ if (isAudio && typeSplit.includes('audio')) {
582
+ return validAudio;
583
+ }
584
+ if (typeSplit.includes('document')) {
585
+ return validDocument;
586
+ }
587
+ return false;
588
+ }
589
+ async checkValidFileSize(file) {
590
+ const isImage = isTypeImage(file);
591
+ const isVideo = isTypeVideo(file);
592
+ const isAudio = isTypeAudio(file);
593
+ const validImage = file.size <= this.maxImageSize();
594
+ const validVideo = file.size <= this.maxVideoSize();
595
+ const validAudio = file.size <= this.maxAudioSize();
596
+ const validDocument = file.size <= this.maxDocumentSize();
597
+ const typeSplit = this.fileType().split('_');
598
+ if (isImage && typeSplit.includes('image')) {
599
+ return validImage;
600
+ }
601
+ if (isVideo && typeSplit.includes('video')) {
602
+ return validVideo;
603
+ }
604
+ if (isAudio && typeSplit.includes('audio')) {
605
+ return validAudio;
606
+ }
607
+ if (typeSplit.includes('document')) {
608
+ return validDocument;
609
+ }
610
+ return false;
611
+ }
612
+ async validate() {
613
+ if (this.validRequired()?.isRequired && !this.fileList().length) {
614
+ this.messageError.set(this.validRequired()?.message || ERROR_MESSAGE_EMPTY_VALID);
615
+ return false;
616
+ }
617
+ if (this.multiple() && this.fileList().length > this.limitFile()) {
618
+ this.messageError.set(this.messageTotalFileExceedsError());
619
+ return false;
620
+ }
621
+ const fileError = this.fileList().find(item => item().error);
622
+ if (fileError) {
623
+ this.messageError.set(this.multiple() ? this.messageFileUploadError() : fileError().error);
624
+ return false;
625
+ }
626
+ this.messageError.set(undefined);
627
+ return true;
628
+ }
629
+ async handlerSetAvatar(event, file) {
630
+ event.stopPropagation();
631
+ this.fileList().forEach(item => {
632
+ if (item().id === file().id) {
633
+ item.update(file => ({ ...file, isAvatar: true }));
634
+ return;
635
+ }
636
+ item.update(file => ({ ...file, isAvatar: false }));
637
+ });
638
+ this.outFileChanged.emit(this.fileList());
639
+ }
640
+ async removeAllFile() {
641
+ this.fileList.set([]);
642
+ this.messageError.set(undefined);
643
+ }
644
+ async handlerDownloadSampleFile(event) {
645
+ event.stopPropagation();
646
+ const config = this.configDownloadSampleFile();
647
+ if (!config) {
648
+ return;
649
+ }
650
+ if (config?.callBack) {
651
+ config.callBack();
652
+ return;
653
+ }
654
+ if (config?.url) {
655
+ downloadFileByUrl(config.url, config.title);
656
+ }
657
+ }
658
+ async showUploadPopup() {
659
+ this.uploadInputRef()?.nativeElement.click();
660
+ this.uploadInputRef()?.nativeElement.setAttribute('accept', this.accessFiles());
661
+ }
662
+ // #endregion
663
+ ngOnDestroy() {
664
+ this.onDestroy.next();
665
+ this.onDestroy.complete();
666
+ }
667
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsInputsUploadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
668
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", 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 }, 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 [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 [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 #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 <div class=\"mb-[4px] libs-ui-font-h6m\"\n [innerHTML]=\"(configDescriptionInputUpload().message || '') | translate:configDescriptionInputUpload().interpolateParams\">\n </div>\n @for (item of descriptionFormatAndSizeFileComputed(); track item; let last = $last) {\n <div class=\"libs-ui-font-h7r\"\n [class.mb-[4px]]=\"!last\"\n [innerHTML]=\"item.message | translate:item.interpolateParams\">\n </div>\n }\n </div>\n </div>\n @if (multiple()) {\n <input #uploadInput\n class=\"upload-input hidden\"\n type=\"file\"\n name=\"files[]\"\n multiple\n [accept]=\"accessFiles()\" />\n } @else {\n <input #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 {{ (messageError() || '') | translate:{ value: limitFile() } }}\n </div>\n }\n @if (configDownloadSampleFile()?.position === 'bottom' && configDownloadSampleFile();as configDownloadSampleFile) {\n <libs_ui-components-buttons-button [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 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 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\n <div class=\"flex w-full\">\n <div class=\"flex items-center\">\n @if (canSetAvatar() && item().type === 'image') {\n <libs_ui-components-buttons-button [type]=\"'button-link-third'\"\n [classIconLeft]=\"'!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 [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 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 [disable]=\"disable() || readonly() \"\n [(item)]=\"item\"\n [showVideoDuration]=\"showVideoDuration()\"\n (outOpenPreview)=\"handlerOpenPreviewFile($event)\" />\n }\n <div class=\"relative w-full\">\n <div 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 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 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 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 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 [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 [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 [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\">{{ (item().error || ' ') | translate }}</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"], 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 });
669
+ }
670
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsInputsUploadComponent, decorators: [{
671
+ type: Component,
672
+ args: [{ selector: 'libs_ui-components-inputs-upload', standalone: true, imports: [TranslateModule,
673
+ LibsUiComponentsButtonsButtonComponent,
674
+ LibsUiComponentsLabelComponent,
675
+ LibsUiComponentsInputsUploadAvatarComponent,
676
+ LibsUiComponentsScrollOverlayDirective,
677
+ LibsUiComponentsInputsUploadDirective,
678
+ LibsUiComponentsInputsUploadDropFileDirective
679
+ ], 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 [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 [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 #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 <div class=\"mb-[4px] libs-ui-font-h6m\"\n [innerHTML]=\"(configDescriptionInputUpload().message || '') | translate:configDescriptionInputUpload().interpolateParams\">\n </div>\n @for (item of descriptionFormatAndSizeFileComputed(); track item; let last = $last) {\n <div class=\"libs-ui-font-h7r\"\n [class.mb-[4px]]=\"!last\"\n [innerHTML]=\"item.message | translate:item.interpolateParams\">\n </div>\n }\n </div>\n </div>\n @if (multiple()) {\n <input #uploadInput\n class=\"upload-input hidden\"\n type=\"file\"\n name=\"files[]\"\n multiple\n [accept]=\"accessFiles()\" />\n } @else {\n <input #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 {{ (messageError() || '') | translate:{ value: limitFile() } }}\n </div>\n }\n @if (configDownloadSampleFile()?.position === 'bottom' && configDownloadSampleFile();as configDownloadSampleFile) {\n <libs_ui-components-buttons-button [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 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 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\n <div class=\"flex w-full\">\n <div class=\"flex items-center\">\n @if (canSetAvatar() && item().type === 'image') {\n <libs_ui-components-buttons-button [type]=\"'button-link-third'\"\n [classIconLeft]=\"'!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 [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 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 [disable]=\"disable() || readonly() \"\n [(item)]=\"item\"\n [showVideoDuration]=\"showVideoDuration()\"\n (outOpenPreview)=\"handlerOpenPreviewFile($event)\" />\n }\n <div class=\"relative w-full\">\n <div 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 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 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 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 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 [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 [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 [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\">{{ (item().error || ' ') | translate }}</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"] }]
680
+ }], ctorParameters: () => [] });
681
+
682
+ /**
683
+ * Generated bundle index. Do not edit.
684
+ */
685
+
686
+ export { LibsUiComponentsInputsUploadAvatarComponent, LibsUiComponentsInputsUploadComponent, LibsUiComponentsInputsUploadDirective, LibsUiComponentsInputsUploadDropFileDirective };
687
+ //# sourceMappingURL=libs-ui-components-inputs-upload.mjs.map