@ibiz-template/vue3-components 0.7.41-alpha.45 → 0.7.41-alpha.47

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 (99) hide show
  1. package/dist/ibiz-markdown-editor-DlU-04L2.js +1 -0
  2. package/dist/{index-DgqTP4Vw.js → index-B0XiEslO.js} +1 -1
  3. package/dist/{index-Dr0VM8iS.js → index-B6kaPJDO.js} +1 -1
  4. package/dist/index-BniHS_Fs.js +11 -0
  5. package/dist/index.min.css +1 -1
  6. package/dist/index.system.min.js +1 -1
  7. package/dist/{wang-editor-homqxACE.js → wang-editor-Bx-SzrX-.js} +1 -1
  8. package/dist/{xlsx-util-C5MBICNN.js → xlsx-util-DgYbktap.js} +1 -1
  9. package/es/common/button-list/button-list.css +1 -1
  10. package/es/control/drbar/drbar.controller.mjs +6 -1
  11. package/es/control/drbar/drbar.mjs +5 -5
  12. package/es/control/drtab/drtab-control.util.mjs +1 -1
  13. package/es/control/drtab/drtab.controller.mjs +6 -1
  14. package/es/control/drtab/drtab.mjs +5 -5
  15. package/es/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.controller.mjs +14 -3
  16. package/es/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.mjs +2 -2
  17. package/es/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.state.mjs +6 -0
  18. package/es/editor/code/monaco-editor/monaco-editor.mjs +2 -2
  19. package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.mjs +10 -6
  20. package/es/index.mjs +1 -0
  21. package/es/locale/en/index.mjs +13 -0
  22. package/es/locale/zh-CN/index.mjs +13 -0
  23. package/es/node_modules/.pnpm/modern-screenshot@4.6.7/node_modules/modern-screenshot/dist/index.mjs +1652 -0
  24. package/es/util/ai-chat-util/ai-chat-util.mjs +57 -23
  25. package/es/util/app-util/app-util.mjs +2 -4
  26. package/es/util/index.mjs +1 -0
  27. package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.mjs +3 -3
  28. package/es/util/screen-shot-util/screen-shot/components/index.mjs +3 -0
  29. package/es/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.css +1 -0
  30. package/es/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.mjs +113 -0
  31. package/es/util/screen-shot-util/screen-shot/components/screen-shot-toolbar/screen-shot-toolbar.css +1 -0
  32. package/es/util/screen-shot-util/screen-shot/components/screen-shot-toolbar/screen-shot-toolbar.mjs +105 -0
  33. package/es/util/screen-shot-util/screen-shot/constant/index.mjs +172 -0
  34. package/es/util/screen-shot-util/screen-shot/controller/index.mjs +3 -0
  35. package/es/util/screen-shot-util/screen-shot/controller/screen-shot.controller.mjs +366 -0
  36. package/es/util/screen-shot-util/screen-shot/controller/screen-shot.store.mjs +51 -0
  37. package/es/util/screen-shot-util/screen-shot/icon/icon.mjs +90 -0
  38. package/es/util/screen-shot-util/screen-shot/icon/index.mjs +3 -0
  39. package/es/util/screen-shot-util/screen-shot/index.mjs +4 -0
  40. package/es/util/screen-shot-util/screen-shot/module/draw-arrow.mjs +109 -0
  41. package/es/util/screen-shot-util/screen-shot/module/draw-circle.mjs +25 -0
  42. package/es/util/screen-shot-util/screen-shot/module/draw-mosaic.mjs +54 -0
  43. package/es/util/screen-shot-util/screen-shot/module/draw-pencil.mjs +15 -0
  44. package/es/util/screen-shot-util/screen-shot/module/draw-rectangle.mjs +12 -0
  45. package/es/util/screen-shot-util/screen-shot/module/draw-text.mjs +12 -0
  46. package/es/util/screen-shot-util/screen-shot/module/index.mjs +8 -0
  47. package/es/util/screen-shot-util/screen-shot/type/index.mjs +16 -0
  48. package/es/util/screen-shot-util/screen-shot/util/index.mjs +8 -0
  49. package/es/util/screen-shot-util/screen-shot-util.mjs +67 -0
  50. package/es/view-engine/edit-view.engine.mjs +6 -1
  51. package/es/view-engine/opt-view.engine.mjs +6 -1
  52. package/es/web-app/main.mjs +2 -0
  53. package/lib/common/button-list/button-list.css +1 -1
  54. package/lib/control/drbar/drbar.cjs +4 -4
  55. package/lib/control/drbar/drbar.controller.cjs +6 -1
  56. package/lib/control/drtab/drtab-control.util.cjs +1 -1
  57. package/lib/control/drtab/drtab.cjs +4 -4
  58. package/lib/control/drtab/drtab.controller.cjs +6 -1
  59. package/lib/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.cjs +2 -2
  60. package/lib/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.controller.cjs +14 -3
  61. package/lib/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.state.cjs +6 -0
  62. package/lib/editor/code/monaco-editor/monaco-editor.cjs +2 -2
  63. package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.cjs +10 -6
  64. package/lib/index.cjs +2 -0
  65. package/lib/locale/en/index.cjs +13 -0
  66. package/lib/locale/zh-CN/index.cjs +13 -0
  67. package/lib/node_modules/.pnpm/modern-screenshot@4.6.7/node_modules/modern-screenshot/dist/index.cjs +1667 -0
  68. package/lib/util/ai-chat-util/ai-chat-util.cjs +57 -23
  69. package/lib/util/app-util/app-util.cjs +2 -4
  70. package/lib/util/index.cjs +2 -0
  71. package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.cjs +3 -3
  72. package/lib/util/screen-shot-util/screen-shot/components/index.cjs +7 -0
  73. package/lib/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.cjs +115 -0
  74. package/lib/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.css +1 -0
  75. package/lib/util/screen-shot-util/screen-shot/components/screen-shot-toolbar/screen-shot-toolbar.cjs +107 -0
  76. package/lib/util/screen-shot-util/screen-shot/components/screen-shot-toolbar/screen-shot-toolbar.css +1 -0
  77. package/lib/util/screen-shot-util/screen-shot/constant/index.cjs +174 -0
  78. package/lib/util/screen-shot-util/screen-shot/controller/index.cjs +7 -0
  79. package/lib/util/screen-shot-util/screen-shot/controller/screen-shot.controller.cjs +368 -0
  80. package/lib/util/screen-shot-util/screen-shot/controller/screen-shot.store.cjs +53 -0
  81. package/lib/util/screen-shot-util/screen-shot/icon/icon.cjs +100 -0
  82. package/lib/util/screen-shot-util/screen-shot/icon/index.cjs +15 -0
  83. package/lib/util/screen-shot-util/screen-shot/index.cjs +8 -0
  84. package/lib/util/screen-shot-util/screen-shot/module/draw-arrow.cjs +111 -0
  85. package/lib/util/screen-shot-util/screen-shot/module/draw-circle.cjs +27 -0
  86. package/lib/util/screen-shot-util/screen-shot/module/draw-mosaic.cjs +56 -0
  87. package/lib/util/screen-shot-util/screen-shot/module/draw-pencil.cjs +18 -0
  88. package/lib/util/screen-shot-util/screen-shot/module/draw-rectangle.cjs +14 -0
  89. package/lib/util/screen-shot-util/screen-shot/module/draw-text.cjs +14 -0
  90. package/lib/util/screen-shot-util/screen-shot/module/index.cjs +18 -0
  91. package/lib/util/screen-shot-util/screen-shot/type/index.cjs +18 -0
  92. package/lib/util/screen-shot-util/screen-shot/util/index.cjs +10 -0
  93. package/lib/util/screen-shot-util/screen-shot-util.cjs +69 -0
  94. package/lib/view-engine/edit-view.engine.cjs +6 -1
  95. package/lib/view-engine/opt-view.engine.cjs +6 -1
  96. package/lib/web-app/main.cjs +2 -0
  97. package/package.json +6 -5
  98. package/dist/ibiz-markdown-editor-C7wR017-.js +0 -1
  99. package/dist/index-yLzheFmH.js +0 -11
