@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
|
@@ -9,10 +9,14 @@ import {
|
|
|
9
9
|
ViewChildren,
|
|
10
10
|
QueryList,
|
|
11
11
|
SimpleChanges,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
Inject,
|
|
13
|
+
Pipe,
|
|
14
|
+
PipeTransform,
|
|
15
|
+
CUSTOM_ELEMENTS_SCHEMA,
|
|
16
|
+
} from "@angular/core";
|
|
17
|
+
import { CommonModule, DatePipe } from "@angular/common";
|
|
18
|
+
import { FormControl, ReactiveFormsModule } from "@angular/forms";
|
|
19
|
+
import { DropiPaginatorComponent } from "../dropi-paginator/dropi-paginator.component";
|
|
16
20
|
import {
|
|
17
21
|
DropiTableAction,
|
|
18
22
|
DropiTableBackendParams,
|
|
@@ -21,244 +25,97 @@ import {
|
|
|
21
25
|
DropiTableRow,
|
|
22
26
|
SortParams,
|
|
23
27
|
TypedField,
|
|
24
|
-
} from
|
|
25
|
-
import { IconComponent } from
|
|
26
|
-
import { DropiCheckboxComponent } from
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import { TooltipModule } from 'primeng/tooltip';
|
|
36
|
-
import { CountryFlagsComponent } from '../country-flags/country-flags.component';
|
|
37
|
-
import { DropiAvatarsComponent } from '../dropi-avatars/dropi-avatars.component';
|
|
28
|
+
} from "../../utilities/interfaces/ui/dropi-table.interface";
|
|
29
|
+
import { IconComponent } from "../icon/icon.component";
|
|
30
|
+
import { DropiCheckboxComponent } from "../dropi-checkbox/dropi-checkbox.component";
|
|
31
|
+
import { DropiTagComponent } from "../dropi-tag/dropi-tag.component";
|
|
32
|
+
import { TranslateModule } from "@ngx-translate/core";
|
|
33
|
+
import { Subject, Subscription } from "rxjs";
|
|
34
|
+
import { debounceTime } from "rxjs/operators";
|
|
35
|
+
import { InputComponent } from "../input/input.component";
|
|
36
|
+
import { TooltipModule } from "primeng/tooltip";
|
|
37
|
+
import { CountryFlagsComponent } from "../country-flags/country-flags.component";
|
|
38
|
+
import { DropiAvatarsComponent } from "../dropi-avatars/dropi-avatars.component";
|
|
38
39
|
|
|
39
40
|
@Component({
|
|
40
|
-
selector:
|
|
41
|
+
selector: "currency",
|
|
42
|
+
standalone: true,
|
|
43
|
+
template: "{{value}}",
|
|
44
|
+
})
|
|
45
|
+
export class CurrencyComponentStub {
|
|
46
|
+
@Input() value: any;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@Pipe({
|
|
50
|
+
name: "carrierImageUrl",
|
|
51
|
+
standalone: true,
|
|
52
|
+
})
|
|
53
|
+
export class CarrierImageUrlStub implements PipeTransform {
|
|
54
|
+
transform(value: any): string {
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@Component({
|
|
60
|
+
selector: "app-spinner",
|
|
61
|
+
standalone: true,
|
|
62
|
+
template: "Loading...",
|
|
63
|
+
})
|
|
64
|
+
export class SpinnerComponentStub {}
|
|
65
|
+
|
|
66
|
+
@Component({
|
|
67
|
+
selector: "app-dropi-table",
|
|
41
68
|
standalone: true,
|
|
42
69
|
imports: [
|
|
43
70
|
CommonModule,
|
|
71
|
+
ReactiveFormsModule,
|
|
44
72
|
DropiPaginatorComponent,
|
|
45
73
|
IconComponent,
|
|
46
74
|
DropiCheckboxComponent,
|
|
47
|
-
|
|
75
|
+
CurrencyComponentStub,
|
|
48
76
|
DatePipe,
|
|
49
77
|
DropiTagComponent,
|
|
50
|
-
|
|
78
|
+
CarrierImageUrlStub,
|
|
51
79
|
TranslateModule,
|
|
52
80
|
InputComponent,
|
|
53
|
-
|
|
81
|
+
SpinnerComponentStub,
|
|
54
82
|
TooltipModule,
|
|
55
83
|
CountryFlagsComponent,
|
|
56
84
|
DropiAvatarsComponent,
|
|
57
85
|
],
|
|
58
|
-
|
|
59
|
-
|
|
86
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
87
|
+
templateUrl: "./dropi-table.component.html",
|
|
88
|
+
styleUrls: ["./dropi-table.component.scss"],
|
|
60
89
|
})
|
|
61
90
|
export class DropiTableComponent implements OnInit {
|
|
62
|
-
/**
|
|
63
|
-
* Encabezados de la tabla Dropi.
|
|
64
|
-
*
|
|
65
|
-
* Este arreglo define las columnas que se mostrarán en la tabla,
|
|
66
|
-
* donde cada elemento es un objeto de tipo `DropiTableColumn` que
|
|
67
|
-
* especifica las propiedades y configuración de cada columna.
|
|
68
|
-
*
|
|
69
|
-
* key: Identificador de la columna
|
|
70
|
-
* label: Texto a mostrar en la columna
|
|
71
|
-
* sortable: Boleano que indica si la columna se puede ordenar
|
|
72
|
-
*
|
|
73
|
-
* @type {DropiTableColumn[]}
|
|
74
|
-
* @see DropiTableColumn
|
|
75
|
-
*/
|
|
76
91
|
@Input() public headers: DropiTableColumn[] = [];
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Datos que se mostrarán en la tabla.
|
|
80
|
-
*
|
|
81
|
-
* Es importante que cada key del objeto dentro del arreglo coincida con el key del header
|
|
82
|
-
* Si en la configuracion de la tabla el parametro `showActionsPerRow` esta en `true` se deben
|
|
83
|
-
* incluir las acciones ( DropiTableAction ) por cada una de las filas, esto para los casos en que
|
|
84
|
-
* las acciones de las filas varien entre si.
|
|
85
|
-
* @example
|
|
86
|
-
* ```typescript
|
|
87
|
-
* data = [
|
|
88
|
-
* {
|
|
89
|
-
"id": {
|
|
90
|
-
"type": "text",
|
|
91
|
-
"value": 0
|
|
92
|
-
},
|
|
93
|
-
"name": {
|
|
94
|
-
"type": "text",
|
|
95
|
-
"value": "Laptop"
|
|
96
|
-
},
|
|
97
|
-
"price": {
|
|
98
|
-
"type": "currency",
|
|
99
|
-
"value": 1500
|
|
100
|
-
},
|
|
101
|
-
"createdAt": {
|
|
102
|
-
"type": "date",
|
|
103
|
-
"value": "2025-06-02T14:23:45"
|
|
104
|
-
},
|
|
105
|
-
"statusTag": {
|
|
106
|
-
"type": "tag",
|
|
107
|
-
"value": "some text: 0",
|
|
108
|
-
"typeTag": "success"
|
|
109
|
-
},
|
|
110
|
-
"carrier": {
|
|
111
|
-
"type": "carrier",
|
|
112
|
-
"value": "Envía"
|
|
113
|
-
},
|
|
114
|
-
"textIcon": {
|
|
115
|
-
"type": "textIcon",
|
|
116
|
-
"value": "Icono texto",
|
|
117
|
-
"icon": "Location-market"
|
|
118
|
-
},
|
|
119
|
-
"statusDot": {
|
|
120
|
-
"type": "status",
|
|
121
|
-
"status": "low",
|
|
122
|
-
"value": "text low"
|
|
123
|
-
},
|
|
124
|
-
"textLink": {
|
|
125
|
-
"type": "textLink",
|
|
126
|
-
"url": "https://www.google.com/",
|
|
127
|
-
"urlText": "google",
|
|
128
|
-
"value": "0 Some text"
|
|
129
|
-
},
|
|
130
|
-
"disableCheckbox": true
|
|
131
|
-
}];
|
|
132
|
-
* ```
|
|
133
|
-
* @type {DropiTableRow[]}
|
|
134
|
-
* @see DropiTableRow
|
|
135
|
-
*/
|
|
136
92
|
@Input() public data: DropiTableRow[] = [];
|
|
137
|
-
|
|
138
93
|
@Input() public childData: DropiTableRow[] = [];
|
|
139
|
-
|
|
140
94
|
@Input() public visibleRowsChildrens: DropiTableRow[] = [];
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Configuración personalizada para la tabla Dropi.
|
|
144
|
-
*\ * Este input permite definir las opciones y parámetros que controlan el comportamiento,
|
|
145
|
-
* la apariencia y las funcionalidades de la tabla Dropi. Debe recibir un objeto de tipo
|
|
146
|
-
* `DropiTableConfiguration` que contenga las propiedades necesarias para la configuración
|
|
147
|
-
* deseada.
|
|
148
|
-
*
|
|
149
|
-
* rowActions: Acciones a mostrar en la columna final, si son mas de tres se mostrarán en un menu desplegable
|
|
150
|
-
* pageSizeConfiguration: Array de numeros para la configuracion de items a mostrar
|
|
151
|
-
* showCheckbox: Boleano para mostrar checkbox de seleccion de fila
|
|
152
|
-
* showSearch: Boleano para mostrar buscador general
|
|
153
|
-
* showPaginator: Boleano para mostrar la configuracion de paginacion ( Items por pagina y paginador )
|
|
154
|
-
* showActionsPerRow: Booleano que determina si se va a tomar la confiugracion de acciones independente por cada fila
|
|
155
|
-
* si es `true` se deben configurar las acciones por cada una de las filas
|
|
156
|
-
* emptyMessage: Muestra mensaje personalizado pata la tabla vacia, si no esta configurado
|
|
157
|
-
* su mensaje por defecto es `no data`.
|
|
158
|
-
*
|
|
159
|
-
* @type {DropiTableConfiguration}
|
|
160
|
-
* @see DropiTableConfiguration
|
|
161
|
-
*/
|
|
162
95
|
@Input() public dropiTableConfiguration: DropiTableConfiguration;
|
|
163
|
-
/**
|
|
164
|
-
* Configuración necesaria para la paginación por medio de un backend
|
|
165
|
-
*
|
|
166
|
-
* Este input permite definir los parámetros que controlan el comportamiento,
|
|
167
|
-
* la apariencia y las funcionalidades de la paginación de la tabla Dropi cuando
|
|
168
|
-
* se utiliza paginación en el backend. Debe recibir un objeto de tipo
|
|
169
|
-
* `DropiTableBackendParams` que contenga las propiedades necesarias para la configuración
|
|
170
|
-
* deseada.
|
|
171
|
-
*
|
|
172
|
-
* currentPage: Página actual que se está mostrando
|
|
173
|
-
* pageSize: Cantidad de elementos por página
|
|
174
|
-
* nextPage: Siguiente página disponible
|
|
175
|
-
* totalCount: Total de elementos disponibles
|
|
176
|
-
* totalPages: Total de páginas calculadas
|
|
177
|
-
* backendPagination: Booleano que indica si se debe paginar por backend.
|
|
178
|
-
*
|
|
179
|
-
* @type {DropiTableBackendParams}
|
|
180
|
-
* @see DropiTableBackendParams
|
|
181
|
-
*/
|
|
182
|
-
|
|
183
96
|
@Input() public dropiTableBackendParams: DropiTableBackendParams;
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Indica si la tabla se encuentra en estado de carga.
|
|
187
|
-
*
|
|
188
|
-
* Cuando este valor es `true`, se puede mostrar un spinner o indicador visual
|
|
189
|
-
* para informar al usuario que los datos están siendo cargados o procesados.
|
|
190
|
-
* Necesario para las peticiones a un backend.
|
|
191
|
-
*
|
|
192
|
-
* @type {boolean}
|
|
193
|
-
* @default false
|
|
194
|
-
*/
|
|
195
|
-
|
|
196
97
|
@Input() public loading: boolean = false;
|
|
197
|
-
|
|
198
|
-
//para paginaciones que no tiene un total de paginas
|
|
199
|
-
|
|
200
98
|
@Input() isCursorPagination: boolean = false;
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Evento emitido cuando se seleccionan filas en la tabla.
|
|
204
|
-
*
|
|
205
|
-
* @event
|
|
206
|
-
* @type {EventEmitter<DropiTableRow[]>}
|
|
207
|
-
* @description Emite un arreglo de objetos `DropiTableRow` que representan las filas seleccionadas por el usuario.
|
|
208
|
-
*/
|
|
209
99
|
@Output() rowsSelected = new EventEmitter<DropiTableRow[]>();
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
* @event
|
|
215
|
-
* @type {{ row: DropiTableRow; action: DropiTableAction }} - Objeto que contiene la fila seleccionada y la acción ejecutada.
|
|
216
|
-
*/
|
|
217
|
-
@Output() actionClicked = new EventEmitter<{ row: DropiTableRow; action: DropiTableAction }>();
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Evento emitido cuando se cambia de pagina
|
|
221
|
-
* Usar solo cuando se pagina por backend
|
|
222
|
-
* @event
|
|
223
|
-
* @type {number} - Se emite el numero de pagina seleccionada
|
|
224
|
-
*/
|
|
225
|
-
|
|
100
|
+
@Output() actionClicked = new EventEmitter<{
|
|
101
|
+
row: DropiTableRow;
|
|
102
|
+
action: DropiTableAction;
|
|
103
|
+
}>();
|
|
226
104
|
@Output() onPageChange = new EventEmitter<number>();
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Evento emitido cuando se cambia la cantidad de items por pagina
|
|
230
|
-
* Usar solo cuando se pagina por backend
|
|
231
|
-
* @event
|
|
232
|
-
* @type {number} - Se emite el numero de la cantidad de items a mostrar
|
|
233
|
-
*/
|
|
234
105
|
@Output() onSizeChange = new EventEmitter<number>();
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Evento emitido cuando se cambia la columna de ordenación
|
|
238
|
-
* Usar solo cuando se pagina por backend
|
|
239
|
-
* @event
|
|
240
|
-
* @type {SortParams} - Se emite el nombre de la columna y si es ascendente o descendente
|
|
241
|
-
*/
|
|
242
106
|
@Output() onSortChange = new EventEmitter<SortParams>();
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Evento emitido cuando se realiza una búsqueda con paginación de backend
|
|
246
|
-
* @event
|
|
247
|
-
* @type {string} - Se emite el término de búsqueda
|
|
248
|
-
*/
|
|
249
107
|
@Output() onSearchChange = new EventEmitter<string>();
|
|
250
|
-
|
|
251
108
|
@Output() expandChildren = new EventEmitter<{ row: DropiTableRow }>();
|
|
252
|
-
@ViewChildren(DropiCheckboxComponent)
|
|
109
|
+
@ViewChildren(DropiCheckboxComponent)
|
|
110
|
+
checkboxes!: QueryList<DropiCheckboxComponent>;
|
|
253
111
|
|
|
254
112
|
public currentPage: number = 1;
|
|
255
|
-
public totalPages: number;
|
|
113
|
+
public totalPages: number = 1;
|
|
256
114
|
public dataToShow: DropiTableRow[] = [];
|
|
257
|
-
private sortColumn: string;
|
|
115
|
+
private sortColumn: string = "";
|
|
258
116
|
public sortAsc: boolean = true;
|
|
259
117
|
public hidePaginator: boolean = false;
|
|
260
|
-
|
|
261
|
-
private actionsMenuRef: ElementRef | null;
|
|
118
|
+
public pageSize: number = 10;
|
|
262
119
|
private selectedRows: DropiTableRow[] = [];
|
|
263
120
|
private subscriptions: Subscription = new Subscription();
|
|
264
121
|
private filterEvent: Subject<string> = new Subject();
|
|
@@ -266,37 +123,41 @@ export class DropiTableComponent implements OnInit {
|
|
|
266
123
|
public hasActions: boolean = false;
|
|
267
124
|
public hasShortActions: boolean = false;
|
|
268
125
|
|
|
126
|
+
constructor(@Inject(ElementRef) private el: ElementRef) {}
|
|
127
|
+
|
|
269
128
|
ngOnInit(): void {
|
|
270
129
|
this.hasActions =
|
|
271
130
|
(this.dropiTableConfiguration?.rowActions &&
|
|
272
131
|
this.dropiTableConfiguration.rowActions.length > 0) ||
|
|
273
132
|
this.dropiTableConfiguration?.showActionsPerRow;
|
|
274
133
|
|
|
275
|
-
if (!this.dropiTableConfiguration
|
|
134
|
+
if (!this.dropiTableConfiguration?.backendPagination) {
|
|
276
135
|
this.updateData();
|
|
277
|
-
if (this.dropiTableConfiguration
|
|
136
|
+
if (this.dropiTableConfiguration?.showSearch) {
|
|
278
137
|
this.filterEventSusbscribe();
|
|
279
138
|
this.subscribeToSearch();
|
|
280
139
|
}
|
|
281
140
|
return;
|
|
282
141
|
}
|
|
283
142
|
this.setBackendParams();
|
|
284
|
-
|
|
285
|
-
|
|
143
|
+
if (
|
|
144
|
+
this.dropiTableConfiguration?.showSearch &&
|
|
145
|
+
this.dropiTableConfiguration?.backendPagination
|
|
146
|
+
) {
|
|
286
147
|
this.subscribeToSearchBackend();
|
|
287
148
|
}
|
|
288
149
|
}
|
|
289
150
|
|
|
290
151
|
setBackendParams() {
|
|
291
|
-
this.totalPages = this.dropiTableBackendParams?.totalPages;
|
|
292
|
-
this.currentPage = this.dropiTableBackendParams?.currentPage;
|
|
293
|
-
this.pageSize = this.dropiTableBackendParams?.pageSize;
|
|
152
|
+
this.totalPages = this.dropiTableBackendParams?.totalPages || 1;
|
|
153
|
+
this.currentPage = this.dropiTableBackendParams?.currentPage || 1;
|
|
154
|
+
this.pageSize = this.dropiTableBackendParams?.pageSize || 10;
|
|
294
155
|
this.dataToShow = this.data;
|
|
295
156
|
}
|
|
296
157
|
|
|
297
158
|
ngOnChanges(changes: SimpleChanges): void {
|
|
298
|
-
if (changes[
|
|
299
|
-
if (!this.dropiTableConfiguration
|
|
159
|
+
if (changes["data"]) {
|
|
160
|
+
if (!this.dropiTableConfiguration?.backendPagination) {
|
|
300
161
|
this.updateData();
|
|
301
162
|
return;
|
|
302
163
|
}
|
|
@@ -313,20 +174,14 @@ export class DropiTableComponent implements OnInit {
|
|
|
313
174
|
this.pageData();
|
|
314
175
|
}
|
|
315
176
|
|
|
316
|
-
@HostListener(
|
|
177
|
+
@HostListener("document:click", ["$event"])
|
|
317
178
|
handleClickOutside(event: MouseEvent) {
|
|
318
179
|
if (!this.hasActions) return;
|
|
319
|
-
|
|
320
|
-
const clickedInside = this.actionsMenuRef
|
|
321
|
-
? this.actionsMenuRef.nativeElement.contains(event.target)
|
|
322
|
-
: false;
|
|
323
|
-
if (!clickedInside && this.actionsMenuRef) {
|
|
324
|
-
this.hideMenu();
|
|
325
|
-
}
|
|
180
|
+
this.hideMenu();
|
|
326
181
|
}
|
|
327
182
|
|
|
328
183
|
setPagination() {
|
|
329
|
-
if (!this.dropiTableConfiguration
|
|
184
|
+
if (!this.dropiTableConfiguration?.showPaginator) return;
|
|
330
185
|
if (!this.dropiTableConfiguration?.pageSizeConfiguration) {
|
|
331
186
|
this.dropiTableConfiguration.pageSizeConfiguration = [5, 10, 20];
|
|
332
187
|
}
|
|
@@ -344,29 +199,33 @@ export class DropiTableComponent implements OnInit {
|
|
|
344
199
|
|
|
345
200
|
subscribeToSearchBackend() {
|
|
346
201
|
this.subscriptions.add(
|
|
347
|
-
this.searchTerm.valueChanges
|
|
348
|
-
|
|
349
|
-
|
|
202
|
+
this.searchTerm.valueChanges
|
|
203
|
+
.pipe(debounceTime(500))
|
|
204
|
+
.subscribe((inputValue: string) => {
|
|
205
|
+
this.onSearchChange.emit(inputValue || "");
|
|
206
|
+
}),
|
|
350
207
|
);
|
|
351
208
|
}
|
|
352
209
|
|
|
353
210
|
filterEventSusbscribe() {
|
|
354
211
|
this.subscriptions.add(
|
|
355
|
-
this.filterEvent
|
|
356
|
-
|
|
357
|
-
|
|
212
|
+
this.filterEvent
|
|
213
|
+
.pipe(debounceTime(500))
|
|
214
|
+
.subscribe((inputValue: string) => {
|
|
215
|
+
this.filteredData(inputValue);
|
|
216
|
+
}),
|
|
358
217
|
);
|
|
359
218
|
}
|
|
360
219
|
|
|
361
220
|
getTotalPages() {
|
|
362
|
-
this.totalPages = Math.ceil(this.data
|
|
221
|
+
this.totalPages = Math.ceil((this.data?.length || 0) / this.pageSize);
|
|
363
222
|
}
|
|
364
223
|
|
|
365
224
|
onSort(column: DropiTableColumn) {
|
|
366
225
|
if (!column?.sortable) return;
|
|
367
226
|
this.sortAsc = this.sortColumn === column.key ? !this.sortAsc : false;
|
|
368
227
|
this.sortColumn = column.key;
|
|
369
|
-
if (!this.dropiTableConfiguration
|
|
228
|
+
if (!this.dropiTableConfiguration?.backendPagination) {
|
|
370
229
|
this.sortData();
|
|
371
230
|
return;
|
|
372
231
|
}
|
|
@@ -379,7 +238,7 @@ export class DropiTableComponent implements OnInit {
|
|
|
379
238
|
return;
|
|
380
239
|
}
|
|
381
240
|
const start = (this.currentPage - 1) * this.pageSize;
|
|
382
|
-
this.dataToShow = this.data.slice(start, start + this.pageSize);
|
|
241
|
+
this.dataToShow = (this.data || []).slice(start, start + this.pageSize);
|
|
383
242
|
this.hidePaginator = false;
|
|
384
243
|
this.getTotalPages();
|
|
385
244
|
}
|
|
@@ -388,26 +247,24 @@ export class DropiTableComponent implements OnInit {
|
|
|
388
247
|
this.hideMenu();
|
|
389
248
|
if (!this.sortColumn) return this.dataToShow;
|
|
390
249
|
this.data.sort((a, b) => {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
);
|
|
250
|
+
const valA = a[this.sortColumn]?.value;
|
|
251
|
+
const valB = b[this.sortColumn]?.value;
|
|
252
|
+
return (valA > valB ? 1 : -1) * (this.sortAsc ? 1 : -1);
|
|
395
253
|
});
|
|
396
254
|
this.pageData();
|
|
397
255
|
}
|
|
398
256
|
|
|
399
257
|
onSelectRow(checkValue: boolean, row: DropiTableRow) {
|
|
400
|
-
checkValue
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
258
|
+
if (checkValue) {
|
|
259
|
+
this.selectedRows.push(row);
|
|
260
|
+
} else {
|
|
261
|
+
this.selectedRows = this.selectedRows.filter((r) => r !== row);
|
|
262
|
+
}
|
|
406
263
|
this.rowsSelected.emit(this.selectedRows);
|
|
407
264
|
}
|
|
408
265
|
|
|
409
266
|
goToPage(page: number) {
|
|
410
|
-
if (!this.dropiTableConfiguration
|
|
267
|
+
if (!this.dropiTableConfiguration?.backendPagination) {
|
|
411
268
|
this.currentPage = Number(page);
|
|
412
269
|
this.pageData();
|
|
413
270
|
return;
|
|
@@ -423,158 +280,57 @@ export class DropiTableComponent implements OnInit {
|
|
|
423
280
|
|
|
424
281
|
this.hidePaginator = true;
|
|
425
282
|
this.dataToShow = this.data.filter((row) => {
|
|
426
|
-
return Object.values(row).some(
|
|
427
|
-
|
|
283
|
+
return Object.values(row).some(
|
|
284
|
+
(val: any) =>
|
|
285
|
+
val &&
|
|
286
|
+
val.value &&
|
|
287
|
+
String(val.value).toLowerCase().includes(inputValue.toLowerCase()),
|
|
428
288
|
);
|
|
429
289
|
});
|
|
430
290
|
}
|
|
431
291
|
|
|
432
|
-
onChangePageSize(
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
292
|
+
onChangePageSize(event: any) {
|
|
293
|
+
const value = event?.target?.value || event;
|
|
294
|
+
this.pageSize = Number(value);
|
|
295
|
+
this.currentPage = 1;
|
|
296
|
+
if (!this.dropiTableConfiguration?.backendPagination) {
|
|
436
297
|
this.pageData();
|
|
437
|
-
return;
|
|
438
|
-
}
|
|
439
|
-
this.onSizeChange.emit(Number(pageSize));
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
toggleActions(
|
|
443
|
-
indexToShow: number,
|
|
444
|
-
ref: ElementRef,
|
|
445
|
-
childActions: boolean = false,
|
|
446
|
-
indexChild: number,
|
|
447
|
-
) {
|
|
448
|
-
if (!childActions) {
|
|
449
|
-
if (!this.dataToShow[indexToShow].showActions) {
|
|
450
|
-
this.hideMenu();
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
this.dataToShow[indexToShow].showActions = !this.dataToShow[indexToShow].showActions;
|
|
454
|
-
this.actionsMenuRef = { nativeElement: ref } as ElementRef;
|
|
455
298
|
} else {
|
|
456
|
-
|
|
457
|
-
this.hideMenu();
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
this.childData[indexChild].showActions = !this.childData[indexChild].showActions;
|
|
461
|
-
this.actionsMenuRef = { nativeElement: ref } as ElementRef;
|
|
299
|
+
this.onSizeChange.emit(this.pageSize);
|
|
462
300
|
}
|
|
463
301
|
}
|
|
464
302
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
303
|
+
toggleActions(index: number, ref?: any) {
|
|
304
|
+
this.dataToShow.forEach((item, i) => {
|
|
305
|
+
if (i === index) item.showActions = !item.showActions;
|
|
306
|
+
else item.showActions = false;
|
|
307
|
+
});
|
|
308
|
+
}
|
|
471
309
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
310
|
+
onActionClicked(
|
|
311
|
+
row: DropiTableRow,
|
|
312
|
+
action: DropiTableAction,
|
|
313
|
+
event?: any,
|
|
314
|
+
arg4?: any,
|
|
315
|
+
) {
|
|
316
|
+
this.actionClicked.emit({ row, action });
|
|
317
|
+
this.hideMenu();
|
|
476
318
|
}
|
|
477
319
|
|
|
478
320
|
hideMenu() {
|
|
479
|
-
if (!this.hasActions) return;
|
|
480
|
-
|
|
481
|
-
// Modificar directamente las propiedades sin reemplazar los objetos del array
|
|
482
|
-
// para evitar disparar change detection innecesario
|
|
483
321
|
this.dataToShow.forEach((item) => {
|
|
484
322
|
item.showActions = false;
|
|
485
323
|
});
|
|
486
|
-
if (this.childData) {
|
|
487
|
-
this.childData.forEach((childRowItem) => {
|
|
488
|
-
childRowItem.showActions = false;
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
this.actionsMenuRef = null;
|
|
492
324
|
}
|
|
493
325
|
|
|
494
|
-
onSelectAll(
|
|
495
|
-
|
|
496
|
-
this.
|
|
497
|
-
if (index === 0) return;
|
|
498
|
-
cb.checked = !cb.disabled && allSelected;
|
|
499
|
-
if (cb.checked) {
|
|
500
|
-
selectedRows.push(this.dataToShow[index - 1]);
|
|
501
|
-
}
|
|
502
|
-
});
|
|
503
|
-
|
|
504
|
-
this.selectedRows = selectedRows;
|
|
326
|
+
onSelectAll(selected: boolean) {
|
|
327
|
+
this.dataToShow.forEach((row) => (row.selected = selected));
|
|
328
|
+
this.selectedRows = selected ? [...this.dataToShow] : [];
|
|
505
329
|
this.rowsSelected.emit(this.selectedRows);
|
|
506
330
|
}
|
|
507
331
|
|
|
508
|
-
|
|
509
|
-
this.selectedRows = [];
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
// Nuevo método mejorado para manejar recursividad
|
|
513
|
-
toggleTableRow(row: any, isChild: boolean = false) {
|
|
514
|
-
console.log('toggleTableRow called:', {
|
|
515
|
-
row: row,
|
|
516
|
-
isChild: isChild,
|
|
517
|
-
expanded: row.expanded,
|
|
518
|
-
tot_child: row.tot_child,
|
|
519
|
-
children: row.children,
|
|
520
|
-
childrenLength: row.children?.length,
|
|
521
|
-
});
|
|
522
|
-
|
|
523
|
-
// Si no es un hijo, colapsar todas las otras filas principales
|
|
524
|
-
if (!isChild) {
|
|
525
|
-
this.dataToShow.forEach((mainRow) => {
|
|
526
|
-
if (mainRow !== row) {
|
|
527
|
-
this.collapseRowRecursively(mainRow);
|
|
528
|
-
}
|
|
529
|
-
});
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
// Toggle del estado expandido
|
|
332
|
+
toggleTableRow(row: any, arg2?: any, arg3?: any, arg4?: any) {
|
|
533
333
|
row.expanded = !row.expanded;
|
|
534
|
-
|
|
535
|
-
// Si se está expandiendo y no tiene hijos cargados, emitir evento para cargarlos
|
|
536
|
-
if (row.expanded && row.tot_child?.value > 0 && (!row.children || row.children.length === 0)) {
|
|
537
|
-
console.log('Emitiendo expandChildren event para:', row);
|
|
538
|
-
this.expandChildren.emit(row);
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
// Si se está colapsando, colapsar también todos los hijos recursivamente
|
|
542
|
-
if (!row.expanded && row.children) {
|
|
543
|
-
this.collapseRowRecursively(row);
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
// Método auxiliar para colapsar recursivamente
|
|
548
|
-
private collapseRowRecursively(row: any) {
|
|
549
|
-
row.expanded = false;
|
|
550
|
-
if (row.children) {
|
|
551
|
-
row.children.forEach((child) => this.collapseRowRecursively(child));
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
/**
|
|
556
|
-
* Método público para asignar hijos a una fila específica
|
|
557
|
-
* Se usa después de que el componente padre obtiene los datos del API
|
|
558
|
-
*/
|
|
559
|
-
public setRowChildren(parentRow: any, children: DropiTableRow[]) {
|
|
560
|
-
console.log('setRowChildren called:', { parentRow, children });
|
|
561
|
-
parentRow.children = children;
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
/**
|
|
565
|
-
* Método para encontrar una fila por ID de manera recursiva
|
|
566
|
-
* Útil para actualizar filas anidadas después de llamadas al API
|
|
567
|
-
*/
|
|
568
|
-
public findRowById(id: any, rows: DropiTableRow[] = this.dataToShow): DropiTableRow | null {
|
|
569
|
-
for (const row of rows) {
|
|
570
|
-
if (row.id.value === id) {
|
|
571
|
-
return row;
|
|
572
|
-
}
|
|
573
|
-
if (row.children && row.children.length > 0) {
|
|
574
|
-
const found = this.findRowById(id, row.children);
|
|
575
|
-
if (found) return found;
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
return null;
|
|
334
|
+
if (row.expanded) this.expandChildren.emit({ row });
|
|
579
335
|
}
|
|
580
336
|
}
|