znyg-frontend-common 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/cdn/index.cdn.js +1 -1
  2. package/cdn/index.cdn.js.map +1 -1
  3. package/cdn/index.cdn.mjs +1 -1
  4. package/cdn/index.cdn.mjs.map +1 -1
  5. package/es/directives/index.d.ts +2 -0
  6. package/es/directives/index.mjs +2 -0
  7. package/es/directives/index.mjs.map +1 -0
  8. package/es/directives/modules/copy.d.ts +3 -0
  9. package/es/directives/modules/copy.mjs +31 -0
  10. package/es/directives/modules/copy.mjs.map +1 -0
  11. package/es/hooks/index.d.ts +1 -1
  12. package/es/hooks/index.mjs +1 -1
  13. package/es/hooks/useDialog/index.d.ts +6 -0
  14. package/es/hooks/useDialog/index.mjs +13 -0
  15. package/es/hooks/useDialog/index.mjs.map +1 -0
  16. package/es/hooks/useDialog/src/index.d.ts +16 -0
  17. package/es/hooks/useDialog/src/index.mjs +122 -0
  18. package/es/hooks/useDialog/src/index.mjs.map +1 -0
  19. package/es/hooks/usePopWindow/src/index.mjs +6 -2
  20. package/es/hooks/usePopWindow/src/index.mjs.map +1 -1
  21. package/es/hooks/usePopWindow/src/interface/index.d.ts +2 -0
  22. package/es/index.d.ts +1 -0
  23. package/es/index.mjs +3 -1
  24. package/es/index.mjs.map +1 -1
  25. package/lib/directives/index.d.ts +2 -0
  26. package/lib/directives/index.js +8 -0
  27. package/lib/directives/index.js.map +1 -0
  28. package/lib/directives/modules/copy.d.ts +3 -0
  29. package/lib/directives/modules/copy.js +35 -0
  30. package/lib/directives/modules/copy.js.map +1 -0
  31. package/lib/hooks/index.d.ts +1 -1
  32. package/lib/hooks/index.js +9 -9
  33. package/lib/hooks/useDialog/index.d.ts +6 -0
  34. package/lib/hooks/useDialog/index.js +15 -0
  35. package/lib/hooks/useDialog/index.js.map +1 -0
  36. package/lib/hooks/useDialog/src/index.d.ts +16 -0
  37. package/lib/hooks/useDialog/src/index.js +126 -0
  38. package/lib/hooks/useDialog/src/index.js.map +1 -0
  39. package/lib/hooks/usePopWindow/src/index.js +6 -2
  40. package/lib/hooks/usePopWindow/src/index.js.map +1 -1
  41. package/lib/hooks/usePopWindow/src/interface/index.d.ts +2 -0
  42. package/lib/index.d.ts +1 -0
  43. package/lib/index.js +12 -9
  44. package/lib/index.js.map +1 -1
  45. package/package.json +1 -1
  46. package/es/hooks/useDeveloper/index.d.ts +0 -3
  47. package/es/hooks/useDeveloper/index.mjs +0 -12
  48. package/es/hooks/useDeveloper/index.mjs.map +0 -1
  49. package/lib/hooks/useDeveloper/index.d.ts +0 -3
  50. package/lib/hooks/useDeveloper/index.js +0 -14
  51. package/lib/hooks/useDeveloper/index.js.map +0 -1
