@tmagic/editor 1.3.0-alpha.16 → 1.3.0-alpha.18
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 +1 -1
- package/dist/tmagic-editor.js +933 -673
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +944 -678
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +12 -12
- package/src/components/CodeBlockEditor.vue +1 -0
- package/src/fields/Code.vue +6 -10
- package/src/fields/CodeLink.vue +6 -7
- package/src/fields/CodeSelect.vue +5 -8
- package/src/fields/CodeSelectCol.vue +4 -15
- package/src/fields/DataSourceFieldSelect.vue +47 -0
- package/src/fields/DataSourceFields.vue +5 -10
- package/src/fields/DataSourceInput.vue +9 -12
- package/src/fields/DataSourceMethodSelect.vue +5 -16
- package/src/fields/DataSourceMethods.vue +6 -11
- package/src/fields/DataSourceSelect.vue +5 -12
- package/src/fields/EventSelect.vue +20 -12
- package/src/fields/KeyValue.vue +9 -11
- package/src/fields/UISelect.vue +19 -10
- package/src/index.ts +3 -0
- package/src/initService.ts +36 -16
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +2 -2
- package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +1 -0
- package/src/layouts/sidebar/data-source/DataSourceList.vue +51 -17
- package/src/services/dep.ts +19 -19
- package/src/theme/code-editor.scss +1 -1
- package/src/type.ts +20 -0
- package/src/utils/dep.ts +33 -7
- package/src/utils/props.ts +298 -189
- package/src/utils/stage.ts +3 -5
- package/types/fields/Code.vue.d.ts +11 -26
- package/types/fields/CodeLink.vue.d.ts +12 -21
- package/types/fields/CodeSelect.vue.d.ts +6 -17
- package/types/fields/CodeSelectCol.vue.d.ts +3 -18
- package/types/fields/DataSourceFieldSelect.vue.d.ts +29 -0
- package/types/fields/DataSourceFields.vue.d.ts +7 -20
- package/types/fields/DataSourceInput.vue.d.ts +10 -30
- package/types/fields/DataSourceMethodSelect.vue.d.ts +3 -18
- package/types/fields/DataSourceMethods.vue.d.ts +7 -20
- package/types/fields/DataSourceSelect.vue.d.ts +13 -29
- package/types/fields/EventSelect.vue.d.ts +2 -13
- package/types/fields/KeyValue.vue.d.ts +9 -24
- package/types/fields/UISelect.vue.d.ts +2 -11
- package/types/index.d.ts +1 -0
- package/types/initService.d.ts +1 -1
- package/types/services/dep.d.ts +12 -21
- package/types/services/props.d.ts +8 -113
- package/types/type.d.ts +18 -0
- package/types/utils/dep.d.ts +4 -2
- package/types/utils/props.d.ts +13 -102
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.3.0-alpha.
|
|
2
|
+
"version": "1.3.0-alpha.18",
|
|
3
3
|
"name": "@tmagic/editor",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
@@ -46,27 +46,27 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@babel/core": "^7.18.0",
|
|
48
48
|
"@element-plus/icons-vue": "^2.0.9",
|
|
49
|
-
"@tmagic/core": "1.3.0-alpha.
|
|
50
|
-
"@tmagic/design": "1.3.0-alpha.
|
|
51
|
-
"@tmagic/form": "1.3.0-alpha.
|
|
52
|
-
"@tmagic/schema": "1.3.0-alpha.
|
|
53
|
-
"@tmagic/stage": "1.3.0-alpha.
|
|
54
|
-
"@tmagic/table": "1.3.0-alpha.
|
|
55
|
-
"@tmagic/utils": "1.3.0-alpha.
|
|
49
|
+
"@tmagic/core": "1.3.0-alpha.18",
|
|
50
|
+
"@tmagic/design": "1.3.0-alpha.18",
|
|
51
|
+
"@tmagic/form": "1.3.0-alpha.18",
|
|
52
|
+
"@tmagic/schema": "1.3.0-alpha.18",
|
|
53
|
+
"@tmagic/stage": "1.3.0-alpha.18",
|
|
54
|
+
"@tmagic/table": "1.3.0-alpha.18",
|
|
55
|
+
"@tmagic/utils": "1.3.0-alpha.18",
|
|
56
56
|
"buffer": "^6.0.3",
|
|
57
57
|
"color": "^3.1.3",
|
|
58
58
|
"events": "^3.3.0",
|
|
59
59
|
"gesto": "^1.19.1",
|
|
60
60
|
"keycon": "^1.4.0",
|
|
61
61
|
"lodash-es": "^4.17.21",
|
|
62
|
-
"monaco-editor": "^0.
|
|
62
|
+
"monaco-editor": "^0.41.0",
|
|
63
63
|
"serialize-javascript": "^6.0.0",
|
|
64
64
|
"vue": "^3.3.4"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
|
-
"@tmagic/design": "1.3.0-alpha.
|
|
68
|
-
"@tmagic/form": "1.3.0-alpha.
|
|
69
|
-
"monaco-editor": "^0.
|
|
67
|
+
"@tmagic/design": "1.3.0-alpha.18",
|
|
68
|
+
"@tmagic/form": "1.3.0-alpha.18",
|
|
69
|
+
"monaco-editor": "^0.41.0",
|
|
70
70
|
"vue": "^3.3.4"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
package/src/fields/Code.vue
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
</template>
|
|
13
13
|
|
|
14
14
|
<script lang="ts" setup>
|
|
15
|
+
import type { FieldProps } from '@tmagic/form';
|
|
16
|
+
|
|
15
17
|
import MagicCodeEditor from '@editor/layouts/CodeEditor.vue';
|
|
16
18
|
|
|
17
19
|
defineOptions({
|
|
@@ -21,19 +23,13 @@ defineOptions({
|
|
|
21
23
|
const emit = defineEmits(['change']);
|
|
22
24
|
|
|
23
25
|
const props = withDefaults(
|
|
24
|
-
defineProps<
|
|
25
|
-
|
|
26
|
+
defineProps<
|
|
27
|
+
FieldProps<{
|
|
26
28
|
language?: string;
|
|
27
29
|
options?: Object;
|
|
28
30
|
height?: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
name: string;
|
|
32
|
-
prop: string;
|
|
33
|
-
lastValues?: any;
|
|
34
|
-
disabled?: boolean;
|
|
35
|
-
size?: 'small' | 'default' | 'large';
|
|
36
|
-
}>(),
|
|
31
|
+
}>
|
|
32
|
+
>(),
|
|
37
33
|
{
|
|
38
34
|
disabled: false,
|
|
39
35
|
},
|
package/src/fields/CodeLink.vue
CHANGED
|
@@ -6,24 +6,23 @@
|
|
|
6
6
|
import { computed, reactive, watch } from 'vue';
|
|
7
7
|
import serialize from 'serialize-javascript';
|
|
8
8
|
|
|
9
|
+
import type { FieldProps } from '@tmagic/form';
|
|
10
|
+
|
|
9
11
|
import { getConfig } from '@editor/utils/config';
|
|
10
12
|
|
|
11
13
|
defineOptions({
|
|
12
14
|
name: 'MEditorCodeLink',
|
|
13
15
|
});
|
|
14
16
|
|
|
15
|
-
const props = defineProps<
|
|
16
|
-
|
|
17
|
+
const props = defineProps<
|
|
18
|
+
FieldProps<{
|
|
17
19
|
type: 'code-link';
|
|
18
20
|
name: string;
|
|
19
21
|
text?: string;
|
|
20
22
|
formTitle?: string;
|
|
21
23
|
codeOptions?: Object;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
name: string;
|
|
25
|
-
prop: string;
|
|
26
|
-
}>();
|
|
24
|
+
}>
|
|
25
|
+
>();
|
|
27
26
|
|
|
28
27
|
const emit = defineEmits(['change']);
|
|
29
28
|
|
|
@@ -11,6 +11,7 @@ import { computed, inject, watch } from 'vue';
|
|
|
11
11
|
import { isEmpty } from 'lodash-es';
|
|
12
12
|
|
|
13
13
|
import { TMagicCard } from '@tmagic/design';
|
|
14
|
+
import type { FieldProps } from '@tmagic/form';
|
|
14
15
|
import { HookType } from '@tmagic/schema';
|
|
15
16
|
|
|
16
17
|
import type { Services } from '@editor/type';
|
|
@@ -24,15 +25,11 @@ const emit = defineEmits(['change']);
|
|
|
24
25
|
const services = inject<Services>('services');
|
|
25
26
|
|
|
26
27
|
const props = withDefaults(
|
|
27
|
-
defineProps<
|
|
28
|
-
|
|
28
|
+
defineProps<
|
|
29
|
+
FieldProps<{
|
|
29
30
|
className?: string;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
prop: string;
|
|
33
|
-
name: string;
|
|
34
|
-
size: 'small' | 'default' | 'large';
|
|
35
|
-
}>(),
|
|
31
|
+
}>
|
|
32
|
+
>(),
|
|
36
33
|
{},
|
|
37
34
|
);
|
|
38
35
|
|
|
@@ -37,7 +37,7 @@ import { computed, inject, ref } from 'vue';
|
|
|
37
37
|
import { Edit, View } from '@element-plus/icons-vue';
|
|
38
38
|
import { isEmpty, map } from 'lodash-es';
|
|
39
39
|
|
|
40
|
-
import { createValues } from '@tmagic/form';
|
|
40
|
+
import { createValues, FieldProps } from '@tmagic/form';
|
|
41
41
|
import type { Id } from '@tmagic/schema';
|
|
42
42
|
|
|
43
43
|
import CodeBlockEditor from '@editor/components/CodeBlockEditor.vue';
|
|
@@ -53,20 +53,9 @@ defineOptions({
|
|
|
53
53
|
const services = inject<Services>('services');
|
|
54
54
|
const emit = defineEmits(['change']);
|
|
55
55
|
|
|
56
|
-
const props = withDefaults(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
model: any;
|
|
60
|
-
prop: string;
|
|
61
|
-
name: string;
|
|
62
|
-
lastValues?: any;
|
|
63
|
-
disabled?: boolean;
|
|
64
|
-
size: 'small' | 'default' | 'large';
|
|
65
|
-
}>(),
|
|
66
|
-
{
|
|
67
|
-
disabled: false,
|
|
68
|
-
},
|
|
69
|
-
);
|
|
56
|
+
const props = withDefaults(defineProps<FieldProps<CodeSelectColConfig>>(), {
|
|
57
|
+
disabled: false,
|
|
58
|
+
});
|
|
70
59
|
|
|
71
60
|
/**
|
|
72
61
|
* 根据代码块id获取代码块参数配置
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<m-form-container
|
|
3
|
+
:config="{
|
|
4
|
+
...config,
|
|
5
|
+
...cascaderConfig,
|
|
6
|
+
}"
|
|
7
|
+
:model="model"
|
|
8
|
+
@change="onChangeHandler"
|
|
9
|
+
></m-form-container>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
import { computed, inject } from 'vue';
|
|
14
|
+
|
|
15
|
+
import type { FieldProps } from '@tmagic/form';
|
|
16
|
+
|
|
17
|
+
import type { DataSourceFieldSelectConfig, Services } from '@editor/type';
|
|
18
|
+
|
|
19
|
+
const services = inject<Services>('services');
|
|
20
|
+
const emit = defineEmits(['change']);
|
|
21
|
+
|
|
22
|
+
const props = withDefaults(defineProps<FieldProps<DataSourceFieldSelectConfig>>(), {
|
|
23
|
+
disabled: false,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const dataSources = computed(() => services?.dataSourceService.get('dataSources'));
|
|
27
|
+
|
|
28
|
+
const cascaderConfig = {
|
|
29
|
+
type: 'cascader',
|
|
30
|
+
name: props.name,
|
|
31
|
+
options: () =>
|
|
32
|
+
dataSources.value
|
|
33
|
+
?.filter((ds) => ds.fields?.length)
|
|
34
|
+
?.map((ds) => ({
|
|
35
|
+
label: ds.title || ds.id,
|
|
36
|
+
value: ds.id,
|
|
37
|
+
children: ds.fields?.map((field) => ({
|
|
38
|
+
label: field.title,
|
|
39
|
+
value: field.name,
|
|
40
|
+
})),
|
|
41
|
+
})) || [],
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const onChangeHandler = (value: any) => {
|
|
45
|
+
emit('change', value);
|
|
46
|
+
};
|
|
47
|
+
</script>
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
import { ref } from 'vue';
|
|
23
23
|
|
|
24
24
|
import { TMagicButton, tMagicMessageBox } from '@tmagic/design';
|
|
25
|
-
import { FormConfig, FormState, MFormDialog } from '@tmagic/form';
|
|
25
|
+
import { FieldProps, FormConfig, FormState, MFormDialog } from '@tmagic/form';
|
|
26
26
|
import { MagicTable } from '@tmagic/table';
|
|
27
27
|
|
|
28
28
|
defineOptions({
|
|
@@ -30,16 +30,11 @@ defineOptions({
|
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
const props = withDefaults(
|
|
33
|
-
defineProps<
|
|
34
|
-
|
|
33
|
+
defineProps<
|
|
34
|
+
FieldProps<{
|
|
35
35
|
type: 'data-source-fields';
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
prop: string;
|
|
39
|
-
lastValues?: any;
|
|
40
|
-
disabled: boolean;
|
|
41
|
-
name: string;
|
|
42
|
-
}>(),
|
|
36
|
+
}>
|
|
37
|
+
>(),
|
|
43
38
|
{
|
|
44
39
|
disabled: false,
|
|
45
40
|
},
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
import { computed, inject, nextTick, ref, watch } from 'vue';
|
|
49
49
|
import { Coin } from '@element-plus/icons-vue';
|
|
50
50
|
|
|
51
|
-
import {
|
|
51
|
+
import { getConfig, TMagicAutocomplete, TMagicTag } from '@tmagic/design';
|
|
52
|
+
import type { FieldProps } from '@tmagic/form';
|
|
52
53
|
import type { DataSchema, DataSourceSchema } from '@tmagic/schema';
|
|
53
54
|
|
|
54
55
|
import Icon from '@editor/components/Icon.vue';
|
|
@@ -59,25 +60,21 @@ defineOptions({
|
|
|
59
60
|
});
|
|
60
61
|
|
|
61
62
|
const props = withDefaults(
|
|
62
|
-
defineProps<
|
|
63
|
-
|
|
63
|
+
defineProps<
|
|
64
|
+
FieldProps<{
|
|
64
65
|
type: 'data-source-input';
|
|
65
66
|
name: string;
|
|
66
67
|
text: string;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
name: string;
|
|
70
|
-
prop: string;
|
|
71
|
-
disabled: boolean;
|
|
72
|
-
lastValues?: Record<string, any>;
|
|
73
|
-
size?: FieldSize;
|
|
74
|
-
}>(),
|
|
68
|
+
}>
|
|
69
|
+
>(),
|
|
75
70
|
{
|
|
76
71
|
disabled: false,
|
|
77
72
|
},
|
|
78
73
|
);
|
|
79
74
|
|
|
80
|
-
const emit = defineEmits<
|
|
75
|
+
const emit = defineEmits<{
|
|
76
|
+
change: [value: string];
|
|
77
|
+
}>();
|
|
81
78
|
|
|
82
79
|
const { dataSourceService } = inject<Services>('services') || {};
|
|
83
80
|
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
import { computed, inject, ref } from 'vue';
|
|
35
35
|
import { Edit, View } from '@element-plus/icons-vue';
|
|
36
36
|
|
|
37
|
-
import { createValues } from '@tmagic/form';
|
|
37
|
+
import { createValues, FieldProps } from '@tmagic/form';
|
|
38
38
|
import type { CodeBlockContent, Id } from '@tmagic/schema';
|
|
39
39
|
|
|
40
40
|
import CodeBlockEditor from '@editor/components/CodeBlockEditor.vue';
|
|
@@ -50,20 +50,9 @@ defineOptions({
|
|
|
50
50
|
const services = inject<Services>('services');
|
|
51
51
|
const emit = defineEmits(['change']);
|
|
52
52
|
|
|
53
|
-
const props = withDefaults(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
model: any;
|
|
57
|
-
lastValues?: any;
|
|
58
|
-
prop: string;
|
|
59
|
-
name: string;
|
|
60
|
-
disabled?: boolean;
|
|
61
|
-
size: 'small' | 'default' | 'large';
|
|
62
|
-
}>(),
|
|
63
|
-
{
|
|
64
|
-
disabled: false,
|
|
65
|
-
},
|
|
66
|
-
);
|
|
53
|
+
const props = withDefaults(defineProps<FieldProps<DataSourceMethodSelectConfig>>(), {
|
|
54
|
+
disabled: false,
|
|
55
|
+
});
|
|
67
56
|
|
|
68
57
|
const dataSources = computed(() => services?.dataSourceService.get('dataSources'));
|
|
69
58
|
|
|
@@ -105,7 +94,7 @@ const cascaderConfig = {
|
|
|
105
94
|
dataSources.value
|
|
106
95
|
?.filter((ds) => ds.methods?.length)
|
|
107
96
|
?.map((ds) => ({
|
|
108
|
-
label:
|
|
97
|
+
label: ds.title || ds.id,
|
|
109
98
|
value: ds.id,
|
|
110
99
|
children: ds.methods?.map((method) => ({
|
|
111
100
|
label: method.name,
|
|
@@ -20,29 +20,24 @@
|
|
|
20
20
|
|
|
21
21
|
<script setup lang="ts">
|
|
22
22
|
import { TMagicButton } from '@tmagic/design';
|
|
23
|
+
import type { FieldProps } from '@tmagic/form';
|
|
23
24
|
import type { CodeBlockContent } from '@tmagic/schema';
|
|
24
25
|
import { MagicTable } from '@tmagic/table';
|
|
25
26
|
|
|
26
27
|
import CodeBlockEditor from '@editor/components/CodeBlockEditor.vue';
|
|
28
|
+
import type { CodeParamStatement } from '@editor/type';
|
|
27
29
|
import { useDataSourceMethod } from '@editor/utils/use-data-source-method';
|
|
28
30
|
|
|
29
|
-
import { CodeParamStatement } from '..';
|
|
30
|
-
|
|
31
31
|
defineOptions({
|
|
32
32
|
name: 'MEditorDataSourceMethods',
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
const props = withDefaults(
|
|
36
|
-
defineProps<
|
|
37
|
-
|
|
36
|
+
defineProps<
|
|
37
|
+
FieldProps<{
|
|
38
38
|
type: 'data-source-methods';
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
prop: string;
|
|
42
|
-
lastValues?: any;
|
|
43
|
-
disabled: boolean;
|
|
44
|
-
name: string;
|
|
45
|
-
}>(),
|
|
39
|
+
}>
|
|
40
|
+
>(),
|
|
46
41
|
{
|
|
47
42
|
disabled: false,
|
|
48
43
|
},
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
<script setup lang="ts">
|
|
15
15
|
import { computed, inject } from 'vue';
|
|
16
16
|
|
|
17
|
-
import {
|
|
18
|
-
import { MSelect, SelectConfig } from '@tmagic/form';
|
|
17
|
+
import { FieldProps, MSelect, SelectConfig } from '@tmagic/form';
|
|
19
18
|
|
|
20
19
|
import { Services } from '../type';
|
|
21
20
|
|
|
@@ -26,21 +25,15 @@ defineOptions({
|
|
|
26
25
|
const emit = defineEmits(['change']);
|
|
27
26
|
|
|
28
27
|
const props = withDefaults(
|
|
29
|
-
defineProps<
|
|
30
|
-
|
|
28
|
+
defineProps<
|
|
29
|
+
FieldProps<{
|
|
31
30
|
type: 'data-source-select';
|
|
32
31
|
name: string;
|
|
33
32
|
text: string;
|
|
34
33
|
placeholder: string;
|
|
35
34
|
dataSourceType?: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
name: string;
|
|
39
|
-
prop: string;
|
|
40
|
-
disabled: boolean;
|
|
41
|
-
lastValues?: Record<string, any>;
|
|
42
|
-
size?: FieldSize;
|
|
43
|
-
}>(),
|
|
35
|
+
}>
|
|
36
|
+
>(),
|
|
44
37
|
{
|
|
45
38
|
disabled: false,
|
|
46
39
|
},
|
|
@@ -3,18 +3,23 @@
|
|
|
3
3
|
<m-form-table
|
|
4
4
|
v-if="isOldVersion"
|
|
5
5
|
ref="eventForm"
|
|
6
|
-
:size="props.size"
|
|
7
|
-
:model="model"
|
|
8
6
|
name="events"
|
|
7
|
+
:size="size"
|
|
8
|
+
:disabled="disabled"
|
|
9
|
+
:model="model"
|
|
9
10
|
:config="tableConfig"
|
|
10
11
|
@change="onChangeHandler"
|
|
11
12
|
></m-form-table>
|
|
12
13
|
|
|
13
14
|
<div v-else class="fullWidth">
|
|
14
|
-
<TMagicButton class="create-button" type="primary" size="
|
|
15
|
+
<TMagicButton class="create-button" type="primary" :size="size" :disabled="disabled" @click="addEvent()"
|
|
16
|
+
>添加事件</TMagicButton
|
|
17
|
+
>
|
|
15
18
|
<m-form-panel
|
|
16
19
|
v-for="(cardItem, index) in model[name]"
|
|
17
20
|
:key="index"
|
|
21
|
+
:disabled="disabled"
|
|
22
|
+
:size="size"
|
|
18
23
|
:config="actionsConfig"
|
|
19
24
|
:model="cardItem"
|
|
20
25
|
@change="onChangeHandler"
|
|
@@ -24,9 +29,18 @@
|
|
|
24
29
|
class="fullWidth"
|
|
25
30
|
:config="eventNameConfig"
|
|
26
31
|
:model="cardItem"
|
|
32
|
+
:disabled="disabled"
|
|
33
|
+
:size="size"
|
|
27
34
|
@change="onChangeHandler"
|
|
28
35
|
></m-form-container>
|
|
29
|
-
<TMagicButton
|
|
36
|
+
<TMagicButton
|
|
37
|
+
style="color: #f56c6c"
|
|
38
|
+
text
|
|
39
|
+
:icon="Delete"
|
|
40
|
+
:disabled="disabled"
|
|
41
|
+
:size="size"
|
|
42
|
+
@click="removeEvent(index)"
|
|
43
|
+
></TMagicButton>
|
|
30
44
|
</template>
|
|
31
45
|
</m-form-panel>
|
|
32
46
|
</div>
|
|
@@ -39,7 +53,7 @@ import { Delete } from '@element-plus/icons-vue';
|
|
|
39
53
|
import { has } from 'lodash-es';
|
|
40
54
|
|
|
41
55
|
import { TMagicButton } from '@tmagic/design';
|
|
42
|
-
import { FormState } from '@tmagic/form';
|
|
56
|
+
import type { FieldProps, FormState } from '@tmagic/form';
|
|
43
57
|
import { ActionType } from '@tmagic/schema';
|
|
44
58
|
|
|
45
59
|
import type { CodeSelectColConfig, DataSourceMethodSelectConfig, EventSelectConfig, Services } from '@editor/type';
|
|
@@ -48,13 +62,7 @@ defineOptions({
|
|
|
48
62
|
name: 'MEditorEventSelect',
|
|
49
63
|
});
|
|
50
64
|
|
|
51
|
-
const props = defineProps<
|
|
52
|
-
config: EventSelectConfig;
|
|
53
|
-
model: any;
|
|
54
|
-
prop: string;
|
|
55
|
-
name: string;
|
|
56
|
-
size: 'small' | 'default' | 'large';
|
|
57
|
-
}>();
|
|
65
|
+
const props = defineProps<FieldProps<EventSelectConfig>>();
|
|
58
66
|
|
|
59
67
|
const emit = defineEmits(['change']);
|
|
60
68
|
|
package/src/fields/KeyValue.vue
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
class="m-fileds-key-value-delete"
|
|
22
22
|
type="danger"
|
|
23
23
|
:size="size"
|
|
24
|
+
:disabled="disabled"
|
|
24
25
|
circle
|
|
25
26
|
plain
|
|
26
27
|
:icon="Delete"
|
|
@@ -28,7 +29,9 @@
|
|
|
28
29
|
></TMagicButton>
|
|
29
30
|
</div>
|
|
30
31
|
|
|
31
|
-
<TMagicButton type="primary" :size="size" plain :icon="Plus" @click="addHandler"
|
|
32
|
+
<TMagicButton type="primary" :size="size" :disabled="disabled" plain :icon="Plus" @click="addHandler"
|
|
33
|
+
>添加</TMagicButton
|
|
34
|
+
>
|
|
32
35
|
</div>
|
|
33
36
|
</template>
|
|
34
37
|
|
|
@@ -37,25 +40,20 @@ import { ref, watchEffect } from 'vue';
|
|
|
37
40
|
import { Delete, Plus } from '@element-plus/icons-vue';
|
|
38
41
|
|
|
39
42
|
import { TMagicButton, TMagicInput } from '@tmagic/design';
|
|
43
|
+
import type { FieldProps } from '@tmagic/form';
|
|
40
44
|
|
|
41
45
|
defineOptions({
|
|
42
46
|
name: 'MEditorKeyValue',
|
|
43
47
|
});
|
|
44
48
|
|
|
45
49
|
const props = withDefaults(
|
|
46
|
-
defineProps<
|
|
47
|
-
|
|
50
|
+
defineProps<
|
|
51
|
+
FieldProps<{
|
|
48
52
|
type: 'key-value';
|
|
49
53
|
name: string;
|
|
50
54
|
text: string;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
name: string;
|
|
54
|
-
prop: string;
|
|
55
|
-
disabled: boolean;
|
|
56
|
-
lastValues?: Record<string, any>;
|
|
57
|
-
size?: 'large' | 'default' | 'small';
|
|
58
|
-
}>(),
|
|
55
|
+
}>
|
|
56
|
+
>(),
|
|
59
57
|
{
|
|
60
58
|
disabled: false,
|
|
61
59
|
},
|
package/src/fields/UISelect.vue
CHANGED
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="m-fields-ui-select" v-if="uiSelectMode" @click="cancelHandler">
|
|
3
|
-
<TMagicButton type="danger" :icon="Delete" text style="padding: 0"
|
|
3
|
+
<TMagicButton type="danger" :icon="Delete" :disabled="disabled" :size="size" text style="padding: 0"
|
|
4
|
+
>取消</TMagicButton
|
|
5
|
+
>
|
|
4
6
|
</div>
|
|
5
7
|
<div class="m-fields-ui-select" v-else style="display: flex">
|
|
6
8
|
<template v-if="val">
|
|
7
9
|
<TMagicTooltip content="清除" placement="top">
|
|
8
|
-
<TMagicButton
|
|
10
|
+
<TMagicButton
|
|
11
|
+
style="padding: 0"
|
|
12
|
+
type="danger"
|
|
13
|
+
:icon="Close"
|
|
14
|
+
:disabled="disabled"
|
|
15
|
+
:size="size"
|
|
16
|
+
text
|
|
17
|
+
@click.stop="deleteHandler"
|
|
18
|
+
></TMagicButton>
|
|
9
19
|
</TMagicTooltip>
|
|
10
20
|
|
|
11
21
|
<TMagicTooltip content="点击选中组件" placement="top">
|
|
12
22
|
<TMagicButton
|
|
13
23
|
text
|
|
14
24
|
style="padding: 0; margin: 0"
|
|
25
|
+
:disabled="disabled"
|
|
26
|
+
:size="size"
|
|
15
27
|
@click="selectNode(val)"
|
|
16
28
|
@mouseenter="highlight(val)"
|
|
17
29
|
@mouseleave="unhightlight"
|
|
@@ -21,7 +33,9 @@
|
|
|
21
33
|
</template>
|
|
22
34
|
|
|
23
35
|
<TMagicTooltip v-else content="点击此处选择" placement="top">
|
|
24
|
-
<TMagicButton text style="padding: 0; margin: 0" @click="startSelect"
|
|
36
|
+
<TMagicButton text style="padding: 0; margin: 0" :disabled="disabled" :size="size" @click="startSelect"
|
|
37
|
+
>点击此处选择</TMagicButton
|
|
38
|
+
>
|
|
25
39
|
</TMagicTooltip>
|
|
26
40
|
</div>
|
|
27
41
|
</template>
|
|
@@ -32,7 +46,7 @@ import { Close, Delete } from '@element-plus/icons-vue';
|
|
|
32
46
|
import { throttle } from 'lodash-es';
|
|
33
47
|
|
|
34
48
|
import { TMagicButton, TMagicTooltip } from '@tmagic/design';
|
|
35
|
-
import { FormState } from '@tmagic/form';
|
|
49
|
+
import type { FieldProps, FormState } from '@tmagic/form';
|
|
36
50
|
import type { Id } from '@tmagic/schema';
|
|
37
51
|
|
|
38
52
|
import type { Services } from '@editor/type';
|
|
@@ -41,12 +55,7 @@ defineOptions({
|
|
|
41
55
|
name: 'MEditorUISelect',
|
|
42
56
|
});
|
|
43
57
|
|
|
44
|
-
const props = defineProps<
|
|
45
|
-
config: any;
|
|
46
|
-
model: any;
|
|
47
|
-
prop: string;
|
|
48
|
-
name: string;
|
|
49
|
-
}>();
|
|
58
|
+
const props = defineProps<FieldProps<any>>();
|
|
50
59
|
|
|
51
60
|
const emit = defineEmits(['change']);
|
|
52
61
|
|
package/src/index.ts
CHANGED
|
@@ -22,6 +22,7 @@ import CodeLink from './fields/CodeLink.vue';
|
|
|
22
22
|
import CodeSelect from './fields/CodeSelect.vue';
|
|
23
23
|
import CodeSelectCol from './fields/CodeSelectCol.vue';
|
|
24
24
|
import DataSourceFields from './fields/DataSourceFields.vue';
|
|
25
|
+
import DataSourceFieldSelect from './fields/DataSourceFieldSelect.vue';
|
|
25
26
|
import DataSourceInput from './fields/DataSourceInput.vue';
|
|
26
27
|
import DataSourceMethods from './fields/DataSourceMethods.vue';
|
|
27
28
|
import DataSourceMethodSelect from './fields/DataSourceMethodSelect.vue';
|
|
@@ -59,6 +60,7 @@ export { default as DataSourceMethods } from './fields/DataSourceMethods.vue';
|
|
|
59
60
|
export { default as DataSourceInput } from './fields/DataSourceInput.vue';
|
|
60
61
|
export { default as DataSourceSelect } from './fields/DataSourceSelect.vue';
|
|
61
62
|
export { default as DataSourceMethodSelect } from './fields/DataSourceMethodSelect.vue';
|
|
63
|
+
export { default as DataSourceFieldSelect } from './fields/DataSourceFieldSelect.vue';
|
|
62
64
|
export { default as EventSelect } from './fields/EventSelect.vue';
|
|
63
65
|
export { default as KeyValue } from './fields/KeyValue.vue';
|
|
64
66
|
export { default as CodeBlockList } from './layouts/sidebar/code-block/CodeBlockList.vue';
|
|
@@ -98,5 +100,6 @@ export default {
|
|
|
98
100
|
app.component('m-fields-data-source-select', DataSourceSelect);
|
|
99
101
|
app.component('m-fields-data-source-methods', DataSourceMethods);
|
|
100
102
|
app.component('m-fields-data-source-method-select', DataSourceMethodSelect);
|
|
103
|
+
app.component('m-fields-data-source-field-select', DataSourceFieldSelect);
|
|
101
104
|
},
|
|
102
105
|
};
|