UNPKG

tms-vue3-ui

Version:

Vue3基础UI库,提供JSONSchema编辑器,支持基于JSONSchema生成表单。

31 lines (30 loc) 1.78 kB
import { h } from "vue"; function f(e, t, i) { return e[t] === void 0 ? e[t] = [i] : Array.isArray(e[t]) ? e[t].includes(i) || e[t].push(i) : typeof e[t] == "object" ? e[t][i] = !0 : typeof e[t] == "string" && (new RegExp(i).test(e[t]) || (e[t] += ` ${i}`)), e; } function u(e) { e.component("tms-flex", { props: { direction: { type: String, default: "row" }, alignItems: { type: String }, elasticItems: { type: Array }, gap: { type: Number, default: 2 } }, render() { var c, a; let t = ["tms-flex"]; t.push( this.direction === "column" ? "tms-flex_column" : this.direction === "row-reverse" ? "tms-flex_row-reverse" : "tms-flex_row" ), t.push(`tms-flex_gap_${this.gap}`); const i = this.alignItems ? this.alignItems : this.direction === "column" ? "stretch" : "flex-start", l = (a = (c = this.$slots).default) == null ? void 0 : a.call(c); return l != null && l.length && l.forEach((s, m) => { typeof s.type == "string" || typeof s.type == "object" ? (s.props ?? (s.props = {}), f(s.props, "class", "tms-flex__item"), this.elasticItems && this.elasticItems.length && this.elasticItems.includes(m) && f(s.props, "class", "tms-flex__item_elastic")) : typeof s.type == "symbol" ? typeof s.children.forEach == "function" ? s.children.forEach((r, n) => { r.props ?? (r.props = {}), f(r.props, "class", "tms-flex__item"), this.elasticItems && this.elasticItems.length && this.elasticItems.includes(n) && f(r.props, "class", "tms-flex__item_elastic"); }) : console.warn("不支持的vnode.children类型", s.children) : console.warn(`不支持的vnode.type=${s.type}`, s); }), h("div", { class: t, style: { alignItems: i } }, l); } }); } export { u as default };