@ibiz-template/vue3-components 0.7.41-alpha.22 → 0.7.41-alpha.23

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.
@@ -215,10 +215,7 @@ const IBizCode = /* @__PURE__ */ defineComponent({
215
215
  history: async (ctx, param, other) => {
216
216
  const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
217
217
  const historyData = other.appendCurData ? other.appendCurData : {};
218
- const result = await deService.aiChatHistory(ctx, param, {
219
- historyData,
220
- sessionid: other.sessionid
221
- });
218
+ const result = await deService.aiChatHistory(ctx, param, historyData);
222
219
  if (result.data && Array.isArray(result.data)) {
223
220
  let preMsg;
224
221
  result.data.forEach((item) => {
@@ -305,10 +305,7 @@ const IBizHtml = /* @__PURE__ */ defineComponent({
305
305
  history: async (ctx, param, other) => {
306
306
  const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
307
307
  const historyData = other.appendCurData ? other.appendCurData : {};
308
- const result = await deService.aiChatHistory(ctx, param, {
309
- historyData,
310
- sessionid: other.sessionid
311
- });
308
+ const result = await deService.aiChatHistory(ctx, param, historyData);
312
309
  if (result.data && Array.isArray(result.data)) {
313
310
  let preMsg;
314
311
  result.data.forEach((item) => {
@@ -274,10 +274,7 @@ const IBizInput = /* @__PURE__ */ defineComponent({
274
274
  history: async (ctx, param, other) => {
275
275
  const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
276
276
  const historyData = other.appendCurData ? other.appendCurData : {};
277
- const result = await deService.aiChatHistory(ctx, param, {
278
- historyData,
279
- sessionid: other.sessionid
280
- });
277
+ const result = await deService.aiChatHistory(ctx, param, historyData);
281
278
  if (result.data && Array.isArray(result.data)) {
282
279
  let preMsg;
283
280
  result.data.forEach((item) => {
@@ -348,10 +348,11 @@ class AppUtil {
348
348
  history: async (ctx, param, other) => {
349
349
  const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
350
350
  const historyData = other.appendCurData ? other.appendCurData : {};
351
- const result = await deService.aiChatHistory(ctx, param, {
352
- historyData,
353
- sessionid: other.sessionid
354
- });
351
+ const result = await deService.aiChatHistory(
352
+ ctx,
353
+ param,
354
+ historyData
355
+ );
355
356
  if (result.data && Array.isArray(result.data)) {
356
357
  let preMsg;
357
358
  result.data.forEach((item) => {
@@ -217,10 +217,7 @@ const IBizCode = /* @__PURE__ */ vue.defineComponent({
217
217
  history: async (ctx, param, other) => {
218
218
  const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
219
219
  const historyData = other.appendCurData ? other.appendCurData : {};
220
- const result = await deService.aiChatHistory(ctx, param, {
221
- historyData,
222
- sessionid: other.sessionid
223
- });
220
+ const result = await deService.aiChatHistory(ctx, param, historyData);
224
221
  if (result.data && Array.isArray(result.data)) {
225
222
  let preMsg;
226
223
  result.data.forEach((item) => {
@@ -309,10 +309,7 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
309
309
  history: async (ctx, param, other) => {
310
310
  const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
311
311
  const historyData = other.appendCurData ? other.appendCurData : {};
312
- const result = await deService.aiChatHistory(ctx, param, {
313
- historyData,
314
- sessionid: other.sessionid
315
- });
312
+ const result = await deService.aiChatHistory(ctx, param, historyData);
316
313
  if (result.data && Array.isArray(result.data)) {
317
314
  let preMsg;
318
315
  result.data.forEach((item) => {
@@ -276,10 +276,7 @@ const IBizInput = /* @__PURE__ */ vue.defineComponent({
276
276
  history: async (ctx, param, other) => {
277
277
  const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
278
278
  const historyData = other.appendCurData ? other.appendCurData : {};
279
- const result = await deService.aiChatHistory(ctx, param, {
280
- historyData,
281
- sessionid: other.sessionid
282
- });
279
+ const result = await deService.aiChatHistory(ctx, param, historyData);
283
280
  if (result.data && Array.isArray(result.data)) {
284
281
  let preMsg;
285
282
  result.data.forEach((item) => {
@@ -350,10 +350,11 @@ class AppUtil {
350
350
  history: async (ctx, param, other) => {
351
351
  const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
352
352
  const historyData = other.appendCurData ? other.appendCurData : {};
353
- const result = await deService.aiChatHistory(ctx, param, {
354
- historyData,
355
- sessionid: other.sessionid
356
- });
353
+ const result = await deService.aiChatHistory(
354
+ ctx,
355
+ param,
356
+ historyData
357
+ );
357
358
  if (result.data && Array.isArray(result.data)) {
358
359
  let preMsg;
359
360
  result.data.forEach((item) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template/vue3-components",
3
- "version": "0.7.41-alpha.22",
3
+ "version": "0.7.41-alpha.23",
4
4
  "description": "web端组件库(vue3)",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "es/index.mjs",
@@ -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-zV2qOpaC.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.ref,o=e.shallowRef,n=e.watch,i=e.onBeforeUnmount,s=e.onMounted,r=e.nextTick,c=e.onUnmounted,d=e.createVNode,u=e.resolveComponent},function(e){m=e.Toolbar,p=e.Editor},function(e){v=e.createUUID},function(e){f=e.isNil},function(e){b=e.getHtmlProps,h=e.getEditorEmits,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:b(),emits:h(),setup(e,{emit:a}){const u=g("html"),b=e.controller,h=l(),U=l({});let x=null,k=0;const A=l(),F=o(),P=l(""),D=ibiz.util.file.getUploadHeaders(),R=l({...D}),O=l(""),H=l(!0),N=l(!1),M=l(!1),B=l(!1),L=l(!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);n((()=>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;i((()=>{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,{historyData:o,sessionid:a.sessionid});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()};s((()=>{n((()=>e.value),((t,a)=>{t===a||"string"!=typeof e.value&&null!=t||r(null==t?()=>{P.value=""}:()=>{P.value=t})}),{immediate:!0}),n((()=>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,r((()=>{M.value?ee():(te(),F.value.focus())}))};return s((()=>{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=u.cssVarBlock(l),k=a}})),x.observe(A.value.selector)}}))})),c((()=>{b.onDestroyed(),x&&x.disconnect(),Q&&Q.close()})),{ns:u,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?d("div",{class:u.b("custom-toolbar")},[N.value&&H.value&&M.value?d("i",{class:"fa fa-edit","aria-hidden":"true",title:ibiz.i18n.t("editor.html.enableedit"),onClick:()=>ae()},null):null,B.value?L.value?d("i",{class:"fa fa-compress","aria-hidden":"true",title:ibiz.i18n.t("editor.html.reduce"),onClick:()=>le()},null):d("i",{class:"fa fa-expand","aria-hidden":"true",title:ibiz.i18n.t("editor.html.expand"),onClick:()=>le()},null):null]):null,renderEditorContent:()=>d("div",{class:u.b("content"),ref:"htmlContent",style:U.value},[d(m,{ref:"toolbarRef",editor:F.value,"default-config":J,mode:"default",class:u.b("toolbar")},null),d(p,{class:[u.b("editor"),u.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?d("div",{class:[u.b("footer"),{[u.b("footer-dialog")]:L.value}]},[d("div",{class:u.be("footer","cancel"),onClick:()=>{e.value!==P.value?z({title:ibiz.i18n.t("editor.common.confirmCancel"),type:"warning",customClass:u.b("message"),message:d("div",{class:u.be("message","message-content")},[d("p",null,[ibiz.i18n.t("editor.common.confirmCancelPrompt")]),d("p",{class:u.bem("message","message-content","message-tip")},[ibiz.i18n.t("editor.common.cancelEditPrompt")])]),showCancelButton:!0,cancelButtonClass:u.be("message","message-cancel"),confirmButtonClass:u.be("message","message-comfire")}).then((()=>{P.value=e.value||"",ae()})).catch((()=>{F.value.focus()})):ae()}},[ibiz.i18n.t("app.cancel")]),d("div",{class:u.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?d(u("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:()=>[d("div",{class:[this.ns.b(),{[this.ns.b("editor-readonly")]:this.readonlyState}]},[this.renderHeaserToolbar(),this.renderEditorContent(),this.hasEnableEdit&&!this.readonlyState?this.renderFooter():null])]}):d("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])}}))}}}));