| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292 |
- import { g as j, m as F, d, r as k, b as X, u as R, bO as Y, _ as M, dN as q, c as J, bb as K, bn as Q, P as D, bg as N, dO as I } from "./index2.js";
- import { defineComponent as L, computed as o, createVNode as h, ref as P, watch as U, Fragment as Z } from "vue";
- import { u as tt } from "./useFlexGapSupport.js";
- const et = (t) => {
- const {
- componentCls: e,
- sizePaddingEdgeHorizontal: l,
- colorSplit: a,
- lineWidth: i
- } = t;
- return {
- [e]: d(d({}, k(t)), {
- borderBlockStart: `${i}px solid ${a}`,
- // vertical
- "&-vertical": {
- position: "relative",
- top: "-0.06em",
- display: "inline-block",
- height: "0.9em",
- margin: `0 ${t.dividerVerticalGutterMargin}px`,
- verticalAlign: "middle",
- borderTop: 0,
- borderInlineStart: `${i}px solid ${a}`
- },
- "&-horizontal": {
- display: "flex",
- clear: "both",
- width: "100%",
- minWidth: "100%",
- margin: `${t.dividerHorizontalGutterMargin}px 0`
- },
- [`&-horizontal${e}-with-text`]: {
- display: "flex",
- alignItems: "center",
- margin: `${t.dividerHorizontalWithTextGutterMargin}px 0`,
- color: t.colorTextHeading,
- fontWeight: 500,
- fontSize: t.fontSizeLG,
- whiteSpace: "nowrap",
- textAlign: "center",
- borderBlockStart: `0 ${a}`,
- "&::before, &::after": {
- position: "relative",
- width: "50%",
- borderBlockStart: `${i}px solid transparent`,
- // Chrome not accept `inherit` in `border-top`
- borderBlockStartColor: "inherit",
- borderBlockEnd: 0,
- transform: "translateY(50%)",
- content: "''"
- }
- },
- [`&-horizontal${e}-with-text-left`]: {
- "&::before": {
- width: "5%"
- },
- "&::after": {
- width: "95%"
- }
- },
- [`&-horizontal${e}-with-text-right`]: {
- "&::before": {
- width: "95%"
- },
- "&::after": {
- width: "5%"
- }
- },
- [`${e}-inner-text`]: {
- display: "inline-block",
- padding: "0 1em"
- },
- "&-dashed": {
- background: "none",
- borderColor: a,
- borderStyle: "dashed",
- borderWidth: `${i}px 0 0`
- },
- [`&-horizontal${e}-with-text${e}-dashed`]: {
- "&::before, &::after": {
- borderStyle: "dashed none none"
- }
- },
- [`&-vertical${e}-dashed`]: {
- borderInlineStartWidth: i,
- borderInlineEnd: 0,
- borderBlockStart: 0,
- borderBlockEnd: 0
- },
- [`&-plain${e}-with-text`]: {
- color: t.colorText,
- fontWeight: "normal",
- fontSize: t.fontSize
- },
- [`&-horizontal${e}-with-text-left${e}-no-default-orientation-margin-left`]: {
- "&::before": {
- width: 0
- },
- "&::after": {
- width: "100%"
- },
- [`${e}-inner-text`]: {
- paddingInlineStart: l
- }
- },
- [`&-horizontal${e}-with-text-right${e}-no-default-orientation-margin-right`]: {
- "&::before": {
- width: "100%"
- },
- "&::after": {
- width: 0
- },
- [`${e}-inner-text`]: {
- paddingInlineEnd: l
- }
- }
- })
- };
- }, it = j("Divider", (t) => {
- const e = F(t, {
- dividerVerticalGutterMargin: t.marginXS,
- dividerHorizontalWithTextGutterMargin: t.margin,
- dividerHorizontalGutterMargin: t.marginLG
- });
- return [et(e)];
- }, {
- sizePaddingEdgeHorizontal: 0
- }), nt = () => ({
- prefixCls: String,
- type: {
- type: String,
- default: "horizontal"
- },
- dashed: {
- type: Boolean,
- default: !1
- },
- orientation: {
- type: String,
- default: "center"
- },
- plain: {
- type: Boolean,
- default: !1
- },
- orientationMargin: [String, Number]
- }), at = L({
- name: "ADivider",
- inheritAttrs: !1,
- compatConfig: {
- MODE: 3
- },
- props: nt(),
- setup(t, e) {
- let {
- slots: l,
- attrs: a
- } = e;
- const {
- prefixCls: i,
- direction: f
- } = 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(() => {
- const {
- type: r,
- dashed: u,
- plain: _
- } = t, s = i.value;
- return {
- [s]: !0,
- [S.value]: !!S.value,
- [`${s}-${r}`]: !0,
- [`${s}-dashed`]: !!u,
- [`${s}-plain`]: !!_,
- [`${s}-rtl`]: f.value === "rtl",
- [`${s}-no-default-orientation-margin-left`]: b.value,
- [`${s}-no-default-orientation-margin-right`]: m.value
- };
- }), p = o(() => {
- const r = typeof t.orientationMargin == "number" ? `${t.orientationMargin}px` : t.orientationMargin;
- return d(d({}, b.value && {
- marginLeft: r
- }), m.value && {
- marginRight: r
- });
- }), v = o(() => t.orientation.length > 0 ? "-" + t.orientation : t.orientation);
- return () => {
- var r;
- const u = Y((r = l.default) === null || r === void 0 ? void 0 : r.call(l));
- return x(h("div", M(M({}, a), {}, {
- class: [c.value, u.length ? `${i.value}-with-text ${i.value}-with-text${v.value}` : "", a.class],
- role: "separator"
- }), [u.length ? h("span", {
- class: `${i.value}-inner-text`,
- style: p.value
- }, [u]) : null]));
- };
- }
- }), ut = X(at), rt = {
- small: 8,
- middle: 16,
- large: 24
- }, lt = () => ({
- prefixCls: String,
- size: {
- type: [String, Number, Array]
- },
- direction: D.oneOf(N("horizontal", "vertical")).def("horizontal"),
- align: D.oneOf(N("start", "end", "center", "baseline")),
- wrap: Q()
- });
- function ot(t) {
- return typeof t == "string" ? rt[t] : t || 0;
- }
- const C = L({
- compatConfig: {
- MODE: 3
- },
- name: "ASpace",
- inheritAttrs: !1,
- props: lt(),
- slots: Object,
- setup(t, e) {
- let {
- slots: l,
- attrs: a
- } = e;
- const {
- prefixCls: i,
- space: f,
- direction: x
- } = R("space", t), [S, b] = q(i), m = tt(), c = o(() => {
- var n, g, $;
- 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";
- }), p = P(), v = P();
- U(c, () => {
- [p.value, v.value] = (Array.isArray(c.value) ? c.value : [c.value, c.value]).map((n) => ot(n));
- }, {
- immediate: !0
- });
- const r = o(() => t.align === void 0 && t.direction === "horizontal" ? "center" : t.align), u = o(() => J(i.value, b.value, `${i.value}-${t.direction}`, {
- [`${i.value}-rtl`]: x.value === "rtl",
- [`${i.value}-align-${r.value}`]: r.value
- })), _ = o(() => x.value === "rtl" ? "marginLeft" : "marginRight"), s = o(() => {
- const n = {};
- return m.value && (n.columnGap = `${p.value}px`, n.rowGap = `${v.value}px`), d(d({}, n), t.wrap && {
- flexWrap: "wrap",
- marginBottom: `${-v.value}px`
- });
- });
- return () => {
- var n, g;
- const {
- wrap: $,
- direction: V = "horizontal"
- } = t, A = (n = l.default) === null || n === void 0 ? void 0 : n.call(l), E = K(A), W = E.length;
- if (W === 0)
- return null;
- const y = (g = l.split) === null || g === void 0 ? void 0 : g.call(l), H = `${i.value}-item`, O = p.value, B = W - 1;
- return h("div", M(M({}, a), {}, {
- class: [u.value, a.class],
- style: [s.value, a.style]
- }), [E.map((T, z) => {
- let G = A.indexOf(T);
- G === -1 && (G = `$$space-${z}`);
- let w = {};
- return m.value || (V === "vertical" ? z < B && (w = {
- marginBottom: `${O / (y ? 2 : 1)}px`
- }) : w = d(d({}, z < B && {
- [_.value]: `${O / (y ? 2 : 1)}px`
- }), $ && {
- paddingBottom: `${v.value}px`
- })), S(h(Z, {
- key: G
- }, [h("div", {
- class: H,
- style: w
- }, [T]), z < B && y && h("span", {
- class: `${H}-split`,
- style: w
- }, [y])]));
- })]);
- };
- }
- });
- C.Compact = I;
- C.install = function(t) {
- return t.component(C.name, C), t.component(I.name, I), t;
- };
- export {
- C as S,
- ut as _
- };
|