PromucFlow_constructor/app/client/src/widgets/SpinnerWidget.tsx

43 lines
1.2 KiB
TypeScript
Raw Normal View History

2019-08-29 11:22:09 +00:00
import React from "react";
2019-09-09 09:08:54 +00:00
import BaseWidget, { WidgetProps, WidgetState } from "./BaseWidget";
2019-11-25 05:07:27 +00:00
import { WidgetType } from "constants/WidgetConstants";
2019-08-29 11:22:09 +00:00
import { Intent } from "@blueprintjs/core";
2019-11-25 05:07:27 +00:00
import SpinnerComponent from "components/designSystems/blueprint/SpinnerComponent";
2019-11-22 13:12:39 +00:00
import { WidgetPropertyValidationType } from "utils/ValidationFactory";
import { VALIDATION_TYPES } from "constants/WidgetValidation";
2019-03-15 12:53:45 +00:00
2019-09-09 09:08:54 +00:00
class SpinnerWidget extends BaseWidget<SpinnerWidgetProps, WidgetState> {
2019-11-22 13:12:39 +00:00
static getPropertyValidationMap(): WidgetPropertyValidationType {
return {
size: VALIDATION_TYPES.NUMBER,
value: VALIDATION_TYPES.NUMBER,
ellipsize: VALIDATION_TYPES.BOOLEAN,
};
}
getPageView() {
2019-03-15 12:53:45 +00:00
return (
<SpinnerComponent
widgetId={this.props.widgetId}
widgetName={this.props.widgetName}
2019-03-15 12:53:45 +00:00
key={this.props.widgetId}
size={this.props.size}
value={this.props.value}
intent={this.props.intent}
/>
);
}
getWidgetType(): WidgetType {
return "SPINNER_WIDGET";
}
}
2019-09-09 09:08:54 +00:00
export interface SpinnerWidgetProps extends WidgetProps {
2019-03-15 12:53:45 +00:00
size?: number;
value?: number;
ellipsize?: boolean;
intent?: Intent;
}
export default SpinnerWidget;