-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/MscrmTools/PCF-Controls
- Loading branch information
Showing
9 changed files
with
13,650 additions
and
4,402 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', // Specifies the ESLint parser | ||
parserOptions: { | ||
ecmaVersion: 2020, // Allows the use of modern ECMAScript features | ||
sourceType: 'module', // Allows for the use of imports | ||
project: './tsconfig.json' // Point to your project's tsconfig.json | ||
}, | ||
rules: { | ||
// Place to specify ESLint rules - can be used to overwrite rules specified from the extended configurations | ||
// For example, to turn off a rule: | ||
// 'no-unused-vars': 'off', | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,76 @@ | ||
import * as React from 'react' | ||
import {Stack} from '@fluentui/react/lib/Stack'; | ||
import {IBaseButtonProps, IBaseButtonState, IButtonStyles, PrimaryButton} from '@fluentui/react/lib/Button'; | ||
import { Stack } from '@fluentui/react/lib/Stack'; | ||
import { IBaseButtonProps, IBaseButtonState, IButtonStyles, PrimaryButton, IconButton } from '@fluentui/react/lib/Button'; | ||
import { IIconProps } from '@fluentui/react'; | ||
import { IconButton } from 'office-ui-fabric-react/lib/components/Button/IconButton/IconButton'; | ||
import { TooltipHost } from '@fluentui/react/lib/Tooltip'; | ||
|
||
export interface IButtonControlProps extends IBaseButtonProps{ | ||
hoverBackgroundColor:string, | ||
hoverBorderColor:string, | ||
hoverColor:string, | ||
checkedBackgroundColor:string, | ||
checkedBorderColor:string, | ||
checkedColor:string, | ||
iconName:string | null | ||
} | ||
export interface IButtonControlProps extends IBaseButtonProps { | ||
hoverBackgroundColor: string, | ||
hoverBorderColor: string, | ||
hoverColor: string, | ||
checkedBackgroundColor: string, | ||
checkedBorderColor: string, | ||
checkedColor: string, | ||
iconName: string | null, | ||
toolTip: string | undefined, | ||
} | ||
|
||
export default class ButtonControl extends React.Component<IButtonControlProps, IBaseButtonState>{ | ||
constructor(props :IButtonControlProps){ | ||
constructor(props: IButtonControlProps) { | ||
super(props); | ||
} | ||
styles : IButtonStyles ={ | ||
root:{ | ||
backgroundColor:this.props.style?.backgroundColor ?? "#0078d4", | ||
borderColor:this.props.style?.borderColor ?? "#0078d4", | ||
color:this.props.style?.color ?? "#FFFFFF", | ||
width:this.props.style?.width | ||
styles: IButtonStyles = { | ||
root: { | ||
backgroundColor: this.props.style?.backgroundColor ?? "#0078d4", | ||
borderColor: this.props.style?.borderColor ?? "#0078d4", | ||
color: this.props.style?.color ?? "#FFFFFF", | ||
width: this.props.style?.width | ||
}, | ||
rootHovered:{ | ||
backgroundColor:this.props.hoverBackgroundColor ?? "#106EBE", | ||
borderColor:this.props.hoverBorderColor ?? "#106EBE", | ||
color:this.props.hoverColor ?? "#FFFFFF", | ||
width:this.props.style?.width | ||
rootHovered: { | ||
backgroundColor: this.props.hoverBackgroundColor ?? "#106EBE", | ||
borderColor: this.props.hoverBorderColor ?? "#106EBE", | ||
color: this.props.hoverColor ?? "#FFFFFF", | ||
width: this.props.style?.width | ||
}, | ||
rootPressed:{ | ||
backgroundColor:this.props.checkedBackgroundColor ?? "#0078d4", | ||
borderColor:this.props.checkedBorderColor ?? "#0078d4", | ||
color:this.props.checkedColor ?? "#FFFFFF", | ||
width:this.props.style?.width | ||
rootPressed: { | ||
backgroundColor: this.props.checkedBackgroundColor ?? "#0078d4", | ||
borderColor: this.props.checkedBorderColor ?? "#0078d4", | ||
color: this.props.checkedColor ?? "#FFFFFF", | ||
width: this.props.style?.width | ||
} | ||
} | ||
|
||
icon : IIconProps = {iconName : this.props.iconName ?? ""}; | ||
icon: IIconProps = { iconName: this.props.iconName ?? "" }; | ||
|
||
render(){ | ||
if(this.props.text?.trim().length ?? 0 > 0) | ||
return( | ||
<Stack horizontal> | ||
<PrimaryButton iconProps={this.icon} styles={this.styles} text={this.props.text} disabled={this.props.disabled} onClick={this.props.onClick}/> | ||
</Stack> | ||
); | ||
else return( | ||
render() { | ||
const toolTipId = `tooltip_${this.props.iconName}`; | ||
|
||
<Stack horizontal> | ||
<IconButton iconProps={this.icon} styles={this.styles} disabled={this.props.disabled} onClick={this.props.onClick}/> | ||
</Stack> | ||
); | ||
} | ||
return ( | ||
<Stack horizontal> | ||
{this.props.text?.trim().length ? ( | ||
<TooltipHost content={this.props.toolTip} id={toolTipId}> | ||
<PrimaryButton | ||
iconProps={this.icon} | ||
styles={this.styles} | ||
text={this.props.text} | ||
disabled={this.props.disabled} | ||
onClick={this.props.onClick} | ||
aria-describedby={toolTipId} | ||
/> | ||
</TooltipHost> | ||
) : ( | ||
<TooltipHost content={this.props.toolTip} id={toolTipId}> | ||
<IconButton | ||
iconProps={this.icon} | ||
styles={this.styles} | ||
disabled={this.props.disabled} | ||
onClick={this.props.onClick} | ||
aria-describedby={toolTipId} | ||
/> | ||
</TooltipHost> | ||
)} | ||
</Stack> | ||
); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.