@lemon-fe/kits 1.0.0-0 → 1.0.0-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
|
|
1
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
4
|
|
|
3
5
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -11,12 +13,12 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
11
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
14
|
|
|
13
15
|
import React, { useEffect, useState } from 'react';
|
|
14
|
-
import
|
|
16
|
+
import classNames from 'classnames';
|
|
15
17
|
export default function TabBar(props) {
|
|
16
|
-
var
|
|
18
|
+
var prefixCls = props.prefixCls,
|
|
19
|
+
tabs = props.tabs,
|
|
17
20
|
onTabClick = props.onTabClick,
|
|
18
|
-
activeKey = props.activeKey
|
|
19
|
-
prefixCls = props.prefixCls;
|
|
21
|
+
activeKey = props.activeKey;
|
|
20
22
|
|
|
21
23
|
var getKey = function getKey() {
|
|
22
24
|
return activeKey || (tabs.length > 0 ? tabs[0].key : undefined);
|
|
@@ -30,22 +32,17 @@ export default function TabBar(props) {
|
|
|
30
32
|
useEffect(function () {
|
|
31
33
|
setKey(getKey());
|
|
32
34
|
}, [activeKey]);
|
|
33
|
-
|
|
34
|
-
var handleChange = function handleChange(key, index, e) {
|
|
35
|
-
setKey(key);
|
|
36
|
-
onTabClick(key, index, e);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
return /*#__PURE__*/React.createElement(Radio.Group, {
|
|
40
|
-
value: key,
|
|
35
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
41
36
|
className: "".concat(prefixCls, "-tab")
|
|
42
|
-
}, tabs.map(function (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
37
|
+
}, tabs.map(function (_, index) {
|
|
38
|
+
var tab = tabs[index];
|
|
39
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
key: tab.key,
|
|
41
|
+
className: classNames("".concat(prefixCls, "-tab-item"), _defineProperty({}, "".concat(prefixCls, "-tab-item-active"), key === tab.key)),
|
|
46
42
|
onClick: function onClick(e) {
|
|
47
|
-
|
|
43
|
+
setKey(tab.key);
|
|
44
|
+
onTabClick(tab.key, index, e);
|
|
48
45
|
}
|
|
49
|
-
},
|
|
46
|
+
}, tab.title);
|
|
50
47
|
}));
|
|
51
48
|
}
|
|
@@ -77,7 +77,12 @@
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
&-tab {
|
|
80
|
+
display: inline-flex;
|
|
81
|
+
align-self: flex-start;
|
|
80
82
|
margin-bottom: @space-v;
|
|
83
|
+
padding: 2px;
|
|
84
|
+
background-color: #f2f2f2;
|
|
85
|
+
border-radius: 4px;
|
|
81
86
|
|
|
82
87
|
.@{ant-prefix}-radio-button-wrapper-checked {
|
|
83
88
|
box-shadow: none !important;
|
|
@@ -85,11 +90,10 @@
|
|
|
85
90
|
|
|
86
91
|
&-item {
|
|
87
92
|
position: relative;
|
|
88
|
-
|
|
89
|
-
padding: (@space-v / 2) (@space-h / 2);
|
|
93
|
+
padding: (@space-v / 2) @space-h;
|
|
90
94
|
color: rgba(51, 51, 51, 0.65);
|
|
91
95
|
font-size: 14px;
|
|
92
|
-
line-height:
|
|
96
|
+
line-height: 16px;
|
|
93
97
|
text-align: center;
|
|
94
98
|
background-color: transparent;
|
|
95
99
|
border-radius: 4px;
|
|
@@ -103,7 +107,7 @@
|
|
|
103
107
|
|
|
104
108
|
&-item:not(&-item-active) + &-item:not(&-item-active)::before {
|
|
105
109
|
position: absolute;
|
|
106
|
-
top:
|
|
110
|
+
top: 8px;
|
|
107
111
|
left: 0;
|
|
108
112
|
z-index: 1;
|
|
109
113
|
display: block;
|
package/es/index.less
CHANGED
|
@@ -3,6 +3,8 @@ import { Link, matchPath, useRouteMatch } from 'react-router-dom';
|
|
|
3
3
|
import { Breadcrumb as AntdBreadcrumb } from 'antd';
|
|
4
4
|
import { uniqBy } from 'lodash';
|
|
5
5
|
import { RouteTabContext } from "../components/RouteTab";
|
|
6
|
+
import Icons from "../../components/Icons";
|
|
7
|
+
import { PREFIX_CLS } from "../../constants";
|
|
6
8
|
var BreadcrumbItem = AntdBreadcrumb.Item;
|
|
7
9
|
export default function Breadcrumb(props) {
|
|
8
10
|
var children = props.children;
|
|
@@ -65,7 +67,11 @@ export default function Breadcrumb(props) {
|
|
|
65
67
|
style: {
|
|
66
68
|
fontWeight: 'normal'
|
|
67
69
|
}
|
|
68
|
-
},
|
|
70
|
+
}, items.length > 1 ? /*#__PURE__*/React.createElement("li", {
|
|
71
|
+
className: "".concat(PREFIX_CLS, "-breadcrumb-back")
|
|
72
|
+
}, /*#__PURE__*/React.createElement(Icons.Down, null), /*#__PURE__*/React.createElement(Link, {
|
|
73
|
+
to: items[items.length - 1].url
|
|
74
|
+
}, "\u8FD4\u56DE")) : null, children || items.map(function (item, index) {
|
|
69
75
|
return /*#__PURE__*/React.createElement(BreadcrumbItem, {
|
|
70
76
|
key: item.url
|
|
71
77
|
}, item.url && index < items.length - 1 ? /*#__PURE__*/React.createElement(Link, {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.@{prefixCls}-breadcrumb {
|
|
2
|
+
&-back {
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
|
|
6
|
+
.anticon {
|
|
7
|
+
transform: rotate(90deg);
|
|
8
|
+
margin-right: 6px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&::after {
|
|
12
|
+
display: inline-block;
|
|
13
|
+
width: 1px;
|
|
14
|
+
height: 12px;
|
|
15
|
+
margin: 0 12px;
|
|
16
|
+
background-color: #e7e5e5;
|
|
17
|
+
content: '';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
package/package.json
CHANGED