Skip to content
This repository was archived by the owner on Jan 3, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/ProgressCircle.webmodeler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class preview extends Component<ContainerProps, {}> {
displayTextValue: this.getDisplayTextValue(),
maximumValue: props.staticMaximumValue,
positiveValueColor: props.positiveValueColor,
overshootValueColor: props.overshootValueColor,
style: ProgressCircleContainer.parseStyle(props.style),
textSize: props.textSize,
value: props.staticValue
Expand Down
14 changes: 14 additions & 0 deletions src/ProgressCircle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,20 @@
<enumerationValue key="danger">Danger</enumerationValue>
</enumerationValues>
</property>
<property key="overshootValueColor" type="enumeration" defaultValue="danger">
<caption>Overshoot style</caption>
<category>Appearance</category>
<description>Color of the circle with a overshooted progress value</description>
<enumerationValues>
<enumerationValue key="default">Default</enumerationValue>
<enumerationValue key="primary">Primary</enumerationValue>
<enumerationValue key="inverse">Inverse</enumerationValue>
<enumerationValue key="info">Info</enumerationValue>
<enumerationValue key="success">Success</enumerationValue>
<enumerationValue key="warning">Warning</enumerationValue>
<enumerationValue key="danger">Danger</enumerationValue>
</enumerationValues>
</property>
<property key="circleThickness" type="integer" defaultValue="6">
<caption>Circle thickness</caption>
<category>Appearance</category>
Expand Down
6 changes: 4 additions & 2 deletions src/components/ProgressCircle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface ProgressCircleProps {
negativeValueColor?: BootstrapStyle;
onClickAction?: () => void;
positiveValueColor?: BootstrapStyle;
overshootValueColor?: BootstrapStyle;
style?: object;
displayText?: DisplayText;
textSize?: ProgressTextSize;
Expand Down Expand Up @@ -63,7 +64,7 @@ export class ProgressCircle extends Component<ProgressCircleProps, { alertMessag
}

render() {
const { maximumValue, textSize, negativeValueColor, positiveValueColor, value } = this.props;
const { maximumValue, textSize, negativeValueColor, positiveValueColor, overshootValueColor, value } = this.props;
const textClass = textSize === "text" ? "mx-text" : textSize;
const validMax = typeof maximumValue === "number" ? maximumValue > 0 : false;
return createElement("div",
Expand All @@ -78,7 +79,8 @@ export class ProgressCircle extends Component<ProgressCircleProps, { alertMessag
this.progressCircleColorClass,
{
[`widget-progress-circle-${negativeValueColor}`]: value ? value < 0 : false,
[`widget-progress-circle-${positiveValueColor}`]: value ? value > 0 : false,
[`widget-progress-circle-${positiveValueColor}`]: value ? value > 0 && value < (maximumValue || 0) : false,
[`widget-progress-circle-${overshootValueColor}`]: value ? value >= (maximumValue || 0) : false,
"widget-progress-circle-alert": !validMax,
"widget-progress-circle-clickable": this.props.clickable
}
Expand Down
2 changes: 2 additions & 0 deletions src/components/ProgressCircleContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface ContainerProps extends WrapperProps {
page?: string;
progressAttribute: string;
positiveValueColor: BootstrapStyle;
overshootValueColor: BootstrapStyle;
textSize: ProgressTextSize;
openPageAs: PageLocation;
staticValue: number;
Expand Down Expand Up @@ -88,6 +89,7 @@ export default class ProgressCircleContainer extends Component<ContainerProps, C
negativeValueColor: this.props.negativeValueColor,
onClickAction: this.handleOnClick,
positiveValueColor: this.props.positiveValueColor,
overshootValueColor: this.props.overshootValueColor,
style: ProgressCircleContainer.parseStyle(this.props.style),
textSize: this.props.textSize,
value: this.props.progressAttribute ? this.state.progressValue || 0 : this.props.staticValue
Expand Down