@unipin/angular-applet 18.9.2 → 18.9.4
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/.editorconfig +16 -0
- package/.eslintrc.json +72 -0
- package/.github/ISSUE_TEMPLATE/bug_fix.yml +60 -0
- package/.github/ISSUE_TEMPLATE/dependency_update.yml +20 -0
- package/.github/ISSUE_TEMPLATE/documentation.yml +13 -0
- package/.github/ISSUE_TEMPLATE/engineering.yml +22 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +38 -0
- package/.github/ISSUE_TEMPLATE/testing.yml +38 -0
- package/.github/dependabot.yml +11 -0
- package/.github/pull_request_template.md +77 -0
- package/.github/workflows/npm_publish.yml +52 -0
- package/.storybook/main.ts +28 -0
- package/.storybook/preview.ts +19 -0
- package/.storybook/test-runner.ts +29 -0
- package/.storybook/tsconfig.json +14 -0
- package/.storybook/typings.d.ts +4 -0
- package/.vscode/extensions.json +7 -0
- package/.vscode/launch.json +20 -0
- package/.vscode/settings.json +16 -0
- package/.vscode/tasks.json +42 -0
- package/README.md +11 -8
- package/angular.json +102 -0
- package/codegen.yml +8 -0
- package/package.json +86 -38
- package/projects/unipin-angular/README.md +24 -0
- package/projects/unipin-angular/documentation.json +116258 -0
- package/projects/unipin-angular/ng-package.json +19 -0
- package/projects/unipin-angular/package-lock.json +23 -0
- package/projects/unipin-angular/package.json +32 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_accordion.scss +149 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_alert.scss +71 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_badge.scss +38 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_breadcrumb.scss +40 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_button-group.scss +142 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_buttons.scss +209 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_card.scss +234 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_carousel.scss +226 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_close.scss +40 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_containers.scss +41 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_dropdown.scss +249 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_forms.scss +9 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_functions.scss +302 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_grid.scss +33 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_helpers.scss +10 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_images.scss +42 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_list-group.scss +192 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_maps.scss +54 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_mixins.scss +43 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_modal.scss +237 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_nav.scss +172 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_navbar.scss +278 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_offcanvas.scss +144 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_pagination.scss +109 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_placeholders.scss +51 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_popover.scss +196 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_progress.scss +59 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_reboot.scss +610 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_root.scss +73 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_spinners.scss +85 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_tables.scss +164 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_toasts.scss +73 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_tooltip.scss +120 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_transitions.scss +27 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_type.scss +106 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_utilities.scss +647 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_variables.scss +1634 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/bootstrap-grid.scss +64 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/bootstrap-reboot.scss +9 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/bootstrap-utilities.scss +18 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/bootstrap.scss +24 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/forms/_floating-labels.scss +75 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/forms/_form-check.scss +175 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/forms/_form-control.scss +195 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/forms/_form-range.scss +91 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/forms/_form-select.scss +71 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/forms/_form-text.scss +11 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/forms/_input-group.scss +132 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/forms/_labels.scss +36 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/forms/_validation.scss +12 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/helpers/_clearfix.scss +3 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/helpers/_color-bg.scss +10 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/helpers/_colored-links.scss +12 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/helpers/_position.scss +36 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/helpers/_ratio.scss +26 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/helpers/_stacks.scss +15 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/helpers/_stretched-link.scss +15 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/helpers/_text-truncation.scss +7 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/helpers/_visually-hidden.scss +8 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/helpers/_vr.scss +8 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_alert.scss +15 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_backdrop.scss +14 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_banner.scss +9 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_border-radius.scss +78 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_box-shadow.scss +18 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_breakpoints.scss +127 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_buttons.scss +70 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_caret.scss +64 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_clearfix.scss +9 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_color-scheme.scss +7 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_container.scss +11 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_deprecate.scss +10 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_forms.scss +152 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_gradients.scss +47 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_grid.scss +151 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_image.scss +16 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_list-group.scss +24 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_lists.scss +7 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_pagination.scss +10 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_reset-text.scss +17 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_resize.scss +6 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_table-variants.scss +24 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_text-truncate.scss +8 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_transition.scss +26 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_utilities.scss +97 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_visually-hidden.scss +29 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/utilities/_api.scss +47 -0
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/vendor/_rfs.scss +354 -0
- package/projects/unipin-angular/src/assets/private/scss/theme/variables.scss +59 -0
- package/projects/unipin-angular/src/graphql/generated.d.ts +715 -0
- package/projects/unipin-angular/src/graphql/generated.mjs +49 -0
- package/projects/unipin-angular/src/graphql/generated.ts +19998 -0
- package/projects/unipin-angular/src/lib/components/approval/detail/approval-detail.component.html +14 -0
- package/projects/unipin-angular/src/lib/components/approval/detail/approval-detail.component.scss +0 -0
- package/projects/unipin-angular/src/lib/components/approval/detail/approval-detail.component.ts +90 -0
- package/projects/unipin-angular/src/lib/components/approval/detail/approval-detail.stories.ts +61 -0
- package/projects/unipin-angular/src/lib/components/approval/form/approval-form.component.html +41 -0
- package/projects/unipin-angular/src/lib/components/approval/form/approval-form.component.scss +0 -0
- package/projects/unipin-angular/src/lib/components/approval/form/approval-form.component.ts +152 -0
- package/projects/unipin-angular/src/lib/components/approval/form/approval-form.stories.ts +111 -0
- package/{lib/components/approval/index.d.ts → projects/unipin-angular/src/lib/components/approval/index.ts} +1 -0
- package/projects/unipin-angular/src/lib/components/approval/list/approval-list.component.html +15 -0
- package/projects/unipin-angular/src/lib/components/approval/list/approval-list.component.scss +0 -0
- package/projects/unipin-angular/src/lib/components/approval/list/approval-list.component.ts +136 -0
- package/projects/unipin-angular/src/lib/components/approval/list/approval-list.stories.ts +141 -0
- package/projects/unipin-angular/src/lib/components/approval/list/provide-approval-entities.util.ts +10 -0
- package/projects/unipin-angular/src/lib/components/approval/services/approval.service.ts +46 -0
- package/projects/unipin-angular/src/lib/components/audit/detail/audit-detail.component.html +50 -0
- package/projects/unipin-angular/src/lib/components/audit/detail/audit-detail.component.scss +4 -0
- package/projects/unipin-angular/src/lib/components/audit/detail/audit-detail.component.spec.ts +51 -0
- package/projects/unipin-angular/src/lib/components/audit/detail/audit-detail.component.ts +141 -0
- package/projects/unipin-angular/src/lib/components/audit/detail/audit-detail.stories.ts +126 -0
- package/projects/unipin-angular/src/lib/components/audit/list/audit-list.component.html +5 -0
- package/projects/unipin-angular/src/lib/components/audit/list/audit-list.component.scss +0 -0
- package/projects/unipin-angular/src/lib/components/audit/list/audit-list.component.ts +85 -0
- package/projects/unipin-angular/src/lib/components/audit/list/audit-list.stories.ts +170 -0
- package/projects/unipin-angular/src/lib/components/audit/service/audit.service.ts +48 -0
- package/projects/unipin-angular/src/lib/components/audit/types/audit-detail-form.type.ts +13 -0
- package/projects/unipin-angular/src/lib/components/buttons/group/btn-group.component.html +42 -0
- package/projects/unipin-angular/src/lib/components/buttons/group/btn-group.component.scss +19 -0
- package/projects/unipin-angular/src/lib/components/buttons/group/btn-group.component.ts +72 -0
- package/projects/unipin-angular/src/lib/components/buttons/group/btn-group.stories.ts +132 -0
- package/projects/unipin-angular/src/lib/components/buttons/group/interfaces/btn-group-config.interface.ts +63 -0
- package/projects/unipin-angular/src/lib/components/buttons/loading/btn-loading.component.html +9 -0
- package/projects/unipin-angular/src/lib/components/buttons/loading/btn-loading.component.scss +8 -0
- package/projects/unipin-angular/src/lib/components/buttons/loading/btn-loading.component.ts +87 -0
- package/projects/unipin-angular/src/lib/components/buttons/loading/btn-loading.stories.ts +188 -0
- package/projects/unipin-angular/src/lib/components/containers/applet-container/applet-container.component.html +39 -0
- package/projects/unipin-angular/src/lib/components/containers/applet-container/applet-container.component.scss +68 -0
- package/projects/unipin-angular/src/lib/components/containers/applet-container/applet-container.component.ts +98 -0
- package/projects/unipin-angular/src/lib/components/containers/applet-container/provide-applet-config.util.ts +23 -0
- package/projects/unipin-angular/src/lib/components/containers/colum-header-container/column-header-container.component.html +17 -0
- package/projects/unipin-angular/src/lib/components/containers/colum-header-container/column-header-container.component.scss +4 -0
- package/projects/unipin-angular/src/lib/components/containers/colum-header-container/column-header-container.component.ts +32 -0
- package/projects/unipin-angular/src/lib/components/containers/colum-header-container/column-header.stories.ts +77 -0
- package/projects/unipin-angular/src/lib/components/containers/column-container/column-container.component.html +17 -0
- package/projects/unipin-angular/src/lib/components/containers/column-container/column-container.component.scss +0 -0
- package/projects/unipin-angular/src/lib/components/containers/column-container/column-container.component.ts +139 -0
- package/projects/unipin-angular/src/lib/components/containers/column-container/directives/lazy-route.directive.ts +86 -0
- package/{lib/components/containers/index.d.ts → projects/unipin-angular/src/lib/components/containers/index.ts} +1 -0
- package/{lib/components/containers/list-container/interfaces/list-container-config.interface.d.ts → projects/unipin-angular/src/lib/components/containers/list-container/interfaces/list-container-config.interface.ts} +5 -4
- package/projects/unipin-angular/src/lib/components/containers/list-container/list-pagination-container/list-pagination-container.component.html +19 -0
- package/projects/unipin-angular/src/lib/components/containers/list-container/list-pagination-container/list-pagination-container.component.scss +7 -0
- package/projects/unipin-angular/src/lib/components/containers/list-container/list-pagination-container/list-pagination-container.component.ts +113 -0
- package/projects/unipin-angular/src/lib/components/containers/list-container/list-pagination-container/list-pagination-container.stories.ts +207 -0
- package/projects/unipin-angular/src/lib/components/containers/list-container/list-snapshot-container/list-snapshot-container.component.html +19 -0
- package/projects/unipin-angular/src/lib/components/containers/list-container/list-snapshot-container/list-snapshot-container.component.scss +7 -0
- package/projects/unipin-angular/src/lib/components/containers/list-container/list-snapshot-container/list-snapshot-container.component.ts +114 -0
- package/projects/unipin-angular/src/lib/components/containers/list-container/list-snapshot-container/list-snapshot-container.stories.ts +212 -0
- package/projects/unipin-angular/src/lib/components/containers/modal-container/modal-container.component.html +15 -0
- package/projects/unipin-angular/src/lib/components/containers/modal-container/modal-container.component.scss +2 -0
- package/projects/unipin-angular/src/lib/components/containers/modal-container/modal-container.component.ts +88 -0
- package/projects/unipin-angular/src/lib/components/containers/modal-container/modal-container.stories.ts +66 -0
- package/projects/unipin-angular/src/lib/components/filter/filter.component.html +112 -0
- package/projects/unipin-angular/src/lib/components/filter/filter.component.scss +28 -0
- package/projects/unipin-angular/src/lib/components/filter/filter.component.ts +329 -0
- package/projects/unipin-angular/src/lib/components/filter/filter.stories.ts +176 -0
- package/{lib/components/filter/index.d.ts → projects/unipin-angular/src/lib/components/filter/index.ts} +1 -1
- package/projects/unipin-angular/src/lib/components/filter/interfaces/filter-config.interface.ts +17 -0
- package/projects/unipin-angular/src/lib/components/filter/interfaces/filter-field.interface.ts +73 -0
- package/projects/unipin-angular/src/lib/components/filter/interfaces/filter-search-event.interface.ts +15 -0
- package/projects/unipin-angular/src/lib/components/forms/country-input/form-country-input.component.html +19 -0
- package/projects/unipin-angular/src/lib/components/forms/country-input/form-country-input.component.scss +0 -0
- package/projects/unipin-angular/src/lib/components/forms/country-input/form-country-input.component.ts +210 -0
- package/projects/unipin-angular/src/lib/components/forms/country-input/form-country-input.stories.ts +175 -0
- package/projects/unipin-angular/src/lib/components/forms/currency-input/form-currency-input.component.html +42 -0
- package/projects/unipin-angular/src/lib/components/forms/currency-input/form-currency-input.component.scss +4 -0
- package/projects/unipin-angular/src/lib/components/forms/currency-input/form-currency-input.component.ts +285 -0
- package/projects/unipin-angular/src/lib/components/forms/currency-input/form-currency-input.spec.ts +119 -0
- package/projects/unipin-angular/src/lib/components/forms/currency-input/form-currency-input.stories.ts +243 -0
- package/projects/unipin-angular/src/lib/components/forms/date/form-date.component.html +27 -0
- package/projects/unipin-angular/src/lib/components/forms/date/form-date.component.scss +7 -0
- package/projects/unipin-angular/src/lib/components/forms/date/form-date.component.ts +225 -0
- package/projects/unipin-angular/src/lib/components/forms/date/form-date.stories.ts +201 -0
- package/projects/unipin-angular/src/lib/components/forms/image-picker/directives/drag-n-drop.directive.ts +40 -0
- package/projects/unipin-angular/src/lib/components/forms/image-picker/form-image-picker.component.html +29 -0
- package/projects/unipin-angular/src/lib/components/forms/image-picker/form-image-picker.component.scss +40 -0
- package/projects/unipin-angular/src/lib/components/forms/image-picker/form-image-picker.component.ts +109 -0
- package/projects/unipin-angular/src/lib/components/forms/image-picker/form-image-picker.stories.ts +133 -0
- package/projects/unipin-angular/src/lib/components/forms/input/form-input.component.html +22 -0
- package/projects/unipin-angular/src/lib/components/forms/input/form-input.component.scss +0 -0
- package/projects/unipin-angular/src/lib/components/forms/input/form-input.component.ts +177 -0
- package/projects/unipin-angular/src/lib/components/forms/input/form-input.stories.ts +185 -0
- package/projects/unipin-angular/src/lib/components/forms/number/form-number.component.html +6 -0
- package/projects/unipin-angular/src/lib/components/forms/number/form-number.component.scss +0 -0
- package/projects/unipin-angular/src/lib/components/forms/number/form-number.component.ts +176 -0
- package/projects/unipin-angular/src/lib/components/forms/number/form-number.spec.ts +62 -0
- package/projects/unipin-angular/src/lib/components/forms/number/form-number.stories.ts +150 -0
- package/projects/unipin-angular/src/lib/components/forms/number/pipes/locale-number.pipe.ts +32 -0
- package/projects/unipin-angular/src/lib/components/forms/password/form-password.component.html +11 -0
- package/projects/unipin-angular/src/lib/components/forms/password/form-password.component.scss +5 -0
- package/projects/unipin-angular/src/lib/components/forms/password/form-password.component.ts +177 -0
- package/projects/unipin-angular/src/lib/components/forms/password/form-password.stories.ts +151 -0
- package/projects/unipin-angular/src/lib/components/forms/rate-group-code-input/form-rate-group-code-input.component.html +30 -0
- package/projects/unipin-angular/src/lib/components/forms/rate-group-code-input/form-rate-group-code-input.component.scss +0 -0
- package/projects/unipin-angular/src/lib/components/forms/rate-group-code-input/form-rate-group-code-input.component.ts +271 -0
- package/projects/unipin-angular/src/lib/components/forms/rate-group-code-input/form-rate-group-code-input.stories.ts +248 -0
- package/projects/unipin-angular/src/lib/components/forms/searchable-select/form-searchable-select.component.html +28 -0
- package/projects/unipin-angular/src/lib/components/forms/searchable-select/form-searchable-select.component.scss +0 -0
- package/projects/unipin-angular/src/lib/components/forms/searchable-select/form-searchable-select.component.ts +281 -0
- package/projects/unipin-angular/src/lib/components/forms/searchable-select/form-searchable-select.stories.ts +267 -0
- package/projects/unipin-angular/src/lib/components/forms/select/form-select.component.html +24 -0
- package/projects/unipin-angular/src/lib/components/forms/select/form-select.component.scss +1 -0
- package/projects/unipin-angular/src/lib/components/forms/select/form-select.component.ts +216 -0
- package/projects/unipin-angular/src/lib/components/forms/select/form-select.stories.ts +220 -0
- package/projects/unipin-angular/src/lib/components/forms/textarea/form-textarea.component.html +9 -0
- package/projects/unipin-angular/src/lib/components/forms/textarea/form-textarea.component.scss +0 -0
- package/projects/unipin-angular/src/lib/components/forms/textarea/form-textarea.component.ts +146 -0
- package/projects/unipin-angular/src/lib/components/forms/textarea/form-textarea.stories.ts +163 -0
- package/projects/unipin-angular/src/lib/components/grids/grid-pagination/grid-pagination.component.html +17 -0
- package/projects/unipin-angular/src/lib/components/grids/grid-pagination/grid-pagination.component.scss +8 -0
- package/projects/unipin-angular/src/lib/components/grids/grid-pagination/grid-pagination.component.ts +224 -0
- package/projects/unipin-angular/src/lib/components/grids/grid-pagination/grid-pagination.stories.ts +219 -0
- package/projects/unipin-angular/src/lib/components/grids/grid-snapshot/grid-snapshot.component.html +17 -0
- package/projects/unipin-angular/src/lib/components/grids/grid-snapshot/grid-snapshot.component.scss +8 -0
- package/projects/unipin-angular/src/lib/components/grids/grid-snapshot/grid-snapshot.component.ts +229 -0
- package/projects/unipin-angular/src/lib/components/grids/grid-snapshot/grid-snapshot.stories.ts +173 -0
- package/projects/unipin-angular/src/lib/components/grids/interfaces/grid-config.interface.ts +44 -0
- package/projects/unipin-angular/src/lib/components/grids/services/grid.service.ts +23 -0
- package/{lib/components/index.d.ts → projects/unipin-angular/src/lib/components/index.ts} +14 -2
- package/projects/unipin-angular/src/lib/components/infinite-scroll/directive/infinite-scroll.directive.ts +72 -0
- package/projects/unipin-angular/src/lib/components/infinite-scroll/infinite-scroll.component.html +13 -0
- package/projects/unipin-angular/src/lib/components/infinite-scroll/infinite-scroll.component.scss +10 -0
- package/projects/unipin-angular/src/lib/components/infinite-scroll/infinite-scroll.component.ts +61 -0
- package/projects/unipin-angular/src/lib/components/infinite-scroll/infinite-scroll.stories.ts +80 -0
- package/{lib/components/tabs/index.d.ts → projects/unipin-angular/src/lib/components/tabs/index.ts} +3 -2
- package/projects/unipin-angular/src/lib/components/tabs/tab-content/tab-content.component.html +3 -0
- package/projects/unipin-angular/src/lib/components/tabs/tab-content/tab-content.component.scss +6 -0
- package/projects/unipin-angular/src/lib/components/tabs/tab-content/tab-content.component.ts +56 -0
- package/projects/unipin-angular/src/lib/components/tabs/tab-group/tab-group.component.html +24 -0
- package/projects/unipin-angular/src/lib/components/tabs/tab-group/tab-group.component.scss +39 -0
- package/projects/unipin-angular/src/lib/components/tabs/tab-group/tab-group.component.ts +92 -0
- package/projects/unipin-angular/src/lib/components/tabs/tab.stories.ts +117 -0
- package/projects/unipin-angular/src/lib/guards/auth/auth.guard.ts +11 -0
- package/projects/unipin-angular/src/lib/interceptors/header/header.interceptor.ts +36 -0
- package/projects/unipin-angular/src/lib/interceptors/refresh-token/refresh-token.interceptor.ts +123 -0
- package/projects/unipin-angular/src/lib/interfaces/user/user.interface.ts +27 -0
- package/projects/unipin-angular/src/lib/modules/index.ts +11 -0
- package/projects/unipin-angular/src/lib/modules/micro-frontend/utils/mf-bootstrap.util.ts +74 -0
- package/projects/unipin-angular/src/lib/modules/micro-frontend/utils/mf-global-state.util.ts +20 -0
- package/projects/unipin-angular/src/lib/modules/permission/directive/permission.directive.spec.ts +50 -0
- package/projects/unipin-angular/src/lib/modules/permission/directive/permission.directive.ts +68 -0
- package/projects/unipin-angular/src/lib/modules/permission/guards/permission.guard.spec.ts +76 -0
- package/projects/unipin-angular/src/lib/modules/permission/guards/permission.guard.ts +30 -0
- package/{lib/modules/permission/index.d.ts → projects/unipin-angular/src/lib/modules/permission/index.ts} +1 -0
- package/projects/unipin-angular/src/lib/modules/permission/pages/401/unauthorized.page.html +3 -0
- package/projects/unipin-angular/src/lib/modules/permission/pages/401/unauthorized.page.scss +3 -0
- package/projects/unipin-angular/src/lib/modules/permission/pages/401/unauthorized.page.ts +14 -0
- package/projects/unipin-angular/src/lib/modules/permission/pages/loading/loading.page.html +2 -0
- package/projects/unipin-angular/src/lib/modules/permission/pages/loading/loading.page.scss +4 -0
- package/projects/unipin-angular/src/lib/modules/permission/pages/loading/loading.page.ts +76 -0
- package/projects/unipin-angular/src/lib/modules/permission/pages/loading/provide-loading-config.util.ts +18 -0
- package/projects/unipin-angular/src/lib/modules/permission/services/permission.service.spec.ts +62 -0
- package/projects/unipin-angular/src/lib/modules/permission/services/permission.service.ts +78 -0
- package/projects/unipin-angular/src/lib/resolvers/auth/auth.resolver.spec.ts +46 -0
- package/projects/unipin-angular/src/lib/resolvers/auth/auth.resolver.ts +144 -0
- package/projects/unipin-angular/src/lib/services/auth/auth.service.ts +243 -0
- package/projects/unipin-angular/src/lib/services/country/country.service.ts +47 -0
- package/projects/unipin-angular/src/lib/services/currency/currency.service.ts +44 -0
- package/projects/unipin-angular/src/lib/services/profile/profile.service.ts +86 -0
- package/projects/unipin-angular/src/lib/services/rate-group-code/rate-group-code.service.ts +29 -0
- package/projects/unipin-angular/src/lib/utils/contrast-color-generator/contrast-color-generator.util.spec.ts +19 -0
- package/projects/unipin-angular/src/lib/utils/contrast-color-generator/contrast-color-generator.util.ts +28 -0
- package/projects/unipin-angular/src/lib/utils/form-error-message/form-error-message.util.spec.ts +58 -0
- package/projects/unipin-angular/src/lib/utils/form-error-message/form-error-message.util.ts +30 -0
- package/projects/unipin-angular/src/lib/utils/format-capitalize/format-capitalize.util.spec.ts +30 -0
- package/projects/unipin-angular/src/lib/utils/format-capitalize/format-capitalize.util.ts +22 -0
- package/projects/unipin-angular/src/lib/utils/redirect-to-first-menu/redirect-to-first-menu.util.ts +15 -0
- package/projects/unipin-angular/src/public-api.ts +126 -0
- package/projects/unipin-angular/tsconfig.lib.json +14 -0
- package/projects/unipin-angular/tsconfig.lib.prod.json +10 -0
- package/projects/unipin-angular/tsconfig.spec.json +14 -0
- package/snapshot-serializer.js +12 -0
- package/test-runner-jest.config.js +13 -0
- package/tsconfig.json +51 -0
- package/esm2022/graphql/generated.mjs +0 -888
- package/esm2022/lib/components/approval/detail/approval-detail.component.mjs +0 -78
- package/esm2022/lib/components/approval/form/approval-form.component.mjs +0 -128
- package/esm2022/lib/components/approval/index.mjs +0 -5
- package/esm2022/lib/components/approval/list/approval-list.component.mjs +0 -114
- package/esm2022/lib/components/approval/list/provide-approval-entities.util.mjs +0 -9
- package/esm2022/lib/components/approval/services/approval.service.mjs +0 -46
- package/esm2022/lib/components/audit/detail/audit-detail.component.mjs +0 -123
- package/esm2022/lib/components/audit/index.mjs +0 -3
- package/esm2022/lib/components/audit/list/audit-list.component.mjs +0 -81
- package/esm2022/lib/components/audit/service/audit.service.mjs +0 -49
- package/esm2022/lib/components/audit/types/audit-detail-form.type.mjs +0 -2
- package/esm2022/lib/components/buttons/group/btn-group.component.mjs +0 -43
- package/esm2022/lib/components/buttons/group/interfaces/btn-group-config.interface.mjs +0 -2
- package/esm2022/lib/components/buttons/index.mjs +0 -3
- package/esm2022/lib/components/buttons/loading/btn-loading.component.mjs +0 -48
- package/esm2022/lib/components/containers/applet-container/applet-container.component.mjs +0 -55
- package/esm2022/lib/components/containers/applet-container/provide-applet-config.util.mjs +0 -9
- package/esm2022/lib/components/containers/colum-header-container/column-header-container.component.mjs +0 -23
- package/esm2022/lib/components/containers/column-container/column-container.component.mjs +0 -79
- package/esm2022/lib/components/containers/column-container/directives/lazy-route.directive.mjs +0 -57
- package/esm2022/lib/components/containers/index.mjs +0 -7
- package/esm2022/lib/components/containers/list-container/index.mjs +0 -3
- package/esm2022/lib/components/containers/list-container/interfaces/list-container-config.interface.mjs +0 -2
- package/esm2022/lib/components/containers/list-container/list-pagination-container/list-pagination-container.component.mjs +0 -58
- package/esm2022/lib/components/containers/list-container/list-snapshot-container/list-snapshot-container.component.mjs +0 -57
- package/esm2022/lib/components/containers/modal-container/modal-container.component.mjs +0 -40
- package/esm2022/lib/components/filter/filter.component.mjs +0 -222
- package/esm2022/lib/components/filter/index.mjs +0 -2
- package/esm2022/lib/components/filter/interfaces/filter-config.interface.mjs +0 -2
- package/esm2022/lib/components/filter/interfaces/filter-field.interface.mjs +0 -2
- package/esm2022/lib/components/filter/interfaces/filter-search-event.interface.mjs +0 -2
- package/esm2022/lib/components/forms/country-input/form-country-input.component.mjs +0 -122
- package/esm2022/lib/components/forms/currency-input/form-currency-input.component.mjs +0 -157
- package/esm2022/lib/components/forms/date/form-date.component.mjs +0 -114
- package/esm2022/lib/components/forms/image-picker/directives/drag-n-drop.directive.mjs +0 -49
- package/esm2022/lib/components/forms/image-picker/form-image-picker.component.mjs +0 -68
- package/esm2022/lib/components/forms/index.mjs +0 -12
- package/esm2022/lib/components/forms/input/form-input.component.mjs +0 -98
- package/esm2022/lib/components/forms/number/form-number.component.mjs +0 -97
- package/esm2022/lib/components/forms/number/pipes/locale-number.pipe.mjs +0 -33
- package/esm2022/lib/components/forms/password/form-password.component.mjs +0 -100
- package/esm2022/lib/components/forms/rate-group-code-input/form-rate-group-code-input.component.mjs +0 -135
- package/esm2022/lib/components/forms/searchable-select/form-searchable-select.component.mjs +0 -138
- package/esm2022/lib/components/forms/select/form-select.component.mjs +0 -116
- package/esm2022/lib/components/forms/textarea/form-textarea.component.mjs +0 -88
- package/esm2022/lib/components/grids/grid-pagination/grid-pagination.component.mjs +0 -111
- package/esm2022/lib/components/grids/grid-snapshot/grid-snapshot.component.mjs +0 -109
- package/esm2022/lib/components/grids/index.mjs +0 -4
- package/esm2022/lib/components/grids/interfaces/grid-config.interface.mjs +0 -2
- package/esm2022/lib/components/grids/services/grid.service.mjs +0 -25
- package/esm2022/lib/components/index.mjs +0 -9
- package/esm2022/lib/components/infinite-scroll/directive/infinite-scroll.directive.mjs +0 -43
- package/esm2022/lib/components/infinite-scroll/index.mjs +0 -3
- package/esm2022/lib/components/infinite-scroll/infinite-scroll.component.mjs +0 -36
- package/esm2022/lib/components/tabs/index.mjs +0 -3
- package/esm2022/lib/components/tabs/tab-content/tab-content.component.mjs +0 -37
- package/esm2022/lib/components/tabs/tab-group/tab-group.component.mjs +0 -47
- package/esm2022/lib/guards/auth/auth.guard.mjs +0 -10
- package/esm2022/lib/guards/index.mjs +0 -2
- package/esm2022/lib/interceptors/header/header.interceptor.mjs +0 -29
- package/esm2022/lib/interceptors/index.mjs +0 -3
- package/esm2022/lib/interceptors/refresh-token/refresh-token.interceptor.mjs +0 -83
- package/esm2022/lib/interfaces/index.mjs +0 -2
- package/esm2022/lib/interfaces/user/user.interface.mjs +0 -2
- package/esm2022/lib/modules/index.mjs +0 -3
- package/esm2022/lib/modules/micro-frontend/index.mjs +0 -2
- package/esm2022/lib/modules/micro-frontend/utils/mf-bootstrap.util.mjs +0 -55
- package/esm2022/lib/modules/micro-frontend/utils/mf-global-state.util.mjs +0 -14
- package/esm2022/lib/modules/permission/directive/permission.directive.mjs +0 -41
- package/esm2022/lib/modules/permission/guards/permission.guard.mjs +0 -26
- package/esm2022/lib/modules/permission/index.mjs +0 -7
- package/esm2022/lib/modules/permission/pages/401/unauthorized.page.mjs +0 -15
- package/esm2022/lib/modules/permission/pages/loading/loading.page.mjs +0 -65
- package/esm2022/lib/modules/permission/pages/loading/provide-loading-config.util.mjs +0 -9
- package/esm2022/lib/modules/permission/services/permission.service.mjs +0 -50
- package/esm2022/lib/resolvers/auth/auth.resolver.mjs +0 -87
- package/esm2022/lib/resolvers/index.mjs +0 -2
- package/esm2022/lib/services/auth/auth.service.mjs +0 -171
- package/esm2022/lib/services/country/country.service.mjs +0 -43
- package/esm2022/lib/services/currency/currency.service.mjs +0 -40
- package/esm2022/lib/services/index.mjs +0 -6
- package/esm2022/lib/services/profile/profile.service.mjs +0 -82
- package/esm2022/lib/services/rate-group-code/rate-group-code.service.mjs +0 -31
- package/esm2022/lib/utils/contrast-color-generator/contrast-color-generator.util.mjs +0 -16
- package/esm2022/lib/utils/form-error-message/form-error-message.util.mjs +0 -21
- package/esm2022/lib/utils/format-capitalize/format-capitalize.util.mjs +0 -18
- package/esm2022/lib/utils/index.mjs +0 -5
- package/esm2022/lib/utils/redirect-to-first-menu/redirect-to-first-menu.util.mjs +0 -9
- package/esm2022/public-api.mjs +0 -10
- package/esm2022/unipin-angular-applet.mjs +0 -2
- package/fesm2022/unipin-angular-applet.mjs +0 -4564
- package/fesm2022/unipin-angular-applet.mjs.map +0 -1
- package/graphql/generated.d.ts +0 -15719
- package/index.d.ts +0 -2
- package/lib/components/approval/detail/approval-detail.component.d.ts +0 -26
- package/lib/components/approval/form/approval-form.component.d.ts +0 -33
- package/lib/components/approval/list/approval-list.component.d.ts +0 -33
- package/lib/components/approval/list/provide-approval-entities.util.d.ts +0 -3
- package/lib/components/approval/services/approval.service.d.ts +0 -18
- package/lib/components/audit/detail/audit-detail.component.d.ts +0 -33
- package/lib/components/audit/list/audit-list.component.d.ts +0 -31
- package/lib/components/audit/service/audit.service.d.ts +0 -15
- package/lib/components/audit/types/audit-detail-form.type.d.ts +0 -12
- package/lib/components/buttons/group/btn-group.component.d.ts +0 -18
- package/lib/components/buttons/group/interfaces/btn-group-config.interface.d.ts +0 -11
- package/lib/components/buttons/loading/btn-loading.component.d.ts +0 -19
- package/lib/components/containers/applet-container/applet-container.component.d.ts +0 -22
- package/lib/components/containers/applet-container/provide-applet-config.util.d.ts +0 -15
- package/lib/components/containers/colum-header-container/column-header-container.component.d.ts +0 -7
- package/lib/components/containers/column-container/column-container.component.d.ts +0 -26
- package/lib/components/containers/column-container/directives/lazy-route.directive.d.ts +0 -17
- package/lib/components/containers/list-container/list-pagination-container/list-pagination-container.component.d.ts +0 -23
- package/lib/components/containers/list-container/list-snapshot-container/list-snapshot-container.component.d.ts +0 -23
- package/lib/components/containers/modal-container/modal-container.component.d.ts +0 -16
- package/lib/components/filter/filter.component.d.ts +0 -44
- package/lib/components/filter/interfaces/filter-config.interface.d.ts +0 -5
- package/lib/components/filter/interfaces/filter-field.interface.d.ts +0 -23
- package/lib/components/filter/interfaces/filter-search-event.interface.d.ts +0 -4
- package/lib/components/forms/country-input/form-country-input.component.d.ts +0 -41
- package/lib/components/forms/currency-input/form-currency-input.component.d.ts +0 -52
- package/lib/components/forms/date/form-date.component.d.ts +0 -32
- package/lib/components/forms/image-picker/directives/drag-n-drop.directive.d.ts +0 -10
- package/lib/components/forms/image-picker/form-image-picker.component.d.ts +0 -21
- package/lib/components/forms/input/form-input.component.d.ts +0 -31
- package/lib/components/forms/number/form-number.component.d.ts +0 -27
- package/lib/components/forms/number/pipes/locale-number.pipe.d.ts +0 -8
- package/lib/components/forms/password/form-password.component.d.ts +0 -27
- package/lib/components/forms/rate-group-code-input/form-rate-group-code-input.component.d.ts +0 -41
- package/lib/components/forms/searchable-select/form-searchable-select.component.d.ts +0 -42
- package/lib/components/forms/select/form-select.component.d.ts +0 -33
- package/lib/components/forms/textarea/form-textarea.component.d.ts +0 -26
- package/lib/components/grids/grid-pagination/grid-pagination.component.d.ts +0 -33
- package/lib/components/grids/grid-snapshot/grid-snapshot.component.d.ts +0 -36
- package/lib/components/grids/interfaces/grid-config.interface.d.ts +0 -16
- package/lib/components/grids/services/grid.service.d.ts +0 -12
- package/lib/components/infinite-scroll/directive/infinite-scroll.directive.d.ts +0 -15
- package/lib/components/infinite-scroll/infinite-scroll.component.d.ts +0 -12
- package/lib/components/tabs/tab-content/tab-content.component.d.ts +0 -14
- package/lib/components/tabs/tab-group/tab-group.component.d.ts +0 -18
- package/lib/guards/auth/auth.guard.d.ts +0 -1
- package/lib/interceptors/header/header.interceptor.d.ts +0 -9
- package/lib/interceptors/refresh-token/refresh-token.interceptor.d.ts +0 -14
- package/lib/interfaces/user/user.interface.d.ts +0 -27
- package/lib/modules/index.d.ts +0 -2
- package/lib/modules/micro-frontend/utils/mf-bootstrap.util.d.ts +0 -9
- package/lib/modules/micro-frontend/utils/mf-global-state.util.d.ts +0 -4
- package/lib/modules/permission/directive/permission.directive.d.ts +0 -16
- package/lib/modules/permission/guards/permission.guard.d.ts +0 -2
- package/lib/modules/permission/pages/401/unauthorized.page.d.ts +0 -5
- package/lib/modules/permission/pages/loading/loading.page.d.ts +0 -18
- package/lib/modules/permission/pages/loading/provide-loading-config.util.d.ts +0 -10
- package/lib/modules/permission/services/permission.service.d.ts +0 -21
- package/lib/resolvers/auth/auth.resolver.d.ts +0 -14
- package/lib/services/auth/auth.service.d.ts +0 -39
- package/lib/services/country/country.service.d.ts +0 -16
- package/lib/services/currency/currency.service.d.ts +0 -16
- package/lib/services/profile/profile.service.d.ts +0 -12
- package/lib/services/rate-group-code/rate-group-code.service.d.ts +0 -14
- package/lib/utils/contrast-color-generator/contrast-color-generator.util.d.ts +0 -4
- package/lib/utils/form-error-message/form-error-message.util.d.ts +0 -2
- package/lib/utils/format-capitalize/format-capitalize.util.d.ts +0 -1
- package/lib/utils/redirect-to-first-menu/redirect-to-first-menu.util.d.ts +0 -2
- package/public-api.d.ts +0 -11
- /package/{src → projects/unipin-angular/src}/assets/scss/forms.scss +0 -0
- /package/{src → projects/unipin-angular/src}/assets/scss/grid.scss +0 -0
- /package/{src → projects/unipin-angular/src}/assets/scss/select.scss +0 -0
- /package/{lib/components/audit/index.d.ts → projects/unipin-angular/src/lib/components/audit/index.ts} +0 -0
- /package/{lib/components/buttons/index.d.ts → projects/unipin-angular/src/lib/components/buttons/index.ts} +0 -0
- /package/{lib/components/containers/list-container/index.d.ts → projects/unipin-angular/src/lib/components/containers/list-container/index.ts} +0 -0
- /package/{lib/components/forms/index.d.ts → projects/unipin-angular/src/lib/components/forms/index.ts} +0 -0
- /package/{lib/components/grids/index.d.ts → projects/unipin-angular/src/lib/components/grids/index.ts} +0 -0
- /package/{lib/components/infinite-scroll/index.d.ts → projects/unipin-angular/src/lib/components/infinite-scroll/index.ts} +0 -0
- /package/{lib/guards/index.d.ts → projects/unipin-angular/src/lib/guards/index.ts} +0 -0
- /package/{lib/interceptors/index.d.ts → projects/unipin-angular/src/lib/interceptors/index.ts} +0 -0
- /package/{lib/interfaces/index.d.ts → projects/unipin-angular/src/lib/interfaces/index.ts} +0 -0
- /package/{lib/modules/micro-frontend/index.d.ts → projects/unipin-angular/src/lib/modules/micro-frontend/index.ts} +0 -0
- /package/{lib/resolvers/index.d.ts → projects/unipin-angular/src/lib/resolvers/index.ts} +0 -0
- /package/{lib/services/index.d.ts → projects/unipin-angular/src/lib/services/index.ts} +0 -0
- /package/{lib/utils/index.d.ts → projects/unipin-angular/src/lib/utils/index.ts} +0 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { Attribute, ChangeDetectorRef, ChangeDetectionStrategy, Component, Input, Output, EventEmitter } from '@angular/core';
|
|
2
|
+
import { AbstractControl, ControlValueAccessor, NG_VALIDATORS, NG_VALUE_ACCESSOR, ValidationErrors, Validator } from '@angular/forms';
|
|
3
|
+
import { getFormErrorMessage } from '../../../utils';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
standalone: true,
|
|
7
|
+
selector: 'up-input',
|
|
8
|
+
styleUrl: './form-input.component.scss',
|
|
9
|
+
templateUrl: './form-input.component.html',
|
|
10
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
11
|
+
host: {
|
|
12
|
+
class: 'd-block'
|
|
13
|
+
},
|
|
14
|
+
providers: [
|
|
15
|
+
{
|
|
16
|
+
multi: true,
|
|
17
|
+
provide: NG_VALUE_ACCESSOR,
|
|
18
|
+
useExisting: FormInputComponent
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
multi: true,
|
|
22
|
+
provide: NG_VALIDATORS,
|
|
23
|
+
useExisting: FormInputComponent
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
})
|
|
27
|
+
export class FormInputComponent implements ControlValueAccessor, Validator {
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Input variable for the label associated with the input.
|
|
31
|
+
* @type {string | undefined}
|
|
32
|
+
*/
|
|
33
|
+
@Input() public label?: string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Input variable for the initial value of the input.
|
|
37
|
+
* @type {string | null | undefined}
|
|
38
|
+
*/
|
|
39
|
+
@Input() public value?: string | null;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Input variable to determine whether the input is required.
|
|
43
|
+
* @type {boolean}
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
@Input() public required: boolean = false;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Input variable to determine whether the input is disabled.
|
|
50
|
+
* @type {boolean}
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
@Input() public disabled: boolean = false;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Input variable for the minimum value of the input.
|
|
57
|
+
* @type {string | undefined}
|
|
58
|
+
*/
|
|
59
|
+
@Input() public min?: string;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Input variable for the maximum value of the input.
|
|
63
|
+
* @type {string | undefined}
|
|
64
|
+
*/
|
|
65
|
+
@Input() public max?: string;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Output variable for emitting input events.
|
|
69
|
+
* @type {EventEmitter<any>}
|
|
70
|
+
*/
|
|
71
|
+
@Output() public onInput: EventEmitter<any> = new EventEmitter<any>();
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Boolean flag indicating whether the input has been touched.
|
|
75
|
+
* @type {boolean}
|
|
76
|
+
* @default false
|
|
77
|
+
*/
|
|
78
|
+
public isTouched: boolean = false;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Error message associated with the input.
|
|
82
|
+
* @type {string}
|
|
83
|
+
* @default undefined
|
|
84
|
+
*/
|
|
85
|
+
public errorMsg!: string;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The form control associated with the input.
|
|
89
|
+
* @type {AbstractControl}
|
|
90
|
+
*/
|
|
91
|
+
protected formControl!: AbstractControl;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Callback function to handle value changes in the input.
|
|
95
|
+
* @type {(_val: any) => void}
|
|
96
|
+
*/
|
|
97
|
+
protected onChange: (_val: any) => void = (_val: any) => {};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Callback function to handle touch events in the input.
|
|
101
|
+
* @type {() => void}
|
|
102
|
+
*/
|
|
103
|
+
protected onTouched: () => void = () => {};
|
|
104
|
+
|
|
105
|
+
constructor(
|
|
106
|
+
@Attribute('placeholder') public placeholder: string,
|
|
107
|
+
@Attribute('type') public type: 'email' | 'hidden' | 'number' | 'search' | 'tel' | 'text' | 'url',
|
|
108
|
+
@Attribute('autocomplete') public autocomplete: 'name' | 'email' | 'tel' | 'url' | 'on' | 'off' | 'honorific-prefix' | 'given-name' | 'additional-name' | 'family-name' | 'honorific-suffix' | 'nickname' | 'username' | 'one-time-code' | 'organization-title' | 'organization' | 'street-address' | 'address-line1' | 'address-line2' | 'address-line3' | 'address-level4' | 'address-level3' | 'address-level2' | 'address-level1' | 'country' | 'country-name' | 'postal-code' | 'cc-name' | 'cc-given-name' | 'cc-additional-name' | 'cc-family-name' | 'cc-number' | 'cc-exp' | 'cc-exp-month' | 'cc-exp-year' | 'cc-csc' | 'cc-type' | 'transaction-currency' | 'transaction-amount' | 'language' | 'bday' | 'bday-day' | 'bday-month' | 'bday-year' | 'sex' | 'tel-country-code' | 'tel-national' | 'tel-area-code' | 'tel-local' | 'tel-extension',
|
|
109
|
+
protected readonly ch: ChangeDetectorRef
|
|
110
|
+
) { }
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Registers a callback function to be called when the input value changes.
|
|
114
|
+
* @param {(_val: any) => void} fn - Callback function for value changes.
|
|
115
|
+
*/
|
|
116
|
+
public registerOnChange(fn: any): void{ this.onChange = fn; }
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Registers a callback function to be called when the input is touched.
|
|
120
|
+
* @param {() => void} fn - Callback function for touch events.
|
|
121
|
+
*/
|
|
122
|
+
public registerOnTouched(fn: any): void{ this.onTouched = fn; }
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Emits an input event when the input value changes.
|
|
126
|
+
* @param {any} val - The new value of the input.
|
|
127
|
+
*/
|
|
128
|
+
public input(val: any): void{ this.onInput.emit(val); }
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Writes a new value to the input.
|
|
132
|
+
* @param {*} val - The new value to be set.
|
|
133
|
+
*/
|
|
134
|
+
public writeValue(val: any): void{
|
|
135
|
+
this.value = val;
|
|
136
|
+
this.ch.markForCheck();
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Sets the disabled state of the input.
|
|
141
|
+
* @param {boolean} d - Whether the input should be disabled or not.
|
|
142
|
+
*/
|
|
143
|
+
public setDisabledState?(d: boolean): void{
|
|
144
|
+
this.disabled = d;
|
|
145
|
+
this.ch.markForCheck();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Validates the input.
|
|
150
|
+
* @param {AbstractControl} control - The abstract control representing the input.
|
|
151
|
+
* @returns {(ValidationErrors | null)} - Validation errors if any, otherwise null.
|
|
152
|
+
*/
|
|
153
|
+
public validate(control: AbstractControl): ValidationErrors | null{
|
|
154
|
+
this.formControl = control;
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Event handler for input changes in the input.
|
|
160
|
+
* If not touched, marks the input as touched.
|
|
161
|
+
* If not disabled, updates the value, triggers change detection, and emits the input event.
|
|
162
|
+
* Updates the error message based on form control errors and label.
|
|
163
|
+
* @param {any} param0 - Event detail containing the new input value.
|
|
164
|
+
*/
|
|
165
|
+
public change({ value }: any): void{
|
|
166
|
+
if (!this.isTouched) {
|
|
167
|
+
this.onTouched();
|
|
168
|
+
this.isTouched = true;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (!this.disabled) {
|
|
172
|
+
this.value = value;
|
|
173
|
+
this.onChange(this.value);
|
|
174
|
+
this.errorMsg = getFormErrorMessage(this.formControl.errors, this.label);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { FormControl } from '@angular/forms';
|
|
2
|
+
import { IonicModule } from '@ionic/angular';
|
|
3
|
+
import { moduleMetadata, type Meta, type StoryObj } from '@storybook/angular';
|
|
4
|
+
import { FormInputComponent } from './form-input.component';
|
|
5
|
+
|
|
6
|
+
const ctrl = new FormControl();
|
|
7
|
+
ctrl.markAsTouched();
|
|
8
|
+
|
|
9
|
+
const meta: Meta<FormInputComponent> = {
|
|
10
|
+
title: 'Form/Input',
|
|
11
|
+
tags: [ 'autodocs' ],
|
|
12
|
+
component: FormInputComponent,
|
|
13
|
+
decorators: [
|
|
14
|
+
moduleMetadata({
|
|
15
|
+
imports: [
|
|
16
|
+
IonicModule
|
|
17
|
+
],
|
|
18
|
+
})
|
|
19
|
+
],
|
|
20
|
+
argTypes: {
|
|
21
|
+
autocomplete: {
|
|
22
|
+
defaultValue: undefined,
|
|
23
|
+
description: 'Indicates whether the value of the control can be automatically completed by the browser.',
|
|
24
|
+
options: [ 'name', 'email', 'tel', 'url', 'on', 'off', 'honorific-prefix', 'given-name', 'additional-name', 'family-name', 'honorific-suffix', 'nickname', 'username', 'one-time-code', 'organization-title', 'organization', 'street-address', 'address-line1', 'address-line2', 'address-line3', 'address-level4', 'address-level3', 'address-level2', 'address-level1', 'country', 'country-name', 'postal-code', 'cc-name', 'cc-given-name', 'cc-additional-name', 'cc-family-name', 'cc-number', 'cc-exp', 'cc-exp-month', 'cc-exp-year', 'cc-csc', 'cc-type', 'transaction-currency', 'transaction-amount', 'language', 'sex', 'tel-country-code', 'tel-national', 'tel-area-code', 'tel-local', 'tel-extension' ],
|
|
25
|
+
control: {
|
|
26
|
+
type: 'select'
|
|
27
|
+
},
|
|
28
|
+
table: {
|
|
29
|
+
category: 'Input',
|
|
30
|
+
subcategory: 'Attribute'
|
|
31
|
+
},
|
|
32
|
+
type: {
|
|
33
|
+
required: false,
|
|
34
|
+
name: 'string'
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
disabled: {
|
|
38
|
+
defaultValue: false,
|
|
39
|
+
description: 'If `true`, the user cannot interact with the input.',
|
|
40
|
+
table: {
|
|
41
|
+
category: 'Input'
|
|
42
|
+
},
|
|
43
|
+
type: {
|
|
44
|
+
required: false,
|
|
45
|
+
name: 'boolean'
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
label: {
|
|
49
|
+
defaultValue: undefined,
|
|
50
|
+
description: 'The visible label associated with the input.',
|
|
51
|
+
table: {
|
|
52
|
+
category: 'Input'
|
|
53
|
+
},
|
|
54
|
+
type: {
|
|
55
|
+
required: false,
|
|
56
|
+
name: 'string'
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
placeholder: {
|
|
60
|
+
defaultValue: undefined,
|
|
61
|
+
description: 'Instructional text that shows before the input has a value. This property applies only when the type property is set to `email`, `number`, `password`, `search`, `tel`, `text`, or `url`, otherwise it is ignored.',
|
|
62
|
+
table: {
|
|
63
|
+
category: 'Input',
|
|
64
|
+
subcategory: 'Attribute'
|
|
65
|
+
},
|
|
66
|
+
type: {
|
|
67
|
+
required: false,
|
|
68
|
+
name: 'string'
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
required: {
|
|
72
|
+
defaultValue: false,
|
|
73
|
+
description: 'If `true`, the user must fill in a value before submitting a form.',
|
|
74
|
+
table: {
|
|
75
|
+
category: 'Input'
|
|
76
|
+
},
|
|
77
|
+
type: {
|
|
78
|
+
required: false,
|
|
79
|
+
name: 'boolean'
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
type: {
|
|
83
|
+
type: 'string',
|
|
84
|
+
defaultValue: undefined,
|
|
85
|
+
description: 'The type of control to display.',
|
|
86
|
+
options: [ 'email', 'hidden', 'search', 'tel', 'text', 'url' ],
|
|
87
|
+
control: {
|
|
88
|
+
type: 'select'
|
|
89
|
+
},
|
|
90
|
+
table: {
|
|
91
|
+
category: 'Input',
|
|
92
|
+
subcategory: 'Attribute'
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
change: {
|
|
96
|
+
table: { disable: true },
|
|
97
|
+
control: { disable: true }
|
|
98
|
+
},
|
|
99
|
+
errorMsg: {
|
|
100
|
+
table: { disable: true },
|
|
101
|
+
control: { disable: true }
|
|
102
|
+
},
|
|
103
|
+
input: {
|
|
104
|
+
table: { disable: true },
|
|
105
|
+
control: { disable: true }
|
|
106
|
+
},
|
|
107
|
+
isTouched: {
|
|
108
|
+
table: { disable: true },
|
|
109
|
+
control: { disable: true }
|
|
110
|
+
},
|
|
111
|
+
onInput: {
|
|
112
|
+
table: { disable: true },
|
|
113
|
+
control: { disable: true }
|
|
114
|
+
},
|
|
115
|
+
registerOnChange: {
|
|
116
|
+
table: { disable: true },
|
|
117
|
+
control: { disable: true }
|
|
118
|
+
},
|
|
119
|
+
registerOnTouched: {
|
|
120
|
+
table: { disable: true },
|
|
121
|
+
control: { disable: true }
|
|
122
|
+
},
|
|
123
|
+
setDisabledState: {
|
|
124
|
+
table: { disable: true },
|
|
125
|
+
control: { disable: true }
|
|
126
|
+
},
|
|
127
|
+
writeValue: {
|
|
128
|
+
table: { disable: true },
|
|
129
|
+
control: { disable: true }
|
|
130
|
+
},
|
|
131
|
+
validate: {
|
|
132
|
+
table: { disable: true },
|
|
133
|
+
control: { disable: true }
|
|
134
|
+
},
|
|
135
|
+
value: {
|
|
136
|
+
table: { disable: true },
|
|
137
|
+
control: { disable: true }
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export default meta;
|
|
143
|
+
type Story = StoryObj<FormInputComponent>;
|
|
144
|
+
|
|
145
|
+
export const Default: Story = {
|
|
146
|
+
args: {
|
|
147
|
+
type: 'text',
|
|
148
|
+
label: 'Name',
|
|
149
|
+
autocomplete: 'name',
|
|
150
|
+
placeholder: 'Insert your name'
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export const WithIcon: Story = {
|
|
155
|
+
name: 'With Icon',
|
|
156
|
+
render: (props) => ({
|
|
157
|
+
props,
|
|
158
|
+
template: `
|
|
159
|
+
<up-input label="Name" name="name" placeholder="Insert your name">
|
|
160
|
+
<ion-icon name="person-circle" class="me-1" icon />
|
|
161
|
+
</up-input>
|
|
162
|
+
`
|
|
163
|
+
})
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export const Required: Story = {
|
|
167
|
+
args: {
|
|
168
|
+
...Default.args,
|
|
169
|
+
required: true
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
export const Disabled: Story = {
|
|
174
|
+
args: {
|
|
175
|
+
...Default.args,
|
|
176
|
+
disabled: true,
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
export const Error: Story = {
|
|
181
|
+
args: {
|
|
182
|
+
...Required.args,
|
|
183
|
+
errorMsg: 'Field is required',
|
|
184
|
+
}
|
|
185
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<label class="form-label">{{ label }}</label>
|
|
2
|
+
<input type="text" placeholder="{{ placeholder }}" class="form-control" [required]="required" [disabled]="disabled" [value]="value | localeNumber:locale" (keydown)="onKeyDown($event)" (change)="change($event.target)" />
|
|
3
|
+
|
|
4
|
+
@if (errorMsg) {
|
|
5
|
+
<label class="is-invalid">{{ errorMsg }}</label>
|
|
6
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { Attribute, ChangeDetectorRef, ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
|
2
|
+
import { AbstractControl, ControlValueAccessor, FormsModule, NG_VALIDATORS, NG_VALUE_ACCESSOR, ValidationErrors, Validator } from '@angular/forms';
|
|
3
|
+
import { getFormErrorMessage } from '../../../utils';
|
|
4
|
+
import { LocaleNumberPipe } from './pipes/locale-number.pipe';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
standalone: true,
|
|
8
|
+
selector: 'up-number',
|
|
9
|
+
styleUrl: './form-number.component.scss',
|
|
10
|
+
templateUrl: './form-number.component.html',
|
|
11
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
12
|
+
host: {
|
|
13
|
+
class: 'd-block'
|
|
14
|
+
},
|
|
15
|
+
imports: [
|
|
16
|
+
FormsModule,
|
|
17
|
+
LocaleNumberPipe
|
|
18
|
+
],
|
|
19
|
+
providers: [
|
|
20
|
+
{
|
|
21
|
+
multi: true,
|
|
22
|
+
provide: NG_VALUE_ACCESSOR,
|
|
23
|
+
useExisting: FormNumberComponent
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
multi: true,
|
|
27
|
+
provide: NG_VALIDATORS,
|
|
28
|
+
useExisting: FormNumberComponent
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
})
|
|
32
|
+
export class FormNumberComponent implements ControlValueAccessor, Validator {
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Input variable for the label associated with the input.
|
|
36
|
+
* @type {string | undefined}
|
|
37
|
+
*/
|
|
38
|
+
@Input() public label?: string;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Input variable for the initial value of the input.
|
|
42
|
+
* @type {string | null | undefined}
|
|
43
|
+
*/
|
|
44
|
+
@Input() public value?: string | null;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Input variable to determine whether the input is required.
|
|
48
|
+
* @type {boolean}
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
@Input() public required: boolean = false;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Input variable to determine whether the input is disabled.
|
|
55
|
+
* @type {boolean}
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
@Input() public disabled: boolean = false;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Input variable specifying the locale to be used for masking numbers based on locale.
|
|
62
|
+
* @type {string}
|
|
63
|
+
* @default navigator.language
|
|
64
|
+
*/
|
|
65
|
+
@Input() public locale: string = navigator.language;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Boolean flag indicating whether the input has been touched.
|
|
69
|
+
* @type {boolean}
|
|
70
|
+
* @default false
|
|
71
|
+
*/
|
|
72
|
+
public isTouched: boolean = false;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Error message associated with the input.
|
|
76
|
+
* @type {string}
|
|
77
|
+
* @default undefined
|
|
78
|
+
*/
|
|
79
|
+
public errorMsg!: string;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The form control associated with the input.
|
|
83
|
+
* @type {AbstractControl}
|
|
84
|
+
*/
|
|
85
|
+
protected formControl!: AbstractControl;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Callback function to handle value changes in the input.
|
|
89
|
+
* @type {(_val: any) => void}
|
|
90
|
+
*/
|
|
91
|
+
protected onChange: (_val: any) => void = (_val: any) => {};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Callback function to handle touch events in the input.
|
|
95
|
+
* @type {() => void}
|
|
96
|
+
*/
|
|
97
|
+
protected onTouched: () => void = () => {};
|
|
98
|
+
|
|
99
|
+
constructor(
|
|
100
|
+
@Attribute('placeholder') public placeholder: string,
|
|
101
|
+
protected readonly ch: ChangeDetectorRef
|
|
102
|
+
) { }
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Registers a callback function to be called when the input value changes.
|
|
106
|
+
* @param {(_val: any) => void} fn - Callback function for value changes.
|
|
107
|
+
*/
|
|
108
|
+
public registerOnChange(fn: any): void{ this.onChange = fn; }
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Registers a callback function to be called when the input is touched.
|
|
112
|
+
* @param {() => void} fn - Callback function for touch events.
|
|
113
|
+
*/
|
|
114
|
+
public registerOnTouched(fn: any): void{ this.onTouched = fn; }
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Writes a new value to the input.
|
|
118
|
+
* @param {*} val - The new value to be set.
|
|
119
|
+
*/
|
|
120
|
+
public writeValue(val: any): void{
|
|
121
|
+
this.value = val;
|
|
122
|
+
this.ch.markForCheck();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Sets the disabled state of the input.
|
|
127
|
+
* @param {boolean} d - Whether the input should be disabled or not.
|
|
128
|
+
*/
|
|
129
|
+
public setDisabledState?(d: boolean): void{
|
|
130
|
+
this.disabled = d;
|
|
131
|
+
this.ch.markForCheck();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Validates the input.
|
|
136
|
+
* @param {AbstractControl} control - The abstract control representing the input.
|
|
137
|
+
* @returns {(ValidationErrors | null)} - Validation errors if any, otherwise null.
|
|
138
|
+
*/
|
|
139
|
+
public validate(control: AbstractControl): ValidationErrors | null{
|
|
140
|
+
this.formControl = control;
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Event handler for input changes in the input.
|
|
146
|
+
* If not touched, marks the input as touched.
|
|
147
|
+
* If not disabled, updates the value, triggers change detection, and emits the input event.
|
|
148
|
+
* Updates the error message based on form control errors and label.
|
|
149
|
+
* @param {any} param - Event detail containing the new input value.
|
|
150
|
+
*/
|
|
151
|
+
public change({ value }: any): void{
|
|
152
|
+
if (!this.isTouched) {
|
|
153
|
+
this.onTouched();
|
|
154
|
+
this.isTouched = true;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (!this.disabled) {
|
|
158
|
+
this.value = value;
|
|
159
|
+
this.onChange(this.value);
|
|
160
|
+
this.errorMsg = getFormErrorMessage(this.formControl?.errors, this.label);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Event handler for keydown events in the input.
|
|
166
|
+
* Prevents input of non-numeric characters except for specific allowed keys.
|
|
167
|
+
* @param {KeyboardEvent} event - The keyboard event object.
|
|
168
|
+
*/
|
|
169
|
+
public onKeyDown(ev: KeyboardEvent): void{
|
|
170
|
+
const allowedKeys = new Set(['Backspace', 'Delete', 'ArrowLeft', 'ArrowRight', 'Tab', 'Home', 'End', ',', '.']);
|
|
171
|
+
const key = ev.key;
|
|
172
|
+
|
|
173
|
+
if (allowedKeys.has(key)) return;
|
|
174
|
+
if (!/^\d$/.test(key)) ev.preventDefault();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { FormNumberComponent } from './form-number.component';
|
|
3
|
+
import { FormsModule, AbstractControl, FormControl } from '@angular/forms';
|
|
4
|
+
|
|
5
|
+
describe('FormNumberComponent', () => {
|
|
6
|
+
let component: FormNumberComponent;
|
|
7
|
+
let fixture: ComponentFixture<FormNumberComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [FormNumberComponent, FormsModule]
|
|
12
|
+
}).compileComponents();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
fixture = TestBed.createComponent(FormNumberComponent);
|
|
17
|
+
component = fixture.componentInstance;
|
|
18
|
+
fixture.detectChanges();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should create', () => {
|
|
22
|
+
expect(component).toBeTruthy();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should write value', () => {
|
|
26
|
+
const value = '123';
|
|
27
|
+
component.writeValue(value);
|
|
28
|
+
|
|
29
|
+
expect(component.value).toEqual(value);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('should validate', () => {
|
|
33
|
+
const control: AbstractControl = new FormControl();
|
|
34
|
+
const validationErrors = component.validate(control);
|
|
35
|
+
|
|
36
|
+
expect(validationErrors).toBeNull();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should prevent input of non-numeric characters except for specific allowed keys', () => {
|
|
40
|
+
const event = new KeyboardEvent('keydown', { key: 'a' });
|
|
41
|
+
spyOn(event, 'preventDefault');
|
|
42
|
+
|
|
43
|
+
component.onKeyDown(event);
|
|
44
|
+
|
|
45
|
+
expect(event.preventDefault).toHaveBeenCalled();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('should not prevent input of allowed keys', () => {
|
|
49
|
+
const allowedKeys = ['Backspace', 'Delete', 'ArrowLeft', 'ArrowRight', 'Tab', 'Home', 'End', ',', '.'];
|
|
50
|
+
|
|
51
|
+
allowedKeys.forEach(key => {
|
|
52
|
+
const event = new KeyboardEvent('keydown', {
|
|
53
|
+
key
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
spyOn(event, 'preventDefault');
|
|
57
|
+
|
|
58
|
+
component.onKeyDown(event);
|
|
59
|
+
expect(event.preventDefault).not.toHaveBeenCalled();
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
});
|