],手风琴模式:string | number
value: {
type: [String, Number, Array, null],
default: () => props$1x.collapse.value
},
// 是否手风琴模式
accordion: {
type: Boolean,
default: () => props$1x.collapse.accordion
},
// 是否显示外边框
border: {
type: Boolean,
default: () => props$1x.collapse.border
}
}
});
const _sfc_main$1G = {
name: "u-collapse",
mixins: [mpMixin, mixin, props$15],
watch: {
needInit() {
this.init();
},
// 当父组件需要子组件需要共享的参数发生了变化,手动通知子组件
parentData() {
if (this.children.length) {
this.children.map((child) => {
typeof child.updateParentData === "function" && child.updateParentData();
});
}
}
},
created() {
this.children = [];
},
computed: {
needInit() {
return [this.accordion, this.value];
}
},
emits: ["open", "close", "change"],
methods: {
// 重新初始化一次内部的所有子元素
init() {
this.children.map((child) => {
child.init();
});
},
/**
* collapse-item被点击时触发,由collapse统一处理各子组件的状态
* @param {Object} target 被操作的面板的实例
*/
onChange(target) {
let changeArr = [];
this.children.map((child, index2) => {
if (this.accordion) {
child.expanded = child === target ? !target.expanded : false;
child.setContentAnimate();
} else {
if (child === target) {
child.expanded = !child.expanded;
child.setContentAnimate();
}
}
changeArr.push({
// 如果没有定义name属性,则默认返回组件的index索引
name: child.name || index2,
status: child.expanded ? "open" : "close"
});
});
this.$emit("change", changeArr);
this.$emit(target.expanded ? "open" : "close", target.name);
}
}
};
function _sfc_render$1F(_ctx, _cache, $props, $setup, $data, $options) {
const _component_u_line = resolveEasycom(vue.resolveDynamicComponent("u-line"), __easycom_1$4);
return vue.openBlock(), vue.createElementBlock("view", { class: "u-collapse" }, [
_ctx.border ? (vue.openBlock(), vue.createBlock(_component_u_line, { key: 0 })) : vue.createCommentVNode("v-if", true),
vue.renderSlot(_ctx.$slots, "default")
]);
}
const uCollapse = /* @__PURE__ */ _export_sfc(_sfc_main$1G, [["render", _sfc_render$1F], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-collapse/u-collapse.vue"]]);
const __vite_glob_0_26 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uCollapse
}, Symbol.toStringTag, { value: "Module" }));
const _sfc_main$1F = {
name: "up-color-picker",
props: {
// 初始颜色值
modelValue: {
type: String,
default: "#ff0000"
},
// 常用颜色列表
commonColors: {
type: Array,
default: () => []
}
},
data() {
return {
show: false,
// 颜色类型索引:0-纯色,1-渐变色
colorTypeIndex: 0,
// 纯色相关数据
hue: 0,
saturation: 100,
lightness: 50,
alpha: 1,
saturationPosition: { x: 150, y: 0 },
huePosition: 0,
alphaPosition: 0,
// 将在initColor中设置为最右侧
// 渐变色相关数据
gradientColors: [
{ color: "#ff0000", percent: 0 },
{ color: "#0000ff", percent: 1 }
],
gradientDirections: [
{ label: "从左到右", value: "to right" },
{ label: "从上到下", value: "to bottom" },
{ label: "从左上到右下", value: "to bottom right" },
{ label: "从右上到左下", value: "to bottom left" }
],
currentDirection: { label: "从左到右", value: "to right" },
showDirectionPicker: false,
// 当前选中颜色
currentColor: "#ff0000",
// 渐变色控制相关
draggingPointerIndex: -1,
directionPointer: { x: 20, y: 20 },
// 默认向右(在圆的右侧)
// 渐变节点颜色修改相关
editingGradientIndex: -1,
// 保存纯色和渐变色的各自状态
solidColorState: {
hue: 0,
saturation: 100,
lightness: 50,
alpha: 1,
saturationPosition: { x: 150, y: 0 },
huePosition: 0,
alphaPosition: 0,
// 将在initColor中设置为最右侧
currentColor: "#ff0000"
},
gradientColorState: {
gradientColors: [
{ color: "#ff0000", percent: 0 },
{ color: "#0000ff", percent: 1 }
],
currentDirection: { label: "从左到右", value: "to right" },
directionPointer: { x: 100, y: 0 }
},
// 区分预览类型:solid-纯色预览,gradient-整体渐变预览,gradient-point-渐变点预览
previewType: "solid"
};
},
computed: {
// 渐变色样式
gradientStyle() {
const colors = this.gradientColors.map((item) => `${item.color} ${Math.round(item.percent * 100)}%`).join(", ");
return `linear-gradient(${this.currentDirection.value}, ${colors})`;
},
// 显示的颜色预览值
displayColor() {
if (this.previewType === "gradient-point" && this.editingGradientIndex >= 0) {
return this.gradientColors[this.editingGradientIndex].color;
}
formatAppLog("log", "at uni_modules/uview-plus/components/u-color-picker/u-color-picker.vue:251", this.editingGradientIndex);
return this.currentColor;
}
},
watch: {
show(newVal) {
if (newVal) {
this.initColor();
}
},
colorTypeIndex(newVal) {
if (newVal == 0) {
this.editingGradientIndex = -1;
}
}
},
mounted() {
this.initColor();
},
emits: ["update:modelValue", "confirm", "close"],
methods: {
// 初始化颜色
initColor() {
if (this.modelValue) {
this.currentColor = this.modelValue;
if (this.modelValue.includes("linear-gradient")) {
this.colorTypeIndex = 1;
this.parseGradientColor(this.modelValue);
this.previewType = "gradient";
} else {
this.colorTypeIndex = 0;
this.parseSolidColor(this.modelValue);
this.previewType = "solid";
}
}
this.initDirectionPointer();
this.initAlphaPosition();
},
// 初始化alpha位置为最右侧
async initAlphaPosition() {
const query = uni.createSelectorQuery().in(this);
query.select(".up-color-picker__alpha").boundingClientRect();
await this.$nextTick();
query.exec((res) => {
const rect = res[0];
if (rect) {
this.alphaPosition = rect.width || 150;
} else {
this.alphaPosition = 150;
}
this.solidColorState.alphaPosition = this.alphaPosition;
this.updateSolidColor();
});
},
// 初始化方向指针位置
initDirectionPointer() {
const angle = this.getDirectionAngle(this.currentDirection.value);
this.setDirectionPointerByAngle(angle);
},
// 根据方向值获取角度
getDirectionAngle(direction) {
switch (direction) {
case "to right":
return 0;
case "to bottom":
return 90;
case "to left":
return 180;
case "to top":
return 270;
case "to bottom right":
return 45;
case "to bottom left":
return 135;
case "to top left":
return 225;
case "to top right":
return 315;
default:
return 0;
}
},
// 根据角度设置方向指针位置
setDirectionPointerByAngle(angle) {
const radian = angle * Math.PI / 180;
const radius = 20;
this.directionPointer = {
x: radius * Math.cos(radian) + 20,
// 20是圆心位置
y: radius * Math.sin(radian) + 20
};
},
// 打开颜色选择器以修改渐变节点颜色
openColorPickerForGradient(index2) {
this.editingGradientIndex = index2;
const color2 = this.gradientColors[index2].color;
this.currentColor = color2;
this.previewType = "gradient-point";
if (!color2.includes("linear-gradient")) {
this.colorTypeIndex = 0;
this.parseSolidColor(color2);
this.gradientColorState = {
gradientColors: [...this.gradientColors],
currentDirection: { ...this.currentDirection },
directionPointer: { ...this.directionPointer }
};
}
},
// 解析纯色
parseSolidColor(color2) {
this.currentColor = color2;
if (this.editingGradientIndex >= 0) {
this.gradientColors[this.editingGradientIndex].color = color2;
this.colorTypeIndex = 1;
Object.assign(this, this.solidColorState);
this.previewType = "gradient-point";
} else {
this.previewType = "solid";
}
},
// 解析渐变色
parseGradientColor(gradient) {
this.currentColor = gradient;
},
// 切换颜色类型
changeColorType(index2) {
if (this.colorTypeIndex === 0) {
this.solidColorState = {
hue: this.hue,
saturation: this.saturation,
lightness: this.lightness,
alpha: this.alpha,
saturationPosition: { ...this.saturationPosition },
huePosition: this.huePosition,
alphaPosition: this.alphaPosition,
currentColor: this.currentColor
};
} else {
this.gradientColorState = {
gradientColors: [...this.gradientColors],
currentDirection: { ...this.currentDirection },
directionPointer: { ...this.directionPointer }
};
}
this.colorTypeIndex = index2;
if (index2 === 0) {
Object.assign(this, this.solidColorState);
this.previewType = "solid";
} else {
Object.assign(this, this.gradientColorState);
this.gradientColors = [...this.gradientColorState.gradientColors];
this.previewType = "gradient";
}
},
// 饱和度和明度触摸开始
onSaturationTouchStart(e2) {
this.updateSaturationPosition(e2);
},
// 饱和度和明度触摸移动
onSaturationTouchMove(e2) {
this.updateSaturationPosition(e2);
},
// 饱和度和明度触摸结束
onSaturationTouchEnd(e2) {
this.updateSaturationPosition(e2);
},
// 更新饱和度和明度位置
updateSaturationPosition(e2) {
const touch = e2.touches[0] || e2.changedTouches[0];
e2.currentTarget;
const query = uni.createSelectorQuery().in(this);
query.select(".up-color-picker__saturation").boundingClientRect();
query.exec((res) => {
const rect = res[0];
if (rect) {
let x2 = touch.clientX - rect.left;
let y2 = touch.clientY - rect.top;
x2 = Math.max(0, Math.min(x2, rect.width));
y2 = Math.max(0, Math.min(y2, rect.height));
this.saturationPosition = { x: x2, y: y2 };
this.updateSolidColor();
}
});
},
// 色相触摸开始
onHueTouchStart(e2) {
this.updateHuePosition(e2);
},
// 色相触摸移动
onHueTouchMove(e2) {
this.updateHuePosition(e2);
},
// 色相触摸结束
onHueTouchEnd(e2) {
this.updateHuePosition(e2);
},
// 更新色相位置
updateHuePosition(e2) {
const touch = e2.touches[0] || e2.changedTouches[0];
e2.currentTarget;
const query = uni.createSelectorQuery().in(this);
query.select(".up-color-picker__hue").boundingClientRect();
query.exec((res) => {
const rect = res[0];
if (rect) {
let x2 = touch.clientX - rect.left;
x2 = Math.max(0, Math.min(x2, rect.width));
this.huePosition = x2;
this.hue = Math.round(x2 / rect.width * 360);
this.updateSolidColor();
}
});
},
// 透明度触摸开始
onAlphaTouchStart(e2) {
this.updateAlphaPosition(e2);
},
// 透明度触摸移动
onAlphaTouchMove(e2) {
this.updateAlphaPosition(e2);
},
// 透明度触摸结束
onAlphaTouchEnd(e2) {
this.updateAlphaPosition(e2);
},
// 更新透明度位置
updateAlphaPosition(e2) {
const touch = e2.touches[0] || e2.changedTouches[0];
e2.currentTarget;
const query = uni.createSelectorQuery().in(this);
query.select(".up-color-picker__alpha").boundingClientRect();
query.exec((res) => {
const rect = res[0];
if (rect) {
let x2 = touch.clientX - rect.left;
x2 = Math.max(0, Math.min(x2, rect.width));
this.alphaPosition = x2;
this.alpha = x2 / rect.width;
this.updateSolidColor();
}
});
},
// 更新纯色
updateSolidColor() {
const query = uni.createSelectorQuery().in(this);
query.select(".up-color-picker__saturation").boundingClientRect();
query.exec((res) => {
const rect = res[0];
const size = rect ? Math.min(rect.width, rect.height) : 150;
const s2 = this.saturationPosition.x / size * 100;
const l2 = 100 - this.saturationPosition.y / size * 100;
this.saturation = s2;
this.lightness = l2;
if (this.colorTypeIndex == 0) {
this.currentColor = this.hslToRgb(this.hue, this.saturation, this.lightness, this.alpha);
} else if (this.colorTypeIndex == 1) {
this.gradientColors[this.editingGradientIndex].color = this.hslToRgb(this.hue, this.saturation, this.lightness, this.alpha);
}
});
},
// 添加渐变色
addGradientColor() {
if (this.gradientColors.length < 5) {
this.gradientColors.push({
color: "#ffffff",
percent: 1
});
}
},
// 删除渐变色
removeGradientColor(index2) {
if (this.gradientColors.length > 2) {
this.gradientColors.splice(index2, 1);
}
},
// 获取渐变控制点位置
getGradientPointerPosition(index2) {
const trackWidth = 280;
return this.gradientColors[index2].percent * trackWidth;
},
// 更新渐变色
updateGradientColor(e2) {
const touch = e2.touches[0] || e2.changedTouches[0];
const query = uni.createSelectorQuery().in(this);
query.select(".up-color-picker__gradient-track").boundingClientRect();
query.exec((res) => {
const rect = res[0];
if (rect) {
let x2 = touch.clientX - rect.left;
x2 = Math.max(0, Math.min(x2, rect.width));
const percent = x2 / rect.width;
if (this.draggingPointerIndex >= 0) {
this.gradientColors[this.draggingPointerIndex].percent = percent;
this.gradientColors.sort((a2, b2) => a2.percent - b2.percent);
}
}
});
},
// 控制点触摸开始
onPointerTouchStart(e2, index2) {
this.draggingPointerIndex = index2;
this.currentColor = this.gradientColors[index2].color;
this.previewType = "gradient-point";
this.editingGradientIndex = index2;
e2.stopPropagation();
},
// 控制点触摸移动
onPointerTouchMove(e2) {
if (this.draggingPointerIndex === -1)
return;
const touch = e2.touches[0] || e2.changedTouches[0];
const query = uni.createSelectorQuery().in(this);
query.select(".up-color-picker__gradient-track").boundingClientRect();
query.exec((res) => {
const rect = res[0];
if (rect) {
let x2 = touch.clientX - rect.left;
x2 = Math.max(0, Math.min(x2, rect.width));
let percent = x2 / rect.width;
if (x2 === 0)
percent = 0;
if (x2 === rect.width)
percent = 1;
this.gradientColors[this.draggingPointerIndex].percent = percent;
this.gradientColors.sort((a2, b2) => a2.percent - b2.percent);
this.draggingPointerIndex = this.gradientColors.findIndex((item, index2) => {
return Math.abs(item.percent - percent) < 1e-4;
});
}
});
},
// 控制点触摸结束
onPointerTouchEnd() {
this.draggingPointerIndex = -1;
},
// 方向选择器触摸开始
onDirectionTouchStart(e2) {
this.updateDirection(e2);
},
// 方向选择器触摸移动
onDirectionTouchMove(e2) {
this.updateDirection(e2);
},
// 方向选择器触摸结束
onDirectionTouchEnd(e2) {
this.updateDirection(e2);
},
// 更新方向
updateDirection(e2) {
const touch = e2.touches[0] || e2.changedTouches[0];
const query = uni.createSelectorQuery().in(this);
query.select(".up-color-picker__gradient__direction-circle").boundingClientRect();
query.exec((res) => {
const rect = res[0];
if (rect) {
const centerX = rect.left + rect.width / 2;
const centerY = rect.top + rect.height / 2;
const x2 = touch.clientX - centerX;
const y2 = touch.clientY - centerY;
const distance = Math.sqrt(x2 * x2 + y2 * y2);
const maxDistance = rect.width / 2;
if (distance <= maxDistance) {
this.directionPointer = {
x: x2 + rect.width / 2,
y: y2 + rect.height / 2
};
} else {
const ratio = maxDistance / distance;
this.directionPointer = {
x: x2 * ratio + rect.width / 2,
y: y2 * ratio + rect.height / 2
};
}
const angle = Math.atan2(y2, x2) * 180 / Math.PI;
formatAppLog("log", "at uni_modules/uview-plus/components/u-color-picker/u-color-picker.vue:704", angle);
this.updateGradientDirection(angle);
}
});
},
// 根据角度更新渐变方向
updateGradientDirection(angle) {
if (angle < 0)
angle += 360;
if (angle >= 315 || angle < 45) {
this.currentDirection = { label: "从左到右", value: "to right" };
} else if (angle >= 45 && angle < 135) {
this.currentDirection = { label: "从上到下", value: "to bottom" };
} else if (angle >= 135 && angle < 225) {
this.currentDirection = { label: "从右到左", value: "to left" };
} else {
this.currentDirection = { label: "从下到上", value: "to top" };
}
},
// 确认方向选择
confirmDirection(e2) {
this.currentDirection = this.gradientDirections[e2.index];
this.showDirectionPicker = false;
},
// 选择常用颜色
selectCommonColor(color2) {
this.currentColor = color2;
if (this.colorTypeIndex === 0) {
this.parseSolidColor(color2);
} else {
this.gradientColors[this.editingGradientIndex].color = color2;
}
},
// 确认选择
confirm() {
let color2 = this.currentColor;
if (this.colorTypeIndex === 1) {
color2 = this.gradientStyle;
}
this.$emit("update:modelValue", color2);
this.show = false;
this.$emit("confirm", color2);
this.editingGradientIndex = -1;
this.previewType = this.colorTypeIndex === 0 ? "solid" : "gradient";
this.close();
},
// 关闭选择器
close() {
this.show = false;
this.$emit("close");
},
// HSL转RGB辅助函数
hslToRgb(h2, s2, l2, a2 = 1) {
h2 = h2 / 360;
s2 = s2 / 100;
l2 = l2 / 100;
let r2, g2, b2;
if (s2 === 0) {
r2 = g2 = b2 = l2;
} else {
const hue2rgb = (p3, q3, t2) => {
if (t2 < 0)
t2 += 1;
if (t2 > 1)
t2 -= 1;
if (t2 < 1 / 6)
return p3 + (q3 - p3) * 6 * t2;
if (t2 < 1 / 2)
return q3;
if (t2 < 2 / 3)
return p3 + (q3 - p3) * (2 / 3 - t2) * 6;
return p3;
};
const q2 = l2 < 0.5 ? l2 * (1 + s2) : l2 + s2 - l2 * s2;
const p2 = 2 * l2 - q2;
r2 = hue2rgb(p2, q2, h2 + 1 / 3);
g2 = hue2rgb(p2, q2, h2);
b2 = hue2rgb(p2, q2, h2 - 1 / 3);
}
const round2 = (value2) => Math.round(value2 * 255);
return `rgba(${round2(r2)}, ${round2(g2)}, ${round2(b2)}, ${a2.toFixed(2)})`;
}
}
};
function _sfc_render$1E(_ctx, _cache, $props, $setup, $data, $options) {
const _component_up_subsection = vue.resolveComponent("up-subsection");
const _component_up_button = vue.resolveComponent("up-button");
const _component_up_popup = vue.resolveComponent("up-popup");
return vue.openBlock(), vue.createElementBlock("view", { class: "up-color-picker" }, [
vue.createElementVNode(
"view",
{
clas: "up-color-picker__trigger",
onClick: _cache[0] || (_cache[0] = ($event) => $data.show = true),
style: vue.normalizeStyle({ backgroundColor: _ctx.value })
},
[
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
],
4
/* STYLE */
),
vue.createVNode(_component_up_popup, {
show: $data.show,
mode: "bottom",
round: "10",
onClose: $options.close,
closeOnClickOverlay: true
}, {
default: vue.withCtx(() => [
vue.createElementVNode("view", { class: "up-color-picker__content" }, [
vue.createElementVNode("view", { class: "up-color-picker__header" }, [
vue.createElementVNode("text", { class: "up-color-picker__title" }, "选择颜色")
]),
vue.createCommentVNode(" 纯色/渐变色切换 "),
vue.createElementVNode("view", { class: "up-color-picker__switch" }, [
vue.createVNode(_component_up_subsection, {
list: [{ name: "纯色" }, { name: "渐变" }],
current: $data.colorTypeIndex,
onChange: $options.changeColorType,
fontSize: "14"
}, null, 8, ["current", "onChange"])
]),
vue.createCommentVNode(" 渐变色选择器 "),
$data.colorTypeIndex == 1 ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "up-color-picker__gradient"
}, [
vue.createCommentVNode(" 渐变色控制条 "),
vue.createElementVNode(
"view",
{
class: "up-color-picker__gradient-track",
style: vue.normalizeStyle({ background: $options.gradientStyle })
},
[
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($data.gradientColors, (item, index2) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "up-color-picker__gradient-pointer",
key: index2,
style: vue.normalizeStyle({ left: $options.getGradientPointerPosition(index2) + "px" }),
onClick: ($event) => $options.openColorPickerForGradient(index2),
onTouchstart: ($event) => $options.onPointerTouchStart($event, index2),
onTouchmove: _cache[1] || (_cache[1] = vue.withModifiers((...args) => $options.onPointerTouchMove && $options.onPointerTouchMove(...args), ["stop"])),
onTouchend: _cache[2] || (_cache[2] = vue.withModifiers((...args) => $options.onPointerTouchEnd && $options.onPointerTouchEnd(...args), ["stop"]))
}, [
vue.createElementVNode(
"view",
{
class: "up-color-picker__gradient-pointer-inner",
style: vue.normalizeStyle({ backgroundColor: item.color })
},
null,
4
/* STYLE */
)
], 44, ["onClick", "onTouchstart"]);
}),
128
/* KEYED_FRAGMENT */
))
],
4
/* STYLE */
),
vue.createElementVNode("view", { class: "up-color-picker__gradient-controls" }, [
vue.createVNode(_component_up_button, {
type: "primary",
size: "mini",
plain: "",
onClick: $options.addGradientColor,
class: "up-color-picker__add-btn"
}, {
default: vue.withCtx(() => [
vue.createTextVNode(" 添加颜色 ")
]),
_: 1
/* STABLE */
}, 8, ["onClick"])
]),
vue.createCommentVNode(" 圆形方向选择器 "),
vue.createElementVNode("view", { class: "up-color-picker__gradient-direction" }, [
vue.createElementVNode("text", null, "方向:"),
vue.createElementVNode(
"view",
{
class: "up-color-picker__gradient__direction-circle",
onTouchstart: _cache[3] || (_cache[3] = (...args) => $options.onDirectionTouchStart && $options.onDirectionTouchStart(...args)),
onTouchmove: _cache[4] || (_cache[4] = (...args) => $options.onDirectionTouchMove && $options.onDirectionTouchMove(...args)),
onTouchend: _cache[5] || (_cache[5] = (...args) => $options.onDirectionTouchEnd && $options.onDirectionTouchEnd(...args))
},
[
vue.createElementVNode(
"view",
{
class: "up-color-picker__direction-pointer",
style: vue.normalizeStyle({
left: $data.directionPointer.x + "px",
top: $data.directionPointer.y + "px"
})
},
null,
4
/* STYLE */
)
],
32
/* NEED_HYDRATION */
)
])
])) : vue.createCommentVNode("v-if", true),
vue.createCommentVNode(" 纯色选择器 "),
vue.createElementVNode("view", { class: "up-color-picker__solid" }, [
vue.createCommentVNode(" 饱和度和明度选择区域 "),
vue.createElementVNode(
"view",
{
class: "up-color-picker__saturation",
style: vue.normalizeStyle({ backgroundColor: `hsl(${$data.hue}, 100%, 50%)` }),
onTouchstart: _cache[6] || (_cache[6] = (...args) => $options.onSaturationTouchStart && $options.onSaturationTouchStart(...args)),
onTouchmove: _cache[7] || (_cache[7] = (...args) => $options.onSaturationTouchMove && $options.onSaturationTouchMove(...args)),
onTouchend: _cache[8] || (_cache[8] = (...args) => $options.onSaturationTouchEnd && $options.onSaturationTouchEnd(...args))
},
[
vue.createElementVNode(
"view",
{
class: "up-color-picker__saturation-pointer",
style: vue.normalizeStyle({
left: $data.saturationPosition.x + "px",
top: $data.saturationPosition.y + "px"
})
},
null,
4
/* STYLE */
)
],
36
/* STYLE, NEED_HYDRATION */
),
vue.createCommentVNode(" 色相选择 "),
vue.createElementVNode(
"view",
{
class: "up-color-picker__hue",
onTouchstart: _cache[9] || (_cache[9] = (...args) => $options.onHueTouchStart && $options.onHueTouchStart(...args)),
onTouchmove: _cache[10] || (_cache[10] = (...args) => $options.onHueTouchMove && $options.onHueTouchMove(...args)),
onTouchend: _cache[11] || (_cache[11] = (...args) => $options.onHueTouchEnd && $options.onHueTouchEnd(...args))
},
[
vue.createElementVNode(
"view",
{
class: "up-color-picker__hue-pointer",
style: vue.normalizeStyle({ left: $data.huePosition + "px" })
},
null,
4
/* STYLE */
)
],
32
/* NEED_HYDRATION */
),
vue.createCommentVNode(" 透明度选择 "),
$data.colorTypeIndex == 0 ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: "up-color-picker__alpha",
onTouchstart: _cache[12] || (_cache[12] = (...args) => $options.onAlphaTouchStart && $options.onAlphaTouchStart(...args)),
onTouchmove: _cache[13] || (_cache[13] = (...args) => $options.onAlphaTouchMove && $options.onAlphaTouchMove(...args)),
onTouchend: _cache[14] || (_cache[14] = (...args) => $options.onAlphaTouchEnd && $options.onAlphaTouchEnd(...args))
},
[
vue.createElementVNode("view", { class: "up-color-picker__alpha-bg" }),
vue.createElementVNode(
"view",
{
class: "up-color-picker__alpha-pointer",
style: vue.normalizeStyle({ left: $data.alphaPosition + "px" })
},
null,
4
/* STYLE */
)
],
32
/* NEED_HYDRATION */
)) : vue.createCommentVNode("v-if", true)
]),
vue.createCommentVNode(" 常用颜色 "),
$props.commonColors && $props.commonColors.length ? (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "up-color-picker__common"
}, [
vue.createElementVNode("text", { class: "up-color-picker__common-title" }, "常用颜色"),
vue.createElementVNode("view", { class: "up-color-picker__common-list" }, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($props.commonColors, (color2, index2) => {
return vue.openBlock(), vue.createElementBlock("view", {
key: index2,
class: "up-color-picker__common-item",
style: vue.normalizeStyle({ backgroundColor: color2 }),
onClick: ($event) => $options.selectCommonColor(color2)
}, null, 12, ["onClick"]);
}),
128
/* KEYED_FRAGMENT */
))
])
])) : vue.createCommentVNode("v-if", true),
vue.createCommentVNode(" 颜色预览和操作按钮 "),
vue.createElementVNode("view", { class: "up-color-picker__footer" }, [
vue.createElementVNode("view", { class: "up-color-picker__preview" }, [
vue.createElementVNode(
"view",
{
class: "up-color-picker__preview-color",
style: vue.normalizeStyle({ backgroundColor: $options.displayColor })
},
null,
4
/* STYLE */
),
vue.createElementVNode(
"text",
{ class: "up-color-picker__preview-text" },
vue.toDisplayString($options.displayColor),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "up-color-picker__actions" }, [
vue.createVNode(_component_up_button, {
type: "primary",
size: "small",
onClick: $options.confirm,
class: "up-color-picker__btn"
}, {
default: vue.withCtx(() => [
vue.createTextVNode(" 确定 ")
]),
_: 1
/* STABLE */
}, 8, ["onClick"]),
vue.createVNode(_component_up_button, {
type: "info",
size: "small",
onClick: $options.close,
class: "up-color-picker__btn"
}, {
default: vue.withCtx(() => [
vue.createTextVNode(" 取消 ")
]),
_: 1
/* STABLE */
}, 8, ["onClick"])
])
])
])
]),
_: 1
/* STABLE */
}, 8, ["show", "onClose"])
]);
}
const uColorPicker = /* @__PURE__ */ _export_sfc(_sfc_main$1F, [["render", _sfc_render$1E], ["__scopeId", "data-v-b51e9743"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-color-picker/u-color-picker.vue"]]);
const __vite_glob_0_27 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uColorPicker
}, Symbol.toStringTag, { value: "Module" }));
const props$14 = defineMixin({
props: {
// 显示的内容,字符串
text: {
type: [Array],
default: () => props$1x.columnNotice.text
},
// 是否显示左侧的音量图标
icon: {
type: String,
default: () => props$1x.columnNotice.icon
},
// 通告模式,link-显示右箭头,closable-显示右侧关闭图标
mode: {
type: String,
default: () => props$1x.columnNotice.mode
},
// 文字颜色,各图标也会使用文字颜色
color: {
type: String,
default: () => props$1x.columnNotice.color
},
// 背景颜色
bgColor: {
type: String,
default: () => props$1x.columnNotice.bgColor
},
// 字体大小,单位px
fontSize: {
type: [String, Number],
default: () => props$1x.columnNotice.fontSize
},
// 水平滚动时的滚动速度,即每秒滚动多少px(px),这有利于控制文字无论多少时,都能有一个恒定的速度
speed: {
type: [String, Number],
default: () => props$1x.columnNotice.speed
},
// direction = row时,是否使用步进形式滚动
step: {
type: Boolean,
default: () => props$1x.columnNotice.step
},
// 滚动一个周期的时间长,单位ms
duration: {
type: [String, Number],
default: () => props$1x.columnNotice.duration
},
// 是否禁止用手滑动切换
// 目前HX2.6.11,只支持App 2.5.5+、H5 2.5.5+、支付宝小程序、字节跳动小程序
disableTouch: {
type: Boolean,
default: () => props$1x.columnNotice.disableTouch
},
justifyContent: {
type: String,
default: () => props$1x.columnNotice.justifyContent
}
}
});
const _sfc_main$1E = {
mixins: [mpMixin, mixin, props$14],
watch: {
text: {
immediate: true,
handler(newValue, oldValue) {
if (!test.array(newValue)) {
error("noticebar组件direction为column时,要求text参数为数组形式");
}
}
}
},
computed: {
// 文字内容的样式
textStyle() {
let style = {};
style.color = this.color;
style.fontSize = addUnit(this.fontSize);
return style;
},
// 垂直或者水平滚动
vertical() {
if (this.mode == "horizontal")
return false;
else
return true;
}
},
data() {
return {
index: 0
};
},
emits: ["click", "close"],
methods: {
noticeChange(e2) {
this.index = e2.detail.current;
},
// 点击通告栏
clickHandler() {
this.$emit("click", this.index);
},
// 点击关闭按钮
close() {
this.$emit("close");
}
}
};
function _sfc_render$1D(_ctx, _cache, $props, $setup, $data, $options) {
const _component_up_icon = vue.resolveComponent("up-icon");
return vue.openBlock(), vue.createElementBlock("view", {
class: "u-notice",
onClick: _cache[1] || (_cache[1] = (...args) => $options.clickHandler && $options.clickHandler(...args))
}, [
vue.renderSlot(_ctx.$slots, "icon", {}, () => [
_ctx.icon ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "u-notice__left-icon"
}, [
vue.createVNode(_component_up_icon, {
name: _ctx.icon,
color: _ctx.color,
size: "19"
}, null, 8, ["name", "color"])
])) : vue.createCommentVNode("v-if", true)
], true),
vue.createElementVNode("swiper", {
"disable-touch": _ctx.disableTouch,
vertical: _ctx.step ? false : true,
circular: "",
interval: _ctx.duration,
autoplay: true,
class: "u-notice__swiper",
onChange: _cache[0] || (_cache[0] = (...args) => $options.noticeChange && $options.noticeChange(...args))
}, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(_ctx.text, (item, index2) => {
return vue.openBlock(), vue.createElementBlock(
"swiper-item",
{
key: index2,
class: "u-notice__swiper__item",
style: vue.normalizeStyle({ "justifyContent": _ctx.justifyContent })
},
[
vue.createElementVNode(
"text",
{
class: "u-notice__swiper__item__text u-line-1",
style: vue.normalizeStyle([$options.textStyle])
},
vue.toDisplayString(item),
5
/* TEXT, STYLE */
)
],
4
/* STYLE */
);
}),
128
/* KEYED_FRAGMENT */
))
], 40, ["disable-touch", "vertical", "interval"]),
["link", "closable"].includes(_ctx.mode) ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "u-notice__right-icon"
}, [
_ctx.mode === "link" ? (vue.openBlock(), vue.createBlock(_component_up_icon, {
key: 0,
name: "arrow-right",
size: 17,
color: _ctx.color
}, null, 8, ["color"])) : vue.createCommentVNode("v-if", true),
_ctx.mode === "closable" ? (vue.openBlock(), vue.createBlock(_component_up_icon, {
key: 1,
name: "close",
size: 16,
color: _ctx.color,
onClick: $options.close
}, null, 8, ["color", "onClick"])) : vue.createCommentVNode("v-if", true)
])) : vue.createCommentVNode("v-if", true)
]);
}
const __easycom_0$6 = /* @__PURE__ */ _export_sfc(_sfc_main$1E, [["render", _sfc_render$1D], ["__scopeId", "data-v-bacc3427"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-column-notice/u-column-notice.vue"]]);
const __vite_glob_0_28 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: __easycom_0$6
}, Symbol.toStringTag, { value: "Module" }));
const _sfc_main$1D = {
name: "up-copy",
props: {
content: {
type: String,
default: ""
},
alertStyle: {
type: String,
default: "toast"
},
notice: {
type: String,
default: t$1("up.common.copy") + t$1("up.common.success")
}
},
emits: ["success"],
methods: {
t: t$1,
handleClick() {
let content = this.content;
if (!content) {
uni.showToast({
title: t$1("up.common.none"),
icon: "none",
duration: 2e3
});
return false;
}
content = typeof content === "string" ? content : content.toString();
let that2 = this;
uni.setClipboardData({
data: content,
success: function() {
if (that2.alertStyle == "modal") {
uni.showModal({
title: "up.common.tip",
content: that2.notice
});
} else {
uni.showToast({
title: that2.notice,
icon: "none"
});
}
that2.$emit("success");
},
fail: function() {
uni.showToast({
title: t$1("up.common.copy") + t$1("up.common.fail"),
icon: "none",
duration: 3e3
});
}
});
}
}
};
function _sfc_render$1C(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock("view", {
onClick: _cache[0] || (_cache[0] = (...args) => $options.handleClick && $options.handleClick(...args))
}, [
vue.renderSlot(_ctx.$slots, "default", {}, () => [
vue.createTextVNode(
vue.toDisplayString($options.t("up.common.copy")),
1
/* TEXT */
)
])
]);
}
const uCopy = /* @__PURE__ */ _export_sfc(_sfc_main$1D, [["render", _sfc_render$1C], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-copy/u-copy.vue"]]);
const __vite_glob_0_29 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uCopy
}, Symbol.toStringTag, { value: "Module" }));
const props$13 = defineMixin({
props: {
// 倒计时时长,单位ms
time: {
type: [String, Number],
default: () => props$1x.countDown.time
},
// 时间格式,DD-日,HH-时,mm-分,ss-秒,SSS-毫秒
format: {
type: String,
default: () => props$1x.countDown.format
},
// 是否自动开始倒计时
autoStart: {
type: Boolean,
default: () => props$1x.countDown.autoStart
},
// 是否展示毫秒倒计时
millisecond: {
type: Boolean,
default: () => props$1x.countDown.millisecond
}
}
});
function padZero(num, targetLength = 2) {
let str = `${num}`;
while (str.length < targetLength) {
str = `0${str}`;
}
return str;
}
const SECOND = 1e3;
const MINUTE = 60 * SECOND;
const HOUR = 60 * MINUTE;
const DAY = 24 * HOUR;
function parseTimeData(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 {
days,
hours,
minutes,
seconds,
milliseconds
};
}
function parseFormat(format2, timeData) {
let {
days,
hours,
minutes,
seconds,
milliseconds
} = timeData;
if (format2.indexOf("DD") === -1) {
hours += days * 24;
} else {
format2 = format2.replace("DD", padZero(days));
}
if (format2.indexOf("HH") === -1) {
minutes += hours * 60;
} else {
format2 = format2.replace("HH", padZero(hours));
}
if (format2.indexOf("mm") === -1) {
seconds += minutes * 60;
} else {
format2 = format2.replace("mm", padZero(minutes));
}
if (format2.indexOf("ss") === -1) {
milliseconds += seconds * 1e3;
} else {
format2 = format2.replace("ss", padZero(seconds));
}
return format2.replace("SSS", padZero(milliseconds, 3));
}
function isSameSecond(time1, time2) {
return Math.floor(time1 / 1e3) === Math.floor(time2 / 1e3);
}
const _sfc_main$1C = {
name: "u-count-down",
mixins: [mpMixin, mixin, props$13],
data() {
return {
timer: null,
// 各单位(天,时,分等)剩余时间
timeData: parseTimeData(0),
// 格式化后的时间,如"03:23:21"
formattedTime: "0",
// 倒计时是否正在进行中
runing: false,
endTime: 0,
// 结束的毫秒时间戳
remainTime: 0
// 剩余的毫秒时间
};
},
watch: {
time(n2) {
this.reset();
}
},
mounted() {
this.init();
},
emits: ["change", "finish"],
methods: {
init() {
this.reset();
},
// 开始倒计时
start() {
if (this.runing)
return;
this.runing = true;
this.endTime = Date.now() + this.remainTime;
this.toTick();
},
// 根据是否展示毫秒,执行不同操作函数
toTick() {
if (this.millisecond) {
this.microTick();
} else {
this.macroTick();
}
},
macroTick() {
this.clearTimeout();
this.timer = setTimeout(() => {
const remain = this.getRemainTime();
if (!isSameSecond(remain, this.remainTime) || remain === 0) {
this.setRemainTime(remain);
}
if (this.remainTime !== 0) {
this.macroTick();
}
}, 30);
},
microTick() {
this.clearTimeout();
this.timer = setTimeout(() => {
this.setRemainTime(this.getRemainTime());
if (this.remainTime !== 0) {
this.microTick();
}
}, 50);
},
// 获取剩余的时间
getRemainTime() {
return Math.max(this.endTime - Date.now(), 0);
},
// 设置剩余的时间
setRemainTime(remain) {
this.remainTime = remain;
const timeData = parseTimeData(remain);
this.timeData = timeData;
this.$emit("change", timeData);
this.formattedTime = parseFormat(this.format, timeData);
if (remain <= 0) {
this.pause();
this.$emit("finish");
}
},
// 重置倒计时
reset() {
this.pause();
this.remainTime = this.time;
this.setRemainTime(this.remainTime);
if (this.autoStart) {
this.start();
}
},
// 暂停倒计时
pause() {
this.runing = false;
this.clearTimeout();
},
// 清空定时器
clearTimeout() {
clearTimeout(this.timer);
this.timer = null;
}
},
beforeUnmount() {
this.clearTimeout();
}
};
function _sfc_render$1B(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock("view", { class: "u-count-down" }, [
vue.renderSlot(_ctx.$slots, "default", {
days: $data.timeData.days,
hours: $data.timeData.hours,
minutes: $data.timeData.minutes,
seconds: $data.timeData.seconds
}, () => [
vue.createElementVNode(
"text",
{ class: "u-count-down__text" },
vue.toDisplayString($data.formattedTime),
1
/* TEXT */
)
], true)
]);
}
const uCountDown = /* @__PURE__ */ _export_sfc(_sfc_main$1C, [["render", _sfc_render$1B], ["__scopeId", "data-v-2f829c0f"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-count-down/u-count-down.vue"]]);
const __vite_glob_0_30 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uCountDown
}, Symbol.toStringTag, { value: "Module" }));
const props$12 = defineMixin({
props: {
// 开始的数值,默认从0增长到某一个数
startVal: {
type: [String, Number],
default: () => props$1x.countTo.startVal
},
// 要滚动的目标数值,必须
endVal: {
type: [String, Number],
default: () => props$1x.countTo.endVal
},
// 滚动到目标数值的动画持续时间,单位为毫秒(ms)
duration: {
type: [String, Number],
default: () => props$1x.countTo.duration
},
// 设置数值后是否自动开始滚动
autoplay: {
type: Boolean,
default: () => props$1x.countTo.autoplay
},
// 要显示的小数位数
decimals: {
type: [String, Number],
default: () => props$1x.countTo.decimals
},
// 是否在即将到达目标数值的时候,使用缓慢滚动的效果
useEasing: {
type: Boolean,
default: () => props$1x.countTo.useEasing
},
// 十进制分割
decimal: {
type: [String, Number],
default: () => props$1x.countTo.decimal
},
// 字体颜色
color: {
type: String,
default: () => props$1x.countTo.color
},
// 字体大小
fontSize: {
type: [String, Number],
default: () => props$1x.countTo.fontSize
},
// 是否加粗字体
bold: {
type: Boolean,
default: () => props$1x.countTo.bold
},
// 千位分隔符,类似金额的分割(¥23,321.05中的",")
separator: {
type: String,
default: () => props$1x.countTo.separator
}
}
});
const _sfc_main$1B = {
name: "u-count-to",
data() {
return {
localStartVal: this.startVal,
displayValue: this.formatNumber(this.startVal),
printVal: null,
paused: false,
// 是否暂停
localDuration: Number(this.duration),
startTime: null,
// 开始的时间
timestamp: null,
// 时间戳
remaining: null,
// 停留的时间
rAF: null,
lastTime: 0
// 上一次的时间
};
},
mixins: [mpMixin, mixin, props$12],
computed: {
countDown() {
return this.startVal > this.endVal;
}
},
watch: {
startVal() {
this.autoplay && this.start();
},
endVal() {
this.autoplay && this.start();
}
},
mounted() {
this.autoplay && this.start();
},
emits: ["end"],
methods: {
addUnit,
easingFn(t2, b2, c2, d2) {
return c2 * (-Math.pow(2, -10 * t2 / d2) + 1) * 1024 / 1023 + b2;
},
requestAnimationFrame(callback) {
const currTime = (/* @__PURE__ */ new Date()).getTime();
const timeToCall = Math.max(0, 16 - (currTime - this.lastTime));
const id = setTimeout(() => {
callback(currTime + timeToCall);
}, timeToCall);
this.lastTime = currTime + timeToCall;
return id;
},
cancelAnimationFrame(id) {
clearTimeout(id);
},
// 开始滚动数字
start() {
this.localStartVal = this.startVal;
this.startTime = null;
this.localDuration = this.duration;
this.paused = false;
this.rAF = this.requestAnimationFrame(this.count);
},
// 暂定状态,重新再开始滚动;或者滚动状态下,暂停
reStart() {
if (this.paused) {
this.resume();
this.paused = false;
} else {
this.stop();
this.paused = true;
}
},
// 暂停
stop() {
this.cancelAnimationFrame(this.rAF);
},
// 重新开始(暂停的情况下)
resume() {
if (!this.remaining)
return;
this.startTime = 0;
this.localDuration = this.remaining;
this.localStartVal = this.printVal;
this.requestAnimationFrame(this.count);
},
// 重置
reset() {
this.startTime = null;
this.cancelAnimationFrame(this.rAF);
this.displayValue = this.formatNumber(this.startVal);
},
count(timestamp) {
if (!this.startTime)
this.startTime = timestamp;
this.timestamp = timestamp;
const progress = timestamp - this.startTime;
this.remaining = this.localDuration - progress;
if (this.useEasing) {
if (this.countDown) {
this.printVal = this.localStartVal - this.easingFn(progress, 0, this.localStartVal - this.endVal, this.localDuration);
} else {
this.printVal = this.easingFn(progress, this.localStartVal, this.endVal - this.localStartVal, this.localDuration);
}
} else {
if (this.countDown) {
this.printVal = this.localStartVal - (this.localStartVal - this.endVal) * (progress / this.localDuration);
} else {
this.printVal = this.localStartVal + (this.endVal - this.localStartVal) * (progress / this.localDuration);
}
}
if (this.countDown) {
this.printVal = this.printVal < this.endVal ? this.endVal : this.printVal;
} else {
this.printVal = this.printVal > this.endVal ? this.endVal : this.printVal;
}
this.displayValue = this.formatNumber(this.printVal) || 0;
if (progress < this.localDuration) {
this.rAF = this.requestAnimationFrame(this.count);
} else {
this.$emit("end");
}
},
// 判断是否数字
isNumber(val) {
return !isNaN(parseFloat(val));
},
formatNumber(num) {
num = Number(num);
num = num.toFixed(Number(this.decimals));
num += "";
const x2 = num.split(".");
let x1 = x2[0];
const x22 = x2.length > 1 ? this.decimal + x2[1] : "";
const rgx = /(\d+)(\d{3})/;
if (this.separator && !this.isNumber(this.separator)) {
while (rgx.test(x1)) {
x1 = x1.replace(rgx, "$1" + this.separator + "$2");
}
}
return x1 + x22;
},
destroyed() {
this.cancelAnimationFrame(this.rAF);
}
}
};
function _sfc_render$1A(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock(
"text",
{
class: "u-count-num",
style: vue.normalizeStyle({
fontSize: $options.addUnit(_ctx.fontSize),
fontWeight: _ctx.bold ? "bold" : "normal",
color: _ctx.color
})
},
vue.toDisplayString($data.displayValue),
5
/* TEXT, STYLE */
);
}
const uCountTo = /* @__PURE__ */ _export_sfc(_sfc_main$1B, [["render", _sfc_render$1A], ["__scopeId", "data-v-eb411063"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-count-to/u-count-to.vue"]]);
const __vite_glob_0_31 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uCountTo
}, Symbol.toStringTag, { value: "Module" }));
const _sfc_main$1A = {
name: "up-coupon",
props: {
// 金额
amount: {
type: [String, Number],
default: ""
},
// 金额单位
unit: {
type: String,
default: "¥"
},
// 单位位置
unitPosition: {
type: String,
default: "left"
},
// 使用限制
limit: {
type: String,
default: ""
},
// 标题
title: {
type: String,
default: "优惠券"
},
// 描述
desc: {
type: String,
default: ""
},
// 有效期
time: {
type: String,
default: ""
},
// 操作按钮文字
actionText: {
type: String,
default: "使用"
},
// 形状:coupon-优惠券, envelope-红包, card-卡片
shape: {
type: String,
default: "coupon"
},
// 尺寸:small, medium, large
size: {
type: String,
default: "medium"
},
// 是否圆形按钮
circle: {
type: Boolean,
default: false
},
// 是否禁用
disabled: {
type: Boolean,
default: false
},
// 背景颜色
bgColor: {
type: String,
default: ""
},
// 文字颜色
color: {
type: String,
default: ""
},
// 内置背景类型
type: {
type: String,
default: ""
}
},
computed: {
couponStyle() {
const style = {};
if (this.bgColor)
style.background = this.bgColor;
if (this.color)
style.color = this.color;
return style;
},
dotCount() {
const map = {
small: 8,
medium: 10,
large: 12
};
return map[this.size] || 10;
}
},
methods: {
handleClick() {
if (this.disabled)
return;
this.$emit("click");
}
}
};
function _sfc_render$1z(_ctx, _cache, $props, $setup, $data, $options) {
const _component_up_tag = vue.resolveComponent("up-tag");
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["up-coupon", [`up-coupon--${$props.shape}`, `up-coupon--${$props.type}`, `up-coupon--${$props.size}`, { "up-coupon--disabled": $props.disabled }]]),
style: vue.normalizeStyle([$options.couponStyle]),
onClick: _cache[0] || (_cache[0] = (...args) => $options.handleClick && $options.handleClick(...args))
},
[
vue.createElementVNode("view", { class: "up-coupon__content" }, [
vue.createCommentVNode(" 左侧金额区域 "),
vue.createElementVNode("view", { class: "up-coupon__amount" }, [
$props.unitPosition === "left" ? vue.renderSlot(_ctx.$slots, "unit", {
key: 0,
unit: $props.unit,
unitPosition: $props.unitPosition
}, () => [
$props.unitPosition === "left" ? (vue.openBlock(), vue.createElementBlock(
"text",
{
key: 0,
class: "up-coupon__amount-unit"
},
vue.toDisplayString($props.unit),
1
/* TEXT */
)) : vue.createCommentVNode("v-if", true)
], true) : vue.createCommentVNode("v-if", true),
vue.renderSlot(_ctx.$slots, "amount", { amount: $props.amount }, () => [
vue.createElementVNode(
"text",
{ class: "up-coupon__amount-value" },
vue.toDisplayString($props.amount),
1
/* TEXT */
)
], true),
$props.unitPosition === "right" ? vue.renderSlot(_ctx.$slots, "unit", {
key: 1,
unit: $props.unit,
unitPosition: $props.unitPosition
}, () => [
$props.unitPosition === "right" ? (vue.openBlock(), vue.createElementBlock(
"text",
{
key: 0,
class: "up-coupon__amount-unit"
},
vue.toDisplayString($props.unit),
1
/* TEXT */
)) : vue.createCommentVNode("v-if", true)
], true) : vue.createCommentVNode("v-if", true),
vue.renderSlot(_ctx.$slots, "limit", { limit: $props.limit }, () => [
$props.limit ? (vue.openBlock(), vue.createElementBlock(
"text",
{
key: 0,
class: "up-coupon__amount-limit"
},
vue.toDisplayString($props.limit),
1
/* TEXT */
)) : vue.createCommentVNode("v-if", true)
], true)
]),
vue.createCommentVNode(" 中间描述区域 "),
vue.createElementVNode("view", { class: "up-coupon__info" }, [
vue.renderSlot(_ctx.$slots, "title", { title: $props.title }, () => [
vue.createElementVNode(
"text",
{ class: "up-coupon__info-title" },
vue.toDisplayString($props.title),
1
/* TEXT */
)
], true),
vue.renderSlot(_ctx.$slots, "desc", { desc: $props.desc }, () => [
$props.desc ? (vue.openBlock(), vue.createElementBlock(
"text",
{
key: 0,
class: "up-coupon__info-desc"
},
vue.toDisplayString($props.desc),
1
/* TEXT */
)) : vue.createCommentVNode("v-if", true)
], true),
vue.renderSlot(_ctx.$slots, "time", { time: $props.time }, () => [
$props.time ? (vue.openBlock(), vue.createElementBlock(
"text",
{
key: 0,
class: "up-coupon__info-time"
},
vue.toDisplayString($props.time),
1
/* TEXT */
)) : vue.createCommentVNode("v-if", true)
], true)
]),
vue.createCommentVNode(" 右侧操作区域 "),
vue.createElementVNode("view", { class: "up-coupon__action u-padding-right-20" }, [
vue.renderSlot(_ctx.$slots, "action", {
actionText: $props.actionText,
circle: $props.circle
}, () => [
vue.createVNode(_component_up_tag, {
type: "error",
bgColor: $props.type ? "transparent" : "#eb433d",
borderColor: $props.type ? "#eee" : "#eb433d",
borderRadius: "6px",
size: "medium",
class: "up-coupon__action-text",
shape: $props.circle ? "circle" : "circle"
}, {
default: vue.withCtx(() => [
vue.createTextVNode(
vue.toDisplayString($props.actionText),
1
/* TEXT */
)
]),
_: 1
/* STABLE */
}, 8, ["bgColor", "borderColor", "shape"])
], true)
])
]),
vue.createCommentVNode(" 红包绳子效果 "),
$props.shape === "envelope" ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "up-coupon__rope"
})) : vue.createCommentVNode("v-if", true),
vue.createCommentVNode(" 默认插槽,可用于添加额外内容 "),
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
],
6
/* CLASS, STYLE */
);
}
const uCoupon = /* @__PURE__ */ _export_sfc(_sfc_main$1A, [["render", _sfc_render$1z], ["__scopeId", "data-v-8013dcad"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-coupon/u-coupon.vue"]]);
const __vite_glob_0_32 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uCoupon
}, Symbol.toStringTag, { value: "Module" }));
const tabHeight = 50;
const _sfc_main$1z = {
name: "u-cropper",
data() {
return {
// 添加实例ID用于区分不同实例
instanceId: Date.now() + "-" + Math.random().toString(36).substr(2, 9),
cvsStyleHeight: "0px",
styleDisplay: "none",
styleTop: "-10000px",
prvTop: "-10000px",
imgStyle: {},
selStyle: {},
showOper: true,
imgSrc: {
imgSrc: ""
},
btnWidth: "19%",
btnDsp: "flex",
// 裁剪区域宽度,用于设置选择区域的宽度
arWidth: "",
// 裁剪区域高度,用于设置选择区域的高度
arHeight: "",
// 导出图片宽度,用于设置最终导出图片的宽度
expWidth: "",
// 导出图片高度,用于设置最终导出图片的高度
expHeight: "",
// 是否允许调整裁剪框大小
letChangeSize: false
};
},
watch: {
avatarSrc() {
this.imgSrc.imgSrc = this.avatarSrc;
}
},
emits: ["avtinit", "confirm"],
props: {
minScale: "",
maxScale: "",
canScale: true,
canRotate: true,
lockWidth: "",
lockHeight: "",
stretch: "",
lock: "",
noTab: true,
inner: false,
quality: "",
index: "",
canChangeSize: false,
areaWidth: "300rpx",
// 裁剪区域高度,用于设置选择区域的高度
areaHeight: "300rpx",
// 导出图片宽度,用于设置最终导出图片的宽度
exportWidth: "260rpx",
// 导出图片高度,用于设置最终导出图片的高度
exportHeight: "260rpx"
},
created() {
this.ctxCanvas = uni.createCanvasContext("avatar-canvas-" + this.instanceId, this);
this.ctxCanvasOper = uni.createCanvasContext("oper-canvas-" + this.instanceId, this);
this.ctxCanvasPrv = uni.createCanvasContext("prv-canvas-" + this.instanceId, this);
this.qlty = parseInt(this.quality) || 0.9;
this.imgSrc.imgSrc = this.imageSrc;
this.letRotate = this.canRotate === false || this.inner === true ? 0 : 1;
this.letScale = this.canScale === false ? 0 : 1;
this.letChangeSize = this.canChangeSize;
this.isin = this.inner === true ? 1 : 0;
this.indx = this.index || void 0;
this.mnScale = this.minScale || 0.3;
this.mxScale = this.maxScale || 4;
this.noBar = this.noTab === true ? 1 : 0;
this.stc = this.stretch;
this.lck = this.lock;
if (this.isin) {
this.btnWidth = "24%";
this.btnDsp = "none";
} else {
this.btnWidth = "19%";
this.btnDsp = "flex";
}
if (this.noBar) {
this.moreHeight = 0;
this.windowResize();
} else {
uni.showTabBar({
complete: (res) => {
this.moreHeight = res.errMsg === "showTabBar:ok" ? 50 : 0;
this.windowResize();
}
});
}
},
methods: {
t: t$1,
windowResize() {
let sysInfo = uni.getSystemInfoSync();
this.platform = sysInfo.platform;
this.pixelRatio = sysInfo.pixelRatio;
this.windowWidth = sysInfo.windowWidth;
if (this.platform === "android") {
this.windowHeight = sysInfo.screenHeight + sysInfo.statusBarHeight;
this.cvsStyleHeight = this.windowHeight - tabHeight + "px";
} else {
this.windowHeight = sysInfo.windowHeight + this.moreHeight;
this.cvsStyleHeight = this.windowHeight - tabHeight + 6 + "px";
}
this.pxRatio = this.windowWidth / 750;
let style = this.avatarStyle;
if (style && style !== true && (style = style.trim())) {
style = style.split(";");
let obj = {};
for (let v2 of style) {
if (!v2)
continue;
v2 = v2.trim().split(":");
if (v2[1].indexOf("rpx") >= 0) {
let arr = v2[1].trim().split(" ");
for (let k2 in arr) {
if (!arr[k2])
continue;
if (arr[k2].indexOf("rpx") >= 0) {
arr[k2] = parseFloat(arr[k2]) * this.pxRatio + "px";
}
}
v2[1] = arr.join(" ");
}
obj[v2[0].trim()] = v2[1].trim();
}
this.imgStyle = obj;
}
this.expWidth && (this.expWidth = this.expWidth.indexOf("rpx") >= 0 ? parseInt(this.expWidth) * this.pxRatio : parseInt(this.expWidth));
this.expHeight && (this.expHeight = this.expHeight.indexOf("rpx") >= 0 ? parseInt(this.expHeight) * this.pxRatio : parseInt(this.expHeight));
if (this.styleDisplay === "flex") {
this.drawInit(true);
}
this.hideImg();
},
select() {
if (this.fSelecting)
return;
this.fSelecting = true;
setTimeout(() => {
this.fSelecting = false;
}, 500);
uni.chooseImage({
count: 1,
sizeType: ["original", "compressed"],
sourceType: ["album", "camera"],
success: (r2) => {
uni.showLoading({ mask: true });
let path = this.imgPath = r2.tempFilePaths[0];
uni.getImageInfo({
src: path,
success: (r3) => {
this.imgWidth = r3.width;
this.imgHeight = r3.height;
this.path = path;
if (!this.hasSel) {
let style = this.selStyle || {};
if (this.arWidth && this.arHeight) {
let areaWidth = this.arWidth.indexOf("rpx") >= 0 ? parseInt(this.arWidth) * this.pxRatio : parseInt(this.arWidth), areaHeight = this.arHeight.indexOf("rpx") >= 0 ? parseInt(this.arHeight) * this.pxRatio : parseInt(this.arHeight);
style.width = areaWidth + "px";
style.height = areaHeight + "px";
style.top = (this.windowHeight - areaHeight - tabHeight) / 2 + "px";
style.left = (this.windowWidth - areaWidth) / 2 + "px";
} else {
uni.showModal({
title: t$1("up.cropper.emptyWidhtOrHeight"),
showCancel: false
});
return;
}
this.selStyle = style;
}
if (this.noBar) {
this.drawInit(true);
} else {
uni.hideTabBar({
complete: () => {
this.drawInit(true);
}
});
}
},
fail: () => {
uni.showToast({
title: "error3",
duration: 2e3
});
},
complete() {
uni.hideLoading();
}
});
}
});
},
confirm() {
if (this.fUploading)
return;
this.fUploading = true;
setTimeout(() => {
this.fUploading = false;
}, 1e3);
let style = this.selStyle, x2 = parseInt(style.left), y2 = parseInt(style.top), width = parseInt(style.width), height = parseInt(style.height), expWidth = this.expWidth || width, expHeight = this.expHeight || height;
uni.showLoading({ mask: true });
this.styleDisplay = "none";
this.styleTop = "-10000px";
this.hasSel = false;
this.hideImg();
uni.canvasToTempFilePath({
x: x2,
y: y2,
width,
height,
destWidth: expWidth,
destHeight: expHeight,
canvasId: "avatar-canvas-" + this.instanceId,
fileType: "png",
quality: this.qlty,
success: (r2) => {
r2 = r2.tempFilePath;
this.$emit("confirm", { avatar: this.imgSrc, path: r2, index: this.indx, data: this.rtn });
},
fail: (res) => {
uni.showToast({
title: "error1",
duration: 2e3
});
},
complete: () => {
uni.hideLoading();
this.noBar || uni.showTabBar();
}
}, this);
},
// 用户点击"预览"模式下的"确认"按钮时被调用,用于将预览的裁剪结果上传
prvUpload() {
if (this.fPrvUploading)
return;
this.fPrvUploading = true;
setTimeout(() => {
this.fPrvUploading = false;
}, 1e3);
let style = this.selStyle;
parseInt(style.width);
parseInt(style.height);
let prvX = this.prvX, prvY = this.prvY, prvWidth = this.prvWidth, prvHeight = this.prvHeight, expWidth = this.expWidth || prvWidth, expHeight = this.expHeight || prvHeight;
uni.showLoading({ mask: true });
this.styleDisplay = "none";
this.styleTop = "-10000px";
this.hasSel = false;
this.hideImg();
uni.canvasToTempFilePath({
x: prvX,
y: prvY,
width: prvWidth,
height: prvHeight,
destWidth: expWidth,
destHeight: expHeight,
canvasId: "prv-canvas-" + this.instanceId,
fileType: "png",
quality: this.qlty,
success: (r2) => {
r2 = r2.tempFilePath;
this.$emit("confirm", { avatar: this.imgSrc, path: r2, index: this.indx, data: this.rtn });
},
fail: () => {
uni.showToast({
title: "error_prv",
duration: 2e3
});
},
complete: () => {
uni.hideLoading();
this.noBar || uni.showTabBar();
}
}, this);
},
drawInit(ini = false) {
let allWidth = this.windowWidth, allHeight = this.windowHeight, imgWidth = this.imgWidth, imgHeight = this.imgHeight, imgRadio = imgWidth / imgHeight, useWidth = allWidth - 40, useHeight = allHeight - tabHeight - 80;
this.pixelRatio;
let selWidth = parseInt(this.selStyle.width), selHeight = parseInt(this.selStyle.height);
this.fixWidth = 0;
this.fixHeight = 0;
this.lckWidth = 0;
this.lckHeight = 0;
switch (this.stc) {
case "x":
this.fixWidth = 1;
break;
case "y":
this.fixHeight = 1;
break;
case "long":
if (imgRadio > 1)
this.fixWidth = 1;
else
this.fixHeight = 1;
break;
case "short":
if (imgRadio > 1)
this.fixHeight = 1;
else
this.fixWidth = 1;
break;
case "longSel":
if (selWidth > selHeight)
this.fixWidth = 1;
else
this.fixHeight = 1;
break;
case "shortSel":
if (selWidth > selHeight)
this.fixHeight = 1;
else
this.fixWidth = 1;
break;
}
switch (this.lck) {
case "x":
this.lckWidth = 1;
break;
case "y":
this.lckHeight = 1;
break;
case "long":
if (imgRadio > 1)
this.lckWidth = 1;
else
this.lckHeight = 1;
break;
case "short":
if (imgRadio > 1)
this.lckHeight = 1;
else
this.lckWidth = 1;
break;
case "longSel":
if (selWidth > selHeight)
this.lckWidth = 1;
else
this.lckHeight = 1;
break;
case "shortSel":
if (selWidth > selHeight)
this.lckHeight = 1;
else
this.lckWidth = 1;
break;
}
if (this.fixWidth) {
useWidth = selWidth;
useHeight = useWidth / imgRadio;
} else if (this.fixHeight) {
useHeight = selHeight;
useWidth = useHeight * imgRadio;
} else if (imgRadio < 1) {
if (imgHeight < useHeight) {
useWidth = imgWidth;
useHeight = imgHeight;
} else {
useHeight = useHeight;
useWidth = useHeight * imgRadio;
}
} else {
if (imgWidth < useWidth) {
useWidth = imgWidth;
useHeight = imgHeight;
} else {
useWidth = useWidth;
useHeight = useWidth / imgRadio;
}
}
if (this.isin) {
this.scaleWidth = 0;
this.scaleHeight = 0;
if (useWidth < selWidth) {
useWidth = selWidth;
useHeight = useWidth / imgRadio;
this.lckHeight = 0;
}
if (useHeight < selHeight) {
useHeight = selHeight;
useWidth = useHeight * imgRadio;
this.lckWidth = 0;
}
}
this.scaleSize = 1;
this.rotateDeg = 0;
this.posWidth = (allWidth - useWidth) / 2;
this.posHeight = (allHeight - useHeight - tabHeight) / 2;
this.useWidth = useWidth;
this.useHeight = useHeight;
let style = this.selStyle, left = parseInt(style.left), top = parseInt(style.top), width = parseInt(style.width), height = parseInt(style.height);
this.canvas;
this.canvasOper;
let ctxCanvas = this.ctxCanvas, ctxCanvasOper = this.ctxCanvasOper;
ctxCanvasOper.setLineWidth(3);
ctxCanvasOper.setStrokeStyle("grey");
ctxCanvasOper.setGlobalAlpha(0.4);
ctxCanvasOper.setFillStyle("black");
ctxCanvasOper.strokeRect(left, top, width, height);
ctxCanvasOper.fillRect(0, 0, this.windowWidth, top);
ctxCanvasOper.fillRect(0, top, left, height);
ctxCanvasOper.fillRect(0, top + height, this.windowWidth, this.windowHeight - height - top - tabHeight);
ctxCanvasOper.fillRect(left + width, top, this.windowWidth - width - left, height);
ctxCanvasOper.setStrokeStyle("red");
ctxCanvasOper.moveTo(left + 20, top);
ctxCanvasOper.lineTo(left, top);
ctxCanvasOper.lineTo(left, top + 20);
ctxCanvasOper.moveTo(left + width - 20, top);
ctxCanvasOper.lineTo(left + width, top);
ctxCanvasOper.lineTo(left + width, top + 20);
ctxCanvasOper.moveTo(left + 20, top + height);
ctxCanvasOper.lineTo(left, top + height);
ctxCanvasOper.lineTo(left, top + height - 20);
ctxCanvasOper.moveTo(left + width - 20, top + height);
ctxCanvasOper.lineTo(left + width, top + height);
ctxCanvasOper.lineTo(left + width, top + height - 20);
const controlPointSize = 10;
ctxCanvasOper.setFillStyle("white");
ctxCanvasOper.setStrokeStyle("grey");
ctxCanvasOper.setLineWidth(1);
ctxCanvasOper.fillRect(left - controlPointSize / 2, top - controlPointSize / 2, controlPointSize, controlPointSize);
ctxCanvasOper.strokeRect(left - controlPointSize / 2, top - controlPointSize / 2, controlPointSize, controlPointSize);
ctxCanvasOper.fillRect(left + width - controlPointSize / 2, top - controlPointSize / 2, controlPointSize, controlPointSize);
ctxCanvasOper.strokeRect(left + width - controlPointSize / 2, top - controlPointSize / 2, controlPointSize, controlPointSize);
ctxCanvasOper.fillRect(left - controlPointSize / 2, top + height - controlPointSize / 2, controlPointSize, controlPointSize);
ctxCanvasOper.strokeRect(left - controlPointSize / 2, top + height - controlPointSize / 2, controlPointSize, controlPointSize);
ctxCanvasOper.fillRect(left + width - controlPointSize / 2, top + height - controlPointSize / 2, controlPointSize, controlPointSize);
ctxCanvasOper.strokeRect(left + width - controlPointSize / 2, top + height - controlPointSize / 2, controlPointSize, controlPointSize);
ctxCanvasOper.stroke();
ctxCanvasOper.draw(false, () => {
if (ini) {
this.styleDisplay = "flex";
this.styleTop = "0";
ctxCanvas.setFillStyle("black");
this.drawImage();
}
});
this.$emit("avtinit");
},
drawImage() {
let tm_now = Date.now();
if (tm_now - this.drawTm < 20)
return;
this.drawTm = tm_now;
let ctxCanvas = this.ctxCanvas;
ctxCanvas.fillRect(0, 0, this.windowWidth, this.windowHeight - tabHeight);
ctxCanvas.translate(this.posWidth + this.useWidth / 2, this.posHeight + this.useHeight / 2);
ctxCanvas.scale(this.scaleSize, this.scaleSize);
ctxCanvas.rotate(this.rotateDeg * Math.PI / 180);
ctxCanvas.drawImage(this.imgPath, -this.useWidth / 2, -this.useHeight / 2, this.useWidth, this.useHeight);
ctxCanvas.draw(false);
},
hideImg() {
this.prvImg = "";
this.prvTop = "-10000px";
this.showOper = true;
this.prvImgData = null;
this.target = null;
},
close() {
this.styleDisplay = "none";
this.styleTop = "-10000px";
this.hasSel = false;
this.hideImg();
this.noBar || uni.showTabBar();
},
preview() {
if (this.fPreviewing)
return;
this.fPreviewing = true;
setTimeout(() => {
this.fPreviewing = false;
}, 1e3);
let style = this.selStyle, x2 = parseInt(style.left), y2 = parseInt(style.top), width = parseInt(style.width), height = parseInt(style.height);
uni.showLoading({ mask: true });
uni.canvasToTempFilePath({
x: x2,
y: y2,
width,
height,
canvasId: "avatar-canvas-" + this.instanceId,
fileType: "png",
quality: this.qlty,
success: (r2) => {
this.prvImgTmp = r2 = r2.tempFilePath;
let ctxCanvasPrv = this.ctxCanvasPrv, prvX = this.windowWidth, prvY = parseInt(this.cvsStyleHeight), prvWidth = parseInt(this.selStyle.width), prvHeight = parseInt(this.selStyle.height), useWidth = prvX - 40, useHeight = prvY - 80, radio = useWidth / prvWidth, rHeight = prvHeight * radio;
if (rHeight < useHeight) {
prvWidth = useWidth;
prvHeight = rHeight;
} else {
radio = useHeight / prvHeight;
prvWidth *= radio;
prvHeight = useHeight;
}
ctxCanvasPrv.setFillStyle("black");
ctxCanvasPrv.fillRect(0, 0, prvX, prvY);
ctxCanvasPrv.fillRect(x2, y2, width, height);
this.prvX = prvX = (prvX - prvWidth) / 2;
this.prvY = prvY = (prvY - prvHeight) / 2;
this.prvWidth = prvWidth;
this.prvHeight = prvHeight;
ctxCanvasPrv.drawImage(r2, prvX, prvY, prvWidth, prvHeight);
ctxCanvasPrv.draw(false, () => {
if (this.platform != "android") {
this.showOper = false;
}
this.prvTop = "0";
});
},
fail: () => {
uni.showToast({
title: "error2",
duration: 2e3
});
},
complete: () => {
uni.hideLoading();
}
}, this);
},
chooseImage(index2 = void 0, params2 = void 0, data = void 0) {
if (params2) {
formatAppLog("log", "at uni_modules/uview-plus/components/u-cropper/u-cropper.vue:698", params2);
let areaWidth = params2.areaWidth || this.areaWidth, areaHeight = params2.areaHeight || this.areaHeight, expWidth = params2.exportWidth || this.exportWidth, expHeight = params2.exportHeight || this.exportHeight, quality = params2.quality, canRotate = params2.canRotate, canScale = params2.canScale, canChangeSize = params2.canChangeSize, minScale = params2.minScale, maxScale = params2.maxScale, stretch = params2.stretch, inner = params2.inner, lock = params2.lock;
formatAppLog("log", "at uni_modules/uview-plus/components/u-cropper/u-cropper.vue:712", "areaWidth", this.areaWidth);
expWidth && (this.expWidth = expWidth.indexOf("rpx") >= 0 ? parseInt(expWidth) * this.pxRatio : parseInt(expWidth));
expHeight && (this.expHeight = expHeight.indexOf("rpx") >= 0 ? parseInt(expHeight) * this.pxRatio : parseInt(expHeight));
this.letRotate = canRotate === false ? 0 : 1;
this.letScale = canScale === false ? 0 : 1;
this.letChangeSize = canChangeSize || false;
this.qlty = parseInt(quality) || 0.9;
this.mnScale = minScale || 0.3;
this.mxScale = maxScale || 4;
this.stc = stretch;
this.isin = inner === true ? 1 : 0;
this.lck = lock;
if (this.isin) {
this.btnWidth = "24%";
this.btnDsp = "none";
} else {
this.btnWidth = "19%";
this.btnDsp = "flex";
}
if (areaWidth && areaHeight) {
areaWidth = areaWidth.indexOf("rpx") >= 0 ? parseInt(areaWidth) * this.pxRatio : parseInt(areaWidth);
areaHeight = areaHeight.indexOf("rpx") >= 0 ? parseInt(areaHeight) * this.pxRatio : parseInt(areaHeight);
this.selStyle.width = areaWidth + "px";
this.selStyle.height = areaHeight + "px";
this.selStyle.top = (this.windowHeight - areaHeight - tabHeight) / 2 + "px";
this.selStyle.left = (this.windowWidth - areaWidth) / 2 + "px";
this.hasSel = true;
}
}
this.rtn = data;
this.indx = index2;
this.select();
},
rotate() {
if (this.platform === "android") {
if (this.fRotateing)
return;
this.fRotateing = true;
setTimeout(() => {
this.fRotateing = false;
}, 500);
}
this.rotateDeg += 90 - this.rotateDeg % 90;
this.drawImage();
},
start(e2) {
let touches = e2.touches, touch0 = touches[0], touch1 = touches[1];
this.touch0 = touch0;
this.touch1 = touch1;
if (touch1) {
let x2 = touch1.x - touch0.x, y2 = touch1.y - touch0.y;
this.fgDistance = Math.sqrt(x2 * x2 + y2 * y2);
} else {
if (this.letChangeSize) {
const controlPointSize = 20;
const x2 = touch0.x;
const y2 = touch0.y;
const style = this.selStyle;
const left = parseInt(style.left);
const top = parseInt(style.top);
const width = parseInt(style.width);
const height = parseInt(style.height);
if (Math.abs(x2 - left) < controlPointSize && Math.abs(y2 - top) < controlPointSize) {
this.resizeHandle = "top-left";
} else if (Math.abs(x2 - (left + width)) < controlPointSize && Math.abs(y2 - top) < controlPointSize) {
this.resizeHandle = "top-right";
} else if (Math.abs(x2 - left) < controlPointSize && Math.abs(y2 - (top + height)) < controlPointSize) {
this.resizeHandle = "bottom-left";
} else if (Math.abs(x2 - (left + width)) < controlPointSize && Math.abs(y2 - (top + height)) < controlPointSize) {
this.resizeHandle = "bottom-right";
} else {
this.resizeHandle = null;
}
} else {
this.resizeHandle = null;
}
}
},
move(e2) {
let touches = e2.touches, touch0 = touches[0], touch1 = touches[1];
if (touch1) {
let x2 = touch1.x - touch0.x, y2 = touch1.y - touch0.y, fgDistance = Math.sqrt(x2 * x2 + y2 * y2), scaleSize = 5e-3 * (fgDistance - this.fgDistance), beScaleSize = this.scaleSize + scaleSize;
do {
if (!this.letScale)
break;
if (beScaleSize < this.mnScale)
break;
if (beScaleSize > this.mxScale)
break;
if (this.isin) {
let imgWidth = this.useWidth * beScaleSize, imgHeight = this.useHeight * beScaleSize, rx0 = this.posWidth + this.useWidth / 2, ry0 = this.posHeight + this.useHeight / 2, l2 = rx0 - imgWidth / 2, t2 = ry0 - imgHeight / 2, r2 = l2 + imgWidth, b2 = t2 + imgHeight, left = parseInt(this.selStyle.left), top = parseInt(this.selStyle.top), width = parseInt(this.selStyle.width), height = parseInt(this.selStyle.height);
if (left < l2 || left + width > r2 || top < t2 || top + height > b2)
break;
this.scaleWidth = (this.useWidth - imgWidth) / 2;
this.scaleHeight = (this.useHeight - imgHeight) / 2;
}
this.scaleSize = beScaleSize;
} while (0);
this.fgDistance = fgDistance;
if (touch1.x !== touch0.x && this.letRotate) {
x2 = (this.touch1.y - this.touch0.y) / (this.touch1.x - this.touch0.x);
y2 = (touch1.y - touch0.y) / (touch1.x - touch0.x);
this.rotateDeg += Math.atan((y2 - x2) / (1 + x2 * y2)) * 180 / Math.PI;
this.touch0 = touch0;
this.touch1 = touch1;
}
this.drawImage();
} else if (this.touch0) {
if (this.resizeHandle && this.letChangeSize) {
const style = { ...this.selStyle };
const left = parseInt(style.left);
const top = parseInt(style.top);
const width = parseInt(style.width);
const height = parseInt(style.height);
const minWidth = 50;
const minHeight = 50;
switch (this.resizeHandle) {
case "top-left":
style.left = touch0.x + "px";
style.top = touch0.y + "px";
style.width = left + width - touch0.x + "px";
style.height = top + height - touch0.y + "px";
break;
case "top-right":
style.top = touch0.y + "px";
style.width = touch0.x - left + "px";
style.height = top + height - touch0.y + "px";
break;
case "bottom-left":
style.left = touch0.x + "px";
style.width = left + width - touch0.x + "px";
style.height = touch0.y - top + "px";
break;
case "bottom-right":
style.width = touch0.x - left + "px";
style.height = touch0.y - top + "px";
break;
}
if (parseInt(style.width) >= minWidth && parseInt(style.height) >= minHeight) {
if (parseInt(style.left) >= 0 && parseInt(style.top) >= 0 && parseInt(style.left) + parseInt(style.width) <= this.windowWidth && parseInt(style.top) + parseInt(style.height) <= this.windowHeight - tabHeight) {
this.selStyle = style;
this.drawInit();
}
}
} else {
let x2 = touch0.x - this.touch0.x, y2 = touch0.y - this.touch0.y, beX = this.posWidth + x2, beY = this.posHeight + y2;
if (this.isin) {
let imgWidth = this.useWidth * this.scaleSize, imgHeight = this.useHeight * this.scaleSize, rx0 = beX + this.useWidth / 2, ry0 = beY + this.useHeight / 2, l2 = rx0 - imgWidth / 2, t2 = ry0 - imgHeight / 2, r2 = l2 + imgWidth, b2 = t2 + imgHeight, left = parseInt(this.selStyle.left), top = parseInt(this.selStyle.top), width = parseInt(this.selStyle.width), height = parseInt(this.selStyle.height);
if (!this.lckWidth && Math.abs(x2) < 100) {
if (left >= l2 && left + width <= r2) {
this.posWidth = beX;
} else if (left < l2) {
this.posWidth = left - this.scaleWidth;
} else if (left + width > r2) {
this.posWidth = left - (imgWidth - width) - this.scaleWidth;
}
}
if (!this.lckHeight && Math.abs(y2) < 100) {
if (top >= t2 && top + height <= b2) {
this.posHeight = beY;
} else if (top < t2) {
this.posHeight = top - this.scaleHeight;
} else if (top + height > b2) {
this.posHeight = top - (imgHeight - height) - this.scaleHeight;
}
}
} else {
if (Math.abs(x2) < 100 && !this.lckWidth)
this.posWidth = beX;
if (Math.abs(y2) < 100 && !this.lckHeight)
this.posHeight = beY;
}
this.touch0 = touch0;
this.drawImage();
}
}
},
end(e2) {
let touches = e2.touches, touch0 = touches && touches[0];
touches && touches[1];
if (touch0) {
this.touch0 = touch0;
} else {
this.touch0 = null;
this.touch1 = null;
this.resizeHandle = null;
}
},
getImgData() {
return new Promise((resolve, reject) => {
let prvX = this.prvX, prvY = this.prvY, prvWidth = this.prvWidth, prvHeight = this.prvHeight;
prvX *= this.pixelRatio;
prvY *= this.pixelRatio;
prvWidth *= this.pixelRatio;
prvHeight *= this.pixelRatio;
uni.canvasGetImageData({
canvasId: "prv-canvas-" + this.instanceId,
x: prvX,
y: prvY,
width: prvWidth,
height: prvHeight,
success(res) {
resolve(res.data);
},
fail(err) {
reject(err);
}
}, this);
});
},
async colorChange(e2) {
let tm_now = Date.now();
if (tm_now - this.prvTm < 100)
return;
this.prvTm = tm_now;
uni.showLoading({ mask: true });
if (!this.prvImgData) {
if (!(this.prvImgData = await this.getImgData().catch((res) => {
uni.showToast({
title: "error_read",
duration: 2e3
});
})))
return;
this.target = new Uint8ClampedArray(this.prvImgData.length);
}
let data = this.prvImgData, target = this.target, i2 = e2.detail.value, r2, g2, b2, a2, h2, s2, l2, d2, p2, q2, min, max, hK, tR, tG, tB;
if (i2 === 0) {
target = data;
} else {
i2 = (i2 + 100) / 200;
if (i2 < 5e-3)
i2 = 0;
if (i2 > 0.995)
i2 = 1;
for (let n2 = data.length - 1; n2 >= 0; n2 -= 4) {
r2 = data[n2 - 3] / 255;
g2 = data[n2 - 2] / 255;
b2 = data[n2 - 1] / 255;
max = Math.max(r2, g2, b2);
min = Math.min(r2, g2, b2);
d2 = max - min;
if (max === min) {
h2 = 0;
} else if (max === r2 && g2 >= b2) {
h2 = 60 * ((g2 - b2) / d2);
} else if (max === r2 && g2 < b2) {
h2 = 60 * ((g2 - b2) / d2) + 360;
} else if (max === g2) {
h2 = 60 * ((b2 - r2) / d2) + 120;
} else if (max === b2) {
h2 = 60 * ((r2 - g2) / d2) + 240;
}
l2 = (max + min) / 2;
if (l2 === 0 || max === min) {
s2 = 0;
} else if (0 < l2 && l2 <= 0.5) {
s2 = d2 / (2 * l2);
} else if (l2 > 0.5) {
s2 = d2 / (2 - 2 * l2);
}
data[n2] && (a2 = data[n2]);
if (i2 < 0.5) {
s2 = s2 * i2 / 0.5;
} else if (i2 > 0.5) {
s2 = 2 * s2 + 2 * i2 - s2 * i2 / 0.5 - 1;
}
if (s2 === 0) {
r2 = g2 = b2 = Math.round(l2 * 255);
} else {
if (l2 < 0.5) {
q2 = l2 * (1 + s2);
} else if (l2 >= 0.5) {
q2 = l2 + s2 - l2 * s2;
}
p2 = 2 * l2 - q2;
hK = h2 / 360;
tR = hK + 1 / 3;
tG = hK;
tB = hK - 1 / 3;
let correctRGB = (t2) => {
if (t2 < 0) {
return t2 + 1;
}
if (t2 > 1) {
return t2 - 1;
}
return t2;
};
let createRGB = (t2) => {
if (t2 < 1 / 6) {
return p2 + (q2 - p2) * 6 * t2;
} else if (t2 >= 1 / 6 && t2 < 1 / 2) {
return q2;
} else if (t2 >= 1 / 2 && t2 < 2 / 3) {
return p2 + (q2 - p2) * 6 * (2 / 3 - t2);
}
return p2;
};
r2 = tR = Math.round(createRGB(correctRGB(tR)) * 255);
g2 = tG = Math.round(createRGB(correctRGB(tG)) * 255);
b2 = tB = Math.round(createRGB(correctRGB(tB)) * 255);
}
a2 && (target[n2] = a2);
target[n2 - 3] = r2;
target[n2 - 2] = g2;
target[n2 - 1] = b2;
}
}
let prvX = this.prvX, prvY = this.prvY, prvWidth = this.prvWidth, prvHeight = this.prvHeight;
this.ctxCanvasPrv.setFillStyle("black");
this.ctxCanvasPrv.fillRect(prvX, prvY, prvWidth, prvHeight);
this.ctxCanvasPrv.draw(true);
prvX *= this.pixelRatio;
prvY *= this.pixelRatio;
prvWidth *= this.pixelRatio;
prvHeight *= this.pixelRatio;
uni.canvasPutImageData({
canvasId: "prv-canvas-" + this.instanceId,
x: prvX,
y: prvY,
width: prvWidth,
height: prvHeight,
data: target,
fail() {
uni.showToast({
title: "error_put",
duration: 2e3
});
},
complete() {
uni.hideLoading();
}
}, this);
},
btop(base64) {
return new Promise(function(resolve, reject) {
var arr = base64.split(","), mime = arr[0].match(/:(.*?);/)[1], bstr = atob(arr[1]), n2 = bstr.length, u8arr = new Uint8Array(n2);
while (n2--) {
u8arr[n2] = bstr.charCodeAt(n2);
}
return resolve((window.URL || window.webkitURL).createObjectURL(new Blob([u8arr], { type: mime })));
});
}
}
};
function _sfc_render$1y(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock("view", { class: "u-cropper" }, [
vue.createCommentVNode(' '),
vue.createElementVNode("canvas", {
"canvas-id": "avatar-canvas-" + $data.instanceId,
id: "avatar-canvas-" + $data.instanceId,
class: "my-canvas",
style: vue.normalizeStyle({ top: $data.styleTop, height: $data.cvsStyleHeight }),
"disable-scroll": "false"
}, null, 12, ["canvas-id", "id"]),
vue.createElementVNode("canvas", {
"canvas-id": "oper-canvas-" + $data.instanceId,
id: "oper-canvas-" + $data.instanceId,
class: "oper-canvas",
style: vue.normalizeStyle({ top: $data.styleTop, height: $data.cvsStyleHeight }),
"disable-scroll": "false",
onTouchstart: _cache[0] || (_cache[0] = (...args) => $options.start && $options.start(...args)),
onTouchmove: _cache[1] || (_cache[1] = (...args) => $options.move && $options.move(...args)),
onTouchend: _cache[2] || (_cache[2] = (...args) => $options.end && $options.end(...args))
}, null, 44, ["canvas-id", "id"]),
vue.createElementVNode("canvas", {
"canvas-id": "prv-canvas-" + $data.instanceId,
id: "prv-canvas-" + $data.instanceId,
class: "prv-canvas",
"disable-scroll": "false",
onTouchstart: _cache[3] || (_cache[3] = (...args) => $options.hideImg && $options.hideImg(...args)),
style: vue.normalizeStyle({ height: $data.cvsStyleHeight, top: $data.prvTop })
}, null, 44, ["canvas-id", "id"]),
vue.createElementVNode(
"view",
{
class: "oper-wrapper",
style: vue.normalizeStyle({ display: $data.styleDisplay })
},
[
vue.createElementVNode("view", { class: "oper" }, [
$data.showOper ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "btn-wrapper"
}, [
vue.createElementVNode(
"view",
{
onClick: _cache[4] || (_cache[4] = (...args) => $options.select && $options.select(...args)),
"hover-class": "hover",
style: vue.normalizeStyle({ width: $data.btnWidth })
},
[
vue.createElementVNode(
"text",
null,
vue.toDisplayString($options.t("up.common.re-select")),
1
/* TEXT */
)
],
4
/* STYLE */
),
vue.createElementVNode(
"view",
{
onClick: _cache[5] || (_cache[5] = (...args) => $options.close && $options.close(...args)),
"hover-class": "hover",
style: vue.normalizeStyle({ width: $data.btnWidth })
},
[
vue.createElementVNode(
"text",
null,
vue.toDisplayString($options.t("up.common.close")),
1
/* TEXT */
)
],
4
/* STYLE */
),
vue.createElementVNode(
"view",
{
onClick: _cache[6] || (_cache[6] = (...args) => $options.rotate && $options.rotate(...args)),
"hover-class": "hover",
style: vue.normalizeStyle({ width: $data.btnWidth, display: $data.btnDsp })
},
[
vue.createElementVNode(
"text",
null,
vue.toDisplayString($options.t("up.common.rotate")),
1
/* TEXT */
)
],
4
/* STYLE */
),
vue.createElementVNode(
"view",
{
onClick: _cache[7] || (_cache[7] = (...args) => $options.preview && $options.preview(...args)),
"hover-class": "hover",
style: vue.normalizeStyle({ width: $data.btnWidth })
},
[
vue.createElementVNode(
"text",
null,
vue.toDisplayString($options.t("up.common.preview")),
1
/* TEXT */
)
],
4
/* STYLE */
),
vue.createElementVNode(
"view",
{
onClick: _cache[8] || (_cache[8] = (...args) => $options.confirm && $options.confirm(...args)),
"hover-class": "hover",
style: vue.normalizeStyle({ width: $data.btnWidth })
},
[
vue.createElementVNode(
"text",
null,
vue.toDisplayString($options.t("up.common.confirm")),
1
/* TEXT */
)
],
4
/* STYLE */
)
])) : (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "clr-wrapper"
}, [
vue.createElementVNode(
"slider",
{
class: "my-slider",
onChange: _cache[9] || (_cache[9] = (...args) => $options.colorChange && $options.colorChange(...args)),
"block-size": "25",
value: "0",
min: "-100",
max: "100",
activeColor: "red",
backgroundColor: "green",
"block-color": "grey",
"show-value": ""
},
null,
32
/* NEED_HYDRATION */
),
vue.createElementVNode(
"view",
{
onClick: _cache[10] || (_cache[10] = (...args) => $options.prvUpload && $options.prvUpload(...args)),
"hover-class": "hover",
style: vue.normalizeStyle({ width: $data.btnWidth })
},
[
vue.createElementVNode(
"text",
null,
vue.toDisplayString($options.t("up.common.confirm")),
1
/* TEXT */
)
],
4
/* STYLE */
)
]))
])
],
4
/* STYLE */
),
$data.styleDisplay == "none" ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
onClick: _cache[11] || (_cache[11] = ($event) => $options.chooseImage(0, {}))
}, [
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
])) : vue.createCommentVNode("v-if", true)
]);
}
const uCropper = /* @__PURE__ */ _export_sfc(_sfc_main$1z, [["render", _sfc_render$1y], ["__scopeId", "data-v-4888bba5"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-cropper/u-cropper.vue"]]);
const __vite_glob_0_33 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uCropper
}, Symbol.toStringTag, { value: "Module" }));
const props$11 = defineMixin({
props: {
// 是否展示工具条
show: {
type: Boolean,
default: () => props$1x.toolbar.show
},
// 取消按钮的文字
cancelText: {
type: String,
default: () => props$1x.toolbar.cancelText
},
// 确认按钮的文字
confirmText: {
type: String,
default: () => props$1x.toolbar.confirmText
},
// 取消按钮的颜色
cancelColor: {
type: String,
default: () => props$1x.toolbar.cancelColor
},
// 确认按钮的颜色
confirmColor: {
type: String,
default: () => props$1x.toolbar.confirmColor
},
// 标题文字
title: {
type: String,
default: () => props$1x.toolbar.title
},
// 开启右侧插槽
rightSlot: {
type: Boolean,
default: false
}
}
});
const _sfc_main$1y = {
name: "u-toolbar",
mixins: [mpMixin, mixin, props$11],
emits: ["confirm", "cancel"],
created() {
},
methods: {
// 点击取消按钮
cancel() {
this.$emit("cancel");
},
// 点击确定按钮
confirm() {
this.$emit("confirm");
}
}
};
function _sfc_render$1x(_ctx, _cache, $props, $setup, $data, $options) {
return _ctx.show ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: "u-toolbar",
onTouchmove: _cache[2] || (_cache[2] = vue.withModifiers((...args) => _ctx.noop && _ctx.noop(...args), ["stop", "prevent"]))
},
[
vue.createElementVNode("view", { class: "u-toolbar__left" }, [
vue.createElementVNode("view", {
class: "u-toolbar__cancel__wrapper",
"hover-class": "u-hover-class"
}, [
vue.createElementVNode(
"text",
{
class: "u-toolbar__wrapper__cancel",
onClick: _cache[0] || (_cache[0] = (...args) => $options.cancel && $options.cancel(...args)),
style: vue.normalizeStyle({
color: _ctx.cancelColor
})
},
vue.toDisplayString(_ctx.cancelText),
5
/* TEXT, STYLE */
)
])
]),
_ctx.title ? (vue.openBlock(), vue.createElementBlock(
"text",
{
key: 0,
class: "u-toolbar__title u-line-1"
},
vue.toDisplayString(_ctx.title),
1
/* TEXT */
)) : vue.createCommentVNode("v-if", true),
vue.createElementVNode("view", { class: "u-toolbar__right" }, [
!_ctx.rightSlot ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "u-toolbar__confirm__wrapper",
"hover-class": "u-hover-class"
}, [
vue.createElementVNode(
"text",
{
class: "u-toolbar__wrapper__confirm",
onClick: _cache[1] || (_cache[1] = (...args) => $options.confirm && $options.confirm(...args)),
style: vue.normalizeStyle({
color: _ctx.confirmColor
})
},
vue.toDisplayString(_ctx.confirmText),
5
/* TEXT, STYLE */
)
])) : vue.renderSlot(_ctx.$slots, "right", { key: 1 }, void 0, true)
])
],
32
/* NEED_HYDRATION */
)) : vue.createCommentVNode("v-if", true);
}
const __easycom_0$5 = /* @__PURE__ */ _export_sfc(_sfc_main$1y, [["render", _sfc_render$1x], ["__scopeId", "data-v-eadae74e"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-toolbar/u-toolbar.vue"]]);
const __vite_glob_0_121 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: __easycom_0$5
}, Symbol.toStringTag, { value: "Module" }));
const props$10 = defineMixin({
props: {
modelValue: {
type: Array,
default: () => []
},
hasInput: {
type: Boolean,
default: false
},
inputProps: {
type: Object,
default: () => {
return {};
}
},
disabled: {
type: Boolean,
default: () => props$1x.picker.disabled
},
disabledColor: {
type: String,
default: () => props$1x.picker.disabledColor
},
placeholder: {
type: String,
default: () => props$1x.picker.placeholder
},
// 是否展示picker弹窗
show: {
type: Boolean,
default: () => props$1x.picker.show
},
// 弹出的方向,可选值为 top bottom right left center
popupMode: {
type: String,
default: () => props$1x.picker.popupMode
},
// 是否展示顶部的操作栏
showToolbar: {
type: Boolean,
default: () => props$1x.picker.showToolbar
},
// 顶部标题
title: {
type: String,
default: () => props$1x.picker.title
},
// 对象数组,设置每一列的数据
columns: {
type: Array,
default: () => props$1x.picker.columns
},
// 是否显示加载中状态
loading: {
type: Boolean,
default: () => props$1x.picker.loading
},
// 各列中,单个选项的高度
itemHeight: {
type: [String, Number],
default: () => props$1x.picker.itemHeight
},
// 取消按钮的文字
cancelText: {
type: String,
default: () => props$1x.picker.cancelText
},
// 确认按钮的文字
confirmText: {
type: String,
default: () => props$1x.picker.confirmText
},
// 取消按钮的颜色
cancelColor: {
type: String,
default: () => props$1x.picker.cancelColor
},
// 确认按钮的颜色
confirmColor: {
type: String,
default: () => props$1x.picker.confirmColor
},
// 每列中可见选项的数量
visibleItemCount: {
type: [String, Number],
default: () => props$1x.picker.visibleItemCount
},
// 选项对象中,需要展示的属性键名
keyName: {
type: String,
default: () => props$1x.picker.keyName
},
// 选项对象中,需要获取的属性值键名
valueName: {
type: String,
default: () => props$1x.picker.valueName
},
// 是否允许点击遮罩关闭选择器
closeOnClickOverlay: {
type: Boolean,
default: () => props$1x.picker.closeOnClickOverlay
},
// 各列的默认索引
defaultIndex: {
type: Array,
default: () => props$1x.picker.defaultIndex
},
// 是否在手指松开时立即触发 change 事件。若不开启则会在滚动动画结束后触发 change 事件,只在微信2.21.1及以上有效
immediateChange: {
type: Boolean,
default: () => props$1x.picker.immediateChange
},
// 工具栏右侧插槽是否开启
toolbarRightSlot: {
type: Boolean,
default: false
},
// 层级
zIndex: {
type: [String, Number],
default: () => props$1x.picker.zIndex
},
// 弹窗背景色,设置为transparent可去除白色背景
bgColor: {
type: String,
default: () => props$1x.picker.bgColor
},
// 是否显示圆角
round: {
type: [Boolean, String, Number],
default: () => props$1x.picker.round
},
// 动画时长,单位ms
duration: {
type: [String, Number],
default: () => props$1x.picker.duration
},
// 遮罩的透明度,0-1之间
overlayOpacity: {
type: [Number, String],
default: () => props$1x.picker.overlayOpacity
},
// 是否页面内展示
pageInline: {
type: Boolean,
default: () => props$1x.picker.pageInline
}
}
});
const _sfc_main$1x = {
name: "u-picker",
mixins: [mpMixin, mixin, props$10],
data() {
return {
// 上一次选择的列索引
lastIndex: [],
// 索引值 ,对应picker-view的value
innerIndex: [],
// 各列的值
innerColumns: [],
// 上一次的变化列索引
columnIndex: 0,
showByClickInput: false,
currentActiveValue: []
//当前用户选中,但是还没确认的值,用户没做change操作时候,点击确认可以默认选中第一个
};
},
watch: {
// 监听columns参数的变化
columns: {
immediate: true,
deep: true,
handler(n2) {
this.setColumns(n2);
}
},
// 监听默认索引的变化,重新设置对应的值
defaultIndex: {
immediate: true,
deep: true,
handler(n2, o2) {
if (!o2 || n2.join("/") != o2.join("/")) {
this.setIndexs(n2, true);
}
}
},
modelValue: {
immediate: true,
deep: true,
handler(n2, o2) {
if (!o2 || n2.join("/") != o2.join("/")) {
let arr = [];
if (n2 != null) {
n2.forEach((element, index2) => {
let currentCols = this.getColumnValues(index2);
if (currentCols && Object.prototype.toString.call(currentCols) === "[object Object]") {
currentCols.forEach((item, index22) => {
if (item[this.keyName] == element) {
arr.push(index22);
}
});
} else {
currentCols.forEach((item, index22) => {
if (item == element) {
arr.push(index22);
}
});
}
});
if (arr.length == 0 && this.defaultIndex)
;
else {
this.setIndexs(arr, true);
}
}
}
}
}
},
emits: ["close", "cancel", "confirm", "change", "update:modelValue", "update:show"],
computed: {
// input的props
inputPropsInner() {
return {
border: this.inputBorder,
placeholder: this.placeholder,
disabled: this.disabled,
disabledColor: this.disabledColor,
...this.inputProps
};
},
//已选&&已确认的值显示在input上面的文案
inputLabel() {
let firstItem = this.innerColumns[0] && this.innerColumns[0][0];
if (firstItem && Object.prototype.toString.call(firstItem) === "[object Object]") {
let res = this.innerColumns[0].filter((item) => this.modelValue.includes(item["id"]));
res = res.map((item) => item[this.keyName]);
return res.join("/");
} else {
return this.modelValue.join("/");
}
},
//已选,待确认的值
inputValue() {
let items = this.innerColumns.map((item, index2) => item[this.innerIndex[index2]]);
let res = [];
if (items[0] && Object.prototype.toString.call(items[0]) === "[object Object]") {
items.forEach((element) => {
res.push(element && element[this.valueName]);
});
} else {
items.forEach((element, index2) => {
res.push(element);
});
}
return res;
}
},
methods: {
addUnit,
testArray: test.array,
onShowByClickInput() {
if (!this.disabled) {
this.showByClickInput = !this.showByClickInput;
}
},
// 获取item需要显示的文字,判别为对象还是文本
getItemText(item) {
if (test.object(item)) {
return item[this.keyName];
} else {
return item;
}
},
// 关闭选择器
closeHandler() {
if (this.closeOnClickOverlay) {
if (this.hasInput) {
this.showByClickInput = false;
}
this.setDefault();
this.$emit("update:show", false);
this.$emit("close");
}
},
// 点击工具栏的取消按钮
cancel() {
if (this.hasInput) {
this.showByClickInput = false;
}
this.setDefault();
this.$emit("update:show", false);
this.$emit("cancel");
},
setDefault() {
let arr = [0];
if (this.lastIndex.length == 0) {
if (Array.isArray(this.defaultIndex) && this.defaultIndex.length == this.innerColumns.length) {
arr = [...this.defaultIndex];
} else {
arr = Array(this.innerColumns.length).fill(0);
}
} else {
arr = deepClone(this.lastIndex);
}
this.setLastIndex(arr);
this.setIndexs(arr);
},
// 点击工具栏的确定按钮
confirm() {
if (!this.currentActiveValue.length) {
this.setDefault();
}
this.$emit("update:modelValue", this.inputValue);
if (this.hasInput) {
this.showByClickInput = false;
}
this.setLastIndex(this.innerIndex);
this.$emit("update:show", false);
this.$emit("confirm", {
indexs: this.innerIndex,
value: this.innerColumns.map((item, index2) => item[this.innerIndex[index2]]),
values: this.innerColumns
});
},
// 选择器某一列的数据发生变化时触发
changeHandler(e2) {
const {
value: value2
} = e2.detail;
let index2 = 0, columnIndex = 0;
this.currentActiveValue = value2;
for (let i2 = 0; i2 < value2.length; i2++) {
let item = value2[i2];
if (item !== (this.lastIndex[i2] || 0)) {
columnIndex = i2;
index2 = item;
break;
}
}
this.columnIndex = columnIndex;
const values = this.innerColumns;
this.setIndexs(value2);
this.$emit("change", {
// 微信小程序不能传递this,会因为循环引用而报错
// picker: this,
value: this.innerColumns.map((item, index3) => item[value2[index3]]),
index: index2,
indexs: value2,
// values为当前变化列的数组内容
values,
columnIndex
});
},
// 设置index索引,此方法可被外部调用设置
setIndexs(index2, setLastIndex) {
this.innerIndex = deepClone(index2);
if (setLastIndex) {
this.setLastIndex(index2);
}
},
// 记录上一次的各列索引位置
setLastIndex(index2) {
this.lastIndex = deepClone(index2);
},
// 设置对应列选项的所有值
setColumnValues(columnIndex, values) {
this.innerColumns.splice(columnIndex, 1, values);
this.setLastIndex(this.innerIndex.slice(0, columnIndex));
let tmpIndex = deepClone(this.innerIndex);
for (let i2 = 0; i2 < this.innerColumns.length; i2++) {
if (i2 > this.columnIndex) {
tmpIndex[i2] = 0;
}
}
this.setIndexs(tmpIndex);
},
// 获取对应列的所有选项
getColumnValues(columnIndex) {
(async () => {
await sleep();
})();
return this.innerColumns[columnIndex];
},
// 设置整体各列的columns的值
setColumns(columns) {
this.innerColumns = deepClone(columns);
if (this.innerIndex.length === 0) {
this.innerIndex = new Array(columns.length).fill(0);
}
},
// 获取各列选中值对应的索引
getIndexs() {
return this.innerIndex;
},
// 获取各列选中的值
getValues() {
(async () => {
await sleep();
})();
return this.innerColumns.map((item, index2) => item[this.innerIndex[index2]]);
}
}
};
function _sfc_render$1w(_ctx, _cache, $props, $setup, $data, $options) {
const _component_up_input = vue.resolveComponent("up-input");
const _component_u_toolbar = resolveEasycom(vue.resolveDynamicComponent("u-toolbar"), __easycom_0$5);
const _component_u_loading_icon = resolveEasycom(vue.resolveDynamicComponent("u-loading-icon"), __easycom_0$e);
const _component_u_popup = resolveEasycom(vue.resolveDynamicComponent("u-popup"), __easycom_2);
return vue.openBlock(), vue.createElementBlock("view", { class: "u-picker-wraper" }, [
_ctx.hasInput ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "u-picker-input cursor-pointer",
onClick: _cache[1] || (_cache[1] = (...args) => $options.onShowByClickInput && $options.onShowByClickInput(...args))
}, [
vue.renderSlot(_ctx.$slots, "default", { value: $options.inputLabel }, void 0, true),
vue.renderSlot(_ctx.$slots, "trigger", { value: $options.inputLabel }, void 0, true),
!_ctx.$slots["default"] && !_ctx.$slots["$default"] && !_ctx.$slots["trigger"] ? (vue.openBlock(), vue.createBlock(_component_up_input, vue.mergeProps({
key: 0,
readonly: true,
modelValue: $options.inputLabel,
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $options.inputLabel = $event)
}, $options.inputPropsInner), null, 16, ["modelValue"])) : vue.createCommentVNode("v-if", true),
vue.createElementVNode("view", { class: "input-cover" })
])) : vue.createCommentVNode("v-if", true),
vue.createVNode(_component_u_popup, {
show: _ctx.show || _ctx.hasInput && $data.showByClickInput,
mode: _ctx.popupMode,
zIndex: _ctx.zIndex,
bgColor: _ctx.bgColor,
round: _ctx.round,
duration: _ctx.duration,
pageInline: _ctx.pageInline,
overlayOpacity: _ctx.overlayOpacity,
onClose: $options.closeHandler
}, {
default: vue.withCtx(() => [
vue.createElementVNode("view", { class: "u-picker" }, [
_ctx.showToolbar ? (vue.openBlock(), vue.createBlock(_component_u_toolbar, {
key: 0,
cancelColor: _ctx.cancelColor,
confirmColor: _ctx.confirmColor,
cancelText: _ctx.cancelText,
confirmText: _ctx.confirmText,
title: _ctx.title,
rightSlot: _ctx.toolbarRightSlot ? true : false,
onCancel: $options.cancel,
onConfirm: $options.confirm
}, {
right: vue.withCtx(() => [
vue.renderSlot(_ctx.$slots, "toolbar-right", {}, void 0, true)
]),
_: 3
/* FORWARDED */
}, 8, ["cancelColor", "confirmColor", "cancelText", "confirmText", "title", "rightSlot", "onCancel", "onConfirm"])) : vue.createCommentVNode("v-if", true),
vue.renderSlot(_ctx.$slots, "toolbar-bottom", {}, void 0, true),
vue.createElementVNode("picker-view", {
class: "u-picker__view",
indicatorStyle: `height: ${$options.addUnit(_ctx.itemHeight, "px")}`,
value: $data.innerIndex,
immediateChange: _ctx.immediateChange,
style: vue.normalizeStyle({
height: `${$options.addUnit(_ctx.visibleItemCount * _ctx.itemHeight, "px")}`
}),
onChange: _cache[2] || (_cache[2] = (...args) => $options.changeHandler && $options.changeHandler(...args))
}, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($data.innerColumns, (item, index2) => {
return vue.openBlock(), vue.createElementBlock("picker-view-column", {
key: index2,
class: "u-picker__view__column"
}, [
$options.testArray(item) ? (vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
{ key: 0 },
vue.renderList(item, (item1, index1) => {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["u-picker__view__column__item u-line-1", [index1 === $data.innerIndex[index2] && "u-picker__view__column__item--selected"]]),
key: index1,
style: vue.normalizeStyle({
height: $options.addUnit(_ctx.itemHeight, "px"),
lineHeight: $options.addUnit(_ctx.itemHeight, "px"),
fontWeight: index1 === $data.innerIndex[index2] ? "bold" : "normal",
display: "block"
})
},
vue.toDisplayString($options.getItemText(item1)),
7
/* TEXT, CLASS, STYLE */
);
}),
128
/* KEYED_FRAGMENT */
)) : vue.createCommentVNode("v-if", true)
]);
}),
128
/* KEYED_FRAGMENT */
))
], 44, ["indicatorStyle", "value", "immediateChange"]),
_ctx.loading ? (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "u-picker--loading"
}, [
vue.createVNode(_component_u_loading_icon, { mode: "circle" })
])) : vue.createCommentVNode("v-if", true)
])
]),
_: 3
/* FORWARDED */
}, 8, ["show", "mode", "zIndex", "bgColor", "round", "duration", "pageInline", "overlayOpacity", "onClose"])
]);
}
const __easycom_0$4 = /* @__PURE__ */ _export_sfc(_sfc_main$1x, [["render", _sfc_render$1w], ["__scopeId", "data-v-91b05052"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-picker/u-picker.vue"]]);
const __vite_glob_0_78 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: __easycom_0$4
}, Symbol.toStringTag, { value: "Module" }));
const props$$ = defineMixin({
props: {
// 是否显示input
hasInput: {
type: Boolean,
default: false
},
inputProps: {
type: Object,
default: () => {
return {};
}
},
inputBorder: {
type: String,
default: () => props$1x.input.inputBorder
},
disabled: {
type: Boolean,
default: () => props$1x.input.disabled
},
disabledColor: {
type: String,
default: () => props$1x.input.disabledColor
},
placeholder: {
type: String,
default: () => props$1x.input.placeholder
},
format: {
type: String,
default: () => ""
},
// 是否打开组件
show: {
type: Boolean,
default: () => props$1x.datetimePicker.show
},
// 弹出的方向,可选值为 top bottom right left center
popupMode: {
type: String,
default: () => props$1x.picker.popupMode
},
// 是否展示顶部的操作栏
showToolbar: {
type: Boolean,
default: () => props$1x.datetimePicker.showToolbar
},
// 工具栏右侧内容
toolbarRightSlot: {
type: Boolean,
default: false
},
// 绑定值
modelValue: {
type: [String, Number],
default: () => props$1x.datetimePicker.value
},
// 顶部标题
title: {
type: String,
default: () => props$1x.datetimePicker.title
},
// 展示格式,mode=date为日期选择,mode=time为时间选择,mode=year-month为年月选择,mode=datetime为日期时间选择
mode: {
type: String,
default: () => props$1x.datetimePicker.mode
},
// 可选的最大时间
maxDate: {
type: Number,
// 最大默认值为后10年
default: () => props$1x.datetimePicker.maxDate
},
// 可选的最小时间
minDate: {
type: Number,
// 最小默认值为前10年
default: () => props$1x.datetimePicker.minDate
},
// 可选的最小小时,仅mode=time有效
minHour: {
type: Number,
default: () => props$1x.datetimePicker.minHour
},
// 可选的最大小时,仅mode=time有效
maxHour: {
type: Number,
default: () => props$1x.datetimePicker.maxHour
},
// 可选的最小分钟,仅mode=time有效
minMinute: {
type: Number,
default: () => props$1x.datetimePicker.minMinute
},
// 可选的最大分钟,仅mode=time有效
maxMinute: {
type: Number,
default: () => props$1x.datetimePicker.maxMinute
},
// 选项过滤函数
filter: {
type: [Function, null],
default: () => props$1x.datetimePicker.filter
},
// 选项格式化函数
formatter: {
type: [Function, null],
default: () => props$1x.datetimePicker.formatter
},
// 是否显示加载中状态
loading: {
type: Boolean,
default: () => props$1x.datetimePicker.loading
},
// 各列中,单个选项的高度
itemHeight: {
type: [String, Number],
default: () => props$1x.datetimePicker.itemHeight
},
// 取消按钮的文字
cancelText: {
type: String,
default: () => props$1x.datetimePicker.cancelText
},
// 确认按钮的文字
confirmText: {
type: String,
default: () => props$1x.datetimePicker.confirmText
},
// 取消按钮的颜色
cancelColor: {
type: String,
default: () => props$1x.datetimePicker.cancelColor
},
// 确认按钮的颜色
confirmColor: {
type: String,
default: () => props$1x.datetimePicker.confirmColor
},
// 每列中可见选项的数量
visibleItemCount: {
type: [String, Number],
default: () => props$1x.datetimePicker.visibleItemCount
},
// 是否允许点击遮罩关闭选择器
closeOnClickOverlay: {
type: Boolean,
default: () => props$1x.datetimePicker.closeOnClickOverlay
},
// 各列的默认索引
defaultIndex: {
type: Array,
default: () => props$1x.datetimePicker.defaultIndex
},
// 是否页面内展示
pageInline: {
type: Boolean,
default: () => props$1x.datetimePicker.pageInline
}
}
});
function times(n2, iteratee) {
let index2 = -1;
const result = Array(n2 < 0 ? 0 : n2);
while (++index2 < n2) {
result[index2] = iteratee(index2);
}
return result;
}
const _sfc_main$1w = {
name: "up-datetime-picker",
mixins: [mpMixin, mixin, props$$],
data() {
return {
// 原来的日期选择器不方便,这里增加一个hasInput选项支持类似element的自带输入框的功能。
inputValue: "",
// 表单显示值
showByClickInput: false,
// 是否在hasInput模式下显示日期选择弹唱
columns: [],
innerDefaultIndex: [],
innerFormatter: (type2, value2) => value2
};
},
watch: {
show(newValue, oldValue) {
if (newValue) {
this.innerValue = this.correctValue(this.modelValue);
this.updateColumnValue(this.innerValue);
}
},
modelValue(newValue) {
this.init();
},
propsChange() {
this.init();
}
},
computed: {
// 如果以下这些变量发生了变化,意味着需要重新初始化各列的值
propsChange() {
return [this.mode, this.maxDate, this.minDate, this.minHour, this.maxHour, this.minMinute, this.maxMinute, this.filter, this.modelValue];
},
// input的props
inputPropsInner() {
return {
border: this.inputBorder,
placeholder: this.placeholder,
disabled: this.disabled,
disabledColor: this.disabledColor,
...this.inputProps
};
}
},
mounted() {
this.init();
},
emits: ["close", "cancel", "confirm", "change", "update:modelValue"],
methods: {
getInputValue(newValue) {
if (newValue == "" || !newValue || newValue == void 0) {
this.inputValue = "";
return;
}
if (this.mode == "time") {
this.inputValue = newValue;
} else {
if (this.format) {
this.inputValue = e$1(newValue).format(this.format);
} else {
let format2 = "";
switch (this.mode) {
case "date":
format2 = "YYYY-MM-DD";
break;
case "year-month":
format2 = "YYYY-MM";
break;
case "datehour":
format2 = "YYYY-MM-DD HH";
break;
case "datetime":
format2 = "YYYY-MM-DD HH:mm";
break;
case "time":
format2 = "HH:mm";
break;
}
this.inputValue = e$1(newValue).format(format2);
}
}
},
init() {
this.innerValue = this.correctValue(this.modelValue);
this.updateColumnValue(this.innerValue);
this.getInputValue(this.innerValue);
},
// 在微信小程序中,不支持将函数当做props参数,故只能通过ref形式调用
setFormatter(e2) {
this.innerFormatter = e2;
},
// 关闭选择器
close() {
if (this.closeOnClickOverlay) {
this.$emit("close");
}
},
// 点击工具栏的取消按钮
cancel() {
if (this.hasInput) {
this.showByClickInput = false;
}
this.$emit("cancel");
},
// 点击工具栏的确定按钮
confirm() {
this.$emit("update:modelValue", this.innerValue);
if (this.hasInput) {
this.getInputValue(this.innerValue);
this.showByClickInput = false;
}
this.$emit("confirm", {
value: this.innerValue,
mode: this.mode
});
},
//用正则截取输出值,当出现多组数字时,抛出错误
intercept(e2, type2) {
let judge = e2.match(/\d+/g);
if (judge.length > 1) {
error("请勿在过滤或格式化函数时添加数字");
return 0;
} else if (type2 && judge[0].length == 4) {
return judge[0];
} else if (judge[0].length > 2) {
error("请勿在过滤或格式化函数时添加数字");
return 0;
} else {
return judge[0];
}
},
// 列发生变化时触发
change(e2) {
const { indexs, values } = e2;
let selectValue = "";
if (this.mode === "time") {
selectValue = `${this.intercept(values[0][indexs[0]])}:${this.intercept(values[1][indexs[1]])}`;
} else {
const year = parseInt(this.intercept(values[0][indexs[0]], "year"));
const month = parseInt(this.intercept(values[1][indexs[1]]));
let date3 = parseInt(values[2] ? this.intercept(values[2][indexs[2]]) : 1);
let hour = 0, minute = 0;
const maxDate = e$1(`${year}-${month}`).daysInMonth();
if (this.mode === "year-month") {
date3 = 1;
}
date3 = Math.min(maxDate, date3);
if (this.mode === "datetime") {
hour = parseInt(this.intercept(values[3][indexs[3]]));
minute = parseInt(this.intercept(values[4][indexs[4]]));
}
selectValue = Number(new Date(year, month - 1, date3, hour, minute));
}
selectValue = this.correctValue(selectValue);
this.innerValue = selectValue;
this.updateColumnValue(selectValue);
this.$emit("change", {
value: selectValue,
// 微信小程序不能传递this实例,会因为循环引用而报错
// picker: this.$refs.picker,
mode: this.mode
});
},
// 更新各列的值,进行补0、格式化等操作
updateColumnValue(value2) {
this.innerValue = value2;
this.updateColumns();
setTimeout(() => {
this.updateIndexs(value2);
}, 0);
},
// 更新索引
updateIndexs(value2) {
let values = [];
const formatter = this.formatter || this.innerFormatter;
if (this.mode === "time") {
const timeArr = value2.split(":");
values = [formatter("hour", timeArr[0]), formatter("minute", timeArr[1])];
} else {
values = [
formatter("year", `${e$1(value2).year()}`),
// 月份补0
formatter("month", padZero$1(e$1(value2).month() + 1))
];
if (this.mode === "date") {
values.push(formatter("day", padZero$1(e$1(value2).date())));
}
if (this.mode === "datetime") {
values.push(formatter("day", padZero$1(e$1(value2).date())), formatter("hour", padZero$1(e$1(value2).hour())), formatter("minute", padZero$1(e$1(value2).minute())));
}
}
const indexs = this.columns.map((column, index2) => {
return Math.max(0, column.findIndex((item) => item === values[index2]));
});
this.innerDefaultIndex = indexs;
},
// 更新各列的值
updateColumns() {
const formatter = this.formatter || this.innerFormatter;
const results = this.getOriginColumns().map((column) => column.values.map((value2) => formatter(column.type, value2)));
this.columns = results;
},
getOriginColumns() {
const results = this.getRanges().map(({ type: type2, range: range2 }) => {
let values = times(range2[1] - range2[0] + 1, (index2) => {
let value2 = range2[0] + index2;
value2 = type2 === "year" ? `${value2}` : padZero$1(value2);
return value2;
});
if (this.filter) {
values = this.filter(type2, values);
if (!values || values && values.length == 0) {
formatAppLog("log", "at uni_modules/uview-plus/components/u-datetime-picker/u-datetime-picker.vue:366", "日期filter结果不能为空");
}
}
return { type: type2, values };
});
return results;
},
// 通过最大值和最小值生成数组
generateArray(start, end) {
return Array.from(new Array(end + 1).keys()).slice(start);
},
// 得出合法的时间
correctValue(value2) {
const isDateMode = this.mode !== "time";
if (isDateMode && !e$1.unix(value2).isValid()) {
value2 = this.minDate;
} else if (!isDateMode && !value2) {
value2 = `${padZero$1(this.minHour)}:${padZero$1(this.minMinute)}`;
}
if (!isDateMode) {
if (String(value2).indexOf(":") === -1)
return error("时间错误,请传递如12:24的格式");
let [hour, minute] = value2.split(":");
hour = padZero$1(range$1(this.minHour, this.maxHour, Number(hour)));
minute = padZero$1(range$1(this.minMinute, this.maxMinute, Number(minute)));
return `${hour}:${minute}`;
} else {
value2 = e$1(value2).isBefore(e$1(this.minDate)) ? this.minDate : value2;
value2 = e$1(value2).isAfter(e$1(this.maxDate)) ? this.maxDate : value2;
return value2;
}
},
// 获取每列的最大和最小值
getRanges() {
if (this.mode === "time") {
return [
{
type: "hour",
range: [this.minHour, this.maxHour]
},
{
type: "minute",
range: [this.minMinute, this.maxMinute]
}
];
}
const { maxYear, maxDate, maxMonth, maxHour, maxMinute } = this.getBoundary("max", this.innerValue);
const { minYear, minDate, minMonth, minHour, minMinute } = this.getBoundary("min", this.innerValue);
const result = [
{
type: "year",
range: [minYear, maxYear]
},
{
type: "month",
range: [minMonth, maxMonth]
},
{
type: "day",
range: [minDate, maxDate]
},
{
type: "hour",
range: [minHour, maxHour]
},
{
type: "minute",
range: [minMinute, maxMinute]
}
];
if (this.mode === "date")
result.splice(3, 2);
if (this.mode === "year-month")
result.splice(2, 3);
return result;
},
// 根据minDate、maxDate、minHour、maxHour等边界值,判断各列的开始和结束边界值
getBoundary(type2, innerValue) {
let value2 = new Date(innerValue);
if (isNaN(value2.getTime())) {
value2 = /* @__PURE__ */ new Date();
}
const boundary = new Date(this[`${type2}Date`]);
const year = e$1(boundary).year();
let month = 1;
let date3 = 1;
let hour = 0;
let minute = 0;
if (type2 === "max") {
month = 12;
date3 = e$1(value2).daysInMonth();
hour = 23;
minute = 59;
}
if (e$1(value2).year() === year) {
month = e$1(boundary).month() + 1;
if (e$1(value2).month() + 1 === month) {
date3 = e$1(boundary).date();
if (e$1(value2).date() === date3) {
hour = e$1(boundary).hour();
if (e$1(value2).hour() === hour) {
minute = e$1(boundary).minute();
}
}
}
}
return {
[`${type2}Year`]: year,
[`${type2}Month`]: month,
[`${type2}Date`]: date3,
[`${type2}Hour`]: hour,
[`${type2}Minute`]: minute
};
},
onShowByClickInput() {
if (!this.disabled) {
this.showByClickInput = !this.showByClickInput;
}
}
}
};
function _sfc_render$1v(_ctx, _cache, $props, $setup, $data, $options) {
const _component_up_input = vue.resolveComponent("up-input");
const _component_u_picker = resolveEasycom(vue.resolveDynamicComponent("u-picker"), __easycom_0$4);
return vue.openBlock(), vue.createElementBlock("view", { class: "u-datetime-picker" }, [
_ctx.hasInput ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "u-datetime-picker__has-input",
onClick: _cache[1] || (_cache[1] = (...args) => $options.onShowByClickInput && $options.onShowByClickInput(...args))
}, [
vue.renderSlot(_ctx.$slots, "trigger", { value: $data.inputValue }, () => [
vue.createVNode(_component_up_input, vue.mergeProps({
readonly: !!$data.showByClickInput,
modelValue: $data.inputValue,
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.inputValue = $event)
}, $options.inputPropsInner), null, 16, ["readonly", "modelValue"]),
vue.createElementVNode("view", { class: "input-cover" })
], true)
])) : vue.createCommentVNode("v-if", true),
vue.createVNode(_component_u_picker, {
ref: "picker",
show: _ctx.pageInline || _ctx.show || _ctx.hasInput && $data.showByClickInput,
popupMode: _ctx.popupMode,
closeOnClickOverlay: _ctx.closeOnClickOverlay,
columns: $data.columns,
title: _ctx.title,
itemHeight: _ctx.itemHeight,
showToolbar: _ctx.showToolbar,
visibleItemCount: _ctx.visibleItemCount,
defaultIndex: $data.innerDefaultIndex,
cancelText: _ctx.cancelText,
confirmText: _ctx.confirmText,
cancelColor: _ctx.cancelColor,
confirmColor: _ctx.confirmColor,
toolbarRightSlot: _ctx.toolbarRightSlot,
pageInline: _ctx.pageInline,
onClose: $options.close,
onCancel: $options.cancel,
onConfirm: $options.confirm,
onChange: $options.change
}, {
"toolbar-right": vue.withCtx(() => [
vue.renderSlot(_ctx.$slots, "toolbar-right", {}, void 0, true)
]),
"toolbar-bottom": vue.withCtx(() => [
vue.renderSlot(_ctx.$slots, "toolbar-bottom", {}, void 0, true)
]),
_: 3
/* FORWARDED */
}, 8, ["show", "popupMode", "closeOnClickOverlay", "columns", "title", "itemHeight", "showToolbar", "visibleItemCount", "defaultIndex", "cancelText", "confirmText", "cancelColor", "confirmColor", "toolbarRightSlot", "pageInline", "onClose", "onCancel", "onConfirm", "onChange"])
]);
}
const uDatetimePicker = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["render", _sfc_render$1v], ["__scopeId", "data-v-e7a0f1eb"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-datetime-picker/u-datetime-picker.vue"]]);
const __vite_glob_0_34 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uDatetimePicker
}, Symbol.toStringTag, { value: "Module" }));
const props$_ = defineMixin({
props: {
// 是否虚线
dashed: {
type: Boolean,
default: () => props$1x.divider.dashed
},
// 是否细线
hairline: {
type: Boolean,
default: () => props$1x.divider.hairline
},
// 是否以点替代文字,优先于text字段起作用
dot: {
type: Boolean,
default: () => props$1x.divider.dot
},
// 内容文本的位置,left-左边,center-中间,right-右边
textPosition: {
type: String,
default: () => props$1x.divider.textPosition
},
// 文本内容
text: {
type: [String, Number],
default: () => props$1x.divider.text
},
// 文本大小
textSize: {
type: [String, Number],
default: () => props$1x.divider.textSize
},
// 文本颜色
textColor: {
type: String,
default: () => props$1x.divider.textColor
},
// 线条颜色
lineColor: {
type: String,
default: () => props$1x.divider.lineColor
}
}
});
const _sfc_main$1v = {
name: "u-divider",
mixins: [mpMixin, mixin, props$_],
computed: {
textStyle() {
const style = {};
style.fontSize = addUnit(this.textSize);
style.color = this.textColor;
return style;
},
// 左边线条的的样式
leftLineStyle() {
const style = {};
if (this.textPosition === "left") {
style.width = "80rpx";
} else {
style.flex = 1;
}
return style;
},
// 右边线条的的样式
rightLineStyle() {
const style = {};
if (this.textPosition === "right") {
style.width = "80rpx";
} else {
style.flex = 1;
}
return style;
}
},
emits: ["click"],
methods: {
addStyle,
// divider组件被点击时触发
click() {
this.$emit("click");
}
}
};
function _sfc_render$1u(_ctx, _cache, $props, $setup, $data, $options) {
const _component_u_line = resolveEasycom(vue.resolveDynamicComponent("u-line"), __easycom_1$4);
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: "u-divider",
style: vue.normalizeStyle([$options.addStyle(_ctx.customStyle)]),
onClick: _cache[0] || (_cache[0] = (...args) => $options.click && $options.click(...args))
},
[
vue.createVNode(_component_u_line, {
color: _ctx.lineColor,
customStyle: $options.leftLineStyle,
hairline: _ctx.hairline,
dashed: _ctx.dashed
}, null, 8, ["color", "customStyle", "hairline", "dashed"]),
_ctx.dot ? (vue.openBlock(), vue.createElementBlock("text", {
key: 0,
class: "u-divider__dot"
}, "●")) : vue.createCommentVNode("v-if", true),
vue.renderSlot(_ctx.$slots, "default", {}, () => [
!_ctx.dot && _ctx.text ? (vue.openBlock(), vue.createElementBlock(
"text",
{
key: 0,
class: "u-divider__text",
style: vue.normalizeStyle([$options.textStyle])
},
vue.toDisplayString(_ctx.text),
5
/* TEXT, STYLE */
)) : vue.createCommentVNode("v-if", true)
], true),
vue.createVNode(_component_u_line, {
color: _ctx.lineColor,
customStyle: $options.rightLineStyle,
hairline: _ctx.hairline,
dashed: _ctx.dashed
}, null, 8, ["color", "customStyle", "hairline", "dashed"])
],
4
/* STYLE */
);
}
const uDivider = /* @__PURE__ */ _export_sfc(_sfc_main$1v, [["render", _sfc_render$1u], ["__scopeId", "data-v-ea022cee"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-divider/u-divider.vue"]]);
const __vite_glob_0_35 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uDivider
}, Symbol.toStringTag, { value: "Module" }));
const _sfc_main$1u = {
name: "u-dragsort",
mixins: [mixin],
props: {
initialList: {
type: Array,
required: true,
default: () => []
},
draggable: {
type: Boolean,
default: true
},
direction: {
type: String,
default: "vertical",
validator: (value2) => ["vertical", "horizontal", "all"].includes(value2)
},
// 新增列数属性,用于all模式
columns: {
type: Number,
default: 3
}
},
data() {
return {
list: [],
dragIndex: -1,
itemHeight: 40,
itemWidth: 80,
areaWidth: 0,
// 可拖动区域宽度
areaHeight: 0,
// 可拖动区域高度
originalPositions: [],
// 保存原始位置
currentPosition: {
x: 0,
y: 0
}
};
},
computed: {
movableAreaStyle() {
if (this.direction === "vertical") {
return {
height: `${this.list.length * this.itemHeight}px`,
width: "100%"
};
} else if (this.direction === "horizontal") {
return {
height: "100%",
width: `${this.list.length * this.itemWidth}px`
};
} else {
const rows = Math.ceil(this.list.length / this.columns);
return {
height: `${rows * this.itemHeight}px`,
width: "100%"
};
}
}
},
emits: ["drag-end"],
async mounted() {
await this.$nextTick();
this.initList();
this.calculateItemSize();
this.calculateAreaSize();
},
methods: {
initList() {
this.list = this.initialList.map((item, index2) => {
let x2 = 0, y2 = 0;
if (this.direction === "horizontal") {
x2 = index2 * this.itemWidth;
y2 = 0;
} else if (this.direction === "vertical") {
x2 = 0;
y2 = index2 * this.itemHeight;
} else {
const col = index2 % this.columns;
const row = Math.floor(index2 / this.columns);
x2 = col * this.itemWidth;
y2 = row * this.itemHeight;
}
return {
...item,
x: x2,
y: y2
};
});
this.saveOriginalPositions();
},
saveOriginalPositions() {
this.originalPositions = this.list.map((item) => ({
x: item.x,
y: item.y
}));
},
async calculateItemSize() {
await sleep(30);
return new Promise((resolve) => {
uni.createSelectorQuery().in(this).select(".u-dragsort-item-content").boundingClientRect((res) => {
if (res) {
this.itemHeight = res.height || 40;
this.itemWidth = res.width || 80;
this.updatePositions();
this.saveOriginalPositions();
}
resolve(res);
}).exec();
});
},
async calculateAreaSize() {
await sleep(30);
return new Promise((resolve) => {
uni.createSelectorQuery().in(this).select(".u-dragsort-area").boundingClientRect((res) => {
if (res) {
this.areaWidth = res.width || 300;
this.areaHeight = res.height || 300;
}
resolve(res);
}).exec();
});
},
updatePositions() {
this.list.forEach((item, index2) => {
if (this.direction === "vertical") {
item.y = index2 * this.itemHeight;
item.x = 0;
} else if (this.direction === "horizontal") {
item.x = index2 * this.itemWidth;
item.y = 0;
} else {
const col = index2 % this.columns;
const row = Math.floor(index2 / this.columns);
item.x = col * this.itemWidth;
item.y = row * this.itemHeight;
}
});
},
onTouchStart(index2) {
this.dragIndex = index2;
this.saveOriginalPositions();
},
onChange(index2, event) {
if (!event.detail.source || event.detail.source !== "touch")
return;
this.currentPosition.x = event.detail.x;
this.currentPosition.y = event.detail.y;
if (this.direction === "all") {
this.handleAllModeChange(index2);
} else {
let itemSize = 0;
let targetIndex = -1;
if (this.direction === "vertical") {
itemSize = this.itemHeight;
targetIndex = Math.max(0, Math.min(
Math.round(this.currentPosition.y / itemSize),
this.list.length - 1
));
} else if (this.direction === "horizontal") {
itemSize = this.itemWidth;
targetIndex = Math.max(0, Math.min(
Math.round(this.currentPosition.x / itemSize),
this.list.length - 1
));
}
if (targetIndex !== index2) {
this.reorderItems(index2, targetIndex);
}
}
},
handleAllModeChange(index2) {
const col = Math.max(0, Math.min(Math.round(this.currentPosition.x / this.itemWidth), this.columns - 1));
const row = Math.max(0, Math.round(this.currentPosition.y / this.itemHeight));
let targetIndex = row * this.columns + col;
targetIndex = Math.max(0, Math.min(targetIndex, this.list.length - 1));
if (targetIndex !== index2) {
this.reorderItems(index2, targetIndex);
}
},
reorderItems(fromIndex, toIndex) {
const movedItem = this.list.splice(fromIndex, 1)[0];
this.list.splice(toIndex, 0, movedItem);
if (uni.vibrateShort) {
uni.vibrateShort();
}
this.dragIndex = toIndex;
this.updatePositions();
this.saveOriginalPositions();
},
onTouchEnd() {
if (this.direction === "horizontal") {
this.list[this.dragIndex].x = this.currentPosition.x + 1e-3;
} else if (this.direction === "vertical" || this.direction === "all") {
this.list[this.dragIndex].y = this.currentPosition.y + 1e-3;
this.list[this.dragIndex].x = this.currentPosition.x + 1e-3;
}
sleep(50).then(() => {
this.list.forEach((item, index2) => {
item.x = this.originalPositions[index2].x;
item.y = this.originalPositions[index2].y;
});
this.dragIndex = -1;
this.$emit("drag-end", [...this.list]);
});
}
},
watch: {
initialList: {
handler() {
this.$nextTick(() => {
this.initList();
});
},
deep: true
},
direction: {
handler() {
this.$nextTick(() => {
this.initList();
this.calculateItemSize();
this.calculateAreaSize();
});
}
},
columns: {
handler() {
if (this.direction === "all") {
this.$nextTick(() => {
this.initList();
this.updatePositions();
this.saveOriginalPositions();
});
}
}
}
}
};
function _sfc_render$1t(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["u-dragsort", [$props.direction == "horizontal" ? "u-dragsort--horizontal" : "", $props.direction == "all" ? "u-dragsort--all" : ""]])
},
[
vue.createElementVNode(
"movable-area",
{
class: "u-dragsort-area",
style: vue.normalizeStyle($options.movableAreaStyle)
},
[
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($data.list, (item, index2) => {
return vue.openBlock(), vue.createElementBlock("movable-view", {
key: item.id,
id: `u-dragsort-item-${index2}`,
class: vue.normalizeClass(["u-dragsort-item", { "dragging": $data.dragIndex === index2 }]),
direction: $props.direction === "all" ? "all" : $props.direction,
x: item.x,
y: item.y,
inertia: false,
disabled: !$props.draggable || item.draggable === false,
onChange: ($event) => $options.onChange(index2, $event),
onTouchstart: ($event) => $options.onTouchStart(index2),
onTouchend: _cache[0] || (_cache[0] = (...args) => $options.onTouchEnd && $options.onTouchEnd(...args)),
onTouchcancel: _cache[1] || (_cache[1] = (...args) => $options.onTouchEnd && $options.onTouchEnd(...args))
}, [
vue.createElementVNode("view", { class: "u-dragsort-item-content" }, [
vue.renderSlot(_ctx.$slots, "default", {
item,
index: index2
}, () => [
vue.createTextVNode(
vue.toDisplayString(item.label),
1
/* TEXT */
)
], true)
])
], 42, ["id", "direction", "x", "y", "disabled", "onChange", "onTouchstart"]);
}),
128
/* KEYED_FRAGMENT */
))
],
4
/* STYLE */
)
],
2
/* CLASS */
);
}
const uDragsort = /* @__PURE__ */ _export_sfc(_sfc_main$1u, [["render", _sfc_render$1t], ["__scopeId", "data-v-09ad657e"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-dragsort/u-dragsort.vue"]]);
const __vite_glob_0_36 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uDragsort
}, Symbol.toStringTag, { value: "Module" }));
const props$Z = defineMixin({
props: {
// 当前选中项的value值
modelValue: {
type: [Number, String, Array],
default: ""
},
// 菜单项标题
title: {
type: [String, Number],
default: ""
},
// 选项数据,如果传入了默认slot,此参数无效
options: {
type: Array,
default() {
return [];
}
},
// 是否禁用此菜单项
disabled: {
type: Boolean,
default: false
},
// 下拉弹窗的高度
height: {
type: [Number, String],
default: "auto"
},
// 点击遮罩是否可以收起弹窗
closeOnClickOverlay: {
type: Boolean,
default: true
}
}
});
const _sfc_main$1t = {
name: "u-dropdown-item",
mixins: [mpMixin, mixin, props$Z],
options: {
styleIsolation: "shared"
},
data() {
return {
active: false,
// 当前项是否处于展开状态
activeColor: "#2979ff",
// 激活时左边文字和右边对勾图标的颜色
inactiveColor: "#606266"
// 未激活时左边文字和右边对勾图标的颜色
};
},
computed: {
// 监听props是否发生了变化,有些值需要传递给父组件u-dropdown,无法双向绑定
propsChange() {
return `${this.title}-${this.disabled}`;
}
},
watch: {
propsChange(n2) {
if (this.parent)
this.parent.init();
}
},
created() {
this.parent = false;
},
emits: ["update:modelValue", "change"],
methods: {
addUnit,
init() {
let parent = $parent.call(this, "u-dropdown");
if (parent) {
this.parent = parent;
this.activeColor = parent.activeColor;
this.inactiveColor = parent.inactiveColor;
let exist = parent.children.find((val) => {
return this === val;
});
if (!exist)
parent.children.push(this);
if (parent.children.length == 1)
this.active = true;
parent.menuList.push({
title: this.title,
disabled: this.disabled
});
}
},
// cell被点击
cellClick(value2) {
this.$emit("update:modelValue", value2);
this.parent.close();
this.$emit("change", value2);
}
},
mounted() {
this.init();
}
};
function _sfc_render$1s(_ctx, _cache, $props, $setup, $data, $options) {
const _component_up_icon = vue.resolveComponent("up-icon");
const _component_up_cell = vue.resolveComponent("up-cell");
const _component_up_cell_group = vue.resolveComponent("up-cell-group");
return $data.active ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: "u-dropdown-item",
onTouchmove: vue.withModifiers(() => {
}, ["stop", "prevent"]),
onClick: vue.withModifiers(() => {
}, ["stop", "prevent"])
},
[
!_ctx.$slots.default && !_ctx.$slots.$default ? (vue.openBlock(), vue.createElementBlock(
"scroll-view",
{
key: 0,
class: "u-dropdown-item__scroll",
"scroll-y": "true",
style: vue.normalizeStyle({
height: $options.addUnit(_ctx.height)
})
},
[
vue.createElementVNode("view", { class: "u-dropdown-item__options" }, [
vue.createVNode(_component_up_cell_group, null, {
default: vue.withCtx(() => [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(_ctx.options, (item, index2) => {
return vue.openBlock(), vue.createBlock(_component_up_cell, {
onClick: ($event) => $options.cellClick(item.value),
arrow: false,
title: item.label,
key: index2,
"title-style": {
color: _ctx.modelValue == item.value ? $data.activeColor : $data.inactiveColor
}
}, {
default: vue.withCtx(() => [
_ctx.modelValue == item.value ? (vue.openBlock(), vue.createBlock(_component_up_icon, {
key: 0,
name: "checkbox-mark",
color: $data.activeColor,
size: "32"
}, null, 8, ["color"])) : vue.createCommentVNode("v-if", true)
]),
_: 2
/* DYNAMIC */
}, 1032, ["onClick", "title", "title-style"]);
}),
128
/* KEYED_FRAGMENT */
))
]),
_: 1
/* STABLE */
})
])
],
4
/* STYLE */
)) : vue.renderSlot(_ctx.$slots, "default", { key: 1 }, void 0, true)
],
32
/* NEED_HYDRATION */
)) : vue.createCommentVNode("v-if", true);
}
const uDropdownItem = /* @__PURE__ */ _export_sfc(_sfc_main$1t, [["render", _sfc_render$1s], ["__scopeId", "data-v-2ab01489"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-dropdown-item/u-dropdown-item.vue"]]);
const __vite_glob_0_37 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uDropdownItem
}, Symbol.toStringTag, { value: "Module" }));
const props$Y = defineMixin({
props: {
// 菜单标题和选项的激活态颜色
activeColor: {
type: String,
default: "#2979ff"
},
// 菜单标题和选项的未激活态颜色
inactiveColor: {
type: String,
default: "#606266"
},
// 点击遮罩是否关闭菜单
closeOnClickMask: {
type: Boolean,
default: true
},
// 点击当前激活项标题是否关闭菜单
closeOnClickSelf: {
type: Boolean,
default: true
},
// 过渡时间
duration: {
type: [Number, String],
default: 300
},
// 标题菜单的高度
height: {
type: [Number, String],
default: 40
},
// 是否显示下边框
borderBottom: {
type: Boolean,
default: false
},
// 标题的字体大小
titleSize: {
type: [Number, String],
default: 14
},
// 下拉出来的内容部分的圆角值
borderRadius: {
type: [Number, String],
default: 0
},
// 菜单右侧的icon图标
menuIcon: {
type: String,
default: "arrow-down"
},
// 菜单右侧图标的大小
menuIconSize: {
type: [Number, String],
default: 14
}
}
});
const _sfc_main$1s = {
name: "u-dropdown",
mixins: [mpMixin, mixin, props$Y],
data() {
return {
showDropdown: true,
// 是否打开下来菜单,
menuList: [],
// 显示的菜单
active: false,
// 下拉菜单的状态
// 当前是第几个菜单处于激活状态,小程序中此处不能写成false或者"",否则后续将current赋值为0,
// 无能的TX没有使用===而是使用==判断,导致程序认为前后二者没有变化,从而不会触发视图更新
current: 99999,
// 外层内容的样式,初始时处于底层,且透明
contentStyle: {
zIndex: -1,
opacity: 0
},
// 让某些菜单保持高亮的状态
highlightIndexList: [],
contentHeight: 0
};
},
computed: {
// 下拉出来部分的样式
popupStyle() {
let style = {};
style.transform = `translateY(${this.active ? 0 : "-100%"})`;
style["transition-duration"] = this.duration / 1e3 + "s";
style.borderRadius = `0 0 ${addUnit(this.borderRadius)} ${addUnit(this.borderRadius)}`;
return style;
}
},
created() {
this.children = [];
},
mounted() {
this.getContentHeight();
},
emits: ["open", "close"],
methods: {
addUnit,
init() {
this.menuList = [];
this.children.map((child) => {
child.init();
});
},
// 点击菜单
menuClick(index2) {
if (this.menuList[index2].disabled)
return;
if (index2 === this.current && this.closeOnClickSelf) {
this.close();
setTimeout(() => {
this.children[index2].active = false;
}, this.duration);
return;
}
this.open(index2);
},
// 打开下拉菜单
open(index2) {
if (this.contentHeight < 1)
this.getContentHeight();
this.contentStyle = {
zIndex: 11,
height: this.contentHeight + "px"
};
this.active = true;
this.current = index2;
this.children.map((val, idx) => {
val.active = index2 == idx ? true : false;
});
this.$emit("open", this.current);
},
// 设置下拉菜单处于收起状态
close() {
this.$emit("close", this.current);
this.active = false;
this.current = 99999;
this.contentStyle.zIndex = -1;
this.contentStyle.opacity = 0;
setTimeout(() => {
this.contentStyle.height = 0;
}, this.duration);
},
// 点击遮罩
maskClick() {
if (!this.closeOnClickMask)
return;
this.close();
},
// 外部手动设置某些菜单高亮
highlight(indexParams = void 0) {
if (Array.isArray(indexParams)) {
this.highlightIndexList = [...indexParams];
return;
}
this.highlightIndexList = indexParams !== void 0 ? [indexParams] : [];
},
// 获取下拉菜单内容的高度
getContentHeight() {
let windowHeight = getWindowInfo().windowHeight;
this.$uGetRect(".u-dropdown__menu").then((res) => {
this.contentHeight = windowHeight - res.bottom;
});
}
}
};
function _sfc_render$1r(_ctx, _cache, $props, $setup, $data, $options) {
const _component_up_icon = vue.resolveComponent("up-icon");
return vue.openBlock(), vue.createElementBlock("view", { class: "u-dropdown" }, [
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["u-dropdown__menu", {
"u-border-bottom": _ctx.borderBottom
}]),
style: vue.normalizeStyle({
height: $options.addUnit(_ctx.height)
})
},
[
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($data.menuList, (item, index2) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "u-dropdown__menu__item",
key: index2,
onClick: vue.withModifiers(($event) => $options.menuClick(index2), ["stop"])
}, [
vue.createElementVNode("view", { class: "u-flex u-flex-row" }, [
vue.createElementVNode(
"text",
{
class: "u-dropdown__menu__item__text",
style: vue.normalizeStyle({
color: item.disabled ? "#c0c4cc" : index2 === $data.current || $data.highlightIndexList.includes(index2) ? _ctx.activeColor : _ctx.inactiveColor,
fontSize: $options.addUnit(_ctx.titleSize)
})
},
vue.toDisplayString(item.title),
5
/* TEXT, STYLE */
),
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["u-dropdown__menu__item__arrow", {
"u-dropdown__menu__item__arrow--rotate": index2 === $data.current
}])
},
[
vue.createVNode(_component_up_icon, {
"custom-style": { display: "flex" },
name: _ctx.menuIcon,
size: $options.addUnit(_ctx.menuIconSize),
color: index2 === $data.current || $data.highlightIndexList.includes(index2) ? _ctx.activeColor : "#c0c4cc"
}, null, 8, ["name", "size", "color"])
],
2
/* CLASS */
)
])
], 8, ["onClick"]);
}),
128
/* KEYED_FRAGMENT */
))
],
6
/* CLASS, STYLE */
),
vue.createElementVNode(
"view",
{
class: "u-dropdown__content",
style: vue.normalizeStyle([$data.contentStyle, {
transition: `opacity ${_ctx.duration / 1e3}s, z-index ${_ctx.duration / 1e3}s linear`,
top: $options.addUnit(_ctx.height)
}]),
onClick: _cache[1] || (_cache[1] = (...args) => $options.maskClick && $options.maskClick(...args)),
onTouchmove: _cache[2] || (_cache[2] = vue.withModifiers(() => {
}, ["stop", "prevent"]))
},
[
vue.createElementVNode(
"view",
{
onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
}, ["stop", "prevent"])),
class: "u-dropdown__content__popup",
style: vue.normalizeStyle([$options.popupStyle, {}])
},
[
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
],
4
/* STYLE */
),
vue.createElementVNode("view", { class: "u-dropdown__content__mask" })
],
36
/* STYLE, NEED_HYDRATION */
)
]);
}
const uDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$1s, [["render", _sfc_render$1r], ["__scopeId", "data-v-029e9a16"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-dropdown/u-dropdown.vue"]]);
const __vite_glob_0_38 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uDropdown
}, Symbol.toStringTag, { value: "Module" }));
const props$X = defineMixin({
props: {
// 内置图标名称,或图片路径,建议绝对路径
icon: {
type: String,
default: () => props$1x.empty.icon
},
// 提示文字
text: {
type: String,
default: () => props$1x.empty.text
},
// 文字颜色
textColor: {
type: String,
default: () => props$1x.empty.textColor
},
// 文字大小
textSize: {
type: [String, Number],
default: () => props$1x.empty.textSize
},
// 图标的颜色
iconColor: {
type: String,
default: () => props$1x.empty.iconColor
},
// 图标的大小
iconSize: {
type: [String, Number],
default: () => props$1x.empty.iconSize
},
// 选择预置的图标类型
mode: {
type: String,
default: () => props$1x.empty.mode
},
// 图标宽度,单位px
width: {
type: [String, Number],
default: () => props$1x.empty.width
},
// 图标高度,单位px
height: {
type: [String, Number],
default: () => props$1x.empty.height
},
// 是否显示组件
show: {
type: Boolean,
default: () => props$1x.empty.show
},
// 组件距离上一个元素之间的距离,默认px单位
marginTop: {
type: [String, Number],
default: () => props$1x.empty.marginTop
}
}
});
const _sfc_main$1r = {
name: "u-empty",
mixins: [mpMixin, mixin, props$X],
data() {
return {
icons: {
car: t$1("up.empty.car"),
page: t$1("up.empty.page"),
search: t$1("up.empty.search"),
address: t$1("up.empty.address"),
wifi: t$1("up.empty.wifi"),
order: t$1("up.empty.order"),
coupon: t$1("up.empty.coupon"),
favor: t$1("up.empty.favor"),
permission: t$1("up.empty.permission"),
history: t$1("up.empty.history"),
news: t$1("up.empty.news"),
message: t$1("up.empty.message"),
list: t$1("up.empty.list"),
data: t$1("up.empty.data"),
comment: t$1("up.empty.comment")
}
};
},
computed: {
// 组件样式
emptyStyle() {
const style = {};
style.marginTop = addUnit(this.marginTop);
return deepMerge$1(addStyle(this.customStyle), style);
},
// 文本样式
textStyle() {
const style = {};
style.color = this.textColor;
style.fontSize = addUnit(this.textSize);
return style;
},
// 判断icon是否图片路径
isSrc() {
return this.icon.indexOf("/") >= 0;
}
},
methods: {
addUnit
}
};
function _sfc_render$1q(_ctx, _cache, $props, $setup, $data, $options) {
const _component_up_icon = vue.resolveComponent("up-icon");
return _ctx.show ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: "u-empty",
style: vue.normalizeStyle([$options.emptyStyle])
},
[
!$options.isSrc ? (vue.openBlock(), vue.createBlock(_component_up_icon, {
key: 0,
name: _ctx.mode === "message" ? "chat" : `empty-${_ctx.mode}`,
size: _ctx.iconSize,
color: _ctx.iconColor,
"margin-top": "14"
}, null, 8, ["name", "size", "color"])) : (vue.openBlock(), vue.createElementBlock("image", {
key: 1,
style: vue.normalizeStyle({
width: $options.addUnit(_ctx.width),
height: $options.addUnit(_ctx.height)
}),
src: _ctx.icon,
mode: "widthFix"
}, null, 12, ["src"])),
vue.createElementVNode(
"text",
{
class: "u-empty__text",
style: vue.normalizeStyle([$options.textStyle])
},
vue.toDisplayString(_ctx.text ? _ctx.text : $data.icons[_ctx.mode]),
5
/* TEXT, STYLE */
),
_ctx.$slots.default || _ctx.$slots.$default ? (vue.openBlock(), vue.createElementBlock("view", {
key: 2,
class: "u-empty__wrap"
}, [
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
])) : vue.createCommentVNode("v-if", true)
],
4
/* STYLE */
)) : vue.createCommentVNode("v-if", true);
}
const uEmpty = /* @__PURE__ */ _export_sfc(_sfc_main$1r, [["render", _sfc_render$1q], ["__scopeId", "data-v-8dd5928e"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-empty/u-empty.vue"]]);
const __vite_glob_0_39 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uEmpty
}, Symbol.toStringTag, { value: "Module" }));
const _sfc_main$1q = {
name: "u-float-button",
mixins: [mpMixin, mixin],
emits: ["click", "item-click"],
computed: {},
props: {
// 背景颜色
backgroundColor: {
type: String,
default: "#2979ff"
},
// 文字颜色
color: {
type: String,
default: "#fff"
},
// 宽度
width: {
type: String,
default: "50px"
},
// 高度
height: {
type: String,
default: "50px"
},
// 边框颜色,默认为空字符串表示无边框
borderColor: {
type: String,
default: ""
},
// 右侧偏移量
right: {
type: [String, Number],
default: "30px"
},
// 顶部偏移量,未提供默认值,可能需要根据具体情况设置
top: {
type: [String, Number],
default: ""
},
// 底部偏移量
bottom: {
type: String,
default: ""
},
// 是否为菜单项
isMenu: {
type: Boolean,
default: false
},
list: {
type: Array,
default: () => {
return [];
}
}
},
data() {
return {
showList: false
};
},
methods: {
addStyle,
clickHandler(e2) {
if (this.isMenu) {
this.showList = !this.showList;
this.$emit("click", e2);
} else {
this.$emit("click", e2);
}
},
itemClick(item, index2) {
this.$emit("item-click", {
...item,
index: index2
});
}
}
};
function _sfc_render$1p(_ctx, _cache, $props, $setup, $data, $options) {
const _component_up_icon = vue.resolveComponent("up-icon");
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: "u-float-button",
style: vue.normalizeStyle({
position: "fixed",
top: $props.top,
bottom: $props.bottom,
right: $props.right
})
},
[
vue.createElementVNode(
"view",
{
class: "u-float-button__main",
onClick: _cache[0] || (_cache[0] = (...args) => $options.clickHandler && $options.clickHandler(...args)),
style: vue.normalizeStyle({
backgroundColor: $props.backgroundColor,
color: $props.color,
display: "flex",
flexDirection: "row",
justifyContent: "center",
alignItems: "center",
width: $props.width,
height: $props.height,
borderRadius: "50%",
borderColor: $props.borderColor
})
},
[
vue.renderSlot(_ctx.$slots, "default", { showList: $data.showList }, () => [
vue.createVNode(_component_up_icon, {
class: vue.normalizeClass(["cursor-pointer", { "show-list": $data.showList }]),
name: "plus",
color: $props.color
}, null, 8, ["class", "color"])
], true),
$data.showList ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: "u-float-button__list",
style: vue.normalizeStyle({
bottom: $props.height
})
},
[
vue.renderSlot(_ctx.$slots, "list", {}, () => [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($props.list, (item, index2) => {
return vue.openBlock(), vue.createElementBlock("view", {
key: index2,
class: "u-float-button__item",
style: vue.normalizeStyle({
backgroundColor: (item == null ? void 0 : item.backgroundColor) ? item == null ? void 0 : item.backgroundColor : $props.backgroundColor,
color: (item == null ? void 0 : item.color) ? item == null ? void 0 : item.color : $props.color,
display: "flex",
flexDirection: "row",
justifyContent: "center",
alignItems: "center",
width: $props.width,
height: $props.height,
borderRadius: "50%",
borderColor: (item == null ? void 0 : item.borderColor) ? item == null ? void 0 : item.borderColor : $props.borderColor
}),
onClick: ($event) => $options.itemClick(item, index2)
}, [
vue.createVNode(_component_up_icon, {
name: item.name,
color: (item == null ? void 0 : item.color) ? item == null ? void 0 : item.color : $props.color
}, null, 8, ["name", "color"])
], 12, ["onClick"]);
}),
128
/* KEYED_FRAGMENT */
))
], true)
],
4
/* STYLE */
)) : vue.createCommentVNode("v-if", true)
],
4
/* STYLE */
)
],
4
/* STYLE */
);
}
const uFloatButton = /* @__PURE__ */ _export_sfc(_sfc_main$1q, [["render", _sfc_render$1p], ["__scopeId", "data-v-8a662942"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-float-button/u-float-button.vue"]]);
const __vite_glob_0_40 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uFloatButton
}, Symbol.toStringTag, { value: "Module" }));
const props$W = defineMixin({
props: {
// input的label提示语
label: {
type: String,
default: () => props$1x.formItem.label
},
// 绑定的值
prop: {
type: String,
default: () => props$1x.formItem.prop
},
// 绑定的规则
rules: {
type: Array,
default: () => props$1x.formItem.rules
},
// 是否显示表单域的下划线边框
borderBottom: {
type: [String, Boolean],
default: () => props$1x.formItem.borderBottom
},
// label的位置,left-左边,top-上边
labelPosition: {
type: String,
default: () => props$1x.formItem.labelPosition
},
// label的宽度,单位px
labelWidth: {
type: [String, Number],
default: () => props$1x.formItem.labelWidth
},
// 右侧图标
rightIcon: {
type: String,
default: () => props$1x.formItem.rightIcon
},
// 左侧图标
leftIcon: {
type: String,
default: () => props$1x.formItem.leftIcon
},
// 是否显示左边的必填星号,只作显示用,具体校验必填的逻辑,请在rules中配置
required: {
type: Boolean,
default: () => props$1x.formItem.required
},
leftIconStyle: {
type: [String, Object],
default: () => props$1x.formItem.leftIconStyle
}
}
});
const _sfc_main$1p = {
name: "u-form-item",
mixins: [mpMixin, mixin, props$W],
data() {
return {
// 错误提示语
message: "",
parentData: {
// 提示文本的位置
labelPosition: "left",
// 提示文本对齐方式
labelAlign: "left",
// 提示文本的样式
labelStyle: {},
// 提示文本的宽度
labelWidth: 45,
// 错误提示方式
errorType: "message"
},
color: color$3,
itemRules: []
};
},
// 组件创建完成时,将当前实例保存到u-form中
computed: {
propsLine() {
return props$1x.line;
}
},
mounted() {
this.init();
},
emits: ["click"],
watch: {
// 监听规则的变化
rules: {
immediate: true,
handler(n2) {
this.setRules(n2);
}
}
},
methods: {
addStyle,
addUnit,
init() {
this.updateParentData();
if (!this.parent) {
error("u-form-item需要结合u-form组件使用");
}
},
// 手动设置校验的规则,如果规则中有函数的话,微信小程序中会过滤掉,所以只能手动调用设置规则
setRules(rules2) {
if (rules2.length === 0) {
this.itemRules = [];
return;
}
this.itemRules = rules2;
},
// 获取父组件的参数
updateParentData() {
this.getParentData("u-form");
},
// 移除u-form-item的校验结果
clearValidate() {
this.message = null;
},
// 清空当前的组件的校验结果,并重置为初始值
resetField() {
const value2 = getProperty(this.parent.originalModel, this.prop);
setProperty(this.parent.model, this.prop, value2);
this.message = null;
},
// 点击组件
clickHandler() {
this.$emit("click");
}
}
};
function _sfc_render$1o(_ctx, _cache, $props, $setup, $data, $options) {
const _component_up_icon = vue.resolveComponent("up-icon");
const _component_u_line = resolveEasycom(vue.resolveDynamicComponent("u-line"), __easycom_1$4);
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["u-form-item", { "u-form-item--error": !!$data.message && $data.parentData.errorType === "message" }])
},
[
vue.createElementVNode(
"view",
{
class: "u-form-item__body",
onClick: _cache[0] || (_cache[0] = (...args) => $options.clickHandler && $options.clickHandler(...args)),
style: vue.normalizeStyle([$options.addStyle(_ctx.customStyle), {
flexDirection: (_ctx.labelPosition || $data.parentData.labelPosition) === "left" ? "row" : "column"
}])
},
[
vue.createCommentVNode(' 微信小程序中,将一个参数设置空字符串,结果会变成字符串"true" '),
vue.renderSlot(_ctx.$slots, "label", {}, () => [
vue.createCommentVNode(" {{required}} "),
_ctx.required || _ctx.leftIcon || _ctx.label ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: "u-form-item__body__left",
style: vue.normalizeStyle({
width: $options.addUnit(_ctx.labelWidth || $data.parentData.labelWidth),
marginBottom: (_ctx.labelPosition || $data.parentData.labelPosition) === "left" ? 0 : "5px"
})
},
[
vue.createCommentVNode(" 为了块对齐 "),
vue.createElementVNode("view", { class: "u-form-item__body__left__content" }, [
vue.createCommentVNode(" nvue不支持伪元素before "),
_ctx.required ? (vue.openBlock(), vue.createElementBlock("text", {
key: 0,
class: "u-form-item__body__left__content__required"
}, "*")) : vue.createCommentVNode("v-if", true),
_ctx.leftIcon ? (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "u-form-item__body__left__content__icon"
}, [
vue.createVNode(_component_up_icon, {
name: _ctx.leftIcon,
"custom-style": _ctx.leftIconStyle
}, null, 8, ["name", "custom-style"])
])) : vue.createCommentVNode("v-if", true),
vue.createElementVNode(
"text",
{
class: "u-form-item__body__left__content__label",
style: vue.normalizeStyle([$data.parentData.labelStyle, {
justifyContent: $data.parentData.labelAlign === "left" ? "flex-start" : $data.parentData.labelAlign === "center" ? "center" : "flex-end"
}])
},
vue.toDisplayString(_ctx.label),
5
/* TEXT, STYLE */
)
])
],
4
/* STYLE */
)) : vue.createCommentVNode("v-if", true)
], true),
vue.createElementVNode("view", { class: "u-form-item__body__right" }, [
vue.createElementVNode("view", { class: "u-form-item__body__right__content" }, [
vue.createElementVNode("view", { class: "u-form-item__body__right__content__slot" }, [
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
]),
_ctx.$slots.right ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "item__body__right__content__icon"
}, [
vue.renderSlot(_ctx.$slots, "right", {}, void 0, true)
])) : vue.createCommentVNode("v-if", true)
])
])
],
4
/* STYLE */
),
vue.renderSlot(_ctx.$slots, "error", {}, () => [
!!$data.message && $data.parentData.errorType === "message" ? (vue.openBlock(), vue.createElementBlock(
"text",
{
key: 0,
class: "u-form-item__body__right__message",
style: vue.normalizeStyle({
marginLeft: $options.addUnit((_ctx.labelPosition || $data.parentData.labelPosition) === "top" ? 0 : _ctx.labelWidth || $data.parentData.labelWidth)
})
},
vue.toDisplayString($data.message),
5
/* TEXT, STYLE */
)) : vue.createCommentVNode("v-if", true)
], true),
_ctx.borderBottom ? (vue.openBlock(), vue.createBlock(_component_u_line, {
key: 0,
color: $data.message && $data.parentData.errorType === "border-bottom" ? $data.color.error : $options.propsLine.color,
customStyle: `margin-top: ${$data.message && $data.parentData.errorType === "message" ? "5px" : 0}`
}, null, 8, ["color", "customStyle"])) : vue.createCommentVNode("v-if", true)
],
2
/* CLASS */
);
}
const uFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$1p, [["render", _sfc_render$1o], ["__scopeId", "data-v-42bac3de"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-form-item/u-form-item.vue"]]);
const __vite_glob_0_41 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uFormItem
}, Symbol.toStringTag, { value: "Module" }));
const props$V = defineMixin({
props: {
// 当前form的需要验证字段的集合
model: {
type: Object,
default: () => props$1x.form.model
},
// 验证规则
rules: {
type: [Object, Function, Array],
default: () => props$1x.form.rules
},
// 有错误时的提示方式,message-提示信息,toast-进行toast提示
// border-bottom-下边框呈现红色,none-无提示
errorType: {
type: String,
default: () => props$1x.form.errorType
},
// 是否显示表单域的下划线边框
borderBottom: {
type: Boolean,
default: () => props$1x.form.borderBottom
},
// label的位置,left-左边,top-上边
labelPosition: {
type: String,
default: () => props$1x.form.labelPosition
},
// label的宽度,单位px
labelWidth: {
type: [String, Number],
default: () => props$1x.form.labelWidth
},
// lable字体的对齐方式
labelAlign: {
type: String,
default: () => props$1x.form.labelAlign
},
// lable的样式,对象形式
labelStyle: {
type: Object,
default: () => props$1x.form.labelStyle
}
}
});
var define_process_env_default = {};
const formatRegExp = /%[sdj%]/g;
let warning = function warning2() {
};
if (typeof process !== "undefined" && define_process_env_default && true && typeof window !== "undefined" && typeof document !== "undefined") {
warning = function warning3(type2, errors) {
if (typeof console !== "undefined" && console.warn) {
if (errors.every((e2) => typeof e2 === "string")) {
formatAppLog("warn", "at uni_modules/uview-plus/libs/util/async-validator.js:28", type2, errors);
}
}
};
}
function convertFieldsError(errors) {
if (!errors || !errors.length)
return null;
const fields = {};
errors.forEach((error2) => {
const { field } = error2;
fields[field] = fields[field] || [];
fields[field].push(error2);
});
return fields;
}
function format() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
let i2 = 1;
const f2 = args[0];
const len = args.length;
if (typeof f2 === "function") {
return f2.apply(null, args.slice(1));
}
if (typeof f2 === "string") {
let str = String(f2).replace(formatRegExp, (x2) => {
if (x2 === "%%") {
return "%";
}
if (i2 >= len) {
return x2;
}
switch (x2) {
case "%s":
return String(args[i2++]);
case "%d":
return Number(args[i2++]);
case "%j":
try {
return JSON.stringify(args[i2++]);
} catch (_2) {
return "[Circular]";
}
break;
default:
return x2;
}
});
for (let arg = args[i2]; i2 < len; arg = args[++i2]) {
str += ` ${arg}`;
}
return str;
}
return f2;
}
function isNativeStringType(type2) {
return type2 === "string" || type2 === "url" || type2 === "hex" || type2 === "email" || type2 === "pattern";
}
function isEmptyValue(value2, type2) {
if (value2 === void 0 || value2 === null) {
return true;
}
if (type2 === "array" && Array.isArray(value2) && !value2.length) {
return true;
}
if (isNativeStringType(type2) && typeof value2 === "string" && !value2) {
return true;
}
return false;
}
function asyncParallelArray(arr, func2, callback) {
const results = [];
let total = 0;
const arrLength = arr.length;
function count(errors) {
results.push.apply(results, errors);
total++;
if (total === arrLength) {
callback(results);
}
}
arr.forEach((a2) => {
func2(a2, count);
});
}
function asyncSerialArray(arr, func2, callback) {
let index2 = 0;
const arrLength = arr.length;
function next(errors) {
if (errors && errors.length) {
callback(errors);
return;
}
const original = index2;
index2 += 1;
if (original < arrLength) {
func2(arr[original], next);
} else {
callback([]);
}
}
next([]);
}
function flattenObjArr(objArr) {
const ret = [];
Object.keys(objArr).forEach((k2) => {
ret.push.apply(ret, objArr[k2]);
});
return ret;
}
function asyncMap(objArr, option, func2, callback) {
if (option.first) {
const _pending = new Promise((resolve, reject) => {
const next = function next2(errors) {
callback(errors);
return errors.length ? reject({
errors,
fields: convertFieldsError(errors)
}) : resolve();
};
const flattenArr = flattenObjArr(objArr);
asyncSerialArray(flattenArr, func2, next);
});
_pending.catch((e2) => e2);
return _pending;
}
let firstFields = option.firstFields || [];
if (firstFields === true) {
firstFields = Object.keys(objArr);
}
const objArrKeys = Object.keys(objArr);
const objArrLength = objArrKeys.length;
let total = 0;
const results = [];
const pending = new Promise((resolve, reject) => {
const next = function next2(errors) {
results.push.apply(results, errors);
total++;
if (total === objArrLength) {
callback(results);
return results.length ? reject({
errors: results,
fields: convertFieldsError(results)
}) : resolve();
}
};
if (!objArrKeys.length) {
callback(results);
resolve();
}
objArrKeys.forEach((key) => {
const arr = objArr[key];
if (firstFields.indexOf(key) !== -1) {
asyncSerialArray(arr, func2, next);
} else {
asyncParallelArray(arr, func2, next);
}
});
});
pending.catch((e2) => e2);
return pending;
}
function complementError(rule) {
return function(oe2) {
if (oe2 && oe2.message) {
oe2.field = oe2.field || rule.fullField;
return oe2;
}
return {
message: typeof oe2 === "function" ? oe2() : oe2,
field: oe2.field || rule.fullField
};
};
}
function deepMerge(target, source) {
if (source) {
for (const s2 in source) {
if (source.hasOwnProperty(s2)) {
const value2 = source[s2];
if (typeof value2 === "object" && typeof target[s2] === "object") {
target[s2] = { ...target[s2], ...value2 };
} else {
target[s2] = value2;
}
}
}
}
return target;
}
function required(rule, value2, source, errors, options2, type2) {
if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value2, type2 || rule.type))) {
errors.push(format(options2.messages.required, rule.fullField));
}
}
function whitespace(rule, value2, source, errors, options2) {
if (/^\s+$/.test(value2) || value2 === "") {
errors.push(format(options2.messages.whitespace, rule.fullField));
}
}
const pattern = {
// http://emailregex.com/
email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
url: new RegExp(
"^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$",
"i"
),
hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
};
var types = {
integer: function integer(value2) {
return /^(-)?\d+$/.test(value2);
},
float: function float(value2) {
return /^(-)?\d+(\.\d+)?$/.test(value2);
},
array: function array3(value2) {
return Array.isArray(value2);
},
regexp: function regexp(value2) {
if (value2 instanceof RegExp) {
return true;
}
try {
return !!new RegExp(value2);
} catch (e2) {
return false;
}
},
date: function date3(value2) {
return typeof value2.getTime === "function" && typeof value2.getMonth === "function" && typeof value2.getYear === "function";
},
number: function number3(value2) {
if (isNaN(value2)) {
return false;
}
return typeof +value2 === "number";
},
object: function object3(value2) {
return typeof value2 === "object" && !types.array(value2);
},
method: function method(value2) {
return typeof value2 === "function";
},
email: function email2(value2) {
return typeof value2 === "string" && !!value2.match(pattern.email) && value2.length < 255;
},
url: function url2(value2) {
return typeof value2 === "string" && !!value2.match(pattern.url);
},
hex: function hex(value2) {
return typeof value2 === "string" && !!value2.match(pattern.hex);
}
};
function type(rule, value2, source, errors, options2) {
if (rule.required && value2 === void 0) {
required(rule, value2, source, errors, options2);
return;
}
const custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
const ruleType = rule.type;
if (custom.indexOf(ruleType) > -1) {
if (!types[ruleType](value2)) {
errors.push(format(options2.messages.types[ruleType], rule.fullField, rule.type));
}
} else if (ruleType && typeof value2 !== rule.type) {
errors.push(format(options2.messages.types[ruleType], rule.fullField, rule.type));
}
}
function range(rule, value2, source, errors, options2) {
const len = typeof rule.len === "number";
const min = typeof rule.min === "number";
const max = typeof rule.max === "number";
const spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
let val = value2;
let key = null;
const num = typeof value2 === "number";
const str = typeof value2 === "string";
const arr = Array.isArray(value2);
if (num) {
key = "number";
} else if (str) {
key = "string";
} else if (arr) {
key = "array";
}
if (!key) {
return false;
}
if (arr) {
val = value2.length;
}
if (str) {
val = value2.replace(spRegexp, "_").length;
}
if (len) {
if (val !== rule.len) {
errors.push(format(options2.messages[key].len, rule.fullField, rule.len));
}
} else if (min && !max && val < rule.min) {
errors.push(format(options2.messages[key].min, rule.fullField, rule.min));
} else if (max && !min && val > rule.max) {
errors.push(format(options2.messages[key].max, rule.fullField, rule.max));
} else if (min && max && (val < rule.min || val > rule.max)) {
errors.push(format(options2.messages[key].range, rule.fullField, rule.min, rule.max));
}
}
const ENUM = "enum";
function enumerable(rule, value2, source, errors, options2) {
rule[ENUM] = Array.isArray(rule[ENUM]) ? rule[ENUM] : [];
if (rule[ENUM].indexOf(value2) === -1) {
errors.push(format(options2.messages[ENUM], rule.fullField, rule[ENUM].join(", ")));
}
}
function pattern$1(rule, value2, source, errors, options2) {
if (rule.pattern) {
if (rule.pattern instanceof RegExp) {
rule.pattern.lastIndex = 0;
if (!rule.pattern.test(value2)) {
errors.push(format(options2.messages.pattern.mismatch, rule.fullField, value2, rule.pattern));
}
} else if (typeof rule.pattern === "string") {
const _pattern = new RegExp(rule.pattern);
if (!_pattern.test(value2)) {
errors.push(format(options2.messages.pattern.mismatch, rule.fullField, value2, rule.pattern));
}
}
}
}
const rules = {
required,
whitespace,
type,
range,
enum: enumerable,
pattern: pattern$1
};
function string(rule, value2, callback, source, options2) {
const errors = [];
const validate2 = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate2) {
if (isEmptyValue(value2, "string") && !rule.required) {
return callback();
}
rules.required(rule, value2, source, errors, options2, "string");
if (!isEmptyValue(value2, "string")) {
rules.type(rule, value2, source, errors, options2);
rules.range(rule, value2, source, errors, options2);
rules.pattern(rule, value2, source, errors, options2);
if (rule.whitespace === true) {
rules.whitespace(rule, value2, source, errors, options2);
}
}
}
callback(errors);
}
function method2(rule, value2, callback, source, options2) {
const errors = [];
const validate2 = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate2) {
if (isEmptyValue(value2) && !rule.required) {
return callback();
}
rules.required(rule, value2, source, errors, options2);
if (value2 !== void 0) {
rules.type(rule, value2, source, errors, options2);
}
}
callback(errors);
}
function number2(rule, value2, callback, source, options2) {
const errors = [];
const validate2 = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate2) {
if (value2 === "") {
value2 = void 0;
}
if (isEmptyValue(value2) && !rule.required) {
return callback();
}
rules.required(rule, value2, source, errors, options2);
if (value2 !== void 0) {
rules.type(rule, value2, source, errors, options2);
rules.range(rule, value2, source, errors, options2);
}
}
callback(errors);
}
function _boolean(rule, value2, callback, source, options2) {
const errors = [];
const validate2 = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate2) {
if (isEmptyValue(value2) && !rule.required) {
return callback();
}
rules.required(rule, value2, source, errors, options2);
if (value2 !== void 0) {
rules.type(rule, value2, source, errors, options2);
}
}
callback(errors);
}
function regexp2(rule, value2, callback, source, options2) {
const errors = [];
const validate2 = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate2) {
if (isEmptyValue(value2) && !rule.required) {
return callback();
}
rules.required(rule, value2, source, errors, options2);
if (!isEmptyValue(value2)) {
rules.type(rule, value2, source, errors, options2);
}
}
callback(errors);
}
function integer2(rule, value2, callback, source, options2) {
const errors = [];
const validate2 = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate2) {
if (isEmptyValue(value2) && !rule.required) {
return callback();
}
rules.required(rule, value2, source, errors, options2);
if (value2 !== void 0) {
rules.type(rule, value2, source, errors, options2);
rules.range(rule, value2, source, errors, options2);
}
}
callback(errors);
}
function floatFn(rule, value2, callback, source, options2) {
const errors = [];
const validate2 = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate2) {
if (isEmptyValue(value2) && !rule.required) {
return callback();
}
rules.required(rule, value2, source, errors, options2);
if (value2 !== void 0) {
rules.type(rule, value2, source, errors, options2);
rules.range(rule, value2, source, errors, options2);
}
}
callback(errors);
}
function array2(rule, value2, callback, source, options2) {
const errors = [];
const validate2 = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate2) {
if (isEmptyValue(value2, "array") && !rule.required) {
return callback();
}
rules.required(rule, value2, source, errors, options2, "array");
if (!isEmptyValue(value2, "array")) {
rules.type(rule, value2, source, errors, options2);
rules.range(rule, value2, source, errors, options2);
}
}
callback(errors);
}
function object2(rule, value2, callback, source, options2) {
const errors = [];
const validate2 = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate2) {
if (isEmptyValue(value2) && !rule.required) {
return callback();
}
rules.required(rule, value2, source, errors, options2);
if (value2 !== void 0) {
rules.type(rule, value2, source, errors, options2);
}
}
callback(errors);
}
const ENUM$1 = "enum";
function enumerable$1(rule, value2, callback, source, options2) {
const errors = [];
const validate2 = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate2) {
if (isEmptyValue(value2) && !rule.required) {
return callback();
}
rules.required(rule, value2, source, errors, options2);
if (value2 !== void 0) {
rules[ENUM$1](rule, value2, source, errors, options2);
}
}
callback(errors);
}
function pattern$2(rule, value2, callback, source, options2) {
const errors = [];
const validate2 = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate2) {
if (isEmptyValue(value2, "string") && !rule.required) {
return callback();
}
rules.required(rule, value2, source, errors, options2);
if (!isEmptyValue(value2, "string")) {
rules.pattern(rule, value2, source, errors, options2);
}
}
callback(errors);
}
function date2(rule, value2, callback, source, options2) {
const errors = [];
const validate2 = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate2) {
if (isEmptyValue(value2) && !rule.required) {
return callback();
}
rules.required(rule, value2, source, errors, options2);
if (!isEmptyValue(value2)) {
let dateObject;
if (typeof value2 === "number") {
dateObject = new Date(value2);
} else {
dateObject = value2;
}
rules.type(rule, dateObject, source, errors, options2);
if (dateObject) {
rules.range(rule, dateObject.getTime(), source, errors, options2);
}
}
}
callback(errors);
}
function required$1(rule, value2, callback, source, options2) {
const errors = [];
const type2 = Array.isArray(value2) ? "array" : typeof value2;
rules.required(rule, value2, source, errors, options2, type2);
callback(errors);
}
function type$1(rule, value2, callback, source, options2) {
const ruleType = rule.type;
const errors = [];
const validate2 = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate2) {
if (isEmptyValue(value2, ruleType) && !rule.required) {
return callback();
}
rules.required(rule, value2, source, errors, options2, ruleType);
if (!isEmptyValue(value2, ruleType)) {
rules.type(rule, value2, source, errors, options2);
}
}
callback(errors);
}
function any(rule, value2, callback, source, options2) {
const errors = [];
const validate2 = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate2) {
if (isEmptyValue(value2) && !rule.required) {
return callback();
}
rules.required(rule, value2, source, errors, options2);
}
callback(errors);
}
const validators = {
string,
method: method2,
number: number2,
boolean: _boolean,
regexp: regexp2,
integer: integer2,
float: floatFn,
array: array2,
object: object2,
enum: enumerable$1,
pattern: pattern$2,
date: date2,
url: type$1,
hex: type$1,
email: type$1,
required: required$1,
any
};
function newMessages() {
return {
default: "Validation error on field %s",
required: "%s is required",
enum: "%s must be one of %s",
whitespace: "%s cannot be empty",
date: {
format: "%s date %s is invalid for format %s",
parse: "%s date could not be parsed, %s is invalid ",
invalid: "%s date %s is invalid"
},
types: {
string: "%s is not a %s",
method: "%s is not a %s (function)",
array: "%s is not an %s",
object: "%s is not an %s",
number: "%s is not a %s",
date: "%s is not a %s",
boolean: "%s is not a %s",
integer: "%s is not an %s",
float: "%s is not a %s",
regexp: "%s is not a valid %s",
email: "%s is not a valid %s",
url: "%s is not a valid %s",
hex: "%s is not a valid %s"
},
string: {
len: "%s must be exactly %s characters",
min: "%s must be at least %s characters",
max: "%s cannot be longer than %s characters",
range: "%s must be between %s and %s characters"
},
number: {
len: "%s must equal %s",
min: "%s cannot be less than %s",
max: "%s cannot be greater than %s",
range: "%s must be between %s and %s"
},
array: {
len: "%s must be exactly %s in length",
min: "%s cannot be less than %s in length",
max: "%s cannot be greater than %s in length",
range: "%s must be between %s and %s in length"
},
pattern: {
mismatch: "%s value %s does not match pattern %s"
},
clone: function clone2() {
const cloned = JSON.parse(JSON.stringify(this));
cloned.clone = this.clone;
return cloned;
}
};
}
const messages = newMessages();
function Schema(descriptor) {
this.rules = null;
this._messages = messages;
this.define(descriptor);
}
Schema.prototype = {
messages: function messages2(_messages) {
if (_messages) {
this._messages = deepMerge(newMessages(), _messages);
}
return this._messages;
},
define: function define(rules2) {
if (!rules2) {
throw new Error("Cannot configure a schema with no rules");
}
if (typeof rules2 !== "object" || Array.isArray(rules2)) {
throw new Error("Rules must be an object");
}
this.rules = {};
let z2;
let item;
for (z2 in rules2) {
if (rules2.hasOwnProperty(z2)) {
item = rules2[z2];
this.rules[z2] = Array.isArray(item) ? item : [item];
}
}
},
validate: function validate(source_, o2, oc) {
const _this = this;
if (o2 === void 0) {
o2 = {};
}
if (oc === void 0) {
oc = function oc2() {
};
}
let source = source_;
let options2 = o2;
let callback = oc;
if (typeof options2 === "function") {
callback = options2;
options2 = {};
}
if (!this.rules || Object.keys(this.rules).length === 0) {
if (callback) {
callback();
}
return Promise.resolve();
}
function complete(results) {
let i2;
let errors = [];
let fields = {};
function add2(e2) {
if (Array.isArray(e2)) {
let _errors;
errors = (_errors = errors).concat.apply(_errors, e2);
} else {
errors.push(e2);
}
}
for (i2 = 0; i2 < results.length; i2++) {
add2(results[i2]);
}
if (!errors.length) {
errors = null;
fields = null;
} else {
fields = convertFieldsError(errors);
}
callback(errors, fields);
}
if (options2.messages) {
let messages$12 = this.messages();
if (messages$12 === messages) {
messages$12 = newMessages();
}
deepMerge(messages$12, options2.messages);
options2.messages = messages$12;
} else {
options2.messages = this.messages();
}
let arr;
let value2;
const series = {};
const keys = options2.keys || Object.keys(this.rules);
keys.forEach((z2) => {
arr = _this.rules[z2];
value2 = source[z2];
arr.forEach((r2) => {
let rule = r2;
if (typeof rule.transform === "function") {
if (source === source_) {
source = { ...source };
}
value2 = source[z2] = rule.transform(value2);
}
if (typeof rule === "function") {
rule = {
validator: rule
};
} else {
rule = { ...rule };
}
rule.validator = _this.getValidationMethod(rule);
rule.field = z2;
rule.fullField = rule.fullField || z2;
rule.type = _this.getType(rule);
if (!rule.validator) {
return;
}
series[z2] = series[z2] || [];
series[z2].push({
rule,
value: value2,
source,
field: z2
});
});
});
const errorFields = {};
return asyncMap(series, options2, (data, doIt) => {
const { rule } = data;
let deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
deep = deep && (rule.required || !rule.required && data.value);
rule.field = data.field;
function addFullfield(key, schema) {
return { ...schema, fullField: `${rule.fullField}.${key}` };
}
function cb(e2) {
if (e2 === void 0) {
e2 = [];
}
let errors = e2;
if (!Array.isArray(errors)) {
errors = [errors];
}
if (!options2.suppressWarning && errors.length) {
Schema.warning("async-validator:", errors);
}
if (errors.length && rule.message) {
errors = [].concat(rule.message);
}
errors = errors.map(complementError(rule));
if (options2.first && errors.length) {
errorFields[rule.field] = 1;
return doIt(errors);
}
if (!deep) {
doIt(errors);
} else {
if (rule.required && !data.value) {
if (rule.message) {
errors = [].concat(rule.message).map(complementError(rule));
} else if (options2.error) {
errors = [options2.error(rule, format(options2.messages.required, rule.field))];
} else {
errors = [];
}
return doIt(errors);
}
let fieldsSchema = {};
if (rule.defaultField) {
for (const k2 in data.value) {
if (data.value.hasOwnProperty(k2)) {
fieldsSchema[k2] = rule.defaultField;
}
}
}
fieldsSchema = { ...fieldsSchema, ...data.rule.fields };
for (const f2 in fieldsSchema) {
if (fieldsSchema.hasOwnProperty(f2)) {
const fieldSchema = Array.isArray(fieldsSchema[f2]) ? fieldsSchema[f2] : [fieldsSchema[f2]];
fieldsSchema[f2] = fieldSchema.map(addFullfield.bind(null, f2));
}
}
const schema = new Schema(fieldsSchema);
schema.messages(options2.messages);
if (data.rule.options) {
data.rule.options.messages = options2.messages;
data.rule.options.error = options2.error;
}
schema.validate(data.value, data.rule.options || options2, (errs) => {
const finalErrors = [];
if (errors && errors.length) {
finalErrors.push.apply(finalErrors, errors);
}
if (errs && errs.length) {
finalErrors.push.apply(finalErrors, errs);
}
doIt(finalErrors.length ? finalErrors : null);
});
}
}
let res;
if (rule.asyncValidator) {
res = rule.asyncValidator(rule, data.value, cb, data.source, options2);
} else if (rule.validator) {
res = rule.validator(rule, data.value, cb, data.source, options2);
if (res === true) {
cb();
} else if (res === false) {
cb(rule.message || `${rule.field} fails`);
} else if (res instanceof Array) {
cb(res);
} else if (res instanceof Error) {
cb(res.message);
}
}
if (res && res.then) {
res.then(() => cb(), (e2) => cb(e2));
}
}, (results) => {
complete(results);
});
},
getType: function getType(rule) {
if (rule.type === void 0 && rule.pattern instanceof RegExp) {
rule.type = "pattern";
}
if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
throw new Error(format("Unknown rule type %s", rule.type));
}
return rule.type || "string";
},
getValidationMethod: function getValidationMethod(rule) {
if (typeof rule.validator === "function") {
return rule.validator;
}
const keys = Object.keys(rule);
const messageIndex = keys.indexOf("message");
if (messageIndex !== -1) {
keys.splice(messageIndex, 1);
}
if (keys.length === 1 && keys[0] === "required") {
return validators.required;
}
return validators[this.getType(rule)] || false;
}
};
Schema.register = function register(type2, validator) {
if (typeof validator !== "function") {
throw new Error("Cannot register a validator by type, validator is not a function");
}
validators[type2] = validator;
};
Schema.warning = warning;
Schema.messages = messages;
Schema.warning = function() {
};
const _sfc_main$1o = {
name: "u-form",
mixins: [mpMixin, mixin, props$V],
provide() {
return {
uForm: this
};
},
data() {
return {
formRules: {},
// 规则校验器
validator: {},
// 原始的model快照,用于resetFields方法重置表单时使用
originalModel: null
};
},
watch: {
// 监听规则的变化
rules: {
immediate: true,
handler(n2) {
this.setRules(n2);
}
},
// 监听属性的变化,通知子组件u-form-item重新获取信息
propsChange(n2) {
var _a2;
if ((_a2 = this.children) == null ? void 0 : _a2.length) {
this.children.map((child) => {
typeof child.updateParentData == "function" && child.updateParentData();
});
}
},
// 监听model的初始值作为重置表单的快照
model: {
immediate: true,
handler(n2) {
if (!this.originalModel) {
this.originalModel = deepClone(n2);
}
}
}
},
computed: {
propsChange() {
return [
this.errorType,
this.borderBottom,
this.labelPosition,
this.labelWidth,
this.labelAlign,
this.labelStyle
];
}
},
created() {
this.children = [];
},
methods: {
// 手动设置校验的规则,如果规则中有函数的话,微信小程序中会过滤掉,所以只能手动调用设置规则
setRules(rules2) {
if (Object.keys(rules2).length === 0)
return;
if (Object.keys(this.model).length === 0) {
error("设置rules,model必须设置!如果已经设置,请刷新页面。");
return;
}
this.formRules = rules2;
this.validator = new Schema(rules2);
},
// 清空所有u-form-item组件的内容,本质上是调用了u-form-item组件中的resetField()方法
resetFields() {
this.resetModel();
},
// 重置model为初始值的快照
resetModel(obj) {
this.children.map((child) => {
const prop = child == null ? void 0 : child.prop;
const value2 = getProperty(this.originalModel, prop);
setProperty(this.model, prop, value2);
});
},
// 清空校验结果
clearValidate(props2) {
props2 = [].concat(props2);
this.children.map((child) => {
if (props2[0] === void 0 || props2.includes(child.prop)) {
child.message = null;
}
});
},
// 对部分表单字段进行校验
async validateField(value2, callback, event = null, options2) {
this.$nextTick(() => {
const errorsRes = [];
value2 = [].concat(value2);
let promises = this.children.map((child) => {
return new Promise((resolve, reject) => {
const childErrors = [];
if (value2.includes(child.prop)) {
const propertyVal = getProperty(
this.model,
child.prop
);
const propertyChain = child.prop.split(".");
const propertyName = propertyChain[propertyChain.length - 1];
let rule = [];
if (child.itemRules && child.itemRules.length > 0) {
rule = child.itemRules;
} else {
rule = this.formRules[child.prop];
}
if (!rule) {
resolve();
return;
}
const rules2 = [].concat(rule);
if (!rules2.length) {
resolve();
}
for (let i2 = 0; i2 < rules2.length; i2++) {
const ruleItem = rules2[i2];
const trigger = [].concat(ruleItem == null ? void 0 : ruleItem.trigger);
if (event && !trigger.includes(event)) {
resolve();
continue;
}
const validator = new Schema({
[propertyName]: ruleItem
});
validator.validate(
{
[propertyName]: propertyVal
},
(errors, fields) => {
var _a2;
if (test.array(errors)) {
errors.forEach((element) => {
element.prop = child.prop;
});
errorsRes.push(...errors);
childErrors.push(...errors);
}
if (!options2 || (options2 == null ? void 0 : options2.showErrorMsg) == true) {
child.message = ((_a2 = childErrors[0]) == null ? void 0 : _a2.message) ? childErrors[0].message : null;
}
if (i2 == rules2.length - 1) {
resolve(errorsRes);
}
}
);
}
} else {
resolve({});
}
});
});
Promise.all(promises).then((results) => {
typeof callback === "function" && callback(errorsRes);
}).catch((error2) => {
formatAppLog("error", "at uni_modules/uview-plus/components/u-form/u-form.vue:218", "An error occurred:", error2);
});
});
},
/**
* 校验全部数据
* @param {Object} options
* @param {Boolean} options.showErrorMsg -是否显示校验信息,
*/
validate(options2) {
if (Object.keys(this.formRules).length === 0) {
error("未设置rules,请看文档说明!如果已经设置,请刷新页面。");
return;
}
return new Promise((resolve, reject) => {
this.$nextTick(() => {
const formItemProps = this.children.map(
(item) => item.prop
);
this.validateField(formItemProps, (errors) => {
if (errors.length) {
this.errorType === "toast" && toast(errors[0].message);
reject(errors);
} else {
resolve(true);
}
}, null, options2);
});
});
}
}
};
function _sfc_render$1n(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock("view", { class: "u-form" }, [
vue.renderSlot(_ctx.$slots, "default")
]);
}
const uForm = /* @__PURE__ */ _export_sfc(_sfc_main$1o, [["render", _sfc_render$1n], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-form/u-form.vue"]]);
const __vite_glob_0_42 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uForm
}, Symbol.toStringTag, { value: "Module" }));
const props$U = defineMixin({
props: {
// 宫格的name
name: {
type: [String, Number, null],
default: () => props$1x.gridItem.name
},
// 背景颜色
bgColor: {
type: String,
default: () => props$1x.gridItem.bgColor
}
}
});
const _sfc_main$1n = {
name: "u-grid-item",
mixins: [mpMixin, mixin, props$U],
data() {
return {
parentData: {
col: 0,
// 父组件划分的宫格数
border: true
// 是否显示边框,根据父组件决定
},
classes: []
// 类名集合,用于判断是否显示右边和下边框
};
},
mounted() {
this.init();
},
emits: ["click"],
// 微信小程序中 options 选项
computed: {
itemStyle() {
const style = {
background: this.bgColor
};
style["width"] = "100%";
return deepMerge$1(style, addStyle(this.customStyle));
}
},
methods: {
init() {
uni.$on("$uGridItem", () => {
this.gridItemClasses();
});
this.updateParentData();
uni.$emit("$uGridItem");
this.gridItemClasses();
},
// 获取父组件的参数
updateParentData() {
this.getParentData("u-grid");
},
clickHandler() {
var _a2;
let name2 = this.name;
const children = (_a2 = this.parent) == null ? void 0 : _a2.children;
if (children && this.name === null) {
name2 = children.findIndex((child) => child === this);
}
this.parent && this.parent.childClick(name2);
this.$emit("click", name2);
},
async getItemWidth() {
let width = 0;
if (this.parent) {
const parentWidth = await this.getParentWidth();
width = parentWidth / Number(this.parentData.col) + "px";
}
this.width = width;
},
// 获取父元素的尺寸
getParentWidth() {
},
gridItemClasses() {
if (this.parentData.border) {
let classes = [];
this.parent.children.map((child, index2) => {
if (this === child) {
const len = this.parent.children.length;
if ((index2 + 1) % this.parentData.col !== 0 && index2 + 1 !== len) {
classes.push("u-border-right");
}
const lessNum = len % this.parentData.col === 0 ? this.parentData.col : len % this.parentData.col;
if (index2 < len - lessNum) {
classes.push("u-border-bottom");
}
}
});
this.classes = classes;
}
}
},
beforeUnmount() {
uni.$off("$uGridItem");
}
};
function _sfc_render$1m(_ctx, _cache, $props, $setup, $data, $options) {
return $data.parentData.col > 0 ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: vue.normalizeClass(["u-grid-item", $data.classes]),
"hover-class": "u-grid-item--hover-class",
"hover-stay-time": 200,
onClick: _cache[0] || (_cache[0] = (...args) => $options.clickHandler && $options.clickHandler(...args)),
style: vue.normalizeStyle([$options.itemStyle])
},
[
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
],
6
/* CLASS, STYLE */
)) : vue.createCommentVNode("v-if", true);
}
const uGridItem = /* @__PURE__ */ _export_sfc(_sfc_main$1n, [["render", _sfc_render$1m], ["__scopeId", "data-v-0a78094b"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-grid-item/u-grid-item.vue"]]);
const __vite_glob_0_44 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uGridItem
}, Symbol.toStringTag, { value: "Module" }));
const props$T = defineMixin({
props: {
// 分成几列
col: {
type: [String, Number],
default: () => props$1x.grid.col
},
// 是否显示边框
border: {
type: Boolean,
default: () => props$1x.grid.border
},
// 宫格对齐方式,表现为数量少的时候,靠左,居中,还是靠右
align: {
type: String,
default: () => props$1x.grid.align
},
// 间隔
gap: {
type: String,
default: "0px"
}
}
});
const _sfc_main$1m = {
name: "u-grid",
mixins: [mpMixin, mixin, props$T],
data() {
return {
index: 0,
width: 0
};
},
watch: {
// 当父组件需要子组件需要共享的参数发生了变化,手动通知子组件
parentData() {
if (this.children.length) {
this.children.map((child) => {
typeof child.updateParentData == "function" && child.updateParentData();
});
}
}
},
created() {
this.children = [];
},
computed: {
// 计算父组件的值是否发生变化
parentData() {
return [this.hoverClass, this.col, this.size, this.border];
},
// 宫格对齐方式
gridStyle() {
let style = {};
switch (this.align) {
case "left":
style.justifyContent = "flex-start";
break;
case "center":
style.justifyContent = "center";
break;
case "right":
style.justifyContent = "flex-end";
break;
default:
style.justifyContent = "flex-start";
}
return deepMerge$1(style, addStyle(this.customStyle));
}
},
emits: ["click"],
// 防止事件执行两次
// 20240409发现抖音小程序如果开启virtualHost会出现严重问题,几乎所有事件包括created等生命周期事件全部失效。
methods: {
// 此方法由u-grid-item触发,用于在u-grid发出事件
childClick(name2) {
this.$emit("click", name2);
}
}
};
const __injectCSSVars__ = () => {
vue.useCssVars((_ctx) => ({
"10b668c8-gap": _ctx.gap,
"10b668c8-col": _ctx.col
}));
};
const __setup__ = _sfc_main$1m.setup;
_sfc_main$1m.setup = __setup__ ? (props2, ctx) => {
__injectCSSVars__();
return __setup__(props2, ctx);
} : __injectCSSVars__;
function _sfc_render$1l(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: "u-grid",
ref: "u-grid",
style: vue.normalizeStyle([$options.gridStyle])
},
[
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
],
4
/* STYLE */
);
}
const uGrid = /* @__PURE__ */ _export_sfc(_sfc_main$1m, [["render", _sfc_render$1l], ["__scopeId", "data-v-10b668c8"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-grid/u-grid.vue"]]);
const __vite_glob_0_45 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uGrid
}, Symbol.toStringTag, { value: "Module" }));
const icons = {
"uicon-level": "",
"uicon-column-line": "",
"uicon-checkbox-mark": "",
"uicon-folder": "",
"uicon-movie": "",
"uicon-star-fill": "",
"uicon-star": "",
"uicon-phone-fill": "",
"uicon-phone": "",
"uicon-apple-fill": "",
"uicon-chrome-circle-fill": "",
"uicon-backspace": "",
"uicon-attach": "",
"uicon-cut": "",
"uicon-empty-car": "",
"uicon-empty-coupon": "",
"uicon-empty-address": "",
"uicon-empty-favor": "",
"uicon-empty-permission": "",
"uicon-empty-news": "",
"uicon-empty-search": "",
"uicon-github-circle-fill": "",
"uicon-rmb": "",
"uicon-person-delete-fill": "",
"uicon-reload": "",
"uicon-order": "",
"uicon-server-man": "",
"uicon-search": "",
"uicon-fingerprint": "",
"uicon-more-dot-fill": "",
"uicon-scan": "",
"uicon-share-square": "",
"uicon-map": "",
"uicon-map-fill": "",
"uicon-tags": "",
"uicon-tags-fill": "",
"uicon-bookmark-fill": "",
"uicon-bookmark": "",
"uicon-eye": "",
"uicon-eye-fill": "",
"uicon-mic": "",
"uicon-mic-off": "",
"uicon-calendar": "",
"uicon-calendar-fill": "",
"uicon-trash": "",
"uicon-trash-fill": "",
"uicon-play-left": "",
"uicon-play-right": "",
"uicon-minus": "",
"uicon-plus": "",
"uicon-info": "",
"uicon-info-circle": "",
"uicon-info-circle-fill": "",
"uicon-question": "",
"uicon-error": "",
"uicon-close": "",
"uicon-checkmark": "",
"uicon-android-circle-fill": "",
"uicon-android-fill": "",
"uicon-ie": "",
"uicon-IE-circle-fill": "",
"uicon-google": "",
"uicon-google-circle-fill": "",
"uicon-setting-fill": "",
"uicon-setting": "",
"uicon-minus-square-fill": "",
"uicon-plus-square-fill": "",
"uicon-heart": "",
"uicon-heart-fill": "",
"uicon-camera": "",
"uicon-camera-fill": "",
"uicon-more-circle": "",
"uicon-more-circle-fill": "",
"uicon-chat": "",
"uicon-chat-fill": "",
"uicon-bag-fill": "",
"uicon-bag": "",
"uicon-error-circle-fill": "",
"uicon-error-circle": "",
"uicon-close-circle": "",
"uicon-close-circle-fill": "",
"uicon-checkmark-circle": "",
"uicon-checkmark-circle-fill": "",
"uicon-question-circle-fill": "",
"uicon-question-circle": "",
"uicon-share": "",
"uicon-share-fill": "",
"uicon-shopping-cart": "",
"uicon-shopping-cart-fill": "",
"uicon-bell": "",
"uicon-bell-fill": "",
"uicon-list": "",
"uicon-list-dot": "",
"uicon-zhihu": "",
"uicon-zhihu-circle-fill": "",
"uicon-zhifubao": "",
"uicon-zhifubao-circle-fill": "",
"uicon-weixin-circle-fill": "",
"uicon-weixin-fill": "",
"uicon-twitter-circle-fill": "",
"uicon-twitter": "",
"uicon-taobao-circle-fill": "",
"uicon-taobao": "",
"uicon-weibo-circle-fill": "",
"uicon-weibo": "",
"uicon-qq-fill": "",
"uicon-qq-circle-fill": "",
"uicon-moments-circel-fill": "",
"uicon-moments": "",
"uicon-qzone": "",
"uicon-qzone-circle-fill": "",
"uicon-baidu-circle-fill": "",
"uicon-baidu": "",
"uicon-facebook-circle-fill": "",
"uicon-facebook": "",
"uicon-car": "",
"uicon-car-fill": "",
"uicon-warning-fill": "",
"uicon-warning": "",
"uicon-clock-fill": "",
"uicon-clock": "",
"uicon-edit-pen": "",
"uicon-edit-pen-fill": "",
"uicon-email": "",
"uicon-email-fill": "",
"uicon-minus-circle": "",
"uicon-minus-circle-fill": "",
"uicon-plus-circle": "",
"uicon-plus-circle-fill": "",
"uicon-file-text": "",
"uicon-file-text-fill": "",
"uicon-pushpin": "",
"uicon-pushpin-fill": "",
"uicon-grid": "",
"uicon-grid-fill": "",
"uicon-play-circle": "",
"uicon-play-circle-fill": "",
"uicon-pause-circle-fill": "",
"uicon-pause": "",
"uicon-pause-circle": "",
"uicon-eye-off": "",
"uicon-eye-off-outline": "",
"uicon-gift-fill": "",
"uicon-gift": "",
"uicon-rmb-circle-fill": "",
"uicon-rmb-circle": "",
"uicon-kefu-ermai": "",
"uicon-server-fill": "",
"uicon-coupon-fill": "",
"uicon-coupon": "",
"uicon-integral": "",
"uicon-integral-fill": "",
"uicon-home-fill": "",
"uicon-home": "",
"uicon-hourglass-half-fill": "",
"uicon-hourglass": "",
"uicon-account": "",
"uicon-plus-people-fill": "",
"uicon-minus-people-fill": "",
"uicon-account-fill": "",
"uicon-thumb-down-fill": "",
"uicon-thumb-down": "",
"uicon-thumb-up": "",
"uicon-thumb-up-fill": "",
"uicon-lock-fill": "",
"uicon-lock-open": "",
"uicon-lock-opened-fill": "",
"uicon-lock": "",
"uicon-red-packet-fill": "",
"uicon-photo-fill": "",
"uicon-photo": "",
"uicon-volume-off-fill": "",
"uicon-volume-off": "",
"uicon-volume-fill": "",
"uicon-volume": "",
"uicon-red-packet": "",
"uicon-download": "",
"uicon-arrow-up-fill": "",
"uicon-arrow-down-fill": "",
"uicon-play-left-fill": "",
"uicon-play-right-fill": "",
"uicon-rewind-left-fill": "",
"uicon-rewind-right-fill": "",
"uicon-arrow-downward": "",
"uicon-arrow-leftward": "",
"uicon-arrow-rightward": "",
"uicon-arrow-upward": "",
"uicon-arrow-down": "",
"uicon-arrow-right": "",
"uicon-arrow-left": "",
"uicon-arrow-up": "",
"uicon-skip-back-left": "",
"uicon-skip-forward-right": "",
"uicon-rewind-right": "",
"uicon-rewind-left": "",
"uicon-arrow-right-double": "",
"uicon-arrow-left-double": "",
"uicon-wifi-off": "",
"uicon-wifi": "",
"uicon-empty-data": "",
"uicon-empty-history": "",
"uicon-empty-list": "",
"uicon-empty-page": "",
"uicon-empty-order": "",
"uicon-man": "",
"uicon-woman": "",
"uicon-man-add": "",
"uicon-man-add-fill": "",
"uicon-man-delete": "",
"uicon-man-delete-fill": "",
"uicon-zh": "",
"uicon-en": ""
};
const props$S = defineMixin({
props: {
// 图标类名
name: {
type: String,
default: () => props$1x.icon.name
},
// 图标颜色,可接受主题色
color: {
type: String,
default: () => props$1x.icon.color
},
// 字体大小,单位px
size: {
type: [String, Number],
default: () => props$1x.icon.size
},
// 是否显示粗体
bold: {
type: Boolean,
default: () => props$1x.icon.bold
},
// 点击图标的时候传递事件出去的index(用于区分点击了哪一个)
index: {
type: [String, Number],
default: () => props$1x.icon.index
},
// 触摸图标时的类名
hoverClass: {
type: String,
default: () => props$1x.icon.hoverClass
},
// 自定义扩展前缀,方便用户扩展自己的图标库
customPrefix: {
type: String,
default: () => props$1x.icon.customPrefix
},
// 图标右边或者下面的文字
label: {
type: [String, Number],
default: () => props$1x.icon.label
},
// label的位置,只能右边或者下边
labelPos: {
type: String,
default: () => props$1x.icon.labelPos
},
// label的大小
labelSize: {
type: [String, Number],
default: () => props$1x.icon.labelSize
},
// label的颜色
labelColor: {
type: String,
default: () => props$1x.icon.labelColor
},
// label与图标的距离
space: {
type: [String, Number],
default: () => props$1x.icon.space
},
// 图片的mode
imgMode: {
type: String,
default: () => props$1x.icon.imgMode
},
// 用于显示图片小图标时,图片的宽度
width: {
type: [String, Number],
default: () => props$1x.icon.width
},
// 用于显示图片小图标时,图片的高度
height: {
type: [String, Number],
default: () => props$1x.icon.height
},
// 用于解决某些情况下,让图标垂直居中的用途
top: {
type: [String, Number],
default: () => props$1x.icon.top
},
// 是否阻止事件传播
stop: {
type: Boolean,
default: () => props$1x.icon.stop
}
}
});
let params = {
loaded: false
};
const loadFont = () => {
if (config$1.loadFontOnce) {
params.loaded = true;
}
uni.loadFontFace({
global: true,
// 是否全局生效。微信小程序 '2.10.0'起支持全局生效,需在 app.vue 中调用。
family: "uicon-iconfont",
source: 'url("' + config$1.iconUrl + '")',
success() {
},
fail() {
}
});
if (config$1.customIcon.family) {
uni.loadFontFace({
global: true,
// 是否全局生效。微信小程序 '2.10.0'起支持全局生效,需在 app.vue 中调用。
family: config$1.customIcon.family,
source: 'url("' + config$1.customIcon.url + '")',
success() {
},
fail() {
}
});
}
return true;
};
const fontUtil = {
params,
loadFont
};
const _sfc_main$1l = {
name: "u-icon",
beforeCreate() {
if (!fontUtil.params.loaded) {
fontUtil.loadFont();
}
},
data() {
return {};
},
emits: ["click"],
mixins: [mpMixin, mixin, props$S],
computed: {
uClasses() {
let classes = [];
classes.push(this.customPrefix + "-" + this.name);
if (this.customPrefix == "uicon") {
classes.push("u-iconfont");
} else {
classes.push(this.customPrefix);
}
if (this.color && config$1.type.includes(this.color))
classes.push("u-icon__icon--" + this.color);
return classes;
},
iconStyle() {
let style = {};
style = {
fontSize: addUnit(this.size),
lineHeight: addUnit(this.size),
fontWeight: this.bold ? "bold" : "normal",
// 某些特殊情况需要设置一个到顶部的距离,才能更好的垂直居中
top: addUnit(this.top)
};
if (this.customPrefix !== "uicon") {
style.fontFamily = this.customPrefix;
}
if (this.color && !config$1.type.includes(this.color))
style.color = this.color;
return style;
},
// 判断传入的name属性,是否图片路径,只要带有"/"均认为是图片形式
isImg() {
return this.name.indexOf("/") !== -1;
},
imgStyle() {
let style = {};
style.width = this.width ? addUnit(this.width) : addUnit(this.size);
style.height = this.height ? addUnit(this.height) : addUnit(this.size);
return style;
},
// 通过图标名,查找对应的图标
icon() {
if (this.customPrefix !== "uicon") {
return config$1.customIcons[this.name] || this.name;
}
return icons["uicon-" + this.name] || this.name;
}
},
methods: {
addStyle,
addUnit,
clickHandler(e2) {
this.$emit("click", this.index, e2);
this.stop && this.preventEvent(e2);
}
}
};
function _sfc_render$1k(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["u-icon", ["u-icon--" + _ctx.labelPos]]),
onClick: _cache[0] || (_cache[0] = (...args) => $options.clickHandler && $options.clickHandler(...args))
},
[
$options.isImg ? (vue.openBlock(), vue.createElementBlock("image", {
key: 0,
class: "u-icon__img",
src: _ctx.name,
mode: _ctx.imgMode,
style: vue.normalizeStyle([$options.imgStyle, $options.addStyle(_ctx.customStyle)])
}, null, 12, ["src", "mode"])) : (vue.openBlock(), vue.createElementBlock("text", {
key: 1,
class: vue.normalizeClass(["u-icon__icon", $options.uClasses]),
style: vue.normalizeStyle([$options.iconStyle, $options.addStyle(_ctx.customStyle)]),
"hover-class": _ctx.hoverClass
}, vue.toDisplayString($options.icon), 15, ["hover-class"])),
vue.createCommentVNode(' 这里进行空字符串判断,如果仅仅是v-if="label",可能会出现传递0的时候,结果也无法显示 '),
_ctx.label !== "" ? (vue.openBlock(), vue.createElementBlock(
"text",
{
key: 2,
class: "u-icon__label",
style: vue.normalizeStyle({
color: _ctx.labelColor,
fontSize: $options.addUnit(_ctx.labelSize),
marginLeft: _ctx.labelPos == "right" ? $options.addUnit(_ctx.space) : 0,
marginTop: _ctx.labelPos == "bottom" ? $options.addUnit(_ctx.space) : 0,
marginRight: _ctx.labelPos == "left" ? $options.addUnit(_ctx.space) : 0,
marginBottom: _ctx.labelPos == "top" ? $options.addUnit(_ctx.space) : 0
})
},
vue.toDisplayString(_ctx.label),
5
/* TEXT, STYLE */
)) : vue.createCommentVNode("v-if", true)
],
2
/* CLASS */
);
}
const uIcon = /* @__PURE__ */ _export_sfc(_sfc_main$1l, [["render", _sfc_render$1k], ["__scopeId", "data-v-ac70166d"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-icon/u-icon.vue"]]);
const __vite_glob_0_46 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uIcon
}, Symbol.toStringTag, { value: "Module" }));
const props$R = defineMixin({
props: {
// 图片地址
src: {
type: String,
default: () => props$1x.image.src
},
// 裁剪模式
mode: {
type: String,
default: () => props$1x.image.mode
},
// 宽度,单位任意
width: {
type: [String, Number],
default: () => props$1x.image.width
},
// 高度,单位任意
height: {
type: [String, Number],
default: () => props$1x.image.height
},
// 图片形状,circle-圆形,square-方形
shape: {
type: String,
default: () => props$1x.image.shape
},
// 圆角,单位任意
radius: {
type: [String, Number],
default: () => props$1x.image.radius
},
// 是否懒加载,微信小程序、App、百度小程序、字节跳动小程序
lazyLoad: {
type: Boolean,
default: () => props$1x.image.lazyLoad
},
// 开启长按图片显示识别微信小程序码菜单
showMenuByLongpress: {
type: Boolean,
default: () => props$1x.image.showMenuByLongpress
},
// 加载中的图标,或者小图片
loadingIcon: {
type: String,
default: () => props$1x.image.loadingIcon
},
// 加载失败的图标,或者小图片
errorIcon: {
type: String,
default: () => props$1x.image.errorIcon
},
// 是否显示加载中的图标或者自定义的slot
showLoading: {
type: Boolean,
default: () => props$1x.image.showLoading
},
// 是否显示加载错误的图标或者自定义的slot
showError: {
type: Boolean,
default: () => props$1x.image.showError
},
// 是否需要淡入效果
fade: {
type: Boolean,
default: () => props$1x.image.fade
},
// 只支持网络资源,只对微信小程序有效
webp: {
type: Boolean,
default: () => props$1x.image.webp
},
// 过渡时间,单位ms
duration: {
type: [String, Number],
default: () => props$1x.image.duration
},
// 背景颜色,用于深色页面加载图片时,为了和背景色融合
bgColor: {
type: String,
default: () => props$1x.image.bgColor
}
}
});
const _sfc_main$1k = {
name: "u-image",
mixins: [mpMixin, mixin, props$R],
data() {
return {
// 图片是否加载错误,如果是,则显示错误占位图
isError: false,
// 初始化组件时,默认为加载中状态
loading: true,
// 不透明度,为了实现淡入淡出的效果
opacity: 1,
// 过渡时间,因为props的值无法修改,故需要一个中间值
durationTime: this.duration,
// 图片加载完成时,去掉背景颜色,因为如果是png图片,就会显示灰色的背景
backgroundStyle: {},
// 用于fade模式的控制组件显示与否
show: false
};
},
watch: {
src: {
immediate: true,
handler(n2) {
if (!n2) {
this.isError = true;
} else {
this.isError = false;
this.loading = true;
}
}
}
},
computed: {
transStyle() {
let style = {};
if (this.loading || this.isError || this.width == "100%" || this.mode != "heightFix") {
style.width = addUnit(this.width);
} else {
style.width = "fit-content";
}
if (this.loading || this.isError || this.height == "100%" || this.mode != "widthFix") {
style.height = addUnit(this.height);
} else {
style.height = "fit-content";
}
return style;
},
wrapStyle() {
let style = {};
if (this.loading || this.isError || this.width == "100%" || this.mode != "heightFix") {
style.width = addUnit(this.width);
} else {
style.width = "fit-content";
}
if (this.loading || this.isError || this.height == "100%" || this.mode != "widthFix") {
style.height = addUnit(this.height);
} else {
style.height = "fit-content";
}
style.borderRadius = this.shape == "circle" ? "10000px" : addUnit(this.radius);
style.overflow = this.radius > 0 ? "hidden" : "visible";
return deepMerge$1(style, addStyle(this.customStyle));
}
},
mounted() {
this.show = true;
},
emits: ["click", "error", "load"],
methods: {
addUnit,
// 点击图片
onClick(e2) {
this.$emit("click", e2);
},
// 图片加载失败
onErrorHandler(err) {
this.loading = false;
this.isError = true;
this.$emit("error", err);
},
// 图片加载完成,标记loading结束
onLoadHandler(event) {
this.loading = false;
this.isError = false;
this.$emit("load", event);
this.removeBgColor();
},
// 移除图片的背景色
removeBgColor() {
}
}
};
function _sfc_render$1j(_ctx, _cache, $props, $setup, $data, $options) {
const _component_up_icon = vue.resolveComponent("up-icon");
const _component_u_transition = resolveEasycom(vue.resolveDynamicComponent("u-transition"), __easycom_2$1);
return vue.openBlock(), vue.createBlock(_component_u_transition, {
mode: "fade",
show: $data.show,
style: vue.normalizeStyle($options.transStyle),
duration: _ctx.fade ? 1e3 : 0
}, {
default: vue.withCtx(() => [
vue.createElementVNode(
"view",
{
class: "u-image box-border",
onClick: _cache[2] || (_cache[2] = (...args) => $options.onClick && $options.onClick(...args)),
style: vue.normalizeStyle([$options.wrapStyle, $data.backgroundStyle])
},
[
!$data.isError ? (vue.openBlock(), vue.createElementBlock("image", {
key: 0,
src: _ctx.src,
mode: _ctx.mode,
onError: _cache[0] || (_cache[0] = (...args) => $options.onErrorHandler && $options.onErrorHandler(...args)),
onLoad: _cache[1] || (_cache[1] = (...args) => $options.onLoadHandler && $options.onLoadHandler(...args)),
"show-menu-by-longpress": _ctx.showMenuByLongpress,
"lazy-load": _ctx.lazyLoad,
class: "u-image__image",
style: vue.normalizeStyle({
width: $options.addUnit(_ctx.width),
height: $options.addUnit(_ctx.height),
borderRadius: _ctx.shape == "circle" ? "10000px" : $options.addUnit(_ctx.radius)
})
}, null, 44, ["src", "mode", "show-menu-by-longpress", "lazy-load"])) : vue.createCommentVNode("v-if", true),
_ctx.showLoading && $data.loading ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 1,
class: "u-image__loading",
style: vue.normalizeStyle({
borderRadius: _ctx.shape == "circle" ? "50%" : $options.addUnit(_ctx.radius),
backgroundColor: this.bgColor,
width: $options.addUnit(_ctx.width),
height: $options.addUnit(_ctx.height)
})
},
[
vue.renderSlot(_ctx.$slots, "loading", {}, () => [
vue.createVNode(_component_up_icon, { name: _ctx.loadingIcon }, null, 8, ["name"])
], true)
],
4
/* STYLE */
)) : vue.createCommentVNode("v-if", true),
_ctx.showError && $data.isError && !$data.loading ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 2,
class: "u-image__error",
style: vue.normalizeStyle({
borderRadius: _ctx.shape == "circle" ? "50%" : $options.addUnit(_ctx.radius),
backgroundColor: this.bgColor,
width: $options.addUnit(_ctx.width),
height: $options.addUnit(_ctx.height)
})
},
[
vue.renderSlot(_ctx.$slots, "error", {}, () => [
vue.createVNode(_component_up_icon, { name: _ctx.errorIcon }, null, 8, ["name"])
], true)
],
4
/* STYLE */
)) : vue.createCommentVNode("v-if", true)
],
4
/* STYLE */
)
]),
_: 3
/* FORWARDED */
}, 8, ["show", "style", "duration"]);
}
const uImage = /* @__PURE__ */ _export_sfc(_sfc_main$1k, [["render", _sfc_render$1j], ["__scopeId", "data-v-abebd402"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-image/u-image.vue"]]);
const __vite_glob_0_47 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uImage
}, Symbol.toStringTag, { value: "Module" }));
const props$Q = defineMixin({
props: {
// 列表锚点文本内容
text: {
type: [String, Number],
default: () => props$1x.indexAnchor.text
},
// 列表锚点文字颜色
color: {
type: String,
default: () => props$1x.indexAnchor.color
},
// 列表锚点文字大小,单位默认px
size: {
type: [String, Number],
default: () => props$1x.indexAnchor.size
},
// 列表锚点背景颜色
bgColor: {
type: String,
default: () => props$1x.indexAnchor.bgColor
},
// 列表锚点高度,单位默认px
height: {
type: [String, Number],
default: () => props$1x.indexAnchor.height
}
}
});
const _sfc_main$1j = {
name: "u-index-anchor",
mixins: [mpMixin, mixin, props$Q],
data() {
return {};
},
mounted() {
this.init();
},
methods: {
addUnit,
init() {
const indexList2 = $parent.call(this, "u-index-list");
if (!indexList2) {
return error("u-index-anchor必须要搭配u-index-list组件使用");
}
indexList2.anchors.push(this);
const indexListItem = $parent.call(this, "u-index-item");
if (!indexListItem) {
return error("u-index-anchor必须要搭配u-index-item组件使用");
}
if (typeof this.text == "string") {
indexListItem.id = this.text.charCodeAt(0);
} else {
indexListItem.id = this.text.name.charCodeAt(0);
}
}
},
computed: {
parentSticky() {
const indexList2 = $parent.call(this, "u-index-list");
return indexList2 ? indexList2.sticky : true;
}
}
};
function _sfc_render$1i(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["u-index-anchor u-border-bottom", { "u-index-anchor--sticky": $options.parentSticky }]),
ref: `u-index-anchor-${_ctx.text}`,
style: vue.normalizeStyle({
height: $options.addUnit(_ctx.height),
backgroundColor: _ctx.bgColor
})
},
[
vue.createElementVNode(
"text",
{
class: "u-index-anchor__text",
style: vue.normalizeStyle({
fontSize: $options.addUnit(_ctx.size),
color: _ctx.color
})
},
vue.toDisplayString(_ctx.text.name || _ctx.text),
5
/* TEXT, STYLE */
)
],
6
/* CLASS, STYLE */
);
}
const uIndexAnchor = /* @__PURE__ */ _export_sfc(_sfc_main$1j, [["render", _sfc_render$1i], ["__scopeId", "data-v-20d39374"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-index-anchor/u-index-anchor.vue"]]);
const __vite_glob_0_48 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uIndexAnchor
}, Symbol.toStringTag, { value: "Module" }));
const props$P = defineMixin({
props: {}
});
const _sfc_main$1i = {
name: "u-index-item",
mixins: [mpMixin, mixin, props$P],
data() {
return {
// 本组件到滚动条顶部的距离
top: 0,
height: 0,
id: ""
};
},
created() {
this.anchor = {};
},
mounted() {
this.init();
},
methods: {
init() {
this.getParentData("u-index-list");
if (!this.parent) {
return error("u-index-item必须要搭配u-index-list组件使用");
}
sleep().then(() => {
this.getIndexItemRect().then((size) => {
this.top = Math.ceil(size.top);
this.height = Math.ceil(size.height);
});
});
},
getIndexItemRect() {
return new Promise((resolve) => {
this.$uGetRect(".u-index-item").then((size) => {
resolve(size);
});
});
}
}
};
function _sfc_render$1h(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock("view", {
class: vue.normalizeClass(["u-index-item", [`u-index-item-${$data.id}`]]),
id: `u-index-item-${$data.id}`
}, [
vue.renderSlot(_ctx.$slots, "default")
], 10, ["id"]);
}
const uIndexItem = /* @__PURE__ */ _export_sfc(_sfc_main$1i, [["render", _sfc_render$1h], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-index-item/u-index-item.vue"]]);
const __vite_glob_0_49 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uIndexItem
}, Symbol.toStringTag, { value: "Module" }));
const props$O = defineMixin({
props: {
// 右边锚点非激活的颜色
inactiveColor: {
type: String,
default: () => props$1x.indexList.inactiveColor
},
// 右边锚点激活的颜色
activeColor: {
type: String,
default: () => props$1x.indexList.activeColor
},
// 索引字符列表,数组形式
indexList: {
type: Array,
default: () => props$1x.indexList.indexList
},
// 是否开启锚点自动吸顶
sticky: {
type: Boolean,
default: () => props$1x.indexList.sticky
},
// 自定义导航栏的高度
customNavHeight: {
type: [String, Number],
default: () => props$1x.indexList.customNavHeight
},
// 是否开启底部安全距离适配
safeBottomFix: {
type: Boolean,
default: () => props$1x.indexList.safeBottomFix
}
}
});
const indexList = () => {
const indexList2 = [];
const charCodeOfA = "A".charCodeAt(0);
for (let i2 = 0; i2 < 26; i2++) {
indexList2.push(String.fromCharCode(charCodeOfA + i2));
}
return indexList2;
};
const _sfc_main$1h = {
name: "u-index-list",
mixins: [mpMixin, mixin, props$O],
data() {
return {
// 当前正在被选中的字母索引
activeIndex: -1,
touchmoveIndex: 1,
// 索引字母的信息
letterInfo: {
height: 0,
itemHeight: 0,
top: 0
},
// 设置字母指示器的高度,后面为了让指示器跟随字母,并将尖角部分指向字母的中部,需要依赖此值
indicatorHeight: 50,
// 字母放大指示器的top值,为了让其指向当前激活的字母
// indicatorTop: 0
// 当前是否正在被触摸状态
touching: false,
// 滚动条顶部top值
scrollTop: 0,
// scroll-view的高度
scrollViewHeight: 0,
// 系统信息
sys: {},
scrolling: false,
scrollIntoView: "",
pageY: 0,
topOffset: 0
};
},
computed: {
// 如果有传入外部的indexList锚点数组则使用,否则使用内部生成A-Z字母
uIndexList() {
return this.indexList.length ? this.indexList : indexList();
},
// 字母放大指示器的top值,为了让其指向当前激活的字母
indicatorTop() {
const {
top,
height,
itemHeight
} = this.letterInfo;
return Math.floor(top - height / 2 + itemHeight * this.activeIndex + itemHeight - 70 / 2);
}
},
watch: {
// 监听字母索引的变化,重新设置尺寸
uIndexList: {
immediate: false,
handler() {
sleep(30).then(() => {
this.setIndexListLetterInfo();
});
}
}
},
created() {
this.children = [];
this.anchors = [];
this.sys = getWindowInfo();
},
mounted() {
this.init();
sleep(50).then(() => {
this.setIndexListLetterInfo();
});
},
methods: {
addUnit,
init() {
let customNavHeight = getPx(this.customNavHeight);
this.getIndexListRect().then(async (sizeScroll) => {
this.scrollViewHeight = sizeScroll.height ? sizeScroll.height : this.sys.windowHeight - customNavHeight;
this.topOffset = this.sys.windowHeight - this.scrollViewHeight;
});
},
// 索引列表被触摸
touchStart(e2) {
const touchStartData = e2.changedTouches[0];
if (!touchStartData)
return;
this.touching = true;
const {
pageY,
screenY
} = touchStartData;
const currentIndex = this.getIndexListLetter(pageY);
this.setValueForTouch(currentIndex);
},
// 索引字母列表被触摸滑动中
touchMove(e2) {
let touchMove = e2.changedTouches[0];
if (!touchMove)
return;
if (!this.touching) {
this.touching = true;
}
const {
pageY,
screenY
} = touchMove;
const currentIndex = this.getIndexListLetter(pageY);
this.setValueForTouch(currentIndex);
},
// 触摸结束
touchEnd(e2) {
sleep(300).then(() => {
this.touching = false;
});
},
// 获取索引列表的尺寸以及单个字符的尺寸信息
getIndexListLetterRect() {
return new Promise((resolve) => {
this.$uGetRect(".u-index-list__letter").then((size) => {
resolve(size);
});
});
},
getIndexListScrollViewRect() {
return new Promise((resolve) => {
this.$uGetRect(".u-index-list__scroll-view").then((size) => {
resolve(size);
});
});
},
getIndexListRect() {
return new Promise((resolve) => {
this.$uGetRect(".u-index-list").then((size) => {
resolve(size);
});
});
},
// 设置indexList索引的尺寸信息
setIndexListLetterInfo() {
this.getIndexListLetterRect().then((size) => {
const {
height
} = size;
const sysData = getWindowInfo();
sysData.windowHeight;
if (this.customNavHeight == 0) {
-(sysData.statusBarHeight + 44);
} else {
getPx(this.customNavHeight);
}
this.getIndexListScrollViewRect().then((sizeScroll) => {
this.letterInfo = {
height,
// 为了让字母列表对屏幕绝对居中,让其对导航栏进行修正,也即往上偏移导航栏的一半高度
top: sizeScroll.height / 2,
// top: (this.scrollViewHeight - height) / 2 + customNavHeight / 2,
itemHeight: Math.floor(height / this.uIndexList.length)
};
});
});
},
// 获取当前被触摸的索引字母
getIndexListLetter(pageY) {
this.pageY = pageY;
let {
top,
height,
itemHeight
} = this.letterInfo;
let index2 = this.currentIndex;
top = top - height / 2;
pageY = pageY - this.topOffset;
if (pageY < top) {
index2 = 0;
} else if (pageY >= top + height) {
index2 = this.uIndexList.length - 1;
} else {
index2 = Math.floor((pageY - top) / itemHeight);
}
return index2;
},
// 设置各项由触摸而导致变化的值
async setValueForTouch(currentIndex) {
if (currentIndex === this.activeIndex)
return;
this.activeIndex = currentIndex;
this.$emit("select", this.uIndexList[currentIndex]);
if (typeof this.uIndexList[currentIndex] == "string") {
this.scrollIntoView = `u-index-item-${this.uIndexList[currentIndex].charCodeAt(0)}`;
} else {
this.scrollIntoView = `u-index-item-${this.uIndexList[currentIndex].name.charCodeAt(0)}`;
}
},
getHeaderRect() {
return new Promise((resolve) => {
if (!this.$slots.header) {
resolve({
width: 0,
height: 0
});
}
this.$uGetRect(".u-index-list__header").then((size) => {
resolve(size);
});
});
},
// scroll-view的滚动事件
async scrollHandler(e2) {
if (this.touching || this.scrolling)
return;
this.scrolling = true;
sleep(10).then(() => {
this.scrolling = false;
});
let scrollTop = 0;
const len = this.children.length;
let children = this.children;
const header = await this.getHeaderRect();
let top = header.height;
this.anchors;
children = this.children.map((item, index2) => {
const child = {
height: item.height,
top
};
top = top + item.height;
return child;
});
scrollTop = e2.detail.scrollTop;
scrollTop = scrollTop + getPx(this.customNavHeight);
for (let i2 = 0; i2 < len; i2++) {
const item = children[i2], nextItem = children[i2 + 1];
if (scrollTop <= children[0].top || scrollTop >= children[len - 1].top + children[len - 1].height) {
this.activeIndex = -1;
break;
} else if (!nextItem) {
this.activeIndex = len - 1;
break;
} else if (scrollTop > item.top && scrollTop < nextItem.top) {
this.activeIndex = i2;
break;
}
}
}
}
};
function _sfc_render$1g(_ctx, _cache, $props, $setup, $data, $options) {
const _component_u_transition = resolveEasycom(vue.resolveDynamicComponent("u-transition"), __easycom_2$1);
return vue.openBlock(), vue.createElementBlock(
"view",
{
ref: "u-index-list",
class: "u-index-list"
},
[
vue.createElementVNode("scroll-view", {
scrollTop: $data.scrollTop,
scrollIntoView: $data.scrollIntoView,
"offset-accuracy": 1,
style: vue.normalizeStyle({
maxHeight: $options.addUnit($data.scrollViewHeight)
}),
"scroll-y": "",
onScroll: _cache[0] || (_cache[0] = (...args) => $options.scrollHandler && $options.scrollHandler(...args)),
ref: "u-index-list__scroll-view",
class: "u-index-list__scroll-view"
}, [
_ctx.$slots.header ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "u-index-list__header"
}, [
vue.renderSlot(_ctx.$slots, "header", {}, void 0, true)
])) : vue.createCommentVNode("v-if", true),
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true),
_ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "u-index-list__footer"
}, [
vue.renderSlot(_ctx.$slots, "footer", {}, void 0, true)
])) : vue.createCommentVNode("v-if", true)
], 44, ["scrollTop", "scrollIntoView"]),
vue.createElementVNode(
"view",
{
class: "u-index-list__letter",
ref: "u-index-list__letter",
style: vue.normalizeStyle({ top: $options.addUnit($data.letterInfo.top), transform: "translateY(-50%)" }),
onTouchstart: _cache[1] || (_cache[1] = vue.withModifiers((...args) => $options.touchStart && $options.touchStart(...args), ["prevent"])),
onTouchmove: _cache[2] || (_cache[2] = vue.withModifiers((...args) => $options.touchMove && $options.touchMove(...args), ["prevent"])),
onTouchend: _cache[3] || (_cache[3] = vue.withModifiers((...args) => $options.touchEnd && $options.touchEnd(...args), ["prevent"])),
onTouchcancel: _cache[4] || (_cache[4] = vue.withModifiers((...args) => $options.touchEnd && $options.touchEnd(...args), ["prevent"]))
},
[
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($options.uIndexList, (item, index2) => {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: "u-index-list__letter__item",
key: index2,
style: vue.normalizeStyle({
backgroundColor: $data.activeIndex === index2 ? _ctx.activeColor : "transparent"
})
},
[
vue.createElementVNode(
"text",
{
class: "u-index-list__letter__item__index",
style: vue.normalizeStyle({ color: $data.activeIndex === index2 ? "#fff" : _ctx.inactiveColor })
},
vue.toDisplayString(item.key || item),
5
/* TEXT, STYLE */
)
],
4
/* STYLE */
);
}),
128
/* KEYED_FRAGMENT */
))
],
36
/* STYLE, NEED_HYDRATION */
),
vue.createVNode(_component_u_transition, {
mode: "fade",
show: $data.touching,
customStyle: {
position: "absolute",
right: "50px",
top: $options.addUnit($options.indicatorTop, "px"),
zIndex: 3
}
}, {
default: vue.withCtx(() => {
var _a2;
return [
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["u-index-list__indicator", ["u-index-list__indicator--show"]]),
style: vue.normalizeStyle({
height: $options.addUnit($data.indicatorHeight),
width: $options.addUnit($data.indicatorHeight)
})
},
[
vue.createElementVNode(
"text",
{ class: "u-index-list__indicator__text" },
vue.toDisplayString(((_a2 = $options.uIndexList[$data.activeIndex]) == null ? void 0 : _a2.key) || $options.uIndexList[$data.activeIndex]),
1
/* TEXT */
)
],
4
/* STYLE */
)
];
}),
_: 1
/* STABLE */
}, 8, ["show", "customStyle"])
],
512
/* NEED_PATCH */
);
}
const uIndexList = /* @__PURE__ */ _export_sfc(_sfc_main$1h, [["render", _sfc_render$1g], ["__scopeId", "data-v-dfefaad1"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-index-list/u-index-list.vue"]]);
const __vite_glob_0_50 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uIndexList
}, Symbol.toStringTag, { value: "Module" }));
const props$N = defineMixin({
props: {
// 绑定的值
modelValue: {
type: [String, Number],
default: () => props$1x.input.value
},
// number-数字输入键盘,app-vue下可以输入浮点数,app-nvue和小程序平台下只能输入整数
// idcard-身份证输入键盘,微信、支付宝、百度、QQ小程序
// digit-带小数点的数字键盘,App的nvue页面、微信、支付宝、百度、头条、QQ小程序
// text-文本输入键盘
type: {
type: String,
default: () => props$1x.input.type
},
// 如果 textarea 是在一个 position:fixed 的区域,需要显示指定属性 fixed 为 true,
// 兼容性:微信小程序、百度小程序、字节跳动小程序、QQ小程序
fixed: {
type: Boolean,
default: () => props$1x.input.fixed
},
// 是否禁用输入框
disabled: {
type: Boolean,
default: () => props$1x.input.disabled
},
// 禁用状态时的背景色
disabledColor: {
type: String,
default: () => props$1x.input.disabledColor
},
// 是否显示清除控件
clearable: {
type: Boolean,
default: false
},
// 是否仅在聚焦时显示清除控件
onlyClearableOnFocused: {
type: Boolean,
default: true
},
// 是否密码类型
password: {
type: Boolean,
default: () => props$1x.input.password
},
// 最大输入长度,设置为 -1 的时候不限制最大长度
maxlength: {
type: [String, Number],
default: () => props$1x.input.maxlength
},
// 输入框为空时的占位符
placeholder: {
type: String,
default: () => props$1x.input.placeholder
},
// 指定placeholder的样式类,注意页面或组件的style中写了scoped时,需要在类名前写/deep/
placeholderClass: {
type: String,
default: () => props$1x.input.placeholderClass
},
// 指定placeholder的样式
placeholderStyle: {
type: [String, Object],
default: () => props$1x.input.placeholderStyle
},
// 是否显示输入字数统计,只在 type ="text"或type ="textarea"时有效
showWordLimit: {
type: Boolean,
default: () => props$1x.input.showWordLimit
},
// 设置右下角按钮的文字,有效值:send|search|next|go|done,兼容性详见uni-app文档
// https://uniapp.dcloud.io/component/input
// https://uniapp.dcloud.io/component/textarea
confirmType: {
type: String,
default: () => props$1x.input.confirmType
},
// 点击键盘右下角按钮时是否保持键盘不收起,H5无效
confirmHold: {
type: Boolean,
default: () => props$1x.input.confirmHold
},
// focus时,点击页面的时候不收起键盘,微信小程序有效
holdKeyboard: {
type: Boolean,
default: () => props$1x.input.holdKeyboard
},
// 自动获取焦点
// 在 H5 平台能否聚焦以及软键盘是否跟随弹出,取决于当前浏览器本身的实现。nvue 页面不支持,需使用组件的 focus()、blur() 方法控制焦点
focus: {
type: Boolean,
default: () => props$1x.input.focus
},
// 键盘收起时,是否自动失去焦点,目前仅App3.0.0+有效
autoBlur: {
type: Boolean,
default: () => props$1x.input.autoBlur
},
// 是否去掉 iOS 下的默认内边距,仅微信小程序,且type=textarea时有效
disableDefaultPadding: {
type: Boolean,
default: () => props$1x.input.disableDefaultPadding
},
// 指定focus时光标的位置
cursor: {
type: [String, Number],
default: () => props$1x.input.cursor
},
// 输入框聚焦时底部与键盘的距离
cursorSpacing: {
type: [String, Number],
default: () => props$1x.input.cursorSpacing
},
// 光标起始位置,自动聚集时有效,需与selection-end搭配使用
selectionStart: {
type: [String, Number],
default: () => props$1x.input.selectionStart
},
// 光标结束位置,自动聚集时有效,需与selection-start搭配使用
selectionEnd: {
type: [String, Number],
default: () => props$1x.input.selectionEnd
},
// 键盘弹起时,是否自动上推页面
adjustPosition: {
type: Boolean,
default: () => props$1x.input.adjustPosition
},
// 输入框内容对齐方式,可选值为:left|center|right
inputAlign: {
type: String,
default: () => props$1x.input.inputAlign
},
// 输入框字体的大小
fontSize: {
type: [String, Number],
default: () => props$1x.input.fontSize
},
// 输入框字体颜色
color: {
type: String,
default: () => props$1x.input.color
},
// 输入框前置图标
prefixIcon: {
type: String,
default: () => props$1x.input.prefixIcon
},
// 前置图标样式,对象或字符串
prefixIconStyle: {
type: [String, Object],
default: () => props$1x.input.prefixIconStyle
},
// 输入框后置图标
suffixIcon: {
type: String,
default: () => props$1x.input.suffixIcon
},
// 后置图标样式,对象或字符串
suffixIconStyle: {
type: [String, Object],
default: () => props$1x.input.suffixIconStyle
},
// 边框类型,surround-四周边框,bottom-底部边框,none-无边框
border: {
type: String,
default: () => props$1x.input.border
},
// 是否只读,与disabled不同之处在于disabled会置灰组件,而readonly则不会
readonly: {
type: Boolean,
default: () => props$1x.input.readonly
},
// 输入框形状,circle-圆形,square-方形
shape: {
type: String,
default: () => props$1x.input.shape
},
// 用于处理或者过滤输入框内容的方法
formatter: {
type: [Function, null],
default: () => props$1x.input.formatter
},
// 是否忽略组件内对文本合成系统事件的处理
ignoreCompositionEvent: {
type: Boolean,
default: true
},
// 光标颜色
cursorColor: {
type: String,
default: () => props$1x.input.cursorColor
},
// 密码类型可见性切换
passwordVisibilityToggle: {
type: Boolean,
default: () => props$1x.input.passwordVisibilityToggle
}
}
});
let timeout = null;
function debounce(func2, wait2 = 500, immediate = false) {
if (timeout !== null)
clearTimeout(timeout);
if (immediate) {
const callNow = !timeout;
timeout = setTimeout(() => {
timeout = null;
}, wait2);
if (callNow)
typeof func2 === "function" && func2();
} else {
timeout = setTimeout(() => {
typeof func2 === "function" && func2();
}, wait2);
}
}
const _sfc_main$1g = {
name: "u-input",
mixins: [mpMixin, mixin, props$N],
data() {
return {
// 清除操作
clearInput: false,
// 输入框的值
innerValue: "",
// 是否处于获得焦点状态
focused: false,
// value是否第一次变化,在watch中,由于加入immediate属性,会在第一次触发,此时不应该认为value发生了变化
firstChange: true,
// value绑定值的变化是由内部还是外部引起的
changeFromInner: false,
// 过滤处理方法
innerFormatter: (value2) => value2,
showPassword: false
};
},
created() {
if (this.formatter) {
this.innerFormatter = this.formatter;
}
},
watch: {
modelValue: {
immediate: true,
handler(newVal, oldVal) {
if (this.changeFromInner || this.innerValue === newVal) {
this.changeFromInner = false;
return;
}
this.innerValue = newVal;
if (this.firstChange === false && this.changeFromInner === false) {
this.valueChange(this.innerValue, true);
} else {
if (!this.firstChange)
formValidate(this, "change");
}
this.firstChange = false;
this.changeFromInner = false;
}
}
},
computed: {
// 是否密码
isPassword() {
let ret = false;
if (this.password) {
ret = true;
} else if (this.type == "password") {
ret = true;
} else {
ret = false;
}
if (this.showPassword) {
ret = false;
}
return ret;
},
// 是否显示清除控件
isShowClear() {
const { clearable, readonly, focused, innerValue, onlyClearableOnFocused } = this;
if (!clearable || readonly) {
return false;
}
if (onlyClearableOnFocused) {
return !!focused && innerValue !== "";
} else {
return innerValue !== "";
}
},
// 组件的类名
inputClass() {
let classes = [], { border, disabled, shape } = this;
border === "surround" && (classes = classes.concat(["u-border", "u-input--radius"]));
classes.push(`u-input--${shape}`);
border === "bottom" && (classes = classes.concat([
"u-border-bottom",
"u-input--no-radius"
]));
return classes.join(" ");
},
// 组件的样式
wrapperStyle() {
const style = {};
if (this.disabled) {
style.backgroundColor = this.disabledColor;
}
if (this.border === "none") {
style.padding = "0";
} else {
style.paddingTop = "6px";
style.paddingBottom = "6px";
style.paddingLeft = "9px";
style.paddingRight = "9px";
}
return deepMerge$1(style, addStyle(this.customStyle));
},
// 输入框的样式
inputStyle() {
const style = {
color: this.color,
fontSize: addUnit(this.fontSize),
textAlign: this.inputAlign
};
return style;
}
},
emits: ["update:modelValue", "focus", "blur", "change", "confirm", "clear", "keyboardheightchange", "nicknamereview"],
methods: {
// 在微信小程序中,不支持将函数当做props参数,故只能通过ref形式调用
setFormatter(e2) {
this.innerFormatter = e2;
},
// 当键盘输入时,触发input事件
onInput(e2) {
let { value: value2 = "" } = e2.detail || {};
this.innerValue = value2;
this.$nextTick(() => {
let formatValue = this.innerFormatter(value2);
this.innerValue = formatValue;
this.valueChange(formatValue);
});
},
// 输入框失去焦点时触发
onBlur(event) {
this.$emit("blur", event.detail.value);
sleep(150).then(() => {
this.focused = false;
});
formValidate(this, "blur");
},
// 输入框聚焦时触发
onFocus(event) {
this.focused = true;
this.$emit("focus");
},
doFocus() {
this.$refs["input-native"].focus();
},
doBlur() {
this.$refs["input-native"].blur();
},
// 点击完成按钮时触发
onConfirm(event) {
this.$emit("confirm", this.innerValue);
},
// 键盘高度发生变化的时候触发此事件
// 兼容性:微信小程序2.7.0+、App 3.1.0+
onkeyboardheightchange(event) {
this.$emit("keyboardheightchange", event);
},
onnicknamereview(event) {
this.$emit("nicknamereview", event);
},
// 内容发生变化,进行处理
valueChange(value2, isOut = false) {
if (this.clearInput) {
this.innerValue = "";
this.clearInput = false;
}
this.$nextTick(() => {
if (!isOut || this.clearInput) {
this.changeFromInner = true;
this.$emit("change", value2);
this.$emit("update:modelValue", value2);
}
formValidate(this, "change");
});
},
// 点击清除控件
onClear() {
this.clearInput = true;
this.innerValue = "";
this.$nextTick(() => {
this.valueChange("");
this.$emit("clear");
});
},
/**
* 在安卓nvue上,事件无法冒泡
* 在某些时间,我们希望监听u-from-item的点击事件,此时会导致点击u-form-item内的u-input后
* 无法触发u-form-item的点击事件,这里通过手动调用u-form-item的方法进行触发
*/
clickHandler() {
if (this.disabled || this.readonly) {
uni.hideKeyboard();
}
}
}
};
function _sfc_render$1f(_ctx, _cache, $props, $setup, $data, $options) {
const _component_up_icon = vue.resolveComponent("up-icon");
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["u-input", $options.inputClass]),
style: vue.normalizeStyle([$options.wrapperStyle])
},
[
vue.createElementVNode("view", { class: "u-input__content" }, [
_ctx.prefixIcon || _ctx.$slots.prefix ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "u-input__content__prefix-icon"
}, [
vue.renderSlot(_ctx.$slots, "prefix", {}, () => [
vue.createVNode(_component_up_icon, {
name: _ctx.prefixIcon,
size: "18",
customStyle: _ctx.prefixIconStyle
}, null, 8, ["name", "customStyle"])
], true)
])) : vue.createCommentVNode("v-if", true),
vue.createElementVNode("view", {
class: "u-input__content__field-wrapper",
onClick: _cache[6] || (_cache[6] = (...args) => $options.clickHandler && $options.clickHandler(...args))
}, [
vue.createCommentVNode(" 根据uni-app的input组件文档,H5和APP中只要声明了password参数(无论true还是false),type均失效,此时\n 为了防止type=number时,又存在password属性,type无效,此时需要设置password为undefined\n "),
vue.createElementVNode("input", {
ref: "input-native",
class: "u-input__content__field-wrapper__field",
style: vue.normalizeStyle([$options.inputStyle]),
type: $data.showPassword && "password" == _ctx.type ? "text" : _ctx.type,
focus: _ctx.focus,
cursor: _ctx.cursor,
value: $data.innerValue,
"auto-blur": _ctx.autoBlur,
disabled: _ctx.disabled || _ctx.readonly,
maxlength: _ctx.maxlength,
placeholder: _ctx.placeholder,
"placeholder-style": _ctx.placeholderStyle,
"placeholder-class": _ctx.placeholderClass,
"confirm-type": _ctx.confirmType,
"confirm-hold": _ctx.confirmHold,
"hold-keyboard": _ctx.holdKeyboard,
"cursor-color": _ctx.cursorColor,
"cursor-spacing": _ctx.cursorSpacing,
"adjust-position": _ctx.adjustPosition,
"selection-end": _ctx.selectionEnd,
"selection-start": _ctx.selectionStart,
password: $options.isPassword,
ignoreCompositionEvent: _ctx.ignoreCompositionEvent,
onInput: _cache[0] || (_cache[0] = (...args) => $options.onInput && $options.onInput(...args)),
onBlur: _cache[1] || (_cache[1] = (...args) => $options.onBlur && $options.onBlur(...args)),
onFocus: _cache[2] || (_cache[2] = (...args) => $options.onFocus && $options.onFocus(...args)),
onConfirm: _cache[3] || (_cache[3] = (...args) => $options.onConfirm && $options.onConfirm(...args)),
onKeyboardheightchange: _cache[4] || (_cache[4] = (...args) => $options.onkeyboardheightchange && $options.onkeyboardheightchange(...args)),
onNicknamereview: _cache[5] || (_cache[5] = (...args) => $options.onnicknamereview && $options.onnicknamereview(...args))
}, null, 44, ["type", "focus", "cursor", "value", "auto-blur", "disabled", "maxlength", "placeholder", "placeholder-style", "placeholder-class", "confirm-type", "confirm-hold", "hold-keyboard", "cursor-color", "cursor-spacing", "adjust-position", "selection-end", "selection-start", "password", "ignoreCompositionEvent"])
]),
$options.isShowClear ? (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "u-input__content__clear",
onClick: _cache[7] || (_cache[7] = (...args) => $options.onClear && $options.onClear(...args))
}, [
vue.createVNode(_component_up_icon, {
name: "close",
size: "11",
color: "#ffffff",
customStyle: "line-height: 12px"
})
])) : vue.createCommentVNode("v-if", true),
(_ctx.type == "password" || _ctx.password) && _ctx.passwordVisibilityToggle ? (vue.openBlock(), vue.createElementBlock("view", {
key: 2,
class: "u-input__content__subfix-password-shower"
}, [
vue.createVNode(_component_up_icon, {
onClick: _cache[8] || (_cache[8] = ($event) => $data.showPassword = !$data.showPassword),
name: $data.showPassword ? "eye-off" : "eye-fill",
size: "18"
}, null, 8, ["name"])
])) : vue.createCommentVNode("v-if", true),
_ctx.suffixIcon || _ctx.$slots.suffix ? (vue.openBlock(), vue.createElementBlock("view", {
key: 3,
class: "u-input__content__subfix-icon"
}, [
vue.renderSlot(_ctx.$slots, "suffix", {}, () => [
vue.createVNode(_component_up_icon, {
name: _ctx.suffixIcon,
size: "18",
customStyle: _ctx.suffixIconStyle
}, null, 8, ["name", "customStyle"])
], true)
])) : vue.createCommentVNode("v-if", true)
])
],
6
/* CLASS, STYLE */
);
}
const uInput = /* @__PURE__ */ _export_sfc(_sfc_main$1g, [["render", _sfc_render$1f], ["__scopeId", "data-v-df79975b"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-input/u-input.vue"]]);
const __vite_glob_0_51 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uInput
}, Symbol.toStringTag, { value: "Module" }));
const props$M = defineMixin({
props: {
// 键盘的类型,number-数字键盘,card-身份证键盘
mode: {
type: String,
default: () => props$1x.numberKeyboard.value
},
// 是否显示键盘的"."符号
dotDisabled: {
type: Boolean,
default: () => props$1x.numberKeyboard.dotDisabled
},
// 是否打乱键盘按键的顺序
random: {
type: Boolean,
default: () => props$1x.numberKeyboard.random
}
}
});
const _sfc_main$1f = {
name: "u-number-keyboard",
mixins: [mpMixin, mixin, props$M],
data() {
return {
backspace: "backspace",
// 退格键内容
dot: ".",
// 点
timer: null,
// 长按多次删除的事件监听
cardX: "X"
// 身份证的X符号
};
},
computed: {
// 键盘需要显示的内容
numList() {
if (this.dotDisabled && this.mode == "number") {
if (!this.random) {
return [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
} else {
return randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]);
}
} else if (!this.dotDisabled && this.mode == "number") {
if (!this.random) {
return [1, 2, 3, 4, 5, 6, 7, 8, 9, this.dot, 0];
} else {
return randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, this.dot, 0]);
}
} else if (this.mode == "card") {
if (!this.random) {
return [1, 2, 3, 4, 5, 6, 7, 8, 9, this.cardX, 0];
} else {
return randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, this.cardX, 0]);
}
}
},
// 按键的样式,在非乱序&&数字键盘&&不显示点按钮时,index为9时,按键占位两个空间
itemStyle() {
return (index2) => {
let style = {};
if (this.mode == "number" && this.dotDisabled && index2 == 9)
style.width = "464rpx";
return style;
};
},
// 是否让按键显示灰色,只在非乱序&&数字键盘&&且允许点按键的时候
btnBgGray() {
return (index2) => {
if (!this.random && index2 == 9 && (this.mode != "number" || this.mode == "number" && !this.dotDisabled))
return true;
else
return false;
};
}
},
created() {
},
emits: ["backspace", "change"],
methods: {
// 点击退格键
backspaceClick() {
this.$emit("backspace");
clearInterval(this.timer);
this.timer = null;
this.timer = setInterval(() => {
this.$emit("backspace");
}, 250);
},
clearTimer() {
clearInterval(this.timer);
this.timer = null;
},
// 获取键盘显示的内容
keyboardClick(val) {
if (!this.dotDisabled && val != this.dot && val != this.cardX)
val = Number(val);
this.$emit("change", val);
}
}
};
function _sfc_render$1e(_ctx, _cache, $props, $setup, $data, $options) {
const _component_up_icon = vue.resolveComponent("up-icon");
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: "u-keyboard",
onTouchmove: _cache[2] || (_cache[2] = vue.withModifiers((...args) => _ctx.noop && _ctx.noop(...args), ["stop", "prevent"]))
},
[
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($options.numList, (item, index2) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "u-keyboard__button-wrapper",
key: index2
}, [
vue.createElementVNode("view", {
class: "u-keyboard__button-wrapper__button",
style: vue.normalizeStyle([$options.itemStyle(index2)]),
onClick: ($event) => $options.keyboardClick(item),
"hover-class": "u-hover-class",
"hover-stay-time": 200
}, [
vue.createElementVNode(
"text",
{ class: "u-keyboard__button-wrapper__button__text" },
vue.toDisplayString(item),
1
/* TEXT */
)
], 12, ["onClick"])
]);
}),
128
/* KEYED_FRAGMENT */
)),
vue.createElementVNode("view", { class: "u-keyboard__button-wrapper" }, [
vue.createElementVNode(
"view",
{
class: "u-keyboard__button-wrapper__button u-keyboard__button-wrapper__button--gray",
"hover-class": "u-hover-class",
"hover-stay-time": 200,
onTouchstart: _cache[0] || (_cache[0] = vue.withModifiers((...args) => $options.backspaceClick && $options.backspaceClick(...args), ["stop"])),
onTouchend: _cache[1] || (_cache[1] = (...args) => $options.clearTimer && $options.clearTimer(...args))
},
[
vue.createVNode(_component_up_icon, {
name: "backspace",
color: "#303133",
size: "28"
})
],
32
/* NEED_HYDRATION */
)
])
],
32
/* NEED_HYDRATION */
);
}
const __easycom_0$3 = /* @__PURE__ */ _export_sfc(_sfc_main$1f, [["render", _sfc_render$1e], ["__scopeId", "data-v-d73731be"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-number-keyboard/u-number-keyboard.vue"]]);
const __vite_glob_0_71 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: __easycom_0$3
}, Symbol.toStringTag, { value: "Module" }));
const props$L = defineMixin({
props: {
// 键盘的类型,number-数字键盘,card-身份证键盘,car-车牌号键盘
mode: {
type: String,
default: () => props$1x.keyboard.mode
},
// 是否显示键盘的"."符号
dotDisabled: {
type: Boolean,
default: () => props$1x.keyboard.dotDisabled
},
// 是否显示顶部工具条
tooltip: {
type: Boolean,
default: () => props$1x.keyboard.tooltip
},
// 是否显示工具条中间的提示
showTips: {
type: Boolean,
default: () => props$1x.keyboard.showTips
},
// 工具条中间的提示文字
tips: {
type: String,
default: () => props$1x.keyboard.tips
},
// 是否显示工具条左边的"取消"按钮
showCancel: {
type: Boolean,
default: () => props$1x.keyboard.showCancel
},
// 是否显示工具条右边的"完成"按钮
showConfirm: {
type: Boolean,
default: () => props$1x.keyboard.showConfirm
},
// 是否打乱键盘按键的顺序
random: {
type: Boolean,
default: () => props$1x.keyboard.random
},
// 是否开启底部安全区适配,开启的话,会在iPhoneX机型底部添加一定的内边距
safeAreaInsetBottom: {
type: Boolean,
default: () => props$1x.keyboard.safeAreaInsetBottom
},
// 是否允许通过点击遮罩关闭键盘
closeOnClickOverlay: {
type: Boolean,
default: () => props$1x.keyboard.closeOnClickOverlay
},
// 控制键盘的弹出与收起
show: {
type: Boolean,
default: () => props$1x.keyboard.show
},
// 是否显示遮罩,某些时候数字键盘时,用户希望看到自己的数值,所以可能不想要遮罩
overlay: {
type: Boolean,
default: () => props$1x.keyboard.overlay
},
// z-index值
zIndex: {
type: [String, Number],
default: () => props$1x.keyboard.zIndex
},
// 取消按钮的文字
cancelText: {
type: String,
default: () => props$1x.keyboard.cancelText
},
// 确认按钮的文字
confirmText: {
type: String,
default: () => props$1x.keyboard.confirmText
},
// 输入一个中文后,是否自动切换到英文
autoChange: {
type: Boolean,
default: () => props$1x.keyboard.autoChange
}
}
});
const _sfc_main$1e = {
name: "u-keyboard",
data() {
return {};
},
mixins: [mpMixin, mixin, props$L],
emits: ["change", "close", "confirm", "cancel", "backspace"],
methods: {
change(e2) {
this.$emit("change", e2);
},
// 键盘关闭
popupClose() {
this.$emit("close");
},
// 输入完成
onConfirm() {
this.$emit("confirm");
},
// 取消输入
onCancel() {
this.$emit("cancel");
},
// 退格键
backspace() {
this.$emit("backspace");
}
}
};
function _sfc_render$1d(_ctx, _cache, $props, $setup, $data, $options) {
const _component_u_number_keyboard = resolveEasycom(vue.resolveDynamicComponent("u-number-keyboard"), __easycom_0$3);
const _component_u_car_keyboard = resolveEasycom(vue.resolveDynamicComponent("u-car-keyboard"), __easycom_1$2);
const _component_u_popup = resolveEasycom(vue.resolveDynamicComponent("u-popup"), __easycom_2);
return vue.openBlock(), vue.createBlock(_component_u_popup, {
overlay: _ctx.overlay,
closeOnClickOverlay: _ctx.closeOnClickOverlay,
mode: "bottom",
popup: false,
show: _ctx.show,
safeAreaInsetBottom: _ctx.safeAreaInsetBottom,
onClose: $options.popupClose,
zIndex: _ctx.zIndex,
customStyle: {
backgroundColor: "rgb(214, 218, 220)"
}
}, {
default: vue.withCtx(() => [
vue.createElementVNode("view", { class: "u-keyboard" }, [
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true),
_ctx.tooltip ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "u-keyboard__tooltip"
}, [
vue.createElementVNode("view", {
"hover-class": "u-hover-class",
"hover-stay-time": 100
}, [
_ctx.showCancel ? (vue.openBlock(), vue.createElementBlock(
"text",
{
key: 0,
class: "u-keyboard__tooltip__item u-keyboard__tooltip__cancel",
onClick: _cache[0] || (_cache[0] = (...args) => $options.onCancel && $options.onCancel(...args))
},
vue.toDisplayString(_ctx.showCancel && _ctx.cancelText),
1
/* TEXT */
)) : vue.createCommentVNode("v-if", true)
]),
vue.createElementVNode("view", null, [
_ctx.showTips ? (vue.openBlock(), vue.createElementBlock(
"text",
{
key: 0,
class: "u-keyboard__tooltip__item u-keyboard__tooltip__tips"
},
vue.toDisplayString(_ctx.tips ? _ctx.tips : _ctx.mode == "number" ? "数字键盘" : _ctx.mode == "card" ? "身份证键盘" : "车牌号键盘"),
1
/* TEXT */
)) : vue.createCommentVNode("v-if", true)
]),
vue.createElementVNode("view", {
"hover-class": "u-hover-class",
"hover-stay-time": 100
}, [
_ctx.showConfirm ? (vue.openBlock(), vue.createElementBlock(
"text",
{
key: 0,
onClick: _cache[1] || (_cache[1] = (...args) => $options.onConfirm && $options.onConfirm(...args)),
class: "u-keyboard__tooltip__item u-keyboard__tooltip__submit",
"hover-class": "u-hover-class"
},
vue.toDisplayString(_ctx.showConfirm && _ctx.confirmText),
1
/* TEXT */
)) : vue.createCommentVNode("v-if", true)
])
])) : vue.createCommentVNode("v-if", true),
_ctx.mode == "number" || _ctx.mode == "card" ? (vue.openBlock(), vue.createBlock(_component_u_number_keyboard, {
key: 1,
random: _ctx.random,
onBackspace: $options.backspace,
onChange: $options.change,
mode: _ctx.mode,
dotDisabled: _ctx.dotDisabled
}, null, 8, ["random", "onBackspace", "onChange", "mode", "dotDisabled"])) : (vue.openBlock(), vue.createBlock(_component_u_car_keyboard, {
key: 2,
random: _ctx.random,
autoChange: _ctx.autoChange,
onBackspace: $options.backspace,
onChange: $options.change
}, null, 8, ["random", "autoChange", "onBackspace", "onChange"]))
])
]),
_: 3
/* FORWARDED */
}, 8, ["overlay", "closeOnClickOverlay", "show", "safeAreaInsetBottom", "onClose", "zIndex", "customStyle"]);
}
const uKeyboard = /* @__PURE__ */ _export_sfc(_sfc_main$1e, [["render", _sfc_render$1d], ["__scopeId", "data-v-5c3a4793"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-keyboard/u-keyboard.vue"]]);
const __vite_glob_0_52 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uKeyboard
}, Symbol.toStringTag, { value: "Module" }));
const _sfc_main$1d = {
name: "u-lazy-load",
props: {
index: {
type: [Number, String]
},
// 要显示的图片
image: {
type: String,
default: ""
},
// 图片裁剪模式
imgMode: {
type: String,
default: "widthFix"
},
// 占位图片路径
loadingImg: {
type: String,
default: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAMAAAC3Ycb+AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OUM0QjNBQjkyQUQ2MTFFQTlCNUQ4RTIzNDE5RUIxNjciIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OUM0QjNBQkEyQUQ2MTFFQTlCNUQ4RTIzNDE5RUIxNjciPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo5QzRCM0FCNzJBRDYxMUVBOUI1RDhFMjM0MTlFQjE2NyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo5QzRCM0FCODJBRDYxMUVBOUI1RDhFMjM0MTlFQjE2NyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PtRHfPcAAAAzUExURZWVldfX18PDw62trZubm9zc3Li4uKGhoebm5tLS0uHh4c3Nzaenp729vcjIyLKysuvr6141L40AAAcXSURBVHja7NzZlqpGAEBR5lG0//9rIw7IJKJi4or7PGTdtN10wr5SVAEGf/qqArsAiIAAERAgAgJEQIAIiIAAERAgAgJEQIAIiIAAERAgAgJEQIAIiIAAERAgAgJEQIAIiIAAERAgAgJEQIAIiIAAERAgAgJEQIAIiIAAERAgAgJEQIAIiIAAERAgAgJEQIAIiIAAERAgAgJEQIAIiIAAERAgAgJEQIAICBABERAgAgJEQIAICBABERAgAgJEQIAICBABERAgAgJEQIAICBABERAgAgJEQIAICBABERAgAgJEQIAICBABERAgAgJEQIAICBABERAgAgJEQIAICBABERAgAgJEQIAICBABERAg+nmQFMi5Jis+sIniED23jSzIgLTtg2D//iYme/8QBM/9lQ+CAEhbNLM3N9hEHAThX7GPCiBfAxK1b51kD+R7QMLjXg7iCsgWIPUh7pfVozG791oeBPngm48G583uW5GkBvI+SBaM2xXDn1oqum423bX/mgF5FySc2cv93Voug9TdZotsggnkBZB2NzbhrSY5HnoG07jei8dvzsJB/c3W60SALILE46+WCztsbhPR7R2VJq0ukEcT49nyy8QhaKcRa3fYHZD4+ufqOJAcgDz8/59vtw1I3QP5K6JsOG0vm3hce4I8LQp/BaRZGJC3AAn7IKOKXbC+7EdA5vdmmVwOLksgRThqOqiH4XEGsht+peoPUE8U/jJIO5OLH4GEwUslV5G0PTBG5Uiw/Y2jyigO3l9HAHKv9PYb82LloH74dZBoBUgar+l48NsNvtD0fkez9iwrAvIYZDRCl+Xs149Hm/KZmQ+QjUCiO1ei4ru7EsgnQYrkznlQb7thCuRfAzlOAPN72427P4VA/i2Q/DKT/Ls/VR8fvIBsDZIuz7TPF6TCbnk4GJkB2RokejTjuE7/unlgCuSTIO0Cy+Plp6vDfnQlBchy8QtjSHVd3EgmK1bHLm+H6+nXYbz2DuQRSPnqoL7vvq0u70on4zvxgCyWD3b9UyDVdW24PaWaiGTnFZJwPIQAebDpIKheBIm7n124ZthMJipAlkqHO+IZkP1tbfzOJark/A7MgKyvvl60fRqkvXfhuow+t9+q00+0/yyBrK8ZngOtBzldhw2X9tvpNGty0gvkmbPeJ0Cy/r09s/stbmfo0yMWkEdjevgKyOn2t2pxv7UXoibTdCDLje9/Ww1ymqzn87dbp92242ZmMRjI8hASvwKSLq4udqN6ksw8nxXN3tszD9L8Gkg+2mFrQYql5az4tvFj5xOx4VwnSdeBtGdyPwUytxK77pBVlNHdO7OK3rh/eTPUvdutT3fO52tuHMqD4N7llv8pyOQQ//w19YVDfX27+Sfuby9/6nau4pdA8vEdOZuChEH/quHt0Jg+IRJ/5+PrHwKZXfjbDiS73Zo7mu5UkzX7uTsXe0e/7nC3ePf1O69+BUg2XDfZCqSqOu7rGVf8cHBe8zhC2b61dtUHXv0OkGo6ZL4JkpbRYXdUaFevivx2M/1GIOctNh949TtAoumQ+TpIHMX54CJu+8BDd8FkE5BqcZh/59XvAClmTvKfB0nDqIlHo3T70SftyW1eX9dXtgQJqs1f/Q6QaOa/7wmQKtxH8eiGoCRuovODIO3VxOMmruZbHrLyD7z6DSDtGyT7ew1kf9hNn07c986JTovzzem0Id9wUG+Vk/IDr34DSNR7huZJkMFT6vEhqrPx/j5cnlZML8N6/PAzh9Y99Flm5Yde/c9BquDOkvkKkMP58dA4qi9vivE8JOvGz/j8FokfPpr288+pH2ZPOZrLmeGD+7KOh6dqYWJ48ki7yUg0tz0go/fv/LLddfV3sgOLJyaGPY/zrSlh1a36Arkzoue9CyG35ze6E6/dzO2Ga0EGHqdRJIkfn9/8OEjTW8Vq91ZWh39FeehWA7Nu9ft8CpUEk1WWOyDF0OPyEU2Pnzf/bZC0P6IPzmAvu7KauQBVrgKpJ0tG2arHzX8e5Pb3PezNs/PrX+3JMyCLn9XXf37tPFHvt09WfCDDjx+yyn1/p1V11j7GnB/q3leLuVva79S/tzed+db08YpF4uOZtmz/9oXWMq6BCAgQAQEiIEAERECACAgQAQEiIEAERECACAgQAQEiIEAERECACAgQAQEiIEAERECACAgQAQEiIEAERECACAgQAQEiIEAERECACAgQAQEiIEAERECACAgQAQEiIEAERECACAgQAQEiIEAERECACAgQAQEiIEAEBIiACAgQAQEiIEAEBIiACAgQAQEiIEAEBIiACAgQAQEiIEAEBIiACAgQAQEiIEAEBIiACAgQAQEiIEAEBIiACAgQAQEiIEAEBIiACAgQAQEiIEAEBIiACAgQAQEiIEAEBIiACAgQAQEiIEAEBIiAALELvqt/BBgACqVeUBXxcCkAAAAASUVORK5CYII="
},
// 加载失败的错误占位图
errorImg: {
type: String,
default: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAMAAAC3Ycb+AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6ODdDMjhENDYyQUQ2MTFFQTlDQ0VBODgxQjFFOEEyMEMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6ODdDMjhENDcyQUQ2MTFFQTlDQ0VBODgxQjFFOEEyMEMiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo4N0MyOEQ0NDJBRDYxMUVBOUNDRUE4ODFCMUU4QTIwQyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo4N0MyOEQ0NTJBRDYxMUVBOUNDRUE4ODFCMUU4QTIwQyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PhLwhikAAAAzUExURZWVldfX162trcPDw5ubm7i4uNzc3Obm5s3NzaGhoeHh4cjIyKenp9LS0r29vbKysuvr67sDMEkAAAlpSURBVHja7NzpYqMgAIVRUVHc8/5PO66R1WAbOzX97q+ZtDEpR0AWTR7kVyWhCAAhgABCAAGEAAIIAQQQAggBBBACCCAEEEAIIIAQQAgggBBAACGAAEIAAYQAQgABhAACCAEEEAIIIAQQAgggBBBACCCAEEAAIYAQQAAhgABCAAGEAAIIAYQAAggBBBACCCAEEEAIIAQQQAgggBBAACGAAEIAIYAAQgABhAACCAEEEAIIAQQQAgggBBBACCCAEEAAIYAQQAAhgABCAAGEAAIIAYQAAggBBBACCCAEEEAIIAQQQAgggBBAACGAAEIAIYAAQgABhAACCAEEEAIIAQQQAgggBBBACCCAEEAIIIAQQAAhgABCAAGEAEIAAYQAAggBBBACCCAEEAIIIAQQQAgggBBAACGAEEAAIYAAsqeX5QWHKIcs/Ptl03lfL4zDFPWfBGmSpPn+IZzSH5KkCL5B+n+oklwz6Iz//R2QzFOabzhEmiRirAmZt/bl0w/dpMbLqeeo4wEdpC7zR5WAPKziHKtO7ql+ReKvIa9BxgNaL5ZtEkpeAGIVp5jKJa09xVo9vgSSzQcszdYvmOqjQNSQ6pHK6rO1n1Xj32788miwHLaZz1Tl9i/yayDlYJ/60/+lp8GSY7OY1B8E4p55bWmfquFk22GLuUUxi78cX+m+BjL2GLkhMrV+/muS6Sfic0CEp5T1Yu2OQdTzsKV0MJV73KVjroyTffxfuv5Tf3fd6iLT9wz8YdVHgUzF2Is9/Xhi5sYJqP1w/GUpjOiHVbaI0w2L+pg3GZzvtokcgHxWDXHaiy78l3sPke01qphamT5c+dqyeAGSumdL/mkggauTam0e3L/mPEiqtzKDbl0Z1Wn8xOa4ySo8X/7TQIJnY/seEKWf12UmC72CKP9xYjr19RPT7NNA+oMO+R0gwmlotAry+C6I0f59ch8yXVQOr0BKYcXt1IUYRyCt+Ur9HGsrQKI79WY9sY9ARPKlzFOFdb41ioD8b5Bp+mqeeRKAxINkESBFGpOpKhgv9OuYpH8A8l4Qa3qp60Kl2/k+rG2sWafuuyCBafb2j4JkgZUob3nWcmicpkxEgmTLLGejTxnWSWCi8lPmsk6DlIHFJv24ojiYyYoGacwL8zXTLEAVaDI/Ybb3NIgKDSv2oXpmHkvNs+PTpMASEdlk7fOZeRk37fwJ6yGnQarQsGIfqqcvx43rTOXY6jf7uKXdRzdLDRPbjIrx1cIj3Kr4KyBFezzgUGuR5893qkOQ19fR2uVBaU+r16LphJNOiatK7PeBZK/Kb+tUn71rcQjSvARpghfH/yG/D2RetTuI3N5QrMWdP46brP7FmKZ//CGQ9At9SL01DLkzY/Vs8Z97fQZ7gelw7jHqCz+/Wile5J4g3Vc79eb5a6oLSue+Ve83gaSv2jp5PxCzjzwFUm9zw9MllSMil1kS4d2E9SaQ1xNo9wMxx0+nQNLnew/WDHvveMAHYm08mofl3TFI/8pD3Q6kMAv6DIi2jTCwRJUvNdDYrrJum9oHhusCbWALonwxBRk1vXMnEGWuT5wAmfYuVGUYpJ7fUZujCN92hvzwWlrFgxSfANKb10DxIMbShnfrynyZZV30imA7P43ArXXHbvBVkTCIuGy25AdBrHmNeBCpL214QdLp9LZarG3IMWrmW0ehtuO7F2PS09UcgqS3B7FKPhpknrStD0HGF/vQRne37LwLG8EbHT4WxN7/Fg0yD9Yr/3br4nnstA+0Il6QxzdBmg8A6a2/IRbkcK9h/uzV8zywF/oSkOyageCPglRWgcWClHnEzs9q/t/SENVXgFijlsq3VtXdCsRp4qObrLLLgjuzSq3fX89ZZW6AfxNIzF6X9FYgThN/fk093KkvHX/hbWd+DqS/FUhlf+G3gohEXzVs3g9iDluWoaW8fL73QhB34u+tIHIf19nLuF4Q98a09Eynnl56q+ePgEhnX+dbQOp6H5XnJ0ACd8dFgkwf12nTOTcEqd2pom+CFF02TIPw6dKmrLS5qOtBpo8b5quUtrwrSGbuqPkeSJqllTFHO02NPxdMrm+y5LKdWyWXjw4vA5nGEtnjuyCFyHqNYvEolzmASm3zK1Eg5zr13lhqV1tlksnVw8Pkwgri7O07AVKLJkutRYw87bPlRpBpNXE8xGb+fhBlvEGrGPLqViu5sILIx9dAmqF1705sxF4M8+R8P5dOdQwi12fMnATpjJ2JSt/POIvU9wPJEs/jduJAjLvU0yFT0i64Yb1bsVi79dA4pEy3TzoHMq2O7Re4vXm5O9+l290NpE4CU+YRIMNye2iaqbVS2AUnn2fsekthYKReVNutVedA5juttyIXrT38mOds+ps9DWhwL7GWc61/DVKPzVN9UHDarf1icU98IOU8tm6L031Iq63t1tKzj3fe/FCpO4F0/i0Z2+yvA1KeGBjqj1qYx8/zoxpKZ1Yl367I1k+sfcft/QPy9csXy/32qX1qLZsrryG5BGQaRj0vc/b7N54XXq293TCLB5HO42Fy517obW19b+qjl3CHp0fdLJcWvmdy1etESi/uAdJrs1hTaUklHuW8qSDdC3UfXVR5cnD3rAFSSqtFb7z7eapErx7rC739jCXfbK3aWiipjXo8UbmxXPa7QQq9R289j2Gr88N7Ag5AlHPRKc37pNZv0CZtX1tVMG6rm8qW1/KlCgQvcMss933ybwXZz3dReW5yce4ByZtHFIhwT9kmjxg8BzbKDUe1PB9edBJqSN7/KM1LmqyuMZ5BpeTUw1aD/uDI0relPfSHa/Wn8Pxq1BNfxy/h3IdwOJqIKumb9CHvTqMefyY82RoQAgggBBBACCCAEEAAIYAQQAAhgABCAAGEAAIIAYQAAggBBBACCCAEEEAIIAQQQAgggBBAACGAAEIAIYAAQgABhAACCAEEEAIIAQQQAgggBBBACCCAEEAIIIAQQAAhgABCAAGEAEIAAYQAAggBBBACCCAEEAIIIAQQQAgggBBAACGAEEAAIYAAQgABhAACCAEEEAIIAQQQAgggBBBACCCAEEAIIIAQQAAhgABCAAGEAEIAAYQAAggBBBACCCAEEAIIIAQQQAgggBBAACGAEEAAIYAAQgABhAACCAGEAAIIAQQQAgggBBBACCAEEEAIIIAQQAAhgABCACGAAEIAAYQAAggBBBACCAEEEAIIIAQQQAggfyL/BBgA8PgLdH0TBtkAAAAASUVORK5CYII="
},
// 图片进入可见区域前多少像素时,单位rpx,开始加载图片
// 负数为图片超出屏幕底部多少距离后触发懒加载,正数为图片顶部距离屏幕底部多少距离时触发(图片还没出现在屏幕上)
threshold: {
type: [Number, String],
default: 100
},
// 淡入淡出动画的过渡时间
duration: {
type: [Number, String],
default: 500
},
// 渡效果的速度曲线,各个之间差别不大,因为这是淡入淡出,且时间很短,不是那些变形或者移动的情况,会明显
// linear|ease|ease-in|ease-out|ease-in-out|cubic-bezier(n,n,n,n);
effect: {
type: String,
default: "ease-in-out"
},
// 是否使用过渡效果
isEffect: {
type: Boolean,
default: true
},
// 圆角值
borderRadius: {
type: [Number, String],
default: 0
},
// 图片高度,单位rpx
height: {
type: [Number, String],
default: "200"
}
},
data() {
return {
isShow: false,
opacity: 1,
time: this.duration,
loadStatus: "",
// 默认是懒加载中的状态
isError: false,
// 图片加载失败
elIndex: guid()
};
},
computed: {
// 将threshold从rpx转为px
getThreshold() {
let thresholdPx = uni.upx2px(Math.abs(this.threshold));
return this.threshold < 0 ? -thresholdPx : thresholdPx;
},
// 计算图片的高度,可能为auto,带%,或者直接数值
imgHeight() {
return addUnit(this.height);
}
},
created() {
this.observer = {};
},
watch: {
isShow(nVal) {
if (!this.isEffect)
return;
this.time = 0;
this.opacity = 0;
setTimeout(() => {
this.time = this.duration;
this.opacity = 1;
}, 30);
},
// 图片路径发生变化时,需要重新标记一些变量,否则会一直卡在某一个状态,比如isError
image(n2) {
if (!n2) {
this.isError = true;
} else {
this.init();
this.isError = false;
}
}
},
emits: ["click", "load", "error"],
methods: {
// 用于重新初始化
init() {
this.isError = false;
this.loadStatus = "";
},
// 点击图片触发的事件,loadlazy-还是懒加载中状态,loading-图片正在加载,loaded-图片加加载完成
clickImg() {
if (this.isShow == false)
;
else if (this.isError == true)
;
else
;
this.$emit("click", this.index);
},
// 图片加载完成事件,可能是加载占位图时触发,也可能是加载真正的图片完成时触发,通过isShow区分
imgLoaded() {
if (this.loadStatus == "") {
this.loadStatus = "lazyed";
} else if (this.loadStatus == "lazyed") {
this.loadStatus = "loaded";
this.$emit("load", this.index);
}
},
// 错误的图片加载完成
errorImgLoaded() {
this.$emit("error", this.index);
},
// 图片加载失败
loadError() {
this.isError = true;
},
disconnectObserver(observerName) {
const observer = this[observerName];
observer && observer.disconnect();
}
},
beforeUnmount() {
},
mounted() {
this.$nextTick(() => {
uni.$once("uOnReachBottom", () => {
if (!this.isShow)
this.isShow = true;
});
});
setTimeout(() => {
const contentObserver = uni.createIntersectionObserver(this);
contentObserver.relativeToViewport({
bottom: this.getThreshold
}).observe(".u-lazy-item-" + this.elIndex, (res) => {
if (res.intersectionRatio > 0) {
this.isShow = true;
if (!this.image) {
this.loadError();
}
this.disconnectObserver("contentObserver");
}
});
this.contentObserver = contentObserver;
}, 30);
}
};
function _sfc_render$1c(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["u-wrap", "u-lazy-item-" + $data.elIndex]),
style: vue.normalizeStyle({
opacity: Number($data.opacity),
borderRadius: $props.borderRadius + "rpx",
// 因为time值需要改变,所以不直接用duration值(不能改变父组件prop传过来的值)
transition: `opacity ${$data.time / 1e3}s ease-in-out`
})
},
[
vue.createElementVNode(
"view",
{
class: vue.normalizeClass("u-lazy-item-" + $data.elIndex)
},
[
!$data.isError ? (vue.openBlock(), vue.createElementBlock("image", {
key: 0,
style: vue.normalizeStyle({ borderRadius: $props.borderRadius + "rpx", height: $options.imgHeight }),
class: "u-lazy-item",
src: $data.isShow ? $props.image : $props.loadingImg,
mode: $props.imgMode,
onLoad: _cache[0] || (_cache[0] = (...args) => $options.imgLoaded && $options.imgLoaded(...args)),
onError: _cache[1] || (_cache[1] = (...args) => $options.loadError && $options.loadError(...args)),
onClick: _cache[2] || (_cache[2] = (...args) => $options.clickImg && $options.clickImg(...args))
}, null, 44, ["src", "mode"])) : (vue.openBlock(), vue.createElementBlock("image", {
key: 1,
style: vue.normalizeStyle({ borderRadius: $props.borderRadius + "rpx", height: $options.imgHeight }),
class: "u-lazy-item error",
src: $props.errorImg,
mode: $props.imgMode,
onLoad: _cache[3] || (_cache[3] = (...args) => $options.errorImgLoaded && $options.errorImgLoaded(...args)),
onClick: _cache[4] || (_cache[4] = (...args) => $options.clickImg && $options.clickImg(...args))
}, null, 44, ["src", "mode"]))
],
2
/* CLASS */
)
],
6
/* CLASS, STYLE */
);
}
const uLazyLoad = /* @__PURE__ */ _export_sfc(_sfc_main$1d, [["render", _sfc_render$1c], ["__scopeId", "data-v-8b9e8d2e"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-lazy-load/u-lazy-load.vue"]]);
const __vite_glob_0_53 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uLazyLoad
}, Symbol.toStringTag, { value: "Module" }));
const props$K = defineMixin({
props: {
// 激活部分的颜色
activeColor: {
type: String,
default: () => props$1x.lineProgress.activeColor
},
inactiveColor: {
type: String,
default: () => props$1x.lineProgress.color
},
// 进度百分比,数值
percentage: {
type: [String, Number],
default: () => props$1x.lineProgress.inactiveColor
},
// 是否在进度条内部显示百分比的值
showText: {
type: Boolean,
default: () => props$1x.lineProgress.showText
},
// 进度条的高度,单位px
height: {
type: [String, Number],
default: () => props$1x.lineProgress.height
},
// 是否从右往左加载
fromRight: {
type: Boolean,
default: () => props$1x.lineProgress.fromRight
}
}
});
const _sfc_main$1c = {
name: "u-line-progress",
mixins: [mpMixin, mixin, props$K],
data() {
return {
lineWidth: 0
};
},
watch: {
percentage(n2) {
this.resizeProgressWidth();
}
},
computed: {
progressStyle() {
let style = {};
style.width = this.lineWidth;
style.backgroundColor = this.activeColor;
style.height = addUnit(this.height);
if (this.fromRight) {
style.right = 0;
} else {
style.left = 0;
}
return style;
},
innserPercentage() {
return range$1(0, 100, this.percentage);
}
},
mounted() {
this.init();
},
methods: {
addStyle,
addUnit,
init() {
sleep(20).then(() => {
this.resizeProgressWidth();
});
},
getProgressWidth() {
return this.$uGetRect(".u-line-progress__background");
},
resizeProgressWidth() {
this.getProgressWidth().then((size) => {
const {
width
} = size;
this.lineWidth = width * this.innserPercentage / 100 + "px";
});
}
}
};
function _sfc_render$1b(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: "u-line-progress",
style: vue.normalizeStyle([$options.addStyle(_ctx.customStyle)])
},
[
vue.createElementVNode(
"view",
{
class: "u-line-progress__background",
ref: "u-line-progress__background",
style: vue.normalizeStyle([{
backgroundColor: _ctx.inactiveColor,
height: $options.addUnit(_ctx.height)
}])
},
null,
4
/* STYLE */
),
vue.createElementVNode(
"view",
{
class: "u-line-progress__line",
style: vue.normalizeStyle([$options.progressStyle])
},
[
vue.renderSlot(_ctx.$slots, "default", {}, () => [
_ctx.showText && _ctx.percentage >= 10 ? (vue.openBlock(), vue.createElementBlock(
"text",
{
key: 0,
class: "u-line-progress__text"
},
vue.toDisplayString($options.innserPercentage + "%"),
1
/* TEXT */
)) : vue.createCommentVNode("v-if", true)
], true)
],
4
/* STYLE */
)
],
4
/* STYLE */
);
}
const uLineProgress = /* @__PURE__ */ _export_sfc(_sfc_main$1c, [["render", _sfc_render$1b], ["__scopeId", "data-v-eeee7090"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-line-progress/u-line-progress.vue"]]);
const __vite_glob_0_54 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uLineProgress
}, Symbol.toStringTag, { value: "Module" }));
const props$J = defineMixin({
props: {
// 文字颜色
color: {
type: String,
default: () => props$1x.link.color
},
// 字体大小,单位px
fontSize: {
type: [String, Number],
default: () => props$1x.link.fontSize
},
// 是否显示下划线
underLine: {
type: Boolean,
default: () => props$1x.link.underLine
},
// 要跳转的链接
href: {
type: String,
default: () => props$1x.link.href
},
// 小程序中复制到粘贴板的提示语
mpTips: {
type: String,
default: () => props$1x.link.mpTips
},
// 下划线颜色
lineColor: {
type: String,
default: () => props$1x.link.lineColor
},
// 超链接的问题,不使用slot形式传入,是因为nvue下无法修改颜色
text: {
type: String,
default: () => props$1x.link.text
}
}
});
const _sfc_main$1b = {
name: "u-link",
mixins: [mpMixin, mixin, props$J],
computed: {
linkStyle() {
const style = {
color: this.color,
fontSize: addUnit(this.fontSize),
// line-height设置为比字体大小多2px
lineHeight: addUnit(getPx(this.fontSize) + 2),
textDecoration: this.underLine ? "underline" : "none"
};
return style;
}
},
emits: ["click"],
methods: {
addStyle,
openLink() {
plus.runtime.openURL(this.href);
this.$emit("click");
}
}
};
function _sfc_render$1a(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock(
"text",
{
class: "u-link",
onClick: _cache[0] || (_cache[0] = vue.withModifiers((...args) => $options.openLink && $options.openLink(...args), ["stop"])),
style: vue.normalizeStyle([$options.linkStyle, $options.addStyle(_ctx.customStyle)])
},
vue.toDisplayString(_ctx.text),
5
/* TEXT, STYLE */
);
}
const __easycom_0$2 = /* @__PURE__ */ _export_sfc(_sfc_main$1b, [["render", _sfc_render$1a], ["__scopeId", "data-v-12f6646d"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-link/u-link.vue"]]);
const __vite_glob_0_56 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: __easycom_0$2
}, Symbol.toStringTag, { value: "Module" }));
const props$I = defineMixin({
props: {
// 用于滚动到指定item
anchor: {
type: [String, Number],
default: () => props$1x.listItem.anchor
}
}
});
const _sfc_main$1a = {
name: "u-list-item",
mixins: [mpMixin, mixin, props$I],
data() {
return {
// 节点信息
rect: {},
index: 0,
show: true,
sys: getWindowInfo()
};
},
computed: {},
inject: ["uList"],
watch: {
"uList.innerScrollTop"(n2) {
const preLoadScreen = this.uList.preLoadScreen;
const windowHeight = this.sys.windowHeight;
if (n2 <= windowHeight * preLoadScreen) {
this.parent.updateOffsetFromChild(0);
} else if (this.rect.top <= n2 - windowHeight * preLoadScreen) {
this.parent.updateOffsetFromChild(this.rect.top);
}
}
},
created() {
this.parent = {};
},
mounted() {
this.init();
},
methods: {
init() {
this.updateParentData();
this.index = this.parent.children.indexOf(this);
this.resize();
},
updateParentData() {
this.getParentData("u-list");
},
resize() {
this.queryRect(`u-list-item-${this.anchor}`).then((size) => {
const lastChild = this.parent.children[this.index - 1];
this.rect = size;
const preLoadScreen = this.uList.preLoadScreen;
const windowHeight = this.sys.windowHeight;
if (lastChild) {
this.rect.top = lastChild.rect.top + lastChild.rect.height;
}
if (size.top >= this.uList.innerScrollTop + (1 + preLoadScreen) * windowHeight)
this.show = false;
});
},
// 查询元素尺寸
queryRect(el) {
return new Promise((resolve) => {
this.$uGetRect(`.${el}`).then((size) => {
resolve(size);
});
});
}
}
};
function _sfc_render$19(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock("view", {
class: vue.normalizeClass(["u-list-item", [`u-list-item-${_ctx.anchor}`]]),
ref: `u-list-item-${_ctx.anchor}`,
anchor: `u-list-item-${_ctx.anchor}`
}, [
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
], 10, ["anchor"]);
}
const uListItem = /* @__PURE__ */ _export_sfc(_sfc_main$1a, [["render", _sfc_render$19], ["__scopeId", "data-v-0c3fc59c"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-list-item/u-list-item.vue"]]);
const __vite_glob_0_57 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uListItem
}, Symbol.toStringTag, { value: "Module" }));
const props$H = defineMixin({
props: {
// 控制是否出现滚动条,仅nvue有效
showScrollbar: {
type: Boolean,
default: () => props$1x.list.showScrollbar
},
// 距底部多少时触发scrolltolower事件
lowerThreshold: {
type: [String, Number],
default: () => props$1x.list.lowerThreshold
},
// 距顶部多少时触发scrolltoupper事件,非nvue有效
upperThreshold: {
type: [String, Number],
default: () => props$1x.list.upperThreshold
},
// 设置竖向滚动条位置
scrollTop: {
type: [String, Number],
default: () => props$1x.list.scrollTop
},
// 控制 onscroll 事件触发的频率,仅nvue有效
offsetAccuracy: {
type: [String, Number],
default: () => props$1x.list.offsetAccuracy
},
// 启用 flexbox 布局。开启后,当前节点声明了display: flex就会成为flex container,并作用于其孩子节点,仅微信小程序有效
enableFlex: {
type: Boolean,
default: () => props$1x.list.enableFlex
},
// 是否按分页模式显示List,默认值false
pagingEnabled: {
type: Boolean,
default: () => props$1x.list.pagingEnabled
},
// 是否允许List滚动
scrollable: {
type: Boolean,
default: () => props$1x.list.scrollable
},
// 值应为某子元素id(id不能以数字开头)
scrollIntoView: {
type: String,
default: () => props$1x.list.scrollIntoView
},
// 在设置滚动条位置时使用动画过渡
scrollWithAnimation: {
type: Boolean,
default: () => props$1x.list.scrollWithAnimation
},
// iOS点击顶部状态栏、安卓双击标题栏时,滚动条返回顶部,只对微信小程序有效
enableBackToTop: {
type: Boolean,
default: () => props$1x.list.enableBackToTop
},
// 列表的高度
height: {
type: [String, Number],
default: () => props$1x.list.height
},
// 列表宽度
width: {
type: [String, Number],
default: () => props$1x.list.width
},
// 列表前后预渲染的屏数,1代表一个屏幕的高度,1.5代表1个半屏幕高度
preLoadScreen: {
type: [String, Number],
default: () => props$1x.list.preLoadScreen
},
// 开启自定义下拉刷新
refresherEnabled: {
type: Boolean,
default: () => false
},
// 设置自定义下拉刷新阈值
refresherThreshold: {
type: Number,
default: () => 45
},
// 设置自定义下拉刷新默认样式,支持设置 black,white,none,none 表示不使用默认样式
refresherDefaultStyle: {
type: String,
default: () => "black"
},
// 设置自定义下拉刷新区域背景颜色
refresherBackground: {
type: String,
default: () => "#FFF"
},
// 设置当前下拉刷新状态,true 表示下拉刷新已经被触发,false 表示下拉刷新未被触发
refresherTriggered: {
type: Boolean,
default: () => false
}
}
});
const _sfc_main$19 = {
name: "u-list",
mixins: [mpMixin, mixin, props$H],
watch: {
scrollIntoView(n2) {
this.scrollIntoViewById(n2);
}
},
data() {
return {
// 记录内部滚动的距离
innerScrollTop: 0,
// vue下,scroll-view在上拉加载时的偏移值
offset: 0,
sys: getWindowInfo()
};
},
computed: {
listStyle() {
const style = {};
if (this.width != 0)
style.width = addUnit(this.width);
if (this.height != 0)
style.height = addUnit(this.height);
if (!style.height)
style.height = addUnit(this.sys.windowHeight, "px");
return deepMerge$1(style, addStyle(this.customStyle));
}
},
provide() {
return {
uList: this
};
},
created() {
this.refs = [];
this.children = [];
this.anchors = [];
},
mounted() {
},
emits: [
"scroll",
"scrolltolower",
"scrolltoupper",
"refresherpulling",
"refresherrefresh",
"refresherrestore",
"refresherabort"
],
methods: {
updateOffsetFromChild(top) {
this.offset = top;
},
onScroll(e2) {
let scrollTop = 0;
scrollTop = e2.detail.scrollTop;
this.innerScrollTop = scrollTop;
this.$emit("scroll", scrollTop);
},
scrollIntoViewById(id) {
},
// 滚动到底部触发事件
scrolltolower(e2) {
sleep(30).then(() => {
this.$emit("scrolltolower");
});
},
// 滚动到底部时触发,非nvue有效
scrolltoupper(e2) {
sleep(30).then(() => {
this.$emit("scrolltoupper");
this.offset = 0;
});
},
refresherpulling(e2) {
this.$emit("refresherpulling", e2);
},
refresherrefresh(e2) {
this.$emit("refresherrefresh", e2);
},
refresherrestore(e2) {
this.$emit("refresherrestore", e2);
},
refresherabort(e2) {
this.$emit("refresherabort", e2);
}
}
};
function _sfc_render$18(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock("scroll-view", {
class: "u-list",
"scroll-into-view": _ctx.scrollIntoView,
style: vue.normalizeStyle([$options.listStyle]),
"scroll-y": _ctx.scrollable,
"scroll-top": Number(_ctx.scrollTop),
"lower-threshold": Number(_ctx.lowerThreshold),
"upper-threshold": Number(_ctx.upperThreshold),
"show-scrollbar": _ctx.showScrollbar,
"enable-back-to-top": _ctx.enableBackToTop,
"scroll-with-animation": _ctx.scrollWithAnimation,
onScroll: _cache[0] || (_cache[0] = (...args) => $options.onScroll && $options.onScroll(...args)),
onScrolltolower: _cache[1] || (_cache[1] = (...args) => $options.scrolltolower && $options.scrolltolower(...args)),
onScrolltoupper: _cache[2] || (_cache[2] = (...args) => $options.scrolltoupper && $options.scrolltoupper(...args)),
"refresher-enabled": _ctx.refresherEnabled,
"refresher-threshold": _ctx.refresherThreshold,
"refresher-default-style": _ctx.refresherDefaultStyle,
"refresher-background": _ctx.refresherBackground,
"refresher-triggered": _ctx.refresherTriggered,
onRefresherpulling: _cache[3] || (_cache[3] = (...args) => $options.refresherpulling && $options.refresherpulling(...args)),
onRefresherrefresh: _cache[4] || (_cache[4] = (...args) => $options.refresherrefresh && $options.refresherrefresh(...args)),
onRefresherrestore: _cache[5] || (_cache[5] = (...args) => $options.refresherrestore && $options.refresherrestore(...args)),
onRefresherabort: _cache[6] || (_cache[6] = (...args) => $options.refresherabort && $options.refresherabort(...args)),
"scroll-anchoring": true
}, [
vue.createElementVNode("view", null, [
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
])
], 44, ["scroll-into-view", "scroll-y", "scroll-top", "lower-threshold", "upper-threshold", "show-scrollbar", "enable-back-to-top", "scroll-with-animation", "refresher-enabled", "refresher-threshold", "refresher-default-style", "refresher-background", "refresher-triggered"]);
}
const uList = /* @__PURE__ */ _export_sfc(_sfc_main$19, [["render", _sfc_render$18], ["__scopeId", "data-v-a7e78647"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-list/u-list.vue"]]);
const __vite_glob_0_58 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uList
}, Symbol.toStringTag, { value: "Module" }));
const props$G = defineMixin({
props: {
// 提示内容
loadingText: {
type: [String, Number],
default: () => props$1x.loadingPage.loadingText
},
// 文字上方用于替换loading动画的图片
image: {
type: String,
default: () => props$1x.loadingPage.image
},
// 加载动画的模式,circle-圆形,spinner-花朵形,semicircle-半圆形
loadingMode: {
type: String,
default: () => props$1x.loadingPage.loadingMode
},
// 是否加载中
loading: {
type: Boolean,
default: () => props$1x.loadingPage.loading
},
// 背景色
bgColor: {
type: String,
default: () => props$1x.loadingPage.bgColor
},
// 文字颜色
color: {
type: String,
default: () => props$1x.loadingPage.color
},
// 文字大小
fontSize: {
type: [String, Number],
default: () => props$1x.loadingPage.fontSize
},
// 图标大小
iconSize: {
type: [String, Number],
default: () => props$1x.loadingPage.fontSize
},
// 加载中图标的颜色,只能rgb或者十六进制颜色值
loadingColor: {
type: String,
default: () => props$1x.loadingPage.loadingColor
},
// 层级
zIndex: {
type: [Number],
default: () => props$1x.loadingPage.zIndex
}
}
});
const _sfc_main$18 = {
name: "u-loading-page",
mixins: [mpMixin, mixin, props$G],
data() {
return {};
},
methods: {
addUnit
}
};
function _sfc_render$17(_ctx, _cache, $props, $setup, $data, $options) {
const _component_u_loading_icon = resolveEasycom(vue.resolveDynamicComponent("u-loading-icon"), __easycom_0$e);
const _component_u_transition = resolveEasycom(vue.resolveDynamicComponent("u-transition"), __easycom_2$1);
return vue.openBlock(), vue.createBlock(_component_u_transition, {
show: _ctx.loading,
"custom-style": {
position: "fixed",
top: 0,
left: 0,
right: 0,
bottom: 0,
backgroundColor: _ctx.bgColor,
display: "flex",
zIndex: _ctx.zIndex,
..._ctx.customStyle
}
}, {
default: vue.withCtx(() => [
vue.createElementVNode("view", { class: "u-loading-page" }, [
vue.createElementVNode("view", { class: "u-loading-page__warpper" }, [
vue.createElementVNode("view", { class: "u-loading-page__warpper__loading-icon" }, [
_ctx.image ? (vue.openBlock(), vue.createElementBlock("image", {
key: 0,
src: _ctx.image,
class: "u-loading-page__warpper__loading-icon__img",
mode: "widthFit",
style: vue.normalizeStyle({
width: $options.addUnit(_ctx.iconSize),
height: $options.addUnit(_ctx.iconSize)
})
}, null, 12, ["src"])) : (vue.openBlock(), vue.createBlock(_component_u_loading_icon, {
key: 1,
mode: _ctx.loadingMode,
size: $options.addUnit(_ctx.iconSize),
color: _ctx.loadingColor
}, null, 8, ["mode", "size", "color"]))
]),
vue.renderSlot(_ctx.$slots, "default", {}, () => [
vue.createElementVNode(
"text",
{
class: "u-loading-page__warpper__text",
style: vue.normalizeStyle({
fontSize: $options.addUnit(_ctx.fontSize),
color: _ctx.color
})
},
vue.toDisplayString(_ctx.loadingText),
5
/* TEXT, STYLE */
)
], true)
])
])
]),
_: 3
/* FORWARDED */
}, 8, ["show", "custom-style"]);
}
const uLoadingPage = /* @__PURE__ */ _export_sfc(_sfc_main$18, [["render", _sfc_render$17], ["__scopeId", "data-v-9c9e88a3"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-loading-page/u-loading-page.vue"]]);
const __vite_glob_0_60 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uLoadingPage
}, Symbol.toStringTag, { value: "Module" }));
const props$F = defineMixin({
props: {
// 组件状态,loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
status: {
type: String,
default: () => props$1x.loadmore.status
},
// 组件背景色
bgColor: {
type: String,
default: () => props$1x.loadmore.bgColor
},
// 是否显示加载中的图标
icon: {
type: Boolean,
default: () => props$1x.loadmore.icon
},
// 字体大小
fontSize: {
type: [String, Number],
default: () => props$1x.loadmore.fontSize
},
// 图标大小
iconSize: {
type: [String, Number],
default: () => props$1x.loadmore.iconSize
},
// 字体颜色
color: {
type: String,
default: () => props$1x.loadmore.color
},
// 加载中状态的图标,spinner-花朵状图标,circle-圆圈状,semicircle-半圆
loadingIcon: {
type: String,
default: () => props$1x.loadmore.loadingIcon
},
// 加载前的提示语
loadmoreText: {
type: String,
default: () => props$1x.loadmore.loadmoreText
},
// 加载中提示语
loadingText: {
type: String,
default: () => props$1x.loadmore.loadingText
},
// 没有更多的提示语
nomoreText: {
type: String,
default: () => props$1x.loadmore.nomoreText
},
// 在“没有更多”状态下,是否显示粗点
isDot: {
type: Boolean,
default: () => props$1x.loadmore.isDot
},
// 加载中图标的颜色
iconColor: {
type: String,
default: () => props$1x.loadmore.iconColor
},
// 上边距
marginTop: {
type: [String, Number],
default: () => props$1x.loadmore.marginTop
},
// 下边距
marginBottom: {
type: [String, Number],
default: () => props$1x.loadmore.marginBottom
},
// 高度,单位px
height: {
type: [String, Number],
default: () => props$1x.loadmore.height
},
// 是否显示左边分割线
line: {
type: Boolean,
default: () => props$1x.loadmore.line
},
// 线条颜色
lineColor: {
type: String,
default: () => props$1x.loadmore.lineColor
},
// 是否虚线,true-虚线,false-实线
dashed: {
type: Boolean,
default: () => props$1x.loadmore.dashed
}
}
});
const _sfc_main$17 = {
name: "u-loadmore",
mixins: [mpMixin, mixin, props$F],
data() {
return {
// 粗点
dotText: "●"
};
},
computed: {
// 加载的文字显示的样式
loadTextStyle() {
return {
color: this.color,
fontSize: addUnit(this.fontSize),
lineHeight: addUnit(this.fontSize),
backgroundColor: this.bgColor
};
},
// 显示的提示文字
showText() {
let text = "";
if (this.status == "loadmore")
text = this.loadmoreText;
else if (this.status == "loading")
text = this.loadingText;
else if (this.status == "nomore" && this.isDot)
text = this.dotText;
else
text = this.nomoreText;
return text;
}
},
emits: ["loadmore"],
methods: {
addStyle,
addUnit,
loadMore() {
if (this.status == "loadmore")
this.$emit("loadmore");
}
}
};
function _sfc_render$16(_ctx, _cache, $props, $setup, $data, $options) {
const _component_u_line = resolveEasycom(vue.resolveDynamicComponent("u-line"), __easycom_1$4);
const _component_u_loading_icon = resolveEasycom(vue.resolveDynamicComponent("u-loading-icon"), __easycom_0$e);
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: "u-loadmore",
style: vue.normalizeStyle([
$options.addStyle(_ctx.customStyle),
{
backgroundColor: _ctx.bgColor,
marginBottom: $options.addUnit(_ctx.marginBottom),
marginTop: $options.addUnit(_ctx.marginTop),
height: $options.addUnit(_ctx.height)
}
])
},
[
_ctx.line ? (vue.openBlock(), vue.createBlock(_component_u_line, {
key: 0,
length: "140rpx",
color: _ctx.lineColor,
hairline: false,
dashed: _ctx.dashed
}, null, 8, ["color", "dashed"])) : vue.createCommentVNode("v-if", true),
vue.createCommentVNode(" 加载中和没有更多的状态才显示两边的横线 "),
vue.createElementVNode(
"view",
{
class: vue.normalizeClass([_ctx.status == "loadmore" || _ctx.status == "nomore" ? "u-more" : "", "u-loadmore__content"])
},
[
_ctx.status === "loading" && _ctx.icon ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "u-loadmore__content__icon-wrap"
}, [
vue.createVNode(_component_u_loading_icon, {
color: _ctx.iconColor,
size: _ctx.iconSize,
mode: _ctx.loadingIcon
}, null, 8, ["color", "size", "mode"])
])) : vue.createCommentVNode("v-if", true),
vue.createCommentVNode(" 如果没有更多的状态下,显示内容为dot(粗点),加载特定样式 "),
vue.createElementVNode(
"text",
{
class: vue.normalizeClass(["u-line-1", [_ctx.status == "nomore" && _ctx.isDot == true ? "u-loadmore__content__dot-text" : "u-loadmore__content__text"]]),
style: vue.normalizeStyle([$options.loadTextStyle]),
onClick: _cache[0] || (_cache[0] = (...args) => $options.loadMore && $options.loadMore(...args))
},
vue.toDisplayString($options.showText),
7
/* TEXT, CLASS, STYLE */
)
],
2
/* CLASS */
),
_ctx.line ? (vue.openBlock(), vue.createBlock(_component_u_line, {
key: 1,
length: "140rpx",
color: _ctx.lineColor,
hairline: false,
dashed: _ctx.dashed
}, null, 8, ["color", "dashed"])) : vue.createCommentVNode("v-if", true)
],
4
/* STYLE */
);
}
const __easycom_0$1 = /* @__PURE__ */ _export_sfc(_sfc_main$17, [["render", _sfc_render$16], ["__scopeId", "data-v-4ccc1478"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-loadmore/u-loadmore.vue"]]);
const __vite_glob_0_61 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: __easycom_0$1
}, Symbol.toStringTag, { value: "Module" }));
function e() {
return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
}
var t = { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
function n(e2) {
t = e2;
}
var r = { exec: () => null };
function s(e2, t2 = "") {
let n2 = "string" == typeof e2 ? e2 : e2.source, r2 = { replace: (e3, t3) => {
let s2 = "string" == typeof t3 ? t3 : t3.source;
return s2 = s2.replace(l.caret, "$1"), n2 = n2.replace(e3, s2), r2;
}, getRegex: () => new RegExp(n2, t2) };
return r2;
}
var l = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceTabs: /^\t+/, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] /, listReplaceTask: /^\[[ xX]\] +/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[a-zA-Z0-9\u00C0-\u02AF\u0300-\u036F\u0400-\u04FF\u0500-\u052F\u1E00-\u1EFF]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (e2) => new RegExp(`^( {0,3}${e2})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (e2) => new RegExp(`^ {0,${Math.min(3, e2 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (e2) => new RegExp(`^ {0,${Math.min(3, e2 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (e2) => new RegExp(`^ {0,${Math.min(3, e2 - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (e2) => new RegExp(`^ {0,${Math.min(3, e2 - 1)}}#`), htmlBeginRegex: (e2) => new RegExp(`^ {0,${Math.min(3, e2 - 1)}}<(?:[a-z].*>|!--)`, "i") }, i = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, a = /(?:[*+-]|\d{1,9}[.)])/, o = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, c = s(o).replace(/bull/g, a).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), h = s(o).replace(/bull/g, a).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), p = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, u = /(?!\s*\])(?:\\.|[^\[\]\\])+/, g = s(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", u).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), k = s(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, a).getRegex(), d = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", f = /|$))/, x = s("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", f).replace("tag", d).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), b = s(p).replace("hr", i).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", d).getRegex(), w = { blockquote: s(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", b).getRegex(), code: /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, def: g, fences: /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, hr: i, html: x, lheading: c, list: k, newline: /^(?:[ \t]*(?:\n|$))+/, paragraph: b, table: r, text: /^[^\n]+/ }, m = s("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", i).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", d).getRegex(), y = { ...w, lheading: h, table: m, paragraph: s(p).replace("hr", i).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", m).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", d).getRegex() }, $ = { ...w, html: s(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", f).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: r, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: s(p).replace("hr", i).replace("heading", " *#{1,6} *[^\n]").replace("lheading", c).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, R = /^( {2,}|\\)\n(?!\s*$)/, S = /[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~·!¥……()——《》「」『』【】、;:‘’“”,。、]/u, T = /[\s!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~·!¥……()——《》「」『』【】、;:‘’“”,。、]/, z = /[^a-zA-Z0-9\u4e00-\u9fa5\s!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~·!¥……()——《》「」『』【】、;:‘’“”,。、]/, A = s(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, T).getRegex(), _ = /[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}·!¥……()——《》「」『』【】、;:‘’“”,。、]/, P = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, I = s(P, "u").replace(/punct/g, S).getRegex(), L = s(P, "u").replace(/punct/g, _).getRegex(), B = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", C = s(B, "gu").replace(/notPunctSpace/g, z).replace(/punctSpace/g, T).replace(/punct/g, S).getRegex(), q = s(B, "gu").replace(/notPunctSpace/g, /[a-zA-Z0-9\u4e00-\u9fa5~]/).replace(/punctSpace/g, /[\s!"#$%&'()*+,-./:;<=>?@[\]^_`{|}·!¥……()——《》「」『』【】、;:‘’“”,。、]/).replace(/punct/g, _).getRegex(), E = s("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, z).replace(/punctSpace/g, T).replace(/punct/g, S).getRegex(), v = s(/\\(punct)/, "gu").replace(/punct/g, S).getRegex(), Z = s(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), D = s(f).replace("(?:-->|$)", "-->").getRegex(), M = s("^comment|^[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment", D).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), O = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, Q = s(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", O).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), N = s(/^!?\[(label)\]\[(ref)\]/).replace("label", O).replace("ref", u).getRegex(), j = s(/^!?\[(ref)\](?:\[\])?/).replace("ref", u).getRegex(), G = { _backpedal: r, anyPunctuation: v, autolink: Z, blockSkip: /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g, br: R, code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, del: r, emStrongLDelim: I, emStrongRDelimAst: C, emStrongRDelimUnd: E, escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, link: Q, nolink: j, punctuation: A, reflink: N, reflinkSearch: s("reflink|nolink(?!\\()", "g").replace("reflink", N).replace("nolink", j).getRegex(), tag: M, text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\": ">", '"': """, "'": "'" }, K = (e2) => J[e2];
function V(e2, t2) {
if (t2) {
if (l.escapeTest.test(e2))
return e2.replace(l.escapeReplace, K);
} else if (l.escapeTestNoEncode.test(e2))
return e2.replace(l.escapeReplaceNoEncode, K);
return e2;
}
function Y(e2) {
try {
e2 = encodeURI(e2).replace(l.percentDecode, "%");
} catch {
return null;
}
return e2;
}
function ee(e2, t2) {
var _a2;
let n2 = e2.replace(l.findPipe, (e3, t3, n3) => {
let r3 = false, s2 = t3;
for (; --s2 >= 0 && "\\" === n3[s2]; )
r3 = !r3;
return r3 ? "|" : " |";
}).split(l.splitPipe), r2 = 0;
if (n2[0].trim() || n2.shift(), n2.length > 0 && !((_a2 = n2.at(-1)) == null ? void 0 : _a2.trim()) && n2.pop(), t2)
if (n2.length > t2)
n2.splice(t2);
else
for (; n2.length < t2; )
n2.push("");
for (; r2 < n2.length; r2++)
n2[r2] = n2[r2].trim().replace(l.slashPipe, "|");
return n2;
}
function te(e2, t2, n2) {
let r2 = e2.length;
if (0 === r2)
return "";
let s2 = 0;
for (; s2 < r2; ) {
let l2 = e2.charAt(r2 - s2 - 1);
if (l2 !== t2 || n2) {
if (l2 === t2 || !n2)
break;
s2++;
} else
s2++;
}
return e2.slice(0, r2 - s2);
}
function ne(e2, t2, n2, r2, s2) {
let l2 = t2.href, i2 = t2.title || null, a2 = e2[1].replace(s2.other.outputLinkReplace, "$1");
r2.state.inLink = true;
let o2 = { type: "!" === e2[0].charAt(0) ? "image" : "link", raw: n2, href: l2, title: i2, text: a2, tokens: r2.inlineTokens(a2) };
return r2.state.inLink = false, o2;
}
var re = class {
constructor(e2) {
__publicField(this, "options");
__publicField(this, "rules");
__publicField(this, "lexer");
this.options = e2 || t;
}
space(e2) {
let t2 = this.rules.block.newline.exec(e2);
if (t2 && t2[0].length > 0)
return { type: "space", raw: t2[0] };
}
code(e2) {
let t2 = this.rules.block.code.exec(e2);
if (t2) {
let e3 = t2[0].replace(this.rules.other.codeRemoveIndent, "");
return { type: "code", raw: t2[0], codeBlockStyle: "indented", text: this.options.pedantic ? e3 : te(e3, "\n") };
}
}
fences(e2) {
let t2 = this.rules.block.fences.exec(e2);
if (t2) {
let e3 = t2[0], n2 = function(e4, t3, n3) {
let r2 = e4.match(n3.other.indentCodeCompensation);
if (null === r2)
return t3;
let s2 = r2[1];
return t3.split("\n").map((e5) => {
let t4 = e5.match(n3.other.beginningSpace);
if (null === t4)
return e5;
let [r3] = t4;
return r3.length >= s2.length ? e5.slice(s2.length) : e5;
}).join("\n");
}(e3, t2[3] || "", this.rules);
return { type: "code", raw: e3, lang: t2[2] ? t2[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t2[2], text: n2 };
}
}
heading(e2) {
let t2 = this.rules.block.heading.exec(e2);
if (t2) {
let e3 = t2[2].trim();
if (this.rules.other.endingHash.test(e3)) {
let t3 = te(e3, "#");
(this.options.pedantic || !t3 || this.rules.other.endingSpaceChar.test(t3)) && (e3 = t3.trim());
}
return { type: "heading", raw: t2[0], depth: t2[1].length, text: e3, tokens: this.lexer.inline(e3) };
}
}
hr(e2) {
let t2 = this.rules.block.hr.exec(e2);
if (t2)
return { type: "hr", raw: te(t2[0], "\n") };
}
blockquote(e2) {
let t2 = this.rules.block.blockquote.exec(e2);
if (t2) {
let e3 = te(t2[0], "\n").split("\n"), n2 = "", r2 = "", s2 = [];
for (; e3.length > 0; ) {
let t3, l2 = false, i2 = [];
for (t3 = 0; t3 < e3.length; t3++)
if (this.rules.other.blockquoteStart.test(e3[t3]))
i2.push(e3[t3]), l2 = true;
else {
if (l2)
break;
i2.push(e3[t3]);
}
e3 = e3.slice(t3);
let a2 = i2.join("\n"), o2 = a2.replace(this.rules.other.blockquoteSetextReplace, "\n $1").replace(this.rules.other.blockquoteSetextReplace2, "");
n2 = n2 ? `${n2}
${a2}` : a2, r2 = r2 ? `${r2}
${o2}` : o2;
let c2 = this.lexer.state.top;
if (this.lexer.state.top = true, this.lexer.blockTokens(o2, s2, true), this.lexer.state.top = c2, 0 === e3.length)
break;
let h2 = s2.at(-1);
if ("code" === (h2 == null ? void 0 : h2.type))
break;
if ("blockquote" === (h2 == null ? void 0 : h2.type)) {
let t4 = h2, l3 = t4.raw + "\n" + e3.join("\n"), i3 = this.blockquote(l3);
s2[s2.length - 1] = i3, n2 = n2.substring(0, n2.length - t4.raw.length) + i3.raw, r2 = r2.substring(0, r2.length - t4.text.length) + i3.text;
break;
}
if ("list" !== (h2 == null ? void 0 : h2.type))
;
else {
let t4 = h2, l3 = t4.raw + "\n" + e3.join("\n"), i3 = this.list(l3);
s2[s2.length - 1] = i3, n2 = n2.substring(0, n2.length - h2.raw.length) + i3.raw, r2 = r2.substring(0, r2.length - t4.raw.length) + i3.raw, e3 = l3.substring(s2.at(-1).raw.length).split("\n");
}
}
return { type: "blockquote", raw: n2, tokens: s2, text: r2 };
}
}
list(e2) {
let t2 = this.rules.block.list.exec(e2);
if (t2) {
let n2 = t2[1].trim(), r2 = n2.length > 1, s2 = { type: "list", raw: "", ordered: r2, start: r2 ? +n2.slice(0, -1) : "", loose: false, items: [] };
n2 = r2 ? `\\d{1,9}\\${n2.slice(-1)}` : `\\${n2}`, this.options.pedantic && (n2 = r2 ? n2 : "[*+-]");
let l2 = this.rules.other.listItemRegex(n2), i2 = false;
for (; e2; ) {
let n3 = false, r3 = "", a3 = "";
if (!(t2 = l2.exec(e2)) || this.rules.block.hr.test(e2))
break;
r3 = t2[0], e2 = e2.substring(r3.length);
let o2 = t2[2].split("\n", 1)[0].replace(this.rules.other.listReplaceTabs, (e3) => " ".repeat(3 * e3.length)), c2 = e2.split("\n", 1)[0], h2 = !o2.trim(), p2 = 0;
if (this.options.pedantic ? (p2 = 2, a3 = o2.trimStart()) : h2 ? p2 = t2[1].length + 1 : (p2 = t2[2].search(this.rules.other.nonSpaceChar), p2 = p2 > 4 ? 1 : p2, a3 = o2.slice(p2), p2 += t2[1].length), h2 && this.rules.other.blankLine.test(c2) && (r3 += c2 + "\n", e2 = e2.substring(c2.length + 1), n3 = true), !n3) {
let t3 = this.rules.other.nextBulletRegex(p2), n4 = this.rules.other.hrRegex(p2), s3 = this.rules.other.fencesBeginRegex(p2), l3 = this.rules.other.headingBeginRegex(p2), i3 = this.rules.other.htmlBeginRegex(p2);
for (; e2; ) {
let u3, g3 = e2.split("\n", 1)[0];
if (c2 = g3, this.options.pedantic ? (c2 = c2.replace(this.rules.other.listReplaceNesting, " "), u3 = c2) : u3 = c2.replace(this.rules.other.tabCharGlobal, " "), s3.test(c2) || l3.test(c2) || i3.test(c2) || t3.test(c2) || n4.test(c2))
break;
if (u3.search(this.rules.other.nonSpaceChar) >= p2 || !c2.trim())
a3 += "\n" + u3.slice(p2);
else {
if (h2 || o2.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || s3.test(o2) || l3.test(o2) || n4.test(o2))
break;
a3 += "\n" + c2;
}
!h2 && !c2.trim() && (h2 = true), r3 += g3 + "\n", e2 = e2.substring(g3.length + 1), o2 = u3.slice(p2);
}
}
s2.loose || (i2 ? s2.loose = true : this.rules.other.doubleBlankLine.test(r3) && (i2 = true));
let u2, g2 = null;
this.options.gfm && (g2 = this.rules.other.listIsTask.exec(a3), g2 && (u2 = "[ ] " !== g2[0], a3 = a3.replace(this.rules.other.listReplaceTask, ""))), s2.items.push({ type: "list_item", raw: r3, task: !!g2, checked: u2, loose: false, text: a3, tokens: [] }), s2.raw += r3;
}
let a2 = s2.items.at(-1);
if (!a2)
return;
a2.raw = a2.raw.trimEnd(), a2.text = a2.text.trimEnd(), s2.raw = s2.raw.trimEnd();
for (let e3 = 0; e3 < s2.items.length; e3++)
if (this.lexer.state.top = false, s2.items[e3].tokens = this.lexer.blockTokens(s2.items[e3].text, []), !s2.loose) {
let t3 = s2.items[e3].tokens.filter((e4) => "space" === e4.type), n3 = t3.length > 0 && t3.some((e4) => this.rules.other.anyLine.test(e4.raw));
s2.loose = n3;
}
if (s2.loose)
for (let e3 = 0; e3 < s2.items.length; e3++)
s2.items[e3].loose = true;
return s2;
}
}
html(e2) {
let t2 = this.rules.block.html.exec(e2);
if (t2)
return { type: "html", block: true, raw: t2[0], pre: "pre" === t2[1] || "script" === t2[1] || "style" === t2[1], text: t2[0] };
}
def(e2) {
let t2 = this.rules.block.def.exec(e2);
if (t2) {
let e3 = t2[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), n2 = t2[2] ? t2[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r2 = t2[3] ? t2[3].substring(1, t2[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t2[3];
return { type: "def", tag: e3, raw: t2[0], href: n2, title: r2 };
}
}
table(e2) {
var _a2;
let t2 = this.rules.block.table.exec(e2);
if (!t2 || !this.rules.other.tableDelimiter.test(t2[2]))
return;
let n2 = ee(t2[1]), r2 = t2[2].replace(this.rules.other.tableAlignChars, "").split("|"), s2 = ((_a2 = t2[3]) == null ? void 0 : _a2.trim()) ? t2[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : [], l2 = { type: "table", raw: t2[0], header: [], align: [], rows: [] };
if (n2.length === r2.length) {
for (let e3 of r2)
this.rules.other.tableAlignRight.test(e3) ? l2.align.push("right") : this.rules.other.tableAlignCenter.test(e3) ? l2.align.push("center") : this.rules.other.tableAlignLeft.test(e3) ? l2.align.push("left") : l2.align.push(null);
for (let e3 = 0; e3 < n2.length; e3++)
l2.header.push({ text: n2[e3], tokens: this.lexer.inline(n2[e3]), header: true, align: l2.align[e3] });
for (let e3 of s2)
l2.rows.push(ee(e3, l2.header.length).map((e4, t3) => ({ text: e4, tokens: this.lexer.inline(e4), header: false, align: l2.align[t3] })));
return l2;
}
}
lheading(e2) {
let t2 = this.rules.block.lheading.exec(e2);
if (t2)
return { type: "heading", raw: t2[0], depth: "=" === t2[2].charAt(0) ? 1 : 2, text: t2[1], tokens: this.lexer.inline(t2[1]) };
}
paragraph(e2) {
let t2 = this.rules.block.paragraph.exec(e2);
if (t2) {
let e3 = "\n" === t2[1].charAt(t2[1].length - 1) ? t2[1].slice(0, -1) : t2[1];
return { type: "paragraph", raw: t2[0], text: e3, tokens: this.lexer.inline(e3) };
}
}
text(e2) {
let t2 = this.rules.block.text.exec(e2);
if (t2)
return { type: "text", raw: t2[0], text: t2[0], tokens: this.lexer.inline(t2[0]) };
}
escape(e2) {
let t2 = this.rules.inline.escape.exec(e2);
if (t2)
return { type: "escape", raw: t2[0], text: t2[1] };
}
tag(e2) {
let t2 = this.rules.inline.tag.exec(e2);
if (t2)
return !this.lexer.state.inLink && this.rules.other.startATag.test(t2[0]) ? this.lexer.state.inLink = true : this.lexer.state.inLink && this.rules.other.endATag.test(t2[0]) && (this.lexer.state.inLink = false), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t2[0]) ? this.lexer.state.inRawBlock = true : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t2[0]) && (this.lexer.state.inRawBlock = false), { type: "html", raw: t2[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: false, text: t2[0] };
}
link(e2) {
let t2 = this.rules.inline.link.exec(e2);
if (t2) {
let e3 = t2[2].trim();
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(e3)) {
if (!this.rules.other.endAngleBracket.test(e3))
return;
let t3 = te(e3.slice(0, -1), "\\");
if ((e3.length - t3.length) % 2 == 0)
return;
} else {
let e4 = function(e5, t3) {
if (-1 === e5.indexOf(t3[1]))
return -1;
let n3 = 0;
for (let r3 = 0; r3 < e5.length; r3++)
if ("\\" === e5[r3])
r3++;
else if (e5[r3] === t3[0])
n3++;
else if (e5[r3] === t3[1] && (n3--, n3 < 0))
return r3;
return n3 > 0 ? -2 : -1;
}(t2[2], "()");
if (-2 === e4)
return;
if (e4 > -1) {
let n3 = (0 === t2[0].indexOf("!") ? 5 : 4) + t2[1].length + e4;
t2[2] = t2[2].substring(0, e4), t2[0] = t2[0].substring(0, n3).trim(), t2[3] = "";
}
}
let n2 = t2[2], r2 = "";
if (this.options.pedantic) {
let e4 = this.rules.other.pedanticHrefTitle.exec(n2);
e4 && (n2 = e4[1], r2 = e4[3]);
} else
r2 = t2[3] ? t2[3].slice(1, -1) : "";
return n2 = n2.trim(), this.rules.other.startAngleBracket.test(n2) && (n2 = this.options.pedantic && !this.rules.other.endAngleBracket.test(e3) ? n2.slice(1) : n2.slice(1, -1)), ne(t2, { href: n2 && n2.replace(this.rules.inline.anyPunctuation, "$1"), title: r2 && r2.replace(this.rules.inline.anyPunctuation, "$1") }, t2[0], this.lexer, this.rules);
}
}
reflink(e2, t2) {
let n2;
if ((n2 = this.rules.inline.reflink.exec(e2)) || (n2 = this.rules.inline.nolink.exec(e2))) {
let e3 = t2[(n2[2] || n2[1]).replace(this.rules.other.multipleSpaceGlobal, " ").toLowerCase()];
if (!e3) {
let e4 = n2[0].charAt(0);
return { type: "text", raw: e4, text: e4 };
}
return ne(n2, e3, n2[0], this.lexer, this.rules);
}
}
emStrong(e2, t2, n2 = "") {
let r2 = this.rules.inline.emStrongLDelim.exec(e2);
if (!(!r2 || r2[3] && n2.match(this.rules.other.unicodeAlphaNumeric)) && (!r2[1] && !r2[2] || !n2 || this.rules.inline.punctuation.exec(n2))) {
let n3, s2, l2 = [...r2[0]].length - 1, i2 = l2, a2 = 0, o2 = "*" === r2[0][0] ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
for (o2.lastIndex = 0, t2 = t2.slice(-1 * e2.length + l2); null != (r2 = o2.exec(t2)); ) {
if (n3 = r2[1] || r2[2] || r2[3] || r2[4] || r2[5] || r2[6], !n3)
continue;
if (s2 = [...n3].length, r2[3] || r2[4]) {
i2 += s2;
continue;
}
if ((r2[5] || r2[6]) && l2 % 3 && !((l2 + s2) % 3)) {
a2 += s2;
continue;
}
if (i2 -= s2, i2 > 0)
continue;
s2 = Math.min(s2, s2 + i2 + a2);
let t3 = [...r2[0]][0].length, o3 = e2.slice(0, l2 + r2.index + t3 + s2);
if (Math.min(l2, s2) % 2) {
let e3 = o3.slice(1, -1);
return { type: "em", raw: o3, text: e3, tokens: this.lexer.inlineTokens(e3) };
}
let c2 = o3.slice(2, -2);
return { type: "strong", raw: o3, text: c2, tokens: this.lexer.inlineTokens(c2) };
}
}
}
codespan(e2) {
let t2 = this.rules.inline.code.exec(e2);
if (t2) {
let e3 = t2[2].replace(this.rules.other.newLineCharGlobal, " "), n2 = this.rules.other.nonSpaceChar.test(e3), r2 = this.rules.other.startingSpaceChar.test(e3) && this.rules.other.endingSpaceChar.test(e3);
return n2 && r2 && (e3 = e3.substring(1, e3.length - 1)), { type: "codespan", raw: t2[0], text: e3 };
}
}
br(e2) {
let t2 = this.rules.inline.br.exec(e2);
if (t2)
return { type: "br", raw: t2[0] };
}
del(e2) {
let t2 = this.rules.inline.del.exec(e2);
if (t2)
return { type: "del", raw: t2[0], text: t2[2], tokens: this.lexer.inlineTokens(t2[2]) };
}
autolink(e2) {
let t2 = this.rules.inline.autolink.exec(e2);
if (t2) {
let e3, n2;
return "@" === t2[2] ? (e3 = t2[1], n2 = "mailto:" + e3) : (e3 = t2[1], n2 = e3), { type: "link", raw: t2[0], text: e3, href: n2, tokens: [{ type: "text", raw: e3, text: e3 }] };
}
}
url(e2) {
var _a2;
let t2;
if (t2 = this.rules.inline.url.exec(e2)) {
let e3, n2;
if ("@" === t2[2])
e3 = t2[0], n2 = "mailto:" + e3;
else {
let r2;
do {
r2 = t2[0], t2[0] = ((_a2 = this.rules.inline._backpedal.exec(t2[0])) == null ? void 0 : _a2[0]) ?? "";
} while (r2 !== t2[0]);
e3 = t2[0], n2 = "www." === t2[1] ? "http://" + t2[0] : t2[0];
}
return { type: "link", raw: t2[0], text: e3, href: n2, tokens: [{ type: "text", raw: e3, text: e3 }] };
}
}
inlineText(e2) {
let t2 = this.rules.inline.text.exec(e2);
if (t2) {
let e3 = this.lexer.state.inRawBlock;
return { type: "text", raw: t2[0], text: t2[0], escaped: e3 };
}
}
}, se = class e2 {
constructor(e3) {
__publicField(this, "tokens");
__publicField(this, "options");
__publicField(this, "state");
__publicField(this, "tokenizer");
__publicField(this, "inlineQueue");
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e3 || t, this.options.tokenizer = this.options.tokenizer || new re(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true };
let n2 = { other: l, block: F.normal, inline: U.normal };
this.options.pedantic ? (n2.block = F.pedantic, n2.inline = U.pedantic) : this.options.gfm && (n2.block = F.gfm, this.options.breaks ? n2.inline = U.breaks : n2.inline = U.gfm), this.tokenizer.rules = n2;
}
static get rules() {
return { block: F, inline: U };
}
static lex(t2, n2) {
return new e2(n2).lex(t2);
}
static lexInline(t2, n2) {
return new e2(n2).inlineTokens(t2);
}
lex(e3) {
e3 = e3.replace(l.carriageReturn, "\n"), this.blockTokens(e3, this.tokens);
for (let e4 = 0; e4 < this.inlineQueue.length; e4++) {
let t2 = this.inlineQueue[e4];
this.inlineTokens(t2.src, t2.tokens);
}
return this.inlineQueue = [], this.tokens;
}
blockTokens(e3, t2 = [], n2 = false) {
var _a2, _b, _c;
for (this.options.pedantic && (e3 = e3.replace(l.tabCharGlobal, " ").replace(l.spaceLine, "")); e3; ) {
let r2;
if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.block) == null ? void 0 : _b.some((n3) => !!(r2 = n3.call({ lexer: this }, e3, t2)) && (e3 = e3.substring(r2.raw.length), t2.push(r2), true)))
continue;
if (r2 = this.tokenizer.space(e3)) {
e3 = e3.substring(r2.raw.length);
let n3 = t2.at(-1);
1 === r2.raw.length && void 0 !== n3 ? n3.raw += "\n" : t2.push(r2);
continue;
}
if (r2 = this.tokenizer.code(e3)) {
e3 = e3.substring(r2.raw.length);
let n3 = t2.at(-1);
"paragraph" === (n3 == null ? void 0 : n3.type) || "text" === (n3 == null ? void 0 : n3.type) ? (n3.raw += (n3.raw.endsWith("\n") ? "" : "\n") + r2.raw, n3.text += "\n" + r2.text, this.inlineQueue.at(-1).src = n3.text) : t2.push(r2);
continue;
}
if (r2 = this.tokenizer.fences(e3)) {
e3 = e3.substring(r2.raw.length), t2.push(r2);
continue;
}
if (r2 = this.tokenizer.heading(e3)) {
e3 = e3.substring(r2.raw.length), t2.push(r2);
continue;
}
if (r2 = this.tokenizer.hr(e3)) {
e3 = e3.substring(r2.raw.length), t2.push(r2);
continue;
}
if (r2 = this.tokenizer.blockquote(e3)) {
e3 = e3.substring(r2.raw.length), t2.push(r2);
continue;
}
if (r2 = this.tokenizer.list(e3)) {
e3 = e3.substring(r2.raw.length), t2.push(r2);
continue;
}
if (r2 = this.tokenizer.html(e3)) {
e3 = e3.substring(r2.raw.length), t2.push(r2);
continue;
}
if (r2 = this.tokenizer.def(e3)) {
e3 = e3.substring(r2.raw.length);
let n3 = t2.at(-1);
"paragraph" === (n3 == null ? void 0 : n3.type) || "text" === (n3 == null ? void 0 : n3.type) ? (n3.raw += (n3.raw.endsWith("\n") ? "" : "\n") + r2.raw, n3.text += "\n" + r2.raw, this.inlineQueue.at(-1).src = n3.text) : this.tokens.links[r2.tag] || (this.tokens.links[r2.tag] = { href: r2.href, title: r2.title });
continue;
}
if (r2 = this.tokenizer.table(e3)) {
e3 = e3.substring(r2.raw.length), t2.push(r2);
continue;
}
if (r2 = this.tokenizer.lheading(e3)) {
e3 = e3.substring(r2.raw.length), t2.push(r2);
continue;
}
let s2 = e3;
if ((_c = this.options.extensions) == null ? void 0 : _c.startBlock) {
let t3, n3 = 1 / 0, r3 = e3.slice(1);
this.options.extensions.startBlock.forEach((e4) => {
t3 = e4.call({ lexer: this }, r3), "number" == typeof t3 && t3 >= 0 && (n3 = Math.min(n3, t3));
}), n3 < 1 / 0 && n3 >= 0 && (s2 = e3.substring(0, n3 + 1));
}
if (this.state.top && (r2 = this.tokenizer.paragraph(s2))) {
let l2 = t2.at(-1);
n2 && "paragraph" === (l2 == null ? void 0 : l2.type) ? (l2.raw += (l2.raw.endsWith("\n") ? "" : "\n") + r2.raw, l2.text += "\n" + r2.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = l2.text) : t2.push(r2), n2 = s2.length !== e3.length, e3 = e3.substring(r2.raw.length);
} else if (r2 = this.tokenizer.text(e3)) {
e3 = e3.substring(r2.raw.length);
let n3 = t2.at(-1);
"text" === (n3 == null ? void 0 : n3.type) ? (n3.raw += (n3.raw.endsWith("\n") ? "" : "\n") + r2.raw, n3.text += "\n" + r2.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = n3.text) : t2.push(r2);
} else if (e3) {
let t3 = "Infinite loop on byte: " + e3.charCodeAt(0);
if (this.options.silent) {
formatAppLog("error", "at uni_modules/uview-plus/components/u-markdown/marked.esm.js:7", t3);
break;
}
throw new Error(t3);
}
}
return this.state.top = true, t2;
}
inline(e3, t2 = []) {
return this.inlineQueue.push({ src: e3, tokens: t2 }), t2;
}
inlineTokens(e3, t2 = []) {
var _a2, _b, _c;
let n2 = e3, r2 = null;
if (this.tokens.links) {
let e4 = Object.keys(this.tokens.links);
if (e4.length > 0)
for (; null != (r2 = this.tokenizer.rules.inline.reflinkSearch.exec(n2)); )
e4.includes(r2[0].slice(r2[0].lastIndexOf("[") + 1, -1)) && (n2 = n2.slice(0, r2.index) + "[" + "a".repeat(r2[0].length - 2) + "]" + n2.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
}
for (; null != (r2 = this.tokenizer.rules.inline.anyPunctuation.exec(n2)); )
n2 = n2.slice(0, r2.index) + "++" + n2.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
for (; null != (r2 = this.tokenizer.rules.inline.blockSkip.exec(n2)); )
n2 = n2.slice(0, r2.index) + "[" + "a".repeat(r2[0].length - 2) + "]" + n2.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
let s2 = false, l2 = "";
for (; e3; ) {
let r3;
if (s2 || (l2 = ""), s2 = false, (_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.inline) == null ? void 0 : _b.some((n3) => !!(r3 = n3.call({ lexer: this }, e3, t2)) && (e3 = e3.substring(r3.raw.length), t2.push(r3), true)))
continue;
if (r3 = this.tokenizer.escape(e3)) {
e3 = e3.substring(r3.raw.length), t2.push(r3);
continue;
}
if (r3 = this.tokenizer.tag(e3)) {
e3 = e3.substring(r3.raw.length), t2.push(r3);
continue;
}
if (r3 = this.tokenizer.link(e3)) {
e3 = e3.substring(r3.raw.length), t2.push(r3);
continue;
}
if (r3 = this.tokenizer.reflink(e3, this.tokens.links)) {
e3 = e3.substring(r3.raw.length);
let n3 = t2.at(-1);
"text" === r3.type && "text" === (n3 == null ? void 0 : n3.type) ? (n3.raw += r3.raw, n3.text += r3.text) : t2.push(r3);
continue;
}
if (r3 = this.tokenizer.emStrong(e3, n2, l2)) {
e3 = e3.substring(r3.raw.length), t2.push(r3);
continue;
}
if (r3 = this.tokenizer.codespan(e3)) {
e3 = e3.substring(r3.raw.length), t2.push(r3);
continue;
}
if (r3 = this.tokenizer.br(e3)) {
e3 = e3.substring(r3.raw.length), t2.push(r3);
continue;
}
if (r3 = this.tokenizer.del(e3)) {
e3 = e3.substring(r3.raw.length), t2.push(r3);
continue;
}
if (r3 = this.tokenizer.autolink(e3)) {
e3 = e3.substring(r3.raw.length), t2.push(r3);
continue;
}
if (!this.state.inLink && (r3 = this.tokenizer.url(e3))) {
e3 = e3.substring(r3.raw.length), t2.push(r3);
continue;
}
let i2 = e3;
if ((_c = this.options.extensions) == null ? void 0 : _c.startInline) {
let t3, n3 = 1 / 0, r4 = e3.slice(1);
this.options.extensions.startInline.forEach((e4) => {
t3 = e4.call({ lexer: this }, r4), "number" == typeof t3 && t3 >= 0 && (n3 = Math.min(n3, t3));
}), n3 < 1 / 0 && n3 >= 0 && (i2 = e3.substring(0, n3 + 1));
}
if (r3 = this.tokenizer.inlineText(i2)) {
e3 = e3.substring(r3.raw.length), "_" !== r3.raw.slice(-1) && (l2 = r3.raw.slice(-1)), s2 = true;
let n3 = t2.at(-1);
"text" === (n3 == null ? void 0 : n3.type) ? (n3.raw += r3.raw, n3.text += r3.text) : t2.push(r3);
} else if (e3) {
let t3 = "Infinite loop on byte: " + e3.charCodeAt(0);
if (this.options.silent) {
formatAppLog("error", "at uni_modules/uview-plus/components/u-markdown/marked.esm.js:7", t3);
break;
}
throw new Error(t3);
}
}
return t2;
}
}, le = class {
constructor(e2) {
__publicField(this, "options");
__publicField(this, "parser");
this.options = e2 || t;
}
space(e2) {
return "";
}
code({ text: e2, lang: t2, escaped: n2 }) {
var _a2;
let r2 = (_a2 = (t2 || "").match(l.notSpaceStart)) == null ? void 0 : _a2[0], s2 = e2.replace(l.endingNewline, "") + "\n";
return r2 ? '' + (n2 ? s2 : V(s2, true)) + "
\n" : "" + (n2 ? s2 : V(s2, true)) + "
\n";
}
blockquote({ tokens: e2 }) {
return `
${this.parser.parse(e2)}
`;
}
html({ text: e2 }) {
return e2;
}
heading({ tokens: e2, depth: t2 }) {
return `${this.parser.parseInline(e2)}
`;
}
hr(e2) {
return "
\n";
}
list(e2) {
let t2 = e2.ordered, n2 = e2.start, r2 = "";
for (let t3 = 0; t3 < e2.items.length; t3++) {
let n3 = e2.items[t3];
r2 += this.listitem(n3);
}
let s2 = t2 ? "ol" : "ul";
return "<" + s2 + (t2 && 1 !== n2 ? ' start="' + n2 + '"' : "") + ">\n" + r2 + "" + s2 + ">\n";
}
listitem(e2) {
var _a2;
let t2 = "";
if (e2.task) {
let n2 = this.checkbox({ checked: !!e2.checked });
e2.loose ? "paragraph" === ((_a2 = e2.tokens[0]) == null ? void 0 : _a2.type) ? (e2.tokens[0].text = n2 + " " + e2.tokens[0].text, e2.tokens[0].tokens && e2.tokens[0].tokens.length > 0 && "text" === e2.tokens[0].tokens[0].type && (e2.tokens[0].tokens[0].text = n2 + " " + V(e2.tokens[0].tokens[0].text), e2.tokens[0].tokens[0].escaped = true)) : e2.tokens.unshift({ type: "text", raw: n2 + " ", text: n2 + " ", escaped: true }) : t2 += n2 + " ";
}
return t2 += this.parser.parse(e2.tokens, !!e2.loose), `${t2}
`;
}
checkbox({ checked: e2 }) {
return "';
}
paragraph({ tokens: e2 }) {
return `${this.parser.parseInline(e2)}
`;
}
table(e2) {
let t2 = "", n2 = "";
for (let t3 = 0; t3 < e2.header.length; t3++)
n2 += this.tablecell(e2.header[t3]);
t2 += this.tablerow({ text: n2 });
let r2 = "";
for (let t3 = 0; t3 < e2.rows.length; t3++) {
let s2 = e2.rows[t3];
n2 = "";
for (let e3 = 0; e3 < s2.length; e3++)
n2 += this.tablecell(s2[e3]);
r2 += this.tablerow({ text: n2 });
}
return r2 && (r2 = `${r2}`), "\n\n" + t2 + "\n" + r2 + "
\n";
}
tablerow({ text: e2 }) {
return `
${e2}
`;
}
tablecell(e2) {
let t2 = this.parser.parseInline(e2.tokens), n2 = e2.header ? "th" : "td";
return (e2.align ? `<${n2} align="${e2.align}">` : `<${n2}>`) + t2 + `${n2}>
`;
}
strong({ tokens: e2 }) {
return `${this.parser.parseInline(e2)}`;
}
em({ tokens: e2 }) {
return `${this.parser.parseInline(e2)}`;
}
codespan({ text: e2 }) {
return `${V(e2, true)}`;
}
br(e2) {
return "
";
}
del({ tokens: e2 }) {
return `${this.parser.parseInline(e2)}`;
}
link({ href: e2, title: t2, tokens: n2 }) {
let r2 = this.parser.parseInline(n2), s2 = Y(e2);
if (null === s2)
return r2;
let l2 = '" + r2 + "", l2;
}
image({ href: e2, title: t2, text: n2, tokens: r2 }) {
r2 && (n2 = this.parser.parseInline(r2, this.parser.textRenderer));
let s2 = Y(e2);
if (null === s2)
return V(n2);
let l2 = `
", l2;
}
text(e2) {
return "tokens" in e2 && e2.tokens ? this.parser.parseInline(e2.tokens) : "escaped" in e2 && e2.escaped ? e2.text : V(e2.text);
}
}, ie = class {
strong({ text: e2 }) {
return e2;
}
em({ text: e2 }) {
return e2;
}
codespan({ text: e2 }) {
return e2;
}
del({ text: e2 }) {
return e2;
}
html({ text: e2 }) {
return e2;
}
text({ text: e2 }) {
return e2;
}
link({ text: e2 }) {
return "" + e2;
}
image({ text: e2 }) {
return "" + e2;
}
br() {
return "";
}
}, ae = class e2 {
constructor(e3) {
__publicField(this, "options");
__publicField(this, "renderer");
__publicField(this, "textRenderer");
this.options = e3 || t, this.options.renderer = this.options.renderer || new le(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new ie();
}
static parse(t2, n2) {
return new e2(n2).parse(t2);
}
static parseInline(t2, n2) {
return new e2(n2).parseInline(t2);
}
parse(e3, t2 = true) {
var _a2, _b;
let n2 = "";
for (let r2 = 0; r2 < e3.length; r2++) {
let s2 = e3[r2];
if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[s2.type]) {
let e4 = s2, t3 = this.options.extensions.renderers[e4.type].call({ parser: this }, e4);
if (false !== t3 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(e4.type)) {
n2 += t3 || "";
continue;
}
}
let l2 = s2;
switch (l2.type) {
case "space":
n2 += this.renderer.space(l2);
continue;
case "hr":
n2 += this.renderer.hr(l2);
continue;
case "heading":
n2 += this.renderer.heading(l2);
continue;
case "code":
n2 += this.renderer.code(l2);
continue;
case "table":
n2 += this.renderer.table(l2);
continue;
case "blockquote":
n2 += this.renderer.blockquote(l2);
continue;
case "list":
n2 += this.renderer.list(l2);
continue;
case "html":
n2 += this.renderer.html(l2);
continue;
case "paragraph":
n2 += this.renderer.paragraph(l2);
continue;
case "text": {
let s3 = l2, i2 = this.renderer.text(s3);
for (; r2 + 1 < e3.length && "text" === e3[r2 + 1].type; )
s3 = e3[++r2], i2 += "\n" + this.renderer.text(s3);
n2 += t2 ? this.renderer.paragraph({ type: "paragraph", raw: i2, text: i2, tokens: [{ type: "text", raw: i2, text: i2, escaped: true }] }) : i2;
continue;
}
default: {
let e4 = 'Token with "' + l2.type + '" type was not found.';
if (this.options.silent)
return formatAppLog("error", "at uni_modules/uview-plus/components/u-markdown/marked.esm.js:7", e4), "";
throw new Error(e4);
}
}
}
return n2;
}
parseInline(e3, t2 = this.renderer) {
var _a2, _b;
let n2 = "";
for (let r2 = 0; r2 < e3.length; r2++) {
let s2 = e3[r2];
if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[s2.type]) {
let e4 = this.options.extensions.renderers[s2.type].call({ parser: this }, s2);
if (false !== e4 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(s2.type)) {
n2 += e4 || "";
continue;
}
}
let l2 = s2;
switch (l2.type) {
case "escape":
case "text":
n2 += t2.text(l2);
break;
case "html":
n2 += t2.html(l2);
break;
case "link":
n2 += t2.link(l2);
break;
case "image":
n2 += t2.image(l2);
break;
case "strong":
n2 += t2.strong(l2);
break;
case "em":
n2 += t2.em(l2);
break;
case "codespan":
n2 += t2.codespan(l2);
break;
case "br":
n2 += t2.br(l2);
break;
case "del":
n2 += t2.del(l2);
break;
default: {
let e4 = 'Token with "' + l2.type + '" type was not found.';
if (this.options.silent)
return formatAppLog("error", "at uni_modules/uview-plus/components/u-markdown/marked.esm.js:7", e4), "";
throw new Error(e4);
}
}
}
return n2;
}
}, oe = (_a = class {
constructor(e2) {
__publicField(this, "options");
__publicField(this, "block");
this.options = e2 || t;
}
preprocess(e2) {
return e2;
}
postprocess(e2) {
return e2;
}
processAllTokens(e2) {
return e2;
}
provideLexer() {
return this.block ? se.lex : se.lexInline;
}
provideParser() {
return this.block ? ae.parse : ae.parseInline;
}
}, __publicField(_a, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), _a), ce = class {
constructor(...e2) {
__publicField(this, "defaults", { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null });
__publicField(this, "options", this.setOptions);
__publicField(this, "parse", this.parseMarkdown(true));
__publicField(this, "parseInline", this.parseMarkdown(false));
__publicField(this, "Parser", ae);
__publicField(this, "Renderer", le);
__publicField(this, "TextRenderer", ie);
__publicField(this, "Lexer", se);
__publicField(this, "Tokenizer", re);
__publicField(this, "Hooks", oe);
this.use(...e2);
}
walkTokens(e2, t2) {
var _a2, _b;
let n2 = [];
for (let r2 of e2)
switch (n2 = n2.concat(t2.call(this, r2)), r2.type) {
case "table": {
let e3 = r2;
for (let r3 of e3.header)
n2 = n2.concat(this.walkTokens(r3.tokens, t2));
for (let r3 of e3.rows)
for (let e4 of r3)
n2 = n2.concat(this.walkTokens(e4.tokens, t2));
break;
}
case "list": {
let e3 = r2;
n2 = n2.concat(this.walkTokens(e3.items, t2));
break;
}
default: {
let e3 = r2;
((_b = (_a2 = this.defaults.extensions) == null ? void 0 : _a2.childTokens) == null ? void 0 : _b[e3.type]) ? this.defaults.extensions.childTokens[e3.type].forEach((r3) => {
let s2 = e3[r3].flat(1 / 0);
n2 = n2.concat(this.walkTokens(s2, t2));
}) : e3.tokens && (n2 = n2.concat(this.walkTokens(e3.tokens, t2)));
}
}
return n2;
}
use(...e2) {
let t2 = this.defaults.extensions || { renderers: {}, childTokens: {} };
return e2.forEach((e3) => {
let n2 = { ...e3 };
if (n2.async = this.defaults.async || n2.async || false, e3.extensions && (e3.extensions.forEach((e4) => {
if (!e4.name)
throw new Error("extension name required");
if ("renderer" in e4) {
let n3 = t2.renderers[e4.name];
t2.renderers[e4.name] = n3 ? function(...t3) {
let r2 = e4.renderer.apply(this, t3);
return false === r2 && (r2 = n3.apply(this, t3)), r2;
} : e4.renderer;
}
if ("tokenizer" in e4) {
if (!e4.level || "block" !== e4.level && "inline" !== e4.level)
throw new Error("extension level must be 'block' or 'inline'");
let n3 = t2[e4.level];
n3 ? n3.unshift(e4.tokenizer) : t2[e4.level] = [e4.tokenizer], e4.start && ("block" === e4.level ? t2.startBlock ? t2.startBlock.push(e4.start) : t2.startBlock = [e4.start] : "inline" === e4.level && (t2.startInline ? t2.startInline.push(e4.start) : t2.startInline = [e4.start]));
}
"childTokens" in e4 && e4.childTokens && (t2.childTokens[e4.name] = e4.childTokens);
}), n2.extensions = t2), e3.renderer) {
let t3 = this.defaults.renderer || new le(this.defaults);
for (let n3 in e3.renderer) {
if (!(n3 in t3))
throw new Error(`renderer '${n3}' does not exist`);
if (["options", "parser"].includes(n3))
continue;
let r2 = n3, s2 = e3.renderer[r2], l2 = t3[r2];
t3[r2] = (...e4) => {
let n4 = s2.apply(t3, e4);
return false === n4 && (n4 = l2.apply(t3, e4)), n4 || "";
};
}
n2.renderer = t3;
}
if (e3.tokenizer) {
let t3 = this.defaults.tokenizer || new re(this.defaults);
for (let n3 in e3.tokenizer) {
if (!(n3 in t3))
throw new Error(`tokenizer '${n3}' does not exist`);
if (["options", "rules", "lexer"].includes(n3))
continue;
let r2 = n3, s2 = e3.tokenizer[r2], l2 = t3[r2];
t3[r2] = (...e4) => {
let n4 = s2.apply(t3, e4);
return false === n4 && (n4 = l2.apply(t3, e4)), n4;
};
}
n2.tokenizer = t3;
}
if (e3.hooks) {
let t3 = this.defaults.hooks || new oe();
for (let n3 in e3.hooks) {
if (!(n3 in t3))
throw new Error(`hook '${n3}' does not exist`);
if (["options", "block"].includes(n3))
continue;
let r2 = n3, s2 = e3.hooks[r2], l2 = t3[r2];
oe.passThroughHooks.has(n3) ? t3[r2] = (e4) => {
if (this.defaults.async)
return Promise.resolve(s2.call(t3, e4)).then((e5) => l2.call(t3, e5));
let n4 = s2.call(t3, e4);
return l2.call(t3, n4);
} : t3[r2] = (...e4) => {
let n4 = s2.apply(t3, e4);
return false === n4 && (n4 = l2.apply(t3, e4)), n4;
};
}
n2.hooks = t3;
}
if (e3.walkTokens) {
let t3 = this.defaults.walkTokens, r2 = e3.walkTokens;
n2.walkTokens = function(e4) {
let n3 = [];
return n3.push(r2.call(this, e4)), t3 && (n3 = n3.concat(t3.call(this, e4))), n3;
};
}
this.defaults = { ...this.defaults, ...n2 };
}), this;
}
setOptions(e2) {
return this.defaults = { ...this.defaults, ...e2 }, this;
}
lexer(e2, t2) {
return se.lex(e2, t2 ?? this.defaults);
}
parser(e2, t2) {
return ae.parse(e2, t2 ?? this.defaults);
}
parseMarkdown(e2) {
return (t2, n2) => {
let r2 = { ...n2 }, s2 = { ...this.defaults, ...r2 }, l2 = this.onError(!!s2.silent, !!s2.async);
if (true === this.defaults.async && false === r2.async)
return l2(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
if (typeof t2 > "u" || null === t2)
return l2(new Error("marked(): input parameter is undefined or null"));
if ("string" != typeof t2)
return l2(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(t2) + ", string expected"));
s2.hooks && (s2.hooks.options = s2, s2.hooks.block = e2);
let i2 = s2.hooks ? s2.hooks.provideLexer() : e2 ? se.lex : se.lexInline, a2 = s2.hooks ? s2.hooks.provideParser() : e2 ? ae.parse : ae.parseInline;
if (s2.async)
return Promise.resolve(s2.hooks ? s2.hooks.preprocess(t2) : t2).then((e3) => i2(e3, s2)).then((e3) => s2.hooks ? s2.hooks.processAllTokens(e3) : e3).then((e3) => s2.walkTokens ? Promise.all(this.walkTokens(e3, s2.walkTokens)).then(() => e3) : e3).then((e3) => a2(e3, s2)).then((e3) => s2.hooks ? s2.hooks.postprocess(e3) : e3).catch(l2);
try {
s2.hooks && (t2 = s2.hooks.preprocess(t2));
let e3 = i2(t2, s2);
s2.hooks && (e3 = s2.hooks.processAllTokens(e3)), s2.walkTokens && this.walkTokens(e3, s2.walkTokens);
let n3 = a2(e3, s2);
return s2.hooks && (n3 = s2.hooks.postprocess(n3)), n3;
} catch (e3) {
return l2(e3);
}
};
}
onError(e2, t2) {
return (n2) => {
if (n2.message += "\nPlease report this to https://github.com/markedjs/marked.", e2) {
let e3 = "An error occurred:
" + V(n2.message + "", true) + "
";
return t2 ? Promise.resolve(e3) : e3;
}
if (t2)
return Promise.reject(n2);
throw n2;
};
}
}, he = new ce();
function pe(e2, t2) {
return he.parse(e2, t2);
}
pe.options = pe.setOptions = function(e2) {
return he.setOptions(e2), pe.defaults = he.defaults, n(pe.defaults), pe;
}, pe.getDefaults = e, pe.defaults = t, pe.use = function(...e2) {
return he.use(...e2), pe.defaults = he.defaults, n(pe.defaults), pe;
}, pe.walkTokens = function(e2, t2) {
return he.walkTokens(e2, t2);
}, pe.parseInline = he.parseInline, pe.Parser = ae, pe.parser = ae.parse, pe.Renderer = le, pe.TextRenderer = ie, pe.Lexer = se, pe.lexer = se.lex, pe.Tokenizer = re, pe.Hooks = oe, pe.parse = pe;
pe.options;
pe.setOptions;
pe.use;
pe.walkTokens;
pe.parseInline;
ae.parse;
se.lex;
const _sfc_main$16 = {
name: "up-markdown",
props: {
// markdown内容
content: {
type: String,
default: ""
},
// 是否启用图片预览
previewImg: {
type: Boolean,
default: true
},
// 是否显示代码块行号
showLineNumber: {
type: Boolean,
default: false
},
// 主题样式 'light' | 'dark'
theme: {
type: String,
default: "light"
}
},
data() {
return {
parsedContent: ""
};
},
watch: {
content: {
handler(newVal) {
this.parseMarkdown(newVal);
},
immediate: true
}
},
methods: {
// 解析markdown内容
parseMarkdown(content) {
if (!content) {
this.parsedContent = "";
return;
}
let parsed = pe(content);
parsed = this.handleCodeBlock(parsed);
parsed = this.applyTheme(parsed);
this.parsedContent = parsed;
},
// 处理代码块
handleCodeBlock(html) {
return html.replace(/]*)>([^<]+)<\/code><\/pre>/g, (match, lang, code2) => {
const language = lang.match(/class="language-([^"]+)"/);
const langClass = language ? `language-${language[1]}` : "";
let result = ``;
if (this.showLineNumber) {
const lines = code2.split("\n").filter((line) => line.trim() !== "");
result += '';
lines.push("");
lines.forEach((_2, index2) => {
result += `${index2 + 1}`;
});
result += "";
}
result += `${code2}`;
return result;
});
},
// 应用主题样式
applyTheme(html) {
return html;
}
}
};
function _sfc_render$15(_ctx, _cache, $props, $setup, $data, $options) {
const _component_up_parse = vue.resolveComponent("up-parse");
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["up-markdown", $props.theme])
},
[
vue.createVNode(_component_up_parse, {
content: $data.parsedContent,
previewImg: $props.previewImg
}, null, 8, ["content", "previewImg"])
],
2
/* CLASS */
);
}
const uMarkdown = /* @__PURE__ */ _export_sfc(_sfc_main$16, [["render", _sfc_render$15], ["__scopeId", "data-v-9f53166f"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-markdown/u-markdown.vue"]]);
const __vite_glob_0_62 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uMarkdown
}, Symbol.toStringTag, { value: "Module" }));
const _sfc_main$15 = {
name: "u-message-input",
props: {
// 最大输入长度
maxlength: {
type: [Number, String],
default: 4
},
// 是否用圆点填充
dotFill: {
type: Boolean,
default: false
},
// 显示模式,box-盒子模式,bottomLine-横线在底部模式,middleLine-横线在中部模式
mode: {
type: String,
default: "box"
},
// 预置值
modelValue: {
type: [String, Number],
default: ""
},
// 当前激活输入item,是否带有呼吸效果
breathe: {
type: Boolean,
default: true
},
// 是否自动获取焦点
focus: {
type: Boolean,
default: false
},
// 字体是否加粗
bold: {
type: Boolean,
default: false
},
// 字体大小
fontSize: {
type: [String, Number],
default: 60
},
// 激活样式
activeColor: {
type: String,
default: "#2979ff"
},
// 未激活的样式
inactiveColor: {
type: String,
default: "#606266"
},
// 输入框的大小,单位rpx,宽等于高
width: {
type: [Number, String],
default: "80"
},
// 是否隐藏原生键盘,如果想用自定义键盘的话,需设置此参数为true
disabledKeyboard: {
type: Boolean,
default: false
}
},
watch: {
// maxlength: {
// // 此值设置为true,会在组件加载后无需maxlength变化就会执行一次本监听函数,无需再created生命周期中处理
// immediate: true,
// handler(val) {
// this.maxlength = Number(val);
// }
// },
modelValue: {
immediate: true,
handler(val) {
val = String(val);
this.valueModel = val.substring(0, this.maxlength);
}
}
},
data() {
return {
valueModel: ""
};
},
emits: ["change", "finish"],
computed: {
// 是否显示呼吸灯效果
animationClass() {
return (index2) => {
if (this.breathe && this.charArr.length == index2)
return "u-breathe";
else
return "";
};
},
// 用于显示字符
charArr() {
return this.valueModel.split("");
},
charArrLength() {
return this.charArr.length;
},
// 根据长度,循环输入框的个数,因为头条小程序数值不能用于v-for
loopCharArr() {
return new Array(this.maxlength);
}
},
methods: {
getVal(e2) {
let {
value: value2
} = e2.detail;
this.valueModel = value2;
if (String(value2).length > this.maxlength)
return;
this.$emit("change", value2);
if (String(value2).length == this.maxlength) {
this.$emit("finish", value2);
}
}
}
};
function _sfc_render$14(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock("view", { class: "u-char-box" }, [
vue.createElementVNode("view", { class: "u-char-flex" }, [
vue.createElementVNode("input", {
disabled: $props.disabledKeyboard,
value: $data.valueModel,
type: "number",
focus: $props.focus,
maxlength: $props.maxlength,
class: "u-input",
onInput: _cache[0] || (_cache[0] = (...args) => $options.getVal && $options.getVal(...args))
}, null, 40, ["disabled", "value", "focus", "maxlength"]),
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($options.loopCharArr, (item, index2) => {
return vue.openBlock(), vue.createElementBlock("view", { key: index2 }, [
vue.createElementVNode(
"view",
{
class: vue.normalizeClass([
$props.breathe && $options.charArrLength == index2 ? "u-breathe" : "",
"u-char-item",
$options.charArrLength === index2 && $props.mode == "box" ? "u-box-active" : "",
$props.mode === "box" ? "u-box" : ""
]),
style: vue.normalizeStyle({
fontWeight: $props.bold ? "bold" : "normal",
fontSize: $props.fontSize + "rpx",
width: $props.width + "rpx",
height: $props.width + "rpx",
color: $props.inactiveColor,
borderColor: $options.charArrLength === index2 && $props.mode == "box" ? $props.activeColor : $props.inactiveColor
})
},
[
$props.mode !== "middleLine" ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: "u-placeholder-line",
style: vue.normalizeStyle({
display: $options.charArrLength === index2 ? "block" : "none",
height: $props.width * 0.5 + "rpx"
})
},
null,
4
/* STYLE */
)) : vue.createCommentVNode("v-if", true),
$props.mode === "middleLine" && $options.charArrLength <= index2 ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 1,
class: vue.normalizeClass([[$props.breathe && $options.charArrLength == index2 ? "u-breathe" : "", $options.charArrLength === index2 ? "u-middle-line-active" : ""], "u-middle-line"]),
style: vue.normalizeStyle({ height: $props.bold ? "4px" : "2px", background: $options.charArrLength === index2 ? $props.activeColor : $props.inactiveColor })
},
null,
6
/* CLASS, STYLE */
)) : vue.createCommentVNode("v-if", true),
$props.mode === "bottomLine" ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 2,
class: vue.normalizeClass([[$props.breathe && $options.charArrLength == index2 ? "u-breathe" : "", $options.charArrLength === index2 ? "u-bottom-line-active" : ""], "u-bottom-line"]),
style: vue.normalizeStyle({ height: $props.bold ? "4px" : "2px", background: $options.charArrLength === index2 ? $props.activeColor : $props.inactiveColor })
},
null,
6
/* CLASS, STYLE */
)) : vue.createCommentVNode("v-if", true),
!$props.dotFill ? (vue.openBlock(), vue.createElementBlock(
vue.Fragment,
{ key: 3 },
[
vue.createTextVNode(
vue.toDisplayString($options.charArr[index2] ? $options.charArr[index2] : ""),
1
/* TEXT */
)
],
64
/* STABLE_FRAGMENT */
)) : (vue.openBlock(), vue.createElementBlock(
"text",
{
key: 4,
class: "u-dot"
},
vue.toDisplayString($options.charArr[index2] ? "●" : ""),
1
/* TEXT */
))
],
6
/* CLASS, STYLE */
)
]);
}),
128
/* KEYED_FRAGMENT */
))
])
]);
}
const uMessageInput = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["render", _sfc_render$14], ["__scopeId", "data-v-bf0cf2ff"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-message-input/u-message-input.vue"]]);
const __vite_glob_0_63 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uMessageInput
}, Symbol.toStringTag, { value: "Module" }));
const props$E = defineMixin({
props: {
// 是否展示modal
show: {
type: Boolean,
default: () => props$1x.modal.show
},
// 标题
title: {
type: [String],
default: () => props$1x.modal.title
},
// 弹窗内容
content: {
type: String,
default: () => props$1x.modal.content
},
// 确认文案
confirmText: {
type: String,
default: () => props$1x.modal.confirmText
},
// 取消文案
cancelText: {
type: String,
default: () => props$1x.modal.cancelText
},
// 是否显示确认按钮
showConfirmButton: {
type: Boolean,
default: () => props$1x.modal.showConfirmButton
},
// 是否显示取消按钮
showCancelButton: {
type: Boolean,
default: () => props$1x.modal.showCancelButton
},
// 确认按钮颜色
confirmColor: {
type: String,
default: () => props$1x.modal.confirmColor
},
// 取消文字颜色
cancelColor: {
type: String,
default: () => props$1x.modal.cancelColor
},
// 对调确认和取消的位置
buttonReverse: {
type: Boolean,
default: () => props$1x.modal.buttonReverse
},
// 是否开启缩放效果
zoom: {
type: Boolean,
default: () => props$1x.modal.zoom
},
// 是否异步关闭,只对确定按钮有效
asyncClose: {
type: Boolean,
default: () => props$1x.modal.asyncClose
},
// 是否允许点击遮罩关闭modal
closeOnClickOverlay: {
type: Boolean,
default: () => props$1x.modal.closeOnClickOverlay
},
// 给一个负的margin-top,往上偏移,避免和键盘重合的情况
negativeTop: {
type: [String, Number],
default: () => props$1x.modal.negativeTop
},
// modal宽度,不支持百分比,可以数值,px,rpx单位
width: {
type: [String, Number],
default: () => props$1x.modal.width
},
// 确认按钮的样式,circle-圆形,square-方形,如设置,将不会显示取消按钮
confirmButtonShape: {
type: String,
default: () => props$1x.modal.confirmButtonShape
},
// 弹窗动画过度时间
duration: {
type: [Number],
default: props$1x.modal.duration
},
// 文案对齐方式
contentTextAlign: {
type: String,
default: () => props$1x.modal.contentTextAlign
},
// 异步确定时如果点击了取消时候的提示文案
asyncCloseTip: {
type: String,
default: () => props$1x.modal.asyncCloseTip
},
// 是否异步关闭,只对取消按钮有效
asyncCancelClose: {
type: Boolean,
default: () => props$1x.modal.asyncCancelClose
},
// 内容样式
contentStyle: {
type: Object,
default: () => props$1x.modal.contentStyle
}
}
});
const _sfc_main$14 = {
name: "u-modal",
mixins: [mpMixin, mixin, props$E],
data() {
return {
loading: false
};
},
watch: {
show(n2) {
if (n2 && this.loading)
this.loading = false;
}
},
emits: ["confirm", "cancel", "close", "update:show", "cancelOnAsync"],
computed: {
contentStyleCpu() {
let style = this.contentStyle;
style.paddingTop = `${this.title ? 12 : 25}px`;
return style;
}
},
methods: {
addUnit,
// 点击确定按钮
confirmHandler() {
if (this.asyncClose) {
this.loading = true;
} else {
this.$emit("update:show", false);
}
this.$emit("confirm");
},
// 点击取消按钮
cancelHandler() {
if (this.asyncClose && this.loading) {
if (this.asyncCloseTip) {
uni.showToast({
title: this.asyncCloseTip,
icon: "none"
});
}
this.$emit("cancelOnAsync");
} else {
if (!this.asyncCancelClose) {
this.$emit("update:show", false);
}
}
this.$emit("cancel");
},
// 点击遮罩
// 从原理上来说,modal的遮罩点击,并不是真的点击到了遮罩
// 因为modal依赖于popup的中部弹窗类型,中部弹窗比较特殊,虽有然遮罩,但是为了让弹窗内容能flex居中
// 多了一个透明的遮罩,此透明的遮罩会覆盖在灰色的遮罩上,所以实际上是点击不到灰色遮罩的,popup内部在
// 透明遮罩的子元素做了.stop处理,所以点击内容区,也不会导致误触发
clickHandler() {
if (this.closeOnClickOverlay) {
this.$emit("update:show", false);
this.$emit("close");
}
}
}
};
function _sfc_render$13(_ctx, _cache, $props, $setup, $data, $options) {
const _component_u_line = resolveEasycom(vue.resolveDynamicComponent("u-line"), __easycom_1$4);
const _component_u_loading_icon = resolveEasycom(vue.resolveDynamicComponent("u-loading-icon"), __easycom_0$e);
const _component_u_popup = resolveEasycom(vue.resolveDynamicComponent("u-popup"), __easycom_2);
return vue.openBlock(), vue.createBlock(_component_u_popup, {
mode: "center",
zoom: _ctx.zoom,
show: _ctx.show,
class: vue.normalizeClass([_ctx.customClass]),
customStyle: {
borderRadius: "6px",
overflow: "hidden",
marginTop: `-${$options.addUnit(_ctx.negativeTop)}`
},
closeOnClickOverlay: _ctx.closeOnClickOverlay,
safeAreaInsetBottom: false,
duration: _ctx.duration,
onClick: $options.clickHandler
}, {
bottom: vue.withCtx(() => [
vue.renderSlot(_ctx.$slots, "popupBottom", {}, void 0, true)
]),
default: vue.withCtx(() => [
vue.createElementVNode(
"view",
{
class: "u-modal",
style: vue.normalizeStyle({
width: $options.addUnit(_ctx.width)
})
},
[
_ctx.title ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: "u-modal__title"
},
vue.toDisplayString(_ctx.title),
1
/* TEXT */
)) : vue.createCommentVNode("v-if", true),
vue.createElementVNode(
"view",
{
class: "u-modal__content",
style: vue.normalizeStyle($options.contentStyleCpu)
},
[
vue.renderSlot(_ctx.$slots, "default", {}, () => [
vue.createElementVNode(
"text",
{
class: "u-modal__content__text",
style: vue.normalizeStyle({ textAlign: _ctx.contentTextAlign })
},
vue.toDisplayString(_ctx.content),
5
/* TEXT, STYLE */
)
], true)
],
4
/* STYLE */
),
_ctx.$slots.confirmButton ? (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "u-modal__button-group--confirm-button"
}, [
vue.renderSlot(_ctx.$slots, "confirmButton", {}, void 0, true)
])) : (vue.openBlock(), vue.createElementBlock(
vue.Fragment,
{ key: 2 },
[
vue.createVNode(_component_u_line),
vue.createElementVNode(
"view",
{
class: "u-modal__button-group",
style: vue.normalizeStyle({
flexDirection: _ctx.buttonReverse ? "row-reverse" : "row"
})
},
[
_ctx.showCancelButton ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: vue.normalizeClass(["u-modal__button-group__wrapper u-modal__button-group__wrapper--cancel", [_ctx.showCancelButton && !_ctx.showConfirmButton && "u-modal__button-group__wrapper--only-cancel"]]),
"hover-stay-time": 150,
"hover-class": "u-modal__button-group__wrapper--hover",
onClick: _cache[0] || (_cache[0] = (...args) => $options.cancelHandler && $options.cancelHandler(...args))
},
[
vue.createElementVNode(
"text",
{
class: "u-modal__button-group__wrapper__text",
style: vue.normalizeStyle({
color: _ctx.cancelColor
})
},
vue.toDisplayString(_ctx.cancelText),
5
/* TEXT, STYLE */
)
],
2
/* CLASS */
)) : vue.createCommentVNode("v-if", true),
_ctx.showConfirmButton && _ctx.showCancelButton ? (vue.openBlock(), vue.createBlock(_component_u_line, {
key: 1,
direction: "column"
})) : vue.createCommentVNode("v-if", true),
_ctx.showConfirmButton ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 2,
class: vue.normalizeClass(["u-modal__button-group__wrapper u-modal__button-group__wrapper--confirm", [!_ctx.showCancelButton && _ctx.showConfirmButton && "u-modal__button-group__wrapper--only-confirm"]]),
"hover-stay-time": 150,
"hover-class": "u-modal__button-group__wrapper--hover",
onClick: _cache[1] || (_cache[1] = (...args) => $options.confirmHandler && $options.confirmHandler(...args))
},
[
$data.loading ? (vue.openBlock(), vue.createBlock(_component_u_loading_icon, { key: 0 })) : (vue.openBlock(), vue.createElementBlock(
"text",
{
key: 1,
class: "u-modal__button-group__wrapper__text",
style: vue.normalizeStyle({
color: _ctx.confirmColor
})
},
vue.toDisplayString(_ctx.confirmText),
5
/* TEXT, STYLE */
))
],
2
/* CLASS */
)) : vue.createCommentVNode("v-if", true)
],
4
/* STYLE */
)
],
64
/* STABLE_FRAGMENT */
))
],
4
/* STYLE */
)
]),
_: 3
/* FORWARDED */
}, 8, ["zoom", "show", "class", "customStyle", "closeOnClickOverlay", "duration", "onClick"]);
}
const uModal = /* @__PURE__ */ _export_sfc(_sfc_main$14, [["render", _sfc_render$13], ["__scopeId", "data-v-f667648f"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-modal/u-modal.vue"]]);
const __vite_glob_0_64 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uModal
}, Symbol.toStringTag, { value: "Module" }));
const props$D = defineMixin({
props: {
// 是否开启顶部安全区适配
safeAreaInsetTop: {
type: Boolean,
default: () => true
},
// 是否固定在顶部
fixed: {
type: Boolean,
default: () => true
},
// 左边的图标
leftIcon: {
type: String,
default: "arrow-leftward"
},
// 背景颜色
bgColor: {
type: String,
default: () => "rgba(0,0,0,.15)"
},
// 导航栏高度
height: {
type: [String, Number],
default: () => "32px"
},
// 图标的大小
iconSize: {
type: [String, Number],
default: "20px"
},
// 图标的颜色
iconColor: {
type: String,
default: "#fff"
},
// 点击左侧区域(返回图标),是否自动返回上一页
autoBack: {
type: Boolean,
default: () => true
},
// 首页路径
homeUrl: {
type: [String],
default: ""
}
}
});
const _sfc_main$13 = {
name: "u-navbar-mini",
mixins: [mpMixin, mixin, props$D],
data() {
return {};
},
emits: ["leftClick", "homeClick"],
created() {
},
methods: {
addStyle,
addUnit,
sys,
getPx,
// 点击左侧区域
leftClick() {
this.$emit("leftClick");
if (this.autoBack) {
uni.navigateBack();
}
},
homeClick() {
if (this.homeUrl) {
uni.reLaunch({ url: this.homeUrl });
}
}
}
};
function _sfc_render$12(_ctx, _cache, $props, $setup, $data, $options) {
const _component_u_status_bar = resolveEasycom(vue.resolveDynamicComponent("u-status-bar"), __easycom_0$c);
const _component_up_icon = vue.resolveComponent("up-icon");
const _component_up_line = vue.resolveComponent("up-line");
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["u-navbar-mini", [_ctx.customClass]])
},
[
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["u-navbar-mini__inner", [_ctx.fixed && "u-navbar-mini--fixed"]])
},
[
_ctx.safeAreaInsetTop ? (vue.openBlock(), vue.createBlock(_component_u_status_bar, { key: 0 })) : vue.createCommentVNode("v-if", true),
vue.createElementVNode(
"view",
{
class: "u-navbar-mini__content",
style: vue.normalizeStyle({
height: $options.addUnit(_ctx.height),
backgroundColor: _ctx.bgColor
})
},
[
vue.createElementVNode("view", {
class: "u-navbar-mini__content__left",
"hover-class": "u-navbar-mini__content__left--hover",
"hover-start-time": "150",
onClick: _cache[0] || (_cache[0] = (...args) => $options.leftClick && $options.leftClick(...args))
}, [
vue.renderSlot(_ctx.$slots, "left", {}, () => [
vue.createVNode(_component_up_icon, {
name: _ctx.leftIcon,
size: _ctx.iconSize,
color: _ctx.iconColor
}, null, 8, ["name", "size", "color"])
], true)
]),
vue.createElementVNode("view", { style: { "padding": "10px 10px" } }, [
vue.createVNode(_component_up_line, {
direction: "col",
color: "#fff",
length: "16px"
})
]),
vue.createElementVNode("view", {
class: "u-navbar-mini__content__center",
onClick: _cache[1] || (_cache[1] = (...args) => $options.homeClick && $options.homeClick(...args))
}, [
vue.renderSlot(_ctx.$slots, "center", {}, () => [
vue.createVNode(_component_up_icon, {
name: "home",
size: _ctx.iconSize,
color: _ctx.iconColor
}, null, 8, ["size", "color"])
], true)
])
],
4
/* STYLE */
)
],
2
/* CLASS */
)
],
2
/* CLASS */
);
}
const uNavbarMini = /* @__PURE__ */ _export_sfc(_sfc_main$13, [["render", _sfc_render$12], ["__scopeId", "data-v-dc7ccfda"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-navbar-mini/u-navbar-mini.vue"]]);
const __vite_glob_0_65 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uNavbarMini
}, Symbol.toStringTag, { value: "Module" }));
const props$C = defineMixin({
props: {
// 是否开启顶部安全区适配
safeAreaInsetTop: {
type: Boolean,
default: () => props$1x.navbar.safeAreaInsetTop
},
// 固定在顶部时,是否生成一个等高元素,以防止塌陷
placeholder: {
type: Boolean,
default: () => props$1x.navbar.placeholder
},
// 是否固定在顶部
fixed: {
type: Boolean,
default: () => props$1x.navbar.fixed
},
// 是否显示下边框
border: {
type: Boolean,
default: () => props$1x.navbar.border
},
// 左边的图标
leftIcon: {
type: String,
default: () => props$1x.navbar.leftIcon
},
// 左边的提示文字
leftText: {
type: String,
default: () => props$1x.navbar.leftText
},
// 左右的提示文字
rightText: {
type: String,
default: () => props$1x.navbar.rightText
},
// 右边的图标
rightIcon: {
type: String,
default: () => props$1x.navbar.rightIcon
},
// 标题
title: {
type: [String, Number],
default: () => props$1x.navbar.title
},
// 标题颜色
titleColor: {
type: String,
default: () => props$1x.navbar.titleColor
},
// 背景颜色
bgColor: {
type: String,
default: () => props$1x.navbar.bgColor
},
// 状态栏背景颜色 不写会使用背景颜色bgColor
statusBarBgColor: {
type: String,
default: () => ""
},
// 标题的宽度
titleWidth: {
type: [String, Number],
default: () => props$1x.navbar.titleWidth
},
// 导航栏高度
height: {
type: [String, Number],
default: () => props$1x.navbar.height
},
// 左侧返回图标的大小
leftIconSize: {
type: [String, Number],
default: () => props$1x.navbar.leftIconSize
},
// 左侧返回图标的颜色
leftIconColor: {
type: String,
default: () => props$1x.navbar.leftIconColor
},
// 点击左侧区域(返回图标),是否自动返回上一页
autoBack: {
type: Boolean,
default: () => props$1x.navbar.autoBack
},
// 标题的样式,对象或字符串
titleStyle: {
type: [String, Object],
default: () => props$1x.navbar.titleStyle
}
}
});
const _sfc_main$12 = {
name: "u-navbar",
mixins: [mpMixin, mixin, props$C],
data() {
return {};
},
emits: ["leftClick", "rightClick"],
methods: {
addStyle,
addUnit,
getWindowInfo,
getPx,
// 点击左侧区域
leftClick() {
this.$emit("leftClick");
if (config$1.interceptor.navbarLeftClick != null) {
config$1.interceptor.navbarLeftClick();
} else {
if (this.autoBack) {
uni.navigateBack();
}
}
},
// 点击右侧区域
rightClick() {
this.$emit("rightClick");
}
}
};
function _sfc_render$11(_ctx, _cache, $props, $setup, $data, $options) {
const _component_u_status_bar = resolveEasycom(vue.resolveDynamicComponent("u-status-bar"), __easycom_0$c);
const _component_up_icon = vue.resolveComponent("up-icon");
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["u-navbar", [_ctx.customClass]])
},
[
_ctx.fixed && _ctx.placeholder ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: "u-navbar__placeholder",
style: vue.normalizeStyle({
height: $options.addUnit($options.getPx(_ctx.height) + $options.getWindowInfo().statusBarHeight, "px")
})
},
null,
4
/* STYLE */
)) : vue.createCommentVNode("v-if", true),
vue.createElementVNode(
"view",
{
class: vue.normalizeClass([_ctx.fixed && "u-navbar--fixed"])
},
[
_ctx.safeAreaInsetTop ? (vue.openBlock(), vue.createBlock(_component_u_status_bar, {
key: 0,
bgColor: _ctx.statusBarBgColor ? _ctx.statusBarBgColor : _ctx.bgColor
}, null, 8, ["bgColor"])) : vue.createCommentVNode("v-if", true),
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["u-navbar__content", [_ctx.border && "u-border-bottom"]]),
style: vue.normalizeStyle({
height: $options.addUnit(_ctx.height),
backgroundColor: _ctx.bgColor
})
},
[
vue.createElementVNode("view", {
class: "u-navbar__content__left",
"hover-class": "u-navbar__content__left--hover",
"hover-start-time": "150",
onClick: _cache[0] || (_cache[0] = (...args) => $options.leftClick && $options.leftClick(...args))
}, [
vue.renderSlot(_ctx.$slots, "left", {}, () => [
_ctx.leftIcon ? (vue.openBlock(), vue.createBlock(_component_up_icon, {
key: 0,
name: _ctx.leftIcon,
size: _ctx.leftIconSize,
color: _ctx.leftIconColor
}, null, 8, ["name", "size", "color"])) : vue.createCommentVNode("v-if", true),
_ctx.leftText ? (vue.openBlock(), vue.createElementBlock(
"text",
{
key: 1,
style: vue.normalizeStyle({
color: _ctx.leftIconColor
}),
class: "u-navbar__content__left__text"
},
vue.toDisplayString(_ctx.leftText),
5
/* TEXT, STYLE */
)) : vue.createCommentVNode("v-if", true)
], true)
]),
vue.renderSlot(_ctx.$slots, "center", {}, () => [
vue.createElementVNode(
"text",
{
class: "u-line-1 u-navbar__content__title",
style: vue.normalizeStyle([{
width: $options.addUnit(_ctx.titleWidth),
color: _ctx.titleColor
}, $options.addStyle(_ctx.titleStyle)])
},
vue.toDisplayString(_ctx.title),
5
/* TEXT, STYLE */
)
], true),
_ctx.$slots.right || _ctx.rightIcon || _ctx.rightText ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "u-navbar__content__right",
onClick: _cache[1] || (_cache[1] = (...args) => $options.rightClick && $options.rightClick(...args))
}, [
vue.renderSlot(_ctx.$slots, "right", {}, () => [
_ctx.rightIcon ? (vue.openBlock(), vue.createBlock(_component_up_icon, {
key: 0,
name: _ctx.rightIcon,
size: "20"
}, null, 8, ["name"])) : vue.createCommentVNode("v-if", true),
_ctx.rightText ? (vue.openBlock(), vue.createElementBlock(
"text",
{
key: 1,
class: "u-navbar__content__right__text"
},
vue.toDisplayString(_ctx.rightText),
1
/* TEXT */
)) : vue.createCommentVNode("v-if", true)
], true)
])) : vue.createCommentVNode("v-if", true)
],
6
/* CLASS, STYLE */
)
],
2
/* CLASS */
)
],
2
/* CLASS */
);
}
const uNavbar = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["render", _sfc_render$11], ["__scopeId", "data-v-f631659b"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-navbar/u-navbar.vue"]]);
const __vite_glob_0_66 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uNavbar
}, Symbol.toStringTag, { value: "Module" }));
const props$B = defineMixin({
props: {
// 页面文字提示
tips: {
type: String,
default: () => props$1x.noNetwork.tips
},
// 一个z-index值,用于设置没有网络这个组件的层次,因为页面可能会有其他定位的元素层级过高,导致此组件被覆盖
zIndex: {
type: [String, Number],
default: () => props$1x.noNetwork.zIndex
},
// image 没有网络的图片提示
image: {
type: String,
default: () => props$1x.noNetwork.image
}
}
});
const _sfc_main$11 = {
name: "u-no-network",
mixins: [mpMixin, mixin, props$B],
data() {
return {
isConnected: true,
// 是否有网络连接
networkType: "none"
// 网络类型
};
},
mounted() {
this.isIOS = getDeviceInfo().platform === "ios";
uni.onNetworkStatusChange((res) => {
this.isConnected = res.isConnected;
this.networkType = res.networkType;
this.emitEvent(this.networkType);
});
uni.getNetworkType({
success: (res) => {
this.networkType = res.networkType;
this.emitEvent(this.networkType);
if (res.networkType == "none") {
this.isConnected = false;
} else {
this.isConnected = true;
}
}
});
},
emits: ["disconnected", "connected"],
methods: {
t: t$1,
retry() {
uni.getNetworkType({
success: (res) => {
this.networkType = res.networkType;
this.emitEvent(this.networkType);
if (res.networkType == "none") {
toast(t$1("up.noNetwork.disconnect"));
this.isConnected = false;
} else {
toast(t$1("up.noNetwork.connect"));
this.isConnected = true;
}
}
});
this.$emit("retry");
},
// 发出事件给父组件
emitEvent(networkType) {
this.$emit(networkType === "none" ? "disconnected" : "connected");
},
async openSettings() {
if (this.networkType == "none") {
this.openSystemSettings();
return;
}
},
openAppSettings() {
this.gotoAppSetting();
},
openSystemSettings() {
if (this.isIOS) {
this.gotoiOSSetting();
} else {
this.gotoAndroidSetting();
}
},
network() {
var result = null;
var cellularData = plus.ios.newObject("CTCellularData");
var state = cellularData.plusGetAttribute("restrictedState");
if (state == 0) {
result = null;
} else if (state == 2) {
result = 1;
} else if (state == 1) {
result = 2;
}
plus.ios.deleteObject(cellularData);
return result;
},
gotoAppSetting() {
if (this.isIOS) {
var UIApplication = plus.ios.import("UIApplication");
var application2 = UIApplication.sharedApplication();
var NSURL2 = plus.ios.import("NSURL");
var setting2 = NSURL2.URLWithString("app-settings:");
application2.openURL(setting2);
plus.ios.deleteObject(setting2);
plus.ios.deleteObject(NSURL2);
plus.ios.deleteObject(application2);
} else {
var Intent = plus.android.importClass("android.content.Intent");
var Settings = plus.android.importClass("android.provider.Settings");
var Uri = plus.android.importClass("android.net.Uri");
var mainActivity = plus.android.runtimeMainActivity();
var intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
intent.setData(uri);
mainActivity.startActivity(intent);
}
},
gotoiOSSetting() {
var UIApplication = plus.ios.import("UIApplication");
var application2 = UIApplication.sharedApplication();
var NSURL2 = plus.ios.import("NSURL");
var setting2 = NSURL2.URLWithString("App-prefs:root=General");
application2.openURL(setting2);
plus.ios.deleteObject(setting2);
plus.ios.deleteObject(NSURL2);
plus.ios.deleteObject(application2);
},
gotoAndroidSetting() {
var Intent = plus.android.importClass("android.content.Intent");
var Settings = plus.android.importClass("android.provider.Settings");
var mainActivity = plus.android.runtimeMainActivity();
var intent = new Intent(Settings.ACTION_SETTINGS);
mainActivity.startActivity(intent);
}
}
};
function _sfc_render$10(_ctx, _cache, $props, $setup, $data, $options) {
const _component_up_icon = vue.resolveComponent("up-icon");
const _component_u_button = resolveEasycom(vue.resolveDynamicComponent("u-button"), __easycom_0$8);
const _component_u_overlay = resolveEasycom(vue.resolveDynamicComponent("u-overlay"), __easycom_0$d);
return vue.openBlock(), vue.createBlock(_component_u_overlay, {
show: !$data.isConnected,
zIndex: _ctx.zIndex,
onTouchmove: vue.withModifiers(_ctx.noop, ["stop", "prevent"]),
customStyle: {
backgroundColor: "#fff",
display: "flex",
justifyContent: "center"
}
}, {
default: vue.withCtx(() => [
vue.createElementVNode("view", { class: "u-no-network" }, [
vue.createVNode(_component_up_icon, {
name: _ctx.image,
size: "150",
imgMode: "widthFit",
class: "u-no-network__error-icon"
}, null, 8, ["name"]),
vue.createElementVNode(
"text",
{ class: "u-no-network__tips" },
vue.toDisplayString(_ctx.tips),
1
/* TEXT */
),
vue.createCommentVNode(" 只有APP平台,才能跳转设置页,因为需要调用plus环境 "),
vue.createElementVNode("view", { class: "u-no-network__app" }, [
vue.createElementVNode(
"text",
{ class: "u-no-network__app__setting" },
vue.toDisplayString($options.t("up.noNetwork.pleaseCheck")),
1
/* TEXT */
),
vue.createElementVNode(
"text",
{
class: "u-no-network__app__to-setting",
onClick: _cache[0] || (_cache[0] = (...args) => $options.openSettings && $options.openSettings(...args))
},
vue.toDisplayString($options.t("up.common.settings")),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "u-no-network__retry" }, [
vue.createVNode(_component_u_button, {
size: "mini",
text: $options.t("up.common.retry"),
type: "primary",
plain: "",
onClick: $options.retry
}, null, 8, ["text", "onClick"])
])
])
]),
_: 1
/* STABLE */
}, 8, ["show", "zIndex", "onTouchmove"]);
}
const uNoNetwork = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["render", _sfc_render$10], ["__scopeId", "data-v-12a0c5bd"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-no-network/u-no-network.vue"]]);
const __vite_glob_0_67 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uNoNetwork
}, Symbol.toStringTag, { value: "Module" }));
const props$A = defineMixin({
props: {
// 显示的内容,字符串
text: {
type: String,
default: () => props$1x.rowNotice.text
},
// 是否显示左侧的音量图标
icon: {
type: String,
default: () => props$1x.rowNotice.icon
},
// 通告模式,link-显示右箭头,closable-显示右侧关闭图标
mode: {
type: String,
default: () => props$1x.rowNotice.mode
},
// 文字颜色,各图标也会使用文字颜色
color: {
type: String,
default: () => props$1x.rowNotice.color
},
// 背景颜色
bgColor: {
type: String,
default: () => props$1x.rowNotice.bgColor
},
// 字体大小,单位px
fontSize: {
type: [String, Number],
default: () => props$1x.rowNotice.fontSize
},
// 水平滚动时的滚动速度,即每秒滚动多少px(rpx),这有利于控制文字无论多少时,都能有一个恒定的速度
speed: {
type: [String, Number],
default: () => props$1x.rowNotice.speed
}
}
});
const _sfc_main$10 = {
name: "u-row-notice",
mixins: [mpMixin, mixin, props$A],
data() {
return {
animationDuration: "0",
// 动画执行时间
animationPlayState: "paused",
// 动画的开始和结束执行
// nvue下,内容发生变化,导致滚动宽度也变化,需要标志为是否需要重新计算宽度
// 不能在内容变化时直接重新计算,因为nvue的animation模块上一次的滚动不是刚好结束,会有影响
nvueInit: true,
show: true
};
},
watch: {
text: {
immediate: true,
handler(newValue, oldValue) {
this.vue();
if (!test.string(newValue)) {
error("noticebar组件direction为row时,要求text参数为字符串形式");
}
}
},
fontSize() {
this.vue();
},
speed() {
this.vue();
}
},
computed: {
// 文字内容的样式
textStyle() {
let style = {};
style.whiteSpace = "nowrap !important";
style.color = this.color;
style.fontSize = addUnit(this.fontSize);
return style;
},
animationStyle() {
let style = {};
style.animationDuration = this.animationDuration;
style.animationPlayState = this.animationPlayState;
return style;
},
// 内部对用户传入的数据进一步分割,放到多个text标签循环,否则如果用户传入的字符串很长(100个字符以上)
// 放在一个text标签中进行滚动,在低端安卓机上,动画可能会出现抖动现象,需要分割到多个text中可解决此问题
innerText() {
let result = [], len = 20;
const textArr = this.text.split("");
for (let i2 = 0; i2 < textArr.length; i2 += len) {
result.push(textArr.slice(i2, i2 + len).join(""));
}
return result;
}
},
mounted() {
var pages2 = getCurrentPages();
var page2 = pages2[pages2.length - 1];
var currentWebview = page2.$getAppWebview();
currentWebview.addEventListener("hide", () => {
this.webviewHide = true;
});
currentWebview.addEventListener("show", () => {
this.webviewHide = false;
});
this.init();
},
emits: ["click", "close"],
methods: {
init() {
this.vue();
if (!test.string(this.text)) {
error("noticebar组件direction为row时,要求text参数为字符串形式");
}
},
// vue版处理
async vue() {
let textWidth = 0;
await sleep();
textWidth = (await this.$uGetRect(".u-notice__content__text")).width;
(await this.$uGetRect(".u-notice__content")).width;
this.animationDuration = `${textWidth / getPx(this.speed)}s`;
this.animationPlayState = "paused";
setTimeout(() => {
this.animationPlayState = "running";
}, 10);
},
// nvue版处理
async nvue() {
},
loopAnimation(textWidth, boxWidth) {
},
getNvueRect(el) {
},
// 点击通告栏
clickHandler(index2) {
this.$emit("click");
},
// 点击右侧按钮,需要判断点击的是关闭图标还是箭头图标
close() {
this.$emit("close");
}
},
beforeUnmount() {
this.stopAnimation = true;
}
};
function _sfc_render$$(_ctx, _cache, $props, $setup, $data, $options) {
const _component_up_icon = vue.resolveComponent("up-icon");
return vue.openBlock(), vue.createElementBlock("view", {
class: "u-notice",
onClick: _cache[0] || (_cache[0] = (...args) => $options.clickHandler && $options.clickHandler(...args))
}, [
vue.renderSlot(_ctx.$slots, "icon", {}, () => [
_ctx.icon ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "u-notice__left-icon"
}, [
vue.createVNode(_component_up_icon, {
name: _ctx.icon,
color: _ctx.color,
size: "19"
}, null, 8, ["name", "color"])
])) : vue.createCommentVNode("v-if", true)
], true),
vue.createElementVNode(
"view",
{
class: "u-notice__content",
ref: "u-notice__content"
},
[
vue.createElementVNode(
"view",
{
ref: "u-notice__content__text",
class: "u-notice__content__text",
style: vue.normalizeStyle([$options.animationStyle])
},
[
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($options.innerText, (item, index2) => {
return vue.openBlock(), vue.createElementBlock(
"text",
{
key: index2,
style: vue.normalizeStyle([$options.textStyle])
},
vue.toDisplayString(item),
5
/* TEXT, STYLE */
);
}),
128
/* KEYED_FRAGMENT */
))
],
4
/* STYLE */
)
],
512
/* NEED_PATCH */
),
["link", "closable"].includes(_ctx.mode) ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "u-notice__right-icon"
}, [
_ctx.mode === "link" ? (vue.openBlock(), vue.createBlock(_component_up_icon, {
key: 0,
name: "arrow-right",
size: 17,
color: _ctx.color
}, null, 8, ["color"])) : vue.createCommentVNode("v-if", true),
_ctx.mode === "closable" ? (vue.openBlock(), vue.createBlock(_component_up_icon, {
key: 1,
onClick: $options.close,
name: "close",
size: 16,
color: _ctx.color
}, null, 8, ["onClick", "color"])) : vue.createCommentVNode("v-if", true)
])) : vue.createCommentVNode("v-if", true)
]);
}
const __easycom_1$1 = /* @__PURE__ */ _export_sfc(_sfc_main$10, [["render", _sfc_render$$], ["__scopeId", "data-v-ab8dee7b"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-row-notice/u-row-notice.vue"]]);
const __vite_glob_0_88 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: __easycom_1$1
}, Symbol.toStringTag, { value: "Module" }));
const props$z = defineMixin({
props: {
// 显示的内容,数组
text: {
type: [Array, String],
default: () => props$1x.noticeBar.text
},
// 通告滚动模式,row-横向滚动,column-竖向滚动
direction: {
type: String,
default: () => props$1x.noticeBar.direction
},
// direction = row时,是否使用步进形式滚动
step: {
type: Boolean,
default: () => props$1x.noticeBar.step
},
// 是否显示左侧的音量图标
icon: {
type: String,
default: () => props$1x.noticeBar.icon
},
// 通告模式,link-显示右箭头,closable-显示右侧关闭图标
mode: {
type: String,
default: () => props$1x.noticeBar.mode
},
// 文字颜色,各图标也会使用文字颜色
color: {
type: String,
default: () => props$1x.noticeBar.color
},
// 背景颜色
bgColor: {
type: String,
default: () => props$1x.noticeBar.bgColor
},
// 水平滚动时的滚动速度,即每秒滚动多少px(px),这有利于控制文字无论多少时,都能有一个恒定的速度
speed: {
type: [String, Number],
default: () => props$1x.noticeBar.speed
},
// 字体大小
fontSize: {
type: [String, Number],
default: () => props$1x.noticeBar.fontSize
},
// 滚动一个周期的时间长,单位ms
duration: {
type: [String, Number],
default: () => props$1x.noticeBar.duration
},
// 是否禁止用手滑动切换
// 目前HX2.6.11,只支持App 2.5.5+、H5 2.5.5+、支付宝小程序、字节跳动小程序
disableTouch: {
type: Boolean,
default: () => props$1x.noticeBar.disableTouch
},
// 跳转的页面路径
url: {
type: String,
default: () => props$1x.noticeBar.url
},
// 页面跳转的类型
linkType: {
type: String,
default: () => props$1x.noticeBar.linkType
},
justifyContent: {
type: String,
default: () => props$1x.noticeBar.justifyContent
}
}
});
const _sfc_main$$ = {
name: "u-notice-bar",
mixins: [mpMixin, mixin, props$z],
data() {
return {
show: true
};
},
emits: ["click", "close"],
methods: {
addStyle,
// 点击通告栏
click(index2) {
this.$emit("click", index2);
if (this.url && this.linkType) {
this.openPage();
}
},
// 点击关闭按钮
close() {
this.show = false;
this.$emit("close");
}
}
};
function _sfc_render$_(_ctx, _cache, $props, $setup, $data, $options) {
const _component_u_column_notice = resolveEasycom(vue.resolveDynamicComponent("u-column-notice"), __easycom_0$6);
const _component_u_row_notice = resolveEasycom(vue.resolveDynamicComponent("u-row-notice"), __easycom_1$1);
return $data.show ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: "u-notice-bar",
style: vue.normalizeStyle([{
backgroundColor: _ctx.bgColor
}, $options.addStyle(_ctx.customStyle)])
},
[
_ctx.direction === "column" || _ctx.direction === "row" && _ctx.step ? (vue.openBlock(), vue.createBlock(_component_u_column_notice, {
key: 0,
color: _ctx.color,
bgColor: _ctx.bgColor,
text: _ctx.text,
mode: _ctx.mode,
step: _ctx.step,
icon: _ctx.icon,
"disable-touch": _ctx.disableTouch,
fontSize: _ctx.fontSize,
duration: _ctx.duration,
justifyContent: _ctx.justifyContent,
onClose: $options.close,
onClick: $options.click
}, null, 8, ["color", "bgColor", "text", "mode", "step", "icon", "disable-touch", "fontSize", "duration", "justifyContent", "onClose", "onClick"])) : (vue.openBlock(), vue.createBlock(_component_u_row_notice, {
key: 1,
color: _ctx.color,
bgColor: _ctx.bgColor,
text: _ctx.text,
mode: _ctx.mode,
fontSize: _ctx.fontSize,
speed: _ctx.speed,
url: _ctx.url,
linkType: _ctx.linkType,
icon: _ctx.icon,
onClose: $options.close,
onClick: $options.click
}, null, 8, ["color", "bgColor", "text", "mode", "fontSize", "speed", "url", "linkType", "icon", "onClose", "onClick"]))
],
4
/* STYLE */
)) : vue.createCommentVNode("v-if", true);
}
const uNoticeBar = /* @__PURE__ */ _export_sfc(_sfc_main$$, [["render", _sfc_render$_], ["__scopeId", "data-v-54bd9363"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-notice-bar/u-notice-bar.vue"]]);
const __vite_glob_0_68 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uNoticeBar
}, Symbol.toStringTag, { value: "Module" }));
const props$y = defineMixin({
props: {
// 到顶部的距离
top: {
type: [String, Number],
default: () => props$1x.notify.top
},
// 是否展示组件
// show: {
// type: Boolean,
// default: () => defProps.notify.show
// },
// type主题,primary,success,warning,error
type: {
type: String,
default: () => props$1x.notify.type
},
// 字体颜色
color: {
type: String,
default: () => props$1x.notify.color
},
// 背景颜色
bgColor: {
type: String,
default: () => props$1x.notify.bgColor
},
// 展示的文字内容
message: {
type: String,
default: () => props$1x.notify.message
},
// 展示时长,为0时不消失,单位ms
duration: {
type: [String, Number],
default: () => props$1x.notify.duration
},
// 字体大小
fontSize: {
type: [String, Number],
default: () => props$1x.notify.fontSize
},
// 是否留出顶部安全距离(状态栏高度)
safeAreaInsetTop: {
type: Boolean,
default: () => props$1x.notify.safeAreaInsetTop
}
}
});
const _sfc_main$_ = {
name: "u-notify",
mixins: [mpMixin, mixin, props$y],
data() {
return {
// 是否展示组件
open: false,
timer: null,
config: {
// 到顶部的距离
top: props$1x.notify.top,
// type主题,primary,success,warning,error
type: props$1x.notify.type,
// 字体颜色
color: props$1x.notify.color,
// 背景颜色
bgColor: props$1x.notify.bgColor,
// 展示的文字内容
message: props$1x.notify.message,
// 展示时长,为0时不消失,单位ms
duration: props$1x.notify.duration,
// 字体大小
fontSize: props$1x.notify.fontSize,
// 是否留出顶部安全距离(状态栏高度)
safeAreaInsetTop: props$1x.notify.safeAreaInsetTop
},
// 合并后的配置,避免多次调用组件后,可能会复用之前使用的配置参数
tmpConfig: {}
};
},
computed: {
containerStyle() {
let top = 0;
if (this.tmpConfig.top === 0)
;
const style = {
top: addUnit(this.tmpConfig.top === 0 ? top : this.tmpConfig.top),
// 因为组件底层为u-transition组件,必须将其设置为fixed定位
// 让其出现在导航栏底部
position: "fixed",
left: 0,
right: 0,
zIndex: 10076
};
return style;
},
// 组件背景颜色
backgroundColor() {
const style = {};
if (this.tmpConfig.bgColor) {
style.backgroundColor = this.tmpConfig.bgColor;
}
return style;
},
// 默认主题下的图标
icon() {
let icon;
if (this.tmpConfig.type === "success") {
icon = "checkmark-circle";
} else if (this.tmpConfig.type === "error") {
icon = "close-circle";
} else if (this.tmpConfig.type === "warning") {
icon = "error-circle";
}
return icon;
}
},
created() {
["primary", "success", "error", "warning"].map((item) => {
this[item] = (message) => this.show({
type: item,
message
});
});
},
methods: {
addStyle,
addUnit,
show(options2) {
this.tmpConfig = deepMerge$1(this.config, options2);
this.clearTimer();
this.open = true;
if (this.tmpConfig.duration > 0) {
this.timer = setTimeout(() => {
this.open = false;
this.clearTimer();
typeof this.tmpConfig.complete === "function" && this.tmpConfig.complete();
}, this.tmpConfig.duration);
}
},
// 关闭notify
close() {
this.clearTimer();
},
clearTimer() {
this.open = false;
clearTimeout(this.timer);
this.timer = null;
}
},
beforeUnmount() {
this.clearTimer();
}
};
function _sfc_render$Z(_ctx, _cache, $props, $setup, $data, $options) {
const _component_u_status_bar = resolveEasycom(vue.resolveDynamicComponent("u-status-bar"), __easycom_0$c);
const _component_up_icon = vue.resolveComponent("up-icon");
const _component_u_transition = resolveEasycom(vue.resolveDynamicComponent("u-transition"), __easycom_2$1);
return vue.openBlock(), vue.createBlock(_component_u_transition, {
mode: "slide-down",
customStyle: $options.containerStyle,
show: $data.open
}, {
default: vue.withCtx(() => [
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["u-notify", [`u-notify--${$data.tmpConfig.type}`]]),
style: vue.normalizeStyle([$options.backgroundColor, $options.addStyle(_ctx.customStyle)])
},
[
$data.tmpConfig.safeAreaInsetTop ? (vue.openBlock(), vue.createBlock(_component_u_status_bar, { key: 0 })) : vue.createCommentVNode("v-if", true),
vue.createElementVNode("view", { class: "u-notify__warpper" }, [
vue.renderSlot(_ctx.$slots, "icon", {}, () => [
["success", "warning", "error"].includes($data.tmpConfig.type) ? (vue.openBlock(), vue.createBlock(_component_up_icon, {
key: 0,
name: $data.tmpConfig.icon,
color: $data.tmpConfig.color,
size: 1.3 * $data.tmpConfig.fontSize,
customStyle: { marginRight: "4px" }
}, null, 8, ["name", "color", "size"])) : vue.createCommentVNode("v-if", true)
], true),
vue.createElementVNode(
"text",
{
class: "u-notify__warpper__text",
style: vue.normalizeStyle({
fontSize: $options.addUnit($data.tmpConfig.fontSize),
color: $data.tmpConfig.color
})
},
vue.toDisplayString($data.tmpConfig.message),
5
/* TEXT, STYLE */
)
])
],
6
/* CLASS, STYLE */
)
]),
_: 3
/* FORWARDED */
}, 8, ["customStyle", "show"]);
}
const uNotify = /* @__PURE__ */ _export_sfc(_sfc_main$_, [["render", _sfc_render$Z], ["__scopeId", "data-v-67836363"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-notify/u-notify.vue"]]);
const __vite_glob_0_69 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uNotify
}, Symbol.toStringTag, { value: "Module" }));
const props$x = defineMixin({
props: {
// 步进器标识符,在change回调返回
name: {
type: [String, Number],
default: () => props$1x.numberBox.name
},
// 用于双向绑定的值,初始化时设置设为默认min值(最小值)
modelValue: {
type: [String, Number],
default: () => props$1x.numberBox.value
},
// 最小值
min: {
type: [String, Number],
default: () => props$1x.numberBox.min
},
// 最大值
max: {
type: [String, Number],
default: () => props$1x.numberBox.max
},
// 加减的步长,可为小数
step: {
type: [String, Number],
default: () => props$1x.numberBox.step
},
// 是否只允许输入整数
integer: {
type: Boolean,
default: () => props$1x.numberBox.integer
},
// 是否禁用,包括输入框,加减按钮
disabled: {
type: Boolean,
default: () => props$1x.numberBox.disabled
},
// 是否禁用输入框
disabledInput: {
type: Boolean,
default: () => props$1x.numberBox.disabledInput
},
// 是否开启异步变更,开启后需要手动控制输入值
asyncChange: {
type: Boolean,
default: () => props$1x.numberBox.asyncChange
},
// 输入框宽度,单位为px
inputWidth: {
type: [String, Number],
default: () => props$1x.numberBox.inputWidth
},
// 是否显示减少按钮
showMinus: {
type: Boolean,
default: () => props$1x.numberBox.showMinus
},
// 是否显示增加按钮
showPlus: {
type: Boolean,
default: () => props$1x.numberBox.showPlus
},
// 显示的小数位数
decimalLength: {
type: [String, Number, null],
default: () => props$1x.numberBox.decimalLength
},
// 是否开启长按加减手势
longPress: {
type: Boolean,
default: () => props$1x.numberBox.longPress
},
// 输入框文字和加减按钮图标的颜色
color: {
type: String,
default: () => props$1x.numberBox.color
},
// 按钮宽度
buttonWidth: {
type: [String, Number],
default: () => props$1x.numberBox.buttonWidth
},
// 按钮大小,宽高等于此值,单位px,输入框高度和此值保持一致
buttonSize: {
type: [String, Number],
default: () => props$1x.numberBox.buttonSize
},
// 按钮圆角
buttonRadius: {
type: [String],
default: () => props$1x.numberBox.buttonRadius
},
// 输入框和按钮的背景颜色
bgColor: {
type: String,
default: () => props$1x.numberBox.bgColor
},
// 按钮禁用背景色
disabledBgColor: {
type: String,
default: () => props$1x.numberBox.disabledBgColor
},
// 输入框背景颜色
inputBgColor: {
type: String,
default: () => props$1x.numberBox.inputBgColor
},
// 指定光标于键盘的距离,避免键盘遮挡输入框,单位px
cursorSpacing: {
type: [String, Number],
default: () => props$1x.numberBox.cursorSpacing
},
// 是否禁用增加按钮
disablePlus: {
type: Boolean,
default: () => props$1x.numberBox.disablePlus
},
// 是否禁用减少按钮
disableMinus: {
type: Boolean,
default: () => props$1x.numberBox.disableMinus
},
// 加减按钮图标的样式
iconStyle: {
type: [Object, String],
default: () => props$1x.numberBox.iconStyle
},
// 迷你模式
miniMode: {
type: Boolean,
default: () => props$1x.numberBox.miniMode
}
}
});
const _sfc_main$Z = {
name: "u-number-box",
mixins: [mpMixin, mixin, props$x],
data() {
return {
// 输入框实际操作的值
currentValue: "",
// 定时器
longPressTimer: null
};
},
watch: {
// 多个值之间,只要一个值发生变化,都要重新检查check()函数
watchChange(n2) {
this.check();
},
// 监听v-mode的变化,重新初始化内部的值
modelValue: {
handler: function(newV, oldV) {
if (newV !== this.currentValue) {
this.currentValue = this.format(this.modelValue);
}
},
immediate: true
}
},
computed: {
hideMinus() {
return this.currentValue == 0 && this.miniMode == true;
},
getCursorSpacing() {
return getPx(this.cursorSpacing);
},
// 按钮的样式
buttonStyle() {
return (type2) => {
const style = {
backgroundColor: this.bgColor,
width: addUnit(this.buttonWidth),
height: addUnit(this.buttonSize),
color: this.color,
borderRadius: this.buttonRadius
};
if (this.isDisabled(type2)) {
style.backgroundColor = this.disabledBgColor;
}
return style;
};
},
// 输入框的样式
inputStyle() {
this.disabled || this.disabledInput;
const style = {
color: this.color,
backgroundColor: this.inputBgColor || this.bgColor,
height: addUnit(this.buttonSize),
width: addUnit(this.inputWidth)
};
return style;
},
// 用于监听多个值发生变化
watchChange() {
return [this.integer, this.decimalLength, this.min, this.max];
},
isDisabled() {
return (type2) => {
if (type2 === "plus") {
return this.disabled || this.disablePlus || this.currentValue >= this.max;
}
return this.disabled || this.disableMinus || this.currentValue <= this.min;
};
}
},
mounted() {
this.init();
},
emits: ["update:modelValue", "focus", "blur", "overlimit", "change", "plus", "minus"],
methods: {
init() {
this.currentValue = this.format(this.modelValue);
},
// 格式化整理数据,限制范围
format(value2) {
value2 = this.filter(value2);
value2 = value2 === "" ? 0 : +value2;
value2 = Math.max(Math.min(this.max, value2), this.min);
if (this.decimalLength !== null) {
value2 = value2.toFixed(this.decimalLength);
}
return value2;
},
// 过滤非法的字符
filter(value2) {
value2 = String(value2).replace(/[^0-9.-]/g, "");
if (this.integer && value2.indexOf(".") !== -1) {
value2 = value2.split(".")[0];
}
return value2;
},
check() {
const val = this.format(this.currentValue);
if (val !== this.currentValue) {
this.currentValue = val;
this.emitChange(val);
}
},
// 判断是否出于禁止操作状态
// isDisabled(type) {
// if (type === 'plus') {
// // 在点击增加按钮情况下,判断整体的disabled,是否单独禁用增加按钮,以及当前值是否大于最大的允许值
// return (
// this.disabled ||
// this.disablePlus ||
// this.currentValue >= this.max
// )
// }
// // 点击减少按钮同理
// return (
// this.disabled ||
// this.disableMinus ||
// this.currentValue <= this.min
// )
// },
// 输入框活动焦点
onFocus(event) {
this.$emit("focus", {
...event.detail,
name: this.name
});
},
// 输入框失去焦点
onBlur(event) {
this.format(event.detail.value);
this.$emit(
"blur",
{
...event.detail,
name: this.name
}
);
},
// 输入框值发生变化
onInput(e2) {
const {
value: value2 = ""
} = e2.detail || {};
if (value2 === "") {
this.emitChange(this.min);
return;
}
let formatted = this.filter(value2);
this.emitChange(value2);
if (this.decimalLength !== null && formatted.indexOf(".") !== -1) {
const pair = formatted.split(".");
formatted = `${pair[0]}.${pair[1].slice(0, this.decimalLength)}`;
}
formatted = this.format(formatted);
this.emitChange(formatted);
},
// 发出change事件,type目前只支持点击时有值,手动输入不支持。
emitChange(value2, type2 = "") {
if (!this.asyncChange) {
this.$nextTick(() => {
this.$emit("update:modelValue", value2);
this.currentValue = value2;
this.$forceUpdate();
});
}
this.$emit("change", {
value: value2,
name: this.name,
type: type2
// 当前变更类型
});
},
onChange() {
const {
type: type2
} = this;
if (this.isDisabled(type2)) {
return this.$emit("overlimit", type2);
}
const diff = type2 === "minus" ? -this.step : +this.step;
const value2 = this.format(this.add(+this.currentValue, diff));
this.emitChange(value2, type2);
this.$emit(type2);
},
// 对值扩大后进行四舍五入,再除以扩大因子,避免出现浮点数操作的精度问题
add(num1, num2) {
const cardinal = Math.pow(10, 10);
return Math.round((num1 + num2) * cardinal) / cardinal;
},
// 点击加减按钮
clickHandler(type2) {
this.type = type2;
this.onChange();
},
longPressStep() {
this.clearTimeout();
this.longPressTimer = setTimeout(() => {
this.onChange();
this.longPressStep();
}, 250);
},
onTouchStart(type2) {
if (!this.longPress)
return;
this.clearTimeout();
this.type = type2;
this.longPressTimer = setTimeout(() => {
this.onChange();
this.longPressStep();
}, 600);
},
// 触摸结束,清除定时器,停止长按加减
onTouchEnd() {
if (!this.longPress)
return;
this.clearTimeout();
},
// 清除定时器
clearTimeout() {
clearTimeout(this.longPressTimer);
this.longPressTimer = null;
}
}
};
function _sfc_render$Y(_ctx, _cache, $props, $setup, $data, $options) {
const _component_up_icon = vue.resolveComponent("up-icon");
return vue.openBlock(), vue.createElementBlock("view", { class: "u-number-box" }, [
_ctx.showMinus && !$options.hideMinus && _ctx.$slots.minus ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: "u-number-box__slot cursor-pointer",
onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => $options.clickHandler("minus"), ["stop"])),
onTouchstart: _cache[1] || (_cache[1] = ($event) => $options.onTouchStart("minus")),
onTouchend: _cache[2] || (_cache[2] = vue.withModifiers((...args) => $options.clearTimeout && $options.clearTimeout(...args), ["stop"]))
},
[
vue.renderSlot(_ctx.$slots, "minus", {}, void 0, true)
],
32
/* NEED_HYDRATION */
)) : _ctx.showMinus && !$options.hideMinus ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 1,
class: vue.normalizeClass(["u-number-box__minus cursor-pointer", { "u-number-box__minus--disabled": $options.isDisabled("minus") }]),
onClick: _cache[3] || (_cache[3] = vue.withModifiers(($event) => $options.clickHandler("minus"), ["stop"])),
onTouchstart: _cache[4] || (_cache[4] = ($event) => $options.onTouchStart("minus")),
onTouchend: _cache[5] || (_cache[5] = vue.withModifiers((...args) => $options.clearTimeout && $options.clearTimeout(...args), ["stop"])),
"hover-class": "u-number-box__minus--hover",
"hover-stay-time": "150",
style: vue.normalizeStyle([$options.buttonStyle("minus")])
},
[
vue.createVNode(_component_up_icon, {
name: "minus",
color: $options.isDisabled("minus") ? "#c8c9cc" : "#323233",
size: "15",
bold: "",
customStyle: _ctx.iconStyle
}, null, 8, ["color", "customStyle"])
],
38
/* CLASS, STYLE, NEED_HYDRATION */
)) : vue.createCommentVNode("v-if", true),
!$options.hideMinus ? vue.renderSlot(_ctx.$slots, "input", { key: 2 }, () => [
vue.withDirectives(vue.createElementVNode("input", {
disabled: _ctx.disabledInput || _ctx.disabled,
"cursor-spacing": $options.getCursorSpacing,
class: vue.normalizeClass([{ "u-number-box__input--disabled": _ctx.disabled || _ctx.disabledInput }, "u-number-box__input"]),
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => $data.currentValue = $event),
onBlur: _cache[7] || (_cache[7] = (...args) => $options.onBlur && $options.onBlur(...args)),
onFocus: _cache[8] || (_cache[8] = (...args) => $options.onFocus && $options.onFocus(...args)),
onInput: _cache[9] || (_cache[9] = (...args) => $options.onInput && $options.onInput(...args)),
type: "number",
style: vue.normalizeStyle([$options.inputStyle])
}, null, 46, ["disabled", "cursor-spacing"]), [
[vue.vModelText, $data.currentValue]
])
], true) : vue.createCommentVNode("v-if", true),
_ctx.showPlus && _ctx.$slots.plus ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 3,
class: "u-number-box__slot cursor-pointer",
onClick: _cache[10] || (_cache[10] = vue.withModifiers(($event) => $options.clickHandler("plus"), ["stop"])),
onTouchstart: _cache[11] || (_cache[11] = ($event) => $options.onTouchStart("plus")),
onTouchend: _cache[12] || (_cache[12] = vue.withModifiers((...args) => $options.clearTimeout && $options.clearTimeout(...args), ["stop"]))
},
[
vue.renderSlot(_ctx.$slots, "plus", {}, void 0, true)
],
32
/* NEED_HYDRATION */
)) : _ctx.showPlus ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 4,
class: vue.normalizeClass(["u-number-box__plus cursor-pointer", { "u-number-box__minus--disabled": $options.isDisabled("plus") }]),
onClick: _cache[13] || (_cache[13] = vue.withModifiers(($event) => $options.clickHandler("plus"), ["stop"])),
onTouchstart: _cache[14] || (_cache[14] = ($event) => $options.onTouchStart("plus")),
onTouchend: _cache[15] || (_cache[15] = vue.withModifiers((...args) => $options.clearTimeout && $options.clearTimeout(...args), ["stop"])),
"hover-class": "u-number-box__plus--hover",
"hover-stay-time": "150",
style: vue.normalizeStyle([$options.buttonStyle("plus")])
},
[
vue.createVNode(_component_up_icon, {
name: "plus",
color: $options.isDisabled("plus") ? "#c8c9cc" : "#323233",
size: "15",
bold: "",
customStyle: _ctx.iconStyle
}, null, 8, ["color", "customStyle"])
],
38
/* CLASS, STYLE, NEED_HYDRATION */
)) : vue.createCommentVNode("v-if", true)
]);
}
const uNumberBox = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["render", _sfc_render$Y], ["__scopeId", "data-v-eb6f6237"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-number-box/u-number-box.vue"]]);
const __vite_glob_0_70 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uNumberBox
}, Symbol.toStringTag, { value: "Module" }));
const _sfc_main$Y = {
name: "u-pagination",
props: {
// 当前页码
currentPage: {
type: Number,
default: 1
},
// 每页条目数
pageSize: {
type: Number,
default: 10
},
// 总数据条目数
total: {
type: Number,
default: 0
},
// 上一页按钮文案
prevText: {
type: String,
default: ""
},
// 下一页按钮文案
nextText: {
type: String,
default: ""
},
buttonBgColor: {
type: String,
default: "#f5f7fa"
},
buttonBorderColor: {
type: String,
default: "#dcdfe6"
},
// 可选的每页条目数
pageSizes: {
type: Array,
default: () => [10, 20, 30, 40, 50]
},
// 布局方式(类似 el-pagination)
layout: {
type: String,
default: "prev, pager, next"
},
// 是否隐藏只有一个页面时的分页控件
hideOnSinglePage: {
type: Boolean,
default: false
}
},
emits: ["update:currentPage", "update:pageSize", "current-change", "size-change"],
data() {
return {
currentPageInput: this.currentPage + ""
};
},
computed: {
totalPages() {
return Math.max(1, Math.ceil(this.total / this.pageSize));
},
pageSizeIndex() {
const index2 = this.pageSizes.findIndex((size) => size.value === this.pageSize);
return index2 >= 0 ? index2 : 0;
},
pageSizeLabel() {
const found = this.pageSizes.find((size) => size.value === this.pageSize);
return (found == null ? void 0 : found.label) || this.pageSize;
},
displayedPages() {
const total = this.totalPages;
const current = this.currentPage;
if (total <= 4) {
return Array.from({ length: total }, (_2, i2) => i2 + 1);
}
const pages2 = [];
if (current <= 2) {
for (let i2 = 1; i2 <= 4; i2++) {
pages2.push(i2);
}
pages2.push("...");
pages2.push(total);
} else if (current >= total - 1) {
pages2.push(1);
pages2.push("...");
for (let i2 = total - 3; i2 <= total; i2++) {
pages2.push(i2);
}
} else {
pages2.push(1);
pages2.push("...");
pages2.push(current - 1);
pages2.push(current);
pages2.push(current + 1);
pages2.push("...");
pages2.push(total);
}
return pages2;
}
// 控制是否隐藏
},
watch: {
currentPage(val) {
this.currentPageInput = val + "";
}
},
methods: {
t: t$1,
handleSizeChange(e2) {
var _a2;
const selected = e2.detail.value;
const size = ((_a2 = this.pageSizes[selected]) == null ? void 0 : _a2.value) || this.pageSizes[0].value;
this.$emit("update:pageSize", size);
this.$emit("size-change", size);
},
prev() {
if (this.currentPage > 1) {
this.goTo(this.currentPage - 1);
}
},
next() {
if (this.currentPage < this.totalPages) {
this.goTo(this.currentPage + 1);
}
},
goTo(page2) {
if (page2 === "..." || page2 === this.currentPage)
return;
this.$emit("update:currentPage", page2);
this.$emit("current-change", page2);
},
onInputPage(e2) {
this.currentPageInput = e2.detail.value;
},
onConfirmPage(e2) {
const num = parseInt(e2.detail.value);
if (!isNaN(num) && num >= 1 && num <= this.totalPages) {
this.goTo(num);
}
}
}
};
function _sfc_render$X(_ctx, _cache, $props, $setup, $data, $options) {
const _component_up_icon = vue.resolveComponent("up-icon");
return vue.openBlock(), vue.createElementBlock("view", { class: "u-pagination" }, [
vue.createCommentVNode(" 上一页按钮 "),
vue.createElementVNode(
"view",
{
class: vue.normalizeClass([
"u-pagination-btn",
{ disabled: $props.currentPage === 1 }
]),
style: vue.normalizeStyle({ backgroundColor: $props.buttonBgColor, borderColor: $props.buttonBorderColor }),
onClick: _cache[0] || (_cache[0] = (...args) => $options.prev && $options.prev(...args))
},
[
$props.prevText ? (vue.openBlock(), vue.createElementBlock(
vue.Fragment,
{ key: 0 },
[
vue.createTextVNode(
vue.toDisplayString($props.prevText),
1
/* TEXT */
)
],
64
/* STABLE_FRAGMENT */
)) : (vue.openBlock(), vue.createBlock(_component_up_icon, {
key: 1,
name: "arrow-left"
}))
],
6
/* CLASS, STYLE */
),
vue.createCommentVNode(" 页码列表 "),
$props.layout.includes("pager") ? (vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
{ key: 0 },
vue.renderList($options.displayedPages, (page2) => {
return vue.openBlock(), vue.createElementBlock("view", {
key: page2,
class: vue.normalizeClass([
"u-pagination-item",
{ active: page2 === $props.currentPage }
]),
onClick: ($event) => $options.goTo(page2)
}, vue.toDisplayString(page2), 11, ["onClick"]);
}),
128
/* KEYED_FRAGMENT */
)) : vue.createCommentVNode("v-if", true),
vue.createCommentVNode(" 总数显示 "),
$props.total > 0 && $props.layout.includes("total") ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 1,
class: "u-pagination-total"
},
vue.toDisplayString($props.currentPage) + " / " + vue.toDisplayString($options.totalPages),
1
/* TEXT */
)) : vue.createCommentVNode("v-if", true),
vue.createCommentVNode(" 每页数量选择器 "),
vue.createCommentVNode(` `),
vue.createCommentVNode(" 下一页按钮 "),
vue.createElementVNode(
"view",
{
class: vue.normalizeClass([
"u-pagination-btn",
{ disabled: $props.currentPage === $options.totalPages }
]),
style: vue.normalizeStyle({ backgroundColor: $props.buttonBgColor, borderColor: $props.buttonBorderColor }),
onClick: _cache[1] || (_cache[1] = (...args) => $options.next && $options.next(...args))
},
[
$props.nextText ? (vue.openBlock(), vue.createElementBlock(
vue.Fragment,
{ key: 0 },
[
vue.createTextVNode(
vue.toDisplayString($props.nextText),
1
/* TEXT */
)
],
64
/* STABLE_FRAGMENT */
)) : (vue.openBlock(), vue.createBlock(_component_up_icon, {
key: 1,
name: "arrow-right"
}))
],
6
/* CLASS, STYLE */
),
vue.createCommentVNode(" 跳转输入框 "),
vue.createCommentVNode(` \r
前往\r
\r
页\r
`)
]);
}
const uPagination = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["render", _sfc_render$X], ["__scopeId", "data-v-c04d6295"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-pagination/u-pagination.vue"]]);
const __vite_glob_0_73 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uPagination
}, Symbol.toStringTag, { value: "Module" }));
const block0$2 = (Comp) => {
(Comp.$wxs || (Comp.$wxs = [])).push("handler");
(Comp.$wxsModules || (Comp.$wxsModules = {}))["handler"] = "155ce918";
};
const _sfc_main$X = {
name: "node",
options: {},
data() {
return {
ctrl: {}
};
},
props: {
name: String,
attrs: {
type: Object,
default() {
return {};
}
},
childs: Array,
opts: Array
},
components: {},
mounted() {
this.$nextTick(() => {
var _a2, _b;
for (this.root = this == null ? void 0 : this.$parent; this.root && ((_a2 = this.root) == null ? void 0 : _a2.$options.name) !== "mp-html"; this.root = (_b = this.root) == null ? void 0 : _b.$parent)
;
});
if (this.opts[0]) {
let i2;
for (i2 = this.childs.length; i2--; ) {
if (this.childs[i2].name === "img")
break;
}
if (i2 !== -1) {
this.observer = uni.createIntersectionObserver(this).relativeToViewport({
top: 500,
bottom: 500
});
this.observer.observe("._img", (res) => {
if (res.intersectionRatio) {
this.$set(this.ctrl, "load", 1);
this.observer.disconnect();
}
});
}
}
},
beforeDestroy() {
if (this.observer) {
this.observer.disconnect();
}
},
methods: {
/**
* @description 播放视频事件
* @param {Event} e
*/
play(e2) {
const i2 = e2.currentTarget.dataset.i;
const node2 = this.childs[i2];
this.root.$emit("play", {
source: node2.name,
attrs: {
...node2.attrs,
src: node2.src[this.ctrl[i2] || 0]
}
});
},
/**
* @description 图片点击事件
* @param {Event} e
*/
imgTap(e2) {
const node2 = this.childs[e2.currentTarget.dataset.i];
if (node2.a) {
this.linkTap(node2.a);
return;
}
if (node2.attrs.ignore)
return;
node2.attrs.src = node2.attrs.src || node2.attrs["data-src"];
this.root.$emit("imgtap", node2.attrs);
if (this.root.previewImg) {
uni.previewImage({
current: parseInt(node2.attrs.i),
urls: this.root.imgList
});
}
},
/**
* @description 图片长按
*/
imgLongTap(e2) {
const attrs = this.childs[e2.currentTarget.dataset.i].attrs;
if (this.opts[3] && !attrs.ignore) {
uni.showActionSheet({
itemList: ["保存图片"],
success: () => {
const save = (path) => {
uni.saveImageToPhotosAlbum({
filePath: path,
success() {
uni.showToast({
title: "保存成功"
});
}
});
};
if (this.root.imgList[attrs.i].startsWith("http")) {
uni.downloadFile({
url: this.root.imgList[attrs.i],
success: (res) => save(res.tempFilePath)
});
} else {
save(this.root.imgList[attrs.i]);
}
}
});
}
},
/**
* @description 图片加载完成事件
* @param {Event} e
*/
imgLoad(e2) {
const i2 = e2.currentTarget.dataset.i;
if (!this.childs[i2].w) {
this.$set(this.ctrl, i2, e2.detail.width);
} else if (this.opts[1] && !this.ctrl[i2] || this.ctrl[i2] === -1) {
this.$set(this.ctrl, i2, 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(e2) {
const node2 = e2.currentTarget ? this.childs[e2.currentTarget.dataset.i] : {};
const attrs = node2.attrs || e2;
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) {
plus.runtime.openWeb(href);
}
} else {
uni.navigateTo({
url: href,
fail() {
uni.switchTab({
url: href,
fail() {
}
});
}
});
}
}
},
/**
* @description 错误事件
* @param {Event} e
*/
mediaError(e2) {
const i2 = e2.currentTarget.dataset.i;
const node2 = this.childs[i2];
if (node2.name === "video" || node2.name === "audio") {
let index2 = (this.ctrl[i2] || 0) + 1;
if (index2 > node2.src.length) {
index2 = 0;
}
if (index2 < node2.src.length) {
this.$set(this.ctrl, i2, index2);
return;
}
} else if (node2.name === "img") {
if (this.opts[2]) {
this.$set(this.ctrl, i2, -1);
}
this.checkReady();
}
if (this.root) {
this.root.$emit("error", {
source: node2.name,
attrs: node2.attrs,
errMsg: e2.detail.errMsg
});
}
}
}
};
function _sfc_render$W(_ctx, _cache, $props, $setup, $data, $options) {
const _component_node = vue.resolveComponent("node", true);
return vue.openBlock(), vue.createElementBlock("view", {
id: $props.attrs.id,
class: vue.normalizeClass("_block _" + $props.name + " " + $props.attrs.class),
style: vue.normalizeStyle($props.attrs.style)
}, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($props.childs, (n2, i2) => {
return vue.openBlock(), vue.createElementBlock(
vue.Fragment,
{ key: i2 },
[
vue.createCommentVNode(" 图片 "),
vue.createCommentVNode(" 占位图 "),
n2.name === "img" && !n2.t && ($props.opts[1] && !$data.ctrl[i2] || $data.ctrl[i2] < 0) ? (vue.openBlock(), vue.createElementBlock("image", {
key: 0,
class: "_img",
style: vue.normalizeStyle(n2.attrs.style),
src: $data.ctrl[i2] < 0 ? $props.opts[2] : $props.opts[1],
mode: "widthFix"
}, null, 12, ["src"])) : vue.createCommentVNode("v-if", true),
vue.createCommentVNode(" 显示图片 "),
vue.createCommentVNode(" 表格中的图片,使用 rich-text 防止大小不正确 "),
n2.name === "img" && n2.t ? (vue.openBlock(), vue.createElementBlock("rich-text", {
key: 1,
style: vue.normalizeStyle("display:" + n2.t),
nodes: [{ attrs: { style: n2.attrs.style || "", src: n2.attrs.src }, name: "img" }],
"data-i": i2,
onClick: _cache[0] || (_cache[0] = vue.withModifiers((...args) => $options.imgTap && $options.imgTap(...args), ["stop"]))
}, null, 12, ["nodes", "data-i"])) : n2.name === "img" ? (vue.openBlock(), vue.createElementBlock("image", {
key: 2,
id: n2.attrs.id,
class: vue.normalizeClass("_img " + n2.attrs.class),
style: vue.normalizeStyle(($data.ctrl[i2] === -1 ? "display:none;" : "") + "width:" + ($data.ctrl[i2] || 1) + "px;" + n2.attrs.style),
src: n2.attrs.src || ($data.ctrl.load ? n2.attrs["data-src"] : ""),
mode: !n2.h ? "widthFix" : !n2.w ? "heightFix" : n2.m || "",
"data-i": i2,
onLoad: _cache[1] || (_cache[1] = (...args) => $options.imgLoad && $options.imgLoad(...args)),
onError: _cache[2] || (_cache[2] = (...args) => $options.mediaError && $options.mediaError(...args)),
onClick: _cache[3] || (_cache[3] = vue.withModifiers((...args) => $options.imgTap && $options.imgTap(...args), ["stop"])),
onLongpress: _cache[4] || (_cache[4] = (...args) => $options.imgLongTap && $options.imgLongTap(...args))
}, null, 46, ["id", "src", "mode", "data-i"])) : n2.text ? (vue.openBlock(), vue.createElementBlock(
vue.Fragment,
{ key: 3 },
[
vue.createCommentVNode(" 文本 "),
vue.createElementVNode(
"text",
{ decode: "" },
vue.toDisplayString(n2.text),
1
/* TEXT */
)
],
2112
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
)) : n2.name === "br" ? (vue.openBlock(), vue.createElementBlock("text", { key: 4 }, vue.toDisplayString("\n"))) : n2.name === "a" ? (vue.openBlock(), vue.createElementBlock(
vue.Fragment,
{ key: 5 },
[
vue.createCommentVNode(" 链接 "),
vue.createElementVNode("view", {
id: n2.attrs.id,
class: vue.normalizeClass((n2.attrs.href ? "_a " : "") + n2.attrs.class),
"hover-class": "_hover",
style: vue.normalizeStyle("display:inline;" + n2.attrs.style),
"data-i": i2,
onClick: _cache[5] || (_cache[5] = vue.withModifiers((...args) => $options.linkTap && $options.linkTap(...args), ["stop"]))
}, [
vue.createVNode(_component_node, {
name: "span",
childs: n2.children,
opts: $props.opts,
style: { "display": "inherit" }
}, null, 8, ["childs", "opts"])
], 14, ["id", "data-i"])
],
2112
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
)) : n2.html ? (vue.openBlock(), vue.createElementBlock(
vue.Fragment,
{ key: 6 },
[
vue.createCommentVNode(" 视频 "),
vue.createElementVNode("view", {
id: n2.attrs.id,
class: vue.normalizeClass("_video " + n2.attrs.class),
style: vue.normalizeStyle(n2.attrs.style),
innerHTML: n2.html,
"data-i": i2,
onVplay: _cache[6] || (_cache[6] = vue.withModifiers((...args) => $options.play && $options.play(...args), ["stop"]))
}, null, 46, ["id", "innerHTML", "data-i"])
],
2112
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
)) : n2.name === "iframe" ? (vue.openBlock(), vue.createElementBlock("iframe", {
key: 7,
style: vue.normalizeStyle(n2.attrs.style),
allowfullscreen: n2.attrs.allowfullscreen,
frameborder: n2.attrs.frameborder,
src: n2.attrs.src
}, null, 12, ["allowfullscreen", "frameborder", "src"])) : n2.name === "embed" ? (vue.openBlock(), vue.createElementBlock("embed", {
key: 8,
style: vue.normalizeStyle(n2.attrs.style),
src: n2.attrs.src
}, null, 12, ["src"])) : n2.name === "table" && n2.c || n2.name === "li" ? (vue.openBlock(), vue.createElementBlock("view", {
key: 9,
id: n2.attrs.id,
class: vue.normalizeClass("_" + n2.name + " " + n2.attrs.class),
style: vue.normalizeStyle(n2.attrs.style)
}, [
n2.name === "li" ? (vue.openBlock(), vue.createBlock(_component_node, {
key: 0,
childs: n2.children,
opts: $props.opts
}, null, 8, ["childs", "opts"])) : (vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
{ key: 1 },
vue.renderList(n2.children, (tbody, x2) => {
return vue.openBlock(), vue.createElementBlock(
"view",
{
key: x2,
class: vue.normalizeClass("_" + tbody.name + " " + tbody.attrs.class),
style: vue.normalizeStyle(tbody.attrs.style)
},
[
tbody.name === "td" || tbody.name === "th" ? (vue.openBlock(), vue.createBlock(_component_node, {
key: 0,
childs: tbody.children,
opts: $props.opts
}, null, 8, ["childs", "opts"])) : (vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
{ key: 1 },
vue.renderList(tbody.children, (tr, y2) => {
return vue.openBlock(), vue.createElementBlock(
vue.Fragment,
{ key: y2 },
[
tr.name === "td" || tr.name === "th" ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: vue.normalizeClass("_" + tr.name + " " + tr.attrs.class),
style: vue.normalizeStyle(tr.attrs.style)
},
[
vue.createVNode(_component_node, {
childs: tr.children,
opts: $props.opts
}, null, 8, ["childs", "opts"])
],
6
/* CLASS, STYLE */
)) : (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 1,
class: vue.normalizeClass("_" + tr.name + " " + tr.attrs.class),
style: vue.normalizeStyle(tr.attrs.style)
},
[
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(tr.children, (td, z2) => {
return vue.openBlock(), vue.createElementBlock(
"view",
{
key: z2,
class: vue.normalizeClass("_" + td.name + " " + td.attrs.class),
style: vue.normalizeStyle(td.attrs.style)
},
[
vue.createVNode(_component_node, {
childs: td.children,
opts: $props.opts
}, null, 8, ["childs", "opts"])
],
6
/* CLASS, STYLE */
);
}),
128
/* KEYED_FRAGMENT */
))
],
6
/* CLASS, STYLE */
))
],
64
/* STABLE_FRAGMENT */
);
}),
128
/* KEYED_FRAGMENT */
))
],
6
/* CLASS, STYLE */
);
}),
128
/* KEYED_FRAGMENT */
))
], 14, ["id"])) : !n2.c ? (vue.openBlock(), vue.createElementBlock(
vue.Fragment,
{ key: 10 },
[
vue.createCommentVNode(" insert "),
vue.createCommentVNode(" 富文本 "),
vue.createElementVNode("rich-text", {
id: n2.attrs.id,
style: vue.normalizeStyle("display:inline;" + n2.f),
preview: false,
selectable: $props.opts[4],
"user-select": $props.opts[4],
nodes: [n2]
}, null, 12, ["id", "selectable", "user-select", "nodes"])
],
2112
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
)) : n2.c === 2 ? (vue.openBlock(), vue.createElementBlock(
vue.Fragment,
{ key: 11 },
[
vue.createCommentVNode(" 继续递归 "),
vue.createElementVNode("view", {
id: n2.attrs.id,
class: vue.normalizeClass("_block _" + n2.name + " " + n2.attrs.class),
style: vue.normalizeStyle(n2.f + ";" + n2.attrs.style)
}, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(n2.children, (n22, j2) => {
return vue.openBlock(), vue.createBlock(_component_node, {
key: j2,
style: vue.normalizeStyle(n22.f),
name: n22.name,
attrs: n22.attrs,
childs: n22.children,
opts: $props.opts
}, null, 8, ["style", "name", "attrs", "childs", "opts"]);
}),
128
/* KEYED_FRAGMENT */
))
], 14, ["id"])
],
2112
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
)) : (vue.openBlock(), vue.createBlock(_component_node, {
key: 12,
style: vue.normalizeStyle(n2.f),
name: n2.name,
attrs: n2.attrs,
childs: n2.children,
opts: $props.opts
}, null, 8, ["style", "name", "attrs", "childs", "opts"]))
],
64
/* STABLE_FRAGMENT */
);
}),
128
/* KEYED_FRAGMENT */
))
], 14, ["id"]);
}
if (typeof block0$2 === "function")
block0$2(_sfc_main$X);
const node = /* @__PURE__ */ _export_sfc(_sfc_main$X, [["render", _sfc_render$W], ["__scopeId", "data-v-1200d422"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-parse/node/node.vue"]]);
const config = {
// 信任的标签(保持标签名不变)
trustTags: makeMap("a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,ruby,rt,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video"),
// 块级标签(转为 div,其他的非信任标签转为 span)
blockTags: makeMap("address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section"),
// 行内标签
inlineTags: makeMap("abbr,b,big,code,del,em,i,ins,label,q,small,span,strong,sub,sup"),
// 要移除的标签
ignoreTags: makeMap("area,base,canvas,embed,frame,head,iframe,input,link,map,meta,param,rp,script,source,style,textarea,title,track,wbr"),
// 自闭合的标签
voidTags: makeMap("area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr"),
// html 实体
entities: {
lt: "<",
gt: ">",
quot: '"',
apos: "'",
ensp: " ",
emsp: " ",
nbsp: " ",
semi: ";",
ndash: "–",
mdash: "—",
middot: "·",
lsquo: "‘",
rsquo: "’",
ldquo: "“",
rdquo: "”",
bull: "•",
hellip: "…",
larr: "←",
uarr: "↑",
rarr: "→",
darr: "↓"
},
// 默认的标签样式
tagStyle: {
address: "font-style:italic",
big: "display:inline;font-size:1.2em",
caption: "display:table-caption;text-align:center",
center: "text-align:center",
cite: "font-style:italic",
dd: "margin-left:40px",
mark: "background-color:yellow",
pre: "font-family:monospace;white-space:pre",
s: "text-decoration:line-through",
small: "display:inline;font-size:0.8em",
strike: "text-decoration:line-through",
u: "text-decoration:underline"
},
// svg 大小写对照表
svgDict: {
animatetransform: "animateTransform",
lineargradient: "linearGradient",
viewbox: "viewBox",
attributename: "attributeName",
repeatcount: "repeatCount",
repeatdur: "repeatDur",
foreignobject: "foreignObject"
}
};
const tagSelector = {};
let windowWidth;
const systemInfo = uni.getSystemInfoSync();
windowWidth = systemInfo.windowWidth;
const blankChar = makeMap(" ,\r,\n, ,\f");
let idIndex = 0;
config.ignoreTags.iframe = void 0;
config.trustTags.iframe = true;
config.ignoreTags.embed = void 0;
config.trustTags.embed = true;
function makeMap(str) {
const map = /* @__PURE__ */ Object.create(null);
const list = str.split(",");
for (let i2 = list.length; i2--; ) {
map[list[i2]] = true;
}
return map;
}
function decodeEntity(str, amp) {
let i2 = str.indexOf("&");
while (i2 !== -1) {
const j2 = str.indexOf(";", i2 + 3);
let code2;
if (j2 === -1)
break;
if (str[i2 + 1] === "#") {
code2 = parseInt((str[i2 + 2] === "x" ? "0" : "") + str.substring(i2 + 2, j2));
if (!isNaN(code2)) {
str = str.substr(0, i2) + String.fromCharCode(code2) + str.substr(j2 + 1);
}
} else {
code2 = str.substring(i2 + 1, j2);
if (config.entities[code2] || code2 === "amp" && amp) {
str = str.substr(0, i2) + (config.entities[code2] || "&") + str.substr(j2 + 1);
}
}
i2 = str.indexOf("&", i2 + 1);
}
return str;
}
function mergeNodes(nodes) {
let i2 = nodes.length - 1;
for (let j2 = i2; j2 >= -1; j2--) {
if (j2 === -1 || nodes[j2].c || !nodes[j2].name || nodes[j2].name !== "div" && nodes[j2].name !== "p" && nodes[j2].name[0] !== "h" || (nodes[j2].attrs.style || "").includes("inline")) {
if (i2 - j2 >= 5) {
nodes.splice(j2 + 1, i2 - j2, {
name: "div",
attrs: {},
children: nodes.slice(j2 + 1, i2 + 1)
});
}
i2 = j2 - 1;
}
}
}
function Parser(vm) {
this.options = vm || {};
this.tagStyle = Object.assign({}, config.tagStyle, this.options.tagStyle);
this.imgList = vm.imgList || [];
this.imgList._unloadimgs = 0;
this.plugins = vm.plugins || [];
this.attrs = /* @__PURE__ */ Object.create(null);
this.stack = [];
this.nodes = [];
this.pre = (this.options.containerStyle || "").includes("white-space") && this.options.containerStyle.includes("pre") ? 2 : 0;
}
Parser.prototype.parse = function(content) {
for (let i2 = this.plugins.length; i2--; ) {
if (this.plugins[i2].onUpdate) {
content = this.plugins[i2].onUpdate(content, config) || content;
}
}
new Lexer(this).parse(content);
while (this.stack.length) {
this.popNode();
}
if (this.nodes.length > 50) {
mergeNodes(this.nodes);
}
return this.nodes;
};
Parser.prototype.expose = function() {
for (let i2 = this.stack.length; i2--; ) {
const item = this.stack[i2];
if (item.c || item.name === "a" || item.name === "video" || item.name === "audio")
return;
item.c = 1;
}
};
Parser.prototype.hook = function(node2) {
for (let i2 = this.plugins.length; i2--; ) {
if (this.plugins[i2].onParse && this.plugins[i2].onParse(node2, this) === false) {
return false;
}
}
return true;
};
Parser.prototype.getUrl = function(url2) {
const domain2 = this.options.domain;
if (url2[0] === "/") {
if (url2[1] === "/") {
url2 = (domain2 ? domain2.split("://")[0] : "http") + ":" + url2;
} else if (domain2) {
url2 = domain2 + url2;
} else {
url2 = plus.io.convertLocalFileSystemURL(url2);
}
} else if (!url2.includes("data:") && !url2.includes("://")) {
if (domain2) {
url2 = domain2 + "/" + url2;
} else {
url2 = plus.io.convertLocalFileSystemURL(url2);
}
}
return url2;
};
Parser.prototype.parseStyle = function(node2) {
const attrs = node2.attrs;
const list = (this.tagStyle[node2.name] || "").split(";").concat((attrs.style || "").split(";"));
const styleObj = {};
let tmp = "";
if (attrs.id && !this.xml) {
if (this.options.useAnchor) {
this.expose();
} else if (node2.name !== "img" && node2.name !== "a" && node2.name !== "video" && node2.name !== "audio") {
attrs.id = void 0;
}
}
if (attrs.width) {
styleObj.width = parseFloat(attrs.width) + (attrs.width.includes("%") ? "%" : "px");
attrs.width = void 0;
}
if (attrs.height) {
styleObj.height = parseFloat(attrs.height) + (attrs.height.includes("%") ? "%" : "px");
attrs.height = void 0;
}
for (let i2 = 0, len = list.length; i2 < len; i2++) {
const info = list[i2].split(":");
if (info.length < 2)
continue;
const key = info.shift().trim().toLowerCase();
let value2 = info.join(":").trim();
if (value2[0] === "-" && value2.lastIndexOf("-") > 0 || value2.includes("safe")) {
tmp += `;${key}:${value2}`;
} else if (!styleObj[key] || value2.includes("import") || !styleObj[key].includes("import")) {
if (value2.includes("url")) {
let j2 = value2.indexOf("(") + 1;
if (j2) {
while (value2[j2] === '"' || value2[j2] === "'" || blankChar[value2[j2]]) {
j2++;
}
value2 = value2.substr(0, j2) + this.getUrl(value2.substr(j2));
}
} else if (value2.includes("rpx")) {
value2 = value2.replace(/[0-9.]+\s*rpx/g, ($2) => parseFloat($2) * windowWidth / 750 + "px");
}
styleObj[key] = value2;
}
}
node2.attrs.style = tmp;
return styleObj;
};
Parser.prototype.onTagName = function(name2) {
this.tagName = this.xml ? name2 : name2.toLowerCase();
if (this.tagName === "svg") {
this.xml = (this.xml || 0) + 1;
config.ignoreTags.style = void 0;
}
};
Parser.prototype.onAttrName = function(name2) {
name2 = this.xml ? name2 : name2.toLowerCase();
if (name2.includes("?") || name2.includes(";")) {
this.attrName = void 0;
return;
}
if (name2.substr(0, 5) === "data-") {
if (name2 === "data-src" && !this.attrs.src) {
this.attrName = "src";
} else if (this.tagName === "img" || this.tagName === "a") {
this.attrName = name2;
} else {
this.attrName = void 0;
}
} else {
this.attrName = name2;
this.attrs[name2] = "T";
}
};
Parser.prototype.onAttrVal = function(val) {
const name2 = this.attrName || "";
if (name2 === "style" || name2 === "href") {
this.attrs[name2] = decodeEntity(val, true);
} else if (name2.includes("src")) {
this.attrs[name2] = this.getUrl(decodeEntity(val, true));
} else if (name2) {
this.attrs[name2] = val;
}
};
Parser.prototype.onOpenTag = function(selfClose) {
const node2 = /* @__PURE__ */ Object.create(null);
node2.name = this.tagName;
node2.attrs = this.attrs;
if (this.options.nodes.length) {
node2.type = "node";
}
this.attrs = /* @__PURE__ */ Object.create(null);
const attrs = node2.attrs;
const parent = this.stack[this.stack.length - 1];
const siblings = parent ? parent.children : this.nodes;
const close = this.xml ? selfClose : config.voidTags[node2.name];
if (tagSelector[node2.name]) {
attrs.class = tagSelector[node2.name] + (attrs.class ? " " + attrs.class : "");
}
if (node2.name === "embed") {
this.expose();
}
if (node2.name === "video" || node2.name === "audio") {
if (node2.name === "video" && !attrs.id) {
attrs.id = "v" + idIndex++;
}
if (!attrs.controls && !attrs.autoplay) {
attrs.controls = "T";
}
node2.src = [];
if (attrs.src) {
node2.src.push(attrs.src);
attrs.src = void 0;
}
this.expose();
}
if (close) {
if (!this.hook(node2) || config.ignoreTags[node2.name]) {
if (node2.name === "base" && !this.options.domain) {
this.options.domain = attrs.href;
} else if (node2.name === "source" && parent && (parent.name === "video" || parent.name === "audio") && attrs.src) {
parent.src.push(attrs.src);
}
return;
}
const styleObj = this.parseStyle(node2);
if (node2.name === "img") {
if (attrs.src) {
if (attrs.src.includes("webp")) {
node2.webp = "T";
}
if (attrs.src.includes("data:") && this.options.previewImg !== "all" && !attrs["original-src"]) {
attrs.ignore = "T";
}
if (!attrs.ignore || node2.webp || attrs.src.includes("cloud://")) {
for (let i2 = this.stack.length; i2--; ) {
const item = this.stack[i2];
if (item.name === "a") {
node2.a = item.attrs;
}
if (item.name === "table" && !node2.webp && !attrs.src.includes("cloud://")) {
if (!styleObj.display || styleObj.display.includes("inline")) {
node2.t = "inline-block";
} else {
node2.t = styleObj.display;
}
styleObj.display = void 0;
}
item.c = 1;
}
attrs.i = this.imgList.length.toString();
let src = attrs["original-src"] || attrs.src;
this.imgList.push(src);
if (!node2.t) {
this.imgList._unloadimgs += 1;
}
if (this.options.lazyLoad) {
attrs["data-src"] = attrs.src;
attrs.src = void 0;
}
}
}
if (styleObj.display === "inline") {
styleObj.display = "";
}
if (attrs.ignore) {
styleObj["max-width"] = styleObj["max-width"] || "100%";
attrs.style += ";-webkit-touch-callout:none";
}
if (parseInt(styleObj.width) > windowWidth) {
styleObj.height = void 0;
}
if (!isNaN(parseInt(styleObj.width))) {
node2.w = "T";
}
if (!isNaN(parseInt(styleObj.height)) && (!styleObj.height.includes("%") || parent && (parent.attrs.style || "").includes("height"))) {
node2.h = "T";
}
if (node2.w && node2.h && styleObj["object-fit"]) {
if (styleObj["object-fit"] === "contain") {
node2.m = "aspectFit";
} else if (styleObj["object-fit"] === "cover") {
node2.m = "aspectFill";
}
}
} else if (node2.name === "svg") {
siblings.push(node2);
this.stack.push(node2);
this.popNode();
return;
}
for (const key in styleObj) {
if (styleObj[key]) {
attrs.style += `;${key}:${styleObj[key].replace(" !important", "")}`;
}
}
attrs.style = attrs.style.substr(1) || void 0;
} else {
if ((node2.name === "pre" || (attrs.style || "").includes("white-space") && attrs.style.includes("pre")) && this.pre !== 2) {
this.pre = node2.pre = 1;
}
node2.children = [];
this.stack.push(node2);
}
siblings.push(node2);
};
Parser.prototype.onCloseTag = function(name2) {
name2 = this.xml ? name2 : name2.toLowerCase();
let i2;
for (i2 = this.stack.length; i2--; ) {
if (this.stack[i2].name === name2)
break;
}
if (i2 !== -1) {
while (this.stack.length > i2) {
this.popNode();
}
} else if (name2 === "p" || name2 === "br") {
const siblings = this.stack.length ? this.stack[this.stack.length - 1].children : this.nodes;
siblings.push({
name: name2,
attrs: {
class: tagSelector[name2] || "",
style: this.tagStyle[name2] || ""
}
});
}
};
Parser.prototype.popNode = function() {
const node2 = this.stack.pop();
let attrs = node2.attrs;
const children = node2.children;
const parent = this.stack[this.stack.length - 1];
const siblings = parent ? parent.children : this.nodes;
if (!this.hook(node2) || config.ignoreTags[node2.name]) {
if (node2.name === "title" && children.length && children[0].type === "text" && this.options.setTitle) {
uni.setNavigationBarTitle({
title: children[0].text
});
}
siblings.pop();
return;
}
if (node2.pre && this.pre !== 2) {
this.pre = node2.pre = void 0;
for (let i2 = this.stack.length; i2--; ) {
if (this.stack[i2].pre) {
this.pre = 1;
}
}
}
const styleObj = {};
if (node2.name === "svg") {
if (this.xml > 1) {
this.xml--;
return;
}
let src = "";
const style = attrs.style;
attrs.style = "";
attrs.xmlns = "http://www.w3.org/2000/svg";
(function traversal(node3) {
if (node3.type === "text") {
src += node3.text;
return;
}
const name2 = config.svgDict[node3.name] || node3.name;
if (name2 === "foreignObject") {
for (const child of node3.children || []) {
if (child.attrs && !child.attrs.xmlns) {
child.attrs.xmlns = "http://www.w3.org/1999/xhtml";
break;
}
}
}
src += "<" + name2;
for (const item in node3.attrs) {
const val = node3.attrs[item];
if (val) {
src += ` ${config.svgDict[item] || item}="${val.replace(/"/g, "")}"`;
}
}
if (!node3.children) {
src += "/>";
} else {
src += ">";
for (let i2 = 0; i2 < node3.children.length; i2++) {
traversal(node3.children[i2]);
}
src += "" + name2 + ">";
}
})(node2);
node2.name = "img";
node2.attrs = {
src: "data:image/svg+xml;utf8," + src.replace(/#/g, "%23"),
style,
ignore: "T"
};
node2.children = void 0;
this.xml = false;
config.ignoreTags.style = true;
return;
}
if (attrs.align) {
if (node2.name === "table") {
if (attrs.align === "center") {
styleObj["margin-inline-start"] = styleObj["margin-inline-end"] = "auto";
} else {
styleObj.float = attrs.align;
}
} else {
styleObj["text-align"] = attrs.align;
}
attrs.align = void 0;
}
if (attrs.dir) {
styleObj.direction = attrs.dir;
attrs.dir = void 0;
}
if (node2.name === "font") {
if (attrs.color) {
styleObj.color = attrs.color;
attrs.color = void 0;
}
if (attrs.face) {
styleObj["font-family"] = attrs.face;
attrs.face = void 0;
}
if (attrs.size) {
let size = parseInt(attrs.size);
if (!isNaN(size)) {
if (size < 1) {
size = 1;
} else if (size > 7) {
size = 7;
}
styleObj["font-size"] = ["x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large"][size - 1];
}
attrs.size = void 0;
}
}
if ((attrs.class || "").includes("align-center")) {
styleObj["text-align"] = "center";
}
Object.assign(styleObj, this.parseStyle(node2));
if (node2.name !== "table" && parseInt(styleObj.width) > windowWidth) {
styleObj["max-width"] = "100%";
styleObj["box-sizing"] = "border-box";
}
if (config.blockTags[node2.name]) {
node2.name = "div";
} else if (!config.trustTags[node2.name] && !this.xml) {
node2.name = "span";
}
if (node2.name === "a" || node2.name === "ad" || node2.name === "iframe") {
this.expose();
} else if (node2.name === "video") {
if ((styleObj.height || "").includes("auto")) {
styleObj.height = void 0;
}
let str = '";
node2.html = str;
} else if ((node2.name === "ul" || node2.name === "ol") && node2.c) {
const types2 = {
a: "lower-alpha",
A: "upper-alpha",
i: "lower-roman",
I: "upper-roman"
};
if (types2[attrs.type]) {
attrs.style += ";list-style-type:" + types2[attrs.type];
attrs.type = void 0;
}
for (let i2 = children.length; i2--; ) {
if (children[i2].name === "li") {
children[i2].c = 1;
}
}
} else if (node2.name === "table") {
let padding = parseFloat(attrs.cellpadding);
let spacing = parseFloat(attrs.cellspacing);
const border = parseFloat(attrs.border);
const bordercolor = styleObj["border-color"];
const borderstyle = styleObj["border-style"];
if (node2.c) {
if (isNaN(padding)) {
padding = 2;
}
if (isNaN(spacing)) {
spacing = 2;
}
}
if (border) {
attrs.style += `;border:${border}px ${borderstyle || "solid"} ${bordercolor || "gray"}`;
}
if (node2.flag && node2.c) {
styleObj.display = "grid";
if (styleObj["border-collapse"] === "collapse") {
styleObj["border-collapse"] = void 0;
spacing = 0;
}
if (spacing) {
styleObj["grid-gap"] = spacing + "px";
styleObj.padding = spacing + "px";
} else if (border) {
attrs.style += ";border-left:0;border-top:0";
}
const width = [];
const trList = [];
const cells = [];
const map = {};
(function traversal(nodes) {
for (let i2 = 0; i2 < nodes.length; i2++) {
if (nodes[i2].name === "tr") {
trList.push(nodes[i2]);
} else if (nodes[i2].name === "colgroup") {
let colI = 1;
for (const col of nodes[i2].children || []) {
if (col.name === "col") {
const style = col.attrs.style || "";
const start = style.indexOf("width") ? style.indexOf(";width") : 0;
if (start !== -1) {
let end = style.indexOf(";", start + 6);
if (end === -1) {
end = style.length;
}
width[colI] = style.substring(start ? start + 7 : 6, end);
}
colI += 1;
}
}
} else {
traversal(nodes[i2].children || []);
}
}
})(children);
for (let row = 1; row <= trList.length; row++) {
let col = 1;
for (let j2 = 0; j2 < trList[row - 1].children.length; j2++) {
const td = trList[row - 1].children[j2];
if (td.name === "td" || td.name === "th") {
while (map[row + "." + col]) {
col++;
}
let style = td.attrs.style || "";
let start = style.indexOf("width") ? style.indexOf(";width") : 0;
if (start !== -1) {
let end = style.indexOf(";", start + 6);
if (end === -1) {
end = style.length;
}
if (!td.attrs.colspan) {
width[col] = style.substring(start ? start + 7 : 6, end);
}
style = style.substr(0, start) + style.substr(end);
}
style += ";display:flex";
start = style.indexOf("vertical-align");
if (start !== -1) {
const val = style.substr(start + 15, 10);
if (val.includes("middle")) {
style += ";align-items:center";
} else if (val.includes("bottom")) {
style += ";align-items:flex-end";
}
} else {
style += ";align-items:center";
}
start = style.indexOf("text-align");
if (start !== -1) {
const val = style.substr(start + 11, 10);
if (val.includes("center")) {
style += ";justify-content: center";
} else if (val.includes("right")) {
style += ";justify-content: right";
}
}
style = (border ? `;border:${border}px ${borderstyle || "solid"} ${bordercolor || "gray"}` + (spacing ? "" : ";border-right:0;border-bottom:0") : "") + (padding ? `;padding:${padding}px` : "") + ";" + style;
if (td.attrs.colspan) {
style += `;grid-column-start:${col};grid-column-end:${col + parseInt(td.attrs.colspan)}`;
if (!td.attrs.rowspan) {
style += `;grid-row-start:${row};grid-row-end:${row + 1}`;
}
col += parseInt(td.attrs.colspan) - 1;
}
if (td.attrs.rowspan) {
style += `;grid-row-start:${row};grid-row-end:${row + parseInt(td.attrs.rowspan)}`;
if (!td.attrs.colspan) {
style += `;grid-column-start:${col};grid-column-end:${col + 1}`;
}
for (let rowspan = 1; rowspan < td.attrs.rowspan; rowspan++) {
for (let colspan = 0; colspan < (td.attrs.colspan || 1); colspan++) {
map[row + rowspan + "." + (col - colspan)] = 1;
}
}
}
if (style) {
td.attrs.style = style;
}
cells.push(td);
col++;
}
}
if (row === 1) {
let temp = "";
for (let i2 = 1; i2 < col; i2++) {
temp += (width[i2] ? width[i2] : "auto") + " ";
}
styleObj["grid-template-columns"] = temp;
}
}
node2.children = cells;
} else {
if (node2.c) {
styleObj.display = "table";
}
if (!isNaN(spacing)) {
styleObj["border-spacing"] = spacing + "px";
}
if (border || padding) {
(function traversal(nodes) {
for (let i2 = 0; i2 < nodes.length; i2++) {
const td = nodes[i2];
if (td.name === "th" || td.name === "td") {
if (border) {
td.attrs.style = `border:${border}px ${borderstyle || "solid"} ${bordercolor || "gray"};${td.attrs.style || ""}`;
}
if (padding) {
td.attrs.style = `padding:${padding}px;${td.attrs.style || ""}`;
}
} else if (td.children) {
traversal(td.children);
}
}
})(children);
}
}
if (this.options.scrollTable && !(attrs.style || "").includes("inline")) {
const table = Object.assign({}, node2);
node2.name = "div";
node2.attrs = {
style: "overflow:auto"
};
node2.children = [table];
attrs = table.attrs;
}
} else if ((node2.name === "tbody" || node2.name === "tr") && node2.flag && node2.c) {
node2.flag = void 0;
(function traversal(nodes) {
for (let i2 = 0; i2 < nodes.length; i2++) {
if (nodes[i2].name === "td") {
for (const style of ["color", "background", "background-color"]) {
if (styleObj[style]) {
nodes[i2].attrs.style = style + ":" + styleObj[style] + ";" + (nodes[i2].attrs.style || "");
}
}
} else {
traversal(nodes[i2].children || []);
}
}
})(children);
} else if ((node2.name === "td" || node2.name === "th") && (attrs.colspan || attrs.rowspan)) {
for (let i2 = this.stack.length; i2--; ) {
if (this.stack[i2].name === "table" || this.stack[i2].name === "tbody" || this.stack[i2].name === "tr") {
this.stack[i2].flag = 1;
}
}
} else if (node2.name === "ruby") {
node2.name = "span";
for (let i2 = 0; i2 < children.length - 1; i2++) {
if (children[i2].type === "text" && children[i2 + 1].name === "rt") {
children[i2] = {
name: "div",
attrs: {
style: "display:inline-block;text-align:center"
},
children: [{
name: "div",
attrs: {
style: "font-size:50%;" + (children[i2 + 1].attrs.style || "")
},
children: children[i2 + 1].children
}, children[i2]]
};
children.splice(i2 + 1, 1);
}
}
} else if (node2.c) {
(function traversal(node3) {
node3.c = 2;
for (let i2 = node3.children.length; i2--; ) {
const child = node3.children[i2];
if (child.name && (config.inlineTags[child.name] || (child.attrs.style || "").includes("inline") && child.children) && !child.c) {
traversal(child);
}
if (!child.c || child.name === "table") {
node3.c = 1;
}
}
})(node2);
}
if ((styleObj.display || "").includes("flex") && !node2.c) {
for (let i2 = children.length; i2--; ) {
const item = children[i2];
if (item.f) {
item.attrs.style = (item.attrs.style || "") + item.f;
item.f = void 0;
}
}
}
const flex = parent && ((parent.attrs.style || "").includes("flex") || (parent.attrs.style || "").includes("grid")) && !node2.c;
if (flex) {
node2.f = ";max-width:100%";
}
if (children.length >= 50 && node2.c && !(styleObj.display || "").includes("flex")) {
mergeNodes(children);
}
for (const key in styleObj) {
if (styleObj[key]) {
const val = `;${key}:${styleObj[key].replace(" !important", "")}`;
if (flex && (key.includes("flex") && key !== "flex-direction" || key === "align-self" || key.includes("grid") || styleObj[key][0] === "-" || key.includes("width") && val.includes("%"))) {
node2.f += val;
if (key === "width") {
attrs.style += ";width:100%";
}
} else {
attrs.style += val;
}
}
}
attrs.style = attrs.style.substr(1) || void 0;
};
Parser.prototype.onText = function(text) {
if (!this.pre) {
let trim2 = "";
let flag2;
for (let i2 = 0, len = text.length; i2 < len; i2++) {
if (!blankChar[text[i2]]) {
trim2 += text[i2];
} else {
if (trim2[trim2.length - 1] !== " ") {
trim2 += " ";
}
if (text[i2] === "\n" && !flag2) {
flag2 = true;
}
}
}
if (trim2 === " ") {
if (flag2)
return;
else {
const parent = this.stack[this.stack.length - 1];
if (parent && parent.name[0] === "t")
return;
}
}
text = trim2;
}
const node2 = /* @__PURE__ */ Object.create(null);
node2.type = "text";
node2.text = decodeEntity(text);
if (this.hook(node2)) {
const siblings = this.stack.length ? this.stack[this.stack.length - 1].children : this.nodes;
siblings.push(node2);
}
};
function Lexer(handler) {
this.handler = handler;
}
Lexer.prototype.parse = function(content) {
this.content = content || "";
this.i = 0;
this.start = 0;
this.state = this.text;
for (let len = this.content.length; this.i !== -1 && this.i < len; ) {
this.state();
}
};
Lexer.prototype.checkClose = function(method) {
const selfClose = this.content[this.i] === "/";
if (this.content[this.i] === ">" || selfClose && this.content[this.i + 1] === ">") {
if (method) {
this.handler[method](this.content.substring(this.start, this.i));
}
this.i += selfClose ? 2 : 1;
this.start = this.i;
this.handler.onOpenTag(selfClose);
if (this.handler.tagName === "script") {
this.i = this.content.indexOf("", this.i);
if (this.i !== -1) {
this.i += 2;
this.start = this.i;
}
this.state = this.endTag;
} else {
this.state = this.text;
}
return true;
}
return false;
};
Lexer.prototype.text = function() {
this.i = this.content.indexOf("<", this.i);
if (this.i === -1) {
if (this.start < this.content.length) {
this.handler.onText(this.content.substring(this.start, this.content.length));
}
return;
}
const c2 = this.content[this.i + 1];
if (c2 >= "a" && c2 <= "z" || c2 >= "A" && c2 <= "Z") {
if (this.start !== this.i) {
this.handler.onText(this.content.substring(this.start, this.i));
}
this.start = ++this.i;
this.state = this.tagName;
} else if (c2 === "/" || c2 === "!" || c2 === "?") {
if (this.start !== this.i) {
this.handler.onText(this.content.substring(this.start, this.i));
}
const next = this.content[this.i + 2];
if (c2 === "/" && (next >= "a" && next <= "z" || next >= "A" && next <= "Z")) {
this.i += 2;
this.start = this.i;
this.state = this.endTag;
return;
}
let end = "-->";
if (c2 !== "!" || this.content[this.i + 2] !== "-" || this.content[this.i + 3] !== "-") {
end = ">";
}
this.i = this.content.indexOf(end, this.i);
if (this.i !== -1) {
this.i += end.length;
this.start = this.i;
}
} else {
this.i++;
}
};
Lexer.prototype.tagName = function() {
if (blankChar[this.content[this.i]]) {
this.handler.onTagName(this.content.substring(this.start, this.i));
while (blankChar[this.content[++this.i]])
;
if (this.i < this.content.length && !this.checkClose()) {
this.start = this.i;
this.state = this.attrName;
}
} else if (!this.checkClose("onTagName")) {
this.i++;
}
};
Lexer.prototype.attrName = function() {
let c2 = this.content[this.i];
if (blankChar[c2] || c2 === "=") {
this.handler.onAttrName(this.content.substring(this.start, this.i));
let needVal = c2 === "=";
const len = this.content.length;
while (++this.i < len) {
c2 = this.content[this.i];
if (!blankChar[c2]) {
if (this.checkClose())
return;
if (needVal) {
this.start = this.i;
this.state = this.attrVal;
return;
}
if (this.content[this.i] === "=") {
needVal = true;
} else {
this.start = this.i;
this.state = this.attrName;
return;
}
}
}
} else if (!this.checkClose("onAttrName")) {
this.i++;
}
};
Lexer.prototype.attrVal = function() {
const c2 = this.content[this.i];
const len = this.content.length;
if (c2 === '"' || c2 === "'") {
this.start = ++this.i;
this.i = this.content.indexOf(c2, this.i);
if (this.i === -1)
return;
this.handler.onAttrVal(this.content.substring(this.start, this.i));
} else {
for (; this.i < len; this.i++) {
if (blankChar[this.content[this.i]]) {
this.handler.onAttrVal(this.content.substring(this.start, this.i));
break;
} else if (this.checkClose("onAttrVal"))
return;
}
}
while (blankChar[this.content[++this.i]])
;
if (this.i < len && !this.checkClose()) {
this.start = this.i;
this.state = this.attrName;
}
};
Lexer.prototype.endTag = function() {
const c2 = this.content[this.i];
if (blankChar[c2] || c2 === ">" || c2 === "/") {
this.handler.onCloseTag(this.content.substring(this.start, this.i));
if (c2 !== ">") {
this.i = this.content.indexOf(">", this.i);
if (this.i === -1)
return;
}
this.start = ++this.i;
this.state = this.text;
} else {
this.i++;
}
};
const plugins = [];
const _sfc_main$W = {
name: "u-parse",
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 i2 = plugins.length; i2--; ) {
this.plugins.push(new plugins[i2](this));
}
},
mounted() {
if (this.content && !this.nodes.length) {
this.setContent(this.content);
}
},
beforeUnmount() {
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(page2, selector, scrollTop) {
if (page2 && selector && scrollTop) {
this._in = {
page: page2,
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 = " ";
const selector = uni.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 {
uni.pageScrollTo({
scrollTop,
duration: 300
});
}
resolve();
});
});
},
/**
* @description 获取文本内容
* @return {String}
*/
getText(nodes) {
let text = "";
(function traversal(nodes2) {
for (let i2 = 0; i2 < nodes2.length; i2++) {
const node2 = nodes2[i2];
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) => {
uni.createSelectorQuery().in(this).select("#_root").boundingClientRect().exec((res) => res[0] ? resolve(res[0]) : reject(Error("Root label not found")));
});
},
/**
* @description 暂停播放媒体
*/
pauseMedia() {
for (let i2 = (this._videos || []).length; i2--; ) {
this._videos[i2].pause();
}
const command = 'for(var e=document.getElementsByTagName("video"),i=e.length;i--;)e[i].pause()';
let page2 = this.$parent;
while (!page2.$scope)
page2 = page2.$parent;
page2.$scope.$getAppWebview().evalJS(command);
},
/**
* @description 设置媒体播放速率
* @param {Number} rate 播放速率
*/
setPlaybackRate(rate) {
this.playbackRate = rate;
for (let i2 = (this._videos || []).length; i2--; ) {
this._videos[i2].playbackRate(rate);
}
const command = 'for(var e=document.getElementsByTagName("video"),i=e.length;i--;)e[i].playbackRate=' + rate;
let page2 = this.$parent;
while (!page2.$scope)
page2 = page2.$parent;
page2.$scope.$getAppWebview().evalJS(command);
},
/**
* @description 设置内容
* @param {String} content html 内容
* @param {Boolean} append 是否在尾部追加
*/
setContent(content, append) {
if (!append || !this.imgList) {
this.imgList = [];
}
const nodes = new 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(name2) {
for (let i2 = plugins.length; i2--; ) {
if (this.plugins[i2][name2]) {
this.plugins[i2][name2]();
}
}
}
}
};
function _sfc_render$V(_ctx, _cache, $props, $setup, $data, $options) {
const _component_node = vue.resolveComponent("node");
return vue.openBlock(), vue.createElementBlock(
"view",
{
id: "_root",
class: vue.normalizeClass(($props.selectable ? "_select " : "") + "_root"),
style: vue.normalizeStyle($props.containerStyle)
},
[
!$data.nodes[0] ? vue.renderSlot(_ctx.$slots, "default", { key: 0 }, void 0, true) : (vue.openBlock(), vue.createBlock(_component_node, {
key: 1,
childs: $data.nodes,
opts: [$props.lazyLoad, $props.loadingImg, $props.errorImg, $props.showImgMenu, $props.selectable],
name: "span"
}, null, 8, ["childs", "opts"]))
],
6
/* CLASS, STYLE */
);
}
const uParse = /* @__PURE__ */ _export_sfc(_sfc_main$W, [["render", _sfc_render$V], ["__scopeId", "data-v-cd79d006"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-parse/u-parse.vue"]]);
const __vite_glob_0_74 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uParse
}, Symbol.toStringTag, { value: "Module" }));
const props$w = {
props: {
// PDF文件地址
src: {
type: String,
default: ""
},
// 组件高度
height: {
type: String,
default: "700px"
},
// pdfjs资源域名
baseUrl: {
type: String,
default: "https://uview-plus.jiangruyi.com/h5"
}
}
};
const _sfc_main$V = {
name: "up-pdf-reader",
mixins: [props$w],
data() {
return {
baseUrlInner: "https://uview-plus.jiangruyi.com/h5",
viewerUrl: ""
};
},
watch: {
baseUrl: function(val) {
this.baseUrl = val;
},
src: function(val) {
this.viewerUrl = `${this.baseUrlInner}/static/pdfjs/web/viewer.html?file=` + encodeURIComponent(val);
}
},
mounted() {
if (this.baseUrl) {
this.baseUrlInner = this.baseUrl;
}
this.viewerUrl = `${this.baseUrlInner}/static/pdfjs/web/viewer.html?file=` + encodeURIComponent(this.src);
}
};
function _sfc_render$U(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: "up-pdf-reader",
style: vue.normalizeStyle({ height: _ctx.height })
},
[
vue.createElementVNode("web-view", {
fullscreen: false,
src: $data.viewerUrl,
style: vue.normalizeStyle({ width: "750rpx", height: _ctx.height }),
"webview-styles": { width: "750rpx", height: _ctx.height },
frameborder: "0"
}, null, 12, ["src", "webview-styles"])
],
4
/* STYLE */
);
}
const uPdfReader = /* @__PURE__ */ _export_sfc(_sfc_main$V, [["render", _sfc_render$U], ["__scopeId", "data-v-2149504b"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-pdf-reader/u-pdf-reader.vue"]]);
const __vite_glob_0_75 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uPdfReader
}, Symbol.toStringTag, { value: "Module" }));
const props$v = defineMixin({
props: {}
});
const _sfc_main$U = {
name: "u-picker-column",
mixins: [mpMixin, mixin, props$v]
};
function _sfc_render$T(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock("picker-view-column", null, [
vue.createElementVNode("view", { class: "u-picker-column" })
]);
}
const uPickerColumn = /* @__PURE__ */ _export_sfc(_sfc_main$U, [["render", _sfc_render$T], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-picker-column/u-picker-column.vue"]]);
const __vite_glob_0_76 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uPickerColumn
}, Symbol.toStringTag, { value: "Module" }));
const _sfc_main$T = {
name: "u-picker-data",
props: {
modelValue: {
type: [String, Number],
default: ""
},
title: {
type: String,
default: ""
},
description: {
type: String,
default: ""
},
options: {
type: Array,
default: () => {
return [];
}
},
valueKey: {
type: String,
default: "id"
},
labelKey: {
type: String,
default: "name"
}
},
data() {
return {
show: false,
current: "",
defaultIndex: []
};
},
created() {
if (this.modelValue) {
this.options.forEach((ele, index2) => {
if (ele[this.valueKey] == this.modelValue) {
this.current = ele[this.labelKey];
this.defaultIndex = [index2];
}
});
}
},
watch: {
modelValue() {
if (this.modelValue) {
this.options.forEach((ele, index2) => {
if (ele[this.valueKey] == this.modelValue) {
this.current = ele[this.labelKey];
this.defaultIndex = [index2];
}
});
}
}
},
computed: {
optionsInner() {
return [this.options];
}
},
emits: ["update:modelValue", "cancel", "close", "confirm"],
methods: {
hideKeyboard() {
uni.hideKeyboard();
},
cancel() {
this.show = false;
this.$emit("cancel");
},
close() {
this.$emit("close");
},
confirm(e2) {
const {
columnIndex,
index: index2,
value: value2
} = e2;
this.show = false;
this.$emit("update:modelValue", value2[0][this.valueKey]);
this.defaultIndex = columnIndex;
this.current = value2[0][this.labelKey];
this.$emit("confirm");
}
}
};
function _sfc_render$S(_ctx, _cache, $props, $setup, $data, $options) {
const _component_up_input = vue.resolveComponent("up-input");
const _component_up_picker = vue.resolveComponent("up-picker");
return vue.openBlock(), vue.createElementBlock("view", { class: "u-picker-data" }, [
vue.createElementVNode("view", { class: "u-picker-data__trigger" }, [
vue.renderSlot(_ctx.$slots, "trigger", { current: $data.current }, void 0, true),
!_ctx.$slots["trigger"] ? (vue.openBlock(), vue.createBlock(_component_up_input, {
key: 0,
modelValue: $data.current,
disabled: "",
disabledColor: "#ffffff",
placeholder: $props.title,
border: "none"
}, null, 8, ["modelValue", "placeholder"])) : vue.createCommentVNode("v-if", true),
vue.createElementVNode("view", {
onClick: _cache[0] || (_cache[0] = ($event) => $data.show = true),
class: "u-picker-data__trigger__cover"
})
]),
vue.createVNode(_component_up_picker, {
show: $data.show,
columns: $options.optionsInner,
keyName: $props.labelKey,
defaultIndex: $data.defaultIndex,
onConfirm: $options.confirm,
onCancel: $options.cancel,
onClose: $options.close
}, null, 8, ["show", "columns", "keyName", "defaultIndex", "onConfirm", "onCancel", "onClose"])
]);
}
const uPickerData = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["render", _sfc_render$S], ["__scopeId", "data-v-cdfa3c95"], ["__file", "C:/Users/EDY/Desktop/项目/shuibei/uni_modules/uview-plus/components/u-picker-data/u-picker-data.vue"]]);
const __vite_glob_0_77 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uPickerData
}, Symbol.toStringTag, { value: "Module" }));
const _sfc_main$S = {
name: "up-poster",
props: {
json: {
type: Object,
default: () => ({})
}
},
data() {
return {
canvasId: "u-poster-canvas-" + Date.now(),
showCanvas: false,
canvasWidth: 0,
canvasHeight: 0,
// 二维码相关数据
qrCodeValue: "",
qrCodeSize: 200,
qrCodeShow: false,
// 存储多个二维码的数据
qrCodeMap: /* @__PURE__ */ new Map()
};
},
computed: {
// 根据传入的css生成文本样式
getTextStyle() {
return (css) => {
const style = {};
if (css.color)
style.color = css.color;
if (css.fontSize)
style.fontSize = css.fontSize;
if (css.fontWeight)
style.fontWeight = css.fontWeight;
if (css.lineHeight)
style.lineHeight = css.lineHeight;
if (css.textAlign)
style.textAlign = css.textAlign;
return style;
};
}
},
methods: {
/**
* 导出海报图片
* @description 根据json配置生成海报并导出为临时图片路径
* @returns {Promise