UNPKG

@wufengteam/inputs

Version:

平台提供的右侧属性编辑器,需要在主工程中注册

44 lines 1.69 kB
import React from 'react'; import { Select, Form } from 'antd'; // 编写范例,没有导出使用 var Test = function Test(_ref) { var name = _ref.name, rules = _ref.rules, _ref$placeholder = _ref.placeholder, placeholder = _ref$placeholder === void 0 ? '请选择' : _ref$placeholder, label = _ref.label, _ref$options = _ref.options, options = _ref$options === void 0 ? [] : _ref$options, defaultValue = _ref.defaultValue, _ref$dependencies = _ref.dependencies, dependencies = _ref$dependencies === void 0 ? [] : _ref$dependencies, _ref$dependenciesValu = _ref.dependenciesValues, dependenciesValues = _ref$dependenciesValu === void 0 ? {} : _ref$dependenciesValu, _ref$size = _ref.size, size = _ref$size === void 0 ? 'small' : _ref$size; var initialValue = defaultValue || options.length && options[0]; return /*#__PURE__*/React.createElement(Form.Item, { dependencies: dependencies, noStyle: true }, function (_ref2) { var getFieldValue = _ref2.getFieldValue; var shouldRender = Object.keys(dependenciesValues || {}).every(function (dependency) { var value = getFieldValue(dependency); return (dependenciesValues === null || dependenciesValues === void 0 ? void 0 : dependenciesValues[dependency]) === value; }); if (shouldRender) { return /*#__PURE__*/React.createElement(Form.Item, { label: label, name: name, initialValue: initialValue, rules: rules }, /*#__PURE__*/React.createElement(Select, { size: size, placeholder: placeholder, options: options })); } return null; }); }; export default Test;