@tmagic/editor 1.2.0-beta.11 → 1.2.0-beta.13
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 +14 -17
- package/dist/tmagic-editor.mjs +709 -562
- package/dist/tmagic-editor.mjs.map +1 -1
- package/dist/tmagic-editor.umd.js +715 -567
- package/dist/tmagic-editor.umd.js.map +1 -1
- package/package.json +9 -9
- package/src/Editor.vue +1 -0
- package/src/components/CodeDraftEditor.vue +130 -0
- package/src/components/FunctionEditor.vue +144 -0
- package/src/fields/CodeSelect.vue +80 -101
- package/src/layouts/CodeEditor.vue +1 -2
- package/src/layouts/sidebar/LayerPanel.vue +99 -86
- package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +23 -79
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +37 -71
- package/src/services/codeBlock.ts +111 -120
- package/src/services/editor.ts +19 -5
- package/src/theme/code-block.scss +14 -17
- package/src/type.ts +36 -38
- package/src/utils/editor.ts +9 -1
- package/src/utils/props.ts +2 -2
- package/types/components/CodeDraftEditor.vue.d.ts +148 -0
- package/types/components/FunctionEditor.vue.d.ts +120 -0
- package/types/fields/CodeSelect.vue.d.ts +9 -9
- package/types/layouts/CodeEditor.vue.d.ts +5 -12
- package/types/layouts/sidebar/code-block/CodeBlockEditor.vue.d.ts +1 -1
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +6 -5
- package/types/services/codeBlock.d.ts +55 -35
- package/types/services/editor.d.ts +1 -0
- package/types/services/props.d.ts +1 -1
- package/types/type.d.ts +32 -35
- package/types/utils/editor.d.ts +1 -0
- package/types/utils/props.d.ts +1 -1
package/types/type.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Component } from 'vue';
|
|
2
2
|
import type { FormConfig } from '@tmagic/form';
|
|
3
|
-
import type { Id, MApp, MContainer, MNode, MPage } from '@tmagic/schema';
|
|
3
|
+
import type { CodeBlockContent, CodeBlockDSL, Id, MApp, MContainer, MNode, MPage } from '@tmagic/schema';
|
|
4
4
|
import type StageCore from '@tmagic/stage';
|
|
5
5
|
import type { ContainerHighlightType, MoveableOptions } from '@tmagic/stage';
|
|
6
6
|
import type { CodeBlockService } from './services/codeBlock';
|
|
@@ -246,26 +246,13 @@ export interface ScrollViewerEvent {
|
|
|
246
246
|
scrollHeight: number;
|
|
247
247
|
scrollWidth: number;
|
|
248
248
|
}
|
|
249
|
-
export interface CodeBlockDSL {
|
|
250
|
-
[id: string]: CodeBlockContent;
|
|
251
|
-
}
|
|
252
|
-
export interface CodeBlockContent {
|
|
253
|
-
/** 代码块名称 */
|
|
254
|
-
name: string;
|
|
255
|
-
/** 代码块内容 */
|
|
256
|
-
content: string;
|
|
257
|
-
/** 代码块与组件的绑定关系 */
|
|
258
|
-
comps?: CodeRelation;
|
|
259
|
-
/** 扩展字段 */
|
|
260
|
-
[propName: string]: any;
|
|
261
|
-
}
|
|
262
249
|
export declare type CodeState = {
|
|
263
250
|
/** 是否展示代码块编辑区 */
|
|
264
251
|
isShowCodeEditor: boolean;
|
|
265
252
|
/** 代码块DSL数据源 */
|
|
266
253
|
codeDsl: CodeBlockDSL | null;
|
|
267
254
|
/** 当前选中的代码块id */
|
|
268
|
-
id:
|
|
255
|
+
id: Id;
|
|
269
256
|
/** 代码块是否可编辑 */
|
|
270
257
|
editable: boolean;
|
|
271
258
|
/** 代码编辑面板的展示模式 */
|
|
@@ -273,11 +260,21 @@ export declare type CodeState = {
|
|
|
273
260
|
/** list模式下左侧展示的代码列表 */
|
|
274
261
|
combineIds: string[];
|
|
275
262
|
/** 为业务逻辑预留的不可删除的代码块列表,由业务逻辑维护(如代码块上线后不可删除) */
|
|
276
|
-
undeletableList:
|
|
263
|
+
undeletableList: Id[];
|
|
264
|
+
/** 代码块和组件的绑定关系 */
|
|
265
|
+
relations: CodeRelation;
|
|
266
|
+
};
|
|
267
|
+
export declare type HookData = {
|
|
268
|
+
/** 代码块id */
|
|
269
|
+
codeId: Id;
|
|
270
|
+
/** 参数 */
|
|
271
|
+
params?: object;
|
|
277
272
|
};
|
|
278
273
|
export declare type CodeRelation = {
|
|
279
|
-
|
|
280
|
-
|
|
274
|
+
[codeId: Id]: {
|
|
275
|
+
/** 组件id:['created'] */
|
|
276
|
+
[compId: Id]: string[];
|
|
277
|
+
};
|
|
281
278
|
};
|
|
282
279
|
export declare enum CodeEditorMode {
|
|
283
280
|
/** 左侧菜单,右侧代码 */
|
|
@@ -285,26 +282,27 @@ export declare enum CodeEditorMode {
|
|
|
285
282
|
/** 全屏代码 */
|
|
286
283
|
EDITOR = "editor"
|
|
287
284
|
}
|
|
288
|
-
export interface
|
|
285
|
+
export interface CodeDslItem {
|
|
289
286
|
/** 代码块id */
|
|
290
|
-
id:
|
|
287
|
+
id: Id;
|
|
291
288
|
/** 代码块名称 */
|
|
292
289
|
name: string;
|
|
293
290
|
/** 代码块函数内容 */
|
|
294
291
|
codeBlockContent?: CodeBlockContent;
|
|
295
292
|
/** 是否展示代码绑定关系 */
|
|
296
293
|
showRelation?: boolean;
|
|
294
|
+
/** 代码块对应绑定的组件信息 */
|
|
295
|
+
combineInfo?: CombineInfo[];
|
|
296
|
+
}
|
|
297
|
+
export interface CombineInfo {
|
|
298
|
+
/** 组件id */
|
|
299
|
+
compId: Id;
|
|
300
|
+
/** 组件名称 */
|
|
301
|
+
compName: string;
|
|
297
302
|
}
|
|
298
303
|
export interface ListState {
|
|
299
304
|
/** 代码块列表 */
|
|
300
|
-
codeList:
|
|
301
|
-
}
|
|
302
|
-
export interface ListRelationState extends ListState {
|
|
303
|
-
/** 与代码块绑定的组件id信息 */
|
|
304
|
-
bindComps: {
|
|
305
|
-
/** 代码块id : 组件信息 */
|
|
306
|
-
[id: string]: MNode[];
|
|
307
|
-
};
|
|
305
|
+
codeList: CodeDslItem[];
|
|
308
306
|
}
|
|
309
307
|
export declare enum CodeDeleteErrorType {
|
|
310
308
|
/** 代码块存在于不可删除列表中 */
|
|
@@ -312,11 +310,10 @@ export declare enum CodeDeleteErrorType {
|
|
|
312
310
|
/** 代码块存在绑定关系 */
|
|
313
311
|
BIND = "bind"
|
|
314
312
|
}
|
|
315
|
-
export declare
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
CHANGE = "change"
|
|
313
|
+
export declare const CODE_DRAFT_STORAGE_KEY = "magicCodeDraft";
|
|
314
|
+
export interface CodeParamStatement {
|
|
315
|
+
/** 参数名称 */
|
|
316
|
+
name: string;
|
|
317
|
+
/** 参数类型 */
|
|
318
|
+
type?: string;
|
|
322
319
|
}
|
package/types/utils/editor.d.ts
CHANGED
|
@@ -45,3 +45,4 @@ export declare const fixNodeLeft: (config: MNode, parent: MContainer, doc?: Docu
|
|
|
45
45
|
export declare const fixNodePosition: (config: MNode, parent: MContainer, stage: StageCore | null) => {
|
|
46
46
|
[key: string]: any;
|
|
47
47
|
} | undefined;
|
|
48
|
+
export declare const serializeConfig: (config: any) => string;
|