@ibiz-template/vue3-components 0.7.41-alpha.37 → 0.7.41-alpha.38
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/ibiz-markdown-editor-qRaayafj.js +1 -0
- package/dist/index-BiYphJ2f.js +11 -0
- package/dist/{index-BFGNWF-0.js → index-C28lnh2e.js} +1 -1
- package/dist/{index-BiFsbM1Y.js → index-Dp8ExwuL.js} +1 -1
- package/dist/index.min.css +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/wang-editor-DDVqSnRX.js +1 -0
- package/dist/{xlsx-util-DZ5-cWNj.js → xlsx-util-BMANxyk-.js} +1 -1
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater.mjs +10 -0
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid2/repeater-grid2.css +1 -0
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid2/repeater-grid2.mjs +309 -0
- package/es/editor/code/code-editor.controller.mjs +176 -1
- package/es/editor/code/monaco-editor/monaco-editor.css +1 -1
- package/es/editor/code/monaco-editor/monaco-editor.mjs +116 -6
- package/es/editor/html/html-editor.controller.mjs +77 -2
- package/es/editor/html/wang-editor/index.mjs +1 -0
- package/es/editor/html/wang-editor/module/index.mjs +1 -0
- package/es/editor/html/wang-editor/module/inline-ai-module.mjs +95 -0
- package/es/editor/html/wang-editor/wang-editor.css +1 -1
- package/es/editor/html/wang-editor/wang-editor.mjs +35 -4
- package/es/editor/markdown/ibiz-markdown-editor/custom-menu.mjs +45 -0
- package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
- package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.mjs +109 -13
- package/es/editor/markdown/markdown-editor.controller.mjs +113 -1
- package/es/index.mjs +1 -0
- package/es/locale/en/index.mjs +15 -2
- package/es/locale/zh-CN/index.mjs +15 -2
- package/es/util/ai-util/ai-util.mjs +6 -2
- package/es/util/app-util/app-util.mjs +41 -2
- package/es/util/index.mjs +1 -0
- package/es/util/inline-ai-util/inline-ai-textarea/icon.mjs +142 -0
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.css +1 -0
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.mjs +162 -0
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.mjs +205 -0
- package/es/util/inline-ai-util/inline-ai-util.mjs +145 -0
- package/es/web-app/main.mjs +2 -0
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater.cjs +10 -0
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid2/repeater-grid2.cjs +311 -0
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid2/repeater-grid2.css +1 -0
- package/lib/editor/code/code-editor.controller.cjs +175 -0
- package/lib/editor/code/monaco-editor/monaco-editor.cjs +116 -6
- package/lib/editor/code/monaco-editor/monaco-editor.css +1 -1
- package/lib/editor/html/html-editor.controller.cjs +75 -0
- package/lib/editor/html/wang-editor/index.cjs +3 -0
- package/lib/editor/html/wang-editor/module/index.cjs +3 -0
- package/lib/editor/html/wang-editor/module/inline-ai-module.cjs +98 -0
- package/lib/editor/html/wang-editor/wang-editor.cjs +35 -4
- package/lib/editor/html/wang-editor/wang-editor.css +1 -1
- package/lib/editor/markdown/ibiz-markdown-editor/custom-menu.cjs +47 -0
- package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.cjs +109 -13
- package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
- package/lib/editor/markdown/markdown-editor.controller.cjs +112 -0
- package/lib/index.cjs +2 -0
- package/lib/locale/en/index.cjs +15 -2
- package/lib/locale/zh-CN/index.cjs +15 -2
- package/lib/util/ai-util/ai-util.cjs +6 -2
- package/lib/util/app-util/app-util.cjs +40 -1
- package/lib/util/index.cjs +2 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/icon.cjs +151 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.cjs +207 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.css +1 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.cjs +167 -0
- package/lib/util/inline-ai-util/inline-ai-util.cjs +147 -0
- package/lib/web-app/main.cjs +2 -0
- package/package.json +5 -5
- package/dist/ibiz-markdown-editor-Cs1m7gKI.js +0 -1
- package/dist/index-Dds3BDDF.js +0 -11
- package/dist/wang-editor-4cJ6X_hb.js +0 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { createVNode } from 'vue';
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
const StopIcon = createVNode("svg", {
|
|
5
|
+
"class": "icon",
|
|
6
|
+
"viewBox": "0 0 1040 1024",
|
|
7
|
+
"version": "1.1",
|
|
8
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
9
|
+
"p-id": "12982",
|
|
10
|
+
"width": "16",
|
|
11
|
+
"height": "16",
|
|
12
|
+
"fill": "currentColor"
|
|
13
|
+
}, [createVNode("path", {
|
|
14
|
+
"d": "M528 960C280.576 960 80 759.424 80 512S280.576 64 528 64s448 200.576 448 448-200.576 448-448 448z m-80-592a64 64 0 0 0-64 64v160a64 64 0 0 0 64 64h160a64 64 0 0 0 64-64V432a64 64 0 0 0-64-64H448z",
|
|
15
|
+
"p-id": "12983"
|
|
16
|
+
}, null)]);
|
|
17
|
+
const AIIcon = createVNode("svg", {
|
|
18
|
+
"id": "ai",
|
|
19
|
+
"viewBox": "0 0 16 16",
|
|
20
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
21
|
+
"width": "16",
|
|
22
|
+
"height": "16",
|
|
23
|
+
"preserveAspectRatio": "xMidYMid meet",
|
|
24
|
+
"focusable": "false",
|
|
25
|
+
"fill": "currentColor"
|
|
26
|
+
}, [createVNode("g", {
|
|
27
|
+
"id": "aae1.Base\u57FA\u7840/1.icon\u56FE\u6807/2.normal/ai-star",
|
|
28
|
+
"stroke-width": "1",
|
|
29
|
+
"fill-rule": "evenodd"
|
|
30
|
+
}, [createVNode("path", {
|
|
31
|
+
"d": "M5.817 1.53l3.158 8.797h.054v.152l1.443 4.021-1.402.001-1.041-2.982H2.495l-1.03 2.982L0 14.5 4.671 1.533l1.146-.003zm7.86 5.424V14.5h-1.213V6.954h1.212zM5.248 3.549l-2.342 6.778h4.706L5.249 3.55zM13.046 0c.075 0 .147.02.204.071a.318.318 0 01.094.181l.064.273c.097.417.17.727.255.968.084.24.177.4.31.523.134.124.318.218.599.306.281.088.65.166 1.15.265a.358.358 0 01.195.095c.056.057.083.13.083.213a.289.289 0 01-.083.21.362.362 0 01-.197.094c-.528.093-.918.167-1.214.255-.295.088-.485.187-.621.324-.137.138-.23.324-.31.606-.08.283-.145.651-.23 1.147a.329.329 0 01-.093.184.293.293 0 01-.206.075.308.308 0 01-.207-.072.322.322 0 01-.1-.188l-.006-.033c-.085-.486-.149-.845-.228-1.12-.079-.274-.17-.452-.305-.585-.135-.133-.323-.23-.618-.32s-.683-.168-1.21-.273a.353.353 0 01-.2-.096.29.29 0 01-.08-.208c0-.079.023-.153.079-.211a.35.35 0 01.2-.097c.5-.098.869-.176 1.15-.263.282-.087.465-.18.597-.302.132-.12.224-.278.306-.511.082-.236.151-.539.244-.947l.071-.312a.312.312 0 01.102-.183.311.311 0 01.205-.069z",
|
|
32
|
+
"id": "aae\u5F62\u72B6\u7ED3\u5408"
|
|
33
|
+
}, null)])]);
|
|
34
|
+
const SendIcon = createVNode("svg", {
|
|
35
|
+
"id": "send",
|
|
36
|
+
"viewBox": "0 0 16 16",
|
|
37
|
+
"version": "1.1",
|
|
38
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
39
|
+
"width": "16",
|
|
40
|
+
"height": "16",
|
|
41
|
+
"preserveAspectRatio": "xMidYMid meet",
|
|
42
|
+
"focusable": "false",
|
|
43
|
+
"fill": "currentColor"
|
|
44
|
+
}, [createVNode("g", {
|
|
45
|
+
"id": "az1.Base\u57FA\u7840/1.icon\u56FE\u6807/2.normal/airplane-fill",
|
|
46
|
+
"stroke-width": "1",
|
|
47
|
+
"fill-rule": "evenodd"
|
|
48
|
+
}, [createVNode("path", {
|
|
49
|
+
"d": "M9.09609607,13.5642768 L13.2170975,15.5669393 C13.4741816,15.6766453 13.7609293,15.517073 13.8004807,15.2378214 L15.9955838,0.48735567 C16.0450231,0.138291234 15.6692847,-0.121013775 15.3726492,0.0585050774 L0.20432945,7.12444843 C-0.0824182488,7.29399401 -0.0626425454,7.7228446 0.233993005,7.87244365 L4.41476499,10.6518549 C4.57297062,10.7216678 4.75095195,10.7017213 4.87949402,10.5820421 L11.7317893,4.66709687 C11.7735964,4.63100873 11.8367429,4.63564485 11.872831,4.67745192 C11.9046123,4.71426959 11.9052944,4.76861446 11.8744472,4.80621817 L5.83087229,12.1735275 L5.83087229,12.1735275 C5.77154518,12.2433404 5.74188162,12.3330998 5.74188162,12.4228593 L5.3388256,15.5669393 C5.32893775,15.9658701 5.82333033,16.1553622 6.08041448,15.8461909 L8.63136704,13.683956 C8.73024556,13.5443302 8.92800259,13.4944639 9.09609607,13.5642768 Z",
|
|
50
|
+
"id": "az\u8DEF\u5F84"
|
|
51
|
+
}, null)])]);
|
|
52
|
+
const RegenerateIcon = createVNode("svg", {
|
|
53
|
+
"viewBox": "0 0 16 16",
|
|
54
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
55
|
+
"width": "16",
|
|
56
|
+
"height": "16",
|
|
57
|
+
"preserveAspectRatio": "xMidYMid meet",
|
|
58
|
+
"focusable": "false",
|
|
59
|
+
"fill": "currentColor"
|
|
60
|
+
}, [createVNode("g", {
|
|
61
|
+
"id": "avf1.Base\u57FA\u7840/1.icon\u56FE\u6807/11.editor/redo",
|
|
62
|
+
"stroke-width": "1",
|
|
63
|
+
"fill-rule": "evenodd"
|
|
64
|
+
}, [createVNode("g", {
|
|
65
|
+
"id": "avf\u7F16\u7EC4",
|
|
66
|
+
"transform": "matrix(-1 0 0 1 15.015 1)"
|
|
67
|
+
}, [createVNode("path", {
|
|
68
|
+
"d": "M3.84 5.825a.6.6 0 01.063.774l-.064.075a.6.6 0 01-.774.063l-.074-.063L.176 3.859a.6.6 0 01-.064-.775l.064-.074L3.01.176a.6.6 0 01.912.774l-.063.074-1.795 1.794h6.851a5.1 5.1 0 01.216 10.196l-.216.004h-4a.6.6 0 01-.097-1.192l.097-.008h4a3.9 3.9 0 00.201-7.795l-.2-.005H2.033l1.805 1.807z",
|
|
69
|
+
"id": "avf\u5F62\u72B6\u7ED3\u5408"
|
|
70
|
+
}, null)])])]);
|
|
71
|
+
const insertTextIcon = createVNode("svg", {
|
|
72
|
+
"viewBox": "0 0 16 16",
|
|
73
|
+
"version": "1.1",
|
|
74
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
75
|
+
"fill": "currentColor",
|
|
76
|
+
"width": "16",
|
|
77
|
+
"height": "16",
|
|
78
|
+
"preserveAspectRatio": "xMidYMid meet",
|
|
79
|
+
"focusable": "false"
|
|
80
|
+
}, [createVNode("g", {
|
|
81
|
+
"id": "ae1.Base\u57FA\u7840/1.icon\u56FE\u6807/2.normal/insert-below",
|
|
82
|
+
"stroke-width": "1",
|
|
83
|
+
"fill-rule": "evenodd"
|
|
84
|
+
}, [createVNode("path", {
|
|
85
|
+
"d": "M13.4,12.7902394 C13.7313708,12.7902394 14,13.0588685 14,13.3902394 C14,13.7216102 13.7313708,13.9902394 13.4,13.9902394 L9.61247231,13.9902394 C9.28110146,13.9902394 9.01247231,13.7216102 9.01247231,13.3902394 C9.01247231,13.0588685 9.28110146,12.7902394 9.61247231,12.7902394 L13.4,12.7902394 Z M2.64424308,9.33926858 C2.97561393,9.33926858 3.24424308,9.60789773 3.24424308,9.93926858 L3.24424308,11.3602686 L5.96531725,11.3599906 L5.33280173,10.7263268 C5.12191861,10.5154437 5.1008303,10.1866372 5.2695368,9.95216939 L5.33280173,9.87779866 C5.56711631,9.64348408 5.94701529,9.64348408 6.18132987,9.87779866 L7.8400676,11.5365364 C8.07438217,11.770851 8.07438217,12.1507499 7.8400676,12.3850645 L6.4106287,13.8145034 C6.17631412,14.048818 5.79641514,14.048818 5.56210056,13.8145034 C5.32778599,13.5801888 5.32778599,13.2002899 5.56210056,12.9659753 L5.96631725,12.5599906 L2.64424308,12.5608005 C2.31287223,12.5608005 2.04424308,12.2921713 2.04424308,11.9608005 L2.04424308,9.93926858 C2.04424308,9.60789773 2.31287223,9.33926858 2.64424308,9.33926858 Z M13.4,9.19548978 C13.7313708,9.19548978 14,9.46411893 14,9.79548978 C14,10.1268606 13.7313708,10.3954898 13.4,10.3954898 L9.61247231,10.3954898 C9.28110146,10.3954898 9.01247231,10.1268606 9.01247231,9.79548978 C9.01247231,9.46411893 9.28110146,9.19548978 9.61247231,9.19548978 L13.4,9.19548978 Z M13.4,5.60074021 C13.7313708,5.60074021 14,5.86936936 14,6.20074021 C14,6.53211106 13.7313708,6.80074021 13.4,6.80074021 L2.61931725,6.80074021 C2.2879464,6.80074021 2.01931725,6.53211106 2.01931725,6.20074021 C2.01931725,5.86936936 2.2879464,5.60074021 2.61931725,5.60074021 L13.4,5.60074021 Z M13.4,2.00599065 C13.7313708,2.00599065 14,2.2746198 14,2.60599065 C14,2.9373615 13.7313708,3.20599065 13.4,3.20599065 L2.61931725,3.20599065 C2.2879464,3.20599065 2.01931725,2.9373615 2.01931725,2.60599065 C2.01931725,2.2746198 2.2879464,2.00599065 2.61931725,2.00599065 L13.4,2.00599065 Z",
|
|
86
|
+
"id": "ae\u5F62\u72B6\u7ED3\u5408"
|
|
87
|
+
}, null)])]);
|
|
88
|
+
const ReplaceTextIcon = createVNode("svg", {
|
|
89
|
+
"viewBox": "0 0 16 16",
|
|
90
|
+
"version": "1.1",
|
|
91
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
92
|
+
"fill": "currentColor",
|
|
93
|
+
"width": "16",
|
|
94
|
+
"height": "16",
|
|
95
|
+
"preserveAspectRatio": "xMidYMid meet",
|
|
96
|
+
"focusable": "false"
|
|
97
|
+
}, [createVNode("g", {
|
|
98
|
+
"id": "ao1.Base\u57FA\u7840/1.icon\u56FE\u6807/2.normal/replace-selection",
|
|
99
|
+
"stroke-width": "1",
|
|
100
|
+
"fill-rule": "evenodd"
|
|
101
|
+
}, [createVNode("path", {
|
|
102
|
+
"d": "M6.61931725,12.8 C6.9506881,12.8 7.21931725,13.0686292 7.21931725,13.4 C7.21931725,13.7313708 6.9506881,14 6.61931725,14 L2.61931725,14 C2.2879464,14 2.01931725,13.7313708 2.01931725,13.4 C2.01931725,13.0686292 2.2879464,12.8 2.61931725,12.8 L6.61931725,12.8 Z M13.882771,9.53617937 L13.9544547,9.59882598 C14.2050411,9.8494124 14.2259233,10.2427187 14.0171013,10.5170918 L13.9544547,10.5887755 L10.6802912,13.862939 C10.6039101,13.93932 10.4806802,13.9412495 10.4019453,13.8672971 L8.52941673,12.1085105 C8.24762538,11.8438358 8.23374956,11.4008376 8.49842422,11.1190462 C8.74104265,10.8607375 9.13350242,10.8275522 9.41427862,11.027682 L9.48788845,11.0880537 L10.5124867,12.0507581 L12.9645052,9.59882598 C13.2150916,9.34823956 13.608398,9.32735736 13.882771,9.53617937 Z M6.61931725,9.20415791 C6.9506881,9.20415791 7.21931725,9.47278706 7.21931725,9.80415791 C7.21931725,10.1355288 6.9506881,10.4041579 6.61931725,10.4041579 L2.61931725,10.4041579 C2.2879464,10.4041579 2.01931725,10.1355288 2.01931725,9.80415791 C2.01931725,9.47278706 2.2879464,9.20415791 2.61931725,9.20415791 L6.61931725,9.20415791 Z M13.4,5.60831582 C13.7313708,5.60831582 14,5.87694497 14,6.20831582 C14,6.53968667 13.7313708,6.80831582 13.4,6.80831582 L2.61931725,6.80831582 C2.2879464,6.80831582 2.01931725,6.53968667 2.01931725,6.20831582 C2.01931725,5.87694497 2.2879464,5.60831582 2.61931725,5.60831582 L13.4,5.60831582 Z M13.4,2.01247373 C13.7313708,2.01247373 14,2.28110288 14,2.61247373 C14,2.94384458 13.7313708,3.21247373 13.4,3.21247373 L2.61931725,3.21247373 C2.2879464,3.21247373 2.01931725,2.94384458 2.01931725,2.61247373 C2.01931725,2.28110288 2.2879464,2.01247373 2.61931725,2.01247373 L13.4,2.01247373 Z",
|
|
103
|
+
"id": "ao\u5F62\u72B6\u7ED3\u5408"
|
|
104
|
+
}, null)])]);
|
|
105
|
+
const CopyTextIcon = createVNode("svg", {
|
|
106
|
+
"viewBox": "0 0 16 16",
|
|
107
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
108
|
+
"fill": "currentColor",
|
|
109
|
+
"width": "16",
|
|
110
|
+
"height": "16",
|
|
111
|
+
"preserveAspectRatio": "xMidYMid meet",
|
|
112
|
+
"focusable": "false"
|
|
113
|
+
}, [createVNode("g", {
|
|
114
|
+
"id": "aiqaction/copy",
|
|
115
|
+
"stroke-width": "1",
|
|
116
|
+
"fill-rule": "evenodd"
|
|
117
|
+
}, [createVNode("g", {
|
|
118
|
+
"id": "aiq\u590D\u5236",
|
|
119
|
+
"transform": "translate(2 -.27)",
|
|
120
|
+
"fill-rule": "nonzero"
|
|
121
|
+
}, [createVNode("path", {
|
|
122
|
+
"d": "M5.6 8.47v-1.2h4.174v1.2H5.6zm0 3v-1.2h4.174v1.2H5.6zm-4.4-10v10.075H0L.003 2.27c0-1.088.895-2 1.997-2h7.585v1.2H1.2zm1.8.8h9a1 1 0 011 1v12a1 1 0 01-1 1H3a1 1 0 01-1-1v-12a1 1 0 011-1zm.2 1.2v11.6h8.6V3.47H3.2z",
|
|
123
|
+
"id": "aiq\u5F62\u72B6\u7ED3\u5408"
|
|
124
|
+
}, null)])])]);
|
|
125
|
+
const CancelIcon = createVNode("svg", {
|
|
126
|
+
"viewBox": "0 0 16 16",
|
|
127
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
128
|
+
"fill": "currentColor",
|
|
129
|
+
"width": "16",
|
|
130
|
+
"height": "16",
|
|
131
|
+
"preserveAspectRatio": "xMidYMid meet",
|
|
132
|
+
"focusable": "false"
|
|
133
|
+
}, [createVNode("g", {
|
|
134
|
+
"id": "bbhaction/trash",
|
|
135
|
+
"stroke-width": "1",
|
|
136
|
+
"fill-rule": "evenodd"
|
|
137
|
+
}, [createVNode("path", {
|
|
138
|
+
"d": "M4.002 3.403V1a1 1 0 011-1h6.003a1 1 0 011 1v2.403h3.396a.6.6 0 110 1.2h-1.395V15a1 1 0 01-1 1H3a1 1 0 01-1-1V4.603H.6a.6.6 0 110-1.2h3.4zm8.804 1.205H3.2V14.8h9.605V4.608zM5.202 1.2v2.155h5.603V1.2H5.202zm.6 6.417a.6.6 0 011.201 0v4.758a.6.6 0 01-1.2 0V7.617zm3.202 0a.6.6 0 011.2 0v4.758a.6.6 0 01-1.2 0V7.617z",
|
|
139
|
+
"id": "bbh\u5220\u9664"
|
|
140
|
+
}, null)])]);
|
|
141
|
+
|
|
142
|
+
export { AIIcon, CancelIcon, CopyTextIcon, RegenerateIcon, ReplaceTextIcon, SendIcon, StopIcon, insertTextIcon };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ibiz-inline-ai-container-context-menu{--ibiz-inline-ai-context-menu-color-bg:var(--ibiz-color-bg-2);--ibiz-inline-ai-context-menu-color-text:var(--ibiz-color-text-0);--ibiz-inline-ai-context-menu-color-bg-active:var(--ibiz-color-fill-0);--mx-menu-text:var(--ibiz-inline-ai-context-menu-color-text);--mx-menu-backgroud:var(--ibiz-inline-ai-context-menu-color-bg);--mx-menu-hover-backgroud:var(--ibiz-inline-ai-context-menu-color-bg-active);--mx-menu-hover-text:var(--ibiz-inline-ai-context-menu-color-text);--mx-menu-open-text:var(--ibiz-inline-ai-context-menu-color-text);--mx-menu-open-backgroud:var(--ibiz-inline-ai-context-menu-color-bg-active);--mx-menu-open-hover-text:var(--ibiz-inline-ai-context-menu-color-text);--mx-menu-open-hover-backgroud:var(--ibiz-inline-ai-context-menu-color-bg-active)}.ibiz-inline-ai-container-context-menu .scroll-content{pointer-events:unset}.ibiz-inline-ai-container-context-menu .mx-context-menu{cursor:pointer}.ibiz-inline-ai-textarea-container{position:absolute;z-index:99999999;-webkit-user-select:none;-moz-user-select:none;user-select:none;background-color:var(--ibiz-color-bg-1);border:1px solid var(--ibiz-color-border);border-radius:var(--ibiz-border-radius-small);box-shadow:rgba(0,0,0,.08) 0 0 16px 0}.ibiz-inline-ai-textarea-container__content{position:relative;display:flex;gap:var(--ibiz-spacing-tight);padding:var(--ibiz-spacing-base-tight)}.ibiz-inline-ai-textarea-container__content--prefix{flex-shrink:0}.ibiz-inline-ai-textarea-container__content--ai-icon{color:var(--ibiz-color-disabled-text)}.ibiz-inline-ai-textarea-container__content--textarea{position:relative;flex-grow:1}.ibiz-inline-ai-textarea-container__content--textarea textarea{width:100%;height:100%;padding:0;resize:none;border:none;outline:0}.ibiz-inline-ai-textarea-container__content--textarea textarea:disabled{background-color:var(--ibiz-color-bg-1)}.ibiz-inline-ai-textarea-container__content--suffix{display:flex;flex-direction:column-reverse;flex-shrink:0}.ibiz-inline-ai-textarea-container__content--sand-icon{display:flex;align-items:center;justify-content:center;width:28px;height:28px;color:var(--ibiz-color-primary);cursor:pointer;border-radius:var(--ibiz-spacing-extra-tight)}.ibiz-inline-ai-textarea-container__content--sand-icon:hover{background-color:var(--ibiz-color-primary-light-default)}.ibiz-inline-ai-textarea-container__content--stop-icon{display:flex;gap:var(--ibiz-spacing-extra-tight);align-items:center;font-size:var(--ibiz-font-size-small);color:var(--ibiz-color-disabled-text);cursor:pointer}.ibiz-inline-ai-textarea-container__content--stop-icon:hover{color:var(--ibiz-color-primary-hover)}.ibiz-inline-ai-textarea-container__footer{padding:var(--ibiz-spacing-base-tight) var(--ibiz-spacing-base);font-size:var(--ibiz-font-size-small);color:var(--ibiz-color-disabled-text);background-color:var(--ibiz-color-disabled-fill);border-top:1px solid var(--ibiz-color-disabled-border)}.ibiz-inline-ai-textarea-container__actions{position:absolute;width:240px;padding:var(--ibiz-spacing-base-tight) 0;font-size:var(--ibiz-font-size-regular);visibility:hidden;background-color:var(--ibiz-color-bg-1);border:1px solid var(--ibiz-color-border);border-radius:var(--ibiz-border-radius-small);box-shadow:rgba(0,0,0,.08) 0 0 16px 0}.ibiz-inline-ai-textarea-container__actions.is-show{visibility:visible}.ibiz-inline-ai-textarea-container__actions--action{display:flex;gap:var(--ibiz-spacing-tight);align-items:center;padding:var(--ibiz-spacing-tight) var(--ibiz-spacing-base-loose);cursor:pointer}.ibiz-inline-ai-textarea-container__actions--action:hover{background-color:var(--ibiz-color-fill-0)}.ibiz-inline-ai-textarea-container__actions--action.is-danger:hover{color:var(--ibiz-color-danger)}.ibiz-inline-ai-textarea-container__actions--divider{margin:var(--ibiz-spacing-extra-tight) var(--ibiz-spacing-base-loose);border-top:1px solid var(--ibiz-color-border)}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { onMounted, onUnmounted, ref } from 'vue';
|
|
2
|
+
import { calcResPath } from '@ibiz-template/runtime';
|
|
3
|
+
import { RegenerateIcon, insertTextIcon, ReplaceTextIcon, CopyTextIcon, CancelIcon } from './icon.mjs';
|
|
4
|
+
|
|
5
|
+
"use strict";
|
|
6
|
+
const computedInLineAIParams = (props) => {
|
|
7
|
+
var _a;
|
|
8
|
+
return {
|
|
9
|
+
srfaiappendcurdata: (_a = props.context.srfaiappendcurdata) != null ? _a : true,
|
|
10
|
+
srfaiautoappend: props.params.srfaiautoappend === "true" || props.params.srfaiautoappend === true,
|
|
11
|
+
srfmode: props.params.srfmode
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
const useInLineAIContainerClick = (props) => {
|
|
15
|
+
const handclick = (evt) => {
|
|
16
|
+
const target = evt.target;
|
|
17
|
+
if (!target.closest(".ibiz-inline-ai-textarea-container")) {
|
|
18
|
+
props.unMountAIChat();
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
onMounted(() => {
|
|
22
|
+
document.addEventListener("click", handclick, true);
|
|
23
|
+
});
|
|
24
|
+
onUnmounted(() => {
|
|
25
|
+
document.removeEventListener("click", handclick, true);
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
const useAI = (props, opts) => {
|
|
29
|
+
const { context, data, deACMode } = props;
|
|
30
|
+
const { srfaiappendcurdata, srfmode } = opts;
|
|
31
|
+
const params = { srfactag: deACMode.codeName };
|
|
32
|
+
const app = ibiz.hub.getApp(deACMode.appId);
|
|
33
|
+
let history = [];
|
|
34
|
+
const calcAIPath = (appDataEntity, isHistories = false) => {
|
|
35
|
+
const srfkey = context[appDataEntity.codeName.toLowerCase()];
|
|
36
|
+
const curPath = "/".concat(appDataEntity.deapicodeName2, "/chatcompletion").concat(isHistories ? "/histories" : "").concat(srfkey ? "/".concat(srfkey) : "");
|
|
37
|
+
const resPath = calcResPath(context, appDataEntity);
|
|
38
|
+
return resPath ? "/".concat(resPath).concat(curPath) : "".concat(curPath);
|
|
39
|
+
};
|
|
40
|
+
const loadAiHistory = async () => {
|
|
41
|
+
const appDataEntity = await ibiz.hub.getAppDataEntity(
|
|
42
|
+
deACMode.appDataEntityId,
|
|
43
|
+
deACMode.appId
|
|
44
|
+
);
|
|
45
|
+
const path = calcAIPath(appDataEntity, true);
|
|
46
|
+
const body = {};
|
|
47
|
+
if (srfaiappendcurdata)
|
|
48
|
+
Object.assign(body, { data });
|
|
49
|
+
if (srfmode)
|
|
50
|
+
Object.assign(body, { mode: srfmode });
|
|
51
|
+
const response = await app.net.post(path, body, params);
|
|
52
|
+
if (response.ok && Array.isArray(response.data)) {
|
|
53
|
+
history = response.data.filter(
|
|
54
|
+
(item) => ["USER", "ASSISTANT"].includes(item.role)
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const askAI = async (content) => {
|
|
59
|
+
var _a, _b;
|
|
60
|
+
const body = {
|
|
61
|
+
messages: [
|
|
62
|
+
...history,
|
|
63
|
+
{
|
|
64
|
+
role: "USER",
|
|
65
|
+
content
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
};
|
|
69
|
+
if (srfmode)
|
|
70
|
+
Object.assign(body, { mode: srfmode });
|
|
71
|
+
const appDataEntity = await ibiz.hub.getAppDataEntity(
|
|
72
|
+
deACMode.appDataEntityId,
|
|
73
|
+
deACMode.appId
|
|
74
|
+
);
|
|
75
|
+
const path = calcAIPath(appDataEntity);
|
|
76
|
+
const response = await app.net.post(path, body, params);
|
|
77
|
+
if (response.ok) {
|
|
78
|
+
const result = (_b = (_a = response.data.choices) == null ? void 0 : _a[0]) == null ? void 0 : _b.content;
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
return "";
|
|
82
|
+
};
|
|
83
|
+
onMounted(() => {
|
|
84
|
+
loadAiHistory();
|
|
85
|
+
});
|
|
86
|
+
return {
|
|
87
|
+
askAI
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
const useBase = (props, container, target) => {
|
|
91
|
+
const actions = [
|
|
92
|
+
{
|
|
93
|
+
title: ibiz.i18n.t("util.inlineAiUtil.regenerate"),
|
|
94
|
+
icon: RegenerateIcon,
|
|
95
|
+
itemType: "action",
|
|
96
|
+
actionName: "regenerate"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
title: ibiz.i18n.t("util.inlineAiUtil.insertText"),
|
|
100
|
+
icon: insertTextIcon,
|
|
101
|
+
itemType: "action",
|
|
102
|
+
actionName: "insertText"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
title: ibiz.i18n.t("util.inlineAiUtil.replaceText"),
|
|
106
|
+
icon: ReplaceTextIcon,
|
|
107
|
+
itemType: "action",
|
|
108
|
+
actionName: "replaceText"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
itemType: "divider"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
title: ibiz.i18n.t("util.inlineAiUtil.copyText"),
|
|
115
|
+
icon: CopyTextIcon,
|
|
116
|
+
itemType: "action",
|
|
117
|
+
actionName: "copyText"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
title: ibiz.i18n.t("app.cancel"),
|
|
121
|
+
icon: CancelIcon,
|
|
122
|
+
itemType: "action",
|
|
123
|
+
actionName: "cancel"
|
|
124
|
+
}
|
|
125
|
+
];
|
|
126
|
+
const actionStyle = ref({});
|
|
127
|
+
const containerStyle = ref({
|
|
128
|
+
width: "".concat(props.options.width, "px"),
|
|
129
|
+
left: "".concat(props.options.left, "px"),
|
|
130
|
+
top: "".concat(props.options.top, "px")
|
|
131
|
+
});
|
|
132
|
+
const contentStyle = ref({
|
|
133
|
+
height: "".concat(props.options.height || 80, "px"),
|
|
134
|
+
"max-height": "".concat(props.options.maxHeight, "px")
|
|
135
|
+
});
|
|
136
|
+
const calcStyle = (isInit = false) => {
|
|
137
|
+
if (!container.value || !target.value)
|
|
138
|
+
return;
|
|
139
|
+
const containerRect = container.value.getBoundingClientRect();
|
|
140
|
+
const targetHeight = target.value.offsetHeight;
|
|
141
|
+
const spaceBelow = window.innerHeight - containerRect.bottom;
|
|
142
|
+
const position = (isInit ? containerRect.height + 41 : containerRect.height) + 4;
|
|
143
|
+
if (spaceBelow >= targetHeight + 8) {
|
|
144
|
+
actionStyle.value.top = "".concat(position, "px");
|
|
145
|
+
actionStyle.value.bottom = "auto";
|
|
146
|
+
} else {
|
|
147
|
+
actionStyle.value.bottom = "".concat(position, "px");
|
|
148
|
+
actionStyle.value.top = "auto";
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
const updatePosition = () => calcStyle();
|
|
152
|
+
onMounted(() => {
|
|
153
|
+
calcStyle(true);
|
|
154
|
+
window.addEventListener("resize", updatePosition, { passive: true });
|
|
155
|
+
});
|
|
156
|
+
onUnmounted(() => {
|
|
157
|
+
window.removeEventListener("resize", updatePosition);
|
|
158
|
+
});
|
|
159
|
+
return { actions, actionStyle, containerStyle, contentStyle };
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export { computedInLineAIParams, useAI, useBase, useInLineAIContainerClick };
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { defineComponent, createVNode, withDirectives, vModelText, ref, computed, onMounted } from 'vue';
|
|
2
|
+
import { useNamespace } from '@ibiz-template/vue3-util';
|
|
3
|
+
import { computedInLineAIParams, useBase, useInLineAIContainerClick, useAI } from './inline-ai-textarea.hook.mjs';
|
|
4
|
+
import { AIIcon, StopIcon, SendIcon } from './icon.mjs';
|
|
5
|
+
import './inline-ai-textarea.css';
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
const InlineAITextArea = /* @__PURE__ */ defineComponent({
|
|
9
|
+
props: {
|
|
10
|
+
context: {
|
|
11
|
+
type: Object,
|
|
12
|
+
required: true
|
|
13
|
+
},
|
|
14
|
+
params: {
|
|
15
|
+
type: Object,
|
|
16
|
+
required: true
|
|
17
|
+
},
|
|
18
|
+
data: {
|
|
19
|
+
type: Object,
|
|
20
|
+
required: true
|
|
21
|
+
},
|
|
22
|
+
content: {
|
|
23
|
+
type: String,
|
|
24
|
+
required: true
|
|
25
|
+
},
|
|
26
|
+
deACMode: {
|
|
27
|
+
type: Object,
|
|
28
|
+
required: true
|
|
29
|
+
},
|
|
30
|
+
options: {
|
|
31
|
+
type: Object,
|
|
32
|
+
required: true
|
|
33
|
+
},
|
|
34
|
+
insertText: {
|
|
35
|
+
type: Function,
|
|
36
|
+
required: true
|
|
37
|
+
},
|
|
38
|
+
replaceSelectionText: {
|
|
39
|
+
type: Function,
|
|
40
|
+
required: true
|
|
41
|
+
},
|
|
42
|
+
restoreSelection: {
|
|
43
|
+
type: Function,
|
|
44
|
+
required: true
|
|
45
|
+
},
|
|
46
|
+
unMountAIChat: {
|
|
47
|
+
type: Function,
|
|
48
|
+
required: true
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
setup(props, ctx) {
|
|
52
|
+
const ns = useNamespace("inline-ai-textarea-container");
|
|
53
|
+
const containerRef = ref();
|
|
54
|
+
const actionsRef = ref();
|
|
55
|
+
const {
|
|
56
|
+
srfaiappendcurdata,
|
|
57
|
+
srfaiautoappend,
|
|
58
|
+
srfmode
|
|
59
|
+
} = computedInLineAIParams(props);
|
|
60
|
+
const {
|
|
61
|
+
actions,
|
|
62
|
+
actionStyle,
|
|
63
|
+
containerStyle,
|
|
64
|
+
contentStyle
|
|
65
|
+
} = useBase(props, containerRef, actionsRef);
|
|
66
|
+
useInLineAIContainerClick(props);
|
|
67
|
+
const {
|
|
68
|
+
askAI
|
|
69
|
+
} = useAI(props, {
|
|
70
|
+
srfaiappendcurdata,
|
|
71
|
+
srfmode
|
|
72
|
+
});
|
|
73
|
+
const textareaContent = ref(props.content);
|
|
74
|
+
let question;
|
|
75
|
+
const contentType = ref("USER");
|
|
76
|
+
const isLoading = ref(false);
|
|
77
|
+
const disabled = computed(() => {
|
|
78
|
+
return contentType.value === "ASSISTANT" || isLoading.value;
|
|
79
|
+
});
|
|
80
|
+
const sendQuestion = async (content) => {
|
|
81
|
+
question = content;
|
|
82
|
+
textareaContent.value = "";
|
|
83
|
+
isLoading.value = true;
|
|
84
|
+
textareaContent.value = await askAI(question);
|
|
85
|
+
isLoading.value = false;
|
|
86
|
+
contentType.value = "ASSISTANT";
|
|
87
|
+
};
|
|
88
|
+
const stopQuestion = () => {
|
|
89
|
+
props.unMountAIChat();
|
|
90
|
+
};
|
|
91
|
+
const onKeydown = (e) => {
|
|
92
|
+
if (e.code === "Enter" && !e.isComposing) {
|
|
93
|
+
e.stopPropagation();
|
|
94
|
+
if (e.shiftKey === false) {
|
|
95
|
+
sendQuestion(textareaContent.value);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const handleAction = (_e, actionName) => {
|
|
100
|
+
const content = textareaContent.value;
|
|
101
|
+
switch (actionName) {
|
|
102
|
+
case "regenerate":
|
|
103
|
+
sendQuestion(question);
|
|
104
|
+
break;
|
|
105
|
+
case "insertText":
|
|
106
|
+
props.insertText(content);
|
|
107
|
+
props.unMountAIChat();
|
|
108
|
+
break;
|
|
109
|
+
case "replaceText":
|
|
110
|
+
props.replaceSelectionText(content);
|
|
111
|
+
props.unMountAIChat();
|
|
112
|
+
break;
|
|
113
|
+
case "copyText":
|
|
114
|
+
ibiz.util.text.copy(content);
|
|
115
|
+
props.unMountAIChat();
|
|
116
|
+
break;
|
|
117
|
+
case "cancel":
|
|
118
|
+
props.unMountAIChat();
|
|
119
|
+
break;
|
|
120
|
+
default:
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
onMounted(() => {
|
|
125
|
+
if (srfaiautoappend)
|
|
126
|
+
sendQuestion(textareaContent.value);
|
|
127
|
+
});
|
|
128
|
+
return {
|
|
129
|
+
ns,
|
|
130
|
+
actions,
|
|
131
|
+
isLoading,
|
|
132
|
+
actionsRef,
|
|
133
|
+
disabled,
|
|
134
|
+
actionStyle,
|
|
135
|
+
contentType,
|
|
136
|
+
containerRef,
|
|
137
|
+
contentStyle,
|
|
138
|
+
containerStyle,
|
|
139
|
+
textareaContent,
|
|
140
|
+
onKeydown,
|
|
141
|
+
sendQuestion,
|
|
142
|
+
stopQuestion,
|
|
143
|
+
handleAction
|
|
144
|
+
};
|
|
145
|
+
},
|
|
146
|
+
render() {
|
|
147
|
+
return createVNode("div", {
|
|
148
|
+
"ref": "containerRef",
|
|
149
|
+
"class": this.ns.b(),
|
|
150
|
+
"style": this.containerStyle
|
|
151
|
+
}, [createVNode("div", {
|
|
152
|
+
"class": this.ns.e("content"),
|
|
153
|
+
"style": this.contentStyle
|
|
154
|
+
}, [!this.disabled && createVNode("div", {
|
|
155
|
+
"class": this.ns.em("content", "prefix")
|
|
156
|
+
}, [createVNode("div", {
|
|
157
|
+
"class": this.ns.em("content", "ai-icon")
|
|
158
|
+
}, [AIIcon])]), createVNode("div", {
|
|
159
|
+
"class": this.ns.em("content", "textarea")
|
|
160
|
+
}, [this.isLoading && createVNode("div", {
|
|
161
|
+
"class": "el-loading-mask",
|
|
162
|
+
"style": ""
|
|
163
|
+
}, [createVNode("div", {
|
|
164
|
+
"class": "el-loading-spinner"
|
|
165
|
+
}, [createVNode("svg", {
|
|
166
|
+
"class": "circular",
|
|
167
|
+
"viewBox": "0 0 50 50"
|
|
168
|
+
}, [createVNode("circle", {
|
|
169
|
+
"class": "path",
|
|
170
|
+
"cx": "25",
|
|
171
|
+
"cy": "25",
|
|
172
|
+
"r": "20",
|
|
173
|
+
"fill": "none"
|
|
174
|
+
}, null)])])]), withDirectives(createVNode("textarea", {
|
|
175
|
+
"disabled": this.disabled,
|
|
176
|
+
"onKeydown": this.onKeydown,
|
|
177
|
+
"onUpdate:modelValue": ($event) => this.textareaContent = $event
|
|
178
|
+
}, null), [[vModelText, this.textareaContent]])]), this.contentType === "USER" && createVNode("div", {
|
|
179
|
+
"class": this.ns.em("content", "suffix")
|
|
180
|
+
}, [this.isLoading ? createVNode("div", {
|
|
181
|
+
"class": this.ns.em("content", "stop-icon"),
|
|
182
|
+
"onClick": () => this.stopQuestion()
|
|
183
|
+
}, [StopIcon, createVNode("span", null, [ibiz.i18n.t("util.inlineAiUtil.stopEdit")])]) : createVNode("div", {
|
|
184
|
+
"class": this.ns.em("content", "sand-icon"),
|
|
185
|
+
"onClick": () => this.sendQuestion(this.textareaContent)
|
|
186
|
+
}, [SendIcon])])]), this.contentType === "ASSISTANT" && createVNode("div", {
|
|
187
|
+
"class": this.ns.e("footer")
|
|
188
|
+
}, [ibiz.i18n.t("util.inlineAiUtil.info")]), createVNode("div", {
|
|
189
|
+
"ref": "actionsRef",
|
|
190
|
+
"class": [this.ns.e("actions"), this.ns.is("show", this.contentType === "ASSISTANT")],
|
|
191
|
+
"style": this.actionStyle
|
|
192
|
+
}, [this.actions.map((action) => {
|
|
193
|
+
if (action.itemType === "divider")
|
|
194
|
+
return createVNode("div", {
|
|
195
|
+
"class": this.ns.em("actions", action.itemType)
|
|
196
|
+
}, null);
|
|
197
|
+
return createVNode("div", {
|
|
198
|
+
"class": [this.ns.em("actions", action.itemType), this.ns.is("danger", action.actionName === "cancel")],
|
|
199
|
+
"onClick": (e) => this.handleAction(e, action.actionName)
|
|
200
|
+
}, [action.icon, createVNode("span", null, [action.title])]);
|
|
201
|
+
})])]);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
export { InlineAITextArea };
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { h, createApp } from 'vue';
|
|
2
|
+
import ContextMenu from '@imengyu/vue3-context-menu';
|
|
3
|
+
import { useNamespace } from '@ibiz-template/vue3-util';
|
|
4
|
+
import { InlineAITextArea } from './inline-ai-textarea/inline-ai-textarea.mjs';
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __publicField = (obj, key, value) => {
|
|
10
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
11
|
+
return value;
|
|
12
|
+
};
|
|
13
|
+
class InLineAIUtil {
|
|
14
|
+
/**
|
|
15
|
+
* Creates an instance of InLineAIUtil.
|
|
16
|
+
* @memberof InLineAIUtil
|
|
17
|
+
*/
|
|
18
|
+
constructor() {
|
|
19
|
+
__publicField(this, "currentApp", null);
|
|
20
|
+
__publicField(this, "container", null);
|
|
21
|
+
__publicField(this, "ns", useNamespace("inline-ai-container"));
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 计算上下文菜单
|
|
25
|
+
* @param deACMode
|
|
26
|
+
* @param clickCallBack
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
calcContextMenus(deACMode, clickCallBack) {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
const menus = [];
|
|
32
|
+
if (!deACMode || !deACMode.deuiactionGroup || !deACMode.deuiactionGroup.uiactionGroupDetails)
|
|
33
|
+
return menus;
|
|
34
|
+
(_b = (_a = deACMode.deuiactionGroup) == null ? void 0 : _a.uiactionGroupDetails) == null ? void 0 : _b.forEach((item) => {
|
|
35
|
+
var _a2, _b2, _c;
|
|
36
|
+
const menuItem = {};
|
|
37
|
+
if (item.detailType === "DEUIACTION" && ((_a2 = item.uiactionId) == null ? void 0 : _a2.startsWith("inline"))) {
|
|
38
|
+
if (item.showCaption && item.caption) {
|
|
39
|
+
menuItem.label = item.caption;
|
|
40
|
+
}
|
|
41
|
+
if (item.sysImage && item.showIcon) {
|
|
42
|
+
menuItem.icon = h("iBizIcon", {
|
|
43
|
+
icon: item.sysImage
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
menuItem.clickClose = true;
|
|
47
|
+
const { uiactionId } = item;
|
|
48
|
+
if (uiactionId) {
|
|
49
|
+
menuItem.onClick = () => {
|
|
50
|
+
clickCallBack(uiactionId);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
menus.push(menuItem);
|
|
54
|
+
} else if (item.detailType === "DEUIACTIONGROUP" && item.refUIActionGroup && ((_b2 = item.refUIActionGroup.id) == null ? void 0 : _b2.startsWith("inline"))) {
|
|
55
|
+
menuItem.label = item.refUIActionGroup.name;
|
|
56
|
+
const menuItems = (_c = item.refUIActionGroup.uiactionGroupDetails) == null ? void 0 : _c.filter((detail) => {
|
|
57
|
+
var _a3;
|
|
58
|
+
return detail.detailType === "DEUIACTION" && ((_a3 = detail.uiactionId) == null ? void 0 : _a3.startsWith("inline"));
|
|
59
|
+
}).map((detail) => {
|
|
60
|
+
return {
|
|
61
|
+
label: detail.showCaption ? detail.caption : void 0,
|
|
62
|
+
icon: detail.showIcon && detail.sysImage ? h("iBizIcon", {
|
|
63
|
+
icon: detail.sysImage
|
|
64
|
+
}) : void 0,
|
|
65
|
+
clickableWhenHasChildren: true,
|
|
66
|
+
onClick: () => {
|
|
67
|
+
ContextMenu.closeContextMenu();
|
|
68
|
+
clickCallBack(detail.uiactionId);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
menuItem.children = menuItems;
|
|
73
|
+
menus.push(menuItem);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
return menus;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* 显示上下文菜单
|
|
80
|
+
* @param x 距离左侧距离
|
|
81
|
+
* @param y 距离上方距离
|
|
82
|
+
* @param menus 菜单集合
|
|
83
|
+
*/
|
|
84
|
+
showContextMenus(x, y, menus) {
|
|
85
|
+
ContextMenu.showContextMenu({
|
|
86
|
+
x,
|
|
87
|
+
y,
|
|
88
|
+
customClass: this.ns.b("context-menu"),
|
|
89
|
+
items: menus
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* 销毁组件实例
|
|
94
|
+
*/
|
|
95
|
+
destroyInlineAIComponent() {
|
|
96
|
+
if (this.currentApp && this.container) {
|
|
97
|
+
this.currentApp.unmount();
|
|
98
|
+
this.currentApp = null;
|
|
99
|
+
}
|
|
100
|
+
if (this.container && document.body.contains(this.container)) {
|
|
101
|
+
document.body.removeChild(this.container);
|
|
102
|
+
this.container = null;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* 显示AI聊天组件
|
|
107
|
+
* @param selectText
|
|
108
|
+
* @param options
|
|
109
|
+
* @returns
|
|
110
|
+
*/
|
|
111
|
+
showAIChat(context, params, data, selectText, deACMode, options) {
|
|
112
|
+
this.destroyInlineAIComponent();
|
|
113
|
+
this.container = document.createElement("div");
|
|
114
|
+
this.container.id = this.ns.b();
|
|
115
|
+
this.container.className = this.ns.b();
|
|
116
|
+
document.body.appendChild(this.container);
|
|
117
|
+
const { editor } = params;
|
|
118
|
+
const { insertText, replaceSelectionText, restoreSelection } = editor;
|
|
119
|
+
delete params.editor;
|
|
120
|
+
const unMountAIChat = () => {
|
|
121
|
+
this.destroyInlineAIComponent();
|
|
122
|
+
};
|
|
123
|
+
this.currentApp = createApp(InlineAITextArea, {
|
|
124
|
+
context,
|
|
125
|
+
params,
|
|
126
|
+
data,
|
|
127
|
+
content: selectText,
|
|
128
|
+
deACMode,
|
|
129
|
+
options,
|
|
130
|
+
insertText: insertText.bind(editor),
|
|
131
|
+
replaceSelectionText: replaceSelectionText.bind(editor),
|
|
132
|
+
restoreSelection: restoreSelection.bind(editor),
|
|
133
|
+
unMountAIChat
|
|
134
|
+
});
|
|
135
|
+
this.currentApp.mount(this.container);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* 隐藏AI聊天组件
|
|
139
|
+
*/
|
|
140
|
+
hideAIChat() {
|
|
141
|
+
this.destroyInlineAIComponent();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export { InLineAIUtil };
|
package/es/web-app/main.mjs
CHANGED
|
@@ -21,6 +21,7 @@ import { NotificationUtil } from '../util/notification-util/notification-util.mj
|
|
|
21
21
|
import { LoadingUtil } from '../util/loading-util/loading-util.mjs';
|
|
22
22
|
import { NoticeUtil } from '../util/notice-util/notice-util.mjs';
|
|
23
23
|
import { OverlayController } from '../util/overlay-controller/overlay-controller.mjs';
|
|
24
|
+
import { InLineAIUtil } from '../util/inline-ai-util/inline-ai-util.mjs';
|
|
24
25
|
import { FullscreenUtil } from '../util/fullscreen/fullscreen-util.mjs';
|
|
25
26
|
|
|
26
27
|
"use strict";
|
|
@@ -81,6 +82,7 @@ async function runApp(plugins, opts) {
|
|
|
81
82
|
ibiz.loading = new LoadingUtil();
|
|
82
83
|
ibiz.notice = new NoticeUtil();
|
|
83
84
|
ibiz.overlay = new OverlayController();
|
|
85
|
+
ibiz.inLineAIUtil = new InLineAIUtil();
|
|
84
86
|
ibiz.util.text.format = (value, code) => {
|
|
85
87
|
return app.config.globalProperties.$textFormat(value, code);
|
|
86
88
|
};
|