Files
appco_dist/.output/server/chunks/build/index-Cr7WIrmx.mjs
T

298 lines
7.4 KiB
JavaScript

import { defineComponent, computed, createVNode, ref, reactive } from 'vue';
function noop() {
}
const extend = Object.assign;
const isObject = (val) => val !== null && typeof val === "object";
const isDef = (val) => val !== void 0 && val !== null;
const isFunction = (val) => typeof val === "function";
const isPromise = (val) => isObject(val) && isFunction(val.then) && isFunction(val.catch);
const isNumeric = (val) => typeof val === "number" || /^\d+(\.\d+)?$/.test(val);
function get(object, path) {
const keys = path.split(".");
let result = object;
keys.forEach((key) => {
var _a;
result = isObject(result) ? (_a = result[key]) != null ? _a : "" : "";
});
return result;
}
function pick(obj, keys, ignoreUndefined) {
return keys.reduce(
(ret, key) => {
{
ret[key] = obj[key];
}
return ret;
},
{}
);
}
const unknownProp = null;
const numericProp = [Number, String];
const truthProp = {
type: Boolean,
default: true
};
const makeArrayProp = () => ({
type: Array,
default: () => []
});
const makeNumericProp = (defaultVal) => ({
type: numericProp,
default: defaultVal
});
const makeStringProp = (defaultVal) => ({
type: String,
default: defaultVal
});
function addUnit(value) {
if (isDef(value)) {
return isNumeric(value) ? `${value}px` : String(value);
}
return void 0;
}
function getSizeStyle(originSize) {
if (isDef(originSize)) {
if (Array.isArray(originSize)) {
return {
width: addUnit(originSize[0]),
height: addUnit(originSize[1])
};
}
const size = addUnit(originSize);
return {
width: size,
height: size
};
}
}
function getZIndexStyle(zIndex) {
const style = {};
if (zIndex !== void 0) {
style.zIndex = +zIndex;
}
return style;
}
const camelizeRE = /-(\w)/g;
const camelize = (str) => str.replace(camelizeRE, (_, c) => c.toUpperCase());
const kebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase().replace(/^-/, "");
const { hasOwnProperty } = Object.prototype;
function assignKey(to, from, key) {
const val = from[key];
if (!isDef(val)) {
return;
}
if (!hasOwnProperty.call(to, key) || !isObject(val)) {
to[key] = val;
} else {
to[key] = deepAssign(Object(to[key]), val);
}
}
function deepAssign(to, from) {
Object.keys(from).forEach((key) => {
assignKey(to, from, key);
});
return to;
}
var stdin_default$2 = {
name: "姓名",
tel: "电话",
save: "保存",
clear: "清空",
cancel: "取消",
confirm: "确认",
delete: "删除",
loading: "加载中...",
noCoupon: "暂无优惠券",
nameEmpty: "请填写姓名",
addContact: "添加联系人",
telInvalid: "请填写正确的电话",
vanCalendar: {
end: "结束",
start: "开始",
title: "日期选择",
weekdays: ["日", "一", "二", "三", "四", "五", "六"],
monthTitle: (year, month) => `${year}年${month}月`,
rangePrompt: (maxRange) => `最多选择 ${maxRange} 天`
},
vanCascader: {
select: "请选择"
},
vanPagination: {
prev: "上一页",
next: "下一页"
},
vanPullRefresh: {
pulling: "下拉即可刷新...",
loosing: "释放即可刷新..."
},
vanSubmitBar: {
label: "合计:"
},
vanCoupon: {
unlimited: "无门槛",
discount: (discount) => `${discount}折`,
condition: (condition) => `满${condition}元可用`
},
vanCouponCell: {
title: "优惠券",
count: (count) => `${count}张可用`
},
vanCouponList: {
exchange: "兑换",
close: "不使用",
enable: "可用",
disabled: "不可用",
placeholder: "输入优惠码"
},
vanAddressEdit: {
area: "地区",
areaEmpty: "请选择地区",
addressEmpty: "请填写详细地址",
addressDetail: "详细地址",
defaultAddress: "设为默认收货地址"
},
vanAddressList: {
add: "新增地址"
}
};
const lang = ref("zh-CN");
const messages = reactive({
"zh-CN": stdin_default$2
});
const Locale = {
messages() {
return messages[lang.value];
},
use(newLang, newMessages) {
lang.value = newLang;
this.add({ [newLang]: newMessages });
},
add(newMessages = {}) {
deepAssign(messages, newMessages);
}
};
var stdin_default$1 = Locale;
function createTranslate(name2) {
const prefix = camelize(name2) + ".";
return (path, ...args) => {
const messages2 = stdin_default$1.messages();
const message = get(messages2, prefix + path) || get(messages2, path);
return isFunction(message) ? message(...args) : message;
};
}
function genBem(name2, mods) {
if (!mods) {
return "";
}
if (typeof mods === "string") {
return ` ${name2}--${mods}`;
}
if (Array.isArray(mods)) {
return mods.reduce(
(ret, item) => ret + genBem(name2, item),
""
);
}
return Object.keys(mods).reduce(
(ret, key) => ret + (mods[key] ? genBem(name2, key) : ""),
""
);
}
function createBEM(name2) {
return (el, mods) => {
if (el && typeof el !== "string") {
mods = el;
el = "";
}
el = el ? `${name2}__${el}` : name2;
return `${el}${genBem(el, mods)}`;
};
}
function createNamespace(name2) {
const prefixedName = `van-${name2}`;
return [
prefixedName,
createBEM(prefixedName),
createTranslate(prefixedName)
];
}
function withInstall(options) {
options.install = (app) => {
const { name: name2 } = options;
if (name2) {
app.component(name2, options);
app.component(camelize(`-${name2}`), options);
}
};
return options;
}
const [name, bem] = createNamespace("loading");
const SpinIcon = Array(12).fill(null).map((_, index) => createVNode("i", {
"class": bem("line", String(index + 1))
}, null));
const CircularIcon = createVNode("svg", {
"class": bem("circular"),
"viewBox": "25 25 50 50"
}, [createVNode("circle", {
"cx": "50",
"cy": "50",
"r": "20",
"fill": "none"
}, null)]);
const loadingProps = {
size: numericProp,
type: makeStringProp("circular"),
color: String,
vertical: Boolean,
textSize: numericProp,
textColor: String
};
var stdin_default = defineComponent({
name,
props: loadingProps,
setup(props, {
slots
}) {
const spinnerStyle = computed(() => extend({
color: props.color
}, getSizeStyle(props.size)));
const renderIcon = () => {
const DefaultIcon = props.type === "spinner" ? SpinIcon : CircularIcon;
return createVNode("span", {
"class": bem("spinner", props.type),
"style": spinnerStyle.value
}, [slots.icon ? slots.icon() : DefaultIcon]);
};
const renderText = () => {
var _a;
if (slots.default) {
return createVNode("span", {
"class": bem("text"),
"style": {
fontSize: addUnit(props.textSize),
color: (_a = props.textColor) != null ? _a : props.color
}
}, [slots.default()]);
}
};
return () => {
const {
type,
vertical
} = props;
return createVNode("div", {
"class": bem([type, {
vertical
}]),
"aria-live": "polite",
"aria-busy": true
}, [renderIcon(), renderText()]);
};
}
});
export { makeNumericProp as a, addUnit as b, createNamespace as c, makeArrayProp as d, extend as e, isNumeric as f, getSizeStyle as g, getZIndexStyle as h, isDef as i, isPromise as j, kebabCase as k, noop as l, makeStringProp as m, numericProp as n, pick as p, stdin_default as s, truthProp as t, unknownProp as u, withInstall as w };
//# sourceMappingURL=index-Cr7WIrmx.mjs.map