package/cdn/index.cdn.js CHANGED
@@ -1,2 +1,2 @@
1
- var oe=Object.defineProperty;var l=(t,o)=>oe(t,"name",{value:o,configurable:!0});(function(t,o){typeof exports=="object"&&typeof module!="undefined"?o(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],o):(t=typeof globalThis!="undefined"?globalThis:t||self,o(t.ZnygFrontendCommon={},t.Vue,t.elementPlus))})(this,function(t,o,$){"use strict";var j=Object.defineProperty,v=l((e,n)=>j(e,"name",{value:n,configurable:!0}),"r$4");const g=v(e=>(e.install=n=>{const i=e;n.component(i.name,i)},e),"withInstall"),E=v((e,n)=>({install:v(i=>{i.directive(n,e)},"install"),directive:e}),"withInstallDirectives"),S={type:{type:String,default:"default"}};var V=o.defineComponent({name:"IButton",__name:"button",props:S,setup(e,{expose:n}){n();const i={};return Object.defineProperty(i,"__isScriptSetup",{enumerable:!1,value:!0}),i}}),D=l((e,n)=>{const i=e.__vccOpts||e;for(const[r,p]of n)i[r]=p;return i},"c"),T=Object.defineProperty,F=l((e,n)=>T(e,"name",{value:n,configurable:!0}),"t$1");function y(e,n,i,r,p,s){return o.openBlock(),o.createElementBlock("button",{class:o.normalizeClass(["mu-button",e.type])},[o.renderSlot(e.$slots,"default")],2)}l(y,"p$2"),F(y,"_sfc_render");var M=D(V,[["render",y],["__file","button.vue"]]);const _=g(M);var k=Object.defineProperty,q=l((e,n)=>k(e,"name",{value:n,configurable:!0}),"n");const N=[_],b=q(function(e){N.forEach(n=>e.use(n))},"install");var A={install:b},x=Object.defineProperty,z=l((e,n)=>x(e,"name",{value:n,configurable:!0}),"r");function W(){return{num:o.ref(0)}}l(W,"useDeveloper"),z(W,"useDeveloper");var L=Object.defineProperty,Z=l((e,n)=>L(e,"name",{value:n,configurable:!0}),"o");function I(){console.log("developFn")}l(I,"developFn"),Z(I,"developFn");var G=Object.defineProperty,H=l((e,n)=>G(e,"name",{value:n,configurable:!0}),"t");function u(e){return typeof e=="number"?`${e}px`:typeof e=="string"?e.endsWith("px")||e.endsWith("%")?e:`${e}px`:""}l(u,"formatValue"),H(u,"formatValue");var J=Object.defineProperty,d=l((e,n)=>J(e,"name",{value:n,configurable:!0}),"a");let w,c=[];const K=d(()=>document.querySelector("body"),"getBody"),C=d((e,n,i)=>{var r;const p={left:"0",top:"0",position:"absolute",id:"popwindow_"+Math.ceil(Math.random()*1e6),animate:!1,animateInClass:"animate__animated animate__faster animate__fadeIn",animateOutClass:"animate__animated animate__faster animate__fadeOut"};let s={...e};e.left!==void 0&&(s.left=u(s.left)),e.top!==void 0&&(s.top=u(s.top)),e.width!==void 0&&(s.width=u(s.width)),e.height!==void 0&&(s.height=u(s.height));const a=Object.assign(p,s),P=d(()=>{h(a.id)},"close");h(a.id);let ne=a.animate?a.animateInClass:"";const m=o.createVNode("div",{class:"popWindow "+ne,style:{width:a.width,height:a.height,left:a.left,top:a.top,position:a.position}},[o.createVNode($.ElScrollbar,null,{default:d(()=>[e.render?e.render({close:P,option:a}):o.createVNode(n,o.mergeProps({is:n},i,{onClose:d(()=>P(),"onClose")}),null)],"default")})]);m.appContext=w,(r=m.children)!=null&&r.length&&(m.children[0].appContext=w);const f=document.createElement("div");f.id="popwindow_"+Math.ceil(Math.random()*1e6),f.style.pointerEvents="auto";let B=K();return e.appendParent&&(B=document.getElementById(e.appendParent)),B.appendChild(f),o.render(m,f),o.nextTick(()=>{const te={id:a.id,tag:a.tag,node:f,option:a};c.push(te)}),{id:a.id,close:P}},"showPopWindow"),O=d(e=>{var n;if(!e)return;const{option:i,node:r}=e;if((n=i.onClose)==null||n.call(i),i.animate){const p=r.querySelector(".popWindow");p.className="popWindow "+i.animateOutClass,p.addEventListener("animationend",()=>{o.render(null,r),r.remove(),c.splice(c.indexOf(e),1)})}else o.render(null,r),r.remove(),c.splice(c.indexOf(e),1)},"removePopWindow"),h=d(e=>{const n=c.find(i=>i.id===e);n&&O(n)},"closePopWindowById"),Q=d(e=>{c.filter(n=>n.tag===e).forEach(n=>O(n))},"closePopWindowByTag"),R=d(()=>c,"getAllPopWindows"),U=d(e=>{const{appContext:n}=e||o.getCurrentInstance()||{};return w=n,{showPopWindow:C}},"initPopWindow");var X=Object.defineProperty,Y=l((e,n)=>X(e,"name",{value:n,configurable:!0}),"p");const ee=Y(e=>{const n=e||o.getCurrentInstance(),{showPopWindow:i}=U(n);return{showPopWindow:i}},"usePopWindow");t.IButton=_,t.closePopWindowById=h,t.closePopWindowByTag=Q,t.default=A,t.developFn=I,t.formatValue=u,t.getAllPopWindows=R,t.install=b,t.showPopWindow=C,t.useDeveloper=W,t.usePopWindow=ee,t.withInstall=g,t.withInstallDirectives=E,Object.defineProperty(t,"__esModule",{value:!0})});
1
+ var Ce=Object.defineProperty;var r=(a,o)=>Ce(a,"name",{value:o,configurable:!0});(function(a,o){typeof exports=="object"&&typeof module!="undefined"?o(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],o):(a=typeof globalThis!="undefined"?globalThis:a||self,o(a.ZnygFrontendCommon={},a.Vue,a.elementPlus))})(this,function(a,o,p){"use strict";var q=Object.defineProperty,C=r((e,t)=>q(e,"name",{value:t,configurable:!0}),"r$4");const E=C(e=>(e.install=t=>{const n=e;t.component(n.name,n)},e),"withInstall"),M=C((e,t)=>({install:C(n=>{n.directive(t,e)},"install"),directive:e}),"withInstallDirectives"),R={type:{type:String,default:"default"}};var A=o.defineComponent({name:"IButton",__name:"button",props:R,setup(e,{expose:t}){t();const n={};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}}),L=r((e,t)=>{const n=e.__vccOpts||e;for(const[d,u]of t)n[d]=u;return n},"c$1"),z=Object.defineProperty,U=r((e,t)=>z(e,"name",{value:t,configurable:!0}),"t$3");function O(e,t,n,d,u,c){return o.openBlock(),o.createElementBlock("button",{class:o.normalizeClass(["mu-button",e.type])},[o.renderSlot(e.$slots,"default")],2)}r(O,"p$3"),U(O,"_sfc_render");var Z=L(A,[["render",O],["__file","button.vue"]]);const V=E(Z);var G=Object.defineProperty,H=r((e,t)=>G(e,"name",{value:t,configurable:!0}),"n$1");const J=[V],I=H(function(e){J.forEach(t=>e.use(t))},"install");var K={install:I},Q=Object.defineProperty,X=r((e,t)=>Q(e,"name",{value:t,configurable:!0}),"o");function j(){console.log("developFn")}r(j,"developFn"),X(j,"developFn");var Y=Object.defineProperty,ee=r((e,t)=>Y(e,"name",{value:t,configurable:!0}),"t$2");function g(e){return typeof e=="number"?`${e}px`:typeof e=="string"?e.endsWith("px")||e.endsWith("%")?e:`${e}px`:""}r(g,"formatValue"),ee(g,"formatValue");var te=Object.defineProperty,s=r((e,t)=>te(e,"name",{value:t,configurable:!0}),"a$1");let v,f=[];const oe=s(()=>document.querySelector("body"),"getBody"),B=s((e,t,n)=>{var d;const u={left:"auto",top:"auto",right:"auto",bottom:"auto",position:"absolute",id:"popwindow_"+Math.ceil(Math.random()*1e6),animate:!1,animateInClass:"animate__animated animate__faster animate__fadeIn",animateOutClass:"animate__animated animate__faster animate__fadeOut"};let c={...e};e.left!==void 0&&(c.left=g(c.left)),e.top!==void 0&&(c.top=g(c.top)),e.width!==void 0&&(c.width=g(c.width)),e.height!==void 0&&(c.height=g(c.height));const l=Object.assign(u,c),m=s(()=>{P(l.id)},"close");P(l.id);let h=l.animate?l.animateInClass:"";const b=o.createVNode("div",{class:"popWindow "+h,style:{width:l.width,height:l.height,left:l.left,right:l.right,top:l.top,bottom:l.bottom,position:l.position}},[o.createVNode(p.ElScrollbar,null,{default:s(()=>[e.render?e.render({close:m,option:l}):o.createVNode(t,o.mergeProps({is:t},n,{onClose:s(()=>m(),"onClose")}),null)],"default")})]);b.appContext=v,(d=b.children)!=null&&d.length&&(b.children[0].appContext=v);const w=document.createElement("div");w.id="popwindow_"+Math.ceil(Math.random()*1e6),w.style.pointerEvents="auto";let x=oe();return e.appendParent&&(x=document.getElementById(e.appendParent)),x.appendChild(w),o.render(b,w),o.nextTick(()=>{const be={id:l.id,tag:l.tag,node:w,option:l};f.push(be)}),{id:l.id,close:m}},"showPopWindow"),N=s(e=>{var t;if(!e)return;const{option:n,node:d}=e;if((t=n.onClose)==null||t.call(n),n.animate){const u=d.querySelector(".popWindow");u.className="popWindow "+n.animateOutClass,u.addEventListener("animationend",()=>{o.render(null,d),d.remove(),f.splice(f.indexOf(e),1)})}else o.render(null,d),d.remove(),f.splice(f.indexOf(e),1)},"removePopWindow"),P=s(e=>{const t=f.find(n=>n.id===e);t&&N(t)},"closePopWindowById"),ne=s(e=>{f.filter(t=>t.tag===e).forEach(t=>N(t))},"closePopWindowByTag"),ae=s(()=>f,"getAllPopWindows"),le=s(e=>{const{appContext:t}=e||o.getCurrentInstance()||{};return v=t,{showPopWindow:B}},"initPopWindow");var ie=Object.defineProperty,re=r((e,t)=>ie(e,"name",{value:t,configurable:!0}),"p$1");const de=re(e=>{const t=e||o.getCurrentInstance(),{showPopWindow:n}=le(t);return{showPopWindow:n}},"usePopWindow");var ce=Object.defineProperty,i=r((e,t)=>ce(e,"name",{value:t,configurable:!0}),"t$1");function S(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!o.isVNode(e)}r(S,"$"),i(S,"_isSlot");const _="work-dialog";let k=0,D;const F=i(()=>document.querySelector("body"),"getFather"),W=o.ref(!0),y=i(()=>{W.value=!1,setTimeout(()=>{const e=document.querySelector(`#${_}-${k--}`);e&&(o.render(null,e),F().removeChild(e)),W.value=!0},500)},"closeDialog"),T=i(e=>(e!=null&&e.onClose&&(e==null||e.onClose(y)),y()),"handleClose"),se=i(e=>(e!=null&&e.onConfirm&&(e==null||e.onConfirm(y)),y()),"handleConfirm"),ue=i((e,t,n)=>{var d;const u=o.ref("default"),c=o.ref(e.height),l=o.createVNode(p.ElConfigProvider,{namespace:"el",size:o.unref(u)},{default:i(()=>[o.createVNode(p.ElDialog,o.mergeProps({modelValue:W.value,title:"\u5F39\u6846",width:"50%","before-close":i(()=>T(e),"before-close"),"close-on-click-modal":!0},e,{render:!0,headerRender:!0,footerRender:!0,class:_}),{default:i(()=>{if(e.render){let h;return o.createVNode(p.ElScrollbar,{style:{height:o.unref(c)}},S(h=e.render())?h:{default:i(()=>[h],"default")})}return o.createVNode(p.ElScrollbar,{style:{height:o.unref(c)}},{default:i(()=>[o.createVNode(t,o.mergeProps({is:t},n,{onCloseDialog:i(()=>y(),"onCloseDialog")}),null)],"default")})},"default"),header:i(h=>e!=null&&e.headerRender?e.headerRender(h):o.createVNode("div",{style:"display: flex"},[o.createVNode("span",{class:"el-dialog__title",style:"flex: 1"},[e.title])]),"header"),footer:i(()=>{if(e.footerRender)return e.footerRender();if(e.showFooter!==!1)return o.createVNode(o.Fragment,null,[o.createVNode(p.ElButton,{onClick:i(()=>T(e),"onClick")},{default:i(()=>[o.createTextVNode("\u53D6 \u6D88")],"default")}),o.createVNode(p.ElButton,{type:"primary",onClick:i(()=>se(e),"onClick")},{default:i(()=>[o.createTextVNode("\u786E \u5B9A")],"default")})])},"footer")})],"default")});l.appContext=D,(d=l.children)!=null&&d.length&&(l.children[0].appContext=D);const m=document.createElement("div");m.id=`${_}-${++k}`,F().appendChild(m),o.render(l,m)},"showDialog"),pe=i(e=>{const{appContext:t}=e||o.getCurrentInstance()||{};return D=t,{showDialog:ue}},"initDialog");var fe=Object.defineProperty,me=r((e,t)=>fe(e,"name",{value:t,configurable:!0}),"t");const he=me(e=>{const t=e||o.getCurrentInstance(),{showDialog:n}=pe(t);return{open:n,close:y}},"useDialog");var ge=Object.defineProperty,ye=r((e,t)=>ge(e,"name",{value:t,configurable:!0}),"i");const we={mounted(e,t){e.copyData=t.value,e.addEventListener("click",$)},updated(e,t){e.copyData=t.value},beforeUnmount(e){e.removeEventListener("click",$)}};async function $(){try{await navigator.clipboard.writeText(this.copyData),p.ElMessage({type:"success",message:"\u590D\u5236\u6210\u529F"})}catch(e){console.error("\u590D\u5236\u64CD\u4F5C\u4E0D\u88AB\u652F\u6301\u6216\u5931\u8D25: ",e)}}r($,"n"),ye($,"handleClick"),a.IButton=V,a.closePopWindowById=P,a.closePopWindowByTag=ne,a.default=K,a.developFn=j,a.formatValue=g,a.getAllPopWindows=ae,a.install=I,a.showPopWindow=B,a.useDialog=he,a.usePopWindow=de,a.vCopy=we,a.withInstall=E,a.withInstallDirectives=M,Object.defineProperty(a,"__esModule",{value:!0})});
2
2
  //# sourceMappingURL=index.cdn.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cdn.js","sources":["../../../packages/utils/install.ts","../../../packages/components/button/src/button.ts","../../../packages/components/button/src/button.vue","../../../packages/components/button/index.ts","../../../packages/installer.ts","../../../packages/hooks/useDeveloper/index.ts","../../../packages/utils/myDevelop.ts","../../../packages/utils/index.ts","../../../packages/hooks/usePopWindow/src/index.tsx","../../../packages/hooks/usePopWindow/index.ts"],"sourcesContent":["import type { App, Directive } from 'vue';\nimport type { SFCWithInstall } from '../types';\n\n// 注册组件\nexport const withInstall = <T>(main: T) => {\n (main as SFCWithInstall<T>).install = (app): void => {\n const comp: Record<string, any> = main as Record<string, any>;\n app.component(comp.name, comp);\n };\n return main as SFCWithInstall<T>;\n};\n\n// 注册指令\nexport const withInstallDirectives = <T extends Directive>(main: T, name: string) => {\n return {\n install: (app: App): void => {\n app.directive(name, main);\n },\n directive: main,\n };\n};\n","import type { ExtractPropTypes, PropType } from 'vue';\nimport type button from './button.vue';\n\nexport type Type = 'primary' | 'success' | 'error';\n\nexport const ButtonProps = {\n type: {\n type: String as PropType<Type>,\n default: 'default',\n },\n};\n\nexport type ButtonPropsType = ExtractPropTypes<typeof ButtonProps>;\nexport type ButtonInstanceType = InstanceType<typeof button>;\n","<script lang=\"ts\" setup>\n import { ButtonProps } from './button';\n\n defineProps(ButtonProps);\n\n defineOptions({\n name: 'IButton',\n });\n</script>\n\n<template>\n <button class=\"mu-button\" :class=\"type\">\n <slot></slot>\n </button>\n</template>\n","import { withInstall } from '../../utils/install';\nimport Button from './src/button.vue';\n\nexport const IButton = withInstall(Button); // 增加类型\n\nexport default IButton;\n","import type { App, Plugin } from 'vue';\n\nimport { IButton } from './components/button';\n\nconst component = [IButton] as Plugin[];\n\nexport const install = function (app: App) {\n component.forEach((i) => app.use(i));\n};\n\nexport default {\n install,\n};\n","import { ref } from 'vue';\n\nexport function useDeveloper() {\n const num = ref<number>(0);\n return { num };\n}\n","// utils 用例\nexport function developFn() {\n console.log('developFn');\n}\n","export * from './install';\nexport * from './myDevelop';\n\n\nexport function formatValue(value: number | string): string {\n if (typeof value === 'number') {\n return `${value}px`;\n } else if (typeof value === 'string') {\n // 检查是否已经带有 px 单位或其他单位\n if (value.endsWith('px') || value.endsWith('%')) {\n return value; // 直接返回已有单位的字符串\n }\n return `${value}px`; // 其他字符串类型的值加上 px\n }\n return '';\n}","import { type AppContext, type Component, type ComponentInternalInstance, getCurrentInstance, nextTick, render } from 'vue'\n\nimport { type PopWindowInfoProps, type PopWindowProps } from './interface'\nimport { ElScrollbar } from 'element-plus'\nimport { formatValue } from '../../../utils'\n\nlet appContextConst: AppContext | undefined\nlet popWindowList: Array<any> = []\nconst getBody = (): Element => {\n return document.querySelector('body') as HTMLBodyElement\n}\n/**\n * 显示弹出窗口\n *\n * 此函数用于创建并显示一个弹出窗口,支持自定义样式和内容通过参数传递\n * 可以选择附加到特定的父元素,并且在渲染后会将自身添加到弹出窗口列表中\n *\n * @param props 弹出窗口的属性,包括位置、尺寸等样式属性以及附加属性\n * @param component 可选参数,用于指定弹出窗口内渲染的自定义组件类型,如果props中传了render函数,则无效\n * @param componentProps 可选参数,传递给自定义组件的属性\n */\nexport const showPopWindow = (props: PopWindowProps, component?: Component, componentProps?: any) => {\n const op = {\n left: '0',\n top: '0',\n // width: 'auto',\n // height: 'auto',\n position: 'absolute',\n id: 'popwindow_' + Math.ceil(Math.random() * 1000000),\n animate: false,\n animateInClass: 'animate__animated animate__faster animate__fadeIn',\n animateOutClass: 'animate__animated animate__faster animate__fadeOut'\n }\n let propsFormat = { ...props }\n if (props.left !== undefined) propsFormat.left = formatValue(propsFormat.left)\n if (props.top !== undefined) propsFormat.top = formatValue(propsFormat.top)\n if (props.width !== undefined) propsFormat.width = formatValue(propsFormat.width)\n if (props.height !== undefined) propsFormat.height = formatValue(propsFormat.height)\n\n const option: PopWindowProps = Object.assign(op, propsFormat)\n const close = () => {\n closePopWindowById(option.id)\n }\n\n // 相同的id只会存在一个\n closePopWindowById(option.id)\n let animateClass = option.animate ? option.animateInClass : ''\n\n const vm = (\n <div\n class={'popWindow ' + animateClass}\n style={{ width: option.width, height: option.height, left: option.left, top: option.top, position: option.position }}>\n <ElScrollbar>\n {props.render ? props.render({ close, option }) : <component is={component} {...componentProps} onClose={() => close()}></component>}\n </ElScrollbar>\n </div>\n )\n vm.appContext = appContextConst\n // 这里是为了让插槽的子组件能获取到appContext\n if (vm.children?.length) {\n vm.children[0].appContext = appContextConst\n }\n const container = document.createElement('div')\n container.id = 'popwindow_' + Math.ceil(Math.random() * 1000000)\n container.style.pointerEvents='auto'\n\n let parentEl = getBody()\n if (props.appendParent) {\n parentEl = document.getElementById(props.appendParent)\n }\n parentEl.appendChild(container)\n render(vm, container)\n\n nextTick(() => {\n const popWindowInfo = { id: option.id, tag: option.tag, node: container, option }\n popWindowList.push(popWindowInfo)\n })\n return { id: option.id, close }\n}\nconst removePopWindow = (popWindowInfo: PopWindowInfoProps) => {\n if (!popWindowInfo) return\n const { option, node } = popWindowInfo\n option.onClose?.()\n if (option.animate) {\n const popWindowNode = node.querySelector('.popWindow')\n popWindowNode.className = 'popWindow ' + option.animateOutClass\n popWindowNode.addEventListener('animationend', () => {\n render(null, node)\n node.remove()\n popWindowList.splice(popWindowList.indexOf(popWindowInfo), 1)\n })\n } else {\n render(null, node)\n node.remove()\n popWindowList.splice(popWindowList.indexOf(popWindowInfo), 1)\n }\n}\n\n/**\n * 根据ID关闭弹出窗口\n *\n * @param id 弹出窗口的唯一标识符\n */\nexport const closePopWindowById = (id: string) => {\n const popWindowItem = popWindowList.find((item) => item.id === id)\n if (popWindowItem) {\n removePopWindow(popWindowItem)\n }\n}\n\n/**\n * 根据tag关闭弹出窗口\n *\n * @param tag 弹出窗口的tag\n */\nexport const closePopWindowByTag = (tag: string) => {\n const popWindows = popWindowList.filter((item) => item.tag === tag)\n popWindows.forEach((item) => removePopWindow(item))\n}\n\n/**\n * 获取所有弹窗信息\n *\n * @returns {PopWindowInfoProps[]} 所有弹窗的列表\n */\nexport const getAllPopWindows = (): PopWindowInfoProps[] => {\n return popWindowList\n}\n\nexport const initPopWindow = (ctx?: ComponentInternalInstance) => {\n const { appContext } = ctx || getCurrentInstance() || {}\n appContextConst = appContext\n\n return { showPopWindow }\n}\n","import { type ComponentInternalInstance, getCurrentInstance } from 'vue'\n\nimport { closePopWindowById, closePopWindowByTag, initPopWindow, showPopWindow, getAllPopWindows } from './src/index'\nimport { type PopWindowInfoProps, type PopWindowProps } from './src/interface'\n\nexport { showPopWindow, closePopWindowById, closePopWindowByTag, getAllPopWindows }\nexport type { PopWindowInfoProps, PopWindowProps }\nexport const usePopWindow = (ctx?: any) => {\n const thisAppContext = ctx || (getCurrentInstance() as ComponentInternalInstance)\n const { showPopWindow } = initPopWindow(thisAppContext)\n return { showPopWindow }\n}\n"],"names":["s","r","__name","t","e","withInstall","main","app","comp","withInstallDirectives","name","ButtonProps","_sfc_render","_ctx","_cache","$props","type","$data","$options","_normalizeClass","IButton","Button","component","install","i","r$2","o","useDeveloper","ref","l","developFn","formatValue","value","appContextConst","popWindowList","getBody","document","querySelector","showPopWindow","props","componentProps","op","left","top","position","id","Math","ceil","random","animate","animateInClass","animateOutClass","propsFormat","undefined","width","height","option","Object","assign","close","closePopWindowById","animateClass","vm","_createVNode","ElScrollbar","default","render","_mergeProps","onClose","appContext","children","length","container","createElement","style","pointerEvents","parentEl","appendParent","getElementById","appendChild","nextTick","popWindowInfo","tag","node","push","removePopWindow","popWindowNode","className","addEventListener","remove","splice","indexOf","popWindowItem","find","item","closePopWindowByTag","filter","forEach","getAllPopWindows","initPopWindow","ctx","getCurrentInstance","usePopWindow","thisAppContext"],"mappings":"iaAIO,IAAAA,EAAA,OAAA,eAAAC,EAAAC,EAAA,CAAAC,EAAAC,IAAAJ,EAAAG,EAAA,OAAA,CAAA,MAAAC,EAAA,aAAA,EAAA,CAAA,EAAA,OAAA,MAAMC,EAAcH,EAAII,IAC5BA,EAA2B,QAAWC,GAAc,CACnD,MAAMC,EAA4BF,EAClCC,EAAI,UAAUC,EAAK,KAAMA,CAAI,CAC/B,EACOF,GALkB,aAAA,EASdG,EAAwBP,EAAA,CAAsBI,EAASI,KAC3D,CACL,QAASR,EAACK,GAAmB,CAC3BA,EAAI,UAAUG,EAAMJ,CAAI,CAC1B,EAFS,SAGT,EAAA,UAAWA,CACb,GANmC,uBAAA,ECRxBK,EAAc,CACzB,KAAM,CACJ,KAAM,OACN,QAAS,SACX,CACF,0VCCeC,EAXfC,EAAAC,EAWgBC,EAAoBC,EAAIC,EAAAC,EAAA,qDACpC,MAAaC,EAAAA,eAAA,CAAA,YAAAN,EAAA,IAAA,CAAA,CAAA,wCADFD,EAAAA,EAAAA,OAAAV,EAAAU,EAAA,iECRR,MAAMQ,EAAUf,EAAYgB,CAAM,oFCCzC,MAAMC,EAAY,CAACF,CAAO,EAEbG,EA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EAAAA,EAAuBb,EAAAA,GAAgB,CAC/BhD,EAAc8D,OAAQF,GAASA,EAAKZ,MAAQA,CAAG,EACvDe,QAASH,GAAST,EAAgBS,CAAI,CAAC,CACpD,EAHoCZ,qBAUvBgB,EAAAA,EAAmBA,EAAAA,IACvBhE,EADuBgE,kBAAAA,EAInBC,EAAiBC,EAAAA,GAAoC,CAChE,KAAM,CAAE/B,WAAAA,CAAW,EAAI+B,GAAOC,EAAAA,sBAAwB,CAAA,EACtDpE,OAAAA,EAAkBoC,EAEX,CAAE/B,cAAAA,CAAc,CACzB,EAL8B8D,eAAAA,oFC1HjB,MAAAE,GAAepG,EAACkG,GAAc,CACzC,MAAMG,EAAiBH,GAAQC,EAAAA,mBACzB,EAAA,CAAE,cAAA/D,CAAc,EAAI6D,EAAcI,CAAc,EACtD,MAAO,CAAE,cAAAjE,CAAc,CACzB,EAJ4B,cAAA"}
