@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,392 +1,76 @@
|
|
|
1
1
|
import {
|
|
2
|
-
AfterContentInit,
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
ChangeDetectorRef,
|
|
5
2
|
Component,
|
|
6
|
-
ContentChildren,
|
|
7
|
-
EventEmitter,
|
|
8
|
-
HostListener,
|
|
9
3
|
Input,
|
|
10
|
-
OnChanges,
|
|
11
|
-
OnDestroy,
|
|
12
4
|
Output,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
ViewEncapsulation,
|
|
19
|
-
} from '@angular/core';
|
|
20
|
-
import { CommonModule } from '@angular/common';
|
|
21
|
-
import { Subscription } from 'rxjs';
|
|
22
|
-
import { Overlay, OverlayModule, OverlayRef } from '@angular/cdk/overlay';
|
|
23
|
-
import { PortalModule, TemplatePortal } from '@angular/cdk/portal';
|
|
24
|
-
|
|
25
|
-
import { PTemplateDirective } from './p-template.directive';
|
|
26
|
-
import { DropiModalStackService } from './dropi-modal-stack.service';
|
|
27
|
-
|
|
28
|
-
type DropiTemplateType = 'header' | 'content' | 'footer';
|
|
5
|
+
EventEmitter,
|
|
6
|
+
OnInit,
|
|
7
|
+
CUSTOM_ELEMENTS_SCHEMA,
|
|
8
|
+
} from "@angular/core";
|
|
9
|
+
import { CommonModule } from "@angular/common";
|
|
29
10
|
|
|
30
11
|
@Component({
|
|
31
|
-
selector:
|
|
12
|
+
selector: "dropi-modal",
|
|
32
13
|
standalone: true,
|
|
33
|
-
imports: [CommonModule
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
14
|
+
imports: [CommonModule],
|
|
15
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
16
|
+
templateUrl: "./dropi-modal.component.html",
|
|
17
|
+
styleUrls: ["./dropi-modal.component.scss"],
|
|
38
18
|
})
|
|
39
|
-
export class DropiModalComponent implements
|
|
40
|
-
@Input() visible = false;
|
|
41
|
-
@
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
@Input()
|
|
45
|
-
@Input()
|
|
46
|
-
@Input()
|
|
47
|
-
@Input()
|
|
48
|
-
@Input()
|
|
49
|
-
|
|
50
|
-
@Input()
|
|
51
|
-
|
|
52
|
-
@
|
|
53
|
-
|
|
54
|
-
@
|
|
55
|
-
@
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
@Input() maxWidth: string | null = null;
|
|
74
|
-
|
|
75
|
-
@Output() onHide = new EventEmitter<void>();
|
|
76
|
-
@Output() onShow = new EventEmitter<void>();
|
|
77
|
-
|
|
78
|
-
@ContentChildren(PTemplateDirective) private readonly templates!: QueryList<PTemplateDirective>;
|
|
79
|
-
|
|
80
|
-
@ViewChild('overlayTpl', { read: TemplateRef })
|
|
81
|
-
private readonly overlayTpl!: TemplateRef<unknown>;
|
|
82
|
-
|
|
83
|
-
headerTemplate: TemplateRef<unknown> | null = null;
|
|
84
|
-
contentTemplate: TemplateRef<unknown> | null = null;
|
|
85
|
-
footerTemplate: TemplateRef<unknown> | null = null;
|
|
86
|
-
|
|
87
|
-
maskZIndex = 1100;
|
|
88
|
-
panelZIndex = 1101;
|
|
89
|
-
|
|
90
|
-
isOpen = false;
|
|
91
|
-
isClosing = false;
|
|
92
|
-
|
|
93
|
-
private readonly id = `dropi-modal-${Math.random().toString(36).slice(2)}`;
|
|
94
|
-
private isRegistered = false;
|
|
95
|
-
private overlayRef: OverlayRef | null = null;
|
|
96
|
-
private portal: TemplatePortal | null = null;
|
|
97
|
-
private closeTimeoutId: number | null = null;
|
|
98
|
-
private pendingOnHideEmit = false;
|
|
99
|
-
|
|
100
|
-
private readonly subscriptions = new Subscription();
|
|
101
|
-
|
|
102
|
-
constructor(
|
|
103
|
-
private readonly stack: DropiModalStackService,
|
|
104
|
-
private readonly cdr: ChangeDetectorRef,
|
|
105
|
-
private readonly overlay: Overlay,
|
|
106
|
-
private readonly viewContainerRef: ViewContainerRef,
|
|
107
|
-
) {}
|
|
108
|
-
|
|
109
|
-
get panelClass(): string {
|
|
110
|
-
const base = 'dropi-modal__panel';
|
|
111
|
-
const extra = (this.styleClass ?? '').trim();
|
|
112
|
-
return extra ? `${base} ${extra}` : base;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
get rootPositionClass(): string {
|
|
116
|
-
return `dropi-modal-root--${this.position}`;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
get rootClasses(): string[] {
|
|
120
|
-
const classes = ['dropi-modal-root', this.rootPositionClass];
|
|
121
|
-
|
|
122
|
-
if (this.isOpen) {
|
|
123
|
-
classes.push('dropi-modal-root--open');
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (this.isClosing) {
|
|
127
|
-
classes.push('dropi-modal-root--closing');
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return classes;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
ngAfterContentInit(): void {
|
|
134
|
-
this.resolveTemplates();
|
|
135
|
-
|
|
136
|
-
this.subscriptions.add(
|
|
137
|
-
this.templates.changes.subscribe(() => {
|
|
138
|
-
this.resolveTemplates();
|
|
139
|
-
this.cdr.markForCheck();
|
|
140
|
-
}),
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
this.cdr.markForCheck();
|
|
144
|
-
|
|
145
|
-
if (this.visible) {
|
|
146
|
-
this.show();
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
ngOnChanges(changes: SimpleChanges): void {
|
|
151
|
-
if (changes['closable']) {
|
|
152
|
-
this.showCloseIcon = this.closable;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (changes['visible']) {
|
|
156
|
-
if (this.visible) {
|
|
157
|
-
this.show();
|
|
158
|
-
queueMicrotask(() => this.onShow.emit());
|
|
159
|
-
} else {
|
|
160
|
-
// Cierre con animación: esperar a terminar antes de detach/unregister.
|
|
161
|
-
this.pendingOnHideEmit = true;
|
|
162
|
-
this.startClose();
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
if (changes['baseZIndex'] && this.visible) {
|
|
167
|
-
this.syncZIndex();
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
ngOnDestroy(): void {
|
|
172
|
-
this.subscriptions.unsubscribe();
|
|
173
|
-
this.clearCloseTimer();
|
|
174
|
-
this.detachFromBody(true);
|
|
175
|
-
this.unregister();
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
hide(): void {
|
|
19
|
+
export class DropiModalComponent implements OnInit {
|
|
20
|
+
@Input() public visible: boolean = false;
|
|
21
|
+
@Input() public modal: boolean = true;
|
|
22
|
+
@Input() public dismissableMask: boolean = true;
|
|
23
|
+
@Input() public closeOnEscape: boolean = true;
|
|
24
|
+
@Input() public showCloseIcon: boolean = true;
|
|
25
|
+
@Input() public showHeader: boolean = true;
|
|
26
|
+
@Input() public header: string | null = null;
|
|
27
|
+
@Input() public styleClass: string | null = null;
|
|
28
|
+
@Input() public maxWidth: string | null = null;
|
|
29
|
+
@Input() public position: string = "center";
|
|
30
|
+
@Input() public transitionOptions: string = "0.15s";
|
|
31
|
+
|
|
32
|
+
@Output() public visibleChange = new EventEmitter<boolean>();
|
|
33
|
+
@Output() public onHide = new EventEmitter<void>();
|
|
34
|
+
@Output() public onShow = new EventEmitter<void>();
|
|
35
|
+
@Output() public onClose = new EventEmitter<void>();
|
|
36
|
+
|
|
37
|
+
// Propiedades requeridas por el template
|
|
38
|
+
public rootClasses: string[] = [];
|
|
39
|
+
public maskZIndex: number = 1100;
|
|
40
|
+
public panelZIndex: number = 1101;
|
|
41
|
+
public panelClass: string = "dropi-modal__panel";
|
|
42
|
+
public headerTemplate: any = null;
|
|
43
|
+
public contentTemplate: any = null;
|
|
44
|
+
public footerTemplate: any = null;
|
|
45
|
+
|
|
46
|
+
constructor() {}
|
|
47
|
+
|
|
48
|
+
ngOnInit(): void {
|
|
49
|
+
this.updateClasses();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public hide(): void {
|
|
179
53
|
this.visible = false;
|
|
180
54
|
this.visibleChange.emit(false);
|
|
181
|
-
this.
|
|
182
|
-
this.
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
private show(): void {
|
|
186
|
-
this.attachToBody();
|
|
187
|
-
this.registerAndSyncZIndex();
|
|
188
|
-
|
|
189
|
-
// Si attachToBody se difirió (overlayTpl no listo), no continuar aún.
|
|
190
|
-
// La microtarea agendada en attachToBody volverá a llamar a show.
|
|
191
|
-
if (!this.overlayRef?.hasAttached()) {
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
this.isClosing = false;
|
|
196
|
-
this.isOpen = false;
|
|
197
|
-
this.clearCloseTimer();
|
|
198
|
-
this.cdr.markForCheck();
|
|
199
|
-
|
|
200
|
-
// Usar doble rAF para garantizar que el DOM se haya pintado con el estado inicial
|
|
201
|
-
// antes de activar la clase "open" y disparar la animación.
|
|
202
|
-
requestAnimationFrame(() => {
|
|
203
|
-
requestAnimationFrame(() => {
|
|
204
|
-
this.isOpen = true;
|
|
205
|
-
this.cdr.markForCheck();
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
onMaskClick(event: MouseEvent): void {
|
|
211
|
-
event.stopPropagation();
|
|
212
|
-
|
|
213
|
-
if (!this.modal) {
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
if (!this.dismissible || !this.dismissableMask) {
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
this.hide();
|
|
55
|
+
this.onHide.emit();
|
|
56
|
+
this.onClose.emit();
|
|
222
57
|
}
|
|
223
58
|
|
|
224
|
-
|
|
225
|
-
onEscape(event: KeyboardEvent): void {
|
|
226
|
-
if (!this.visible) {
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
if (!this.closeOnEscape || !this.dismissible) {
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
event.preventDefault();
|
|
59
|
+
public close(): void {
|
|
235
60
|
this.hide();
|
|
236
61
|
}
|
|
237
62
|
|
|
238
|
-
|
|
239
|
-
if (
|
|
240
|
-
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
const templateByType = new Map<DropiTemplateType, TemplateRef<unknown>>();
|
|
244
|
-
|
|
245
|
-
for (const entry of this.templates.toArray()) {
|
|
246
|
-
const type = (entry.type ?? '') as DropiTemplateType;
|
|
247
|
-
if (type === 'header' || type === 'content' || type === 'footer') {
|
|
248
|
-
templateByType.set(type, entry.template);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
this.headerTemplate = templateByType.get('header') ?? null;
|
|
253
|
-
this.contentTemplate = templateByType.get('content') ?? null;
|
|
254
|
-
this.footerTemplate = templateByType.get('footer') ?? null;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
private registerAndSyncZIndex(): void {
|
|
258
|
-
if (!this.autoZIndex) {
|
|
259
|
-
this.maskZIndex = this.baseZIndex;
|
|
260
|
-
this.panelZIndex = this.baseZIndex + 1;
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
if (!this.isRegistered) {
|
|
265
|
-
this.stack.register({
|
|
266
|
-
id: this.id,
|
|
267
|
-
baseZIndex: this.baseZIndex,
|
|
268
|
-
blockScroll: this.blockScroll,
|
|
269
|
-
});
|
|
270
|
-
this.isRegistered = true;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
this.syncZIndex();
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
private startClose(): void {
|
|
277
|
-
if (!this.overlayRef?.hasAttached()) {
|
|
278
|
-
// Nada montado; asegurar cleanup.
|
|
279
|
-
this.unregister();
|
|
280
|
-
if (this.pendingOnHideEmit) {
|
|
281
|
-
this.pendingOnHideEmit = false;
|
|
282
|
-
this.onHide.emit();
|
|
283
|
-
}
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
if (this.isClosing) {
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
this.isClosing = true;
|
|
292
|
-
// Mantener "open" para que la animación de salida parta desde visible.
|
|
293
|
-
this.isOpen = true;
|
|
294
|
-
this.cdr.markForCheck();
|
|
295
|
-
|
|
296
|
-
const durationMs = this.parseTransitionToMs(this.transitionOptions);
|
|
297
|
-
|
|
298
|
-
this.clearCloseTimer();
|
|
299
|
-
this.closeTimeoutId = window.setTimeout(() => {
|
|
300
|
-
this.detachFromBody();
|
|
301
|
-
this.unregister();
|
|
302
|
-
this.isClosing = false;
|
|
303
|
-
this.isOpen = false;
|
|
304
|
-
this.cdr.markForCheck();
|
|
305
|
-
|
|
306
|
-
if (this.pendingOnHideEmit) {
|
|
307
|
-
this.pendingOnHideEmit = false;
|
|
308
|
-
this.onHide.emit();
|
|
309
|
-
}
|
|
310
|
-
}, durationMs);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
private attachToBody(): void {
|
|
314
|
-
if (!this.overlayTpl) {
|
|
315
|
-
// Por si el ciclo de vida aún no creó el TemplateRef.
|
|
316
|
-
queueMicrotask(() => this.show());
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
if (!this.overlayRef) {
|
|
321
|
-
const positionStrategy = this.overlay.position().global().top('0').left('0');
|
|
322
|
-
|
|
323
|
-
this.overlayRef = this.overlay.create({
|
|
324
|
-
positionStrategy,
|
|
325
|
-
hasBackdrop: false,
|
|
326
|
-
scrollStrategy: this.overlay.scrollStrategies.noop(),
|
|
327
|
-
disposeOnNavigation: true,
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
if (!this.portal) {
|
|
332
|
-
this.portal = new TemplatePortal(this.overlayTpl, this.viewContainerRef);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
if (!this.overlayRef.hasAttached()) {
|
|
336
|
-
this.overlayRef.attach(this.portal);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
private detachFromBody(dispose = false): void {
|
|
341
|
-
if (this.overlayRef?.hasAttached()) {
|
|
342
|
-
this.overlayRef.detach();
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
if (dispose) {
|
|
346
|
-
this.overlayRef?.dispose();
|
|
347
|
-
this.overlayRef = null;
|
|
348
|
-
this.portal = null;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
private clearCloseTimer(): void {
|
|
353
|
-
if (this.closeTimeoutId === null) {
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
window.clearTimeout(this.closeTimeoutId);
|
|
358
|
-
this.closeTimeoutId = null;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
private parseTransitionToMs(value: string | null | undefined): number {
|
|
362
|
-
const raw = (value ?? '').trim();
|
|
363
|
-
// Acepta '150ms', '0.2s' o strings que contengan tiempos (ej: '0.2s ease').
|
|
364
|
-
const match = raw.match(/(\d*\.?\d+)\s*(ms|s)\b/i);
|
|
365
|
-
if (!match) {
|
|
366
|
-
return 150;
|
|
63
|
+
public onMaskClick(event: any): void {
|
|
64
|
+
if (this.dismissableMask) {
|
|
65
|
+
this.hide();
|
|
367
66
|
}
|
|
368
|
-
|
|
369
|
-
const amount = Number(match[1]);
|
|
370
|
-
if (!Number.isFinite(amount)) {
|
|
371
|
-
return 150;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
const unit = match[2].toLowerCase();
|
|
375
|
-
return unit === 's' ? Math.round(amount * 1000) : Math.round(amount);
|
|
376
67
|
}
|
|
377
68
|
|
|
378
|
-
private
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
private unregister(): void {
|
|
385
|
-
if (!this.isRegistered) {
|
|
386
|
-
return;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
this.stack.unregister(this.id);
|
|
390
|
-
this.isRegistered = false;
|
|
69
|
+
private updateClasses(): void {
|
|
70
|
+
this.rootClasses = [
|
|
71
|
+
"dropi-modal-root",
|
|
72
|
+
`dropi-modal-root--${this.position}`,
|
|
73
|
+
];
|
|
74
|
+
if (this.visible) this.rootClasses.push("dropi-modal-root--open");
|
|
391
75
|
}
|
|
392
76
|
}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { CommonModule } from
|
|
2
|
-
import { Component, Input, OnInit, Output, EventEmitter } from
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
} from '@app/utilities/interfaces/ui/dropi-table.interface';
|
|
1
|
+
import { CommonModule } from "@angular/common";
|
|
2
|
+
import { Component, Input, OnInit, Output, EventEmitter } from "@angular/core";
|
|
3
|
+
// import {
|
|
4
|
+
// DropiTableRow,
|
|
5
|
+
// } from '@app/utilities/interfaces/ui/dropi-table.interface';
|
|
6
|
+
type DropiTableRow = any;
|
|
6
7
|
|
|
7
8
|
@Component({
|
|
8
|
-
selector:
|
|
9
|
-
templateUrl:
|
|
10
|
-
styleUrls: [
|
|
11
|
-
imports: [
|
|
12
|
-
standalone: true
|
|
9
|
+
selector: "app-dropi-navbar",
|
|
10
|
+
templateUrl: "./dropi-navbar.component.html",
|
|
11
|
+
styleUrls: ["./dropi-navbar.component.scss"],
|
|
12
|
+
imports: [CommonModule],
|
|
13
|
+
standalone: true,
|
|
13
14
|
})
|
|
14
15
|
export class DropiNavBarComponent implements OnInit {
|
|
15
|
-
@Input() public data: DropiTableRow[] = [];
|
|
16
|
+
@Input() public data: DropiTableRow[] = [];
|
|
16
17
|
@Input() public title: string = "";
|
|
17
|
-
@Output() clickLoadItem = new EventEmitter<{ item: any
|
|
18
|
+
@Output() clickLoadItem = new EventEmitter<{ item: any }>();
|
|
18
19
|
sidebarItems: any[] = [];
|
|
19
20
|
activeItem: any;
|
|
20
21
|
isLoading: boolean = true;
|
|
@@ -29,9 +30,9 @@ export class DropiNavBarComponent implements OnInit {
|
|
|
29
30
|
|
|
30
31
|
private updateSidebarItems(): void {
|
|
31
32
|
if (this.data && this.data.length > 0) {
|
|
32
|
-
this.sidebarItems = this.data.map(item => ({
|
|
33
|
+
this.sidebarItems = this.data.map((item) => ({
|
|
33
34
|
...item,
|
|
34
|
-
expanded: false
|
|
35
|
+
expanded: false,
|
|
35
36
|
}));
|
|
36
37
|
} else {
|
|
37
38
|
}
|
|
@@ -39,14 +40,13 @@ export class DropiNavBarComponent implements OnInit {
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
handleItemClick(item: any): void {
|
|
42
|
-
|
|
43
43
|
if (item.children && item.children.length > 0) {
|
|
44
44
|
item.expanded = !item.expanded;
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
this.activeItem = item;
|
|
48
48
|
if (!item.children) {
|
|
49
49
|
this.clickLoadItem.emit(item);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
}
|
|
52
|
+
}
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
(click)="goToFirstPage()"
|
|
9
9
|
aria-label="Anterior"
|
|
10
10
|
>
|
|
11
|
-
<app-icon
|
|
11
|
+
<app-icon
|
|
12
|
+
[name]="'Arrow-double-small-left'"
|
|
13
|
+
[width]="'16'"
|
|
14
|
+
[height]="'16'"
|
|
15
|
+
/>
|
|
12
16
|
</button>
|
|
13
17
|
<button
|
|
14
18
|
*ngIf="currentPage !== 1"
|
|
@@ -18,8 +22,8 @@
|
|
|
18
22
|
(click)="prevPage()"
|
|
19
23
|
aria-label="Anterior"
|
|
20
24
|
>
|
|
21
|
-
<app-icon [name]="'Dropdown-left'" [width]="16" [height]="16" />
|
|
22
|
-
{{
|
|
25
|
+
<app-icon [name]="'Dropdown-left'" [width]="'16'" [height]="'16'" />
|
|
26
|
+
{{ "Previous" | translate }}
|
|
23
27
|
</button>
|
|
24
28
|
|
|
25
29
|
<ng-container *ngIf="!isNotTotalPages">
|
|
@@ -41,15 +45,18 @@
|
|
|
41
45
|
</ng-container>
|
|
42
46
|
|
|
43
47
|
<button
|
|
44
|
-
*ngIf="
|
|
48
|
+
*ngIf="
|
|
49
|
+
currentPage !== totalPages ||
|
|
50
|
+
(isNotTotalPages && currentPage < totalPages)
|
|
51
|
+
"
|
|
45
52
|
class="page-item next"
|
|
46
53
|
[ngClass]="{ nextCursor: isNotTotalPages }"
|
|
47
54
|
[disabled]="disabled || currentPage === totalPages"
|
|
48
55
|
(click)="nextPage()"
|
|
49
56
|
aria-label="Siguiente"
|
|
50
57
|
>
|
|
51
|
-
{{
|
|
52
|
-
<app-icon [name]="'Dropdown-Right'" [width]="16" [height]="16" />
|
|
58
|
+
{{ "Next" | translate }}
|
|
59
|
+
<app-icon [name]="'Dropdown-Right'" [width]="'16'" [height]="'16'" />
|
|
53
60
|
</button>
|
|
54
61
|
|
|
55
62
|
<button
|
|
@@ -59,6 +66,10 @@
|
|
|
59
66
|
(click)="goToLastPage()"
|
|
60
67
|
aria-label="Siguiente"
|
|
61
68
|
>
|
|
62
|
-
<app-icon
|
|
69
|
+
<app-icon
|
|
70
|
+
[name]="'Arrow-double-small-right'"
|
|
71
|
+
[width]="'16'"
|
|
72
|
+
[height]="'16'"
|
|
73
|
+
/>
|
|
63
74
|
</button>
|
|
64
75
|
</div>
|
|
@@ -1,38 +1,53 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
Input,
|
|
4
|
+
Output,
|
|
5
|
+
EventEmitter,
|
|
6
|
+
OnInit,
|
|
7
|
+
OnChanges,
|
|
8
|
+
CUSTOM_ELEMENTS_SCHEMA,
|
|
9
|
+
} from "@angular/core";
|
|
10
|
+
import { CommonModule } from "@angular/common";
|
|
11
|
+
import { TranslateModule } from "@ngx-translate/core";
|
|
12
|
+
import { IconComponent } from "../icon/icon.component";
|
|
5
13
|
|
|
6
14
|
@Component({
|
|
7
|
-
selector:
|
|
15
|
+
selector: "app-dropi-paginator",
|
|
8
16
|
standalone: true,
|
|
9
17
|
imports: [CommonModule, IconComponent, TranslateModule],
|
|
10
|
-
|
|
11
|
-
|
|
18
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
19
|
+
templateUrl: "./dropi-paginator.component.html",
|
|
20
|
+
styleUrls: ["./dropi-paginator.component.scss"],
|
|
12
21
|
})
|
|
13
|
-
export class DropiPaginatorComponent {
|
|
22
|
+
export class DropiPaginatorComponent implements OnInit, OnChanges {
|
|
14
23
|
@Input() totalPages: number = 1;
|
|
15
24
|
@Input() currentPage: number = 1;
|
|
16
25
|
@Input() disabled: boolean = false;
|
|
17
|
-
@Input() maxVisiblePages: number = 8; // Máximo de páginas visibles (ajustable)
|
|
18
26
|
@Input() isNotTotalPages: boolean = false;
|
|
27
|
+
@Input() maxVisiblePages: number = 8;
|
|
19
28
|
@Output() pageChange = new EventEmitter<number>();
|
|
20
29
|
|
|
21
|
-
constructor(
|
|
30
|
+
constructor() {}
|
|
31
|
+
|
|
32
|
+
ngOnInit(): void {}
|
|
33
|
+
|
|
34
|
+
ngOnChanges(): void {}
|
|
22
35
|
|
|
23
36
|
get pages(): (number | string)[] {
|
|
24
37
|
const pages: (number | string)[] = [];
|
|
25
38
|
const total = this.totalPages;
|
|
26
39
|
const current = this.currentPage;
|
|
27
40
|
const max = this.maxVisiblePages;
|
|
41
|
+
|
|
28
42
|
if (total <= max) {
|
|
29
|
-
// Si hay pocas páginas, mostrar todas
|
|
30
43
|
for (let i = 1; i <= total; i++) pages.push(i);
|
|
31
44
|
return pages;
|
|
32
45
|
}
|
|
33
|
-
|
|
46
|
+
|
|
47
|
+
const visible = max - 2;
|
|
34
48
|
let start = Math.max(2, current - Math.floor(visible / 2));
|
|
35
49
|
let end = Math.min(total - 1, current + Math.floor(visible / 2));
|
|
50
|
+
|
|
36
51
|
if (start <= 2) {
|
|
37
52
|
start = 2;
|
|
38
53
|
end = start + visible - 1;
|
|
@@ -41,45 +56,38 @@ export class DropiPaginatorComponent {
|
|
|
41
56
|
end = total - 1;
|
|
42
57
|
start = end - visible + 1;
|
|
43
58
|
}
|
|
59
|
+
|
|
44
60
|
pages.push(1);
|
|
45
|
-
if (start > 2) pages.push(
|
|
61
|
+
if (start > 2) pages.push("...");
|
|
46
62
|
for (let i = start; i <= end; i++) pages.push(i);
|
|
47
|
-
if (end < total - 1) pages.push(
|
|
63
|
+
if (end < total - 1) pages.push("...");
|
|
48
64
|
pages.push(total);
|
|
49
65
|
return pages;
|
|
50
66
|
}
|
|
51
67
|
|
|
52
|
-
goToPage(page:
|
|
53
|
-
if (
|
|
68
|
+
public goToPage(page: any): void {
|
|
69
|
+
if (typeof page === "number") {
|
|
54
70
|
this.pageChange.emit(page);
|
|
55
71
|
}
|
|
56
72
|
}
|
|
57
73
|
|
|
58
|
-
prevPage() {
|
|
59
|
-
if (
|
|
74
|
+
public prevPage(): void {
|
|
75
|
+
if (this.currentPage > 1) {
|
|
60
76
|
this.pageChange.emit(this.currentPage - 1);
|
|
61
77
|
}
|
|
62
78
|
}
|
|
63
79
|
|
|
64
|
-
nextPage() {
|
|
65
|
-
if (
|
|
80
|
+
public nextPage(): void {
|
|
81
|
+
if (this.currentPage < this.totalPages || this.isNotTotalPages) {
|
|
66
82
|
this.pageChange.emit(this.currentPage + 1);
|
|
67
83
|
}
|
|
68
84
|
}
|
|
69
85
|
|
|
70
|
-
goToFirstPage() {
|
|
71
|
-
|
|
72
|
-
this.pageChange.emit(1);
|
|
73
|
-
}
|
|
86
|
+
public goToFirstPage(): void {
|
|
87
|
+
this.pageChange.emit(1);
|
|
74
88
|
}
|
|
75
89
|
|
|
76
|
-
goToLastPage() {
|
|
77
|
-
|
|
78
|
-
this.pageChange.emit(this.totalPages);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
showFirstLastButtons(): boolean {
|
|
82
|
-
// si esta en la primera o última página no se muestran los botones
|
|
83
|
-
return this.currentPage > 1 && this.currentPage < this.totalPages;
|
|
90
|
+
public goToLastPage(): void {
|
|
91
|
+
this.pageChange.emit(this.totalPages);
|
|
84
92
|
}
|
|
85
93
|
}
|