@ibiz-template/vue3-components 0.7.41-alpha.164 → 0.7.41-alpha.166

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 (34) hide show
  1. package/dist/{index-DWRQ9IG6.js → index-CCoBeNIV.js} +6 -6
  2. package/dist/{index.es-BJBzhTrX.js → index.es-D1vng-7i.js} +1 -1
  3. package/dist/index.min.css +1 -1
  4. package/dist/index.system.min.js +1 -1
  5. package/dist/{wang-editor-DtLGL_ju.js → wang-editor-B0ZpE6o-.js} +1 -1
  6. package/dist/{xlsx-util-k3HzMMjk.js → xlsx-util-Djaaq9Po.js} +1 -1
  7. package/es/editor/index.mjs +8 -0
  8. package/es/editor/work-space/embed-work-space/embed-work-space.css +1 -0
  9. package/es/editor/work-space/embed-work-space/embed-work-space.mjs +75 -0
  10. package/es/editor/work-space/embed-work-space.controller.mjs +62 -0
  11. package/es/editor/work-space/embed-work-space.provider.mjs +22 -0
  12. package/es/editor/work-space/index.mjs +5 -0
  13. package/es/util/ai-chat-util/ai-chat-util.mjs +311 -252
  14. package/es/util/message-util/message-util.mjs +12 -8
  15. package/es/util/notification-util/notification-util.mjs +1 -0
  16. package/lib/editor/index.cjs +8 -0
  17. package/lib/editor/work-space/embed-work-space/embed-work-space.cjs +77 -0
  18. package/lib/editor/work-space/embed-work-space/embed-work-space.css +1 -0
  19. package/lib/editor/work-space/embed-work-space.controller.cjs +64 -0
  20. package/lib/editor/work-space/embed-work-space.provider.cjs +24 -0
  21. package/lib/editor/work-space/index.cjs +11 -0
  22. package/lib/util/ai-chat-util/ai-chat-util.cjs +311 -252
  23. package/lib/util/message-util/message-util.cjs +12 -8
  24. package/lib/util/notification-util/notification-util.cjs +1 -0
  25. package/package.json +5 -5
  26. package/src/editor/index.ts +7 -1
  27. package/src/editor/work-space/embed-work-space/embed-work-space.scss +8 -0
  28. package/src/editor/work-space/embed-work-space/embed-work-space.tsx +78 -0
  29. package/src/editor/work-space/embed-work-space.controller.ts +70 -0
  30. package/src/editor/work-space/embed-work-space.provider.ts +28 -0
  31. package/src/editor/work-space/index.ts +3 -0
  32. package/src/util/ai-chat-util/ai-chat-util.ts +391 -287
  33. package/src/util/message-util/message-util.ts +8 -0
  34. package/src/util/notification-util/notification-util.ts +1 -0
