@ibiz-template/vue3-components 0.7.41-alpha.45 → 0.7.41-alpha.46
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-DgqTP4Vw.js → index-B0XiEslO.js} +1 -1
- package/dist/{index-Dr0VM8iS.js → index-B6kaPJDO.js} +1 -1
- package/dist/{index-yLzheFmH.js → index-DTj1Yy9-.js} +4 -4
- package/dist/index.min.css +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/{wang-editor-homqxACE.js → wang-editor-CRTv7Ujm.js} +1 -1
- package/dist/{xlsx-util-C5MBICNN.js → xlsx-util-CqW4WJ9G.js} +1 -1
- package/es/common/button-list/button-list.css +1 -1
- package/es/index.mjs +1 -0
- package/es/locale/en/index.mjs +13 -0
- package/es/locale/zh-CN/index.mjs +13 -0
- package/es/node_modules/.pnpm/modern-screenshot@4.6.7/node_modules/modern-screenshot/dist/index.mjs +1652 -0
- package/es/util/ai-chat-util/ai-chat-util.mjs +21 -21
- package/es/util/app-util/app-util.mjs +2 -4
- package/es/util/index.mjs +1 -0
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.mjs +3 -3
- package/es/util/screen-shot-util/screen-shot/components/index.mjs +3 -0
- package/es/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.css +1 -0
- package/es/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.mjs +113 -0
- package/es/util/screen-shot-util/screen-shot/components/screen-shot-toolbar/screen-shot-toolbar.css +1 -0
- package/es/util/screen-shot-util/screen-shot/components/screen-shot-toolbar/screen-shot-toolbar.mjs +105 -0
- package/es/util/screen-shot-util/screen-shot/constant/index.mjs +172 -0
- package/es/util/screen-shot-util/screen-shot/controller/index.mjs +3 -0
- package/es/util/screen-shot-util/screen-shot/controller/screen-shot.controller.mjs +366 -0
- package/es/util/screen-shot-util/screen-shot/controller/screen-shot.store.mjs +51 -0
- package/es/util/screen-shot-util/screen-shot/icon/icon.mjs +90 -0
- package/es/util/screen-shot-util/screen-shot/icon/index.mjs +3 -0
- package/es/util/screen-shot-util/screen-shot/index.mjs +4 -0
- package/es/util/screen-shot-util/screen-shot/module/draw-arrow.mjs +109 -0
- package/es/util/screen-shot-util/screen-shot/module/draw-circle.mjs +25 -0
- package/es/util/screen-shot-util/screen-shot/module/draw-mosaic.mjs +54 -0
- package/es/util/screen-shot-util/screen-shot/module/draw-pencil.mjs +15 -0
- package/es/util/screen-shot-util/screen-shot/module/draw-rectangle.mjs +12 -0
- package/es/util/screen-shot-util/screen-shot/module/draw-text.mjs +12 -0
- package/es/util/screen-shot-util/screen-shot/module/index.mjs +8 -0
- package/es/util/screen-shot-util/screen-shot/type/index.mjs +16 -0
- package/es/util/screen-shot-util/screen-shot/util/index.mjs +8 -0
- package/es/util/screen-shot-util/screen-shot-util.mjs +67 -0
- package/es/web-app/main.mjs +2 -0
- package/lib/common/button-list/button-list.css +1 -1
- package/lib/index.cjs +2 -0
- package/lib/locale/en/index.cjs +13 -0
- package/lib/locale/zh-CN/index.cjs +13 -0
- package/lib/node_modules/.pnpm/modern-screenshot@4.6.7/node_modules/modern-screenshot/dist/index.cjs +1667 -0
- package/lib/util/ai-chat-util/ai-chat-util.cjs +21 -21
- package/lib/util/app-util/app-util.cjs +2 -4
- package/lib/util/index.cjs +2 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.cjs +3 -3
- package/lib/util/screen-shot-util/screen-shot/components/index.cjs +7 -0
- package/lib/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.cjs +115 -0
- package/lib/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.css +1 -0
- package/lib/util/screen-shot-util/screen-shot/components/screen-shot-toolbar/screen-shot-toolbar.cjs +107 -0
- package/lib/util/screen-shot-util/screen-shot/components/screen-shot-toolbar/screen-shot-toolbar.css +1 -0
- package/lib/util/screen-shot-util/screen-shot/constant/index.cjs +174 -0
- package/lib/util/screen-shot-util/screen-shot/controller/index.cjs +7 -0
- package/lib/util/screen-shot-util/screen-shot/controller/screen-shot.controller.cjs +368 -0
- package/lib/util/screen-shot-util/screen-shot/controller/screen-shot.store.cjs +53 -0
- package/lib/util/screen-shot-util/screen-shot/icon/icon.cjs +100 -0
- package/lib/util/screen-shot-util/screen-shot/icon/index.cjs +15 -0
- package/lib/util/screen-shot-util/screen-shot/index.cjs +8 -0
- package/lib/util/screen-shot-util/screen-shot/module/draw-arrow.cjs +111 -0
- package/lib/util/screen-shot-util/screen-shot/module/draw-circle.cjs +27 -0
- package/lib/util/screen-shot-util/screen-shot/module/draw-mosaic.cjs +56 -0
- package/lib/util/screen-shot-util/screen-shot/module/draw-pencil.cjs +18 -0
- package/lib/util/screen-shot-util/screen-shot/module/draw-rectangle.cjs +14 -0
- package/lib/util/screen-shot-util/screen-shot/module/draw-text.cjs +14 -0
- package/lib/util/screen-shot-util/screen-shot/module/index.cjs +18 -0
- package/lib/util/screen-shot-util/screen-shot/type/index.cjs +18 -0
- package/lib/util/screen-shot-util/screen-shot/util/index.cjs +10 -0
- package/lib/util/screen-shot-util/screen-shot-util.cjs +69 -0
- package/lib/web-app/main.cjs +2 -0
- package/package.json +6 -5
|
@@ -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
|
}
|
|
@@ -347,6 +352,16 @@ class AIChatUtil {
|
|
|
347
352
|
} else {
|
|
348
353
|
topicOptions.captionMode = ibiz.config.common.aiChatTopicCaptionMode;
|
|
349
354
|
}
|
|
355
|
+
topicOptions.hideTopicSidebar = false;
|
|
356
|
+
if (params.hasOwnProperty("hidetopicsidebar")) {
|
|
357
|
+
topicOptions.hideTopicSidebar = params.hidetopicsidebar === "true";
|
|
358
|
+
delete params.hidetopicsidebar;
|
|
359
|
+
}
|
|
360
|
+
topicOptions.disableStorage = false;
|
|
361
|
+
if (params.hasOwnProperty("disabletopicstorage")) {
|
|
362
|
+
topicOptions.disableStorage = params.disabletopicstorage === "true";
|
|
363
|
+
delete params.disabletopicstorage;
|
|
364
|
+
}
|
|
350
365
|
topicOptions.beforeDelete = async (...args2) => {
|
|
351
366
|
const isBatchRemove = args2[4];
|
|
352
367
|
const result = await ibiz.confirm.warning({
|
|
@@ -405,6 +420,12 @@ class AIChatUtil {
|
|
|
405
420
|
chatOptions.activeAIAgentID = params.srfaiagent;
|
|
406
421
|
delete params.srfaiagent;
|
|
407
422
|
}
|
|
423
|
+
let enableAIAgentChange = ibiz.config.common.enableAIAgentChange;
|
|
424
|
+
if (params.hasOwnProperty("srfenableaiagentchange")) {
|
|
425
|
+
enableAIAgentChange = params.srfenableaiagentchange === "true";
|
|
426
|
+
delete params.srfenableaiagentchange;
|
|
427
|
+
}
|
|
428
|
+
chatOptions.enableAIAgentChange = enableAIAgentChange;
|
|
408
429
|
const aiAgentlist = await this.getAIAgentList(context, params);
|
|
409
430
|
chatOptions.aiAgentlist = aiAgentlist;
|
|
410
431
|
if (deACMode) {
|
|
@@ -854,27 +875,6 @@ class AIChatUtil {
|
|
|
854
875
|
};
|
|
855
876
|
return resourceOptions;
|
|
856
877
|
}
|
|
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
878
|
}
|
|
879
879
|
|
|
880
880
|
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:
|
|
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
|
|
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("
|
|
51
|
+
document.addEventListener("mousedown", handMousedown, true);
|
|
52
52
|
});
|
|
53
53
|
onUnmounted(() => {
|
|
54
|
-
document.removeEventListener("
|
|
54
|
+
document.removeEventListener("mousedown", handMousedown, true);
|
|
55
55
|
});
|
|
56
56
|
};
|
|
57
57
|
const useAI = (props, opts) => {
|
|
@@ -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 };
|
package/es/util/screen-shot-util/screen-shot/components/screen-shot-toolbar/screen-shot-toolbar.css
ADDED
|
@@ -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}
|
package/es/util/screen-shot-util/screen-shot/components/screen-shot-toolbar/screen-shot-toolbar.mjs
ADDED
|
@@ -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 };
|