@dropi/ui-components 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitignore +13 -0
- package/CONTRIBUTING.md +188 -0
- package/MIGRATION_STEPS.md +39 -0
- package/PUBLISH_CHECKLIST.md +97 -0
- package/QUICK_START.md +108 -0
- package/README.md +146 -0
- package/jest.config.ts +21 -0
- package/ng-package.json +8 -0
- package/package.json +66 -0
- package/project.json +48 -0
- package/publish.sh +113 -0
- package/src/components-source/accordion/accordion-item/accordion-item.component.html +12 -0
- package/src/components-source/accordion/accordion-item/accordion-item.component.scss +47 -0
- package/src/components-source/accordion/accordion-item/accordion-item.component.spec.ts +122 -0
- package/src/components-source/accordion/accordion-item/accordion-item.component.ts +42 -0
- package/src/components-source/accordion/accordion.component.html +3 -0
- package/src/components-source/accordion/accordion.component.scss +5 -0
- package/src/components-source/accordion/accordion.component.spec.ts +243 -0
- package/src/components-source/accordion/accordion.component.stories.ts +111 -0
- package/src/components-source/accordion/accordion.component.ts +43 -0
- package/src/components-source/alert/alert.component.html +28 -0
- package/src/components-source/alert/alert.component.scss +154 -0
- package/src/components-source/alert/alert.component.spec.ts +185 -0
- package/src/components-source/alert/alert.component.stories.ts +310 -0
- package/src/components-source/alert/alert.component.ts +203 -0
- package/src/components-source/alert-legacy/alert.component.html +21 -0
- package/src/components-source/alert-legacy/alert.component.scss +42 -0
- package/src/components-source/alert-legacy/alert.component.spec.ts +159 -0
- package/src/components-source/alert-legacy/alert.component.ts +33 -0
- package/src/components-source/alert-modal/alert-modal.component.html +124 -0
- package/src/components-source/alert-modal/alert-modal.component.scss +203 -0
- package/src/components-source/alert-modal/alert-modal.component.spec.ts +557 -0
- package/src/components-source/alert-modal/alert-modal.component.stories.ts +295 -0
- package/src/components-source/alert-modal/alert-modal.component.ts +294 -0
- package/src/components-source/alert-modal/services/template-alert-modal.service.ts +75 -0
- package/src/components-source/badge/badge.component.html +49 -0
- package/src/components-source/badge/badge.component.scss +57 -0
- package/src/components-source/badge/badge.component.spec.ts +181 -0
- package/src/components-source/badge/badge.component.ts +21 -0
- package/src/components-source/breadcrumb/breadcrumb.component.html +5 -0
- package/src/components-source/breadcrumb/breadcrumb.component.scss +46 -0
- package/src/components-source/breadcrumb/breadcrumb.component.spec.ts +279 -0
- package/src/components-source/breadcrumb/breadcrumb.component.ts +24 -0
- package/src/components-source/card-product/card-product.component.html +173 -0
- package/src/components-source/card-product/card-product.component.spec.ts +601 -0
- package/src/components-source/card-product/card-product.component.stories.ts +322 -0
- package/src/components-source/card-product/card-product.component.ts +1101 -0
- package/src/components-source/card-section/card-section.component.html +22 -0
- package/src/components-source/card-section/card-section.component.scss +14 -0
- package/src/components-source/card-section/card-section.component.spec.ts +333 -0
- package/src/components-source/card-section/card-section.component.stories.ts +141 -0
- package/src/components-source/card-section/card-section.component.ts +35 -0
- package/src/components-source/checkbox-selection-list/checkbox-selection-list.component.html +38 -0
- package/src/components-source/checkbox-selection-list/checkbox-selection-list.component.scss +147 -0
- package/src/components-source/checkbox-selection-list/checkbox-selection-list.component.spec.ts +555 -0
- package/src/components-source/checkbox-selection-list/checkbox-selection-list.component.stories.ts +157 -0
- package/src/components-source/checkbox-selection-list/checkbox-selection-list.component.ts +219 -0
- package/src/components-source/city-selector/city-selector.component.html +22 -0
- package/src/components-source/city-selector/city-selector.component.scss +1 -0
- package/src/components-source/city-selector/city-selector.component.spec.ts +278 -0
- package/src/components-source/city-selector/city-selector.component.stories.ts +200 -0
- package/src/components-source/city-selector/city-selector.component.ts +151 -0
- package/src/components-source/color-picker/color-picker.component.html +54 -0
- package/src/components-source/color-picker/color-picker.component.scss +203 -0
- package/src/components-source/color-picker/color-picker.component.spec.ts +148 -0
- package/src/components-source/color-picker/color-picker.component.stories.ts +70 -0
- package/src/components-source/color-picker/color-picker.component.ts +353 -0
- package/src/components-source/country-flags/country-flags.component.html +10 -0
- package/src/components-source/country-flags/country-flags.component.scss +34 -0
- package/src/components-source/country-flags/country-flags.component.spec.ts +78 -0
- package/src/components-source/country-flags/country-flags.component.ts +18 -0
- package/src/components-source/date-picker/date-picker.component.html +35 -0
- package/src/components-source/date-picker/date-picker.component.scss +388 -0
- package/src/components-source/date-picker/date-picker.component.spec.ts +510 -0
- package/src/components-source/date-picker/date-picker.component.stories.ts +444 -0
- package/src/components-source/date-picker/date-picker.component.ts +313 -0
- package/src/components-source/date-picker/date-picker.stories.spec.ts +150 -0
- package/src/components-source/date-picker-range/date-picker-range.component.html +45 -0
- package/src/components-source/date-picker-range/date-picker-range.component.scss +229 -0
- package/src/components-source/date-picker-range/date-picker-range.component.spec.ts +555 -0
- package/src/components-source/date-picker-range/date-picker-range.component.ts +254 -0
- package/src/components-source/dropi-avatars/dropi-avatars.component.html +17 -0
- package/src/components-source/dropi-avatars/dropi-avatars.component.scss +58 -0
- package/src/components-source/dropi-avatars/dropi-avatars.component.spec.ts +403 -0
- package/src/components-source/dropi-avatars/dropi-avatars.component.ts +24 -0
- package/src/components-source/dropi-badge/dropi-badge.component.html +12 -0
- package/src/components-source/dropi-badge/dropi-badge.component.scss +50 -0
- package/src/components-source/dropi-badge/dropi-badge.component.spec.ts +108 -0
- package/src/components-source/dropi-badge/dropi-badge.component.stories.ts +140 -0
- package/src/components-source/dropi-badge/dropi-badge.component.ts +39 -0
- package/src/components-source/dropi-banner-external/dropi-banner-external.component.html +67 -0
- package/src/components-source/dropi-banner-external/dropi-banner-external.component.scss +46 -0
- package/src/components-source/dropi-banner-external/dropi-banner-external.component.spec.ts +170 -0
- package/src/components-source/dropi-banner-external/dropi-banner-external.component.stories.ts +203 -0
- package/src/components-source/dropi-banner-external/dropi-banner-external.component.ts +204 -0
- package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.component.html +65 -0
- package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.component.scss +65 -0
- package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.component.spec.ts +125 -0
- package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.component.ts +38 -0
- package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.stories.ts +133 -0
- package/src/components-source/dropi-button/dropi-button.component.html +37 -0
- package/src/components-source/dropi-button/dropi-button.component.scss +266 -0
- package/src/components-source/dropi-button/dropi-button.component.spec.ts +264 -0
- package/src/components-source/dropi-button/dropi-button.component.stories.ts +221 -0
- package/src/components-source/dropi-button/dropi-button.component.ts +82 -0
- package/src/components-source/dropi-card-checkbox/dropi-card-checkbox.component.html +24 -0
- package/src/components-source/dropi-card-checkbox/dropi-card-checkbox.component.scss +85 -0
- package/src/components-source/dropi-card-checkbox/dropi-card-checkbox.component.spec.ts +157 -0
- package/src/components-source/dropi-card-checkbox/dropi-card-checkbox.component.stories.ts +209 -0
- package/src/components-source/dropi-card-checkbox/dropi-card-checkbox.component.ts +41 -0
- package/src/components-source/dropi-carousel/dropi-carousel.component.html +57 -0
- package/src/components-source/dropi-carousel/dropi-carousel.component.scss +156 -0
- package/src/components-source/dropi-carousel/dropi-carousel.component.spec.ts +224 -0
- package/src/components-source/dropi-carousel/dropi-carousel.component.ts +266 -0
- package/src/components-source/dropi-carousel/dropi-carousel.stories.ts +365 -0
- package/src/components-source/dropi-checkbox/dropi-checkbox.component.css +39 -0
- package/src/components-source/dropi-checkbox/dropi-checkbox.component.html +18 -0
- package/src/components-source/dropi-checkbox/dropi-checkbox.component.spec.ts +155 -0
- package/src/components-source/dropi-checkbox/dropi-checkbox.component.stories.ts +101 -0
- package/src/components-source/dropi-checkbox/dropi-checkbox.component.ts +25 -0
- package/src/components-source/dropi-chips/dropi-chips.component.html +10 -0
- package/src/components-source/dropi-chips/dropi-chips.component.scss +54 -0
- package/src/components-source/dropi-chips/dropi-chips.component.spec.ts +356 -0
- package/src/components-source/dropi-chips/dropi-chips.component.stories.ts +275 -0
- package/src/components-source/dropi-chips/dropi-chips.component.ts +100 -0
- package/src/components-source/dropi-country-selector/countries.data.ts +239 -0
- package/src/components-source/dropi-country-selector/dropi-country-selector.component.html +59 -0
- package/src/components-source/dropi-country-selector/dropi-country-selector.component.scss +126 -0
- package/src/components-source/dropi-country-selector/dropi-country-selector.component.spec.ts +244 -0
- package/src/components-source/dropi-country-selector/dropi-country-selector.component.stories.ts +117 -0
- package/src/components-source/dropi-country-selector/dropi-country-selector.component.ts +179 -0
- package/src/components-source/dropi-drawer/dropi-drawer.component.html +23 -0
- package/src/components-source/dropi-drawer/dropi-drawer.component.scss +88 -0
- package/src/components-source/dropi-drawer/dropi-drawer.component.spec.ts +84 -0
- package/src/components-source/dropi-drawer/dropi-drawer.component.ts +90 -0
- package/src/components-source/dropi-dropdown/dropi-dropdown.component.html +30 -0
- package/src/components-source/dropi-dropdown/dropi-dropdown.component.scss +58 -0
- package/src/components-source/dropi-dropdown/dropi-dropdown.component.spec.ts +213 -0
- package/src/components-source/dropi-dropdown/dropi-dropdown.component.stories.ts +143 -0
- package/src/components-source/dropi-dropdown/dropi-dropdown.component.ts +53 -0
- package/src/components-source/dropi-favorite-button/dropi-favorite-button.component.html +23 -0
- package/src/components-source/dropi-favorite-button/dropi-favorite-button.component.scss +21 -0
- package/src/components-source/dropi-favorite-button/dropi-favorite-button.component.spec.ts +240 -0
- package/src/components-source/dropi-favorite-button/dropi-favorite-button.component.ts +31 -0
- package/src/components-source/dropi-file-upload/card-view/card-view.component.html +154 -0
- package/src/components-source/dropi-file-upload/card-view/card-view.component.scss +118 -0
- package/src/components-source/dropi-file-upload/card-view/card-view.component.ts +72 -0
- package/src/components-source/dropi-file-upload/drop-zone/drop-zone.coment.stories.ts +179 -0
- package/src/components-source/dropi-file-upload/drop-zone/drop-zone.component.html +111 -0
- package/src/components-source/dropi-file-upload/drop-zone/drop-zone.component.scss +90 -0
- package/src/components-source/dropi-file-upload/drop-zone/drop-zone.component.ts +172 -0
- package/src/components-source/dropi-file-upload/dropi-file-upload.component.html +42 -0
- package/src/components-source/dropi-file-upload/dropi-file-upload.component.scss +31 -0
- package/src/components-source/dropi-file-upload/dropi-file-upload.component.spec.ts +398 -0
- package/src/components-source/dropi-file-upload/dropi-file-upload.component.stories.ts +139 -0
- package/src/components-source/dropi-file-upload/dropi-file-upload.component.ts +329 -0
- package/src/components-source/dropi-file-upload/file-list/file-list.component.html +51 -0
- package/src/components-source/dropi-file-upload/file-list/file-list.component.scss +60 -0
- package/src/components-source/dropi-file-upload/file-list/file-list.component.ts +84 -0
- package/src/components-source/dropi-file-upload/grid-view/grid-view.component.html +77 -0
- package/src/components-source/dropi-file-upload/grid-view/grid-view.component.scss +85 -0
- package/src/components-source/dropi-file-upload/grid-view/grid-view.component.ts +35 -0
- package/src/components-source/dropi-ilustration-icon/dropi-ilustration-icon.component.html +38 -0
- package/src/components-source/dropi-ilustration-icon/dropi-ilustration-icon.component.scss +59 -0
- package/src/components-source/dropi-ilustration-icon/dropi-ilustration-icon.component.spec.ts +214 -0
- package/src/components-source/dropi-ilustration-icon/dropi-ilustration-icon.component.ts +65 -0
- package/src/components-source/dropi-image-overlay/dropi-image-overlay.component.html +54 -0
- package/src/components-source/dropi-image-overlay/dropi-image-overlay.component.scss +210 -0
- package/src/components-source/dropi-image-overlay/dropi-image-overlay.component.spec.ts +145 -0
- package/src/components-source/dropi-image-overlay/dropi-image-overlay.component.ts +76 -0
- package/src/components-source/dropi-image-overlay/dropi-image-overlay.stories.ts +267 -0
- package/src/components-source/dropi-languages-selector/dropi-languages-selector.component.html +17 -0
- package/src/components-source/dropi-languages-selector/dropi-languages-selector.component.scss +82 -0
- package/src/components-source/dropi-languages-selector/dropi-languages-selector.component.spec.ts +152 -0
- package/src/components-source/dropi-languages-selector/dropi-languages-selector.component.ts +41 -0
- package/src/components-source/dropi-logo/dropi-logo.component.html +3 -0
- package/src/components-source/dropi-logo/dropi-logo.component.scss +20 -0
- package/src/components-source/dropi-logo/dropi-logo.component.spec.ts +274 -0
- package/src/components-source/dropi-logo/dropi-logo.component.ts +24 -0
- package/src/components-source/dropi-modal/dropi-modal-stack.service.ts +75 -0
- package/src/components-source/dropi-modal/dropi-modal.component.html +55 -0
- package/src/components-source/dropi-modal/dropi-modal.component.scss +274 -0
- package/src/components-source/dropi-modal/dropi-modal.component.spec.ts +46 -0
- package/src/components-source/dropi-modal/dropi-modal.component.stories.ts +392 -0
- package/src/components-source/dropi-modal/dropi-modal.component.ts +392 -0
- package/src/components-source/dropi-modal/p-template.directive.ts +11 -0
- package/src/components-source/dropi-navbar/dropi-navbar.component.html +41 -0
- package/src/components-source/dropi-navbar/dropi-navbar.component.scss +227 -0
- package/src/components-source/dropi-navbar/dropi-navbar.component.spec.ts +110 -0
- package/src/components-source/dropi-navbar/dropi-navbar.component.ts +52 -0
- package/src/components-source/dropi-paginator/dropi-paginator.component.html +64 -0
- package/src/components-source/dropi-paginator/dropi-paginator.component.scss +43 -0
- package/src/components-source/dropi-paginator/dropi-paginator.component.spec.ts +285 -0
- package/src/components-source/dropi-paginator/dropi-paginator.component.stories.ts +345 -0
- package/src/components-source/dropi-paginator/dropi-paginator.component.ts +85 -0
- package/src/components-source/dropi-phone-input/dropi-phone-input.component.html +93 -0
- package/src/components-source/dropi-phone-input/dropi-phone-input.component.scss +224 -0
- package/src/components-source/dropi-phone-input/dropi-phone-input.component.spec.ts +376 -0
- package/src/components-source/dropi-phone-input/dropi-phone-input.component.ts +203 -0
- package/src/components-source/dropi-phone-input/numeric-input.directive.ts +17 -0
- package/src/components-source/dropi-radio-button/dropi-radio-button.component.html +8 -0
- package/src/components-source/dropi-radio-button/dropi-radio-button.component.scss +33 -0
- package/src/components-source/dropi-radio-button/dropi-radio-button.component.spec.ts +225 -0
- package/src/components-source/dropi-radio-button/dropi-radio-button.component.ts +48 -0
- package/src/components-source/dropi-search/dropi-search.component.html +124 -0
- package/src/components-source/dropi-search/dropi-search.component.scss +116 -0
- package/src/components-source/dropi-search/dropi-search.component.spec.ts +483 -0
- package/src/components-source/dropi-search/dropi-search.component.stories.ts +267 -0
- package/src/components-source/dropi-search/dropi-search.component.ts +230 -0
- package/src/components-source/dropi-select/dropi-select.component.html +158 -0
- package/src/components-source/dropi-select/dropi-select.component.scss +275 -0
- package/src/components-source/dropi-select/dropi-select.component.spec.ts +386 -0
- package/src/components-source/dropi-select/dropi-select.component.stories.ts +686 -0
- package/src/components-source/dropi-select/dropi-select.component.ts +465 -0
- package/src/components-source/dropi-skeleton/dropi-skeleton.component.html +10 -0
- package/src/components-source/dropi-skeleton/dropi-skeleton.component.scss +28 -0
- package/src/components-source/dropi-skeleton/dropi-skeleton.component.spec.ts +273 -0
- package/src/components-source/dropi-skeleton/dropi-skeleton.component.stories.ts +145 -0
- package/src/components-source/dropi-skeleton/dropi-skeleton.component.ts +30 -0
- package/src/components-source/dropi-steps/dropi-steps.component.html +29 -0
- package/src/components-source/dropi-steps/dropi-steps.component.scss +110 -0
- package/src/components-source/dropi-steps/dropi-steps.component.spec.ts +228 -0
- package/src/components-source/dropi-steps/dropi-steps.component.stories.ts +231 -0
- package/src/components-source/dropi-steps/dropi-steps.component.ts +98 -0
- package/src/components-source/dropi-switch/dropi-switch.component.html +4 -0
- package/src/components-source/dropi-switch/dropi-switch.component.scss +50 -0
- package/src/components-source/dropi-switch/dropi-switch.component.spec.ts +105 -0
- package/src/components-source/dropi-switch/dropi-switch.component.stories.ts +106 -0
- package/src/components-source/dropi-switch/dropi-switch.component.ts +22 -0
- package/src/components-source/dropi-table/dropi-table.component.html +395 -0
- package/src/components-source/dropi-table/dropi-table.component.scss +506 -0
- package/src/components-source/dropi-table/dropi-table.component.spec.ts +578 -0
- package/src/components-source/dropi-table/dropi-table.component.stories.ts +313 -0
- package/src/components-source/dropi-table/dropi-table.component.ts +580 -0
- package/src/components-source/dropi-tag/dropi-tag.component.html +17 -0
- package/src/components-source/dropi-tag/dropi-tag.component.scss +50 -0
- package/src/components-source/dropi-tag/dropi-tag.component.spec.ts +267 -0
- package/src/components-source/dropi-tag/dropi-tag.component.stories.ts +290 -0
- package/src/components-source/dropi-tag/dropi-tag.component.ts +92 -0
- package/src/components-source/dropi-text-area/droip-text-area.component.stories.ts +138 -0
- package/src/components-source/dropi-text-area/dropi-text-area.component.html +63 -0
- package/src/components-source/dropi-text-area/dropi-text-area.component.scss +106 -0
- package/src/components-source/dropi-text-area/dropi-text-area.component.spec.ts +507 -0
- package/src/components-source/dropi-text-area/dropi-text-area.component.ts +80 -0
- package/src/components-source/dropi-tooltip/dropi-tooltip.component.html +70 -0
- package/src/components-source/dropi-tooltip/dropi-tooltip.component.scss +250 -0
- package/src/components-source/dropi-tooltip/dropi-tooltip.component.spec.ts +423 -0
- package/src/components-source/dropi-tooltip/dropi-tooltip.component.ts +153 -0
- package/src/components-source/dropi-youtube-lazy-video/dropi-youtube-lazy-video.component.html +20 -0
- package/src/components-source/dropi-youtube-lazy-video/dropi-youtube-lazy-video.component.scss +63 -0
- package/src/components-source/dropi-youtube-lazy-video/dropi-youtube-lazy-video.component.spec.ts +121 -0
- package/src/components-source/dropi-youtube-lazy-video/dropi-youtube-lazy-video.component.ts +43 -0
- package/src/components-source/dropi-youtube-lazy-video/dropi-youtube-lazy-video.stories.ts +125 -0
- package/src/components-source/empty-state/empty-state.component.html +30 -0
- package/src/components-source/empty-state/empty-state.component.scss +76 -0
- package/src/components-source/empty-state/empty-state.component.spec.ts +244 -0
- package/src/components-source/empty-state/empty-state.component.stories.ts +198 -0
- package/src/components-source/empty-state/empty-state.component.ts +34 -0
- package/src/components-source/file-upload-progress-bar/file-upload-progress-bar.component.html +81 -0
- package/src/components-source/file-upload-progress-bar/file-upload-progress-bar.component.scss +86 -0
- package/src/components-source/file-upload-progress-bar/file-upload-progress-bar.component.spec.ts +27 -0
- package/src/components-source/file-upload-progress-bar/file-upload-progress-bar.component.stories.ts +149 -0
- package/src/components-source/file-upload-progress-bar/file-upload-progress-bar.component.ts +89 -0
- package/src/components-source/foundations/dropi-border-radius-demo/dropi-border-radius-demo.component.scss +32 -0
- package/src/components-source/foundations/dropi-border-radius-demo/dropi-border-radius-demo.component.ts +17 -0
- package/src/components-source/foundations/foundations.component.html +183 -0
- package/src/components-source/foundations/foundations.component.scss +31 -0
- package/src/components-source/foundations/foundations.component.ts +26 -0
- package/src/components-source/icon/icon-names.const.ts +270 -0
- package/src/components-source/icon/icon.component.html +3 -0
- package/src/components-source/icon/icon.component.scss +4 -0
- package/src/components-source/icon/icon.component.spec.ts +304 -0
- package/src/components-source/icon/icon.component.ts +53 -0
- package/src/components-source/index.ts +89 -0
- package/src/components-source/input/input.component.html +97 -0
- package/src/components-source/input/input.component.scss +149 -0
- package/src/components-source/input/input.component.spec.ts +243 -0
- package/src/components-source/input/input.component.stories.ts +269 -0
- package/src/components-source/input/input.component.ts +119 -0
- package/src/components-source/lottie-loader/lottie-loader.component.html +16 -0
- package/src/components-source/lottie-loader/lottie-loader.component.scss +32 -0
- package/src/components-source/lottie-loader/lottie-loader.component.spec.ts +103 -0
- package/src/components-source/lottie-loader/lottie-loader.component.ts +20 -0
- package/src/components-source/otp-send-code/mock-otp-services.ts +214 -0
- package/src/components-source/otp-send-code/otp-send-code.component.html +151 -0
- package/src/components-source/otp-send-code/otp-send-code.component.scss +156 -0
- package/src/components-source/otp-send-code/otp-send-code.component.spec.ts +419 -0
- package/src/components-source/otp-send-code/otp-send-code.component.stories.ts +190 -0
- package/src/components-source/otp-send-code/otp-send-code.component.ts +659 -0
- package/src/components-source/radio-selection-list/radio-selection-list.component.html +107 -0
- package/src/components-source/radio-selection-list/radio-selection-list.component.scss +280 -0
- package/src/components-source/radio-selection-list/radio-selection-list.component.spec.ts +243 -0
- package/src/components-source/radio-selection-list/radio-selection-list.component.stories.ts +313 -0
- package/src/components-source/radio-selection-list/radio-selection-list.component.ts +143 -0
- package/src/components-source/read-more/read-more.component.html +14 -0
- package/src/components-source/read-more/read-more.component.scss +16 -0
- package/src/components-source/read-more/read-more.component.spec.ts +272 -0
- package/src/components-source/read-more/read-more.component.stories.ts +131 -0
- package/src/components-source/read-more/read-more.component.ts +88 -0
- package/src/components-source/sidebar/sidebar.component.html +42 -0
- package/src/components-source/sidebar/sidebar.component.scss +70 -0
- package/src/components-source/sidebar/sidebar.component.spec.ts +354 -0
- package/src/components-source/sidebar/sidebar.component.stories.ts +145 -0
- package/src/components-source/sidebar/sidebar.component.ts +105 -0
- package/src/components-source/simple-stepper/simple-stepper.component.html +17 -0
- package/src/components-source/simple-stepper/simple-stepper.component.scss +117 -0
- package/src/components-source/simple-stepper/simple-stepper.component.spec.ts +348 -0
- package/src/components-source/simple-stepper/simple-stepper.component.stories.ts +104 -0
- package/src/components-source/simple-stepper/simple-stepper.component.ts +69 -0
- package/src/components-source/storybook-doc-components/avatars-storybook/avatars-storybook.component.html +192 -0
- package/src/components-source/storybook-doc-components/avatars-storybook/avatars-storybook.component.scss +15 -0
- package/src/components-source/storybook-doc-components/avatars-storybook/avatars-storybook.component.ts +17 -0
- package/src/components-source/storybook-doc-components/border-radius-storybook/border-radius-storybook.component.html +22 -0
- package/src/components-source/storybook-doc-components/border-radius-storybook/border-radius-storybook.component.scss +0 -0
- package/src/components-source/storybook-doc-components/border-radius-storybook/border-radius-storybook.component.ts +54 -0
- package/src/components-source/storybook-doc-components/breakpoints-and-grids-storybook/breakpoints-and-grids-storybook.component.css +81 -0
- package/src/components-source/storybook-doc-components/breakpoints-and-grids-storybook/breakpoints-and-grids-storybook.component.html +143 -0
- package/src/components-source/storybook-doc-components/breakpoints-and-grids-storybook/breakpoints-and-grids-storybook.component.ts +97 -0
- package/src/components-source/storybook-doc-components/colors-storybook/colors-storybook.component.css +10 -0
- package/src/components-source/storybook-doc-components/colors-storybook/colors-storybook.component.html +63 -0
- package/src/components-source/storybook-doc-components/colors-storybook/colors-storybook.component.ts +542 -0
- package/src/components-source/storybook-doc-components/dropi-modal/dropi-modal.component.html +132 -0
- package/src/components-source/storybook-doc-components/dropi-modal/dropi-modal.component.scss +15 -0
- package/src/components-source/storybook-doc-components/dropi-modal/dropi-modal.component.ts +67 -0
- package/src/components-source/storybook-doc-components/dropi-toast/dropi-toast.component.html +156 -0
- package/src/components-source/storybook-doc-components/dropi-toast/dropi-toast.component.scss +13 -0
- package/src/components-source/storybook-doc-components/dropi-toast/dropi-toast.component.ts +55 -0
- package/src/components-source/storybook-doc-components/flags-storybook/flags-storybook.component.css +0 -0
- package/src/components-source/storybook-doc-components/flags-storybook/flags-storybook.component.html +99 -0
- package/src/components-source/storybook-doc-components/flags-storybook/flags-storybook.component.ts +19 -0
- package/src/components-source/storybook-doc-components/icons-storybook/icons-storybook.component.css +82 -0
- package/src/components-source/storybook-doc-components/icons-storybook/icons-storybook.component.html +111 -0
- package/src/components-source/storybook-doc-components/icons-storybook/icons-storybook.component.ts +196 -0
- package/src/components-source/storybook-doc-components/logo-storybook/logo-foundations.component.ts +19 -0
- package/src/components-source/storybook-doc-components/logo-storybook/logo-storybook.component.css +0 -0
- package/src/components-source/storybook-doc-components/logo-storybook/logo-storybook.component.html +104 -0
- package/src/components-source/storybook-doc-components/lustration-storybook/lustration-storybook.component.css +0 -0
- package/src/components-source/storybook-doc-components/lustration-storybook/lustration-storybook.component.html +218 -0
- package/src/components-source/storybook-doc-components/lustration-storybook/lustration-storybook.component.ts +20 -0
- package/src/components-source/storybook-doc-components/shadow-storybook/shadow-storybook.component.html +21 -0
- package/src/components-source/storybook-doc-components/shadow-storybook/shadow-storybook.component.scss +0 -0
- package/src/components-source/storybook-doc-components/shadow-storybook/shadow-storybook.component.ts +66 -0
- package/src/components-source/storybook-doc-components/spacing-storybook/spacing-storybook.component.html +33 -0
- package/src/components-source/storybook-doc-components/spacing-storybook/spacing-storybook.component.scss +0 -0
- package/src/components-source/storybook-doc-components/spacing-storybook/spacing-storybook.component.ts +37 -0
- package/src/components-source/storybook-doc-components/story-page/story-page.component.html +74 -0
- package/src/components-source/storybook-doc-components/story-page/story-page.component.scss +103 -0
- package/src/components-source/storybook-doc-components/story-page/story-page.component.ts +424 -0
- package/src/components-source/storybook-doc-components/template-breakpoint-storybook/template-breakpoint-storybook.component.html +35 -0
- package/src/components-source/storybook-doc-components/template-breakpoint-storybook/template-breakpoint-storybook.component.scss +64 -0
- package/src/components-source/storybook-doc-components/template-breakpoint-storybook/template-breakpoint-storybook.component.ts +71 -0
- package/src/components-source/storybook-doc-components/tillte-table-documentation/tillte-table-documentation.component.html +44 -0
- package/src/components-source/storybook-doc-components/tillte-table-documentation/tillte-table-documentation.component.scss +270 -0
- package/src/components-source/storybook-doc-components/tillte-table-documentation/tillte-table-documentation.component.ts +153 -0
- package/src/components-source/tabs/tabs.component.html +26 -0
- package/src/components-source/tabs/tabs.component.scss +62 -0
- package/src/components-source/tabs/tabs.component.spec.ts +212 -0
- package/src/components-source/tabs/tabs.component.stories.ts +203 -0
- package/src/components-source/tabs/tabs.component.ts +138 -0
- package/src/components-source/tag-type-product/tag-type-product.component.html +1 -0
- package/src/components-source/tag-type-product/tag-type-product.component.scss +10 -0
- package/src/components-source/tag-type-product/tag-type-product.component.spec.ts +38 -0
- package/src/components-source/tag-type-product/tag-type-product.component.ts +9 -0
- package/src/components-source/toast/toast.component.html +37 -0
- package/src/components-source/toast/toast.component.scss +142 -0
- package/src/components-source/toast/toast.component.spec.ts +368 -0
- package/src/components-source/toast/toast.component.ts +59 -0
- package/src/components-source/toast/toast.stories.ts +69 -0
- package/src/components-source/tooltip/tooltip.component.html +46 -0
- package/src/components-source/tooltip/tooltip.component.scss +44 -0
- package/src/components-source/tooltip/tooltip.component.spec.ts +327 -0
- package/src/components-source/tooltip/tooltip.component.ts +24 -0
- package/src/components-source/ui-dropi.module.ts +125 -0
- package/src/components-source/ui-inventory.json +1138 -0
- package/src/components-source/vertical-steps/vertical-steps.component.html +35 -0
- package/src/components-source/vertical-steps/vertical-steps.component.scss +143 -0
- package/src/components-source/vertical-steps/vertical-steps.component.spec.ts +121 -0
- package/src/components-source/vertical-steps/vertical-steps.component.stories.ts +216 -0
- package/src/components-source/vertical-steps/vertical-steps.component.ts +151 -0
- package/src/index.ts +31 -0
- package/src/lib/bootstrap.ts +28 -0
- package/src/lib/dropi-ui-elements/dropi-ui-elements.component.html +1 -0
- package/src/lib/dropi-ui-elements/dropi-ui-elements.component.scss +0 -0
- package/src/lib/dropi-ui-elements/dropi-ui-elements.component.spec.ts +21 -0
- package/src/lib/dropi-ui-elements/dropi-ui-elements.component.ts +9 -0
- package/src/lib/elements-registry.ts +66 -0
- package/src/lib/elements.module.ts +22 -0
- package/src/styles.scss +152 -0
- package/src/test-setup.ts +6 -0
- package/tsconfig.json +28 -0
- package/tsconfig.lib.json +18 -0
- package/tsconfig.lib.prod.json +9 -0
- package/tsconfig.spec.json +12 -0
|
@@ -0,0 +1,329 @@
|
|
|
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
|
+
import {
|
|
6
|
+
FILE_TYPE_MAP,
|
|
7
|
+
FileItem,
|
|
8
|
+
UploadFileState,
|
|
9
|
+
UploadParams,
|
|
10
|
+
} from '../../utilities/interfaces/ui/upload.model';
|
|
11
|
+
import { FileListComponent } from './file-list/file-list.component';
|
|
12
|
+
import { UploadFileService } from '@app/services/ui/upload-file.service';
|
|
13
|
+
import { AlertComponent } from '../alert/alert.component';
|
|
14
|
+
|
|
15
|
+
@Component({
|
|
16
|
+
selector: 'app-dropi-file-upload',
|
|
17
|
+
standalone: true,
|
|
18
|
+
imports: [CommonModule, TranslateModule, DropZoneComponent, FileListComponent, AlertComponent],
|
|
19
|
+
templateUrl: './dropi-file-upload.component.html',
|
|
20
|
+
styleUrls: ['./dropi-file-upload.component.scss'],
|
|
21
|
+
})
|
|
22
|
+
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
|
+
@Input() params: UploadParams = {
|
|
41
|
+
title: '',
|
|
42
|
+
label: '',
|
|
43
|
+
previewType: 'card',
|
|
44
|
+
multiple: false,
|
|
45
|
+
maxFiles: 1,
|
|
46
|
+
maxFileSizeMB: 10,
|
|
47
|
+
accept: [],
|
|
48
|
+
compress: false,
|
|
49
|
+
maxHeight: 1000,
|
|
50
|
+
maxWidth: 1000,
|
|
51
|
+
path: '',
|
|
52
|
+
onlyView: false,
|
|
53
|
+
viewDragAndDrop: false
|
|
54
|
+
};
|
|
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
|
+
@Output() uploadedUrlsChange = new EventEmitter<string[]>();
|
|
63
|
+
|
|
64
|
+
dragOver = false;
|
|
65
|
+
selectedFiles: FileItem[] = [];
|
|
66
|
+
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
|
+
}
|
|
107
|
+
|
|
108
|
+
cancelDelete(file: FileItem): void {
|
|
109
|
+
file.state = 'complete';
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
deleteFile(file: FileItem): void {
|
|
113
|
+
this.selectedFiles = this.selectedFiles.filter((f) => f !== file);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
onFilesAdded($event: any) {
|
|
117
|
+
this.handleFiles($event);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
handleFiles(files: File[]): void {
|
|
121
|
+
this.error = false;
|
|
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
|
+
];
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
private generatePreviewUrl(file: File): Promise<string> {
|
|
322
|
+
return new Promise((resolve, reject) => {
|
|
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
|
+
});
|
|
328
|
+
}
|
|
329
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<div class="files-container">
|
|
2
|
+
<div class="grid-list">
|
|
3
|
+
<ng-container *ngIf="!viewImageToDelete">
|
|
4
|
+
<app-grid-view
|
|
5
|
+
*ngFor="let fileItem of gridFiles"
|
|
6
|
+
[fileItem]="fileItem"
|
|
7
|
+
(action)="onChildGridAction($event)"
|
|
8
|
+
></app-grid-view>
|
|
9
|
+
</ng-container>
|
|
10
|
+
|
|
11
|
+
<app-card-view
|
|
12
|
+
*ngIf="viewImageToDelete"
|
|
13
|
+
style="width: 100%"
|
|
14
|
+
[fileItem]="imageTodelete"
|
|
15
|
+
[onlyView]="onlyView"
|
|
16
|
+
(action)="onDeleteCardAction($event)"
|
|
17
|
+
></app-card-view>
|
|
18
|
+
<div
|
|
19
|
+
(click)="addImage()"
|
|
20
|
+
*ngIf="(gridFiles.length != 0 || (previewType == 'grid' && addButton)) && gridFiles.length < maxFiles && !viewImageToDelete"
|
|
21
|
+
class="add-img"
|
|
22
|
+
>
|
|
23
|
+
<div class="icon">
|
|
24
|
+
<svg
|
|
25
|
+
width="14"
|
|
26
|
+
height="14"
|
|
27
|
+
viewBox="0 0 14 14"
|
|
28
|
+
fill="none"
|
|
29
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
30
|
+
>
|
|
31
|
+
<path
|
|
32
|
+
d="M9.77774 6.4444H7.55551V4.22218C7.55551 4.07484 7.49698 3.93353 7.3928 3.82934C7.28861 3.72516 7.1473 3.66663 6.99996 3.66663C6.85262 3.66663 6.71131 3.72516 6.60712 3.82934C6.50294 3.93353 6.4444 4.07484 6.4444 4.22218V6.4444H4.22218C4.07484 6.4444 3.93353 6.50294 3.82934 6.60712C3.72516 6.71131 3.66663 6.85262 3.66663 6.99996C3.66663 7.1473 3.72516 7.28861 3.82934 7.3928C3.93353 7.49698 4.07484 7.55551 4.22218 7.55551H6.4444V9.77774C6.4444 9.92508 6.50294 10.0664 6.60712 10.1706C6.71131 10.2748 6.85262 10.3333 6.99996 10.3333C7.1473 10.3333 7.28861 10.2748 7.3928 10.1706C7.49698 10.0664 7.55551 9.92508 7.55551 9.77774V7.55551H9.77774C9.92508 7.55551 10.0664 7.49698 10.1706 7.3928C10.2748 7.28861 10.3333 7.1473 10.3333 6.99996C10.3333 6.85262 10.2748 6.71131 10.1706 6.60712C10.0664 6.50294 9.92508 6.4444 9.77774 6.4444Z"
|
|
33
|
+
fill="#32394D"
|
|
34
|
+
/>
|
|
35
|
+
</svg>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="text">
|
|
38
|
+
{{ 'add' | translate }}
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
<div class="card-list">
|
|
43
|
+
<app-card-view
|
|
44
|
+
*ngFor="let fileItem of cardFiles"
|
|
45
|
+
style="width: 100%"
|
|
46
|
+
[fileItem]="fileItem"
|
|
47
|
+
[onlyView]="onlyView"
|
|
48
|
+
(action)="onChildAction($event)"
|
|
49
|
+
></app-card-view>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
.grid-list {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: flex-start;
|
|
4
|
+
gap: var(--Size-5, 24px);
|
|
5
|
+
align-self: stretch;
|
|
6
|
+
flex-wrap: wrap;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.files-container {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
gap: var(--Size-3);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.card-list {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
align-items: flex-start;
|
|
19
|
+
gap: var(--Size-3);
|
|
20
|
+
align-self: stretch;
|
|
21
|
+
width: 100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.add-img {
|
|
25
|
+
display: flex;
|
|
26
|
+
height: 88px;
|
|
27
|
+
width: 88px;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
align-items: center;
|
|
31
|
+
gap: var(--Size-1, 4px);
|
|
32
|
+
align-self: stretch;
|
|
33
|
+
border-radius: var(--Border-2, 8px);
|
|
34
|
+
background: var(--Gray-Gray-50, #f7f8fa);
|
|
35
|
+
|
|
36
|
+
&:hover {
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
transform: scale(1.1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.icon {
|
|
42
|
+
display: flex;
|
|
43
|
+
width: 24px;
|
|
44
|
+
height: 24px;
|
|
45
|
+
padding: 4px;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
align-items: center;
|
|
48
|
+
flex-shrink: 0;
|
|
49
|
+
border-radius: var(--Border-3, 12px);
|
|
50
|
+
background: var(--Gray-Gray-100, #e6eaf2);
|
|
51
|
+
}
|
|
52
|
+
.text {
|
|
53
|
+
color: var(--Gray-600, #475066);
|
|
54
|
+
text-align: center;
|
|
55
|
+
font-size: 12px;
|
|
56
|
+
font-style: normal;
|
|
57
|
+
font-weight: 400;
|
|
58
|
+
line-height: 150%; /* 18px */
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { FileItem } from '../../../utilities/interfaces/ui/upload.model';
|
|
4
|
+
import { CardViewComponent } from '../card-view/card-view.component';
|
|
5
|
+
import { GridViewComponent } from '../grid-view/grid-view.component';
|
|
6
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
7
|
+
import { UploadFileService } from '@app/services/ui/upload-file.service';
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'app-file-list',
|
|
11
|
+
standalone: true,
|
|
12
|
+
imports: [CommonModule, CardViewComponent, GridViewComponent, TranslateModule],
|
|
13
|
+
templateUrl: './file-list.component.html',
|
|
14
|
+
styleUrls: ['./file-list.component.scss'],
|
|
15
|
+
})
|
|
16
|
+
export class FileListComponent implements OnChanges {
|
|
17
|
+
@Input() files: FileItem[];
|
|
18
|
+
@Input() onlyView: boolean;
|
|
19
|
+
@Input() previewType: 'card' | 'grid' = 'card';
|
|
20
|
+
@Input() maxFiles: number = 1;
|
|
21
|
+
@Input() addButton: boolean = true;
|
|
22
|
+
@Output() action = new EventEmitter<{
|
|
23
|
+
file: FileItem;
|
|
24
|
+
type: 'delete' | 'confirm-delete' | 'cancel-delete';
|
|
25
|
+
}>();
|
|
26
|
+
|
|
27
|
+
public cardFiles: FileItem[];
|
|
28
|
+
public gridFiles: FileItem[];
|
|
29
|
+
viewImageToDelete: boolean;
|
|
30
|
+
imageTodelete: FileItem;
|
|
31
|
+
imageCopyValue: FileItem;
|
|
32
|
+
|
|
33
|
+
constructor(private uploadFileService: UploadFileService) {}
|
|
34
|
+
|
|
35
|
+
ngOnChanges(changes: SimpleChanges) {
|
|
36
|
+
if (changes['files']) {
|
|
37
|
+
this.updateFileViews();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
private updateFileViews() {
|
|
42
|
+
this.cardFiles = [];
|
|
43
|
+
this.gridFiles = [];
|
|
44
|
+
|
|
45
|
+
this.files.forEach((file) => {
|
|
46
|
+
if (file.typeView === 'card') {
|
|
47
|
+
this.cardFiles.push(file);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
this.gridFiles.push(file);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
onChildAction(event: { file: FileItem; type: 'delete' | 'confirm-delete' | 'cancel-delete' }) {
|
|
55
|
+
this.action.emit(event);
|
|
56
|
+
}
|
|
57
|
+
onChildGridAction(event: { file: FileItem; type: 'delete' | 'confirm-delete' | 'cancel-delete' }) {
|
|
58
|
+
|
|
59
|
+
this.imageTodelete = {...event.file, state:'confirm-delete' };
|
|
60
|
+
this.viewImageToDelete = true;
|
|
61
|
+
this.imageCopyValue = event.file;
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
onDeleteCardAction(event: { file: FileItem; type: 'delete' | 'confirm-delete' | 'cancel-delete' }) {
|
|
66
|
+
console.log('event', event);
|
|
67
|
+
if(event.type == 'confirm-delete'){
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
this.action.emit({type:'confirm-delete', file: this.imageCopyValue});
|
|
71
|
+
this.viewImageToDelete = false;
|
|
72
|
+
this.imageCopyValue = null;
|
|
73
|
+
} else {
|
|
74
|
+
this.imageTodelete = null;
|
|
75
|
+
this.viewImageToDelete = false;
|
|
76
|
+
this.imageCopyValue = null;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
addImage() {
|
|
82
|
+
this.uploadFileService.triggerInput();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<div class="img-view" [ngClass]="[fileItem.state, getFileTypeClass(fileItem.file)]">
|
|
2
|
+
<!-- Imagen o ícono -->
|
|
3
|
+
|
|
4
|
+
<div class="preview-wrapper">
|
|
5
|
+
<div class="preview-container">
|
|
6
|
+
<img
|
|
7
|
+
[ngClass]="fileItem.state"
|
|
8
|
+
class="preview"
|
|
9
|
+
[src]="fileItem?.previewUrl || './assets/utils/template-no-image.png'"
|
|
10
|
+
alt="preview"
|
|
11
|
+
/>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<ng-container *ngIf="fileItem.state === 'complete'">
|
|
15
|
+
<div class="overlay-icon">
|
|
16
|
+
<svg
|
|
17
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
18
|
+
width="12"
|
|
19
|
+
height="12"
|
|
20
|
+
viewBox="0 0 12 12"
|
|
21
|
+
fill="none"
|
|
22
|
+
>
|
|
23
|
+
<g clip-path="url(#clip0_5064_216)">
|
|
24
|
+
<path
|
|
25
|
+
d="M11.1594 2.2155L4.24992 9.1245C4.20347 9.17114 4.14826 9.20815 4.08747 9.2334C4.02668 9.25865 3.9615 9.27165 3.89567 9.27165C3.82985 9.27165 3.76467 9.25865 3.70388 9.2334C3.64308 9.20815 3.58788 9.17114 3.54142 9.1245L0.869423 6.45C0.822969 6.40337 0.767762 6.36636 0.70697 6.34111C0.646179 6.31586 0.581 6.30286 0.515173 6.30286C0.449346 6.30286 0.384167 6.31586 0.323376 6.34111C0.262585 6.36636 0.207378 6.40337 0.160923 6.45C0.114285 6.49646 0.0772787 6.55167 0.0520278 6.61246C0.026777 6.67325 0.0137787 6.73843 0.0137787 6.80425C0.0137787 6.87008 0.026777 6.93526 0.0520278 6.99605C0.0772787 7.05684 0.114285 7.11205 0.160923 7.1585L2.83392 9.831C3.1159 10.1125 3.49802 10.2705 3.89642 10.2705C4.29482 10.2705 4.67695 10.1125 4.95892 9.831L11.8679 2.9235C11.9145 2.87706 11.9514 2.82188 11.9766 2.76114C12.0018 2.70039 12.0148 2.63527 12.0148 2.5695C12.0148 2.50374 12.0018 2.43862 11.9766 2.37787C11.9514 2.31713 11.9145 2.26195 11.8679 2.2155C11.8215 2.16887 11.7663 2.13186 11.7055 2.10661C11.6447 2.08136 11.5795 2.06836 11.5137 2.06836C11.4478 2.06836 11.3827 2.08136 11.3219 2.10661C11.2611 2.13186 11.2059 2.16887 11.1594 2.2155Z"
|
|
26
|
+
fill="#0ABB87"
|
|
27
|
+
/>
|
|
28
|
+
</g>
|
|
29
|
+
<defs>
|
|
30
|
+
<clipPath id="clip0_5064_216">
|
|
31
|
+
<rect width="12" height="12" fill="white" />
|
|
32
|
+
</clipPath>
|
|
33
|
+
</defs>
|
|
34
|
+
</svg>
|
|
35
|
+
</div>
|
|
36
|
+
</ng-container>
|
|
37
|
+
|
|
38
|
+
<div
|
|
39
|
+
(click)="onSendClick('confirm-delete')"
|
|
40
|
+
*ngIf="fileItem.state !== 'confirm-delete'"
|
|
41
|
+
class="delete"
|
|
42
|
+
>
|
|
43
|
+
<svg
|
|
44
|
+
width="32"
|
|
45
|
+
height="32"
|
|
46
|
+
viewBox="0 0 32 32"
|
|
47
|
+
fill="none"
|
|
48
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
49
|
+
>
|
|
50
|
+
<path
|
|
51
|
+
d="M8 0.5H24C28.1421 0.5 31.5 3.85786 31.5 8V24C31.5 28.1421 28.1421 31.5 24 31.5H8C3.85786 31.5 0.5 28.1421 0.5 24V8C0.5 3.85786 3.85786 0.5 8 0.5Z"
|
|
52
|
+
fill="white"
|
|
53
|
+
/>
|
|
54
|
+
<path
|
|
55
|
+
d="M8 0.5H24C28.1421 0.5 31.5 3.85786 31.5 8V24C31.5 28.1421 28.1421 31.5 24 31.5H8C3.85786 31.5 0.5 28.1421 0.5 24V8C0.5 3.85786 3.85786 0.5 8 0.5Z"
|
|
56
|
+
stroke="#F7F8FA"
|
|
57
|
+
/>
|
|
58
|
+
<path
|
|
59
|
+
d="M22.25 10.4445H20.0972C19.936 9.66072 19.5096 8.95651 18.8897 8.45052C18.2699 7.94453 17.4945 7.6677 16.6944 7.66669H15.3055C14.5054 7.6677 13.73 7.94453 13.1102 8.45052C12.4904 8.95651 12.0639 9.66072 11.9027 10.4445H9.74996C9.56578 10.4445 9.38914 10.5176 9.25891 10.6479C9.12868 10.7781 9.05551 10.9547 9.05551 11.1389C9.05551 11.3231 9.12868 11.4997 9.25891 11.63C9.38914 11.7602 9.56578 11.8334 9.74996 11.8334H10.4444V20.8611C10.4455 21.7817 10.8117 22.6642 11.4626 23.3151C12.1135 23.9661 12.9961 24.3323 13.9166 24.3334H18.0833C19.0038 24.3323 19.8864 23.9661 20.5373 23.3151C21.1882 22.6642 21.5544 21.7817 21.5555 20.8611V11.8334H22.25C22.4341 11.8334 22.6108 11.7602 22.741 11.63C22.8712 11.4997 22.9444 11.3231 22.9444 11.1389C22.9444 10.9547 22.8712 10.7781 22.741 10.6479C22.6108 10.5176 22.4341 10.4445 22.25 10.4445ZM15.3055 9.05558H16.6944C17.1251 9.0561 17.5452 9.18986 17.8969 9.43852C18.2486 9.68718 18.5148 10.0386 18.659 10.4445H13.3409C13.4851 10.0386 13.7513 9.68718 14.103 9.43852C14.4547 9.18986 14.8748 9.0561 15.3055 9.05558ZM20.1666 20.8611C20.1666 21.4137 19.9471 21.9436 19.5564 22.3343C19.1657 22.725 18.6358 22.9445 18.0833 22.9445H13.9166C13.3641 22.9445 12.8342 22.725 12.4435 22.3343C12.0528 21.9436 11.8333 21.4137 11.8333 20.8611V11.8334H20.1666V20.8611Z"
|
|
60
|
+
fill="#DE6061"
|
|
61
|
+
/>
|
|
62
|
+
<path
|
|
63
|
+
d="M14.6111 20.1662C14.7953 20.1662 14.9719 20.0931 15.1022 19.9628C15.2324 19.8326 15.3056 19.656 15.3056 19.4718V15.3051C15.3056 15.121 15.2324 14.9443 15.1022 14.8141C14.9719 14.6839 14.7953 14.6107 14.6111 14.6107C14.4269 14.6107 14.2503 14.6839 14.1201 14.8141C13.9898 14.9443 13.9167 15.121 13.9167 15.3051V19.4718C13.9167 19.656 13.9898 19.8326 14.1201 19.9628C14.2503 20.0931 14.4269 20.1662 14.6111 20.1662Z"
|
|
64
|
+
fill="#DE6061"
|
|
65
|
+
/>
|
|
66
|
+
<path
|
|
67
|
+
d="M17.3888 20.1662C17.573 20.1662 17.7496 20.0931 17.8799 19.9628C18.0101 19.8326 18.0833 19.656 18.0833 19.4718V15.3051C18.0833 15.121 18.0101 14.9443 17.8799 14.8141C17.7496 14.6839 17.573 14.6107 17.3888 14.6107C17.2046 14.6107 17.028 14.6839 16.8978 14.8141C16.7675 14.9443 16.6944 15.121 16.6944 15.3051V19.4718C16.6944 19.656 16.7675 19.8326 16.8978 19.9628C17.028 20.0931 17.2046 20.1662 17.3888 20.1662Z"
|
|
68
|
+
fill="#DE6061"
|
|
69
|
+
/>
|
|
70
|
+
</svg>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
<div class="progress-bar-container" *ngIf="fileItem.state === 'uploading'">
|
|
75
|
+
<div class="progress-bar" [style.width.%]="fileItem.progress"></div>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
.preview-wrapper {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: inline-block;
|
|
4
|
+
|
|
5
|
+
.preview {
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 100%;
|
|
8
|
+
object-fit: cover;
|
|
9
|
+
flex-shrink: 0;
|
|
10
|
+
|
|
11
|
+
&.uploading {
|
|
12
|
+
filter: blur(2px);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
.preview-container {
|
|
16
|
+
border-radius: var(--Border-2);
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 100%;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.overlay-icon {
|
|
23
|
+
position: absolute;
|
|
24
|
+
top: 50%;
|
|
25
|
+
left: 50%;
|
|
26
|
+
transform: translate(-50%, -50%);
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
display: flex;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
align-items: center;
|
|
31
|
+
flex-shrink: 0;
|
|
32
|
+
border-radius: var(--Border-3, 12px);
|
|
33
|
+
background: var(--White, #fff);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.delete {
|
|
37
|
+
position: absolute;
|
|
38
|
+
top: -12px;
|
|
39
|
+
right: -9px;
|
|
40
|
+
display: flex;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
align-items: center;
|
|
43
|
+
flex-shrink: 0;
|
|
44
|
+
border-radius: var(--Border-3, 12px);
|
|
45
|
+
background: var(--White, #fff);
|
|
46
|
+
&:hover {
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
transform: scale(1.1);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.img-view {
|
|
54
|
+
display: flex;
|
|
55
|
+
width: 88px;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
align-items: flex-start;
|
|
59
|
+
gap: var(--Size-2, 8px);
|
|
60
|
+
|
|
61
|
+
.preview-wrapper {
|
|
62
|
+
width: 88px;
|
|
63
|
+
height: 88px;
|
|
64
|
+
}
|
|
65
|
+
.overlay-icon {
|
|
66
|
+
width: 24px;
|
|
67
|
+
height: 24px;
|
|
68
|
+
padding: 6px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.progress-bar-container {
|
|
72
|
+
width: 100%;
|
|
73
|
+
height: 4px;
|
|
74
|
+
background-color: #f0f0f0;
|
|
75
|
+
border-radius: 4px;
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.progress-bar {
|
|
80
|
+
height: 100%;
|
|
81
|
+
border-radius: 4.5px;
|
|
82
|
+
background: var(--Primary-Primary-500);
|
|
83
|
+
transition: width 0.3s ease;
|
|
84
|
+
}
|
|
85
|
+
}
|