@taiga-ui/core 3.19.0-dev.main-8e6cab0 → 3.19.0-dev.main-9e6bc23
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/abstract/abstract-driver.directive.d.ts +9 -2
- package/abstract/driver.d.ts +1 -0
- package/abstract/position-accessor.d.ts +3 -1
- package/abstract/rect-accessor.d.ts +4 -1
- package/abstract/vehicle.d.ts +1 -0
- package/bundles/taiga-ui-core-abstract.umd.js +49 -10
- package/bundles/taiga-ui-core-abstract.umd.js.map +1 -1
- package/bundles/taiga-ui-core-directives-dropdown.umd.js +155 -107
- package/bundles/taiga-ui-core-directives-dropdown.umd.js.map +1 -1
- package/bundles/taiga-ui-core-directives-hint.umd.js +235 -180
- package/bundles/taiga-ui-core-directives-hint.umd.js.map +1 -1
- package/bundles/taiga-ui-core-tokens.umd.js +1 -0
- package/bundles/taiga-ui-core-tokens.umd.js.map +1 -1
- package/directives/dropdown/dropdown-context.directive.d.ts +1 -0
- package/directives/dropdown/dropdown-driver.directive.d.ts +5 -2
- package/directives/dropdown/dropdown-host.directive.d.ts +1 -0
- package/directives/dropdown/dropdown-hover.directive.d.ts +1 -0
- package/directives/dropdown/dropdown-manual.directive.d.ts +1 -0
- package/directives/dropdown/dropdown-position-sided.directive.d.ts +4 -3
- package/directives/dropdown/dropdown-position.directive.d.ts +7 -3
- package/directives/dropdown/dropdown-selection.directive.d.ts +1 -0
- package/directives/dropdown/dropdown.directive.d.ts +7 -4
- package/directives/hint/hint-describe.directive.d.ts +3 -5
- package/directives/hint/hint-driver.directive.d.ts +5 -2
- package/directives/hint/hint-host.directive.d.ts +1 -0
- package/directives/hint/hint-hover.directive.d.ts +2 -0
- package/directives/hint/hint-manual.directive.d.ts +3 -1
- package/directives/hint/hint-position.directive.d.ts +6 -3
- package/directives/hint/hint.directive.d.ts +3 -2
- package/esm2015/abstract/abstract-driver.directive.js +15 -7
- package/esm2015/abstract/driver.js +2 -1
- package/esm2015/abstract/position-accessor.js +10 -1
- package/esm2015/abstract/rect-accessor.js +14 -1
- package/esm2015/abstract/vehicle.js +2 -1
- package/esm2015/directives/dropdown/dropdown-context.directive.js +2 -1
- package/esm2015/directives/dropdown/dropdown-driver.directive.js +22 -5
- package/esm2015/directives/dropdown/dropdown-host.directive.js +5 -1
- package/esm2015/directives/dropdown/dropdown-hover.directive.js +2 -1
- package/esm2015/directives/dropdown/dropdown-manual.directive.js +4 -3
- package/esm2015/directives/dropdown/dropdown-position-sided.directive.js +13 -12
- package/esm2015/directives/dropdown/dropdown-position.directive.js +27 -10
- package/esm2015/directives/dropdown/dropdown-selection.directive.js +2 -1
- package/esm2015/directives/dropdown/dropdown.component.js +19 -9
- package/esm2015/directives/dropdown/dropdown.directive.js +14 -19
- package/esm2015/directives/hint/hint-describe.directive.js +5 -11
- package/esm2015/directives/hint/hint-driver.directive.js +22 -5
- package/esm2015/directives/hint/hint-host.directive.js +5 -1
- package/esm2015/directives/hint/hint-hover.directive.js +5 -3
- package/esm2015/directives/hint/hint-manual.directive.js +12 -5
- package/esm2015/directives/hint/hint-position.directive.js +24 -10
- package/esm2015/directives/hint/hint.component.js +18 -4
- package/esm2015/directives/hint/hint.directive.js +3 -1
- package/esm2015/directives/hint/hint.providers.js +2 -1
- package/esm2015/tokens/viewport.js +2 -1
- package/fesm2015/taiga-ui-core-abstract.js +39 -9
- package/fesm2015/taiga-ui-core-abstract.js.map +1 -1
- package/fesm2015/taiga-ui-core-directives-dropdown.js +92 -50
- package/fesm2015/taiga-ui-core-directives-dropdown.js.map +1 -1
- package/fesm2015/taiga-ui-core-directives-hint.js +180 -131
- package/fesm2015/taiga-ui-core-directives-hint.js.map +1 -1
- package/fesm2015/taiga-ui-core-tokens.js +1 -0
- package/fesm2015/taiga-ui-core-tokens.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { InjectionToken, Optional, SkipSelf, forwardRef, Directive, Inject, Input, ElementRef, HostListener, Component, ChangeDetectionStrategy, Self, HostBinding,
|
|
3
|
+
import { InjectionToken, Optional, SkipSelf, forwardRef, Directive, Inject, Input, ElementRef, INJECTOR, HostListener, Component, ChangeDetectionStrategy, Self, HostBinding, NgZone, NgModule } from '@angular/core';
|
|
4
4
|
import * as i3 from '@taiga-ui/cdk';
|
|
5
|
-
import { AbstractTuiController, tuiDefaultProp, TuiHoveredService, EMPTY_CLIENT_RECT, tuiPointToClientRect, tuiPx, tuiClamp, TuiDestroyService, tuiPure,
|
|
5
|
+
import { AbstractTuiController, tuiDefaultProp, TuiActiveZoneDirective, TuiHoveredService, EMPTY_CLIENT_RECT, tuiPointToClientRect, tuiPx, tuiClamp, TuiDestroyService, tuiPure, tuiTypedFromEvent, tuiZoneOptimized, tuiIsNativeFocused } from '@taiga-ui/cdk';
|
|
6
6
|
import * as i1$1 from '@taiga-ui/core/abstract';
|
|
7
|
-
import { TuiDriver, tuiAsDriver,
|
|
7
|
+
import { tuiAsRectAccessor, tuiAsVehicle, TuiDriver, tuiAsDriver, TuiRectAccessor, tuiPositionAccessorFor, tuiRectAccessorFor, AbstractTuiDriverDirective, TuiVehicle, TuiPositionAccessor, tuiFallbackRectAccessor, tuiAsPositionAccessor } from '@taiga-ui/core/abstract';
|
|
8
8
|
import { tuiFadeIn } from '@taiga-ui/core/animations';
|
|
9
9
|
import * as i5 from '@taiga-ui/core/directives/mode';
|
|
10
10
|
import { TuiModeDirective } from '@taiga-ui/core/directives/mode';
|
|
11
|
-
import * as i2
|
|
12
|
-
import {
|
|
11
|
+
import * as i2 from '@taiga-ui/core/services';
|
|
12
|
+
import { TuiHintService, TuiPositionService } from '@taiga-ui/core/services';
|
|
13
13
|
import { TUI_ANIMATION_OPTIONS, TUI_VIEWPORT } from '@taiga-ui/core/tokens';
|
|
14
14
|
import * as i1 from '@tinkoff/ng-polymorpheus';
|
|
15
|
-
import {
|
|
16
|
-
import { switchMap, delay, takeUntil, repeat, map, debounce, startWith, distinctUntilChanged, skip } from 'rxjs/operators';
|
|
17
|
-
import * as i2 from 'rxjs';
|
|
18
|
-
import { Subject, merge, of, timer } from 'rxjs';
|
|
15
|
+
import { PolymorpheusComponent, POLYMORPHEUS_CONTEXT, PolymorpheusModule } from '@tinkoff/ng-polymorpheus';
|
|
16
|
+
import { switchMap, delay, takeUntil, repeat, filter, map, debounce, startWith, distinctUntilChanged, skip } from 'rxjs/operators';
|
|
19
17
|
import { tuiOverrideOptions } from '@taiga-ui/core/utils';
|
|
18
|
+
import * as i2$1 from 'rxjs';
|
|
19
|
+
import { Subject, merge, of, timer } from 'rxjs';
|
|
20
20
|
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
21
21
|
import { TUI_HINT_DIRECTIONS } from '@taiga-ui/core/constants';
|
|
22
22
|
|
|
23
|
+
const TUI_HINT_COMPONENT = new InjectionToken(`[TUI_HINT_COMPONENT] A component to display a hint`, {
|
|
24
|
+
factory: () => TuiHintComponent,
|
|
25
|
+
});
|
|
26
|
+
|
|
23
27
|
/** Default values for hint options */
|
|
24
28
|
const TUI_HINT_DEFAULT_OPTIONS = {
|
|
25
29
|
direction: 'bottom-left',
|
|
@@ -106,6 +110,98 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
106
110
|
args: ['tuiHintHideDelay']
|
|
107
111
|
}] } });
|
|
108
112
|
|
|
113
|
+
class TuiHintDirective {
|
|
114
|
+
constructor(elementRef, component, hintService, options, activeZone) {
|
|
115
|
+
this.elementRef = elementRef;
|
|
116
|
+
this.component = component;
|
|
117
|
+
this.hintService = hintService;
|
|
118
|
+
this.options = options;
|
|
119
|
+
this.activeZone = activeZone;
|
|
120
|
+
this.content = '';
|
|
121
|
+
this.tuiHintAppearance = null;
|
|
122
|
+
this.type = 'hint';
|
|
123
|
+
}
|
|
124
|
+
get appearance() {
|
|
125
|
+
var _a;
|
|
126
|
+
return (_a = this.tuiHintAppearance) !== null && _a !== void 0 ? _a : this.options.appearance;
|
|
127
|
+
}
|
|
128
|
+
ngOnChanges() {
|
|
129
|
+
if (!this.content) {
|
|
130
|
+
this.toggle(false);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
ngOnDestroy() {
|
|
134
|
+
this.toggle(false);
|
|
135
|
+
}
|
|
136
|
+
getClientRect() {
|
|
137
|
+
return this.elementRef.nativeElement.getBoundingClientRect();
|
|
138
|
+
}
|
|
139
|
+
toggle(show) {
|
|
140
|
+
if (show && this.content) {
|
|
141
|
+
this.hintService.add(this);
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
this.hintService.remove(this);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
TuiHintDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintDirective, deps: [{ token: ElementRef }, { token: PolymorpheusComponent }, { token: TuiHintService }, { token: TUI_HINT_OPTIONS }, { token: TuiActiveZoneDirective, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
149
|
+
TuiHintDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: TuiHintDirective, selector: "[tuiHint]:not(ng-container)", inputs: { content: ["tuiHint", "content"], context: ["tuiHintContext", "context"], tuiHintAppearance: "tuiHintAppearance" }, providers: [
|
|
150
|
+
tuiAsRectAccessor(TuiHintDirective),
|
|
151
|
+
tuiAsVehicle(TuiHintDirective),
|
|
152
|
+
{
|
|
153
|
+
provide: PolymorpheusComponent,
|
|
154
|
+
deps: [TUI_HINT_COMPONENT, INJECTOR],
|
|
155
|
+
useClass: PolymorpheusComponent,
|
|
156
|
+
},
|
|
157
|
+
], usesOnChanges: true, ngImport: i0 });
|
|
158
|
+
__decorate([
|
|
159
|
+
tuiDefaultProp()
|
|
160
|
+
], TuiHintDirective.prototype, "content", void 0);
|
|
161
|
+
__decorate([
|
|
162
|
+
tuiDefaultProp()
|
|
163
|
+
], TuiHintDirective.prototype, "tuiHintAppearance", void 0);
|
|
164
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintDirective, decorators: [{
|
|
165
|
+
type: Directive,
|
|
166
|
+
args: [{
|
|
167
|
+
selector: '[tuiHint]:not(ng-container)',
|
|
168
|
+
providers: [
|
|
169
|
+
tuiAsRectAccessor(TuiHintDirective),
|
|
170
|
+
tuiAsVehicle(TuiHintDirective),
|
|
171
|
+
{
|
|
172
|
+
provide: PolymorpheusComponent,
|
|
173
|
+
deps: [TUI_HINT_COMPONENT, INJECTOR],
|
|
174
|
+
useClass: PolymorpheusComponent,
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
}]
|
|
178
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef, decorators: [{
|
|
179
|
+
type: Inject,
|
|
180
|
+
args: [ElementRef]
|
|
181
|
+
}] }, { type: i1.PolymorpheusComponent, decorators: [{
|
|
182
|
+
type: Inject,
|
|
183
|
+
args: [PolymorpheusComponent]
|
|
184
|
+
}] }, { type: i2.TuiHintService, decorators: [{
|
|
185
|
+
type: Inject,
|
|
186
|
+
args: [TuiHintService]
|
|
187
|
+
}] }, { type: undefined, decorators: [{
|
|
188
|
+
type: Inject,
|
|
189
|
+
args: [TUI_HINT_OPTIONS]
|
|
190
|
+
}] }, { type: i3.TuiActiveZoneDirective, decorators: [{
|
|
191
|
+
type: Optional
|
|
192
|
+
}, {
|
|
193
|
+
type: Inject,
|
|
194
|
+
args: [TuiActiveZoneDirective]
|
|
195
|
+
}] }]; }, propDecorators: { content: [{
|
|
196
|
+
type: Input,
|
|
197
|
+
args: ['tuiHint']
|
|
198
|
+
}], context: [{
|
|
199
|
+
type: Input,
|
|
200
|
+
args: ['tuiHintContext']
|
|
201
|
+
}], tuiHintAppearance: [{
|
|
202
|
+
type: Input
|
|
203
|
+
}] } });
|
|
204
|
+
|
|
109
205
|
class TuiHintHoverDirective extends TuiDriver {
|
|
110
206
|
constructor(hovered$, options, elementRef) {
|
|
111
207
|
super(subscriber => this.stream$.subscribe(subscriber));
|
|
@@ -113,9 +209,11 @@ class TuiHintHoverDirective extends TuiDriver {
|
|
|
113
209
|
this.options = options;
|
|
114
210
|
this.elementRef = elementRef;
|
|
115
211
|
this.toggle$ = new Subject();
|
|
116
|
-
this.stream$ = merge(this.toggle$.pipe(switchMap(visible => of(visible).pipe(delay(visible ? 0 : this.hideDelay))), takeUntil(this.hovered$), repeat()), this.hovered$.pipe(switchMap(visible => of(visible).pipe(delay(visible ? this.showDelay : this.hideDelay))), takeUntil(this.toggle$), repeat()));
|
|
212
|
+
this.stream$ = merge(this.toggle$.pipe(switchMap(visible => of(visible).pipe(delay(visible ? 0 : this.hideDelay))), takeUntil(this.hovered$), repeat()), this.hovered$.pipe(switchMap(visible => of(visible).pipe(delay(visible ? this.showDelay : this.hideDelay))), takeUntil(this.toggle$), repeat())).pipe(filter(() => this.enabled));
|
|
117
213
|
this.showDelay = this.options.showDelay;
|
|
118
214
|
this.hideDelay = this.options.hideDelay;
|
|
215
|
+
this.type = 'hint';
|
|
216
|
+
this.enabled = true;
|
|
119
217
|
}
|
|
120
218
|
toggle(visible) {
|
|
121
219
|
this.toggle$.next(visible);
|
|
@@ -136,7 +234,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
136
234
|
exportAs: 'tuiHintHover',
|
|
137
235
|
providers: [tuiAsDriver(TuiHintHoverDirective), TuiHoveredService],
|
|
138
236
|
}]
|
|
139
|
-
}], ctorParameters: function () { return [{ type: i2.Observable, decorators: [{
|
|
237
|
+
}], ctorParameters: function () { return [{ type: i2$1.Observable, decorators: [{
|
|
140
238
|
type: Inject,
|
|
141
239
|
args: [TuiHoveredService]
|
|
142
240
|
}] }, { type: undefined, decorators: [{
|
|
@@ -229,7 +327,13 @@ class TuiHintComponent {
|
|
|
229
327
|
}
|
|
230
328
|
}
|
|
231
329
|
TuiHintComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintComponent, deps: [{ token: TuiHoveredService }, { token: TuiPositionService }, { token: TuiDestroyService, self: true }, { token: TuiRectAccessor }, { token: ElementRef }, { token: TUI_ANIMATION_OPTIONS }, { token: POLYMORPHEUS_CONTEXT }, { token: TuiHintHoverDirective }, { token: TuiHintPointerDirective, optional: true }, { token: TuiModeDirective, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
232
|
-
TuiHintComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: TuiHintComponent, selector: "tui-hint", host: { listeners: { "document:click": "onClick($event.target)" }, properties: { "@tuiFadeIn": "this.animation", "attr.data-appearance": "this.appearance", "class._untouchable": "this.untouchable" } }, providers: [
|
|
330
|
+
TuiHintComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: TuiHintComponent, selector: "tui-hint", host: { listeners: { "document:click": "onClick($event.target)" }, properties: { "@tuiFadeIn": "this.animation", "attr.data-appearance": "this.appearance", "class._untouchable": "this.untouchable" } }, providers: [
|
|
331
|
+
TuiDestroyService,
|
|
332
|
+
TuiPositionService,
|
|
333
|
+
TuiHoveredService,
|
|
334
|
+
tuiPositionAccessorFor('hint'),
|
|
335
|
+
tuiRectAccessorFor('hint', TuiHintDirective),
|
|
336
|
+
], ngImport: i0, template: `
|
|
233
337
|
<ng-container *polymorpheusOutlet="content as text; context: context">
|
|
234
338
|
{{ text }}
|
|
235
339
|
</ng-container>
|
|
@@ -248,16 +352,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
248
352
|
`,
|
|
249
353
|
styleUrls: ['./hint.style.less'],
|
|
250
354
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
251
|
-
providers: [
|
|
355
|
+
providers: [
|
|
356
|
+
TuiDestroyService,
|
|
357
|
+
TuiPositionService,
|
|
358
|
+
TuiHoveredService,
|
|
359
|
+
tuiPositionAccessorFor('hint'),
|
|
360
|
+
tuiRectAccessorFor('hint', TuiHintDirective),
|
|
361
|
+
],
|
|
252
362
|
animations: [tuiFadeIn],
|
|
253
363
|
}]
|
|
254
|
-
}], ctorParameters: function () { return [{ type: i2.Observable, decorators: [{
|
|
364
|
+
}], ctorParameters: function () { return [{ type: i2$1.Observable, decorators: [{
|
|
255
365
|
type: Inject,
|
|
256
366
|
args: [TuiHoveredService]
|
|
257
|
-
}] }, { type: i2.Observable, decorators: [{
|
|
367
|
+
}] }, { type: i2$1.Observable, decorators: [{
|
|
258
368
|
type: Inject,
|
|
259
369
|
args: [TuiPositionService]
|
|
260
|
-
}] }, { type: i2.Observable, decorators: [{
|
|
370
|
+
}] }, { type: i2$1.Observable, decorators: [{
|
|
261
371
|
type: Self
|
|
262
372
|
}, {
|
|
263
373
|
type: Inject,
|
|
@@ -301,115 +411,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
301
411
|
args: ['document:click', ['$event.target']]
|
|
302
412
|
}], update: [] } });
|
|
303
413
|
|
|
304
|
-
const TUI_HINT_COMPONENT = new InjectionToken(`[TUI_HINT_COMPONENT] A component to display a hint`, {
|
|
305
|
-
factory: () => TuiHintComponent,
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
class TuiHintDirective {
|
|
309
|
-
constructor(elementRef, component, hintService, options, activeZone) {
|
|
310
|
-
this.elementRef = elementRef;
|
|
311
|
-
this.component = component;
|
|
312
|
-
this.hintService = hintService;
|
|
313
|
-
this.options = options;
|
|
314
|
-
this.activeZone = activeZone;
|
|
315
|
-
this.content = '';
|
|
316
|
-
this.tuiHintAppearance = null;
|
|
317
|
-
}
|
|
318
|
-
get appearance() {
|
|
319
|
-
var _a;
|
|
320
|
-
return (_a = this.tuiHintAppearance) !== null && _a !== void 0 ? _a : this.options.appearance;
|
|
321
|
-
}
|
|
322
|
-
ngOnChanges() {
|
|
323
|
-
if (!this.content) {
|
|
324
|
-
this.toggle(false);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
ngOnDestroy() {
|
|
328
|
-
this.toggle(false);
|
|
329
|
-
}
|
|
330
|
-
getClientRect() {
|
|
331
|
-
return this.elementRef.nativeElement.getBoundingClientRect();
|
|
332
|
-
}
|
|
333
|
-
toggle(show) {
|
|
334
|
-
if (show && this.content) {
|
|
335
|
-
this.hintService.add(this);
|
|
336
|
-
}
|
|
337
|
-
else {
|
|
338
|
-
this.hintService.remove(this);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
TuiHintDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintDirective, deps: [{ token: ElementRef }, { token: PolymorpheusComponent }, { token: TuiHintService }, { token: TUI_HINT_OPTIONS }, { token: TuiActiveZoneDirective, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
343
|
-
TuiHintDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: TuiHintDirective, selector: "[tuiHint]:not(ng-container)", inputs: { content: ["tuiHint", "content"], context: ["tuiHintContext", "context"], tuiHintAppearance: "tuiHintAppearance" }, providers: [
|
|
344
|
-
tuiAsRectAccessor(TuiHintDirective),
|
|
345
|
-
tuiAsVehicle(TuiHintDirective),
|
|
346
|
-
{
|
|
347
|
-
provide: PolymorpheusComponent,
|
|
348
|
-
deps: [TUI_HINT_COMPONENT, INJECTOR],
|
|
349
|
-
useClass: PolymorpheusComponent,
|
|
350
|
-
},
|
|
351
|
-
], usesOnChanges: true, ngImport: i0 });
|
|
352
|
-
__decorate([
|
|
353
|
-
tuiDefaultProp()
|
|
354
|
-
], TuiHintDirective.prototype, "content", void 0);
|
|
355
|
-
__decorate([
|
|
356
|
-
tuiDefaultProp()
|
|
357
|
-
], TuiHintDirective.prototype, "tuiHintAppearance", void 0);
|
|
358
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintDirective, decorators: [{
|
|
359
|
-
type: Directive,
|
|
360
|
-
args: [{
|
|
361
|
-
selector: '[tuiHint]:not(ng-container)',
|
|
362
|
-
providers: [
|
|
363
|
-
tuiAsRectAccessor(TuiHintDirective),
|
|
364
|
-
tuiAsVehicle(TuiHintDirective),
|
|
365
|
-
{
|
|
366
|
-
provide: PolymorpheusComponent,
|
|
367
|
-
deps: [TUI_HINT_COMPONENT, INJECTOR],
|
|
368
|
-
useClass: PolymorpheusComponent,
|
|
369
|
-
},
|
|
370
|
-
],
|
|
371
|
-
}]
|
|
372
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef, decorators: [{
|
|
373
|
-
type: Inject,
|
|
374
|
-
args: [ElementRef]
|
|
375
|
-
}] }, { type: i1.PolymorpheusComponent, decorators: [{
|
|
376
|
-
type: Inject,
|
|
377
|
-
args: [PolymorpheusComponent]
|
|
378
|
-
}] }, { type: i2$1.TuiHintService, decorators: [{
|
|
379
|
-
type: Inject,
|
|
380
|
-
args: [TuiHintService]
|
|
381
|
-
}] }, { type: undefined, decorators: [{
|
|
382
|
-
type: Inject,
|
|
383
|
-
args: [TUI_HINT_OPTIONS]
|
|
384
|
-
}] }, { type: i3.TuiActiveZoneDirective, decorators: [{
|
|
385
|
-
type: Optional
|
|
386
|
-
}, {
|
|
387
|
-
type: Inject,
|
|
388
|
-
args: [TuiActiveZoneDirective]
|
|
389
|
-
}] }]; }, propDecorators: { content: [{
|
|
390
|
-
type: Input,
|
|
391
|
-
args: ['tuiHint']
|
|
392
|
-
}], context: [{
|
|
393
|
-
type: Input,
|
|
394
|
-
args: ['tuiHintContext']
|
|
395
|
-
}], tuiHintAppearance: [{
|
|
396
|
-
type: Input
|
|
397
|
-
}] } });
|
|
398
|
-
|
|
399
414
|
class TuiHintDescribeDirective extends TuiDriver {
|
|
400
|
-
constructor(ngZone,
|
|
415
|
+
constructor(ngZone, documentRef, elementRef) {
|
|
401
416
|
super(subscriber => this.stream$.subscribe(subscriber));
|
|
402
417
|
this.ngZone = ngZone;
|
|
403
|
-
this.hover$ = hover$;
|
|
404
418
|
this.documentRef = documentRef;
|
|
405
419
|
this.elementRef = elementRef;
|
|
406
|
-
this.
|
|
420
|
+
this.stream$ = tuiTypedFromEvent(this.documentRef, 'keydown', {
|
|
407
421
|
capture: true,
|
|
408
422
|
}).pipe(switchMap(() => this.focused
|
|
409
423
|
? of(false)
|
|
410
424
|
: merge(tuiTypedFromEvent(this.documentRef, 'keyup'), tuiTypedFromEvent(this.element, 'blur')).pipe(map(() => this.focused))), debounce(visible => (visible ? timer(1000) : of(null))), startWith(false), distinctUntilChanged(), skip(1), tuiZoneOptimized(this.ngZone));
|
|
411
|
-
this.stream$ = merge(this.hover$, this.focus$);
|
|
412
425
|
this.tuiHintDescribe = '';
|
|
426
|
+
this.type = 'hint';
|
|
413
427
|
}
|
|
414
428
|
get focused() {
|
|
415
429
|
return tuiIsNativeFocused(this.element);
|
|
@@ -419,7 +433,7 @@ class TuiHintDescribeDirective extends TuiDriver {
|
|
|
419
433
|
this.elementRef.nativeElement);
|
|
420
434
|
}
|
|
421
435
|
}
|
|
422
|
-
TuiHintDescribeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintDescribeDirective, deps: [{ token: NgZone }, { token:
|
|
436
|
+
TuiHintDescribeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintDescribeDirective, deps: [{ token: NgZone }, { token: DOCUMENT }, { token: ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
423
437
|
TuiHintDescribeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: TuiHintDescribeDirective, selector: "[tuiHintDescribe]", inputs: { tuiHintDescribe: "tuiHintDescribe" }, providers: [tuiAsDriver(TuiHintDescribeDirective)], usesInheritance: true, ngImport: i0 });
|
|
424
438
|
__decorate([
|
|
425
439
|
tuiPure
|
|
@@ -433,9 +447,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
433
447
|
}], ctorParameters: function () { return [{ type: i0.NgZone, decorators: [{
|
|
434
448
|
type: Inject,
|
|
435
449
|
args: [NgZone]
|
|
436
|
-
}] }, { type: i2.Observable, decorators: [{
|
|
437
|
-
type: Inject,
|
|
438
|
-
args: [TuiHintHoverDirective]
|
|
439
450
|
}] }, { type: Document, decorators: [{
|
|
440
451
|
type: Inject,
|
|
441
452
|
args: [DOCUMENT]
|
|
@@ -447,8 +458,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
447
458
|
}], element: [] } });
|
|
448
459
|
|
|
449
460
|
class TuiHintDriverDirective extends AbstractTuiDriverDirective {
|
|
461
|
+
// TODO: Figure out why this is necessary under nx test runner
|
|
462
|
+
constructor(destroy$, drivers, vehicles) {
|
|
463
|
+
super(destroy$, drivers, vehicles);
|
|
464
|
+
this.type = 'hint';
|
|
465
|
+
}
|
|
450
466
|
}
|
|
451
|
-
TuiHintDriverDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintDriverDirective, deps:
|
|
467
|
+
TuiHintDriverDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintDriverDirective, deps: [{ token: TuiDestroyService, self: true }, { token: TuiDriver }, { token: TuiVehicle }], target: i0.ɵɵFactoryTarget.Directive });
|
|
452
468
|
TuiHintDriverDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: TuiHintDriverDirective, selector: "[tuiHint]", providers: [TuiDestroyService], usesInheritance: true, ngImport: i0 });
|
|
453
469
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintDriverDirective, decorators: [{
|
|
454
470
|
type: Directive,
|
|
@@ -456,9 +472,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
456
472
|
selector: '[tuiHint]',
|
|
457
473
|
providers: [TuiDestroyService],
|
|
458
474
|
}]
|
|
459
|
-
}]
|
|
475
|
+
}], ctorParameters: function () { return [{ type: i2$1.Observable, decorators: [{
|
|
476
|
+
type: Self
|
|
477
|
+
}, {
|
|
478
|
+
type: Inject,
|
|
479
|
+
args: [TuiDestroyService]
|
|
480
|
+
}] }, { type: undefined, decorators: [{
|
|
481
|
+
type: Inject,
|
|
482
|
+
args: [TuiDriver]
|
|
483
|
+
}] }, { type: undefined, decorators: [{
|
|
484
|
+
type: Inject,
|
|
485
|
+
args: [TuiVehicle]
|
|
486
|
+
}] }]; } });
|
|
460
487
|
|
|
461
488
|
class TuiHintHostDirective extends TuiRectAccessor {
|
|
489
|
+
constructor() {
|
|
490
|
+
super(...arguments);
|
|
491
|
+
this.type = 'hint';
|
|
492
|
+
}
|
|
462
493
|
getClientRect() {
|
|
463
494
|
var _a;
|
|
464
495
|
return ((_a = this.tuiHintHost) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) || EMPTY_CLIENT_RECT;
|
|
@@ -477,16 +508,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
477
508
|
}] } });
|
|
478
509
|
|
|
479
510
|
class TuiHintManualDirective extends TuiDriver {
|
|
480
|
-
constructor() {
|
|
511
|
+
constructor(hover) {
|
|
481
512
|
super(subscriber => this.stream$.subscribe(subscriber));
|
|
482
513
|
this.stream$ = new Subject();
|
|
483
514
|
this.tuiHintManual = false;
|
|
515
|
+
this.type = 'hint';
|
|
516
|
+
hover.enabled = false;
|
|
484
517
|
}
|
|
485
518
|
ngOnChanges() {
|
|
486
519
|
this.stream$.next(this.tuiHintManual);
|
|
487
520
|
}
|
|
488
521
|
}
|
|
489
|
-
TuiHintManualDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintManualDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
522
|
+
TuiHintManualDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintManualDirective, deps: [{ token: TuiHintHoverDirective }], target: i0.ɵɵFactoryTarget.Directive });
|
|
490
523
|
TuiHintManualDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: TuiHintManualDirective, selector: "[tuiHint][tuiHintManual]", inputs: { tuiHintManual: "tuiHintManual" }, providers: [tuiAsDriver(TuiHintManualDirective)], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
491
524
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintManualDirective, decorators: [{
|
|
492
525
|
type: Directive,
|
|
@@ -494,7 +527,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
494
527
|
selector: '[tuiHint][tuiHintManual]',
|
|
495
528
|
providers: [tuiAsDriver(TuiHintManualDirective)],
|
|
496
529
|
}]
|
|
497
|
-
}], ctorParameters: function () { return [
|
|
530
|
+
}], ctorParameters: function () { return [{ type: TuiHintHoverDirective, decorators: [{
|
|
531
|
+
type: Inject,
|
|
532
|
+
args: [TuiHintHoverDirective]
|
|
533
|
+
}] }]; }, propDecorators: { tuiHintManual: [{
|
|
498
534
|
type: Input
|
|
499
535
|
}] } });
|
|
500
536
|
|
|
@@ -502,17 +538,21 @@ const OFFSET = 8;
|
|
|
502
538
|
const ARROW_OFFSET = 22;
|
|
503
539
|
const TOP = 0;
|
|
504
540
|
const LEFT = 1;
|
|
505
|
-
class TuiHintPositionDirective {
|
|
506
|
-
constructor(options, viewport,
|
|
541
|
+
class TuiHintPositionDirective extends TuiPositionAccessor {
|
|
542
|
+
constructor(options, viewport, directive, accessors) {
|
|
543
|
+
super();
|
|
507
544
|
this.options = options;
|
|
508
545
|
this.viewport = viewport;
|
|
509
|
-
this.
|
|
546
|
+
this.directive = directive;
|
|
547
|
+
this.accessors = accessors;
|
|
510
548
|
this.points = TUI_HINT_DIRECTIONS.reduce((acc, direction) => (Object.assign(Object.assign({}, acc), { [direction]: [0, 0] })), {});
|
|
511
549
|
this.direction = this.options.direction;
|
|
550
|
+
this.type = 'hint';
|
|
512
551
|
}
|
|
513
552
|
// eslint-disable-next-line max-statements
|
|
514
553
|
getPosition({ width, height }) {
|
|
515
|
-
|
|
554
|
+
var _a, _b;
|
|
555
|
+
const hostRect = (_b = (_a = this.accessor) === null || _a === void 0 ? void 0 : _a.getClientRect()) !== null && _b !== void 0 ? _b : EMPTY_CLIENT_RECT;
|
|
516
556
|
const leftCenter = hostRect.left + hostRect.width / 2;
|
|
517
557
|
const topCenter = hostRect.top + hostRect.height / 2;
|
|
518
558
|
this.points['top-left'][TOP] = hostRect.top - height - OFFSET;
|
|
@@ -545,6 +585,9 @@ class TuiHintPositionDirective {
|
|
|
545
585
|
const direction = TUI_HINT_DIRECTIONS.find(direction => this.checkPosition(this.points[direction], width, height));
|
|
546
586
|
return this.points[direction || this.fallback];
|
|
547
587
|
}
|
|
588
|
+
get accessor() {
|
|
589
|
+
return tuiFallbackRectAccessor('hint')(this.accessors, this.directive);
|
|
590
|
+
}
|
|
548
591
|
get fallback() {
|
|
549
592
|
return this.points.top[TOP] >
|
|
550
593
|
this.viewport.getClientRect().bottom - this.points.bottom[TOP]
|
|
@@ -559,11 +602,14 @@ class TuiHintPositionDirective {
|
|
|
559
602
|
left + width < viewport.right - OFFSET);
|
|
560
603
|
}
|
|
561
604
|
}
|
|
562
|
-
TuiHintPositionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintPositionDirective, deps: [{ token: TUI_HINT_OPTIONS }, { token: TUI_VIEWPORT }, { token: TuiRectAccessor }], target: i0.ɵɵFactoryTarget.Directive });
|
|
563
|
-
TuiHintPositionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: TuiHintPositionDirective, selector: "[tuiHint]:not([tuiHintCustomPosition])", inputs: { direction: ["tuiHintDirection", "direction"] }, providers: [tuiAsPositionAccessor(TuiHintPositionDirective)], ngImport: i0 });
|
|
605
|
+
TuiHintPositionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintPositionDirective, deps: [{ token: TUI_HINT_OPTIONS }, { token: TUI_VIEWPORT }, { token: TuiHintDirective }, { token: TuiRectAccessor }], target: i0.ɵɵFactoryTarget.Directive });
|
|
606
|
+
TuiHintPositionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: TuiHintPositionDirective, selector: "[tuiHint]:not([tuiHintCustomPosition])", inputs: { direction: ["tuiHintDirection", "direction"] }, providers: [tuiAsPositionAccessor(TuiHintPositionDirective)], usesInheritance: true, ngImport: i0 });
|
|
564
607
|
__decorate([
|
|
565
608
|
tuiDefaultProp()
|
|
566
609
|
], TuiHintPositionDirective.prototype, "direction", void 0);
|
|
610
|
+
__decorate([
|
|
611
|
+
tuiPure
|
|
612
|
+
], TuiHintPositionDirective.prototype, "accessor", null);
|
|
567
613
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintPositionDirective, decorators: [{
|
|
568
614
|
type: Directive,
|
|
569
615
|
args: [{
|
|
@@ -577,12 +623,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
577
623
|
type: Inject,
|
|
578
624
|
args: [TUI_VIEWPORT]
|
|
579
625
|
}] }, { type: i1$1.TuiRectAccessor, decorators: [{
|
|
626
|
+
type: Inject,
|
|
627
|
+
args: [TuiHintDirective]
|
|
628
|
+
}] }, { type: undefined, decorators: [{
|
|
580
629
|
type: Inject,
|
|
581
630
|
args: [TuiRectAccessor]
|
|
582
631
|
}] }]; }, propDecorators: { direction: [{
|
|
583
632
|
type: Input,
|
|
584
633
|
args: ['tuiHintDirection']
|
|
585
|
-
}] } });
|
|
634
|
+
}], accessor: [] } });
|
|
586
635
|
|
|
587
636
|
class TuiHintModule {
|
|
588
637
|
}
|