@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,18 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
Input,
|
|
4
|
+
OnInit,
|
|
5
|
+
CUSTOM_ELEMENTS_SCHEMA,
|
|
6
|
+
} from "@angular/core";
|
|
7
|
+
import { CommonModule } from "@angular/common";
|
|
5
8
|
|
|
6
9
|
@Component({
|
|
7
|
-
selector:
|
|
10
|
+
selector: "app-country-flags",
|
|
8
11
|
standalone: true,
|
|
9
12
|
imports: [CommonModule],
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
14
|
+
templateUrl: "./country-flags.component.html",
|
|
15
|
+
styleUrls: ["./country-flags.component.scss"],
|
|
12
16
|
})
|
|
13
|
-
export class CountryFlagsComponent {
|
|
14
|
-
@Input() country: string;
|
|
15
|
-
@Input()
|
|
16
|
-
@Input() height:
|
|
17
|
-
@Input()
|
|
17
|
+
export class CountryFlagsComponent implements OnInit {
|
|
18
|
+
@Input() public country: string = "";
|
|
19
|
+
@Input() public width: number = 24;
|
|
20
|
+
@Input() public height: number = 24;
|
|
21
|
+
@Input() public style: string = "rectangle";
|
|
22
|
+
|
|
23
|
+
public countries: any[] = [];
|
|
24
|
+
|
|
25
|
+
ngOnInit(): void {}
|
|
18
26
|
}
|
|
@@ -1,313 +1,53 @@
|
|
|
1
|
-
import { AnimationEvent } from '@angular/animations';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
1
|
import {
|
|
4
2
|
Component,
|
|
5
|
-
forwardRef,
|
|
6
3
|
Input,
|
|
7
4
|
Output,
|
|
8
5
|
EventEmitter,
|
|
9
|
-
ViewChild,
|
|
10
|
-
TemplateRef,
|
|
11
|
-
EmbeddedViewRef,
|
|
12
6
|
OnInit,
|
|
13
|
-
|
|
14
|
-
} from
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { IconComponent } from '../icon/icon.component';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Componente que renderiza un calendario para seleccionar fechas.
|
|
22
|
-
* Soporta la configuración de fechas mínima y máxima que se pueden seleccionar.
|
|
23
|
-
* Permite mostrar un título flotante sobre el componente de fecha y un texto placeholder.
|
|
24
|
-
* Emite eventos cuando se selecciona una nueva fecha y cuando se cierra el panel emergente del calendario.
|
|
25
|
-
* @example
|
|
26
|
-
* <app-date-picker [minDate]="new Date(2022, 0, 1)" [maxDate]="new Date(2022, 11, 31)"></app-date-picker>
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
interface FilterOption {
|
|
30
|
-
filter: string; // Texto descriptivo del filtro
|
|
31
|
-
value: string; // Valor técnico del filtro
|
|
32
|
-
group: string; // Grupo al que pertenece
|
|
33
|
-
}
|
|
34
|
-
type FilterGroup = Array<FilterOption>;
|
|
7
|
+
CUSTOM_ELEMENTS_SCHEMA,
|
|
8
|
+
} from "@angular/core";
|
|
9
|
+
import { CommonModule } from "@angular/common";
|
|
10
|
+
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
|
11
|
+
import { TranslateModule } from "@ngx-translate/core";
|
|
35
12
|
|
|
36
13
|
@Component({
|
|
37
|
-
selector:
|
|
14
|
+
selector: "app-date-picker",
|
|
38
15
|
standalone: true,
|
|
39
|
-
imports: [CommonModule,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
{
|
|
44
|
-
provide: NG_VALUE_ACCESSOR,
|
|
45
|
-
useExisting: forwardRef(() => DatePickerComponent),
|
|
46
|
-
multi: true,
|
|
47
|
-
},
|
|
48
|
-
],
|
|
16
|
+
imports: [CommonModule, FormsModule, ReactiveFormsModule, TranslateModule],
|
|
17
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
18
|
+
templateUrl: "./date-picker.component.html",
|
|
19
|
+
styleUrls: ["./date-picker.component.scss"],
|
|
49
20
|
})
|
|
50
21
|
export class DatePickerComponent implements OnInit {
|
|
51
|
-
@Input()
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
@Input()
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
@Input()
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
* <app-date-picker [loading]="true"/>
|
|
71
|
-
*/
|
|
72
|
-
@Input() loading: boolean = false;
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Establece la alineación del calendario emergente.
|
|
76
|
-
* Por defecto es false, lo que significa que el calendario se abrirá a la izquierda del input de fecha.
|
|
77
|
-
* Si se establece en true, el calendario se abrirá a la derecha del input de fecha.
|
|
78
|
-
* @example
|
|
79
|
-
* <app-date-picker [setRight]="true"/>
|
|
80
|
-
*/
|
|
81
|
-
@Input() setRight: boolean = false;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Establece un título flotante sobre el componente de fecha.
|
|
85
|
-
* @example
|
|
86
|
-
* <app-date-picker [label]="'Fecha de nacimiento'"/>
|
|
87
|
-
*/
|
|
88
|
-
@Input() label: string = null;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Texto que se mostrará en el input de fecha si no se ha seleccionado una fecha.
|
|
92
|
-
* Por defecto es null, lo que significa que se mostrará el texto "DD/MM/YYYY".
|
|
93
|
-
* @example
|
|
94
|
-
* <app-date-picker [placeholder]="'Seleccione una fecha'"/>
|
|
95
|
-
*/
|
|
96
|
-
@Input() placeholder: string = 'DD/MM/YYYY';
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Establece si el componente de fecha debe mostrar un icono de calendario.
|
|
100
|
-
* Por defecto es false.
|
|
101
|
-
* @example
|
|
102
|
-
* <app-date-picker [showIcon]="true"/>
|
|
103
|
-
*/
|
|
104
|
-
@Input() showIcon: boolean = false;
|
|
105
|
-
|
|
106
|
-
@Input() required: boolean = false;
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Indica si el componente debe mostrar un estado de error.
|
|
110
|
-
* Por defecto es false.
|
|
111
|
-
* @example
|
|
112
|
-
* <app-date-picker [isInvalid]="true"/>
|
|
113
|
-
*/
|
|
114
|
-
@Input() isInvalid: boolean = false;
|
|
115
|
-
|
|
116
|
-
// Indica si el componente debe estar deshabilitado.
|
|
117
|
-
@Input() disabled: boolean = false;
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Indica si el componente debe mostrar un estado de error.
|
|
121
|
-
* Por defecto es false.
|
|
122
|
-
* @example
|
|
123
|
-
* <app-date-picker [isInvalid]="true"/>
|
|
124
|
-
*/
|
|
125
|
-
@Input() selectionMode: string = 'single';
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Indica si el componente debe mostrar un estado de error.
|
|
129
|
-
* Por defecto es false.
|
|
130
|
-
* @example
|
|
131
|
-
* <app-date-picker [isInvalid]="true"/>
|
|
132
|
-
*/
|
|
133
|
-
@Input() filters: FilterGroup[] = [];
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Evento que se dispara cuando se selecciona una nueva fecha.
|
|
137
|
-
* @example
|
|
138
|
-
* <app-date-picker (onChangeDate)="onChangeDate($event)"/>
|
|
139
|
-
*/
|
|
140
|
-
@Output() onChangeDate = new EventEmitter<Date>();
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Emite un evento cuando se cierra el panel emergente del calendario.
|
|
144
|
-
* El evento emitido contiene la animación que se está ejecutando en el momento de cerrar el panel.
|
|
145
|
-
* @example
|
|
146
|
-
* <app-date-picker (onClosePanel)="onClosePanel($event)"/>
|
|
147
|
-
*/
|
|
148
|
-
@Output() onClosePanel = new EventEmitter<AnimationEvent>();
|
|
149
|
-
|
|
150
|
-
@Output() sendFilters = new EventEmitter<FilterOption>();
|
|
151
|
-
/**
|
|
152
|
-
* Define la fecha preseleccionada ( en caso de que cuando lo utilices, ya tengas una fecha estipulada)
|
|
153
|
-
* Por defecto es null.
|
|
154
|
-
* @example
|
|
155
|
-
* <app-date-picker [selectedDate]="new Date(2022, 11, 31)"/>
|
|
156
|
-
*/
|
|
157
|
-
private _selectedDate: Date | Date[] = new Date();
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Verifica si una fecha es válida
|
|
161
|
-
* @param date Fecha a validar
|
|
162
|
-
* @returns true si la fecha es válida, false en caso contrario
|
|
163
|
-
*/
|
|
164
|
-
private isValidDate(date: Date): boolean {
|
|
165
|
-
return date instanceof Date && !isNaN(date.getTime());
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
@Input() set selectedDate(value: any) {
|
|
169
|
-
if (!this.selectionMode || this.selectionMode !== 'range') {
|
|
170
|
-
if (value === undefined || value === null || value === '' || value === 'Invalid Date') {
|
|
171
|
-
this._selectedDate = null;
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
const parsedDate = new Date(value);
|
|
175
|
-
// Solo asignar si la fecha es válida
|
|
176
|
-
this._selectedDate = this.isValidDate(parsedDate) ? parsedDate : null;
|
|
177
|
-
} else if (this.selectionMode === 'range') {
|
|
178
|
-
if (value === undefined || value === null || value === '' || value === 'Invalid Date') {
|
|
179
|
-
this._selectedDate = [];
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
// Asegurar que value sea un array para el rango
|
|
183
|
-
if (Array.isArray(value)) {
|
|
184
|
-
this._selectedDate = value.map((date) => {
|
|
185
|
-
if (!date || date === 'Invalid Date') return null;
|
|
186
|
-
const parsedDate = new Date(date);
|
|
187
|
-
return this.isValidDate(parsedDate) ? parsedDate : null;
|
|
188
|
-
});
|
|
189
|
-
} else {
|
|
190
|
-
// Si no es un array, crear un rango con la misma fecha en ambos extremos
|
|
191
|
-
const date = new Date(value);
|
|
192
|
-
if (this.isValidDate(date)) {
|
|
193
|
-
this._selectedDate = [date, date];
|
|
194
|
-
} else {
|
|
195
|
-
this._selectedDate = [];
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
@ViewChild('filtersTemplate') filtersTemplate!: TemplateRef<any>;
|
|
202
|
-
private filtersViewRef: EmbeddedViewRef<any> | null = null;
|
|
203
|
-
|
|
204
|
-
get selectedDate(): Date | Date[] {
|
|
205
|
-
// Tipo ajustado para coincidir con el setter
|
|
206
|
-
return this._selectedDate;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
isDateView = true;
|
|
210
|
-
activeRangeIndex: number | null = null;
|
|
211
|
-
isSelectedFilter: boolean = false;
|
|
212
|
-
|
|
213
|
-
onChange: any = () => {};
|
|
214
|
-
onTouch: any = () => {};
|
|
215
|
-
|
|
216
|
-
constructor(private zone: NgZone) {}
|
|
22
|
+
@Input() public label: string | null = null;
|
|
23
|
+
@Input() public required: boolean = false;
|
|
24
|
+
@Input() public selectedDate: any = new Date();
|
|
25
|
+
@Input() public minDate: any;
|
|
26
|
+
@Input() public maxDate: any;
|
|
27
|
+
@Input() public showIcon: boolean = false;
|
|
28
|
+
@Input() public showTime: boolean = false;
|
|
29
|
+
@Input() public loading: boolean = false;
|
|
30
|
+
@Input() public isInvalid: boolean = false;
|
|
31
|
+
@Input() public placeholder: string = "DD/MM/YYYY";
|
|
32
|
+
@Input() public disabled: boolean = false;
|
|
33
|
+
@Input() public selectionMode: string = "single";
|
|
34
|
+
@Input() public setRight: boolean = false;
|
|
35
|
+
@Input() public filters: any[] = [];
|
|
36
|
+
|
|
37
|
+
@Output() public onChangeDate = new EventEmitter<any>();
|
|
38
|
+
@Output() public onClosePanel = new EventEmitter<any>();
|
|
39
|
+
|
|
40
|
+
constructor() {}
|
|
217
41
|
|
|
218
42
|
ngOnInit(): void {}
|
|
219
43
|
|
|
220
|
-
|
|
221
|
-
this.onChange = fn;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
registerOnTouched(fn: any): void {
|
|
225
|
-
this.onTouch = fn;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
onSelect(event: Date) {
|
|
44
|
+
public onSelect(event: any): void {
|
|
229
45
|
this.onChangeDate.emit(event);
|
|
230
|
-
|
|
231
|
-
this.onTouch();
|
|
232
46
|
}
|
|
233
47
|
|
|
234
|
-
onClose(event:
|
|
48
|
+
public onClose(event: any): void {
|
|
235
49
|
this.onClosePanel.emit(event);
|
|
236
50
|
}
|
|
237
51
|
|
|
238
|
-
|
|
239
|
-
// Usar el setter que ya tiene validación de fechas inválidas
|
|
240
|
-
this.selectedDate = value;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
onCalendarOpen(event: any) {
|
|
244
|
-
if (this.filters.length > 0) {
|
|
245
|
-
const overlay = document.querySelector('.p-datepicker') as HTMLElement;
|
|
246
|
-
|
|
247
|
-
if (overlay) {
|
|
248
|
-
overlay.style.display = 'flex';
|
|
249
|
-
overlay.style.flexDirection = 'row';
|
|
250
|
-
overlay.style.alignItems = 'flex-start';
|
|
251
|
-
overlay.style.justifyContent = 'space-between';
|
|
252
|
-
overlay.style.gap = '1rem';
|
|
253
|
-
|
|
254
|
-
let filtersDiv = overlay.querySelector('.custom-filters') as HTMLElement;
|
|
255
|
-
if (!filtersDiv) {
|
|
256
|
-
filtersDiv = document.createElement('div');
|
|
257
|
-
filtersDiv.classList.add('custom-filters');
|
|
258
|
-
this.buildFilters(filtersDiv);
|
|
259
|
-
overlay.appendChild(filtersDiv);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
// 👉 Observa cambios en el calendario
|
|
263
|
-
const observer = new MutationObserver(() => {
|
|
264
|
-
const isMonthPicker = !!overlay.querySelector('.p-monthpicker');
|
|
265
|
-
const isYearPicker = !!overlay.querySelector('.p-yearpicker');
|
|
266
|
-
|
|
267
|
-
if (isMonthPicker || isYearPicker) {
|
|
268
|
-
filtersDiv.style.display = 'none';
|
|
269
|
-
} else {
|
|
270
|
-
filtersDiv.style.display = 'block';
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
observer.observe(overlay, { childList: true, subtree: true });
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
// Método auxiliar
|
|
280
|
-
private buildFilters(filtersDiv: HTMLElement) {
|
|
281
|
-
this.filters.forEach((group) => {
|
|
282
|
-
let groupDiv = document.createElement('div');
|
|
283
|
-
groupDiv.classList.add('filtros');
|
|
284
|
-
|
|
285
|
-
let title = document.createElement('div');
|
|
286
|
-
title.classList.add('title-header');
|
|
287
|
-
title.textContent = group[0].group;
|
|
288
|
-
groupDiv.appendChild(title);
|
|
289
|
-
|
|
290
|
-
group.forEach((f) => {
|
|
291
|
-
let btn = document.createElement('button');
|
|
292
|
-
btn.textContent = f.filter;
|
|
293
|
-
btn.classList.add('filter-btn');
|
|
294
|
-
|
|
295
|
-
btn.addEventListener('click', () => {
|
|
296
|
-
this.zone.run(() => {
|
|
297
|
-
groupDiv.querySelectorAll('.filter-btn').forEach((b) => b.classList.remove('selected'));
|
|
298
|
-
btn.classList.add('selected');
|
|
299
|
-
this.sendFilters.emit(f);
|
|
300
|
-
});
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
groupDiv.appendChild(btn);
|
|
304
|
-
});
|
|
305
|
-
|
|
306
|
-
filtersDiv.appendChild(groupDiv);
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
ditributeFilters() {
|
|
311
|
-
this.filters;
|
|
312
|
-
}
|
|
52
|
+
public onCalendarOpen(event: any): void {}
|
|
313
53
|
}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
<div
|
|
2
|
-
|
|
1
|
+
<div
|
|
2
|
+
[ngClass]="setRight ? '' : 'calendar-left'"
|
|
3
|
+
class="date-picker-range"
|
|
4
|
+
*ngIf="!loading"
|
|
5
|
+
>
|
|
6
|
+
<div *ngIf="showLabel" class="label">{{ "date range" | translate }}</div>
|
|
3
7
|
<p-calendar
|
|
4
8
|
#calendarInputRef
|
|
5
9
|
class="date-picker-input"
|
|
6
|
-
[panelStyleClass]="
|
|
10
|
+
[panelStyleClass]="
|
|
11
|
+
setRight ? 'dropi-custom-calendar' : 'dropi-custom-calendar calendar-left'
|
|
12
|
+
"
|
|
7
13
|
[ngClass]="{ 'date-picker-input--open': loading }"
|
|
8
14
|
[(ngModel)]="dateRange"
|
|
9
15
|
selectionMode="range"
|
|
@@ -25,15 +31,17 @@
|
|
|
25
31
|
<ng-template *ngIf="CalendarTypeView === null" pTemplate="header">
|
|
26
32
|
<div class="custom-header">
|
|
27
33
|
<button
|
|
28
|
-
pButton
|
|
29
34
|
*ngFor="let range of ranges; let i = index"
|
|
30
35
|
(click)="selectRange(range, i)"
|
|
31
|
-
label="{{ range.label |translate}}"
|
|
32
36
|
class="p-button-text"
|
|
33
37
|
[ngClass]="{ active: i === activeRangeIndex }"
|
|
34
|
-
|
|
38
|
+
>
|
|
39
|
+
{{ range.label | translate }}
|
|
40
|
+
</button>
|
|
35
41
|
<div *ngIf="viewRangeWarning" class="warning-box">
|
|
36
|
-
<span class="warning-message"
|
|
42
|
+
<span class="warning-message"
|
|
43
|
+
>Solo puedes filtrar en un rango máximo de 90 días.</span
|
|
44
|
+
>
|
|
37
45
|
</div>
|
|
38
46
|
</div>
|
|
39
47
|
</ng-template>
|