@tmagic/editor 1.2.14 → 1.3.0-alpha.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.
Files changed (59) hide show
  1. package/dist/style.css +173 -80
  2. package/dist/tmagic-editor.js +975 -222
  3. package/dist/tmagic-editor.js.map +1 -1
  4. package/dist/tmagic-editor.umd.cjs +984 -230
  5. package/dist/tmagic-editor.umd.cjs.map +1 -1
  6. package/package.json +10 -9
  7. package/src/Editor.vue +2 -0
  8. package/src/components/CodeDraftEditor.vue +2 -2
  9. package/src/components/SearchInput.vue +6 -3
  10. package/src/editorProps.ts +5 -0
  11. package/src/fields/CodeSelect.vue +1 -0
  12. package/src/fields/DataSourceFields.vue +178 -0
  13. package/src/fields/EventSelect.vue +1 -0
  14. package/src/fields/KeyValue.vue +93 -0
  15. package/src/icons/AppManageIcon.vue +1 -1
  16. package/src/icons/CodeIcon.vue +1 -10
  17. package/src/index.ts +6 -0
  18. package/src/initService.ts +59 -3
  19. package/src/layouts/sidebar/LayerPanel.vue +2 -0
  20. package/src/layouts/sidebar/Sidebar.vue +24 -14
  21. package/src/layouts/sidebar/code-block/CodeBlockList.vue +11 -4
  22. package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +84 -0
  23. package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +130 -0
  24. package/src/services/codeBlock.ts +0 -2
  25. package/src/services/dataSource.ts +90 -0
  26. package/src/services/props.ts +2 -15
  27. package/src/theme/code-block.scss +4 -66
  28. package/src/theme/data-source-fields.scss +13 -0
  29. package/src/theme/data-source.scss +17 -0
  30. package/src/theme/dep-list.scss +59 -0
  31. package/src/theme/key-value.scss +13 -0
  32. package/src/theme/sidebar.scss +26 -6
  33. package/src/theme/theme.scss +4 -0
  34. package/src/type.ts +3 -1
  35. package/src/utils/data-source/formConfigs/base.ts +32 -0
  36. package/src/utils/data-source/formConfigs/http.ts +50 -0
  37. package/src/utils/data-source/index.ts +31 -0
  38. package/src/utils/dep.ts +9 -1
  39. package/src/utils/props.ts +1 -0
  40. package/types/Editor.vue.d.ts +9 -0
  41. package/types/components/ContentMenu.vue.d.ts +2 -2
  42. package/types/components/ScrollViewer.vue.d.ts +1 -1
  43. package/types/editorProps.d.ts +4 -0
  44. package/types/fields/DataSourceFields.vue.d.ts +40 -0
  45. package/types/fields/KeyValue.vue.d.ts +50 -0
  46. package/types/index.d.ts +2 -0
  47. package/types/initService.d.ts +1 -1
  48. package/types/layouts/CodeEditor.vue.d.ts +1 -1
  49. package/types/layouts/sidebar/Sidebar.vue.d.ts +2 -2
  50. package/types/layouts/sidebar/data-source/DataSourceConfigPanel.vue.d.ts +22 -0
  51. package/types/layouts/sidebar/data-source/DataSourceListPanel.vue.d.ts +12 -0
  52. package/types/services/dataSource.d.ts +25 -0
  53. package/types/services/props.d.ts +17 -12
  54. package/types/type.d.ts +3 -1
  55. package/types/utils/data-source/formConfigs/base.d.ts +3 -0
  56. package/types/utils/data-source/formConfigs/http.d.ts +3 -0
  57. package/types/utils/data-source/index.d.ts +2 -0
  58. package/types/utils/dep.d.ts +2 -1
  59. package/types/utils/props.d.ts +2 -3
