@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.
@@ -42,8 +42,8 @@ declare class Props extends BaseService {
42
42
  items: {
43
43
  name: string;
44
44
  text: string;
45
- type: string;
46
45
  labelWidth: string;
46
+ type: string;
47
47
  }[];
48
48
  labelWidth?: undefined;
49
49
  })[];
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: string;
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: string[];
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
- /** 组件id:['created'] */
280
- [compId: string | number]: string[];
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 CodeDslList {
285
+ export interface CodeDslItem {
289
286
  /** 代码块id */
290
- id: string;
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: CodeDslList[];
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 enum CodeSelectOp {
316
- /** 增加 */
317
- ADD = "add",
318
- /** 删除 */
319
- DELETE = "delete",
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
  }
@@ -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;
@@ -41,8 +41,8 @@ export declare const fillConfig: (config?: FormConfig) => {
41
41
  items: {
42
42
  name: string;
43
43
  text: string;
44
- type: string;
45
44
  labelWidth: string;
45
+ type: string;
46
46
  }[];
47
47
  labelWidth?: undefined;
48
48
  })[];