@ibiz-template/vue3-components 0.7.8 → 0.7.9

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.
Files changed (42) hide show
  1. package/dist/index-GAvjatsT.js +4 -0
  2. package/dist/index-dsmTOMa5.js +1 -0
  3. package/dist/index-sGpuIVYT.js +1 -0
  4. package/dist/index.min.css +1 -1
  5. package/dist/index.system.min.js +1 -1
  6. package/dist/wang-editor-mq8sQSDK.js +1 -0
  7. package/dist/{xlsx-util-3My8gW7-.js → xlsx-util-Fc3O95jH.js} +1 -1
  8. package/es/control/dashboard/custom-dashboard-container/custom-dashboard-container.d.ts +2 -1
  9. package/es/control/dashboard/custom-dashboard-container/custom-dashboard-container.mjs +7 -3
  10. package/es/control/dashboard/dashboard-design/dashboard-design.mjs +22 -28
  11. package/es/control/dashboard/portlet/chart-portlet/chart-portlet.mjs +13 -1
  12. package/es/control/dashboard/portlet/list-portlet/list-portlet.mjs +13 -1
  13. package/es/control/dashboard/portlet/portlet-layout/portlet-layout.d.ts +1 -0
  14. package/es/control/dashboard/portlet/portlet-layout/portlet-layout.mjs +10 -1
  15. package/es/control/dashboard/portlet/view-portlet/view-portlet.mjs +13 -1
  16. package/es/editor/html/html-editor.controller.d.ts +25 -2
  17. package/es/editor/html/html-editor.controller.mjs +38 -1
  18. package/es/editor/html/wang-editor/ai/ai-modules.d.ts +9 -0
  19. package/es/editor/html/wang-editor/ai/ai-modules.mjs +32 -0
  20. package/es/editor/html/wang-editor/wang-editor.mjs +96 -3
  21. package/es/editor/text-box/input/input.mjs +9 -5
  22. package/es/locale/en/index.d.ts +204 -0
  23. package/es/locale/en/index.mjs +205 -0
  24. package/es/locale/zh-CN/index.d.ts +204 -0
  25. package/es/locale/zh-CN/index.mjs +205 -0
  26. package/lib/control/dashboard/custom-dashboard-container/custom-dashboard-container.cjs +6 -2
  27. package/lib/control/dashboard/dashboard-design/dashboard-design.cjs +22 -28
  28. package/lib/control/dashboard/portlet/chart-portlet/chart-portlet.cjs +12 -0
  29. package/lib/control/dashboard/portlet/list-portlet/list-portlet.cjs +12 -0
  30. package/lib/control/dashboard/portlet/portlet-layout/portlet-layout.cjs +10 -1
  31. package/lib/control/dashboard/portlet/view-portlet/view-portlet.cjs +12 -0
  32. package/lib/editor/html/html-editor.controller.cjs +37 -0
  33. package/lib/editor/html/wang-editor/ai/ai-modules.cjs +34 -0
  34. package/lib/editor/html/wang-editor/wang-editor.cjs +95 -2
  35. package/lib/editor/text-box/input/input.cjs +9 -5
  36. package/lib/locale/en/index.cjs +205 -0
  37. package/lib/locale/zh-CN/index.cjs +205 -0
  38. package/package.json +7 -7
  39. package/dist/index-Rqr5SnvQ.js +0 -1
  40. package/dist/index-oydyrl0O.js +0 -4
  41. package/dist/index-x-jLCilD.js +0 -1
  42. package/dist/wang-editor-XnzvMz46.js +0 -1
@@ -2056,6 +2056,7 @@ export declare const CustomDashboardContainer: import("vue").DefineComponent<{
2056
2056
  ownerType: string;
2057
2057
  ownerId: string;
2058
2058
  loadCustomModelData: () => Promise<IData>;
2059
+ resetCustomModelData: () => Promise<IData>;
2059
2060
  saveCustomModelData: (model: IData[], config?: IData | undefined) => Promise<IData>;
2060
2061
  };
2061
2062
  isShowDesign: import("vue").Ref<boolean>;
