@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 { Radio } from 'antd';
16
+ import classNames from 'classnames';
15
17
  export default function TabBar(props) {
16
- var tabs = props.tabs,
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 (item, index) {
43
- return /*#__PURE__*/React.createElement(Radio.Button, {
44
- key: item.key,
45
- value: item.key,
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
- return handleChange(item.key, index, e);
43
+ setKey(tab.key);
44
+ onTabClick(tab.key, index, e);
48
45
  }
49
- }, item.title || item.key);
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
- min-width: 88px;
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: 22px;
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: 12px;
110
+ top: 8px;
107
111
  left: 0;
108
112
  z-index: 1;
109
113
  display: block;
package/es/index.less CHANGED
@@ -23,3 +23,4 @@
23
23
  @import './components/DataGrid/index.less';
24
24
 
25
25
  @import './layouts/BasicLayout/components/MainFramework/index.less';
26
+ @import './layouts/Breadcrumb/index.less';
@@ -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
- }, children || items.map(function (item, index) {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/kits",
3
- "version": "1.0.0-0",
3
+ "version": "1.0.0-1",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -86,4 +86,4 @@
86
86
  "react-router": "^5.0.0",
87
87
  "react-router-dom": "^5.0.0"
88
88
  }
89
- }
89
+ }