1
+ {"version":3,"file":"index.cdn.js","sources":["../../../packages/utils/install.ts","../../../packages/components/button/src/button.ts","../../../packages/components/button/src/button.vue","../../../packages/components/button/index.ts","../../../packages/installer.ts","../../../packages/utils/myDevelop.ts","../../../packages/utils/index.ts","../../../packages/hooks/usePopWindow/src/index.tsx","../../../packages/hooks/usePopWindow/index.ts","../../../packages/hooks/useDialog/src/index.tsx","../../../packages/hooks/useDialog/index.ts","../../../packages/directives/modules/copy.ts"],"sourcesContent":["import type { App, Directive } from 'vue';\nimport type { SFCWithInstall } from '../types';\n\n// 注册组件\nexport const withInstall = <T>(main: T) => {\n (main as SFCWithInstall<T>).install = (app): void => {\n const comp: Record<string, any> = main as Record<string, any>;\n app.component(comp.name, comp);\n };\n return main as SFCWithInstall<T>;\n};\n\n// 注册指令\nexport const withInstallDirectives = <T extends Directive>(main: T, name: string) => {\n return {\n install: (app: App): void => {\n app.directive(name, main);\n },\n directive: main,\n };\n};\n","import type { ExtractPropTypes, PropType } from 'vue';\nimport type button from './button.vue';\n\nexport type Type = 'primary' | 'success' | 'error';\n\nexport const ButtonProps = {\n type: {\n type: String as PropType<Type>,\n default: 'default',\n },\n};\n\nexport type ButtonPropsType = ExtractPropTypes<typeof ButtonProps>;\nexport type ButtonInstanceType = InstanceType<typeof button>;\n","<script lang=\"ts\" setup>\n import { ButtonProps } from './button';\n\n defineProps(ButtonProps);\n\n defineOptions({\n name: 'IButton',\n });\n</script>\n\n<template>\n <button class=\"mu-button\" :class=\"type\">\n <slot></slot>\n </button>\n</template>\n","import { withInstall } from '../../utils/install';\nimport Button from './src/button.vue';\n\nexport const IButton = withInstall(Button); // 增加类型\n\nexport default IButton;\n","import type { App, Plugin } from 'vue';\n\nimport { IButton } from './components/button';\n\nconst component = [IButton] as Plugin[];\n\nexport const install = function (app: App) {\n component.forEach((i) => app.use(i));\n};\n\nexport default {\n install,\n};\n","// utils 用例\nexport function developFn() {\n console.log('developFn');\n}\n","export * from './install';\nexport * from './myDevelop';\n\n\nexport function formatValue(value: number | string): string {\n if (typeof value === 'number') {\n return `${value}px`;\n } else if (typeof value === 'string') {\n // 检查是否已经带有 px 单位或其他单位\n if (value.endsWith('px') || value.endsWith('%')) {\n return value; // 直接返回已有单位的字符串\n }\n return `${value}px`; // 其他字符串类型的值加上 px\n }\n return '';\n}","import { type AppContext, type Component, type ComponentInternalInstance, getCurrentInstance, nextTick, render } from 'vue'\n\nimport { type PopWindowInfoProps, type PopWindowProps } from './interface'\nimport { ElScrollbar } from 'element-plus'\nimport { formatValue } from '../../../utils'\n\nlet appContextConst: AppContext | undefined\nlet popWindowList: Array<any> = []\nconst getBody = (): Element => {\n return document.querySelector('body') as HTMLBodyElement\n}\n/**\n * 显示弹出窗口\n *\n * 此函数用于创建并显示一个弹出窗口,支持自定义样式和内容通过参数传递\n * 可以选择附加到特定的父元素,并且在渲染后会将自身添加到弹出窗口列表中\n *\n * @param props 弹出窗口的属性,包括位置、尺寸等样式属性以及附加属性\n * @param component 可选参数,用于指定弹出窗口内渲染的自定义组件类型,如果props中传了render函数,则无效\n * @param componentProps 可选参数,传递给自定义组件的属性\n */\nexport const showPopWindow = (props: PopWindowProps, component?: Component, componentProps?: any) => {\n const op = {\n left: 'auto',\n top: 'auto',\n right: 'auto',\n bottom: 'auto',\n // width: 'auto',\n // height: 'auto',\n position: 'absolute',\n id: 'popwindow_' + Math.ceil(Math.random() * 1000000),\n animate: false,\n animateInClass: 'animate__animated animate__faster animate__fadeIn',\n animateOutClass: 'animate__animated animate__faster animate__fadeOut'\n }\n let propsFormat = { ...props }\n if (props.left !== undefined) propsFormat.left = formatValue(propsFormat.left)\n if (props.top !== undefined) propsFormat.top = formatValue(propsFormat.top)\n if (props.width !== undefined) propsFormat.width = formatValue(propsFormat.width)\n if (props.height !== undefined) propsFormat.height = formatValue(propsFormat.height)\n\n const option: PopWindowProps = Object.assign(op, propsFormat)\n const close = () => {\n closePopWindowById(option.id)\n }\n\n // 相同的id只会存在一个\n closePopWindowById(option.id)\n let animateClass = option.animate ? option.animateInClass : ''\n\n const vm = (\n <div\n class={'popWindow ' + animateClass}\n style={{\n width: option.width,\n height: option.height,\n left: option.left,\n right: option.right,\n top: option.top,\n bottom: option.bottom,\n position: option.position\n }}>\n <ElScrollbar>\n {props.render ? props.render({ close, option }) : <component is={component} {...componentProps} onClose={() => close()}></component>}\n </ElScrollbar>\n </div>\n )\n vm.appContext = appContextConst\n // 这里是为了让插槽的子组件能获取到appContext\n if (vm.children?.length) {\n vm.children[0].appContext = appContextConst\n }\n const container = document.createElement('div')\n container.id = 'popwindow_' + Math.ceil(Math.random() * 1000000)\n container.style.pointerEvents = 'auto'\n\n let parentEl = getBody()\n if (props.appendParent) {\n parentEl = document.getElementById(props.appendParent)\n }\n parentEl.appendChild(container)\n render(vm, container)\n\n nextTick(() => {\n const popWindowInfo = { id: option.id, tag: option.tag, node: container, option }\n popWindowList.push(popWindowInfo)\n })\n return { id: option.id, close }\n}\nconst removePopWindow = (popWindowInfo: PopWindowInfoProps) => {\n if (!popWindowInfo) return\n const { option, node } = popWindowInfo\n option.onClose?.()\n if (option.animate) {\n const popWindowNode = node.querySelector('.popWindow')\n popWindowNode.className = 'popWindow ' + option.animateOutClass\n popWindowNode.addEventListener('animationend', () => {\n render(null, node)\n node.remove()\n popWindowList.splice(popWindowList.indexOf(popWindowInfo), 1)\n })\n } else {\n render(null, node)\n node.remove()\n popWindowList.splice(popWindowList.indexOf(popWindowInfo), 1)\n }\n}\n\n/**\n * 根据ID关闭弹出窗口\n *\n * @param id 弹出窗口的唯一标识符\n */\nexport const closePopWindowById = (id: string) => {\n const popWindowItem = popWindowList.find((item) => item.id === id)\n if (popWindowItem) {\n removePopWindow(popWindowItem)\n }\n}\n\n/**\n * 根据tag关闭弹出窗口\n *\n * @param tag 弹出窗口的tag\n */\nexport const closePopWindowByTag = (tag: string) => {\n const popWindows = popWindowList.filter((item) => item.tag === tag)\n popWindows.forEach((item) => removePopWindow(item))\n}\n\n/**\n * 获取所有弹窗信息\n *\n * @returns {PopWindowInfoProps[]} 所有弹窗的列表\n */\nexport const getAllPopWindows = (): PopWindowInfoProps[] => {\n return popWindowList\n}\n\nexport const initPopWindow = (ctx?: ComponentInternalInstance) => {\n const { appContext } = ctx || getCurrentInstance() || {}\n appContextConst = appContext\n\n return { showPopWindow }\n}\n","import { type ComponentInternalInstance, getCurrentInstance } from 'vue'\n\nimport { closePopWindowById, closePopWindowByTag, initPopWindow, showPopWindow, getAllPopWindows } from './src/index'\nimport { type PopWindowInfoProps, type PopWindowProps } from './src/interface'\n\nexport { showPopWindow, closePopWindowById, closePopWindowByTag, getAllPopWindows }\nexport type { PopWindowInfoProps, PopWindowProps }\nexport const usePopWindow = (ctx?: any) => {\n const thisAppContext = ctx || (getCurrentInstance() as ComponentInternalInstance)\n const { showPopWindow } = initPopWindow(thisAppContext)\n return { showPopWindow }\n}\n","import { type AppContext, type Component, type ComponentInternalInstance, getCurrentInstance, ref, render, unref, type VNode } from 'vue'\n\nimport { type DialogProps, ElButton, ElConfigProvider, ElDialog, ElScrollbar } from 'element-plus'\n\nconst prefixClass = 'work-dialog'\n\nlet id = 0\n\nlet appContextConst: AppContext | undefined\n\nconst getFather = (): Element => {\n return document.querySelector('body') as HTMLBodyElement\n}\n\nexport interface ZnDialogProps extends Partial<DialogProps> {\n render?: () => VNode // 内容渲染 TSX\n headerRender?: (scope: any) => VNode // 头部渲染 TSX\n footerRender?: () => VNode // 底部渲染 TSX\n showFooter?: boolean // 是否渲染底部,默认 true\n onConfirm?: (closeDialog: () => void) => void // 确认按钮点击事件\n onClose?: (closeDialog: () => void) => void // 关闭按钮点击事件\n height?: string // 内容高度,默认 400px\n}\n\nconst isShow = ref(true)\n\n/**\n * @description 关闭弹框\n */\nexport const closeDialog = () => {\n isShow.value = false\n setTimeout(() => {\n const vm = document.querySelector(`#${prefixClass}-${id--}`) as HTMLElement\n if (vm) {\n render(null, vm)\n getFather().removeChild(vm)\n }\n isShow.value = true\n }, 500)\n}\n\nconst handleClose = (dialogProps?: ZnDialogProps) => {\n if (dialogProps?.onClose) dialogProps?.onClose(closeDialog)\n return closeDialog()\n}\n\nconst handleConfirm = (dialogProps?: ZnDialogProps) => {\n if (dialogProps?.onConfirm) dialogProps?.onConfirm(closeDialog)\n return closeDialog()\n}\n/**\n * 内容渲染方式有两种\n * 方式 1:在第一个参数里写 render,即可实现 el-dialog 的内容渲染\n * 方式 2:第二个参数为组件,第三个参数为组件的 props\n *\n * 在第一个参数里写 headerRender 和 footerRender,可以自定义 el-dialog 的 header 和 footer\n */\nexport const showDialog = (dialogProps: ZnDialogProps, component?: Component, componentsProps?: any) => {\n const layoutSize = ref('default')\n\n const contentHeight = ref(dialogProps.height)\n\n const vm = (\n <ElConfigProvider namespace=\"el\" size={unref(layoutSize)}>\n <ElDialog\n modelValue={isShow.value}\n title=\"弹框\"\n width=\"50%\"\n before-close={() => handleClose(dialogProps)}\n close-on-click-modal={true}\n {...dialogProps}\n render\n headerRender\n footerRender\n class={prefixClass}>\n {{\n default: () => {\n if (dialogProps.render) {\n return (\n <ElScrollbar\n style={{\n height: unref(contentHeight)\n }}>\n {dialogProps.render()}\n </ElScrollbar>\n )\n }\n return (\n <ElScrollbar style={{ height: unref(contentHeight) }}>\n <component is={component} {...componentsProps} onCloseDialog={() => closeDialog()}></component>\n </ElScrollbar>\n )\n },\n header: (scope: any) => {\n if (dialogProps?.headerRender) return dialogProps.headerRender(scope)\n return (\n <div style=\"display: flex\">\n <span class={`el-dialog__title`} style=\"flex: 1\">\n {dialogProps.title}\n </span>\n </div>\n )\n },\n footer: () => {\n if (dialogProps.footerRender) return dialogProps.footerRender()\n if (dialogProps.showFooter === false) return\n return (\n <>\n <ElButton onClick={() => handleClose(dialogProps)}>取 消</ElButton>\n <ElButton type=\"primary\" onClick={() => handleConfirm(dialogProps)}>\n 确 定\n </ElButton>\n </>\n )\n }\n }}\n </ElDialog>\n </ElConfigProvider>\n )\n\n vm.appContext = appContextConst\n vm.children?.length && (vm.children[0].appContext = appContextConst)\n\n const container = document.createElement('div')\n container.id = `${prefixClass}-${++id}`\n getFather().appendChild(container)\n render(vm, container)\n}\n\nexport const initDialog = (ctx?: ComponentInternalInstance) => {\n const { appContext } = ctx || getCurrentInstance() || {}\n appContextConst = appContext\n\n return { showDialog }\n}\n","import { type ComponentInternalInstance, getCurrentInstance } from 'vue'\n\nimport { closeDialog, initDialog, type ZnDialogProps } from './src/index'\n\nexport { type ZnDialogProps }\n\nexport const useDialog = (ctx?: any) => {\n const thisAppContext = ctx || (getCurrentInstance() as ComponentInternalInstance)\n const { showDialog } = initDialog(thisAppContext)\n\n return { open: showDialog, close: closeDialog }\n}\n","/**\r\n * v-copy\r\n * 复制某个值至剪贴板\r\n * 接收参数:string类型/Ref<string>类型/Reactive<string>类型\r\n */\r\n\r\nimport { ElMessage } from 'element-plus'\r\nimport type { Directive, DirectiveBinding } from 'vue'\r\ninterface ElType extends HTMLElement {\r\n copyData: string | number;\r\n}\r\nconst copy: Directive = {\r\n mounted(el: ElType, binding: DirectiveBinding) {\r\n el.copyData = binding.value\r\n el.addEventListener('click', handleClick)\r\n },\r\n updated(el: ElType, binding: DirectiveBinding) {\r\n el.copyData = binding.value\r\n },\r\n beforeUnmount(el: ElType) {\r\n el.removeEventListener('click', handleClick)\r\n }\r\n}\r\n\r\nasync function handleClick(this: any) {\r\n try {\r\n await navigator.clipboard.writeText(this.copyData)\r\n ElMessage({\r\n type: 'success',\r\n message: '复制成功'\r\n })\r\n } catch (err) {\r\n console.error('复制操作不被支持或失败: ', err)\r\n }\r\n}\r\n\r\nexport default copy\r\n"],"names":["s","r","__name","t","e","withInstall","main","app","comp","withInstallDirectives","name","ButtonProps","_sfc_render","_ctx","_cache","$props","type","$data","$options","_normalizeClass","IButton","Button","component","install","i","r$2","l","o","n","developFn","formatValue","value","appContextConst","popWindowList","getBody","document","querySelector","showPopWindow","props","componentProps","op","left","top","right","bottom","position","id","Math","ceil","random","animate","animateInClass","animateOutClass","propsFormat","undefined","width","height","option","Object","assign","close","closePopWindowById","animateClass","vm","_createVNode","ElScrollbar","default","render","_mergeProps","onClose","appContext","children","length","container","createElement","style","pointerEvents","parentEl","appendParent","getElementById","appendChild","nextTick","popWindowInfo","tag","node","push","removePopWindow","popWindowNode","className","addEventListener","remove","splice","indexOf","popWindowItem","find","item","closePopWindowByTag","filter","forEach","getAllPopWindows","initPopWindow","ctx","getCurrentInstance","usePopWindow","thisAppContext","_isSlot","prototype","toString","call","_isVNode","prefixClass","getFather","isShow","ref","closeDialog","setTimeout","removeChild","handleClose","dialogProps","handleConfirm","onConfirm","showDialog","componentsProps","layoutSize","contentHeight","ElConfigProvider","unref","ElDialog","before-close","_slot","onCloseDialog","header","scope","headerRender","title","footer","footerRender","showFooter","_Fragment","ElButton","onClick","_createTextVNode","initDialog","p","useDialog","copy","el","binding","handleClick","ElMessage","err"],"mappings":"iaAIO,IAAAA,EAAA,OAAA,eAAAC,EAAAC,EAAA,CAAAC,EAAAC,IAAAJ,EAAAG,EAAA,OAAA,CAAA,MAAAC,EAAA,aAAA,EAAA,CAAA,EAAA,OAAA,MAAM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,MACtBD,EAAG,iBAAiB,QAASE,CAAW,CAC1C,EACA,QAAQF,EAAYC,EAA2B,CAC7CD,EAAG,SAAWC,EAAQ,KACxB,EACA,cAAcD,EAAY,CACxBA,EAAG,oBAAoB,QAASE,CAAW,CAC7C,CACF,EAEA,eAAeA,GAAuB,CACpC,GAAI,CACF,MAAM,UAAU,UAAU,UAAU,KAAK,QAAQ,EACjDC,EAAAA,UAAU,CACR,KAAM,UACN,QAAS,0BACX,CAAC,CACH,OAASC,EAAK,CACZ,QAAQ,MAAM,uEAAiBA,CAAG,CACpC,CACF,CAVeF,EAAAA,EAAAA,KAAAlJ,GAAAkJ,EAAA"}
package/cdn/index.cdn.mjs CHANGED
@@ -1,2 +1,2 @@
1
- var E=Object.defineProperty;var a=(e,t)=>E(e,"name",{value:t,configurable:!0});import{defineComponent as S,openBlock as k,createElementBlock as D,normalizeClass as M,renderSlot as F,ref as T,createVNode as v,mergeProps as V,render as m,nextTick as q,getCurrentInstance as b}from"vue";import{ElScrollbar as A}from"element-plus";var N=Object.defineProperty,h=a((e,t)=>N(e,"name",{value:t,configurable:!0}),"r$4");const y=h(e=>(e.install=t=>{const n=e;t.component(n.name,n)},e),"withInstall"),z=h((e,t)=>({install:h(n=>{n.directive(t,e)},"install"),directive:e}),"withInstallDirectives"),L={type:{type:String,default:"default"}};var G=S({name:"IButton",__name:"button",props:L,setup(e,{expose:t}){t();const n={};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}}),H=a((e,t)=>{const n=e.__vccOpts||e;for(const[i,d]of t)n[i]=d;return n},"c"),J=Object.defineProperty,K=a((e,t)=>J(e,"name",{value:t,configurable:!0}),"t$1");function _(e,t,n,i,d,r){return k(),D("button",{class:M(["mu-button",e.type])},[F(e.$slots,"default")],2)}a(_,"p$2"),K(_,"_sfc_render");var Q=H(G,[["render",_],["__file","button.vue"]]);const W=y(Q);var R=Object.defineProperty,U=a((e,t)=>R(e,"name",{value:t,configurable:!0}),"n");const X=[W],O=U(function(e){X.forEach(t=>e.use(t))},"install");var Y={install:O},Z=Object.defineProperty,ee=a((e,t)=>Z(e,"name",{value:t,configurable:!0}),"r");function C(){return{num:T(0)}}a(C,"useDeveloper"),ee(C,"useDeveloper");var te=Object.defineProperty,ne=a((e,t)=>te(e,"name",{value:t,configurable:!0}),"o");function $(){console.log("developFn")}a($,"developFn"),ne($,"developFn");var oe=Object.defineProperty,ae=a((e,t)=>oe(e,"name",{value:t,configurable:!0}),"t");function p(e){return typeof e=="number"?`${e}px`:typeof e=="string"?e.endsWith("px")||e.endsWith("%")?e:`${e}px`:""}a(p,"formatValue"),ae(p,"formatValue");var ie=Object.defineProperty,l=a((e,t)=>ie(e,"name",{value:t,configurable:!0}),"a");let w,s=[];const re=l(()=>document.querySelector("body"),"getBody"),I=l((e,t,n)=>{var i;const d={left:"0",top:"0",position:"absolute",id:"popwindow_"+Math.ceil(Math.random()*1e6),animate:!1,animateInClass:"animate__animated animate__faster animate__fadeIn",animateOutClass:"animate__animated animate__faster animate__fadeOut"};let r={...e};e.left!==void 0&&(r.left=p(r.left)),e.top!==void 0&&(r.top=p(r.top)),e.width!==void 0&&(r.width=p(r.width)),e.height!==void 0&&(r.height=p(r.height));const o=Object.assign(d,r),f=l(()=>{g(o.id)},"close");g(o.id);let B=o.animate?o.animateInClass:"";const u=v("div",{class:"popWindow "+B,style:{width:o.width,height:o.height,left:o.left,top:o.top,position:o.position}},[v(A,null,{default:l(()=>[e.render?e.render({close:f,option:o}):v(t,V({is:t},n,{onClose:l(()=>f(),"onClose")}),null)],"default")})]);u.appContext=w,(i=u.children)!=null&&i.length&&(u.children[0].appContext=w);const c=document.createElement("div");c.id="popwindow_"+Math.ceil(Math.random()*1e6),c.style.pointerEvents="auto";let P=re();return e.appendParent&&(P=document.getElementById(e.appendParent)),P.appendChild(c),m(u,c),q(()=>{const j={id:o.id,tag:o.tag,node:c,option:o};s.push(j)}),{id:o.id,close:f}},"showPopWindow"),x=l(e=>{var t;if(!e)return;const{option:n,node:i}=e;if((t=n.onClose)==null||t.call(n),n.animate){const d=i.querySelector(".popWindow");d.className="popWindow "+n.animateOutClass,d.addEventListener("animationend",()=>{m(null,i),i.remove(),s.splice(s.indexOf(e),1)})}else m(null,i),i.remove(),s.splice(s.indexOf(e),1)},"removePopWindow"),g=l(e=>{const t=s.find(n=>n.id===e);t&&x(t)},"closePopWindowById"),le=l(e=>{s.filter(t=>t.tag===e).forEach(t=>x(t))},"closePopWindowByTag"),se=l(()=>s,"getAllPopWindows"),de=l(e=>{const{appContext:t}=e||b()||{};return w=t,{showPopWindow:I}},"initPopWindow");var pe=Object.defineProperty,ce=a((e,t)=>pe(e,"name",{value:t,configurable:!0}),"p");const ue=ce(e=>{const t=e||b(),{showPopWindow:n}=de(t);return{showPopWindow:n}},"usePopWindow");export{W as IButton,g as closePopWindowById,le as closePopWindowByTag,Y as default,$ as developFn,p as formatValue,se as getAllPopWindows,O as install,I as showPopWindow,C as useDeveloper,ue as usePopWindow,y as withInstall,z as withInstallDirectives};
1
+ var G=Object.defineProperty;var l=(e,t)=>G(e,"name",{value:t,configurable:!0});import{defineComponent as H,openBlock as J,createElementBlock as K,normalizeClass as Q,renderSlot as X,createVNode as s,mergeProps as w,render as g,nextTick as Y,getCurrentInstance as b,isVNode as Z,ref as C,unref as P,Fragment as ee,createTextVNode as k}from"vue";import{ElScrollbar as _,ElConfigProvider as te,ElDialog as oe,ElButton as I,ElMessage as ne}from"element-plus";var ae=Object.defineProperty,D=l((e,t)=>ae(e,"name",{value:t,configurable:!0}),"r$4");const S=D(e=>(e.install=t=>{const o=e;t.component(o.name,o)},e),"withInstall"),le=D((e,t)=>({install:D(o=>{o.directive(t,e)},"install"),directive:e}),"withInstallDirectives"),ie={type:{type:String,default:"default"}};var re=H({name:"IButton",__name:"button",props:ie,setup(e,{expose:t}){t();const o={};return Object.defineProperty(o,"__isScriptSetup",{enumerable:!1,value:!0}),o}}),se=l((e,t)=>{const o=e.__vccOpts||e;for(const[i,u]of t)o[i]=u;return o},"c$1"),de=Object.defineProperty,ue=l((e,t)=>de(e,"name",{value:t,configurable:!0}),"t$3");function F(e,t,o,i,u,r){return J(),K("button",{class:Q(["mu-button",e.type])},[X(e.$slots,"default")],2)}l(F,"p$3"),ue(F,"_sfc_render");var ce=se(re,[["render",F],["__file","button.vue"]]);const R=S(ce);var pe=Object.defineProperty,fe=l((e,t)=>pe(e,"name",{value:t,configurable:!0}),"n$1");const me=[R],T=fe(function(e){me.forEach(t=>e.use(t))},"install");var ve={install:T},he=Object.defineProperty,ge=l((e,t)=>he(e,"name",{value:t,configurable:!0}),"o");function V(){console.log("developFn")}l(V,"developFn"),ge(V,"developFn");var ye=Object.defineProperty,be=l((e,t)=>ye(e,"name",{value:t,configurable:!0}),"t$2");function m(e){return typeof e=="number"?`${e}px`:typeof e=="string"?e.endsWith("px")||e.endsWith("%")?e:`${e}px`:""}l(m,"formatValue"),be(m,"formatValue");var we=Object.defineProperty,d=l((e,t)=>we(e,"name",{value:t,configurable:!0}),"a$1");let $,c=[];const Ce=d(()=>document.querySelector("body"),"getBody"),M=d((e,t,o)=>{var i;const u={left:"auto",top:"auto",right:"auto",bottom:"auto",position:"absolute",id:"popwindow_"+Math.ceil(Math.random()*1e6),animate:!1,animateInClass:"animate__animated animate__faster animate__fadeIn",animateOutClass:"animate__animated animate__faster animate__fadeOut"};let r={...e};e.left!==void 0&&(r.left=m(r.left)),e.top!==void 0&&(r.top=m(r.top)),e.width!==void 0&&(r.width=m(r.width)),e.height!==void 0&&(r.height=m(r.height));const n=Object.assign(u,r),p=d(()=>{O(n.id)},"close");O(n.id);let f=n.animate?n.animateInClass:"";const y=s("div",{class:"popWindow "+f,style:{width:n.width,height:n.height,left:n.left,right:n.right,top:n.top,bottom:n.bottom,position:n.position}},[s(_,null,{default:d(()=>[e.render?e.render({close:p,option:n}):s(t,w({is:t},o,{onClose:d(()=>p(),"onClose")}),null)],"default")})]);y.appContext=$,(i=y.children)!=null&&i.length&&(y.children[0].appContext=$);const h=document.createElement("div");h.id="popwindow_"+Math.ceil(Math.random()*1e6),h.style.pointerEvents="auto";let B=Ce();return e.appendParent&&(B=document.getElementById(e.appendParent)),B.appendChild(h),g(y,h),Y(()=>{const U={id:n.id,tag:n.tag,node:h,option:n};c.push(U)}),{id:n.id,close:p}},"showPopWindow"),q=d(e=>{var t;if(!e)return;const{option:o,node:i}=e;if((t=o.onClose)==null||t.call(o),o.animate){const u=i.querySelector(".popWindow");u.className="popWindow "+o.animateOutClass,u.addEventListener("animationend",()=>{g(null,i),i.remove(),c.splice(c.indexOf(e),1)})}else g(null,i),i.remove(),c.splice(c.indexOf(e),1)},"removePopWindow"),O=d(e=>{const t=c.find(o=>o.id===e);t&&q(t)},"closePopWindowById"),Pe=d(e=>{c.filter(t=>t.tag===e).forEach(t=>q(t))},"closePopWindowByTag"),_e=d(()=>c,"getAllPopWindows"),De=d(e=>{const{appContext:t}=e||b()||{};return $=t,{showPopWindow:M}},"initPopWindow");var $e=Object.defineProperty,Oe=l((e,t)=>$e(e,"name",{value:t,configurable:!0}),"p$1");const We=Oe(e=>{const t=e||b(),{showPopWindow:o}=De(t);return{showPopWindow:o}},"usePopWindow");var xe=Object.defineProperty,a=l((e,t)=>xe(e,"name",{value:t,configurable:!0}),"t$1");function A(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!Z(e)}l(A,"$"),a(A,"_isSlot");const W="work-dialog";let N=0,x;const L=a(()=>document.querySelector("body"),"getFather"),E=C(!0),v=a(()=>{E.value=!1,setTimeout(()=>{const e=document.querySelector(`#${W}-${N--}`);e&&(g(null,e),L().removeChild(e)),E.value=!0},500)},"closeDialog"),z=a(e=>(e!=null&&e.onClose&&(e==null||e.onClose(v)),v()),"handleClose"),Ee=a(e=>(e!=null&&e.onConfirm&&(e==null||e.onConfirm(v)),v()),"handleConfirm"),je=a((e,t,o)=>{var i;const u=C("default"),r=C(e.height),n=s(te,{namespace:"el",size:P(u)},{default:a(()=>[s(oe,w({modelValue:E.value,title:"\u5F39\u6846",width:"50%","before-close":a(()=>z(e),"before-close"),"close-on-click-modal":!0},e,{render:!0,headerRender:!0,footerRender:!0,class:W}),{default:a(()=>{if(e.render){let f;return s(_,{style:{height:P(r)}},A(f=e.render())?f:{default:a(()=>[f],"default")})}return s(_,{style:{height:P(r)}},{default:a(()=>[s(t,w({is:t},o,{onCloseDialog:a(()=>v(),"onCloseDialog")}),null)],"default")})},"default"),header:a(f=>e!=null&&e.headerRender?e.headerRender(f):s("div",{style:"display: flex"},[s("span",{class:"el-dialog__title",style:"flex: 1"},[e.title])]),"header"),footer:a(()=>{if(e.footerRender)return e.footerRender();if(e.showFooter!==!1)return s(ee,null,[s(I,{onClick:a(()=>z(e),"onClick")},{default:a(()=>[k("\u53D6 \u6D88")],"default")}),s(I,{type:"primary",onClick:a(()=>Ee(e),"onClick")},{default:a(()=>[k("\u786E \u5B9A")],"default")})])},"footer")})],"default")});n.appContext=x,(i=n.children)!=null&&i.length&&(n.children[0].appContext=x);const p=document.createElement("div");p.id=`${W}-${++N}`,L().appendChild(p),g(n,p)},"showDialog"),Be=a(e=>{const{appContext:t}=e||b()||{};return x=t,{showDialog:je}},"initDialog");var ke=Object.defineProperty,Ie=l((e,t)=>ke(e,"name",{value:t,configurable:!0}),"t");const Se=Ie(e=>{const t=e||b(),{showDialog:o}=Be(t);return{open:o,close:v}},"useDialog");var Fe=Object.defineProperty,Re=l((e,t)=>Fe(e,"name",{value:t,configurable:!0}),"i");const Te={mounted(e,t){e.copyData=t.value,e.addEventListener("click",j)},updated(e,t){e.copyData=t.value},beforeUnmount(e){e.removeEventListener("click",j)}};async function j(){try{await navigator.clipboard.writeText(this.copyData),ne({type:"success",message:"\u590D\u5236\u6210\u529F"})}catch(e){console.error("\u590D\u5236\u64CD\u4F5C\u4E0D\u88AB\u652F\u6301\u6216\u5931\u8D25: ",e)}}l(j,"n"),Re(j,"handleClick");export{R as IButton,O as closePopWindowById,Pe as closePopWindowByTag,ve as default,V as developFn,m as formatValue,_e as getAllPopWindows,T as install,M as showPopWindow,Se as useDialog,We as usePopWindow,Te as vCopy,S as withInstall,le as withInstallDirectives};
2
2
  //# sourceMappingURL=index.cdn.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cdn.mjs","sources":["../../../packages/utils/install.ts","../../../packages/components/button/src/button.ts","../../../packages/components/button/src/button.vue","../../../packages/components/button/index.ts","../../../packages/installer.ts","../../../packages/hooks/useDeveloper/index.ts","../../../packages/utils/myDevelop.ts","../../../packages/utils/index.ts","../../../packages/hooks/usePopWindow/src/index.tsx","../../../packages/hooks/usePopWindow/index.ts"],"sourcesContent":["import type { App, Directive } from 'vue';\nimport type { SFCWithInstall } from '../types';\n\n// 注册组件\nexport const withInstall = <T>(main: T) => {\n (main as SFCWithInstall<T>).install = (app): void => {\n const comp: Record<string, any> = main as Record<string, any>;\n app.component(comp.name, comp);\n };\n return main as SFCWithInstall<T>;\n};\n\n// 注册指令\nexport const withInstallDirectives = <T extends Directive>(main: T, name: string) => {\n return {\n install: (app: App): void => {\n app.directive(name, main);\n },\n directive: main,\n };\n};\n","import type { ExtractPropTypes, PropType } from 'vue';\nimport type button from './button.vue';\n\nexport type Type = 'primary' | 'success' | 'error';\n\nexport const ButtonProps = {\n type: {\n type: String as PropType<Type>,\n default: 'default',\n },\n};\n\nexport type ButtonPropsType = ExtractPropTypes<typeof ButtonProps>;\nexport type ButtonInstanceType = InstanceType<typeof button>;\n","<script lang=\"ts\" setup>\n import { ButtonProps } from './button';\n\n defineProps(ButtonProps);\n\n defineOptions({\n name: 'IButton',\n });\n</script>\n\n<template>\n <button class=\"mu-button\" :class=\"type\">\n <slot></slot>\n </button>\n</template>\n","import { withInstall } from '../../utils/install';\nimport Button from './src/button.vue';\n\nexport const IButton = withInstall(Button); // 增加类型\n\nexport default IButton;\n","import type { App, Plugin } from 'vue';\n\nimport { IButton } from './components/button';\n\nconst component = [IButton] as Plugin[];\n\nexport const install = function (app: App) {\n component.forEach((i) => app.use(i));\n};\n\nexport default {\n install,\n};\n","import { ref } from 'vue';\n\nexport function useDeveloper() {\n const num = ref<number>(0);\n return { num };\n}\n","// utils 用例\nexport function developFn() {\n console.log('developFn');\n}\n","export * from './install';\nexport * from './myDevelop';\n\n\nexport function formatValue(value: number | string): string {\n if (typeof value === 'number') {\n return `${value}px`;\n } else if (typeof value === 'string') {\n // 检查是否已经带有 px 单位或其他单位\n if (value.endsWith('px') || value.endsWith('%')) {\n return value; // 直接返回已有单位的字符串\n }\n return `${value}px`; // 其他字符串类型的值加上 px\n }\n return '';\n}","import { type AppContext, type Component, type ComponentInternalInstance, getCurrentInstance, nextTick, render } from 'vue'\n\nimport { type PopWindowInfoProps, type PopWindowProps } from './interface'\nimport { ElScrollbar } from 'element-plus'\nimport { formatValue } from '../../../utils'\n\nlet appContextConst: AppContext | undefined\nlet popWindowList: Array<any> = []\nconst getBody = (): Element => {\n return document.querySelector('body') as HTMLBodyElement\n}\n/**\n * 显示弹出窗口\n *\n * 此函数用于创建并显示一个弹出窗口,支持自定义样式和内容通过参数传递\n * 可以选择附加到特定的父元素,并且在渲染后会将自身添加到弹出窗口列表中\n *\n * @param props 弹出窗口的属性,包括位置、尺寸等样式属性以及附加属性\n * @param component 可选参数,用于指定弹出窗口内渲染的自定义组件类型,如果props中传了render函数,则无效\n * @param componentProps 可选参数,传递给自定义组件的属性\n */\nexport const showPopWindow = (props: PopWindowProps, component?: Component, componentProps?: any) => {\n const op = {\n left: '0',\n top: '0',\n // width: 'auto',\n // height: 'auto',\n position: 'absolute',\n id: 'popwindow_' + Math.ceil(Math.random() * 1000000),\n animate: false,\n animateInClass: 'animate__animated animate__faster animate__fadeIn',\n animateOutClass: 'animate__animated animate__faster animate__fadeOut'\n }\n let propsFormat = { ...props }\n if (props.left !== undefined) propsFormat.left = formatValue(propsFormat.left)\n if (props.top !== undefined) propsFormat.top = formatValue(propsFormat.top)\n if (props.width !== undefined) propsFormat.width = formatValue(propsFormat.width)\n if (props.height !== undefined) propsFormat.height = formatValue(propsFormat.height)\n\n const option: PopWindowProps = Object.assign(op, propsFormat)\n const close = () => {\n closePopWindowById(option.id)\n }\n\n // 相同的id只会存在一个\n closePopWindowById(option.id)\n let animateClass = option.animate ? option.animateInClass : ''\n\n const vm = (\n <div\n class={'popWindow ' + animateClass}\n style={{ width: option.width, height: option.height, left: option.left, top: option.top, position: option.position }}>\n <ElScrollbar>\n {props.render ? props.render({ close, option }) : <component is={component} {...componentProps} onClose={() => close()}></component>}\n </ElScrollbar>\n </div>\n )\n vm.appContext = appContextConst\n // 这里是为了让插槽的子组件能获取到appContext\n if (vm.children?.length) {\n vm.children[0].appContext = appContextConst\n }\n const container = document.createElement('div')\n container.id = 'popwindow_' + Math.ceil(Math.random() * 1000000)\n container.style.pointerEvents='auto'\n\n let parentEl = getBody()\n if (props.appendParent) {\n parentEl = document.getElementById(props.appendParent)\n }\n parentEl.appendChild(container)\n render(vm, container)\n\n nextTick(() => {\n const popWindowInfo = { id: option.id, tag: option.tag, node: container, option }\n popWindowList.push(popWindowInfo)\n })\n return { id: option.id, close }\n}\nconst removePopWindow = (popWindowInfo: PopWindowInfoProps) => {\n if (!popWindowInfo) return\n const { option, node } = popWindowInfo\n option.onClose?.()\n if (option.animate) {\n const popWindowNode = node.querySelector('.popWindow')\n popWindowNode.className = 'popWindow ' + option.animateOutClass\n popWindowNode.addEventListener('animationend', () => {\n render(null, node)\n node.remove()\n popWindowList.splice(popWindowList.indexOf(popWindowInfo), 1)\n })\n } else {\n render(null, node)\n node.remove()\n popWindowList.splice(popWindowList.indexOf(popWindowInfo), 1)\n }\n}\n\n/**\n * 根据ID关闭弹出窗口\n *\n * @param id 弹出窗口的唯一标识符\n */\nexport const closePopWindowById = (id: string) => {\n const popWindowItem = popWindowList.find((item) => item.id === id)\n if (popWindowItem) {\n removePopWindow(popWindowItem)\n }\n}\n\n/**\n * 根据tag关闭弹出窗口\n *\n * @param tag 弹出窗口的tag\n */\nexport const closePopWindowByTag = (tag: string) => {\n const popWindows = popWindowList.filter((item) => item.tag === tag)\n popWindows.forEach((item) => removePopWindow(item))\n}\n\n/**\n * 获取所有弹窗信息\n *\n * @returns {PopWindowInfoProps[]} 所有弹窗的列表\n */\nexport const getAllPopWindows = (): PopWindowInfoProps[] => {\n return popWindowList\n}\n\nexport const initPopWindow = (ctx?: ComponentInternalInstance) => {\n const { appContext } = ctx || getCurrentInstance() || {}\n appContextConst = appContext\n\n return { showPopWindow }\n}\n","import { type ComponentInternalInstance, getCurrentInstance } from 'vue'\n\nimport { closePopWindowById, closePopWindowByTag, initPopWindow, showPopWindow, getAllPopWindows } from './src/index'\nimport { type PopWindowInfoProps, type PopWindowProps } from './src/interface'\n\nexport { showPopWindow, closePopWindowById, closePopWindowByTag, getAllPopWindows }\nexport type { PopWindowInfoProps, PopWindowProps }\nexport const usePopWindow = (ctx?: any) => {\n const thisAppContext = ctx || (getCurrentInstance() as ComponentInternalInstance)\n const { showPopWindow } = initPopWindow(thisAppContext)\n return { showPopWindow }\n}\n"],"names":["s","r","__name","t","e","withInstall","main","app","comp","withInstallDirectives","name","ButtonProps","_sfc_render","_ctx","_cache","$props","type","$data","$options","_normalizeClass","IButton","Button","component","install","i","r$2","o","n","useDeveloper","ref","l","developFn","formatValue","value","appContextConst","popWindowList","getBody","document","querySelector","showPopWindow","props","componentProps","op","left","top","position","id","Math","ceil","random","animate","animateInClass","animateOutClass","propsFormat","undefined","width","height","option","Object","assign","close","closePopWindowById","animateClass","vm","_createVNode","ElScrollbar","default","render","_mergeProps","onClose","appContext","children","length","container","createElement","style","pointerEvents","parentEl","appendParent","getElementById","appendChild","nextTick","popWindowInfo","tag","node","push","removePopWindow","popWindowNode","className","addEventListener","remove","splice","indexOf","popWindowItem","find","item","closePopWindowByTag","filter","forEach","getAllPopWindows","initPopWindow","ctx","getCurrentInstance","usePopWindow","thisAppContext"],"mappings":"uUAIO,IAAAA,EAAA,OAAA,eAAAC,EAAAC,EAAA,CAAAC,EAAAC,IAAAJ,EAAAG,EAAA,O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,EAAIF,EAEzB,IADAzB,EAAAA,EAAOY,UAAPZ,MAAAA,EAAAA,KAAAA,CAAAA,EACIA,EAAOP,QAAS,CAClB,MAAMqC,EAAgBH,EAAK9C,cAAc,YAAY,EACrDiD,EAAcC,UAAY,aAAe/B,EAAOL,gBAChDmC,EAAcE,iBAAiB,eAAgB,IAAM,CACnDtB,EAAO,KAAMiB,CAAI,EACjBA,EAAKM,OAAO,EACZvD,EAAcwD,OAAOxD,EAAcyD,QAAQV,CAAa,EAAG,CAAC,CAC9D,CAAC,CACH,MACEf,EAAO,KAAMiB,CAAI,EACjBA,EAAKM,SACLvD,EAAcwD,OAAOxD,EAAcyD,QAAQV,CAAa,EAAG,CAAC,CAEhE,EAjByBA,iBAAAA,EAwBZrB,EAAsBf,EAAAA,GAAe,CAChD,MAAM+C,EAAgB1D,EAAc2D,KAAMC,GAASA,EAAKjD,KAAOA,CAAE,EAC7D+C,GACFP,EAAgBO,CAAa,CAEjC,EALmC/C,oBAYtBkD,EAAAA,GAAuBb,EAAAA,GAAgB,CAC/BhD,EAAc8D,OAAQF,GAASA,EAAKZ,MAAQA,CAAG,EACvDe,QAASH,GAAST,EAAgBS,CAAI,CAAC,CACpD,EAHoCZ,qBAUvBgB,EAAAA,GAAmBA,EAAAA,IACvBhE,EADuBgE,kBAAAA,EAInBC,GAAiBC,EAAAA,GAAoC,CAChE,KAAM,CAAE/B,WAAAA,CAAW,EAAI+B,GAAOC,KAAwB,CAAA,EACtDpE,OAAAA,EAAkBoC,EAEX,CAAE/B,cAAAA,CAAc,CACzB,EAL8B8D,eAAAA,uFC1HjB,MAAAE,GAAerG,GAACmG,GAAc,CACzC,MAAMG,EAAiBH,GAAQC,EACzB,EAAA,CAAE,cAAA/D,CAAc,EAAI6D,GAAcI,CAAc,EACtD,MAAO,CAAE,cAAAjE,CAAc,CACzB,EAJ4B,cAAA"}
