Files
aiot-platform-ui/apps/web-antd/dist/js/Text-DsKDDcPS.js

17 lines
21 KiB
JavaScript
Raw Normal View History

2026-03-23 17:20:54 +08:00
import{cc as oe,cd as We,_ as f,ce as Se,n as Ue,m as Fe,h as Ee,bP as Ve,j as U,K as J,c as Ke,cf as Xe,y as we,cg as Q,ch as qe,ci as Oe,cj as Y,o as ie,aI as Ge,ax as Z,ck as Je,cl as Qe,cm as fe,cn as ge}from"./bootstrap-DmcuvVZS.js";import{j as p,m as le,bt as Ye,b7 as Te,w as te,b9 as ne,v as $e,aa as X,aW as Ze,bF as et,I as me,R as tt,n as ye}from"../jse/index-index-B6J4axeY.js";var nt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M864 170h-60c-4.4 0-8 3.6-8 8v518H310v-73c0-6.7-7.8-10.5-13-6.3l-141.9 112a8 8 0 000 12.6l141.9 112c5.3 4.2 13 .4 13-6.3v-75h498c35.3 0 64-28.7 64-64V178c0-4.4-3.6-8-8-8z"}}]},name:"enter",theme:"outlined"};function be(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?Object(arguments[t]):{},o=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))),o.forEach(function(r){ot(e,r,n[r])})}return e}function ot(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var re=function(t,n){var o=be({},t,n.attrs);return p(oe,be({},o,{icon:nt}),null)};re.displayName="EnterOutlined";re.inheritAttrs=!1;const it=(e,t,n,o)=>{const{sizeMarginHeadingVerticalEnd:r,fontWeightStrong:s}=o;return{marginBottom:r,color:n,fontWeight:s,fontSize:e,lineHeight:t}},lt=e=>{const t=[1,2,3,4,5],n={};return t.forEach(o=>{n[`
h${o}&,
div&-h${o},
div&-h${o} > textarea,
h${o}
`]=it(e[`fontSizeHeading${o}`],e[`lineHeightHeading${o}`],e.colorTextHeading,e)}),n},rt=e=>{const{componentCls:t}=e;return{"a&, a":f(f({},Se(e)),{textDecoration:e.linkDecoration,"&:active, &:hover":{textDecoration:e.linkHoverDecoration},[`&[disabled], &${t}-disabled`]:{color:e.colorTextDisabled,cursor:"not-allowed","&:active, &:hover":{color:e.colorTextDisabled},"&:active":{pointerEvents:"none"}}})}},at=()=>({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,backgroundColor:We[2]},"u, ins":{textDecoration:"underline",textDecorationSkipInk:"auto"},"s, del":{textDecoration:"line-through"},strong:{fontWeight:600},"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, 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,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:.85}}),ct=e=>{const{componentCls:t}=e,o=Ue(e).inputPaddingVertical+1;return{"&-edit-content":{position:"relative","div&":{insetInlineStart:-e.paddingSM,marginTop:-o,marginBottom:`calc(1em - ${o}px)`},[`${t}-edit-content-confirm`]:{position:"absolute",insetInlineEnd:e.marginXS+2,insetBlockEnd:e.marginXS,color:e.colorTextDescription,fontWeight:"normal",fontSize:e.fontSize,fontStyle:"normal",pointerEvents:"none"},textarea:{margin:"0!important",MozTransition:"none",height:"1em"}}}},st=e=>({"&-copy-success":{"\n &,\n &:hover,\n &:focus":{color:e.colorSuccess}}}),dt=()=>({"\n a&-ellipsis,\n span&-ellipsis\n ":{display:"inline-block",maxWidth:"100%"},"&-single-line":{whiteSpace:"nowrap"},"&-ellipsis-single-line":{overflow:"hidden",textOverflow:"ellipsis","a&, span&":{verticalAlign:"bottom"}},"&-ellipsis-multiple-line":{display:"-webkit-box",overflow:"hidden",WebkitLineClamp:3,WebkitBoxOrient:"vertical"}}),ut=e=>{const{componentCls:t,sizeMarginHeadingVerticalStart:n}=e;return{[t]:f(f(f(f(f(f(f(f(f({color:e.colorText,wordBreak:"break-word",lineHeight:e.lineHeight,[`&${t}-secondary`]:{color:e.colorTextDescription},[`&${t}-success`]:{color:e.colorSuccess},[`&${t}-warning`]:{color:e.colorWarning},[`&${t}-danger`]:{color:e.colorError,"a&:active, a&:focus":{color:e.colorErrorActive},"a&:hover":{color:e.colorErrorHover}},[`&${t}-disabled`]:{color:e.colorTextDisabled,cursor:"not-allowed",userSelect:"none"},"\n div&,\n p\n ":{marginBottom:"1em"}},lt(e)),{[`
& + h1${t},
& + h2${t},
& + h3${t},
& + h4${t},
& + h5${t}
`]:{marginTop:n},"\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:n}}}),at()),rt(e)),{[`
${t}-expand,
${t}-edit,
${t}-copy
2026-03-18 16:18:59 +08:00
`]:f(f({},Se(e)),{marginInlineStart:e.marginXXS})}),ct(e)),st(e)),dt()),{"&-rtl":{direction:"rtl"}})}},Ie=Fe("Typography",e=>[ut(e)],{sizeMarginHeadingVerticalStart:"1.2em",sizeMarginHeadingVerticalEnd:"0.5em"}),pt=()=>({prefixCls:String,value:String,maxlength:Number,autoSize:{type:[Boolean,Object]},onSave:Function,onCancel:Function,onEnd:Function,onChange:Function,originContent:String,direction:String,component:String}),ft=le({compatConfig:{MODE:3},name:"Editable",inheritAttrs:!1,props:pt(),setup(e,t){let{emit:n,slots:o,attrs:r}=t;const{prefixCls:s}=Ye(e),c=Te({current:e.value||"",lastKeyCode:void 0,inComposition:!1,cancelFlag:!1});te(()=>e.value,g=>{c.current=g});const l=ne();$e(()=>{var g;if(l.value){const d=(g=l.value)===null||g===void 0?void 0:g.resizableTextArea,b=d==null?void 0:d.textArea;b.focus();const{length:y}=b.value;b.setSelectionRange(y,y)}});function h(g){l.value=g}function C(g){let{target:{value:d}}=g;c.current=d.replace(/[\r\n]/g,""),n("change",c.current)}function m(){c.inComposition=!0}function T(){c.inComposition=!1}function B(g){const{keyCode:d}=g;d===J.ENTER&&g.preventDefault(),!c.inComposition&&(c.lastKeyCode=d)}function O(g){const{keyCode:d,ctrlKey:b,altKey:y,metaKey:E,shiftKey:H}=g;c.lastKeyCode===d&&!c.inComposition&&!b&&!y&&!E&&!H&&(d===J.ENTER?($(),n("end")):d===J.ESC&&(c.current=e.originContent,n("cancel")))}function N(){$()}function $(){n("save",c.current.trim())}const[M,P]=Ie(s);return()=>{const g=Ee({[`${s.value}`]:!0,[`${s.value}-edit-content`]:!0,[`${s.value}-rtl`]:e.direction==="rtl",[e.component?`${s.value}-${e.component}`:""]:!0},r.class,P.value);return M(p("div",U(U({},r),{},{class:g}),[p(Ve,{ref:h,maxlength:e.maxlength,value:c.current,onChange:C,onKeydown:B,onKeyup:O,onCompositionstart:m,onCompositionend:T,onBlur:N,rows:1,autoSize:e.autoSize===void 0||e.autoSize},null),o.enterIcon?o.enterIcon({className:`${e.prefixCls}-edit-content-confirm`}):p(re,{class:`${e.prefixCls}-edit-content-confirm`},null)]))}}}),gt=3,mt=8;let S;const ee={padding:0,margin:0,display:"inline",lineHeight:"inherit"};function De(e,t){e.setAttribute("aria-hidden","true");const n=window.getComputedStyle(t),o=Xe(n);e.setAttribute("style",o),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 yt(e){const t=document.createElement("div");De(t,e),t.appendChild(document.createTextNode("text")),document.body.appendChild(t);const n=t.getBoundingClientRect().height;return document.body.removeChild(t),n}const bt=(e,t,n,o,r)=>{S||(S=document.createElement("div"),S.setAttribute("aria-hidden","true"),document.body.appendChild(S));const{rows:s,suffix:c=""}=t,l=yt(e),h=Math.round(l*s*100)/100;De(S,e);const C=Ke({render(){return p("div",{style:ee},[p("span",{style:ee},[n,c]),p("span",{style:ee},[o])])}});C.mount(S);function m(){return Math.round(S.getBoundingClientRect().height*100)/100-.1<=h}if(m())return C.unmount(),{content:n,text:S.innerHTML,ellipsis:!1};const T=Array.prototype.slice.apply(S.childNodes[0].childNodes[0].cloneNode(!0).childNodes).filter(d=>{let{nodeType:b,data:y}=d;return b!==mt&&y!==""}),B=Array.prototype.slice.apply(S.childNodes[0].childNodes[1].cloneNode(!0).childNodes);C.unmount();const O=[];S.innerHTML="";const N=document.createElement("span");S.appendChild(N);const $=document.createTextNode(r+c);N.appendChild($),B.forEach(d=>{S.appendChild(d)});function M(d){N.insertBefore(d,$)}function P(d,b){let y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,E=arguments.length>3&&arguments[3]!==void 0?arguments[3]:b.length,H=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;const R=Math.floor((y+E)/2),q=b.slice(0,R);if(d.textContent=q,y>=E-1)for(let _=E;_>=y;_-=1){const L=b.slice(0,_);if(d.textContent=L,m()||!L)return _===b.length?{finished:!1,vNode:b}:{finished:!0,vNode:L}}return m()?P(d,b