| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163 |
- import { d as s, _ as B, K as V, dN as ze, dO as Se, bZ as Me, g as Ke, c as Te, ak as We, dP as Ue, dQ as Fe, u as we, w as ae, br as X, L as Ve, dd as se, dR as Xe, o as W, R as qe, y as ce, dS as Ee, dT as Qe, cz as Ze, dU as Ge, dV as Je } from "./index2.js";
- import { defineComponent as ie, shallowRef as Ye, onMounted as fe, createVNode as f, toRefs as et, reactive as Oe, watch as ue, ref as pe, createApp as tt, computed as oe, onBeforeUnmount as nt, nextTick as be, watchEffect as ot, Fragment as he, toRaw as it } from "vue";
- var lt = function(e, n) {
- var o = {};
- for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && n.indexOf(t) < 0 && (o[t] = e[t]);
- if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, t = Object.getOwnPropertySymbols(e); i < t.length; i++)
- n.indexOf(t[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[i]) && (o[t[i]] = e[t[i]]);
- return o;
- };
- const rt = {
- border: 0,
- background: "transparent",
- padding: 0,
- lineHeight: "inherit",
- display: "inline-block"
- }, ve = ie({
- compatConfig: {
- MODE: 3
- },
- name: "TransButton",
- inheritAttrs: !1,
- props: {
- noStyle: {
- type: Boolean,
- default: void 0
- },
- onClick: Function,
- disabled: {
- type: Boolean,
- default: void 0
- },
- autofocus: {
- type: Boolean,
- default: void 0
- }
- },
- setup(e, n) {
- let {
- slots: o,
- emit: t,
- attrs: i,
- expose: d
- } = n;
- const a = Ye(), l = (v) => {
- const {
- keyCode: S
- } = v;
- S === V.ENTER && v.preventDefault();
- }, m = (v) => {
- const {
- keyCode: S
- } = v;
- S === V.ENTER && t("click", v);
- }, C = (v) => {
- t("click", v);
- }, y = () => {
- a.value && a.value.focus();
- }, _ = () => {
- a.value && a.value.blur();
- };
- return fe(() => {
- e.autofocus && y();
- }), d({
- focus: y,
- blur: _
- }), () => {
- var v;
- const {
- noStyle: S,
- disabled: I
- } = e, N = lt(e, ["noStyle", "disabled"]);
- let $ = {};
- return S || ($ = s({}, rt)), I && ($.pointerEvents = "none"), f("div", B(B(B({
- role: "button",
- tabindex: 0,
- ref: a
- }, N), i), {}, {
- onClick: C,
- onKeydown: l,
- onKeyup: m,
- style: s(s({}, $), i.style || {})
- }), [(v = o.default) === null || v === void 0 ? void 0 : v.call(o)]);
- };
- }
- }), at = (e, n, o, t) => {
- const {
- sizeMarginHeadingVerticalEnd: i,
- fontWeightStrong: d
- } = t;
- return {
- marginBottom: i,
- color: o,
- fontWeight: d,
- fontSize: e,
- lineHeight: n
- };
- }, st = (e) => {
- const n = [1, 2, 3, 4, 5], o = {};
- return n.forEach((t) => {
- o[`
- h${t}&,
- div&-h${t},
- div&-h${t} > textarea,
- h${t}
- `] = at(e[`fontSizeHeading${t}`], e[`lineHeightHeading${t}`], e.colorTextHeading, e);
- }), o;
- }, ct = (e) => {
- const {
- componentCls: n
- } = e;
- return {
- "a&, a": s(s({}, Se(e)), {
- textDecoration: e.linkDecoration,
- "&:active, &:hover": {
- textDecoration: e.linkHoverDecoration
- },
- [`&[disabled], &${n}-disabled`]: {
- color: e.colorTextDisabled,
- cursor: "not-allowed",
- "&:active, &:hover": {
- color: e.colorTextDisabled
- },
- "&:active": {
- pointerEvents: "none"
- }
- }
- })
- };
- }, dt = () => ({
- code: {
- margin: "0 0.2em",
- paddingInline: "0.4em",
- paddingBlock: "0.2em 0.1em",
- fontSize: "85%",
- background: "rgba(150, 150, 150, 0.1)",
- border: "1px solid rgba(100, 100, 100, 0.2)",
- borderRadius: 3
- },
- kbd: {
- margin: "0 0.2em",
- paddingInline: "0.4em",
- paddingBlock: "0.15em 0.1em",
- fontSize: "90%",
- background: "rgba(150, 150, 150, 0.06)",
- border: "1px solid rgba(100, 100, 100, 0.2)",
- borderBottomWidth: 2,
- borderRadius: 3
- },
- mark: {
- padding: 0,
- // FIXME hardcode in v4
- backgroundColor: ze[2]
- },
- "u, ins": {
- textDecoration: "underline",
- textDecorationSkipInk: "auto"
- },
- "s, del": {
- textDecoration: "line-through"
- },
- strong: {
- fontWeight: 600
- },
- // list
- "ul, ol": {
- marginInline: 0,
- marginBlock: "0 1em",
- padding: 0,
- li: {
- marginInline: "20px 0",
- marginBlock: 0,
- paddingInline: "4px 0",
- paddingBlock: 0
- }
- },
- ul: {
- listStyleType: "circle",
- ul: {
- listStyleType: "disc"
- }
- },
- ol: {
- listStyleType: "decimal"
- },
- // pre & block
- "pre, blockquote": {
- margin: "1em 0"
- },
- pre: {
- padding: "0.4em 0.6em",
- whiteSpace: "pre-wrap",
- wordWrap: "break-word",
- background: "rgba(150, 150, 150, 0.1)",
- border: "1px solid rgba(100, 100, 100, 0.2)",
- borderRadius: 3,
- // Compatible for marked
- code: {
- display: "inline",
- margin: 0,
- padding: 0,
- fontSize: "inherit",
- fontFamily: "inherit",
- background: "transparent",
- border: 0
- }
- },
- blockquote: {
- paddingInline: "0.6em 0",
- paddingBlock: 0,
- borderInlineStart: "4px solid rgba(100, 100, 100, 0.2)",
- opacity: 0.85
- }
- }), ut = (e) => {
- const {
- componentCls: n
- } = e, t = Me(e).inputPaddingVertical + 1;
- return {
- "&-edit-content": {
- position: "relative",
- "div&": {
- insetInlineStart: -e.paddingSM,
- marginTop: -t,
- marginBottom: `calc(1em - ${t}px)`
- },
- [`${n}-edit-content-confirm`]: {
- position: "absolute",
- insetInlineEnd: e.marginXS + 2,
- insetBlockEnd: e.marginXS,
- color: e.colorTextDescription,
- // default style
- fontWeight: "normal",
- fontSize: e.fontSize,
- fontStyle: "normal",
- pointerEvents: "none"
- },
- textarea: {
- margin: "0!important",
- // Fix Editable Textarea flash in Firefox
- MozTransition: "none",
- height: "1em"
- }
- }
- };
- }, pt = (e) => ({
- "&-copy-success": {
- "\n &,\n &:hover,\n &:focus": {
- color: e.colorSuccess
- }
- }
- }), ft = () => ({
- "\n a&-ellipsis,\n span&-ellipsis\n ": {
- display: "inline-block",
- maxWidth: "100%"
- },
- "&-single-line": {
- whiteSpace: "nowrap"
- },
- "&-ellipsis-single-line": {
- overflow: "hidden",
- textOverflow: "ellipsis",
- // https://blog.csdn.net/iefreer/article/details/50421025
- "a&, span&": {
- verticalAlign: "bottom"
- }
- },
- "&-ellipsis-multiple-line": {
- display: "-webkit-box",
- overflow: "hidden",
- WebkitLineClamp: 3,
- WebkitBoxOrient: "vertical"
- }
- }), yt = (e) => {
- const {
- componentCls: n,
- sizeMarginHeadingVerticalStart: o
- } = e;
- return {
- [n]: s(s(s(s(s(s(s(s(s({
- color: e.colorText,
- wordBreak: "break-word",
- lineHeight: e.lineHeight,
- [`&${n}-secondary`]: {
- color: e.colorTextDescription
- },
- [`&${n}-success`]: {
- color: e.colorSuccess
- },
- [`&${n}-warning`]: {
- color: e.colorWarning
- },
- [`&${n}-danger`]: {
- color: e.colorError,
- "a&:active, a&:focus": {
- color: e.colorErrorActive
- },
- "a&:hover": {
- color: e.colorErrorHover
- }
- },
- [`&${n}-disabled`]: {
- color: e.colorTextDisabled,
- cursor: "not-allowed",
- userSelect: "none"
- },
- "\n div&,\n p\n ": {
- marginBottom: "1em"
- }
- }, st(e)), {
- [`
- & + h1${n},
- & + h2${n},
- & + h3${n},
- & + h4${n},
- & + h5${n}
- `]: {
- marginTop: o
- },
- "\n div,\n ul,\n li,\n p,\n h1,\n h2,\n h3,\n h4,\n h5": {
- "\n + h1,\n + h2,\n + h3,\n + h4,\n + h5\n ": {
- marginTop: o
- }
- }
- }), dt()), ct(e)), {
- // Operation
- [`
- ${n}-expand,
- ${n}-edit,
- ${n}-copy
- `]: s(s({}, Se(e)), {
- marginInlineStart: e.marginXXS
- })
- }), ut(e)), pt(e)), ft()), {
- "&-rtl": {
- direction: "rtl"
- }
- })
- };
- }, ke = Ke("Typography", (e) => [yt(e)], {
- sizeMarginHeadingVerticalStart: "1.2em",
- sizeMarginHeadingVerticalEnd: "0.5em"
- }), gt = () => ({
- prefixCls: String,
- value: String,
- maxlength: Number,
- autoSize: {
- type: [Boolean, Object]
- },
- onSave: Function,
- onCancel: Function,
- onEnd: Function,
- onChange: Function,
- originContent: String,
- direction: String,
- component: String
- }), mt = ie({
- compatConfig: {
- MODE: 3
- },
- name: "Editable",
- inheritAttrs: !1,
- props: gt(),
- // emits: ['save', 'cancel', 'end', 'change'],
- setup(e, n) {
- let {
- emit: o,
- slots: t,
- attrs: i
- } = n;
- const {
- prefixCls: d
- } = et(e), a = Oe({
- current: e.value || "",
- lastKeyCode: void 0,
- inComposition: !1,
- cancelFlag: !1
- });
- ue(() => e.value, (g) => {
- a.current = g;
- });
- const l = pe();
- fe(() => {
- var g;
- if (l.value) {
- const u = (g = l.value) === null || g === void 0 ? void 0 : g.resizableTextArea, h = u == null ? void 0 : u.textArea;
- h.focus();
- const {
- length: b
- } = h.value;
- h.setSelectionRange(b, b);
- }
- });
- function m(g) {
- l.value = g;
- }
- function C(g) {
- let {
- target: {
- value: u
- }
- } = g;
- a.current = u.replace(/[\r\n]/g, ""), o("change", a.current);
- }
- function y() {
- a.inComposition = !0;
- }
- function _() {
- a.inComposition = !1;
- }
- function v(g) {
- const {
- keyCode: u
- } = g;
- u === V.ENTER && g.preventDefault(), !a.inComposition && (a.lastKeyCode = u);
- }
- function S(g) {
- const {
- keyCode: u,
- ctrlKey: h,
- altKey: b,
- metaKey: O,
- shiftKey: H
- } = g;
- a.lastKeyCode === u && !a.inComposition && !h && !b && !O && !H && (u === V.ENTER ? (N(), o("end")) : u === V.ESC && (a.current = e.originContent, o("cancel")));
- }
- function I() {
- N();
- }
- function N() {
- o("save", a.current.trim());
- }
- const [$, R] = ke(d);
- return () => {
- const g = Te({
- [`${d.value}`]: !0,
- [`${d.value}-edit-content`]: !0,
- [`${d.value}-rtl`]: e.direction === "rtl",
- [e.component ? `${d.value}-${e.component}` : ""]: !0
- }, i.class, R.value);
- return $(f("div", B(B({}, i), {}, {
- class: g
- }), [f(We, {
- ref: m,
- maxlength: e.maxlength,
- value: a.current,
- onChange: C,
- onKeydown: v,
- onKeyup: S,
- onCompositionstart: y,
- onCompositionend: _,
- onBlur: I,
- rows: 1,
- autoSize: e.autoSize === void 0 || e.autoSize
- }, null), t.enterIcon ? t.enterIcon({
- className: `${e.prefixCls}-edit-content-confirm`
- }) : f(Ue, {
- class: `${e.prefixCls}-edit-content-confirm`
- }, null)]));
- };
- }
- }), bt = 3, ht = 8;
- let w;
- const de = {
- padding: 0,
- margin: 0,
- display: "inline",
- lineHeight: "inherit"
- };
- function _e(e, n) {
- e.setAttribute("aria-hidden", "true");
- const o = window.getComputedStyle(n), t = Fe(o);
- e.setAttribute("style", t), e.style.position = "fixed", e.style.left = "0", e.style.height = "auto", e.style.minHeight = "auto", e.style.maxHeight = "auto", e.style.paddingTop = "0", e.style.paddingBottom = "0", e.style.borderTopWidth = "0", e.style.borderBottomWidth = "0", e.style.top = "-999999px", e.style.zIndex = "-1000", e.style.textOverflow = "clip", e.style.whiteSpace = "normal", e.style.webkitLineClamp = "none";
- }
- function vt(e) {
- const n = document.createElement("div");
- _e(n, e), n.appendChild(document.createTextNode("text")), document.body.appendChild(n);
- const o = n.getBoundingClientRect().height;
- return document.body.removeChild(n), o;
- }
- const xt = (e, n, o, t, i) => {
- w || (w = document.createElement("div"), w.setAttribute("aria-hidden", "true"), document.body.appendChild(w));
- const {
- rows: d,
- suffix: a = ""
- } = n, l = vt(e), m = Math.round(l * d * 100) / 100;
- _e(w, e);
- const C = tt({
- render() {
- return f("div", {
- style: de
- }, [f("span", {
- style: de
- }, [o, a]), f("span", {
- style: de
- }, [t])]);
- }
- });
- C.mount(w);
- function y() {
- return Math.round(w.getBoundingClientRect().height * 100) / 100 - 0.1 <= m;
- }
- if (y())
- return C.unmount(), {
- content: o,
- text: w.innerHTML,
- ellipsis: !1
- };
- const _ = Array.prototype.slice.apply(w.childNodes[0].childNodes[0].cloneNode(!0).childNodes).filter((u) => {
- let {
- nodeType: h,
- data: b
- } = u;
- return h !== ht && b !== "";
- }), v = Array.prototype.slice.apply(w.childNodes[0].childNodes[1].cloneNode(!0).childNodes);
- C.unmount();
- const S = [];
- w.innerHTML = "";
- const I = document.createElement("span");
- w.appendChild(I);
- const N = document.createTextNode(i + a);
- I.appendChild(N), v.forEach((u) => {
- w.appendChild(u);
- });
- function $(u) {
- I.insertBefore(u, N);
- }
- function R(u, h) {
- let b = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0, O = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : h.length, H = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 0;
- const A = Math.floor((b + O) / 2), le = h.slice(0, A);
- if (u.textContent = le, b >= O - 1)
- for (let L = O; L >= b; L -= 1) {
- const U = h.slice(0, L);
- if (u.textContent = U, y() || !U)
- return L === h.length ? {
- finished: !1,
- vNode: h
- } : {
- finished: !0,
- vNode: U
- };
- }
- return y() ? R(u, h, A, O, A) : R(u, h, b, A, H);
- }
- function g(u) {
- if (u.nodeType === bt) {
- const b = u.textContent || "", O = document.createTextNode(b);
- return $(O), R(O, b);
- }
- return {
- finished: !1,
- vNode: null
- };
- }
- return _.some((u) => {
- const {
- finished: h,
- vNode: b
- } = g(u);
- return b && S.push(b), h;
- }), {
- content: S,
- text: w.innerHTML,
- ellipsis: !0
- };
- };
- var Ct = function(e, n) {
- var o = {};
- for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && n.indexOf(t) < 0 && (o[t] = e[t]);
- if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, t = Object.getOwnPropertySymbols(e); i < t.length; i++)
- n.indexOf(t[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[i]) && (o[t[i]] = e[t[i]]);
- return o;
- };
- const St = () => ({
- prefixCls: String,
- direction: String,
- // Form Internal use
- component: String
- }), E = ie({
- name: "ATypography",
- inheritAttrs: !1,
- props: St(),
- setup(e, n) {
- let {
- slots: o,
- attrs: t
- } = n;
- const {
- prefixCls: i,
- direction: d
- } = we("typography", e), [a, l] = ke(i);
- return () => {
- var m;
- const C = s(s({}, e), t), {
- prefixCls: y,
- direction: _,
- component: v = "article"
- } = C, S = Ct(C, ["prefixCls", "direction", "component"]);
- return a(f(v, B(B({}, S), {}, {
- class: Te(i.value, {
- [`${i.value}-rtl`]: d.value === "rtl"
- }, t.class, l.value)
- }), {
- default: () => [(m = o.default) === null || m === void 0 ? void 0 : m.call(o)]
- }));
- };
- }
- }), Tt = () => {
- const e = document.getSelection();
- if (!e.rangeCount)
- return function() {
- };
- let n = document.activeElement;
- const o = [];
- for (let t = 0; t < e.rangeCount; t++)
- o.push(e.getRangeAt(t));
- switch (n.tagName.toUpperCase()) {
- case "INPUT":
- case "TEXTAREA":
- n.blur();
- break;
- default:
- n = null;
- break;
- }
- return e.removeAllRanges(), function() {
- e.type === "Caret" && e.removeAllRanges(), e.rangeCount || o.forEach(function(t) {
- e.addRange(t);
- }), n && n.focus();
- };
- }, xe = {
- "text/plain": "Text",
- "text/html": "Url",
- default: "Text"
- }, wt = "Copy to clipboard: #{key}, Enter";
- function Et(e) {
- const n = (/mac os x/i.test(navigator.userAgent) ? "⌘" : "Ctrl") + "+C";
- return e.replace(/#{\s*key\s*}/g, n);
- }
- function Ot(e, n) {
- let o, t, i, d, a, l = !1;
- n || (n = {});
- const m = n.debug || !1;
- try {
- if (t = Tt(), i = document.createRange(), d = document.getSelection(), a = document.createElement("span"), a.textContent = e, a.style.all = "unset", a.style.position = "fixed", a.style.top = 0, a.style.clip = "rect(0, 0, 0, 0)", a.style.whiteSpace = "pre", a.style.webkitUserSelect = "text", a.style.MozUserSelect = "text", a.style.msUserSelect = "text", a.style.userSelect = "text", a.addEventListener("copy", function(y) {
- if (y.stopPropagation(), n.format)
- if (y.preventDefault(), typeof y.clipboardData == "undefined") {
- m && console.warn("unable to use e.clipboardData"), m && console.warn("trying IE specific stuff"), window.clipboardData.clearData();
- const _ = xe[n.format] || xe.default;
- window.clipboardData.setData(_, e);
- } else
- y.clipboardData.clearData(), y.clipboardData.setData(n.format, e);
- n.onCopy && (y.preventDefault(), n.onCopy(y.clipboardData));
- }), document.body.appendChild(a), i.selectNodeContents(a), d.addRange(i), !document.execCommand("copy"))
- throw new Error("copy command was unsuccessful");
- l = !0;
- } catch (C) {
- m && console.error("unable to copy using execCommand: ", C), m && console.warn("trying IE specific stuff");
- try {
- window.clipboardData.setData(n.format || "text", e), n.onCopy && n.onCopy(window.clipboardData), l = !0;
- } catch (y) {
- m && console.error("unable to copy using clipboardData: ", y), m && console.error("falling back to prompt"), o = Et("message" in n ? n.message : wt), window.prompt(o, e);
- }
- } finally {
- d && (typeof d.removeRange == "function" ? d.removeRange(i) : d.removeAllRanges()), a && document.body.removeChild(a), t();
- }
- return l;
- }
- var kt = function(e, n) {
- var o = {};
- for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && n.indexOf(t) < 0 && (o[t] = e[t]);
- if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, t = Object.getOwnPropertySymbols(e); i < t.length; i++)
- n.indexOf(t[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[i]) && (o[t[i]] = e[t[i]]);
- return o;
- };
- const _t = Ee("webkitLineClamp"), Nt = Ee("textOverflow"), Ce = "...", q = () => ({
- editable: {
- type: [Boolean, Object],
- default: void 0
- },
- copyable: {
- type: [Boolean, Object],
- default: void 0
- },
- prefixCls: String,
- component: String,
- type: String,
- disabled: {
- type: Boolean,
- default: void 0
- },
- ellipsis: {
- type: [Boolean, Object],
- default: void 0
- },
- code: {
- type: Boolean,
- default: void 0
- },
- mark: {
- type: Boolean,
- default: void 0
- },
- underline: {
- type: Boolean,
- default: void 0
- },
- delete: {
- type: Boolean,
- default: void 0
- },
- strong: {
- type: Boolean,
- default: void 0
- },
- keyboard: {
- type: Boolean,
- default: void 0
- },
- content: String,
- "onUpdate:content": Function
- }), Q = ie({
- compatConfig: {
- MODE: 3
- },
- name: "TypographyBase",
- inheritAttrs: !1,
- props: q(),
- // emits: ['update:content'],
- setup(e, n) {
- let {
- slots: o,
- attrs: t,
- emit: i
- } = n;
- const {
- prefixCls: d,
- direction: a
- } = we("typography", e), l = Oe({
- copied: !1,
- ellipsisText: "",
- ellipsisContent: null,
- isEllipsis: !1,
- expanded: !1,
- clientRendered: !1,
- //locale
- expandStr: "",
- copyStr: "",
- copiedStr: "",
- editStr: "",
- copyId: void 0,
- rafId: void 0,
- prevProps: void 0,
- originContent: ""
- }), m = pe(), C = pe(), y = oe(() => {
- const r = e.ellipsis;
- return r ? s({
- rows: 1,
- expandable: !1
- }, typeof r == "object" ? r : null) : {};
- });
- fe(() => {
- l.clientRendered = !0, A();
- }), nt(() => {
- clearTimeout(l.copyId), ae.cancel(l.rafId);
- }), ue([() => y.value.rows, () => e.content], () => {
- be(() => {
- O();
- });
- }, {
- flush: "post",
- deep: !0
- }), ot(() => {
- e.content === void 0 && (X(!e.editable, "Typography", "When `editable` is enabled, please use `content` instead of children"), X(!e.ellipsis, "Typography", "When `ellipsis` is enabled, please use `content` instead of children"));
- });
- function _() {
- var r;
- return e.ellipsis || e.editable ? e.content : (r = se(m.value)) === null || r === void 0 ? void 0 : r.innerText;
- }
- function v(r) {
- const {
- onExpand: c
- } = y.value;
- l.expanded = !0, c == null || c(r);
- }
- function S(r) {
- r.preventDefault(), l.originContent = e.content, b(!0);
- }
- function I(r) {
- N(r), b(!1);
- }
- function N(r) {
- const {
- onChange: c
- } = g.value;
- r !== e.content && (i("update:content", r), c == null || c(r));
- }
- function $() {
- var r, c;
- (c = (r = g.value).onCancel) === null || c === void 0 || c.call(r), b(!1);
- }
- function R(r) {
- r.preventDefault(), r.stopPropagation();
- const {
- copyable: c
- } = e, p = s({}, typeof c == "object" ? c : null);
- p.text === void 0 && (p.text = _()), Ot(p.text || ""), l.copied = !0, be(() => {
- p.onCopy && p.onCopy(r), l.copyId = setTimeout(() => {
- l.copied = !1;
- }, 3e3);
- });
- }
- const g = oe(() => {
- const r = e.editable;
- return r ? s({}, typeof r == "object" ? r : null) : {
- editing: !1
- };
- }), [u, h] = Ve(!1, {
- value: oe(() => g.value.editing)
- });
- function b(r) {
- const {
- onStart: c
- } = g.value;
- r && c && c(), h(r);
- }
- ue(u, (r) => {
- var c;
- r || (c = C.value) === null || c === void 0 || c.focus();
- }, {
- flush: "post"
- });
- function O(r) {
- if (r) {
- const {
- width: c,
- height: p
- } = r;
- if (!c || !p) return;
- }
- ae.cancel(l.rafId), l.rafId = ae(() => {
- A();
- });
- }
- const H = oe(() => {
- const {
- rows: r,
- expandable: c,
- suffix: p,
- onEllipsis: x,
- tooltip: T
- } = y.value;
- return p || T || e.editable || e.copyable || c || x ? !1 : r === 1 ? Nt : _t;
- }), A = () => {
- const {
- ellipsisText: r,
- isEllipsis: c
- } = l, {
- rows: p,
- suffix: x,
- onEllipsis: T
- } = y.value;
- if (!p || p < 0 || !se(m.value) || l.expanded || e.content === void 0 || H.value) return;
- const {
- content: P,
- text: z,
- ellipsis: j
- } = xt(se(m.value), {
- rows: p,
- suffix: x
- }, e.content, ye(!0), Ce);
- (r !== z || l.isEllipsis !== j) && (l.ellipsisText = z, l.ellipsisContent = P, l.isEllipsis = j, c !== j && T && T(j));
- };
- function le(r, c) {
- let {
- mark: p,
- code: x,
- underline: T,
- delete: P,
- strong: z,
- keyboard: j
- } = r, F = c;
- function D(ee, k) {
- if (!ee) return;
- const te = /* @__PURE__ */ function() {
- return F;
- }();
- F = f(k, null, {
- default: () => [te]
- });
- }
- return D(z, "strong"), D(T, "u"), D(P, "del"), D(x, "code"), D(p, "mark"), D(j, "kbd"), F;
- }
- function L(r) {
- const {
- expandable: c,
- symbol: p
- } = y.value;
- if (!c || !r && (l.expanded || !l.isEllipsis)) return null;
- const x = (o.ellipsisSymbol ? o.ellipsisSymbol() : p) || l.expandStr;
- return f("a", {
- key: "expand",
- class: `${d.value}-expand`,
- onClick: v,
- "aria-label": l.expandStr
- }, [x]);
- }
- function U() {
- if (!e.editable) return;
- const {
- tooltip: r,
- triggerType: c = ["icon"]
- } = e.editable, p = o.editableIcon ? o.editableIcon() : f(Qe, {
- role: "button"
- }, null), x = o.editableTooltip ? o.editableTooltip() : l.editStr, T = typeof x == "string" ? x : "";
- return c.indexOf("icon") !== -1 ? f(ce, {
- key: "edit",
- title: r === !1 ? "" : x
- }, {
- default: () => [f(ve, {
- ref: C,
- class: `${d.value}-edit`,
- onClick: S,
- "aria-label": T
- }, {
- default: () => [p]
- })]
- }) : null;
- }
- function Ne() {
- if (!e.copyable) return;
- const {
- tooltip: r
- } = e.copyable, c = l.copied ? l.copiedStr : l.copyStr, p = o.copyableTooltip ? o.copyableTooltip({
- copied: l.copied
- }) : c, x = typeof p == "string" ? p : "", T = l.copied ? f(Ze, null, null) : f(Ge, null, null), P = o.copyableIcon ? o.copyableIcon({
- copied: !!l.copied
- }) : T;
- return f(ce, {
- key: "copy",
- title: r === !1 ? "" : p
- }, {
- default: () => [f(ve, {
- class: [`${d.value}-copy`, {
- [`${d.value}-copy-success`]: l.copied
- }],
- onClick: R,
- "aria-label": x
- }, {
- default: () => [P]
- })]
- });
- }
- function Ie() {
- const {
- class: r,
- style: c
- } = t, {
- maxlength: p,
- autoSize: x,
- onEnd: T
- } = g.value;
- return f(mt, {
- class: r,
- style: c,
- prefixCls: d.value,
- value: e.content,
- originContent: l.originContent,
- maxlength: p,
- autoSize: x,
- onSave: I,
- onChange: N,
- onCancel: $,
- onEnd: T,
- direction: a.value,
- component: e.component
- }, {
- enterIcon: o.editableEnterIcon
- });
- }
- function ye(r) {
- return [L(r), U(), Ne()].filter((c) => c);
- }
- return () => {
- var r;
- const {
- triggerType: c = ["icon"]
- } = g.value, p = e.ellipsis || e.editable ? e.content !== void 0 ? e.content : (r = o.default) === null || r === void 0 ? void 0 : r.call(o) : o.default ? o.default() : e.content;
- return u.value ? Ie() : f(Xe, {
- componentName: "Text",
- children: (x) => {
- const T = s(s({}, e), t), {
- type: P,
- disabled: z,
- content: j,
- class: F,
- style: D
- } = T, ee = kt(T, ["type", "disabled", "content", "class", "style"]), {
- rows: k,
- suffix: te,
- tooltip: re
- } = y.value, {
- edit: $e,
- copy: Pe,
- copied: De,
- expand: Be
- } = x;
- l.editStr = $e, l.copyStr = Pe, l.copiedStr = De, l.expandStr = Be;
- const Re = W(ee, ["prefixCls", "editable", "copyable", "ellipsis", "mark", "code", "delete", "underline", "strong", "keyboard", "onUpdate:content"]), ne = H.value, Ae = k === 1 && ne, ge = k && k > 1 && ne;
- let M = p, je;
- if (k && l.isEllipsis && !l.expanded && !ne) {
- const {
- title: me
- } = ee;
- let K = me || "";
- !me && (typeof p == "string" || typeof p == "number") && (K = String(p)), K = K == null ? void 0 : K.slice(String(l.ellipsisContent || "").length), M = f(he, null, [it(l.ellipsisContent), f("span", {
- title: K,
- "aria-hidden": "true"
- }, [Ce]), te]);
- } else
- M = f(he, null, [p, te]);
- M = le(e, M);
- const He = re && k && l.isEllipsis && !l.expanded && !ne, Le = o.ellipsisTooltip ? o.ellipsisTooltip() : re;
- return f(qe, {
- onResize: O,
- disabled: !k
- }, {
- default: () => [f(E, B({
- ref: m,
- class: [{
- [`${d.value}-${P}`]: P,
- [`${d.value}-disabled`]: z,
- [`${d.value}-ellipsis`]: k,
- [`${d.value}-single-line`]: k === 1 && !l.isEllipsis,
- [`${d.value}-ellipsis-single-line`]: Ae,
- [`${d.value}-ellipsis-multiple-line`]: ge
- }, F],
- style: s(s({}, D), {
- WebkitLineClamp: ge ? k : void 0
- }),
- "aria-label": je,
- direction: a.value,
- onClick: c.indexOf("text") !== -1 ? S : () => {
- }
- }, Re), {
- default: () => [He ? f(ce, {
- title: re === !0 ? p : Le
- }, {
- default: () => [f("span", null, [M])]
- }) : M, ye()]
- })]
- });
- }
- }, null);
- };
- }
- });
- var It = function(e, n) {
- var o = {};
- for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && n.indexOf(t) < 0 && (o[t] = e[t]);
- if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, t = Object.getOwnPropertySymbols(e); i < t.length; i++)
- n.indexOf(t[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[i]) && (o[t[i]] = e[t[i]]);
- return o;
- };
- const $t = () => W(s(s({}, q()), {
- ellipsis: {
- type: Boolean,
- default: void 0
- }
- }), ["component"]), Z = (e, n) => {
- let {
- slots: o,
- attrs: t
- } = n;
- const i = s(s({}, e), t), {
- ellipsis: d,
- rel: a
- } = i, l = It(i, ["ellipsis", "rel"]);
- X(typeof d != "object", "Typography.Link", "`ellipsis` only supports boolean value.");
- const m = s(s({}, l), {
- rel: a === void 0 && l.target === "_blank" ? "noopener noreferrer" : a,
- ellipsis: !!d,
- component: "a"
- });
- return delete m.navigate, f(Q, m, o);
- };
- Z.displayName = "ATypographyLink";
- Z.inheritAttrs = !1;
- Z.props = $t();
- const Pt = () => W(q(), ["component"]), G = (e, n) => {
- let {
- slots: o,
- attrs: t
- } = n;
- const i = s(s(s({}, e), {
- component: "div"
- }), t);
- return f(Q, i, o);
- };
- G.displayName = "ATypographyParagraph";
- G.inheritAttrs = !1;
- G.props = Pt();
- const Dt = () => s(s({}, W(q(), ["component"])), {
- ellipsis: {
- type: [Boolean, Object],
- default: void 0
- }
- }), J = (e, n) => {
- let {
- slots: o,
- attrs: t
- } = n;
- const {
- ellipsis: i
- } = e;
- X(typeof i != "object" || !i || !("expandable" in i) && !("rows" in i), "Typography.Text", "`ellipsis` do not support `expandable` or `rows` props.");
- const d = s(s(s({}, e), {
- ellipsis: i && typeof i == "object" ? W(i, ["expandable", "rows"]) : i,
- component: "span"
- }), t);
- return f(Q, d, o);
- };
- J.displayName = "ATypographyText";
- J.inheritAttrs = !1;
- J.props = Dt();
- var Bt = function(e, n) {
- var o = {};
- for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && n.indexOf(t) < 0 && (o[t] = e[t]);
- if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, t = Object.getOwnPropertySymbols(e); i < t.length; i++)
- n.indexOf(t[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[i]) && (o[t[i]] = e[t[i]]);
- return o;
- };
- const Rt = Je(1, 2, 3, 4, 5), At = () => s(s({}, W(q(), ["component", "strong"])), {
- level: Number
- }), Y = (e, n) => {
- let {
- slots: o,
- attrs: t
- } = n;
- const {
- level: i = 1
- } = e, d = Bt(e, ["level"]);
- let a;
- Rt.includes(i) ? a = `h${i}` : (X(!1, "Typography", "Title only accept `1 | 2 | 3 | 4 | 5` as `level` value."), a = "h1");
- const l = s(s(s({}, d), {
- component: a
- }), t);
- return f(Q, l, o);
- };
- Y.displayName = "ATypographyTitle";
- Y.inheritAttrs = !1;
- Y.props = At();
- E.Text = J;
- E.Title = Y;
- E.Paragraph = G;
- E.Link = Z;
- E.Base = Q;
- E.install = function(e) {
- return e.component(E.name, E), e.component(E.Text.displayName, J), e.component(E.Title.displayName, Y), e.component(E.Paragraph.displayName, G), e.component(E.Link.displayName, Z), e;
- };
- export {
- G as P,
- Y as T,
- J as a
- };
|