forked from alibaba/lowcode-engine
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcommon.ts
More file actions
122 lines (107 loc) · 2.98 KB
/
common.ts
File metadata and controls
122 lines (107 loc) · 2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import { Component, ReactNode } from 'react';
import {
IPublicTypeI18nData,
IPublicTypeNodeSchema,
IPublicTypeTitleContent,
} from '../type';
import { IPublicEnumTransitionType } from '../enum';
export interface IPublicApiCommonUtils {
/**
* 是否为合法的 schema 结构
* check if data is valid NodeSchema
*
* @param {*} data
* @returns {boolean}
*/
isNodeSchema(data: any): boolean;
/**
* 是否为表单事件类型
* check if e is a form event
* @param {(KeyboardEvent | MouseEvent)} e
* @returns {boolean}
*/
isFormEvent(e: KeyboardEvent | MouseEvent): boolean;
/**
* 从 schema 结构中查找指定 id 节点
* get node schema from a larger schema with node id
* @param {IPublicTypeNodeSchema} schema
* @param {string} nodeId
* @returns {(IPublicTypeNodeSchema | undefined)}
*/
getNodeSchemaById(
schema: IPublicTypeNodeSchema,
nodeId: string,
): IPublicTypeNodeSchema | undefined;
// TODO: add comments
getConvertedExtraKey(key: string): string;
// TODO: add comments
getOriginalExtraKey(key: string): string;
/**
* 批处理事务,用于优化特定场景的性能
* excute something in a transaction for performence
*
* @param {() => void} fn
* @param {IPublicEnumTransitionType} type
* @since v1.0.16
*/
executeTransaction(fn: () => void, type: IPublicEnumTransitionType): void;
/**
* i18n 相关工具
* i18n tools
*
* @param {(string | object)} instance
* @returns {{
* intlNode(id: string, params?: object): ReactNode;
* intl(id: string, params?: object): string;
* getLocale(): string;
* setLocale(locale: string): void;
* }}
* @since v1.0.17
*/
createIntl(instance: string | object): {
intlNode(id: string, params?: object): ReactNode;
intl(id: string, params?: object): string;
getLocale(): string;
setLocale(locale: string): void;
};
/**
* i18n 转换方法
*/
intl(data: IPublicTypeI18nData | string, params?: object): string;
}
export interface IPublicApiCommonSkeletonCabin {
/**
* 编辑器框架 View
* get Workbench Component
*/
get Workbench(): ReactNode;
}
export interface IPublicApiCommonEditorCabin {
/**
* Title 组件
* @experimental unstable API, pay extra caution when trying to use this
*/
get Tip(): React.ComponentClass<{}>;
/**
* Tip 组件
* @experimental unstable API, pay extra caution when trying to use this
*/
get Title(): React.ComponentClass<{
title: IPublicTypeTitleContent | undefined;
match?: boolean;
keywords?: string | null;
}>;
}
export interface IPublicApiCommonDesignerCabin {}
export interface IPublicApiCommon {
get utils(): IPublicApiCommonUtils;
/**
* @deprecated
*/
get designerCabin(): IPublicApiCommonDesignerCabin;
/**
* @experimental unstable API, pay extra caution when trying to use this
*/
get editorCabin(): IPublicApiCommonEditorCabin;
get skeletonCabin(): IPublicApiCommonSkeletonCabin;
}