@tmagic/editor 1.3.0-beta.2 → 1.3.0-beta.4
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 +52 -60
- package/dist/tmagic-editor.js +1634 -1065
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +1659 -1087
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +10 -10
- package/src/Editor.vue +70 -65
- package/src/components/ContentMenu.vue +5 -1
- package/src/components/SearchInput.vue +5 -1
- package/src/editorProps.ts +51 -129
- package/src/fields/Code.vue +9 -3
- package/src/fields/DataSourceFieldSelect.vue +28 -16
- package/src/fields/DataSourceFields.vue +95 -7
- package/src/fields/DataSourceMethodSelect.vue +23 -14
- package/src/fields/DataSourceMocks.vue +237 -0
- package/src/fields/EventSelect.vue +18 -11
- package/src/index.ts +4 -1
- package/src/initService.ts +50 -20
- package/src/layouts/CodeEditor.vue +20 -4
- package/src/layouts/Framework.vue +3 -1
- package/src/layouts/PropsPanel.vue +3 -1
- package/src/layouts/sidebar/ComponentListPanel.vue +18 -8
- package/src/layouts/sidebar/Sidebar.vue +7 -10
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +3 -1
- package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +3 -1
- package/src/layouts/sidebar/layer/LayerNode.vue +206 -0
- package/src/layouts/sidebar/layer/LayerNodeTool.vue +32 -0
- package/src/layouts/sidebar/layer/LayerPanel.vue +85 -0
- package/src/layouts/sidebar/layer/use-drag.ts +157 -0
- package/src/layouts/sidebar/layer/use-filter.ts +70 -0
- package/src/layouts/sidebar/layer/use-keybinding.ts +47 -0
- package/src/layouts/sidebar/layer/use-node-status.ts +103 -0
- package/src/layouts/workspace/Workspace.vue +3 -1
- package/src/layouts/workspace/viewer/NodeListMenu.vue +1 -1
- package/src/layouts/workspace/viewer/Stage.vue +19 -17
- package/src/services/dataSource.ts +10 -0
- package/src/services/editor.ts +45 -5
- package/src/theme/common/var.scss +2 -2
- package/src/theme/framework.scss +2 -0
- package/src/theme/layer-panel.scss +63 -63
- package/src/theme/props-panel.scss +8 -0
- package/src/theme/sidebar.scss +1 -5
- package/src/type.ts +60 -0
- package/src/utils/data-source/index.ts +11 -0
- package/src/utils/dep.ts +26 -11
- package/src/utils/editor.ts +14 -3
- package/src/utils/props.ts +3 -0
- package/types/editorProps.d.ts +61 -107
- package/types/fields/Code.vue.d.ts +10 -6
- package/types/fields/DataSourceMocks.vue.d.ts +32 -0
- package/types/index.d.ts +2 -1
- package/types/initService.d.ts +5 -4
- package/types/layouts/CodeEditor.vue.d.ts +5 -0
- package/types/layouts/Framework.vue.d.ts +2 -12
- package/types/layouts/PropsPanel.vue.d.ts +2 -3
- package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +2 -7
- package/types/layouts/sidebar/Sidebar.vue.d.ts +2 -17
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +2 -7
- package/types/layouts/sidebar/code-block/CodeBlockListPanel.vue.d.ts +2 -9
- package/types/layouts/sidebar/{LayerMenu.vue.d.ts → layer/LayerMenu.vue.d.ts} +1 -1
- package/types/layouts/sidebar/layer/LayerNode.vue.d.ts +50 -0
- package/types/layouts/sidebar/{LayerNode.vue.d.ts → layer/LayerNodeTool.vue.d.ts} +1 -1
- package/types/layouts/sidebar/{LayerPanel.vue.d.ts → layer/LayerPanel.vue.d.ts} +2 -8
- package/types/layouts/sidebar/layer/use-drag.d.ts +14 -0
- package/types/layouts/sidebar/layer/use-filter.d.ts +8 -0
- package/types/layouts/sidebar/layer/use-keybinding.d.ts +4 -0
- package/types/layouts/sidebar/layer/use-node-status.d.ts +7 -0
- package/types/layouts/workspace/Workspace.vue.d.ts +2 -11
- package/types/layouts/workspace/viewer/Stage.vue.d.ts +1 -1
- package/types/services/dataSource.d.ts +3 -0
- package/types/services/editor.d.ts +1 -0
- package/types/type.d.ts +60 -0
- package/types/utils/dep.d.ts +1 -1
- package/types/utils/editor.d.ts +3 -2
- package/src/layouts/sidebar/LayerNode.vue +0 -40
- package/src/layouts/sidebar/LayerPanel.vue +0 -369
- package/types/Editor.vue.d.ts +0 -233
- /package/src/layouts/sidebar/{LayerMenu.vue → layer/LayerMenu.vue} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
$--theme-color: #2882e0;
|
|
2
2
|
|
|
3
|
-
$--font-color: #
|
|
3
|
+
$--font-color: #313a40;
|
|
4
4
|
$--border-color: #d9dbdd;
|
|
5
5
|
$--hover-color: #f3f5f9;
|
|
6
6
|
|
|
7
7
|
$--nav-height: 35px;
|
|
8
|
-
$--nav-color: #
|
|
8
|
+
$--nav-color: #313a40;
|
|
9
9
|
$--nav--background-color: #ffffff;
|
|
10
10
|
|
|
11
11
|
$--sidebar-heder-background-color: $--theme-color;
|
package/src/theme/framework.scss
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
1
|
.magic-editor-layer-panel {
|
|
2
|
+
$--node-height: 22px;
|
|
3
|
+
|
|
2
4
|
background: $--sidebar-content-background-color;
|
|
3
5
|
|
|
4
6
|
.magic-editor-layer-tree {
|
|
5
7
|
padding-top: 48px;
|
|
6
|
-
|
|
8
|
+
background-color: $--sidebar-content-background-color;
|
|
9
|
+
color: $--font-color;
|
|
10
|
+
font-size: 13px;
|
|
7
11
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
display: flex;
|
|
11
|
-
width: 100%;
|
|
12
|
-
> div {
|
|
13
|
-
width: 8px;
|
|
14
|
-
}
|
|
15
|
-
> span {
|
|
16
|
-
width: calc(100% - 68px);
|
|
17
|
-
white-space: nowrap;
|
|
18
|
-
overflow: hidden;
|
|
19
|
-
text-overflow: ellipsis;
|
|
20
|
-
}
|
|
21
|
-
> i {
|
|
22
|
-
margin-right: 10px;
|
|
23
|
-
font-size: 20px;
|
|
24
|
-
&.lock {
|
|
25
|
-
color: #bbb;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
.magic-editor-layer-panel,
|
|
31
|
-
.magic-editor-layer-panel .el-tree {
|
|
32
|
-
background-color: $--sidebar-content-background-color;
|
|
33
|
-
color: #313a40;
|
|
34
|
-
}
|
|
12
|
+
.magic-editor-layer-node {
|
|
13
|
+
cursor: pointer;
|
|
35
14
|
|
|
36
|
-
.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
> .el-tree-node__content {
|
|
40
|
-
background-color: $--sidebar-heder-background-color;
|
|
41
|
-
color: #fff;
|
|
42
|
-
}
|
|
15
|
+
.layer-node {
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
43
18
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
justify-content: space-between;
|
|
19
|
+
&:hover {
|
|
20
|
+
background-color: $--hover-color;
|
|
21
|
+
color: $--font-color;
|
|
22
|
+
}
|
|
49
23
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
24
|
+
&.selected {
|
|
25
|
+
background-color: $--theme-color;
|
|
26
|
+
color: $--hover-color;
|
|
27
|
+
}
|
|
54
28
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
29
|
+
&.drag-inner {
|
|
30
|
+
.layer-node-content {
|
|
31
|
+
background-color: rgba($color: $--theme-color, $alpha: 0.5);
|
|
32
|
+
color: $--hover-color;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
59
35
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
36
|
+
&.drag-before {
|
|
37
|
+
.layer-node-content {
|
|
38
|
+
border-top-color: rgba($color: $--theme-color, $alpha: 0.5);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&.drag-after {
|
|
43
|
+
.layer-node-content {
|
|
44
|
+
border-bottom-color: rgba($color: $--theme-color, $alpha: 0.5);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.expand-icon {
|
|
49
|
+
padding: 4px;
|
|
50
|
+
box-sizing: content-box;
|
|
51
|
+
font-size: 14px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.layer-node-content {
|
|
55
|
+
display: flex;
|
|
56
|
+
flex: 1;
|
|
57
|
+
justify-content: space-between;
|
|
58
|
+
height: $--node-height;
|
|
59
|
+
border-top: 2px solid transparent;
|
|
60
|
+
border-bottom: 2px solid transparent;
|
|
61
|
+
.layer-node-label {
|
|
62
|
+
line-height: $--node-height;
|
|
63
|
+
flex: 1;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.layer-node-tool {
|
|
68
|
+
margin-right: 15px;
|
|
69
|
+
display: flex;
|
|
70
|
+
align-items: center;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
75
|
}
|
package/src/theme/sidebar.scss
CHANGED
package/src/type.ts
CHANGED
|
@@ -41,6 +41,54 @@ import type { StorageService } from './services/storage';
|
|
|
41
41
|
import type { UiService } from './services/ui';
|
|
42
42
|
import type { UndoRedo } from './utils/undo-redo';
|
|
43
43
|
|
|
44
|
+
export interface FrameworkSlots {
|
|
45
|
+
header(props: {}): any;
|
|
46
|
+
nav(props: {}): any;
|
|
47
|
+
'content-before'(props: {}): any;
|
|
48
|
+
'content-after'(props: {}): any;
|
|
49
|
+
'src-code'(props: {}): any;
|
|
50
|
+
sidebar(props: {}): any;
|
|
51
|
+
empty(props: {}): any;
|
|
52
|
+
workspace(props: {}): any;
|
|
53
|
+
'props-panel'(props: {}): any;
|
|
54
|
+
'footer'(props: {}): any;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface WorkspaceSlots {
|
|
58
|
+
stage(props: {}): any;
|
|
59
|
+
'workspace-content'(props: {}): any;
|
|
60
|
+
'page-bar-title'(props: { page: MPage }): any;
|
|
61
|
+
'page-bar-popover'(props: { page: MPage }): any;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface ComponentListPanelSlots {
|
|
65
|
+
'component-list-panel-header'(props: {}): any;
|
|
66
|
+
'component-list-item'(props: { component: ComponentItem }): any;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface CodeBlockListPanelSlots extends CodeBlockListSlots {
|
|
70
|
+
'code-block-panel-search'(props: {}): any;
|
|
71
|
+
'code-block-panel-header'(props: {}): any;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface CodeBlockListSlots {
|
|
75
|
+
'code-block-panel-tool'(props: { id: Id; data: CodeBlockContent }): any;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface LayerNodeSlots {
|
|
79
|
+
'layer-node-content'(props: { data: MNode }): any;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface LayerPanelSlots extends LayerNodeSlots {
|
|
83
|
+
'layer-panel-header'(props: {}): any;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface PropsPanelSlots {
|
|
87
|
+
'props-panel-header'(props: {}): any;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export type SidebarSlots = LayerPanelSlots & CodeBlockListPanelSlots & ComponentListPanelSlots;
|
|
91
|
+
|
|
44
92
|
export type BeforeAdd = (config: MNode, parent: MContainer) => Promise<MNode> | MNode;
|
|
45
93
|
export type GetConfig = (config: FormConfig) => Promise<FormConfig> | FormConfig;
|
|
46
94
|
|
|
@@ -507,6 +555,7 @@ export interface DataSourceMethodSelectConfig {
|
|
|
507
555
|
export interface DataSourceFieldSelectConfig {
|
|
508
556
|
type: 'data-source-field-select';
|
|
509
557
|
name: string;
|
|
558
|
+
value?: 'key' | 'value';
|
|
510
559
|
labelWidth?: number | string;
|
|
511
560
|
disabled?: boolean | FilterFunction;
|
|
512
561
|
display?: boolean | FilterFunction;
|
|
@@ -528,3 +577,14 @@ export interface DatasourceTypeOption {
|
|
|
528
577
|
type: string;
|
|
529
578
|
text: string;
|
|
530
579
|
}
|
|
580
|
+
|
|
581
|
+
export interface LayerNodeStatus {
|
|
582
|
+
visible: boolean;
|
|
583
|
+
expand: boolean;
|
|
584
|
+
selected: boolean;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
export enum DragType {
|
|
588
|
+
COMPONENT_LIST = 'component-list',
|
|
589
|
+
LAYER_TREE = 'layer-tree',
|
|
590
|
+
}
|
|
@@ -41,6 +41,17 @@ const fillConfig = (config: FormConfig): FormConfig => [
|
|
|
41
41
|
},
|
|
42
42
|
],
|
|
43
43
|
},
|
|
44
|
+
{
|
|
45
|
+
type: 'panel',
|
|
46
|
+
title: 'mock数据',
|
|
47
|
+
items: [
|
|
48
|
+
{
|
|
49
|
+
name: 'mocks',
|
|
50
|
+
type: 'data-source-mocks',
|
|
51
|
+
defaultValue: () => [],
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
},
|
|
44
55
|
];
|
|
45
56
|
|
|
46
57
|
export const getFormConfig = (type: string, configs: Record<string, FormConfig>): FormConfig => {
|
package/src/utils/dep.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { isEmpty } from 'lodash-es';
|
|
2
2
|
|
|
3
|
-
import { CodeBlockContent, HookType, Id } from '@tmagic/schema';
|
|
3
|
+
import { type CodeBlockContent, HookType, type Id } from '@tmagic/schema';
|
|
4
|
+
import { DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX } from '@tmagic/utils';
|
|
4
5
|
|
|
5
6
|
import dataSourceService from '@editor/services/dataSource';
|
|
6
7
|
import { Target } from '@editor/services/dep';
|
|
7
|
-
import { DepTargetType, HookData } from '@editor/type';
|
|
8
|
+
import { DepTargetType, type HookData } from '@editor/type';
|
|
8
9
|
|
|
9
10
|
export const createCodeBlockTarget = (id: Id, codeBlock: CodeBlockContent) =>
|
|
10
11
|
new Target({
|
|
@@ -29,22 +30,36 @@ export const createDataSourceTarget = (id: Id) =>
|
|
|
29
30
|
new Target({
|
|
30
31
|
type: DepTargetType.DATA_SOURCE,
|
|
31
32
|
id,
|
|
32
|
-
isTarget: (key: string | number, value: any) =>
|
|
33
|
+
isTarget: (key: string | number, value: any) => {
|
|
33
34
|
// 关联数据源对象或者在模板在使用数据源
|
|
34
|
-
(value?.isBindDataSource && value.dataSourceId) || (typeof value === 'string' && value.includes(`${id}`))
|
|
35
|
+
if ((value?.isBindDataSource && value.dataSourceId) || (typeof value === 'string' && value.includes(`${id}`))) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// 关联数据源字段,格式为 [前缀+数据源ID, 字段名]
|
|
40
|
+
if (!Array.isArray(value) || typeof value[0] !== 'string') {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const [prefixId] = value;
|
|
45
|
+
const prefixIndex = prefixId.indexOf(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX);
|
|
46
|
+
|
|
47
|
+
if (prefixIndex === -1) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const dsId = prefixId.substring(prefixIndex + DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX.length);
|
|
52
|
+
|
|
53
|
+
return dsId === id && Boolean(dataSourceService.getDataSourceById(id));
|
|
54
|
+
},
|
|
35
55
|
});
|
|
36
56
|
|
|
37
57
|
export const createDataSourceCondTarget = (id: string) =>
|
|
38
58
|
new Target({
|
|
39
59
|
type: DepTargetType.DATA_SOURCE_COND,
|
|
40
60
|
id,
|
|
41
|
-
isTarget: (key: string | number, value: any) =>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const ds = dataSourceService.getDataSourceById(id);
|
|
45
|
-
|
|
46
|
-
return Boolean(ds?.fields?.find((field) => field.name === value[1]));
|
|
47
|
-
},
|
|
61
|
+
isTarget: (key: string | number, value: any) =>
|
|
62
|
+
Array.isArray(value) && value[0] === id && Boolean(dataSourceService.getDataSourceById(id)),
|
|
48
63
|
});
|
|
49
64
|
|
|
50
65
|
export const createDataSourceMethodTarget = (id: string) =>
|
package/src/utils/editor.ts
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
import serialize from 'serialize-javascript';
|
|
20
20
|
|
|
21
|
-
import type { MApp, MContainer, MNode, MPage } from '@tmagic/schema';
|
|
21
|
+
import type { Id, MApp, MContainer, MNode, MPage } from '@tmagic/schema';
|
|
22
22
|
import { NodeType } from '@tmagic/schema';
|
|
23
23
|
import type StageCore from '@tmagic/stage';
|
|
24
24
|
import { getNodePath, isNumber, isPage, isPop } from '@tmagic/utils';
|
|
@@ -77,9 +77,9 @@ export const generatePageNameByApp = (app: MApp): string => generatePageName(get
|
|
|
77
77
|
*/
|
|
78
78
|
export const isFixed = (node: MNode): boolean => node.style?.position === 'fixed';
|
|
79
79
|
|
|
80
|
-
export const getNodeIndex = (
|
|
80
|
+
export const getNodeIndex = (id: Id, parent: MContainer | MApp): number => {
|
|
81
81
|
const items = parent?.items || [];
|
|
82
|
-
return items.findIndex((item: MNode) => `${item.id}` === `${
|
|
82
|
+
return items.findIndex((item: MNode) => `${item.id}` === `${id}`);
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
export const getRelativeStyle = (style: Record<string, any> = {}): Record<string, any> => ({
|
|
@@ -251,3 +251,14 @@ export const serializeConfig = (config: any) =>
|
|
|
251
251
|
space: 2,
|
|
252
252
|
unsafe: true,
|
|
253
253
|
}).replace(/"(\w+)":\s/g, '$1: ');
|
|
254
|
+
|
|
255
|
+
export const traverseNode = (node: MNode, cb: (node: MNode, parents: MNode[]) => void, parents: MNode[] = []) => {
|
|
256
|
+
cb(node, parents);
|
|
257
|
+
|
|
258
|
+
if (node.items?.length) {
|
|
259
|
+
parents.push(node);
|
|
260
|
+
node.items.forEach((item: MNode) => {
|
|
261
|
+
traverseNode(item, cb, parents);
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
};
|
package/src/utils/props.ts
CHANGED
|
@@ -237,6 +237,8 @@ export const displayTabConfig: TabPaneConfig = {
|
|
|
237
237
|
{
|
|
238
238
|
type: 'groupList',
|
|
239
239
|
name: 'displayConds',
|
|
240
|
+
titlePrefix: '条件组',
|
|
241
|
+
expandAll: true,
|
|
240
242
|
items: [
|
|
241
243
|
{
|
|
242
244
|
type: 'table',
|
|
@@ -245,6 +247,7 @@ export const displayTabConfig: TabPaneConfig = {
|
|
|
245
247
|
{
|
|
246
248
|
type: 'data-source-field-select',
|
|
247
249
|
name: 'field',
|
|
250
|
+
value: 'key',
|
|
248
251
|
label: '字段',
|
|
249
252
|
},
|
|
250
253
|
{
|
package/types/editorProps.d.ts
CHANGED
|
@@ -1,127 +1,81 @@
|
|
|
1
|
-
import type { PropType } from 'vue';
|
|
2
1
|
import type { EventOption } from '@tmagic/core';
|
|
3
2
|
import type { FormConfig, FormState } from '@tmagic/form';
|
|
4
|
-
import type { DataSourceSchema, MApp, MNode } from '@tmagic/schema';
|
|
3
|
+
import type { DataSourceSchema, Id, MApp, MNode } from '@tmagic/schema';
|
|
5
4
|
import StageCore, { ContainerHighlightType, CustomizeMoveableOptionsCallbackConfig, MoveableOptions, UpdateDragEl } from '@tmagic/stage';
|
|
6
5
|
import type { ComponentGroup, DatasourceTypeOption, MenuBarData, MenuButton, MenuComponent, SideBarData, StageRect } from './type';
|
|
7
|
-
|
|
6
|
+
export interface EditorProps {
|
|
8
7
|
/** 页面初始值 */
|
|
9
|
-
modelValue
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/** 左侧面板中的组件列表 */
|
|
15
|
-
componentGroupList: {
|
|
16
|
-
type: PropType<ComponentGroup[]>;
|
|
17
|
-
default: () => never[];
|
|
18
|
-
};
|
|
19
|
-
/** 左侧面板中的组件列表 */
|
|
20
|
-
datasourceList: {
|
|
21
|
-
type: PropType<DatasourceTypeOption[]>;
|
|
22
|
-
default: () => never[];
|
|
23
|
-
};
|
|
8
|
+
modelValue?: MApp;
|
|
9
|
+
/** 左侧面板中的组件类型列表 */
|
|
10
|
+
componentGroupList?: ComponentGroup[];
|
|
11
|
+
/** 左侧面板中的数据源类型列表 */
|
|
12
|
+
datasourceList?: DatasourceTypeOption[];
|
|
24
13
|
/** 左侧面板配置 */
|
|
25
|
-
sidebar
|
|
26
|
-
type: PropType<SideBarData>;
|
|
27
|
-
};
|
|
14
|
+
sidebar?: SideBarData;
|
|
28
15
|
/** 顶部工具栏配置 */
|
|
29
|
-
menu
|
|
30
|
-
type: PropType<MenuBarData>;
|
|
31
|
-
default: () => {
|
|
32
|
-
left: never[];
|
|
33
|
-
right: never[];
|
|
34
|
-
};
|
|
35
|
-
};
|
|
16
|
+
menu?: MenuBarData;
|
|
36
17
|
/** 组件树右键菜单 */
|
|
37
|
-
layerContentMenu
|
|
38
|
-
type: PropType<(MenuButton | MenuComponent)[]>;
|
|
39
|
-
default: () => never[];
|
|
40
|
-
};
|
|
18
|
+
layerContentMenu?: (MenuButton | MenuComponent)[];
|
|
41
19
|
/** 画布右键菜单 */
|
|
42
|
-
stageContentMenu
|
|
43
|
-
type: PropType<(MenuButton | MenuComponent)[]>;
|
|
44
|
-
default: () => never[];
|
|
45
|
-
};
|
|
20
|
+
stageContentMenu?: (MenuButton | MenuComponent)[];
|
|
46
21
|
/** 中间工作区域中画布渲染的内容 */
|
|
47
|
-
render:
|
|
48
|
-
type: PropType<(stage: StageCore) => HTMLDivElement | Promise<HTMLDivElement>>;
|
|
49
|
-
};
|
|
22
|
+
render?: (stage: StageCore) => HTMLDivElement | Promise<HTMLDivElement>;
|
|
50
23
|
/** 中间工作区域中画布通过iframe渲染时的页面url */
|
|
51
|
-
runtimeUrl
|
|
24
|
+
runtimeUrl?: string;
|
|
52
25
|
/** 选中时是否自动滚动到可视区域 */
|
|
53
|
-
autoScrollIntoView
|
|
26
|
+
autoScrollIntoView?: boolean;
|
|
54
27
|
/** 组件的属性配置表单的dsl */
|
|
55
|
-
propsConfigs
|
|
56
|
-
type: PropType<Record<string, FormConfig>>;
|
|
57
|
-
default: () => {};
|
|
58
|
-
};
|
|
28
|
+
propsConfigs?: Record<string, FormConfig>;
|
|
59
29
|
/** 添加组件时的默认值 */
|
|
60
|
-
propsValues
|
|
61
|
-
type: PropType<Record<string, Partial<MNode>>>;
|
|
62
|
-
default: () => {};
|
|
63
|
-
};
|
|
30
|
+
propsValues?: Record<string, Partial<MNode>>;
|
|
64
31
|
/** 组件联动事件选项列表 */
|
|
65
|
-
eventMethodList
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}>>;
|
|
70
|
-
default: () => {};
|
|
71
|
-
};
|
|
32
|
+
eventMethodList?: Record<string, {
|
|
33
|
+
events: EventOption[];
|
|
34
|
+
methods: EventOption[];
|
|
35
|
+
}>;
|
|
72
36
|
/** 添加数据源时的默认值 */
|
|
73
|
-
datasourceValues
|
|
74
|
-
type: PropType<Record<string, Partial<DataSourceSchema>>>;
|
|
75
|
-
default: () => {};
|
|
76
|
-
};
|
|
37
|
+
datasourceValues?: Record<string, Partial<DataSourceSchema>>;
|
|
77
38
|
/** 数据源的属性配置表单的dsl */
|
|
78
|
-
datasourceConfigs
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
39
|
+
datasourceConfigs?: Record<string, FormConfig>;
|
|
40
|
+
datasourceEventMethodList?: Record<string, {
|
|
41
|
+
events: EventOption[];
|
|
42
|
+
methods: EventOption[];
|
|
43
|
+
}>;
|
|
82
44
|
/** 画布中组件选中框的移动范围 */
|
|
83
|
-
moveableOptions
|
|
84
|
-
type: PropType<MoveableOptions | ((config?: CustomizeMoveableOptionsCallbackConfig) => MoveableOptions)>;
|
|
85
|
-
};
|
|
45
|
+
moveableOptions?: MoveableOptions | ((config?: CustomizeMoveableOptionsCallbackConfig) => MoveableOptions);
|
|
86
46
|
/** 编辑器初始化时默认选中的组件ID */
|
|
87
|
-
defaultSelected
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
type: BooleanConstructor;
|
|
122
|
-
};
|
|
123
|
-
extendFormState: {
|
|
124
|
-
type: PropType<(state: FormState) => Record<string, any> | Promise<Record<string, any>>>;
|
|
125
|
-
};
|
|
47
|
+
defaultSelected?: Id;
|
|
48
|
+
canSelect?: (el: HTMLElement) => boolean | Promise<boolean>;
|
|
49
|
+
isContainer?: (el: HTMLElement) => boolean | Promise<boolean>;
|
|
50
|
+
containerHighlightClassName?: string;
|
|
51
|
+
containerHighlightDuration?: number;
|
|
52
|
+
containerHighlightType?: ContainerHighlightType;
|
|
53
|
+
stageRect?: StageRect;
|
|
54
|
+
codeOptions?: {
|
|
55
|
+
[key: string]: any;
|
|
56
|
+
};
|
|
57
|
+
updateDragEl?: UpdateDragEl;
|
|
58
|
+
disabledDragStart?: boolean;
|
|
59
|
+
extendFormState?: (state: FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
60
|
+
}
|
|
61
|
+
export declare const defaultEditorProps: {
|
|
62
|
+
componentGroupList: () => never[];
|
|
63
|
+
datasourceList: () => never[];
|
|
64
|
+
menu: () => {
|
|
65
|
+
left: never[];
|
|
66
|
+
right: never[];
|
|
67
|
+
};
|
|
68
|
+
layerContentMenu: () => never[];
|
|
69
|
+
stageContentMenu: () => never[];
|
|
70
|
+
propsConfigs: () => {};
|
|
71
|
+
propsValues: () => {};
|
|
72
|
+
eventMethodList: () => {};
|
|
73
|
+
datasourceValues: () => {};
|
|
74
|
+
datasourceConfigs: () => {};
|
|
75
|
+
canSelect: (el: HTMLElement) => boolean;
|
|
76
|
+
isContainer: (el: HTMLElement) => boolean;
|
|
77
|
+
containerHighlightClassName: string;
|
|
78
|
+
containerHighlightDuration: number;
|
|
79
|
+
containerHighlightType: ContainerHighlightType;
|
|
80
|
+
codeOptions: () => {};
|
|
126
81
|
};
|
|
127
|
-
export default _default;
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import type { FieldProps } from '@tmagic/form';
|
|
2
2
|
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<FieldProps<{
|
|
3
3
|
language?: string | undefined;
|
|
4
|
-
options?:
|
|
4
|
+
options?: {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
} | undefined;
|
|
5
7
|
height?: string | undefined;
|
|
8
|
+
parse?: boolean | undefined;
|
|
6
9
|
}>>, {
|
|
7
10
|
disabled: boolean;
|
|
8
|
-
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
11
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<FieldProps<{
|
|
9
12
|
language?: string | undefined;
|
|
10
|
-
options?:
|
|
13
|
+
options?: {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
} | undefined;
|
|
11
16
|
height?: string | undefined;
|
|
17
|
+
parse?: boolean | undefined;
|
|
12
18
|
}>>, {
|
|
13
19
|
disabled: boolean;
|
|
14
|
-
}
|
|
15
|
-
onChange?: ((...args: any[]) => any) | undefined;
|
|
16
|
-
}, {
|
|
20
|
+
}>>>, {
|
|
17
21
|
disabled: boolean;
|
|
18
22
|
}, {}>;
|
|
19
23
|
export default _default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type FieldProps } from '@tmagic/form';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<FieldProps<{
|
|
3
|
+
type: "data-source-mocks";
|
|
4
|
+
}>>, {
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "change"[], "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<FieldProps<{
|
|
7
|
+
type: "data-source-mocks";
|
|
8
|
+
}>>, {
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
}>>> & {
|
|
11
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
disabled: boolean;
|
|
14
|
+
}, {}>;
|
|
15
|
+
export default _default;
|
|
16
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
17
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
18
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
19
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
20
|
+
} : {
|
|
21
|
+
type: import('vue').PropType<T[K]>;
|
|
22
|
+
required: true;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
type __VLS_WithDefaults<P, D> = {
|
|
26
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
27
|
+
default: D[K];
|
|
28
|
+
}> : P[K];
|
|
29
|
+
};
|
|
30
|
+
type __VLS_Prettify<T> = {
|
|
31
|
+
[K in keyof T]: T[K];
|
|
32
|
+
} & {};
|
package/types/index.d.ts
CHANGED
|
@@ -18,10 +18,11 @@ export { default as uiService } from './services/ui';
|
|
|
18
18
|
export { default as codeBlockService } from './services/codeBlock';
|
|
19
19
|
export { default as depService } from './services/dep';
|
|
20
20
|
export { default as ComponentListPanel } from './layouts/sidebar/ComponentListPanel.vue';
|
|
21
|
-
export { default as LayerPanel } from './layouts/sidebar/LayerPanel.vue';
|
|
21
|
+
export { default as LayerPanel } from './layouts/sidebar/layer/LayerPanel.vue';
|
|
22
22
|
export { default as CodeSelect } from './fields/CodeSelect.vue';
|
|
23
23
|
export { default as CodeSelectCol } from './fields/CodeSelectCol.vue';
|
|
24
24
|
export { default as DataSourceFields } from './fields/DataSourceFields.vue';
|
|
25
|
+
export { default as DataSourceMocks } from './fields/DataSourceMocks.vue';
|
|
25
26
|
export { default as DataSourceMethods } from './fields/DataSourceMethods.vue';
|
|
26
27
|
export { default as DataSourceInput } from './fields/DataSourceInput.vue';
|
|
27
28
|
export { default as DataSourceSelect } from './fields/DataSourceSelect.vue';
|