first commit
This commit is contained in:
56
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/mixins/page-scroll.js
vendored
Normal file
56
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/mixins/page-scroll.js
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
const uni_modules_tdesignUniapp_components_common_utils = require("../common/utils.js");
|
||||
const uni_modules_tdesignUniapp_components_common_bus = require("../common/bus.js");
|
||||
const bus = new uni_modules_tdesignUniapp_components_common_bus.Bus();
|
||||
const PAGE_SCROLL_EVENT_NAME = "page-scroll";
|
||||
const onPageScroll = function(event) {
|
||||
const page = uni_modules_tdesignUniapp_components_common_utils.getCurrentPage();
|
||||
if (!page)
|
||||
return;
|
||||
const { pageScroller } = page;
|
||||
pageScroller == null ? void 0 : pageScroller.forEach((scroller) => {
|
||||
if (typeof scroller === "function") {
|
||||
scroller(event);
|
||||
}
|
||||
});
|
||||
};
|
||||
const pageScrollMixin = (funcName = "onScroll", useBus = true) => {
|
||||
return {
|
||||
mounted() {
|
||||
if (useBus) {
|
||||
bus.on(PAGE_SCROLL_EVENT_NAME, this[funcName]);
|
||||
return;
|
||||
}
|
||||
const page = uni_modules_tdesignUniapp_components_common_utils.getCurrentPage();
|
||||
if (!page)
|
||||
return;
|
||||
if (Array.isArray(page.pageScroller)) {
|
||||
page.pageScroller.push(this._bindScroller);
|
||||
} else {
|
||||
page.pageScroller = typeof page.onPageScroll === "function" ? [page.onPageScroll.bind(page), this._bindScroller] : [this._bindScroller];
|
||||
}
|
||||
page.onPageScroll = onPageScroll;
|
||||
},
|
||||
beforeUnMount() {
|
||||
var _a;
|
||||
if (useBus) {
|
||||
bus.off(PAGE_SCROLL_EVENT_NAME, this[funcName]);
|
||||
return;
|
||||
}
|
||||
const page = uni_modules_tdesignUniapp_components_common_utils.getCurrentPage();
|
||||
if (!page)
|
||||
return;
|
||||
page.pageScroller = ((_a = page.pageScroller) == null ? void 0 : _a.filter((item) => item !== this._bindScroller)) || [];
|
||||
},
|
||||
methods: {
|
||||
_bindScroller(e) {
|
||||
var _a;
|
||||
let result;
|
||||
result = (_a = this[funcName]) == null ? void 0 : _a.call(this, e);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
exports.pageScrollMixin = pageScrollMixin;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/tdesign-uniapp/components/mixins/page-scroll.js.map
|
||||
32
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/mixins/touch.js
vendored
Normal file
32
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/mixins/touch.js
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
const getDirection = (t, s) => t > s && t > 10 ? "horizontal" : s > t && s > 10 ? "vertical" : "";
|
||||
const touch = {
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
methods: {
|
||||
resetTouchStatus() {
|
||||
this.direction = "";
|
||||
this.deltaX = 0;
|
||||
this.deltaY = 0;
|
||||
this.offsetX = 0;
|
||||
this.offsetY = 0;
|
||||
},
|
||||
touchStart(t) {
|
||||
this.resetTouchStatus();
|
||||
const [s] = t.touches;
|
||||
this.startX = s.clientX;
|
||||
this.startY = s.clientY;
|
||||
},
|
||||
touchMove(t) {
|
||||
const [s] = t.touches;
|
||||
this.deltaX = s.clientX - this.startX;
|
||||
this.deltaY = s.clientY - this.startY;
|
||||
this.offsetX = Math.abs(this.deltaX);
|
||||
this.offsetY = Math.abs(this.deltaY);
|
||||
this.direction = getDirection(this.offsetX, this.offsetY);
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.touch = touch;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/tdesign-uniapp/components/mixins/touch.js.map
|
||||
132
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/mixins/transition.js
vendored
Normal file
132
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/mixins/transition.js
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
"use strict";
|
||||
const uni_modules_tdesignUniapp_components_common_config = require("../common/config.js");
|
||||
function transition() {
|
||||
return {
|
||||
data() {
|
||||
return {
|
||||
transitionClass: "",
|
||||
transitionDurations: 300,
|
||||
className: "",
|
||||
realVisible: false
|
||||
};
|
||||
},
|
||||
props: {
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: null
|
||||
},
|
||||
appear: Boolean,
|
||||
name: {
|
||||
type: String,
|
||||
default: "fade"
|
||||
},
|
||||
durations: {
|
||||
type: Number,
|
||||
optionalTypes: [Array]
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
visible: {
|
||||
handler(val, oldVal) {
|
||||
this.watchVisible(val, oldVal);
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.status = "";
|
||||
this.transitionT = 0;
|
||||
},
|
||||
beforeMount() {
|
||||
this.dataDurations = this.getDurations();
|
||||
if (this.visible) {
|
||||
this.enter();
|
||||
}
|
||||
this.inited = true;
|
||||
},
|
||||
destroyed() {
|
||||
clearTimeout(this.transitionT);
|
||||
},
|
||||
methods: {
|
||||
watchVisible(curr, prev) {
|
||||
if (this.inited && curr !== prev) {
|
||||
curr ? this.enter() : this.leave();
|
||||
}
|
||||
},
|
||||
getDurations() {
|
||||
const { durations } = this;
|
||||
if (Array.isArray(durations)) {
|
||||
return durations.map((item) => Number(item));
|
||||
}
|
||||
return [Number(durations), Number(durations)];
|
||||
},
|
||||
enter() {
|
||||
const { name, transitionDurations } = this;
|
||||
const [duration] = this.dataDurations;
|
||||
this.status = "entering";
|
||||
this.realVisible = true;
|
||||
this.transitionClass = `${uni_modules_tdesignUniapp_components_common_config.prefix}-${name}-enter ${uni_modules_tdesignUniapp_components_common_config.prefix}-${name}-enter-active`;
|
||||
setTimeout(() => {
|
||||
this.transitionClass = `${uni_modules_tdesignUniapp_components_common_config.prefix}-${name}-enter-active ${uni_modules_tdesignUniapp_components_common_config.prefix}-${name}-enter-to`;
|
||||
}, 30);
|
||||
if (typeof duration === "number" && duration > 0) {
|
||||
this.transitionT = setTimeout(this.entered.bind(this), duration + 30);
|
||||
} else {
|
||||
this.transitionT = setTimeout(
|
||||
this.status === "leaving" ? this.leaved.bind(this) : () => {
|
||||
},
|
||||
transitionDurations + 30
|
||||
);
|
||||
}
|
||||
},
|
||||
entered() {
|
||||
this.customDuration = false;
|
||||
clearTimeout(this.transitionT);
|
||||
this.status = "entered";
|
||||
this.transitionClass = "";
|
||||
},
|
||||
leave() {
|
||||
const { name, transitionDurations } = this;
|
||||
const [, duration] = this.dataDurations;
|
||||
this.status = "leaving";
|
||||
this.transitionClass = `${uni_modules_tdesignUniapp_components_common_config.prefix}-${name}-leave ${uni_modules_tdesignUniapp_components_common_config.prefix}-${name}-leave-active`;
|
||||
clearTimeout(this.transitionT);
|
||||
setTimeout(() => {
|
||||
this.transitionClass = `${uni_modules_tdesignUniapp_components_common_config.prefix}-${name}-leave-active ${uni_modules_tdesignUniapp_components_common_config.prefix}-${name}-leave-to`;
|
||||
}, 30);
|
||||
if (typeof duration === "number" && duration > 0) {
|
||||
this.customDuration = true;
|
||||
this.transitionT = setTimeout(this.leaved.bind(this), duration + 30);
|
||||
} else {
|
||||
this.transitionT = setTimeout(
|
||||
this.status === "leaving" ? this.leaved.bind(this) : () => {
|
||||
},
|
||||
transitionDurations + 30
|
||||
);
|
||||
}
|
||||
},
|
||||
leaved() {
|
||||
this.customDuration = false;
|
||||
this.$emit("leaved");
|
||||
clearTimeout(this.transitionT);
|
||||
this.status = "leaved";
|
||||
this.transitionClass = "";
|
||||
this.realVisible = false;
|
||||
},
|
||||
onTransitionEnd() {
|
||||
if (this.customDuration) {
|
||||
return;
|
||||
}
|
||||
clearTimeout(this.transitionT);
|
||||
if (this.status === "entering" && this.visible) {
|
||||
this.entered();
|
||||
} else if (this.status === "leaving" && !this.visible) {
|
||||
this.leaved();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
const transitionMixins = transition();
|
||||
exports.transition = transition;
|
||||
exports.transitionMixins = transitionMixins;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/tdesign-uniapp/components/mixins/transition.js.map
|
||||
36
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/mixins/using-custom-navbar.js
vendored
Normal file
36
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/mixins/using-custom-navbar.js
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_tdesignUniapp_components_common_utils = require("../common/utils.js");
|
||||
const useCustomNavbarBehavior = {
|
||||
data() {
|
||||
return {
|
||||
distanceTop: 0
|
||||
};
|
||||
},
|
||||
props: {
|
||||
usingCustomNavbar: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
customNavbarHeight: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.usingCustomNavbar) {
|
||||
this.calculateCustomNavbarDistanceTop();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
calculateCustomNavbarDistanceTop() {
|
||||
const { statusBarHeight } = uni_modules_tdesignUniapp_components_common_utils.systemInfo;
|
||||
let distance = 0;
|
||||
const menuButton = common_vendor.index.getMenuButtonBoundingClientRect();
|
||||
distance = menuButton.top + menuButton.bottom - statusBarHeight;
|
||||
this.distanceTop = Math.max(distance, this.customNavbarHeight + statusBarHeight);
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.useCustomNavbarBehavior = useCustomNavbarBehavior;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/tdesign-uniapp/components/mixins/using-custom-navbar.js.map
|
||||
Reference in New Issue
Block a user