@easy-editor/react-renderer 0.0.17 → 1.0.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.
- package/README.md +12 -1
- package/dist/adapter/index.d.ts +17 -0
- package/dist/{renderer-core/base.d.ts → base.d.ts} +2 -2
- package/dist/component.d.ts +2 -0
- package/dist/components/FaultComponent.d.ts +4 -0
- package/dist/components/NotFoundComponent.d.ts +4 -0
- package/dist/{renderer-core/hoc → hoc}/leaf.d.ts +2 -1
- package/dist/{cjs/index.js → index.cjs} +374 -583
- package/dist/index.d.ts +10 -3
- package/dist/index.js +324 -516
- package/dist/page.d.ts +2 -0
- package/dist/renderer.d.ts +2 -0
- package/dist/setting-renderer/context.d.ts +8 -0
- package/dist/setting-renderer/index.d.ts +8 -0
- package/dist/types.d.ts +7 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/is.d.ts +3 -0
- package/package.json +16 -21
- package/dist/cjs/index.development.js +0 -2734
- package/dist/cjs/index.development.js.map +0 -1
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/index.production.js +0 -2734
- package/dist/cjs/index.production.js.map +0 -1
- package/dist/configure-renderer/context.d.ts +0 -13
- package/dist/configure-renderer/index.d.ts +0 -10
- package/dist/esm/index.development.js +0 -2699
- package/dist/esm/index.development.js.map +0 -1
- package/dist/esm/index.js +0 -2699
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.production.js +0 -2699
- package/dist/esm/index.production.js.map +0 -1
- package/dist/renderer-core/adapter/index.d.ts +0 -17
- package/dist/renderer-core/component.d.ts +0 -2
- package/dist/renderer-core/components/FaultComponent.d.ts +0 -7
- package/dist/renderer-core/components/NotFoundComponent.d.ts +0 -7
- package/dist/renderer-core/index.d.ts +0 -9
- package/dist/renderer-core/page.d.ts +0 -2
- package/dist/renderer-core/renderer.d.ts +0 -2
- package/dist/renderer-core/types.d.ts +0 -187
- package/dist/renderer-core/utils/classnames.d.ts +0 -1
- package/dist/renderer-core/utils/common.d.ts +0 -53
- package/dist/renderer-core/utils/index.d.ts +0 -4
- package/dist/renderer-core/utils/logger.d.ts +0 -5
- /package/dist/{renderer-core/context.d.ts → context.d.ts} +0 -0
- /package/dist/{renderer-core/hoc → hoc}/comp.d.ts +0 -0
- /package/dist/{renderer-core/hoc → hoc}/index.d.ts +0 -0
- /package/dist/{configure-renderer → setting-renderer}/SettingSetter.d.ts +0 -0
- /package/dist/{renderer-core/utils → utils}/hoc.d.ts +0 -0
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { NodeSchema } from '@easy-editor/core';
|
|
2
|
-
import type { FC } from 'react';
|
|
3
|
-
export interface NotFoundComponentProps extends NodeSchema {
|
|
4
|
-
enableStrictNotFoundMode?: boolean;
|
|
5
|
-
}
|
|
6
|
-
declare const NotFoundComponent: FC<NotFoundComponentProps>;
|
|
7
|
-
export default NotFoundComponent;
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import type { DesignMode, JSONObject, Node, NodeSchema, RootSchema, Simulator, SimulatorRenderer } from '@easy-editor/core';
|
|
2
|
-
import type { Component } from 'react';
|
|
3
|
-
import type { FaultComponentProps } from './components/FaultComponent';
|
|
4
|
-
import type { NotFoundComponentProps } from './components/NotFoundComponent';
|
|
5
|
-
export type Schema = NodeSchema | RootSchema;
|
|
6
|
-
export interface RendererState {
|
|
7
|
-
engineRenderError?: boolean;
|
|
8
|
-
error?: Error;
|
|
9
|
-
}
|
|
10
|
-
export interface RendererProps {
|
|
11
|
-
/** 符合低代码搭建协议的数据 */
|
|
12
|
-
schema: RootSchema | NodeSchema;
|
|
13
|
-
/** 组件依赖的实例 */
|
|
14
|
-
components: Record<string, React.ComponentType<any>>;
|
|
15
|
-
/** CSS 类名 */
|
|
16
|
-
className?: string;
|
|
17
|
-
/** style */
|
|
18
|
-
style?: React.CSSProperties;
|
|
19
|
-
/** id */
|
|
20
|
-
id?: string | number;
|
|
21
|
-
/** 当前文档的 id */
|
|
22
|
-
documentId?: string;
|
|
23
|
-
/** 主要用于设置渲染模块的全局上下文,里面定义的内容可以在低代码中通过 this 来访问,比如 this.utils */
|
|
24
|
-
appHelper?: RendererAppHelper;
|
|
25
|
-
/**
|
|
26
|
-
* 配置规范参见《低代码搭建组件描述协议》https://lowcode-engine.cn/lowcode
|
|
27
|
-
* 主要在搭建场景中使用,用于提升用户搭建体验。
|
|
28
|
-
*
|
|
29
|
-
* > 在生产环境下不需要设置
|
|
30
|
-
*/
|
|
31
|
-
componentsMap?: Record<string, any>;
|
|
32
|
-
/** 设计模式,可选值:live、design */
|
|
33
|
-
designMode?: DesignMode;
|
|
34
|
-
/** 渲染模块是否挂起,当设置为 true 时,渲染模块最外层容器的 shouldComponentUpdate 将始终返回false,在下钻编辑或者多引擎渲染的场景会用到该参数。 */
|
|
35
|
-
suspended?: boolean;
|
|
36
|
-
/** 组件获取 ref 时触发的钩子 */
|
|
37
|
-
onCompGetRef?: (schema: NodeSchema, ref: any) => void;
|
|
38
|
-
/** 组件 ctx 更新回调 */
|
|
39
|
-
onCompGetCtx?: (schema: NodeSchema, ref: any) => void;
|
|
40
|
-
/** 传入的 schema 是否有变更 */
|
|
41
|
-
getSchemaChangedSymbol?: () => boolean;
|
|
42
|
-
/** 设置 schema 是否有变更 */
|
|
43
|
-
setSchemaChangedSymbol?: (symbol: boolean) => void;
|
|
44
|
-
/** 自定义创建 element 的钩子 */
|
|
45
|
-
customCreateElement?: (Component: any, props: any, children: any) => any;
|
|
46
|
-
/** 渲染类型,标识当前模块是以什么类型进行渲染的 */
|
|
47
|
-
rendererName?: 'LowCodeRenderer' | 'PageRenderer' | string;
|
|
48
|
-
/** 当找不到组件时,显示的组件 */
|
|
49
|
-
notFoundComponent?: React.ComponentType<NotFoundComponentProps>;
|
|
50
|
-
/** 当组件渲染异常时,显示的组件 */
|
|
51
|
-
faultComponent?: React.ComponentType<FaultComponentProps>;
|
|
52
|
-
/** 设备信息 */
|
|
53
|
-
device?: 'default' | 'pc' | 'mobile' | string;
|
|
54
|
-
/**
|
|
55
|
-
* 当开启组件未找到严格模式时,渲染模块不会默认给一个容器组件
|
|
56
|
-
* @default false
|
|
57
|
-
*/
|
|
58
|
-
enableStrictNotFoundMode?: boolean;
|
|
59
|
-
/** 获取节点的方法 */
|
|
60
|
-
getNode?: (id: string) => Node;
|
|
61
|
-
/** 渲染模块的 host */
|
|
62
|
-
__host?: Simulator;
|
|
63
|
-
/** 渲染模块的 container */
|
|
64
|
-
__container?: SimulatorRenderer;
|
|
65
|
-
/**
|
|
66
|
-
* 是否在设计模式下执行生命周期方法
|
|
67
|
-
* @default false
|
|
68
|
-
*/
|
|
69
|
-
excuteLifeCycleInDesignMode?: boolean;
|
|
70
|
-
}
|
|
71
|
-
export interface RenderComponent {
|
|
72
|
-
displayName: string;
|
|
73
|
-
defaultProps: RendererProps;
|
|
74
|
-
new (props: RendererProps): RendererComponentInstance;
|
|
75
|
-
}
|
|
76
|
-
export interface RendererComponentInstance extends Component<RendererProps, RendererState> {
|
|
77
|
-
[x: string]: any;
|
|
78
|
-
__getRef: (ref: any) => void;
|
|
79
|
-
componentDidMount(): Promise<void> | void;
|
|
80
|
-
componentDidUpdate(): Promise<void> | void;
|
|
81
|
-
componentWillUnmount(): Promise<void> | void;
|
|
82
|
-
componentDidCatch(e: any): Promise<void> | void;
|
|
83
|
-
shouldComponentUpdate(nextProps: RendererProps): boolean;
|
|
84
|
-
isValidComponent(SetComponent: any): any;
|
|
85
|
-
createElement(SetComponent: any, props: any, children?: any): any;
|
|
86
|
-
getNotFoundComponent(): any;
|
|
87
|
-
getFaultComponent(): any;
|
|
88
|
-
}
|
|
89
|
-
export interface RendererAppHelper {
|
|
90
|
-
/** 全局公共函数 */
|
|
91
|
-
utils?: Record<string, any>;
|
|
92
|
-
/** 全局常量 */
|
|
93
|
-
constants?: Record<string, any>;
|
|
94
|
-
/** @experimental 内部使用 */
|
|
95
|
-
requestHandlersMap?: Record<string, any>;
|
|
96
|
-
}
|
|
97
|
-
export interface NodeInfo {
|
|
98
|
-
schema?: NodeSchema;
|
|
99
|
-
Comp: any;
|
|
100
|
-
componentInfo?: any;
|
|
101
|
-
componentChildren?: any;
|
|
102
|
-
}
|
|
103
|
-
export interface JSExpression {
|
|
104
|
-
type: string;
|
|
105
|
-
value: string;
|
|
106
|
-
}
|
|
107
|
-
export interface DataSourceItem {
|
|
108
|
-
id: string;
|
|
109
|
-
isInit?: boolean | JSExpression;
|
|
110
|
-
type?: string;
|
|
111
|
-
options?: {
|
|
112
|
-
uri: string | JSExpression;
|
|
113
|
-
params?: JSONObject | JSExpression;
|
|
114
|
-
method?: string | JSExpression;
|
|
115
|
-
shouldFetch?: string;
|
|
116
|
-
willFetch?: string;
|
|
117
|
-
fit?: string;
|
|
118
|
-
didFetch?: string;
|
|
119
|
-
};
|
|
120
|
-
dataHandler?: JSExpression;
|
|
121
|
-
}
|
|
122
|
-
export interface DataSource {
|
|
123
|
-
list?: DataSourceItem[];
|
|
124
|
-
dataHandler?: JSExpression;
|
|
125
|
-
}
|
|
126
|
-
export interface BaseRendererProps extends RendererProps {
|
|
127
|
-
__appHelper?: RendererAppHelper;
|
|
128
|
-
__components: Record<string, React.ComponentType>;
|
|
129
|
-
__ctx?: Record<string, any>;
|
|
130
|
-
__schema: RootSchema;
|
|
131
|
-
__designMode?: DesignMode;
|
|
132
|
-
__host?: Simulator;
|
|
133
|
-
__container?: SimulatorRenderer;
|
|
134
|
-
config?: Record<string, any>;
|
|
135
|
-
designMode?: DesignMode;
|
|
136
|
-
className?: string;
|
|
137
|
-
style?: React.CSSProperties;
|
|
138
|
-
id?: string | number;
|
|
139
|
-
getSchemaChangedSymbol?: () => boolean;
|
|
140
|
-
setSchemaChangedSymbol?: (symbol: boolean) => void;
|
|
141
|
-
documentId?: string;
|
|
142
|
-
getNode?: any;
|
|
143
|
-
/**
|
|
144
|
-
* 设备类型,默认值:'default'
|
|
145
|
-
*/
|
|
146
|
-
device?: 'default' | 'pc' | 'mobile' | string;
|
|
147
|
-
componentName?: string;
|
|
148
|
-
}
|
|
149
|
-
export interface BaseRendererContext {
|
|
150
|
-
appHelper: RendererAppHelper;
|
|
151
|
-
components: Record<string, React.ComponentType>;
|
|
152
|
-
engine: RendererComponentInstance;
|
|
153
|
-
pageContext?: BaseRenderComponent;
|
|
154
|
-
compContext?: BaseRenderComponent;
|
|
155
|
-
}
|
|
156
|
-
export type BaseRendererInstance = Component<BaseRendererProps, Record<string, any>, any> & {
|
|
157
|
-
reloadDataSource(): Promise<any>;
|
|
158
|
-
__beforeInit(props: BaseRendererProps): void;
|
|
159
|
-
__init(props: BaseRendererProps): void;
|
|
160
|
-
__afterInit(props: BaseRendererProps): void;
|
|
161
|
-
__executeLifeCycleMethod(method: string, args?: any[]): void;
|
|
162
|
-
__getComponentView(): React.ComponentType | undefined;
|
|
163
|
-
__bindCustomMethods(props: BaseRendererProps): void;
|
|
164
|
-
__generateCtx(ctx: Record<string, any>): void;
|
|
165
|
-
__parseData(data: any, ctx?: any): any;
|
|
166
|
-
__initDataSource(props: BaseRendererProps): void;
|
|
167
|
-
__writeCss(props: BaseRendererProps): void;
|
|
168
|
-
__render(): void;
|
|
169
|
-
__getRef(ref: any): void;
|
|
170
|
-
__getSchemaChildrenVirtualDom(schema: NodeSchema | undefined, Comp: any, nodeChildrenMap?: any): any;
|
|
171
|
-
__getComponentProps(schema: NodeSchema | undefined, scope: any, Comp: any, componentInfo?: any): any;
|
|
172
|
-
__createDom(): any;
|
|
173
|
-
__createVirtualDom(schema: any, self: any, parentInfo: NodeInfo, idx: string | number): any;
|
|
174
|
-
__createLoopVirtualDom(schema: any, self: any, parentInfo: NodeInfo, idx: number | string): any;
|
|
175
|
-
__parseProps(props: any, self: any, path: string, info: NodeInfo): any;
|
|
176
|
-
__renderContextProvider(customProps?: object, children?: any): any;
|
|
177
|
-
__renderContextConsumer(children: any): any;
|
|
178
|
-
__renderContent(children: any): any;
|
|
179
|
-
__checkSchema(schema: NodeSchema | undefined, extraComponents?: string | string[]): any;
|
|
180
|
-
__renderComp(Comp: any, ctxProps: object): any;
|
|
181
|
-
$(id: string, instance?: any): any;
|
|
182
|
-
context: BaseRendererContext;
|
|
183
|
-
__designModeIsDesign?: boolean;
|
|
184
|
-
};
|
|
185
|
-
export interface BaseRenderComponent {
|
|
186
|
-
new (props: BaseRendererProps): BaseRendererInstance;
|
|
187
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const classnames: (...args: any[]) => string;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { type NodeSchema } from '@easy-editor/core';
|
|
2
|
-
import { type ComponentClass, type ComponentType } from 'react';
|
|
3
|
-
export declare function inSameDomain(): boolean;
|
|
4
|
-
/**
|
|
5
|
-
* get css styled name from schema`s fileName
|
|
6
|
-
* FileName -> lce-file-name
|
|
7
|
-
* @returns string
|
|
8
|
-
*/
|
|
9
|
-
export declare function getFileCssName(fileName: string): string | undefined;
|
|
10
|
-
export declare const isSchema: (schema: any) => schema is NodeSchema;
|
|
11
|
-
export declare const getValue: (obj: any, path: string, defaultValue?: {}) => any;
|
|
12
|
-
export declare function transformArrayToMap(arr: any[], key: string, overwrite?: boolean): any;
|
|
13
|
-
interface IParseOptions {
|
|
14
|
-
logScope?: string;
|
|
15
|
-
}
|
|
16
|
-
export declare const parseData: (schema: unknown, self: any, options?: IParseOptions) => any;
|
|
17
|
-
export declare const isUseLoop: (loop: null | any[], isDesignMode: boolean) => boolean;
|
|
18
|
-
export declare function checkPropTypes(value: any, name: string, rule: any, componentName: string): boolean;
|
|
19
|
-
/**
|
|
20
|
-
* transform string to a function
|
|
21
|
-
* @param str function in string form
|
|
22
|
-
* @returns funtion
|
|
23
|
-
*/
|
|
24
|
-
export declare function transformStringToFunction(str: string): any;
|
|
25
|
-
/**
|
|
26
|
-
* 对象类型JSExpression,支持省略this
|
|
27
|
-
* @param str expression in string form
|
|
28
|
-
* @param self scope object
|
|
29
|
-
* @returns funtion
|
|
30
|
-
*/
|
|
31
|
-
declare function parseExpression(options: {
|
|
32
|
-
str: any;
|
|
33
|
-
self: any;
|
|
34
|
-
thisRequired?: boolean;
|
|
35
|
-
logScope?: string;
|
|
36
|
-
}): any;
|
|
37
|
-
declare function parseExpression(str: any, self: any, thisRequired?: boolean): any;
|
|
38
|
-
export { parseExpression };
|
|
39
|
-
export declare function parseThisRequiredExpression(str: any, self: any): any;
|
|
40
|
-
/**
|
|
41
|
-
* check str passed in is a string type of not
|
|
42
|
-
* @param str obj to be checked
|
|
43
|
-
* @returns boolean
|
|
44
|
-
*/
|
|
45
|
-
export declare function isString(str: any): boolean;
|
|
46
|
-
/**
|
|
47
|
-
* capitalize first letter
|
|
48
|
-
* @param word string to be proccessed
|
|
49
|
-
* @returns string capitalized string
|
|
50
|
-
*/
|
|
51
|
-
export declare function capitalizeFirstLetter(word: string): string;
|
|
52
|
-
export declare const isReactClass: (obj: any) => obj is ComponentClass<any>;
|
|
53
|
-
export declare function isReactComponent(obj: any): obj is ComponentType<any>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|