index19.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. import { g as S, m as w, d as s, r as z, b as y, u as C, bP as M, _ as u } from "./index2.js";
  2. import { defineComponent as B, computed as d, createVNode as f } from "vue";
  3. const I = (t) => {
  4. const {
  5. componentCls: e,
  6. sizePaddingEdgeHorizontal: o,
  7. colorSplit: r,
  8. lineWidth: i
  9. } = t;
  10. return {
  11. [e]: s(s({}, z(t)), {
  12. borderBlockStart: `${i}px solid ${r}`,
  13. // vertical
  14. "&-vertical": {
  15. position: "relative",
  16. top: "-0.06em",
  17. display: "inline-block",
  18. height: "0.9em",
  19. margin: `0 ${t.dividerVerticalGutterMargin}px`,
  20. verticalAlign: "middle",
  21. borderTop: 0,
  22. borderInlineStart: `${i}px solid ${r}`
  23. },
  24. "&-horizontal": {
  25. display: "flex",
  26. clear: "both",
  27. width: "100%",
  28. minWidth: "100%",
  29. margin: `${t.dividerHorizontalGutterMargin}px 0`
  30. },
  31. [`&-horizontal${e}-with-text`]: {
  32. display: "flex",
  33. alignItems: "center",
  34. margin: `${t.dividerHorizontalWithTextGutterMargin}px 0`,
  35. color: t.colorTextHeading,
  36. fontWeight: 500,
  37. fontSize: t.fontSizeLG,
  38. whiteSpace: "nowrap",
  39. textAlign: "center",
  40. borderBlockStart: `0 ${r}`,
  41. "&::before, &::after": {
  42. position: "relative",
  43. width: "50%",
  44. borderBlockStart: `${i}px solid transparent`,
  45. // Chrome not accept `inherit` in `border-top`
  46. borderBlockStartColor: "inherit",
  47. borderBlockEnd: 0,
  48. transform: "translateY(50%)",
  49. content: "''"
  50. }
  51. },
  52. [`&-horizontal${e}-with-text-left`]: {
  53. "&::before": {
  54. width: "5%"
  55. },
  56. "&::after": {
  57. width: "95%"
  58. }
  59. },
  60. [`&-horizontal${e}-with-text-right`]: {
  61. "&::before": {
  62. width: "95%"
  63. },
  64. "&::after": {
  65. width: "5%"
  66. }
  67. },
  68. [`${e}-inner-text`]: {
  69. display: "inline-block",
  70. padding: "0 1em"
  71. },
  72. "&-dashed": {
  73. background: "none",
  74. borderColor: r,
  75. borderStyle: "dashed",
  76. borderWidth: `${i}px 0 0`
  77. },
  78. [`&-horizontal${e}-with-text${e}-dashed`]: {
  79. "&::before, &::after": {
  80. borderStyle: "dashed none none"
  81. }
  82. },
  83. [`&-vertical${e}-dashed`]: {
  84. borderInlineStartWidth: i,
  85. borderInlineEnd: 0,
  86. borderBlockStart: 0,
  87. borderBlockEnd: 0
  88. },
  89. [`&-plain${e}-with-text`]: {
  90. color: t.colorText,
  91. fontWeight: "normal",
  92. fontSize: t.fontSize
  93. },
  94. [`&-horizontal${e}-with-text-left${e}-no-default-orientation-margin-left`]: {
  95. "&::before": {
  96. width: 0
  97. },
  98. "&::after": {
  99. width: "100%"
  100. },
  101. [`${e}-inner-text`]: {
  102. paddingInlineStart: o
  103. }
  104. },
  105. [`&-horizontal${e}-with-text-right${e}-no-default-orientation-margin-right`]: {
  106. "&::before": {
  107. width: "100%"
  108. },
  109. "&::after": {
  110. width: 0
  111. },
  112. [`${e}-inner-text`]: {
  113. paddingInlineEnd: o
  114. }
  115. }
  116. })
  117. };
  118. }, _ = S("Divider", (t) => {
  119. const e = w(t, {
  120. dividerVerticalGutterMargin: t.marginXS,
  121. dividerHorizontalWithTextGutterMargin: t.margin,
  122. dividerHorizontalGutterMargin: t.marginLG
  123. });
  124. return [I(e)];
  125. }, {
  126. sizePaddingEdgeHorizontal: 0
  127. }), G = () => ({
  128. prefixCls: String,
  129. type: {
  130. type: String,
  131. default: "horizontal"
  132. },
  133. dashed: {
  134. type: Boolean,
  135. default: !1
  136. },
  137. orientation: {
  138. type: String,
  139. default: "center"
  140. },
  141. plain: {
  142. type: Boolean,
  143. default: !1
  144. },
  145. orientationMargin: [String, Number]
  146. }), H = B({
  147. name: "ADivider",
  148. inheritAttrs: !1,
  149. compatConfig: {
  150. MODE: 3
  151. },
  152. props: G(),
  153. setup(t, e) {
  154. let {
  155. slots: o,
  156. attrs: r
  157. } = e;
  158. const {
  159. prefixCls: i,
  160. direction: m
  161. } = C("divider", t), [v, h] = _(i), g = d(() => t.orientation === "left" && t.orientationMargin != null), c = d(() => t.orientation === "right" && t.orientationMargin != null), $ = d(() => {
  162. const {
  163. type: n,
  164. dashed: l,
  165. plain: b
  166. } = t, a = i.value;
  167. return {
  168. [a]: !0,
  169. [h.value]: !!h.value,
  170. [`${a}-${n}`]: !0,
  171. [`${a}-dashed`]: !!l,
  172. [`${a}-plain`]: !!b,
  173. [`${a}-rtl`]: m.value === "rtl",
  174. [`${a}-no-default-orientation-margin-left`]: g.value,
  175. [`${a}-no-default-orientation-margin-right`]: c.value
  176. };
  177. }), p = d(() => {
  178. const n = typeof t.orientationMargin == "number" ? `${t.orientationMargin}px` : t.orientationMargin;
  179. return s(s({}, g.value && {
  180. marginLeft: n
  181. }), c.value && {
  182. marginRight: n
  183. });
  184. }), x = d(() => t.orientation.length > 0 ? "-" + t.orientation : t.orientation);
  185. return () => {
  186. var n;
  187. const l = M((n = o.default) === null || n === void 0 ? void 0 : n.call(o));
  188. return v(f("div", u(u({}, r), {}, {
  189. class: [$.value, l.length ? `${i.value}-with-text ${i.value}-with-text${x.value}` : "", r.class],
  190. role: "separator"
  191. }), [l.length ? f("span", {
  192. class: `${i.value}-inner-text`,
  193. style: p.value
  194. }, [l]) : null]));
  195. };
  196. }
  197. }), T = y(H);
  198. export {
  199. T as _
  200. };