@taiga-ui/addon-mobile 2.92.0 → 2.93.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 +21 -17
- 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/components/pull-to-refresh/pull-to-refresh.component.d.ts +2 -2
- package/components/pull-to-refresh/taiga-ui-addon-mobile-components-pull-to-refresh.metadata.json +1 -1
- package/esm2015/components/pull-to-refresh/pull-to-refresh.component.js +24 -20
- package/esm5/components/pull-to-refresh/pull-to-refresh.component.js +24 -20
- package/fesm2015/taiga-ui-addon-mobile-components-pull-to-refresh.js +23 -19
- package/fesm2015/taiga-ui-addon-mobile-components-pull-to-refresh.js.map +1 -1
- package/fesm5/taiga-ui-addon-mobile-components-pull-to-refresh.js +23 -19
- package/fesm5/taiga-ui-addon-mobile-components-pull-to-refresh.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElementRef } from '@angular/core';
|
|
1
|
+
import { ElementRef, NgZone } from '@angular/core';
|
|
2
2
|
import { TuiContextWithImplicit, TuiHandler } from '@taiga-ui/cdk';
|
|
3
3
|
import { PolymorpheusContent } from '@tinkoff/ng-polymorpheus';
|
|
4
4
|
import { Observable } from 'rxjs';
|
|
@@ -10,5 +10,5 @@ export declare class TuiPullToRefreshComponent {
|
|
|
10
10
|
styleHandler: TuiHandler<number, Record<string, any> | null>;
|
|
11
11
|
readonly pulled: Observable<unknown>;
|
|
12
12
|
readonly dropped$: Observable<boolean>;
|
|
13
|
-
constructor(destroy$: Observable<unknown>, { nativeElement }: ElementRef<HTMLElement>, isIOS: boolean, threshold: number, component: PolymorpheusContent<TuiContextWithImplicit<number>>, pulling$: Observable<number>);
|
|
13
|
+
constructor(ngZone: NgZone, destroy$: Observable<unknown>, { nativeElement }: ElementRef<HTMLElement>, isIOS: boolean, threshold: number, component: PolymorpheusContent<TuiContextWithImplicit<number>>, pulling$: Observable<number>);
|
|
14
14
|
}
|
package/components/pull-to-refresh/taiga-ui-addon-mobile-components-pull-to-refresh.metadata.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"metadata":{"TuiMobileLoaderAndroidComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":11,"character":1},"arguments":[{"selector":"tui-mobile-android-loader","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy","line":15,"character":21},"member":"OnPush"},"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","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)}}"]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":19,"character":9},"arguments":[{"__symbolic":"reference","module":"@tinkoff/ng-polymorpheus","name":"POLYMORPHEUS_CONTEXT","line":19,"character":16}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":21,"character":9},"arguments":[{"__symbolic":"reference","name":"TUI_PULL_TO_REFRESH_THRESHOLD"}]}]],"parameters":[{"__symbolic":"reference","name":"TuiContextWithImplicit","module":"@taiga-ui/cdk","arguments":[{"__symbolic":"reference","name":"number"}]},{"__symbolic":"reference","name":"number"}]}],"percent":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostBinding","line":33,"character":5},"arguments":["class._visible"]}]}],"dropped":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostBinding","line":42,"character":5},"arguments":["class._dropped"]}]}],"hostTransform":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostBinding","line":50,"character":5},"arguments":["style.transform"]}]}]}},"TUI_ANDROID_LOADER":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@tinkoff/ng-polymorpheus","name":"PolymorpheusComponent","line":56,"character":38},"arguments":[{"__symbolic":"reference","name":"TuiMobileLoaderAndroidComponent"}]},"TuiMobileLoaderIOSComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":9,"character":1},"arguments":[{"selector":"tui-mobile-ios-loader","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy","line":13,"character":21},"member":"OnPush"},"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","styles":[":host{position:absolute;top:-.5rem;left:50%;margin-left:-1.125rem}"]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":19,"character":9},"arguments":[{"__symbolic":"reference","module":"@tinkoff/ng-polymorpheus","name":"POLYMORPHEUS_CONTEXT","line":19,"character":16}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":21,"character":9},"arguments":[{"__symbolic":"reference","name":"TUI_PULL_TO_REFRESH_THRESHOLD"}]}]],"parameters":[{"__symbolic":"reference","name":"TuiContextWithImplicit","module":"@taiga-ui/cdk","arguments":[{"__symbolic":"reference","name":"number"}]},{"__symbolic":"reference","name":"number"}]}],"isShown":[{"__symbolic":"method"}],"calculateTransform":[{"__symbolic":"method"}],"calculateAnimationBegin":[{"__symbolic":"method"}]}},"TUI_IOS_LOADER":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@tinkoff/ng-polymorpheus","name":"PolymorpheusComponent","line":45,"character":34},"arguments":[{"__symbolic":"reference","name":"TuiMobileLoaderIOSComponent"}]},"TuiPullToRefreshComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":26,"character":1},"arguments":[{"selector":"tui-pull-to-refresh","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy","line":30,"character":21},"member":"OnPush"},"providers":[{"__symbolic":"reference","name":"TuiPullToRefreshService"},{"__symbolic":"reference","module":"@taiga-ui/cdk","name":"TuiDestroyService","line":31,"character":41}],"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","styles":[".t-drop{transition:all var(--tui-duration) cubic-bezier(.4,0,.2,1)}"]}]}],"members":{"styleHandler":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":34,"character":5}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@taiga-ui/cdk","name":"tuiDefaultProp","line":35,"character":5}}]}],"pulled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":40,"character":5}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":51,"character":9},"arguments":[{"__symbolic":"reference","module":"@taiga-ui/cdk","name":"TuiDestroyService","line":51,"character":16}]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self","line":51,"character":36}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":52,"character":9},"arguments":[{"__symbolic":"reference","module":"@taiga-ui/core","name":"TUI_SCROLL_REF","line":52,"character":16}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":53,"character":9},"arguments":[{"__symbolic":"reference","module":"@taiga-ui/cdk","name":"TUI_IS_IOS","line":53,"character":16}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":54,"character":9},"arguments":[{"__symbolic":"reference","name":"TUI_PULL_TO_REFRESH_THRESHOLD"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":55,"character":9},"arguments":[{"__symbolic":"reference","name":"TUI_PULL_TO_REFRESH_COMPONENT"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":57,"character":9},"arguments":[{"__symbolic":"reference","name":"TuiPullToRefreshService"}]}]],"parameters":[{"__symbolic":"reference","name":"Observable","module":"rxjs","arguments":[{"__symbolic":"reference","name":"number"}]},{"__symbolic":"reference","name":"ElementRef","module":"@angular/core","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":52,"character":60,"context":{"typeName":"HTMLElement"},"module":"./pull-to-refresh.component"}]},{"__symbolic":"reference","name":"boolean"},{"__symbolic":"reference","name":"number"},{"__symbolic":"reference","name":"PolymorpheusContent","module":"@tinkoff/ng-polymorpheus","arguments":[{"__symbolic":"reference","name":"TuiContextWithImplicit","module":"@taiga-ui/cdk","arguments":[{"__symbolic":"reference","name":"number"}]}]},{"__symbolic":"reference","name":"Observable","module":"rxjs","arguments":[{"__symbolic":"reference","name":"number"}]}]}]}},"TuiPullToRefreshModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":10,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":11,"character":14},{"__symbolic":"reference","module":"@taiga-ui/core","name":"TuiSvgModule","line":11,"character":28},{"__symbolic":"reference","module":"@taiga-ui/cdk","name":"TuiRepeatTimesModule","line":11,"character":42},{"__symbolic":"reference","module":"@tinkoff/ng-polymorpheus","name":"PolymorpheusModule","line":11,"character":64}],"declarations":[{"__symbolic":"reference","name":"TuiPullToRefreshComponent"},{"__symbolic":"reference","name":"TuiMobileLoaderAndroidComponent"},{"__symbolic":"reference","name":"TuiMobileLoaderIOSComponent"}],"exports":[{"__symbolic":"reference","name":"TuiPullToRefreshComponent"}]}]}],"members":{}},"TUI_PULL_TO_REFRESH_LOADED":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":11,"character":46},"arguments":["[TUI_PULL_TO_REFRESH_LOADED]",{"__symbolic":"error","message":"Lambda not supported","line":14,"character":17,"module":"./pull-to-refresh.providers"}]},"TUI_PULL_TO_REFRESH_COMPONENT":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":21,"character":49},"arguments":["[TUI_PULL_TO_REFRESH_COMPONENT]",{"__symbolic":"error","message":"Lambda not supported","line":24,"character":13,"module":"./pull-to-refresh.providers"}]},"TUI_LOADED":{"__symbolic":"reference","name":"TUI_PULL_TO_REFRESH_LOADED"},"MICRO_OFFSET":{"__symbolic":"binop","operator":"**","left":10,"right":-6},"TuiPullToRefreshService":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"rxjs","name":"Observable","line":28,"character":45},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":27,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":73,"character":9},"arguments":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":73,"character":16}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":74,"character":9},"arguments":[{"__symbolic":"reference","module":"@taiga-ui/core","name":"TUI_SCROLL_REF","line":74,"character":16}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":75,"character":9},"arguments":[{"__symbolic":"reference","name":"TUI_PULL_TO_REFRESH_LOADED"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":76,"character":9},"arguments":[{"__symbolic":"reference","name":"TUI_PULL_TO_REFRESH_THRESHOLD"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":77,"character":9},"arguments":[{"__symbolic":"reference","name":"TUI_PULL_TO_REFRESH_COMPONENT"}]}]],"parameters":[{"__symbolic":"reference","name":"ElementRef","module":"@angular/core","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":74,"character":71,"context":{"typeName":"HTMLElement"},"module":"./pull-to-refresh.service"}]},{"__symbolic":"reference","name":"ElementRef","module":"@angular/core","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":74,"character":71,"context":{"typeName":"HTMLElement"},"module":"./pull-to-refresh.service"}]},{"__symbolic":"reference","name":"Observable","module":"rxjs","arguments":[{"__symbolic":"error","message":"Expression form not supported","line":75,"character":81,"module":"./pull-to-refresh.service"}]},{"__symbolic":"reference","name":"number"},{"__symbolic":"error","message":"Expression form not supported","line":77,"character":58,"module":"./pull-to-refresh.service"}]}]}},"TUI_PULL_TO_REFRESH_THRESHOLD":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":6,"character":49},"arguments":["[TUI_PULL_TO_REFRESH_THRESHOLD]",{"__symbolic":"error","message":"Lambda not supported","line":9,"character":17,"module":"./pull-to-refresh.tokens"}]}},"origins":{"TuiMobileLoaderAndroidComponent":"./loader-android/loader-android.component","TUI_ANDROID_LOADER":"./loader-android/loader-android.component","TuiMobileLoaderIOSComponent":"./loader-ios/loader-ios.component","TUI_IOS_LOADER":"./loader-ios/loader-ios.component","TuiPullToRefreshComponent":"./pull-to-refresh.component","TuiPullToRefreshModule":"./pull-to-refresh.module","TUI_PULL_TO_REFRESH_LOADED":"./pull-to-refresh.providers","TUI_PULL_TO_REFRESH_COMPONENT":"./pull-to-refresh.providers","TUI_LOADED":"./pull-to-refresh.providers","MICRO_OFFSET":"./pull-to-refresh.service","TuiPullToRefreshService":"./pull-to-refresh.service","TUI_PULL_TO_REFRESH_THRESHOLD":"./pull-to-refresh.tokens"},"importAs":"@taiga-ui/addon-mobile/components/pull-to-refresh"}
|
|
1
|
+
{"__symbolic":"module","version":4,"metadata":{"TuiMobileLoaderAndroidComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":11,"character":1},"arguments":[{"selector":"tui-mobile-android-loader","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy","line":15,"character":21},"member":"OnPush"},"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","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)}}"]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":19,"character":9},"arguments":[{"__symbolic":"reference","module":"@tinkoff/ng-polymorpheus","name":"POLYMORPHEUS_CONTEXT","line":19,"character":16}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":21,"character":9},"arguments":[{"__symbolic":"reference","name":"TUI_PULL_TO_REFRESH_THRESHOLD"}]}]],"parameters":[{"__symbolic":"reference","name":"TuiContextWithImplicit","module":"@taiga-ui/cdk","arguments":[{"__symbolic":"reference","name":"number"}]},{"__symbolic":"reference","name":"number"}]}],"percent":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostBinding","line":33,"character":5},"arguments":["class._visible"]}]}],"dropped":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostBinding","line":42,"character":5},"arguments":["class._dropped"]}]}],"hostTransform":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostBinding","line":50,"character":5},"arguments":["style.transform"]}]}]}},"TUI_ANDROID_LOADER":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@tinkoff/ng-polymorpheus","name":"PolymorpheusComponent","line":56,"character":38},"arguments":[{"__symbolic":"reference","name":"TuiMobileLoaderAndroidComponent"}]},"TuiMobileLoaderIOSComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":9,"character":1},"arguments":[{"selector":"tui-mobile-ios-loader","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy","line":13,"character":21},"member":"OnPush"},"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","styles":[":host{position:absolute;top:-.5rem;left:50%;margin-left:-1.125rem}"]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":19,"character":9},"arguments":[{"__symbolic":"reference","module":"@tinkoff/ng-polymorpheus","name":"POLYMORPHEUS_CONTEXT","line":19,"character":16}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":21,"character":9},"arguments":[{"__symbolic":"reference","name":"TUI_PULL_TO_REFRESH_THRESHOLD"}]}]],"parameters":[{"__symbolic":"reference","name":"TuiContextWithImplicit","module":"@taiga-ui/cdk","arguments":[{"__symbolic":"reference","name":"number"}]},{"__symbolic":"reference","name":"number"}]}],"isShown":[{"__symbolic":"method"}],"calculateTransform":[{"__symbolic":"method"}],"calculateAnimationBegin":[{"__symbolic":"method"}]}},"TUI_IOS_LOADER":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@tinkoff/ng-polymorpheus","name":"PolymorpheusComponent","line":45,"character":34},"arguments":[{"__symbolic":"reference","name":"TuiMobileLoaderIOSComponent"}]},"TuiPullToRefreshComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":28,"character":1},"arguments":[{"selector":"tui-pull-to-refresh","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy","line":32,"character":21},"member":"OnPush"},"providers":[{"__symbolic":"reference","name":"TuiPullToRefreshService"},{"__symbolic":"reference","module":"@taiga-ui/cdk","name":"TuiDestroyService","line":33,"character":41}],"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","styles":[".t-drop{transition:all var(--tui-duration) cubic-bezier(.4,0,.2,1)}"]}]}],"members":{"styleHandler":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":36,"character":5}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@taiga-ui/cdk","name":"tuiDefaultProp","line":37,"character":5}}]}],"pulled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":42,"character":5}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":53,"character":9},"arguments":[{"__symbolic":"reference","module":"@angular/core","name":"NgZone","line":53,"character":16}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":54,"character":9},"arguments":[{"__symbolic":"reference","module":"@taiga-ui/cdk","name":"TuiDestroyService","line":54,"character":16}]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self","line":54,"character":36}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":55,"character":9},"arguments":[{"__symbolic":"reference","module":"@taiga-ui/core","name":"TUI_SCROLL_REF","line":55,"character":16}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":56,"character":9},"arguments":[{"__symbolic":"reference","module":"@taiga-ui/cdk","name":"TUI_IS_IOS","line":56,"character":16}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":57,"character":9},"arguments":[{"__symbolic":"reference","name":"TUI_PULL_TO_REFRESH_THRESHOLD"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":58,"character":9},"arguments":[{"__symbolic":"reference","name":"TUI_PULL_TO_REFRESH_COMPONENT"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":60,"character":9},"arguments":[{"__symbolic":"reference","name":"TuiPullToRefreshService"}]}]],"parameters":[{"__symbolic":"reference","module":"@angular/core","name":"NgZone","line":53,"character":32},{"__symbolic":"reference","name":"Observable","module":"rxjs","arguments":[{"__symbolic":"reference","name":"number"}]},{"__symbolic":"reference","name":"ElementRef","module":"@angular/core","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":55,"character":60,"context":{"typeName":"HTMLElement"},"module":"./pull-to-refresh.component"}]},{"__symbolic":"reference","name":"boolean"},{"__symbolic":"reference","name":"number"},{"__symbolic":"reference","name":"PolymorpheusContent","module":"@tinkoff/ng-polymorpheus","arguments":[{"__symbolic":"reference","name":"TuiContextWithImplicit","module":"@taiga-ui/cdk","arguments":[{"__symbolic":"reference","name":"number"}]}]},{"__symbolic":"reference","name":"Observable","module":"rxjs","arguments":[{"__symbolic":"reference","name":"number"}]}]}]}},"TuiPullToRefreshModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":10,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":11,"character":14},{"__symbolic":"reference","module":"@taiga-ui/core","name":"TuiSvgModule","line":11,"character":28},{"__symbolic":"reference","module":"@taiga-ui/cdk","name":"TuiRepeatTimesModule","line":11,"character":42},{"__symbolic":"reference","module":"@tinkoff/ng-polymorpheus","name":"PolymorpheusModule","line":11,"character":64}],"declarations":[{"__symbolic":"reference","name":"TuiPullToRefreshComponent"},{"__symbolic":"reference","name":"TuiMobileLoaderAndroidComponent"},{"__symbolic":"reference","name":"TuiMobileLoaderIOSComponent"}],"exports":[{"__symbolic":"reference","name":"TuiPullToRefreshComponent"}]}]}],"members":{}},"TUI_PULL_TO_REFRESH_LOADED":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":11,"character":46},"arguments":["[TUI_PULL_TO_REFRESH_LOADED]",{"__symbolic":"error","message":"Lambda not supported","line":14,"character":17,"module":"./pull-to-refresh.providers"}]},"TUI_PULL_TO_REFRESH_COMPONENT":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":21,"character":49},"arguments":["[TUI_PULL_TO_REFRESH_COMPONENT]",{"__symbolic":"error","message":"Lambda not supported","line":24,"character":13,"module":"./pull-to-refresh.providers"}]},"TUI_LOADED":{"__symbolic":"reference","name":"TUI_PULL_TO_REFRESH_LOADED"},"MICRO_OFFSET":{"__symbolic":"binop","operator":"**","left":10,"right":-6},"TuiPullToRefreshService":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"rxjs","name":"Observable","line":28,"character":45},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":27,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":73,"character":9},"arguments":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":73,"character":16}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":74,"character":9},"arguments":[{"__symbolic":"reference","module":"@taiga-ui/core","name":"TUI_SCROLL_REF","line":74,"character":16}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":75,"character":9},"arguments":[{"__symbolic":"reference","name":"TUI_PULL_TO_REFRESH_LOADED"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":76,"character":9},"arguments":[{"__symbolic":"reference","name":"TUI_PULL_TO_REFRESH_THRESHOLD"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":77,"character":9},"arguments":[{"__symbolic":"reference","name":"TUI_PULL_TO_REFRESH_COMPONENT"}]}]],"parameters":[{"__symbolic":"reference","name":"ElementRef","module":"@angular/core","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":74,"character":71,"context":{"typeName":"HTMLElement"},"module":"./pull-to-refresh.service"}]},{"__symbolic":"reference","name":"ElementRef","module":"@angular/core","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":74,"character":71,"context":{"typeName":"HTMLElement"},"module":"./pull-to-refresh.service"}]},{"__symbolic":"reference","name":"Observable","module":"rxjs","arguments":[{"__symbolic":"error","message":"Expression form not supported","line":75,"character":81,"module":"./pull-to-refresh.service"}]},{"__symbolic":"reference","name":"number"},{"__symbolic":"error","message":"Expression form not supported","line":77,"character":58,"module":"./pull-to-refresh.service"}]}]}},"TUI_PULL_TO_REFRESH_THRESHOLD":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":6,"character":49},"arguments":["[TUI_PULL_TO_REFRESH_THRESHOLD]",{"__symbolic":"error","message":"Lambda not supported","line":9,"character":17,"module":"./pull-to-refresh.tokens"}]}},"origins":{"TuiMobileLoaderAndroidComponent":"./loader-android/loader-android.component","TUI_ANDROID_LOADER":"./loader-android/loader-android.component","TuiMobileLoaderIOSComponent":"./loader-ios/loader-ios.component","TUI_IOS_LOADER":"./loader-ios/loader-ios.component","TuiPullToRefreshComponent":"./pull-to-refresh.component","TuiPullToRefreshModule":"./pull-to-refresh.module","TUI_PULL_TO_REFRESH_LOADED":"./pull-to-refresh.providers","TUI_PULL_TO_REFRESH_COMPONENT":"./pull-to-refresh.providers","TUI_LOADED":"./pull-to-refresh.providers","MICRO_OFFSET":"./pull-to-refresh.service","TuiPullToRefreshService":"./pull-to-refresh.service","TUI_PULL_TO_REFRESH_THRESHOLD":"./pull-to-refresh.tokens"},"importAs":"@taiga-ui/addon-mobile/components/pull-to-refresh"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate, __param } from "tslib";
|
|
2
|
-
import { ChangeDetectionStrategy, Component, ElementRef, Inject, Input, Output, Self, } from '@angular/core';
|
|
3
|
-
import { TUI_IS_IOS, tuiDefaultProp, TuiDestroyService, tuiScrollFrom, } from '@taiga-ui/cdk';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, ElementRef, Inject, Input, NgZone, Output, Self, } from '@angular/core';
|
|
3
|
+
import { TUI_IS_IOS, tuiDefaultProp, TuiDestroyService, tuiScrollFrom, tuiZonefree, } from '@taiga-ui/cdk';
|
|
4
4
|
import { TUI_SCROLL_REF } from '@taiga-ui/core';
|
|
5
5
|
import { Observable } from 'rxjs';
|
|
6
6
|
import { distinctUntilChanged, filter, map, startWith, takeUntil } from 'rxjs/operators';
|
|
@@ -8,7 +8,7 @@ import { TUI_PULL_TO_REFRESH_COMPONENT } from './pull-to-refresh.providers';
|
|
|
8
8
|
import { MICRO_OFFSET, TuiPullToRefreshService } from './pull-to-refresh.service';
|
|
9
9
|
import { TUI_PULL_TO_REFRESH_THRESHOLD } from './pull-to-refresh.tokens';
|
|
10
10
|
let TuiPullToRefreshComponent = class TuiPullToRefreshComponent {
|
|
11
|
-
constructor(destroy$, { nativeElement }, isIOS, threshold, component, pulling$) {
|
|
11
|
+
constructor(ngZone, destroy$, { nativeElement }, isIOS, threshold, component, pulling$) {
|
|
12
12
|
this.isIOS = isIOS;
|
|
13
13
|
this.threshold = threshold;
|
|
14
14
|
this.component = component;
|
|
@@ -19,19 +19,22 @@ let TuiPullToRefreshComponent = class TuiPullToRefreshComponent {
|
|
|
19
19
|
this.pulled = this.pulling$.pipe(filter(distance => distance === this.threshold));
|
|
20
20
|
this.dropped$ = this.pulling$.pipe(map(distance => distance <= MICRO_OFFSET || distance === this.threshold), distinctUntilChanged());
|
|
21
21
|
// Ensure scrolling down is impossible while pulling
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
nativeElement.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
if (this.component) {
|
|
23
|
+
tuiScrollFrom(nativeElement)
|
|
24
|
+
.pipe(startWith(null), tuiZonefree(ngZone), takeUntil(destroy$))
|
|
25
|
+
.subscribe(() => {
|
|
26
|
+
if (nativeElement.scrollTop) {
|
|
27
|
+
nativeElement.style.touchAction = '';
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
nativeElement.style.touchAction = 'pan-down';
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
32
34
|
}
|
|
33
35
|
};
|
|
34
36
|
TuiPullToRefreshComponent.ctorParameters = () => [
|
|
37
|
+
{ type: NgZone, decorators: [{ type: Inject, args: [NgZone,] }] },
|
|
35
38
|
{ type: Observable, decorators: [{ type: Inject, args: [TuiDestroyService,] }, { type: Self }] },
|
|
36
39
|
{ type: ElementRef, decorators: [{ type: Inject, args: [TUI_SCROLL_REF,] }] },
|
|
37
40
|
{ type: Boolean, decorators: [{ type: Inject, args: [TUI_IS_IOS,] }] },
|
|
@@ -54,12 +57,13 @@ TuiPullToRefreshComponent = __decorate([
|
|
|
54
57
|
providers: [TuiPullToRefreshService, TuiDestroyService],
|
|
55
58
|
styles: [".t-drop{transition:all var(--tui-duration) cubic-bezier(.4,0,.2,1)}"]
|
|
56
59
|
}),
|
|
57
|
-
__param(0, Inject(
|
|
58
|
-
__param(1, Inject(
|
|
59
|
-
__param(2, Inject(
|
|
60
|
-
__param(3, Inject(
|
|
61
|
-
__param(4, Inject(
|
|
62
|
-
__param(5, Inject(
|
|
60
|
+
__param(0, Inject(NgZone)),
|
|
61
|
+
__param(1, Inject(TuiDestroyService)), __param(1, Self()),
|
|
62
|
+
__param(2, Inject(TUI_SCROLL_REF)),
|
|
63
|
+
__param(3, Inject(TUI_IS_IOS)),
|
|
64
|
+
__param(4, Inject(TUI_PULL_TO_REFRESH_THRESHOLD)),
|
|
65
|
+
__param(5, Inject(TUI_PULL_TO_REFRESH_COMPONENT)),
|
|
66
|
+
__param(6, Inject(TuiPullToRefreshService))
|
|
63
67
|
], TuiPullToRefreshComponent);
|
|
64
68
|
export { TuiPullToRefreshComponent };
|
|
65
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
69
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVsbC10by1yZWZyZXNoLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0B0YWlnYS11aS9hZGRvbi1tb2JpbGUvY29tcG9uZW50cy9wdWxsLXRvLXJlZnJlc2gvIiwic291cmNlcyI6WyJwdWxsLXRvLXJlZnJlc2guY29tcG9uZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxPQUFPLEVBQ0gsdUJBQXVCLEVBQ3ZCLFNBQVMsRUFDVCxVQUFVLEVBQ1YsTUFBTSxFQUNOLEtBQUssRUFDTCxNQUFNLEVBQ04sTUFBTSxFQUNOLElBQUksR0FDUCxNQUFNLGVBQWUsQ0FBQztBQU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XRpdmVFbGVtZW50LnN0eWxlLnRvdWNoQWN0aW9uID0gJyc7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBuYXRpdmVFbGVtZW50LnN0eWxlLnRvdWNoQWN0aW9uID0gJ3Bhbi1kb3duJztcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgfVxufVxuIl19
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate, __param } from "tslib";
|
|
2
|
-
import { ChangeDetectionStrategy, Component, ElementRef, Inject, Input, Output, Self, } from '@angular/core';
|
|
3
|
-
import { TUI_IS_IOS, tuiDefaultProp, TuiDestroyService, tuiScrollFrom, } from '@taiga-ui/cdk';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, ElementRef, Inject, Input, NgZone, Output, Self, } from '@angular/core';
|
|
3
|
+
import { TUI_IS_IOS, tuiDefaultProp, TuiDestroyService, tuiScrollFrom, tuiZonefree, } from '@taiga-ui/cdk';
|
|
4
4
|
import { TUI_SCROLL_REF } from '@taiga-ui/core';
|
|
5
5
|
import { Observable } from 'rxjs';
|
|
6
6
|
import { distinctUntilChanged, filter, map, startWith, takeUntil } from 'rxjs/operators';
|
|
@@ -8,7 +8,7 @@ import { TUI_PULL_TO_REFRESH_COMPONENT } from './pull-to-refresh.providers';
|
|
|
8
8
|
import { MICRO_OFFSET, TuiPullToRefreshService } from './pull-to-refresh.service';
|
|
9
9
|
import { TUI_PULL_TO_REFRESH_THRESHOLD } from './pull-to-refresh.tokens';
|
|
10
10
|
var TuiPullToRefreshComponent = /** @class */ (function () {
|
|
11
|
-
function TuiPullToRefreshComponent(destroy$, _a, isIOS, threshold, component, pulling$) {
|
|
11
|
+
function TuiPullToRefreshComponent(ngZone, destroy$, _a, isIOS, threshold, component, pulling$) {
|
|
12
12
|
var _this = this;
|
|
13
13
|
var nativeElement = _a.nativeElement;
|
|
14
14
|
this.isIOS = isIOS;
|
|
@@ -21,18 +21,21 @@ var TuiPullToRefreshComponent = /** @class */ (function () {
|
|
|
21
21
|
this.pulled = this.pulling$.pipe(filter(function (distance) { return distance === _this.threshold; }));
|
|
22
22
|
this.dropped$ = this.pulling$.pipe(map(function (distance) { return distance <= MICRO_OFFSET || distance === _this.threshold; }), distinctUntilChanged());
|
|
23
23
|
// Ensure scrolling down is impossible while pulling
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
nativeElement.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
if (this.component) {
|
|
25
|
+
tuiScrollFrom(nativeElement)
|
|
26
|
+
.pipe(startWith(null), tuiZonefree(ngZone), takeUntil(destroy$))
|
|
27
|
+
.subscribe(function () {
|
|
28
|
+
if (nativeElement.scrollTop) {
|
|
29
|
+
nativeElement.style.touchAction = '';
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
nativeElement.style.touchAction = 'pan-down';
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
34
36
|
}
|
|
35
37
|
TuiPullToRefreshComponent.ctorParameters = function () { return [
|
|
38
|
+
{ type: NgZone, decorators: [{ type: Inject, args: [NgZone,] }] },
|
|
36
39
|
{ type: Observable, decorators: [{ type: Inject, args: [TuiDestroyService,] }, { type: Self }] },
|
|
37
40
|
{ type: ElementRef, decorators: [{ type: Inject, args: [TUI_SCROLL_REF,] }] },
|
|
38
41
|
{ type: Boolean, decorators: [{ type: Inject, args: [TUI_IS_IOS,] }] },
|
|
@@ -55,14 +58,15 @@ var TuiPullToRefreshComponent = /** @class */ (function () {
|
|
|
55
58
|
providers: [TuiPullToRefreshService, TuiDestroyService],
|
|
56
59
|
styles: [".t-drop{transition:all var(--tui-duration) cubic-bezier(.4,0,.2,1)}"]
|
|
57
60
|
}),
|
|
58
|
-
__param(0, Inject(
|
|
59
|
-
__param(1, Inject(
|
|
60
|
-
__param(2, Inject(
|
|
61
|
-
__param(3, Inject(
|
|
62
|
-
__param(4, Inject(
|
|
63
|
-
__param(5, Inject(
|
|
61
|
+
__param(0, Inject(NgZone)),
|
|
62
|
+
__param(1, Inject(TuiDestroyService)), __param(1, Self()),
|
|
63
|
+
__param(2, Inject(TUI_SCROLL_REF)),
|
|
64
|
+
__param(3, Inject(TUI_IS_IOS)),
|
|
65
|
+
__param(4, Inject(TUI_PULL_TO_REFRESH_THRESHOLD)),
|
|
66
|
+
__param(5, Inject(TUI_PULL_TO_REFRESH_COMPONENT)),
|
|
67
|
+
__param(6, Inject(TuiPullToRefreshService))
|
|
64
68
|
], TuiPullToRefreshComponent);
|
|
65
69
|
return TuiPullToRefreshComponent;
|
|
66
70
|
}());
|
|
67
71
|
export { TuiPullToRefreshComponent };
|
|
68
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
72
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVsbC10by1yZWZyZXNoLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0B0YWlnYS11aS9hZGRvbi1tb2JpbGUvY29tcG9uZW50cy9wdWxsLXRvLXJlZnJlc2gvIiwic291cmNlcyI6WyJwdWxsLXRvLXJlZnJlc2guY29tcG9uZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxPQUFPLEVBQ0gsdUJBQXVCLEVBQ3ZCLFNBQVMsRUFDVCxVQUFVLEVBQ1YsTUFBTSxFQUNOLEtBQUssRUFDTCxNQUFNLEVBQ04sTUFBTSxFQUNOLElBQUksR0FDUCxNQUFNLGVBQWUsQ0FBQztBQUN2QixPQUFPLEVBQ0gsVUFBVSxFQUVWLGNBQWMsRUFDZCxpQkFBaUIsRUFFakIsYUFBYSxFQUNiLFdBQVcsR0FDZCxNQUFNLGVBQWUsQ0FBQztBQUN2QixPQUFPLEVBQUMsY0FBYyxFQUFDLE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gICAgICAgICAgICAgICAgICAgICAgICBuYXRpdmVFbGVtZW50LnN0eWxlLnRvdWNoQWN0aW9uID0gJ3Bhbi1kb3duJztcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgfVxufVxuIl19
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __param } from 'tslib';
|
|
2
|
-
import { InjectionToken, Inject, Component, ChangeDetectionStrategy, inject, ElementRef, Injectable, HostBinding, Self, Input, Output, NgModule } from '@angular/core';
|
|
2
|
+
import { InjectionToken, Inject, Component, ChangeDetectionStrategy, inject, ElementRef, Injectable, HostBinding, NgZone, Self, Input, Output, NgModule } from '@angular/core';
|
|
3
3
|
import { POLYMORPHEUS_CONTEXT, PolymorpheusComponent, PolymorpheusModule } from '@tinkoff/ng-polymorpheus';
|
|
4
|
-
import { TUI_IS_IOS, tuiTypedFromEvent, tuiScrollFrom, TuiDestroyService, tuiDefaultProp, TuiRepeatTimesModule } from '@taiga-ui/cdk';
|
|
4
|
+
import { TUI_IS_IOS, tuiTypedFromEvent, tuiScrollFrom, tuiZonefree, TuiDestroyService, tuiDefaultProp, TuiRepeatTimesModule } from '@taiga-ui/cdk';
|
|
5
5
|
import { TUI_SCROLL_REF, TuiSvgModule } from '@taiga-ui/core';
|
|
6
6
|
import { EMPTY, Observable } from 'rxjs';
|
|
7
7
|
import { startWith, switchMap, filter, map, tap, takeUntil, endWith, scan, takeWhile, distinctUntilChanged, share } from 'rxjs/operators';
|
|
@@ -166,7 +166,7 @@ TuiMobileLoaderAndroidComponent = __decorate([
|
|
|
166
166
|
const TUI_ANDROID_LOADER = new PolymorpheusComponent(TuiMobileLoaderAndroidComponent);
|
|
167
167
|
|
|
168
168
|
let TuiPullToRefreshComponent = class TuiPullToRefreshComponent {
|
|
169
|
-
constructor(destroy$, { nativeElement }, isIOS, threshold, component, pulling$) {
|
|
169
|
+
constructor(ngZone, destroy$, { nativeElement }, isIOS, threshold, component, pulling$) {
|
|
170
170
|
this.isIOS = isIOS;
|
|
171
171
|
this.threshold = threshold;
|
|
172
172
|
this.component = component;
|
|
@@ -177,19 +177,22 @@ let TuiPullToRefreshComponent = class TuiPullToRefreshComponent {
|
|
|
177
177
|
this.pulled = this.pulling$.pipe(filter(distance => distance === this.threshold));
|
|
178
178
|
this.dropped$ = this.pulling$.pipe(map(distance => distance <= MICRO_OFFSET || distance === this.threshold), distinctUntilChanged());
|
|
179
179
|
// Ensure scrolling down is impossible while pulling
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
nativeElement.
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
180
|
+
if (this.component) {
|
|
181
|
+
tuiScrollFrom(nativeElement)
|
|
182
|
+
.pipe(startWith(null), tuiZonefree(ngZone), takeUntil(destroy$))
|
|
183
|
+
.subscribe(() => {
|
|
184
|
+
if (nativeElement.scrollTop) {
|
|
185
|
+
nativeElement.style.touchAction = '';
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
nativeElement.style.touchAction = 'pan-down';
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
190
192
|
}
|
|
191
193
|
};
|
|
192
194
|
TuiPullToRefreshComponent.ctorParameters = () => [
|
|
195
|
+
{ type: NgZone, decorators: [{ type: Inject, args: [NgZone,] }] },
|
|
193
196
|
{ type: Observable, decorators: [{ type: Inject, args: [TuiDestroyService,] }, { type: Self }] },
|
|
194
197
|
{ type: ElementRef, decorators: [{ type: Inject, args: [TUI_SCROLL_REF,] }] },
|
|
195
198
|
{ type: Boolean, decorators: [{ type: Inject, args: [TUI_IS_IOS,] }] },
|
|
@@ -212,12 +215,13 @@ TuiPullToRefreshComponent = __decorate([
|
|
|
212
215
|
providers: [TuiPullToRefreshService, TuiDestroyService],
|
|
213
216
|
styles: [".t-drop{transition:all var(--tui-duration) cubic-bezier(.4,0,.2,1)}"]
|
|
214
217
|
}),
|
|
215
|
-
__param(0, Inject(
|
|
216
|
-
__param(1, Inject(
|
|
217
|
-
__param(2, Inject(
|
|
218
|
-
__param(3, Inject(
|
|
219
|
-
__param(4, Inject(
|
|
220
|
-
__param(5, Inject(
|
|
218
|
+
__param(0, Inject(NgZone)),
|
|
219
|
+
__param(1, Inject(TuiDestroyService)), __param(1, Self()),
|
|
220
|
+
__param(2, Inject(TUI_SCROLL_REF)),
|
|
221
|
+
__param(3, Inject(TUI_IS_IOS)),
|
|
222
|
+
__param(4, Inject(TUI_PULL_TO_REFRESH_THRESHOLD)),
|
|
223
|
+
__param(5, Inject(TUI_PULL_TO_REFRESH_COMPONENT)),
|
|
224
|
+
__param(6, Inject(TuiPullToRefreshService))
|
|
221
225
|
], TuiPullToRefreshComponent);
|
|
222
226
|
|
|
223
227
|
let TuiPullToRefreshModule = class TuiPullToRefreshModule {
|
|
@@ -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/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;;;MAIa,6BAA6B,GAAG,IAAI,cAAc,CAC3D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AAsB,CAAG;;ACnBtC;;;;;;"}
|
|
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 NgZone,\n Output,\n Self,\n} from '@angular/core';\nimport {\n TUI_IS_IOS,\n TuiContextWithImplicit,\n tuiDefaultProp,\n TuiDestroyService,\n TuiHandler,\n tuiScrollFrom,\n tuiZonefree,\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(NgZone) ngZone: NgZone,\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 if (this.component) {\n tuiScrollFrom(nativeElement)\n .pipe(startWith(null), tuiZonefree(ngZone), 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}\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;;;MAIa,6BAA6B,GAAG,IAAI,cAAc,CAC3D,iCAAiC,EACjC;IACI,OAAO,EAAE,MAAM,EAAE;CACpB;;ACJL,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,aAAa,GAAG,EAAE,CAAC;IAQZ,2BAA2B,GAAxC,MAAa,2BAA2B;IAGpC,YAEqB,OAAuC,EACA,SAAiB;QADxD,YAAO,GAAP,OAAO,CAAgC;QACA,cAAS,GAAT,SAAS,CAAQ;QALpE,UAAK,GAAG,EAAE,CAAC;KAMhB;IAEJ,IAAI,QAAQ;QACR,OAAO,IAAI,CAAC,OAAO,IAAI,GAAG,CAAC;KAC9B;IAED,IAAI,OAAO;QACP,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC;KA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AAM,SAAC,uBAAuB;;AAtBnC;IAFC,KAAK,EAAE;IACP,cAAc,EAAE;+DAGA;AAGjB;IADC,MAAM,EAAE;yDAGP;AAVO,yBAAyB;IAPrC,SAAS,CAAC;QACP,QAAQ,EAAE,qBAAqB;QAC/B,6RAA8C;QAE9C,eAAe,EAAE,uBAAuB,CAAC,MAAM;QAC/C,SAAS,EAAE,CAAC,uBAAuB,EAAE,iBAAiB,CAAC;;KAC1D,CAAC;IAmBO,WAAA,MAAM,CAAC,MAAM,CAAC,CAAA;IACd,WAAA,MAAM,CAAC,iBAAiB,CAAC,CAAA,EAAE,WAAA,IAAI,EAAE,CAAA;IACjC,WAAA,MAAM,CAAC,cAAc,CAAC,CAAA;IACtB,WAAA,MAAM,CAAC,UAAU,CAAC,CAAA;IAClB,WAAA,MAAM,CAAC,6BAA6B,CAAC,CAAA;IACrC,WAAA,MAAM,CAAC,6BAA6B,CAAC,CAAA;IAErC,WAAA,MAAM,CAAC,uBAAuB,CAAC,CAAA;GAzB3B,yBAAyB,CAwCrC;;ICxDY,sBAAsB,GAAnC,MAAa,sBAAsB;EAAG;AAAzB,sBAAsB;IATlC,QAAQ,CAAC;QACN,OAAO,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,oBAAoB,EAAE,kBAAkB,CAAC;QAC/E,YAAY,EAAE;YACV,yBAAyB;YACzB,+BAA+B;YAC/B,2BAA2B;SAC9B;QACD,OAAO,EAAE,CAAC,yBAAyB,CAAC;KACvC,CAAC;GACW,sBAAsB,CAAG;;ACnBtC;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __param, __extends } from 'tslib';
|
|
2
|
-
import { InjectionToken, Inject, Component, ChangeDetectionStrategy, inject, ElementRef, Injectable, HostBinding, Self, Input, Output, NgModule } from '@angular/core';
|
|
2
|
+
import { InjectionToken, Inject, Component, ChangeDetectionStrategy, inject, ElementRef, Injectable, HostBinding, NgZone, Self, Input, Output, NgModule } from '@angular/core';
|
|
3
3
|
import { POLYMORPHEUS_CONTEXT, PolymorpheusComponent, PolymorpheusModule } from '@tinkoff/ng-polymorpheus';
|
|
4
|
-
import { TUI_IS_IOS, tuiTypedFromEvent, tuiScrollFrom, TuiDestroyService, tuiDefaultProp, TuiRepeatTimesModule } from '@taiga-ui/cdk';
|
|
4
|
+
import { TUI_IS_IOS, tuiTypedFromEvent, tuiScrollFrom, tuiZonefree, TuiDestroyService, tuiDefaultProp, TuiRepeatTimesModule } from '@taiga-ui/cdk';
|
|
5
5
|
import { TUI_SCROLL_REF, TuiSvgModule } from '@taiga-ui/core';
|
|
6
6
|
import { EMPTY, Observable } from 'rxjs';
|
|
7
7
|
import { startWith, switchMap, filter, map, tap, takeUntil, endWith, scan, takeWhile, distinctUntilChanged, share } from 'rxjs/operators';
|
|
@@ -219,7 +219,7 @@ var TuiMobileLoaderAndroidComponent = /** @class */ (function () {
|
|
|
219
219
|
var TUI_ANDROID_LOADER = new PolymorpheusComponent(TuiMobileLoaderAndroidComponent);
|
|
220
220
|
|
|
221
221
|
var TuiPullToRefreshComponent = /** @class */ (function () {
|
|
222
|
-
function TuiPullToRefreshComponent(destroy$, _a, isIOS, threshold, component, pulling$) {
|
|
222
|
+
function TuiPullToRefreshComponent(ngZone, destroy$, _a, isIOS, threshold, component, pulling$) {
|
|
223
223
|
var _this = this;
|
|
224
224
|
var nativeElement = _a.nativeElement;
|
|
225
225
|
this.isIOS = isIOS;
|
|
@@ -232,18 +232,21 @@ var TuiPullToRefreshComponent = /** @class */ (function () {
|
|
|
232
232
|
this.pulled = this.pulling$.pipe(filter(function (distance) { return distance === _this.threshold; }));
|
|
233
233
|
this.dropped$ = this.pulling$.pipe(map(function (distance) { return distance <= MICRO_OFFSET || distance === _this.threshold; }), distinctUntilChanged());
|
|
234
234
|
// Ensure scrolling down is impossible while pulling
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
nativeElement.
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
235
|
+
if (this.component) {
|
|
236
|
+
tuiScrollFrom(nativeElement)
|
|
237
|
+
.pipe(startWith(null), tuiZonefree(ngZone), takeUntil(destroy$))
|
|
238
|
+
.subscribe(function () {
|
|
239
|
+
if (nativeElement.scrollTop) {
|
|
240
|
+
nativeElement.style.touchAction = '';
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
nativeElement.style.touchAction = 'pan-down';
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
}
|
|
245
247
|
}
|
|
246
248
|
TuiPullToRefreshComponent.ctorParameters = function () { return [
|
|
249
|
+
{ type: NgZone, decorators: [{ type: Inject, args: [NgZone,] }] },
|
|
247
250
|
{ type: Observable, decorators: [{ type: Inject, args: [TuiDestroyService,] }, { type: Self }] },
|
|
248
251
|
{ type: ElementRef, decorators: [{ type: Inject, args: [TUI_SCROLL_REF,] }] },
|
|
249
252
|
{ type: Boolean, decorators: [{ type: Inject, args: [TUI_IS_IOS,] }] },
|
|
@@ -266,12 +269,13 @@ var TuiPullToRefreshComponent = /** @class */ (function () {
|
|
|
266
269
|
providers: [TuiPullToRefreshService, TuiDestroyService],
|
|
267
270
|
styles: [".t-drop{transition:all var(--tui-duration) cubic-bezier(.4,0,.2,1)}"]
|
|
268
271
|
}),
|
|
269
|
-
__param(0, Inject(
|
|
270
|
-
__param(1, Inject(
|
|
271
|
-
__param(2, Inject(
|
|
272
|
-
__param(3, Inject(
|
|
273
|
-
__param(4, Inject(
|
|
274
|
-
__param(5, Inject(
|
|
272
|
+
__param(0, Inject(NgZone)),
|
|
273
|
+
__param(1, Inject(TuiDestroyService)), __param(1, Self()),
|
|
274
|
+
__param(2, Inject(TUI_SCROLL_REF)),
|
|
275
|
+
__param(3, Inject(TUI_IS_IOS)),
|
|
276
|
+
__param(4, Inject(TUI_PULL_TO_REFRESH_THRESHOLD)),
|
|
277
|
+
__param(5, Inject(TUI_PULL_TO_REFRESH_COMPONENT)),
|
|
278
|
+
__param(6, Inject(TuiPullToRefreshService))
|
|
275
279
|
], TuiPullToRefreshComponent);
|
|
276
280
|
return TuiPullToRefreshComponent;
|
|
277
281
|
}());
|