SPanelLayout.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. headerSticky: {
  29. type: Boolean,
  30. default: !1
  31. },
  32. width: {
  33. type: [Number, String],
  34. default: "100%"
  35. }
  36. },
  37. setup(d) {
  38. 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 : {
  39. height: typeof e.height == "number" ? `${e.height}px` : e.height
  40. }), y = o(() => window.$utils.isNumber(e.width) ? e.width + "px" : e.width);
  41. return (t, C) => {
  42. const m = x;
  43. return l(), a("div", {
  44. class: g(["s-panel-layout", { "is-panel": c.value }]),
  45. style: i(f.value)
  46. }, [
  47. p.value ? (l(), a("div", {
  48. key: 0,
  49. class: "s-panel-layout-header",
  50. style: i({ position: e.headerSticky ? "sticky" : "" })
  51. }, [
  52. r("div", b, [
  53. n(t.$slots, "title", {}, () => [
  54. _(w(d.title), 1)
  55. ], !0)
  56. ]),
  57. t.$slots.extra ? (l(), a("div", z, [
  58. n(t.$slots, "extra", {}, void 0, !0)
  59. ])) : u("", !0)
  60. ], 4)) : u("", !0),
  61. r("div", B, [
  62. r("div", {
  63. class: "s-panel-scroll-view",
  64. style: i({ width: y.value })
  65. }, [
  66. n(t.$slots, "default", {}, void 0, !0)
  67. ], 4)
  68. ]),
  69. t.$slots.footer ? (l(), a("div", P, [
  70. k(m, { size: h.value }, {
  71. default: $(() => [
  72. n(t.$slots, "footer", {}, void 0, !0)
  73. ]),
  74. _: 3
  75. }, 8, ["size"])
  76. ])) : u("", !0)
  77. ], 6);
  78. };
  79. }
  80. }), j = /* @__PURE__ */ N(V, [["__scopeId", "data-v-d493140f"]]);
  81. export {
  82. j as default
  83. };