SFormItem.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. var _ = Object.defineProperty;
  2. var s = Object.getOwnPropertySymbols;
  3. var S = Object.prototype.hasOwnProperty, g = Object.prototype.propertyIsEnumerable;
  4. var c = (n, t, o) => t in n ? _(n, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : n[t] = o, a = (n, t) => {
  5. for (var o in t || (t = {}))
  6. S.call(t, o) && c(n, o, t[o]);
  7. if (s)
  8. for (var o of s(t))
  9. g.call(t, o) && c(n, o, t[o]);
  10. return n;
  11. };
  12. import { useAttrs as y, computed as u, openBlock as i, createElementBlock as d, createVNode as w, mergeProps as C, withCtx as B, renderSlot as m, createCommentVNode as O } from "vue";
  13. import { _ as k } from "./index4.js";
  14. const A = { class: "s-form-item" }, x = {
  15. key: 0,
  16. class: "label"
  17. }, D = {
  18. __name: "SFormItem",
  19. props: {
  20. label: {
  21. type: String,
  22. default: ""
  23. },
  24. labelWidth: {
  25. type: [Number, String],
  26. default: "100%"
  27. },
  28. name: {
  29. type: String,
  30. default: ""
  31. }
  32. },
  33. setup(n) {
  34. const t = y(), o = n, f = /* @__PURE__ */ new Set([
  35. "disabled",
  36. "allowClear",
  37. "clearable",
  38. "showSearch",
  39. "multiple",
  40. "readonly",
  41. "autofocus",
  42. "bordered",
  43. "checked",
  44. "open",
  45. "autoClearSearchValue",
  46. "noDrag",
  47. "isManual",
  48. "expandAll",
  49. "recursionChildren",
  50. "treeCheckable",
  51. "showOnlyOrganization",
  52. "isDataScopeFilter"
  53. ]), 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(() => {
  54. const e = {};
  55. return Object.keys(t || {}).forEach((l) => {
  56. const r = t[l];
  57. e[l] = f.has(l) ? p(r) : r;
  58. }), e;
  59. }), h = u(() => {
  60. const e = o.labelWidth + "";
  61. return {
  62. labelCol: {
  63. style: {
  64. width: e.includes("px") ? e : e + "px"
  65. }
  66. }
  67. };
  68. });
  69. return (e, l) => {
  70. const r = k;
  71. return i(), d("div", A, [
  72. w(r, C({
  73. label: n.label,
  74. name: n.name
  75. }, a(a({}, h.value), b.value), { class: "s-form-item" }), {
  76. default: B(() => [
  77. e.$slots.label ? (i(), d("div", x, [
  78. m(e.$slots, "label")
  79. ])) : O("", !0),
  80. m(e.$slots, "default")
  81. ]),
  82. _: 3
  83. }, 16, ["label", "name"])
  84. ]);
  85. };
  86. }
  87. };
  88. export {
  89. D as default
  90. };