@@ -71,6 +71,11 @@ class AIChatUtil {
71
71
  if (editorParams.srfmode) {
72
72
  chatOptions.srfMode = editorParams.srfmode;
73
73
  }
74
+ let enableAIAgentChange = ibiz.config.common.enableAIAgentChange;
75
+ if (editorParams.srfenableaiagentchange) {
76
+ enableAIAgentChange = editorParams.srfenableaiagentchange === "true";
77
+ }
78
+ chatOptions.enableAIAgentChange = enableAIAgentChange;
74
79
  if (editorParams.srfaiagent) {
75
80
  chatOptions.activeAIAgentID = editorParams.srfaiagent;
76
81
  }
@@ -96,6 +101,7 @@ class AIChatUtil {
96
101
  chatOptions.sessionid = sessionid;
97
102
  let id = "";
98
103
  let abortController;
104
+ let asyncacitonid = "";
99
105
  const { chatInstance, view, ctrl } = args;
100
106
  chatOptions.history = async (ctx, param, other) => {
101
107
  const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
@@ -169,6 +175,7 @@ class AIChatUtil {
169
175
  await deService.aiChatSse(
170
176
  (msg) => {
171
177
  if (msg.actionstate === 20 && msg.actionresult) {
178
+ asyncacitonid = msg.asyncacitonid;
172
179
  aiChat.addMessage({
173
180
  messageid: id,
174
181
  state: msg.actionstate,
@@ -218,8 +225,23 @@ class AIChatUtil {
218
225
  return true;
219
226
  }
220
227
  };
221
- chatOptions.abortQuestion = async (aiChat) => {
228
+ chatOptions.abortQuestion = async (aiChat, ctx, param, other) => {
222
229
  abortController == null ? void 0 : abortController.abort();
230
+ if (asyncacitonid) {
231
+ const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
232
+ const abortRequestData = { asyncacitonid };
233
+ if (other.sessionid) {
234
+ Object.assign(abortRequestData, {
235
+ sessionid: other.sessionid
236
+ });
237
+ }
238
+ const result = await deService.aiChatCancel(
239
+ ctx,
240
+ param,
241
+ abortRequestData
242
+ );
243
+ asyncacitonid = "";
244
+ }
223
245
  await aiChat.stopMessage({
224
246
  messageid: id,
225
247
  state: 30,
@@ -347,6 +369,16 @@ class AIChatUtil {
347
369
  } else {
348
370
  topicOptions.captionMode = ibiz.config.common.aiChatTopicCaptionMode;
349
371
  }
372
+ topicOptions.hideTopicSidebar = false;
373
+ if (params.hasOwnProperty("hidetopicsidebar")) {
374
+ topicOptions.hideTopicSidebar = params.hidetopicsidebar === "true";
375
+ delete params.hidetopicsidebar;
376
+ }
377
+ topicOptions.disableStorage = false;
378
+ if (params.hasOwnProperty("disabletopicstorage")) {
379
+ topicOptions.disableStorage = params.disabletopicstorage === "true";
380
+ delete params.disabletopicstorage;
381
+ }
350
382
  topicOptions.beforeDelete = async (...args2) => {
351
383
  const isBatchRemove = args2[4];
352
384
  const result = await ibiz.confirm.warning({
@@ -405,6 +437,12 @@ class AIChatUtil {
405
437
  chatOptions.activeAIAgentID = params.srfaiagent;
406
438
  delete params.srfaiagent;
407
439
  }
440
+ let enableAIAgentChange = ibiz.config.common.enableAIAgentChange;
441
+ if (params.hasOwnProperty("srfenableaiagentchange")) {
442
+ enableAIAgentChange = params.srfenableaiagentchange === "true";
443
+ delete params.srfenableaiagentchange;
444
+ }
445
+ chatOptions.enableAIAgentChange = enableAIAgentChange;
408
446
  const aiAgentlist = await this.getAIAgentList(context, params);
409
447
  chatOptions.aiAgentlist = aiAgentlist;
410
448
  if (deACMode) {
@@ -421,6 +459,7 @@ class AIChatUtil {
421
459
  }
422
460
  let id = "";
423
461
  let abortController;
462
+ let asyncacitonid = "";
424
463
  const { chatInstance, view, ctrl } = args;
425
464
  chatOptions.history = async (ctx, param, other) => {
426
465
  const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
@@ -494,6 +533,7 @@ class AIChatUtil {
494
533
  await deService.aiChatSse(
495
534
  (msg) => {
496
535
  if (msg.actionstate === 20 && msg.actionresult) {
536
+ asyncacitonid = msg.asyncacitonid;
497
537
  aiChat.addMessage({
498
538
  messageid: id,
499
539
  state: msg.actionstate,
@@ -543,8 +583,23 @@ class AIChatUtil {
543
583
  return true;
544
584
  }
545
585
  };
546
- chatOptions.abortQuestion = async (aiChat) => {
586
+ chatOptions.abortQuestion = async (aiChat, ctx, param, other) => {
547
587
  abortController == null ? void 0 : abortController.abort();
588
+ if (asyncacitonid) {
589
+ const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
590
+ const abortRequestData = { asyncacitonid };
591
+ if (other.sessionid) {
592
+ Object.assign(abortRequestData, {
593
+ sessionid: other.sessionid
594
+ });
595
+ }
596
+ const result = await deService.aiChatCancel(
597
+ ctx,
598
+ param,
599
+ abortRequestData
600
+ );
601
+ asyncacitonid = "";
602
+ }
548
603
  await aiChat.stopMessage({
549
604
  messageid: id,
550
605
  state: 30,
@@ -854,27 +909,6 @@ class AIChatUtil {
854
909
  };
855
910
  return resourceOptions;
856
911
  }
857
- /**
858
- * 获取AI聊天模式
859
- * @param type 场景类型:UIACTION:界面行为;EDITOR:编辑器
860
- * @param context
861
- * @param params
862
- * @param editorParams
863
- */
864
- getAIChatMode(type, context, params, editorParams) {
865
- switch (type) {
866
- case "UIACTION":
867
- if (params.srfenabletempmode && params.srfenabletempmode === "true") {
868
- delete params.srfenabletempmode;
869
- return "DEFAULT";
870
- }
871
- return "TOPIC";
872
- case "EDITOR":
873
- return "DEFAULT";
874
- default:
875
- return "DEFAULT";
876
- }
877
- }
878
912
  }
879
913
 
880
914
  export { AIChatUtil };
@@ -206,7 +206,6 @@ class AppUtil {
206
206
  if (!deACMode)
207
207
  return Promise.resolve([]);
208
208
  const chatInstance = await ibiz.aiChatUtil.getAIChat();
209
- const messages = [];
210
209
  const appDataEntityName = calcDeCodeNameById(appDataEntityId);
211
210
  let topicId = "".concat(appDataEntityId, "@").concat(appDEACModeId, "@");
212
211
  topicId += context[appDataEntityName] ? context[appDataEntityName] : "default";
@@ -222,14 +221,13 @@ class AppUtil {
222
221
  deACMode,
223
222
  { chatInstance, view, ctrl }
224
223
  );
225
- const chatMode = ibiz.aiChatUtil.getAIChatMode("UIACTION", context, params);
226
224
  const resourceOptions = await ibiz.aiChatUtil.getAIResourceOptions(
227
225
  context,
228
226
  params
229
227
  );
230
228
  return new Promise((resolve) => {
231
229
  chatInstance.create({
232
- mode: chatMode,
230
+ mode: "TOPIC",
233
231
  resourceOptions,
234
232
  containerOptions: {
235
233
  zIndex: containerZIndex,
@@ -253,7 +251,7 @@ class AppUtil {
253
251
  // 扩展参数
254
252
  ...chatOptions,
255
253
  // 关闭回调
256
- closed: () => {
254
+ closed: (context2, params2, messages) => {
257
255
  resolve(messages);
258
256
  }
259
257
  }
package/es/util/index.mjs CHANGED
@@ -16,5 +16,6 @@ export { convertBtnType } from './button-util/button-util.mjs';
16
16
  export { ArrowLeftBold, ArrowRightBold } from './icon/icon.mjs';
17
17
  export { InLineAIUtil } from './inline-ai-util/inline-ai-util.mjs';
18
18
  export { AIChatUtil } from './ai-chat-util/ai-chat-util.mjs';
19
+ export { ScreenShotUtil } from './screen-shot-util/screen-shot-util.mjs';
19
20
 
20
21
  "use strict";
@@ -25,7 +25,7 @@ const computedInLineAIParams = (props) => {
25
25
  };
26
26
  };
27
27
  const useInLineAIContainerClick = (props, message, isLoading) => {
28
- const handclick = async (evt) => {
28
+ const handMousedown = async (evt) => {
29
29
  const target = evt.target;
30
30
  if (!target.closest(".ibiz-inline-ai-textarea-container") && !target.closest(".ibiz-inline-ai-alert")) {
31
31
  if (isLoading.value) {
@@ -48,10 +48,10 @@ const useInLineAIContainerClick = (props, message, isLoading) => {
48
48
  }
49
49
  };
50
50
  onMounted(() => {
51
- document.addEventListener("click", handclick, true);
51
+ document.addEventListener("mousedown", handMousedown, true);
52
52
  });
53
53
  onUnmounted(() => {
54
- document.removeEventListener("click", handclick, true);
54
+ document.removeEventListener("mousedown", handMousedown, true);
55
55
  });
56
56
  };
57
57
  const useAI = (props, opts) => {
@@ -0,0 +1,3 @@
1
+ export { ScreenShot } from './screen-shot/screen-shot.mjs';
2
+
3
+ "use strict";
@@ -0,0 +1 @@
1
+ .ibiz-screen-shot{--ibiz-screen-shot-mask-color-bg:rgba(122, 122, 122, 0.8);--ibiz-screen-shot-color-border:var(--ibiz-color-border);--ibiz-screen-shot-color-disabled:var(--ibiz-color-disabled-text);--ibiz-screen-shot-toolbar-color-0:var(--ibiz-color-text-3);--ibiz-screen-shot-toolbar-color-1:var(--ibiz-color-text-1);--ibiz-screen-shot-toolbar-color-bg:var(--ibiz-color-bg-2);--ibiz-screen-shot-toolbar-color-active:var(--ibiz-color-primary);position:fixed;top:0;left:0;z-index:999999;width:100%;height:100%;background-color:var(--ibiz-screen-shot-mask-color-bg)}.ibiz-screen-shot__toolber{position:absolute;top:40px;left:50%;z-index:1;transform:translateX(-50%)}.ibiz-screen-shot__canvas{position:absolute}.ibiz-screen-shot__text{position:absolute;top:0;left:0;z-index:1;box-sizing:border-box;display:none;min-width:20px;min-height:20px;padding:0;margin:0;font-weight:700;border:none;outline:0}.ibiz-screen-shot__text.is-show{display:block}
@@ -0,0 +1,113 @@
1
+ import { defineComponent, createVNode, onMounted } from 'vue';
2
+ import { useNamespace } from '@ibiz-template/vue3-util';
3
+ import '../../controller/index.mjs';
4
+ import { ToolbarItemType } from '../../type/index.mjs';
5
+ import { ScreenShotToolbar } from '../screen-shot-toolbar/screen-shot-toolbar.mjs';
6
+ import './screen-shot.css';
7
+ import { ScreenShotController } from '../../controller/screen-shot.controller.mjs';
8
+
9
+ "use strict";
10
+ const ScreenShot = /* @__PURE__ */ defineComponent({
11
+ name: "IBizScreenShot",
12
+ props: {
13
+ /**
14
+ * 生成Canvas的画布元素
15
+ */
16
+ element: {
17
+ type: Object,
18
+ required: true
19
+ },
20
+ /**
21
+ * dom中的滚动容器
22
+ */
23
+ container: {
24
+ type: Object
25
+ },
26
+ /**
27
+ * 滚动项类名,用于排除不在滚动容器的项绘制
28
+ */
29
+ itemClassName: {
30
+ type: String
31
+ }
32
+ },
33
+ emits: {
34
+ complete: (_base64) => true,
35
+ cancel: () => true
36
+ },
37
+ setup(props, {
38
+ emit
39
+ }) {
40
+ const ns = useNamespace("screen-shot");
41
+ const c = new ScreenShotController();
42
+ const {
43
+ isLoading,
44
+ history,
45
+ textStatus,
46
+ toolbarStatus,
47
+ canvasElement,
48
+ textInputElement
49
+ } = c.store;
50
+ const handleToolBarClick = (type, opt) => {
51
+ c.onToolClick(type, opt);
52
+ if (type === ToolbarItemType.AI)
53
+ emit("complete", canvasElement.value.toDataURL("png"));
54
+ };
55
+ onMounted(() => {
56
+ c.domToCanvas(props.element, {
57
+ container: props.container,
58
+ itemClassName: props.itemClassName
59
+ });
60
+ });
61
+ return {
62
+ c,
63
+ ns,
64
+ history,
65
+ isLoading,
66
+ textStatus,
67
+ toolbarStatus,
68
+ canvasElement,
69
+ textInputElement,
70
+ handleToolBarClick
71
+ };
72
+ },
73
+ render() {
74
+ return createVNode("div", {
75
+ "class": this.ns.b(),
76
+ "id": "screenShotContainer",
77
+ "onMouseup": () => this.c.mouseUpEvent()
78
+ }, [this.isLoading && createVNode("div", {
79
+ "class": "el-loading-mask"
80
+ }, [createVNode("div", {
81
+ "class": "el-loading-spinner"
82
+ }, [createVNode("svg", {
83
+ "class": "circular",
84
+ "viewBox": "0 0 50 50"
85
+ }, [createVNode("circle", {
86
+ "class": "path",
87
+ "cx": "25",
88
+ "cy": "25",
89
+ "r": "20",
90
+ "fill": "none"
91
+ }, null)]), createVNode("p", {
92
+ "class": "el-loading-text"
93
+ }, [ibiz.i18n.t("util.screenShotUtil.prepareCanvas")])])]), this.toolbarStatus && createVNode(ScreenShotToolbar, {
94
+ "history": this.history,
95
+ "class": this.ns.e("toolber"),
96
+ "onItemClick": this.handleToolBarClick
97
+ }, null), createVNode("canvas", {
98
+ "ref": "canvasElement",
99
+ "id": "canvasContainer",
100
+ "class": this.ns.e("canvas"),
101
+ "onMousedown": (evt) => this.c.mouseDownEvent(evt),
102
+ "onMousemove": (evt) => this.c.mouseMoveEvent(evt)
103
+ }, null), createVNode("div", {
104
+ "ref": "textInputElement",
105
+ "id": "textInputContainer",
106
+ "spellcheck": false,
107
+ "contenteditable": true,
108
+ "class": [this.ns.e("text"), this.ns.is("show", this.textStatus)]
109
+ }, null)]);
110
+ }
111
+ });
112
+
113
+ export { ScreenShot };
@@ -0,0 +1 @@
1
+ .ibiz-screen-shot-toolbar__item{display:flex;align-items:center;justify-content:center;cursor:pointer}.ibiz-screen-shot-toolbar__item--icon{display:flex;align-items:center;justify-content:center}.ibiz-screen-shot-toolbar__item--icon svg{width:1em;height:1em;fill:var(--ibiz-color-text-1)}.ibiz-screen-shot-toolbar__item--divider{width:1px;height:14px;padding:0;pointer-events:none;background:var(--ibiz-color-text-2)}.ibiz-screen-shot-toolbar__item.is-active svg{fill:var(--ibiz-screen-shot-toolbar-color-active)}.ibiz-screen-shot-toolbar__item.is-disabled{pointer-events:none}.ibiz-screen-shot-toolbar__item.is-disabled svg{fill:var(--ibiz-screen-shot-color-disabled)}.ibiz-screen-shot-toolbar__content{display:flex;gap:20px;align-items:center;height:40px;padding:8px 12px;overflow:hidden;font-size:20px;background-color:var(--ibiz-screen-shot-toolbar-color-bg);border:1px solid var(--ibiz-screen-shot-color-border);border-radius:2px}.ibiz-screen-shot-toolbar__item-options{position:relative;height:40px;margin-top:4px}.ibiz-screen-shot-toolbar__item-options--content{position:absolute;display:flex;gap:4px;align-items:center;width:auto;height:40px;padding:4px;background-color:var(--ibiz-screen-shot-toolbar-color-bg);border:1px solid var(--ibiz-screen-shot-color-border);border-radius:2px}.ibiz-screen-shot-toolbar__size{display:flex;align-items:center;height:100%}.ibiz-screen-shot-toolbar__size--item{display:flex;align-items:center;height:100%;padding:0 8px;cursor:pointer}.ibiz-screen-shot-toolbar__size--item::before{display:block;content:"";background-color:var(--ibiz-screen-shot-toolbar-color-0);border-radius:50%}.ibiz-screen-shot-toolbar__size--item.is-active::before{background-color:var(--ibiz-screen-shot-toolbar-color-1)}.ibiz-screen-shot-toolbar__size--small::before{width:4px;height:4px}.ibiz-screen-shot-toolbar__size--medium::before{width:12px;height:12px}.ibiz-screen-shot-toolbar__size--big::before{width:20px;height:20px}.ibiz-screen-shot-toolbar__color-picker .el-button.is-text{display:none}
@@ -0,0 +1,105 @@
1
+ import { defineComponent, createVNode, reactive, ref } from 'vue';
2
+ import { ElColorPicker } from 'element-plus';
3
+ import { useNamespace } from '@ibiz-template/vue3-util';
4
+ import { ToolbarItemType } from '../../type/index.mjs';
5
+ import { getDefaultToolbarItems } from '../../constant/index.mjs';
6
+ import './screen-shot-toolbar.css';
7
+
8
+ "use strict";
9
+ const ScreenShotToolbar = /* @__PURE__ */ defineComponent({
10
+ name: "IBizScreenShotToolbar",
11
+ props: {
12
+ history: {
13
+ type: Array,
14
+ required: true
15
+ }
16
+ },
17
+ emits: {
18
+ itemClick: (_type, _opt) => true
19
+ },
20
+ setup(_props, {
21
+ emit
22
+ }) {
23
+ const ns = useNamespace("screen-shot-toolbar");
24
+ const items = reactive(getDefaultToolbarItems());
25
+ const activeItem = ref(null);
26
+ const onChange = () => {
27
+ const {
28
+ type,
29
+ color,
30
+ size
31
+ } = activeItem.value || {};
32
+ if (!type)
33
+ return;
34
+ emit("itemClick", type, {
35
+ size,
36
+ color
37
+ });
38
+ };
39
+ const handleSizeClick = (size) => {
40
+ if (activeItem.value)
41
+ activeItem.value.size = size;
42
+ onChange();
43
+ };
44
+ const handleColorChange = (color) => {
45
+ if (activeItem.value)
46
+ activeItem.value.color = color;
47
+ onChange();
48
+ };
49
+ const handleItemClick = (item) => {
50
+ activeItem.value = item;
51
+ onChange();
52
+ };
53
+ const stopPropagation = (e) => {
54
+ e.stopPropagation();
55
+ e.preventDefault();
56
+ };
57
+ return {
58
+ ns,
59
+ items,
60
+ activeItem,
61
+ stopPropagation,
62
+ handleItemClick,
63
+ handleSizeClick,
64
+ handleColorChange
65
+ };
66
+ },
67
+ render() {
68
+ var _a, _b;
69
+ return createVNode("div", {
70
+ "class": this.ns.b(),
71
+ "onClick": this.stopPropagation
72
+ }, [createVNode("div", {
73
+ "class": this.ns.e("content"),
74
+ "onMouseup": this.stopPropagation
75
+ }, [this.items.map((item) => {
76
+ var _a2;
77
+ return createVNode("div", {
78
+ "class": [this.ns.e("item"), this.ns.em("item", item.type), this.ns.is("active", item.type !== ToolbarItemType.DRAWDOWN && item.type === ((_a2 = this.activeItem) == null ? void 0 : _a2.type)), this.ns.is("disabled", item.type === ToolbarItemType.DRAWDOWN && !this.history.length)],
79
+ "onClick": () => this.handleItemClick(item)
80
+ }, [createVNode("div", {
81
+ "class": this.ns.em("item", "icon"),
82
+ "title": item.text
83
+ }, [item.icon])]);
84
+ })]), ((_a = this.activeItem) == null ? void 0 : _a.size) || ((_b = this.activeItem) == null ? void 0 : _b.color) ? createVNode("div", {
85
+ "class": this.ns.e("item-options")
86
+ }, [createVNode("div", {
87
+ "class": this.ns.em("item-options", "content")
88
+ }, [this.activeItem.sizeOpts ? createVNode("div", {
89
+ "class": this.ns.e("size")
90
+ }, [this.activeItem.sizeOpts.map((item) => createVNode("div", {
91
+ "class": [this.ns.em("size", "item"), this.ns.em("size", item.type), this.ns.is("active", item.value === this.activeItem.size)],
92
+ "title": item.text,
93
+ "onClick": () => this.handleSizeClick(item.value)
94
+ }, null))]) : null, this.activeItem.color ? createVNode("div", {
95
+ "class": this.ns.e("color-picker")
96
+ }, [createVNode(ElColorPicker, {
97
+ "teleported": false,
98
+ "modelValue": this.activeItem.color,
99
+ "onUpdate:modelValue": ($event) => this.activeItem.color = $event,
100
+ "onChange": this.handleColorChange
101
+ }, null)]) : null])]) : null]);
102
+ }
103
+ });
104
+
105
+ export { ScreenShotToolbar };
@@ -0,0 +1,172 @@
1
+ import '../icon/index.mjs';
2
+ import { ToolbarItemType } from '../type/index.mjs';
3
+ import { BrushIcon, RectIcon, CircleIcon, MosaicIcon, TextIcon, ArrowIcon, DrawdownIcon, AIIcon } from '../icon/icon.mjs';
4
+
5
+ "use strict";
6
+ function getDefaultToolbarItems() {
7
+ return [
8
+ {
9
+ icon: BrushIcon,
10
+ type: ToolbarItemType.BRUSH,
11
+ text: ibiz.i18n.t("util.screenShotUtil.brush"),
12
+ sizeOpts: [
13
+ {
14
+ value: 2,
15
+ type: "small",
16
+ text: ibiz.i18n.t("util.screenShotUtil.small")
17
+ },
18
+ {
19
+ value: 4,
20
+ type: "medium",
21
+ text: ibiz.i18n.t("util.screenShotUtil.medium")
22
+ },
23
+ {
24
+ value: 8,
25
+ type: "big",
26
+ text: ibiz.i18n.t("util.screenShotUtil.big")
27
+ }
28
+ ],
29
+ size: 2,
30
+ color: "#F53340"
31
+ },
32
+ {
33
+ icon: RectIcon,
34
+ type: ToolbarItemType.RECT,
35
+ text: ibiz.i18n.t("util.screenShotUtil.rect"),
36
+ sizeOpts: [
37
+ {
38
+ value: 2,
39
+ type: "small",
40
+ text: ibiz.i18n.t("util.screenShotUtil.small")
41
+ },
42
+ {
43
+ value: 4,
44
+ type: "medium",
45
+ text: ibiz.i18n.t("util.screenShotUtil.medium")
46
+ },
47
+ {
48
+ value: 8,
49
+ type: "big",
50
+ text: ibiz.i18n.t("util.screenShotUtil.big")
51
+ }
52
+ ],
53
+ size: 2,
54
+ color: "#F53340"
55
+ },
56
+ {
57
+ icon: CircleIcon,
58
+ type: ToolbarItemType.CIRCLE,
59
+ text: ibiz.i18n.t("util.screenShotUtil.circle"),
60
+ sizeOpts: [
61
+ {
62
+ value: 2,
63
+ type: "small",
64
+ text: ibiz.i18n.t("util.screenShotUtil.small")
65
+ },
66
+ {
67
+ value: 4,
68
+ type: "medium",
69
+ text: ibiz.i18n.t("util.screenShotUtil.medium")
70
+ },
71
+ {
72
+ value: 8,
73
+ type: "big",
74
+ text: ibiz.i18n.t("util.screenShotUtil.big")
75
+ }
76
+ ],
77
+ size: 2,
78
+ color: "#F53340"
79
+ },
80
+ {
81
+ icon: MosaicIcon,
82
+ type: ToolbarItemType.MOSAIC,
83
+ text: ibiz.i18n.t("util.screenShotUtil.mosaic"),
84
+ sizeOpts: [
85
+ {
86
+ value: 10,
87
+ type: "small",
88
+ text: ibiz.i18n.t("util.screenShotUtil.small")
89
+ },
90
+ {
91
+ value: 15,
92
+ type: "medium",
93
+ text: ibiz.i18n.t("util.screenShotUtil.medium")
94
+ },
95
+ {
96
+ value: 20,
97
+ type: "big",
98
+ text: ibiz.i18n.t("util.screenShotUtil.big")
99
+ }
100
+ ],
101
+ size: 10
102
+ },
103
+ {
104
+ // 文本注释 - 文字标注
105
+ icon: TextIcon,
106
+ type: ToolbarItemType.TEXT,
107
+ text: ibiz.i18n.t("util.screenShotUtil.text"),
108
+ sizeOpts: [
109
+ {
110
+ value: 14,
111
+ type: "small",
112
+ text: ibiz.i18n.t("util.screenShotUtil.small")
113
+ },
114
+ {
115
+ value: 18,
116
+ type: "medium",
117
+ text: ibiz.i18n.t("util.screenShotUtil.medium")
118
+ },
119
+ {
120
+ value: 24,
121
+ type: "big",
122
+ text: ibiz.i18n.t("util.screenShotUtil.big")
123
+ }
124
+ ],
125
+ size: 16,
126
+ color: "#F53340"
127
+ },
128
+ {
129
+ // 箭头工具 - 箭头标注
130
+ icon: ArrowIcon,
131
+ type: ToolbarItemType.ARROW,
132
+ text: ibiz.i18n.t("util.screenShotUtil.arrow"),
133
+ sizeOpts: [
134
+ {
135
+ value: 2,
136
+ type: "small",
137
+ text: ibiz.i18n.t("util.screenShotUtil.small")
138
+ },
139
+ {
140
+ value: 4,
141
+ type: "medium",
142
+ text: ibiz.i18n.t("util.screenShotUtil.medium")
143
+ },
144
+ {
145
+ value: 8,
146
+ type: "big",
147
+ text: ibiz.i18n.t("util.screenShotUtil.big")
148
+ }
149
+ ],
150
+ size: 2,
151
+ color: "#F53340"
152
+ },
153
+ {
154
+ // 分割项 - 视觉分隔线(无交互)
155
+ type: ToolbarItemType.DIVIDER
156
+ },
157
+ {
158
+ // 回撤
159
+ icon: DrawdownIcon,
160
+ type: ToolbarItemType.DRAWDOWN,
161
+ text: ibiz.i18n.t("util.screenShotUtil.drawdown")
162
+ },
163
+ {
164
+ // AI助手 - AI分析/标注
165
+ icon: AIIcon,
166
+ type: ToolbarItemType.AI,
167
+ text: "AI"
168
+ }
169
+ ];
170
+ }
171
+
172
+ export { getDefaultToolbarItems };
@@ -0,0 +1,3 @@
1
+ export { ScreenShotController } from './screen-shot.controller.mjs';
2
+
3
+ "use strict";