index-2dc56fe4.js 2.8 KB

1
  1. var x=(c,g,u)=>new Promise((y,a)=>{var r=n=>{try{l(u.next(n))}catch(m){a(m)}},s=n=>{try{l(u.throw(n))}catch(m){a(m)}},l=n=>n.done?y(n.value):Promise.resolve(n.value).then(r,s);l((u=u.apply(c,g)).next())});import{dp as E,r as v,u as h,dF as I,dG as M,am as H,c3 as R,dH as S,bV as C,d as $,z,_ as V,y as W,o as B,c as G,w as _,e as p,b,__tla as U}from"./index-b5895273.js";import{P as j,__tla as A}from"./index-3705f1a8.js";import{__tla as D}from"./onMountedOrActivated-6125a24a.js";import{__tla as F}from"./useWindowSizeFn-a59bee15.js";import{__tla as L}from"./useContentViewHeight-cd147d02.js";let P,N=Promise.all([(()=>{try{return U}catch(c){}})(),(()=>{try{return A}catch(c){}})(),(()=>{try{return D}catch(c){}})(),(()=>{try{return F}catch(c){}})(),(()=>{try{return L}catch(c){}})()]).then(()=>x(void 0,null,function*(){const c=Symbol("watermark-dom");function g(a=v(document.body)){const r=S(function(){const e=h(a);if(!e)return;const{clientHeight:t,clientWidth:i}=e;d({height:t,width:i})}),s=c.toString(),l=E(),n=()=>{const e=h(l);l.value=void 0;const t=h(a);t&&(e&&t.removeChild(e),I(t,r))};function m(e){const t=document.createElement("canvas"),i=300,f=240;Object.assign(t,{width:i,height:f});const o=t.getContext("2d");return o&&(o.rotate(-20*Math.PI/120),o.font="15px Vedana",o.fillStyle="rgba(0, 0, 0, 0.15)",o.textAlign="left",o.textBaseline="middle",o.fillText(e,i/20,f)),t.toDataURL("image/png")}function d(e={}){const t=h(l);t&&(C(e.width)&&(t.style.width=`${e.width}px`),C(e.height)&&(t.style.height=`${e.height}px`),C(e.str)&&(t.style.background=`url(${m(e.str)}) left top repeat`))}const k=e=>{if(h(l))return d({str:e}),s;const t=document.createElement("div");l.value=t,t.id=s,t.style.pointerEvents="none",t.style.top="0px",t.style.left="0px",t.style.position="absolute",t.style.zIndex="100000";const i=h(a);if(!i)return s;const{clientHeight:f,clientWidth:o}=i;return d({str:e,width:o,height:f}),i.appendChild(t),s};function w(e){k(e),M(document.documentElement,r),H()&&R(()=>{n()})}return{setWatermark:w,clear:n}}const u=$({components:{CollapseContainer:z,PageWrapper:j},setup(){const a=v(null),{setWatermark:r,clear:s}=g();return{setWatermark:r,clear:s,areaRef:a}}});function y(a,r,s,l,n,m){const d=W("a-button"),k=W("CollapseContainer"),w=W("PageWrapper");return B(),G(w,{title:"\u6C34\u5370\u793A\u4F8B"},{default:_(()=>[p(k,{class:"w-full h-32 bg-white rounded-md",title:"Global WaterMark"},{default:_(()=>[p(d,{type:"primary",class:"mr-2",onClick:r[0]||(r[0]=e=>a.setWatermark("WaterMark Info"))},{default:_(()=>[b(" Create ")]),_:1}),p(d,{color:"error",class:"mr-2",onClick:a.clear},{default:_(()=>[b(" Clear ")]),_:1},8,["onClick"]),p(d,{color:"warning",class:"mr-2",onClick:r[1]||(r[1]=e=>a.setWatermark("WaterMark Info New"))},{default:_(()=>[b(" Reset ")]),_:1})]),_:1})]),_:1})}P=V(u,[["render",y]])}));export{N as __tla,P as default};