@tmagic/editor 1.3.16 → 1.4.0-beta.2

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.
Files changed (129) hide show
  1. package/dist/style.css +25 -9
  2. package/dist/tmagic-editor.js +1048 -632
  3. package/dist/tmagic-editor.umd.cjs +1065 -647
  4. package/package.json +23 -21
  5. package/src/components/CodeBlockEditor.vue +82 -59
  6. package/src/components/FloatingBox.vue +71 -25
  7. package/src/components/SplitView.vue +46 -35
  8. package/src/fields/Code.vue +12 -10
  9. package/src/fields/CodeLink.vue +9 -9
  10. package/src/fields/CodeSelect.vue +7 -5
  11. package/src/fields/CodeSelectCol.vue +1 -1
  12. package/src/fields/DataSourceFieldSelect.vue +118 -27
  13. package/src/fields/DataSourceFields.vue +10 -3
  14. package/src/fields/DataSourceInput.vue +7 -7
  15. package/src/fields/DataSourceMethodSelect.vue +1 -1
  16. package/src/fields/DataSourceMethods.vue +3 -3
  17. package/src/fields/DataSourceMocks.vue +3 -3
  18. package/src/fields/DataSourceSelect.vue +6 -18
  19. package/src/fields/EventSelect.vue +1 -1
  20. package/src/fields/KeyValue.vue +8 -8
  21. package/src/fields/PageFragmentSelect.vue +1 -1
  22. package/src/fields/UISelect.vue +5 -5
  23. package/src/hooks/index.ts +2 -0
  24. package/src/hooks/use-code-block-edit.ts +1 -2
  25. package/src/hooks/use-editor-content-height.ts +20 -0
  26. package/src/hooks/use-float-box.ts +8 -8
  27. package/src/hooks/use-window-rect.ts +20 -0
  28. package/src/index.ts +2 -2
  29. package/src/layouts/Framework.vue +33 -34
  30. package/src/layouts/NavMenu.vue +21 -2
  31. package/src/layouts/PropsPanel.vue +35 -0
  32. package/src/layouts/sidebar/Sidebar.vue +18 -8
  33. package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +0 -1
  34. package/src/layouts/workspace/viewer/NodeListMenu.vue +1 -0
  35. package/src/services/BaseService.ts +5 -2
  36. package/src/services/codeBlock.ts +14 -8
  37. package/src/services/dataSource.ts +39 -26
  38. package/src/services/editor.ts +46 -25
  39. package/src/services/events.ts +4 -4
  40. package/src/services/props.ts +44 -35
  41. package/src/services/stageOverlay.ts +16 -9
  42. package/src/services/storage.ts +14 -8
  43. package/src/services/ui.ts +26 -19
  44. package/src/theme/code-block.scss +0 -5
  45. package/src/theme/code-editor.scss +6 -0
  46. package/src/theme/floating-box.scss +4 -2
  47. package/src/theme/props-panel.scss +14 -0
  48. package/src/theme/sidebar.scss +6 -3
  49. package/src/type.ts +87 -37
  50. package/src/utils/operator.ts +37 -39
  51. package/src/utils/props.ts +174 -37
  52. package/types/components/CodeBlockEditor.vue.d.ts +46 -25
  53. package/types/components/CodeParams.vue.d.ts +5 -5
  54. package/types/components/ContentMenu.vue.d.ts +12 -12
  55. package/types/components/FloatingBox.vue.d.ts +42 -55
  56. package/types/components/Icon.vue.d.ts +3 -3
  57. package/types/components/Resizer.vue.d.ts +3 -3
  58. package/types/components/ScrollBar.vue.d.ts +3 -3
  59. package/types/components/ScrollViewer.vue.d.ts +12 -12
  60. package/types/components/SearchInput.vue.d.ts +1 -1
  61. package/types/components/SplitView.vue.d.ts +13 -11
  62. package/types/components/ToolButton.vue.d.ts +13 -13
  63. package/types/components/Tree.vue.d.ts +24 -14
  64. package/types/components/TreeNode.vue.d.ts +22 -12
  65. package/types/fields/Code.vue.d.ts +14 -14
  66. package/types/fields/CodeLink.vue.d.ts +6 -10
  67. package/types/fields/CodeSelect.vue.d.ts +14 -14
  68. package/types/fields/CodeSelectCol.vue.d.ts +11 -11
  69. package/types/fields/DataSourceFieldSelect.vue.d.ts +11 -11
  70. package/types/fields/DataSourceFields.vue.d.ts +11 -11
  71. package/types/fields/DataSourceInput.vue.d.ts +14 -18
  72. package/types/fields/DataSourceMethodSelect.vue.d.ts +11 -11
  73. package/types/fields/DataSourceMethods.vue.d.ts +11 -11
  74. package/types/fields/DataSourceMocks.vue.d.ts +11 -11
  75. package/types/fields/DataSourceSelect.vue.d.ts +13 -26
  76. package/types/fields/EventSelect.vue.d.ts +3 -3
  77. package/types/fields/KeyValue.vue.d.ts +14 -18
  78. package/types/fields/PageFragmentSelect.vue.d.ts +11 -11
  79. package/types/fields/UISelect.vue.d.ts +8 -4
  80. package/types/hooks/index.d.ts +2 -0
  81. package/types/hooks/use-code-block-edit.d.ts +66 -90
  82. package/types/hooks/use-data-source-method.d.ts +66 -90
  83. package/types/hooks/use-editor-content-height.d.ts +3 -0
  84. package/types/hooks/use-node-status.d.ts +6 -1
  85. package/types/hooks/use-window-rect.d.ts +6 -0
  86. package/types/icons/AppManageIcon.vue.d.ts +1 -1
  87. package/types/icons/CenterIcon.vue.d.ts +1 -1
  88. package/types/icons/CodeIcon.vue.d.ts +1 -1
  89. package/types/icons/FolderMinusIcon.vue.d.ts +1 -1
  90. package/types/icons/PinIcon.vue.d.ts +1 -1
  91. package/types/icons/PinnedIcon.vue.d.ts +1 -1
  92. package/types/layouts/AddPageBox.vue.d.ts +3 -3
  93. package/types/layouts/CodeEditor.vue.d.ts +12 -12
  94. package/types/layouts/Framework.vue.d.ts +9 -9
  95. package/types/layouts/NavMenu.vue.d.ts +11 -11
  96. package/types/layouts/PropsPanel.vue.d.ts +193 -243
  97. package/types/layouts/page-bar/AddButton.vue.d.ts +3 -3
  98. package/types/layouts/page-bar/PageBar.vue.d.ts +8 -8
  99. package/types/layouts/page-bar/PageBarScrollContainer.vue.d.ts +8 -8
  100. package/types/layouts/page-bar/SwitchTypeButton.vue.d.ts +3 -3
  101. package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +1 -1
  102. package/types/layouts/sidebar/Sidebar.vue.d.ts +13 -13
  103. package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +10 -10
  104. package/types/layouts/sidebar/code-block/CodeBlockListPanel.vue.d.ts +9 -9
  105. package/types/layouts/sidebar/data-source/DataSourceConfigPanel.vue.d.ts +3 -3
  106. package/types/layouts/sidebar/data-source/DataSourceList.vue.d.ts +3 -3
  107. package/types/layouts/sidebar/data-source/DataSourceListPanel.vue.d.ts +9 -9
  108. package/types/layouts/sidebar/layer/LayerMenu.vue.d.ts +11 -11
  109. package/types/layouts/sidebar/layer/LayerNodeTool.vue.d.ts +3 -3
  110. package/types/layouts/sidebar/layer/LayerPanel.vue.d.ts +9 -9
  111. package/types/layouts/sidebar/layer/use-click.d.ts +42 -76
  112. package/types/layouts/sidebar/layer/use-node-status.d.ts +6 -1
  113. package/types/layouts/workspace/Breadcrumb.vue.d.ts +1 -1
  114. package/types/layouts/workspace/Workspace.vue.d.ts +12 -12
  115. package/types/layouts/workspace/viewer/NodeListMenu.vue.d.ts +1 -1
  116. package/types/layouts/workspace/viewer/Stage.vue.d.ts +11 -11
  117. package/types/layouts/workspace/viewer/StageOverlay.vue.d.ts +1 -1
  118. package/types/layouts/workspace/viewer/ViewerMenu.vue.d.ts +12 -12
  119. package/types/services/BaseService.d.ts +5 -2
  120. package/types/services/codeBlock.d.ts +8 -0
  121. package/types/services/dataSource.d.ts +9 -2
  122. package/types/services/editor.d.ts +8 -1
  123. package/types/services/props.d.ts +15 -22
  124. package/types/services/stageOverlay.d.ts +9 -2
  125. package/types/services/storage.d.ts +8 -0
  126. package/types/services/ui.d.ts +20 -8
  127. package/types/type.d.ts +56 -32
  128. package/types/utils/operator.d.ts +1 -1
  129. 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
