SPanelLayout.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import { useSlots as m, ref as S, computed as n, openBlock as s, createElementBlock as l, normalizeStyle as d, normalizeClass as _, createElementVNode as c, renderSlot as a, createTextVNode as g, toDisplayString as v, createCommentVNode as i, createVNode as k, withCtx as $ } from "vue";
  2. import { n as b } from "./index2.js";
  3. import { S as x } from "./index9.js";
  4. const z = { class: "s-panel-layout-title" }, N = {
  5. key: 0,
  6. class: "s-panel-layout-extra"
  7. }, w = { class: "s-panel-layout-content" }, B = {
  8. key: 1,
  9. class: "s-panel-layout-footer"
  10. }, P = /* @__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. headerSticky: {
  29. type: Boolean,
  30. default: !1
  31. }
  32. },
  33. setup(r) {
  34. const e = r, o = m(), h = S(8), u = n(() => !!(e.title || o.title || o.extra || o.footer)), p = n(() => e.showTitle && !!(e.title || o.title || o.extra)), f = n(() => !u.value || e.height === null || e.height === void 0 || e.height === "" || e.height === "100%" ? null : {
  35. height: typeof e.height == "number" ? `${e.height}px` : e.height
  36. });
  37. return (t, V) => {
  38. const y = x;
  39. return s(), l("div", {
  40. class: _(["s-panel-layout", { "is-panel": u.value }]),
  41. style: d(f.value)
  42. }, [
  43. p.value ? (s(), l("div", {
  44. key: 0,
  45. class: "s-panel-layout-header",
  46. style: d({ position: e.headerSticky ? "sticky" : "" })
  47. }, [
  48. c("div", z, [
  49. a(t.$slots, "title", {}, () => [
  50. g(v(r.title), 1)
  51. ], !0)
  52. ]),
  53. t.$slots.extra ? (s(), l("div", N, [
  54. a(t.$slots, "extra", {}, void 0, !0)
  55. ])) : i("", !0)
  56. ], 4)) : i("", !0),
  57. c("div", w, [
  58. a(t.$slots, "default", {}, void 0, !0)
  59. ]),
  60. t.$slots.footer ? (s(), l("div", B, [
  61. k(y, { size: h.value }, {
  62. default: $(() => [
  63. a(t.$slots, "footer", {}, void 0, !0)
  64. ]),
  65. _: 3
  66. }, 8, ["size"])
  67. ])) : i("", !0)
  68. ], 6);
  69. };
  70. }
  71. }), E = /* @__PURE__ */ b(P, [["__scopeId", "data-v-ecb1bd03"]]);
  72. export {
  73. E as default
  74. };