@unipin/angular-applet 18.9.7 → 21.0.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/README.md +49 -10
- package/common/assets/sprites/flagGlobal.png +0 -0
- package/common/assets/sprites/flagSprite42.webp +0 -0
- package/common/assets/styles/freakflags.scss +263 -0
- package/common/assets/styles/theme.css +69 -0
- package/fesm2022/unipin-angular-applet-accordion.mjs +242 -0
- package/fesm2022/unipin-angular-applet-accordion.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-alert-dialog.mjs +267 -0
- package/fesm2022/unipin-angular-applet-alert-dialog.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-alert.mjs +94 -0
- package/fesm2022/unipin-angular-applet-alert.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-auth.mjs +707 -0
- package/fesm2022/unipin-angular-applet-auth.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-avatar.mjs +41 -0
- package/fesm2022/unipin-angular-applet-avatar.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-badge.mjs +50 -0
- package/fesm2022/unipin-angular-applet-badge.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-buttons.mjs +263 -0
- package/fesm2022/unipin-angular-applet-buttons.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-calendar.mjs +492 -0
- package/fesm2022/unipin-angular-applet-calendar.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-collapsible.mjs +97 -0
- package/fesm2022/unipin-angular-applet-collapsible.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-common.mjs +342 -0
- package/fesm2022/unipin-angular-applet-common.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-containers.mjs +472 -0
- package/fesm2022/unipin-angular-applet-containers.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-dialog.mjs +535 -0
- package/fesm2022/unipin-angular-applet-dialog.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-forms.mjs +1699 -0
- package/fesm2022/unipin-angular-applet-forms.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-froala.mjs +298 -0
- package/fesm2022/unipin-angular-applet-froala.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-grids.mjs +105 -0
- package/fesm2022/unipin-angular-applet-grids.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-infinite-scroll.mjs +86 -0
- package/fesm2022/unipin-angular-applet-infinite-scroll.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-json-viewer.mjs +71 -0
- package/fesm2022/unipin-angular-applet-json-viewer.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-loading-dialog.mjs +252 -0
- package/fesm2022/unipin-angular-applet-loading-dialog.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-markdown.mjs +703 -0
- package/fesm2022/unipin-angular-applet-markdown.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-micro-frontend.mjs +75 -0
- package/fesm2022/unipin-angular-applet-micro-frontend.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-popover.mjs +333 -0
- package/fesm2022/unipin-angular-applet-popover.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-progress-bar.mjs +38 -0
- package/fesm2022/unipin-angular-applet-progress-bar.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-skeleton.mjs +32 -0
- package/fesm2022/unipin-angular-applet-skeleton.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-spinner.mjs +144 -0
- package/fesm2022/unipin-angular-applet-spinner.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-swipeable.mjs +270 -0
- package/fesm2022/unipin-angular-applet-swipeable.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-tabs.mjs +142 -0
- package/fesm2022/unipin-angular-applet-tabs.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet-tooltip.mjs +118 -0
- package/fesm2022/unipin-angular-applet-tooltip.mjs.map +1 -0
- package/fesm2022/unipin-angular-applet.mjs +5 -4617
- package/fesm2022/unipin-angular-applet.mjs.map +1 -1
- package/package.json +132 -29
- package/types/unipin-angular-applet-accordion.d.ts +60 -0
- package/types/unipin-angular-applet-alert-dialog.d.ts +35 -0
- package/types/unipin-angular-applet-alert.d.ts +34 -0
- package/types/unipin-angular-applet-auth.d.ts +225 -0
- package/types/unipin-angular-applet-avatar.d.ts +16 -0
- package/types/unipin-angular-applet-badge.d.ts +20 -0
- package/types/unipin-angular-applet-buttons.d.ts +37 -0
- package/types/unipin-angular-applet-calendar.d.ts +44 -0
- package/types/unipin-angular-applet-collapsible.d.ts +35 -0
- package/types/unipin-angular-applet-common.d.ts +94 -0
- package/types/unipin-angular-applet-containers.d.ts +179 -0
- package/types/unipin-angular-applet-dialog.d.ts +180 -0
- package/types/unipin-angular-applet-forms.d.ts +412 -0
- package/types/unipin-angular-applet-froala.d.ts +85 -0
- package/types/unipin-angular-applet-grids.d.ts +22 -0
- package/types/unipin-angular-applet-infinite-scroll.d.ts +51 -0
- package/types/unipin-angular-applet-json-viewer.d.ts +30 -0
- package/types/unipin-angular-applet-loading-dialog.d.ts +19 -0
- package/types/unipin-angular-applet-markdown.d.ts +119 -0
- package/types/unipin-angular-applet-micro-frontend.d.ts +11 -0
- package/types/unipin-angular-applet-popover.d.ts +58 -0
- package/types/unipin-angular-applet-progress-bar.d.ts +14 -0
- package/types/unipin-angular-applet-skeleton.d.ts +11 -0
- package/types/unipin-angular-applet-spinner.d.ts +12 -0
- package/types/unipin-angular-applet-swipeable.d.ts +66 -0
- package/types/unipin-angular-applet-tabs.d.ts +40 -0
- package/types/unipin-angular-applet-tooltip.d.ts +32 -0
- package/types/unipin-angular-applet.d.ts +3 -0
- package/esm2022/graphql/generated.mjs +0 -938
- 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 -117
- 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 -119
- 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/graphql/generated.d.ts +0 -16225
- 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/index.d.ts +0 -4
- 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/index.d.ts +0 -2
- 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/index.d.ts +0 -3
- 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/index.d.ts +0 -6
- package/lib/components/containers/list-container/index.d.ts +0 -3
- package/lib/components/containers/list-container/interfaces/list-container-config.interface.d.ts +0 -9
- 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/index.d.ts +0 -4
- package/lib/components/filter/interfaces/filter-config.interface.d.ts +0 -5
- package/lib/components/filter/interfaces/filter-field.interface.d.ts +0 -24
- 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 -33
- 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/index.d.ts +0 -11
- 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 -34
- 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/index.d.ts +0 -4
- 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/index.d.ts +0 -8
- package/lib/components/infinite-scroll/directive/infinite-scroll.directive.d.ts +0 -15
- package/lib/components/infinite-scroll/index.d.ts +0 -2
- package/lib/components/infinite-scroll/infinite-scroll.component.d.ts +0 -12
- package/lib/components/tabs/index.d.ts +0 -6
- 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/guards/index.d.ts +0 -1
- package/lib/interceptors/header/header.interceptor.d.ts +0 -9
- package/lib/interceptors/index.d.ts +0 -2
- package/lib/interceptors/refresh-token/refresh-token.interceptor.d.ts +0 -14
- package/lib/interfaces/index.d.ts +0 -1
- package/lib/interfaces/user/user.interface.d.ts +0 -27
- package/lib/modules/index.d.ts +0 -2
- package/lib/modules/micro-frontend/index.d.ts +0 -1
- 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/index.d.ts +0 -6
- 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/resolvers/index.d.ts +0 -1
- 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/index.d.ts +0 -5
- 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/index.d.ts +0 -4
- 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/assets/scss/forms.scss +0 -65
- package/src/assets/scss/grid.scss +0 -7505
- package/src/assets/scss/select.scss +0 -328
|
@@ -0,0 +1,1699 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { signal, inject, Injector, Injectable, input, computed, forwardRef, Directive, HostListener, model, booleanAttribute, ChangeDetectionStrategy, Component, output, contentChild, ViewEncapsulation, viewChild, effect } from '@angular/core';
|
|
3
|
+
import * as i1$1 from '@unipin/angular-applet/common';
|
|
4
|
+
import { up } from '@unipin/angular-applet/common';
|
|
5
|
+
import * as i1 from '@angular/forms';
|
|
6
|
+
import { NgControl, NgForm, FormGroupDirective, FormsModule } from '@angular/forms';
|
|
7
|
+
import { NgIcon, provideIcons } from '@ng-icons/core';
|
|
8
|
+
import { matVisibilityOffRound, matVisibilityRound, matCalendarMonthRound } from '@ng-icons/material-icons/round';
|
|
9
|
+
import { NgSelectComponent } from '@ng-select/ng-select';
|
|
10
|
+
import { toSignal } from '@angular/core/rxjs-interop';
|
|
11
|
+
import { Subject, distinctUntilChanged, debounceTime, tap, switchMap, map, catchError, of } from 'rxjs';
|
|
12
|
+
import { format } from 'date-fns';
|
|
13
|
+
import { UpButtonDirective } from '@unipin/angular-applet/buttons';
|
|
14
|
+
import { UpCalendarComponent } from '@unipin/angular-applet/calendar';
|
|
15
|
+
import { UpPopoverComponent, UpPopoverTriggerDirective, UpPopoverContentRefDirective } from '@unipin/angular-applet/popover';
|
|
16
|
+
|
|
17
|
+
const errMessage = {
|
|
18
|
+
email: (label) => `${label} is not a valid email`,
|
|
19
|
+
required: (label) => `${label} is required`,
|
|
20
|
+
minlength: (label, length) => `${label} must be at least ${length} characters`,
|
|
21
|
+
maxlength: (label, length) => `${label} must not exceed ${length} characters`,
|
|
22
|
+
max: (label, max) => `${label} value must be lower than ${max}`,
|
|
23
|
+
min: (label, min) => `${label} value must be larger than ${min}`,
|
|
24
|
+
};
|
|
25
|
+
const extraParamKey = {
|
|
26
|
+
max: 'max',
|
|
27
|
+
min: 'min',
|
|
28
|
+
minlength: 'requiredLength',
|
|
29
|
+
maxlength: 'requiredLength',
|
|
30
|
+
};
|
|
31
|
+
class UpFieldControl {
|
|
32
|
+
}
|
|
33
|
+
class UpFieldControlComponent {
|
|
34
|
+
constructor() {
|
|
35
|
+
this.error = signal('', ...(ngDevMode ? [{ debugName: "error" }] : []));
|
|
36
|
+
this.injector = inject(Injector);
|
|
37
|
+
this.ngControl = this.injector.get(NgControl, null);
|
|
38
|
+
this._parentForm = inject(NgForm, { optional: true });
|
|
39
|
+
this._parentFormGroup = inject(FormGroupDirective, { optional: true });
|
|
40
|
+
this._controlName = '';
|
|
41
|
+
}
|
|
42
|
+
ngDoCheck() {
|
|
43
|
+
this.updateErrorState();
|
|
44
|
+
}
|
|
45
|
+
setControlName(name) {
|
|
46
|
+
this._controlName = name;
|
|
47
|
+
}
|
|
48
|
+
updateErrorState() {
|
|
49
|
+
const control = this.ngControl?.control ?? null;
|
|
50
|
+
if (!control ||
|
|
51
|
+
!control.touched ||
|
|
52
|
+
!control.dirty) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (!control.errors) {
|
|
56
|
+
this.error.set('');
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const errKey = Object.keys(control.errors)[0];
|
|
60
|
+
const newState = errMessage[errKey](this._controlName ?? 'Field', control.errors[errKey][extraParamKey[errKey]]);
|
|
61
|
+
if (newState !== this.error()) {
|
|
62
|
+
this.error.set(newState);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpFieldControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
66
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpFieldControlComponent }); }
|
|
67
|
+
}
|
|
68
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpFieldControlComponent, decorators: [{
|
|
69
|
+
type: Injectable
|
|
70
|
+
}] });
|
|
71
|
+
|
|
72
|
+
class UpInputDirective extends UpFieldControlComponent {
|
|
73
|
+
constructor() {
|
|
74
|
+
super(...arguments);
|
|
75
|
+
this.inlineClass = input('', ...(ngDevMode ? [{ debugName: "inlineClass", alias: 'class' }] : [{ alias: 'class' }]));
|
|
76
|
+
this._computedClass = computed(() => {
|
|
77
|
+
return up('peer file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:border-0 file:bg-transparent file:text-sm file:font-medium file:h-7 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm', 'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] focus-visible:outline-none', this.error() ? 'ring-destructive/20 dark:ring-destructive/40 border-destructive focus-visible:ring-destructive/50' : '', this.inlineClass());
|
|
78
|
+
}, ...(ngDevMode ? [{ debugName: "_computedClass" }] : []));
|
|
79
|
+
}
|
|
80
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpInputDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
81
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.0", type: UpInputDirective, isStandalone: true, selector: "[upInput]", inputs: { inlineClass: { classPropertyName: "inlineClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "_computedClass()" } }, providers: [
|
|
82
|
+
{
|
|
83
|
+
provide: UpFieldControl,
|
|
84
|
+
useExisting: forwardRef(() => UpInputDirective)
|
|
85
|
+
}
|
|
86
|
+
], exportAs: ["upInput"], usesInheritance: true, ngImport: i0 }); }
|
|
87
|
+
}
|
|
88
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpInputDirective, decorators: [{
|
|
89
|
+
type: Directive,
|
|
90
|
+
args: [{
|
|
91
|
+
standalone: true,
|
|
92
|
+
exportAs: 'upInput',
|
|
93
|
+
selector: '[upInput]',
|
|
94
|
+
host: {
|
|
95
|
+
'[class]': '_computedClass()',
|
|
96
|
+
},
|
|
97
|
+
providers: [
|
|
98
|
+
{
|
|
99
|
+
provide: UpFieldControl,
|
|
100
|
+
useExisting: forwardRef(() => UpInputDirective)
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
}]
|
|
104
|
+
}], propDecorators: { inlineClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
105
|
+
|
|
106
|
+
class UpNumberDirective extends UpInputDirective {
|
|
107
|
+
constructor(renderer, el) {
|
|
108
|
+
super();
|
|
109
|
+
this.renderer = renderer;
|
|
110
|
+
this.el = el;
|
|
111
|
+
this.magnifyValue = input(1, ...(ngDevMode ? [{ debugName: "magnifyValue" }] : []));
|
|
112
|
+
this.maxDecimalDigits = computed(() => {
|
|
113
|
+
if (!this.magnifyValue() ||
|
|
114
|
+
this.magnifyValue() === 1) {
|
|
115
|
+
return 0;
|
|
116
|
+
}
|
|
117
|
+
const floatPoint = Math.log10(this.magnifyValue());
|
|
118
|
+
return floatPoint % 1 !== 0 ? 0 : floatPoint;
|
|
119
|
+
}, ...(ngDevMode ? [{ debugName: "maxDecimalDigits" }] : []));
|
|
120
|
+
this.lastCaretPos = 0;
|
|
121
|
+
this.lastRawValue = '';
|
|
122
|
+
this.lastKey = null;
|
|
123
|
+
/**
|
|
124
|
+
* Callback function to handle value changes in the password input.
|
|
125
|
+
* @type {(_val: any) => void}
|
|
126
|
+
*/
|
|
127
|
+
this._onChange = (_val) => { };
|
|
128
|
+
/**
|
|
129
|
+
* Callback function to handle touch events in the password input.
|
|
130
|
+
* @type {() => void}
|
|
131
|
+
*/
|
|
132
|
+
this._onTouched = () => { };
|
|
133
|
+
if (this.ngControl !== null) {
|
|
134
|
+
this.ngControl.valueAccessor = this;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
onBlur() {
|
|
138
|
+
this._onTouched();
|
|
139
|
+
const input = this.el.nativeElement;
|
|
140
|
+
if (!input.value.trim()) {
|
|
141
|
+
input.value = '';
|
|
142
|
+
this._onChange(null);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const { integer, decimal } = this.sanitizeNumber(input.value);
|
|
146
|
+
const cleanedInteger = integer.replace(/^0+/, '') || '';
|
|
147
|
+
const cleanedDecimal = decimal ?? '';
|
|
148
|
+
let formatted;
|
|
149
|
+
if ((!cleanedInteger ||
|
|
150
|
+
/^0+$/.test(cleanedInteger)) &&
|
|
151
|
+
(!cleanedDecimal ||
|
|
152
|
+
/^0+$/.test(cleanedDecimal))) {
|
|
153
|
+
formatted = '0';
|
|
154
|
+
}
|
|
155
|
+
else if (!cleanedDecimal) {
|
|
156
|
+
formatted = this.formatWithThousandSeparator(cleanedInteger || '0');
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
formatted = `${this.formatWithThousandSeparator(cleanedInteger || '0')},${cleanedDecimal}`;
|
|
160
|
+
}
|
|
161
|
+
input.value = formatted;
|
|
162
|
+
}
|
|
163
|
+
onInput(event) {
|
|
164
|
+
const input = event.target;
|
|
165
|
+
const postRaw = input.value;
|
|
166
|
+
const postCaret = input.selectionStart ?? postRaw.length;
|
|
167
|
+
const formatted = this.formatNumber(postRaw);
|
|
168
|
+
input.value = formatted;
|
|
169
|
+
const numericValue = Number(formatted.replace(/\./g, '').replace(',', '.'));
|
|
170
|
+
this._onChange(numericValue);
|
|
171
|
+
const digitsBefore = postRaw.slice(0, postCaret).replace(/\D/g, '').length;
|
|
172
|
+
let newCaret = this.lastKey === ',' ? this.findCommaCaret(formatted, digitsBefore) : this.mapDigitsToIndex(formatted, digitsBefore);
|
|
173
|
+
input.setSelectionRange(newCaret, newCaret);
|
|
174
|
+
this.lastKey = null;
|
|
175
|
+
this.lastRawValue = postRaw;
|
|
176
|
+
this.lastCaretPos = newCaret;
|
|
177
|
+
}
|
|
178
|
+
onKeyDown(event) {
|
|
179
|
+
const input = event.target;
|
|
180
|
+
const allowedKeys = [
|
|
181
|
+
'Backspace',
|
|
182
|
+
'Tab',
|
|
183
|
+
'Enter',
|
|
184
|
+
'Escape',
|
|
185
|
+
'Delete',
|
|
186
|
+
'ArrowLeft',
|
|
187
|
+
'ArrowRight',
|
|
188
|
+
'Home',
|
|
189
|
+
'End',
|
|
190
|
+
];
|
|
191
|
+
this.lastKey = event.key;
|
|
192
|
+
this.lastRawValue = input.value;
|
|
193
|
+
this.lastCaretPos = input.selectionStart ?? input.value.length;
|
|
194
|
+
if ((event.ctrlKey ||
|
|
195
|
+
event.metaKey) &&
|
|
196
|
+
['a', 'c', 'v', 'x'].includes(event.key.toLowerCase())) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (allowedKeys.includes(event.key))
|
|
200
|
+
return;
|
|
201
|
+
if (event.key === ',') {
|
|
202
|
+
if (this.maxDecimalDigits() === 0 ||
|
|
203
|
+
input.value.includes(',')) {
|
|
204
|
+
event.preventDefault();
|
|
205
|
+
}
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
if (!/^[0-9,]$/.test(event.key)) {
|
|
209
|
+
event.preventDefault();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Registers a callback function to be called when the password input value changes.
|
|
214
|
+
* @param {(_val: any) => void} fn - Callback function for value changes.
|
|
215
|
+
*/
|
|
216
|
+
registerOnChange(fn) {
|
|
217
|
+
this._onChange = fn;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Registers a callback function to be called when the password input is touched.
|
|
221
|
+
* @param {() => void} fn - Callback function for touch events.
|
|
222
|
+
*/
|
|
223
|
+
registerOnTouched(fn) {
|
|
224
|
+
this._onTouched = fn;
|
|
225
|
+
}
|
|
226
|
+
setDisabledState(isDisabled) {
|
|
227
|
+
this.renderer.setProperty(this.el.nativeElement, 'disabled', isDisabled);
|
|
228
|
+
}
|
|
229
|
+
writeValue(value) {
|
|
230
|
+
this.el.nativeElement.value = this.formatNumber(String(value ?? ''));
|
|
231
|
+
}
|
|
232
|
+
findCommaCaret(formatted, digitsBefore) {
|
|
233
|
+
const commaIndex = formatted.indexOf(',');
|
|
234
|
+
return commaIndex >= 0 ? commaIndex + 1 : this.mapDigitsToIndex(formatted, digitsBefore);
|
|
235
|
+
}
|
|
236
|
+
mapDigitsToIndex(formatted, digitsBefore) {
|
|
237
|
+
if (digitsBefore <= 0)
|
|
238
|
+
return 0;
|
|
239
|
+
let count = 0;
|
|
240
|
+
for (let i = 0; i < formatted.length; i++) {
|
|
241
|
+
if (/\d/.test(formatted[i])) {
|
|
242
|
+
count++;
|
|
243
|
+
if (count === digitsBefore) {
|
|
244
|
+
return i + 1;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return formatted.length;
|
|
249
|
+
}
|
|
250
|
+
formatNumber(value) {
|
|
251
|
+
if (!value) {
|
|
252
|
+
return '';
|
|
253
|
+
}
|
|
254
|
+
const { integer, decimal } = this.sanitizeNumber(value);
|
|
255
|
+
const formattedInt = this.formatWithThousandSeparator(integer || '');
|
|
256
|
+
if (decimal !== undefined) {
|
|
257
|
+
return `${formattedInt || '0'},${decimal}`;
|
|
258
|
+
}
|
|
259
|
+
return formattedInt || '0';
|
|
260
|
+
}
|
|
261
|
+
formatWithThousandSeparator(value) {
|
|
262
|
+
return value.replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
|
263
|
+
}
|
|
264
|
+
sanitizeNumber(value) {
|
|
265
|
+
const onlyDigitsComma = value.replace(/[^0-9,]/g, '');
|
|
266
|
+
const singleComma = onlyDigitsComma.replace(/,/g, (_, i) => onlyDigitsComma.indexOf(',') === i ? ',' : '');
|
|
267
|
+
const [integerPart, decimalPart] = singleComma.split(',');
|
|
268
|
+
return {
|
|
269
|
+
integer: integerPart || '',
|
|
270
|
+
decimal: decimalPart?.slice(0, this.maxDecimalDigits()),
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpNumberDirective, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
274
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.0", type: UpNumberDirective, isStandalone: true, selector: "[upNumber]", inputs: { magnifyValue: { classPropertyName: "magnifyValue", publicName: "magnifyValue", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "blur": "onBlur()", "input": "onInput($event)", "keydown": "onKeyDown($event)" }, properties: { "class": "_computedClass()" } }, providers: [
|
|
275
|
+
{
|
|
276
|
+
provide: UpFieldControl,
|
|
277
|
+
useExisting: forwardRef(() => UpNumberDirective),
|
|
278
|
+
},
|
|
279
|
+
], exportAs: ["upNumber"], usesInheritance: true, ngImport: i0 }); }
|
|
280
|
+
}
|
|
281
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpNumberDirective, decorators: [{
|
|
282
|
+
type: Directive,
|
|
283
|
+
args: [{
|
|
284
|
+
standalone: true,
|
|
285
|
+
exportAs: 'upNumber',
|
|
286
|
+
selector: '[upNumber]',
|
|
287
|
+
host: {
|
|
288
|
+
'[class]': '_computedClass()'
|
|
289
|
+
},
|
|
290
|
+
providers: [
|
|
291
|
+
{
|
|
292
|
+
provide: UpFieldControl,
|
|
293
|
+
useExisting: forwardRef(() => UpNumberDirective),
|
|
294
|
+
},
|
|
295
|
+
],
|
|
296
|
+
}]
|
|
297
|
+
}], ctorParameters: () => [{ type: i0.Renderer2 }, { type: i0.ElementRef }], propDecorators: { magnifyValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "magnifyValue", required: false }] }], onBlur: [{
|
|
298
|
+
type: HostListener,
|
|
299
|
+
args: ['blur']
|
|
300
|
+
}], onInput: [{
|
|
301
|
+
type: HostListener,
|
|
302
|
+
args: ['input', ['$event']]
|
|
303
|
+
}], onKeyDown: [{
|
|
304
|
+
type: HostListener,
|
|
305
|
+
args: ['keydown', ['$event']]
|
|
306
|
+
}] } });
|
|
307
|
+
|
|
308
|
+
class UpCheckboxDirective extends UpFieldControlComponent {
|
|
309
|
+
constructor() {
|
|
310
|
+
super(...arguments);
|
|
311
|
+
this.inlineClass = input('', ...(ngDevMode ? [{ debugName: "inlineClass", alias: 'class' }] : [{ alias: 'class' }]));
|
|
312
|
+
this._computedClass = computed(() => {
|
|
313
|
+
return up('peer dark:bg-input/30 border-input size-5 min-w-0 rounded-md border bg-transparent shadow-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-border/40 relative cursor-pointer', 'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] focus-visible:outline-none', 'appearance-none checked:border-primary checked:bg-primary', 'checked:after:content-[\'\'] checked:after:absolute checked:after:border-white checked:after:border-b-2 checked:after:border-r-2 checked:after:w-1.5 checked:after:h-2.5 checked:after:rounded-br-xs checked:after:rotate-45 checked:after:left-1.5 checked:after:top-0.75', this.error() ? 'ring-destructive/20 dark:ring-destructive/40 border-destructive focus-visible:ring-destructive/50' : '', this.inlineClass());
|
|
314
|
+
}, ...(ngDevMode ? [{ debugName: "_computedClass" }] : []));
|
|
315
|
+
}
|
|
316
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpCheckboxDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
317
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.0", type: UpCheckboxDirective, isStandalone: true, selector: "[upCheckbox]", inputs: { inlineClass: { classPropertyName: "inlineClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "type": "checkbox" }, properties: { "class": "_computedClass()" } }, providers: [
|
|
318
|
+
{
|
|
319
|
+
provide: UpFieldControl,
|
|
320
|
+
useExisting: forwardRef(() => UpCheckboxDirective)
|
|
321
|
+
}
|
|
322
|
+
], exportAs: ["upCheckbox"], usesInheritance: true, ngImport: i0 }); }
|
|
323
|
+
}
|
|
324
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpCheckboxDirective, decorators: [{
|
|
325
|
+
type: Directive,
|
|
326
|
+
args: [{
|
|
327
|
+
standalone: true,
|
|
328
|
+
exportAs: 'upCheckbox',
|
|
329
|
+
selector: '[upCheckbox]',
|
|
330
|
+
host: {
|
|
331
|
+
type: 'checkbox',
|
|
332
|
+
'[class]': '_computedClass()',
|
|
333
|
+
},
|
|
334
|
+
providers: [
|
|
335
|
+
{
|
|
336
|
+
provide: UpFieldControl,
|
|
337
|
+
useExisting: forwardRef(() => UpCheckboxDirective)
|
|
338
|
+
}
|
|
339
|
+
]
|
|
340
|
+
}]
|
|
341
|
+
}], propDecorators: { inlineClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
342
|
+
|
|
343
|
+
class UpSwitchComponent extends UpFieldControlComponent {
|
|
344
|
+
constructor() {
|
|
345
|
+
super();
|
|
346
|
+
this.checked = model(false, ...(ngDevMode ? [{ debugName: "checked" }] : []));
|
|
347
|
+
this.inlineClass = input('', ...(ngDevMode ? [{ debugName: "inlineClass", alias: 'class' }] : [{ alias: 'class' }]));
|
|
348
|
+
this.required = input(false, ...(ngDevMode ? [{ debugName: "required", transform: booleanAttribute }] : [{
|
|
349
|
+
transform: booleanAttribute
|
|
350
|
+
}]));
|
|
351
|
+
this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{
|
|
352
|
+
transform: booleanAttribute
|
|
353
|
+
}]));
|
|
354
|
+
this.isTouched = false;
|
|
355
|
+
this._computedClass = computed(() => {
|
|
356
|
+
return up(`
|
|
357
|
+
relative w-9 h-5 flex items-center justify-start flex-shrink-0 outline outline-input bg-input rounded-full
|
|
358
|
+
transition-colors duration-300 ease-in-out
|
|
359
|
+
peer-checked:bg-primary after:absolute
|
|
360
|
+
after:top-1/2 after:left-[2px] after:-translate-y-1/2
|
|
361
|
+
after:w-4 after:h-4 after:bg-white after:rounded-full after:shadow-md
|
|
362
|
+
after:transition-transform after:duration-300 after:ease-in-out
|
|
363
|
+
peer-checked:after:translate-x-[15px]
|
|
364
|
+
peer-focus-visible:ring-2 peer-focus-visible:ring-primary peer-focus-visible:ring-offset-2
|
|
365
|
+
`, this.inlineClass());
|
|
366
|
+
}, ...(ngDevMode ? [{ debugName: "_computedClass" }] : []));
|
|
367
|
+
this._onChange = (_val) => { };
|
|
368
|
+
this._onTouched = () => { };
|
|
369
|
+
if (this.ngControl !== null) {
|
|
370
|
+
this.ngControl.valueAccessor = this;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
writeValue(value) {
|
|
374
|
+
this.checked.set(value);
|
|
375
|
+
}
|
|
376
|
+
registerOnChange(fn) {
|
|
377
|
+
this._onChange = fn;
|
|
378
|
+
}
|
|
379
|
+
registerOnTouched(fn) {
|
|
380
|
+
this._onTouched = fn;
|
|
381
|
+
}
|
|
382
|
+
touch() {
|
|
383
|
+
if (!this.isTouched) {
|
|
384
|
+
this._onTouched();
|
|
385
|
+
this.isTouched = true;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
toggle() {
|
|
389
|
+
if (this.disabled()) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
this.checked.set(!this.checked());
|
|
393
|
+
this._onChange(this.checked());
|
|
394
|
+
this._onTouched();
|
|
395
|
+
}
|
|
396
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpSwitchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
397
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.0", type: UpSwitchComponent, isStandalone: true, selector: "up-switch", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, inlineClass: { classPropertyName: "inlineClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange" }, host: { classAttribute: "inline-flex items-center cursor-pointer" }, providers: [
|
|
398
|
+
{
|
|
399
|
+
provide: UpFieldControl,
|
|
400
|
+
useExisting: forwardRef(() => UpSwitchComponent),
|
|
401
|
+
}
|
|
402
|
+
], usesInheritance: true, ngImport: i0, template: `
|
|
403
|
+
<input
|
|
404
|
+
type="checkbox"
|
|
405
|
+
class="sr-only peer"
|
|
406
|
+
[checked]="checked()"
|
|
407
|
+
[required]="required()"
|
|
408
|
+
[disabled]="disabled()"
|
|
409
|
+
(blur)="touch()"
|
|
410
|
+
/>
|
|
411
|
+
|
|
412
|
+
<span
|
|
413
|
+
(click)="toggle()"
|
|
414
|
+
[class]="_computedClass()"
|
|
415
|
+
>
|
|
416
|
+
</span>
|
|
417
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
418
|
+
}
|
|
419
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpSwitchComponent, decorators: [{
|
|
420
|
+
type: Component,
|
|
421
|
+
args: [{
|
|
422
|
+
standalone: true,
|
|
423
|
+
selector: 'up-switch',
|
|
424
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
425
|
+
host: {
|
|
426
|
+
class: 'inline-flex items-center cursor-pointer'
|
|
427
|
+
},
|
|
428
|
+
providers: [
|
|
429
|
+
{
|
|
430
|
+
provide: UpFieldControl,
|
|
431
|
+
useExisting: forwardRef(() => UpSwitchComponent),
|
|
432
|
+
}
|
|
433
|
+
],
|
|
434
|
+
template: `
|
|
435
|
+
<input
|
|
436
|
+
type="checkbox"
|
|
437
|
+
class="sr-only peer"
|
|
438
|
+
[checked]="checked()"
|
|
439
|
+
[required]="required()"
|
|
440
|
+
[disabled]="disabled()"
|
|
441
|
+
(blur)="touch()"
|
|
442
|
+
/>
|
|
443
|
+
|
|
444
|
+
<span
|
|
445
|
+
(click)="toggle()"
|
|
446
|
+
[class]="_computedClass()"
|
|
447
|
+
>
|
|
448
|
+
</span>
|
|
449
|
+
`
|
|
450
|
+
}]
|
|
451
|
+
}], ctorParameters: () => [], propDecorators: { checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], inlineClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
|
|
452
|
+
|
|
453
|
+
class UpPasswordComponent extends UpFieldControlComponent {
|
|
454
|
+
constructor() {
|
|
455
|
+
super();
|
|
456
|
+
this.placeholder = input(...(ngDevMode ? [undefined, { debugName: "placeholder" }] : []));
|
|
457
|
+
this.inlineClass = input('', ...(ngDevMode ? [{ debugName: "inlineClass", alias: 'class' }] : [{ alias: 'class' }]));
|
|
458
|
+
this.autocomplete = input('off', ...(ngDevMode ? [{ debugName: "autocomplete" }] : []));
|
|
459
|
+
this.required = input(false, ...(ngDevMode ? [{ debugName: "required", transform: booleanAttribute }] : [{
|
|
460
|
+
transform: booleanAttribute
|
|
461
|
+
}]));
|
|
462
|
+
this.disabled = model(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
463
|
+
this.value = signal('', ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
464
|
+
this.type = signal('password', ...(ngDevMode ? [{ debugName: "type" }] : []));
|
|
465
|
+
this.isTouched = false;
|
|
466
|
+
this._computedClass = computed(() => {
|
|
467
|
+
return up('pr-10 peer', this.inlineClass());
|
|
468
|
+
}, ...(ngDevMode ? [{ debugName: "_computedClass" }] : []));
|
|
469
|
+
/**
|
|
470
|
+
* Callback function to handle value changes in the password input.
|
|
471
|
+
* @type {(_val: any) => void}
|
|
472
|
+
*/
|
|
473
|
+
this._onChange = (_val) => { };
|
|
474
|
+
/**
|
|
475
|
+
* Callback function to handle touch events in the password input.
|
|
476
|
+
* @type {() => void}
|
|
477
|
+
*/
|
|
478
|
+
this._onTouched = () => { };
|
|
479
|
+
if (this.ngControl !== null) {
|
|
480
|
+
this.ngControl.valueAccessor = this;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Registers a callback function to be called when the password input value changes.
|
|
485
|
+
* @param {(_val: any) => void} fn - Callback function for value changes.
|
|
486
|
+
*/
|
|
487
|
+
registerOnChange(fn) {
|
|
488
|
+
this._onChange = fn;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Registers a callback function to be called when the password input is touched.
|
|
492
|
+
* @param {() => void} fn - Callback function for touch events.
|
|
493
|
+
*/
|
|
494
|
+
registerOnTouched(fn) {
|
|
495
|
+
this._onTouched = fn;
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Writes a new value to the password input.
|
|
499
|
+
* @param {*} val - The new value to be set.
|
|
500
|
+
*/
|
|
501
|
+
writeValue(val) {
|
|
502
|
+
this.value.set(val ?? '');
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Function that is called by the forms API when the control status change to or from 'DISABLED'.
|
|
506
|
+
* Depending on the status, it enables or disables the appropriate DOM element
|
|
507
|
+
* @param {boolean} isDisabled - disable state
|
|
508
|
+
*/
|
|
509
|
+
setDisabledState(isDisabled) {
|
|
510
|
+
this.disabled.set(isDisabled);
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Toggles the type of the password input between text and password.
|
|
514
|
+
*/
|
|
515
|
+
changeType() {
|
|
516
|
+
if (!this.disabled()) {
|
|
517
|
+
this.type.set(this.type() === 'text' ? 'password' : 'text');
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Event handler to handle touch status.
|
|
522
|
+
*
|
|
523
|
+
* @returns {void}
|
|
524
|
+
*/
|
|
525
|
+
touch() {
|
|
526
|
+
if (!this.isTouched) {
|
|
527
|
+
this._onTouched();
|
|
528
|
+
this.isTouched = true;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Event handler for changes in the password input.
|
|
533
|
+
* If not touched, marks the input as touched.
|
|
534
|
+
* Updates the value and triggers change detection.
|
|
535
|
+
* @param {any} param - Event detail containing the new password input value.
|
|
536
|
+
*/
|
|
537
|
+
change({ value }) {
|
|
538
|
+
if (!this.isTouched) {
|
|
539
|
+
this._onTouched();
|
|
540
|
+
this.isTouched = true;
|
|
541
|
+
}
|
|
542
|
+
this.value.set(value);
|
|
543
|
+
this._onChange(this.value());
|
|
544
|
+
}
|
|
545
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpPasswordComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
546
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.0", type: UpPasswordComponent, isStandalone: true, selector: "up-password", inputs: { placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, inlineClass: { classPropertyName: "inlineClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { disabled: "disabledChange" }, host: { classAttribute: "block relative" }, providers: [
|
|
547
|
+
{
|
|
548
|
+
provide: UpFieldControl,
|
|
549
|
+
useExisting: forwardRef(() => UpPasswordComponent)
|
|
550
|
+
},
|
|
551
|
+
provideIcons({
|
|
552
|
+
matVisibilityRound,
|
|
553
|
+
matVisibilityOffRound
|
|
554
|
+
}),
|
|
555
|
+
], usesInheritance: true, ngImport: i0, template: `
|
|
556
|
+
<input
|
|
557
|
+
upInput
|
|
558
|
+
maxlength="64"
|
|
559
|
+
[type]="type()"
|
|
560
|
+
[value]="value()"
|
|
561
|
+
[required]="required()"
|
|
562
|
+
[disabled]="disabled()"
|
|
563
|
+
[class]="_computedClass()"
|
|
564
|
+
[placeholder]="placeholder()?? ''"
|
|
565
|
+
[attr.autocomplete]="autocomplete()"
|
|
566
|
+
(blur)="touch()"
|
|
567
|
+
(input)="change($event.target)"
|
|
568
|
+
/>
|
|
569
|
+
|
|
570
|
+
<ng-icon
|
|
571
|
+
class="absolute right-3 top-1/2 -translate-y-1/2 cursor-pointer text-gray-500 hover:text-primary peer-disabled:opacity-50 peer-disabled:cursor-not-allowed"
|
|
572
|
+
[name]="type() === 'password'? 'matVisibilityRound' : 'matVisibilityOffRound'"
|
|
573
|
+
(click)="changeType()"
|
|
574
|
+
/>
|
|
575
|
+
`, isInline: true, dependencies: [{ kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }, { kind: "directive", type: UpInputDirective, selector: "[upInput]", inputs: ["class"], exportAs: ["upInput"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
576
|
+
}
|
|
577
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpPasswordComponent, decorators: [{
|
|
578
|
+
type: Component,
|
|
579
|
+
args: [{
|
|
580
|
+
standalone: true,
|
|
581
|
+
selector: 'up-password',
|
|
582
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
583
|
+
host: {
|
|
584
|
+
class: 'block relative',
|
|
585
|
+
},
|
|
586
|
+
imports: [
|
|
587
|
+
NgIcon,
|
|
588
|
+
UpInputDirective
|
|
589
|
+
],
|
|
590
|
+
providers: [
|
|
591
|
+
{
|
|
592
|
+
provide: UpFieldControl,
|
|
593
|
+
useExisting: forwardRef(() => UpPasswordComponent)
|
|
594
|
+
},
|
|
595
|
+
provideIcons({
|
|
596
|
+
matVisibilityRound,
|
|
597
|
+
matVisibilityOffRound
|
|
598
|
+
}),
|
|
599
|
+
],
|
|
600
|
+
template: `
|
|
601
|
+
<input
|
|
602
|
+
upInput
|
|
603
|
+
maxlength="64"
|
|
604
|
+
[type]="type()"
|
|
605
|
+
[value]="value()"
|
|
606
|
+
[required]="required()"
|
|
607
|
+
[disabled]="disabled()"
|
|
608
|
+
[class]="_computedClass()"
|
|
609
|
+
[placeholder]="placeholder()?? ''"
|
|
610
|
+
[attr.autocomplete]="autocomplete()"
|
|
611
|
+
(blur)="touch()"
|
|
612
|
+
(input)="change($event.target)"
|
|
613
|
+
/>
|
|
614
|
+
|
|
615
|
+
<ng-icon
|
|
616
|
+
class="absolute right-3 top-1/2 -translate-y-1/2 cursor-pointer text-gray-500 hover:text-primary peer-disabled:opacity-50 peer-disabled:cursor-not-allowed"
|
|
617
|
+
[name]="type() === 'password'? 'matVisibilityRound' : 'matVisibilityOffRound'"
|
|
618
|
+
(click)="changeType()"
|
|
619
|
+
/>
|
|
620
|
+
`,
|
|
621
|
+
}]
|
|
622
|
+
}], ctorParameters: () => [], propDecorators: { placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], inlineClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], autocomplete: [{ type: i0.Input, args: [{ isSignal: true, alias: "autocomplete", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }] } });
|
|
623
|
+
|
|
624
|
+
class UpSelectComponent extends UpFieldControlComponent {
|
|
625
|
+
constructor() {
|
|
626
|
+
super();
|
|
627
|
+
this.items = input.required(...(ngDevMode ? [{ debugName: "items" }] : []));
|
|
628
|
+
this.label = input('', ...(ngDevMode ? [{ debugName: "label" }] : []));
|
|
629
|
+
this.appendTo = input('', ...(ngDevMode ? [{ debugName: "appendTo" }] : []));
|
|
630
|
+
this.placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
631
|
+
this.bindLabel = input('label', ...(ngDevMode ? [{ debugName: "bindLabel" }] : []));
|
|
632
|
+
this.bindValue = input('value', ...(ngDevMode ? [{ debugName: "bindValue" }] : []));
|
|
633
|
+
this.value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
634
|
+
this.inlineClass = input('', ...(ngDevMode ? [{ debugName: "inlineClass", alias: 'class' }] : [{ alias: 'class' }]));
|
|
635
|
+
this.loading = input(false, ...(ngDevMode ? [{ debugName: "loading" }] : []));
|
|
636
|
+
this.multiple = input(false, ...(ngDevMode ? [{ debugName: "multiple" }] : []));
|
|
637
|
+
this.required = input(false, ...(ngDevMode ? [{ debugName: "required" }] : []));
|
|
638
|
+
this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
639
|
+
this.clearable = input(true, ...(ngDevMode ? [{ debugName: "clearable" }] : []));
|
|
640
|
+
this.addTag = input(false, ...(ngDevMode ? [{ debugName: "addTag", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
641
|
+
this.searchable = input(false, ...(ngDevMode ? [{ debugName: "searchable", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
642
|
+
this.virtualScroll = input(false, ...(ngDevMode ? [{ debugName: "virtualScroll", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
643
|
+
this.changed = output();
|
|
644
|
+
this.control = contentChild(UpFieldControl, ...(ngDevMode ? [{ debugName: "control" }] : []));
|
|
645
|
+
this._computedClass = computed(() => {
|
|
646
|
+
return up('w-full min-w-0 h-9', 'data-[disabled=true]:[&>.ng-select-container]:cursor-not-allowed! data-[disabled=true]:[&>.ng-select-container]:opacity-50! data-[disabled=true]:[&>.ng-select-container]:bg-transparent!', '[&>.ng-select-container]:border! [&>.ng-select-container]:border-input! [&>.ng-select-container]:rounded-md! [&>.ng-select-container]:cursor-pointer! [&>.ng-select-container]:shadow-xs! [&>.ng-select-container]:items-center!', '[&>.ng-select-container>.ng-value-container>.ng-placeholder]:text-base! md:[&>.ng-select-container>.ng-value-container>.ng-placeholder]:text-sm!', '[&>.ng-select-container>.ng-value-container>.ng-value]:text-base! md:[&>.ng-select-container>.ng-value-container>.ng-value]:text-sm! [&>.ng-select-container>.ng-value-container>.ng-value]:text-black!', '[&.ng-select-focused>.ng-select-container]:border-ring! [&.ng-select-focused>.ng-select-container]:ring-ring/50! [&.ng-select-focused>.ng-select-container]:ring-[3px]!', this.inlineClass());
|
|
647
|
+
}, ...(ngDevMode ? [{ debugName: "_computedClass" }] : []));
|
|
648
|
+
this.isTouched = false;
|
|
649
|
+
this._onTouched = () => { };
|
|
650
|
+
this._onChange = (_val) => { };
|
|
651
|
+
if (this.ngControl !== null) {
|
|
652
|
+
this.ngControl.valueAccessor = this;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Lifecycle hook — initializes the control name for form integration.
|
|
657
|
+
*/
|
|
658
|
+
ngOnInit() {
|
|
659
|
+
this.setControlName(this.ngControl?.name);
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* Writes a new value from the form model into the view.
|
|
663
|
+
*
|
|
664
|
+
* @param {any} value - The value to assign to the select.
|
|
665
|
+
*/
|
|
666
|
+
writeValue(value) {
|
|
667
|
+
this.value.set(value);
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Registers a callback function to be called when the select value changes.
|
|
671
|
+
*
|
|
672
|
+
* @param {(val: any) => void} fn - Callback function to handle value changes.
|
|
673
|
+
*/
|
|
674
|
+
registerOnChange(fn) {
|
|
675
|
+
this._onChange = fn;
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* Registers a callback function to be called when the component is touched.
|
|
679
|
+
*
|
|
680
|
+
* @param {() => void} fn - Callback function for touch events.
|
|
681
|
+
*/
|
|
682
|
+
registerOnTouched(fn) {
|
|
683
|
+
this._onTouched = fn;
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Marks the component as touched (used for form validation state).
|
|
687
|
+
*/
|
|
688
|
+
touch() {
|
|
689
|
+
if (!this.isTouched) {
|
|
690
|
+
this._onTouched();
|
|
691
|
+
this.isTouched = true;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* Handles changes from the dropdown and propagates them to the form model.
|
|
696
|
+
*
|
|
697
|
+
* @param {any} e - The new value emitted by the ng-select component.
|
|
698
|
+
*/
|
|
699
|
+
change(e) {
|
|
700
|
+
if (!this.isTouched) {
|
|
701
|
+
this._onTouched();
|
|
702
|
+
this.isTouched = true;
|
|
703
|
+
}
|
|
704
|
+
if (!this.disabled()) {
|
|
705
|
+
this.value.set(e);
|
|
706
|
+
this._onChange(this.value());
|
|
707
|
+
this.changed.emit(this.value());
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
711
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.0.0", type: UpSelectComponent, isStandalone: true, selector: "up-select", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, appendTo: { classPropertyName: "appendTo", publicName: "appendTo", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, bindLabel: { classPropertyName: "bindLabel", publicName: "bindLabel", isSignal: true, isRequired: false, transformFunction: null }, bindValue: { classPropertyName: "bindValue", publicName: "bindValue", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, inlineClass: { classPropertyName: "inlineClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, addTag: { classPropertyName: "addTag", publicName: "addTag", isSignal: true, isRequired: false, transformFunction: null }, searchable: { classPropertyName: "searchable", publicName: "searchable", isSignal: true, isRequired: false, transformFunction: null }, virtualScroll: { classPropertyName: "virtualScroll", publicName: "virtualScroll", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", changed: "changed" }, host: { classAttribute: "block relative" }, providers: [
|
|
712
|
+
{
|
|
713
|
+
provide: UpFieldControl,
|
|
714
|
+
useExisting: forwardRef(() => UpSelectComponent)
|
|
715
|
+
}
|
|
716
|
+
], queries: [{ propertyName: "control", first: true, predicate: UpFieldControl, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
|
|
717
|
+
<ng-select
|
|
718
|
+
[items]="items()"
|
|
719
|
+
[ngModel]="value()"
|
|
720
|
+
[addTag]="addTag()"
|
|
721
|
+
[loading]="loading()"
|
|
722
|
+
[multiple]="multiple()"
|
|
723
|
+
[readonly]="disabled()"
|
|
724
|
+
[appendTo]="appendTo()"
|
|
725
|
+
[clearable]="clearable()"
|
|
726
|
+
[bindLabel]="bindLabel()"
|
|
727
|
+
[bindValue]="bindValue()"
|
|
728
|
+
[class]="_computedClass()"
|
|
729
|
+
[searchable]="searchable()"
|
|
730
|
+
[placeholder]="placeholder()"
|
|
731
|
+
[virtualScroll]="virtualScroll()"
|
|
732
|
+
[attr.data-disabled]="disabled()"
|
|
733
|
+
(blur)="touch()"
|
|
734
|
+
(ngModelChange)="change($event)"
|
|
735
|
+
/>
|
|
736
|
+
`, isInline: true, styles: [".ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value{background-color:var(--accent)!important}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon.left{border-right-color:color-mix(in oklab,var(--primary) 50%,transparent)!important}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon.left:hover{background-color:color-mix(in oklab,var(--primary) 40%,transparent)!important}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{top:50%!important;padding-bottom:0!important;transform:translateY(-50%)!important}.ng-select .ng-select-container{transition:all .2s ease}.ng-select .ng-select-container .ng-value-container{align-items:center;padding-left:.75rem}.ng-select .ng-select-container .ng-value-container .ng-placeholder{color:var(--muted-foreground)}.ng-select .ng-select-container .ng-arrow-wrapper{padding-right:.75rem}.ng-select .ng-select-container .ng-clear-wrapper{margin-right:.25rem;transition:color .2s ease}.ng-select .ng-select-container .ng-clear-wrapper:hover .ng-clear{color:var(--destructive)}.ng-dropdown-panel{overflow:hidden;margin-top:.25rem!important;border-color:var(--border)!important;border-radius:calc(var(--radius) - 2px)!important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}.ng-dropdown-panel .ng-option-label{color:#000;font-size:1rem}@media screen and (min-width:48rem){.ng-dropdown-panel .ng-option-label{font-size:.875rem}}.ng-dropdown-panel .ng-option:hover,.ng-dropdown-panel .ng-option-marked{background-color:var(--accent)!important}.ng-dropdown-panel .ng-option-selected{color:#000!important;background-color:color-mix(in oklab,var(--primary) 15%,transparent)!important}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: NgSelectComponent, selector: "ng-select", inputs: ["ariaLabelDropdown", "ariaLabel", "markFirst", "placeholder", "fixedPlaceholder", "notFoundText", "typeToSearchText", "preventToggleOnRightClick", "addTagText", "loadingText", "clearAllText", "dropdownPosition", "appendTo", "outsideClickEvent", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "tabFocusOnClearButton", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "ngClass", "typeahead", "multiple", "addTag", "searchable", "clearable", "deselectOnClick", "clearSearchOnAdd", "compareWith", "keyDownFn", "bindLabel", "bindValue", "appearance", "isOpen", "items"], outputs: ["bindLabelChange", "bindValueChange", "appearanceChange", "isOpenChange", "itemsChange", "blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"], exportAs: ["ngSelect"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
737
|
+
}
|
|
738
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpSelectComponent, decorators: [{
|
|
739
|
+
type: Component,
|
|
740
|
+
args: [{ standalone: true, selector: 'up-select', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
741
|
+
class: 'block relative',
|
|
742
|
+
}, imports: [
|
|
743
|
+
FormsModule,
|
|
744
|
+
NgSelectComponent
|
|
745
|
+
], providers: [
|
|
746
|
+
{
|
|
747
|
+
provide: UpFieldControl,
|
|
748
|
+
useExisting: forwardRef(() => UpSelectComponent)
|
|
749
|
+
}
|
|
750
|
+
], template: `
|
|
751
|
+
<ng-select
|
|
752
|
+
[items]="items()"
|
|
753
|
+
[ngModel]="value()"
|
|
754
|
+
[addTag]="addTag()"
|
|
755
|
+
[loading]="loading()"
|
|
756
|
+
[multiple]="multiple()"
|
|
757
|
+
[readonly]="disabled()"
|
|
758
|
+
[appendTo]="appendTo()"
|
|
759
|
+
[clearable]="clearable()"
|
|
760
|
+
[bindLabel]="bindLabel()"
|
|
761
|
+
[bindValue]="bindValue()"
|
|
762
|
+
[class]="_computedClass()"
|
|
763
|
+
[searchable]="searchable()"
|
|
764
|
+
[placeholder]="placeholder()"
|
|
765
|
+
[virtualScroll]="virtualScroll()"
|
|
766
|
+
[attr.data-disabled]="disabled()"
|
|
767
|
+
(blur)="touch()"
|
|
768
|
+
(ngModelChange)="change($event)"
|
|
769
|
+
/>
|
|
770
|
+
`, styles: [".ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value{background-color:var(--accent)!important}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon.left{border-right-color:color-mix(in oklab,var(--primary) 50%,transparent)!important}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon.left:hover{background-color:color-mix(in oklab,var(--primary) 40%,transparent)!important}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{top:50%!important;padding-bottom:0!important;transform:translateY(-50%)!important}.ng-select .ng-select-container{transition:all .2s ease}.ng-select .ng-select-container .ng-value-container{align-items:center;padding-left:.75rem}.ng-select .ng-select-container .ng-value-container .ng-placeholder{color:var(--muted-foreground)}.ng-select .ng-select-container .ng-arrow-wrapper{padding-right:.75rem}.ng-select .ng-select-container .ng-clear-wrapper{margin-right:.25rem;transition:color .2s ease}.ng-select .ng-select-container .ng-clear-wrapper:hover .ng-clear{color:var(--destructive)}.ng-dropdown-panel{overflow:hidden;margin-top:.25rem!important;border-color:var(--border)!important;border-radius:calc(var(--radius) - 2px)!important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}.ng-dropdown-panel .ng-option-label{color:#000;font-size:1rem}@media screen and (min-width:48rem){.ng-dropdown-panel .ng-option-label{font-size:.875rem}}.ng-dropdown-panel .ng-option:hover,.ng-dropdown-panel .ng-option-marked{background-color:var(--accent)!important}.ng-dropdown-panel .ng-option-selected{color:#000!important;background-color:color-mix(in oklab,var(--primary) 15%,transparent)!important}\n"] }]
|
|
771
|
+
}], ctorParameters: () => [], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], appendTo: [{ type: i0.Input, args: [{ isSignal: true, alias: "appendTo", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], bindLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "bindLabel", required: false }] }], bindValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "bindValue", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], inlineClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], addTag: [{ type: i0.Input, args: [{ isSignal: true, alias: "addTag", required: false }] }], searchable: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchable", required: false }] }], virtualScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScroll", required: false }] }], changed: [{ type: i0.Output, args: ["changed"] }], control: [{ type: i0.ContentChild, args: [i0.forwardRef(() => UpFieldControl), { isSignal: true }] }] } });
|
|
772
|
+
|
|
773
|
+
class UpCountrySelectComponent extends UpFieldControlComponent {
|
|
774
|
+
constructor(service) {
|
|
775
|
+
super();
|
|
776
|
+
this.service = service;
|
|
777
|
+
this.multiple = input(false, ...(ngDevMode ? [{ debugName: "multiple" }] : []));
|
|
778
|
+
this.clearable = input(true, ...(ngDevMode ? [{ debugName: "clearable" }] : []));
|
|
779
|
+
this.placeholder = input('Select country', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
780
|
+
this.inlineClass = input('', ...(ngDevMode ? [{ debugName: "inlineClass", alias: 'class' }] : [{ alias: 'class' }]));
|
|
781
|
+
this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
782
|
+
this.value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
783
|
+
this.changed = output();
|
|
784
|
+
this.countries = signal([], ...(ngDevMode ? [{ debugName: "countries" }] : []));
|
|
785
|
+
this.isLoading = signal(true, ...(ngDevMode ? [{ debugName: "isLoading" }] : []));
|
|
786
|
+
this._disabled = signal(false, ...(ngDevMode ? [{ debugName: "_disabled" }] : []));
|
|
787
|
+
this.isTouched = false;
|
|
788
|
+
this._onTouched = () => { };
|
|
789
|
+
this._onChange = (_val) => { };
|
|
790
|
+
if (this.ngControl) {
|
|
791
|
+
this.ngControl.valueAccessor = this;
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
ngOnInit() {
|
|
795
|
+
this.sub = this.service.query().subscribe({
|
|
796
|
+
error: () => {
|
|
797
|
+
this.countries.set([]);
|
|
798
|
+
this.isLoading.set(false);
|
|
799
|
+
},
|
|
800
|
+
next: ({ data: { webConfigMsCountry: { data } } }) => {
|
|
801
|
+
this.countries.set(data);
|
|
802
|
+
this.isLoading.set(false);
|
|
803
|
+
}
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
ngOnDestroy() {
|
|
807
|
+
this.sub?.unsubscribe();
|
|
808
|
+
}
|
|
809
|
+
registerOnChange(fn) {
|
|
810
|
+
this._onChange = fn;
|
|
811
|
+
}
|
|
812
|
+
registerOnTouched(fn) {
|
|
813
|
+
this._onTouched = fn;
|
|
814
|
+
}
|
|
815
|
+
setDisabledState(isDisabled) {
|
|
816
|
+
this._disabled.set(isDisabled);
|
|
817
|
+
}
|
|
818
|
+
writeValue(value) {
|
|
819
|
+
this.value.set(value);
|
|
820
|
+
}
|
|
821
|
+
onTouched() {
|
|
822
|
+
if (!this.isTouched) {
|
|
823
|
+
this._onTouched();
|
|
824
|
+
this.isTouched = true;
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
change(value) {
|
|
828
|
+
if (!this.isTouched) {
|
|
829
|
+
this._onTouched();
|
|
830
|
+
this.isTouched = true;
|
|
831
|
+
}
|
|
832
|
+
if (!this.disabled()) {
|
|
833
|
+
this.value.set(value);
|
|
834
|
+
this._onChange(value);
|
|
835
|
+
this.changed.emit(this.countries().find(c => c.code === value));
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpCountrySelectComponent, deps: [{ token: i1$1.CountryService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
839
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.0", type: UpCountrySelectComponent, isStandalone: true, selector: "up-country-select", inputs: { multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, inlineClass: { classPropertyName: "inlineClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", changed: "changed" }, host: { classAttribute: "block" }, providers: [
|
|
840
|
+
{
|
|
841
|
+
provide: UpFieldControl,
|
|
842
|
+
useExisting: forwardRef(() => UpCountrySelectComponent),
|
|
843
|
+
}
|
|
844
|
+
], usesInheritance: true, ngImport: i0, template: `
|
|
845
|
+
<up-select
|
|
846
|
+
searchable
|
|
847
|
+
virtualScroll
|
|
848
|
+
appendTo="body"
|
|
849
|
+
bindValue="code"
|
|
850
|
+
bindLabel="name"
|
|
851
|
+
[value]="value()"
|
|
852
|
+
[items]="countries()"
|
|
853
|
+
[loading]="isLoading()"
|
|
854
|
+
[multiple]="multiple()"
|
|
855
|
+
[class]="inlineClass()"
|
|
856
|
+
[clearable]="clearable()"
|
|
857
|
+
[placeholder]="placeholder()"
|
|
858
|
+
[disabled]="disabled() || _disabled()"
|
|
859
|
+
(blur)="onTouched()"
|
|
860
|
+
(changed)="change($event)"
|
|
861
|
+
/>
|
|
862
|
+
`, isInline: true, dependencies: [{ kind: "component", type: UpSelectComponent, selector: "up-select", inputs: ["items", "label", "appendTo", "placeholder", "bindLabel", "bindValue", "value", "class", "loading", "multiple", "required", "disabled", "clearable", "addTag", "searchable", "virtualScroll"], outputs: ["valueChange", "changed"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
863
|
+
}
|
|
864
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpCountrySelectComponent, decorators: [{
|
|
865
|
+
type: Component,
|
|
866
|
+
args: [{
|
|
867
|
+
standalone: true,
|
|
868
|
+
selector: 'up-country-select',
|
|
869
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
870
|
+
host: {
|
|
871
|
+
class: 'block'
|
|
872
|
+
},
|
|
873
|
+
imports: [
|
|
874
|
+
UpSelectComponent
|
|
875
|
+
],
|
|
876
|
+
providers: [
|
|
877
|
+
{
|
|
878
|
+
provide: UpFieldControl,
|
|
879
|
+
useExisting: forwardRef(() => UpCountrySelectComponent),
|
|
880
|
+
}
|
|
881
|
+
],
|
|
882
|
+
template: `
|
|
883
|
+
<up-select
|
|
884
|
+
searchable
|
|
885
|
+
virtualScroll
|
|
886
|
+
appendTo="body"
|
|
887
|
+
bindValue="code"
|
|
888
|
+
bindLabel="name"
|
|
889
|
+
[value]="value()"
|
|
890
|
+
[items]="countries()"
|
|
891
|
+
[loading]="isLoading()"
|
|
892
|
+
[multiple]="multiple()"
|
|
893
|
+
[class]="inlineClass()"
|
|
894
|
+
[clearable]="clearable()"
|
|
895
|
+
[placeholder]="placeholder()"
|
|
896
|
+
[disabled]="disabled() || _disabled()"
|
|
897
|
+
(blur)="onTouched()"
|
|
898
|
+
(changed)="change($event)"
|
|
899
|
+
/>
|
|
900
|
+
`,
|
|
901
|
+
}]
|
|
902
|
+
}], ctorParameters: () => [{ type: i1$1.CountryService }], propDecorators: { multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], inlineClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], changed: [{ type: i0.Output, args: ["changed"] }] } });
|
|
903
|
+
|
|
904
|
+
class UpCurrencySelectComponent extends UpFieldControlComponent {
|
|
905
|
+
constructor(service) {
|
|
906
|
+
super();
|
|
907
|
+
this.service = service;
|
|
908
|
+
this.multiple = input(false, ...(ngDevMode ? [{ debugName: "multiple" }] : []));
|
|
909
|
+
this.clearable = input(true, ...(ngDevMode ? [{ debugName: "clearable" }] : []));
|
|
910
|
+
this.placeholder = input('Select currency', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
911
|
+
this.inlineClass = input('', ...(ngDevMode ? [{ debugName: "inlineClass", alias: 'class' }] : [{ alias: 'class' }]));
|
|
912
|
+
this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
913
|
+
this.value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
914
|
+
this.changed = output();
|
|
915
|
+
this.isLoading = signal(true, ...(ngDevMode ? [{ debugName: "isLoading" }] : []));
|
|
916
|
+
this._disabled = signal(false, ...(ngDevMode ? [{ debugName: "_disabled" }] : []));
|
|
917
|
+
this.currencies = signal([], ...(ngDevMode ? [{ debugName: "currencies" }] : []));
|
|
918
|
+
this.isTouched = false;
|
|
919
|
+
this._onTouched = () => { };
|
|
920
|
+
this._onChange = (_val) => { };
|
|
921
|
+
if (this.ngControl) {
|
|
922
|
+
this.ngControl.valueAccessor = this;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
ngOnInit() {
|
|
926
|
+
this.sub = this.service.query().subscribe({
|
|
927
|
+
error: () => {
|
|
928
|
+
this.currencies.set([]);
|
|
929
|
+
this.isLoading.set(false);
|
|
930
|
+
},
|
|
931
|
+
next: ({ data: { webConfigMsCurrency: { data } } }) => {
|
|
932
|
+
this.currencies.set(data.map(({ code, name, ...ccy }) => {
|
|
933
|
+
return {
|
|
934
|
+
...ccy,
|
|
935
|
+
code,
|
|
936
|
+
name,
|
|
937
|
+
displayLabel: `${code} - ${name}`
|
|
938
|
+
};
|
|
939
|
+
}));
|
|
940
|
+
this.isLoading.set(false);
|
|
941
|
+
}
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
ngOnDestroy() {
|
|
945
|
+
this.sub?.unsubscribe();
|
|
946
|
+
}
|
|
947
|
+
registerOnChange(fn) {
|
|
948
|
+
this._onChange = fn;
|
|
949
|
+
}
|
|
950
|
+
registerOnTouched(fn) {
|
|
951
|
+
this._onTouched = fn;
|
|
952
|
+
}
|
|
953
|
+
setDisabledState(isDisabled) {
|
|
954
|
+
this._disabled.set(isDisabled);
|
|
955
|
+
}
|
|
956
|
+
writeValue(value) {
|
|
957
|
+
this.value.set(value);
|
|
958
|
+
}
|
|
959
|
+
onTouched() {
|
|
960
|
+
if (!this.isTouched) {
|
|
961
|
+
this._onTouched();
|
|
962
|
+
this.isTouched = true;
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
change(value) {
|
|
966
|
+
if (!this.isTouched) {
|
|
967
|
+
this._onTouched();
|
|
968
|
+
this.isTouched = true;
|
|
969
|
+
}
|
|
970
|
+
if (!this.disabled()) {
|
|
971
|
+
this.value.set(value);
|
|
972
|
+
this._onChange(value);
|
|
973
|
+
this.changed.emit(this.currencies().find(c => c.code === value));
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpCurrencySelectComponent, deps: [{ token: i1$1.CurrencyService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
977
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.0", type: UpCurrencySelectComponent, isStandalone: true, selector: "up-currency-select", inputs: { multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, inlineClass: { classPropertyName: "inlineClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", changed: "changed" }, host: { classAttribute: "block" }, providers: [
|
|
978
|
+
{
|
|
979
|
+
provide: UpFieldControl,
|
|
980
|
+
useExisting: forwardRef(() => UpCurrencySelectComponent)
|
|
981
|
+
}
|
|
982
|
+
], usesInheritance: true, ngImport: i0, template: `
|
|
983
|
+
<up-select
|
|
984
|
+
searchable
|
|
985
|
+
virtualScroll
|
|
986
|
+
appendTo="body"
|
|
987
|
+
bindValue="code"
|
|
988
|
+
bindLabel="displayLabel"
|
|
989
|
+
[value]="value()"
|
|
990
|
+
[items]="currencies()"
|
|
991
|
+
[loading]="isLoading()"
|
|
992
|
+
[multiple]="multiple()"
|
|
993
|
+
[class]="inlineClass()"
|
|
994
|
+
[clearable]="clearable()"
|
|
995
|
+
[placeholder]="placeholder()"
|
|
996
|
+
[disabled]="disabled() || _disabled()"
|
|
997
|
+
(blur)="onTouched()"
|
|
998
|
+
(changed)="change($event)"
|
|
999
|
+
/>
|
|
1000
|
+
`, isInline: true, dependencies: [{ kind: "component", type: UpSelectComponent, selector: "up-select", inputs: ["items", "label", "appendTo", "placeholder", "bindLabel", "bindValue", "value", "class", "loading", "multiple", "required", "disabled", "clearable", "addTag", "searchable", "virtualScroll"], outputs: ["valueChange", "changed"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1001
|
+
}
|
|
1002
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpCurrencySelectComponent, decorators: [{
|
|
1003
|
+
type: Component,
|
|
1004
|
+
args: [{
|
|
1005
|
+
standalone: true,
|
|
1006
|
+
selector: 'up-currency-select',
|
|
1007
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1008
|
+
host: {
|
|
1009
|
+
class: 'block'
|
|
1010
|
+
},
|
|
1011
|
+
imports: [
|
|
1012
|
+
UpSelectComponent
|
|
1013
|
+
],
|
|
1014
|
+
providers: [
|
|
1015
|
+
{
|
|
1016
|
+
provide: UpFieldControl,
|
|
1017
|
+
useExisting: forwardRef(() => UpCurrencySelectComponent)
|
|
1018
|
+
}
|
|
1019
|
+
],
|
|
1020
|
+
template: `
|
|
1021
|
+
<up-select
|
|
1022
|
+
searchable
|
|
1023
|
+
virtualScroll
|
|
1024
|
+
appendTo="body"
|
|
1025
|
+
bindValue="code"
|
|
1026
|
+
bindLabel="displayLabel"
|
|
1027
|
+
[value]="value()"
|
|
1028
|
+
[items]="currencies()"
|
|
1029
|
+
[loading]="isLoading()"
|
|
1030
|
+
[multiple]="multiple()"
|
|
1031
|
+
[class]="inlineClass()"
|
|
1032
|
+
[clearable]="clearable()"
|
|
1033
|
+
[placeholder]="placeholder()"
|
|
1034
|
+
[disabled]="disabled() || _disabled()"
|
|
1035
|
+
(blur)="onTouched()"
|
|
1036
|
+
(changed)="change($event)"
|
|
1037
|
+
/>
|
|
1038
|
+
`,
|
|
1039
|
+
}]
|
|
1040
|
+
}], ctorParameters: () => [{ type: i1$1.CurrencyService }], propDecorators: { multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], inlineClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], changed: [{ type: i0.Output, args: ["changed"] }] } });
|
|
1041
|
+
|
|
1042
|
+
class UpSearchableSelectComponent extends UpFieldControlComponent {
|
|
1043
|
+
constructor() {
|
|
1044
|
+
super();
|
|
1045
|
+
this.query = input.required(...(ngDevMode ? [{ debugName: "query" }] : []));
|
|
1046
|
+
this.label = input('', ...(ngDevMode ? [{ debugName: "label" }] : []));
|
|
1047
|
+
this.appendTo = input('', ...(ngDevMode ? [{ debugName: "appendTo" }] : []));
|
|
1048
|
+
this.placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
1049
|
+
this.initialItems = input([], ...(ngDevMode ? [{ debugName: "initialItems" }] : []));
|
|
1050
|
+
this.bindLabel = input('label', ...(ngDevMode ? [{ debugName: "bindLabel" }] : []));
|
|
1051
|
+
this.bindValue = input('value', ...(ngDevMode ? [{ debugName: "bindValue" }] : []));
|
|
1052
|
+
this.inlineClass = input('', ...(ngDevMode ? [{ debugName: "inlineClass", alias: 'class' }] : [{ alias: 'class' }]));
|
|
1053
|
+
this.addTag = input(false, ...(ngDevMode ? [{ debugName: "addTag", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
1054
|
+
this.multiple = input(false, ...(ngDevMode ? [{ debugName: "multiple", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
1055
|
+
this.required = input(false, ...(ngDevMode ? [{ debugName: "required", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
1056
|
+
this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
1057
|
+
this.clearable = input(true, ...(ngDevMode ? [{ debugName: "clearable", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
1058
|
+
this.virtualScroll = input(false, ...(ngDevMode ? [{ debugName: "virtualScroll", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
1059
|
+
this.loading = model(false, ...(ngDevMode ? [{ debugName: "loading" }] : []));
|
|
1060
|
+
this.value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
1061
|
+
this.changed = output();
|
|
1062
|
+
this.control = contentChild(UpFieldControl, ...(ngDevMode ? [{ debugName: "control" }] : []));
|
|
1063
|
+
this._computedClass = computed(() => {
|
|
1064
|
+
return up('w-full min-w-0 h-9', 'data-[disabled=true]:[&>.ng-select-container]:cursor-not-allowed! data-[disabled=true]:[&>.ng-select-container]:opacity-50! data-[disabled=true]:[&>.ng-select-container]:bg-transparent!', '[&>.ng-select-container]:border! [&>.ng-select-container]:border-input! [&>.ng-select-container]:rounded-md! [&>.ng-select-container]:cursor-pointer! [&>.ng-select-container]:shadow-xs! [&>.ng-select-container]:items-center!', '[&>.ng-select-container>.ng-value-container>.ng-placeholder]:text-base! md:[&>.ng-select-container>.ng-value-container>.ng-placeholder]:text-sm!', '[&>.ng-select-container>.ng-value-container>.ng-value]:text-base! md:[&>.ng-select-container>.ng-value-container>.ng-value]:text-sm! [&>.ng-select-container>.ng-value-container>.ng-value]:text-black!', '[&.ng-select-focused>.ng-select-container]:border-ring! [&.ng-select-focused>.ng-select-container]:ring-ring/50! [&.ng-select-focused>.ng-select-container]:ring-[3px]!', this.inlineClass());
|
|
1065
|
+
}, ...(ngDevMode ? [{ debugName: "_computedClass" }] : []));
|
|
1066
|
+
this.items = computed(() => {
|
|
1067
|
+
const results = this._queryResults();
|
|
1068
|
+
return results.length > 0 ? results : this.initialItems();
|
|
1069
|
+
}, ...(ngDevMode ? [{ debugName: "items" }] : []));
|
|
1070
|
+
this.typeahead = new Subject();
|
|
1071
|
+
this.query$ = this.typeahead.pipe(distinctUntilChanged(), debounceTime(300), tap(() => this.loading.set(true)), switchMap((k) => {
|
|
1072
|
+
return this.query()(k).pipe(map((result) => !result.length ? this.initialItems() : result), catchError(() => of(this.initialItems())));
|
|
1073
|
+
}), tap(() => this.loading.set(false)));
|
|
1074
|
+
this._queryResults = toSignal(this.query$, { initialValue: [] });
|
|
1075
|
+
this.isTouched = false;
|
|
1076
|
+
this._onTouched = () => { };
|
|
1077
|
+
this._onChange = (_val) => { };
|
|
1078
|
+
if (this.ngControl !== null) {
|
|
1079
|
+
this.ngControl.valueAccessor = this;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
ngOnInit() {
|
|
1083
|
+
this.setControlName(this.ngControl?.name);
|
|
1084
|
+
}
|
|
1085
|
+
registerOnChange(fn) {
|
|
1086
|
+
this._onChange = fn;
|
|
1087
|
+
}
|
|
1088
|
+
registerOnTouched(fn) {
|
|
1089
|
+
this._onTouched = fn;
|
|
1090
|
+
}
|
|
1091
|
+
writeValue(value) {
|
|
1092
|
+
this.value.set(value);
|
|
1093
|
+
}
|
|
1094
|
+
touch() {
|
|
1095
|
+
if (!this.isTouched) {
|
|
1096
|
+
this._onTouched();
|
|
1097
|
+
this.isTouched = true;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
change(e) {
|
|
1101
|
+
if (!this.isTouched) {
|
|
1102
|
+
this._onTouched();
|
|
1103
|
+
this.isTouched = true;
|
|
1104
|
+
}
|
|
1105
|
+
if (!this.disabled()) {
|
|
1106
|
+
if (!e) {
|
|
1107
|
+
this.value.set(null);
|
|
1108
|
+
}
|
|
1109
|
+
else {
|
|
1110
|
+
this.value.set(!this.multiple() ? e[this.bindValue()] : e.map((o) => o[this.bindValue()]));
|
|
1111
|
+
}
|
|
1112
|
+
this._onChange(this.value());
|
|
1113
|
+
this.changed.emit(this.value());
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpSearchableSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1117
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.0.0", type: UpSearchableSelectComponent, isStandalone: true, selector: "up-searchable-select", inputs: { query: { classPropertyName: "query", publicName: "query", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, appendTo: { classPropertyName: "appendTo", publicName: "appendTo", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, initialItems: { classPropertyName: "initialItems", publicName: "initialItems", isSignal: true, isRequired: false, transformFunction: null }, bindLabel: { classPropertyName: "bindLabel", publicName: "bindLabel", isSignal: true, isRequired: false, transformFunction: null }, bindValue: { classPropertyName: "bindValue", publicName: "bindValue", isSignal: true, isRequired: false, transformFunction: null }, inlineClass: { classPropertyName: "inlineClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, addTag: { classPropertyName: "addTag", publicName: "addTag", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, virtualScroll: { classPropertyName: "virtualScroll", publicName: "virtualScroll", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { loading: "loadingChange", value: "valueChange", changed: "changed" }, host: { classAttribute: "block relative" }, providers: [
|
|
1118
|
+
{
|
|
1119
|
+
provide: UpFieldControl,
|
|
1120
|
+
useExisting: forwardRef(() => UpSearchableSelectComponent)
|
|
1121
|
+
}
|
|
1122
|
+
], queries: [{ propertyName: "control", first: true, predicate: UpFieldControl, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
|
|
1123
|
+
<ng-select
|
|
1124
|
+
typeToSearchText="Please enter 3 or more characters"
|
|
1125
|
+
[minTermLength]="3"
|
|
1126
|
+
[virtualScroll]="true"
|
|
1127
|
+
[editableSearchTerm]="true"
|
|
1128
|
+
|
|
1129
|
+
[typeahead]="typeahead"
|
|
1130
|
+
|
|
1131
|
+
[items]="items()"
|
|
1132
|
+
[ngModel]="value()"
|
|
1133
|
+
[addTag]="addTag()"
|
|
1134
|
+
[loading]="loading()"
|
|
1135
|
+
[multiple]="multiple()"
|
|
1136
|
+
[readonly]="disabled()"
|
|
1137
|
+
[appendTo]="appendTo()"
|
|
1138
|
+
[clearable]="clearable()"
|
|
1139
|
+
[bindLabel]="bindLabel()"
|
|
1140
|
+
[bindValue]="bindValue()"
|
|
1141
|
+
[class]="_computedClass()"
|
|
1142
|
+
[placeholder]="placeholder()"
|
|
1143
|
+
[virtualScroll]="virtualScroll()"
|
|
1144
|
+
[attr.data-disabled]="disabled()"
|
|
1145
|
+
|
|
1146
|
+
(blur)="touch()"
|
|
1147
|
+
(change)="change($event)"
|
|
1148
|
+
/>
|
|
1149
|
+
`, isInline: true, styles: [".ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value{background-color:var(--accent)!important}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon.left{border-right-color:color-mix(in oklab,var(--primary) 50%,transparent)!important}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon.left:hover{background-color:color-mix(in oklab,var(--primary) 40%,transparent)!important}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{top:50%!important;padding-bottom:0!important;transform:translateY(-50%)!important}.ng-select .ng-select-container{transition:all .2s ease}.ng-select .ng-select-container .ng-value-container{align-items:center;padding-left:.75rem}.ng-select .ng-select-container .ng-value-container .ng-placeholder{color:var(--muted-foreground)}.ng-select .ng-select-container .ng-arrow-wrapper{padding-right:.75rem}.ng-select .ng-select-container .ng-clear-wrapper{margin-right:.25rem;transition:color .2s ease}.ng-select .ng-select-container .ng-clear-wrapper:hover .ng-clear{color:var(--destructive)}.ng-dropdown-panel{overflow:hidden;margin-top:.25rem!important;border-color:var(--border)!important;border-radius:calc(var(--radius) - 2px)!important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}.ng-dropdown-panel .ng-option-label{color:#000;font-size:1rem}@media screen and (min-width:48rem){.ng-dropdown-panel .ng-option-label{font-size:.875rem}}.ng-dropdown-panel .ng-option:hover,.ng-dropdown-panel .ng-option-marked{background-color:var(--accent)!important}.ng-dropdown-panel .ng-option-selected{color:#000!important;background-color:color-mix(in oklab,var(--primary) 15%,transparent)!important}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: NgSelectComponent, selector: "ng-select", inputs: ["ariaLabelDropdown", "ariaLabel", "markFirst", "placeholder", "fixedPlaceholder", "notFoundText", "typeToSearchText", "preventToggleOnRightClick", "addTagText", "loadingText", "clearAllText", "dropdownPosition", "appendTo", "outsideClickEvent", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "tabFocusOnClearButton", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "ngClass", "typeahead", "multiple", "addTag", "searchable", "clearable", "deselectOnClick", "clearSearchOnAdd", "compareWith", "keyDownFn", "bindLabel", "bindValue", "appearance", "isOpen", "items"], outputs: ["bindLabelChange", "bindValueChange", "appearanceChange", "isOpenChange", "itemsChange", "blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"], exportAs: ["ngSelect"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1150
|
+
}
|
|
1151
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpSearchableSelectComponent, decorators: [{
|
|
1152
|
+
type: Component,
|
|
1153
|
+
args: [{ standalone: true, selector: 'up-searchable-select', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
1154
|
+
class: 'block relative',
|
|
1155
|
+
}, imports: [
|
|
1156
|
+
FormsModule,
|
|
1157
|
+
NgSelectComponent
|
|
1158
|
+
], providers: [
|
|
1159
|
+
{
|
|
1160
|
+
provide: UpFieldControl,
|
|
1161
|
+
useExisting: forwardRef(() => UpSearchableSelectComponent)
|
|
1162
|
+
}
|
|
1163
|
+
], template: `
|
|
1164
|
+
<ng-select
|
|
1165
|
+
typeToSearchText="Please enter 3 or more characters"
|
|
1166
|
+
[minTermLength]="3"
|
|
1167
|
+
[virtualScroll]="true"
|
|
1168
|
+
[editableSearchTerm]="true"
|
|
1169
|
+
|
|
1170
|
+
[typeahead]="typeahead"
|
|
1171
|
+
|
|
1172
|
+
[items]="items()"
|
|
1173
|
+
[ngModel]="value()"
|
|
1174
|
+
[addTag]="addTag()"
|
|
1175
|
+
[loading]="loading()"
|
|
1176
|
+
[multiple]="multiple()"
|
|
1177
|
+
[readonly]="disabled()"
|
|
1178
|
+
[appendTo]="appendTo()"
|
|
1179
|
+
[clearable]="clearable()"
|
|
1180
|
+
[bindLabel]="bindLabel()"
|
|
1181
|
+
[bindValue]="bindValue()"
|
|
1182
|
+
[class]="_computedClass()"
|
|
1183
|
+
[placeholder]="placeholder()"
|
|
1184
|
+
[virtualScroll]="virtualScroll()"
|
|
1185
|
+
[attr.data-disabled]="disabled()"
|
|
1186
|
+
|
|
1187
|
+
(blur)="touch()"
|
|
1188
|
+
(change)="change($event)"
|
|
1189
|
+
/>
|
|
1190
|
+
`, styles: [".ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value{background-color:var(--accent)!important}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon.left{border-right-color:color-mix(in oklab,var(--primary) 50%,transparent)!important}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon.left:hover{background-color:color-mix(in oklab,var(--primary) 40%,transparent)!important}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{top:50%!important;padding-bottom:0!important;transform:translateY(-50%)!important}.ng-select .ng-select-container{transition:all .2s ease}.ng-select .ng-select-container .ng-value-container{align-items:center;padding-left:.75rem}.ng-select .ng-select-container .ng-value-container .ng-placeholder{color:var(--muted-foreground)}.ng-select .ng-select-container .ng-arrow-wrapper{padding-right:.75rem}.ng-select .ng-select-container .ng-clear-wrapper{margin-right:.25rem;transition:color .2s ease}.ng-select .ng-select-container .ng-clear-wrapper:hover .ng-clear{color:var(--destructive)}.ng-dropdown-panel{overflow:hidden;margin-top:.25rem!important;border-color:var(--border)!important;border-radius:calc(var(--radius) - 2px)!important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}.ng-dropdown-panel .ng-option-label{color:#000;font-size:1rem}@media screen and (min-width:48rem){.ng-dropdown-panel .ng-option-label{font-size:.875rem}}.ng-dropdown-panel .ng-option:hover,.ng-dropdown-panel .ng-option-marked{background-color:var(--accent)!important}.ng-dropdown-panel .ng-option-selected{color:#000!important;background-color:color-mix(in oklab,var(--primary) 15%,transparent)!important}\n"] }]
|
|
1191
|
+
}], ctorParameters: () => [], propDecorators: { query: [{ type: i0.Input, args: [{ isSignal: true, alias: "query", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], appendTo: [{ type: i0.Input, args: [{ isSignal: true, alias: "appendTo", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], initialItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialItems", required: false }] }], bindLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "bindLabel", required: false }] }], bindValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "bindValue", required: false }] }], inlineClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], addTag: [{ type: i0.Input, args: [{ isSignal: true, alias: "addTag", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], virtualScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScroll", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }, { type: i0.Output, args: ["loadingChange"] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], changed: [{ type: i0.Output, args: ["changed"] }], control: [{ type: i0.ContentChild, args: [i0.forwardRef(() => UpFieldControl), { isSignal: true }] }] } });
|
|
1192
|
+
|
|
1193
|
+
class UpDatepickerComponent extends UpFieldControlComponent {
|
|
1194
|
+
constructor() {
|
|
1195
|
+
super();
|
|
1196
|
+
this.placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
1197
|
+
this.minDate = input(null, ...(ngDevMode ? [{ debugName: "minDate" }] : []));
|
|
1198
|
+
this.maxDate = input(null, ...(ngDevMode ? [{ debugName: "maxDate" }] : []));
|
|
1199
|
+
this.inlineClass = input('', ...(ngDevMode ? [{ debugName: "inlineClass", alias: 'class' }] : [{ alias: 'class' }]));
|
|
1200
|
+
this.dateFormat = input('dd LLL yyyy', ...(ngDevMode ? [{ debugName: "dateFormat", alias: 'format' }] : [{ alias: 'format' }]));
|
|
1201
|
+
this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{
|
|
1202
|
+
transform: booleanAttribute
|
|
1203
|
+
}]));
|
|
1204
|
+
this.btnTrigger = viewChild('btnTrigger', ...(ngDevMode ? [{ debugName: "btnTrigger" }] : []));
|
|
1205
|
+
this.value = signal(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
1206
|
+
this._disabled = signal(false, ...(ngDevMode ? [{ debugName: "_disabled" }] : []));
|
|
1207
|
+
this.formattedDate = computed(() => {
|
|
1208
|
+
return this.value() ? format(this.value(), this.dateFormat()) : '';
|
|
1209
|
+
}, ...(ngDevMode ? [{ debugName: "formattedDate" }] : []));
|
|
1210
|
+
this._computedClass = computed(() => {
|
|
1211
|
+
return up('flex justify-between px-3 border border-border min-w-48 w-full font-normal hover:not-disabled:text-primary! data-[has-value=false]:text-muted-foreground', this.inlineClass());
|
|
1212
|
+
}, ...(ngDevMode ? [{ debugName: "_computedClass" }] : []));
|
|
1213
|
+
this._isTouched = false;
|
|
1214
|
+
this._onTouched = () => { };
|
|
1215
|
+
this._onChange = () => { };
|
|
1216
|
+
if (this.ngControl !== null) {
|
|
1217
|
+
this.ngControl.valueAccessor = this;
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
writeValue(value) {
|
|
1221
|
+
this.value.set(value ?? null);
|
|
1222
|
+
}
|
|
1223
|
+
registerOnChange(fn) {
|
|
1224
|
+
this._onChange = fn;
|
|
1225
|
+
}
|
|
1226
|
+
registerOnTouched(fn) {
|
|
1227
|
+
this._onTouched = fn;
|
|
1228
|
+
}
|
|
1229
|
+
setDisabledState(isDisabled) {
|
|
1230
|
+
this._disabled.set(isDisabled);
|
|
1231
|
+
}
|
|
1232
|
+
touch() {
|
|
1233
|
+
this._markTouched();
|
|
1234
|
+
}
|
|
1235
|
+
selectedDate(day) {
|
|
1236
|
+
this.value.set(day);
|
|
1237
|
+
this._onChange(day);
|
|
1238
|
+
this._markTouched();
|
|
1239
|
+
this.btnTrigger()?.nativeElement.click();
|
|
1240
|
+
}
|
|
1241
|
+
_markTouched() {
|
|
1242
|
+
if (this._isTouched)
|
|
1243
|
+
return;
|
|
1244
|
+
this._onTouched();
|
|
1245
|
+
this._isTouched = true;
|
|
1246
|
+
}
|
|
1247
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpDatepickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1248
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.0.0", type: UpDatepickerComponent, isStandalone: true, selector: "up-datepicker", inputs: { placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, inlineClass: { classPropertyName: "inlineClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, dateFormat: { classPropertyName: "dateFormat", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
1249
|
+
{
|
|
1250
|
+
provide: UpFieldControl,
|
|
1251
|
+
useExisting: forwardRef(() => UpDatepickerComponent),
|
|
1252
|
+
},
|
|
1253
|
+
provideIcons({
|
|
1254
|
+
matCalendarMonthRound
|
|
1255
|
+
}),
|
|
1256
|
+
], viewQueries: [{ propertyName: "btnTrigger", first: true, predicate: ["btnTrigger"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
|
|
1257
|
+
<up-popover
|
|
1258
|
+
alignment="start"
|
|
1259
|
+
placementOffset="4"
|
|
1260
|
+
>
|
|
1261
|
+
<button
|
|
1262
|
+
upButton
|
|
1263
|
+
upPopoverTrigger
|
|
1264
|
+
type="button"
|
|
1265
|
+
variant="ghost"
|
|
1266
|
+
[class]="_computedClass()"
|
|
1267
|
+
[disabled]="disabled() || _disabled()"
|
|
1268
|
+
[attr.data-has-value]="value()? true : false"
|
|
1269
|
+
(blur)="touch()"
|
|
1270
|
+
#btnTrigger
|
|
1271
|
+
>
|
|
1272
|
+
{{ value()? formattedDate() : placeholder() }}
|
|
1273
|
+
|
|
1274
|
+
<ng-icon
|
|
1275
|
+
size="16"
|
|
1276
|
+
class="ml-auto"
|
|
1277
|
+
name="matCalendarMonthRound"
|
|
1278
|
+
/>
|
|
1279
|
+
</button>
|
|
1280
|
+
|
|
1281
|
+
<ng-container *upPopoverContentRef>
|
|
1282
|
+
<up-calendar
|
|
1283
|
+
[activeDay]="value()"
|
|
1284
|
+
[minDate]="minDate()"
|
|
1285
|
+
[maxDate]="maxDate()"
|
|
1286
|
+
(selected)="selectedDate($event)"
|
|
1287
|
+
/>
|
|
1288
|
+
</ng-container>
|
|
1289
|
+
</up-popover>
|
|
1290
|
+
`, isInline: true, dependencies: [{ kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }, { kind: "directive", type: UpButtonDirective, selector: "[upButton]", inputs: ["size", "variant", "class"], exportAs: ["upButton"] }, { kind: "component", type: UpPopoverComponent, selector: "up-popover", inputs: ["placement", "alignment", "placementOffset", "alignmentOffset"] }, { kind: "component", type: UpCalendarComponent, selector: "up-calendar", inputs: ["minDate", "maxDate", "variant", "activeDay", "activeRangeDay"], outputs: ["selected", "rangeSelected", "activeDayChange", "activeRangeDayChange"] }, { kind: "directive", type: UpPopoverTriggerDirective, selector: "[upPopoverTrigger]", exportAs: ["upPopoverTrigger"] }, { kind: "directive", type: UpPopoverContentRefDirective, selector: "[upPopoverContentRef]", exportAs: ["upPopoverContentRef"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1291
|
+
}
|
|
1292
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpDatepickerComponent, decorators: [{
|
|
1293
|
+
type: Component,
|
|
1294
|
+
args: [{
|
|
1295
|
+
standalone: true,
|
|
1296
|
+
selector: 'up-datepicker',
|
|
1297
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1298
|
+
providers: [
|
|
1299
|
+
{
|
|
1300
|
+
provide: UpFieldControl,
|
|
1301
|
+
useExisting: forwardRef(() => UpDatepickerComponent),
|
|
1302
|
+
},
|
|
1303
|
+
provideIcons({
|
|
1304
|
+
matCalendarMonthRound
|
|
1305
|
+
}),
|
|
1306
|
+
],
|
|
1307
|
+
imports: [
|
|
1308
|
+
NgIcon,
|
|
1309
|
+
UpButtonDirective,
|
|
1310
|
+
UpPopoverComponent,
|
|
1311
|
+
UpCalendarComponent,
|
|
1312
|
+
UpPopoverTriggerDirective,
|
|
1313
|
+
UpPopoverContentRefDirective
|
|
1314
|
+
],
|
|
1315
|
+
template: `
|
|
1316
|
+
<up-popover
|
|
1317
|
+
alignment="start"
|
|
1318
|
+
placementOffset="4"
|
|
1319
|
+
>
|
|
1320
|
+
<button
|
|
1321
|
+
upButton
|
|
1322
|
+
upPopoverTrigger
|
|
1323
|
+
type="button"
|
|
1324
|
+
variant="ghost"
|
|
1325
|
+
[class]="_computedClass()"
|
|
1326
|
+
[disabled]="disabled() || _disabled()"
|
|
1327
|
+
[attr.data-has-value]="value()? true : false"
|
|
1328
|
+
(blur)="touch()"
|
|
1329
|
+
#btnTrigger
|
|
1330
|
+
>
|
|
1331
|
+
{{ value()? formattedDate() : placeholder() }}
|
|
1332
|
+
|
|
1333
|
+
<ng-icon
|
|
1334
|
+
size="16"
|
|
1335
|
+
class="ml-auto"
|
|
1336
|
+
name="matCalendarMonthRound"
|
|
1337
|
+
/>
|
|
1338
|
+
</button>
|
|
1339
|
+
|
|
1340
|
+
<ng-container *upPopoverContentRef>
|
|
1341
|
+
<up-calendar
|
|
1342
|
+
[activeDay]="value()"
|
|
1343
|
+
[minDate]="minDate()"
|
|
1344
|
+
[maxDate]="maxDate()"
|
|
1345
|
+
(selected)="selectedDate($event)"
|
|
1346
|
+
/>
|
|
1347
|
+
</ng-container>
|
|
1348
|
+
</up-popover>
|
|
1349
|
+
`
|
|
1350
|
+
}]
|
|
1351
|
+
}], ctorParameters: () => [], propDecorators: { placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], inlineClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], dateFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], btnTrigger: [{ type: i0.ViewChild, args: ['btnTrigger', { isSignal: true }] }] } });
|
|
1352
|
+
|
|
1353
|
+
class UpDateRangePickerComponent extends UpFieldControlComponent {
|
|
1354
|
+
constructor() {
|
|
1355
|
+
super();
|
|
1356
|
+
this.placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
1357
|
+
this.minDate = input(null, ...(ngDevMode ? [{ debugName: "minDate" }] : []));
|
|
1358
|
+
this.maxDate = input(null, ...(ngDevMode ? [{ debugName: "maxDate" }] : []));
|
|
1359
|
+
this.inlineClass = input('', ...(ngDevMode ? [{ debugName: "inlineClass", alias: 'class' }] : [{ alias: 'class' }]));
|
|
1360
|
+
this.dateFormat = input('dd LLL yyyy', ...(ngDevMode ? [{ debugName: "dateFormat", alias: 'format' }] : [{ alias: 'format' }]));
|
|
1361
|
+
this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{
|
|
1362
|
+
transform: booleanAttribute
|
|
1363
|
+
}]));
|
|
1364
|
+
this._disabled = signal(false, ...(ngDevMode ? [{ debugName: "_disabled" }] : []));
|
|
1365
|
+
this.value = signal({ from: null, to: null }, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
1366
|
+
this.formattedDate = computed(() => {
|
|
1367
|
+
return this.value().from && this.value().to ? `${format(this.value().from, this.dateFormat())} - ${format(this.value().to, this.dateFormat())}` : '';
|
|
1368
|
+
}, ...(ngDevMode ? [{ debugName: "formattedDate" }] : []));
|
|
1369
|
+
this._computedClass = computed(() => {
|
|
1370
|
+
return up('flex justify-between px-3 border border-border min-w-60 w-full font-normal hover:not-disabled:text-primary! data-[has-value=false]:text-muted-foreground', this.inlineClass());
|
|
1371
|
+
}, ...(ngDevMode ? [{ debugName: "_computedClass" }] : []));
|
|
1372
|
+
this._isTouched = false;
|
|
1373
|
+
this._onTouched = () => { };
|
|
1374
|
+
this._onChange = () => { };
|
|
1375
|
+
if (this.ngControl !== null) {
|
|
1376
|
+
this.ngControl.valueAccessor = this;
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
writeValue(value) {
|
|
1380
|
+
this.value.set(value ?? null);
|
|
1381
|
+
}
|
|
1382
|
+
registerOnChange(fn) {
|
|
1383
|
+
this._onChange = fn;
|
|
1384
|
+
}
|
|
1385
|
+
registerOnTouched(fn) {
|
|
1386
|
+
this._onTouched = fn;
|
|
1387
|
+
}
|
|
1388
|
+
setDisabledState(isDisabled) {
|
|
1389
|
+
this._disabled.set(isDisabled);
|
|
1390
|
+
}
|
|
1391
|
+
touch() {
|
|
1392
|
+
this._markTouched();
|
|
1393
|
+
}
|
|
1394
|
+
selectedDate(range) {
|
|
1395
|
+
this.value.set(range);
|
|
1396
|
+
this._onChange(range);
|
|
1397
|
+
this._markTouched();
|
|
1398
|
+
}
|
|
1399
|
+
_markTouched() {
|
|
1400
|
+
if (this._isTouched)
|
|
1401
|
+
return;
|
|
1402
|
+
this._onTouched();
|
|
1403
|
+
this._isTouched = true;
|
|
1404
|
+
}
|
|
1405
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpDateRangePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1406
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.0", type: UpDateRangePickerComponent, isStandalone: true, selector: "up-date-range-picker", inputs: { placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, inlineClass: { classPropertyName: "inlineClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, dateFormat: { classPropertyName: "dateFormat", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
1407
|
+
{
|
|
1408
|
+
provide: UpFieldControl,
|
|
1409
|
+
useExisting: forwardRef(() => UpDateRangePickerComponent)
|
|
1410
|
+
},
|
|
1411
|
+
provideIcons({
|
|
1412
|
+
matCalendarMonthRound
|
|
1413
|
+
}),
|
|
1414
|
+
], usesInheritance: true, ngImport: i0, template: `
|
|
1415
|
+
<up-popover
|
|
1416
|
+
alignment="start"
|
|
1417
|
+
placementOffset="4"
|
|
1418
|
+
>
|
|
1419
|
+
<button
|
|
1420
|
+
upButton
|
|
1421
|
+
upPopoverTrigger
|
|
1422
|
+
type="button"
|
|
1423
|
+
variant="ghost"
|
|
1424
|
+
[class]="_computedClass()"
|
|
1425
|
+
[disabled]="disabled() || _disabled()"
|
|
1426
|
+
[attr.data-has-value]="value().from && value().to? true : false"
|
|
1427
|
+
(blur)="touch()"
|
|
1428
|
+
>
|
|
1429
|
+
{{ value().from && value().to? formattedDate() : placeholder()}}
|
|
1430
|
+
|
|
1431
|
+
<ng-icon
|
|
1432
|
+
size="16"
|
|
1433
|
+
class="ml-auto"
|
|
1434
|
+
name="matCalendarMonthRound"
|
|
1435
|
+
/>
|
|
1436
|
+
</button>
|
|
1437
|
+
|
|
1438
|
+
<ng-container *upPopoverContentRef>
|
|
1439
|
+
<up-calendar
|
|
1440
|
+
variant="range"
|
|
1441
|
+
[activeDay]="null"
|
|
1442
|
+
[activeRangeDay]="value()"
|
|
1443
|
+
[minDate]="minDate()"
|
|
1444
|
+
[maxDate]="maxDate()"
|
|
1445
|
+
(rangeSelected)="selectedDate($event)"
|
|
1446
|
+
/>
|
|
1447
|
+
</ng-container>
|
|
1448
|
+
</up-popover>
|
|
1449
|
+
`, isInline: true, dependencies: [{ kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }, { kind: "directive", type: UpButtonDirective, selector: "[upButton]", inputs: ["size", "variant", "class"], exportAs: ["upButton"] }, { kind: "component", type: UpPopoverComponent, selector: "up-popover", inputs: ["placement", "alignment", "placementOffset", "alignmentOffset"] }, { kind: "component", type: UpCalendarComponent, selector: "up-calendar", inputs: ["minDate", "maxDate", "variant", "activeDay", "activeRangeDay"], outputs: ["selected", "rangeSelected", "activeDayChange", "activeRangeDayChange"] }, { kind: "directive", type: UpPopoverTriggerDirective, selector: "[upPopoverTrigger]", exportAs: ["upPopoverTrigger"] }, { kind: "directive", type: UpPopoverContentRefDirective, selector: "[upPopoverContentRef]", exportAs: ["upPopoverContentRef"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1450
|
+
}
|
|
1451
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpDateRangePickerComponent, decorators: [{
|
|
1452
|
+
type: Component,
|
|
1453
|
+
args: [{
|
|
1454
|
+
standalone: true,
|
|
1455
|
+
selector: 'up-date-range-picker',
|
|
1456
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1457
|
+
providers: [
|
|
1458
|
+
{
|
|
1459
|
+
provide: UpFieldControl,
|
|
1460
|
+
useExisting: forwardRef(() => UpDateRangePickerComponent)
|
|
1461
|
+
},
|
|
1462
|
+
provideIcons({
|
|
1463
|
+
matCalendarMonthRound
|
|
1464
|
+
}),
|
|
1465
|
+
],
|
|
1466
|
+
imports: [
|
|
1467
|
+
NgIcon,
|
|
1468
|
+
UpButtonDirective,
|
|
1469
|
+
UpPopoverComponent,
|
|
1470
|
+
UpCalendarComponent,
|
|
1471
|
+
UpPopoverTriggerDirective,
|
|
1472
|
+
UpPopoverContentRefDirective
|
|
1473
|
+
],
|
|
1474
|
+
template: `
|
|
1475
|
+
<up-popover
|
|
1476
|
+
alignment="start"
|
|
1477
|
+
placementOffset="4"
|
|
1478
|
+
>
|
|
1479
|
+
<button
|
|
1480
|
+
upButton
|
|
1481
|
+
upPopoverTrigger
|
|
1482
|
+
type="button"
|
|
1483
|
+
variant="ghost"
|
|
1484
|
+
[class]="_computedClass()"
|
|
1485
|
+
[disabled]="disabled() || _disabled()"
|
|
1486
|
+
[attr.data-has-value]="value().from && value().to? true : false"
|
|
1487
|
+
(blur)="touch()"
|
|
1488
|
+
>
|
|
1489
|
+
{{ value().from && value().to? formattedDate() : placeholder()}}
|
|
1490
|
+
|
|
1491
|
+
<ng-icon
|
|
1492
|
+
size="16"
|
|
1493
|
+
class="ml-auto"
|
|
1494
|
+
name="matCalendarMonthRound"
|
|
1495
|
+
/>
|
|
1496
|
+
</button>
|
|
1497
|
+
|
|
1498
|
+
<ng-container *upPopoverContentRef>
|
|
1499
|
+
<up-calendar
|
|
1500
|
+
variant="range"
|
|
1501
|
+
[activeDay]="null"
|
|
1502
|
+
[activeRangeDay]="value()"
|
|
1503
|
+
[minDate]="minDate()"
|
|
1504
|
+
[maxDate]="maxDate()"
|
|
1505
|
+
(rangeSelected)="selectedDate($event)"
|
|
1506
|
+
/>
|
|
1507
|
+
</ng-container>
|
|
1508
|
+
</up-popover>
|
|
1509
|
+
`
|
|
1510
|
+
}]
|
|
1511
|
+
}], ctorParameters: () => [], propDecorators: { placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], inlineClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], dateFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
|
|
1512
|
+
|
|
1513
|
+
class UpFormFieldComponent {
|
|
1514
|
+
constructor() {
|
|
1515
|
+
this.name = input('', ...(ngDevMode ? [{ debugName: "name" }] : []));
|
|
1516
|
+
this.hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : []));
|
|
1517
|
+
this.label = input('', ...(ngDevMode ? [{ debugName: "label" }] : []));
|
|
1518
|
+
this.inlineClass = input('', ...(ngDevMode ? [{ debugName: "inlineClass", alias: 'class' }] : [{ alias: 'class' }]));
|
|
1519
|
+
this.control = contentChild(UpFieldControl, ...(ngDevMode ? [{ debugName: "control" }] : []));
|
|
1520
|
+
this._computedClass = computed(() => {
|
|
1521
|
+
return up('block space-y-2', this.inlineClass());
|
|
1522
|
+
}, ...(ngDevMode ? [{ debugName: "_computedClass" }] : []));
|
|
1523
|
+
effect(() => {
|
|
1524
|
+
if (!this.control()) {
|
|
1525
|
+
throw new Error('Form field must contain a field control, eg: input, checkbox, textarea, etc.');
|
|
1526
|
+
}
|
|
1527
|
+
this.control().setControlName(this.label());
|
|
1528
|
+
});
|
|
1529
|
+
}
|
|
1530
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpFormFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1531
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.0", type: UpFormFieldComponent, isStandalone: true, selector: "up-form-field", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, inlineClass: { classPropertyName: "inlineClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "_computedClass()" } }, queries: [{ propertyName: "control", first: true, predicate: UpFieldControl, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
1532
|
+
<div
|
|
1533
|
+
class="
|
|
1534
|
+
group flex flex-col gap-2
|
|
1535
|
+
has-[input[type='checkbox']]:flex-row has-[input[type='checkbox']]:items-center
|
|
1536
|
+
"
|
|
1537
|
+
>
|
|
1538
|
+
@if (label()) {
|
|
1539
|
+
<label
|
|
1540
|
+
class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 select-none group-has-[input[type='checkbox']]:order-2"
|
|
1541
|
+
[for]="name()"
|
|
1542
|
+
[class.text-destructive]="control()?.error()"
|
|
1543
|
+
>
|
|
1544
|
+
{{ label() }}
|
|
1545
|
+
</label>
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
<ng-content />
|
|
1549
|
+
</div>
|
|
1550
|
+
|
|
1551
|
+
@if (control()?.error()) {
|
|
1552
|
+
<p class="text-xs font-medium text-destructive">
|
|
1553
|
+
{{ control()?.error() }}
|
|
1554
|
+
</p>
|
|
1555
|
+
}
|
|
1556
|
+
@else if (hint()) {
|
|
1557
|
+
<p class="text-xs text-muted-foreground">
|
|
1558
|
+
{{ hint() }}
|
|
1559
|
+
</p>
|
|
1560
|
+
}
|
|
1561
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1562
|
+
}
|
|
1563
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpFormFieldComponent, decorators: [{
|
|
1564
|
+
type: Component,
|
|
1565
|
+
args: [{
|
|
1566
|
+
standalone: true,
|
|
1567
|
+
selector: 'up-form-field',
|
|
1568
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1569
|
+
host: {
|
|
1570
|
+
'[class]': '_computedClass()',
|
|
1571
|
+
},
|
|
1572
|
+
template: `
|
|
1573
|
+
<div
|
|
1574
|
+
class="
|
|
1575
|
+
group flex flex-col gap-2
|
|
1576
|
+
has-[input[type='checkbox']]:flex-row has-[input[type='checkbox']]:items-center
|
|
1577
|
+
"
|
|
1578
|
+
>
|
|
1579
|
+
@if (label()) {
|
|
1580
|
+
<label
|
|
1581
|
+
class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 select-none group-has-[input[type='checkbox']]:order-2"
|
|
1582
|
+
[for]="name()"
|
|
1583
|
+
[class.text-destructive]="control()?.error()"
|
|
1584
|
+
>
|
|
1585
|
+
{{ label() }}
|
|
1586
|
+
</label>
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
<ng-content />
|
|
1590
|
+
</div>
|
|
1591
|
+
|
|
1592
|
+
@if (control()?.error()) {
|
|
1593
|
+
<p class="text-xs font-medium text-destructive">
|
|
1594
|
+
{{ control()?.error() }}
|
|
1595
|
+
</p>
|
|
1596
|
+
}
|
|
1597
|
+
@else if (hint()) {
|
|
1598
|
+
<p class="text-xs text-muted-foreground">
|
|
1599
|
+
{{ hint() }}
|
|
1600
|
+
</p>
|
|
1601
|
+
}
|
|
1602
|
+
`
|
|
1603
|
+
}]
|
|
1604
|
+
}], ctorParameters: () => [], propDecorators: { name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], inlineClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], control: [{ type: i0.ContentChild, args: [i0.forwardRef(() => UpFieldControl), { isSignal: true }] }] } });
|
|
1605
|
+
|
|
1606
|
+
function setValidator(form, keys, validators) {
|
|
1607
|
+
if (!keys.length ||
|
|
1608
|
+
keys.length === 1) {
|
|
1609
|
+
throw new Error('Use normal action for single keys and keys cannot be empty.');
|
|
1610
|
+
}
|
|
1611
|
+
keys.forEach((key) => {
|
|
1612
|
+
const control = form.get(key);
|
|
1613
|
+
if (control) {
|
|
1614
|
+
control.setValidators(validators);
|
|
1615
|
+
control.updateValueAndValidity();
|
|
1616
|
+
}
|
|
1617
|
+
});
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
function toggleFormControls(form, keys, mode) {
|
|
1621
|
+
if (!keys.length ||
|
|
1622
|
+
keys.length === 1) {
|
|
1623
|
+
throw new Error('Use normal action for single keys and keys cannot be empty.');
|
|
1624
|
+
}
|
|
1625
|
+
keys.forEach((key) => form.get(key)?.[mode]());
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
function prettifyLabel(name) {
|
|
1629
|
+
return name
|
|
1630
|
+
.replace(/([a-z])([A-Z])/g, '$1 $2')
|
|
1631
|
+
.replace(/_/g, ' ')
|
|
1632
|
+
.replace(/\b\w/g, char => char.toUpperCase());
|
|
1633
|
+
}
|
|
1634
|
+
function convertToDate(value) {
|
|
1635
|
+
if (value instanceof Date)
|
|
1636
|
+
return value;
|
|
1637
|
+
if (typeof value === 'string' &&
|
|
1638
|
+
!isNaN(Date.parse(value))) {
|
|
1639
|
+
return new Date(value);
|
|
1640
|
+
}
|
|
1641
|
+
return null;
|
|
1642
|
+
}
|
|
1643
|
+
/**
|
|
1644
|
+
* Range validator for number and date values.
|
|
1645
|
+
* @param {string} fromKey - The "from" control name
|
|
1646
|
+
* @param {string} toKey - The "to" control name
|
|
1647
|
+
* @returns {ValidatorFn} Throw error message when fromKey is greater than toKey
|
|
1648
|
+
*
|
|
1649
|
+
* Usage:
|
|
1650
|
+
* this.form = new FormGroup({
|
|
1651
|
+
* agingFrom: new FormControl(),
|
|
1652
|
+
* agingTo: new FormControl(),
|
|
1653
|
+
* }, { validators: rangeValidator('agingFrom', 'agingTo') });
|
|
1654
|
+
*/
|
|
1655
|
+
function validRangeValidator(fromKey, toKey) {
|
|
1656
|
+
return (group) => {
|
|
1657
|
+
if (!group) {
|
|
1658
|
+
return null;
|
|
1659
|
+
}
|
|
1660
|
+
const toControl = group.get(toKey);
|
|
1661
|
+
const fromControl = group.get(fromKey);
|
|
1662
|
+
if (!fromControl ||
|
|
1663
|
+
!toControl) {
|
|
1664
|
+
return null;
|
|
1665
|
+
}
|
|
1666
|
+
const toValue = toControl.value;
|
|
1667
|
+
const fromValue = fromControl.value;
|
|
1668
|
+
if (fromValue === null ||
|
|
1669
|
+
toValue === null ||
|
|
1670
|
+
fromValue === '' ||
|
|
1671
|
+
toValue === '') {
|
|
1672
|
+
return null;
|
|
1673
|
+
}
|
|
1674
|
+
let isInvalid = false;
|
|
1675
|
+
const toDate = convertToDate(toValue);
|
|
1676
|
+
const fromDate = convertToDate(fromValue);
|
|
1677
|
+
if (fromDate && toDate) {
|
|
1678
|
+
isInvalid = toDate <= fromDate;
|
|
1679
|
+
}
|
|
1680
|
+
else if (!isNaN(fromValue) &&
|
|
1681
|
+
!isNaN(toValue)) {
|
|
1682
|
+
isInvalid = Number(toValue) <= Number(fromValue);
|
|
1683
|
+
}
|
|
1684
|
+
return !isInvalid ? null : {
|
|
1685
|
+
rangeInvalid: {
|
|
1686
|
+
to: toKey,
|
|
1687
|
+
from: fromKey,
|
|
1688
|
+
message: `${prettifyLabel(toKey)} must be greater than ${prettifyLabel(fromKey)}`
|
|
1689
|
+
}
|
|
1690
|
+
};
|
|
1691
|
+
};
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
/**
|
|
1695
|
+
* Generated bundle index. Do not edit.
|
|
1696
|
+
*/
|
|
1697
|
+
|
|
1698
|
+
export { UpCheckboxDirective, UpCountrySelectComponent, UpCurrencySelectComponent, UpDateRangePickerComponent, UpDatepickerComponent, UpFieldControl, UpFieldControlComponent, UpFormFieldComponent, UpInputDirective, UpNumberDirective, UpPasswordComponent, UpSearchableSelectComponent, UpSelectComponent, UpSwitchComponent, setValidator, toggleFormControls, validRangeValidator };
|
|
1699
|
+
//# sourceMappingURL=unipin-angular-applet-forms.mjs.map
|