@taiga-ui/addon-mobile 2.88.0 → 2.89.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-addon-mobile-components-pull-to-refresh.umd.js +229 -110
- package/bundles/taiga-ui-addon-mobile-components-pull-to-refresh.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-mobile-components-pull-to-refresh.umd.min.js +1 -1
- package/bundles/taiga-ui-addon-mobile-components-pull-to-refresh.umd.min.js.map +1 -1
- package/bundles/taiga-ui-addon-mobile-components-sheet.umd.js +11 -3
- package/bundles/taiga-ui-addon-mobile-components-sheet.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-mobile-components-sheet.umd.min.js +1 -1
- package/bundles/taiga-ui-addon-mobile-components-sheet.umd.min.js.map +1 -1
- package/bundles/taiga-ui-addon-mobile-directives-elastic-sticky.umd.js +14 -27
- package/bundles/taiga-ui-addon-mobile-directives-elastic-sticky.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-mobile-directives-elastic-sticky.umd.min.js +1 -1
- package/bundles/taiga-ui-addon-mobile-directives-elastic-sticky.umd.min.js.map +1 -1
- package/bundles/taiga-ui-addon-mobile.umd.js +4 -12
- package/bundles/taiga-ui-addon-mobile.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-mobile.umd.min.js +1 -1
- package/components/pull-to-refresh/index.d.ts +2 -0
- package/components/pull-to-refresh/loader-android/loader-android.component.d.ts +10 -2
- package/components/pull-to-refresh/loader-ios/loader-ios.component.d.ts +7 -1
- package/components/pull-to-refresh/pull-to-refresh.component.d.ts +10 -7
- package/components/pull-to-refresh/pull-to-refresh.providers.d.ts +15 -6
- package/components/pull-to-refresh/pull-to-refresh.service.d.ts +14 -0
- package/components/pull-to-refresh/pull-to-refresh.tokens.d.ts +5 -0
- package/components/pull-to-refresh/taiga-ui-addon-mobile-components-pull-to-refresh.metadata.json +1 -1
- package/components/sheet/sheet.service.d.ts +2 -1
- package/components/sheet/taiga-ui-addon-mobile-components-sheet.metadata.json +1 -1
- package/directives/elastic-sticky/elastic-sticky.service.d.ts +1 -2
- package/directives/elastic-sticky/taiga-ui-addon-mobile-directives-elastic-sticky.metadata.json +1 -1
- package/esm2015/components/pull-to-refresh/index.js +3 -1
- package/esm2015/components/pull-to-refresh/loader-android/loader-android.component.js +39 -16
- package/esm2015/components/pull-to-refresh/loader-ios/loader-ios.component.js +22 -13
- package/esm2015/components/pull-to-refresh/pull-to-refresh.component.js +46 -30
- package/esm2015/components/pull-to-refresh/pull-to-refresh.module.js +4 -3
- package/esm2015/components/pull-to-refresh/pull-to-refresh.providers.js +22 -27
- package/esm2015/components/pull-to-refresh/pull-to-refresh.service.js +52 -0
- package/esm2015/components/pull-to-refresh/pull-to-refresh.tokens.js +8 -0
- package/esm2015/components/sheet/sheet.service.js +16 -5
- package/esm2015/directives/elastic-sticky/elastic-sticky.service.js +12 -25
- package/esm2015/index.js +1 -2
- package/esm5/components/pull-to-refresh/index.js +3 -1
- package/esm5/components/pull-to-refresh/loader-android/loader-android.component.js +51 -16
- package/esm5/components/pull-to-refresh/loader-ios/loader-ios.component.js +26 -13
- package/esm5/components/pull-to-refresh/pull-to-refresh.component.js +48 -36
- package/esm5/components/pull-to-refresh/pull-to-refresh.module.js +4 -3
- package/esm5/components/pull-to-refresh/pull-to-refresh.providers.js +22 -32
- package/esm5/components/pull-to-refresh/pull-to-refresh.service.js +75 -0
- package/esm5/components/pull-to-refresh/pull-to-refresh.tokens.js +8 -0
- package/esm5/components/sheet/sheet.service.js +16 -5
- package/esm5/directives/elastic-sticky/elastic-sticky.service.js +13 -27
- package/esm5/index.js +1 -2
- package/fesm2015/taiga-ui-addon-mobile-components-pull-to-refresh.js +176 -90
- package/fesm2015/taiga-ui-addon-mobile-components-pull-to-refresh.js.map +1 -1
- package/fesm2015/taiga-ui-addon-mobile-components-sheet.js +12 -4
- package/fesm2015/taiga-ui-addon-mobile-components-sheet.js.map +1 -1
- package/fesm2015/taiga-ui-addon-mobile-directives-elastic-sticky.js +11 -24
- package/fesm2015/taiga-ui-addon-mobile-directives-elastic-sticky.js.map +1 -1
- package/fesm2015/taiga-ui-addon-mobile.js +0 -1
- package/fesm2015/taiga-ui-addon-mobile.js.map +1 -1
- package/fesm5/taiga-ui-addon-mobile-components-pull-to-refresh.js +226 -110
- package/fesm5/taiga-ui-addon-mobile-components-pull-to-refresh.js.map +1 -1
- package/fesm5/taiga-ui-addon-mobile-components-sheet.js +12 -4
- package/fesm5/taiga-ui-addon-mobile-components-sheet.js.map +1 -1
- package/fesm5/taiga-ui-addon-mobile-directives-elastic-sticky.js +12 -26
- package/fesm5/taiga-ui-addon-mobile-directives-elastic-sticky.js.map +1 -1
- package/fesm5/taiga-ui-addon-mobile.js +0 -1
- package/fesm5/taiga-ui-addon-mobile.js.map +1 -1
- package/index.d.ts +0 -1
- package/package.json +4 -4
- package/taiga-ui-addon-mobile.metadata.json +1 -1
- package/bundles/taiga-ui-addon-mobile-tokens.umd.js +0 -16
- package/bundles/taiga-ui-addon-mobile-tokens.umd.js.map +0 -1
- package/bundles/taiga-ui-addon-mobile-tokens.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-mobile-tokens.umd.min.js.map +0 -1
- package/esm2015/tokens/index.js +0 -2
- package/esm2015/tokens/loaded.js +0 -6
- package/esm2015/tokens/taiga-ui-addon-mobile-tokens.js +0 -5
- package/esm5/tokens/index.js +0 -2
- package/esm5/tokens/loaded.js +0 -6
- package/esm5/tokens/taiga-ui-addon-mobile-tokens.js +0 -5
- package/fesm2015/taiga-ui-addon-mobile-tokens.js +0 -13
- package/fesm2015/taiga-ui-addon-mobile-tokens.js.map +0 -1
- package/fesm5/taiga-ui-addon-mobile-tokens.js +0 -13
- package/fesm5/taiga-ui-addon-mobile-tokens.js.map +0 -1
- package/tokens/index.d.ts +0 -1
- package/tokens/loaded.d.ts +0 -3
- package/tokens/package.json +0 -13
- package/tokens/taiga-ui-addon-mobile-tokens.d.ts +0 -4
- package/tokens/taiga-ui-addon-mobile-tokens.metadata.json +0 -1
|
@@ -1,68 +1,43 @@
|
|
|
1
|
-
import { __decorate, __param } from 'tslib';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { __decorate, __param, __extends } from 'tslib';
|
|
2
|
+
import { InjectionToken, Inject, Component, ChangeDetectionStrategy, inject, ElementRef, Injectable, HostBinding, Self, Input, Output, NgModule } from '@angular/core';
|
|
3
|
+
import { POLYMORPHEUS_CONTEXT, PolymorpheusComponent, PolymorpheusModule } from '@tinkoff/ng-polymorpheus';
|
|
4
|
+
import { TUI_IS_IOS, tuiTypedFromEvent, tuiScrollFrom, TuiDestroyService, tuiDefaultProp, TuiRepeatTimesModule } from '@taiga-ui/cdk';
|
|
5
|
+
import { TUI_SCROLL_REF, TuiSvgModule } from '@taiga-ui/core';
|
|
6
|
+
import { EMPTY, Observable } from 'rxjs';
|
|
7
|
+
import { startWith, switchMap, filter, map, tap, takeUntil, endWith, scan, takeWhile, distinctUntilChanged, share } from 'rxjs/operators';
|
|
7
8
|
import { CommonModule } from '@angular/common';
|
|
8
|
-
import { TuiSvgModule } from '@taiga-ui/core';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
this.pulled = 0;
|
|
17
|
-
}
|
|
18
|
-
Object.defineProperty(TuiMobileLoaderAndroidComponent.prototype, "transform", {
|
|
19
|
-
get: function () {
|
|
20
|
-
var rotateX = Math.min(ROTATE_X_DEFAULT + this.pulled * ROTATE_X_MULTIPLIER, ROTATE_X_MAX);
|
|
21
|
-
return "rotate(" + rotateX + " 0 0)";
|
|
22
|
-
},
|
|
23
|
-
enumerable: true,
|
|
24
|
-
configurable: true
|
|
25
|
-
});
|
|
26
|
-
Object.defineProperty(TuiMobileLoaderAndroidComponent.prototype, "hidden", {
|
|
27
|
-
get: function () {
|
|
28
|
-
return this.pulled < HIDDEN_DISTANCE;
|
|
29
|
-
},
|
|
30
|
-
enumerable: true,
|
|
31
|
-
configurable: true
|
|
32
|
-
});
|
|
33
|
-
__decorate([
|
|
34
|
-
Input()
|
|
35
|
-
], TuiMobileLoaderAndroidComponent.prototype, "pulled", void 0);
|
|
36
|
-
__decorate([
|
|
37
|
-
HostBinding('class._hidden')
|
|
38
|
-
], TuiMobileLoaderAndroidComponent.prototype, "hidden", null);
|
|
39
|
-
TuiMobileLoaderAndroidComponent = __decorate([
|
|
40
|
-
Component({
|
|
41
|
-
selector: 'tui-mobile-android-loader',
|
|
42
|
-
template: "<svg\n *ngIf=\"pulled !== 100; else loading\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n [attr.transform]=\"transform\"\n>\n <defs>\n <mask id=\"mask-1\">\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M21 12C21 7.03 16.97 3 12 3C7.03 3 3 7.03 3 12C3 16.97 7.03 21 12 21C14.06 21 15.96 20.3 17.48 19.14L16.06 17.7C14.91 18.51 13.51 19 12 19C8.13 19 5 15.87 5 12C5 8.13 8.13 5 12 5C15.87 5 19 8.13 19 12H16L20 16L24 12H21Z\"\n fill=\"white\"\n />\n </mask>\n </defs>\n <g mask=\"url(#mask-1)\">\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M21 12C21 7.03 16.97 3 12 3C7.03 3 3 7.03 3 12C3 16.97 7.03 21 12 21C14.06 21 15.96 20.3 17.48 19.14L16.06 17.7C14.91 18.51 13.51 19 12 19C8.13 19 5 15.87 5 12C5 8.13 8.13 5 12 5C15.87 5 19 8.13 19 12H16L20 16L24 12H21Z\"\n fill=\"black\"\n />\n </g>\n</svg>\n<ng-template #loading>\n <svg\n viewBox=\"0 0 100 100\"\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"t-loading\"\n >\n <circle\n cx=\"50\"\n cy=\"50\"\n r=\"50\"\n stroke-dasharray=\"314\"\n class=\"t-circle\"\n ></circle>\n </svg>\n</ng-template>\n",
|
|
43
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
44
|
-
styles: [":host{box-shadow:0 .5rem 1rem rgba(0,0,0,.16);display:flex;height:2.25rem;width:2.25rem;background-color:#fff;border-radius:6.25rem;align-items:center;justify-content:center}:host._hidden{visibility:hidden;transition:none}.t-loading{display:block;width:1rem;border-radius:100%;animation:3s linear infinite tuiLoaderRotate}.t-circle{fill:none;stroke:var(--tui-text-01);stroke-width:1.5rem;animation:3s linear infinite tuiLoaderDashOffset}"]
|
|
45
|
-
})
|
|
46
|
-
], TuiMobileLoaderAndroidComponent);
|
|
47
|
-
return TuiMobileLoaderAndroidComponent;
|
|
48
|
-
}());
|
|
10
|
+
/**
|
|
11
|
+
* Pull threshold in pixels until loading starts
|
|
12
|
+
*/
|
|
13
|
+
var TUI_PULL_TO_REFRESH_THRESHOLD = new InjectionToken("[TUI_PULL_TO_REFRESH_THRESHOLD]", {
|
|
14
|
+
factory: function () { return 50; },
|
|
15
|
+
});
|
|
49
16
|
|
|
50
17
|
var LOADED_STEP = 8;
|
|
51
18
|
var ROTATE_X_STEP = 30;
|
|
52
19
|
var TuiMobileLoaderIOSComponent = /** @class */ (function () {
|
|
53
|
-
function TuiMobileLoaderIOSComponent() {
|
|
54
|
-
this.
|
|
20
|
+
function TuiMobileLoaderIOSComponent(context, threshold) {
|
|
21
|
+
this.context = context;
|
|
22
|
+
this.threshold = threshold;
|
|
55
23
|
this.steps = 12;
|
|
56
24
|
}
|
|
57
25
|
Object.defineProperty(TuiMobileLoaderIOSComponent.prototype, "finished", {
|
|
58
26
|
get: function () {
|
|
59
|
-
return this.
|
|
27
|
+
return this.percent >= 100;
|
|
28
|
+
},
|
|
29
|
+
enumerable: true,
|
|
30
|
+
configurable: true
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(TuiMobileLoaderIOSComponent.prototype, "percent", {
|
|
33
|
+
get: function () {
|
|
34
|
+
return (this.context.$implicit * 100) / this.threshold;
|
|
60
35
|
},
|
|
61
36
|
enumerable: true,
|
|
62
37
|
configurable: true
|
|
63
38
|
});
|
|
64
39
|
TuiMobileLoaderIOSComponent.prototype.isShown = function (index) {
|
|
65
|
-
return this.
|
|
40
|
+
return this.percent > (index + 1) * LOADED_STEP;
|
|
66
41
|
};
|
|
67
42
|
TuiMobileLoaderIOSComponent.prototype.calculateTransform = function (index) {
|
|
68
43
|
return "rotate(" + index * ROTATE_X_STEP + " 50 50)";
|
|
@@ -70,92 +45,233 @@ var TuiMobileLoaderIOSComponent = /** @class */ (function () {
|
|
|
70
45
|
TuiMobileLoaderIOSComponent.prototype.calculateAnimationBegin = function (index) {
|
|
71
46
|
return (index * LOADED_STEP) / 100 + "s";
|
|
72
47
|
};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
48
|
+
TuiMobileLoaderIOSComponent.ctorParameters = function () { return [
|
|
49
|
+
{ type: undefined, decorators: [{ type: Inject, args: [POLYMORPHEUS_CONTEXT,] }] },
|
|
50
|
+
{ type: Number, decorators: [{ type: Inject, args: [TUI_PULL_TO_REFRESH_THRESHOLD,] }] }
|
|
51
|
+
]; };
|
|
76
52
|
TuiMobileLoaderIOSComponent = __decorate([
|
|
77
53
|
Component({
|
|
78
54
|
selector: 'tui-mobile-ios-loader',
|
|
79
55
|
template: "<svg\n width=\"36\"\n height=\"36\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n viewBox=\"0 0 100 100\"\n preserveAspectRatio=\"xMidYMid\"\n>\n <ng-container *tuiRepeatTimes=\"let index of steps\">\n <g\n *ngIf=\"isShown(index)\"\n [attr.transform]=\"calculateTransform(index)\"\n >\n <rect\n x=\"47\"\n y=\"22\"\n rx=\"7.05\"\n ry=\"3.3\"\n width=\"6\"\n height=\"16\"\n fill=\"#c7c9cc\"\n >\n <animate\n *ngIf=\"finished\"\n attributeName=\"opacity\"\n values=\"1;0\"\n keyTimes=\"0;1\"\n dur=\"1s\"\n repeatCount=\"indefinite\"\n [attr.begin]=\"calculateAnimationBegin(index)\"\n ></animate>\n </rect>\n </g>\n </ng-container>\n</svg>\n",
|
|
80
56
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
81
|
-
|
|
82
|
-
})
|
|
57
|
+
styles: [":host{position:absolute;top:-.5rem;left:50%;margin-left:-1.125rem}"]
|
|
58
|
+
}),
|
|
59
|
+
__param(0, Inject(POLYMORPHEUS_CONTEXT)),
|
|
60
|
+
__param(1, Inject(TUI_PULL_TO_REFRESH_THRESHOLD))
|
|
83
61
|
], TuiMobileLoaderIOSComponent);
|
|
84
62
|
return TuiMobileLoaderIOSComponent;
|
|
85
63
|
}());
|
|
64
|
+
var TUI_IOS_LOADER = new PolymorpheusComponent(TuiMobileLoaderIOSComponent);
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Stream that emits when loading is over
|
|
68
|
+
*/
|
|
69
|
+
var TUI_PULL_TO_REFRESH_LOADED = new InjectionToken("[TUI_PULL_TO_REFRESH_LOADED]", {
|
|
70
|
+
factory: function () { return EMPTY; },
|
|
71
|
+
});
|
|
72
|
+
/**
|
|
73
|
+
* Loading indicator component that gets current pull distance in pixels as context
|
|
74
|
+
*/
|
|
75
|
+
var TUI_PULL_TO_REFRESH_COMPONENT = new InjectionToken("[TUI_PULL_TO_REFRESH_COMPONENT]", {
|
|
76
|
+
factory: function () { return (inject(TUI_IS_IOS) ? TUI_IOS_LOADER : TUI_ANDROID_LOADER); },
|
|
77
|
+
});
|
|
78
|
+
/**
|
|
79
|
+
* @deprecated renamed to {@link TUI_PULL_TO_REFRESH_LOADED}
|
|
80
|
+
*/
|
|
81
|
+
var TUI_LOADED = TUI_PULL_TO_REFRESH_LOADED;
|
|
86
82
|
|
|
87
83
|
var MICRO_OFFSET = Math.pow(10, -6);
|
|
88
|
-
|
|
89
|
-
var
|
|
90
|
-
|
|
91
|
-
{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
//
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
84
|
+
// @dynamic
|
|
85
|
+
var TuiPullToRefreshService = /** @class */ (function (_super) {
|
|
86
|
+
__extends(TuiPullToRefreshService, _super);
|
|
87
|
+
function TuiPullToRefreshService(el, scrollRef, loaded$, threshold, component) {
|
|
88
|
+
var _this = _super.call(this, function (subscriber) { return (component ? _this.pulling$ : EMPTY).subscribe(subscriber); }) || this;
|
|
89
|
+
_this.el = el;
|
|
90
|
+
_this.scrollRef = scrollRef;
|
|
91
|
+
_this.loaded$ = loaded$;
|
|
92
|
+
_this.threshold = threshold;
|
|
93
|
+
// Hack for iOS to determine if pulling stopped due to scroll
|
|
94
|
+
// because Safari does not support `touch-action: pan-down`
|
|
95
|
+
_this.touched = false;
|
|
96
|
+
_this.pulling$ = _this.loaded$.pipe(startWith(null), switchMap(function () {
|
|
97
|
+
return tuiTypedFromEvent(_this.element, "touchstart", { passive: true }).pipe(filter(function () { return !_this.scrollTop; }), map(function (_a) {
|
|
98
|
+
var touches = _a.touches;
|
|
99
|
+
return touches[0].clientY;
|
|
100
|
+
}), switchMap(function (start) {
|
|
101
|
+
return tuiTypedFromEvent(_this.element, "touchmove").pipe(tap(function () {
|
|
102
|
+
_this.touched = true;
|
|
103
|
+
}), map(function (_a) {
|
|
104
|
+
var touches = _a.touches;
|
|
105
|
+
return touches[0].clientY - start;
|
|
106
|
+
}), filter(function (distance) { return distance > 0; }), takeUntil(tuiTypedFromEvent(_this.element, "touchend").pipe(tap(function () {
|
|
107
|
+
_this.touched = false;
|
|
108
|
+
}))), takeUntil(tuiScrollFrom(_this.scrollRef.nativeElement)), endWith(0));
|
|
109
|
+
}), scan(function (prev, current) {
|
|
110
|
+
return !current && !_this.touched && prev > _this.threshold
|
|
111
|
+
? _this.threshold
|
|
112
|
+
: current + current * MICRO_OFFSET;
|
|
113
|
+
}, 0), takeWhile(function (distance) { return distance !== _this.threshold; }, true), startWith(0));
|
|
114
|
+
}), distinctUntilChanged(), share());
|
|
115
|
+
return _this;
|
|
116
|
+
}
|
|
117
|
+
Object.defineProperty(TuiPullToRefreshService.prototype, "element", {
|
|
118
|
+
get: function () {
|
|
119
|
+
return this.el.nativeElement;
|
|
120
|
+
},
|
|
121
|
+
enumerable: true,
|
|
122
|
+
configurable: true
|
|
123
|
+
});
|
|
124
|
+
Object.defineProperty(TuiPullToRefreshService.prototype, "scrollTop", {
|
|
125
|
+
get: function () {
|
|
126
|
+
return this.scrollRef.nativeElement.scrollTop;
|
|
127
|
+
},
|
|
128
|
+
enumerable: true,
|
|
129
|
+
configurable: true
|
|
130
|
+
});
|
|
131
|
+
TuiPullToRefreshService.ctorParameters = function () { return [
|
|
132
|
+
{ type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] },
|
|
133
|
+
{ type: ElementRef, decorators: [{ type: Inject, args: [TUI_SCROLL_REF,] }] },
|
|
134
|
+
{ type: Observable, decorators: [{ type: Inject, args: [TUI_PULL_TO_REFRESH_LOADED,] }] },
|
|
135
|
+
{ type: Number, decorators: [{ type: Inject, args: [TUI_PULL_TO_REFRESH_THRESHOLD,] }] },
|
|
136
|
+
{ type: undefined, decorators: [{ type: Inject, args: [TUI_PULL_TO_REFRESH_COMPONENT,] }] }
|
|
137
|
+
]; };
|
|
138
|
+
TuiPullToRefreshService = __decorate([
|
|
139
|
+
Injectable(),
|
|
140
|
+
__param(0, Inject(ElementRef)),
|
|
141
|
+
__param(1, Inject(TUI_SCROLL_REF)),
|
|
142
|
+
__param(2, Inject(TUI_PULL_TO_REFRESH_LOADED)),
|
|
143
|
+
__param(3, Inject(TUI_PULL_TO_REFRESH_THRESHOLD)),
|
|
144
|
+
__param(4, Inject(TUI_PULL_TO_REFRESH_COMPONENT))
|
|
145
|
+
], TuiPullToRefreshService);
|
|
146
|
+
return TuiPullToRefreshService;
|
|
147
|
+
}(Observable));
|
|
113
148
|
|
|
114
|
-
var
|
|
115
|
-
var
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
this.isIOS = isIOS;
|
|
122
|
-
this.pulling$ = pulling$;
|
|
123
|
-
this.pulled = this.pulling$.pipe(distinctUntilChanged(), filter(function (distance) { return distance === PULLED_DISTANCE; }), mapTo(undefined));
|
|
124
|
-
this.pulledInPercent$ = this.pulling$.pipe(map(function (distance) { return (distance * 100) / PULLED_DISTANCE; }));
|
|
125
|
-
this.dropped$ = this.pulling$.pipe(map(function (distance) { return distance <= MICRO_OFFSET || distance === PULLED_DISTANCE; }), distinctUntilChanged());
|
|
126
|
-
this.contentTransform$ = this.isIOS
|
|
127
|
-
? this.pulling$.pipe(map(function (distance) {
|
|
128
|
-
return distance === PULLED_DISTANCE ? IOS_LOADING_DISTANCE : distance;
|
|
129
|
-
}), map(translateY))
|
|
130
|
-
: of(null);
|
|
149
|
+
var ROTATE_X_DEFAULT = 180;
|
|
150
|
+
var ROTATE_X_MAX = 500;
|
|
151
|
+
var ROTATE_X_MULTIPLIER = 2.3;
|
|
152
|
+
var TuiMobileLoaderAndroidComponent = /** @class */ (function () {
|
|
153
|
+
function TuiMobileLoaderAndroidComponent(context, threshold) {
|
|
154
|
+
this.context = context;
|
|
155
|
+
this.threshold = threshold;
|
|
131
156
|
}
|
|
132
|
-
Object.defineProperty(
|
|
157
|
+
Object.defineProperty(TuiMobileLoaderAndroidComponent.prototype, "transform", {
|
|
158
|
+
get: function () {
|
|
159
|
+
var rotateX = Math.min(ROTATE_X_DEFAULT + this.percent * ROTATE_X_MULTIPLIER, ROTATE_X_MAX);
|
|
160
|
+
return "rotate(" + rotateX + " 0 0)";
|
|
161
|
+
},
|
|
162
|
+
enumerable: true,
|
|
163
|
+
configurable: true
|
|
164
|
+
});
|
|
165
|
+
Object.defineProperty(TuiMobileLoaderAndroidComponent.prototype, "percent", {
|
|
166
|
+
get: function () {
|
|
167
|
+
return (this.context.$implicit * 100) / this.threshold;
|
|
168
|
+
},
|
|
169
|
+
enumerable: true,
|
|
170
|
+
configurable: true
|
|
171
|
+
});
|
|
172
|
+
Object.defineProperty(TuiMobileLoaderAndroidComponent.prototype, "opacity", {
|
|
173
|
+
get: function () {
|
|
174
|
+
return this.context.$implicit / (this.threshold * 1.5);
|
|
175
|
+
},
|
|
176
|
+
enumerable: true,
|
|
177
|
+
configurable: true
|
|
178
|
+
});
|
|
179
|
+
Object.defineProperty(TuiMobileLoaderAndroidComponent.prototype, "dropped", {
|
|
180
|
+
get: function () {
|
|
181
|
+
return (this.context.$implicit <= MICRO_OFFSET ||
|
|
182
|
+
this.context.$implicit === this.threshold);
|
|
183
|
+
},
|
|
184
|
+
enumerable: true,
|
|
185
|
+
configurable: true
|
|
186
|
+
});
|
|
187
|
+
Object.defineProperty(TuiMobileLoaderAndroidComponent.prototype, "hostTransform", {
|
|
133
188
|
get: function () {
|
|
134
|
-
return
|
|
189
|
+
return "translateY(" + Math.min(this.context.$implicit, this.threshold * 1.5) + "px)";
|
|
135
190
|
},
|
|
136
191
|
enumerable: true,
|
|
137
192
|
configurable: true
|
|
138
193
|
});
|
|
194
|
+
TuiMobileLoaderAndroidComponent.ctorParameters = function () { return [
|
|
195
|
+
{ type: undefined, decorators: [{ type: Inject, args: [POLYMORPHEUS_CONTEXT,] }] },
|
|
196
|
+
{ type: Number, decorators: [{ type: Inject, args: [TUI_PULL_TO_REFRESH_THRESHOLD,] }] }
|
|
197
|
+
]; };
|
|
198
|
+
__decorate([
|
|
199
|
+
HostBinding('class._visible')
|
|
200
|
+
], TuiMobileLoaderAndroidComponent.prototype, "percent", null);
|
|
201
|
+
__decorate([
|
|
202
|
+
HostBinding('class._dropped')
|
|
203
|
+
], TuiMobileLoaderAndroidComponent.prototype, "dropped", null);
|
|
204
|
+
__decorate([
|
|
205
|
+
HostBinding('style.transform')
|
|
206
|
+
], TuiMobileLoaderAndroidComponent.prototype, "hostTransform", null);
|
|
207
|
+
TuiMobileLoaderAndroidComponent = __decorate([
|
|
208
|
+
Component({
|
|
209
|
+
selector: 'tui-mobile-android-loader',
|
|
210
|
+
template: "<div class=\"t-wrapper\">\n <svg\n *ngIf=\"percent !== 100; else loading\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n [attr.transform]=\"transform\"\n [style.opacity]=\"opacity\"\n >\n <defs>\n <mask id=\"mask-1\">\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M21 12C21 7.03 16.97 3 12 3C7.03 3 3 7.03 3 12C3 16.97 7.03 21 12 21C14.06 21 15.96 20.3 17.48 19.14L16.06 17.7C14.91 18.51 13.51 19 12 19C8.13 19 5 15.87 5 12C5 8.13 8.13 5 12 5C15.87 5 19 8.13 19 12H16L20 16L24 12H21Z\"\n fill=\"white\"\n />\n </mask>\n </defs>\n <g mask=\"url(#mask-1)\">\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M21 12C21 7.03 16.97 3 12 3C7.03 3 3 7.03 3 12C3 16.97 7.03 21 12 21C14.06 21 15.96 20.3 17.48 19.14L16.06 17.7C14.91 18.51 13.51 19 12 19C8.13 19 5 15.87 5 12C5 8.13 8.13 5 12 5C15.87 5 19 8.13 19 12H16L20 16L24 12H21Z\"\n fill=\"black\"\n />\n </g>\n </svg>\n</div>\n<ng-template #loading>\n <svg\n viewBox=\"0 0 100 100\"\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"t-loading\"\n >\n <circle\n cx=\"50\"\n cy=\"50\"\n r=\"50\"\n stroke-dasharray=\"314\"\n class=\"t-circle\"\n ></circle>\n </svg>\n</ng-template>\n",
|
|
211
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
212
|
+
styles: [":host{transition-property:opacity;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;position:-webkit-sticky;position:sticky;top:0;z-index:1;display:block;height:0;opacity:0}:host._visible{opacity:1}:host._dropped{transition:transform var(--tui-duration) cubic-bezier(.4,0,.2,1),opacity var(--tui-duration) var(--tui-duration)}.t-wrapper{box-shadow:0 .5rem 1rem rgba(0,0,0,.16);position:absolute;top:-2.5rem;left:50%;display:flex;height:2.25rem;width:2.25rem;background-color:var(--tui-secondary);border-radius:6.25rem;align-items:center;justify-content:center;margin-left:-1.125rem}.t-loading{display:block;width:1rem;border-radius:100%;animation:3s linear infinite tuiLoaderRotate}.t-circle{fill:none;stroke:var(--tui-text-01);stroke-width:1.5rem;animation:3s linear infinite tuiLoaderDashOffset}@keyframes tuiLoaderDashOffset{0%,100%{stroke-dashoffset:-66}50%{stroke-dashoffset:-314}}@keyframes tuiLoaderRotate{0%{transform:rotate(0)}50%{transform:rotate(1turn)}100%{transform:rotate(3turn)}}"]
|
|
213
|
+
}),
|
|
214
|
+
__param(0, Inject(POLYMORPHEUS_CONTEXT)),
|
|
215
|
+
__param(1, Inject(TUI_PULL_TO_REFRESH_THRESHOLD))
|
|
216
|
+
], TuiMobileLoaderAndroidComponent);
|
|
217
|
+
return TuiMobileLoaderAndroidComponent;
|
|
218
|
+
}());
|
|
219
|
+
var TUI_ANDROID_LOADER = new PolymorpheusComponent(TuiMobileLoaderAndroidComponent);
|
|
220
|
+
|
|
221
|
+
var TuiPullToRefreshComponent = /** @class */ (function () {
|
|
222
|
+
function TuiPullToRefreshComponent(destroy$, _a, isIOS, threshold, component, pulling$) {
|
|
223
|
+
var _this = this;
|
|
224
|
+
var nativeElement = _a.nativeElement;
|
|
225
|
+
this.isIOS = isIOS;
|
|
226
|
+
this.threshold = threshold;
|
|
227
|
+
this.component = component;
|
|
228
|
+
this.pulling$ = pulling$;
|
|
229
|
+
this.styleHandler = this.isIOS
|
|
230
|
+
? function (distance) { return ({ transform: "translateY(" + distance / 2 + "px)" }); }
|
|
231
|
+
: function () { return null; };
|
|
232
|
+
this.pulled = this.pulling$.pipe(filter(function (distance) { return distance === _this.threshold; }));
|
|
233
|
+
this.dropped$ = this.pulling$.pipe(map(function (distance) { return distance <= MICRO_OFFSET || distance === _this.threshold; }), distinctUntilChanged());
|
|
234
|
+
// Ensure scrolling down is impossible while pulling
|
|
235
|
+
tuiScrollFrom(nativeElement)
|
|
236
|
+
.pipe(startWith(null), takeUntil(destroy$))
|
|
237
|
+
.subscribe(function () {
|
|
238
|
+
if (nativeElement.scrollTop) {
|
|
239
|
+
nativeElement.style.touchAction = '';
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
nativeElement.style.touchAction = 'pan-down';
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
}
|
|
139
246
|
TuiPullToRefreshComponent.ctorParameters = function () { return [
|
|
247
|
+
{ type: Observable, decorators: [{ type: Inject, args: [TuiDestroyService,] }, { type: Self }] },
|
|
248
|
+
{ type: ElementRef, decorators: [{ type: Inject, args: [TUI_SCROLL_REF,] }] },
|
|
140
249
|
{ type: Boolean, decorators: [{ type: Inject, args: [TUI_IS_IOS,] }] },
|
|
141
|
-
{ type:
|
|
250
|
+
{ type: Number, decorators: [{ type: Inject, args: [TUI_PULL_TO_REFRESH_THRESHOLD,] }] },
|
|
251
|
+
{ type: undefined, decorators: [{ type: Inject, args: [TUI_PULL_TO_REFRESH_COMPONENT,] }] },
|
|
252
|
+
{ type: Observable, decorators: [{ type: Inject, args: [TuiPullToRefreshService,] }] }
|
|
142
253
|
]; };
|
|
254
|
+
__decorate([
|
|
255
|
+
Input(),
|
|
256
|
+
tuiDefaultProp()
|
|
257
|
+
], TuiPullToRefreshComponent.prototype, "styleHandler", void 0);
|
|
143
258
|
__decorate([
|
|
144
259
|
Output()
|
|
145
260
|
], TuiPullToRefreshComponent.prototype, "pulled", void 0);
|
|
146
|
-
__decorate([
|
|
147
|
-
tuiPure
|
|
148
|
-
], TuiPullToRefreshComponent.prototype, "loaderTransform$", null);
|
|
149
261
|
TuiPullToRefreshComponent = __decorate([
|
|
150
262
|
Component({
|
|
151
263
|
selector: 'tui-pull-to-refresh',
|
|
152
|
-
template: "<div\n
|
|
264
|
+
template: "<div\n polymorpheus-outlet\n [content]=\"component\"\n [context]=\"{$implicit: (pulling$ | async) || 0}\"\n></div>\n\n<div\n [class.t-drop]=\"dropped$ | async\"\n [ngStyle]=\"styleHandler((pulling$ | async) || 0)\"\n>\n <ng-content></ng-content>\n</div>\n",
|
|
153
265
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
154
|
-
providers: [
|
|
155
|
-
styles: ["
|
|
266
|
+
providers: [TuiPullToRefreshService, TuiDestroyService],
|
|
267
|
+
styles: [".t-drop{transition:all var(--tui-duration) cubic-bezier(.4,0,.2,1)}"]
|
|
156
268
|
}),
|
|
157
|
-
__param(0, Inject(
|
|
158
|
-
__param(1, Inject(
|
|
269
|
+
__param(0, Inject(TuiDestroyService)), __param(0, Self()),
|
|
270
|
+
__param(1, Inject(TUI_SCROLL_REF)),
|
|
271
|
+
__param(2, Inject(TUI_IS_IOS)),
|
|
272
|
+
__param(3, Inject(TUI_PULL_TO_REFRESH_THRESHOLD)),
|
|
273
|
+
__param(4, Inject(TUI_PULL_TO_REFRESH_COMPONENT)),
|
|
274
|
+
__param(5, Inject(TuiPullToRefreshService))
|
|
159
275
|
], TuiPullToRefreshComponent);
|
|
160
276
|
return TuiPullToRefreshComponent;
|
|
161
277
|
}());
|
|
@@ -165,7 +281,7 @@ var TuiPullToRefreshModule = /** @class */ (function () {
|
|
|
165
281
|
}
|
|
166
282
|
TuiPullToRefreshModule = __decorate([
|
|
167
283
|
NgModule({
|
|
168
|
-
imports: [CommonModule, TuiSvgModule,
|
|
284
|
+
imports: [CommonModule, TuiSvgModule, TuiRepeatTimesModule, PolymorpheusModule],
|
|
169
285
|
declarations: [
|
|
170
286
|
TuiPullToRefreshComponent,
|
|
171
287
|
TuiMobileLoaderAndroidComponent,
|
|
@@ -181,5 +297,5 @@ var TuiPullToRefreshModule = /** @class */ (function () {
|
|
|
181
297
|
* Generated bundle index. Do not edit.
|
|
182
298
|
*/
|
|
183
299
|
|
|
184
|
-
export { MICRO_OFFSET,
|
|
300
|
+
export { MICRO_OFFSET, TUI_ANDROID_LOADER, TUI_IOS_LOADER, TUI_LOADED, TUI_PULL_TO_REFRESH_COMPONENT, TUI_PULL_TO_REFRESH_LOADED, TUI_PULL_TO_REFRESH_THRESHOLD, TuiMobileLoaderAndroidComponent, TuiMobileLoaderIOSComponent, TuiPullToRefreshComponent, TuiPullToRefreshModule, TuiPullToRefreshService };
|
|
185
301
|
//# sourceMappingURL=taiga-ui-addon-mobile-components-pull-to-refresh.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-addon-mobile-components-pull-to-refresh.js","sources":["ng://@taiga-ui/addon-mobile/components/pull-to-refresh/loader-android/loader-android.component.ts","ng://@taiga-ui/addon-mobile/components/pull-to-refresh/loader-ios/loader-ios.component.ts","ng://@taiga-ui/addon-mobile/components/pull-to-refresh/pull-to-refresh.providers.ts","ng://@taiga-ui/addon-mobile/components/pull-to-refresh/pull-to-refresh.component.ts","ng://@taiga-ui/addon-mobile/components/pull-to-refresh/pull-to-refresh.module.ts","ng://@taiga-ui/addon-mobile/components/pull-to-refresh/taiga-ui-addon-mobile-components-pull-to-refresh.ts"],"sourcesContent":["import {ChangeDetectionStrategy, Component, HostBinding, Input} from '@angular/core';\n\nconst HIDDEN_DISTANCE = 2;\nconst ROTATE_X_DEFAULT = 180;\nconst ROTATE_X_MAX = 500;\nconst ROTATE_X_MULTIPLIER = 2.3;\n\n@Component({\n selector: 'tui-mobile-android-loader',\n templateUrl: './loader-android.template.html',\n styleUrls: ['./loader-android.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiMobileLoaderAndroidComponent {\n @Input()\n pulled = 0;\n\n get transform(): string {\n const rotateX = Math.min(\n ROTATE_X_DEFAULT + this.pulled * ROTATE_X_MULTIPLIER,\n ROTATE_X_MAX,\n );\n\n return `rotate(${rotateX} 0 0)`;\n }\n\n @HostBinding('class._hidden')\n get hidden(): boolean {\n return this.pulled < HIDDEN_DISTANCE;\n }\n}\n","import {ChangeDetectionStrategy, Component, Input} from '@angular/core';\nimport {TuiDestroyService} from '@taiga-ui/cdk';\n\nconst LOADED_STEP = 8;\nconst ROTATE_X_STEP = 30;\n\n@Component({\n selector: 'tui-mobile-ios-loader',\n templateUrl: './loader-ios.template.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [TuiDestroyService],\n})\nexport class TuiMobileLoaderIOSComponent {\n @Input()\n pulled = 0;\n\n readonly steps = 12;\n\n get finished(): boolean {\n return this.pulled >= 100;\n }\n\n isShown(index: number): boolean {\n return this.pulled > (index + 1) * LOADED_STEP;\n }\n\n calculateTransform(index: number): string {\n return `rotate(${index * ROTATE_X_STEP} 50 50)`;\n }\n\n calculateAnimationBegin(index: number): string {\n return `${(index * LOADED_STEP) / 100}s`;\n }\n}\n","import {ElementRef, InjectionToken, Provider} from '@angular/core';\nimport {TUI_LOADED} from '@taiga-ui/addon-mobile/tokens';\nimport {TUI_IS_IOS, typedFromEvent} from '@taiga-ui/cdk';\nimport {merge, Observable} from 'rxjs';\nimport {endWith, filter, map, mapTo, scan, switchMap, takeUntil} from 'rxjs/operators';\n\nexport const MICRO_OFFSET = 10 ** -6;\nexport const PULLED_DISTANCE = 50;\n\nexport const TUI_PULLING = new InjectionToken<Observable<number>>(\n `Stream that emits content pulling`,\n);\n\nexport const TUI_PULL_TO_REFRESH_PROVIDERS: Provider[] = [\n {\n provide: TUI_PULLING,\n deps: [TUI_IS_IOS, TUI_LOADED, ElementRef],\n useFactory: pullingFactory,\n },\n];\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function pullingFactory(\n isIOS: boolean,\n loaded$: Observable<unknown>,\n {nativeElement}: ElementRef<HTMLElement>,\n): Observable<number> {\n return merge(\n typedFromEvent(nativeElement, `touchstart`, {passive: true}).pipe(\n filter(() => nativeElement.scrollTop === 0),\n switchMap(touchStart =>\n typedFromEvent(nativeElement, `touchmove`).pipe(\n map(\n touchMove =>\n touchMove.touches[0].clientY - touchStart.touches[0].clientY,\n ),\n takeUntil(typedFromEvent(nativeElement, `touchend`)),\n endWith(0),\n ),\n ),\n ),\n loaded$.pipe(mapTo(NaN)),\n ).pipe(\n scan((max, current) => {\n if (Number.isNaN(current)) {\n return 0;\n }\n\n const androidLoading = !isIOS && max === PULLED_DISTANCE;\n const dropped = current === 0 && max > PULLED_DISTANCE;\n\n return androidLoading || dropped ? PULLED_DISTANCE : current + MICRO_OFFSET;\n }, 0),\n );\n}\n","import {ChangeDetectionStrategy, Component, Inject, Output} from '@angular/core';\nimport {TUI_IS_IOS, tuiPure} from '@taiga-ui/cdk';\nimport {Observable, of} from 'rxjs';\nimport {distinctUntilChanged, filter, map, mapTo} from 'rxjs/operators';\n\nimport {\n MICRO_OFFSET,\n PULLED_DISTANCE,\n TUI_PULL_TO_REFRESH_PROVIDERS,\n TUI_PULLING,\n} from './pull-to-refresh.providers';\n\nconst IOS_LOADING_DISTANCE = PULLED_DISTANCE / 2;\nconst ANDROID_MAX_DISTANCE = PULLED_DISTANCE * 1.5;\n\nfunction translateY(distance: number): string {\n return `translateY(${distance}px)`;\n}\n\n@Component({\n selector: 'tui-pull-to-refresh',\n templateUrl: './pull-to-refresh.template.html',\n styleUrls: ['./pull-to-refresh.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [TUI_PULL_TO_REFRESH_PROVIDERS],\n})\nexport class TuiPullToRefreshComponent {\n @Output()\n readonly pulled: Observable<void> = this.pulling$.pipe(\n distinctUntilChanged(),\n filter(distance => distance === PULLED_DISTANCE),\n mapTo(undefined),\n );\n\n readonly pulledInPercent$: Observable<number> = this.pulling$.pipe(\n map(distance => (distance * 100) / PULLED_DISTANCE),\n );\n\n readonly dropped$: Observable<boolean> = this.pulling$.pipe(\n map(distance => distance <= MICRO_OFFSET || distance === PULLED_DISTANCE),\n distinctUntilChanged(),\n );\n\n readonly contentTransform$: Observable<string | null> = this.isIOS\n ? this.pulling$.pipe(\n map(distance =>\n distance === PULLED_DISTANCE ? IOS_LOADING_DISTANCE : distance,\n ),\n map(translateY),\n )\n : of(null);\n\n constructor(\n @Inject(TUI_IS_IOS) readonly isIOS: boolean,\n @Inject(TUI_PULLING) private readonly pulling$: Observable<number>,\n ) {}\n\n @tuiPure\n get loaderTransform$(): Observable<string> {\n return this.pulling$.pipe(\n map(distance => translateY(Math.min(distance, ANDROID_MAX_DISTANCE))),\n );\n }\n}\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {TuiOverscrollModule, TuiRepeatTimesModule} from '@taiga-ui/cdk';\nimport {TuiSvgModule} from '@taiga-ui/core';\n\nimport {TuiMobileLoaderAndroidComponent} from './loader-android/loader-android.component';\nimport {TuiMobileLoaderIOSComponent} from './loader-ios/loader-ios.component';\nimport {TuiPullToRefreshComponent} from './pull-to-refresh.component';\n\n@NgModule({\n imports: [CommonModule, TuiSvgModule, TuiOverscrollModule, TuiRepeatTimesModule],\n declarations: [\n TuiPullToRefreshComponent,\n TuiMobileLoaderAndroidComponent,\n TuiMobileLoaderIOSComponent,\n ],\n exports: [TuiPullToRefreshComponent],\n})\nexport class TuiPullToRefreshModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAEA,IAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,IAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,IAAM,YAAY,GAAG,GAAG,CAAC;AACzB,IAAM,mBAAmB,GAAG,GAAG,CAAC;;IAQhC;QAEI,WAAM,GAAG,CAAC,CAAC;KAed;IAbG,sBAAI,sDAAS;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AKX;IAGJ,sBAAI,uDAAgB;aAApB;YACI,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CACrB,GAAG,CAAC,UAAA,QAAQ,IAAI,OAAA,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC,GAAA,CAAC,CACxE,CAAC;SACL;;;OAAA;;8CATI,MAAM,SAAC,UAAU;gBAC8B,UAAU,uBAAzD,MAAM,SAAC,WAAW;;IA1BvB;QADC,MAAM,EAAE;6DAKP;IA0BF;QADC,OAAO;qEAKP;IApCQ,yBAAyB;QAPrC,SAAS,CAAC;YACP,QAAQ,EAAE,qBAAqB;YAC/B,gqBAA8C;YAE9C,eAAe,EAAE,uBAAuB,CAAC,MAAM;YAC/C,SAAS,EAAE,CAAC,6BAA6B,CAAC;;SAC7C,CAAC;QA4BO,WAAA,MAAM,CAAC,UAAU,CAAC,CAAA;QAClB,WAAA,MAAM,CAAC,WAAW,CAAC,CAAA;OA5Bf,yBAAyB,CAqCrC;IAAD,gCAAC;CArCD;;;ICRA;KAAsC;IAAzB,sBAAsB;QATlC,QAAQ,CAAC;YACN,OAAO,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,CAAC;YAChF,YAAY,EAAE;gBACV,yBAAyB;gBACzB,+BAA+B;gBAC/B,2BAA2B;aAC9B;YACD,OAAO,EAAE,CAAC,yBAAyB,CAAC;SACvC,CAAC;OACW,sBAAsB,CAAG;IAAD,6BAAC;CAAtC;;AClBA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-addon-mobile-components-pull-to-refresh.js","sources":["ng://@taiga-ui/addon-mobile/components/pull-to-refresh/pull-to-refresh.tokens.ts","ng://@taiga-ui/addon-mobile/components/pull-to-refresh/loader-ios/loader-ios.component.ts","ng://@taiga-ui/addon-mobile/components/pull-to-refresh/pull-to-refresh.providers.ts","ng://@taiga-ui/addon-mobile/components/pull-to-refresh/pull-to-refresh.service.ts","ng://@taiga-ui/addon-mobile/components/pull-to-refresh/loader-android/loader-android.component.ts","ng://@taiga-ui/addon-mobile/components/pull-to-refresh/pull-to-refresh.component.ts","ng://@taiga-ui/addon-mobile/components/pull-to-refresh/pull-to-refresh.module.ts","ng://@taiga-ui/addon-mobile/components/pull-to-refresh/taiga-ui-addon-mobile-components-pull-to-refresh.ts"],"sourcesContent":["import {InjectionToken} from '@angular/core';\n\n/**\n * Pull threshold in pixels until loading starts\n */\n\nexport const TUI_PULL_TO_REFRESH_THRESHOLD = new InjectionToken<number>(\n `[TUI_PULL_TO_REFRESH_THRESHOLD]`,\n {\n factory: () => 50,\n },\n);\n","import {ChangeDetectionStrategy, Component, Inject} from '@angular/core';\nimport {TuiContextWithImplicit} from '@taiga-ui/cdk';\nimport {POLYMORPHEUS_CONTEXT, PolymorpheusComponent} from '@tinkoff/ng-polymorpheus';\n\nimport {TUI_PULL_TO_REFRESH_THRESHOLD} from '../pull-to-refresh.tokens';\n\nconst LOADED_STEP = 8;\nconst ROTATE_X_STEP = 30;\n\n@Component({\n selector: 'tui-mobile-ios-loader',\n templateUrl: './loader-ios.template.html',\n styleUrls: ['./loader-ios.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiMobileLoaderIOSComponent {\n readonly steps = 12;\n\n constructor(\n @Inject(POLYMORPHEUS_CONTEXT)\n private readonly context: TuiContextWithImplicit<number>,\n @Inject(TUI_PULL_TO_REFRESH_THRESHOLD) private readonly threshold: number,\n ) {}\n\n get finished(): boolean {\n return this.percent >= 100;\n }\n\n get percent(): number {\n return (this.context.$implicit * 100) / this.threshold;\n }\n\n isShown(index: number): boolean {\n return this.percent > (index + 1) * LOADED_STEP;\n }\n\n calculateTransform(index: number): string {\n return `rotate(${index * ROTATE_X_STEP} 50 50)`;\n }\n\n calculateAnimationBegin(index: number): string {\n return `${(index * LOADED_STEP) / 100}s`;\n }\n}\n\nexport const TUI_IOS_LOADER = new PolymorpheusComponent(TuiMobileLoaderIOSComponent);\n","import {inject, InjectionToken} from '@angular/core';\nimport {TUI_IS_IOS, TuiContextWithImplicit} from '@taiga-ui/cdk';\nimport {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';\nimport {EMPTY, Observable} from 'rxjs';\n\nimport {TUI_ANDROID_LOADER} from './loader-android/loader-android.component';\nimport {TUI_IOS_LOADER} from './loader-ios/loader-ios.component';\n\n/**\n * Stream that emits when loading is over\n */\nexport const TUI_PULL_TO_REFRESH_LOADED = new InjectionToken<Observable<unknown>>(\n `[TUI_PULL_TO_REFRESH_LOADED]`,\n {\n factory: () => EMPTY,\n },\n);\n\n/**\n * Loading indicator component that gets current pull distance in pixels as context\n */\nexport const TUI_PULL_TO_REFRESH_COMPONENT = new InjectionToken<\n PolymorpheusContent<TuiContextWithImplicit<number>>\n>(`[TUI_PULL_TO_REFRESH_COMPONENT]`, {\n factory: () => (inject(TUI_IS_IOS) ? TUI_IOS_LOADER : TUI_ANDROID_LOADER),\n});\n\n/**\n * @deprecated renamed to {@link TUI_PULL_TO_REFRESH_LOADED}\n */\nexport const TUI_LOADED = TUI_PULL_TO_REFRESH_LOADED;\n","import {ElementRef, Inject, Injectable} from '@angular/core';\nimport {tuiScrollFrom, tuiTypedFromEvent} from '@taiga-ui/cdk';\nimport {TUI_SCROLL_REF} from '@taiga-ui/core';\nimport {EMPTY, Observable} from 'rxjs';\nimport {\n distinctUntilChanged,\n endWith,\n filter,\n map,\n scan,\n share,\n startWith,\n switchMap,\n takeUntil,\n takeWhile,\n tap,\n} from 'rxjs/operators';\n\nimport {\n TUI_PULL_TO_REFRESH_COMPONENT,\n TUI_PULL_TO_REFRESH_LOADED,\n} from './pull-to-refresh.providers';\nimport {TUI_PULL_TO_REFRESH_THRESHOLD} from './pull-to-refresh.tokens';\n\nexport const MICRO_OFFSET = 10 ** -6;\n\n// @dynamic\n@Injectable()\nexport class TuiPullToRefreshService extends Observable<number> {\n // Hack for iOS to determine if pulling stopped due to scroll\n // because Safari does not support `touch-action: pan-down`\n private touched = false;\n\n private readonly pulling$ = this.loaded$.pipe(\n startWith(null),\n switchMap(() =>\n tuiTypedFromEvent(this.element, `touchstart`, {passive: true}).pipe(\n filter(() => !this.scrollTop),\n map(({touches}) => touches[0].clientY),\n switchMap(start =>\n tuiTypedFromEvent(this.element, `touchmove`).pipe(\n tap((): void => {\n this.touched = true;\n }),\n map(({touches}) => touches[0].clientY - start),\n filter(distance => distance > 0),\n takeUntil(\n tuiTypedFromEvent(this.element, `touchend`).pipe(\n tap((): void => {\n this.touched = false;\n }),\n ),\n ),\n takeUntil(tuiScrollFrom(this.scrollRef.nativeElement)),\n endWith(0),\n ),\n ),\n scan(\n (prev, current) =>\n !current && !this.touched && prev > this.threshold\n ? this.threshold\n : current + current * MICRO_OFFSET,\n 0,\n ),\n takeWhile(distance => distance !== this.threshold, true),\n startWith(0),\n ),\n ),\n distinctUntilChanged(),\n share(),\n );\n\n constructor(\n @Inject(ElementRef) private readonly el: ElementRef<HTMLElement>,\n @Inject(TUI_SCROLL_REF) private readonly scrollRef: ElementRef<HTMLElement>,\n @Inject(TUI_PULL_TO_REFRESH_LOADED) private readonly loaded$: Observable<unknown>,\n @Inject(TUI_PULL_TO_REFRESH_THRESHOLD) private readonly threshold: number,\n @Inject(TUI_PULL_TO_REFRESH_COMPONENT) component: unknown,\n ) {\n super(subscriber => (component ? this.pulling$ : EMPTY).subscribe(subscriber));\n }\n\n private get element(): HTMLElement {\n return this.el.nativeElement;\n }\n\n private get scrollTop(): number {\n return this.scrollRef.nativeElement.scrollTop;\n }\n}\n","import {ChangeDetectionStrategy, Component, HostBinding, Inject} from '@angular/core';\nimport {TuiContextWithImplicit} from '@taiga-ui/cdk';\nimport {POLYMORPHEUS_CONTEXT, PolymorpheusComponent} from '@tinkoff/ng-polymorpheus';\n\nimport {MICRO_OFFSET} from '../pull-to-refresh.service';\nimport {TUI_PULL_TO_REFRESH_THRESHOLD} from '../pull-to-refresh.tokens';\n\nconst ROTATE_X_DEFAULT = 180;\nconst ROTATE_X_MAX = 500;\nconst ROTATE_X_MULTIPLIER = 2.3;\n\n@Component({\n selector: 'tui-mobile-android-loader',\n templateUrl: './loader-android.template.html',\n styleUrls: ['./loader-android.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiMobileLoaderAndroidComponent {\n constructor(\n @Inject(POLYMORPHEUS_CONTEXT)\n private readonly context: TuiContextWithImplicit<number>,\n @Inject(TUI_PULL_TO_REFRESH_THRESHOLD) private readonly threshold: number,\n ) {}\n\n get transform(): string {\n const rotateX = Math.min(\n ROTATE_X_DEFAULT + this.percent * ROTATE_X_MULTIPLIER,\n ROTATE_X_MAX,\n );\n\n return `rotate(${rotateX} 0 0)`;\n }\n\n @HostBinding('class._visible')\n get percent(): number {\n return (this.context.$implicit * 100) / this.threshold;\n }\n\n get opacity(): number {\n return this.context.$implicit / (this.threshold * 1.5);\n }\n\n @HostBinding('class._dropped')\n get dropped(): boolean {\n return (\n this.context.$implicit <= MICRO_OFFSET ||\n this.context.$implicit === this.threshold\n );\n }\n\n @HostBinding('style.transform')\n get hostTransform(): string {\n return `translateY(${Math.min(this.context.$implicit, this.threshold * 1.5)}px)`;\n }\n}\n\nexport const TUI_ANDROID_LOADER = new PolymorpheusComponent(\n TuiMobileLoaderAndroidComponent,\n);\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n Inject,\n Input,\n Output,\n Self,\n} from '@angular/core';\nimport {\n TUI_IS_IOS,\n TuiContextWithImplicit,\n tuiDefaultProp,\n TuiDestroyService,\n TuiHandler,\n tuiScrollFrom,\n} from '@taiga-ui/cdk';\nimport {TUI_SCROLL_REF} from '@taiga-ui/core';\nimport {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';\nimport {Observable} from 'rxjs';\nimport {distinctUntilChanged, filter, map, startWith, takeUntil} from 'rxjs/operators';\n\nimport {TUI_PULL_TO_REFRESH_COMPONENT} from './pull-to-refresh.providers';\nimport {MICRO_OFFSET, TuiPullToRefreshService} from './pull-to-refresh.service';\nimport {TUI_PULL_TO_REFRESH_THRESHOLD} from './pull-to-refresh.tokens';\n\n@Component({\n selector: 'tui-pull-to-refresh',\n templateUrl: './pull-to-refresh.template.html',\n styleUrls: ['./pull-to-refresh.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [TuiPullToRefreshService, TuiDestroyService],\n})\nexport class TuiPullToRefreshComponent {\n @Input()\n @tuiDefaultProp()\n styleHandler: TuiHandler<number, Record<string, any> | null> = this.isIOS\n ? distance => ({transform: `translateY(${distance / 2}px)`})\n : () => null;\n\n @Output()\n readonly pulled: Observable<unknown> = this.pulling$.pipe(\n filter(distance => distance === this.threshold),\n );\n\n readonly dropped$: Observable<boolean> = this.pulling$.pipe(\n map(distance => distance <= MICRO_OFFSET || distance === this.threshold),\n distinctUntilChanged(),\n );\n\n constructor(\n @Inject(TuiDestroyService) @Self() destroy$: Observable<unknown>,\n @Inject(TUI_SCROLL_REF) {nativeElement}: ElementRef<HTMLElement>,\n @Inject(TUI_IS_IOS) private readonly isIOS: boolean,\n @Inject(TUI_PULL_TO_REFRESH_THRESHOLD) private readonly threshold: number,\n @Inject(TUI_PULL_TO_REFRESH_COMPONENT)\n readonly component: PolymorpheusContent<TuiContextWithImplicit<number>>,\n @Inject(TuiPullToRefreshService) readonly pulling$: Observable<number>,\n ) {\n // Ensure scrolling down is impossible while pulling\n tuiScrollFrom(nativeElement)\n .pipe(startWith(null), takeUntil(destroy$))\n .subscribe(() => {\n if (nativeElement.scrollTop) {\n nativeElement.style.touchAction = '';\n } else {\n nativeElement.style.touchAction = 'pan-down';\n }\n });\n }\n}\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {TuiRepeatTimesModule} from '@taiga-ui/cdk';\nimport {TuiSvgModule} from '@taiga-ui/core';\nimport {PolymorpheusModule} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiMobileLoaderAndroidComponent} from './loader-android/loader-android.component';\nimport {TuiMobileLoaderIOSComponent} from './loader-ios/loader-ios.component';\nimport {TuiPullToRefreshComponent} from './pull-to-refresh.component';\n\n@NgModule({\n imports: [CommonModule, TuiSvgModule, TuiRepeatTimesModule, PolymorpheusModule],\n declarations: [\n TuiPullToRefreshComponent,\n TuiMobileLoaderAndroidComponent,\n TuiMobileLoaderIOSComponent,\n ],\n exports: [TuiPullToRefreshComponent],\n})\nexport class TuiPullToRefreshModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAEA;;;IAIa,6BAA6B,GAAG,IAAI,cAAc,CAC3D,iCAAiC,EACjC;IACI,OAAO,EAAE,cAAM,OAAA,EAAE,GAAA;CACpB;;ACJL,IAAM,WAAW,GAAG,CAAC,CAAC;AACtB,IAAM,aAAa,GAAG,EAAE,CAAC;;IAWrB,qCAEqB,OAAuC,EACA,SAAiB;QADxD,YAAO,GAAP,OAAO,CAAgC;QACA,cAAS,GAAT,SAAS,CAAQ;QALpE,UAAK,GAAG,EAAE,CAAC;KAMhB;IAEJ,sBAAI,iDAAQ;aAAZ;YACI,OAAO,IAAI,CAAC,OAAO,IAAI,GAAG,CAAC;SAC9B;;;OAAA;IAED,sBAAI,gDAAO;aAAX;YACI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC;SAC1D;;;OAAA;IAED,6CAAO,GAAP,UAAQ,KAAa;QACjB,OAAO,IAAI,CAAC,OAAO,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,WAAW,CAAC;KACnD;IAED,wDAAkB,GAAlB,UAAmB,KAAa;QAC5B,OAAO,YAAU,KAAK,GAAG,aAAa,YAAS,CAAC;KACnD;IAED,6DAAuB,GAAvB,UAAwB,KAAa;QACjC,OAAU,CAAC,KAAK,GAAG,WAAW,IAAI,GAAG,MAAG,CAAC;KAC5C;;gDAvBI,MAAM,SAAC,oBAAoB;6CAE3B,MAAM,SAAC,6BAA6B;;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Q,EAAE,qBAAqB;YAC/B,6RAA8C;YAE9C,eAAe,EAAE,uBAAuB,CAAC,MAAM;YAC/C,SAAS,EAAE,CAAC,uBAAuB,EAAE,iBAAiB,CAAC;;SAC1D,CAAC;QAmBO,WAAA,MAAM,CAAC,iBAAiB,CAAC,CAAA,EAAE,WAAA,IAAI,EAAE,CAAA;QACjC,WAAA,MAAM,CAAC,cAAc,CAAC,CAAA;QACtB,WAAA,MAAM,CAAC,UAAU,CAAC,CAAA;QAClB,WAAA,MAAM,CAAC,6BAA6B,CAAC,CAAA;QACrC,WAAA,MAAM,CAAC,6BAA6B,CAAC,CAAA;QAErC,WAAA,MAAM,CAAC,uBAAuB,CAAC,CAAA;OAxB3B,yBAAyB,CAqCrC;IAAD,gCAAC;CArCD;;;ICdA;KAAsC;IAAzB,sBAAsB;QATlC,QAAQ,CAAC;YACN,OAAO,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,oBAAoB,EAAE,kBAAkB,CAAC;YAC/E,YAAY,EAAE;gBACV,yBAAyB;gBACzB,+BAA+B;gBAC/B,2BAA2B;aAC9B;YACD,OAAO,EAAE,CAAC,yBAAyB,CAAC;SACvC,CAAC;OACW,sBAAsB,CAAG;IAAD,6BAAC;CAAtC;;ACnBA;;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __read, __decorate, __param, __assign, __spread, __extends } from 'tslib';
|
|
2
2
|
import { Inject, ElementRef, Component, ChangeDetectionStrategy, InjectionToken, NgZone, ViewChild, ViewChildren, Input, HostListener, inject, ɵɵdefineInjectable, ɵɵinject, Injectable, Output, Directive, forwardRef, ContentChild, ChangeDetectorRef, TemplateRef, NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
|
|
3
|
-
import { typedFromEvent, tuiZonefree, TuiIdService, TUI_IS_IOS, EMPTY_QUERY, tuiZonefull, tuiPure, clamp, TUI_WINDOW_HEIGHT, TuiDestroyService, tuiDefaultProp, tuiRequiredSetter, TuiLetModule, TuiOverscrollModule } from '@taiga-ui/cdk';
|
|
3
|
+
import { typedFromEvent, tuiZonefree, TuiIdService, TUI_IS_IOS, EMPTY_QUERY, tuiZonefull, tuiPure, clamp, tuiGetNativeFocused, TUI_WINDOW_HEIGHT, TuiDestroyService, tuiDefaultProp, tuiRequiredSetter, TuiLetModule, TuiOverscrollModule } from '@taiga-ui/cdk';
|
|
4
4
|
import { TUI_CLOSE_WORD, TUI_SCROLL_REF, tuiSlideInTop, tuiZonefulMap, TUI_ANIMATION_OPTIONS, tuiFadeIn, TuiButtonModule, TuiScrollbarModule } from '@taiga-ui/core';
|
|
5
5
|
import { TUI_MORE_WORD } from '@taiga-ui/kit';
|
|
6
6
|
import { merge, concat, zip, race, timer, Observable, BehaviorSubject, EMPTY, Subject } from 'rxjs';
|
|
@@ -303,8 +303,10 @@ var TUI_SHEET_OPTIONS = new InjectionToken("Default parameters for sheet compone
|
|
|
303
303
|
factory: function () { return (__assign(__assign({}, TUI_SHEET_DEFAULT_OPTIONS), { offset: inject(TUI_SHEET_OFFSET) })); },
|
|
304
304
|
});
|
|
305
305
|
|
|
306
|
+
// @dynamic
|
|
306
307
|
var TuiSheetService = /** @class */ (function () {
|
|
307
|
-
function TuiSheetService(options) {
|
|
308
|
+
function TuiSheetService(doc, options) {
|
|
309
|
+
this.doc = doc;
|
|
308
310
|
this.options = options;
|
|
309
311
|
this.sheets$ = new BehaviorSubject([]);
|
|
310
312
|
}
|
|
@@ -319,6 +321,10 @@ var TuiSheetService = /** @class */ (function () {
|
|
|
319
321
|
var sheet = __assign(__assign(__assign({}, _this.options), options), { content: content,
|
|
320
322
|
completeWith: completeWith,
|
|
321
323
|
$implicit: $implicit, scroll$: EMPTY });
|
|
324
|
+
var focused = tuiGetNativeFocused(_this.doc);
|
|
325
|
+
if (focused instanceof HTMLElement && sheet.overlay) {
|
|
326
|
+
focused.blur();
|
|
327
|
+
}
|
|
322
328
|
_this.sheets$.next(__spread(_this.sheets$.value, [sheet]));
|
|
323
329
|
return function () {
|
|
324
330
|
_this.sheets$.next(_this.sheets$.value.filter(function (item) { return item !== sheet; }));
|
|
@@ -326,14 +332,16 @@ var TuiSheetService = /** @class */ (function () {
|
|
|
326
332
|
});
|
|
327
333
|
};
|
|
328
334
|
TuiSheetService.ctorParameters = function () { return [
|
|
335
|
+
{ type: Document, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
|
|
329
336
|
{ type: undefined, decorators: [{ type: Inject, args: [TUI_SHEET_OPTIONS,] }] }
|
|
330
337
|
]; };
|
|
331
|
-
TuiSheetService.ɵprov = ɵɵdefineInjectable({ factory: function TuiSheetService_Factory() { return new TuiSheetService(ɵɵinject(TUI_SHEET_OPTIONS)); }, token: TuiSheetService, providedIn: "root" });
|
|
338
|
+
TuiSheetService.ɵprov = ɵɵdefineInjectable({ factory: function TuiSheetService_Factory() { return new TuiSheetService(ɵɵinject(DOCUMENT), ɵɵinject(TUI_SHEET_OPTIONS)); }, token: TuiSheetService, providedIn: "root" });
|
|
332
339
|
TuiSheetService = __decorate([
|
|
333
340
|
Injectable({
|
|
334
341
|
providedIn: "root",
|
|
335
342
|
}),
|
|
336
|
-
__param(0, Inject(
|
|
343
|
+
__param(0, Inject(DOCUMENT)),
|
|
344
|
+
__param(1, Inject(TUI_SHEET_OPTIONS))
|
|
337
345
|
], TuiSheetService);
|
|
338
346
|
return TuiSheetService;
|
|
339
347
|
}());
|