@tmagic/editor 1.3.15 → 1.4.0-beta.1
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 +17 -3
- package/dist/tmagic-editor.js +875 -530
- package/dist/tmagic-editor.umd.cjs +891 -545
- package/package.json +23 -21
- package/src/Editor.vue +8 -0
- package/src/components/CodeBlockEditor.vue +50 -24
- package/src/components/FloatingBox.vue +53 -12
- package/src/fields/Code.vue +12 -10
- package/src/fields/CodeLink.vue +9 -9
- package/src/fields/CodeSelect.vue +7 -5
- package/src/fields/CodeSelectCol.vue +1 -1
- package/src/fields/DataSourceFieldSelect.vue +118 -27
- package/src/fields/DataSourceFields.vue +10 -3
- package/src/fields/DataSourceInput.vue +7 -7
- package/src/fields/DataSourceMethodSelect.vue +1 -1
- package/src/fields/DataSourceMethods.vue +3 -3
- package/src/fields/DataSourceMocks.vue +3 -3
- package/src/fields/DataSourceSelect.vue +6 -18
- package/src/fields/EventSelect.vue +1 -1
- package/src/fields/KeyValue.vue +8 -8
- package/src/fields/PageFragmentSelect.vue +1 -1
- package/src/fields/UISelect.vue +5 -5
- package/src/hooks/use-code-block-edit.ts +0 -1
- package/src/index.ts +3 -2
- package/src/layouts/NavMenu.vue +21 -2
- package/src/layouts/sidebar/Sidebar.vue +16 -1
- package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +0 -1
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +3 -0
- package/src/services/BaseService.ts +5 -2
- package/src/services/codeBlock.ts +14 -8
- package/src/services/dataSource.ts +39 -26
- package/src/services/editor.ts +46 -25
- package/src/services/events.ts +4 -4
- package/src/services/props.ts +44 -35
- package/src/services/stageOverlay.ts +14 -7
- package/src/services/storage.ts +14 -8
- package/src/services/ui.ts +20 -19
- package/src/theme/code-editor.scss +6 -0
- package/src/theme/component-list-panel.scss +79 -71
- package/src/theme/floating-box.scss +2 -0
- package/src/theme/layer-panel.scss +1 -0
- package/src/theme/sidebar.scss +6 -3
- package/src/type.ts +82 -37
- package/src/utils/operator.ts +37 -39
- package/src/utils/props.ts +174 -37
- package/types/components/CodeBlockEditor.vue.d.ts +4 -4
- package/types/components/CodeParams.vue.d.ts +5 -5
- package/types/components/ContentMenu.vue.d.ts +12 -12
- package/types/components/FloatingBox.vue.d.ts +14 -12
- package/types/components/Icon.vue.d.ts +3 -3
- package/types/components/Resizer.vue.d.ts +3 -3
- package/types/components/ScrollBar.vue.d.ts +3 -3
- package/types/components/ScrollViewer.vue.d.ts +12 -12
- package/types/components/SearchInput.vue.d.ts +1 -1
- package/types/components/SplitView.vue.d.ts +11 -11
- package/types/components/ToolButton.vue.d.ts +13 -13
- package/types/components/Tree.vue.d.ts +24 -14
- package/types/components/TreeNode.vue.d.ts +22 -12
- package/types/fields/Code.vue.d.ts +14 -14
- package/types/fields/CodeLink.vue.d.ts +6 -10
- package/types/fields/CodeSelect.vue.d.ts +14 -14
- package/types/fields/CodeSelectCol.vue.d.ts +11 -11
- package/types/fields/DataSourceFieldSelect.vue.d.ts +11 -11
- package/types/fields/DataSourceFields.vue.d.ts +11 -11
- package/types/fields/DataSourceInput.vue.d.ts +14 -18
- package/types/fields/DataSourceMethodSelect.vue.d.ts +11 -11
- package/types/fields/DataSourceMethods.vue.d.ts +11 -11
- package/types/fields/DataSourceMocks.vue.d.ts +11 -11
- package/types/fields/DataSourceSelect.vue.d.ts +13 -26
- package/types/fields/EventSelect.vue.d.ts +3 -3
- package/types/fields/KeyValue.vue.d.ts +14 -18
- package/types/fields/PageFragmentSelect.vue.d.ts +11 -11
- package/types/fields/UISelect.vue.d.ts +8 -4
- package/types/hooks/use-code-block-edit.d.ts +51 -89
- package/types/hooks/use-data-source-method.d.ts +51 -89
- package/types/hooks/use-node-status.d.ts +6 -1
- package/types/icons/AppManageIcon.vue.d.ts +1 -1
- package/types/icons/CenterIcon.vue.d.ts +1 -1
- package/types/icons/CodeIcon.vue.d.ts +1 -1
- package/types/icons/FolderMinusIcon.vue.d.ts +1 -1
- package/types/icons/PinIcon.vue.d.ts +1 -1
- package/types/icons/PinnedIcon.vue.d.ts +1 -1
- package/types/index.d.ts +1 -0
- package/types/layouts/AddPageBox.vue.d.ts +3 -3
- package/types/layouts/CodeEditor.vue.d.ts +12 -12
- package/types/layouts/Framework.vue.d.ts +9 -9
- package/types/layouts/NavMenu.vue.d.ts +11 -11
- package/types/layouts/PropsPanel.vue.d.ts +193 -243
- package/types/layouts/page-bar/AddButton.vue.d.ts +3 -3
- package/types/layouts/page-bar/PageBar.vue.d.ts +8 -8
- package/types/layouts/page-bar/PageBarScrollContainer.vue.d.ts +8 -8
- package/types/layouts/page-bar/SwitchTypeButton.vue.d.ts +3 -3
- package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +1 -1
- package/types/layouts/sidebar/Sidebar.vue.d.ts +12 -12
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +10 -10
- package/types/layouts/sidebar/code-block/CodeBlockListPanel.vue.d.ts +9 -9
- package/types/layouts/sidebar/data-source/DataSourceConfigPanel.vue.d.ts +3 -3
- package/types/layouts/sidebar/data-source/DataSourceList.vue.d.ts +3 -3
- package/types/layouts/sidebar/data-source/DataSourceListPanel.vue.d.ts +9 -9
- package/types/layouts/sidebar/layer/LayerMenu.vue.d.ts +11 -11
- package/types/layouts/sidebar/layer/LayerNodeTool.vue.d.ts +3 -3
- package/types/layouts/sidebar/layer/LayerPanel.vue.d.ts +9 -9
- package/types/layouts/sidebar/layer/use-click.d.ts +42 -76
- package/types/layouts/sidebar/layer/use-node-status.d.ts +6 -1
- package/types/layouts/workspace/Breadcrumb.vue.d.ts +1 -1
- package/types/layouts/workspace/Workspace.vue.d.ts +12 -12
- package/types/layouts/workspace/viewer/NodeListMenu.vue.d.ts +1 -1
- package/types/layouts/workspace/viewer/Stage.vue.d.ts +11 -11
- package/types/layouts/workspace/viewer/StageOverlay.vue.d.ts +1 -1
- package/types/layouts/workspace/viewer/ViewerMenu.vue.d.ts +12 -12
- package/types/services/BaseService.d.ts +5 -2
- package/types/services/codeBlock.d.ts +8 -0
- package/types/services/dataSource.d.ts +9 -2
- package/types/services/editor.d.ts +8 -1
- package/types/services/props.d.ts +15 -22
- package/types/services/stageOverlay.d.ts +8 -1
- package/types/services/storage.d.ts +8 -0
- package/types/services/ui.d.ts +15 -9
- package/types/type.d.ts +51 -32
- package/types/utils/operator.d.ts +1 -1
- package/types/utils/props.d.ts +2 -13
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { Writable } from 'type-fest';
|
|
1
2
|
import type { EventOption } from '@tmagic/core';
|
|
2
3
|
import type { FormConfig } from '@tmagic/form';
|
|
3
4
|
import type { DataSourceSchema } from '@tmagic/schema';
|
|
4
|
-
import type { DatasourceTypeOption } from '../type';
|
|
5
|
+
import type { DatasourceTypeOption, SyncHookPlugin } from '../type';
|
|
5
6
|
import BaseService from './BaseService';
|
|
6
7
|
interface State {
|
|
7
8
|
datasourceTypeList: DatasourceTypeOption[];
|
|
@@ -13,6 +14,11 @@ interface State {
|
|
|
13
14
|
methods: Record<string, EventOption[]>;
|
|
14
15
|
}
|
|
15
16
|
type StateKey = keyof State;
|
|
17
|
+
declare const canUsePluginMethods: {
|
|
18
|
+
async: never[];
|
|
19
|
+
sync: readonly ["getFormConfig", "setFormConfig", "getFormValue", "setFormValue", "getFormEvent", "setFormEvent", "getFormMethod", "setFormMethod", "add", "update", "remove", "createId"];
|
|
20
|
+
};
|
|
21
|
+
type SyncMethodName = Writable<(typeof canUsePluginMethods)['sync']>;
|
|
16
22
|
declare class DataSource extends BaseService {
|
|
17
23
|
private state;
|
|
18
24
|
constructor();
|
|
@@ -38,10 +44,11 @@ declare class DataSource extends BaseService {
|
|
|
38
44
|
};
|
|
39
45
|
update(config: DataSourceSchema): DataSourceSchema;
|
|
40
46
|
remove(id: string): void;
|
|
47
|
+
createId(): string;
|
|
41
48
|
getDataSourceById(id: string): DataSourceSchema | undefined;
|
|
42
49
|
resetState(): void;
|
|
43
50
|
destroy(): void;
|
|
44
|
-
|
|
51
|
+
usePlugin(options: SyncHookPlugin<SyncMethodName, DataSource>): void;
|
|
45
52
|
}
|
|
46
53
|
export type DataSourceService = DataSource;
|
|
47
54
|
declare const _default: DataSource;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import { Writable } from 'type-fest';
|
|
1
2
|
import type { Id, MContainer, MNode } from '@tmagic/schema';
|
|
2
3
|
import BaseService from '../services/BaseService';
|
|
3
|
-
import type { AddMNode, EditorNodeInfo, PastePosition, StepValue, StoreState, StoreStateKey } from '../type';
|
|
4
|
+
import type { AddMNode, AsyncHookPlugin, EditorNodeInfo, PastePosition, StepValue, StoreState, StoreStateKey } from '../type';
|
|
4
5
|
import { LayerOffset, Layout } from '../type';
|
|
6
|
+
declare const canUsePluginMethods: {
|
|
7
|
+
async: readonly ["getLayout", "highlight", "select", "multiSelect", "doAdd", "add", "doRemove", "remove", "doUpdate", "update", "sort", "copy", "paste", "doPaste", "doAlignCenter", "alignCenter", "moveLayer", "moveToContainer", "dragTo", "undo", "redo", "move"];
|
|
8
|
+
sync: never[];
|
|
9
|
+
};
|
|
10
|
+
type AsyncMethodName = Writable<(typeof canUsePluginMethods)['async']>;
|
|
5
11
|
declare class Editor extends BaseService {
|
|
6
12
|
state: StoreState;
|
|
7
13
|
private isHistoryStateChange;
|
|
@@ -144,6 +150,7 @@ declare class Editor extends BaseService {
|
|
|
144
150
|
resetState(): void;
|
|
145
151
|
destroy(): void;
|
|
146
152
|
resetModifiedNodeId(): void;
|
|
153
|
+
usePlugin(options: AsyncHookPlugin<AsyncMethodName, Editor>): void;
|
|
147
154
|
private addModifiedNodeId;
|
|
148
155
|
private pushHistoryState;
|
|
149
156
|
private changeHistoryState;
|
|
@@ -1,27 +1,19 @@
|
|
|
1
|
+
import { Writable } from 'type-fest';
|
|
1
2
|
import type { FormConfig } from '@tmagic/form';
|
|
2
3
|
import type { MNode } from '@tmagic/schema';
|
|
4
|
+
import type { AsyncHookPlugin, SyncHookPlugin } from '../type';
|
|
3
5
|
import BaseService from './BaseService';
|
|
6
|
+
declare const canUsePluginMethods: {
|
|
7
|
+
async: readonly ["setPropsConfig", "getPropsConfig", "setPropsValue", "getPropsValue", "fillConfig", "getDefaultPropsValue"];
|
|
8
|
+
sync: readonly ["createId", "setNewItemId"];
|
|
9
|
+
};
|
|
10
|
+
type AsyncMethodName = Writable<(typeof canUsePluginMethods)['async']>;
|
|
11
|
+
type SyncMethodName = Writable<(typeof canUsePluginMethods)['sync']>;
|
|
4
12
|
declare class Props extends BaseService {
|
|
5
13
|
private state;
|
|
6
14
|
constructor();
|
|
7
15
|
setPropsConfigs(configs: Record<string, FormConfig>): void;
|
|
8
|
-
fillConfig(config: FormConfig): Promise<
|
|
9
|
-
type: string;
|
|
10
|
-
items: {
|
|
11
|
-
[x: string]: any;
|
|
12
|
-
status?: string | undefined;
|
|
13
|
-
title: string;
|
|
14
|
-
lazy?: boolean | undefined;
|
|
15
|
-
labelWidth?: string | undefined;
|
|
16
|
-
items: FormConfig;
|
|
17
|
-
onTabClick?: ((mForm: import("@tmagic/form").FormState | undefined, tab: any, data: any) => void) | undefined;
|
|
18
|
-
}[];
|
|
19
|
-
}[]>;
|
|
20
|
-
/**
|
|
21
|
-
* 为指定类型组件设置组件属性表单配置
|
|
22
|
-
* @param type 组件类型
|
|
23
|
-
* @param config 组件属性表单配置
|
|
24
|
-
*/
|
|
16
|
+
fillConfig(config: FormConfig, labelWidth?: string): Promise<FormConfig>;
|
|
25
17
|
setPropsConfig(type: string, config: FormConfig): Promise<void>;
|
|
26
18
|
/**
|
|
27
19
|
* 获取指点类型的组件属性表单配置
|
|
@@ -41,21 +33,21 @@ declare class Props extends BaseService {
|
|
|
41
33
|
* @param type 组件类型
|
|
42
34
|
* @returns 组件初始值
|
|
43
35
|
*/
|
|
44
|
-
getPropsValue(
|
|
45
|
-
createId(type: string | number):
|
|
36
|
+
getPropsValue(componentType: string, { inputEvent, ...defaultValue }?: Record<string, any>): Promise<any>;
|
|
37
|
+
createId(type: string | number): string;
|
|
46
38
|
/**
|
|
47
39
|
* 将组件与组件的子元素配置中的id都设置成一个新的ID
|
|
48
40
|
* 如果没有相同ID并且force为false则保持不变
|
|
49
41
|
* @param {Object} config 组件配置
|
|
50
42
|
* @param {Boolean} force 是否强制设置新的ID
|
|
51
43
|
*/
|
|
52
|
-
setNewItemId(config: MNode, force?: boolean):
|
|
44
|
+
setNewItemId(config: MNode, force?: boolean): MNode;
|
|
53
45
|
/**
|
|
54
46
|
* 获取默认属性配置
|
|
55
47
|
* @param type 组件类型
|
|
56
48
|
* @returns Object
|
|
57
49
|
*/
|
|
58
|
-
getDefaultPropsValue(type: string):
|
|
50
|
+
getDefaultPropsValue(type: string): {
|
|
59
51
|
type: string;
|
|
60
52
|
layout: string;
|
|
61
53
|
style: {};
|
|
@@ -67,7 +59,7 @@ declare class Props extends BaseService {
|
|
|
67
59
|
name: string;
|
|
68
60
|
layout?: undefined;
|
|
69
61
|
items?: undefined;
|
|
70
|
-
}
|
|
62
|
+
};
|
|
71
63
|
resetState(): void;
|
|
72
64
|
/**
|
|
73
65
|
* 替换关联ID
|
|
@@ -80,6 +72,7 @@ declare class Props extends BaseService {
|
|
|
80
72
|
*/
|
|
81
73
|
clearRelateId(): void;
|
|
82
74
|
destroy(): void;
|
|
75
|
+
usePlugin(options: AsyncHookPlugin<AsyncMethodName, Props> & SyncHookPlugin<SyncMethodName, Props>): void;
|
|
83
76
|
/**
|
|
84
77
|
* 获取setNewItemId前后映射关系
|
|
85
78
|
* @param oldId 原组件ID
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import type { Writable } from 'type-fest';
|
|
1
2
|
import StageCore from '@tmagic/stage';
|
|
2
3
|
import BaseService from '../services/BaseService';
|
|
3
|
-
import type { StageOptions, StageOverlayState } from '../type';
|
|
4
|
+
import type { StageOptions, StageOverlayState, SyncHookPlugin } from '../type';
|
|
5
|
+
declare const canUsePluginMethods: {
|
|
6
|
+
async: never[];
|
|
7
|
+
sync: readonly ["openOverlay", "closeOverlay", "updateOverlay", "createStage"];
|
|
8
|
+
};
|
|
9
|
+
type SyncMethodName = Writable<(typeof canUsePluginMethods)['sync']>;
|
|
4
10
|
declare class StageOverlay extends BaseService {
|
|
5
11
|
private state;
|
|
6
12
|
constructor();
|
|
@@ -10,6 +16,7 @@ declare class StageOverlay extends BaseService {
|
|
|
10
16
|
closeOverlay(): void;
|
|
11
17
|
updateOverlay(): void;
|
|
12
18
|
createStage(stageOptions?: StageOptions): StageCore;
|
|
19
|
+
usePlugin(options: SyncHookPlugin<SyncMethodName, StageOverlay>): void;
|
|
13
20
|
private createContentEl;
|
|
14
21
|
private copyDocumentElement;
|
|
15
22
|
private render;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Writable } from 'type-fest';
|
|
2
|
+
import type { SyncHookPlugin } from '../type';
|
|
1
3
|
import BaseService from './BaseService';
|
|
2
4
|
interface Options {
|
|
3
5
|
namespace?: string;
|
|
@@ -10,6 +12,11 @@ export declare enum Protocol {
|
|
|
10
12
|
NUMBER = "number",
|
|
11
13
|
BOOLEAN = "boolean"
|
|
12
14
|
}
|
|
15
|
+
declare const canUsePluginMethods: {
|
|
16
|
+
async: never[];
|
|
17
|
+
sync: readonly ["getStorage", "getNamespace", "clear", "getItem", "removeItem", "setItem"];
|
|
18
|
+
};
|
|
19
|
+
type SyncMethodName = Writable<(typeof canUsePluginMethods)['sync']>;
|
|
13
20
|
/**
|
|
14
21
|
* 数据存储服务
|
|
15
22
|
*/
|
|
@@ -50,6 +57,7 @@ export declare class WebStorage extends BaseService {
|
|
|
50
57
|
*/
|
|
51
58
|
setItem(key: string, value: any, options?: Options): void;
|
|
52
59
|
destroy(): void;
|
|
60
|
+
usePlugin(options: SyncHookPlugin<SyncMethodName, WebStorage>): void;
|
|
53
61
|
private getValueAndProtocol;
|
|
54
62
|
}
|
|
55
63
|
export type StorageService = WebStorage;
|
package/types/services/ui.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Writable } from 'type-fest';
|
|
2
|
+
import type { AsyncHookPlugin, UiState } from '../type';
|
|
2
3
|
import BaseService from './BaseService';
|
|
4
|
+
declare const canUsePluginMethods: {
|
|
5
|
+
async: readonly ["zoom", "calcZoom"];
|
|
6
|
+
sync: readonly [];
|
|
7
|
+
};
|
|
8
|
+
type AsyncMethodName = Writable<(typeof canUsePluginMethods)['async']>;
|
|
3
9
|
declare class Ui extends BaseService {
|
|
4
10
|
constructor();
|
|
5
11
|
set<K extends keyof UiState, T extends UiState[K]>(name: K, value: T): void;
|
|
@@ -22,21 +28,21 @@ declare class Ui extends BaseService {
|
|
|
22
28
|
};
|
|
23
29
|
showGuides: boolean;
|
|
24
30
|
showRule: boolean;
|
|
25
|
-
propsPanelSize: "
|
|
31
|
+
propsPanelSize: "small" | "large" | "default";
|
|
26
32
|
showAddPageButton: boolean;
|
|
27
|
-
floatBox: Map<string, {
|
|
28
|
-
status: boolean;
|
|
29
|
-
zIndex: number;
|
|
30
|
-
top: number;
|
|
31
|
-
left: number;
|
|
32
|
-
}>;
|
|
33
33
|
hideSlideBar: boolean;
|
|
34
|
+
navMenuRect: {
|
|
35
|
+
left: number;
|
|
36
|
+
top: number;
|
|
37
|
+
width: number;
|
|
38
|
+
height: number;
|
|
39
|
+
};
|
|
34
40
|
}[K];
|
|
35
41
|
zoom(zoom: number): Promise<void>;
|
|
36
42
|
calcZoom(): Promise<number>;
|
|
37
|
-
setFloatBox(keys: string[]): Promise<void>;
|
|
38
43
|
resetState(): void;
|
|
39
44
|
destroy(): void;
|
|
45
|
+
usePlugin(options: AsyncHookPlugin<AsyncMethodName, Ui>): void;
|
|
40
46
|
private setStageRect;
|
|
41
47
|
}
|
|
42
48
|
export type UiService = Ui;
|
package/types/type.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Component } from 'vue';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
2
|
+
import type { PascalCasedProperties } from 'type-fest';
|
|
3
|
+
import type { ChildConfig, ColumnConfig, FilterFunction, FormConfig, FormItem, Input } from '@tmagic/form';
|
|
4
|
+
import type { CodeBlockContent, CodeBlockDSL, DataSourceFieldType, Id, MApp, MContainer, MNode, MPage, MPageFragment } from '@tmagic/schema';
|
|
4
5
|
import type StageCore from '@tmagic/stage';
|
|
5
6
|
import type { ContainerHighlightType, CustomizeMoveableOptionsCallbackConfig, GuidesOptions, MoveableOptions, RenderType, UpdateDragEl } from '@tmagic/stage';
|
|
6
7
|
import type { CodeBlockService } from './services/codeBlock';
|
|
@@ -59,6 +60,7 @@ export interface DataSourceListSlots {
|
|
|
59
60
|
'data-source-panel-tool'(props: {
|
|
60
61
|
data: any;
|
|
61
62
|
}): any;
|
|
63
|
+
'data-source-panel-search'(props: {}): any;
|
|
62
64
|
}
|
|
63
65
|
export interface LayerNodeSlots {
|
|
64
66
|
'layer-node-content'(props: {
|
|
@@ -190,15 +192,14 @@ export interface UiState {
|
|
|
190
192
|
propsPanelSize: 'large' | 'default' | 'small';
|
|
191
193
|
/** 是否显示新增页面按钮 */
|
|
192
194
|
showAddPageButton: boolean;
|
|
193
|
-
/** slide 拖拽悬浮窗 state */
|
|
194
|
-
floatBox: Map<string, {
|
|
195
|
-
status: boolean;
|
|
196
|
-
zIndex: number;
|
|
197
|
-
top: number;
|
|
198
|
-
left: number;
|
|
199
|
-
}>;
|
|
200
195
|
/** 是否隐藏侧边栏 */
|
|
201
196
|
hideSlideBar: boolean;
|
|
197
|
+
navMenuRect: {
|
|
198
|
+
left: number;
|
|
199
|
+
top: number;
|
|
200
|
+
width: number;
|
|
201
|
+
height: number;
|
|
202
|
+
};
|
|
202
203
|
}
|
|
203
204
|
export interface EditorNodeInfo {
|
|
204
205
|
node: MNode | null;
|
|
@@ -505,39 +506,40 @@ export interface KeyBindingCacheItem {
|
|
|
505
506
|
eventType: 'keyup' | 'keydown';
|
|
506
507
|
bound: boolean;
|
|
507
508
|
}
|
|
508
|
-
export interface CodeSelectColConfig {
|
|
509
|
+
export interface CodeSelectColConfig extends FormItem {
|
|
509
510
|
type: 'code-select-col';
|
|
510
|
-
|
|
511
|
-
text: string;
|
|
512
|
-
labelWidth?: number | string;
|
|
513
|
-
disabled?: boolean | FilterFunction;
|
|
511
|
+
/** 是否可以编辑代码块,disable表示的是是否可以选择代码块 */
|
|
514
512
|
notEditable?: boolean | FilterFunction;
|
|
515
|
-
display?: boolean | FilterFunction;
|
|
516
513
|
}
|
|
517
|
-
export interface PageFragmentSelectConfig {
|
|
514
|
+
export interface PageFragmentSelectConfig extends FormItem {
|
|
518
515
|
type: 'page-fragment-select';
|
|
519
|
-
name: string;
|
|
520
|
-
text: string;
|
|
521
|
-
labelWidth?: number | string;
|
|
522
|
-
disabled?: boolean | FilterFunction;
|
|
523
|
-
display?: boolean | FilterFunction;
|
|
524
516
|
}
|
|
525
|
-
export interface
|
|
517
|
+
export interface DataSourceSelect extends FormItem, Input {
|
|
518
|
+
type: 'data-source-select';
|
|
519
|
+
/** 数据源类型: base、http... */
|
|
520
|
+
dataSourceType?: string;
|
|
521
|
+
/** 是否要编译成数据源的data。
|
|
522
|
+
* id: 不编译,就是要数据源id;
|
|
523
|
+
* value: 要编译(数据源data)
|
|
524
|
+
* */
|
|
525
|
+
value?: 'id' | 'value';
|
|
526
|
+
}
|
|
527
|
+
export interface DataSourceMethodSelectConfig extends FormItem {
|
|
526
528
|
type: 'data-source-method-select';
|
|
527
|
-
|
|
528
|
-
text: string;
|
|
529
|
-
labelWidth?: number | string;
|
|
530
|
-
disabled?: boolean | FilterFunction;
|
|
529
|
+
/** 是否可以编辑数据源,disable表示的是是否可以选择数据源 */
|
|
531
530
|
notEditable?: boolean | FilterFunction;
|
|
532
|
-
display?: boolean | FilterFunction;
|
|
533
531
|
}
|
|
534
|
-
export interface DataSourceFieldSelectConfig {
|
|
532
|
+
export interface DataSourceFieldSelectConfig extends FormItem {
|
|
535
533
|
type: 'data-source-field-select';
|
|
536
|
-
|
|
534
|
+
/** 是否要编译成数据源的data。
|
|
535
|
+
* key: 不编译,就是要数据源id和field name;
|
|
536
|
+
* value: 要编译(数据源data[`${filed}`])
|
|
537
|
+
* */
|
|
537
538
|
value?: 'key' | 'value';
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
539
|
+
/** 是否严格的遵守父子节点不互相关联 */
|
|
540
|
+
checkStrictly?: boolean;
|
|
541
|
+
dataSourceFieldType?: DataSourceFieldType[];
|
|
542
|
+
fieldConfig?: ChildConfig;
|
|
541
543
|
}
|
|
542
544
|
/** 可新增的数据源类型选项 */
|
|
543
545
|
export interface DatasourceTypeOption {
|
|
@@ -572,3 +574,20 @@ export interface TreeNodeData {
|
|
|
572
574
|
items?: TreeNodeData[];
|
|
573
575
|
[key: string]: any;
|
|
574
576
|
}
|
|
577
|
+
export type AsyncBeforeHook<Value extends Array<string>, C extends Record<Value[number], (...args: any) => any>> = {
|
|
578
|
+
[K in Value[number]]?: (...args: Parameters<C[K]>) => Promise<Parameters<C[K]>> | Parameters<C[K]>;
|
|
579
|
+
};
|
|
580
|
+
export type AsyncAfterHook<Value extends Array<string>, C extends Record<Value[number], (...args: any) => any>> = {
|
|
581
|
+
[K in Value[number]]?: (result: Awaited<ReturnType<C[K]>>, ...args: Parameters<C[K]>) => ReturnType<C[K]> | Awaited<ReturnType<C[K]>>;
|
|
582
|
+
};
|
|
583
|
+
export type SyncBeforeHook<Value extends Array<string>, C extends Record<Value[number], (...args: any) => any>> = {
|
|
584
|
+
[K in Value[number]]?: (...args: Parameters<C[K]>) => Parameters<C[K]>;
|
|
585
|
+
};
|
|
586
|
+
export type SyncAfterHook<Value extends Array<string>, C extends Record<Value[number], (...args: any) => any>> = {
|
|
587
|
+
[K in Value[number]]?: (result: ReturnType<C[K]>, ...args: Parameters<C[K]>) => ReturnType<C[K]>;
|
|
588
|
+
};
|
|
589
|
+
export type AddPrefixToObject<T, P extends string> = {
|
|
590
|
+
[K in keyof T as K extends string ? `${P}${K}` : never]: T[K];
|
|
591
|
+
};
|
|
592
|
+
export type AsyncHookPlugin<T extends Array<string>, C extends Record<T[number], (...args: any) => any>> = AddPrefixToObject<PascalCasedProperties<AsyncBeforeHook<T, C>>, 'before'> & AddPrefixToObject<PascalCasedProperties<AsyncAfterHook<T, C>>, 'after'>;
|
|
593
|
+
export type SyncHookPlugin<T extends Array<string>, C extends Record<T[number], (...args: any) => any>> = AddPrefixToObject<PascalCasedProperties<SyncBeforeHook<T, C>>, 'before'> & AddPrefixToObject<PascalCasedProperties<SyncAfterHook<T, C>>, 'after'>;
|
|
@@ -6,7 +6,7 @@ import type { AddMNode, PastePosition } from '../type';
|
|
|
6
6
|
* @param config 待粘贴的元素配置(复制时保存的那份配置)
|
|
7
7
|
* @returns
|
|
8
8
|
*/
|
|
9
|
-
export declare const beforePaste: (position: PastePosition, config: MNode[]) =>
|
|
9
|
+
export declare const beforePaste: (position: PastePosition, config: MNode[]) => MNode[];
|
|
10
10
|
/**
|
|
11
11
|
* 将元素粘贴到容器内时,将相对于画布坐标转换为相对于容器的坐标
|
|
12
12
|
* @param position PastePosition 粘贴时相对于画布的坐标
|
package/types/utils/props.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FormConfig,
|
|
1
|
+
import type { FormConfig, TabPaneConfig } from '@tmagic/form';
|
|
2
2
|
export declare const styleTabConfig: TabPaneConfig;
|
|
3
3
|
export declare const eventTabConfig: TabPaneConfig;
|
|
4
4
|
export declare const advancedTabConfig: TabPaneConfig;
|
|
@@ -8,15 +8,4 @@ export declare const displayTabConfig: TabPaneConfig;
|
|
|
8
8
|
* @param config 组件属性配置
|
|
9
9
|
* @returns Object
|
|
10
10
|
*/
|
|
11
|
-
export declare const fillConfig: (config?: FormConfig) =>
|
|
12
|
-
type: string;
|
|
13
|
-
items: {
|
|
14
|
-
[x: string]: any;
|
|
15
|
-
status?: string | undefined;
|
|
16
|
-
title: string;
|
|
17
|
-
lazy?: boolean | undefined;
|
|
18
|
-
labelWidth?: string | undefined;
|
|
19
|
-
items: FormConfig;
|
|
20
|
-
onTabClick?: ((mForm: FormState | undefined, tab: any, data: any) => void) | undefined;
|
|
21
|
-
}[];
|
|
22
|
-
}[];
|
|
11
|
+
export declare const fillConfig: (config?: FormConfig, labelWidth?: string) => FormConfig;
|