1
+ {"version":3,"file":"index.cdn.mjs","sources":["../../../packages/utils/install.ts","../../../packages/components/button/src/button.ts","../../../packages/components/button/src/button.vue","../../../packages/components/button/index.ts","../../../packages/installer.ts","../../../packages/utils/myDevelop.ts","../../../packages/utils/index.ts","../../../packages/hooks/usePopWindow/src/index.tsx","../../../packages/hooks/usePopWindow/index.ts","../../../packages/hooks/useDialog/src/index.tsx","../../../packages/hooks/useDialog/index.ts","../../../packages/directives/modules/copy.ts"],"sourcesContent":["import type { App, Directive } from 'vue';\nimport type { SFCWithInstall } from '../types';\n\n// 注册组件\nexport const withInstall = <T>(main: T) => {\n (main as SFCWithInstall<T>).install = (app): void => {\n const comp: Record<string, any> = main as Record<string, any>;\n app.component(comp.name, comp);\n };\n return main as SFCWithInstall<T>;\n};\n\n// 注册指令\nexport const withInstallDirectives = <T extends Directive>(main: T, name: string) => {\n return {\n install: (app: App): void => {\n app.directive(name, main);\n },\n directive: main,\n };\n};\n","import type { ExtractPropTypes, PropType } from 'vue';\nimport type button from './button.vue';\n\nexport type Type = 'primary' | 'success' | 'error';\n\nexport const ButtonProps = {\n type: {\n type: String as PropType<Type>,\n default: 'default',\n },\n};\n\nexport type ButtonPropsType = ExtractPropTypes<typeof ButtonProps>;\nexport type ButtonInstanceType = InstanceType<typeof button>;\n","<script lang=\"ts\" setup>\n import { ButtonProps } from './button';\n\n defineProps(ButtonProps);\n\n defineOptions({\n name: 'IButton',\n });\n</script>\n\n<template>\n <button class=\"mu-button\" :class=\"type\">\n <slot></slot>\n </button>\n</template>\n","import { withInstall } from '../../utils/install';\nimport Button from './src/button.vue';\n\nexport const IButton = withInstall(Button); // 增加类型\n\nexport default IButton;\n","import type { App, Plugin } from 'vue';\n\nimport { IButton } from './components/button';\n\nconst component = [IButton] as Plugin[];\n\nexport const install = function (app: App) {\n component.forEach((i) => app.use(i));\n};\n\nexport default {\n install,\n};\n","// utils 用例\nexport function developFn() {\n console.log('developFn');\n}\n","export * from './install';\nexport * from './myDevelop';\n\n\nexport function formatValue(value: number | string): string {\n if (typeof value === 'number') {\n return `${value}px`;\n } else if (typeof value === 'string') {\n // 检查是否已经带有 px 单位或其他单位\n if (value.endsWith('px') || value.endsWith('%')) {\n return value; // 直接返回已有单位的字符串\n }\n return `${value}px`; // 其他字符串类型的值加上 px\n }\n return '';\n}","import { type AppContext, type Component, type ComponentInternalInstance, getCurrentInstance, nextTick, render } from 'vue'\n\nimport { type PopWindowInfoProps, type PopWindowProps } from './interface'\nimport { ElScrollbar } from 'element-plus'\nimport { formatValue } from '../../../utils'\n\nlet appContextConst: AppContext | undefined\nlet popWindowList: Array<any> = []\nconst getBody = (): Element => {\n return document.querySelector('body') as HTMLBodyElement\n}\n/**\n * 显示弹出窗口\n *\n * 此函数用于创建并显示一个弹出窗口,支持自定义样式和内容通过参数传递\n * 可以选择附加到特定的父元素,并且在渲染后会将自身添加到弹出窗口列表中\n *\n * @param props 弹出窗口的属性,包括位置、尺寸等样式属性以及附加属性\n * @param component 可选参数,用于指定弹出窗口内渲染的自定义组件类型,如果props中传了render函数,则无效\n * @param componentProps 可选参数,传递给自定义组件的属性\n */\nexport const showPopWindow = (props: PopWindowProps, component?: Component, componentProps?: any) => {\n const op = {\n left: 'auto',\n top: 'auto',\n right: 'auto',\n bottom: 'auto',\n // width: 'auto',\n // height: 'auto',\n position: 'absolute',\n id: 'popwindow_' + Math.ceil(Math.random() * 1000000),\n animate: false,\n animateInClass: 'animate__animated animate__faster animate__fadeIn',\n animateOutClass: 'animate__animated animate__faster animate__fadeOut'\n }\n let propsFormat = { ...props }\n if (props.left !== undefined) propsFormat.left = formatValue(propsFormat.left)\n if (props.top !== undefined) propsFormat.top = formatValue(propsFormat.top)\n if (props.width !== undefined) propsFormat.width = formatValue(propsFormat.width)\n if (props.height !== undefined) propsFormat.height = formatValue(propsFormat.height)\n\n const option: PopWindowProps = Object.assign(op, propsFormat)\n const close = () => {\n closePopWindowById(option.id)\n }\n\n // 相同的id只会存在一个\n closePopWindowById(option.id)\n let animateClass = option.animate ? option.animateInClass : ''\n\n const vm = (\n <div\n class={'popWindow ' + animateClass}\n style={{\n width: option.width,\n height: option.height,\n left: option.left,\n right: option.right,\n top: option.top,\n bottom: option.bottom,\n position: option.position\n }}>\n <ElScrollbar>\n {props.render ? props.render({ close, option }) : <component is={component} {...componentProps} onClose={() => close()}></component>}\n </ElScrollbar>\n </div>\n )\n vm.appContext = appContextConst\n // 这里是为了让插槽的子组件能获取到appContext\n if (vm.children?.length) {\n vm.children[0].appContext = appContextConst\n }\n const container = document.createElement('div')\n container.id = 'popwindow_' + Math.ceil(Math.random() * 1000000)\n container.style.pointerEvents = 'auto'\n\n let parentEl = getBody()\n if (props.appendParent) {\n parentEl = document.getElementById(props.appendParent)\n }\n parentEl.appendChild(container)\n render(vm, container)\n\n nextTick(() => {\n const popWindowInfo = { id: option.id, tag: option.tag, node: container, option }\n popWindowList.push(popWindowInfo)\n })\n return { id: option.id, close }\n}\nconst removePopWindow = (popWindowInfo: PopWindowInfoProps) => {\n if (!popWindowInfo) return\n const { option, node } = popWindowInfo\n option.onClose?.()\n if (option.animate) {\n const popWindowNode = node.querySelector('.popWindow')\n popWindowNode.className = 'popWindow ' + option.animateOutClass\n popWindowNode.addEventListener('animationend', () => {\n render(null, node)\n node.remove()\n popWindowList.splice(popWindowList.indexOf(popWindowInfo), 1)\n })\n } else {\n render(null, node)\n node.remove()\n popWindowList.splice(popWindowList.indexOf(popWindowInfo), 1)\n }\n}\n\n/**\n * 根据ID关闭弹出窗口\n *\n * @param id 弹出窗口的唯一标识符\n */\nexport const closePopWindowById = (id: string) => {\n const popWindowItem = popWindowList.find((item) => item.id === id)\n if (popWindowItem) {\n removePopWindow(popWindowItem)\n }\n}\n\n/**\n * 根据tag关闭弹出窗口\n *\n * @param tag 弹出窗口的tag\n */\nexport const closePopWindowByTag = (tag: string) => {\n const popWindows = popWindowList.filter((item) => item.tag === tag)\n popWindows.forEach((item) => removePopWindow(item))\n}\n\n/**\n * 获取所有弹窗信息\n *\n * @returns {PopWindowInfoProps[]} 所有弹窗的列表\n */\nexport const getAllPopWindows = (): PopWindowInfoProps[] => {\n return popWindowList\n}\n\nexport const initPopWindow = (ctx?: ComponentInternalInstance) => {\n const { appContext } = ctx || getCurrentInstance() || {}\n appContextConst = appContext\n\n return { showPopWindow }\n}\n","import { type ComponentInternalInstance, getCurrentInstance } from 'vue'\n\nimport { closePopWindowById, closePopWindowByTag, initPopWindow, showPopWindow, getAllPopWindows } from './src/index'\nimport { type PopWindowInfoProps, type PopWindowProps } from './src/interface'\n\nexport { showPopWindow, closePopWindowById, closePopWindowByTag, getAllPopWindows }\nexport type { PopWindowInfoProps, PopWindowProps }\nexport const usePopWindow = (ctx?: any) => {\n const thisAppContext = ctx || (getCurrentInstance() as ComponentInternalInstance)\n const { showPopWindow } = initPopWindow(thisAppContext)\n return { showPopWindow }\n}\n","import { type AppContext, type Component, type ComponentInternalInstance, getCurrentInstance, ref, render, unref, type VNode } from 'vue'\n\nimport { type DialogProps, ElButton, ElConfigProvider, ElDialog, ElScrollbar } from 'element-plus'\n\nconst prefixClass = 'work-dialog'\n\nlet id = 0\n\nlet appContextConst: AppContext | undefined\n\nconst getFather = (): Element => {\n return document.querySelector('body') as HTMLBodyElement\n}\n\nexport interface ZnDialogProps extends Partial<DialogProps> {\n render?: () => VNode // 内容渲染 TSX\n headerRender?: (scope: any) => VNode // 头部渲染 TSX\n footerRender?: () => VNode // 底部渲染 TSX\n showFooter?: boolean // 是否渲染底部,默认 true\n onConfirm?: (closeDialog: () => void) => void // 确认按钮点击事件\n onClose?: (closeDialog: () => void) => void // 关闭按钮点击事件\n height?: string // 内容高度,默认 400px\n}\n\nconst isShow = ref(true)\n\n/**\n * @description 关闭弹框\n */\nexport const closeDialog = () => {\n isShow.value = false\n setTimeout(() => {\n const vm = document.querySelector(`#${prefixClass}-${id--}`) as HTMLElement\n if (vm) {\n render(null, vm)\n getFather().removeChild(vm)\n }\n isShow.value = true\n }, 500)\n}\n\nconst handleClose = (dialogProps?: ZnDialogProps) => {\n if (dialogProps?.onClose) dialogProps?.onClose(closeDialog)\n return closeDialog()\n}\n\nconst handleConfirm = (dialogProps?: ZnDialogProps) => {\n if (dialogProps?.onConfirm) dialogProps?.onConfirm(closeDialog)\n return closeDialog()\n}\n/**\n * 内容渲染方式有两种\n * 方式 1:在第一个参数里写 render,即可实现 el-dialog 的内容渲染\n * 方式 2:第二个参数为组件,第三个参数为组件的 props\n *\n * 在第一个参数里写 headerRender 和 footerRender,可以自定义 el-dialog 的 header 和 footer\n */\nexport const showDialog = (dialogProps: ZnDialogProps, component?: Component, componentsProps?: any) => {\n const layoutSize = ref('default')\n\n const contentHeight = ref(dialogProps.height)\n\n const vm = (\n <ElConfigProvider namespace=\"el\" size={unref(layoutSize)}>\n <ElDialog\n modelValue={isShow.value}\n title=\"弹框\"\n width=\"50%\"\n before-close={() => handleClose(dialogProps)}\n close-on-click-modal={true}\n {...dialogProps}\n render\n headerRender\n footerRender\n class={prefixClass}>\n {{\n default: () => {\n if (dialogProps.render) {\n return (\n <ElScrollbar\n style={{\n height: unref(contentHeight)\n }}>\n {dialogProps.render()}\n </ElScrollbar>\n )\n }\n return (\n <ElScrollbar style={{ height: unref(contentHeight) }}>\n <component is={component} {...componentsProps} onCloseDialog={() => closeDialog()}></component>\n </ElScrollbar>\n )\n },\n header: (scope: any) => {\n if (dialogProps?.headerRender) return dialogProps.headerRender(scope)\n return (\n <div style=\"display: flex\">\n <span class={`el-dialog__title`} style=\"flex: 1\">\n {dialogProps.title}\n </span>\n </div>\n )\n },\n footer: () => {\n if (dialogProps.footerRender) return dialogProps.footerRender()\n if (dialogProps.showFooter === false) return\n return (\n <>\n <ElButton onClick={() => handleClose(dialogProps)}>取 消</ElButton>\n <ElButton type=\"primary\" onClick={() => handleConfirm(dialogProps)}>\n 确 定\n </ElButton>\n </>\n )\n }\n }}\n </ElDialog>\n </ElConfigProvider>\n )\n\n vm.appContext = appContextConst\n vm.children?.length && (vm.children[0].appContext = appContextConst)\n\n const container = document.createElement('div')\n container.id = `${prefixClass}-${++id}`\n getFather().appendChild(container)\n render(vm, container)\n}\n\nexport const initDialog = (ctx?: ComponentInternalInstance) => {\n const { appContext } = ctx || getCurrentInstance() || {}\n appContextConst = appContext\n\n return { showDialog }\n}\n","import { type ComponentInternalInstance, getCurrentInstance } from 'vue'\n\nimport { closeDialog, initDialog, type ZnDialogProps } from './src/index'\n\nexport { type ZnDialogProps }\n\nexport const useDialog = (ctx?: any) => {\n const thisAppContext = ctx || (getCurrentInstance() as ComponentInternalInstance)\n const { showDialog } = initDialog(thisAppContext)\n\n return { open: showDialog, close: closeDialog }\n}\n","/**\r\n * v-copy\r\n * 复制某个值至剪贴板\r\n * 接收参数:string类型/Ref<string>类型/Reactive<string>类型\r\n */\r\n\r\nimport { ElMessage } from 'element-plus'\r\nimport type { Directive, DirectiveBinding } from 'vue'\r\ninterface ElType extends HTMLElement {\r\n copyData: string | number;\r\n}\r\nconst copy: Directive = {\r\n mounted(el: ElType, binding: DirectiveBinding) {\r\n el.copyData = binding.value\r\n el.addEventListener('click', handleClick)\r\n },\r\n updated(el: ElType, binding: DirectiveBinding) {\r\n el.copyData = binding.value\r\n },\r\n beforeUnmount(el: ElType) {\r\n el.removeEventListener('click', handleClick)\r\n }\r\n}\r\n\r\nasync function handleClick(this: any) {\r\n try {\r\n await navigator.clipboard.writeText(this.copyData)\r\n ElMessage({\r\n type: 'success',\r\n message: '复制成功'\r\n })\r\n } catch (err) {\r\n console.error('复制操作不被支持或失败: ', err)\r\n }\r\n}\r\n\r\nexport default copy\r\n"],"names":["s","r","__name","t","e","withInstall","main","app","comp","withInstallDirectives","name","ButtonProps","_sfc_render","_ctx","_cache","$props","type","$data","$options","_normalizeClass","IButton","Button","component","install","i","r$2","l","o","n","developFn","formatValue","value","appContextConst","popWindowList","getBody","document","querySelector","showPopWindow","props","componentProps","op","left","top","right","bottom","position","id","Math","ceil","random","animate","animateInClass","animateOutClass","propsFormat","undefined","width","height","option","Object","assign","close","closePopWindowById","animateClass","vm","_createVNode","ElScrollbar","default","render","_mergeProps","onClose","appContext","children","length","container","createElement","style","pointerEvents","parentEl","appendParent","getElementById","appendChild","nextTick","popWindowInfo","tag","node","push","removePopWindow","popWindowNode","className","addEventListener","remove","splice","indexOf","popWindowItem","find","item","closePopWindowByTag","filter","forEach","getAllPopWindows","initPopWindow","ctx","getCurrentInstance","usePopWindow","thisAppContext","_isSlot","prototype","toString","call","_isVNode","prefixClass","getFather","isShow","ref","closeDialog","setTimeout","removeChild","handleClose","dialogProps","handleConfirm","onConfirm","showDialog","componentsProps","layoutSize","contentHeight","ElConfigProvider","unref","ElDialog","before-close","_slot","onCloseDialog","header","scope","headerRender","title","footer","footerRender","showFooter","_Fragment","ElButton","onClick","_createTextVNode","initDialog","p","useDialog","copy","el","binding","handleClick","ElMessage","err"],"mappings":"ucAIO,IAAAA,GAAA,OAAA,eAAAC,EAAAC,EAAA,CAAAC,EAAAC,IAAAJ,GAAAG,EAAA,OAAA,CAAA,MAAAC,EAAA,aAAA,EAAA,CAAA,EAAA,OAAA,MAAMC,EAAcH,EAAII,IAC5BA,EAA2B,QAAWC,GAAc,CACnD,MAAMC,EAA4BF,EAClCC,EAAI,UAAUC,EAAK,KAAMA,CAAI,CAC/B,EACOF,GALkB,aAAA,EASdG,GAAwBP,EAAA,CAAsBI,EAASI,KAC3D,CACL,QAASR,EAACK,GAAmB,CAC3BA,EAAI,UAAUG,EAAMJ,CAAI,CAC1B,EAFS,SAGT,EAAA,UAAWA,CACb,GANmC,uBAAA,ECRxBK,GAAc,CACzB,KAAM,CACJ,KAAM,OACN,QAAS,SACX,CACF,kVCCeC,EAXfC,EAAAC,EAWgBC,EAAoBC,EAAIC,EAAAC,EAAA,wBACpC,MAAaC,EAAA,CAAA,YAAAN,EAAA,IAAA,CAAA,CAAA,6BADFD,EAAAA,EAAAA,OAAAV,GAAAU,EAAA,oECRR,MAAMQ,EAAUf,EAAYgB,EAAM,yFCCzC,MAAMC,GAAY,CAACF,CAAO,EAEbG,EAAUrB,GAAA,SAAUK,EAAU,CACzCe,GAAU,QAASE,GAA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CACtC,MAAMG,EAAiBH,GAAQC,IACzB,CAAE,WAAAmB,CAAW,EAAIqB,GAAWtC,CAAc,EAEhD,MAAO,CAAE,KAAMiB,EAAY,MAAOP,CAAY,CAChD,EALyB,WAAA,ECAzB,IAAAjH,GAAA,OAAA,eAAAuB,GAAAtB,EAAA,CAAA,EAAA,IAAAD,GAAA,EAAA,OAAA,CAAA,MAAA,EAAA,aAAA,EAAA,CAAA,EAAA,KAKA,MAAMgJ,GAAkB,CACtB,QAAQC,EAAYC,EAA2B,CAC7CD,EAAG,SAAWC,EAAQ,MACtBD,EAAG,iBAAiB,QAASE,CAAW,CAC1C,EACA,QAAQF,EAAYC,EAA2B,CAC7CD,EAAG,SAAWC,EAAQ,KACxB,EACA,cAAcD,EAAY,CACxBA,EAAG,oBAAoB,QAASE,CAAW,CAC7C,CACF,EAEA,eAAeA,GAAuB,CACpC,GAAI,CACF,MAAM,UAAU,UAAU,UAAU,KAAK,QAAQ,EACjDC,GAAU,CACR,KAAM,UACN,QAAS,0BACX,CAAC,CACH,OAASC,EAAK,CACZ,QAAQ,MAAM,uEAAiBA,CAAG,CACpC,CACF,CAVeF,EAAAA,EAAAA,KAAAlJ,GAAAkJ,EAAA"}
@@ -0,0 +1,2 @@
1
+ import vCopy from './modules/copy';
2
+ export { vCopy };
@@ -0,0 +1,2 @@
1
+ export { default as vCopy } from './modules/copy.mjs';
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import type { Directive } from 'vue';
2
+ declare const copy: Directive;
3
+ export default copy;
@@ -0,0 +1,31 @@
1
+ import { ElMessage } from 'element-plus';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+ const copy = {
6
+ mounted(el, binding) {
7
+ el.copyData = binding.value;
8
+ el.addEventListener("click", handleClick);
9
+ },
10
+ updated(el, binding) {
11
+ el.copyData = binding.value;
12
+ },
13
+ beforeUnmount(el) {
14
+ el.removeEventListener("click", handleClick);
15
+ }
16
+ };
17
+ async function handleClick() {
18
+ try {
19
+ await navigator.clipboard.writeText(this.copyData);
20
+ ElMessage({
21
+ type: "success",
22
+ message: "\u590D\u5236\u6210\u529F"
23
+ });
24
+ } catch (err) {
25
+ console.error("\u590D\u5236\u64CD\u4F5C\u4E0D\u88AB\u652F\u6301\u6216\u5931\u8D25: ", err);
26
+ }
27
+ }
28
+ __name(handleClick, "handleClick");
29
+
30
+ export { copy as default };
31
+ //# sourceMappingURL=copy.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy.mjs","sources":["../../../../../packages/directives/modules/copy.ts"],"sourcesContent":["/**\r\n * v-copy\r\n * 复制某个值至剪贴板\r\n * 接收参数:string类型/Ref<string>类型/Reactive<string>类型\r\n */\r\n\r\nimport { ElMessage } from 'element-plus'\r\nimport type { Directive, DirectiveBinding } from 'vue'\r\ninterface ElType extends HTMLElement {\r\n copyData: string | number;\r\n}\r\nconst copy: Directive = {\r\n mounted(el: ElType, binding: DirectiveBinding) {\r\n el.copyData = binding.value\r\n el.addEventListener('click', handleClick)\r\n },\r\n updated(el: ElType, binding: DirectiveBinding) {\r\n el.copyData = binding.value\r\n },\r\n beforeUnmount(el: ElType) {\r\n el.removeEventListener('click', handleClick)\r\n }\r\n}\r\n\r\nasync function handleClick(this: any) {\r\n try {\r\n await navigator.clipboard.writeText(this.copyData)\r\n ElMessage({\r\n type: 'success',\r\n message: '复制成功'\r\n })\r\n } catch (err) {\r\n console.error('复制操作不被支持或失败: ', err)\r\n }\r\n}\r\n\r\nexport default copy\r\n"],"names":[],"mappings":";;;;AAWA,MAAM,IAAkB,GAAA;AAAA,EACtB,OAAA,CAAQ,IAAY,OAA2B,EAAA;AAC7C,IAAA,EAAA,CAAG,WAAW,OAAQ,CAAA,KAAA,CAAA;AACtB,IAAG,EAAA,CAAA,gBAAA,CAAiB,SAAS,WAAW,CAAA,CAAA;AAAA,GAC1C;AAAA,EACA,OAAA,CAAQ,IAAY,OAA2B,EAAA;AAC7C,IAAA,EAAA,CAAG,WAAW,OAAQ,CAAA,KAAA,CAAA;AAAA,GACxB;AAAA,EACA,cAAc,EAAY,EAAA;AACxB,IAAG,EAAA,CAAA,mBAAA,CAAoB,SAAS,WAAW,CAAA,CAAA;AAAA,GAC7C;AACF,EAAA;AAEA,eAAe,WAAuB,GAAA;AACpC,EAAI,IAAA;AACF,IAAA,MAAM,SAAU,CAAA,SAAA,CAAU,SAAU,CAAA,IAAA,CAAK,QAAQ,CAAA,CAAA;AACjD,IAAU,SAAA,CAAA;AAAA,MACR,IAAM,EAAA,SAAA;AAAA,MACN,OAAS,EAAA,0BAAA;AAAA,KACV,CAAA,CAAA;AAAA,WACM,GAAK,EAAA;AACZ,IAAQ,OAAA,CAAA,KAAA,CAAM,wEAAiB,GAAG,CAAA,CAAA;AAAA,GACpC;AACF,CAAA;AAVe,MAAA,CAAA,WAAA,EAAA,aAAA,CAAA;;;;"}
@@ -1,2 +1,2 @@
1
- export * from './useDeveloper';
2
1
  export * from './usePopWindow';
