design-angular-kit 1.2.0 → 1.2.1
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/.eslintrc.json +31 -0
- package/karma.conf.js +38 -0
- package/ng-package.json +9 -0
- package/ng-package.prod.json +8 -0
- package/package.json +9 -14
- package/schematics/ng-add/index.spec.ts +45 -0
- package/schematics/ng-add/index.ts +36 -0
- package/schematics/ng-add/rules/setup-project/add-animations.ts +7 -0
- package/schematics/ng-add/rules/setup-project/add-assets.ts +45 -0
- package/schematics/ng-add/rules/setup-project/add-design-angular-kit.ts +40 -0
- package/schematics/ng-add/rules/setup-project/add-http-client.ts +7 -0
- package/schematics/ng-add/rules/setup-project/add-import-to-style-file.ts +120 -0
- package/schematics/ng-add/rules/setup-project/add-localisation.ts +45 -0
- package/schematics/ng-add/rules/setup-project/angular-json-helper.ts +11 -0
- package/schematics/ng-add/rules/setup-project/exceptions.ts +13 -0
- package/schematics/ng-add/{schema.d.ts → schema.ts} +1 -1
- package/schematics/ng-add/setup-project.spec.ts +166 -0
- package/schematics/ng-add/setup-project.ts +31 -0
- package/schematics/ng-add/utils.ts +71 -0
- package/schematics/ng-add/versions-helper.ts +41 -0
- package/src/lib/abstracts/abstract-form.component.ts +200 -0
- package/src/lib/abstracts/abstract.component.ts +63 -0
- package/src/lib/components/core/accordion/accordion.component.html +27 -0
- package/src/lib/components/core/accordion/accordion.component.spec.ts +21 -0
- package/src/lib/components/core/accordion/accordion.component.ts +40 -0
- package/src/lib/components/core/alert/alert.component.html +19 -0
- package/src/lib/components/core/alert/alert.component.scss +3 -0
- package/src/lib/components/core/alert/alert.component.spec.ts +62 -0
- package/src/lib/components/core/alert/alert.component.ts +75 -0
- package/src/lib/components/core/avatar/avatar-dropdown/avatar-dropdown.component.html +23 -0
- package/src/lib/components/core/avatar/avatar-dropdown/avatar-dropdown.component.scss +17 -0
- package/src/lib/components/core/avatar/avatar-dropdown/avatar-dropdown.component.spec.ts +21 -0
- package/src/lib/components/core/avatar/avatar-dropdown/avatar-dropdown.component.ts +50 -0
- package/src/lib/components/core/avatar/avatar-group/avatar-group.component.html +7 -0
- package/src/lib/components/core/avatar/avatar-group/avatar-group.component.spec.ts +38 -0
- package/src/lib/components/core/avatar/avatar-group/avatar-group.component.ts +25 -0
- package/src/lib/components/core/avatar/avatar.directive.ts +73 -0
- package/src/lib/components/core/avatar/avatar.module.ts +18 -0
- package/src/lib/components/core/badge/badge.directive.spec.ts +59 -0
- package/src/lib/components/core/badge/badge.directive.ts +39 -0
- package/src/lib/components/core/button/button.directive.spec.ts +96 -0
- package/src/lib/components/core/button/button.directive.ts +89 -0
- package/src/lib/components/core/callout/callout.component.html +25 -0
- package/src/lib/components/core/callout/callout.component.spec.ts +138 -0
- package/src/lib/components/core/callout/callout.component.ts +92 -0
- package/src/lib/components/core/card/card.component.html +35 -0
- package/src/lib/components/core/card/card.component.scss +30 -0
- package/src/lib/components/core/card/card.component.spec.ts +21 -0
- package/src/lib/components/core/card/card.component.ts +78 -0
- package/src/lib/components/core/carousel/carousel/carousel.component.html +29 -0
- package/src/lib/components/core/carousel/carousel/carousel.component.scss +1 -0
- package/src/lib/components/core/carousel/carousel/carousel.component.spec.ts +21 -0
- package/src/lib/components/core/carousel/carousel/carousel.component.ts +119 -0
- package/src/lib/components/core/carousel/carousel-item/carousel-item.component.html +3 -0
- package/src/lib/components/core/carousel/carousel-item/carousel-item.component.spec.ts +22 -0
- package/src/lib/components/core/carousel/carousel-item/carousel-item.component.ts +20 -0
- package/src/lib/components/core/carousel/carousel.module.ts +11 -0
- package/src/lib/components/core/chip/chip.component.html +26 -0
- package/src/lib/components/core/chip/chip.component.spec.ts +87 -0
- package/src/lib/components/core/chip/chip.component.ts +154 -0
- package/src/lib/components/core/collapse/collapse.component.html +3 -0
- package/src/lib/components/core/collapse/collapse.component.spec.ts +21 -0
- package/src/lib/components/core/collapse/collapse.component.ts +124 -0
- package/src/lib/components/core/dimmer/dimmer-buttons/dimmer-buttons.component.html +3 -0
- package/src/lib/components/core/dimmer/dimmer-buttons/dimmer-buttons.component.spec.ts +35 -0
- package/src/lib/components/core/dimmer/dimmer-buttons/dimmer-buttons.component.ts +23 -0
- package/src/lib/components/core/dimmer/dimmer-icon/dimmer-icon.component.html +3 -0
- package/src/lib/components/core/dimmer/dimmer-icon/dimmer-icon.component.spec.ts +22 -0
- package/src/lib/components/core/dimmer/dimmer-icon/dimmer-icon.component.ts +10 -0
- package/src/lib/components/core/dimmer/dimmer.component.html +7 -0
- package/src/lib/components/core/dimmer/dimmer.component.spec.ts +49 -0
- package/src/lib/components/core/dimmer/dimmer.component.ts +50 -0
- package/src/lib/components/core/dimmer/dimmer.module.ts +12 -0
- package/src/lib/components/core/dropdown/dropdown/dropdown.component.html +45 -0
- package/src/lib/components/core/dropdown/dropdown/dropdown.component.scss +3 -0
- package/src/lib/components/core/dropdown/dropdown/dropdown.component.spec.ts +21 -0
- package/src/lib/components/core/dropdown/dropdown/dropdown.component.ts +186 -0
- package/src/lib/components/core/dropdown/dropdown-item/dropdown-item.component.html +18 -0
- package/src/lib/components/core/dropdown/dropdown-item/dropdown-item.component.scss +4 -0
- package/src/lib/components/core/dropdown/dropdown-item/dropdown-item.component.spec.ts +21 -0
- package/src/lib/components/core/dropdown/dropdown-item/dropdown-item.component.ts +82 -0
- package/src/lib/components/core/dropdown/dropdown.module.ts +11 -0
- package/src/lib/components/core/forward/forward.directive.spec.ts +60 -0
- package/src/lib/components/core/forward/forward.directive.ts +43 -0
- package/src/lib/components/core/link/link.component.html +13 -0
- package/src/lib/components/core/link/link.component.spec.ts +21 -0
- package/src/lib/components/core/link/link.component.ts +54 -0
- package/src/lib/components/core/list/list/list.component.html +13 -0
- package/src/lib/components/core/list/list/list.component.spec.ts +21 -0
- package/src/lib/components/core/list/list/list.component.ts +30 -0
- package/src/lib/components/core/list/list-item/list-item.component.html +42 -0
- package/src/lib/components/core/list/list-item/list-item.component.scss +16 -0
- package/src/lib/components/core/list/list-item/list-item.component.spec.ts +21 -0
- package/src/lib/components/core/list/list-item/list-item.component.ts +75 -0
- package/src/lib/components/core/list/list.module.ts +11 -0
- package/src/lib/components/core/modal/modal.component.html +36 -0
- package/src/lib/components/core/modal/modal.component.scss +3 -0
- package/src/lib/components/core/modal/modal.component.spec.ts +21 -0
- package/src/lib/components/core/modal/modal.component.ts +218 -0
- package/src/lib/components/core/notifications/notifications.component.html +25 -0
- package/src/lib/components/core/notifications/notifications.component.scss +3 -0
- package/src/lib/components/core/notifications/notifications.component.spec.ts +21 -0
- package/src/lib/components/core/notifications/notifications.component.ts +123 -0
- package/src/lib/components/core/pagination/pagination.component.html +107 -0
- package/src/lib/components/core/pagination/pagination.component.spec.ts +21 -0
- package/src/lib/components/core/pagination/pagination.component.ts +157 -0
- package/src/lib/components/core/popover/popover.directive.spec.ts +21 -0
- package/src/lib/components/core/popover/popover.directive.ts +171 -0
- package/src/lib/components/core/progress-bar/progress-bar.component.html +20 -0
- package/src/lib/components/core/progress-bar/progress-bar.component.spec.ts +21 -0
- package/src/lib/components/core/progress-bar/progress-bar.component.ts +46 -0
- package/src/lib/components/core/progress-button/progress-button.component.html +5 -0
- package/src/lib/components/core/progress-button/progress-button.component.spec.ts +21 -0
- package/src/lib/components/core/progress-button/progress-button.component.ts +39 -0
- package/src/lib/components/core/spinner/spinner.component.html +7 -0
- package/src/lib/components/core/spinner/spinner.component.spec.ts +80 -0
- package/src/lib/components/core/spinner/spinner.component.ts +31 -0
- package/src/lib/components/core/steppers/steppers-container/steppers-container.component.html +126 -0
- package/src/lib/components/core/steppers/steppers-container/steppers-container.component.spec.ts +21 -0
- package/src/lib/components/core/steppers/steppers-container/steppers-container.component.ts +185 -0
- package/src/lib/components/core/steppers/steppers-item/steppers-item.component.html +3 -0
- package/src/lib/components/core/steppers/steppers-item/steppers-item.component.spec.ts +22 -0
- package/src/lib/components/core/steppers/steppers-item/steppers-item.component.ts +33 -0
- package/src/lib/components/core/steppers/steppers.module.ts +11 -0
- package/src/lib/components/core/tab/tab-container/tab-container.component.html +78 -0
- package/src/lib/components/core/tab/tab-container/tab-container.component.spec.ts +21 -0
- package/src/lib/components/core/tab/tab-container/tab-container.component.ts +137 -0
- package/src/lib/components/core/tab/tab-item/tab-item.component.html +3 -0
- package/src/lib/components/core/tab/tab-item/tab-item.component.spec.ts +22 -0
- package/src/lib/components/core/tab/tab-item/tab-item.component.ts +50 -0
- package/src/lib/components/core/tab/tab.module.ts +11 -0
- package/src/lib/components/core/table/sort/sort-header/sort-header.component.html +27 -0
- package/src/lib/components/core/table/sort/sort-header/sort-header.component.scss +65 -0
- package/src/lib/components/core/table/sort/sort-header/sort-header.component.spec.ts +25 -0
- package/src/lib/components/core/table/sort/sort-header/sort-header.component.ts +164 -0
- package/src/lib/components/core/table/sort/sort.directive.spec.ts +73 -0
- package/src/lib/components/core/table/sort/sort.directive.ts +142 -0
- package/src/lib/components/core/table/table.component.html +23 -0
- package/src/lib/components/core/table/table.component.scss +7 -0
- package/src/lib/components/core/table/table.component.spec.ts +21 -0
- package/src/lib/components/core/table/table.component.ts +70 -0
- package/src/lib/components/core/table/table.module.ts +12 -0
- package/src/lib/components/core/timeline/timeline-item/timeline-item.component.html +47 -0
- package/src/lib/components/core/timeline/timeline-item/timeline-item.component.spec.ts +24 -0
- package/src/lib/components/core/timeline/timeline-item/timeline-item.component.ts +102 -0
- package/src/lib/components/core/timeline/timeline.component.html +21 -0
- package/src/lib/components/core/timeline/timeline.component.spec.ts +21 -0
- package/src/lib/components/core/timeline/timeline.component.ts +31 -0
- package/src/lib/components/core/timeline/timeline.module.ts +11 -0
- package/src/lib/components/core/tooltip/tooltip.directive.spec.ts +20 -0
- package/src/lib/components/core/tooltip/tooltip.directive.ts +141 -0
- package/src/lib/components/form/autocomplete/autocomplete.component.html +58 -0
- package/src/lib/components/form/autocomplete/autocomplete.component.spec.ts +21 -0
- package/src/lib/components/form/autocomplete/autocomplete.component.ts +130 -0
- package/src/lib/components/form/checkbox/checkbox.component.html +67 -0
- package/src/lib/components/form/checkbox/checkbox.component.spec.ts +21 -0
- package/src/lib/components/form/checkbox/checkbox.component.ts +65 -0
- package/src/lib/components/form/form.module.ts +34 -0
- package/src/lib/components/form/input/input.component.html +92 -0
- package/src/lib/components/form/input/input.component.scss +29 -0
- package/src/lib/components/form/input/input.component.spec.ts +21 -0
- package/src/lib/components/form/input/input.component.ts +234 -0
- package/src/lib/components/form/password-input/password-input.component.html +65 -0
- package/src/lib/components/form/password-input/password-input.component.scss +9 -0
- package/src/lib/components/form/password-input/password-input.component.spec.ts +21 -0
- package/src/lib/components/form/password-input/password-input.component.ts +171 -0
- package/src/lib/components/form/radio-button/radio-button.component.html +50 -0
- package/src/lib/components/form/radio-button/radio-button.component.scss +14 -0
- package/src/lib/components/form/radio-button/radio-button.component.spec.ts +21 -0
- package/src/lib/components/form/radio-button/radio-button.component.ts +82 -0
- package/src/lib/components/form/range/range.component.html +17 -0
- package/src/lib/components/form/range/range.component.scss +17 -0
- package/src/lib/components/form/range/range.component.spec.ts +21 -0
- package/src/lib/components/form/range/range.component.ts +100 -0
- package/src/lib/components/form/rating/rating.component.html +24 -0
- package/src/lib/components/form/rating/rating.component.spec.ts +21 -0
- package/src/lib/components/form/rating/rating.component.ts +52 -0
- package/src/lib/components/form/select/select.component.html +54 -0
- package/src/lib/components/form/select/select.component.scss +3 -0
- package/src/lib/components/form/select/select.component.spec.ts +22 -0
- package/src/lib/components/form/select/select.component.ts +91 -0
- package/src/lib/components/form/textarea/textarea.component.html +28 -0
- package/src/lib/components/form/textarea/textarea.component.scss +12 -0
- package/src/lib/components/form/textarea/textarea.component.spec.ts +21 -0
- package/src/lib/components/form/textarea/textarea.component.ts +61 -0
- package/src/lib/components/form/transfer/store/transfer.reducers.ts +242 -0
- package/src/lib/components/form/transfer/store/transfer.state.ts +20 -0
- package/src/lib/components/form/transfer/store/transfer.store.ts +88 -0
- package/src/lib/components/form/transfer/transfer-list/transfer-list.component.html +42 -0
- package/src/lib/components/form/transfer/transfer-list/transfer-list.component.spec.ts +33 -0
- package/src/lib/components/form/transfer/transfer-list/transfer-list.component.ts +93 -0
- package/src/lib/components/form/transfer/transfer.component.html +52 -0
- package/src/lib/components/form/transfer/transfer.component.spec.ts +27 -0
- package/src/lib/components/form/transfer/transfer.component.ts +159 -0
- package/{lib/components/form/transfer/transfer.model.d.ts → src/lib/components/form/transfer/transfer.model.ts} +9 -2
- package/src/lib/components/form/upload-drag-drop/upload-drag-drop.component.html +36 -0
- package/src/lib/components/form/upload-drag-drop/upload-drag-drop.component.spec.ts +21 -0
- package/src/lib/components/form/upload-drag-drop/upload-drag-drop.component.ts +170 -0
- package/src/lib/components/form/upload-file-list/upload-file-list.component.html +46 -0
- package/src/lib/components/form/upload-file-list/upload-file-list.component.spec.ts +22 -0
- package/src/lib/components/form/upload-file-list/upload-file-list.component.ts +120 -0
- package/src/lib/components/navigation/back-button/back-button.component.html +25 -0
- package/src/lib/components/navigation/back-button/back-button.component.spec.ts +91 -0
- package/src/lib/components/navigation/back-button/back-button.component.ts +67 -0
- package/src/lib/components/navigation/back-to-top/back-to-top.component.html +11 -0
- package/src/lib/components/navigation/back-to-top/back-to-top.component.spec.ts +21 -0
- package/src/lib/components/navigation/back-to-top/back-to-top.component.ts +80 -0
- package/src/lib/components/navigation/breadcrumbs/breadcrumb/breadcrumb.component.html +23 -0
- package/src/lib/components/navigation/breadcrumbs/breadcrumb/breadcrumb.component.spec.ts +21 -0
- package/src/lib/components/navigation/breadcrumbs/breadcrumb/breadcrumb.component.ts +68 -0
- package/src/lib/components/navigation/breadcrumbs/breadcrumb-item/breadcrumb-item.component.html +3 -0
- package/src/lib/components/navigation/breadcrumbs/breadcrumb-item/breadcrumb-item.component.spec.ts +22 -0
- package/src/lib/components/navigation/breadcrumbs/breadcrumb-item/breadcrumb-item.component.ts +29 -0
- package/src/lib/components/navigation/breadcrumbs/breadcrumbs.module.ts +11 -0
- package/src/lib/components/navigation/header/header.component.html +102 -0
- package/src/lib/components/navigation/header/header.component.scss +3 -0
- package/src/lib/components/navigation/header/header.component.spec.ts +21 -0
- package/src/lib/components/navigation/header/header.component.ts +107 -0
- package/src/lib/components/navigation/megamenu/megamenu.component.html +34 -0
- package/src/lib/components/navigation/megamenu/megamenu.component.scss +5 -0
- package/src/lib/components/navigation/megamenu/megamenu.component.ts +30 -0
- package/src/lib/components/navigation/navbar/navbar/navbar.component.html +28 -0
- package/src/lib/components/navigation/navbar/navbar/navbar.component.ts +45 -0
- package/src/lib/components/navigation/navbar/navbar-item/navbar-item.component.html +3 -0
- package/src/lib/components/navigation/navbar/navbar-item/navbar-item.component.ts +10 -0
- package/src/lib/components/navigation/navbar/navbar.module.ts +11 -0
- package/src/lib/components/navigation/navscroll/navscroll-list-item.component.ts +95 -0
- package/src/lib/components/navigation/navscroll/navscroll-list-items.component.ts +27 -0
- package/src/lib/components/navigation/navscroll/navscroll.component.html +101 -0
- package/src/lib/components/navigation/navscroll/navscroll.component.scss +9 -0
- package/src/lib/components/navigation/navscroll/navscroll.component.ts +143 -0
- package/{lib/components/navigation/navscroll/navscroll.model.d.ts → src/lib/components/navigation/navscroll/navscroll.model.ts} +7 -5
- package/src/lib/components/navigation/navscroll/navscroll.store.ts +96 -0
- package/src/lib/components/navigation/navscroll/navscroll.utils.ts +28 -0
- package/src/lib/components/navigation/sidebar/sidebar.component.html +11 -0
- package/src/lib/components/navigation/sidebar/sidebar.component.spec.ts +21 -0
- package/src/lib/components/navigation/sidebar/sidebar.component.ts +39 -0
- package/src/lib/components/navigation/skiplink/skiplink/skiplink.component.html +15 -0
- package/src/lib/components/navigation/skiplink/skiplink/skiplink.component.ts +27 -0
- package/src/lib/components/navigation/skiplink/skiplink-item/skiplink-item.component.html +15 -0
- package/src/lib/components/navigation/skiplink/skiplink-item/skiplink-item.component.ts +38 -0
- package/src/lib/components/navigation/skiplink/skiplink.module.ts +11 -0
- package/src/lib/components/utils/error-page/error-page.component.html +33 -0
- package/src/lib/components/utils/error-page/error-page.component.spec.ts +21 -0
- package/src/lib/components/utils/error-page/error-page.component.ts +79 -0
- package/src/lib/components/utils/icon/icon.component.html +6 -0
- package/src/lib/components/utils/icon/icon.component.spec.ts +21 -0
- package/src/lib/components/utils/icon/icon.component.ts +95 -0
- package/src/lib/components/utils/language-switcher/language-switcher.component.html +21 -0
- package/src/lib/components/utils/language-switcher/language-switcher.component.spec.ts +21 -0
- package/src/lib/components/utils/language-switcher/language-switcher.component.ts +56 -0
- package/src/lib/design-angular-kit.module.ts +131 -0
- package/src/lib/enums/colors.enums.ts +10 -0
- package/src/lib/enums/sizes.enum.ts +7 -0
- package/{lib/interfaces/core.d.ts → src/lib/interfaces/core.ts} +95 -53
- package/src/lib/interfaces/design-angular-kit-config.ts +34 -0
- package/src/lib/interfaces/form.ts +78 -0
- package/src/lib/interfaces/icon.ts +176 -0
- package/src/lib/interfaces/sortable-table.ts +42 -0
- package/src/lib/interfaces/utils.ts +11 -0
- package/src/lib/pipes/date-ago.pipe.ts +57 -0
- package/src/lib/pipes/duration.pipe.ts +112 -0
- package/src/lib/pipes/mark-matching-text.pipe.ts +43 -0
- package/src/lib/provide-design-angular-kit.ts +73 -0
- package/src/lib/services/notification/notification.service.spec.ts +16 -0
- package/src/lib/services/notification/notification.service.ts +119 -0
- package/{lib/utils/coercion.d.ts → src/lib/utils/coercion.ts} +7 -1
- package/src/lib/utils/date-utils.ts +184 -0
- package/src/lib/utils/file-utils.ts +80 -0
- package/src/lib/utils/regex.ts +44 -0
- package/src/lib/validators/it-validators.ts +193 -0
- package/{public_api.d.ts → src/public_api.ts} +43 -0
- package/src/test.ts +26 -0
- package/tsconfig.lib.json +24 -0
- package/tsconfig.lib.prod.json +9 -0
- package/tsconfig.schematics.json +25 -0
- package/tsconfig.spec.json +9 -0
- package/esm2022/design-angular-kit.mjs +0 -5
- package/esm2022/lib/abstracts/abstract-form.component.mjs +0 -186
- package/esm2022/lib/abstracts/abstract.component.mjs +0 -46
- package/esm2022/lib/components/core/accordion/accordion.component.mjs +0 -39
- package/esm2022/lib/components/core/alert/alert.component.mjs +0 -71
- package/esm2022/lib/components/core/avatar/avatar-dropdown/avatar-dropdown.component.mjs +0 -43
- package/esm2022/lib/components/core/avatar/avatar-group/avatar-group.component.mjs +0 -40
- package/esm2022/lib/components/core/avatar/avatar.directive.mjs +0 -78
- package/esm2022/lib/components/core/avatar/avatar.module.mjs +0 -33
- package/esm2022/lib/components/core/badge/badge.directive.mjs +0 -39
- package/esm2022/lib/components/core/button/button.directive.mjs +0 -80
- package/esm2022/lib/components/core/callout/callout.component.mjs +0 -64
- package/esm2022/lib/components/core/card/card.component.mjs +0 -59
- package/esm2022/lib/components/core/carousel/carousel/carousel.component.mjs +0 -84
- package/esm2022/lib/components/core/carousel/carousel-item/carousel-item.component.mjs +0 -19
- package/esm2022/lib/components/core/carousel/carousel.module.mjs +0 -18
- package/esm2022/lib/components/core/chip/chip.component.mjs +0 -136
- package/esm2022/lib/components/core/collapse/collapse.component.mjs +0 -116
- package/esm2022/lib/components/core/dimmer/dimmer-buttons/dimmer-buttons.component.mjs +0 -27
- package/esm2022/lib/components/core/dimmer/dimmer-icon/dimmer-icon.component.mjs +0 -11
- package/esm2022/lib/components/core/dimmer/dimmer.component.mjs +0 -55
- package/esm2022/lib/components/core/dimmer/dimmer.module.mjs +0 -19
- package/esm2022/lib/components/core/dropdown/dropdown/dropdown.component.mjs +0 -144
- package/esm2022/lib/components/core/dropdown/dropdown-item/dropdown-item.component.mjs +0 -61
- package/esm2022/lib/components/core/dropdown/dropdown.module.mjs +0 -18
- package/esm2022/lib/components/core/forward/forward.directive.mjs +0 -57
- package/esm2022/lib/components/core/link/link.component.mjs +0 -42
- package/esm2022/lib/components/core/list/list/list.component.mjs +0 -22
- package/esm2022/lib/components/core/list/list-item/list-item.component.mjs +0 -56
- package/esm2022/lib/components/core/list/list.module.mjs +0 -18
- package/esm2022/lib/components/core/modal/modal.component.mjs +0 -194
- package/esm2022/lib/components/core/notifications/notifications.component.mjs +0 -111
- package/esm2022/lib/components/core/pagination/pagination.component.mjs +0 -130
- package/esm2022/lib/components/core/popover/popover.directive.mjs +0 -176
- package/esm2022/lib/components/core/progress-bar/progress-bar.component.mjs +0 -34
- package/esm2022/lib/components/core/progress-button/progress-button.component.mjs +0 -25
- package/esm2022/lib/components/core/spinner/spinner.component.mjs +0 -30
- package/esm2022/lib/components/core/steppers/steppers-container/steppers-container.component.mjs +0 -116
- package/esm2022/lib/components/core/steppers/steppers-item/steppers-item.component.mjs +0 -22
- package/esm2022/lib/components/core/steppers/steppers.module.mjs +0 -18
- package/esm2022/lib/components/core/tab/tab-container/tab-container.component.mjs +0 -97
- package/esm2022/lib/components/core/tab/tab-item/tab-item.component.mjs +0 -39
- package/esm2022/lib/components/core/tab/tab.module.mjs +0 -18
- package/esm2022/lib/components/core/table/sort/sort-header/sort-header.component.mjs +0 -134
- package/esm2022/lib/components/core/table/sort/sort.directive.mjs +0 -123
- package/esm2022/lib/components/core/table/table.component.mjs +0 -45
- package/esm2022/lib/components/core/table/table.module.mjs +0 -19
- package/esm2022/lib/components/core/timeline/timeline-item/timeline-item.component.mjs +0 -90
- package/esm2022/lib/components/core/timeline/timeline.component.mjs +0 -36
- package/esm2022/lib/components/core/timeline/timeline.module.mjs +0 -18
- package/esm2022/lib/components/core/tooltip/tooltip.directive.mjs +0 -143
- package/esm2022/lib/components/form/autocomplete/autocomplete.component.mjs +0 -112
- package/esm2022/lib/components/form/checkbox/checkbox.component.mjs +0 -48
- package/esm2022/lib/components/form/form.module.mjs +0 -63
- package/esm2022/lib/components/form/input/input.component.mjs +0 -190
- package/esm2022/lib/components/form/password-input/password-input.component.mjs +0 -149
- package/esm2022/lib/components/form/radio-button/radio-button.component.mjs +0 -60
- package/esm2022/lib/components/form/range/range.component.mjs +0 -64
- package/esm2022/lib/components/form/rating/rating.component.mjs +0 -50
- package/esm2022/lib/components/form/select/select.component.mjs +0 -70
- package/esm2022/lib/components/form/textarea/textarea.component.mjs +0 -55
- package/esm2022/lib/components/form/transfer/store/transfer.reducers.mjs +0 -191
- package/esm2022/lib/components/form/transfer/store/transfer.state.mjs +0 -2
- package/esm2022/lib/components/form/transfer/store/transfer.store.mjs +0 -70
- package/esm2022/lib/components/form/transfer/transfer-list/transfer-list.component.mjs +0 -72
- package/esm2022/lib/components/form/transfer/transfer.component.mjs +0 -149
- package/esm2022/lib/components/form/transfer/transfer.model.mjs +0 -6
- package/esm2022/lib/components/form/upload-drag-drop/upload-drag-drop.component.mjs +0 -142
- package/esm2022/lib/components/form/upload-file-list/upload-file-list.component.mjs +0 -107
- package/esm2022/lib/components/navigation/back-button/back-button.component.mjs +0 -67
- package/esm2022/lib/components/navigation/back-to-top/back-to-top.component.mjs +0 -68
- package/esm2022/lib/components/navigation/breadcrumbs/breadcrumb/breadcrumb.component.mjs +0 -51
- package/esm2022/lib/components/navigation/breadcrumbs/breadcrumb-item/breadcrumb-item.component.mjs +0 -21
- package/esm2022/lib/components/navigation/breadcrumbs/breadcrumbs.module.mjs +0 -18
- package/esm2022/lib/components/navigation/header/header.component.mjs +0 -97
- package/esm2022/lib/components/navigation/megamenu/megamenu.component.mjs +0 -27
- package/esm2022/lib/components/navigation/navbar/navbar/navbar.component.mjs +0 -40
- package/esm2022/lib/components/navigation/navbar/navbar-item/navbar-item.component.mjs +0 -11
- package/esm2022/lib/components/navigation/navbar/navbar.module.mjs +0 -18
- package/esm2022/lib/components/navigation/navscroll/navscroll-list-item.component.mjs +0 -98
- package/esm2022/lib/components/navigation/navscroll/navscroll-list-items.component.mjs +0 -44
- package/esm2022/lib/components/navigation/navscroll/navscroll.component.mjs +0 -116
- package/esm2022/lib/components/navigation/navscroll/navscroll.model.mjs +0 -2
- package/esm2022/lib/components/navigation/navscroll/navscroll.store.mjs +0 -68
- package/esm2022/lib/components/navigation/navscroll/navscroll.utils.mjs +0 -23
- package/esm2022/lib/components/navigation/sidebar/sidebar.component.mjs +0 -50
- package/esm2022/lib/components/navigation/skiplink/skiplink/skiplink.component.mjs +0 -27
- package/esm2022/lib/components/navigation/skiplink/skiplink-item/skiplink-item.component.mjs +0 -26
- package/esm2022/lib/components/navigation/skiplink/skiplink.module.mjs +0 -18
- package/esm2022/lib/components/utils/error-page/error-page.component.mjs +0 -74
- package/esm2022/lib/components/utils/icon/icon.component.mjs +0 -63
- package/esm2022/lib/components/utils/language-switcher/language-switcher.component.mjs +0 -50
- package/esm2022/lib/design-angular-kit.module.mjs +0 -233
- package/esm2022/lib/enums/colors.enums.mjs +0 -12
- package/esm2022/lib/enums/sizes.enum.mjs +0 -9
- package/esm2022/lib/interfaces/core.mjs +0 -16
- package/esm2022/lib/interfaces/design-angular-kit-config.mjs +0 -7
- package/esm2022/lib/interfaces/form.mjs +0 -2
- package/esm2022/lib/interfaces/icon.mjs +0 -168
- package/esm2022/lib/interfaces/sortable-table.mjs +0 -6
- package/esm2022/lib/interfaces/utils.mjs +0 -2
- package/esm2022/lib/pipes/date-ago.pipe.mjs +0 -56
- package/esm2022/lib/pipes/duration.pipe.mjs +0 -115
- package/esm2022/lib/pipes/mark-matching-text.pipe.mjs +0 -48
- package/esm2022/lib/provide-design-angular-kit.mjs +0 -64
- package/esm2022/lib/services/notification/notification.service.mjs +0 -120
- package/esm2022/lib/utils/coercion.mjs +0 -18
- package/esm2022/lib/utils/date-utils.mjs +0 -162
- package/esm2022/lib/utils/file-utils.mjs +0 -73
- package/esm2022/lib/utils/regex.mjs +0 -35
- package/esm2022/lib/validators/it-validators.mjs +0 -156
- package/esm2022/public_api.mjs +0 -110
- package/fesm2022/design-angular-kit.mjs +0 -6704
- package/fesm2022/design-angular-kit.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/abstracts/abstract-form.component.d.ts +0 -87
- package/lib/abstracts/abstract.component.d.ts +0 -30
- package/lib/components/core/accordion/accordion.component.d.ts +0 -18
- package/lib/components/core/alert/alert.component.d.ts +0 -44
- package/lib/components/core/avatar/avatar-dropdown/avatar-dropdown.component.d.ts +0 -29
- package/lib/components/core/avatar/avatar-group/avatar-group.component.d.ts +0 -15
- package/lib/components/core/avatar/avatar.directive.d.ts +0 -33
- package/lib/components/core/avatar/avatar.module.d.ts +0 -9
- package/lib/components/core/badge/badge.directive.d.ts +0 -23
- package/lib/components/core/button/button.directive.d.ts +0 -48
- package/lib/components/core/callout/callout.component.d.ts +0 -50
- package/lib/components/core/card/card.component.d.ts +0 -69
- package/lib/components/core/carousel/carousel/carousel.component.d.ts +0 -65
- package/lib/components/core/carousel/carousel-item/carousel-item.component.d.ts +0 -15
- package/lib/components/core/carousel/carousel.module.d.ts +0 -8
- package/lib/components/core/chip/chip.component.d.ts +0 -76
- package/lib/components/core/collapse/collapse.component.d.ts +0 -67
- package/lib/components/core/dimmer/dimmer-buttons/dimmer-buttons.component.d.ts +0 -12
- package/lib/components/core/dimmer/dimmer-icon/dimmer-icon.component.d.ts +0 -5
- package/lib/components/core/dimmer/dimmer.component.d.ts +0 -24
- package/lib/components/core/dimmer/dimmer.module.d.ts +0 -9
- package/lib/components/core/dropdown/dropdown/dropdown.component.d.ts +0 -94
- package/lib/components/core/dropdown/dropdown-item/dropdown-item.component.d.ts +0 -42
- package/lib/components/core/dropdown/dropdown.module.d.ts +0 -8
- package/lib/components/core/forward/forward.directive.d.ts +0 -14
- package/lib/components/core/link/link.component.d.ts +0 -35
- package/lib/components/core/list/list/list.component.d.ts +0 -24
- package/lib/components/core/list/list-item/list-item.component.d.ts +0 -41
- package/lib/components/core/list/list.module.d.ts +0 -8
- package/lib/components/core/modal/modal.component.d.ts +0 -135
- package/lib/components/core/notifications/notifications.component.d.ts +0 -45
- package/lib/components/core/pagination/pagination.component.d.ts +0 -92
- package/lib/components/core/popover/popover.directive.d.ts +0 -99
- package/lib/components/core/progress-bar/progress-bar.component.d.ts +0 -31
- package/lib/components/core/progress-button/progress-button.component.d.ts +0 -21
- package/lib/components/core/spinner/spinner.component.d.ts +0 -24
- package/lib/components/core/steppers/steppers-container/steppers-container.component.d.ts +0 -130
- package/lib/components/core/steppers/steppers-item/steppers-item.component.d.ts +0 -24
- package/lib/components/core/steppers/steppers.module.d.ts +0 -8
- package/lib/components/core/tab/tab-container/tab-container.component.d.ts +0 -60
- package/lib/components/core/tab/tab-item/tab-item.component.d.ts +0 -38
- package/lib/components/core/tab/tab.module.d.ts +0 -8
- package/lib/components/core/table/sort/sort-header/sort-header.component.d.ts +0 -72
- package/lib/components/core/table/sort/sort.directive.d.ts +0 -53
- package/lib/components/core/table/table.component.d.ts +0 -60
- package/lib/components/core/table/table.module.d.ts +0 -9
- package/lib/components/core/timeline/timeline-item/timeline-item.component.d.ts +0 -79
- package/lib/components/core/timeline/timeline.component.d.ts +0 -21
- package/lib/components/core/timeline/timeline.module.d.ts +0 -8
- package/lib/components/core/tooltip/tooltip.directive.d.ts +0 -82
- package/lib/components/form/autocomplete/autocomplete.component.d.ts +0 -59
- package/lib/components/form/checkbox/checkbox.component.d.ts +0 -41
- package/lib/components/form/form.module.d.ts +0 -18
- package/lib/components/form/input/input.component.d.ts +0 -95
- package/lib/components/form/password-input/password-input.component.d.ts +0 -80
- package/lib/components/form/radio-button/radio-button.component.d.ts +0 -38
- package/lib/components/form/range/range.component.d.ts +0 -42
- package/lib/components/form/rating/rating.component.d.ts +0 -24
- package/lib/components/form/select/select.component.d.ts +0 -36
- package/lib/components/form/textarea/textarea.component.d.ts +0 -34
- package/lib/components/form/transfer/store/transfer.reducers.d.ts +0 -103
- package/lib/components/form/transfer/store/transfer.state.d.ts +0 -18
- package/lib/components/form/transfer/store/transfer.store.d.ts +0 -23
- package/lib/components/form/transfer/transfer-list/transfer-list.component.d.ts +0 -48
- package/lib/components/form/transfer/transfer.component.d.ts +0 -75
- package/lib/components/form/upload-drag-drop/upload-drag-drop.component.d.ts +0 -60
- package/lib/components/form/upload-file-list/upload-file-list.component.d.ts +0 -62
- package/lib/components/navigation/back-button/back-button.component.d.ts +0 -47
- package/lib/components/navigation/back-to-top/back-to-top.component.d.ts +0 -50
- package/lib/components/navigation/breadcrumbs/breadcrumb/breadcrumb.component.d.ts +0 -28
- package/lib/components/navigation/breadcrumbs/breadcrumb-item/breadcrumb-item.component.d.ts +0 -23
- package/lib/components/navigation/breadcrumbs/breadcrumbs.module.d.ts +0 -8
- package/lib/components/navigation/header/header.component.d.ts +0 -36
- package/lib/components/navigation/megamenu/megamenu.component.d.ts +0 -22
- package/lib/components/navigation/navbar/navbar/navbar.component.d.ts +0 -16
- package/lib/components/navigation/navbar/navbar-item/navbar-item.component.d.ts +0 -5
- package/lib/components/navigation/navbar/navbar.module.d.ts +0 -8
- package/lib/components/navigation/navscroll/navscroll-list-item.component.d.ts +0 -16
- package/lib/components/navigation/navscroll/navscroll-list-items.component.d.ts +0 -7
- package/lib/components/navigation/navscroll/navscroll.component.d.ts +0 -47
- package/lib/components/navigation/navscroll/navscroll.store.d.ts +0 -16
- package/lib/components/navigation/navscroll/navscroll.utils.d.ts +0 -6
- package/lib/components/navigation/sidebar/sidebar.component.d.ts +0 -26
- package/lib/components/navigation/skiplink/skiplink/skiplink.component.d.ts +0 -17
- package/lib/components/navigation/skiplink/skiplink-item/skiplink-item.component.d.ts +0 -24
- package/lib/components/navigation/skiplink/skiplink.module.d.ts +0 -8
- package/lib/components/utils/error-page/error-page.component.d.ts +0 -44
- package/lib/components/utils/icon/icon.component.d.ts +0 -53
- package/lib/components/utils/language-switcher/language-switcher.component.d.ts +0 -27
- package/lib/design-angular-kit.module.d.ts +0 -53
- package/lib/enums/colors.enums.d.ts +0 -10
- package/lib/enums/sizes.enum.d.ts +0 -7
- package/lib/interfaces/design-angular-kit-config.d.ts +0 -30
- package/lib/interfaces/form.d.ts +0 -67
- package/lib/interfaces/icon.d.ts +0 -4
- package/lib/interfaces/sortable-table.d.ts +0 -33
- package/lib/interfaces/utils.d.ts +0 -10
- package/lib/pipes/date-ago.pipe.d.ts +0 -17
- package/lib/pipes/duration.pipe.d.ts +0 -35
- package/lib/pipes/mark-matching-text.pipe.d.ts +0 -18
- package/lib/provide-design-angular-kit.d.ts +0 -7
- package/lib/services/notification/notification.service.d.ts +0 -63
- package/lib/utils/date-utils.d.ts +0 -79
- package/lib/utils/file-utils.d.ts +0 -32
- package/lib/utils/regex.d.ts +0 -34
- package/lib/validators/it-validators.d.ts +0 -69
- package/schematics/ng-add/index.d.ts +0 -3
- package/schematics/ng-add/index.js +0 -29
- package/schematics/ng-add/index.js.map +0 -1
- package/schematics/ng-add/index.spec.d.ts +0 -1
- package/schematics/ng-add/index.spec.js +0 -43
- package/schematics/ng-add/index.spec.js.map +0 -1
- package/schematics/ng-add/rules/setup-project/add-animations.d.ts +0 -2
- package/schematics/ng-add/rules/setup-project/add-animations.js +0 -11
- package/schematics/ng-add/rules/setup-project/add-animations.js.map +0 -1
- package/schematics/ng-add/rules/setup-project/add-assets.d.ts +0 -3
- package/schematics/ng-add/rules/setup-project/add-assets.js +0 -50
- package/schematics/ng-add/rules/setup-project/add-assets.js.map +0 -1
- package/schematics/ng-add/rules/setup-project/add-design-angular-kit.d.ts +0 -3
- package/schematics/ng-add/rules/setup-project/add-design-angular-kit.js +0 -43
- package/schematics/ng-add/rules/setup-project/add-design-angular-kit.js.map +0 -1
- package/schematics/ng-add/rules/setup-project/add-http-client.d.ts +0 -2
- package/schematics/ng-add/rules/setup-project/add-http-client.js +0 -11
- package/schematics/ng-add/rules/setup-project/add-http-client.js.map +0 -1
- package/schematics/ng-add/rules/setup-project/add-import-to-style-file.d.ts +0 -11
- package/schematics/ng-add/rules/setup-project/add-import-to-style-file.js +0 -112
- package/schematics/ng-add/rules/setup-project/add-import-to-style-file.js.map +0 -1
- package/schematics/ng-add/rules/setup-project/add-localisation.d.ts +0 -3
- package/schematics/ng-add/rules/setup-project/add-localisation.js +0 -50
- package/schematics/ng-add/rules/setup-project/add-localisation.js.map +0 -1
- package/schematics/ng-add/rules/setup-project/angular-json-helper.d.ts +0 -2
- package/schematics/ng-add/rules/setup-project/angular-json-helper.js +0 -13
- package/schematics/ng-add/rules/setup-project/angular-json-helper.js.map +0 -1
- package/schematics/ng-add/rules/setup-project/exceptions.d.ts +0 -7
- package/schematics/ng-add/rules/setup-project/exceptions.js +0 -17
- package/schematics/ng-add/rules/setup-project/exceptions.js.map +0 -1
- package/schematics/ng-add/rules/setup-project/index.js +0 -23
- package/schematics/ng-add/rules/setup-project/index.js.map +0 -1
- package/schematics/ng-add/schema.js +0 -3
- package/schematics/ng-add/schema.js.map +0 -1
- package/schematics/ng-add/setup-project.d.ts +0 -3
- package/schematics/ng-add/setup-project.js +0 -37
- package/schematics/ng-add/setup-project.js.map +0 -1
- package/schematics/ng-add/setup-project.spec.d.ts +0 -1
- package/schematics/ng-add/setup-project.spec.js +0 -139
- package/schematics/ng-add/setup-project.spec.js.map +0 -1
- package/schematics/ng-add/utils.d.ts +0 -14
- package/schematics/ng-add/utils.js +0 -49
- package/schematics/ng-add/utils.js.map +0 -1
- package/schematics/ng-add/versions-helper.d.ts +0 -3
- package/schematics/ng-add/versions-helper.js +0 -40
- package/schematics/ng-add/versions-helper.js.map +0 -1
- /package/schematics/ng-add/rules/setup-project/{index.d.ts → index.ts} +0 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
|
|
2
|
+
import { ItAbstractFormComponent } from '../../../abstracts/abstract-form.component';
|
|
3
|
+
import { InputControlType } from '../../../interfaces/form';
|
|
4
|
+
import { AbstractControl, ReactiveFormsModule, ValidatorFn, Validators } from '@angular/forms';
|
|
5
|
+
import { ItValidators } from '../../../validators/it-validators';
|
|
6
|
+
import { Observable } from 'rxjs';
|
|
7
|
+
import { AsyncPipe } from '@angular/common';
|
|
8
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
9
|
+
import { inputToBoolean } from '../../../utils/coercion';
|
|
10
|
+
|
|
11
|
+
@Component({
|
|
12
|
+
standalone: true,
|
|
13
|
+
selector: 'it-input',
|
|
14
|
+
templateUrl: './input.component.html',
|
|
15
|
+
styleUrls: ['./input.component.scss'],
|
|
16
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
17
|
+
imports: [ReactiveFormsModule, TranslateModule, AsyncPipe],
|
|
18
|
+
})
|
|
19
|
+
export class ItInputComponent extends ItAbstractFormComponent<string | number | null | undefined> implements OnInit {
|
|
20
|
+
/**
|
|
21
|
+
* The input type
|
|
22
|
+
* @default text
|
|
23
|
+
*/
|
|
24
|
+
@Input() type: InputControlType = 'text';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The input placeholder
|
|
28
|
+
*/
|
|
29
|
+
@Input() placeholder = '';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The input description
|
|
33
|
+
*/
|
|
34
|
+
@Input() description: string | undefined;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* To prevent modification of the contained value.
|
|
38
|
+
* - <b>plaintext</b>: Readonly field in the form stylized as plain text
|
|
39
|
+
* @default undefined
|
|
40
|
+
*/
|
|
41
|
+
@Input() readonly: boolean | 'plaintext' | undefined;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The max date value [Used only in type = 'date']
|
|
45
|
+
* @default '9999-12-31'
|
|
46
|
+
* @example 'yyyy-mm-dd'
|
|
47
|
+
*/
|
|
48
|
+
@Input() maxDate?: string = '9999-12-31';
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The min date value [Used only in type = 'date']
|
|
52
|
+
* @example 'yyyy-mm-dd'
|
|
53
|
+
*/
|
|
54
|
+
@Input() minDate: string | undefined;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The max value [Used only in type = 'number']
|
|
58
|
+
*/
|
|
59
|
+
@Input() max: number | undefined;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The min value [Used only in type = 'number']
|
|
63
|
+
*/
|
|
64
|
+
@Input() min: number | undefined;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The step value [Used only in type = 'number']
|
|
68
|
+
*/
|
|
69
|
+
@Input() step: number | 'any' | undefined;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* If is a currency number [Used only in type = 'number']
|
|
73
|
+
* @default false
|
|
74
|
+
*/
|
|
75
|
+
@Input({ transform: inputToBoolean }) currency?: boolean;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* If is a percentage number [Used only in type = 'number']
|
|
79
|
+
* @default false
|
|
80
|
+
*/
|
|
81
|
+
@Input({ transform: inputToBoolean }) percentage?: boolean;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The currency or percentage symbol [Used only if percentage or currency]
|
|
85
|
+
* @example '$'
|
|
86
|
+
*/
|
|
87
|
+
@Input() symbol: string | undefined;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* To make the numeric field automatically resize according to the value contained in it. [Used only in type = 'number']
|
|
91
|
+
* @default false
|
|
92
|
+
*/
|
|
93
|
+
@Input({ transform: inputToBoolean }) adaptive?: boolean;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Input autocomplete attribute (Browser autocomplete)
|
|
97
|
+
* @default undefined
|
|
98
|
+
*/
|
|
99
|
+
@Input() autocomplete: string | undefined;
|
|
100
|
+
|
|
101
|
+
get isActiveLabel(): boolean {
|
|
102
|
+
const value = this.control.value;
|
|
103
|
+
if ((!!value && value !== 0) || value === 0 || !!this.placeholder) {
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// if (this.type === 'number' && (!!this.currency || !!this.percentage)) {
|
|
108
|
+
// return true;
|
|
109
|
+
// }
|
|
110
|
+
|
|
111
|
+
return this.type === 'date' || this.type === 'time' || this.type === 'color';
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Check is readonly field
|
|
116
|
+
*/
|
|
117
|
+
protected get isReadonly(): boolean {
|
|
118
|
+
return this.readonly === 'plaintext' || !!this.readonly;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Return the invalid message string from TranslateService
|
|
123
|
+
*/
|
|
124
|
+
override get invalidMessage(): Observable<string> {
|
|
125
|
+
if (this.hasError('min') && this.min) {
|
|
126
|
+
return this._translateService.get('it.errors.min-invalid', {
|
|
127
|
+
min: this.min,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
if (this.hasError('max') && this.max) {
|
|
131
|
+
return this._translateService.get('it.errors.max-invalid', {
|
|
132
|
+
max: this.max,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
if (this.hasError('minlength')) {
|
|
136
|
+
const error = this.getError('minlength');
|
|
137
|
+
return this._translateService.get('it.errors.min-length-invalid', {
|
|
138
|
+
min: error.requiredLength,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
if (this.hasError('maxlength')) {
|
|
142
|
+
const error = this.getError('maxlength');
|
|
143
|
+
return this._translateService.get('it.errors.max-length-invalid', {
|
|
144
|
+
max: error.requiredLength,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
if (this.hasError('email') || this.hasError('invalidEmail')) {
|
|
148
|
+
return this._translateService.get('it.errors.email-invalid');
|
|
149
|
+
}
|
|
150
|
+
if (this.hasError('invalidTel')) {
|
|
151
|
+
return this._translateService.get('it.errors.tel-invalid');
|
|
152
|
+
}
|
|
153
|
+
if (this.hasError('invalidUrl')) {
|
|
154
|
+
return this._translateService.get('it.errors.url-invalid');
|
|
155
|
+
}
|
|
156
|
+
if (this.hasError('invalidTaxCode')) {
|
|
157
|
+
return this._translateService.get('it.errors.tax-code-invalid');
|
|
158
|
+
}
|
|
159
|
+
if (this.hasError('invalidVatNumber')) {
|
|
160
|
+
return this._translateService.get('it.errors.vat-number-invalid');
|
|
161
|
+
}
|
|
162
|
+
if (this.hasError('invalidCap')) {
|
|
163
|
+
return this._translateService.get('it.errors.cap-invalid');
|
|
164
|
+
}
|
|
165
|
+
if (this.hasError('invalidIban')) {
|
|
166
|
+
return this._translateService.get('it.errors.iban-invalid');
|
|
167
|
+
}
|
|
168
|
+
if (this.hasError('invalidPlate')) {
|
|
169
|
+
return this._translateService.get('it.errors.plate-invalid');
|
|
170
|
+
}
|
|
171
|
+
if (this.hasError('invalidRegex')) {
|
|
172
|
+
return this._translateService.get('it.errors.regex-invalid');
|
|
173
|
+
}
|
|
174
|
+
if (this.hasError('pattern')) {
|
|
175
|
+
const error = this.getError('pattern');
|
|
176
|
+
return this._translateService.get('it.errors.pattern-invalid', {
|
|
177
|
+
pattern: error.requiredPattern,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return super.invalidMessage;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
override ngOnInit() {
|
|
185
|
+
super.ngOnInit();
|
|
186
|
+
|
|
187
|
+
const validators: Array<ValidatorFn> = [];
|
|
188
|
+
switch (this.type) {
|
|
189
|
+
case 'number':
|
|
190
|
+
if (this.percentage) {
|
|
191
|
+
this.min = this.min || 0;
|
|
192
|
+
this.max = this.max || 100;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Dynamic min/max validators
|
|
196
|
+
validators.push((control: AbstractControl) => (this.min ? Validators.min(this.min)(control) : null));
|
|
197
|
+
validators.push((control: AbstractControl) => (this.max ? Validators.max(this.max)(control) : null));
|
|
198
|
+
break;
|
|
199
|
+
case 'email':
|
|
200
|
+
validators.push(ItValidators.email);
|
|
201
|
+
break;
|
|
202
|
+
case 'tel':
|
|
203
|
+
validators.push(ItValidators.tel);
|
|
204
|
+
break;
|
|
205
|
+
case 'url':
|
|
206
|
+
validators.push(ItValidators.url);
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
this.addValidators(validators);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Increment or decrease the input number value of step
|
|
215
|
+
* @param decrease true to decrease value
|
|
216
|
+
*/
|
|
217
|
+
protected incrementNumber(decrease = false): void {
|
|
218
|
+
if (this.type !== 'number') {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
const step = this.step === 'any' ? 1 : this.step ?? 1;
|
|
222
|
+
let value = Number(this.control.value);
|
|
223
|
+
value = (isNaN(value) ? 0 : value) + (decrease ? -step : step);
|
|
224
|
+
value = Math.round(value * 1e12) / 1e12; // prevent js decimal error
|
|
225
|
+
|
|
226
|
+
if (this.min !== undefined && value < this.min) {
|
|
227
|
+
value = this.min;
|
|
228
|
+
} else if (this.max !== undefined && value > this.max) {
|
|
229
|
+
value = this.max;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
this.control.setValue(value);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<div class="form-group">
|
|
2
|
+
@if (label) {
|
|
3
|
+
<label [for]="id" [class.active]="!!control.value || !!placeholder">{{ label }}</label>
|
|
4
|
+
}
|
|
5
|
+
<input
|
|
6
|
+
#input
|
|
7
|
+
[id]="id"
|
|
8
|
+
type="password"
|
|
9
|
+
class="form-control input-password"
|
|
10
|
+
[class.is-invalid]="isInvalid"
|
|
11
|
+
[class.is-valid]="isValid"
|
|
12
|
+
[formControl]="control"
|
|
13
|
+
[placeholder]="placeholder"
|
|
14
|
+
[attr.aria-describedby]="id + '-description'"
|
|
15
|
+
[autocomplete]="confirmPasswordField ? 'off' : autocomplete" />
|
|
16
|
+
|
|
17
|
+
<span class="password-icon" aria-hidden="true">
|
|
18
|
+
<it-icon name="password-visible" size="sm" class="password-icon-visible"></it-icon>
|
|
19
|
+
<it-icon name="password-invisible" size="sm" class="password-icon-invisible d-none"></it-icon>
|
|
20
|
+
</span>
|
|
21
|
+
|
|
22
|
+
@if (isInvalid) {
|
|
23
|
+
<div [id]="id + '-error'" class="form-feedback just-validate-error-label">
|
|
24
|
+
<div #customError>
|
|
25
|
+
<ng-content select="[error]"></ng-content>
|
|
26
|
+
</div>
|
|
27
|
+
@if (!customError.hasChildNodes()) {
|
|
28
|
+
{{ invalidMessage | async }}
|
|
29
|
+
}
|
|
30
|
+
</div>
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@if (description !== undefined && !isStrengthMeter) {
|
|
34
|
+
<small [id]="id + '-description'" class="form-text">
|
|
35
|
+
{{ description !== true ? description : (strengthMeterDescription | async) }}
|
|
36
|
+
</small>
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
<small class="password-caps form-text text-warning position-absolute bg-white w-100">
|
|
40
|
+
{{ 'it.form.caps-inserted' | translate }}
|
|
41
|
+
</small>
|
|
42
|
+
|
|
43
|
+
@if (isStrengthMeter) {
|
|
44
|
+
<div class="password-strength-meter">
|
|
45
|
+
<small
|
|
46
|
+
[id]="id + '-description'"
|
|
47
|
+
class="form-text text-muted"
|
|
48
|
+
[attr.data-bs-short-pass]="'it.form.password-strength-meter.password-short' | translate"
|
|
49
|
+
[attr.data-bs-bad-pas]="'it.form.password-strength-meter.password-bad' | translate"
|
|
50
|
+
[attr.data-bs-good-pass]="'it.form.password-strength-meter.password-good' | translate"
|
|
51
|
+
[attr.data-bs-strong-pass]="'it.form.password-strength-meter.password-strong' | translate">
|
|
52
|
+
{{ description !== undefined && description !== true ? description : (strengthMeterDescription | async) }}
|
|
53
|
+
</small>
|
|
54
|
+
<div class="password-meter progress rounded-0 position-absolute">
|
|
55
|
+
<div class="row position-absolute w-100 m-0">
|
|
56
|
+
<div class="col-3 border-start border-end border-white"></div>
|
|
57
|
+
<div class="col-3 border-start border-end border-white"></div>
|
|
58
|
+
<div class="col-3 border-start border-end border-white"></div>
|
|
59
|
+
<div class="col-3 border-start border-end border-white"></div>
|
|
60
|
+
</div>
|
|
61
|
+
<div class="progress-bar bg-muted" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
}
|
|
65
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { ItPasswordInputComponent } from './password-input.component';
|
|
4
|
+
import { tb_base } from '../../../../test';
|
|
5
|
+
|
|
6
|
+
describe('ItPasswordInputComponent', () => {
|
|
7
|
+
let component: ItPasswordInputComponent;
|
|
8
|
+
let fixture: ComponentFixture<ItPasswordInputComponent>;
|
|
9
|
+
|
|
10
|
+
beforeEach(async () => {
|
|
11
|
+
await TestBed.configureTestingModule(tb_base).compileComponents();
|
|
12
|
+
|
|
13
|
+
fixture = TestBed.createComponent(ItPasswordInputComponent);
|
|
14
|
+
component = fixture.componentInstance;
|
|
15
|
+
fixture.detectChanges();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should create', () => {
|
|
19
|
+
expect(component).toBeTruthy();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core';
|
|
2
|
+
import { ItAbstractFormComponent } from '../../../abstracts/abstract-form.component';
|
|
3
|
+
import { ItValidators } from '../../../validators/it-validators';
|
|
4
|
+
import { map, Observable } from 'rxjs';
|
|
5
|
+
import { InputPassword } from 'bootstrap-italia';
|
|
6
|
+
import { ReactiveFormsModule, Validators } from '@angular/forms';
|
|
7
|
+
import { AsyncPipe } from '@angular/common';
|
|
8
|
+
import { ItIconComponent } from '../../utils/icon/icon.component';
|
|
9
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
10
|
+
import { inputToBoolean } from '../../../utils/coercion';
|
|
11
|
+
|
|
12
|
+
@Component({
|
|
13
|
+
standalone: true,
|
|
14
|
+
selector: 'it-password-input',
|
|
15
|
+
templateUrl: './password-input.component.html',
|
|
16
|
+
styleUrls: ['./password-input.component.scss'],
|
|
17
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
18
|
+
imports: [ReactiveFormsModule, ItIconComponent, AsyncPipe, TranslateModule],
|
|
19
|
+
})
|
|
20
|
+
export class ItPasswordInputComponent extends ItAbstractFormComponent<string | null | undefined> implements OnInit, AfterViewInit {
|
|
21
|
+
/**
|
|
22
|
+
* The field is required
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
@Input() required: boolean = true;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The password minimum length
|
|
29
|
+
* @default 10
|
|
30
|
+
*/
|
|
31
|
+
@Input() minLength: number = 10;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The password must contain at least one number
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
37
|
+
@Input() useNumber: boolean = true;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The password must contain at least one uppercase character
|
|
41
|
+
* @default true
|
|
42
|
+
*/
|
|
43
|
+
@Input() useCapitalCase: boolean = true;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The password must contain at least one lowercase character
|
|
47
|
+
* @default true
|
|
48
|
+
*/
|
|
49
|
+
@Input() useSmallCase: boolean = true;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The password must contain at least one special character
|
|
53
|
+
* @default true
|
|
54
|
+
*/
|
|
55
|
+
@Input() useSpecialCharacters: boolean = true;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The input placeholder
|
|
59
|
+
*/
|
|
60
|
+
@Input() placeholder: string = '';
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The input description
|
|
64
|
+
* - <b>true</b>: show the StrengthMeter description message
|
|
65
|
+
* - <b>string</b>: show custom description
|
|
66
|
+
* @default true for StrengthMeter mode else is undefined
|
|
67
|
+
*/
|
|
68
|
+
@Input() description: string | true | undefined;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Enable to show the strength meter
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
74
|
+
@Input({ transform: inputToBoolean }) showStrengthMeter?: boolean;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Is the confirmation password field
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
80
|
+
@Input({ transform: inputToBoolean }) confirmPasswordField?: boolean;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Input autocomplete attribute (Browser autocomplete)
|
|
84
|
+
* @default undefined
|
|
85
|
+
*/
|
|
86
|
+
@Input() autocomplete: string | undefined;
|
|
87
|
+
|
|
88
|
+
private inputPasswordBs?: InputPassword;
|
|
89
|
+
|
|
90
|
+
@ViewChild('input') private inputElement?: ElementRef<HTMLInputElement>;
|
|
91
|
+
|
|
92
|
+
override ngOnInit() {
|
|
93
|
+
super.ngOnInit();
|
|
94
|
+
|
|
95
|
+
if (!this.confirmPasswordField) {
|
|
96
|
+
this.addValidators(
|
|
97
|
+
ItValidators.password(
|
|
98
|
+
this.minLength,
|
|
99
|
+
this.useNumber,
|
|
100
|
+
this.useCapitalCase,
|
|
101
|
+
this.useSmallCase,
|
|
102
|
+
this.useSpecialCharacters,
|
|
103
|
+
this.required
|
|
104
|
+
)
|
|
105
|
+
);
|
|
106
|
+
} else if (this.required) {
|
|
107
|
+
this.addValidators(Validators.required);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
override ngAfterViewInit() {
|
|
112
|
+
super.ngAfterViewInit();
|
|
113
|
+
|
|
114
|
+
if (this.inputElement) {
|
|
115
|
+
this.inputPasswordBs = InputPassword.getOrCreateInstance(this.inputElement.nativeElement, {
|
|
116
|
+
showText: this.isStrengthMeter,
|
|
117
|
+
minimumLength: this.minLength,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
protected get isStrengthMeter(): boolean {
|
|
123
|
+
return !this.confirmPasswordField && !!this.showStrengthMeter;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Return the invalid message string from TranslateService
|
|
128
|
+
*/
|
|
129
|
+
override get invalidMessage(): Observable<string> {
|
|
130
|
+
if (this.hasError('noPasswordMatch')) {
|
|
131
|
+
return this._translateService.get('it.errors.password-no-match');
|
|
132
|
+
}
|
|
133
|
+
if (this.hasError('minlength')) {
|
|
134
|
+
return this._translateService.get('it.errors.password-min-length', {
|
|
135
|
+
minLength: this.minLength,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
if (this.hasError('hasNumber')) {
|
|
139
|
+
return this._translateService.get('it.errors.password-number');
|
|
140
|
+
}
|
|
141
|
+
if (this.hasError('hasCapitalCase')) {
|
|
142
|
+
return this._translateService.get('it.errors.password-capital-case');
|
|
143
|
+
}
|
|
144
|
+
if (this.hasError('hasSmallCase')) {
|
|
145
|
+
return this._translateService.get('it.errors.password-capital-case');
|
|
146
|
+
}
|
|
147
|
+
if (this.hasError('hasSpecialCharacters')) {
|
|
148
|
+
return this._translateService.get('it.errors.password-special-character');
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return super.invalidMessage;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Retrieve the default StrengthMeter description message from TranslateService
|
|
156
|
+
*/
|
|
157
|
+
protected get strengthMeterDescription(): Observable<string> {
|
|
158
|
+
const keys = ['it.form.password-strength-meter.description.default'];
|
|
159
|
+
if (this.useNumber) {
|
|
160
|
+
keys.push('it.form.password-strength-meter.description.number');
|
|
161
|
+
}
|
|
162
|
+
if (this.useCapitalCase) {
|
|
163
|
+
keys.push('it.form.password-strength-meter.description.capital-case');
|
|
164
|
+
}
|
|
165
|
+
if (this.useSpecialCharacters) {
|
|
166
|
+
keys.push('it.form.password-strength-meter.description.special-character');
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return this._translateService.get(keys, { minLength: this.minLength }).pipe(map(labels => Object.values(labels).join(', ')));
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<ng-container>
|
|
2
|
+
<div class="form-check" [class.form-check-group]="group" [class.form-check-inline]="inline">
|
|
3
|
+
<input
|
|
4
|
+
[id]="id"
|
|
5
|
+
type="radio"
|
|
6
|
+
[value]="value"
|
|
7
|
+
[name]="name"
|
|
8
|
+
[class.is-invalid]="isInvalid"
|
|
9
|
+
[class.is-valid]="isValid"
|
|
10
|
+
[formControl]="control"
|
|
11
|
+
[attr.aria-describedby]="id + '-help'" />
|
|
12
|
+
|
|
13
|
+
<label class="form-check-label" [for]="id">
|
|
14
|
+
<div #customLabel>
|
|
15
|
+
<ng-content select="[label]"></ng-content>
|
|
16
|
+
</div>
|
|
17
|
+
@if (!customLabel.hasChildNodes()) {
|
|
18
|
+
{{ label }}
|
|
19
|
+
}
|
|
20
|
+
</label>
|
|
21
|
+
|
|
22
|
+
@if (group) {
|
|
23
|
+
<small [id]="id + '-help'" class="form-text">
|
|
24
|
+
<ng-content></ng-content>
|
|
25
|
+
</small>
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@if (isInvalid && group) {
|
|
29
|
+
<div class="form-feedback just-validate-error-label" [id]="id + '-error'">
|
|
30
|
+
<div #customError>
|
|
31
|
+
<ng-content select="[error]"></ng-content>
|
|
32
|
+
</div>
|
|
33
|
+
@if (!customError.hasChildNodes()) {
|
|
34
|
+
{{ invalidMessage | async }}
|
|
35
|
+
}
|
|
36
|
+
</div>
|
|
37
|
+
}
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
@if (isInvalid && !group) {
|
|
41
|
+
<div class="form-feedback just-validate-error-label" [id]="id + '-error'">
|
|
42
|
+
<div #customError>
|
|
43
|
+
<ng-content select="[error]"></ng-content>
|
|
44
|
+
</div>
|
|
45
|
+
@if (!customError.hasChildNodes()) {
|
|
46
|
+
{{ invalidMessage | async }}
|
|
47
|
+
}
|
|
48
|
+
</div>
|
|
49
|
+
}
|
|
50
|
+
</ng-container>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//@import 'bootstrap-italia/src/scss/functions';
|
|
2
|
+
//@import 'bootstrap-italia/src/scss/utilities/colors_vars';
|
|
3
|
+
//
|
|
4
|
+
//.form-check {
|
|
5
|
+
//
|
|
6
|
+
// [type=radio].is-invalid:not(:checked) + label::after,
|
|
7
|
+
// [type=radio].is-invalid:not(:checked) + label::before {
|
|
8
|
+
// border-color: $danger;
|
|
9
|
+
// }
|
|
10
|
+
//
|
|
11
|
+
// [type=radio].is-invalid:not(:checked) + label {
|
|
12
|
+
// color: $danger;
|
|
13
|
+
// }
|
|
14
|
+
//}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { ItRadioButtonComponent } from './radio-button.component';
|
|
4
|
+
import { tb_base } from '../../../../test';
|
|
5
|
+
|
|
6
|
+
describe('ItRadioButtonComponent', () => {
|
|
7
|
+
let component: ItRadioButtonComponent;
|
|
8
|
+
let fixture: ComponentFixture<ItRadioButtonComponent>;
|
|
9
|
+
|
|
10
|
+
beforeEach(async () => {
|
|
11
|
+
await TestBed.configureTestingModule(tb_base).compileComponents();
|
|
12
|
+
|
|
13
|
+
fixture = TestBed.createComponent(ItRadioButtonComponent);
|
|
14
|
+
component = fixture.componentInstance;
|
|
15
|
+
fixture.detectChanges();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should create', () => {
|
|
19
|
+
expect(component).toBeTruthy();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
|
|
2
|
+
import { ItAbstractFormComponent } from '../../../abstracts/abstract-form.component';
|
|
3
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
4
|
+
import { AsyncPipe } from '@angular/common';
|
|
5
|
+
import { inputToBoolean } from '../../../utils/coercion';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
standalone: true,
|
|
9
|
+
selector: 'it-radio-button',
|
|
10
|
+
templateUrl: './radio-button.component.html',
|
|
11
|
+
styleUrls: ['./radio-button.component.scss'],
|
|
12
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
13
|
+
imports: [ReactiveFormsModule, AsyncPipe],
|
|
14
|
+
})
|
|
15
|
+
export class ItRadioButtonComponent extends ItAbstractFormComponent<string | number | null | undefined> implements OnInit {
|
|
16
|
+
/**
|
|
17
|
+
* The radio value
|
|
18
|
+
*/
|
|
19
|
+
@Input({ required: true }) value: string | number | undefined | null;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* If show radio inline
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
@Input({ transform: inputToBoolean }) inline?: boolean;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* If is radio group
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
@Input({ transform: inputToBoolean }) group?: boolean;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* If is radio is checked
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
@Input({ transform: inputToBoolean }) checked?: boolean;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Set the radio name manually.
|
|
41
|
+
* For example when the radio button name is duplicated inside page
|
|
42
|
+
* @default by default the radio name is calculated from form field name
|
|
43
|
+
*/
|
|
44
|
+
@Input() forceRadioName?: string;
|
|
45
|
+
|
|
46
|
+
get name(): string {
|
|
47
|
+
if (this.forceRadioName) {
|
|
48
|
+
return this.forceRadioName;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
let name = '';
|
|
52
|
+
if (this._ngControl) {
|
|
53
|
+
name = this._ngControl.name?.toString() || '';
|
|
54
|
+
|
|
55
|
+
// Retrieve parent name, prevent duplicate name inside FormArray or nested FormGroup
|
|
56
|
+
let control = this._ngControl.control?.parent;
|
|
57
|
+
while (control?.parent) {
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
|
+
const controls: { [key: string]: any } = control?.parent?.controls || {};
|
|
60
|
+
const parentName = Object.keys(controls).find(name => control === controls[name]) || null;
|
|
61
|
+
if (!parentName) {
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
name = `${parentName}.${name}`; // parent.0.radioName
|
|
65
|
+
control = control.parent;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return name;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
override ngOnInit() {
|
|
73
|
+
super.ngOnInit();
|
|
74
|
+
|
|
75
|
+
if (this.control.value || !this.value || !this.checked) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
this.writeValue(this.value);
|
|
80
|
+
return this.onChange(this.value);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<div class="d-flex justify-content-between align-items-center">
|
|
2
|
+
@if (label) {
|
|
3
|
+
<label [for]="id" class="form-label">{{ label }}</label>
|
|
4
|
+
}
|
|
5
|
+
<ng-content></ng-content>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<input
|
|
9
|
+
#slider
|
|
10
|
+
[id]="id"
|
|
11
|
+
type="range"
|
|
12
|
+
[min]="min"
|
|
13
|
+
[max]="max"
|
|
14
|
+
[step]="step"
|
|
15
|
+
class="form-range"
|
|
16
|
+
[class.double-color]="!!leftColor && !!rightColor"
|
|
17
|
+
[formControl]="control" />
|