2019-11-05 05:09:50 +00:00
|
|
|
import React from "react";
|
|
|
|
|
import BaseControl, { ControlProps } from "./BaseControl";
|
2021-09-09 15:10:22 +00:00
|
|
|
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);
|
|
|
|
|
};
|
|
|
|
|
|
2020-04-14 05:35:16 +00:00
|
|
|
static getControlType() {
|
2019-11-05 05:09:50 +00:00
|
|
|
return "OPTION_INPUT";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default OptionControl;
|