@@ -0,0 +1,32 @@
1
+ import type { FormConfig } from '@tmagic/form';
2
+
3
+ export default [
4
+ {
5
+ name: 'id',
6
+ type: 'hidden',
7
+ },
8
+ {
9
+ name: 'type',
10
+ text: '类型',
11
+ type: 'select',
12
+ options: [
13
+ { text: '基础', value: 'base' },
14
+ { text: 'HTTP', value: 'http' },
15
+ ],
16
+ defaultValue: 'base',
17
+ },
18
+ {
19
+ name: 'title',
20
+ text: '名称',
21
+ rules: [
22
+ {
23
+ required: true,
24
+ message: '请输入名称',
25
+ },
26
+ ],
27
+ },
28
+ {
29
+ name: 'description',
30
+ text: '描述',
31
+ },
32
+ ] as FormConfig;
@@ -0,0 +1,50 @@
1
+ import { FormConfig } from '@tmagic/form';
2
+
3
+ export default [
4
+ {
5
+ name: 'autoFetch',
6
+ text: '自动请求',
7
+ type: 'switch',
8
+ defaultValue: true,
9
+ },
10
+ {
11
+ type: 'fieldset',
12
+ name: 'options',
13
+ legend: 'HTTP 配置',
14
+ items: [
15
+ {
16
+ name: 'url',
17
+ text: 'URL',
18
+ },
19
+ {
20
+ name: 'method',
21
+ text: 'Method',
22
+ type: 'select',
23
+ options: [
24
+ { text: 'GET', value: 'GET' },
25
+ { text: 'POST', value: 'POST' },
26
+ { text: 'PUT', value: 'PUT' },
27
+ { text: 'DELETE', value: 'DELETE' },
28
+ ],
29
+ },
30
+ {
31
+ name: 'params',
32
+ type: 'key-value',
33
+ defaultValue: {},
34
+ text: '参数',
35
+ },
36
+ {
37
+ name: 'data',
38
+ type: 'key-value',
39
+ defaultValue: {},
40
+ text: '请求体',
41
+ },
42
+ {
43
+ name: 'headers',
44
+ type: 'key-value',
45
+ defaultValue: {},
46
+ text: '请求头',
47
+ },
48
+ ],
49
+ },
50
+ ] as FormConfig;
@@ -0,0 +1,31 @@
1
+ import { FormConfig } from '@tmagic/form';
2
+
3
+ import BaseFormConfig from './formConfigs/base';
4
+ import HttpFormConfig from './formConfigs/http';
5
+
6
+ const fillConfig = (config: FormConfig): FormConfig => [
7
+ ...BaseFormConfig,
8
+ ...config,
9
+ {
10
+ type: 'panel',
11
+ title: '数据定义',
12
+ items: [
13
+ {
14
+ name: 'fields',
15
+ type: 'data-source-fields',
16
+ defaultValue: [],
17
+ },
18
+ ],
19
+ },
20
+ ];
21
+
22
+ export const getFormConfig = (type: string, configs: Record<string, FormConfig>): FormConfig => {
23
+ switch (type) {
24
+ case 'base':
25
+ return fillConfig([]);
26
+ case 'http':
27
+ return fillConfig(HttpFormConfig);
28
+ default:
29
+ return fillConfig(configs[type] || []);
30
+ }
31
+ };
package/src/utils/dep.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { isEmpty } from 'lodash-es';
2
2
 
3
- import { CodeBlockContent, HookType, Id } from '@tmagic/schema';
3
+ import { CodeBlockContent, DataSourceSchema, HookType, Id } from '@tmagic/schema';
4
4
 
5
5
  import { Target } from '@editor/services/dep';
6
6
  import type { HookData } from '@editor/type';
@@ -19,3 +19,11 @@ export const createCodeBlockTarget = (id: Id, codeBlock: CodeBlockContent) =>
19
19
  return false;
20
20
  },
21
21
  });
22
+
23
+ export const createDataSourceTarget = (id: Id, ds: DataSourceSchema) =>
24
+ new Target({
25
+ type: 'data-source',
26
+ id,
27
+ name: ds.title || `${id}`,
28
+ isTarget: (key: string | number, value: any) => typeof value === 'string' && value.includes(`${id}`),
29
+ });
@@ -182,6 +182,7 @@ export const fillConfig = (config: FormConfig = []) => [
182
182
  {
183
183
  name: 'events',
184
184
  type: 'event-select',
185
+ labelWidth: 0,
185
186
  },
186
187
  ],
187
188
  },
@@ -47,6 +47,10 @@ declare const _default: import("vue").DefineComponent<{
47
47
  }>>;
48
48
  default: () => {};
49
49
  };
