index17.js 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. import { g as j, m as F, d, r as k, b as U, u as R, bO as X, _ as M, dU as Y, c as q, bb as J, bn as K, P as O, bg as P, dV as I } from "./index2.js";
  2. import { defineComponent as V, computed as o, createVNode as h, ref as N, watch as Q, Fragment as Z } from "vue";
  3. import { u as tt } from "./useFlexGapSupport.js";
  4. const et = (t) => {
  5. const {
  6. componentCls: e,
  7. sizePaddingEdgeHorizontal: l,
  8. colorSplit: a,
  9. lineWidth: i
  10. } = t;
  11. return {
  12. [e]: d(d({}, k(t)), {
  13. borderBlockStart: `${i}px solid ${a}`,
  14. // vertical
  15. "&-vertical": {
  16. position: "relative",
  17. top: "-0.06em",
  18. display: "inline-block",
  19. height: "0.9em",
  20. margin: `0 ${t.dividerVerticalGutterMargin}px`,
  21. verticalAlign: "middle",
  22. borderTop: 0,
  23. borderInlineStart: `${i}px solid ${a}`
  24. },
  25. "&-horizontal": {
  26. display: "flex",
  27. clear: "both",
  28. width: "100%",
  29. minWidth: "100%",
  30. margin: `${t.dividerHorizontalGutterMargin}px 0`
  31. },
  32. [`&-horizontal${e}-with-text`]: {
  33. display: "flex",
  34. alignItems: "center",
  35. margin: `${t.dividerHorizontalWithTextGutterMargin}px 0`,
  36. color: t.colorTextHeading,
  37. fontWeight: 500,
  38. fontSize: t.fontSizeLG,
  39. whiteSpace: "nowrap",
  40. textAlign: "center",
  41. borderBlockStart: `0 ${a}`,
  42. "&::before, &::after": {
  43. position: "relative",
  44. width: "50%",
  45. borderBlockStart: `${i}px solid transparent`,
  46. // Chrome not accept `inherit` in `border-top`
  47. borderBlockStartColor: "inherit",
  48. borderBlockEnd: 0,
  49. transform: "translateY(50%)",
  50. content: "''"
  51. }
  52. },
  53. [`&-horizontal${e}-with-text-left`]: {
  54. "&::before": {
  55. width: "5%"
  56. },
  57. "&::after": {
  58. width: "95%"
  59. }
  60. },
  61. [`&-horizontal${e}-with-text-right`]: {
  62. "&::before": {
  63. width: "95%"
  64. },
  65. "&::after": {
  66. width: "5%"
  67. }
  68. },
  69. [`${e}-inner-text`]: {
  70. display: "inline-block",
  71. padding: "0 1em"
  72. },
  73. "&-dashed": {
  74. background: "none",
  75. borderColor: a,
  76. borderStyle: "dashed",
  77. borderWidth: `${i}px 0 0`
  78. },
  79. [`&-horizontal${e}-with-text${e}-dashed`]: {
  80. "&::before, &::after": {
  81. borderStyle: "dashed none none"
  82. }
  83. },
  84. [`&-vertical${e}-dashed`]: {
  85. borderInlineStartWidth: i,
  86. borderInlineEnd: 0,
  87. borderBlockStart: 0,
  88. borderBlockEnd: 0
  89. },
  90. [`&-plain${e}-with-text`]: {
  91. color: t.colorText,
  92. fontWeight: "normal",
  93. fontSize: t.fontSize
  94. },
  95. [`&-horizontal${e}-with-text-left${e}-no-default-orientation-margin-left`]: {
  96. "&::before": {
  97. width: 0
  98. },
  99. "&::after": {
  100. width: "100%"
  101. },
  102. [`${e}-inner-text`]: {
  103. paddingInlineStart: l
  104. }
  105. },
  106. [`&-horizontal${e}-with-text-right${e}-no-default-orientation-margin-right`]: {
  107. "&::before": {
  108. width: "100%"
  109. },
  110. "&::after": {
  111. width: 0
  112. },
  113. [`${e}-inner-text`]: {
  114. paddingInlineEnd: l
  115. }
  116. }
  117. })
  118. };
  119. }, it = j("Divider", (t) => {
  120. const e = F(t, {
  121. dividerVerticalGutterMargin: t.marginXS,
  122. dividerHorizontalWithTextGutterMargin: t.margin,
  123. dividerHorizontalGutterMargin: t.marginLG
  124. });
  125. return [et(e)];
  126. }, {
  127. sizePaddingEdgeHorizontal: 0
  128. }), nt = () => ({
  129. prefixCls: String,
  130. type: {
  131. type: String,
  132. default: "horizontal"
  133. },
  134. dashed: {
  135. type: Boolean,
  136. default: !1
  137. },
  138. orientation: {
  139. type: String,
  140. default: "center"
  141. },
  142. plain: {
  143. type: Boolean,
  144. default: !1
  145. },
  146. orientationMargin: [String, Number]
  147. }), at = V({
  148. name: "ADivider",
  149. inheritAttrs: !1,
  150. compatConfig: {
  151. MODE: 3
  152. },
  153. props: nt(),
  154. setup(t, e) {
  155. let {
  156. slots: l,
  157. attrs: a
  158. } = e;
  159. const {
  160. prefixCls: i,
  161. direction: f
  162. } = R("divider", t), [x, S] = it(i), b = o(() => t.orientation === "left" && t.orientationMargin != null), m = o(() => t.orientation === "right" && t.orientationMargin != null), c = o(() => {
  163. const {
  164. type: r,
  165. dashed: u,
  166. plain: _
  167. } = t, s = i.value;
  168. return {
  169. [s]: !0,
  170. [S.value]: !!S.value,
  171. [`${s}-${r}`]: !0,
  172. [`${s}-dashed`]: !!u,
  173. [`${s}-plain`]: !!_,
  174. [`${s}-rtl`]: f.value === "rtl",
  175. [`${s}-no-default-orientation-margin-left`]: b.value,
  176. [`${s}-no-default-orientation-margin-right`]: m.value
  177. };
  178. }), p = o(() => {
  179. const r = typeof t.orientationMargin == "number" ? `${t.orientationMargin}px` : t.orientationMargin;
  180. return d(d({}, b.value && {
  181. marginLeft: r
  182. }), m.value && {
  183. marginRight: r
  184. });
  185. }), v = o(() => t.orientation.length > 0 ? "-" + t.orientation : t.orientation);
  186. return () => {
  187. var r;
  188. const u = X((r = l.default) === null || r === void 0 ? void 0 : r.call(l));
  189. return x(h("div", M(M({}, a), {}, {
  190. class: [c.value, u.length ? `${i.value}-with-text ${i.value}-with-text${v.value}` : "", a.class],
  191. role: "separator"
  192. }), [u.length ? h("span", {
  193. class: `${i.value}-inner-text`,
  194. style: p.value
  195. }, [u]) : null]));
  196. };
  197. }
  198. }), ut = U(at), rt = {
  199. small: 8,
  200. middle: 16,
  201. large: 24
  202. }, lt = () => ({
  203. prefixCls: String,
  204. size: {
  205. type: [String, Number, Array]
  206. },
  207. direction: O.oneOf(P("horizontal", "vertical")).def("horizontal"),
  208. align: O.oneOf(P("start", "end", "center", "baseline")),
  209. wrap: K()
  210. });
  211. function ot(t) {
  212. return typeof t == "string" ? rt[t] : t || 0;
  213. }
  214. const C = V({
  215. compatConfig: {
  216. MODE: 3
  217. },
  218. name: "ASpace",
  219. inheritAttrs: !1,
  220. props: lt(),
  221. slots: Object,
  222. setup(t, e) {
  223. let {
  224. slots: l,
  225. attrs: a
  226. } = e;
  227. const {
  228. prefixCls: i,
  229. space: f,
  230. direction: x
  231. } = R("space", t), [S, b] = Y(i), m = tt(), c = o(() => {
  232. var n, g, $;
  233. return ($ = (n = t.size) !== null && n !== void 0 ? n : (g = f == null ? void 0 : f.value) === null || g === void 0 ? void 0 : g.size) !== null && $ !== void 0 ? $ : "small";
  234. }), p = N(), v = N();
  235. Q(c, () => {
  236. [p.value, v.value] = (Array.isArray(c.value) ? c.value : [c.value, c.value]).map((n) => ot(n));
  237. }, {
  238. immediate: !0
  239. });
  240. const r = o(() => t.align === void 0 && t.direction === "horizontal" ? "center" : t.align), u = o(() => q(i.value, b.value, `${i.value}-${t.direction}`, {
  241. [`${i.value}-rtl`]: x.value === "rtl",
  242. [`${i.value}-align-${r.value}`]: r.value
  243. })), _ = o(() => x.value === "rtl" ? "marginLeft" : "marginRight"), s = o(() => {
  244. const n = {};
  245. return m.value && (n.columnGap = `${p.value}px`, n.rowGap = `${v.value}px`), d(d({}, n), t.wrap && {
  246. flexWrap: "wrap",
  247. marginBottom: `${-v.value}px`
  248. });
  249. });
  250. return () => {
  251. var n, g;
  252. const {
  253. wrap: $,
  254. direction: L = "horizontal"
  255. } = t, A = (n = l.default) === null || n === void 0 ? void 0 : n.call(l), E = J(A), W = E.length;
  256. if (W === 0)
  257. return null;
  258. const y = (g = l.split) === null || g === void 0 ? void 0 : g.call(l), H = `${i.value}-item`, T = p.value, B = W - 1;
  259. return h("div", M(M({}, a), {}, {
  260. class: [u.value, a.class],
  261. style: [s.value, a.style]
  262. }), [E.map((D, z) => {
  263. let G = A.indexOf(D);
  264. G === -1 && (G = `$$space-${z}`);
  265. let w = {};
  266. return m.value || (L === "vertical" ? z < B && (w = {
  267. marginBottom: `${T / (y ? 2 : 1)}px`
  268. }) : w = d(d({}, z < B && {
  269. [_.value]: `${T / (y ? 2 : 1)}px`
  270. }), $ && {
  271. paddingBottom: `${v.value}px`
  272. })), S(h(Z, {
  273. key: G
  274. }, [h("div", {
  275. class: H,
  276. style: w
  277. }, [D]), z < B && y && h("span", {
  278. class: `${H}-split`,
  279. style: w
  280. }, [y])]));
  281. })]);
  282. };
  283. }
  284. });
  285. C.Compact = I;
  286. C.install = function(t) {
  287. return t.component(C.name, C), t.component(I.name, I), t;
  288. };
  289. export {
  290. C as S,
  291. ut as _
  292. };