mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-15 05:36:39 +00:00
refactor: change __setLifeCycleMethods to its actual meaning __excuteLifeCycleMethod
This commit is contained in:
parent
951d1cb103
commit
12f67dcdeb
@ -45,7 +45,7 @@ export default function addonRendererFactory(): IBaseRenderComponent {
|
|||||||
this.__initDataSource(props);
|
this.__initDataSource(props);
|
||||||
this.open = this.open || (() => { });
|
this.open = this.open || (() => { });
|
||||||
this.close = this.close || (() => { });
|
this.close = this.close || (() => { });
|
||||||
this.__setLifeCycleMethods('constructor', [...arguments]);
|
this.__excuteLifeCycleMethod('constructor', [...arguments]);
|
||||||
}
|
}
|
||||||
|
|
||||||
async componentWillUnmount() {
|
async componentWillUnmount() {
|
||||||
|
|||||||
@ -131,28 +131,28 @@ export default function baseRendererFactory(): IBaseRenderComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getSnapshotBeforeUpdate(...args: any[]) {
|
async getSnapshotBeforeUpdate(...args: any[]) {
|
||||||
this.__setLifeCycleMethods('getSnapshotBeforeUpdate', args);
|
this.__excuteLifeCycleMethod('getSnapshotBeforeUpdate', args);
|
||||||
this.__debug(`getSnapshotBeforeUpdate - ${this.props?.__schema?.fileName}`);
|
this.__debug(`getSnapshotBeforeUpdate - ${this.props?.__schema?.fileName}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async componentDidMount(...args: any[]) {
|
async componentDidMount(...args: any[]) {
|
||||||
this.reloadDataSource();
|
this.reloadDataSource();
|
||||||
this.__setLifeCycleMethods('componentDidMount', args);
|
this.__excuteLifeCycleMethod('componentDidMount', args);
|
||||||
this.__debug(`componentDidMount - ${this.props?.__schema?.fileName}`);
|
this.__debug(`componentDidMount - ${this.props?.__schema?.fileName}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async componentDidUpdate(...args: any[]) {
|
async componentDidUpdate(...args: any[]) {
|
||||||
this.__setLifeCycleMethods('componentDidUpdate', args);
|
this.__excuteLifeCycleMethod('componentDidUpdate', args);
|
||||||
this.__debug(`componentDidUpdate - ${this.props.__schema.fileName}`);
|
this.__debug(`componentDidUpdate - ${this.props.__schema.fileName}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async componentWillUnmount(...args: any[]) {
|
async componentWillUnmount(...args: any[]) {
|
||||||
this.__setLifeCycleMethods('componentWillUnmount', args);
|
this.__excuteLifeCycleMethod('componentWillUnmount', args);
|
||||||
this.__debug(`componentWillUnmount - ${this.props?.__schema?.fileName}`);
|
this.__debug(`componentWillUnmount - ${this.props?.__schema?.fileName}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async componentDidCatch(...args: any[]) {
|
async componentDidCatch(...args: any[]) {
|
||||||
this.__setLifeCycleMethods('componentDidCatch', args);
|
this.__excuteLifeCycleMethod('componentDidCatch', args);
|
||||||
console.warn(args);
|
console.warn(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ export default function baseRendererFactory(): IBaseRenderComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__setLifeCycleMethods = (method: string, args?: any) => {
|
__excuteLifeCycleMethod = (method: string, args?: any) => {
|
||||||
const lifeCycleMethods = getValue(this.props.__schema, 'lifeCycles', {});
|
const lifeCycleMethods = getValue(this.props.__schema, 'lifeCycles', {});
|
||||||
let fn = lifeCycleMethods[method];
|
let fn = lifeCycleMethods[method];
|
||||||
if (fn) {
|
if (fn) {
|
||||||
@ -360,7 +360,7 @@ export default function baseRendererFactory(): IBaseRenderComponent {
|
|||||||
|
|
||||||
__render = () => {
|
__render = () => {
|
||||||
const schema = this.props.__schema;
|
const schema = this.props.__schema;
|
||||||
this.__setLifeCycleMethods('render');
|
this.__excuteLifeCycleMethod('render');
|
||||||
this.__writeCss();
|
this.__writeCss();
|
||||||
|
|
||||||
const { engine } = this.context;
|
const { engine } = this.context;
|
||||||
|
|||||||
@ -13,7 +13,7 @@ export default function blockRendererFactory(): IBaseRenderComponent {
|
|||||||
const schema = props.__schema || {};
|
const schema = props.__schema || {};
|
||||||
this.state = this.__parseData(schema.state || {});
|
this.state = this.__parseData(schema.state || {});
|
||||||
this.__initDataSource(props);
|
this.__initDataSource(props);
|
||||||
this.__setLifeCycleMethods('constructor', [...arguments]);
|
this.__excuteLifeCycleMethod('constructor', [...arguments]);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
@ -15,7 +15,7 @@ export default function componentRendererFactory(): IBaseRenderComponent {
|
|||||||
const schema = props.__schema || {};
|
const schema = props.__schema || {};
|
||||||
this.state = this.__parseData(schema.state || {});
|
this.state = this.__parseData(schema.state || {});
|
||||||
this.__initDataSource(props);
|
this.__initDataSource(props);
|
||||||
this.__setLifeCycleMethods('constructor', arguments as any);
|
this.__excuteLifeCycleMethod('constructor', arguments as any);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
@ -15,7 +15,7 @@ export default function pageRendererFactory(): IBaseRenderComponent {
|
|||||||
const schema = props.__schema || {};
|
const schema = props.__schema || {};
|
||||||
this.state = this.__parseData(schema.state || {});
|
this.state = this.__parseData(schema.state || {});
|
||||||
this.__initDataSource(props);
|
this.__initDataSource(props);
|
||||||
this.__setLifeCycleMethods('constructor', [props, ...rest]);
|
this.__excuteLifeCycleMethod('constructor', [props, ...rest]);
|
||||||
}
|
}
|
||||||
|
|
||||||
async componentDidUpdate(prevProps: IBaseRendererProps, _prevState: {}, snapshot: unknown) {
|
async componentDidUpdate(prevProps: IBaseRendererProps, _prevState: {}, snapshot: unknown) {
|
||||||
@ -40,7 +40,7 @@ export default function pageRendererFactory(): IBaseRenderComponent {
|
|||||||
this.__bindCustomMethods(this.props);
|
this.__bindCustomMethods(this.props);
|
||||||
this.__initDataSource(this.props);
|
this.__initDataSource(this.props);
|
||||||
|
|
||||||
// this.__setLifeCycleMethods('constructor', arguments);
|
// this.__excuteLifeCycleMethod('constructor', arguments);
|
||||||
|
|
||||||
this.__generateCtx({
|
this.__generateCtx({
|
||||||
page: this,
|
page: this,
|
||||||
|
|||||||
@ -240,7 +240,7 @@ export type IBaseRendererInstance = IGeneralComponent<
|
|||||||
__beforeInit(props: IBaseRendererProps): void;
|
__beforeInit(props: IBaseRendererProps): void;
|
||||||
__init(props: IBaseRendererProps): void;
|
__init(props: IBaseRendererProps): void;
|
||||||
__afterInit(props: IBaseRendererProps): void;
|
__afterInit(props: IBaseRendererProps): void;
|
||||||
__setLifeCycleMethods(method: string, args?: any[]): void;
|
__excuteLifeCycleMethod(method: string, args?: any[]): void;
|
||||||
__bindCustomMethods(props: IBaseRendererProps): void;
|
__bindCustomMethods(props: IBaseRendererProps): void;
|
||||||
__generateCtx(ctx: Record<string, any>): void;
|
__generateCtx(ctx: Record<string, any>): void;
|
||||||
__parseData(data: any, ctx?: any): any;
|
__parseData(data: any, ctx?: any): any;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user