@easy-editor/react-renderer 0.0.1 → 0.0.2-alpha.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/dist/cjs/index.development.js +6 -10
- package/dist/cjs/index.development.js.map +1 -1
- package/dist/cjs/index.js +6 -10
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.production.js +6 -10
- package/dist/cjs/index.production.js.map +1 -1
- package/dist/esm/index.development.js +6 -10
- package/dist/esm/index.development.js.map +1 -1
- package/dist/esm/index.js +6 -10
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.production.js +6 -10
- package/dist/esm/index.production.js.map +1 -1
- package/dist/index.js +6 -10
- package/dist/renderer-core/base.d.ts +1 -1
- package/dist/renderer-core/types.d.ts +0 -6
- package/dist/renderer-core/utils/common.d.ts +0 -1
- package/package.json +3 -4
- package/CHANGELOG.md +0 -9
package/dist/index.js
CHANGED
|
@@ -357,7 +357,7 @@ const parseData = (schema, self, options = {}) => {
|
|
|
357
357
|
return parseExpression({
|
|
358
358
|
str: schema,
|
|
359
359
|
self,
|
|
360
|
-
thisRequired:
|
|
360
|
+
thisRequired: true,
|
|
361
361
|
logScope: options.logScope
|
|
362
362
|
});
|
|
363
363
|
}
|
|
@@ -1036,7 +1036,7 @@ const leafWrapper = (Comp, {
|
|
|
1036
1036
|
/**
|
|
1037
1037
|
* execute method in schema.lifeCycles with context
|
|
1038
1038
|
*/
|
|
1039
|
-
function executeLifeCycleMethod(context, schema, method, args
|
|
1039
|
+
function executeLifeCycleMethod(context, schema, method, args) {
|
|
1040
1040
|
if (!context || !isSchema(schema) || !method) {
|
|
1041
1041
|
return;
|
|
1042
1042
|
}
|
|
@@ -1048,7 +1048,7 @@ function executeLifeCycleMethod(context, schema, method, args, thisRequiredInJSE
|
|
|
1048
1048
|
|
|
1049
1049
|
// TODO: cache
|
|
1050
1050
|
if (isJSExpression(fn) || isJSFunction(fn)) {
|
|
1051
|
-
fn =
|
|
1051
|
+
fn = parseExpression(fn, context, true);
|
|
1052
1052
|
}
|
|
1053
1053
|
if (typeof fn !== 'function') {
|
|
1054
1054
|
logger.error(`生命周期${method}类型不符`, fn);
|
|
@@ -1114,7 +1114,6 @@ function baseRendererFactory() {
|
|
|
1114
1114
|
return parseExpression({
|
|
1115
1115
|
str,
|
|
1116
1116
|
self,
|
|
1117
|
-
thisRequired: props?.thisRequiredInJSE,
|
|
1118
1117
|
logScope: props.componentName
|
|
1119
1118
|
});
|
|
1120
1119
|
};
|
|
@@ -1131,7 +1130,7 @@ function baseRendererFactory() {
|
|
|
1131
1130
|
}
|
|
1132
1131
|
__afterInit(props) {}
|
|
1133
1132
|
static getDerivedStateFromProps(props, state) {
|
|
1134
|
-
const result = executeLifeCycleMethod(this, props?.__schema, 'getDerivedStateFromProps', [props, state]
|
|
1133
|
+
const result = executeLifeCycleMethod(this, props?.__schema, 'getDerivedStateFromProps', [props, state]);
|
|
1135
1134
|
return result === undefined ? null : result;
|
|
1136
1135
|
}
|
|
1137
1136
|
async getSnapshotBeforeUpdate(...args) {
|
|
@@ -1187,7 +1186,7 @@ function baseRendererFactory() {
|
|
|
1187
1186
|
* execute method in schema.lifeCycles
|
|
1188
1187
|
*/
|
|
1189
1188
|
__executeLifeCycleMethod = (method, args) => {
|
|
1190
|
-
executeLifeCycleMethod(this, this.props.__schema, method, args
|
|
1189
|
+
executeLifeCycleMethod(this, this.props.__schema, method, args);
|
|
1191
1190
|
};
|
|
1192
1191
|
|
|
1193
1192
|
/**
|
|
@@ -1243,11 +1242,9 @@ function baseRendererFactory() {
|
|
|
1243
1242
|
__parseData = (data, ctx) => {
|
|
1244
1243
|
const {
|
|
1245
1244
|
__ctx,
|
|
1246
|
-
thisRequiredInJSE,
|
|
1247
1245
|
componentName
|
|
1248
1246
|
} = this.props;
|
|
1249
1247
|
return parseData(data, ctx || __ctx || this, {
|
|
1250
|
-
thisRequiredInJSE,
|
|
1251
1248
|
logScope: componentName
|
|
1252
1249
|
});
|
|
1253
1250
|
};
|
|
@@ -2017,8 +2014,7 @@ function rendererFactory() {
|
|
|
2017
2014
|
suspended: false,
|
|
2018
2015
|
schema: {},
|
|
2019
2016
|
onCompGetRef: () => {},
|
|
2020
|
-
onCompGetCtx: () => {}
|
|
2021
|
-
thisRequiredInJSE: true
|
|
2017
|
+
onCompGetCtx: () => {}
|
|
2022
2018
|
};
|
|
2023
2019
|
constructor(props) {
|
|
2024
2020
|
super(props);
|
|
@@ -3,7 +3,7 @@ import type { BaseRenderComponent } from './types';
|
|
|
3
3
|
/**
|
|
4
4
|
* execute method in schema.lifeCycles with context
|
|
5
5
|
*/
|
|
6
|
-
export declare function executeLifeCycleMethod(context: any, schema: RootSchema, method: string, args: any
|
|
6
|
+
export declare function executeLifeCycleMethod(context: any, schema: RootSchema, method: string, args: any): any;
|
|
7
7
|
/**
|
|
8
8
|
* get children from a node schema
|
|
9
9
|
*/
|
|
@@ -51,11 +51,6 @@ export interface RendererProps {
|
|
|
51
51
|
faultComponent?: React.ComponentType<FaultComponentProps>;
|
|
52
52
|
/** 设备信息 */
|
|
53
53
|
device?: 'default' | 'pc' | 'mobile' | string;
|
|
54
|
-
/**
|
|
55
|
-
* @default true
|
|
56
|
-
* JSExpression 是否只支持使用 this 来访问上下文变量
|
|
57
|
-
*/
|
|
58
|
-
thisRequiredInJSE?: boolean;
|
|
59
54
|
/**
|
|
60
55
|
* @default false
|
|
61
56
|
* 当开启组件未找到严格模式时,渲染模块不会默认给一个容器组件
|
|
@@ -137,7 +132,6 @@ export interface BaseRendererProps {
|
|
|
137
132
|
id?: string | number;
|
|
138
133
|
getSchemaChangedSymbol?: () => boolean;
|
|
139
134
|
setSchemaChangedSymbol?: (symbol: boolean) => void;
|
|
140
|
-
thisRequiredInJSE?: boolean;
|
|
141
135
|
documentId?: string;
|
|
142
136
|
getNode?: any;
|
|
143
137
|
/**
|
|
@@ -11,7 +11,6 @@ export declare const isSchema: (schema: any) => schema is NodeSchema;
|
|
|
11
11
|
export declare const getValue: (obj: any, path: string, defaultValue?: {}) => any;
|
|
12
12
|
export declare function transformArrayToMap(arr: any[], key: string, overwrite?: boolean): any;
|
|
13
13
|
interface IParseOptions {
|
|
14
|
-
thisRequiredInJSE?: boolean;
|
|
15
14
|
logScope?: string;
|
|
16
15
|
}
|
|
17
16
|
export declare const parseData: (schema: unknown, self: any, options?: IParseOptions) => any;
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easy-editor/react-renderer",
|
|
3
|
-
"version": "0.0.1",
|
|
3
|
+
"version": "0.0.2-alpha.1",
|
|
4
4
|
"description": "React Renderer package for EasyEditor.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
9
9
|
"LICENSE",
|
|
10
|
-
"CHANGELOG.md",
|
|
11
10
|
"README.md"
|
|
12
11
|
],
|
|
13
12
|
"publishConfig": {
|
|
@@ -45,11 +44,11 @@
|
|
|
45
44
|
"@types/react-dom": "^18.3.1",
|
|
46
45
|
"react": "^18.3.1",
|
|
47
46
|
"react-dom": "^18.3.1",
|
|
48
|
-
"
|
|
47
|
+
"mobx-react": "^9.2.0",
|
|
48
|
+
"@easy-editor/core": "0.0.3-alpha.1"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"lodash-es": "^4.17.21",
|
|
52
|
-
"mobx-react": "^9.2.0",
|
|
53
52
|
"prop-types": "^15.8.1",
|
|
54
53
|
"react-is": "^18.3.1"
|
|
55
54
|
},
|