@nmgolden/zui
Version:
mobile ui framework
1,484 lines • 81.2 kB
JavaScript
import { defineComponent, ref, watch, openBlock, createElementBlock, normalizeClass, Fragment, renderList, createElementVNode, toDisplayString, withModifiers, createCommentVNode, pushScopeId, popScopeId, renderSlot, computed, unref, nextTick, onMounted, withDirectives, normalizeStyle, vModelDynamic, vModelText, createTextVNode, resolveComponent, createVNode, withCtx, createBlock, getCurrentInstance, Teleport, Transition, mergeProps, isRef, reactive } from "vue";
import dateUtils from "@nmgolden/date-utils";
import Sortable from "sortablejs";
const base = "";
const _withScopeId$9 = (n) => (pushScopeId("data-v-939f4827"), n = n(), popScopeId(), n);
const _hoisted_1$k = {
key: 0,
class: "attachments"
};
const _hoisted_2$h = ["onClick"];
const _hoisted_3$e = { class: "name" };
const _hoisted_4$c = ["onClick"];
const _hoisted_5$9 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ createElementVNode("div", { class: "icon iconfont-zui icon-zui-plus" }, null, -1));
const _hoisted_6$7 = ["disabled"];
const _hoisted_7$6 = {
key: 2,
class: "empty"
};
const _sfc_main$q = /* @__PURE__ */ defineComponent({
__name: "ZuiAttachment",
props: {
modelValue: {
type: Array,
default: () => []
},
max: { type: Number, default: 3 },
editActions: { type: Array, default: ["add", "remove"] },
disabled: Boolean,
readonly: Boolean
},
emits: ["update:modelValue", "fileSelect", "attachmentClick"],
setup(__props, { emit }) {
const props = __props;
const attachments = ref(props.modelValue);
watch(attachments, (val) => {
emit("update:modelValue", val);
});
watch(
() => props.modelValue,
(val) => {
attachments.value = val;
},
{ immediate: true }
);
const fileDom = ref();
function onFileChange() {
const file = fileDom.value.files[0];
emit("fileSelect", file);
fileDom.value.value = "";
}
function onRemoveAttachment(idx) {
attachments.value.splice(idx, 1);
}
function onAttachmentClick(attachment) {
emit("attachmentClick", attachment);
}
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass(["zui-attachment", { disabled: __props.disabled }])
}, [
attachments.value && attachments.value.length ? (openBlock(), createElementBlock("ul", _hoisted_1$k, [
(openBlock(true), createElementBlock(Fragment, null, renderList(attachments.value, (item, idx) => {
return openBlock(), createElementBlock("li", {
key: idx,
class: "attachment clickable",
onClick: ($event) => onAttachmentClick(item)
}, [
createElementVNode("span", _hoisted_3$e, toDisplayString(item.name), 1),
!__props.readonly && __props.editActions.includes("remove") ? (openBlock(), createElementBlock("i", {
key: 0,
class: "remove iconfont-zui icon-zui-x clickable",
onClick: withModifiers(($event) => !__props.disabled && onRemoveAttachment(idx), ["stop"])
}, null, 8, _hoisted_4$c)) : createCommentVNode("", true)
], 8, _hoisted_2$h);
}), 128))
])) : createCommentVNode("", true),
!__props.readonly && (attachments.value && attachments.value.length) < __props.max && __props.editActions.includes("add") ? (openBlock(), createElementBlock("div", {
key: 1,
class: normalizeClass(["add-btn", [__props.disabled]])
}, [
_hoisted_5$9,
createElementVNode("input", {
class: "add",
type: "file",
accept: "*/*",
onChange: onFileChange,
ref_key: "fileDom",
ref: fileDom,
disabled: __props.disabled
}, null, 40, _hoisted_6$7)
], 2)) : createCommentVNode("", true),
__props.readonly && (!attachments.value || !attachments.value.length) ? (openBlock(), createElementBlock("div", _hoisted_7$6, "未上传")) : createCommentVNode("", true)
], 2);
};
}
});
const ZuiAttachment_vue_vue_type_style_index_0_scoped_939f4827_lang = "";
const _export_sfc = (sfc, props) => {
const target = sfc.__vccOpts || sfc;
for (const [key, val] of props) {
target[key] = val;
}
return target;
};
const Attachment = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-939f4827"]]);
const index$m = {
install(Vue) {
Vue.component("ZuiAttachment", Attachment);
}
};
const _withScopeId$8 = (n) => (pushScopeId("data-v-0ce5d0cc"), n = n(), popScopeId(), n);
const _hoisted_1$j = ["disabled"];
const _hoisted_2$g = {
key: 0,
viewBox: "25 25 50 50",
class: "van-loading"
};
const _hoisted_3$d = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ createElementVNode("circle", {
cx: "50",
cy: "50",
r: "20",
fill: "none"
}, null, -1));
const _hoisted_4$b = [
_hoisted_3$d
];
const _sfc_main$p = /* @__PURE__ */ defineComponent({
__name: "ZuiButton",
props: {
bold: Boolean,
size: {
type: String
},
type: String,
round: Boolean,
circle: Boolean,
loading: Boolean,
disabled: Boolean,
noBorderRadius: Boolean
},
setup(__props) {
return (_ctx, _cache) => {
return openBlock(), createElementBlock("button", {
class: normalizeClass(["zui-button", [
__props.size,
__props.type,
__props.bold,
__props.round ? "round" : "",
__props.circle ? "circle" : "",
__props.disabled ? "disabled" : "",
__props.loading ? "loading" : "",
__props.noBorderRadius ? "no-border-radius" : ""
]]),
disabled: __props.disabled || __props.loading
}, [
__props.loading ? (openBlock(), createElementBlock("svg", _hoisted_2$g, _hoisted_4$b)) : renderSlot(_ctx.$slots, "default", { key: 1 }, void 0, true)
], 10, _hoisted_1$j);
};
}
});
const ZuiButton_vue_vue_type_style_index_0_scoped_0ce5d0cc_lang = "";
const ZuiButton = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-0ce5d0cc"]]);
const index$l = {
install(Vue) {
Vue.component("ZuiButton", ZuiButton);
}
};
const ZuiCalendar_vue_vue_type_style_index_0_scoped_8fdab1d1_lang = "";
const _hoisted_1$i = { class: "zui-calendar" };
const _hoisted_2$f = { class: "week" };
const _hoisted_3$c = { class: "dates" };
const _hoisted_4$a = ["onClick"];
const _hoisted_5$8 = {
key: 0,
class: "bottom-text"
};
const _sfc_main$o = {
__name: "ZuiCalendar",
props: {
monthDate: {
type: Object,
default: () => new Date()
},
curDate: {
type: Object,
default: () => new Date()
},
minDate: { type: Date, default: dateUtils.getDateByOffset(-60) },
maxDate: { type: Date, default: new Date() },
formatter: Function
},
emits: ["dateClick", "dateChange", "update:curDate"],
setup(__props, { emit }) {
const props = __props;
const curDate = ref();
const days = computed(() => {
const lastDate = dateUtils.getLastDateOfMonth(props.monthDate);
const amount = lastDate.getDate();
const days2 = [];
for (let i = 0; ++i <= amount; ) {
days2.push({ date: getDateByDateNum(i), num: i, text: i.toString(), bottomText: "" });
}
if (props.formatter) {
return days2.map((item) => {
return props.formatter(item);
});
} else {
return days2;
}
function getDateByDateNum(dateNum) {
const [year, month, day] = [props.monthDate.getFullYear(), props.monthDate.getMonth(), dateNum];
return new Date(year, month, day);
}
});
const dayOffset = computed(() => {
const firstDate = dateUtils.getFirstDateOfMonth(props.monthDate);
const firstDay = firstDate.getDay();
return (firstDay - 1 + 7) % 7;
});
watch(
() => props.curDate,
(value) => {
curDate.value = value;
}
);
watch(curDate, (value) => {
emit("dateChange", value);
emit("update:curDate", value);
});
function isToday(date) {
return dateUtils.isToday(date);
}
function isCurDate(date) {
return dateUtils.isSameDate(curDate.value, date);
}
function isExceeded(date) {
return date > props.maxDate || date < props.minDate;
}
function onDateClick(day) {
if (isExceeded(day.date)) {
return;
}
curDate.value = day.date;
emit("dateClick", day);
}
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", _hoisted_1$i, [
createElementVNode("div", _hoisted_2$f, [
(openBlock(), createElementBlock(Fragment, null, renderList("一二三四五六日", (day) => {
return createElementVNode("span", {
class: "day",
key: day
}, toDisplayString(day), 1);
}), 64))
]),
createElementVNode("div", _hoisted_3$c, [
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(dayOffset), (i) => {
return openBlock(), createElementBlock("div", {
class: "date-block",
key: i
});
}), 128)),
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(days), (day) => {
return openBlock(), createElementBlock("div", {
class: "date-block",
key: day.num
}, [
createElementVNode("div", {
class: normalizeClass(["date", { highlight: day.bottomText, today: isToday(day.date), exceeded: isExceeded(day.date) }]),
onClick: ($event) => onDateClick(day)
}, [
createElementVNode("span", {
class: normalizeClass(["date-num", { active: isCurDate(day.date) }])
}, toDisplayString(day.text), 3),
day.bottomText ? (openBlock(), createElementBlock("span", _hoisted_5$8, toDisplayString(day.bottomText), 1)) : createCommentVNode("", true)
], 10, _hoisted_4$a)
]);
}), 128))
])
]);
};
}
};
const Calendar = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-8fdab1d1"]]);
const index$k = {
install(Vue) {
Vue.component("ZuiCalendar", Calendar);
}
};
const ZuiDeletable_vue_vue_type_style_index_0_scoped_5575db45_lang = "";
const _sfc_main$n = {
emits: ["delete"],
props: {
size: {
type: String,
default: "large"
},
show: {
type: Boolean,
default: true
},
hoverShadow: {
type: Boolean,
default: false
},
needPrompt: {
type: Boolean,
default: true
},
promptTitle: {
type: String,
default: "确认删除?"
},
confirmText: {
type: String,
default: "删除"
},
cancelText: {
type: String,
default: "取消"
}
},
methods: {
onDelete() {
this.$emit("delete");
}
}
};
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", {
class: normalizeClass(["zui-deletable", { "hover-shadow": $props.hoverShadow }])
}, [
renderSlot(_ctx.$slots, "default", {}, void 0, true)
], 2);
}
const Deletable = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$3], ["__scopeId", "data-v-5575db45"]]);
const index$j = {
install(Vue) {
Vue.component("ZuiDeletable", Deletable);
}
};
const _withScopeId$7 = (n) => (pushScopeId("data-v-4210b94f"), n = n(), popScopeId(), n);
const _hoisted_1$h = ["type", "placeholder", "maxlength", "disabled", "readonly"];
const _hoisted_2$e = ["type", "placeholder", "rows", "disabled", "readonly"];
const _hoisted_3$b = { class: "current" };
const _hoisted_4$9 = ["onClick"];
const _hoisted_5$7 = /* @__PURE__ */ _withScopeId$7(() => /* @__PURE__ */ createElementVNode("i", { class: "icon iconfont-zui icon-zui-clear" }, null, -1));
const _hoisted_6$6 = [
_hoisted_5$7
];
const _hoisted_7$5 = {
key: 1,
class: "zui-input preview"
};
const _hoisted_8$4 = { key: 0 };
const _hoisted_9$4 = {
key: 1,
class: "empty"
};
const _sfc_main$m = /* @__PURE__ */ defineComponent({
__name: "ZuiInput",
props: {
textAlign: {
type: String,
default: "left"
},
type: String,
size: String,
autoHeight: Boolean,
multiline: Boolean,
lines: { type: Number, default: 3 },
hideBorder: Boolean,
round: Boolean,
padding: { type: String, default: "6px 8px 6px 12px" },
placeholder: String,
modelValue: { type: [String, Number], default: "" },
showWordLimit: Boolean,
maxWordLength: {
type: Number,
default: 99999
},
clearable: Boolean,
disabled: Boolean,
readonly: Boolean,
preview: Boolean,
showEye: Boolean,
autoFocus: Boolean
},
emits: ["update:modelValue", "blur"],
setup(__props, { emit }) {
const props = __props;
const inputRef = ref();
const value = ref(props.modelValue);
watch(
() => props.modelValue,
(val) => {
value.value = val;
}
);
watch(value, (val) => {
emit("update:modelValue", val);
});
const inputStyle = {
textAlign: props.textAlign,
padding: props.padding
};
const paddingRight = computed(() => {
const paddingStyle = inputStyle.padding || "0";
const paddings = paddingStyle.toString().split(" ");
if (paddings.length == 4) {
return paddings[1];
} else if (paddings.length == 2) {
return paddings[1];
} else if (paddings.length == 1) {
return paddings[0];
}
return "8px";
});
const forceUpdateKey = ref(0);
const textareaRef = ref();
watch(value, (newVal, oldVal) => {
if (oldVal == newVal) {
return;
}
if (props.autoHeight) {
forceUpdateKey.value += 1;
nextTick(() => {
changeTextareaHeight();
});
}
function changeTextareaHeight() {
if (!textareaRef.value) {
return;
}
textareaRef.value.scrollHeight;
textareaRef.value.offsetHeight;
textareaRef.value.style.height = "auto";
textareaRef.value.style.height = Math.min(textareaRef.value.scrollHeight - 8, 200) + "px";
}
});
const maxReached = computed(() => {
return value.value && String(value.value).length >= props.maxWordLength;
});
watch(value, (inputValue) => {
if (maxReached.value) {
value.value = String(inputValue).substring(0, props.maxWordLength);
}
});
const wordLimitPaddingStyle = computed(() => {
return {
paddingLeft: "0px",
paddingRight: value.value && props.clearable ? "0px" : paddingRight.value
};
});
const clearCss = {
paddingLeft: "8px",
paddingRight: paddingRight.value
};
function onClearTap() {
value.value = "";
}
const showPassword = ref(false);
function onEyeClick() {
showPassword.value = !showPassword.value;
console.log("showPassword.value :>> ", showPassword.value);
}
onMounted(() => {
if (props.autoFocus) {
const dom = inputRef.value || textareaRef.value;
dom && dom.focus();
}
});
return (_ctx, _cache) => {
return !__props.preview ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(["zui-input", {
round: __props.round,
border: !__props.hideBorder,
disabled: __props.disabled,
"zui-input-large": __props.size === "large",
"zui-input-small": __props.size === "small",
multiline: __props.multiline
}])
}, [
renderSlot(_ctx.$slots, "prefix", {}, void 0, true),
!__props.autoHeight && !__props.multiline ? withDirectives((openBlock(), createElementBlock("input", {
key: 0,
class: "input",
style: normalizeStyle(unref(inputStyle)),
type: showPassword.value ? "text" : __props.type,
placeholder: __props.placeholder,
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
maxlength: __props.maxWordLength,
disabled: __props.disabled,
readonly: __props.readonly,
onBlur: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("blur")),
ref_key: "inputRef",
ref: inputRef
}, null, 44, _hoisted_1$h)), [
[vModelDynamic, value.value]
]) : withDirectives((openBlock(), createElementBlock("textarea", {
key: 1,
class: "textarea",
style: normalizeStyle(unref(inputStyle)),
type: __props.type,
placeholder: __props.placeholder,
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => value.value = $event),
rows: __props.autoHeight ? 1 : __props.lines,
disabled: __props.disabled,
readonly: __props.readonly,
ref_key: "textareaRef",
ref: textareaRef,
onBlur: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("blur"))
}, null, 44, _hoisted_2$e)), [
[vModelText, value.value]
]),
__props.showWordLimit ? (openBlock(), createElementBlock("span", {
key: 2,
class: normalizeClass(["word-limit", { danger: unref(maxReached) }]),
style: normalizeStyle(unref(wordLimitPaddingStyle))
}, [
createElementVNode("span", _hoisted_3$b, toDisplayString(!value.value ? 0 : String(value.value).length), 1),
createTextVNode("/" + toDisplayString(__props.maxWordLength), 1)
], 6)) : createCommentVNode("", true),
value.value && __props.clearable ? (openBlock(), createElementBlock("span", {
key: 3,
class: "clear clickable",
style: normalizeStyle(unref(clearCss)),
onClick: withModifiers(onClearTap, ["stop"])
}, _hoisted_6$6, 12, _hoisted_4$9)) : createCommentVNode("", true),
__props.showEye ? (openBlock(), createElementBlock("div", {
key: 4,
class: "eye-wrap",
onClick: onEyeClick
}, [
__props.type == "password" ? (openBlock(), createElementBlock("span", {
key: 0,
class: normalizeClass(["icon iconfont-zui", {
"icon-zui-eye": showPassword.value,
"icon-zui-eye-slash": !showPassword.value
}])
}, null, 2)) : createCommentVNode("", true)
])) : createCommentVNode("", true),
renderSlot(_ctx.$slots, "suffix", {}, void 0, true)
], 2)) : (openBlock(), createElementBlock("div", _hoisted_7$5, [
__props.modelValue ? (openBlock(), createElementBlock("span", _hoisted_8$4, toDisplayString(__props.modelValue), 1)) : (openBlock(), createElementBlock("span", _hoisted_9$4, "未填写"))
]));
};
}
});
const ZuiInput_vue_vue_type_style_index_0_scoped_4210b94f_lang = "";
const ZuiInput = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-4210b94f"]]);
const index$i = {
install(Vue) {
Vue.component("ZuiInput", ZuiInput);
}
};
const _hoisted_1$g = {
key: 0,
class: "required"
};
const _hoisted_2$d = { class: "accessory" };
const _hoisted_3$a = { class: "value-wrap" };
const _hoisted_4$8 = {
key: 0,
class: "value"
};
const _hoisted_5$6 = {
key: 1,
class: "placeholder"
};
const _hoisted_6$5 = {
key: 0,
class: "arrow-right iconfont-zui icon-zui-arrow-right-round"
};
const _sfc_main$l = /* @__PURE__ */ defineComponent({
__name: "ZuiField",
props: {
round: Boolean,
showShadow: Boolean,
padding: String,
hideLabel: Boolean,
labelPosition: {
type: String,
default: "left"
},
clickable: {
type: Boolean,
default: true
},
label: String,
labelColor: {
type: String,
default: ""
},
labelStyle: {
type: String,
default: "strong"
},
required: Boolean,
fadeLabel: Boolean,
value: [String, Number, Boolean],
placeholder: String,
showArrowRight: {
type: Boolean,
default: true
}
},
setup(__props) {
const props = __props;
const style = { padding: props.padding || "12px 20px" };
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass(["zui-field", {
"label-position-top": __props.labelPosition == "top",
round: __props.round,
shadow: __props.showShadow,
padding: __props.padding,
clickable: __props.clickable,
"fade-label": __props.fadeLabel && __props.value
}]),
style
}, [
!__props.hideLabel ? (openBlock(), createElementBlock("h1", {
key: 0,
class: normalizeClass(["label-wrap", [__props.labelStyle, __props.label ? "label-min-width" : ""]]),
style: normalizeStyle({ color: __props.labelColor })
}, [
createElementVNode("label", null, toDisplayString(__props.label), 1),
__props.required ? (openBlock(), createElementBlock("span", _hoisted_1$g, "*")) : createCommentVNode("", true)
], 6)) : createCommentVNode("", true),
renderSlot(_ctx.$slots, "accessory", {}, () => [
createElementVNode("div", _hoisted_2$d, [
createElementVNode("span", _hoisted_3$a, [
__props.value ? (openBlock(), createElementBlock("h5", _hoisted_4$8, toDisplayString(__props.value), 1)) : (openBlock(), createElementBlock("span", _hoisted_5$6, toDisplayString(__props.placeholder), 1))
]),
__props.showArrowRight ? (openBlock(), createElementBlock("i", _hoisted_6$5)) : createCommentVNode("", true)
])
], true)
], 2);
};
}
});
const ZuiField_vue_vue_type_style_index_0_scoped_a96be6cb_lang = "";
const Field = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-a96be6cb"]]);
const index$h = {
install(Vue) {
Vue.component("ZuiField", Field);
}
};
const ZuiFieldGroup_vue_vue_type_style_index_0_scoped_f35d964e_lang = "";
const _sfc_main$k = {
__name: "ZuiFieldGroup",
props: {
title: String,
titleStyle: {
type: String,
default: "strong"
},
titlePosition: {
type: String,
default: "inner"
},
borders: {
type: String,
default: "none"
},
divider: {
type: Boolean,
default: true
}
},
setup(__props) {
const props = __props;
const style = { "border-top-width": props.titlePosition == "outer" ? "0.5px" : "" };
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass(["zui-field-group", {
"top-border": __props.borders === "top" || __props.borders === "all",
"bottom-border": __props.borders === "bottom" || __props.borders === "all"
}]),
style
}, [
createElementVNode("header", null, [
renderSlot(_ctx.$slots, "header", {}, () => [
__props.title ? (openBlock(), createElementBlock("h1", {
key: 0,
class: normalizeClass(["title", [__props.titleStyle, __props.titlePosition]])
}, toDisplayString(__props.title), 3)) : createCommentVNode("", true)
], true)
]),
createElementVNode("main", {
class: normalizeClass(["fields", { divider: __props.divider }])
}, [
renderSlot(_ctx.$slots, "default", {}, void 0, true)
], 2)
], 2);
};
}
};
const FieldGroup = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-f35d964e"]]);
const index$g = {
install(Vue) {
Vue.component("ZuiFieldGroup", FieldGroup);
}
};
const _sfc_main$j = /* @__PURE__ */ defineComponent({
__name: "ZuiInputField",
props: {
modelValue: String,
type: String,
round: Boolean,
showShadow: Boolean,
labelPosition: String,
labelStyle: String,
label: String,
required: Boolean,
multiline: Boolean,
showWordLimit: Boolean,
maxWordLength: Number,
placeholder: String,
clearable: Boolean,
textAlign: String,
readonly: Boolean
},
emits: ["update:modelValue"],
setup(__props, { emit }) {
const props = __props;
const fieldPadding = props.labelPosition == "top" ? "16px 20px 12px 20px" : "4px 20px";
const value = ref(props.modelValue);
watch(
() => props.modelValue,
(val) => {
value.value = val;
}
);
watch(value, (inputValue) => {
emit("update:modelValue", inputValue);
});
return (_ctx, _cache) => {
const _component_zui_input = resolveComponent("zui-input");
const _component_zui_field = resolveComponent("zui-field");
return openBlock(), createElementBlock("div", {
class: normalizeClass(["zui-input-field", { "label-position-top": __props.labelPosition == "top" }])
}, [
createVNode(_component_zui_field, {
class: "field",
padding: unref(fieldPadding),
required: __props.required,
"label-position": __props.labelPosition,
"label-style": __props.labelStyle,
round: __props.round,
"show-shadow": __props.showShadow,
label: __props.label,
clickable: false
}, {
accessory: withCtx(() => [
createVNode(_component_zui_input, {
padding: "8px 0",
class: "input",
type: __props.type,
"show-border": false,
modelValue: value.value,
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
multiline: __props.multiline,
"show-word-limit": __props.showWordLimit,
"max-word-length": __props.maxWordLength,
placeholder: __props.placeholder,
clearable: __props.clearable,
textAlign: __props.textAlign,
readonly: __props.readonly
}, null, 8, ["type", "modelValue", "multiline", "show-word-limit", "max-word-length", "placeholder", "clearable", "textAlign", "readonly"])
]),
_: 1
}, 8, ["padding", "required", "label-position", "label-style", "round", "show-shadow", "label"])
], 2);
};
}
});
const ZuiInputField_vue_vue_type_style_index_0_scoped_dd2c7fb0_lang = "";
const InputField = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-dd2c7fb0"]]);
const index$f = {
install(Vue) {
Vue.component("ZuiInputField", InputField);
}
};
const ZuiLoading_vue_vue_type_style_index_0_scoped_1f764c79_lang = "";
const _withScopeId$6 = (n) => (pushScopeId("data-v-1f764c79"), n = n(), popScopeId(), n);
const _hoisted_1$f = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ createElementVNode("div", { class: "dots" }, [
/* @__PURE__ */ createElementVNode("div", {
class: "object object-1",
style: { "transform": "scale(0)" }
}),
/* @__PURE__ */ createElementVNode("div", {
class: "object object-2",
style: { "transform": "scale(0)" }
}),
/* @__PURE__ */ createElementVNode("div", {
class: "object object-3",
style: { "transform": "scale(0)" }
})
], -1));
const _hoisted_2$c = {
key: 0,
class: "msg"
};
const _sfc_main$i = {
__name: "ZuiLoading",
props: {
msg: { type: String, default: "加载中..." },
showMsg: Boolean,
showBackground: Boolean,
forbidClick: Boolean,
size: { type: String, default: "large" },
position: {
type: String,
default: "center"
}
},
setup(__props) {
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass(["loading", [__props.position, __props.size, __props.forbidClick ? "fill" : ""]])
}, [
createElementVNode("div", {
class: normalizeClass(["loading-center", { bg: __props.showBackground }])
}, [
_hoisted_1$f,
__props.showMsg ? (openBlock(), createElementBlock("p", _hoisted_2$c, toDisplayString(__props.msg), 1)) : createCommentVNode("", true)
], 2)
], 2);
};
}
};
const Loading = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-1f764c79"]]);
const Index_vue_vue_type_style_index_0_scoped_06a7a791_lang = "";
const _hoisted_1$e = { class: "images" };
const _hoisted_2$b = ["onClick"];
const _hoisted_3$9 = ["src"];
const _hoisted_4$7 = { class: "tags-wrap" };
const _hoisted_5$5 = {
key: 0,
class: "tags"
};
const _hoisted_6$4 = {
key: 0,
class: "remove-wrap"
};
const _hoisted_7$4 = ["onClick"];
const _hoisted_8$3 = {
key: 0,
class: "icon iconfont-zui icon-zui-camera"
};
const _hoisted_9$3 = {
key: 0,
class: "empty"
};
const _sfc_main$h = {
__name: "Index",
props: {
modelValue: { type: Array, default: [] },
disabled: Boolean,
readonly: Boolean,
loading: Boolean,
padding: { type: String, default: "16px 20px" },
editActions: { type: Array, default: ["add", "remove"] },
max: {
type: Number,
default: 9
}
},
emits: ["update:modelValue", "addClick", "imageClick", "remove"],
setup(__props, { emit }) {
const props = __props;
const images = ref();
const imageUrls = computed(() => {
return images.value.map((item) => item.url);
});
watch(images, (val) => [emit("update:modelValue", val)]);
watch(
() => props.modelValue,
(val) => {
images.value = val;
},
{
immediate: true
}
);
async function onAddClick() {
emit("addClick");
}
function onRemoveClick(idx) {
emit("remove", idx);
}
function onImageClick(idx) {
emit("imageClick", idx);
}
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass(["zui-image-uploader", { disabled: __props.disabled }])
}, [
createElementVNode("ul", _hoisted_1$e, [
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(imageUrls), (url, idx) => {
return openBlock(), createElementBlock("li", {
key: idx,
class: "image-wrap clickable",
onClick: ($event) => onImageClick(idx)
}, [
createElementVNode("img", {
class: "image",
src: url
}, null, 8, _hoisted_3$9),
createElementVNode("div", _hoisted_4$7, [
images.value[idx]["tags"] ? (openBlock(), createElementBlock("ul", _hoisted_5$5, [
(openBlock(true), createElementBlock(Fragment, null, renderList(images.value[idx]["tags"], (tag, tagIdx) => {
return openBlock(), createElementBlock("li", { key: tagIdx }, toDisplayString(tag), 1);
}), 128))
])) : createCommentVNode("", true),
images.value[idx]["loading"] ? (openBlock(), createBlock(Loading, {
key: 1,
class: "loading",
position: "inline",
size: "xsmall"
})) : createCommentVNode("", true)
]),
!__props.readonly && __props.editActions.includes("remove") ? (openBlock(), createElementBlock("span", _hoisted_6$4, [
createElementVNode("i", {
class: "remove iconfont-zui icon-zui-x clickable",
onClick: withModifiers(($event) => onRemoveClick(idx), ["stop"])
}, null, 8, _hoisted_7$4)
])) : createCommentVNode("", true)
], 8, _hoisted_2$b);
}), 128)),
!__props.readonly && unref(imageUrls).length < __props.max && __props.editActions.includes("add") ? (openBlock(), createElementBlock("li", {
key: 0,
class: normalizeClass(["image-wrap add-btn", { loading: __props.loading }]),
onClick: _cache[0] || (_cache[0] = ($event) => !__props.loading && onAddClick())
}, [
!__props.loading ? (openBlock(), createElementBlock("div", _hoisted_8$3)) : (openBlock(), createBlock(Loading, {
key: 1,
class: "loading",
position: "inline",
size: "xsmall"
}))
], 2)) : createCommentVNode("", true)
]),
__props.readonly && !images.value.length ? (openBlock(), createElementBlock("div", _hoisted_9$3, "未上传")) : createCommentVNode("", true)
], 2);
};
}
};
const ImageUploader = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-06a7a791"]]);
const index$e = {
install(Vue) {
Vue.component("ZuiImageUploader", ImageUploader);
}
};
const index$d = {
install(Vue) {
Vue.component("ZuiLoading", Loading);
}
};
const ZuiMonth_vue_vue_type_style_index_0_lang = "";
const _hoisted_1$d = { class: "zui-month" };
const _hoisted_2$a = {
key: 0,
class: "year-wrap"
};
const _hoisted_3$8 = { class: "left btn-wrap" };
const _hoisted_4$6 = /* @__PURE__ */ createElementVNode("i", { class: "icon-left iconfont-zui icon-zui-arrow-left" }, null, -1);
const _hoisted_5$4 = { class: "year" };
const _hoisted_6$3 = { class: "right btn-wrap" };
const _hoisted_7$3 = /* @__PURE__ */ createElementVNode("i", { class: "icon-right iconfont-zui icon-zui-arrow-right" }, null, -1);
const _hoisted_8$2 = { class: "month-wrap" };
const _hoisted_9$2 = ["onClick"];
const _sfc_main$g = {
__name: "ZuiMonth",
props: {
modelValue: { type: Date, default: () => new Date() },
maxDate: {
type: Date,
default: dateUtils.getFirstDateOfMonth(dateUtils.getToday())
},
minDate: {
type: Date,
default: new Date(2021, 0, 1)
},
showYear: { type: Boolean, default: true },
allowExceed: Boolean
},
emits: ["update:modelValue", "yearChange", "monthChange"],
setup(__props, { emit }) {
const props = __props;
const curDate = ref(props.modelValue);
const monthRefs = ref();
const curYear = computed(() => {
if (!curDate.value) {
return;
}
return curDate.value.getFullYear();
});
const curMonth = computed(() => {
if (!curDate.value) {
return;
}
return curDate.value.getMonth() + 1;
});
const canPrevYearClick = computed(() => {
return curYear.value > props.minDate.getFullYear();
});
const canNextYearClick = computed(() => {
return curYear.value < props.maxDate.getFullYear();
});
watch(
() => props.modelValue,
(value) => {
curDate.value = value;
}
);
watch(curDate, (value) => {
emit("update:modelValue", value);
});
watch(curYear, (value, old) => {
emit("yearChange", value);
});
watch(curMonth, (val, old) => {
emit("monthChange", val);
nextTick(() => {
monthRefs.value[val - 1].scrollIntoView();
});
});
onMounted(() => {
curDate.value = props.modelValue;
});
if (!curDate.value) {
curDate.value = dateUtils.getFirstDateOfMonth(dateUtils.getToday());
}
function isCurMonth(month) {
if (!curDate.value) {
return false;
}
return month - 1 == curDate.value.getMonth();
}
function exceeded(month) {
const exceedMax = curYear.value > props.maxDate.getFullYear() || curYear.value == props.maxDate.getFullYear() && month - 1 > props.maxDate.getMonth();
const exceedMin = curYear.value < props.minDate.getFullYear() || curYear.value == props.minDate.getFullYear() && month - 1 < props.minDate.getMonth();
return exceedMax || exceedMin;
}
function onMonthClick(month) {
if (!props.allowExceed && exceeded(month)) {
return;
}
const newDate = new Date(Date.UTC(curYear.value, month - 1, 1));
curDate.value = newDate;
}
function onPrevYearClick() {
const newDate = new Date(Date.UTC(curYear.value - 1, 0, 1));
curDate.value = newDate;
}
function onNextYearClick() {
const newDate = new Date(Date.UTC(curYear.value + 1, 0, 1));
curDate.value = newDate;
}
return (_ctx, _cache) => {
const _component_zui_button = resolveComponent("zui-button");
return openBlock(), createElementBlock("div", _hoisted_1$d, [
__props.showYear ? (openBlock(), createElementBlock("div", _hoisted_2$a, [
createElementVNode("div", _hoisted_3$8, [
createVNode(_component_zui_button, {
circle: "",
type: "secondary",
size: "small",
disabled: !unref(canPrevYearClick),
onClick: onPrevYearClick
}, {
default: withCtx(() => [
_hoisted_4$6
]),
_: 1
}, 8, ["disabled"])
]),
createElementVNode("span", _hoisted_5$4, toDisplayString(unref(curYear)) + "年", 1),
createElementVNode("div", _hoisted_6$3, [
createVNode(_component_zui_button, {
circle: "",
type: "secondary",
disabled: !unref(canNextYearClick),
size: "small",
onClick: onNextYearClick
}, {
default: withCtx(() => [
_hoisted_7$3
]),
_: 1
}, 8, ["disabled"])
])
])) : createCommentVNode("", true),
createElementVNode("ul", _hoisted_8$2, [
(openBlock(), createElementBlock(Fragment, null, renderList(12, (month) => {
return createElementVNode("li", {
class: normalizeClass(["month", { active: isCurMonth(month), disabled: !__props.allowExceed && exceeded(month) }]),
key: month,
onClick: ($event) => onMonthClick(month),
ref_for: true,
ref_key: "monthRefs",
ref: monthRefs
}, toDisplayString(month) + toDisplayString(!isCurMonth(month) ? "月" : ""), 11, _hoisted_9$2);
}), 64))
])
]);
};
}
};
const index$c = {
install(Vue) {
Vue.component("ZuiMonth", _sfc_main$g);
}
};
const ZuiPlaceholder_vue_vue_type_style_index_0_scoped_a3c8f861_lang = "";
const types = { EMPTY: "empty", NETWORK_ERROR: "network-error" };
const _sfc_main$f = {
emits: ["buttonClick"],
components: {},
props: {
type: {
type: String,
default: types.EMPTY
},
title: String,
showButton: Boolean,
buttonText: String
},
data() {
return {};
},
computed: {
computedButtonText() {
if (this.buttonText) {
return this.buttonText;
}
if (this.type == types.EMPTY) {
return "添加";
}
if (this.type == types.NETWORK_ERROR) {
return "重新加载";
}
},
computedTitle() {
if (this.title) {
return this.title;
} else {
if (this.type == types.EMPTY) {
return "暂无内容";
} else if (this.type == types.NETWORK_ERROR) {
return "网络错误请重试";
}
}
return "空";
}
},
methods: {
onBtnTap() {
this.$emit("buttonClick");
}
}
};
const _hoisted_1$c = { class: "zui-placeholder" };
const _hoisted_2$9 = { class: "content-wrap" };
const _hoisted_3$7 = {
key: 0,
class: "icon iconfont-zui icon-zui-empty"
};
const _hoisted_4$5 = {
key: 1,
class: "icon iconfont-zui icon-zui-network-error"
};
const _hoisted_5$3 = { class: "title" };
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
const _component_zui_button = resolveComponent("zui-button");
return openBlock(), createElementBlock("div", _hoisted_1$c, [
createElementVNode("div", _hoisted_2$9, [
$props.type == "empty" ? (openBlock(), createElementBlock("i", _hoisted_3$7)) : $props.type == "network-error" ? (openBlock(), createElementBlock("i", _hoisted_4$5)) : createCommentVNode("", true),
createElementVNode("h5", _hoisted_5$3, toDisplayString($options.computedTitle), 1),
$props.showButton ? (openBlock(), createBlock(_component_zui_button, {
key: 2,
class: "button",
round: "",
size: "small",
type: "primary",
onClick: $options.onBtnTap
}, {
default: withCtx(() => [
createTextVNode(toDisplayString($options.computedButtonText), 1)
]),
_: 1
}, 8, ["onClick"])) : createCommentVNode("", true)
])
]);
}
const Placeholder = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$2], ["__scopeId", "data-v-a3c8f861"]]);
const index$b = {
install(Vue) {
Vue.component("ZuiPlaceholder", Placeholder);
}
};
const ZuiSwitch_vue_vue_type_style_index_0_scoped_eee5343c_lang = "";
const _withScopeId$5 = (n) => (pushScopeId("data-v-eee5343c"), n = n(), popScopeId(), n);
const _hoisted_1$b = { class: "zui-switch" };
const _hoisted_2$8 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ createElementVNode("em", null, null, -1));
const _hoisted_3$6 = { class: "yes" };
const _hoisted_4$4 = { class: "no" };
const _sfc_main$e = {
__name: "ZuiSwitch",
props: {
modelValue: Boolean,
yesText: {
type: String,
default: "是"
},
noText: {
type: String,
default: "否"
}
},
emits: ["update:modelValue"],
setup(__props, { emit }) {
const props = __props;
const value = ref(!!props.modelValue);
watch(
() => props.modelValue,
(val) => {
value.value = val;
}
);
watch(value, (val) => {
emit("update:modelValue", val);
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", _hoisted_1$b, [
createElementVNode("div", {
class: normalizeClass(["switch", { negative: !value.value }]),
onClick: _cache[0] || (_cache[0] = ($event) => value.value = !value.value)
}, [
_hoisted_2$8,
createElementVNode("span", _hoisted_3$6, toDisplayString(__props.yesText), 1),
createElementVNode("span", _hoisted_4$4, toDisplayString(__props.noText), 1)
], 2)
]);
};
}
};
const Switch = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-eee5343c"]]);
const index$a = {
install(Vue) {
Vue.component("ZuiSwitch", Switch);
}
};
const _sfc_main$d = /* @__PURE__ */ defineComponent({
__name: "ZuiSwitchField",
props: {
modelValue: Boolean,
round: Boolean,
showShadow: Boolean,
labelPosition: String,
labelStyle: String,
label: String,
yesText: String,
noText: String
},
emits: ["update:modelValue"],
setup(__props, { emit }) {
const props = __props;
const value = ref(props.modelValue);
watch(
() => props.modelValue,
(val) => {
value.value = val;
}
);
watch(value, (inputValue) => {
emit("update:modelValue", inputValue);
});
const fieldPadding = props.labelPosition == "top" ? "16px 20px 12px 20px" : "4px 20px";
return (_ctx, _cache) => {
const _component_zui_switch = resolveComponent("zui-switch");
const _component_zui_field = resolveComponent("zui-field");
return openBlock(), createElementBlock("div", {
class: normalizeClass(["zui-switch-field", { "label-position-top": __props.labelPosition == "top" }])
}, [
createVNode(_component_zui_field, {
class: "field",
padding: unref(fieldPadding),
"label-position": __props.labelPosition,
"label-style": __props.labelStyle,
round: __props.round,
"show-shadow": __props.showShadow,
label: __props.label,
clickable: false
}, {
accessory: withCtx(() => [
createVNode(_component_zui_switch, {
modelValue: value.value,
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
"yes-Text": __props.yesText,
"no-text": __props.noText
}, null, 8, ["modelValue", "yes-Text", "no-text"])
]),
_: 1
}, 8, ["padding", "label-position", "label-style", "round", "show-shadow", "label"])
], 2);
};
}
});
const index$9 = {
install(Vue) {
Vue.component("ZuiSwitchField", _sfc_main$d);
}
};
const _withScopeId$4 = (n) => (pushScopeId("data-v-f8278b2d"), n = n(), popScopeId(), n);
const _hoisted_1$a = { class: "sortable-inputs" };
const _hoisted_2$7 = {
key: 0,
class: "remove clickable"
};
const _hoisted_3$5 = ["onClick"];
const _hoisted_4$3 = {
key: 1,
class: "sequence"
};
const _hoisted_5$2 = {
key: 2,
class: "sort clickable"
};
const _hoisted_6$2 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ createElementVNode("i", { class: "icon iconfont-zui icon-zui-sort" }, null, -1));
const _hoisted_7$2 = [
_hoisted_6$2
];
const _sfc_main$c = /* @__PURE__ */ defineComponent({
__name: "ZuiSortableInputs",
props: {
modelValue: { default: () => [], type: Array },
showSequence: Boolean
},
emits: ["update:modelValue"],
setup(__props, { emit }) {
const props = __props;
const datas = ref([...props.modelValue, { text: "" }]);
watch(
() => props.modelValue,
(value) => {
datas.value = [...value, { text: "" }];
}
);
const items = ref();
nextTick(() => {
Sortable.create(items.value, {
handle: ".sort",
onEnd: function(evt) {
const { oldIndex: startIndex, newIndex: endIndex } = evt;
const dragData = datas.value[startIndex];
datas.value.splice(startIndex, 1);
datas.value.splice(endIndex, 0, dragData);
}
});
});
watch(
datas,
(newValue) => {
const lastData = newValue[newValue.length - 1];
if (lastData.text) {
datas.value.push({ text: "" });
}
if (newValue.length > 1) {
const penultData = newValue[newValue.length - 2];
if (!penultData.text) {
datas.value.pop();
}
}
},
{ deep: true }
);
function onRemove(idx, item) {
datas.value.splice(idx, 1);
}
watch(
datas,
(newValue) => {
const resolvedValue = newValue.slice(0, newValue.length - 1);
if (JSON.stringify(resolvedValue) == JSON.stringify(props.modelValue)) {
return;
}
emit("update:modelValue", resolvedValue);
},
{ deep: true }
);
return (_ctx, _cache) => {
const _component_zui_input = resolveComponent("zui-input");
return openBlock(), createElementBlock("div", _hoisted_1$a, [
createElementVNode("div", {
class: "items",
ref_key: "items",
ref: items
}, [
(openBlock(true), createElementBlock(Fragment, null, renderList(datas.value, (item, idx) => {
return openBlock(), createElementBlock("div", {
key: item,
class: "item"
}, [
idx != datas.value.length - 1 ? (openBlock(), createElementBlock("label", _hoisted_2$7, [
createElementVNode("i", {
class: "icon iconfont-zui icon-zui-remove",
onClick: ($event) => onRemove(idx)
}, null, 8, _hoisted_3$5)
])) : createCommentVNode("", true),
__props.showSequence ? (openBlock(), createElementBlock("label", _hoisted_4$3, toDisplayString(idx + 1) + ".", 1)) : createCommentVNode("", true),
createVNode(_component_zui_input, {
class: "input",
clear: "",
placeholder: "点击输入",
"text-align": "left",
"show-border": false,
modelValue: datas.value[idx]["text"],
"onUpdate:modelValue": ($event) => datas.value[idx]["text"] = $event,
padding: "12px 8px",
clearable: ""
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
idx != datas.value.length - 1 ? (openBlock(), createElementBlock("label", _hoisted_5$2, _hoisted_7$2)) : createCommentVNode("", true)
]);
}), 128))
], 512)
]);
};
}
});
const ZuiSortableInputs_vue_vue_type_style_index_0_scoped_f8278b2d_lang = "";
const SortableInputs = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-f8278b2d"]]);
const index$8 = {
install(Vue) {
Vue.component("ZuiSortableInputs", SortableInputs);
}
};
const _sfc_main$b = /* @__PURE__ */ defineComponent({
__name: "ZuiSortableInputsField",
props: {
modelValue: Array,
options: Array,
multiple: Boolean,
round: Boolean,
showShadow: Boolean,
labelPosition: String,
labelStyle: String,
label: String,
required: Boolean
},
emits: ["update:modelValue"],
setup(__props, { emit }) {
const props = __props;
const fieldPadding = props.labelPosition == "top" ? "16px 20px 12px 20px" : "0px 20px";
const value = ref(props.modelValue);
watch(
() => props.modelValue,
(val) => {
value.value = val;
}
);
watch(value, (inputValue) => {
emit("update:modelValue", inputValue);
});
return (_ctx, _cache) => {
const _component_zui_sortable_inputs = resolveComponent("zui-sortable-inputs");
const _component_zui_field = resolveComponent("zui-field");
return openBlock(), createElementBlock("div", {
class: normalizeClass(["zui-sortable-inputs-field", { "label-position-top": __props.labelPosition == "top" }])
}, [
createVNode(_component_zui_field, {
class: "field",
padding: unref(fieldPadding),
"label-position": __props.labelPosition,
"label-style": __props.labelStyle,
round: __props.round,
"show-shadow": __props.showShadow,
label: __props.label,
clickable: false,
req