@taiga-ui/core 4.52.0-canary.6c67ccf → 4.52.0-canary.6de148b
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 +1 -1
- package/classes/accessors.d.ts +1 -1
- package/components/button/button.directive.d.ts +2 -2
- package/components/button/button.options.d.ts +1 -1
- package/components/calendar/calendar-sheet.options.d.ts +1 -3
- package/{pipes/calendar-sheet → components/calendar}/calendar-sheet.pipe.d.ts +1 -1
- package/components/calendar/calendar-spin.component.d.ts +1 -0
- package/components/calendar/calendar-year.component.d.ts +1 -1
- package/components/calendar/index.d.ts +2 -0
- package/components/cell/cell.directive.d.ts +9 -0
- package/components/cell/cell.options.d.ts +6 -0
- package/components/cell/index.d.ts +2 -0
- package/components/data-list/data-list.component.d.ts +8 -12
- package/components/data-list/data-list.d.ts +3 -4
- package/components/data-list/data-list.tokens.d.ts +1 -23
- package/components/data-list/index.d.ts +3 -4
- package/components/data-list/opt-group.directive.d.ts +2 -2
- package/components/data-list/option-content.directive.d.ts +14 -0
- package/components/data-list/option-with-value.directive.d.ts +9 -0
- package/components/data-list/option.directive.d.ts +19 -0
- package/components/error/error.component.d.ts +6 -8
- package/components/error/error.d.ts +4 -0
- package/components/error/error.directive.d.ts +19 -0
- package/components/error/error.pipe.d.ts +10 -0
- package/components/error/index.d.ts +3 -0
- package/components/expand/expand.component.d.ts +9 -28
- package/components/expand/index.d.ts +0 -2
- package/components/icon/icon.component.d.ts +3 -3
- package/components/index.d.ts +3 -3
- package/components/input/index.d.ts +2 -0
- package/components/input/input.d.ts +2 -0
- package/components/input/input.directive.d.ts +30 -0
- package/components/link/link.directive.d.ts +2 -2
- package/components/link/link.options.d.ts +1 -3
- package/components/loader/loader.component.d.ts +7 -7
- package/components/loader/loader.options.d.ts +1 -3
- package/components/notification/index.d.ts +3 -0
- package/components/notification/notification.component.d.ts +14 -0
- package/components/notification/notification.d.ts +3 -0
- package/components/notification/notification.directive.d.ts +7 -12
- package/components/notification/notification.options.d.ts +10 -7
- package/components/notification/notification.service.d.ts +17 -0
- package/components/root/root.component.d.ts +4 -6
- package/components/scrollbar/scroll-into-view.directive.d.ts +3 -2
- package/components/scrollbar/scrollbar.component.d.ts +2 -2
- package/components/scrollbar/scrollbar.directive.d.ts +2 -2
- package/components/scrollbar/scrollbar.options.d.ts +1 -1
- package/components/spin-button/spin-button.component.d.ts +8 -9
- package/components/textfield/index.d.ts +1 -4
- package/components/textfield/textfield-icon.d.ts +3 -3
- package/components/textfield/textfield-multi/textfield-item.component.d.ts +3 -2
- package/components/textfield/textfield-multi/textfield-multi.component.d.ts +10 -15
- package/components/textfield/textfield.component.d.ts +23 -37
- package/components/textfield/textfield.d.ts +2 -4
- package/components/textfield/textfield.options.d.ts +8 -11
- package/{directives → components}/title/title.directive.d.ts +2 -3
- package/directives/appearance/appearance.directive.d.ts +5 -13
- package/directives/appearance/appearance.options.d.ts +1 -1
- package/directives/date-format/date-format.directive.d.ts +3 -7
- package/directives/group/group.directive.d.ts +7 -7
- package/directives/group/group.options.d.ts +1 -3
- package/directives/icons/icons.bindings.d.ts +5 -0
- package/directives/icons/icons.directive.d.ts +6 -14
- package/directives/icons/index.d.ts +1 -0
- package/directives/index.d.ts +0 -5
- package/directives/number-format/number-format.directive.d.ts +3 -7
- package/fesm2022/taiga-ui-core-animations.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-classes.mjs +6 -8
- package/fesm2022/taiga-ui-core-classes.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-button.mjs +11 -18
- package/fesm2022/taiga-ui-core-components-button.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-calendar.mjs +125 -27
- package/fesm2022/taiga-ui-core-components-calendar.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-cell.mjs +45 -0
- package/fesm2022/taiga-ui-core-components-cell.mjs.map +1 -0
- package/fesm2022/taiga-ui-core-components-data-list.mjs +106 -275
- package/fesm2022/taiga-ui-core-components-data-list.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-error.mjs +109 -24
- package/fesm2022/taiga-ui-core-components-error.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-expand.mjs +33 -131
- package/fesm2022/taiga-ui-core-components-expand.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-icon.mjs +5 -6
- package/fesm2022/taiga-ui-core-components-icon.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-input.mjs +95 -0
- package/fesm2022/taiga-ui-core-components-input.mjs.map +1 -0
- package/fesm2022/taiga-ui-core-components-label.mjs +6 -9
- package/fesm2022/taiga-ui-core-components-label.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-link.mjs +14 -23
- package/fesm2022/taiga-ui-core-components-link.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-loader.mjs +14 -32
- package/fesm2022/taiga-ui-core-components-loader.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-notification.mjs +107 -64
- package/fesm2022/taiga-ui-core-components-notification.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-root.mjs +19 -50
- package/fesm2022/taiga-ui-core-components-root.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-scrollbar.mjs +36 -45
- package/fesm2022/taiga-ui-core-components-scrollbar.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-spin-button.mjs +14 -27
- package/fesm2022/taiga-ui-core-components-spin-button.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-textfield.mjs +109 -408
- package/fesm2022/taiga-ui-core-components-textfield.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-title.mjs +37 -0
- package/fesm2022/taiga-ui-core-components-title.mjs.map +1 -0
- package/fesm2022/taiga-ui-core-components.mjs +3 -3
- package/fesm2022/taiga-ui-core-directives-appearance.mjs +27 -64
- package/fesm2022/taiga-ui-core-directives-appearance.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-directives-date-format.mjs +24 -18
- package/fesm2022/taiga-ui-core-directives-date-format.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-directives-group.mjs +23 -38
- package/fesm2022/taiga-ui-core-directives-group.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-directives-icons.mjs +30 -40
- package/fesm2022/taiga-ui-core-directives-icons.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-directives-items-handlers.mjs +3 -6
- package/fesm2022/taiga-ui-core-directives-items-handlers.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-directives-number-format.mjs +30 -18
- package/fesm2022/taiga-ui-core-directives-number-format.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-directives.mjs +0 -5
- package/fesm2022/taiga-ui-core-directives.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-pipes-format-number.mjs +19 -13
- package/fesm2022/taiga-ui-core-pipes-format-number.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-pipes.mjs +0 -8
- package/fesm2022/taiga-ui-core-pipes.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-portals-alert.mjs +73 -0
- package/fesm2022/taiga-ui-core-portals-alert.mjs.map +1 -0
- package/fesm2022/taiga-ui-core-portals-dialog.mjs +158 -0
- package/fesm2022/taiga-ui-core-portals-dialog.mjs.map +1 -0
- package/fesm2022/{taiga-ui-core-directives-dropdown.mjs → taiga-ui-core-portals-dropdown.mjs} +137 -289
- package/fesm2022/taiga-ui-core-portals-dropdown.mjs.map +1 -0
- package/fesm2022/{taiga-ui-core-directives-hint.mjs → taiga-ui-core-portals-hint.mjs} +119 -219
- package/fesm2022/taiga-ui-core-portals-hint.mjs.map +1 -0
- package/fesm2022/taiga-ui-core-portals-modal.mjs +89 -0
- package/fesm2022/taiga-ui-core-portals-modal.mjs.map +1 -0
- package/fesm2022/taiga-ui-core-portals-popup.mjs +56 -0
- package/fesm2022/taiga-ui-core-portals-popup.mjs.map +1 -0
- package/fesm2022/taiga-ui-core-portals.mjs +11 -0
- package/fesm2022/taiga-ui-core-portals.mjs.map +1 -0
- package/fesm2022/taiga-ui-core-services.mjs +3 -23
- package/fesm2022/taiga-ui-core-services.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-tokens.mjs +28 -26
- package/fesm2022/taiga-ui-core-tokens.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-utils-dom.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-utils-format.mjs +1 -22
- package/fesm2022/taiga-ui-core-utils-format.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-utils-miscellaneous.mjs +55 -18
- package/fesm2022/taiga-ui-core-utils-miscellaneous.mjs.map +1 -1
- package/fesm2022/taiga-ui-core.mjs +1 -0
- package/fesm2022/taiga-ui-core.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/package.json +83 -104
- package/pipes/format-number/format-number.pipe.d.ts +6 -4
- package/pipes/index.d.ts +0 -8
- package/portals/alert/alert.directive.d.ts +11 -0
- package/portals/alert/alert.service.d.ts +12 -0
- package/portals/alert/index.d.ts +2 -0
- package/portals/dialog/dialog.component.d.ts +14 -0
- package/portals/dialog/dialog.directive.d.ts +8 -0
- package/{components → portals}/dialog/dialog.factory.d.ts +1 -1
- package/portals/dialog/dialog.options.d.ts +25 -0
- package/{components/dialog/dialog-close.service.d.ts → portals/dialog/dialog.providers.d.ts} +2 -0
- package/portals/dialog/dialog.service.d.ts +10 -0
- package/portals/dialog/index.d.ts +6 -0
- package/portals/dropdown/dropdown-content.directive.d.ts +9 -0
- package/{directives → portals}/dropdown/dropdown-hover.directive.d.ts +5 -10
- package/{directives → portals}/dropdown/dropdown-hover.options.d.ts +1 -3
- package/{directives → portals}/dropdown/dropdown-manual.directive.d.ts +2 -2
- package/portals/dropdown/dropdown-open.directive.d.ts +30 -0
- package/{directives → portals}/dropdown/dropdown-position-sided.directive.d.ts +3 -3
- package/{directives → portals}/dropdown/dropdown-position.directive.d.ts +5 -5
- package/{directives → portals}/dropdown/dropdown-selection.directive.d.ts +4 -5
- package/{directives → portals}/dropdown/dropdown.bindings.d.ts +0 -1
- package/{directives → portals}/dropdown/dropdown.d.ts +2 -3
- package/{directives → portals}/dropdown/dropdown.directive.d.ts +6 -8
- package/{directives → portals}/dropdown/index.d.ts +1 -4
- package/{directives → portals}/hint/hint-describe.directive.d.ts +4 -6
- package/{directives → portals}/hint/hint-host.directive.d.ts +2 -2
- package/{directives → portals}/hint/hint-hover.directive.d.ts +3 -4
- package/{directives → portals}/hint/hint-manual.directive.d.ts +2 -2
- package/{directives → portals}/hint/hint-options.directive.d.ts +3 -3
- package/{directives → portals}/hint/hint-overflow.directive.d.ts +2 -2
- package/{directives → portals}/hint/hint-position.directive.d.ts +4 -5
- package/{directives → portals}/hint/hint-unstyled.component.d.ts +2 -7
- package/portals/hint/hint.component.d.ts +29 -0
- package/portals/hint/hint.directive.d.ts +24 -0
- package/{directives → portals}/hint/index.d.ts +0 -2
- package/portals/index.d.ts +6 -0
- package/portals/modal/index.d.ts +2 -0
- package/portals/modal/modal.component.d.ts +17 -0
- package/portals/modal/modal.service.d.ts +13 -0
- package/portals/popup/popup.directive.d.ts +12 -0
- package/{directives → portals}/popup/popup.service.d.ts +1 -1
- package/{directives → portals}/popup/popups.component.d.ts +2 -2
- package/services/index.d.ts +0 -1
- package/styles/components/button.less +0 -2
- package/styles/components/icons.less +4 -4
- package/styles/components/link.less +1 -0
- package/styles/components/textfield.less +10 -7
- package/styles/mixins/appearance.less +1 -1
- package/styles/mixins/mixins.less +0 -6
- package/styles/mixins/mixins.scss +0 -6
- package/styles/mixins/slider.less +21 -16
- package/styles/mixins/slider.scss +1 -2
- package/styles/theme/variables.less +2 -4
- package/tokens/common-icons.d.ts +1 -3
- package/tokens/date-format.d.ts +2 -3
- package/tokens/i18n.d.ts +7 -7
- package/tokens/icon-resolver.d.ts +0 -4
- package/tokens/icons.d.ts +0 -4
- package/tokens/index.d.ts +1 -0
- package/tokens/number-format.d.ts +2 -3
- package/tokens/validation-errors.d.ts +4 -0
- package/types/index.d.ts +0 -3
- package/types/size.d.ts +0 -11
- package/utils/format/index.d.ts +0 -1
- package/utils/miscellaneous/get-duration.d.ts +2 -0
- package/utils/miscellaneous/index.d.ts +2 -1
- package/utils/miscellaneous/provide-taiga.d.ts +13 -0
- package/components/alert/alert.component.d.ts +0 -15
- package/components/alert/alert.directive.d.ts +0 -7
- package/components/alert/alert.interfaces.d.ts +0 -12
- package/components/alert/alert.service.d.ts +0 -7
- package/components/alert/alert.tokens.d.ts +0 -12
- package/components/alert/alerts.component.d.ts +0 -12
- package/components/alert/index.d.ts +0 -6
- package/components/data-list/data-list.directive.d.ts +0 -7
- package/components/data-list/option/option-content.d.ts +0 -16
- package/components/data-list/option/option-legacy.component.d.ts +0 -24
- package/components/data-list/option/option.directive.d.ts +0 -27
- package/components/dialog/dialog.component.d.ts +0 -20
- package/components/dialog/dialog.directive.d.ts +0 -7
- package/components/dialog/dialog.interfaces.d.ts +0 -34
- package/components/dialog/dialog.service.d.ts +0 -7
- package/components/dialog/dialog.tokens.d.ts +0 -15
- package/components/dialog/dialogs.component.d.ts +0 -8
- package/components/dialog/index.d.ts +0 -8
- package/components/expand/expand-content.directive.d.ts +0 -8
- package/components/expand/expand.d.ts +0 -6
- package/components/fullscreen/fullscreen.component.d.ts +0 -14
- package/components/fullscreen/index.d.ts +0 -1
- package/components/textfield/select.directive.d.ts +0 -19
- package/components/textfield/textfield-dropdown.directive.d.ts +0 -16
- package/components/textfield/textfield.directive.d.ts +0 -38
- package/directives/dropdown/dropdown-open-legacy.directive.d.ts +0 -12
- package/directives/dropdown/dropdown-open.directive.d.ts +0 -33
- package/directives/dropdown/dropdown-portal.directive.d.ts +0 -14
- package/directives/dropdown/dropdown.service.d.ts +0 -6
- package/directives/dropdown/dropdowns.component.d.ts +0 -9
- package/directives/hint/hint.component.d.ts +0 -30
- package/directives/hint/hint.directive.d.ts +0 -26
- package/directives/hint/hint.service.d.ts +0 -13
- package/directives/hint/hints.component.d.ts +0 -12
- package/directives/popup/popup.directive.d.ts +0 -11
- package/directives/surface/index.d.ts +0 -1
- package/directives/surface/surface.directive.d.ts +0 -8
- package/fesm2022/taiga-ui-core-components-alert.mjs +0 -149
- package/fesm2022/taiga-ui-core-components-alert.mjs.map +0 -1
- package/fesm2022/taiga-ui-core-components-dialog.mjs +0 -195
- package/fesm2022/taiga-ui-core-components-dialog.mjs.map +0 -1
- package/fesm2022/taiga-ui-core-components-fullscreen.mjs +0 -66
- package/fesm2022/taiga-ui-core-components-fullscreen.mjs.map +0 -1
- package/fesm2022/taiga-ui-core-directives-dropdown.mjs.map +0 -1
- package/fesm2022/taiga-ui-core-directives-hint.mjs.map +0 -1
- package/fesm2022/taiga-ui-core-directives-popup.mjs +0 -63
- package/fesm2022/taiga-ui-core-directives-popup.mjs.map +0 -1
- package/fesm2022/taiga-ui-core-directives-surface.mjs +0 -50
- package/fesm2022/taiga-ui-core-directives-surface.mjs.map +0 -1
- package/fesm2022/taiga-ui-core-directives-title.mjs +0 -43
- package/fesm2022/taiga-ui-core-directives-title.mjs.map +0 -1
- package/fesm2022/taiga-ui-core-pipes-auto-color.mjs +0 -25
- package/fesm2022/taiga-ui-core-pipes-auto-color.mjs.map +0 -1
- package/fesm2022/taiga-ui-core-pipes-calendar-sheet.mjs +0 -94
- package/fesm2022/taiga-ui-core-pipes-calendar-sheet.mjs.map +0 -1
- package/fesm2022/taiga-ui-core-pipes-fallback-src.mjs +0 -29
- package/fesm2022/taiga-ui-core-pipes-fallback-src.mjs.map +0 -1
- package/fesm2022/taiga-ui-core-pipes-flag.mjs +0 -32
- package/fesm2022/taiga-ui-core-pipes-flag.mjs.map +0 -1
- package/fesm2022/taiga-ui-core-pipes-format-date.mjs +0 -28
- package/fesm2022/taiga-ui-core-pipes-format-date.mjs.map +0 -1
- package/fesm2022/taiga-ui-core-pipes-initials.mjs +0 -29
- package/fesm2022/taiga-ui-core-pipes-initials.mjs.map +0 -1
- package/fesm2022/taiga-ui-core-pipes-month.mjs +0 -29
- package/fesm2022/taiga-ui-core-pipes-month.mjs.map +0 -1
- package/fesm2022/taiga-ui-core-pipes-order-week-days.mjs +0 -36
- package/fesm2022/taiga-ui-core-pipes-order-week-days.mjs.map +0 -1
- package/pipes/auto-color/auto-color.pipe.d.ts +0 -7
- package/pipes/auto-color/index.d.ts +0 -1
- package/pipes/calendar-sheet/index.d.ts +0 -1
- package/pipes/calendar-sheet/utils.d.ts +0 -20
- package/pipes/fallback-src/fallback-src.pipe.d.ts +0 -9
- package/pipes/fallback-src/index.d.ts +0 -1
- package/pipes/flag/flag.pipe.d.ts +0 -14
- package/pipes/flag/index.d.ts +0 -1
- package/pipes/format-date/format-date.pipe.d.ts +0 -9
- package/pipes/format-date/index.d.ts +0 -1
- package/pipes/initials/index.d.ts +0 -1
- package/pipes/initials/initials.pipe.d.ts +0 -7
- package/pipes/month/index.d.ts +0 -1
- package/pipes/month/month.pipe.d.ts +0 -10
- package/pipes/order-week-days/index.d.ts +0 -1
- package/services/format-date.service.d.ts +0 -8
- package/types/portal-item.d.ts +0 -9
- package/types/range-state.d.ts +0 -4
- package/types/value-content-context.d.ts +0 -4
- package/utils/format/string-hash-to-hsl.d.ts +0 -6
- package/utils/miscellaneous/to-animation-options.d.ts +0 -4
- /package/{pipes/order-week-days → components/calendar}/order-week-days.pipe.d.ts +0 -0
- /package/{directives → components}/title/index.d.ts +0 -0
- /package/{directives → portals}/dropdown/dropdown-context.directive.d.ts +0 -0
- /package/{directives → portals}/dropdown/dropdown-limit-width.d.ts +0 -0
- /package/{directives → portals}/dropdown/dropdown-options.directive.d.ts +0 -0
- /package/{directives → portals}/dropdown/dropdown.component.d.ts +0 -0
- /package/{directives → portals}/dropdown/dropdown.driver.d.ts +0 -0
- /package/{directives → portals}/dropdown/dropdown.providers.d.ts +0 -0
- /package/{directives → portals}/dropdown/with-dropdown-open.directive.d.ts +0 -0
- /package/{directives → portals}/hint/hint-driver.directive.d.ts +0 -0
- /package/{directives → portals}/hint/hint-pointer.directive.d.ts +0 -0
- /package/{directives → portals}/hint/hint.d.ts +0 -0
- /package/{directives → portals}/hint/hint.providers.d.ts +0 -0
- /package/{directives → portals}/popup/index.d.ts +0 -0
package/fesm2022/{taiga-ui-core-directives-dropdown.mjs → taiga-ui-core-portals-dropdown.mjs}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, Directive, InjectionToken, Optional, Self, SkipSelf, inject, Input,
|
|
3
|
-
import { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';
|
|
2
|
+
import { Injectable, Directive, InjectionToken, Optional, Self, SkipSelf, inject, Input, ChangeDetectorRef, effect, signal, INJECTOR, input, computed, TemplateRef, forwardRef, ChangeDetectionStrategy, Component, PLATFORM_ID, contentChild, ElementRef, model, ViewContainerRef } from '@angular/core';
|
|
3
|
+
import { outputFromObservable, takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';
|
|
4
4
|
import { EMPTY_CLIENT_RECT, TUI_TRUE_HANDLER, CHAR_ZERO_WIDTH_SPACE, CHAR_NO_BREAK_SPACE } from '@taiga-ui/cdk/constants';
|
|
5
5
|
import * as i1 from '@taiga-ui/cdk/directives/active-zone';
|
|
6
6
|
import { TuiActiveZone } from '@taiga-ui/cdk/directives/active-zone';
|
|
@@ -8,24 +8,25 @@ import * as i2 from '@taiga-ui/cdk/directives/animated';
|
|
|
8
8
|
import { TuiAnimated } from '@taiga-ui/cdk/directives/animated';
|
|
9
9
|
import { tuiInjectElement, tuiGetActualTarget, tuiPointToClientRect, tuiIsElement, tuiIsHTMLElement, tuiIsElementEditable, tuiIsTextNode, tuiIsTextfield } from '@taiga-ui/cdk/utils/dom';
|
|
10
10
|
import { tuiClamp } from '@taiga-ui/cdk/utils/math';
|
|
11
|
-
import {
|
|
12
|
-
import { TuiDriverDirective, TuiPositionAccessor, tuiFallbackAccessor, TuiRectAccessor,
|
|
11
|
+
import { tuiPx, tuiSetSignal, tuiIsString } from '@taiga-ui/cdk/utils/miscellaneous';
|
|
12
|
+
import { TuiDriverDirective, TuiPositionAccessor, tuiFallbackAccessor, TuiRectAccessor, tuiAsVehicle, tuiPositionAccessorFor, tuiRectAccessorFor, tuiAsDriver, tuiAsRectAccessor, TuiDriver, tuiAsPositionAccessor } from '@taiga-ui/core/classes';
|
|
13
13
|
import { TuiScrollbar } from '@taiga-ui/core/components/scrollbar';
|
|
14
14
|
import { TuiVisualViewportService, TuiPositionService } from '@taiga-ui/core/services';
|
|
15
15
|
import { TUI_VIEWPORT, TUI_DARK_MODE, TUI_SELECTION_STREAM } from '@taiga-ui/core/tokens';
|
|
16
16
|
import { PolymorpheusComponent, PolymorpheusTemplate, PolymorpheusOutlet } from '@taiga-ui/polymorpheus';
|
|
17
|
-
import { BehaviorSubject, Subject, throttleTime, takeWhile, map, merge, filter, fromEvent, switchMap, delay, startWith, takeUntil,
|
|
17
|
+
import { BehaviorSubject, Subject, distinctUntilChanged, throttleTime, takeWhile, map, merge, filter, fromEvent, switchMap, delay, startWith, takeUntil, of, tap, share, combineLatest } from 'rxjs';
|
|
18
18
|
import { coerceArray } from '@angular/cdk/coercion';
|
|
19
19
|
import { tuiZonefreeScheduler, tuiTypedFromEvent, tuiZonefree, tuiIfMap, tuiCloseWatcher, tuiZonefull, tuiWatch, tuiZoneOptimized } from '@taiga-ui/cdk/observables';
|
|
20
|
+
import { TuiPopupService } from '@taiga-ui/core/portals/popup';
|
|
20
21
|
import { tuiOverrideOptions, tuiCheckFixedPosition, tuiGetWordRange } from '@taiga-ui/core/utils';
|
|
21
|
-
import {
|
|
22
|
+
import { tuiProvide, tuiCreateOptions, tuiDirectiveBinding } from '@taiga-ui/cdk/utils/di';
|
|
23
|
+
import { isPlatformBrowser, DOCUMENT } from '@angular/common';
|
|
22
24
|
import { __decorate } from 'tslib';
|
|
23
|
-
import {
|
|
24
|
-
import { TUI_IS_TOUCH, TUI_RANGE } from '@taiga-ui/cdk/tokens';
|
|
25
|
+
import { TUI_IS_TOUCH } from '@taiga-ui/cdk/tokens';
|
|
25
26
|
import { shouldCall } from '@taiga-ui/event-plugins';
|
|
26
27
|
import * as i1$1 from '@taiga-ui/cdk/directives/obscured';
|
|
27
28
|
import { TuiObscured } from '@taiga-ui/cdk/directives/obscured';
|
|
28
|
-
import {
|
|
29
|
+
import { tuiIsFocusable, tuiGetClosestFocusable, tuiIsFocusedIn, tuiGetFocused } from '@taiga-ui/cdk/utils/focus';
|
|
29
30
|
import { tuiIsEditingKey, tuiOverrideOptions as tuiOverrideOptions$1 } from '@taiga-ui/core/utils/miscellaneous';
|
|
30
31
|
|
|
31
32
|
class TuiDropdownDriver extends BehaviorSubject {
|
|
@@ -48,10 +49,7 @@ class TuiDropdownDriverDirective extends TuiDriverDirective {
|
|
|
48
49
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiDropdownDriverDirective, isStandalone: true, usesInheritance: true, ngImport: i0 }); }
|
|
49
50
|
}
|
|
50
51
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownDriverDirective, decorators: [{
|
|
51
|
-
type: Directive
|
|
52
|
-
args: [{
|
|
53
|
-
standalone: true,
|
|
54
|
-
}]
|
|
52
|
+
type: Directive
|
|
55
53
|
}] });
|
|
56
54
|
|
|
57
55
|
/**
|
|
@@ -62,17 +60,6 @@ const TUI_DROPDOWN_COMPONENT = new InjectionToken(ngDevMode ? 'TUI_DROPDOWN_COMP
|
|
|
62
60
|
});
|
|
63
61
|
const TUI_DROPDOWN_CONTEXT = new InjectionToken(ngDevMode ? 'TUI_DROPDOWN_CONTEXT' : '');
|
|
64
62
|
|
|
65
|
-
class TuiDropdownService extends TuiPortalService {
|
|
66
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
67
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownService, providedIn: 'root' }); }
|
|
68
|
-
}
|
|
69
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownService, decorators: [{
|
|
70
|
-
type: Injectable,
|
|
71
|
-
args: [{
|
|
72
|
-
providedIn: 'root',
|
|
73
|
-
}]
|
|
74
|
-
}] });
|
|
75
|
-
|
|
76
63
|
/** Default values for dropdown options */
|
|
77
64
|
const TUI_DROPDOWN_DEFAULT_OPTIONS = {
|
|
78
65
|
align: 'left',
|
|
@@ -114,7 +101,6 @@ class TuiDropdownOptionsDirective {
|
|
|
114
101
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownOptionsDirective, decorators: [{
|
|
115
102
|
type: Directive,
|
|
116
103
|
args: [{
|
|
117
|
-
standalone: true,
|
|
118
104
|
selector: '[tuiDropdownAlign], [tuiDropdownAppearance], [tuiDropdownDirection], [tuiDropdownLimitWidth], [tuiDropdownMinHeight], [tuiDropdownMaxHeight], [tuiDropdownOffset]',
|
|
119
105
|
providers: [tuiProvide(TUI_DROPDOWN_OPTIONS, TuiDropdownOptionsDirective)],
|
|
120
106
|
}]
|
|
@@ -147,18 +133,16 @@ class TuiDropdownPosition extends TuiPositionAccessor {
|
|
|
147
133
|
this.el = tuiInjectElement();
|
|
148
134
|
this.options = inject(TUI_DROPDOWN_OPTIONS);
|
|
149
135
|
this.viewport = inject(TUI_VIEWPORT);
|
|
150
|
-
this.
|
|
136
|
+
this.direction = new Subject();
|
|
151
137
|
this.type = 'dropdown';
|
|
152
|
-
this.accessor = tuiFallbackAccessor('dropdown')(inject(TuiRectAccessor
|
|
153
|
-
|
|
154
|
-
emitDirection(direction) {
|
|
155
|
-
this.directionChange.emit(direction);
|
|
138
|
+
this.accessor = tuiFallbackAccessor('dropdown')(inject(TuiRectAccessor, { optional: true }), { getClientRect: () => this.el.getBoundingClientRect() });
|
|
139
|
+
this.tuiDropdownDirectionChange = outputFromObservable(this.direction.pipe(distinctUntilChanged()));
|
|
156
140
|
}
|
|
157
141
|
getPosition({ width, height }) {
|
|
158
142
|
if (!width && !height) {
|
|
159
143
|
this.previous = undefined;
|
|
160
144
|
}
|
|
161
|
-
const hostRect = this.accessor
|
|
145
|
+
const hostRect = this.accessor.getClientRect();
|
|
162
146
|
const viewportRect = this.viewport.getClientRect();
|
|
163
147
|
const { minHeight, direction, offset, limitWidth } = this.options;
|
|
164
148
|
const align = this.getAlign(this.options.align);
|
|
@@ -188,11 +172,11 @@ class TuiDropdownPosition extends TuiPositionAccessor {
|
|
|
188
172
|
const better = available.top > available.bottom ? 'top' : 'bottom';
|
|
189
173
|
if ((available[previous] > minHeight && direction) ||
|
|
190
174
|
available[previous] > height) {
|
|
191
|
-
this.
|
|
175
|
+
this.direction.next(previous);
|
|
192
176
|
return [position[previous], position[align]];
|
|
193
177
|
}
|
|
194
178
|
this.previous = better;
|
|
195
|
-
this.
|
|
179
|
+
this.direction.next(better);
|
|
196
180
|
return [position[better], position[align]];
|
|
197
181
|
}
|
|
198
182
|
getAlign(align) {
|
|
@@ -203,27 +187,17 @@ class TuiDropdownPosition extends TuiPositionAccessor {
|
|
|
203
187
|
return rtl && align === 'right' ? 'left' : align;
|
|
204
188
|
}
|
|
205
189
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownPosition, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
206
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiDropdownPosition, isStandalone: true, outputs: {
|
|
190
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiDropdownPosition, isStandalone: true, outputs: { tuiDropdownDirectionChange: "tuiDropdownDirectionChange" }, usesInheritance: true, ngImport: i0 }); }
|
|
207
191
|
}
|
|
208
|
-
__decorate([
|
|
209
|
-
tuiPure
|
|
210
|
-
], TuiDropdownPosition.prototype, "emitDirection", null);
|
|
211
192
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownPosition, decorators: [{
|
|
212
|
-
type: Directive
|
|
213
|
-
|
|
214
|
-
standalone: true,
|
|
215
|
-
}]
|
|
216
|
-
}], propDecorators: { directionChange: [{
|
|
217
|
-
type: Output,
|
|
218
|
-
args: ['tuiDropdownDirectionChange']
|
|
219
|
-
}], emitDirection: [] } });
|
|
193
|
+
type: Directive
|
|
194
|
+
}] });
|
|
220
195
|
|
|
221
196
|
class TuiDropdownDirective {
|
|
222
197
|
constructor() {
|
|
223
198
|
this.refresh$ = new Subject();
|
|
224
|
-
this.service = inject(
|
|
199
|
+
this.service = inject(TuiPopupService);
|
|
225
200
|
this.cdr = inject(ChangeDetectorRef);
|
|
226
|
-
// TODO: think of a better solution later
|
|
227
201
|
this.drivers = coerceArray(inject(TuiDropdownDriver, { self: true, optional: true }));
|
|
228
202
|
this.sub = this.refresh$
|
|
229
203
|
.pipe(throttleTime(0, tuiZonefreeScheduler()), takeUntilDestroyed())
|
|
@@ -231,33 +205,25 @@ class TuiDropdownDirective {
|
|
|
231
205
|
this.ref()?.changeDetectorRef.detectChanges();
|
|
232
206
|
this.ref()?.changeDetectorRef.markForCheck();
|
|
233
207
|
});
|
|
208
|
+
this.autoClose = effect(() => {
|
|
209
|
+
if (!this.content()) {
|
|
210
|
+
this.toggle(false);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
this.ref = signal(null);
|
|
234
214
|
this.el = tuiInjectElement();
|
|
235
215
|
this.type = 'dropdown';
|
|
236
216
|
this.component = new PolymorpheusComponent(inject(TUI_DROPDOWN_COMPONENT), inject(INJECTOR));
|
|
237
|
-
this.
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
this._content.set(content instanceof TemplateRef
|
|
244
|
-
? new PolymorpheusTemplate(content, this.cdr)
|
|
245
|
-
: content);
|
|
246
|
-
if (!this._content()) {
|
|
247
|
-
this.toggle(false);
|
|
248
|
-
}
|
|
217
|
+
this.tuiDropdown = input();
|
|
218
|
+
this.content = computed((content = this.tuiDropdown()) => {
|
|
219
|
+
return content instanceof TemplateRef
|
|
220
|
+
? new PolymorpheusTemplate(content, this.cdr)
|
|
221
|
+
: content;
|
|
222
|
+
});
|
|
249
223
|
}
|
|
250
224
|
get position() {
|
|
251
225
|
return tuiCheckFixedPosition(this.el) ? 'fixed' : 'absolute';
|
|
252
226
|
}
|
|
253
|
-
// TODO(v5): delete
|
|
254
|
-
get content() {
|
|
255
|
-
return this._content();
|
|
256
|
-
}
|
|
257
|
-
// TODO(v5): delete
|
|
258
|
-
set content(x) {
|
|
259
|
-
this._content.set(x);
|
|
260
|
-
}
|
|
261
227
|
ngAfterViewChecked() {
|
|
262
228
|
this.refresh$.next();
|
|
263
229
|
}
|
|
@@ -269,32 +235,25 @@ class TuiDropdownDirective {
|
|
|
269
235
|
}
|
|
270
236
|
toggle(show) {
|
|
271
237
|
const ref = this.ref();
|
|
272
|
-
if (show && this.
|
|
238
|
+
if (show && this.content() && !ref) {
|
|
273
239
|
this.ref.set(this.service.add(this.component));
|
|
274
240
|
}
|
|
275
241
|
else if (!show && ref) {
|
|
276
242
|
this.ref.set(null);
|
|
277
|
-
|
|
243
|
+
ref.destroy();
|
|
278
244
|
}
|
|
279
|
-
this.drivers.forEach((driver) => driver?.next(show));
|
|
280
245
|
// TODO: Remove in v5, only needed in Angular 16
|
|
281
246
|
this.cdr.markForCheck();
|
|
247
|
+
this.drivers.forEach((driver) => driver?.next(show));
|
|
282
248
|
}
|
|
283
249
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
284
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
285
|
-
tuiAsRectAccessor(TuiDropdownDirective),
|
|
286
|
-
tuiAsVehicle(TuiDropdownDirective),
|
|
287
|
-
], exportAs: ["tuiDropdown"], hostDirectives: [{ directive: TuiDropdownDriverDirective }, { directive: TuiDropdownPosition, outputs: ["tuiDropdownDirectionChange", "tuiDropdownDirectionChange"] }], ngImport: i0 }); }
|
|
250
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.15", type: TuiDropdownDirective, isStandalone: true, selector: "[tuiDropdown]:not(ng-container):not(ng-template)", inputs: { tuiDropdown: { classPropertyName: "tuiDropdown", publicName: "tuiDropdown", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.tui-dropdown-open": "ref()" } }, providers: [tuiAsVehicle(TuiDropdownDirective)], exportAs: ["tuiDropdown"], hostDirectives: [{ directive: TuiDropdownDriverDirective }, { directive: TuiDropdownPosition, outputs: ["tuiDropdownDirectionChange", "tuiDropdownDirectionChange"] }], ngImport: i0 }); }
|
|
288
251
|
}
|
|
289
252
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownDirective, decorators: [{
|
|
290
253
|
type: Directive,
|
|
291
254
|
args: [{
|
|
292
|
-
standalone: true,
|
|
293
255
|
selector: '[tuiDropdown]:not(ng-container):not(ng-template)',
|
|
294
|
-
providers: [
|
|
295
|
-
tuiAsRectAccessor(TuiDropdownDirective),
|
|
296
|
-
tuiAsVehicle(TuiDropdownDirective),
|
|
297
|
-
],
|
|
256
|
+
providers: [tuiAsVehicle(TuiDropdownDirective)],
|
|
298
257
|
exportAs: 'tuiDropdown',
|
|
299
258
|
hostDirectives: [
|
|
300
259
|
TuiDropdownDriverDirective,
|
|
@@ -307,9 +266,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
|
|
|
307
266
|
'[class.tui-dropdown-open]': 'ref()',
|
|
308
267
|
},
|
|
309
268
|
}]
|
|
310
|
-
}]
|
|
311
|
-
type: Input
|
|
312
|
-
}] } });
|
|
269
|
+
}] });
|
|
313
270
|
|
|
314
271
|
/**
|
|
315
272
|
* @description:
|
|
@@ -366,21 +323,43 @@ class TuiDropdownComponent {
|
|
|
366
323
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: TuiDropdownComponent, isStandalone: true, selector: "tui-dropdown", host: { properties: { "attr.data-appearance": "options.appearance", "attr.tuiTheme": "theme()" } }, providers: [
|
|
367
324
|
TuiPositionService,
|
|
368
325
|
tuiPositionAccessorFor('dropdown', TuiDropdownPosition),
|
|
369
|
-
tuiRectAccessorFor('dropdown', TuiDropdownDirective),
|
|
370
|
-
], hostDirectives: [{ directive: i1.TuiActiveZone }, { directive: i2.TuiAnimated }], ngImport: i0, template: "<tui-scrollbar class=\"t-scroll\">\n <div\n *polymorpheusOutlet=\"directive.
|
|
326
|
+
tuiRectAccessorFor('dropdown', forwardRef(() => TuiDropdownDirective)),
|
|
327
|
+
], hostDirectives: [{ directive: i1.TuiActiveZone }, { directive: i2.TuiAnimated }], ngImport: i0, template: "<tui-scrollbar class=\"t-scroll\">\n <div\n *polymorpheusOutlet=\"directive.content() as text; context: {$implicit: close}\"\n class=\"t-primitive\"\n >\n {{ text }}\n </div>\n</tui-scrollbar>\n", styles: [":host{position:absolute;display:flex;box-shadow:var(--tui-shadow-medium);color:var(--tui-text-primary);background:var(--tui-background-elevation-3);border-radius:var(--tui-radius-m);overflow:hidden;border:1px solid var(--tui-border-normal);box-sizing:border-box;isolation:isolate;pointer-events:auto;--tui-from: translateY(-1rem)}:host.tui-enter,:host.tui-leave{animation-name:tuiFade,tuiSlide}:host:not([style*=top]){visibility:hidden}.t-scroll{flex-grow:1;max-inline-size:100%;inline-size:max-content;overscroll-behavior:none}.t-primitive{padding:1rem}\n"], dependencies: [{ kind: "directive", type: PolymorpheusOutlet, selector: "[polymorpheusOutlet]", inputs: ["polymorpheusOutlet", "polymorpheusOutletContext"] }, { kind: "component", type: TuiScrollbar, selector: "tui-scrollbar", inputs: ["hidden"] }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
|
|
371
328
|
}
|
|
372
329
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownComponent, decorators: [{
|
|
373
330
|
type: Component,
|
|
374
331
|
args: [{ selector: 'tui-dropdown', imports: [PolymorpheusOutlet, TuiScrollbar], changeDetection: ChangeDetectionStrategy.Default, providers: [
|
|
375
332
|
TuiPositionService,
|
|
376
333
|
tuiPositionAccessorFor('dropdown', TuiDropdownPosition),
|
|
377
|
-
tuiRectAccessorFor('dropdown', TuiDropdownDirective),
|
|
334
|
+
tuiRectAccessorFor('dropdown', forwardRef(() => TuiDropdownDirective)),
|
|
378
335
|
], hostDirectives: [TuiActiveZone, TuiAnimated], host: {
|
|
379
336
|
'[attr.data-appearance]': 'options.appearance',
|
|
380
337
|
'[attr.tuiTheme]': 'theme()',
|
|
381
|
-
}, template: "<tui-scrollbar class=\"t-scroll\">\n <div\n *polymorpheusOutlet=\"directive.
|
|
338
|
+
}, template: "<tui-scrollbar class=\"t-scroll\">\n <div\n *polymorpheusOutlet=\"directive.content() as text; context: {$implicit: close}\"\n class=\"t-primitive\"\n >\n {{ text }}\n </div>\n</tui-scrollbar>\n", styles: [":host{position:absolute;display:flex;box-shadow:var(--tui-shadow-medium);color:var(--tui-text-primary);background:var(--tui-background-elevation-3);border-radius:var(--tui-radius-m);overflow:hidden;border:1px solid var(--tui-border-normal);box-sizing:border-box;isolation:isolate;pointer-events:auto;--tui-from: translateY(-1rem)}:host.tui-enter,:host.tui-leave{animation-name:tuiFade,tuiSlide}:host:not([style*=top]){visibility:hidden}.t-scroll{flex-grow:1;max-inline-size:100%;inline-size:max-content;overscroll-behavior:none}.t-primitive{padding:1rem}\n"] }]
|
|
382
339
|
}] });
|
|
383
340
|
|
|
341
|
+
class TuiDropdownContent {
|
|
342
|
+
constructor() {
|
|
343
|
+
this.directive = inject(TuiDropdownDirective);
|
|
344
|
+
tuiSetSignal(this.directive.tuiDropdown, inject(TemplateRef));
|
|
345
|
+
if (isPlatformBrowser(inject(PLATFORM_ID)) &&
|
|
346
|
+
this.directive.el.matches(':focus-within')) {
|
|
347
|
+
this.directive.toggle(true);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
ngOnDestroy() {
|
|
351
|
+
tuiSetSignal(this.directive.tuiDropdown, null);
|
|
352
|
+
}
|
|
353
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownContent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
354
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiDropdownContent, isStandalone: true, selector: "ng-template[tuiDropdown]", ngImport: i0 }); }
|
|
355
|
+
}
|
|
356
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownContent, decorators: [{
|
|
357
|
+
type: Directive,
|
|
358
|
+
args: [{
|
|
359
|
+
selector: 'ng-template[tuiDropdown]',
|
|
360
|
+
}]
|
|
361
|
+
}], ctorParameters: () => [] });
|
|
362
|
+
|
|
384
363
|
function activeZoneFilter(event) {
|
|
385
364
|
return (!event ||
|
|
386
365
|
(this.driver.value && !this.activeZone.contains(tuiGetActualTarget(event))));
|
|
@@ -424,7 +403,6 @@ __decorate([
|
|
|
424
403
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownContext, decorators: [{
|
|
425
404
|
type: Directive,
|
|
426
405
|
args: [{
|
|
427
|
-
standalone: true,
|
|
428
406
|
selector: '[tuiDropdownContext]',
|
|
429
407
|
providers: [
|
|
430
408
|
TuiActiveZone,
|
|
@@ -450,48 +428,40 @@ const TUI_DROPDOWN_HOVER_DEFAULT_OPTIONS = {
|
|
|
450
428
|
/**
|
|
451
429
|
* Default parameters for dropdown hover directive
|
|
452
430
|
*/
|
|
453
|
-
const TUI_DROPDOWN_HOVER_OPTIONS =
|
|
454
|
-
factory: () => TUI_DROPDOWN_HOVER_DEFAULT_OPTIONS,
|
|
455
|
-
});
|
|
456
|
-
function tuiDropdownHoverOptionsProvider(options) {
|
|
457
|
-
return tuiProvideOptions(TUI_DROPDOWN_HOVER_OPTIONS, options, TUI_DROPDOWN_HOVER_DEFAULT_OPTIONS);
|
|
458
|
-
}
|
|
431
|
+
const [TUI_DROPDOWN_HOVER_OPTIONS, tuiDropdownHoverOptionsProvider] = tuiCreateOptions(TUI_DROPDOWN_HOVER_DEFAULT_OPTIONS);
|
|
459
432
|
|
|
460
433
|
function shouldClose(event) {
|
|
461
434
|
return (
|
|
462
435
|
// @ts-ignore
|
|
463
436
|
typeof CloseWatcher === 'undefined' &&
|
|
464
|
-
// ?. for
|
|
437
|
+
// ?. for autofill events
|
|
465
438
|
event.key?.toLowerCase() === 'escape' &&
|
|
466
|
-
this.
|
|
467
|
-
|
|
439
|
+
this.enabled() &&
|
|
440
|
+
this.open() &&
|
|
468
441
|
!this['dropdown']()?.nextElementSibling);
|
|
469
442
|
}
|
|
470
443
|
class TuiDropdownOpen {
|
|
471
444
|
constructor() {
|
|
445
|
+
this.dropdownHost = contentChild('tuiDropdownHost', {
|
|
446
|
+
descendants: true,
|
|
447
|
+
read: ElementRef,
|
|
448
|
+
});
|
|
472
449
|
this.directive = inject(TuiDropdownDirective);
|
|
473
450
|
this.el = tuiInjectElement();
|
|
474
451
|
this.obscured = inject(TuiObscured);
|
|
475
452
|
this.activeZone = inject(TuiActiveZone);
|
|
476
|
-
this.dropdown = computed(() => this.directive.ref()?.location.nativeElement);
|
|
477
|
-
this.tuiDropdownEnabled = true;
|
|
478
|
-
this.tuiDropdownOpen = false;
|
|
479
|
-
this.tuiDropdownOpenChange = new EventEmitter();
|
|
480
|
-
// TODO: make it private when all legacy controls will be deleted from @taiga-ui/legacy (5.0)
|
|
481
453
|
this.driver = inject(TuiDropdownDriver);
|
|
482
|
-
this.
|
|
483
|
-
|
|
454
|
+
this.dropdown = computed(() => this.directive.ref()?.location.nativeElement);
|
|
455
|
+
this.enabled = input(true, { alias: 'tuiDropdownEnabled' });
|
|
456
|
+
this.open = model(false, { alias: 'tuiDropdownOpen' });
|
|
457
|
+
this.driveEffect = effect(() => this.drive(this.open()));
|
|
458
|
+
this.syncSub = this.driver
|
|
459
|
+
.pipe(filter((open) => open !== this.open()), takeUntilDestroyed())
|
|
460
|
+
.subscribe((open) => this.update(open));
|
|
461
|
+
this.closeSub = this.driver
|
|
462
|
+
.pipe(tuiIfMap(() => merge(tuiCloseWatcher(), this.obscured.tuiObscured$.pipe(filter(Boolean)), this.activeZone.tuiActiveZoneChange.pipe(filter((a) => !a)), fromEvent(this.el, 'focusin').pipe(filter((event) => !this.host.contains(tuiGetActualTarget(event)) ||
|
|
484
463
|
!this.directive.ref())))), tuiZonefull(), tuiWatch(), takeUntilDestroyed())
|
|
485
464
|
.subscribe(() => this.toggle(false));
|
|
486
|
-
this.sync = this.driver.pipe(takeUntilDestroyed()).subscribe((open) => {
|
|
487
|
-
if (open !== this.tuiDropdownOpen) {
|
|
488
|
-
this.update(open);
|
|
489
|
-
}
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
ngOnChanges() {
|
|
493
|
-
this.drive(!!this.tuiDropdownOpen);
|
|
494
|
-
this.tuiDropdownOpenChange.emit(!!this.tuiDropdownOpen);
|
|
495
465
|
}
|
|
496
466
|
toggle(open) {
|
|
497
467
|
if (this.focused && !open) {
|
|
@@ -505,14 +475,14 @@ class TuiDropdownOpen {
|
|
|
505
475
|
}
|
|
506
476
|
onClick(target) {
|
|
507
477
|
if (!this.editable && this.host.contains(target)) {
|
|
508
|
-
this.update(!this.
|
|
478
|
+
this.update(!this.open());
|
|
509
479
|
}
|
|
510
480
|
}
|
|
511
481
|
onArrow(event, up) {
|
|
512
482
|
if (!tuiIsElement(event.target) ||
|
|
513
483
|
!this.host.contains(event.target) ||
|
|
514
|
-
!this.
|
|
515
|
-
!this.directive.
|
|
484
|
+
!this.enabled() ||
|
|
485
|
+
!this.directive.content()) {
|
|
516
486
|
return;
|
|
517
487
|
}
|
|
518
488
|
event.preventDefault();
|
|
@@ -530,28 +500,27 @@ class TuiDropdownOpen {
|
|
|
530
500
|
}
|
|
531
501
|
}
|
|
532
502
|
get host() {
|
|
533
|
-
const initial = this.dropdownHost?.nativeElement || this.el;
|
|
534
|
-
const focusable =
|
|
503
|
+
const initial = this.dropdownHost()?.nativeElement || this.el;
|
|
504
|
+
const focusable = tuiIsFocusable(initial)
|
|
535
505
|
? initial
|
|
536
506
|
: tuiGetClosestFocusable({ initial, root: this.el });
|
|
537
|
-
return this.dropdownHost?.nativeElement || focusable || this.el;
|
|
507
|
+
return this.dropdownHost()?.nativeElement || focusable || this.el;
|
|
538
508
|
}
|
|
539
509
|
get editable() {
|
|
540
510
|
return tuiIsElementEditable(this.host);
|
|
541
511
|
}
|
|
542
512
|
get focused() {
|
|
543
|
-
return
|
|
513
|
+
return tuiIsFocusedIn(this.host) || tuiIsFocusedIn(this.dropdown());
|
|
544
514
|
}
|
|
545
515
|
update(open) {
|
|
546
|
-
if (open && !this.
|
|
516
|
+
if (open && !this.enabled()) {
|
|
547
517
|
return this.drive();
|
|
548
518
|
}
|
|
549
|
-
this.
|
|
550
|
-
this.tuiDropdownOpenChange.emit(open);
|
|
519
|
+
this.open.set(open);
|
|
551
520
|
this.drive();
|
|
552
521
|
}
|
|
553
|
-
drive(open =
|
|
554
|
-
this.obscured.tuiObscuredEnabled
|
|
522
|
+
drive(open = this.open() && this.enabled()) {
|
|
523
|
+
tuiSetSignal(this.obscured.tuiObscuredEnabled, open);
|
|
555
524
|
this.driver.next(open);
|
|
556
525
|
}
|
|
557
526
|
focusDropdown(previous) {
|
|
@@ -568,7 +537,7 @@ class TuiDropdownOpen {
|
|
|
568
537
|
focusable?.focus();
|
|
569
538
|
}
|
|
570
539
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownOpen, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
571
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
540
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.15", type: TuiDropdownOpen, isStandalone: true, selector: "[tuiDropdown][tuiDropdownAuto],[tuiDropdown][tuiDropdownOpen],[tuiDropdown][tuiDropdownOpenChange]", inputs: { enabled: { classPropertyName: "enabled", publicName: "tuiDropdownEnabled", isSignal: true, isRequired: false, transformFunction: null }, open: { classPropertyName: "open", publicName: "tuiDropdownOpen", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "tuiDropdownOpenChange" }, host: { listeners: { "click": "onClick($event.target)", "keydown.arrowDown": "onArrow($event, false)", "keydown.arrowUp": "onArrow($event, true)", "document:keydown.zoneless.capture": "onEsc($event)", "document:keydown.zoneless": "onKeydown($event)", "tuiActiveZoneChange": "0" } }, providers: [TuiDropdownDriver, tuiAsDriver(TuiDropdownDriver)], queries: [{ propertyName: "dropdownHost", first: true, predicate: ["tuiDropdownHost"], descendants: true, read: ElementRef, isSignal: true }], hostDirectives: [{ directive: i1$1.TuiObscured }, { directive: i1.TuiActiveZone, inputs: ["tuiActiveZoneParent", "tuiActiveZoneParent"], outputs: ["tuiActiveZoneChange", "tuiActiveZoneChange"] }], ngImport: i0 }); }
|
|
572
541
|
}
|
|
573
542
|
__decorate([
|
|
574
543
|
shouldCall(shouldClose)
|
|
@@ -576,8 +545,7 @@ __decorate([
|
|
|
576
545
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownOpen, decorators: [{
|
|
577
546
|
type: Directive,
|
|
578
547
|
args: [{
|
|
579
|
-
|
|
580
|
-
selector: '[tuiDropdown][tuiDropdownOpen],[tuiDropdown][tuiDropdownOpenChange]',
|
|
548
|
+
selector: '[tuiDropdown][tuiDropdownAuto],[tuiDropdown][tuiDropdownOpen],[tuiDropdown][tuiDropdownOpenChange]',
|
|
581
549
|
providers: [TuiDropdownDriver, tuiAsDriver(TuiDropdownDriver)],
|
|
582
550
|
hostDirectives: [
|
|
583
551
|
TuiObscured,
|
|
@@ -597,37 +565,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
|
|
|
597
565
|
'(tuiActiveZoneChange)': '0',
|
|
598
566
|
},
|
|
599
567
|
}]
|
|
600
|
-
}], propDecorators: {
|
|
601
|
-
type: ContentChild,
|
|
602
|
-
args: ['tuiDropdownHost', { descendants: true, read: ElementRef }]
|
|
603
|
-
}], tuiDropdownEnabled: [{
|
|
604
|
-
type: Input
|
|
605
|
-
}], tuiDropdownOpen: [{
|
|
606
|
-
type: Input
|
|
607
|
-
}], tuiDropdownOpenChange: [{
|
|
608
|
-
type: Output
|
|
609
|
-
}], onEsc: [] } });
|
|
568
|
+
}], propDecorators: { onEsc: [] } });
|
|
610
569
|
|
|
611
570
|
class TuiDropdownHover extends TuiDriver {
|
|
612
571
|
constructor() {
|
|
613
572
|
super((subscriber) => this.stream$.subscribe(subscriber));
|
|
573
|
+
this.dropdownHost = contentChild('tuiDropdownHost', {
|
|
574
|
+
descendants: true,
|
|
575
|
+
read: ElementRef,
|
|
576
|
+
});
|
|
577
|
+
this.hovered = false;
|
|
614
578
|
this.el = tuiInjectElement();
|
|
615
579
|
this.doc = inject(DOCUMENT);
|
|
616
580
|
this.options = inject(TUI_DROPDOWN_HOVER_OPTIONS);
|
|
617
581
|
this.activeZone = inject(TuiActiveZone);
|
|
618
582
|
this.open = inject(TuiDropdownOpen, { optional: true });
|
|
583
|
+
this.stream$ = merge(
|
|
619
584
|
/**
|
|
620
585
|
* Dropdown can be removed not only via click/touch –
|
|
621
586
|
* swipe on mobile devices removes dropdown sheet without triggering new mouseover / mouseout events.
|
|
622
587
|
*/
|
|
623
|
-
|
|
624
|
-
this.stream$ = merge(this.dropdownExternalRemoval$.pipe(switchMap(() => tuiTypedFromEvent(this.doc, 'pointerdown').pipe(map(tuiGetActualTarget), delay(this.hideDelay), startWith(null), takeUntil(fromEvent(this.doc, 'mouseover'))))), tuiTypedFromEvent(this.doc, 'mouseover').pipe(map(tuiGetActualTarget)), tuiTypedFromEvent(this.doc, 'mouseout').pipe(map((e) => e.relatedTarget))).pipe(map((element) => tuiIsElement(element) && this.isHovered(element)), distinctUntilChanged(), switchMap((v) => of(v).pipe(delay(v ? this.showDelay : this.hideDelay))), tuiZoneOptimized(), tap((hovered) => {
|
|
588
|
+
toObservable(inject(TuiDropdownDirective).ref).pipe(filter((x) => !x && this.hovered), switchMap(() => tuiTypedFromEvent(this.doc, 'pointerdown').pipe(map(tuiGetActualTarget), delay(this.tuiDropdownHideDelay()), startWith(null), takeUntil(fromEvent(this.doc, 'mouseover'))))), tuiTypedFromEvent(this.doc, 'mouseover').pipe(map(tuiGetActualTarget)), tuiTypedFromEvent(this.doc, 'mouseout').pipe(map((e) => e.relatedTarget))).pipe(map((element) => tuiIsElement(element) && this.isHovered(element)), distinctUntilChanged(), switchMap((v) => of(v).pipe(delay(v ? this.tuiDropdownShowDelay() : this.tuiDropdownHideDelay()))), tuiZoneOptimized(), tap((hovered) => {
|
|
625
589
|
this.hovered = hovered;
|
|
626
590
|
this.open?.toggle(hovered);
|
|
627
591
|
}), share());
|
|
628
|
-
this.
|
|
629
|
-
this.
|
|
630
|
-
this.hovered = false;
|
|
592
|
+
this.tuiDropdownShowDelay = input(this.options.showDelay);
|
|
593
|
+
this.tuiDropdownHideDelay = input(this.options.hideDelay);
|
|
631
594
|
this.type = 'dropdown';
|
|
632
595
|
}
|
|
633
596
|
onClick(event) {
|
|
@@ -636,115 +599,43 @@ class TuiDropdownHover extends TuiDriver {
|
|
|
636
599
|
}
|
|
637
600
|
}
|
|
638
601
|
isHovered(element) {
|
|
639
|
-
const host = this.dropdownHost?.nativeElement || this.el;
|
|
602
|
+
const host = this.dropdownHost()?.nativeElement || this.el;
|
|
640
603
|
const hovered = host.contains(element);
|
|
641
604
|
const child = !this.el.contains(element) && this.activeZone.contains(element);
|
|
642
605
|
return hovered || child;
|
|
643
606
|
}
|
|
644
607
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownHover, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
645
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
608
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.15", type: TuiDropdownHover, isStandalone: true, selector: "[tuiDropdownHover]", inputs: { tuiDropdownShowDelay: { classPropertyName: "tuiDropdownShowDelay", publicName: "tuiDropdownShowDelay", isSignal: true, isRequired: false, transformFunction: null }, tuiDropdownHideDelay: { classPropertyName: "tuiDropdownHideDelay", publicName: "tuiDropdownHideDelay", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click.capture": "onClick($event)" } }, providers: [TuiActiveZone, tuiAsDriver(TuiDropdownHover)], queries: [{ propertyName: "dropdownHost", first: true, predicate: ["tuiDropdownHost"], descendants: true, read: ElementRef, isSignal: true }], usesInheritance: true, ngImport: i0 }); }
|
|
646
609
|
}
|
|
647
610
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownHover, decorators: [{
|
|
648
611
|
type: Directive,
|
|
649
612
|
args: [{
|
|
650
|
-
standalone: true,
|
|
651
613
|
selector: '[tuiDropdownHover]',
|
|
652
614
|
providers: [TuiActiveZone, tuiAsDriver(TuiDropdownHover)],
|
|
653
615
|
host: {
|
|
654
616
|
'(click.capture)': 'onClick($event)',
|
|
655
617
|
},
|
|
656
618
|
}]
|
|
657
|
-
}], ctorParameters: () => []
|
|
658
|
-
type: ContentChild,
|
|
659
|
-
args: ['tuiDropdownHost', { descendants: true, read: ElementRef }]
|
|
660
|
-
}], showDelay: [{
|
|
661
|
-
type: Input,
|
|
662
|
-
args: ['tuiDropdownShowDelay']
|
|
663
|
-
}], hideDelay: [{
|
|
664
|
-
type: Input,
|
|
665
|
-
args: ['tuiDropdownHideDelay']
|
|
666
|
-
}] } });
|
|
619
|
+
}], ctorParameters: () => [] });
|
|
667
620
|
|
|
668
621
|
class TuiDropdownManual {
|
|
669
622
|
constructor() {
|
|
670
623
|
this.driver = inject(TuiDropdownDriver);
|
|
671
|
-
this.tuiDropdownManual = false;
|
|
624
|
+
this.tuiDropdownManual = input(false);
|
|
672
625
|
}
|
|
673
626
|
ngOnChanges() {
|
|
674
|
-
this.driver.next(!!this.tuiDropdownManual);
|
|
627
|
+
this.driver.next(!!this.tuiDropdownManual());
|
|
675
628
|
}
|
|
676
629
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownManual, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
677
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
630
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.15", type: TuiDropdownManual, isStandalone: true, selector: "[tuiDropdownManual]", inputs: { tuiDropdownManual: { classPropertyName: "tuiDropdownManual", publicName: "tuiDropdownManual", isSignal: true, isRequired: false, transformFunction: null } }, providers: [TuiDropdownDriver, tuiAsDriver(TuiDropdownDriver)], usesOnChanges: true, ngImport: i0 }); }
|
|
678
631
|
}
|
|
679
632
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownManual, decorators: [{
|
|
680
633
|
type: Directive,
|
|
681
634
|
args: [{
|
|
682
|
-
standalone: true,
|
|
683
635
|
selector: '[tuiDropdownManual]',
|
|
684
636
|
providers: [TuiDropdownDriver, tuiAsDriver(TuiDropdownDriver)],
|
|
685
637
|
}]
|
|
686
|
-
}]
|
|
687
|
-
type: Input
|
|
688
|
-
}] } });
|
|
689
|
-
|
|
690
|
-
/**
|
|
691
|
-
* @deprecated TODO: remove in v.5 when legacy controls are dropped
|
|
692
|
-
*/
|
|
693
|
-
class TuiDropdownOpenLegacy {
|
|
694
|
-
constructor() {
|
|
695
|
-
this.openStateSub = new Subject();
|
|
696
|
-
this.tuiDropdownOpenChange = this.openStateSub.pipe(distinctUntilChanged());
|
|
697
|
-
}
|
|
698
|
-
set tuiDropdownOpen(open) {
|
|
699
|
-
this.emitOpenChange(open);
|
|
700
|
-
}
|
|
701
|
-
emitOpenChange(open) {
|
|
702
|
-
this.openStateSub.next(open);
|
|
703
|
-
}
|
|
704
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownOpenLegacy, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
705
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiDropdownOpenLegacy, isStandalone: true, selector: "[tuiDropdownOpen]:not([tuiDropdown]),[tuiDropdownOpenChange]:not([tuiDropdown])", inputs: { tuiDropdownOpen: "tuiDropdownOpen" }, outputs: { tuiDropdownOpenChange: "tuiDropdownOpenChange" }, ngImport: i0 }); }
|
|
706
|
-
}
|
|
707
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownOpenLegacy, decorators: [{
|
|
708
|
-
type: Directive,
|
|
709
|
-
args: [{
|
|
710
|
-
standalone: true,
|
|
711
|
-
selector: '[tuiDropdownOpen]:not([tuiDropdown]),[tuiDropdownOpenChange]:not([tuiDropdown])',
|
|
712
|
-
}]
|
|
713
|
-
}], propDecorators: { tuiDropdownOpenChange: [{
|
|
714
|
-
type: Output
|
|
715
|
-
}], tuiDropdownOpen: [{
|
|
716
|
-
type: Input
|
|
717
|
-
}] } });
|
|
718
|
-
|
|
719
|
-
/**
|
|
720
|
-
* @deprecated use {@link TuiPopup} directive instead
|
|
721
|
-
*/
|
|
722
|
-
class TuiDropdownPortal {
|
|
723
|
-
constructor() {
|
|
724
|
-
this.template = inject(TemplateRef);
|
|
725
|
-
this.service = inject(TuiDropdownService);
|
|
726
|
-
}
|
|
727
|
-
set tuiDropdown(show) {
|
|
728
|
-
this.viewRef?.destroy();
|
|
729
|
-
if (show) {
|
|
730
|
-
this.viewRef = this.service.addTemplate(this.template);
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
ngOnDestroy() {
|
|
734
|
-
this.viewRef?.destroy();
|
|
735
|
-
}
|
|
736
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownPortal, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
737
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiDropdownPortal, isStandalone: true, selector: "ng-template[tuiDropdown]", inputs: { tuiDropdown: "tuiDropdown" }, ngImport: i0 }); }
|
|
738
|
-
}
|
|
739
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownPortal, decorators: [{
|
|
740
|
-
type: Directive,
|
|
741
|
-
args: [{
|
|
742
|
-
standalone: true,
|
|
743
|
-
selector: 'ng-template[tuiDropdown]',
|
|
744
|
-
}]
|
|
745
|
-
}], propDecorators: { tuiDropdown: [{
|
|
746
|
-
type: Input
|
|
747
|
-
}] } });
|
|
638
|
+
}] });
|
|
748
639
|
|
|
749
640
|
class TuiDropdownPositionSided extends TuiPositionAccessor {
|
|
750
641
|
constructor() {
|
|
@@ -753,12 +644,12 @@ class TuiDropdownPositionSided extends TuiPositionAccessor {
|
|
|
753
644
|
this.viewport = inject(TUI_VIEWPORT);
|
|
754
645
|
this.vertical = inject(TuiDropdownPosition);
|
|
755
646
|
this.previous = this.options.direction || 'bottom';
|
|
756
|
-
this.tuiDropdownSided = '';
|
|
757
|
-
this.tuiDropdownSidedOffset = 4;
|
|
647
|
+
this.tuiDropdownSided = input('');
|
|
648
|
+
this.tuiDropdownSidedOffset = input(4);
|
|
758
649
|
this.type = 'dropdown';
|
|
759
650
|
}
|
|
760
651
|
getPosition(rect) {
|
|
761
|
-
if (this.tuiDropdownSided === false) {
|
|
652
|
+
if (this.tuiDropdownSided() === false) {
|
|
762
653
|
return this.vertical.getPosition(rect);
|
|
763
654
|
}
|
|
764
655
|
const { height, width } = rect;
|
|
@@ -774,38 +665,33 @@ class TuiDropdownPositionSided extends TuiPositionAccessor {
|
|
|
774
665
|
bottom: viewport.bottom - hostRect.top,
|
|
775
666
|
};
|
|
776
667
|
const position = {
|
|
777
|
-
top: hostRect.bottom - height + this.tuiDropdownSidedOffset + 1, // 1 for border
|
|
668
|
+
top: hostRect.bottom - height + this.tuiDropdownSidedOffset() + 1, // 1 for border
|
|
778
669
|
left: hostRect.left - width - offset,
|
|
779
670
|
right: hostRect.right + offset,
|
|
780
|
-
bottom: hostRect.top - this.tuiDropdownSidedOffset - 1, // 1 for border
|
|
671
|
+
bottom: hostRect.top - this.tuiDropdownSidedOffset() - 1, // 1 for border
|
|
781
672
|
};
|
|
782
673
|
const better = available.top > available.bottom ? 'top' : 'bottom';
|
|
783
674
|
const maxLeft = available.left > available.right ? position.left : position.right;
|
|
784
675
|
const left = available[align] > width ? position[align] : maxLeft;
|
|
785
676
|
if ((available[this.previous] > height && direction) ||
|
|
786
677
|
this.previous === better) {
|
|
787
|
-
this.vertical.
|
|
678
|
+
this.vertical.direction.next(this.previous);
|
|
788
679
|
return [position[this.previous], left];
|
|
789
680
|
}
|
|
790
681
|
this.previous = better;
|
|
791
|
-
this.vertical.
|
|
682
|
+
this.vertical.direction.next(better);
|
|
792
683
|
return [position[better], left];
|
|
793
684
|
}
|
|
794
685
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownPositionSided, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
795
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
686
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.15", type: TuiDropdownPositionSided, isStandalone: true, selector: "[tuiDropdownSided]", inputs: { tuiDropdownSided: { classPropertyName: "tuiDropdownSided", publicName: "tuiDropdownSided", isSignal: true, isRequired: false, transformFunction: null }, tuiDropdownSidedOffset: { classPropertyName: "tuiDropdownSidedOffset", publicName: "tuiDropdownSidedOffset", isSignal: true, isRequired: false, transformFunction: null } }, providers: [TuiDropdownPosition, tuiAsPositionAccessor(TuiDropdownPositionSided)], usesInheritance: true, ngImport: i0 }); }
|
|
796
687
|
}
|
|
797
688
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownPositionSided, decorators: [{
|
|
798
689
|
type: Directive,
|
|
799
690
|
args: [{
|
|
800
|
-
standalone: true,
|
|
801
691
|
selector: '[tuiDropdownSided]',
|
|
802
692
|
providers: [TuiDropdownPosition, tuiAsPositionAccessor(TuiDropdownPositionSided)],
|
|
803
693
|
}]
|
|
804
|
-
}]
|
|
805
|
-
type: Input
|
|
806
|
-
}], tuiDropdownSidedOffset: [{
|
|
807
|
-
type: Input
|
|
808
|
-
}] } });
|
|
694
|
+
}] });
|
|
809
695
|
|
|
810
696
|
class TuiDropdownSelection extends TuiDriver {
|
|
811
697
|
constructor() {
|
|
@@ -814,9 +700,9 @@ class TuiDropdownSelection extends TuiDriver {
|
|
|
814
700
|
this.vcr = inject(ViewContainerRef);
|
|
815
701
|
this.dropdown = inject(TuiDropdownDirective);
|
|
816
702
|
this.el = tuiInjectElement();
|
|
817
|
-
this.handler
|
|
703
|
+
this.handler = computed((visible = this.tuiDropdownSelection()) => tuiIsString(visible) ? TUI_TRUE_HANDLER : visible);
|
|
818
704
|
this.stream$ = combineLatest([
|
|
819
|
-
this.handler
|
|
705
|
+
toObservable(this.handler),
|
|
820
706
|
inject(TUI_SELECTION_STREAM).pipe(map(() => this.getRange()), filter((range) => this.isValid(range)), distinctUntilChanged((x, y) => x.startOffset === y.startOffset &&
|
|
821
707
|
x.endOffset === y.endOffset &&
|
|
822
708
|
x.commonAncestorContainer === y.commonAncestorContainer)),
|
|
@@ -828,17 +714,15 @@ class TuiDropdownSelection extends TuiDriver {
|
|
|
828
714
|
: this.range;
|
|
829
715
|
return (contained && handler(this.range)) || this.inDropdown(range);
|
|
830
716
|
}));
|
|
831
|
-
this.range = inject(
|
|
832
|
-
|
|
717
|
+
this.range = isPlatformBrowser(inject(PLATFORM_ID))
|
|
718
|
+
? new Range()
|
|
719
|
+
: {};
|
|
833
720
|
this.type = 'dropdown';
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
if (!tuiIsString(visible)) {
|
|
837
|
-
this.handler$.next(visible);
|
|
838
|
-
}
|
|
721
|
+
this.tuiDropdownSelection = input('');
|
|
722
|
+
this.tuiDropdownSelectionPosition = input('selection');
|
|
839
723
|
}
|
|
840
724
|
getClientRect() {
|
|
841
|
-
switch (this.
|
|
725
|
+
switch (this.tuiDropdownSelectionPosition()) {
|
|
842
726
|
case 'tag': {
|
|
843
727
|
const { commonAncestorContainer } = this.range;
|
|
844
728
|
const element = tuiIsElement(commonAncestorContainer)
|
|
@@ -863,7 +747,7 @@ class TuiDropdownSelection extends TuiDriver {
|
|
|
863
747
|
return this.el.querySelector('tui-textfield .t-ghost') || this.el;
|
|
864
748
|
}
|
|
865
749
|
getRange() {
|
|
866
|
-
const active =
|
|
750
|
+
const active = tuiGetFocused(this.doc);
|
|
867
751
|
const selection = this.doc.getSelection();
|
|
868
752
|
const range = active && tuiIsTextfield(active) && this.el.contains(active)
|
|
869
753
|
? this.veryVerySadInputFix(active)
|
|
@@ -930,7 +814,7 @@ class TuiDropdownSelection extends TuiDriver {
|
|
|
930
814
|
return ghost;
|
|
931
815
|
}
|
|
932
816
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownSelection, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
933
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
817
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.15", type: TuiDropdownSelection, isStandalone: true, selector: "[tuiDropdownSelection]", inputs: { tuiDropdownSelection: { classPropertyName: "tuiDropdownSelection", publicName: "tuiDropdownSelection", isSignal: true, isRequired: false, transformFunction: null }, tuiDropdownSelectionPosition: { classPropertyName: "tuiDropdownSelectionPosition", publicName: "tuiDropdownSelectionPosition", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
934
818
|
tuiAsDriver(TuiDropdownSelection),
|
|
935
819
|
tuiAsRectAccessor(TuiDropdownSelection),
|
|
936
820
|
], usesInheritance: true, ngImport: i0 }); }
|
|
@@ -938,19 +822,13 @@ class TuiDropdownSelection extends TuiDriver {
|
|
|
938
822
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownSelection, decorators: [{
|
|
939
823
|
type: Directive,
|
|
940
824
|
args: [{
|
|
941
|
-
standalone: true,
|
|
942
825
|
selector: '[tuiDropdownSelection]',
|
|
943
826
|
providers: [
|
|
944
827
|
tuiAsDriver(TuiDropdownSelection),
|
|
945
828
|
tuiAsRectAccessor(TuiDropdownSelection),
|
|
946
829
|
],
|
|
947
830
|
}]
|
|
948
|
-
}], ctorParameters: () => []
|
|
949
|
-
type: Input,
|
|
950
|
-
args: ['tuiDropdownSelectionPosition']
|
|
951
|
-
}], tuiDropdownSelection: [{
|
|
952
|
-
type: Input
|
|
953
|
-
}] } });
|
|
831
|
+
}], ctorParameters: () => [] });
|
|
954
832
|
|
|
955
833
|
const TuiDropdown = [
|
|
956
834
|
TuiDropdownOptionsDirective,
|
|
@@ -958,10 +836,9 @@ const TuiDropdown = [
|
|
|
958
836
|
TuiDropdownDirective,
|
|
959
837
|
TuiDropdownComponent,
|
|
960
838
|
TuiDropdownOpen,
|
|
961
|
-
TuiDropdownOpenLegacy,
|
|
962
|
-
TuiDropdownPortal,
|
|
963
839
|
TuiDropdownManual,
|
|
964
840
|
TuiDropdownHover,
|
|
841
|
+
TuiDropdownContent,
|
|
965
842
|
TuiDropdownContext,
|
|
966
843
|
TuiDropdownPosition,
|
|
967
844
|
TuiDropdownPositionSided,
|
|
@@ -972,14 +849,7 @@ function tuiDropdown(value) {
|
|
|
972
849
|
return tuiDirectiveBinding(TuiDropdownDirective, 'tuiDropdown', value, {});
|
|
973
850
|
}
|
|
974
851
|
function tuiDropdownEnabled(value) {
|
|
975
|
-
return tuiDirectiveBinding(TuiDropdownOpen, '
|
|
976
|
-
}
|
|
977
|
-
function tuiDropdownOpen() {
|
|
978
|
-
const open = tuiDirectiveBinding(TuiDropdownOpen, 'tuiDropdownOpen', false, {});
|
|
979
|
-
inject(TuiDropdownOpen)
|
|
980
|
-
.tuiDropdownOpenChange.pipe(takeUntilDestroyed())
|
|
981
|
-
.subscribe((value) => open.set(value));
|
|
982
|
-
return open;
|
|
852
|
+
return tuiDirectiveBinding(TuiDropdownOpen, 'enabled', value, {});
|
|
983
853
|
}
|
|
984
854
|
|
|
985
855
|
class TuiDropdownFixed {
|
|
@@ -993,7 +863,6 @@ class TuiDropdownFixed {
|
|
|
993
863
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownFixed, decorators: [{
|
|
994
864
|
type: Directive,
|
|
995
865
|
args: [{
|
|
996
|
-
standalone: true,
|
|
997
866
|
providers: [tuiDropdownOptionsProvider({})],
|
|
998
867
|
}]
|
|
999
868
|
}], ctorParameters: () => [] });
|
|
@@ -1009,29 +878,9 @@ class TuiDropdownAuto {
|
|
|
1009
878
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiDropdownAuto, isStandalone: true, ngImport: i0 }); }
|
|
1010
879
|
}
|
|
1011
880
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownAuto, decorators: [{
|
|
1012
|
-
type: Directive
|
|
1013
|
-
args: [{ standalone: true }]
|
|
881
|
+
type: Directive
|
|
1014
882
|
}], ctorParameters: () => [] });
|
|
1015
883
|
|
|
1016
|
-
/**
|
|
1017
|
-
* Host element for dynamically created portals, for example using {@link TuiDropdownDirective}.
|
|
1018
|
-
*/
|
|
1019
|
-
class TuiDropdowns extends TuiPortals {
|
|
1020
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdowns, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1021
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: TuiDropdowns, isStandalone: true, selector: "tui-dropdowns", host: { styleAttribute: "position: absolute; width: 100%; top: 0" }, providers: [tuiAsPortal(TuiDropdownService)], usesInheritance: true, ngImport: i0, template: '<ng-container #viewContainer />', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1022
|
-
}
|
|
1023
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdowns, decorators: [{
|
|
1024
|
-
type: Component,
|
|
1025
|
-
args: [{
|
|
1026
|
-
standalone: true,
|
|
1027
|
-
selector: 'tui-dropdowns',
|
|
1028
|
-
template: '<ng-container #viewContainer />',
|
|
1029
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1030
|
-
providers: [tuiAsPortal(TuiDropdownService)],
|
|
1031
|
-
host: { style: 'position: absolute; width: 100%; top: 0' },
|
|
1032
|
-
}]
|
|
1033
|
-
}] });
|
|
1034
|
-
|
|
1035
884
|
class TuiWithDropdownOpen {
|
|
1036
885
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiWithDropdownOpen, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1037
886
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiWithDropdownOpen, isStandalone: true, hostDirectives: [{ directive: TuiDropdownOpen, inputs: ["tuiDropdownOpen", "open", "tuiDropdownEnabled", "tuiDropdownEnabled"], outputs: ["tuiDropdownOpenChange", "openChange"] }], ngImport: i0 }); }
|
|
@@ -1039,7 +888,6 @@ class TuiWithDropdownOpen {
|
|
|
1039
888
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiWithDropdownOpen, decorators: [{
|
|
1040
889
|
type: Directive,
|
|
1041
890
|
args: [{
|
|
1042
|
-
standalone: true,
|
|
1043
891
|
hostDirectives: [
|
|
1044
892
|
{
|
|
1045
893
|
directive: TuiDropdownOpen,
|
|
@@ -1054,5 +902,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
|
|
|
1054
902
|
* Generated bundle index. Do not edit.
|
|
1055
903
|
*/
|
|
1056
904
|
|
|
1057
|
-
export { TUI_DROPDOWN_COMPONENT, TUI_DROPDOWN_CONTEXT, TUI_DROPDOWN_DEFAULT_OPTIONS, TUI_DROPDOWN_HOVER_DEFAULT_OPTIONS, TUI_DROPDOWN_HOVER_OPTIONS, TUI_DROPDOWN_OPTIONS, TuiDropdown, TuiDropdownAuto, TuiDropdownComponent, TuiDropdownContext, TuiDropdownDirective, TuiDropdownDriver, TuiDropdownDriverDirective, TuiDropdownFixed, TuiDropdownHover, TuiDropdownManual, TuiDropdownOpen,
|
|
1058
|
-
//# sourceMappingURL=taiga-ui-core-
|
|
905
|
+
export { TUI_DROPDOWN_COMPONENT, TUI_DROPDOWN_CONTEXT, TUI_DROPDOWN_DEFAULT_OPTIONS, TUI_DROPDOWN_HOVER_DEFAULT_OPTIONS, TUI_DROPDOWN_HOVER_OPTIONS, TUI_DROPDOWN_OPTIONS, TuiDropdown, TuiDropdownAuto, TuiDropdownComponent, TuiDropdownContent, TuiDropdownContext, TuiDropdownDirective, TuiDropdownDriver, TuiDropdownDriverDirective, TuiDropdownFixed, TuiDropdownHover, TuiDropdownManual, TuiDropdownOpen, TuiDropdownOptionsDirective, TuiDropdownPosition, TuiDropdownPositionSided, TuiDropdownSelection, TuiWithDropdownOpen, tuiDropdown, tuiDropdownEnabled, tuiDropdownHoverOptionsProvider, tuiDropdownOptionsProvider };
|
|
906
|
+
//# sourceMappingURL=taiga-ui-core-portals-dropdown.mjs.map
|