@react-awesome-query-builder/antd
Version:
User-friendly query builder for React. AntDesign widgets
59 lines • 2.71 kB
JavaScript
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/inherits";
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
import React, { PureComponent } from "react";
import { Popover, Radio } from "antd";
var RadioButton = Radio.Button;
var RadioGroup = Radio.Group;
import { EllipsisOutlined } from "@ant-design/icons";
var ValueSources = /*#__PURE__*/function (_PureComponent) {
function ValueSources() {
var _this;
_classCallCheck(this, ValueSources);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _callSuper(this, ValueSources, [].concat(args));
_this.onChange = function (e) {
var setValueSrc = _this.props.setValueSrc;
setValueSrc(e.target.value);
};
return _this;
}
_inherits(ValueSources, _PureComponent);
return _createClass(ValueSources, [{
key: "render",
value: function render() {
var _this$props = this.props,
config = _this$props.config,
valueSources = _this$props.valueSources,
valueSrc = _this$props.valueSrc,
readonly = _this$props.readonly,
title = _this$props.title;
var content = /*#__PURE__*/React.createElement(RadioGroup, {
value: valueSrc || "value",
size: config.settings.renderSize,
onChange: this.onChange,
disabled: readonly
}, valueSources.map(function (_ref) {
var _ref2 = _slicedToArray(_ref, 2),
srcKey = _ref2[0],
info = _ref2[1];
return /*#__PURE__*/React.createElement(RadioButton, {
key: srcKey,
value: srcKey
}, info.label);
}));
return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Popover, {
content: content,
title: title
}, /*#__PURE__*/React.createElement(EllipsisOutlined, null)));
}
}]);
}(PureComponent);
export { ValueSources as default };