SSkeletonLayout.js 8.8 KB

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