@taiga-ui/kit 2.53.0 → 2.55.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/bundles/taiga-ui-kit-components-input-files.umd.js +11 -5
- package/bundles/taiga-ui-kit-components-input-files.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-files.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-input-files.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-month-range.umd.js +1 -2
- package/bundles/taiga-ui-kit-components-input-month-range.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-month-range.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-input-month-range.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-phone-international.umd.js +1 -0
- package/bundles/taiga-ui-kit-components-input-phone-international.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-phone-international.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-input-phone-international.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-line-clamp.umd.js +32 -4
- package/bundles/taiga-ui-kit-components-line-clamp.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-line-clamp.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-line-clamp.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-slider.umd.js +148 -85
- package/bundles/taiga-ui-kit-components-slider.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-slider.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-slider.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-tabs.umd.js +5 -3
- package/bundles/taiga-ui-kit-components-tabs.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-tabs.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-tabs.umd.min.js.map +1 -1
- package/components/input-files/taiga-ui-kit-components-input-files.metadata.json +1 -1
- package/components/input-phone-international/taiga-ui-kit-components-input-phone-international.metadata.json +1 -1
- package/components/line-clamp/index.d.ts +1 -0
- package/components/line-clamp/line-clamp-options.d.ts +7 -0
- package/components/line-clamp/line-clamp.component.d.ts +8 -3
- package/components/line-clamp/taiga-ui-kit-components-line-clamp.metadata.json +1 -1
- package/components/slider/{slider-key-steps.directive.d.ts → helpers/slider-key-steps.directive.d.ts} +1 -1
- package/components/slider/{slider-readonly.directive.d.ts → helpers/slider-readonly.directive.d.ts} +0 -0
- package/components/slider/helpers/slider-thumb-label/slider-thumb-label.component.d.ts +12 -0
- package/components/slider/index.d.ts +3 -2
- package/components/slider/slider.component.d.ts +2 -1
- package/components/slider/taiga-ui-kit-components-slider.metadata.json +1 -1
- package/components/tabs/taiga-ui-kit-components-tabs.metadata.json +1 -1
- package/esm2015/components/input-files/input-files.module.js +10 -3
- package/esm2015/components/input-month-range/input-month-range.component.js +3 -4
- package/esm2015/components/input-phone-international/const/countries.js +2 -1
- package/esm2015/components/line-clamp/index.js +2 -1
- package/esm2015/components/line-clamp/line-clamp-options.js +12 -0
- package/esm2015/components/line-clamp/line-clamp.component.js +23 -8
- package/esm2015/components/slider/helpers/slider-key-steps.directive.js +103 -0
- package/esm2015/components/slider/helpers/slider-readonly.directive.js +79 -0
- package/esm2015/components/slider/helpers/slider-thumb-label/slider-thumb-label.component.js +40 -0
- package/esm2015/components/slider/index.js +4 -3
- package/esm2015/components/slider/slider.component.js +12 -2
- package/esm2015/components/slider/slider.module.js +6 -3
- package/esm2015/components/tabs/tab/tab.component.js +1 -1
- package/esm2015/components/tabs/tabs-with-more/tabs-with-more.component.js +6 -4
- package/esm5/components/input-files/input-files.module.js +10 -3
- package/esm5/components/input-month-range/input-month-range.component.js +3 -4
- package/esm5/components/input-phone-international/const/countries.js +2 -1
- package/esm5/components/line-clamp/index.js +2 -1
- package/esm5/components/line-clamp/line-clamp-options.js +13 -0
- package/esm5/components/line-clamp/line-clamp.component.js +23 -8
- package/esm5/components/slider/helpers/slider-key-steps.directive.js +129 -0
- package/esm5/components/slider/helpers/slider-readonly.directive.js +87 -0
- package/esm5/components/slider/helpers/slider-thumb-label/slider-thumb-label.component.js +55 -0
- package/esm5/components/slider/index.js +4 -3
- package/esm5/components/slider/slider.component.js +12 -2
- package/esm5/components/slider/slider.module.js +6 -3
- package/esm5/components/tabs/tab/tab.component.js +1 -1
- package/esm5/components/tabs/tabs-with-more/tabs-with-more.component.js +6 -4
- package/fesm2015/taiga-ui-kit-components-input-files.js +9 -2
- package/fesm2015/taiga-ui-kit-components-input-files.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-input-month-range.js +2 -3
- package/fesm2015/taiga-ui-kit-components-input-month-range.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-input-phone-international.js +1 -0
- package/fesm2015/taiga-ui-kit-components-input-phone-international.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-line-clamp.js +33 -8
- package/fesm2015/taiga-ui-kit-components-line-clamp.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-slider.js +122 -75
- package/fesm2015/taiga-ui-kit-components-slider.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-tabs.js +6 -4
- package/fesm2015/taiga-ui-kit-components-tabs.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-input-files.js +9 -2
- package/fesm5/taiga-ui-kit-components-input-files.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-input-month-range.js +2 -3
- package/fesm5/taiga-ui-kit-components-input-month-range.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-input-phone-international.js +1 -0
- package/fesm5/taiga-ui-kit-components-input-phone-international.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-line-clamp.js +34 -9
- package/fesm5/taiga-ui-kit-components-line-clamp.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-slider.js +149 -87
- package/fesm5/taiga-ui-kit-components-slider.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-tabs.js +6 -4
- package/fesm5/taiga-ui-kit-components-tabs.js.map +1 -1
- package/package.json +5 -5
- package/esm2015/components/slider/slider-key-steps.directive.js +0 -102
- package/esm2015/components/slider/slider-readonly.directive.js +0 -79
- package/esm5/components/slider/slider-key-steps.directive.js +0 -128
- package/esm5/components/slider/slider-readonly.directive.js +0 -87
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { __assign, __decorate, __param, __extends, __read } from 'tslib';
|
|
2
|
-
import { InjectionToken, Optional, Self, Inject, ChangeDetectorRef, ElementRef, Input, HostBinding, Component, ChangeDetectionStrategy, Output, HostListener, Directive, Pipe, forwardRef, NgModule } from '@angular/core';
|
|
2
|
+
import { InjectionToken, Optional, Self, Inject, ChangeDetectorRef, ElementRef, Input, HostBinding, Component, ChangeDetectionStrategy, Output, HostListener, Directive, Pipe, ContentChild, forwardRef, NgModule } from '@angular/core';
|
|
3
3
|
import { NgModel, NgControl } from '@angular/forms';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { watch, isEdgeOlderThan, CHROMIUM_EDGE_START_VERSION, tuiDefaultProp, typedFromEvent, isNativeFocused, clamp, tuiAssert, AbstractTuiControl, tuiCoerceBooleanProperty, TuiDestroyService, TUI_FOCUSABLE_ITEM_ACCESSOR, TuiRepeatTimesModule, TuiFocusableModule, TuiFocusVisibleModule, TuiActiveZoneModule } from '@taiga-ui/cdk';
|
|
5
|
+
import { tuiPercentageToKeyStepValue, tuiKeyStepValueToPercentage, tuiCheckKeyStepsHaveMinMaxPercents } from '@taiga-ui/kit/utils';
|
|
6
6
|
import { take, map, tap, mapTo, filter, takeUntil } from 'rxjs/operators';
|
|
7
|
+
import { USER_AGENT } from '@ng-web-apis/common';
|
|
7
8
|
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
9
|
+
import { merge, combineLatest, Observable } from 'rxjs';
|
|
8
10
|
import { TuiFormatNumberPipeModule } from '@taiga-ui/core';
|
|
9
|
-
import { tuiPercentageToKeyStepValue, tuiKeyStepValueToPercentage, tuiCheckKeyStepsHaveMinMaxPercents } from '@taiga-ui/kit/utils';
|
|
10
11
|
import { AbstractTuiSlider } from '@taiga-ui/kit/abstract';
|
|
11
12
|
import { TUI_FROM_TO_TEXTS } from '@taiga-ui/kit/tokens';
|
|
12
|
-
import { Observable, merge, combineLatest } from 'rxjs';
|
|
13
13
|
|
|
14
14
|
var TUI_SLIDER_DEFAULT_OPTIONS = {
|
|
15
15
|
size: 'm',
|
|
@@ -26,6 +26,7 @@ function tuiSliderOptionsProvider(options) {
|
|
|
26
26
|
var TuiSliderComponent = /** @class */ (function () {
|
|
27
27
|
function TuiSliderComponent(control, changeDetectorRef, options, elementRef, userAgent) {
|
|
28
28
|
var _a;
|
|
29
|
+
this.control = control;
|
|
29
30
|
this.options = options;
|
|
30
31
|
this.elementRef = elementRef;
|
|
31
32
|
this.userAgent = userAgent;
|
|
@@ -65,7 +66,16 @@ var TuiSliderComponent = /** @class */ (function () {
|
|
|
65
66
|
});
|
|
66
67
|
Object.defineProperty(TuiSliderComponent.prototype, "value", {
|
|
67
68
|
get: function () {
|
|
68
|
-
|
|
69
|
+
var _a = this, elementRef = _a.elementRef, control = _a.control;
|
|
70
|
+
var noKeySteps = !elementRef.nativeElement.hasAttribute('data-key-steps');
|
|
71
|
+
if (noKeySteps && control instanceof NgModel) {
|
|
72
|
+
/**
|
|
73
|
+
* If developer uses `[(ngModel)]` and programmatically change value,
|
|
74
|
+
* the `elementRef.nativeElement.value` is equal to the previous value at this moment.
|
|
75
|
+
*/
|
|
76
|
+
return control.viewModel;
|
|
77
|
+
}
|
|
78
|
+
return Number(elementRef.nativeElement.value) || 0;
|
|
69
79
|
},
|
|
70
80
|
set: function (newValue) {
|
|
71
81
|
this.elementRef.nativeElement.value = "" + newValue;
|
|
@@ -240,6 +250,7 @@ var TuiSliderKeyStepsDirective = /** @class */ (function (_super) {
|
|
|
240
250
|
Directive({
|
|
241
251
|
selector: 'input[tuiSlider][keySteps]',
|
|
242
252
|
host: {
|
|
253
|
+
'[attr.data-key-steps]': 'true',
|
|
243
254
|
'[attr.aria-valuenow]': 'controlValue',
|
|
244
255
|
'[attr.aria-valuemin]': 'min',
|
|
245
256
|
'[attr.aria-valuemax]': 'max',
|
|
@@ -272,6 +283,135 @@ var TuiSliderTickLabelPipe = /** @class */ (function () {
|
|
|
272
283
|
return TuiSliderTickLabelPipe;
|
|
273
284
|
}());
|
|
274
285
|
|
|
286
|
+
var SLIDER_INTERACTION_KEYS = new Set([
|
|
287
|
+
'ArrowLeft',
|
|
288
|
+
'ArrowRight',
|
|
289
|
+
'ArrowUp',
|
|
290
|
+
'ArrowDown',
|
|
291
|
+
'Home',
|
|
292
|
+
'End',
|
|
293
|
+
'PageUp',
|
|
294
|
+
'PageDown',
|
|
295
|
+
]);
|
|
296
|
+
/**
|
|
297
|
+
* Native <input type='range' readonly> doesn't work.
|
|
298
|
+
* This directive imitates this native behaviour.
|
|
299
|
+
*/
|
|
300
|
+
// @dynamic
|
|
301
|
+
var TuiSliderReadonlyDirective = /** @class */ (function () {
|
|
302
|
+
function TuiSliderReadonlyDirective(elementRef, documentRef, destroy$) {
|
|
303
|
+
var _this = this;
|
|
304
|
+
this.readonly = true;
|
|
305
|
+
var touchStart$ = typedFromEvent(elementRef.nativeElement, 'touchstart', {
|
|
306
|
+
passive: false,
|
|
307
|
+
});
|
|
308
|
+
var touchMove$ = typedFromEvent(documentRef, 'touchmove', {
|
|
309
|
+
passive: false,
|
|
310
|
+
});
|
|
311
|
+
var touchEnd$ = typedFromEvent(documentRef, 'touchend', {
|
|
312
|
+
passive: true,
|
|
313
|
+
});
|
|
314
|
+
var shouldPreventMove$ = merge(touchStart$.pipe(tap(function (e) { return _this.preventEvent(e); }), mapTo(true)), touchEnd$.pipe(mapTo(false)));
|
|
315
|
+
/**
|
|
316
|
+
* @bad TODO think about another solution.
|
|
317
|
+
* Keep in mind that preventing touch event (on slider) inside `@HostListener('touchstart')` doesn't work for mobile chrome.
|
|
318
|
+
*/
|
|
319
|
+
combineLatest([touchMove$, shouldPreventMove$])
|
|
320
|
+
.pipe(filter(function (_a) {
|
|
321
|
+
var _b = __read(_a, 2), _ = _b[0], shouldPreventMove = _b[1];
|
|
322
|
+
return shouldPreventMove;
|
|
323
|
+
}), takeUntil(destroy$))
|
|
324
|
+
.subscribe(function (_a) {
|
|
325
|
+
var _b = __read(_a, 1), moveEvent = _b[0];
|
|
326
|
+
return _this.preventEvent(moveEvent);
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
TuiSliderReadonlyDirective.prototype.preventEvent = function (event) {
|
|
330
|
+
if (event.cancelable && tuiCoerceBooleanProperty(this.readonly)) {
|
|
331
|
+
event.preventDefault();
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
TuiSliderReadonlyDirective.prototype.preventKeyboardInteraction = function (event) {
|
|
335
|
+
if (SLIDER_INTERACTION_KEYS.has(event.key)) {
|
|
336
|
+
this.preventEvent(event);
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
TuiSliderReadonlyDirective.ctorParameters = function () { return [
|
|
340
|
+
{ type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] },
|
|
341
|
+
{ type: Document, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
|
|
342
|
+
{ type: Observable, decorators: [{ type: Inject, args: [TuiDestroyService,] }] }
|
|
343
|
+
]; };
|
|
344
|
+
__decorate([
|
|
345
|
+
Input(),
|
|
346
|
+
tuiDefaultProp()
|
|
347
|
+
], TuiSliderReadonlyDirective.prototype, "readonly", void 0);
|
|
348
|
+
__decorate([
|
|
349
|
+
HostListener('mousedown', ['$event'])
|
|
350
|
+
], TuiSliderReadonlyDirective.prototype, "preventEvent", null);
|
|
351
|
+
__decorate([
|
|
352
|
+
HostListener('keydown', ['$event'])
|
|
353
|
+
], TuiSliderReadonlyDirective.prototype, "preventKeyboardInteraction", null);
|
|
354
|
+
TuiSliderReadonlyDirective = __decorate([
|
|
355
|
+
Directive({
|
|
356
|
+
selector: 'input[tuiSlider][readonly]',
|
|
357
|
+
providers: [TuiDestroyService],
|
|
358
|
+
}),
|
|
359
|
+
__param(0, Inject(ElementRef)),
|
|
360
|
+
__param(1, Inject(DOCUMENT)),
|
|
361
|
+
__param(2, Inject(TuiDestroyService))
|
|
362
|
+
], TuiSliderReadonlyDirective);
|
|
363
|
+
return TuiSliderReadonlyDirective;
|
|
364
|
+
}());
|
|
365
|
+
|
|
366
|
+
var TuiSliderThumbLabelComponent = /** @class */ (function () {
|
|
367
|
+
function TuiSliderThumbLabelComponent() {
|
|
368
|
+
}
|
|
369
|
+
Object.defineProperty(TuiSliderThumbLabelComponent.prototype, "size", {
|
|
370
|
+
get: function () {
|
|
371
|
+
var _a;
|
|
372
|
+
return ((_a = this.slider) === null || _a === void 0 ? void 0 : _a.size) || 'm';
|
|
373
|
+
},
|
|
374
|
+
enumerable: true,
|
|
375
|
+
configurable: true
|
|
376
|
+
});
|
|
377
|
+
Object.defineProperty(TuiSliderThumbLabelComponent.prototype, "ratio", {
|
|
378
|
+
get: function () {
|
|
379
|
+
var _a;
|
|
380
|
+
return (((_a = this.slider) === null || _a === void 0 ? void 0 : _a.valuePercentage) || 0) / 100;
|
|
381
|
+
},
|
|
382
|
+
enumerable: true,
|
|
383
|
+
configurable: true
|
|
384
|
+
});
|
|
385
|
+
Object.defineProperty(TuiSliderThumbLabelComponent.prototype, "ghostLeft", {
|
|
386
|
+
get: function () {
|
|
387
|
+
var _a;
|
|
388
|
+
return this.ratio * (((_a = this.slider) === null || _a === void 0 ? void 0 : _a.elementRef.nativeElement.offsetWidth) || 0);
|
|
389
|
+
},
|
|
390
|
+
enumerable: true,
|
|
391
|
+
configurable: true
|
|
392
|
+
});
|
|
393
|
+
TuiSliderThumbLabelComponent.prototype.ngAfterContentInit = function () {
|
|
394
|
+
var _a;
|
|
395
|
+
tuiAssert.assert(Boolean((_a = this.control) === null || _a === void 0 ? void 0 : _a.valueChanges), "\n[tuiSliderThumbLabel] expected <input tuiSlider type=\"range\" /> to use Angular Forms.\n" +
|
|
396
|
+
'Use [(ngModel)] or [formControl] or formControlName for correct work.');
|
|
397
|
+
};
|
|
398
|
+
__decorate([
|
|
399
|
+
ContentChild(TuiSliderComponent)
|
|
400
|
+
], TuiSliderThumbLabelComponent.prototype, "slider", void 0);
|
|
401
|
+
__decorate([
|
|
402
|
+
ContentChild(NgControl)
|
|
403
|
+
], TuiSliderThumbLabelComponent.prototype, "control", void 0);
|
|
404
|
+
TuiSliderThumbLabelComponent = __decorate([
|
|
405
|
+
Component({
|
|
406
|
+
selector: '[tuiSliderThumbLabel]',
|
|
407
|
+
template: "<ng-container *ngIf=\"control?.valueChanges | async\"></ng-container>\n\n<div\n class=\"t-ghost\"\n [attr.data-size]=\"size\"\n [style.left.px]=\"ghostLeft\"\n [style.--tui-slider-thumb-ratio]=\"ratio\"\n>\n <ng-content></ng-content>\n</div>\n\n<ng-content select=\"input[type=range]\"></ng-content>\n",
|
|
408
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
409
|
+
styles: [":host{position:relative}.t-ghost{position:absolute;top:0;bottom:0;margin:auto;border-radius:50%;pointer-events:none}.t-ghost[data-size='s']{width:.5rem;height:.5rem;transform:translateX(calc(var(--tui-slider-thumb-ratio) * -.5rem))}.t-ghost[data-size='m']{width:1rem;height:1rem;transform:translateX(calc(var(--tui-slider-thumb-ratio) * -1rem))}"]
|
|
410
|
+
})
|
|
411
|
+
], TuiSliderThumbLabelComponent);
|
|
412
|
+
return TuiSliderThumbLabelComponent;
|
|
413
|
+
}());
|
|
414
|
+
|
|
275
415
|
/**
|
|
276
416
|
* @deprecated use {@link TuiSliderComponent} instead
|
|
277
417
|
* TODO: 3.0 remove
|
|
@@ -359,86 +499,6 @@ var TuiSliderOldComponent = /** @class */ (function (_super) {
|
|
|
359
499
|
return TuiSliderOldComponent;
|
|
360
500
|
}(AbstractTuiSlider));
|
|
361
501
|
|
|
362
|
-
var SLIDER_INTERACTION_KEYS = new Set([
|
|
363
|
-
'ArrowLeft',
|
|
364
|
-
'ArrowRight',
|
|
365
|
-
'ArrowUp',
|
|
366
|
-
'ArrowDown',
|
|
367
|
-
'Home',
|
|
368
|
-
'End',
|
|
369
|
-
'PageUp',
|
|
370
|
-
'PageDown',
|
|
371
|
-
]);
|
|
372
|
-
/**
|
|
373
|
-
* Native <input type='range' readonly> doesn't work.
|
|
374
|
-
* This directive imitates this native behaviour.
|
|
375
|
-
*/
|
|
376
|
-
// @dynamic
|
|
377
|
-
var TuiSliderReadonlyDirective = /** @class */ (function () {
|
|
378
|
-
function TuiSliderReadonlyDirective(elementRef, documentRef, destroy$) {
|
|
379
|
-
var _this = this;
|
|
380
|
-
this.readonly = true;
|
|
381
|
-
var touchStart$ = typedFromEvent(elementRef.nativeElement, 'touchstart', {
|
|
382
|
-
passive: false,
|
|
383
|
-
});
|
|
384
|
-
var touchMove$ = typedFromEvent(documentRef, 'touchmove', {
|
|
385
|
-
passive: false,
|
|
386
|
-
});
|
|
387
|
-
var touchEnd$ = typedFromEvent(documentRef, 'touchend', {
|
|
388
|
-
passive: true,
|
|
389
|
-
});
|
|
390
|
-
var shouldPreventMove$ = merge(touchStart$.pipe(tap(function (e) { return _this.preventEvent(e); }), mapTo(true)), touchEnd$.pipe(mapTo(false)));
|
|
391
|
-
/**
|
|
392
|
-
* @bad TODO think about another solution.
|
|
393
|
-
* Keep in mind that preventing touch event (on slider) inside `@HostListener('touchstart')` doesn't work for mobile chrome.
|
|
394
|
-
*/
|
|
395
|
-
combineLatest([touchMove$, shouldPreventMove$])
|
|
396
|
-
.pipe(filter(function (_a) {
|
|
397
|
-
var _b = __read(_a, 2), _ = _b[0], shouldPreventMove = _b[1];
|
|
398
|
-
return shouldPreventMove;
|
|
399
|
-
}), takeUntil(destroy$))
|
|
400
|
-
.subscribe(function (_a) {
|
|
401
|
-
var _b = __read(_a, 1), moveEvent = _b[0];
|
|
402
|
-
return _this.preventEvent(moveEvent);
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
TuiSliderReadonlyDirective.prototype.preventEvent = function (event) {
|
|
406
|
-
if (event.cancelable && tuiCoerceBooleanProperty(this.readonly)) {
|
|
407
|
-
event.preventDefault();
|
|
408
|
-
}
|
|
409
|
-
};
|
|
410
|
-
TuiSliderReadonlyDirective.prototype.preventKeyboardInteraction = function (event) {
|
|
411
|
-
if (SLIDER_INTERACTION_KEYS.has(event.key)) {
|
|
412
|
-
this.preventEvent(event);
|
|
413
|
-
}
|
|
414
|
-
};
|
|
415
|
-
TuiSliderReadonlyDirective.ctorParameters = function () { return [
|
|
416
|
-
{ type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] },
|
|
417
|
-
{ type: Document, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
|
|
418
|
-
{ type: Observable, decorators: [{ type: Inject, args: [TuiDestroyService,] }] }
|
|
419
|
-
]; };
|
|
420
|
-
__decorate([
|
|
421
|
-
Input(),
|
|
422
|
-
tuiDefaultProp()
|
|
423
|
-
], TuiSliderReadonlyDirective.prototype, "readonly", void 0);
|
|
424
|
-
__decorate([
|
|
425
|
-
HostListener('mousedown', ['$event'])
|
|
426
|
-
], TuiSliderReadonlyDirective.prototype, "preventEvent", null);
|
|
427
|
-
__decorate([
|
|
428
|
-
HostListener('keydown', ['$event'])
|
|
429
|
-
], TuiSliderReadonlyDirective.prototype, "preventKeyboardInteraction", null);
|
|
430
|
-
TuiSliderReadonlyDirective = __decorate([
|
|
431
|
-
Directive({
|
|
432
|
-
selector: 'input[tuiSlider][readonly]',
|
|
433
|
-
providers: [TuiDestroyService],
|
|
434
|
-
}),
|
|
435
|
-
__param(0, Inject(ElementRef)),
|
|
436
|
-
__param(1, Inject(DOCUMENT)),
|
|
437
|
-
__param(2, Inject(TuiDestroyService))
|
|
438
|
-
], TuiSliderReadonlyDirective);
|
|
439
|
-
return TuiSliderReadonlyDirective;
|
|
440
|
-
}());
|
|
441
|
-
|
|
442
502
|
var TuiSliderModule = /** @class */ (function () {
|
|
443
503
|
function TuiSliderModule() {
|
|
444
504
|
}
|
|
@@ -454,6 +514,7 @@ var TuiSliderModule = /** @class */ (function () {
|
|
|
454
514
|
],
|
|
455
515
|
declarations: [
|
|
456
516
|
TuiSliderComponent,
|
|
517
|
+
TuiSliderThumbLabelComponent,
|
|
457
518
|
TuiSliderKeyStepsDirective,
|
|
458
519
|
TuiSliderReadonlyDirective,
|
|
459
520
|
TuiSliderTickLabelPipe,
|
|
@@ -461,6 +522,7 @@ var TuiSliderModule = /** @class */ (function () {
|
|
|
461
522
|
],
|
|
462
523
|
exports: [
|
|
463
524
|
TuiSliderComponent,
|
|
525
|
+
TuiSliderThumbLabelComponent,
|
|
464
526
|
TuiSliderKeyStepsDirective,
|
|
465
527
|
TuiSliderReadonlyDirective,
|
|
466
528
|
TuiSliderTickLabelPipe,
|
|
@@ -475,5 +537,5 @@ var TuiSliderModule = /** @class */ (function () {
|
|
|
475
537
|
* Generated bundle index. Do not edit.
|
|
476
538
|
*/
|
|
477
539
|
|
|
478
|
-
export { TUI_SLIDER_DEFAULT_OPTIONS, TUI_SLIDER_OPTIONS, TuiSliderComponent, TuiSliderKeyStepsDirective, TuiSliderModule, TuiSliderOldComponent, TuiSliderReadonlyDirective, TuiSliderTickLabelPipe, tuiSliderOptionsProvider };
|
|
540
|
+
export { TUI_SLIDER_DEFAULT_OPTIONS, TUI_SLIDER_OPTIONS, TuiSliderComponent, TuiSliderKeyStepsDirective, TuiSliderModule, TuiSliderOldComponent, TuiSliderReadonlyDirective, TuiSliderThumbLabelComponent, TuiSliderTickLabelPipe, tuiSliderOptionsProvider };
|
|
479
541
|
//# sourceMappingURL=taiga-ui-kit-components-slider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-kit-components-slider.js","sources":["ng://@taiga-ui/kit/components/slider/slider-options.ts","ng://@taiga-ui/kit/components/slider/slider.component.ts","ng://@taiga-ui/kit/components/slider/slider-key-steps.directive.ts","ng://@taiga-ui/kit/components/slider/slider-old.component.ts","ng://@taiga-ui/kit/components/slider/slider-readonly.directive.ts","ng://@taiga-ui/kit/components/slider/slider.module.ts","ng://@taiga-ui/kit/components/slider/taiga-ui-kit-components-slider.ts"],"sourcesContent":["import {InjectionToken, ValueProvider} from '@angular/core';\nimport {TuiSizeS} from '@taiga-ui/core';\n\nexport interface TuiSliderOptions {\n readonly size: TuiSizeS;\n readonly trackColor: string;\n}\n\nexport const TUI_SLIDER_DEFAULT_OPTIONS: TuiSliderOptions = {\n size: 'm',\n trackColor: 'var(--tui-base-03)',\n};\n\nexport const TUI_SLIDER_OPTIONS = new InjectionToken<TuiSliderOptions>(\n 'Default parameters for Slider component',\n {factory: () => TUI_SLIDER_DEFAULT_OPTIONS},\n);\n\nexport function tuiSliderOptionsProvider(\n options: Partial<TuiSliderOptions>,\n): ValueProvider {\n return {\n provide: TUI_SLIDER_OPTIONS,\n useValue: {...TUI_SLIDER_DEFAULT_OPTIONS, ...options},\n };\n}\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n HostBinding,\n Inject,\n Input,\n Optional,\n Self,\n} from '@angular/core';\nimport {NgControl, NgModel} from '@angular/forms';\nimport {USER_AGENT} from '@ng-web-apis/common';\nimport {\n CHROMIUM_EDGE_START_VERSION,\n isEdgeOlderThan,\n tuiDefaultProp,\n watch,\n} from '@taiga-ui/cdk';\nimport {TuiSizeS} from '@taiga-ui/core';\nimport {take} from 'rxjs/operators';\n\nimport {TUI_SLIDER_OPTIONS, TuiSliderOptions} from './slider-options';\n\n@Component({\n /**\n * We have to call our component as `<input tuiSlider type=\"range\" ... />`\n * because otherwise built-in angular\n * {@link https://github.com/angular/angular/blob/master/packages/forms/src/directives/range_value_accessor.ts#L45 RangeValueAccessor}\n * cannot be matched by its CSS selector.\n */\n selector: 'input[type=range][tuiSlider]',\n template: ``,\n styleUrls: ['./slider.style.less'],\n host: {\n /**\n * For change detection.\n * Webkit does not have built-in method for customization of filling progress (as Firefox).\n * We draw filling of progress by `background: linear-gradient(...)` of the track.\n * This function triggers change detection (for {@link valuePercentage} function) when we drag thumb of the input.\n */\n '(input)': '0',\n '[style.--tui-slider-track-color]': 'options.trackColor',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiSliderComponent {\n @Input()\n @HostBinding('attr.data-size')\n @tuiDefaultProp()\n size: TuiSizeS = this.options.size;\n\n @Input()\n @tuiDefaultProp()\n segments = 1;\n\n get min(): number {\n return Number(this.elementRef.nativeElement.min);\n }\n\n get max(): number {\n return Number(this.elementRef.nativeElement.max || 100);\n }\n\n get step(): number {\n return Number(this.elementRef.nativeElement.step) || 1;\n }\n\n get value(): number {\n return Number(this.elementRef.nativeElement.value) || 0;\n }\n\n set value(newValue: number) {\n this.elementRef.nativeElement.value = `${newValue}`;\n }\n\n @HostBinding('style.--tui-slider-fill-percentage.%')\n get valuePercentage(): number {\n return (100 * (this.value - this.min)) / (this.max - this.min) || 0;\n }\n\n @HostBinding('style.--tui-slider-segment-width.%')\n get segmentWidth(): number {\n return 100 / Math.max(1, this.segments);\n }\n\n @HostBinding('class._old-edge')\n get isOldEdge(): boolean {\n return isEdgeOlderThan(CHROMIUM_EDGE_START_VERSION, this.userAgent);\n }\n\n constructor(\n @Optional()\n @Self()\n @Inject(NgControl)\n control: NgControl | null,\n @Inject(ChangeDetectorRef) changeDetectorRef: ChangeDetectorRef,\n @Inject(TUI_SLIDER_OPTIONS) readonly options: TuiSliderOptions,\n @Inject(ElementRef) private readonly elementRef: ElementRef<HTMLInputElement>,\n @Inject(USER_AGENT) private readonly userAgent: string,\n ) {\n if (control instanceof NgModel) {\n /**\n * The ValueAccessor.writeValue method is called twice on any value accessor during component initialization,\n * when a control is bound using [(ngModel)], first time with a phantom null value.\n * With `changeDetection: ChangeDetectionStrategy.OnPush` the second call of writeValue with real value don't re-render the view.\n * ___\n * See this {@link https://github.com/angular/angular/issues/14988 issue}\n */\n control.valueChanges?.pipe(watch(changeDetectorRef), take(1)).subscribe();\n }\n }\n}\n","import {\n ChangeDetectorRef,\n Directive,\n ElementRef,\n HostListener,\n Inject,\n Input,\n Optional,\n Output,\n Pipe,\n PipeTransform,\n Self,\n} from '@angular/core';\nimport {NgControl} from '@angular/forms';\nimport {\n AbstractTuiControl,\n clamp,\n isNativeFocused,\n tuiAssert,\n tuiDefaultProp,\n TuiFocusableElementAccessor,\n typedFromEvent,\n} from '@taiga-ui/cdk';\nimport {TuiKeySteps} from '@taiga-ui/kit/types';\nimport {\n tuiCheckKeyStepsHaveMinMaxPercents,\n tuiKeyStepValueToPercentage,\n tuiPercentageToKeyStepValue,\n} from '@taiga-ui/kit/utils';\nimport {map} from 'rxjs/operators';\n\nimport {TuiSliderComponent} from './slider.component';\n\n// @dynamic\n@Directive({\n selector: 'input[tuiSlider][keySteps]',\n host: {\n '[attr.aria-valuenow]': 'controlValue',\n '[attr.aria-valuemin]': 'min',\n '[attr.aria-valuemax]': 'max',\n },\n})\nexport class TuiSliderKeyStepsDirective\n extends AbstractTuiControl<number>\n implements TuiFocusableElementAccessor\n{\n @Input()\n @tuiDefaultProp(\n tuiCheckKeyStepsHaveMinMaxPercents,\n 'Should contain min and max values',\n )\n keySteps: TuiKeySteps = [];\n\n @Output()\n keyStepsInput = typedFromEvent(this.elementRef.nativeElement, 'input').pipe(\n map(() => this.controlValue),\n );\n\n get nativeFocusableElement(): HTMLInputElement | null {\n return this.computedDisabled ? null : this.elementRef.nativeElement;\n }\n\n get focused(): boolean {\n return isNativeFocused(this.nativeFocusableElement);\n }\n\n get min(): number {\n return this.keySteps[0]?.[1] || 0;\n }\n\n get max(): number {\n return this.keySteps[this.keySteps.length - 1]?.[1] || 100;\n }\n\n get controlValue(): number {\n return tuiPercentageToKeyStepValue(this.slider.valuePercentage, this.keySteps);\n }\n\n constructor(\n @Optional()\n @Self()\n @Inject(NgControl)\n control: NgControl | null,\n @Inject(ChangeDetectorRef) changeDetectorRef: ChangeDetectorRef,\n @Inject(ElementRef) private readonly elementRef: ElementRef<HTMLInputElement>,\n @Inject(TuiSliderComponent) private readonly slider: TuiSliderComponent,\n ) {\n super(control, changeDetectorRef);\n }\n\n @HostListener('change')\n updateControlValue(): void {\n this.updateValue(this.controlValue);\n }\n\n writeValue(controlValue: number | null): void {\n if (controlValue === null) {\n return;\n }\n\n const clampedControlValue = clamp(controlValue, this.min, this.max);\n\n tuiAssert.assert(\n controlValue === clampedControlValue,\n '\\n[SliderKeySteps]: You cannot programmatically set value which is less/more than min/max',\n );\n\n this.slider.value = this.transformToNativeValue(clampedControlValue);\n }\n\n protected getFallbackValue(): number {\n return 0;\n }\n\n private transformToNativeValue(controlValue: number): number {\n const {min, max} = this.slider;\n const newValuePercentage = tuiKeyStepValueToPercentage(\n controlValue,\n this.keySteps,\n );\n\n return (newValuePercentage * (max - min)) / 100 + min;\n }\n}\n\n/**\n * @deprecated DONT USE IT! It is just temporary solution for internal purposes only. We will delete it in next major release.\n * TODO delete it in v3.0\n *\n */\n@Pipe({name: 'tuiSliderTickLabel'})\nexport class TuiSliderTickLabelPipe implements PipeTransform {\n transform(tickIndex: number, totalSegments: number, keySteps: TuiKeySteps): number {\n const percentage = (100 / totalSegments) * tickIndex;\n\n return tuiPercentageToKeyStepValue(percentage, keySteps);\n }\n}\n","import {DOCUMENT} from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n forwardRef,\n Inject,\n Optional,\n Self,\n} from '@angular/core';\nimport {NgControl} from '@angular/forms';\nimport {\n isNativeFocused,\n TUI_FOCUSABLE_ITEM_ACCESSOR,\n TuiFocusableElementAccessor,\n TuiNativeFocusableElement,\n} from '@taiga-ui/cdk';\nimport {AbstractTuiSlider} from '@taiga-ui/kit/abstract';\nimport {TUI_FROM_TO_TEXTS} from '@taiga-ui/kit/tokens';\nimport {Observable} from 'rxjs';\n\n/**\n * @deprecated use {@link TuiSliderComponent} instead\n * TODO: 3.0 remove\n */\n// @dynamic\n@Component({\n selector: 'tui-slider',\n templateUrl: '../../abstract/slider/slider.common.template.html',\n styleUrls: [\n '../../abstract/slider/slider.common.style.less',\n './slider-old.style.less',\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: TUI_FOCUSABLE_ITEM_ACCESSOR,\n useExisting: forwardRef(() => TuiSliderOldComponent),\n },\n ],\n})\nexport class TuiSliderOldComponent\n extends AbstractTuiSlider<number>\n implements TuiFocusableElementAccessor\n{\n constructor(\n @Optional()\n @Self()\n @Inject(NgControl)\n control: NgControl | null,\n @Inject(ChangeDetectorRef) changeDetectorRef: ChangeDetectorRef,\n @Inject(DOCUMENT) documentRef: Document,\n @Inject(TUI_FROM_TO_TEXTS) fromToTexts$: Observable<[string, string]>,\n ) {\n super(control, changeDetectorRef, documentRef, fromToTexts$);\n }\n\n get nativeFocusableElement(): TuiNativeFocusableElement | null {\n return this.dotRight ? this.dotRight.nativeElement : null;\n }\n\n get focused(): boolean {\n return isNativeFocused(this.nativeFocusableElement);\n }\n\n get left(): number {\n return 0;\n }\n\n get right(): number {\n return 100 - 100 * this.getFractionFromValue(this.value);\n }\n\n processValue(value: number): void {\n this.updateValue(this.valueGuard(value));\n }\n\n decrement(): void {\n this.processStep(false);\n }\n\n increment(): void {\n this.processStep(true);\n }\n\n protected getFallbackValue(): number {\n return 0;\n }\n\n protected processStep(increment: boolean): void {\n const fraction = this.getFractionFromValue(this.value);\n const step = this.computedStep;\n const value = this.getValueFromFraction(\n increment ? fraction + step : fraction - step,\n );\n\n this.processValue(value);\n }\n}\n","import {DOCUMENT} from '@angular/common';\nimport {Directive, ElementRef, HostListener, Inject, Input} from '@angular/core';\nimport {\n tuiCoerceBooleanProperty,\n tuiDefaultProp,\n TuiDestroyService,\n typedFromEvent,\n} from '@taiga-ui/cdk';\nimport {combineLatest, merge, Observable} from 'rxjs';\nimport {filter, mapTo, takeUntil, tap} from 'rxjs/operators';\n\nconst SLIDER_INTERACTION_KEYS = new Set([\n 'ArrowLeft',\n 'ArrowRight',\n 'ArrowUp',\n 'ArrowDown',\n 'Home',\n 'End',\n 'PageUp',\n 'PageDown',\n]);\n\n/**\n * Native <input type='range' readonly> doesn't work.\n * This directive imitates this native behaviour.\n */\n// @dynamic\n@Directive({\n selector: 'input[tuiSlider][readonly]',\n providers: [TuiDestroyService],\n})\nexport class TuiSliderReadonlyDirective {\n @Input()\n @tuiDefaultProp()\n readonly: string | boolean = true;\n\n constructor(\n @Inject(ElementRef) elementRef: ElementRef<HTMLInputElement>,\n @Inject(DOCUMENT) documentRef: Document,\n @Inject(TuiDestroyService)\n destroy$: Observable<unknown>,\n ) {\n const touchStart$ = typedFromEvent(elementRef.nativeElement, 'touchstart', {\n passive: false,\n });\n const touchMove$ = typedFromEvent(documentRef, 'touchmove', {\n passive: false,\n });\n const touchEnd$ = typedFromEvent(documentRef, 'touchend', {\n passive: true,\n });\n\n const shouldPreventMove$ = merge(\n touchStart$.pipe(\n tap(e => this.preventEvent(e)),\n mapTo(true),\n ),\n touchEnd$.pipe(mapTo(false)),\n );\n\n /**\n * @bad TODO think about another solution.\n * Keep in mind that preventing touch event (on slider) inside `@HostListener('touchstart')` doesn't work for mobile chrome.\n */\n combineLatest([touchMove$, shouldPreventMove$])\n .pipe(\n filter(([_, shouldPreventMove]) => shouldPreventMove),\n takeUntil(destroy$),\n )\n .subscribe(([moveEvent]) => this.preventEvent(moveEvent));\n }\n\n @HostListener('mousedown', ['$event'])\n preventEvent(event: Event): void {\n if (event.cancelable && tuiCoerceBooleanProperty(this.readonly)) {\n event.preventDefault();\n }\n }\n\n @HostListener('keydown', ['$event'])\n preventKeyboardInteraction(event: KeyboardEvent): void {\n if (SLIDER_INTERACTION_KEYS.has(event.key)) {\n this.preventEvent(event);\n }\n }\n}\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {\n TuiActiveZoneModule,\n TuiFocusableModule,\n TuiFocusVisibleModule,\n TuiRepeatTimesModule,\n} from '@taiga-ui/cdk';\nimport {TuiFormatNumberPipeModule} from '@taiga-ui/core';\n\nimport {TuiSliderComponent} from './slider.component';\nimport {\n TuiSliderKeyStepsDirective,\n TuiSliderTickLabelPipe,\n} from './slider-key-steps.directive';\nimport {TuiSliderOldComponent} from './slider-old.component';\nimport {TuiSliderReadonlyDirective} from './slider-readonly.directive';\n\n@NgModule({\n imports: [\n CommonModule,\n TuiRepeatTimesModule,\n TuiFocusableModule,\n TuiFocusVisibleModule,\n TuiActiveZoneModule,\n TuiFormatNumberPipeModule,\n ],\n declarations: [\n TuiSliderComponent,\n TuiSliderKeyStepsDirective,\n TuiSliderReadonlyDirective,\n TuiSliderTickLabelPipe,\n TuiSliderOldComponent,\n ],\n exports: [\n TuiSliderComponent,\n TuiSliderKeyStepsDirective,\n TuiSliderReadonlyDirective,\n TuiSliderTickLabelPipe,\n TuiSliderOldComponent,\n ],\n})\nexport class TuiSliderModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;IAQa,0BAA0B,GAAqB;IACxD,IAAI,EAAE,GAAG;IACT,UAAU,EAAE,oBAAoB;EAClC;IAEW,kBAAkB,GAAG,IAAI,cAAc,CAChD,yCAAyC,EACzC,EAAC,OAAO,EAAE,cAAM,OAAA,0BAA0B,GAAA,EAAC,EAC7C;SAEc,wBAAwB,CACpC,OAAkC;IAElC,OAAO;QACH,OAAO,EAAE,kBAAkB;QAC3B,QAAQ,wBAAM,0BAA0B,GAAK,OAAO,CAAC;KACxD,CAAC;AACN;;;ICkEI,4BAII,OAAyB,EACE,iBAAoC,EAC1B,OAAyB,EACzB,UAAwC,EACxC,SAAiB;;QAFjB,YAAO,GAAP,OAAO,CAAkB;QACzB,eAAU,GAAV,UAAU,CAA8B;QACxC,cAAS,GAAT,SAAS,CAAQ;QAjD1D,SAAI,GAAa,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;QAInC,aAAQ,GAAG,CAAC,CAAC;QA+CT,IAAI,OAAO,YAAY,OAAO,EAAE;;;;;;;;YAQ5B,MAAA,OAAO,CAAC,YAAY,0CAAE,IAAI,CAAC,KAAK,CAAC,iBA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,CAAC,CAAC;SAC5B;KACJ;;gBA/CmC,UAAU,uBAAzC,MAAM,SAAC,UAAU;gBACa,QAAQ,uBAAtC,MAAM,SAAC,QAAQ;gBAEN,UAAU,uBADnB,MAAM,SAAC,iBAAiB;;IAL7B;QAFC,KAAK,EAAE;QACP,cAAc,EAAE;gEACiB;IAuClC;QADC,YAAY,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC;kEAKrC;IAGD;QADC,YAAY,CAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,CAAC;gFAKnC;IArDQ,0BAA0B;QAJtC,SAAS,CAAC;YACP,QAAQ,EAAE,4BAA4B;YACtC,SAAS,EAAE,CAAC,iBAAiB,CAAC;SACjC,CAAC;QAOO,WAAA,MAAM,CAAC,UAAU,CAAC,CAAA;QAClB,WAAA,MAAM,CAAC,QAAQ,CAAC,CAAA;QAChB,WAAA,MAAM,CAAC,iBAAiB,CAAC,CAAA;OARrB,0BAA0B,CAsDtC;IAAD,iCAAC;CAtDD;;;ICWA;KAA+B;IAAlB,eAAe;QAxB3B,QAAQ,CAAC;YACN,OAAO,EAAE;gBACL,YAAY;gBACZ,oBAAoB;gBACpB,kBAAkB;gBAClB,qBAAqB;gBACrB,mBAAmB;gBACnB,yBAAyB;aAC5B;YACD,YAAY,EAAE;gBACV,kBAAkB;gBAClB,0BAA0B;gBAC1B,0BAA0B;gBAC1B,sBAAsB;gBACtB,qBAAqB;aACxB;YACD,OAAO,EAAE;gBACL,kBAAkB;gBAClB,0BAA0B;gBAC1B,0BAA0B;gBAC1B,sBAAsB;gBACtB,qBAAqB;aACxB;SACJ,CAAC;OACW,eAAe,CAAG;IAAD,sBAAC;CAA/B;;AC1CA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-kit-components-slider.js","sources":["ng://@taiga-ui/kit/components/slider/slider-options.ts","ng://@taiga-ui/kit/components/slider/slider.component.ts","ng://@taiga-ui/kit/components/slider/helpers/slider-key-steps.directive.ts","ng://@taiga-ui/kit/components/slider/helpers/slider-readonly.directive.ts","ng://@taiga-ui/kit/components/slider/helpers/slider-thumb-label/slider-thumb-label.component.ts","ng://@taiga-ui/kit/components/slider/slider-old.component.ts","ng://@taiga-ui/kit/components/slider/slider.module.ts","ng://@taiga-ui/kit/components/slider/taiga-ui-kit-components-slider.ts"],"sourcesContent":["import {InjectionToken, ValueProvider} from '@angular/core';\nimport {TuiSizeS} from '@taiga-ui/core';\n\nexport interface TuiSliderOptions {\n readonly size: TuiSizeS;\n readonly trackColor: string;\n}\n\nexport const TUI_SLIDER_DEFAULT_OPTIONS: TuiSliderOptions = {\n size: 'm',\n trackColor: 'var(--tui-base-03)',\n};\n\nexport const TUI_SLIDER_OPTIONS = new InjectionToken<TuiSliderOptions>(\n 'Default parameters for Slider component',\n {factory: () => TUI_SLIDER_DEFAULT_OPTIONS},\n);\n\nexport function tuiSliderOptionsProvider(\n options: Partial<TuiSliderOptions>,\n): ValueProvider {\n return {\n provide: TUI_SLIDER_OPTIONS,\n useValue: {...TUI_SLIDER_DEFAULT_OPTIONS, ...options},\n };\n}\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n HostBinding,\n Inject,\n Input,\n Optional,\n Self,\n} from '@angular/core';\nimport {NgControl, NgModel} from '@angular/forms';\nimport {USER_AGENT} from '@ng-web-apis/common';\nimport {\n CHROMIUM_EDGE_START_VERSION,\n isEdgeOlderThan,\n tuiDefaultProp,\n watch,\n} from '@taiga-ui/cdk';\nimport {TuiSizeS} from '@taiga-ui/core';\nimport {take} from 'rxjs/operators';\n\nimport {TUI_SLIDER_OPTIONS, TuiSliderOptions} from './slider-options';\n\n@Component({\n /**\n * We have to call our component as `<input tuiSlider type=\"range\" ... />`\n * because otherwise built-in angular\n * {@link https://github.com/angular/angular/blob/master/packages/forms/src/directives/range_value_accessor.ts#L45 RangeValueAccessor}\n * cannot be matched by its CSS selector.\n */\n selector: 'input[type=range][tuiSlider]',\n template: ``,\n styleUrls: ['./slider.style.less'],\n host: {\n /**\n * For change detection.\n * Webkit does not have built-in method for customization of filling progress (as Firefox).\n * We draw filling of progress by `background: linear-gradient(...)` of the track.\n * This function triggers change detection (for {@link valuePercentage} function) when we drag thumb of the input.\n */\n '(input)': '0',\n '[style.--tui-slider-track-color]': 'options.trackColor',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiSliderComponent {\n @Input()\n @HostBinding('attr.data-size')\n @tuiDefaultProp()\n size: TuiSizeS = this.options.size;\n\n @Input()\n @tuiDefaultProp()\n segments = 1;\n\n get min(): number {\n return Number(this.elementRef.nativeElement.min);\n }\n\n get max(): number {\n return Number(this.elementRef.nativeElement.max || 100);\n }\n\n get step(): number {\n return Number(this.elementRef.nativeElement.step) || 1;\n }\n\n get value(): number {\n const {elementRef, control} = this;\n const noKeySteps = !elementRef.nativeElement.hasAttribute('data-key-steps');\n\n if (noKeySteps && control instanceof NgModel) {\n /**\n * If developer uses `[(ngModel)]` and programmatically change value,\n * the `elementRef.nativeElement.value` is equal to the previous value at this moment.\n */\n return control.viewModel;\n }\n\n return Number(elementRef.nativeElement.value) || 0;\n }\n\n set value(newValue: number) {\n this.elementRef.nativeElement.value = `${newValue}`;\n }\n\n @HostBinding('style.--tui-slider-fill-percentage.%')\n get valuePercentage(): number {\n return (100 * (this.value - this.min)) / (this.max - this.min) || 0;\n }\n\n @HostBinding('style.--tui-slider-segment-width.%')\n get segmentWidth(): number {\n return 100 / Math.max(1, this.segments);\n }\n\n @HostBinding('class._old-edge')\n get isOldEdge(): boolean {\n return isEdgeOlderThan(CHROMIUM_EDGE_START_VERSION, this.userAgent);\n }\n\n constructor(\n @Optional()\n @Self()\n @Inject(NgControl)\n private readonly control: NgControl | null,\n @Inject(ChangeDetectorRef) changeDetectorRef: ChangeDetectorRef,\n @Inject(TUI_SLIDER_OPTIONS) readonly options: TuiSliderOptions,\n @Inject(ElementRef) readonly elementRef: ElementRef<HTMLInputElement>,\n @Inject(USER_AGENT) private readonly userAgent: string,\n ) {\n if (control instanceof NgModel) {\n /**\n * The ValueAccessor.writeValue method is called twice on any value accessor during component initialization,\n * when a control is bound using [(ngModel)], first time with a phantom null value.\n * With `changeDetection: ChangeDetectionStrategy.OnPush` the second call of writeValue with real value don't re-render the view.\n * ___\n * See this {@link https://github.com/angular/angular/issues/14988 issue}\n */\n control.valueChanges?.pipe(watch(changeDetectorRef), take(1)).subscribe();\n }\n }\n}\n","import {\n ChangeDetectorRef,\n Directive,\n ElementRef,\n HostListener,\n Inject,\n Input,\n Optional,\n Output,\n Pipe,\n PipeTransform,\n Self,\n} from '@angular/core';\nimport {NgControl} from '@angular/forms';\nimport {\n AbstractTuiControl,\n clamp,\n isNativeFocused,\n tuiAssert,\n tuiDefaultProp,\n TuiFocusableElementAccessor,\n typedFromEvent,\n} from '@taiga-ui/cdk';\nimport {TuiKeySteps} from '@taiga-ui/kit/types';\nimport {\n tuiCheckKeyStepsHaveMinMaxPercents,\n tuiKeyStepValueToPercentage,\n tuiPercentageToKeyStepValue,\n} from '@taiga-ui/kit/utils';\nimport {map} from 'rxjs/operators';\n\nimport {TuiSliderComponent} from '../slider.component';\n\n// @dynamic\n@Directive({\n selector: 'input[tuiSlider][keySteps]',\n host: {\n '[attr.data-key-steps]': 'true',\n '[attr.aria-valuenow]': 'controlValue',\n '[attr.aria-valuemin]': 'min',\n '[attr.aria-valuemax]': 'max',\n },\n})\nexport class TuiSliderKeyStepsDirective\n extends AbstractTuiControl<number>\n implements TuiFocusableElementAccessor\n{\n @Input()\n @tuiDefaultProp(\n tuiCheckKeyStepsHaveMinMaxPercents,\n 'Should contain min and max values',\n )\n keySteps: TuiKeySteps = [];\n\n @Output()\n keyStepsInput = typedFromEvent(this.elementRef.nativeElement, 'input').pipe(\n map(() => this.controlValue),\n );\n\n get nativeFocusableElement(): HTMLInputElement | null {\n return this.computedDisabled ? null : this.elementRef.nativeElement;\n }\n\n get focused(): boolean {\n return isNativeFocused(this.nativeFocusableElement);\n }\n\n get min(): number {\n return this.keySteps[0]?.[1] || 0;\n }\n\n get max(): number {\n return this.keySteps[this.keySteps.length - 1]?.[1] || 100;\n }\n\n get controlValue(): number {\n return tuiPercentageToKeyStepValue(this.slider.valuePercentage, this.keySteps);\n }\n\n constructor(\n @Optional()\n @Self()\n @Inject(NgControl)\n control: NgControl | null,\n @Inject(ChangeDetectorRef) changeDetectorRef: ChangeDetectorRef,\n @Inject(ElementRef) private readonly elementRef: ElementRef<HTMLInputElement>,\n @Inject(TuiSliderComponent) private readonly slider: TuiSliderComponent,\n ) {\n super(control, changeDetectorRef);\n }\n\n @HostListener('change')\n updateControlValue(): void {\n this.updateValue(this.controlValue);\n }\n\n writeValue(controlValue: number | null): void {\n if (controlValue === null) {\n return;\n }\n\n const clampedControlValue = clamp(controlValue, this.min, this.max);\n\n tuiAssert.assert(\n controlValue === clampedControlValue,\n '\\n[SliderKeySteps]: You cannot programmatically set value which is less/more than min/max',\n );\n\n this.slider.value = this.transformToNativeValue(clampedControlValue);\n }\n\n protected getFallbackValue(): number {\n return 0;\n }\n\n private transformToNativeValue(controlValue: number): number {\n const {min, max} = this.slider;\n const newValuePercentage = tuiKeyStepValueToPercentage(\n controlValue,\n this.keySteps,\n );\n\n return (newValuePercentage * (max - min)) / 100 + min;\n }\n}\n\n/**\n * @deprecated DONT USE IT! It is just temporary solution for internal purposes only. We will delete it in next major release.\n * TODO delete it in v3.0\n *\n */\n@Pipe({name: 'tuiSliderTickLabel'})\nexport class TuiSliderTickLabelPipe implements PipeTransform {\n transform(tickIndex: number, totalSegments: number, keySteps: TuiKeySteps): number {\n const percentage = (100 / totalSegments) * tickIndex;\n\n return tuiPercentageToKeyStepValue(percentage, keySteps);\n }\n}\n","import {DOCUMENT} from '@angular/common';\nimport {Directive, ElementRef, HostListener, Inject, Input} from '@angular/core';\nimport {\n tuiCoerceBooleanProperty,\n tuiDefaultProp,\n TuiDestroyService,\n typedFromEvent,\n} from '@taiga-ui/cdk';\nimport {combineLatest, merge, Observable} from 'rxjs';\nimport {filter, mapTo, takeUntil, tap} from 'rxjs/operators';\n\nconst SLIDER_INTERACTION_KEYS = new Set([\n 'ArrowLeft',\n 'ArrowRight',\n 'ArrowUp',\n 'ArrowDown',\n 'Home',\n 'End',\n 'PageUp',\n 'PageDown',\n]);\n\n/**\n * Native <input type='range' readonly> doesn't work.\n * This directive imitates this native behaviour.\n */\n// @dynamic\n@Directive({\n selector: 'input[tuiSlider][readonly]',\n providers: [TuiDestroyService],\n})\nexport class TuiSliderReadonlyDirective {\n @Input()\n @tuiDefaultProp()\n readonly: string | boolean = true;\n\n constructor(\n @Inject(ElementRef) elementRef: ElementRef<HTMLInputElement>,\n @Inject(DOCUMENT) documentRef: Document,\n @Inject(TuiDestroyService)\n destroy$: Observable<unknown>,\n ) {\n const touchStart$ = typedFromEvent(elementRef.nativeElement, 'touchstart', {\n passive: false,\n });\n const touchMove$ = typedFromEvent(documentRef, 'touchmove', {\n passive: false,\n });\n const touchEnd$ = typedFromEvent(documentRef, 'touchend', {\n passive: true,\n });\n\n const shouldPreventMove$ = merge(\n touchStart$.pipe(\n tap(e => this.preventEvent(e)),\n mapTo(true),\n ),\n touchEnd$.pipe(mapTo(false)),\n );\n\n /**\n * @bad TODO think about another solution.\n * Keep in mind that preventing touch event (on slider) inside `@HostListener('touchstart')` doesn't work for mobile chrome.\n */\n combineLatest([touchMove$, shouldPreventMove$])\n .pipe(\n filter(([_, shouldPreventMove]) => shouldPreventMove),\n takeUntil(destroy$),\n )\n .subscribe(([moveEvent]) => this.preventEvent(moveEvent));\n }\n\n @HostListener('mousedown', ['$event'])\n preventEvent(event: Event): void {\n if (event.cancelable && tuiCoerceBooleanProperty(this.readonly)) {\n event.preventDefault();\n }\n }\n\n @HostListener('keydown', ['$event'])\n preventKeyboardInteraction(event: KeyboardEvent): void {\n if (SLIDER_INTERACTION_KEYS.has(event.key)) {\n this.preventEvent(event);\n }\n }\n}\n","import {\n AfterContentInit,\n ChangeDetectionStrategy,\n Component,\n ContentChild,\n} from '@angular/core';\nimport {NgControl} from '@angular/forms';\nimport {tuiAssert} from '@taiga-ui/cdk';\nimport {TuiSizeS} from '@taiga-ui/core';\n\nimport {TuiSliderComponent} from '../../slider.component';\n\n@Component({\n selector: '[tuiSliderThumbLabel]',\n templateUrl: './slider-thumb-label.template.html',\n styleUrls: ['./slider-thumb-label.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiSliderThumbLabelComponent implements AfterContentInit {\n @ContentChild(TuiSliderComponent)\n readonly slider?: TuiSliderComponent;\n\n @ContentChild(NgControl)\n readonly control?: NgControl;\n\n get size(): TuiSizeS {\n return this.slider?.size || 'm';\n }\n\n get ratio(): number {\n return (this.slider?.valuePercentage || 0) / 100;\n }\n\n get ghostLeft(): number {\n return this.ratio * (this.slider?.elementRef.nativeElement.offsetWidth || 0);\n }\n\n ngAfterContentInit(): void {\n tuiAssert.assert(\n Boolean(this.control?.valueChanges),\n `\\n[tuiSliderThumbLabel] expected <input tuiSlider type=\"range\" /> to use Angular Forms.\\n` +\n 'Use [(ngModel)] or [formControl] or formControlName for correct work.',\n );\n }\n}\n","import {DOCUMENT} from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n forwardRef,\n Inject,\n Optional,\n Self,\n} from '@angular/core';\nimport {NgControl} from '@angular/forms';\nimport {\n isNativeFocused,\n TUI_FOCUSABLE_ITEM_ACCESSOR,\n TuiFocusableElementAccessor,\n TuiNativeFocusableElement,\n} from '@taiga-ui/cdk';\nimport {AbstractTuiSlider} from '@taiga-ui/kit/abstract';\nimport {TUI_FROM_TO_TEXTS} from '@taiga-ui/kit/tokens';\nimport {Observable} from 'rxjs';\n\n/**\n * @deprecated use {@link TuiSliderComponent} instead\n * TODO: 3.0 remove\n */\n// @dynamic\n@Component({\n selector: 'tui-slider',\n templateUrl: '../../abstract/slider/slider.common.template.html',\n styleUrls: [\n '../../abstract/slider/slider.common.style.less',\n './slider-old.style.less',\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: TUI_FOCUSABLE_ITEM_ACCESSOR,\n useExisting: forwardRef(() => TuiSliderOldComponent),\n },\n ],\n})\nexport class TuiSliderOldComponent\n extends AbstractTuiSlider<number>\n implements TuiFocusableElementAccessor\n{\n constructor(\n @Optional()\n @Self()\n @Inject(NgControl)\n control: NgControl | null,\n @Inject(ChangeDetectorRef) changeDetectorRef: ChangeDetectorRef,\n @Inject(DOCUMENT) documentRef: Document,\n @Inject(TUI_FROM_TO_TEXTS) fromToTexts$: Observable<[string, string]>,\n ) {\n super(control, changeDetectorRef, documentRef, fromToTexts$);\n }\n\n get nativeFocusableElement(): TuiNativeFocusableElement | null {\n return this.dotRight ? this.dotRight.nativeElement : null;\n }\n\n get focused(): boolean {\n return isNativeFocused(this.nativeFocusableElement);\n }\n\n get left(): number {\n return 0;\n }\n\n get right(): number {\n return 100 - 100 * this.getFractionFromValue(this.value);\n }\n\n processValue(value: number): void {\n this.updateValue(this.valueGuard(value));\n }\n\n decrement(): void {\n this.processStep(false);\n }\n\n increment(): void {\n this.processStep(true);\n }\n\n protected getFallbackValue(): number {\n return 0;\n }\n\n protected processStep(increment: boolean): void {\n const fraction = this.getFractionFromValue(this.value);\n const step = this.computedStep;\n const value = this.getValueFromFraction(\n increment ? fraction + step : fraction - step,\n );\n\n this.processValue(value);\n }\n}\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {\n TuiActiveZoneModule,\n TuiFocusableModule,\n TuiFocusVisibleModule,\n TuiRepeatTimesModule,\n} from '@taiga-ui/cdk';\nimport {TuiFormatNumberPipeModule} from '@taiga-ui/core';\n\nimport {\n TuiSliderKeyStepsDirective,\n TuiSliderTickLabelPipe,\n} from './helpers/slider-key-steps.directive';\nimport {TuiSliderReadonlyDirective} from './helpers/slider-readonly.directive';\nimport {TuiSliderThumbLabelComponent} from './helpers/slider-thumb-label/slider-thumb-label.component';\nimport {TuiSliderComponent} from './slider.component';\nimport {TuiSliderOldComponent} from './slider-old.component';\n\n@NgModule({\n imports: [\n CommonModule,\n TuiRepeatTimesModule,\n TuiFocusableModule,\n TuiFocusVisibleModule,\n TuiActiveZoneModule,\n TuiFormatNumberPipeModule,\n ],\n declarations: [\n TuiSliderComponent,\n TuiSliderThumbLabelComponent,\n TuiSliderKeyStepsDirective,\n TuiSliderReadonlyDirective,\n TuiSliderTickLabelPipe,\n TuiSliderOldComponent,\n ],\n exports: [\n TuiSliderComponent,\n TuiSliderThumbLabelComponent,\n TuiSliderKeyStepsDirective,\n TuiSliderReadonlyDirective,\n TuiSliderTickLabelPipe,\n TuiSliderOldComponent,\n ],\n})\nexport class TuiSliderModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;IAQa,0BAA0B,GAAqB;IACxD,IAAI,EAAE,GAAG;IACT,UAAU,EAAE,oBAAoB;EAClC;IAEW,kBAAkB,GAAG,IAAI,cAAc,CAChD,yCAAyC,EACzC,EAAC,OAAO,EAAE,cAAM,OAAA,0BAA0B,GAAA,EAAC,EAC7C;SAEc,wBAAwB,CACpC,OAAkC;IAElC,OAAO;QACH,OAAO,EAAE,kBAAkB;QAC3B,QAAQ,wBAAM,0BAA0B,GAAK,OAAO,CAAC;KACxD,CAAC;AACN;;;IC6EI,4BAIqB,OAAyB,EACf,iBAAoC,EAC1B,OAAyB,EACjC,UAAwC,EAChC,SAAiB;;QAJrC,YAAO,GAAP,OAAO,CAAkB;QAEL,YAAO,GAAP,OAAO,CAAkB;QACjC,eAAU,GAAV,UAAU,CAA8B;QAChC,cAAS,GAAT,SAAS,CAAQ;QA5D1D,SAAI,GAAa,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;QAInC,aAAQ,GAAG,CAAC,CAAC;QA0DT,IAAI,OAAO,YAAY,OAAO,EAAE;;;;;;;;YAQ5B,MAAA,OAAO,CAAC,YAAY,0CAAE,IAAI,CAAC,KAAK,CAAC,iBAAi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,uBAAuB,CAAC,MAAM;YAC/C,SAAS,EAAE;gBACP;oBACI,OAAO,EAAE,2BAA2B;oBACpC,WAAW,EAAE,UAAU,CAAC,cAAM,OAAA,uBAAqB,GAAA,CAAC;iBACvD;aACJ;;SACJ,CAAC;QAMO,WAAA,QAAQ,EAAE,CAAA;QACV,WAAA,IAAI,EAAE,CAAA;QACN,WAAA,MAAM,CAAC,SAAS,CAAC,CAAA;QAEjB,WAAA,MAAM,CAAC,iBAAiB,CAAC,CAAA;QACzB,WAAA,MAAM,CAAC,QAAQ,CAAC,CAAA;QAChB,WAAA,MAAM,CAAC,iBAAiB,CAAC,CAAA;OAXrB,qBAAqB,CAyDjC;IAAD,4BAAC;CAAA,CAxDW,iBAAiB;;;ICG7B;KAA+B;IAAlB,eAAe;QA1B3B,QAAQ,CAAC;YACN,OAAO,EAAE;gBACL,YAAY;gBACZ,oBAAoB;gBACpB,kBAAkB;gBAClB,qBAAqB;gBACrB,mBAAmB;gBACnB,yBAAyB;aAC5B;YACD,YAAY,EAAE;gBACV,kBAAkB;gBAClB,4BAA4B;gBAC5B,0BAA0B;gBAC1B,0BAA0B;gBAC1B,sBAAsB;gBACtB,qBAAqB;aACxB;YACD,OAAO,EAAE;gBACL,kBAAkB;gBAClB,4BAA4B;gBAC5B,0BAA0B;gBAC1B,0BAA0B;gBAC1B,sBAAsB;gBACtB,qBAAqB;aACxB;SACJ,CAAC;OACW,eAAe,CAAG;IAAD,sBAAC;CAA/B;;AC7CA;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __param, __assign } from 'tslib';
|
|
2
2
|
import { TemplateRef, Inject, Directive, InjectionToken, ElementRef, Optional, HostBinding, Component, ChangeDetectionStrategy, EventEmitter, Renderer2, ChangeDetectorRef, ContentChildren, forwardRef, Input, Output, HostListener, ViewChild, NgZone, NgModule } from '@angular/core';
|
|
3
3
|
import { RouterLinkActive } from '@angular/router';
|
|
4
|
-
import { TuiDestroyService, TuiFocusVisibleService, typedFromEvent, tuiCustomEvent, isNativeFocused, setNativeFocused, TUI_IS_IOS, TUI_IS_ANDROID, EMPTY_QUERY, moveFocus, TuiResizeService, tuiDefaultProp, tuiAssertIsHTMLElement, getClosestFocusable, toInt, tuiZonefree, px, TuiFocusableModule } from '@taiga-ui/cdk';
|
|
4
|
+
import { TuiDestroyService, TuiFocusVisibleService, typedFromEvent, tuiCustomEvent, isNativeFocused, setNativeFocused, TUI_IS_IOS, TUI_IS_ANDROID, EMPTY_QUERY, moveFocus, TuiResizeService, tuiDefaultProp, tuiClamp, tuiAssertIsHTMLElement, getClosestFocusable, toInt, tuiZonefree, px, TuiFocusableModule } from '@taiga-ui/cdk';
|
|
5
5
|
import { TuiRouterLinkActiveService, MODE_PROVIDER, TUI_MODE, TuiHostedDropdownModule, TuiSvgModule } from '@taiga-ui/core';
|
|
6
6
|
import { TUI_TAB_MARGIN, TUI_MOBILE_AWARE, TUI_MORE_WORD } from '@taiga-ui/kit/tokens';
|
|
7
7
|
import { EMPTY, merge, identity, Observable, ReplaySubject, of } from 'rxjs';
|
|
@@ -119,7 +119,7 @@ var TuiTabComponent = /** @class */ (function () {
|
|
|
119
119
|
'[style.--tui-tab-margin.px]': 'margin',
|
|
120
120
|
type: 'button',
|
|
121
121
|
},
|
|
122
|
-
styles: [":host-context(._underline):hover{box-shadow:inset 0 -2px var(--tui-base-03)}:host-context([tuiTabs]>):first-child,:host-context([tuiTabs]>:first-child),:host-context(tui-tabs>):first-child,:host-context(tui-tabs>:first-child){margin-left:0}:host{transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:0;border:0;background:0 0;font-size:inherit;line-height:inherit;position:relative;display:flex;flex-shrink:0;height:100%;box-sizing:border-box;justify-content:space-between;align-items:center;white-space:nowrap;cursor:pointer;outline:0;text-decoration:none;color:inherit;transition-property:color,box-shadow,opacity;margin-left:var(--tui-tab-margin,1.5rem)}:host:
|
|
122
|
+
styles: [":host-context(._underline):hover{box-shadow:inset 0 -2px var(--tui-base-03)}:host-context([tuiTabs]>):first-child,:host-context([tuiTabs]>:first-child),:host-context(tui-tabs>):first-child,:host-context(tui-tabs>:first-child){margin-left:0}:host{transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:0;border:0;background:0 0;font-size:inherit;line-height:inherit;position:relative;display:flex;flex-shrink:0;height:100%;box-sizing:border-box;justify-content:space-between;align-items:center;white-space:nowrap;cursor:pointer;outline:0;text-decoration:none;color:inherit;transition-property:color,box-shadow,opacity;margin-left:var(--tui-tab-margin,1.5rem)}:host:disabled{opacity:var(--tui-disabled-opacity);pointer-events:none}:host:not([data-mode])._active{opacity:1;color:var(--tui-text-01);box-shadow:none}:host[data-mode=onDark]{color:rgba(255,255,255,.72)}:host[data-mode=onDark]._active,:host[data-mode=onDark]:hover{color:#fff}:host[data-mode=onDark]._focus-visible .t-highlight{background:var(--tui-clear-inverse);color:var(--tui-text-01)}:host[data-mode=onLight]{color:var(--tui-text-02)}:host[data-mode=onLight]._active,:host[data-mode=onLight]:hover{color:var(--tui-text-01)}:host[data-mode=onLight]._focus-visible .t-highlight{background:var(--tui-text-01);color:#fff}:host._focus-visible .t-highlight{background:var(--tui-selection)}:host._android{transition-property:opacity;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;height:3rem;flex:1;flex-shrink:0;justify-content:center;margin:0;text-transform:uppercase;color:var(--tui-base-09);opacity:.5;font-size:.875rem;font-weight:500;letter-spacing:-.008125rem;font-family:-apple-system,BlinkMacSystemFont,Roboto,'Helvetica Neue',sans-serif}:host._android:hover{box-shadow:none}:host._android._active{opacity:1;color:var(--tui-base-09)}:host._android .t-highlight{width:auto}:host._ios{height:1.75rem;flex:1;flex-shrink:0;justify-content:center;margin:0;color:var(--tui-base-01);opacity:1;font-size:.8125rem;font-weight:500;letter-spacing:-.005rem;font-family:-apple-system,BlinkMacSystemFont,Roboto,'Helvetica Neue',sans-serif}:host._ios:hover{box-shadow:none}:host._ios._active{font-size:.875rem;font-weight:600;color:var(--tui-link)}:host._ios .t-highlight{width:auto}@media (hover:hover){:host:hover{color:var(--tui-text-01)}}.t-highlight{display:inline-flex;width:100%;align-items:center;justify-content:inherit}.t-highlight ::ng-deep>*{flex-shrink:0}"]
|
|
123
123
|
}),
|
|
124
124
|
__param(0, Optional()),
|
|
125
125
|
__param(0, Inject(RouterLinkActive)),
|
|
@@ -363,8 +363,10 @@ var TuiTabsWithMoreComponent = /** @class */ (function () {
|
|
|
363
363
|
Object.defineProperty(TuiTabsWithMoreComponent.prototype, "activeElement", {
|
|
364
364
|
get: function () {
|
|
365
365
|
var _a;
|
|
366
|
-
|
|
367
|
-
|
|
366
|
+
var tabs = this.tabs;
|
|
367
|
+
var safeActiveIndex = tuiClamp(this.activeItemIndex || 0, 0, tabs.length - 2);
|
|
368
|
+
return this.options.exposeActive || this.lastVisibleIndex >= safeActiveIndex
|
|
369
|
+
? tabs[safeActiveIndex] || null
|
|
368
370
|
: ((_a = this.moreButton) === null || _a === void 0 ? void 0 : _a.nativeElement) || null;
|
|
369
371
|
},
|
|
370
372
|
enumerable: true,
|