50
+ dataScourceConfigs: {
51
+ type: import("vue").PropType<Record<string, import("@tmagic/form").FormConfig>>;
52
+ default: () => {};
53
+ };
50
54
  moveableOptions: {
51
55
  type: import("vue").PropType<import("@tmagic/stage").MoveableOptions | ((config?: import("@tmagic/stage").CustomizeMoveableOptionsCallbackConfig | undefined) => import("@tmagic/stage").MoveableOptions)>;
52
56
  };
@@ -134,6 +138,10 @@ declare const _default: import("vue").DefineComponent<{
134
138
  }>>;
135
139
  default: () => {};
136
140
  };
141
+ dataScourceConfigs: {
142
+ type: import("vue").PropType<Record<string, import("@tmagic/form").FormConfig>>;
143
+ default: () => {};
144
+ };
137
145
  moveableOptions: {
138
146
  type: import("vue").PropType<import("@tmagic/stage").MoveableOptions | ((config?: import("@tmagic/stage").CustomizeMoveableOptionsCallbackConfig | undefined) => import("@tmagic/stage").MoveableOptions)>;
139
147
  };
@@ -190,6 +198,7 @@ declare const _default: import("vue").DefineComponent<{
190
198
  events: import("@tmagic/core").EventOption[];
191
199
  methods: import("@tmagic/core").EventOption[];
192
200
  }>;
201
+ dataScourceConfigs: Record<string, import("@tmagic/form").FormConfig>;
193
202
  canSelect: (el: HTMLElement) => boolean | Promise<boolean>;
194
203
  isContainer: (el: HTMLElement) => boolean | Promise<boolean>;
195
204
  containerHighlightClassName: string;
@@ -8,15 +8,15 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
8
8
  }>, {
9
9
  hide: () => void;
10
10
  show: (e: MouseEvent) => void;
11
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("hide" | "show")[], "hide" | "show", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
11
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("show" | "hide")[], "show" | "hide", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
12
12
  menuData?: (MenuButton | MenuComponent)[] | undefined;
13
13
  isSubMenu?: boolean | undefined;
14
14
  }>, {
15
15
  menuData: () => never[];
16
16
  isSubMenu: boolean;
17
17
  }>>> & {
18
- onHide?: ((...args: any[]) => any) | undefined;
19
18
  onShow?: ((...args: any[]) => any) | undefined;
19
+ onHide?: ((...args: any[]) => any) | undefined;
20
20
  }, {
21
21
  menuData: (MenuButton | MenuComponent)[];
22
22
  isSubMenu: boolean;
@@ -41,8 +41,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
41
41
  height: number;
42
42
  };
43
43
  }>>>, {
44
- height: number;
45
44
  width: number;
45
+ height: number;
46
46
  zoom: number;
47
47
  wrapWidth: number;
48
48
  wrapHeight: number;
@@ -64,6 +64,10 @@ declare const _default: {
64
64
  }>>;
65
65
  default: () => {};
66
66
  };
67
+ dataScourceConfigs: {
68
+ type: PropType<Record<string, FormConfig>>;
69
+ default: () => {};
70
+ };
67
71
  /** 画布中组件选中框的移动范围 */
