UNPKG

sunmao-sdk

Version:

榫卯-开箱即用赋能-sdk

43 lines (33 loc) 2.23 kB
"use strict"; import "antd/es/button/style"; import _Button from "antd/es/button"; var _excluded = ["onChange", "name", "value", "schema", "options", "formData", "rootValue"]; function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } import React, { useState, useEffect } from "react"; /** * 表单按键组件 */ var displayName = "FormBtn"; var FormBtn = function FormBtn(props) { var onChange = props.onChange, name = props.name, value = props.value, _props$schema$commonP = props.schema.commonProps, commonProps = _props$schema$commonP === void 0 ? {} : _props$schema$commonP, uiOptions = props.options, formData = props.formData, rootValue = props.rootValue, otherProps = _objectWithoutProperties(props, _excluded); // 此处onClick与uiOptions中onClick会有冲突,自行注意,二选一 var _onClick = commonProps.onClick; return /*#__PURE__*/React.createElement(_Button, _extends({ style: { width: "100%" }, onClick: function onClick() { return _onClick && _onClick(formData, onChange, rootValue); } }, uiOptions), value || "按键"); }; export default FormBtn;