@ibiz-template/vue3-components 0.7.41-alpha.37 → 0.7.41-alpha.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/ibiz-markdown-editor-D4Og0fLv.js +1 -0
  2. package/dist/{index-BiFsbM1Y.js → index-BewO9StC.js} +1 -1
  3. package/dist/{index-BFGNWF-0.js → index-ClxO69TM.js} +1 -1
  4. package/dist/index-DHKZJQyN.js +11 -0
  5. package/dist/index.min.css +1 -1
  6. package/dist/index.system.min.js +1 -1
  7. package/dist/wang-editor-BYeoazrn.js +1 -0
  8. package/dist/{xlsx-util-DZ5-cWNj.js → xlsx-util-DpgMzatq.js} +1 -1
  9. package/es/control/form/form-detail/form-item/form-item-container/form-item-container.mjs +42 -8
  10. package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater.mjs +10 -0
  11. package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid2/repeater-grid2.css +1 -0
  12. package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid2/repeater-grid2.mjs +309 -0
  13. package/es/editor/code/code-editor.controller.mjs +223 -1
  14. package/es/editor/code/monaco-editor/monaco-editor.css +1 -1
  15. package/es/editor/code/monaco-editor/monaco-editor.mjs +132 -10
  16. package/es/editor/html/html-editor.controller.mjs +122 -2
  17. package/es/editor/html/wang-editor/index.mjs +1 -0
  18. package/es/editor/html/wang-editor/module/index.mjs +1 -0
  19. package/es/editor/html/wang-editor/module/inline-ai-module.mjs +95 -0
  20. package/es/editor/html/wang-editor/wang-editor.css +1 -1
  21. package/es/editor/html/wang-editor/wang-editor.mjs +41 -4
  22. package/es/editor/markdown/ibiz-markdown-editor/custom-menu.mjs +43 -0
  23. package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
  24. package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.mjs +143 -9
  25. package/es/editor/markdown/markdown-editor.controller.mjs +218 -1
  26. package/es/index.mjs +1 -0
  27. package/es/locale/en/index.mjs +18 -2
  28. package/es/locale/zh-CN/index.mjs +18 -2
  29. package/es/util/ai-util/ai-util.mjs +6 -2
  30. package/es/util/app-util/app-util.mjs +41 -2
  31. package/es/util/index.mjs +1 -0
  32. package/es/util/inline-ai-util/inline-ai-textarea/icon.mjs +142 -0
  33. package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.css +1 -0
  34. package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.mjs +217 -0
  35. package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.mjs +220 -0
  36. package/es/util/inline-ai-util/inline-ai-util.mjs +145 -0
  37. package/es/web-app/main.mjs +2 -0
  38. package/lib/control/form/form-detail/form-item/form-item-container/form-item-container.cjs +42 -8
  39. package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater.cjs +10 -0
  40. package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid2/repeater-grid2.cjs +311 -0
  41. package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid2/repeater-grid2.css +1 -0
  42. package/lib/editor/code/code-editor.controller.cjs +222 -0
  43. package/lib/editor/code/monaco-editor/monaco-editor.cjs +132 -10
  44. package/lib/editor/code/monaco-editor/monaco-editor.css +1 -1
  45. package/lib/editor/html/html-editor.controller.cjs +120 -0
  46. package/lib/editor/html/wang-editor/index.cjs +3 -0
  47. package/lib/editor/html/wang-editor/module/index.cjs +3 -0
  48. package/lib/editor/html/wang-editor/module/inline-ai-module.cjs +98 -0
  49. package/lib/editor/html/wang-editor/wang-editor.cjs +41 -4
  50. package/lib/editor/html/wang-editor/wang-editor.css +1 -1
  51. package/lib/editor/markdown/ibiz-markdown-editor/custom-menu.cjs +45 -0
  52. package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.cjs +143 -9
  53. package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
  54. package/lib/editor/markdown/markdown-editor.controller.cjs +217 -0
  55. package/lib/index.cjs +2 -0
  56. package/lib/locale/en/index.cjs +18 -2
  57. package/lib/locale/zh-CN/index.cjs +18 -2
  58. package/lib/util/ai-util/ai-util.cjs +6 -2
  59. package/lib/util/app-util/app-util.cjs +40 -1
  60. package/lib/util/index.cjs +2 -0
  61. package/lib/util/inline-ai-util/inline-ai-textarea/icon.cjs +151 -0
  62. package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.cjs +222 -0
  63. package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.css +1 -0
  64. package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.cjs +222 -0
  65. package/lib/util/inline-ai-util/inline-ai-util.cjs +147 -0
  66. package/lib/web-app/main.cjs +2 -0
  67. package/package.json +5 -5
  68. package/dist/ibiz-markdown-editor-Cs1m7gKI.js +0 -1
  69. package/dist/index-Dds3BDDF.js +0 -11
  70. package/dist/wang-editor-4cJ6X_hb.js +0 -1
