znyg-frontend-common 1.0.0
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.
- package/cdn/index.cdn.js +2 -0
- package/cdn/index.cdn.js.map +1 -0
- package/cdn/index.cdn.mjs +2 -0
- package/cdn/index.cdn.mjs.map +1 -0
- package/cdn/index.css +1 -0
- package/es/_virtual/_plugin-vue_export-helper.mjs +10 -0
- package/es/_virtual/_plugin-vue_export-helper.mjs.map +1 -0
- package/es/components/button/index.d.ts +14 -0
- package/es/components/button/index.mjs +7 -0
- package/es/components/button/index.mjs.map +1 -0
- package/es/components/button/src/button.d.ts +11 -0
- package/es/components/button/src/button.mjs +9 -0
- package/es/components/button/src/button.mjs.map +1 -0
- package/es/components/button/src/button.vue.d.ts +14 -0
- package/es/components/button/src/button.vue.mjs +24 -0
- package/es/components/button/src/button.vue.mjs.map +1 -0
- package/es/components/button/src/button.vue2.mjs +19 -0
- package/es/components/button/src/button.vue2.mjs.map +1 -0
- package/es/components/index.d.ts +1 -0
- package/es/components/index.mjs +2 -0
- package/es/components/index.mjs.map +1 -0
- package/es/hooks/index.d.ts +2 -0
- package/es/hooks/index.mjs +4 -0
- package/es/hooks/index.mjs.map +1 -0
- package/es/hooks/useDeveloper/index.d.ts +3 -0
- package/es/hooks/useDeveloper/index.mjs +12 -0
- package/es/hooks/useDeveloper/index.mjs.map +1 -0
- package/es/hooks/usePopWindow/index.d.ts +10 -0
- package/es/hooks/usePopWindow/index.mjs +14 -0
- package/es/hooks/usePopWindow/index.mjs.map +1 -0
- package/es/hooks/usePopWindow/src/index.d.ts +15 -0
- package/es/hooks/usePopWindow/src/index.mjs +121 -0
- package/es/hooks/usePopWindow/src/index.mjs.map +1 -0
- package/es/hooks/usePopWindow/src/interface/index.d.ts +27 -0
- package/es/hooks/usePopWindow/src/interface/index.mjs +2 -0
- package/es/hooks/usePopWindow/src/interface/index.mjs.map +1 -0
- package/es/index.d.ts +6 -0
- package/es/index.mjs +16 -0
- package/es/index.mjs.map +1 -0
- package/es/installer.d.ts +6 -0
- package/es/installer.mjs +14 -0
- package/es/installer.mjs.map +1 -0
- package/es/types.d.ts +6 -0
- package/es/types.mjs +2 -0
- package/es/types.mjs.map +1 -0
- package/es/utils/index.d.ts +2 -0
- package/es/utils/index.mjs +3 -0
- package/es/utils/index.mjs.map +1 -0
- package/es/utils/install.d.ts +7 -0
- package/es/utils/install.mjs +20 -0
- package/es/utils/install.mjs.map +1 -0
- package/es/utils/myDevelop.d.ts +1 -0
- package/es/utils/myDevelop.mjs +9 -0
- package/es/utils/myDevelop.mjs.map +1 -0
- package/global.d.ts +10 -0
- package/lib/_virtual/_plugin-vue_export-helper.js +14 -0
- package/lib/_virtual/_plugin-vue_export-helper.js.map +1 -0
- package/lib/components/button/index.d.ts +14 -0
- package/lib/components/button/index.js +12 -0
- package/lib/components/button/index.js.map +1 -0
- package/lib/components/button/src/button.d.ts +11 -0
- package/lib/components/button/src/button.js +11 -0
- package/lib/components/button/src/button.js.map +1 -0
- package/lib/components/button/src/button.vue.d.ts +14 -0
- package/lib/components/button/src/button.vue.js +28 -0
- package/lib/components/button/src/button.vue.js.map +1 -0
- package/lib/components/button/src/button.vue2.js +23 -0
- package/lib/components/button/src/button.vue2.js.map +1 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +8 -0
- package/lib/components/index.js.map +1 -0
- package/lib/hooks/index.d.ts +2 -0
- package/lib/hooks/index.js +14 -0
- package/lib/hooks/index.js.map +1 -0
- package/lib/hooks/useDeveloper/index.d.ts +3 -0
- package/lib/hooks/useDeveloper/index.js +14 -0
- package/lib/hooks/useDeveloper/index.js.map +1 -0
- package/lib/hooks/usePopWindow/index.d.ts +10 -0
- package/lib/hooks/usePopWindow/index.js +18 -0
- package/lib/hooks/usePopWindow/index.js.map +1 -0
- package/lib/hooks/usePopWindow/src/index.d.ts +15 -0
- package/lib/hooks/usePopWindow/src/index.js +127 -0
- package/lib/hooks/usePopWindow/src/index.js.map +1 -0
- package/lib/hooks/usePopWindow/src/interface/index.d.ts +27 -0
- package/lib/hooks/usePopWindow/src/interface/index.js +3 -0
- package/lib/hooks/usePopWindow/src/interface/index.js.map +1 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +29 -0
- package/lib/index.js.map +1 -0
- package/lib/installer.d.ts +6 -0
- package/lib/installer.js +19 -0
- package/lib/installer.js.map +1 -0
- package/lib/types.d.ts +6 -0
- package/lib/types.js +3 -0
- package/lib/types.js.map +1 -0
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +11 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/install.d.ts +7 -0
- package/lib/utils/install.js +23 -0
- package/lib/utils/install.js.map +1 -0
- package/lib/utils/myDevelop.d.ts +1 -0
- package/lib/utils/myDevelop.js +11 -0
- package/lib/utils/myDevelop.js.map +1 -0
- package/package.json +85 -0
- package/theme-default/button.css +1 -0
- package/theme-default/index.css +1 -0
package/cdn/index.cdn.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var X=Object.defineProperty;var l=(i,t)=>X(i,"name",{value:t,configurable:!0});(function(i,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],t):(i=typeof globalThis!="undefined"?globalThis:i||self,t(i.ZnygFrontendCommon={},i.Vue,i.elementPlus))})(this,function(i,t,O){"use strict";var B=Object.defineProperty,f=l((e,n)=>B(e,"name",{value:n,configurable:!0}),"r$4");const h=f(e=>(e.install=n=>{const o=e;n.component(o.name,o)},e),"withInstall"),j=f((e,n)=>({install:f(o=>{o.directive(n,e)},"install"),directive:e}),"withInstallDirectives"),$={type:{type:String,default:"default"}};var E=t.defineComponent({name:"IButton",__name:"button",props:$,setup(e,{expose:n}){n();const o={};return Object.defineProperty(o,"__isScriptSetup",{enumerable:!1,value:!0}),o}}),S=l((e,n)=>{const o=e.__vccOpts||e;for(const[r,c]of n)o[r]=c;return o},"c"),D=Object.defineProperty,T=l((e,n)=>D(e,"name",{value:n,configurable:!0}),"t");function P(e,n,o,r,c,a){return t.openBlock(),t.createElementBlock("button",{class:t.normalizeClass(["mu-button",e.type])},[t.renderSlot(e.$slots,"default")],2)}l(P,"p$2"),T(P,"_sfc_render");var F=S(E,[["render",P],["__file","button.vue"]]);const y=h(F);var M=Object.defineProperty,k=l((e,n)=>M(e,"name",{value:n,configurable:!0}),"n");const q=[y],g=k(function(e){q.forEach(n=>e.use(n))},"install");var N={install:g},V=Object.defineProperty,A=l((e,n)=>V(e,"name",{value:n,configurable:!0}),"r");function _(){return{num:t.ref(0)}}l(_,"useDeveloper"),A(_,"useDeveloper");var x=Object.defineProperty,d=l((e,n)=>x(e,"name",{value:n,configurable:!0}),"i");let m,s=[];const z=d(()=>document.querySelector("body"),"getBody"),b=d((e,n,o)=>{var r;const c={left:"0",top:"0",width:"100px",height:"100px",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"},a=Object.assign(c,e),v=d(()=>{w(a.id)},"close");w(a.id);let R=a.animate?a.animateInClass:"";const p=t.createVNode("div",{class:"popWindow "+R,style:{width:a.width,height:a.height,left:a.left,top:a.top,position:a.position}},[t.createVNode(O.ElScrollbar,null,{default:d(()=>[e.render?e.render({close:v,option:a}):t.createVNode(n,t.mergeProps({is:n},o,{onClose:d(()=>v(),"onClose")}),null)],"default")})]);p.appContext=m,(r=p.children)!=null&&r.length&&(p.children[0].appContext=m);const u=document.createElement("div");u.id="popwindow_"+Math.ceil(Math.random()*1e6);let C=z();return e.appendParent&&(C=document.getElementById(e.appendParent)),C.appendChild(u),t.render(p,u),t.nextTick(()=>{const U={id:a.id,tag:a.tag,node:u,option:a};s.push(U)}),{id:a.id,close:v}},"showPopWindow"),W=d(e=>{var n;if(!e)return;const{option:o,node:r}=e;if((n=o.onClose)==null||n.call(o),o.animate){const c=r.querySelector(".popWindow");c.className="popWindow "+o.animateOutClass,c.addEventListener("animationend",()=>{t.render(null,r),r.remove(),s.splice(s.indexOf(e),1)})}else t.render(null,r),r.remove(),s.splice(s.indexOf(e),1)},"removePopWindow"),w=d(e=>{const n=s.find(o=>o.id===e);n&&W(n)},"closePopWindowById"),L=d(e=>{s.filter(n=>n.tag===e).forEach(n=>W(n))},"closePopWindowByTag"),Y=d(()=>s,"getAllPopWindows"),Z=d(e=>{const{appContext:n}=e||t.getCurrentInstance()||{};return m=n,{showPopWindow:b}},"initPopWindow");var G=Object.defineProperty,H=l((e,n)=>G(e,"name",{value:n,configurable:!0}),"p");const J=H(e=>{const n=e||t.getCurrentInstance(),{showPopWindow:o}=Z(n);return{showPopWindow:o}},"usePopWindow");var K=Object.defineProperty,Q=l((e,n)=>K(e,"name",{value:n,configurable:!0}),"o");function I(){console.log("developFn")}l(I,"developFn"),Q(I,"developFn"),i.IButton=y,i.closePopWindowById=w,i.closePopWindowByTag=L,i.default=N,i.developFn=I,i.install=g,i.showPopWindow=b,i.useDeveloper=_,i.usePopWindow=J,i.withInstall=h,i.withInstallDirectives=j,Object.defineProperty(i,"__esModule",{value:!0})});
|
|
2
|
+
//# sourceMappingURL=index.cdn.js.map
|
|
@@ -0,0 +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/hooks/usePopWindow/src/index.tsx","../../../packages/hooks/usePopWindow/index.ts","../../../packages/utils/myDevelop.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","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'\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: '100px',\n height: '100px',\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 const option: PopWindowProps = Object.assign(op, props)\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\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 } from './src/index'\nimport { type PopWindowInfoProps, type PopWindowProps } from './src/interface'\n\nexport { showPopWindow, closePopWindowById, closePopWindowByTag }\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","// utils 用例\nexport function developFn() {\n console.log('developFn');\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","appContextConst","popWindowList","getBody","document","querySelector","showPopWindow","props","componentProps","op","left","top","width","height","position","id","Math","ceil","random","animate","animateInClass","animateOutClass","option","Object","assign","close","closePopWindowById","animateClass","vm","_createVNode","ElScrollbar","default","render","_mergeProps","onClose","appContext","children","length","container","createElement","parentEl","appendParent","getElementById","appendChild","nextTick","popWindowInfo","tag","node","push","removePopWindow","popWindowNode","className","addEventListener","remove","splice","indexOf","popWindowItem","find","item","closePopWindowByTag","filter","forEach","getAllPopWindows","initPopW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BgB,EAAAA,EAAmBA,EAAAA,IACvB5D,EADuB4D,oBAInBC,EAAiBC,EAAAA,GAAoC,CAChE,KAAM,CAAE7B,WAAAA,CAAW,EAAI6B,GAAOC,qBAAmB,GAAK,GACtDhE,OAAAA,EAAkBkC,EAEX,CAAE7B,cAAAA,CAAc,CACzB,EAL8B0D,eAAAA,ECzH9B,IAAAxF,EAAA,OAAA,eAAA0F,EAAA5F,EAAA,CAAAwB,EAAA,IAAAtB,EAAAsB,EAAA,OAAA,CAAA,MAAA,EAAA,aAAA,EAAA,CAAA,EAAA,KAOO,MAAMqE,EAAe7F,EAAC0F,GAAc,CACzC,MAAMI,EAAiBJ,GAAQC,EAAAA,qBACzB,CAAE,cAAA3D,CAAc,EAAIyD,EAAcK,CAAc,EACtD,MAAO,CAAE,cAAA9D,CAAc,CACzB,EAJ4B,cAAA,ECNrB,IAAA+D,EAAA,OAAA,eAAAvE,EAAAxB,EAAA,CAAA,EAAA,IAAA+F,EAAA,EAAA,OAAA,CAAA,MAAA,EAAA,aAAA,EAAA,CAAA,EAAA,KAAA,SAASC,GAAY,CAC1B,QAAQ,IAAI,WAAW,CACzB,CAFgBhG,EAAAgG,EAAA,aAAAhG,EAAAgG,EAAA,WAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var $=Object.defineProperty;var a=(e,n)=>$(e,"name",{value:n,configurable:!0});import{defineComponent as j,openBlock as E,createElementBlock as S,normalizeClass as k,renderSlot as D,ref as M,createVNode as u,mergeProps as F,render as m,nextTick as T,getCurrentInstance as g}from"vue";import{ElScrollbar as q}from"element-plus";var A=Object.defineProperty,f=a((e,n)=>A(e,"name",{value:n,configurable:!0}),"r$4");const P=f(e=>(e.install=n=>{const t=e;n.component(t.name,t)},e),"withInstall"),N=f((e,n)=>({install:f(t=>{t.directive(n,e)},"install"),directive:e}),"withInstallDirectives"),z={type:{type:String,default:"default"}};var L=j({name:"IButton",__name:"button",props:z,setup(e,{expose:n}){n();const t={};return Object.defineProperty(t,"__isScriptSetup",{enumerable:!1,value:!0}),t}}),V=a((e,n)=>{const t=e.__vccOpts||e;for(const[i,s]of n)t[i]=s;return t},"c"),G=Object.defineProperty,H=a((e,n)=>G(e,"name",{value:n,configurable:!0}),"t");function _(e,n,t,i,s,o){return E(),S("button",{class:k(["mu-button",e.type])},[D(e.$slots,"default")],2)}a(_,"p$2"),H(_,"_sfc_render");var J=V(L,[["render",_],["__file","button.vue"]]);const b=P(J);var K=Object.defineProperty,Q=a((e,n)=>K(e,"name",{value:n,configurable:!0}),"n");const R=[b],y=Q(function(e){R.forEach(n=>e.use(n))},"install");var U={install:y},X=Object.defineProperty,Y=a((e,n)=>X(e,"name",{value:n,configurable:!0}),"r");function W(){return{num:M(0)}}a(W,"useDeveloper"),Y(W,"useDeveloper");var Z=Object.defineProperty,r=a((e,n)=>Z(e,"name",{value:n,configurable:!0}),"i");let v,l=[];const ee=r(()=>document.querySelector("body"),"getBody"),O=r((e,n,t)=>{var i;const s={left:"0",top:"0",width:"100px",height:"100px",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"},o=Object.assign(s,e),p=r(()=>{w(o.id)},"close");w(o.id);let B=o.animate?o.animateInClass:"";const d=u("div",{class:"popWindow "+B,style:{width:o.width,height:o.height,left:o.left,top:o.top,position:o.position}},[u(q,null,{default:r(()=>[e.render?e.render({close:p,option:o}):u(n,F({is:n},t,{onClose:r(()=>p(),"onClose")}),null)],"default")})]);d.appContext=v,(i=d.children)!=null&&i.length&&(d.children[0].appContext=v);const c=document.createElement("div");c.id="popwindow_"+Math.ceil(Math.random()*1e6);let h=ee();return e.appendParent&&(h=document.getElementById(e.appendParent)),h.appendChild(c),m(d,c),T(()=>{const x={id:o.id,tag:o.tag,node:c,option:o};l.push(x)}),{id:o.id,close:p}},"showPopWindow"),C=r(e=>{var n;if(!e)return;const{option:t,node:i}=e;if((n=t.onClose)==null||n.call(t),t.animate){const s=i.querySelector(".popWindow");s.className="popWindow "+t.animateOutClass,s.addEventListener("animationend",()=>{m(null,i),i.remove(),l.splice(l.indexOf(e),1)})}else m(null,i),i.remove(),l.splice(l.indexOf(e),1)},"removePopWindow"),w=r(e=>{const n=l.find(t=>t.id===e);n&&C(n)},"closePopWindowById"),ne=r(e=>{l.filter(n=>n.tag===e).forEach(n=>C(n))},"closePopWindowByTag"),pe=r(()=>l,"getAllPopWindows"),te=r(e=>{const{appContext:n}=e||g()||{};return v=n,{showPopWindow:O}},"initPopWindow");var oe=Object.defineProperty,ae=a((e,n)=>oe(e,"name",{value:n,configurable:!0}),"p");const ie=ae(e=>{const n=e||g(),{showPopWindow:t}=te(n);return{showPopWindow:t}},"usePopWindow");var re=Object.defineProperty,le=a((e,n)=>re(e,"name",{value:n,configurable:!0}),"o");function I(){console.log("developFn")}a(I,"developFn"),le(I,"developFn");export{b as IButton,w as closePopWindowById,ne as closePopWindowByTag,U as default,I as developFn,y as install,O as showPopWindow,W as useDeveloper,ie as usePopWindow,P as withInstall,N as withInstallDirectives};
|
|
2
|
+
//# sourceMappingURL=index.cdn.mjs.map
|
|
@@ -0,0 +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/hooks/usePopWindow/src/index.tsx","../../../packages/hooks/usePopWindow/index.ts","../../../packages/utils/myDevelop.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","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'\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: '100px',\n height: '100px',\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 const option: PopWindowProps = Object.assign(op, props)\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\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 } from './src/index'\nimport { type PopWindowInfoProps, type PopWindowProps } from './src/interface'\n\nexport { showPopWindow, closePopWindowById, closePopWindowByTag }\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","// utils 用例\nexport function developFn() {\n console.log('developFn');\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","appContextConst","popWindowList","getBody","document","querySelector","showPopWindow","props","componentProps","op","left","top","width","height","position","id","Math","ceil","random","animate","animateInClass","animateOutClass","option","Object","assign","close","closePopWindowById","animateClass","vm","_createVNode","ElScrollbar","default","render","_mergeProps","onClose","appContext","children","length","container","createElement","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","p","usePopWindow","thisAppContext","l","developFn"],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KAAM,CAAE7B,WAAAA,CAAW,EAAI6B,GAAOC,EAAmB,GAAK,GACtDhE,OAAAA,EAAkBkC,EAEX,CAAE7B,cAAAA,CAAc,CACzB,EAL8B0D,eAAAA,ECzH9B,IAAAxF,GAAA,OAAA,eAAA0F,GAAA5F,EAAA,CAAAwB,EAAA,IAAAtB,GAAAsB,EAAA,OAAA,CAAA,MAAA,EAAA,aAAA,EAAA,CAAA,EAAA,KAOO,MAAMqE,GAAe7F,GAAC0F,GAAc,CACzC,MAAMI,EAAiBJ,GAAQC,IACzB,CAAE,cAAA3D,CAAc,EAAIyD,GAAcK,CAAc,EACtD,MAAO,CAAE,cAAA9D,CAAc,CACzB,EAJ4B,cAAA,ECNrB,IAAA+D,GAAA,OAAA,eAAAvE,GAAAxB,EAAA,CAAA,EAAA,IAAA+F,GAAA,EAAA,OAAA,CAAA,MAAA,EAAA,aAAA,EAAA,CAAA,EAAA,KAAA,SAASC,GAAY,CAC1B,QAAQ,IAAI,WAAW,CACzB,CAFgBhG,EAAAgG,EAAA,aAAAhG,GAAAgG,EAAA,WAAA"}
|
package/cdn/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.mu-button{padding:12px;border:1px solid #e3e3e3;border-radius:5px;background-color:#fff}.primary{background:#409eff}.success{background:#67c23a}.error{background:#f56c6c}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_plugin-vue_export-helper.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const IButton: import("../../types").SFCWithInstall<import("vue").DefineComponent<{
|
|
2
|
+
type: {
|
|
3
|
+
type: import("vue").PropType<import("./src/button").Type>;
|
|
4
|
+
default: string;
|
|
5
|
+
};
|
|
6
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
7
|
+
type: {
|
|
8
|
+
type: import("vue").PropType<import("./src/button").Type>;
|
|
9
|
+
default: string;
|
|
10
|
+
};
|
|
11
|
+
}>>, {
|
|
12
|
+
type: import("./src/button").Type;
|
|
13
|
+
}, {}>>;
|
|
14
|
+
export default IButton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../../packages/components/button/index.ts"],"sourcesContent":["import { withInstall } from '../../utils/install';\nimport Button from './src/button.vue';\n\nexport const IButton = withInstall(Button); // 增加类型\n\nexport default IButton;\n"],"names":[],"mappings":";;;AAGa,MAAA,OAAA,GAAU,YAAY,MAAM;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import type button from './button.vue';
|
|
3
|
+
export type Type = 'primary' | 'success' | 'error';
|
|
4
|
+
export declare const ButtonProps: {
|
|
5
|
+
type: {
|
|
6
|
+
type: PropType<Type>;
|
|
7
|
+
default: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export type ButtonPropsType = ExtractPropTypes<typeof ButtonProps>;
|
|
11
|
+
export type ButtonInstanceType = InstanceType<typeof button>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.mjs","sources":["../../../../../../packages/components/button/src/button.ts"],"sourcesContent":["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"],"names":[],"mappings":"AAKO,MAAM,WAAc,GAAA;AAAA,EACzB,IAAM,EAAA;AAAA,IACJ,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,SAAA;AAAA,GACX;AACF;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
type: {
|
|
3
|
+
type: import("vue").PropType<import("./button").Type>;
|
|
4
|
+
default: string;
|
|
5
|
+
};
|
|
6
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
7
|
+
type: {
|
|
8
|
+
type: import("vue").PropType<import("./button").Type>;
|
|
9
|
+
default: string;
|
|
10
|
+
};
|
|
11
|
+
}>>, {
|
|
12
|
+
type: import("./button").Type;
|
|
13
|
+
}, {}>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import _sfc_main from './button.vue2.mjs';
|
|
2
|
+
import { openBlock, createElementBlock, normalizeClass, renderSlot } from 'vue';
|
|
3
|
+
import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.mjs';
|
|
4
|
+
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
8
|
+
return openBlock(), createElementBlock(
|
|
9
|
+
"button",
|
|
10
|
+
{
|
|
11
|
+
class: normalizeClass(["mu-button", _ctx.type])
|
|
12
|
+
},
|
|
13
|
+
[
|
|
14
|
+
renderSlot(_ctx.$slots, "default")
|
|
15
|
+
],
|
|
16
|
+
2
|
|
17
|
+
/* CLASS */
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
__name(_sfc_render, "_sfc_render");
|
|
21
|
+
var Button = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "button.vue"]]);
|
|
22
|
+
|
|
23
|
+
export { Button as default };
|
|
24
|
+
//# sourceMappingURL=button.vue.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.vue.mjs","sources":["../../../../../../packages/components/button/src/button.vue"],"sourcesContent":["<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"],"names":["type","_normalizeClass"],"mappings":";;;;;;SAWe,YAXf,IAAA,EAAA,MAAA,EAWgB,MAAoBA,EAAAA,MAAAA,EAAI,OAAA,QAAA,EAAA;;;;MACpC,OAAaC,cAAA,CAAA,CAAA,WAAA,EAAA,IAAA,CAAA,IAAA,CAAA,CAAA;AAAA,KAAA;AAAA;;;;;;;AADF,MAAA,CAAA,WAAA,EAAA,aAAA,CAAA,CAAA;;;;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineComponent } from 'vue';
|
|
2
|
+
import { ButtonProps } from './button.mjs';
|
|
3
|
+
|
|
4
|
+
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
...{
|
|
6
|
+
name: "IButton"
|
|
7
|
+
},
|
|
8
|
+
__name: "button",
|
|
9
|
+
props: ButtonProps,
|
|
10
|
+
setup(__props, { expose: __expose }) {
|
|
11
|
+
__expose();
|
|
12
|
+
const __returned__ = {};
|
|
13
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
14
|
+
return __returned__;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export { _sfc_main as default };
|
|
19
|
+
//# sourceMappingURL=button.vue2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.vue2.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './button';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
function useDeveloper() {
|
|
6
|
+
const num = ref(0);
|
|
7
|
+
return { num };
|
|
8
|
+
}
|
|
9
|
+
__name(useDeveloper, "useDeveloper");
|
|
10
|
+
|
|
11
|
+
export { useDeveloper };
|
|
12
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../../packages/hooks/useDeveloper/index.ts"],"sourcesContent":["import { ref } from 'vue';\n\nexport function useDeveloper() {\n const num = ref<number>(0);\n return { num };\n}\n"],"names":[],"mappings":";;;;AAEO,SAAS,YAAe,GAAA;AAC7B,EAAM,MAAA,GAAA,GAAM,IAAY,CAAC,CAAA,CAAA;AACzB,EAAA,OAAO,EAAE,GAAI,EAAA,CAAA;AACf,CAAA;AAHgB,MAAA,CAAA,YAAA,EAAA,cAAA,CAAA;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { closePopWindowById, closePopWindowByTag, showPopWindow } from './src/index';
|
|
2
|
+
import { type PopWindowInfoProps, type PopWindowProps } from './src/interface';
|
|
3
|
+
export { showPopWindow, closePopWindowById, closePopWindowByTag };
|
|
4
|
+
export type { PopWindowInfoProps, PopWindowProps };
|
|
5
|
+
export declare const usePopWindow: (ctx?: any) => {
|
|
6
|
+
showPopWindow: (props: PopWindowProps, component?: import("vue").Component, componentProps?: any) => {
|
|
7
|
+
id: string;
|
|
8
|
+
close: () => void;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { getCurrentInstance } from 'vue';
|
|
2
|
+
import { initPopWindow } from './src/index.mjs';
|
|
3
|
+
export { closePopWindowById, closePopWindowByTag, showPopWindow } from './src/index.mjs';
|
|
4
|
+
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
const usePopWindow = /* @__PURE__ */ __name((ctx) => {
|
|
8
|
+
const thisAppContext = ctx || getCurrentInstance();
|
|
9
|
+
const { showPopWindow: showPopWindow2 } = initPopWindow(thisAppContext);
|
|
10
|
+
return { showPopWindow: showPopWindow2 };
|
|
11
|
+
}, "usePopWindow");
|
|
12
|
+
|
|
13
|
+
export { usePopWindow };
|
|
14
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../../packages/hooks/usePopWindow/index.ts"],"sourcesContent":["import { type ComponentInternalInstance, getCurrentInstance } from 'vue'\n\nimport { closePopWindowById, closePopWindowByTag, initPopWindow, showPopWindow } from './src/index'\nimport { type PopWindowInfoProps, type PopWindowProps } from './src/interface'\n\nexport { showPopWindow, closePopWindowById, closePopWindowByTag }\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":["showPopWindow"],"mappings":";;;;;;AAOa,MAAA,YAAA,2BAAgB,GAAc,KAAA;AACzC,EAAM,MAAA,cAAA,GAAiB,OAAQ,kBAAmB,EAAA,CAAA;AAClD,EAAA,MAAM,EAAE,aAAA,EAAAA,cAAc,EAAA,GAAI,cAAc,cAAc,CAAA,CAAA;AACtD,EAAO,OAAA,EAAE,eAAAA,cAAc,EAAA,CAAA;AACzB,CAJ4B,EAAA,cAAA;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Component, type ComponentInternalInstance } from 'vue';
|
|
2
|
+
import { type PopWindowInfoProps, type PopWindowProps } from './interface';
|
|
3
|
+
export declare const showPopWindow: (props: PopWindowProps, component?: Component, componentProps?: any) => {
|
|
4
|
+
id: string;
|
|
5
|
+
close: () => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const closePopWindowById: (id: string) => void;
|
|
8
|
+
export declare const closePopWindowByTag: (tag: string) => void;
|
|
9
|
+
export declare const getAllPopWindows: () => PopWindowInfoProps[];
|
|
10
|
+
export declare const initPopWindow: (ctx?: ComponentInternalInstance) => {
|
|
11
|
+
showPopWindow: (props: PopWindowProps, component?: Component, componentProps?: any) => {
|
|
12
|
+
id: string;
|
|
13
|
+
close: () => void;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { createVNode, mergeProps, render, nextTick, getCurrentInstance } from 'vue';
|
|
2
|
+
import { ElScrollbar } from 'element-plus';
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
let appContextConst;
|
|
7
|
+
let popWindowList = [];
|
|
8
|
+
const getBody = /* @__PURE__ */ __name(() => {
|
|
9
|
+
return document.querySelector("body");
|
|
10
|
+
}, "getBody");
|
|
11
|
+
const showPopWindow = /* @__PURE__ */ __name((props, component, componentProps) => {
|
|
12
|
+
var _a;
|
|
13
|
+
const op = {
|
|
14
|
+
left: "0",
|
|
15
|
+
top: "0",
|
|
16
|
+
width: "100px",
|
|
17
|
+
height: "100px",
|
|
18
|
+
position: "absolute",
|
|
19
|
+
id: "popwindow_" + Math.ceil(Math.random() * 1e6),
|
|
20
|
+
animate: false,
|
|
21
|
+
animateInClass: "animate__animated animate__faster animate__fadeIn",
|
|
22
|
+
animateOutClass: "animate__animated animate__faster animate__fadeOut"
|
|
23
|
+
};
|
|
24
|
+
const option = Object.assign(op, props);
|
|
25
|
+
const close = /* @__PURE__ */ __name(() => {
|
|
26
|
+
closePopWindowById(option.id);
|
|
27
|
+
}, "close");
|
|
28
|
+
closePopWindowById(option.id);
|
|
29
|
+
let animateClass = option.animate ? option.animateInClass : "";
|
|
30
|
+
const vm = createVNode("div", {
|
|
31
|
+
"class": "popWindow " + animateClass,
|
|
32
|
+
"style": {
|
|
33
|
+
width: option.width,
|
|
34
|
+
height: option.height,
|
|
35
|
+
left: option.left,
|
|
36
|
+
top: option.top,
|
|
37
|
+
position: option.position
|
|
38
|
+
}
|
|
39
|
+
}, [createVNode(ElScrollbar, null, {
|
|
40
|
+
default: /* @__PURE__ */ __name(() => [props.render ? props.render({
|
|
41
|
+
close,
|
|
42
|
+
option
|
|
43
|
+
}) : createVNode(component, mergeProps({
|
|
44
|
+
"is": component
|
|
45
|
+
}, componentProps, {
|
|
46
|
+
"onClose": /* @__PURE__ */ __name(() => close(), "onClose")
|
|
47
|
+
}), null)], "default")
|
|
48
|
+
})]);
|
|
49
|
+
vm.appContext = appContextConst;
|
|
50
|
+
if ((_a = vm.children) == null ? void 0 : _a.length) {
|
|
51
|
+
vm.children[0].appContext = appContextConst;
|
|
52
|
+
}
|
|
53
|
+
const container = document.createElement("div");
|
|
54
|
+
container.id = "popwindow_" + Math.ceil(Math.random() * 1e6);
|
|
55
|
+
let parentEl = getBody();
|
|
56
|
+
if (props.appendParent) {
|
|
57
|
+
parentEl = document.getElementById(props.appendParent);
|
|
58
|
+
}
|
|
59
|
+
parentEl.appendChild(container);
|
|
60
|
+
render(vm, container);
|
|
61
|
+
nextTick(() => {
|
|
62
|
+
const popWindowInfo = {
|
|
63
|
+
id: option.id,
|
|
64
|
+
tag: option.tag,
|
|
65
|
+
node: container,
|
|
66
|
+
option
|
|
67
|
+
};
|
|
68
|
+
popWindowList.push(popWindowInfo);
|
|
69
|
+
});
|
|
70
|
+
return {
|
|
71
|
+
id: option.id,
|
|
72
|
+
close
|
|
73
|
+
};
|
|
74
|
+
}, "showPopWindow");
|
|
75
|
+
const removePopWindow = /* @__PURE__ */ __name((popWindowInfo) => {
|
|
76
|
+
var _a;
|
|
77
|
+
if (!popWindowInfo) return;
|
|
78
|
+
const {
|
|
79
|
+
option,
|
|
80
|
+
node
|
|
81
|
+
} = popWindowInfo;
|
|
82
|
+
(_a = option.onClose) == null ? void 0 : _a.call(option);
|
|
83
|
+
if (option.animate) {
|
|
84
|
+
const popWindowNode = node.querySelector(".popWindow");
|
|
85
|
+
popWindowNode.className = "popWindow " + option.animateOutClass;
|
|
86
|
+
popWindowNode.addEventListener("animationend", () => {
|
|
87
|
+
render(null, node);
|
|
88
|
+
node.remove();
|
|
89
|
+
popWindowList.splice(popWindowList.indexOf(popWindowInfo), 1);
|
|
90
|
+
});
|
|
91
|
+
} else {
|
|
92
|
+
render(null, node);
|
|
93
|
+
node.remove();
|
|
94
|
+
popWindowList.splice(popWindowList.indexOf(popWindowInfo), 1);
|
|
95
|
+
}
|
|
96
|
+
}, "removePopWindow");
|
|
97
|
+
const closePopWindowById = /* @__PURE__ */ __name((id) => {
|
|
98
|
+
const popWindowItem = popWindowList.find((item) => item.id === id);
|
|
99
|
+
if (popWindowItem) {
|
|
100
|
+
removePopWindow(popWindowItem);
|
|
101
|
+
}
|
|
102
|
+
}, "closePopWindowById");
|
|
103
|
+
const closePopWindowByTag = /* @__PURE__ */ __name((tag) => {
|
|
104
|
+
const popWindows = popWindowList.filter((item) => item.tag === tag);
|
|
105
|
+
popWindows.forEach((item) => removePopWindow(item));
|
|
106
|
+
}, "closePopWindowByTag");
|
|
107
|
+
const getAllPopWindows = /* @__PURE__ */ __name(() => {
|
|
108
|
+
return popWindowList;
|
|
109
|
+
}, "getAllPopWindows");
|
|
110
|
+
const initPopWindow = /* @__PURE__ */ __name((ctx) => {
|
|
111
|
+
const {
|
|
112
|
+
appContext
|
|
113
|
+
} = ctx || getCurrentInstance() || {};
|
|
114
|
+
appContextConst = appContext;
|
|
115
|
+
return {
|
|
116
|
+
showPopWindow
|
|
117
|
+
};
|
|
118
|
+
}, "initPopWindow");
|
|
119
|
+
|
|
120
|
+
export { closePopWindowById, closePopWindowByTag, getAllPopWindows, initPopWindow, showPopWindow };
|
|
121
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../../../packages/hooks/usePopWindow/src/index.tsx"],"sourcesContent":["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'\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: '100px',\n height: '100px',\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 const option: PopWindowProps = Object.assign(op, props)\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\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"],"names":["appContextConst","popWindowList","getBody","document","querySelector","showPopWindow","props","component","componentProps","op","left","top","width","height","position","id","Math","ceil","random","animate","animateInClass","animateOutClass","option","Object","assign","close","closePopWindowById","animateClass","vm","_createVNode","ElScrollbar","default","render","_mergeProps","onClose","appContext","children","length","container","createElement","parentEl","appendParent","getElementById","appendChild","nextTick","popWindowInfo","tag","node","push","removePopWindow","popWindowNode","className","addEventListener","remove","splice","indexOf","popWindowItem","find","item","closePopWindowByTag","popWindows","filter","forEach","getAllPopWindows","initPopWindow","ctx","getCurrentInstance"],"mappings":";;;;;AAKA,IAAIA,eAAAA,CAAAA;AACJ,IAAIC,gBAA4B,EAAE,CAAA;AAClC,MAAMC,0BAAyB,MAAA,CAAA,MAAA;AAC7B,EAAOC,OAAAA,QAAAA,CAASC,cAAc,MAAM,CAAA,CAAA;AACtC,CAFgBF,EAAAA,SAAAA,CAAAA,CAAAA;AAaT,MAAMG,aAAgBA,mBAAAA,MAAAA,CAAAA,CAACC,KAAuBC,EAAAA,SAAAA,EAAuBC,cAAyB,KAAA;;AACnG,EAAA,MAAMC,EAAK,GAAA;AAAA,IACTC,IAAM,EAAA,GAAA;AAAA,IACNC,GAAK,EAAA,GAAA;AAAA,IACLC,KAAO,EAAA,OAAA;AAAA,IACPC,MAAQ,EAAA,OAAA;AAAA,IACRC,QAAU,EAAA,UAAA;AAAA,IACVC,IAAI,YAAeC,GAAAA,IAAAA,CAAKC,KAAKD,IAAKE,CAAAA,MAAAA,KAAW,GAAO,CAAA;AAAA,IACpDC,OAAS,EAAA,KAAA;AAAA,IACTC,cAAgB,EAAA,mDAAA;AAAA,IAChBC,eAAiB,EAAA,oDAAA;AAAA,GACnB,CAAA;AACA,EAAA,MAAMC,MAAyBC,GAAAA,MAAAA,CAAOC,MAAOf,CAAAA,EAAAA,EAAIH,KAAK,CAAA,CAAA;AACtD,EAAA,MAAMmB,wBAAc,MAAA,CAAA,MAAA;AAClBC,IAAAA,kBAAAA,CAAmBJ,OAAOP,EAAE,CAAA,CAAA;AAAA,GADhBU,EAAAA,OAAAA,CAAAA,CAAAA;AAKdC,EAAAA,kBAAAA,CAAmBJ,OAAOP,EAAE,CAAA,CAAA;AAC5B,EAAA,IAAIY,YAA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GAAA,KAAA;AAClD,EAAA,MAAMC,aAAa3D,aAAc4D,CAAAA,MAAAA,CAAQH,CAASA,IAAAA,KAAAA,IAAAA,CAAKZ,QAAQA,GAAG,CAAA,CAAA;AAClEc,EAAAA,UAAAA,CAAWE,OAASJ,CAAAA,CAAAA,IAAAA,KAAST,eAAgBS,CAAAA,IAAI,CAAC,CAAA,CAAA;AACpD,CAHoCZ,EAAAA,qBAAAA,EAAAA;AAU7B,MAAMiB,mCAA+C,MAAA,CAAA,MAAA;AAC1D,EAAO9D,OAAAA,aAAAA,CAAAA;AACT,CAFgC8D,EAAAA,kBAAAA,EAAAA;AAIzB,MAAMC,gCAAqD,MAAA,CAAA,CAAA,GAAA,KAAA;AAChE,EAAM,MAAA;AAAA,IAAE7B,UAAAA;AAAAA,GAAe8B,GAAAA,GAAAA,IAAOC,kBAAmB,EAAA,IAAK,EAAC,CAAA;AACvDlE,EAAkBmC,eAAAA,GAAAA,UAAAA,CAAAA;AAElB,EAAO,OAAA;AAAA,IAAE9B,aAAAA;AAAAA,GAAc,CAAA;AACzB,CAL8B4D,EAAAA,eAAAA;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { VNode } from 'vue';
|
|
2
|
+
export interface PopWindowProps {
|
|
3
|
+
left?: string;
|
|
4
|
+
top?: string;
|
|
5
|
+
width: string;
|
|
6
|
+
height: string;
|
|
7
|
+
position?: 'absolute' | 'relative';
|
|
8
|
+
id?: string;
|
|
9
|
+
tag?: string;
|
|
10
|
+
appendParent?: string;
|
|
11
|
+
animate?: boolean;
|
|
12
|
+
animateInClass?: string;
|
|
13
|
+
animateOutClass?: string;
|
|
14
|
+
onClose?: () => void;
|
|
15
|
+
render?: (scope: PopWindowRenderScope) => VNode;
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}
|
|
18
|
+
export interface PopWindowInfoProps {
|
|
19
|
+
id: string;
|
|
20
|
+
tag?: string;
|
|
21
|
+
node: any;
|
|
22
|
+
option: PopWindowProps;
|
|
23
|
+
}
|
|
24
|
+
export interface PopWindowRenderScope {
|
|
25
|
+
close: () => void;
|
|
26
|
+
option: PopWindowProps;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/es/index.d.ts
ADDED
package/es/index.mjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import installer from './installer.mjs';
|
|
2
|
+
export { install } from './installer.mjs';
|
|
3
|
+
import './components/index.mjs';
|
|
4
|
+
import './hooks/index.mjs';
|
|
5
|
+
import './utils/index.mjs';
|
|
6
|
+
export { IButton } from './components/button/index.mjs';
|
|
7
|
+
export { useDeveloper } from './hooks/useDeveloper/index.mjs';
|
|
8
|
+
export { closePopWindowById, closePopWindowByTag, showPopWindow } from './hooks/usePopWindow/src/index.mjs';
|
|
9
|
+
export { usePopWindow } from './hooks/usePopWindow/index.mjs';
|
|
10
|
+
export { withInstall, withInstallDirectives } from './utils/install.mjs';
|
|
11
|
+
export { developFn } from './utils/myDevelop.mjs';
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export { installer as default };
|
|
16
|
+
//# sourceMappingURL=index.mjs.map
|
package/es/index.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
|
package/es/installer.mjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IButton } from './components/button/index.mjs';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
const component = [IButton];
|
|
6
|
+
const install = /* @__PURE__ */ __name(function(app) {
|
|
7
|
+
component.forEach((i) => app.use(i));
|
|
8
|
+
}, "install");
|
|
9
|
+
var installer = {
|
|
10
|
+
install
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { installer as default, install };
|
|
14
|
+
//# sourceMappingURL=installer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installer.mjs","sources":["../../../packages/installer.ts"],"sourcesContent":["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"],"names":[],"mappings":";;;;AAIA,MAAM,SAAA,GAAY,CAAC,OAAO,CAAA,CAAA;AAEb,MAAA,OAAA,mCAAoB,GAAU,EAAA;AACzC,EAAA,SAAA,CAAU,QAAQ,CAAC,CAAA,KAAM,GAAI,CAAA,GAAA,CAAI,CAAC,CAAC,CAAA,CAAA;AACrC,CAFuB,EAAA,SAAA,EAAA;AAIvB,gBAAe;AAAA,EACb,OAAA;AACF,CAAA;;;;"}
|
package/es/types.d.ts
ADDED
package/es/types.mjs
ADDED
package/es/types.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { App, Directive } from 'vue';
|
|
2
|
+
import type { SFCWithInstall } from '../types';
|
|
3
|
+
export declare const withInstall: <T>(main: T) => SFCWithInstall<T>;
|
|
4
|
+
export declare const withInstallDirectives: <T extends Directive>(main: T, name: string) => {
|
|
5
|
+
install: (app: App) => void;
|
|
6
|
+
directive: T;
|
|
7
|
+
};
|