UNPKG

vxe-table-pro

Version:

Vue table plugins based on vxe-table

135 lines (134 loc) 4.12 kB
import { defineComponent as W, mergeModels as M, useModel as F, resolveComponent as r, createElementBlock as v, openBlock as s, createCommentVNode as T, createVNode as c, createBlock as y, withCtx as h, normalizeStyle as x, unref as p, isRef as _, Fragment as U, renderList as I } from "vue"; import { _ as Q } from "./index-B8MbCfO1.mjs"; const j = { class: "flex justify-start align--center" }, z = { key: 0, class: "mr-[4px]" }, A = /* @__PURE__ */ W({ __name: "index", props: /* @__PURE__ */ M({ options: { type: Array, default: () => [] }, selectWidth: { type: Number, default: 100 }, inputWidth: { type: Number, default: 100 }, type: { type: String, default: "" }, tips: { type: String, default: "" } }, { modelValue: {}, modelModifiers: {} }), emits: ["update:modelValue"], setup(l) { const o = F(l, "modelValue"), m = l, a = ref(""), n = ref(""), u = ref(null); onBeforeMount(() => { V(); }); const k = computed(() => { const e = m.options.find((t) => t.value === a.value); return e ? `请输入${e.label}` : "请输入"; }); watch(o, () => { if (!o.value) { n.value = "", u.value = null; return; } let e = "", t = ""; for (const i in o.value) e = i, t = o.value[i]; (e !== a.value || t !== n.value) && V(); }); const b = () => { n.value = "", u.value = null; }, V = () => { for (const e in o.value) a.value = e, m.type === "dateRange" ? u.value = o.value[e] : n.value = o.value[e]; }; watch(a, () => { f(); }), watch(n, () => { f(); }), watch(u, () => { f(); }); let g = -1; const f = () => { const e = { [a.value]: m.type === "dateRange" ? u.value : n.value }; clearInterval(g), g = setTimeout(() => { o.value = e; }, 100); }; return (e, t) => { const i = r("QuestionFilled"), R = r("el-icon"), w = r("el-popover"), S = r("el-option"), C = r("el-select"), B = r("el-date-picker"), N = r("el-input"); return s(), v("div", j, [ l.tips ? (s(), v("div", z, [ c(w, { effect: "dark", trigger: "hover", content: l.tips }, { reference: h(() => [ c(R, { style: { color: "#adadad" } }, { default: h(() => [ c(i) ]), _: 1 }) ]), _: 1 }, 8, ["content"]) ])) : T("", !0), c(C, { modelValue: p(a), "onUpdate:modelValue": t[0] || (t[0] = (d) => _(a) ? a.value = d : null), placeholder: "请选择", style: x({ width: l.selectWidth + "px", flexShrink: 0 }), class: "selectStyle", onChange: b }, { default: h(() => [ (s(!0), v(U, null, I(l.options, (d) => (s(), y(S, { label: d.label, value: d.value }, null, 8, ["label", "value"]))), 256)) ]), _: 1 }, 8, ["modelValue", "style"]), l.type === "dateRange" ? (s(), y(B, { key: 1, modelValue: p(u), "onUpdate:modelValue": t[1] || (t[1] = (d) => _(u) ? u.value = d : null), type: "daterange", class: "dateStyle", style: x({ width: l.inputWidth + "px", borderRadius: "0 4px 4px 0", borderRight: "none" }), clearable: "" }, null, 8, ["modelValue", "style"])) : (s(), y(N, { key: 2, modelValue: p(n), "onUpdate:modelValue": t[2] || (t[2] = (d) => _(n) ? n.value = d : null), clearable: "", class: "inputStyle", style: x({ width: l.inputWidth + "px", borderRadius: "0 4px 4px 0", borderRight: "none" }), placeholder: p(k) }, null, 8, ["modelValue", "style", "placeholder"])) ]); }; } }), L = /* @__PURE__ */ Q(A, [["__scopeId", "data-v-b3ef177d"]]); export { L as default };