@tmagic/editor 1.4.9 → 1.4.10
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 +26 -0
- package/dist/tmagic-editor.js +3213 -2820
- package/dist/tmagic-editor.umd.cjs +3237 -2839
- package/package.json +12 -10
- package/src/Editor.vue +2 -1
- package/src/editorProps.ts +3 -0
- package/src/fields/CondOpSelect.vue +87 -0
- package/src/fields/DataSourceFieldSelect/FieldSelect.vue +152 -0
- package/src/fields/DataSourceFieldSelect/Index.vue +168 -0
- package/src/fields/DataSourceFields.vue +6 -0
- package/src/fields/DisplayConds.vue +145 -0
- package/src/index.ts +8 -2
- package/src/layouts/Framework.vue +4 -2
- package/src/layouts/page-bar/PageBar.vue +8 -2
- package/src/layouts/page-bar/PageBarScrollContainer.vue +40 -4
- package/src/layouts/page-bar/PageList.vue +55 -0
- package/src/services/ui.ts +1 -0
- package/src/theme/data-source-field-select.scss +16 -0
- package/src/theme/page-bar.scss +13 -0
- package/src/theme/theme.scss +1 -0
- package/src/type.ts +35 -4
- package/src/utils/data-source/index.ts +9 -3
- package/src/utils/props.ts +6 -103
- package/types/editorProps.d.ts +3 -1
- package/types/fields/CondOpSelect.vue.d.ts +17 -0
- package/types/fields/DataSourceFieldSelect/FieldSelect.vue.d.ts +36 -0
- package/types/fields/{DataSourceFieldSelect.vue.d.ts → DataSourceFieldSelect/Index.vue.d.ts} +1 -1
- package/types/fields/DisplayConds.vue.d.ts +32 -0
- package/types/index.d.ts +3 -1
- package/types/layouts/Framework.vue.d.ts +3 -1
- package/types/layouts/PropsPanel.vue.d.ts +21 -21
- package/types/layouts/page-bar/PageBar.vue.d.ts +6 -0
- package/types/layouts/page-bar/PageBarScrollContainer.vue.d.ts +3 -0
- package/types/layouts/page-bar/PageList.vue.d.ts +25 -0
- package/types/services/ui.d.ts +1 -0
- package/types/type.d.ts +30 -4
- package/types/utils/data-source/index.d.ts +1 -0
- package/types/utils/props.d.ts +12 -0
- package/src/fields/DataSourceFieldSelect.vue +0 -149
|
@@ -8,22 +8,22 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
8
8
|
popperClass: {
|
|
9
9
|
type: import("vue").PropType<string>;
|
|
10
10
|
};
|
|
11
|
-
height: {
|
|
12
|
-
type: import("vue").PropType<string>;
|
|
13
|
-
default: string;
|
|
14
|
-
};
|
|
15
|
-
size: {
|
|
16
|
-
type: import("vue").PropType<"default" | "small" | "large">;
|
|
17
|
-
};
|
|
18
11
|
disabled: {
|
|
19
12
|
type: import("vue").PropType<boolean>;
|
|
20
13
|
default: boolean;
|
|
21
14
|
};
|
|
15
|
+
height: {
|
|
16
|
+
type: import("vue").PropType<string>;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
22
19
|
config: {
|
|
23
20
|
type: import("vue").PropType<import("@tmagic/form").FormConfig>;
|
|
24
21
|
required: true;
|
|
25
22
|
default: () => never[];
|
|
26
23
|
};
|
|
24
|
+
size: {
|
|
25
|
+
type: import("vue").PropType<"default" | "small" | "large">;
|
|
26
|
+
};
|
|
27
27
|
labelWidth: {
|
|
28
28
|
type: import("vue").PropType<string>;
|
|
29
29
|
default: string;
|
|
@@ -86,22 +86,22 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
86
86
|
popperClass: {
|
|
87
87
|
type: import("vue").PropType<string>;
|
|
88
88
|
};
|
|
89
|
-
height: {
|
|
90
|
-
type: import("vue").PropType<string>;
|
|
91
|
-
default: string;
|
|
92
|
-
};
|
|
93
|
-
size: {
|
|
94
|
-
type: import("vue").PropType<"default" | "small" | "large">;
|
|
95
|
-
};
|
|
96
89
|
disabled: {
|
|
97
90
|
type: import("vue").PropType<boolean>;
|
|
98
91
|
default: boolean;
|
|
99
92
|
};
|
|
93
|
+
height: {
|
|
94
|
+
type: import("vue").PropType<string>;
|
|
95
|
+
default: string;
|
|
96
|
+
};
|
|
100
97
|
config: {
|
|
101
98
|
type: import("vue").PropType<import("@tmagic/form").FormConfig>;
|
|
102
99
|
required: true;
|
|
103
100
|
default: () => never[];
|
|
104
101
|
};
|
|
102
|
+
size: {
|
|
103
|
+
type: import("vue").PropType<"default" | "small" | "large">;
|
|
104
|
+
};
|
|
105
105
|
labelWidth: {
|
|
106
106
|
type: import("vue").PropType<string>;
|
|
107
107
|
default: string;
|
|
@@ -171,22 +171,22 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
171
171
|
popperClass: {
|
|
172
172
|
type: import("vue").PropType<string>;
|
|
173
173
|
};
|
|
174
|
-
height: {
|
|
175
|
-
type: import("vue").PropType<string>;
|
|
176
|
-
default: string;
|
|
177
|
-
};
|
|
178
|
-
size: {
|
|
179
|
-
type: import("vue").PropType<"default" | "small" | "large">;
|
|
180
|
-
};
|
|
181
174
|
disabled: {
|
|
182
175
|
type: import("vue").PropType<boolean>;
|
|
183
176
|
default: boolean;
|
|
184
177
|
};
|
|
178
|
+
height: {
|
|
179
|
+
type: import("vue").PropType<string>;
|
|
180
|
+
default: string;
|
|
181
|
+
};
|
|
185
182
|
config: {
|
|
186
183
|
type: import("vue").PropType<import("@tmagic/form").FormConfig>;
|
|
187
184
|
required: true;
|
|
188
185
|
default: () => never[];
|
|
189
186
|
};
|
|
187
|
+
size: {
|
|
188
|
+
type: import("vue").PropType<"default" | "small" | "large">;
|
|
189
|
+
};
|
|
190
190
|
labelWidth: {
|
|
191
191
|
type: import("vue").PropType<string>;
|
|
192
192
|
default: string;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { type MPage, type MPageFragment } from '@tmagic/schema';
|
|
2
|
+
import type { PageBarSortOptions } from '../../type';
|
|
2
3
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToOption<{
|
|
3
4
|
disabledPageFragment: boolean;
|
|
5
|
+
pageBarSortOptions?: PageBarSortOptions | undefined;
|
|
4
6
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
|
|
5
7
|
disabledPageFragment: boolean;
|
|
8
|
+
pageBarSortOptions?: PageBarSortOptions | undefined;
|
|
6
9
|
}>>>, {}, {}>, {
|
|
10
|
+
"page-list-popover"?(_: {
|
|
11
|
+
list: MPage[] | MPageFragment[];
|
|
12
|
+
}): any;
|
|
7
13
|
"page-bar-title"?(_: {
|
|
8
14
|
page: MPage | MPageFragment;
|
|
9
15
|
}): any;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { NodeType } from '@tmagic/schema';
|
|
2
|
+
import type { PageBarSortOptions } from '../../type';
|
|
2
3
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToOption<{
|
|
3
4
|
type: NodeType.PAGE | NodeType.PAGE_FRAGMENT;
|
|
5
|
+
pageBarSortOptions?: PageBarSortOptions | undefined;
|
|
4
6
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
|
|
5
7
|
type: NodeType.PAGE | NodeType.PAGE_FRAGMENT;
|
|
8
|
+
pageBarSortOptions?: PageBarSortOptions | undefined;
|
|
6
9
|
}>>>, {}, {}>, {
|
|
7
10
|
prepend?(_: {}): any;
|
|
8
11
|
default?(_: {}): any;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { MPage, MPageFragment } from '@tmagic/schema';
|
|
2
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToOption<{
|
|
3
|
+
list: MPage[] | MPageFragment[];
|
|
4
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
|
|
5
|
+
list: MPage[] | MPageFragment[];
|
|
6
|
+
}>>>, {}, {}>, {
|
|
7
|
+
"page-list-popover"?(_: {
|
|
8
|
+
list: MPage[] | MPageFragment[];
|
|
9
|
+
}): any;
|
|
10
|
+
}>;
|
|
11
|
+
export default _default;
|
|
12
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
13
|
+
new (): {
|
|
14
|
+
$slots: S;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
18
|
+
type __VLS_TypePropsToOption<T> = {
|
|
19
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
20
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
21
|
+
} : {
|
|
22
|
+
type: import('vue').PropType<T[K]>;
|
|
23
|
+
required: true;
|
|
24
|
+
};
|
|
25
|
+
};
|
package/types/services/ui.d.ts
CHANGED
package/types/type.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { Component } from 'vue';
|
|
3
3
|
import type EventEmitter from 'events';
|
|
4
|
+
import Sortable, { Options, SortableEvent } from 'sortablejs';
|
|
4
5
|
import type { PascalCasedProperties } from 'type-fest';
|
|
5
|
-
import type { ChildConfig, ColumnConfig, FilterFunction, FormConfig, FormItem, Input } from '@tmagic/form';
|
|
6
|
-
import type { CodeBlockContent, CodeBlockDSL, DataSourceFieldType, Id, MApp, MContainer, MNode, MPage, MPageFragment } from '@tmagic/schema';
|
|
6
|
+
import type { ChildConfig, ColumnConfig, FilterFunction, FormConfig, FormItem, FormState, Input } from '@tmagic/form';
|
|
7
|
+
import type { CodeBlockContent, CodeBlockDSL, DataSourceFieldType, DataSourceSchema, Id, MApp, MContainer, MNode, MPage, MPageFragment } from '@tmagic/schema';
|
|
7
8
|
import type StageCore from '@tmagic/stage';
|
|
8
9
|
import type { ContainerHighlightType, CustomizeMoveableOptionsCallbackConfig, GuidesOptions, MoveableOptions, RenderType, UpdateDragEl } from '@tmagic/stage';
|
|
9
10
|
import type { CodeBlockService } from './services/codeBlock';
|
|
@@ -37,6 +38,9 @@ export interface FrameworkSlots {
|
|
|
37
38
|
'page-bar-popover'(props: {
|
|
38
39
|
page: MPage | MPageFragment;
|
|
39
40
|
}): any;
|
|
41
|
+
'page-list-popover'(props: {
|
|
42
|
+
list: MPage[] | MPageFragment[];
|
|
43
|
+
}): any;
|
|
40
44
|
}
|
|
41
45
|
export interface WorkspaceSlots {
|
|
42
46
|
stage(props: {}): any;
|
|
@@ -195,6 +199,8 @@ export interface UiState {
|
|
|
195
199
|
propsPanelSize: 'large' | 'default' | 'small';
|
|
196
200
|
/** 是否显示新增页面按钮 */
|
|
197
201
|
showAddPageButton: boolean;
|
|
202
|
+
/** 是否在页面工具栏显示呼起页面列表按钮 */
|
|
203
|
+
showPageListButton: boolean;
|
|
198
204
|
/** 是否隐藏侧边栏 */
|
|
199
205
|
hideSlideBar: boolean;
|
|
200
206
|
/** 侧边栏面板配置 */
|
|
@@ -547,18 +553,31 @@ export interface DataSourceMethodSelectConfig extends FormItem {
|
|
|
547
553
|
}
|
|
548
554
|
export interface DataSourceFieldSelectConfig extends FormItem {
|
|
549
555
|
type: 'data-source-field-select';
|
|
550
|
-
/**
|
|
556
|
+
/**
|
|
557
|
+
* 是否要编译成数据源的data。
|
|
551
558
|
* key: 不编译,就是要数据源id和field name;
|
|
552
559
|
* value: 要编译(数据源data[`${filed}`])
|
|
553
560
|
* */
|
|
554
561
|
value?: 'key' | 'value';
|
|
555
562
|
/** 是否严格的遵守父子节点不互相关联 */
|
|
556
|
-
checkStrictly?: boolean
|
|
563
|
+
checkStrictly?: boolean | ((mForm: FormState | undefined, data: {
|
|
564
|
+
model: Record<any, any>;
|
|
565
|
+
values: Record<any, any>;
|
|
566
|
+
parent?: Record<any, any>;
|
|
567
|
+
formValue: Record<any, any>;
|
|
568
|
+
prop: string;
|
|
569
|
+
config: DataSourceFieldSelectConfig;
|
|
570
|
+
dataSource?: DataSourceSchema;
|
|
571
|
+
}) => boolean);
|
|
557
572
|
dataSourceFieldType?: DataSourceFieldType[];
|
|
558
573
|
fieldConfig?: ChildConfig;
|
|
559
574
|
/** 是否可以编辑数据源,disable表示的是是否可以选择数据源 */
|
|
560
575
|
notEditable?: boolean | FilterFunction;
|
|
561
576
|
}
|
|
577
|
+
export interface CondOpSelectConfig extends FormItem {
|
|
578
|
+
type: 'cond-op';
|
|
579
|
+
parentFields?: string[];
|
|
580
|
+
}
|
|
562
581
|
/** 可新增的数据源类型选项 */
|
|
563
582
|
export interface DatasourceTypeOption {
|
|
564
583
|
/** 数据源类型 */
|
|
@@ -623,3 +642,10 @@ export type PropsFormConfigFunction = (data: {
|
|
|
623
642
|
export type PropsFormValueFunction = (data: {
|
|
624
643
|
editorService: EditorService;
|
|
625
644
|
}) => Partial<MNode>;
|
|
645
|
+
export type PartSortableOptions = Omit<Options, 'onStart' | 'onUpdate'>;
|
|
646
|
+
export interface PageBarSortOptions extends PartSortableOptions {
|
|
647
|
+
/** 在onUpdate之后调用 */
|
|
648
|
+
afterUpdate: (event: SortableEvent, sortable: Sortable) => void;
|
|
649
|
+
/** 在onStart之前调用 */
|
|
650
|
+
beforeStart: (event: SortableEvent, sortable: Sortable) => void;
|
|
651
|
+
}
|
|
@@ -7,3 +7,4 @@ export declare const getDisplayField: (dataSources: DataSourceSchema[], key: str
|
|
|
7
7
|
type: 'var' | 'text';
|
|
8
8
|
}[];
|
|
9
9
|
export declare const getCascaderOptionsFromFields: (fields?: DataSchema[], dataSourceFieldType?: DataSourceFieldType[]) => CascaderOption[];
|
|
10
|
+
export declare const removeDataSourceFieldPrefix: (id?: string) => string;
|
package/types/utils/props.d.ts
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import type { FormConfig, TabPaneConfig } from '@tmagic/form';
|
|
2
|
+
export declare const arrayOptions: {
|
|
3
|
+
text: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}[];
|
|
6
|
+
export declare const eqOptions: {
|
|
7
|
+
text: string;
|
|
8
|
+
value: string;
|
|
9
|
+
}[];
|
|
10
|
+
export declare const numberOptions: {
|
|
11
|
+
text: string;
|
|
12
|
+
value: string;
|
|
13
|
+
}[];
|
|
2
14
|
export declare const styleTabConfig: TabPaneConfig;
|
|
3
15
|
export declare const eventTabConfig: TabPaneConfig;
|
|
4
16
|
export declare const advancedTabConfig: TabPaneConfig;
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="m-fields-data-source-field-select">
|
|
3
|
-
<component
|
|
4
|
-
:is="tagName"
|
|
5
|
-
:config="showDataSourceFieldSelect || !config.fieldConfig ? cascaderConfig : config.fieldConfig"
|
|
6
|
-
:model="model"
|
|
7
|
-
:name="name"
|
|
8
|
-
:disabled="disabled"
|
|
9
|
-
:size="size"
|
|
10
|
-
:last-values="lastValues"
|
|
11
|
-
:init-values="initValues"
|
|
12
|
-
:values="values"
|
|
13
|
-
:prop="`${prop}${prop ? '.' : ''}${name}`"
|
|
14
|
-
@change="onChangeHandler"
|
|
15
|
-
></component>
|
|
16
|
-
|
|
17
|
-
<TMagicButton
|
|
18
|
-
v-if="(showDataSourceFieldSelect || !config.fieldConfig) && selectedDataSourceId && hasDataSourceSidePanel"
|
|
19
|
-
class="m-fields-select-action-button"
|
|
20
|
-
:size="size"
|
|
21
|
-
@click="editHandler(selectedDataSourceId)"
|
|
22
|
-
><MIcon :icon="!notEditable ? Edit : View"></MIcon
|
|
23
|
-
></TMagicButton>
|
|
24
|
-
|
|
25
|
-
<TMagicButton
|
|
26
|
-
v-if="config.fieldConfig"
|
|
27
|
-
style="margin-left: 5px"
|
|
28
|
-
:type="showDataSourceFieldSelect ? 'primary' : 'default'"
|
|
29
|
-
:size="size"
|
|
30
|
-
@click="showDataSourceFieldSelect = !showDataSourceFieldSelect"
|
|
31
|
-
><MIcon :icon="Coin"></MIcon
|
|
32
|
-
></TMagicButton>
|
|
33
|
-
</div>
|
|
34
|
-
</template>
|
|
35
|
-
|
|
36
|
-
<script setup lang="ts">
|
|
37
|
-
import { computed, inject, ref, resolveComponent, watch } from 'vue';
|
|
38
|
-
import { Coin, Edit, View } from '@element-plus/icons-vue';
|
|
39
|
-
|
|
40
|
-
import { TMagicButton } from '@tmagic/design';
|
|
41
|
-
import type { CascaderConfig, FieldProps, FormState } from '@tmagic/form';
|
|
42
|
-
import { filterFunction, MCascader } from '@tmagic/form';
|
|
43
|
-
import { DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX } from '@tmagic/utils';
|
|
44
|
-
|
|
45
|
-
import MIcon from '@editor/components/Icon.vue';
|
|
46
|
-
import type { DataSourceFieldSelectConfig, EventBus, Services } from '@editor/type';
|
|
47
|
-
import { SideItemKey } from '@editor/type';
|
|
48
|
-
import { getCascaderOptionsFromFields } from '@editor/utils';
|
|
49
|
-
|
|
50
|
-
defineOptions({
|
|
51
|
-
name: 'MFieldsDataSourceFieldSelect',
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const services = inject<Services>('services');
|
|
55
|
-
const eventBus = inject<EventBus>('eventBus');
|
|
56
|
-
const emit = defineEmits(['change']);
|
|
57
|
-
|
|
58
|
-
const props = withDefaults(defineProps<FieldProps<DataSourceFieldSelectConfig>>(), {
|
|
59
|
-
disabled: false,
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
const notEditable = computed(() => filterFunction(mForm, props.config.notEditable, props));
|
|
63
|
-
|
|
64
|
-
const hasDataSourceSidePanel = computed(() =>
|
|
65
|
-
(services?.uiService.get('sideBarItems') || []).find((item) => item.$key === SideItemKey.DATA_SOURCE),
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
const selectedDataSourceId = computed(() => {
|
|
69
|
-
const value = props.model[props.name];
|
|
70
|
-
if (!Array.isArray(value) || !value.length) {
|
|
71
|
-
return '';
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return value[0].replace(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, '');
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
const dataSources = computed(() => services?.dataSourceService.get('dataSources'));
|
|
78
|
-
|
|
79
|
-
const cascaderConfig = computed<CascaderConfig>(() => {
|
|
80
|
-
const valueIsKey = props.config.value === 'key';
|
|
81
|
-
|
|
82
|
-
return {
|
|
83
|
-
type: 'cascader',
|
|
84
|
-
checkStrictly: props.config.checkStrictly ?? !valueIsKey,
|
|
85
|
-
popperClass: 'm-editor-data-source-field-select-popper',
|
|
86
|
-
options: () => {
|
|
87
|
-
const options =
|
|
88
|
-
dataSources.value?.map((ds) => ({
|
|
89
|
-
label: ds.title || ds.id,
|
|
90
|
-
value: valueIsKey ? ds.id : `${DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX}${ds.id}`,
|
|
91
|
-
children: getCascaderOptionsFromFields(ds.fields, props.config.dataSourceFieldType),
|
|
92
|
-
})) || [];
|
|
93
|
-
return options.filter((option) => option.children.length);
|
|
94
|
-
},
|
|
95
|
-
};
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
const showDataSourceFieldSelect = ref(false);
|
|
99
|
-
|
|
100
|
-
watch(
|
|
101
|
-
() => props.model[props.name],
|
|
102
|
-
(value) => {
|
|
103
|
-
if (
|
|
104
|
-
Array.isArray(value) &&
|
|
105
|
-
typeof value[0] === 'string' &&
|
|
106
|
-
value[0].startsWith(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX)
|
|
107
|
-
) {
|
|
108
|
-
showDataSourceFieldSelect.value = true;
|
|
109
|
-
} else {
|
|
110
|
-
showDataSourceFieldSelect.value = false;
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
immediate: true,
|
|
115
|
-
},
|
|
116
|
-
);
|
|
117
|
-
|
|
118
|
-
const mForm = inject<FormState | undefined>('mForm');
|
|
119
|
-
|
|
120
|
-
const type = computed((): string => {
|
|
121
|
-
let type = props.config.fieldConfig?.type;
|
|
122
|
-
if (typeof type === 'function') {
|
|
123
|
-
type = type(mForm, {
|
|
124
|
-
model: props.model,
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
if (type === 'form') return '';
|
|
128
|
-
if (type === 'container') return '';
|
|
129
|
-
return type?.replace(/([A-Z])/g, '-$1').toLowerCase() || (props.config.items ? '' : 'text');
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
const tagName = computed(() => {
|
|
133
|
-
if (showDataSourceFieldSelect.value || !props.config.fieldConfig) {
|
|
134
|
-
return MCascader;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
const component = resolveComponent(`m-${props.config.items ? 'form' : 'fields'}-${type.value}`);
|
|
138
|
-
if (typeof component !== 'string') return component;
|
|
139
|
-
return 'm-fields-text';
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
const onChangeHandler = (value: any) => {
|
|
143
|
-
emit('change', value);
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
const editHandler = (id: string) => {
|
|
147
|
-
eventBus?.emit('edit-data-source', id);
|
|
148
|
-
};
|
|
149
|
-
</script>
|