@tmagic/editor 1.4.15 → 1.5.0-beta.0
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 +2 -2
- package/dist/tmagic-editor.js +274 -265
- package/dist/tmagic-editor.umd.cjs +275 -262
- package/package.json +13 -17
- package/src/components/CodeParams.vue +1 -1
- package/src/editorProps.ts +2 -1
- package/src/fields/DataSourceInput.vue +2 -2
- package/src/fields/UISelect.vue +20 -15
- package/src/hooks/use-stage.ts +13 -7
- package/src/initService.ts +50 -53
- package/src/layouts/workspace/viewer/NodeListMenu.vue +2 -1
- package/src/layouts/workspace/viewer/Stage.vue +4 -3
- package/src/services/editor.ts +2 -2
- package/src/services/stageOverlay.ts +3 -1
- package/src/theme/page-bar.scss +2 -2
- package/src/utils/data-source/index.ts +25 -23
- package/src/utils/editor.ts +4 -3
- package/src/utils/index.ts +4 -0
- package/src/utils/operator.ts +3 -2
- package/src/utils/props.ts +2 -1
- package/types/index.d.ts +6484 -49
- package/src/shims-vue.d.ts +0 -6
- package/types/components/CodeBlockEditor.vue.d.ts +0 -33
- package/types/components/CodeParams.vue.d.ts +0 -28
- package/types/components/ContentMenu.vue.d.ts +0 -73
- package/types/components/FloatingBox.vue.d.ts +0 -68
- package/types/components/Icon.vue.d.ts +0 -15
- package/types/components/Resizer.vue.d.ts +0 -14
- package/types/components/ScrollBar.vue.d.ts +0 -25
- package/types/components/ScrollViewer.vue.d.ts +0 -79
- package/types/components/SearchInput.vue.d.ts +0 -6
- package/types/components/SplitView.vue.d.ts +0 -70
- package/types/components/ToolButton.vue.d.ts +0 -41
- package/types/components/Tree.vue.d.ts +0 -81
- package/types/components/TreeNode.vue.d.ts +0 -81
- package/types/editorProps.d.ts +0 -111
- package/types/fields/Code.vue.d.ts +0 -44
- package/types/fields/CodeLink.vue.d.ts +0 -24
- package/types/fields/CodeSelect.vue.d.ts +0 -28
- package/types/fields/CodeSelectCol.vue.d.ts +0 -31
- package/types/fields/CondOpSelect.vue.d.ts +0 -17
- package/types/fields/DataSourceFieldSelect/FieldSelect.vue.d.ts +0 -36
- package/types/fields/DataSourceFieldSelect/Index.vue.d.ts +0 -31
- package/types/fields/DataSourceFields.vue.d.ts +0 -44
- package/types/fields/DataSourceInput.vue.d.ts +0 -34
- package/types/fields/DataSourceMethodSelect.vue.d.ts +0 -31
- package/types/fields/DataSourceMethods.vue.d.ts +0 -34
- package/types/fields/DataSourceMocks.vue.d.ts +0 -41
- package/types/fields/DataSourceSelect.vue.d.ts +0 -31
- package/types/fields/DisplayConds.vue.d.ts +0 -37
- package/types/fields/EventSelect.vue.d.ts +0 -17
- package/types/fields/KeyValue.vue.d.ts +0 -36
- package/types/fields/PageFragmentSelect.vue.d.ts +0 -31
- package/types/fields/UISelect.vue.d.ts +0 -20
- package/types/hooks/index.d.ts +0 -6
- package/types/hooks/use-code-block-edit.d.ts +0 -100
- package/types/hooks/use-data-source-edit.d.ts +0 -93
- package/types/hooks/use-data-source-method.d.ts +0 -98
- package/types/hooks/use-editor-content-height.d.ts +0 -3
- package/types/hooks/use-filter.d.ts +0 -7
- package/types/hooks/use-float-box.d.ts +0 -15
- package/types/hooks/use-getso.d.ts +0 -5
- package/types/hooks/use-next-float-box-position.d.ts +0 -9
- package/types/hooks/use-node-status.d.ts +0 -11
- package/types/hooks/use-stage.d.ts +0 -3
- package/types/hooks/use-window-rect.d.ts +0 -6
- package/types/icons/AppManageIcon.vue.d.ts +0 -2
- package/types/icons/CenterIcon.vue.d.ts +0 -2
- package/types/icons/CodeIcon.vue.d.ts +0 -2
- package/types/icons/FolderMinusIcon.vue.d.ts +0 -2
- package/types/icons/PinIcon.vue.d.ts +0 -2
- package/types/icons/PinnedIcon.vue.d.ts +0 -2
- package/types/initService.d.ts +0 -9
- package/types/layouts/AddPageBox.vue.d.ts +0 -15
- package/types/layouts/CodeEditor.vue.d.ts +0 -80
- package/types/layouts/Framework.vue.d.ts +0 -23
- package/types/layouts/NavMenu.vue.d.ts +0 -35
- package/types/layouts/PropsPanel.vue.d.ts +0 -284
- package/types/layouts/page-bar/AddButton.vue.d.ts +0 -16
- package/types/layouts/page-bar/PageBar.vue.d.ts +0 -34
- package/types/layouts/page-bar/PageBarScrollContainer.vue.d.ts +0 -27
- package/types/layouts/page-bar/PageList.vue.d.ts +0 -25
- package/types/layouts/page-bar/SwitchTypeButton.vue.d.ts +0 -20
- package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +0 -8
- package/types/layouts/sidebar/Sidebar.vue.d.ts +0 -49
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +0 -30
- package/types/layouts/sidebar/code-block/CodeBlockListPanel.vue.d.ts +0 -22
- package/types/layouts/sidebar/data-source/DataSourceConfigPanel.vue.d.ts +0 -31
- package/types/layouts/sidebar/data-source/DataSourceList.vue.d.ts +0 -16
- package/types/layouts/sidebar/data-source/DataSourceListPanel.vue.d.ts +0 -8
- package/types/layouts/sidebar/layer/LayerMenu.vue.d.ts +0 -41
- package/types/layouts/sidebar/layer/LayerNodeTool.vue.d.ts +0 -16
- package/types/layouts/sidebar/layer/LayerPanel.vue.d.ts +0 -23
- package/types/layouts/sidebar/layer/use-click.d.ts +0 -64
- package/types/layouts/sidebar/layer/use-drag.d.ts +0 -14
- package/types/layouts/sidebar/layer/use-keybinding.d.ts +0 -6
- package/types/layouts/sidebar/layer/use-node-status.d.ts +0 -11
- package/types/layouts/workspace/Breadcrumb.vue.d.ts +0 -2
- package/types/layouts/workspace/Workspace.vue.d.ts +0 -39
- package/types/layouts/workspace/viewer/NodeListMenu.vue.d.ts +0 -2
- package/types/layouts/workspace/viewer/Stage.vue.d.ts +0 -34
- package/types/layouts/workspace/viewer/StageOverlay.vue.d.ts +0 -2
- package/types/layouts/workspace/viewer/ViewerMenu.vue.d.ts +0 -42
- package/types/services/BaseService.d.ts +0 -66
- package/types/services/codeBlock.d.ts +0 -130
- package/types/services/componentList.d.ts +0 -16
- package/types/services/dataSource.d.ts +0 -68
- package/types/services/dep.d.ts +0 -33
- package/types/services/editor.d.ts +0 -180
- package/types/services/events.d.ts +0 -18
- package/types/services/history.d.ts +0 -26
- package/types/services/keybinding.d.ts +0 -40
- package/types/services/props.d.ts +0 -92
- package/types/services/stageOverlay.d.ts +0 -30
- package/types/services/storage.d.ts +0 -65
- package/types/services/ui.d.ts +0 -77
- package/types/type.d.ts +0 -658
- package/types/utils/compose.d.ts +0 -5
- package/types/utils/config.d.ts +0 -4
- package/types/utils/content-menu.d.ts +0 -7
- package/types/utils/data-source/formConfigs/base.d.ts +0 -2
- package/types/utils/data-source/formConfigs/http.d.ts +0 -3
- package/types/utils/data-source/index.d.ts +0 -10
- package/types/utils/editor.d.ts +0 -59
- package/types/utils/idle-task.d.ts +0 -14
- package/types/utils/index.d.ts +0 -6
- package/types/utils/keybinding-config.d.ts +0 -7
- package/types/utils/logger.d.ts +0 -5
- package/types/utils/monaco-editor.d.ts +0 -2
- package/types/utils/operator.d.ts +0 -21
- package/types/utils/props.d.ts +0 -23
- package/types/utils/scroll-viewer.d.ts +0 -38
- package/types/utils/tree.d.ts +0 -3
- package/types/utils/undo-redo.d.ts +0 -12
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { Writable } from 'type-fest';
|
|
2
|
-
import { type TargetOptions } from '@tmagic/dep';
|
|
3
|
-
import type { Id, MContainer, MNode, MPage, MPageFragment } from '@tmagic/schema';
|
|
4
|
-
import BaseService from '../services/BaseService';
|
|
5
|
-
import type { AddMNode, AsyncHookPlugin, EditorNodeInfo, PastePosition, StepValue, StoreState, StoreStateKey } from '../type';
|
|
6
|
-
import { LayerOffset, Layout } from '../type';
|
|
7
|
-
export interface EditorEvents {
|
|
8
|
-
'root-change': [value: StoreState['root'], preValue?: StoreState['root']];
|
|
9
|
-
select: [node: MNode | null];
|
|
10
|
-
add: [nodes: MNode[]];
|
|
11
|
-
remove: [nodes: MNode[]];
|
|
12
|
-
update: [nodes: MNode[]];
|
|
13
|
-
'move-layer': [offset: number | LayerOffset];
|
|
14
|
-
'drag-to': [data: {
|
|
15
|
-
targetIndex: number;
|
|
16
|
-
configs: MNode | MNode[];
|
|
17
|
-
targetParent: MContainer;
|
|
18
|
-
}];
|
|
19
|
-
'history-change': [data: MPage | MPageFragment];
|
|
20
|
-
}
|
|
21
|
-
declare const canUsePluginMethods: {
|
|
22
|
-
async: readonly ["getLayout", "highlight", "select", "multiSelect", "doAdd", "add", "doRemove", "remove", "doUpdate", "update", "sort", "copy", "paste", "doPaste", "doAlignCenter", "alignCenter", "moveLayer", "moveToContainer", "dragTo", "undo", "redo", "move"];
|
|
23
|
-
sync: never[];
|
|
24
|
-
};
|
|
25
|
-
type AsyncMethodName = Writable<(typeof canUsePluginMethods)['async']>;
|
|
26
|
-
declare class Editor extends BaseService {
|
|
27
|
-
state: StoreState;
|
|
28
|
-
private isHistoryStateChange;
|
|
29
|
-
constructor();
|
|
30
|
-
/**
|
|
31
|
-
* 设置当前指点节点配置
|
|
32
|
-
* @param name 'root' | 'page' | 'parent' | 'node' | 'highlightNode' | 'nodes' | 'stage' | 'modifiedNodeIds' | 'pageLength' | 'pageFragmentLength
|
|
33
|
-
* @param value MNode
|
|
34
|
-
*/
|
|
35
|
-
set<K extends StoreStateKey, T extends StoreState[K]>(name: K, value: T): void;
|
|
36
|
-
/**
|
|
37
|
-
* 获取当前指点节点配置
|
|
38
|
-
* @param name 'root' | 'page' | 'parent' | 'node' | 'highlightNode' | 'nodes' | 'stage' | 'modifiedNodeIds' | 'pageLength' | 'pageFragmentLength'
|
|
39
|
-
* @returns MNode
|
|
40
|
-
*/
|
|
41
|
-
get<K extends StoreStateKey>(name: K): StoreState[K];
|
|
42
|
-
/**
|
|
43
|
-
* 根据id获取组件、组件的父组件以及组件所属的页面节点
|
|
44
|
-
* @param {number | string} id 组件id
|
|
45
|
-
* @param {boolean} raw 是否使用toRaw
|
|
46
|
-
* @returns {EditorNodeInfo}
|
|
47
|
-
*/
|
|
48
|
-
getNodeInfo(id: Id, raw?: boolean): EditorNodeInfo;
|
|
49
|
-
/**
|
|
50
|
-
* 根据ID获取指点节点配置
|
|
51
|
-
* @param id 组件ID
|
|
52
|
-
* @param {boolean} raw 是否使用toRaw
|
|
53
|
-
* @returns 组件节点配置
|
|
54
|
-
*/
|
|
55
|
-
getNodeById(id: Id, raw?: boolean): MNode | null;
|
|
56
|
-
/**
|
|
57
|
-
* 根据ID获取指点节点的父节点配置
|
|
58
|
-
* @param id 组件ID
|
|
59
|
-
* @param {boolean} raw 是否使用toRaw
|
|
60
|
-
* @returns 指点组件的父节点配置
|
|
61
|
-
*/
|
|
62
|
-
getParentById(id: Id, raw?: boolean): MContainer | null;
|
|
63
|
-
/**
|
|
64
|
-
* 只有容器拥有布局
|
|
65
|
-
*/
|
|
66
|
-
getLayout(parent: MNode, node?: MNode | null): Promise<Layout>;
|
|
67
|
-
/**
|
|
68
|
-
* 选中指定节点(将指定节点设置成当前选中状态)
|
|
69
|
-
* @param config 指定节点配置或者ID
|
|
70
|
-
* @returns 当前选中的节点配置
|
|
71
|
-
*/
|
|
72
|
-
select(config: MNode | Id): Promise<MNode> | never;
|
|
73
|
-
selectNextNode(): Promise<MNode | null> | never;
|
|
74
|
-
selectNextPage(): Promise<MNode> | never;
|
|
75
|
-
/**
|
|
76
|
-
* 高亮指定节点
|
|
77
|
-
* @param config 指定节点配置或者ID
|
|
78
|
-
* @returns 当前高亮的节点配置
|
|
79
|
-
*/
|
|
80
|
-
highlight(config: MNode | Id): void;
|
|
81
|
-
/**
|
|
82
|
-
* 多选
|
|
83
|
-
* @param ids 指定节点ID
|
|
84
|
-
* @returns 加入多选的节点配置
|
|
85
|
-
*/
|
|
86
|
-
multiSelect(ids: Id[]): void;
|
|
87
|
-
selectRoot(): void;
|
|
88
|
-
doAdd(node: MNode, parent: MContainer): Promise<MNode>;
|
|
89
|
-
/**
|
|
90
|
-
* 向指点容器添加组件节点
|
|
91
|
-
* @param addConfig 将要添加的组件节点配置
|
|
92
|
-
* @param parent 要添加到的容器组件节点配置,如果不设置,默认为当前选中的组件的父节点
|
|
93
|
-
* @returns 添加后的节点
|
|
94
|
-
*/
|
|
95
|
-
add(addNode: AddMNode | MNode[], parent?: MContainer | null): Promise<MNode | MNode[]>;
|
|
96
|
-
doRemove(node: MNode): Promise<void>;
|
|
97
|
-
/**
|
|
98
|
-
* 删除组件
|
|
99
|
-
* @param {Object} node
|
|
100
|
-
*/
|
|
101
|
-
remove(nodeOrNodeList: MNode | MNode[]): Promise<void>;
|
|
102
|
-
doUpdate(config: MNode): Promise<MNode>;
|
|
103
|
-
/**
|
|
104
|
-
* 更新节点
|
|
105
|
-
* @param config 新的节点配置,配置中需要有id信息
|
|
106
|
-
* @returns 更新后的节点配置
|
|
107
|
-
*/
|
|
108
|
-
update(config: MNode | MNode[]): Promise<MNode | MNode[]>;
|
|
109
|
-
/**
|
|
110
|
-
* 将id为id1的组件移动到id为id2的组件位置上,例如:[1,2,3,4] -> sort(1,3) -> [2,1,3,4]
|
|
111
|
-
* @param id1 组件ID
|
|
112
|
-
* @param id2 组件ID
|
|
113
|
-
* @returns void
|
|
114
|
-
*/
|
|
115
|
-
sort(id1: Id, id2: Id): Promise<void>;
|
|
116
|
-
/**
|
|
117
|
-
* 将组件节点配置存储到localStorage中
|
|
118
|
-
* @param config 组件节点配置
|
|
119
|
-
* @returns
|
|
120
|
-
*/
|
|
121
|
-
copy(config: MNode | MNode[]): void;
|
|
122
|
-
/**
|
|
123
|
-
* 复制时会带上组件关联的依赖
|
|
124
|
-
* @param config 组件节点配置
|
|
125
|
-
* @returns
|
|
126
|
-
*/
|
|
127
|
-
copyWithRelated(config: MNode | MNode[], collectorOptions?: TargetOptions): void;
|
|
128
|
-
/**
|
|
129
|
-
* 从localStorage中获取节点,然后添加到当前容器中
|
|
130
|
-
* @param position 粘贴的坐标
|
|
131
|
-
* @returns 添加后的组件节点配置
|
|
132
|
-
*/
|
|
133
|
-
paste(position?: PastePosition, collectorOptions?: TargetOptions): Promise<MNode | MNode[] | void>;
|
|
134
|
-
doPaste(config: MNode[], position?: PastePosition): Promise<MNode[]>;
|
|
135
|
-
doAlignCenter(config: MNode): Promise<MNode>;
|
|
136
|
-
/**
|
|
137
|
-
* 将指点节点设置居中
|
|
138
|
-
* @param config 组件节点配置
|
|
139
|
-
* @returns 当前组件节点配置
|
|
140
|
-
*/
|
|
141
|
-
alignCenter(config: MNode | MNode[]): Promise<MNode | MNode[]>;
|
|
142
|
-
/**
|
|
143
|
-
* 移动当前选中节点位置
|
|
144
|
-
* @param offset 偏移量
|
|
145
|
-
*/
|
|
146
|
-
moveLayer(offset: number | LayerOffset): Promise<void>;
|
|
147
|
-
/**
|
|
148
|
-
* 移动到指定容器中
|
|
149
|
-
* @param config 需要移动的节点
|
|
150
|
-
* @param targetId 容器ID
|
|
151
|
-
*/
|
|
152
|
-
moveToContainer(config: MNode, targetId: Id): Promise<MNode | undefined>;
|
|
153
|
-
dragTo(config: MNode | MNode[], targetParent: MContainer, targetIndex: number): Promise<void>;
|
|
154
|
-
/**
|
|
155
|
-
* 撤销当前操作
|
|
156
|
-
* @returns 上一次数据
|
|
157
|
-
*/
|
|
158
|
-
undo(): Promise<StepValue | null>;
|
|
159
|
-
/**
|
|
160
|
-
* 恢复到下一步
|
|
161
|
-
* @returns 下一步数据
|
|
162
|
-
*/
|
|
163
|
-
redo(): Promise<StepValue | null>;
|
|
164
|
-
move(left: number, top: number): Promise<void>;
|
|
165
|
-
resetState(): void;
|
|
166
|
-
destroy(): void;
|
|
167
|
-
resetModifiedNodeId(): void;
|
|
168
|
-
usePlugin(options: AsyncHookPlugin<AsyncMethodName, Editor>): void;
|
|
169
|
-
on<Name extends keyof EditorEvents, Param extends EditorEvents[Name]>(eventName: Name, listener: (...args: Param) => void | Promise<void>): this;
|
|
170
|
-
once<Name extends keyof EditorEvents, Param extends EditorEvents[Name]>(eventName: Name, listener: (...args: Param) => void | Promise<void>): this;
|
|
171
|
-
emit<Name extends keyof EditorEvents, Param extends EditorEvents[Name]>(eventName: Name, ...args: Param): boolean;
|
|
172
|
-
private addModifiedNodeId;
|
|
173
|
-
private pushHistoryState;
|
|
174
|
-
private changeHistoryState;
|
|
175
|
-
private toggleFixedPosition;
|
|
176
|
-
private selectedConfigExceptionHandler;
|
|
177
|
-
}
|
|
178
|
-
export type EditorService = Editor;
|
|
179
|
-
declare const _default: Editor;
|
|
180
|
-
export default _default;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { EventOption } from '@tmagic/core';
|
|
2
|
-
import type { ComponentGroup } from '../type';
|
|
3
|
-
import BaseService from './BaseService';
|
|
4
|
-
declare class Events extends BaseService {
|
|
5
|
-
constructor();
|
|
6
|
-
init(componentGroupList: ComponentGroup[]): void;
|
|
7
|
-
setEvents(events: Record<string, EventOption[]>): void;
|
|
8
|
-
setEvent(type: string, events: EventOption[]): void;
|
|
9
|
-
getEvent(type: string): EventOption[];
|
|
10
|
-
setMethods(methods: Record<string, EventOption[]>): void;
|
|
11
|
-
setMethod(type: string, method: EventOption[]): void;
|
|
12
|
-
getMethod(type: string): EventOption[];
|
|
13
|
-
resetState(): void;
|
|
14
|
-
destroy(): void;
|
|
15
|
-
}
|
|
16
|
-
export type EventsService = Events;
|
|
17
|
-
declare const _default: Events;
|
|
18
|
-
export default _default;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { MPage, MPageFragment } from '@tmagic/schema';
|
|
2
|
-
import type { StepValue } from '../type';
|
|
3
|
-
import { UndoRedo } from '../utils/undo-redo';
|
|
4
|
-
import BaseService from './BaseService';
|
|
5
|
-
declare class History extends BaseService {
|
|
6
|
-
state: {
|
|
7
|
-
pageId?: import("@tmagic/schema").Id | undefined;
|
|
8
|
-
pageSteps: Record<import("@tmagic/schema").Id, UndoRedo<StepValue>>;
|
|
9
|
-
canRedo: boolean;
|
|
10
|
-
canUndo: boolean;
|
|
11
|
-
};
|
|
12
|
-
constructor();
|
|
13
|
-
reset(): void;
|
|
14
|
-
resetPage(): void;
|
|
15
|
-
changePage(page: MPage | MPageFragment): void;
|
|
16
|
-
resetState(): void;
|
|
17
|
-
push(state: StepValue): StepValue | null;
|
|
18
|
-
undo(): StepValue | null;
|
|
19
|
-
redo(): StepValue | null;
|
|
20
|
-
destroy(): void;
|
|
21
|
-
private getUndoRedo;
|
|
22
|
-
private setCanUndoRedo;
|
|
23
|
-
}
|
|
24
|
-
export type HistoryService = History;
|
|
25
|
-
declare const _default: History;
|
|
26
|
-
export default _default;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { KeyBindingItem } from '../type';
|
|
2
|
-
import BaseService from './BaseService';
|
|
3
|
-
declare class Keybinding extends BaseService {
|
|
4
|
-
ctrlKey: string;
|
|
5
|
-
private controllers;
|
|
6
|
-
private bindingList;
|
|
7
|
-
private commands;
|
|
8
|
-
registerCommand(command: string, handler: (e: KeyboardEvent) => void | Promise<void>): void;
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated
|
|
11
|
-
*/
|
|
12
|
-
registeCommand(command: string, handler: (e: KeyboardEvent) => void | Promise<void>): void;
|
|
13
|
-
unregisterCommand(command: string): void;
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated
|
|
16
|
-
*/
|
|
17
|
-
unregisteCommand(command: string): void;
|
|
18
|
-
registerEl(name: string, el?: HTMLElement): void;
|
|
19
|
-
/**
|
|
20
|
-
* @deprecated
|
|
21
|
-
*/
|
|
22
|
-
registeEl(name: string, el?: HTMLElement): void;
|
|
23
|
-
unregisterEl(name: string): void;
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated
|
|
26
|
-
*/
|
|
27
|
-
unregisteEl(name: string): void;
|
|
28
|
-
register(maps: KeyBindingItem[]): void;
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated
|
|
31
|
-
*/
|
|
32
|
-
registe(map: KeyBindingItem[]): void;
|
|
33
|
-
reset(): void;
|
|
34
|
-
destroy(): void;
|
|
35
|
-
private bind;
|
|
36
|
-
private getKeyconKeys;
|
|
37
|
-
}
|
|
38
|
-
export type KeybindingService = Keybinding;
|
|
39
|
-
declare const _default: Keybinding;
|
|
40
|
-
export default _default;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { Writable } from 'type-fest';
|
|
2
|
-
import { type TargetOptions } from '@tmagic/dep';
|
|
3
|
-
import type { FormConfig } from '@tmagic/form';
|
|
4
|
-
import type { MNode } from '@tmagic/schema';
|
|
5
|
-
import type { AsyncHookPlugin, PropsFormConfigFunction, PropsFormValueFunction, SyncHookPlugin } from '../type';
|
|
6
|
-
import BaseService from './BaseService';
|
|
7
|
-
declare const canUsePluginMethods: {
|
|
8
|
-
async: readonly ["setPropsConfig", "getPropsConfig", "setPropsValue", "getPropsValue", "fillConfig", "getDefaultPropsValue"];
|
|
9
|
-
sync: readonly ["createId", "setNewItemId"];
|
|
10
|
-
};
|
|
11
|
-
type AsyncMethodName = Writable<(typeof canUsePluginMethods)['async']>;
|
|
12
|
-
type SyncMethodName = Writable<(typeof canUsePluginMethods)['sync']>;
|
|
13
|
-
declare class Props extends BaseService {
|
|
14
|
-
private state;
|
|
15
|
-
constructor();
|
|
16
|
-
setPropsConfigs(configs: Record<string, FormConfig | PropsFormConfigFunction>): void;
|
|
17
|
-
fillConfig(config: FormConfig, labelWidth?: string): Promise<FormConfig>;
|
|
18
|
-
setPropsConfig(type: string, config: FormConfig | PropsFormConfigFunction): Promise<void>;
|
|
19
|
-
/**
|
|
20
|
-
* 获取指点类型的组件属性表单配置
|
|
21
|
-
* @param type 组件类型
|
|
22
|
-
* @returns 组件属性表单配置
|
|
23
|
-
*/
|
|
24
|
-
getPropsConfig(type: string): Promise<FormConfig>;
|
|
25
|
-
setPropsValues(values: Record<string, Partial<MNode> | PropsFormValueFunction>): void;
|
|
26
|
-
/**
|
|
27
|
-
* 为指点类型组件设置组件初始值
|
|
28
|
-
* @param type 组件类型
|
|
29
|
-
* @param value 组件初始值
|
|
30
|
-
*/
|
|
31
|
-
setPropsValue(type: string, value: Partial<MNode> | PropsFormValueFunction): Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* 获取指定类型的组件初始值
|
|
34
|
-
* @param type 组件类型
|
|
35
|
-
* @returns 组件初始值
|
|
36
|
-
*/
|
|
37
|
-
getPropsValue(componentType: string, { inputEvent, ...defaultValue }?: Record<string, any>): Promise<any>;
|
|
38
|
-
createId(type: string | number): string;
|
|
39
|
-
/**
|
|
40
|
-
* 将组件与组件的子元素配置中的id都设置成一个新的ID
|
|
41
|
-
* 如果没有相同ID并且force为false则保持不变
|
|
42
|
-
* @param {Object} config 组件配置
|
|
43
|
-
* @param {Boolean} force 是否强制设置新的ID
|
|
44
|
-
*/
|
|
45
|
-
setNewItemId(config: MNode, force?: boolean): MNode;
|
|
46
|
-
/**
|
|
47
|
-
* 获取默认属性配置
|
|
48
|
-
* @param type 组件类型
|
|
49
|
-
* @returns Object
|
|
50
|
-
*/
|
|
51
|
-
getDefaultPropsValue(type: string): {
|
|
52
|
-
type: string;
|
|
53
|
-
layout: string;
|
|
54
|
-
style: {};
|
|
55
|
-
name: string;
|
|
56
|
-
items: never[];
|
|
57
|
-
} | {
|
|
58
|
-
type: string;
|
|
59
|
-
style: {};
|
|
60
|
-
name: string;
|
|
61
|
-
layout?: undefined;
|
|
62
|
-
items?: undefined;
|
|
63
|
-
};
|
|
64
|
-
resetState(): void;
|
|
65
|
-
/**
|
|
66
|
-
* 替换关联ID
|
|
67
|
-
* @param originConfigs 原组件配置
|
|
68
|
-
* @param targetConfigs 待替换的组件配置
|
|
69
|
-
*/
|
|
70
|
-
replaceRelateId(originConfigs: MNode[], targetConfigs: MNode[], collectorOptions: TargetOptions): void;
|
|
71
|
-
/**
|
|
72
|
-
* 清除setNewItemId前后映射关系
|
|
73
|
-
*/
|
|
74
|
-
clearRelateId(): void;
|
|
75
|
-
destroy(): void;
|
|
76
|
-
usePlugin(options: AsyncHookPlugin<AsyncMethodName, Props> & SyncHookPlugin<SyncMethodName, Props>): void;
|
|
77
|
-
/**
|
|
78
|
-
* 获取setNewItemId前后映射关系
|
|
79
|
-
* @param oldId 原组件ID
|
|
80
|
-
* @returns 新旧ID映射
|
|
81
|
-
*/
|
|
82
|
-
private getRelateIdMap;
|
|
83
|
-
/**
|
|
84
|
-
* 记录setNewItemId前后映射关系
|
|
85
|
-
* @param oldId 原组件ID
|
|
86
|
-
* @param newId 分配的新ID
|
|
87
|
-
*/
|
|
88
|
-
private setRelateId;
|
|
89
|
-
}
|
|
90
|
-
export type PropsService = Props;
|
|
91
|
-
declare const _default: Props;
|
|
92
|
-
export default _default;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Writable } from 'type-fest';
|
|
2
|
-
import StageCore from '@tmagic/stage';
|
|
3
|
-
import BaseService from '../services/BaseService';
|
|
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']>;
|
|
10
|
-
declare class StageOverlay extends BaseService {
|
|
11
|
-
private state;
|
|
12
|
-
constructor();
|
|
13
|
-
get<K extends keyof StageOverlayState>(name: K): StageOverlayState[K];
|
|
14
|
-
set<K extends keyof StageOverlayState, T extends StageOverlayState[K]>(name: K, value: T): void;
|
|
15
|
-
openOverlay(el: HTMLElement | null): void;
|
|
16
|
-
closeOverlay(): void;
|
|
17
|
-
updateOverlay(): void;
|
|
18
|
-
createStage(stageOptions?: StageOptions): StageCore;
|
|
19
|
-
usePlugin(options: SyncHookPlugin<SyncMethodName, StageOverlay>): void;
|
|
20
|
-
private createContentEl;
|
|
21
|
-
private copyDocumentElement;
|
|
22
|
-
private render;
|
|
23
|
-
private updateHandler;
|
|
24
|
-
private addHandler;
|
|
25
|
-
private removeHandler;
|
|
26
|
-
private updateSelectStatus;
|
|
27
|
-
}
|
|
28
|
-
export type StageOverlayService = StageOverlay;
|
|
29
|
-
declare const _default: StageOverlay;
|
|
30
|
-
export default _default;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import type { Writable } from 'type-fest';
|
|
2
|
-
import type { SyncHookPlugin } from '../type';
|
|
3
|
-
import BaseService from './BaseService';
|
|
4
|
-
interface Options {
|
|
5
|
-
namespace?: string;
|
|
6
|
-
protocol?: Protocol;
|
|
7
|
-
}
|
|
8
|
-
export declare enum Protocol {
|
|
9
|
-
OBJECT = "object",
|
|
10
|
-
JSON = "json",
|
|
11
|
-
STRING = "string",
|
|
12
|
-
NUMBER = "number",
|
|
13
|
-
BOOLEAN = "boolean"
|
|
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']>;
|
|
20
|
-
/**
|
|
21
|
-
* 数据存储服务
|
|
22
|
-
*/
|
|
23
|
-
export declare class WebStorage extends BaseService {
|
|
24
|
-
private storage;
|
|
25
|
-
private namespace;
|
|
26
|
-
constructor();
|
|
27
|
-
/**
|
|
28
|
-
* 获取数据存储对象,可以通过
|
|
29
|
-
* const storageService = new StorageService();
|
|
30
|
-
* storageService.usePlugin({
|
|
31
|
-
* // 替换存储对象为 sessionStorage
|
|
32
|
-
* async afterGetStorage(): Promise<Storage> {
|
|
33
|
-
* return window.sessionStorage;
|
|
34
|
-
* },
|
|
35
|
-
* });
|
|
36
|
-
*/
|
|
37
|
-
getStorage(): Storage;
|
|
38
|
-
getNamespace(): string;
|
|
39
|
-
/**
|
|
40
|
-
* 清理,支持storageService.usePlugin
|
|
41
|
-
*/
|
|
42
|
-
clear(): void;
|
|
43
|
-
/**
|
|
44
|
-
* 获取存储项,支持storageService.usePlugin
|
|
45
|
-
*/
|
|
46
|
-
getItem(key: string, options?: Options): any;
|
|
47
|
-
/**
|
|
48
|
-
* 获取指定索引位置的key
|
|
49
|
-
*/
|
|
50
|
-
key(index: number): string | null;
|
|
51
|
-
/**
|
|
52
|
-
* 移除存储项,支持storageService.usePlugin
|
|
53
|
-
*/
|
|
54
|
-
removeItem(key: string, options?: Options): void;
|
|
55
|
-
/**
|
|
56
|
-
* 设置存储项,支持storageService.usePlugin
|
|
57
|
-
*/
|
|
58
|
-
setItem(key: string, value: any, options?: Options): void;
|
|
59
|
-
destroy(): void;
|
|
60
|
-
usePlugin(options: SyncHookPlugin<SyncMethodName, WebStorage>): void;
|
|
61
|
-
private getValueAndProtocol;
|
|
62
|
-
}
|
|
63
|
-
export type StorageService = WebStorage;
|
|
64
|
-
declare const _default: WebStorage;
|
|
65
|
-
export default _default;
|
package/types/services/ui.d.ts
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import type { Writable } from 'type-fest';
|
|
2
|
-
import type { AsyncHookPlugin, UiState } from '../type';
|
|
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']>;
|
|
9
|
-
declare class Ui extends BaseService {
|
|
10
|
-
constructor();
|
|
11
|
-
set<K extends keyof UiState, T extends UiState[K]>(name: K, value: T): void;
|
|
12
|
-
get<K extends keyof UiState>(name: K): {
|
|
13
|
-
uiSelectMode: boolean;
|
|
14
|
-
showSrc: boolean;
|
|
15
|
-
zoom: number;
|
|
16
|
-
stageContainerRect: {
|
|
17
|
-
width: number;
|
|
18
|
-
height: number;
|
|
19
|
-
};
|
|
20
|
-
stageRect: {
|
|
21
|
-
width: string | number;
|
|
22
|
-
height: string | number;
|
|
23
|
-
};
|
|
24
|
-
columnWidth: {
|
|
25
|
-
left: number;
|
|
26
|
-
center: number;
|
|
27
|
-
right: number;
|
|
28
|
-
};
|
|
29
|
-
showGuides: boolean;
|
|
30
|
-
showRule: boolean;
|
|
31
|
-
propsPanelSize: "default" | "small" | "large";
|
|
32
|
-
showAddPageButton: boolean;
|
|
33
|
-
showPageListButton: boolean;
|
|
34
|
-
hideSlideBar: boolean;
|
|
35
|
-
sideBarItems: {
|
|
36
|
-
[x: string]: any;
|
|
37
|
-
text: string;
|
|
38
|
-
tabStyle?: string | Record<string, any> | undefined;
|
|
39
|
-
icon?: any;
|
|
40
|
-
$key: string;
|
|
41
|
-
draggable?: boolean | undefined;
|
|
42
|
-
beforeClick?: ((config: import("../type").SideComponent) => boolean | Promise<boolean>) | undefined;
|
|
43
|
-
boxComponentConfig?: {
|
|
44
|
-
component?: any;
|
|
45
|
-
props?: Record<string, any> | undefined;
|
|
46
|
-
} | undefined;
|
|
47
|
-
type: "component";
|
|
48
|
-
component: any;
|
|
49
|
-
props?: Record<string, any> | undefined;
|
|
50
|
-
listeners?: Record<string, Function> | undefined;
|
|
51
|
-
slots?: Record<string, any> | undefined;
|
|
52
|
-
className?: string | undefined;
|
|
53
|
-
display?: boolean | ((data?: import("../type").Services | undefined) => boolean | Promise<boolean>) | undefined;
|
|
54
|
-
}[];
|
|
55
|
-
navMenuRect: {
|
|
56
|
-
left: number;
|
|
57
|
-
top: number;
|
|
58
|
-
width: number;
|
|
59
|
-
height: number;
|
|
60
|
-
};
|
|
61
|
-
frameworkRect: {
|
|
62
|
-
left: number;
|
|
63
|
-
top: number;
|
|
64
|
-
width: number;
|
|
65
|
-
height: number;
|
|
66
|
-
};
|
|
67
|
-
}[K];
|
|
68
|
-
zoom(zoom: number): Promise<void>;
|
|
69
|
-
calcZoom(): Promise<number>;
|
|
70
|
-
resetState(): void;
|
|
71
|
-
destroy(): void;
|
|
72
|
-
usePlugin(options: AsyncHookPlugin<AsyncMethodName, Ui>): void;
|
|
73
|
-
private setStageRect;
|
|
74
|
-
}
|
|
75
|
-
export type UiService = Ui;
|
|
76
|
-
declare const _default: Ui;
|
|
77
|
-
export default _default;
|