| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- var _ = Object.defineProperty;
- var s = Object.getOwnPropertySymbols;
- var S = Object.prototype.hasOwnProperty, y = Object.prototype.propertyIsEnumerable;
- var c = (r, t, o) => t in r ? _(r, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : r[t] = o, a = (r, t) => {
- for (var o in t || (t = {}))
- S.call(t, o) && c(r, o, t[o]);
- if (s)
- for (var o of s(t))
- y.call(t, o) && c(r, o, t[o]);
- return r;
- };
- import { useAttrs as g, computed as u, openBlock as i, createElementBlock as d, createVNode as w, mergeProps as C, withCtx as A, renderSlot as m, createCommentVNode as B } from "vue";
- import { _ as O } from "./index4.js";
- const k = { class: "s-form-item" }, x = {
- key: 0,
- class: "label"
- }, D = {
- __name: "SFormItem",
- props: {
- label: {
- type: String,
- default: ""
- },
- labelWidth: {
- type: [Number, String],
- default: "100%"
- },
- // 支持嵌套字段:name 传字符串,或传数组路径(如 ['dsConfigRdb', 'dbCode']),与 a-form-item 一致
- name: {
- type: [String, Array],
- default: ""
- }
- },
- setup(r) {
- const t = g(), o = r, f = /* @__PURE__ */ new Set([
- "disabled",
- "allowClear",
- "clearable",
- "showSearch",
- "multiple",
- "readonly",
- "autofocus",
- "bordered",
- "checked",
- "open",
- "autoClearSearchValue",
- "noDrag",
- "isManual",
- "expandAll",
- "recursionChildren",
- "treeCheckable",
- "showOnlyOrganization",
- "isDataScopeFilter"
- ]), p = (e) => typeof e == "boolean" ? e : e === "" || e === null || e === void 0 ? e === "" ? !0 : e : typeof e == "string" ? !(e === "false" || e === "0") : !!e, b = u(() => {
- const e = {};
- return Object.keys(t || {}).forEach((n) => {
- const l = t[n];
- e[n] = f.has(n) ? p(l) : l;
- }), e;
- }), h = u(() => {
- const e = o.labelWidth + "";
- return {
- labelCol: {
- style: {
- width: e.includes("px") ? e : e + "px"
- }
- }
- };
- });
- return (e, n) => {
- const l = O;
- return i(), d("div", k, [
- w(l, C({
- label: r.label,
- name: r.name
- }, a(a({}, h.value), b.value), { class: "s-form-item" }), {
- default: A(() => [
- e.$slots.label ? (i(), d("div", x, [
- m(e.$slots, "label")
- ])) : B("", !0),
- m(e.$slots, "default")
- ]),
- _: 3
- }, 16, ["label", "name"])
- ]);
- };
- }
- };
- export {
- D as default
- };
|