@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,492 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Pipe, input, output, model, signal, computed, effect, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { NgClass } from '@angular/common';
|
|
4
|
+
import { NgIcon, provideIcons } from '@ng-icons/core';
|
|
5
|
+
import { matArrowForwardIosRound, matArrowBackIosRound } from '@ng-icons/material-icons/round';
|
|
6
|
+
import { startOfDay, endOfDay, getDay, getYear, getMonth, startOfMonth, startOfWeek, endOfWeek, endOfMonth, eachDayOfInterval, format, subMonths, addMonths } from 'date-fns';
|
|
7
|
+
import { UpButtonDirective } from '@unipin/angular-applet/buttons';
|
|
8
|
+
|
|
9
|
+
class UpDateIsInRangePipe {
|
|
10
|
+
transform(date, from, to) {
|
|
11
|
+
if (!date || !from || !to) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
return date >= startOfDay(from) && date <= endOfDay(to);
|
|
15
|
+
}
|
|
16
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpDateIsInRangePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
17
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.0.0", ngImport: i0, type: UpDateIsInRangePipe, isStandalone: true, name: "upDateIsInRange" }); }
|
|
18
|
+
}
|
|
19
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpDateIsInRangePipe, decorators: [{
|
|
20
|
+
type: Pipe,
|
|
21
|
+
args: [{
|
|
22
|
+
pure: true,
|
|
23
|
+
standalone: true,
|
|
24
|
+
name: 'upDateIsInRange',
|
|
25
|
+
}]
|
|
26
|
+
}] });
|
|
27
|
+
|
|
28
|
+
class UpDateIsWeekEdgePipe {
|
|
29
|
+
transform(date) {
|
|
30
|
+
if (!date) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
const day = getDay(date);
|
|
34
|
+
if (day === 1)
|
|
35
|
+
return 'left';
|
|
36
|
+
if (day === 0)
|
|
37
|
+
return 'right';
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpDateIsWeekEdgePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
41
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.0.0", ngImport: i0, type: UpDateIsWeekEdgePipe, isStandalone: true, name: "upDateIsWeekEdge" }); }
|
|
42
|
+
}
|
|
43
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpDateIsWeekEdgePipe, decorators: [{
|
|
44
|
+
type: Pipe,
|
|
45
|
+
args: [{
|
|
46
|
+
pure: true,
|
|
47
|
+
standalone: true,
|
|
48
|
+
name: 'upDateIsWeekEdge',
|
|
49
|
+
}]
|
|
50
|
+
}] });
|
|
51
|
+
|
|
52
|
+
class UpDateIsSelectablePipe {
|
|
53
|
+
transform(date, minDate, maxDate) {
|
|
54
|
+
if (!date)
|
|
55
|
+
return false;
|
|
56
|
+
if (minDate && date < startOfDay(minDate))
|
|
57
|
+
return false;
|
|
58
|
+
if (maxDate && date > endOfDay(maxDate))
|
|
59
|
+
return false;
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpDateIsSelectablePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
63
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.0.0", ngImport: i0, type: UpDateIsSelectablePipe, isStandalone: true, name: "upDateIsSelectable" }); }
|
|
64
|
+
}
|
|
65
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpDateIsSelectablePipe, decorators: [{
|
|
66
|
+
type: Pipe,
|
|
67
|
+
args: [{
|
|
68
|
+
pure: true,
|
|
69
|
+
standalone: true,
|
|
70
|
+
name: 'upDateIsSelectable',
|
|
71
|
+
}]
|
|
72
|
+
}] });
|
|
73
|
+
|
|
74
|
+
class UpCalendarComponent {
|
|
75
|
+
constructor() {
|
|
76
|
+
this.minDate = input(null, ...(ngDevMode ? [{ debugName: "minDate" }] : []));
|
|
77
|
+
this.maxDate = input(null, ...(ngDevMode ? [{ debugName: "maxDate" }] : []));
|
|
78
|
+
this.variant = input('single', ...(ngDevMode ? [{ debugName: "variant" }] : []));
|
|
79
|
+
this.selected = output();
|
|
80
|
+
this.rangeSelected = output();
|
|
81
|
+
this.today = new Date();
|
|
82
|
+
this.activeDay = model(this.today, ...(ngDevMode ? [{ debugName: "activeDay" }] : []));
|
|
83
|
+
this.activeRangeDay = model({ from: null, to: null }, ...(ngDevMode ? [{ debugName: "activeRangeDay" }] : []));
|
|
84
|
+
this.rangeTo = signal(null, ...(ngDevMode ? [{ debugName: "rangeTo" }] : []));
|
|
85
|
+
this.rangeFrom = signal(null, ...(ngDevMode ? [{ debugName: "rangeFrom" }] : []));
|
|
86
|
+
this.selectedYear = signal(getYear(this.today), ...(ngDevMode ? [{ debugName: "selectedYear" }] : []));
|
|
87
|
+
this.selectedMonth = signal(getMonth(this.today), ...(ngDevMode ? [{ debugName: "selectedMonth" }] : []));
|
|
88
|
+
this.firstDayOfActiveMonth = computed(() => {
|
|
89
|
+
return startOfMonth(new Date(this.selectedYear(), this.selectedMonth(), 1));
|
|
90
|
+
}, ...(ngDevMode ? [{ debugName: "firstDayOfActiveMonth" }] : []));
|
|
91
|
+
this.daysOfMonth = computed(() => {
|
|
92
|
+
const start = startOfWeek(this.firstDayOfActiveMonth(), { weekStartsOn: 1 });
|
|
93
|
+
const end = endOfWeek(endOfMonth(this.firstDayOfActiveMonth()), { weekStartsOn: 1 });
|
|
94
|
+
return eachDayOfInterval({ start, end });
|
|
95
|
+
}, ...(ngDevMode ? [{ debugName: "daysOfMonth" }] : []));
|
|
96
|
+
this.weekDays = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
|
|
97
|
+
this.months = Array.from({ length: 12 }, (_, i) => format(new Date(2000, i), 'MMM'));
|
|
98
|
+
this.years = Array.from({
|
|
99
|
+
length: (new Date().getFullYear() + 2) - 1970 + 1
|
|
100
|
+
}, (_, i) => 1970 + i);
|
|
101
|
+
effect(() => {
|
|
102
|
+
if (this.variant() !== 'range') {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const range = this.activeRangeDay();
|
|
106
|
+
if (!range.from && !range.to) {
|
|
107
|
+
this.rangeTo.set(null);
|
|
108
|
+
this.rangeFrom.set(null);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (range.from && range.to) {
|
|
112
|
+
this.rangeTo.set(range.to);
|
|
113
|
+
this.rangeFrom.set(range.from);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const singleDate = range.from || range.to;
|
|
117
|
+
this.rangeTo.set(singleDate);
|
|
118
|
+
this.rangeFrom.set(singleDate);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
changeMonth(event) {
|
|
122
|
+
this.selectedMonth.set(+event.target.value);
|
|
123
|
+
}
|
|
124
|
+
changeYear(event) {
|
|
125
|
+
this.selectedYear.set(+event.target.value);
|
|
126
|
+
}
|
|
127
|
+
previousMonth() {
|
|
128
|
+
const prev = subMonths(this.firstDayOfActiveMonth(), 1);
|
|
129
|
+
this.selectedYear.set(getYear(prev));
|
|
130
|
+
this.selectedMonth.set(getMonth(prev));
|
|
131
|
+
}
|
|
132
|
+
nextMonth() {
|
|
133
|
+
const next = addMonths(this.firstDayOfActiveMonth(), 1);
|
|
134
|
+
this.selectedYear.set(getYear(next));
|
|
135
|
+
this.selectedMonth.set(getMonth(next));
|
|
136
|
+
}
|
|
137
|
+
selectDate(day) {
|
|
138
|
+
if (this.variant() === 'single') {
|
|
139
|
+
const active = this.activeDay();
|
|
140
|
+
const value = active && active.toDateString() === day.toDateString() ? null : day;
|
|
141
|
+
this.activeDay.set(value);
|
|
142
|
+
this.selected.emit(value);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
this.handleRangeSelection(day);
|
|
146
|
+
}
|
|
147
|
+
handleRangeSelection(day) {
|
|
148
|
+
const from = this.rangeFrom();
|
|
149
|
+
const to = this.rangeTo();
|
|
150
|
+
const time = day.getTime();
|
|
151
|
+
if (!from && !to) {
|
|
152
|
+
return this.setRange(day, day);
|
|
153
|
+
}
|
|
154
|
+
if (from?.getTime() === to?.getTime() &&
|
|
155
|
+
from?.getTime() === time) {
|
|
156
|
+
return this.setRange(null, null);
|
|
157
|
+
}
|
|
158
|
+
if (from && to) {
|
|
159
|
+
const fromTime = from.getTime();
|
|
160
|
+
const toTime = to.getTime();
|
|
161
|
+
if (time === fromTime)
|
|
162
|
+
return this.setRange(from, day);
|
|
163
|
+
if (time === toTime)
|
|
164
|
+
return this.setRange(day, to);
|
|
165
|
+
if (time < fromTime)
|
|
166
|
+
return this.setRange(day, to);
|
|
167
|
+
return this.setRange(from, day);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
setRange(from, to) {
|
|
171
|
+
this.rangeTo.set(to);
|
|
172
|
+
this.rangeFrom.set(from);
|
|
173
|
+
this.rangeSelected.emit({ from, to });
|
|
174
|
+
}
|
|
175
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpCalendarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
176
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.0", type: UpCalendarComponent, isStandalone: true, selector: "up-calendar", inputs: { minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, activeDay: { classPropertyName: "activeDay", publicName: "activeDay", isSignal: true, isRequired: false, transformFunction: null }, activeRangeDay: { classPropertyName: "activeRangeDay", publicName: "activeRangeDay", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selected", rangeSelected: "rangeSelected", activeDay: "activeDayChange", activeRangeDay: "activeRangeDayChange" }, providers: [
|
|
177
|
+
provideIcons({
|
|
178
|
+
matArrowBackIosRound,
|
|
179
|
+
matArrowForwardIosRound
|
|
180
|
+
})
|
|
181
|
+
], ngImport: i0, template: `
|
|
182
|
+
<div class="w-fit rounded-xl border border-border bg-card p-3 shadow-lg [--cell-size:2rem]">
|
|
183
|
+
<div class="flex items-center justify-between mb-4 gap-1">
|
|
184
|
+
<button
|
|
185
|
+
upButton
|
|
186
|
+
type="icon"
|
|
187
|
+
variant="ghost"
|
|
188
|
+
(click)="previousMonth()"
|
|
189
|
+
class="h-[--cell-size] w-[--cell-size]"
|
|
190
|
+
>
|
|
191
|
+
<ng-icon name="matArrowBackIosRound" size="14" />
|
|
192
|
+
</button>
|
|
193
|
+
|
|
194
|
+
<div class="flex items-center justify-center h-[--cell-size] gap-1.5">
|
|
195
|
+
<div
|
|
196
|
+
class="
|
|
197
|
+
relative border border-input rounded-md shadow-xs
|
|
198
|
+
has-focus:border-ring has-focus:ring-ring/50 has-focus:ring-[3px]
|
|
199
|
+
"
|
|
200
|
+
>
|
|
201
|
+
<select
|
|
202
|
+
class="
|
|
203
|
+
h-8 bg-background px-2 pr-6 text-sm font-medium text-foreground
|
|
204
|
+
appearance-none cursor-pointer focus:outline-none relative z-10 opacity-0
|
|
205
|
+
"
|
|
206
|
+
(change)="changeMonth($event)"
|
|
207
|
+
>
|
|
208
|
+
@for (month of months; track $index) {
|
|
209
|
+
<option
|
|
210
|
+
[value]="$index"
|
|
211
|
+
[selected]="$index === selectedMonth()"
|
|
212
|
+
>
|
|
213
|
+
{{ month }}
|
|
214
|
+
</option>
|
|
215
|
+
}
|
|
216
|
+
</select>
|
|
217
|
+
|
|
218
|
+
<div class="absolute inset-0 flex items-center px-2">
|
|
219
|
+
<span class="text-sm font-medium flex-1 truncate">
|
|
220
|
+
{{ months[selectedMonth()] }}
|
|
221
|
+
</span>
|
|
222
|
+
|
|
223
|
+
<ng-icon
|
|
224
|
+
size="10"
|
|
225
|
+
name="matArrowForwardIosRound"
|
|
226
|
+
class="text-muted-foreground rotate-90 absolute right-2 pointer-events-none"
|
|
227
|
+
/>
|
|
228
|
+
</div>
|
|
229
|
+
</div>
|
|
230
|
+
|
|
231
|
+
<div
|
|
232
|
+
class="
|
|
233
|
+
relative border border-input rounded-md shadow-xs
|
|
234
|
+
has-focus:border-ring has-focus:ring-ring/50 has-focus:ring-[3px]
|
|
235
|
+
"
|
|
236
|
+
>
|
|
237
|
+
<select
|
|
238
|
+
class="
|
|
239
|
+
h-8 bg-background px-2 pr-6 text-sm font-medium text-foreground
|
|
240
|
+
appearance-none cursor-pointer focus:outline-none relative z-10 opacity-0
|
|
241
|
+
"
|
|
242
|
+
(change)="changeYear($event)"
|
|
243
|
+
>
|
|
244
|
+
@for (year of years; track $index) {
|
|
245
|
+
<option
|
|
246
|
+
[value]="year"
|
|
247
|
+
[selected]="year === selectedYear()"
|
|
248
|
+
>
|
|
249
|
+
{{ year }}
|
|
250
|
+
</option>
|
|
251
|
+
}
|
|
252
|
+
</select>
|
|
253
|
+
|
|
254
|
+
<div class="absolute inset-0 flex items-center px-2">
|
|
255
|
+
<span class="text-sm font-medium flex-1 truncate">
|
|
256
|
+
{{ selectedYear() }}
|
|
257
|
+
</span>
|
|
258
|
+
|
|
259
|
+
<ng-icon
|
|
260
|
+
size="10"
|
|
261
|
+
name="matArrowForwardIosRound"
|
|
262
|
+
class="text-muted-foreground rotate-90 absolute right-2 pointer-events-none"
|
|
263
|
+
/>
|
|
264
|
+
</div>
|
|
265
|
+
</div>
|
|
266
|
+
</div>
|
|
267
|
+
|
|
268
|
+
<button
|
|
269
|
+
upButton
|
|
270
|
+
type="icon"
|
|
271
|
+
variant="ghost"
|
|
272
|
+
(click)="nextMonth()"
|
|
273
|
+
class="h-[--cell-size] w-[--cell-size]"
|
|
274
|
+
>
|
|
275
|
+
<ng-icon name="matArrowForwardIosRound" size="14" />
|
|
276
|
+
</button>
|
|
277
|
+
</div>
|
|
278
|
+
|
|
279
|
+
<div class="grid grid-cols-7 text-center text-[0.8rem] font-normal text-muted-foreground">
|
|
280
|
+
@for (day of weekDays; track $index) {
|
|
281
|
+
<div class="select-none py-1">
|
|
282
|
+
{{ day }}
|
|
283
|
+
</div>
|
|
284
|
+
}
|
|
285
|
+
</div>
|
|
286
|
+
|
|
287
|
+
<div class="grid grid-cols-7 text-sm mt-2">
|
|
288
|
+
@for (day of daysOfMonth(); track $index) {
|
|
289
|
+
<div
|
|
290
|
+
class="relative aspect-square select-none mt-2 outline-none"
|
|
291
|
+
[ngClass]="{
|
|
292
|
+
'bg-primary/20': variant() === 'range' && (day | upDateIsInRange:rangeFrom():rangeTo()),
|
|
293
|
+
'rounded-l-md': day.toDateString() === rangeFrom()?.toDateString() || ((day | upDateIsInRange:rangeFrom():rangeTo()) && (day | upDateIsWeekEdge) === 'left'),
|
|
294
|
+
'rounded-r-md': day.toDateString() === rangeTo()?.toDateString() || ((day | upDateIsInRange:rangeFrom():rangeTo()) && (day | upDateIsWeekEdge) === 'right')
|
|
295
|
+
}"
|
|
296
|
+
>
|
|
297
|
+
<button
|
|
298
|
+
class="flex aspect-square w-full min-w-[--cell-size] items-center justify-center rounded-md font-normal leading-none transition-colors duration-150 not-disabled:cursor-pointer outline-none"
|
|
299
|
+
[disabled]="!(day | upDateIsSelectable:minDate():maxDate())"
|
|
300
|
+
[ngClass]="{
|
|
301
|
+
'bg-accent text-accent-foreground': day.toDateString() === today.toDateString(),
|
|
302
|
+
'opacity-40 pointer-events-none': !(day | upDateIsSelectable:minDate():maxDate()),
|
|
303
|
+
'text-foreground hover:bg-accent hover:text-accent-foreground': day.getMonth() === firstDayOfActiveMonth().getMonth(),
|
|
304
|
+
'text-muted-foreground/40 hover:text-muted-foreground/60 hover:bg-accent/30': day.getMonth() !== firstDayOfActiveMonth().getMonth(),
|
|
305
|
+
|
|
306
|
+
'bg-primary text-primary-foreground':
|
|
307
|
+
(variant() === 'single' && activeDay()?.toDateString() === day.toDateString()) ||
|
|
308
|
+
(variant() === 'range' && (
|
|
309
|
+
day.toDateString() === rangeFrom()?.toDateString() ||
|
|
310
|
+
day.toDateString() === rangeTo()?.toDateString()
|
|
311
|
+
)),
|
|
312
|
+
}"
|
|
313
|
+
(click)="selectDate(day)"
|
|
314
|
+
>
|
|
315
|
+
{{ day.getDate() }}
|
|
316
|
+
</button>
|
|
317
|
+
</div>
|
|
318
|
+
}
|
|
319
|
+
</div>
|
|
320
|
+
</div>
|
|
321
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { 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: "pipe", type: UpDateIsInRangePipe, name: "upDateIsInRange" }, { kind: "pipe", type: UpDateIsWeekEdgePipe, name: "upDateIsWeekEdge" }, { kind: "pipe", type: UpDateIsSelectablePipe, name: "upDateIsSelectable" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
322
|
+
}
|
|
323
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpCalendarComponent, decorators: [{
|
|
324
|
+
type: Component,
|
|
325
|
+
args: [{
|
|
326
|
+
standalone: true,
|
|
327
|
+
selector: 'up-calendar',
|
|
328
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
329
|
+
providers: [
|
|
330
|
+
provideIcons({
|
|
331
|
+
matArrowBackIosRound,
|
|
332
|
+
matArrowForwardIosRound
|
|
333
|
+
})
|
|
334
|
+
],
|
|
335
|
+
imports: [
|
|
336
|
+
NgClass,
|
|
337
|
+
NgIcon,
|
|
338
|
+
UpButtonDirective,
|
|
339
|
+
UpDateIsInRangePipe,
|
|
340
|
+
UpDateIsWeekEdgePipe,
|
|
341
|
+
UpDateIsSelectablePipe,
|
|
342
|
+
],
|
|
343
|
+
template: `
|
|
344
|
+
<div class="w-fit rounded-xl border border-border bg-card p-3 shadow-lg [--cell-size:2rem]">
|
|
345
|
+
<div class="flex items-center justify-between mb-4 gap-1">
|
|
346
|
+
<button
|
|
347
|
+
upButton
|
|
348
|
+
type="icon"
|
|
349
|
+
variant="ghost"
|
|
350
|
+
(click)="previousMonth()"
|
|
351
|
+
class="h-[--cell-size] w-[--cell-size]"
|
|
352
|
+
>
|
|
353
|
+
<ng-icon name="matArrowBackIosRound" size="14" />
|
|
354
|
+
</button>
|
|
355
|
+
|
|
356
|
+
<div class="flex items-center justify-center h-[--cell-size] gap-1.5">
|
|
357
|
+
<div
|
|
358
|
+
class="
|
|
359
|
+
relative border border-input rounded-md shadow-xs
|
|
360
|
+
has-focus:border-ring has-focus:ring-ring/50 has-focus:ring-[3px]
|
|
361
|
+
"
|
|
362
|
+
>
|
|
363
|
+
<select
|
|
364
|
+
class="
|
|
365
|
+
h-8 bg-background px-2 pr-6 text-sm font-medium text-foreground
|
|
366
|
+
appearance-none cursor-pointer focus:outline-none relative z-10 opacity-0
|
|
367
|
+
"
|
|
368
|
+
(change)="changeMonth($event)"
|
|
369
|
+
>
|
|
370
|
+
@for (month of months; track $index) {
|
|
371
|
+
<option
|
|
372
|
+
[value]="$index"
|
|
373
|
+
[selected]="$index === selectedMonth()"
|
|
374
|
+
>
|
|
375
|
+
{{ month }}
|
|
376
|
+
</option>
|
|
377
|
+
}
|
|
378
|
+
</select>
|
|
379
|
+
|
|
380
|
+
<div class="absolute inset-0 flex items-center px-2">
|
|
381
|
+
<span class="text-sm font-medium flex-1 truncate">
|
|
382
|
+
{{ months[selectedMonth()] }}
|
|
383
|
+
</span>
|
|
384
|
+
|
|
385
|
+
<ng-icon
|
|
386
|
+
size="10"
|
|
387
|
+
name="matArrowForwardIosRound"
|
|
388
|
+
class="text-muted-foreground rotate-90 absolute right-2 pointer-events-none"
|
|
389
|
+
/>
|
|
390
|
+
</div>
|
|
391
|
+
</div>
|
|
392
|
+
|
|
393
|
+
<div
|
|
394
|
+
class="
|
|
395
|
+
relative border border-input rounded-md shadow-xs
|
|
396
|
+
has-focus:border-ring has-focus:ring-ring/50 has-focus:ring-[3px]
|
|
397
|
+
"
|
|
398
|
+
>
|
|
399
|
+
<select
|
|
400
|
+
class="
|
|
401
|
+
h-8 bg-background px-2 pr-6 text-sm font-medium text-foreground
|
|
402
|
+
appearance-none cursor-pointer focus:outline-none relative z-10 opacity-0
|
|
403
|
+
"
|
|
404
|
+
(change)="changeYear($event)"
|
|
405
|
+
>
|
|
406
|
+
@for (year of years; track $index) {
|
|
407
|
+
<option
|
|
408
|
+
[value]="year"
|
|
409
|
+
[selected]="year === selectedYear()"
|
|
410
|
+
>
|
|
411
|
+
{{ year }}
|
|
412
|
+
</option>
|
|
413
|
+
}
|
|
414
|
+
</select>
|
|
415
|
+
|
|
416
|
+
<div class="absolute inset-0 flex items-center px-2">
|
|
417
|
+
<span class="text-sm font-medium flex-1 truncate">
|
|
418
|
+
{{ selectedYear() }}
|
|
419
|
+
</span>
|
|
420
|
+
|
|
421
|
+
<ng-icon
|
|
422
|
+
size="10"
|
|
423
|
+
name="matArrowForwardIosRound"
|
|
424
|
+
class="text-muted-foreground rotate-90 absolute right-2 pointer-events-none"
|
|
425
|
+
/>
|
|
426
|
+
</div>
|
|
427
|
+
</div>
|
|
428
|
+
</div>
|
|
429
|
+
|
|
430
|
+
<button
|
|
431
|
+
upButton
|
|
432
|
+
type="icon"
|
|
433
|
+
variant="ghost"
|
|
434
|
+
(click)="nextMonth()"
|
|
435
|
+
class="h-[--cell-size] w-[--cell-size]"
|
|
436
|
+
>
|
|
437
|
+
<ng-icon name="matArrowForwardIosRound" size="14" />
|
|
438
|
+
</button>
|
|
439
|
+
</div>
|
|
440
|
+
|
|
441
|
+
<div class="grid grid-cols-7 text-center text-[0.8rem] font-normal text-muted-foreground">
|
|
442
|
+
@for (day of weekDays; track $index) {
|
|
443
|
+
<div class="select-none py-1">
|
|
444
|
+
{{ day }}
|
|
445
|
+
</div>
|
|
446
|
+
}
|
|
447
|
+
</div>
|
|
448
|
+
|
|
449
|
+
<div class="grid grid-cols-7 text-sm mt-2">
|
|
450
|
+
@for (day of daysOfMonth(); track $index) {
|
|
451
|
+
<div
|
|
452
|
+
class="relative aspect-square select-none mt-2 outline-none"
|
|
453
|
+
[ngClass]="{
|
|
454
|
+
'bg-primary/20': variant() === 'range' && (day | upDateIsInRange:rangeFrom():rangeTo()),
|
|
455
|
+
'rounded-l-md': day.toDateString() === rangeFrom()?.toDateString() || ((day | upDateIsInRange:rangeFrom():rangeTo()) && (day | upDateIsWeekEdge) === 'left'),
|
|
456
|
+
'rounded-r-md': day.toDateString() === rangeTo()?.toDateString() || ((day | upDateIsInRange:rangeFrom():rangeTo()) && (day | upDateIsWeekEdge) === 'right')
|
|
457
|
+
}"
|
|
458
|
+
>
|
|
459
|
+
<button
|
|
460
|
+
class="flex aspect-square w-full min-w-[--cell-size] items-center justify-center rounded-md font-normal leading-none transition-colors duration-150 not-disabled:cursor-pointer outline-none"
|
|
461
|
+
[disabled]="!(day | upDateIsSelectable:minDate():maxDate())"
|
|
462
|
+
[ngClass]="{
|
|
463
|
+
'bg-accent text-accent-foreground': day.toDateString() === today.toDateString(),
|
|
464
|
+
'opacity-40 pointer-events-none': !(day | upDateIsSelectable:minDate():maxDate()),
|
|
465
|
+
'text-foreground hover:bg-accent hover:text-accent-foreground': day.getMonth() === firstDayOfActiveMonth().getMonth(),
|
|
466
|
+
'text-muted-foreground/40 hover:text-muted-foreground/60 hover:bg-accent/30': day.getMonth() !== firstDayOfActiveMonth().getMonth(),
|
|
467
|
+
|
|
468
|
+
'bg-primary text-primary-foreground':
|
|
469
|
+
(variant() === 'single' && activeDay()?.toDateString() === day.toDateString()) ||
|
|
470
|
+
(variant() === 'range' && (
|
|
471
|
+
day.toDateString() === rangeFrom()?.toDateString() ||
|
|
472
|
+
day.toDateString() === rangeTo()?.toDateString()
|
|
473
|
+
)),
|
|
474
|
+
}"
|
|
475
|
+
(click)="selectDate(day)"
|
|
476
|
+
>
|
|
477
|
+
{{ day.getDate() }}
|
|
478
|
+
</button>
|
|
479
|
+
</div>
|
|
480
|
+
}
|
|
481
|
+
</div>
|
|
482
|
+
</div>
|
|
483
|
+
`,
|
|
484
|
+
}]
|
|
485
|
+
}], ctorParameters: () => [], propDecorators: { minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], selected: [{ type: i0.Output, args: ["selected"] }], rangeSelected: [{ type: i0.Output, args: ["rangeSelected"] }], activeDay: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeDay", required: false }] }, { type: i0.Output, args: ["activeDayChange"] }], activeRangeDay: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeRangeDay", required: false }] }, { type: i0.Output, args: ["activeRangeDayChange"] }] } });
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* Generated bundle index. Do not edit.
|
|
489
|
+
*/
|
|
490
|
+
|
|
491
|
+
export { UpCalendarComponent };
|
|
492
|
+
//# sourceMappingURL=unipin-angular-applet-calendar.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unipin-angular-applet-calendar.mjs","sources":["../../../projects/unipin-angular/calendar/pipes/date-is-in-range.pipe.ts","../../../projects/unipin-angular/calendar/pipes/date-is-week-edge.pipe.ts","../../../projects/unipin-angular/calendar/pipes/date-is-selectable.pipe.ts","../../../projects/unipin-angular/calendar/components/calendar.component.ts","../../../projects/unipin-angular/calendar/unipin-angular-applet-calendar.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\nimport { startOfDay, endOfDay } from 'date-fns';\n\n@Pipe({\n pure: true,\n standalone: true,\n name: 'upDateIsInRange',\n})\nexport class UpDateIsInRangePipe implements PipeTransform {\n \n public transform(date: Date, from?: Date | null, to?: Date | null): boolean{\n if (!date || !from || !to) {\n return false;\n }\n return date >= startOfDay(from) && date <= endOfDay(to);\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { getDay } from 'date-fns';\n\n@Pipe({\n pure: true,\n standalone: true,\n name: 'upDateIsWeekEdge',\n})\nexport class UpDateIsWeekEdgePipe implements PipeTransform {\n\n public transform(date: Date | null): 'left' | 'right' | null{\n if (!date) {\n return null;\n }\n const day = getDay(date);\n\n if (day === 1) return 'left';\n if (day === 0) return 'right';\n return null;\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { startOfDay, endOfDay } from 'date-fns';\n\n@Pipe({\n pure: true,\n standalone: true,\n name: 'upDateIsSelectable',\n})\nexport class UpDateIsSelectablePipe implements PipeTransform {\n \n public transform(date: Date, minDate?: Date | null, maxDate?: Date | null): boolean{\n if (!date) return false;\n \n if (minDate && date < startOfDay(minDate)) return false;\n if (maxDate && date > endOfDay(maxDate)) return false;\n return true;\n }\n}\n","import { ChangeDetectionStrategy, Component, computed, effect, input, model, output, signal } from '@angular/core';\nimport { NgClass } from '@angular/common';\nimport { NgIcon, provideIcons } from '@ng-icons/core';\nimport { matArrowBackIosRound, matArrowForwardIosRound } from '@ng-icons/material-icons/round';\nimport { addMonths, eachDayOfInterval, endOfMonth, endOfWeek, format, getMonth, getYear, startOfMonth, startOfWeek, subMonths } from 'date-fns';\nimport { UpButtonDirective } from '@unipin/angular-applet/buttons';\nimport { SingleDate, RangeDate } from '../types/calendar-date.type';\nimport { UpDateIsInRangePipe } from '../pipes/date-is-in-range.pipe';\nimport { UpDateIsWeekEdgePipe } from '../pipes/date-is-week-edge.pipe';\nimport { UpDateIsSelectablePipe } from '../pipes/date-is-selectable.pipe';\n\n\n@Component({\n standalone: true,\n selector: 'up-calendar',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n provideIcons(\n { \n matArrowBackIosRound, \n matArrowForwardIosRound \n }\n )\n ],\n imports: [\n NgClass,\n NgIcon,\n UpButtonDirective,\n UpDateIsInRangePipe,\n UpDateIsWeekEdgePipe,\n UpDateIsSelectablePipe,\n ],\n template: `\n <div class=\"w-fit rounded-xl border border-border bg-card p-3 shadow-lg [--cell-size:2rem]\">\n <div class=\"flex items-center justify-between mb-4 gap-1\">\n <button\n upButton\n type=\"icon\"\n variant=\"ghost\"\n (click)=\"previousMonth()\"\n class=\"h-[--cell-size] w-[--cell-size]\"\n >\n <ng-icon name=\"matArrowBackIosRound\" size=\"14\" />\n </button>\n\n <div class=\"flex items-center justify-center h-[--cell-size] gap-1.5\">\n <div\n class=\"\n relative border border-input rounded-md shadow-xs \n has-focus:border-ring has-focus:ring-ring/50 has-focus:ring-[3px]\n \"\n >\n <select\n class=\"\n h-8 bg-background px-2 pr-6 text-sm font-medium text-foreground \n appearance-none cursor-pointer focus:outline-none relative z-10 opacity-0\n \"\n (change)=\"changeMonth($event)\"\n >\n @for (month of months; track $index) {\n <option \n [value]=\"$index\" \n [selected]=\"$index === selectedMonth()\"\n >\n {{ month }}\n </option>\n }\n </select>\n \n <div class=\"absolute inset-0 flex items-center px-2\">\n <span class=\"text-sm font-medium flex-1 truncate\">\n {{ months[selectedMonth()] }}\n </span>\n \n <ng-icon\n size=\"10\"\n name=\"matArrowForwardIosRound\"\n class=\"text-muted-foreground rotate-90 absolute right-2 pointer-events-none\"\n />\n </div>\n </div>\n\n <div\n class=\"\n relative border border-input rounded-md shadow-xs \n has-focus:border-ring has-focus:ring-ring/50 has-focus:ring-[3px]\n \"\n >\n <select\n class=\"\n h-8 bg-background px-2 pr-6 text-sm font-medium text-foreground \n appearance-none cursor-pointer focus:outline-none relative z-10 opacity-0\n \"\n (change)=\"changeYear($event)\"\n >\n @for (year of years; track $index) {\n <option \n [value]=\"year\" \n [selected]=\"year === selectedYear()\"\n >\n {{ year }}\n </option>\n }\n </select>\n \n <div class=\"absolute inset-0 flex items-center px-2\">\n <span class=\"text-sm font-medium flex-1 truncate\">\n {{ selectedYear() }}\n </span>\n \n <ng-icon\n size=\"10\"\n name=\"matArrowForwardIosRound\"\n class=\"text-muted-foreground rotate-90 absolute right-2 pointer-events-none\"\n />\n </div>\n </div>\n </div>\n\n <button\n upButton\n type=\"icon\"\n variant=\"ghost\"\n (click)=\"nextMonth()\"\n class=\"h-[--cell-size] w-[--cell-size]\"\n >\n <ng-icon name=\"matArrowForwardIosRound\" size=\"14\" />\n </button>\n </div>\n\n <div class=\"grid grid-cols-7 text-center text-[0.8rem] font-normal text-muted-foreground\">\n @for (day of weekDays; track $index) {\n <div class=\"select-none py-1\">\n {{ day }}\n </div>\n }\n </div>\n\n <div class=\"grid grid-cols-7 text-sm mt-2\">\n @for (day of daysOfMonth(); track $index) {\n <div \n class=\"relative aspect-square select-none mt-2 outline-none\"\n [ngClass]=\"{\n 'bg-primary/20': variant() === 'range' && (day | upDateIsInRange:rangeFrom():rangeTo()),\n 'rounded-l-md': day.toDateString() === rangeFrom()?.toDateString() || ((day | upDateIsInRange:rangeFrom():rangeTo()) && (day | upDateIsWeekEdge) === 'left'),\n 'rounded-r-md': day.toDateString() === rangeTo()?.toDateString() || ((day | upDateIsInRange:rangeFrom():rangeTo()) && (day | upDateIsWeekEdge) === 'right')\n }\"\n >\n <button\n class=\"flex aspect-square w-full min-w-[--cell-size] items-center justify-center rounded-md font-normal leading-none transition-colors duration-150 not-disabled:cursor-pointer outline-none\"\n [disabled]=\"!(day | upDateIsSelectable:minDate():maxDate())\"\n [ngClass]=\"{\n 'bg-accent text-accent-foreground': day.toDateString() === today.toDateString(),\n 'opacity-40 pointer-events-none': !(day | upDateIsSelectable:minDate():maxDate()),\n 'text-foreground hover:bg-accent hover:text-accent-foreground': day.getMonth() === firstDayOfActiveMonth().getMonth(),\n 'text-muted-foreground/40 hover:text-muted-foreground/60 hover:bg-accent/30': day.getMonth() !== firstDayOfActiveMonth().getMonth(),\n \n 'bg-primary text-primary-foreground':\n (variant() === 'single' && activeDay()?.toDateString() === day.toDateString()) ||\n (variant() === 'range' && (\n day.toDateString() === rangeFrom()?.toDateString() ||\n day.toDateString() === rangeTo()?.toDateString()\n )),\n }\"\n (click)=\"selectDate(day)\"\n >\n {{ day.getDate() }}\n </button>\n </div>\n }\n </div>\n </div>\n `,\n})\nexport class UpCalendarComponent {\n \n public readonly minDate = input<SingleDate>(null);\n public readonly maxDate = input<SingleDate>(null);\n public readonly variant = input<'single' | 'range'>('single');\n \n public readonly selected = output<SingleDate>();\n public readonly rangeSelected = output<RangeDate>();\n\n public readonly today = new Date();\n public readonly activeDay = model<SingleDate>(this.today);\n public readonly activeRangeDay = model<RangeDate>({from: null, to: null});\n\n public readonly rangeTo = signal<SingleDate>(null);\n public readonly rangeFrom = signal<SingleDate>(null);\n\n public readonly selectedYear = signal(getYear(this.today));\n public readonly selectedMonth = signal(getMonth(this.today));\n\n public readonly firstDayOfActiveMonth = computed(\n () => {\n return startOfMonth(new Date(this.selectedYear(), this.selectedMonth(), 1));\n }\n );\n \n public readonly daysOfMonth = computed(\n () => {\n const start = startOfWeek(this.firstDayOfActiveMonth(), { weekStartsOn: 1 });\n const end = endOfWeek(endOfMonth(this.firstDayOfActiveMonth()), { weekStartsOn: 1 });\n \n return eachDayOfInterval({ start, end });\n }\n );\n\n public readonly weekDays = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];\n public readonly months = Array.from(\n { length: 12 }, \n (_, i) => format(new Date(2000, i), 'MMM')\n );\n public readonly years = Array.from(\n { \n length: (new Date().getFullYear() + 2) - 1970 + 1\n },\n (_, i) => 1970 + i\n );\n\n constructor() {\n effect(\n () => {\n if (this.variant() !== 'range') {\n return;\n }\n const range = this.activeRangeDay();\n\n if (!range.from && !range.to) {\n this.rangeTo.set(null);\n this.rangeFrom.set(null);\n \n return;\n }\n \n if (range.from && range.to) {\n this.rangeTo.set(range.to);\n this.rangeFrom.set(range.from);\n \n return;\n }\n const singleDate = range.from || range.to;\n \n this.rangeTo.set(singleDate);\n this.rangeFrom.set(singleDate);\n }\n );\n }\n\n public changeMonth(event: Event): void{\n this.selectedMonth.set(\n +(event.target as HTMLSelectElement).value\n );\n }\n \n public changeYear(event: Event): void{\n this.selectedYear.set(\n +(event.target as HTMLSelectElement).value\n );\n }\n\n public previousMonth(): void{\n const prev = subMonths(this.firstDayOfActiveMonth(), 1);\n \n this.selectedYear.set(getYear(prev));\n this.selectedMonth.set(getMonth(prev));\n }\n \n public nextMonth(): void{\n const next = addMonths(this.firstDayOfActiveMonth(), 1);\n \n this.selectedYear.set(getYear(next));\n this.selectedMonth.set(getMonth(next));\n }\n\n public selectDate(day: Date): void{\n if (this.variant() === 'single') {\n const active = this.activeDay();\n const value = active && active.toDateString() === day.toDateString() ? null : day;\n \n this.activeDay.set(value);\n this.selected.emit(value);\n \n return;\n }\n this.handleRangeSelection(day);\n }\n\n protected handleRangeSelection(day: Date): void{\n const from = this.rangeFrom();\n const to = this.rangeTo();\n \n const time = day.getTime();\n if (!from && !to) {\n return this.setRange(day, day);\n }\n \n if (\n from?.getTime() === to?.getTime() && \n from?.getTime() === time\n ) {\n return this.setRange(null, null);\n }\n \n if (from && to) {\n const fromTime = from.getTime();\n const toTime = to.getTime();\n \n if (time === fromTime) return this.setRange(from, day);\n if (time === toTime) return this.setRange(day, to);\n if (time < fromTime) return this.setRange(day, to);\n \n return this.setRange(from, day);\n }\n }\n \n protected setRange(from: SingleDate, to: SingleDate): void{\n this.rangeTo.set(to);\n this.rangeFrom.set(from);\n \n this.rangeSelected.emit({ from, to });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;MAQa,mBAAmB,CAAA;AAEvB,IAAA,SAAS,CAAC,IAAU,EAAE,IAAkB,EAAE,EAAgB,EAAA;QAC/D,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,EAAE,EAAE;AACzB,YAAA,OAAO,KAAK;QACd;AACA,QAAA,OAAO,IAAI,IAAI,UAAU,CAAC,IAAI,CAAC,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AoB;wBACpB,sBAAsB;AACvB,qBAAA;AACD,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4IT,EAAA,CAAA;AACF,iBAAA;;;AC7KD;;AAEG;;;;"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { model, input, Directive, computed } from '@angular/core';
|
|
3
|
+
import { up } from '@unipin/angular-applet/common';
|
|
4
|
+
|
|
5
|
+
class UpCollapsibleDirective {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.isOpened = model(false, ...(ngDevMode ? [{ debugName: "isOpened" }] : []));
|
|
8
|
+
this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
9
|
+
this.inlineClass = input('', ...(ngDevMode ? [{ debugName: "inlineClass", alias: 'class' }] : [{ alias: 'class' }]));
|
|
10
|
+
}
|
|
11
|
+
setOpen(value) {
|
|
12
|
+
if (!this.disabled()) {
|
|
13
|
+
this.isOpened.set(value);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpCollapsibleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
17
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.0", type: UpCollapsibleDirective, isStandalone: true, selector: "[upCollapsible]", inputs: { isOpened: { classPropertyName: "isOpened", publicName: "isOpened", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, inlineClass: { classPropertyName: "inlineClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { isOpened: "isOpenedChange" }, host: { properties: { "class": "inlineClass()", "attr.data-state": "isOpened()? 'open' : 'closed'" } }, exportAs: ["upCollapsible"], ngImport: i0 }); }
|
|
18
|
+
}
|
|
19
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpCollapsibleDirective, decorators: [{
|
|
20
|
+
type: Directive,
|
|
21
|
+
args: [{
|
|
22
|
+
standalone: true,
|
|
23
|
+
exportAs: 'upCollapsible',
|
|
24
|
+
selector: '[upCollapsible]',
|
|
25
|
+
host: {
|
|
26
|
+
'[class]': 'inlineClass()',
|
|
27
|
+
'[attr.data-state]': `isOpened()? 'open' : 'closed'`,
|
|
28
|
+
}
|
|
29
|
+
}]
|
|
30
|
+
}], propDecorators: { isOpened: [{ type: i0.Input, args: [{ isSignal: true, alias: "isOpened", required: false }] }, { type: i0.Output, args: ["isOpenedChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], inlineClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
31
|
+
|
|
32
|
+
class UpCollapsibleTriggerDirective {
|
|
33
|
+
constructor(parent) {
|
|
34
|
+
this.parent = parent;
|
|
35
|
+
this.inlineClass = input('', ...(ngDevMode ? [{ debugName: "inlineClass", alias: 'class' }] : [{ alias: 'class' }]));
|
|
36
|
+
this._computedClass = computed(() => {
|
|
37
|
+
return up('cursor-pointer', this.inlineClass());
|
|
38
|
+
}, ...(ngDevMode ? [{ debugName: "_computedClass" }] : []));
|
|
39
|
+
}
|
|
40
|
+
toggleState() {
|
|
41
|
+
this.parent.setOpen(!this.parent.isOpened());
|
|
42
|
+
}
|
|
43
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpCollapsibleTriggerDirective, deps: [{ token: UpCollapsibleDirective }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
44
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.0", type: UpCollapsibleTriggerDirective, isStandalone: true, selector: "[upCollapsibleTrigger]", inputs: { inlineClass: { classPropertyName: "inlineClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "toggleState()" }, properties: { "class": "_computedClass()", "attr.disabled": "parent.disabled() || null", "attr.data-state": "parent.isOpened()? 'open' : 'closed'" } }, exportAs: ["upCollapsibleTrigger"], ngImport: i0 }); }
|
|
45
|
+
}
|
|
46
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpCollapsibleTriggerDirective, decorators: [{
|
|
47
|
+
type: Directive,
|
|
48
|
+
args: [{
|
|
49
|
+
standalone: true,
|
|
50
|
+
exportAs: 'upCollapsibleTrigger',
|
|
51
|
+
selector: '[upCollapsibleTrigger]',
|
|
52
|
+
host: {
|
|
53
|
+
'[class]': '_computedClass()',
|
|
54
|
+
'[attr.disabled]': 'parent.disabled() || null',
|
|
55
|
+
'[attr.data-state]': `parent.isOpened()? 'open' : 'closed'`,
|
|
56
|
+
'(click)': 'toggleState()'
|
|
57
|
+
}
|
|
58
|
+
}]
|
|
59
|
+
}], ctorParameters: () => [{ type: UpCollapsibleDirective }], propDecorators: { inlineClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
60
|
+
|
|
61
|
+
class UpCollapsibleContentDirective {
|
|
62
|
+
constructor(elementRef, parent) {
|
|
63
|
+
this.elementRef = elementRef;
|
|
64
|
+
this.parent = parent;
|
|
65
|
+
this.inlineClass = input('', ...(ngDevMode ? [{ debugName: "inlineClass", alias: 'class' }] : [{ alias: 'class' }]));
|
|
66
|
+
this._contentHeight = computed(() => {
|
|
67
|
+
const element = this.elementRef.nativeElement;
|
|
68
|
+
return element ? `${element.scrollHeight}px` : '0px';
|
|
69
|
+
}, ...(ngDevMode ? [{ debugName: "_contentHeight" }] : []));
|
|
70
|
+
this._computedClass = computed(() => {
|
|
71
|
+
return up('overflow-hidden transition-all duration-300 ease-in-out', 'h-0 data-[state="open"]:h-[var(--up-collapsible-content-height)]', 'invisible data-[state="open"]:visible', this.inlineClass());
|
|
72
|
+
}, ...(ngDevMode ? [{ debugName: "_computedClass" }] : []));
|
|
73
|
+
}
|
|
74
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpCollapsibleContentDirective, deps: [{ token: i0.ElementRef }, { token: UpCollapsibleDirective }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
75
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.0", type: UpCollapsibleContentDirective, isStandalone: true, selector: "[upCollapsibleContent]", inputs: { inlineClass: { classPropertyName: "inlineClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "_computedClass()", "attr.data-disabled": "parent.disabled() || null", "attr.data-state": "parent.isOpened()? 'open' : 'closed'", "style.--up-collapsible-content-height": "_contentHeight()" } }, exportAs: ["upCollapsibleContent"], ngImport: i0 }); }
|
|
76
|
+
}
|
|
77
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: UpCollapsibleContentDirective, decorators: [{
|
|
78
|
+
type: Directive,
|
|
79
|
+
args: [{
|
|
80
|
+
standalone: true,
|
|
81
|
+
exportAs: 'upCollapsibleContent',
|
|
82
|
+
selector: '[upCollapsibleContent]',
|
|
83
|
+
host: {
|
|
84
|
+
'[class]': '_computedClass()',
|
|
85
|
+
'[attr.data-disabled]': 'parent.disabled() || null',
|
|
86
|
+
'[attr.data-state]': `parent.isOpened()? 'open' : 'closed'`,
|
|
87
|
+
'[style.--up-collapsible-content-height]': '_contentHeight()',
|
|
88
|
+
}
|
|
89
|
+
}]
|
|
90
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: UpCollapsibleDirective }], propDecorators: { inlineClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Generated bundle index. Do not edit.
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
export { UpCollapsibleContentDirective, UpCollapsibleDirective, UpCollapsibleTriggerDirective };
|
|
97
|
+
//# sourceMappingURL=unipin-angular-applet-collapsible.mjs.map
|