- private createId;
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(type: string, { inputEvent, ...defaultValue }?: Record<string, any>): Promise<any>;
45
- createId(type: string | number): Promise<string>;
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): Promise<MNode>;
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): Promise<{
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,15 +1,22 @@
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();
7
13
  get<K extends keyof StageOverlayState>(name: K): StageOverlayState[K];
8
14
  set<K extends keyof StageOverlayState, T extends StageOverlayState[K]>(name: K, value: T): void;
9
- openOverlay(el: HTMLElement | undefined | null): void;
15
+ openOverlay(el: HTMLElement | null): void;
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;
@@ -1,5 +1,11 @@
1
- import type { UiState } from '../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,27 @@ declare class Ui extends BaseService {
22
28
  };
23
29
  showGuides: boolean;
24
30
  showRule: boolean;
25
- propsPanelSize: "default" | "small" | "large";
31
+ propsPanelSize: "small" | "large" | "default";
26
32
  showAddPageButton: boolean;
27
- floatBox: Map<string, {
28
- status: boolean;
29
- zIndex: number;
33
+ hideSlideBar: boolean;
34
+ navMenuRect: {
35
+ left: number;
30
36
  top: number;
37
+ width: number;
38
+ height: number;
39
+ };
40
+ frameworkRect: {
31
41
  left: number;
32
- }>;
33
- hideSlideBar: boolean;
42
+ top: number;
43
+ width: number;
44
+ height: number;
45
+ };
34
46
  }[K];
