1 |
- import{af as y,s as W,i as c,fI as v,fJ as x,M as _,fK as b,bg as $,ee as g,aw as B,a as I,cD as R,w as C,o as M,j as P,z as m,n as d,B as k}from"./index.7e08ba81.js";import{P as z}from"./index.334036fa.js";import"./index.ea1692d3.js";import"./index.3132743a.js";import"./useSize.1210be5f.js";import"./eagerComputed.41f917f7.js";import"./useWindowSizeFn.9cd1b73f.js";import"./useContentViewHeight.eee5bfce.js";import"./ArrowLeftOutlined.8453d1a8.js";import"./index.492f2ae6.js";import"./transButton.38e068f8.js";const S=Symbol("watermark-dom");function D(n=W(document.body)){const r=b(function(){const t=c(n);if(!t)return;const{clientHeight:e,clientWidth:o}=t;i({height:e,width:o})}),s=S.toString(),l=y(),f=()=>{const t=c(l);l.value=void 0;const e=c(n);!e||(t&&e.removeChild(t),v(e,r))};function w(t){const e=document.createElement("canvas"),o=300,u=240;Object.assign(e,{width:o,height:u});const a=e.getContext("2d");return a&&(a.rotate(-20*Math.PI/120),a.font="15px Vedana",a.fillStyle="rgba(0, 0, 0, 0.15)",a.textAlign="left",a.textBaseline="middle",a.fillText(t,o/20,u)),e.toDataURL("image/png")}function i(t={}){const e=c(l);!e||(g(t.width)&&(e.style.width=`${t.width}px`),g(t.height)&&(e.style.height=`${t.height}px`),g(t.str)&&(e.style.background=`url(${w(t.str)}) left top repeat`))}const p=t=>{if(c(l))return i({str:t}),s;const e=document.createElement("div");l.value=e,e.id=s,e.style.pointerEvents="none",e.style.top="0px",e.style.left="0px",e.style.position="absolute",e.style.zIndex="100000";const o=c(n);if(!o)return s;const{clientHeight:u,clientWidth:a}=o;return i({str:t,width:a,height:u}),o.appendChild(e),s};function h(t){p(t),x(document.documentElement,r),$()&&_(()=>{f()})}return{setWatermark:h,clear:f}}const E=I({components:{CollapseContainer:R,PageWrapper:z},setup(){const n=W(null),{setWatermark:r,clear:s}=D();return{setWatermark:r,clear:s,areaRef:n}}});function L(n,r,s,l,f,w){const i=C("a-button"),p=C("CollapseContainer"),h=C("PageWrapper");return M(),P(h,{title:"\u6C34\u5370\u793A\u4F8B"},{default:m(()=>[d(p,{class:"w-full h-32 bg-white rounded-md",title:"Global WaterMark"},{default:m(()=>[d(i,{type:"primary",class:"mr-2",onClick:r[0]||(r[0]=t=>n.setWatermark("WaterMark Info"))},{default:m(()=>[k(" Create ")]),_:1}),d(i,{color:"error",class:"mr-2",onClick:n.clear},{default:m(()=>[k(" Clear ")]),_:1},8,["onClick"]),d(i,{color:"warning",class:"mr-2",onClick:r[1]||(r[1]=t=>n.setWatermark("WaterMark Info New"))},{default:m(()=>[k(" Reset ")]),_:1})]),_:1})]),_:1})}var O=B(E,[["render",L]]);export{O as default};
|