SPanelLayout.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import { useSlots as S, ref as v, computed as o, openBlock as l, createElementBlock as a, normalizeStyle as i, normalizeClass as g, createElementVNode as r, renderSlot as n, createTextVNode as _, toDisplayString as w, createCommentVNode as u, createVNode as k, withCtx as $ } from "vue";
  2. import { n as N } from "./index2.js";
  3. import { S as x } from "./index9.js";
  4. const b = { class: "s-panel-layout-title" }, z = {
  5. key: 0,
  6. class: "s-panel-layout-extra"
  7. }, B = { class: "s-panel-layout-content" }, P = {
  8. key: 1,
  9. class: "s-panel-layout-footer"
  10. }, V = /* @__PURE__ */ Object.assign({ name: "SPanelLayout" }, {
  11. __name: "SPanelLayout",
  12. props: {
  13. // 面板标题
  14. title: {
  15. type: String,
  16. default: ""
  17. },
  18. // 是否显示标题栏(传了 #extra 插槽时也会显示)
  19. showTitle: {
  20. type: Boolean,
  21. default: !0
  22. },
  23. // 面板高度:默认占满父容器,可传 '100vh' / 'calc(100vh - 60px)' / 具体像素值
  24. height: {
  25. type: [String, Number],
  26. default: "100%"
  27. },
  28. // 内容区滚动时标题栏是否吸顶
  29. headerSticky: {
  30. type: Boolean,
  31. default: !1
  32. },
  33. // 内容区宽度,默认 100%;传固定宽度(如 1200px)后居中显示
  34. width: {
  35. type: [Number, String],
  36. default: "100%"
  37. }
  38. },
  39. setup(d) {
  40. const e = d, s = S(), h = v(8), c = o(() => !!(e.title || s.title || s.extra || s.footer)), p = o(() => e.showTitle && !!(e.title || s.title || s.extra)), f = o(() => !c.value || e.height === null || e.height === void 0 || e.height === "" || e.height === "100%" ? null : {
  41. height: typeof e.height == "number" ? `${e.height}px` : e.height
  42. }), y = o(() => window.$utils.isNumber(e.width) ? e.width + "px" : e.width);
  43. return (t, C) => {
  44. const m = x;
  45. return l(), a("div", {
  46. class: g(["s-panel-layout", { "is-panel": c.value }]),
  47. style: i(f.value)
  48. }, [
  49. p.value ? (l(), a("div", {
  50. key: 0,
  51. class: "s-panel-layout-header",
  52. style: i({ position: e.headerSticky ? "sticky" : "" })
  53. }, [
  54. r("div", b, [
  55. n(t.$slots, "title", {}, () => [
  56. _(w(d.title), 1)
  57. ], !0)
  58. ]),
  59. t.$slots.extra ? (l(), a("div", z, [
  60. n(t.$slots, "extra", {}, void 0, !0)
  61. ])) : u("", !0)
  62. ], 4)) : u("", !0),
  63. r("div", B, [
  64. r("div", {
  65. class: "s-panel-scroll-view",
  66. style: i({ width: y.value })
  67. }, [
  68. n(t.$slots, "default", {}, void 0, !0)
  69. ], 4)
  70. ]),
  71. t.$slots.footer ? (l(), a("div", P, [
  72. k(m, { size: h.value }, {
  73. default: $(() => [
  74. n(t.$slots, "footer", {}, void 0, !0)
  75. ]),
  76. _: 3
  77. }, 8, ["size"])
  78. ])) : u("", !0)
  79. ], 6);
  80. };
  81. }
  82. }), j = /* @__PURE__ */ N(V, [["__scopeId", "data-v-8004311d"]]);
  83. export {
  84. j as default
  85. };