12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- import { __awaiter, __generator } from "tslib";
- import { Component } from '../_util/simply';
- import { PaginationDefaultProps } from './props';
- import { getInstanceBoundingClientRect } from '../_util/jsapi/get-instance-bounding-client-rect';
- Component(PaginationDefaultProps, {
- clacWidth: function () {
- return __awaiter(this, void 0, void 0, function () {
- var rect;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0: return [4 /*yield*/, getInstanceBoundingClientRect(this, "#ant-pageInfinite-".concat(this.$id ? "-".concat(this.$id) : ''))];
- case 1:
- rect = _a.sent();
- if (rect) {
- return [2 /*return*/, rect.width];
- }
- return [2 /*return*/, 0];
- }
- });
- });
- },
- onScroll: function (e) {
- return __awaiter(this, void 0, void 0, function () {
- var _a, scrollLeft, scrollWidth, viewWidth;
- return __generator(this, function (_b) {
- switch (_b.label) {
- case 0:
- _a = e.detail, scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth;
- return [4 /*yield*/, this.clacWidth()];
- case 1:
- viewWidth = _b.sent();
- if (viewWidth) {
- this.setData({
- pageDeg: Math.ceil((scrollLeft / (scrollWidth - viewWidth)) * 100),
- });
- }
- return [2 /*return*/];
- }
- });
- });
- },
- }, {
- pageDeg: 0,
- supportSjs: true,
- }, undefined, {
- wrapWidth: 0,
- onInit: function () {
- var supportSjs;
- if (typeof my === 'undefined') {
- supportSjs = true;
- }
- supportSjs = my.canIUse('sjs.event');
- this.setData({ supportSjs: supportSjs });
- },
- });
|