2
+ export * from './useDialog';
@@ -1,4 +1,4 @@
1
- export { useDeveloper } from './useDeveloper/index.mjs';
2
1
  export { usePopWindow } from './usePopWindow/index.mjs';
2
+ export { useDialog } from './useDialog/index.mjs';
3
3
  export { closePopWindowById, closePopWindowByTag, getAllPopWindows, showPopWindow } from './usePopWindow/src/index.mjs';
4
4
  //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,6 @@
1
+ import { type ZnDialogProps } from './src/index';
2
+ export { type ZnDialogProps };
3
+ export declare const useDialog: (ctx?: any) => {
4
+ open: (dialogProps: ZnDialogProps, component?: import("vue").Component, componentsProps?: any) => void;
5
+ close: () => void;
6
+ };
@@ -0,0 +1,13 @@
1
+ import { getCurrentInstance } from 'vue';
2
+ import { initDialog, closeDialog } from './src/index.mjs';
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ const useDialog = /* @__PURE__ */ __name((ctx) => {
7
+ const thisAppContext = ctx || getCurrentInstance();
8
+ const { showDialog } = initDialog(thisAppContext);
9
+ return { open: showDialog, close: closeDialog };
10
+ }, "useDialog");
11
+
12
+ export { useDialog };
13
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../../../../../packages/hooks/useDialog/index.ts"],"sourcesContent":["import { type ComponentInternalInstance, getCurrentInstance } from 'vue'\n\nimport { closeDialog, initDialog, type ZnDialogProps } from './src/index'\n\nexport { type ZnDialogProps }\n\nexport const useDialog = (ctx?: any) => {\n const thisAppContext = ctx || (getCurrentInstance() as ComponentInternalInstance)\n const { showDialog } = initDialog(thisAppContext)\n\n return { open: showDialog, close: closeDialog }\n}\n"],"names":[],"mappings":";;;;;AAMa,MAAA,SAAA,2BAAa,GAAc,KAAA;AACtC,EAAM,MAAA,cAAA,GAAiB,OAAQ,kBAAmB,EAAA,CAAA;AAClD,EAAA,MAAM,EAAE,UAAA,EAAe,GAAA,UAAA,CAAW,cAAc,CAAA,CAAA;AAEhD,EAAA,OAAO,EAAE,IAAA,EAAM,UAAY,EAAA,KAAA,EAAO,WAAY,EAAA,CAAA;AAChD,CALyB,EAAA,WAAA;;;;"}
@@ -0,0 +1,16 @@
1
+ import { type Component, type ComponentInternalInstance, type VNode } from 'vue';
2
+ import { type DialogProps } from 'element-plus';
3
+ export interface ZnDialogProps extends Partial<DialogProps> {
4
+ render?: () => VNode;
5
+ headerRender?: (scope: any) => VNode;
6
+ footerRender?: () => VNode;
7
+ showFooter?: boolean;
8
+ onConfirm?: (closeDialog: () => void) => void;
9
+ onClose?: (closeDialog: () => void) => void;
10
+ height?: string;
11
+ }
12
+ export declare const closeDialog: () => void;
13
+ export declare const showDialog: (dialogProps: ZnDialogProps, component?: Component, componentsProps?: any) => void;
14
+ export declare const initDialog: (ctx?: ComponentInternalInstance) => {
15
+ showDialog: (dialogProps: ZnDialogProps, component?: Component, componentsProps?: any) => void;
16
+ };
@@ -0,0 +1,122 @@
1
+ import { isVNode, ref, render, createVNode, unref, mergeProps, Fragment, createTextVNode, getCurrentInstance } from 'vue';
2
+ import { ElConfigProvider, ElDialog, ElScrollbar, ElButton } from 'element-plus';
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ function _isSlot(s) {
7
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
8
+ }
9
+ __name(_isSlot, "_isSlot");
10
+ const prefixClass = "work-dialog";
11
+ let id = 0;
12
+ let appContextConst;
13
+ const getFather = /* @__PURE__ */ __name(() => {
14
+ return document.querySelector("body");
15
+ }, "getFather");
16
+ const isShow = ref(true);
17
+ const closeDialog = /* @__PURE__ */ __name(() => {
18
+ isShow.value = false;
19
+ setTimeout(() => {
20
+ const vm = document.querySelector(`#${prefixClass}-${id--}`);
21
+ if (vm) {
22
+ render(null, vm);
23
+ getFather().removeChild(vm);
24
+ }
25
+ isShow.value = true;
26
+ }, 500);
27
+ }, "closeDialog");
28
+ const handleClose = /* @__PURE__ */ __name((dialogProps) => {
29
+ if (dialogProps == null ? void 0 : dialogProps.onClose) dialogProps == null ? void 0 : dialogProps.onClose(closeDialog);
30
+ return closeDialog();
31
+ }, "handleClose");
32
+ const handleConfirm = /* @__PURE__ */ __name((dialogProps) => {
33
+ if (dialogProps == null ? void 0 : dialogProps.onConfirm) dialogProps == null ? void 0 : dialogProps.onConfirm(closeDialog);
34
+ return closeDialog();
35
+ }, "handleConfirm");
36
+ const showDialog = /* @__PURE__ */ __name((dialogProps, component, componentsProps) => {
37
+ var _a;
38
+ const layoutSize = ref("default");
39
+ const contentHeight = ref(dialogProps.height);
40
+ const vm = createVNode(ElConfigProvider, {
41
+ "namespace": "el",
42
+ "size": unref(layoutSize)
43
+ }, {
44
+ default: /* @__PURE__ */ __name(() => [createVNode(ElDialog, mergeProps({
45
+ "modelValue": isShow.value,
46
+ "title": "\u5F39\u6846",
47
+ "width": "50%",
48
+ "before-close": /* @__PURE__ */ __name(() => handleClose(dialogProps), "before-close"),
49
+ "close-on-click-modal": true
50
+ }, dialogProps, {
51
+ "render": true,
52
+ "headerRender": true,
53
+ "footerRender": true,
54
+ "class": prefixClass
55
+ }), {
56
+ default: /* @__PURE__ */ __name(() => {
57
+ if (dialogProps.render) {
58
+ let _slot;
59
+ return createVNode(ElScrollbar, {
60
+ "style": {
61
+ height: unref(contentHeight)
62
+ }
63
+ }, _isSlot(_slot = dialogProps.render()) ? _slot : {
64
+ default: /* @__PURE__ */ __name(() => [_slot], "default")
65
+ });
66
+ }
67
+ return createVNode(ElScrollbar, {
68
+ "style": {
69
+ height: unref(contentHeight)
70
+ }
71
+ }, {
72
+ default: /* @__PURE__ */ __name(() => [createVNode(component, mergeProps({
73
+ "is": component
74
+ }, componentsProps, {
75
+ "onCloseDialog": /* @__PURE__ */ __name(() => closeDialog(), "onCloseDialog")
76
+ }), null)], "default")
77
+ });
78
+ }, "default"),
79
+ header: /* @__PURE__ */ __name((scope) => {
80
+ if (dialogProps == null ? void 0 : dialogProps.headerRender) return dialogProps.headerRender(scope);
81
+ return createVNode("div", {
82
+ "style": "display: flex"
83
+ }, [createVNode("span", {
84
+ "class": `el-dialog__title`,
85
+ "style": "flex: 1"
86
+ }, [dialogProps.title])]);
87
+ }, "header"),
88
+ footer: /* @__PURE__ */ __name(() => {
89
+ if (dialogProps.footerRender) return dialogProps.footerRender();
90
+ if (dialogProps.showFooter === false) return;
91
+ return createVNode(Fragment, null, [createVNode(ElButton, {
92
+ "onClick": /* @__PURE__ */ __name(() => handleClose(dialogProps), "onClick")
93
+ }, {
94
+ default: /* @__PURE__ */ __name(() => [createTextVNode("\u53D6 \u6D88")], "default")
95
+ }), createVNode(ElButton, {
96
+ "type": "primary",
97
+ "onClick": /* @__PURE__ */ __name(() => handleConfirm(dialogProps), "onClick")
98
+ }, {
99
+ default: /* @__PURE__ */ __name(() => [createTextVNode("\u786E \u5B9A")], "default")
100
+ })]);
101
+ }, "footer")
102
+ })], "default")
103
+ });
104
+ vm.appContext = appContextConst;
105
+ ((_a = vm.children) == null ? void 0 : _a.length) && (vm.children[0].appContext = appContextConst);
106
+ const container = document.createElement("div");
107
+ container.id = `${prefixClass}-${++id}`;
108
+ getFather().appendChild(container);
109
+ render(vm, container);
110
+ }, "showDialog");
111
+ const initDialog = /* @__PURE__ */ __name((ctx) => {
112
+ const {
113
+ appContext
114
+ } = ctx || getCurrentInstance() || {};
115
+ appContextConst = appContext;
116
+ return {
117
+ showDialog
118
+ };
119
+ }, "initDialog");
120
+
121
+ export { closeDialog, initDialog, showDialog };
122
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../../../../../../packages/hooks/useDialog/src/index.tsx"],"sourcesContent":["import { type AppContext, type Component, type ComponentInternalInstance, getCurrentInstance, ref, render, unref, type VNode } from 'vue'\n\nimport { type DialogProps, ElButton, ElConfigProvider, ElDialog, ElScrollbar } from 'element-plus'\n\nconst prefixClass = 'work-dialog'\n\nlet id = 0\n\nlet appContextConst: AppContext | undefined\n\nconst getFather = (): Element => {\n return document.querySelector('body') as HTMLBodyElement\n}\n\nexport interface ZnDialogProps extends Partial<DialogProps> {\n render?: () => VNode // 内容渲染 TSX\n headerRender?: (scope: any) => VNode // 头部渲染 TSX\n footerRender?: () => VNode // 底部渲染 TSX\n showFooter?: boolean // 是否渲染底部,默认 true\n onConfirm?: (closeDialog: () => void) => void // 确认按钮点击事件\n onClose?: (closeDialog: () => void) => void // 关闭按钮点击事件\n height?: string // 内容高度,默认 400px\n}\n\nconst isShow = ref(true)\n\n/**\n * @description 关闭弹框\n */\nexport const closeDialog = () => {\n isShow.value = false\n setTimeout(() => {\n const vm = document.querySelector(`#${prefixClass}-${id--}`) as HTMLElement\n if (vm) {\n render(null, vm)\n getFather().removeChild(vm)\n }\n isShow.value = true\n }, 500)\n}\n\nconst handleClose = (dialogProps?: ZnDialogProps) => {\n if (dialogProps?.onClose) dialogProps?.onClose(closeDialog)\n return closeDialog()\n}\n\nconst handleConfirm = (dialogProps?: ZnDialogProps) => {\n if (dialogProps?.onConfirm) dialogProps?.onConfirm(closeDialog)\n return closeDialog()\n}\n/**\n * 内容渲染方式有两种\n * 方式 1:在第一个参数里写 render,即可实现 el-dialog 的内容渲染\n * 方式 2:第二个参数为组件,第三个参数为组件的 props\n *\n * 在第一个参数里写 headerRender 和 footerRender,可以自定义 el-dialog 的 header 和 footer\n */\nexport const showDialog = (dialogProps: ZnDialogProps, component?: Component, componentsProps?: any) => {\n const layoutSize = ref('default')\n\n const contentHeight = ref(dialogProps.height)\n\n const vm = (\n <ElConfigProvider namespace=\"el\" size={unref(layoutSize)}>\n <ElDialog\n modelValue={isShow.value}\n title=\"弹框\"\n width=\"50%\"\n before-close={() => handleClose(dialogProps)}\n close-on-click-modal={true}\n {...dialogProps}\n render\n headerRender\n footerRender\n class={prefixClass}>\n {{\n default: () => {\n if (dialogProps.render) {\n return (\n <ElScrollbar\n style={{\n height: unref(contentHeight)\n }}>\n {dialogProps.render()}\n </ElScrollbar>\n )\n }\n return (\n <ElScrollbar style={{ height: unref(contentHeight) }}>\n <component is={component} {...componentsProps} onCloseDialog={() => closeDialog()}></component>\n </ElScrollbar>\n )\n },\n header: (scope: any) => {\n if (dialogProps?.headerRender) return dialogProps.headerRender(scope)\n return (\n <div style=\"display: flex\">\n <span class={`el-dialog__title`} style=\"flex: 1\">\n {dialogProps.title}\n </span>\n </div>\n )\n },\n footer: () => {\n if (dialogProps.footerRender) return dialogProps.footerRender()\n if (dialogProps.showFooter === false) return\n return (\n <>\n <ElButton onClick={() => handleClose(dialogProps)}>取 消</ElButton>\n <ElButton type=\"primary\" onClick={() => handleConfirm(dialogProps)}>\n 确 定\n </ElButton>\n </>\n )\n }\n }}\n </ElDialog>\n </ElConfigProvider>\n )\n\n vm.appContext = appContextConst\n vm.children?.length && (vm.children[0].appContext = appContextConst)\n\n const container = document.createElement('div')\n container.id = `${prefixClass}-${++id}`\n getFather().appendChild(container)\n render(vm, container)\n}\n\nexport const initDialog = (ctx?: ComponentInternalInstance) => {\n const { appContext } = ctx || getCurrentInstance() || {}\n appContextConst = appContext\n\n return { showDialog }\n}\n"],"names":["_isSlot","s","Object","prototype","toString","call","_isVNode","prefixClass","id","appContextConst","getFather","document","querySelector","isShow","ref","closeDialog","value","setTimeout","vm","render","removeChild","handleClose","dialogProps","onClose","handleConfirm","onConfirm","showDialog","component","componentsProps","layoutSize","contentHeight","height","_createVNode","ElConfigProvider","unref","default","ElDialog","_mergeProps","before-close","_slot","ElScrollbar","onCloseDialog","header","headerRender","scope","title","footer","footerRender","showFooter","_Fragment","ElButton","onClick","_createTextVNode","appContext","children","length","container","createElement","appendChild","initDialog","ctx","getCurrentInstance"],"mappings":";;;;;AAEkG,SAAAA,QAAAC,CAAA,EAAA;AAAA,EAAA,OAAA,OAAAA,CAAAA,KAAA,UAAAC,IAAAA,MAAAA,CAAAC,SAAAC,CAAAA,QAAAA,CAAAC,IAAAJ,CAAAA,CAAA,CAAAK,KAAAA,iBAAAA,IAAAA,CAAAA,OAAAA,CAAAL,CAAA,CAAA,CAAA;AAAA,CAAA;AAAAD,MAAAA,CAAAA,OAAAA,EAAAA,SAAAA,CAAAA,CAAAA;AAElG,MAAMO,WAAc,GAAA,aAAA,CAAA;AAEpB,IAAIC,EAAK,GAAA,CAAA,CAAA;AAET,IAAIC,eAAAA,CAAAA;AAEJ,MAAMC,4BAA2B,MAAA,CAAA,MAAA;AAC/B,EAAOC,OAAAA,QAAAA,CAASC,cAAc,MAAM,CAAA,CAAA;AACtC,CAFkBF,EAAAA,WAAAA,CAAAA,CAAAA;AAclB,MAAMG,MAAAA,GAASC,IAAI,IAAI,CAAA,CAAA;AAKhB,MAAMC,8BAAoB,MAAA,CAAA,MAAA;AAC/BF,EAAAA,MAAAA,CAAOG,KAAQ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U,SAAA,EAAA,CAAEgD,YAAYF,SAAS,CAAA,CAAA;AACjCrC,EAAAA,MAAAA,CAAOD,IAAIsC,SAAS,CAAA,CAAA;AACtB,CAtE0B9B,EAAAA,YAAAA,EAAAA;AAwEnB,MAAMiC,6BAAkD,MAAA,CAAA,CAAA,GAAA,KAAA;AAC7D,EAAM,MAAA;AAAA,IAAEN,UAAAA;AAAAA,GAAeO,GAAAA,GAAAA,IAAOC,kBAAmB,EAAA,IAAK,EAAC,CAAA;AACvDpD,EAAkB4C,eAAAA,GAAAA,UAAAA,CAAAA;AAElB,EAAO,OAAA;AAAA,IAAE3B,UAAAA;AAAAA,GAAW,CAAA;AACtB,CAL2BkC,EAAAA,YAAAA;;;;"}
@@ -12,8 +12,10 @@ const getBody = /* @__PURE__ */ __name(() => {
12
12
  const showPopWindow = /* @__PURE__ */ __name((props, component, componentProps) => {
13
13
  var _a;
14
14
  const op = {
15
- left: "0",
16
- top: "0",
15
+ left: "auto",
16
+ top: "auto",
17
+ right: "auto",
18
+ bottom: "auto",
17
19
  // width: 'auto',
18
20
  // height: 'auto',
19
21
  position: "absolute",
@@ -41,7 +43,9 @@ const showPopWindow = /* @__PURE__ */ __name((props, component, componentProps)
41
43
  width: option.width,
42
44
  height: option.height,
43
45
  left: option.left,
46
+ right: option.right,
44
47
  top: option.top,
48
+ bottom: option.bottom,
45
49
  position: option.position
46
50
  }
47
51
  }, [createVNode(ElScrollbar, null, {