35
47
  zoom(zoom: number): Promise<void>;
36
48
  calcZoom(): Promise<number>;
37
- setFloatBox(keys: string[]): Promise<void>;
38
49
  resetState(): void;
39
50
  destroy(): void;
51
+ usePlugin(options: AsyncHookPlugin<AsyncMethodName, Ui>): void;
40
52
  private setStageRect;
41
53
  }
42
54
  export type UiService = Ui;
package/types/type.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { Component } from 'vue';
2
- import type { ColumnConfig, FilterFunction, FormConfig, FormItem } from '@tmagic/form';
3
- import type { CodeBlockContent, CodeBlockDSL, Id, MApp, MContainer, MNode, MPage, MPageFragment } from '@tmagic/schema';
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';
@@ -191,15 +192,20 @@ export interface UiState {
191
192
  propsPanelSize: 'large' | 'default' | 'small';
192
193
  /** 是否显示新增页面按钮 */
193
194
  showAddPageButton: boolean;
194
- /** slide 拖拽悬浮窗 state */
195
- floatBox: Map<string, {
196
- status: boolean;
197
- zIndex: number;
198
- top: number;
199
- left: number;
200
- }>;
201
195
  /** 是否隐藏侧边栏 */
202
196
  hideSlideBar: boolean;
197
+ navMenuRect: {
198
+ left: number;
199
+ top: number;
200
+ width: number;
201
+ height: number;
202
+ };
203
+ frameworkRect: {
204
+ left: number;
205
+ top: number;
206
+ width: number;
207
+ height: number;
208
+ };
203
209
  }
