@cuipengyu5/bling-renderer-core 0.0.1
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/es/adapter/index.d.ts +24 -0
- package/es/adapter/index.js +95 -0
- package/es/components/Div.d.ts +2 -0
- package/es/components/Div.js +19 -0
- package/es/components/VisualDom/index.css +19 -0
- package/es/components/VisualDom/index.d.ts +3 -0
- package/es/components/VisualDom/index.js +44 -0
- package/es/context/index.d.ts +1 -0
- package/es/context/index.js +11 -0
- package/es/hoc/index.d.ts +7 -0
- package/es/hoc/index.js +90 -0
- package/es/hoc/leaf.d.ts +32 -0
- package/es/hoc/leaf.js +521 -0
- package/es/index.d.ts +7 -0
- package/es/index.js +9 -0
- package/es/renderer/addon.d.ts +2 -0
- package/es/renderer/addon.js +107 -0
- package/es/renderer/base.d.ts +13 -0
- package/es/renderer/base.js +1120 -0
- package/es/renderer/block.d.ts +2 -0
- package/es/renderer/block.js +43 -0
- package/es/renderer/component.d.ts +2 -0
- package/es/renderer/component.js +59 -0
- package/es/renderer/index.d.ts +8 -0
- package/es/renderer/index.js +8 -0
- package/es/renderer/page.d.ts +2 -0
- package/es/renderer/page.js +91 -0
- package/es/renderer/renderer.d.ts +2 -0
- package/es/renderer/renderer.js +230 -0
- package/es/renderer/temp.d.ts +2 -0
- package/es/renderer/temp.js +139 -0
- package/es/style.js +1 -0
- package/es/types/index.d.ts +275 -0
- package/es/types/index.js +1 -0
- package/es/utils/common.d.ts +119 -0
- package/es/utils/common.js +378 -0
- package/es/utils/data-helper.d.ts +74 -0
- package/es/utils/data-helper.js +300 -0
- package/es/utils/index.d.ts +3 -0
- package/es/utils/index.js +3 -0
- package/es/utils/is-use-loop.d.ts +2 -0
- package/es/utils/is-use-loop.js +16 -0
- package/es/utils/logger.d.ts +3 -0
- package/es/utils/logger.js +5 -0
- package/es/utils/request.d.ts +54 -0
- package/es/utils/request.js +209 -0
- package/lib/adapter/index.d.ts +24 -0
- package/lib/adapter/index.js +99 -0
- package/lib/components/Div.d.ts +2 -0
- package/lib/components/Div.js +24 -0
- package/lib/components/VisualDom/index.css +19 -0
- package/lib/components/VisualDom/index.d.ts +3 -0
- package/lib/components/VisualDom/index.js +49 -0
- package/lib/context/index.d.ts +1 -0
- package/lib/context/index.js +16 -0
- package/lib/hoc/index.d.ts +7 -0
- package/lib/hoc/index.js +95 -0
- package/lib/hoc/leaf.d.ts +32 -0
- package/lib/hoc/leaf.js +526 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.js +34 -0
- package/lib/renderer/addon.d.ts +2 -0
- package/lib/renderer/addon.js +112 -0
- package/lib/renderer/base.d.ts +13 -0
- package/lib/renderer/base.js +1126 -0
- package/lib/renderer/block.d.ts +2 -0
- package/lib/renderer/block.js +48 -0
- package/lib/renderer/component.d.ts +2 -0
- package/lib/renderer/component.js +64 -0
- package/lib/renderer/index.d.ts +8 -0
- package/lib/renderer/index.js +18 -0
- package/lib/renderer/page.d.ts +2 -0
- package/lib/renderer/page.js +96 -0
- package/lib/renderer/renderer.d.ts +2 -0
- package/lib/renderer/renderer.js +235 -0
- package/lib/renderer/temp.d.ts +2 -0
- package/lib/renderer/temp.js +144 -0
- package/lib/style.js +1 -0
- package/lib/types/index.d.ts +275 -0
- package/lib/types/index.js +3 -0
- package/lib/utils/common.d.ts +119 -0
- package/lib/utils/common.js +409 -0
- package/lib/utils/data-helper.d.ts +74 -0
- package/lib/utils/data-helper.js +306 -0
- package/lib/utils/index.d.ts +3 -0
- package/lib/utils/index.js +21 -0
- package/lib/utils/is-use-loop.d.ts +2 -0
- package/lib/utils/is-use-loop.js +19 -0
- package/lib/utils/logger.d.ts +3 -0
- package/lib/utils/logger.js +9 -0
- package/lib/utils/request.d.ts +54 -0
- package/lib/utils/request.js +217 -0
- package/package.json +64 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import type { ComponentLifecycle, CSSProperties } from 'react';
|
|
2
|
+
import { BuiltinSimulatorHost, BuiltinSimulatorRenderer } from '@alilc/lowcode-designer';
|
|
3
|
+
import { RequestHandler, IPublicTypeNodeSchema, IPublicTypeRootSchema, IPublicTypeJSONObject } from '@alilc/lowcode-types';
|
|
4
|
+
export type ISchema = IPublicTypeNodeSchema | IPublicTypeRootSchema;
|
|
5
|
+
interface IGeneralComponent<P = {}, S = {}, SS = any> extends ComponentLifecycle<P, S, SS> {
|
|
6
|
+
readonly props: Readonly<P> & Readonly<{
|
|
7
|
+
children?: any | undefined;
|
|
8
|
+
}>;
|
|
9
|
+
state: Readonly<S>;
|
|
10
|
+
refs: Record<string, any>;
|
|
11
|
+
context: any;
|
|
12
|
+
setState<K extends keyof S>(state: ((prevState: Readonly<S>, props: Readonly<P>) => (Pick<S, K> | S | null)) | (Pick<S, K> | S | null), callback?: () => void): void;
|
|
13
|
+
forceUpdate(callback?: () => void): void;
|
|
14
|
+
render(): any;
|
|
15
|
+
}
|
|
16
|
+
export type IGeneralConstructor<T = {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}, S = {
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}, D = any> = new <TT = T, SS = S, DD = D>(props: TT, context: any) => IGeneralComponent<TT, SS, DD>;
|
|
21
|
+
/**
|
|
22
|
+
* duck-typed History
|
|
23
|
+
*
|
|
24
|
+
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md
|
|
25
|
+
*/
|
|
26
|
+
interface IHistoryLike {
|
|
27
|
+
readonly action: any;
|
|
28
|
+
readonly location: ILocationLike;
|
|
29
|
+
createHref: (to: any) => string;
|
|
30
|
+
push: (to: any, state?: any) => void;
|
|
31
|
+
replace: (to: any, state?: any) => void;
|
|
32
|
+
go: (delta: any) => void;
|
|
33
|
+
back: () => void;
|
|
34
|
+
forward: () => void;
|
|
35
|
+
listen: (listener: any) => () => void;
|
|
36
|
+
block: (blocker: any) => () => void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* duck-typed History.Location
|
|
40
|
+
*
|
|
41
|
+
* @see https://github.com/remix-run/history/blob/dev/docs/api-reference.md#location
|
|
42
|
+
*/
|
|
43
|
+
export interface ILocationLike {
|
|
44
|
+
pathname: any;
|
|
45
|
+
search: any;
|
|
46
|
+
state: any;
|
|
47
|
+
hash: any;
|
|
48
|
+
key?: any;
|
|
49
|
+
}
|
|
50
|
+
export type IRendererAppHelper = Partial<{
|
|
51
|
+
/** 全局公共函数 */
|
|
52
|
+
utils: Record<string, any>;
|
|
53
|
+
/** 全局常量 */
|
|
54
|
+
constants: Record<string, any>;
|
|
55
|
+
/** react-router 的 location 实例 */
|
|
56
|
+
location: ILocationLike;
|
|
57
|
+
/** react-router 的 history 实例 */
|
|
58
|
+
history: IHistoryLike;
|
|
59
|
+
/** @deprecated 已无业务使用 */
|
|
60
|
+
match: any;
|
|
61
|
+
/** @experimental 内部使用 */
|
|
62
|
+
logParams: Record<string, any>;
|
|
63
|
+
/** @experimental 内部使用 */
|
|
64
|
+
addons: Record<string, any>;
|
|
65
|
+
/** @experimental 内部使用 */
|
|
66
|
+
requestHandlersMap: Record<string, RequestHandler<{
|
|
67
|
+
data: unknown;
|
|
68
|
+
}>>;
|
|
69
|
+
}>;
|
|
70
|
+
/**
|
|
71
|
+
* 渲染模块可用配置
|
|
72
|
+
*
|
|
73
|
+
* @see @todo @承虎
|
|
74
|
+
*/
|
|
75
|
+
export interface IRendererProps {
|
|
76
|
+
/** 符合低代码搭建协议的数据 */
|
|
77
|
+
schema: IPublicTypeRootSchema | IPublicTypeNodeSchema;
|
|
78
|
+
/** 组件依赖的实例 */
|
|
79
|
+
components: Record<string, IGeneralComponent>;
|
|
80
|
+
/** CSS 类名 */
|
|
81
|
+
className?: string;
|
|
82
|
+
/** style */
|
|
83
|
+
style?: CSSProperties;
|
|
84
|
+
/** id */
|
|
85
|
+
id?: string | number;
|
|
86
|
+
/** 语言 */
|
|
87
|
+
locale?: string;
|
|
88
|
+
/**
|
|
89
|
+
* 多语言语料
|
|
90
|
+
* 配置规范参见《低代码搭建组件描述协议》https://lowcode-engine.cn/lowcode 中 2.6 国际化多语言支持
|
|
91
|
+
* */
|
|
92
|
+
messages?: Record<string, any>;
|
|
93
|
+
/** 主要用于设置渲染模块的全局上下文,里面定义的内容可以在低代码中通过 this 来访问,比如 this.utils */
|
|
94
|
+
appHelper?: IRendererAppHelper;
|
|
95
|
+
/**
|
|
96
|
+
* 配置规范参见《低代码搭建组件描述协议》https://lowcode-engine.cn/lowcode
|
|
97
|
+
* 主要在搭建场景中使用,用于提升用户搭建体验。
|
|
98
|
+
*
|
|
99
|
+
* > 在生产环境下不需要设置
|
|
100
|
+
*/
|
|
101
|
+
componentsMap?: {
|
|
102
|
+
[key: string]: any;
|
|
103
|
+
};
|
|
104
|
+
/** 设计模式,可选值:live、design */
|
|
105
|
+
designMode?: string;
|
|
106
|
+
/** 渲染模块是否挂起,当设置为 true 时,渲染模块最外层容器的 shouldComponentUpdate 将始终返回false,在下钻编辑或者多引擎渲染的场景会用到该参数。 */
|
|
107
|
+
suspended?: boolean;
|
|
108
|
+
/** 组件获取 ref 时触发的钩子 */
|
|
109
|
+
onCompGetRef?: (schema: IPublicTypeNodeSchema, ref: any) => void;
|
|
110
|
+
/** 组件 ctx 更新回调 */
|
|
111
|
+
onCompGetCtx?: (schema: IPublicTypeNodeSchema, ref: any) => void;
|
|
112
|
+
/** 传入的 schema 是否有变更 */
|
|
113
|
+
getSchemaChangedSymbol?: () => boolean;
|
|
114
|
+
/** 设置 schema 是否有变更 */
|
|
115
|
+
setSchemaChangedSymbol?: (symbol: boolean) => void;
|
|
116
|
+
/** 自定义创建 element 的钩子 */
|
|
117
|
+
customCreateElement?: (Component: any, props: any, children: any) => any;
|
|
118
|
+
/** 渲染类型,标识当前模块是以什么类型进行渲染的 */
|
|
119
|
+
rendererName?: 'LowCodeRenderer' | 'PageRenderer' | string;
|
|
120
|
+
/** 当找不到组件时,显示的组件 */
|
|
121
|
+
notFoundComponent?: IGeneralComponent;
|
|
122
|
+
/** 当组件渲染异常时,显示的组件 */
|
|
123
|
+
faultComponent?: IGeneralComponent;
|
|
124
|
+
/** */
|
|
125
|
+
faultComponentMap?: {
|
|
126
|
+
[prop: string]: IGeneralComponent;
|
|
127
|
+
};
|
|
128
|
+
/** 设备信息 */
|
|
129
|
+
device?: string;
|
|
130
|
+
/**
|
|
131
|
+
* @default true
|
|
132
|
+
* JSExpression 是否只支持使用 this 来访问上下文变量
|
|
133
|
+
*/
|
|
134
|
+
thisRequiredInJSE?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* @default false
|
|
137
|
+
* 当开启组件未找到严格模式时,渲染模块不会默认给一个容器组件
|
|
138
|
+
*/
|
|
139
|
+
enableStrictNotFoundMode?: boolean;
|
|
140
|
+
}
|
|
141
|
+
export interface IRendererState {
|
|
142
|
+
engineRenderError?: boolean;
|
|
143
|
+
error?: Error;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* 渲染内部模块可用配置
|
|
147
|
+
*/
|
|
148
|
+
export interface IBaseRendererProps {
|
|
149
|
+
locale?: string;
|
|
150
|
+
messages: Record<string, any>;
|
|
151
|
+
__appHelper: IRendererAppHelper;
|
|
152
|
+
__components: Record<string, any>;
|
|
153
|
+
__ctx: Record<string, any>;
|
|
154
|
+
__schema: IPublicTypeRootSchema;
|
|
155
|
+
__host?: BuiltinSimulatorHost;
|
|
156
|
+
__container?: BuiltinSimulatorRenderer;
|
|
157
|
+
config?: Record<string, any>;
|
|
158
|
+
designMode?: 'design';
|
|
159
|
+
className?: string;
|
|
160
|
+
style?: CSSProperties;
|
|
161
|
+
id?: string | number;
|
|
162
|
+
getSchemaChangedSymbol?: () => boolean;
|
|
163
|
+
setSchemaChangedSymbol?: (symbol: boolean) => void;
|
|
164
|
+
thisRequiredInJSE?: boolean;
|
|
165
|
+
documentId?: string;
|
|
166
|
+
getNode?: any;
|
|
167
|
+
/**
|
|
168
|
+
* 设备类型,默认值:'default'
|
|
169
|
+
*/
|
|
170
|
+
device?: 'default' | 'mobile' | string;
|
|
171
|
+
componentName?: string;
|
|
172
|
+
}
|
|
173
|
+
export interface INodeInfo {
|
|
174
|
+
schema?: IPublicTypeNodeSchema;
|
|
175
|
+
Comp: any;
|
|
176
|
+
componentInfo?: any;
|
|
177
|
+
componentChildren?: any;
|
|
178
|
+
}
|
|
179
|
+
export interface JSExpression {
|
|
180
|
+
type: string;
|
|
181
|
+
value: string;
|
|
182
|
+
}
|
|
183
|
+
export interface DataSourceItem {
|
|
184
|
+
id: string;
|
|
185
|
+
isInit?: boolean | JSExpression;
|
|
186
|
+
type?: string;
|
|
187
|
+
options?: {
|
|
188
|
+
uri: string | JSExpression;
|
|
189
|
+
params?: IPublicTypeJSONObject | JSExpression;
|
|
190
|
+
method?: string | JSExpression;
|
|
191
|
+
shouldFetch?: string;
|
|
192
|
+
willFetch?: string;
|
|
193
|
+
fit?: string;
|
|
194
|
+
didFetch?: string;
|
|
195
|
+
};
|
|
196
|
+
dataHandler?: JSExpression;
|
|
197
|
+
}
|
|
198
|
+
export interface DataSource {
|
|
199
|
+
list?: DataSourceItem[];
|
|
200
|
+
dataHandler?: JSExpression;
|
|
201
|
+
}
|
|
202
|
+
export interface IRuntime {
|
|
203
|
+
[key: string]: any;
|
|
204
|
+
Component: IGeneralConstructor;
|
|
205
|
+
PureComponent: IGeneralConstructor;
|
|
206
|
+
createElement: (...args: any) => any;
|
|
207
|
+
createContext: (...args: any) => any;
|
|
208
|
+
forwardRef: (...args: any) => any;
|
|
209
|
+
findDOMNode: (...args: any) => any;
|
|
210
|
+
}
|
|
211
|
+
export interface IRendererModules {
|
|
212
|
+
BaseRenderer?: IBaseRenderComponent;
|
|
213
|
+
PageRenderer: IBaseRenderComponent;
|
|
214
|
+
ComponentRenderer: IBaseRenderComponent;
|
|
215
|
+
BlockRenderer?: IBaseRenderComponent;
|
|
216
|
+
AddonRenderer?: IBaseRenderComponent;
|
|
217
|
+
TempRenderer?: IBaseRenderComponent;
|
|
218
|
+
DivRenderer?: IBaseRenderComponent;
|
|
219
|
+
}
|
|
220
|
+
export interface IBaseRendererContext {
|
|
221
|
+
appHelper: IRendererAppHelper;
|
|
222
|
+
components: Record<string, IGeneralComponent>;
|
|
223
|
+
engine: IRuntime;
|
|
224
|
+
pageContext?: IBaseRenderComponent;
|
|
225
|
+
compContext?: IBaseRenderComponent;
|
|
226
|
+
}
|
|
227
|
+
export type IBaseRendererInstance = IGeneralComponent<IBaseRendererProps, Record<string, any>, any> & {
|
|
228
|
+
reloadDataSource(): Promise<any>;
|
|
229
|
+
__beforeInit(props: IBaseRendererProps): void;
|
|
230
|
+
__init(props: IBaseRendererProps): void;
|
|
231
|
+
__afterInit(props: IBaseRendererProps): void;
|
|
232
|
+
__executeLifeCycleMethod(method: string, args?: any[]): void;
|
|
233
|
+
__bindCustomMethods(props: IBaseRendererProps): void;
|
|
234
|
+
__generateCtx(ctx: Record<string, any>): void;
|
|
235
|
+
__parseData(data: any, ctx?: any): any;
|
|
236
|
+
__initDataSource(props: IBaseRendererProps): void;
|
|
237
|
+
__render(): void;
|
|
238
|
+
__getRef(ref: any): void;
|
|
239
|
+
__getSchemaChildrenVirtualDom(schema: IPublicTypeNodeSchema | undefined, Comp: any, nodeChildrenMap?: any): any;
|
|
240
|
+
__getComponentProps(schema: IPublicTypeNodeSchema | undefined, scope: any, Comp: any, componentInfo?: any): any;
|
|
241
|
+
__createDom(): any;
|
|
242
|
+
__createVirtualDom(schema: any, self: any, parentInfo: INodeInfo, idx: string | number): any;
|
|
243
|
+
__createLoopVirtualDom(schema: any, self: any, parentInfo: INodeInfo, idx: number | string): any;
|
|
244
|
+
__parseProps(props: any, self: any, path: string, info: INodeInfo): any;
|
|
245
|
+
__initDebug?(): void;
|
|
246
|
+
__debug(...args: any[]): void;
|
|
247
|
+
__renderContextProvider(customProps?: object, children?: any): any;
|
|
248
|
+
__renderContextConsumer(children: any): any;
|
|
249
|
+
__renderContent(children: any): any;
|
|
250
|
+
__checkSchema(schema: IPublicTypeNodeSchema | undefined, extraComponents?: string | string[]): any;
|
|
251
|
+
__renderComp(Comp: any, ctxProps: object): any;
|
|
252
|
+
$(filedId: string, instance?: any): any;
|
|
253
|
+
};
|
|
254
|
+
export interface IBaseRenderComponent {
|
|
255
|
+
new (props: IBaseRendererProps, context: any): IBaseRendererInstance;
|
|
256
|
+
}
|
|
257
|
+
export interface IRenderComponent {
|
|
258
|
+
displayName: string;
|
|
259
|
+
defaultProps: IRendererProps;
|
|
260
|
+
findDOMNode: (...args: any) => any;
|
|
261
|
+
new (props: IRendererProps, context: any): IGeneralComponent<IRendererProps, IRendererState> & {
|
|
262
|
+
[x: string]: any;
|
|
263
|
+
__getRef: (ref: any) => void;
|
|
264
|
+
componentDidMount(): Promise<void> | void;
|
|
265
|
+
componentDidUpdate(): Promise<void> | void;
|
|
266
|
+
componentWillUnmount(): Promise<void> | void;
|
|
267
|
+
componentDidCatch(e: any): Promise<void> | void;
|
|
268
|
+
shouldComponentUpdate(nextProps: IRendererProps): boolean;
|
|
269
|
+
isValidComponent(SetComponent: any): any;
|
|
270
|
+
createElement(SetComponent: any, props: any, children?: any): any;
|
|
271
|
+
getNotFoundComponent(): any;
|
|
272
|
+
getFaultComponent(): any;
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
export {};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { IPublicTypeRootSchema, IPublicTypeNodeSchema, IPublicTypeJSSlot } from '@alilc/lowcode-types';
|
|
2
|
+
export { pick, isEqualWith as deepEqual, cloneDeep as clone, isEmpty, throttle, debounce } from 'lodash';
|
|
3
|
+
/**
|
|
4
|
+
* check if schema passed in is a valid schema
|
|
5
|
+
* @name isSchema
|
|
6
|
+
* @returns boolean
|
|
7
|
+
*/
|
|
8
|
+
export declare function isSchema(schema: any): schema is IPublicTypeNodeSchema;
|
|
9
|
+
/**
|
|
10
|
+
* check if schema passed in is a container type, including : Component Block Page
|
|
11
|
+
* @param schema
|
|
12
|
+
* @returns boolean
|
|
13
|
+
*/
|
|
14
|
+
export declare function isFileSchema(schema: IPublicTypeNodeSchema): schema is IPublicTypeRootSchema;
|
|
15
|
+
/**
|
|
16
|
+
* check if current page is nested within another page with same host
|
|
17
|
+
* @returns boolean
|
|
18
|
+
*/
|
|
19
|
+
export declare function inSameDomain(): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* get css styled name from schema`s fileName
|
|
22
|
+
* FileName -> lce-file-name
|
|
23
|
+
* @returns string
|
|
24
|
+
*/
|
|
25
|
+
export declare function getFileCssName(fileName: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* check if a object is type of JSSlot
|
|
28
|
+
* @returns string
|
|
29
|
+
*/
|
|
30
|
+
export declare function isJSSlot(obj: any): obj is IPublicTypeJSSlot;
|
|
31
|
+
/**
|
|
32
|
+
* get value from an object
|
|
33
|
+
* @returns string
|
|
34
|
+
*/
|
|
35
|
+
export declare function getValue(obj: any, path: string, defaultValue?: {}): any;
|
|
36
|
+
/**
|
|
37
|
+
* 用于处理国际化字符串
|
|
38
|
+
* @param {*} key 语料标识
|
|
39
|
+
* @param {*} values 字符串模版变量
|
|
40
|
+
* @param {*} locale 国际化标识,例如 zh-CN、en-US
|
|
41
|
+
* @param {*} messages 国际化语言包
|
|
42
|
+
*/
|
|
43
|
+
export declare function getI18n(key: string, values?: {}, locale?: string, messages?: Record<string, any>): string | void | (string | void)[];
|
|
44
|
+
/**
|
|
45
|
+
* 判断当前组件是否能够设置ref
|
|
46
|
+
* @param {*} Comp 需要判断的组件
|
|
47
|
+
*/
|
|
48
|
+
export declare function canAcceptsRef(Comp: any): any;
|
|
49
|
+
/**
|
|
50
|
+
* transform array to a object
|
|
51
|
+
* @param arr array to be transformed
|
|
52
|
+
* @param key key of array item, which`s value will be used as key in result map
|
|
53
|
+
* @param overwrite overwrite existing item in result or not
|
|
54
|
+
* @returns object result map
|
|
55
|
+
*/
|
|
56
|
+
export declare function transformArrayToMap(arr: any[], key: string, overwrite?: boolean): any;
|
|
57
|
+
/**
|
|
58
|
+
* transform string to a function
|
|
59
|
+
* @param str function in string form
|
|
60
|
+
* @returns funtion
|
|
61
|
+
*/
|
|
62
|
+
export declare function transformStringToFunction(str: string): any;
|
|
63
|
+
/**
|
|
64
|
+
* 对象类型JSExpression,支持省略this
|
|
65
|
+
* @param str expression in string form
|
|
66
|
+
* @param self scope object
|
|
67
|
+
* @returns funtion
|
|
68
|
+
*/
|
|
69
|
+
declare function parseExpression(options: {
|
|
70
|
+
str: any;
|
|
71
|
+
self: any;
|
|
72
|
+
thisRequired?: boolean;
|
|
73
|
+
logScope?: string;
|
|
74
|
+
}): any;
|
|
75
|
+
declare function parseExpression(str: any, self: any, thisRequired?: boolean): any;
|
|
76
|
+
export { parseExpression, };
|
|
77
|
+
export declare function parseThisRequiredExpression(str: any, self: any): any;
|
|
78
|
+
/**
|
|
79
|
+
* capitalize first letter
|
|
80
|
+
* @param word string to be proccessed
|
|
81
|
+
* @returns string capitalized string
|
|
82
|
+
*/
|
|
83
|
+
export declare function capitalizeFirstLetter(word: string): string;
|
|
84
|
+
/**
|
|
85
|
+
* check str passed in is a string type of not
|
|
86
|
+
* @param str obj to be checked
|
|
87
|
+
* @returns boolean
|
|
88
|
+
*/
|
|
89
|
+
export declare function isString(str: any): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* check if obj is type of variable structure
|
|
92
|
+
* @param obj object to be checked
|
|
93
|
+
* @returns boolean
|
|
94
|
+
*/
|
|
95
|
+
export declare function isVariable(obj: any): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* 将 i18n 结构,降级解释为对 i18n 接口的调用
|
|
98
|
+
* @param i18nInfo object
|
|
99
|
+
* @param self context
|
|
100
|
+
*/
|
|
101
|
+
export declare function parseI18n(i18nInfo: any, self: any): any;
|
|
102
|
+
/**
|
|
103
|
+
* for each key in targetObj, run fn with the value of the value, and the context paased in.
|
|
104
|
+
* @param targetObj object that keys will be for each
|
|
105
|
+
* @param fn function that process each item
|
|
106
|
+
* @param context
|
|
107
|
+
*/
|
|
108
|
+
export declare function forEach(targetObj: any, fn: any, context?: any): void;
|
|
109
|
+
interface IParseOptions {
|
|
110
|
+
thisRequiredInJSE?: boolean;
|
|
111
|
+
logScope?: string;
|
|
112
|
+
}
|
|
113
|
+
export declare function parseData(schema: unknown, self: any, options?: IParseOptions): any;
|
|
114
|
+
/**
|
|
115
|
+
* process params for using in a url query
|
|
116
|
+
* @param obj params to be processed
|
|
117
|
+
* @returns string
|
|
118
|
+
*/
|
|
119
|
+
export declare function serializeParams(obj: any): any;
|