UNPKG

@wetspace/pro-components

Version:
87 lines (86 loc) 2.75 kB
import { defineComponent as v, shallowRef as g, computed as N, watch as S, openBlock as f, createBlock as d, mergeProps as q, unref as s, withCtx as a, createVNode as c, renderSlot as A, createTextVNode as p, toDisplayString as x, createCommentVNode as B } from "vue"; import V from "./schema.vue.mjs"; import { wetQeuryformProps as $ } from "./types.mjs"; import { ArrowDown as D, ArrowUp as E } from "../../node_modules/.pnpm/@element-plus_icons-vue@2.3.1_vue@3.5.12_typescript@5.4.2_/node_modules/@element-plus/icons-vue/dist/index.mjs"; import { useNamespace as P, ElSpace as F, ElButton as i } from "element-plus"; const U = /* @__PURE__ */ v({ __name: "query-form", props: $, emits: ["query", "change"], setup(w, { emit: h }) { const y = P("query-form"), o = w, u = h, r = g(!1), _ = () => { r.value = !r.value; }, m = async (e) => { const t = await e(); u("query", t); }, C = N(() => { const e = o.collapseShowNum === void 0 ? 24 / o.span : o.collapseShowNum + 1; return o.properties.map((n, l) => ({ ...n, hideInForm: !r.value && l + 1 >= e })); }); S(() => o.showCollapse, (e) => { e ? r.value = !1 : r.value = !0; }, { immediate: !0 }); const k = (e) => { u("change", e); }; return (e, t) => (f(), d(V, q(o, { properties: C.value, class: s(y).b(), onChange: k }), { actions: a(({ submit: n, reset: l }) => [ c(s(F), { class: "search-actions", wrap: "" }, { default: a(() => [ A(e.$slots, "search-actions", { search: () => m(n), reset: () => l() }, () => [ c(s(i), { type: "primary", onClick: () => m(n) }, { default: a(() => t[0] || (t[0] = [ p(" 查询 ") ])), _: 2 }, 1032, ["onClick"]), c(s(i), { onClick: () => l() }, { default: a(() => t[1] || (t[1] = [ p(" 重置 ") ])), _: 2 }, 1032, ["onClick"]) ]), o.showCollapse ? (f(), d(s(i), { key: 0, link: "", type: "primary", icon: r.value ? s(E) : s(D), onClick: _ }, { default: a(() => [ p(x(r.value ? "收起" : "展开"), 1) ]), _: 1 }, 8, ["icon"])) : B("", !0) ]), _: 2 }, 1024) ]), _: 3 }, 16, ["properties", "class"])); } }); export { U as default };