@tmagic/editor 1.5.12 → 1.5.14
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/tmagic-editor.js +219 -166
- package/dist/tmagic-editor.umd.cjs +225 -266
- package/package.json +7 -7
- package/src/Editor.vue +4 -20
- package/src/components/CodeBlockEditor.vue +14 -2
- package/src/components/ContentMenu.vue +2 -2
- package/src/components/FloatingBox.vue +1 -1
- package/src/components/ScrollBar.vue +9 -3
- package/src/components/SearchInput.vue +1 -1
- package/src/components/Tree.vue +3 -3
- package/src/components/TreeNode.vue +3 -3
- package/src/fields/CodeSelect.vue +5 -7
- package/src/fields/CodeSelectCol.vue +9 -5
- package/src/fields/DataSourceFields.vue +4 -2
- package/src/fields/DataSourceInput.vue +7 -3
- package/src/fields/DataSourceMethodSelect.vue +17 -6
- package/src/fields/DataSourceMethods.vue +3 -3
- package/src/fields/EventSelect.vue +3 -2
- package/src/fields/UISelect.vue +2 -2
- package/src/hooks/use-code-block-edit.ts +1 -1
- package/src/index.ts +0 -1
- package/src/initService.ts +75 -65
- package/src/layouts/Framework.vue +1 -1
- package/src/layouts/NavMenu.vue +1 -1
- package/src/layouts/page-bar/PageBar.vue +1 -1
- package/src/layouts/props-panel/FormPanel.vue +2 -2
- package/src/layouts/props-panel/PropsPanel.vue +1 -1
- package/src/layouts/sidebar/ComponentListPanel.vue +1 -1
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +2 -1
- package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +20 -3
- package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +13 -1
- package/src/layouts/sidebar/data-source/DataSourceList.vue +1 -0
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +20 -3
- package/src/layouts/workspace/viewer/Stage.vue +1 -1
- package/src/services/BaseService.ts +1 -0
- package/src/services/editor.ts +4 -3
- package/src/type.ts +9 -0
- package/src/utils/props.ts +9 -7
- package/types/index.d.ts +945 -9788
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.5.
|
|
2
|
+
"version": "1.5.14",
|
|
3
3
|
"name": "@tmagic/editor",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"moveable": "^0.53.0",
|
|
59
59
|
"serialize-javascript": "^6.0.0",
|
|
60
60
|
"sortablejs": "^1.15.2",
|
|
61
|
-
"@tmagic/design": "1.5.
|
|
62
|
-
"@tmagic/form": "1.5.
|
|
63
|
-
"@tmagic/
|
|
64
|
-
"@tmagic/
|
|
65
|
-
"@tmagic/utils": "1.5.
|
|
61
|
+
"@tmagic/design": "1.5.14",
|
|
62
|
+
"@tmagic/form": "1.5.14",
|
|
63
|
+
"@tmagic/table": "1.5.14",
|
|
64
|
+
"@tmagic/stage": "1.5.14",
|
|
65
|
+
"@tmagic/utils": "1.5.14"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@types/events": "^3.0.0",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"monaco-editor": "^0.48.0",
|
|
77
77
|
"typescript": "*",
|
|
78
78
|
"vue": ">=3.5.0",
|
|
79
|
-
"@tmagic/core": "1.5.
|
|
79
|
+
"@tmagic/core": "1.5.14"
|
|
80
80
|
},
|
|
81
81
|
"peerDependenciesMeta": {
|
|
82
82
|
"typescript": {
|
package/src/Editor.vue
CHANGED
|
@@ -142,7 +142,7 @@ import codeBlockService from './services/codeBlock';
|
|
|
142
142
|
import componentListService from './services/componentList';
|
|
143
143
|
import dataSourceService from './services/dataSource';
|
|
144
144
|
import depService from './services/dep';
|
|
145
|
-
import editorService
|
|
145
|
+
import editorService from './services/editor';
|
|
146
146
|
import eventsService from './services/events';
|
|
147
147
|
import historyService from './services/history';
|
|
148
148
|
import keybindingService from './services/keybinding';
|
|
@@ -153,25 +153,9 @@ import uiService from './services/ui';
|
|
|
153
153
|
import keybindingConfig from './utils/keybinding-config';
|
|
154
154
|
import { defaultEditorProps, EditorProps } from './editorProps';
|
|
155
155
|
import { initServiceEvents, initServiceState } from './initService';
|
|
156
|
-
import type {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
PropsPanelSlots,
|
|
160
|
-
Services,
|
|
161
|
-
SidebarSlots,
|
|
162
|
-
StageOptions,
|
|
163
|
-
WorkspaceSlots,
|
|
164
|
-
} from './type';
|
|
165
|
-
|
|
166
|
-
defineSlots<
|
|
167
|
-
FrameworkSlots &
|
|
168
|
-
WorkspaceSlots &
|
|
169
|
-
SidebarSlots &
|
|
170
|
-
PropsPanelSlots & {
|
|
171
|
-
workspace(props: { editorService: EditorService }): any;
|
|
172
|
-
'workspace-content'(props: { editorService: EditorService }): any;
|
|
173
|
-
}
|
|
174
|
-
>();
|
|
156
|
+
import type { EditorSlots, EventBus, Services, StageOptions } from './type';
|
|
157
|
+
|
|
158
|
+
defineSlots<EditorSlots>();
|
|
175
159
|
|
|
176
160
|
defineOptions({
|
|
177
161
|
name: 'MEditor',
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
</template>
|
|
60
60
|
|
|
61
61
|
<script lang="ts" setup>
|
|
62
|
-
import { computed, inject, Ref, ref, useTemplateRef } from 'vue';
|
|
62
|
+
import { computed, inject, nextTick, Ref, ref, useTemplateRef, watch } from 'vue';
|
|
63
63
|
|
|
64
64
|
import type { CodeBlockContent } from '@tmagic/core';
|
|
65
65
|
import { TMagicButton, TMagicDialog, tMagicMessage, tMagicMessageBox, TMagicTag } from '@tmagic/design';
|
|
@@ -95,6 +95,8 @@ const props = defineProps<{
|
|
|
95
95
|
|
|
96
96
|
const emit = defineEmits<{
|
|
97
97
|
submit: [values: CodeBlockContent, eventData: ContainerChangeEventData];
|
|
98
|
+
close: [];
|
|
99
|
+
open: [];
|
|
98
100
|
}>();
|
|
99
101
|
|
|
100
102
|
const { codeBlockService, uiService } = useServices();
|
|
@@ -231,7 +233,7 @@ const changeHandler = (values: CodeBlockContent) => {
|
|
|
231
233
|
changedValue.value = values;
|
|
232
234
|
};
|
|
233
235
|
|
|
234
|
-
const beforeClose = (done: (
|
|
236
|
+
const beforeClose = (done: (_cancel?: boolean) => void) => {
|
|
235
237
|
if (!changedValue.value) {
|
|
236
238
|
done();
|
|
237
239
|
return;
|
|
@@ -261,6 +263,16 @@ const closedHandler = () => {
|
|
|
261
263
|
const parentFloating = inject<Ref<HTMLDivElement | null>>('parentFloating', ref(null));
|
|
262
264
|
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(uiService, parentFloating);
|
|
263
265
|
|
|
266
|
+
watch(boxVisible, (visible) => {
|
|
267
|
+
nextTick(() => {
|
|
268
|
+
if (!visible) {
|
|
269
|
+
emit('close');
|
|
270
|
+
} else {
|
|
271
|
+
emit('open');
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
|
|
264
276
|
defineExpose({
|
|
265
277
|
async show() {
|
|
266
278
|
calcBoxPosition();
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
</template>
|
|
38
38
|
|
|
39
39
|
<script lang="ts" setup>
|
|
40
|
-
import { computed, nextTick, onBeforeUnmount, onMounted, ref, useTemplateRef } from 'vue';
|
|
40
|
+
import { computed, nextTick, onBeforeUnmount, onMounted, type Ref, ref, useTemplateRef } from 'vue';
|
|
41
41
|
|
|
42
42
|
import { useZIndex } from '@tmagic/design';
|
|
43
43
|
|
|
@@ -73,7 +73,7 @@ const menuEl = useTemplateRef<HTMLDivElement>('menu');
|
|
|
73
73
|
const buttonRefs = useTemplateRef<InstanceType<typeof ToolButton>[]>('buttons');
|
|
74
74
|
const subMenuRef = useTemplateRef<any>('subMenu');
|
|
75
75
|
const visible = ref(false);
|
|
76
|
-
const subMenuData = ref<(MenuButton | MenuComponent)[]>([]);
|
|
76
|
+
const subMenuData: Ref<(MenuButton | MenuComponent)[]> = ref<(MenuButton | MenuComponent)[]>([]);
|
|
77
77
|
const zIndex = useZIndex();
|
|
78
78
|
const curZIndex = ref<number>(0);
|
|
79
79
|
|
|
@@ -93,7 +93,9 @@ const scrollBy = (delta: number) => {
|
|
|
93
93
|
position: absolute;
|
|
94
94
|
background-color: transparent;
|
|
95
95
|
opacity: 0.3;
|
|
96
|
-
transition:
|
|
96
|
+
transition:
|
|
97
|
+
background-color 0.2s linear,
|
|
98
|
+
opacity 0.2s linear;
|
|
97
99
|
|
|
98
100
|
.m-editor-scroll-bar-thumb {
|
|
99
101
|
background-color: #aaa;
|
|
@@ -108,7 +110,9 @@ const scrollBy = (delta: number) => {
|
|
|
108
110
|
|
|
109
111
|
.m-editor-scroll-bar-thumb {
|
|
110
112
|
height: 6px;
|
|
111
|
-
transition:
|
|
113
|
+
transition:
|
|
114
|
+
background-color 0.2s linear,
|
|
115
|
+
height 0.2s ease-in-out;
|
|
112
116
|
bottom: 2px;
|
|
113
117
|
}
|
|
114
118
|
}
|
|
@@ -120,7 +124,9 @@ const scrollBy = (delta: number) => {
|
|
|
120
124
|
|
|
121
125
|
.m-editor-scroll-bar-thumb {
|
|
122
126
|
width: 6px;
|
|
123
|
-
transition:
|
|
127
|
+
transition:
|
|
128
|
+
background-color 0.2s linear,
|
|
129
|
+
width 0.2s ease-in-out;
|
|
124
130
|
right: 2px;
|
|
125
131
|
}
|
|
126
132
|
}
|
|
@@ -27,7 +27,7 @@ const emit = defineEmits(['search']);
|
|
|
27
27
|
|
|
28
28
|
const filterText = ref('');
|
|
29
29
|
|
|
30
|
-
let timer:
|
|
30
|
+
let timer: ReturnType<typeof setTimeout> | null = null;
|
|
31
31
|
const filterTextChangeHandler = () => {
|
|
32
32
|
timer && clearTimeout(timer);
|
|
33
33
|
timer = setTimeout(() => {
|
package/src/components/Tree.vue
CHANGED
|
@@ -38,9 +38,9 @@ import type { LayerNodeStatus, TreeNodeData } from '@editor/type';
|
|
|
38
38
|
import TreeNode from './TreeNode.vue';
|
|
39
39
|
|
|
40
40
|
defineSlots<{
|
|
41
|
-
'tree-node-content'(
|
|
42
|
-
'tree-node-label'(
|
|
43
|
-
'tree-node-tool'(
|
|
41
|
+
'tree-node-content'(_props: { data: TreeNodeData }): any;
|
|
42
|
+
'tree-node-label'(_props: { data: TreeNodeData }): any;
|
|
43
|
+
'tree-node-tool'(_props: { data: TreeNodeData }): any;
|
|
44
44
|
}>();
|
|
45
45
|
|
|
46
46
|
defineOptions({
|
|
@@ -72,9 +72,9 @@ import type { LayerNodeStatus, TreeNodeData } from '@editor/type';
|
|
|
72
72
|
import { updateStatus } from '@editor/utils/tree';
|
|
73
73
|
|
|
74
74
|
defineSlots<{
|
|
75
|
-
'tree-node-label'(
|
|
76
|
-
'tree-node-tool'(
|
|
77
|
-
'tree-node-content'(
|
|
75
|
+
'tree-node-label'(_props: { data: TreeNodeData }): any;
|
|
76
|
+
'tree-node-tool'(_props: { data: TreeNodeData }): any;
|
|
77
|
+
'tree-node-content'(_props: { data: TreeNodeData }): any;
|
|
78
78
|
}>();
|
|
79
79
|
|
|
80
80
|
defineOptions({
|
|
@@ -80,13 +80,11 @@ const codeConfig = computed<GroupListConfig>(() => ({
|
|
|
80
80
|
{ value: HookCodeType.DATA_SOURCE_METHOD, text: '数据源方法' },
|
|
81
81
|
],
|
|
82
82
|
defaultValue: 'code',
|
|
83
|
-
onChange: (
|
|
83
|
+
onChange: (_mForm, v: HookCodeType, { setModel }) => {
|
|
84
84
|
if (v === HookCodeType.DATA_SOURCE_METHOD) {
|
|
85
|
-
|
|
86
|
-
changeRecords.push({ propPath: prop.replace('codeType', 'codeId'), value: [] });
|
|
85
|
+
setModel('codeId', []);
|
|
87
86
|
} else {
|
|
88
|
-
|
|
89
|
-
changeRecords.push({ propPath: prop.replace('codeType', 'codeId'), value: '' });
|
|
87
|
+
setModel('codeId', '');
|
|
90
88
|
}
|
|
91
89
|
|
|
92
90
|
return v;
|
|
@@ -97,7 +95,7 @@ const codeConfig = computed<GroupListConfig>(() => ({
|
|
|
97
95
|
name: 'codeId',
|
|
98
96
|
span: 18,
|
|
99
97
|
labelWidth: 0,
|
|
100
|
-
display: (
|
|
98
|
+
display: (_mForm, { model }) => model.codeType !== HookCodeType.DATA_SOURCE_METHOD,
|
|
101
99
|
notEditable: () => !codeBlockService.getEditStatus(),
|
|
102
100
|
},
|
|
103
101
|
{
|
|
@@ -105,7 +103,7 @@ const codeConfig = computed<GroupListConfig>(() => ({
|
|
|
105
103
|
name: 'codeId',
|
|
106
104
|
span: 18,
|
|
107
105
|
labelWidth: 0,
|
|
108
|
-
display: (
|
|
106
|
+
display: (_mForm, { model }) => model.codeType === HookCodeType.DATA_SOURCE_METHOD,
|
|
109
107
|
notEditable: () => !dataSourceService.get('editable'),
|
|
110
108
|
},
|
|
111
109
|
],
|
|
@@ -121,24 +121,28 @@ const selectConfig = {
|
|
|
121
121
|
}
|
|
122
122
|
return [];
|
|
123
123
|
},
|
|
124
|
-
onChange: (formState: any, codeId: Id, { model }: any) => {
|
|
124
|
+
onChange: (formState: any, codeId: Id, { setModel, model }: any) => {
|
|
125
125
|
// 通过下拉框选择的codeId变化后修正model的值,避免写入其他codeId的params
|
|
126
126
|
paramsConfig.value = getParamItemsConfig(codeId);
|
|
127
127
|
|
|
128
128
|
if (paramsConfig.value.length) {
|
|
129
|
-
|
|
129
|
+
setModel('params', createValues(formState, paramsConfig.value, {}, model.params));
|
|
130
130
|
} else {
|
|
131
|
-
|
|
131
|
+
setModel('params', {});
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
return codeId;
|
|
135
135
|
},
|
|
136
136
|
};
|
|
137
137
|
|
|
138
|
-
const onCodeIdChangeHandler = (value: any) => {
|
|
138
|
+
const onCodeIdChangeHandler = (value: any, eventData: ContainerChangeEventData) => {
|
|
139
139
|
props.model.params = value.params;
|
|
140
|
+
|
|
140
141
|
emit('change', props.model, {
|
|
141
|
-
changeRecords:
|
|
142
|
+
changeRecords: eventData.changeRecords?.map((item) => ({
|
|
143
|
+
prop: `${props.prop.replace(props.name, '')}${item.propPath}`,
|
|
144
|
+
value: item.value,
|
|
145
|
+
})) || [
|
|
142
146
|
{
|
|
143
147
|
propPath: props.prop,
|
|
144
148
|
value: value[props.name],
|
|
@@ -65,6 +65,7 @@ import FloatingBox from '@editor/components/FloatingBox.vue';
|
|
|
65
65
|
import { useEditorContentHeight } from '@editor/hooks';
|
|
66
66
|
import { useNextFloatBoxPosition } from '@editor/hooks/use-next-float-box-position';
|
|
67
67
|
import { useServices } from '@editor/hooks/use-services';
|
|
68
|
+
import { error } from '@editor/utils/logger';
|
|
68
69
|
|
|
69
70
|
defineOptions({
|
|
70
71
|
name: 'MFieldsDataSourceFields',
|
|
@@ -144,6 +145,7 @@ const fieldColumns: ColumnConfig[] = [
|
|
|
144
145
|
try {
|
|
145
146
|
return JSON.stringify(row.defaultValue);
|
|
146
147
|
} catch (e) {
|
|
148
|
+
error(e);
|
|
147
149
|
return row.defaultValue;
|
|
148
150
|
}
|
|
149
151
|
},
|
|
@@ -193,9 +195,9 @@ const dataSourceFieldsConfig: FormConfig = [
|
|
|
193
195
|
{ text: 'null', value: 'null' },
|
|
194
196
|
{ text: 'any', value: 'any' },
|
|
195
197
|
],
|
|
196
|
-
onChange: (
|
|
198
|
+
onChange: (_formState, v: string, { setModel }) => {
|
|
197
199
|
if (!['any', 'array', 'object'].includes(v)) {
|
|
198
|
-
|
|
200
|
+
setModel('fields', []);
|
|
199
201
|
}
|
|
200
202
|
return v;
|
|
201
203
|
},
|
|
@@ -179,7 +179,11 @@ const curCharIsDot = (dotIndex: number) => dotIndex > -1 && dotIndex === getSele
|
|
|
179
179
|
* @param leftCurlyBracketIndex 左大括号字符索引
|
|
180
180
|
* @param cb 建议的方法
|
|
181
181
|
*/
|
|
182
|
-
const dsQuerySearch = (
|
|
182
|
+
const dsQuerySearch = (
|
|
183
|
+
queryString: string,
|
|
184
|
+
leftCurlyBracketIndex: number,
|
|
185
|
+
cb: (_data: { value: string }[]) => void,
|
|
186
|
+
) => {
|
|
183
187
|
let result: DataSourceSchema[] = [];
|
|
184
188
|
|
|
185
189
|
if (curCharIsLeftCurlyBracket(leftCurlyBracketIndex)) {
|
|
@@ -211,7 +215,7 @@ const fieldQuerySearch = (
|
|
|
211
215
|
queryString: string,
|
|
212
216
|
leftAngleIndex: number,
|
|
213
217
|
dotIndex: number,
|
|
214
|
-
cb: (
|
|
218
|
+
cb: (_data: { value: string }[]) => void,
|
|
215
219
|
) => {
|
|
216
220
|
let result: DataSchema[] = [];
|
|
217
221
|
|
|
@@ -272,7 +276,7 @@ const fieldQuerySearch = (
|
|
|
272
276
|
* @param queryString 当前输入框内的字符串
|
|
273
277
|
* @param cb 建议回调
|
|
274
278
|
*/
|
|
275
|
-
const querySearch = (queryString: string, cb: (
|
|
279
|
+
const querySearch = (queryString: string, cb: (_data: { value: string }[]) => void) => {
|
|
276
280
|
inputText = queryString;
|
|
277
281
|
|
|
278
282
|
const selectionStart = getSelectionStart();
|
|
@@ -37,7 +37,14 @@ import { Edit, View } from '@element-plus/icons-vue';
|
|
|
37
37
|
|
|
38
38
|
import type { Id } from '@tmagic/core';
|
|
39
39
|
import { TMagicButton, TMagicTooltip } from '@tmagic/design';
|
|
40
|
-
import {
|
|
40
|
+
import {
|
|
41
|
+
createValues,
|
|
42
|
+
type FieldProps,
|
|
43
|
+
filterFunction,
|
|
44
|
+
type FormState,
|
|
45
|
+
MContainer,
|
|
46
|
+
type OnChangeHandlerData,
|
|
47
|
+
} from '@tmagic/form';
|
|
41
48
|
|
|
42
49
|
import CodeParams from '@editor/components/CodeParams.vue';
|
|
43
50
|
import MIcon from '@editor/components/Icon.vue';
|
|
@@ -92,14 +99,18 @@ const getParamItemsConfig = ([dataSourceId, methodName]: [Id, string] = ['', '']
|
|
|
92
99
|
|
|
93
100
|
const paramsConfig = ref<CodeParamStatement[]>(getParamItemsConfig(props.model[props.name || 'dataSourceMethod']));
|
|
94
101
|
|
|
95
|
-
const setParamsConfig = (
|
|
102
|
+
const setParamsConfig = (
|
|
103
|
+
dataSourceMethod: [Id, string],
|
|
104
|
+
formState: any = {},
|
|
105
|
+
setModel: OnChangeHandlerData['setModel'],
|
|
106
|
+
) => {
|
|
96
107
|
// 通过下拉框选择的codeId变化后修正model的值,避免写入其他codeId的params
|
|
97
108
|
paramsConfig.value = dataSourceMethod ? getParamItemsConfig(dataSourceMethod) : [];
|
|
98
109
|
|
|
99
110
|
if (paramsConfig.value.length) {
|
|
100
|
-
|
|
111
|
+
setModel('params', createValues(formState, paramsConfig.value, {}, props.model.params));
|
|
101
112
|
} else {
|
|
102
|
-
|
|
113
|
+
setModel('params', {});
|
|
103
114
|
}
|
|
104
115
|
};
|
|
105
116
|
|
|
@@ -125,8 +136,8 @@ const cascaderConfig = computed(() => ({
|
|
|
125
136
|
name: props.name,
|
|
126
137
|
options: methodsOptions.value,
|
|
127
138
|
disable: props.disabled,
|
|
128
|
-
onChange: (formState: any, dataSourceMethod: [Id, string]) => {
|
|
129
|
-
setParamsConfig(dataSourceMethod, formState);
|
|
139
|
+
onChange: (formState: any, dataSourceMethod: [Id, string], { setModel }: OnChangeHandlerData) => {
|
|
140
|
+
setParamsConfig(dataSourceMethod, formState, setModel);
|
|
130
141
|
|
|
131
142
|
return dataSourceMethod;
|
|
132
143
|
},
|
|
@@ -80,7 +80,7 @@ const methodColumns: ColumnConfig[] = [
|
|
|
80
80
|
{
|
|
81
81
|
text: '编辑',
|
|
82
82
|
handler: (method: CodeBlockContent, index: number) => {
|
|
83
|
-
let codeContent = method.content ||
|
|
83
|
+
let codeContent = method.content || '({ params, dataSource, app }) => {\n // place your code here\n}';
|
|
84
84
|
|
|
85
85
|
if (typeof codeContent !== 'string') {
|
|
86
86
|
codeContent = codeContent.toString();
|
|
@@ -114,7 +114,7 @@ const methodColumns: ColumnConfig[] = [
|
|
|
114
114
|
const createCodeHandler = () => {
|
|
115
115
|
codeConfig.value = {
|
|
116
116
|
name: '',
|
|
117
|
-
content:
|
|
117
|
+
content: '({ params, dataSource, app, flowState }) => {\n // place your code here\n}',
|
|
118
118
|
params: [],
|
|
119
119
|
};
|
|
120
120
|
|
|
@@ -130,7 +130,7 @@ const submitCodeHandler = (value: CodeBlockContent, data: ContainerChangeEventDa
|
|
|
130
130
|
// 在保存的时候转换代码内容
|
|
131
131
|
const parseDSL = getEditorConfig('parseDSL');
|
|
132
132
|
if (typeof value.content === 'string') {
|
|
133
|
-
value.content = parseDSL<(...
|
|
133
|
+
value.content = parseDSL<(..._args: any[]) => any>(value.content);
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
if (editIndex > -1) {
|
|
@@ -63,6 +63,7 @@ import type {
|
|
|
63
63
|
ContainerChangeEventData,
|
|
64
64
|
FieldProps,
|
|
65
65
|
FormState,
|
|
66
|
+
OnChangeHandlerData,
|
|
66
67
|
PanelConfig,
|
|
67
68
|
} from '@tmagic/form';
|
|
68
69
|
import { MContainer as MFormContainer, MPanel } from '@tmagic/form';
|
|
@@ -202,8 +203,8 @@ const targetCompConfig = computed(() => {
|
|
|
202
203
|
text: '联动组件',
|
|
203
204
|
type: 'ui-select',
|
|
204
205
|
display: (mForm: FormState, { model }: { model: Record<any, any> }) => model.actionType === ActionType.COMP,
|
|
205
|
-
onChange: (MForm: FormState, v: string, {
|
|
206
|
-
|
|
206
|
+
onChange: (MForm: FormState, v: string, { setModel }: OnChangeHandlerData) => {
|
|
207
|
+
setModel('method', '');
|
|
207
208
|
return v;
|
|
208
209
|
},
|
|
209
210
|
};
|
package/src/fields/UISelect.vue
CHANGED
|
@@ -70,7 +70,7 @@ const uiSelectMode = ref(false);
|
|
|
70
70
|
const cancelHandler = () => {
|
|
71
71
|
uiService.set('uiSelectMode', false);
|
|
72
72
|
uiSelectMode.value = false;
|
|
73
|
-
globalThis.document.removeEventListener(UI_SELECT_MODE_EVENT_NAME, clickHandler as
|
|
73
|
+
globalThis.document.removeEventListener(UI_SELECT_MODE_EVENT_NAME, clickHandler as any);
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
const clickHandler = ({ detail }: Event & { detail: HTMLElement | MNode }) => {
|
|
@@ -97,7 +97,7 @@ const toName = computed(() => {
|
|
|
97
97
|
const startSelect = () => {
|
|
98
98
|
uiService.set('uiSelectMode', true);
|
|
99
99
|
uiSelectMode.value = true;
|
|
100
|
-
globalThis.document.addEventListener(UI_SELECT_MODE_EVENT_NAME, clickHandler as
|
|
100
|
+
globalThis.document.addEventListener(UI_SELECT_MODE_EVENT_NAME, clickHandler as any);
|
|
101
101
|
};
|
|
102
102
|
|
|
103
103
|
const deleteHandler = () => {
|
|
@@ -16,7 +16,7 @@ export const useCodeBlockEdit = (codeBlockService: Services['codeBlockService'])
|
|
|
16
16
|
const createCodeBlock = async () => {
|
|
17
17
|
codeConfig.value = {
|
|
18
18
|
name: '',
|
|
19
|
-
content:
|
|
19
|
+
content: '({app, params, flowState}) => {\n // place your code here\n}',
|
|
20
20
|
params: [],
|
|
21
21
|
};
|
|
22
22
|
|