| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- import { g as L, m as O, d as B, r as R, cx as j, cy as X, u as z, c as F, _ as b, bA as U, cz as V, cA as q, cB as G, c1 as J, P, cC as K } from "./index2.js";
- import { defineComponent as D, computed as m, createVNode as d, shallowRef as Q, watchEffect as Y, Fragment as Z } from "vue";
- const h = (e, c, l) => {
- const r = X(l);
- return {
- [`${e.componentCls}-${c}`]: {
- color: e[`color${l}`],
- background: e[`color${r}Bg`],
- borderColor: e[`color${r}Border`],
- [`&${e.componentCls}-borderless`]: {
- borderColor: "transparent"
- }
- }
- };
- }, ee = (e) => j(e, (c, l) => {
- let {
- textColor: r,
- lightBorderColor: n,
- lightColor: o,
- darkColor: t
- } = l;
- return {
- [`${e.componentCls}-${c}`]: {
- color: r,
- background: o,
- borderColor: n,
- // Inverse color
- "&-inverse": {
- color: e.colorTextLightSolid,
- background: t,
- borderColor: t
- },
- [`&${e.componentCls}-borderless`]: {
- borderColor: "transparent"
- }
- }
- };
- }), oe = (e) => {
- const {
- paddingXXS: c,
- lineWidth: l,
- tagPaddingHorizontal: r,
- componentCls: n
- } = e, o = r - l, t = c - l;
- return {
- // Result
- [n]: B(B({}, R(e)), {
- display: "inline-block",
- height: "auto",
- marginInlineEnd: e.marginXS,
- paddingInline: o,
- fontSize: e.tagFontSize,
- lineHeight: `${e.tagLineHeight}px`,
- whiteSpace: "nowrap",
- background: e.tagDefaultBg,
- border: `${e.lineWidth}px ${e.lineType} ${e.colorBorder}`,
- borderRadius: e.borderRadiusSM,
- opacity: 1,
- transition: `all ${e.motionDurationMid}`,
- textAlign: "start",
- // RTL
- [`&${n}-rtl`]: {
- direction: "rtl"
- },
- "&, a, a:hover": {
- color: e.tagDefaultColor
- },
- [`${n}-close-icon`]: {
- marginInlineStart: t,
- color: e.colorTextDescription,
- fontSize: e.tagIconSize,
- cursor: "pointer",
- transition: `all ${e.motionDurationMid}`,
- "&:hover": {
- color: e.colorTextHeading
- }
- },
- [`&${n}-has-color`]: {
- borderColor: "transparent",
- [`&, a, a:hover, ${e.iconCls}-close, ${e.iconCls}-close:hover`]: {
- color: e.colorTextLightSolid
- }
- },
- "&-checkable": {
- backgroundColor: "transparent",
- borderColor: "transparent",
- cursor: "pointer",
- [`&:not(${n}-checkable-checked):hover`]: {
- color: e.colorPrimary,
- backgroundColor: e.colorFillSecondary
- },
- "&:active, &-checked": {
- color: e.colorTextLightSolid
- },
- "&-checked": {
- backgroundColor: e.colorPrimary,
- "&:hover": {
- backgroundColor: e.colorPrimaryHover
- }
- },
- "&:active": {
- backgroundColor: e.colorPrimaryActive
- }
- },
- "&-hidden": {
- display: "none"
- },
- // To ensure that a space will be placed between character and `Icon`.
- [`> ${e.iconCls} + span, > span + ${e.iconCls}`]: {
- marginInlineStart: o
- }
- }),
- [`${n}-borderless`]: {
- borderColor: "transparent",
- background: e.tagBorderlessBg
- }
- };
- }, H = L("Tag", (e) => {
- const {
- fontSize: c,
- lineHeight: l,
- lineWidth: r,
- fontSizeIcon: n
- } = e, o = Math.round(c * l), t = e.fontSizeSM, g = o - r * 2, C = e.colorFillAlter, s = e.colorText, a = O(e, {
- tagFontSize: t,
- tagLineHeight: g,
- tagDefaultBg: C,
- tagDefaultColor: s,
- tagIconSize: n - 2 * r,
- tagPaddingHorizontal: 8,
- tagBorderlessBg: e.colorFillTertiary
- });
- return [oe(a), ee(a), h(a, "success", "Success"), h(a, "processing", "Info"), h(a, "error", "Error"), h(a, "warning", "Warning")];
- }), le = () => ({
- prefixCls: String,
- checked: {
- type: Boolean,
- default: void 0
- },
- onChange: {
- type: Function
- },
- onClick: {
- type: Function
- },
- "onUpdate:checked": Function
- }), S = D({
- compatConfig: {
- MODE: 3
- },
- name: "ACheckableTag",
- inheritAttrs: !1,
- props: le(),
- // emits: ['update:checked', 'change', 'click'],
- setup(e, c) {
- let {
- slots: l,
- emit: r,
- attrs: n
- } = c;
- const {
- prefixCls: o
- } = z("tag", e), [t, g] = H(o), C = (a) => {
- const {
- checked: u
- } = e;
- r("update:checked", !u), r("change", !u), r("click", a);
- }, s = m(() => F(o.value, g.value, {
- [`${o.value}-checkable`]: !0,
- [`${o.value}-checkable-checked`]: e.checked
- }));
- return () => {
- var a;
- return t(d("span", b(b({}, n), {}, {
- class: [s.value, n.class],
- onClick: C
- }), [(a = l.default) === null || a === void 0 ? void 0 : a.call(l)]));
- };
- }
- }), re = () => ({
- prefixCls: String,
- color: {
- type: String
- },
- closable: {
- type: Boolean,
- default: !1
- },
- closeIcon: P.any,
- /** @deprecated `visible` will be removed in next major version. */
- visible: {
- type: Boolean,
- default: void 0
- },
- onClose: {
- type: Function
- },
- onClick: K(),
- "onUpdate:visible": Function,
- icon: P.any,
- bordered: {
- type: Boolean,
- default: !0
- }
- }), v = D({
- compatConfig: {
- MODE: 3
- },
- name: "ATag",
- inheritAttrs: !1,
- props: re(),
- // emits: ['update:visible', 'close'],
- slots: Object,
- setup(e, c) {
- let {
- slots: l,
- emit: r,
- attrs: n
- } = c;
- const {
- prefixCls: o,
- direction: t
- } = z("tag", e), [g, C] = H(o), s = Q(!0);
- process.env.NODE_ENV !== "production" && U(e.visible === void 0, "Tag", '`visible` is deprecated, please use `<Tag v-show="visible" />` instead.'), Y(() => {
- e.visible !== void 0 && (s.value = e.visible);
- });
- const a = (i) => {
- i.stopPropagation(), r("update:visible", !1), r("close", i), !i.defaultPrevented && e.visible === void 0 && (s.value = !1);
- }, u = m(() => V(e.color) || q(e.color)), w = m(() => F(o.value, C.value, {
- [`${o.value}-${e.color}`]: u.value,
- [`${o.value}-has-color`]: e.color && !u.value,
- [`${o.value}-hidden`]: !s.value,
- [`${o.value}-rtl`]: t.value === "rtl",
- [`${o.value}-borderless`]: !e.bordered
- })), A = (i) => {
- r("click", i);
- };
- return () => {
- var i, f, p;
- const {
- icon: M = (i = l.icon) === null || i === void 0 ? void 0 : i.call(l),
- color: $,
- closeIcon: y = (f = l.closeIcon) === null || f === void 0 ? void 0 : f.call(l),
- closable: N = !1
- } = e, _ = () => N ? y ? d("span", {
- class: `${o.value}-close-icon`,
- onClick: a
- }, [y]) : d(J, {
- class: `${o.value}-close-icon`,
- onClick: a
- }, null) : null, E = {
- backgroundColor: $ && !u.value ? $ : void 0
- }, T = M || null, x = (p = l.default) === null || p === void 0 ? void 0 : p.call(l), k = T ? d(Z, null, [T, d("span", null, [x])]) : x, W = e.onClick !== void 0, I = d("span", b(b({}, n), {}, {
- onClick: A,
- class: [w.value, n.class],
- style: [E, n.style]
- }), [k, _()]);
- return g(W ? d(G, null, {
- default: () => [I]
- }) : I);
- };
- }
- });
- v.CheckableTag = S;
- v.install = function(e) {
- return e.component(v.name, v), e.component(S.name, S), e;
- };
- export {
- v as T
- };
|