GeezerVison is showing github.com — refactor: change __setLifeCycleMethods to its actual meaning __excut… · zfhstudy/lowcode-engine@12f67dc
File treeExpand file treeCollapse file tree Open diff view settings packages/renderer-core/src
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/renderer-core/src/renderer/addon.tsx +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -45,7 +45,7 @@ export default function addonRendererFactory(): IBaseRenderComponent { | 45 | 45 | this.__initDataSource(props); | 46 | 46 | this.open = this.open || (() => { }); | 47 | 47 | this.close = this.close || (() => { }); | 48 | | - this.__setLifeCycleMethods('constructor', [...arguments]); | | 48 | + this.__excuteLifeCycleMethod('constructor', [...arguments]); | 49 | 49 | } | 50 | 50 |
| 51 | 51 | async componentWillUnmount() { | |
Collapse file Copy file name to clipboardExpand all lines: packages/renderer-core/src/renderer/base.tsx +7-7Lines changed: 7 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -131,28 +131,28 @@ export default function baseRendererFactory(): IBaseRenderComponent { | 131 | 131 | } | 132 | 132 |
| 133 | 133 | async getSnapshotBeforeUpdate(...args: any[]) { | 134 | | - this.__setLifeCycleMethods('getSnapshotBeforeUpdate', args); | | 134 | + this.__excuteLifeCycleMethod('getSnapshotBeforeUpdate', args); | 135 | 135 | this.__debug(`getSnapshotBeforeUpdate - ${this.props?.__schema?.fileName}`); | 136 | 136 | } | 137 | 137 |
| 138 | 138 | async componentDidMount(...args: any[]) { | 139 | 139 | this.reloadDataSource(); | 140 | | - this.__setLifeCycleMethods('componentDidMount', args); | | 140 | + this.__excuteLifeCycleMethod('componentDidMount', args); | 141 | 141 | this.__debug(`componentDidMount - ${this.props?.__schema?.fileName}`); | 142 | 142 | } | 143 | 143 |
| 144 | 144 | async componentDidUpdate(...args: any[]) { | 145 | | - this.__setLifeCycleMethods('componentDidUpdate', args); | | 145 | + this.__excuteLifeCycleMethod('componentDidUpdate', args); | 146 | 146 | this.__debug(`componentDidUpdate - ${this.props.__schema.fileName}`); | 147 | 147 | } | 148 | 148 |
| 149 | 149 | async componentWillUnmount(...args: any[]) { | 150 | | - this.__setLifeCycleMethods('componentWillUnmount', args); | | 150 | + this.__excuteLifeCycleMethod('componentWillUnmount', args); | 151 | 151 | this.__debug(`componentWillUnmount - ${this.props?.__schema?.fileName}`); | 152 | 152 | } | 153 | 153 |
| 154 | 154 | async componentDidCatch(...args: any[]) { | 155 | | - this.__setLifeCycleMethods('componentDidCatch', args); | | 155 | + this.__excuteLifeCycleMethod('componentDidCatch', args); | 156 | 156 | console.warn(args); | 157 | 157 | } | 158 | 158 |
| @@ -194,7 +194,7 @@ export default function baseRendererFactory(): IBaseRenderComponent { | 194 | 194 | } | 195 | 195 | } | 196 | 196 |
| 197 | | - __setLifeCycleMethods = (method: string, args?: any) => { | | 197 | + __excuteLifeCycleMethod = (method: string, args?: any) => { | 198 | 198 | const lifeCycleMethods = getValue(this.props.__schema, 'lifeCycles', {}); | 199 | 199 | let fn = lifeCycleMethods[method]; | 200 | 200 | if (fn) { | @@ -360,7 +360,7 @@ export default function baseRendererFactory(): IBaseRenderComponent { | 360 | 360 |
| 361 | 361 | __render = () => { | 362 | 362 | const schema = this.props.__schema; | 363 | | - this.__setLifeCycleMethods('render'); | | 363 | + this.__excuteLifeCycleMethod('render'); | 364 | 364 | this.__writeCss(); | 365 | 365 |
| 366 | 366 | const { engine } = this.context; | |
Collapse file Copy file name to clipboardExpand all lines: packages/renderer-core/src/renderer/block.tsx +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -13,7 +13,7 @@ export default function blockRendererFactory(): IBaseRenderComponent { | 13 | 13 | const schema = props.__schema || {}; | 14 | 14 | this.state = this.__parseData(schema.state || {}); | 15 | 15 | this.__initDataSource(props); | 16 | | - this.__setLifeCycleMethods('constructor', [...arguments]); | | 16 | + this.__excuteLifeCycleMethod('constructor', [...arguments]); | 17 | 17 | } | 18 | 18 |
| 19 | 19 | render() { | |
Collapse file Copy file name to clipboardExpand all lines: packages/renderer-core/src/renderer/component.tsx +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -15,7 +15,7 @@ export default function componentRendererFactory(): IBaseRenderComponent { | 15 | 15 | const schema = props.__schema || {}; | 16 | 16 | this.state = this.__parseData(schema.state || {}); | 17 | 17 | this.__initDataSource(props); | 18 | | - this.__setLifeCycleMethods('constructor', arguments as any); | | 18 | + this.__excuteLifeCycleMethod('constructor', arguments as any); | 19 | 19 | } | 20 | 20 |
| 21 | 21 | render() { | |
Collapse file Copy file name to clipboardExpand all lines: packages/renderer-core/src/renderer/page.tsx +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -15,7 +15,7 @@ export default function pageRendererFactory(): IBaseRenderComponent { | 15 | 15 | const schema = props.__schema || {}; | 16 | 16 | this.state = this.__parseData(schema.state || {}); | 17 | 17 | this.__initDataSource(props); | 18 | | - this.__setLifeCycleMethods('constructor', [props, ...rest]); | | 18 | + this.__excuteLifeCycleMethod('constructor', [props, ...rest]); | 19 | 19 | } | 20 | 20 |
| 21 | 21 | async componentDidUpdate(prevProps: IBaseRendererProps, _prevState: {}, snapshot: unknown) { | @@ -40,7 +40,7 @@ export default function pageRendererFactory(): IBaseRenderComponent { | 40 | 40 | this.__bindCustomMethods(this.props); | 41 | 41 | this.__initDataSource(this.props); | 42 | 42 |
| 43 | | - // this.__setLifeCycleMethods('constructor', arguments); | | 43 | + // this.__excuteLifeCycleMethod('constructor', arguments); | 44 | 44 |
| 45 | 45 | this.__generateCtx({ | 46 | 46 | page: this, | |
Collapse file Copy file name to clipboardExpand all lines: packages/renderer-core/src/types/index.ts +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -240,7 +240,7 @@ export type IBaseRendererInstance = IGeneralComponent< | 240 | 240 | __beforeInit(props: IBaseRendererProps): void; | 241 | 241 | __init(props: IBaseRendererProps): void; | 242 | 242 | __afterInit(props: IBaseRendererProps): void; | 243 | | - __setLifeCycleMethods(method: string, args?: any[]): void; | | 243 | + __excuteLifeCycleMethod(method: string, args?: any[]): void; | 244 | 244 | __bindCustomMethods(props: IBaseRendererProps): void; | 245 | 245 | __generateCtx(ctx: Record<string, any>): void; | 246 | 246 | __parseData(data: any, ctx?: any): any; | |
|