UNPKG

nsn-comp

Version:

NSN核心组件

36 lines (32 loc) 1.01 kB
import "antd/es/button/style"; import _Button from "antd/es/button"; import { PlusCircleOutlined } from '@ant-design/icons'; import { Operation } from 'nsn-enum'; import { NLocale, NType } from 'nsn-util'; import React from 'react'; /** * table 工具栏中的新建按钮 */ var CreateAction = function CreateAction(props) { var comp = props.comp; var toolbar = comp.props.toolbar; var createProps = undefined; if (NType.isFunction(toolbar)) { createProps = toolbar(comp).create; } else if (toolbar) { createProps = toolbar.create; } var text = createProps ? createProps.text : undefined; return React.createElement(_Button, Object.assign({ icon: React.createElement(PlusCircleOutlined, null), onClick: function onClick() { return comp.setState({ editType: Operation.NEW, editVisible: true, record: undefined }); }, type: "text" }, createProps || {}), text || NLocale.getText('operation.new')); }; export { CreateAction };