@taiga-ui/addon-mobile 4.11.0 → 4.13.0
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/components/sheet-dialog/sheet-dialog.component.d.ts +1 -12
- package/components/sheet-dialog/sheet-dialog.options.d.ts +5 -2
- package/components/sheet-dialog/sheet-dialog.service.d.ts +3 -0
- package/directives/index.d.ts +1 -0
- package/directives/responsive-dialog/index.d.ts +2 -0
- package/directives/responsive-dialog/responsive-dialog.directive.d.ts +7 -0
- package/directives/responsive-dialog/responsive-dialog.service.d.ts +22 -0
- package/directives/sidebar/sidebar.component.d.ts +3 -0
- package/directives/sidebar/sidebar.directive.d.ts +4 -1
- package/esm2022/components/mobile-calendar/mobile-calendar.component.mjs +3 -2
- package/esm2022/components/mobile-calendar/mobile-calendar.providers.mjs +4 -4
- package/esm2022/components/sheet-dialog/sheet-dialog.component.mjs +20 -61
- package/esm2022/components/sheet-dialog/sheet-dialog.options.mjs +2 -1
- package/esm2022/components/sheet-dialog/sheet-dialog.service.mjs +21 -2
- package/esm2022/components/tab-bar/tab-bar-item.directive.mjs +3 -3
- package/esm2022/directives/dropdown-mobile/dropdown-mobile.component.mjs +2 -2
- package/esm2022/directives/index.mjs +2 -1
- package/esm2022/directives/responsive-dialog/index.mjs +3 -0
- package/esm2022/directives/responsive-dialog/responsive-dialog.directive.mjs +21 -0
- package/esm2022/directives/responsive-dialog/responsive-dialog.service.mjs +34 -0
- package/esm2022/directives/responsive-dialog/taiga-ui-addon-mobile-directives-responsive-dialog.mjs +5 -0
- package/esm2022/directives/sidebar/sidebar.component.mjs +4 -1
- package/esm2022/directives/sidebar/sidebar.directive.mjs +8 -5
- package/esm2022/services/keyboard.service.mjs +1 -1
- package/fesm2022/taiga-ui-addon-mobile-components-mobile-calendar.mjs +5 -4
- package/fesm2022/taiga-ui-addon-mobile-components-mobile-calendar.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-mobile-components-sheet-dialog.mjs +41 -61
- package/fesm2022/taiga-ui-addon-mobile-components-sheet-dialog.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-mobile-components-tab-bar.mjs +2 -2
- package/fesm2022/taiga-ui-addon-mobile-components-tab-bar.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-mobile-directives-dropdown-mobile.mjs +1 -1
- package/fesm2022/taiga-ui-addon-mobile-directives-dropdown-mobile.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-mobile-directives-responsive-dialog.mjs +57 -0
- package/fesm2022/taiga-ui-addon-mobile-directives-responsive-dialog.mjs.map +1 -0
- package/fesm2022/taiga-ui-addon-mobile-directives-sidebar.mjs +10 -4
- package/fesm2022/taiga-ui-addon-mobile-directives-sidebar.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-mobile-directives.mjs +1 -0
- package/fesm2022/taiga-ui-addon-mobile-directives.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-mobile-services.mjs.map +1 -1
- package/package.json +54 -48
- package/styles/android/app-bar.less +4 -4
- package/styles/common/button.less +8 -8
- package/styles/{ios → common}/search.less +0 -1
- package/styles/taiga-ui-mobile.less +17 -16
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
|
-
import {
|
|
2
|
+
import { NgForOf, NgIf } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { inject, Component, ChangeDetectionStrategy,
|
|
5
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
4
|
+
import { inject, Component, ChangeDetectionStrategy, ViewChildren, Injectable, Directive } from '@angular/core';
|
|
6
5
|
import { EMPTY_QUERY } from '@taiga-ui/cdk/constants';
|
|
7
|
-
import { TuiClickOutside } from '@taiga-ui/cdk/directives/click-outside';
|
|
8
6
|
import { tuiInjectElement } from '@taiga-ui/cdk/utils/dom';
|
|
9
|
-
import { tuiPure, tuiCreateToken, tuiProvideOptions } from '@taiga-ui/cdk/utils/miscellaneous';
|
|
10
7
|
import { tuiSlideInTop } from '@taiga-ui/core/animations';
|
|
11
8
|
import { TuiButton } from '@taiga-ui/core/components/button';
|
|
12
|
-
import { TUI_ANIMATIONS_SPEED
|
|
9
|
+
import { TUI_ANIMATIONS_SPEED } from '@taiga-ui/core/tokens';
|
|
13
10
|
import { tuiGetDuration } from '@taiga-ui/core/utils/miscellaneous';
|
|
14
11
|
import { shouldCall } from '@taiga-ui/event-plugins';
|
|
15
|
-
import { injectContext, PolymorpheusOutlet
|
|
16
|
-
import { BehaviorSubject } from 'rxjs';
|
|
12
|
+
import { injectContext, PolymorpheusOutlet } from '@taiga-ui/polymorpheus';
|
|
17
13
|
import { TuiPopoverDirective } from '@taiga-ui/cdk/directives/popover';
|
|
18
|
-
import { TuiPopoverService, tuiAsPopover } from '@taiga-ui/cdk/services';
|
|
14
|
+
import { TuiPopoverService, TuiThemeColorService, tuiAsPopover } from '@taiga-ui/cdk/services';
|
|
15
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
19
16
|
import { TUI_DIALOGS } from '@taiga-ui/core/components/dialog';
|
|
17
|
+
import { startWith, pairwise } from 'rxjs';
|
|
18
|
+
import { tuiCreateToken, tuiProvideOptions } from '@taiga-ui/cdk/utils/miscellaneous';
|
|
20
19
|
|
|
21
20
|
// So we re-enter ngZone and trigger change detection
|
|
22
21
|
function isCloseable() {
|
|
23
|
-
return this.context.closeable;
|
|
22
|
+
return this.context.closeable === true;
|
|
24
23
|
}
|
|
25
24
|
class TuiSheetDialogComponent {
|
|
26
25
|
constructor() {
|
|
27
|
-
this.
|
|
26
|
+
this.stops = EMPTY_QUERY;
|
|
28
27
|
this.el = tuiInjectElement();
|
|
29
28
|
this.pointers = 0;
|
|
30
29
|
this.slideInTop = {
|
|
@@ -34,83 +33,46 @@ class TuiSheetDialogComponent {
|
|
|
34
33
|
duration: tuiGetDuration(inject(TUI_ANIMATIONS_SPEED)),
|
|
35
34
|
},
|
|
36
35
|
};
|
|
37
|
-
this.stuck$ = new BehaviorSubject(false);
|
|
38
|
-
this.stuck$$ = this.stuck$
|
|
39
|
-
.pipe(takeUntilDestroyed())
|
|
40
|
-
.subscribe((add) => add ? this.el.classList.add('_stuck') : this.el.classList.remove('_stuck'));
|
|
41
|
-
this.icons = inject(TUI_COMMON_ICONS);
|
|
42
|
-
this.closeWord$ = inject(TUI_CLOSE_WORD);
|
|
43
36
|
this.context = injectContext();
|
|
44
37
|
}
|
|
45
38
|
ngAfterViewInit() {
|
|
46
39
|
this.el.scrollTop =
|
|
47
|
-
[
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
get closeable() {
|
|
53
|
-
return this.context.closeable;
|
|
54
|
-
}
|
|
55
|
-
get isSmall() {
|
|
56
|
-
return this.sheetTop > (this.sheet?.nativeElement.clientHeight || Infinity);
|
|
40
|
+
[
|
|
41
|
+
...this.stops.map((e) => e.nativeElement.offsetTop - this.context.offset),
|
|
42
|
+
this.el.clientHeight ?? Infinity,
|
|
43
|
+
][this.context.initial] ?? 0;
|
|
57
44
|
}
|
|
58
45
|
close() {
|
|
59
|
-
// TODO: Refactor focus visible on mobile
|
|
60
|
-
this.el.dispatchEvent(new Event('mousedown', { bubbles: true }));
|
|
61
46
|
this.context.$implicit.complete();
|
|
62
47
|
}
|
|
63
48
|
onPointerChange(delta) {
|
|
64
49
|
this.pointers += delta;
|
|
65
|
-
if (!
|
|
66
|
-
const stuck = this.el.scrollTop > this.sheetTop;
|
|
67
|
-
this.stuck$.value !== stuck && this.stuck$.next(stuck);
|
|
68
|
-
}
|
|
69
|
-
if (this.context.closeable && !this.pointers && !this.el.scrollTop) {
|
|
50
|
+
if (!this.pointers && this.el.scrollTop <= 0) {
|
|
70
51
|
this.close();
|
|
71
52
|
}
|
|
72
53
|
}
|
|
73
|
-
get sheetTop() {
|
|
74
|
-
return this.sheet?.nativeElement.offsetTop ?? Infinity;
|
|
75
|
-
}
|
|
76
|
-
getStops(stops) {
|
|
77
|
-
return stops.map(({ nativeElement }) => nativeElement.offsetTop + nativeElement.clientHeight);
|
|
78
|
-
}
|
|
79
54
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiSheetDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
80
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiSheetDialogComponent, isStandalone: true, selector: "tui-sheet-dialog", host: { listeners: { "document:touchstart.passive.silent": "onPointerChange(1)", "document:touchend.silent": "onPointerChange(-1)", "document:touchcancel.silent": "onPointerChange(-1)", "scroll.silent": "onPointerChange(0)" }, properties: { "@tuiSlideInTop": "slideInTop", "style.
|
|
55
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiSheetDialogComponent, isStandalone: true, selector: "tui-sheet-dialog", host: { listeners: { "document:touchstart.passive.silent": "onPointerChange(1)", "document:touchend.silent": "onPointerChange(-1)", "document:touchcancel.silent": "onPointerChange(-1)", "scroll.silent": "onPointerChange(0)", "click.self": "close()" }, properties: { "@tuiSlideInTop": "slideInTop", "style.--tui-offset.px": "context.offset", "class._closeable": "context.closeable === true" } }, viewQueries: [{ propertyName: "stops", predicate: ["stops"], descendants: true }], ngImport: i0, template: "<div class=\"t-stops\">\n <div\n *ngFor=\"let stop of context.stops\"\n #stops\n class=\"t-stop\"\n [style.margin-top]=\"stop\"\n ></div>\n</div>\n<div class=\"t-sheet\">\n <div\n *ngIf=\"context.bar\"\n class=\"t-top\"\n ></div>\n <h2\n *ngIf=\"context.label\"\n class=\"t-heading\"\n [id]=\"context.id\"\n >\n <ng-container *polymorpheusOutlet=\"context.label as label; context: context\">\n {{ label }}\n </ng-container>\n </h2>\n <div class=\"t-content\">\n <ng-container *polymorpheusOutlet=\"context.content as text; context: context\">\n {{ text }}\n </ng-container>\n </div>\n</div>\n", styles: [":host{scrollbar-width:none;-ms-overflow-style:none;display:flex;inline-size:100%;max-inline-size:40rem;block-size:calc(100% - var(--tui-offset));flex-direction:column;font:var(--tui-font-text-m);overflow-y:scroll;scroll-snap-type:y mandatory;margin:var(--tui-offset) auto 0;border-radius:.75rem .75rem 0 0}:host::-webkit-scrollbar,:host::-webkit-scrollbar-thumb{display:none}:host:before{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;content:\"\";z-index:-1}:host._closeable{display:block}:host._closeable .t-stops{display:flex}.t-stops{display:none;block-size:100%;scroll-snap-stop:always;scroll-snap-align:start;pointer-events:none}.t-stop{position:relative;top:env(safe-area-inset-bottom);scroll-snap-stop:normal;scroll-snap-align:start;block-size:1rem;inline-size:1rem}.t-sheet{scrollbar-width:none;-ms-overflow-style:none;inline-size:100%;box-shadow:var(--tui-shadow-small);border-radius:inherit;padding:0 1rem;margin-block-start:auto;background:var(--tui-background-elevation-1);box-sizing:border-box;scroll-snap-stop:always;scroll-snap-align:start}.t-sheet::-webkit-scrollbar,.t-sheet::-webkit-scrollbar-thumb{display:none}.t-top{position:sticky;top:0;z-index:1;block-size:1.5rem;margin:0 -1rem;border-radius:inherit;background:var(--tui-background-elevation-1)}.t-top:after{content:\"\";position:absolute;top:.5rem;left:50%;inline-size:2rem;block-size:.25rem;transform:translate(-50%);background:var(--tui-background-neutral-2);border-radius:1rem}.t-heading{position:sticky;top:1.5rem;z-index:1;margin:0 -1rem;padding:.75rem 1rem;font:var(--tui-font-heading-6);background:var(--tui-background-elevation-1)}.t-heading:first-child{top:0;border-radius:inherit}.t-heading:last-child{padding-block-end:1.5rem}.t-content{position:relative;isolation:isolate;padding-block-end:calc(1.5em + env(safe-area-inset-bottom))}.t-content:after{content:\"\";position:relative;top:calc(1.5em + env(safe-area-inset-bottom));z-index:-1;display:block;scroll-snap-stop:always;scroll-snap-align:end;border-image:conic-gradient(var(--tui-background-elevation-1) 0 0) fill 0/0/0 100vh 100vh}\n"], dependencies: [{ kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: PolymorpheusOutlet, selector: "[polymorpheusOutlet]", inputs: ["polymorpheusOutlet", "polymorpheusOutletContext"] }], animations: [tuiSlideInTop], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
81
56
|
}
|
|
82
57
|
__decorate([
|
|
83
58
|
shouldCall(isCloseable)
|
|
84
59
|
], TuiSheetDialogComponent.prototype, "close", null);
|
|
85
|
-
__decorate([
|
|
86
|
-
tuiPure
|
|
87
|
-
], TuiSheetDialogComponent.prototype, "getStops", null);
|
|
88
60
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiSheetDialogComponent, decorators: [{
|
|
89
61
|
type: Component,
|
|
90
|
-
args: [{ standalone: true, selector: 'tui-sheet-dialog', imports: [
|
|
91
|
-
AsyncPipe,
|
|
92
|
-
NgForOf,
|
|
93
|
-
NgIf,
|
|
94
|
-
PolymorpheusOutlet,
|
|
95
|
-
PolymorpheusTemplate,
|
|
96
|
-
TuiButton,
|
|
97
|
-
TuiClickOutside,
|
|
98
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, animations: [tuiSlideInTop], host: {
|
|
62
|
+
args: [{ standalone: true, selector: 'tui-sheet-dialog', imports: [NgForOf, NgIf, PolymorpheusOutlet, TuiButton], changeDetection: ChangeDetectionStrategy.OnPush, animations: [tuiSlideInTop], host: {
|
|
99
63
|
'[@tuiSlideInTop]': 'slideInTop',
|
|
100
|
-
'[style.
|
|
101
|
-
'[class._closeable]': 'closeable',
|
|
64
|
+
'[style.--tui-offset.px]': 'context.offset',
|
|
65
|
+
'[class._closeable]': 'context.closeable === true',
|
|
102
66
|
'(document:touchstart.passive.silent)': 'onPointerChange(1)',
|
|
103
67
|
'(document:touchend.silent)': 'onPointerChange(-1)',
|
|
104
68
|
'(document:touchcancel.silent)': 'onPointerChange(-1)',
|
|
105
69
|
'(scroll.silent)': 'onPointerChange(0)',
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
args: ['sheet']
|
|
110
|
-
}], stopsRefs: [{
|
|
70
|
+
'(click.self)': 'close()',
|
|
71
|
+
}, template: "<div class=\"t-stops\">\n <div\n *ngFor=\"let stop of context.stops\"\n #stops\n class=\"t-stop\"\n [style.margin-top]=\"stop\"\n ></div>\n</div>\n<div class=\"t-sheet\">\n <div\n *ngIf=\"context.bar\"\n class=\"t-top\"\n ></div>\n <h2\n *ngIf=\"context.label\"\n class=\"t-heading\"\n [id]=\"context.id\"\n >\n <ng-container *polymorpheusOutlet=\"context.label as label; context: context\">\n {{ label }}\n </ng-container>\n </h2>\n <div class=\"t-content\">\n <ng-container *polymorpheusOutlet=\"context.content as text; context: context\">\n {{ text }}\n </ng-container>\n </div>\n</div>\n", styles: [":host{scrollbar-width:none;-ms-overflow-style:none;display:flex;inline-size:100%;max-inline-size:40rem;block-size:calc(100% - var(--tui-offset));flex-direction:column;font:var(--tui-font-text-m);overflow-y:scroll;scroll-snap-type:y mandatory;margin:var(--tui-offset) auto 0;border-radius:.75rem .75rem 0 0}:host::-webkit-scrollbar,:host::-webkit-scrollbar-thumb{display:none}:host:before{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;content:\"\";z-index:-1}:host._closeable{display:block}:host._closeable .t-stops{display:flex}.t-stops{display:none;block-size:100%;scroll-snap-stop:always;scroll-snap-align:start;pointer-events:none}.t-stop{position:relative;top:env(safe-area-inset-bottom);scroll-snap-stop:normal;scroll-snap-align:start;block-size:1rem;inline-size:1rem}.t-sheet{scrollbar-width:none;-ms-overflow-style:none;inline-size:100%;box-shadow:var(--tui-shadow-small);border-radius:inherit;padding:0 1rem;margin-block-start:auto;background:var(--tui-background-elevation-1);box-sizing:border-box;scroll-snap-stop:always;scroll-snap-align:start}.t-sheet::-webkit-scrollbar,.t-sheet::-webkit-scrollbar-thumb{display:none}.t-top{position:sticky;top:0;z-index:1;block-size:1.5rem;margin:0 -1rem;border-radius:inherit;background:var(--tui-background-elevation-1)}.t-top:after{content:\"\";position:absolute;top:.5rem;left:50%;inline-size:2rem;block-size:.25rem;transform:translate(-50%);background:var(--tui-background-neutral-2);border-radius:1rem}.t-heading{position:sticky;top:1.5rem;z-index:1;margin:0 -1rem;padding:.75rem 1rem;font:var(--tui-font-heading-6);background:var(--tui-background-elevation-1)}.t-heading:first-child{top:0;border-radius:inherit}.t-heading:last-child{padding-block-end:1.5rem}.t-content{position:relative;isolation:isolate;padding-block-end:calc(1.5em + env(safe-area-inset-bottom))}.t-content:after{content:\"\";position:relative;top:calc(1.5em + env(safe-area-inset-bottom));z-index:-1;display:block;scroll-snap-stop:always;scroll-snap-align:end;border-image:conic-gradient(var(--tui-background-elevation-1) 0 0) fill 0/0/0 100vh 100vh}\n"] }]
|
|
72
|
+
}], propDecorators: { stops: [{
|
|
111
73
|
type: ViewChildren,
|
|
112
74
|
args: ['stops']
|
|
113
|
-
}], close: []
|
|
75
|
+
}], close: [] } });
|
|
114
76
|
|
|
115
77
|
const TUI_SHEET_DIALOG_DEFAULT_OPTIONS = {
|
|
116
78
|
label: '',
|
|
@@ -119,6 +81,7 @@ const TUI_SHEET_DIALOG_DEFAULT_OPTIONS = {
|
|
|
119
81
|
offset: 16,
|
|
120
82
|
closeable: true,
|
|
121
83
|
data: undefined,
|
|
84
|
+
bar: true,
|
|
122
85
|
};
|
|
123
86
|
/**
|
|
124
87
|
* Default parameters for mobile dialog component
|
|
@@ -128,7 +91,24 @@ function tuiSheetDialogOptionsProvider(options) {
|
|
|
128
91
|
return tuiProvideOptions(TUI_SHEET_DIALOG_OPTIONS, options, TUI_SHEET_DIALOG_DEFAULT_OPTIONS);
|
|
129
92
|
}
|
|
130
93
|
|
|
94
|
+
const THEME = '#404040';
|
|
131
95
|
class TuiSheetDialogService extends TuiPopoverService {
|
|
96
|
+
constructor() {
|
|
97
|
+
super(...arguments);
|
|
98
|
+
this.theme = inject(TuiThemeColorService);
|
|
99
|
+
this.initial = this.theme.color;
|
|
100
|
+
this.$ = this.items$
|
|
101
|
+
.pipe(startWith([]), pairwise(), takeUntilDestroyed())
|
|
102
|
+
.subscribe(([prev, next]) => {
|
|
103
|
+
if (!prev.length && next.length) {
|
|
104
|
+
this.initial = this.theme.color;
|
|
105
|
+
this.theme.color = THEME;
|
|
106
|
+
}
|
|
107
|
+
if (!next.length && prev.length) {
|
|
108
|
+
this.theme.color = this.initial;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
132
112
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiSheetDialogService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
133
113
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiSheetDialogService, providedIn: 'root', useFactory: () => new TuiSheetDialogService(TUI_DIALOGS, TuiSheetDialogComponent, inject(TUI_SHEET_DIALOG_OPTIONS)) }); }
|
|
134
114
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-addon-mobile-components-sheet-dialog.mjs","sources":["../../../projects/addon-mobile/components/sheet-dialog/sheet-dialog.component.ts","../../../projects/addon-mobile/components/sheet-dialog/sheet-dialog.template.html","../../../projects/addon-mobile/components/sheet-dialog/sheet-dialog.options.ts","../../../projects/addon-mobile/components/sheet-dialog/sheet-dialog.service.ts","../../../projects/addon-mobile/components/sheet-dialog/sheet-dialog.directive.ts","../../../projects/addon-mobile/components/sheet-dialog/taiga-ui-addon-mobile-components-sheet-dialog.ts"],"sourcesContent":["import {AsyncPipe, NgForOf, NgIf} from '@angular/common';\nimport type {AfterViewInit, ElementRef, QueryList} from '@angular/core';\nimport {\n ChangeDetectionStrategy,\n Component,\n inject,\n ViewChild,\n ViewChildren,\n} from '@angular/core';\nimport {takeUntilDestroyed} from '@angular/core/rxjs-interop';\nimport {EMPTY_QUERY} from '@taiga-ui/cdk/constants';\nimport {TuiClickOutside} from '@taiga-ui/cdk/directives/click-outside';\nimport type {TuiPopover} from '@taiga-ui/cdk/services';\nimport {tuiInjectElement} from '@taiga-ui/cdk/utils/dom';\nimport {tuiPure} from '@taiga-ui/cdk/utils/miscellaneous';\nimport {tuiSlideInTop} from '@taiga-ui/core/animations';\nimport {TuiButton} from '@taiga-ui/core/components/button';\nimport {\n TUI_ANIMATIONS_SPEED,\n TUI_CLOSE_WORD,\n TUI_COMMON_ICONS,\n} from '@taiga-ui/core/tokens';\nimport {tuiGetDuration} from '@taiga-ui/core/utils/miscellaneous';\nimport {shouldCall} from '@taiga-ui/event-plugins';\nimport {\n injectContext,\n PolymorpheusOutlet,\n PolymorpheusTemplate,\n} from '@taiga-ui/polymorpheus';\nimport {BehaviorSubject} from 'rxjs';\n\nimport type {TuiSheetDialogOptions} from './sheet-dialog.options';\n\n// So we re-enter ngZone and trigger change detection\nfunction isCloseable(this: TuiSheetDialogComponent<unknown>): boolean {\n return this.context.closeable;\n}\n\n@Component({\n standalone: true,\n selector: 'tui-sheet-dialog',\n imports: [\n AsyncPipe,\n NgForOf,\n NgIf,\n PolymorpheusOutlet,\n PolymorpheusTemplate,\n TuiButton,\n TuiClickOutside,\n ],\n templateUrl: './sheet-dialog.template.html',\n styleUrls: ['./sheet-dialog.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n animations: [tuiSlideInTop],\n host: {\n '[@tuiSlideInTop]': 'slideInTop',\n '[style.top.px]': 'offset',\n '[class._closeable]': 'closeable',\n '(document:touchstart.passive.silent)': 'onPointerChange(1)',\n '(document:touchend.silent)': 'onPointerChange(-1)',\n '(document:touchcancel.silent)': 'onPointerChange(-1)',\n '(scroll.silent)': 'onPointerChange(0)',\n },\n})\nexport class TuiSheetDialogComponent<I> implements AfterViewInit {\n @ViewChild('sheet')\n private readonly sheet?: ElementRef<HTMLElement>;\n\n @ViewChildren('stops')\n private readonly stopsRefs: QueryList<ElementRef<HTMLElement>> = EMPTY_QUERY;\n\n private readonly el = tuiInjectElement();\n private pointers = 0;\n\n protected readonly slideInTop = {\n value: '',\n params: {\n start: '100vh',\n duration: tuiGetDuration(inject(TUI_ANIMATIONS_SPEED)),\n },\n };\n\n protected readonly stuck$ = new BehaviorSubject(false);\n\n protected readonly stuck$$ = this.stuck$\n .pipe(takeUntilDestroyed())\n .subscribe((add) =>\n add ? this.el.classList.add('_stuck') : this.el.classList.remove('_stuck'),\n );\n\n protected readonly icons = inject(TUI_COMMON_ICONS);\n protected readonly closeWord$ = inject(TUI_CLOSE_WORD);\n protected readonly context =\n injectContext<TuiPopover<TuiSheetDialogOptions<I>, any>>();\n\n public ngAfterViewInit(): void {\n this.el.scrollTop =\n [...this.getStops(this.stopsRefs), this.sheetTop][this.context.initial] ?? 0;\n }\n\n protected get offset(): number {\n return this.context.offset;\n }\n\n protected get closeable(): boolean {\n return this.context.closeable;\n }\n\n protected get isSmall(): boolean {\n return this.sheetTop > (this.sheet?.nativeElement.clientHeight || Infinity);\n }\n\n @shouldCall(isCloseable)\n protected close(): void {\n // TODO: Refactor focus visible on mobile\n this.el.dispatchEvent(new Event('mousedown', {bubbles: true}));\n this.context.$implicit.complete();\n }\n\n protected onPointerChange(delta: number): void {\n this.pointers += delta;\n\n if (!delta) {\n const stuck = this.el.scrollTop > this.sheetTop;\n\n this.stuck$.value !== stuck && this.stuck$.next(stuck);\n }\n\n if (this.context.closeable && !this.pointers && !this.el.scrollTop) {\n this.close();\n }\n }\n\n private get sheetTop(): number {\n return this.sheet?.nativeElement.offsetTop ?? Infinity;\n }\n\n @tuiPure\n private getStops(stops: QueryList<ElementRef<HTMLElement>>): readonly number[] {\n return stops.map(\n ({nativeElement}) => nativeElement.offsetTop + nativeElement.clientHeight,\n );\n }\n}\n","<div class=\"t-stops\">\n <div\n *ngFor=\"let stop of context.stops\"\n #stops\n class=\"t-stop\"\n [style.margin-top]=\"stop\"\n ></div>\n</div>\n<div\n #sheet\n class=\"t-sheet\"\n [class.t-sheet_small]=\"isSmall\"\n (tuiClickOutside)=\"close()\"\n>\n <div class=\"t-top\"></div>\n <h2\n *ngIf=\"context.label\"\n class=\"t-heading\"\n [id]=\"context.id\"\n >\n <ng-container *polymorpheusOutlet=\"context.label as label\">\n {{ label }}\n </ng-container>\n <button\n *ngIf=\"context.closeable\"\n appearance=\"icon\"\n size=\"xs\"\n tuiIconButton\n type=\"button\"\n class=\"t-close\"\n [iconStart]=\"icons.close\"\n (click)=\"close()\"\n >\n {{ closeWord$ | async }}\n </button>\n </h2>\n <div\n *ngIf=\"context.content\"\n class=\"t-content\"\n >\n <ng-container *polymorpheusOutlet=\"context.content as text; context: context\">\n {{ text }}\n </ng-container>\n </div>\n</div>\n<div class=\"t-footer\"></div>\n","import type {Provider} from '@angular/core';\nimport {tuiCreateToken, tuiProvideOptions} from '@taiga-ui/cdk/utils/miscellaneous';\nimport type {PolymorpheusContent} from '@taiga-ui/polymorpheus';\n\nexport interface TuiSheetDialogOptions<I = undefined> {\n readonly closeable: boolean;\n readonly data: I;\n readonly initial: number;\n readonly label: PolymorpheusContent;\n readonly offset: number;\n readonly stops: readonly string[];\n}\n\nexport const TUI_SHEET_DIALOG_DEFAULT_OPTIONS: TuiSheetDialogOptions = {\n label: '',\n stops: [],\n initial: 0,\n offset: 16,\n closeable: true,\n data: undefined,\n};\n\n/**\n * Default parameters for mobile dialog component\n */\nexport const TUI_SHEET_DIALOG_OPTIONS = tuiCreateToken(TUI_SHEET_DIALOG_DEFAULT_OPTIONS);\n\nexport function tuiSheetDialogOptionsProvider(\n options: Partial<TuiSheetDialogOptions>,\n): Provider {\n return tuiProvideOptions(\n TUI_SHEET_DIALOG_OPTIONS,\n options,\n TUI_SHEET_DIALOG_DEFAULT_OPTIONS,\n );\n}\n","import {inject, Injectable} from '@angular/core';\nimport {TuiPopoverService} from '@taiga-ui/cdk/services';\nimport {TUI_DIALOGS} from '@taiga-ui/core/components/dialog';\n\nimport {TuiSheetDialogComponent} from './sheet-dialog.component';\nimport type {TuiSheetDialogOptions} from './sheet-dialog.options';\nimport {TUI_SHEET_DIALOG_OPTIONS} from './sheet-dialog.options';\n\n@Injectable({\n providedIn: 'root',\n useFactory: () =>\n new TuiSheetDialogService(\n TUI_DIALOGS,\n TuiSheetDialogComponent,\n inject(TUI_SHEET_DIALOG_OPTIONS),\n ),\n})\nexport class TuiSheetDialogService extends TuiPopoverService<\n TuiSheetDialogOptions<any>\n> {}\n","import {Directive} from '@angular/core';\nimport {TuiPopoverDirective} from '@taiga-ui/cdk/directives/popover';\nimport {tuiAsPopover} from '@taiga-ui/cdk/services';\n\nimport type {TuiSheetDialogOptions} from './sheet-dialog.options';\nimport {TuiSheetDialogService} from './sheet-dialog.service';\n\n@Directive({\n standalone: true,\n selector: 'ng-template[tuiSheetDialog]',\n inputs: ['options: tuiSheetDialogOptions', 'open: tuiSheetDialog'],\n outputs: ['openChange: tuiSheetDialogChange'],\n providers: [tuiAsPopover(TuiSheetDialogService)],\n})\nexport class TuiSheetDialog extends TuiPopoverDirective<TuiSheetDialogOptions> {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAiCA;AACA,SAAS,WAAW,GAAA;AAChB,IAAA,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;AAClC,CAAC;AAED,MA0Ba,uBAAuB,CAAA;AA1BpC,IAAA,WAAA,GAAA;QA+BqB,IAAS,CAAA,SAAA,GAAuC,WAAW,CAAC;QAE5D,IAAE,CAAA,EAAA,GAAG,gBAAgB,EAAE,CAAC;QACjC,IAAQ,CAAA,QAAA,GAAG,CAAC,CAAC;AAEF,QAAA,IAAA,CAAA,UAAU,GAAG;AAC5B,YAAA,KAAK,EAAE,EAAE;AACT,YAAA,MAAM,EAAE;AACJ,gBAAA,KAAK,EAAE,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AACnD,iBAAA,CAAA;;;ACbD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-addon-mobile-components-sheet-dialog.mjs","sources":["../../../projects/addon-mobile/components/sheet-dialog/sheet-dialog.component.ts","../../../projects/addon-mobile/components/sheet-dialog/sheet-dialog.template.html","../../../projects/addon-mobile/components/sheet-dialog/sheet-dialog.options.ts","../../../projects/addon-mobile/components/sheet-dialog/sheet-dialog.service.ts","../../../projects/addon-mobile/components/sheet-dialog/sheet-dialog.directive.ts","../../../projects/addon-mobile/components/sheet-dialog/taiga-ui-addon-mobile-components-sheet-dialog.ts"],"sourcesContent":["import {NgForOf, NgIf} from '@angular/common';\nimport type {AfterViewInit, ElementRef, QueryList} from '@angular/core';\nimport {ChangeDetectionStrategy, Component, inject, ViewChildren} from '@angular/core';\nimport {EMPTY_QUERY} from '@taiga-ui/cdk/constants';\nimport type {TuiPopover} from '@taiga-ui/cdk/services';\nimport {tuiInjectElement} from '@taiga-ui/cdk/utils/dom';\nimport {tuiSlideInTop} from '@taiga-ui/core/animations';\nimport {TuiButton} from '@taiga-ui/core/components/button';\nimport {TUI_ANIMATIONS_SPEED} from '@taiga-ui/core/tokens';\nimport {tuiGetDuration} from '@taiga-ui/core/utils/miscellaneous';\nimport {shouldCall} from '@taiga-ui/event-plugins';\nimport {injectContext, PolymorpheusOutlet} from '@taiga-ui/polymorpheus';\n\nimport type {TuiSheetDialogOptions} from './sheet-dialog.options';\n\n// So we re-enter ngZone and trigger change detection\nfunction isCloseable(this: TuiSheetDialogComponent<unknown>): boolean {\n return this.context.closeable === true;\n}\n\n@Component({\n standalone: true,\n selector: 'tui-sheet-dialog',\n imports: [NgForOf, NgIf, PolymorpheusOutlet, TuiButton],\n templateUrl: './sheet-dialog.template.html',\n styleUrls: ['./sheet-dialog.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n animations: [tuiSlideInTop],\n host: {\n '[@tuiSlideInTop]': 'slideInTop',\n '[style.--tui-offset.px]': 'context.offset',\n '[class._closeable]': 'context.closeable === true',\n '(document:touchstart.passive.silent)': 'onPointerChange(1)',\n '(document:touchend.silent)': 'onPointerChange(-1)',\n '(document:touchcancel.silent)': 'onPointerChange(-1)',\n '(scroll.silent)': 'onPointerChange(0)',\n '(click.self)': 'close()',\n },\n})\nexport class TuiSheetDialogComponent<I> implements AfterViewInit {\n @ViewChildren('stops')\n private readonly stops: QueryList<ElementRef<HTMLElement>> = EMPTY_QUERY;\n\n private readonly el = tuiInjectElement();\n private pointers = 0;\n\n protected readonly slideInTop = {\n value: '',\n params: {\n start: '100vh',\n duration: tuiGetDuration(inject(TUI_ANIMATIONS_SPEED)),\n },\n };\n\n protected readonly context =\n injectContext<TuiPopover<TuiSheetDialogOptions<I>, any>>();\n\n public ngAfterViewInit(): void {\n this.el.scrollTop =\n [\n ...this.stops.map((e) => e.nativeElement.offsetTop - this.context.offset),\n this.el.clientHeight ?? Infinity,\n ][this.context.initial] ?? 0;\n }\n\n @shouldCall(isCloseable)\n protected close(): void {\n this.context.$implicit.complete();\n }\n\n protected onPointerChange(delta: number): void {\n this.pointers += delta;\n\n if (!this.pointers && this.el.scrollTop <= 0) {\n this.close();\n }\n }\n}\n","<div class=\"t-stops\">\n <div\n *ngFor=\"let stop of context.stops\"\n #stops\n class=\"t-stop\"\n [style.margin-top]=\"stop\"\n ></div>\n</div>\n<div class=\"t-sheet\">\n <div\n *ngIf=\"context.bar\"\n class=\"t-top\"\n ></div>\n <h2\n *ngIf=\"context.label\"\n class=\"t-heading\"\n [id]=\"context.id\"\n >\n <ng-container *polymorpheusOutlet=\"context.label as label; context: context\">\n {{ label }}\n </ng-container>\n </h2>\n <div class=\"t-content\">\n <ng-container *polymorpheusOutlet=\"context.content as text; context: context\">\n {{ text }}\n </ng-container>\n </div>\n</div>\n","import type {Provider} from '@angular/core';\nimport type {TuiPopover} from '@taiga-ui/cdk/services';\nimport {tuiCreateToken, tuiProvideOptions} from '@taiga-ui/cdk/utils/miscellaneous';\nimport type {PolymorpheusContent} from '@taiga-ui/polymorpheus';\nimport type {Observable} from 'rxjs';\n\nexport interface TuiSheetDialogOptions<I = undefined> {\n readonly closeable: Observable<boolean> | boolean;\n readonly data: I;\n readonly initial: number;\n readonly label: PolymorpheusContent<TuiPopover<TuiSheetDialogOptions<I>, any>>;\n readonly offset: number;\n readonly stops: readonly string[];\n readonly bar: boolean;\n}\n\nexport const TUI_SHEET_DIALOG_DEFAULT_OPTIONS: TuiSheetDialogOptions = {\n label: '',\n stops: [],\n initial: 0,\n offset: 16,\n closeable: true,\n data: undefined,\n bar: true,\n};\n\n/**\n * Default parameters for mobile dialog component\n */\nexport const TUI_SHEET_DIALOG_OPTIONS = tuiCreateToken(TUI_SHEET_DIALOG_DEFAULT_OPTIONS);\n\nexport function tuiSheetDialogOptionsProvider(\n options: Partial<TuiSheetDialogOptions>,\n): Provider {\n return tuiProvideOptions(\n TUI_SHEET_DIALOG_OPTIONS,\n options,\n TUI_SHEET_DIALOG_DEFAULT_OPTIONS,\n );\n}\n","import {inject, Injectable} from '@angular/core';\nimport {takeUntilDestroyed} from '@angular/core/rxjs-interop';\nimport {TuiPopoverService, TuiThemeColorService} from '@taiga-ui/cdk/services';\nimport {TUI_DIALOGS} from '@taiga-ui/core/components/dialog';\nimport {pairwise, startWith} from 'rxjs';\n\nimport {TuiSheetDialogComponent} from './sheet-dialog.component';\nimport type {TuiSheetDialogOptions} from './sheet-dialog.options';\nimport {TUI_SHEET_DIALOG_OPTIONS} from './sheet-dialog.options';\n\nconst THEME = '#404040';\n\n@Injectable({\n providedIn: 'root',\n useFactory: () =>\n new TuiSheetDialogService(\n TUI_DIALOGS,\n TuiSheetDialogComponent,\n inject(TUI_SHEET_DIALOG_OPTIONS),\n ),\n})\nexport class TuiSheetDialogService extends TuiPopoverService<TuiSheetDialogOptions<any>> {\n private readonly theme = inject(TuiThemeColorService);\n private initial = this.theme.color;\n\n protected readonly $ = this.items$\n .pipe(startWith([]), pairwise(), takeUntilDestroyed())\n .subscribe(([prev, next]) => {\n if (!prev.length && next.length) {\n this.initial = this.theme.color;\n this.theme.color = THEME;\n }\n\n if (!next.length && prev.length) {\n this.theme.color = this.initial;\n }\n });\n}\n","import {Directive} from '@angular/core';\nimport {TuiPopoverDirective} from '@taiga-ui/cdk/directives/popover';\nimport {tuiAsPopover} from '@taiga-ui/cdk/services';\n\nimport type {TuiSheetDialogOptions} from './sheet-dialog.options';\nimport {TuiSheetDialogService} from './sheet-dialog.service';\n\n@Directive({\n standalone: true,\n selector: 'ng-template[tuiSheetDialog]',\n inputs: ['options: tuiSheetDialogOptions', 'open: tuiSheetDialog'],\n outputs: ['openChange: tuiSheetDialogChange'],\n providers: [tuiAsPopover(TuiSheetDialogService)],\n})\nexport class TuiSheetDialog extends TuiPopoverDirective<TuiSheetDialogOptions> {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAeA;AACA,SAAS,WAAW,GAAA;AAChB,IAAA,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC;AAC3C,CAAC;AAED,MAmBa,uBAAuB,CAAA;AAnBpC,IAAA,WAAA,GAAA;QAqBqB,IAAK,CAAA,KAAA,GAAuC,WAAW,CAAC;QAExD,IAAE,CAAA,EAAA,GAAG,gBAAgB,EAAE,CAAC;QACjC,IAAQ,CAAA,QAAA,GAAG,CAAC,CAAC;AAEF,QAAA,IAAA,CAAA,UAAU,GAAG;AAC5B,YAAA,KAAK,EAAE,EAAE;AACT,YAAA,MAAM,EAAE;AACJ,gBAAA,KAAK,EAAE,OAAO;AACd,gBAAA,QAAQ,EAAE,cAAc,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;AACzD,aAAA;SACJ,CAAC;QAEiB,IAAO,CAAA,OAAA,GACtB,aAAa,EAA6C,CAAC;AAsBlE,KAAA;IApBU,eAAe,GAAA;QAClB,IAAI,CAAC,EAAE,CAAC,SAAS;AACb,YAAA;g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AA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;4FAEvC,cAAc,EAAA,UAAA,EAAA,CAAA;kBAP1B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,QAAQ,EAAE,6BAA6B;AACvC,oBAAA,MAAM,EAAE,CAAC,gCAAgC,EAAE,sBAAsB,CAAC;oBAClE,OAAO,EAAE,CAAC,kCAAkC,CAAC;AAC7C,oBAAA,SAAS,EAAE,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;AACnD,iBAAA,CAAA;;;ACbD;;AAEG;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Component, ChangeDetectionStrategy, Input, EventEmitter, ElementRef, ContentChildren, forwardRef, Output,
|
|
2
|
+
import { inject, Component, ChangeDetectionStrategy, Input, EventEmitter, ElementRef, ContentChildren, forwardRef, Output, Directive } from '@angular/core';
|
|
3
3
|
import { EMPTY_QUERY } from '@taiga-ui/cdk/constants';
|
|
4
4
|
import { TuiRepeatTimes } from '@taiga-ui/cdk/directives/repeat-times';
|
|
5
5
|
import { tuiIsElement, tuiInjectElement } from '@taiga-ui/cdk/utils/dom';
|
|
@@ -78,7 +78,7 @@ class TuiTabBarItemDirective {
|
|
|
78
78
|
const tabs = inject(TuiTabBarComponent);
|
|
79
79
|
const el = tuiInjectElement();
|
|
80
80
|
const link = inject(RouterLinkActive, { optional: true })?.isActiveChange || EMPTY;
|
|
81
|
-
link.pipe(filter(Boolean), tuiWatch(
|
|
81
|
+
link.pipe(filter(Boolean), tuiWatch(), takeUntilDestroyed()).subscribe(() => tabs.setActive(el));
|
|
82
82
|
}
|
|
83
83
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTabBarItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
84
84
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: TuiTabBarItemDirective, isStandalone: true, selector: "[tuiTabBarItem][routerLinkActive]", ngImport: i0 }); }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-addon-mobile-components-tab-bar.mjs","sources":["../../../projects/addon-mobile/components/tab-bar/tab-bar-item.component.ts","../../../projects/addon-mobile/components/tab-bar/tab-bar-item.template.html","../../../projects/addon-mobile/components/tab-bar/tab-bar.component.ts","../../../projects/addon-mobile/components/tab-bar/tab-bar.template.html","../../../projects/addon-mobile/components/tab-bar/tab-bar-item.directive.ts","../../../projects/addon-mobile/components/tab-bar/tab-bar.ts","../../../projects/addon-mobile/components/tab-bar/taiga-ui-addon-mobile-components-tab-bar.ts"],"sourcesContent":["import {NgIf} from '@angular/common';\nimport {ChangeDetectionStrategy, Component, inject, Input} from '@angular/core';\nimport {tuiScaleIn} from '@taiga-ui/core/animations';\nimport {TuiIcon} from '@taiga-ui/core/components/icon';\nimport {TUI_ANIMATIONS_SPEED} from '@taiga-ui/core/tokens';\nimport {tuiToAnimationOptions} from '@taiga-ui/core/utils/miscellaneous';\n\n@Component({\n standalone: true,\n selector: 'button[tuiTabBarItem], a[tuiTabBarItem]',\n imports: [NgIf, TuiIcon],\n templateUrl: './tab-bar-item.template.html',\n styleUrls: ['./tab-bar-item.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n animations: [tuiScaleIn],\n})\nexport class TuiTabBarItem {\n protected readonly options = tuiToAnimationOptions(inject(TUI_ANIMATIONS_SPEED));\n\n @Input()\n public icon = '';\n\n @Input()\n public badge?: number | null = null;\n\n protected format(value: number): string {\n return value > 999 ? '999+' : String(value);\n }\n}\n","<tui-icon\n class=\"t-icon\"\n [icon]=\"icon\"\n/>\n<span class=\"t-wrapper\">\n <span\n *ngIf=\"badge as value\"\n class=\"t-badge\"\n [@tuiScaleIn]=\"options\"\n >\n {{ format(value) }}\n </span>\n</span>\n<span class=\"t-text\">\n <ng-content />\n</span>\n","import type {QueryList} from '@angular/core';\nimport {\n ChangeDetectionStrategy,\n Component,\n ContentChildren,\n ElementRef,\n EventEmitter,\n forwardRef,\n Input,\n Output,\n} from '@angular/core';\nimport {EMPTY_QUERY} from '@taiga-ui/cdk/constants';\nimport {TuiRepeatTimes} from '@taiga-ui/cdk/directives/repeat-times';\nimport {tuiIsElement} from '@taiga-ui/cdk/utils/dom';\n\nimport {TuiTabBarItem} from './tab-bar-item.component';\n\n@Component({\n standalone: true,\n selector: 'nav[tuiTabBar]',\n imports: [TuiRepeatTimes],\n templateUrl: './tab-bar.template.html',\n styleUrls: ['./tab-bar.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[style]': 'style',\n '(click)': 'setActive($event.target)',\n },\n})\nexport class TuiTabBarComponent {\n @ContentChildren(forwardRef(() => TuiTabBarItem), {read: ElementRef})\n private readonly tabs: QueryList<ElementRef<HTMLElement>> = EMPTY_QUERY;\n\n @Input()\n public quantity = 4;\n\n @Input()\n public activeItemIndex = NaN;\n\n @Output()\n public readonly activeItemIndexChange = new EventEmitter<number>();\n\n public setActive(tab: EventTarget): void {\n if (tuiIsElement(tab)) {\n this.updateIndex(\n this.tabs.toArray().findIndex(({nativeElement}) => nativeElement === tab),\n );\n }\n }\n\n protected get style(): string {\n return `--tui-tab-${this.activeItemIndex + 1}: var(--tui-active-color)`;\n }\n\n private updateIndex(index: number): void {\n this.activeItemIndex = index;\n this.activeItemIndexChange.emit(index);\n }\n}\n","<ng-content />\n<div class=\"t-skeletons\">\n <div\n *tuiRepeatTimes=\"let index of quantity\"\n class=\"t-skeleton\"\n ></div>\n</div>\n","import {
|
|
1
|
+
{"version":3,"file":"taiga-ui-addon-mobile-components-tab-bar.mjs","sources":["../../../projects/addon-mobile/components/tab-bar/tab-bar-item.component.ts","../../../projects/addon-mobile/components/tab-bar/tab-bar-item.template.html","../../../projects/addon-mobile/components/tab-bar/tab-bar.component.ts","../../../projects/addon-mobile/components/tab-bar/tab-bar.template.html","../../../projects/addon-mobile/components/tab-bar/tab-bar-item.directive.ts","../../../projects/addon-mobile/components/tab-bar/tab-bar.ts","../../../projects/addon-mobile/components/tab-bar/taiga-ui-addon-mobile-components-tab-bar.ts"],"sourcesContent":["import {NgIf} from '@angular/common';\nimport {ChangeDetectionStrategy, Component, inject, Input} from '@angular/core';\nimport {tuiScaleIn} from '@taiga-ui/core/animations';\nimport {TuiIcon} from '@taiga-ui/core/components/icon';\nimport {TUI_ANIMATIONS_SPEED} from '@taiga-ui/core/tokens';\nimport {tuiToAnimationOptions} from '@taiga-ui/core/utils/miscellaneous';\n\n@Component({\n standalone: true,\n selector: 'button[tuiTabBarItem], a[tuiTabBarItem]',\n imports: [NgIf, TuiIcon],\n templateUrl: './tab-bar-item.template.html',\n styleUrls: ['./tab-bar-item.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n animations: [tuiScaleIn],\n})\nexport class TuiTabBarItem {\n protected readonly options = tuiToAnimationOptions(inject(TUI_ANIMATIONS_SPEED));\n\n @Input()\n public icon = '';\n\n @Input()\n public badge?: number | null = null;\n\n protected format(value: number): string {\n return value > 999 ? '999+' : String(value);\n }\n}\n","<tui-icon\n class=\"t-icon\"\n [icon]=\"icon\"\n/>\n<span class=\"t-wrapper\">\n <span\n *ngIf=\"badge as value\"\n class=\"t-badge\"\n [@tuiScaleIn]=\"options\"\n >\n {{ format(value) }}\n </span>\n</span>\n<span class=\"t-text\">\n <ng-content />\n</span>\n","import type {QueryList} from '@angular/core';\nimport {\n ChangeDetectionStrategy,\n Component,\n ContentChildren,\n ElementRef,\n EventEmitter,\n forwardRef,\n Input,\n Output,\n} from '@angular/core';\nimport {EMPTY_QUERY} from '@taiga-ui/cdk/constants';\nimport {TuiRepeatTimes} from '@taiga-ui/cdk/directives/repeat-times';\nimport {tuiIsElement} from '@taiga-ui/cdk/utils/dom';\n\nimport {TuiTabBarItem} from './tab-bar-item.component';\n\n@Component({\n standalone: true,\n selector: 'nav[tuiTabBar]',\n imports: [TuiRepeatTimes],\n templateUrl: './tab-bar.template.html',\n styleUrls: ['./tab-bar.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[style]': 'style',\n '(click)': 'setActive($event.target)',\n },\n})\nexport class TuiTabBarComponent {\n @ContentChildren(forwardRef(() => TuiTabBarItem), {read: ElementRef})\n private readonly tabs: QueryList<ElementRef<HTMLElement>> = EMPTY_QUERY;\n\n @Input()\n public quantity = 4;\n\n @Input()\n public activeItemIndex = NaN;\n\n @Output()\n public readonly activeItemIndexChange = new EventEmitter<number>();\n\n public setActive(tab: EventTarget): void {\n if (tuiIsElement(tab)) {\n this.updateIndex(\n this.tabs.toArray().findIndex(({nativeElement}) => nativeElement === tab),\n );\n }\n }\n\n protected get style(): string {\n return `--tui-tab-${this.activeItemIndex + 1}: var(--tui-active-color)`;\n }\n\n private updateIndex(index: number): void {\n this.activeItemIndex = index;\n this.activeItemIndexChange.emit(index);\n }\n}\n","<ng-content />\n<div class=\"t-skeletons\">\n <div\n *tuiRepeatTimes=\"let index of quantity\"\n class=\"t-skeleton\"\n ></div>\n</div>\n","import {Directive, inject} from '@angular/core';\nimport {takeUntilDestroyed} from '@angular/core/rxjs-interop';\nimport {RouterLinkActive} from '@angular/router';\nimport {tuiWatch} from '@taiga-ui/cdk/observables';\nimport {tuiInjectElement} from '@taiga-ui/cdk/utils/dom';\nimport type {Observable} from 'rxjs';\nimport {EMPTY, filter} from 'rxjs';\n\nimport {TuiTabBarComponent} from './tab-bar.component';\n\n@Directive({\n standalone: true,\n selector: '[tuiTabBarItem][routerLinkActive]',\n})\nexport class TuiTabBarItemDirective {\n constructor() {\n const tabs = inject(TuiTabBarComponent);\n const el = tuiInjectElement();\n const link: Observable<boolean> =\n inject(RouterLinkActive, {optional: true})?.isActiveChange || EMPTY;\n\n link.pipe(filter(Boolean), tuiWatch(), takeUntilDestroyed()).subscribe(() =>\n tabs.setActive(el),\n );\n }\n}\n","import {TuiTabBarComponent} from './tab-bar.component';\nimport {TuiTabBarItem} from './tab-bar-item.component';\nimport {TuiTabBarItemDirective} from './tab-bar-item.directive';\n\nexport const TuiTabBar = [\n TuiTabBarComponent,\n TuiTabBarItem,\n TuiTabBarItemDirective,\n] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAOA,MASa,aAAa,CAAA;AAT1B,IAAA,WAAA,GAAA;QAUuB,IAAO,CAAA,OAAA,GAAG,qBAAqB,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAC;QAG1E,IAAI,CAAA,IAAA,GAAG,EAAE,CAAC;QAGV,IAAK,CAAA,KAAA,GAAmB,IAAI,CAAC;AAKvC,KAAA;AAHa,IAAA,MAAM,CAAC,KAAa,EAAA;AAC1B,QAAA,OAAO,KAAK,GAAG,GAAG,GAAG,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;KAC/C;+GAXQ,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;mGAAb,aAAa,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,yCAAA,EAAA,MAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,KAAA,EAAA,OAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EChB1B,mTAgBA,EDNc,MAAA,EAAA,CAAA,i9CAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,IAAI,6FAAE,OAAO,EAAA,QAAA,EAAA,UAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,YAAA,CAAA,EAAA,CAAA,EAAA,UAAA,EAIX,CAAC,UAAU,CAAC,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA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AAE,GAAG,gBAAgB,EAAE,CAAC;AAC9B,QAAA,MAAM,IAAI,GACN,MAAM,CAAC,gBAAgB,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC,EAAE,cAAc,IAAI,KAAK,CAAC;QAExE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE,kBAAkB,EAAE,CAAC,CAAC,SAAS,CAAC,MACnE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CACrB,CAAC;KACL;+GAVQ,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;mGAAtB,sBAAsB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,mCAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;4FAAtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAJlC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,QAAQ,EAAE,mCAAmC;AAChD,iBAAA,CAAA;;;ACTY,MAAA,SAAS,GAAG;IACrB,kBAAkB;IAClB,aAAa;IACb,sBAAsB;;;ACP1B;;AAEG;;;;"}
|
|
@@ -138,7 +138,7 @@ class TuiDropdownMobileComponent {
|
|
|
138
138
|
return this.dropdown.el.contains(tuiGetNativeFocused(this.doc));
|
|
139
139
|
}
|
|
140
140
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiDropdownMobileComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
141
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiDropdownMobileComponent, isStandalone: true, selector: "tui-dropdown-mobile", host: { listeners: { "document:click.silent.capture": "onClick($event)", "window>scroll.silent.capture": "refresh($event.currentTarget.visualViewport)", "visualViewport>resize.silent": "refresh($event.target)", "visualViewport>scroll.silent": "refresh($event.target)" }, properties: { "@tuiFadeIn": "animation", "@tuiSlideInTop": "animation", "class._sheet": "directive.tuiDropdownMobile" } }, hostDirectives: [{ directive: i1.TuiActiveZone }], ngImport: i0, template: "<div\n *ngIf=\"directive.tuiDropdownMobile\"\n waIntersectionObserver\n waIntersectionThreshold=\"1\"\n class=\"t-filler\"\n (touchstart.prevent)=\"close()\"\n (waIntersectionObservee)=\"$event[0] && onIntersection($event[0])\"\n></div>\n<div\n #container\n class=\"t-container\"\n (tuiSwipe)=\"onSwipe($event, container)\"\n>\n <h2\n *ngIf=\"directive.tuiDropdownMobile\"\n class=\"t-heading\"\n >\n {{ directive.tuiDropdownMobile }}\n </h2>\n <div class=\"t-content\">\n <ng-container *polymorpheusOutlet=\"dropdown.content as text\">\n {{ text }}\n </ng-container>\n </div>\n</div>\n", styles: ["tui-dropdown-mobile:not(._sheet){scrollbar-width:none;-ms-overflow-style:none;position:fixed;top:0;left:0;inline-size:100%;block-size:100%;transition-property:transform;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;visibility:visible!important;transform:translateZ(0);background:var(--tui-background-base);overscroll-behavior:contain;overflow:auto;box-shadow:0 -.5rem .5rem var(--tui-background-base),0 10rem var(--tui-background-base),0 20rem var(--tui-background-base),0 30rem var(--tui-background-base)}tui-dropdown-mobile:not(._sheet)::-webkit-scrollbar,tui-dropdown-mobile:not(._sheet)::-webkit-scrollbar-thumb{display:none}tui-dropdown-mobile:not(._sheet):after{content:\"\";display:block;block-size:1px}tui-dropdown-mobile:not(._sheet)>.t-container{scrollbar-width:none;-ms-overflow-style:none;position:sticky;top:0;block-size:100%;overflow:auto;margin:0 .75rem;touch-action:pan-y!important}tui-dropdown-mobile:not(._sheet)>.t-container::-webkit-scrollbar,tui-dropdown-mobile:not(._sheet)>.t-container::-webkit-scrollbar-thumb{display:none}tui-dropdown-mobile:not(._sheet) [tuiDropdownButton][tuiDropdownButton]{position:fixed;right:1rem;bottom:1rem;display:inline-flex}tui-dropdown-mobile._sheet{position:fixed;top:0;left:0;bottom:0;right:0;scrollbar-width:none;-ms-overflow-style:none;overflow:auto;background:var(--tui-service-backdrop);box-shadow:0 -80vh 0 5rem var(--tui-service-backdrop);overflow-y:scroll;scroll-snap-type:y mandatory;overscroll-behavior:none}tui-dropdown-mobile._sheet::-webkit-scrollbar,tui-dropdown-mobile._sheet::-webkit-scrollbar-thumb{display:none}tui-dropdown-mobile._sheet>.t-filler{block-size:100%;scroll-snap-stop:always;scroll-snap-align:start}tui-dropdown-mobile._sheet>.t-container{display:flex;max-block-size:calc(100% - 1rem);flex-direction:column;border-top-left-radius:1rem;border-top-right-radius:1rem;padding:0 .5rem;scroll-snap-stop:always;scroll-snap-align:start;background:var(--tui-background-elevation-1)}tui-dropdown-mobile._sheet>.t-container>.t-heading{position:relative;margin:0;padding:2rem .5rem .75rem;font:var(--tui-font-heading-6)}tui-dropdown-mobile._sheet>.t-container>.t-heading:before{content:\"\";position:absolute;left:50%;top:.75rem;inline-size:2rem;block-size:.25rem;border-radius:1rem;background:var(--tui-background-neutral-2);transform:translate(-50%,-50%)}tui-dropdown-mobile._sheet>.t-container>.t-content{scrollbar-width:none;-ms-overflow-style:none;overflow:auto}tui-dropdown-mobile._sheet>.t-container>.t-content::-webkit-scrollbar,tui-dropdown-mobile._sheet>.t-container>.t-content::-webkit-scrollbar-thumb{display:none}.t-dropdown-mobile{touch-action:none;visibility:hidden}.t-dropdown-mobile *{touch-action:inherit;visibility:inherit}.t-dropdown-mobile tui-root{visibility:visible}.t-dropdown-mobile tui-root .t-root-content{visibility:hidden}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: PolymorpheusOutlet, selector: "[polymorpheusOutlet]", inputs: ["polymorpheusOutlet", "polymorpheusOutletContext"] }, { kind: "directive", type: TuiSwipe, selector: "[tuiSwipe]", outputs: ["tuiSwipe"] }, { kind: "directive", type: i2.WaIntersectionObserverDirective, selector: "[waIntersectionObserver]", inputs: ["
|
|
141
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiDropdownMobileComponent, isStandalone: true, selector: "tui-dropdown-mobile", host: { listeners: { "document:click.silent.capture": "onClick($event)", "window>scroll.silent.capture": "refresh($event.currentTarget.visualViewport)", "visualViewport>resize.silent": "refresh($event.target)", "visualViewport>scroll.silent": "refresh($event.target)" }, properties: { "@tuiFadeIn": "animation", "@tuiSlideInTop": "animation", "class._sheet": "directive.tuiDropdownMobile" } }, hostDirectives: [{ directive: i1.TuiActiveZone }], ngImport: i0, template: "<div\n *ngIf=\"directive.tuiDropdownMobile\"\n waIntersectionObserver\n waIntersectionThreshold=\"1\"\n class=\"t-filler\"\n (touchstart.prevent)=\"close()\"\n (waIntersectionObservee)=\"$event[0] && onIntersection($event[0])\"\n></div>\n<div\n #container\n class=\"t-container\"\n (tuiSwipe)=\"onSwipe($event, container)\"\n>\n <h2\n *ngIf=\"directive.tuiDropdownMobile\"\n class=\"t-heading\"\n >\n {{ directive.tuiDropdownMobile }}\n </h2>\n <div class=\"t-content\">\n <ng-container *polymorpheusOutlet=\"dropdown.content as text\">\n {{ text }}\n </ng-container>\n </div>\n</div>\n", styles: ["tui-dropdown-mobile:not(._sheet){scrollbar-width:none;-ms-overflow-style:none;position:fixed;top:0;left:0;inline-size:100%;block-size:100%;transition-property:transform;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;visibility:visible!important;transform:translateZ(0);background:var(--tui-background-base);overscroll-behavior:contain;overflow:auto;box-shadow:0 -.5rem .5rem var(--tui-background-base),0 10rem var(--tui-background-base),0 20rem var(--tui-background-base),0 30rem var(--tui-background-base)}tui-dropdown-mobile:not(._sheet)::-webkit-scrollbar,tui-dropdown-mobile:not(._sheet)::-webkit-scrollbar-thumb{display:none}tui-dropdown-mobile:not(._sheet):after{content:\"\";display:block;block-size:1px}tui-dropdown-mobile:not(._sheet)>.t-container{scrollbar-width:none;-ms-overflow-style:none;position:sticky;top:0;block-size:100%;overflow:auto;margin:0 .75rem;touch-action:pan-y!important}tui-dropdown-mobile:not(._sheet)>.t-container::-webkit-scrollbar,tui-dropdown-mobile:not(._sheet)>.t-container::-webkit-scrollbar-thumb{display:none}tui-dropdown-mobile:not(._sheet) [tuiDropdownButton][tuiDropdownButton]{position:fixed;right:1rem;bottom:1rem;display:inline-flex}tui-dropdown-mobile._sheet{position:fixed;top:0;left:0;bottom:0;right:0;scrollbar-width:none;-ms-overflow-style:none;overflow:auto;background:var(--tui-service-backdrop);box-shadow:0 -80vh 0 5rem var(--tui-service-backdrop);overflow-y:scroll;scroll-snap-type:y mandatory;overscroll-behavior:none}tui-dropdown-mobile._sheet::-webkit-scrollbar,tui-dropdown-mobile._sheet::-webkit-scrollbar-thumb{display:none}tui-dropdown-mobile._sheet>.t-filler{block-size:100%;scroll-snap-stop:always;scroll-snap-align:start}tui-dropdown-mobile._sheet>.t-container{display:flex;max-block-size:calc(100% - 1rem);flex-direction:column;border-top-left-radius:1rem;border-top-right-radius:1rem;padding:0 .5rem;scroll-snap-stop:always;scroll-snap-align:start;background:var(--tui-background-elevation-1)}tui-dropdown-mobile._sheet>.t-container>.t-heading{position:relative;margin:0;padding:2rem .5rem .75rem;font:var(--tui-font-heading-6)}tui-dropdown-mobile._sheet>.t-container>.t-heading:before{content:\"\";position:absolute;left:50%;top:.75rem;inline-size:2rem;block-size:.25rem;border-radius:1rem;background:var(--tui-background-neutral-2);transform:translate(-50%,-50%)}tui-dropdown-mobile._sheet>.t-container>.t-content{scrollbar-width:none;-ms-overflow-style:none;overflow:auto}tui-dropdown-mobile._sheet>.t-container>.t-content::-webkit-scrollbar,tui-dropdown-mobile._sheet>.t-container>.t-content::-webkit-scrollbar-thumb{display:none}.t-dropdown-mobile{touch-action:none;visibility:hidden}.t-dropdown-mobile *{touch-action:inherit;visibility:inherit}.t-dropdown-mobile tui-root{visibility:visible}.t-dropdown-mobile tui-root .t-root-content{visibility:hidden}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: PolymorpheusOutlet, selector: "[polymorpheusOutlet]", inputs: ["polymorpheusOutlet", "polymorpheusOutletContext"] }, { kind: "directive", type: TuiSwipe, selector: "[tuiSwipe]", outputs: ["tuiSwipe"] }, { kind: "directive", type: i2.WaIntersectionObserverDirective, selector: "[waIntersectionObserver]", inputs: ["waIntersectionRootMargin", "waIntersectionThreshold"], exportAs: ["IntersectionObserver"] }, { kind: "directive", type: i2.WaIntersectionObservee, selector: "[waIntersectionObservee]", outputs: ["waIntersectionObservee"] }], animations: [tuiSlideInTop, tuiFadeIn], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
142
142
|
}
|
|
143
143
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiDropdownMobileComponent, decorators: [{
|
|
144
144
|
type: Component,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-addon-mobile-directives-dropdown-mobile.mjs","sources":["../../../projects/addon-mobile/directives/dropdown-mobile/dropdown-mobile.directive.ts","../../../projects/addon-mobile/directives/dropdown-mobile/dropdown-mobile.component.ts","../../../projects/addon-mobile/directives/dropdown-mobile/dropdown-mobile.template.html","../../../projects/addon-mobile/directives/dropdown-mobile/taiga-ui-addon-mobile-directives-dropdown-mobile.ts"],"sourcesContent":["import {Directive, inject, Input} from '@angular/core';\nimport {TUI_IS_MOBILE} from '@taiga-ui/cdk/tokens';\nimport {tuiIsHTMLElement} from '@taiga-ui/cdk/utils/dom';\nimport {TUI_DROPDOWN_COMPONENT} from '@taiga-ui/core/directives/dropdown';\n\nimport {TuiDropdownMobileComponent} from './dropdown-mobile.component';\n\n@Directive({\n standalone: true,\n selector: '[tuiDropdownMobile]',\n providers: [\n {\n provide: TUI_DROPDOWN_COMPONENT,\n useFactory: () =>\n inject(TUI_IS_MOBILE)\n ? TuiDropdownMobileComponent\n : inject(TUI_DROPDOWN_COMPONENT, {skipSelf: true}),\n },\n ],\n host: {\n '[style.visibility]': '\"visible\"',\n '(mousedown)': 'onMouseDown($event)',\n },\n})\nexport class TuiDropdownMobile {\n private readonly isMobile = inject(TUI_IS_MOBILE);\n\n @Input()\n public tuiDropdownMobile = '';\n\n protected onMouseDown(event: MouseEvent): void {\n if (\n !this.isMobile ||\n !tuiIsHTMLElement(event.target) ||\n !event.target.matches('input,textarea')\n ) {\n return;\n }\n\n event.preventDefault();\n event.target.focus({preventScroll: true});\n }\n}\n","import {DOCUMENT, NgIf} from '@angular/common';\nimport type {AfterViewInit, OnDestroy} from '@angular/core';\nimport {\n ChangeDetectionStrategy,\n Component,\n inject,\n ViewEncapsulation,\n} from '@angular/core';\nimport {WaIntersectionObserver} from '@ng-web-apis/intersection-observer';\nimport {TuiKeyboardService} from '@taiga-ui/addon-mobile/services';\nimport {TuiActiveZone} from '@taiga-ui/cdk/directives/active-zone';\nimport type {TuiSwipeEvent} from '@taiga-ui/cdk/directives/swipe';\nimport {TuiSwipe} from '@taiga-ui/cdk/directives/swipe';\nimport {tuiInjectElement, tuiIsElement} from '@taiga-ui/cdk/utils/dom';\nimport {tuiGetNativeFocused} from '@taiga-ui/cdk/utils/focus';\nimport {tuiPx} from '@taiga-ui/cdk/utils/miscellaneous';\nimport {tuiFadeIn, tuiSlideInTop} from '@taiga-ui/core/animations';\nimport {TuiDropdownDirective} from '@taiga-ui/core/directives/dropdown';\nimport {TUI_ANIMATIONS_SPEED} from '@taiga-ui/core/tokens';\nimport {tuiGetDuration} from '@taiga-ui/core/utils/miscellaneous';\nimport {PolymorpheusOutlet, PolymorpheusTemplate} from '@taiga-ui/polymorpheus';\n\nimport {TuiDropdownMobile} from './dropdown-mobile.directive';\n\nconst GAP = 16;\n\n@Component({\n standalone: true,\n selector: 'tui-dropdown-mobile',\n imports: [\n NgIf,\n PolymorpheusOutlet,\n PolymorpheusTemplate,\n TuiSwipe,\n WaIntersectionObserver,\n ],\n templateUrl: './dropdown-mobile.template.html',\n styleUrls: ['./dropdown-mobile.style.less'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n animations: [tuiSlideInTop, tuiFadeIn],\n hostDirectives: [TuiActiveZone],\n host: {\n '[@tuiFadeIn]': 'animation',\n '[@tuiSlideInTop]': 'animation',\n '[class._sheet]': 'directive.tuiDropdownMobile',\n '(document:click.silent.capture)': 'onClick($event)',\n '(window>scroll.silent.capture)': 'refresh($event.currentTarget.visualViewport)',\n '(visualViewport>resize.silent)': 'refresh($event.target)',\n '(visualViewport>scroll.silent)': 'refresh($event.target)',\n },\n})\nexport class TuiDropdownMobileComponent implements OnDestroy, AfterViewInit {\n private readonly el = tuiInjectElement();\n private readonly keyboard = inject(TuiKeyboardService);\n private readonly doc = inject(DOCUMENT);\n private readonly scrollTop = this.doc.documentElement.scrollTop;\n private readonly observer = new ResizeObserver(() =>\n this.refresh(this.doc.defaultView!.visualViewport!),\n );\n\n protected readonly directive = inject(TuiDropdownMobile);\n protected readonly dropdown = inject(TuiDropdownDirective);\n protected readonly animation = {\n value: '',\n params: {\n start: '100vh',\n duration: tuiGetDuration(inject(TUI_ANIMATIONS_SPEED)),\n },\n } as const;\n\n constructor() {\n this.observer.observe(this.dropdown.el);\n this.doc.documentElement.style.setProperty('scroll-behavior', 'initial');\n }\n\n public ngAfterViewInit(): void {\n this.el.scrollTop = this.directive.tuiDropdownMobile ? this.el.clientHeight : 0;\n }\n\n public ngOnDestroy(): void {\n this.observer.disconnect();\n this.doc.body.classList.remove('t-dropdown-mobile');\n this.doc.body.style.removeProperty('--t-root-top');\n this.doc.documentElement.scrollTop = this.scrollTop;\n this.doc.documentElement.style.removeProperty('scroll-behavior');\n\n if (this.focused) {\n this.keyboard.hide();\n }\n }\n\n protected onClick(event: MouseEvent): void {\n if (\n tuiIsElement(event.target) &&\n !this.el.contains(event.target) &&\n (!this.dropdown.el.contains(event.target) ||\n event.target.matches('input,textarea'))\n ) {\n event.stopPropagation();\n }\n }\n\n protected onSwipe({direction}: TuiSwipeEvent, el: HTMLElement): void {\n if (\n direction === 'bottom' &&\n el.getBoundingClientRect().bottom > Number(this.doc.defaultView?.innerHeight)\n ) {\n this.close();\n }\n }\n\n protected onIntersection({isIntersecting}: IntersectionObserverEntry): void {\n if (isIntersecting) {\n this.close();\n }\n }\n\n protected close(): void {\n this.dropdown.toggle(false);\n }\n\n protected refresh({offsetTop, height}: VisualViewport): void {\n this.doc.body.style.removeProperty('--t-root-top');\n\n if (\n !this.focused ||\n this.directive.tuiDropdownMobile ||\n !this.doc.documentElement.style.getPropertyValue('scroll-behavior')\n ) {\n return;\n }\n\n this.doc.documentElement.scrollTop = 0;\n\n const rect = this.dropdown.el.getBoundingClientRect();\n const top = offsetTop + GAP - rect.top;\n const offset = rect.height + GAP * 2;\n\n this.el.style.setProperty('top', tuiPx(offsetTop + offset));\n this.el.style.setProperty('height', tuiPx(height - offset));\n this.doc.body.classList.add('t-dropdown-mobile');\n this.doc.body.style.setProperty('--t-root-top', tuiPx(top));\n }\n\n private get focused(): boolean {\n return this.dropdown.el.contains(tuiGetNativeFocused(this.doc));\n }\n}\n","<div\n *ngIf=\"directive.tuiDropdownMobile\"\n waIntersectionObserver\n waIntersectionThreshold=\"1\"\n class=\"t-filler\"\n (touchstart.prevent)=\"close()\"\n (waIntersectionObservee)=\"$event[0] && onIntersection($event[0])\"\n></div>\n<div\n #container\n class=\"t-container\"\n (tuiSwipe)=\"onSwipe($event, container)\"\n>\n <h2\n *ngIf=\"directive.tuiDropdownMobile\"\n class=\"t-heading\"\n >\n {{ directive.tuiDropdownMobile }}\n </h2>\n <div class=\"t-content\">\n <ng-container *polymorpheusOutlet=\"dropdown.content as text\">\n {{ text }}\n </ng-container>\n </div>\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,CAAA,IAAA,EAAA,CAAA,CAAA,EAAA;;4FAY7B,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBA1BtC,SAAS;iCACM,IAAI,EAAA,QAAA,EACN,qBAAqB,EACtB,OAAA,EAAA;wBACL,IAAI;wBACJ,kBAAkB;wBAClB,oBAAoB;wBACpB,QAAQ;wBACR,sBAAsB;AACzB,qBAAA,EAAA,aAAA,EAGc,iBAAiB,CAAC,IAAI,EACpB,eAAA,EAAA,uBAAuB,CAAC,MAAM,EAAA,UAAA,EACnC,CAAC,aAAa,EAAE,SAAS,CAAC,kBACtB,CAAC,aAAa,CAAC,EACzB,IAAA,EAAA;AACF,wBAAA,cAAc,EAAE,WAAW;AAC3B,wBAAA,kBAAkB,EAAE,WAAW;AAC/B,wBAAA,gBAAgB,EAAE,6BAA6B;AAC/C,wBAAA,iCAAiC,EAAE,iBAAiB;AACpD,wBAAA,gCAAgC,EAAE,8CAA8C;AAChF,wBAAA,gCAAgC,EAAE,wBAAwB;AAC1D,wBAAA,gCAAgC,EAAE,wBAAwB;AAC7D,qBAAA,EAAA,QAAA,EAAA,oqBAAA,EAAA,MAAA,EAAA,CAAA,mzFAAA,CAAA,EAAA,CAAA;;;AElDL;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-addon-mobile-directives-dropdown-mobile.mjs","sources":["../../../projects/addon-mobile/directives/dropdown-mobile/dropdown-mobile.directive.ts","../../../projects/addon-mobile/directives/dropdown-mobile/dropdown-mobile.component.ts","../../../projects/addon-mobile/directives/dropdown-mobile/dropdown-mobile.template.html","../../../projects/addon-mobile/directives/dropdown-mobile/taiga-ui-addon-mobile-directives-dropdown-mobile.ts"],"sourcesContent":["import {Directive, inject, Input} from '@angular/core';\nimport {TUI_IS_MOBILE} from '@taiga-ui/cdk/tokens';\nimport {tuiIsHTMLElement} from '@taiga-ui/cdk/utils/dom';\nimport {TUI_DROPDOWN_COMPONENT} from '@taiga-ui/core/directives/dropdown';\n\nimport {TuiDropdownMobileComponent} from './dropdown-mobile.component';\n\n@Directive({\n standalone: true,\n selector: '[tuiDropdownMobile]',\n providers: [\n {\n provide: TUI_DROPDOWN_COMPONENT,\n useFactory: () =>\n inject(TUI_IS_MOBILE)\n ? TuiDropdownMobileComponent\n : inject(TUI_DROPDOWN_COMPONENT, {skipSelf: true}),\n },\n ],\n host: {\n '[style.visibility]': '\"visible\"',\n '(mousedown)': 'onMouseDown($event)',\n },\n})\nexport class TuiDropdownMobile {\n private readonly isMobile = inject(TUI_IS_MOBILE);\n\n @Input()\n public tuiDropdownMobile = '';\n\n protected onMouseDown(event: MouseEvent): void {\n if (\n !this.isMobile ||\n !tuiIsHTMLElement(event.target) ||\n !event.target.matches('input,textarea')\n ) {\n return;\n }\n\n event.preventDefault();\n event.target.focus({preventScroll: true});\n }\n}\n","import {DOCUMENT, NgIf} from '@angular/common';\nimport type {AfterViewInit, OnDestroy} from '@angular/core';\nimport {\n ChangeDetectionStrategy,\n Component,\n inject,\n ViewEncapsulation,\n} from '@angular/core';\nimport {WaIntersectionObserver} from '@ng-web-apis/intersection-observer';\nimport {TuiKeyboardService} from '@taiga-ui/addon-mobile/services';\nimport {TuiActiveZone} from '@taiga-ui/cdk/directives/active-zone';\nimport type {TuiSwipeEvent} from '@taiga-ui/cdk/directives/swipe';\nimport {TuiSwipe} from '@taiga-ui/cdk/directives/swipe';\nimport {tuiInjectElement, tuiIsElement} from '@taiga-ui/cdk/utils/dom';\nimport {tuiGetNativeFocused} from '@taiga-ui/cdk/utils/focus';\nimport {tuiPx} from '@taiga-ui/cdk/utils/miscellaneous';\nimport {tuiFadeIn, tuiSlideInTop} from '@taiga-ui/core/animations';\nimport {TuiDropdownDirective} from '@taiga-ui/core/directives/dropdown';\nimport {TUI_ANIMATIONS_SPEED} from '@taiga-ui/core/tokens';\nimport {tuiGetDuration} from '@taiga-ui/core/utils/miscellaneous';\nimport {PolymorpheusOutlet, PolymorpheusTemplate} from '@taiga-ui/polymorpheus';\n\nimport {TuiDropdownMobile} from './dropdown-mobile.directive';\n\nconst GAP = 16;\n\n@Component({\n standalone: true,\n selector: 'tui-dropdown-mobile',\n imports: [\n NgIf,\n PolymorpheusOutlet,\n PolymorpheusTemplate,\n TuiSwipe,\n WaIntersectionObserver,\n ],\n templateUrl: './dropdown-mobile.template.html',\n styleUrls: ['./dropdown-mobile.style.less'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n animations: [tuiSlideInTop, tuiFadeIn],\n hostDirectives: [TuiActiveZone],\n host: {\n '[@tuiFadeIn]': 'animation',\n '[@tuiSlideInTop]': 'animation',\n '[class._sheet]': 'directive.tuiDropdownMobile',\n '(document:click.silent.capture)': 'onClick($event)',\n '(window>scroll.silent.capture)': 'refresh($event.currentTarget.visualViewport)',\n '(visualViewport>resize.silent)': 'refresh($event.target)',\n '(visualViewport>scroll.silent)': 'refresh($event.target)',\n },\n})\nexport class TuiDropdownMobileComponent implements OnDestroy, AfterViewInit {\n private readonly el = tuiInjectElement();\n private readonly keyboard = inject(TuiKeyboardService);\n private readonly doc = inject(DOCUMENT);\n private readonly scrollTop = this.doc.documentElement.scrollTop;\n private readonly observer = new ResizeObserver(() =>\n this.refresh(this.doc.defaultView!.visualViewport!),\n );\n\n protected readonly directive = inject(TuiDropdownMobile);\n protected readonly dropdown = inject(TuiDropdownDirective);\n protected readonly animation = {\n value: '',\n params: {\n start: '100vh',\n duration: tuiGetDuration(inject(TUI_ANIMATIONS_SPEED)),\n },\n } as const;\n\n constructor() {\n this.observer.observe(this.dropdown.el);\n this.doc.documentElement.style.setProperty('scroll-behavior', 'initial');\n }\n\n public ngAfterViewInit(): void {\n this.el.scrollTop = this.directive.tuiDropdownMobile ? this.el.clientHeight : 0;\n }\n\n public ngOnDestroy(): void {\n this.observer.disconnect();\n this.doc.body.classList.remove('t-dropdown-mobile');\n this.doc.body.style.removeProperty('--t-root-top');\n this.doc.documentElement.scrollTop = this.scrollTop;\n this.doc.documentElement.style.removeProperty('scroll-behavior');\n\n if (this.focused) {\n this.keyboard.hide();\n }\n }\n\n protected onClick(event: MouseEvent): void {\n if (\n tuiIsElement(event.target) &&\n !this.el.contains(event.target) &&\n (!this.dropdown.el.contains(event.target) ||\n event.target.matches('input,textarea'))\n ) {\n event.stopPropagation();\n }\n }\n\n protected onSwipe({direction}: TuiSwipeEvent, el: HTMLElement): void {\n if (\n direction === 'bottom' &&\n el.getBoundingClientRect().bottom > Number(this.doc.defaultView?.innerHeight)\n ) {\n this.close();\n }\n }\n\n protected onIntersection({isIntersecting}: IntersectionObserverEntry): void {\n if (isIntersecting) {\n this.close();\n }\n }\n\n protected close(): void {\n this.dropdown.toggle(false);\n }\n\n protected refresh({offsetTop, height}: VisualViewport): void {\n this.doc.body.style.removeProperty('--t-root-top');\n\n if (\n !this.focused ||\n this.directive.tuiDropdownMobile ||\n !this.doc.documentElement.style.getPropertyValue('scroll-behavior')\n ) {\n return;\n }\n\n this.doc.documentElement.scrollTop = 0;\n\n const rect = this.dropdown.el.getBoundingClientRect();\n const top = offsetTop + GAP - rect.top;\n const offset = rect.height + GAP * 2;\n\n this.el.style.setProperty('top', tuiPx(offsetTop + offset));\n this.el.style.setProperty('height', tuiPx(height - offset));\n this.doc.body.classList.add('t-dropdown-mobile');\n this.doc.body.style.setProperty('--t-root-top', tuiPx(top));\n }\n\n private get focused(): boolean {\n return this.dropdown.el.contains(tuiGetNativeFocused(this.doc));\n }\n}\n","<div\n *ngIf=\"directive.tuiDropdownMobile\"\n waIntersectionObserver\n waIntersectionThreshold=\"1\"\n class=\"t-filler\"\n (touchstart.prevent)=\"close()\"\n (waIntersectionObservee)=\"$event[0] && onIntersection($event[0])\"\n></div>\n<div\n #container\n class=\"t-container\"\n (tuiSwipe)=\"onSwipe($event, container)\"\n>\n <h2\n *ngIf=\"directive.tuiDropdownMobile\"\n class=\"t-heading\"\n >\n {{ directive.tuiDropdownMobile }}\n </h2>\n <div class=\"t-content\">\n <ng-container *polymorpheusOutlet=\"dropdown.content as text\">\n {{ text }}\n </ng-container>\n </div>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAOA,MAiBa,iBAAiB,CAAA;AAjB9B,IAAA,WAAA,GAAA;AAkBqB,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;QAG3C,IAAiB,CAAA,iBAAA,GAAG,EAAE,CAAC;AAcjC,KAAA;AAZa,IAAA,WAAW,CAAC,KAAiB,EAAA;QACnC,IACI,CAAC,IAAI,CAAC,QAAQ;AACd,YAAA,CAAC,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC;YAC/B,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,EACzC;YACE,OAAO;AACV,SAAA;QAED,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAC,aAAa,EAAE,IAAI,EAAC,CAAC,CAAC;KAC7C;+GAjBQ,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;AAAjB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,iBAAiB,EAdf,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,qBAAA,EAAA,MAAA,EAAA,EAAA,iBAAA,EAAA,mBAAA,EAAA,EAAA,IAAA,EAAA,EAAA,SAAA,EAAA,EAAA,WAAA,EAAA,qBAAA,EAAA,EAAA,UAAA,EAAA,EAAA,kBAAA,EAAA,aAAA,EAAA,EAAA,EAAA,SAAA,EAAA;AACP,YAAA;AACI,gBAAA,OAAO,EAAE,sBAAsB;AAC/B,gBAAA,UAAU,EAAE,MACR,MAAM,CA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EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA,CAAA,EAAA;;4FAY7B,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBA1BtC,SAAS;iCACM,IAAI,EAAA,QAAA,EACN,qBAAqB,EACtB,OAAA,EAAA;wBACL,IAAI;wBACJ,kBAAkB;wBAClB,oBAAoB;wBACpB,QAAQ;wBACR,sBAAsB;AACzB,qBAAA,EAAA,aAAA,EAGc,iBAAiB,CAAC,IAAI,EACpB,eAAA,EAAA,uBAAuB,CAAC,MAAM,EAAA,UAAA,EACnC,CAAC,aAAa,EAAE,SAAS,CAAC,kBACtB,CAAC,aAAa,CAAC,EACzB,IAAA,EAAA;AACF,wBAAA,cAAc,EAAE,WAAW;AAC3B,wBAAA,kBAAkB,EAAE,WAAW;AAC/B,wBAAA,gBAAgB,EAAE,6BAA6B;AAC/C,wBAAA,iCAAiC,EAAE,iBAAiB;AACpD,wBAAA,gCAAgC,EAAE,8CAA8C;AAChF,wBAAA,gCAAgC,EAAE,wBAAwB;AAC1D,wBAAA,gCAAgC,EAAE,wBAAwB;AAC7D,qBAAA,EAAA,QAAA,EAAA,oqBAAA,EAAA,MAAA,EAAA,CAAA,mzFAAA,CAAA,EAAA,CAAA;;;AElDL;;AAEG;;;;"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, Injectable, Directive } from '@angular/core';
|
|
3
|
+
import { TuiPopoverDirective } from '@taiga-ui/cdk/directives/popover';
|
|
4
|
+
import { tuiAsPopover } from '@taiga-ui/cdk/services';
|
|
5
|
+
import { TuiSheetDialogService } from '@taiga-ui/addon-mobile/components/sheet-dialog';
|
|
6
|
+
import { TUI_IS_MOBILE } from '@taiga-ui/cdk/tokens';
|
|
7
|
+
import { tuiIsString } from '@taiga-ui/cdk/utils/miscellaneous';
|
|
8
|
+
import { TuiDialogService } from '@taiga-ui/core/components/dialog';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Same as `TuiDialogService` but automatically switches to `TuiSheetDialogService` on mobile
|
|
12
|
+
*/
|
|
13
|
+
class TuiResponsiveDialogService {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.isMobile = inject(TUI_IS_MOBILE);
|
|
16
|
+
this.dialogs = inject(TuiDialogService);
|
|
17
|
+
this.sheets = inject(TuiSheetDialogService);
|
|
18
|
+
}
|
|
19
|
+
open(content, options = {}) {
|
|
20
|
+
return this.isMobile
|
|
21
|
+
? this.sheets.open(content, options)
|
|
22
|
+
: this.dialogs.open(content, {
|
|
23
|
+
...options,
|
|
24
|
+
label: tuiIsString(options.label) ? options.label : '',
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiResponsiveDialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
28
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiResponsiveDialogService, providedIn: 'root' }); }
|
|
29
|
+
}
|
|
30
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiResponsiveDialogService, decorators: [{
|
|
31
|
+
type: Injectable,
|
|
32
|
+
args: [{
|
|
33
|
+
providedIn: 'root',
|
|
34
|
+
}]
|
|
35
|
+
}] });
|
|
36
|
+
|
|
37
|
+
class TuiResponsiveDialog extends TuiPopoverDirective {
|
|
38
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiResponsiveDialog, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
39
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: TuiResponsiveDialog, isStandalone: true, selector: "ng-template[tuiResponsiveDialog]", inputs: { options: ["tuiResponsiveDialogOptions", "options"], open: ["tuiResponsiveDialog", "open"] }, outputs: { openChange: "tuiResponsiveDialogChange" }, providers: [tuiAsPopover(TuiResponsiveDialogService)], usesInheritance: true, ngImport: i0 }); }
|
|
40
|
+
}
|
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiResponsiveDialog, decorators: [{
|
|
42
|
+
type: Directive,
|
|
43
|
+
args: [{
|
|
44
|
+
standalone: true,
|
|
45
|
+
selector: 'ng-template[tuiResponsiveDialog]',
|
|
46
|
+
inputs: ['options: tuiResponsiveDialogOptions', 'open: tuiResponsiveDialog'],
|
|
47
|
+
outputs: ['openChange: tuiResponsiveDialogChange'],
|
|
48
|
+
providers: [tuiAsPopover(TuiResponsiveDialogService)],
|
|
49
|
+
}]
|
|
50
|
+
}] });
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Generated bundle index. Do not edit.
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
export { TuiResponsiveDialog, TuiResponsiveDialogService };
|
|
57
|
+
//# sourceMappingURL=taiga-ui-addon-mobile-directives-responsive-dialog.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"taiga-ui-addon-mobile-directives-responsive-dialog.mjs","sources":["../../../projects/addon-mobile/directives/responsive-dialog/responsive-dialog.service.ts","../../../projects/addon-mobile/directives/responsive-dialog/responsive-dialog.directive.ts","../../../projects/addon-mobile/directives/responsive-dialog/taiga-ui-addon-mobile-directives-responsive-dialog.ts"],"sourcesContent":["import {inject, Injectable} from '@angular/core';\nimport type {TuiSheetDialogOptions} from '@taiga-ui/addon-mobile/components/sheet-dialog';\nimport {TuiSheetDialogService} from '@taiga-ui/addon-mobile/components/sheet-dialog';\nimport {TUI_IS_MOBILE} from '@taiga-ui/cdk/tokens';\nimport {tuiIsString} from '@taiga-ui/cdk/utils/miscellaneous';\nimport type {TuiDialogContext, TuiDialogOptions} from '@taiga-ui/core/components/dialog';\nimport {TuiDialogService} from '@taiga-ui/core/components/dialog';\nimport type {PolymorpheusContent} from '@taiga-ui/polymorpheus';\nimport type {Observable} from 'rxjs';\n\nexport interface TuiResponsiveDialogOptions<I = undefined>\n extends Omit<TuiDialogOptions<I>, 'label'>,\n TuiSheetDialogOptions<unknown> {\n readonly data: I extends void ? undefined : I & {button?: string};\n readonly label: PolymorpheusContent;\n}\n\n/**\n * Same as `TuiDialogService` but automatically switches to `TuiSheetDialogService` on mobile\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class TuiResponsiveDialogService {\n private readonly isMobile = inject(TUI_IS_MOBILE);\n private readonly dialogs = inject(TuiDialogService);\n private readonly sheets = inject(TuiSheetDialogService);\n\n public open<G = void>(\n content: PolymorpheusContent<\n TuiDialogContext<G> & TuiResponsiveDialogOptions<any>\n >,\n options: Partial<TuiResponsiveDialogOptions<any>> = {},\n ): Observable<G> {\n return this.isMobile\n ? this.sheets.open(content, options)\n : this.dialogs.open(content, {\n ...options,\n label: tuiIsString(options.label) ? options.label : '',\n });\n }\n}\n","import {Directive} from '@angular/core';\nimport {TuiPopoverDirective} from '@taiga-ui/cdk/directives/popover';\nimport {tuiAsPopover} from '@taiga-ui/cdk/services';\n\nimport type {TuiResponsiveDialogOptions} from './responsive-dialog.service';\nimport {TuiResponsiveDialogService} from './responsive-dialog.service';\n\n@Directive({\n standalone: true,\n selector: 'ng-template[tuiResponsiveDialog]',\n inputs: ['options: tuiResponsiveDialogOptions', 'open: tuiResponsiveDialog'],\n outputs: ['openChange: tuiResponsiveDialogChange'],\n providers: [tuiAsPopover(TuiResponsiveDialogService as any)],\n})\nexport class TuiResponsiveDialog extends TuiPopoverDirective<TuiResponsiveDialogOptions> {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAiBA;;AAEG;AACH,MAGa,0BAA0B,CAAA;AAHvC,IAAA,WAAA,GAAA;AAIqB,QAAA,IAAA,CA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CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,mBAAmB,4OAFjB,CAAC,YAAY,CAAC,0BAAiC,CAAC,CAAC,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;4FAEnD,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAP/B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,QAAQ,EAAE,kCAAkC;AAC5C,oBAAA,MAAM,EAAE,CAAC,qCAAqC,EAAE,2BAA2B,CAAC;oBAC5E,OAAO,EAAE,CAAC,uCAAuC,CAAC;AAClD,oBAAA,SAAS,EAAE,CAAC,YAAY,CAAC,0BAAiC,CAAC,CAAC;AAC/D,iBAAA,CAAA;;;ACbD;;AAEG;;;;"}
|
|
@@ -5,13 +5,16 @@ import { tuiSlideIn } from '@taiga-ui/core/animations';
|
|
|
5
5
|
import { TUI_ANIMATIONS_SPEED } from '@taiga-ui/core/tokens';
|
|
6
6
|
import { tuiToAnimationOptions } from '@taiga-ui/core/utils/miscellaneous';
|
|
7
7
|
import { PolymorpheusTemplate, PolymorpheusComponent, PolymorpheusOutlet } from '@taiga-ui/polymorpheus';
|
|
8
|
-
import {
|
|
8
|
+
import { TuiPopupService } from '@taiga-ui/core/directives/popup';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated use {@link TuiDrawer} instead
|
|
12
|
+
*/
|
|
10
13
|
class TuiSidebarDirective extends PolymorpheusTemplate {
|
|
11
14
|
constructor() {
|
|
12
15
|
super(...arguments);
|
|
13
16
|
this.injector = inject(INJECTOR);
|
|
14
|
-
this.
|
|
17
|
+
this.service = inject(TuiPopupService);
|
|
15
18
|
this.component = new PolymorpheusComponent(TuiSidebarComponent, this.injector);
|
|
16
19
|
this.sidebarRef = null;
|
|
17
20
|
this.direction = 'left';
|
|
@@ -33,14 +36,14 @@ class TuiSidebarDirective extends PolymorpheusTemplate {
|
|
|
33
36
|
if (this.sidebarRef !== null) {
|
|
34
37
|
return;
|
|
35
38
|
}
|
|
36
|
-
this.sidebarRef = this.
|
|
39
|
+
this.sidebarRef = this.service.add(this.component);
|
|
37
40
|
this.sidebarRef.changeDetectorRef.detectChanges();
|
|
38
41
|
}
|
|
39
42
|
hide() {
|
|
40
43
|
if (this.sidebarRef === null) {
|
|
41
44
|
return;
|
|
42
45
|
}
|
|
43
|
-
this.
|
|
46
|
+
this.service.remove(this.sidebarRef);
|
|
44
47
|
this.sidebarRef = null;
|
|
45
48
|
}
|
|
46
49
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiSidebarDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
@@ -62,6 +65,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
62
65
|
type: Input
|
|
63
66
|
}] } });
|
|
64
67
|
|
|
68
|
+
/**
|
|
69
|
+
* @deprecated use {@link TuiDrawer} instead
|
|
70
|
+
*/
|
|
65
71
|
class TuiSidebarComponent {
|
|
66
72
|
constructor() {
|
|
67
73
|
this.directive = inject(TuiSidebarDirective);
|