@taiga-ui/kit 2.34.0 → 2.35.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-calendar-month.umd.js +2 -2
- package/bundles/taiga-ui-kit-components-calendar-month.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-calendar-month.umd.min.js +2 -2
- package/bundles/taiga-ui-kit-components-calendar-month.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-month-range.umd.js +64 -41
- 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 +2 -2
- package/bundles/taiga-ui-kit-components-input-month-range.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-month.umd.js +57 -32
- package/bundles/taiga-ui-kit-components-input-month.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-month.umd.min.js +2 -2
- package/bundles/taiga-ui-kit-components-input-month.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-number.umd.js +8 -2
- package/bundles/taiga-ui-kit-components-input-number.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-number.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-input-number.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-phone.umd.js +8 -2
- package/bundles/taiga-ui-kit-components-input-phone.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-phone.umd.min.js +2 -2
- package/bundles/taiga-ui-kit-components-input-phone.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-tag.umd.js +15 -8
- package/bundles/taiga-ui-kit-components-input-tag.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-tag.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-input-tag.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-line-clamp.umd.js +24 -14
- 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-multi-select.umd.js +21 -7
- package/bundles/taiga-ui-kit-components-multi-select.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-multi-select.umd.min.js +2 -2
- package/bundles/taiga-ui-kit-components-multi-select.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-progress.umd.js +140 -73
- package/bundles/taiga-ui-kit-components-progress.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-progress.umd.min.js +2 -2
- package/bundles/taiga-ui-kit-components-progress.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-slider.umd.js +37 -24
- package/bundles/taiga-ui-kit-components-slider.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-slider.umd.min.js +2 -2
- package/bundles/taiga-ui-kit-components-slider.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-text-area.umd.js +1 -1
- package/bundles/taiga-ui-kit-components-text-area.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-text-area.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-directives-lazy-loading.umd.js +1 -1
- package/bundles/taiga-ui-kit-directives-lazy-loading.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-pipes-field-error.umd.js +38 -6
- package/bundles/taiga-ui-kit-pipes-field-error.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-pipes-field-error.umd.min.js +2 -2
- package/bundles/taiga-ui-kit-pipes-field-error.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-providers.umd.js +29 -12
- package/bundles/taiga-ui-kit-providers.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-providers.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-providers.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-tokens.umd.js +3 -0
- package/bundles/taiga-ui-kit-tokens.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-tokens.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-tokens.umd.min.js.map +1 -1
- package/components/calendar-month/taiga-ui-kit-components-calendar-month.metadata.json +1 -1
- package/components/input-month/index.d.ts +1 -0
- package/components/input-month/input-month.component.d.ts +6 -4
- package/components/input-month/input-month.directive.d.ts +8 -1
- package/components/input-month/input-month.providers.d.ts +2 -0
- package/components/input-month/taiga-ui-kit-components-input-month.metadata.json +1 -1
- package/components/input-month-range/index.d.ts +1 -0
- package/components/input-month-range/input-month-range.component.d.ts +6 -7
- package/components/input-month-range/input-month-range.directive.d.ts +8 -1
- package/components/input-month-range/input-month-range.providers.d.ts +2 -0
- package/components/input-month-range/taiga-ui-kit-components-input-month-range.metadata.json +1 -1
- package/components/input-number/input-number.directive.d.ts +4 -1
- package/components/input-number/taiga-ui-kit-components-input-number.metadata.json +1 -1
- package/components/input-phone/input-phone.directive.d.ts +4 -1
- package/components/input-phone/taiga-ui-kit-components-input-phone.metadata.json +1 -1
- package/components/input-tag/input-tag.component.d.ts +4 -3
- package/components/input-tag/taiga-ui-kit-components-input-tag.metadata.json +1 -1
- package/components/line-clamp/line-clamp.component.d.ts +7 -3
- package/components/line-clamp/taiga-ui-kit-components-line-clamp.metadata.json +1 -1
- package/components/multi-select/hide-selected.pipe.d.ts +1 -1
- package/components/multi-select/multi-select.component.d.ts +4 -2
- package/components/multi-select/taiga-ui-kit-components-multi-select.metadata.json +1 -1
- package/components/progress/index.d.ts +4 -3
- package/components/progress/progress-bar/progress-color-segments.directive.d.ts +11 -0
- package/components/progress/taiga-ui-kit-components-progress.metadata.json +1 -1
- package/components/progress/{pipes → utils}/abstract-color-segments.d.ts +0 -0
- package/components/progress/utils/calculate-color-segments.d.ts +5 -0
- package/components/progress/{pipes → utils}/progress-color-segments-async.pipe.d.ts +5 -0
- package/components/progress/utils/progress-color-segments.pipe.d.ts +9 -0
- package/components/slider/slider.component.d.ts +5 -6
- package/components/slider/taiga-ui-kit-components-slider.metadata.json +1 -1
- package/components/text-area/taiga-ui-kit-components-text-area.metadata.json +1 -1
- package/directives/lazy-loading/index.d.ts +1 -0
- package/directives/lazy-loading/taiga-ui-kit-directives-lazy-loading.d.ts +0 -1
- package/directives/lazy-loading/taiga-ui-kit-directives-lazy-loading.metadata.json +1 -1
- package/esm2015/components/calendar-month/calendar-month.component.js +3 -3
- package/esm2015/components/input-month/index.js +2 -1
- package/esm2015/components/input-month/input-month.component.js +19 -25
- package/esm2015/components/input-month/input-month.directive.js +32 -7
- package/esm2015/components/input-month/input-month.module.js +4 -4
- package/esm2015/components/input-month/input-month.providers.js +19 -0
- package/esm2015/components/input-month-range/index.js +2 -1
- package/esm2015/components/input-month-range/input-month-range.component.js +21 -37
- package/esm2015/components/input-month-range/input-month-range.directive.js +37 -7
- package/esm2015/components/input-month-range/input-month-range.module.js +3 -2
- package/esm2015/components/input-month-range/input-month-range.providers.js +19 -0
- package/esm2015/components/input-number/input-number.directive.js +9 -3
- package/esm2015/components/input-phone/input-phone.directive.js +9 -3
- package/esm2015/components/input-tag/input-tag.component.js +16 -9
- package/esm2015/components/line-clamp/line-clamp.component.js +25 -15
- package/esm2015/components/multi-select/hide-selected.pipe.js +4 -3
- package/esm2015/components/multi-select/multi-select.component.js +16 -6
- package/esm2015/components/progress/index.js +5 -4
- package/esm2015/components/progress/progress-bar/progress-color-segments.directive.js +48 -0
- package/esm2015/components/progress/progress.module.js +6 -3
- package/esm2015/components/progress/utils/abstract-color-segments.js +32 -0
- package/esm2015/components/progress/utils/calculate-color-segments.js +10 -0
- package/esm2015/components/progress/utils/progress-color-segments-async.pipe.js +21 -0
- package/esm2015/components/progress/utils/progress-color-segments.pipe.js +19 -0
- package/esm2015/components/slider/slider.component.js +34 -20
- package/esm2015/components/text-area/text-area.component.js +1 -1
- package/esm2015/directives/lazy-loading/index.js +2 -1
- package/esm2015/directives/lazy-loading/taiga-ui-kit-directives-lazy-loading.js +1 -2
- package/esm2015/pipes/field-error/field-error-content-pipe.js +35 -0
- package/esm2015/pipes/field-error/field-error.module.js +4 -3
- package/esm2015/pipes/field-error/index.js +2 -1
- package/esm2015/providers/index.js +2 -1
- package/esm2015/providers/month-formatter.provider.js +17 -0
- package/esm2015/providers/value-accessor.provider.js +2 -2
- package/esm2015/tokens/index.js +2 -1
- package/esm2015/tokens/month-formatter.js +3 -0
- package/esm5/components/calendar-month/calendar-month.component.js +3 -3
- package/esm5/components/input-month/index.js +2 -1
- package/esm5/components/input-month/input-month.component.js +18 -25
- package/esm5/components/input-month/input-month.directive.js +32 -9
- package/esm5/components/input-month/input-month.module.js +4 -4
- package/esm5/components/input-month/input-month.providers.js +19 -0
- package/esm5/components/input-month-range/index.js +2 -1
- package/esm5/components/input-month-range/input-month-range.component.js +20 -38
- package/esm5/components/input-month-range/input-month-range.directive.js +38 -8
- package/esm5/components/input-month-range/input-month-range.module.js +3 -2
- package/esm5/components/input-month-range/input-month-range.providers.js +19 -0
- package/esm5/components/input-number/input-number.directive.js +9 -3
- package/esm5/components/input-phone/input-phone.directive.js +9 -3
- package/esm5/components/input-tag/input-tag.component.js +16 -9
- package/esm5/components/line-clamp/line-clamp.component.js +26 -16
- package/esm5/components/multi-select/hide-selected.pipe.js +4 -4
- package/esm5/components/multi-select/multi-select.component.js +20 -6
- package/esm5/components/progress/index.js +5 -4
- package/esm5/components/progress/progress-bar/progress-color-segments.directive.js +56 -0
- package/esm5/components/progress/progress.module.js +6 -3
- package/esm5/components/progress/utils/abstract-color-segments.js +33 -0
- package/esm5/components/progress/utils/calculate-color-segments.js +12 -0
- package/esm5/components/progress/utils/progress-color-segments-async.pipe.js +27 -0
- package/esm5/components/progress/utils/progress-color-segments.pipe.js +24 -0
- package/esm5/components/slider/slider.component.js +37 -23
- package/esm5/components/text-area/text-area.component.js +1 -1
- package/esm5/directives/lazy-loading/index.js +2 -1
- package/esm5/directives/lazy-loading/taiga-ui-kit-directives-lazy-loading.js +1 -2
- package/esm5/pipes/field-error/field-error-content-pipe.js +36 -0
- package/esm5/pipes/field-error/field-error.module.js +4 -3
- package/esm5/pipes/field-error/index.js +2 -1
- package/esm5/providers/index.js +2 -1
- package/esm5/providers/month-formatter.provider.js +19 -0
- package/esm5/providers/value-accessor.provider.js +2 -2
- package/esm5/tokens/index.js +2 -1
- package/esm5/tokens/month-formatter.js +3 -0
- package/fesm2015/taiga-ui-kit-components-calendar-month.js +2 -2
- package/fesm2015/taiga-ui-kit-components-calendar-month.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-input-month-range.js +67 -41
- package/fesm2015/taiga-ui-kit-components-input-month-range.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-input-month.js +61 -31
- package/fesm2015/taiga-ui-kit-components-input-month.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-input-number.js +8 -2
- package/fesm2015/taiga-ui-kit-components-input-number.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-input-phone.js +8 -2
- package/fesm2015/taiga-ui-kit-components-input-phone.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-input-tag.js +15 -8
- package/fesm2015/taiga-ui-kit-components-input-tag.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-line-clamp.js +24 -14
- package/fesm2015/taiga-ui-kit-components-line-clamp.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-multi-select.js +18 -7
- package/fesm2015/taiga-ui-kit-components-multi-select.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-progress.js +113 -55
- package/fesm2015/taiga-ui-kit-components-progress.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-slider.js +33 -19
- package/fesm2015/taiga-ui-kit-components-slider.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-text-area.js +1 -1
- package/fesm2015/taiga-ui-kit-directives-lazy-loading.js +1 -1
- package/fesm2015/taiga-ui-kit-directives-lazy-loading.js.map +1 -1
- package/fesm2015/taiga-ui-kit-pipes-field-error.js +35 -4
- package/fesm2015/taiga-ui-kit-pipes-field-error.js.map +1 -1
- package/fesm2015/taiga-ui-kit-providers.js +18 -4
- package/fesm2015/taiga-ui-kit-providers.js.map +1 -1
- package/fesm2015/taiga-ui-kit-tokens.js +3 -1
- package/fesm2015/taiga-ui-kit-tokens.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-calendar-month.js +2 -2
- package/fesm5/taiga-ui-kit-components-calendar-month.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-input-month-range.js +68 -44
- package/fesm5/taiga-ui-kit-components-input-month-range.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-input-month.js +60 -33
- package/fesm5/taiga-ui-kit-components-input-month.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-input-number.js +8 -2
- package/fesm5/taiga-ui-kit-components-input-number.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-input-phone.js +8 -2
- package/fesm5/taiga-ui-kit-components-input-phone.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-input-tag.js +15 -8
- package/fesm5/taiga-ui-kit-components-input-tag.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-line-clamp.js +25 -15
- package/fesm5/taiga-ui-kit-components-line-clamp.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-multi-select.js +22 -8
- package/fesm5/taiga-ui-kit-components-multi-select.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-progress.js +135 -69
- package/fesm5/taiga-ui-kit-components-progress.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-slider.js +36 -22
- package/fesm5/taiga-ui-kit-components-slider.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-text-area.js +1 -1
- package/fesm5/taiga-ui-kit-directives-lazy-loading.js +1 -1
- package/fesm5/taiga-ui-kit-directives-lazy-loading.js.map +1 -1
- package/fesm5/taiga-ui-kit-pipes-field-error.js +36 -4
- package/fesm5/taiga-ui-kit-pipes-field-error.js.map +1 -1
- package/fesm5/taiga-ui-kit-providers.js +20 -4
- package/fesm5/taiga-ui-kit-providers.js.map +1 -1
- package/fesm5/taiga-ui-kit-tokens.js +3 -1
- package/fesm5/taiga-ui-kit-tokens.js.map +1 -1
- package/package.json +4 -4
- package/pipes/field-error/field-error-content-pipe.d.ts +11 -0
- package/pipes/field-error/index.d.ts +1 -0
- package/pipes/field-error/taiga-ui-kit-pipes-field-error.metadata.json +1 -1
- package/providers/index.d.ts +1 -0
- package/providers/month-formatter.provider.d.ts +6 -0
- package/providers/taiga-ui-kit-providers.metadata.json +1 -1
- package/tokens/index.d.ts +1 -0
- package/tokens/month-formatter.d.ts +4 -0
- package/tokens/taiga-ui-kit-tokens.metadata.json +1 -1
- package/components/progress/pipes/progress-color-segments.pipe.d.ts +0 -9
- package/esm2015/components/progress/pipes/abstract-color-segments.js +0 -32
- package/esm2015/components/progress/pipes/progress-color-segments-async.pipe.js +0 -15
- package/esm2015/components/progress/pipes/progress-color-segments.pipe.js +0 -18
- package/esm5/components/progress/pipes/abstract-color-segments.js +0 -35
- package/esm5/components/progress/pipes/progress-color-segments-async.pipe.js +0 -21
- package/esm5/components/progress/pipes/progress-color-segments.pipe.js +0 -23
|
@@ -1,60 +1,10 @@
|
|
|
1
1
|
import { __decorate, __param } from 'tslib';
|
|
2
|
-
import {
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { Input, HostBinding, Component, ChangeDetectionStrategy, ElementRef, Inject, Directive, ViewChild, Injectable, Pipe, NgModule } from '@angular/core';
|
|
4
|
+
import { tuiDefaultProp, isEdgeOlderThan, CHROMIUM_EDGE_START_VERSION, isIE, TuiResizeService, tuiPure, TuiDestroyService, TuiRepeatTimesModule } from '@taiga-ui/cdk';
|
|
3
5
|
import { USER_AGENT, WINDOW } from '@ng-web-apis/common';
|
|
4
|
-
import {
|
|
5
|
-
import { timer } from 'rxjs';
|
|
6
|
+
import { Observable, timer } from 'rxjs';
|
|
6
7
|
import { map } from 'rxjs/operators';
|
|
7
|
-
import { CommonModule } from '@angular/common';
|
|
8
|
-
|
|
9
|
-
let AbstractTuiColorSegments = class AbstractTuiColorSegments {
|
|
10
|
-
constructor(userAgent, elementRef) {
|
|
11
|
-
this.userAgent = userAgent;
|
|
12
|
-
this.elementRef = elementRef;
|
|
13
|
-
this.isOldBrowsers = isEdgeOlderThan(CHROMIUM_EDGE_START_VERSION, this.userAgent) ||
|
|
14
|
-
isIE(this.userAgent);
|
|
15
|
-
}
|
|
16
|
-
calculate(colors) {
|
|
17
|
-
if (this.isOldBrowsers) {
|
|
18
|
-
return colors[0];
|
|
19
|
-
}
|
|
20
|
-
const elementWidth = this.elementRef.nativeElement.offsetWidth;
|
|
21
|
-
const segmentWidth = Math.ceil(elementWidth / colors.length);
|
|
22
|
-
const colorsString = colors.reduce((acc, color, i) => `${acc}, ${color} ${i * segmentWidth}px ${(i + 1) * segmentWidth}px`, '');
|
|
23
|
-
return `linear-gradient(to right ${colorsString})`;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
AbstractTuiColorSegments.ctorParameters = () => [
|
|
27
|
-
{ type: String, decorators: [{ type: Inject, args: [USER_AGENT,] }] },
|
|
28
|
-
{ type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] }
|
|
29
|
-
];
|
|
30
|
-
AbstractTuiColorSegments = __decorate([
|
|
31
|
-
Injectable(),
|
|
32
|
-
__param(0, Inject(USER_AGENT)),
|
|
33
|
-
__param(1, Inject(ElementRef))
|
|
34
|
-
], AbstractTuiColorSegments);
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @deprecated use tuiProgressColorSegmentsAsync instead
|
|
38
|
-
* {@link TuiProgressColorSegmentsAsyncPipe}
|
|
39
|
-
* example: `<progress [color]="colors | tuiProgressColorSegmentsAsync | async">`
|
|
40
|
-
*/
|
|
41
|
-
let TuiProgressColorSegmentsPipe = class TuiProgressColorSegmentsPipe extends AbstractTuiColorSegments {
|
|
42
|
-
transform(colors) {
|
|
43
|
-
return this.calculate(colors);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
TuiProgressColorSegmentsPipe = __decorate([
|
|
47
|
-
Pipe({ name: 'tuiProgressColorSegments' })
|
|
48
|
-
], TuiProgressColorSegmentsPipe);
|
|
49
|
-
|
|
50
|
-
let TuiProgressColorSegmentsAsyncPipe = class TuiProgressColorSegmentsAsyncPipe extends AbstractTuiColorSegments {
|
|
51
|
-
transform(colors) {
|
|
52
|
-
return timer(0).pipe(map(() => this.calculate(colors)));
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
TuiProgressColorSegmentsAsyncPipe = __decorate([
|
|
56
|
-
Pipe({ name: 'tuiProgressColorSegmentsAsync' })
|
|
57
|
-
], TuiProgressColorSegmentsAsyncPipe);
|
|
58
8
|
|
|
59
9
|
let TuiProgressBarComponent = class TuiProgressBarComponent {
|
|
60
10
|
constructor() {
|
|
@@ -79,6 +29,56 @@ TuiProgressBarComponent = __decorate([
|
|
|
79
29
|
})
|
|
80
30
|
], TuiProgressBarComponent);
|
|
81
31
|
|
|
32
|
+
/**
|
|
33
|
+
* TODO in v3.0 move inside {@link TuiProgressColorSegmentsDirective} (as a private method)
|
|
34
|
+
* (after deletion of {@link TuiProgressColorSegmentsPipe} and {@link TuiProgressColorSegmentsAsyncPipe})
|
|
35
|
+
*/
|
|
36
|
+
const calculateColorSegments = (colors, progressWidth) => {
|
|
37
|
+
const segmentWidth = Math.ceil(progressWidth / colors.length);
|
|
38
|
+
const colorsString = colors.reduce((acc, color, i) => `${acc}, ${color} ${i * segmentWidth}px ${(i + 1) * segmentWidth}px`, '');
|
|
39
|
+
return `linear-gradient(to right ${colorsString})`;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
let TuiProgressColorSegmentsDirective = class TuiProgressColorSegmentsDirective {
|
|
43
|
+
constructor(elementRef, resize$, userAgent) {
|
|
44
|
+
this.elementRef = elementRef;
|
|
45
|
+
this.resize$ = resize$;
|
|
46
|
+
this.userAgent = userAgent;
|
|
47
|
+
this.isOldBrowsers = isEdgeOlderThan(CHROMIUM_EDGE_START_VERSION, this.userAgent) ||
|
|
48
|
+
isIE(this.userAgent);
|
|
49
|
+
this.colors = [];
|
|
50
|
+
}
|
|
51
|
+
get calcSegments$() {
|
|
52
|
+
return this.resize$.pipe(map(() => this.isOldBrowsers
|
|
53
|
+
? this.colors[0]
|
|
54
|
+
: calculateColorSegments(this.colors, this.elementRef.nativeElement.offsetWidth)));
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
TuiProgressColorSegmentsDirective.ctorParameters = () => [
|
|
58
|
+
{ type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] },
|
|
59
|
+
{ type: Observable, decorators: [{ type: Inject, args: [TuiResizeService,] }] },
|
|
60
|
+
{ type: String, decorators: [{ type: Inject, args: [USER_AGENT,] }] }
|
|
61
|
+
];
|
|
62
|
+
__decorate([
|
|
63
|
+
Input('tuiProgressColorSegments')
|
|
64
|
+
], TuiProgressColorSegmentsDirective.prototype, "colors", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
tuiPure
|
|
67
|
+
], TuiProgressColorSegmentsDirective.prototype, "calcSegments$", null);
|
|
68
|
+
TuiProgressColorSegmentsDirective = __decorate([
|
|
69
|
+
Directive({
|
|
70
|
+
selector: 'progress[tuiProgressBar][tuiProgressColorSegments]',
|
|
71
|
+
host: {
|
|
72
|
+
'[$.style.--tui-progress-color]': 'calcSegments$',
|
|
73
|
+
'($.style.--tui-progress-color)': '0',
|
|
74
|
+
},
|
|
75
|
+
providers: [TuiDestroyService, TuiResizeService],
|
|
76
|
+
}),
|
|
77
|
+
__param(0, Inject(ElementRef)),
|
|
78
|
+
__param(1, Inject(TuiResizeService)),
|
|
79
|
+
__param(2, Inject(USER_AGENT))
|
|
80
|
+
], TuiProgressColorSegmentsDirective);
|
|
81
|
+
|
|
82
82
|
// @dynamic
|
|
83
83
|
let TuiProgressCircleComponent = class TuiProgressCircleComponent {
|
|
84
84
|
constructor(userAgent, windowRef, elementRef) {
|
|
@@ -198,6 +198,62 @@ TuiProgressSegmentedComponent = __decorate([
|
|
|
198
198
|
})
|
|
199
199
|
], TuiProgressSegmentedComponent);
|
|
200
200
|
|
|
201
|
+
// TODO delete in v3.0
|
|
202
|
+
let AbstractTuiColorSegments = class AbstractTuiColorSegments {
|
|
203
|
+
constructor(userAgent, elementRef) {
|
|
204
|
+
this.userAgent = userAgent;
|
|
205
|
+
this.elementRef = elementRef;
|
|
206
|
+
this.isOldBrowsers = isEdgeOlderThan(CHROMIUM_EDGE_START_VERSION, this.userAgent) ||
|
|
207
|
+
isIE(this.userAgent);
|
|
208
|
+
}
|
|
209
|
+
calculate(colors) {
|
|
210
|
+
if (this.isOldBrowsers) {
|
|
211
|
+
return colors[0];
|
|
212
|
+
}
|
|
213
|
+
const elementWidth = this.elementRef.nativeElement.offsetWidth;
|
|
214
|
+
return calculateColorSegments(colors, elementWidth);
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
AbstractTuiColorSegments.ctorParameters = () => [
|
|
218
|
+
{ type: String, decorators: [{ type: Inject, args: [USER_AGENT,] }] },
|
|
219
|
+
{ type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] }
|
|
220
|
+
];
|
|
221
|
+
AbstractTuiColorSegments = __decorate([
|
|
222
|
+
Injectable(),
|
|
223
|
+
__param(0, Inject(USER_AGENT)),
|
|
224
|
+
__param(1, Inject(ElementRef))
|
|
225
|
+
], AbstractTuiColorSegments);
|
|
226
|
+
|
|
227
|
+
// TODO delete in v3.0
|
|
228
|
+
let TuiProgressColorSegmentsPipe = class TuiProgressColorSegmentsPipe extends AbstractTuiColorSegments {
|
|
229
|
+
/**
|
|
230
|
+
* @deprecated use tuiProgressColorSegments directive instead
|
|
231
|
+
* {@link TuiProgressColorSegmentsDirective}
|
|
232
|
+
* @example: `<progress tuiProgressBar [tuiProgressColorSegments]="colors">`
|
|
233
|
+
*/
|
|
234
|
+
transform(colors) {
|
|
235
|
+
return this.calculate(colors);
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
TuiProgressColorSegmentsPipe = __decorate([
|
|
239
|
+
Pipe({ name: 'tuiProgressColorSegments' })
|
|
240
|
+
], TuiProgressColorSegmentsPipe);
|
|
241
|
+
|
|
242
|
+
// TODO delete in v3.0
|
|
243
|
+
let TuiProgressColorSegmentsAsyncPipe = class TuiProgressColorSegmentsAsyncPipe extends AbstractTuiColorSegments {
|
|
244
|
+
/**
|
|
245
|
+
* @deprecated use tuiProgressColorSegments directive instead
|
|
246
|
+
* {@link TuiProgressColorSegmentsDirective}
|
|
247
|
+
* @example: `<progress tuiProgressBar [tuiProgressColorSegments]="colors">`
|
|
248
|
+
*/
|
|
249
|
+
transform(colors) {
|
|
250
|
+
return timer(0).pipe(map(() => this.calculate(colors)));
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
TuiProgressColorSegmentsAsyncPipe = __decorate([
|
|
254
|
+
Pipe({ name: 'tuiProgressColorSegmentsAsync' })
|
|
255
|
+
], TuiProgressColorSegmentsAsyncPipe);
|
|
256
|
+
|
|
201
257
|
let TuiProgressModule = class TuiProgressModule {
|
|
202
258
|
};
|
|
203
259
|
TuiProgressModule = __decorate([
|
|
@@ -205,6 +261,7 @@ TuiProgressModule = __decorate([
|
|
|
205
261
|
imports: [CommonModule, TuiRepeatTimesModule],
|
|
206
262
|
declarations: [
|
|
207
263
|
TuiProgressBarComponent,
|
|
264
|
+
TuiProgressColorSegmentsDirective,
|
|
208
265
|
TuiProgressColorSegmentsPipe,
|
|
209
266
|
TuiProgressColorSegmentsAsyncPipe,
|
|
210
267
|
TuiProgressCircleComponent,
|
|
@@ -214,6 +271,7 @@ TuiProgressModule = __decorate([
|
|
|
214
271
|
exports: [
|
|
215
272
|
TuiProgressBarComponent,
|
|
216
273
|
TuiProgressCircleComponent,
|
|
274
|
+
TuiProgressColorSegmentsDirective,
|
|
217
275
|
TuiProgressColorSegmentsPipe,
|
|
218
276
|
TuiProgressColorSegmentsAsyncPipe,
|
|
219
277
|
TuiProgressLabelComponent,
|
|
@@ -226,5 +284,5 @@ TuiProgressModule = __decorate([
|
|
|
226
284
|
* Generated bundle index. Do not edit.
|
|
227
285
|
*/
|
|
228
286
|
|
|
229
|
-
export { AbstractTuiColorSegments, TuiProgressBarComponent, TuiProgressCircleComponent, TuiProgressColorSegmentsAsyncPipe, TuiProgressColorSegmentsPipe, TuiProgressLabelComponent, TuiProgressModule, TuiProgressSegmentedComponent, nonNegativeInt, positiveInt };
|
|
287
|
+
export { AbstractTuiColorSegments, TuiProgressBarComponent, TuiProgressCircleComponent, TuiProgressColorSegmentsAsyncPipe, TuiProgressColorSegmentsDirective, TuiProgressColorSegmentsPipe, TuiProgressLabelComponent, TuiProgressModule, TuiProgressSegmentedComponent, nonNegativeInt, positiveInt };
|
|
230
288
|
//# sourceMappingURL=taiga-ui-kit-components-progress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-kit-components-progress.js","sources":["ng://@taiga-ui/kit/components/progress/pipes/abstract-color-segments.ts","ng://@taiga-ui/kit/components/progress/pipes/progress-color-segments.pipe.ts","ng://@taiga-ui/kit/components/progress/pipes/progress-color-segments-async.pipe.ts","ng://@taiga-ui/kit/components/progress/progress-bar/progress-bar.component.ts","ng://@taiga-ui/kit/components/progress/progress-circle/progress-circle.component.ts","ng://@taiga-ui/kit/components/progress/progress-label/progress-label.component.ts","ng://@taiga-ui/kit/components/progress/progress-segmented/progress-segmented.component.ts","ng://@taiga-ui/kit/components/progress/progress.module.ts","ng://@taiga-ui/kit/components/progress/taiga-ui-kit-components-progress.ts"],"sourcesContent":["import {ElementRef, Inject, Injectable, PipeTransform} from '@angular/core';\nimport {USER_AGENT} from '@ng-web-apis/common';\nimport {CHROMIUM_EDGE_START_VERSION, isEdgeOlderThan, isIE} from '@taiga-ui/cdk';\n\n@Injectable()\nexport abstract class AbstractTuiColorSegments<T> implements PipeTransform {\n private readonly isOldBrowsers =\n isEdgeOlderThan(CHROMIUM_EDGE_START_VERSION, this.userAgent) ||\n isIE(this.userAgent);\n\n constructor(\n @Inject(USER_AGENT) private readonly userAgent: string,\n @Inject(ElementRef) private readonly elementRef: ElementRef<HTMLElement>,\n ) {}\n\n abstract transform(colors: string[]): T;\n\n protected calculate(colors: string[]): string {\n if (this.isOldBrowsers) {\n return colors[0];\n }\n\n const elementWidth = this.elementRef.nativeElement.offsetWidth;\n const segmentWidth = Math.ceil(elementWidth / colors.length);\n const colorsString = colors.reduce(\n (acc, color, i) =>\n `${acc}, ${color} ${i * segmentWidth}px ${(i + 1) * segmentWidth}px`,\n '',\n );\n\n return `linear-gradient(to right ${colorsString})`;\n }\n}\n","import {Pipe} from '@angular/core';\n\nimport {AbstractTuiColorSegments} from './abstract-color-segments';\n\n/**\n * @deprecated use tuiProgressColorSegmentsAsync instead\n * {@link TuiProgressColorSegmentsAsyncPipe}\n * example: `<progress [color]=\"colors | tuiProgressColorSegmentsAsync | async\">`\n */\n@Pipe({name: 'tuiProgressColorSegments'})\nexport class TuiProgressColorSegmentsPipe extends AbstractTuiColorSegments<string> {\n transform(colors: string[]): string {\n return this.calculate(colors);\n }\n}\n","import {Pipe} from '@angular/core';\nimport {Observable, timer} from 'rxjs';\nimport {map} from 'rxjs/operators';\n\nimport {AbstractTuiColorSegments} from './abstract-color-segments';\n\n@Pipe({name: 'tuiProgressColorSegmentsAsync'})\nexport class TuiProgressColorSegmentsAsyncPipe extends AbstractTuiColorSegments<\n Observable<string>\n> {\n transform(colors: string[]): Observable<string> {\n return timer(0).pipe(map(() => this.calculate(colors)));\n }\n}\n","import {ChangeDetectionStrategy, Component, HostBinding, Input} from '@angular/core';\nimport {tuiDefaultProp} from '@taiga-ui/cdk';\nimport {TuiSizeS} from '@taiga-ui/core';\n\n@Component({\n selector: 'progress[tuiProgressBar]',\n template: '',\n styleUrls: ['./progress-bar.component.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiProgressBarComponent {\n @Input()\n @HostBinding('style.--tui-progress-color')\n color?: string;\n\n @Input()\n @HostBinding('attr.data-size')\n @tuiDefaultProp()\n size: TuiSizeS = 'm';\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n HostBinding,\n Inject,\n Input,\n ViewChild,\n} from '@angular/core';\nimport {USER_AGENT, WINDOW} from '@ng-web-apis/common';\nimport {\n CHROMIUM_EDGE_START_VERSION,\n isEdgeOlderThan,\n tuiDefaultProp,\n} from '@taiga-ui/cdk';\nimport {TuiSizeS, TuiSizeXL} from '@taiga-ui/core';\n\n// @dynamic\n@Component({\n selector: 'tui-progress-circle',\n templateUrl: './progress-circle.template.html',\n styleUrls: ['./progress-circle.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiProgressCircleComponent {\n @ViewChild('progressCircle', {static: true})\n private readonly progressCircle!: ElementRef<SVGCircleElement>;\n\n @Input()\n @tuiDefaultProp()\n value = 0;\n\n @Input()\n @tuiDefaultProp()\n max = 1;\n\n @Input()\n @HostBinding('style.--tui-progress-color')\n @tuiDefaultProp()\n color: string | null = null;\n\n @Input()\n @HostBinding('attr.data-size')\n @tuiDefaultProp()\n size: TuiSizeS | TuiSizeXL = 'm';\n\n @HostBinding('style.--progress-percentage')\n get progressPercentage(): number {\n return this.value / this.max;\n }\n\n get oldEdgeRadiusFallback(): number | null {\n if (!isEdgeOlderThan(CHROMIUM_EDGE_START_VERSION, this.userAgent)) {\n return null;\n }\n\n const strokeWidth = parseInt(\n this.windowRef.getComputedStyle(this.progressCircle.nativeElement)\n .strokeWidth,\n 10,\n );\n\n return (this.elementRef.nativeElement.offsetWidth - strokeWidth) / 2;\n }\n\n constructor(\n @Inject(USER_AGENT) private readonly userAgent: string,\n @Inject(WINDOW) private readonly windowRef: Window,\n @Inject(ElementRef) private readonly elementRef: ElementRef<HTMLElement>,\n ) {}\n}\n","import {ChangeDetectionStrategy, Component} from '@angular/core';\n\n@Component({\n selector: 'label[tuiProgressLabel]',\n templateUrl: './progress-label.template.html',\n styleUrls: ['./progress-label.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiProgressLabelComponent {}\n","import {ChangeDetectionStrategy, Component, HostBinding, Input} from '@angular/core';\nimport {tuiDefaultProp} from '@taiga-ui/cdk';\nimport {TuiSizeS} from '@taiga-ui/core';\n\nexport function nonNegativeInt(value: number): boolean {\n return Number.isInteger(value) && value >= 0;\n}\n\nexport function positiveInt(value: number): boolean {\n return Number.isInteger(value) && value > 0;\n}\n\n@Component({\n selector: 'tui-progress-segmented',\n templateUrl: './progress-segmented.template.html',\n styleUrls: ['./progress-segmented.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiProgressSegmentedComponent {\n @Input()\n @tuiDefaultProp(nonNegativeInt, 'Must be non-negative integer between 0 and max')\n value = 0;\n\n @Input()\n @tuiDefaultProp(positiveInt, 'Must be positive integer')\n max = 1;\n\n @Input()\n @HostBinding('attr.data-size')\n size: TuiSizeS = 'm';\n\n @Input()\n @tuiDefaultProp()\n colors: string | ReadonlyArray<string> = 'var(--tui-primary)';\n\n getActiveColor(index: number = 0): string | null {\n return typeof this.colors === 'string'\n ? this.colors\n : this.colors[index] || this.colors[this.colors.length - 1];\n }\n}\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {TuiRepeatTimesModule} from '@taiga-ui/cdk';\n\nimport {TuiProgressColorSegmentsPipe} from './pipes/progress-color-segments.pipe';\nimport {TuiProgressColorSegmentsAsyncPipe} from './pipes/progress-color-segments-async.pipe';\nimport {TuiProgressBarComponent} from './progress-bar/progress-bar.component';\nimport {TuiProgressCircleComponent} from './progress-circle/progress-circle.component';\nimport {TuiProgressLabelComponent} from './progress-label/progress-label.component';\nimport {TuiProgressSegmentedComponent} from './progress-segmented/progress-segmented.component';\n\n@NgModule({\n imports: [CommonModule, TuiRepeatTimesModule],\n declarations: [\n TuiProgressBarComponent,\n TuiProgressColorSegmentsPipe,\n TuiProgressColorSegmentsAsyncPipe,\n TuiProgressCircleComponent,\n TuiProgressLabelComponent,\n TuiProgressSegmentedComponent,\n ],\n exports: [\n TuiProgressBarComponent,\n TuiProgressCircleComponent,\n TuiProgressColorSegmentsPipe,\n TuiProgressColorSegmentsAsyncPipe,\n TuiProgressLabelComponent,\n TuiProgressSegmentedComponent,\n ],\n})\nexport class TuiProgressModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;IAKsB,wBAAwB,GAA9C,MAAsB,wBAAwB;IAK1C,YACyC,SAAiB,EACjB,UAAmC;QADnC,cAAS,GAAT,SAAS,CAAQ;QACjB,eAAU,GAAV,UAAU,CAAyB;QAN3D,kBAAa,GAC1B,eAAe,CAAC,2BAA2B,EAAE,IAAI,CAAC,SAAS,CAAC;YAC5D,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;KAKrB;IAIM,SAAS,CAAC,MAAgB;QAChC,IAAI,IAAI,CAAC,aAAa,EAAE;YACpB,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;SACpB;QAED,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC;QAC/D,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;QAC7D,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAC9B,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,KACV,GAAG,GAAG,KAAK,KAAK,IAAI,CAAC,GAAG,YAAY,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,YAAY,IAAI,EACxE,EAAE,CACL,CAAC;QAEF,OAAO,4BAA4B,YAAY,GAAG,CAAC;KACtD;EACJ;;yCArBQ,MAAM,SAAC,UAAU;YAC+B,UAAU,uBAA1D,MAAM,SAAC,UAAU;;AAPJ,wBAAwB;IAD7C,UAAU,EAAE;IAOJ,WAAA,MAAM,CAAC,UAAU,CAAC,CAAA;IAClB,WAAA,MAAM,CAAC,UAAU,CAAC,CAAA;GAPL,wBAAwB,CA2B7C;;AC5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AAuB,CAAC,MAAM;;KAClD,CAAC;GACW,6BAA6B,CAsBzC;;ICVY,iBAAiB,GAA9B,MAAa,iBAAiB;EAAG;AAApB,iBAAiB;IAnB7B,QAAQ,CAAC;QACN,OAAO,EAAE,CAAC,YAAY,EAAE,oBAAoB,CAAC;QAC7C,YAAY,EAAE;YACV,uBAAuB;YACvB,4BAA4B;YAC5B,iCAAiC;YACjC,0BAA0B;YAC1B,yBAAyB;YACzB,6BAA6B;SAChC;QACD,OAAO,EAAE;YACL,uBAAuB;YACvB,0BAA0B;YAC1B,4BAA4B;YAC5B,iCAAiC;YACjC,yBAAyB;YACzB,6BAA6B;SAChC;KACJ,CAAC;GACW,iBAAiB,CAAG;;AC9BjC;;;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-kit-components-progress.js","sources":["ng://@taiga-ui/kit/components/progress/progress-bar/progress-bar.component.ts","ng://@taiga-ui/kit/components/progress/utils/calculate-color-segments.ts","ng://@taiga-ui/kit/components/progress/progress-bar/progress-color-segments.directive.ts","ng://@taiga-ui/kit/components/progress/progress-circle/progress-circle.component.ts","ng://@taiga-ui/kit/components/progress/progress-label/progress-label.component.ts","ng://@taiga-ui/kit/components/progress/progress-segmented/progress-segmented.component.ts","ng://@taiga-ui/kit/components/progress/utils/abstract-color-segments.ts","ng://@taiga-ui/kit/components/progress/utils/progress-color-segments.pipe.ts","ng://@taiga-ui/kit/components/progress/utils/progress-color-segments-async.pipe.ts","ng://@taiga-ui/kit/components/progress/progress.module.ts","ng://@taiga-ui/kit/components/progress/taiga-ui-kit-components-progress.ts"],"sourcesContent":["import {ChangeDetectionStrategy, Component, HostBinding, Input} from '@angular/core';\nimport {tuiDefaultProp} from '@taiga-ui/cdk';\nimport {TuiSizeS} from '@taiga-ui/core';\n\n@Component({\n selector: 'progress[tuiProgressBar]',\n template: '',\n styleUrls: ['./progress-bar.component.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiProgressBarComponent {\n @Input()\n @HostBinding('style.--tui-progress-color')\n color?: string;\n\n @Input()\n @HostBinding('attr.data-size')\n @tuiDefaultProp()\n size: TuiSizeS = 'm';\n}\n","/**\n * TODO in v3.0 move inside {@link TuiProgressColorSegmentsDirective} (as a private method)\n * (after deletion of {@link TuiProgressColorSegmentsPipe} and {@link TuiProgressColorSegmentsAsyncPipe})\n */\nexport const calculateColorSegments = (\n colors: string[],\n progressWidth: number,\n): string => {\n const segmentWidth = Math.ceil(progressWidth / colors.length);\n const colorsString = colors.reduce(\n (acc, color, i) =>\n `${acc}, ${color} ${i * segmentWidth}px ${(i + 1) * segmentWidth}px`,\n '',\n );\n\n return `linear-gradient(to right ${colorsString})`;\n};\n","import {Directive, ElementRef, Inject, Input} from '@angular/core';\nimport {USER_AGENT} from '@ng-web-apis/common';\nimport {\n CHROMIUM_EDGE_START_VERSION,\n isEdgeOlderThan,\n isIE,\n TuiDestroyService,\n tuiPure,\n TuiResizeService,\n} from '@taiga-ui/cdk';\nimport {Observable} from 'rxjs';\nimport {map} from 'rxjs/operators';\n\nimport {calculateColorSegments} from '../utils/calculate-color-segments';\n\n@Directive({\n selector: 'progress[tuiProgressBar][tuiProgressColorSegments]',\n host: {\n '[$.style.--tui-progress-color]': 'calcSegments$',\n '($.style.--tui-progress-color)': '0',\n },\n providers: [TuiDestroyService, TuiResizeService],\n})\nexport class TuiProgressColorSegmentsDirective {\n private readonly isOldBrowsers =\n isEdgeOlderThan(CHROMIUM_EDGE_START_VERSION, this.userAgent) ||\n isIE(this.userAgent);\n\n @Input('tuiProgressColorSegments')\n colors: string[] = [];\n\n @tuiPure\n get calcSegments$(): Observable<string> {\n return this.resize$.pipe(\n map(() =>\n this.isOldBrowsers\n ? this.colors[0]\n : calculateColorSegments(\n this.colors,\n this.elementRef.nativeElement.offsetWidth,\n ),\n ),\n );\n }\n\n constructor(\n @Inject(ElementRef) private readonly elementRef: ElementRef<HTMLProgressElement>,\n @Inject(TuiResizeService) private readonly resize$: Observable<unknown>,\n @Inject(USER_AGENT) private readonly userAgent: string,\n ) {}\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n HostBinding,\n Inject,\n Input,\n ViewChild,\n} from '@angular/core';\nimport {USER_AGENT, WINDOW} from '@ng-web-apis/common';\nimport {\n CHROMIUM_EDGE_START_VERSION,\n isEdgeOlderThan,\n tuiDefaultProp,\n} from '@taiga-ui/cdk';\nimport {TuiSizeS, TuiSizeXL} from '@taiga-ui/core';\n\n// @dynamic\n@Component({\n selector: 'tui-progress-circle',\n templateUrl: './progress-circle.template.html',\n styleUrls: ['./progress-circle.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiProgressCircleComponent {\n @ViewChild('progressCircle', {static: true})\n private readonly progressCircle!: ElementRef<SVGCircleElement>;\n\n @Input()\n @tuiDefaultProp()\n value = 0;\n\n @Input()\n @tuiDefaultProp()\n max = 1;\n\n @Input()\n @HostBinding('style.--tui-progress-color')\n @tuiDefaultProp()\n color: string | null = null;\n\n @Input()\n @HostBinding('attr.data-size')\n @tuiDefaultProp()\n size: TuiSizeS | TuiSizeXL = 'm';\n\n @HostBinding('style.--progress-percentage')\n get progressPercentage(): number {\n return this.value / this.max;\n }\n\n get oldEdgeRadiusFallback(): number | null {\n if (!isEdgeOlderThan(CHROMIUM_EDGE_START_VERSION, this.userAgent)) {\n return null;\n }\n\n const strokeWidth = parseInt(\n this.windowRef.getComputedStyle(this.progressCircle.nativeElement)\n .strokeWidth,\n 10,\n );\n\n return (this.elementRef.nativeElement.offsetWidth - strokeWidth) / 2;\n }\n\n constructor(\n @Inject(USER_AGENT) private readonly userAgent: string,\n @Inject(WINDOW) private readonly windowRef: Window,\n @Inject(ElementRef) private readonly elementRef: ElementRef<HTMLElement>,\n ) {}\n}\n","import {ChangeDetectionStrategy, Component} from '@angular/core';\n\n@Component({\n selector: 'label[tuiProgressLabel]',\n templateUrl: './progress-label.template.html',\n styleUrls: ['./progress-label.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiProgressLabelComponent {}\n","import {ChangeDetectionStrategy, Component, HostBinding, Input} from '@angular/core';\nimport {tuiDefaultProp} from '@taiga-ui/cdk';\nimport {TuiSizeS} from '@taiga-ui/core';\n\nexport function nonNegativeInt(value: number): boolean {\n return Number.isInteger(value) && value >= 0;\n}\n\nexport function positiveInt(value: number): boolean {\n return Number.isInteger(value) && value > 0;\n}\n\n@Component({\n selector: 'tui-progress-segmented',\n templateUrl: './progress-segmented.template.html',\n styleUrls: ['./progress-segmented.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiProgressSegmentedComponent {\n @Input()\n @tuiDefaultProp(nonNegativeInt, 'Must be non-negative integer between 0 and max')\n value = 0;\n\n @Input()\n @tuiDefaultProp(positiveInt, 'Must be positive integer')\n max = 1;\n\n @Input()\n @HostBinding('attr.data-size')\n size: TuiSizeS = 'm';\n\n @Input()\n @tuiDefaultProp()\n colors: string | ReadonlyArray<string> = 'var(--tui-primary)';\n\n getActiveColor(index: number = 0): string | null {\n return typeof this.colors === 'string'\n ? this.colors\n : this.colors[index] || this.colors[this.colors.length - 1];\n }\n}\n","import {ElementRef, Inject, Injectable, PipeTransform} from '@angular/core';\nimport {USER_AGENT} from '@ng-web-apis/common';\nimport {CHROMIUM_EDGE_START_VERSION, isEdgeOlderThan, isIE} from '@taiga-ui/cdk';\n\nimport {calculateColorSegments} from './calculate-color-segments';\n\n// TODO delete in v3.0\n@Injectable()\nexport abstract class AbstractTuiColorSegments<T> implements PipeTransform {\n private readonly isOldBrowsers =\n isEdgeOlderThan(CHROMIUM_EDGE_START_VERSION, this.userAgent) ||\n isIE(this.userAgent);\n\n constructor(\n @Inject(USER_AGENT) private readonly userAgent: string,\n @Inject(ElementRef) private readonly elementRef: ElementRef<HTMLElement>,\n ) {}\n\n abstract transform(colors: string[]): T;\n\n protected calculate(colors: string[]): string {\n if (this.isOldBrowsers) {\n return colors[0];\n }\n\n const elementWidth = this.elementRef.nativeElement.offsetWidth;\n\n return calculateColorSegments(colors, elementWidth);\n }\n}\n","import {Pipe} from '@angular/core';\n\nimport {AbstractTuiColorSegments} from './abstract-color-segments';\n\n// TODO delete in v3.0\n@Pipe({name: 'tuiProgressColorSegments'})\nexport class TuiProgressColorSegmentsPipe extends AbstractTuiColorSegments<string> {\n /**\n * @deprecated use tuiProgressColorSegments directive instead\n * {@link TuiProgressColorSegmentsDirective}\n * @example: `<progress tuiProgressBar [tuiProgressColorSegments]=\"colors\">`\n */\n transform(colors: string[]): string {\n return this.calculate(colors);\n }\n}\n","import {Pipe} from '@angular/core';\nimport {Observable, timer} from 'rxjs';\nimport {map} from 'rxjs/operators';\n\nimport {AbstractTuiColorSegments} from './abstract-color-segments';\n\n// TODO delete in v3.0\n@Pipe({name: 'tuiProgressColorSegmentsAsync'})\nexport class TuiProgressColorSegmentsAsyncPipe extends AbstractTuiColorSegments<\n Observable<string>\n> {\n /**\n * @deprecated use tuiProgressColorSegments directive instead\n * {@link TuiProgressColorSegmentsDirective}\n * @example: `<progress tuiProgressBar [tuiProgressColorSegments]=\"colors\">`\n */\n transform(colors: string[]): Observable<string> {\n return timer(0).pipe(map(() => this.calculate(colors)));\n }\n}\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {TuiRepeatTimesModule} from '@taiga-ui/cdk';\n\nimport {TuiProgressBarComponent} from './progress-bar/progress-bar.component';\nimport {TuiProgressColorSegmentsDirective} from './progress-bar/progress-color-segments.directive';\nimport {TuiProgressCircleComponent} from './progress-circle/progress-circle.component';\nimport {TuiProgressLabelComponent} from './progress-label/progress-label.component';\nimport {TuiProgressSegmentedComponent} from './progress-segmented/progress-segmented.component';\nimport {TuiProgressColorSegmentsPipe} from './utils/progress-color-segments.pipe';\nimport {TuiProgressColorSegmentsAsyncPipe} from './utils/progress-color-segments-async.pipe';\n\n@NgModule({\n imports: [CommonModule, TuiRepeatTimesModule],\n declarations: [\n TuiProgressBarComponent,\n TuiProgressColorSegmentsDirective,\n TuiProgressColorSegmentsPipe,\n TuiProgressColorSegmentsAsyncPipe,\n TuiProgressCircleComponent,\n TuiProgressLabelComponent,\n TuiProgressSegmentedComponent,\n ],\n exports: [\n TuiProgressBarComponent,\n TuiProgressCircleComponent,\n TuiProgressColorSegmentsDirective,\n TuiProgressColorSegmentsPipe,\n TuiProgressColorSegmentsAsyncPipe,\n TuiProgressLabelComponent,\n TuiProgressSegmentedComponent,\n ],\n})\nexport class TuiProgressModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;IAUa,uBAAuB,GAApC,MAAa,uBAAuB;IAApC;QAQI,SAAI,GAAa,GAAG,CAAC;KACxB;EAAA;AANG;IAFC,KAAK,EAAE;IACP,WAAW,CAAC,4BAA4B,CAAC;sDAC3B;AAKf;IAHC,KAAK,EAAE;IACP,WAAW,CAAC,gBAAgB,CAAC;IAC7B,cAAc,EAAE;qDACI;AARZ,uBAAuB;IANnC,SAAS,CAAC;QACP,QAAQ,EAAE,0BAA0B;QACpC,QAAQ,EAAE,EAAE;QAEZ,eAAe,EAAE,uBAAuB,CAAC,MAAM;;KAClD,CAAC;GACW,uBAAuB,CASnC;;ACnBD;;;;AAIO,MAAM,sBAAsB,GAAG,CAClC,MAAgB,EAChB,aAAqB;IAErB,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9D,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAC9B,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,KACV,GAAG,GAAG,KAAK,KAAK,IAAI,CAAC,GAAG,YAAY,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,YAAY,IAAI,EACxE,EAAE,CACL,CAAC;IAEF,OAAO,4BAA4B,YAAY,GAAG,CAAC;AACvD,CAAC;;ICOY,iCAAiC,GAA9C,MAAa,iCAAiC;IAsB1C,YACyC,UAA2C,EACrC,OAA4B,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;;IAMG,SAAS,CAAC,MAAgB;QACtB,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;KAC3D;EACJ;AAXY,iCAAiC;IAD7C,IAAI,CAAC,EAAC,IAAI,EAAE,+BAA+B,EAAC,CAAC;GACjC,iCAAiC,CAW7C;;ICcY,iBAAiB,GAA9B,MAAa,iBAAiB;EAAG;AAApB,iBAAiB;IArB7B,QAAQ,CAAC;QACN,OAAO,EAAE,CAAC,YAAY,EAAE,oBAAoB,CAAC;QAC7C,YAAY,EAAE;YACV,uBAAuB;YACvB,iCAAiC;YACjC,4BAA4B;YAC5B,iCAAiC;YACjC,0BAA0B;YAC1B,yBAAyB;YACzB,6BAA6B;SAChC;QACD,OAAO,EAAE;YACL,uBAAuB;YACvB,0BAA0B;YAC1B,iCAAiC;YACjC,4BAA4B;YAC5B,iCAAiC;YACjC,yBAAyB;YACzB,6BAA6B;SAChC;KACJ,CAAC;GACW,iBAAiB,CAAG;;ACjCjC;;;;;;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { __decorate, __param } from 'tslib';
|
|
2
|
-
import { Optional, Self, Inject, ElementRef, Input, HostBinding, Component, ChangeDetectionStrategy,
|
|
2
|
+
import { Optional, Self, Inject, ChangeDetectorRef, ElementRef, Input, HostBinding, Component, ChangeDetectionStrategy, forwardRef, NgModule } from '@angular/core';
|
|
3
3
|
import { NgModel, NgControl } from '@angular/forms';
|
|
4
4
|
import { USER_AGENT } from '@ng-web-apis/common';
|
|
5
|
-
import { isEdgeOlderThan, CHROMIUM_EDGE_START_VERSION, tuiDefaultProp, isNativeFocused, TUI_FOCUSABLE_ITEM_ACCESSOR, TuiRepeatTimesModule, TuiFocusableModule, TuiFocusVisibleModule, TuiActiveZoneModule } from '@taiga-ui/cdk';
|
|
5
|
+
import { watch, isEdgeOlderThan, CHROMIUM_EDGE_START_VERSION, tuiDefaultProp, isNativeFocused, TUI_FOCUSABLE_ITEM_ACCESSOR, TuiRepeatTimesModule, TuiFocusableModule, TuiFocusVisibleModule, TuiActiveZoneModule } from '@taiga-ui/cdk';
|
|
6
|
+
import { take } from 'rxjs/operators';
|
|
6
7
|
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
7
8
|
import { TuiFormatNumberPipeModule } from '@taiga-ui/core';
|
|
8
9
|
import { AbstractTuiSlider } from '@taiga-ui/kit/abstract';
|
|
@@ -10,12 +11,22 @@ import { TUI_FROM_TO_TEXTS } from '@taiga-ui/kit/tokens';
|
|
|
10
11
|
import { Observable } from 'rxjs';
|
|
11
12
|
|
|
12
13
|
let TuiSliderComponent = class TuiSliderComponent {
|
|
13
|
-
constructor(control, elementRef, userAgent) {
|
|
14
|
-
|
|
14
|
+
constructor(control, changeDetectorRef, elementRef, userAgent) {
|
|
15
|
+
var _a;
|
|
15
16
|
this.elementRef = elementRef;
|
|
16
17
|
this.userAgent = userAgent;
|
|
17
18
|
this.size = 'm';
|
|
18
19
|
this.segments = 1;
|
|
20
|
+
if (control instanceof NgModel) {
|
|
21
|
+
/**
|
|
22
|
+
* The ValueAccessor.writeValue method is called twice on any value accessor during component initialization,
|
|
23
|
+
* when a control is bound using [(ngModel)], first time with a phantom null value.
|
|
24
|
+
* With `changeDetection: ChangeDetectionStrategy.OnPush` the second call of writeValue with real value don't re-render the view.
|
|
25
|
+
* ___
|
|
26
|
+
* See this {@link https://github.com/angular/angular/issues/14988 issue}
|
|
27
|
+
*/
|
|
28
|
+
(_a = control.valueChanges) === null || _a === void 0 ? void 0 : _a.pipe(watch(changeDetectorRef), take(1)).subscribe();
|
|
29
|
+
}
|
|
19
30
|
}
|
|
20
31
|
get min() {
|
|
21
32
|
return Number(this.elementRef.nativeElement.min);
|
|
@@ -26,25 +37,22 @@ let TuiSliderComponent = class TuiSliderComponent {
|
|
|
26
37
|
get step() {
|
|
27
38
|
return Number(this.elementRef.nativeElement.step) || 1;
|
|
28
39
|
}
|
|
40
|
+
get value() {
|
|
41
|
+
return Number(this.elementRef.nativeElement.value) || 0;
|
|
42
|
+
}
|
|
29
43
|
get fillPercentage() {
|
|
30
|
-
|
|
31
|
-
return `${percentage}%`;
|
|
44
|
+
return (100 * this.value) / (this.max - this.min);
|
|
32
45
|
}
|
|
33
46
|
get stepPercentage() {
|
|
34
|
-
|
|
35
|
-
return `${percentage}%`;
|
|
47
|
+
return 100 / this.segments - 0.1;
|
|
36
48
|
}
|
|
37
49
|
get isOldEdge() {
|
|
38
50
|
return isEdgeOlderThan(CHROMIUM_EDGE_START_VERSION, this.userAgent);
|
|
39
51
|
}
|
|
40
|
-
get value() {
|
|
41
|
-
const { control } = this;
|
|
42
|
-
const controlValue = control instanceof NgModel ? control.viewModel : control === null || control === void 0 ? void 0 : control.value;
|
|
43
|
-
return controlValue || Number(this.elementRef.nativeElement.value) || 0;
|
|
44
|
-
}
|
|
45
52
|
};
|
|
46
53
|
TuiSliderComponent.ctorParameters = () => [
|
|
47
54
|
{ type: NgControl, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NgControl,] }] },
|
|
55
|
+
{ type: ChangeDetectorRef, decorators: [{ type: Inject, args: [ChangeDetectorRef,] }] },
|
|
48
56
|
{ type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] },
|
|
49
57
|
{ type: String, decorators: [{ type: Inject, args: [USER_AGENT,] }] }
|
|
50
58
|
];
|
|
@@ -58,20 +66,25 @@ __decorate([
|
|
|
58
66
|
tuiDefaultProp()
|
|
59
67
|
], TuiSliderComponent.prototype, "segments", void 0);
|
|
60
68
|
__decorate([
|
|
61
|
-
HostBinding('style.--tui-slider-fill-percentage')
|
|
69
|
+
HostBinding('style.--tui-slider-fill-percentage.%')
|
|
62
70
|
], TuiSliderComponent.prototype, "fillPercentage", null);
|
|
63
71
|
__decorate([
|
|
64
|
-
HostBinding('style.--tui-slider-segment-width')
|
|
72
|
+
HostBinding('style.--tui-slider-segment-width.%')
|
|
65
73
|
], TuiSliderComponent.prototype, "stepPercentage", null);
|
|
66
74
|
__decorate([
|
|
67
75
|
HostBinding('class._old-edge')
|
|
68
76
|
], TuiSliderComponent.prototype, "isOldEdge", null);
|
|
69
77
|
TuiSliderComponent = __decorate([
|
|
70
78
|
Component({
|
|
71
|
-
|
|
79
|
+
/**
|
|
80
|
+
* We have to call our component as `<input tuiSlider type="range" ... />`
|
|
81
|
+
* because otherwise built-in angular
|
|
82
|
+
* {@link https://github.com/angular/angular/blob/master/packages/forms/src/directives/range_value_accessor.ts#L45 RangeValueAccessor}
|
|
83
|
+
* cannot be matched by its CSS selector.
|
|
84
|
+
*/
|
|
85
|
+
selector: 'input[type=range][tuiSlider]',
|
|
72
86
|
template: ``,
|
|
73
87
|
host: {
|
|
74
|
-
type: 'range',
|
|
75
88
|
/**
|
|
76
89
|
* For change detection.
|
|
77
90
|
* Webkit does not have built-in method for customization of filling progress (as Firefox).
|
|
@@ -86,8 +99,9 @@ TuiSliderComponent = __decorate([
|
|
|
86
99
|
__param(0, Optional()),
|
|
87
100
|
__param(0, Self()),
|
|
88
101
|
__param(0, Inject(NgControl)),
|
|
89
|
-
__param(1, Inject(
|
|
90
|
-
__param(2, Inject(
|
|
102
|
+
__param(1, Inject(ChangeDetectorRef)),
|
|
103
|
+
__param(2, Inject(ElementRef)),
|
|
104
|
+
__param(3, Inject(USER_AGENT))
|
|
91
105
|
], TuiSliderComponent);
|
|
92
106
|
|
|
93
107
|
var TuiSliderOldComponent_1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-kit-components-slider.js","sources":["ng://@taiga-ui/kit/components/slider/slider.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 {\n ChangeDetectionStrategy,\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} from '@taiga-ui/cdk';\nimport {TuiSizeS} from '@taiga-ui/core';\n\n@Component({\n selector: 'input[tuiSlider]',\n template: ``,\n styleUrls: ['./slider.style.less'],\n host: {\n type: 'range',\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 `fillPercentage` function) when we drag thumb of the input.\n */\n '(input)': '0',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiSliderComponent {\n @Input()\n @HostBinding('attr.data-size')\n @tuiDefaultProp()\n size: TuiSizeS = 'm';\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 @HostBinding('style.--tui-slider-fill-percentage')\n get fillPercentage(): string {\n const percentage = Math.floor((100 * this.value) / (this.max - this.min));\n\n return `${percentage}%`;\n }\n\n @HostBinding('style.--tui-slider-segment-width')\n get stepPercentage(): string {\n const percentage = 100 / this.segments - 0.1;\n\n return `${percentage}%`;\n }\n\n @HostBinding('class._old-edge')\n get isOldEdge(): boolean {\n return isEdgeOlderThan(CHROMIUM_EDGE_START_VERSION, this.userAgent);\n }\n\n get value(): number {\n const {control} = this;\n const controlValue =\n control instanceof NgModel ? control.viewModel : control?.value;\n\n return controlValue || Number(this.elementRef.nativeElement.value) || 0;\n }\n\n constructor(\n @Optional()\n @Self()\n @Inject(NgControl)\n private readonly control: NgControl | null,\n @Inject(ElementRef) private readonly elementRef: ElementRef<HTMLInputElement>,\n @Inject(USER_AGENT) private readonly userAgent: string,\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 remove in 3.0\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 protected getFallbackValue(): number {\n return 0;\n }\n\n protected processStep(increment: boolean) {\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 protected processValue(value: number) {\n this.updateValue(this.valueGuard(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 {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: [TuiSliderComponent, TuiSliderOldComponent],\n exports: [TuiSliderComponent, TuiSliderOldComponent],\n})\nexport class TuiSliderModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;IAmCa,kBAAkB,GAA/B,MAAa,kBAAkB;IAiD3B,YAIqB,OAAyB,EACL,UAAwC,EACxC,SAAiB;QAFrC,YAAO,GAAP,OAAO,CAAkB;QACL,eAAU,GAAV,UAAU,CAA8B;QACxC,cAAS,GAAT,SAAS,CAAQ;QAnD1D,SAAI,GAAa,GAAG,CAAC;QAIrB,aAAQ,GAAG,CAAC,CAAC;KAgDT;IA9CJ,IAAI,GAAG;QACH,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;KACpD;IAED,IAAI,GAAG;QACH,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC;KAC3D;IAED,IAAI,IAAI;QACJ,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KAC1D;IAGD,IAAI,cAAc;QACd,MAAM,UAAU,G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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 {\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\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 `fillPercentage` function) when we drag thumb of the input.\n */\n '(input)': '0',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiSliderComponent {\n @Input()\n @HostBinding('attr.data-size')\n @tuiDefaultProp()\n size: TuiSizeS = 'm';\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 @HostBinding('style.--tui-slider-fill-percentage.%')\n get fillPercentage(): number {\n return (100 * this.value) / (this.max - this.min);\n }\n\n @HostBinding('style.--tui-slider-segment-width.%')\n get stepPercentage(): number {\n return 100 / this.segments - 0.1;\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(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 {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 remove in 3.0\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 protected getFallbackValue(): number {\n return 0;\n }\n\n protected processStep(increment: boolean) {\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 protected processValue(value: number) {\n this.updateValue(this.valueGuard(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 {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: [TuiSliderComponent, TuiSliderOldComponent],\n exports: [TuiSliderComponent, TuiSliderOldComponent],\n})\nexport class TuiSliderModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;IA2Ca,kBAAkB,GAA/B,MAAa,kBAAkB;IAyC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,CAAC,CAAA;IAChB,WAAA,MAAM,CAAC,iBAAiB,CAAC,CAAA;GAXrB,qBAAqB,CAiDjC;;ICjEY,eAAe,GAA5B,MAAa,eAAe;EAAG;AAAlB,eAAe;IAZ3B,QAAQ,CAAC;QACN,OAAO,EAAE;YACL,YAAY;YACZ,oBAAoB;YACpB,kBAAkB;YAClB,qBAAqB;YACrB,mBAAmB;YACnB,yBAAyB;SAC5B;QACD,YAAY,EAAE,CAAC,kBAAkB,EAAE,qBAAqB,CAAC;QACzD,OAAO,EAAE,CAAC,kBAAkB,EAAE,qBAAqB,CAAC;KACvD,CAAC;GACW,eAAe,CAAG;;ACzB/B;;;;;;"}
|
|
@@ -158,7 +158,7 @@ TuiTextAreaComponent = __decorate([
|
|
|
158
158
|
'($.data-mode.attr)': 'mode$',
|
|
159
159
|
'[class._ios]': 'isIOS',
|
|
160
160
|
},
|
|
161
|
-
styles: [":host{position:relative;z-index:0;display:flex;font:var(--tui-font-text-m);flex-direction:column;min-height:6.75rem;border-radius:var(--tui-radius-m);color:var(--tui-text-01)}:host[data-mode=onDark]{color:var(--tui-text-01-night)}:host[data-size='m']{font:var(--tui-font-text-s);min-height:5.5rem}:host[data-size='m']._has-counter{min-height:6.625rem}:host[data-size='l']._has-counter{min-height:7.875rem}.outline{position:absolute;top:0;left:0;width:100%;height:100%;z-index:-1}.content{margin-top:0;margin-bottom:0;min-height:inherit;width:100%;box-sizing:border-box;overflow:hidden;cursor:text}:host._disabled .content{cursor:auto;opacity:var(--tui-disabled-opacity)}:host:not(._expandable) .content{position:absolute;top:0;left:0;bottom:1px;right:0;min-height:auto}:host._has-counter:not(._expandable) .content{bottom:1.6875rem}.wrapper{position:relative;width:100%;height:100%;min-height:inherit;padding-bottom:.4375rem;box-sizing:border-box}:host[data-size='m']._label-outside .wrapper{padding-top:.75rem}:host[data-size='l']._label-outside .wrapper{padding-top:1rem}:host[data-size='m']:not(._label-outside) .wrapper{padding-top:1.375rem}:host[data-size='l']:not(._label-outside) .wrapper{padding-top:1.625rem}.input-wrapper{min-height:inherit;width:100%;flex:1}.relative{position:relative;min-height:inherit}.box{display:flex;min-height:100%;width:100%}:host:not(._expandable) .box{height:100%}:host._has-counter._expandable .box{margin-bottom:1.25rem}.pseudo-content{white-space:pre-wrap;word-wrap:break-word;pointer-events:none;color:transparent;overflow:hidden;border:
|
|
161
|
+
styles: [":host{position:relative;z-index:0;display:flex;font:var(--tui-font-text-m);flex-direction:column;min-height:6.75rem;border-radius:var(--tui-radius-m);color:var(--tui-text-01)}:host[data-mode=onDark]{color:var(--tui-text-01-night)}:host[data-size='m']{font:var(--tui-font-text-s);min-height:5.5rem}:host[data-size='m']._has-counter{min-height:6.625rem}:host[data-size='l']._has-counter{min-height:7.875rem}.outline{position:absolute;top:0;left:0;width:100%;height:100%;z-index:-1}.content{margin-top:0;margin-bottom:0;min-height:inherit;width:100%;box-sizing:border-box;overflow:hidden;cursor:text}:host._disabled .content{cursor:auto;opacity:var(--tui-disabled-opacity)}:host:not(._expandable) .content{position:absolute;top:0;left:0;bottom:1px;right:0;min-height:auto}:host._has-counter:not(._expandable) .content{bottom:1.6875rem}.wrapper{position:relative;width:100%;height:100%;min-height:inherit;padding-bottom:.4375rem;box-sizing:border-box}:host[data-size='m']._label-outside .wrapper{padding-top:.75rem}:host[data-size='l']._label-outside .wrapper{padding-top:1rem}:host[data-size='m']:not(._label-outside) .wrapper{padding-top:1.375rem}:host[data-size='l']:not(._label-outside) .wrapper{padding-top:1.625rem}.input-wrapper{min-height:inherit;width:100%;flex:1}.relative{position:relative;min-height:inherit}.box{display:flex;min-height:100%;width:100%}:host:not(._expandable) .box{height:100%}:host._has-counter._expandable .box{margin-bottom:1.25rem}.pseudo-content{white-space:pre-wrap;word-wrap:break-word;pointer-events:none;color:transparent;overflow:hidden;border:solid transparent;border-width:0 var(--border-end,0) 0 var(--border-start,0);border-inline-start-width:var(--border-start,0);border-inline-end-width:var(--border-end,0)}:host[data-size='m'] .pseudo-content{padding:0 .75rem}:host[data-size='l'] .pseudo-content{padding:0 1rem}.pseudo-content__extra{background-color:var(--tui-error-bg-night)}.input{padding:0;border:0;border-radius:inherit;background:0 0;font-size:inherit;line-height:inherit;font-weight:inherit;color:inherit;caret-color:currentColor;-webkit-appearance:none;-moz-appearance:none;appearance:none;word-break:keep-all;-webkit-text-fill-color:currentColor;position:absolute;top:0;left:0;width:100%;height:100%;box-sizing:border-box;resize:none;overflow:hidden;outline:0;border:solid transparent;border-width:0 var(--border-end,0) 0 var(--border-start,0);border-inline-start-width:var(--border-start,0);border-inline-end-width:var(--border-end,0)}.input:-webkit-autofill,.input:-webkit-autofill:focus,.input:-webkit-autofill:hover{border-radius:inherit;color:inherit!important;background-color:transparent!important;-webkit-text-fill-color:var(--tui-text-01)!important;border-color:var(--tui-autofill);-webkit-box-shadow:0 0 0 1000px var(--tui-autofill) inset!important}.input::-ms-input-placeholder{color:var(--tui-text-03);opacity:0}.input::placeholder{color:var(--tui-text-03);opacity:0}:host[data-mode=onDark] .input::-ms-input-placeholder{color:var(--tui-text-03-night)}:host[data-mode=onDark] .input::placeholder{color:var(--tui-text-03-night)}:host._focused .input:not(:read-only)::-ms-input-placeholder{opacity:1}:host._focused .input:not(:-moz-read-only)::placeholder{opacity:1}:host._focused .input:not(:read-only)::placeholder{opacity:1}:host[data-size='m'] .input{padding:0 .75rem}:host[data-size='l'] .input{padding:0 1rem}:host._ios .input{padding-left:.8125rem}:host[data-mode=onDark]._disabled .input{color:var(--tui-text-03-night)}.placeholder{transition-property:transform,font-size,color,letter-spacing;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;font:var(--tui-font-text-s);color:var(--tui-text-01);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;width:100%;font-size:.8125rem;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;color:var(--tui-text-02);pointer-events:none;position:absolute;left:0;max-width:100%;padding:0 1rem;border:solid transparent;border-width:0 var(--border-end,0) 0 var(--border-start,0);border-inline-start-width:var(--border-start,0);border-inline-end-width:var(--border-end,0);box-sizing:border-box}.placeholder_raised{transform:translateY(-.625rem)}:host[data-size='m'] .placeholder_raised{font-size:.69rem;transform:translateY(-.5rem);letter-spacing:.025rem}:host._invalid:not(._focused) .placeholder_raised,:host._invalid:not(._focused)._hovered .placeholder_raised{color:var(--tui-error-fill)}:host[data-mode=onDark]._invalid:not(._focused) .placeholder_raised,:host[data-mode=onDark]._invalid:not(._focused)._hovered .placeholder_raised{color:var(--tui-error-fill-night)}:host._focused .placeholder,:host[data-size='l']._focused._label-outside .placeholder,:host[data-size='m']._focused._label-outside .placeholder{color:var(--tui-text-03)}:host[data-size='l'] .placeholder{font-size:.9375rem}:host[data-size='l'] .placeholder_raised{font-size:.8156rem}:host[data-size='l']._focused:not(._label-outside) .placeholder,:host[data-size='m']._focused:not(._label-outside) .placeholder{color:var(--tui-text-01)}:host[data-mode=onDark] .placeholder{color:var(--tui-text-02-night)}:host[data-size='l'][data-mode=onDark]._focused:not(._label-outside) .placeholder,:host[data-size='m'][data-mode=onDark]._focused:not(._label-outside) .placeholder{color:var(--tui-text-01-night)}:host[data-mode=onDark]._focused .placeholder,:host[data-size='l'][data-mode=onDark]._focused._label-outside .placeholder,:host[data-size='m'][data-mode=onDark]._focused._label-outside .placeholder{color:var(--tui-text-02-night)}:host[data-size='m'] .placeholder{top:.75rem;padding:0 .75rem}:host[data-size='l'] .placeholder{top:1rem}:host._label-outside .placeholder{overflow:initial;height:auto;white-space:initial}.icons{position:absolute;top:0;left:0;bottom:0;right:0;display:flex;justify-content:flex-end;pointer-events:none;padding:1rem .75rem}:host[data-size='m'] .icons{padding:.75rem}.cleaner{transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;display:flex;width:1.5rem;height:1.5rem;align-items:center;justify-content:center;color:var(--tui-text-03);position:relative;box-sizing:border-box;cursor:pointer;transition-property:color,transform;pointer-events:auto}.cleaner:hover{color:var(--tui-text-02)}:host._disabled .cleaner,:host._readonly .cleaner{pointer-events:none}:host[data-mode=onDark] .cleaner{color:var(--tui-text-03-night)}:host[data-mode=onDark] .cleaner:hover{color:var(--tui-text-01-night)}.tooltip{pointer-events:auto}.counter{position:absolute;right:.75rem;bottom:.5rem;font:var(--tui-font-text-s);pointer-events:none;margin-top:auto;text-align:right;color:var(--tui-text-03)}:host[data-mode=onDark] .counter{color:var(--tui-text-03-night)}"]
|
|
162
162
|
}),
|
|
163
163
|
__param(0, Optional()),
|
|
164
164
|
__param(0, Self()),
|
|
@@ -94,5 +94,5 @@ TuiLazyLoadingModule = __decorate([
|
|
|
94
94
|
* Generated bundle index. Do not edit.
|
|
95
95
|
*/
|
|
96
96
|
|
|
97
|
-
export { TuiLazyLoadingDirective, TuiLazyLoadingModule, TuiLazyLoadingService
|
|
97
|
+
export { TuiLazyLoadingDirective, TuiLazyLoadingModule, TuiLazyLoadingService };
|
|
98
98
|
//# sourceMappingURL=taiga-ui-kit-directives-lazy-loading.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-kit-directives-lazy-loading.js","sources":["ng://@taiga-ui/kit/directives/lazy-loading/lazy-loading.service.ts","ng://@taiga-ui/kit/directives/lazy-loading/lazy-loading.directive.ts","ng://@taiga-ui/kit/directives/lazy-loading/lazy-loading.module.ts","ng://@taiga-ui/kit/directives/lazy-loading/taiga-ui-kit-directives-lazy-loading.ts"],"sourcesContent":["import {ChangeDetectorRef, Inject, Injectable} from '@angular/core';\nimport {IntersectionObserverService} from '@ng-web-apis/intersection-observer';\nimport {TuiDestroyService, watch} from '@taiga-ui/cdk';\nimport {Observable, of, Subject} from 'rxjs';\nimport {catchError, filter, mapTo, switchMap, take, takeUntil} from 'rxjs/operators';\n\n@Injectable()\nexport class TuiLazyLoadingService extends Observable<string> {\n private readonly src$ = new Subject<string>();\n\n constructor(\n @Inject(ChangeDetectorRef) changeDetectorRef: ChangeDetectorRef,\n @Inject(TuiDestroyService) destroy$: Observable<void>,\n @Inject(IntersectionObserverService)\n intersections$: Observable<IntersectionObserverEntry[]>,\n ) {\n super(subscriber =>\n this.src$\n .pipe(\n switchMap(src =>\n intersections$.pipe(\n filter(([{isIntersecting}]) => isIntersecting),\n mapTo(src),\n catchError(() => of(src)),\n watch(changeDetectorRef),\n take(1),\n ),\n ),\n takeUntil(destroy$),\n )\n .subscribe(subscriber),\n );\n }\n\n next(src: string) {\n this.src$.next(src);\n }\n}\n","import {\n Directive,\n ElementRef,\n HostBinding,\n HostListener,\n Inject,\n Input,\n} from '@angular/core';\nimport {IntersectionObserverService} from '@ng-web-apis/intersection-observer';\nimport {TuiDestroyService} from '@taiga-ui/cdk';\n\nimport {TuiLazyLoadingService} from './lazy-loading.service';\n\n@Directive({\n selector: 'img[loading=\"lazy\"]',\n providers: [TuiLazyLoadingService, IntersectionObserverService, TuiDestroyService],\n})\nexport class TuiLazyLoadingDirective {\n @Input('src')\n set srcSetter(src: string) {\n this.src = this.supported ? src : null;\n this.src$.next(src);\n }\n\n @HostBinding('style.animation')\n animation = 'tuiSkeletonVibe ease-in-out 1s infinite alternate';\n\n @HostBinding('style.background')\n background = 'rgba(0, 0, 0, .16)';\n\n @HostBinding('attr.src')\n src: string | null = null;\n\n constructor(\n @Inject(TuiLazyLoadingService)\n private readonly src$: TuiLazyLoadingService,\n @Inject(ElementRef)\n private readonly elementRef: ElementRef<HTMLImageElement>,\n ) {\n if (!this.supported) {\n this.src$.subscribe(src => {\n this.src = src;\n });\n }\n }\n\n private get supported() {\n return 'loading' in this.elementRef.nativeElement;\n }\n\n @HostListener('load')\n onLoad() {\n this.background = '';\n this.animation = '';\n }\n}\n","import {NgModule} from '@angular/core';\n\nimport {TuiLazyLoadingDirective} from './lazy-loading.directive';\n\n@NgModule({\n declarations: [TuiLazyLoadingDirective],\n exports: [TuiLazyLoadingDirective],\n})\nexport class TuiLazyLoadingModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n
|
|
1
|
+
{"version":3,"file":"taiga-ui-kit-directives-lazy-loading.js","sources":["ng://@taiga-ui/kit/directives/lazy-loading/lazy-loading.service.ts","ng://@taiga-ui/kit/directives/lazy-loading/lazy-loading.directive.ts","ng://@taiga-ui/kit/directives/lazy-loading/lazy-loading.module.ts","ng://@taiga-ui/kit/directives/lazy-loading/taiga-ui-kit-directives-lazy-loading.ts"],"sourcesContent":["import {ChangeDetectorRef, Inject, Injectable} from '@angular/core';\nimport {IntersectionObserverService} from '@ng-web-apis/intersection-observer';\nimport {TuiDestroyService, watch} from '@taiga-ui/cdk';\nimport {Observable, of, Subject} from 'rxjs';\nimport {catchError, filter, mapTo, switchMap, take, takeUntil} from 'rxjs/operators';\n\n@Injectable()\nexport class TuiLazyLoadingService extends Observable<string> {\n private readonly src$ = new Subject<string>();\n\n constructor(\n @Inject(ChangeDetectorRef) changeDetectorRef: ChangeDetectorRef,\n @Inject(TuiDestroyService) destroy$: Observable<void>,\n @Inject(IntersectionObserverService)\n intersections$: Observable<IntersectionObserverEntry[]>,\n ) {\n super(subscriber =>\n this.src$\n .pipe(\n switchMap(src =>\n intersections$.pipe(\n filter(([{isIntersecting}]) => isIntersecting),\n mapTo(src),\n catchError(() => of(src)),\n watch(changeDetectorRef),\n take(1),\n ),\n ),\n takeUntil(destroy$),\n )\n .subscribe(subscriber),\n );\n }\n\n next(src: string) {\n this.src$.next(src);\n }\n}\n","import {\n Directive,\n ElementRef,\n HostBinding,\n HostListener,\n Inject,\n Input,\n} from '@angular/core';\nimport {IntersectionObserverService} from '@ng-web-apis/intersection-observer';\nimport {TuiDestroyService} from '@taiga-ui/cdk';\n\nimport {TuiLazyLoadingService} from './lazy-loading.service';\n\n@Directive({\n selector: 'img[loading=\"lazy\"]',\n providers: [TuiLazyLoadingService, IntersectionObserverService, TuiDestroyService],\n})\nexport class TuiLazyLoadingDirective {\n @Input('src')\n set srcSetter(src: string) {\n this.src = this.supported ? src : null;\n this.src$.next(src);\n }\n\n @HostBinding('style.animation')\n animation = 'tuiSkeletonVibe ease-in-out 1s infinite alternate';\n\n @HostBinding('style.background')\n background = 'rgba(0, 0, 0, .16)';\n\n @HostBinding('attr.src')\n src: string | null = null;\n\n constructor(\n @Inject(TuiLazyLoadingService)\n private readonly src$: TuiLazyLoadingService,\n @Inject(ElementRef)\n private readonly elementRef: ElementRef<HTMLImageElement>,\n ) {\n if (!this.supported) {\n this.src$.subscribe(src => {\n this.src = src;\n });\n }\n }\n\n private get supported() {\n return 'loading' in this.elementRef.nativeElement;\n }\n\n @HostListener('load')\n onLoad() {\n this.background = '';\n this.animation = '';\n }\n}\n","import {NgModule} from '@angular/core';\n\nimport {TuiLazyLoadingDirective} from './lazy-loading.directive';\n\n@NgModule({\n declarations: [TuiLazyLoadingDirective],\n exports: [TuiLazyLoadingDirective],\n})\nexport class TuiLazyLoadingModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;IAOa,qBAAqB,GAAlC,MAAa,qBAAsB,SAAQ,UAAkB;IAGzD,YAC+B,iBAAoC,EACpC,QAA0B,EAErD,cAAuD;QAEvD,KAAK,CAAC,UAAU,IACZ,IAAI,CAAC,IAAI;aACJ,IAAI,CACD,SAAS,CAAC,GAAG,IACT,cAAc,CAAC,IAAI,CACf,MAAM,CAAC,CAAC,CAAC,EAAC,cAAc,EAAC,CAAC,KAAK,cAAc,CAAC,EAC9C,KAAK,CAAC,GAAG,CAAC,EACV,UAAU,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EACzB,KAAK,CAAC,iBAAiB,CAAC,EACxB,IAAI,CAAC,CAAC,CAAC,CACV,CACJ,EACD,SAAS,CAAC,QAAQ,CAAC,CACtB;aACA,SAAS,CAAC,UAAU,CAAC,CAC7B,CAAC;QAvBW,SAAI,GAAG,IAAI,OAAO,EAAU,CAAC;KAwB7C;IAED,IAAI,CAAC,GAAW;QACZ,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACvB;EACJ;;YA1BqD,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AC,iBAAiB,CAAC;0DACiC;AAGhE;IADC,WAAW,CAAC,kBAAkB,CAAC;2DACE;AAGlC;IADC,WAAW,CAAC,UAAU,CAAC;oDACE;AAoB1B;IADC,YAAY,CAAC,MAAM,CAAC;qDAIpB;AArCQ,uBAAuB;IAJnC,SAAS,CAAC;QACP,QAAQ,EAAE,qBAAqB;QAC/B,SAAS,EAAE,CAAC,qBAAqB,EAAE,2BAA2B,EAAE,iBAAiB,CAAC;KACrF,CAAC;IAkBO,WAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;IAE7B,WAAA,MAAM,CAAC,UAAU,CAAC,CAAA;GAnBd,uBAAuB,CAsCnC;;IC/CY,oBAAoB,GAAjC,MAAa,oBAAoB;EAAG;AAAvB,oBAAoB;IAJhC,QAAQ,CAAC;QACN,YAAY,EAAE,CAAC,uBAAuB,CAAC;QACvC,OAAO,EAAE,CAAC,uBAAuB,CAAC;KACrC,CAAC;GACW,oBAAoB,CAAG;;ACRpC;;;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __decorate, __param } from 'tslib';
|
|
2
|
-
import { Optional, Self, Inject, Pipe, NgModule } from '@angular/core';
|
|
2
|
+
import { Optional, Self, Inject, Pipe, Injector, NgModule } from '@angular/core';
|
|
3
|
+
import { AsyncPipe } from '@angular/common';
|
|
3
4
|
import { NgControl, FormArrayName, FormGroupName, FormGroupDirective } from '@angular/forms';
|
|
4
5
|
import { TuiValidationError, tuiPure } from '@taiga-ui/cdk';
|
|
5
6
|
import { TUI_VALIDATION_ERRORS } from '@taiga-ui/kit/tokens';
|
|
@@ -118,12 +119,42 @@ TuiFieldErrorPipe = __decorate([
|
|
|
118
119
|
__param(4, Inject(TUI_VALIDATION_ERRORS))
|
|
119
120
|
], TuiFieldErrorPipe);
|
|
120
121
|
|
|
122
|
+
// @dynamic
|
|
123
|
+
let TuiFieldErrorContentPipe = class TuiFieldErrorContentPipe {
|
|
124
|
+
constructor(injector) {
|
|
125
|
+
this.injector = injector;
|
|
126
|
+
this.localInjector = Injector.create({
|
|
127
|
+
providers: [{ provide: AsyncPipe }, { provide: TuiFieldErrorPipe }],
|
|
128
|
+
parent: this.injector,
|
|
129
|
+
});
|
|
130
|
+
this.asyncPipe = this.localInjector.get(AsyncPipe);
|
|
131
|
+
this.fieldErrorPipe = this.localInjector.get(TuiFieldErrorPipe);
|
|
132
|
+
}
|
|
133
|
+
transform(order) {
|
|
134
|
+
var _a;
|
|
135
|
+
return (((_a = this.asyncPipe.transform(this.fieldErrorPipe.transform(order))) === null || _a === void 0 ? void 0 : _a.message) || '');
|
|
136
|
+
}
|
|
137
|
+
ngOnDestroy() {
|
|
138
|
+
this.asyncPipe.ngOnDestroy();
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
TuiFieldErrorContentPipe.ctorParameters = () => [
|
|
142
|
+
{ type: Injector, decorators: [{ type: Inject, args: [Injector,] }] }
|
|
143
|
+
];
|
|
144
|
+
TuiFieldErrorContentPipe = __decorate([
|
|
145
|
+
Pipe({
|
|
146
|
+
name: 'tuiFieldErrorContent',
|
|
147
|
+
pure: false,
|
|
148
|
+
}),
|
|
149
|
+
__param(0, Inject(Injector))
|
|
150
|
+
], TuiFieldErrorContentPipe);
|
|
151
|
+
|
|
121
152
|
let TuiFieldErrorPipeModule = class TuiFieldErrorPipeModule {
|
|
122
153
|
};
|
|
123
154
|
TuiFieldErrorPipeModule = __decorate([
|
|
124
155
|
NgModule({
|
|
125
|
-
declarations: [TuiFieldErrorPipe],
|
|
126
|
-
exports: [TuiFieldErrorPipe],
|
|
156
|
+
declarations: [TuiFieldErrorPipe, TuiFieldErrorContentPipe],
|
|
157
|
+
exports: [TuiFieldErrorPipe, TuiFieldErrorContentPipe],
|
|
127
158
|
})
|
|
128
159
|
], TuiFieldErrorPipeModule);
|
|
129
160
|
|
|
@@ -131,5 +162,5 @@ TuiFieldErrorPipeModule = __decorate([
|
|
|
131
162
|
* Generated bundle index. Do not edit.
|
|
132
163
|
*/
|
|
133
164
|
|
|
134
|
-
export { TuiFieldErrorPipe, TuiFieldErrorPipeModule };
|
|
165
|
+
export { TuiFieldErrorContentPipe, TuiFieldErrorPipe, TuiFieldErrorPipeModule };
|
|
135
166
|
//# sourceMappingURL=taiga-ui-kit-pipes-field-error.js.map
|