UNPKG

@form-create/component-ivu-select

Version:

@form-create/iview 内置组件

108 lines (107 loc) 3.37 kB
/*! * FormCreate 低代码表单渲染器 * @form-create/component-ivu-select v2.6.3 * (c) 2018-2024 xaboy * Github https://github.com/xaboy/form-create * Site https://form-create.com/ * Released under the MIT License. */ function p(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; } function y() { return y = Object.assign ? Object.assign.bind() : function(e) { for (var t, n = 1; n < arguments.length; n++) for (var r in t = arguments[n], t) Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]); return e; }, y.apply(this, arguments); } var m = ["attrs", "props", "domProps"], d = ["class", "style", "directives"], g = ["on", "nativeOn"], O = function(e) { return e.reduce(function(t, n) { for (var r in n) if (!t[r]) t[r] = n[r]; else if (m.indexOf(r) !== -1) t[r] = y({}, t[r], n[r]); else if (d.indexOf(r) !== -1) { var a = t[r] instanceof Array ? t[r] : [t[r]], s = n[r] instanceof Array ? n[r] : [n[r]]; t[r] = [].concat(a, s); } else if (g.indexOf(r) !== -1) for (var o in n[r]) if (t[r][o]) { var i = t[r][o] instanceof Array ? t[r][o] : [t[r][o]], c = n[r][o] instanceof Array ? n[r][o] : [n[r][o]]; t[r][o] = [].concat(i, c); } else t[r][o] = n[r][o]; else if (r === "hook") for (var u in n[r]) t[r][u] = t[r][u] ? A(t[r][u], n[r][u]) : n[r][u]; else t[r] = n[r]; return t; }, {}); }, A = function(e, t) { return function() { e && e.apply(this, arguments), t && t.apply(this, arguments); }; }, j = O; const f = /* @__PURE__ */ p(j), l = { type(e, t) { return Object.prototype.toString.call(e) === "[object " + t + "]"; }, Undef(e) { return e == null; }, Element(e) { return typeof e == "object" && e !== null && e.nodeType === 1 && !l.Object(e); }, trueArray(e) { return Array.isArray(e) && e.length > 0; }, Function(e) { const t = this.getType(e); return t === "Function" || t === "AsyncFunction"; }, getType(e) { const t = Object.prototype.toString.call(e); return /^\[object (.*)\]$/.exec(t)[1]; }, empty(e) { return e == null || Array.isArray(e) && Array.isArray(e) && !e.length ? !0 : typeof e == "string" && !e; } }; ["Date", "Object", "String", "Boolean", "Array", "Number"].forEach((e) => { l[e] = function(t) { return l.type(t, e); }; }); function h(e, t) { return {}.hasOwnProperty.call(e, t); } const P = "fcSelect", S = { name: P, functional: !0, props: { formCreateInject: { type: Object, required: !0 } }, render(e, t) { const n = (s, o) => { const i = s.slot; return e("Option", f([{}, { props: s }, { key: "" + o + "-" + s.value }]), [i ? e("template", { slot: s.slotName || "default" }, [l.Function(i) ? s.slot(e) : i]) : null]); }, r = (s, o) => e("OptionGroup", { attrs: { label: s.label }, key: "" + o + "-" + s.label }, [l.trueArray(s.options) && s.options.map((i, c) => n(i, c))]), a = t.props.formCreateInject.options; return e("Select", f([{}, t.data, { ref: "el" }]), [(Array.isArray(a) ? a : []).map((s, o) => h(s || "", "options") ? r(s, o) : n(s, o)), t.children]); }, mounted() { this.$emit("fc.el", this.$refs.el); } }; export { S as default };