@@ -2064,7 +2065,7 @@ export declare const CustomDashboardContainer: import("vue").DefineComponent<{
2064
2065
  showTypeDir: import("vue").Ref<boolean>;
2065
2066
  openDesign: () => void;
2066
2067
  onSaved: (args: IData) => Promise<void>;
2067
- onReset: () => void;
2068
+ onReset: () => Promise<void>;
2068
2069
  clickCollapse: (type: string) => void;
2069
2070
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
2070
2071
  modelData: {
@@ -1,4 +1,4 @@
1
- import { reactive, ref, computed, onMounted, resolveComponent, createVNode, defineComponent } from 'vue';
1
+ import { reactive, ref, nextTick, computed, onMounted, resolveComponent, createVNode, defineComponent } from 'vue';
2
2
  import { CustomDashboardController } from '@ibiz-template/runtime';
3
3
  import { useNamespace } from '@ibiz-template/vue3-util';
4
4
  import './custom-dashboard-container.css';
@@ -65,13 +65,17 @@ const CustomDashboardContainer = /* @__PURE__ */ defineComponent({
65
65
  model: tempModelDatas,
66
66
  config: args.config
67
67
  });
68
+ await props.dashboard.evt.emit("onSavePortlet", void 0);
68
69
  emit("changed", {
69
70
  model: tempModelDatas
70
71
  });
71
72
  };
72
- const onReset = () => {
73
+ const onReset = async () => {
74
+ isInited.value = false;
73
75
  isShowDesign.value = false;
74
- props.dashboard.resetPortlets();
76
+ await props.dashboard.resetPortlets();
77
+ await nextTick();
78
+ isInited.value = true;
75
79
  };
76
80
  const isShowDefault = computed(() => {
77
81
  return customC.customModelData.length === 0;
@@ -100,12 +100,25 @@ const DashboardDesign = /* @__PURE__ */ defineComponent({
100
100
  const list2 = [];
101
101
  const app = ibiz.hub.getApp(ibiz.env.appId);
102
102
  if (app.model.appPortletCats && app.model.appPortlets) {
103
+ const isDEView = customC.model.appDataEntityId;
104
+ const categoryTag = props.dashboard.controlParams.categorytag;
103
105
  app.model.appPortlets.forEach((portlet) => {
104
106
  var _a;
107
+ if (!isDEView && !portlet.enableAppDashboard) {
108
+ return;
109
+ }
110
+ if (isDEView && !portlet.enableDEDashboard) {
111
+ return;
112
+ }
105
113
  const portletCat = (_a = app.model.appPortletCats) == null ? void 0 : _a.find((cat) => {
106
114
  var _a2;
107
115
  return cat.codeName === ((_a2 = portlet.appPortletCat) == null ? void 0 : _a2.codeName);
108
116
  });
117
+ if (categoryTag) {
118
+ if (!portletCat || portletCat.codeName !== categoryTag) {
119
+ return;
120
+ }
121
+ }
109
122
  const temp = {
110
123
  type: "app",
111
124
  portletCodeName: portlet.codeName,
@@ -143,11 +156,8 @@ const DashboardDesign = /* @__PURE__ */ defineComponent({
143
156
  if (filterVal.value) {
144
157
  tempOpens = [filterVal.value];
145
158
  } else {
146
- list.value.forEach((item, index) => {
147
- tempOpens.push(item.type + index);
148
- item.children.forEach((child, index2) => {
149
- tempOpens.push(child.type + index2);
150
- });
159
+ groups.value.forEach((item, index) => {
160
+ tempOpens.push(item.value + index);
151
161
  });
152
162
  }
153
163
  return tempOpens;
@@ -220,8 +230,7 @@ const DashboardDesign = /* @__PURE__ */ defineComponent({
220
230
  return !!model;
221
231
  };
222
232
  const onReset = async () => {
223
- customC.portletConfig = {};
224
- const res = await customC.saveCustomModelData([]);
233
+ const res = await customC.resetCustomModelData();
225
234
  layoutModel.value = res.model;
226
235
  layoutConfig.value = res.config;
227
236
  emit("reset");
@@ -362,32 +371,17 @@ const DashboardDesign = /* @__PURE__ */ defineComponent({
362
371
  "class": this.ns.is("no-filter", true),
363
372
  "default-openeds": this.defaultOpens,
364
373
  "key": "default"
365
- }, _isSlot(_slot2 = this.list.map((item, index) => {
374
+ }, _isSlot(_slot2 = this.groups.map((group, index) => {
366
375
  return createVNode(resolveComponent("el-sub-menu"), {
367
- "key": item.type + index,
368
- "index": item.type + index
376
+ "key": group.value + index,
377
+ "index": group.value + index
369
378
  }, {
370
379
  title: () => {
371
- if (item.type === "app") {
372
- return ibiz.i18n.t("control.dashboard.dashboardDesign.global");
373
- }
374
- return item.name;
380
+ return group.name;
375
381
  },
376
382
  default: () => {
377
- return item.children.map((child, index2) => {
378
- return createVNode(resolveComponent("el-sub-menu"), {
379
- "key": child.type + index2,
380
- "index": child.type + index2
381
- }, {
382
- title: () => {
383
- return child.name;
384
- },
385
- default: () => {
386
- return child.children.map((child2) => {
387
- return renderElMenuItem(child2);
388
- });
389
- }
390
- });
383
+ return group.children.map((child) => {
384
+ return renderElMenuItem(child);
391
385
  });
392
386
  }
393
387
  });
@@ -1,4 +1,4 @@
1
- import { isVNode, resolveComponent, h, createVNode, defineComponent } from 'vue';
1
+ import { isVNode, onMounted, onBeforeUnmount, resolveComponent, h, createVNode, defineComponent } from 'vue';
2
2
  import { useNamespace } from '@ibiz-template/vue3-util';
3
3
  import { ChartPortletController, ControlType } from '@ibiz-template/runtime';
4
4
 
@@ -24,6 +24,18 @@ const ChartPortlet = /* @__PURE__ */ defineComponent({
24
24
  const chart = (_b = props.modelData.controls) == null ? void 0 : _b.find((item) => {
25
25
  return item.controlType === ControlType.CHART;
26
26
  });
27
+ let timerTag;
28
+ onMounted(() => {
29
+ const timer = props.controller.model.timer;
30
+ if (timer && timer > 0) {
31
+ timerTag = setInterval(() => {
32
+ props.controller.refresh();
33
+ }, timer);
34
+ }
35
+ });
36
+ onBeforeUnmount(() => {
37
+ clearInterval(timerTag);
38
+ });
27
39
  return {
28
40
  ns,
29
41
  chart
@@ -1,4 +1,4 @@
1
- import { isVNode, resolveComponent, h, createVNode, defineComponent } from 'vue';
1
+ import { isVNode, onMounted, onBeforeUnmount, resolveComponent, h, createVNode, defineComponent } from 'vue';
2
2
  import { useNamespace } from '@ibiz-template/vue3-util';
3
3
  import { ListPortletController, ControlType } from '@ibiz-template/runtime';
4
4
 
@@ -24,6 +24,18 @@ const ListPortlet = /* @__PURE__ */ defineComponent({
24
24
  const list = (_b = props.modelData.controls) == null ? void 0 : _b.find((item) => {
25
25
  return item.controlType === ControlType.LIST;
26
26
  });
27
+ let timerTag;
28
+ onMounted(() => {
29
+ const timer = props.controller.model.timer;
30
+ if (timer && timer > 0) {
31
+ timerTag = setInterval(() => {
32
+ props.controller.refresh();
33
+ }, timer);
34
+ }
35
+ });
36
+ onBeforeUnmount(() => {
37
+ clearInterval(timerTag);
38
+ });
27
39
  return {
28
40
  ns,
29
41
  list
@@ -12,6 +12,7 @@ export declare const PortletLayout: import("vue").DefineComponent<{
12
12
  }, {
13
13
  c: PortletPartController<import("@ibiz/model-core").IDBPortletPart>;
14
14
  ns: import("@ibiz-template/core").Namespace;
15
+ popperClass: import("vue").ComputedRef<string[]>;
15
16
  portletType: string;
16
17
  isShowHeader: import("vue").ComputedRef<string | import("@ibiz/model-core").ISysImage | import("@ibiz/model-core").IUIActionGroup | undefined>;
17
18
  onActionClick: (detail: IUIActionGroupDetail, event: MouseEvent) => Promise<void>;
@@ -17,6 +17,14 @@ const PortletLayout = /* @__PURE__ */ defineComponent({
17
17
  const ns = useNamespace("portlet-layout");
18
18
  const portletType = "portlet-".concat((_a = props.controller.model.portletType) == null ? void 0 : _a.toLowerCase());
19
19
  const c = props.controller;
20
+ const popperClass = computed(() => {
21
+ const classNames = [ns.em("toolbar", "".concat(portletType, "-").concat(c.model.id))];
22
+ const {
23
+ codeName
24
+ } = c.dashboard.view.model;
25
+ classNames.push(ns.em("toolbar", codeName));
26
+ return classNames;
27
+ });
20
28
  const isShowHeader = computed(() => {
21
29
  return c.model.showTitleBar && (c.model.title || c.model.sysImage) || c.model.uiactionGroup;
22
30
  });
@@ -26,6 +34,7 @@ const PortletLayout = /* @__PURE__ */ defineComponent({
26
34
  return {
27
35
  c,
28
36
  ns,
37
+ popperClass,
29
38
  portletType,
30
39
  isShowHeader,
31
40
  onActionClick
@@ -59,7 +68,7 @@ const PortletLayout = /* @__PURE__ */ defineComponent({
59
68
  "action-details": model.uiactionGroup.uiactionGroupDetails,
60
69
  "actions-state": state.actionGroupState,
61
70
  "mode": model.actionGroupExtractMode === "ITEMS" ? "dropdown" : "buttons",
62
- "popperClass": this.ns.em("toolbar", "".concat(this.portletType, "-").concat(model.id)),
71
+ "popperClass": this.popperClass,
63
72
  "onActionClick": this.onActionClick
64
73
  }, null)])]), createVNode("div", {
65
74
  "key": "content",
@@ -1,4 +1,4 @@
1
- import { isVNode, resolveComponent, h, createVNode, defineComponent } from 'vue';
1
+ import { isVNode, onMounted, onBeforeUnmount, resolveComponent, h, createVNode, defineComponent } from 'vue';
2
2
  import { useNamespace } from '@ibiz-template/vue3-util';
3
3
  import { ViewPortletController } from '@ibiz-template/runtime';
4
4
 
@@ -22,6 +22,18 @@ const ViewPortlet = /* @__PURE__ */ defineComponent({
22
22
  var _a;
23
23
  const ns = useNamespace("portlet-".concat((_a = props.modelData.portletType) == null ? void 0 : _a.toLowerCase()));
24
24
  const view = props.modelData.portletAppView;
25
+ let timerTag;
26
+ onMounted(() => {
27
+ const timer = props.controller.model.timer;
28
+ if (timer && timer > 0) {
29
+ timerTag = setInterval(() => {
30
+ props.controller.refresh();
31
+ }, timer);
32
+ }
33
+ });
34
+ onBeforeUnmount(() => {
35
+ clearInterval(timerTag);
36
+ });
25
37
  return {
26
38
  ns,
27
39
  view
@@ -1,5 +1,5 @@
1
- import { EditorController } from '@ibiz-template/runtime';
2
- import { IHtml } from '@ibiz/model-core';
1
+ import { EditorController, IAppDEService } from '@ibiz-template/runtime';
2
+ import { IAppDEACMode, IHtml } from '@ibiz/model-core';
3
3
  /**
4
4
  * html框编辑器控制器
5
5
  *
@@ -16,5 +16,28 @@ export declare class HtmlEditorController extends EditorController<IHtml> {
16
16
  * 下载参数
17
17
  */
18
18
  exportParams?: IParams;
19
+ /**
20
+ * 应用实体服务
21
+ *
22
+ * @type {IAppDEService}
23
+ * @memberof HtmlEditorController
24
+ */
25
+ deService?: IAppDEService;
26
+ /**
27
+ * 自填模式
28
+ *
29
+ * @author chitanda
30
+ * @date 2023-10-12 10:10:52
31
+ * @type {IAppDEACMode}
32
+ */
33
+ deACMode?: IAppDEACMode;
34
+ /**
35
+ * AI 聊天自填模式
36
+ *
37
+ * @author chitanda
38
+ * @date 2023-10-12 10:10:37
39
+ * @type {boolean}
40
+ */
41
+ chatCompletion: boolean;
19
42
  protected onInit(): Promise<void>;
20
43
  }
@@ -1,4 +1,4 @@
1
- import { EditorController } from '@ibiz-template/runtime';
1
+ import { EditorController, getDeACMode } from '@ibiz-template/runtime';
2
2
 
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -18,6 +18,29 @@ class HtmlEditorController extends EditorController {
18
18
  * 下载参数
19
19
  */
20
20
  __publicField(this, "exportParams");
21
+ /**
22
+ * 应用实体服务
23
+ *
24
+ * @type {IAppDEService}
25
+ * @memberof HtmlEditorController
26
+ */
27
+ __publicField(this, "deService");
28
+ /**
29
+ * 自填模式
30
+ *
31
+ * @author chitanda
32
+ * @date 2023-10-12 10:10:52
33
+ * @type {IAppDEACMode}
34
+ */
35
+ __publicField(this, "deACMode");
36
+ /**
37
+ * AI 聊天自填模式
38
+ *
39
+ * @author chitanda
40
+ * @date 2023-10-12 10:10:37
41
+ * @type {boolean}
42
+ */
43
+ __publicField(this, "chatCompletion", false);
21
44
  }
22
45
  async onInit() {
23
46
  await super.onInit();
@@ -46,6 +69,20 @@ class HtmlEditorController extends EditorController {
46
69
  }
47
70
  }
48
71
  }
72
+ const model = this.model;
73
+ if (model.appDEACModeId) {
74
+ this.deACMode = await getDeACMode(
75
+ model.appDEACModeId,
76
+ model.appDataEntityId,
77
+ this.context.srfappid
78
+ );
79
+ if (this.deACMode) {
80
+ if (this.deACMode.actype === "CHATCOMPLETION") {
81
+ this.deService = await ibiz.hub.getApp(model.appId).deService.getService(this.context, model.appDataEntityId);
82
+ this.chatCompletion = true;
83
+ }
84
+ }
85
+ }
49
86
  }
50
87
  }
51
88
 
@@ -0,0 +1,9 @@
1
+ import { IButtonMenu, IDomEditor } from '@wangeditor/editor';
2
+ export declare class AIMenu implements IButtonMenu {
3
+ title: string;
4
+ tag: string;
5
+ isActive(editor: IDomEditor): boolean;
6
+ getValue(editor: IDomEditor): string | boolean;
7
+ isDisabled(editor: IDomEditor): boolean;
8
+ exec(editor: IDomEditor, value: string | boolean): void;
9
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __publicField = (obj, key, value) => {
5
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
+ return value;
7
+ };
8
+ class AIMenu {
9
+ constructor() {
10
+ // TS 语法
11
+ __publicField(this, "title", "AI");
12
+ __publicField(this, "tag", "button");
13
+ }
14
+ // 菜单是否需要激活(如选中加粗文本,“加粗”菜单会激活),用不到则返回 false
15
+ isActive(editor) {
16
+ return true;
17
+ }
18
+ // 获取菜单执行时的 value ,用不到则返回空 字符串或 false
19
+ getValue(editor) {
20
+ return "aichart";
21
+ }
22
+ // 菜单是否需要禁用(如选中 H1 ,“引用”菜单被禁用),用不到则返回 false
23
+ isDisabled(editor) {
24
+ return false;
25
+ }
26
+ // 点击菜单时触发的函数
27
+ exec(editor, value) {
28
+ editor.emit("aiClick");
29
+ }
30
+ }
31
+
32
+ export { AIMenu };
@@ -1,11 +1,13 @@
1
1
  import { ref, shallowRef, watch, onBeforeUnmount, nextTick, onMounted, createTextVNode, createVNode, onUnmounted, resolveComponent, defineComponent } from 'vue';
2
2
  import { Toolbar, Editor } from '@wangeditor/editor-for-vue';
3
- import { getCookie } from 'qx-util';
3
+ import { Boot } from '@wangeditor/editor';
4
+ import { getCookie, createUUID } from 'qx-util';
4
5
  import { isNil } from 'ramda';
5
6
  import { getHtmlProps, getEditorEmits, useNamespace } from '@ibiz-template/vue3-util';
6
7
  import { CoreConst, awaitTimeout } from '@ibiz-template/core';
7
8
  import { ElMessageBox } from 'element-plus';
8
9
  import './wang-editor.css';
10
+ import { AIMenu } from './ai/ai-modules.mjs';
9
11
 
10
12
  "use strict";
11
13
  const IBizHtml = /* @__PURE__ */ defineComponent({
@@ -68,8 +70,18 @@ const IBizHtml = /* @__PURE__ */ defineComponent({
68
70
  const customParseLinkUrl = (url) => {
69
71
  return url;
70
72
  };
73
+ Boot.registerMenu({
74
+ key: "aichart",
75
+ factory() {
76
+ return new AIMenu();
77
+ }
78
+ });
71
79
  const toolbarConfig = {
72
- excludeKeys: ["group-video"]
80
+ excludeKeys: ["group-video"],
81
+ insertKeys: {
82
+ index: 60,
83
+ keys: ["|", "aichart"]
84
+ }
73
85
  };
74
86
  const editorConfig = {
75
87
  placeholder: c.placeHolder,
@@ -141,9 +153,87 @@ const IBizHtml = /* @__PURE__ */ defineComponent({
141
153
  return;
142
154
  editor.destroy();
143
155
  });
156
+ let chatInstance;
157
+ const onClickAI = async () => {
158
+ var _a;
159
+ if (c.deService) {
160
+ const module = await import('@ibiz-template-plugin/ai-chat');
161
+ const chat = module.chat || module.default.chat;
162
+ chatInstance = chat;
163
+ const aiChat = chat.create({
164
+ question: async (arr) => {
165
+ var _a2;
166
+ const id = createUUID();
167
+ await ((_a2 = c.deService) == null ? void 0 : _a2.aiChatSse((msg) => {
168
+ ibiz.log.info("aiChatSse", msg);
169
+ if (msg.actionstate === 20 && msg.actionresult) {
170
+ aiChat.addMessage({
171
+ messageid: id,
172
+ state: msg.actionstate,
173
+ type: "DEFAULT",
174
+ role: "ASSISTANT",
175
+ content: msg.actionresult
176
+ });
177
+ } else if (msg.actionstate === 30 && msg.actionresult) {
178
+ const result = JSON.parse(msg.actionresult);
179
+ const choices = result.choices;
180
+ if (choices && choices.length > 0) {
181
+ aiChat.replaceMessage({
182
+ messageid: id,
183
+ state: msg.actionstate,
184
+ type: "DEFAULT",
185
+ role: "ASSISTANT",
186
+ content: choices[0].content || ""
187
+ });
188
+ }
189
+ } else if (msg.actionstate === 40) {
190
+ aiChat.replaceMessage({
191
+ messageid: id,
192
+ state: msg.actionstate,
193
+ type: "ERROR",
194
+ role: "ASSISTANT",
195
+ content: msg.actionresult
196
+ });
197
+ }
198
+ }, c.context, {}, {
199
+ messages: arr
200
+ }));
201
+ aiChat.addMessage({
202
+ messageid: id,
203
+ state: 10,
204
+ type: "DEFAULT",
205
+ role: "ASSISTANT",
206
+ content: ""
207
+ });
208
+ return true;
209
+ },
210
+ action: (action, message) => {
211
+ if (action === "backfill") {
212
+ emit("change", message.content);
213
+ }
214
+ }
215
+ });
216
+ const res = await ((_a = c.deService) == null ? void 0 : _a.aiChatHistory(c.context, {}));
217
+ if (res.data && Array.isArray(res.data)) {
218
+ res.data.forEach((item) => {
219
+ const msg = {
220
+ messageid: createUUID(),
221
+ state: 30,
222
+ type: "DEFAULT",
223
+ role: item.role,
224
+ content: item.content
225
+ };
226
+ aiChat.addMessage(msg);
227
+ });
228
+ }
229
+ }
230
+ };
144
231
  const handleCreated = (editor) => {
145
232
  editorRef.value = editor;
146
233
  editor.setHtml(valueHtml.value);
234
+ editor.on("aiClick", () => {
235
+ onClickAI();
236
+ });
147
237
  };
148
238
  const handleChange = (editor) => {
149
239
  const html = editor.getHtml();
@@ -387,6 +477,9 @@ const IBizHtml = /* @__PURE__ */ defineComponent({
387
477
  if (resizeObserver) {
388
478
  resizeObserver.disconnect();
389
479
  }
480
+ if (chatInstance) {
481
+ chatInstance.close();
482
+ }
390
483
  });
391
484
  return {
392
485
  ns,
@@ -422,7 +515,7 @@ const IBizHtml = /* @__PURE__ */ defineComponent({
422
515
  return !this.isFullScreen ? createVNode("div", {
423
516
  "class": [this.ns.b(), {
424
517
  [this.ns.b("editor-readonly")]: this.readonlyState
425
- }]
518
+ }, this.ns.is("show-ai", true)]
426
519
  }, [this.renderHeaserToolbar(), this.renderEditorContent(), this.hasEnableEdit && !this.readonlyState ? this.renderFooter() : null]) : createVNode(resolveComponent("el-dialog"), {
427
520
  "modelValue": this.isFullScreen,
428
521
  "onUpdate:modelValue": ($event) => this.isFullScreen = $event,
@@ -113,16 +113,16 @@ const IBizInput = /* @__PURE__ */ defineComponent({
113
113
  };
114
114
  let chatInstance;
115
115
  const onClick = async () => {
116
- var _a;
116
+ var _a, _b;
117
117
  if (c.deService) {
118
118
  const module = await import('@ibiz-template-plugin/ai-chat');
119
119
  const chat = module.chat || module.default.chat;
120
120
  chatInstance = chat;
121
121
  const aiChat = chat.create({
122
122
  question: async (arr) => {
123
- var _a2;
123
+ var _a2, _b2;
124
124
  const id = createUUID();
125
- await ((_a2 = c.deService) == null ? void 0 : _a2.aiChatSse((msg) => {
125
+ await ((_b2 = c.deService) == null ? void 0 : _b2.aiChatSse((msg) => {
126
126
  ibiz.log.info("aiChatSse", msg);
127
127
  if (msg.actionstate === 20 && msg.actionresult) {
128
128
  aiChat.addMessage({
@@ -153,7 +153,9 @@ const IBizInput = /* @__PURE__ */ defineComponent({
153
153
  content: msg.actionresult
154
154
  });
155
155
  }
156
- }, c.context, {}, {
156
+ }, c.context, {
157
+ srfactag: (_a2 = c.deACMode) == null ? void 0 : _a2.codeName
158
+ }, {
157
159
  messages: arr
158
160
  }));
159
161
  aiChat.addMessage({
@@ -171,7 +173,9 @@ const IBizInput = /* @__PURE__ */ defineComponent({
171
173
  }
172
174
  }
173
175
  });
174
- const res = await ((_a = c.deService) == null ? void 0 : _a.aiChatHistory(c.context, {}));
176
+ const res = await ((_b = c.deService) == null ? void 0 : _b.aiChatHistory(c.context, {
177
+ srfactag: (_a = c.deACMode) == null ? void 0 : _a.codeName
178
+ }));
175
179
  if (res.data && Array.isArray(res.data)) {
176
180
  res.data.forEach((item) => {
177
181
  const msg = {