@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/esm/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: options.thisRequiredInJSE,
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, thisRequiredInJSE) {
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 = thisRequiredInJSE ? parseThisRequiredExpression(fn, context) : parseExpression(fn, context);
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], props.thisRequiredInJSE);
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, this.props.thisRequiredInJSE);
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);