68
72
  moveableOptions: {
69
73
  type: PropType<MoveableOptions | ((config?: CustomizeMoveableOptionsCallbackConfig) => MoveableOptions)>;
@@ -0,0 +1,40 @@
1
+ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
2
+ config: {
3
+ type: 'data-source-fields';
4
+ };
5
+ model: any;
6
+ prop: string;
7
+ disabled: boolean;
8
+ name: string;
9
+ }>, {
10
+ disabled: boolean;
11
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "change"[], "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
12
+ config: {
13
+ type: 'data-source-fields';
14
+ };
15
+ model: any;
16
+ prop: string;
17
+ disabled: boolean;
18
+ name: string;
19
+ }>, {
20
+ disabled: boolean;
21
+ }>>> & {
22
+ onChange?: ((...args: any[]) => any) | undefined;
23
+ }, {
24
+ disabled: boolean;
25
+ }>;
26
+ export default _default;
27
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
28
+ type __VLS_TypePropsToRuntimeProps<T> = {
29
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
30
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
31
+ } : {
32
+ type: import('vue').PropType<T[K]>;
33
+ required: true;
34
+ };
35
+ };
36
+ type __VLS_WithDefaults<P, D> = {
37
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? P[K] & {
38
+ default: D[K];
39
+ } : P[K];
40
+ };
@@ -0,0 +1,50 @@
1
+ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
2
+ config: {
3
+ type: 'key-value';
4
+ name: string;
5
+ text: string;
6
+ };
7
+ model: Record<string, any>;
8
+ name: string;
9
+ prop: string;
10
+ disabled: boolean;
11
+ lastValues?: Record<string, any> | undefined;
12
+ size?: "default" | "small" | "large" | undefined;
13
+ }>, {
14
+ disabled: boolean;
15
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
+ change: (value: Record<string, any>) => void;
17
+ }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
18
+ config: {
19
+ type: 'key-value';
20
+ name: string;
21
+ text: string;
22
+ };
23
+ model: Record<string, any>;
24
+ name: string;
25
+ prop: string;
26
+ disabled: boolean;
27
+ lastValues?: Record<string, any> | undefined;
28
+ size?: "default" | "small" | "large" | undefined;
29
+ }>, {
30
+ disabled: boolean;
31
+ }>>> & {
32
+ onChange?: ((value: Record<string, any>) => any) | undefined;
33
+ }, {
34
+ disabled: boolean;
35
+ }>;
36
+ export default _default;
37
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
38
+ type __VLS_TypePropsToRuntimeProps<T> = {
39
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
40
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
41
+ } : {
42
+ type: import('vue').PropType<T[K]>;
43
+ required: true;
44
+ };
45
+ };
46
+ type __VLS_WithDefaults<P, D> = {
47
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? P[K] & {
48
+ default: D[K];
49
+ } : P[K];
50
+ };
package/types/index.d.ts CHANGED
@@ -18,7 +18,9 @@ export { default as ComponentListPanel } from './layouts/sidebar/ComponentListPa
18
18
  export { default as LayerPanel } from './layouts/sidebar/LayerPanel.vue';
19
19
  export { default as CodeSelect } from './fields/CodeSelect.vue';
20
20
  export { default as CodeSelectCol } from './fields/CodeSelectCol.vue';
21
+ export { default as DataSourceFields } from './fields/DataSourceFields.vue';
21
22
  export { default as EventSelect } from './fields/EventSelect.vue';
23
+ export { default as KeyValue } from './fields/KeyValue.vue';
22
24
  export { default as CodeBlockList } from './layouts/sidebar/code-block/CodeBlockList.vue';
23
25
  export { default as PropsPanel } from './layouts/PropsPanel.vue';
24
26
  export { default as ToolButton } from './components/ToolButton.vue';
@@ -5,4 +5,4 @@ export declare type LooseRequired<T> = {
5
5
  [P in string & keyof T]: T[P];
6
6
  };
7
7
  export declare const initServiceState: (props: Readonly<LooseRequired<Readonly<ExtractPropTypes<typeof editorProps>>>>, { editorService, historyService, componentListService, propsService, eventsService, uiService, codeBlockService, }: Services) => void;
8
- export declare const initServiceEvents: (props: Readonly<LooseRequired<Readonly<ExtractPropTypes<typeof editorProps>>>>, emit: (event: 'props-panel-mounted' | 'update:modelValue', ...args: any[]) => void, { editorService, codeBlockService, depService }: Services) => void;
8
+ export declare const initServiceEvents: (props: Readonly<LooseRequired<Readonly<ExtractPropTypes<typeof editorProps>>>>, emit: (event: 'props-panel-mounted' | 'update:modelValue', ...args: any[]) => void, { editorService, codeBlockService, dataSourceService, depService }: Services) => void;
@@ -37,10 +37,10 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
37
37
  onSave?: ((...args: any[]) => any) | undefined;
38
38
  onInitd?: ((...args: any[]) => any) | undefined;
39
39
  }, {
40
- language: string;
41
40
  options: {
42
41
  [key: string]: any;
43
42
  };
43
+ language: string;
44
44
  autoSave: boolean;
45
45
  }>;
46
46
  export default _default;
@@ -1,7 +1,7 @@
1
1
  import type { MenuButton, MenuComponent } from '../../type';
2
2
  import { SideBarData } from '../../type';
