SSkeletonLayout.js 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. import { ref as i, computed as Y, watch as Z, resolveComponent as S, resolveDirective as x, openBlock as n, createElementBlock as l, createElementVNode as d, toDisplayString as b, createBlock as f, withCtx as u, createVNode as m, createTextVNode as _, createCommentVNode as a, Fragment as $, renderList as T, withDirectives as B, resolveDynamicComponent as ee, vShow as te, renderSlot as g, normalizeStyle as ne } from "vue";
  2. import { n as se, y as oe, B as le } from "./index2.js";
  3. import { _ as ae, S as ie } from "./index11.js";
  4. import { T as ue, _ as re } from "./index12.js";
  5. const de = { class: "title" }, ce = { style: { "margin-right": "10px" } }, fe = { class: "btns" }, me = {
  6. key: 0,
  7. style: { "margin-left": "8px" }
  8. }, ye = {
  9. key: 1,
  10. class: "steps-btns"
  11. }, pe = { class: "skeleton-layout-main" }, ve = {
  12. key: 1,
  13. class: "side-bar s-theme-bg"
  14. }, be = { class: "skeleton-content" }, ke = { class: "skeleton-container" }, he = 0, _e = /* @__PURE__ */ Object.assign({ name: "SSkeletonLayout" }, {
  15. __name: "SSkeletonLayout",
  16. props: {
  17. // 页面标题
  18. title: {
  19. type: String,
  20. required: !0
  21. },
  22. // 页面副标题
  23. subTitle: {
  24. type: String,
  25. default: ""
  26. },
  27. // 工具条按钮:[{ key, name, icon, type, show, disabled, action }]
  28. buttons: {
  29. type: Array,
  30. default: () => []
  31. },
  32. tabs: {
  33. type: Array,
  34. default: () => []
  35. },
  36. tabKey: {
  37. type: Object,
  38. default: () => ({
  39. label: "label",
  40. value: "value"
  41. })
  42. },
  43. steps: {
  44. type: Array,
  45. default: () => []
  46. }
  47. },
  48. emits: ["tabsChange", "btnCallback", "stepChange", "stepConfirm"],
  49. setup(s, { emit: L }) {
  50. const C = L, k = s, V = i(null), K = i(null), P = i(null), z = i(null), O = i(232), h = i(""), E = i(null), I = i(null), y = i(0), N = () => {
  51. const e = k.tabs || [];
  52. if (!e.length) {
  53. h.value = "";
  54. return;
  55. }
  56. const o = w.value;
  57. e.some((r) => r && r[o] === h.value) || (h.value = e[0][o]);
  58. }, w = Y(() => k.tabKey && k.tabKey.value || "value");
  59. Z(() => k.tabs, N, { immediate: !0, deep: !0 });
  60. function R(e) {
  61. h.value = e;
  62. const o = k.tabs.find((r) => r[w.value] === e);
  63. C("tabsChange", o);
  64. }
  65. function D(e) {
  66. y.value += e === "prev" ? -1 : 1, C("stepChange", e, y.value);
  67. }
  68. function W() {
  69. C("stepConfirm", y.value);
  70. }
  71. const X = {
  72. add: "PlusCircleOutlined",
  73. edit: "FormOutlined",
  74. delete: "DeleteOutlined",
  75. remove: "DeleteOutlined",
  76. import: "UploadOutlined",
  77. export: "DownloadOutlined",
  78. assign: "ClusterOutlined",
  79. execute: "PlayCircleOutlined",
  80. pause: "PauseCircleOutlined",
  81. resume: "PoweroffOutlined",
  82. approve: "HighlightOutlined",
  83. setting: "SettingOutlined",
  84. TopOfType: "VerticalAlignTopOutlined",
  85. TOP: "VerticalAlignTopOutlined",
  86. synchronize: "SyncOutlined"
  87. };
  88. function j(e) {
  89. C("btnCallback", e.key);
  90. }
  91. function A(e) {
  92. return typeof e.icon == "string" ? e.icon : typeof e.icon == "boolean" && e.icon && X[e.key] || "";
  93. }
  94. const F = {
  95. mounted(e) {
  96. e.style.cursor = "e-resize", document.addEventListener("selectstart", (o) => {
  97. o.preventDefault();
  98. }), e.onmousedown = (o) => {
  99. const r = o.clientX, p = O.value;
  100. document.onmousemove = (v) => {
  101. const c = v.clientX - r;
  102. if (c < 0) {
  103. if (p + c <= 232) return;
  104. O.value = p + c;
  105. } else {
  106. if (p + c >= 500) return;
  107. O.value = p + c;
  108. }
  109. }, document.onmouseup = () => {
  110. document.onmousemove = document.onmousedown = null;
  111. };
  112. };
  113. }
  114. };
  115. return (e, o) => {
  116. const r = S("InfoCircleOutlined"), p = oe, v = le, c = S("arrow-left-outlined"), q = S("arrow-right-outlined"), H = S("save-outlined"), M = ie, U = ae, G = re, J = ue, Q = x("action");
  117. return n(), l("div", {
  118. class: "s-skeleton-layout",
  119. ref_key: "layout",
  120. ref: V
  121. }, [
  122. d("div", {
  123. class: "tools",
  124. ref_key: "tools",
  125. ref: K
  126. }, [
  127. d("div", de, [
  128. d("span", ce, b(s.title), 1),
  129. s.subTitle ? (n(), f(p, {
  130. key: 0,
  131. placement: "topLeft",
  132. mouseEnterDelay: 0.5,
  133. mouseLeaveDelay: 0.5
  134. }, {
  135. title: u(() => [
  136. _(b(s.subTitle), 1)
  137. ]),
  138. default: u(() => [
  139. m(r)
  140. ]),
  141. _: 1
  142. })) : a("", !0)
  143. ]),
  144. d("div", fe, [
  145. (n(!0), l($, null, T(s.buttons, (t) => (n(), l("span", {
  146. class: "item-btn",
  147. key: t.key
  148. }, [
  149. B((n(), f(v, {
  150. class: "btn",
  151. disabled: !!t.disabled,
  152. type: t.type || t.key === "add" ? "primary" : "default",
  153. onClick: (ge) => j(t)
  154. }, {
  155. icon: u(() => [
  156. A(t) ? (n(), f(ee(A(t)), { key: 0 })) : a("", !0)
  157. ]),
  158. default: u(() => [
  159. _(" " + b(e.$l(t.name)), 1)
  160. ]),
  161. _: 2
  162. }, 1032, ["disabled", "type", "onClick"])), [
  163. [Q, t.action || t.key],
  164. [te, t.show !== !1]
  165. ])
  166. ]))), 128)),
  167. e.$slots.otherBtns ? (n(), l("span", me, [
  168. g(e.$slots, "otherBtns", {}, void 0, !0)
  169. ])) : a("", !0),
  170. s.steps.length > 0 ? (n(), l("span", ye, [
  171. s.steps.length ? (n(), f(v, {
  172. key: 0,
  173. class: "btn",
  174. disabled: y.value === he,
  175. onClick: o[0] || (o[0] = (t) => D("prev"))
  176. }, {
  177. default: u(() => [
  178. m(c),
  179. _(b(e.$l("上一步")), 1)
  180. ]),
  181. _: 1
  182. }, 8, ["disabled"])) : a("", !0),
  183. s.steps.length ? (n(), f(v, {
  184. key: 1,
  185. class: "btn",
  186. type: "primary",
  187. disabled: y.value === s.steps.length - 1,
  188. onClick: o[1] || (o[1] = (t) => D("next"))
  189. }, {
  190. default: u(() => [
  191. m(q),
  192. _(b(e.$l("下一步")), 1)
  193. ]),
  194. _: 1
  195. }, 8, ["disabled"])) : a("", !0),
  196. m(v, {
  197. style: { "margin-right": "8px" },
  198. type: "primary",
  199. onClick: W
  200. }, {
  201. default: u(() => [
  202. m(H),
  203. _(" " + b(e.$l("确认")), 1)
  204. ]),
  205. _: 1
  206. })
  207. ])) : a("", !0)
  208. ])
  209. ], 512),
  210. d("div", pe, [
  211. e.$slots.tree ? (n(), l("div", {
  212. key: 0,
  213. class: "side s-side-tree",
  214. ref: "side",
  215. style: ne({ width: O.value + "px" })
  216. }, [
  217. g(e.$slots, "tree", {}, void 0, !0)
  218. ], 4)) : a("", !0),
  219. e.$slots.tree ? B((n(), l("div", ve, null, 512)), [
  220. [F]
  221. ]) : a("", !0),
  222. d("div", be, [
  223. s.steps && s.steps.length ? (n(), l("div", {
  224. key: 0,
  225. class: "step-wrap",
  226. ref_key: "stepRef",
  227. ref: I
  228. }, [
  229. m(U, {
  230. current: y.value,
  231. type: "navigation",
  232. size: "small"
  233. }, {
  234. default: u(() => [
  235. (n(!0), l($, null, T(s.steps, (t) => (n(), f(M, {
  236. title: t,
  237. key: t,
  238. disabled: !0
  239. }, null, 8, ["title"]))), 128))
  240. ]),
  241. _: 1
  242. }, 8, ["current"])
  243. ], 512)) : a("", !0),
  244. s.tabs && s.tabs.length ? (n(), l("div", {
  245. key: 1,
  246. class: "tabs-wrap",
  247. ref_key: "tabsRef",
  248. ref: E
  249. }, [
  250. m(J, {
  251. "active-key": h.value,
  252. onChange: R
  253. }, {
  254. default: u(() => [
  255. (n(!0), l($, null, T(s.tabs, (t) => (n(), f(G, {
  256. tab: t[s.tabKey.label],
  257. key: t[w.value]
  258. }, null, 8, ["tab"]))), 128))
  259. ]),
  260. _: 1
  261. }, 8, ["active-key"])
  262. ], 512)) : a("", !0),
  263. d("div", ke, [
  264. g(e.$slots, "default", {}, void 0, !0)
  265. ])
  266. ])
  267. ]),
  268. d("div", {
  269. class: "other",
  270. ref_key: "other",
  271. ref: P
  272. }, [
  273. g(e.$slots, "other", {}, void 0, !0)
  274. ], 512),
  275. e.$slots.footer ? (n(), l("div", {
  276. key: 0,
  277. class: "skeleton-footer",
  278. ref_key: "footer",
  279. ref: z
  280. }, [
  281. g(e.$slots, "footer", {}, void 0, !0)
  282. ], 512)) : a("", !0)
  283. ], 512);
  284. };
  285. }
  286. }), $e = /* @__PURE__ */ se(_e, [["__scopeId", "data-v-56957248"]]);
  287. export {
  288. $e as default
  289. };