meraproject/lib/js/bws/react/form/ImagePicker.js
keboss-m 5c21d25d45 Initial commit: Merakomis portal, Docker stack and user-reader API.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-24 11:04:05 +03:00

45 lines
1.0 KiB
JavaScript

var ImagePicker;
import '../ui/dropper.js';
export default window.ImagePicker = ImagePicker = class ImagePicker extends React.Component {
constructor(props) {
var ref, ref1;
super(props);
this.state = {
value: (ref = props.value) != null ? ref : 0,
src: (ref1 = props.src) != null ? ref1 : ''
};
this.onUpload = this.onUpload.bind(this);
this.getValue = this.getValue.bind(this);
}
getValue() {
return this.state.value;
}
onUpload(data) {
console.log('onUpload', data);
return this.setState({
value: data.id,
src: data.link
});
}
render() {
var src;
({
src
} = this.state);
return /*#__PURE__*/React.createElement("div", {
class: "image_picker"
}, src !== '' ? /*#__PURE__*/React.createElement("img", {
src: src
}) : null, /*#__PURE__*/React.createElement(Dropper, {
buttonTitle: "Выбрать изображение",
callback: this.onUpload,
type: "image"
}));
}
};
//# sourceMappingURL=ImagePicker.js.map