UNPKG

bee-cascader

Version:
959 lines (736 loc) 768 kB
/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(2); var _reactDom2 = _interopRequireDefault(_reactDom); var _beeLayout = __webpack_require__(3); var _beePanel = __webpack_require__(9); var _beeDrawer = __webpack_require__(84); var _beeDrawer2 = _interopRequireDefault(_beeDrawer); var _beeClipboard = __webpack_require__(98); var _beeClipboard2 = _interopRequireDefault(_beeClipboard); var _src = __webpack_require__(157); var _src2 = _interopRequireDefault(_src); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } var Demo1 = __webpack_require__(250);var Demo2 = __webpack_require__(251);var Demo3 = __webpack_require__(252);var Demo4 = __webpack_require__(253);var Demo5 = __webpack_require__(254);var Demo6 = __webpack_require__(255);var Demo7 = __webpack_require__(256);var Demo8 = __webpack_require__(257);var DemoArray = [{ "example": _react2['default'].createElement(Demo1, null), "title": " 基础级联菜单", "code": "/**\n *\n * @title 基础级联菜单\n * @description 级联选择对数据有较严格要求,请参照示例的格式使用options,每项数据至少包含 value、label 两项,子集为 children,以此类推。\n *\n */\n\nimport React, { Component } from 'react';\nimport { Cascader, Row, Col } from 'tinper-bee';\n\nconst options = [{\n\tlabel: '基础组件',\n\tvalue: 'jczj',\n\tchildren: [{\n\t\tlabel: '导航',\n\t\tvalue: 'dh',\n\t\tchildren: [{\n\t\t\tlabel: '面包屑',\n\t\t\tvalue: 'mbx'\n\t\t},{\n\t\t\tlabel: '分页',\n\t\t\tvalue: 'fy'\n\t\t},{\n\t\t\tlabel: '标签',\n\t\t\tvalue: 'bq'\n\t\t},{\n\t\t\tlabel: '菜单',\n\t\t\tvalue: 'cd'\n\t\t}]\n\t},{\n\t\tlabel: '反馈',\n\t\tvalue: 'fk',\n\t\tchildren: [{\n\t\t\tlabel: '模态框',\n\t\t\tvalue: 'mtk'\n\t\t},{\n\t\t\tlabel: '通知',\n\t\t\tvalue: 'tz'\n\t\t}]\n \t},\n \t{\n\t\tlabel: '表单',\n \t value: 'bd'\n \t}]\n\t},{\n\t\tlabel: '应用组件',\n\t\tvalue: 'yyzj',\n\t\tchildren: [{\n\t\t\tlabel: '参照',\n\t\t\tvalue: 'ref',\n\t\t\tchildren: [{\n\t\t\t\tlabel: '树参照',\n\t\t\t\tvalue: 'reftree'\n\t\t\t},{\n\t\t\t\tlabel: '表参照',\n\t\t\t\tvalue: 'reftable'\n\t\t\t},{\n\t\t\t\tlabel: '穿梭参照',\n\t\t\t\tvalue: 'reftransfer'\n\t\t\t}]\n\t\t}]\n\t}\n];\nclass Demo1 extends Component {\n\n\tonChange = (value, selectedOptions) => {\n\t\tconsole.log(value, selectedOptions);\n\t}\n\t\n \trender(){\n \t\treturn(\n\t\t\t<Row>\n\t\t\t\t<Col md={4}>\n\t\t\t\t\t<div className=\"height-150\">\n\t\t\t\t\t\t<Cascader \n\t\t\t\t\t\t\toptions = {options} \n\t\t\t\t\t\t\tonChange = {this.onChange}\n\t\t\t\t\t\t\tplaceholder = \"请选择\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</Col>\n\t\t\t</Row>\n \t\t)\n \t}\n}\n", "desc": " 级联选择对数据有较严格要求,请参照示例的格式使用options,每项数据至少包含 value、label 两项,子集为 children,以此类推。" }, { "example": _react2['default'].createElement(Demo2, null), "title": " 默认值", "code": "/**\r\n *\r\n * @title 默认值\r\n * @description 默认值通过数组的方式指定。注:需要给数组的每一项指定label和value属性。\r\n *\r\n */\r\n\r\nimport React, { Component } from 'react';\r\n\nimport { Cascader, Row, Col } from 'tinper-bee';\r\n\r\nconst options = [{\r\n\tlabel: '基础组件',\r\n\tvalue: 'jczj',\r\n\tchildren: [{\r\n\t\tlabel: '导航',\r\n\t\tvalue: 'dh',\r\n\t\tchildren: [{\r\n\t\t\tlabel: '面包屑',\r\n\t\t\tvalue: 'mbx'\r\n\t\t},{\r\n\t\t\tlabel: '分页',\r\n\t\t\tvalue: 'fy'\r\n\t\t},{\r\n\t\t\tlabel: '标签',\r\n\t\t\tvalue: 'bq'\r\n\t\t},{\r\n\t\t\tlabel: '菜单',\r\n\t\t\tvalue: 'cd'\r\n\t\t}]\r\n\t},{\r\n\t\tlabel: '反馈',\r\n\t\tvalue: 'fk',\r\n\t\tchildren: [{\r\n\t\t\tlabel: '模态框',\r\n\t\t\tvalue: 'mtk'\r\n\t\t},{\r\n\t\t\tlabel: '通知',\r\n\t\t\tvalue: 'tz'\r\n\t\t}]\r\n \t},\r\n \t{\r\n\t\tlabel: '表单',\r\n \t value: 'bd'\r\n \t}]\r\n\t},{\r\n\t\tlabel: '应用组件',\r\n\t\tvalue: 'yyzj',\r\n\t\tchildren: [{\r\n\t\t\tlabel: '参照',\r\n\t\t\tvalue: 'ref',\r\n\t\t\tchildren: [{\r\n\t\t\t\tlabel: '树参照',\r\n\t\t\t\tvalue: 'reftree'\r\n\t\t\t},{\r\n\t\t\t\tlabel: '表参照',\r\n\t\t\t\tvalue: 'reftable'\r\n\t\t\t},{\r\n\t\t\t\tlabel: '穿梭参照',\r\n\t\t\t\tvalue: 'reftransfer'\r\n\t\t\t}]\r\n\t\t}]\r\n\t}\r\n];\r\n\r\nconst defaultOptions = [{\r\n label: '基础组件',\r\n value: 'jczj',\r\n}, {\r\n label: '导航',\r\n value: 'dh',\r\n}, {\r\n label: '菜单',\r\n value: 'cd',\r\n}];\r\n\r\nclass Demo2 extends Component {\r\n\r\n\tonChange = (value, selectedOptions) => {\r\n console.log(value, selectedOptions);\r\n\t}\r\n\t\r\n \trender(){\r\n \t\treturn(\r\n\t\t\t<Row>\r\n\t\t\t\t<Col md={4}>\r\n\t\t\t\t\t<div className=\"height-150\">\r\n <Cascader \r\n defaultValue={defaultOptions}\r\n\t\t\t\t\t\t\toptions = {options} \r\n\t\t\t\t\t\t\tonChange = {this.onChange}\r\n\t\t\t\t\t\t\tplaceholder = \"请选择\"\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</Col>\r\n\t\t\t</Row>\r\n \t\t)\r\n \t}\r\n}\r\n", "desc": " 默认值通过数组的方式指定。注:需要给数组的每一项指定label和value属性。" }, { "example": _react2['default'].createElement(Demo3, null), "title": " 移入展开", "code": "/**\r\n *\r\n * @title 移入展开\r\n * @description 鼠标hover时展开菜单子选项\r\n *\r\n */\r\n\r\nimport React, { Component } from 'react';\r\n\nimport { Cascader, Row, Col } from 'tinper-bee';\r\n\r\nconst options = [{\r\n\tlabel: '基础组件',\r\n\tvalue: 'jczj',\r\n\tchildren: [{\r\n\t\tlabel: '导航',\r\n\t\tvalue: 'dh',\r\n\t\tchildren: [{\r\n\t\t\tlabel: '面包屑',\r\n\t\t\tvalue: 'mbx'\r\n\t\t},{\r\n\t\t\tlabel: '分页',\r\n\t\t\tvalue: 'fy'\r\n\t\t},{\r\n\t\t\tlabel: '标签',\r\n\t\t\tvalue: 'bq'\r\n\t\t},{\r\n\t\t\tlabel: '菜单',\r\n\t\t\tvalue: 'cd'\r\n\t\t}]\r\n\t},{\r\n\t\tlabel: '反馈',\r\n\t\tvalue: 'fk',\r\n\t\tchildren: [{\r\n\t\t\tlabel: '模态框',\r\n\t\t\tvalue: 'mtk'\r\n\t\t},{\r\n\t\t\tlabel: '通知',\r\n\t\t\tvalue: 'tz'\r\n\t\t}]\r\n \t},\r\n \t{\r\n\t\tlabel: '表单',\r\n \t value: 'bd'\r\n \t}]\r\n\t},{\r\n\t\tlabel: '应用组件',\r\n\t\tvalue: 'yyzj',\r\n\t\tchildren: [{\r\n\t\t\tlabel: '参照',\r\n\t\t\tvalue: 'ref',\r\n\t\t\tchildren: [{\r\n\t\t\t\tlabel: '树参照',\r\n\t\t\t\tvalue: 'reftree'\r\n\t\t\t},{\r\n\t\t\t\tlabel: '表参照',\r\n\t\t\t\tvalue: 'reftable'\r\n\t\t\t},{\r\n\t\t\t\tlabel: '穿梭参照',\r\n\t\t\t\tvalue: 'reftransfer'\r\n\t\t\t}]\r\n\t\t}]\r\n\t}\r\n];\r\n\r\nclass Demo3 extends Component {\r\n\r\n onChange = (value) => {\r\n console.log(value)\r\n }\r\n\r\n render(){\r\n return (\r\n <Row>\r\n <Col md={4}>\r\n <div className=\"height-150\">\r\n <Cascader expandTrigger=\"hover\" options={options} onChange={this.onChange} placeholder=\"请选择\"/>\r\n </div>\r\n </Col>\r\n </Row>\r\n )\r\n }\r\n}\r\n\r\n", "desc": " 鼠标hover时展开菜单子选项" }, { "example": _react2['default'].createElement(Demo4, null), "title": " 禁用状态", "code": "/**\r\n *\r\n * @title 禁用状态\r\n * @description 通过`disabled`参数设置是否禁用。\r\n *\r\n */\r\n\r\nimport React, { Component } from 'react';\r\n\nimport { Cascader, Row, Col } from 'tinper-bee';\r\n\r\nconst options = [{\r\n label: '浙江',\r\n value: 'zj',\r\n children: [{\r\n label: '杭州',\r\n value: 'hz',\r\n children: [{\r\n label: '西湖',\r\n value: 'xh',\r\n children: [{\r\n label: '白娘子',\r\n value: 'bnz'\r\n },{\r\n label: '许仙',\r\n value: 'xx'\r\n }]\r\n }]\r\n }]\r\n },\r\n {\r\n label: '江苏',\r\n value: 'js',\r\n children: [{\r\n label: '南京',\r\n value: 'nj',\r\n children: [{\r\n label: '中华门',\r\n value: 'zhm'\r\n }]\r\n }]\r\n },\r\n {\r\n label: '山东',\r\n value: 'sd'\r\n }\r\n];\r\n\r\nclass Demo4 extends Component { \r\n render(){\r\n return (\r\n <Row>\r\n <Col md={4}>\r\n <div className=\"height-150\">\r\n <Cascader disabled options={options} placeholder=\"请选择地址\"/>\r\n </div>\r\n </Col>\r\n </Row>\r\n )\r\n }\r\n}\r\n\r\n", "desc": " 通过`disabled`参数设置是否禁用。" }, { "example": _react2['default'].createElement(Demo5, null), "title": " 选择即改变", "code": "/**\r\n *\r\n * @title 选择即改变\r\n * @description 设置属性 `changeOnSelect` 点任何一级都可以选择。\r\n *\r\n */\r\n\r\nimport React, { Component } from 'react';\r\n\nimport { Cascader, Row, Col } from 'tinper-bee';\r\n\r\nconst options = [{\r\n\tlabel: '基础组件',\r\n\tvalue: 'jczj',\r\n\tchildren: [{\r\n\t\tlabel: '导航',\r\n\t\tvalue: 'dh',\r\n\t\tchildren: [{\r\n\t\t\tlabel: '面包屑',\r\n\t\t\tvalue: 'mbx'\r\n\t\t},{\r\n\t\t\tlabel: '分页',\r\n\t\t\tvalue: 'fy'\r\n\t\t},{\r\n\t\t\tlabel: '标签',\r\n\t\t\tvalue: 'bq'\r\n\t\t},{\r\n\t\t\tlabel: '菜单',\r\n\t\t\tvalue: 'cd'\r\n\t\t}]\r\n\t},{\r\n\t\tlabel: '反馈',\r\n\t\tvalue: 'fk',\r\n\t\tchildren: [{\r\n\t\t\tlabel: '模态框',\r\n\t\t\tvalue: 'mtk'\r\n\t\t},{\r\n\t\t\tlabel: '通知',\r\n\t\t\tvalue: 'tz'\r\n\t\t}]\r\n \t},\r\n \t{\r\n\t\tlabel: '表单',\r\n \t value: 'bd'\r\n \t}]\r\n\t},{\r\n\t\tlabel: '应用组件',\r\n\t\tvalue: 'yyzj',\r\n\t\tchildren: [{\r\n\t\t\tlabel: '参照',\r\n\t\t\tvalue: 'ref',\r\n\t\t\tchildren: [{\r\n\t\t\t\tlabel: '树参照',\r\n\t\t\t\tvalue: 'reftree'\r\n\t\t\t},{\r\n\t\t\t\tlabel: '表参照',\r\n\t\t\t\tvalue: 'reftable'\r\n\t\t\t},{\r\n\t\t\t\tlabel: '穿梭参照',\r\n\t\t\t\tvalue: 'reftransfer'\r\n\t\t\t}]\r\n\t\t}]\r\n\t}\r\n];\r\n\r\nclass Demo5 extends Component { \r\n render(){\r\n return (\r\n <Row>\r\n <Col md={4}>\r\n <div className=\"height-150\">\r\n <Cascader changeOnSelect options={options} placeholder=\"请选择\"/>\r\n </div>\r\n </Col>\r\n </Row>\r\n )\r\n }\r\n}\r\n\r\n", "desc": " 设置属性 `changeOnSelect` 点任何一级都可以选择。" }, { "example": _react2['default'].createElement(Demo6, null), "title": " 动态改变options", "code": "/**\r\n *\r\n * @title 动态改变options\r\n * @description 通过动态设置`options`参数,即可灵活改变数据源。\r\n *\r\n */\r\n\r\nimport React, { Component } from 'react';\r\n\n\nimport { Cascader, Button, Row, Col } from 'tinper-bee';\r\n\r\nconst baseOptions = [{\r\n label: '基础组件',\r\n value: 'jczj',\r\n children: [{\r\n label: '导航',\r\n value: 'dh',\r\n children: [{\r\n label: '面包屑',\r\n value: 'mbx'\r\n },{\r\n label: '分页',\r\n value: 'fy'\r\n },{\r\n label: '标签',\r\n value: 'bq'\r\n },{\r\n label: '菜单',\r\n value: 'cd'\r\n }]\r\n },{\r\n label: '反馈',\r\n value: 'fk',\r\n children: [{\r\n label: '模态框',\r\n value: 'mtk'\r\n },{\r\n label: '通知',\r\n value: 'tz'\r\n }]\r\n },\r\n {\r\n label: '表单',\r\n value: 'bd'\r\n }]\r\n },{\r\n label: '应用组件',\r\n value: 'yyzj',\r\n children: [{\r\n label: '参照',\r\n value: 'ref',\r\n children: [{\r\n label: '树参照',\r\n value: 'reftree'\r\n },{\r\n label: '表参照',\r\n value: 'reftable'\r\n },{\r\n label: '穿梭参照',\r\n value: 'reftransfer'\r\n }]\r\n }]\r\n }\r\n];\r\n\r\nclass Demo6 extends Component { \r\n state = {\r\n options: baseOptions\r\n }\r\n \r\n changeOptions = () => {\r\n this.setState({\r\n options: [{\r\n label: '北京',\r\n value: 'bj',\r\n children: [{\r\n label: '故宫',\r\n value: 'gg',\r\n },{\r\n label: '天坛',\r\n value: 'tt',\r\n },{\r\n label: '王府井',\r\n value: 'wfj',\r\n }]\r\n },\r\n {\r\n label: '江苏',\r\n value: 'js',\r\n children: [{\r\n label: '南京',\r\n value: 'nj',\r\n children: [{\r\n label: '中华门',\r\n value: 'zhm'\r\n }]\r\n }]\r\n },\r\n {\r\n label: '山东',\r\n value: 'sd'\r\n }\r\n ]\r\n })\r\n }\r\n\r\n render(){\r\n return (\r\n <Row>\r\n <Col md={4}>\r\n <div className=\"height-150\">\r\n <Button colors=\"primary\" onClick={this.changeOptions} style={{marginBottom:8+'px'}}>点击改变选项数组</Button>\r\n <Cascader options={this.state.options} placeholder=\"请选择\"/>\r\n </div>\r\n </Col>\r\n </Row>\r\n )\r\n }\r\n}\r\n\r\n", "desc": " 通过动态设置`options`参数,即可灵活改变数据源。" }, { "example": _react2['default'].createElement(Demo7, null), "title": " 不同尺寸的Cascader", "code": "/**\r\n *\r\n * @title 不同尺寸的Cascader\r\n * @description 通过设置`size`属性为 \"lg\" 和 \"sm\" 将输入框设置为大和小尺寸,不设置为默认(中)尺寸。\r\n *\r\n */\r\n\r\nimport React, { Component } from 'react';\r\n\n\nimport { Cascader, Button, Row, Col } from 'tinper-bee';\r\n\r\nconst options = [{\r\n label: '基础组件',\r\n value: 'jczj',\r\n children: [{\r\n label: '导航',\r\n value: 'dh',\r\n children: [{\r\n label: '面包屑',\r\n value: 'mbx'\r\n },{\r\n label: '分页',\r\n value: 'fy'\r\n },{\r\n label: '标签',\r\n value: 'bq'\r\n },{\r\n label: '菜单',\r\n value: 'cd'\r\n }]\r\n },{\r\n label: '反馈',\r\n value: 'fk',\r\n children: [{\r\n label: '模态框',\r\n value: 'mtk'\r\n },{\r\n label: '通知',\r\n value: 'tz'\r\n }]\r\n },\r\n {\r\n label: '表单',\r\n value: 'bd'\r\n }]\r\n },{\r\n label: '应用组件',\r\n value: 'yyzj',\r\n children: [{\r\n label: '参照',\r\n value: 'ref',\r\n children: [{\r\n label: '树参照',\r\n value: 'reftree'\r\n },{\r\n label: '表参照',\r\n value: 'reftable'\r\n },{\r\n label: '穿梭参照',\r\n value: 'reftransfer'\r\n }]\r\n }]\r\n }\r\n];\r\n\r\nclass Demo7 extends Component { \r\n\r\n render(){\r\n return (\r\n <Row>\r\n <Col md={4}>\r\n <div className=\"height-150 demo7\">\r\n <Cascader size=\"sm\" options={options} placeholder=\"请选择\"/>\r\n <Cascader options={options} placeholder=\"请选择\"/>\r\n <Cascader size=\"lg\" options={options} placeholder=\"请选择\"/>\r\n </div>\r\n </Col>\r\n </Row>\r\n )\r\n }\r\n}\r\n\r\n", "desc": " 通过设置`size`属性为 \"lg\" 和 \"sm\" 将输入框设置为大和小尺寸,不设置为默认(中)尺寸。", "scss_code": ".demo7{\r\n span{\r\n margin-bottom: 16px;\r\n }\r\n .u-form-control.lg{\r\n width: 183px;\r\n }\r\n}" }, { "example": _react2['default'].createElement(Demo8, null), "title": " 自定义输入框显示", "code": "/**\r\n *\r\n * @title 自定义输入框显示\r\n * @description 通过设置 `inputValue` 属性,可自定义输入框展示内容。可在 onChange 回调函数中对数据进行自定义处理。\r\n *\r\n */\r\n\r\nimport React, { Component } from 'react';\r\n\nimport { Cascader, Row, Col } from 'tinper-bee';\r\n\r\nconst options = [{\r\n\tlabel: '基础组件',\r\n\tvalue: 'jczj',\r\n\tchildren: [{\r\n\t\tlabel: '导航',\r\n\t\tvalue: 'dh',\r\n\t\tchildren: [{\r\n\t\t\tlabel: '面包屑',\r\n\t\t\tvalue: 'mbx'\r\n\t\t},{\r\n\t\t\tlabel: '分页',\r\n\t\t\tvalue: 'fy'\r\n\t\t},{\r\n\t\t\tlabel: '标签',\r\n\t\t\tvalue: 'bq'\r\n\t\t},{\r\n\t\t\tlabel: '菜单',\r\n\t\t\tvalue: 'cd'\r\n\t\t}]\r\n\t},{\r\n\t\tlabel: '反馈',\r\n\t\tvalue: 'fk',\r\n\t\tchildren: [{\r\n\t\t\tlabel: '模态框',\r\n\t\t\tvalue: 'mtk'\r\n\t\t},{\r\n\t\t\tlabel: '通知',\r\n\t\t\tvalue: 'tz'\r\n\t\t}]\r\n \t},\r\n \t{\r\n\t\tlabel: '表单',\r\n \t value: 'bd'\r\n \t}]\r\n\t},{\r\n\t\tlabel: '应用组件',\r\n\t\tvalue: 'yyzj',\r\n\t\tchildren: [{\r\n\t\t\tlabel: '参照',\r\n\t\t\tvalue: 'ref',\r\n\t\t\tchildren: [{\r\n\t\t\t\tlabel: '树参照',\r\n\t\t\t\tvalue: 'reftree'\r\n\t\t\t},{\r\n\t\t\t\tlabel: '表参照',\r\n\t\t\t\tvalue: 'reftable'\r\n\t\t\t},{\r\n\t\t\t\tlabel: '穿梭参照',\r\n\t\t\t\tvalue: 'reftransfer'\r\n\t\t\t}]\r\n\t\t}]\r\n\t}\r\n];\r\nclass Demo8 extends Component {\r\n\tconstructor(props){\r\n\t\tsuper(props);\r\n\t\tthis.state = {\r\n\t\t\tinputValue:\"\"\r\n\t\t}\r\n\t}\r\n\r\n\tonChange = (value, selectedOptions) => {\r\n console.log(value, selectedOptions);\r\n // 自定义输入框显示内容\r\n let lastLabel = '';\r\n if (typeof selectedOptions !== 'undefined') {\r\n lastLabel = selectedOptions[selectedOptions.length - 1].label;\r\n }\r\n this.setState({ \r\n inputValue : lastLabel\r\n })\r\n\t}\r\n\t\r\n \trender(){\r\n \t\treturn(\r\n\t\t\t<Row>\r\n\t\t\t\t<Col md={4}>\r\n\t\t\t\t\t<div className=\"height-150\">\r\n\t\t\t\t\t\t<Cascader \r\n\t\t\t\t\t\t\toptions = {options} \r\n\t\t\t\t\t\t\tonChange = {this.onChange}\r\n\t\t\t\t\t\t\tplaceholder = \"请选择\"\r\n\t\t\t\t\t\t\tinputValue = {this.state.inputValue}\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</Col>\r\n\t\t\t</Row>\r\n \t\t)\r\n \t}\r\n}\r\n", "desc": " 通过设置 `inputValue` 属性,可自定义输入框展示内容。可在 onChange 回调函数中对数据进行自定义处理。" }]; var Demo = function (_Component) { _inherits(Demo, _Component); function Demo(props) { _classCallCheck(this, Demo); var _this = _possibleConstructorReturn(this, _Component.call(this, props)); _this.handleClick = function () { _this.setState({ open: !_this.state.open }); }; _this.fCloseDrawer = function () { _this.setState({ open: false }); }; _this.state = { open: false }; return _this; } Demo.prototype.render = function render() { var _props = this.props, title = _props.title, example = _props.example, code = _props.code, desc = _props.desc, scss_code = _props.scss_code; var header = _react2['default'].createElement( 'div', null, _react2['default'].createElement( 'p', { className: 'component-title' }, title ), _react2['default'].createElement( 'p', null, desc ), _react2['default'].createElement( 'span', { className: 'component-code', onClick: this.handleClick }, ' \u67E5\u770B\u6E90\u7801 ', _react2['default'].createElement('i', { className: 'uf uf-arrow-right' }), ' ' ) ); return _react2['default'].createElement( _beeLayout.Col, { md: 12, id: title.trim(), className: 'component-demo' }, _react2['default'].createElement( _beePanel.Panel, { header: header }, example ), _react2['default'].createElement( _beeDrawer2['default'], { className: 'component-drawerc', title: title, show: this.state.open, placement: 'right', onClose: this.fCloseDrawer }, _react2['default'].createElement( 'div', { className: 'component-code-copy' }, ' JS\u4EE3\u7801', _react2['default'].createElement(_beeClipboard2['default'], { action: 'copy', text: code }) ), _react2['default'].createElement( 'pre', { className: 'pre-js' }, _react2['default'].createElement( 'code', { className: 'hljs javascript' }, code ) ), !!scss_code ? _react2['default'].createElement( 'div', { className: 'component-code-copy copy-css' }, ' SCSS\u4EE3\u7801', _react2['default'].createElement(_beeClipboard2['default'], { action: 'copy', text: scss_code }) ) : null, !!scss_code ? _react2['default'].createElement( 'pre', { className: 'pre-css' }, _react2['default'].createElement( 'code', { className: 'hljs css' }, scss_code ) ) : null ) ); }; return Demo; }(_react.Component); var DemoGroup = function (_Component2) { _inherits(DemoGroup, _Component2); function DemoGroup(props) { _classCallCheck(this, DemoGroup); return _possibleConstructorReturn(this, _Component2.call(this, props)); } DemoGroup.prototype.render = function render() { return _react2['default'].createElement( _beeLayout.Row, null, DemoArray.map(function (child, index) { return _react2['default'].createElement(Demo, { example: child.example, title: child.title, code: child.code, scss_code: child.scss_code, desc: child.desc, key: index }); }) ); }; return DemoGroup; }(_react.Component); _reactDom2['default'].render(_react2['default'].createElement(DemoGroup, null), document.getElementById('tinperBeeDemo')); /***/ }), /* 1 */ /***/ (function(module, exports) { module.exports = React; /***/ }), /* 2 */ /***/ (function(module, exports) { module.exports = ReactDOM; /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Con = exports.Row = exports.Col = undefined; var _Col2 = __webpack_require__(4); var _Col3 = _interopRequireDefault(_Col2); var _Row2 = __webpack_require__(7); var _Row3 = _interopRequireDefault(_Row2); var _Layout = __webpack_require__(8); var _Layout2 = _interopRequireDefault(_Layout); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } exports.Col = _Col3["default"]; exports.Row = _Row3["default"]; exports.Con = _Layout2["default"]; /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _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; }; var _classnames = __webpack_require__(5); var _classnames2 = _interopRequireDefault(_classnames); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(6); var _propTypes2 = _interopRequireDefault(_propTypes); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } var propTypes = { componentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string]), /** * xs显示列数 */ xs: _propTypes2["default"].number, /** * sm显示列数 */ sm: _propTypes2["default"].number, /** * md显示列数 */ md: _propTypes2["default"].number, /** * lg显示列数 */ lg: _propTypes2["default"].number, /** * xs偏移列数 */ xsOffset: _propTypes2["default"].number, /** * sm偏移列数 */ smOffset: _propTypes2["default"].number, /** * md偏移列数 */ mdOffset: _propTypes2["default"].number, /** * lg偏移列数 */ lgOffset: _propTypes2["default"].number, /** * xs右偏移列数 */ xsPush: _propTypes2["default"].number, /** * sm右偏移列数 */ smPush: _propTypes2["default"].number, /** * md右偏移列数 */ mdPush: _propTypes2["default"].number, /** * lg右偏移列数 */ lgPush: _propTypes2["default"].number, /** * xs左偏移列数 */ xsPull: _propTypes2["default"].number, /** * sm左偏移列数 */ smPull: _propTypes2["default"].number, /** * md左偏移列数 */ mdPull: _propTypes2["default"].number, /** * lg左偏移列数 */ lgPull: _propTypes2["default"].number }; var defaultProps = { componentClass: 'div', clsPrefix: 'u-col' }; var DEVICE_SIZES = ['lg', 'md', 'sm', 'xs']; var Col = function (_Component) { _inherits(Col, _Component); function Col() { _classCallCheck(this, Col); return _possibleConstructorReturn(this, _Component.apply(this, arguments)); } Col.prototype.render = function render() { var _props = this.props, Component = _props.componentClass, className = _props.className, clsPrefix = _props.clsPrefix, others = _objectWithoutProperties(_props, ['componentClass', 'className', 'clsPrefix']); var tbClass = []; /** * 对传入props做样式转化 * @type {[type]} */ DEVICE_SIZES.forEach(function (size) { function popProp(propSuffix, modifier) { var propName = '' + size + propSuffix; var propValue = others[propName]; if (propValue != undefined && propValue != null) { tbClass.push(clsPrefix + '-' + size + modifier + '-' + propValue); } delete others[propName]; } popProp('', ''); popProp('Offset', '-offset'); popProp('Push', '-push'); popProp('Pull', '-pull'); }); return _react2["default"].createElement( Component, _extends({ className: (0, _classnames2["default"])(tbClass, className) }, others), this.props.children ); }; return Col; }(_react.Component); Col.defaultProps = defaultProps; Col.propTypes = propTypes; exports["default"] = Col; module.exports = exports['default']; /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! Copyright (c) 2017 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ /* global define */ (function () { 'use strict'; var hasOwn = {}.hasOwnProperty; function classNames () { var classes = []; for (var i = 0; i < arguments.length; i++) { var arg = arguments[i]; if (!arg) continue; var argType = typeof arg; if (argType === 'string' || argType === 'number') { classes.push(arg); } else if (Array.isArray(arg) && arg.length) { var inner = classNames.apply(null, arg); if (inner) { classes.push(inner); } } else if (argType === 'object') { for (var key in arg) { if (hasOwn.call(arg, key) && arg[key]) { classes.push(key); } } } } return classes.join(' '); } if (typeof module !== 'undefined' && module.exports) { classNames.default = classNames; module.exports = classNames; } else if (true) { // register as 'classnames', consistent with npm package name !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () { return classNames; }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else { window.classNames = classNames; } }()); /***/ }), /* 6 */ /***/ (function(module, exports) { module.exports = PropTypes; /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _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; }; var _classnames = __webpack_require__(5); var _classnames2 = _interopRequireDefault(_classnames); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(6); var _propTypes2 = _interopRequireDefault(_propTypes); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } var propTypes = { componentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string]) }; var defaultProps = { componentClass: 'div', clsPrefix: 'u-row' }; var Row = function (_Component) { _inherits(Row, _Component); function Row() { _classCallCheck(this, Row); return _possibleConstructorReturn(this, _Component.apply(this, arguments)); } Row.prototype.render = function render() { var _props = this.props, Component = _props.componentClass, clsPrefix = _props.clsPrefix, className = _props.className, others = _objectWithoutProperties(_props, ['componentClass', 'clsPrefix', 'className']); var bsclass = '' + clsPrefix; return _react2["default"].createElement( Component, _extends({}, others, { className: (0, _classnames2["default"])(bsclass, className) }), this.props.children ); }; return Row; }(_react.Component); Row.propTypes = propTypes; Row.defaultProps = defaultProps; exports["default"] = Row; module.exports = exports['default']; /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _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; }; var _classnames = __webpack_require__(5); var _classnames2 = _interopRequireDefault(_classnames); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(6); var _propTypes2 = _interopRequireDefault(_propTypes); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } var propTypes = { /** * Adds `container-fluid` class. */ fluid: _propTypes2["default"].bool, /** * You can use a custom element for this component */ componentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string]) }; var defaultProps = { componentClass: 'div', fluid: false, clsPrefix: 'u-container' }; var Con = function (_React$Component) { _inherits(Con, _React$Component); function Con() { _classCallCheck(this, Con); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } Con.prototype.render = function render() { var _tbclass; var _props = this.props, fluid = _props.fluid, Component = _props.componentClass, clsPrefix = _props.clsPrefix, className = _props.className, others = _objectWithoutProperties(_props, ['fluid', 'componentClass', 'clsPrefix', 'className']); var tbclass = (_tbclass = {}, _defineProperty(_tbclass, '' + clsPrefix, !fluid), _defineProperty(_tbclass, clsPrefix + '-fluid', fluid), _tbclass); return _react2["default"].createElement( Component, _extends({}, others, { className: (0, _classnames2["default"])(tbclass, className) }), this.props.children ); }; return Con; }(_react2["default"].Component); Con.propTypes = propTypes; Con.defaultProps = defaultProps; exports["default"] = Con; module.exports = exports['default']; /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.PanelGroup = exports.Panel = undefined; var _Panel2 = __webpack_require__(10); var _Panel3 = _interopRequireDefault(_Panel2); var _PanelGroup2 = __webpack_require__(83); var _PanelGroup3 = _interopRequireDefault(_PanelGroup2); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } exports.Panel = _Panel3["default"]; exports.PanelGroup = _PanelGroup3["default"]; /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _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; }; var _classnames = __webpack_require__(5); var _classnames2 = _interopRequireDefault(_classnames); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _beeTransition = __webpack_require__(11); var _beeMessage = __webpack_require__(65); var _beeMessage2 = _interopRequireDefault(_beeMessage); var _propTypes = __webpack_require__(6); var _propTypes2 = _interopRequireDefault(_propTypes); var _copyToClipboard = __webpack_require__(81); var _copyToClipboard2 = _interopRequireDefault(_copyToClipboard); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } var propTypes = { //是否添加折叠 collapsible: _propTypes2["default"].bool, onSelect: _propTypes2["default"].func, //头部组件 header: _propTypes2["default"].node, headerStyle: _propTypes2["default"].object, id: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]), headerContent: _propTypes2["default"].bool, //footer组件 footer: _propTypes2["default"].node, footerStyle: _propTypes2["default"].object, //默认是否打开 defaultExpanded: _propTypes2["default"].bool, //是否打开 expanded: _propTypes2["default"].bool, //每个panel的标记 eventKey: _propTypes2["default"].any, headerRole: _propTypes2["default"].string, panelRole: _propTypes2["default"].string, //颜色 colors: _propTypes2["default"].oneOf(['primary', 'accent', 'success', 'info', 'warning', 'danger', 'default', 'bordered']), // From Collapse.的扩展动画 onEnter: _propTypes2["default"].func, onEntering: _propTypes2["default"].func, onEntered: _propTypes2["default"].func, onExit: _propTypes2["default"].func, onExiting: _propTypes2["default"].func, onExited: _propTypes2["default"].func, //是否可复制内容 copyable: _propTypes2["default"].bool }; var defaultProps = { defaultExpanded: false, clsPrefix: "u-panel", colors: "default" }; var Panel = function (_React$Component) { _inherits(Panel, _React$Component); function Panel(props, context) { _classCallCheck(this, Panel); var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context)); _this.handleClickTitle = _this.handleClickTitle.bind(_this); _this.state = { expanded: _this.props.defaultExpanded }; return _this; } //头部点击事件 Panel.prototype.handleClickTitle = function handleClickTitle(e) { // 不让事件进入事件池 e.persist(); e.selected = true; if (this.props.onSelect) { this.props.onSelect(this.props.eventKey, e); } else { e.preventDefault(); } if (e.selected) { this.setState({ expanded: !this.state.expanded }); } }; //渲染panelheader Panel.prototype.renderHeader = function renderHeader(collapsible, header, id, role, expanded, clsPrefix) { var titleClassName = clsPrefix + '-title'; if (!collapsible) { if (!_react2["default"].isValidElement(header)) { return header; } return (0, _react.cloneElement)(header, { className: (0, _classnames2["default"])(header.props.className, titleClassName) }); } if (!_react2["default"].isValidElement(header)) { return _react2["default"].createElement( 'h4', { role: 'presentation', className: titleClassName }, this.renderAnchor(header, id, role, expanded) ); } if (this.props.headerContent) { return (0, _react.cloneElement)(header, { className: (0, _classnames2["default"])(header.props.className, titleClassName) }); } return (0, _react.cloneElement)(header, { className: (0, _classnames2["default"])(header.props.className, titleClassName), children: this.renderAnchor(header.props.children, id, role, expanded) }); }; //如果使用链接,渲染为a标签 Panel.prototype.renderAnchor = function renderAnchor(header, id, role, expanded) { return _react2["default"].createElement( 'a', { role: role, href: id && '#' + id, 'aria-controls': id, 'aria-expanded': expanded, 'aria-selected': expanded, className: expanded ? null : 'collapsed' }, header ); }; //复制代码,弹出提示信息 Panel.prototype.copyDemo = function copyDemo(e) { var panelTarget = e.target.parentNode; var clipBoardContent = panelTarget.firstChild.innerText; (0, _copyToClipboard2["default"])(clipBoardContent); _beeMessage2["default"].create({ content: '复制成功!', color: 'success', duration: 2 }); }; //如果有折叠动画,渲染折叠动画 Panel.prototype.renderCollapsibleBody = function renderCollapsibleBody(id, expanded, role, children, clsPrefix, copyable, animationHooks) { return _react2["default"].createElement( _beeTransition.Collapse, _extends({ 'in': expanded }, animationHooks), _react2["default"].createElement( 'div', { id: id, role: role, className: clsPrefix + '-collapse', 'aria-hidden': !expanded }, this.renderBody(children, clsPrefix, copyable) ) ); }; //渲染panelbody Panel.prototype.renderBody = function renderBody(rawChildren, clsPrefix, copyable) { var self = this; var children = []; var bodyChildren = []; var bodyClassName = clsPrefix + '-body'; //添加到body的children中 function maybeAddBody(self) { if (!bodyChildren.length) { return; } // 给子组件添加key,为了之后触发事件时使用 children.push(_react2["default"].createElement( 'div', { key: children.length, className: bodyClassName }, bodyChildren, copyable && _react2["default"].createElement('i', { className: clsPrefix + '-copy uf uf-files-o', onClick: self.copyDemo }) )); bodyChildren = []; } //转换为数组,方便复用 _react2["default"].Children.toArray(rawChildren).forEach(function (child) { if (_react2["default"].isValidElement(child) && child.props.fill) { maybeAddBody(self); //将标示fill设置为undefined children.push((0, _react.cloneElement)(child, { fill: undefined })); return; } bodyChildren.push(child); }); maybeAddBody(self); return children; }; Panel.prototype.render = function render() { var _props = this.props, collapsible = _props.collapsible, header = _props.header, id = _props.id, footer = _props.footer, propsExpanded = _props.expanded, footerStyle = _props.footerStyle, headerStyle = _props.headerStyle, headerRole = _props.headerRole, panelRole = _props.panelRole, className = _props.className, colors = _props.colors, children = _props.children, onEnter = _props.onEnter, onEntering = _props.onEntering, onEntered = _props.onEntered, clsPrefix = _props.clsPrefix, onExit = _props.onExit, headerContent = _props.headerContent, onExiting = _props.onExiting, onExited = _props.onExited, defaultExpanded = _props.defaultExpanded, eventKey = _props.eventKey, onSelect = _props.onSelect, copyable = _props.copyable,