3
3
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
4
- data?: SideBarData | undefined;
4
+ data: SideBarData;
5
5
  layerContentMenu: (MenuButton | MenuComponent)[];
6
6
  }>, {
7
7
  data: () => {
@@ -12,7 +12,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
12
12
  }>, {
13
13
  activeTabName: import("vue").Ref<string>;
14
14
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
15
- data?: SideBarData | undefined;
15
+ data: SideBarData;
16
16
  layerContentMenu: (MenuButton | MenuComponent)[];
17
17
  }>, {
18
18
  data: () => {
@@ -0,0 +1,22 @@
1
+ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
2
+ title?: string | undefined;
3
+ values: any;
4
+ }>, {
5
+ show(): void;
6
+ hide: () => void;
7
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "submit"[], "submit", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
8
+ title?: string | undefined;
9
+ values: any;
10
+ }>>> & {
11
+ onSubmit?: ((...args: any[]) => any) | undefined;
12
+ }, {}>;
13
+ export default _default;
14
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
15
+ type __VLS_TypePropsToRuntimeProps<T> = {
16
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
17
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
18
+ } : {
19
+ type: import('vue').PropType<T[K]>;
20
+ required: true;
21
+ };
22
+ };
@@ -0,0 +1,12 @@
1
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>, {
2
+ 'data-source-panel-tool': (_: {
3
+ id: any;
4
+ data: any;
5
+ }) => any;
6
+ }>;
7
+ export default _default;
8
+ type __VLS_WithTemplateSlots<T, S> = T & {
9
+ new (): {
10
+ $slots: S;
11
+ };
12
+ };
@@ -0,0 +1,25 @@
1
+ import type { FormConfig } from '@tmagic/form';
2
+ import { DataSourceSchema } from '@tmagic/schema';
3
+ import BaseService from './BaseService';
4
+ interface State {
5
+ dataSources: DataSourceSchema[];
6
+ configs: Record<string, FormConfig>;
7
+ }
8
+ type StateKey = keyof State;
9
+ declare class DataSource extends BaseService {
10
+ private state;
11
+ set<K extends StateKey, T extends State[K]>(name: K, value: T): void;
12
+ get<K extends StateKey>(name: K): State[K];
13
+ getFormConfig(type?: string): FormConfig;
14
+ setFormConfig(type: string, config: FormConfig): void;
15
+ add(config: DataSourceSchema): void;
16
+ update(config: DataSourceSchema): void;
17
+ remove(id: string): void;
18
+ getDataSourceById(id: string): DataSourceSchema | undefined;
19
+ resetState(): void;
20
+ destroy(): void;
21
+ private createId;
22
+ }
23
+ export type DataSourceService = DataSource;
24
+ declare const _default: DataSource;
25
+ export default _default;
@@ -10,9 +10,7 @@ declare class Props extends BaseService {
10
10
  items: ({
11
11
  title: string;
12
12
  labelWidth: string;
13
- items: (import("@tmagic/form").ChildConfig & {
14
- [key: string]: any;
15
- })[];
13
+ items: import("@tmagic/form").ChildConfig[];
16
14
  lazy?: undefined;
17
15
  } | {
18
16
  title: string;
@@ -25,7 +23,11 @@ declare class Props extends BaseService {
25
23
  items: ({
26
24
  name: string;
27
25
  type: string;
28
- activeValue: string;
26
+ activeValue: string; /**
27
+ * 为指定类型组件设置组件属性表单配置
28
+ * @param type 组件类型
29
+ * @param config 组件属性表单配置
30
+ */
29
31
  inactiveValue: string;
30
32
  defaultValue: string;
31
33
  text: string;
@@ -34,7 +36,11 @@ declare class Props extends BaseService {
34
36
  name: string;
35
37
  text: string;
36
38
  type?: undefined;
37
- activeValue?: undefined;
39
+ activeValue?: undefined; /**
40
+ * 为指定类型组件设置组件属性表单配置
41
+ * @param type 组件类型
42
+ * @param config 组件属性表单配置
43
+ */
38
44
  inactiveValue?: undefined;
39
45
  defaultValue?: undefined;
40
46
  disabled?: undefined;
@@ -43,7 +49,11 @@ declare class Props extends BaseService {
43
49
  text: string;
44
50
  disabled: (vm: import("@tmagic/form").FormState, { model }: any) => boolean;
45
51
  type?: undefined;
46
- activeValue?: undefined;
52
+ activeValue?: undefined; /**
53
+ * 为指定类型组件设置组件属性表单配置
54
+ * @param type 组件类型
55
+ * @param config 组件属性表单配置
56
+ */
47
57
  inactiveValue?: undefined;
48
58
  defaultValue?: undefined;
49
59
  })[];
@@ -96,6 +106,7 @@ declare class Props extends BaseService {
96
106
  items: {
97
107
  name: string;
98
108
  type: string;
109
+ labelWidth: number;
99
110
  }[];
100
111
  labelWidth?: undefined;
101
112
  lazy?: undefined;
@@ -162,12 +173,6 @@ declare class Props extends BaseService {
162
173
  }>;
163
174
  resetState(): void;
164
175
  destroy(): void;
165
- /**
166
- * 生成指定位数的GUID,无【-】格式
167
- * @param digit 位数,默认值8
168
- * @returns
169
- */
170
- private guid;
171
176
  }
172
177
  export type PropsService = Props;
173
178
  declare const _default: Props;
package/types/type.d.ts CHANGED
@@ -5,6 +5,7 @@ import type StageCore from '@tmagic/stage';
5
5
  import type { ContainerHighlightType, CustomizeMoveableOptionsCallbackConfig, MoveableOptions, UpdateDragEl } from '@tmagic/stage';
6
6
  import type { CodeBlockService } from './services/codeBlock';
7
7
  import type { ComponentListService } from './services/componentList';
8
+ import { DataSourceService } from './services/dataSource';
8
9
  import type { DepService } from './services/dep';
9
10
  import type { EditorService } from './services/editor';
10
11
  import type { EventsService } from './services/events';
@@ -28,6 +29,7 @@ export interface Services {
28
29
  uiService: UiService;
29
30
  codeBlockService: CodeBlockService;
30
31
  depService: DepService;
32
+ dataSourceService: DataSourceService;
31
33
  }
32
34
  export interface StageOptions {
33
35
  runtimeUrl: string;
@@ -203,7 +205,7 @@ export interface SideComponent extends MenuComponent {
203
205
  * layer: 已选组件树
204
206
  * code-block: 代码块
205
207
  */
206
- export type SideItem = 'component-list' | 'layer' | 'code-block' | SideComponent;
208
+ export type SideItem = 'component-list' | 'layer' | 'code-block' | 'data-source' | SideComponent;
207
209
  /** 工具栏 */
208
210
  export interface SideBarData {
209
211
  /** 容器类型 */
@@ -0,0 +1,3 @@
1
+ import type { FormConfig } from '@tmagic/form';
2
+ declare const _default: FormConfig;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { FormConfig } from '@tmagic/form';
2
+ declare const _default: FormConfig;
3
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import { FormConfig } from '@tmagic/form';
2
+ export declare const getFormConfig: (type: string, configs: Record<string, FormConfig>) => FormConfig;
@@ -1,3 +1,4 @@
1
- import { CodeBlockContent, Id } from '@tmagic/schema';
1
+ import { CodeBlockContent, DataSourceSchema, Id } from '@tmagic/schema';
2
2
  import { Target } from '../services/dep';
3
3
  export declare const createCodeBlockTarget: (id: Id, codeBlock: CodeBlockContent) => Target;
4
+ export declare const createDataSourceTarget: (id: Id, ds: DataSourceSchema) => Target;
@@ -9,9 +9,7 @@ export declare const fillConfig: (config?: FormConfig) => {
9
9
  items: ({
10
10
  title: string;
11
11
  labelWidth: string;
12
- items: (import("@tmagic/form").ChildConfig & {
13
- [key: string]: any;
14
- })[];
12
+ items: import("@tmagic/form").ChildConfig[];
15
13
  lazy?: undefined;
16
14
  } | {
17
15
  title: string;
@@ -95,6 +93,7 @@ export declare const fillConfig: (config?: FormConfig) => {
95
93
  items: {
96
94
  name: string;
97
95
  type: string;
96
+ labelWidth: number;
98
97
  }[];
99
98
  labelWidth?: undefined;
100
99
  lazy?: undefined;