first commit
This commit is contained in:
269
unpackage/dist/dev/mp-weixin/uni_modules/mp-html/components/mp-html/mp-html.js
vendored
Normal file
269
unpackage/dist/dev/mp-weixin/uni_modules/mp-html/components/mp-html/mp-html.js
vendored
Normal file
@@ -0,0 +1,269 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_mpHtml_components_mpHtml_parser = require("./parser.js");
|
||||
const node = () => "./node/node.js";
|
||||
const plugins = [];
|
||||
const _sfc_main = {
|
||||
name: "mp-html",
|
||||
data() {
|
||||
return {
|
||||
nodes: []
|
||||
};
|
||||
},
|
||||
props: {
|
||||
containerStyle: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
content: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
copyLink: {
|
||||
type: [Boolean, String],
|
||||
default: true
|
||||
},
|
||||
domain: String,
|
||||
errorImg: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
lazyLoad: {
|
||||
type: [Boolean, String],
|
||||
default: false
|
||||
},
|
||||
loadingImg: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
pauseVideo: {
|
||||
type: [Boolean, String],
|
||||
default: true
|
||||
},
|
||||
previewImg: {
|
||||
type: [Boolean, String],
|
||||
default: true
|
||||
},
|
||||
scrollTable: [Boolean, String],
|
||||
selectable: [Boolean, String],
|
||||
setTitle: {
|
||||
type: [Boolean, String],
|
||||
default: true
|
||||
},
|
||||
showImgMenu: {
|
||||
type: [Boolean, String],
|
||||
default: true
|
||||
},
|
||||
tagStyle: Object,
|
||||
useAnchor: [Boolean, Number]
|
||||
},
|
||||
emits: ["load", "ready", "imgtap", "linktap", "play", "error"],
|
||||
components: {
|
||||
node
|
||||
},
|
||||
watch: {
|
||||
content(content) {
|
||||
this.setContent(content);
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.plugins = [];
|
||||
for (let i = plugins.length; i--; ) {
|
||||
this.plugins.push(new plugins[i](this));
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (this.content && !this.nodes.length) {
|
||||
this.setContent(this.content);
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this._hook("onDetached");
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* @description 将锚点跳转的范围限定在一个 scroll-view 内
|
||||
* @param {Object} page scroll-view 所在页面的示例
|
||||
* @param {String} selector scroll-view 的选择器
|
||||
* @param {String} scrollTop scroll-view scroll-top 属性绑定的变量名
|
||||
*/
|
||||
in(page, selector, scrollTop) {
|
||||
if (page && selector && scrollTop) {
|
||||
this._in = {
|
||||
page,
|
||||
selector,
|
||||
scrollTop
|
||||
};
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @description 锚点跳转
|
||||
* @param {String} id 要跳转的锚点 id
|
||||
* @param {Number} offset 跳转位置的偏移量
|
||||
* @returns {Promise}
|
||||
*/
|
||||
navigateTo(id, offset) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!this.useAnchor) {
|
||||
reject(Error("Anchor is disabled"));
|
||||
return;
|
||||
}
|
||||
offset = offset || parseInt(this.useAnchor) || 0;
|
||||
let deep = " ";
|
||||
deep = ">>>";
|
||||
const selector = common_vendor.index.createSelectorQuery().in(this._in ? this._in.page : this).select((this._in ? this._in.selector : "._root") + (id ? `${deep}#${id}` : "")).boundingClientRect();
|
||||
if (this._in) {
|
||||
selector.select(this._in.selector).scrollOffset().select(this._in.selector).boundingClientRect();
|
||||
} else {
|
||||
selector.selectViewport().scrollOffset();
|
||||
}
|
||||
selector.exec((res) => {
|
||||
if (!res[0]) {
|
||||
reject(Error("Label not found"));
|
||||
return;
|
||||
}
|
||||
const scrollTop = res[1].scrollTop + res[0].top - (res[2] ? res[2].top : 0) + offset;
|
||||
if (this._in) {
|
||||
this._in.page[this._in.scrollTop] = scrollTop;
|
||||
} else {
|
||||
common_vendor.index.pageScrollTo({
|
||||
scrollTop,
|
||||
duration: 300
|
||||
});
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* @description 获取文本内容
|
||||
* @return {String}
|
||||
*/
|
||||
getText(nodes) {
|
||||
let text = "";
|
||||
(function traversal(nodes2) {
|
||||
for (let i = 0; i < nodes2.length; i++) {
|
||||
const node2 = nodes2[i];
|
||||
if (node2.type === "text") {
|
||||
text += node2.text.replace(/&/g, "&");
|
||||
} else if (node2.name === "br") {
|
||||
text += "\n";
|
||||
} else {
|
||||
const isBlock = node2.name === "p" || node2.name === "div" || node2.name === "tr" || node2.name === "li" || node2.name[0] === "h" && node2.name[1] > "0" && node2.name[1] < "7";
|
||||
if (isBlock && text && text[text.length - 1] !== "\n") {
|
||||
text += "\n";
|
||||
}
|
||||
if (node2.children) {
|
||||
traversal(node2.children);
|
||||
}
|
||||
if (isBlock && text[text.length - 1] !== "\n") {
|
||||
text += "\n";
|
||||
} else if (node2.name === "td" || node2.name === "th") {
|
||||
text += " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
})(nodes || this.nodes);
|
||||
return text;
|
||||
},
|
||||
/**
|
||||
* @description 获取内容大小和位置
|
||||
* @return {Promise}
|
||||
*/
|
||||
getRect() {
|
||||
return new Promise((resolve, reject) => {
|
||||
common_vendor.index.createSelectorQuery().in(this).select("#_root").boundingClientRect().exec((res) => res[0] ? resolve(res[0]) : reject(Error("Root label not found")));
|
||||
});
|
||||
},
|
||||
/**
|
||||
* @description 暂停播放媒体
|
||||
*/
|
||||
pauseMedia() {
|
||||
for (let i = (this._videos || []).length; i--; ) {
|
||||
this._videos[i].pause();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @description 设置媒体播放速率
|
||||
* @param {Number} rate 播放速率
|
||||
*/
|
||||
setPlaybackRate(rate) {
|
||||
this.playbackRate = rate;
|
||||
for (let i = (this._videos || []).length; i--; ) {
|
||||
this._videos[i].playbackRate(rate);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @description 设置内容
|
||||
* @param {String} content html 内容
|
||||
* @param {Boolean} append 是否在尾部追加
|
||||
*/
|
||||
setContent(content, append) {
|
||||
if (!append || !this.imgList) {
|
||||
this.imgList = [];
|
||||
}
|
||||
const nodes = new uni_modules_mpHtml_components_mpHtml_parser.Parser(this).parse(content);
|
||||
this.$set(this, "nodes", append ? (this.nodes || []).concat(nodes) : nodes);
|
||||
this._videos = [];
|
||||
this.$nextTick(() => {
|
||||
this._hook("onLoad");
|
||||
this.$emit("load");
|
||||
});
|
||||
if (this.lazyLoad || this.imgList._unloadimgs < this.imgList.length / 2) {
|
||||
let height = 0;
|
||||
const callback = (rect) => {
|
||||
if (!rect || !rect.height)
|
||||
rect = {};
|
||||
if (rect.height === height) {
|
||||
this.$emit("ready", rect);
|
||||
} else {
|
||||
height = rect.height;
|
||||
setTimeout(() => {
|
||||
this.getRect().then(callback).catch(callback);
|
||||
}, 350);
|
||||
}
|
||||
};
|
||||
this.getRect().then(callback).catch(callback);
|
||||
} else {
|
||||
if (!this.imgList._unloadimgs) {
|
||||
this.getRect().then((rect) => {
|
||||
this.$emit("ready", rect);
|
||||
}).catch(() => {
|
||||
this.$emit("ready", {});
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @description 调用插件钩子函数
|
||||
*/
|
||||
_hook(name) {
|
||||
for (let i = plugins.length; i--; ) {
|
||||
if (this.plugins[i][name]) {
|
||||
this.plugins[i][name]();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _component_node = common_vendor.resolveComponent("node");
|
||||
_component_node();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: !$data.nodes[0]
|
||||
}, !$data.nodes[0] ? {} : {
|
||||
b: common_vendor.p({
|
||||
childs: $data.nodes,
|
||||
opts: [$props.lazyLoad, $props.loadingImg, $props.errorImg, $props.showImgMenu, $props.selectable],
|
||||
name: "span"
|
||||
})
|
||||
}, {
|
||||
c: common_vendor.n(($props.selectable ? "_select " : "") + "_root"),
|
||||
d: common_vendor.s($props.containerStyle)
|
||||
});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/mp-html/components/mp-html/mp-html.js.map
|
||||
6
unpackage/dist/dev/mp-weixin/uni_modules/mp-html/components/mp-html/mp-html.json
vendored
Normal file
6
unpackage/dist/dev/mp-weixin/uni_modules/mp-html/components/mp-html/mp-html.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"node": "./node/node"
|
||||
}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/uni_modules/mp-html/components/mp-html/mp-html.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/uni_modules/mp-html/components/mp-html/mp-html.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view id="_root" class="{{c}}" style="{{d}}"><slot wx:if="{{a}}"/><node wx:else u-i="0ec86618-0" bind:__l="__l" u-p="{{b||''}}"/></view>
|
||||
16
unpackage/dist/dev/mp-weixin/uni_modules/mp-html/components/mp-html/mp-html.wxss
vendored
Normal file
16
unpackage/dist/dev/mp-weixin/uni_modules/mp-html/components/mp-html/mp-html.wxss
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
/* 根节点样式 */
|
||||
._root {
|
||||
padding: 1px 0;
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
/* 长按复制 */
|
||||
._select {
|
||||
-webkit-user-select: text;
|
||||
user-select: text;
|
||||
}
|
||||
|
||||
404
unpackage/dist/dev/mp-weixin/uni_modules/mp-html/components/mp-html/node/node.js
vendored
Normal file
404
unpackage/dist/dev/mp-weixin/uni_modules/mp-html/components/mp-html/node/node.js
vendored
Normal file
@@ -0,0 +1,404 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../../common/vendor.js");
|
||||
const block0 = {};
|
||||
const node = () => Promise.resolve().then(() => RDovQmFja3VwL0RvY3VtZW50cy9IQnVpbGRlclByb2plY3RzL2Rhamlhbmt1YW5nL3VuaV9tb2R1bGVzL21wLWh0bWwvY29tcG9uZW50cy9tcC1odG1sL25vZGUvbm9kZS52dWU);
|
||||
const _sfc_main = {
|
||||
name: "node",
|
||||
options: {
|
||||
virtualHost: true
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
ctrl: {},
|
||||
isiOS: common_vendor.index.getSystemInfoSync().system.includes("iOS")
|
||||
};
|
||||
},
|
||||
props: {
|
||||
name: String,
|
||||
attrs: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
childs: Array,
|
||||
opts: Array
|
||||
},
|
||||
components: {
|
||||
node
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
for (this.root = this.$parent; this.root.$options.name !== "mp-html"; this.root = this.root.$parent)
|
||||
;
|
||||
});
|
||||
},
|
||||
beforeDestroy() {
|
||||
},
|
||||
methods: {
|
||||
toJSON() {
|
||||
return this;
|
||||
},
|
||||
/**
|
||||
* @description 播放视频事件
|
||||
* @param {Event} e
|
||||
*/
|
||||
play(e) {
|
||||
const i = e.currentTarget.dataset.i;
|
||||
const node2 = this.childs[i];
|
||||
this.root.$emit("play", {
|
||||
source: node2.name,
|
||||
attrs: {
|
||||
...node2.attrs,
|
||||
src: node2.src[this.ctrl[i] || 0]
|
||||
}
|
||||
});
|
||||
if (this.root.pauseVideo) {
|
||||
let flag = false;
|
||||
const id = e.target.id;
|
||||
for (let i2 = this.root._videos.length; i2--; ) {
|
||||
if (this.root._videos[i2].id === id) {
|
||||
flag = true;
|
||||
} else {
|
||||
this.root._videos[i2].pause();
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
const ctx = common_vendor.index.createVideoContext(
|
||||
id,
|
||||
this
|
||||
);
|
||||
ctx.id = id;
|
||||
if (this.root.playbackRate) {
|
||||
ctx.playbackRate(this.root.playbackRate);
|
||||
}
|
||||
this.root._videos.push(ctx);
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @description 图片点击事件
|
||||
* @param {Event} e
|
||||
*/
|
||||
imgTap(e) {
|
||||
const node2 = this.childs[e.currentTarget.dataset.i];
|
||||
if (node2.a) {
|
||||
this.linkTap(node2.a);
|
||||
return;
|
||||
}
|
||||
if (node2.attrs.ignore)
|
||||
return;
|
||||
this.root.$emit("imgtap", node2.attrs);
|
||||
if (this.root.previewImg) {
|
||||
common_vendor.index.previewImage({
|
||||
showmenu: this.root.showImgMenu,
|
||||
current: parseInt(node2.attrs.i),
|
||||
urls: this.root.imgList
|
||||
});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @description 图片长按
|
||||
*/
|
||||
imgLongTap(e) {
|
||||
},
|
||||
/**
|
||||
* @description 图片加载完成事件
|
||||
* @param {Event} e
|
||||
*/
|
||||
imgLoad(e) {
|
||||
const i = e.currentTarget.dataset.i;
|
||||
if (!this.childs[i].w) {
|
||||
this.$set(this.ctrl, i, e.detail.width);
|
||||
} else if (this.opts[1] && !this.ctrl[i] || this.ctrl[i] === -1) {
|
||||
this.$set(this.ctrl, i, 1);
|
||||
}
|
||||
this.checkReady();
|
||||
},
|
||||
/**
|
||||
* @description 检查是否所有图片加载完毕
|
||||
*/
|
||||
checkReady() {
|
||||
if (this.root && !this.root.lazyLoad) {
|
||||
this.root._unloadimgs -= 1;
|
||||
if (!this.root._unloadimgs) {
|
||||
setTimeout(() => {
|
||||
this.root.getRect().then((rect) => {
|
||||
this.root.$emit("ready", rect);
|
||||
}).catch(() => {
|
||||
this.root.$emit("ready", {});
|
||||
});
|
||||
}, 350);
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @description 链接点击事件
|
||||
* @param {Event} e
|
||||
*/
|
||||
linkTap(e) {
|
||||
const node2 = e.currentTarget ? this.childs[e.currentTarget.dataset.i] : {};
|
||||
const attrs = node2.attrs || e;
|
||||
const href = attrs.href;
|
||||
this.root.$emit("linktap", Object.assign({
|
||||
innerText: this.root.getText(node2.children || [])
|
||||
// 链接内的文本内容
|
||||
}, attrs));
|
||||
if (href) {
|
||||
if (href[0] === "#") {
|
||||
this.root.navigateTo(href.substring(1)).catch(() => {
|
||||
});
|
||||
} else if (href.split("?")[0].includes("://")) {
|
||||
if (this.root.copyLink) {
|
||||
common_vendor.index.setClipboardData({
|
||||
data: href,
|
||||
success: () => common_vendor.index.showToast({
|
||||
title: "链接已复制"
|
||||
})
|
||||
});
|
||||
}
|
||||
} else {
|
||||
common_vendor.index.navigateTo({
|
||||
url: href,
|
||||
fail() {
|
||||
common_vendor.index.switchTab({
|
||||
url: href,
|
||||
fail() {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @description 错误事件
|
||||
* @param {Event} e
|
||||
*/
|
||||
mediaError(e) {
|
||||
const i = e.currentTarget.dataset.i;
|
||||
const node2 = this.childs[i];
|
||||
if (node2.name === "video" || node2.name === "audio") {
|
||||
let index = (this.ctrl[i] || 0) + 1;
|
||||
if (index > node2.src.length) {
|
||||
index = 0;
|
||||
}
|
||||
if (index < node2.src.length) {
|
||||
this.$set(this.ctrl, i, index);
|
||||
return;
|
||||
}
|
||||
} else if (node2.name === "img") {
|
||||
if (this.opts[2]) {
|
||||
this.$set(this.ctrl, i, -1);
|
||||
}
|
||||
this.checkReady();
|
||||
}
|
||||
if (this.root) {
|
||||
this.root.$emit("error", {
|
||||
source: node2.name,
|
||||
attrs: node2.attrs,
|
||||
errMsg: e.detail.errMsg
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _component_node = common_vendor.resolveComponent("node");
|
||||
_component_node();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: common_vendor.f($props.childs, (n, i, i0) => {
|
||||
return common_vendor.e({
|
||||
a: n.name === "img" && !n.t && ($props.opts[1] && !$data.ctrl[i] || $data.ctrl[i] < 0)
|
||||
}, n.name === "img" && !n.t && ($props.opts[1] && !$data.ctrl[i] || $data.ctrl[i] < 0) ? {
|
||||
b: common_vendor.s(n.attrs.style),
|
||||
c: $data.ctrl[i] < 0 ? $props.opts[2] : $props.opts[1]
|
||||
} : {}, {
|
||||
d: n.name === "img" && n.t
|
||||
}, n.name === "img" && n.t ? {
|
||||
e: common_vendor.s("display:" + n.t),
|
||||
f: [{
|
||||
attrs: {
|
||||
style: n.attrs.style || "",
|
||||
src: n.attrs.src
|
||||
},
|
||||
name: "img"
|
||||
}],
|
||||
g: i,
|
||||
h: common_vendor.o((...args) => $options.imgTap && $options.imgTap(...args), i)
|
||||
} : n.name === "img" ? {
|
||||
j: n.attrs.id,
|
||||
k: common_vendor.n("_img " + n.attrs.class),
|
||||
l: common_vendor.s(($data.ctrl[i] === -1 ? "display:none;" : "") + "width:" + ($data.ctrl[i] || 1) + "px;height:1px;" + n.attrs.style),
|
||||
m: n.attrs.src,
|
||||
n: !n.h ? "widthFix" : !n.w ? "heightFix" : n.m || "scaleToFill",
|
||||
o: $props.opts[0],
|
||||
p: n.webp,
|
||||
q: $props.opts[3] && !n.attrs.ignore,
|
||||
r: !$props.opts[3] || n.attrs.ignore,
|
||||
s: i,
|
||||
t: common_vendor.o((...args) => $options.imgLoad && $options.imgLoad(...args), i),
|
||||
v: common_vendor.o((...args) => $options.mediaError && $options.mediaError(...args), i),
|
||||
w: common_vendor.o((...args) => $options.imgTap && $options.imgTap(...args), i),
|
||||
x: common_vendor.o((...args) => $options.imgLongTap && $options.imgLongTap(...args), i)
|
||||
} : n.text ? {
|
||||
z: common_vendor.t(n.text),
|
||||
A: $props.opts[4] == "force" && $data.isiOS
|
||||
} : n.name === "br" ? {} : n.name === "a" ? {
|
||||
D: "99a81ae4-0-" + i0,
|
||||
E: common_vendor.p({
|
||||
name: "span",
|
||||
childs: n.children,
|
||||
opts: $props.opts
|
||||
}),
|
||||
F: n.attrs.id,
|
||||
G: common_vendor.n((n.attrs.href ? "_a " : "") + n.attrs.class),
|
||||
H: common_vendor.s("display:inline;" + n.attrs.style),
|
||||
I: i,
|
||||
J: common_vendor.o((...args) => $options.linkTap && $options.linkTap(...args), i)
|
||||
} : n.name === "video" ? {
|
||||
L: n.attrs.id,
|
||||
M: common_vendor.n(n.attrs.class),
|
||||
N: common_vendor.s(n.attrs.style),
|
||||
O: n.attrs.autoplay,
|
||||
P: n.attrs.controls,
|
||||
Q: n.attrs.loop,
|
||||
R: n.attrs.muted,
|
||||
S: n.attrs["object-fit"],
|
||||
T: n.attrs.poster,
|
||||
U: n.src[$data.ctrl[i] || 0],
|
||||
V: i,
|
||||
W: common_vendor.o((...args) => $options.play && $options.play(...args), i),
|
||||
X: common_vendor.o((...args) => $options.mediaError && $options.mediaError(...args), i)
|
||||
} : n.name === "audio" ? {
|
||||
Z: n.attrs.id,
|
||||
aa: common_vendor.n(n.attrs.class),
|
||||
ab: common_vendor.s(n.attrs.style),
|
||||
ac: n.attrs.author,
|
||||
ad: n.attrs.controls,
|
||||
ae: n.attrs.loop,
|
||||
af: n.attrs.name,
|
||||
ag: n.attrs.poster,
|
||||
ah: n.src[$data.ctrl[i] || 0],
|
||||
ai: i,
|
||||
aj: common_vendor.o((...args) => $options.play && $options.play(...args), i),
|
||||
ak: common_vendor.o((...args) => $options.mediaError && $options.mediaError(...args), i)
|
||||
} : n.name === "table" && n.c || n.name === "li" ? common_vendor.e({
|
||||
am: n.name === "li"
|
||||
}, n.name === "li" ? {
|
||||
an: "99a81ae4-1-" + i0,
|
||||
ao: common_vendor.p({
|
||||
childs: n.children,
|
||||
opts: $props.opts
|
||||
})
|
||||
} : {
|
||||
ap: common_vendor.f(n.children, (tbody, x, i1) => {
|
||||
return common_vendor.e({
|
||||
a: tbody.name === "td" || tbody.name === "th"
|
||||
}, tbody.name === "td" || tbody.name === "th" ? {
|
||||
b: "99a81ae4-2-" + i0 + "-" + i1,
|
||||
c: common_vendor.p({
|
||||
childs: tbody.children,
|
||||
opts: $props.opts
|
||||
})
|
||||
} : {
|
||||
d: common_vendor.f(tbody.children, (tr, y, i2) => {
|
||||
return common_vendor.e({
|
||||
a: tr.name === "td" || tr.name === "th"
|
||||
}, tr.name === "td" || tr.name === "th" ? {
|
||||
b: "99a81ae4-3-" + i0 + "-" + i1 + "-" + i2,
|
||||
c: common_vendor.p({
|
||||
childs: tr.children,
|
||||
opts: $props.opts
|
||||
}),
|
||||
d: common_vendor.n("_" + tr.name + " " + tr.attrs.class),
|
||||
e: common_vendor.s(tr.attrs.style)
|
||||
} : {
|
||||
f: common_vendor.f(tr.children, (td, z, i3) => {
|
||||
return {
|
||||
a: "99a81ae4-4-" + i0 + "-" + i1 + "-" + i2 + "-" + i3,
|
||||
b: common_vendor.p({
|
||||
childs: td.children,
|
||||
opts: $props.opts
|
||||
}),
|
||||
c: z,
|
||||
d: common_vendor.n("_" + td.name + " " + td.attrs.class),
|
||||
e: common_vendor.s(td.attrs.style)
|
||||
};
|
||||
}),
|
||||
g: common_vendor.n("_" + tr.name + " " + tr.attrs.class),
|
||||
h: common_vendor.s(tr.attrs.style)
|
||||
}, {
|
||||
i: y
|
||||
});
|
||||
})
|
||||
}, {
|
||||
e: x,
|
||||
f: common_vendor.n("_" + tbody.name + " " + tbody.attrs.class),
|
||||
g: common_vendor.s(tbody.attrs.style)
|
||||
});
|
||||
})
|
||||
}, {
|
||||
aq: n.attrs.id,
|
||||
ar: common_vendor.n("_" + n.name + " " + n.attrs.class),
|
||||
as: common_vendor.s(n.attrs.style)
|
||||
}) : !n.c ? {
|
||||
av: n.attrs.id,
|
||||
aw: common_vendor.s("display:inline;" + n.f),
|
||||
ax: $props.opts[4],
|
||||
ay: $props.opts[4],
|
||||
az: [n]
|
||||
} : n.c === 2 ? {
|
||||
aB: common_vendor.f(n.children, (n2, j, i1) => {
|
||||
return {
|
||||
a: j,
|
||||
b: common_vendor.s(n2.f),
|
||||
c: "99a81ae4-5-" + i0 + "-" + i1,
|
||||
d: common_vendor.p({
|
||||
name: n2.name,
|
||||
attrs: n2.attrs,
|
||||
childs: n2.children,
|
||||
opts: $props.opts
|
||||
})
|
||||
};
|
||||
}),
|
||||
aC: n.attrs.id,
|
||||
aD: common_vendor.n("_block _" + n.name + " " + n.attrs.class),
|
||||
aE: common_vendor.s(n.f + ";" + n.attrs.style)
|
||||
} : {
|
||||
aF: common_vendor.s(n.f),
|
||||
aG: "99a81ae4-6-" + i0,
|
||||
aH: common_vendor.p({
|
||||
name: n.name,
|
||||
attrs: n.attrs,
|
||||
childs: n.children,
|
||||
opts: $props.opts
|
||||
})
|
||||
}, {
|
||||
i: n.name === "img",
|
||||
y: n.text,
|
||||
B: n.name === "br",
|
||||
C: n.name === "a",
|
||||
K: n.name === "video",
|
||||
Y: n.name === "audio",
|
||||
al: n.name === "table" && n.c || n.name === "li",
|
||||
at: !n.c,
|
||||
aA: n.c === 2,
|
||||
aI: i
|
||||
});
|
||||
}),
|
||||
b: $props.attrs.id,
|
||||
c: common_vendor.n("_block _" + $props.name + " " + $props.attrs.class),
|
||||
d: common_vendor.s($props.attrs.style)
|
||||
};
|
||||
}
|
||||
if (typeof block0 === "function")
|
||||
block0(_sfc_main);
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
wx.createComponent(Component);
|
||||
const RDovQmFja3VwL0RvY3VtZW50cy9IQnVpbGRlclByb2plY3RzL2Rhamlhbmt1YW5nL3VuaV9tb2R1bGVzL21wLWh0bWwvY29tcG9uZW50cy9tcC1odG1sL25vZGUvbm9kZS52dWU = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
||||
__proto__: null
|
||||
}, Symbol.toStringTag, { value: "Module" }));
|
||||
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/uni_modules/mp-html/components/mp-html/node/node.js.map
|
||||
6
unpackage/dist/dev/mp-weixin/uni_modules/mp-html/components/mp-html/node/node.json
vendored
Normal file
6
unpackage/dist/dev/mp-weixin/uni_modules/mp-html/components/mp-html/node/node.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"node": "./node"
|
||||
}
|
||||
}
|
||||
31
unpackage/dist/dev/mp-weixin/uni_modules/mp-html/components/mp-html/node/node.wxml
vendored
Normal file
31
unpackage/dist/dev/mp-weixin/uni_modules/mp-html/components/mp-html/node/node.wxml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<wxs module="handler">
|
||||
|
||||
// 行内标签列表
|
||||
var inlineTags = {
|
||||
abbr: true,
|
||||
b: true,
|
||||
big: true,
|
||||
code: true,
|
||||
del: true,
|
||||
em: true,
|
||||
i: true,
|
||||
ins: true,
|
||||
label: true,
|
||||
q: true,
|
||||
small: true,
|
||||
span: true,
|
||||
strong: true,
|
||||
sub: true,
|
||||
sup: true
|
||||
}
|
||||
/**
|
||||
* @description 判断是否为行内标签
|
||||
*/
|
||||
module.exports = {
|
||||
isInline: function (tagName, style) {
|
||||
return inlineTags[tagName] || (style || '').indexOf('display:inline') !== -1
|
||||
}
|
||||
}
|
||||
|
||||
</wxs>
|
||||
<view id="{{b}}" class="{{c}}" style="{{d}}"><block wx:for="{{a}}" wx:for-item="n" wx:key="aI"><image wx:if="{{n.a}}" class="_img" style="{{n.b}}" src="{{n.c}}" mode="widthFix"/><rich-text wx:if="{{n.d}}" style="{{n.e}}" nodes="{{n.f}}" data-i="{{n.g}}" catchtap="{{n.h}}"/><image wx:elif="{{n.i}}" id="{{n.j}}" class="{{n.k}}" style="{{n.l}}" src="{{n.m}}" mode="{{n.n}}" lazy-load="{{n.o}}" webp="{{n.p}}" show-menu-by-longpress="{{n.q}}" image-menu-prevent="{{n.r}}" data-i="{{n.s}}" bindload="{{n.t}}" binderror="{{n.v}}" catchtap="{{n.w}}" bindlongpress="{{n.x}}"/><text wx:elif="{{n.y}}" user-select="{{n.A}}" decode>{{n.z}}</text><text wx:elif="{{n.B}}">\n</text><view wx:elif="{{n.C}}" id="{{n.F}}" class="{{n.G}}" hover-class="_hover" style="{{n.H}}" data-i="{{n.I}}" catchtap="{{n.J}}"><node wx:if="{{n.E}}" style="display:inherit" u-i="{{n.D}}" bind:__l="__l" u-p="{{n.E}}"/></view><video wx:elif="{{n.K}}" id="{{n.L}}" class="{{n.M}}" style="{{n.N}}" autoplay="{{n.O}}" controls="{{n.P}}" loop="{{n.Q}}" muted="{{n.R}}" object-fit="{{n.S}}" poster="{{n.T}}" src="{{n.U}}" data-i="{{n.V}}" bindplay="{{n.W}}" binderror="{{n.X}}"/><audio wx:elif="{{n.Y}}" id="{{n.Z}}" class="{{n.aa}}" style="{{n.ab}}" author="{{n.ac}}" controls="{{n.ad}}" loop="{{n.ae}}" name="{{n.af}}" poster="{{n.ag}}" src="{{n.ah}}" data-i="{{n.ai}}" bindplay="{{n.aj}}" binderror="{{n.ak}}"/><view wx:elif="{{n.al}}" id="{{n.aq}}" class="{{n.ar}}" style="{{n.as}}"><node wx:if="{{n.am}}" u-i="{{n.an}}" bind:__l="__l" u-p="{{n.ao}}"/><block wx:else><view wx:for="{{n.ap}}" wx:for-item="tbody" wx:key="e" class="{{tbody.f}}" style="{{tbody.g}}"><node wx:if="{{tbody.a}}" u-i="{{tbody.b}}" bind:__l="__l" u-p="{{tbody.c}}"/><block wx:else><block wx:for="{{tbody.d}}" wx:for-item="tr" wx:key="i"><view wx:if="{{tr.a}}" class="{{tr.d}}" style="{{tr.e}}"><node wx:if="{{tr.c}}" u-i="{{tr.b}}" bind:__l="__l" u-p="{{tr.c}}"/></view><view wx:else class="{{tr.g}}" style="{{tr.h}}"><view wx:for="{{tr.f}}" wx:for-item="td" wx:key="c" class="{{td.d}}" style="{{td.e}}"><node wx:if="{{td.b}}" u-i="{{td.a}}" bind:__l="__l" u-p="{{td.b}}"/></view></view></block></block></view></block></view><rich-text wx:elif="{{n.at}}" id="{{n.av}}" style="{{n.aw}}" preview="{{false}}" selectable="{{n.ax}}" user-select="{{n.ay}}" nodes="{{n.az}}"/><view wx:elif="{{n.aA}}" id="{{n.aC}}" class="{{n.aD}}" style="{{n.aE}}"><node wx:for="{{n.aB}}" wx:for-item="n2" wx:key="a" style="{{n2.b}}" u-i="{{n2.c}}" bind:__l="__l" u-p="{{n2.d}}"/></view><node wx:else style="{{n.aF}}" u-i="{{n.aG}}" bind:__l="__l" u-p="{{n.aH||''}}"/></block></view>
|
||||
143
unpackage/dist/dev/mp-weixin/uni_modules/mp-html/components/mp-html/node/node.wxss
vendored
Normal file
143
unpackage/dist/dev/mp-weixin/uni_modules/mp-html/components/mp-html/node/node.wxss
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
|
||||
/* a 标签默认效果 */
|
||||
._a {
|
||||
padding: 1.5px 0 1.5px 0;
|
||||
color: #366092;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
/* a 标签点击态效果 */
|
||||
._hover {
|
||||
text-decoration: underline;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
/* 图片默认效果 */
|
||||
._img {
|
||||
max-width: 100%;
|
||||
-webkit-touch-callout: none;
|
||||
}
|
||||
|
||||
/* 内部样式 */
|
||||
._block {
|
||||
display: block;
|
||||
}
|
||||
._b,
|
||||
._strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
._code {
|
||||
font-family: monospace;
|
||||
}
|
||||
._del {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
._em,
|
||||
._i {
|
||||
font-style: italic;
|
||||
}
|
||||
._h1 {
|
||||
font-size: 2em;
|
||||
}
|
||||
._h2 {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
._h3 {
|
||||
font-size: 1.17em;
|
||||
}
|
||||
._h5 {
|
||||
font-size: 0.83em;
|
||||
}
|
||||
._h6 {
|
||||
font-size: 0.67em;
|
||||
}
|
||||
._h1,
|
||||
._h2,
|
||||
._h3,
|
||||
._h4,
|
||||
._h5,
|
||||
._h6 {
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
}
|
||||
._image {
|
||||
height: 1px;
|
||||
}
|
||||
._ins {
|
||||
text-decoration: underline;
|
||||
}
|
||||
._li {
|
||||
display: list-item;
|
||||
}
|
||||
._ol {
|
||||
list-style-type: decimal;
|
||||
}
|
||||
._ol,
|
||||
._ul {
|
||||
display: block;
|
||||
padding-left: 40px;
|
||||
margin: 1em 0;
|
||||
}
|
||||
._q::before {
|
||||
content: '"';
|
||||
}
|
||||
._q::after {
|
||||
content: '"';
|
||||
}
|
||||
._sub {
|
||||
font-size: smaller;
|
||||
vertical-align: sub;
|
||||
}
|
||||
._sup {
|
||||
font-size: smaller;
|
||||
vertical-align: super;
|
||||
}
|
||||
._thead,
|
||||
._tbody,
|
||||
._tfoot {
|
||||
display: table-row-group;
|
||||
}
|
||||
._tr {
|
||||
display: table-row;
|
||||
}
|
||||
._td,
|
||||
._th {
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
._th {
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
}
|
||||
._ul {
|
||||
list-style-type: disc;
|
||||
}
|
||||
._ul ._ul {
|
||||
margin: 0;
|
||||
list-style-type: circle;
|
||||
}
|
||||
._ul ._ul ._ul {
|
||||
list-style-type: square;
|
||||
}
|
||||
._abbr,
|
||||
._b,
|
||||
._code,
|
||||
._del,
|
||||
._em,
|
||||
._i,
|
||||
._ins,
|
||||
._label,
|
||||
._q,
|
||||
._span,
|
||||
._strong,
|
||||
._sub,
|
||||
._sup {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1047
unpackage/dist/dev/mp-weixin/uni_modules/mp-html/components/mp-html/parser.js
vendored
Normal file
1047
unpackage/dist/dev/mp-weixin/uni_modules/mp-html/components/mp-html/parser.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
195
unpackage/dist/dev/mp-weixin/uni_modules/uni-dateformat/components/uni-dateformat/date-format.js
vendored
Normal file
195
unpackage/dist/dev/mp-weixin/uni_modules/uni-dateformat/components/uni-dateformat/date-format.js
vendored
Normal file
@@ -0,0 +1,195 @@
|
||||
"use strict";
|
||||
function pad(str, length = 2) {
|
||||
str += "";
|
||||
while (str.length < length) {
|
||||
str = "0" + str;
|
||||
}
|
||||
return str.slice(-length);
|
||||
}
|
||||
const parser = {
|
||||
yyyy: (dateObj) => {
|
||||
return pad(dateObj.year, 4);
|
||||
},
|
||||
yy: (dateObj) => {
|
||||
return pad(dateObj.year);
|
||||
},
|
||||
MM: (dateObj) => {
|
||||
return pad(dateObj.month);
|
||||
},
|
||||
M: (dateObj) => {
|
||||
return dateObj.month;
|
||||
},
|
||||
dd: (dateObj) => {
|
||||
return pad(dateObj.day);
|
||||
},
|
||||
d: (dateObj) => {
|
||||
return dateObj.day;
|
||||
},
|
||||
hh: (dateObj) => {
|
||||
return pad(dateObj.hour);
|
||||
},
|
||||
h: (dateObj) => {
|
||||
return dateObj.hour;
|
||||
},
|
||||
mm: (dateObj) => {
|
||||
return pad(dateObj.minute);
|
||||
},
|
||||
m: (dateObj) => {
|
||||
return dateObj.minute;
|
||||
},
|
||||
ss: (dateObj) => {
|
||||
return pad(dateObj.second);
|
||||
},
|
||||
s: (dateObj) => {
|
||||
return dateObj.second;
|
||||
},
|
||||
SSS: (dateObj) => {
|
||||
return pad(dateObj.millisecond, 3);
|
||||
},
|
||||
S: (dateObj) => {
|
||||
return dateObj.millisecond;
|
||||
}
|
||||
};
|
||||
function getDate(time) {
|
||||
if (time instanceof Date) {
|
||||
return time;
|
||||
}
|
||||
switch (typeof time) {
|
||||
case "string": {
|
||||
if (time.indexOf("T") > -1) {
|
||||
return new Date(time);
|
||||
}
|
||||
return new Date(time.replace(/-/g, "/"));
|
||||
}
|
||||
default:
|
||||
return new Date(time);
|
||||
}
|
||||
}
|
||||
function formatDate(date, format = "yyyy/MM/dd hh:mm:ss") {
|
||||
if (!date && date !== 0) {
|
||||
return "";
|
||||
}
|
||||
date = getDate(date);
|
||||
const dateObj = {
|
||||
year: date.getFullYear(),
|
||||
month: date.getMonth() + 1,
|
||||
day: date.getDate(),
|
||||
hour: date.getHours(),
|
||||
minute: date.getMinutes(),
|
||||
second: date.getSeconds(),
|
||||
millisecond: date.getMilliseconds()
|
||||
};
|
||||
const tokenRegExp = /yyyy|yy|MM|M|dd|d|hh|h|mm|m|ss|s|SSS|SS|S/;
|
||||
let flag = true;
|
||||
let result = format;
|
||||
while (flag) {
|
||||
flag = false;
|
||||
result = result.replace(tokenRegExp, function(matched) {
|
||||
flag = true;
|
||||
return parser[matched](dateObj);
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function friendlyDate(time, {
|
||||
locale = "zh",
|
||||
threshold = [6e4, 36e5],
|
||||
format = "yyyy/MM/dd hh:mm:ss"
|
||||
}) {
|
||||
if (time === "-") {
|
||||
return time;
|
||||
}
|
||||
if (!time && time !== 0) {
|
||||
return "";
|
||||
}
|
||||
const localeText = {
|
||||
zh: {
|
||||
year: "年",
|
||||
month: "月",
|
||||
day: "天",
|
||||
hour: "小时",
|
||||
minute: "分钟",
|
||||
second: "秒",
|
||||
ago: "前",
|
||||
later: "后",
|
||||
justNow: "刚刚",
|
||||
soon: "马上",
|
||||
template: "{num}{unit}{suffix}"
|
||||
},
|
||||
en: {
|
||||
year: "year",
|
||||
month: "month",
|
||||
day: "day",
|
||||
hour: "hour",
|
||||
minute: "minute",
|
||||
second: "second",
|
||||
ago: "ago",
|
||||
later: "later",
|
||||
justNow: "just now",
|
||||
soon: "soon",
|
||||
template: "{num} {unit} {suffix}"
|
||||
}
|
||||
};
|
||||
const text = localeText[locale] || localeText.zh;
|
||||
let date = getDate(time);
|
||||
let ms = date.getTime() - Date.now();
|
||||
let absMs = Math.abs(ms);
|
||||
if (absMs < threshold[0]) {
|
||||
return ms < 0 ? text.justNow : text.soon;
|
||||
}
|
||||
if (absMs >= threshold[1]) {
|
||||
return formatDate(date, format);
|
||||
}
|
||||
let num;
|
||||
let unit;
|
||||
let suffix = text.later;
|
||||
if (ms < 0) {
|
||||
suffix = text.ago;
|
||||
ms = -ms;
|
||||
}
|
||||
const seconds = Math.floor(ms / 1e3);
|
||||
const minutes = Math.floor(seconds / 60);
|
||||
const hours = Math.floor(minutes / 60);
|
||||
const days = Math.floor(hours / 24);
|
||||
const months = Math.floor(days / 30);
|
||||
const years = Math.floor(months / 12);
|
||||
switch (true) {
|
||||
case years > 0:
|
||||
num = years;
|
||||
unit = text.year;
|
||||
break;
|
||||
case months > 0:
|
||||
num = months;
|
||||
unit = text.month;
|
||||
break;
|
||||
case days > 0:
|
||||
num = days;
|
||||
unit = text.day;
|
||||
break;
|
||||
case hours > 0:
|
||||
num = hours;
|
||||
unit = text.hour;
|
||||
break;
|
||||
case minutes > 0:
|
||||
num = minutes;
|
||||
unit = text.minute;
|
||||
break;
|
||||
default:
|
||||
num = seconds;
|
||||
unit = text.second;
|
||||
break;
|
||||
}
|
||||
if (locale === "en") {
|
||||
if (num === 1) {
|
||||
num = "a";
|
||||
} else {
|
||||
unit += "s";
|
||||
}
|
||||
}
|
||||
return text.template.replace(/{\s*num\s*}/g, num + "").replace(/{\s*unit\s*}/g, unit).replace(
|
||||
/{\s*suffix\s*}/g,
|
||||
suffix
|
||||
);
|
||||
}
|
||||
exports.friendlyDate = friendlyDate;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uni-dateformat/components/uni-dateformat/date-format.js.map
|
||||
@@ -0,0 +1,77 @@
|
||||
"use strict";
|
||||
const uni_modules_uniDateformat_components_uniDateformat_dateFormat = require("./date-format.js");
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "uniDateformat",
|
||||
props: {
|
||||
date: {
|
||||
type: [Object, String, Number],
|
||||
default() {
|
||||
return "-";
|
||||
}
|
||||
},
|
||||
locale: {
|
||||
type: String,
|
||||
default: "zh"
|
||||
},
|
||||
threshold: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [0, 0];
|
||||
}
|
||||
},
|
||||
format: {
|
||||
type: String,
|
||||
default: "yyyy/MM/dd hh:mm:ss"
|
||||
},
|
||||
// refreshRate使用不当可能导致性能问题,谨慎使用
|
||||
refreshRate: {
|
||||
type: [Number, String],
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
refreshMark: 0
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
dateShow() {
|
||||
this.refreshMark;
|
||||
return uni_modules_uniDateformat_components_uniDateformat_dateFormat.friendlyDate(this.date, {
|
||||
locale: this.locale,
|
||||
threshold: this.threshold,
|
||||
format: this.format
|
||||
});
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
refreshRate: {
|
||||
handler() {
|
||||
this.setAutoRefresh();
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
refresh() {
|
||||
this.refreshMark++;
|
||||
},
|
||||
setAutoRefresh() {
|
||||
clearInterval(this.refreshInterval);
|
||||
if (this.refreshRate) {
|
||||
this.refreshInterval = setInterval(() => {
|
||||
this.refresh();
|
||||
}, parseInt(this.refreshRate));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: common_vendor.t($options.dateShow)
|
||||
};
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uni-dateformat/components/uni-dateformat/uni-dateformat.js.map
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<text>{{a}}</text>
|
||||
394
unpackage/dist/dev/mp-weixin/uni_modules/uni-popup/components/uni-popup/uni-popup.js
vendored
Normal file
394
unpackage/dist/dev/mp-weixin/uni_modules/uni-popup/components/uni-popup/uni-popup.js
vendored
Normal file
@@ -0,0 +1,394 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "uniPopup",
|
||||
components: {},
|
||||
emits: ["change", "maskClick"],
|
||||
props: {
|
||||
// 开启动画
|
||||
animation: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 弹出层类型,可选值,top: 顶部弹出层;bottom:底部弹出层;center:全屏弹出层
|
||||
// message: 消息提示 ; dialog : 对话框
|
||||
type: {
|
||||
type: String,
|
||||
default: "center"
|
||||
},
|
||||
// maskClick
|
||||
isMaskClick: {
|
||||
type: Boolean,
|
||||
default: null
|
||||
},
|
||||
// TODO 2 个版本后废弃属性 ,使用 isMaskClick
|
||||
maskClick: {
|
||||
type: Boolean,
|
||||
default: null
|
||||
},
|
||||
backgroundColor: {
|
||||
type: String,
|
||||
default: "none"
|
||||
},
|
||||
safeArea: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
maskBackgroundColor: {
|
||||
type: String,
|
||||
default: "rgba(0, 0, 0, 0.4)"
|
||||
},
|
||||
borderRadius: {
|
||||
type: String
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
/**
|
||||
* 监听type类型
|
||||
*/
|
||||
type: {
|
||||
handler: function(type) {
|
||||
if (!this.config[type])
|
||||
return;
|
||||
this[this.config[type]](true);
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
isDesktop: {
|
||||
handler: function(newVal) {
|
||||
if (!this.config[newVal])
|
||||
return;
|
||||
this[this.config[this.type]](true);
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
/**
|
||||
* 监听遮罩是否可点击
|
||||
* @param {Object} val
|
||||
*/
|
||||
maskClick: {
|
||||
handler: function(val) {
|
||||
this.mkclick = val;
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
isMaskClick: {
|
||||
handler: function(val) {
|
||||
this.mkclick = val;
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
// H5 下禁止底部滚动
|
||||
showPopup(show) {
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
duration: 300,
|
||||
ani: [],
|
||||
showPopup: false,
|
||||
showTrans: false,
|
||||
popupWidth: 0,
|
||||
popupHeight: 0,
|
||||
config: {
|
||||
top: "top",
|
||||
bottom: "bottom",
|
||||
center: "center",
|
||||
left: "left",
|
||||
right: "right",
|
||||
message: "top",
|
||||
dialog: "center",
|
||||
share: "bottom"
|
||||
},
|
||||
maskClass: {
|
||||
position: "fixed",
|
||||
bottom: 0,
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
backgroundColor: "rgba(0, 0, 0, 0.4)"
|
||||
},
|
||||
transClass: {
|
||||
backgroundColor: "transparent",
|
||||
borderRadius: this.borderRadius || "0",
|
||||
position: "fixed",
|
||||
left: 0,
|
||||
right: 0
|
||||
},
|
||||
maskShow: true,
|
||||
mkclick: true,
|
||||
popupstyle: "top"
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
getStyles() {
|
||||
let res = { backgroundColor: this.bg };
|
||||
if (this.borderRadius || "0") {
|
||||
res = Object.assign(res, { borderRadius: this.borderRadius });
|
||||
}
|
||||
return res;
|
||||
},
|
||||
isDesktop() {
|
||||
return this.popupWidth >= 500 && this.popupHeight >= 500;
|
||||
},
|
||||
bg() {
|
||||
if (this.backgroundColor === "" || this.backgroundColor === "none") {
|
||||
return "transparent";
|
||||
}
|
||||
return this.backgroundColor;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const fixSize = () => {
|
||||
const {
|
||||
windowWidth,
|
||||
windowHeight,
|
||||
windowTop,
|
||||
safeArea,
|
||||
screenHeight,
|
||||
safeAreaInsets
|
||||
} = common_vendor.index.getSystemInfoSync();
|
||||
this.popupWidth = windowWidth;
|
||||
this.popupHeight = windowHeight + (windowTop || 0);
|
||||
if (safeArea && this.safeArea) {
|
||||
this.safeAreaInsets = screenHeight - safeArea.bottom;
|
||||
} else {
|
||||
this.safeAreaInsets = 0;
|
||||
}
|
||||
};
|
||||
fixSize();
|
||||
},
|
||||
// TODO vue3
|
||||
unmounted() {
|
||||
this.setH5Visible();
|
||||
},
|
||||
activated() {
|
||||
this.setH5Visible(!this.showPopup);
|
||||
},
|
||||
deactivated() {
|
||||
this.setH5Visible(true);
|
||||
},
|
||||
created() {
|
||||
if (this.isMaskClick === null && this.maskClick === null) {
|
||||
this.mkclick = true;
|
||||
} else {
|
||||
this.mkclick = this.isMaskClick !== null ? this.isMaskClick : this.maskClick;
|
||||
}
|
||||
if (this.animation) {
|
||||
this.duration = 300;
|
||||
} else {
|
||||
this.duration = 0;
|
||||
}
|
||||
this.messageChild = null;
|
||||
this.clearPropagation = false;
|
||||
this.maskClass.backgroundColor = this.maskBackgroundColor;
|
||||
},
|
||||
methods: {
|
||||
setH5Visible(visible = true) {
|
||||
},
|
||||
/**
|
||||
* 公用方法,不显示遮罩层
|
||||
*/
|
||||
closeMask() {
|
||||
this.maskShow = false;
|
||||
},
|
||||
/**
|
||||
* 公用方法,遮罩层禁止点击
|
||||
*/
|
||||
disableMask() {
|
||||
this.mkclick = false;
|
||||
},
|
||||
// TODO nvue 取消冒泡
|
||||
clear(e) {
|
||||
e.stopPropagation();
|
||||
this.clearPropagation = true;
|
||||
},
|
||||
open(direction) {
|
||||
if (this.showPopup) {
|
||||
return;
|
||||
}
|
||||
let innerType = ["top", "center", "bottom", "left", "right", "message", "dialog", "share"];
|
||||
if (!(direction && innerType.indexOf(direction) !== -1)) {
|
||||
direction = this.type;
|
||||
}
|
||||
if (!this.config[direction]) {
|
||||
common_vendor.index.__f__("error", "at uni_modules/uni-popup/components/uni-popup/uni-popup.vue:298", "缺少类型:", direction);
|
||||
return;
|
||||
}
|
||||
this[this.config[direction]]();
|
||||
this.$emit("change", {
|
||||
show: true,
|
||||
type: direction
|
||||
});
|
||||
},
|
||||
close(type) {
|
||||
this.showTrans = false;
|
||||
this.$emit("change", {
|
||||
show: false,
|
||||
type: this.type
|
||||
});
|
||||
clearTimeout(this.timer);
|
||||
this.timer = setTimeout(() => {
|
||||
this.showPopup = false;
|
||||
}, 300);
|
||||
},
|
||||
// TODO 处理冒泡事件,头条的冒泡事件有问题 ,先这样兼容
|
||||
touchstart() {
|
||||
this.clearPropagation = false;
|
||||
},
|
||||
onTap() {
|
||||
if (this.clearPropagation) {
|
||||
this.clearPropagation = false;
|
||||
return;
|
||||
}
|
||||
this.$emit("maskClick");
|
||||
if (!this.mkclick)
|
||||
return;
|
||||
this.close();
|
||||
},
|
||||
/**
|
||||
* 顶部弹出样式处理
|
||||
*/
|
||||
top(type) {
|
||||
this.popupstyle = this.isDesktop ? "fixforpc-top" : "top";
|
||||
this.ani = ["slide-top"];
|
||||
this.transClass = {
|
||||
position: "fixed",
|
||||
left: 0,
|
||||
right: 0,
|
||||
backgroundColor: this.bg,
|
||||
borderRadius: this.borderRadius || "0"
|
||||
};
|
||||
if (type)
|
||||
return;
|
||||
this.showPopup = true;
|
||||
this.showTrans = true;
|
||||
this.$nextTick(() => {
|
||||
if (this.messageChild && this.type === "message") {
|
||||
this.messageChild.timerClose();
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 底部弹出样式处理
|
||||
*/
|
||||
bottom(type) {
|
||||
this.popupstyle = "bottom";
|
||||
this.ani = ["slide-bottom"];
|
||||
this.transClass = {
|
||||
position: "fixed",
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
paddingBottom: this.safeAreaInsets + "px",
|
||||
backgroundColor: this.bg,
|
||||
borderRadius: this.borderRadius || "0"
|
||||
};
|
||||
if (type)
|
||||
return;
|
||||
this.showPopup = true;
|
||||
this.showTrans = true;
|
||||
},
|
||||
/**
|
||||
* 中间弹出样式处理
|
||||
*/
|
||||
center(type) {
|
||||
this.popupstyle = "center";
|
||||
this.ani = ["fade"];
|
||||
this.transClass = {
|
||||
position: "fixed",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
top: 0,
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
borderRadius: this.borderRadius || "0"
|
||||
};
|
||||
if (type)
|
||||
return;
|
||||
this.showPopup = true;
|
||||
this.showTrans = true;
|
||||
},
|
||||
left(type) {
|
||||
this.popupstyle = "left";
|
||||
this.ani = ["slide-left"];
|
||||
this.transClass = {
|
||||
position: "fixed",
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
top: 0,
|
||||
backgroundColor: this.bg,
|
||||
borderRadius: this.borderRadius || "0",
|
||||
display: "flex",
|
||||
flexDirection: "column"
|
||||
};
|
||||
if (type)
|
||||
return;
|
||||
this.showPopup = true;
|
||||
this.showTrans = true;
|
||||
},
|
||||
right(type) {
|
||||
this.popupstyle = "right";
|
||||
this.ani = ["slide-right"];
|
||||
this.transClass = {
|
||||
position: "fixed",
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
top: 0,
|
||||
backgroundColor: this.bg,
|
||||
borderRadius: this.borderRadius || "0",
|
||||
display: "flex",
|
||||
flexDirection: "column"
|
||||
};
|
||||
if (type)
|
||||
return;
|
||||
this.showPopup = true;
|
||||
this.showTrans = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_uni_transition2 = common_vendor.resolveComponent("uni-transition");
|
||||
_easycom_uni_transition2();
|
||||
}
|
||||
const _easycom_uni_transition = () => "../../../uni-transition/components/uni-transition/uni-transition.js";
|
||||
if (!Math) {
|
||||
_easycom_uni_transition();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: $data.showPopup
|
||||
}, $data.showPopup ? common_vendor.e({
|
||||
b: $data.maskShow
|
||||
}, $data.maskShow ? {
|
||||
c: common_vendor.o($options.onTap),
|
||||
d: common_vendor.p({
|
||||
name: "mask",
|
||||
["mode-class"]: "fade",
|
||||
styles: $data.maskClass,
|
||||
duration: $data.duration,
|
||||
show: $data.showTrans
|
||||
})
|
||||
} : {}, {
|
||||
e: common_vendor.s($options.getStyles),
|
||||
f: common_vendor.n($data.popupstyle),
|
||||
g: common_vendor.o((...args) => $options.clear && $options.clear(...args)),
|
||||
h: common_vendor.o($options.onTap),
|
||||
i: common_vendor.p({
|
||||
["mode-class"]: $data.ani,
|
||||
name: "content",
|
||||
styles: $data.transClass,
|
||||
duration: $data.duration,
|
||||
show: $data.showTrans
|
||||
}),
|
||||
j: common_vendor.o((...args) => $options.touchstart && $options.touchstart(...args)),
|
||||
k: common_vendor.n($data.popupstyle),
|
||||
l: common_vendor.n($options.isDesktop ? "fixforpc-z-index" : "")
|
||||
}) : {});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uni-popup/components/uni-popup/uni-popup.js.map
|
||||
6
unpackage/dist/dev/mp-weixin/uni_modules/uni-popup/components/uni-popup/uni-popup.json
vendored
Normal file
6
unpackage/dist/dev/mp-weixin/uni_modules/uni-popup/components/uni-popup/uni-popup.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"uni-transition": "../../../uni-transition/components/uni-transition/uni-transition"
|
||||
}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/uni_modules/uni-popup/components/uni-popup/uni-popup.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/uni_modules/uni-popup/components/uni-popup/uni-popup.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view wx:if="{{a}}" class="{{['uni-popup', k, l]}}"><view bindtouchstart="{{j}}"><uni-transition wx:if="{{b}}" key="1" bindclick="{{c}}" u-i="363f6a2e-0" bind:__l="__l" u-p="{{d}}"/><uni-transition wx:if="{{i}}" u-s="{{['d']}}" key="2" bindclick="{{h}}" u-i="363f6a2e-1" bind:__l="__l" u-p="{{i}}"><view style="{{e}}" class="{{['uni-popup__wrapper', f]}}" bindtap="{{g}}"><slot/></view></uni-transition></view></view>
|
||||
24
unpackage/dist/dev/mp-weixin/uni_modules/uni-popup/components/uni-popup/uni-popup.wxss
vendored
Normal file
24
unpackage/dist/dev/mp-weixin/uni_modules/uni-popup/components/uni-popup/uni-popup.wxss
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/* 水平间距 */
|
||||
/* 水平间距 */
|
||||
.uni-popup {
|
||||
position: fixed;
|
||||
z-index: 99;
|
||||
}
|
||||
.uni-popup.top, .uni-popup.left, .uni-popup.right {
|
||||
top: 0;
|
||||
}
|
||||
.uni-popup .uni-popup__wrapper {
|
||||
display: block;
|
||||
position: relative;
|
||||
/* iphonex 等安全区设置,底部安全区适配 */
|
||||
}
|
||||
.uni-popup .uni-popup__wrapper.left, .uni-popup .uni-popup__wrapper.right {
|
||||
padding-top: 0;
|
||||
flex: 1;
|
||||
}
|
||||
.fixforpc-z-index {
|
||||
z-index: 999;
|
||||
}
|
||||
.fixforpc-top {
|
||||
top: 0;
|
||||
}
|
||||
116
unpackage/dist/dev/mp-weixin/uni_modules/uni-transition/components/uni-transition/createAnimation.js
vendored
Normal file
116
unpackage/dist/dev/mp-weixin/uni_modules/uni-transition/components/uni-transition/createAnimation.js
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
class MPAnimation {
|
||||
constructor(options, _this) {
|
||||
this.options = options;
|
||||
this.animation = common_vendor.index.createAnimation({
|
||||
...options
|
||||
});
|
||||
this.currentStepAnimates = {};
|
||||
this.next = 0;
|
||||
this.$ = _this;
|
||||
}
|
||||
_nvuePushAnimates(type, args) {
|
||||
let aniObj = this.currentStepAnimates[this.next];
|
||||
let styles = {};
|
||||
if (!aniObj) {
|
||||
styles = {
|
||||
styles: {},
|
||||
config: {}
|
||||
};
|
||||
} else {
|
||||
styles = aniObj;
|
||||
}
|
||||
if (animateTypes1.includes(type)) {
|
||||
if (!styles.styles.transform) {
|
||||
styles.styles.transform = "";
|
||||
}
|
||||
let unit = "";
|
||||
if (type === "rotate") {
|
||||
unit = "deg";
|
||||
}
|
||||
styles.styles.transform += `${type}(${args + unit}) `;
|
||||
} else {
|
||||
styles.styles[type] = `${args}`;
|
||||
}
|
||||
this.currentStepAnimates[this.next] = styles;
|
||||
}
|
||||
_animateRun(styles = {}, config = {}) {
|
||||
let ref = this.$.$refs["ani"].ref;
|
||||
if (!ref)
|
||||
return;
|
||||
return new Promise((resolve, reject) => {
|
||||
nvueAnimation.transition(ref, {
|
||||
styles,
|
||||
...config
|
||||
}, (res) => {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
_nvueNextAnimate(animates, step = 0, fn) {
|
||||
let obj = animates[step];
|
||||
if (obj) {
|
||||
let {
|
||||
styles,
|
||||
config
|
||||
} = obj;
|
||||
this._animateRun(styles, config).then(() => {
|
||||
step += 1;
|
||||
this._nvueNextAnimate(animates, step, fn);
|
||||
});
|
||||
} else {
|
||||
this.currentStepAnimates = {};
|
||||
typeof fn === "function" && fn();
|
||||
this.isEnd = true;
|
||||
}
|
||||
}
|
||||
step(config = {}) {
|
||||
this.animation.step(config);
|
||||
return this;
|
||||
}
|
||||
run(fn) {
|
||||
this.$.animationData = this.animation.export();
|
||||
this.$.timer = setTimeout(() => {
|
||||
typeof fn === "function" && fn();
|
||||
}, this.$.durationTime);
|
||||
}
|
||||
}
|
||||
const animateTypes1 = [
|
||||
"matrix",
|
||||
"matrix3d",
|
||||
"rotate",
|
||||
"rotate3d",
|
||||
"rotateX",
|
||||
"rotateY",
|
||||
"rotateZ",
|
||||
"scale",
|
||||
"scale3d",
|
||||
"scaleX",
|
||||
"scaleY",
|
||||
"scaleZ",
|
||||
"skew",
|
||||
"skewX",
|
||||
"skewY",
|
||||
"translate",
|
||||
"translate3d",
|
||||
"translateX",
|
||||
"translateY",
|
||||
"translateZ"
|
||||
];
|
||||
const animateTypes2 = ["opacity", "backgroundColor"];
|
||||
const animateTypes3 = ["width", "height", "left", "right", "top", "bottom"];
|
||||
animateTypes1.concat(animateTypes2, animateTypes3).forEach((type) => {
|
||||
MPAnimation.prototype[type] = function(...args) {
|
||||
this.animation[type](...args);
|
||||
return this;
|
||||
};
|
||||
});
|
||||
function createAnimation(option, _this) {
|
||||
if (!_this)
|
||||
return;
|
||||
clearTimeout(_this.timer);
|
||||
return new MPAnimation(option, _this);
|
||||
}
|
||||
exports.createAnimation = createAnimation;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uni-transition/components/uni-transition/createAnimation.js.map
|
||||
266
unpackage/dist/dev/mp-weixin/uni_modules/uni-transition/components/uni-transition/uni-transition.js
vendored
Normal file
266
unpackage/dist/dev/mp-weixin/uni_modules/uni-transition/components/uni-transition/uni-transition.js
vendored
Normal file
@@ -0,0 +1,266 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_uniTransition_components_uniTransition_createAnimation = require("./createAnimation.js");
|
||||
const _sfc_main = {
|
||||
name: "uniTransition",
|
||||
emits: ["click", "change"],
|
||||
props: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
modeClass: {
|
||||
type: [Array, String],
|
||||
default() {
|
||||
return "fade";
|
||||
}
|
||||
},
|
||||
duration: {
|
||||
type: Number,
|
||||
default: 300
|
||||
},
|
||||
styles: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
customClass: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
onceRender: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isShow: false,
|
||||
transform: "",
|
||||
opacity: 1,
|
||||
animationData: {},
|
||||
durationTime: 300,
|
||||
config: {}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
show: {
|
||||
handler(newVal) {
|
||||
if (newVal) {
|
||||
this.open();
|
||||
} else {
|
||||
if (this.isShow) {
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 生成样式数据
|
||||
stylesObject() {
|
||||
let styles = {
|
||||
...this.styles,
|
||||
"transition-duration": this.duration / 1e3 + "s"
|
||||
};
|
||||
let transform = "";
|
||||
for (let i in styles) {
|
||||
let line = this.toLine(i);
|
||||
transform += line + ":" + styles[i] + ";";
|
||||
}
|
||||
return transform;
|
||||
},
|
||||
// 初始化动画条件
|
||||
transformStyles() {
|
||||
return "transform:" + this.transform + ";opacity:" + this.opacity + ";" + this.stylesObject;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.config = {
|
||||
duration: this.duration,
|
||||
timingFunction: "ease",
|
||||
transformOrigin: "50% 50%",
|
||||
delay: 0
|
||||
};
|
||||
this.durationTime = this.duration;
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* ref 触发 初始化动画
|
||||
*/
|
||||
init(obj = {}) {
|
||||
if (obj.duration) {
|
||||
this.durationTime = obj.duration;
|
||||
}
|
||||
this.animation = uni_modules_uniTransition_components_uniTransition_createAnimation.createAnimation(Object.assign(this.config, obj), this);
|
||||
},
|
||||
/**
|
||||
* 点击组件触发回调
|
||||
*/
|
||||
onClick() {
|
||||
this.$emit("click", {
|
||||
detail: this.isShow
|
||||
});
|
||||
},
|
||||
/**
|
||||
* ref 触发 动画分组
|
||||
* @param {Object} obj
|
||||
*/
|
||||
step(obj, config = {}) {
|
||||
if (!this.animation)
|
||||
return;
|
||||
for (let i in obj) {
|
||||
try {
|
||||
if (typeof obj[i] === "object") {
|
||||
this.animation[i](...obj[i]);
|
||||
} else {
|
||||
this.animation[i](obj[i]);
|
||||
}
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at uni_modules/uni-transition/components/uni-transition/uni-transition.vue:148", `方法 ${i} 不存在`);
|
||||
}
|
||||
}
|
||||
this.animation.step(config);
|
||||
return this;
|
||||
},
|
||||
/**
|
||||
* ref 触发 执行动画
|
||||
*/
|
||||
run(fn) {
|
||||
if (!this.animation)
|
||||
return;
|
||||
this.animation.run(fn);
|
||||
},
|
||||
// 开始过度动画
|
||||
open() {
|
||||
clearTimeout(this.timer);
|
||||
this.transform = "";
|
||||
this.isShow = true;
|
||||
let { opacity, transform } = this.styleInit(false);
|
||||
if (typeof opacity !== "undefined") {
|
||||
this.opacity = opacity;
|
||||
}
|
||||
this.transform = transform;
|
||||
this.$nextTick(() => {
|
||||
this.timer = setTimeout(() => {
|
||||
this.animation = uni_modules_uniTransition_components_uniTransition_createAnimation.createAnimation(this.config, this);
|
||||
this.tranfromInit(false).step();
|
||||
this.animation.run();
|
||||
this.$emit("change", {
|
||||
detail: this.isShow
|
||||
});
|
||||
}, 20);
|
||||
});
|
||||
},
|
||||
// 关闭过度动画
|
||||
close(type) {
|
||||
if (!this.animation)
|
||||
return;
|
||||
this.tranfromInit(true).step().run(() => {
|
||||
this.isShow = false;
|
||||
this.animationData = null;
|
||||
this.animation = null;
|
||||
let { opacity, transform } = this.styleInit(false);
|
||||
this.opacity = opacity || 1;
|
||||
this.transform = transform;
|
||||
this.$emit("change", {
|
||||
detail: this.isShow
|
||||
});
|
||||
});
|
||||
},
|
||||
// 处理动画开始前的默认样式
|
||||
styleInit(type) {
|
||||
let styles = {
|
||||
transform: ""
|
||||
};
|
||||
let buildStyle = (type2, mode) => {
|
||||
if (mode === "fade") {
|
||||
styles.opacity = this.animationType(type2)[mode];
|
||||
} else {
|
||||
styles.transform += this.animationType(type2)[mode] + " ";
|
||||
}
|
||||
};
|
||||
if (typeof this.modeClass === "string") {
|
||||
buildStyle(type, this.modeClass);
|
||||
} else {
|
||||
this.modeClass.forEach((mode) => {
|
||||
buildStyle(type, mode);
|
||||
});
|
||||
}
|
||||
return styles;
|
||||
},
|
||||
// 处理内置组合动画
|
||||
tranfromInit(type) {
|
||||
let buildTranfrom = (type2, mode) => {
|
||||
let aniNum = null;
|
||||
if (mode === "fade") {
|
||||
aniNum = type2 ? 0 : 1;
|
||||
} else {
|
||||
aniNum = type2 ? "-100%" : "0";
|
||||
if (mode === "zoom-in") {
|
||||
aniNum = type2 ? 0.8 : 1;
|
||||
}
|
||||
if (mode === "zoom-out") {
|
||||
aniNum = type2 ? 1.2 : 1;
|
||||
}
|
||||
if (mode === "slide-right") {
|
||||
aniNum = type2 ? "100%" : "0";
|
||||
}
|
||||
if (mode === "slide-bottom") {
|
||||
aniNum = type2 ? "100%" : "0";
|
||||
}
|
||||
}
|
||||
this.animation[this.animationMode()[mode]](aniNum);
|
||||
};
|
||||
if (typeof this.modeClass === "string") {
|
||||
buildTranfrom(type, this.modeClass);
|
||||
} else {
|
||||
this.modeClass.forEach((mode) => {
|
||||
buildTranfrom(type, mode);
|
||||
});
|
||||
}
|
||||
return this.animation;
|
||||
},
|
||||
animationType(type) {
|
||||
return {
|
||||
fade: type ? 0 : 1,
|
||||
"slide-top": `translateY(${type ? "0" : "-100%"})`,
|
||||
"slide-right": `translateX(${type ? "0" : "100%"})`,
|
||||
"slide-bottom": `translateY(${type ? "0" : "100%"})`,
|
||||
"slide-left": `translateX(${type ? "0" : "-100%"})`,
|
||||
"zoom-in": `scaleX(${type ? 1 : 0.8}) scaleY(${type ? 1 : 0.8})`,
|
||||
"zoom-out": `scaleX(${type ? 1 : 1.2}) scaleY(${type ? 1 : 1.2})`
|
||||
};
|
||||
},
|
||||
// 内置动画类型与实际动画对应字典
|
||||
animationMode() {
|
||||
return {
|
||||
fade: "opacity",
|
||||
"slide-top": "translateY",
|
||||
"slide-right": "translateX",
|
||||
"slide-bottom": "translateY",
|
||||
"slide-left": "translateX",
|
||||
"zoom-in": "scale",
|
||||
"zoom-out": "scale"
|
||||
};
|
||||
},
|
||||
// 驼峰转中横线
|
||||
toLine(name) {
|
||||
return name.replace(/([A-Z])/g, "-$1").toLowerCase();
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: $data.isShow,
|
||||
b: $data.animationData,
|
||||
c: common_vendor.n($props.customClass),
|
||||
d: common_vendor.s($options.transformStyles),
|
||||
e: common_vendor.o((...args) => $options.onClick && $options.onClick(...args))
|
||||
};
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uni-transition/components/uni-transition/uni-transition.js.map
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<view hidden="{{!a}}" ref="ani" animation="{{b}}" class="{{c}}" style="{{d}}" bindtap="{{e}}"><slot></slot></view>
|
||||
24
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/common/AbortablePromise.js
vendored
Normal file
24
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/common/AbortablePromise.js
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
class AbortablePromise {
|
||||
constructor(executor) {
|
||||
this._reject = null;
|
||||
this.promise = new Promise((resolve, reject) => {
|
||||
executor(resolve, reject);
|
||||
this._reject = reject;
|
||||
});
|
||||
}
|
||||
// 提供abort方法来中止Promise
|
||||
abort(error) {
|
||||
if (this._reject) {
|
||||
this._reject(error);
|
||||
}
|
||||
}
|
||||
then(onfulfilled, onrejected) {
|
||||
return this.promise.then(onfulfilled, onrejected);
|
||||
}
|
||||
catch(onrejected) {
|
||||
return this.promise.catch(onrejected);
|
||||
}
|
||||
}
|
||||
exports.AbortablePromise = AbortablePromise;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/common/AbortablePromise.js.map
|
||||
28
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/common/base64.js
vendored
Normal file
28
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/common/base64.js
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
const _b64chars = [..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"];
|
||||
const _mkUriSafe = (src) => src.replace(/[+/]/g, (m0) => m0 === "+" ? "-" : "_").replace(/=+\$/m, "");
|
||||
const fromUint8Array = (src, rfc4648 = false) => {
|
||||
let b64 = "";
|
||||
for (let i = 0, l = src.length; i < l; i += 3) {
|
||||
const [a0, a1, a2] = [src[i], src[i + 1], src[i + 2]];
|
||||
const ord = a0 << 16 | a1 << 8 | a2;
|
||||
b64 += _b64chars[ord >>> 18];
|
||||
b64 += _b64chars[ord >>> 12 & 63];
|
||||
b64 += typeof a1 !== "undefined" ? _b64chars[ord >>> 6 & 63] : "=";
|
||||
b64 += typeof a2 !== "undefined" ? _b64chars[ord & 63] : "=";
|
||||
}
|
||||
return rfc4648 ? _mkUriSafe(b64) : b64;
|
||||
};
|
||||
const _btoa = typeof btoa === "function" ? (s) => btoa(s) : (s) => {
|
||||
if (s.charCodeAt(0) > 255) {
|
||||
throw new RangeError("The string contains invalid characters.");
|
||||
}
|
||||
return fromUint8Array(Uint8Array.from(s, (c) => c.charCodeAt(0)));
|
||||
};
|
||||
const utob = (src) => unescape(encodeURIComponent(src));
|
||||
function encode(src, rfc4648 = false) {
|
||||
const b64 = _btoa(utob(src));
|
||||
return rfc4648 ? _mkUriSafe(b64) : b64;
|
||||
}
|
||||
exports.encode = encode;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/common/base64.js.map
|
||||
2
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/common/clickoutside.js
vendored
Normal file
2
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/common/clickoutside.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/common/clickoutside.js.map
|
||||
31
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/common/interceptor.js
vendored
Normal file
31
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/common/interceptor.js
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
const uni_modules_wotDesignUni_components_common_util = require("./util.js");
|
||||
function noop() {
|
||||
}
|
||||
function callInterceptor(interceptor, {
|
||||
args = [],
|
||||
done,
|
||||
canceled,
|
||||
error
|
||||
}) {
|
||||
if (interceptor) {
|
||||
const returnVal = interceptor.apply(null, args);
|
||||
if (uni_modules_wotDesignUni_components_common_util.isPromise(returnVal)) {
|
||||
returnVal.then((value) => {
|
||||
if (value) {
|
||||
done();
|
||||
} else if (canceled) {
|
||||
canceled();
|
||||
}
|
||||
}).catch(error || noop);
|
||||
} else if (returnVal) {
|
||||
done();
|
||||
} else if (canceled) {
|
||||
canceled();
|
||||
}
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
}
|
||||
exports.callInterceptor = callInterceptor;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/common/interceptor.js.map
|
||||
45
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/common/props.js
vendored
Normal file
45
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/common/props.js
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
const numericProp = [Number, String];
|
||||
const makeRequiredProp = (type) => ({
|
||||
type,
|
||||
required: true
|
||||
});
|
||||
const makeArrayProp = () => ({
|
||||
type: Array,
|
||||
default: () => []
|
||||
});
|
||||
const makeBooleanProp = (defaultVal) => ({
|
||||
type: Boolean,
|
||||
default: defaultVal
|
||||
});
|
||||
const makeNumberProp = (defaultVal) => ({
|
||||
type: Number,
|
||||
default: defaultVal
|
||||
});
|
||||
const makeNumericProp = (defaultVal) => ({
|
||||
type: numericProp,
|
||||
default: defaultVal
|
||||
});
|
||||
const makeStringProp = (defaultVal) => ({
|
||||
type: String,
|
||||
default: defaultVal
|
||||
});
|
||||
const baseProps = {
|
||||
/**
|
||||
* 自定义根节点样式
|
||||
*/
|
||||
customStyle: makeStringProp(""),
|
||||
/**
|
||||
* 自定义根节点样式类
|
||||
*/
|
||||
customClass: makeStringProp("")
|
||||
};
|
||||
exports.baseProps = baseProps;
|
||||
exports.makeArrayProp = makeArrayProp;
|
||||
exports.makeBooleanProp = makeBooleanProp;
|
||||
exports.makeNumberProp = makeNumberProp;
|
||||
exports.makeNumericProp = makeNumericProp;
|
||||
exports.makeRequiredProp = makeRequiredProp;
|
||||
exports.makeStringProp = makeStringProp;
|
||||
exports.numericProp = numericProp;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/common/props.js.map
|
||||
325
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/common/util.js
vendored
Normal file
325
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/common/util.js
vendored
Normal file
@@ -0,0 +1,325 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_wotDesignUni_components_common_AbortablePromise = require("./AbortablePromise.js");
|
||||
function uuid() {
|
||||
return s4() + s4() + s4() + s4() + s4() + s4() + s4() + s4();
|
||||
}
|
||||
function s4() {
|
||||
return Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
|
||||
}
|
||||
function addUnit(num) {
|
||||
return Number.isNaN(Number(num)) ? `${num}` : `${num}px`;
|
||||
}
|
||||
function isObj(value) {
|
||||
return Object.prototype.toString.call(value) === "[object Object]" || typeof value === "object";
|
||||
}
|
||||
function getType(target) {
|
||||
const typeStr = Object.prototype.toString.call(target);
|
||||
const match = typeStr.match(/\[object (\w+)\]/);
|
||||
const type = match && match.length ? match[1].toLowerCase() : "";
|
||||
return type;
|
||||
}
|
||||
const defaultDisplayFormat = function(items, kv) {
|
||||
const labelKey = (kv == null ? void 0 : kv.labelKey) || "value";
|
||||
if (Array.isArray(items)) {
|
||||
return items.map((item) => item[labelKey]).join(", ");
|
||||
} else {
|
||||
return items[labelKey];
|
||||
}
|
||||
};
|
||||
const isDef = (value) => value !== void 0 && value !== null;
|
||||
function rgbToHex(r, g, b) {
|
||||
const hex = (r << 16 | g << 8 | b).toString(16);
|
||||
const paddedHex = "#" + "0".repeat(Math.max(0, 6 - hex.length)) + hex;
|
||||
return paddedHex;
|
||||
}
|
||||
function hexToRgb(hex) {
|
||||
const rgb = [];
|
||||
for (let i = 1; i < 7; i += 2) {
|
||||
rgb.push(parseInt("0x" + hex.slice(i, i + 2), 16));
|
||||
}
|
||||
return rgb;
|
||||
}
|
||||
const gradient = (startColor, endColor, step = 2) => {
|
||||
const sColor = hexToRgb(startColor);
|
||||
const eColor = hexToRgb(endColor);
|
||||
const rStep = (eColor[0] - sColor[0]) / step;
|
||||
const gStep = (eColor[1] - sColor[1]) / step;
|
||||
const bStep = (eColor[2] - sColor[2]) / step;
|
||||
const gradientColorArr = [];
|
||||
for (let i = 0; i < step; i++) {
|
||||
gradientColorArr.push(
|
||||
rgbToHex(parseInt(String(rStep * i + sColor[0])), parseInt(String(gStep * i + sColor[1])), parseInt(String(bStep * i + sColor[2])))
|
||||
);
|
||||
}
|
||||
return gradientColorArr;
|
||||
};
|
||||
const range = (num, min, max) => {
|
||||
return Math.min(Math.max(num, min), max);
|
||||
};
|
||||
const isEqual = (value1, value2) => {
|
||||
if (value1 === value2) {
|
||||
return true;
|
||||
}
|
||||
if (!Array.isArray(value1) || !Array.isArray(value2)) {
|
||||
return false;
|
||||
}
|
||||
if (value1.length !== value2.length) {
|
||||
return false;
|
||||
}
|
||||
for (let i = 0; i < value1.length; ++i) {
|
||||
if (value1[i] !== value2[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
const padZero = (number, length = 2) => {
|
||||
let numStr = number.toString();
|
||||
while (numStr.length < length) {
|
||||
numStr = "0" + numStr;
|
||||
}
|
||||
return numStr;
|
||||
};
|
||||
const context = {
|
||||
id: 1e3
|
||||
};
|
||||
function getRect(selector, all, scope, useFields) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let query = null;
|
||||
if (scope) {
|
||||
query = common_vendor.index.createSelectorQuery().in(scope);
|
||||
} else {
|
||||
query = common_vendor.index.createSelectorQuery();
|
||||
}
|
||||
const method = all ? "selectAll" : "select";
|
||||
const callback = (rect) => {
|
||||
if (all && isArray(rect) && rect.length > 0) {
|
||||
resolve(rect);
|
||||
} else if (!all && rect) {
|
||||
resolve(rect);
|
||||
} else {
|
||||
reject(new Error("No nodes found"));
|
||||
}
|
||||
};
|
||||
if (useFields) {
|
||||
query[method](selector).fields({ size: true, node: true }, callback).exec();
|
||||
} else {
|
||||
query[method](selector).boundingClientRect(callback).exec();
|
||||
}
|
||||
});
|
||||
}
|
||||
function kebabCase(word) {
|
||||
const newWord = word.replace(/[A-Z]/g, function(match) {
|
||||
return "-" + match;
|
||||
}).toLowerCase();
|
||||
return newWord;
|
||||
}
|
||||
function camelCase(word) {
|
||||
return word.replace(/-(\w)/g, (_, c) => c.toUpperCase());
|
||||
}
|
||||
function isArray(value) {
|
||||
if (typeof Array.isArray === "function") {
|
||||
return Array.isArray(value);
|
||||
}
|
||||
return Object.prototype.toString.call(value) === "[object Array]";
|
||||
}
|
||||
function isFunction(value) {
|
||||
return getType(value) === "function" || getType(value) === "asyncfunction";
|
||||
}
|
||||
function isString(value) {
|
||||
return getType(value) === "string";
|
||||
}
|
||||
function isNumber(value) {
|
||||
return getType(value) === "number";
|
||||
}
|
||||
function isPromise(value) {
|
||||
if (isObj(value) && isDef(value)) {
|
||||
return isFunction(value.then) && isFunction(value.catch);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isUndefined(value) {
|
||||
return typeof value === "undefined";
|
||||
}
|
||||
function objToStyle(styles) {
|
||||
if (isArray(styles)) {
|
||||
const result = styles.filter(function(item) {
|
||||
return item != null && item !== "";
|
||||
}).map(function(item) {
|
||||
return objToStyle(item);
|
||||
}).join(";");
|
||||
return result ? result.endsWith(";") ? result : result + ";" : "";
|
||||
}
|
||||
if (isString(styles)) {
|
||||
return styles ? styles.endsWith(";") ? styles : styles + ";" : "";
|
||||
}
|
||||
if (isObj(styles)) {
|
||||
const result = Object.keys(styles).filter(function(key) {
|
||||
return styles[key] != null && styles[key] !== "";
|
||||
}).map(function(key) {
|
||||
return [kebabCase(key), styles[key]].join(":");
|
||||
}).join(";");
|
||||
return result ? result.endsWith(";") ? result : result + ";" : "";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
const pause = (ms = 1e3 / 30) => {
|
||||
return new uni_modules_wotDesignUni_components_common_AbortablePromise.AbortablePromise((resolve) => {
|
||||
const timer = setTimeout(() => {
|
||||
clearTimeout(timer);
|
||||
resolve(true);
|
||||
}, ms);
|
||||
});
|
||||
};
|
||||
function deepClone(obj, cache = /* @__PURE__ */ new Map()) {
|
||||
if (obj === null || typeof obj !== "object") {
|
||||
return obj;
|
||||
}
|
||||
if (isDate(obj)) {
|
||||
return new Date(obj.getTime());
|
||||
}
|
||||
if (obj instanceof RegExp) {
|
||||
return new RegExp(obj.source, obj.flags);
|
||||
}
|
||||
if (obj instanceof Error) {
|
||||
const errorCopy = new Error(obj.message);
|
||||
errorCopy.stack = obj.stack;
|
||||
return errorCopy;
|
||||
}
|
||||
if (cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
const copy = Array.isArray(obj) ? [] : {};
|
||||
cache.set(obj, copy);
|
||||
for (const key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
copy[key] = deepClone(obj[key], cache);
|
||||
}
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
function deepMerge(target, source) {
|
||||
target = deepClone(target);
|
||||
if (typeof target !== "object" || typeof source !== "object") {
|
||||
throw new Error("Both target and source must be objects.");
|
||||
}
|
||||
for (const prop in source) {
|
||||
if (!source.hasOwnProperty(prop))
|
||||
continue;
|
||||
target[prop] = source[prop];
|
||||
}
|
||||
return target;
|
||||
}
|
||||
function deepAssign(target, source) {
|
||||
Object.keys(source).forEach((key) => {
|
||||
const targetValue = target[key];
|
||||
const newObjValue = source[key];
|
||||
if (isObj(targetValue) && isObj(newObjValue)) {
|
||||
deepAssign(targetValue, newObjValue);
|
||||
} else {
|
||||
target[key] = newObjValue;
|
||||
}
|
||||
});
|
||||
return target;
|
||||
}
|
||||
function debounce(func, wait, options = {}) {
|
||||
let timeoutId = null;
|
||||
let lastArgs;
|
||||
let lastThis;
|
||||
let result;
|
||||
const leading = isDef(options.leading) ? options.leading : false;
|
||||
const trailing = isDef(options.trailing) ? options.trailing : true;
|
||||
function invokeFunc() {
|
||||
if (lastArgs !== void 0) {
|
||||
result = func.apply(lastThis, lastArgs);
|
||||
lastArgs = void 0;
|
||||
}
|
||||
}
|
||||
function startTimer() {
|
||||
timeoutId = setTimeout(() => {
|
||||
timeoutId = null;
|
||||
if (trailing) {
|
||||
invokeFunc();
|
||||
}
|
||||
}, wait);
|
||||
}
|
||||
function cancelTimer() {
|
||||
if (timeoutId !== null) {
|
||||
clearTimeout(timeoutId);
|
||||
timeoutId = null;
|
||||
}
|
||||
}
|
||||
function debounced(...args) {
|
||||
lastArgs = args;
|
||||
lastThis = this;
|
||||
if (timeoutId === null) {
|
||||
if (leading) {
|
||||
invokeFunc();
|
||||
}
|
||||
startTimer();
|
||||
} else if (trailing) {
|
||||
cancelTimer();
|
||||
startTimer();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return debounced;
|
||||
}
|
||||
const getPropByPath = (obj, path) => {
|
||||
const keys = path.split(".");
|
||||
try {
|
||||
return keys.reduce((acc, key) => acc !== void 0 && acc !== null ? acc[key] : void 0, obj);
|
||||
} catch (error) {
|
||||
return void 0;
|
||||
}
|
||||
};
|
||||
const isDate = (val) => Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
|
||||
function isVideoUrl(url) {
|
||||
const videoRegex = /\.(ogm|webm|ogv|asx|m4v|mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv|video)(?=$|[?#])/i;
|
||||
return videoRegex.test(url);
|
||||
}
|
||||
function isImageUrl(url) {
|
||||
const imageRegex = /\.(xbm|tif|pjp|apng|svgz|jpeg|jpg|heif|ico|tiff|heic|pjpeg|avif|gif|png|svg|webp|jfif|bmp|dpg|image)(?=$|[?#])/i;
|
||||
return imageRegex.test(url);
|
||||
}
|
||||
const isH5 = /* @__PURE__ */ (() => {
|
||||
let isH52 = false;
|
||||
return isH52;
|
||||
})();
|
||||
function omitBy(obj, predicate) {
|
||||
const newObj = deepClone(obj);
|
||||
Object.keys(newObj).forEach((key) => predicate(newObj[key], key) && delete newObj[key]);
|
||||
return newObj;
|
||||
}
|
||||
exports.addUnit = addUnit;
|
||||
exports.camelCase = camelCase;
|
||||
exports.context = context;
|
||||
exports.debounce = debounce;
|
||||
exports.deepAssign = deepAssign;
|
||||
exports.deepClone = deepClone;
|
||||
exports.deepMerge = deepMerge;
|
||||
exports.defaultDisplayFormat = defaultDisplayFormat;
|
||||
exports.getPropByPath = getPropByPath;
|
||||
exports.getRect = getRect;
|
||||
exports.getType = getType;
|
||||
exports.gradient = gradient;
|
||||
exports.isArray = isArray;
|
||||
exports.isDef = isDef;
|
||||
exports.isEqual = isEqual;
|
||||
exports.isFunction = isFunction;
|
||||
exports.isH5 = isH5;
|
||||
exports.isImageUrl = isImageUrl;
|
||||
exports.isNumber = isNumber;
|
||||
exports.isObj = isObj;
|
||||
exports.isPromise = isPromise;
|
||||
exports.isString = isString;
|
||||
exports.isUndefined = isUndefined;
|
||||
exports.isVideoUrl = isVideoUrl;
|
||||
exports.objToStyle = objToStyle;
|
||||
exports.omitBy = omitBy;
|
||||
exports.padZero = padZero;
|
||||
exports.pause = pause;
|
||||
exports.range = range;
|
||||
exports.uuid = uuid;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/common/util.js.map
|
||||
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
|
||||
96
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-button/types.js
vendored
Normal file
96
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-button/types.js
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
"use strict";
|
||||
const uni_modules_wotDesignUni_components_common_props = require("../common/props.js");
|
||||
const buttonProps = {
|
||||
...uni_modules_wotDesignUni_components_common_props.baseProps,
|
||||
/**
|
||||
* 幽灵按钮
|
||||
*/
|
||||
plain: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 圆角按钮
|
||||
*/
|
||||
round: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(true),
|
||||
/**
|
||||
* 禁用按钮
|
||||
*/
|
||||
disabled: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 是否细边框
|
||||
*/
|
||||
hairline: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 块状按钮
|
||||
*/
|
||||
block: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 按钮类型,可选值:primary / success / info / warning / error / text / icon
|
||||
*/
|
||||
type: uni_modules_wotDesignUni_components_common_props.makeStringProp("primary"),
|
||||
/**
|
||||
* 按钮尺寸,可选值:small / medium / large
|
||||
*/
|
||||
size: uni_modules_wotDesignUni_components_common_props.makeStringProp("medium"),
|
||||
/**
|
||||
* 图标类名
|
||||
*/
|
||||
icon: String,
|
||||
/**
|
||||
* 类名前缀,用于使用自定义图标,用法参考Icon组件
|
||||
*/
|
||||
classPrefix: uni_modules_wotDesignUni_components_common_props.makeStringProp("wd-icon"),
|
||||
/**
|
||||
* 加载中按钮
|
||||
*/
|
||||
loading: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 加载图标颜色
|
||||
*/
|
||||
loadingColor: String,
|
||||
/**
|
||||
* 开放能力
|
||||
*/
|
||||
openType: String,
|
||||
/**
|
||||
* 指定是否阻止本节点的祖先节点出现点击态
|
||||
*/
|
||||
hoverStopPropagation: Boolean,
|
||||
/**
|
||||
* 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文
|
||||
*/
|
||||
lang: String,
|
||||
/**
|
||||
* 会话来源,open-type="contact"时有效
|
||||
*/
|
||||
sessionFrom: String,
|
||||
/**
|
||||
* 会话内消息卡片标题,open-type="contact"时有效
|
||||
*/
|
||||
sendMessageTitle: String,
|
||||
/**
|
||||
* 会话内消息卡片点击跳转小程序路径,open-type="contact"时有效
|
||||
*/
|
||||
sendMessagePath: String,
|
||||
/**
|
||||
* 会话内消息卡片图片,open-type="contact"时有效
|
||||
*/
|
||||
sendMessageImg: String,
|
||||
/**
|
||||
* 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效
|
||||
*/
|
||||
appParameter: String,
|
||||
/**
|
||||
* 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,open-type="contact"时有效
|
||||
*/
|
||||
showMessageCard: Boolean,
|
||||
/**
|
||||
* 按钮的唯一标识,可用于设置隐私同意授权按钮的id
|
||||
*/
|
||||
buttonId: String,
|
||||
/**
|
||||
* 支付宝小程序,当 open-type 为 getAuthorize 时有效。
|
||||
* 可选值:'phoneNumber' | 'userInfo'
|
||||
*/
|
||||
scope: String
|
||||
};
|
||||
exports.buttonProps = buttonProps;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-button/types.js.map
|
||||
172
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-button/wd-button.js
vendored
Normal file
172
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-button/wd-button.js
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_wotDesignUni_components_common_base64 = require("../common/base64.js");
|
||||
const uni_modules_wotDesignUni_components_wdButton_types = require("./types.js");
|
||||
if (!Math) {
|
||||
wdIcon();
|
||||
}
|
||||
const wdIcon = () => "../wd-icon/wd-icon.js";
|
||||
const __default__ = {
|
||||
name: "wd-button",
|
||||
options: {
|
||||
addGlobalClass: true,
|
||||
virtualHost: true,
|
||||
styleIsolation: "shared"
|
||||
}
|
||||
};
|
||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
...__default__,
|
||||
props: uni_modules_wotDesignUni_components_wdButton_types.buttonProps,
|
||||
emits: [
|
||||
"click",
|
||||
"getuserinfo",
|
||||
"contact",
|
||||
"getphonenumber",
|
||||
"getrealtimephonenumber",
|
||||
"error",
|
||||
"launchapp",
|
||||
"opensetting",
|
||||
"chooseavatar",
|
||||
"agreeprivacyauthorization"
|
||||
],
|
||||
setup(__props, { emit: __emit }) {
|
||||
const loadingIcon = (color = "#4D80F0", reverse = true) => {
|
||||
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 42 42"><defs><linearGradient x1="100%" y1="0%" x2="0%" y2="0%" id="a"><stop stop-color="${reverse ? color : "#fff"}" offset="0%" stop-opacity="0"/><stop stop-color="${reverse ? color : "#fff"}" offset="100%"/></linearGradient></defs><g fill="none" fill-rule="evenodd"><path d="M21 1c11.046 0 20 8.954 20 20s-8.954 20-20 20S1 32.046 1 21 9.954 1 21 1zm0 7C13.82 8 8 13.82 8 21s5.82 13 13 13 13-5.82 13-13S28.18 8 21 8z" fill="${reverse ? "#fff" : color}"/><path d="M4.599 21c0 9.044 7.332 16.376 16.376 16.376 9.045 0 16.376-7.332 16.376-16.376" stroke="url(#a)" stroke-width="3.5" stroke-linecap="round"/></g></svg>`;
|
||||
};
|
||||
const props = __props;
|
||||
const emit = __emit;
|
||||
const hoverStartTime = common_vendor.ref(20);
|
||||
const hoverStayTime = common_vendor.ref(70);
|
||||
const loadingIconSvg = common_vendor.ref("");
|
||||
const loadingStyle = common_vendor.computed(() => {
|
||||
return `background-image: url(${loadingIconSvg.value});`;
|
||||
});
|
||||
common_vendor.watch(
|
||||
() => props.loading,
|
||||
() => {
|
||||
buildLoadingSvg();
|
||||
},
|
||||
{ deep: true, immediate: true }
|
||||
);
|
||||
function handleClick(event) {
|
||||
if (!props.disabled && !props.loading) {
|
||||
emit("click", event);
|
||||
}
|
||||
}
|
||||
function handleGetAuthorize(event) {
|
||||
if (props.scope === "phoneNumber") {
|
||||
handleGetphonenumber(event);
|
||||
} else if (props.scope === "userInfo") {
|
||||
handleGetuserinfo(event);
|
||||
}
|
||||
}
|
||||
function handleGetuserinfo(event) {
|
||||
emit("getuserinfo", event.detail);
|
||||
}
|
||||
function handleConcat(event) {
|
||||
emit("contact", event.detail);
|
||||
}
|
||||
function handleGetphonenumber(event) {
|
||||
emit("getphonenumber", event.detail);
|
||||
}
|
||||
function handleGetrealtimephonenumber(event) {
|
||||
emit("getrealtimephonenumber", event.detail);
|
||||
}
|
||||
function handleError(event) {
|
||||
emit("error", event.detail);
|
||||
}
|
||||
function handleLaunchapp(event) {
|
||||
emit("launchapp", event.detail);
|
||||
}
|
||||
function handleOpensetting(event) {
|
||||
emit("opensetting", event.detail);
|
||||
}
|
||||
function handleChooseavatar(event) {
|
||||
emit("chooseavatar", event.detail);
|
||||
}
|
||||
function handleAgreePrivacyAuthorization(event) {
|
||||
emit("agreeprivacyauthorization", event.detail);
|
||||
}
|
||||
function buildLoadingSvg() {
|
||||
const { loadingColor, type, plain } = props;
|
||||
let color = loadingColor;
|
||||
if (!color) {
|
||||
switch (type) {
|
||||
case "primary":
|
||||
color = "#4D80F0";
|
||||
break;
|
||||
case "success":
|
||||
color = "#34d19d";
|
||||
break;
|
||||
case "info":
|
||||
color = "#333";
|
||||
break;
|
||||
case "warning":
|
||||
color = "#f0883a";
|
||||
break;
|
||||
case "error":
|
||||
color = "#fa4350";
|
||||
break;
|
||||
case "default":
|
||||
color = "#333";
|
||||
break;
|
||||
}
|
||||
}
|
||||
const svg = loadingIcon(color, !plain);
|
||||
loadingIconSvg.value = `"data:image/svg+xml;base64,${uni_modules_wotDesignUni_components_common_base64.encode(svg)}"`;
|
||||
}
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: _ctx.loading
|
||||
}, _ctx.loading ? {
|
||||
b: common_vendor.s(loadingStyle.value)
|
||||
} : _ctx.icon ? {
|
||||
d: common_vendor.p({
|
||||
["custom-class"]: "wd-button__icon",
|
||||
name: _ctx.icon,
|
||||
classPrefix: _ctx.classPrefix
|
||||
})
|
||||
} : {}, {
|
||||
c: _ctx.icon,
|
||||
e: _ctx.buttonId,
|
||||
f: `${_ctx.disabled || _ctx.loading ? "" : "wd-button--active"}`,
|
||||
g: common_vendor.s(_ctx.customStyle),
|
||||
h: common_vendor.n("is-" + _ctx.type),
|
||||
i: common_vendor.n("is-" + _ctx.size),
|
||||
j: common_vendor.n(_ctx.round ? "is-round" : ""),
|
||||
k: common_vendor.n(_ctx.hairline ? "is-hairline" : ""),
|
||||
l: common_vendor.n(_ctx.plain ? "is-plain" : ""),
|
||||
m: common_vendor.n(_ctx.disabled ? "is-disabled" : ""),
|
||||
n: common_vendor.n(_ctx.block ? "is-block" : ""),
|
||||
o: common_vendor.n(_ctx.loading ? "is-loading" : ""),
|
||||
p: common_vendor.n(_ctx.customClass),
|
||||
q: hoverStartTime.value,
|
||||
r: hoverStayTime.value,
|
||||
s: _ctx.disabled || _ctx.loading ? void 0 : _ctx.openType,
|
||||
t: _ctx.sendMessageTitle,
|
||||
v: _ctx.sendMessagePath,
|
||||
w: _ctx.sendMessageImg,
|
||||
x: _ctx.appParameter,
|
||||
y: _ctx.showMessageCard,
|
||||
z: _ctx.sessionFrom,
|
||||
A: _ctx.lang,
|
||||
B: _ctx.hoverStopPropagation,
|
||||
C: _ctx.scope,
|
||||
D: common_vendor.o(handleClick),
|
||||
E: common_vendor.o(handleGetAuthorize),
|
||||
F: common_vendor.o(handleGetuserinfo),
|
||||
G: common_vendor.o(handleConcat),
|
||||
H: common_vendor.o(handleGetphonenumber),
|
||||
I: common_vendor.o(handleGetrealtimephonenumber),
|
||||
J: common_vendor.o(handleError),
|
||||
K: common_vendor.o(handleLaunchapp),
|
||||
L: common_vendor.o(handleOpensetting),
|
||||
M: common_vendor.o(handleChooseavatar),
|
||||
N: common_vendor.o(handleAgreePrivacyAuthorization)
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-d858c170"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-button/wd-button.js.map
|
||||
6
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-button/wd-button.json
vendored
Normal file
6
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-button/wd-button.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"wd-icon": "../wd-icon/wd-icon"
|
||||
}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-button/wd-button.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-button/wd-button.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<button id="{{e}}" hover-class="{{f}}" style="{{g}}" class="{{['data-v-d858c170', 'wd-button', h, i, j, k, l, m, n, o, p]}}" hover-start-time="{{q}}" hover-stay-time="{{r}}" open-type="{{s}}" send-message-title="{{t}}" send-message-path="{{v}}" send-message-img="{{w}}" app-parameter="{{x}}" show-message-card="{{y}}" session-from="{{z}}" lang="{{A}}" hover-stop-propagation="{{B}}" scope="{{C}}" bindtap="{{D}}" bindgetAuthorize="{{E}}" bindgetuserinfo="{{F}}" bindcontact="{{G}}" bindgetphonenumber="{{H}}" bindgetrealtimephonenumber="{{I}}" binderror="{{J}}" bindlaunchapp="{{K}}" bindopensetting="{{L}}" bindchooseavatar="{{M}}" bindagreeprivacyauthorization="{{N}}"><view class="wd-button__content data-v-d858c170"><view wx:if="{{a}}" class="wd-button__loading data-v-d858c170"><view class="wd-button__loading-svg data-v-d858c170" style="{{b}}"></view></view><wd-icon wx:elif="{{c}}" class="data-v-d858c170" u-i="d858c170-0" bind:__l="__l" u-p="{{d}}"></wd-icon><view class="wd-button__text data-v-d858c170"><slot/></view></view></button>
|
||||
430
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-button/wd-button.wxss
vendored
Normal file
430
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-button/wd-button.wxss
vendored
Normal file
@@ -0,0 +1,430 @@
|
||||
/* 水平间距 */
|
||||
/* 水平间距 */
|
||||
/**
|
||||
* 混合宏
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/**
|
||||
* 辅助函数
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/* 转换成字符串 */
|
||||
/* 判断是否存在 Modifier */
|
||||
/* 判断是否存在伪类 */
|
||||
/**
|
||||
* 主题色切换
|
||||
* @params $theme-color 主题色
|
||||
* @params $type 变暗’dark‘ 变亮 'light'
|
||||
* @params $mix-color 自己设置的混色
|
||||
*/
|
||||
/**
|
||||
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
|
||||
* @params $open-linear 是否开启线性渐变色
|
||||
* @params $deg 渐变色角度
|
||||
* @params $theme-color 当前配色
|
||||
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
|
||||
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
|
||||
* @params [Array] $per-list 渐变色比例
|
||||
*/
|
||||
/**
|
||||
* BEM,定义块(b)
|
||||
*/
|
||||
/* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
|
||||
/* 此方法用于生成穿透样式 */
|
||||
/* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
|
||||
/* 定义状态(m) */
|
||||
/* 定义状态(m) */
|
||||
/* 对于需要需要嵌套在 m 底下的 e,调用这个混合宏,一般在切换整个组件的状态,如切换颜色的时候 */
|
||||
/* 状态,生成 is-$state 类名 */
|
||||
/**
|
||||
* 常用混合宏
|
||||
*/
|
||||
/* 单行超出隐藏 */
|
||||
/* 多行超出隐藏 */
|
||||
/* 清除浮动 */
|
||||
/* 0.5px 边框 指定方向*/
|
||||
/* 0.5px 边框 环绕 */
|
||||
/**
|
||||
* 三角形实现尖角样式,适用于背景透明情况
|
||||
* @param $size 三角形高,底边为 $size * 2
|
||||
* @param $bg 三角形背景颜色
|
||||
*/
|
||||
/**
|
||||
* 正方形实现尖角样式,适用于背景不透明情况
|
||||
* @param $size 正方形边长
|
||||
* @param $bg 正方形背景颜色
|
||||
* @param $z-index z-index属性值,不得大于外部包裹器
|
||||
* @param $box-shadow 阴影
|
||||
*/
|
||||
/**
|
||||
* 辅助函数
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/* 转换成字符串 */
|
||||
/* 判断是否存在 Modifier */
|
||||
/* 判断是否存在伪类 */
|
||||
/**
|
||||
* 主题色切换
|
||||
* @params $theme-color 主题色
|
||||
* @params $type 变暗’dark‘ 变亮 'light'
|
||||
* @params $mix-color 自己设置的混色
|
||||
*/
|
||||
/**
|
||||
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
|
||||
* @params $open-linear 是否开启线性渐变色
|
||||
* @params $deg 渐变色角度
|
||||
* @params $theme-color 当前配色
|
||||
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
|
||||
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
|
||||
* @params [Array] $per-list 渐变色比例
|
||||
*/
|
||||
/**
|
||||
* UI规范基础变量
|
||||
*/
|
||||
/*----------------------------------------- Theme color. start ----------------------------------------*/
|
||||
/* 主题颜色 */
|
||||
/* 辅助色 */
|
||||
/* 文字颜色(默认浅色背景下 */
|
||||
/* 暗黑模式 */
|
||||
/* 图形颜色 */
|
||||
/*----------------------------------------- Theme color. end -------------------------------------------*/
|
||||
/*-------------------------------- Theme color application size. start --------------------------------*/
|
||||
/* 文字字号 */
|
||||
/* 文字字重 */
|
||||
/* 尺寸 */
|
||||
/*-------------------------------- Theme color application size. end --------------------------------*/
|
||||
/* component var */
|
||||
/* action-sheet */
|
||||
/* badge */
|
||||
/* button */
|
||||
/* cell */
|
||||
/* calendar */
|
||||
/* checkbox */
|
||||
/* collapse */
|
||||
/* divider */
|
||||
/* drop-menu */
|
||||
/* input-number */
|
||||
/* input */
|
||||
/* textarea */
|
||||
/* loadmore */
|
||||
/* message-box */
|
||||
/* notice-bar */
|
||||
/* pagination */
|
||||
/* picker */
|
||||
/* col-picker */
|
||||
/* overlay */
|
||||
/* popup */
|
||||
/* progress */
|
||||
/* radio */
|
||||
/* search */
|
||||
/* slider */
|
||||
/* sort-button */
|
||||
/* steps */
|
||||
/* switch */
|
||||
/* tabs */
|
||||
/* tag */
|
||||
/* toast */
|
||||
/* loading */
|
||||
/* tooltip */
|
||||
/* popover */
|
||||
/* grid-item */
|
||||
/* statustip */
|
||||
/* card */
|
||||
/* upload */
|
||||
/* curtain */
|
||||
/* notify */
|
||||
/* skeleton */
|
||||
/* circle */
|
||||
/* swiper */
|
||||
/* swiper-nav */
|
||||
/* segmented */
|
||||
/* tabbar */
|
||||
/* tabbar-item */
|
||||
/* navbar */
|
||||
/* navbar-capsule */
|
||||
/* table */
|
||||
/* sidebar */
|
||||
/* sidebar-item */
|
||||
/* fab */
|
||||
/* count-down */
|
||||
/* keyboard */
|
||||
/* number-keyboard */
|
||||
/* passwod-input */
|
||||
/* form-item */
|
||||
/* backtop */
|
||||
/* index-bar */
|
||||
/* text */
|
||||
/* video-preview */
|
||||
/* img-cropper */
|
||||
/* floating-panel */
|
||||
/* signature */
|
||||
.wot-theme-dark .wd-button.is-info.data-v-d858c170 {
|
||||
background: var(--wot-dark-background4, #323233);
|
||||
color: var(--wot-dark-color3, rgba(232, 230, 227, 0.8));
|
||||
}
|
||||
.wot-theme-dark .wd-button.is-plain.data-v-d858c170 {
|
||||
background: transparent;
|
||||
}
|
||||
.wot-theme-dark .wd-button.is-plain.is-info.data-v-d858c170 {
|
||||
color: var(--wot-dark-color, var(--wot-color-white, white));
|
||||
}
|
||||
.wot-theme-dark .wd-button.is-plain.is-info.data-v-d858c170::after {
|
||||
border-color: var(--wot-dark-background5, #646566);
|
||||
}
|
||||
.wot-theme-dark .wd-button.is-text.is-disabled.data-v-d858c170 {
|
||||
color: var(--wot-dark-color-gray, var(--wot-color-secondary, #595959));
|
||||
background: transparent;
|
||||
}
|
||||
.wot-theme-dark .wd-button.is-icon.data-v-d858c170 {
|
||||
color: var(--wot-dark-color, var(--wot-color-white, white));
|
||||
}
|
||||
.wot-theme-dark .wd-button.is-icon.is-disabled.data-v-d858c170 {
|
||||
color: var(--wot-dark-color-gray, var(--wot-color-secondary, #595959));
|
||||
background: transparent;
|
||||
}
|
||||
.wd-button.data-v-d858c170 {
|
||||
margin-left: initial;
|
||||
margin-right: initial;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
outline: none;
|
||||
-webkit-appearance: none;
|
||||
outline: none;
|
||||
background: transparent;
|
||||
box-sizing: border-box;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
color: var(--wot-button-normal-color, var(--wot-color-title, var(--wot-color-black, black)));
|
||||
transition: opacity 0.2s;
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
font-weight: normal;
|
||||
}
|
||||
.wd-button.data-v-d858c170::before {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: var(--wot-color-black, black);
|
||||
border: inherit;
|
||||
border-color: var(--wot-color-black, black);
|
||||
border-radius: inherit;
|
||||
transform: translate(-50%, -50%);
|
||||
opacity: 0;
|
||||
content: " ";
|
||||
}
|
||||
.wd-button.data-v-d858c170::after {
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
.wd-button__content.data-v-d858c170 {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
}
|
||||
.wd-button--active.data-v-d858c170:active::before {
|
||||
opacity: 0.15;
|
||||
}
|
||||
.wd-button.is-disabled.data-v-d858c170 {
|
||||
opacity: var(--wot-button-disabled-opacity, 0.6);
|
||||
}
|
||||
.wd-button__loading.data-v-d858c170 {
|
||||
margin-right: 5px;
|
||||
animation: wd-rotate-d858c170 0.8s linear infinite;
|
||||
animation-duration: 2s;
|
||||
}
|
||||
.wd-button__loading-svg.data-v-d858c170 {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
.wd-button.is-primary.data-v-d858c170 {
|
||||
background: var(--wot-button-primary-bg-color, var(--wot-color-theme, #4d80f0));
|
||||
color: var(--wot-button-primary-color, var(--wot-color-white, white));
|
||||
}
|
||||
.wd-button.is-success.data-v-d858c170 {
|
||||
background: var(--wot-button-success-bg-color, var(--wot-color-success, #34d19d));
|
||||
color: var(--wot-button-success-color, var(--wot-color-white, white));
|
||||
}
|
||||
.wd-button.is-info.data-v-d858c170 {
|
||||
background: var(--wot-button-info-bg-color, #f0f0f0);
|
||||
color: var(--wot-button-info-color, var(--wot-color-title, var(--wot-color-black, black)));
|
||||
}
|
||||
.wd-button.is-warning.data-v-d858c170 {
|
||||
background: var(--wot-button-warning-bg-color, var(--wot-color-warning, #f0883a));
|
||||
color: var(--wot-button-warning-color, var(--wot-color-white, white));
|
||||
}
|
||||
.wd-button.is-error.data-v-d858c170 {
|
||||
background: var(--wot-button-error-bg-color, var(--wot-color-danger, #fa4350));
|
||||
color: var(--wot-button-error-color, var(--wot-color-white, white));
|
||||
}
|
||||
.wd-button.is-small.data-v-d858c170 {
|
||||
height: var(--wot-button-small-height, 28px);
|
||||
padding: var(--wot-button-small-padding, 0 12px);
|
||||
border-radius: var(--wot-button-small-radius, 2px);
|
||||
font-size: var(--wot-button-small-fs, var(--wot-fs-secondary, 12px));
|
||||
font-weight: normal;
|
||||
}
|
||||
.wd-button.is-small .wd-button__loading.data-v-d858c170 {
|
||||
width: var(--wot-button-small-loading, 14px);
|
||||
height: var(--wot-button-small-loading, 14px);
|
||||
}
|
||||
.wd-button.is-medium.data-v-d858c170 {
|
||||
height: var(--wot-button-medium-height, 36px);
|
||||
padding: var(--wot-button-medium-padding, 0 16px);
|
||||
border-radius: var(--wot-button-medium-radius, 4px);
|
||||
font-size: var(--wot-button-medium-fs, var(--wot-fs-content, 14px));
|
||||
min-width: 120px;
|
||||
}
|
||||
.wd-button.is-medium.is-round.is-icon.data-v-d858c170 {
|
||||
min-width: 0;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.wd-button.is-medium.is-round.is-text.data-v-d858c170 {
|
||||
border-radius: 0;
|
||||
min-width: 0;
|
||||
}
|
||||
.wd-button.is-medium .wd-button__loading.data-v-d858c170 {
|
||||
width: var(--wot-button-medium-loading, 18px);
|
||||
height: var(--wot-button-medium-loading, 18px);
|
||||
}
|
||||
.wd-button.is-large.data-v-d858c170 {
|
||||
height: var(--wot-button-large-height, 44px);
|
||||
padding: var(--wot-button-large-padding, 0 36px);
|
||||
border-radius: var(--wot-button-large-radius, 8px);
|
||||
font-size: var(--wot-button-large-fs, var(--wot-fs-title, 16px));
|
||||
}
|
||||
.wd-button.is-large.data-v-d858c170::after {
|
||||
border-radius: var(--wot-button-large-radius, 8px);
|
||||
}
|
||||
.wd-button.is-large .wd-button__loading.data-v-d858c170 {
|
||||
width: var(--wot-button-large-loading, 24px);
|
||||
height: var(--wot-button-large-loading, 24px);
|
||||
}
|
||||
.wd-button.is-round.data-v-d858c170 {
|
||||
border-radius: 999px;
|
||||
}
|
||||
.wd-button.is-text.data-v-d858c170 {
|
||||
color: var(--wot-button-primary-bg-color, var(--wot-color-theme, #4d80f0));
|
||||
min-width: 0;
|
||||
padding: 4px 0;
|
||||
}
|
||||
.wd-button.is-text.data-v-d858c170::after {
|
||||
display: none;
|
||||
}
|
||||
.wd-button.is-text.wd-button--active.data-v-d858c170 {
|
||||
opacity: var(--wot-button-text-hover-opacity, 0.7);
|
||||
}
|
||||
.wd-button.is-text.wd-button--active.data-v-d858c170:active::before {
|
||||
display: none;
|
||||
}
|
||||
.wd-button.is-text.is-disabled.data-v-d858c170 {
|
||||
color: var(--wot-button-normal-disabled-color, rgba(0, 0, 0, 0.25));
|
||||
background: transparent;
|
||||
}
|
||||
.wd-button.is-plain.data-v-d858c170 {
|
||||
background: var(--wot-button-plain-bg-color, var(--wot-color-white, white));
|
||||
border: 1px solid currentColor;
|
||||
}
|
||||
.wd-button.is-plain.is-primary.data-v-d858c170 {
|
||||
color: var(--wot-button-primary-bg-color, var(--wot-color-theme, #4d80f0));
|
||||
}
|
||||
.wd-button.is-plain.is-success.data-v-d858c170 {
|
||||
color: var(--wot-button-success-bg-color, var(--wot-color-success, #34d19d));
|
||||
}
|
||||
.wd-button.is-plain.is-info.data-v-d858c170 {
|
||||
color: var(--wot-button-info-plain-normal-color, rgba(0, 0, 0, 0.85));
|
||||
border-color: var(--wot-button-info-plain-border-color, rgba(0, 0, 0, 0.45));
|
||||
}
|
||||
.wd-button.is-plain.is-warning.data-v-d858c170 {
|
||||
color: var(--wot-button-warning-bg-color, var(--wot-color-warning, #f0883a));
|
||||
}
|
||||
.wd-button.is-plain.is-error.data-v-d858c170 {
|
||||
color: var(--wot-button-error-bg-color, var(--wot-color-danger, #fa4350));
|
||||
}
|
||||
.wd-button.is-hairline.data-v-d858c170 {
|
||||
border-width: 0;
|
||||
}
|
||||
.wd-button.is-hairline.is-plain.data-v-d858c170 {
|
||||
position: relative;
|
||||
}
|
||||
.wd-button.is-hairline.is-plain.data-v-d858c170::after {
|
||||
position: absolute;
|
||||
display: block;
|
||||
content: " ";
|
||||
pointer-events: none;
|
||||
width: 200%;
|
||||
height: 200%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
border: 1px solid var(--wot-color-border-light, #e8e8e8);
|
||||
transform: scale(0.5);
|
||||
box-sizing: border-box;
|
||||
transform-origin: left top;
|
||||
}
|
||||
.wd-button.is-hairline.is-plain.data-v-d858c170::before {
|
||||
border-radius: inherit;
|
||||
}
|
||||
.wd-button.is-hairline.is-plain.data-v-d858c170::after {
|
||||
border-color: inherit;
|
||||
}
|
||||
.wd-button.is-hairline.is-plain.is-round.data-v-d858c170::after {
|
||||
border-radius: inherit !important;
|
||||
}
|
||||
.wd-button.is-hairline.is-plain.is-large.data-v-d858c170::after {
|
||||
border-radius: calc(2 * var(--wot-button-large-radius, 8px));
|
||||
}
|
||||
.wd-button.is-hairline.is-plain.is-medium.data-v-d858c170::after {
|
||||
border-radius: calc(2 * var(--wot-button-medium-radius, 4px));
|
||||
}
|
||||
.wd-button.is-hairline.is-plain.is-small.data-v-d858c170::after {
|
||||
border-radius: calc(2 * var(--wot-button-small-radius, 2px));
|
||||
}
|
||||
.wd-button.is-block.data-v-d858c170 {
|
||||
display: block;
|
||||
}
|
||||
.wd-button.is-icon.data-v-d858c170 {
|
||||
width: var(--wot-button-icon-size, 40px);
|
||||
height: var(--wot-button-icon-size, 40px);
|
||||
padding: 0;
|
||||
border-radius: 50%;
|
||||
color: var(--wot-button-icon-color, rgba(0, 0, 0, 0.65));
|
||||
}
|
||||
.wd-button.is-icon.data-v-d858c170::after {
|
||||
display: none;
|
||||
}
|
||||
.wd-button.is-icon.data-v-d858c170 .wd-button__icon {
|
||||
margin-right: 0;
|
||||
}
|
||||
.wd-button.is-icon.is-disabled.data-v-d858c170 {
|
||||
color: var(--wot-button-icon-disabled-color, var(--wot-color-icon-disabled, #a7a7a7));
|
||||
background: transparent;
|
||||
}
|
||||
.data-v-d858c170 .wd-button__icon {
|
||||
display: block;
|
||||
margin-right: 6px;
|
||||
font-size: var(--wot-button-icon-fs, 18px);
|
||||
vertical-align: middle;
|
||||
}
|
||||
.wd-button__text.data-v-d858c170 {
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
@keyframes wd-rotate-d858c170 {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
4
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-cell-group/types.js
vendored
Normal file
4
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-cell-group/types.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
const CELL_GROUP_KEY = Symbol("wd-cell-group");
|
||||
exports.CELL_GROUP_KEY = CELL_GROUP_KEY;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-cell-group/types.js.map
|
||||
108
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-cell/types.js
vendored
Normal file
108
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-cell/types.js
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
"use strict";
|
||||
const uni_modules_wotDesignUni_components_common_props = require("../common/props.js");
|
||||
const cellProps = {
|
||||
...uni_modules_wotDesignUni_components_common_props.baseProps,
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
title: String,
|
||||
/**
|
||||
* 右侧内容
|
||||
*/
|
||||
value: uni_modules_wotDesignUni_components_common_props.makeNumericProp(""),
|
||||
/**
|
||||
* 图标类名
|
||||
*/
|
||||
icon: String,
|
||||
/**
|
||||
* 图标大小
|
||||
*/
|
||||
iconSize: uni_modules_wotDesignUni_components_common_props.numericProp,
|
||||
/**
|
||||
* 描述信息
|
||||
*/
|
||||
label: String,
|
||||
/**
|
||||
* 是否为跳转链接
|
||||
*/
|
||||
isLink: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 跳转地址
|
||||
*/
|
||||
to: String,
|
||||
/**
|
||||
* 跳转时是否替换栈顶页面
|
||||
*/
|
||||
replace: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 开启点击反馈,is-link 默认开启
|
||||
*/
|
||||
clickable: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 设置单元格大小,可选值:large
|
||||
*/
|
||||
size: String,
|
||||
/**
|
||||
* 是否展示边框线
|
||||
*/
|
||||
border: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(void 0),
|
||||
/**
|
||||
* 设置左侧标题宽度
|
||||
*/
|
||||
titleWidth: String,
|
||||
/**
|
||||
* 是否垂直居中,默认顶部居中
|
||||
*/
|
||||
center: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 是否必填
|
||||
*/
|
||||
required: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 表单属性,上下结构
|
||||
*/
|
||||
vertical: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 表单域 model 字段名,在使用表单校验功能的情况下,该属性是必填的
|
||||
*/
|
||||
prop: String,
|
||||
/**
|
||||
* 表单验证规则,结合wd-form组件使用
|
||||
*/
|
||||
rules: uni_modules_wotDesignUni_components_common_props.makeArrayProp(),
|
||||
/**
|
||||
* icon 使用 slot 时的自定义样式
|
||||
*/
|
||||
customIconClass: uni_modules_wotDesignUni_components_common_props.makeStringProp(""),
|
||||
/**
|
||||
* label 使用 slot 时的自定义样式
|
||||
*/
|
||||
customLabelClass: uni_modules_wotDesignUni_components_common_props.makeStringProp(""),
|
||||
/**
|
||||
* value 使用 slot 时的自定义样式
|
||||
*/
|
||||
customValueClass: uni_modules_wotDesignUni_components_common_props.makeStringProp(""),
|
||||
/**
|
||||
* title 使用 slot 时的自定义样式
|
||||
*/
|
||||
customTitleClass: uni_modules_wotDesignUni_components_common_props.makeStringProp(""),
|
||||
/**
|
||||
* value 文字对齐方式,可选值:left、right、center
|
||||
*/
|
||||
valueAlign: uni_modules_wotDesignUni_components_common_props.makeStringProp("right"),
|
||||
/**
|
||||
* 是否超出隐藏,显示省略号
|
||||
*/
|
||||
ellipsis: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 是否启用title插槽,默认启用,用来解决插槽传递时v-slot和v-if冲突问题。
|
||||
* 问题见:https://github.com/dcloudio/uni-app/issues/4847
|
||||
*/
|
||||
useTitleSlot: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(true),
|
||||
/**
|
||||
* 必填标记位置,可选值:before(标签前)、after(标签后)
|
||||
*/
|
||||
markerSide: uni_modules_wotDesignUni_components_common_props.makeStringProp("before")
|
||||
};
|
||||
exports.cellProps = cellProps;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-cell/types.js.map
|
||||
127
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-cell/wd-cell.js
vendored
Normal file
127
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-cell/wd-cell.js
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_wotDesignUni_components_composables_useCell = require("../composables/useCell.js");
|
||||
const uni_modules_wotDesignUni_components_composables_useParent = require("../composables/useParent.js");
|
||||
const uni_modules_wotDesignUni_components_wdForm_types = require("../wd-form/types.js");
|
||||
const uni_modules_wotDesignUni_components_wdCell_types = require("./types.js");
|
||||
const uni_modules_wotDesignUni_components_common_util = require("../common/util.js");
|
||||
if (!Math) {
|
||||
wdIcon();
|
||||
}
|
||||
const wdIcon = () => "../wd-icon/wd-icon.js";
|
||||
const __default__ = {
|
||||
name: "wd-cell",
|
||||
options: {
|
||||
addGlobalClass: true,
|
||||
virtualHost: true,
|
||||
styleIsolation: "shared"
|
||||
}
|
||||
};
|
||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
...__default__,
|
||||
props: uni_modules_wotDesignUni_components_wdCell_types.cellProps,
|
||||
emits: ["click"],
|
||||
setup(__props, { emit: __emit }) {
|
||||
const props = __props;
|
||||
const emit = __emit;
|
||||
const slots = common_vendor.useSlots();
|
||||
const cell = uni_modules_wotDesignUni_components_composables_useCell.useCell();
|
||||
const isBorder = common_vendor.computed(() => {
|
||||
return Boolean(uni_modules_wotDesignUni_components_common_util.isDef(props.border) ? props.border : cell.border.value);
|
||||
});
|
||||
const { parent: form } = uni_modules_wotDesignUni_components_composables_useParent.useParent(uni_modules_wotDesignUni_components_wdForm_types.FORM_KEY);
|
||||
const errorMessage = common_vendor.computed(() => {
|
||||
if (form && props.prop && form.errorMessages && form.errorMessages[props.prop]) {
|
||||
return form.errorMessages[props.prop];
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
const isRequired = common_vendor.computed(() => {
|
||||
let formRequired = false;
|
||||
if (form && form.props.rules) {
|
||||
const rules = form.props.rules;
|
||||
for (const key in rules) {
|
||||
if (Object.prototype.hasOwnProperty.call(rules, key) && key === props.prop && Array.isArray(rules[key])) {
|
||||
formRequired = rules[key].some((rule) => rule.required);
|
||||
}
|
||||
}
|
||||
}
|
||||
return props.required || props.rules.some((rule) => rule.required) || formRequired;
|
||||
});
|
||||
const showLeft = common_vendor.computed(() => {
|
||||
const hasIcon = slots.icon || props.icon;
|
||||
const hasTitle = slots.title && props.useTitleSlot || props.title;
|
||||
const hasLabel = slots.label || props.label;
|
||||
return hasIcon || hasTitle || hasLabel;
|
||||
});
|
||||
function onClick() {
|
||||
const url = props.to;
|
||||
if (props.clickable || props.isLink) {
|
||||
emit("click");
|
||||
}
|
||||
if (url && props.isLink) {
|
||||
if (props.replace) {
|
||||
common_vendor.index.redirectTo({ url });
|
||||
} else {
|
||||
common_vendor.index.navigateTo({ url });
|
||||
}
|
||||
}
|
||||
}
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: showLeft.value
|
||||
}, showLeft.value ? common_vendor.e({
|
||||
b: isRequired.value && _ctx.markerSide === "before"
|
||||
}, isRequired.value && _ctx.markerSide === "before" ? {} : {}, {
|
||||
c: _ctx.icon
|
||||
}, _ctx.icon ? {
|
||||
d: common_vendor.p({
|
||||
name: _ctx.icon,
|
||||
size: _ctx.iconSize,
|
||||
["custom-class"]: `wd-cell__icon ${_ctx.customIconClass}`
|
||||
})
|
||||
} : {}, {
|
||||
e: _ctx.useTitleSlot && _ctx.$slots.title
|
||||
}, _ctx.useTitleSlot && _ctx.$slots.title ? {} : _ctx.title ? {
|
||||
g: common_vendor.t(_ctx.title),
|
||||
h: common_vendor.n(_ctx.customTitleClass)
|
||||
} : {}, {
|
||||
f: _ctx.title,
|
||||
i: _ctx.label
|
||||
}, _ctx.label ? {
|
||||
j: common_vendor.t(_ctx.label),
|
||||
k: common_vendor.n(`wd-cell__label ${_ctx.customLabelClass}`)
|
||||
} : {}, {
|
||||
l: isRequired.value && _ctx.markerSide === "after"
|
||||
}, isRequired.value && _ctx.markerSide === "after" ? {} : {}, {
|
||||
m: common_vendor.s(_ctx.titleWidth ? "min-width:" + _ctx.titleWidth + ";max-width:" + _ctx.titleWidth + ";" : "")
|
||||
}) : {}, {
|
||||
n: common_vendor.t(_ctx.value),
|
||||
o: common_vendor.n(`wd-cell__value ${_ctx.customValueClass} wd-cell__value--${_ctx.valueAlign} ${_ctx.ellipsis ? "wd-cell__value--ellipsis" : ""}`),
|
||||
p: _ctx.isLink
|
||||
}, _ctx.isLink ? {
|
||||
q: common_vendor.p({
|
||||
["custom-class"]: "wd-cell__arrow-right",
|
||||
name: "arrow-right"
|
||||
})
|
||||
} : {}, {
|
||||
r: errorMessage.value
|
||||
}, errorMessage.value ? {
|
||||
s: common_vendor.t(errorMessage.value)
|
||||
} : {}, {
|
||||
t: common_vendor.n(_ctx.vertical ? "is-vertical" : ""),
|
||||
v: common_vendor.n(isBorder.value ? "is-border" : ""),
|
||||
w: common_vendor.n(_ctx.size ? "is-" + _ctx.size : ""),
|
||||
x: common_vendor.n(_ctx.center ? "is-center" : ""),
|
||||
y: common_vendor.n(_ctx.customClass),
|
||||
z: common_vendor.s(_ctx.customStyle),
|
||||
A: _ctx.isLink || _ctx.clickable ? "is-hover" : "none",
|
||||
B: common_vendor.o(onClick)
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-f1c5bbe2"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-cell/wd-cell.js.map
|
||||
6
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-cell/wd-cell.json
vendored
Normal file
6
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-cell/wd-cell.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"wd-icon": "../wd-icon/wd-icon"
|
||||
}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-cell/wd-cell.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-cell/wd-cell.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="{{['data-v-f1c5bbe2', 'wd-cell', v, w, x, y]}}" style="{{z}}" hover-class="{{A}}" hover-stay-time="{{70}}" bindtap="{{B}}"><view class="{{['data-v-f1c5bbe2', 'wd-cell__wrapper', t]}}"><view wx:if="{{a}}" class="wd-cell__left data-v-f1c5bbe2" style="{{m}}"><text wx:if="{{b}}" class="wd-cell__required wd-cell__required--left data-v-f1c5bbe2">*</text><block wx:if="{{$slots.icon}}"><slot name="icon"></slot></block><block wx:else><wd-icon wx:if="{{c}}" class="data-v-f1c5bbe2" u-i="f1c5bbe2-0" bind:__l="__l" u-p="{{d}}"></wd-icon></block><view class="wd-cell__title data-v-f1c5bbe2"><slot wx:if="{{e}}" name="title"></slot><text wx:elif="{{f}}" class="{{['data-v-f1c5bbe2', h]}}">{{g}}</text><block wx:if="{{$slots.label}}"><slot name="label"></slot></block><block wx:else><view wx:if="{{i}}" class="{{['data-v-f1c5bbe2', k]}}">{{j}}</view></block></view><text wx:if="{{l}}" class="wd-cell__required data-v-f1c5bbe2">*</text></view><view class="wd-cell__right data-v-f1c5bbe2"><view class="wd-cell__body data-v-f1c5bbe2"><view class="{{['data-v-f1c5bbe2', o]}}"><block wx:if="{{$slots.d}}"><slot></slot></block><block wx:else>{{n}}</block></view><wd-icon wx:if="{{p}}" class="data-v-f1c5bbe2" u-i="f1c5bbe2-1" bind:__l="__l" u-p="{{q}}"/><slot wx:else name="right-icon"/></view><view wx:if="{{r}}" class="wd-cell__error-message data-v-f1c5bbe2">{{s}}</view></view></view></view>
|
||||
348
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-cell/wd-cell.wxss
vendored
Normal file
348
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-cell/wd-cell.wxss
vendored
Normal file
@@ -0,0 +1,348 @@
|
||||
/* 水平间距 */
|
||||
/* 水平间距 */
|
||||
/**
|
||||
* 辅助函数
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/* 转换成字符串 */
|
||||
/* 判断是否存在 Modifier */
|
||||
/* 判断是否存在伪类 */
|
||||
/**
|
||||
* 主题色切换
|
||||
* @params $theme-color 主题色
|
||||
* @params $type 变暗’dark‘ 变亮 'light'
|
||||
* @params $mix-color 自己设置的混色
|
||||
*/
|
||||
/**
|
||||
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
|
||||
* @params $open-linear 是否开启线性渐变色
|
||||
* @params $deg 渐变色角度
|
||||
* @params $theme-color 当前配色
|
||||
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
|
||||
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
|
||||
* @params [Array] $per-list 渐变色比例
|
||||
*/
|
||||
/**
|
||||
* UI规范基础变量
|
||||
*/
|
||||
/*----------------------------------------- Theme color. start ----------------------------------------*/
|
||||
/* 主题颜色 */
|
||||
/* 辅助色 */
|
||||
/* 文字颜色(默认浅色背景下 */
|
||||
/* 暗黑模式 */
|
||||
/* 图形颜色 */
|
||||
/*----------------------------------------- Theme color. end -------------------------------------------*/
|
||||
/*-------------------------------- Theme color application size. start --------------------------------*/
|
||||
/* 文字字号 */
|
||||
/* 文字字重 */
|
||||
/* 尺寸 */
|
||||
/*-------------------------------- Theme color application size. end --------------------------------*/
|
||||
/* component var */
|
||||
/* action-sheet */
|
||||
/* badge */
|
||||
/* button */
|
||||
/* cell */
|
||||
/* calendar */
|
||||
/* checkbox */
|
||||
/* collapse */
|
||||
/* divider */
|
||||
/* drop-menu */
|
||||
/* input-number */
|
||||
/* input */
|
||||
/* textarea */
|
||||
/* loadmore */
|
||||
/* message-box */
|
||||
/* notice-bar */
|
||||
/* pagination */
|
||||
/* picker */
|
||||
/* col-picker */
|
||||
/* overlay */
|
||||
/* popup */
|
||||
/* progress */
|
||||
/* radio */
|
||||
/* search */
|
||||
/* slider */
|
||||
/* sort-button */
|
||||
/* steps */
|
||||
/* switch */
|
||||
/* tabs */
|
||||
/* tag */
|
||||
/* toast */
|
||||
/* loading */
|
||||
/* tooltip */
|
||||
/* popover */
|
||||
/* grid-item */
|
||||
/* statustip */
|
||||
/* card */
|
||||
/* upload */
|
||||
/* curtain */
|
||||
/* notify */
|
||||
/* skeleton */
|
||||
/* circle */
|
||||
/* swiper */
|
||||
/* swiper-nav */
|
||||
/* segmented */
|
||||
/* tabbar */
|
||||
/* tabbar-item */
|
||||
/* navbar */
|
||||
/* navbar-capsule */
|
||||
/* table */
|
||||
/* sidebar */
|
||||
/* sidebar-item */
|
||||
/* fab */
|
||||
/* count-down */
|
||||
/* keyboard */
|
||||
/* number-keyboard */
|
||||
/* passwod-input */
|
||||
/* form-item */
|
||||
/* backtop */
|
||||
/* index-bar */
|
||||
/* text */
|
||||
/* video-preview */
|
||||
/* img-cropper */
|
||||
/* floating-panel */
|
||||
/* signature */
|
||||
/**
|
||||
* 混合宏
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/**
|
||||
* 辅助函数
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/* 转换成字符串 */
|
||||
/* 判断是否存在 Modifier */
|
||||
/* 判断是否存在伪类 */
|
||||
/**
|
||||
* 主题色切换
|
||||
* @params $theme-color 主题色
|
||||
* @params $type 变暗’dark‘ 变亮 'light'
|
||||
* @params $mix-color 自己设置的混色
|
||||
*/
|
||||
/**
|
||||
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
|
||||
* @params $open-linear 是否开启线性渐变色
|
||||
* @params $deg 渐变色角度
|
||||
* @params $theme-color 当前配色
|
||||
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
|
||||
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
|
||||
* @params [Array] $per-list 渐变色比例
|
||||
*/
|
||||
/**
|
||||
* BEM,定义块(b)
|
||||
*/
|
||||
/* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
|
||||
/* 此方法用于生成穿透样式 */
|
||||
/* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
|
||||
/* 定义状态(m) */
|
||||
/* 定义状态(m) */
|
||||
/* 对于需要需要嵌套在 m 底下的 e,调用这个混合宏,一般在切换整个组件的状态,如切换颜色的时候 */
|
||||
/* 状态,生成 is-$state 类名 */
|
||||
/**
|
||||
* 常用混合宏
|
||||
*/
|
||||
/* 单行超出隐藏 */
|
||||
/* 多行超出隐藏 */
|
||||
/* 清除浮动 */
|
||||
/* 0.5px 边框 指定方向*/
|
||||
/* 0.5px 边框 环绕 */
|
||||
/**
|
||||
* 三角形实现尖角样式,适用于背景透明情况
|
||||
* @param $size 三角形高,底边为 $size * 2
|
||||
* @param $bg 三角形背景颜色
|
||||
*/
|
||||
/**
|
||||
* 正方形实现尖角样式,适用于背景不透明情况
|
||||
* @param $size 正方形边长
|
||||
* @param $bg 正方形背景颜色
|
||||
* @param $z-index z-index属性值,不得大于外部包裹器
|
||||
* @param $box-shadow 阴影
|
||||
*/
|
||||
.wot-theme-dark .wd-cell.data-v-f1c5bbe2 {
|
||||
background-color: var(--wot-dark-background2, #1b1b1b);
|
||||
color: var(--wot-dark-color, var(--wot-color-white, white));
|
||||
}
|
||||
.wot-theme-dark .wd-cell__value.data-v-f1c5bbe2 {
|
||||
color: var(--wot-dark-color, var(--wot-color-white, white));
|
||||
}
|
||||
.wot-theme-dark .wd-cell__label.data-v-f1c5bbe2 {
|
||||
color: var(--wot-dark-color3, rgba(232, 230, 227, 0.8));
|
||||
}
|
||||
.wot-theme-dark .wd-cell.is-hover.data-v-f1c5bbe2 {
|
||||
background-color: var(--wot-dark-background4, #323233);
|
||||
}
|
||||
.wot-theme-dark .wd-cell.is-border .wd-cell__wrapper.data-v-f1c5bbe2 {
|
||||
position: relative;
|
||||
}
|
||||
.wot-theme-dark .wd-cell.is-border .wd-cell__wrapper.data-v-f1c5bbe2::after {
|
||||
position: absolute;
|
||||
display: block;
|
||||
content: "";
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
left: 0;
|
||||
top: 0;
|
||||
transform: scaleY(0.5);
|
||||
background: var(--wot-dark-border-color, #3a3a3c);
|
||||
}
|
||||
.wot-theme-dark .wd-cell.data-v-f1c5bbe2 .wd-cell__arrow-right {
|
||||
color: var(--wot-dark-color, var(--wot-color-white, white));
|
||||
}
|
||||
.wd-cell.data-v-f1c5bbe2 {
|
||||
position: relative;
|
||||
padding-left: var(--wot-cell-padding, var(--wot-size-side-padding, 15px));
|
||||
background-color: var(--wot-color-white, white);
|
||||
text-decoration: none;
|
||||
color: var(--wot-cell-title-color, rgba(0, 0, 0, 0.85));
|
||||
line-height: var(--wot-cell-line-height, 24px);
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.wd-cell.is-border .wd-cell__wrapper.data-v-f1c5bbe2 {
|
||||
position: relative;
|
||||
}
|
||||
.wd-cell.is-border .wd-cell__wrapper.data-v-f1c5bbe2::after {
|
||||
position: absolute;
|
||||
display: block;
|
||||
content: "";
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
left: 0;
|
||||
top: 0;
|
||||
transform: scaleY(0.5);
|
||||
background: var(--wot-color-border-light, #e8e8e8);
|
||||
}
|
||||
.wd-cell__wrapper.data-v-f1c5bbe2 {
|
||||
position: relative;
|
||||
display: flex;
|
||||
padding: var(--wot-cell-wrapper-padding, 10px) var(--wot-cell-padding, var(--wot-size-side-padding, 15px)) var(--wot-cell-wrapper-padding, 10px) 0;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
overflow: hidden;
|
||||
}
|
||||
.wd-cell__wrapper.is-vertical.data-v-f1c5bbe2 {
|
||||
display: block;
|
||||
}
|
||||
.wd-cell__wrapper.is-vertical .wd-cell__right.data-v-f1c5bbe2 {
|
||||
margin-top: var(--wot-cell-vertical-top, 16px);
|
||||
}
|
||||
.wd-cell__wrapper.is-vertical .wd-cell__value.data-v-f1c5bbe2 {
|
||||
text-align: left;
|
||||
}
|
||||
.wd-cell__wrapper.is-vertical .wd-cell__left.data-v-f1c5bbe2 {
|
||||
margin-right: 0;
|
||||
}
|
||||
.wd-cell__wrapper.is-label.data-v-f1c5bbe2 {
|
||||
padding: var(--wot-cell-wrapper-padding-with-label, 16px) var(--wot-cell-padding, var(--wot-size-side-padding, 15px)) var(--wot-cell-wrapper-padding-with-label, 16px) 0;
|
||||
}
|
||||
.wd-cell__left.data-v-f1c5bbe2 {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
text-align: left;
|
||||
font-size: var(--wot-cell-title-fs, 14px);
|
||||
box-sizing: border-box;
|
||||
margin-right: var(--wot-cell-padding, var(--wot-size-side-padding, 15px));
|
||||
}
|
||||
.wd-cell__right.data-v-f1c5bbe2 {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.wd-cell__title.data-v-f1c5bbe2 {
|
||||
font-size: var(--wot-cell-title-fs, 14px);
|
||||
}
|
||||
.wd-cell__required.data-v-f1c5bbe2 {
|
||||
font-size: var(--wot-cell-required-size, 18px);
|
||||
color: var(--wot-cell-required-color, var(--wot-color-danger, #fa4350));
|
||||
margin-left: var(--wot-cell-required-margin, 4px);
|
||||
}
|
||||
.wd-cell__required--left.data-v-f1c5bbe2 {
|
||||
margin-left: 0;
|
||||
margin-right: var(--wot-cell-required-margin, 4px);
|
||||
}
|
||||
.wd-cell__label.data-v-f1c5bbe2 {
|
||||
margin-top: 2px;
|
||||
font-size: var(--wot-cell-label-fs, 12px);
|
||||
color: var(--wot-cell-label-color, rgba(0, 0, 0, 0.45));
|
||||
}
|
||||
.data-v-f1c5bbe2 .wd-cell__icon {
|
||||
display: block;
|
||||
position: relative;
|
||||
margin-right: var(--wot-cell-icon-right, 4px);
|
||||
font-size: var(--wot-cell-icon-size, 16px);
|
||||
height: var(--wot-cell-line-height, 24px);
|
||||
line-height: var(--wot-cell-line-height, 24px);
|
||||
}
|
||||
.wd-cell__body.data-v-f1c5bbe2 {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
}
|
||||
.wd-cell__value.data-v-f1c5bbe2 {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
font-size: var(--wot-cell-value-fs, 14px);
|
||||
color: var(--wot-cell-value-color, rgba(0, 0, 0, 0.85));
|
||||
vertical-align: middle;
|
||||
}
|
||||
.wd-cell__value--left.data-v-f1c5bbe2 {
|
||||
text-align: left;
|
||||
}
|
||||
.wd-cell__value--right.data-v-f1c5bbe2 {
|
||||
text-align: right;
|
||||
}
|
||||
.wd-cell__value--ellipsis.data-v-f1c5bbe2 {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
min-width: 0;
|
||||
}
|
||||
.data-v-f1c5bbe2 .wd-cell__arrow-right {
|
||||
display: block;
|
||||
margin-left: 8px;
|
||||
width: var(--wot-cell-arrow-size, 18px);
|
||||
font-size: var(--wot-cell-arrow-size, 18px);
|
||||
color: var(--wot-cell-arrow-color, rgba(0, 0, 0, 0.25));
|
||||
height: var(--wot-cell-line-height, 24px);
|
||||
line-height: var(--wot-cell-line-height, 24px);
|
||||
}
|
||||
.wd-cell__error-message.data-v-f1c5bbe2 {
|
||||
color: var(--wot-form-item-error-message-color, var(--wot-color-danger, #fa4350));
|
||||
font-size: var(--wot-form-item-error-message-font-size, var(--wot-fs-secondary, 12px));
|
||||
line-height: var(--wot-form-item-error-message-line-height, 24px);
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.wd-cell.is-link.data-v-f1c5bbe2 {
|
||||
-webkit-tap-highlight-color: var(--wot-cell-tap-bg, rgba(0, 0, 0, 0.06));
|
||||
}
|
||||
.wd-cell.is-hover.data-v-f1c5bbe2 {
|
||||
background-color: var(--wot-cell-tap-bg, rgba(0, 0, 0, 0.06));
|
||||
}
|
||||
.wd-cell.is-large .wd-cell__title.data-v-f1c5bbe2 {
|
||||
font-size: var(--wot-cell-title-fs-large, 16px);
|
||||
}
|
||||
.wd-cell.is-large .wd-cell__wrapper.data-v-f1c5bbe2 {
|
||||
padding-top: var(--wot-cell-wrapper-padding-large, 12px);
|
||||
padding-bottom: var(--wot-cell-wrapper-padding-large, 12px);
|
||||
}
|
||||
.wd-cell.is-large .wd-cell__label.data-v-f1c5bbe2 {
|
||||
font-size: var(--wot-cell-label-fs-large, 14px);
|
||||
}
|
||||
.wd-cell.is-large .wd-cell__value.data-v-f1c5bbe2 {
|
||||
font-size: var(--wot-cell-value-fs-large, 16px);
|
||||
}
|
||||
.wd-cell.is-large.data-v-f1c5bbe2 .wd-cell__icon {
|
||||
font-size: var(--wot-cell-icon-size-large, 18px);
|
||||
}
|
||||
.wd-cell.is-center .wd-cell__wrapper.data-v-f1c5bbe2 {
|
||||
align-items: center;
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
"use strict";
|
||||
const uni_modules_wotDesignUni_components_common_props = require("../common/props.js");
|
||||
const datetimePickerViewProps = {
|
||||
...uni_modules_wotDesignUni_components_common_props.baseProps,
|
||||
/**
|
||||
* 选中项,当 type 为 time 时,类型为字符串,否则为 时间戳
|
||||
*/
|
||||
modelValue: uni_modules_wotDesignUni_components_common_props.makeRequiredProp([String, Number]),
|
||||
/**
|
||||
* 加载中
|
||||
*/
|
||||
loading: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 加载的颜色,只能使用十六进制的色值写法,且不能使用缩写
|
||||
*/
|
||||
loadingColor: uni_modules_wotDesignUni_components_common_props.makeStringProp("#4D80F0"),
|
||||
/**
|
||||
* picker内部滚筒高
|
||||
*/
|
||||
columnsHeight: uni_modules_wotDesignUni_components_common_props.makeNumberProp(217),
|
||||
/**
|
||||
* picker item的高度
|
||||
*/
|
||||
itemHeight: uni_modules_wotDesignUni_components_common_props.makeNumberProp(35),
|
||||
/**
|
||||
* 选项的key
|
||||
*/
|
||||
valueKey: uni_modules_wotDesignUni_components_common_props.makeStringProp("value"),
|
||||
/**
|
||||
* 选项的label
|
||||
*/
|
||||
labelKey: uni_modules_wotDesignUni_components_common_props.makeStringProp("label"),
|
||||
/**
|
||||
* 选择器类型,可选值:date / year-month / time
|
||||
*/
|
||||
type: uni_modules_wotDesignUni_components_common_props.makeStringProp("datetime"),
|
||||
/**
|
||||
* 自定义过滤选项的函数,返回列的选项数组
|
||||
*/
|
||||
filter: Function,
|
||||
/**
|
||||
* 自定义弹出层选项文案的格式化函数,返回一个字符串
|
||||
*/
|
||||
formatter: Function,
|
||||
/**
|
||||
* 自定义列的格式化函数
|
||||
*/
|
||||
columnFormatter: Function,
|
||||
/**
|
||||
* 最小日期
|
||||
*/
|
||||
minDate: uni_modules_wotDesignUni_components_common_props.makeNumberProp(new Date((/* @__PURE__ */ new Date()).getFullYear() - 10, 0, 1).getTime()),
|
||||
/**
|
||||
* 最大日期
|
||||
*/
|
||||
maxDate: uni_modules_wotDesignUni_components_common_props.makeNumberProp(new Date((/* @__PURE__ */ new Date()).getFullYear() + 10, 11, 31).getTime()),
|
||||
/**
|
||||
* 最小小时,time类型时生效
|
||||
*/
|
||||
minHour: uni_modules_wotDesignUni_components_common_props.makeNumberProp(0),
|
||||
/**
|
||||
* 最大小时,time类型时生效
|
||||
*/
|
||||
maxHour: uni_modules_wotDesignUni_components_common_props.makeNumberProp(23),
|
||||
/**
|
||||
* 最小分钟,time类型时生效
|
||||
*/
|
||||
minMinute: uni_modules_wotDesignUni_components_common_props.makeNumberProp(0),
|
||||
/**
|
||||
* 最大分钟,time类型时生效
|
||||
*/
|
||||
maxMinute: uni_modules_wotDesignUni_components_common_props.makeNumberProp(59),
|
||||
/**
|
||||
* 是否显示秒选择,仅在 time 和 datetime 类型下生效
|
||||
*/
|
||||
useSecond: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 最小秒数,仅在 time 和 datetime 类型下生效
|
||||
*/
|
||||
minSecond: uni_modules_wotDesignUni_components_common_props.makeNumberProp(0),
|
||||
/**
|
||||
* 最大秒数,仅在 time 和 datetime 类型下生效
|
||||
*/
|
||||
maxSecond: uni_modules_wotDesignUni_components_common_props.makeNumberProp(59),
|
||||
/**
|
||||
* 是否在手指松开时立即触发picker-view的 change 事件。若不开启则会在滚动动画结束后触发 change 事件,1.2.25版本起提供,仅微信小程序和支付宝小程序支持。
|
||||
*/
|
||||
immediateChange: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false)
|
||||
};
|
||||
exports.datetimePickerViewProps = datetimePickerViewProps;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-datetime-picker-view/types.js.map
|
||||
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
function getPickerValue(value, type, useSecond = false) {
|
||||
const values = [];
|
||||
const date = new Date(value);
|
||||
if (type === "time") {
|
||||
const pair = String(value).split(":");
|
||||
values.push(parseInt(pair[0]), parseInt(pair[1]));
|
||||
if (useSecond && pair[2]) {
|
||||
values.push(parseInt(pair[2]));
|
||||
}
|
||||
} else {
|
||||
values.push(date.getFullYear(), date.getMonth() + 1);
|
||||
if (type === "date") {
|
||||
values.push(date.getDate());
|
||||
} else if (type === "datetime") {
|
||||
values.push(date.getDate(), date.getHours(), date.getMinutes());
|
||||
if (useSecond) {
|
||||
values.push(date.getSeconds());
|
||||
}
|
||||
}
|
||||
}
|
||||
return values;
|
||||
}
|
||||
exports.getPickerValue = getPickerValue;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-datetime-picker-view/util.js.map
|
||||
@@ -0,0 +1,394 @@
|
||||
"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_wdDatetimePickerView_types = require("./types.js");
|
||||
const uni_modules_wotDesignUni_components_wdDatetimePickerView_util = require("./util.js");
|
||||
if (!Math) {
|
||||
wdPickerView();
|
||||
}
|
||||
const wdPickerView = () => "../wd-picker-view/wd-picker-view.js";
|
||||
const __default__ = {
|
||||
name: "wd-datetime-picker-view",
|
||||
virtualHost: true,
|
||||
addGlobalClass: true,
|
||||
styleIsolation: "shared"
|
||||
};
|
||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
...__default__,
|
||||
props: uni_modules_wotDesignUni_components_wdDatetimePickerView_types.datetimePickerViewProps,
|
||||
emits: ["change", "pickstart", "pickend", "update:modelValue"],
|
||||
setup(__props, { expose: __expose, emit: __emit }) {
|
||||
const isValidDate = (date) => uni_modules_wotDesignUni_components_common_util.isDef(date) && !Number.isNaN(date);
|
||||
const times = (n, iteratee) => {
|
||||
let index = -1;
|
||||
const length = n < 0 ? 0 : n;
|
||||
const result = Array(length);
|
||||
while (++index < n) {
|
||||
result[index] = iteratee(index);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
const getMonthEndDay = (year, month) => {
|
||||
return 32 - new Date(year, month - 1, 32).getDate();
|
||||
};
|
||||
const props = __props;
|
||||
const emit = __emit;
|
||||
const datePickerview = common_vendor.ref();
|
||||
const innerValue = common_vendor.ref(null);
|
||||
const columns = common_vendor.ref([]);
|
||||
const pickerValue = common_vendor.ref([]);
|
||||
const created = common_vendor.ref(false);
|
||||
const { proxy } = common_vendor.getCurrentInstance();
|
||||
const updateValue = uni_modules_wotDesignUni_components_common_util.debounce(() => {
|
||||
if (!created.value)
|
||||
return;
|
||||
const val = correctValue(props.modelValue);
|
||||
const isEqual = val === innerValue.value;
|
||||
if (!isEqual) {
|
||||
updateColumnValue(val);
|
||||
} else {
|
||||
columns.value = updateColumns();
|
||||
}
|
||||
}, 50);
|
||||
common_vendor.watch(
|
||||
() => props.modelValue,
|
||||
(val, oldVal) => {
|
||||
if (val === oldVal)
|
||||
return;
|
||||
const value = correctValue(val);
|
||||
updateColumnValue(value);
|
||||
},
|
||||
{ deep: true, immediate: true }
|
||||
);
|
||||
common_vendor.watch(
|
||||
() => props.type,
|
||||
(target) => {
|
||||
const type = ["date", "year-month", "time", "datetime", "year"];
|
||||
if (type.indexOf(target) === -1) {
|
||||
common_vendor.index.__f__("error", "at uni_modules/wot-design-uni/components/wd-datetime-picker-view/wd-datetime-picker-view.vue:110", `type must be one of ${type}`);
|
||||
}
|
||||
},
|
||||
{ deep: true, immediate: true }
|
||||
);
|
||||
common_vendor.watch(
|
||||
[
|
||||
() => props.type,
|
||||
() => props.filter,
|
||||
() => props.formatter,
|
||||
() => props.columnFormatter,
|
||||
() => props.minDate,
|
||||
() => props.maxDate,
|
||||
() => props.minHour,
|
||||
() => props.maxHour,
|
||||
() => props.minMinute,
|
||||
() => props.maxMinute,
|
||||
() => props.minSecond,
|
||||
() => props.maxSecond,
|
||||
() => props.useSecond
|
||||
],
|
||||
() => {
|
||||
updateValue();
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
common_vendor.onBeforeMount(() => {
|
||||
created.value = true;
|
||||
const innerValue2 = correctValue(props.modelValue);
|
||||
updateColumnValue(innerValue2);
|
||||
});
|
||||
function onChange({ value }) {
|
||||
pickerValue.value = value;
|
||||
const result = updateInnerValue();
|
||||
emit("update:modelValue", result);
|
||||
emit("change", {
|
||||
value: result,
|
||||
picker: proxy.$.exposed
|
||||
});
|
||||
}
|
||||
function updateColumns() {
|
||||
const { formatter, columnFormatter } = props;
|
||||
if (columnFormatter) {
|
||||
return columnFormatter(proxy.$.exposed);
|
||||
} else {
|
||||
return getOriginColumns().map((column) => {
|
||||
return column.values.map((value) => {
|
||||
return {
|
||||
label: formatter ? formatter(column.type, uni_modules_wotDesignUni_components_common_util.padZero(value)) : uni_modules_wotDesignUni_components_common_util.padZero(value),
|
||||
value
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
function setColumns(columnList) {
|
||||
columns.value = columnList;
|
||||
}
|
||||
function getOriginColumns() {
|
||||
const { filter } = props;
|
||||
return getRanges().map(({ type, range: range2 }) => {
|
||||
let values = times(range2[1] - range2[0] + 1, (index) => {
|
||||
return range2[0] + index;
|
||||
});
|
||||
if (filter) {
|
||||
values = filter(type, values);
|
||||
}
|
||||
return {
|
||||
type,
|
||||
values
|
||||
};
|
||||
});
|
||||
}
|
||||
function getRanges() {
|
||||
if (props.type === "time") {
|
||||
const result2 = [
|
||||
{
|
||||
type: "hour",
|
||||
range: [props.minHour, props.maxHour]
|
||||
},
|
||||
{
|
||||
type: "minute",
|
||||
range: [props.minMinute, props.maxMinute]
|
||||
}
|
||||
];
|
||||
if (props.useSecond) {
|
||||
result2.push({
|
||||
type: "second",
|
||||
range: [props.minSecond, props.maxSecond]
|
||||
});
|
||||
}
|
||||
return result2;
|
||||
}
|
||||
const { maxYear, maxDate, maxMonth, maxHour, maxMinute, maxSecond } = getBoundary("max", innerValue.value);
|
||||
const { minYear, minDate, minMonth, minHour, minMinute, minSecond } = getBoundary("min", innerValue.value);
|
||||
const result = [
|
||||
{
|
||||
type: "year",
|
||||
range: [minYear, maxYear]
|
||||
},
|
||||
{
|
||||
type: "month",
|
||||
range: [minMonth, maxMonth]
|
||||
},
|
||||
{
|
||||
type: "date",
|
||||
range: [minDate, maxDate]
|
||||
},
|
||||
{
|
||||
type: "hour",
|
||||
range: [minHour, maxHour]
|
||||
},
|
||||
{
|
||||
type: "minute",
|
||||
range: [minMinute, maxMinute]
|
||||
}
|
||||
];
|
||||
if (props.type === "datetime" && props.useSecond) {
|
||||
result.push({
|
||||
type: "second",
|
||||
range: [minSecond, maxSecond]
|
||||
});
|
||||
}
|
||||
if (props.type === "date")
|
||||
result.splice(3, 2);
|
||||
if (props.type === "year-month")
|
||||
result.splice(2, 3);
|
||||
if (props.type === "year")
|
||||
result.splice(1, 4);
|
||||
return result;
|
||||
}
|
||||
function correctValue(value) {
|
||||
const isDateType = props.type !== "time";
|
||||
if (isDateType && !isValidDate(value)) {
|
||||
value = props.minDate;
|
||||
} else if (!isDateType && !value) {
|
||||
value = props.useSecond ? `${uni_modules_wotDesignUni_components_common_util.padZero(props.minHour)}:00:00` : `${uni_modules_wotDesignUni_components_common_util.padZero(props.minHour)}:00`;
|
||||
}
|
||||
if (!isDateType) {
|
||||
let [hour, minute, second = "00"] = (uni_modules_wotDesignUni_components_common_util.isString(value) ? value : value.toString()).split(":");
|
||||
hour = uni_modules_wotDesignUni_components_common_util.padZero(uni_modules_wotDesignUni_components_common_util.range(Number(hour), props.minHour, props.maxHour));
|
||||
minute = uni_modules_wotDesignUni_components_common_util.padZero(uni_modules_wotDesignUni_components_common_util.range(Number(minute), props.minMinute, props.maxMinute));
|
||||
if (props.useSecond) {
|
||||
second = uni_modules_wotDesignUni_components_common_util.padZero(uni_modules_wotDesignUni_components_common_util.range(Number(second), props.minSecond, props.maxSecond));
|
||||
return `${hour}:${minute}:${second}`;
|
||||
}
|
||||
return `${hour}:${minute}`;
|
||||
}
|
||||
value = Math.min(Math.max(Number(value), props.minDate), props.maxDate);
|
||||
return value;
|
||||
}
|
||||
function getBoundary(type, innerValue2) {
|
||||
const value = new Date(innerValue2);
|
||||
const boundary = new Date(props[`${type}Date`]);
|
||||
const year = boundary.getFullYear();
|
||||
let month = 1;
|
||||
let date = 1;
|
||||
let hour = 0;
|
||||
let minute = 0;
|
||||
let second = 0;
|
||||
if (type === "max") {
|
||||
month = 12;
|
||||
date = getMonthEndDay(value.getFullYear(), value.getMonth() + 1);
|
||||
hour = 23;
|
||||
minute = 59;
|
||||
second = 59;
|
||||
}
|
||||
if (value.getFullYear() === year) {
|
||||
month = boundary.getMonth() + 1;
|
||||
if (value.getMonth() + 1 === month) {
|
||||
date = boundary.getDate();
|
||||
if (value.getDate() === date) {
|
||||
hour = boundary.getHours();
|
||||
if (value.getHours() === hour) {
|
||||
minute = boundary.getMinutes();
|
||||
if (value.getMinutes() === minute) {
|
||||
second = boundary.getSeconds();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
[`${type}Year`]: year,
|
||||
[`${type}Month`]: month,
|
||||
[`${type}Date`]: date,
|
||||
[`${type}Hour`]: hour,
|
||||
[`${type}Minute`]: minute,
|
||||
[`${type}Second`]: second
|
||||
};
|
||||
}
|
||||
function updateColumnValue(value) {
|
||||
const values = uni_modules_wotDesignUni_components_wdDatetimePickerView_util.getPickerValue(value, props.type, props.useSecond);
|
||||
if (props.modelValue !== value) {
|
||||
emit("update:modelValue", value);
|
||||
emit("change", {
|
||||
value,
|
||||
picker: proxy.$.exposed
|
||||
});
|
||||
}
|
||||
innerValue.value = value;
|
||||
columns.value = updateColumns();
|
||||
pickerValue.value = values;
|
||||
}
|
||||
function updateInnerValue() {
|
||||
var _a;
|
||||
const { type, useSecond } = props;
|
||||
let innerValue2 = "";
|
||||
const pickerVal = ((_a = datePickerview.value) == null ? void 0 : _a.getValues()) || [];
|
||||
const values = uni_modules_wotDesignUni_components_common_util.isArray(pickerVal) ? pickerVal : [pickerVal];
|
||||
if (type === "time") {
|
||||
if (useSecond) {
|
||||
innerValue2 = `${uni_modules_wotDesignUni_components_common_util.padZero(values[0])}:${uni_modules_wotDesignUni_components_common_util.padZero(values[1])}:${uni_modules_wotDesignUni_components_common_util.padZero(values[2])}`;
|
||||
} else {
|
||||
innerValue2 = `${uni_modules_wotDesignUni_components_common_util.padZero(values[0])}:${uni_modules_wotDesignUni_components_common_util.padZero(values[1])}`;
|
||||
}
|
||||
return innerValue2;
|
||||
}
|
||||
const year = values[0] && parseInt(values[0]);
|
||||
const month = type === "year" ? 1 : values[1] && parseInt(values[1]);
|
||||
const maxDate = getMonthEndDay(Number(year), Number(month));
|
||||
let date = 1;
|
||||
if (type !== "year-month" && type !== "year") {
|
||||
date = (Number(values[2]) && parseInt(String(values[2]))) > maxDate ? maxDate : values[2] && parseInt(String(values[2]));
|
||||
}
|
||||
let hour = 0;
|
||||
let minute = 0;
|
||||
let second = 0;
|
||||
if (type === "datetime") {
|
||||
hour = Number(values[3]) && parseInt(values[3]);
|
||||
minute = Number(values[4]) && parseInt(values[4]);
|
||||
if (useSecond) {
|
||||
second = Number(values[5]) && parseInt(values[5]);
|
||||
}
|
||||
}
|
||||
const value = new Date(Number(year), Number(month) - 1, Number(date), hour, minute, second).getTime();
|
||||
innerValue2 = correctValue(value);
|
||||
return innerValue2;
|
||||
}
|
||||
function columnChange(picker) {
|
||||
if (props.type === "time" || props.type === "year-month" || props.type === "year") {
|
||||
return;
|
||||
}
|
||||
const values = picker.getValues();
|
||||
const year = Number(values[0]);
|
||||
const month = Number(values[1]);
|
||||
const maxDate = getMonthEndDay(year, month);
|
||||
let date = Number(values[2]);
|
||||
date = date > maxDate ? maxDate : date;
|
||||
let hour = 0;
|
||||
let minute = 0;
|
||||
let second = 0;
|
||||
if (props.type === "datetime") {
|
||||
hour = Number(values[3]);
|
||||
minute = Number(values[4]);
|
||||
if (props.useSecond) {
|
||||
second = Number(values[5]);
|
||||
}
|
||||
}
|
||||
const value = new Date(year, month - 1, date, hour, minute, second).getTime();
|
||||
innerValue.value = correctValue(value);
|
||||
const newColumns = updateColumns();
|
||||
const selectedIndex = picker.getSelectedIndex().slice(0);
|
||||
newColumns.forEach((_columns, index) => {
|
||||
const nextColumnIndex = index + 1;
|
||||
const nextColumnData = newColumns[nextColumnIndex];
|
||||
if (nextColumnIndex > newColumns.length - 1)
|
||||
return;
|
||||
picker.setColumnData(
|
||||
nextColumnIndex,
|
||||
nextColumnData,
|
||||
selectedIndex[nextColumnIndex] <= nextColumnData.length - 1 ? selectedIndex[nextColumnIndex] : 0
|
||||
);
|
||||
});
|
||||
}
|
||||
function onPickStart() {
|
||||
emit("pickstart");
|
||||
}
|
||||
function onPickEnd() {
|
||||
emit("pickend");
|
||||
}
|
||||
function getSelects() {
|
||||
var _a;
|
||||
const pickerVal = (_a = datePickerview.value) == null ? void 0 : _a.getSelects();
|
||||
if (pickerVal == null)
|
||||
return void 0;
|
||||
if (uni_modules_wotDesignUni_components_common_util.isArray(pickerVal))
|
||||
return pickerVal;
|
||||
return [pickerVal];
|
||||
}
|
||||
__expose({
|
||||
updateColumns,
|
||||
setColumns,
|
||||
getSelects,
|
||||
correctValue,
|
||||
getOriginColumns
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return {
|
||||
a: common_vendor.sr(datePickerview, "a76d8a1e-0", {
|
||||
"k": "datePickerview"
|
||||
}),
|
||||
b: common_vendor.o(onChange),
|
||||
c: common_vendor.o(onPickStart),
|
||||
d: common_vendor.o(onPickEnd),
|
||||
e: common_vendor.o(($event) => pickerValue.value = $event),
|
||||
f: common_vendor.p({
|
||||
["custom-class"]: _ctx.customClass,
|
||||
["custom-style"]: _ctx.customStyle,
|
||||
["immediate-change"]: _ctx.immediateChange,
|
||||
columns: columns.value,
|
||||
["columns-height"]: _ctx.columnsHeight,
|
||||
["item-height"]: _ctx.itemHeight,
|
||||
columnChange,
|
||||
loading: _ctx.loading,
|
||||
["loading-color"]: _ctx.loadingColor,
|
||||
modelValue: pickerValue.value
|
||||
})
|
||||
};
|
||||
};
|
||||
}
|
||||
});
|
||||
wx.createComponent(_sfc_main);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-datetime-picker-view/wd-datetime-picker-view.js.map
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"wd-picker-view": "../wd-picker-view/wd-picker-view"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<wd-picker-view wx:if="{{f}}" class="r" u-r="datePickerview" bindchange="{{b}}" bindpickstart="{{c}}" bindpickend="{{d}}" u-i="a76d8a1e-0" bind:__l="__l" bindupdateModelValue="{{e}}" u-p="{{f}}"></wd-picker-view>
|
||||
199
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-datetime-picker/types.js
vendored
Normal file
199
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-datetime-picker/types.js
vendored
Normal file
@@ -0,0 +1,199 @@
|
||||
"use strict";
|
||||
const uni_modules_wotDesignUni_components_common_props = require("../common/props.js");
|
||||
const datetimePickerProps = {
|
||||
...uni_modules_wotDesignUni_components_common_props.baseProps,
|
||||
/**
|
||||
* 选择器左侧文案,label可以不传
|
||||
*/
|
||||
label: String,
|
||||
/**
|
||||
* 选择器占位符
|
||||
*/
|
||||
placeholder: String,
|
||||
/**
|
||||
* 禁用
|
||||
*/
|
||||
disabled: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 只读
|
||||
*/
|
||||
readonly: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 加载中
|
||||
*/
|
||||
loading: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 加载的颜色,只能使用十六进制的色值写法,且不能使用缩写
|
||||
*/
|
||||
loadingColor: uni_modules_wotDesignUni_components_common_props.makeStringProp("#4D80F0"),
|
||||
/**
|
||||
* 弹出层标题
|
||||
*/
|
||||
title: String,
|
||||
/**
|
||||
* 取消按钮文案
|
||||
*/
|
||||
cancelButtonText: String,
|
||||
/**
|
||||
* 确认按钮文案
|
||||
*/
|
||||
confirmButtonText: String,
|
||||
/**
|
||||
* 是否必填
|
||||
*/
|
||||
required: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 设置选择器大小,可选值:large
|
||||
*/
|
||||
size: String,
|
||||
/**
|
||||
* 设置左侧标题宽度
|
||||
*/
|
||||
labelWidth: uni_modules_wotDesignUni_components_common_props.makeStringProp("33%"),
|
||||
/**
|
||||
* 是否为错误状态,错误状态时右侧内容为红色
|
||||
*/
|
||||
error: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 选择器的值靠右展示
|
||||
*/
|
||||
alignRight: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 点击遮罩是否关闭
|
||||
*/
|
||||
closeOnClickModal: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(true),
|
||||
/**
|
||||
* 弹出面板是否设置底部安全距离(iphone X 类型的机型)
|
||||
*/
|
||||
safeAreaInsetBottom: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(true),
|
||||
/**
|
||||
* 是否超出隐藏
|
||||
*/
|
||||
ellipsis: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* picker内部滚筒高
|
||||
*/
|
||||
columnsHeight: uni_modules_wotDesignUni_components_common_props.makeNumberProp(217),
|
||||
/**
|
||||
* 选项的key
|
||||
*/
|
||||
valueKey: uni_modules_wotDesignUni_components_common_props.makeStringProp("value"),
|
||||
/**
|
||||
* 选项的label
|
||||
*/
|
||||
labelKey: uni_modules_wotDesignUni_components_common_props.makeStringProp("label"),
|
||||
/**
|
||||
* 选中项,当 type 为 time 时,类型为字符串;当 type 为 Array 时,类型为范围选择;否则为 时间戳
|
||||
*/
|
||||
modelValue: uni_modules_wotDesignUni_components_common_props.makeRequiredProp([String, Number, Array]),
|
||||
/**
|
||||
* 选择器类型,可选值为:date / year-month / time
|
||||
*/
|
||||
type: uni_modules_wotDesignUni_components_common_props.makeStringProp("datetime"),
|
||||
/**
|
||||
* 最小日期
|
||||
*/
|
||||
minDate: uni_modules_wotDesignUni_components_common_props.makeNumberProp(new Date((/* @__PURE__ */ new Date()).getFullYear() - 10, 0, 1).getTime()),
|
||||
/**
|
||||
* 最大日期
|
||||
*/
|
||||
maxDate: uni_modules_wotDesignUni_components_common_props.makeNumberProp(new Date((/* @__PURE__ */ new Date()).getFullYear() + 10, 11, 31, 23, 59, 59).getTime()),
|
||||
/**
|
||||
* 最小小时,time类型时生效
|
||||
*/
|
||||
minHour: uni_modules_wotDesignUni_components_common_props.makeNumberProp(0),
|
||||
/**
|
||||
* 最大小时,time类型时生效
|
||||
*/
|
||||
maxHour: uni_modules_wotDesignUni_components_common_props.makeNumberProp(23),
|
||||
/**
|
||||
* 最小分钟,time类型时生效
|
||||
*/
|
||||
minMinute: uni_modules_wotDesignUni_components_common_props.makeNumberProp(0),
|
||||
/**
|
||||
* 最大分钟,time类型时生效
|
||||
*/
|
||||
maxMinute: uni_modules_wotDesignUni_components_common_props.makeNumberProp(59),
|
||||
/**
|
||||
* 是否启用秒选择,仅在 time 和 datetime 类型下生效
|
||||
*/
|
||||
useSecond: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 最小秒数,仅在 time 和 datetime 类型下生效
|
||||
*/
|
||||
minSecond: uni_modules_wotDesignUni_components_common_props.makeNumberProp(0),
|
||||
/**
|
||||
* 最大秒数,仅在 time 和 datetime 类型下生效
|
||||
*/
|
||||
maxSecond: uni_modules_wotDesignUni_components_common_props.makeNumberProp(59),
|
||||
/**
|
||||
* 自定义过滤选项的函数,返回列的选项数组
|
||||
*/
|
||||
filter: Function,
|
||||
/**
|
||||
* 自定义弹出层选项文案的格式化函数,返回一个字符串
|
||||
*/
|
||||
formatter: Function,
|
||||
/**
|
||||
* 自定义展示文案的格式化函数,返回一个字符串
|
||||
*/
|
||||
displayFormat: Function,
|
||||
/**
|
||||
* 确定前校验函数,接收 (value, resolve, picker) 参数,通过 resolve 继续执行 picker,resolve 接收1个boolean参数
|
||||
*/
|
||||
beforeConfirm: Function,
|
||||
/**
|
||||
* 在区域选择模式下,自定义展示tab标签文案的格式化函数,返回一个字符串
|
||||
*/
|
||||
displayFormatTabLabel: Function,
|
||||
/**
|
||||
* 默认日期,类型保持与 value 一致,打开面板时面板自动选到默认日期
|
||||
*/
|
||||
defaultValue: [String, Number, Array],
|
||||
/**
|
||||
* 弹窗层级
|
||||
*/
|
||||
zIndex: uni_modules_wotDesignUni_components_common_props.makeNumberProp(15),
|
||||
/**
|
||||
* 表单域 model 字段名,在使用表单校验功能的情况下,该属性是必填的
|
||||
*/
|
||||
prop: String,
|
||||
/**
|
||||
* 表单验证规则,结合wd-form组件使用
|
||||
*/
|
||||
rules: uni_modules_wotDesignUni_components_common_props.makeArrayProp(),
|
||||
/**
|
||||
* picker cell 外部自定义样式
|
||||
*/
|
||||
customCellClass: uni_modules_wotDesignUni_components_common_props.makeStringProp(""),
|
||||
/**
|
||||
* pickerView 外部自定义样式
|
||||
*/
|
||||
customViewClass: uni_modules_wotDesignUni_components_common_props.makeStringProp(""),
|
||||
/**
|
||||
* label 外部自定义样式
|
||||
*/
|
||||
customLabelClass: uni_modules_wotDesignUni_components_common_props.makeStringProp(""),
|
||||
/**
|
||||
* value 外部自定义样式
|
||||
*/
|
||||
customValueClass: uni_modules_wotDesignUni_components_common_props.makeStringProp(""),
|
||||
/**
|
||||
* 是否在手指松开时立即触发picker-view的 change 事件。若不开启则会在滚动动画结束后触发 change 事件,1.2.25版本起提供,仅微信小程序和支付宝小程序支持。
|
||||
*/
|
||||
immediateChange: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 是否从页面中脱离出来,用于解决各种 fixed 失效问题 (H5: teleport, APP: renderjs, 小程序: root-portal)
|
||||
*/
|
||||
rootPortal: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 显示清空按钮
|
||||
*/
|
||||
clearable: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 必填标记位置,可选值:before、after
|
||||
*/
|
||||
markerSide: uni_modules_wotDesignUni_components_common_props.makeStringProp("before")
|
||||
};
|
||||
exports.datetimePickerProps = datetimePickerProps;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-datetime-picker/types.js.map
|
||||
@@ -0,0 +1,664 @@
|
||||
"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_useTranslate = require("../composables/useTranslate.js");
|
||||
const uni_modules_wotDesignUni_components_wdDatetimePicker_types = require("./types.js");
|
||||
const uni_modules_wotDesignUni_dayjs_index = require("../../dayjs/index.js");
|
||||
const uni_modules_wotDesignUni_components_wdDatetimePickerView_util = require("../wd-datetime-picker-view/util.js");
|
||||
if (!Math) {
|
||||
(wdIcon + wdCell + wdDatetimePickerView + wdPopup)();
|
||||
}
|
||||
const wdPopup = () => "../wd-popup/wd-popup.js";
|
||||
const wdDatetimePickerView = () => "../wd-datetime-picker-view/wd-datetime-picker-view.js";
|
||||
const wdCell = () => "../wd-cell/wd-cell.js";
|
||||
const wdIcon = () => "../wd-icon/wd-icon.js";
|
||||
const __default__ = {
|
||||
name: "wd-datetime-picker",
|
||||
options: {
|
||||
virtualHost: true,
|
||||
addGlobalClass: true,
|
||||
styleIsolation: "shared"
|
||||
}
|
||||
};
|
||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
...__default__,
|
||||
props: uni_modules_wotDesignUni_components_wdDatetimePicker_types.datetimePickerProps,
|
||||
emits: ["change", "open", "toggle", "cancel", "confirm", "clear", "update:modelValue", "close"],
|
||||
setup(__props, { expose: __expose, emit: __emit }) {
|
||||
const props = __props;
|
||||
const emit = __emit;
|
||||
const { translate } = uni_modules_wotDesignUni_components_composables_useTranslate.useTranslate("datetime-picker");
|
||||
const datetimePickerView = common_vendor.ref();
|
||||
const datetimePickerView1 = common_vendor.ref();
|
||||
const showValue = common_vendor.ref("");
|
||||
const popupShow = common_vendor.ref(false);
|
||||
const showStart = common_vendor.ref(true);
|
||||
const region = common_vendor.ref(false);
|
||||
const showTabLabel = common_vendor.ref([]);
|
||||
const innerValue = common_vendor.ref("");
|
||||
const endInnerValue = common_vendor.ref("");
|
||||
const isPicking = common_vendor.ref(false);
|
||||
const hasConfirmed = common_vendor.ref(false);
|
||||
const isLoading = common_vendor.ref(false);
|
||||
const { proxy } = common_vendor.getCurrentInstance();
|
||||
const cellClass = common_vendor.computed(() => {
|
||||
const classes = ["wd-datetime-picker__cell"];
|
||||
if (props.disabled)
|
||||
classes.push("is-disabled");
|
||||
if (props.readonly)
|
||||
classes.push("is-readonly");
|
||||
if (props.error)
|
||||
classes.push("is-error");
|
||||
return classes.join(" ");
|
||||
});
|
||||
common_vendor.watch(
|
||||
() => props.modelValue,
|
||||
(val, oldVal) => {
|
||||
if (uni_modules_wotDesignUni_components_common_util.isEqual(val, oldVal))
|
||||
return;
|
||||
if (uni_modules_wotDesignUni_components_common_util.isArray(val)) {
|
||||
region.value = true;
|
||||
innerValue.value = uni_modules_wotDesignUni_components_common_util.deepClone(getDefaultInnerValue(true));
|
||||
endInnerValue.value = uni_modules_wotDesignUni_components_common_util.deepClone(getDefaultInnerValue(true, true));
|
||||
} else {
|
||||
innerValue.value = uni_modules_wotDesignUni_components_common_util.deepClone(getDefaultInnerValue());
|
||||
}
|
||||
common_vendor.nextTick$1(() => {
|
||||
setShowValue(false, false, true);
|
||||
});
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
common_vendor.watch(
|
||||
() => props.displayFormat,
|
||||
(fn) => {
|
||||
if (fn && !uni_modules_wotDesignUni_components_common_util.isFunction(fn)) {
|
||||
common_vendor.index.__f__("error", "at uni_modules/wot-design-uni/components/wd-datetime-picker/wd-datetime-picker.vue:236", "The type of displayFormat must be Function");
|
||||
}
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
common_vendor.watch(
|
||||
() => props.filter,
|
||||
(fn) => {
|
||||
if (fn && !uni_modules_wotDesignUni_components_common_util.isFunction(fn)) {
|
||||
common_vendor.index.__f__("error", "at uni_modules/wot-design-uni/components/wd-datetime-picker/wd-datetime-picker.vue:248", "The type of filter must be Function");
|
||||
}
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
common_vendor.watch(
|
||||
() => props.formatter,
|
||||
(fn) => {
|
||||
if (fn && !uni_modules_wotDesignUni_components_common_util.isFunction(fn)) {
|
||||
common_vendor.index.__f__("error", "at uni_modules/wot-design-uni/components/wd-datetime-picker/wd-datetime-picker.vue:260", "The type of formatter must be Function");
|
||||
}
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
common_vendor.watch(
|
||||
() => props.beforeConfirm,
|
||||
(fn) => {
|
||||
if (fn && !uni_modules_wotDesignUni_components_common_util.isFunction(fn)) {
|
||||
common_vendor.index.__f__("error", "at uni_modules/wot-design-uni/components/wd-datetime-picker/wd-datetime-picker.vue:272", "The type of beforeConfirm must be Function");
|
||||
}
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
common_vendor.watch(
|
||||
() => props.displayFormatTabLabel,
|
||||
(fn) => {
|
||||
if (fn && !uni_modules_wotDesignUni_components_common_util.isFunction(fn)) {
|
||||
common_vendor.index.__f__("error", "at uni_modules/wot-design-uni/components/wd-datetime-picker/wd-datetime-picker.vue:284", "The type of displayFormatTabLabel must be Function");
|
||||
}
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
common_vendor.watch(
|
||||
() => props.defaultValue,
|
||||
(val) => {
|
||||
if (uni_modules_wotDesignUni_components_common_util.isArray(val) || region.value) {
|
||||
innerValue.value = uni_modules_wotDesignUni_components_common_util.deepClone(getDefaultInnerValue(true));
|
||||
endInnerValue.value = uni_modules_wotDesignUni_components_common_util.deepClone(getDefaultInnerValue(true, true));
|
||||
} else {
|
||||
innerValue.value = uni_modules_wotDesignUni_components_common_util.deepClone(getDefaultInnerValue());
|
||||
}
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
const showClear = common_vendor.computed(() => {
|
||||
return props.clearable && !props.disabled && !props.readonly && (!uni_modules_wotDesignUni_components_common_util.isArray(showValue.value) && showValue.value || uni_modules_wotDesignUni_components_common_util.isArray(showValue.value) && (showValue.value[0] || showValue.value[1]));
|
||||
});
|
||||
const showArrow = common_vendor.computed(() => {
|
||||
return !props.disabled && !props.readonly && !showClear.value;
|
||||
});
|
||||
function handleBoundaryValue(isStart, columnType, value, currentArray, boundary) {
|
||||
const { type, useSecond } = props;
|
||||
switch (type) {
|
||||
case "datetime": {
|
||||
const [year, month, date, hour, minute, second] = boundary;
|
||||
if (columnType === "year") {
|
||||
return isStart ? value > year : value < year;
|
||||
}
|
||||
if (columnType === "month" && currentArray[0] === year) {
|
||||
return isStart ? value > month : value < month;
|
||||
}
|
||||
if (columnType === "date" && currentArray[0] === year && currentArray[1] === month) {
|
||||
return isStart ? value > date : value < date;
|
||||
}
|
||||
if (columnType === "hour" && currentArray[0] === year && currentArray[1] === month && currentArray[2] === date) {
|
||||
return isStart ? value > hour : value < hour;
|
||||
}
|
||||
if (columnType === "minute" && currentArray[0] === year && currentArray[1] === month && currentArray[2] === date && currentArray[3] === hour) {
|
||||
return isStart ? value > minute : value < minute;
|
||||
}
|
||||
if (useSecond && columnType === "second" && currentArray[0] === year && currentArray[1] === month && currentArray[2] === date && currentArray[3] === hour && currentArray[4] === minute) {
|
||||
return isStart ? value > second : value < second;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "year-month": {
|
||||
const [year, month] = boundary;
|
||||
if (columnType === "year") {
|
||||
return isStart ? value > year : value < year;
|
||||
}
|
||||
if (columnType === "month" && currentArray[0] === year) {
|
||||
return isStart ? value > month : value < month;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "year": {
|
||||
const [year] = boundary;
|
||||
if (columnType === "year") {
|
||||
return isStart ? value > year : value < year;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "date": {
|
||||
const [year, month, date] = boundary;
|
||||
if (columnType === "year") {
|
||||
return isStart ? value > year : value < year;
|
||||
}
|
||||
if (columnType === "month" && currentArray[0] === year) {
|
||||
return isStart ? value > month : value < month;
|
||||
}
|
||||
if (columnType === "date" && currentArray[0] === year && currentArray[1] === month) {
|
||||
return isStart ? value > date : value < date;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "time": {
|
||||
const [hour, minute, second] = boundary;
|
||||
if (columnType === "hour") {
|
||||
return isStart ? value > hour : value < hour;
|
||||
}
|
||||
if (columnType === "minute" && currentArray[0] === hour) {
|
||||
return isStart ? value > minute : value < minute;
|
||||
}
|
||||
if (useSecond && columnType === "second" && currentArray[0] === hour && currentArray[1] === minute) {
|
||||
return isStart ? value > second : value < second;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function startColumnFormatter(picker) {
|
||||
return customColumnFormatter(picker, "start");
|
||||
}
|
||||
function endColumnFormatter(picker) {
|
||||
return customColumnFormatter(picker, "end");
|
||||
}
|
||||
const customColumnFormatter = (picker, pickerType) => {
|
||||
if (!picker)
|
||||
return [];
|
||||
const { type } = props;
|
||||
const startSymbol = pickerType === "start";
|
||||
const { formatter } = props;
|
||||
const start = picker.correctValue(innerValue.value);
|
||||
const end = picker.correctValue(endInnerValue.value);
|
||||
const currentValue = startSymbol ? uni_modules_wotDesignUni_components_wdDatetimePickerView_util.getPickerValue(start, type, props.useSecond) : uni_modules_wotDesignUni_components_wdDatetimePickerView_util.getPickerValue(end, type, props.useSecond);
|
||||
const boundary = startSymbol ? uni_modules_wotDesignUni_components_wdDatetimePickerView_util.getPickerValue(end, type, props.useSecond) : uni_modules_wotDesignUni_components_wdDatetimePickerView_util.getPickerValue(start, type, props.useSecond);
|
||||
const columns = picker.getOriginColumns();
|
||||
return columns.map((column, _) => {
|
||||
return column.values.map((value) => {
|
||||
const disabled = handleBoundaryValue(startSymbol, column.type, value, currentValue, boundary);
|
||||
return {
|
||||
label: formatter ? formatter(column.type, uni_modules_wotDesignUni_components_common_util.padZero(value)) : uni_modules_wotDesignUni_components_common_util.padZero(value),
|
||||
value,
|
||||
disabled
|
||||
};
|
||||
});
|
||||
});
|
||||
};
|
||||
common_vendor.onBeforeMount(() => {
|
||||
const { modelValue: value } = props;
|
||||
if (uni_modules_wotDesignUni_components_common_util.isArray(value)) {
|
||||
region.value = true;
|
||||
innerValue.value = uni_modules_wotDesignUni_components_common_util.deepClone(getDefaultInnerValue(true));
|
||||
endInnerValue.value = uni_modules_wotDesignUni_components_common_util.deepClone(getDefaultInnerValue(true, true));
|
||||
} else {
|
||||
innerValue.value = uni_modules_wotDesignUni_components_common_util.deepClone(getDefaultInnerValue());
|
||||
}
|
||||
});
|
||||
common_vendor.onMounted(() => {
|
||||
setShowValue(false, false, true);
|
||||
});
|
||||
function getSelects(picker) {
|
||||
let value = picker === "before" ? innerValue.value : endInnerValue.value;
|
||||
let selected = [];
|
||||
if (value) {
|
||||
selected = uni_modules_wotDesignUni_components_wdDatetimePickerView_util.getPickerValue(value, props.type, props.useSecond);
|
||||
}
|
||||
let selects = selected.map((value2) => {
|
||||
return {
|
||||
[props.labelKey]: uni_modules_wotDesignUni_components_common_util.padZero(value2),
|
||||
[props.valueKey]: value2
|
||||
};
|
||||
});
|
||||
return selects;
|
||||
}
|
||||
function noop() {
|
||||
}
|
||||
function getDefaultInnerValue(isRegion, isEnd) {
|
||||
const { modelValue: value, defaultValue, maxDate, minDate, type } = props;
|
||||
if (isRegion) {
|
||||
const index = isEnd ? 1 : 0;
|
||||
const targetValue = uni_modules_wotDesignUni_components_common_util.isArray(value) ? value[index] : "";
|
||||
const targetDefault = uni_modules_wotDesignUni_components_common_util.isArray(defaultValue) ? defaultValue[index] : "";
|
||||
const maxValue = type === "time" ? uni_modules_wotDesignUni_dayjs_index.dayjs(maxDate).format("HH:mm") : maxDate;
|
||||
const minValue = type === "time" ? uni_modules_wotDesignUni_dayjs_index.dayjs(minDate).format("HH:mm") : minDate;
|
||||
return targetValue || targetDefault || (isEnd ? maxValue : minValue);
|
||||
} else {
|
||||
return uni_modules_wotDesignUni_components_common_util.isDef(value || defaultValue) ? value || defaultValue : "";
|
||||
}
|
||||
}
|
||||
function open() {
|
||||
showPopup();
|
||||
}
|
||||
function close() {
|
||||
onCancel();
|
||||
}
|
||||
function showPopup() {
|
||||
if (props.disabled || props.readonly)
|
||||
return;
|
||||
emit("open");
|
||||
if (region.value) {
|
||||
popupShow.value = true;
|
||||
showStart.value = true;
|
||||
innerValue.value = uni_modules_wotDesignUni_components_common_util.deepClone(getDefaultInnerValue(true, false));
|
||||
endInnerValue.value = uni_modules_wotDesignUni_components_common_util.deepClone(getDefaultInnerValue(true, true));
|
||||
} else {
|
||||
popupShow.value = true;
|
||||
innerValue.value = uni_modules_wotDesignUni_components_common_util.deepClone(getDefaultInnerValue());
|
||||
}
|
||||
setShowValue(true, false, true);
|
||||
}
|
||||
function tabChange() {
|
||||
showStart.value = !showStart.value;
|
||||
const picker = showStart.value ? datetimePickerView.value : datetimePickerView1.value;
|
||||
picker.setColumns(picker.updateColumns());
|
||||
emit("toggle", showStart.value ? innerValue.value : endInnerValue.value);
|
||||
}
|
||||
function onChangeStart({ value }) {
|
||||
if (!datetimePickerView.value)
|
||||
return;
|
||||
if (region.value && !datetimePickerView1.value)
|
||||
return;
|
||||
if (region.value) {
|
||||
const currentArray = uni_modules_wotDesignUni_components_wdDatetimePickerView_util.getPickerValue(value, props.type, props.useSecond);
|
||||
const boundaryArray = uni_modules_wotDesignUni_components_wdDatetimePickerView_util.getPickerValue(endInnerValue.value, props.type, props.useSecond);
|
||||
const columns = datetimePickerView.value.getOriginColumns();
|
||||
const needsAdjust = columns.some((column, index) => {
|
||||
return handleBoundaryValue(true, column.type, currentArray[index], currentArray, boundaryArray);
|
||||
});
|
||||
innerValue.value = uni_modules_wotDesignUni_components_common_util.deepClone(needsAdjust ? endInnerValue.value : value);
|
||||
common_vendor.nextTick$1(() => {
|
||||
showTabLabel.value = [setTabLabel(), uni_modules_wotDesignUni_components_common_util.deepClone(showTabLabel.value[1])];
|
||||
emit("change", {
|
||||
value: [innerValue.value, endInnerValue.value]
|
||||
});
|
||||
datetimePickerView.value && datetimePickerView.value.setColumns(datetimePickerView.value.updateColumns());
|
||||
datetimePickerView1.value && datetimePickerView1.value.setColumns(datetimePickerView1.value.updateColumns());
|
||||
});
|
||||
} else {
|
||||
innerValue.value = uni_modules_wotDesignUni_components_common_util.deepClone(value);
|
||||
emit("change", {
|
||||
value: innerValue.value
|
||||
});
|
||||
}
|
||||
}
|
||||
function onChangeEnd({ value }) {
|
||||
if (!datetimePickerView.value || !datetimePickerView1.value)
|
||||
return;
|
||||
const currentArray = uni_modules_wotDesignUni_components_wdDatetimePickerView_util.getPickerValue(value, props.type);
|
||||
const boundaryArray = uni_modules_wotDesignUni_components_wdDatetimePickerView_util.getPickerValue(innerValue.value, props.type);
|
||||
const columns = datetimePickerView1.value.getOriginColumns();
|
||||
const needsAdjust = columns.some((column, index) => {
|
||||
return handleBoundaryValue(false, column.type, currentArray[index], currentArray, boundaryArray);
|
||||
});
|
||||
endInnerValue.value = uni_modules_wotDesignUni_components_common_util.deepClone(needsAdjust ? innerValue.value : value);
|
||||
common_vendor.nextTick$1(() => {
|
||||
showTabLabel.value = [uni_modules_wotDesignUni_components_common_util.deepClone(showTabLabel.value[0]), setTabLabel(1)];
|
||||
emit("change", {
|
||||
value: [innerValue.value, endInnerValue.value]
|
||||
});
|
||||
datetimePickerView.value && datetimePickerView.value.setColumns(datetimePickerView.value.updateColumns());
|
||||
datetimePickerView1.value && datetimePickerView1.value.setColumns(datetimePickerView1.value.updateColumns());
|
||||
});
|
||||
}
|
||||
function onCancel() {
|
||||
popupShow.value = false;
|
||||
emit("close");
|
||||
setTimeout(() => {
|
||||
if (region.value) {
|
||||
innerValue.value = uni_modules_wotDesignUni_components_common_util.deepClone(getDefaultInnerValue(true));
|
||||
endInnerValue.value = uni_modules_wotDesignUni_components_common_util.deepClone(getDefaultInnerValue(true, true));
|
||||
} else {
|
||||
innerValue.value = uni_modules_wotDesignUni_components_common_util.deepClone(getDefaultInnerValue());
|
||||
}
|
||||
}, 200);
|
||||
emit("cancel");
|
||||
}
|
||||
function onConfirm() {
|
||||
if (props.loading || isLoading.value)
|
||||
return;
|
||||
if (isPicking.value) {
|
||||
hasConfirmed.value = true;
|
||||
return;
|
||||
}
|
||||
const { beforeConfirm } = props;
|
||||
if (beforeConfirm) {
|
||||
beforeConfirm(
|
||||
region.value ? [innerValue.value, endInnerValue.value] : innerValue.value,
|
||||
(isPass) => {
|
||||
isPass && handleConfirm();
|
||||
},
|
||||
proxy.$.exposed
|
||||
);
|
||||
} else {
|
||||
handleConfirm();
|
||||
}
|
||||
}
|
||||
function onPickStart() {
|
||||
isPicking.value = true;
|
||||
}
|
||||
function onPickEnd() {
|
||||
isPicking.value = false;
|
||||
setTimeout(() => {
|
||||
if (hasConfirmed.value) {
|
||||
hasConfirmed.value = false;
|
||||
onConfirm();
|
||||
}
|
||||
}, 50);
|
||||
}
|
||||
function handleConfirm() {
|
||||
if (props.loading || isLoading.value || props.disabled) {
|
||||
popupShow.value = false;
|
||||
emit("close");
|
||||
return;
|
||||
}
|
||||
const value = region.value ? [innerValue.value, endInnerValue.value] : innerValue.value;
|
||||
popupShow.value = false;
|
||||
emit("close");
|
||||
emit("update:modelValue", value);
|
||||
emit("confirm", {
|
||||
value
|
||||
});
|
||||
setShowValue(false, true);
|
||||
}
|
||||
function setTabLabel(index = 0) {
|
||||
if (region.value) {
|
||||
let items = [];
|
||||
if (index === 0) {
|
||||
items = (datetimePickerView.value ? datetimePickerView.value.getSelects() : void 0) || innerValue.value && getSelects("before");
|
||||
} else {
|
||||
items = (datetimePickerView1.value ? datetimePickerView1.value.getSelects() : void 0) || endInnerValue.value && getSelects("after");
|
||||
}
|
||||
return defaultDisplayFormat(items, true);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
function setShowValue(tab = false, isConfirm = false, beforeMount = false) {
|
||||
if (region.value) {
|
||||
const items = beforeMount ? innerValue.value && getSelects("before") || [] : datetimePickerView.value && datetimePickerView.value.getSelects && datetimePickerView.value.getSelects() || [];
|
||||
const endItems = beforeMount ? endInnerValue.value && getSelects("after") || [] : datetimePickerView1.value && datetimePickerView1.value.getSelects && datetimePickerView1.value.getSelects() || [];
|
||||
showValue.value = tab ? showValue.value : [
|
||||
props.modelValue[0] || isConfirm ? defaultDisplayFormat(items) : "",
|
||||
props.modelValue[1] || isConfirm ? defaultDisplayFormat(endItems) : ""
|
||||
];
|
||||
showTabLabel.value = [defaultDisplayFormat(items, true), defaultDisplayFormat(endItems, true)];
|
||||
} else {
|
||||
const items = beforeMount ? innerValue.value && getSelects("before") || [] : datetimePickerView.value && datetimePickerView.value.getSelects && datetimePickerView.value.getSelects() || [];
|
||||
showValue.value = uni_modules_wotDesignUni_components_common_util.deepClone(props.modelValue || isConfirm ? defaultDisplayFormat(items) : "");
|
||||
}
|
||||
}
|
||||
function defaultDisplayFormat(items, tabLabel = false) {
|
||||
if (items.length === 0)
|
||||
return "";
|
||||
if (tabLabel && props.displayFormatTabLabel) {
|
||||
return props.displayFormatTabLabel(items);
|
||||
}
|
||||
if (props.displayFormat) {
|
||||
return props.displayFormat(items);
|
||||
}
|
||||
if (props.formatter) {
|
||||
const typeMaps = {
|
||||
year: ["year"],
|
||||
datetime: props.useSecond ? ["year", "month", "date", "hour", "minute", "second"] : ["year", "month", "date", "hour", "minute"],
|
||||
date: ["year", "month", "date"],
|
||||
time: props.useSecond ? ["hour", "minute", "second"] : ["hour", "minute"],
|
||||
"year-month": ["year", "month"]
|
||||
};
|
||||
return items.map((item, index) => {
|
||||
return props.formatter(typeMaps[props.type][index], item.value);
|
||||
}).join("");
|
||||
}
|
||||
switch (props.type) {
|
||||
case "year":
|
||||
return items[0].label;
|
||||
case "date":
|
||||
return `${items[0].label}-${items[1].label}-${items[2].label}`;
|
||||
case "year-month":
|
||||
return `${items[0].label}-${items[1].label}`;
|
||||
case "time":
|
||||
return props.useSecond ? `${items[0].label}:${items[1].label}:${items[2].label}` : `${items[0].label}:${items[1].label}`;
|
||||
case "datetime":
|
||||
return props.useSecond ? `${items[0].label}-${items[1].label}-${items[2].label} ${items[3].label}:${items[4].label}:${items[5].label}` : `${items[0].label}-${items[1].label}-${items[2].label} ${items[3].label}:${items[4].label}`;
|
||||
}
|
||||
}
|
||||
function setLoading(loading) {
|
||||
isLoading.value = loading;
|
||||
}
|
||||
function handleClear() {
|
||||
emit("clear");
|
||||
emit("update:modelValue", "");
|
||||
setShowValue(false, true);
|
||||
}
|
||||
__expose({
|
||||
open,
|
||||
close,
|
||||
setLoading
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: !_ctx.$slots.default
|
||||
}, !_ctx.$slots.default ? common_vendor.e({
|
||||
b: _ctx.$slots.label
|
||||
}, _ctx.$slots.label ? {} : {}, {
|
||||
c: region.value
|
||||
}, region.value ? common_vendor.e({
|
||||
d: common_vendor.unref(uni_modules_wotDesignUni_components_common_util.isArray)(showValue.value)
|
||||
}, common_vendor.unref(uni_modules_wotDesignUni_components_common_util.isArray)(showValue.value) ? {
|
||||
e: common_vendor.t(showValue.value[0] ? showValue.value[0] : _ctx.placeholder || common_vendor.unref(translate)("placeholder")),
|
||||
f: common_vendor.n(showValue.value[0] ? "" : "wd-datetime-picker__placeholder"),
|
||||
g: common_vendor.t(common_vendor.unref(translate)("to")),
|
||||
h: common_vendor.t(showValue.value[1] ? showValue.value[1] : _ctx.placeholder || common_vendor.unref(translate)("placeholder")),
|
||||
i: common_vendor.n(showValue.value[1] ? "" : "wd-datetime-picker__placeholder")
|
||||
} : {
|
||||
j: common_vendor.t(_ctx.placeholder || common_vendor.unref(translate)("placeholder"))
|
||||
}) : {
|
||||
k: common_vendor.t(showValue.value ? showValue.value : _ctx.placeholder || common_vendor.unref(translate)("placeholder")),
|
||||
l: common_vendor.n(showValue.value ? "" : "wd-datetime-picker__placeholder")
|
||||
}, {
|
||||
m: showArrow.value
|
||||
}, showArrow.value ? {
|
||||
n: common_vendor.p({
|
||||
["custom-class"]: "wd-datetime-picker__arrow",
|
||||
name: "arrow-right"
|
||||
})
|
||||
} : showClear.value ? {
|
||||
p: common_vendor.p({
|
||||
["custom-class"]: "wd-datetime-picker__clear",
|
||||
name: "error-fill"
|
||||
}),
|
||||
q: common_vendor.o(handleClear)
|
||||
} : {}, {
|
||||
o: showClear.value,
|
||||
r: common_vendor.o(showPopup),
|
||||
s: common_vendor.p({
|
||||
title: _ctx.label,
|
||||
required: _ctx.required,
|
||||
size: _ctx.size,
|
||||
["title-width"]: _ctx.labelWidth,
|
||||
prop: _ctx.prop,
|
||||
rules: _ctx.rules,
|
||||
clickable: !_ctx.disabled && !_ctx.readonly,
|
||||
["value-align"]: _ctx.alignRight ? "right" : "left",
|
||||
["custom-class"]: cellClass.value,
|
||||
["custom-style"]: _ctx.customStyle,
|
||||
["custom-title-class"]: _ctx.customLabelClass,
|
||||
["custom-value-class"]: _ctx.customValueClass,
|
||||
ellipsis: _ctx.ellipsis,
|
||||
["use-title-slot"]: !!_ctx.$slots.label,
|
||||
["marker-side"]: _ctx.markerSide
|
||||
})
|
||||
}) : {
|
||||
t: common_vendor.o(showPopup)
|
||||
}, {
|
||||
v: common_vendor.t(_ctx.cancelButtonText || common_vendor.unref(translate)("cancel")),
|
||||
w: common_vendor.o(onCancel),
|
||||
x: _ctx.title
|
||||
}, _ctx.title ? {
|
||||
y: common_vendor.t(_ctx.title)
|
||||
} : {}, {
|
||||
z: common_vendor.t(_ctx.confirmButtonText || common_vendor.unref(translate)("confirm")),
|
||||
A: common_vendor.n(`wd-datetime-picker__action ${_ctx.loading || isLoading.value ? "is-loading" : ""}`),
|
||||
B: common_vendor.o(onConfirm),
|
||||
C: common_vendor.o(noop),
|
||||
D: region.value
|
||||
}, region.value ? {
|
||||
E: common_vendor.t(common_vendor.unref(translate)("start")),
|
||||
F: common_vendor.t(showTabLabel.value[0]),
|
||||
G: common_vendor.n(`wd-datetime-picker__region ${showStart.value ? "is-active" : ""} `),
|
||||
H: common_vendor.o(tabChange),
|
||||
I: common_vendor.t(common_vendor.unref(translate)("end")),
|
||||
J: common_vendor.t(showTabLabel.value[1]),
|
||||
K: common_vendor.n(`wd-datetime-picker__region ${showStart.value ? "" : "is-active"}`),
|
||||
L: common_vendor.o(tabChange)
|
||||
} : {}, {
|
||||
M: common_vendor.sr(datetimePickerView, "2a8ca3bd-4,2a8ca3bd-3", {
|
||||
"k": "datetimePickerView"
|
||||
}),
|
||||
N: common_vendor.o(onChangeStart),
|
||||
O: common_vendor.o(onPickStart),
|
||||
P: common_vendor.o(onPickEnd),
|
||||
Q: common_vendor.o(($event) => innerValue.value = $event),
|
||||
R: common_vendor.p({
|
||||
["custom-class"]: _ctx.customViewClass,
|
||||
type: _ctx.type,
|
||||
loading: _ctx.loading || isLoading.value,
|
||||
["loading-color"]: _ctx.loadingColor,
|
||||
["columns-height"]: _ctx.columnsHeight,
|
||||
["value-key"]: _ctx.valueKey,
|
||||
["label-key"]: _ctx.labelKey,
|
||||
formatter: _ctx.formatter,
|
||||
filter: _ctx.filter,
|
||||
["column-formatter"]: common_vendor.unref(uni_modules_wotDesignUni_components_common_util.isArray)(_ctx.modelValue) ? startColumnFormatter : void 0,
|
||||
["max-hour"]: _ctx.maxHour,
|
||||
["min-hour"]: _ctx.minHour,
|
||||
["max-date"]: _ctx.maxDate,
|
||||
["min-date"]: _ctx.minDate,
|
||||
["max-minute"]: _ctx.maxMinute,
|
||||
["min-minute"]: _ctx.minMinute,
|
||||
["use-second"]: _ctx.useSecond,
|
||||
["min-second"]: _ctx.minSecond,
|
||||
["max-second"]: _ctx.maxSecond,
|
||||
["immediate-change"]: _ctx.immediateChange,
|
||||
modelValue: innerValue.value
|
||||
}),
|
||||
S: common_vendor.n(showStart.value ? "wd-datetime-picker__show" : "wd-datetime-picker__hidden"),
|
||||
T: common_vendor.sr(datetimePickerView1, "2a8ca3bd-5,2a8ca3bd-3", {
|
||||
"k": "datetimePickerView1"
|
||||
}),
|
||||
U: common_vendor.o(onChangeEnd),
|
||||
V: common_vendor.o(onPickStart),
|
||||
W: common_vendor.o(onPickEnd),
|
||||
X: common_vendor.o(($event) => endInnerValue.value = $event),
|
||||
Y: common_vendor.p({
|
||||
["custom-class"]: _ctx.customViewClass,
|
||||
type: _ctx.type,
|
||||
loading: _ctx.loading || isLoading.value,
|
||||
["loading-color"]: _ctx.loadingColor,
|
||||
["columns-height"]: _ctx.columnsHeight,
|
||||
["value-key"]: _ctx.valueKey,
|
||||
["label-key"]: _ctx.labelKey,
|
||||
formatter: _ctx.formatter,
|
||||
filter: _ctx.filter,
|
||||
["column-formatter"]: common_vendor.unref(uni_modules_wotDesignUni_components_common_util.isArray)(_ctx.modelValue) ? endColumnFormatter : void 0,
|
||||
["max-hour"]: _ctx.maxHour,
|
||||
["min-hour"]: _ctx.minHour,
|
||||
["max-date"]: _ctx.maxDate,
|
||||
["min-date"]: _ctx.minDate,
|
||||
["max-minute"]: _ctx.maxMinute,
|
||||
["min-minute"]: _ctx.minMinute,
|
||||
["use-second"]: _ctx.useSecond,
|
||||
["min-second"]: _ctx.minSecond,
|
||||
["max-second"]: _ctx.maxSecond,
|
||||
["immediate-change"]: _ctx.immediateChange,
|
||||
modelValue: endInnerValue.value
|
||||
}),
|
||||
Z: common_vendor.n(showStart.value ? "wd-datetime-picker__hidden" : "wd-datetime-picker__show"),
|
||||
aa: common_vendor.o(onCancel),
|
||||
ab: common_vendor.o(($event) => popupShow.value = $event),
|
||||
ac: common_vendor.p({
|
||||
position: "bottom",
|
||||
["hide-when-close"]: false,
|
||||
["close-on-click-modal"]: _ctx.closeOnClickModal,
|
||||
["safe-area-inset-bottom"]: _ctx.safeAreaInsetBottom,
|
||||
["z-index"]: _ctx.zIndex,
|
||||
["root-portal"]: _ctx.rootPortal,
|
||||
["custom-class"]: "wd-datetime-picker__popup",
|
||||
modelValue: popupShow.value
|
||||
}),
|
||||
ad: common_vendor.n(`wd-datetime-picker ${_ctx.customClass}`),
|
||||
ae: common_vendor.s(_ctx.customStyle)
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-2a8ca3bd"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-datetime-picker/wd-datetime-picker.js.map
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"wd-popup": "../wd-popup/wd-popup",
|
||||
"wd-datetime-picker-view": "../wd-datetime-picker-view/wd-datetime-picker-view",
|
||||
"wd-cell": "../wd-cell/wd-cell",
|
||||
"wd-icon": "../wd-icon/wd-icon"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<view class="{{['data-v-2a8ca3bd', ad]}}" style="{{ae}}"><wd-cell wx:if="{{a}}" class="data-v-2a8ca3bd" u-s="{{['title','d','right-icon']}}" bindclick="{{r}}" u-i="2a8ca3bd-0" bind:__l="__l" u-p="{{s}}"><view wx:if="{{b}}" slot="title"><slot name="label"></slot></view><view><block wx:if="{{c}}"><view wx:if="{{d}}" class="data-v-2a8ca3bd"><text class="{{['data-v-2a8ca3bd', f]}}">{{e}}</text> {{g}} <text class="{{['data-v-2a8ca3bd', i]}}">{{h}}</text></view><view wx:else class="wd-datetime-picker__cell-placeholder data-v-2a8ca3bd">{{j}}</view></block><view wx:else class="{{['data-v-2a8ca3bd', l]}}">{{k}}</view></view><view slot="right-icon"><wd-icon wx:if="{{m}}" class="data-v-2a8ca3bd" u-i="2a8ca3bd-1,2a8ca3bd-0" bind:__l="__l" u-p="{{n}}"/><view wx:elif="{{o}}" class="data-v-2a8ca3bd" catchtap="{{q}}"><wd-icon wx:if="{{p}}" class="data-v-2a8ca3bd" u-i="2a8ca3bd-2,2a8ca3bd-0" bind:__l="__l" u-p="{{p}}"/></view></view></wd-cell><view wx:else class="data-v-2a8ca3bd" bindtap="{{t}}"><slot></slot></view><wd-popup wx:if="{{ac}}" class="data-v-2a8ca3bd" u-s="{{['d']}}" bindclose="{{aa}}" u-i="2a8ca3bd-3" bind:__l="__l" bindupdateModelValue="{{ab}}" u-p="{{ac}}"><view class="wd-datetime-picker__wraper data-v-2a8ca3bd"><view class="wd-datetime-picker__toolbar data-v-2a8ca3bd" bindtouchmove="{{C}}"><view class="wd-datetime-picker__action wd-datetime-picker__action--cancel data-v-2a8ca3bd" bindtap="{{w}}">{{v}}</view><view wx:if="{{x}}" class="wd-datetime-picker__title data-v-2a8ca3bd">{{y}}</view><view class="{{['data-v-2a8ca3bd', A]}}" bindtap="{{B}}">{{z}}</view></view><view wx:if="{{D}}" class="wd-datetime-picker__region-tabs data-v-2a8ca3bd"><view class="{{['data-v-2a8ca3bd', G]}}" bindtap="{{H}}"><view class="data-v-2a8ca3bd">{{E}}</view><view class="wd-datetime-picker__region-time data-v-2a8ca3bd">{{F}}</view></view><view class="{{['data-v-2a8ca3bd', K]}}" bindtap="{{L}}"><view class="data-v-2a8ca3bd">{{I}}</view><view class="wd-datetime-picker__region-time data-v-2a8ca3bd">{{J}}</view></view></view><view class="{{['data-v-2a8ca3bd', S]}}"><wd-datetime-picker-view wx:if="{{R}}" class="r data-v-2a8ca3bd" u-r="datetimePickerView" bindchange="{{N}}" bindpickstart="{{O}}" bindpickend="{{P}}" u-i="2a8ca3bd-4,2a8ca3bd-3" bind:__l="__l" bindupdateModelValue="{{Q}}" u-p="{{R}}"/></view><view class="{{['data-v-2a8ca3bd', Z]}}"><wd-datetime-picker-view wx:if="{{Y}}" class="r data-v-2a8ca3bd" u-r="datetimePickerView1" bindchange="{{U}}" bindpickstart="{{V}}" bindpickend="{{W}}" u-i="2a8ca3bd-5,2a8ca3bd-3" bind:__l="__l" bindupdateModelValue="{{X}}" u-p="{{Y}}"/></view></view></wd-popup></view>
|
||||
@@ -0,0 +1,289 @@
|
||||
/* 水平间距 */
|
||||
/* 水平间距 */
|
||||
/**
|
||||
* 混合宏
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/**
|
||||
* 辅助函数
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/* 转换成字符串 */
|
||||
/* 判断是否存在 Modifier */
|
||||
/* 判断是否存在伪类 */
|
||||
/**
|
||||
* 主题色切换
|
||||
* @params $theme-color 主题色
|
||||
* @params $type 变暗’dark‘ 变亮 'light'
|
||||
* @params $mix-color 自己设置的混色
|
||||
*/
|
||||
/**
|
||||
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
|
||||
* @params $open-linear 是否开启线性渐变色
|
||||
* @params $deg 渐变色角度
|
||||
* @params $theme-color 当前配色
|
||||
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
|
||||
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
|
||||
* @params [Array] $per-list 渐变色比例
|
||||
*/
|
||||
/**
|
||||
* BEM,定义块(b)
|
||||
*/
|
||||
/* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
|
||||
/* 此方法用于生成穿透样式 */
|
||||
/* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
|
||||
/* 定义状态(m) */
|
||||
/* 定义状态(m) */
|
||||
/* 对于需要需要嵌套在 m 底下的 e,调用这个混合宏,一般在切换整个组件的状态,如切换颜色的时候 */
|
||||
/* 状态,生成 is-$state 类名 */
|
||||
/**
|
||||
* 常用混合宏
|
||||
*/
|
||||
/* 单行超出隐藏 */
|
||||
/* 多行超出隐藏 */
|
||||
/* 清除浮动 */
|
||||
/* 0.5px 边框 指定方向*/
|
||||
/* 0.5px 边框 环绕 */
|
||||
/**
|
||||
* 三角形实现尖角样式,适用于背景透明情况
|
||||
* @param $size 三角形高,底边为 $size * 2
|
||||
* @param $bg 三角形背景颜色
|
||||
*/
|
||||
/**
|
||||
* 正方形实现尖角样式,适用于背景不透明情况
|
||||
* @param $size 正方形边长
|
||||
* @param $bg 正方形背景颜色
|
||||
* @param $z-index z-index属性值,不得大于外部包裹器
|
||||
* @param $box-shadow 阴影
|
||||
*/
|
||||
/**
|
||||
* 辅助函数
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/* 转换成字符串 */
|
||||
/* 判断是否存在 Modifier */
|
||||
/* 判断是否存在伪类 */
|
||||
/**
|
||||
* 主题色切换
|
||||
* @params $theme-color 主题色
|
||||
* @params $type 变暗’dark‘ 变亮 'light'
|
||||
* @params $mix-color 自己设置的混色
|
||||
*/
|
||||
/**
|
||||
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
|
||||
* @params $open-linear 是否开启线性渐变色
|
||||
* @params $deg 渐变色角度
|
||||
* @params $theme-color 当前配色
|
||||
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
|
||||
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
|
||||
* @params [Array] $per-list 渐变色比例
|
||||
*/
|
||||
/**
|
||||
* UI规范基础变量
|
||||
*/
|
||||
/*----------------------------------------- Theme color. start ----------------------------------------*/
|
||||
/* 主题颜色 */
|
||||
/* 辅助色 */
|
||||
/* 文字颜色(默认浅色背景下 */
|
||||
/* 暗黑模式 */
|
||||
/* 图形颜色 */
|
||||
/*----------------------------------------- Theme color. end -------------------------------------------*/
|
||||
/*-------------------------------- Theme color application size. start --------------------------------*/
|
||||
/* 文字字号 */
|
||||
/* 文字字重 */
|
||||
/* 尺寸 */
|
||||
/*-------------------------------- Theme color application size. end --------------------------------*/
|
||||
/* component var */
|
||||
/* action-sheet */
|
||||
/* badge */
|
||||
/* button */
|
||||
/* cell */
|
||||
/* calendar */
|
||||
/* checkbox */
|
||||
/* collapse */
|
||||
/* divider */
|
||||
/* drop-menu */
|
||||
/* input-number */
|
||||
/* input */
|
||||
/* textarea */
|
||||
/* loadmore */
|
||||
/* message-box */
|
||||
/* notice-bar */
|
||||
/* pagination */
|
||||
/* picker */
|
||||
/* col-picker */
|
||||
/* overlay */
|
||||
/* popup */
|
||||
/* progress */
|
||||
/* radio */
|
||||
/* search */
|
||||
/* slider */
|
||||
/* sort-button */
|
||||
/* steps */
|
||||
/* switch */
|
||||
/* tabs */
|
||||
/* tag */
|
||||
/* toast */
|
||||
/* loading */
|
||||
/* tooltip */
|
||||
/* popover */
|
||||
/* grid-item */
|
||||
/* statustip */
|
||||
/* card */
|
||||
/* upload */
|
||||
/* curtain */
|
||||
/* notify */
|
||||
/* skeleton */
|
||||
/* circle */
|
||||
/* swiper */
|
||||
/* swiper-nav */
|
||||
/* segmented */
|
||||
/* tabbar */
|
||||
/* tabbar-item */
|
||||
/* navbar */
|
||||
/* navbar-capsule */
|
||||
/* table */
|
||||
/* sidebar */
|
||||
/* sidebar-item */
|
||||
/* fab */
|
||||
/* count-down */
|
||||
/* keyboard */
|
||||
/* number-keyboard */
|
||||
/* passwod-input */
|
||||
/* form-item */
|
||||
/* backtop */
|
||||
/* index-bar */
|
||||
/* text */
|
||||
/* video-preview */
|
||||
/* img-cropper */
|
||||
/* floating-panel */
|
||||
/* signature */
|
||||
.wot-theme-dark .wd-datetime-picker__placeholder.data-v-2a8ca3bd {
|
||||
color: var(--wot-dark-color-gray, var(--wot-color-secondary, #595959));
|
||||
}
|
||||
.wot-theme-dark .wd-datetime-picker.data-v-2a8ca3bd .wd-datetime-picker__arrow,
|
||||
.wot-theme-dark .wd-datetime-picker.data-v-2a8ca3bd .wd-datetime-picker__clear {
|
||||
color: var(--wot-dark-color, var(--wot-color-white, white));
|
||||
}
|
||||
.wot-theme-dark .wd-datetime-picker__action--cancel.data-v-2a8ca3bd {
|
||||
color: var(--wot-dark-color, var(--wot-color-white, white));
|
||||
}
|
||||
.wot-theme-dark .wd-datetime-picker__region.data-v-2a8ca3bd {
|
||||
color: var(--wot-dark-color, var(--wot-color-white, white));
|
||||
}
|
||||
.wot-theme-dark .wd-datetime-picker__region.is-active.data-v-2a8ca3bd {
|
||||
background: var(--wot-picker-region-bg-active-color, var(--wot-color-theme, #4d80f0));
|
||||
color: var(--wot-dark-color, var(--wot-color-white, white));
|
||||
}
|
||||
.data-v-2a8ca3bd .wd-datetime-picker__cell.is-disabled .wd-cell__value {
|
||||
color: var(--wot-input-disabled-color, #d9d9d9);
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.data-v-2a8ca3bd .wd-datetime-picker__cell.is-error .wd-cell__value {
|
||||
color: var(--wot-input-error-color, var(--wot-color-danger, #fa4350));
|
||||
}
|
||||
.data-v-2a8ca3bd .wd-datetime-picker__cell.is-error .wd-datetime-picker__arrow {
|
||||
color: var(--wot-input-error-color, var(--wot-color-danger, #fa4350));
|
||||
}
|
||||
.data-v-2a8ca3bd .wd-datetime-picker__cell.is-large .wd-datetime-picker__arrow {
|
||||
font-size: var(--wot-cell-icon-size-large, 18px);
|
||||
}
|
||||
.data-v-2a8ca3bd .wd-datetime-picker__cell .wd-cell__value--ellipsis view {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
}
|
||||
.data-v-2a8ca3bd .wd-datetime-picker__cell .wd-cell__value--ellipsis text {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
max-width: 100%;
|
||||
}
|
||||
.wd-datetime-picker__placeholder.data-v-2a8ca3bd {
|
||||
color: var(--wot-input-placeholder-color, #bfbfbf);
|
||||
}
|
||||
.data-v-2a8ca3bd .wd-datetime-picker__arrow {
|
||||
display: block;
|
||||
font-size: var(--wot-cell-icon-size, 16px);
|
||||
color: var(--wot-cell-arrow-color, rgba(0, 0, 0, 0.25));
|
||||
line-height: var(--wot-cell-line-height, 24px);
|
||||
}
|
||||
.data-v-2a8ca3bd .wd-datetime-picker__clear {
|
||||
display: block;
|
||||
font-size: var(--wot-cell-icon-size, 16px);
|
||||
color: var(--wot-cell-clear-color, #585858);
|
||||
line-height: var(--wot-cell-line-height, 24px);
|
||||
}
|
||||
.data-v-2a8ca3bd .wd-datetime-picker__popup {
|
||||
border-radius: 16px 16px 0px 0px;
|
||||
}
|
||||
.wd-datetime-picker__wraper.data-v-2a8ca3bd {
|
||||
padding-bottom: var(--window-bottom);
|
||||
}
|
||||
.wd-datetime-picker__toolbar.data-v-2a8ca3bd {
|
||||
position: relative;
|
||||
display: flex;
|
||||
font-size: var(--wot-picker-toolbar-fs, var(--wot-fs-title, 16px));
|
||||
height: var(--wot-picker-toolbar-height, 54px);
|
||||
line-height: var(--wot-picker-action-height, 16px);
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.wd-datetime-picker__action.data-v-2a8ca3bd {
|
||||
display: block;
|
||||
border: none;
|
||||
outline: none;
|
||||
font-size: var(--wot-picker-toolbar-fs, var(--wot-fs-title, 16px));
|
||||
color: var(--wot-picker-toolbar-finish-color, var(--wot-color-theme, #4d80f0));
|
||||
background: transparent;
|
||||
padding: 24px 15px 14px 15px;
|
||||
}
|
||||
.wd-datetime-picker__action--cancel.data-v-2a8ca3bd {
|
||||
color: var(--wot-picker-toolbar-cancel-color, #666666);
|
||||
}
|
||||
.wd-datetime-picker__action.is-loading.data-v-2a8ca3bd {
|
||||
color: var(--wot-picker-loading-button-color, rgba(0, 0, 0, 0.25));
|
||||
}
|
||||
.wd-datetime-picker__title.data-v-2a8ca3bd {
|
||||
display: block;
|
||||
float: 1;
|
||||
color: var(--wot-picker-toolbar-title-color, rgba(0, 0, 0, 0.85));
|
||||
}
|
||||
.wd-datetime-picker__region-tabs.data-v-2a8ca3bd {
|
||||
display: flex;
|
||||
}
|
||||
.wd-datetime-picker__region.data-v-2a8ca3bd {
|
||||
width: 50%;
|
||||
display: inline-block;
|
||||
color: var(--wot-picker-region-color, rgba(0, 0, 0, 0.45));
|
||||
text-align: center;
|
||||
padding: 14px 0;
|
||||
font-size: var(--wot-picker-region-fs, 14px);
|
||||
line-height: 16px;
|
||||
transition: all 0.15s ease-out;
|
||||
}
|
||||
.wd-datetime-picker__region.is-active.data-v-2a8ca3bd {
|
||||
background: var(--wot-picker-region-bg-active-color, var(--wot-color-theme, #4d80f0));
|
||||
color: var(--wot-color-white, white);
|
||||
}
|
||||
.wd-datetime-picker__region-time.data-v-2a8ca3bd {
|
||||
font-size: 16px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
.wd-datetime-picker__hidden.data-v-2a8ca3bd {
|
||||
visibility: hidden;
|
||||
overflow: hidden;
|
||||
height: 0;
|
||||
}
|
||||
.wd-datetime-picker__show.data-v-2a8ca3bd {
|
||||
visibility: visible;
|
||||
height: auto;
|
||||
}
|
||||
4
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-form/types.js
vendored
Normal file
4
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-form/types.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
const FORM_KEY = Symbol("wd-form");
|
||||
exports.FORM_KEY = FORM_KEY;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-form/types.js.map
|
||||
23
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-icon/types.js
vendored
Normal file
23
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-icon/types.js
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
const uni_modules_wotDesignUni_components_common_props = require("../common/props.js");
|
||||
const iconProps = {
|
||||
...uni_modules_wotDesignUni_components_common_props.baseProps,
|
||||
/**
|
||||
* 使用的图标名字,可以使用链接图片
|
||||
*/
|
||||
name: uni_modules_wotDesignUni_components_common_props.makeRequiredProp(String),
|
||||
/**
|
||||
* 图标的颜色
|
||||
*/
|
||||
color: String,
|
||||
/**
|
||||
* 图标的字体大小
|
||||
*/
|
||||
size: uni_modules_wotDesignUni_components_common_props.numericProp,
|
||||
/**
|
||||
* 类名前缀,用于使用自定义图标
|
||||
*/
|
||||
classPrefix: uni_modules_wotDesignUni_components_common_props.makeStringProp("wd-icon")
|
||||
};
|
||||
exports.iconProps = iconProps;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-icon/types.js.map
|
||||
55
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-icon/wd-icon.js
vendored
Normal file
55
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-icon/wd-icon.js
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
"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_wdIcon_types = require("./types.js");
|
||||
const __default__ = {
|
||||
name: "wd-icon",
|
||||
options: {
|
||||
virtualHost: true,
|
||||
addGlobalClass: true,
|
||||
styleIsolation: "shared"
|
||||
}
|
||||
};
|
||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
...__default__,
|
||||
props: uni_modules_wotDesignUni_components_wdIcon_types.iconProps,
|
||||
emits: ["click", "touch"],
|
||||
setup(__props, { emit: __emit }) {
|
||||
const props = __props;
|
||||
const emit = __emit;
|
||||
const isImage = common_vendor.computed(() => {
|
||||
return uni_modules_wotDesignUni_components_common_util.isDef(props.name) && props.name.includes("/");
|
||||
});
|
||||
const rootClass = common_vendor.computed(() => {
|
||||
const prefix = props.classPrefix;
|
||||
return `${prefix} ${props.customClass} ${isImage.value ? "wd-icon--image" : prefix + "-" + props.name}`;
|
||||
});
|
||||
const rootStyle = common_vendor.computed(() => {
|
||||
const style = {};
|
||||
if (props.color) {
|
||||
style["color"] = props.color;
|
||||
}
|
||||
if (props.size) {
|
||||
style["font-size"] = uni_modules_wotDesignUni_components_common_util.addUnit(props.size);
|
||||
}
|
||||
return `${uni_modules_wotDesignUni_components_common_util.objToStyle(style)} ${props.customStyle}`;
|
||||
});
|
||||
function handleClick(event) {
|
||||
emit("click", event);
|
||||
}
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: isImage.value
|
||||
}, isImage.value ? {
|
||||
b: _ctx.name
|
||||
} : {}, {
|
||||
c: common_vendor.o(handleClick),
|
||||
d: common_vendor.n(rootClass.value),
|
||||
e: common_vendor.s(rootStyle.value)
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-24906af6"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-icon/wd-icon.js.map
|
||||
4
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-icon/wd-icon.json
vendored
Normal file
4
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-icon/wd-icon.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-icon/wd-icon.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-icon/wd-icon.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view bindtap="{{c}}" class="{{['data-v-24906af6', d]}}" style="{{e}}"><image wx:if="{{a}}" class="wd-icon__image data-v-24906af6" src="{{b}}"></image></view>
|
||||
1079
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-icon/wd-icon.wxss
vendored
Normal file
1079
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-icon/wd-icon.wxss
vendored
Normal file
File diff suppressed because it is too large
Load Diff
91
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-input-number/types.js
vendored
Normal file
91
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-input-number/types.js
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
"use strict";
|
||||
const uni_modules_wotDesignUni_components_common_props = require("../common/props.js");
|
||||
const inputNumberProps = {
|
||||
...uni_modules_wotDesignUni_components_common_props.baseProps,
|
||||
/**
|
||||
* 绑定值
|
||||
*/
|
||||
modelValue: uni_modules_wotDesignUni_components_common_props.makeRequiredProp(uni_modules_wotDesignUni_components_common_props.numericProp),
|
||||
/**
|
||||
* 最小值
|
||||
*/
|
||||
min: uni_modules_wotDesignUni_components_common_props.makeNumberProp(1),
|
||||
/**
|
||||
* 最大值
|
||||
*/
|
||||
max: uni_modules_wotDesignUni_components_common_props.makeNumberProp(Number.MAX_SAFE_INTEGER),
|
||||
/**
|
||||
* 步进值
|
||||
*/
|
||||
step: uni_modules_wotDesignUni_components_common_props.makeNumberProp(1),
|
||||
/**
|
||||
* 是否严格按照步进值递增或递减
|
||||
*/
|
||||
stepStrictly: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 数值精度
|
||||
*/
|
||||
precision: uni_modules_wotDesignUni_components_common_props.makeNumericProp(0),
|
||||
/**
|
||||
* 是否禁用
|
||||
*/
|
||||
disabled: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 是否禁用输入框
|
||||
*/
|
||||
disableInput: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 是否禁用减号按钮
|
||||
*/
|
||||
disableMinus: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 是否禁用加号按钮
|
||||
*/
|
||||
disablePlus: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 是否不显示输入框
|
||||
*/
|
||||
withoutInput: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 输入框宽度
|
||||
*/
|
||||
inputWidth: uni_modules_wotDesignUni_components_common_props.makeNumericProp(36),
|
||||
/**
|
||||
* 是否允许为空
|
||||
*/
|
||||
allowNull: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 输入框占位符
|
||||
*/
|
||||
placeholder: uni_modules_wotDesignUni_components_common_props.makeStringProp(""),
|
||||
/**
|
||||
* 原生属性,键盘弹起时,是否自动上推页面
|
||||
*/
|
||||
adjustPosition: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(true),
|
||||
/**
|
||||
* 输入值变化前的回调函数,返回 `false` 可阻止输入,支持返回 `Promise`
|
||||
*/
|
||||
beforeChange: Function,
|
||||
/**
|
||||
* 是否开启长按加减手势
|
||||
*/
|
||||
longPress: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 是否立即响应输入变化,false 时仅在失焦和按钮点击时更新
|
||||
*/
|
||||
immediateChange: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(true),
|
||||
/**
|
||||
* 是否在初始化时更新 v-model 为修正后的值
|
||||
* true: 自动修正并更新 v-model
|
||||
* false: 保持原始值不修正,但仍会进行显示格式化
|
||||
*/
|
||||
updateOnInit: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(true),
|
||||
/**
|
||||
* 输入框类型
|
||||
* number: 数字输入
|
||||
* digit: 整数输入
|
||||
*/
|
||||
inputType: uni_modules_wotDesignUni_components_common_props.makeStringProp("digit")
|
||||
};
|
||||
exports.inputNumberProps = inputNumberProps;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-input-number/types.js.map
|
||||
@@ -0,0 +1,327 @@
|
||||
"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_wdInputNumber_types = require("./types.js");
|
||||
const uni_modules_wotDesignUni_components_common_interceptor = require("../common/interceptor.js");
|
||||
if (!Math) {
|
||||
wdIcon();
|
||||
}
|
||||
const wdIcon = () => "../wd-icon/wd-icon.js";
|
||||
const __default__ = {
|
||||
name: "wd-input-number",
|
||||
options: {
|
||||
virtualHost: true,
|
||||
addGlobalClass: true,
|
||||
styleIsolation: "shared"
|
||||
}
|
||||
};
|
||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
...__default__,
|
||||
props: uni_modules_wotDesignUni_components_wdInputNumber_types.inputNumberProps,
|
||||
emits: ["change", "focus", "blur", "update:modelValue"],
|
||||
setup(__props, { emit: __emit }) {
|
||||
const props = __props;
|
||||
const emit = __emit;
|
||||
const inputValue = common_vendor.ref(getInitValue());
|
||||
let longPressTimer = null;
|
||||
const minDisabled = common_vendor.computed(() => {
|
||||
const val = toNumber(inputValue.value);
|
||||
return props.disabled || val <= props.min || addStep(val, -props.step) < props.min;
|
||||
});
|
||||
const maxDisabled = common_vendor.computed(() => {
|
||||
const val = toNumber(inputValue.value);
|
||||
return props.disabled || val >= props.max || addStep(val, props.step) > props.max;
|
||||
});
|
||||
common_vendor.watch(
|
||||
() => props.modelValue,
|
||||
(val) => {
|
||||
inputValue.value = formatValue(val);
|
||||
}
|
||||
);
|
||||
common_vendor.watch([() => props.max, () => props.min, () => props.precision], () => {
|
||||
const val = toNumber(inputValue.value);
|
||||
inputValue.value = formatValue(val);
|
||||
});
|
||||
function getInitValue() {
|
||||
if (!props.updateOnInit) {
|
||||
return formatDisplay(props.modelValue);
|
||||
}
|
||||
const formatted = formatValue(props.modelValue);
|
||||
if (!uni_modules_wotDesignUni_components_common_util.isEqual(String(formatted), String(props.modelValue))) {
|
||||
emit("update:modelValue", formatted);
|
||||
}
|
||||
return formatted;
|
||||
}
|
||||
function getPrecision(val) {
|
||||
if (!uni_modules_wotDesignUni_components_common_util.isDef(val))
|
||||
return 0;
|
||||
const str = val.toString();
|
||||
const dotIndex = str.indexOf(".");
|
||||
return dotIndex === -1 ? 0 : str.length - dotIndex - 1;
|
||||
}
|
||||
function toPrecision(val) {
|
||||
const precision = Number(props.precision);
|
||||
return Math.round(val * Math.pow(10, precision)) / Math.pow(10, precision);
|
||||
}
|
||||
function toNumber(val) {
|
||||
if (props.allowNull && (!uni_modules_wotDesignUni_components_common_util.isDef(val) || val === "")) {
|
||||
return NaN;
|
||||
}
|
||||
if (!uni_modules_wotDesignUni_components_common_util.isDef(val) || val === "") {
|
||||
return props.min;
|
||||
}
|
||||
let str = String(val);
|
||||
if (str.endsWith("."))
|
||||
str = str.slice(0, -1);
|
||||
if (str.startsWith("."))
|
||||
str = "0" + str;
|
||||
if (str.startsWith("-."))
|
||||
str = "-0" + str.substring(1);
|
||||
if (str === "-" || str === "")
|
||||
return props.min;
|
||||
let num = Number(str);
|
||||
if (isNaN(num))
|
||||
num = props.min;
|
||||
return normalizeValue(num);
|
||||
}
|
||||
function normalizeValue(val) {
|
||||
let result = val;
|
||||
if (props.stepStrictly) {
|
||||
const stepPrecision = getPrecision(props.step);
|
||||
const factor = Math.pow(10, stepPrecision);
|
||||
result = Math.round(result / props.step) * factor * props.step / factor;
|
||||
}
|
||||
if (props.stepStrictly) {
|
||||
result = applyStrictBounds(result, props.min, props.max);
|
||||
} else {
|
||||
result = Math.min(Math.max(result, props.min), props.max);
|
||||
}
|
||||
if (uni_modules_wotDesignUni_components_common_util.isDef(props.precision)) {
|
||||
result = toPrecision(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function applyStrictBounds(val, min, max) {
|
||||
if (val >= min && val <= max)
|
||||
return val;
|
||||
const stepPrecision = getPrecision(props.step);
|
||||
const factor = Math.pow(10, stepPrecision);
|
||||
if (val < min) {
|
||||
const minSteps = Math.ceil(min * factor / (props.step * factor));
|
||||
const candidate = toPrecision(minSteps * props.step * factor / factor);
|
||||
if (candidate > max) {
|
||||
const maxSteps = Math.floor(max * factor / (props.step * factor));
|
||||
return toPrecision(maxSteps * props.step * factor / factor);
|
||||
}
|
||||
return candidate;
|
||||
}
|
||||
if (val > max) {
|
||||
const maxSteps = Math.floor(max * factor / (props.step * factor));
|
||||
const candidate = toPrecision(maxSteps * props.step * factor / factor);
|
||||
if (candidate < min) {
|
||||
const minSteps = Math.ceil(min * factor / (props.step * factor));
|
||||
return toPrecision(minSteps * props.step * factor / factor);
|
||||
}
|
||||
return candidate;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
function formatValue(val) {
|
||||
if (props.allowNull && (!uni_modules_wotDesignUni_components_common_util.isDef(val) || val === "")) {
|
||||
return "";
|
||||
}
|
||||
const num = toNumber(val);
|
||||
const precision = Number(props.precision);
|
||||
if (!uni_modules_wotDesignUni_components_common_util.isDef(props.precision)) {
|
||||
return num;
|
||||
}
|
||||
return precision === 0 ? Number(num.toFixed(0)) : num.toFixed(precision);
|
||||
}
|
||||
function formatDisplay(val) {
|
||||
if (props.allowNull && (!uni_modules_wotDesignUni_components_common_util.isDef(val) || val === "")) {
|
||||
return "";
|
||||
}
|
||||
if (!uni_modules_wotDesignUni_components_common_util.isDef(val) || val === "") {
|
||||
return props.min;
|
||||
}
|
||||
let num = Number(val);
|
||||
if (isNaN(num)) {
|
||||
return props.min;
|
||||
}
|
||||
const precision = Number(props.precision);
|
||||
if (!uni_modules_wotDesignUni_components_common_util.isDef(props.precision)) {
|
||||
return num;
|
||||
}
|
||||
return precision === 0 ? Number(num.toFixed(0)) : num.toFixed(precision);
|
||||
}
|
||||
function isIntermediate(val) {
|
||||
if (!val)
|
||||
return false;
|
||||
const str = String(val);
|
||||
return str.endsWith(".") || str.startsWith(".") || str.startsWith("-.") || str === "-" || Number(props.precision) > 0 && str.indexOf(".") === -1;
|
||||
}
|
||||
function cleanInput(val) {
|
||||
if (!val)
|
||||
return "";
|
||||
let cleaned = val.replace(/[^\d.-]/g, "");
|
||||
const hasNegative = cleaned.startsWith("-");
|
||||
cleaned = cleaned.replace(/-/g, "");
|
||||
if (hasNegative)
|
||||
cleaned = "-" + cleaned;
|
||||
const precision = Number(props.precision);
|
||||
if (precision > 0) {
|
||||
const parts = cleaned.split(".");
|
||||
if (parts.length > 2) {
|
||||
cleaned = parts[0] + "." + parts.slice(1).join("");
|
||||
}
|
||||
} else {
|
||||
cleaned = cleaned.split(".")[0];
|
||||
}
|
||||
if (cleaned.startsWith("."))
|
||||
return "0" + cleaned;
|
||||
if (cleaned.startsWith("-."))
|
||||
return "-0" + cleaned.substring(1);
|
||||
return cleaned;
|
||||
}
|
||||
function updateValue(val) {
|
||||
if (props.allowNull && (!uni_modules_wotDesignUni_components_common_util.isDef(val) || val === "")) {
|
||||
if (uni_modules_wotDesignUni_components_common_util.isEqual("", String(props.modelValue))) {
|
||||
inputValue.value = "";
|
||||
return;
|
||||
}
|
||||
const doUpdate2 = () => {
|
||||
inputValue.value = "";
|
||||
emit("update:modelValue", "");
|
||||
emit("change", { value: "" });
|
||||
};
|
||||
uni_modules_wotDesignUni_components_common_interceptor.callInterceptor(props.beforeChange, { args: [""], done: doUpdate2 });
|
||||
return;
|
||||
}
|
||||
const num = toNumber(val);
|
||||
const display = formatValue(val);
|
||||
if (uni_modules_wotDesignUni_components_common_util.isEqual(String(num), String(props.modelValue))) {
|
||||
inputValue.value = display;
|
||||
return;
|
||||
}
|
||||
const doUpdate = () => {
|
||||
inputValue.value = display;
|
||||
emit("update:modelValue", num);
|
||||
emit("change", { value: num });
|
||||
};
|
||||
uni_modules_wotDesignUni_components_common_interceptor.callInterceptor(props.beforeChange, { args: [num], done: doUpdate });
|
||||
}
|
||||
function addStep(val, step) {
|
||||
const num = Number(val);
|
||||
if (isNaN(num))
|
||||
return normalizeValue(props.min);
|
||||
const precision = Math.max(getPrecision(num), getPrecision(step));
|
||||
const factor = Math.pow(10, precision);
|
||||
const result = (num * factor + step * factor) / factor;
|
||||
return normalizeValue(result);
|
||||
}
|
||||
function handleClick(type) {
|
||||
const step = type === "add" ? props.step : -props.step;
|
||||
if (step < 0 && (minDisabled.value || props.disableMinus) || step > 0 && (maxDisabled.value || props.disablePlus))
|
||||
return;
|
||||
const newVal = addStep(inputValue.value, step);
|
||||
updateValue(newVal);
|
||||
}
|
||||
function handleInput(event) {
|
||||
const rawVal = event.detail.value || "";
|
||||
inputValue.value = rawVal;
|
||||
common_vendor.nextTick$1(() => {
|
||||
if (rawVal === "") {
|
||||
inputValue.value = "";
|
||||
if (props.immediateChange && props.allowNull) {
|
||||
updateValue("");
|
||||
}
|
||||
return;
|
||||
}
|
||||
const cleaned = cleanInput(rawVal);
|
||||
if (Number(props.precision) > 0 && isIntermediate(cleaned)) {
|
||||
inputValue.value = cleaned;
|
||||
return;
|
||||
}
|
||||
inputValue.value = cleaned;
|
||||
if (props.immediateChange) {
|
||||
updateValue(cleaned);
|
||||
}
|
||||
});
|
||||
}
|
||||
function handleBlur(event) {
|
||||
const val = event.detail.value || "";
|
||||
updateValue(val);
|
||||
emit("blur", { value: val });
|
||||
}
|
||||
function handleFocus(event) {
|
||||
emit("focus", event.detail);
|
||||
}
|
||||
function longPressStep(type) {
|
||||
clearLongPressTimer();
|
||||
longPressTimer = setTimeout(() => {
|
||||
handleClick(type);
|
||||
longPressStep(type);
|
||||
}, 250);
|
||||
}
|
||||
function handleTouchStart(type) {
|
||||
if (!props.longPress)
|
||||
return;
|
||||
clearLongPressTimer();
|
||||
longPressTimer = setTimeout(() => {
|
||||
handleClick(type);
|
||||
longPressStep(type);
|
||||
}, 600);
|
||||
}
|
||||
function handleTouchEnd() {
|
||||
if (!props.longPress)
|
||||
return;
|
||||
clearLongPressTimer();
|
||||
}
|
||||
function clearLongPressTimer() {
|
||||
if (longPressTimer) {
|
||||
clearTimeout(longPressTimer);
|
||||
longPressTimer = null;
|
||||
}
|
||||
}
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.p({
|
||||
name: "decrease",
|
||||
["custom-class"]: "wd-input-number__action-icon"
|
||||
}),
|
||||
b: common_vendor.n(`wd-input-number__action ${minDisabled.value || _ctx.disableMinus ? "is-disabled" : ""}`),
|
||||
c: common_vendor.o(($event) => handleClick("sub")),
|
||||
d: common_vendor.o(($event) => handleTouchStart("sub")),
|
||||
e: common_vendor.o(handleTouchEnd),
|
||||
f: !_ctx.withoutInput
|
||||
}, !_ctx.withoutInput ? {
|
||||
g: common_vendor.s(`${_ctx.inputWidth ? "width: " + _ctx.inputWidth : ""}`),
|
||||
h: _ctx.inputType,
|
||||
i: _ctx.precision ? "decimal" : "numeric",
|
||||
j: _ctx.disabled || _ctx.disableInput,
|
||||
k: String(inputValue.value),
|
||||
l: _ctx.placeholder,
|
||||
m: _ctx.adjustPosition,
|
||||
n: common_vendor.o(handleInput),
|
||||
o: common_vendor.o(handleFocus),
|
||||
p: common_vendor.o(handleBlur),
|
||||
q: common_vendor.o(() => {
|
||||
})
|
||||
} : {}, {
|
||||
r: common_vendor.p({
|
||||
name: "add",
|
||||
["custom-class"]: "wd-input-number__action-icon"
|
||||
}),
|
||||
s: common_vendor.n(`wd-input-number__action ${maxDisabled.value || _ctx.disablePlus ? "is-disabled" : ""}`),
|
||||
t: common_vendor.o(($event) => handleClick("add")),
|
||||
v: common_vendor.o(($event) => handleTouchStart("add")),
|
||||
w: common_vendor.o(handleTouchEnd),
|
||||
x: common_vendor.n(`wd-input-number ${_ctx.customClass} ${_ctx.disabled ? "is-disabled" : ""} ${_ctx.withoutInput ? "is-without-input" : ""}`),
|
||||
y: common_vendor.s(_ctx.customStyle)
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-a2d9dd24"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-input-number/wd-input-number.js.map
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"wd-icon": "../wd-icon/wd-icon"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<view class="{{['data-v-a2d9dd24', x]}}" style="{{y}}"><view class="{{['data-v-a2d9dd24', b]}}" bindtap="{{c}}" bindtouchstart="{{d}}" catchtouchend="{{e}}"><wd-icon wx:if="{{a}}" class="data-v-a2d9dd24" u-i="a2d9dd24-0" bind:__l="__l" u-p="{{a}}"></wd-icon></view><view wx:if="{{f}}" class="wd-input-number__inner data-v-a2d9dd24" catchtap="{{q}}"><block wx:if="{{r0}}"><input class="wd-input-number__input data-v-a2d9dd24" style="{{g}}" type="{{h}}" input-mode="{{i}}" disabled="{{j}}" value="{{k}}" placeholder="{{l}}" adjust-position="{{m}}" bindinput="{{n}}" bindfocus="{{o}}" bindblur="{{p}}"/></block><view class="wd-input-number__input-border data-v-a2d9dd24"></view></view><view class="{{['data-v-a2d9dd24', s]}}" bindtap="{{t}}" bindtouchstart="{{v}}" catchtouchend="{{w}}"><wd-icon wx:if="{{r}}" class="data-v-a2d9dd24" u-i="a2d9dd24-1" bind:__l="__l" u-p="{{r}}"></wd-icon></view></view>
|
||||
@@ -0,0 +1,275 @@
|
||||
/* 水平间距 */
|
||||
/* 水平间距 */
|
||||
/**
|
||||
* 混合宏
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/**
|
||||
* 辅助函数
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/* 转换成字符串 */
|
||||
/* 判断是否存在 Modifier */
|
||||
/* 判断是否存在伪类 */
|
||||
/**
|
||||
* 主题色切换
|
||||
* @params $theme-color 主题色
|
||||
* @params $type 变暗’dark‘ 变亮 'light'
|
||||
* @params $mix-color 自己设置的混色
|
||||
*/
|
||||
/**
|
||||
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
|
||||
* @params $open-linear 是否开启线性渐变色
|
||||
* @params $deg 渐变色角度
|
||||
* @params $theme-color 当前配色
|
||||
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
|
||||
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
|
||||
* @params [Array] $per-list 渐变色比例
|
||||
*/
|
||||
/**
|
||||
* BEM,定义块(b)
|
||||
*/
|
||||
/* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
|
||||
/* 此方法用于生成穿透样式 */
|
||||
/* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
|
||||
/* 定义状态(m) */
|
||||
/* 定义状态(m) */
|
||||
/* 对于需要需要嵌套在 m 底下的 e,调用这个混合宏,一般在切换整个组件的状态,如切换颜色的时候 */
|
||||
/* 状态,生成 is-$state 类名 */
|
||||
/**
|
||||
* 常用混合宏
|
||||
*/
|
||||
/* 单行超出隐藏 */
|
||||
/* 多行超出隐藏 */
|
||||
/* 清除浮动 */
|
||||
/* 0.5px 边框 指定方向*/
|
||||
/* 0.5px 边框 环绕 */
|
||||
/**
|
||||
* 三角形实现尖角样式,适用于背景透明情况
|
||||
* @param $size 三角形高,底边为 $size * 2
|
||||
* @param $bg 三角形背景颜色
|
||||
*/
|
||||
/**
|
||||
* 正方形实现尖角样式,适用于背景不透明情况
|
||||
* @param $size 正方形边长
|
||||
* @param $bg 正方形背景颜色
|
||||
* @param $z-index z-index属性值,不得大于外部包裹器
|
||||
* @param $box-shadow 阴影
|
||||
*/
|
||||
/**
|
||||
* 辅助函数
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/* 转换成字符串 */
|
||||
/* 判断是否存在 Modifier */
|
||||
/* 判断是否存在伪类 */
|
||||
/**
|
||||
* 主题色切换
|
||||
* @params $theme-color 主题色
|
||||
* @params $type 变暗’dark‘ 变亮 'light'
|
||||
* @params $mix-color 自己设置的混色
|
||||
*/
|
||||
/**
|
||||
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
|
||||
* @params $open-linear 是否开启线性渐变色
|
||||
* @params $deg 渐变色角度
|
||||
* @params $theme-color 当前配色
|
||||
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
|
||||
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
|
||||
* @params [Array] $per-list 渐变色比例
|
||||
*/
|
||||
/**
|
||||
* UI规范基础变量
|
||||
*/
|
||||
/*----------------------------------------- Theme color. start ----------------------------------------*/
|
||||
/* 主题颜色 */
|
||||
/* 辅助色 */
|
||||
/* 文字颜色(默认浅色背景下 */
|
||||
/* 暗黑模式 */
|
||||
/* 图形颜色 */
|
||||
/*----------------------------------------- Theme color. end -------------------------------------------*/
|
||||
/*-------------------------------- Theme color application size. start --------------------------------*/
|
||||
/* 文字字号 */
|
||||
/* 文字字重 */
|
||||
/* 尺寸 */
|
||||
/*-------------------------------- Theme color application size. end --------------------------------*/
|
||||
/* component var */
|
||||
/* action-sheet */
|
||||
/* badge */
|
||||
/* button */
|
||||
/* cell */
|
||||
/* calendar */
|
||||
/* checkbox */
|
||||
/* collapse */
|
||||
/* divider */
|
||||
/* drop-menu */
|
||||
/* input-number */
|
||||
/* input */
|
||||
/* textarea */
|
||||
/* loadmore */
|
||||
/* message-box */
|
||||
/* notice-bar */
|
||||
/* pagination */
|
||||
/* picker */
|
||||
/* col-picker */
|
||||
/* overlay */
|
||||
/* popup */
|
||||
/* progress */
|
||||
/* radio */
|
||||
/* search */
|
||||
/* slider */
|
||||
/* sort-button */
|
||||
/* steps */
|
||||
/* switch */
|
||||
/* tabs */
|
||||
/* tag */
|
||||
/* toast */
|
||||
/* loading */
|
||||
/* tooltip */
|
||||
/* popover */
|
||||
/* grid-item */
|
||||
/* statustip */
|
||||
/* card */
|
||||
/* upload */
|
||||
/* curtain */
|
||||
/* notify */
|
||||
/* skeleton */
|
||||
/* circle */
|
||||
/* swiper */
|
||||
/* swiper-nav */
|
||||
/* segmented */
|
||||
/* tabbar */
|
||||
/* tabbar-item */
|
||||
/* navbar */
|
||||
/* navbar-capsule */
|
||||
/* table */
|
||||
/* sidebar */
|
||||
/* sidebar-item */
|
||||
/* fab */
|
||||
/* count-down */
|
||||
/* keyboard */
|
||||
/* number-keyboard */
|
||||
/* passwod-input */
|
||||
/* form-item */
|
||||
/* backtop */
|
||||
/* index-bar */
|
||||
/* text */
|
||||
/* video-preview */
|
||||
/* img-cropper */
|
||||
/* floating-panel */
|
||||
/* signature */
|
||||
.wot-theme-dark .wd-input-number__action.data-v-a2d9dd24 {
|
||||
color: var(--wot-dark-color, var(--wot-color-white, white));
|
||||
}
|
||||
.wot-theme-dark .wd-input-number__action.is-disabled.data-v-a2d9dd24 {
|
||||
color: var(--wot-dark-color-gray, var(--wot-color-secondary, #595959));
|
||||
}
|
||||
.wot-theme-dark .wd-input-number__input.data-v-a2d9dd24 {
|
||||
color: var(--wot-dark-color, var(--wot-color-white, white));
|
||||
}
|
||||
.wot-theme-dark .wd-input-number.is-disabled .wd-input-number__input.data-v-a2d9dd24 {
|
||||
color: var(--wot-dark-color-gray, var(--wot-color-secondary, #595959));
|
||||
}
|
||||
.wot-theme-dark .wd-input-number.is-disabled .wd-input-number__sub.data-v-a2d9dd24,
|
||||
.wot-theme-dark .wd-input-number.is-disabled .wd-input-number__add.data-v-a2d9dd24 {
|
||||
color: var(--wot-dark-color-gray, var(--wot-color-secondary, #595959));
|
||||
}
|
||||
.wd-input-number.data-v-a2d9dd24 {
|
||||
display: inline-block;
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
line-height: 1.15;
|
||||
}
|
||||
.wd-input-number__action.data-v-a2d9dd24 {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: var(--wot-input-number-btn-width, 26px);
|
||||
height: var(--wot-input-number-height, 24px);
|
||||
vertical-align: middle;
|
||||
color: var(--wot-input-number-icon-color, rgba(0, 0, 0, 0.65));
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.wd-input-number__action.data-v-a2d9dd24::after {
|
||||
position: absolute;
|
||||
content: "";
|
||||
width: calc(200% - 2px);
|
||||
height: calc(200% - 2px);
|
||||
left: 0;
|
||||
top: 0;
|
||||
border: 1px solid var(--wot-input-number-border-color, #e8e8e8);
|
||||
border-top-left-radius: calc(var(--wot-input-number-radius, 4px) * 2);
|
||||
border-bottom-left-radius: calc(var(--wot-input-number-radius, 4px) * 2);
|
||||
transform: scale(0.5);
|
||||
transform-origin: left top;
|
||||
}
|
||||
.wd-input-number__action.data-v-a2d9dd24:last-child::after {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
border-top-right-radius: calc(var(--wot-input-number-radius, 4px) * 2);
|
||||
border-bottom-right-radius: calc(var(--wot-input-number-radius, 4px) * 2);
|
||||
}
|
||||
.wd-input-number__action.is-disabled.data-v-a2d9dd24 {
|
||||
color: var(--wot-input-number-disabled-color, rgba(0, 0, 0, 0.25));
|
||||
}
|
||||
.wd-input-number__inner.data-v-a2d9dd24 {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.wd-input-number__input.data-v-a2d9dd24 {
|
||||
position: relative;
|
||||
display: block;
|
||||
width: var(--wot-input-number-input-width, 36px);
|
||||
height: var(--wot-input-number-height, 24px);
|
||||
padding: 0 2px;
|
||||
box-sizing: border-box;
|
||||
z-index: 1;
|
||||
background: transparent;
|
||||
border: none;
|
||||
outline: none;
|
||||
text-align: center;
|
||||
color: var(--wot-input-number-color, #262626);
|
||||
font-size: var(--wot-input-number-fs, 12px);
|
||||
-webkit-appearance: none;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
.wd-input-number__input-border.data-v-a2d9dd24 {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: calc(200% - 2px);
|
||||
left: 0;
|
||||
top: 0;
|
||||
border-top: 1px solid var(--wot-input-number-border-color, #e8e8e8);
|
||||
border-bottom: 1px solid var(--wot-input-number-border-color, #e8e8e8);
|
||||
transform: scaleY(0.5);
|
||||
transform-origin: left top;
|
||||
z-index: 0;
|
||||
}
|
||||
.data-v-a2d9dd24 .wd-input-number__action-icon {
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
font-size: var(--wot-input-number-icon-size, 14px);
|
||||
width: var(--wot-input-number-icon-size, 14px);
|
||||
height: var(--wot-input-number-icon-size, 14px);
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
.wd-input-number.is-disabled .wd-input-number__input.data-v-a2d9dd24 {
|
||||
color: var(--wot-input-number-disabled-color, rgba(0, 0, 0, 0.25));
|
||||
z-index: inherit;
|
||||
}
|
||||
.wd-input-number.is-disabled .wd-input-number__sub.data-v-a2d9dd24,
|
||||
.wd-input-number.is-disabled .wd-input-number__add.data-v-a2d9dd24 {
|
||||
color: var(--wot-input-number-disabled-color, rgba(0, 0, 0, 0.25));
|
||||
}
|
||||
.wd-input-number.is-without-input .wd-input-number__action.data-v-a2d9dd24:last-child::after {
|
||||
border-left: none;
|
||||
}
|
||||
175
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-input/types.js
vendored
Normal file
175
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-input/types.js
vendored
Normal file
@@ -0,0 +1,175 @@
|
||||
"use strict";
|
||||
const uni_modules_wotDesignUni_components_common_props = require("../common/props.js");
|
||||
const inputProps = {
|
||||
...uni_modules_wotDesignUni_components_common_props.baseProps,
|
||||
customInputClass: uni_modules_wotDesignUni_components_common_props.makeStringProp(""),
|
||||
customLabelClass: uni_modules_wotDesignUni_components_common_props.makeStringProp(""),
|
||||
// 原生属性
|
||||
/**
|
||||
* 占位文本
|
||||
*/
|
||||
placeholder: String,
|
||||
/**
|
||||
* 原生属性,指定 placeholder 的样式,目前仅支持color,font-size和font-weight
|
||||
*/
|
||||
placeholderStyle: String,
|
||||
/**
|
||||
* 原生属性,指定 placeholder 的样式类
|
||||
*/
|
||||
placeholderClass: uni_modules_wotDesignUni_components_common_props.makeStringProp(""),
|
||||
/**
|
||||
* 原生属性,指定光标与键盘的距离。取 input 距离底部的距离和cursor-spacing指定的距离的最小值作为光标与键盘的距离
|
||||
*/
|
||||
cursorSpacing: uni_modules_wotDesignUni_components_common_props.makeNumberProp(0),
|
||||
/**
|
||||
* 原生属性,指定focus时的光标位置
|
||||
*/
|
||||
cursor: uni_modules_wotDesignUni_components_common_props.makeNumberProp(-1),
|
||||
/**
|
||||
* 原生属性,光标起始位置,自动聚集时有效,需与selection-end搭配使用
|
||||
*/
|
||||
selectionStart: uni_modules_wotDesignUni_components_common_props.makeNumberProp(-1),
|
||||
/**
|
||||
* 原生属性,光标结束位置,自动聚集时有效,需与selection-start搭配使用
|
||||
*/
|
||||
selectionEnd: uni_modules_wotDesignUni_components_common_props.makeNumberProp(-1),
|
||||
/**
|
||||
* 原生属性,键盘弹起时,是否自动上推页面
|
||||
*/
|
||||
adjustPosition: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(true),
|
||||
/**
|
||||
* focus时,点击页面的时候不收起键盘
|
||||
*/
|
||||
holdKeyboard: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 设置键盘右下角按钮的文字,仅在type='text'时生效,可选值:done / go / next / search / send
|
||||
*/
|
||||
confirmType: uni_modules_wotDesignUni_components_common_props.makeStringProp("done"),
|
||||
/**
|
||||
* 点击键盘右下角按钮时是否保持键盘不收起
|
||||
*/
|
||||
confirmHold: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 原生属性,获取焦点
|
||||
*/
|
||||
focus: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 类型,可选值:text / number / digit / idcard / safe-password / nickname / tel
|
||||
*/
|
||||
type: uni_modules_wotDesignUni_components_common_props.makeStringProp("text"),
|
||||
/**
|
||||
* 原生属性,最大长度
|
||||
*/
|
||||
maxlength: {
|
||||
type: Number,
|
||||
default: -1
|
||||
},
|
||||
/**
|
||||
* 原生属性,禁用
|
||||
*/
|
||||
disabled: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 微信小程序原生属性,强制 input 处于同层状态,默认 focus 时 input 会切到非同层状态 (仅在 iOS 下生效)
|
||||
*/
|
||||
alwaysEmbed: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
// 原生属性结束
|
||||
/**
|
||||
* 输入框的值靠右展示
|
||||
*/
|
||||
alignRight: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 绑定值
|
||||
*/
|
||||
modelValue: uni_modules_wotDesignUni_components_common_props.makeNumericProp(""),
|
||||
/**
|
||||
* 显示为密码框
|
||||
*/
|
||||
showPassword: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 显示清空按钮
|
||||
*/
|
||||
clearable: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 只读
|
||||
*/
|
||||
readonly: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 前置图标,icon组件中的图标类名
|
||||
*/
|
||||
prefixIcon: String,
|
||||
/**
|
||||
* 后置图标,icon组件中的图标类名
|
||||
*/
|
||||
suffixIcon: String,
|
||||
/**
|
||||
* 显示字数限制,需要同时设置 maxlength
|
||||
*/
|
||||
showWordLimit: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 设置左侧标题
|
||||
*/
|
||||
label: String,
|
||||
/**
|
||||
* 设置左侧标题宽度
|
||||
*/
|
||||
labelWidth: uni_modules_wotDesignUni_components_common_props.makeStringProp(""),
|
||||
/**
|
||||
* 设置输入框大小,可选值:large
|
||||
*/
|
||||
size: String,
|
||||
/**
|
||||
* 设置输入框错误状态,错误状态时为红色
|
||||
*/
|
||||
error: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 当有label属性时,设置标题和输入框垂直居中,默认为顶部居中
|
||||
*/
|
||||
center: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 非 cell 类型下是否隐藏下划线
|
||||
*/
|
||||
noBorder: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 是否必填
|
||||
*/
|
||||
required: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 表单域 model 字段名,在使用表单校验功能的情况下,该属性是必填的
|
||||
*/
|
||||
prop: String,
|
||||
/**
|
||||
* 表单验证规则,结合wd-form组件使用
|
||||
*/
|
||||
rules: uni_modules_wotDesignUni_components_common_props.makeArrayProp(),
|
||||
/**
|
||||
* 显示清除图标的时机,always 表示输入框不为空时展示,focus 表示输入框聚焦且不为空时展示
|
||||
* 类型: "focus" | "always"
|
||||
* 默认值: "always"
|
||||
*/
|
||||
clearTrigger: uni_modules_wotDesignUni_components_common_props.makeStringProp("always"),
|
||||
/**
|
||||
* 是否在点击清除按钮时聚焦输入框
|
||||
* 类型: boolean
|
||||
* 默认值: true
|
||||
*/
|
||||
focusWhenClear: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(true),
|
||||
/**
|
||||
* 是否忽略组件内对文本合成系统事件的处理。为 false 时将触发 compositionstart、compositionend、compositionupdate 事件,且在文本合成期间会触发 input 事件
|
||||
* 类型: boolean
|
||||
* 默认值: true
|
||||
*/
|
||||
ignoreCompositionEvent: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(true),
|
||||
/**
|
||||
* 它提供了用户在编辑元素或其内容时可能输入的数据类型的提示。在符合条件的高版本webview里,uni-app的web和app-vue平台中可使用本属性。
|
||||
* 类型: InputMode
|
||||
* 可选值: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | "password"
|
||||
* 默认值: "text"
|
||||
*/
|
||||
inputmode: uni_modules_wotDesignUni_components_common_props.makeStringProp("text"),
|
||||
/**
|
||||
* 必填标记位置,可选值:before(标签前)、after(标签后)
|
||||
*/
|
||||
markerSide: uni_modules_wotDesignUni_components_common_props.makeStringProp("before")
|
||||
};
|
||||
exports.inputProps = inputProps;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-input/types.js.map
|
||||
292
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-input/wd-input.js
vendored
Normal file
292
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-input/wd-input.js
vendored
Normal file
@@ -0,0 +1,292 @@
|
||||
"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_useCell = require("../composables/useCell.js");
|
||||
const uni_modules_wotDesignUni_components_wdForm_types = require("../wd-form/types.js");
|
||||
const uni_modules_wotDesignUni_components_composables_useParent = require("../composables/useParent.js");
|
||||
const uni_modules_wotDesignUni_components_composables_useTranslate = require("../composables/useTranslate.js");
|
||||
const uni_modules_wotDesignUni_components_wdInput_types = require("./types.js");
|
||||
if (!Math) {
|
||||
wdIcon();
|
||||
}
|
||||
const wdIcon = () => "../wd-icon/wd-icon.js";
|
||||
const __default__ = {
|
||||
name: "wd-input",
|
||||
options: {
|
||||
virtualHost: true,
|
||||
addGlobalClass: true,
|
||||
styleIsolation: "shared"
|
||||
}
|
||||
};
|
||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
...__default__,
|
||||
props: uni_modules_wotDesignUni_components_wdInput_types.inputProps,
|
||||
emits: [
|
||||
"update:modelValue",
|
||||
"clear",
|
||||
"blur",
|
||||
"focus",
|
||||
"input",
|
||||
"keyboardheightchange",
|
||||
"confirm",
|
||||
"clicksuffixicon",
|
||||
"clickprefixicon",
|
||||
"click"
|
||||
],
|
||||
setup(__props, { emit: __emit }) {
|
||||
const props = __props;
|
||||
const emit = __emit;
|
||||
const slots = common_vendor.useSlots();
|
||||
const { translate } = uni_modules_wotDesignUni_components_composables_useTranslate.useTranslate("input");
|
||||
const isPwdVisible = common_vendor.ref(false);
|
||||
const clearing = common_vendor.ref(false);
|
||||
const focused = common_vendor.ref(false);
|
||||
const focusing = common_vendor.ref(false);
|
||||
const inputValue = common_vendor.ref(getInitValue());
|
||||
const cell = uni_modules_wotDesignUni_components_composables_useCell.useCell();
|
||||
common_vendor.watch(
|
||||
() => props.focus,
|
||||
(newValue) => {
|
||||
focused.value = newValue;
|
||||
},
|
||||
{ immediate: true, deep: true }
|
||||
);
|
||||
common_vendor.watch(
|
||||
() => props.modelValue,
|
||||
(newValue) => {
|
||||
inputValue.value = uni_modules_wotDesignUni_components_common_util.isDef(newValue) ? String(newValue) : "";
|
||||
}
|
||||
);
|
||||
const { parent: form } = uni_modules_wotDesignUni_components_composables_useParent.useParent(uni_modules_wotDesignUni_components_wdForm_types.FORM_KEY);
|
||||
const placeholderValue = common_vendor.computed(() => {
|
||||
return uni_modules_wotDesignUni_components_common_util.isDef(props.placeholder) ? props.placeholder : translate("placeholder");
|
||||
});
|
||||
const showClear = common_vendor.computed(() => {
|
||||
const { disabled, readonly, clearable, clearTrigger } = props;
|
||||
if (clearable && !readonly && !disabled && inputValue.value && (clearTrigger === "always" || props.clearTrigger === "focus" && focusing.value)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
const showWordCount = common_vendor.computed(() => {
|
||||
const { disabled, readonly, maxlength, showWordLimit } = props;
|
||||
return Boolean(!disabled && !readonly && uni_modules_wotDesignUni_components_common_util.isDef(maxlength) && maxlength > -1 && showWordLimit);
|
||||
});
|
||||
const errorMessage = common_vendor.computed(() => {
|
||||
if (form && props.prop && form.errorMessages && form.errorMessages[props.prop]) {
|
||||
return form.errorMessages[props.prop];
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
const isRequired = common_vendor.computed(() => {
|
||||
let formRequired = false;
|
||||
if (form && form.props.rules) {
|
||||
const rules = form.props.rules;
|
||||
for (const key in rules) {
|
||||
if (Object.prototype.hasOwnProperty.call(rules, key) && key === props.prop && Array.isArray(rules[key])) {
|
||||
formRequired = rules[key].some((rule) => rule.required);
|
||||
}
|
||||
}
|
||||
}
|
||||
return props.required || props.rules.some((rule) => rule.required) || formRequired;
|
||||
});
|
||||
const rootClass = common_vendor.computed(() => {
|
||||
return `wd-input ${props.label || slots.label ? "is-cell" : ""} ${props.center ? "is-center" : ""} ${cell.border.value ? "is-border" : ""} ${props.size ? "is-" + props.size : ""} ${props.error ? "is-error" : ""} ${props.disabled ? "is-disabled" : ""} ${inputValue.value && String(inputValue.value).length > 0 ? "is-not-empty" : ""} ${props.noBorder ? "is-no-border" : ""} ${props.customClass}`;
|
||||
});
|
||||
const labelClass = common_vendor.computed(() => {
|
||||
return `wd-input__label ${props.customLabelClass}`;
|
||||
});
|
||||
const inputPlaceholderClass = common_vendor.computed(() => {
|
||||
return `wd-input__placeholder ${props.placeholderClass}`;
|
||||
});
|
||||
const labelStyle = common_vendor.computed(() => {
|
||||
return props.labelWidth ? uni_modules_wotDesignUni_components_common_util.objToStyle({
|
||||
"min-width": props.labelWidth,
|
||||
"max-width": props.labelWidth
|
||||
}) : "";
|
||||
});
|
||||
function getInitValue() {
|
||||
const formatted = formatValue(props.modelValue);
|
||||
if (!isValueEqual(formatted, props.modelValue)) {
|
||||
emit("update:modelValue", formatted);
|
||||
}
|
||||
return formatted;
|
||||
}
|
||||
function formatValue(value) {
|
||||
const { maxlength } = props;
|
||||
if (uni_modules_wotDesignUni_components_common_util.isDef(maxlength) && maxlength !== -1 && String(value).length > maxlength) {
|
||||
return value.toString().slice(0, maxlength);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
function togglePwdVisible() {
|
||||
isPwdVisible.value = !isPwdVisible.value;
|
||||
}
|
||||
async function handleClear() {
|
||||
focusing.value = false;
|
||||
inputValue.value = "";
|
||||
if (props.focusWhenClear) {
|
||||
clearing.value = true;
|
||||
focused.value = false;
|
||||
}
|
||||
await uni_modules_wotDesignUni_components_common_util.pause();
|
||||
if (props.focusWhenClear) {
|
||||
focused.value = true;
|
||||
focusing.value = true;
|
||||
}
|
||||
emit("update:modelValue", inputValue.value);
|
||||
emit("clear");
|
||||
}
|
||||
async function handleBlur() {
|
||||
await uni_modules_wotDesignUni_components_common_util.pause(150);
|
||||
if (clearing.value) {
|
||||
clearing.value = false;
|
||||
return;
|
||||
}
|
||||
focusing.value = false;
|
||||
emit("blur", {
|
||||
value: inputValue.value
|
||||
});
|
||||
}
|
||||
function handleFocus({ detail }) {
|
||||
focusing.value = true;
|
||||
emit("focus", detail);
|
||||
}
|
||||
function handleInput({ detail }) {
|
||||
emit("update:modelValue", inputValue.value);
|
||||
emit("input", detail);
|
||||
}
|
||||
function handleKeyboardheightchange({ detail }) {
|
||||
emit("keyboardheightchange", detail);
|
||||
}
|
||||
function handleConfirm({ detail }) {
|
||||
emit("confirm", detail);
|
||||
}
|
||||
function onClickSuffixIcon() {
|
||||
emit("clicksuffixicon");
|
||||
}
|
||||
function onClickPrefixIcon() {
|
||||
emit("clickprefixicon");
|
||||
}
|
||||
function handleClick(event) {
|
||||
emit("click", event);
|
||||
}
|
||||
function isValueEqual(value1, value2) {
|
||||
return uni_modules_wotDesignUni_components_common_util.isEqual(String(value1), String(value2));
|
||||
}
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: _ctx.label || _ctx.$slots.label
|
||||
}, _ctx.label || _ctx.$slots.label ? common_vendor.e({
|
||||
b: isRequired.value && _ctx.markerSide === "before"
|
||||
}, isRequired.value && _ctx.markerSide === "before" ? {} : {}, {
|
||||
c: _ctx.prefixIcon || _ctx.$slots.prefix
|
||||
}, _ctx.prefixIcon || _ctx.$slots.prefix ? common_vendor.e({
|
||||
d: _ctx.prefixIcon && !_ctx.$slots.prefix
|
||||
}, _ctx.prefixIcon && !_ctx.$slots.prefix ? {
|
||||
e: common_vendor.o(onClickPrefixIcon),
|
||||
f: common_vendor.p({
|
||||
["custom-class"]: "wd-input__icon",
|
||||
name: _ctx.prefixIcon
|
||||
})
|
||||
} : {}) : {}, {
|
||||
g: _ctx.label && !_ctx.$slots.label
|
||||
}, _ctx.label && !_ctx.$slots.label ? {
|
||||
h: common_vendor.t(_ctx.label)
|
||||
} : _ctx.$slots.label ? {} : {}, {
|
||||
i: _ctx.$slots.label,
|
||||
j: isRequired.value && _ctx.markerSide === "after"
|
||||
}, isRequired.value && _ctx.markerSide === "after" ? {} : {}, {
|
||||
k: common_vendor.n(labelClass.value),
|
||||
l: common_vendor.s(labelStyle.value)
|
||||
}) : {}, {
|
||||
m: (_ctx.prefixIcon || _ctx.$slots.prefix) && !_ctx.label
|
||||
}, (_ctx.prefixIcon || _ctx.$slots.prefix) && !_ctx.label ? common_vendor.e({
|
||||
n: _ctx.prefixIcon && !_ctx.$slots.prefix
|
||||
}, _ctx.prefixIcon && !_ctx.$slots.prefix ? {
|
||||
o: common_vendor.o(onClickPrefixIcon),
|
||||
p: common_vendor.p({
|
||||
["custom-class"]: "wd-input__icon",
|
||||
name: _ctx.prefixIcon
|
||||
})
|
||||
} : {}) : {}, {
|
||||
q: common_vendor.n(_ctx.prefixIcon ? "wd-input__inner--prefix" : ""),
|
||||
r: common_vendor.n(showWordCount.value ? "wd-input__inner--count" : ""),
|
||||
s: common_vendor.n(_ctx.alignRight ? "is-align-right" : ""),
|
||||
t: common_vendor.n(_ctx.customInputClass),
|
||||
v: _ctx.type,
|
||||
w: _ctx.showPassword && !isPwdVisible.value,
|
||||
x: placeholderValue.value,
|
||||
y: _ctx.disabled || _ctx.readonly,
|
||||
z: _ctx.maxlength,
|
||||
A: focused.value,
|
||||
B: _ctx.confirmType,
|
||||
C: _ctx.confirmHold,
|
||||
D: _ctx.cursor,
|
||||
E: _ctx.cursorSpacing,
|
||||
F: _ctx.placeholderStyle,
|
||||
G: _ctx.selectionStart,
|
||||
H: _ctx.selectionEnd,
|
||||
I: _ctx.adjustPosition,
|
||||
J: _ctx.holdKeyboard,
|
||||
K: _ctx.alwaysEmbed,
|
||||
L: inputPlaceholderClass.value,
|
||||
M: _ctx.ignoreCompositionEvent,
|
||||
N: _ctx.inputmode,
|
||||
O: common_vendor.o([($event) => inputValue.value = $event.detail.value, handleInput]),
|
||||
P: common_vendor.o(handleFocus),
|
||||
Q: common_vendor.o(handleBlur),
|
||||
R: common_vendor.o(handleConfirm),
|
||||
S: common_vendor.o(handleKeyboardheightchange),
|
||||
T: inputValue.value,
|
||||
U: props.readonly
|
||||
}, props.readonly ? {} : {}, {
|
||||
V: showClear.value || _ctx.showPassword || _ctx.suffixIcon || showWordCount.value || _ctx.$slots.suffix
|
||||
}, showClear.value || _ctx.showPassword || _ctx.suffixIcon || showWordCount.value || _ctx.$slots.suffix ? common_vendor.e({
|
||||
W: showClear.value
|
||||
}, showClear.value ? {
|
||||
X: common_vendor.o(handleClear),
|
||||
Y: common_vendor.p({
|
||||
["custom-class"]: "wd-input__clear",
|
||||
name: "error-fill"
|
||||
})
|
||||
} : {}, {
|
||||
Z: _ctx.showPassword
|
||||
}, _ctx.showPassword ? {
|
||||
aa: common_vendor.o(togglePwdVisible),
|
||||
ab: common_vendor.p({
|
||||
["custom-class"]: "wd-input__icon",
|
||||
name: isPwdVisible.value ? "view" : "eye-close"
|
||||
})
|
||||
} : {}, {
|
||||
ac: showWordCount.value
|
||||
}, showWordCount.value ? {
|
||||
ad: common_vendor.t(String(inputValue.value).length),
|
||||
ae: common_vendor.n(inputValue.value && String(inputValue.value).length > 0 ? "wd-input__count-current" : ""),
|
||||
af: common_vendor.n(String(inputValue.value).length > _ctx.maxlength ? "is-error" : ""),
|
||||
ag: common_vendor.t(_ctx.maxlength)
|
||||
} : {}, {
|
||||
ah: _ctx.suffixIcon && !_ctx.$slots.suffix
|
||||
}, _ctx.suffixIcon && !_ctx.$slots.suffix ? {
|
||||
ai: common_vendor.o(onClickSuffixIcon),
|
||||
aj: common_vendor.p({
|
||||
["custom-class"]: "wd-input__icon",
|
||||
name: _ctx.suffixIcon
|
||||
})
|
||||
} : {}) : {}, {
|
||||
ak: errorMessage.value
|
||||
}, errorMessage.value ? {
|
||||
al: common_vendor.t(errorMessage.value)
|
||||
} : {}, {
|
||||
am: common_vendor.n(rootClass.value),
|
||||
an: common_vendor.s(_ctx.customStyle),
|
||||
ao: common_vendor.o(handleClick)
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-4e0c9774"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-input/wd-input.js.map
|
||||
6
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-input/wd-input.json
vendored
Normal file
6
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-input/wd-input.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"wd-icon": "../wd-icon/wd-icon"
|
||||
}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-input/wd-input.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-input/wd-input.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="{{['data-v-4e0c9774', am]}}" style="{{an}}" bindtap="{{ao}}"><view wx:if="{{a}}" class="{{['data-v-4e0c9774', k]}}" style="{{l}}"><text wx:if="{{b}}" class="wd-input__required wd-input__required--left data-v-4e0c9774">*</text><view wx:if="{{c}}" class="wd-input__prefix data-v-4e0c9774"><wd-icon wx:if="{{d}}" class="data-v-4e0c9774" bindclick="{{e}}" u-i="4e0c9774-0" bind:__l="__l" u-p="{{f}}"/><slot wx:else name="prefix"></slot></view><view class="wd-input__label-inner data-v-4e0c9774"><text wx:if="{{g}}" class="data-v-4e0c9774">{{h}}</text><slot wx:elif="{{i}}" name="label"></slot></view><text wx:if="{{j}}" class="wd-input__required data-v-4e0c9774">*</text></view><view class="wd-input__body data-v-4e0c9774"><view class="wd-input__value data-v-4e0c9774"><view wx:if="{{m}}" class="wd-input__prefix data-v-4e0c9774"><wd-icon wx:if="{{n}}" class="data-v-4e0c9774" bindclick="{{o}}" u-i="4e0c9774-1" bind:__l="__l" u-p="{{p}}"/><slot wx:else name="prefix"></slot></view><block wx:if="{{r0}}"><input class="{{['data-v-4e0c9774', 'wd-input__inner', q, r, s, t]}}" type="{{v}}" password="{{w}}" placeholder="{{x}}" disabled="{{y}}" maxlength="{{z}}" focus="{{A}}" confirm-type="{{B}}" confirm-hold="{{C}}" cursor="{{D}}" cursor-spacing="{{E}}" placeholder-style="{{F}}" selection-start="{{G}}" selection-end="{{H}}" adjust-position="{{I}}" hold-keyboard="{{J}}" always-embed="{{K}}" placeholder-class="{{L}}" ignoreCompositionEvent="{{M}}" inputmode="{{N}}" bindinput="{{O}}" bindfocus="{{P}}" bindblur="{{Q}}" bindconfirm="{{R}}" bindkeyboardheightchange="{{S}}" value="{{T}}"/></block><view wx:if="{{U}}" class="wd-input__readonly-mask data-v-4e0c9774"/><view wx:if="{{V}}" class="wd-input__suffix data-v-4e0c9774"><wd-icon wx:if="{{W}}" class="data-v-4e0c9774" bindclick="{{X}}" u-i="4e0c9774-2" bind:__l="__l" u-p="{{Y}}"/><wd-icon wx:if="{{Z}}" class="data-v-4e0c9774" bindclick="{{aa}}" u-i="4e0c9774-3" bind:__l="__l" u-p="{{ab}}"/><view wx:if="{{ac}}" class="wd-input__count data-v-4e0c9774"><text class="{{['data-v-4e0c9774', ae, af]}}">{{ad}}</text> /{{ag}}</view><wd-icon wx:if="{{ah}}" class="data-v-4e0c9774" bindclick="{{ai}}" u-i="4e0c9774-4" bind:__l="__l" u-p="{{aj}}"/><slot wx:else name="suffix"></slot></view></view><view wx:if="{{ak}}" class="wd-input__error-message data-v-4e0c9774">{{al}}</view></view></view>
|
||||
600
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-input/wd-input.wxss
vendored
Normal file
600
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-input/wd-input.wxss
vendored
Normal file
@@ -0,0 +1,600 @@
|
||||
/* 水平间距 */
|
||||
/* 水平间距 */
|
||||
/**
|
||||
* 辅助函数
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/* 转换成字符串 */
|
||||
/* 判断是否存在 Modifier */
|
||||
/* 判断是否存在伪类 */
|
||||
/**
|
||||
* 主题色切换
|
||||
* @params $theme-color 主题色
|
||||
* @params $type 变暗’dark‘ 变亮 'light'
|
||||
* @params $mix-color 自己设置的混色
|
||||
*/
|
||||
/**
|
||||
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
|
||||
* @params $open-linear 是否开启线性渐变色
|
||||
* @params $deg 渐变色角度
|
||||
* @params $theme-color 当前配色
|
||||
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
|
||||
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
|
||||
* @params [Array] $per-list 渐变色比例
|
||||
*/
|
||||
/**
|
||||
* UI规范基础变量
|
||||
*/
|
||||
/*----------------------------------------- Theme color. start ----------------------------------------*/
|
||||
/* 主题颜色 */
|
||||
/* 辅助色 */
|
||||
/* 文字颜色(默认浅色背景下 */
|
||||
/* 暗黑模式 */
|
||||
/* 图形颜色 */
|
||||
/*----------------------------------------- Theme color. end -------------------------------------------*/
|
||||
/*-------------------------------- Theme color application size. start --------------------------------*/
|
||||
/* 文字字号 */
|
||||
/* 文字字重 */
|
||||
/* 尺寸 */
|
||||
/*-------------------------------- Theme color application size. end --------------------------------*/
|
||||
/* component var */
|
||||
/* action-sheet */
|
||||
/* badge */
|
||||
/* button */
|
||||
/* cell */
|
||||
/* calendar */
|
||||
/* checkbox */
|
||||
/* collapse */
|
||||
/* divider */
|
||||
/* drop-menu */
|
||||
/* input-number */
|
||||
/* input */
|
||||
/* textarea */
|
||||
/* loadmore */
|
||||
/* message-box */
|
||||
/* notice-bar */
|
||||
/* pagination */
|
||||
/* picker */
|
||||
/* col-picker */
|
||||
/* overlay */
|
||||
/* popup */
|
||||
/* progress */
|
||||
/* radio */
|
||||
/* search */
|
||||
/* slider */
|
||||
/* sort-button */
|
||||
/* steps */
|
||||
/* switch */
|
||||
/* tabs */
|
||||
/* tag */
|
||||
/* toast */
|
||||
/* loading */
|
||||
/* tooltip */
|
||||
/* popover */
|
||||
/* grid-item */
|
||||
/* statustip */
|
||||
/* card */
|
||||
/* upload */
|
||||
/* curtain */
|
||||
/* notify */
|
||||
/* skeleton */
|
||||
/* circle */
|
||||
/* swiper */
|
||||
/* swiper-nav */
|
||||
/* segmented */
|
||||
/* tabbar */
|
||||
/* tabbar-item */
|
||||
/* navbar */
|
||||
/* navbar-capsule */
|
||||
/* table */
|
||||
/* sidebar */
|
||||
/* sidebar-item */
|
||||
/* fab */
|
||||
/* count-down */
|
||||
/* keyboard */
|
||||
/* number-keyboard */
|
||||
/* passwod-input */
|
||||
/* form-item */
|
||||
/* backtop */
|
||||
/* index-bar */
|
||||
/* text */
|
||||
/* video-preview */
|
||||
/* img-cropper */
|
||||
/* floating-panel */
|
||||
/* signature */
|
||||
/**
|
||||
* 混合宏
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/**
|
||||
* 辅助函数
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/* 转换成字符串 */
|
||||
/* 判断是否存在 Modifier */
|
||||
/* 判断是否存在伪类 */
|
||||
/**
|
||||
* 主题色切换
|
||||
* @params $theme-color 主题色
|
||||
* @params $type 变暗’dark‘ 变亮 'light'
|
||||
* @params $mix-color 自己设置的混色
|
||||
*/
|
||||
/**
|
||||
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
|
||||
* @params $open-linear 是否开启线性渐变色
|
||||
* @params $deg 渐变色角度
|
||||
* @params $theme-color 当前配色
|
||||
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
|
||||
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
|
||||
* @params [Array] $per-list 渐变色比例
|
||||
*/
|
||||
/**
|
||||
* BEM,定义块(b)
|
||||
*/
|
||||
/* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
|
||||
/* 此方法用于生成穿透样式 */
|
||||
/* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
|
||||
/* 定义状态(m) */
|
||||
/* 定义状态(m) */
|
||||
/* 对于需要需要嵌套在 m 底下的 e,调用这个混合宏,一般在切换整个组件的状态,如切换颜色的时候 */
|
||||
/* 状态,生成 is-$state 类名 */
|
||||
/**
|
||||
* 常用混合宏
|
||||
*/
|
||||
/* 单行超出隐藏 */
|
||||
/* 多行超出隐藏 */
|
||||
/* 清除浮动 */
|
||||
/* 0.5px 边框 指定方向*/
|
||||
/* 0.5px 边框 环绕 */
|
||||
/**
|
||||
* 三角形实现尖角样式,适用于背景透明情况
|
||||
* @param $size 三角形高,底边为 $size * 2
|
||||
* @param $bg 三角形背景颜色
|
||||
*/
|
||||
/**
|
||||
* 正方形实现尖角样式,适用于背景不透明情况
|
||||
* @param $size 正方形边长
|
||||
* @param $bg 正方形背景颜色
|
||||
* @param $z-index z-index属性值,不得大于外部包裹器
|
||||
* @param $box-shadow 阴影
|
||||
*/
|
||||
.wot-theme-dark .wd-input.data-v-4e0c9774 {
|
||||
background: var(--wot-dark-background2, #1b1b1b);
|
||||
}
|
||||
.wot-theme-dark .wd-input.data-v-4e0c9774::after {
|
||||
background: var(--wot-dark-color-gray, var(--wot-color-secondary, #595959));
|
||||
}
|
||||
.wot-theme-dark .wd-input.is-not-empty.data-v-4e0c9774:not(.is-disabled)::after {
|
||||
background-color: var(--wot-dark-color, var(--wot-color-white, white));
|
||||
}
|
||||
.wot-theme-dark .wd-input__inner.data-v-4e0c9774 {
|
||||
color: var(--wot-dark-color, var(--wot-color-white, white));
|
||||
}
|
||||
.wot-theme-dark .wd-input__inner.data-v-4e0c9774::-webkit-input-placeholder {
|
||||
color: var(--wot-dark-color3, rgba(232, 230, 227, 0.8));
|
||||
}
|
||||
.wot-theme-dark .wd-input__count.data-v-4e0c9774 {
|
||||
color: var(--wot-dark-color3, rgba(232, 230, 227, 0.8));
|
||||
background: transparent;
|
||||
}
|
||||
.wot-theme-dark .wd-input__count-current.data-v-4e0c9774 {
|
||||
color: var(--wot-dark-color, var(--wot-color-white, white));
|
||||
}
|
||||
.wot-theme-dark .wd-input.data-v-4e0c9774 .wd-input__icon,
|
||||
.wot-theme-dark .wd-input.data-v-4e0c9774 .wd-input__clear {
|
||||
color: var(--wot-dark-color, var(--wot-color-white, white));
|
||||
background: transparent;
|
||||
}
|
||||
.wot-theme-dark .wd-input.is-cell.data-v-4e0c9774 {
|
||||
background-color: var(--wot-dark-background2, #1b1b1b);
|
||||
line-height: var(--wot-cell-line-height, 24px);
|
||||
}
|
||||
.wot-theme-dark .wd-input.is-cell.is-border.data-v-4e0c9774 {
|
||||
position: relative;
|
||||
}
|
||||
.wot-theme-dark .wd-input.is-cell.is-border.data-v-4e0c9774::after {
|
||||
position: absolute;
|
||||
display: block;
|
||||
content: "";
|
||||
width: calc(100% - var(--wot-input-cell-padding, 10px));
|
||||
height: 1px;
|
||||
left: var(--wot-input-cell-padding, 10px);
|
||||
top: 0;
|
||||
transform: scaleY(0.5);
|
||||
background: var(--wot-dark-border-color, #3a3a3c);
|
||||
}
|
||||
.wot-theme-dark .wd-input.is-disabled .wd-input__inner.data-v-4e0c9774 {
|
||||
color: var(--wot-dark-color-gray, var(--wot-color-secondary, #595959));
|
||||
background: transparent;
|
||||
}
|
||||
.wot-theme-dark .wd-input__label.data-v-4e0c9774 {
|
||||
color: var(--wot-dark-color, var(--wot-color-white, white));
|
||||
}
|
||||
.wd-input.data-v-4e0c9774 {
|
||||
position: relative;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
text-align: left;
|
||||
background: var(--wot-input-bg, var(--wot-color-white, white));
|
||||
}
|
||||
.wd-input.data-v-4e0c9774::after {
|
||||
position: absolute;
|
||||
content: "";
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 1px;
|
||||
background: var(--wot-input-border-color, #dadada);
|
||||
transform: scaleY(0.5);
|
||||
transition: background-color 0.2s ease-in-out;
|
||||
}
|
||||
.wd-input.is-not-empty.data-v-4e0c9774:not(.is-disabled)::after {
|
||||
background-color: var(--wot-input-not-empty-border-color, #262626);
|
||||
}
|
||||
.wd-input__label.data-v-4e0c9774 {
|
||||
position: relative;
|
||||
display: flex;
|
||||
width: var(--wot-input-cell-label-width, 33%);
|
||||
color: var(--wot-cell-title-color, rgba(0, 0, 0, 0.85));
|
||||
margin-right: var(--wot-cell-padding, var(--wot-size-side-padding, 15px));
|
||||
box-sizing: border-box;
|
||||
font-size: var(--wot-input-fs, var(--wot-cell-title-fs, 14px));
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.wd-input__label-inner.data-v-4e0c9774 {
|
||||
display: inline-block;
|
||||
font-size: var(--wot-input-fs, var(--wot-cell-title-fs, 14px));
|
||||
line-height: var(--wot-cell-line-height, 24px);
|
||||
}
|
||||
.wd-input__required.data-v-4e0c9774 {
|
||||
font-size: var(--wot-cell-required-size, 18px);
|
||||
color: var(--wot-cell-required-color, var(--wot-color-danger, #fa4350));
|
||||
margin-left: var(--wot-cell-required-margin, 4px);
|
||||
}
|
||||
.wd-input__required--left.data-v-4e0c9774 {
|
||||
margin-left: 0;
|
||||
margin-right: var(--wot-cell-required-margin, 4px);
|
||||
}
|
||||
.wd-input__body.data-v-4e0c9774 {
|
||||
flex: 1;
|
||||
}
|
||||
.wd-input__value.data-v-4e0c9774 {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
.wd-input__prefix.data-v-4e0c9774 {
|
||||
margin-right: var(--wot-input-icon-margin, 8px);
|
||||
font-size: var(--wot-input-fs, var(--wot-cell-title-fs, 14px));
|
||||
line-height: initial;
|
||||
}
|
||||
.wd-input__prefix.data-v-4e0c9774 .wd-input__icon,
|
||||
.wd-input__prefix.data-v-4e0c9774 .wd-input__clear {
|
||||
margin-left: 0;
|
||||
}
|
||||
.wd-input__suffix.data-v-4e0c9774 {
|
||||
flex-shrink: 0;
|
||||
line-height: initial;
|
||||
}
|
||||
.wd-input__error-message.data-v-4e0c9774 {
|
||||
color: var(--wot-form-item-error-message-color, var(--wot-color-danger, #fa4350));
|
||||
font-size: var(--wot-form-item-error-message-font-size, var(--wot-fs-secondary, 12px));
|
||||
line-height: var(--wot-form-item-error-message-line-height, 24px);
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.wd-input.is-disabled .wd-input__inner.data-v-4e0c9774 {
|
||||
color: var(--wot-input-disabled-color, #d9d9d9);
|
||||
background: transparent;
|
||||
}
|
||||
.wd-input.is-error .wd-input__inner.data-v-4e0c9774 {
|
||||
color: var(--wot-input-error-color, var(--wot-color-danger, #fa4350));
|
||||
background: transparent;
|
||||
}
|
||||
.wd-input.is-no-border.data-v-4e0c9774::after {
|
||||
display: none;
|
||||
}
|
||||
.wd-input.is-no-border .wd-input__inner.data-v-4e0c9774 {
|
||||
height: var(--wot-input-inner-height-no-border, 24px);
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
.wd-input.is-cell.data-v-4e0c9774 {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
padding: var(--wot-input-cell-padding, 10px) var(--wot-input-padding, var(--wot-size-side-padding, 15px));
|
||||
background-color: var(--wot-input-cell-bg, var(--wot-color-white, white));
|
||||
}
|
||||
.wd-input.is-cell.is-error.data-v-4e0c9774::after {
|
||||
background: var(--wot-input-cell-border-color, var(--wot-color-border-light, #e8e8e8));
|
||||
}
|
||||
.wd-input.is-cell.data-v-4e0c9774 .wd-input__icon,
|
||||
.wd-input.is-cell.data-v-4e0c9774 .wd-input__clear {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
height: var(--wot-input-cell-height, 24px);
|
||||
line-height: var(--wot-input-cell-height, 24px);
|
||||
}
|
||||
.wd-input.is-cell .wd-input__prefix.data-v-4e0c9774 {
|
||||
display: inline-block;
|
||||
margin-right: var(--wot-cell-icon-right, 4px);
|
||||
}
|
||||
.wd-input.is-cell .wd-input__inner.data-v-4e0c9774 {
|
||||
height: var(--wot-input-cell-height, 24px);
|
||||
}
|
||||
.wd-input.is-cell.wd-input.data-v-4e0c9774::after {
|
||||
display: none;
|
||||
}
|
||||
.wd-input.is-cell.is-center.data-v-4e0c9774 {
|
||||
align-items: center;
|
||||
}
|
||||
.wd-input.is-cell.is-border.data-v-4e0c9774 {
|
||||
position: relative;
|
||||
}
|
||||
.wd-input.is-cell.is-border.data-v-4e0c9774::after {
|
||||
position: absolute;
|
||||
display: block;
|
||||
content: "";
|
||||
width: calc(100% - var(--wot-input-cell-padding, 10px));
|
||||
height: 1px;
|
||||
left: var(--wot-input-cell-padding, 10px);
|
||||
top: 0;
|
||||
transform: scaleY(0.5);
|
||||
background: var(--wot-color-border-light, #e8e8e8);
|
||||
}
|
||||
.wd-input.is-large.data-v-4e0c9774 {
|
||||
padding: var(--wot-input-cell-padding-large, 12px);
|
||||
}
|
||||
.wd-input.is-large .wd-input__prefix.data-v-4e0c9774 {
|
||||
font-size: var(--wot-input-fs-large, var(--wot-cell-title-fs-large, 16px));
|
||||
}
|
||||
.wd-input.is-large .wd-input__label-inner.data-v-4e0c9774 {
|
||||
font-size: var(--wot-input-fs-large, var(--wot-cell-title-fs-large, 16px));
|
||||
}
|
||||
.wd-input.is-large .wd-input__inner.data-v-4e0c9774 {
|
||||
font-size: var(--wot-input-fs-large, var(--wot-cell-title-fs-large, 16px));
|
||||
}
|
||||
.wd-input.is-large .wd-input__count.data-v-4e0c9774 {
|
||||
font-size: var(--wot-input-count-fs-large, 14px);
|
||||
}
|
||||
.wd-input.is-large.data-v-4e0c9774 .wd-input__icon,
|
||||
.wd-input.is-large.data-v-4e0c9774 .wd-input__clear {
|
||||
font-size: var(--wot-input-icon-size-large, 18px);
|
||||
}
|
||||
.wd-input__inner.data-v-4e0c9774 {
|
||||
flex: 1;
|
||||
height: var(--wot-input-inner-height, 34px);
|
||||
font-size: var(--wot-input-fs, var(--wot-cell-title-fs, 14px));
|
||||
color: var(--wot-input-color, #262626);
|
||||
outline: none;
|
||||
border: none;
|
||||
background: none;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.wd-input__inner.data-v-4e0c9774::-webkit-input-placeholder {
|
||||
color: var(--wot-input-placeholder-color, #bfbfbf);
|
||||
}
|
||||
.wd-input__inner.is-align-right.data-v-4e0c9774 {
|
||||
text-align: right;
|
||||
}
|
||||
.wd-input__readonly-mask.data-v-4e0c9774 {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 2;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.data-v-4e0c9774 .wd-input__icon {
|
||||
margin-left: var(--wot-input-icon-margin, 8px);
|
||||
font-size: var(--wot-input-icon-size, 16px);
|
||||
color: var(--wot-input-icon-color, #bfbfbf);
|
||||
vertical-align: middle;
|
||||
background: var(--wot-input-bg, var(--wot-color-white, white));
|
||||
}
|
||||
.data-v-4e0c9774 .wd-input__clear {
|
||||
margin-left: var(--wot-input-icon-margin, 8px);
|
||||
font-size: var(--wot-input-icon-size, 16px);
|
||||
color: var(--wot-input-clear-color, #585858);
|
||||
vertical-align: middle;
|
||||
background: var(--wot-input-bg, var(--wot-color-white, white));
|
||||
}
|
||||
.wd-input__count.data-v-4e0c9774 {
|
||||
margin-left: 15px;
|
||||
font-size: var(--wot-input-count-fs, 14px);
|
||||
color: var(--wot-input-count-color, #bfbfbf);
|
||||
vertical-align: middle;
|
||||
background: var(--wot-input-bg, var(--wot-color-white, white));
|
||||
}
|
||||
.wd-input__count-current.data-v-4e0c9774 {
|
||||
color: var(--wot-input-count-current-color, #262626);
|
||||
}
|
||||
.wd-input__count-current.is-error.data-v-4e0c9774 {
|
||||
color: var(--wot-input-error-color, var(--wot-color-danger, #fa4350));
|
||||
}
|
||||
.wd-input .wd-input__count.data-v-4e0c9774,
|
||||
.wd-input .wd-input__count-current.data-v-4e0c9774 {
|
||||
display: inline-flex;
|
||||
}
|
||||
/* 水平间距 */
|
||||
/* 水平间距 */
|
||||
/**
|
||||
* 辅助函数
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/* 转换成字符串 */
|
||||
/* 判断是否存在 Modifier */
|
||||
/* 判断是否存在伪类 */
|
||||
/**
|
||||
* 主题色切换
|
||||
* @params $theme-color 主题色
|
||||
* @params $type 变暗’dark‘ 变亮 'light'
|
||||
* @params $mix-color 自己设置的混色
|
||||
*/
|
||||
/**
|
||||
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
|
||||
* @params $open-linear 是否开启线性渐变色
|
||||
* @params $deg 渐变色角度
|
||||
* @params $theme-color 当前配色
|
||||
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
|
||||
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
|
||||
* @params [Array] $per-list 渐变色比例
|
||||
*/
|
||||
/**
|
||||
* UI规范基础变量
|
||||
*/
|
||||
/*----------------------------------------- Theme color. start ----------------------------------------*/
|
||||
/* 主题颜色 */
|
||||
/* 辅助色 */
|
||||
/* 文字颜色(默认浅色背景下 */
|
||||
/* 暗黑模式 */
|
||||
/* 图形颜色 */
|
||||
/*----------------------------------------- Theme color. end -------------------------------------------*/
|
||||
/*-------------------------------- Theme color application size. start --------------------------------*/
|
||||
/* 文字字号 */
|
||||
/* 文字字重 */
|
||||
/* 尺寸 */
|
||||
/*-------------------------------- Theme color application size. end --------------------------------*/
|
||||
/* component var */
|
||||
/* action-sheet */
|
||||
/* badge */
|
||||
/* button */
|
||||
/* cell */
|
||||
/* calendar */
|
||||
/* checkbox */
|
||||
/* collapse */
|
||||
/* divider */
|
||||
/* drop-menu */
|
||||
/* input-number */
|
||||
/* input */
|
||||
/* textarea */
|
||||
/* loadmore */
|
||||
/* message-box */
|
||||
/* notice-bar */
|
||||
/* pagination */
|
||||
/* picker */
|
||||
/* col-picker */
|
||||
/* overlay */
|
||||
/* popup */
|
||||
/* progress */
|
||||
/* radio */
|
||||
/* search */
|
||||
/* slider */
|
||||
/* sort-button */
|
||||
/* steps */
|
||||
/* switch */
|
||||
/* tabs */
|
||||
/* tag */
|
||||
/* toast */
|
||||
/* loading */
|
||||
/* tooltip */
|
||||
/* popover */
|
||||
/* grid-item */
|
||||
/* statustip */
|
||||
/* card */
|
||||
/* upload */
|
||||
/* curtain */
|
||||
/* notify */
|
||||
/* skeleton */
|
||||
/* circle */
|
||||
/* swiper */
|
||||
/* swiper-nav */
|
||||
/* segmented */
|
||||
/* tabbar */
|
||||
/* tabbar-item */
|
||||
/* navbar */
|
||||
/* navbar-capsule */
|
||||
/* table */
|
||||
/* sidebar */
|
||||
/* sidebar-item */
|
||||
/* fab */
|
||||
/* count-down */
|
||||
/* keyboard */
|
||||
/* number-keyboard */
|
||||
/* passwod-input */
|
||||
/* form-item */
|
||||
/* backtop */
|
||||
/* index-bar */
|
||||
/* text */
|
||||
/* video-preview */
|
||||
/* img-cropper */
|
||||
/* floating-panel */
|
||||
/* signature */
|
||||
/**
|
||||
* 混合宏
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/**
|
||||
* 辅助函数
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/* 转换成字符串 */
|
||||
/* 判断是否存在 Modifier */
|
||||
/* 判断是否存在伪类 */
|
||||
/**
|
||||
* 主题色切换
|
||||
* @params $theme-color 主题色
|
||||
* @params $type 变暗’dark‘ 变亮 'light'
|
||||
* @params $mix-color 自己设置的混色
|
||||
*/
|
||||
/**
|
||||
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
|
||||
* @params $open-linear 是否开启线性渐变色
|
||||
* @params $deg 渐变色角度
|
||||
* @params $theme-color 当前配色
|
||||
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
|
||||
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
|
||||
* @params [Array] $per-list 渐变色比例
|
||||
*/
|
||||
/**
|
||||
* BEM,定义块(b)
|
||||
*/
|
||||
/* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
|
||||
/* 此方法用于生成穿透样式 */
|
||||
/* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
|
||||
/* 定义状态(m) */
|
||||
/* 定义状态(m) */
|
||||
/* 对于需要需要嵌套在 m 底下的 e,调用这个混合宏,一般在切换整个组件的状态,如切换颜色的时候 */
|
||||
/* 状态,生成 is-$state 类名 */
|
||||
/**
|
||||
* 常用混合宏
|
||||
*/
|
||||
/* 单行超出隐藏 */
|
||||
/* 多行超出隐藏 */
|
||||
/* 清除浮动 */
|
||||
/* 0.5px 边框 指定方向*/
|
||||
/* 0.5px 边框 环绕 */
|
||||
/**
|
||||
* 三角形实现尖角样式,适用于背景透明情况
|
||||
* @param $size 三角形高,底边为 $size * 2
|
||||
* @param $bg 三角形背景颜色
|
||||
*/
|
||||
/**
|
||||
* 正方形实现尖角样式,适用于背景不透明情况
|
||||
* @param $size 正方形边长
|
||||
* @param $bg 正方形背景颜色
|
||||
* @param $z-index z-index属性值,不得大于外部包裹器
|
||||
* @param $box-shadow 阴影
|
||||
*/
|
||||
.wot-theme-dark .wd-input__placeholder {
|
||||
color: var(--wot-dark-color3, rgba(232, 230, 227, 0.8));
|
||||
}
|
||||
.wd-input__placeholder {
|
||||
color: var(--wot-input-placeholder-color, #bfbfbf);
|
||||
}
|
||||
.wd-input__placeholder.is-error {
|
||||
color: var(--wot-input-error-color, var(--wot-color-danger, #fa4350));
|
||||
}
|
||||
19
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-loading/types.js
vendored
Normal file
19
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-loading/types.js
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
const uni_modules_wotDesignUni_components_common_props = require("../common/props.js");
|
||||
const loadingProps = {
|
||||
...uni_modules_wotDesignUni_components_common_props.baseProps,
|
||||
/**
|
||||
* 加载指示器类型,可选值:'outline' | 'ring'
|
||||
*/
|
||||
type: uni_modules_wotDesignUni_components_common_props.makeStringProp("ring"),
|
||||
/**
|
||||
* 设置加载指示器颜色
|
||||
*/
|
||||
color: uni_modules_wotDesignUni_components_common_props.makeStringProp("#4D80F0"),
|
||||
/**
|
||||
* 设置加载指示器大小
|
||||
*/
|
||||
size: uni_modules_wotDesignUni_components_common_props.makeNumericProp("")
|
||||
};
|
||||
exports.loadingProps = loadingProps;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-loading/types.js.map
|
||||
82
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-loading/wd-loading.js
vendored
Normal file
82
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-loading/wd-loading.js
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_wotDesignUni_components_common_base64 = require("../common/base64.js");
|
||||
const uni_modules_wotDesignUni_components_common_util = require("../common/util.js");
|
||||
const uni_modules_wotDesignUni_components_wdLoading_types = require("./types.js");
|
||||
const __default__ = {
|
||||
name: "wd-loading",
|
||||
options: {
|
||||
virtualHost: true,
|
||||
addGlobalClass: true,
|
||||
styleIsolation: "shared"
|
||||
}
|
||||
};
|
||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
...__default__,
|
||||
props: uni_modules_wotDesignUni_components_wdLoading_types.loadingProps,
|
||||
setup(__props) {
|
||||
const svgDefineId = uni_modules_wotDesignUni_components_common_util.context.id++;
|
||||
const svgDefineId1 = uni_modules_wotDesignUni_components_common_util.context.id++;
|
||||
const svgDefineId2 = uni_modules_wotDesignUni_components_common_util.context.id++;
|
||||
const icon = {
|
||||
outline(color = "#4D80F0") {
|
||||
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 42 42"><defs><linearGradient x1="100%" y1="0%" x2="0%" y2="0%" id="${svgDefineId}"><stop stop-color="#FFF" offset="0%" stop-opacity="0"/><stop stop-color="#FFF" offset="100%"/></linearGradient></defs><g fill="none" fill-rule="evenodd"><path d="M21 1c11.046 0 20 8.954 20 20s-8.954 20-20 20S1 32.046 1 21 9.954 1 21 1zm0 7C13.82 8 8 13.82 8 21s5.82 13 13 13 13-5.82 13-13S28.18 8 21 8z" fill="${color}"/><path d="M4.599 21c0 9.044 7.332 16.376 16.376 16.376 9.045 0 16.376-7.332 16.376-16.376" stroke="url(#${svgDefineId}) " stroke-width="3.5" stroke-linecap="round"/></g></svg>`;
|
||||
},
|
||||
ring(color = "#4D80F0", intermediateColor2 = "#a6bff7") {
|
||||
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200"><linearGradient id="${svgDefineId1}" gradientUnits="userSpaceOnUse" x1="50" x2="50" y2="180"><stop offset="0" stop-color="${color}"></stop> <stop offset="1" stop-color="${intermediateColor2}"></stop></linearGradient> <path fill="url(#${svgDefineId1})" d="M20 100c0-44.1 35.9-80 80-80V0C44.8 0 0 44.8 0 100s44.8 100 100 100v-20c-44.1 0-80-35.9-80-80z"></path> <linearGradient id="${svgDefineId2}" gradientUnits="userSpaceOnUse" x1="150" y1="20" x2="150" y2="180"><stop offset="0" stop-color="#fff" stop-opacity="0"></stop> <stop offset="1" stop-color="${intermediateColor2}"></stop></linearGradient> <path fill="url(#${svgDefineId2})" d="M100 0v20c44.1 0 80 35.9 80 80s-35.9 80-80 80v20c55.2 0 100-44.8 100-100S155.2 0 100 0z"></path> <circle cx="100" cy="10" r="10" fill="${color}"></circle></svg>`;
|
||||
}
|
||||
};
|
||||
const props = __props;
|
||||
const svg = common_vendor.ref("");
|
||||
const intermediateColor = common_vendor.ref("");
|
||||
const iconSize = common_vendor.ref(null);
|
||||
common_vendor.watch(
|
||||
() => props.size,
|
||||
(newVal) => {
|
||||
iconSize.value = uni_modules_wotDesignUni_components_common_util.addUnit(newVal);
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
common_vendor.watch(
|
||||
() => props.type,
|
||||
() => {
|
||||
buildSvg();
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
const rootStyle = common_vendor.computed(() => {
|
||||
const style = {};
|
||||
if (uni_modules_wotDesignUni_components_common_util.isDef(iconSize.value)) {
|
||||
style.height = uni_modules_wotDesignUni_components_common_util.addUnit(iconSize.value);
|
||||
style.width = uni_modules_wotDesignUni_components_common_util.addUnit(iconSize.value);
|
||||
}
|
||||
return `${uni_modules_wotDesignUni_components_common_util.objToStyle(style)} ${props.customStyle}`;
|
||||
});
|
||||
common_vendor.onBeforeMount(() => {
|
||||
intermediateColor.value = uni_modules_wotDesignUni_components_common_util.gradient(props.color, "#ffffff", 2)[1];
|
||||
buildSvg();
|
||||
});
|
||||
function buildSvg() {
|
||||
const { type, color } = props;
|
||||
let ringType = uni_modules_wotDesignUni_components_common_util.isDef(type) ? type : "ring";
|
||||
const svgStr = `"data:image/svg+xml;base64,${uni_modules_wotDesignUni_components_common_base64.encode(ringType === "ring" ? icon[ringType](color, intermediateColor.value) : icon[ringType](color))}"`;
|
||||
svg.value = svgStr;
|
||||
}
|
||||
return (_ctx, _cache) => {
|
||||
return {
|
||||
a: common_vendor.s(`background-image: url(${svg.value});`),
|
||||
b: common_vendor.n(`wd-loading ${props.customClass}`),
|
||||
c: common_vendor.s(rootStyle.value)
|
||||
};
|
||||
};
|
||||
}
|
||||
});
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-f2b508ee"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-loading/wd-loading.js.map
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<view class="{{['data-v-f2b508ee', b]}}" style="{{c}}"><view class="wd-loading__body data-v-f2b508ee"><view class="wd-loading__svg data-v-f2b508ee" style="{{a}}"></view></view></view>
|
||||
194
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-loading/wd-loading.wxss
vendored
Normal file
194
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-loading/wd-loading.wxss
vendored
Normal file
@@ -0,0 +1,194 @@
|
||||
/* 水平间距 */
|
||||
/* 水平间距 */
|
||||
/**
|
||||
* 混合宏
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/**
|
||||
* 辅助函数
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/* 转换成字符串 */
|
||||
/* 判断是否存在 Modifier */
|
||||
/* 判断是否存在伪类 */
|
||||
/**
|
||||
* 主题色切换
|
||||
* @params $theme-color 主题色
|
||||
* @params $type 变暗’dark‘ 变亮 'light'
|
||||
* @params $mix-color 自己设置的混色
|
||||
*/
|
||||
/**
|
||||
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
|
||||
* @params $open-linear 是否开启线性渐变色
|
||||
* @params $deg 渐变色角度
|
||||
* @params $theme-color 当前配色
|
||||
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
|
||||
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
|
||||
* @params [Array] $per-list 渐变色比例
|
||||
*/
|
||||
/**
|
||||
* BEM,定义块(b)
|
||||
*/
|
||||
/* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
|
||||
/* 此方法用于生成穿透样式 */
|
||||
/* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
|
||||
/* 定义状态(m) */
|
||||
/* 定义状态(m) */
|
||||
/* 对于需要需要嵌套在 m 底下的 e,调用这个混合宏,一般在切换整个组件的状态,如切换颜色的时候 */
|
||||
/* 状态,生成 is-$state 类名 */
|
||||
/**
|
||||
* 常用混合宏
|
||||
*/
|
||||
/* 单行超出隐藏 */
|
||||
/* 多行超出隐藏 */
|
||||
/* 清除浮动 */
|
||||
/* 0.5px 边框 指定方向*/
|
||||
/* 0.5px 边框 环绕 */
|
||||
/**
|
||||
* 三角形实现尖角样式,适用于背景透明情况
|
||||
* @param $size 三角形高,底边为 $size * 2
|
||||
* @param $bg 三角形背景颜色
|
||||
*/
|
||||
/**
|
||||
* 正方形实现尖角样式,适用于背景不透明情况
|
||||
* @param $size 正方形边长
|
||||
* @param $bg 正方形背景颜色
|
||||
* @param $z-index z-index属性值,不得大于外部包裹器
|
||||
* @param $box-shadow 阴影
|
||||
*/
|
||||
/**
|
||||
* 辅助函数
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/* 转换成字符串 */
|
||||
/* 判断是否存在 Modifier */
|
||||
/* 判断是否存在伪类 */
|
||||
/**
|
||||
* 主题色切换
|
||||
* @params $theme-color 主题色
|
||||
* @params $type 变暗’dark‘ 变亮 'light'
|
||||
* @params $mix-color 自己设置的混色
|
||||
*/
|
||||
/**
|
||||
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
|
||||
* @params $open-linear 是否开启线性渐变色
|
||||
* @params $deg 渐变色角度
|
||||
* @params $theme-color 当前配色
|
||||
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
|
||||
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
|
||||
* @params [Array] $per-list 渐变色比例
|
||||
*/
|
||||
/**
|
||||
* UI规范基础变量
|
||||
*/
|
||||
/*----------------------------------------- Theme color. start ----------------------------------------*/
|
||||
/* 主题颜色 */
|
||||
/* 辅助色 */
|
||||
/* 文字颜色(默认浅色背景下 */
|
||||
/* 暗黑模式 */
|
||||
/* 图形颜色 */
|
||||
/*----------------------------------------- Theme color. end -------------------------------------------*/
|
||||
/*-------------------------------- Theme color application size. start --------------------------------*/
|
||||
/* 文字字号 */
|
||||
/* 文字字重 */
|
||||
/* 尺寸 */
|
||||
/*-------------------------------- Theme color application size. end --------------------------------*/
|
||||
/* component var */
|
||||
/* action-sheet */
|
||||
/* badge */
|
||||
/* button */
|
||||
/* cell */
|
||||
/* calendar */
|
||||
/* checkbox */
|
||||
/* collapse */
|
||||
/* divider */
|
||||
/* drop-menu */
|
||||
/* input-number */
|
||||
/* input */
|
||||
/* textarea */
|
||||
/* loadmore */
|
||||
/* message-box */
|
||||
/* notice-bar */
|
||||
/* pagination */
|
||||
/* picker */
|
||||
/* col-picker */
|
||||
/* overlay */
|
||||
/* popup */
|
||||
/* progress */
|
||||
/* radio */
|
||||
/* search */
|
||||
/* slider */
|
||||
/* sort-button */
|
||||
/* steps */
|
||||
/* switch */
|
||||
/* tabs */
|
||||
/* tag */
|
||||
/* toast */
|
||||
/* loading */
|
||||
/* tooltip */
|
||||
/* popover */
|
||||
/* grid-item */
|
||||
/* statustip */
|
||||
/* card */
|
||||
/* upload */
|
||||
/* curtain */
|
||||
/* notify */
|
||||
/* skeleton */
|
||||
/* circle */
|
||||
/* swiper */
|
||||
/* swiper-nav */
|
||||
/* segmented */
|
||||
/* tabbar */
|
||||
/* tabbar-item */
|
||||
/* navbar */
|
||||
/* navbar-capsule */
|
||||
/* table */
|
||||
/* sidebar */
|
||||
/* sidebar-item */
|
||||
/* fab */
|
||||
/* count-down */
|
||||
/* keyboard */
|
||||
/* number-keyboard */
|
||||
/* passwod-input */
|
||||
/* form-item */
|
||||
/* backtop */
|
||||
/* index-bar */
|
||||
/* text */
|
||||
/* video-preview */
|
||||
/* img-cropper */
|
||||
/* floating-panel */
|
||||
/* signature */
|
||||
.wd-loading.data-v-f2b508ee {
|
||||
font-size: 0;
|
||||
line-height: 0;
|
||||
vertical-align: middle;
|
||||
display: inline-block;
|
||||
width: var(--wot-loading-size, 32px);
|
||||
height: var(--wot-loading-size, 32px);
|
||||
}
|
||||
.wd-loading__body.data-v-f2b508ee {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
animation: wd-rotate-f2b508ee 0.8s linear infinite;
|
||||
animation-duration: 2s;
|
||||
}
|
||||
.wd-loading__svg.data-v-f2b508ee {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
@keyframes wd-rotate-f2b508ee {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
76
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-message-box/index.js
vendored
Normal file
76
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-message-box/index.js
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_wotDesignUni_components_common_util = require("../common/util.js");
|
||||
const messageDefaultOptionKey = "__MESSAGE_OPTION__";
|
||||
const None = Symbol("None");
|
||||
const defaultOptions = {
|
||||
title: "",
|
||||
showCancelButton: false,
|
||||
show: false,
|
||||
closeOnClickModal: true,
|
||||
msg: "",
|
||||
type: "alert",
|
||||
inputType: "text",
|
||||
inputValue: "",
|
||||
showErr: false,
|
||||
zIndex: 99,
|
||||
lazyRender: true,
|
||||
inputError: ""
|
||||
};
|
||||
function useMessage(selector = "") {
|
||||
const messageOptionKey = selector ? messageDefaultOptionKey + selector : messageDefaultOptionKey;
|
||||
const messageOption = common_vendor.inject(messageOptionKey, common_vendor.ref(None));
|
||||
if (messageOption.value === None) {
|
||||
messageOption.value = defaultOptions;
|
||||
common_vendor.provide(messageOptionKey, messageOption);
|
||||
}
|
||||
const createMethod = (type) => {
|
||||
return (options) => {
|
||||
const messageOptions = uni_modules_wotDesignUni_components_common_util.deepMerge({ type }, typeof options === "string" ? { title: options } : options);
|
||||
if (messageOptions.type === "confirm" || messageOptions.type === "prompt") {
|
||||
messageOptions.showCancelButton = true;
|
||||
} else {
|
||||
messageOptions.showCancelButton = false;
|
||||
}
|
||||
return show(messageOptions);
|
||||
};
|
||||
};
|
||||
const show = (option) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const options = uni_modules_wotDesignUni_components_common_util.deepMerge(defaultOptions, typeof option === "string" ? { title: option } : option);
|
||||
messageOption.value = uni_modules_wotDesignUni_components_common_util.deepMerge(options, {
|
||||
show: true,
|
||||
success: (res) => {
|
||||
close();
|
||||
resolve(res);
|
||||
},
|
||||
fail: (res) => {
|
||||
close();
|
||||
reject(res);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
const alert = createMethod("alert");
|
||||
const confirm = createMethod("confirm");
|
||||
const prompt = createMethod("prompt");
|
||||
const close = () => {
|
||||
if (messageOption.value !== None) {
|
||||
messageOption.value.show = false;
|
||||
}
|
||||
};
|
||||
return {
|
||||
show,
|
||||
alert,
|
||||
confirm,
|
||||
prompt,
|
||||
close
|
||||
};
|
||||
}
|
||||
const getMessageDefaultOptionKey = (selector) => {
|
||||
return selector ? `${messageDefaultOptionKey}${selector}` : messageDefaultOptionKey;
|
||||
};
|
||||
exports.defaultOptions = defaultOptions;
|
||||
exports.getMessageDefaultOptionKey = getMessageDefaultOptionKey;
|
||||
exports.useMessage = useMessage;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-message-box/index.js.map
|
||||
15
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-message-box/types.js
vendored
Normal file
15
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-message-box/types.js
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
const uni_modules_wotDesignUni_components_common_props = require("../common/props.js");
|
||||
const messageBoxProps = {
|
||||
...uni_modules_wotDesignUni_components_common_props.baseProps,
|
||||
/**
|
||||
* 指定唯一标识
|
||||
*/
|
||||
selector: uni_modules_wotDesignUni_components_common_props.makeStringProp(""),
|
||||
/**
|
||||
* 是否从页面中脱离出来,用于解决各种 fixed 失效问题 (H5: teleport, APP: renderjs, 小程序: root-portal)
|
||||
*/
|
||||
rootPortal: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false)
|
||||
};
|
||||
exports.messageBoxProps = messageBoxProps;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-message-box/types.js.map
|
||||
268
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-message-box/wd-message-box.js
vendored
Normal file
268
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-message-box/wd-message-box.js
vendored
Normal file
@@ -0,0 +1,268 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_wotDesignUni_components_wdMessageBox_types = require("./types.js");
|
||||
const uni_modules_wotDesignUni_components_wdMessageBox_index = require("./index.js");
|
||||
const uni_modules_wotDesignUni_components_common_util = require("../common/util.js");
|
||||
const uni_modules_wotDesignUni_components_composables_useTranslate = require("../composables/useTranslate.js");
|
||||
if (!Math) {
|
||||
(wdInput + wdButton + wdPopup)();
|
||||
}
|
||||
const wdPopup = () => "../wd-popup/wd-popup.js";
|
||||
const wdButton = () => "../wd-button/wd-button.js";
|
||||
const wdInput = () => "../wd-input/wd-input.js";
|
||||
const __default__ = {
|
||||
name: "wd-message-box",
|
||||
options: {
|
||||
virtualHost: true,
|
||||
addGlobalClass: true,
|
||||
styleIsolation: "shared"
|
||||
}
|
||||
};
|
||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
...__default__,
|
||||
props: uni_modules_wotDesignUni_components_wdMessageBox_types.messageBoxProps,
|
||||
setup(__props) {
|
||||
const props = __props;
|
||||
const { translate } = uni_modules_wotDesignUni_components_composables_useTranslate.useTranslate("message-box");
|
||||
const rootClass = common_vendor.computed(() => {
|
||||
return `wd-message-box__container ${props.customClass}`;
|
||||
});
|
||||
const bodyClass = common_vendor.computed(() => {
|
||||
return `wd-message-box__body ${!messageState.title ? "is-no-title" : ""} ${messageState.type === "prompt" ? "is-prompt" : ""}`;
|
||||
});
|
||||
const messageOptionKey = uni_modules_wotDesignUni_components_wdMessageBox_index.getMessageDefaultOptionKey(props.selector);
|
||||
const messageOption = common_vendor.inject(messageOptionKey, common_vendor.ref(uni_modules_wotDesignUni_components_wdMessageBox_index.defaultOptions));
|
||||
const messageState = common_vendor.reactive({
|
||||
msg: "",
|
||||
// 消息内容
|
||||
show: false,
|
||||
// 是否显示弹框
|
||||
title: "",
|
||||
// 标题
|
||||
showCancelButton: false,
|
||||
// 是否展示取消按钮
|
||||
closeOnClickModal: true,
|
||||
// 是否支持点击蒙层关闭
|
||||
confirmButtonText: "",
|
||||
// 确定按钮文案
|
||||
cancelButtonText: "",
|
||||
// 取消按钮文案
|
||||
type: "alert",
|
||||
// 弹框类型
|
||||
inputType: "text",
|
||||
// 输入框类型
|
||||
inputValue: "",
|
||||
// 输入框初始值
|
||||
inputPlaceholder: "",
|
||||
// 输入框placeholder
|
||||
inputError: "",
|
||||
// 输入框错误提示文案
|
||||
showErr: false,
|
||||
// 是否显示错误提示
|
||||
zIndex: 99,
|
||||
// 弹窗层级
|
||||
lazyRender: true
|
||||
// 弹层内容懒渲染
|
||||
});
|
||||
const customConfirmProps = common_vendor.computed(() => {
|
||||
const buttonProps = uni_modules_wotDesignUni_components_common_util.deepAssign(
|
||||
{
|
||||
block: true
|
||||
},
|
||||
uni_modules_wotDesignUni_components_common_util.isDef(messageState.confirmButtonProps) ? uni_modules_wotDesignUni_components_common_util.omitBy(messageState.confirmButtonProps, uni_modules_wotDesignUni_components_common_util.isUndefined) : {}
|
||||
);
|
||||
buttonProps.customClass = `${buttonProps.customClass || ""} wd-message-box__actions-btn`;
|
||||
return buttonProps;
|
||||
});
|
||||
const customCancelProps = common_vendor.computed(() => {
|
||||
const buttonProps = uni_modules_wotDesignUni_components_common_util.deepAssign(
|
||||
{
|
||||
block: true,
|
||||
type: "info"
|
||||
},
|
||||
uni_modules_wotDesignUni_components_common_util.isDef(messageState.cancelButtonProps) ? uni_modules_wotDesignUni_components_common_util.omitBy(messageState.cancelButtonProps, uni_modules_wotDesignUni_components_common_util.isUndefined) : {}
|
||||
);
|
||||
buttonProps.customClass = `${buttonProps.customClass || ""} wd-message-box__actions-btn`;
|
||||
return buttonProps;
|
||||
});
|
||||
common_vendor.watch(
|
||||
() => messageOption.value,
|
||||
(newVal) => {
|
||||
reset(newVal);
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
common_vendor.watch(
|
||||
() => messageState.show,
|
||||
(newValue) => {
|
||||
resetErr(!!newValue);
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
function toggleModal(action) {
|
||||
if (action === "modal" && !messageState.closeOnClickModal) {
|
||||
return;
|
||||
}
|
||||
if (messageState.type === "prompt" && action === "confirm" && !validate()) {
|
||||
return;
|
||||
}
|
||||
switch (action) {
|
||||
case "confirm":
|
||||
if (messageState.beforeConfirm) {
|
||||
messageState.beforeConfirm({
|
||||
resolve: (isPass) => {
|
||||
if (isPass) {
|
||||
handleConfirm({
|
||||
action,
|
||||
value: messageState.inputValue
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
handleConfirm({
|
||||
action,
|
||||
value: messageState.inputValue
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "cancel":
|
||||
handleCancel({
|
||||
action
|
||||
});
|
||||
break;
|
||||
default:
|
||||
handleCancel({
|
||||
action: "modal"
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
function handleConfirm(result) {
|
||||
messageState.show = false;
|
||||
if (uni_modules_wotDesignUni_components_common_util.isFunction(messageState.success)) {
|
||||
messageState.success(result);
|
||||
}
|
||||
}
|
||||
function handleCancel(result) {
|
||||
messageState.show = false;
|
||||
if (uni_modules_wotDesignUni_components_common_util.isFunction(messageState.fail)) {
|
||||
messageState.fail(result);
|
||||
}
|
||||
}
|
||||
function validate() {
|
||||
if (messageState.inputPattern && !messageState.inputPattern.test(String(messageState.inputValue))) {
|
||||
messageState.showErr = true;
|
||||
return false;
|
||||
}
|
||||
if (typeof messageState.inputValidate === "function") {
|
||||
const validateResult = messageState.inputValidate(messageState.inputValue);
|
||||
if (!validateResult) {
|
||||
messageState.showErr = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
messageState.showErr = false;
|
||||
return true;
|
||||
}
|
||||
function resetErr(val) {
|
||||
if (val === false) {
|
||||
messageState.showErr = false;
|
||||
}
|
||||
}
|
||||
function inputValChange({ value }) {
|
||||
if (value === "") {
|
||||
messageState.showErr = false;
|
||||
return;
|
||||
}
|
||||
messageState.inputValue = value;
|
||||
}
|
||||
function reset(option) {
|
||||
if (option) {
|
||||
messageState.title = uni_modules_wotDesignUni_components_common_util.isDef(option.title) ? option.title : "";
|
||||
messageState.showCancelButton = uni_modules_wotDesignUni_components_common_util.isDef(option.showCancelButton) ? option.showCancelButton : false;
|
||||
messageState.show = option.show;
|
||||
messageState.closeOnClickModal = option.closeOnClickModal;
|
||||
messageState.confirmButtonText = option.confirmButtonText;
|
||||
messageState.cancelButtonText = option.cancelButtonText;
|
||||
messageState.msg = option.msg;
|
||||
messageState.type = option.type;
|
||||
messageState.inputType = option.inputType;
|
||||
messageState.inputSize = option.inputSize;
|
||||
messageState.inputValue = option.inputValue;
|
||||
messageState.inputPlaceholder = option.inputPlaceholder;
|
||||
messageState.inputPattern = option.inputPattern;
|
||||
messageState.inputValidate = option.inputValidate;
|
||||
messageState.success = option.success;
|
||||
messageState.fail = option.fail;
|
||||
messageState.beforeConfirm = option.beforeConfirm;
|
||||
messageState.inputError = option.inputError;
|
||||
messageState.showErr = option.showErr;
|
||||
messageState.zIndex = option.zIndex;
|
||||
messageState.lazyRender = option.lazyRender;
|
||||
messageState.confirmButtonProps = option.confirmButtonProps;
|
||||
messageState.cancelButtonProps = option.cancelButtonProps;
|
||||
}
|
||||
}
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: messageState.title
|
||||
}, messageState.title ? {
|
||||
b: common_vendor.t(messageState.title)
|
||||
} : {}, {
|
||||
c: messageState.type === "prompt"
|
||||
}, messageState.type === "prompt" ? common_vendor.e({
|
||||
d: common_vendor.o(inputValChange),
|
||||
e: common_vendor.o(($event) => messageState.inputValue = $event),
|
||||
f: common_vendor.p({
|
||||
type: messageState.inputType,
|
||||
size: messageState.inputSize,
|
||||
placeholder: messageState.inputPlaceholder,
|
||||
modelValue: messageState.inputValue
|
||||
}),
|
||||
g: messageState.showErr
|
||||
}, messageState.showErr ? {
|
||||
h: common_vendor.t(messageState.inputError || common_vendor.unref(translate)("inputNoValidate"))
|
||||
} : {}) : {}, {
|
||||
i: common_vendor.t(messageState.msg),
|
||||
j: common_vendor.n(bodyClass.value),
|
||||
k: messageState.showCancelButton
|
||||
}, messageState.showCancelButton ? {
|
||||
l: common_vendor.t(messageState.cancelButtonText || common_vendor.unref(translate)("cancel")),
|
||||
m: common_vendor.o(($event) => toggleModal("cancel")),
|
||||
n: common_vendor.p({
|
||||
...customCancelProps.value
|
||||
})
|
||||
} : {}, {
|
||||
o: common_vendor.t(messageState.confirmButtonText || common_vendor.unref(translate)("confirm")),
|
||||
p: common_vendor.o(($event) => toggleModal("confirm")),
|
||||
q: common_vendor.p({
|
||||
...customConfirmProps.value
|
||||
}),
|
||||
r: common_vendor.n(`wd-message-box__actions ${messageState.showCancelButton ? "wd-message-box__flex" : "wd-message-box__block"}`),
|
||||
s: common_vendor.n(rootClass.value),
|
||||
t: common_vendor.o(($event) => toggleModal("modal")),
|
||||
v: common_vendor.o(($event) => messageState.show = $event),
|
||||
w: common_vendor.p({
|
||||
transition: "zoom-in",
|
||||
["close-on-click-modal"]: messageState.closeOnClickModal,
|
||||
["lazy-render"]: messageState.lazyRender,
|
||||
["custom-class"]: "wd-message-box",
|
||||
["z-index"]: messageState.zIndex,
|
||||
duration: 200,
|
||||
["root-portal"]: _ctx.rootPortal,
|
||||
modelValue: messageState.show
|
||||
})
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-c8139c88"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-message-box/wd-message-box.js.map
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"wd-popup": "../wd-popup/wd-popup",
|
||||
"wd-button": "../wd-button/wd-button",
|
||||
"wd-input": "../wd-input/wd-input"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<view class="data-v-c8139c88"><wd-popup wx:if="{{w}}" class="data-v-c8139c88" u-s="{{['d']}}" bindclickModal="{{t}}" u-i="c8139c88-0" bind:__l="__l" bindupdateModelValue="{{v}}" u-p="{{w}}"><view class="{{['data-v-c8139c88', s]}}"><view class="{{['data-v-c8139c88', j]}}"><view wx:if="{{a}}" class="wd-message-box__title data-v-c8139c88">{{b}}</view><view class="wd-message-box__content data-v-c8139c88"><block wx:if="{{c}}"><wd-input wx:if="{{f}}" class="data-v-c8139c88" bindinput="{{d}}" u-i="c8139c88-1,c8139c88-0" bind:__l="__l" bindupdateModelValue="{{e}}" u-p="{{f}}"/><view wx:if="{{g}}" class="wd-message-box__input-error data-v-c8139c88">{{h}}</view></block><block wx:if="{{$slots.d}}"><slot></slot></block><block wx:else>{{i}}</block></view></view><view class="{{['data-v-c8139c88', r]}}"><wd-button wx:if="{{k}}" class="data-v-c8139c88" u-s="{{['d']}}" bindclick="{{m}}" u-i="c8139c88-2,c8139c88-0" bind:__l="__l" u-p="{{n}}">{{l}}</wd-button><wd-button wx:if="{{q}}" class="data-v-c8139c88" u-s="{{['d']}}" bindclick="{{p}}" u-i="c8139c88-3,c8139c88-0" bind:__l="__l" u-p="{{q}}">{{o}}</wd-button></view></view></wd-popup></view>
|
||||
@@ -0,0 +1,246 @@
|
||||
/* 水平间距 */
|
||||
/* 水平间距 */
|
||||
/**
|
||||
* 辅助函数
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/* 转换成字符串 */
|
||||
/* 判断是否存在 Modifier */
|
||||
/* 判断是否存在伪类 */
|
||||
/**
|
||||
* 主题色切换
|
||||
* @params $theme-color 主题色
|
||||
* @params $type 变暗’dark‘ 变亮 'light'
|
||||
* @params $mix-color 自己设置的混色
|
||||
*/
|
||||
/**
|
||||
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
|
||||
* @params $open-linear 是否开启线性渐变色
|
||||
* @params $deg 渐变色角度
|
||||
* @params $theme-color 当前配色
|
||||
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
|
||||
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
|
||||
* @params [Array] $per-list 渐变色比例
|
||||
*/
|
||||
/**
|
||||
* UI规范基础变量
|
||||
*/
|
||||
/*----------------------------------------- Theme color. start ----------------------------------------*/
|
||||
/* 主题颜色 */
|
||||
/* 辅助色 */
|
||||
/* 文字颜色(默认浅色背景下 */
|
||||
/* 暗黑模式 */
|
||||
/* 图形颜色 */
|
||||
/*----------------------------------------- Theme color. end -------------------------------------------*/
|
||||
/*-------------------------------- Theme color application size. start --------------------------------*/
|
||||
/* 文字字号 */
|
||||
/* 文字字重 */
|
||||
/* 尺寸 */
|
||||
/*-------------------------------- Theme color application size. end --------------------------------*/
|
||||
/* component var */
|
||||
/* action-sheet */
|
||||
/* badge */
|
||||
/* button */
|
||||
/* cell */
|
||||
/* calendar */
|
||||
/* checkbox */
|
||||
/* collapse */
|
||||
/* divider */
|
||||
/* drop-menu */
|
||||
/* input-number */
|
||||
/* input */
|
||||
/* textarea */
|
||||
/* loadmore */
|
||||
/* message-box */
|
||||
/* notice-bar */
|
||||
/* pagination */
|
||||
/* picker */
|
||||
/* col-picker */
|
||||
/* overlay */
|
||||
/* popup */
|
||||
/* progress */
|
||||
/* radio */
|
||||
/* search */
|
||||
/* slider */
|
||||
/* sort-button */
|
||||
/* steps */
|
||||
/* switch */
|
||||
/* tabs */
|
||||
/* tag */
|
||||
/* toast */
|
||||
/* loading */
|
||||
/* tooltip */
|
||||
/* popover */
|
||||
/* grid-item */
|
||||
/* statustip */
|
||||
/* card */
|
||||
/* upload */
|
||||
/* curtain */
|
||||
/* notify */
|
||||
/* skeleton */
|
||||
/* circle */
|
||||
/* swiper */
|
||||
/* swiper-nav */
|
||||
/* segmented */
|
||||
/* tabbar */
|
||||
/* tabbar-item */
|
||||
/* navbar */
|
||||
/* navbar-capsule */
|
||||
/* table */
|
||||
/* sidebar */
|
||||
/* sidebar-item */
|
||||
/* fab */
|
||||
/* count-down */
|
||||
/* keyboard */
|
||||
/* number-keyboard */
|
||||
/* passwod-input */
|
||||
/* form-item */
|
||||
/* backtop */
|
||||
/* index-bar */
|
||||
/* text */
|
||||
/* video-preview */
|
||||
/* img-cropper */
|
||||
/* floating-panel */
|
||||
/* signature */
|
||||
/**
|
||||
* 混合宏
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/**
|
||||
* 辅助函数
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/* 转换成字符串 */
|
||||
/* 判断是否存在 Modifier */
|
||||
/* 判断是否存在伪类 */
|
||||
/**
|
||||
* 主题色切换
|
||||
* @params $theme-color 主题色
|
||||
* @params $type 变暗’dark‘ 变亮 'light'
|
||||
* @params $mix-color 自己设置的混色
|
||||
*/
|
||||
/**
|
||||
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
|
||||
* @params $open-linear 是否开启线性渐变色
|
||||
* @params $deg 渐变色角度
|
||||
* @params $theme-color 当前配色
|
||||
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
|
||||
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
|
||||
* @params [Array] $per-list 渐变色比例
|
||||
*/
|
||||
/**
|
||||
* BEM,定义块(b)
|
||||
*/
|
||||
/* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
|
||||
/* 此方法用于生成穿透样式 */
|
||||
/* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
|
||||
/* 定义状态(m) */
|
||||
/* 定义状态(m) */
|
||||
/* 对于需要需要嵌套在 m 底下的 e,调用这个混合宏,一般在切换整个组件的状态,如切换颜色的时候 */
|
||||
/* 状态,生成 is-$state 类名 */
|
||||
/**
|
||||
* 常用混合宏
|
||||
*/
|
||||
/* 单行超出隐藏 */
|
||||
/* 多行超出隐藏 */
|
||||
/* 清除浮动 */
|
||||
/* 0.5px 边框 指定方向*/
|
||||
/* 0.5px 边框 环绕 */
|
||||
/**
|
||||
* 三角形实现尖角样式,适用于背景透明情况
|
||||
* @param $size 三角形高,底边为 $size * 2
|
||||
* @param $bg 三角形背景颜色
|
||||
*/
|
||||
/**
|
||||
* 正方形实现尖角样式,适用于背景不透明情况
|
||||
* @param $size 正方形边长
|
||||
* @param $bg 正方形背景颜色
|
||||
* @param $z-index z-index属性值,不得大于外部包裹器
|
||||
* @param $box-shadow 阴影
|
||||
*/
|
||||
.wot-theme-dark .wd-message-box__body.data-v-c8139c88 {
|
||||
background-color: var(--wot-dark-background2, #1b1b1b);
|
||||
}
|
||||
.wot-theme-dark .wd-message-box__title.data-v-c8139c88 {
|
||||
color: var(--wot-dark-color, var(--wot-color-white, white));
|
||||
}
|
||||
.wot-theme-dark .wd-message-box__content.data-v-c8139c88 {
|
||||
color: var(--wot-dark-color3, rgba(232, 230, 227, 0.8));
|
||||
}
|
||||
.wot-theme-dark .wd-message-box__content.data-v-c8139c88::-webkit-scrollbar-thumb {
|
||||
background: var(--wot-dark-border-color, #3a3a3c);
|
||||
}
|
||||
.data-v-c8139c88 .wd-message-box {
|
||||
border-radius: var(--wot-message-box-radius, 16px);
|
||||
overflow: hidden;
|
||||
}
|
||||
.wd-message-box.data-v-c8139c88 {
|
||||
border-radius: var(--wot-message-box-radius, 16px);
|
||||
overflow: hidden;
|
||||
}
|
||||
.wd-message-box__container.data-v-c8139c88 {
|
||||
width: var(--wot-message-box-width, 300px);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.wd-message-box__body.data-v-c8139c88 {
|
||||
background-color: var(--wot-message-box-bg, var(--wot-color-white, white));
|
||||
padding: var(--wot-message-box-padding, 25px 24px 0);
|
||||
}
|
||||
.wd-message-box__body.is-no-title.data-v-c8139c88 {
|
||||
padding: 25px 24px 0px;
|
||||
}
|
||||
.wd-message-box__title.data-v-c8139c88 {
|
||||
text-align: center;
|
||||
font-size: var(--wot-message-box-title-fs, 16px);
|
||||
color: var(--wot-message-box-title-color, rgba(0, 0, 0, 0.85));
|
||||
line-height: 20px;
|
||||
font-weight: 500;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
.wd-message-box__content.data-v-c8139c88 {
|
||||
max-height: var(--wot-message-box-content-max-height, 264px);
|
||||
color: var(--wot-message-box-content-color, #666666);
|
||||
font-size: var(--wot-message-box-content-fs, 14px);
|
||||
text-align: center;
|
||||
overflow: auto;
|
||||
line-height: 20px;
|
||||
}
|
||||
.wd-message-box__content.data-v-c8139c88::-webkit-scrollbar {
|
||||
width: var(--wot-message-box-content-scrollbar-width, 4px);
|
||||
}
|
||||
.wd-message-box__content.data-v-c8139c88::-webkit-scrollbar-thumb {
|
||||
width: var(--wot-message-box-content-scrollbar-width, 4px);
|
||||
background: var(--wot-message-box-content-scrollbar-color, rgba(0, 0, 0, 0.1));
|
||||
border-radius: calc(var(--wot-message-box-content-scrollbar-width, 4px) / 2);
|
||||
}
|
||||
.wd-message-box__input-error.data-v-c8139c88 {
|
||||
min-height: 18px;
|
||||
margin-top: 2px;
|
||||
color: var(--wot-message-box-input-error-color, var(--wot-input-error-color, var(--wot-color-danger, #fa4350)));
|
||||
text-align: left;
|
||||
}
|
||||
.wd-message-box__input-error.is-hidden.data-v-c8139c88 {
|
||||
visibility: hidden;
|
||||
}
|
||||
.wd-message-box__actions.data-v-c8139c88 {
|
||||
padding: 24px;
|
||||
}
|
||||
.data-v-c8139c88 .wd-message-box__actions-btn:not(:last-child) {
|
||||
margin-right: 16px;
|
||||
}
|
||||
.wd-message-box__flex.data-v-c8139c88 {
|
||||
display: flex;
|
||||
}
|
||||
.wd-message-box__block.data-v-c8139c88 {
|
||||
display: block;
|
||||
}
|
||||
.wd-message-box__cancel.data-v-c8139c88 {
|
||||
margin-right: 16px;
|
||||
}
|
||||
51
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-navbar/types.js
vendored
Normal file
51
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-navbar/types.js
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
const uni_modules_wotDesignUni_components_common_props = require("../common/props.js");
|
||||
const navbarProps = {
|
||||
...uni_modules_wotDesignUni_components_common_props.baseProps,
|
||||
/**
|
||||
* 标题文字
|
||||
*/
|
||||
title: String,
|
||||
/**
|
||||
* 左侧文案
|
||||
*/
|
||||
leftText: String,
|
||||
/**
|
||||
* 右侧文案
|
||||
*/
|
||||
rightText: String,
|
||||
/**
|
||||
* 是否显示左侧箭头
|
||||
*/
|
||||
leftArrow: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 是否显示下边框
|
||||
*/
|
||||
bordered: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(true),
|
||||
/**
|
||||
* 是否固定到顶部
|
||||
*/
|
||||
fixed: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 固定在顶部时,是否在标签位置生成一个等高的占位元素
|
||||
*/
|
||||
placeholder: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 导航栏 z-index
|
||||
*/
|
||||
zIndex: uni_modules_wotDesignUni_components_common_props.makeNumberProp(500),
|
||||
/**
|
||||
* 是否开启顶部安全区适配
|
||||
*/
|
||||
safeAreaInsetTop: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 是否禁用左侧按钮,禁用时透明度降低,且无法点击
|
||||
*/
|
||||
leftDisabled: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 是否禁用右侧按钮,禁用时透明度降低,且无法点击
|
||||
*/
|
||||
rightDisabled: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false)
|
||||
};
|
||||
exports.navbarProps = navbarProps;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-navbar/types.js.map
|
||||
112
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-navbar/wd-navbar.js
vendored
Normal file
112
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-navbar/wd-navbar.js
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
"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_wdNavbar_types = require("./types.js");
|
||||
if (!Math) {
|
||||
wdIcon();
|
||||
}
|
||||
const wdIcon = () => "../wd-icon/wd-icon.js";
|
||||
const __default__ = {
|
||||
name: "wd-navbar",
|
||||
options: {
|
||||
virtualHost: true,
|
||||
addGlobalClass: true,
|
||||
styleIsolation: "shared"
|
||||
}
|
||||
};
|
||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
...__default__,
|
||||
props: uni_modules_wotDesignUni_components_wdNavbar_types.navbarProps,
|
||||
emits: ["click-left", "click-right"],
|
||||
setup(__props, { emit: __emit }) {
|
||||
const props = __props;
|
||||
const emit = __emit;
|
||||
const height = common_vendor.ref("");
|
||||
const { statusBarHeight } = common_vendor.index.getSystemInfoSync();
|
||||
common_vendor.watch(
|
||||
[() => props.fixed, () => props.placeholder],
|
||||
() => {
|
||||
setPlaceholderHeight();
|
||||
},
|
||||
{ deep: true, immediate: false }
|
||||
);
|
||||
const rootStyle = common_vendor.computed(() => {
|
||||
const style = {};
|
||||
if (props.fixed && uni_modules_wotDesignUni_components_common_util.isDef(props.zIndex)) {
|
||||
style["z-index"] = props.zIndex;
|
||||
}
|
||||
if (props.safeAreaInsetTop) {
|
||||
style["padding-top"] = uni_modules_wotDesignUni_components_common_util.addUnit(statusBarHeight || 0);
|
||||
}
|
||||
return `${uni_modules_wotDesignUni_components_common_util.objToStyle(style)}${props.customStyle}`;
|
||||
});
|
||||
common_vendor.onMounted(() => {
|
||||
if (props.fixed && props.placeholder) {
|
||||
common_vendor.nextTick$1(() => {
|
||||
setPlaceholderHeight();
|
||||
});
|
||||
}
|
||||
});
|
||||
function handleClickLeft() {
|
||||
if (!props.leftDisabled) {
|
||||
emit("click-left");
|
||||
}
|
||||
}
|
||||
function handleClickRight() {
|
||||
if (!props.rightDisabled) {
|
||||
emit("click-right");
|
||||
}
|
||||
}
|
||||
const { proxy } = common_vendor.getCurrentInstance();
|
||||
function setPlaceholderHeight() {
|
||||
if (!props.fixed || !props.placeholder) {
|
||||
return;
|
||||
}
|
||||
uni_modules_wotDesignUni_components_common_util.getRect(".wd-navbar", false, proxy).then((res) => {
|
||||
height.value = res.height;
|
||||
});
|
||||
}
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: _ctx.$slots.capsule
|
||||
}, _ctx.$slots.capsule ? {} : !_ctx.$slots.left ? common_vendor.e({
|
||||
c: _ctx.leftArrow
|
||||
}, _ctx.leftArrow ? {
|
||||
d: common_vendor.p({
|
||||
name: "arrow-left",
|
||||
["custom-class"]: "wd-navbar__arrow"
|
||||
})
|
||||
} : {}, {
|
||||
e: _ctx.leftText
|
||||
}, _ctx.leftText ? {
|
||||
f: common_vendor.t(_ctx.leftText)
|
||||
} : {}, {
|
||||
g: common_vendor.n(`wd-navbar__left ${_ctx.leftDisabled ? "is-disabled" : ""}`),
|
||||
h: common_vendor.o(handleClickLeft)
|
||||
}) : {
|
||||
i: common_vendor.n(`wd-navbar__left ${_ctx.leftDisabled ? "is-disabled" : ""}`),
|
||||
j: common_vendor.o(handleClickLeft)
|
||||
}, {
|
||||
b: !_ctx.$slots.left,
|
||||
k: !_ctx.$slots.title && _ctx.title
|
||||
}, !_ctx.$slots.title && _ctx.title ? {
|
||||
l: common_vendor.t(_ctx.title)
|
||||
} : {}, {
|
||||
m: _ctx.$slots.right || _ctx.rightText
|
||||
}, _ctx.$slots.right || _ctx.rightText ? common_vendor.e({
|
||||
n: !_ctx.$slots.right && _ctx.rightText
|
||||
}, !_ctx.$slots.right && _ctx.rightText ? {
|
||||
o: common_vendor.t(_ctx.rightText)
|
||||
} : {}, {
|
||||
p: common_vendor.n(`wd-navbar__right ${_ctx.rightDisabled ? "is-disabled" : ""}`),
|
||||
q: common_vendor.o(handleClickRight)
|
||||
}) : {}, {
|
||||
r: common_vendor.n(`wd-navbar ${_ctx.customClass} ${_ctx.fixed ? "is-fixed" : ""} ${_ctx.bordered ? "is-border" : ""}`),
|
||||
s: common_vendor.s(rootStyle.value),
|
||||
t: common_vendor.unref(uni_modules_wotDesignUni_components_common_util.addUnit)(height.value)
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
wx.createComponent(_sfc_main);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-navbar/wd-navbar.js.map
|
||||
6
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-navbar/wd-navbar.json
vendored
Normal file
6
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-navbar/wd-navbar.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"wd-icon": "../wd-icon/wd-icon"
|
||||
}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-navbar/wd-navbar.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-navbar/wd-navbar.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view style="{{'height:' + t}}"><view class="{{r}}" style="{{s}}"><view class="wd-navbar__content"><view wx:if="{{a}}" class="wd-navbar__capsule"><slot name="capsule"/></view><view wx:elif="{{b}}" class="{{g}}" bindtap="{{h}}"><wd-icon wx:if="{{c}}" u-i="a56cc726-0" bind:__l="__l" u-p="{{d}}"/><view wx:if="{{e}}" class="wd-navbar__text">{{f}}</view></view><view wx:else class="{{i}}" bindtap="{{j}}"><slot name="left"/></view><view class="wd-navbar__title"><slot name="title"/><block wx:if="{{k}}">{{l}}</block></view><view wx:if="{{m}}" class="{{p}}" bindtap="{{q}}"><slot name="right"/><view wx:if="{{n}}" class="wd-navbar__text" hover-class="wd-navbar__text--hover" hover-stay-time="{{70}}">{{o}}</view></view></view></view></view>
|
||||
252
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-navbar/wd-navbar.wxss
vendored
Normal file
252
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-navbar/wd-navbar.wxss
vendored
Normal file
@@ -0,0 +1,252 @@
|
||||
/* 水平间距 */
|
||||
/* 水平间距 */
|
||||
/**
|
||||
* 混合宏
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/**
|
||||
* 辅助函数
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/* 转换成字符串 */
|
||||
/* 判断是否存在 Modifier */
|
||||
/* 判断是否存在伪类 */
|
||||
/**
|
||||
* 主题色切换
|
||||
* @params $theme-color 主题色
|
||||
* @params $type 变暗’dark‘ 变亮 'light'
|
||||
* @params $mix-color 自己设置的混色
|
||||
*/
|
||||
/**
|
||||
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
|
||||
* @params $open-linear 是否开启线性渐变色
|
||||
* @params $deg 渐变色角度
|
||||
* @params $theme-color 当前配色
|
||||
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
|
||||
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
|
||||
* @params [Array] $per-list 渐变色比例
|
||||
*/
|
||||
/**
|
||||
* BEM,定义块(b)
|
||||
*/
|
||||
/* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
|
||||
/* 此方法用于生成穿透样式 */
|
||||
/* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
|
||||
/* 定义状态(m) */
|
||||
/* 定义状态(m) */
|
||||
/* 对于需要需要嵌套在 m 底下的 e,调用这个混合宏,一般在切换整个组件的状态,如切换颜色的时候 */
|
||||
/* 状态,生成 is-$state 类名 */
|
||||
/**
|
||||
* 常用混合宏
|
||||
*/
|
||||
/* 单行超出隐藏 */
|
||||
/* 多行超出隐藏 */
|
||||
/* 清除浮动 */
|
||||
/* 0.5px 边框 指定方向*/
|
||||
/* 0.5px 边框 环绕 */
|
||||
/**
|
||||
* 三角形实现尖角样式,适用于背景透明情况
|
||||
* @param $size 三角形高,底边为 $size * 2
|
||||
* @param $bg 三角形背景颜色
|
||||
*/
|
||||
/**
|
||||
* 正方形实现尖角样式,适用于背景不透明情况
|
||||
* @param $size 正方形边长
|
||||
* @param $bg 正方形背景颜色
|
||||
* @param $z-index z-index属性值,不得大于外部包裹器
|
||||
* @param $box-shadow 阴影
|
||||
*/
|
||||
/**
|
||||
* 辅助函数
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/* 转换成字符串 */
|
||||
/* 判断是否存在 Modifier */
|
||||
/* 判断是否存在伪类 */
|
||||
/**
|
||||
* 主题色切换
|
||||
* @params $theme-color 主题色
|
||||
* @params $type 变暗’dark‘ 变亮 'light'
|
||||
* @params $mix-color 自己设置的混色
|
||||
*/
|
||||
/**
|
||||
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
|
||||
* @params $open-linear 是否开启线性渐变色
|
||||
* @params $deg 渐变色角度
|
||||
* @params $theme-color 当前配色
|
||||
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
|
||||
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
|
||||
* @params [Array] $per-list 渐变色比例
|
||||
*/
|
||||
/**
|
||||
* UI规范基础变量
|
||||
*/
|
||||
/*----------------------------------------- Theme color. start ----------------------------------------*/
|
||||
/* 主题颜色 */
|
||||
/* 辅助色 */
|
||||
/* 文字颜色(默认浅色背景下 */
|
||||
/* 暗黑模式 */
|
||||
/* 图形颜色 */
|
||||
/*----------------------------------------- Theme color. end -------------------------------------------*/
|
||||
/*-------------------------------- Theme color application size. start --------------------------------*/
|
||||
/* 文字字号 */
|
||||
/* 文字字重 */
|
||||
/* 尺寸 */
|
||||
/*-------------------------------- Theme color application size. end --------------------------------*/
|
||||
/* component var */
|
||||
/* action-sheet */
|
||||
/* badge */
|
||||
/* button */
|
||||
/* cell */
|
||||
/* calendar */
|
||||
/* checkbox */
|
||||
/* collapse */
|
||||
/* divider */
|
||||
/* drop-menu */
|
||||
/* input-number */
|
||||
/* input */
|
||||
/* textarea */
|
||||
/* loadmore */
|
||||
/* message-box */
|
||||
/* notice-bar */
|
||||
/* pagination */
|
||||
/* picker */
|
||||
/* col-picker */
|
||||
/* overlay */
|
||||
/* popup */
|
||||
/* progress */
|
||||
/* radio */
|
||||
/* search */
|
||||
/* slider */
|
||||
/* sort-button */
|
||||
/* steps */
|
||||
/* switch */
|
||||
/* tabs */
|
||||
/* tag */
|
||||
/* toast */
|
||||
/* loading */
|
||||
/* tooltip */
|
||||
/* popover */
|
||||
/* grid-item */
|
||||
/* statustip */
|
||||
/* card */
|
||||
/* upload */
|
||||
/* curtain */
|
||||
/* notify */
|
||||
/* skeleton */
|
||||
/* circle */
|
||||
/* swiper */
|
||||
/* swiper-nav */
|
||||
/* segmented */
|
||||
/* tabbar */
|
||||
/* tabbar-item */
|
||||
/* navbar */
|
||||
/* navbar-capsule */
|
||||
/* table */
|
||||
/* sidebar */
|
||||
/* sidebar-item */
|
||||
/* fab */
|
||||
/* count-down */
|
||||
/* keyboard */
|
||||
/* number-keyboard */
|
||||
/* passwod-input */
|
||||
/* form-item */
|
||||
/* backtop */
|
||||
/* index-bar */
|
||||
/* text */
|
||||
/* video-preview */
|
||||
/* img-cropper */
|
||||
/* floating-panel */
|
||||
/* signature */
|
||||
.wot-theme-dark .wd-navbar {
|
||||
background-color: var(--wot-dark-background, #131313);
|
||||
}
|
||||
.wot-theme-dark .wd-navbar__title {
|
||||
color: var(--wot-dark-color, var(--wot-color-white, white));
|
||||
}
|
||||
.wot-theme-dark .wd-navbar__text {
|
||||
color: var(--wot-dark-color, var(--wot-color-white, white));
|
||||
}
|
||||
.wot-theme-dark .wd-navbar .wd-navbar__arrow {
|
||||
color: var(--wot-dark-color, var(--wot-color-white, white));
|
||||
}
|
||||
.wd-navbar {
|
||||
position: relative;
|
||||
text-align: center;
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
height: var(--wot-navbar-height, 44px);
|
||||
line-height: var(--wot-navbar-height, 44px);
|
||||
background-color: var(--wot-navbar-background, var(--wot-color-white, white));
|
||||
box-sizing: content-box;
|
||||
}
|
||||
.wd-navbar__content {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.wd-navbar__title {
|
||||
max-width: 60%;
|
||||
height: 100%;
|
||||
margin: 0 auto;
|
||||
color: var(--wot-navbar-color, var(--wot-font-gray-1, rgba(0, 0, 0, 0.9)));
|
||||
font-weight: var(--wot-navbar-title-font-weight, 600);
|
||||
font-size: var(--wot-navbar-title-font-size, 18px);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.wd-navbar__text {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
color: var(--wot-navbar-desc-font-color, var(--wot-font-gray-1, rgba(0, 0, 0, 0.9)));
|
||||
}
|
||||
.wd-navbar__left, .wd-navbar__right, .wd-navbar__capsule {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
font-size: var(--wot-navbar-desc-font-size, 16px);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 12px;
|
||||
}
|
||||
.wd-navbar__left.is-disabled, .wd-navbar__right.is-disabled, .wd-navbar__capsule.is-disabled {
|
||||
opacity: var(--wot-navbar-disabled-opacity, 0.6);
|
||||
}
|
||||
.wd-navbar__left, .wd-navbar__capsule {
|
||||
left: 0;
|
||||
}
|
||||
.wd-navbar__right {
|
||||
right: 0;
|
||||
}
|
||||
.wd-navbar__arrow {
|
||||
font-size: var(--wot-navbar-arrow-size, 24px);
|
||||
color: var(--wot-navbar-color, var(--wot-font-gray-1, rgba(0, 0, 0, 0.9)));
|
||||
}
|
||||
.wd-navbar.is-border {
|
||||
position: relative;
|
||||
}
|
||||
.wd-navbar.is-border::after {
|
||||
position: absolute;
|
||||
display: block;
|
||||
content: "";
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
transform: scaleY(0.5);
|
||||
background: var(--wot-color-border-light, #e8e8e8);
|
||||
}
|
||||
.wd-navbar.is-fixed {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 500;
|
||||
}
|
||||
54
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-notice-bar/types.js
vendored
Normal file
54
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-notice-bar/types.js
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
const uni_modules_wotDesignUni_components_common_props = require("../common/props.js");
|
||||
const noticeBarProps = {
|
||||
...uni_modules_wotDesignUni_components_common_props.baseProps,
|
||||
/**
|
||||
* 设置通知栏文案
|
||||
*/
|
||||
text: {
|
||||
type: [String, Array],
|
||||
default: ""
|
||||
},
|
||||
/**
|
||||
* 设置通知栏类型,可选值为:'warning' | 'info' | 'danger'
|
||||
*/
|
||||
type: uni_modules_wotDesignUni_components_common_props.makeStringProp("warning"),
|
||||
/**
|
||||
* 是否可滚动
|
||||
*/
|
||||
scrollable: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(true),
|
||||
/**
|
||||
* 滚动延迟时间(秒)
|
||||
*/
|
||||
delay: uni_modules_wotDesignUni_components_common_props.makeNumberProp(1),
|
||||
/**
|
||||
* 滚动速度(px/s)
|
||||
*/
|
||||
speed: uni_modules_wotDesignUni_components_common_props.makeNumberProp(50),
|
||||
/**
|
||||
* 是否可关闭
|
||||
*/
|
||||
closable: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 是否换行显示
|
||||
*/
|
||||
wrapable: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
|
||||
/**
|
||||
* 设置左侧图标,使用 icon 章节中的图标名
|
||||
*/
|
||||
prefix: String,
|
||||
/**
|
||||
* 文字、图标颜色
|
||||
*/
|
||||
color: String,
|
||||
/**
|
||||
* 背景颜色
|
||||
*/
|
||||
backgroundColor: String,
|
||||
/**
|
||||
* 滚动方向
|
||||
*/
|
||||
direction: uni_modules_wotDesignUni_components_common_props.makeStringProp("horizontal")
|
||||
};
|
||||
exports.noticeBarProps = noticeBarProps;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-notice-bar/types.js.map
|
||||
249
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-notice-bar/wd-notice-bar.js
vendored
Normal file
249
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-notice-bar/wd-notice-bar.js
vendored
Normal file
@@ -0,0 +1,249 @@
|
||||
"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_wdNoticeBar_types = require("./types.js");
|
||||
if (!Math) {
|
||||
wdIcon();
|
||||
}
|
||||
const wdIcon = () => "../wd-icon/wd-icon.js";
|
||||
const __default__ = {
|
||||
name: "wd-notice-bar",
|
||||
options: {
|
||||
virtualHost: true,
|
||||
addGlobalClass: true,
|
||||
styleIsolation: "shared"
|
||||
}
|
||||
};
|
||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
...__default__,
|
||||
props: uni_modules_wotDesignUni_components_wdNoticeBar_types.noticeBarProps,
|
||||
emits: ["close", "next", "click"],
|
||||
setup(__props, { expose: __expose, emit: __emit }) {
|
||||
const $wrap = ".wd-notice-bar__wrap";
|
||||
const $content = ".wd-notice-bar__content";
|
||||
const props = __props;
|
||||
const emit = __emit;
|
||||
const wrapWidth = common_vendor.ref(0);
|
||||
const show = common_vendor.ref(true);
|
||||
const currentIndex = common_vendor.ref(0);
|
||||
const textArray = common_vendor.computed(() => Array.isArray(props.text) ? props.text : [props.text]);
|
||||
const currentText = common_vendor.computed(() => textArray.value[currentIndex.value]);
|
||||
const verticalIndex = common_vendor.ref(0);
|
||||
const wrapRect = common_vendor.ref(null);
|
||||
const contentRect = common_vendor.ref(null);
|
||||
const isHorizontal = common_vendor.computed(() => props.direction === "horizontal");
|
||||
const isVertical = common_vendor.computed(() => props.direction === "vertical");
|
||||
const transitionState = common_vendor.reactive({
|
||||
transitionProperty: "unset",
|
||||
transitionDelay: "unset",
|
||||
transitionDuration: "unset",
|
||||
transform: "none",
|
||||
transitionTimingFunction: "linear"
|
||||
});
|
||||
const animation = common_vendor.computed(() => {
|
||||
return uni_modules_wotDesignUni_components_common_util.objToStyle(transitionState);
|
||||
});
|
||||
const rootStyle = common_vendor.computed(() => {
|
||||
const style = {};
|
||||
if (uni_modules_wotDesignUni_components_common_util.isDef(props.color)) {
|
||||
style.color = props.color;
|
||||
}
|
||||
if (uni_modules_wotDesignUni_components_common_util.isDef(props.backgroundColor)) {
|
||||
style.background = props.backgroundColor;
|
||||
}
|
||||
return `${uni_modules_wotDesignUni_components_common_util.objToStyle(style)}${props.customStyle}`;
|
||||
});
|
||||
const noticeBarClass = common_vendor.computed(() => {
|
||||
const { type, wrapable, scrollable } = props;
|
||||
let noticeBarClasses = [];
|
||||
type && noticeBarClasses.push(`is-${type}`);
|
||||
if (isHorizontal.value) {
|
||||
!wrapable && !scrollable && noticeBarClasses.push("wd-notice-bar--ellipse");
|
||||
} else {
|
||||
noticeBarClasses.push("wd-notice-bar--ellipse");
|
||||
}
|
||||
wrapable && !scrollable && noticeBarClasses.push("wd-notice-bar--wrap");
|
||||
return noticeBarClasses.join(" ");
|
||||
});
|
||||
const { proxy } = common_vendor.getCurrentInstance();
|
||||
common_vendor.watch(
|
||||
() => props.text,
|
||||
() => {
|
||||
reset();
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
common_vendor.onMounted(() => {
|
||||
startTransition();
|
||||
});
|
||||
common_vendor.onActivated(() => {
|
||||
startTransition();
|
||||
});
|
||||
common_vendor.onDeactivated(() => {
|
||||
stopTransition();
|
||||
});
|
||||
function reset() {
|
||||
stopTransition();
|
||||
startTransition();
|
||||
}
|
||||
function startTransition() {
|
||||
common_vendor.nextTick$1(() => scroll());
|
||||
}
|
||||
function stopTransition() {
|
||||
transitionState.transitionProperty = "unset";
|
||||
transitionState.transitionDelay = "unset";
|
||||
transitionState.transitionDuration = "unset";
|
||||
transitionState.transform = "none";
|
||||
transitionState.transitionTimingFunction = "linear";
|
||||
currentIndex.value = 0;
|
||||
verticalIndex.value = 0;
|
||||
}
|
||||
function handleClose() {
|
||||
show.value = false;
|
||||
emit("close");
|
||||
}
|
||||
function setTransition({ duration, delay, translate }) {
|
||||
transitionState.transitionProperty = "all";
|
||||
transitionState.transitionDelay = `${delay}s`;
|
||||
transitionState.transitionDuration = `${duration}s`;
|
||||
transitionState.transform = `${props.direction === "vertical" ? "translateY" : "translateX"}(${translate}px)`;
|
||||
transitionState.transitionTimingFunction = "linear";
|
||||
}
|
||||
function queryRect() {
|
||||
return Promise.all([uni_modules_wotDesignUni_components_common_util.getRect($wrap, false, proxy), uni_modules_wotDesignUni_components_common_util.getRect($content, false, proxy)]);
|
||||
}
|
||||
async function verticalAnimate(height) {
|
||||
const translate = -(height / (textArray.value.length + 1)) * (currentIndex.value + 1);
|
||||
setTransition({
|
||||
duration: height / (textArray.value.length + 1) / props.speed,
|
||||
delay: props.delay,
|
||||
translate
|
||||
});
|
||||
}
|
||||
async function scroll() {
|
||||
const [wRect, cRect] = await queryRect();
|
||||
if (!wRect.width || !cRect.width || !cRect.height)
|
||||
return;
|
||||
wrapRect.value = wRect;
|
||||
contentRect.value = cRect;
|
||||
wrapWidth.value = wRect.width;
|
||||
if (isHorizontal.value) {
|
||||
if (props.scrollable) {
|
||||
setTransition({
|
||||
duration: cRect.width / props.speed,
|
||||
delay: props.delay,
|
||||
translate: -cRect.width
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (textArray.value.length > 1) {
|
||||
verticalAnimate(cRect.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
function next() {
|
||||
if (currentIndex.value >= textArray.value.length - 1) {
|
||||
currentIndex.value = 0;
|
||||
} else {
|
||||
currentIndex.value++;
|
||||
}
|
||||
emit("next", currentIndex.value);
|
||||
}
|
||||
function animationEnd() {
|
||||
if (isHorizontal.value) {
|
||||
setTransition({
|
||||
duration: 0,
|
||||
delay: 0,
|
||||
translate: wrapWidth.value + 1
|
||||
});
|
||||
} else {
|
||||
if (++verticalIndex.value >= textArray.value.length) {
|
||||
verticalIndex.value = 0;
|
||||
setTransition({
|
||||
duration: 0,
|
||||
delay: 0,
|
||||
translate: 0
|
||||
});
|
||||
}
|
||||
}
|
||||
const timer = setTimeout(() => {
|
||||
next();
|
||||
common_vendor.nextTick$1(async () => {
|
||||
try {
|
||||
const [wRect, cRect] = await queryRect();
|
||||
wrapRect.value = wRect;
|
||||
contentRect.value = cRect;
|
||||
wrapWidth.value = wRect.width || 0;
|
||||
} catch (error) {
|
||||
}
|
||||
if (!contentRect.value || !contentRect.value.width || !contentRect.value.height)
|
||||
return;
|
||||
if (isHorizontal.value) {
|
||||
setTransition({
|
||||
duration: (wrapWidth.value + contentRect.value.width) / props.speed,
|
||||
delay: props.delay,
|
||||
translate: -contentRect.value.width
|
||||
});
|
||||
} else {
|
||||
verticalAnimate(contentRect.value.height);
|
||||
}
|
||||
});
|
||||
clearTimeout(timer);
|
||||
}, 20);
|
||||
}
|
||||
function handleClick() {
|
||||
const result = uni_modules_wotDesignUni_components_common_util.isArray(props.text) ? {
|
||||
index: currentIndex.value,
|
||||
text: props.text[currentIndex.value]
|
||||
} : {
|
||||
index: 0,
|
||||
text: props.text
|
||||
};
|
||||
emit("click", result);
|
||||
}
|
||||
__expose({ reset });
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: show.value
|
||||
}, show.value ? common_vendor.e({
|
||||
b: _ctx.prefix
|
||||
}, _ctx.prefix ? {
|
||||
c: common_vendor.p({
|
||||
["custom-class"]: "wd-notice-bar__prefix",
|
||||
name: _ctx.prefix
|
||||
})
|
||||
} : {}, {
|
||||
d: isVertical.value
|
||||
}, isVertical.value ? common_vendor.e({
|
||||
e: common_vendor.f(textArray.value, (item, k0, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item),
|
||||
b: item
|
||||
};
|
||||
}),
|
||||
f: textArray.value.length > 1
|
||||
}, textArray.value.length > 1 ? {
|
||||
g: common_vendor.t(textArray.value[0])
|
||||
} : {}) : {
|
||||
h: common_vendor.t(currentText.value)
|
||||
}, {
|
||||
i: common_vendor.s(animation.value),
|
||||
j: common_vendor.o(animationEnd),
|
||||
k: common_vendor.o(handleClick),
|
||||
l: _ctx.closable
|
||||
}, _ctx.closable ? {
|
||||
m: common_vendor.o(handleClose),
|
||||
n: common_vendor.p({
|
||||
["custom-class"]: "wd-notice-bar__suffix",
|
||||
name: "close-bold"
|
||||
})
|
||||
} : {}, {
|
||||
o: common_vendor.n(`wd-notice-bar ${_ctx.customClass} ${noticeBarClass.value}`),
|
||||
p: common_vendor.s(rootStyle.value)
|
||||
}) : {});
|
||||
};
|
||||
}
|
||||
});
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-e7a73070"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-notice-bar/wd-notice-bar.js.map
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"wd-icon": "../wd-icon/wd-icon"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<view wx:if="{{a}}" class="{{['data-v-e7a73070', o]}}" style="{{p}}"><wd-icon wx:if="{{b}}" class="data-v-e7a73070" u-i="e7a73070-0" bind:__l="__l" u-p="{{c}}"></wd-icon><slot wx:else name="prefix"></slot><view class="wd-notice-bar__wrap data-v-e7a73070"><view class="wd-notice-bar__content data-v-e7a73070" style="{{i}}" bindtransitionend="{{j}}" bindtap="{{k}}"><block wx:if="{{d}}"><view wx:for="{{e}}" wx:for-item="item" wx:key="b" class="data-v-e7a73070">{{item.a}}</view><view wx:if="{{f}}" class="data-v-e7a73070">{{g}}</view></block><block wx:else><block wx:if="{{$slots.d}}"><slot></slot></block><block wx:else>{{h}}</block></block></view></view><wd-icon wx:if="{{l}}" class="data-v-e7a73070" bindclick="{{m}}" u-i="e7a73070-1" bind:__l="__l" u-p="{{n}}"></wd-icon><slot wx:else name="suffix"></slot></view>
|
||||
227
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-notice-bar/wd-notice-bar.wxss
vendored
Normal file
227
unpackage/dist/dev/mp-weixin/uni_modules/wot-design-uni/components/wd-notice-bar/wd-notice-bar.wxss
vendored
Normal file
@@ -0,0 +1,227 @@
|
||||
/* 水平间距 */
|
||||
/* 水平间距 */
|
||||
/**
|
||||
* 辅助函数
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/* 转换成字符串 */
|
||||
/* 判断是否存在 Modifier */
|
||||
/* 判断是否存在伪类 */
|
||||
/**
|
||||
* 主题色切换
|
||||
* @params $theme-color 主题色
|
||||
* @params $type 变暗’dark‘ 变亮 'light'
|
||||
* @params $mix-color 自己设置的混色
|
||||
*/
|
||||
/**
|
||||
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
|
||||
* @params $open-linear 是否开启线性渐变色
|
||||
* @params $deg 渐变色角度
|
||||
* @params $theme-color 当前配色
|
||||
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
|
||||
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
|
||||
* @params [Array] $per-list 渐变色比例
|
||||
*/
|
||||
/**
|
||||
* UI规范基础变量
|
||||
*/
|
||||
/*----------------------------------------- Theme color. start ----------------------------------------*/
|
||||
/* 主题颜色 */
|
||||
/* 辅助色 */
|
||||
/* 文字颜色(默认浅色背景下 */
|
||||
/* 暗黑模式 */
|
||||
/* 图形颜色 */
|
||||
/*----------------------------------------- Theme color. end -------------------------------------------*/
|
||||
/*-------------------------------- Theme color application size. start --------------------------------*/
|
||||
/* 文字字号 */
|
||||
/* 文字字重 */
|
||||
/* 尺寸 */
|
||||
/*-------------------------------- Theme color application size. end --------------------------------*/
|
||||
/* component var */
|
||||
/* action-sheet */
|
||||
/* badge */
|
||||
/* button */
|
||||
/* cell */
|
||||
/* calendar */
|
||||
/* checkbox */
|
||||
/* collapse */
|
||||
/* divider */
|
||||
/* drop-menu */
|
||||
/* input-number */
|
||||
/* input */
|
||||
/* textarea */
|
||||
/* loadmore */
|
||||
/* message-box */
|
||||
/* notice-bar */
|
||||
/* pagination */
|
||||
/* picker */
|
||||
/* col-picker */
|
||||
/* overlay */
|
||||
/* popup */
|
||||
/* progress */
|
||||
/* radio */
|
||||
/* search */
|
||||
/* slider */
|
||||
/* sort-button */
|
||||
/* steps */
|
||||
/* switch */
|
||||
/* tabs */
|
||||
/* tag */
|
||||
/* toast */
|
||||
/* loading */
|
||||
/* tooltip */
|
||||
/* popover */
|
||||
/* grid-item */
|
||||
/* statustip */
|
||||
/* card */
|
||||
/* upload */
|
||||
/* curtain */
|
||||
/* notify */
|
||||
/* skeleton */
|
||||
/* circle */
|
||||
/* swiper */
|
||||
/* swiper-nav */
|
||||
/* segmented */
|
||||
/* tabbar */
|
||||
/* tabbar-item */
|
||||
/* navbar */
|
||||
/* navbar-capsule */
|
||||
/* table */
|
||||
/* sidebar */
|
||||
/* sidebar-item */
|
||||
/* fab */
|
||||
/* count-down */
|
||||
/* keyboard */
|
||||
/* number-keyboard */
|
||||
/* passwod-input */
|
||||
/* form-item */
|
||||
/* backtop */
|
||||
/* index-bar */
|
||||
/* text */
|
||||
/* video-preview */
|
||||
/* img-cropper */
|
||||
/* floating-panel */
|
||||
/* signature */
|
||||
/**
|
||||
* 混合宏
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/**
|
||||
* 辅助函数
|
||||
*/
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
/* 转换成字符串 */
|
||||
/* 判断是否存在 Modifier */
|
||||
/* 判断是否存在伪类 */
|
||||
/**
|
||||
* 主题色切换
|
||||
* @params $theme-color 主题色
|
||||
* @params $type 变暗’dark‘ 变亮 'light'
|
||||
* @params $mix-color 自己设置的混色
|
||||
*/
|
||||
/**
|
||||
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
|
||||
* @params $open-linear 是否开启线性渐变色
|
||||
* @params $deg 渐变色角度
|
||||
* @params $theme-color 当前配色
|
||||
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
|
||||
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
|
||||
* @params [Array] $per-list 渐变色比例
|
||||
*/
|
||||
/**
|
||||
* BEM,定义块(b)
|
||||
*/
|
||||
/* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
|
||||
/* 此方法用于生成穿透样式 */
|
||||
/* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
|
||||
/* 定义状态(m) */
|
||||
/* 定义状态(m) */
|
||||
/* 对于需要需要嵌套在 m 底下的 e,调用这个混合宏,一般在切换整个组件的状态,如切换颜色的时候 */
|
||||
/* 状态,生成 is-$state 类名 */
|
||||
/**
|
||||
* 常用混合宏
|
||||
*/
|
||||
/* 单行超出隐藏 */
|
||||
/* 多行超出隐藏 */
|
||||
/* 清除浮动 */
|
||||
/* 0.5px 边框 指定方向*/
|
||||
/* 0.5px 边框 环绕 */
|
||||
/**
|
||||
* 三角形实现尖角样式,适用于背景透明情况
|
||||
* @param $size 三角形高,底边为 $size * 2
|
||||
* @param $bg 三角形背景颜色
|
||||
*/
|
||||
/**
|
||||
* 正方形实现尖角样式,适用于背景不透明情况
|
||||
* @param $size 正方形边长
|
||||
* @param $bg 正方形背景颜色
|
||||
* @param $z-index z-index属性值,不得大于外部包裹器
|
||||
* @param $box-shadow 阴影
|
||||
*/
|
||||
.wd-notice-bar.data-v-e7a73070 {
|
||||
display: flex;
|
||||
padding: var(--wot-notice-bar-padding, 9px 20px 9px 15px);
|
||||
align-items: center;
|
||||
font-size: var(--wot-notice-bar-fs, 12px);
|
||||
border-radius: var(--wot-notice-bar-border-radius, 8px);
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.wd-notice-bar.is-warning.data-v-e7a73070 {
|
||||
background: var(--wot-notice-bar-warning-bg, #fff6c8);
|
||||
color: var(--wot-notice-bar-warning-color, var(--wot-color-warning, #f0883a));
|
||||
}
|
||||
.wd-notice-bar.is-info.data-v-e7a73070 {
|
||||
background: var(--wot-notice-bar-info-bg, #f4f9ff);
|
||||
color: var(--wot-notice-bar-info-color, var(--wot-color-theme, #4d80f0));
|
||||
}
|
||||
.wd-notice-bar.is-danger.data-v-e7a73070 {
|
||||
background: var(--wot-notice-bar-danger-bg, #feeced);
|
||||
color: var(--wot-notice-bar-danger-color, var(--wot-color-danger, #fa4350));
|
||||
}
|
||||
.data-v-e7a73070 .wd-notice-bar__prefix {
|
||||
padding-right: 4px;
|
||||
font-size: var(--wot-notice-bar-prefix-size, 18px);
|
||||
}
|
||||
.data-v-e7a73070 .wd-notice-bar__suffix {
|
||||
text-align: center;
|
||||
font-size: var(--wot-notice-bar-close-size, 18px);
|
||||
display: inline-block;
|
||||
background-color: var(--wot-notice-bar-close-bg, rgba(0, 0, 0, 0.15));
|
||||
color: var(--wot-notice-bar-close-color, var(--wot-color-white, white));
|
||||
padding: 0;
|
||||
border-radius: 0px 8px 0px 4px;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
.wd-notice-bar__wrap.data-v-e7a73070 {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
height: var(--wot-notice-bar-line-height, 18px);
|
||||
overflow: hidden;
|
||||
line-height: var(--wot-notice-bar-line-height, 18px);
|
||||
}
|
||||
.wd-notice-bar__content.data-v-e7a73070 {
|
||||
position: absolute;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.wd-notice-bar--ellipse .wd-notice-bar__content.data-v-e7a73070 {
|
||||
position: static;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.wd-notice-bar--wrap .wd-notice-bar__wrap.data-v-e7a73070 {
|
||||
height: auto;
|
||||
}
|
||||
.wd-notice-bar--wrap .wd-notice-bar__content.data-v-e7a73070 {
|
||||
position: static;
|
||||
white-space: normal;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user