"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PropertyEditorSelect = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const core_1 = require("@material-ui/core");
const PropertyEditorSelect = (props) => {
    const onChange = (event) => {
        if (props.parentDefaultValue && props.parentDefaultValue === event.target.value) {
            Reflect.set(props.editObject, props.propertyName, null);
        }
        else {
            Reflect.set(props.editObject, props.propertyName, event.target.value);
        }
        props.updateCallback();
    };
    return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(core_1.TextField, { "data-testid": `property-${props.propertyName}-select`, select: true, value: Reflect.get(props.editObject, props.propertyName) ?? props.parentDefaultValue, label: props.label, onChange: onChange, fullWidth: true, variant: "outlined", children: props.options.map((item, index) => {
                return ((0, jsx_runtime_1.jsx)("option", { value: item, children: item }, index));
            }) }) }));
};
exports.PropertyEditorSelect = PropertyEditorSelect;
//# sourceMappingURL=PropertyEditorSelect.js.map