SSkeletonLayout.js 8.9 KB

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