@taiga-ui/core 2.50.0 → 2.50.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/bundles/taiga-ui-core-components-dialog.umd.js +2 -1
- package/bundles/taiga-ui-core-components-dialog.umd.js.map +1 -1
- package/bundles/taiga-ui-core-components-dialog.umd.min.js +1 -1
- package/bundles/taiga-ui-core-components-dialog.umd.min.js.map +1 -1
- package/bundles/taiga-ui-core-components-dropdown-box.umd.js +5 -4
- package/bundles/taiga-ui-core-components-dropdown-box.umd.js.map +1 -1
- package/bundles/taiga-ui-core-components-dropdown-box.umd.min.js +1 -1
- package/bundles/taiga-ui-core-components-dropdown-box.umd.min.js.map +1 -1
- package/bundles/taiga-ui-core-components-hints-host.umd.js +5 -5
- package/bundles/taiga-ui-core-components-hints-host.umd.js.map +1 -1
- package/bundles/taiga-ui-core-components-hints-host.umd.min.js +1 -1
- package/bundles/taiga-ui-core-components-hints-host.umd.min.js.map +1 -1
- package/bundles/taiga-ui-core-components-primitive-textfield.umd.js +18 -19
- package/bundles/taiga-ui-core-components-primitive-textfield.umd.js.map +1 -1
- package/bundles/taiga-ui-core-components-primitive-textfield.umd.min.js +1 -1
- package/bundles/taiga-ui-core-components-primitive-textfield.umd.min.js.map +1 -1
- package/bundles/taiga-ui-core-components-root.umd.js +1 -1
- package/bundles/taiga-ui-core-components-root.umd.min.js +1 -1
- package/bundles/taiga-ui-core-components-root.umd.min.js.map +1 -1
- package/bundles/taiga-ui-core-constants.umd.js +1 -1
- package/bundles/taiga-ui-core-constants.umd.js.map +1 -1
- package/bundles/taiga-ui-core-constants.umd.min.js +1 -1
- package/bundles/taiga-ui-core-constants.umd.min.js.map +1 -1
- package/bundles/taiga-ui-core-tokens.umd.js +2 -2
- package/bundles/taiga-ui-core-tokens.umd.js.map +1 -1
- package/bundles/taiga-ui-core-tokens.umd.min.js +1 -1
- package/bundles/taiga-ui-core-tokens.umd.min.js.map +1 -1
- package/bundles/taiga-ui-core-utils-mobile.umd.js +18 -0
- package/bundles/taiga-ui-core-utils-mobile.umd.js.map +1 -0
- package/bundles/taiga-ui-core-utils-mobile.umd.min.js +2 -0
- package/bundles/taiga-ui-core-utils-mobile.umd.min.js.map +1 -0
- package/bundles/taiga-ui-core-utils.umd.js +12 -4
- package/bundles/taiga-ui-core-utils.umd.js.map +1 -1
- package/bundles/taiga-ui-core-utils.umd.min.js +1 -1
- package/components/dialog/taiga-ui-core-components-dialog.metadata.json +1 -1
- package/components/dropdown-box/taiga-ui-core-components-dropdown-box.metadata.json +1 -1
- package/components/hints-host/taiga-ui-core-components-hints-host.metadata.json +1 -1
- package/components/primitive-textfield/taiga-ui-core-components-primitive-textfield.metadata.json +1 -1
- package/components/primitive-textfield/value-decoration/value-decoration.component.d.ts +6 -6
- package/components/root/taiga-ui-core-components-root.metadata.json +1 -1
- package/constants/taiga-ui-core-constants.metadata.json +1 -1
- package/constants/version.d.ts +1 -1
- package/esm2015/components/dialog/dialog.providers.js +4 -3
- package/esm2015/components/dropdown-box/dropdown-box.component.js +7 -6
- package/esm2015/components/hints-host/hint-box/hint-box.component.js +3 -2
- package/esm2015/components/primitive-textfield/primitive-textfield.module.js +2 -4
- package/esm2015/components/primitive-textfield/value-decoration/value-decoration.component.js +17 -19
- package/esm2015/components/root/root.component.js +1 -1
- package/esm2015/constants/version.js +2 -2
- package/esm2015/tokens/is-mobile-resolution.js +4 -3
- package/esm2015/utils/index.js +2 -1
- package/esm2015/utils/mobile/index.js +2 -0
- package/esm2015/utils/mobile/is-mobile.js +4 -0
- package/esm2015/utils/mobile/taiga-ui-core-utils-mobile.js +5 -0
- package/esm5/components/dialog/dialog.providers.js +4 -3
- package/esm5/components/dropdown-box/dropdown-box.component.js +7 -6
- package/esm5/components/hints-host/hint-box/hint-box.component.js +3 -2
- package/esm5/components/primitive-textfield/primitive-textfield.module.js +2 -4
- package/esm5/components/primitive-textfield/value-decoration/value-decoration.component.js +17 -19
- package/esm5/components/root/root.component.js +1 -1
- package/esm5/constants/version.js +2 -2
- package/esm5/tokens/is-mobile-resolution.js +4 -3
- package/esm5/utils/index.js +2 -1
- package/esm5/utils/mobile/index.js +2 -0
- package/esm5/utils/mobile/is-mobile.js +6 -0
- package/esm5/utils/mobile/taiga-ui-core-utils-mobile.js +5 -0
- package/fesm2015/taiga-ui-core-components-dialog.js +3 -2
- package/fesm2015/taiga-ui-core-components-dialog.js.map +1 -1
- package/fesm2015/taiga-ui-core-components-dropdown-box.js +6 -5
- package/fesm2015/taiga-ui-core-components-dropdown-box.js.map +1 -1
- package/fesm2015/taiga-ui-core-components-hints-host.js +2 -1
- package/fesm2015/taiga-ui-core-components-hints-host.js.map +1 -1
- package/fesm2015/taiga-ui-core-components-primitive-textfield.js +17 -19
- package/fesm2015/taiga-ui-core-components-primitive-textfield.js.map +1 -1
- package/fesm2015/taiga-ui-core-components-root.js +1 -1
- package/fesm2015/taiga-ui-core-constants.js +1 -1
- package/fesm2015/taiga-ui-core-constants.js.map +1 -1
- package/fesm2015/taiga-ui-core-tokens.js +3 -3
- package/fesm2015/taiga-ui-core-tokens.js.map +1 -1
- package/fesm2015/taiga-ui-core-utils-mobile.js +10 -0
- package/fesm2015/taiga-ui-core-utils-mobile.js.map +1 -0
- package/fesm2015/taiga-ui-core-utils.js +1 -0
- package/fesm2015/taiga-ui-core-utils.js.map +1 -1
- package/fesm5/taiga-ui-core-components-dialog.js +3 -2
- package/fesm5/taiga-ui-core-components-dialog.js.map +1 -1
- package/fesm5/taiga-ui-core-components-dropdown-box.js +6 -5
- package/fesm5/taiga-ui-core-components-dropdown-box.js.map +1 -1
- package/fesm5/taiga-ui-core-components-hints-host.js +2 -1
- package/fesm5/taiga-ui-core-components-hints-host.js.map +1 -1
- package/fesm5/taiga-ui-core-components-primitive-textfield.js +17 -19
- package/fesm5/taiga-ui-core-components-primitive-textfield.js.map +1 -1
- package/fesm5/taiga-ui-core-components-root.js +1 -1
- package/fesm5/taiga-ui-core-constants.js +1 -1
- package/fesm5/taiga-ui-core-constants.js.map +1 -1
- package/fesm5/taiga-ui-core-tokens.js +3 -3
- package/fesm5/taiga-ui-core-tokens.js.map +1 -1
- package/fesm5/taiga-ui-core-utils-mobile.js +12 -0
- package/fesm5/taiga-ui-core-utils-mobile.js.map +1 -0
- package/fesm5/taiga-ui-core-utils.js +1 -0
- package/fesm5/taiga-ui-core-utils.js.map +1 -1
- package/package.json +4 -4
- package/tokens/taiga-ui-core-tokens.metadata.json +1 -1
- package/utils/index.d.ts +1 -0
- package/utils/mobile/index.d.ts +1 -0
- package/utils/mobile/is-mobile.d.ts +2 -0
- package/utils/mobile/package.json +13 -0
- package/utils/mobile/taiga-ui-core-utils-mobile.d.ts +4 -0
- package/utils/mobile/taiga-ui-core-utils-mobile.metadata.json +1 -0
- package/utils/taiga-ui-core-utils.metadata.json +1 -1
package/esm5/utils/index.js
CHANGED
|
@@ -2,5 +2,6 @@ export * from '@taiga-ui/core/utils/dom';
|
|
|
2
2
|
export * from '@taiga-ui/core/utils/format';
|
|
3
3
|
export * from '@taiga-ui/core/utils/mask';
|
|
4
4
|
export * from '@taiga-ui/core/utils/miscellaneous';
|
|
5
|
+
export * from '@taiga-ui/core/utils/mobile';
|
|
5
6
|
export * from '@taiga-ui/core/utils/polyfills';
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AdGFpZ2EtdWkvY29yZS91dGlscy8iLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsMEJBQTBCLENBQUM7QUFDekMsY0FBYyw2QkFBNkIsQ0FBQztBQUM1QyxjQUFjLDJCQUEyQixDQUFDO0FBQzFDLGNBQWMsb0NBQW9DLENBQUM7QUFDbkQsY0FBYyw2QkFBNkIsQ0FBQztBQUM1QyxjQUFjLGdDQUFnQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnQHRhaWdhLXVpL2NvcmUvdXRpbHMvZG9tJztcbmV4cG9ydCAqIGZyb20gJ0B0YWlnYS11aS9jb3JlL3V0aWxzL2Zvcm1hdCc7XG5leHBvcnQgKiBmcm9tICdAdGFpZ2EtdWkvY29yZS91dGlscy9tYXNrJztcbmV4cG9ydCAqIGZyb20gJ0B0YWlnYS11aS9jb3JlL3V0aWxzL21pc2NlbGxhbmVvdXMnO1xuZXhwb3J0ICogZnJvbSAnQHRhaWdhLXVpL2NvcmUvdXRpbHMvbW9iaWxlJztcbmV4cG9ydCAqIGZyb20gJ0B0YWlnYS11aS9jb3JlL3V0aWxzL3BvbHlmaWxscyc7XG4iXX0=
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export * from './is-mobile';
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AdGFpZ2EtdWkvY29yZS91dGlscy9tb2JpbGUvIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGFBQWEsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vaXMtbW9iaWxlJztcbiJdfQ==
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export function tuiIsMobile(_a, _b) {
|
|
2
|
+
var innerWidth = _a.innerWidth;
|
|
3
|
+
var mobile = _b.mobile;
|
|
4
|
+
return innerWidth <= mobile;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaXMtbW9iaWxlLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQHRhaWdhLXVpL2NvcmUvdXRpbHMvbW9iaWxlLyIsInNvdXJjZXMiOlsiaXMtbW9iaWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE1BQU0sVUFBVSxXQUFXLENBQUMsRUFBb0IsRUFBRSxFQUFrQjtRQUF2QywwQkFBVTtRQUFZLGtCQUFNO0lBQ3JELE9BQU8sVUFBVSxJQUFJLE1BQU0sQ0FBQztBQUNoQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHtUdWlNZWRpYX0gZnJvbSAnQHRhaWdhLXVpL2NvcmUvaW50ZXJmYWNlcyc7XG5cbmV4cG9ydCBmdW5jdGlvbiB0dWlJc01vYmlsZSh7aW5uZXJXaWR0aH06IFdpbmRvdywge21vYmlsZX06IFR1aU1lZGlhKTogYm9vbGVhbiB7XG4gICAgcmV0dXJuIGlubmVyV2lkdGggPD0gbW9iaWxlO1xufVxuIl19
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
export * from './index';
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFpZ2EtdWktY29yZS11dGlscy1tb2JpbGUuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AdGFpZ2EtdWkvY29yZS91dGlscy9tb2JpbGUvIiwic291cmNlcyI6WyJ0YWlnYS11aS1jb3JlLXV0aWxzLW1vYmlsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsU0FBUyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL2luZGV4JztcbiJdfQ==
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate, __param } from 'tslib';
|
|
2
2
|
import { InjectionToken, ElementRef, Inject, HostBinding, Component, ChangeDetectionStrategy, ɵɵdefineInjectable, ɵɵinject, Injectable, Directive, NgModule } from '@angular/core';
|
|
3
|
-
import { typedFromEvent, isCurrentTarget, containsOrAfter, TuiDestroyService, TUI_IS_MOBILE, AbstractTuiDialogService, AbstractTuiDialogDirective, TuiPreventDefaultModule, TUI_DIALOGS } from '@taiga-ui/cdk';
|
|
3
|
+
import { typedFromEvent, isCurrentTarget, containsOrAfter, tuiGetViewportWidth, TuiDestroyService, TUI_IS_MOBILE, AbstractTuiDialogService, AbstractTuiDialogDirective, TuiPreventDefaultModule, TUI_DIALOGS } from '@taiga-ui/cdk';
|
|
4
4
|
import { tuiSlideInTop, tuiFadeIn } from '@taiga-ui/core/animations';
|
|
5
5
|
import { TUI_ANIMATIONS_DURATION, TUI_CLOSE_WORD } from '@taiga-ui/core/tokens';
|
|
6
6
|
import { POLYMORPHEUS_CONTEXT, PolymorpheusComponent, PolymorpheusModule } from '@tinkoff/ng-polymorpheus';
|
|
@@ -25,7 +25,8 @@ function dialogCloseStreamFactory(documentRef, windowRef, { nativeElement }, clo
|
|
|
25
25
|
nativeElement.contains(target)))), typedFromEvent(documentRef, 'mousedown').pipe(
|
|
26
26
|
// TODO: iframe warning
|
|
27
27
|
filter(({ target, clientX }) => target instanceof Element &&
|
|
28
|
-
windowRef
|
|
28
|
+
tuiGetViewportWidth(windowRef) - clientX >
|
|
29
|
+
SCROLLBAR_PLACEHOLDER &&
|
|
29
30
|
!containsOrAfter(nativeElement, target)), switchMapTo(typedFromEvent(documentRef, 'mouseup').pipe(take(1),
|
|
30
31
|
// TODO: iframe warning
|
|
31
32
|
filter(({ target }) => target instanceof Element &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-core-components-dialog.js","sources":["ng://@taiga-ui/core/components/dialog/dialog.providers.ts","ng://@taiga-ui/core/components/dialog/dialog.component.ts","ng://@taiga-ui/core/components/dialog/dialog.service.ts","ng://@taiga-ui/core/components/dialog/dialog.directive.ts","ng://@taiga-ui/core/components/dialog/dialog.module.ts","ng://@taiga-ui/core/components/dialog/taiga-ui-core-components-dialog.ts"],"sourcesContent":["import {DOCUMENT} from '@angular/common';\nimport {ElementRef, InjectionToken, Provider} from '@angular/core';\nimport {WINDOW} from '@ng-web-apis/common';\nimport {\n containsOrAfter,\n isCurrentTarget,\n TuiDestroyService,\n TuiDialog,\n typedFromEvent,\n} from '@taiga-ui/cdk';\nimport {TuiDialogOptions} from '@taiga-ui/core/interfaces';\nimport {POLYMORPHEUS_CONTEXT} from '@tinkoff/ng-polymorpheus';\nimport {EMPTY, merge, Observable} from 'rxjs';\nimport {filter, switchMapTo, take, takeUntil} from 'rxjs/operators';\n\nexport const TUI_DIALOGS_CLOSE = new InjectionToken<Observable<unknown>>(\n 'A stream to close dialogs',\n {\n factory: () => EMPTY,\n },\n);\n\nconst SCROLLBAR_PLACEHOLDER = 17;\n\nexport function dialogCloseStreamFactory(\n documentRef: Document,\n windowRef: Window,\n {nativeElement}: ElementRef<HTMLElement>,\n close$: Observable<void>,\n destroy$: Observable<void>,\n {dismissible}: TuiDialog<TuiDialogOptions<unknown>, unknown>,\n): Observable<unknown> {\n return dismissible\n ? merge(\n typedFromEvent(nativeElement, 'click').pipe(filter(isCurrentTarget)),\n typedFromEvent(documentRef, 'keydown').pipe(\n // TODO: iframe warning\n filter(\n ({key, target}) =>\n key === 'Escape' &&\n target instanceof Element &&\n (!containsOrAfter(nativeElement, target) ||\n nativeElement.contains(target)),\n ),\n ),\n typedFromEvent(documentRef, 'mousedown').pipe(\n // TODO: iframe warning\n filter(\n ({target, clientX}) =>\n target instanceof Element &&\n windowRef.innerWidth - clientX > SCROLLBAR_PLACEHOLDER &&\n !containsOrAfter(nativeElement, target),\n ),\n switchMapTo(\n typedFromEvent(documentRef, 'mouseup').pipe(\n take(1),\n // TODO: iframe warning\n filter(\n ({target}) =>\n target instanceof Element &&\n !containsOrAfter(nativeElement, target),\n ),\n ),\n ),\n ),\n close$,\n ).pipe(takeUntil(destroy$))\n : close$;\n}\n\nexport const TUI_DIALOG_CLOSE_STREAM = new InjectionToken<Observable<unknown>>(\n 'Dialogs closing stream',\n);\nexport const TUI_DIALOG_PROVIDERS: Provider[] = [\n TuiDestroyService,\n {\n provide: TUI_DIALOG_CLOSE_STREAM,\n deps: [\n DOCUMENT,\n WINDOW,\n ElementRef,\n TUI_DIALOGS_CLOSE,\n TuiDestroyService,\n POLYMORPHEUS_CONTEXT,\n ],\n useFactory: dialogCloseStreamFactory,\n },\n];\n","import {ChangeDetectionStrategy, Component, HostBinding, Inject} from '@angular/core';\nimport {TUI_IS_MOBILE, TuiDialog} from '@taiga-ui/cdk';\nimport {tuiFadeIn, tuiSlideInTop} from '@taiga-ui/core/animations';\nimport {TuiAnimationOptions, TuiDialogOptions} from '@taiga-ui/core/interfaces';\nimport {TUI_ANIMATIONS_DURATION, TUI_CLOSE_WORD} from '@taiga-ui/core/tokens';\nimport {TuiDialogSize} from '@taiga-ui/core/types';\nimport {POLYMORPHEUS_CONTEXT, PolymorpheusContent} from '@tinkoff/ng-polymorpheus';\nimport {Observable} from 'rxjs';\n\nimport {TUI_DIALOG_CLOSE_STREAM, TUI_DIALOG_PROVIDERS} from './dialog.providers';\n\nconst REQUIRED_ERROR = new Error('Required dialog was dismissed');\n\n// @dynamic\n@Component({\n selector: 'tui-dialog',\n templateUrl: './dialog.template.html',\n styleUrls: ['./dialog.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: TUI_DIALOG_PROVIDERS,\n animations: [tuiSlideInTop, tuiFadeIn],\n})\nexport class TuiDialogComponent<O, I> {\n private readonly animation = {\n value: '',\n params: {\n start: '40px',\n duration: this.duration,\n },\n } as const;\n\n private readonly fullscreenAnimation = {\n value: '',\n params: {\n start: '100vh',\n duration: this.duration,\n },\n } as const;\n\n constructor(\n @Inject(TUI_ANIMATIONS_DURATION) private readonly duration: number,\n @Inject(TUI_IS_MOBILE) private readonly isMobile: boolean,\n @Inject(POLYMORPHEUS_CONTEXT)\n readonly context: TuiDialog<TuiDialogOptions<I>, O>,\n @Inject(TUI_DIALOG_CLOSE_STREAM)\n close$: Observable<unknown>,\n @Inject(TUI_CLOSE_WORD) readonly closeWord$: Observable<string>,\n ) {\n close$.subscribe(() => {\n this.close();\n });\n }\n\n @HostBinding('attr.data-size')\n get size(): TuiDialogSize {\n return this.context.size;\n }\n\n @HostBinding('class._centered')\n get header(): PolymorpheusContent {\n return this.context.header;\n }\n\n @HostBinding('@tuiSlideInTop')\n @HostBinding('@tuiFadeIn')\n get slideInTop(): TuiAnimationOptions {\n return this.size === 'fullscreen' || this.size === 'page' || this.isMobile\n ? this.fullscreenAnimation\n : this.animation;\n }\n\n close(): void {\n if (this.context.required) {\n this.context.$implicit.error(REQUIRED_ERROR);\n } else {\n this.context.$implicit.complete();\n }\n }\n}\n","import {Injectable} from '@angular/core';\nimport {AbstractTuiDialogService} from '@taiga-ui/cdk';\nimport {TuiDialogOptions} from '@taiga-ui/core/interfaces';\nimport {PolymorpheusComponent} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiDialogComponent} from './dialog.component';\n\nconst DIALOG = new PolymorpheusComponent(TuiDialogComponent);\nconst DEFAULT_OPTIONS = {\n size: 'm',\n required: false,\n closeable: true,\n dismissible: true,\n label: '',\n header: '',\n} as const;\n\n@Injectable({\n providedIn: 'root',\n})\nexport class TuiDialogService extends AbstractTuiDialogService<TuiDialogOptions<any>> {\n protected readonly component = DIALOG;\n protected readonly defaultOptions: TuiDialogOptions<any> = DEFAULT_OPTIONS as any;\n}\n","import {Directive} from '@angular/core';\nimport {AbstractTuiDialogDirective, AbstractTuiDialogService} from '@taiga-ui/cdk';\nimport {TuiDialogOptions} from '@taiga-ui/core/interfaces';\n\nimport {TuiDialogService} from './dialog.service';\n\n@Directive({\n selector: 'ng-template[tuiDialog]',\n providers: [\n {\n provide: AbstractTuiDialogService,\n useExisting: TuiDialogService,\n },\n ],\n inputs: ['options: tuiDialogOptions', 'open: tuiDialog'],\n outputs: ['openChange: tuiDialogChange'],\n})\nexport class TuiDialogDirective<T> extends AbstractTuiDialogDirective<\n TuiDialogOptions<T>\n> {}\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {TUI_DIALOGS, TuiPreventDefaultModule} from '@taiga-ui/cdk';\nimport {TuiButtonModule} from '@taiga-ui/core/components/button';\nimport {PolymorpheusModule} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiDialogComponent} from './dialog.component';\nimport {TuiDialogDirective} from './dialog.directive';\nimport {TuiDialogService} from './dialog.service';\n\n@NgModule({\n imports: [PolymorpheusModule, TuiButtonModule, CommonModule, TuiPreventDefaultModule],\n declarations: [TuiDialogComponent, TuiDialogDirective],\n exports: [TuiDialogComponent, TuiDialogDirective],\n entryComponents: [TuiDialogComponent],\n providers: [\n {\n provide: TUI_DIALOGS,\n useExisting: TuiDialogService,\n multi: true,\n },\n ],\n})\nexport class TuiDialogModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;MAea,iBAAiB,GAAG,IAAI,cAAc,CAC/C,2BAA2B,EAC3B;IACI,OAAO,EAAE,MAAM,KAAK;CACvB,EACH;AAEF,MAAM,qBAAqB,GAAG,EAAE,CAAC;SAEjB,wBAAwB,CACpC,WAAqB,EACrB,SAAiB,EACjB,EAAC,aAAa,EAA0B,EACxC,MAAwB,EACxB,QAA0B,EAC1B,EAAC,WAAW,EAAgD;IAE5D,OAAO,WAAW;UACZ,KAAK,CACD,cAAc,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EACpE,cAAc,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,IAAI;;QAEvC,MAAM,CACF,CAAC,EAAC,GAAG,EAAE,MAAM,EAAC,KACV,GAAG,KAAK,QAAQ;YAChB,MAAM,YAAY,OAAO;aACxB,CAAC,eAAe,CAAC,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AC;KAC3C,CAAC;GACW,kBAAkB,CAE3B;;ICIS,eAAe,GAA5B,MAAa,eAAe;EAAG;AAAlB,eAAe;IAb3B,QAAQ,CAAC;QACN,OAAO,EAAE,CAAC,kBAAkB,EAAE,eAAe,EAAE,YAAY,EAAE,uBAAuB,CAAC;QACrF,YAAY,EAAE,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;QACtD,OAAO,EAAE,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;QACjD,eAAe,EAAE,CAAC,kBAAkB,CAAC;QACrC,SAAS,EAAE;YACP;gBACI,OAAO,EAAE,WAAW;gBACpB,WAAW,EAAE,gBAAgB;gBAC7B,KAAK,EAAE,IAAI;aACd;SACJ;KACJ,CAAC;GACW,eAAe,CAAG;;ACvB/B;;;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-core-components-dialog.js","sources":["ng://@taiga-ui/core/components/dialog/dialog.providers.ts","ng://@taiga-ui/core/components/dialog/dialog.component.ts","ng://@taiga-ui/core/components/dialog/dialog.service.ts","ng://@taiga-ui/core/components/dialog/dialog.directive.ts","ng://@taiga-ui/core/components/dialog/dialog.module.ts","ng://@taiga-ui/core/components/dialog/taiga-ui-core-components-dialog.ts"],"sourcesContent":["import {DOCUMENT} from '@angular/common';\nimport {ElementRef, InjectionToken, Provider} from '@angular/core';\nimport {WINDOW} from '@ng-web-apis/common';\nimport {\n containsOrAfter,\n isCurrentTarget,\n TuiDestroyService,\n TuiDialog,\n tuiGetViewportWidth,\n typedFromEvent,\n} from '@taiga-ui/cdk';\nimport {TuiDialogOptions} from '@taiga-ui/core/interfaces';\nimport {POLYMORPHEUS_CONTEXT} from '@tinkoff/ng-polymorpheus';\nimport {EMPTY, merge, Observable} from 'rxjs';\nimport {filter, switchMapTo, take, takeUntil} from 'rxjs/operators';\n\nexport const TUI_DIALOGS_CLOSE = new InjectionToken<Observable<unknown>>(\n 'A stream to close dialogs',\n {\n factory: () => EMPTY,\n },\n);\n\nconst SCROLLBAR_PLACEHOLDER = 17;\n\nexport function dialogCloseStreamFactory(\n documentRef: Document,\n windowRef: Window,\n {nativeElement}: ElementRef<HTMLElement>,\n close$: Observable<void>,\n destroy$: Observable<void>,\n {dismissible}: TuiDialog<TuiDialogOptions<unknown>, unknown>,\n): Observable<unknown> {\n return dismissible\n ? merge(\n typedFromEvent(nativeElement, 'click').pipe(filter(isCurrentTarget)),\n typedFromEvent(documentRef, 'keydown').pipe(\n // TODO: iframe warning\n filter(\n ({key, target}) =>\n key === 'Escape' &&\n target instanceof Element &&\n (!containsOrAfter(nativeElement, target) ||\n nativeElement.contains(target)),\n ),\n ),\n typedFromEvent(documentRef, 'mousedown').pipe(\n // TODO: iframe warning\n filter(\n ({target, clientX}) =>\n target instanceof Element &&\n tuiGetViewportWidth(windowRef) - clientX >\n SCROLLBAR_PLACEHOLDER &&\n !containsOrAfter(nativeElement, target),\n ),\n switchMapTo(\n typedFromEvent(documentRef, 'mouseup').pipe(\n take(1),\n // TODO: iframe warning\n filter(\n ({target}) =>\n target instanceof Element &&\n !containsOrAfter(nativeElement, target),\n ),\n ),\n ),\n ),\n close$,\n ).pipe(takeUntil(destroy$))\n : close$;\n}\n\nexport const TUI_DIALOG_CLOSE_STREAM = new InjectionToken<Observable<unknown>>(\n 'Dialogs closing stream',\n);\nexport const TUI_DIALOG_PROVIDERS: Provider[] = [\n TuiDestroyService,\n {\n provide: TUI_DIALOG_CLOSE_STREAM,\n deps: [\n DOCUMENT,\n WINDOW,\n ElementRef,\n TUI_DIALOGS_CLOSE,\n TuiDestroyService,\n POLYMORPHEUS_CONTEXT,\n ],\n useFactory: dialogCloseStreamFactory,\n },\n];\n","import {ChangeDetectionStrategy, Component, HostBinding, Inject} from '@angular/core';\nimport {TUI_IS_MOBILE, TuiDialog} from '@taiga-ui/cdk';\nimport {tuiFadeIn, tuiSlideInTop} from '@taiga-ui/core/animations';\nimport {TuiAnimationOptions, TuiDialogOptions} from '@taiga-ui/core/interfaces';\nimport {TUI_ANIMATIONS_DURATION, TUI_CLOSE_WORD} from '@taiga-ui/core/tokens';\nimport {TuiDialogSize} from '@taiga-ui/core/types';\nimport {POLYMORPHEUS_CONTEXT, PolymorpheusContent} from '@tinkoff/ng-polymorpheus';\nimport {Observable} from 'rxjs';\n\nimport {TUI_DIALOG_CLOSE_STREAM, TUI_DIALOG_PROVIDERS} from './dialog.providers';\n\nconst REQUIRED_ERROR = new Error('Required dialog was dismissed');\n\n// @dynamic\n@Component({\n selector: 'tui-dialog',\n templateUrl: './dialog.template.html',\n styleUrls: ['./dialog.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: TUI_DIALOG_PROVIDERS,\n animations: [tuiSlideInTop, tuiFadeIn],\n})\nexport class TuiDialogComponent<O, I> {\n private readonly animation = {\n value: '',\n params: {\n start: '40px',\n duration: this.duration,\n },\n } as const;\n\n private readonly fullscreenAnimation = {\n value: '',\n params: {\n start: '100vh',\n duration: this.duration,\n },\n } as const;\n\n constructor(\n @Inject(TUI_ANIMATIONS_DURATION) private readonly duration: number,\n @Inject(TUI_IS_MOBILE) private readonly isMobile: boolean,\n @Inject(POLYMORPHEUS_CONTEXT)\n readonly context: TuiDialog<TuiDialogOptions<I>, O>,\n @Inject(TUI_DIALOG_CLOSE_STREAM)\n close$: Observable<unknown>,\n @Inject(TUI_CLOSE_WORD) readonly closeWord$: Observable<string>,\n ) {\n close$.subscribe(() => {\n this.close();\n });\n }\n\n @HostBinding('attr.data-size')\n get size(): TuiDialogSize {\n return this.context.size;\n }\n\n @HostBinding('class._centered')\n get header(): PolymorpheusContent {\n return this.context.header;\n }\n\n @HostBinding('@tuiSlideInTop')\n @HostBinding('@tuiFadeIn')\n get slideInTop(): TuiAnimationOptions {\n return this.size === 'fullscreen' || this.size === 'page' || this.isMobile\n ? this.fullscreenAnimation\n : this.animation;\n }\n\n close(): void {\n if (this.context.required) {\n this.context.$implicit.error(REQUIRED_ERROR);\n } else {\n this.context.$implicit.complete();\n }\n }\n}\n","import {Injectable} from '@angular/core';\nimport {AbstractTuiDialogService} from '@taiga-ui/cdk';\nimport {TuiDialogOptions} from '@taiga-ui/core/interfaces';\nimport {PolymorpheusComponent} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiDialogComponent} from './dialog.component';\n\nconst DIALOG = new PolymorpheusComponent(TuiDialogComponent);\nconst DEFAULT_OPTIONS = {\n size: 'm',\n required: false,\n closeable: true,\n dismissible: true,\n label: '',\n header: '',\n} as const;\n\n@Injectable({\n providedIn: 'root',\n})\nexport class TuiDialogService extends AbstractTuiDialogService<TuiDialogOptions<any>> {\n protected readonly component = DIALOG;\n protected readonly defaultOptions: TuiDialogOptions<any> = DEFAULT_OPTIONS as any;\n}\n","import {Directive} from '@angular/core';\nimport {AbstractTuiDialogDirective, AbstractTuiDialogService} from '@taiga-ui/cdk';\nimport {TuiDialogOptions} from '@taiga-ui/core/interfaces';\n\nimport {TuiDialogService} from './dialog.service';\n\n@Directive({\n selector: 'ng-template[tuiDialog]',\n providers: [\n {\n provide: AbstractTuiDialogService,\n useExisting: TuiDialogService,\n },\n ],\n inputs: ['options: tuiDialogOptions', 'open: tuiDialog'],\n outputs: ['openChange: tuiDialogChange'],\n})\nexport class TuiDialogDirective<T> extends AbstractTuiDialogDirective<\n TuiDialogOptions<T>\n> {}\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {TUI_DIALOGS, TuiPreventDefaultModule} from '@taiga-ui/cdk';\nimport {TuiButtonModule} from '@taiga-ui/core/components/button';\nimport {PolymorpheusModule} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiDialogComponent} from './dialog.component';\nimport {TuiDialogDirective} from './dialog.directive';\nimport {TuiDialogService} from './dialog.service';\n\n@NgModule({\n imports: [PolymorpheusModule, TuiButtonModule, CommonModule, TuiPreventDefaultModule],\n declarations: [TuiDialogComponent, TuiDialogDirective],\n exports: [TuiDialogComponent, TuiDialogDirective],\n entryComponents: [TuiDialogComponent],\n providers: [\n {\n provide: TUI_DIALOGS,\n useExisting: TuiDialogService,\n multi: true,\n },\n ],\n})\nexport class TuiDialogModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;MAgBa,iBAAiB,GAAG,IAAI,cAAc,CAC/C,2BAA2B,EAC3B;IACI,OAAO,EAAE,MAAM,KAAK;CACvB,EACH;AAEF,MAAM,qBAAqB,GAAG,EAAE,CAAC;SAEjB,wBAAwB,CACpC,WAAqB,EACrB,SAAiB,EACjB,EAAC,aAAa,EAA0B,EACxC,MAAwB,EACxB,QAA0B,EAC1B,EAAC,WAAW,EAAgD;IAE5D,OAAO,WAAW;UACZ,KAAK,CACD,cAAc,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EACpE,cAAc,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,IAAI;;QAEvC,MAAM,CACF,CAAC,EAAC,GAAG,EAAE,MAAM,EAAC,KACV,GAAG,KAAK,QAAQ;YAChB,MAAM,YAAY,OAAO;aACxB,CAAC,eAAe,CAAC,aAAa,EAAE,MAAM,CAAC;gBACpC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAC1C,CACJ,EACD,cAAc,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,IAAI;;QAEzC,MAAM,CACF,CAAC,EAAC,MAAM,EAAE,OAAO,EAAC,KACd,MAAM,YAAY,OAAO;YACzB,mBAAmB,CAAC,SAAS,CAAC,GAAG,OAAO;gBACpC,qBAAqB;YACzB,CAAC,eAAe,CAAC,aAAa,EAAE,MAAM,CAAC,CAC9C,EACD,WAAW,CACP,cAAc,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,IAAI,CACvC,IAAI,CAAC,CAAC,CAAC;;QAEP,MAAM,CACF,CAAC,EAAC,MAAM,EAAC,KACL,MAAM,YAAY,OAAO;YACzB,CAAC,eAAe,CAAC,aAAa,EAAE,MAAM,CAAC,C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orate, __param } from 'tslib';
|
|
2
2
|
import { Inject, NgZone, ElementRef, HostBinding, ViewChild, Component, ChangeDetectionStrategy, NgModule } from '@angular/core';
|
|
3
3
|
import { WINDOW, ANIMATION_FRAME } from '@ng-web-apis/common';
|
|
4
|
-
import { POLLING_TIME, tuiZonefree, inRange, px, tuiAssertIsHTMLElement, getClosestFocusable, TuiDestroyService, TuiDropdownHostComponent, AbstractTuiPortalHostComponent, tuiPure, TuiActiveZoneModule, TuiOverscrollModule } from '@taiga-ui/cdk';
|
|
4
|
+
import { POLLING_TIME, tuiZonefree, tuiGetViewportWidth, inRange, px, tuiAssertIsHTMLElement, getClosestFocusable, TuiDestroyService, TuiDropdownHostComponent, AbstractTuiPortalHostComponent, tuiPure, TuiActiveZoneModule, TuiOverscrollModule } from '@taiga-ui/cdk';
|
|
5
5
|
import { tuiDropdownAnimation } from '@taiga-ui/core/animations';
|
|
6
6
|
import { DEFAULT_MARGIN, DEFAULT_MAX_WIDTH } from '@taiga-ui/core/constants';
|
|
7
7
|
import { TUI_DROPDOWN_DIRECTIVE, TUI_ANIMATION_OPTIONS } from '@taiga-ui/core/tokens';
|
|
@@ -113,10 +113,11 @@ let TuiDropdownBoxComponent = class TuiDropdownBoxComponent {
|
|
|
113
113
|
: 0;
|
|
114
114
|
const left = Math.ceil(directiveRect.left - hostRect.left - offset);
|
|
115
115
|
const right = Math.floor(hostRect.right - directiveRect.right - offset);
|
|
116
|
+
const viewportWidth = tuiGetViewportWidth(this.windowRef);
|
|
116
117
|
switch (this.getFinalAlign(style, directiveRect)) {
|
|
117
118
|
case 'left':
|
|
118
|
-
if (right + DEFAULT_MARGIN >
|
|
119
|
-
inRange(left + DEFAULT_MARGIN, 0,
|
|
119
|
+
if (right + DEFAULT_MARGIN > viewportWidth ||
|
|
120
|
+
inRange(left + DEFAULT_MARGIN, 0, viewportWidth)) {
|
|
120
121
|
style.left = px(left);
|
|
121
122
|
style.right = 'auto';
|
|
122
123
|
}
|
|
@@ -126,8 +127,8 @@ let TuiDropdownBoxComponent = class TuiDropdownBoxComponent {
|
|
|
126
127
|
}
|
|
127
128
|
break;
|
|
128
129
|
case 'right':
|
|
129
|
-
if (inRange(right + DEFAULT_MARGIN, 0,
|
|
130
|
-
left + DEFAULT_MARGIN >
|
|
130
|
+
if (inRange(right + DEFAULT_MARGIN, 0, viewportWidth) ||
|
|
131
|
+
left + DEFAULT_MARGIN > viewportWidth) {
|
|
131
132
|
style.left = 'auto';
|
|
132
133
|
style.right = px(right);
|
|
133
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-core-components-dropdown-box.js","sources":["ng://@taiga-ui/core/components/dropdown-box/dropdown-box.component.ts","ng://@taiga-ui/core/components/dropdown-box/dropdown-box.module.ts","ng://@taiga-ui/core/components/dropdown-box/taiga-ui-core-components-dropdown-box.ts"],"sourcesContent":["import {AnimationOptions} from '@angular/animations';\nimport {\n AfterViewChecked,\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n HostBinding,\n Inject,\n NgZone,\n ViewChild,\n} from '@angular/core';\nimport {ANIMATION_FRAME, WINDOW} from '@ng-web-apis/common';\nimport {\n AbstractTuiPortalHostComponent,\n getClosestFocusable,\n inRange,\n POLLING_TIME,\n px,\n TuiActiveZoneDirective,\n tuiAssertIsHTMLElement,\n TuiDestroyService,\n TuiDropdownHostComponent,\n TuiOverscrollModeT,\n tuiPure,\n tuiZonefree,\n} from '@taiga-ui/cdk';\nimport {tuiDropdownAnimation} from '@taiga-ui/core/animations';\nimport {DEFAULT_MARGIN, DEFAULT_MAX_WIDTH} from '@taiga-ui/core/constants';\nimport {TuiDropdownAnimation} from '@taiga-ui/core/enums';\nimport {TuiAnimationOptions, TuiDropdown} from '@taiga-ui/core/interfaces';\nimport {TUI_ANIMATION_OPTIONS, TUI_DROPDOWN_DIRECTIVE} from '@taiga-ui/core/tokens';\nimport {TuiHorizontalDirection, TuiVerticalDirection} from '@taiga-ui/core/types';\nimport {getScreenWidth} from '@taiga-ui/core/utils/dom';\nimport {fromEvent, merge, Observable} from 'rxjs';\nimport {takeUntil, throttleTime} from 'rxjs/operators';\n\n/**\n * This component is used to show template in a portal using default style of white rounded box with a shadow\n */\n// @bad TODO: OnPush\n// Ambient type cannot be used without dynamic https://github.com/angular/angular/issues/23395\n// @dynamic\n@Component({\n selector: 'tui-dropdown-box',\n templateUrl: './dropdown-box.template.html',\n styleUrls: ['./dropdown-box.style.less'],\n changeDetection: ChangeDetectionStrategy.Default,\n providers: [TuiDestroyService],\n animations: [tuiDropdownAnimation],\n})\nexport class TuiDropdownBoxComponent implements AfterViewChecked {\n private readonly animationTop = {\n value: TuiDropdownAnimation.FadeInTop,\n ...this.options,\n };\n\n private readonly animationBottom = {\n value: TuiDropdownAnimation.FadeInBottom,\n ...this.options,\n };\n\n /**\n * Is previous position on top (to prevent jumping up and down on scroll)\n */\n private prevDirectionIsTop = false;\n\n @HostBinding('@tuiDropdownAnimation')\n dropdownAnimation!: TuiAnimationOptions;\n\n @ViewChild('content', {read: ElementRef})\n readonly contentElementRef?: ElementRef<HTMLElement>;\n\n constructor(\n @Inject(TuiDestroyService)\n destroy$: TuiDestroyService,\n @Inject(NgZone) ngZone: NgZone,\n @Inject(TUI_DROPDOWN_DIRECTIVE) readonly directive: TuiDropdown,\n @Inject(WINDOW) private readonly windowRef: Window,\n @Inject(ElementRef) private readonly elementRef: ElementRef<HTMLElement>,\n @Inject(AbstractTuiPortalHostComponent)\n private readonly portalHost: TuiDropdownHostComponent,\n @Inject(TUI_ANIMATION_OPTIONS) private readonly options: AnimationOptions,\n @Inject(ANIMATION_FRAME) animationFrame$: Observable<number>,\n ) {\n merge(\n animationFrame$.pipe(throttleTime(POLLING_TIME)),\n this.directive.refresh$,\n fromEvent(this.windowRef, 'resize'),\n )\n .pipe(tuiZonefree(ngZone), takeUntil(destroy$))\n .subscribe(() => {\n this.calculatePositionAndSize();\n });\n }\n\n get overscroll(): TuiOverscrollModeT {\n return this.inModal ? 'all' : 'scroll';\n }\n\n @tuiPure\n getContext<T extends object>(\n context?: T,\n activeZone?: TuiActiveZoneDirective,\n ):\n | (T & {activeZone?: TuiActiveZoneDirective})\n | {activeZone?: TuiActiveZoneDirective} {\n return {...context, activeZone};\n }\n\n ngAfterViewChecked(): void {\n this.calculatePositionAndSize();\n }\n\n onTopFocus(): void {\n this.moveFocusOutside(true);\n }\n\n onBottomFocus(): void {\n this.moveFocusOutside(false);\n }\n\n @tuiPure\n private get inModal(): boolean {\n // @awful TODO: get rid of component tag name dependency\n return !!this.directive.host.closest('tui-dialog-host');\n }\n\n @tuiPure\n private get inOption(): boolean {\n // @awful TODO: get rid of component tag name dependency\n return !!this.directive.host.closest('[tuiOption]');\n }\n\n private calculatePositionAndSize(): void {\n const {clientRect} = this.directive;\n const {style} = this.elementRef.nativeElement;\n const hostRect = this.directive.fixed\n ? this.portalHost.fixedPositionOffset()\n : this.portalHost.clientRect;\n\n style.position = this.directive.fixed ? 'fixed' : 'absolute';\n\n this.calculateVerticalPosition(style, clientRect, hostRect);\n this.calculateHorizontalPosition(style, clientRect, hostRect);\n this.calculateWidth(style, clientRect);\n }\n\n private getFinalAlign(\n style: CSSStyleDeclaration,\n directiveRect: ClientRect,\n ): TuiHorizontalDirection {\n const dropdownRect = this.elementRef.nativeElement.getBoundingClientRect();\n const dropdownWidth = this.elementRef.nativeElement.offsetWidth;\n const screenWidth = getScreenWidth(this.windowRef.document);\n const isDropdownSizeHypotheticallyFitsViewport =\n directiveRect.left + dropdownWidth < screenWidth ||\n directiveRect.right - dropdownWidth > 0;\n const isDropdownSizeActuallyFitsViewport =\n dropdownRect.right <= screenWidth && dropdownRect.left >= 0;\n let finalAlign: TuiHorizontalDirection = this.directive.align;\n\n switch (this.directive.align) {\n case 'left':\n if (\n isDropdownSizeHypotheticallyFitsViewport &&\n dropdownRect.right > screenWidth\n ) {\n finalAlign = 'right';\n }\n\n break;\n case 'right':\n if (isDropdownSizeHypotheticallyFitsViewport && dropdownRect.left < 0) {\n finalAlign = 'left';\n }\n\n break;\n }\n\n if (style.right === 'auto' && isDropdownSizeActuallyFitsViewport) {\n finalAlign = 'left';\n }\n\n if (style.left === 'auto' && isDropdownSizeActuallyFitsViewport) {\n finalAlign = 'right';\n }\n\n return finalAlign;\n }\n\n /**\n * Calculates horizontal position\n *\n * @param style dropdownBox elementRef styles object\n * @param directiveRect ClientRect of hosting directive\n * @param hostRect ClientRect of portal host\n */\n private calculateHorizontalPosition(\n style: CSSStyleDeclaration,\n directiveRect: ClientRect,\n hostRect: ClientRect,\n ): void {\n const offset = this.directive.sided\n ? this.elementRef.nativeElement.getBoundingClientRect().width + DEFAULT_MARGIN\n : 0;\n const left = Math.ceil(directiveRect.left - hostRect.left - offset);\n const right = Math.floor(hostRect.right - directiveRect.right - offset);\n\n switch (this.getFinalAlign(style, directiveRect)) {\n case 'left':\n if (\n right + DEFAULT_MARGIN > this.windowRef.innerWidth ||\n inRange(left + DEFAULT_MARGIN, 0, this.windowRef.innerWidth)\n ) {\n style.left = px(left);\n style.right = 'auto';\n } else {\n style.left = 'auto';\n style.right = px(right);\n }\n\n break;\n case 'right':\n if (\n inRange(right + DEFAULT_MARGIN, 0, this.windowRef.innerWidth) ||\n left + DEFAULT_MARGIN > this.windowRef.innerWidth\n ) {\n style.left = 'auto';\n style.right = px(right);\n } else {\n style.left = px(left);\n style.right = 'auto';\n }\n\n break;\n }\n }\n\n /**\n * Calculates vertical position and height\n *\n * @param style dropdownBox elementRef styles object\n * @param directiveRect ClientRect of hosting directive\n * @param hostRect ClientRect of portal host\n */\n private calculateVerticalPosition(\n style: CSSStyleDeclaration,\n directiveRect: ClientRect,\n hostRect: ClientRect,\n ): void {\n const windowHeight = this.windowRef.innerHeight;\n // Maximum height of the box\n const boxHeightLimit = Math.min(\n this.directive.maxHeight,\n windowHeight - DEFAULT_MARGIN * 2,\n );\n const offset = this.directive.sided\n ? DEFAULT_MARGIN - directiveRect.height\n : DEFAULT_MARGIN * 2;\n const topAvailableHeight = directiveRect.top - offset;\n const bottomAvailableHeight = windowHeight - directiveRect.bottom - offset;\n const finalDirection = this.getFinalDirection(directiveRect);\n const optionOffset = this.inOption ? DEFAULT_MARGIN * 2 : 0;\n\n this.prevDirectionIsTop = finalDirection === 'top';\n\n if (finalDirection === 'top') {\n this.dropdownAnimation = this.animationBottom;\n\n style.maxHeight = px(Math.min(boxHeightLimit, topAvailableHeight));\n style.top = 'auto';\n style.bottom = px(\n hostRect.bottom -\n directiveRect.top -\n DEFAULT_MARGIN +\n offset -\n optionOffset,\n );\n } else {\n this.dropdownAnimation = this.animationTop;\n\n style.maxHeight = px(Math.min(boxHeightLimit, bottomAvailableHeight));\n style.top = px(\n directiveRect.bottom -\n hostRect.top -\n DEFAULT_MARGIN +\n offset -\n optionOffset,\n );\n style.bottom = 'auto';\n }\n }\n\n private getFinalDirection(directiveRect: ClientRect): TuiVerticalDirection | null {\n const windowHeight = this.windowRef.innerHeight;\n const offset = this.directive.sided\n ? DEFAULT_MARGIN - directiveRect.height\n : DEFAULT_MARGIN * 2;\n\n // Maximum space available on top and on the bottom in the viewport\n const topAvailableHeight = directiveRect.top - offset;\n const bottomAvailableHeight = windowHeight - directiveRect.bottom - offset;\n\n let finalDirection: TuiVerticalDirection | null = null;\n\n // Given direction is applied if we can fit the box in the limits that way\n switch (this.directive.direction) {\n case 'top':\n if (topAvailableHeight >= this.directive.minHeight) {\n finalDirection = 'top';\n }\n\n break;\n case 'bottom':\n if (bottomAvailableHeight >= this.directive.minHeight) {\n finalDirection = 'bottom';\n }\n\n break;\n }\n\n // Maximum height of the box\n const boxHeightLimit = Math.min(\n this.directive.maxHeight,\n windowHeight - DEFAULT_MARGIN * 2,\n );\n\n // Choose direction if given direction did not fit\n if (finalDirection === null && this.contentElementRef) {\n // Box height if it fits without scroll\n const visualHeight = Math.min(\n this.contentElementRef.nativeElement.getBoundingClientRect().height +\n (this.elementRef.nativeElement.offsetHeight -\n this.elementRef.nativeElement.clientHeight),\n boxHeightLimit,\n );\n\n // If there is enough space to fit below without scroll,\n // choose 'bottom', unless it was previously on the top\n if (this.prevDirectionIsTop && topAvailableHeight >= visualHeight) {\n finalDirection = 'top';\n } else if (bottomAvailableHeight >= visualHeight) {\n finalDirection = 'bottom';\n } else {\n // Corner case — select direction with more space\n finalDirection =\n bottomAvailableHeight >= topAvailableHeight ? 'bottom' : 'top';\n }\n }\n\n return finalDirection;\n }\n\n /**\n * Calculates width\n *\n * @param style dropdownBox elementRef styles object\n * @param directiveRect ClientRect of hosting directive\n */\n private calculateWidth(style: CSSStyleDeclaration, directiveRect: ClientRect): void {\n style.width =\n this.directive.limitMinWidth === 'fixed' && !this.directive.sided\n ? px(directiveRect.width)\n : '';\n\n if (this.directive.limitMinWidth === 'min' && !this.directive.sided) {\n style.minWidth = px(directiveRect.width);\n style.maxWidth = px(DEFAULT_MAX_WIDTH);\n\n return;\n }\n\n style.minWidth = '';\n style.maxWidth = '';\n }\n\n private moveFocusOutside(previous: boolean): void {\n const {host} = this.directive;\n const {ownerDocument} = host;\n const root = ownerDocument ? ownerDocument.body : host;\n\n tuiAssertIsHTMLElement(host);\n\n let focusable = getClosestFocusable(host, previous, root);\n\n while (focusable !== null && host.contains(focusable)) {\n focusable = getClosestFocusable(focusable, previous, root);\n }\n\n focusable?.focus();\n }\n}\n","import {NgModule} from '@angular/core';\nimport {TuiActiveZoneModule, TuiOverscrollModule} from '@taiga-ui/cdk';\nimport {TuiScrollbarModule} from '@taiga-ui/core/components/scrollbar';\nimport {TuiModeModule} from '@taiga-ui/core/directives/mode';\nimport {PolymorpheusModule} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiDropdownBoxComponent} from './dropdown-box.component';\n\n@NgModule({\n imports: [\n TuiActiveZoneModule,\n PolymorpheusModule,\n TuiOverscrollModule,\n TuiScrollbarModule,\n TuiModeModule,\n ],\n entryComponents: [TuiDropdownBoxComponent],\n declarations: [TuiDropdownBoxComponent],\n exports: [TuiDropdownBoxComponent],\n})\nexport class TuiDropdownBoxMod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AAe,EAAE,CAAC,uBAAuB,CAAC;QAC1C,YAAY,EAAE,CAAC,uBAAuB,CAAC;QACvC,OAAO,EAAE,CAAC,uBAAuB,CAAC;KACrC,CAAC;GACW,oBAAoB,CAAG;;ACpBpC;;;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-core-components-dropdown-box.js","sources":["ng://@taiga-ui/core/components/dropdown-box/dropdown-box.component.ts","ng://@taiga-ui/core/components/dropdown-box/dropdown-box.module.ts","ng://@taiga-ui/core/components/dropdown-box/taiga-ui-core-components-dropdown-box.ts"],"sourcesContent":["import {AnimationOptions} from '@angular/animations';\nimport {\n AfterViewChecked,\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n HostBinding,\n Inject,\n NgZone,\n ViewChild,\n} from '@angular/core';\nimport {ANIMATION_FRAME, WINDOW} from '@ng-web-apis/common';\nimport {\n AbstractTuiPortalHostComponent,\n getClosestFocusable,\n inRange,\n POLLING_TIME,\n px,\n TuiActiveZoneDirective,\n tuiAssertIsHTMLElement,\n TuiDestroyService,\n TuiDropdownHostComponent,\n tuiGetViewportWidth,\n TuiOverscrollModeT,\n tuiPure,\n tuiZonefree,\n} from '@taiga-ui/cdk';\nimport {tuiDropdownAnimation} from '@taiga-ui/core/animations';\nimport {DEFAULT_MARGIN, DEFAULT_MAX_WIDTH} from '@taiga-ui/core/constants';\nimport {TuiDropdownAnimation} from '@taiga-ui/core/enums';\nimport {TuiAnimationOptions, TuiDropdown} from '@taiga-ui/core/interfaces';\nimport {TUI_ANIMATION_OPTIONS, TUI_DROPDOWN_DIRECTIVE} from '@taiga-ui/core/tokens';\nimport {TuiHorizontalDirection, TuiVerticalDirection} from '@taiga-ui/core/types';\nimport {getScreenWidth} from '@taiga-ui/core/utils/dom';\nimport {fromEvent, merge, Observable} from 'rxjs';\nimport {takeUntil, throttleTime} from 'rxjs/operators';\n\n/**\n * This component is used to show template in a portal using default style of white rounded box with a shadow\n */\n// @bad TODO: OnPush\n// Ambient type cannot be used without dynamic https://github.com/angular/angular/issues/23395\n// @dynamic\n@Component({\n selector: 'tui-dropdown-box',\n templateUrl: './dropdown-box.template.html',\n styleUrls: ['./dropdown-box.style.less'],\n changeDetection: ChangeDetectionStrategy.Default,\n providers: [TuiDestroyService],\n animations: [tuiDropdownAnimation],\n})\nexport class TuiDropdownBoxComponent implements AfterViewChecked {\n private readonly animationTop = {\n value: TuiDropdownAnimation.FadeInTop,\n ...this.options,\n };\n\n private readonly animationBottom = {\n value: TuiDropdownAnimation.FadeInBottom,\n ...this.options,\n };\n\n /**\n * Is previous position on top (to prevent jumping up and down on scroll)\n */\n private prevDirectionIsTop = false;\n\n @HostBinding('@tuiDropdownAnimation')\n dropdownAnimation!: TuiAnimationOptions;\n\n @ViewChild('content', {read: ElementRef})\n readonly contentElementRef?: ElementRef<HTMLElement>;\n\n constructor(\n @Inject(TuiDestroyService)\n destroy$: TuiDestroyService,\n @Inject(NgZone) ngZone: NgZone,\n @Inject(TUI_DROPDOWN_DIRECTIVE) readonly directive: TuiDropdown,\n @Inject(WINDOW) private readonly windowRef: Window,\n @Inject(ElementRef) private readonly elementRef: ElementRef<HTMLElement>,\n @Inject(AbstractTuiPortalHostComponent)\n private readonly portalHost: TuiDropdownHostComponent,\n @Inject(TUI_ANIMATION_OPTIONS) private readonly options: AnimationOptions,\n @Inject(ANIMATION_FRAME) animationFrame$: Observable<number>,\n ) {\n merge(\n animationFrame$.pipe(throttleTime(POLLING_TIME)),\n this.directive.refresh$,\n fromEvent(this.windowRef, 'resize'),\n )\n .pipe(tuiZonefree(ngZone), takeUntil(destroy$))\n .subscribe(() => {\n this.calculatePositionAndSize();\n });\n }\n\n get overscroll(): TuiOverscrollModeT {\n return this.inModal ? 'all' : 'scroll';\n }\n\n @tuiPure\n getContext<T extends object>(\n context?: T,\n activeZone?: TuiActiveZoneDirective,\n ):\n | (T & {activeZone?: TuiActiveZoneDirective})\n | {activeZone?: TuiActiveZoneDirective} {\n return {...context, activeZone};\n }\n\n ngAfterViewChecked(): void {\n this.calculatePositionAndSize();\n }\n\n onTopFocus(): void {\n this.moveFocusOutside(true);\n }\n\n onBottomFocus(): void {\n this.moveFocusOutside(false);\n }\n\n @tuiPure\n private get inModal(): boolean {\n // @awful TODO: get rid of component tag name dependency\n return !!this.directive.host.closest('tui-dialog-host');\n }\n\n @tuiPure\n private get inOption(): boolean {\n // @awful TODO: get rid of component tag name dependency\n return !!this.directive.host.closest('[tuiOption]');\n }\n\n private calculatePositionAndSize(): void {\n const {clientRect} = this.directive;\n const {style} = this.elementRef.nativeElement;\n const hostRect = this.directive.fixed\n ? this.portalHost.fixedPositionOffset()\n : this.portalHost.clientRect;\n\n style.position = this.directive.fixed ? 'fixed' : 'absolute';\n\n this.calculateVerticalPosition(style, clientRect, hostRect);\n this.calculateHorizontalPosition(style, clientRect, hostRect);\n this.calculateWidth(style, clientRect);\n }\n\n private getFinalAlign(\n style: CSSStyleDeclaration,\n directiveRect: ClientRect,\n ): TuiHorizontalDirection {\n const dropdownRect = this.elementRef.nativeElement.getBoundingClientRect();\n const dropdownWidth = this.elementRef.nativeElement.offsetWidth;\n const screenWidth = getScreenWidth(this.windowRef.document);\n const isDropdownSizeHypotheticallyFitsViewport =\n directiveRect.left + dropdownWidth < screenWidth ||\n directiveRect.right - dropdownWidth > 0;\n const isDropdownSizeActuallyFitsViewport =\n dropdownRect.right <= screenWidth && dropdownRect.left >= 0;\n let finalAlign: TuiHorizontalDirection = this.directive.align;\n\n switch (this.directive.align) {\n case 'left':\n if (\n isDropdownSizeHypotheticallyFitsViewport &&\n dropdownRect.right > screenWidth\n ) {\n finalAlign = 'right';\n }\n\n break;\n case 'right':\n if (isDropdownSizeHypotheticallyFitsViewport && dropdownRect.left < 0) {\n finalAlign = 'left';\n }\n\n break;\n }\n\n if (style.right === 'auto' && isDropdownSizeActuallyFitsViewport) {\n finalAlign = 'left';\n }\n\n if (style.left === 'auto' && isDropdownSizeActuallyFitsViewport) {\n finalAlign = 'right';\n }\n\n return finalAlign;\n }\n\n /**\n * Calculates horizontal position\n *\n * @param style dropdownBox elementRef styles object\n * @param directiveRect ClientRect of hosting directive\n * @param hostRect ClientRect of portal host\n */\n private calculateHorizontalPosition(\n style: CSSStyleDeclaration,\n directiveRect: ClientRect,\n hostRect: ClientRect,\n ): void {\n const offset = this.directive.sided\n ? this.elementRef.nativeElement.getBoundingClientRect().width + DEFAULT_MARGIN\n : 0;\n const left = Math.ceil(directiveRect.left - hostRect.left - offset);\n const right = Math.floor(hostRect.right - directiveRect.right - offset);\n const viewportWidth = tuiGetViewportWidth(this.windowRef);\n\n switch (this.getFinalAlign(style, directiveRect)) {\n case 'left':\n if (\n right + DEFAULT_MARGIN > viewportWidth ||\n inRange(left + DEFAULT_MARGIN, 0, viewportWidth)\n ) {\n style.left = px(left);\n style.right = 'auto';\n } else {\n style.left = 'auto';\n style.right = px(right);\n }\n\n break;\n case 'right':\n if (\n inRange(right + DEFAULT_MARGIN, 0, viewportWidth) ||\n left + DEFAULT_MARGIN > viewportWidth\n ) {\n style.left = 'auto';\n style.right = px(right);\n } else {\n style.left = px(left);\n style.right = 'auto';\n }\n\n break;\n }\n }\n\n /**\n * Calculates vertical position and height\n *\n * @param style dropdownBox elementRef styles object\n * @param directiveRect ClientRect of hosting directive\n * @param hostRect ClientRect of portal host\n */\n private calculateVerticalPosition(\n style: CSSStyleDeclaration,\n directiveRect: ClientRect,\n hostRect: ClientRect,\n ): void {\n const windowHeight = this.windowRef.innerHeight;\n // Maximum height of the box\n const boxHeightLimit = Math.min(\n this.directive.maxHeight,\n windowHeight - DEFAULT_MARGIN * 2,\n );\n const offset = this.directive.sided\n ? DEFAULT_MARGIN - directiveRect.height\n : DEFAULT_MARGIN * 2;\n const topAvailableHeight = directiveRect.top - offset;\n const bottomAvailableHeight = windowHeight - directiveRect.bottom - offset;\n const finalDirection = this.getFinalDirection(directiveRect);\n const optionOffset = this.inOption ? DEFAULT_MARGIN * 2 : 0;\n\n this.prevDirectionIsTop = finalDirection === 'top';\n\n if (finalDirection === 'top') {\n this.dropdownAnimation = this.animationBottom;\n\n style.maxHeight = px(Math.min(boxHeightLimit, topAvailableHeight));\n style.top = 'auto';\n style.bottom = px(\n hostRect.bottom -\n directiveRect.top -\n DEFAULT_MARGIN +\n offset -\n optionOffset,\n );\n } else {\n this.dropdownAnimation = this.animationTop;\n\n style.maxHeight = px(Math.min(boxHeightLimit, bottomAvailableHeight));\n style.top = px(\n directiveRect.bottom -\n hostRect.top -\n DEFAULT_MARGIN +\n offset -\n optionOffset,\n );\n style.bottom = 'auto';\n }\n }\n\n private getFinalDirection(directiveRect: ClientRect): TuiVerticalDirection | null {\n const windowHeight = this.windowRef.innerHeight;\n const offset = this.directive.sided\n ? DEFAULT_MARGIN - directiveRect.height\n : DEFAULT_MARGIN * 2;\n\n // Maximum space available on top and on the bottom in the viewport\n const topAvailableHeight = directiveRect.top - offset;\n const bottomAvailableHeight = windowHeight - directiveRect.bottom - offset;\n\n let finalDirection: TuiVerticalDirection | null = null;\n\n // Given direction is applied if we can fit the box in the limits that way\n switch (this.directive.direction) {\n case 'top':\n if (topAvailableHeight >= this.directive.minHeight) {\n finalDirection = 'top';\n }\n\n break;\n case 'bottom':\n if (bottomAvailableHeight >= this.directive.minHeight) {\n finalDirection = 'bottom';\n }\n\n break;\n }\n\n // Maximum height of the box\n const boxHeightLimit = Math.min(\n this.directive.maxHeight,\n windowHeight - DEFAULT_MARGIN * 2,\n );\n\n // Choose direction if given direction did not fit\n if (finalDirection === null && this.contentElementRef) {\n // Box height if it fits without scroll\n const visualHeight = Math.min(\n this.contentElementRef.nativeElement.getBoundingClientRect().height +\n (this.elementRef.nativeElement.offsetHeight -\n this.elementRef.nativeElement.clientHeight),\n boxHeightLimit,\n );\n\n // If there is enough space to fit below without scroll,\n // choose 'bottom', unless it was previously on the top\n if (this.prevDirectionIsTop && topAvailableHeight >= visualHeight) {\n finalDirection = 'top';\n } else if (bottomAvailableHeight >= visualHeight) {\n finalDirection = 'bottom';\n } else {\n // Corner case — select direction with more space\n finalDirection =\n bottomAvailableHeight >= topAvailableHeight ? 'bottom' : 'top';\n }\n }\n\n return finalDirection;\n }\n\n /**\n * Calculates width\n *\n * @param style dropdownBox elementRef styles object\n * @param directiveRect ClientRect of hosting directive\n */\n private calculateWidth(style: CSSStyleDeclaration, directiveRect: ClientRect): void {\n style.width =\n this.directive.limitMinWidth === 'fixed' && !this.directive.sided\n ? px(directiveRect.width)\n : '';\n\n if (this.directive.limitMinWidth === 'min' && !this.directive.sided) {\n style.minWidth = px(directiveRect.width);\n style.maxWidth = px(DEFAULT_MAX_WIDTH);\n\n return;\n }\n\n style.minWidth = '';\n style.maxWidth = '';\n }\n\n private moveFocusOutside(previous: boolean): void {\n const {host} = this.directive;\n const {ownerDocument} = host;\n const root = ownerDocument ? ownerDocument.body : host;\n\n tuiAssertIsHTMLElement(host);\n\n let focusable = getClosestFocusable(host, previous, root);\n\n while (focusable !== null && host.contains(focusable)) {\n focusable = getClosestFocusable(focusable, previous, root);\n }\n\n focusable?.focus();\n }\n}\n","import {NgModule} from '@angular/core';\nimport {TuiActiveZoneModule, TuiOverscrollModule} from '@taiga-ui/cdk';\nimport {TuiScrollbarModule} from '@taiga-ui/core/components/scrollbar';\nimport {TuiModeModule} from '@taiga-ui/core/directives/mode';\nimport {PolymorpheusModule} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiDropdownBoxComponent} from './dropdown-box.component';\n\n@NgModule({\n imports: [\n TuiActiveZoneModule,\n PolymorpheusModule,\n TuiOverscrollModule,\n TuiScrollbarModule,\n TuiModeModule,\n ],\n entryComponents: [TuiDropdownBoxComponent],\n declarations: [TuiDropdownBoxComponent],\n exports: [TuiDropdownBoxComponent],\n})\nexport class TuiDropdownBoxModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAqCA;;;AAGA;AACA;AACA;IASa,uBAAuB,GAApC,MAAa,uBAAuB;IAsBhC,YAEI,QAA2B,EAC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ARENT_ANIMATION, tuiZonefree, px, TuiDestroyService, tuiPure, TuiH
|
|
|
5
5
|
import { tuiFadeIn } from '@taiga-ui/core/animations';
|
|
6
6
|
import { TuiPointerHintDirective } from '@taiga-ui/core/directives/pointer-hint';
|
|
7
7
|
import { TUI_ANIMATION_OPTIONS, TUI_MEDIA } from '@taiga-ui/core/tokens';
|
|
8
|
+
import { tuiIsMobile } from '@taiga-ui/core/utils';
|
|
8
9
|
import { PolymorpheusComponent, POLYMORPHEUS_CONTEXT, PolymorpheusModule } from '@tinkoff/ng-polymorpheus';
|
|
9
10
|
import { Observable } from 'rxjs';
|
|
10
11
|
import { takeUntil } from 'rxjs/operators';
|
|
@@ -99,7 +100,7 @@ let TuiHintBoxComponent = class TuiHintBoxComponent {
|
|
|
99
100
|
return this.hint.mode;
|
|
100
101
|
}
|
|
101
102
|
get isMobile() {
|
|
102
|
-
return this.windowRef
|
|
103
|
+
return tuiIsMobile(this.windowRef, this.media);
|
|
103
104
|
}
|
|
104
105
|
/**
|
|
105
106
|
* Calculates wrapper position.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-core-components-hints-host.js","sources":["ng://@taiga-ui/core/components/hints-host/hints-host.component.ts","ng://@taiga-ui/core/components/hints-host/hint-box/hint-box.component.ts","ng://@taiga-ui/core/components/hints-host/hint-box/hint-box.module.ts","ng://@taiga-ui/core/components/hints-host/hints-host.module.ts","ng://@taiga-ui/core/components/hints-host/taiga-ui-core-components-hints-host.ts"],"sourcesContent":["import {ChangeDetectionStrategy, Component, ElementRef, Inject} from '@angular/core';\nimport {TUI_PARENT_ANIMATION} from '@taiga-ui/cdk';\nimport {AbstractTuiHint} from '@taiga-ui/core/abstract';\nimport {TuiHintDirective} from '@taiga-ui/core/directives/hint';\nimport {TuiHintService} from '@taiga-ui/core/services';\nimport {PolymorpheusComponent} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiHintBoxComponent} from './hint-box/hint-box.component';\n\n@Component({\n selector: 'tui-hints-host',\n templateUrl: './hints-host.template.html',\n styleUrls: ['./hints-host.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n animations: [TUI_PARENT_ANIMATION],\n host: {\n 'aria-live': 'polite',\n },\n})\nexport class TuiHintsHostComponent {\n readonly component = new PolymorpheusComponent(TuiHintBoxComponent);\n\n constructor(\n @Inject(ElementRef) private readonly elementRef: ElementRef<HTMLElement>,\n @Inject(TuiHintService) readonly hints$: TuiHintService,\n ) {}\n\n get clientRect(): ClientRect {\n return this.elementRef.nativeElement.getBoundingClientRect();\n }\n\n onHovered(hovered: boolean, directive: AbstractTuiHint): void {\n if (directive instanceof TuiHintDirective) {\n directive.componentHovered$.next(hovered);\n }\n }\n}\n","import {AnimationOptions} from '@angular/animations';\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n forwardRef,\n HostBinding,\n Inject,\n NgZone,\n ViewChild,\n} from '@angular/core';\nimport {ANIMATION_FRAME, WINDOW} from '@ng-web-apis/common';\nimport {\n px,\n TuiContextWithImplicit,\n TuiDestroyService,\n tuiPure,\n tuiZonefree,\n} from '@taiga-ui/cdk';\nimport {AbstractTuiHint} from '@taiga-ui/core/abstract';\nimport {tuiFadeIn} from '@taiga-ui/core/animations';\nimport {TuiPointerHintDirective} from '@taiga-ui/core/directives/pointer-hint';\nimport {TuiMedia} from '@taiga-ui/core/interfaces';\nimport {TUI_ANIMATION_OPTIONS, TUI_MEDIA} from '@taiga-ui/core/tokens';\nimport {TuiDirection, TuiHintModeT} from '@taiga-ui/core/types';\nimport {POLYMORPHEUS_CONTEXT} from '@tinkoff/ng-polymorpheus';\nimport {Observable} from 'rxjs';\nimport {takeUntil} from 'rxjs/operators';\n\nimport {TuiHintsHostComponent} from '../hints-host.component';\n\nconst SPACE = 8;\nconst BORDER_WIDTH = 1;\nconst LEFT_PADDING = 16;\nconst TOP_PADDING = 12;\nconst ARROW_SIZE = 8;\nconst ARROW_OFFSET = 16;\nconst ARROWHEAD_OFFSET = ARROW_OFFSET + (ARROW_SIZE * Math.sqrt(2)) / 2;\nconst reverseDirectionsVertical: {[key in TuiDirection]: TuiDirection} = {\n 'top-left': 'bottom-left',\n 'top-right': 'bottom-right',\n 'bottom-left': 'top-left',\n 'bottom-right': 'top-right',\n left: 'right',\n right: 'left',\n 'top-middle': 'bottom-middle',\n 'bottom-middle': 'top-middle',\n};\nconst reverseDirectionsHorizontal: {[key in TuiDirection]: TuiDirection} = {\n 'top-left': 'top-right',\n 'top-right': 'top-left',\n 'bottom-left': 'bottom-right',\n 'bottom-right': 'bottom-left',\n left: 'right',\n right: 'left',\n 'top-middle': 'top-middle',\n 'bottom-middle': 'bottom-middle',\n};\n\n// TODO: consider abstracting UI and move to CDK, split hint and overflow\n// Ambient type cannot be used without dynamic https://github.com/angular/angular/issues/23395\n// @dynamic\n@Component({\n selector: 'tui-hint-box[hint]',\n templateUrl: './hint-box.template.html',\n styleUrls: ['./hint-box.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [TuiDestroyService],\n animations: [tuiFadeIn],\n})\nexport class TuiHintBoxComponent {\n @ViewChild('arrow')\n private readonly arrow?: ElementRef<HTMLElement>;\n\n @HostBinding('@tuiFadeIn')\n readonly animation = {value: '', ...this.options} as const;\n\n constructor(\n @Inject(ANIMATION_FRAME) animationFrame$: Observable<number>,\n @Inject(TuiDestroyService) destroy$: Observable<void>,\n @Inject(NgZone) ngZone: NgZone,\n @Inject(TUI_ANIMATION_OPTIONS) private readonly options: AnimationOptions,\n @Inject(ElementRef) private readonly elementRef: ElementRef<HTMLElement>,\n @Inject(WINDOW) private readonly windowRef: Window,\n @Inject(TUI_MEDIA) private readonly media: TuiMedia,\n @Inject(forwardRef(() => TuiHintsHostComponent))\n private readonly hintsHost: TuiHintsHostComponent,\n @Inject(POLYMORPHEUS_CONTEXT)\n private readonly context: TuiContextWithImplicit<AbstractTuiHint>,\n ) {\n animationFrame$\n .pipe(tuiZonefree(ngZone), takeUntil(destroy$))\n .subscribe(() => this.calculatePosition());\n }\n\n get hint(): AbstractTuiHint {\n return this.context.$implicit;\n }\n\n @tuiPure\n @HostBinding('class._untouchable')\n get isUntouchable(): boolean {\n return this.hint instanceof TuiPointerHintDirective;\n }\n\n @HostBinding('attr.data-mode')\n get mode(): TuiHintModeT | null {\n return this.hint.mode;\n }\n\n get isMobile(): boolean {\n return this.windowRef.innerWidth <= this.media.mobile;\n }\n\n /**\n * Calculates wrapper position.\n * Styles are set directly to avoid visual shake of element\n */\n private calculatePosition(): void {\n if (this.mode !== 'overflow') {\n this.calculateCoordinates();\n } else {\n this.setOverflowStyles();\n }\n }\n\n private calculateCoordinates(): void {\n if (this.isMobile) {\n this.calculateMobileCoordinates();\n\n return;\n }\n\n const hostRect = this.hint.getElementClientRect();\n const portalRect = this.hintsHost.clientRect;\n const tooltip = this.elementRef.nativeElement;\n const {style} = tooltip;\n const tooltipRect = tooltip.getBoundingClientRect();\n const isHostLong = hostRect.width > ARROWHEAD_OFFSET * 2;\n const directions: TuiDirection[] = [\n 'left',\n 'right',\n 'bottom-left',\n 'bottom-right',\n 'bottom-middle',\n 'top-left',\n 'top-right',\n 'top-middle',\n ];\n\n let top = 0;\n let left = 0;\n let {direction} = this.hint;\n\n const horizontalTop =\n hostRect.top + hostRect.height / 2 - tooltipRect.height / 2 - portalRect.top;\n const horizontalLeft =\n hostRect.left - tooltipRect.width - SPACE - portalRect.left;\n const horizontalRight = hostRect.left + hostRect.width + SPACE - portalRect.left;\n const verticalBottom = hostRect.bottom + SPACE - portalRect.top;\n const verticalTop = hostRect.top - tooltipRect.height - SPACE - portalRect.top;\n const verticalRight = isHostLong\n ? hostRect.left - portalRect.left\n : hostRect.left + hostRect.width / 2 - ARROWHEAD_OFFSET - portalRect.left;\n const verticalLeft = isHostLong\n ? hostRect.left - tooltipRect.width + hostRect.width - portalRect.left\n : hostRect.left -\n tooltipRect.width +\n hostRect.width / 2 +\n ARROWHEAD_OFFSET -\n portalRect.left;\n const verticalMiddle =\n hostRect.left - tooltipRect.width / 2 + hostRect.width / 2 - portalRect.left;\n\n directions.splice(directions.indexOf(direction), 1);\n\n // eslint-disable-next-line no-constant-condition\n while (true) {\n switch (direction) {\n case 'left':\n top = horizontalTop;\n left = horizontalLeft;\n break;\n case 'right':\n top = horizontalTop;\n left = horizontalRight;\n break;\n case 'top-right':\n top = verticalTop;\n left = verticalRight;\n break;\n case 'top-left':\n top = verticalTop;\n left = verticalLeft;\n break;\n case 'bottom-right':\n top = verticalBottom;\n left = verticalRight;\n break;\n case 'bottom-left':\n top = verticalBottom;\n left = verticalLeft;\n break;\n case 'bottom-middle':\n top = verticalBottom;\n left = verticalMiddle;\n break;\n case 'top-middle':\n top = verticalTop;\n left = verticalMiddle;\n break;\n }\n\n const verticalFit =\n top + portalRect.top > SPACE &&\n top + tooltipRect.height + SPACE + portalRect.top <\n this.windowRef.innerHeight;\n const horizontalFit =\n left > SPACE &&\n left + tooltipRect.width + SPACE + portalRect.left < portalRect.width;\n\n if (directions.length === 0 || (verticalFit && horizontalFit)) {\n break;\n }\n\n direction = verticalFit\n ? reverseDirectionsHorizontal[direction]\n : reverseDirectionsVertical[direction];\n direction =\n directions.splice(directions.indexOf(direction), 1)[0] || direction;\n }\n\n style.top = px(top);\n style.left = px(left);\n\n tooltip.setAttribute('data-tui-host-direction', direction);\n }\n\n private calculateMobileCoordinates(): void {\n const hostRect = this.hint.getElementClientRect();\n const portalRect = this.hintsHost.clientRect;\n const tooltip = this.elementRef.nativeElement;\n const {style} = tooltip;\n const tooltipRect = tooltip.getBoundingClientRect();\n const verticalTop = hostRect.top - tooltipRect.height - SPACE - portalRect.top;\n const verticalBottom = hostRect.bottom + SPACE - portalRect.top;\n const verticalTopFit =\n verticalTop + portalRect.top > SPACE &&\n hostRect.top < this.windowRef.innerHeight;\n const verticalBottomFit =\n hostRect.bottom > 0 &&\n hostRect.bottom + 2 * SPACE + tooltipRect.height < this.windowRef.innerHeight;\n const direction =\n (this.hint.direction.includes('top') && verticalTopFit) || !verticalBottomFit\n ? 'top'\n : 'bottom';\n const attemptedLeft =\n portalRect.left + hostRect.left + hostRect.width / 2 - tooltipRect.width / 2;\n const left = Math.max(\n attemptedLeft + tooltipRect.width + SPACE > portalRect.right\n ? portalRect.right - SPACE - tooltipRect.width\n : attemptedLeft,\n SPACE * 2,\n );\n\n style.left = px(left);\n style.top = direction === 'top' ? px(verticalTop) : px(verticalBottom);\n\n if (this.arrow) {\n this.arrow.nativeElement.style.left = px(\n hostRect.left <= SPACE * 2 && hostRect.width > ARROW_OFFSET * 2\n ? ARROW_OFFSET\n : hostRect.left + hostRect.width / 2 - left - ARROW_SIZE / 2,\n );\n }\n\n tooltip.setAttribute('data-tui-host-direction', direction);\n }\n\n private setOverflowStyles(): void {\n const hostRect = this.hint.getElementClientRect();\n const {style} = this.elementRef.nativeElement;\n\n style.top = px(hostRect.top - window.innerHeight - TOP_PADDING - BORDER_WIDTH);\n style.left = px(hostRect.left - LEFT_PADDING - BORDER_WIDTH);\n style.width = px(hostRect.width + LEFT_PADDING * 2 + BORDER_WIDTH * 2);\n }\n}\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {PolymorpheusModule} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiHintBoxComponent} from './hint-box.component';\n\n@NgModule({\n imports: [CommonModule, PolymorpheusModule],\n declarations: [TuiHintBoxComponent],\n exports: [TuiHintBoxComponent],\n entryComponents: [TuiHintBoxComponent],\n})\nexport class TuiHintBoxModule {}\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {TuiActiveZoneModule, TuiHoveredModule} from '@taiga-ui/cdk';\nimport {PolymorpheusModule} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiHintBoxModule} from './hint-box/hint-box.module';\nimport {TuiHintsHostComponent} from './hints-host.component';\n\n@NgModule({\n imports: [\n CommonModule,\n PolymorpheusModule,\n TuiHoveredModule,\n TuiHintBoxModule,\n TuiActiveZoneModule,\n ],\n declarations: [TuiHintsHostComponent],\n exports: [TuiHintsHostComponent],\n})\nexport class TuiHintsHostModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;IAmBa,qBAAqB,GAAlC,MAAa,qBAAqB;IAG9B,YACyC,UAAmC,EACvC,MAAsB;QADlB,eAAU,GAAV,UAAU,CAAyB;QACvC,WAAM,GAAN,MAAM,CAAgB;QAJlD,cAAS,GAAG,IAAI,qBAAqB,CAAC,mBAAmB,CAAC,CAAC;KAKhE;IAEJ,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,qBAAqB,EAAE,CAAC;KAChE;IAED,SAAS,CAAC,OAAgB,EAAE,SAA0B;QAClD,IAAI,SAAS,YAAY,gBAAgB,EAAE;YACvC,SAAS,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SAC7C;KACJ;EACJ;;YAbwD,UAAU,uBAA1D,MAAM,SAAC,UAAU;YACuB,cAAc,uBAAtD,MAAM,SAAC,cAAc;;AALjB,qBAAqB;IAVjC,SAAS,CAAC;QACP,QAAQ,EAAE,gBAAgB;QAC1B,gVAAyC;QAEzC,eAAe,EAAE,uBAAuB,CAAC,MAAM;QAC/C,UAAU,EAAE,CAAC,oBAAoB,CAAC;QAClC,IAAI,EAAE;YACF,WAAW,EAAE,QAAQ;SACxB;;KACJ,CAAC;IAKO,WAAA,MAAM,CAAC,UAAU,CAAC,CAAA;IAClB,WAAA,MAAM,CAAC,cAAc,CAAC,CAAA;GALlB,qBAAqB,CAiBjC;;ACLD,MAAM,KAAK,GAAG,CAAC,CAAC;AAChB,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,UAAU,GAAG,CAAC,CAAC;AACrB,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,gBAAgB,GAAG,Y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C,CAAA;IAC7B,WAAA,MAAM,CAAC,UAAU,CAAC,CAAA;IAClB,WAAA,MAAM,CAAC,MAAM,CAAC,CAAA;IACd,WAAA,MAAM,CAAC,SAAS,CAAC,CAAA;IACjB,WAAA,MAAM,CAAC,UAAU,CAAC,MAAM,qBAAqB,CAAC,CAAC,CAAA;IAE/C,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;GAjBxB,mBAAmB,CAyN/B;;ICnRY,gBAAgB,GAA7B,MAAa,gBAAgB;EAAG;AAAnB,gBAAgB;IAN5B,QAAQ,CAAC;QACN,OAAO,EAAE,CAAC,YAAY,EAAE,kBAAkB,CAAC;QAC3C,YAAY,EAAE,CAAC,mBAAmB,CAAC;QACnC,OAAO,EAAE,CAAC,mBAAmB,CAAC;QAC9B,eAAe,EAAE,CAAC,mBAAmB,CAAC;KACzC,CAAC;GACW,gBAAgB,CAAG;;ICOnB,kBAAkB,GAA/B,MAAa,kBAAkB;EAAG;AAArB,kBAAkB;IAX9B,QAAQ,CAAC;QACN,OAAO,EAAE;YACL,YAAY;YACZ,kBAAkB;YAClB,gBAAgB;YAChB,gBAAgB;YAChB,mBAAmB;SACtB;QACD,YAAY,EAAE,CAAC,qBAAqB,CAAC;QACrC,OAAO,EAAE,CAAC,qBAAqB,CAAC;KACnC,CAAC;GACW,kBAAkB,CAAG;;ACnBlC;;;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-core-components-hints-host.js","sources":["ng://@taiga-ui/core/components/hints-host/hints-host.component.ts","ng://@taiga-ui/core/components/hints-host/hint-box/hint-box.component.ts","ng://@taiga-ui/core/components/hints-host/hint-box/hint-box.module.ts","ng://@taiga-ui/core/components/hints-host/hints-host.module.ts","ng://@taiga-ui/core/components/hints-host/taiga-ui-core-components-hints-host.ts"],"sourcesContent":["import {ChangeDetectionStrategy, Component, ElementRef, Inject} from '@angular/core';\nimport {TUI_PARENT_ANIMATION} from '@taiga-ui/cdk';\nimport {AbstractTuiHint} from '@taiga-ui/core/abstract';\nimport {TuiHintDirective} from '@taiga-ui/core/directives/hint';\nimport {TuiHintService} from '@taiga-ui/core/services';\nimport {PolymorpheusComponent} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiHintBoxComponent} from './hint-box/hint-box.component';\n\n@Component({\n selector: 'tui-hints-host',\n templateUrl: './hints-host.template.html',\n styleUrls: ['./hints-host.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n animations: [TUI_PARENT_ANIMATION],\n host: {\n 'aria-live': 'polite',\n },\n})\nexport class TuiHintsHostComponent {\n readonly component = new PolymorpheusComponent(TuiHintBoxComponent);\n\n constructor(\n @Inject(ElementRef) private readonly elementRef: ElementRef<HTMLElement>,\n @Inject(TuiHintService) readonly hints$: TuiHintService,\n ) {}\n\n get clientRect(): ClientRect {\n return this.elementRef.nativeElement.getBoundingClientRect();\n }\n\n onHovered(hovered: boolean, directive: AbstractTuiHint): void {\n if (directive instanceof TuiHintDirective) {\n directive.componentHovered$.next(hovered);\n }\n }\n}\n","import {AnimationOptions} from '@angular/animations';\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n forwardRef,\n HostBinding,\n Inject,\n NgZone,\n ViewChild,\n} from '@angular/core';\nimport {ANIMATION_FRAME, WINDOW} from '@ng-web-apis/common';\nimport {\n px,\n TuiContextWithImplicit,\n TuiDestroyService,\n tuiPure,\n tuiZonefree,\n} from '@taiga-ui/cdk';\nimport {AbstractTuiHint} from '@taiga-ui/core/abstract';\nimport {tuiFadeIn} from '@taiga-ui/core/animations';\nimport {TuiPointerHintDirective} from '@taiga-ui/core/directives/pointer-hint';\nimport {TuiMedia} from '@taiga-ui/core/interfaces';\nimport {TUI_ANIMATION_OPTIONS, TUI_MEDIA} from '@taiga-ui/core/tokens';\nimport {TuiDirection, TuiHintModeT} from '@taiga-ui/core/types';\nimport {tuiIsMobile} from '@taiga-ui/core/utils';\nimport {POLYMORPHEUS_CONTEXT} from '@tinkoff/ng-polymorpheus';\nimport {Observable} from 'rxjs';\nimport {takeUntil} from 'rxjs/operators';\n\nimport {TuiHintsHostComponent} from '../hints-host.component';\n\nconst SPACE = 8;\nconst BORDER_WIDTH = 1;\nconst LEFT_PADDING = 16;\nconst TOP_PADDING = 12;\nconst ARROW_SIZE = 8;\nconst ARROW_OFFSET = 16;\nconst ARROWHEAD_OFFSET = ARROW_OFFSET + (ARROW_SIZE * Math.sqrt(2)) / 2;\nconst reverseDirectionsVertical: {[key in TuiDirection]: TuiDirection} = {\n 'top-left': 'bottom-left',\n 'top-right': 'bottom-right',\n 'bottom-left': 'top-left',\n 'bottom-right': 'top-right',\n left: 'right',\n right: 'left',\n 'top-middle': 'bottom-middle',\n 'bottom-middle': 'top-middle',\n};\nconst reverseDirectionsHorizontal: {[key in TuiDirection]: TuiDirection} = {\n 'top-left': 'top-right',\n 'top-right': 'top-left',\n 'bottom-left': 'bottom-right',\n 'bottom-right': 'bottom-left',\n left: 'right',\n right: 'left',\n 'top-middle': 'top-middle',\n 'bottom-middle': 'bottom-middle',\n};\n\n// TODO: consider abstracting UI and move to CDK, split hint and overflow\n// Ambient type cannot be used without dynamic https://github.com/angular/angular/issues/23395\n// @dynamic\n@Component({\n selector: 'tui-hint-box[hint]',\n templateUrl: './hint-box.template.html',\n styleUrls: ['./hint-box.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [TuiDestroyService],\n animations: [tuiFadeIn],\n})\nexport class TuiHintBoxComponent {\n @ViewChild('arrow')\n private readonly arrow?: ElementRef<HTMLElement>;\n\n @HostBinding('@tuiFadeIn')\n readonly animation = {value: '', ...this.options} as const;\n\n constructor(\n @Inject(ANIMATION_FRAME) animationFrame$: Observable<number>,\n @Inject(TuiDestroyService) destroy$: Observable<void>,\n @Inject(NgZone) ngZone: NgZone,\n @Inject(TUI_ANIMATION_OPTIONS) private readonly options: AnimationOptions,\n @Inject(ElementRef) private readonly elementRef: ElementRef<HTMLElement>,\n @Inject(WINDOW) private readonly windowRef: Window,\n @Inject(TUI_MEDIA) private readonly media: TuiMedia,\n @Inject(forwardRef(() => TuiHintsHostComponent))\n private readonly hintsHost: TuiHintsHostComponent,\n @Inject(POLYMORPHEUS_CONTEXT)\n private readonly context: TuiContextWithImplicit<AbstractTuiHint>,\n ) {\n animationFrame$\n .pipe(tuiZonefree(ngZone), takeUntil(destroy$))\n .subscribe(() => this.calculatePosition());\n }\n\n get hint(): AbstractTuiHint {\n return this.context.$implicit;\n }\n\n @tuiPure\n @HostBinding('class._untouchable')\n get isUntouchable(): boolean {\n return this.hint instanceof TuiPointerHintDirective;\n }\n\n @HostBinding('attr.data-mode')\n get mode(): TuiHintModeT | null {\n return this.hint.mode;\n }\n\n get isMobile(): boolean {\n return tuiIsMobile(this.windowRef, this.media);\n }\n\n /**\n * Calculates wrapper position.\n * Styles are set directly to avoid visual shake of element\n */\n private calculatePosition(): void {\n if (this.mode !== 'overflow') {\n this.calculateCoordinates();\n } else {\n this.setOverflowStyles();\n }\n }\n\n private calculateCoordinates(): void {\n if (this.isMobile) {\n this.calculateMobileCoordinates();\n\n return;\n }\n\n const hostRect = this.hint.getElementClientRect();\n const portalRect = this.hintsHost.clientRect;\n const tooltip = this.elementRef.nativeElement;\n const {style} = tooltip;\n const tooltipRect = tooltip.getBoundingClientRect();\n const isHostLong = hostRect.width > ARROWHEAD_OFFSET * 2;\n const directions: TuiDirection[] = [\n 'left',\n 'right',\n 'bottom-left',\n 'bottom-right',\n 'bottom-middle',\n 'top-left',\n 'top-right',\n 'top-middle',\n ];\n\n let top = 0;\n let left = 0;\n let {direction} = this.hint;\n\n const horizontalTop =\n hostRect.top + hostRect.height / 2 - tooltipRect.height / 2 - portalRect.top;\n const horizontalLeft =\n hostRect.left - tooltipRect.width - SPACE - portalRect.left;\n const horizontalRight = hostRect.left + hostRect.width + SPACE - portalRect.left;\n const verticalBottom = hostRect.bottom + SPACE - portalRect.top;\n const verticalTop = hostRect.top - tooltipRect.height - SPACE - portalRect.top;\n const verticalRight = isHostLong\n ? hostRect.left - portalRect.left\n : hostRect.left + hostRect.width / 2 - ARROWHEAD_OFFSET - portalRect.left;\n const verticalLeft = isHostLong\n ? hostRect.left - tooltipRect.width + hostRect.width - portalRect.left\n : hostRect.left -\n tooltipRect.width +\n hostRect.width / 2 +\n ARROWHEAD_OFFSET -\n portalRect.left;\n const verticalMiddle =\n hostRect.left - tooltipRect.width / 2 + hostRect.width / 2 - portalRect.left;\n\n directions.splice(directions.indexOf(direction), 1);\n\n // eslint-disable-next-line no-constant-condition\n while (true) {\n switch (direction) {\n case 'left':\n top = horizontalTop;\n left = horizontalLeft;\n break;\n case 'right':\n top = horizontalTop;\n left = horizontalRight;\n break;\n case 'top-right':\n top = verticalTop;\n left = verticalRight;\n break;\n case 'top-left':\n top = verticalTop;\n left = verticalLeft;\n break;\n case 'bottom-right':\n top = verticalBottom;\n left = verticalRight;\n break;\n case 'bottom-left':\n top = verticalBottom;\n left = verticalLeft;\n break;\n case 'bottom-middle':\n top = verticalBottom;\n left = verticalMiddle;\n break;\n case 'top-middle':\n top = verticalTop;\n left = verticalMiddle;\n break;\n }\n\n const verticalFit =\n top + portalRect.top > SPACE &&\n top + tooltipRect.height + SPACE + portalRect.top <\n this.windowRef.innerHeight;\n const horizontalFit =\n left > SPACE &&\n left + tooltipRect.width + SPACE + portalRect.left < portalRect.width;\n\n if (directions.length === 0 || (verticalFit && horizontalFit)) {\n break;\n }\n\n direction = verticalFit\n ? reverseDirectionsHorizontal[direction]\n : reverseDirectionsVertical[direction];\n direction =\n directions.splice(directions.indexOf(direction), 1)[0] || direction;\n }\n\n style.top = px(top);\n style.left = px(left);\n\n tooltip.setAttribute('data-tui-host-direction', direction);\n }\n\n private calculateMobileCoordinates(): void {\n const hostRect = this.hint.getElementClientRect();\n const portalRect = this.hintsHost.clientRect;\n const tooltip = this.elementRef.nativeElement;\n const {style} = tooltip;\n const tooltipRect = tooltip.getBoundingClientRect();\n const verticalTop = hostRect.top - tooltipRect.height - SPACE - portalRect.top;\n const verticalBottom = hostRect.bottom + SPACE - portalRect.top;\n const verticalTopFit =\n verticalTop + portalRect.top > SPACE &&\n hostRect.top < this.windowRef.innerHeight;\n const verticalBottomFit =\n hostRect.bottom > 0 &&\n hostRect.bottom + 2 * SPACE + tooltipRect.height < this.windowRef.innerHeight;\n const direction =\n (this.hint.direction.includes('top') && verticalTopFit) || !verticalBottomFit\n ? 'top'\n : 'bottom';\n const attemptedLeft =\n portalRect.left + hostRect.left + hostRect.width / 2 - tooltipRect.width / 2;\n const left = Math.max(\n attemptedLeft + tooltipRect.width + SPACE > portalRect.right\n ? portalRect.right - SPACE - tooltipRect.width\n : attemptedLeft,\n SPACE * 2,\n );\n\n style.left = px(left);\n style.top = direction === 'top' ? px(verticalTop) : px(verticalBottom);\n\n if (this.arrow) {\n this.arrow.nativeElement.style.left = px(\n hostRect.left <= SPACE * 2 && hostRect.width > ARROW_OFFSET * 2\n ? ARROW_OFFSET\n : hostRect.left + hostRect.width / 2 - left - ARROW_SIZE / 2,\n );\n }\n\n tooltip.setAttribute('data-tui-host-direction', direction);\n }\n\n private setOverflowStyles(): void {\n const hostRect = this.hint.getElementClientRect();\n const {style} = this.elementRef.nativeElement;\n\n style.top = px(hostRect.top - window.innerHeight - TOP_PADDING - BORDER_WIDTH);\n style.left = px(hostRect.left - LEFT_PADDING - BORDER_WIDTH);\n style.width = px(hostRect.width + LEFT_PADDING * 2 + BORDER_WIDTH * 2);\n }\n}\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {PolymorpheusModule} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiHintBoxComponent} from './hint-box.component';\n\n@NgModule({\n imports: [CommonModule, PolymorpheusModule],\n declarations: [TuiHintBoxComponent],\n exports: [TuiHintBoxComponent],\n entryComponents: [TuiHintBoxComponent],\n})\nexport class TuiHintBoxModule {}\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {TuiActiveZoneModule, TuiHoveredModule} from '@taiga-ui/cdk';\nimport {PolymorpheusModule} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiHintBoxModule} from './hint-box/hint-box.module';\nimport {TuiHintsHostComponent} from './hints-host.component';\n\n@NgModule({\n imports: [\n CommonModule,\n PolymorpheusModule,\n TuiHoveredModule,\n TuiHintBoxModule,\n TuiActiveZoneModule,\n ],\n declarations: [TuiHintsHostComponent],\n exports: [TuiHintsHostComponent],\n})\nexport class TuiHintsHostModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;IAmBa,qBAAqB,GAAlC,MAAa,qBAAqB;IAG9B,YACyC,UAAmC,EACvC,MAAsB;QADlB,eAAU,GAAV,UAAU,CAAyB;QACvC,WAAM,GAAN,MAAM,CAAgB;QAJlD,cAAS,GAAG,IAAI,qBAAqB,CAAC,mBAAmB,CAAC,CAAC;KAKhE;IAEJ,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,qBAAqB,EAAE,CAAC;KAChE;IAED,SAAS,CAAC,OAAgB,EAAE,SAA0B;QAClD,IAAI,SAAS,YAAY,gBAAgB,EAAE;YACvC,SAAS,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SAC7C;KACJ;EACJ;;YAbwD,UAAU,uBAA1D,MAAM,SAAC,UAAU;YACuB,cAAc,uBAAtD,MAAM,SAAC,cAAc;;AALjB,qBAAqB;IAVjC,SAAS,CAAC;QACP,QAAQ,EAAE,gBAAgB;QAC1B,gVAAyC;QAEzC,eAAe,EAAE,uBAAuB,CAAC,MAAM;QAC/C,UAAU,EAAE,CAAC,oBAAoB,CAAC;QAClC,IAAI,EAAE;YACF,WAAW,EAAE,QAAQ;SACxB;;KACJ,CAAC;IAKO,WAAA,MAAM,CAAC,UAAU,CAAC,CAAA;IAClB,WAAA,MAAM,CAAC,cAAc,CAAC,CAAA;GALlB,qBAAqB,CAiBjC;;ACJD,MAAM,KAAK,GAAG,CAAC,CAAC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U,EAAE,CAAC,SAAS,CAAC;;KAC1B,CAAC;IASO,WAAA,MAAM,CAAC,eAAe,CAAC,CAAA;IACvB,WAAA,MAAM,CAAC,iBAAiB,CAAC,CAAA;IACzB,WAAA,MAAM,CAAC,MAAM,CAAC,CAAA;IACd,WAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;IAC7B,WAAA,MAAM,CAAC,UAAU,CAAC,CAAA;IAClB,WAAA,MAAM,CAAC,MAAM,CAAC,CAAA;IACd,WAAA,MAAM,CAAC,SAAS,CAAC,CAAA;IACjB,WAAA,MAAM,CAAC,UAAU,CAAC,MAAM,qBAAqB,CAAC,CAAC,CAAA;IAE/C,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;GAjBxB,mBAAmB,CAyN/B;;ICpRY,gBAAgB,GAA7B,MAAa,gBAAgB;EAAG;AAAnB,gBAAgB;IAN5B,QAAQ,CAAC;QACN,OAAO,EAAE,CAAC,YAAY,EAAE,kBAAkB,CAAC;QAC3C,YAAY,EAAE,CAAC,mBAAmB,CAAC;QACnC,OAAO,EAAE,CAAC,mBAAmB,CAAC;QAC9B,eAAe,EAAE,CAAC,mBAAmB,CAAC;KACzC,CAAC;GACW,gBAAgB,CAAG;;ICOnB,kBAAkB,GAA/B,MAAa,kBAAkB;EAAG;AAArB,kBAAkB;IAX9B,QAAQ,CAAC;QACN,OAAO,EAAE;YACL,YAAY;YACZ,kBAAkB;YAClB,gBAAgB;YAChB,gBAAgB;YAChB,mBAAmB;SACtB;QACD,YAAY,EAAE,CAAC,qBAAqB,CAAC;QACrC,OAAO,EAAE,CAAC,qBAAqB,CAAC;KACnC,CAAC;GACW,kBAAkB,CAAG;;ACnBlC;;;;;;"}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { __decorate, __param } from 'tslib';
|
|
2
2
|
import { forwardRef, InjectionToken, EventEmitter, Inject, ElementRef, ViewChild, Input, HostBinding, Output, ContentChildren, HostListener, Component, ChangeDetectionStrategy, Directive, NgModule } from '@angular/core';
|
|
3
|
-
import { TUI_FOCUSABLE_ITEM_ACCESSOR, AbstractTuiInteractive, isNativeFocusedIn, setNativeFocused, tuiDefaultProp, tuiPure, TuiIdService,
|
|
3
|
+
import { TUI_FOCUSABLE_ITEM_ACCESSOR, AbstractTuiInteractive, isNativeFocusedIn, setNativeFocused, tuiDefaultProp, tuiPure, TuiIdService, TuiFocusableModule, TuiHoveredModule, TuiInputModeModule, TuiAutofilledModule } from '@taiga-ui/cdk';
|
|
4
4
|
import { HINT_CONTROLLER_PROVIDER, TuiHintControllerDirective, TUI_HINT_WATCHED_CONTROLLER } from '@taiga-ui/core/directives/hint-controller';
|
|
5
5
|
import { TEXTFIELD_CONTROLLER_PROVIDER, TuiTextfieldController, TUI_TEXTFIELD_WATCHED_CONTROLLER } from '@taiga-ui/core/directives/textfield-controller';
|
|
6
6
|
import { TUI_MODE, TUI_TEXTFIELD_APPEARANCE, TUI_TEXTFIELD_HOST } from '@taiga-ui/core/tokens';
|
|
7
7
|
import { getBorder } from '@taiga-ui/core/utils/miscellaneous';
|
|
8
8
|
import { PolymorpheusOutletComponent, PolymorpheusModule } from '@tinkoff/ng-polymorpheus';
|
|
9
|
-
import { fromEvent, Observable,
|
|
10
|
-
import { map,
|
|
9
|
+
import { fromEvent, Observable, BehaviorSubject } from 'rxjs';
|
|
10
|
+
import { map, delay, filter, distinctUntilChanged } from 'rxjs/operators';
|
|
11
11
|
import { MODE_PROVIDER } from '@taiga-ui/core/providers';
|
|
12
12
|
import { TuiAbstractTextfieldHost } from '@taiga-ui/core/abstract';
|
|
13
13
|
import { CommonModule } from '@angular/common';
|
|
14
14
|
import { FormsModule } from '@angular/forms';
|
|
15
|
-
import { MutationObserverDirective, MutationObserverModule } from '@ng-web-apis/mutation-observer';
|
|
16
15
|
import { TuiSvgModule } from '@taiga-ui/core/components/svg';
|
|
17
16
|
import { TuiTooltipModule } from '@taiga-ui/core/components/tooltip';
|
|
18
17
|
import { TuiDescribedByModule } from '@taiga-ui/core/directives/described-by';
|
|
@@ -408,11 +407,11 @@ TuiTextfieldComponent = __decorate([
|
|
|
408
407
|
], TuiTextfieldComponent);
|
|
409
408
|
|
|
410
409
|
let TuiValueDecorationComponent = class TuiValueDecorationComponent {
|
|
411
|
-
constructor(textfield, controller
|
|
410
|
+
constructor(textfield, controller) {
|
|
412
411
|
this.textfield = textfield;
|
|
413
412
|
this.controller = controller;
|
|
414
|
-
this.
|
|
415
|
-
this.pre$ =
|
|
413
|
+
this.prefix$ = new BehaviorSubject('');
|
|
414
|
+
this.pre$ = this.prefix$.pipe(delay(0), filter(() => { var _a; return !!((_a = this.pre) === null || _a === void 0 ? void 0 : _a.nativeElement.isConnected); }), distinctUntilChanged(), map(() => { var _a; return ((_a = this.pre) === null || _a === void 0 ? void 0 : _a.nativeElement.offsetWidth) || 0; }));
|
|
416
415
|
}
|
|
417
416
|
get isContextTable() {
|
|
418
417
|
return this.textfield.appearance === "table" /* Table */;
|
|
@@ -433,6 +432,9 @@ let TuiValueDecorationComponent = class TuiValueDecorationComponent {
|
|
|
433
432
|
get postfix() {
|
|
434
433
|
return this.decorationsVisible ? this.computedPostfix : '';
|
|
435
434
|
}
|
|
435
|
+
ngDoCheck() {
|
|
436
|
+
this.prefix$.next(this.prefix);
|
|
437
|
+
}
|
|
436
438
|
get placeholder() {
|
|
437
439
|
var _a;
|
|
438
440
|
return ((_a = this.textfield.nativeFocusableElement) === null || _a === void 0 ? void 0 : _a.placeholder) || '';
|
|
@@ -455,30 +457,27 @@ let TuiValueDecorationComponent = class TuiValueDecorationComponent {
|
|
|
455
457
|
};
|
|
456
458
|
TuiValueDecorationComponent.ctorParameters = () => [
|
|
457
459
|
{ type: TuiPrimitiveTextfieldComponent, decorators: [{ type: Inject, args: [TuiPrimitiveTextfieldComponent,] }] },
|
|
458
|
-
{ type: TuiTextfieldController$1, decorators: [{ type: Inject, args: [TUI_TEXTFIELD_WATCHED_CONTROLLER$1,] }] }
|
|
459
|
-
{ type: Observable, decorators: [{ type: Inject, args: [TuiResizeService,] }] }
|
|
460
|
+
{ type: TuiTextfieldController$1, decorators: [{ type: Inject, args: [TUI_TEXTFIELD_WATCHED_CONTROLLER$1,] }] }
|
|
460
461
|
];
|
|
461
462
|
__decorate([
|
|
462
463
|
ViewChild('pre', { read: ElementRef, static: true })
|
|
463
464
|
], TuiValueDecorationComponent.prototype, "pre", void 0);
|
|
464
|
-
__decorate([
|
|
465
|
-
ViewChild(MutationObserverDirective, { static: true })
|
|
466
|
-
], TuiValueDecorationComponent.prototype, "directive", void 0);
|
|
467
465
|
__decorate([
|
|
468
466
|
HostBinding('class._table')
|
|
469
467
|
], TuiValueDecorationComponent.prototype, "isContextTable", null);
|
|
468
|
+
__decorate([
|
|
469
|
+
HostListener('animationstart')
|
|
470
|
+
], TuiValueDecorationComponent.prototype, "ngDoCheck", null);
|
|
470
471
|
TuiValueDecorationComponent = __decorate([
|
|
471
472
|
Component({
|
|
472
473
|
selector: 'tui-value-decoration',
|
|
473
|
-
template: "<span
|
|
474
|
-
providers: [TuiResizeService],
|
|
474
|
+
template: "<span #pre>{{ prefix }}</span>\n<span class=\"t-ghost\">{{ value }}</span>\n<span class=\"t-filler\">{{ filler }}</span>\n{{ postfix }}\n",
|
|
475
475
|
// It follows Change Detection of PrimitiveTextfield
|
|
476
476
|
changeDetection: ChangeDetectionStrategy.Default,
|
|
477
|
-
styles: [":host{position:absolute;display:block;height:1.25rem;
|
|
477
|
+
styles: [":host{position:absolute;display:block;height:1.25rem;width:100%;margin:-1.25rem 0;padding:.625rem 0;box-sizing:content-box;color:var(--tui-text-01);-webkit-animation:1s tuiPresent;animation:1s tuiPresent}:host._table{position:static}:host-context(tui-textfield[data-mode=onDark]) :host{color:var(--tui-text-01-night)}.t-ghost{visibility:hidden;white-space:pre;text-overflow:clip}.t-filler{display:inline-block;overflow:hidden;color:var(--tui-text-03);text-overflow:ellipsis;max-width:100%;white-space:nowrap}:host-context(tui-textfield[data-mode=onDark]) .t-filler{color:var(--tui-text-03-night)}"]
|
|
478
478
|
}),
|
|
479
479
|
__param(0, Inject(TuiPrimitiveTextfieldComponent)),
|
|
480
|
-
__param(1, Inject(TUI_TEXTFIELD_WATCHED_CONTROLLER$1))
|
|
481
|
-
__param(2, Inject(TuiResizeService))
|
|
480
|
+
__param(1, Inject(TUI_TEXTFIELD_WATCHED_CONTROLLER$1))
|
|
482
481
|
], TuiValueDecorationComponent);
|
|
483
482
|
|
|
484
483
|
let TuiPrimitiveTextfieldModule = class TuiPrimitiveTextfieldModule {
|
|
@@ -488,17 +487,16 @@ TuiPrimitiveTextfieldModule = __decorate([
|
|
|
488
487
|
imports: [
|
|
489
488
|
CommonModule,
|
|
490
489
|
FormsModule,
|
|
490
|
+
PolymorpheusModule,
|
|
491
491
|
TuiMaskAccessorModule,
|
|
492
492
|
TuiFocusableModule,
|
|
493
493
|
TuiHoveredModule,
|
|
494
494
|
TuiInputModeModule,
|
|
495
|
-
PolymorpheusModule,
|
|
496
495
|
TuiWrapperModule,
|
|
497
496
|
TuiSvgModule,
|
|
498
497
|
TuiTooltipModule,
|
|
499
498
|
TuiAutofilledModule,
|
|
500
499
|
TuiDescribedByModule,
|
|
501
|
-
MutationObserverModule,
|
|
502
500
|
],
|
|
503
501
|
declarations: [
|
|
504
502
|
TuiPrimitiveTextfieldComponent,
|