@ibiz-template/vue3-components 0.7.41-alpha.41 → 0.7.41-alpha.42
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-pEdb_gS_.js +1 -0
- package/dist/{index-Bv2fgePf.js → index-BObZTN7-.js} +3 -3
- package/dist/index.min.css +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/wang-editor-Ck-JCWqK.js +1 -0
- package/dist/{xlsx-util-Dvg2kWh7.js → xlsx-util-B1eGfH7d.js} +1 -1
- package/es/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.controller.mjs +16 -6
- package/es/editor/code/monaco-editor/monaco-editor.mjs +8 -2
- package/es/editor/html/wang-editor/wang-editor.mjs +12 -2
- package/es/editor/markdown/ibiz-markdown-editor/custom-menu.mjs +11 -2
- package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
- package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.mjs +2 -1
- package/es/editor/text-box/input/input.mjs +1 -1
- package/es/util/ai-chat-util/ai-chat-util.mjs +8 -9
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.mjs +7 -3
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.mjs +3 -1
- package/lib/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.controller.cjs +16 -6
- package/lib/editor/code/monaco-editor/monaco-editor.cjs +8 -2
- package/lib/editor/html/wang-editor/wang-editor.cjs +12 -2
- package/lib/editor/markdown/ibiz-markdown-editor/custom-menu.cjs +11 -2
- package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.cjs +2 -1
- package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
- package/lib/editor/text-box/input/input.cjs +1 -1
- package/lib/util/ai-chat-util/ai-chat-util.cjs +8 -9
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.cjs +3 -1
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.cjs +7 -3
- package/package.json +4 -4
- package/dist/ibiz-markdown-editor-DEV-iSvz.js +0 -1
- package/dist/wang-editor-4cNAgOaJ.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
System.register(["vue","@ibiz-template/vue3-util","qx-util","cherry-markdown","@ibiz-template/core","@ibiz-template/runtime"],function(e){"use strict";var t,n,a,i,o,l,r,s,c,d,u,m,h,p,v,f,b,g;return{setters:[function(e){t=e.nextTick,n=e.ref,a=e.onBeforeUnmount,i=e.createVNode,o=e.resolveComponent,l=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){p=e.createUUID},function(e){v=e.default},function(e){f=e.IBizContext},function(e){b=e.UIActionUtil,g=e.SysUIActionTag}],execute:function(){function w(e,t){return!(!e||1!==e.nodeType||e.nodeName!==t)}function y(e){const l=n(""),r=n([]),s=n();let c=null;const d=async e=>{var n;if(l.value=e,r.value=[e],await t(),s.value){const{container:e}=s.value.$refs;e&&(null==(n=e.children[0])||n.click())}},u=e=>{"Escape"!==e.key&&27!==e.keyCode||(e.stopPropagation(),e.preventDefault(),r.value=[],h())},m=async()=>{var e;await t();const n=null==(e=s.value)?void 0:e.$refs.container;if(!n)return;const a=n.querySelector(".el-image-viewer__wrapper");null==a||a.addEventListener("keydown",u)},h=()=>{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",u)},p=e=>{const t=null==e?void 0:e.target;if(w(t,"IMG")&&t)return void d(t.src);const n=function(e){let t=e;for(;t;){if(t.classList.contains("cherry-previewer"))return null;const e=t.parentElement;if(w(t,"svg")&&e&&"mermaid"===e.dataset.type)return t;t=t.parentElement}return null}(t);n&&d(function(e){const t=e.cloneNode(!0),n=e.width.baseVal.value||e.clientWidth,a=e.height.baseVal.value||e.clientHeight;t.setAttribute("width",n),t.setAttribute("height",a),t.style.backgroundColor="white";const i=(new XMLSerializer).serializeToString(t),o=btoa(unescape(encodeURIComponent(i)));return"data:image/svg+xml;base64,".concat(o)}(n))};return a(()=>{c&&(c.removeEventListener("click",p),c=null),h()}),{renderImgPreview:()=>i(o("el-image"),{class:e.e("img-preview"),ref:s,"zoom-rate":1.1,src:l.value,"preview-src-list":r.value,"hide-on-click-modal":!0,onShow:m,fit:"cover"},null),onMDEditorCreated:e=>{var t,n;c=(null==(n=null==(t=null==e?void 0:e.previewer)?void 0:t.previewerBubble)?void 0:n.previewerDom)||null,null==c||c.addEventListener("click",p)}}}e("default",l({name:"IBizMarkDown",props:m(),emits:u(),setup(e,{emit:o,slots:l}){var u,m,w;const C=h("markdown"),k=e.controller,I=n("");let A=null;const z=p(),{onMDEditorCreated:E,renderImgPreview:M}=y(C),S=ibiz.util.file.getUploadHeaders(),T=n({...S}),x=n(""),U=(null==(u=null==k?void 0:k.editorParams)?void 0:u.customTheme)||(null==(m=null==k?void 0:k.editorParams)?void 0:m.customtheme),{UIStore:D}=d(),P=n(U||D.theme),R=n(!1);let O="default";k&&(null==(w=k.editorParams)?void 0:w.showmode)&&(O=k.editorParams.showmode);const L=n(!1),B=n("editOnly");let N=null,V=null,H=0;const F=n({}),q=n({}),j=n("full");let $=!1;const[_,J]=function(e,n){const{props:a,isEditing:i,currentVal:o,emit:l}=n;let r=n.chatInstance;return[v.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,a,i)=>{i.stopPropagation(),i.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;ibiz.inLineAIUtil.showContextMenus(t.left,t.top+43,n)}})}}),v.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 n=await ibiz.aiChatUtil.getAIAgentList(e.context,e.params),{contentToolbarItems:s,footerToolbarItems:c,questionToolbarItems:u,otherToolbarItems:m}=ibiz.aiChatUtil.calcAiToolbarItemsByAc(e.deACMode),{containerOptions:h,chatOptions:v}=ibiz.aiChatUtil.getEditorExAIChatParams(e.editorParams,e.context,e.params,a.data),{zIndex:w}=d(),y=w.increment();r=await ibiz.aiChatUtil.getAIChat();let C,k="";r.create({containerOptions:{zIndex:y,...h},chatOptions:{caption:e.deACMode.logicName,context:{...e.context},params:{...e.params,srfactag:e.deACMode.codeName},appDataEntityId:t,contentToolbarItems:s,footerToolbarItems:c,questionToolbarItems:u,otherToolbarItems:m,aiAgentlist:n,...v,question:async(e,t,n,a,i,o,l,r)=>{k=p(),C=new AbortController;const s=await ibiz.hub.getApp(t.srfappid).deService.getService(t,a.appDataEntityId);try{const a={messages:i,sessionid:o};l&&(a.srfaiagent=l),r&&(a.mode=r),await s.aiChatSse(t=>{if(20===t.actionstate&&t.actionresult)e.addMessage({messageid:k,state:t.actionstate,type:"DEFAULT",role:"ASSISTANT",content:t.actionresult});else if(30===t.actionstate&&t.actionresult){const n=JSON.parse(t.actionresult).choices;n&&n.length>0&&e.replaceMessage({messageid:k,state:t.actionstate,type:"DEFAULT",role:"ASSISTANT",content:n[0].content||""})}else 40===t.actionstate&&e.replaceMessage({messageid:k,state:t.actionstate,type:"ERROR",role:"ASSISTANT",content:t.actionresult})},C,t,n,{...a})}catch(t){e.replaceMessage({messageid:k,state:40,type:"ERROR",role:"ASSISTANT",content:t.message||ibiz.i18n.t("app.aiError")}),null==C||C.abort()}finally{return e.completeMessage(k,!0),!0}},abortQuestion:async e=>{null==C||C.abort(),await e.stopMessage({messageid:k,state:30,type:"DEFAULT",role:"ASSISTANT",content:""}),await e.completeMessage(k,!0)},action:(e,t)=>{"backfill"===e&&(i.value?o.value=t.realcontent||"":l("change",t.realcontent))},history:async(e,t,n)=>{const a=await ibiz.hub.getApp(e.srfappid).deService.getService(e,n.appDataEntityId),i={};n.appendCurData&&Object.assign(i,{...n.appendCurData}),n.srfaiagent&&Object.assign(i,{srfaiagent:n.srfaiagent}),n.srfmode&&Object.assign(i,{mode:n.srfmode});const o=await a.aiChatHistory(e,t,i);if(o.data&&Array.isArray(o.data)){let e;o.data.forEach(t=>{if("TOOL"===t.role)e&&t.content&&r.aiChat.updateRecommendPrompt(e,t.content);else{const n={messageid:p(),state:30,type:"DEFAULT",role:t.role,content:t.content,completed:!0};e=n,r.aiChat.addMessage(n)}})}return!0},recommendPrompt:async(e,t,n)=>{const a=await ibiz.hub.getApp(e.srfappid).deService.getService(e,n.appDataEntityId),i=await a.aiChatRecommendPrompt(e,t,n.message);if(i.ok&&i.data){const e=i.data.choices;return e&&e.length>0?e[0]:null}return null},uploader:{onUpload:async(t,n,a)=>{const i=ibiz.util.file.calcFileUpDownUrl((null==a?void 0:a.context)||e.context,(null==a?void 0:a.params)||e.params,{}),o=ibiz.util.file.getUploadHeaders(),l=new FormData;return l.append("file",t),(await ibiz.net.axios({url:i.uploadUrl,method:"post",headers:o,data:l,onUploadProgress:e=>{const t=e.loaded/e.total*100;n(t)}})).data}},extendToolbarClick:async(t,n,a,i,o)=>{var l,r;const s=await b.exec(n.id,{view:e.view,ctrl:e.ctrl,context:f.create(a),params:i,data:[o],event:t},n.appId);if(s.closeView)e.view.closeView({ok:!0});else if(s.refresh)switch(s.refreshMode){case 1:e.view.callUIAction(g.REFRESH);break;case 2:null==(l=e.view.parentView)||l.callUIAction(g.REFRESH);break;case 3:null==(r=e.view.getTopView())||r.callUIAction(g.REFRESH)}return s}}})}})]}(k,{props:e,chatInstance:undefined,isEditing:R,currentVal:I,emit:o});r(()=>e.data,e=>{if(e&&k){const t={...k.editorParams};t.uploadparams&&(t.uploadParams=JSON.parse(t.uploadparams));const n=ibiz.util.file.calcFileUpDownUrl(k.context,k.params,e,t);x.value=n.uploadUrl}},{immediate:!0,deep:!0});const W=n(),Y=async(t,n)=>{const a=await ibiz.util.file.fileUpload(x.value,t,T.value),i=((e,t)=>{if(!k)return"";const n={...k.editorParams};return n.exportparams&&(n.exportParams=JSON.parse(n.exportparams)),t&&t.folder&&(n.osscat=t.folder),ibiz.util.file.calcFileUpDownUrl(k.context,k.params,e,n).downloadUrl})(e.data||{},a.fileid);let o=i.replace("%fileId%",a.fileid);if(ibiz.config.common.enableDownloadTicket&&k){const t=await ibiz.util.file.getDownloadTicket(k.context,k.params,e.data||{},{fileId:a.fileid},k.downloadTicketParams);t&&t.ticket&&(o=i.replace("%fileId%",t.ticket),n(o))}else n(o)},G=()=>null==A?void 0:A.getMarkdown(),Q=e=>{$=!0,null==A||A.setMarkdown(e,!0)};r(()=>e.value,(e,t)=>{e!==t&&(I.value=e||"")},{immediate:!0}),r(I,(e,t)=>{const n=G();e!==t&&n!==e&&Q(e)});const X=e=>{"manual"!==O&&(o("change",G(),null==k?void 0:k.model.id,$),$=!1)},K=(e,t)=>({[e]:t}),Z=(e,t="")=>{const n=document.createElement(e);return n.className=t,n},ee=e=>Z("i","ch-icon ch-icon-".concat(e)),te=C.e("fullscreen"),ne=e=>{for(;e.firstChild;)e.removeChild(e.firstChild)},ae=()=>{if(A&&W.value){const e=A.editor.options.editorDom.parentElement;if(!e)return{};const t=e.classList,n=W.value.querySelector(".".concat(te));return n?{parentElement:e,cherryClass:t,fullscreenNode:n}:{}}return{}},ie=()=>{const{parentElement:e,cherryClass:t,fullscreenNode:n}=ae();e&&t&&n&&(ne(n),n.appendChild(ee("fullscreen")),n.title=ibiz.i18n.t("editor.common.fullscreen"),t.remove("fullscreen"),null==e||e.blur(),e.setAttribute("tabindex","-1"))},oe=()=>{const{cherryClass:e}=ae();return null==e?void 0:e.contains("fullscreen")},le=()=>{A&&W.value&&(oe()?(ie(),A.toggleToc(j.value),L.value=!1):((()=>{const{parentElement:e,cherryClass:n,fullscreenNode:a}=ae();e&&n&&a&&(ne(a),a.appendChild(ee("minscreen")),n.add("fullscreen"),a.title=ibiz.i18n.t("editor.common.minimize"),e.setAttribute("tabindex","-1"),t(()=>null==e?void 0:e.focus()))})(),j.value=A.toc.model,A.toggleToc("full"),L.value=!0))},re=e=>{e.stopPropagation(),"Escape"===e.key&&(e.preventDefault(),oe()&&(ie(),A.toggleToc(j.value),L.value=!1))},se=e=>{null==k||k.setCurrentEditorTheme(e)},ce=e=>{var t,n;const{info:a}=e;let i=!0;const o=a.ranges&&a.ranges[0];if(o){const{anchor:e,head:t}=o;i=k.isPositionBefore(e,t)}else i=!0;const l=null==(t=k.mdeditor)?void 0:t.editor.editor.getCursor("start"),r=null==(n=k.mdeditor)?void 0:n.editor.editor.getCursor("end");k.setCursorPos(l,r),k.setSelectionDirection(i)};r(()=>D.theme,e=>{P.value=U||e,null==A||A.setTheme(P.value),null==A||A.setCodeBlockTheme(P.value)});const de=()=>{R.value=!0,B.value="editOnly",null==A||A.switchModel(B.value)},ue=()=>{R.value=!1,B.value="previewOnly",null==A||A.switchModel(B.value)},me=()=>{Q(I.value),ue()},he=()=>{o("change",G(),null==k?void 0:k.model.id,$),$=!1,ue()},pe=()=>{const e=document.getElementById(z);null==e||e.focus()};return s(()=>{var n;(e.disabled||e.readonly||"manual"===O)&&(B.value="previewOnly"),t(()=>{var t;const n=["bold","italic","underline","strikethrough","sub","sup","|","size","color"],a=["bold","italic","underline","strikethrough","|","color","header","|","list","image",{insert:["link","hr","br","code","formula","toc","table","line-table","bar-table"]},"settings","togglePreview"];k&&k.chatCompletion&&(a.unshift("AIChart"),n.unshift("AI")),A=new v({id:z,value:I.value,previewer:{enablePreviewerBubble:!(e.disabled||e.readonly)},themeSettings:{mainTheme:P.value,codeBlockTheme:P.value},fileUpload:Y,emoji:{useUnicode:!0},header:{anchorStyle:"autonumber"},editor:{height:"100%",defaultModel:B.value,codemirror:{autofocus:!1}},toolbars:{toolbar:a,bubble:n,float:["h1","h2","h3","|","checklist","quote","quickTable","code"],customMenu:{AI:_,AIChart:J},sidebar:["theme","copy"],toolbarRight:[],toc:{updateLocationHash:!1,defaultModel:"pure",showAutoNumber:!0,position:"absolute",cssText:""}},callback:{afterChange:X,beforeImageMounted:K},event:{changeMainTheme:se,selectionChange:ce},engine:{syntax:{table:{enableChart:!1,externals:["echarts"]}}}}),A.setTheme(P.value),U&&(A.setTheme(U),A.setCodeBlockTheme(U));const i=Z("span","".concat(te," cherry-toolbar-button"));i.title=ibiz.i18n.t("editor.common.fullscreen"),i.onclick=le,i.appendChild(ee("fullscreen"));const o=e.disabled?A.editor.options.editorDom.parentElement:null==(t=A.editor.options.editorDom.parentElement)?void 0:t.querySelector(".cherry-toolbar>.toolbar-right");if(null==o||o.appendChild(i),null==k||k.setMDEditor(A),E(A),l.editorSwitchMenu&&window.ResizeObserver&&W.value){const e=W.value.querySelector(".cherry-toolbar");e&&(V=new ResizeObserver(e=>{var t;const n=null==(t=e[0])?void 0:t.contentRect.height;q.value=C.cssVarBlock({"toolbar-height":"".concat(n,"px")})}),V.observe(e))}}),(()=>{if(window.ResizeObserver&&W.value){const e={width:W.value.offsetWidth?"".concat(W.value.offsetWidth,"px"):"100%"};k&&"number"==typeof k.parent.model.height&&Object.assign(e,{height:"".concat(k.parent.model.height,"px")}),F.value=C.cssVarBlock(e),N=new ResizeObserver(e=>{const t=e[0].contentRect.width;if(t!==H){const n={width:"".concat(e[0].contentRect.width,"px")};k&&"number"==typeof k.parent.model.height&&Object.assign(n,{height:"".concat(k.parent.model.height,"px")}),F.value=C.cssVarBlock(n),H=t}}),N.observe(W.value)}})(),null==(n=W.value)||n.addEventListener("keydown",re.bind(this))}),a(()=>{var e;null==(e=W.value)||e.removeEventListener("keydown",re.bind(this))}),c(()=>{A=null,N&&N.disconnect(),V&&V.disconnect()}),{ns:C,currentVal:I,id:z,editor:A,markDownBox:W,headers:T,theme:P,defaultModel:B,cssVars:F,isEditing:R,showmode:O,getCherryHtml:()=>null==A?void 0:A.getHtml(),getCherryContent:G,setCherryContent:Q,renderHeader:()=>{if("manual"===O&&!R.value)return i("div",{onClick:pe,class:[C.e("header"),C.is("fullscreen",L.value)]},[!e.disabled&&!e.readonly&&i("div",{class:C.em("header","edit"),onClick:de,title:ibiz.i18n.t("editor.markdown.edit")},[i("i",{class:"fa fa-edit","aria-hidden":"true"},null)]),i("div",{class:C.em("header","full"),onClick:le},[L.value?i("i",{class:"fa fa-compress","aria-hidden":"true",title:ibiz.i18n.t("editor.html.reduce")},null):i("i",{class:"fa fa-expand","aria-hidden":"true",title:ibiz.i18n.t("editor.common.fullscreen")},null)])])},renderFooter:()=>{if("manual"===O&&R.value&&!e.disabled&&!e.readonly)return i("div",{onClick:pe,class:[C.e("footer"),C.is("fullscreen",L.value)]},[i("div",{class:C.em("footer","cancel"),onClick:me},[ibiz.i18n.t("editor.common.cancel")]),i("div",{class:C.em("footer","save"),onClick:he},[ibiz.i18n.t("editor.common.confirm")])])},renderImgPreview:M,renderEditorSwitchMenu:()=>{var e;return i("div",{class:[C.b("menu"),C.is("fullscreen",L.value)],style:q.value},[null==(e=l.editorSwitchMenu)?void 0:e.call(l)])}}},render(){const e=!!this.$slots.editorSwitchMenu;return i("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)]},[e?this.renderEditorSwitchMenu():null,this.renderHeader(),this.renderFooter(),this.renderImgPreview(),i("div",{tabindex:"-1",id:this.id,style:this.cssVars,class:[this.ns.b("cherry"),this.ns.m("dark"===this.theme?"dark":"light")]},null)])}}))}}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
System.register(["vue","@wangeditor/editor-for-vue","qx-util","ramda","@ibiz-template/vue3-util","@ibiz-template/core","@ibiz-template/runtime","element-plus","./index-Bv2fgePf.js","@wangeditor/editor","lodash-es","@floating-ui/dom","interactjs","dayjs","qs","vuedraggable","@imengyu/vue3-context-menu","vue-router","async-validator","@ibiz-template/devtool","axios","dayjs/plugin/customParseFormat","vue-i18n","@ibiz-template/model-helper"],function(e){"use strict";var t,a,o,l,i,n,s,r,c,d,u,m,p,v,h,g,f,b,y,S,C,w,z,I,x;return{setters:[function(e){t=e.defineComponent,a=e.createVNode,o=e.resolveComponent,l=e.ref,i=e.shallowRef,n=e.watch,s=e.onBeforeUnmount,r=e.onMounted,c=e.nextTick,d=e.onUnmounted},function(e){u=e.Toolbar,m=e.Editor},function(e){p=e.createUUID},function(e){v=e.isNil},function(e){h=e.getEditorEmits,g=e.getHtmlProps,f=e.useNamespace,b=e.useUIStore},function(e){y=e.awaitTimeout,S=e.IBizContext},function(e){C=e.UIActionUtil,w=e.SysUIActionTag},function(e){z=e.ElMessageBox},function(e){I=e.h},function(e){x=e.t},null,null,null,null,null,null,null,null,null,null,null,null,null,null],execute:function(){e("default",t({name:"IBizHtml",props:g(),emits:h(),setup(e,{emit:t,slots:o}){const h=f("html"),g=e.controller,A=l(),T=l({});let E=null,U=0;const k=l(),M=i(),F=l(""),H=ibiz.util.file.getUploadHeaders(),P=l({...H}),O=l(""),B=l(!0),D=l(!1),R=l(!1),L=l(!1),N=l(!1),V=g.model;V.editorParams&&(V.editorParams.enableEdit&&(D.value=!0,R.value=!0,B.value=g.toBoolean(V.editorParams.enableEdit)&&!e.readonly&&!e.disabled),V.editorParams.enableedit&&(D.value=!0,R.value=!0,B.value=g.toBoolean(V.editorParams.enableedit)&&!e.readonly&&!e.disabled),V.editorParams.enableFullScreen&&(L.value=g.toBoolean(V.editorParams.enableFullScreen)),V.editorParams.enablefullscreen&&(L.value=g.toBoolean(V.editorParams.enablefullscreen))),e.readonly&&(D.value=!1,R.value=!0);n(()=>e.data,e=>{if(e){const t={...g.editorParams};t.uploadparams&&(t.uploadParams=JSON.parse(t.uploadparams));const a=ibiz.util.file.calcFileUpDownUrl(g.context,g.params,e,t);O.value=a.uploadUrl}},{immediate:!0,deep:!0});const j=(e,t)=>{if(t)return!0},K=e=>e,q=["headerSelect","blockquote","|","bold","underline","italic",{key:"group-more-style",title:x("editor.more"),iconSvg:'<svg viewBox="0 0 1024 1024"><path d="M204.8 505.6m-76.8 0a76.8 76.8 0 1 0 153.6 0 76.8 76.8 0 1 0-153.6 0Z"></path><path d="M505.6 505.6m-76.8 0a76.8 76.8 0 1 0 153.6 0 76.8 76.8 0 1 0-153.6 0Z"></path><path d="M806.4 505.6m-76.8 0a76.8 76.8 0 1 0 153.6 0 76.8 76.8 0 1 0-153.6 0Z"></path></svg>',menuKeys:["through","code","sup","sub","clearStyle"]},"color","bgColor","|","fontSize","fontFamily","lineHeight","|","bulletedList","numberedList","todo",{key:"group-justify",title:x("editor.justify"),iconSvg:'<svg viewBox="0 0 1024 1024"><path d="M768 793.6v102.4H51.2v-102.4h716.8z m204.8-230.4v102.4H51.2v-102.4h921.6z m-204.8-230.4v102.4H51.2v-102.4h716.8zM972.8 102.4v102.4H51.2V102.4h921.6z"></path></svg>',menuKeys:["justifyLeft","justifyRight","justifyCenter","justifyJustify"]},{key:"group-indent",title:x("editor.indent"),iconSvg:'<svg viewBox="0 0 1024 1024"><path d="M0 64h1024v128H0z m384 192h640v128H384z m0 192h640v128H384z m0 192h640v128H384zM0 832h1024v128H0z m0-128V320l256 192z"></path></svg>',menuKeys:["indent","delIndent"]},"|","emotion","insertLink",{key:"group-image",title:x("editor.image"),iconSvg:'<svg viewBox="0 0 1024 1024"><path d="M959.877 128l0.123 0.123v767.775l-0.123 0.122H64.102l-0.122-0.122V128.123l0.122-0.123h895.775zM960 64H64C28.795 64 0 92.795 0 128v768c0 35.205 28.795 64 64 64h896c35.205 0 64-28.795 64-64V128c0-35.205-28.795-64-64-64zM832 288.01c0 53.023-42.988 96.01-96.01 96.01s-96.01-42.987-96.01-96.01S682.967 192 735.99 192 832 234.988 832 288.01zM896 832H128V704l224.01-384 256 320h64l224.01-192z"></path></svg>',menuKeys:["insertImage","uploadImage"]},{key:"group-video",title:x("editor.video"),iconSvg:'<svg viewBox="0 0 1024 1024"><path d="M981.184 160.096C837.568 139.456 678.848 128 512 128S186.432 139.456 42.816 160.096C15.296 267.808 0 386.848 0 512s15.264 244.16 42.816 351.904C186.464 884.544 345.152 896 512 896s325.568-11.456 469.184-32.096C1008.704 756.192 1024 637.152 1024 512s-15.264-244.16-42.816-351.904zM384 704V320l320 192-320 192z"></path></svg>',menuKeys:["insertVideo","uploadVideo"]},"insertTable","codeBlock","divider","|","undo","redo","|","fullScreen","emoji"];g.chatCompletion&&q.unshift("aichart","|");const J={excludeKeys:["group-video","emotion"],toolbarKeys:q},Z={placeholder:g.placeHolder,readOnly:D.value?R.value:e.readonly,MENU_CONF:{uploadImage:{server:O.value,fieldName:"file",maxFileSize:10485760,maxNumberOfFiles:10,allowedFileTypes:[],headers:P.value,withCredentials:!0,onBeforeUpload:e=>e,onProgress(e){console.log("progress",e)},onSuccess(e,t){ibiz.config.common.enableDownloadTicket&&t.ticket&&ibiz.util.file.setDownloadTicket(t.id,t.ticket),console.log("".concat(e.name," 上传成功"),t)},onFailed(e,t){console.log("".concat(e.name," 上传失败"),t)},onError(e,t,a){console.log("".concat(e.name," 上传出错"),t,a)},async customInsert(t,a){const o=((e,t)=>{const a={...g.editorParams};return a.exportparams&&(a.exportParams=JSON.parse(a.exportparams)),t&&t.folder&&(a.osscat=t.folder),ibiz.util.file.calcFileUpDownUrl(g.context,g.params,e,a).downloadUrl})(e.data,t);let l=o.replace("%fileId%",t.id);const i=t.filename;if(ibiz.config.common.enableDownloadTicket){const n=await ibiz.util.file.getDownloadTicket(g.context,g.params,e.data,{fileId:t.id},g.downloadTicketParams);n&&n.ticket&&(l=o.replace("%fileId%",n.ticket),a(l,i,""))}else a(l,i,"")}},insertLink:{checkLink:j,parseLinkUrl:K},editLink:{checkLink:j,parseLinkUrl:K}},hoverbarKeys:I};let Q;s(()=>{const e=M.value;null!=e&&e.destroy()});const $=a=>{M.value=a,g.onCreated(M.value),a.setHtml(F.value),a.on("aiClick",()=>{(async()=>{const a=g.model.appDataEntityId;if(!a||!g.deACMode)return;const o=await ibiz.aiChatUtil.getAIAgentList(g.context,g.params),{contentToolbarItems:l,footerToolbarItems:i,questionToolbarItems:n,otherToolbarItems:s}=ibiz.aiChatUtil.calcAiToolbarItemsByAc(g.deACMode),{containerOptions:r,chatOptions:c}=ibiz.aiChatUtil.getEditorExAIChatParams(g.editorParams,g.context,g.params,e.data),{zIndex:d}=b(),u=d.increment();Q=await ibiz.aiChatUtil.getAIChat();let m,v="";Q.create({containerOptions:{zIndex:u,...r},chatOptions:{caption:g.deACMode.logicName,context:{...g.context},params:{...g.params,srfactag:g.deACMode.codeName},appDataEntityId:a,contentToolbarItems:l,footerToolbarItems:i,questionToolbarItems:n,otherToolbarItems:s,aiAgentlist:o,...c,question:async(e,t,a,o,l,i,n,s)=>{v=p(),m=new AbortController;const r=await ibiz.hub.getApp(t.srfappid).deService.getService(t,o.appDataEntityId);try{const o={messages:l,sessionid:i};n&&(o.srfaiagent=n),s&&(o.mode=s),await r.aiChatSse(t=>{if(20===t.actionstate&&t.actionresult)e.addMessage({messageid:v,state:t.actionstate,type:"DEFAULT",role:"ASSISTANT",content:t.actionresult});else if(30===t.actionstate&&t.actionresult){const a=JSON.parse(t.actionresult).choices;a&&a.length>0&&e.replaceMessage({messageid:v,state:t.actionstate,type:"DEFAULT",role:"ASSISTANT",content:a[0].content||""})}else 40===t.actionstate&&e.replaceMessage({messageid:v,state:t.actionstate,type:"ERROR",role:"ASSISTANT",content:t.actionresult})},m,t,a,{...o})}catch(t){e.replaceMessage({messageid:v,state:40,type:"ERROR",role:"ASSISTANT",content:t.message||ibiz.i18n.t("app.aiError")}),null==m||m.abort()}finally{return e.completeMessage(v,!0),!0}},abortQuestion:async e=>{null==m||m.abort(),await e.stopMessage({messageid:v,state:30,type:"DEFAULT",role:"ASSISTANT",content:""}),await e.completeMessage(v,!0)},action:(e,a)=>{"backfill"===e&&(D.value?F.value=a.realcontent||"":t("change",a.realcontent))},history:async(e,t,a)=>{const o=await ibiz.hub.getApp(e.srfappid).deService.getService(e,a.appDataEntityId),l={};a.appendCurData&&Object.assign(l,{...a.appendCurData}),a.srfaiagent&&Object.assign(l,{srfaiagent:a.srfaiagent}),a.srfmode&&Object.assign(l,{mode:a.srfmode});const i=await o.aiChatHistory(e,t,l);if(i.data&&Array.isArray(i.data)){let e;i.data.forEach(t=>{if("TOOL"===t.role)e&&t.content&&Q.aiChat.updateRecommendPrompt(e,t.content);else{const a={messageid:p(),state:30,type:"DEFAULT",role:t.role,content:t.content,completed:!0};e=a,Q.aiChat.addMessage(a)}})}return!0},recommendPrompt:async(e,t,a)=>{const o=await ibiz.hub.getApp(e.srfappid).deService.getService(e,a.appDataEntityId),l=await o.aiChatRecommendPrompt(e,t,a.message);if(l.ok&&l.data){const e=l.data.choices;return e&&e.length>0?e[0]:null}return null},uploader:{onUpload:async(e,t,a)=>{const o=ibiz.util.file.calcFileUpDownUrl((null==a?void 0:a.context)||g.context,(null==a?void 0:a.params)||g.params,{}),l=ibiz.util.file.getUploadHeaders(),i=new FormData;return i.append("file",e),(await ibiz.net.axios({url:o.uploadUrl,method:"post",headers:l,data:i,onUploadProgress:e=>{const a=e.loaded/e.total*100;t(a)}})).data}},extendToolbarClick:async(e,t,a,o,l)=>{var i,n;const s=await C.exec(t.id,{view:g.view,ctrl:g.ctrl,context:S.create(a),params:o,data:[l],event:e},t.appId);if(s.closeView)g.view.closeView({ok:!0});else if(s.refresh)switch(s.refreshMode){case 1:g.view.callUIAction(w.REFRESH);break;case 2:null==(i=g.view.parentView)||i.callUIAction(w.REFRESH);break;case 3:null==(n=g.view.getTopView())||n.callUIAction(w.REFRESH)}return s}}})})()}),a.on("lineAiClick",()=>{const e=a.getSelectionPosition();if(!e||!e.left||!e.top)return;const t=ibiz.inLineAIUtil.calcContextMenus(g.deACMode,e=>{g.doInLineAIUIAction(e,g.model.appId)});if(0===t.length)return;const o=a.getEditableContainer().getBoundingClientRect();ibiz.inLineAIUtil.showContextMenus(o.x+Number(e.left.replace("px","")),o.y+Number(e.top.replace("px",""))+42,t)})},_=a=>{const o=a.getHtml(),l="<p><br></p>"===o?"":o;l===e.value||""===l&&v(e.value)||!D.value&&a.isFocused()&&t("change",l)},G=e=>{},W=e=>{t("focus")},X=e=>{t("blur")},Y=(e,t)=>{alert("【".concat(ibiz.i18n.t("editor.html.wangEditor.customTips"),"】").concat(t," - ").concat(e))},ee=(e,t,a)=>{a(!0)},te=()=>{const e=M.value;null!=e&&e.disable()},ae=()=>{const e=M.value;null!=e&&e.enable()};r(()=>{n(()=>e.value,(t,a)=>{t===a||"string"!=typeof e.value&&null!=t||c(null==t?()=>{F.value=""}:()=>{F.value=t})},{immediate:!0}),n(()=>e.disabled,(e,t)=>{e!==t&&(!0===e?te():ae())},{immediate:!0})});const oe=()=>{R.value=!R.value,R.value?te():(ae(),M.value.focus(),(()=>{var t,a;if(e.value){const o=e.value.indexOf("</p>");if(o>=0){const e=null==(t=M.value.selection.anchor)?void 0:t.offset,l=null==(a=M.value.selection.anchor)?void 0:a.path;0===e&&l.length>0&&0===l[0]&&M.value.move(o-3)}}})())},le=()=>{N.value=!N.value,c(()=>{R.value?te():(ae(),M.value.focus())})};return r(()=>{y(0,()=>{if(A.value&&k.value){const e=A.value.offsetHeight;E=new ResizeObserver(t=>{const a=t[0].contentRect.height;if(a!==U){const o={height:"".concat(e-t[0].contentRect.height+(0!==a?300:0),"px"),"toolbar-height":"".concat(a,"px")};T.value=h.cssVarBlock(o),U=a}}),E.observe(k.value.selector)}})}),d(()=>{g.onDestroyed(),E&&E.disconnect(),Q&&Q.close()}),{ns:h,editorRef:M,mode:"default",valueHtml:F,toolbarConfig:J,editorConfig:Z,handleCreated:$,handleChange:_,handleDestroyed:G,handleFocus:W,handleBlur:X,customAlert:Y,customPaste:ee,insertText:e=>{const t=M.value;null!=t&&t.insertText(e)},printHtml:()=>{const e=M.value;null!=e&&console.log(e.getHtml())},disable:te,enable:ae,renderHeaserToolbar:()=>D.value||L.value?a("div",{class:h.b("custom-toolbar")},[D.value&&B.value&&R.value?a("i",{class:"fa fa-edit","aria-hidden":"true",title:ibiz.i18n.t("editor.html.enableedit"),onClick:()=>oe()},null):null,L.value?N.value?a("i",{class:"fa fa-compress","aria-hidden":"true",title:ibiz.i18n.t("editor.html.reduce"),onClick:()=>le()},null):a("i",{class:"fa fa-expand","aria-hidden":"true",title:ibiz.i18n.t("editor.html.expand"),onClick:()=>le()},null):null]):null,renderEditorContent:()=>a("div",{class:[h.b("content"),h.is("editing",!R.value)],ref:"htmlContent",style:T.value},[o.editorSwitchMenu?a("div",{class:h.b("menu")},[o.editorSwitchMenu()]):null,a(u,{ref:"toolbarRef",editor:M.value,"default-config":J,mode:"default",class:h.b("toolbar")},null),a(m,{class:[h.b("editor"),h.is("readonly",R.value)],modelValue:F.value,"onUpdate:modelValue":e=>F.value=e,"default-config":Z,mode:"default",onOnCreated:$,onOnChange:_,onOnDestroyed:G,onOnFocus:W,onOnBlur:X,oncustomAlert:Y,oncustomPaste:ee},null)]),renderFooter:()=>D.value?a("div",{class:[h.b("footer"),{[h.b("footer-dialog")]:N.value}]},[a("div",{class:h.be("footer","cancel"),onClick:()=>{e.value!==F.value?z({title:ibiz.i18n.t("editor.common.confirmCancel"),type:"warning",customClass:h.b("message"),message:a("div",{class:h.be("message","message-content")},[a("p",null,[ibiz.i18n.t("editor.common.confirmCancelPrompt")]),a("p",{class:h.bem("message","message-content","message-tip")},[ibiz.i18n.t("editor.common.cancelEditPrompt")])]),showCancelButton:!0,cancelButtonClass:h.be("message","message-cancel"),confirmButtonClass:h.be("message","message-comfire")}).then(()=>{F.value=e.value||"",oe()}).catch(()=>{M.value.focus()}):oe()}},[ibiz.i18n.t("app.cancel")]),a("div",{class:h.be("footer","save"),onClick:()=>(()=>{R.value=!0,M.value.disable();const e=F.value;t("change",e),N.value&&(N.value=!1)})()},[ibiz.i18n.t("app.save")])]):null,htmlContent:A,hasEnableEdit:D,cssVars:T,toolbarRef:k,isFullScreen:N,readonlyState:R,changeFullScreenState:le}},render(){const e=!!this.$slots.editorSwitchMenu;return this.isFullScreen?a(o("el-dialog"),{modelValue:this.isFullScreen,"onUpdate:modelValue":e=>this.isFullScreen=e,width:"80%",top:"10vh",class:[this.ns.b("dialog-full-screen"),this.ns.is("editing",!this.readonlyState)],onClose:()=>this.changeFullScreenState()},{default:()=>[a("div",{class:[this.ns.b(),{[this.ns.b("editor-readonly")]:this.readonlyState},this.ns.is("show-editor-switch-menu",e)]},[this.renderHeaserToolbar(),this.renderEditorContent(),this.hasEnableEdit&&!this.readonlyState?this.renderFooter():null])]}):a("div",{class:[this.ns.b(),{[this.ns.b("editor-readonly")]:this.readonlyState},this.ns.is("show-ai",!0),this.ns.is("enable-edit",!this.readonly&&!this.disabled),this.ns.is("show-editor-switch-menu",e)]},[this.renderHeaserToolbar(),this.renderEditorContent(),this.hasEnableEdit&&!this.readonlyState?this.renderFooter():null])}}))}}});
|