1 | import _extends from 'babel-runtime/helpers/extends';
|
2 | import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
|
3 | import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
|
4 | import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
5 | import _inherits from 'babel-runtime/helpers/inherits';
|
6 |
|
7 | var _class, _temp;
|
8 |
|
9 | import React, { Component } from 'react';
|
10 | import PropTypes from 'prop-types';
|
11 | import classNames from 'classnames';
|
12 | import ConfigProvider from '../config-provider';
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | var Item = (_temp = _class = function (_Component) {
|
18 | _inherits(Item, _Component);
|
19 |
|
20 | function Item() {
|
21 | _classCallCheck(this, Item);
|
22 |
|
23 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
24 | }
|
25 |
|
26 |
|
27 | Item.Separator = function Separator(_ref) {
|
28 | var prefix = _ref.prefix,
|
29 | children = _ref.children;
|
30 |
|
31 | return React.createElement(
|
32 | 'span',
|
33 | { className: prefix + 'breadcrumb-separator' },
|
34 | children
|
35 | );
|
36 | };
|
37 |
|
38 | Item.prototype.render = function render() {
|
39 | var _props = this.props,
|
40 | prefix = _props.prefix,
|
41 | rtl = _props.rtl,
|
42 | className = _props.className,
|
43 | children = _props.children,
|
44 | link = _props.link,
|
45 | activated = _props.activated,
|
46 | separator = _props.separator,
|
47 | others = _objectWithoutProperties(_props, ['prefix', 'rtl', 'className', 'children', 'link', 'activated', 'separator']);
|
48 |
|
49 | var clazz = classNames(prefix + 'breadcrumb-text', className, {
|
50 | activated: activated
|
51 | });
|
52 |
|
53 | return React.createElement(
|
54 | 'li',
|
55 | { dir: rtl ? 'rtl' : null, className: prefix + 'breadcrumb-item' },
|
56 | link ? React.createElement(
|
57 | 'a',
|
58 | _extends({ href: link, className: clazz }, others),
|
59 | children
|
60 | ) : React.createElement(
|
61 | 'span',
|
62 | _extends({ className: clazz }, others),
|
63 | children
|
64 | ),
|
65 | activated ? null : Item.Separator({ prefix: prefix, children: separator })
|
66 | );
|
67 | };
|
68 |
|
69 | return Item;
|
70 | }(Component), _class.propTypes = {
|
71 | prefix: PropTypes.string,
|
72 | rtl: PropTypes.bool,
|
73 | |
74 |
|
75 |
|
76 | link: PropTypes.string,
|
77 | activated: PropTypes.bool,
|
78 | separator: PropTypes.node,
|
79 | className: PropTypes.any,
|
80 | children: PropTypes.node
|
81 | }, _class.defaultProps = {
|
82 | prefix: 'next-'
|
83 | }, _class._typeMark = 'breadcrumb_item', _temp);
|
84 | Item.displayName = 'Item';
|
85 |
|
86 |
|
87 | export default ConfigProvider.config(Item); |
\ | No newline at end of file |