/
button.component.tsx
47 lines (41 loc) · 1.61 KB
/
button.component.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import * as React from 'react';
import { Button, ButtonModel } from '@syncfusion/ej2-buttons';
import { ComponentBase, applyMixins, DefaultHtmlAttributes } from '@syncfusion/ej2-react-base';
/**
* `ButtonComponent` represents the react Button Component.
* ```ts
* <ButtonComponent></ButtonComponent>
* ```
*/
export class ButtonComponent extends Button {
public state: Readonly<{ children?: React.ReactNode | React.ReactNode[] }>
& Readonly<ButtonModel | DefaultHtmlAttributes>;
public setState: any;
private getDefaultAttributes: Function;
public initRenderCalled: boolean = false;
private checkInjectedModules: boolean = false;
private statelessTemplateProps: string[] = null;
private templateProps: string[] = null;
private immediateRender: boolean = true;
public props: Readonly<{ children?: React.ReactNode | React.ReactNode[] }>
& Readonly<ButtonModel | DefaultHtmlAttributes>;
public forceUpdate: (callBack?: () => any) => void;
public context: Object;
public portals: any = [];
public isReactComponent: Object;
public refs: {
[key: string]: React.ReactInstance
};
constructor(props: any) {
super(props);
}
public render(): any {
if (((this.element && !this.initRenderCalled) || this.refreshing) && !(this as any).isReactForeceUpdate) {
super.render();
this.initRenderCalled = true;
} else {
return React.createElement('button', this.getDefaultAttributes(),[].concat(this.props.children,this.portals));
}
}
}
applyMixins(ButtonComponent, [ComponentBase, React.Component]);