@@ -15,32 +15,36 @@ class MessageUtil {
15
15
  constructor() {
16
16
  __publicField(this, "ns", vue3Util.useNamespace("message"));
17
17
  }
18
- info(msg, duration, closable) {
18
+ info(msg, duration, closable, options = {}) {
19
19
  ElementPlus.ElMessage.info({
20
20
  message: msg,
21
21
  duration: duration ? duration * 1e3 : duration,
22
- showClose: closable
22
+ showClose: closable,
23
+ ...options
23
24
  });
24
25
  }
25
- success(msg, duration, closable) {
26
+ success(msg, duration, closable, options = {}) {
26
27
  ElementPlus.ElMessage.success({
27
28
  message: msg,
28
29
  duration: duration ? duration * 1e3 : duration,
29
- showClose: closable
30
+ showClose: closable,
31
+ ...options
30
32
  });
31
33
  }
32
- warning(msg, duration, closable) {
34
+ warning(msg, duration, closable, options = {}) {
33
35
  ElementPlus.ElMessage.warning({
34
36
  message: msg,
35
37
  duration: duration ? duration * 1e3 : duration,
36
- showClose: closable
38
+ showClose: closable,
39
+ ...options
37
40
  });
38
41
  }
39
- error(msg, duration, closable) {
42
+ error(msg, duration, closable, options = {}) {
40
43
  ElementPlus.ElMessage.error({
41
44
  message: msg,
42
45
  duration: duration ? duration * 1e3 : duration,
43
- showClose: closable
46
+ showClose: closable,
47
+ ...options
44
48
  });
45
49
  }
46
50
  /**
@@ -72,6 +72,7 @@ class NotificationUtil {
72
72
  position: params.position || "top-right",
73
73
  duration,
74
74
  customClass: params.class,
75
+ appendTo: params.appendTo,
75
76
  onClick: params.onClick
76
77
  });
77
78
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template/vue3-components",
3
- "version": "0.7.41-alpha.164",
3
+ "version": "0.7.41-alpha.166",
4
4
  "description": "web端组件库(vue3)",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "es/index.mjs",
@@ -31,16 +31,16 @@
31
31
  "dependencies": {
32
32
  "@amap/amap-jsapi-loader": "^1.0.1",
33
33
  "@floating-ui/dom": "^1.5.3",
34
- "@ibiz-template-plugin/ai-chat": "^0.0.131",
34
+ "@ibiz-template-plugin/ai-chat": "^0.0.133",
35
35
  "@ibiz-template-plugin/gantt": "0.1.8-alpha.468",
36
36
  "@ibiz-template-plugin/bi-report": "0.0.32",
37
37
  "@ibiz-template-plugin/data-view": "0.0.8",
38
38
  "@ibiz-template/core": "0.7.41-alpha.152",
39
39
  "@ibiz-template/devtool": "0.0.18",
40
- "@ibiz-template/model-helper": "0.7.41-alpha.155",
41
- "@ibiz-template/runtime": "0.7.41-alpha.155",
40
+ "@ibiz-template/model-helper": "0.7.41-alpha.157",
41
+ "@ibiz-template/runtime": "0.7.41-alpha.157",
42
42
  "@ibiz-template/theme": "0.7.39",
43
- "@ibiz-template/vue3-util": "0.7.41-alpha.155",
43
+ "@ibiz-template/vue3-util": "0.7.41-alpha.157",
44
44
  "@ibiz-template/web-theme": "3.16.0",
45
45
  "@ibiz/model-core": "^0.1.89",
46
46
  "@imengyu/vue3-context-menu": "^1.3.5",
@@ -68,6 +68,7 @@ import {
68
68
  import { IBizMapPicker, MapPickerEditorProvider } from './map-picker';
69
69
  import { EmbedAIChatEditorProvider, IBizEmbedAIChat } from './ai-chat';
70
70
  import { IBizHtmlPreview, HtmlPreviewEditorProvider } from './html-preview';
71
+ import { IBizEmbedWorkSpace, EmbedWorkSpaceProvider } from './work-space';
71
72
 
72
73
  export const IBizEditor = {
73
74
  install: (v: App): void => {
@@ -117,6 +118,7 @@ export const IBizEditor = {
117
118
  v.component(IBizCarousel.name, IBizCarousel);
118
119
  v.component(IBizMapPicker.name, IBizMapPicker);
119
120
  v.component(IBizEmbedAIChat.name!, IBizEmbedAIChat);
121
+ v.component(IBizEmbedWorkSpace.name!, IBizEmbedWorkSpace);
120
122
  v.component(
121
123
  'IBizHtml',
122
124
  defineAsyncComponent(() => import('./html/wang-editor/wang-editor')),
@@ -455,7 +457,11 @@ export const IBizEditor = {
455
457
  'TEXTAREA_EMBED_AI_CHAT',
456
458
  () => new EmbedAIChatEditorProvider(),
457
459
  );
458
-
460
+ // 嵌入工作空间
461
+ registerEditorProvider(
462
+ 'TEXTAREA_EMBED_WORK_SPACE',
463
+ () => new EmbedWorkSpaceProvider(),
464
+ );
459
465
  // 预置类型编辑器 `${predefinedType}_${editorType}`;
460
466
  registerEditorProvider(
461
467
  'FIELD_IMAGE_PICTURE_ONE',
@@ -0,0 +1,8 @@
1
+ @include b(embed-work-space) {
2
+ width: 100%;
3
+ height: 100%;
4
+ @include e(container) {
5
+ width: 100%;
6
+ height: 100%;
7
+ }
8
+ }
@@ -0,0 +1,78 @@
1
+ /* eslint-disable no-nested-ternary */
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ import { createUUID } from 'qx-util';
4
+ import { Ref, ref, onMounted, onUnmounted, defineComponent } from 'vue';
5
+ import { convertNavData } from '@ibiz-template/runtime';
6
+ import {
7
+ getEditorEmits,
8
+ getInputProps,
9
+ useNamespace,
10
+ } from '@ibiz-template/vue3-util';
11
+ import { EmbedWorkSpaceController } from '../embed-work-space.controller';
12
+ import './embed-work-space.scss';
13
+
14
+ export const IBizEmbedWorkSpace = defineComponent({
15
+ name: 'IBizEmbedWorkSpace',
16
+ props: getInputProps<EmbedWorkSpaceController>(),
17
+ emits: getEditorEmits(),
18
+ setup(props) {
19
+ const ns = useNamespace('embed-work-space');
20
+ const c = props.controller;
21
+ // 挂载容器元素
22
+ const containerRef: Ref<HTMLElement | null> = ref(null);
23
+
24
+ // 挂载AI聊天框
25
+ const mountedAIChat = async () => {
26
+ const appDataEntityId = c.model.appDataEntityId;
27
+ if (!appDataEntityId || !c.deACMode || !c.workSpaceInstance) return;
28
+
29
+ const editorParams = { ...c.editorParams };
30
+ if (editorParams && Object.keys(editorParams).length > 0) {
31
+ const addParams = convertNavData(editorParams, {}, c.context, c.params);
32
+ Object.assign(editorParams, addParams);
33
+ }
34
+ const sessionid = editorParams.srfsessionid || createUUID();
35
+ const tempParams = { ...c.params, srfactag: c.deACMode.codeName };
36
+ const { chatOptions } = await ibiz.aiChatUtil.getEditorExAIChatParams(
37
+ editorParams,
38
+ c.context,
39
+ c.params,
40
+ props.data,
41
+ c.deACMode,
42
+ { chatInstance: c.workSpaceInstance, view: c.view, ctrl: c.ctrl },
43
+ );
44
+
45
+ const workSpaceInstance: IData = {
46
+ ...chatOptions,
47
+ container: containerRef.value,
48
+ context: { ...c.context },
49
+ params: tempParams,
50
+ appDataEntityId,
51
+ sessionid,
52
+ hideWorkSpaceHeader: editorParams.hideworkspaceheader === 'true',
53
+ };
54
+ c.workSpaceInstance.create(workSpaceInstance);
55
+ };
56
+
57
+ onMounted(() => {
58
+ mountedAIChat();
59
+ });
60
+
61
+ onUnmounted(() => {
62
+ c.workSpaceInstance?.close();
63
+ });
64
+
65
+ return {
66
+ c,
67
+ ns,
68
+ containerRef,
69
+ };
70
+ },
71
+ render() {
72
+ return (
73
+ <div class={this.ns.b()}>
74
+ <div class={this.ns.e('container')} ref='containerRef'></div>
75
+ </div>
76
+ );
77
+ },
78
+ });
@@ -0,0 +1,70 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import {
3
+ getDeACMode,
4
+ IAppDEService,
5
+ EditorController,
6
+ } from '@ibiz-template/runtime';
7
+ import { IAppDEACMode, ITextArea } from '@ibiz/model-core';
8
+
9
+ /**
10
+ * @description 嵌入式工作空间
11
+ * @export
12
+ * @class EmbedWorkSpaceController
13
+ * @extends {EditorController<ITextArea>}
14
+ */
15
+ export class EmbedWorkSpaceController extends EditorController<ITextArea> {
16
+ /**
17
+ * @description 工作空间实例
18
+ * @type {*}
19
+ * @memberof EmbedWorkSpaceController
20
+ */
21
+ public workSpaceInstance: any;
22
+
23
+ /**
24
+ * @description 应用实体服务
25
+ * @type {IAppDEService}
26
+ * @memberof EmbedWorkSpaceController
27
+ */
28
+ deService?: IAppDEService;
29
+
30
+ /**
31
+ * @description 自填模式
32
+ * @type {IAppDEACMode}
33
+ * @memberof EmbedWorkSpaceController
34
+ */
35
+ deACMode?: IAppDEACMode;
36
+
37
+ /**
38
+ * @description 初始化
39
+ * @protected
40
+ * @returns {*} {Promise<void>}
41
+ * @memberof EmbedWorkSpaceController
42
+ */
43
+ protected async onInit(): Promise<void> {
44
+ await super.onInit();
45
+ const model = this.model;
46
+ if (model.appDEACModeId) {
47
+ // 1.自填模式
48
+ this.deACMode = await getDeACMode(
49
+ model.appDEACModeId,
50
+ model.appDataEntityId!,
51
+ this.context.srfappid,
52
+ );
53
+ if (this.deACMode) {
54
+ if (this.deACMode.actype === 'CHATCOMPLETION' && ibiz.env.enableAI) {
55
+ // 2.实体服务
56
+ this.deService = await ibiz.hub
57
+ .getApp(model.appId)
58
+ .deService.getService(this.context, model.appDataEntityId!);
59
+ }
60
+ }
61
+ }
62
+ // 3.创建工作空间实例
63
+ const module = await import('@ibiz-template-plugin/ai-chat');
64
+ if (module && module.createWorkSpace) {
65
+ this.workSpaceInstance = module.createWorkSpace();
66
+ } else if (module && module.default && module.default.createWorkSpace) {
67
+ this.workSpaceInstance = module.default.createWorkSpace();
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,28 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import {
3
+ IEditorContainerController,
4
+ IEditorProvider,
5
+ } from '@ibiz-template/runtime';
6
+ import { ITextBox } from '@ibiz/model-core';
7
+ import { EmbedWorkSpaceController } from './embed-work-space.controller';
8
+
9
+ /**
10
+ * @description 嵌入式工作空间
11
+ * @export
12
+ * @class EmbedWorkSpaceProvider
13
+ * @implements {IEditorProvider}
14
+ */
15
+ export class EmbedWorkSpaceProvider implements IEditorProvider {
16
+ formEditor: string = 'IBizEmbedWorkSpace';
17
+
18
+ gridEditor: string = 'IBizEmbedWorkSpace';
19
+
20
+ async createController(
21
+ editorModel: ITextBox,
22
+ parentController: IEditorContainerController,
23
+ ): Promise<EmbedWorkSpaceController> {
24
+ const c = new EmbedWorkSpaceController(editorModel, parentController);
25
+ await c.init();
26
+ return c;
27
+ }
28
+ }
@@ -0,0 +1,3 @@
1
+ export { IBizEmbedWorkSpace } from './embed-work-space/embed-work-space';
2
+ export { EmbedWorkSpaceController } from './embed-work-space.controller';
3
+ export { EmbedWorkSpaceProvider } from './embed-work-space.provider';