@ibiz-template/vue3-components 0.7.41-alpha.61 → 0.7.41-alpha.62
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/dist/ibiz-markdown-editor-D-5gnej5.js +1 -0
- package/dist/{index-B3bLnxuY.js → index-DFk7mzuZ.js} +2 -2
- package/dist/index.min.css +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/{wang-editor-CA-ztFOO.js → wang-editor-BdJ2v_6e.js} +1 -1
- package/dist/{xlsx-util-CrgXlRhs.js → xlsx-util-C4If0XV-.js} +1 -1
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.css +1 -1
- package/es/control/tree/tree.css +1 -1
- package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.mjs +4 -1
- package/es/editor/markdown/ibiz-markdown-editor/render-util.mjs +9 -0
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.css +1 -1
- package/lib/control/tree/tree.css +1 -1
- package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.cjs +4 -1
- package/lib/editor/markdown/ibiz-markdown-editor/render-util.cjs +9 -0
- package/package.json +5 -5
- package/dist/ibiz-markdown-editor-uRNoNVHw.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
System.register(["vue","@ibiz-template/vue3-util","qx-util","cherry-markdown"],function(e){"use strict";var t,n,i,l,o,a,r,s,c,d,u,m,h,v,p;return{setters:[function(e){t=e.nextTick,n=e.ref,i=e.onBeforeUnmount,l=e.createVNode,o=e.resolveComponent,a=e.defineComponent,r=e.watch,s=e.onMounted,c=e.onUnmounted},function(e){d=e.useUIStore,u=e.getEditorEmits,m=e.getMarkDownProps,h=e.useNamespace},function(e){v=e.createUUID},function(e){p=e.default}],execute:function(){function f(e,t){return!(!e||1!==e.nodeType||e.nodeName!==t)}function b(e){const a=n(""),r=n([]),s=n(),c=n(!1);let d=null;const u=async e=>{var n;if(c.value=!0,a.value=e,r.value=[e],await t(),s.value){const{container:e}=s.value.$refs;e&&(null==(n=e.children[0])||n.click())}},m=e=>{"Escape"!==e.key&&27!==e.keyCode||(e.stopPropagation(),e.preventDefault(),r.value=[],c.value=!1,v())},h=async()=>{var e;await t();const n=null==(e=s.value)?void 0:e.$refs.container;if(!n)return;const i=n.querySelector(".el-image-viewer__wrapper");null==i||i.addEventListener("keydown",m)},v=()=>{var e;const t=null==(e=s.value)?void 0:e.$refs.container;if(!t)return;const n=t.querySelector(".el-image-viewer__wrapper");null==n||n.removeEventListener("keydown",m)},p=e=>{const t=null==e?void 0:e.target;if(f(t,"IMG")&&t)return void u(t.src);const n=function(e){let t=e;for(;t;){if(t.classList.contains("cherry-previewer"))return null;const e=t.parentElement;if(f(t,"svg")&&e&&"mermaid"===e.dataset.type)return t;t=t.parentElement}return null}(t);n&&u(function(e){const t=e.cloneNode(!0),n=e.width.baseVal.value||e.clientWidth,i=e.height.baseVal.value||e.clientHeight;t.setAttribute("width",n),t.setAttribute("height",i),t.style.backgroundColor="white";const l=(new XMLSerializer).serializeToString(t),o=btoa(unescape(encodeURIComponent(l)));return"data:image/svg+xml;base64,".concat(o)}(n))},b=()=>{r.value=[],c.value=!1};return i(()=>{d&&(d.removeEventListener("click",p),d=null),v()}),{isImgPreview:c,renderImgPreview:()=>l(o("el-image"),{class:e.e("img-preview"),ref:s,"zoom-rate":1.1,src:a.value,"preview-src-list":r.value,"hide-on-click-modal":!0,onShow:h,onClose:b,fit:"cover"},null),onMDEditorCreated:e=>{var t,n;d=(null==(n=null==(t=null==e?void 0:e.previewer)?void 0:t.previewerBubble)?void 0:n.previewerDom)||null,null==d||d.addEventListener("click",p)}}}e("default",a({name:"IBizMarkDown",props:m(),emits:u(),setup(e,{emit:o,slots:a}){var u,m,f,g,w,C;const k=h("markdown"),y=e.controller,x=n("");let I=null;const z=v(),{isImgPreview:M,onMDEditorCreated:P,renderImgPreview:E}=b(k),A=ibiz.util.file.getUploadHeaders(),D=n({...A}),S=n(""),U=(null==(u=null==y?void 0:y.editorParams)?void 0:u.customTheme)||(null==(m=null==y?void 0:y.editorParams)?void 0:m.customtheme),T="true"===(null==(f=null==y?void 0:y.editorParams)?void 0:f.enablenoaccess),{UIStore:B}=d(),L=n(U||B.theme),O=n(!1);let N="default";y&&(null==(g=y.editorParams)?void 0:g.showmode)&&(N=y.editorParams.showmode);const V=n(!1),R=n("editOnly");let H=null,q=null,F=0;const $=n({}),_=n({}),j=n("pure");let W=!1,J=!1;(null==(w=null==y?void 0:y.editorParams)?void 0:w.disabledirectory)&&(J="true"===y.editorParams.disabledirectory);let Y="absolute";(null==(C=null==y?void 0:y.editorParams)?void 0:C.tocpos)&&(Y="fixed"===y.editorParams.tocpos?"fixed":"absolute");const[G,X]=function(e,n){const{props:i,isEditing:l,currentVal:o,emit:a}=n;let r=n.chatInstance;return[p.createMenuHook("AI",{icon:{type:"svg",content:"<svg\n viewBox='0 0 16 16'\n xmlns='http://www.w3.org/2000/svg'\n fill='currentColor'\n height='1em'\n width='1em'\n preserveAspectRatio='xMidYMid meet'\n focusable='false'\n >\n <g\n id='aae1.Base基础/1.icon图标/2.normal/ai-star'\n stroke-width='1'\n fill-rule='evenodd'\n >\n <path\n d='M5.817 1.53l3.158 8.797h.054v.152l1.443 4.021-1.402.001-1.041-2.982H2.495l-1.03 2.982L0 14.5 4.671 1.533l1.146-.003zm7.86 5.424V14.5h-1.213V6.954h1.212zM5.248 3.549l-2.342 6.778h4.706L5.249 3.55zM13.046 0c.075 0 .147.02.204.071a.318.318 0 01.094.181l.064.273c.097.417.17.727.255.968.084.24.177.4.31.523.134.124.318.218.599.306.281.088.65.166 1.15.265a.358.358 0 01.195.095c.056.057.083.13.083.213a.289.289 0 01-.083.21.362.362 0 01-.197.094c-.528.093-.918.167-1.214.255-.295.088-.485.187-.621.324-.137.138-.23.324-.31.606-.08.283-.145.651-.23 1.147a.329.329 0 01-.093.184.293.293 0 01-.206.075.308.308 0 01-.207-.072.322.322 0 01-.1-.188l-.006-.033c-.085-.486-.149-.845-.228-1.12-.079-.274-.17-.452-.305-.585-.135-.133-.323-.23-.618-.32s-.683-.168-1.21-.273a.353.353 0 01-.2-.096.29.29 0 01-.08-.208c0-.079.023-.153.079-.211a.35.35 0 01.2-.097c.5-.098.869-.176 1.15-.263.282-.087.465-.18.597-.302.132-.12.224-.278.306-.511.082-.236.151-.539.244-.947l.071-.312a.312.312 0 01.102-.183.311.311 0 01.205-.069z'\n id='aae形状结合'\n ></path>\n </g>\n </svg>\n "},onClick:(n,i,l)=>{l.stopPropagation(),l.preventDefault(),t(()=>{var t;if(null==(t=e.mdeditor)?void 0:t.bubble){e.mdeditor.bubble.showBubble();const t=e.mdeditor.bubble.bubbleDom.getBoundingClientRect();if(!t||!t.left||!t.top)return;const n=ibiz.inLineAIUtil.calcContextMenus(e.deACMode,t=>{e.doInLineAIUIAction(t,e.model.appId)});if(0===n.length)return;const{zIndex:i}=d(),l=i.increment();ibiz.inLineAIUtil.showContextMenus(t.left,t.top+43,n,{zIndex:l,onClose:()=>{i.decrement()}})}})}}),p.createMenuHook("AIChart",{icon:{type:"svg",content:"<svg\n viewBox='0 0 16 16'\n xmlns='http://www.w3.org/2000/svg'\n fill='currentColor'\n height='1em'\n width='1em'\n preserveAspectRatio='xMidYMid meet'\n focusable='false'\n >\n <g\n id='aae1.Base基础/1.icon图标/2.normal/ai-star'\n stroke-width='1'\n fill-rule='evenodd'\n >\n <path\n d='M5.817 1.53l3.158 8.797h.054v.152l1.443 4.021-1.402.001-1.041-2.982H2.495l-1.03 2.982L0 14.5 4.671 1.533l1.146-.003zm7.86 5.424V14.5h-1.213V6.954h1.212zM5.248 3.549l-2.342 6.778h4.706L5.249 3.55zM13.046 0c.075 0 .147.02.204.071a.318.318 0 01.094.181l.064.273c.097.417.17.727.255.968.084.24.177.4.31.523.134.124.318.218.599.306.281.088.65.166 1.15.265a.358.358 0 01.195.095c.056.057.083.13.083.213a.289.289 0 01-.083.21.362.362 0 01-.197.094c-.528.093-.918.167-1.214.255-.295.088-.485.187-.621.324-.137.138-.23.324-.31.606-.08.283-.145.651-.23 1.147a.329.329 0 01-.093.184.293.293 0 01-.206.075.308.308 0 01-.207-.072.322.322 0 01-.1-.188l-.006-.033c-.085-.486-.149-.845-.228-1.12-.079-.274-.17-.452-.305-.585-.135-.133-.323-.23-.618-.32s-.683-.168-1.21-.273a.353.353 0 01-.2-.096.29.29 0 01-.08-.208c0-.079.023-.153.079-.211a.35.35 0 01.2-.097c.5-.098.869-.176 1.15-.263.282-.087.465-.18.597-.302.132-.12.224-.278.306-.511.082-.236.151-.539.244-.947l.071-.312a.312.312 0 01.102-.183.311.311 0 01.205-.069z'\n id='aae形状结合'\n ></path>\n </g>\n </svg>\n "},onClick:async()=>{const t=e.model.appDataEntityId;if(!t||!e.deACMode)return;const{zIndex:n}=d(),s=n.increment();r=await ibiz.aiChatUtil.getAIChat();const{containerOptions:c,chatOptions:u}=await ibiz.aiChatUtil.getEditorExAIChatParams(e.editorParams,e.context,e.params,i.data,e.deACMode,{chatInstance:r,view:e.view,ctrl:e.ctrl}),m=await ibiz.aiChatUtil.getAIResourceOptions(e.context,e.params);r.create({resourceOptions:m,containerOptions:{zIndex:s,...c},chatOptions:{caption:e.deACMode.logicName,context:{...e.context},params:{...e.params,srfactag:e.deACMode.codeName},appDataEntityId:t,...u,action:(e,t)=>{"backfill"===e&&(l.value?o.value=t.realcontent||"":a("change",t.realcontent))}}})}})]}(y,{props:e,chatInstance:undefined,isEditing:O,currentVal:x,emit:o});r(()=>e.data,e=>{if(e&&y){const t={...y.editorParams,enableNoAccess:T};t.uploadparams&&(t.uploadParams=JSON.parse(t.uploadparams));const n=ibiz.util.file.calcFileUpDownUrl(y.context,y.params,e,t);S.value=n.uploadUrl}},{immediate:!0,deep:!0});const K=n(),Q=async(t,n)=>{const i=await ibiz.util.file.fileUpload(S.value,t,D.value),l=((e,t)=>{if(!y)return"";const n={...y.editorParams,enableNoAccess:T};return n.exportparams&&(n.exportParams=JSON.parse(n.exportparams)),n.globaldownloadprifix?n.globalDownloadPrifix="true"===n.globaldownloadprifix:n.globalDownloadPrifix=ibiz.config.common.globalDownloadPrifix,t&&t.folder&&(n.osscat=t.folder),ibiz.util.file.calcFileUpDownUrl(y.context,y.params,e,n).downloadUrl})(e.data||{},i.fileid);let o=l.replace("%fileId%",i.fileid);if(ibiz.config.common.enableDownloadTicket&&y&&y.editorParams&&!T){const t=await ibiz.util.file.getDownloadTicket(y.context,y.params,e.data||{},{fileId:i.fileid},y.downloadTicketParams);t&&t.ticket&&(o=l.replace("%fileId%",t.ticket),n(o))}else n(o)},Z=()=>null==I?void 0:I.getMarkdown(),ee=e=>{W=!0,null==I||I.setMarkdown(e,!0)};r(()=>e.value,(e,t)=>{e!==t&&(x.value=e||"")},{immediate:!0}),r(x,(e,t)=>{const n=Z();e!==t&&n!==e&&ee(e)});const te=e=>{"manual"!==N&&(o("change",Z(),null==y?void 0:y.model.id,W),W=!1)},ne=(e,t)=>({[e]:t}),ie=(e,t="")=>{const n=document.createElement(e);return n.className=t,n},le=e=>ie("i","ch-icon ch-icon-".concat(e)),oe=k.e("fullscreen"),ae=e=>{for(;e.firstChild;)e.removeChild(e.firstChild)},re=()=>{if(I&&K.value){const e=I.editor.options.editorDom.parentElement;if(!e)return{};const t=e.classList,n=K.value.querySelector(".".concat(oe));return n?{parentElement:e,cherryClass:t,fullscreenNode:n}:{}}return{}},se=()=>{const{parentElement:e,cherryClass:t,fullscreenNode:n}=re();e&&t&&n&&(ae(n),n.appendChild(le("fullscreen")),n.title=ibiz.i18n.t("editor.common.fullscreen"),t.remove("fullscreen"),null==e||e.blur(),e.setAttribute("tabindex","-1"))},ce=()=>{const{cherryClass:e}=re();return null==e?void 0:e.contains("fullscreen")},de=()=>{I&&K.value&&(ce()?(se(),I.toggleToc(j.value),V.value=!1):((()=>{const{parentElement:e,cherryClass:n,fullscreenNode:i}=re();e&&n&&i&&(ae(i),i.appendChild(le("minscreen")),n.add("fullscreen"),i.title=ibiz.i18n.t("editor.common.minimize"),e.setAttribute("tabindex","-1"),t(()=>null==e?void 0:e.focus()))})(),j.value=I.toc.model,I.toggleToc("full"),V.value=!0))},ue=e=>{e.stopPropagation(),"Escape"===e.key&&(e.preventDefault(),ce()&&(se(),I.toggleToc(j.value),V.value=!1))},me=e=>{null==y||y.setCurrentEditorTheme(e)},he=e=>{var t,n;const{info:i}=e;let l=!0;const o=i.ranges&&i.ranges[0];if(o){const{anchor:e,head:t}=o;l=y.isPositionBefore(e,t)}else l=!0;const a=null==(t=y.mdeditor)?void 0:t.editor.editor.getCursor("start"),r=null==(n=y.mdeditor)?void 0:n.editor.editor.getCursor("end");y.setCursorPos(a,r),y.setSelectionDirection(l)};r(()=>B.theme,e=>{L.value=U||e,null==I||I.setTheme(L.value),null==I||I.setCodeBlockTheme(L.value)});const ve=()=>{O.value=!0,R.value="editOnly",null==I||I.switchModel(R.value)},pe=()=>{O.value=!1,R.value="previewOnly",null==I||I.switchModel(R.value)},fe=()=>{ee(x.value),pe()},be=()=>{o("change",Z(),null==y?void 0:y.model.id,W),W=!1,pe()},ge=()=>{const e=document.getElementById(z);null==e||e.focus()};return s(()=>{var n;(e.disabled||e.readonly||"manual"===N)&&(R.value="previewOnly"),t(()=>{var t,n,i;const l=["bold","italic","underline","strikethrough","sub","sup","|","size","color"],o=["bold","italic","underline","strikethrough","|","color","header","|","list","image",{insert:["link","hr","br","code","formula","toc","table","line-table","bar-table"]},"settings","togglePreview"];y&&y.chatCompletion&&(o.unshift("AIChart"),l.unshift("AI")),I=new p({id:z,value:x.value,previewer:{enablePreviewerBubble:!(e.disabled||e.readonly)},themeSettings:{mainTheme:L.value,codeBlockTheme:L.value},fileUpload:Q,emoji:{useUnicode:!0},header:{anchorStyle:"autonumber"},editor:{height:"100%",defaultModel:R.value,codemirror:{autofocus:!1}},toolbars:{toolbar:o,bubble:l,float:["h1","h2","h3","|","checklist","quote","quickTable","code"],customMenu:{AI:G,AIChart:X},sidebar:["theme","copy"],toolbarRight:[],toc:!J&&{updateLocationHash:!1,defaultModel:"pure",showAutoNumber:!0,position:Y,cssText:""}},callback:{afterChange:te,beforeImageMounted:ne},event:{changeMainTheme:me,selectionChange:he},engine:{syntax:{table:{enableChart:!1,externals:["echarts"]}}}}),I.toggleToc("pure");const r=I.engine.makeHtml(x.value);I.previewer.update(r),null==(n=null==(t=I.toc)?void 0:t.updateTocList)||n.call(t),I.setTheme(L.value),U&&(I.setTheme(U),I.setCodeBlockTheme(U));const s=ie("span","".concat(oe," cherry-toolbar-button"));s.title=ibiz.i18n.t("editor.common.fullscreen"),s.onclick=de,s.appendChild(le("fullscreen"));const c=e.disabled?I.editor.options.editorDom.parentElement:null==(i=I.editor.options.editorDom.parentElement)?void 0:i.querySelector(".cherry-toolbar>.toolbar-right");if(null==c||c.appendChild(s),null==y||y.setMDEditor(I),P(I),a.editorSwitchMenu&&window.ResizeObserver&&K.value){const e=K.value.querySelector(".cherry-toolbar");e&&(q=new ResizeObserver(e=>{var t;const n=null==(t=e[0])?void 0:t.contentRect.height;_.value=k.cssVarBlock({"toolbar-height":"".concat(n,"px")})}),q.observe(e))}}),(()=>{if(window.ResizeObserver&&K.value){const e={width:K.value.offsetWidth?"".concat(K.value.offsetWidth,"px"):"100%"};y&&"number"==typeof y.parent.model.height&&Object.assign(e,{height:"".concat(y.parent.model.height,"px")}),$.value=k.cssVarBlock(e),H=new ResizeObserver(e=>{const t=e[0].contentRect.width;if(t!==F){const n={width:"".concat(e[0].contentRect.width,"px")};y&&"number"==typeof y.parent.model.height&&Object.assign(n,{height:"".concat(y.parent.model.height,"px")}),$.value=k.cssVarBlock(n),F=t}}),H.observe(K.value)}})(),null==(n=K.value)||n.addEventListener("keydown",ue.bind(this))}),i(()=>{var e;null==(e=K.value)||e.removeEventListener("keydown",ue.bind(this))}),c(()=>{I=null,H&&H.disconnect(),q&&q.disconnect()}),{ns:k,currentVal:x,id:z,editor:I,markDownBox:K,headers:D,theme:L,UIStore:B,defaultModel:R,cssVars:$,isEditing:O,showmode:N,isFullScreen:V,isImgPreview:M,getCherryHtml:()=>null==I?void 0:I.getHtml(),getCherryContent:Z,setCherryContent:ee,renderHeader:()=>{if("manual"===N&&!O.value)return l("div",{onClick:ge,class:[k.e("header"),k.is("fullscreen",V.value)]},[!e.disabled&&!e.readonly&&l("div",{class:k.em("header","edit"),onClick:ve,title:ibiz.i18n.t("editor.markdown.edit")},[l("i",{class:"fa fa-edit","aria-hidden":"true"},null)]),l("div",{class:k.em("header","full"),onClick:de},[V.value?l("i",{class:"fa fa-compress","aria-hidden":"true",title:ibiz.i18n.t("editor.html.reduce")},null):l("i",{class:"fa fa-expand","aria-hidden":"true",title:ibiz.i18n.t("editor.common.fullscreen")},null)])])},renderFooter:()=>{if("manual"===N&&O.value&&!e.disabled&&!e.readonly)return l("div",{onClick:ge,class:[k.e("footer"),k.is("fullscreen",V.value)]},[l("div",{class:k.em("footer","cancel"),onClick:fe},[ibiz.i18n.t("editor.common.cancel")]),l("div",{class:k.em("footer","save"),onClick:be},[ibiz.i18n.t("editor.common.confirm")])])},renderImgPreview:E,renderEditorSwitchMenu:()=>{var e;return l("div",{class:[k.b("menu"),k.is("fullscreen",V.value)],style:_.value},[null==(e=a.editorSwitchMenu)?void 0:e.call(a)])}}},render(){const e=!!this.$slots.editorSwitchMenu;return l("div",{ref:"markDownBox",class:[this.ns.b(),this.ns.is("disabled",this.disabled),this.ns.is("manual","manual"===this.showmode),this.ns.is("editing",this.isEditing),this.ns.is("show-editor-switch-menu",e),this.ns.is("editor-content-fixed",this.isFullScreen||this.isImgPreview)]},[e?this.renderEditorSwitchMenu():null,this.renderHeader(),this.renderFooter(),this.renderImgPreview(),l("div",{tabindex:"-1",id:this.id,style:this.cssVars,class:[this.ns.b("cherry"),this.ns.m("dark"===this.UIStore.theme?"dark":"light")]},null)])}}))}}});
|