@ibiz-template/vue3-components 0.7.41-alpha.28 → 0.7.41-alpha.29
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/index-nGWWgnsc.js +11 -0
- package/dist/index.min.css +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/{wang-editor-C2Kvoo5k.js → wang-editor-vb19lrqQ.js} +1 -1
- package/dist/{xlsx-util-LtsAKql7.js → xlsx-util-Dj0CJwvb.js} +1 -1
- package/es/control/app-menu/app-menu.mjs +16 -2
- package/es/control/search-bar/search-bar.mjs +2 -1
- package/es/editor/text-box/input/input.mjs +12 -0
- package/lib/control/app-menu/app-menu.cjs +15 -1
- package/lib/control/search-bar/search-bar.cjs +2 -1
- package/lib/editor/text-box/input/input.cjs +12 -0
- package/package.json +5 -5
- package/dist/index-DXs5m_xe.js +0 -11
package/dist/index.system.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
System.register(["./index-
|
|
1
|
+
System.register(["./index-nGWWgnsc.js","@ibiz-template/model-helper","@ibiz-template/vue3-util","vue","@ibiz-template/core","@ibiz-template/runtime","qx-util","element-plus","ramda","lodash-es","@floating-ui/dom","interactjs","dayjs","qs","vuedraggable","@wangeditor/editor","vue-router","@ibiz-template/devtool","axios","dayjs/plugin/customParseFormat","vue-i18n"],function(i){"use strict";return{setters:[function(e){i({ActionBarPortlet:e.ar,AppDataUploadViewEngine:e.b7,AppRouter:e.c6,AppUtil:e.bZ,ArrowLeftBold:e.c2,ArrowRightBold:e.c3,AuthGuard:e.c4,CalendarExpViewEngine:e.b8,CalendarViewEngine:e.b9,ChartExpViewEngine:e.ba,ChartPortlet:e.aj,ChartViewEngine:e.bb,ConfirmUtil:e.bS,ContainerPortlet:e.ac,CustomViewEngine:e.bc,DEIndexViewEngine:e.bf,DRBarController:e.a7,DRTabController:e.a9,DataViewControlProvider:e.V,DataViewEngine:e.b3,DataViewExpViewEngine:e.be,DoingNotice:e.D,EditView2Engine:e.bh,EditView3Engine:e.bi,EditView4Engine:e.bj,EditViewEngine:e.bg,ErrorView:e.a$,ExpViewEngine:e.bk,FilterPortlet:e.av,FormPickupDataViewEngine:e.bl,FullscreenUtil:e.b_,GanttViewEngine:e.bm,GridExpViewEngine:e.bn,GridViewEngine:e.b1,HtmlPortlet:e.ap,IBizActionBarPortlet:e.aq,IBizActionToolbar:e.f,IBizAppMenuControl:e.l,IBizAppMenuIconViewControl:e.m,IBizAuthUserinfo:e.aH,IBizCalendarControl:e.aw,IBizCalendarExpBarControl:e.a1,IBizCaptionBarControl:e.T,IBizChartControl:e.a4,IBizChartExpBarControl:e.a2,IBizChartPortlet:e.ai,IBizCol:e.d,IBizCommonComponents:e.b,IBizContainerPortlet:e.ab,IBizContextMenuControl:e.aE,IBizDRBarControl:e.a6,IBizDRTabControl:e.a8,IBizDashboardControl:e.aa,IBizDataViewControl:e.U,IBizDataViewExpBarControl:e.a0,IBizDynamicGridFieldEditColumn:e.x,IBizEditFormControl:e.Q,IBizEditor:e.aV,IBizFilterPortlet:e.au,IBizFormButton:e.H,IBizFormButtonList:e.O,IBizFormControl:e.R,IBizFormDRUIPart:e.J,IBizFormGroupPanel:e.B,IBizFormIFrame:e.P,IBizFormItem:e.C,IBizFormItemContainer:e.E,IBizFormMDCtrl:e.K,IBizFormPage:e.F,IBizFormPageItem:e.G,IBizFormRawItem:e.L,IBizFormTabPage:e.N,IBizFormTabPanel:e.M,IBizGanttControl:e.aD,IBizGridColumnHeader:e.y,IBizGridControl:e.n,IBizGridExpBarControl:e.$,IBizGridFieldColumn:e.s,IBizGridFieldEditColumn:e.v,IBizGridGroupColumn:e.w,IBizGridUAColumn:e.t,IBizHtmlPortlet:e.ao,IBizIndexActions:e.aT,IBizKanbanControl:e.ax,IBizListControl:e.z,IBizListExpBarControl:e._,IBizListPortlet:e.am,IBizMEditViewPanelControl:e.aA,IBizMapControl:e.aB,IBizMenuPortlet:e.ag,IBizNavPosIndex:e.aK,IBizPanelAppTitle:e.aN,IBizPanelButton:e.aL,IBizPanelComponents:e.aG,IBizPanelIndexViewSearch:e.aS,IBizPanelTabPanel:e.aP,IBizPickupViewPanelControl:e.X,IBizRawItem:e.g,IBizRawItemPortlet:e.ak,IBizReportPanelControl:e.aC,IBizReportPortlet:e.as,IBizRow:e.e,IBizSearchBarControl:e.a3,IBizSearchFormControl:e.A,IBizSortBar:e.k,IBizSplit:e.h,IBizSplitContainer:e.aR,IBizSplitTrigger:e.j,IBizSubAppRefView:e.a_,IBizTabExpPanelControl:e.Y,IBizToolbarControl:e.S,IBizTreeControl:e.W,IBizTreeExpBarControl:e.Z,IBizTreeGridControl:e.az,IBizTreeGridExControl:e.ay,IBizUserAction:e.aU,IBizViewEngine:e.b0,IBizViewPanelControl:e.aF,IBizViewPortlet:e.ae,IBizVue3:e.I,IBizWFStepTraceView:e.aZ,IBizWizardPanelControl:e.a5,IndexViewEngine:e.b2,KanbanViewEngine:e.bo,ListExpViewEngine:e.bp,ListPortlet:e.an,ListViewEngine:e.bq,LoadingUtil:e.bP,LoginView:e.aY,LoginViewEngine:e.br,MDCustomViewEngine:e.bd,MEditView9Engine:e.bt,MPickupView2Engine:e.bv,MPickupViewEngine:e.bu,MapViewEngine:e.bs,MenuPortlet:e.ah,MessageUtil:e.bQ,ModalUtil:e.bR,NavPosIndexController:e.aJ,NavPosIndexState:e.aI,NoticeUtil:e.bX,NotificationUtil:e.bT,OpenViewUtil:e.bU,OptViewEngine:e.b4,OverlayController:e.bV,PanelAppTitleController:e.aO,PanelButtonController:e.aM,PanelViewEngine:e.bw,PickupDataViewEngine:e.bx,PickupGridViewEngine:e.by,PickupTreeViewEngine:e.bz,PickupView2Engine:e.bB,PickupViewEngine:e.bA,PortalViewEngine:e.bC,PortletLayout:e.ad,RawItemPortlet:e.al,RenderUtil:e.bY,ReportPortlet:e.at,ReportViewEngine:e.bD,SplitContainerController:e.aQ,SubAppRefViewEngine:e.bE,TabExpViewEngine:e.b5,TabSearchViewEngine:e.bF,TreeExpViewEngine:e.b6,TreeGridExViewEngine:e.bG,TreeGridViewEngine:e.bH,TreeViewEngine:e.bI,View403:e.aX,View404:e.aW,ViewPortlet:e.af,WFDynaActionViewEngine:e.bJ,WFDynaEditView3Engine:e.bL,WFDynaEditViewEngine:e.bK,WFDynaStartViewEngine:e.bM,WFStepDataViewEngine:e.bN,WizardViewEngine:e.bO,calcAiToolbarItemsByAc:e.c,convertBtnType:e.c0,i18n:e.i,parseHtml:e.c1,runApp:e.c5,useAppGridBase:e.p,useAppGridPagination:e.o,useFocusByEnter:e.b$,useGridDraggable:e.r,useGridHeaderStyle:e.q,useITableEvent:e.u,usePagination:e.bW})},null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],execute:function(){}}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
System.register(["vue","@wangeditor/editor-for-vue","qx-util","ramda","@ibiz-template/vue3-util","@ibiz-template/core","@ibiz-template/runtime","element-plus","./index-DXs5m_xe.js","lodash-es","@floating-ui/dom","interactjs","dayjs","qs","vuedraggable","@wangeditor/editor","vue-router","@ibiz-template/devtool","axios","dayjs/plugin/customParseFormat","vue-i18n","@ibiz-template/model-helper"],function(e,t){"use strict";var a,l,o,n,i,s,r,c,d,u,m,p,v,f,b,h,g,y,S,w,C,T,E,z,I;return{setters:[function(e){a=e.defineComponent,l=e.createVNode,o=e.resolveComponent,n=e.ref,i=e.shallowRef,s=e.watch,r=e.onBeforeUnmount,c=e.onMounted,d=e.nextTick,u=e.onUnmounted},function(e){m=e.Toolbar,p=e.Editor},function(e){v=e.createUUID},function(e){f=e.isNil},function(e){b=e.getEditorEmits,h=e.getHtmlProps,g=e.useNamespace,y=e.useUIStore},function(e){S=e.awaitTimeout,w=e.StringUtil,C=e.IBizContext},function(e){T=e.UIActionUtil,E=e.SysUIActionTag},function(e){z=e.ElMessageBox},function(e){I=e.c},null,null,null,null,null,null,null,null,null,null,null,null,null],execute:function(){e("default",a({name:"IBizHtml",props:h(),emits:b(),setup(e,{emit:a}){const o=g("html"),b=e.controller,h=n(),U=n({});let x=null,k=0;const A=n(),F=i(),P=n(""),D=ibiz.util.file.getUploadHeaders(),R=n({...D}),O=n(""),H=n(!0),N=n(!1),M=n(!1),B=n(!1),L=n(!1),V=b.model;V.editorParams&&(V.editorParams.enableEdit&&(N.value=!0,M.value=!0,H.value=b.toBoolean(V.editorParams.enableEdit)&&!e.readonly&&!e.disabled),V.editorParams.enableedit&&(N.value=!0,M.value=!0,H.value=b.toBoolean(V.editorParams.enableedit)&&!e.readonly&&!e.disabled),V.editorParams.enableFullScreen&&(B.value=b.toBoolean(V.editorParams.enableFullScreen)),V.editorParams.enablefullscreen&&(B.value=b.toBoolean(V.editorParams.enablefullscreen))),e.readonly&&(N.value=!1,M.value=!0);s(()=>e.data,e=>{if(e){const t={...b.editorParams};t.uploadparams&&(t.uploadParams=JSON.parse(t.uploadparams));const a=ibiz.util.file.calcFileUpDownUrl(b.context,b.params,e,t);O.value=a.uploadUrl}},{immediate:!0,deep:!0});const j=(e,t)=>{if(t)return!0},q=e=>e,J={excludeKeys:["group-video","emotion"],insertKeys:{index:60,keys:b.chatCompletion?["emoji","|","aichart"]:["emoji"]}},K={placeholder:b.placeHolder,readOnly:N.value?M.value:e.readonly,MENU_CONF:{uploadImage:{server:O.value,fieldName:"file",maxFileSize:10485760,maxNumberOfFiles:10,allowedFileTypes:[],headers:R.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 l=((e,t)=>{const a={...b.editorParams};return a.exportparams&&(a.exportParams=JSON.parse(a.exportparams)),t&&t.folder&&(a.osscat=t.folder),ibiz.util.file.calcFileUpDownUrl(b.context,b.params,e,a).downloadUrl})(e.data,t);let o=l.replace("%fileId%",t.id);const n=t.filename;if(ibiz.config.common.enableDownloadTicket){const i=await ibiz.util.file.getDownloadTicket(b.context,b.params,e.data,{fileId:t.id},b.downloadTicketParams);i&&i.ticket&&(o=l.replace("%fileId%",i.ticket),a(o,n,""))}else a(o,n,"")}},insertLink:{checkLink:j,parseLinkUrl:q},editLink:{checkLink:j,parseLinkUrl:q}}};let Q;r(()=>{const e=F.value;null!=e&&e.destroy()});const _=l=>{F.value=l,b.onCreated(F.value),l.setHtml(P.value),l.on("aiClick",()=>{(async()=>{const l=b.model.appDataEntityId;if(!l||!b.deACMode)return;const{contentToolbarItems:o,footerToolbarItems:n,questionToolbarItems:i,otherToolbarItems:s}=I(b.deACMode),{zIndex:r}=y(),c=r.increment(),d=await t.import("@ibiz-template-plugin/ai-chat");Q=d.chat||d.default.chat;let u,m="";Q.create({containerOptions:{zIndex:c},chatOptions:{caption:b.deACMode.logicName,context:{...b.context},params:{...b.params,srfactag:b.deACMode.codeName},appDataEntityId:l,contentToolbarItems:o,footerToolbarItems:n,questionToolbarItems:i,otherToolbarItems:s,appendCurData:"true"===b.editorParams.srfaiappendcurdata?e.data:void 0,appendCurContent:b.editorParams.srfaiappendcurcontent?w.fill(b.editorParams.srfaiappendcurcontent,b.context,b.params,e.data):void 0,question:async(e,t,a,l,o,n)=>{m=v(),u=new AbortController;const i=await ibiz.hub.getApp(t.srfappid).deService.getService(t,l.appDataEntityId);try{await i.aiChatSse(t=>{if(20===t.actionstate&&t.actionresult)e.addMessage({messageid:m,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:m,state:t.actionstate,type:"DEFAULT",role:"ASSISTANT",content:a[0].content||""})}else 40===t.actionstate&&e.replaceMessage({messageid:m,state:t.actionstate,type:"ERROR",role:"ASSISTANT",content:t.actionresult})},u,t,a,{messages:o,sessionid:n})}catch(t){e.replaceMessage({messageid:m,state:40,type:"ERROR",role:"ASSISTANT",content:t.message||ibiz.i18n.t("app.aiError")}),null==u||u.abort()}finally{return e.completeMessage(m,!0),!0}},abortQuestion:async e=>{null==u||u.abort(),await e.stopMessage({messageid:m,state:30,type:"DEFAULT",role:"ASSISTANT",content:""}),await e.completeMessage(m,!0)},action:(e,t)=>{"backfill"===e&&(N.value?P.value=t.realcontent||"":a("change",t.realcontent))},history:async(e,t,a)=>{const l=await ibiz.hub.getApp(e.srfappid).deService.getService(e,a.appDataEntityId),o=a.appendCurData?a.appendCurData:{},n=await l.aiChatHistory(e,t,o);if(n.data&&Array.isArray(n.data)){let e;n.data.forEach(t=>{if("TOOL"===t.role)e&&t.content&&Q.aiChat.updateRecommendPrompt(e,t.content);else{const a={messageid:v(),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 l=await ibiz.hub.getApp(e.srfappid).deService.getService(e,a.appDataEntityId),o=await l.aiChatRecommendPrompt(e,t,a.message);if(o.ok&&o.data){const e=o.data.choices;return e&&e.length>0?e[0]:null}return null},uploader:{onUpload:async(e,t,a)=>{const l=ibiz.util.file.calcFileUpDownUrl((null==a?void 0:a.context)||b.context,(null==a?void 0:a.params)||b.params,{}),o=ibiz.util.file.getUploadHeaders(),n=new FormData;return n.append("file",e),(await ibiz.net.axios({url:l.uploadUrl,method:"post",headers:o,data:n,onUploadProgress:e=>{const a=e.loaded/e.total*100;t(a)}})).data}},extendToolbarClick:async(e,t,a,l,o)=>{var n,i;const s=await T.exec(t.id,{view:b.view,ctrl:b.ctrl,context:C.create(a),params:l,data:[o],event:e},t.appId);if(s.closeView)b.view.closeView({ok:!0});else if(s.refresh)switch(s.refreshMode){case 1:b.view.callUIAction(E.REFRESH);break;case 2:null==(n=b.view.parentView)||n.callUIAction(E.REFRESH);break;case 3:null==(i=b.view.getTopView())||i.callUIAction(E.REFRESH)}return s}}})})()})},G=t=>{const l=t.getHtml(),o="<p><br></p>"===l?"":l;o===e.value||""===o&&f(e.value)||!N.value&&t.isFocused()&&a("change",o)},W=e=>{},X=e=>{a("focus")},Y=e=>{a("blur")},Z=(e,t)=>{alert("【".concat(ibiz.i18n.t("editor.html.wangEditor.customTips"),"】").concat(t," - ").concat(e))},$=(e,t,a)=>{a(!0)},ee=()=>{const e=F.value;null!=e&&e.disable()},te=()=>{const e=F.value;null!=e&&e.enable()};c(()=>{s(()=>e.value,(t,a)=>{t===a||"string"!=typeof e.value&&null!=t||d(null==t?()=>{P.value=""}:()=>{P.value=t})},{immediate:!0}),s(()=>e.disabled,(e,t)=>{e!==t&&(!0===e?ee():te())},{immediate:!0})});const ae=()=>{M.value=!M.value,M.value?ee():(te(),F.value.focus(),(()=>{var t,a;if(e.value){const l=e.value.indexOf("</p>");if(l>=0){const e=null==(t=F.value.selection.anchor)?void 0:t.offset,o=null==(a=F.value.selection.anchor)?void 0:a.path;0===e&&o.length>0&&0===o[0]&&F.value.move(l-3)}}})())},le=()=>{L.value=!L.value,d(()=>{M.value?ee():(te(),F.value.focus())})};return c(()=>{S(0,()=>{if(h.value&&A.value){const e=h.value.offsetHeight;x=new ResizeObserver(t=>{const a=t[0].contentRect.height;if(a!==k){const l={height:"".concat(e-t[0].contentRect.height+(0!==a?300:0),"px")};U.value=o.cssVarBlock(l),k=a}}),x.observe(A.value.selector)}})}),u(()=>{b.onDestroyed(),x&&x.disconnect(),Q&&Q.close()}),{ns:o,editorRef:F,mode:"default",valueHtml:P,toolbarConfig:J,editorConfig:K,handleCreated:_,handleChange:G,handleDestroyed:W,handleFocus:X,handleBlur:Y,customAlert:Z,customPaste:$,insertText:e=>{const t=F.value;null!=t&&t.insertText(e)},printHtml:()=>{const e=F.value;null!=e&&console.log(e.getHtml())},disable:ee,enable:te,renderHeaserToolbar:()=>N.value||B.value?l("div",{class:o.b("custom-toolbar")},[N.value&&H.value&&M.value?l("i",{class:"fa fa-edit","aria-hidden":"true",title:ibiz.i18n.t("editor.html.enableedit"),onClick:()=>ae()},null):null,B.value?L.value?l("i",{class:"fa fa-compress","aria-hidden":"true",title:ibiz.i18n.t("editor.html.reduce"),onClick:()=>le()},null):l("i",{class:"fa fa-expand","aria-hidden":"true",title:ibiz.i18n.t("editor.html.expand"),onClick:()=>le()},null):null]):null,renderEditorContent:()=>l("div",{class:o.b("content"),ref:"htmlContent",style:U.value},[l(m,{ref:"toolbarRef",editor:F.value,"default-config":J,mode:"default",class:o.b("toolbar")},null),l(p,{class:[o.b("editor"),o.is("readonly",M.value)],modelValue:P.value,"onUpdate:modelValue":e=>P.value=e,"default-config":K,mode:"default",onOnCreated:_,onOnChange:G,onOnDestroyed:W,onOnFocus:X,onOnBlur:Y,oncustomAlert:Z,oncustomPaste:$},null)]),renderFooter:()=>N.value?l("div",{class:[o.b("footer"),{[o.b("footer-dialog")]:L.value}]},[l("div",{class:o.be("footer","cancel"),onClick:()=>{e.value!==P.value?z({title:ibiz.i18n.t("editor.common.confirmCancel"),type:"warning",customClass:o.b("message"),message:l("div",{class:o.be("message","message-content")},[l("p",null,[ibiz.i18n.t("editor.common.confirmCancelPrompt")]),l("p",{class:o.bem("message","message-content","message-tip")},[ibiz.i18n.t("editor.common.cancelEditPrompt")])]),showCancelButton:!0,cancelButtonClass:o.be("message","message-cancel"),confirmButtonClass:o.be("message","message-comfire")}).then(()=>{P.value=e.value||"",ae()}).catch(()=>{F.value.focus()}):ae()}},[ibiz.i18n.t("app.cancel")]),l("div",{class:o.be("footer","save"),onClick:()=>(()=>{M.value=!0,F.value.disable();const e=P.value;a("change",e),L.value&&(L.value=!1)})()},[ibiz.i18n.t("app.save")])]):null,htmlContent:h,hasEnableEdit:N,cssVars:U,toolbarRef:A,isFullScreen:L,readonlyState:M,changeFullScreenState:le}},render(){return this.isFullScreen?l(o("el-dialog"),{modelValue:this.isFullScreen,"onUpdate:modelValue":e=>this.isFullScreen=e,width:"80%",top:"10vh",class:this.ns.b("dialog-full-screen"),onClose:()=>this.changeFullScreenState()},{default:()=>[l("div",{class:[this.ns.b(),{[this.ns.b("editor-readonly")]:this.readonlyState}]},[this.renderHeaserToolbar(),this.renderEditorContent(),this.hasEnableEdit&&!this.readonlyState?this.renderFooter():null])]}):l("div",{class:[this.ns.b(),{[this.ns.b("editor-readonly")]:this.readonlyState},this.ns.is("show-ai",!0)]},[this.renderHeaserToolbar(),this.renderEditorContent(),this.hasEnableEdit&&!this.readonlyState?this.renderFooter():null])}}))}}});
|
|
1
|
+
System.register(["vue","@wangeditor/editor-for-vue","qx-util","ramda","@ibiz-template/vue3-util","@ibiz-template/core","@ibiz-template/runtime","element-plus","./index-nGWWgnsc.js","lodash-es","@floating-ui/dom","interactjs","dayjs","qs","vuedraggable","@wangeditor/editor","vue-router","@ibiz-template/devtool","axios","dayjs/plugin/customParseFormat","vue-i18n","@ibiz-template/model-helper"],function(e,t){"use strict";var a,l,o,n,i,s,r,c,d,u,m,p,v,f,b,h,g,y,S,w,C,T,E,z,I;return{setters:[function(e){a=e.defineComponent,l=e.createVNode,o=e.resolveComponent,n=e.ref,i=e.shallowRef,s=e.watch,r=e.onBeforeUnmount,c=e.onMounted,d=e.nextTick,u=e.onUnmounted},function(e){m=e.Toolbar,p=e.Editor},function(e){v=e.createUUID},function(e){f=e.isNil},function(e){b=e.getEditorEmits,h=e.getHtmlProps,g=e.useNamespace,y=e.useUIStore},function(e){S=e.awaitTimeout,w=e.StringUtil,C=e.IBizContext},function(e){T=e.UIActionUtil,E=e.SysUIActionTag},function(e){z=e.ElMessageBox},function(e){I=e.c},null,null,null,null,null,null,null,null,null,null,null,null,null],execute:function(){e("default",a({name:"IBizHtml",props:h(),emits:b(),setup(e,{emit:a}){const o=g("html"),b=e.controller,h=n(),U=n({});let x=null,k=0;const A=n(),F=i(),P=n(""),D=ibiz.util.file.getUploadHeaders(),R=n({...D}),O=n(""),H=n(!0),N=n(!1),M=n(!1),B=n(!1),L=n(!1),V=b.model;V.editorParams&&(V.editorParams.enableEdit&&(N.value=!0,M.value=!0,H.value=b.toBoolean(V.editorParams.enableEdit)&&!e.readonly&&!e.disabled),V.editorParams.enableedit&&(N.value=!0,M.value=!0,H.value=b.toBoolean(V.editorParams.enableedit)&&!e.readonly&&!e.disabled),V.editorParams.enableFullScreen&&(B.value=b.toBoolean(V.editorParams.enableFullScreen)),V.editorParams.enablefullscreen&&(B.value=b.toBoolean(V.editorParams.enablefullscreen))),e.readonly&&(N.value=!1,M.value=!0);s(()=>e.data,e=>{if(e){const t={...b.editorParams};t.uploadparams&&(t.uploadParams=JSON.parse(t.uploadparams));const a=ibiz.util.file.calcFileUpDownUrl(b.context,b.params,e,t);O.value=a.uploadUrl}},{immediate:!0,deep:!0});const j=(e,t)=>{if(t)return!0},q=e=>e,J={excludeKeys:["group-video","emotion"],insertKeys:{index:60,keys:b.chatCompletion?["emoji","|","aichart"]:["emoji"]}},K={placeholder:b.placeHolder,readOnly:N.value?M.value:e.readonly,MENU_CONF:{uploadImage:{server:O.value,fieldName:"file",maxFileSize:10485760,maxNumberOfFiles:10,allowedFileTypes:[],headers:R.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 l=((e,t)=>{const a={...b.editorParams};return a.exportparams&&(a.exportParams=JSON.parse(a.exportparams)),t&&t.folder&&(a.osscat=t.folder),ibiz.util.file.calcFileUpDownUrl(b.context,b.params,e,a).downloadUrl})(e.data,t);let o=l.replace("%fileId%",t.id);const n=t.filename;if(ibiz.config.common.enableDownloadTicket){const i=await ibiz.util.file.getDownloadTicket(b.context,b.params,e.data,{fileId:t.id},b.downloadTicketParams);i&&i.ticket&&(o=l.replace("%fileId%",i.ticket),a(o,n,""))}else a(o,n,"")}},insertLink:{checkLink:j,parseLinkUrl:q},editLink:{checkLink:j,parseLinkUrl:q}}};let Q;r(()=>{const e=F.value;null!=e&&e.destroy()});const _=l=>{F.value=l,b.onCreated(F.value),l.setHtml(P.value),l.on("aiClick",()=>{(async()=>{const l=b.model.appDataEntityId;if(!l||!b.deACMode)return;const{contentToolbarItems:o,footerToolbarItems:n,questionToolbarItems:i,otherToolbarItems:s}=I(b.deACMode),{zIndex:r}=y(),c=r.increment(),d=await t.import("@ibiz-template-plugin/ai-chat");Q=d.chat||d.default.chat;let u,m="";Q.create({containerOptions:{zIndex:c},chatOptions:{caption:b.deACMode.logicName,context:{...b.context},params:{...b.params,srfactag:b.deACMode.codeName},appDataEntityId:l,contentToolbarItems:o,footerToolbarItems:n,questionToolbarItems:i,otherToolbarItems:s,appendCurData:"true"===b.editorParams.srfaiappendcurdata?e.data:void 0,appendCurContent:b.editorParams.srfaiappendcurcontent?w.fill(b.editorParams.srfaiappendcurcontent,b.context,b.params,e.data):void 0,question:async(e,t,a,l,o,n)=>{m=v(),u=new AbortController;const i=await ibiz.hub.getApp(t.srfappid).deService.getService(t,l.appDataEntityId);try{await i.aiChatSse(t=>{if(20===t.actionstate&&t.actionresult)e.addMessage({messageid:m,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:m,state:t.actionstate,type:"DEFAULT",role:"ASSISTANT",content:a[0].content||""})}else 40===t.actionstate&&e.replaceMessage({messageid:m,state:t.actionstate,type:"ERROR",role:"ASSISTANT",content:t.actionresult})},u,t,a,{messages:o,sessionid:n})}catch(t){e.replaceMessage({messageid:m,state:40,type:"ERROR",role:"ASSISTANT",content:t.message||ibiz.i18n.t("app.aiError")}),null==u||u.abort()}finally{return e.completeMessage(m,!0),!0}},abortQuestion:async e=>{null==u||u.abort(),await e.stopMessage({messageid:m,state:30,type:"DEFAULT",role:"ASSISTANT",content:""}),await e.completeMessage(m,!0)},action:(e,t)=>{"backfill"===e&&(N.value?P.value=t.realcontent||"":a("change",t.realcontent))},history:async(e,t,a)=>{const l=await ibiz.hub.getApp(e.srfappid).deService.getService(e,a.appDataEntityId),o=a.appendCurData?a.appendCurData:{},n=await l.aiChatHistory(e,t,o);if(n.data&&Array.isArray(n.data)){let e;n.data.forEach(t=>{if("TOOL"===t.role)e&&t.content&&Q.aiChat.updateRecommendPrompt(e,t.content);else{const a={messageid:v(),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 l=await ibiz.hub.getApp(e.srfappid).deService.getService(e,a.appDataEntityId),o=await l.aiChatRecommendPrompt(e,t,a.message);if(o.ok&&o.data){const e=o.data.choices;return e&&e.length>0?e[0]:null}return null},uploader:{onUpload:async(e,t,a)=>{const l=ibiz.util.file.calcFileUpDownUrl((null==a?void 0:a.context)||b.context,(null==a?void 0:a.params)||b.params,{}),o=ibiz.util.file.getUploadHeaders(),n=new FormData;return n.append("file",e),(await ibiz.net.axios({url:l.uploadUrl,method:"post",headers:o,data:n,onUploadProgress:e=>{const a=e.loaded/e.total*100;t(a)}})).data}},extendToolbarClick:async(e,t,a,l,o)=>{var n,i;const s=await T.exec(t.id,{view:b.view,ctrl:b.ctrl,context:C.create(a),params:l,data:[o],event:e},t.appId);if(s.closeView)b.view.closeView({ok:!0});else if(s.refresh)switch(s.refreshMode){case 1:b.view.callUIAction(E.REFRESH);break;case 2:null==(n=b.view.parentView)||n.callUIAction(E.REFRESH);break;case 3:null==(i=b.view.getTopView())||i.callUIAction(E.REFRESH)}return s}}})})()})},G=t=>{const l=t.getHtml(),o="<p><br></p>"===l?"":l;o===e.value||""===o&&f(e.value)||!N.value&&t.isFocused()&&a("change",o)},W=e=>{},X=e=>{a("focus")},Y=e=>{a("blur")},Z=(e,t)=>{alert("【".concat(ibiz.i18n.t("editor.html.wangEditor.customTips"),"】").concat(t," - ").concat(e))},$=(e,t,a)=>{a(!0)},ee=()=>{const e=F.value;null!=e&&e.disable()},te=()=>{const e=F.value;null!=e&&e.enable()};c(()=>{s(()=>e.value,(t,a)=>{t===a||"string"!=typeof e.value&&null!=t||d(null==t?()=>{P.value=""}:()=>{P.value=t})},{immediate:!0}),s(()=>e.disabled,(e,t)=>{e!==t&&(!0===e?ee():te())},{immediate:!0})});const ae=()=>{M.value=!M.value,M.value?ee():(te(),F.value.focus(),(()=>{var t,a;if(e.value){const l=e.value.indexOf("</p>");if(l>=0){const e=null==(t=F.value.selection.anchor)?void 0:t.offset,o=null==(a=F.value.selection.anchor)?void 0:a.path;0===e&&o.length>0&&0===o[0]&&F.value.move(l-3)}}})())},le=()=>{L.value=!L.value,d(()=>{M.value?ee():(te(),F.value.focus())})};return c(()=>{S(0,()=>{if(h.value&&A.value){const e=h.value.offsetHeight;x=new ResizeObserver(t=>{const a=t[0].contentRect.height;if(a!==k){const l={height:"".concat(e-t[0].contentRect.height+(0!==a?300:0),"px")};U.value=o.cssVarBlock(l),k=a}}),x.observe(A.value.selector)}})}),u(()=>{b.onDestroyed(),x&&x.disconnect(),Q&&Q.close()}),{ns:o,editorRef:F,mode:"default",valueHtml:P,toolbarConfig:J,editorConfig:K,handleCreated:_,handleChange:G,handleDestroyed:W,handleFocus:X,handleBlur:Y,customAlert:Z,customPaste:$,insertText:e=>{const t=F.value;null!=t&&t.insertText(e)},printHtml:()=>{const e=F.value;null!=e&&console.log(e.getHtml())},disable:ee,enable:te,renderHeaserToolbar:()=>N.value||B.value?l("div",{class:o.b("custom-toolbar")},[N.value&&H.value&&M.value?l("i",{class:"fa fa-edit","aria-hidden":"true",title:ibiz.i18n.t("editor.html.enableedit"),onClick:()=>ae()},null):null,B.value?L.value?l("i",{class:"fa fa-compress","aria-hidden":"true",title:ibiz.i18n.t("editor.html.reduce"),onClick:()=>le()},null):l("i",{class:"fa fa-expand","aria-hidden":"true",title:ibiz.i18n.t("editor.html.expand"),onClick:()=>le()},null):null]):null,renderEditorContent:()=>l("div",{class:o.b("content"),ref:"htmlContent",style:U.value},[l(m,{ref:"toolbarRef",editor:F.value,"default-config":J,mode:"default",class:o.b("toolbar")},null),l(p,{class:[o.b("editor"),o.is("readonly",M.value)],modelValue:P.value,"onUpdate:modelValue":e=>P.value=e,"default-config":K,mode:"default",onOnCreated:_,onOnChange:G,onOnDestroyed:W,onOnFocus:X,onOnBlur:Y,oncustomAlert:Z,oncustomPaste:$},null)]),renderFooter:()=>N.value?l("div",{class:[o.b("footer"),{[o.b("footer-dialog")]:L.value}]},[l("div",{class:o.be("footer","cancel"),onClick:()=>{e.value!==P.value?z({title:ibiz.i18n.t("editor.common.confirmCancel"),type:"warning",customClass:o.b("message"),message:l("div",{class:o.be("message","message-content")},[l("p",null,[ibiz.i18n.t("editor.common.confirmCancelPrompt")]),l("p",{class:o.bem("message","message-content","message-tip")},[ibiz.i18n.t("editor.common.cancelEditPrompt")])]),showCancelButton:!0,cancelButtonClass:o.be("message","message-cancel"),confirmButtonClass:o.be("message","message-comfire")}).then(()=>{P.value=e.value||"",ae()}).catch(()=>{F.value.focus()}):ae()}},[ibiz.i18n.t("app.cancel")]),l("div",{class:o.be("footer","save"),onClick:()=>(()=>{M.value=!0,F.value.disable();const e=P.value;a("change",e),L.value&&(L.value=!1)})()},[ibiz.i18n.t("app.save")])]):null,htmlContent:h,hasEnableEdit:N,cssVars:U,toolbarRef:A,isFullScreen:L,readonlyState:M,changeFullScreenState:le}},render(){return this.isFullScreen?l(o("el-dialog"),{modelValue:this.isFullScreen,"onUpdate:modelValue":e=>this.isFullScreen=e,width:"80%",top:"10vh",class:this.ns.b("dialog-full-screen"),onClose:()=>this.changeFullScreenState()},{default:()=>[l("div",{class:[this.ns.b(),{[this.ns.b("editor-readonly")]:this.readonlyState}]},[this.renderHeaserToolbar(),this.renderEditorContent(),this.hasEnableEdit&&!this.readonlyState?this.renderFooter():null])]}):l("div",{class:[this.ns.b(),{[this.ns.b("editor-readonly")]:this.readonlyState},this.ns.is("show-ai",!0)]},[this.renderHeaserToolbar(),this.renderEditorContent(),this.hasEnableEdit&&!this.readonlyState?this.renderFooter():null])}}))}}});
|