@ucloud-fe/react-components 1.13.0 → 1.15.0
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.
- package/CHANGELOG.md +19 -0
- package/dist/icon.min.js +1 -1
- package/dist/main.min.js +8 -8
- package/index.d.ts +11 -0
- package/lib/components/Switch/style/index.js +7 -5
- package/lib/components/Table/Table.js +521 -123
- package/lib/components/Tag/Group.d.ts +21 -15
- package/lib/components/Tag/Group.js +175 -31
- package/lib/components/Tag/Icon.d.ts +17 -0
- package/lib/components/Tag/Icon.js +31 -2
- package/lib/components/Tag/Tag.d.ts +19 -0
- package/lib/components/Tag/Tag.js +44 -6
- package/lib/components/Tag/index.d.ts +2 -2
- package/lib/components/Tag/style/index.d.ts +46 -1
- package/lib/components/Tag/style/index.js +259 -85
- package/lib/components/ThemeProvider/designTokens.d.ts +216 -0
- package/lib/components/ThemeProvider/designTokens.js +436 -4
- package/lib/components/ThemeProvider/designTokensDark.d.ts +216 -0
- package/lib/components/ThemeProvider/designTokensDark.js +435 -3
- package/lib/components/ThemeProvider/designTokensPrivate.d.ts +492 -0
- package/lib/components/ThemeProvider/designTokensPrivate.js +989 -0
- package/lib/components/ThemeProvider/private.js +17 -0
- package/package.json +1 -1
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
declare
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type Key = number | string;
|
|
3
|
+
export interface TagGroupProps {
|
|
4
|
+
/** @ignore */
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* 紧凑型布局
|
|
8
|
+
*/
|
|
9
|
+
compact?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* 暴露的Tag数量
|
|
12
|
+
*/
|
|
13
|
+
exposeCount?: number;
|
|
14
|
+
/**
|
|
15
|
+
* 是否自动按照宽度调整展示数量
|
|
16
|
+
* */
|
|
17
|
+
autoAdjustment?: boolean;
|
|
18
|
+
/** 弹出层的 popover props */
|
|
19
|
+
popoverProps?: any;
|
|
14
20
|
}
|
|
15
|
-
|
|
16
|
-
|
|
21
|
+
declare const _default: React.MemoExoticComponent<(props: TagGroupProps & React.HTMLAttributes<HTMLDivElement>) => JSX.Element | null>;
|
|
22
|
+
export default _default;
|
|
@@ -9,60 +9,204 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.default = void 0;
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _newArrowCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/newArrowCheck"));
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
23
|
|
|
24
24
|
var _react = _interopRequireWildcard(require("react"));
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _useOverflow3 = _interopRequireDefault(require("../../hooks/useOverflow"));
|
|
27
|
+
|
|
28
|
+
var _usePopoverConfig = _interopRequireDefault(require("../../hooks/usePopoverConfig"));
|
|
29
|
+
|
|
30
|
+
var _Popover = _interopRequireDefault(require("../../components/Popover"));
|
|
31
|
+
|
|
32
|
+
var _Menu = _interopRequireDefault(require("../../components/Menu"));
|
|
33
|
+
|
|
34
|
+
var _Tag = _interopRequireDefault(require("../../components/Tag"));
|
|
27
35
|
|
|
28
36
|
var _style = require("./style");
|
|
29
37
|
|
|
38
|
+
var _excluded = ["children", "exposeCount", "lens", "popoverProps"],
|
|
39
|
+
_excluded2 = ["children", "exposeCount", "lens"],
|
|
40
|
+
_excluded3 = ["autoAdjustment", "compact", "children"];
|
|
41
|
+
|
|
42
|
+
var _this = void 0;
|
|
43
|
+
|
|
30
44
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
45
|
|
|
32
46
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
47
|
|
|
34
|
-
|
|
48
|
+
var _uid = 0;
|
|
49
|
+
var ID_KEY = 'data-urc-tag_list-id';
|
|
50
|
+
|
|
51
|
+
var TagMenu = function TagMenu(_ref) {
|
|
52
|
+
var _this2 = this;
|
|
53
|
+
|
|
54
|
+
(0, _newArrowCheck2.default)(this, _this);
|
|
55
|
+
var list = _ref.list,
|
|
56
|
+
popoverProps = _ref.popoverProps;
|
|
57
|
+
var popoverConfigProps = (0, _usePopoverConfig.default)();
|
|
58
|
+
if (!list.length) return null;
|
|
59
|
+
|
|
60
|
+
var renderList = function renderList(list) {
|
|
61
|
+
var _this3 = this;
|
|
62
|
+
|
|
63
|
+
(0, _newArrowCheck2.default)(this, _this2);
|
|
64
|
+
return list.map(function (info, i) {
|
|
65
|
+
(0, _newArrowCheck2.default)(this, _this3);
|
|
66
|
+
return /*#__PURE__*/_react.default.createElement(_style.TagPopoverWrap, {
|
|
67
|
+
key: i
|
|
68
|
+
}, info);
|
|
69
|
+
}.bind(this));
|
|
70
|
+
}.bind(this);
|
|
71
|
+
|
|
72
|
+
return /*#__PURE__*/_react.default.createElement(_Popover.default, (0, _extends2.default)({
|
|
73
|
+
trigger: ['hover'],
|
|
74
|
+
popup: /*#__PURE__*/_react.default.createElement(_style.TagMenuWapper, null, /*#__PURE__*/_react.default.createElement(_Menu.default, {
|
|
75
|
+
selectable: false,
|
|
76
|
+
customStyle: {
|
|
77
|
+
maxHeight: '380px'
|
|
78
|
+
}
|
|
79
|
+
}, renderList(list)))
|
|
80
|
+
}, popoverConfigProps, popoverProps), /*#__PURE__*/_react.default.createElement(_style.TagMoreWapper, null, /*#__PURE__*/_react.default.createElement(_Tag.default, null, "+", list.length)));
|
|
81
|
+
}.bind(void 0);
|
|
82
|
+
|
|
83
|
+
var PureTagList = function PureTagList(props) {
|
|
84
|
+
(0, _newArrowCheck2.default)(this, _this);
|
|
85
|
+
var children = props.children,
|
|
86
|
+
exposeCount = props.exposeCount,
|
|
87
|
+
lens = props.lens,
|
|
88
|
+
popoverProps = props.popoverProps,
|
|
89
|
+
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
90
|
+
|
|
91
|
+
var childArray = _react.default.Children.toArray(children);
|
|
92
|
+
|
|
93
|
+
var _exposeCount = exposeCount || 0;
|
|
94
|
+
|
|
95
|
+
var tagList, menuList;
|
|
96
|
+
|
|
97
|
+
if (lens > _exposeCount + 1) {
|
|
98
|
+
tagList = childArray.slice(0, exposeCount);
|
|
99
|
+
menuList = childArray.slice(exposeCount);
|
|
100
|
+
} else {
|
|
101
|
+
tagList = childArray;
|
|
102
|
+
menuList = [];
|
|
103
|
+
}
|
|
35
104
|
|
|
36
|
-
|
|
105
|
+
return exposeCount === void 0 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tagList) : /*#__PURE__*/_react.default.createElement(_style.SWrap, (0, _extends2.default)({}, rest, {
|
|
106
|
+
exposeCount: exposeCount,
|
|
107
|
+
sharedProps: {
|
|
108
|
+
size: 'sm'
|
|
109
|
+
}
|
|
110
|
+
}), tagList, menuList.length ? /*#__PURE__*/_react.default.createElement(TagMenu, {
|
|
111
|
+
list: menuList,
|
|
112
|
+
popoverProps: popoverProps
|
|
113
|
+
}) : null);
|
|
114
|
+
}.bind(void 0);
|
|
37
115
|
|
|
38
|
-
|
|
39
|
-
|
|
116
|
+
PureTagList.propTypes = {
|
|
117
|
+
children: _propTypes.default.node,
|
|
118
|
+
compact: _propTypes.default.bool,
|
|
119
|
+
exposeCount: _propTypes.default.number,
|
|
120
|
+
autoAdjustment: _propTypes.default.bool,
|
|
121
|
+
popoverProps: _propTypes.default.any
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
var AutoAdjustmentTagList = function AutoAdjustmentTagList(props) {
|
|
125
|
+
var _this4 = this;
|
|
126
|
+
|
|
127
|
+
(0, _newArrowCheck2.default)(this, _this);
|
|
128
|
+
|
|
129
|
+
var children = props.children,
|
|
130
|
+
_props$exposeCount = props.exposeCount,
|
|
131
|
+
_exposeCount = _props$exposeCount === void 0 ? 3 : _props$exposeCount,
|
|
132
|
+
lens = props.lens,
|
|
133
|
+
rest = (0, _objectWithoutProperties2.default)(props, _excluded2);
|
|
134
|
+
|
|
135
|
+
var _useState = (0, _react.useState)(function () {
|
|
136
|
+
(0, _newArrowCheck2.default)(this, _this4);
|
|
137
|
+
return _uid++;
|
|
138
|
+
}.bind(this)),
|
|
139
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 1),
|
|
140
|
+
uid = _useState2[0];
|
|
141
|
+
|
|
142
|
+
var containerRef = (0, _react.useRef)(null);
|
|
143
|
+
(0, _react.useLayoutEffect)(function () {
|
|
144
|
+
(0, _newArrowCheck2.default)(this, _this4);
|
|
145
|
+
containerRef.current = document.querySelector("[".concat(ID_KEY, "=\"").concat(uid, "\"]"));
|
|
146
|
+
}.bind(this), [uid]);
|
|
147
|
+
var maxCount = (0, _react.useMemo)(function () {
|
|
148
|
+
(0, _newArrowCheck2.default)(this, _this4);
|
|
149
|
+
var maxCount = Math.min(lens, Math.max(_exposeCount, 0));
|
|
150
|
+
return maxCount;
|
|
151
|
+
}.bind(this), [_exposeCount, lens]);
|
|
152
|
+
|
|
153
|
+
var _useOverflow = (0, _useOverflow3.default)({
|
|
154
|
+
containerRef: containerRef,
|
|
155
|
+
defaultCount: maxCount,
|
|
156
|
+
maxCount: maxCount
|
|
157
|
+
}),
|
|
158
|
+
_useOverflow2 = (0, _slicedToArray2.default)(_useOverflow, 1),
|
|
159
|
+
exposeCount = _useOverflow2[0];
|
|
160
|
+
|
|
161
|
+
return /*#__PURE__*/_react.default.createElement(PureTagList, (0, _extends2.default)({}, rest, {
|
|
162
|
+
lens: lens,
|
|
163
|
+
children: children,
|
|
164
|
+
exposeCount: exposeCount
|
|
165
|
+
}, (0, _defineProperty2.default)({}, ID_KEY, uid)));
|
|
166
|
+
}.bind(void 0);
|
|
167
|
+
|
|
168
|
+
AutoAdjustmentTagList.propTypes = {
|
|
169
|
+
children: _propTypes.default.node,
|
|
170
|
+
compact: _propTypes.default.bool,
|
|
171
|
+
exposeCount: _propTypes.default.number,
|
|
172
|
+
autoAdjustment: _propTypes.default.bool,
|
|
173
|
+
popoverProps: _propTypes.default.any
|
|
174
|
+
};
|
|
40
175
|
|
|
41
|
-
|
|
176
|
+
var Group = function Group(props) {
|
|
177
|
+
(0, _newArrowCheck2.default)(this, _this);
|
|
178
|
+
var autoAdjustment = props.autoAdjustment,
|
|
179
|
+
compact = props.compact,
|
|
180
|
+
children = props.children,
|
|
181
|
+
rest = (0, _objectWithoutProperties2.default)(props, _excluded3);
|
|
42
182
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return _super.apply(this, arguments);
|
|
183
|
+
if (!children) {
|
|
184
|
+
return null;
|
|
46
185
|
}
|
|
47
186
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
187
|
+
var lens = Array.isArray(children) ? children.length : 1;
|
|
188
|
+
return !compact ? /*#__PURE__*/_react.default.createElement(_style.TagGroupWrapper, (0, _extends2.default)({
|
|
189
|
+
compact: false
|
|
190
|
+
}, rest), autoAdjustment ? /*#__PURE__*/_react.default.createElement(AutoAdjustmentTagList, (0, _extends2.default)({
|
|
191
|
+
lens: lens,
|
|
192
|
+
children: children
|
|
193
|
+
}, rest)) : /*#__PURE__*/_react.default.createElement(PureTagList, (0, _extends2.default)({
|
|
194
|
+
lens: lens,
|
|
195
|
+
children: children
|
|
196
|
+
}, rest))) : /*#__PURE__*/_react.default.createElement(_style.TagGroupWrapper, (0, _extends2.default)({
|
|
197
|
+
compact: compact,
|
|
198
|
+
children: children
|
|
199
|
+
}, rest));
|
|
200
|
+
}.bind(void 0);
|
|
57
201
|
|
|
58
202
|
Group.propTypes = {
|
|
59
|
-
/** @ignore */
|
|
60
203
|
children: _propTypes.default.node,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
compact: _propTypes.default.bool
|
|
204
|
+
compact: _propTypes.default.bool,
|
|
205
|
+
exposeCount: _propTypes.default.number,
|
|
206
|
+
autoAdjustment: _propTypes.default.bool,
|
|
207
|
+
popoverProps: _propTypes.default.any
|
|
66
208
|
};
|
|
67
|
-
|
|
209
|
+
|
|
210
|
+
var _default = /*#__PURE__*/_react.default.memo(Group);
|
|
211
|
+
|
|
68
212
|
exports.default = _default;
|
|
@@ -13,6 +13,18 @@ declare class Icon extends React.PureComponent<any, any, any> {
|
|
|
13
13
|
* 样式风格
|
|
14
14
|
*/
|
|
15
15
|
styleType: PropTypes.Requireable<string>;
|
|
16
|
+
/**
|
|
17
|
+
* icon 大小
|
|
18
|
+
*/
|
|
19
|
+
iconSize: PropTypes.Requireable<string>;
|
|
20
|
+
/**
|
|
21
|
+
* 是否开启border样式
|
|
22
|
+
*/
|
|
23
|
+
border: PropTypes.Requireable<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* border 类型
|
|
26
|
+
*/
|
|
27
|
+
borderType: PropTypes.Requireable<string>;
|
|
16
28
|
/**
|
|
17
29
|
* 自定义样式
|
|
18
30
|
*/
|
|
@@ -25,6 +37,11 @@ declare class Icon extends React.PureComponent<any, any, any> {
|
|
|
25
37
|
background: PropTypes.Requireable<string>;
|
|
26
38
|
}>>;
|
|
27
39
|
};
|
|
40
|
+
static defaultProps: {
|
|
41
|
+
borderType: string;
|
|
42
|
+
iconSize: string;
|
|
43
|
+
border: boolean;
|
|
44
|
+
};
|
|
28
45
|
constructor(props: any);
|
|
29
46
|
constructor(props: any, context: any);
|
|
30
47
|
render(): JSX.Element;
|
|
@@ -9,6 +9,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.default = void 0;
|
|
11
11
|
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
12
14
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
15
|
|
|
14
16
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
@@ -29,7 +31,7 @@ var _style = require("./style");
|
|
|
29
31
|
|
|
30
32
|
var _Tag = require("./Tag");
|
|
31
33
|
|
|
32
|
-
var _excluded = ["children", "icon", "prefix"];
|
|
34
|
+
var _excluded = ["children", "icon", "prefix", "borderType", "iconSize", "border"];
|
|
33
35
|
|
|
34
36
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
35
37
|
|
|
@@ -57,8 +59,15 @@ var Icon = /*#__PURE__*/function (_PureComponent) {
|
|
|
57
59
|
children = _this$props.children,
|
|
58
60
|
icon = _this$props.icon,
|
|
59
61
|
prefix = _this$props.prefix,
|
|
62
|
+
borderType = _this$props.borderType,
|
|
63
|
+
iconSize = _this$props.iconSize,
|
|
64
|
+
border = _this$props.border,
|
|
60
65
|
rest = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
|
|
61
|
-
return /*#__PURE__*/_react.default.createElement(_style.IconTagWrapper,
|
|
66
|
+
return /*#__PURE__*/_react.default.createElement(_style.IconTagWrapper, (0, _extends2.default)({
|
|
67
|
+
borderType: borderType,
|
|
68
|
+
iconSize: iconSize,
|
|
69
|
+
border: border
|
|
70
|
+
}, rest), typeof icon === 'string' ? /*#__PURE__*/_react.default.createElement(_style.IconTag, {
|
|
62
71
|
type: icon,
|
|
63
72
|
prefix: prefix
|
|
64
73
|
}) : icon);
|
|
@@ -84,6 +93,21 @@ Icon.propTypes = {
|
|
|
84
93
|
*/
|
|
85
94
|
styleType: _propTypes.default.oneOf(_Tag.StyleType),
|
|
86
95
|
|
|
96
|
+
/**
|
|
97
|
+
* icon 大小
|
|
98
|
+
*/
|
|
99
|
+
iconSize: _propTypes.default.oneOf(['xs', 'sm', 'md', 'lg']),
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* 是否开启border样式
|
|
103
|
+
*/
|
|
104
|
+
border: _propTypes.default.bool,
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* border 类型
|
|
108
|
+
*/
|
|
109
|
+
borderType: _propTypes.default.oneOf(['default', 'circle']),
|
|
110
|
+
|
|
87
111
|
/**
|
|
88
112
|
* 自定义样式
|
|
89
113
|
*/
|
|
@@ -98,5 +122,10 @@ Icon.propTypes = {
|
|
|
98
122
|
background: _propTypes.default.string
|
|
99
123
|
})
|
|
100
124
|
};
|
|
125
|
+
Icon.defaultProps = {
|
|
126
|
+
borderType: 'default',
|
|
127
|
+
iconSize: 'sm',
|
|
128
|
+
border: true
|
|
129
|
+
};
|
|
101
130
|
var _default = Icon;
|
|
102
131
|
exports.default = _default;
|
|
@@ -19,6 +19,22 @@ declare class Tag extends React.PureComponent<any, any, any> {
|
|
|
19
19
|
* 自定义前置 icon
|
|
20
20
|
*/
|
|
21
21
|
icon: PropTypes.Requireable<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
|
|
22
|
+
/**
|
|
23
|
+
* icon 大小
|
|
24
|
+
*/
|
|
25
|
+
iconSize: PropTypes.Requireable<string>;
|
|
26
|
+
/**
|
|
27
|
+
* 是否开启border样式
|
|
28
|
+
*/
|
|
29
|
+
border: PropTypes.Requireable<boolean>;
|
|
30
|
+
/**
|
|
31
|
+
* border 类型
|
|
32
|
+
*/
|
|
33
|
+
borderType: PropTypes.Requireable<string>;
|
|
34
|
+
/**
|
|
35
|
+
* 后缀
|
|
36
|
+
*/
|
|
37
|
+
suffix: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
22
38
|
/**
|
|
23
39
|
* 是否禁用
|
|
24
40
|
*/
|
|
@@ -39,6 +55,9 @@ declare class Tag extends React.PureComponent<any, any, any> {
|
|
|
39
55
|
};
|
|
40
56
|
static defaultProps: {
|
|
41
57
|
styleType: string;
|
|
58
|
+
borderType: string;
|
|
59
|
+
iconSize: string;
|
|
60
|
+
border: boolean;
|
|
42
61
|
};
|
|
43
62
|
constructor(props: any);
|
|
44
63
|
constructor(props: any, context: any);
|
|
@@ -27,9 +27,11 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
27
27
|
|
|
28
28
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
29
29
|
|
|
30
|
+
var _SvgIcon = _interopRequireDefault(require("../../components/SvgIcon"));
|
|
31
|
+
|
|
30
32
|
var _style = require("./style");
|
|
31
33
|
|
|
32
|
-
var _excluded = ["children", "styleType", "closable", "icon", "disabled", "onClose"];
|
|
34
|
+
var _excluded = ["children", "styleType", "closable", "icon", "disabled", "onClose", "iconSize", "border", "borderType", "suffix"];
|
|
33
35
|
|
|
34
36
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
35
37
|
|
|
@@ -62,13 +64,26 @@ var Tag = /*#__PURE__*/function (_PureComponent) {
|
|
|
62
64
|
icon = _this$props.icon,
|
|
63
65
|
disabled = _this$props.disabled,
|
|
64
66
|
onClose = _this$props.onClose,
|
|
67
|
+
iconSize = _this$props.iconSize,
|
|
68
|
+
border = _this$props.border,
|
|
69
|
+
borderType = _this$props.borderType,
|
|
70
|
+
suffix = _this$props.suffix,
|
|
65
71
|
rest = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
|
|
66
72
|
return /*#__PURE__*/_react.default.createElement(_style.TagWrapper, (0, _extends2.default)({
|
|
67
73
|
styleType: styleType,
|
|
68
|
-
disabled: disabled
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
disabled: disabled,
|
|
75
|
+
border: border,
|
|
76
|
+
borderType: borderType,
|
|
77
|
+
closable: closable
|
|
78
|
+
}, rest), icon && /*#__PURE__*/_react.default.createElement(_style.PrefixIconWrapper, null, typeof icon === 'string' ? icon === 'loading' ? /*#__PURE__*/_react.default.createElement(_style.SvgIconWrapper, {
|
|
79
|
+
size: iconSize
|
|
80
|
+
}, /*#__PURE__*/_react.default.createElement(_SvgIcon.default, {
|
|
81
|
+
type: "loading-line",
|
|
82
|
+
spin: true
|
|
83
|
+
})) : /*#__PURE__*/_react.default.createElement(_style.PrefixIcon, {
|
|
84
|
+
type: icon,
|
|
85
|
+
size: iconSize
|
|
86
|
+
}) : icon), /*#__PURE__*/_react.default.createElement(_style.ContentWrapper, null, children), suffix && /*#__PURE__*/_react.default.createElement(_style.SuffixIconWrapper, null, suffix), closable && /*#__PURE__*/_react.default.createElement(_style.CloseIconWrapper, {
|
|
72
87
|
onClick: disabled ? undefined : onClose
|
|
73
88
|
}, /*#__PURE__*/_react.default.createElement(_style.CloseIcon, {
|
|
74
89
|
type: "cross"
|
|
@@ -102,6 +117,26 @@ Tag.propTypes = {
|
|
|
102
117
|
*/
|
|
103
118
|
icon: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
|
104
119
|
|
|
120
|
+
/**
|
|
121
|
+
* icon 大小
|
|
122
|
+
*/
|
|
123
|
+
iconSize: _propTypes.default.oneOf(['xs', 'sm', 'md', 'lg']),
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* 是否开启border样式
|
|
127
|
+
*/
|
|
128
|
+
border: _propTypes.default.bool,
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* border 类型
|
|
132
|
+
*/
|
|
133
|
+
borderType: _propTypes.default.oneOf(['default', 'circle', 'corner']),
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* 后缀
|
|
137
|
+
*/
|
|
138
|
+
suffix: _propTypes.default.node,
|
|
139
|
+
|
|
105
140
|
/**
|
|
106
141
|
* 是否禁用
|
|
107
142
|
*/
|
|
@@ -125,7 +160,10 @@ Tag.propTypes = {
|
|
|
125
160
|
})
|
|
126
161
|
};
|
|
127
162
|
Tag.defaultProps = {
|
|
128
|
-
styleType: 'default'
|
|
163
|
+
styleType: 'default',
|
|
164
|
+
borderType: 'default',
|
|
165
|
+
iconSize: 'sm',
|
|
166
|
+
border: true
|
|
129
167
|
};
|
|
130
168
|
var _default = Tag;
|
|
131
169
|
exports.default = _default;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import Tag from './Tag';
|
|
2
|
-
import Group from './Group';
|
|
3
3
|
import IconTag from './Icon';
|
|
4
4
|
declare const ExportTag: typeof Tag & {
|
|
5
|
-
Group:
|
|
5
|
+
Group: import("react").MemoExoticComponent<(props: import("./Group").TagGroupProps & import("react").HTMLAttributes<HTMLDivElement>) => JSX.Element | null>;
|
|
6
6
|
Icon: typeof IconTag;
|
|
7
7
|
};
|
|
8
8
|
export default ExportTag;
|