204
210
  export interface EditorNodeInfo {
205
211
  node: MNode | null;
@@ -506,39 +512,40 @@ export interface KeyBindingCacheItem {
506
512
  eventType: 'keyup' | 'keydown';
507
513
  bound: boolean;
508
514
  }
509
- export interface CodeSelectColConfig {
515
+ export interface CodeSelectColConfig extends FormItem {
510
516
  type: 'code-select-col';
511
- name: string;
512
- text: string;
513
- labelWidth?: number | string;
514
- disabled?: boolean | FilterFunction;
517
+ /** 是否可以编辑代码块,disable表示的是是否可以选择代码块 */
515
518
  notEditable?: boolean | FilterFunction;
516
- display?: boolean | FilterFunction;
517
519
  }
518
- export interface PageFragmentSelectConfig {
520
+ export interface PageFragmentSelectConfig extends FormItem {
519
521
  type: 'page-fragment-select';
520
- name: string;
521
- text: string;
522
- labelWidth?: number | string;
523
- disabled?: boolean | FilterFunction;
524
- display?: boolean | FilterFunction;
525
522
  }
526
- export interface DataSourceMethodSelectConfig {
523
+ export interface DataSourceSelect extends FormItem, Input {
524
+ type: 'data-source-select';
525
+ /** 数据源类型: base、http... */
526
+ dataSourceType?: string;
527
+ /** 是否要编译成数据源的data。
528
+ * id: 不编译,就是要数据源id;
529
+ * value: 要编译(数据源data)
530
+ * */
531
+ value?: 'id' | 'value';
532
+ }
533
+ export interface DataSourceMethodSelectConfig extends FormItem {
527
534
  type: 'data-source-method-select';
528
- name: string;
529
- text: string;
530
- labelWidth?: number | string;
531
- disabled?: boolean | FilterFunction;
535
+ /** 是否可以编辑数据源,disable表示的是是否可以选择数据源 */
532
536
  notEditable?: boolean | FilterFunction;
533
- display?: boolean | FilterFunction;
534
537
  }
535
- export interface DataSourceFieldSelectConfig {
538
+ export interface DataSourceFieldSelectConfig extends FormItem {
536
539
  type: 'data-source-field-select';
537
- name: string;
540
+ /** 是否要编译成数据源的data。
541
+ * key: 不编译,就是要数据源id和field name;
542
+ * value: 要编译(数据源data[`${filed}`])
543
+ * */
538
544
  value?: 'key' | 'value';
539
- labelWidth?: number | string;
540
- disabled?: boolean | FilterFunction;
541
- display?: boolean | FilterFunction;
545
+ /** 是否严格的遵守父子节点不互相关联 */
546
+ checkStrictly?: boolean;
547
+ dataSourceFieldType?: DataSourceFieldType[];
548
+ fieldConfig?: ChildConfig;
542
549
  }
543
550
  /** 可新增的数据源类型选项 */
544
551
  export interface DatasourceTypeOption {
@@ -573,3 +580,20 @@ export interface TreeNodeData {
573
580
  items?: TreeNodeData[];
574
581
  [key: string]: any;
575
582
  }
583
+ export type AsyncBeforeHook<Value extends Array<string>, C extends Record<Value[number], (...args: any) => any>> = {
584
+ [K in Value[number]]?: (...args: Parameters<C[K]>) => Promise<Parameters<C[K]>> | Parameters<C[K]>;
585
+ };
586
+ export type AsyncAfterHook<Value extends Array<string>, C extends Record<Value[number], (...args: any) => any>> = {
587
+ [K in Value[number]]?: (result: Awaited<ReturnType<C[K]>>, ...args: Parameters<C[K]>) => ReturnType<C[K]> | Awaited<ReturnType<C[K]>>;
588
+ };
589
+ export type SyncBeforeHook<Value extends Array<string>, C extends Record<Value[number], (...args: any) => any>> = {
590
+ [K in Value[number]]?: (...args: Parameters<C[K]>) => Parameters<C[K]>;
591
+ };
592
+ export type SyncAfterHook<Value extends Array<string>, C extends Record<Value[number], (...args: any) => any>> = {
593
+ [K in Value[number]]?: (result: ReturnType<C[K]>, ...args: Parameters<C[K]>) => ReturnType<C[K]>;
594
+ };
595
+ export type AddPrefixToObject<T, P extends string> = {
596
+ [K in keyof T as K extends string ? `${P}${K}` : never]: T[K];
597
+ };
598
+ 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'>;
599
+ 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[]) => Promise<MNode[]>;
9
+ export declare const beforePaste: (position: PastePosition, config: MNode[]) => MNode[];
10
10
  /**
11
11
  * 将元素粘贴到容器内时,将相对于画布坐标转换为相对于容器的坐标
12
12
  * @param position PastePosition 粘贴时相对于画布的坐标
@@ -1,4 +1,4 @@
1
- import type { FormConfig, FormState, TabPaneConfig } from '@tmagic/form';
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;