first commit
This commit is contained in:
4
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/composables/index.js
vendored
Normal file
4
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/composables/index.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
require("../../../../common/vendor.js");
|
||||
require("../../locale/index.js");
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/composables/index.js.map
|
||||
13
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/composables/useCell.js
vendored
Normal file
13
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/composables/useCell.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_wotDesignUni_components_composables_useParent = require("./useParent.js");
|
||||
const uni_modules_wotDesignUni_components_wdCellGroup_types = require("../wd-cell-group/types.js");
|
||||
function useCell() {
|
||||
const { parent: cellGroup, index } = uni_modules_wotDesignUni_components_composables_useParent.useParent(uni_modules_wotDesignUni_components_wdCellGroup_types.CELL_GROUP_KEY);
|
||||
const border = common_vendor.computed(() => {
|
||||
return cellGroup && cellGroup.props.border && index.value;
|
||||
});
|
||||
return { border };
|
||||
}
|
||||
exports.useCell = useCell;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/composables/useCell.js.map
|
||||
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
require("../../../../common/vendor.js");
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/composables/useChildren.js.map
|
||||
92
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/composables/useCountDown.js
vendored
Normal file
92
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/composables/useCountDown.js
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_wotDesignUni_components_common_util = require("../common/util.js");
|
||||
const uni_modules_wotDesignUni_components_composables_useRaf = require("./useRaf.js");
|
||||
const SECOND = 1e3;
|
||||
const MINUTE = 60 * SECOND;
|
||||
const HOUR = 60 * MINUTE;
|
||||
const DAY = 24 * HOUR;
|
||||
function parseTime(time) {
|
||||
const days = Math.floor(time / DAY);
|
||||
const hours = Math.floor(time % DAY / HOUR);
|
||||
const minutes = Math.floor(time % HOUR / MINUTE);
|
||||
const seconds = Math.floor(time % MINUTE / SECOND);
|
||||
const milliseconds = Math.floor(time % SECOND);
|
||||
return {
|
||||
total: time,
|
||||
days,
|
||||
hours,
|
||||
minutes,
|
||||
seconds,
|
||||
milliseconds
|
||||
};
|
||||
}
|
||||
function isSameSecond(time1, time2) {
|
||||
return Math.floor(time1 / 1e3) === Math.floor(time2 / 1e3);
|
||||
}
|
||||
function useCountDown(options) {
|
||||
let endTime;
|
||||
let counting;
|
||||
const { start: startRaf, cancel: cancelRaf } = uni_modules_wotDesignUni_components_composables_useRaf.useRaf(tick);
|
||||
const remain = common_vendor.ref(options.time);
|
||||
const current = common_vendor.computed(() => parseTime(remain.value));
|
||||
const pause = () => {
|
||||
counting = false;
|
||||
cancelRaf();
|
||||
};
|
||||
const getCurrentRemain = () => Math.max(endTime - Date.now(), 0);
|
||||
const setRemain = (value) => {
|
||||
remain.value = value;
|
||||
uni_modules_wotDesignUni_components_common_util.isDef(options.onChange) && options.onChange(current.value);
|
||||
if (value === 0) {
|
||||
pause();
|
||||
uni_modules_wotDesignUni_components_common_util.isDef(options.onFinish) && options.onFinish();
|
||||
}
|
||||
};
|
||||
const microTick = () => {
|
||||
if (counting) {
|
||||
setRemain(getCurrentRemain());
|
||||
if (remain.value > 0) {
|
||||
startRaf();
|
||||
}
|
||||
}
|
||||
};
|
||||
const macroTick = () => {
|
||||
if (counting) {
|
||||
const remainRemain = getCurrentRemain();
|
||||
if (!isSameSecond(remainRemain, remain.value) || remainRemain === 0) {
|
||||
setRemain(remainRemain);
|
||||
}
|
||||
if (remain.value > 0) {
|
||||
startRaf();
|
||||
}
|
||||
}
|
||||
};
|
||||
function tick() {
|
||||
if (options.millisecond) {
|
||||
microTick();
|
||||
} else {
|
||||
macroTick();
|
||||
}
|
||||
}
|
||||
const start = () => {
|
||||
if (!counting) {
|
||||
endTime = Date.now() + remain.value;
|
||||
counting = true;
|
||||
startRaf();
|
||||
}
|
||||
};
|
||||
const reset = (totalTime = options.time) => {
|
||||
pause();
|
||||
remain.value = totalTime;
|
||||
};
|
||||
common_vendor.onBeforeUnmount(pause);
|
||||
return {
|
||||
start,
|
||||
pause,
|
||||
reset,
|
||||
current
|
||||
};
|
||||
}
|
||||
exports.useCountDown = useCountDown;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/composables/useCountDown.js.map
|
||||
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
require("../../../../common/vendor.js");
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/composables/useLockScroll.js.map
|
||||
22
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/composables/useParent.js
vendored
Normal file
22
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/composables/useParent.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
function useParent(key) {
|
||||
const parent = common_vendor.inject(key, null);
|
||||
if (parent) {
|
||||
const instance = common_vendor.getCurrentInstance();
|
||||
const { link, unlink, internalChildren } = parent;
|
||||
link(instance);
|
||||
common_vendor.onUnmounted(() => unlink(instance));
|
||||
const index = common_vendor.computed(() => internalChildren.indexOf(instance));
|
||||
return {
|
||||
parent,
|
||||
index
|
||||
};
|
||||
}
|
||||
return {
|
||||
parent: null,
|
||||
index: common_vendor.ref(-1)
|
||||
};
|
||||
}
|
||||
exports.useParent = useParent;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/composables/useParent.js.map
|
||||
3
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/composables/usePopover.js
vendored
Normal file
3
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/composables/usePopover.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
require("../../../../common/vendor.js");
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/composables/usePopover.js.map
|
||||
3
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/composables/useQueue.js
vendored
Normal file
3
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/composables/useQueue.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
require("../../../../common/vendor.js");
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/composables/useQueue.js.map
|
||||
29
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/composables/useRaf.js
vendored
Normal file
29
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/composables/useRaf.js
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_wotDesignUni_components_common_util = require("../common/util.js");
|
||||
function useRaf(callback) {
|
||||
const requestRef = common_vendor.ref(null);
|
||||
const start = () => {
|
||||
const handle = (time) => {
|
||||
callback(time);
|
||||
};
|
||||
if (uni_modules_wotDesignUni_components_common_util.isH5) {
|
||||
requestRef.value = requestAnimationFrame(handle);
|
||||
} else {
|
||||
requestRef.value = setTimeout(() => handle(Date.now()), 1e3 / 30);
|
||||
}
|
||||
};
|
||||
const cancel = () => {
|
||||
if (uni_modules_wotDesignUni_components_common_util.isH5 && uni_modules_wotDesignUni_components_common_util.isNumber(requestRef.value)) {
|
||||
cancelAnimationFrame(requestRef.value);
|
||||
} else if (uni_modules_wotDesignUni_components_common_util.isDef(requestRef.value)) {
|
||||
clearTimeout(requestRef.value);
|
||||
}
|
||||
};
|
||||
common_vendor.onUnmounted(() => {
|
||||
cancel();
|
||||
});
|
||||
return { start, cancel };
|
||||
}
|
||||
exports.useRaf = useRaf;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/composables/useRaf.js.map
|
||||
3
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/composables/useTouch.js
vendored
Normal file
3
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/composables/useTouch.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
require("../../../../common/vendor.js");
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/composables/useTouch.js.map
|
||||
14
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/composables/useTranslate.js
vendored
Normal file
14
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/composables/useTranslate.js
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
const uni_modules_wotDesignUni_components_common_util = require("../common/util.js");
|
||||
const uni_modules_wotDesignUni_locale_index = require("../../locale/index.js");
|
||||
const useTranslate = (name) => {
|
||||
const prefix = name ? uni_modules_wotDesignUni_components_common_util.camelCase(name) + "." : "";
|
||||
const translate = (key, ...args) => {
|
||||
const currentMessages = uni_modules_wotDesignUni_locale_index.Locale.messages();
|
||||
const message = uni_modules_wotDesignUni_components_common_util.getPropByPath(currentMessages, prefix + key);
|
||||
return uni_modules_wotDesignUni_components_common_util.isFunction(message) ? message(...args) : uni_modules_wotDesignUni_components_common_util.isDef(message) ? message : `${prefix}${key}`;
|
||||
};
|
||||
return { translate };
|
||||
};
|
||||
exports.useTranslate = useTranslate;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/composables/useTranslate.js.map
|
||||
3
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/composables/useUpload.js
vendored
Normal file
3
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/composables/useUpload.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
require("../../../../common/vendor.js");
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/composables/useUpload.js.map
|
||||
Reference in New Issue
Block a user