@@ -54,7 +54,7 @@ const IBizFormItemContainer = /* @__PURE__ */ defineComponent({
54
54
  }, null);
55
55
  }
56
56
  };
57
- const renderInputTip = () => {
57
+ const renderTipsIcon = () => {
58
58
  return createVNode(resolveComponent("el-tooltip"), {
59
59
  "effect": "light",
60
60
  "visible": visible.value,
@@ -64,16 +64,42 @@ const IBizFormItemContainer = /* @__PURE__ */ defineComponent({
64
64
  "placement": labelPos === "RIGHT" ? "right" : "left"
65
65
  }, {
66
66
  default: () => {
67
- return createVNode("div", {
68
- "class": [ns.em("label", "content"), ns.is("tooltip", enableInputTip)]
69
- }, [enableInputTip && ibiz.config.form.showTipsIcon && createVNode("ion-icon", {
67
+ return createVNode("ion-icon", {
70
68
  "name": "bulb-outline",
71
69
  "class": ns.em("label", "icon")
72
- }, null), sysImage && createVNode(IBizIcon, {
70
+ }, null);
71
+ },
72
+ content: () => {
73
+ return createVNode("div", {
74
+ "class": ns.em("popper", "content")
75
+ }, [createVNode("div", {
76
+ "class": ns.em("popper", "tooltip")
77
+ }, [renderTipContent()]), c.state.inputTipUrl && createVNode("a", {
78
+ "target": "_blank",
79
+ "href": c.state.inputTipUrl,
80
+ "title": ibiz.i18n.t("component.formItemContainer.more")
81
+ }, [ibiz.i18n.t("component.formItemContainer.more")])]);
82
+ }
83
+ });
84
+ };
85
+ const renderLabelWithoutTips = () => {
86
+ return createVNode(resolveComponent("el-tooltip"), {
87
+ "effect": "light",
88
+ "visible": visible.value,
89
+ "onUpdate:visible": ($event) => visible.value = $event,
90
+ "popper-class": [ns.e("popper"), ns.is(ibiz.config.tooltiprendermode.toLowerCase(), true)],
91
+ "disabled": !enableInputTip,
92
+ "placement": labelPos === "RIGHT" ? "right" : "left"
93
+ }, {
94
+ default: () => {
95
+ return createVNode("div", {
96
+ "class": [ns.em("label", "content"), ns.is("tooltip", enableInputTip)]
97
+ }, [sysImage && createVNode(IBizIcon, {
73
98
  "class": ns.em("label", "icon"),
74
99
  "icon": sysImage
75
100
  }, null), createVNode("div", {
76
- "class": ns.em("label", "text")
101
+ "class": ns.em("label", "text"),
102
+ "title": enableInputTip ? void 0 : showTitle(c.labelCaption)
77
103
  }, [c.labelCaption])]);
78
104
  },
79
105
  content: () => {
@@ -90,10 +116,18 @@ const IBizFormItemContainer = /* @__PURE__ */ defineComponent({
90
116
  });
91
117
  };
92
118
  const renderLabel = () => {
119
+ const showTipsIcon = enableInputTip && ibiz.config.form.showTipsIcon;
93
120
  return createVNode("div", {
94
- "title": enableInputTip ? void 0 : showTitle(c.labelCaption),
95
121
  "class": [ns.e("label"), ...c.labelClass || []]
96
- }, [renderInputTip()]);
122
+ }, [showTipsIcon && createVNode("div", {
123
+ "class": [ns.em("label", "content"), ns.is("tooltip", enableInputTip)]
124
+ }, [renderTipsIcon(), sysImage && createVNode(IBizIcon, {
125
+ "class": ns.em("label", "icon"),
126
+ "icon": sysImage
127
+ }, null), createVNode("div", {
128
+ "class": ns.em("label", "text"),
129
+ "title": showTitle(c.labelCaption)
130
+ }, [c.labelCaption])]), !showTipsIcon && renderLabelWithoutTips()]);
97
131
  };
98
132
  return {
99
133
  ns,
@@ -4,6 +4,7 @@ import { useNamespace } from '@ibiz-template/vue3-util';
4
4
  import { RepeaterSingleForm } from './repeater-single-form/repeater-single-form.mjs';
5
5
  import { RepeaterMultiForm } from './repeater-multi-form/repeater-multi-form.mjs';
6
6
  import { RepeaterGrid } from './repeater-grid/repeater-grid.mjs';
7
+ import { RepeaterGrid2 } from './repeater-grid2/repeater-grid2.mjs';
7
8
 
8
9
  "use strict";
9
10
  const FormMDCtrlRepeater = /* @__PURE__ */ defineComponent({
@@ -25,6 +26,7 @@ const FormMDCtrlRepeater = /* @__PURE__ */ defineComponent({
25
26
  };
26
27
  },
27
28
  render() {
29
+ var _a;
28
30
  const classNames = [this.ns.b()];
29
31
  switch (this.controller.repeaterStyle) {
30
32
  case "MultiForm":
@@ -34,6 +36,14 @@ const FormMDCtrlRepeater = /* @__PURE__ */ defineComponent({
34
36
  "controller": this.controller
35
37
  }, null);
36
38
  case "Grid":
39
+ const gridStyle = (_a = this.controller.model.ctrlParams) == null ? void 0 : _a.gridStyle;
40
+ if (gridStyle === "style2") {
41
+ return createVNode(RepeaterGrid2, {
42
+ "class": classNames,
43
+ "controller": this.controller,
44
+ "onChange": this.onDataChange
45
+ }, null);
46
+ }
37
47
  return createVNode(RepeaterGrid, {
38
48
  "class": classNames,
39
49
  "controller": this.controller,
@@ -0,0 +1 @@
1
+ .ibiz-repeater-grid2{--ibiz-repeater-grid2-row-height:57px;--ibiz-repeater-grid2-index-cell-padding:var(--ibiz-spacing-extra-tight);--ibiz-repeater-grid2-btn-size:var(--ibiz-width-icon-large);--ibiz-repeater-grid2-btn-color:var(--ibiz-color-text-2);--ibiz-repeater-grid2-btn-border:1px solid var(--ibiz-color-border);--ibiz-repeater-grid2-btn-margin-left:var(--ibiz-spacing-tight);--ibiz-repeater-grid2-btn-hover-color:var(--ibiz-color-primary-hover);--ibiz-repeater-grid2-btn-hover-border:1px solid var(--ibiz-color-primary-hover);position:relative;width:100%;--ibiz-grid-column-justify-content:center}.ibiz-repeater-grid2__drag-icon{cursor:move}.ibiz-repeater-grid2__sortable-ghost{opacity:.5}.ibiz-repeater-grid2 .el-table__row{height:var(--ibiz-repeater-grid2-row-height)}.ibiz-repeater-grid2-index .cell{padding:var(--ibiz-repeater-grid2-index-cell-padding)}.ibiz-repeater-grid2-action-group{display:flex;align-items:center;justify-content:center}.ibiz-repeater-grid2-action-group ion-icon{font-size:var(--ibiz-repeater-grid2-btn-size);color:var(--ibiz-repeater-grid2-btn-color);cursor:pointer;border:var(--ibiz-repeater-grid2-btn-border)}.ibiz-repeater-grid2-action-group ion-icon+ion-icon{margin-left:var(--ibiz-repeater-grid2-btn-margin-left)}.ibiz-repeater-grid2-action-group ion-icon:hover{color:var(--ibiz-repeater-grid2-btn-hover-color);border:var(--ibiz-repeater-grid2-btn-hover-border)}
@@ -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,5 @@
1
- import { EditorController, getDeACMode } from '@ibiz-template/runtime';
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,36 @@ 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");
44
+ /**
45
+ * AI 聊天自填模式
46
+ *
47
+ * @type {boolean}
48
+ * @memberof CodeEditorController
49
+ */
50
+ __publicField(this, "chatCompletion", false);
20
51
  }
21
52
  /**
22
53
  * 语言类型
@@ -52,6 +83,197 @@ class CodeEditorController extends EditorController {
52
83
  appDataEntityId,
53
84
  this.context.srfappid
54
85
  );
86
+ if (this.deACMode) {
87
+ if (this.deACMode.actype === "CHATCOMPLETION") {
88
+ this.chatCompletion = true;
89
+ }
90
+ }
91
+ }
92
+ /**
93
+ * editor 创建完成
94
+ *
95
+ * @private
96
+ * @param {Monaco.editor.IStandaloneCodeEditor} editor
97
+ */
98
+ onCreated(editor, monaco) {
99
+ this.editor = editor;
100
+ this.monaco = monaco;
101
+ }
102
+ /**
103
+ * 获取选中文本
104
+ * @return {*} {string} 选中文本
105
+ */
106
+ getSelectionText() {
107
+ var _a, _b, _c;
108
+ const selection = (_a = this.editor) == null ? void 0 : _a.getSelection();
109
+ let selectedText;
110
+ if (selection) {
111
+ selectedText = (_c = (_b = this.editor) == null ? void 0 : _b.getModel()) == null ? void 0 : _c.getValueInRange(selection);
112
+ }
113
+ return selectedText || "";
114
+ }
115
+ /**
116
+ * 插入文本
117
+ * @param {string} text 文本
118
+ */
119
+ insertText(text) {
120
+ var _a, _b, _c, _d;
121
+ if (!this.editor || !this.monaco) {
122
+ throw new RuntimeError(ibiz.i18n.t("editor.code.editorNotInit"));
123
+ }
124
+ const selections = this.editor.getSelections();
125
+ if (!selections || selections.length === 0)
126
+ return;
127
+ const activeSelection = selections[selections.length - 1];
128
+ const insertLine = activeSelection.positionLineNumber;
129
+ const insertColumn = activeSelection.positionColumn;
130
+ const formattedText = "\n".concat(text, "\n");
131
+ (_a = this.editor) == null ? void 0 : _a.executeEdits("", [
132
+ {
133
+ range: new this.monaco.Range(
134
+ insertLine,
135
+ insertColumn,
136
+ insertLine,
137
+ insertColumn
138
+ // 光标位置纯插入,不替换任何内容
139
+ ),
140
+ text: formattedText
141
+ }
142
+ ]);
143
+ const linesInText = formattedText.split("\n");
144
+ const linesAdded = linesInText.length - 1;
145
+ const lastLineOfInsert = insertLine + linesAdded - 1;
146
+ const lastLineContent = linesInText[linesInText.length - 2] || "";
147
+ const newColumn = lastLineContent.length + 1;
148
+ const newPosition = new this.monaco.Position(lastLineOfInsert, newColumn);
149
+ (_b = this.editor) == null ? void 0 : _b.setPosition(newPosition);
150
+ (_c = this.editor) == null ? void 0 : _c.revealPositionInCenter(newPosition);
151
+ (_d = this.editor) == null ? void 0 : _d.focus();
152
+ }
153
+ /**
154
+ * 替换选中文本
155
+ * @param {string} text
156
+ */
157
+ replaceSelectionText(text) {
158
+ var _a;
159
+ const selection = (_a = this.editor) == null ? void 0 : _a.getSelection();
160
+ if (!selection || selection.isEmpty() || !this.monaco || !this.editor) {
161
+ return;
162
+ }
163
+ const startPosition = selection.getStartPosition();
164
+ this.editor.executeEdits("", [
165
+ {
166
+ range: selection,
167
+ text
168
+ }
169
+ ]);
170
+ const textLines = text.split("\n");
171
+ const lineCount = textLines.length;
172
+ const lastLineChars = textLines[lineCount - 1].length;
173
+ let finalLineNumber;
174
+ let finalColumn;
175
+ if (lineCount === 1) {
176
+ finalLineNumber = startPosition.lineNumber;
177
+ finalColumn = startPosition.column + lastLineChars;
178
+ } else {
179
+ finalLineNumber = startPosition.lineNumber + (lineCount - 1);
180
+ finalColumn = 1 + lastLineChars;
181
+ }
182
+ const newSelection = new this.monaco.Range(
183
+ finalLineNumber,
184
+ finalColumn,
185
+ finalLineNumber,
186
+ finalColumn
187
+ );
188
+ this.editor.createDecorationsCollection().clear();
189
+ this.editor.setSelection(newSelection);
190
+ this.editor.focus();
191
+ }
192
+ /**
193
+ * 恢复选取
194
+ */
195
+ restoreSelection() {
196
+ var _a;
197
+ (_a = this.editor) == null ? void 0 : _a.focus();
198
+ }
199
+ /**
200
+ * 获取内联AI编辑器元素
201
+ */
202
+ getInLineAiEditorElement() {
203
+ if (!this.editor) {
204
+ throw new RuntimeError(ibiz.i18n.t("editor.code.editorNotInit"));
205
+ }
206
+ return this.editor.getDomNode();
207
+ }
208
+ /**
209
+ * 获取内联AI编辑器主题
210
+ */
211
+ getInLineAiEditorTheme() {
212
+ var _a, _b, _c;
213
+ const currentTheme = (_c = (_b = (_a = this.editor) == null ? void 0 : _a._themeService) == null ? void 0 : _b._theme) == null ? void 0 : _c.themeName;
214
+ switch (currentTheme) {
215
+ case "vs-dark":
216
+ return "dark";
217
+ case "vs":
218
+ default:
219
+ return "light";
220
+ }
221
+ }
222
+ /**
223
+ * 获取内联AI聊天参数
224
+ */
225
+ getInLineAiChatOptions() {
226
+ var _a, _b, _c, _d, _e, _f;
227
+ if (!this.editor || !this.monaco) {
228
+ throw new RuntimeError(ibiz.i18n.t("editor.code.editorNotInit"));
229
+ }
230
+ const contentArea = (_b = (_a = this.editor) == null ? void 0 : _a.getDomNode()) == null ? void 0 : _b.querySelector(".editor-scrollable");
231
+ if (!contentArea) {
232
+ throw new RuntimeError(ibiz.i18n.t("editor.code.noEditorArea"));
233
+ }
234
+ const position = (_c = this.currentSelection) == null ? void 0 : _c.getStartPosition();
235
+ if (!position) {
236
+ throw new RuntimeError(ibiz.i18n.t("editor.code.noSelStart"));
237
+ }
238
+ const coordinates = (_d = this.editor) == null ? void 0 : _d.getScrolledVisiblePosition(position);
239
+ const editorRect = (_f = (_e = this.editor) == null ? void 0 : _e.getDomNode()) == null ? void 0 : _f.getBoundingClientRect();
240
+ if (!editorRect) {
241
+ throw new RuntimeError(ibiz.i18n.t("editor.code.noEditorRect"));
242
+ }
243
+ if (!coordinates) {
244
+ throw new RuntimeError(ibiz.i18n.t("editor.code.noSelCoords"));
245
+ }
246
+ const rect = contentArea.getBoundingClientRect();
247
+ const layoutInfo = this.editor.getLayoutInfo();
248
+ return {
249
+ // 编辑器编辑区左侧距离
250
+ left: rect.left,
251
+ // 编辑器上方距离 + 选区距离编辑器上方距离 + 行高度
252
+ top: editorRect.top + coordinates.top + coordinates.height,
253
+ // 编辑器编辑区宽度 - 代码预览区宽度 - 代码预览区标尺宽度
254
+ width: rect.width - layoutInfo.minimap.minimapWidth - layoutInfo.overviewRuler.width,
255
+ editorElement: this.getInLineAiEditorElement(),
256
+ editorTheme: this.getInLineAiEditorTheme()
257
+ };
258
+ }
259
+ /**
260
+ * 执行内联AIUI操作
261
+ * @param uiActionId
262
+ * @param appId
263
+ */
264
+ async doInLineAIUIAction(uiActionId, appId) {
265
+ const eventArgs = this.ctrl.getEventArgs();
266
+ eventArgs.params.editor = this;
267
+ if (this.editorParams.srfaiappendcurdata && this.editorParams.srfaiappendcurdata === "true") {
268
+ eventArgs.context.srfaiappendcurdata = true;
269
+ }
270
+ await UIActionUtil.exec(
271
+ uiActionId,
272
+ {
273
+ ...eventArgs
274
+ },
275
+ appId
276
+ );
55
277
  }
56
278
  }
57
279
 
@@ -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{--ibiz-code-color-text-editor-toolbar-bg:var(--ibiz-color-bg-2);--ibiz-code-color-text-editor-toolbar-text:var(--ibiz-color-text-0);--ibiz-code-color-text-editor-toolbar-item-bg-hover:var(--ibiz-color-primary-light-default);--ibiz-code-color-text-editor-toolbar-item-text-hover:var(--ibiz-color-primary);--ibiz-code-height-text-editor-toolbar:40px;--ibiz-code-footer-toolbar-height:36px;--ibiz-code-footer-button-height:36px;--ibiz-code-spacing-code-text-editor-toolbar-padding:var(--ibiz-spacing-extra-tight);--ibiz-code-spacing-code-text-editor-toolbar-item-padding:var(--ibiz-spacing-extra-tight) var(--ibiz-spacing-tight);--ibiz-code-spacing-code-text-editor-toolbar-circle:var(--ibiz-border-radius-extra-small);--ibiz-code-spacing-code-text-editor-toolbar-item-circle:var(--ibiz-border-radius-extra-small);--ibiz-code-text-editor-toolbar-z-index:1;--ibiz-code-text-editor-toolbar-left:0;--ibiz-code-text-editor-toolbar-top:0;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{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__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{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-code-spacing-code-text-editor-toolbar-padding);font-size:var(--ibiz-font-size-regular);color:var(--ibiz-code-color-text-editor-toolbar-text);background-color:var(--ibiz-code-color-text-editor-toolbar-bg);border-radius:var(--ibiz-code-spacing-code-text-editor-toolbar-circle);box-shadow:var(--ibiz-shadow-elevated)}.ibiz-code-text-editor-toolbar__item{display:flex;align-items:center;justify-content:center;padding:var(--ibiz-code-spacing-code-text-editor-toolbar-item-padding);cursor:pointer;border-radius:var(--ibiz-code-spacing-code-text-editor-toolbar-item-circle)}.ibiz-code-text-editor-toolbar__item:hover{color:var(--ibiz-code-color-text-editor-toolbar-item-text-hover);background-color:var(--ibiz-code-color-text-editor-toolbar-item-bg-hover)}.ibiz-code.is-dark{--ibiz-code-color-text-editor-toolbar-bg:rgb(53, 54, 60);--ibiz-code-color-text-editor-toolbar-text:rgb(249, 249, 249);--ibiz-code-color-text-editor-toolbar-item-bg-hover:rgba(255, 255, 255, 0.12);--ibiz-code-color-text-editor-toolbar-item-text-hover:rgb(249, 249, 249)}