PromucFlow_constructor/app/client/src/components/propertyControls/OptionControl.tsx

30 lines
677 B
TypeScript
Raw Normal View History

2019-11-05 05:09:50 +00:00
import React from "react";
import BaseControl, { ControlProps } from "./BaseControl";
import { DropdownOption } from "components/constants";
2020-04-01 08:09:57 +00:00
import { KeyValueComponent } from "./KeyValueComponent";
2019-12-18 17:05:28 +00:00
2020-04-01 08:09:57 +00:00
export type DropDownOptionWithKey = DropdownOption & {
2020-03-19 03:07:31 +00:00
key: string;
};
2020-04-01 08:09:57 +00:00
class OptionControl extends BaseControl<ControlProps> {
2019-11-05 05:09:50 +00:00
render() {
return (
2020-04-01 08:09:57 +00:00
<KeyValueComponent
pairs={this.props.propertyValue}
updatePairs={this.updateOptions}
/>
2019-11-05 05:09:50 +00:00
);
}
2020-04-01 08:09:57 +00:00
updateOptions = (options: DropdownOption[]) => {
2019-11-05 05:09:50 +00:00
this.updateProperty("options", options);
};
static getControlType() {
2019-11-05 05:09:50 +00:00
return "OPTION_INPUT";
}
}
export default OptionControl;