@ibiz-template/vue3-components 0.5.7-alpha.0 → 0.5.7-alpha.1

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.
@@ -1 +1 @@
1
- System.register(["vue","@ibiz-template/vue3-util","qx-util","cherry-markdown","@ibiz-template/core"],(function(e){"use strict";var t,a,o,l,r,n,i,s,u,c,d,h,v,m,b;return{setters:[function(e){t=e.defineComponent,a=e.ref,o=e.watch,l=e.onMounted,r=e.onUnmounted,n=e.createVNode,i=e.nextTick},function(e){s=e.getMarkDownProps,u=e.getEditorEmits,c=e.useNamespace,d=e.useUIStore},function(e){h=e.createUUID,v=e.getCookie},function(e){m=e.default},function(e){b=e.CoreConst}],execute:function(){e("default",t({name:"IBizMarkDown",props:s(),emits:u(),setup(e,{emit:t}){const n=c("markdown"),s=e.controller,u=a(""),f=a(null),g=h(),p=a({Authorization:"Bearer ".concat(v(b.TOKEN))}),w=a(""),k=a(""),{UIStore:y}=d(),x=a(y.theme),C=a("editOnly");let U=null,z=0;const M=a({});o((()=>e.data),(e=>{if(e&&s){const t=s.calcBaseUrl(e);w.value=t.uploadUrl,k.value=t.downloadUrl}}),{immediate:!0,deep:!0});const B=a(),O=(e,t)=>{const a=new FormData;a.append("file",e),ibiz.net.axios({url:w.value,method:"post",headers:p.value,data:a}).then((e=>{if(200===e.status&&e.data.fileid){const a=k.value.replace("%fileId%",e.data.fileid);t(a)}})).catch((e=>{ibiz.log.error("上传出错",e)}))},D=()=>{var e;return null==(e=f.value)?void 0:e.getMarkdown()},I=e=>{var t;null==(t=f.value)||t.setMarkdown(e,!1)};o((()=>e.value),((e,t)=>{e!==t&&(u.value=e||"")}),{immediate:!0}),o(u,((e,t)=>{const a=D();e!==t&&a!==e&&I(e)}));const V=e=>{t("change",D())},R=(e,t)=>({[e]:t});o((()=>y.theme),(e=>{var t;x.value=e,null==(t=f.value)||t.setTheme(x.value)}));return l((()=>{e.disabled&&(C.value="previewOnly"),i((()=>{f.value=new m({id:g,value:u.value,theme:x.value,fileUpload:O,emoji:{useUnicode:!0},header:{anchorStyle:"autonumber"},editor:{height:"100%",defaultModel:C.value,codemirror:{autofocus:!1}},toolbars:{theme:x.value,toolbar:["bold","italic","underline","strikethrough","|","color","header","|","list","image",{insert:["link","hr","br","code","formula","toc","table","line-table","bar-table"]},"settings","togglePreview"],bubble:["bold","italic","underline","strikethrough","sub","sup","|","size","color"],float:["h1","h2","h3","|","checklist","quote","quickTable","code"],customMenu:[],sidebar:[]},callback:{afterChange:V,beforeImageMounted:R}})})),(()=>{if(window.ResizeObserver&&B.value){const e={width:"".concat(B.value.offsetWidth,"px")};s&&"number"==typeof s.parent.model.height&&Object.assign(e,{height:"".concat(s.parent.model.height,"px")}),M.value=n.cssVarBlock(e),U=new ResizeObserver((e=>{const t=e[0].contentRect.width;if(t!==z){const a={width:"".concat(e[0].contentRect.width,"px")};s&&"number"==typeof s.parent.model.height&&Object.assign(a,{height:"".concat(s.parent.model.height,"px")}),M.value=n.cssVarBlock(a),z=t}})),U.observe(B.value)}})()})),r((()=>{f.value=null})),{ns:n,currentVal:u,id:g,editor:f,markDownBox:B,headers:p,theme:x,defaultModel:C,cssVars:M,getCherryHtml:()=>{var e;return null==(e=f.value)?void 0:e.getHtml()},getCherryContent:D,setCherryContent:I}},render(){return n("div",{ref:"markDownBox",class:[this.ns.b(),this.ns.is("disabled",this.disabled)]},[n("div",{id:this.id,style:this.cssVars,class:this.ns.b("cherry")},null)])}}))}}}));
1
+ System.register(["vue","@ibiz-template/vue3-util","qx-util","cherry-markdown","@ibiz-template/core"],(function(e){"use strict";var t,a,o,n,l,r,i,s,u,c,d,h,v,m,b;return{setters:[function(e){t=e.defineComponent,a=e.ref,o=e.watch,n=e.onMounted,l=e.onUnmounted,r=e.createVNode,i=e.nextTick},function(e){s=e.getMarkDownProps,u=e.getEditorEmits,c=e.useNamespace,d=e.useUIStore},function(e){h=e.createUUID,v=e.getCookie},function(e){m=e.default},function(e){b=e.CoreConst}],execute:function(){e("default",t({name:"IBizMarkDown",props:s(),emits:u(),setup(e,{emit:t}){const r=c("markdown"),s=e.controller,u=a(""),f=a(null),g=h(),p=a({Authorization:"Bearer ".concat(v(b.TOKEN))}),w=a(""),k=a(""),{UIStore:y}=d(),x=a(y.theme),C=a("editOnly");let U=null,z=0;const M=a({});o((()=>e.data),(e=>{if(e&&s){const t=s.calcBaseUrl(e);w.value=t.uploadUrl,k.value=t.downloadUrl}}),{immediate:!0,deep:!0});const B=a(),O=(e,t)=>{const a=new FormData;a.append("file",e),ibiz.net.axios({url:w.value,method:"post",headers:p.value,data:a}).then((e=>{if(200===e.status&&e.data.fileid){const a=k.value.replace("%fileId%",e.data.fileid);t(a)}})).catch((e=>{ibiz.log.error("上传出错",e)}))},D=()=>{var e;return null==(e=f.value)?void 0:e.getMarkdown()},I=e=>{var t;null==(t=f.value)||t.setMarkdown(e,!1)};o((()=>e.value),((e,t)=>{e!==t&&(u.value=e||"")}),{immediate:!0}),o(u,((e,t)=>{const a=D();e!==t&&a!==e&&I(e)}));const V=e=>{t("change",D())},R=(e,t)=>({[e]:t});o((()=>y.theme),(e=>{var t;x.value=e,null==(t=f.value)||t.setTheme(x.value)}));return n((()=>{e.disabled&&(C.value="previewOnly"),i((()=>{f.value=new m({id:g,value:u.value,theme:x.value,fileUpload:O,emoji:{useUnicode:!0},header:{anchorStyle:"autonumber"},editor:{height:"100%",defaultModel:C.value,codemirror:{autofocus:!1}},toolbars:{theme:x.value,toolbar:["bold","italic","underline","strikethrough","|","color","header","|","list","image",{insert:["link","hr","br","code","formula","toc","table","line-table","bar-table"]},"settings","togglePreview"],bubble:["bold","italic","underline","strikethrough","sub","sup","|","size","color"],float:["h1","h2","h3","|","checklist","quote","quickTable","code"],customMenu:[],sidebar:[]},callback:{afterChange:V,beforeImageMounted:R}})})),(()=>{if(window.ResizeObserver&&B.value){const e={width:"".concat(B.value.offsetWidth,"px")};s&&"number"==typeof s.parent.model.height&&Object.assign(e,{height:"".concat(s.parent.model.height,"px")}),M.value=r.cssVarBlock(e),U=new ResizeObserver((e=>{const t=e[0].contentRect.width;if(t!==z){const a={width:"".concat(e[0].contentRect.width,"px")};s&&"number"==typeof s.parent.model.height&&Object.assign(a,{height:"".concat(s.parent.model.height,"px")}),M.value=r.cssVarBlock(a),z=t}})),U.observe(B.value)}})()})),l((()=>{f.value=null,U&&U.disconnect()})),{ns:r,currentVal:u,id:g,editor:f,markDownBox:B,headers:p,theme:x,defaultModel:C,cssVars:M,getCherryHtml:()=>{var e;return null==(e=f.value)?void 0:e.getHtml()},getCherryContent:D,setCherryContent:I}},render(){return r("div",{ref:"markDownBox",class:[this.ns.b(),this.ns.is("disabled",this.disabled)]},[r("div",{id:this.id,style:this.cssVars,class:this.ns.b("cherry")},null)])}}))}}}));