@ibiz-template/vue3-components 0.7.41-alpha.36 → 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-CxXULY47.js → xlsx-util-BMANxyk-.js} +1 -1
- package/es/control/calendar/calendar.mjs +33 -8
- 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/form-mdctrl-repeater.util.mjs +30 -0
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.mjs +114 -85
- 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/control/tab-exp-panel/tab-exp-panel.mjs +4 -17
- 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/editor/text-box/input/input.css +1 -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/panel-component/nav-breadcrumb/nav-breadcrumb.util.mjs +1 -1
- package/es/panel-component/user-message/internal-message/internal-message-json/internal-message-json.provider.mjs +2 -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/calendar/calendar.cjs +32 -7
- 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/form-mdctrl-repeater.util.cjs +32 -0
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.cjs +113 -84
- 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/control/tab-exp-panel/tab-exp-panel.cjs +3 -16
- 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/editor/text-box/input/input.css +1 -1
- 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/panel-component/nav-breadcrumb/nav-breadcrumb.util.cjs +1 -1
- package/lib/panel-component/user-message/internal-message/internal-message-json/internal-message-json.provider.cjs +2 -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-CCKb6xlM.js +0 -11
- package/dist/wang-editor-BIllIvre.js +0 -1
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { isVNode, defineComponent, createVNode, resolveComponent, mergeProps, withDirectives, resolveDirective, toRaw, h, ref, reactive, watch, onUnmounted } from 'vue';
|
|
2
|
+
import Sortable from '../../../../../../node_modules/.pnpm/sortablejs@1.15.6/node_modules/sortablejs/modular/sortable.esm.mjs';
|
|
3
|
+
import { EditFormController, ControlVO, FormMDCtrlRepeaterController } from '@ibiz-template/runtime';
|
|
4
|
+
import { createUUID } from 'qx-util';
|
|
5
|
+
import { useNamespace, useCtx } from '@ibiz-template/vue3-util';
|
|
6
|
+
import { recursiveIterate } from '@ibiz-template/core';
|
|
7
|
+
import { useLoadMore } from '../form-mdctrl-repeater.util.mjs';
|
|
8
|
+
import './repeater-grid2.css';
|
|
9
|
+
|
|
10
|
+
"use strict";
|
|
11
|
+
function _isSlot(s) {
|
|
12
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
13
|
+
}
|
|
14
|
+
const RepeaterGrid2 = /* @__PURE__ */ defineComponent({
|
|
15
|
+
name: "IBizRepeaterGrid2",
|
|
16
|
+
props: {
|
|
17
|
+
controller: {
|
|
18
|
+
type: FormMDCtrlRepeaterController,
|
|
19
|
+
required: true
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
emits: {
|
|
23
|
+
change: (_value) => true
|
|
24
|
+
},
|
|
25
|
+
setup(props, {
|
|
26
|
+
emit
|
|
27
|
+
}) {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
const ns = useNamespace("repeater-grid2");
|
|
30
|
+
const formItems = [];
|
|
31
|
+
const tableRef = ref();
|
|
32
|
+
const tableKey = ref(createUUID());
|
|
33
|
+
const chunkSize = ((_a = props.controller.model.ctrlParams) == null ? void 0 : _a.chunkSize) ? Number((_b = props.controller.model.ctrlParams) == null ? void 0 : _b.chunkSize) : 100;
|
|
34
|
+
const {
|
|
35
|
+
renderItems,
|
|
36
|
+
loadMore,
|
|
37
|
+
updateTotalItems
|
|
38
|
+
} = useLoadMore(props.controller.value, chunkSize);
|
|
39
|
+
recursiveIterate(props.controller.repeatedForm, (item) => {
|
|
40
|
+
var _a2;
|
|
41
|
+
if (item.detailType === "FORMITEM") {
|
|
42
|
+
if (((_a2 = item.editor) == null ? void 0 : _a2.editorType) !== "HIDDEN") {
|
|
43
|
+
formItems.push(item);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
childrenFields: ["deformPages", "deformTabPages", "deformDetails"]
|
|
48
|
+
});
|
|
49
|
+
const onSingleValueChange = (value, index) => {
|
|
50
|
+
const arrData = [...props.controller.value || []];
|
|
51
|
+
arrData[index] = value;
|
|
52
|
+
emit("change", arrData);
|
|
53
|
+
};
|
|
54
|
+
const ctx = useCtx();
|
|
55
|
+
const formControllers = reactive([]);
|
|
56
|
+
const addFormController = async (data = {}) => {
|
|
57
|
+
const formC = new EditFormController(props.controller.repeatedForm, props.controller.context, props.controller.params, ctx);
|
|
58
|
+
formC.state.isSimple = true;
|
|
59
|
+
await formC.created();
|
|
60
|
+
formC.setSimpleData(data);
|
|
61
|
+
formControllers.push(formC);
|
|
62
|
+
props.controller.setRepeaterController("".concat(formControllers.length - 1), formC);
|
|
63
|
+
formC.evt.on("onFormDataChange", (event) => {
|
|
64
|
+
const item = event.data[0];
|
|
65
|
+
const formData = item instanceof ControlVO ? item.clone() : {
|
|
66
|
+
...item
|
|
67
|
+
};
|
|
68
|
+
const index = formControllers.indexOf(formC);
|
|
69
|
+
onSingleValueChange(formData, index);
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
watch(() => props.controller.value, (newVal) => {
|
|
73
|
+
if (newVal && newVal.length > 0) {
|
|
74
|
+
newVal.forEach((item, index) => {
|
|
75
|
+
const formC = formControllers[index];
|
|
76
|
+
if (formC) {
|
|
77
|
+
const changeVal = item || {};
|
|
78
|
+
const find = Object.keys(formC.data).find((key) => {
|
|
79
|
+
return changeVal[key] !== formC.data[key];
|
|
80
|
+
});
|
|
81
|
+
if (find) {
|
|
82
|
+
formC.setSimpleData(changeVal);
|
|
83
|
+
}
|
|
84
|
+
} else {
|
|
85
|
+
addFormController(item);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
updateTotalItems(newVal || []);
|
|
90
|
+
}, {
|
|
91
|
+
immediate: true,
|
|
92
|
+
deep: true
|
|
93
|
+
});
|
|
94
|
+
let sortable;
|
|
95
|
+
const rowDrop = () => {
|
|
96
|
+
var _a2, _b2;
|
|
97
|
+
const wrapper = (_b2 = (_a2 = tableRef.value) == null ? void 0 : _a2.$el) == null ? void 0 : _b2.querySelector(".el-table__body-wrapper tbody");
|
|
98
|
+
if (!wrapper || !props.controller.enableSort)
|
|
99
|
+
return;
|
|
100
|
+
sortable = Sortable.create(wrapper, {
|
|
101
|
+
animation: 150,
|
|
102
|
+
handle: ".".concat(ns.e("drag-icon")),
|
|
103
|
+
ghostClass: "".concat(ns.e("sortable-ghost")),
|
|
104
|
+
onEnd({
|
|
105
|
+
newIndex,
|
|
106
|
+
oldIndex
|
|
107
|
+
}) {
|
|
108
|
+
props.controller.dragChange(oldIndex, newIndex);
|
|
109
|
+
tableKey.value = createUUID();
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
watch(() => tableRef.value, () => {
|
|
114
|
+
if (!props.controller.enableSort)
|
|
115
|
+
return;
|
|
116
|
+
tableRef.value ? rowDrop() : sortable == null ? void 0 : sortable.destroy();
|
|
117
|
+
});
|
|
118
|
+
onUnmounted(() => sortable == null ? void 0 : sortable.destroy());
|
|
119
|
+
const renderRemoveBtn = (index) => {
|
|
120
|
+
if (ibiz.config.form.mdCtrlConfirmBeforeRemove) {
|
|
121
|
+
return createVNode(resolveComponent("el-popconfirm"), {
|
|
122
|
+
"title": ibiz.i18n.t("control.form.repeaterGrid.promptInformation"),
|
|
123
|
+
"confirm-button-text": ibiz.i18n.t("app.confirm"),
|
|
124
|
+
"cancel-button-text": ibiz.i18n.t("app.cancel"),
|
|
125
|
+
"onConfirm": () => {
|
|
126
|
+
props.controller.remove(index);
|
|
127
|
+
formControllers.splice(index, 1);
|
|
128
|
+
}
|
|
129
|
+
}, {
|
|
130
|
+
reference: () => {
|
|
131
|
+
return createVNode("ion-icon", {
|
|
132
|
+
"name": "remove-outline",
|
|
133
|
+
"title": ibiz.i18n.t("app.delete"),
|
|
134
|
+
"class": ns.b("remove-btn")
|
|
135
|
+
}, null);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return createVNode("ion-icon", {
|
|
140
|
+
"name": "remove-outline",
|
|
141
|
+
"title": ibiz.i18n.t("app.delete"),
|
|
142
|
+
"class": ns.b("remove-btn"),
|
|
143
|
+
"onClick": () => {
|
|
144
|
+
props.controller.remove(index);
|
|
145
|
+
formControllers.splice(index, 1);
|
|
146
|
+
}
|
|
147
|
+
}, null);
|
|
148
|
+
};
|
|
149
|
+
return {
|
|
150
|
+
ns,
|
|
151
|
+
tableRef,
|
|
152
|
+
tableKey,
|
|
153
|
+
formItems,
|
|
154
|
+
renderItems,
|
|
155
|
+
formControllers,
|
|
156
|
+
renderRemoveBtn,
|
|
157
|
+
loadMore
|
|
158
|
+
};
|
|
159
|
+
},
|
|
160
|
+
render() {
|
|
161
|
+
var _a;
|
|
162
|
+
const tableHeight = (_a = this.controller.model.layoutPos) == null ? void 0 : _a.height;
|
|
163
|
+
const heightObject = tableHeight ? {
|
|
164
|
+
height: tableHeight
|
|
165
|
+
} : {};
|
|
166
|
+
const isEmpty = this.renderItems.length === 0;
|
|
167
|
+
return createVNode("div", {
|
|
168
|
+
"class": this.ns.b()
|
|
169
|
+
}, [createVNode(resolveComponent("el-table"), mergeProps({
|
|
170
|
+
"ref": "tableRef",
|
|
171
|
+
"key": this.tableKey,
|
|
172
|
+
"show-header": true,
|
|
173
|
+
"class": this.ns.e("table"),
|
|
174
|
+
"data": isEmpty && this.controller.enableCreate ? [{}] : this.renderItems,
|
|
175
|
+
"cell-class-name": ({
|
|
176
|
+
columnIndex
|
|
177
|
+
}) => {
|
|
178
|
+
const shouldShowIndex = this.controller.enableSort ? columnIndex === 1 : columnIndex === 0;
|
|
179
|
+
return shouldShowIndex ? this.ns.b("index") : "";
|
|
180
|
+
}
|
|
181
|
+
}, heightObject), {
|
|
182
|
+
default: () => {
|
|
183
|
+
return [this.controller.enableSort && createVNode(resolveComponent("el-table-column"), {
|
|
184
|
+
"width": 26,
|
|
185
|
+
"type": "default"
|
|
186
|
+
}, {
|
|
187
|
+
default: () => {
|
|
188
|
+
if (isEmpty) {
|
|
189
|
+
return "";
|
|
190
|
+
}
|
|
191
|
+
return createVNode("svg", {
|
|
192
|
+
"viewBox": "0 0 16 16",
|
|
193
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
194
|
+
"height": "1em",
|
|
195
|
+
"width": "1em",
|
|
196
|
+
"class": this.ns.e("drag-icon"),
|
|
197
|
+
"preserveAspectRatio": "xMidYMid meet",
|
|
198
|
+
"focusable": "false"
|
|
199
|
+
}, [createVNode("g", {
|
|
200
|
+
"stroke-width": "1",
|
|
201
|
+
"fill-rule": "evenodd"
|
|
202
|
+
}, [createVNode("g", {
|
|
203
|
+
"transform": "translate(5 1)",
|
|
204
|
+
"fill-rule": "nonzero"
|
|
205
|
+
}, [createVNode("path", {
|
|
206
|
+
"d": "M1 2a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm4 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2zM1 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm4 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm-4 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm4 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm-4 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm4 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"
|
|
207
|
+
}, null)])])]);
|
|
208
|
+
}
|
|
209
|
+
}), createVNode(resolveComponent("el-table-column"), {
|
|
210
|
+
"type": "index",
|
|
211
|
+
"width": 66,
|
|
212
|
+
"align": "center"
|
|
213
|
+
}, {
|
|
214
|
+
default: (opts) => {
|
|
215
|
+
if (isEmpty) {
|
|
216
|
+
return "";
|
|
217
|
+
}
|
|
218
|
+
const {
|
|
219
|
+
$index
|
|
220
|
+
} = opts;
|
|
221
|
+
return createVNode("span", null, [$index + 1]);
|
|
222
|
+
}
|
|
223
|
+
}), this.formItems.length > 0 && this.formItems.map((item) => {
|
|
224
|
+
const width = item.labelWidth;
|
|
225
|
+
let widthName = "width";
|
|
226
|
+
let columnWidth = "";
|
|
227
|
+
if (typeof width === "number") {
|
|
228
|
+
if (width === 1) {
|
|
229
|
+
widthName = "min-width";
|
|
230
|
+
}
|
|
231
|
+
columnWidth = "".concat(width, "px");
|
|
232
|
+
}
|
|
233
|
+
return createVNode(resolveComponent("el-table-column"), mergeProps({
|
|
234
|
+
"label": item.caption,
|
|
235
|
+
"prop": item.id
|
|
236
|
+
}, {
|
|
237
|
+
[widthName]: columnWidth
|
|
238
|
+
}, {
|
|
239
|
+
"align": "center"
|
|
240
|
+
}), {
|
|
241
|
+
default: (opts) => {
|
|
242
|
+
if (isEmpty) {
|
|
243
|
+
return "";
|
|
244
|
+
}
|
|
245
|
+
const {
|
|
246
|
+
$index
|
|
247
|
+
} = opts;
|
|
248
|
+
const formC = toRaw(this.formControllers[$index]);
|
|
249
|
+
if (!formC || !formC.state.isLoaded) {
|
|
250
|
+
return createVNode("div", null, [ibiz.i18n.t("control.form.repeaterGrid.absentOrLoad")]);
|
|
251
|
+
}
|
|
252
|
+
const formItemC = formC.formItems.find((x) => x.name === item.id);
|
|
253
|
+
let editor = null;
|
|
254
|
+
if (!formItemC.editorProvider) {
|
|
255
|
+
editor = createVNode(resolveComponent("not-supported-editor"), {
|
|
256
|
+
"modelData": item.editor
|
|
257
|
+
}, null);
|
|
258
|
+
} else {
|
|
259
|
+
const component = resolveComponent(formItemC.editorProvider.formEditor);
|
|
260
|
+
editor = h(component, {
|
|
261
|
+
value: formItemC.value,
|
|
262
|
+
data: formItemC.data,
|
|
263
|
+
controller: formItemC.editor,
|
|
264
|
+
disabled: formItemC.state.disabled,
|
|
265
|
+
readonly: formItemC.state.readonly,
|
|
266
|
+
onChange: (val, name) => {
|
|
267
|
+
formItemC.setDataValue(val, name);
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
return createVNode(resolveComponent("iBizGridEditItem"), {
|
|
272
|
+
"error": formItemC.state.error,
|
|
273
|
+
"required": formItemC.state.required
|
|
274
|
+
}, _isSlot(editor) ? editor : {
|
|
275
|
+
default: () => [editor]
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
}), (this.controller.enableCreate || this.controller.enableDelete) && createVNode(resolveComponent("el-table-column"), {
|
|
280
|
+
"width": 80,
|
|
281
|
+
"align": "center"
|
|
282
|
+
}, {
|
|
283
|
+
default: (opts) => {
|
|
284
|
+
const {
|
|
285
|
+
$index
|
|
286
|
+
} = opts;
|
|
287
|
+
return createVNode("div", {
|
|
288
|
+
"class": this.ns.b("action-group")
|
|
289
|
+
}, [this.controller.enableCreate && createVNode("ion-icon", {
|
|
290
|
+
"name": "add-outline",
|
|
291
|
+
"title": ibiz.i18n.t("app.add"),
|
|
292
|
+
"class": this.ns.b("add-btn"),
|
|
293
|
+
"onClick": () => {
|
|
294
|
+
this.controller.create(isEmpty ? 0 : $index + 1);
|
|
295
|
+
}
|
|
296
|
+
}, null), this.controller.enableDelete && !isEmpty && this.renderRemoveBtn($index)]);
|
|
297
|
+
}
|
|
298
|
+
})];
|
|
299
|
+
},
|
|
300
|
+
append: () => {
|
|
301
|
+
return [tableHeight && withDirectives(createVNode("div", {
|
|
302
|
+
"infinite-scroll-distance": 20
|
|
303
|
+
}, null), [[resolveDirective("infinite-scroll"), () => this.loadMore()]])];
|
|
304
|
+
}
|
|
305
|
+
})]);
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
export { RepeaterGrid2 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isVNode, defineComponent, createVNode, resolveComponent,
|
|
1
|
+
import { isVNode, defineComponent, createVNode, resolveComponent, watch } from 'vue';
|
|
2
2
|
import { useControlController, useNamespace, getNestedRoutePath, route2routePath } from '@ibiz-template/vue3-util';
|
|
3
3
|
import './tab-exp-panel.css';
|
|
4
4
|
import { TabExpPanelController } from '@ibiz-template/runtime';
|
|
@@ -52,19 +52,6 @@ const TabExpPanelControl = /* @__PURE__ */ defineComponent({
|
|
|
52
52
|
var _a;
|
|
53
53
|
const c = useControlController((...args) => new TabExpPanelController(...args));
|
|
54
54
|
const ns = useNamespace("control-".concat(c.model.controlType.toLowerCase()));
|
|
55
|
-
const counterData = ref({});
|
|
56
|
-
const fn = (counter) => {
|
|
57
|
-
counterData.value = counter;
|
|
58
|
-
};
|
|
59
|
-
c.evt.on("onCreated", () => {
|
|
60
|
-
if (c.counter) {
|
|
61
|
-
c.counter.onChange(fn, true);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
onUnmounted(() => {
|
|
65
|
-
var _a2;
|
|
66
|
-
(_a2 = c.counter) == null ? void 0 : _a2.offChange(fn);
|
|
67
|
-
});
|
|
68
55
|
const handleTabChange = () => {
|
|
69
56
|
c.handleTabChange();
|
|
70
57
|
};
|
|
@@ -98,7 +85,6 @@ const TabExpPanelControl = /* @__PURE__ */ defineComponent({
|
|
|
98
85
|
c,
|
|
99
86
|
ns,
|
|
100
87
|
tabPosition,
|
|
101
|
-
counterData,
|
|
102
88
|
handleTabChange
|
|
103
89
|
};
|
|
104
90
|
},
|
|
@@ -106,7 +92,8 @@ const TabExpPanelControl = /* @__PURE__ */ defineComponent({
|
|
|
106
92
|
let _slot;
|
|
107
93
|
const {
|
|
108
94
|
isCreated,
|
|
109
|
-
tabPages
|
|
95
|
+
tabPages,
|
|
96
|
+
counterData
|
|
110
97
|
} = this.c.state;
|
|
111
98
|
return createVNode(resolveComponent("iBizControlBase"), {
|
|
112
99
|
"controller": this.c
|
|
@@ -117,7 +104,7 @@ const TabExpPanelControl = /* @__PURE__ */ defineComponent({
|
|
|
117
104
|
"tabPosition": this.tabPosition,
|
|
118
105
|
"onTabChange": this.handleTabChange
|
|
119
106
|
}, _isSlot(_slot = tabPages.map((tab) => {
|
|
120
|
-
const counterNum = tab.counterId ?
|
|
107
|
+
const counterNum = tab.counterId ? counterData[tab.counterId] : void 0;
|
|
121
108
|
return createVNode(resolveComponent("el-tab-pane"), {
|
|
122
109
|
"class": [this.ns.e("tab-item")],
|
|
123
110
|
"label": tab.caption,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RuntimeError } from '@ibiz-template/core';
|
|
2
|
+
import { EditorController, getDeACMode, UIActionUtil } from '@ibiz-template/runtime';
|
|
2
3
|
|
|
3
4
|
"use strict";
|
|
4
5
|
var __defProp = Object.defineProperty;
|
|
@@ -17,6 +18,29 @@ class CodeEditorController extends EditorController {
|
|
|
17
18
|
* @memberof CodeEditorController
|
|
18
19
|
*/
|
|
19
20
|
__publicField(this, "deACMode");
|
|
21
|
+
/**
|
|
22
|
+
* editor 实例
|
|
23
|
+
*
|
|
24
|
+
* @private
|
|
25
|
+
* @type {Monaco.editor.IStandaloneCodeEditor}
|
|
26
|
+
* @memberof HtmlEditorController
|
|
27
|
+
*/
|
|
28
|
+
__publicField(this, "editor");
|
|
29
|
+
/**
|
|
30
|
+
* monaco 实例
|
|
31
|
+
*
|
|
32
|
+
* @private
|
|
33
|
+
* @type {IMonaco}
|
|
34
|
+
* @memberof CodeEditorController
|
|
35
|
+
*/
|
|
36
|
+
__publicField(this, "monaco");
|
|
37
|
+
/**
|
|
38
|
+
* editor 当前选区
|
|
39
|
+
*
|
|
40
|
+
* @type {monaco.Selection}
|
|
41
|
+
* @memberof CodeEditorController
|
|
42
|
+
*/
|
|
43
|
+
__publicField(this, "currentSelection");
|
|
20
44
|
}
|
|
21
45
|
/**
|
|
22
46
|
* 语言类型
|
|
@@ -53,6 +77,157 @@ class CodeEditorController extends EditorController {
|
|
|
53
77
|
this.context.srfappid
|
|
54
78
|
);
|
|
55
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* editor 创建完成
|
|
82
|
+
*
|
|
83
|
+
* @private
|
|
84
|
+
* @param {Monaco.editor.IStandaloneCodeEditor} editor
|
|
85
|
+
*/
|
|
86
|
+
onCreated(editor, monaco) {
|
|
87
|
+
this.editor = editor;
|
|
88
|
+
this.monaco = monaco;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* 获取选中文本
|
|
92
|
+
* @return {*} {string} 选中文本
|
|
93
|
+
*/
|
|
94
|
+
getSelectionText() {
|
|
95
|
+
var _a, _b, _c;
|
|
96
|
+
const selection = (_a = this.editor) == null ? void 0 : _a.getSelection();
|
|
97
|
+
let selectedText;
|
|
98
|
+
if (selection) {
|
|
99
|
+
selectedText = (_c = (_b = this.editor) == null ? void 0 : _b.getModel()) == null ? void 0 : _c.getValueInRange(selection);
|
|
100
|
+
}
|
|
101
|
+
return selectedText || "";
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* 插入文本
|
|
105
|
+
* @param {string} text 文本
|
|
106
|
+
*/
|
|
107
|
+
insertText(text) {
|
|
108
|
+
var _a, _b, _c, _d, _e, _f;
|
|
109
|
+
const model = (_a = this.editor) == null ? void 0 : _a.getModel();
|
|
110
|
+
if (!model || !this.monaco)
|
|
111
|
+
return;
|
|
112
|
+
const lastLineNumber = model.getLineCount();
|
|
113
|
+
const lastLineContent = model.getLineContent(lastLineNumber);
|
|
114
|
+
const lastColumn = lastLineContent.length + 1;
|
|
115
|
+
(_b = this.editor) == null ? void 0 : _b.executeEdits("", [
|
|
116
|
+
{
|
|
117
|
+
range: new this.monaco.Range(
|
|
118
|
+
lastLineNumber,
|
|
119
|
+
lastColumn,
|
|
120
|
+
lastLineNumber,
|
|
121
|
+
lastColumn
|
|
122
|
+
),
|
|
123
|
+
text
|
|
124
|
+
}
|
|
125
|
+
]);
|
|
126
|
+
const newLastLine = lastLineNumber + (text.includes("\n") ? 1 : 0);
|
|
127
|
+
const newLastColumn = ((_c = text.split("\n").pop()) == null ? void 0 : _c.length) || 0;
|
|
128
|
+
(_d = this.editor) == null ? void 0 : _d.setPosition(
|
|
129
|
+
new this.monaco.Position(newLastLine, newLastColumn)
|
|
130
|
+
);
|
|
131
|
+
(_e = this.editor) == null ? void 0 : _e.revealPositionInCenter(
|
|
132
|
+
new this.monaco.Position(newLastLine, newLastColumn)
|
|
133
|
+
);
|
|
134
|
+
(_f = this.editor) == null ? void 0 : _f.focus();
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* 替换选中文本
|
|
138
|
+
* @param {string} text
|
|
139
|
+
*/
|
|
140
|
+
replaceSelectionText(text) {
|
|
141
|
+
var _a;
|
|
142
|
+
const selection = (_a = this.editor) == null ? void 0 : _a.getSelection();
|
|
143
|
+
if (!selection || selection.isEmpty() || !this.monaco || !this.editor) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const startPosition = selection.getStartPosition();
|
|
147
|
+
this.editor.executeEdits("", [
|
|
148
|
+
{
|
|
149
|
+
range: selection,
|
|
150
|
+
text
|
|
151
|
+
}
|
|
152
|
+
]);
|
|
153
|
+
const textLines = text.split("\n");
|
|
154
|
+
const lineCount = textLines.length;
|
|
155
|
+
const lastLineChars = textLines[lineCount - 1].length;
|
|
156
|
+
let finalLineNumber;
|
|
157
|
+
let finalColumn;
|
|
158
|
+
if (lineCount === 1) {
|
|
159
|
+
finalLineNumber = startPosition.lineNumber;
|
|
160
|
+
finalColumn = startPosition.column + lastLineChars;
|
|
161
|
+
} else {
|
|
162
|
+
finalLineNumber = startPosition.lineNumber + (lineCount - 1);
|
|
163
|
+
finalColumn = 1 + lastLineChars;
|
|
164
|
+
}
|
|
165
|
+
const newSelection = new this.monaco.Range(
|
|
166
|
+
finalLineNumber,
|
|
167
|
+
finalColumn,
|
|
168
|
+
finalLineNumber,
|
|
169
|
+
finalColumn
|
|
170
|
+
);
|
|
171
|
+
this.editor.createDecorationsCollection().clear();
|
|
172
|
+
this.editor.setSelection(newSelection);
|
|
173
|
+
this.editor.focus();
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* 恢复选取
|
|
177
|
+
*/
|
|
178
|
+
restoreSelection() {
|
|
179
|
+
var _a;
|
|
180
|
+
(_a = this.editor) == null ? void 0 : _a.focus();
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* 获取内联AI聊天参数
|
|
184
|
+
*/
|
|
185
|
+
getInLineAiChatOptions() {
|
|
186
|
+
var _a, _b, _c, _d, _e, _f;
|
|
187
|
+
const contentArea = (_b = (_a = this.editor) == null ? void 0 : _a.getDomNode()) == null ? void 0 : _b.querySelector(".editor-scrollable");
|
|
188
|
+
if (!contentArea) {
|
|
189
|
+
throw new RuntimeError(ibiz.i18n.t("editor.code.noEditorArea"));
|
|
190
|
+
}
|
|
191
|
+
const position = (_c = this.currentSelection) == null ? void 0 : _c.getStartPosition();
|
|
192
|
+
if (!position) {
|
|
193
|
+
throw new RuntimeError(ibiz.i18n.t("editor.code.noSelStart"));
|
|
194
|
+
}
|
|
195
|
+
const coordinates = (_d = this.editor) == null ? void 0 : _d.getScrolledVisiblePosition(position);
|
|
196
|
+
const editorRect = (_f = (_e = this.editor) == null ? void 0 : _e.getDomNode()) == null ? void 0 : _f.getBoundingClientRect();
|
|
197
|
+
if (!editorRect) {
|
|
198
|
+
throw new RuntimeError(ibiz.i18n.t("editor.code.noEditorRect"));
|
|
199
|
+
}
|
|
200
|
+
if (!coordinates) {
|
|
201
|
+
throw new RuntimeError(ibiz.i18n.t("editor.code.noSelCoords"));
|
|
202
|
+
}
|
|
203
|
+
const rect = contentArea.getBoundingClientRect();
|
|
204
|
+
return {
|
|
205
|
+
left: rect.left,
|
|
206
|
+
top: editorRect.top + coordinates.top + 28,
|
|
207
|
+
// 减去 20px 的行高度及 8px 向下偏移
|
|
208
|
+
width: rect.width - 160
|
|
209
|
+
// 减去 左侧占位 及 右侧代码预览 边距
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* 执行内联AIUI操作
|
|
214
|
+
* @param uiActionId
|
|
215
|
+
* @param appId
|
|
216
|
+
*/
|
|
217
|
+
async doInLineAIUIAction(uiActionId, appId) {
|
|
218
|
+
const eventArgs = this.ctrl.getEventArgs();
|
|
219
|
+
eventArgs.params.editor = this;
|
|
220
|
+
if (this.editorParams.srfaiappendcurdata && this.editorParams.srfaiappendcurdata === "true") {
|
|
221
|
+
eventArgs.context.srfaiappendcurdata = true;
|
|
222
|
+
}
|
|
223
|
+
await UIActionUtil.exec(
|
|
224
|
+
uiActionId,
|
|
225
|
+
{
|
|
226
|
+
...eventArgs
|
|
227
|
+
},
|
|
228
|
+
appId
|
|
229
|
+
);
|
|
230
|
+
}
|
|
56
231
|
}
|
|
57
232
|
|
|
58
233
|
export { CodeEditorController };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.ibiz-code{display:flex;flex-direction:column;width:100%;height:100%}.ibiz-code__box{width:100%;height:100%;min-height:200px;overflow:hidden}.ibiz-code__first-prompt::before{padding-right:var(--ibiz-spacing-base);content:var(--ibiz-code-placeholder)}.ibiz-code-toolbar{position:absolute;top:4px;right:18px;z-index:10;display:flex;align-items:center;justify-content:end;width:auto;height:auto;padding-right:0;font-size:var(--ibiz-font-size-header-6)}.ibiz-code-toolbar>*+*{margin-left:var(--ibiz-spacing-base-loose)}.ibiz-code-toolbar__fullscreen{height:38px;padding:0 12px;font-size:var(--ibiz-font-size-regular);font-style:normal;line-height:2.8;cursor:pointer}.ibiz-code-toolbar__fullscreen:hover{background-color:var(--ibiz-color-bg-3)}.ibiz-code-footer{--ibiz-code-footer-toolbar-height:36px;--ibiz-code-footer-button-height:36px;display:flex;align-items:center;justify-content:end;width:100%;min-height:var(--ibiz-code-footer-toolbar-height);margin-top:var(--ibiz-spacing-base-tight);margin-right:var(--ibiz-spacing-tight)}.ibiz-code-footer>*+*{margin-left:var(--ibiz-spacing-base)}.ibiz-code-footer__cancel{height:var(--ibiz-code-footer-button-height);line-height:var(--ibiz-code-footer-button-height);color:var(--ibiz-color-text-1);cursor:pointer;opacity:.7}.ibiz-code-footer__cancel:hover{color:var(--ibiz-color-primary);opacity:1}.ibiz-code-footer__save{width:96px;height:var(--ibiz-code-footer-button-height);line-height:var(--ibiz-code-footer-button-height);color:var(--ibiz-color-primary-active-text);text-align:center;cursor:pointer;background-color:var(--ibiz-color-primary);border-radius:var(--ibiz-border-radius-small)}.ibiz-code-footer__save:hover{box-shadow:0 2px 5px 1px var(--ibiz-color-primary)}.ibiz-code-message{width:500px;max-width:unset}.ibiz-code-message__message-content--message-tip{color:var(--ibiz-color-text-3)}.ibiz-code-message__message-cancel{color:var(--ibiz-color-text-1);background-color:transparent}.ibiz-code-message__message-cancel:hover{color:var(--ibiz-color-primary);background-color:transparent}.ibiz-code-message__message-comfire{background-color:var(--ibiz-color-danger)!important}.ibiz-code-message__message-comfire:hover{box-shadow:0 2px 5px 1px var(--ibiz-color-danger)}.ibiz-code-editor-enable{--ibiz-code-footer-toolbar-height:36px;--ibiz-code-footer-button-height:36px}.ibiz-code-editor-enable .ibiz-code__box{height:100%}.ibiz-code-editor-enable:has(.ibiz-code-footer) .ibiz-code__box{height:calc(100% - var(--ibiz-code-footer-toolbar-height))}.ibiz-code-dialog-full-screen{width:100%!important;height:100%!important;margin:0!important}.ibiz-code-dialog-full-screen .ibiz-code-footer{--ibiz-code-footer-toolbar-height:68px}.ibiz-code-dialog-full-screen .ibiz-code{gap:0;padding:0 var(--ibiz-spacing-extra-loose);--w-e-toolbar-bg-color:var(--ibiz-color-bg-0)}.ibiz-code-dialog-full-screen .ibiz-code .ibiz-code-toolbar{right:calc(var(--ibiz-spacing-extra-loose) + 18px)}.ibiz-code-dialog-full-screen .el-dialog__header{display:none!important}.ibiz-code-dialog-full-screen .el-dialog__body{width:100%;height:100%;padding:0 0 var(--ibiz-spacing-base)}.ibiz-code-dialog-full-screen .el-dialog__body:has(.ibiz-code-footer){padding-bottom:0}.ibiz-code-footer-dialog{margin-top:0}
|
|
1
|
+
.ibiz-code{display:flex;flex-direction:column;width:100%;height:100%}.ibiz-code__box{width:100%;height:100%;min-height:200px;overflow:hidden}.ibiz-code__first-prompt::before{padding-right:var(--ibiz-spacing-base);content:var(--ibiz-code-placeholder)}.ibiz-code-toolbar{position:absolute;top:4px;right:18px;z-index:10;display:flex;align-items:center;justify-content:end;width:auto;height:auto;padding-right:0;font-size:var(--ibiz-font-size-header-6)}.ibiz-code-toolbar>*+*{margin-left:var(--ibiz-spacing-base-loose)}.ibiz-code-toolbar__fullscreen{height:38px;padding:0 12px;font-size:var(--ibiz-font-size-regular);font-style:normal;line-height:2.8;cursor:pointer}.ibiz-code-toolbar__fullscreen:hover{background-color:var(--ibiz-color-bg-3)}.ibiz-code-footer{--ibiz-code-height-text-editor-toolbar:40px;--ibiz-code-footer-toolbar-height:36px;--ibiz-code-footer-button-height:36px;--ibiz-code-text-editor-toolbar-z-index:1;--ibiz-code-text-editor-toolbar-left:0;--ibiz-code-text-editor-toolbar-top:0;display:flex;align-items:center;justify-content:end;width:100%;min-height:var(--ibiz-code-footer-toolbar-height);margin-top:var(--ibiz-spacing-base-tight);margin-right:var(--ibiz-spacing-tight)}.ibiz-code-footer>*+*{margin-left:var(--ibiz-spacing-base)}.ibiz-code-footer__cancel{height:var(--ibiz-code-footer-button-height);line-height:var(--ibiz-code-footer-button-height);color:var(--ibiz-color-text-1);cursor:pointer;opacity:.7}.ibiz-code-footer__cancel:hover{color:var(--ibiz-color-primary);opacity:1}.ibiz-code-footer__save{width:96px;height:var(--ibiz-code-footer-button-height);line-height:var(--ibiz-code-footer-button-height);color:var(--ibiz-color-primary-active-text);text-align:center;cursor:pointer;background-color:var(--ibiz-color-primary);border-radius:var(--ibiz-border-radius-small)}.ibiz-code-footer__save:hover{box-shadow:0 2px 5px 1px var(--ibiz-color-primary)}.ibiz-code-message{width:500px;max-width:unset}.ibiz-code-message__message-content--message-tip{color:var(--ibiz-color-text-3)}.ibiz-code-message__message-cancel{color:var(--ibiz-color-text-1);background-color:transparent}.ibiz-code-message__message-cancel:hover{color:var(--ibiz-color-primary);background-color:transparent}.ibiz-code-message__message-comfire{background-color:var(--ibiz-color-danger)!important}.ibiz-code-message__message-comfire:hover{box-shadow:0 2px 5px 1px var(--ibiz-color-danger)}.ibiz-code-editor-enable{--ibiz-code-height-text-editor-toolbar:40px;--ibiz-code-footer-toolbar-height:36px;--ibiz-code-footer-button-height:36px;--ibiz-code-text-editor-toolbar-z-index:1;--ibiz-code-text-editor-toolbar-left:0;--ibiz-code-text-editor-toolbar-top:0}.ibiz-code-editor-enable .ibiz-code__box{height:100%}.ibiz-code-editor-enable:has(.ibiz-code-footer) .ibiz-code__box{height:calc(100% - var(--ibiz-code-footer-toolbar-height))}.ibiz-code-dialog-full-screen{width:100%!important;height:100%!important;margin:0!important}.ibiz-code-dialog-full-screen .ibiz-code-footer{--ibiz-code-footer-toolbar-height:68px}.ibiz-code-dialog-full-screen .ibiz-code{gap:0;padding:0 var(--ibiz-spacing-extra-loose);--w-e-toolbar-bg-color:var(--ibiz-color-bg-0)}.ibiz-code-dialog-full-screen .ibiz-code .ibiz-code-toolbar{right:calc(var(--ibiz-spacing-extra-loose) + 18px)}.ibiz-code-dialog-full-screen .el-dialog__header{display:none!important}.ibiz-code-dialog-full-screen .el-dialog__body{width:100%;height:100%;padding:0 0 var(--ibiz-spacing-base)}.ibiz-code-dialog-full-screen .el-dialog__body:has(.ibiz-code-footer){padding-bottom:0}.ibiz-code-footer-dialog{margin-top:0}.ibiz-code-text-editor-toolbar{--ibiz-code-height-text-editor-toolbar:40px;--ibiz-code-footer-toolbar-height:36px;--ibiz-code-footer-button-height:36px;--ibiz-code-text-editor-toolbar-z-index:1;--ibiz-code-text-editor-toolbar-left:0;--ibiz-code-text-editor-toolbar-top:0;position:fixed;top:var(--ibiz-code-text-editor-toolbar-top);left:var(--ibiz-code-text-editor-toolbar-left);z-index:var(--ibiz-code-text-editor-toolbar-z-index);display:flex;gap:var(--ibiz-spacing-tight);height:var(--ibiz-code-height-text-editor-toolbar);padding:var(--ibiz-spacing-extra-tight);font-size:var(--ibiz-font-size-regular);background-color:var(--ibiz-color-bg-2);border-radius:var(--ibiz-border-radius-extra-small);box-shadow:var(--ibiz-shadow-elevated)}.ibiz-code-text-editor-toolbar__item{display:flex;align-items:center;justify-content:center;padding:var(--ibiz-spacing-extra-tight) var(--ibiz-spacing-tight);cursor:pointer;border-radius:var(--ibiz-border-radius-extra-small)}.ibiz-code-text-editor-toolbar__item:hover{color:var(--ibiz-color-primary);background-color:var(--ibiz-color-primary-light-default)}
|