@dropi/ui-components 1.0.12 → 1.0.13
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 +55 -36
- package/dist/README.md +58 -38
- package/dist/components-source/accordion/accordion-item/accordion-item.component.d.ts +31 -0
- package/dist/components-source/accordion/accordion.component.d.ts +26 -0
- package/dist/components-source/alert/alert.component.d.ts +32 -0
- package/dist/components-source/alert-modal/alert-modal.component.d.ts +78 -0
- package/dist/components-source/alert-validation/alert-validation.component.d.ts +21 -0
- package/dist/components-source/badge/badge.component.d.ts +12 -0
- package/dist/components-source/beta-tag/beta-tag.component.d.ts +5 -0
- package/dist/components-source/breadcrumb/breadcrumb.component.d.ts +11 -0
- package/dist/components-source/card-product/card-product.component.d.ts +204 -0
- package/dist/components-source/card-section/card-section.component.d.ts +31 -0
- package/dist/components-source/checkbox-selection-list/checkbox-selection-list.component.d.ts +26 -0
- package/dist/components-source/city-selector/city-selector.component.d.ts +17 -0
- package/dist/components-source/color-picker/color-picker.component.d.ts +73 -0
- package/dist/components-source/confirm-dialog/confirm-dialog.component.d.ts +10 -0
- package/dist/components-source/country-flags/country-flags.component.d.ts +12 -0
- package/dist/components-source/date-picker/date-picker.component.d.ts +27 -0
- package/dist/components-source/date-picker-range/date-picker-range.component.d.ts +26 -0
- package/dist/components-source/dropi-avatars/dropi-avatars.component.d.ts +11 -0
- package/dist/components-source/dropi-badge/dropi-badge.component.d.ts +29 -0
- package/dist/components-source/dropi-banner-external/dropi-banner-external.component.d.ts +19 -0
- package/dist/components-source/dropi-breadcrumb/dropi-breadcrumb.component.d.ts +22 -0
- package/dist/components-source/dropi-card-checkbox/dropi-card-checkbox.component.d.ts +20 -0
- package/dist/components-source/dropi-carousel/dropi-carousel.component.d.ts +52 -0
- package/dist/components-source/dropi-checkbox/dropi-checkbox.component.d.ts +11 -0
- package/dist/components-source/dropi-chips/dropi-chips.component.d.ts +17 -0
- package/dist/components-source/dropi-country-selector/countries.data.d.ts +6 -0
- package/dist/components-source/dropi-country-selector/dropi-country-selector.component.d.ts +90 -0
- package/dist/components-source/dropi-drawer/dropi-drawer.component.d.ts +20 -0
- package/dist/components-source/dropi-dropdown/dropi-dropdown.component.d.ts +20 -0
- package/dist/components-source/dropi-favorite-button/dropi-favorite-button.component.d.ts +12 -0
- package/dist/components-source/dropi-file-upload/card-view/card-view.component.d.ts +19 -0
- package/dist/components-source/dropi-file-upload/drop-zone/drop-zone.component.d.ts +38 -0
- package/dist/components-source/dropi-file-upload/dropi-file-upload.component.d.ts +18 -0
- package/dist/components-source/dropi-file-upload/file-list/file-list.component.d.ts +39 -0
- package/dist/components-source/dropi-file-upload/grid-view/grid-view.component.d.ts +15 -0
- package/dist/components-source/dropi-ilustration-icon/dropi-ilustration-icon.component.d.ts +20 -0
- package/dist/components-source/dropi-image-overlay/dropi-image-overlay.component.d.ts +8 -0
- package/dist/components-source/dropi-languages-selector/dropi-languages-selector.component.d.ts +18 -0
- package/dist/components-source/dropi-logo/dropi-logo.component.d.ts +12 -0
- package/dist/components-source/dropi-modal/dropi-modal.component.d.ts +34 -0
- package/dist/components-source/dropi-modal/p-template.directive.d.ts +9 -0
- package/dist/components-source/dropi-navbar/dropi-navbar.component.d.ts +20 -0
- package/dist/components-source/dropi-paginator/dropi-paginator.component.d.ts +21 -0
- package/dist/components-source/dropi-phone-input/dropi-phone-input.component.d.ts +55 -0
- package/dist/components-source/dropi-radio-button/dropi-radio-button.component.d.ts +17 -0
- package/dist/components-source/dropi-search/dropi-search.component.d.ts +40 -0
- package/dist/components-source/dropi-select/dropi-select.component.d.ts +34 -0
- package/dist/components-source/dropi-skeleton/dropi-skeleton.component.d.ts +14 -0
- package/dist/components-source/dropi-steps/dropi-steps.component.d.ts +64 -0
- package/dist/components-source/dropi-switch/dropi-switch.component.d.ts +11 -0
- package/dist/components-source/dropi-table/dropi-table.component.d.ts +82 -0
- package/dist/components-source/dropi-tag/dropi-tag.component.d.ts +15 -0
- package/dist/components-source/dropi-text-area/dropi-text-area.component.d.ts +14 -0
- package/dist/components-source/dropi-tooltip/dropi-tooltip.component.d.ts +28 -0
- package/dist/components-source/dropi-youtube-lazy-video/dropi-youtube-lazy-video.component.d.ts +16 -0
- package/dist/components-source/empty/empty.component.d.ts +9 -0
- package/dist/components-source/empty-state/empty-state.component.d.ts +17 -0
- package/dist/components-source/file-upload-progress-bar/file-upload-progress-bar.component.d.ts +30 -0
- package/dist/components-source/index.d.ts +85 -0
- package/dist/components-source/input/input.component.d.ts +33 -0
- package/dist/components-source/lottie-loader/lottie-loader.component.d.ts +9 -0
- package/dist/components-source/otp-send-code/otp-send-code.component.d.ts +83 -0
- package/dist/components-source/radio-selection-list/radio-selection-list.component.d.ts +30 -0
- package/dist/components-source/read-more/read-more.component.d.ts +60 -0
- package/dist/components-source/sidebar/sidebar.component.d.ts +27 -0
- package/dist/components-source/simple-stepper/simple-stepper.component.d.ts +21 -0
- package/dist/components-source/spinner/spinner.component.d.ts +9 -0
- package/dist/components-source/tabs/tabs.component.d.ts +27 -0
- package/dist/components-source/tag-type-product/tag-type-product.component.d.ts +5 -0
- package/dist/components-source/toast/toast.component.d.ts +21 -0
- package/dist/components-source/toggle/input-toggle.component.d.ts +11 -0
- package/dist/components-source/tooltip/tooltip.component.d.ts +15 -0
- package/dist/components-source/vertical-steps/vertical-steps.component.d.ts +27 -0
- package/dist/esm2022/components-source/accordion/accordion-item/accordion-item.component.mjs +51 -0
- package/dist/esm2022/components-source/accordion/accordion.component.mjs +46 -0
- package/dist/esm2022/components-source/alert/alert.component.mjs +114 -0
- package/dist/esm2022/components-source/alert-modal/alert-modal.component.mjs +247 -0
- package/dist/esm2022/components-source/alert-validation/alert-validation.component.mjs +53 -0
- package/dist/esm2022/components-source/badge/badge.component.mjs +23 -0
- package/dist/esm2022/components-source/beta-tag/beta-tag.component.mjs +11 -0
- package/dist/esm2022/components-source/breadcrumb/breadcrumb.component.mjs +26 -0
- package/dist/esm2022/components-source/card-product/card-product.component.mjs +534 -0
- package/dist/esm2022/components-source/card-section/card-section.component.mjs +91 -0
- package/dist/esm2022/components-source/checkbox-selection-list/checkbox-selection-list.component.mjs +79 -0
- package/dist/esm2022/components-source/city-selector/city-selector.component.mjs +53 -0
- package/dist/esm2022/components-source/color-picker/color-picker.component.mjs +320 -0
- package/dist/esm2022/components-source/confirm-dialog/confirm-dialog.component.mjs +27 -0
- package/dist/esm2022/components-source/country-flags/country-flags.component.mjs +27 -0
- package/dist/esm2022/components-source/date-picker/date-picker.component.mjs +73 -0
- package/dist/esm2022/components-source/date-picker-range/date-picker-range.component.mjs +67 -0
- package/dist/esm2022/components-source/dropi-avatars/dropi-avatars.component.mjs +31 -0
- package/dist/esm2022/components-source/dropi-badge/dropi-badge.component.mjs +45 -0
- package/dist/esm2022/components-source/dropi-banner-external/dropi-banner-external.component.mjs +39 -0
- package/dist/esm2022/components-source/dropi-breadcrumb/dropi-breadcrumb.component.mjs +45 -0
- package/dist/esm2022/components-source/dropi-card-checkbox/dropi-card-checkbox.component.mjs +53 -0
- package/dist/esm2022/components-source/dropi-carousel/dropi-carousel.component.mjs +243 -0
- package/dist/esm2022/components-source/dropi-checkbox/dropi-checkbox.component.mjs +31 -0
- package/dist/esm2022/components-source/dropi-chips/dropi-chips.component.mjs +38 -0
- package/dist/esm2022/components-source/dropi-country-selector/countries.data.mjs +254 -0
- package/dist/esm2022/components-source/dropi-country-selector/dropi-country-selector.component.mjs +183 -0
- package/dist/esm2022/components-source/dropi-drawer/dropi-drawer.component.mjs +69 -0
- package/dist/esm2022/components-source/dropi-dropdown/dropi-dropdown.component.mjs +59 -0
- package/dist/esm2022/components-source/dropi-favorite-button/dropi-favorite-button.component.mjs +33 -0
- package/dist/esm2022/components-source/dropi-file-upload/card-view/card-view.component.mjs +47 -0
- package/dist/esm2022/components-source/dropi-file-upload/drop-zone/drop-zone.component.mjs +115 -0
- package/dist/esm2022/components-source/dropi-file-upload/dropi-file-upload.component.mjs +66 -0
- package/dist/esm2022/components-source/dropi-file-upload/file-list/file-list.component.mjs +95 -0
- package/dist/esm2022/components-source/dropi-file-upload/grid-view/grid-view.component.mjs +37 -0
- package/dist/esm2022/components-source/dropi-ilustration-icon/dropi-ilustration-icon.component.mjs +59 -0
- package/dist/esm2022/components-source/dropi-image-overlay/dropi-image-overlay.component.mjs +31 -0
- package/dist/esm2022/components-source/dropi-languages-selector/dropi-languages-selector.component.mjs +38 -0
- package/dist/esm2022/components-source/dropi-logo/dropi-logo.component.mjs +27 -0
- package/dist/esm2022/components-source/dropi-modal/dropi-modal.component.mjs +92 -0
- package/dist/esm2022/components-source/dropi-modal/p-template.directive.mjs +22 -0
- package/dist/esm2022/components-source/dropi-navbar/dropi-navbar.component.mjs +51 -0
- package/dist/esm2022/components-source/dropi-paginator/dropi-paginator.component.mjs +89 -0
- package/dist/esm2022/components-source/dropi-phone-input/dropi-phone-input.component.mjs +155 -0
- package/dist/esm2022/components-source/dropi-radio-button/dropi-radio-button.component.mjs +48 -0
- package/dist/esm2022/components-source/dropi-search/dropi-search.component.mjs +104 -0
- package/dist/esm2022/components-source/dropi-select/dropi-select.component.mjs +96 -0
- package/dist/esm2022/components-source/dropi-skeleton/dropi-skeleton.component.mjs +39 -0
- package/dist/esm2022/components-source/dropi-steps/dropi-steps.component.mjs +97 -0
- package/dist/esm2022/components-source/dropi-switch/dropi-switch.component.mjs +22 -0
- package/dist/esm2022/components-source/dropi-table/dropi-table.component.mjs +333 -0
- package/dist/esm2022/components-source/dropi-tag/dropi-tag.component.mjs +36 -0
- package/dist/esm2022/components-source/dropi-text-area/dropi-text-area.component.mjs +53 -0
- package/dist/esm2022/components-source/dropi-tooltip/dropi-tooltip.component.mjs +78 -0
- package/dist/esm2022/components-source/dropi-youtube-lazy-video/dropi-youtube-lazy-video.component.mjs +46 -0
- package/dist/esm2022/components-source/empty/empty.component.mjs +18 -0
- package/dist/esm2022/components-source/empty-state/empty-state.component.mjs +62 -0
- package/dist/esm2022/components-source/file-upload-progress-bar/file-upload-progress-bar.component.mjs +91 -0
- package/dist/esm2022/components-source/index.mjs +107 -0
- package/dist/esm2022/components-source/input/input.component.mjs +104 -0
- package/dist/esm2022/components-source/lottie-loader/lottie-loader.component.mjs +25 -0
- package/dist/esm2022/components-source/otp-send-code/otp-send-code.component.mjs +201 -0
- package/dist/esm2022/components-source/radio-selection-list/radio-selection-list.component.mjs +89 -0
- package/dist/esm2022/components-source/read-more/read-more.component.mjs +91 -0
- package/dist/esm2022/components-source/sidebar/sidebar.component.mjs +88 -0
- package/dist/esm2022/components-source/simple-stepper/simple-stepper.component.mjs +60 -0
- package/dist/esm2022/components-source/spinner/spinner.component.mjs +19 -0
- package/dist/esm2022/components-source/tabs/tabs.component.mjs +83 -0
- package/dist/esm2022/components-source/tag-type-product/tag-type-product.component.mjs +11 -0
- package/dist/esm2022/components-source/toast/toast.component.mjs +47 -0
- package/dist/esm2022/components-source/toggle/input-toggle.component.mjs +36 -0
- package/dist/esm2022/components-source/tooltip/tooltip.component.mjs +34 -0
- package/dist/esm2022/components-source/vertical-steps/vertical-steps.component.mjs +75 -0
- package/dist/esm2022/lib/elements-registry.mjs +343 -2
- package/dist/esm2022/utilities/interfaces/ui/dropi-table.interface.mjs +2 -0
- package/dist/esm2022/utilities/interfaces/ui/input-interface.mjs +2 -0
- package/dist/esm2022/utilities/interfaces/ui/select-interface.mjs +2 -0
- package/dist/esm2022/utilities/interfaces/ui/selection-list-interface.mjs +2 -0
- package/dist/esm2022/utilities/interfaces/ui/upload.model.mjs +5 -0
- package/dist/fesm2022/dropi-ui-components.mjs +5913 -2
- package/dist/fesm2022/dropi-ui-components.mjs.map +1 -1
- package/dist/utilities/interfaces/ui/dropi-table.interface.d.ts +45 -0
- package/dist/utilities/interfaces/ui/input-interface.d.ts +33 -0
- package/dist/utilities/interfaces/ui/select-interface.d.ts +8 -0
- package/dist/utilities/interfaces/ui/selection-list-interface.d.ts +24 -0
- package/dist/utilities/interfaces/ui/upload.model.d.ts +30 -0
- package/package.json +18 -6
- package/src/components-source/alert/alert.component.ts +12 -129
- package/src/components-source/alert-modal/alert-modal.component.ts +84 -114
- package/src/components-source/alert-validation/alert-validation.component.html +8 -0
- package/src/components-source/alert-validation/alert-validation.component.scss +225 -0
- package/src/components-source/alert-validation/alert-validation.component.ts +43 -0
- package/src/components-source/beta-tag/beta-tag.component.html +1 -0
- package/src/components-source/beta-tag/beta-tag.component.scss +26 -0
- package/src/components-source/beta-tag/beta-tag.component.ts +11 -0
- package/src/components-source/breadcrumb/breadcrumb.component.html +13 -5
- package/src/components-source/breadcrumb/breadcrumb.component.scss +8 -1
- package/src/components-source/breadcrumb/breadcrumb.component.spec.ts +26 -26
- package/src/components-source/breadcrumb/breadcrumb.component.ts +10 -12
- package/src/components-source/card-product/card-product.component.spec.ts +9 -9
- package/src/components-source/card-product/card-product.component.stories.ts +2 -2
- package/src/components-source/card-product/card-product.component.ts +294 -818
- package/src/components-source/card-section/card-section.component.html +7 -7
- package/src/components-source/card-section/card-section.component.ts +41 -15
- package/src/components-source/checkbox-selection-list/checkbox-selection-list.component.ts +42 -179
- package/src/components-source/city-selector/city-selector.component.ts +37 -137
- package/src/components-source/confirm-dialog/confirm-dialog.component.html +26 -0
- package/src/components-source/confirm-dialog/confirm-dialog.component.scss +55 -0
- package/src/components-source/confirm-dialog/confirm-dialog.component.ts +22 -0
- package/src/components-source/country-flags/country-flags.component.ts +20 -12
- package/src/components-source/date-picker/date-picker.component.ts +32 -292
- package/src/components-source/date-picker-range/date-picker-range.component.html +15 -7
- package/src/components-source/date-picker-range/date-picker-range.component.ts +42 -235
- package/src/components-source/dropi-banner-external/dropi-banner-external.component.ts +24 -185
- package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.component.html +21 -21
- package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.component.spec.ts +9 -9
- package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.component.ts +41 -23
- package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.stories.ts +12 -12
- package/src/components-source/dropi-chips/dropi-chips.component.ts +22 -87
- package/src/components-source/dropi-country-selector/countries.data.ts +256 -236
- package/src/components-source/dropi-country-selector/dropi-country-selector.component.ts +37 -25
- package/src/components-source/dropi-drawer/dropi-drawer.component.ts +91 -78
- package/src/components-source/dropi-dropdown/dropi-dropdown.component.ts +44 -47
- package/src/components-source/dropi-file-upload/card-view/card-view.component.ts +33 -53
- package/src/components-source/dropi-file-upload/drop-zone/drop-zone.component.ts +52 -123
- package/src/components-source/dropi-file-upload/dropi-file-upload.component.ts +38 -294
- package/src/components-source/dropi-file-upload/file-list/file-list.component.ts +62 -43
- package/src/components-source/dropi-file-upload/grid-view/grid-view.component.ts +23 -22
- package/src/components-source/dropi-ilustration-icon/dropi-ilustration-icon.component.scss +6 -2
- package/src/components-source/dropi-image-overlay/dropi-image-overlay.component.ts +16 -71
- package/src/components-source/dropi-modal/dropi-modal.component.ts +56 -372
- package/src/components-source/dropi-navbar/dropi-navbar.component.ts +17 -17
- package/src/components-source/dropi-paginator/dropi-paginator.component.html +18 -7
- package/src/components-source/dropi-paginator/dropi-paginator.component.ts +40 -32
- package/src/components-source/dropi-phone-input/dropi-phone-input.component.html +78 -79
- package/src/components-source/dropi-phone-input/dropi-phone-input.component.ts +29 -85
- package/src/components-source/dropi-search/dropi-search.component.ts +59 -222
- package/src/components-source/dropi-select/dropi-select.component.html +82 -131
- package/src/components-source/dropi-select/dropi-select.component.ts +60 -423
- package/src/components-source/dropi-table/dropi-table.component.html +40 -23
- package/src/components-source/dropi-table/dropi-table.component.ts +130 -374
- package/src/components-source/dropi-tag/dropi-tag.component.ts +20 -90
- package/src/components-source/dropi-text-area/dropi-text-area.component.ts +22 -48
- package/src/components-source/dropi-tooltip/dropi-tooltip.component.ts +40 -129
- package/src/components-source/empty/empty.component.html +3 -0
- package/src/components-source/empty/empty.component.scss +0 -0
- package/src/components-source/empty/empty.component.ts +16 -0
- package/src/components-source/empty-state/empty-state.component.ts +47 -19
- package/src/components-source/index.ts +82 -37
- package/src/components-source/input/input.component.html +79 -63
- package/src/components-source/input/input.component.ts +51 -97
- package/src/components-source/lottie-loader/lottie-loader.component.ts +13 -16
- package/src/components-source/otp-send-code/otp-send-code.component.ts +60 -528
- package/src/components-source/radio-selection-list/radio-selection-list.component.ts +36 -97
- package/src/components-source/sidebar/sidebar.component.spec.ts +11 -11
- package/src/components-source/sidebar/sidebar.component.stories.ts +3 -3
- package/src/components-source/sidebar/sidebar.component.ts +51 -47
- package/src/components-source/simple-stepper/simple-stepper.component.ts +20 -35
- package/src/components-source/spinner/spinner.component.html +6 -0
- package/src/components-source/spinner/spinner.component.scss +15 -0
- package/src/components-source/spinner/spinner.component.ts +17 -0
- package/src/components-source/tabs/tabs.component.spec.ts +8 -8
- package/src/components-source/tabs/tabs.component.stories.ts +5 -5
- package/src/components-source/tabs/tabs.component.ts +41 -83
- package/src/components-source/toast/toast.component.ts +40 -46
- package/src/components-source/toggle/input-toggle.component.html +34 -0
- package/src/components-source/toggle/input-toggle.component.scss +0 -0
- package/src/components-source/toggle/input-toggle.component.ts +27 -0
- package/src/components-source/toggle/inputToggleConfig.ts +11 -0
- package/src/components-source/tooltip/tooltip.component.html +22 -11
- package/src/components-source/tooltip/tooltip.component.ts +28 -13
- package/src/components-source/vertical-steps/vertical-steps.component.ts +16 -78
- package/src/lib/elements-registry.ts +413 -1
- package/src/lib/router-stub.ts +7 -0
- package/src/libreria work space.code-workspace +11 -8
- package/src/utilities/interfaces/ui/dropi-table.interface.ts +60 -0
- package/src/utilities/interfaces/ui/input-interface.ts +34 -0
- package/src/utilities/interfaces/ui/select-interface.ts +8 -0
- package/src/utilities/interfaces/ui/selection-list-interface.ts +15 -0
- package/src/utilities/interfaces/ui/upload.model.ts +41 -0
|
@@ -1,96 +1,61 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Component,
|
|
3
|
-
ElementRef,
|
|
4
3
|
EventEmitter,
|
|
5
4
|
Input,
|
|
6
|
-
OnChanges,
|
|
7
|
-
OnDestroy,
|
|
8
|
-
OnInit,
|
|
9
5
|
Output,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import {
|
|
15
|
-
import { ButtonComponent } from
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { CompressImagesService } from '@app/services/configuration-white-labels/compress-images.service';
|
|
19
|
-
import { Subscription } from 'rxjs';
|
|
20
|
-
import { IconComponent } from '@app/ui/icon/icon.component';
|
|
6
|
+
Inject,
|
|
7
|
+
OnInit,
|
|
8
|
+
CUSTOM_ELEMENTS_SCHEMA,
|
|
9
|
+
} from "@angular/core";
|
|
10
|
+
import { CommonModule } from "@angular/common";
|
|
11
|
+
import { ButtonComponent } from "../../dropi-button/dropi-button.component";
|
|
12
|
+
import { IconComponent } from "../../icon/icon.component";
|
|
13
|
+
import { TranslateModule } from "@ngx-translate/core";
|
|
21
14
|
|
|
22
|
-
type UploadFileState = 'uploading' | 'complete' | 'confirm-delete';
|
|
23
|
-
interface FileItem {
|
|
24
|
-
file: File;
|
|
25
|
-
progress: number; // 0–100
|
|
26
|
-
state: UploadFileState;
|
|
27
|
-
previewUrl?: string;
|
|
28
|
-
}
|
|
29
15
|
@Component({
|
|
30
|
-
selector:
|
|
16
|
+
selector: "app-drop-zone",
|
|
31
17
|
standalone: true,
|
|
32
|
-
imports: [CommonModule,
|
|
33
|
-
|
|
34
|
-
|
|
18
|
+
imports: [CommonModule, ButtonComponent, IconComponent, TranslateModule],
|
|
19
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
20
|
+
templateUrl: "./drop-zone.component.html",
|
|
21
|
+
styleUrls: ["./drop-zone.component.scss"],
|
|
35
22
|
})
|
|
36
|
-
export class DropZoneComponent implements OnInit
|
|
23
|
+
export class DropZoneComponent implements OnInit {
|
|
37
24
|
@Input() multiple = false;
|
|
38
|
-
@Input() maxFiles = 5;
|
|
39
|
-
@Input() maxFileSizeMB = 5;
|
|
40
25
|
@Input() accept: string[] = [];
|
|
26
|
+
@Input() maxFiles = 10;
|
|
27
|
+
@Input() maxFileSizeMB = 10;
|
|
28
|
+
@Input() title = "";
|
|
29
|
+
@Input() label = "";
|
|
30
|
+
@Input() viewDragAndDrop = false;
|
|
41
31
|
@Input() compress: boolean = false;
|
|
42
|
-
@Input() maxHeight: number =
|
|
43
|
-
@Input() maxWidth: number =
|
|
44
|
-
@Input()
|
|
45
|
-
@Input()
|
|
46
|
-
@Input() textFileUpload: string = 'Drop or upload an image here';
|
|
47
|
-
//estados que se muestra el boton cuando no lleva el dropzone
|
|
48
|
-
@Input() uploadStatus: 'success' | 'error' | 'loading' | 'idle' = 'idle';
|
|
49
|
-
@Input() disabled: boolean = false;
|
|
50
|
-
@Input() size: 'small' | 'default' = 'default';
|
|
32
|
+
@Input() maxHeight: number = 1000;
|
|
33
|
+
@Input() maxWidth: number = 1000;
|
|
34
|
+
@Input() textButton: string = "Seleccionar Imagen";
|
|
35
|
+
@Input() textFileUpload: string = "Drop or upload an image here";
|
|
51
36
|
|
|
52
37
|
@Output() addFiles = new EventEmitter<File[]>();
|
|
53
|
-
@Output() fileCleared = new EventEmitter<string>();
|
|
54
38
|
|
|
55
39
|
dragOver = false;
|
|
56
|
-
selectedFiles: FileItem[] = [];
|
|
57
|
-
validFiles;
|
|
58
|
-
fileCharged = '';
|
|
59
40
|
|
|
60
|
-
|
|
41
|
+
// Propiedades requeridas por el template original
|
|
42
|
+
isNotStore: boolean = true;
|
|
43
|
+
size: "default" | "small" = "default";
|
|
44
|
+
uploadStatus: "idle" | "loading" | "error" | "success" = "idle";
|
|
45
|
+
disabled: boolean = false;
|
|
46
|
+
stateButton: string = "default";
|
|
47
|
+
fileCharged: string = "";
|
|
61
48
|
|
|
62
|
-
get
|
|
63
|
-
return this.
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
set isChargeFile(value: boolean) {
|
|
67
|
-
this._isChargeFile = value;
|
|
68
|
-
this.getStatebutton();
|
|
49
|
+
get acceptedMimeTypes(): string[] {
|
|
50
|
+
return this.accept || ["image/*"];
|
|
69
51
|
}
|
|
70
52
|
|
|
71
|
-
@ViewChild('fileInput') fileInput!: ElementRef<HTMLInputElement>;
|
|
72
|
-
private readonly subscriptions = new Subscription();
|
|
73
|
-
stateButton: string = '';
|
|
74
|
-
|
|
75
|
-
//tipos de archivos
|
|
76
|
-
|
|
77
53
|
constructor(
|
|
78
|
-
private sharedUpload:
|
|
79
|
-
private
|
|
54
|
+
@Inject("UploadFileService") private sharedUpload: any,
|
|
55
|
+
@Inject("CompressImagesService") private compressService: any,
|
|
80
56
|
) {}
|
|
81
57
|
|
|
82
|
-
ngOnInit() {
|
|
83
|
-
this.subscriptions.add(
|
|
84
|
-
this.sharedUpload.triggerInput$.subscribe(() => {
|
|
85
|
-
this.fileInput.nativeElement.value = '';
|
|
86
|
-
this.fileInput.nativeElement.click();
|
|
87
|
-
}),
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
getStatebutton() {
|
|
92
|
-
this.stateButton = this.isChargeFile ? 'loading' : '';
|
|
93
|
-
}
|
|
58
|
+
ngOnInit(): void {}
|
|
94
59
|
|
|
95
60
|
onDragOver(event: DragEvent): void {
|
|
96
61
|
event.preventDefault();
|
|
@@ -98,75 +63,39 @@ export class DropZoneComponent implements OnInit, OnDestroy {
|
|
|
98
63
|
}
|
|
99
64
|
|
|
100
65
|
onDragLeave(event: DragEvent): void {
|
|
66
|
+
event.preventDefault();
|
|
101
67
|
this.dragOver = false;
|
|
102
68
|
}
|
|
103
69
|
|
|
104
70
|
onDrop(event: DragEvent): void {
|
|
105
71
|
event.preventDefault();
|
|
106
72
|
this.dragOver = false;
|
|
107
|
-
const files
|
|
108
|
-
|
|
109
|
-
|
|
73
|
+
const files = event.dataTransfer?.files;
|
|
74
|
+
if (files) {
|
|
75
|
+
this.handleFiles(Array.from(files));
|
|
76
|
+
}
|
|
110
77
|
}
|
|
111
78
|
|
|
112
|
-
|
|
113
|
-
this.isChargeFile = true;
|
|
79
|
+
onFileSelected(event: Event): void {
|
|
114
80
|
const input = event.target as HTMLInputElement;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
this.compressAndEmitFiles(files);
|
|
81
|
+
if (input.files) {
|
|
82
|
+
this.handleFiles(Array.from(input.files));
|
|
83
|
+
}
|
|
119
84
|
}
|
|
120
85
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
files.forEach((file) => {
|
|
126
|
-
if (file.type.startsWith('image/')) {
|
|
127
|
-
images.push(file);
|
|
128
|
-
this.isChargeFile = false;
|
|
129
|
-
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
otherFiles.push(file);
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
if (this.compress) {
|
|
136
|
-
this.compressImagesService
|
|
137
|
-
.compressFiles(images, this.maxWidth, this.maxHeight)
|
|
138
|
-
.subscribe((compressed) => {
|
|
139
|
-
this.sendFiles([...compressed, ...otherFiles]);
|
|
140
|
-
});
|
|
141
|
-
this.isChargeFile = false;
|
|
142
|
-
|
|
143
|
-
return;
|
|
86
|
+
onFileChange(event: any): void {
|
|
87
|
+
const files = event.target.files;
|
|
88
|
+
if (files) {
|
|
89
|
+
this.handleFiles(Array.from(files));
|
|
144
90
|
}
|
|
145
|
-
|
|
146
|
-
this.sendFiles(files);
|
|
147
91
|
}
|
|
148
92
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
.map((type) => FILE_TYPE_MAP[type.toUpperCase()] || [])
|
|
153
|
-
.reduce((acc, val) => acc.concat(val), []);
|
|
93
|
+
clearFile(): void {
|
|
94
|
+
this.fileCharged = "";
|
|
95
|
+
this.uploadStatus = "idle";
|
|
154
96
|
}
|
|
155
97
|
|
|
156
|
-
|
|
98
|
+
private handleFiles(files: File[]): void {
|
|
157
99
|
this.addFiles.emit(files);
|
|
158
|
-
this.isChargeFile = false;
|
|
159
|
-
this.fileCharged = files[0].name;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
clearFile() {
|
|
163
|
-
this.fileCharged = '';
|
|
164
|
-
this.selectedFiles = [];
|
|
165
|
-
this.uploadStatus = 'idle';
|
|
166
|
-
this.fileCleared.emit(this.uploadStatus);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
ngOnDestroy() {
|
|
170
|
-
this.subscriptions.unsubscribe();
|
|
171
100
|
}
|
|
172
101
|
}
|
|
@@ -1,46 +1,42 @@
|
|
|
1
|
-
import { Component, EventEmitter, Input, NgZone, Output } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { TranslateModule } from '@ngx-translate/core';
|
|
4
|
-
import { DropZoneComponent } from './drop-zone/drop-zone.component';
|
|
5
1
|
import {
|
|
6
|
-
|
|
2
|
+
Component,
|
|
3
|
+
EventEmitter,
|
|
4
|
+
Input,
|
|
5
|
+
NgZone,
|
|
6
|
+
Output,
|
|
7
|
+
Inject,
|
|
8
|
+
CUSTOM_ELEMENTS_SCHEMA,
|
|
9
|
+
} from "@angular/core";
|
|
10
|
+
import { CommonModule } from "@angular/common";
|
|
11
|
+
import { TranslateModule } from "@ngx-translate/core";
|
|
12
|
+
import { DropZoneComponent } from "./drop-zone/drop-zone.component";
|
|
13
|
+
import {
|
|
7
14
|
FileItem,
|
|
8
15
|
UploadFileState,
|
|
9
16
|
UploadParams,
|
|
10
|
-
} from
|
|
11
|
-
import { FileListComponent } from
|
|
12
|
-
import {
|
|
13
|
-
import { AlertComponent } from '../alert/alert.component';
|
|
17
|
+
} from "../../utilities/interfaces/ui/upload.model";
|
|
18
|
+
import { FileListComponent } from "./file-list/file-list.component";
|
|
19
|
+
import { AlertComponent } from "../alert/alert.component";
|
|
14
20
|
|
|
15
21
|
@Component({
|
|
16
|
-
selector:
|
|
22
|
+
selector: "app-dropi-file-upload",
|
|
17
23
|
standalone: true,
|
|
18
|
-
imports: [
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
imports: [
|
|
25
|
+
CommonModule,
|
|
26
|
+
TranslateModule,
|
|
27
|
+
DropZoneComponent,
|
|
28
|
+
FileListComponent,
|
|
29
|
+
AlertComponent,
|
|
30
|
+
],
|
|
31
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
32
|
+
templateUrl: "./dropi-file-upload.component.html",
|
|
33
|
+
styleUrls: ["./dropi-file-upload.component.scss"],
|
|
21
34
|
})
|
|
22
35
|
export class DropiFileUploadComponent {
|
|
23
|
-
/**
|
|
24
|
-
* Parámetros de configuración del uploader.
|
|
25
|
-
*
|
|
26
|
-
* Cada campo define:
|
|
27
|
-
* - `title`: Título que se muestra arriba.
|
|
28
|
-
* - `label`: Subtituulo para informacion adiicional.
|
|
29
|
-
* - `previewType`: ‘card’ o ‘grid’ para vista previa de las imágenes.
|
|
30
|
-
* - `multiple`: Permitir varios archivos.
|
|
31
|
-
* - `maxFiles`: Límite de archivos.
|
|
32
|
-
* - `maxFileSizeMB`: Tamaño máximo por archivo (MB).
|
|
33
|
-
* - `accept`: string[]. Extensiones permitidas separadas por comas, el listado está en `FILE_TYPE_MAP`.
|
|
34
|
-
* - `compress`: Comprimir imágenes.
|
|
35
|
-
* - `maxWidth`/`maxHeight`: Dimensiones máximas si se comprimen.
|
|
36
|
-
* - `path`: Ruta donde el backend guarda las imágenes.
|
|
37
|
-
*
|
|
38
|
-
* @type {UploadParams}
|
|
39
|
-
*/
|
|
40
36
|
@Input() params: UploadParams = {
|
|
41
|
-
title:
|
|
42
|
-
label:
|
|
43
|
-
previewType:
|
|
37
|
+
title: "",
|
|
38
|
+
label: "",
|
|
39
|
+
previewType: "card",
|
|
44
40
|
multiple: false,
|
|
45
41
|
maxFiles: 1,
|
|
46
42
|
maxFileSizeMB: 10,
|
|
@@ -48,282 +44,30 @@ export class DropiFileUploadComponent {
|
|
|
48
44
|
compress: false,
|
|
49
45
|
maxHeight: 1000,
|
|
50
46
|
maxWidth: 1000,
|
|
51
|
-
path:
|
|
47
|
+
path: "",
|
|
52
48
|
onlyView: false,
|
|
53
|
-
viewDragAndDrop: false
|
|
49
|
+
viewDragAndDrop: false,
|
|
50
|
+
textButton: "Seleccionar Imagen",
|
|
51
|
+
textDropZone: "Drop or upload an image here",
|
|
54
52
|
};
|
|
55
|
-
/**
|
|
56
|
-
* Emite las URLs de los archivos subidos exitosamente.
|
|
57
|
-
*
|
|
58
|
-
* Se dispara cada vez que termina la subida de un archivo.
|
|
59
|
-
*
|
|
60
|
-
* @type {EventEmitter<string[]>}
|
|
61
|
-
*/
|
|
62
53
|
@Output() uploadedUrlsChange = new EventEmitter<string[]>();
|
|
63
54
|
|
|
64
55
|
dragOver = false;
|
|
65
56
|
selectedFiles: FileItem[] = [];
|
|
66
57
|
error: boolean = false;
|
|
67
|
-
errorMessage: string =
|
|
68
|
-
|
|
69
|
-
constructor(
|
|
70
|
-
private readonly uploadFileService: UploadFileService,
|
|
71
|
-
private readonly zone: NgZone,
|
|
72
|
-
) {}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Establece imágenes precargadas en el componente a partir de una lista de rutas y una URL base.
|
|
76
|
-
*
|
|
77
|
-
* @param paths - Arreglo de rutas relativas de las imágenes a precargar.
|
|
78
|
-
* @param baseUrl - URL base que se utilizará para construir la URL de previsualización de cada imagen.
|
|
79
|
-
*
|
|
80
|
-
* Este método crea una lista de objetos `FileItem` representando las imágenes precargadas,
|
|
81
|
-
* actualiza la propiedad `selectedFiles` con estos elementos y emite el evento `uploadedUrlsChange`
|
|
82
|
-
* con las rutas proporcionadas.
|
|
83
|
-
* Usar con ViewChild
|
|
84
|
-
*/
|
|
85
|
-
setPrechargedImages(paths: string[], baseUrl: string) {
|
|
86
|
-
let precharged: FileItem[] = paths.map((path, index) => {
|
|
87
|
-
return {
|
|
88
|
-
id: index,
|
|
89
|
-
file: null,
|
|
90
|
-
progress: 100,
|
|
91
|
-
state: 'complete',
|
|
92
|
-
previewUrl: `${baseUrl}/${path}`,
|
|
93
|
-
typeView: this.params.previewType,
|
|
94
|
-
uploadedUrl: path,
|
|
95
|
-
fileType: path.includes('.pdf') ? 'document' : 'image',
|
|
96
|
-
isTemp: false,
|
|
97
|
-
};
|
|
98
|
-
});
|
|
99
|
-
this.selectedFiles = [...precharged];
|
|
100
|
-
|
|
101
|
-
this.uploadedUrlsChange.emit(paths);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
confirmDelete(file: FileItem): void {
|
|
105
|
-
file.state = 'confirm-delete';
|
|
106
|
-
}
|
|
58
|
+
errorMessage: string = "";
|
|
107
59
|
|
|
108
|
-
|
|
109
|
-
file.state = 'complete';
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
deleteFile(file: FileItem): void {
|
|
113
|
-
this.selectedFiles = this.selectedFiles.filter((f) => f !== file);
|
|
114
|
-
}
|
|
60
|
+
constructor(@Inject(NgZone) private readonly zone: NgZone) {}
|
|
115
61
|
|
|
116
62
|
onFilesAdded($event: any) {
|
|
117
63
|
this.handleFiles($event);
|
|
118
64
|
}
|
|
119
65
|
|
|
120
66
|
handleFiles(files: File[]): void {
|
|
121
|
-
|
|
122
|
-
if (files.length + this.selectedFiles.length > this.params.maxFiles) {
|
|
123
|
-
this.showError('exceded max Files');
|
|
124
|
-
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
const acceptedFiles = this.validateAndFilterFiles(files);
|
|
129
|
-
if (acceptedFiles.length === 0) {
|
|
130
|
-
if (!this.error) {
|
|
131
|
-
this.showError('conditions exceeded');
|
|
132
|
-
}
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
let imageFiles = [];
|
|
137
|
-
let otherFiles = [];
|
|
138
|
-
|
|
139
|
-
acceptedFiles.forEach((file) => {
|
|
140
|
-
if (file.type.startsWith('image/')) {
|
|
141
|
-
imageFiles.push(file);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
if (!file.type.startsWith('image/')) {
|
|
145
|
-
otherFiles.push(file);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
this.prepareFileItem(file);
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
private async prepareFileItem(file: File): Promise<void> {
|
|
153
|
-
const isImage = file.type.startsWith('image/');
|
|
154
|
-
const isSvg = file.type == 'image/svg+xml';
|
|
155
|
-
const fileItem: FileItem = {
|
|
156
|
-
file,
|
|
157
|
-
id: this.generateId(file),
|
|
158
|
-
progress: 0,
|
|
159
|
-
state: 'uploading', // SIEMPRE empezamos en uploading
|
|
160
|
-
typeView: this.getFileViewType(file),
|
|
161
|
-
fileType: this.getFileType(file),
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
this.selectedFiles = [...this.selectedFiles, fileItem];
|
|
165
|
-
|
|
166
|
-
this.uploadFile(fileItem); // Iniciamos la carga inmediatamente
|
|
167
|
-
|
|
168
|
-
if (isImage && !isSvg) {
|
|
169
|
-
fileItem.previewUrl = await this.generatePreviewUrl(file);
|
|
170
|
-
this.syncFileItemState(fileItem.id, { previewUrl: fileItem.previewUrl });
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
private validateAndFilterFiles(files: File[]): File[] {
|
|
175
|
-
const acceptedTypes = this.acceptedMimeTypes;
|
|
176
|
-
const allowAllTypes = acceptedTypes.includes('*');
|
|
177
|
-
const validFiles: File[] = [];
|
|
178
|
-
|
|
179
|
-
for (const file of files) {
|
|
180
|
-
const isTypeAccepted =
|
|
181
|
-
allowAllTypes ||
|
|
182
|
-
acceptedTypes.includes(file.type) ||
|
|
183
|
-
acceptedTypes.includes(`${file.type.split('/')[0]}/*`);
|
|
184
|
-
|
|
185
|
-
const isSizeOk = file.size <= this.params.maxFileSizeMB * 1024 * 1024;
|
|
186
|
-
|
|
187
|
-
if (!isTypeAccepted) {
|
|
188
|
-
this.showError(`conditions exceeded`);
|
|
189
|
-
continue;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
if (!isSizeOk) {
|
|
193
|
-
this.showError(`File size exceeded`);
|
|
194
|
-
continue;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
validFiles.push(file);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
return validFiles;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
private uploadFile(fileItem: FileItem): void {
|
|
204
|
-
this.uploadFileService
|
|
205
|
-
.uploadFileWithProgress(fileItem.file, this.params.path, fileItem.fileType)
|
|
206
|
-
.subscribe({
|
|
207
|
-
next: (result) => {
|
|
208
|
-
this.zone.run(() => {
|
|
209
|
-
this.handleUploadEvent(result, fileItem);
|
|
210
|
-
});
|
|
211
|
-
},
|
|
212
|
-
error: (err) => {
|
|
213
|
-
this.zone.run(() => {
|
|
214
|
-
this.deleteFile(fileItem);
|
|
215
|
-
this.errorMessage = 'upload file error';
|
|
216
|
-
this.error = true;
|
|
217
|
-
});
|
|
218
|
-
},
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
private handleUploadEvent(result: any, fileItem: FileItem): void {
|
|
223
|
-
if (typeof result === 'number') {
|
|
224
|
-
this.syncFileItemState(fileItem.id, { progress: result });
|
|
225
|
-
} else {
|
|
226
|
-
this.syncFileItemState(fileItem.id, {
|
|
227
|
-
progress: 100,
|
|
228
|
-
state: 'complete',
|
|
229
|
-
uploadedUrl: result.response,
|
|
230
|
-
});
|
|
231
|
-
this.emitUploadedUrls();
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
getFileViewType(file: File): string {
|
|
236
|
-
return file.type.startsWith('image/') && this.params.previewType === 'grid' ? 'grid' : 'card';
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
getFileType(file: File): string {
|
|
240
|
-
const type = file.type;
|
|
241
|
-
if (type.startsWith('image/')) return 'image';
|
|
242
|
-
return 'document';
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
get acceptedMimeTypes(): string[] {
|
|
246
|
-
if (!this.params.accept.length) return ['*'];
|
|
247
|
-
return this.params.accept
|
|
248
|
-
.map((type) => FILE_TYPE_MAP[type.toUpperCase()] || [])
|
|
249
|
-
.reduce((acc, val) => acc.concat(val), []);
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
// eventos desde los items
|
|
253
|
-
|
|
254
|
-
onFileAction(event: { file: FileItem; type: 'delete' | 'confirm-delete' | 'cancel-delete' }) {
|
|
255
|
-
const { file, type } = event;
|
|
256
|
-
switch (type) {
|
|
257
|
-
case 'delete':
|
|
258
|
-
this.setFileState(file, 'confirm-delete');
|
|
259
|
-
|
|
260
|
-
break;
|
|
261
|
-
case 'confirm-delete':
|
|
262
|
-
this.removeFile(file);
|
|
263
|
-
|
|
264
|
-
break;
|
|
265
|
-
case 'cancel-delete':
|
|
266
|
-
this.setFileState(file, 'complete');
|
|
267
|
-
break;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
setFileState(file: FileItem, newState: UploadFileState) {
|
|
272
|
-
file.state = newState;
|
|
273
|
-
this.syncFileItemState(file.id, { state: newState });
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
removeFile(file: FileItem) {
|
|
277
|
-
this.uploadFileService.deletePublishedFile(file.uploadedUrl).subscribe((res) => {
|
|
278
|
-
if (res) {
|
|
279
|
-
this.selectedFiles = this.selectedFiles.filter((f) => f !== file);
|
|
280
|
-
|
|
281
|
-
this.emitUploadedUrls();
|
|
282
|
-
}
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
generateId(file: File): string {
|
|
286
|
-
if (typeof crypto !== 'undefined' && 'randomUUID' in crypto) {
|
|
287
|
-
return `${file.name}-${crypto.randomUUID()}`;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
return `${file.name}-${Date.now()}-${Math.floor(Math.random() * 1_000_000)}`;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
emitUploadedUrls() {
|
|
294
|
-
const urls = this.selectedFiles
|
|
295
|
-
.filter((f) => f.state === 'complete' && f.uploadedUrl)
|
|
296
|
-
.map((f) => f.uploadedUrl as string);
|
|
297
|
-
this.uploadedUrlsChange.emit(urls);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
showError(message: string) {
|
|
301
|
-
this.zone.run(() => {
|
|
302
|
-
this.error = true;
|
|
303
|
-
this.errorMessage = message;
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
private syncFileItemState(id: string | number, changes: Partial<FileItem>) {
|
|
308
|
-
const index = this.selectedFiles.findIndex((f) => f.id === id);
|
|
309
|
-
if (index === -1) {
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
const updated = { ...this.selectedFiles[index], ...changes } as FileItem;
|
|
314
|
-
this.selectedFiles = [
|
|
315
|
-
...this.selectedFiles.slice(0, index),
|
|
316
|
-
updated,
|
|
317
|
-
...this.selectedFiles.slice(index + 1),
|
|
318
|
-
];
|
|
67
|
+
// Implementación básica para build
|
|
319
68
|
}
|
|
320
69
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
const reader = new FileReader();
|
|
324
|
-
reader.readAsDataURL(file);
|
|
325
|
-
reader.onload = () => resolve(reader.result as string);
|
|
326
|
-
reader.onerror = (error) => resolve('assets/img/imgIcon.png');
|
|
327
|
-
});
|
|
70
|
+
onFileAction(event: any) {
|
|
71
|
+
// Implementación básica para build
|
|
328
72
|
}
|
|
329
73
|
}
|