@tmagic/editor 1.3.0-beta.4 → 1.3.0-beta.6
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/style.css +4 -4
- package/dist/tmagic-editor.js +301 -195
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +301 -193
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +11 -10
- package/src/components/Icon.vue +5 -1
- package/src/fields/CodeSelectCol.vue +1 -2
- package/src/fields/DataSourceMethodSelect.vue +0 -3
- package/src/fields/EventSelect.vue +4 -5
- package/src/fields/KeyValue.vue +1 -0
- package/src/fields/UISelect.vue +3 -3
- package/src/hooks/use-stage.ts +7 -2
- package/src/layouts/CodeEditor.vue +1 -0
- package/src/layouts/sidebar/ComponentListPanel.vue +4 -3
- package/src/layouts/sidebar/layer/LayerNode.vue +7 -5
- package/src/layouts/sidebar/layer/LayerPanel.vue +4 -2
- package/src/layouts/sidebar/layer/use-keybinding.ts +11 -8
- package/src/layouts/sidebar/layer/use-node-status.ts +9 -5
- package/src/layouts/workspace/viewer/Stage.vue +2 -1
- package/src/services/dataSource.ts +2 -2
- package/src/theme/event.scss +1 -3
- package/src/theme/framework.scss +0 -2
- package/src/theme/layer-panel.scss +4 -0
- package/src/type.ts +19 -0
- package/src/utils/data-source/index.ts +117 -34
- package/src/utils/keybinding-config.ts +31 -26
- package/src/utils/props.ts +1 -0
- package/types/layouts/CodeEditor.vue.d.ts +4 -1
- package/types/layouts/sidebar/layer/LayerNode.vue.d.ts +1 -1
- package/types/layouts/sidebar/layer/use-keybinding.d.ts +3 -2
- package/types/type.d.ts +18 -0
- package/types/utils/data-source/index.d.ts +1 -0
- package/types/utils/keybinding-config.d.ts +4 -0
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.3.0-beta.
|
|
2
|
+
"version": "1.3.0-beta.6",
|
|
3
3
|
"name": "@tmagic/editor",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"types": "types/index.d.ts",
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
15
|
+
"types": "./types/index.d.ts",
|
|
15
16
|
"import": "./dist/tmagic-editor.js",
|
|
16
17
|
"require": "./dist/tmagic-editor.umd.cjs"
|
|
17
18
|
},
|
|
@@ -46,13 +47,13 @@
|
|
|
46
47
|
"dependencies": {
|
|
47
48
|
"@babel/core": "^7.18.0",
|
|
48
49
|
"@element-plus/icons-vue": "^2.0.9",
|
|
49
|
-
"@tmagic/core": "1.3.0-beta.
|
|
50
|
-
"@tmagic/design": "1.3.0-beta.
|
|
51
|
-
"@tmagic/form": "1.3.0-beta.
|
|
52
|
-
"@tmagic/schema": "1.3.0-beta.
|
|
53
|
-
"@tmagic/stage": "1.3.0-beta.
|
|
54
|
-
"@tmagic/table": "1.3.0-beta.
|
|
55
|
-
"@tmagic/utils": "1.3.0-beta.
|
|
50
|
+
"@tmagic/core": "1.3.0-beta.6",
|
|
51
|
+
"@tmagic/design": "1.3.0-beta.6",
|
|
52
|
+
"@tmagic/form": "1.3.0-beta.6",
|
|
53
|
+
"@tmagic/schema": "1.3.0-beta.6",
|
|
54
|
+
"@tmagic/stage": "1.3.0-beta.6",
|
|
55
|
+
"@tmagic/table": "1.3.0-beta.6",
|
|
56
|
+
"@tmagic/utils": "1.3.0-beta.6",
|
|
56
57
|
"buffer": "^6.0.3",
|
|
57
58
|
"color": "^3.1.3",
|
|
58
59
|
"events": "^3.3.0",
|
|
@@ -64,8 +65,8 @@
|
|
|
64
65
|
"vue": "^3.3.4"
|
|
65
66
|
},
|
|
66
67
|
"peerDependencies": {
|
|
67
|
-
"@tmagic/design": "1.3.0-beta.
|
|
68
|
-
"@tmagic/form": "1.3.0-beta.
|
|
68
|
+
"@tmagic/design": "1.3.0-beta.6",
|
|
69
|
+
"@tmagic/form": "1.3.0-beta.6",
|
|
69
70
|
"monaco-editor": "^0.41.0",
|
|
70
71
|
"vue": "^3.3.4"
|
|
71
72
|
},
|
package/src/components/Icon.vue
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<TMagicIcon v-if="!icon" class="magic-editor-icon"><Edit></Edit></TMagicIcon>
|
|
3
|
-
<TMagicIcon
|
|
3
|
+
<TMagicIcon
|
|
4
|
+
v-else-if="typeof icon === 'string' && (icon.startsWith('http') || isRelativePath(icon))"
|
|
5
|
+
class="magic-editor-icon"
|
|
4
6
|
><img :src="icon"
|
|
5
7
|
/></TMagicIcon>
|
|
6
8
|
<i v-else-if="typeof icon === 'string'" class="magic-editor-icon" :class="icon"></i>
|
|
@@ -20,4 +22,6 @@ defineOptions({
|
|
|
20
22
|
defineProps<{
|
|
21
23
|
icon?: any;
|
|
22
24
|
}>();
|
|
25
|
+
|
|
26
|
+
const isRelativePath = (str: string) => /^(\.|(\.\.)?\/)/.test(str);
|
|
23
27
|
</script>
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
class="select"
|
|
7
7
|
:config="selectConfig"
|
|
8
8
|
:model="model"
|
|
9
|
+
:size="size"
|
|
9
10
|
@change="onParamsChangeHandler"
|
|
10
11
|
></m-form-container>
|
|
11
12
|
<!-- 查看/编辑按钮 -->
|
|
@@ -89,9 +90,7 @@ watch(
|
|
|
89
90
|
|
|
90
91
|
const selectConfig = {
|
|
91
92
|
type: 'select',
|
|
92
|
-
text: '代码块',
|
|
93
93
|
name: props.name,
|
|
94
|
-
labelWidth: '80px',
|
|
95
94
|
options: () => {
|
|
96
95
|
if (codeDsl.value) {
|
|
97
96
|
return map(codeDsl.value, (value, key) => ({
|
|
@@ -68,7 +68,6 @@ const getParamItemsConfig = ([dataSourceId, medthodName]: [Id, string] = ['', ''
|
|
|
68
68
|
if (!paramStatements) return [];
|
|
69
69
|
|
|
70
70
|
return paramStatements.map((paramState: CodeParamStatement) => ({
|
|
71
|
-
labelWidth: '100px',
|
|
72
71
|
text: paramState.name,
|
|
73
72
|
...paramState,
|
|
74
73
|
}));
|
|
@@ -106,9 +105,7 @@ const methodsOptions = computed(
|
|
|
106
105
|
|
|
107
106
|
const cascaderConfig = computed(() => ({
|
|
108
107
|
type: 'cascader',
|
|
109
|
-
text: '数据源方法',
|
|
110
108
|
name: props.name,
|
|
111
|
-
labelWidth: '80px',
|
|
112
109
|
options: methodsOptions.value,
|
|
113
110
|
onChange: (formState: any, dataSourceMethod: [Id, string]) => {
|
|
114
111
|
setParamsConfig(dataSourceMethod, formState);
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
:size="size"
|
|
23
23
|
:config="actionsConfig"
|
|
24
24
|
:model="cardItem"
|
|
25
|
+
:label-width="config.labelWidth || '100px'"
|
|
25
26
|
@change="onChangeHandler"
|
|
26
27
|
>
|
|
27
28
|
<template #header>
|
|
@@ -106,7 +107,6 @@ const actionTypeConfig = computed(() => {
|
|
|
106
107
|
const defaultActionTypeConfig = {
|
|
107
108
|
name: 'actionType',
|
|
108
109
|
text: '联动类型',
|
|
109
|
-
labelWidth: '80px',
|
|
110
110
|
type: 'select',
|
|
111
111
|
defaultValue: ActionType.COMP,
|
|
112
112
|
options: () => [
|
|
@@ -139,7 +139,6 @@ const targetCompConfig = computed(() => {
|
|
|
139
139
|
const defaultTargetCompConfig = {
|
|
140
140
|
name: 'to',
|
|
141
141
|
text: '联动组件',
|
|
142
|
-
labelWidth: '80px',
|
|
143
142
|
type: 'ui-select',
|
|
144
143
|
display: (mForm: FormState, { model }: { model: Record<any, any> }) => model.actionType === ActionType.COMP,
|
|
145
144
|
};
|
|
@@ -151,7 +150,6 @@ const compActionConfig = computed(() => {
|
|
|
151
150
|
const defaultCompActionConfig = {
|
|
152
151
|
name: 'method',
|
|
153
152
|
text: '动作',
|
|
154
|
-
labelWidth: '80px',
|
|
155
153
|
type: 'select',
|
|
156
154
|
display: (mForm: FormState, { model }: { model: Record<any, any> }) => model.actionType === ActionType.COMP,
|
|
157
155
|
options: (mForm: FormState, { model }: any) => {
|
|
@@ -171,7 +169,7 @@ const compActionConfig = computed(() => {
|
|
|
171
169
|
const codeActionConfig = computed(() => {
|
|
172
170
|
const defaultCodeActionConfig: CodeSelectColConfig = {
|
|
173
171
|
type: 'code-select-col',
|
|
174
|
-
|
|
172
|
+
text: '代码块',
|
|
175
173
|
name: 'codeId',
|
|
176
174
|
disabled: () => !codeBlockService?.getEditStatus(),
|
|
177
175
|
display: (mForm, { model }) => model.actionType === ActionType.CODE,
|
|
@@ -183,8 +181,8 @@ const codeActionConfig = computed(() => {
|
|
|
183
181
|
const dataSourceActionConfig = computed(() => {
|
|
184
182
|
const defaultDataSourceActionConfig: DataSourceMethodSelectConfig = {
|
|
185
183
|
type: 'data-source-method-select',
|
|
184
|
+
text: '数据源方法',
|
|
186
185
|
name: 'dataSourceMethod',
|
|
187
|
-
labelWidth: 0,
|
|
188
186
|
display: (mForm, { model }) => model.actionType === ActionType.DATA_SOURCE,
|
|
189
187
|
};
|
|
190
188
|
return { ...defaultDataSourceActionConfig, ...props.config.dataSourceActionConfig };
|
|
@@ -235,6 +233,7 @@ const actionsConfig = computed(() => ({
|
|
|
235
233
|
name: 'actions',
|
|
236
234
|
expandAll: true,
|
|
237
235
|
enableToggleMode: false,
|
|
236
|
+
titlePrefix: '动作',
|
|
238
237
|
items: [
|
|
239
238
|
actionTypeConfig.value,
|
|
240
239
|
targetCompConfig.value,
|
package/src/fields/KeyValue.vue
CHANGED
package/src/fields/UISelect.vue
CHANGED
|
@@ -49,7 +49,7 @@ import { TMagicButton, TMagicTooltip } from '@tmagic/design';
|
|
|
49
49
|
import type { FieldProps, FormState } from '@tmagic/form';
|
|
50
50
|
import type { Id } from '@tmagic/schema';
|
|
51
51
|
|
|
52
|
-
import
|
|
52
|
+
import { Services, UI_SELECT_MODE_EVENT_NAME } from '@editor/type';
|
|
53
53
|
|
|
54
54
|
defineOptions({
|
|
55
55
|
name: 'MEditorUISelect',
|
|
@@ -68,7 +68,7 @@ const cancelHandler = () => {
|
|
|
68
68
|
if (!services?.uiService) return;
|
|
69
69
|
services.uiService.set('uiSelectMode', false);
|
|
70
70
|
uiSelectMode.value = false;
|
|
71
|
-
globalThis.document.removeEventListener(
|
|
71
|
+
globalThis.document.removeEventListener(UI_SELECT_MODE_EVENT_NAME, clickHandler as EventListener);
|
|
72
72
|
};
|
|
73
73
|
|
|
74
74
|
const clickHandler = ({ detail }: Event & { detail: any }) => {
|
|
@@ -92,7 +92,7 @@ const startSelect = () => {
|
|
|
92
92
|
if (!services?.uiService) return;
|
|
93
93
|
services.uiService.set('uiSelectMode', true);
|
|
94
94
|
uiSelectMode.value = true;
|
|
95
|
-
globalThis.document.addEventListener(
|
|
95
|
+
globalThis.document.addEventListener(UI_SELECT_MODE_EVENT_NAME, clickHandler as EventListener);
|
|
96
96
|
};
|
|
97
97
|
|
|
98
98
|
const deleteHandler = () => {
|
package/src/hooks/use-stage.ts
CHANGED
|
@@ -5,7 +5,12 @@ import StageCore, { GuidesType, RemoveEventData, SortEventData, UpdateEventData
|
|
|
5
5
|
|
|
6
6
|
import editorService from '@editor/services/editor';
|
|
7
7
|
import uiService from '@editor/services/ui';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
H_GUIDE_LINE_STORAGE_KEY,
|
|
10
|
+
StageOptions,
|
|
11
|
+
UI_SELECT_MODE_EVENT_NAME,
|
|
12
|
+
V_GUIDE_LINE_STORAGE_KEY,
|
|
13
|
+
} from '@editor/type';
|
|
9
14
|
import { getGuideLineFromCache } from '@editor/utils/editor';
|
|
10
15
|
|
|
11
16
|
const root = computed(() => editorService.get('root'));
|
|
@@ -30,7 +35,7 @@ export const useStage = (stageOptions: StageOptions) => {
|
|
|
30
35
|
const elCanSelect = stageOptions.canSelect(el);
|
|
31
36
|
// 在组件联动过程中不能再往下选择,返回并触发 ui-select
|
|
32
37
|
if (uiSelectMode.value && elCanSelect && event.type === 'mousedown') {
|
|
33
|
-
document.dispatchEvent(new CustomEvent(
|
|
38
|
+
document.dispatchEvent(new CustomEvent(UI_SELECT_MODE_EVENT_NAME, { detail: el }));
|
|
34
39
|
return stop();
|
|
35
40
|
}
|
|
36
41
|
|
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
@drag="dragHandler"
|
|
19
19
|
>
|
|
20
20
|
<slot name="component-list-item" :component="item">
|
|
21
|
-
<
|
|
22
|
-
|
|
21
|
+
<TMagicTooltip placement="right" :disabled="!Boolean(item.desc)" :content="item.desc">
|
|
22
|
+
<MIcon :icon="item.icon"></MIcon>
|
|
23
|
+
</TMagicTooltip>
|
|
23
24
|
<span :title="item.text">{{ item.text }}</span>
|
|
24
25
|
</slot>
|
|
25
26
|
</div>
|
|
@@ -34,7 +35,7 @@ import { computed, inject, ref } from 'vue';
|
|
|
34
35
|
import { Grid } from '@element-plus/icons-vue';
|
|
35
36
|
import serialize from 'serialize-javascript';
|
|
36
37
|
|
|
37
|
-
import { TMagicCollapse, TMagicCollapseItem, TMagicScrollbar } from '@tmagic/design';
|
|
38
|
+
import { TMagicCollapse, TMagicCollapseItem, TMagicScrollbar, TMagicTooltip } from '@tmagic/design';
|
|
38
39
|
import { removeClassNameByClassName } from '@tmagic/utils';
|
|
39
40
|
|
|
40
41
|
import MIcon from '@editor/components/Icon.vue';
|
|
@@ -62,7 +62,7 @@ import type { Id, MContainer, MNode } from '@tmagic/schema';
|
|
|
62
62
|
import { isPage } from '@tmagic/utils';
|
|
63
63
|
|
|
64
64
|
import MIcon from '@editor/components/Icon.vue';
|
|
65
|
-
import
|
|
65
|
+
import { LayerNodeSlots, LayerNodeStatus, Services, UI_SELECT_MODE_EVENT_NAME } from '@editor/type';
|
|
66
66
|
|
|
67
67
|
import LayerNodeTool from './LayerNodeTool.vue';
|
|
68
68
|
import { useDrag } from './use-drag';
|
|
@@ -128,7 +128,7 @@ const nodeClickHandler = () => {
|
|
|
128
128
|
if (!nodeStatusMap?.value) return;
|
|
129
129
|
|
|
130
130
|
if (uiService?.get('uiSelectMode')) {
|
|
131
|
-
document.dispatchEvent(new CustomEvent(
|
|
131
|
+
document.dispatchEvent(new CustomEvent(UI_SELECT_MODE_EVENT_NAME, { detail: props.data }));
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
134
|
|
|
@@ -145,8 +145,10 @@ const nodeClickHandler = () => {
|
|
|
145
145
|
|
|
146
146
|
const contextmenuHandler = (event: MouseEvent) => {
|
|
147
147
|
event.preventDefault();
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
const nodes = editorService?.get('nodes') || [];
|
|
149
|
+
if (nodes.length < 2 || !nodes.includes(props.data)) {
|
|
150
|
+
nodeClickHandler();
|
|
151
|
+
}
|
|
150
152
|
|
|
151
153
|
emit('node-contextmenu', event, props.data);
|
|
152
154
|
};
|
|
@@ -155,7 +157,7 @@ const nodeContentmenuHandler = (event: MouseEvent, node: MNode) => {
|
|
|
155
157
|
emit('node-contextmenu', event, node);
|
|
156
158
|
};
|
|
157
159
|
|
|
158
|
-
//
|
|
160
|
+
// 触发画布选中
|
|
159
161
|
const select = async (data: MNode) => {
|
|
160
162
|
if (!data.id) {
|
|
161
163
|
throw new Error('没有id');
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
<SearchInput @search="filterTextChangeHandler"></SearchInput>
|
|
6
6
|
|
|
7
|
-
<div class="magic-editor-layer-tree" tabindex="-1" @dragover="handleDragOver">
|
|
7
|
+
<div class="magic-editor-layer-tree" ref="layerTreeContainer" tabindex="-1" @dragover="handleDragOver">
|
|
8
8
|
<LayerNode
|
|
9
9
|
v-if="page && root"
|
|
10
10
|
:data="page"
|
|
@@ -52,11 +52,13 @@ defineProps<{
|
|
|
52
52
|
const services = inject<Services>('services');
|
|
53
53
|
const editorService = services?.editorService;
|
|
54
54
|
|
|
55
|
+
const layerTreeContainer = ref<HTMLDivElement>();
|
|
56
|
+
|
|
55
57
|
const page = computed(() => editorService?.get('page'));
|
|
56
58
|
const root = computed(() => editorService?.get('root'));
|
|
57
59
|
|
|
58
60
|
const { nodeStatusMap } = useNodeStatus(services, page);
|
|
59
|
-
const { isCtrlKeyDown } = useKeybinding(services);
|
|
61
|
+
const { isCtrlKeyDown } = useKeybinding(services, layerTreeContainer);
|
|
60
62
|
|
|
61
63
|
provide('nodeStatusMap', nodeStatusMap);
|
|
62
64
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type Ref, ref, watchEffect } from 'vue';
|
|
2
2
|
|
|
3
3
|
import type { Services } from '@editor/type';
|
|
4
|
+
import { KeyBindingContainerKey } from '@editor/utils/keybinding-config';
|
|
4
5
|
|
|
5
|
-
export const useKeybinding = (services: Services | undefined) => {
|
|
6
|
+
export const useKeybinding = (services: Services | undefined, contianer: Ref<HTMLDivElement | undefined>) => {
|
|
6
7
|
const keybindingService = services?.keybindingService;
|
|
7
8
|
|
|
8
9
|
// 是否多选
|
|
@@ -33,12 +34,14 @@ export const useKeybinding = (services: Services | undefined) => {
|
|
|
33
34
|
},
|
|
34
35
|
]);
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
watchEffect(() => {
|
|
38
|
+
if (contianer.value) {
|
|
39
|
+
globalThis.addEventListener('blur', windowBlurHandler);
|
|
40
|
+
keybindingService?.registeEl(KeyBindingContainerKey.LAYER_PANEL, contianer.value);
|
|
41
|
+
} else {
|
|
42
|
+
globalThis.removeEventListener('blur', windowBlurHandler);
|
|
43
|
+
keybindingService?.unregisteEl(KeyBindingContainerKey.LAYER_PANEL);
|
|
44
|
+
}
|
|
42
45
|
});
|
|
43
46
|
|
|
44
47
|
return {
|
|
@@ -82,17 +82,21 @@ export const useNodeStatus = (services: Services | undefined, page: ComputedRef<
|
|
|
82
82
|
|
|
83
83
|
services?.editorService.on('add', (newNodes: MNode[]) => {
|
|
84
84
|
newNodes.forEach((node) => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
traverseNode(node, (node: MNode) => {
|
|
86
|
+
nodeStatusMap.value?.set(node.id, {
|
|
87
|
+
visible: true,
|
|
88
|
+
expand: Array.isArray(node.items),
|
|
89
|
+
selected: true,
|
|
90
|
+
});
|
|
89
91
|
});
|
|
90
92
|
});
|
|
91
93
|
});
|
|
92
94
|
|
|
93
95
|
services?.editorService.on('remove', (nodes: MNode[]) => {
|
|
94
96
|
nodes.forEach((node) => {
|
|
95
|
-
|
|
97
|
+
traverseNode(node, (node: MNode) => {
|
|
98
|
+
nodeStatusMap.value?.delete(node.id);
|
|
99
|
+
});
|
|
96
100
|
});
|
|
97
101
|
});
|
|
98
102
|
|
|
@@ -40,6 +40,7 @@ import ScrollViewer from '@editor/components/ScrollViewer.vue';
|
|
|
40
40
|
import { useStage } from '@editor/hooks/use-stage';
|
|
41
41
|
import { DragType, Layout, type MenuButton, type MenuComponent, type Services, type StageOptions } from '@editor/type';
|
|
42
42
|
import { getConfig } from '@editor/utils/config';
|
|
43
|
+
import { KeyBindingContainerKey } from '@editor/utils/keybinding-config';
|
|
43
44
|
|
|
44
45
|
import NodeListMenu from './NodeListMenu.vue';
|
|
45
46
|
import ViewerMenu from './ViewerMenu.vue';
|
|
@@ -131,7 +132,7 @@ const resizeObserver = new ResizeObserver((entries) => {
|
|
|
131
132
|
onMounted(() => {
|
|
132
133
|
if (stageWrap.value?.container) {
|
|
133
134
|
resizeObserver.observe(stageWrap.value.container);
|
|
134
|
-
services?.keybindingService.registeEl(
|
|
135
|
+
services?.keybindingService.registeEl(KeyBindingContainerKey.STAGE, stageWrap.value.container);
|
|
135
136
|
}
|
|
136
137
|
});
|
|
137
138
|
|
|
@@ -7,7 +7,7 @@ import type { DataSourceSchema } from '@tmagic/schema';
|
|
|
7
7
|
import { guid } from '@tmagic/utils';
|
|
8
8
|
|
|
9
9
|
import type { DatasourceTypeOption } from '@editor/type';
|
|
10
|
-
import { getFormConfig } from '@editor/utils/data-source';
|
|
10
|
+
import { getFormConfig, getFormValue } from '@editor/utils/data-source';
|
|
11
11
|
|
|
12
12
|
import BaseService from './BaseService';
|
|
13
13
|
|
|
@@ -50,7 +50,7 @@ class DataSource extends BaseService {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
public getFormValue(type = 'base') {
|
|
53
|
-
return this.get('values')[type];
|
|
53
|
+
return getFormValue(type, this.get('values')[type]);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
public setFormValue(type: string, value: Partial<DataSourceSchema>) {
|
package/src/theme/event.scss
CHANGED
package/src/theme/framework.scss
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
.magic-editor-layer-node {
|
|
13
13
|
cursor: pointer;
|
|
14
|
+
white-space: nowrap;
|
|
14
15
|
|
|
15
16
|
.layer-node {
|
|
16
17
|
display: flex;
|
|
@@ -61,6 +62,9 @@
|
|
|
61
62
|
.layer-node-label {
|
|
62
63
|
line-height: $--node-height;
|
|
63
64
|
flex: 1;
|
|
65
|
+
width: 100px;
|
|
66
|
+
overflow: hidden;
|
|
67
|
+
text-overflow: ellipsis;
|
|
64
68
|
}
|
|
65
69
|
}
|
|
66
70
|
|
package/src/type.ts
CHANGED
|
@@ -334,6 +334,8 @@ export interface SideBarData {
|
|
|
334
334
|
export interface ComponentItem {
|
|
335
335
|
/** 显示文案 */
|
|
336
336
|
text: string;
|
|
337
|
+
/** 详情,用于tooltip */
|
|
338
|
+
desc?: string;
|
|
337
339
|
/** 组件类型 */
|
|
338
340
|
type: string;
|
|
339
341
|
/** Vue组件或url */
|
|
@@ -467,6 +469,7 @@ export interface EventSelectConfig {
|
|
|
467
469
|
name: string;
|
|
468
470
|
type: 'event-select';
|
|
469
471
|
src: 'datasource' | 'component';
|
|
472
|
+
labelWidth?: string;
|
|
470
473
|
/** 事件名称表单配置 */
|
|
471
474
|
eventNameConfig?: FormItem;
|
|
472
475
|
/** 动作类型配置 */
|
|
@@ -539,6 +542,7 @@ export interface KeyBindingCacheItem {
|
|
|
539
542
|
export interface CodeSelectColConfig {
|
|
540
543
|
type: 'code-select-col';
|
|
541
544
|
name: string;
|
|
545
|
+
text: string;
|
|
542
546
|
labelWidth?: number | string;
|
|
543
547
|
disabled?: boolean | FilterFunction;
|
|
544
548
|
display?: boolean | FilterFunction;
|
|
@@ -547,6 +551,7 @@ export interface CodeSelectColConfig {
|
|
|
547
551
|
export interface DataSourceMethodSelectConfig {
|
|
548
552
|
type: 'data-source-method-select';
|
|
549
553
|
name: string;
|
|
554
|
+
text: string;
|
|
550
555
|
labelWidth?: number | string;
|
|
551
556
|
disabled?: boolean | FilterFunction;
|
|
552
557
|
display?: boolean | FilterFunction;
|
|
@@ -561,6 +566,7 @@ export interface DataSourceFieldSelectConfig {
|
|
|
561
566
|
display?: boolean | FilterFunction;
|
|
562
567
|
}
|
|
563
568
|
|
|
569
|
+
/** 依赖收集的目标类型 */
|
|
564
570
|
export enum DepTargetType {
|
|
565
571
|
DEFAULT = 'default',
|
|
566
572
|
/** 代码块 */
|
|
@@ -573,18 +579,31 @@ export enum DepTargetType {
|
|
|
573
579
|
DATA_SOURCE_COND = 'data-source-cond',
|
|
574
580
|
}
|
|
575
581
|
|
|
582
|
+
/** 可新增的数据源类型选项 */
|
|
576
583
|
export interface DatasourceTypeOption {
|
|
584
|
+
/** 数据源类型 */
|
|
577
585
|
type: string;
|
|
586
|
+
/** 数据源名称 */
|
|
578
587
|
text: string;
|
|
579
588
|
}
|
|
580
589
|
|
|
590
|
+
/** 组件树节点状态 */
|
|
581
591
|
export interface LayerNodeStatus {
|
|
592
|
+
/** 显隐 */
|
|
582
593
|
visible: boolean;
|
|
594
|
+
/** 展开子节点 */
|
|
583
595
|
expand: boolean;
|
|
596
|
+
/** 选中 */
|
|
584
597
|
selected: boolean;
|
|
585
598
|
}
|
|
586
599
|
|
|
600
|
+
/** 拖拽类型 */
|
|
587
601
|
export enum DragType {
|
|
602
|
+
/** 从组件列表拖到画布 */
|
|
588
603
|
COMPONENT_LIST = 'component-list',
|
|
604
|
+
/** 拖动组件树节点 */
|
|
589
605
|
LAYER_TREE = 'layer-tree',
|
|
590
606
|
}
|
|
607
|
+
|
|
608
|
+
/** 当uiService.get('uiSelectMode')为true,点击组件(包括任何形式,组件树/画布)时触发的事件名 */
|
|
609
|
+
export const UI_SELECT_MODE_EVENT_NAME = 'ui-select';
|