@para-ui/core 4.0.0-rc.3 → 4.0.0-rc.5

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.
Files changed (180) hide show
  1. package/AutoBox/index.js +72 -85
  2. package/AutoTips/index.js +72 -95
  3. package/Badge/index.js +18 -17
  4. package/Breadcrumbs/index.js +57 -73
  5. package/Button/index.js +89 -117
  6. package/ButtonGroup/index.js +30 -33
  7. package/Carousel/index.js +29 -33
  8. package/Cascader/index.js +7 -9
  9. package/Checkbox/index.js +28 -35
  10. package/CheckboxGroup/index.js +43 -58
  11. package/Collapse/index.js +52 -49
  12. package/CollapseBox/index.js +65 -70
  13. package/CollapseLayout/index.js +106 -101
  14. package/ColorPicker/index.js +3 -3
  15. package/ComboSelect/index.js +242 -330
  16. package/ComboSelect/utils.d.ts +0 -5
  17. package/Container/index.js +17 -21
  18. package/CopyText/index.js +50 -83
  19. package/DatePicker/index.js +22 -27
  20. package/Descriptions/index.js +50 -59
  21. package/Desktop/index.js +161 -180
  22. package/DragVerify/index.js +77 -113
  23. package/Drawer/index.js +82 -97
  24. package/Dropdown/index.js +3 -3
  25. package/DynamicMultiBox/index.js +219 -224
  26. package/DynamicMultiBox/interface.d.ts +7 -0
  27. package/Empty/index.js +26 -28
  28. package/Form/index.js +66 -74
  29. package/FormItem/index.js +14 -15
  30. package/FunctionModal/index.js +7 -14
  31. package/GlobalContext/index.js +17 -20
  32. package/Help/index.js +9 -12
  33. package/HelperText/index.js +11 -11
  34. package/InputLang/index.js +104 -124
  35. package/InputNumber/index.js +62 -81
  36. package/Label/index.js +19 -21
  37. package/Loading/index.js +11 -10
  38. package/Menu/index.js +302 -371
  39. package/Message/index.js +105 -114
  40. package/Modal/index.js +122 -148
  41. package/MultiBox/index.d.ts +5 -0
  42. package/MultiBox/index.js +111 -115
  43. package/Notification/index.js +105 -103
  44. package/OperateBtn/index.d.ts +3 -0
  45. package/OperateBtn/index.js +77 -107
  46. package/PageHeader/index.js +327 -406
  47. package/Pagination/index.js +107 -137
  48. package/ParauiProvider/index.js +20 -22
  49. package/PasswordRules/index.js +36 -40
  50. package/PopConfirm/index.js +62 -79
  51. package/Popover/index.js +12 -12
  52. package/Progress/index.js +72 -74
  53. package/Querying/index.js +52 -59
  54. package/README.md +2 -0
  55. package/Radio/index.js +27 -34
  56. package/RadioGroup/index.js +38 -52
  57. package/Search/index.js +35 -44
  58. package/Select/index.js +323 -364
  59. package/SelectInput/index.js +8 -13
  60. package/Selector/index.js +905 -796
  61. package/SelectorPicker/index.js +111 -133
  62. package/SingleBox/index.d.ts +5 -0
  63. package/SingleBox/index.js +92 -88
  64. package/Slider/index.js +46 -57
  65. package/Status/index.js +14 -13
  66. package/Stepper/index.js +25 -26
  67. package/Styles/theme.scss +9 -9
  68. package/Switch/index.js +32 -35
  69. package/Table/index.js +767 -963
  70. package/Tabs/index.js +102 -102
  71. package/Tag/index.js +115 -162
  72. package/TextEditor/index.js +81 -103
  73. package/TextField/index.js +142 -183
  74. package/TimePicker/index.js +27 -28
  75. package/Timeline/index.js +67 -58
  76. package/Title/index.js +32 -34
  77. package/ToggleButton/index.js +53 -52
  78. package/Tooltip/index.js +79 -82
  79. package/Transfer/index.js +160 -203
  80. package/Tree/index.js +7 -12
  81. package/Upload/index.js +527 -759
  82. package/Upload/interface.d.ts +5 -0
  83. package/_verture/{constant-0d9802f7.js → constant-5317fc89.js} +2 -2
  84. package/_verture/{index-f48d5ce6.js → index-0ced30f7.js} +1128 -1080
  85. package/_verture/{index-024bbc9b.js → index-775ad32d.js} +29 -25
  86. package/_verture/{index-05f7bf11.js → index-c568f272.js} +2 -2
  87. package/_verture/index-da9097d3.js +239 -0
  88. package/_verture/{index-56601c94.js → index-ef1235fb.js} +125 -134
  89. package/_verture/{index-de8f4428.js → index-f186b5e8.js} +315 -399
  90. package/_verture/intl-f2f27722.js +69 -0
  91. package/_verture/{modalContext-736ff215.js → modalContext-5df08980.js} +36 -64
  92. package/_verture/{slicedToArray-a8206399.js → slicedToArray-8223a2ef.js} +15 -2
  93. package/_verture/{useFormatMessage-703f8b20.js → useFormatMessage-eb13cf56.js} +5 -4
  94. package/_verture/{useGlobalProps-1b846a65.js → useGlobalProps-1e416658.js} +4 -3
  95. package/_verture/{usePopupContainer-87febeb9.js → usePopupContainer-635f66f4.js} +16 -15
  96. package/_verture/{util-7e1fb1e2.js → util-82646c4f.js} +5 -4
  97. package/_verture/{utils-06d86594.js → utils-46e99c9a.js} +34 -26
  98. package/index.js +21 -22
  99. package/locale/index.js +10 -10
  100. package/package.json +1 -1
  101. package/umd/AutoBox.js +9 -8
  102. package/umd/AutoTips.js +9 -8
  103. package/umd/Badge.js +1 -1
  104. package/umd/Breadcrumbs.js +9 -8
  105. package/umd/Button.js +9 -8
  106. package/umd/ButtonGroup.js +9 -8
  107. package/umd/Carousel.js +5 -5
  108. package/umd/Cascader.js +9 -8
  109. package/umd/Checkbox.js +9 -8
  110. package/umd/CheckboxGroup.js +9 -8
  111. package/umd/Collapse.js +8 -7
  112. package/umd/CollapseBox.js +1 -1
  113. package/umd/CollapseLayout.js +4 -4
  114. package/umd/ColorPicker.js +1 -1
  115. package/umd/ComboSelect.js +9 -8
  116. package/umd/Container.js +1 -1
  117. package/umd/CopyText.js +9 -8
  118. package/umd/DatePicker.js +9 -8
  119. package/umd/Descriptions.js +9 -8
  120. package/umd/Desktop.js +9 -8
  121. package/umd/DragVerify.js +4 -4
  122. package/umd/Drawer.js +9 -8
  123. package/umd/Dropdown.js +6 -5
  124. package/umd/DynamicMultiBox.js +11 -10
  125. package/umd/Empty.js +1 -1
  126. package/umd/Form.js +9 -8
  127. package/umd/FormItem.js +9 -8
  128. package/umd/FunctionModal.js +9 -8
  129. package/umd/GlobalContext.js +1 -1
  130. package/umd/Help.js +9 -8
  131. package/umd/HelperText.js +1 -1
  132. package/umd/InputLang.js +9 -8
  133. package/umd/InputNumber.js +9 -8
  134. package/umd/Label.js +9 -8
  135. package/umd/Loading.js +4 -4
  136. package/umd/Menu.js +4 -4
  137. package/umd/Message.js +4 -4
  138. package/umd/Modal.js +9 -8
  139. package/umd/MultiBox.js +9 -8
  140. package/umd/Notification.js +8 -7
  141. package/umd/OperateBtn.js +9 -8
  142. package/umd/PageHeader.js +9 -8
  143. package/umd/Pagination.js +9 -8
  144. package/umd/ParauiProvider.js +1 -1
  145. package/umd/PasswordRules.js +4 -4
  146. package/umd/PopConfirm.js +9 -8
  147. package/umd/Popover.js +9 -8
  148. package/umd/Progress.js +5 -5
  149. package/umd/Querying.js +1 -1
  150. package/umd/Radio.js +9 -8
  151. package/umd/RadioGroup.js +9 -8
  152. package/umd/Search.js +9 -8
  153. package/umd/Select.js +9 -8
  154. package/umd/SelectInput.js +9 -8
  155. package/umd/Selector.js +9 -8
  156. package/umd/SelectorPicker.js +9 -8
  157. package/umd/SingleBox.js +9 -8
  158. package/umd/Slider.js +6 -5
  159. package/umd/Status.js +4 -4
  160. package/umd/Stepper.js +9 -8
  161. package/umd/Switch.js +9 -8
  162. package/umd/Table.js +9 -8
  163. package/umd/Tabs.js +9 -8
  164. package/umd/Tag.js +9 -8
  165. package/umd/TextEditor.js +22 -21
  166. package/umd/TextField.js +9 -8
  167. package/umd/TimePicker.js +9 -8
  168. package/umd/Timeline.js +1 -1
  169. package/umd/Title.js +9 -8
  170. package/umd/ToggleButton.js +9 -8
  171. package/umd/Tooltip.js +9 -8
  172. package/umd/Transfer.js +10 -9
  173. package/umd/Tree.js +9 -8
  174. package/umd/Upload.js +10 -9
  175. package/umd/locale.js +1 -1
  176. package/_verture/index-232d890b.js +0 -327
  177. package/_verture/index-e9007d6a.js +0 -236
  178. package/_verture/intl-5c1ec055.js +0 -81
  179. package/_verture/toConsumableArray-8f4c9589.js +0 -19
  180. package/_verture/unsupportedIterableToArray-cb478f24.js +0 -16
package/Tag/index.js CHANGED
@@ -1,19 +1,14 @@
1
- import { _ as _defineProperty } from '../_verture/defineProperty-1d116156.js';
2
- import { _ as _slicedToArray } from '../_verture/slicedToArray-a8206399.js';
3
1
  import { _ as __rest } from '../_verture/tslib.es6-55ed4bd2.js';
4
2
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
5
3
  import { useState, useRef, useEffect } from 'react';
6
4
  import CloseIcon from '@para-ui/icons/Close';
7
5
  import EditIcon from '@para-ui/icons/EditOutline';
8
6
  import clsx from 'clsx';
9
- import { _ as _toConsumableArray } from '../_verture/toConsumableArray-8f4c9589.js';
10
- import { _ as _typeof } from '../_verture/typeof-adeedc13.js';
11
- import { $ as $prefixCls } from '../_verture/constant-0d9802f7.js';
7
+ import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
12
8
  import AutoTips from '../AutoTips/index.js';
13
9
  import { t as tinycolor } from '../_verture/tinycolor-ece3542d.js';
14
10
  import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
15
11
  import Plus from '@para-ui/icons/Plus';
16
- import '../_verture/unsupportedIterableToArray-cb478f24.js';
17
12
  import '../Tooltip/index.js';
18
13
  import 'rc-tooltip';
19
14
  import 'rc-tooltip/lib/placements';
@@ -24,121 +19,97 @@ var css_248z = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2022/1/12 上
24
19
  styleInject(css_248z);
25
20
 
26
21
  //tag group
27
- var TagGroup = function TagGroup(props) {
28
- var className = props.className,
29
- _props$size = props.size,
30
- size = _props$size === void 0 ? 'large' : _props$size,
31
- style = props.style,
32
- defaultInputValue = props.defaultInputValue,
33
- _props$increased = props.increased,
34
- increased = _props$increased === void 0 ? false : _props$increased,
35
- increasedTag = props.increasedTag,
36
- inputClassName = props.inputClassName,
37
- inputWidth = props.inputWidth,
38
- onChange = props.onChange;
39
- var _useState = useState([]),
40
- _useState2 = _slicedToArray(_useState, 2),
41
- inData = _useState2[0],
42
- setInData = _useState2[1]; //数据源
43
- var _useState3 = useState(defaultInputValue !== null && defaultInputValue !== void 0 ? defaultInputValue : ''),
44
- _useState4 = _slicedToArray(_useState3, 2),
45
- inputValue = _useState4[0],
46
- setInputValue = _useState4[1]; //input value
47
- var _useState5 = useState(false),
48
- _useState6 = _slicedToArray(_useState5, 2),
49
- inputVisible = _useState6[0],
50
- setInputVisible = _useState6[1]; //input visible
51
- var inputRef = useRef(); //input ref
52
- var _useState7 = useState(),
53
- _useState8 = _slicedToArray(_useState7, 2),
54
- increasedInputWidth = _useState8[0],
55
- setIncreasedInputWidth = _useState8[1]; //添加标签的最小宽
56
- useEffect(function () {
22
+ const TagGroup = props => {
23
+ const {
24
+ className,
25
+ size = 'large',
26
+ style,
27
+ defaultInputValue,
28
+ increased = false,
29
+ increasedTag,
30
+ inputClassName,
31
+ inputWidth,
32
+ onChange
33
+ } = props;
34
+ const [inData, setInData] = useState([]); //数据源
35
+ const [inputValue, setInputValue] = useState(defaultInputValue !== null && defaultInputValue !== void 0 ? defaultInputValue : ''); //input value
36
+ const [inputVisible, setInputVisible] = useState(false); //input visible
37
+ const inputRef = useRef(); //input ref
38
+ const [increasedInputWidth, setIncreasedInputWidth] = useState(); //添加标签的最小宽
39
+ useEffect(() => {
57
40
  if (props.data) {
58
- var tArr = props.data;
41
+ let tArr = props.data;
59
42
  //Item[]
60
- var unObjType = tArr.some(function (v) {
61
- return ['string', 'number'].includes(_typeof(v));
62
- });
43
+ const unObjType = tArr.some(v => ['string', 'number'].includes(typeof v));
63
44
  if (unObjType) {
64
- tArr = tArr.map(function (_) {
65
- return {
66
- value: _,
67
- label: _
68
- };
69
- });
45
+ tArr = tArr.map(_ => ({
46
+ value: _,
47
+ label: _
48
+ }));
70
49
  }
71
- setInData(_toConsumableArray(tArr));
50
+ setInData([...tArr]);
72
51
  }
73
52
  }, [props.data]);
74
53
  //tag value
75
- var getTagGroupVal = function getTagGroupVal(data) {
76
- return data.map(function (_) {
77
- return _.value;
78
- });
54
+ const getTagGroupVal = data => {
55
+ return data.map(_ => _.value);
79
56
  };
80
57
  //show input
81
- var showInput = function showInput() {
58
+ const showInput = () => {
82
59
  setInputVisible(true);
83
- setTimeout(function () {
60
+ setTimeout(() => {
84
61
  var _a;
85
62
  (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
86
63
  });
87
64
  };
88
- var handleTagEdit = function handleTagEdit(value, idx) {
65
+ const handleTagEdit = (value, idx) => {
89
66
  inData[idx].value = value;
90
- setInData(_toConsumableArray(inData));
67
+ setInData([...inData]);
91
68
  onChange === null || onChange === void 0 ? void 0 : onChange(inData, getTagGroupVal(inData));
92
69
  };
93
70
  //input change
94
- var handleInputChange = function handleInputChange(e) {
71
+ const handleInputChange = e => {
95
72
  setInputValue(e.target.value);
96
73
  };
97
74
  //input confirm
98
- var handleInputConfirm = function handleInputConfirm() {
99
- var val = inputValue.trim();
75
+ const handleInputConfirm = () => {
76
+ const val = inputValue.trim();
100
77
  if (val !== '') {
101
78
  inData.push({
102
79
  value: val,
103
80
  label: val,
104
81
  closable: true
105
82
  });
106
- setInData(_toConsumableArray(inData));
83
+ setInData([...inData]);
107
84
  onChange === null || onChange === void 0 ? void 0 : onChange(inData, getTagGroupVal(inData));
108
85
  }
109
86
  setInputValue(defaultInputValue !== null && defaultInputValue !== void 0 ? defaultInputValue : '');
110
87
  setInputVisible(false);
111
88
  };
112
89
  //input enter
113
- var handleInputEnter = function handleInputEnter(e) {
90
+ const handleInputEnter = e => {
114
91
  if (e.keyCode === 13 || e.which === 13) {
115
92
  handleInputConfirm();
116
93
  }
117
94
  };
118
95
  //handle close
119
- var handleClose = function handleClose(item) {
120
- return function (e) {
121
- var idx = inData.findIndex(function (_) {
122
- return _.value === item.value;
123
- });
124
- if (idx > -1) {
125
- inData.splice(idx, 1);
126
- setInData(_toConsumableArray(inData));
127
- }
128
- if (item.onClose) item.onClose(e);
129
- onChange === null || onChange === void 0 ? void 0 : onChange(inData, getTagGroupVal(inData));
130
- };
96
+ const handleClose = item => e => {
97
+ const idx = inData.findIndex(_ => _.value === item.value);
98
+ if (idx > -1) {
99
+ inData.splice(idx, 1);
100
+ setInData([...inData]);
101
+ }
102
+ if (item.onClose) item.onClose(e);
103
+ onChange === null || onChange === void 0 ? void 0 : onChange(inData, getTagGroupVal(inData));
131
104
  };
132
105
  //渲染Tag组
133
- var renderTagGroup = function renderTagGroup() {
106
+ const renderTagGroup = () => {
134
107
  if (!(inData === null || inData === void 0 ? void 0 : inData.length)) return null;
135
- return inData.map(function (item, idx) {
108
+ return inData.map((item, idx) => {
136
109
  return jsx(Tag, Object.assign({}, item, {
137
110
  size: size,
138
111
  visible: true,
139
- tagChange: function tagChange(value) {
140
- return handleTagEdit(value, idx);
141
- },
112
+ tagChange: value => handleTagEdit(value, idx),
142
113
  onClose: handleClose(item)
143
114
  }, {
144
115
  children: item.label
@@ -146,10 +117,10 @@ var TagGroup = function TagGroup(props) {
146
117
  });
147
118
  };
148
119
  //动态增加tag
149
- var renderNewInput = function renderNewInput() {
120
+ const renderNewInput = () => {
150
121
  var _a;
151
122
  if (inputVisible) {
152
- var inputCls = clsx('tag-group-input', {
123
+ const inputCls = clsx('tag-group-input', {
153
124
  'tag-group-input-large': size === 'large'
154
125
  }, inputClassName);
155
126
  return jsx("input", {
@@ -166,19 +137,17 @@ var TagGroup = function TagGroup(props) {
166
137
  onKeyDown: handleInputEnter
167
138
  });
168
139
  }
169
- var icon = jsx(Plus, {});
170
- var text = 'New Tag';
140
+ let icon = jsx(Plus, {});
141
+ let text = 'New Tag';
171
142
  if (increasedTag) {
172
143
  icon = increasedTag.icon || jsx(Plus, {});
173
144
  text = (_a = increasedTag.text) !== null && _a !== void 0 ? _a : 'New Tag';
174
145
  }
175
- var newCls = clsx('tag-group-new', {
146
+ const newCls = clsx('tag-group-new', {
176
147
  'tag-group-new-icon': !text
177
148
  }, 'tag-group-add-btn');
178
149
  return jsx(Tag, Object.assign({
179
- getWidth: function getWidth(width) {
180
- return setIncreasedInputWidth(width);
181
- },
150
+ getWidth: width => setIncreasedInputWidth(width),
182
151
  className: newCls,
183
152
  size: size,
184
153
  icon: icon,
@@ -196,104 +165,88 @@ var TagGroup = function TagGroup(props) {
196
165
  };
197
166
 
198
167
  //预设颜色列表
199
- var PresetColors = ['blue', 'green', 'yellow', 'red'];
168
+ const PresetColors = ['blue', 'green', 'yellow', 'red'];
200
169
  //tag
201
- var InternalTag = function InternalTag(props) {
202
- var _clsx;
203
- var _props$type = props.type,
204
- type = _props$type === void 0 ? 'normal' : _props$type,
205
- className = props.className,
206
- children = props.children,
207
- icon = props.icon,
208
- color = props.color,
209
- onClose = props.onClose,
210
- onEdit = props.onEdit,
211
- getWidth = props.getWidth,
212
- tagChange = props.tagChange,
213
- editInputClassName = props.editInputClassName,
214
- closeIcon = props.closeIcon,
215
- _props$closable = props.closable,
216
- closable = _props$closable === void 0 ? false : _props$closable,
217
- _props$editable = props.editable,
218
- editable = _props$editable === void 0 ? false : _props$editable,
219
- _props$size = props.size,
220
- size = _props$size === void 0 ? 'larage' : _props$size,
221
- _props$maxWidth = props.maxWidth,
222
- maxWidth = _props$maxWidth === void 0 ? 300 : _props$maxWidth,
223
- style = props.style,
224
- visibleTag = props.visible,
225
- editInputWidth = props.editInputWidth,
226
- tipMaxWidth = props.tipMaxWidth,
170
+ const InternalTag = props => {
171
+ const {
172
+ type = 'normal',
173
+ className,
174
+ children,
175
+ icon,
176
+ color,
177
+ onClose,
178
+ onEdit,
179
+ getWidth,
180
+ tagChange,
181
+ editInputClassName,
182
+ closeIcon,
183
+ closable = false,
184
+ editable = false,
185
+ size = 'larage',
186
+ maxWidth,
187
+ style,
188
+ visible: visibleTag,
189
+ editInputWidth,
190
+ tipMaxWidth
191
+ } = props,
227
192
  restProps = __rest(props, ["type", "className", "children", "icon", "color", "onClose", "onEdit", "getWidth", "tagChange", "editInputClassName", "closeIcon", "closable", "editable", "size", "maxWidth", "style", "visible", "editInputWidth", "tipMaxWidth"]);
228
- var _useState = useState(true),
229
- _useState2 = _slicedToArray(_useState, 2),
230
- visible = _useState2[0],
231
- setVisible = _useState2[1]; //显示tag
232
- var _useState3 = useState(false),
233
- _useState4 = _slicedToArray(_useState3, 2),
234
- inputVisible = _useState4[0],
235
- setInputVisible = _useState4[1]; //显示输入框
236
- var _useState5 = useState(''),
237
- _useState6 = _slicedToArray(_useState5, 2),
238
- inputValue = _useState6[0],
239
- setInputValue = _useState6[1]; // 编辑输入框的值
240
- var _useState7 = useState(''),
241
- _useState8 = _slicedToArray(_useState7, 2),
242
- inputWidth = _useState8[0],
243
- setInputWidth = _useState8[1]; // 编辑输入框的值
244
- var _useState9 = useState(false),
245
- _useState10 = _slicedToArray(_useState9, 2),
246
- closeIconEnter = _useState10[0],
247
- setCloseIconEnter = _useState10[1]; // 鼠标是否进入closeIcon
248
- var _useState11 = useState(false),
249
- _useState12 = _slicedToArray(_useState11, 2),
250
- editIconEnter = _useState12[0],
251
- setEditIconEnter = _useState12[1]; // 鼠标是否进入closeIcon
252
- var inputRef = useRef(); //input ref
253
- var tagRef = useRef(); //tagRef ref
254
- useEffect(function () {
193
+ const [visible, setVisible] = useState(true); //显示tag
194
+ const [inputVisible, setInputVisible] = useState(false); //显示输入框
195
+ const [inputValue, setInputValue] = useState(''); // 编辑输入框的值
196
+ const [inputWidth, setInputWidth] = useState(''); // 编辑输入框的值
197
+ const [closeIconEnter, setCloseIconEnter] = useState(false); // 鼠标是否进入closeIcon
198
+ const [editIconEnter, setEditIconEnter] = useState(false); // 鼠标是否进入closeIcon
199
+ const inputRef = useRef(); //input ref
200
+ const tagRef = useRef(); //tagRef ref
201
+ useEffect(() => {
255
202
  if ('visible' in props) {
256
203
  setVisible(!!visibleTag);
257
204
  }
258
205
  }, [visibleTag]);
259
- useEffect(function () {
206
+ useEffect(() => {
260
207
  if (!tagRef.current) return;
261
- var offsetWidth = tagRef.current.offsetWidth;
208
+ const {
209
+ offsetWidth
210
+ } = tagRef.current;
262
211
  setInputWidth(offsetWidth);
263
212
  getWidth && getWidth(offsetWidth);
264
213
  }, [tagRef, inputVisible]);
265
- useEffect(function () {
214
+ useEffect(() => {
266
215
  if (typeof children === 'string') {
267
216
  setInputValue(children);
268
217
  }
269
218
  }, [children]);
270
219
  //是否预设颜色
271
- var isPresetColor = function isPresetColor() {
220
+ const isPresetColor = () => {
272
221
  if (!color) return false;
273
222
  return PresetColors.includes(color);
274
223
  };
275
224
  //tag style
276
- var tagStyle = Object.assign({
225
+ const tagStyle = Object.assign({
277
226
  color: color && !isPresetColor() ? color : undefined,
278
227
  backgroundColor: color && !isPresetColor() ? tinycolor(color).setAlpha(0.1).toRgbString() : undefined,
279
228
  borderColor: color && !isPresetColor() && type === 'outline' ? color : undefined,
280
- maxWidth: maxWidth
229
+ maxWidth
281
230
  }, style);
282
231
  //tag closeIcon style
283
- var closeIconStyle = {
232
+ const closeIconStyle = {
284
233
  backgroundColor: closeIconEnter ? tinycolor(color).setAlpha(0.1).toRgbString() : undefined,
285
234
  borderRadius: '2px'
286
235
  };
287
236
  //tag editIcon style
288
- var editIconStyle = {
237
+ const editIconStyle = {
289
238
  backgroundColor: editIconEnter ? tinycolor(color).setAlpha(0.1).toRgbString() : undefined,
290
239
  marginRight: children ? size === 'small' ? '2px' : '4px' : undefined,
291
240
  borderRadius: '2px'
292
241
  };
293
242
  //tag cls
294
- var tagClassName = clsx("".concat($prefixCls, "-tag"), "".concat($prefixCls, "-tag-").concat(type), "".concat($prefixCls, "-tag-").concat(size), className, (_clsx = {}, _defineProperty(_clsx, "".concat($prefixCls, "-tag-has-color"), color), _defineProperty(_clsx, "".concat($prefixCls, "-tag-hidden"), !visible), _defineProperty(_clsx, "".concat($prefixCls, "-tag-").concat(color), isPresetColor()), _clsx));
243
+ const tagClassName = clsx("".concat($prefixCls, "-tag"), "".concat($prefixCls, "-tag-").concat(type), "".concat($prefixCls, "-tag-").concat(size), className, {
244
+ ["".concat($prefixCls, "-tag-has-color")]: color,
245
+ ["".concat($prefixCls, "-tag-hidden")]: !visible,
246
+ ["".concat($prefixCls, "-tag-").concat(color)]: isPresetColor()
247
+ });
295
248
  //tag close click
296
- var handleCloseClick = function handleCloseClick(e) {
249
+ const handleCloseClick = e => {
297
250
  e.stopPropagation();
298
251
  onClose === null || onClose === void 0 ? void 0 : onClose(e);
299
252
  setCloseIconEnter(false);
@@ -304,19 +257,19 @@ var InternalTag = function InternalTag(props) {
304
257
  setVisible(false);
305
258
  }
306
259
  };
307
- var handleCloseEnter = function handleCloseEnter() {
260
+ const handleCloseEnter = () => {
308
261
  setCloseIconEnter(true);
309
262
  };
310
- var handleCloseLeave = function handleCloseLeave() {
263
+ const handleCloseLeave = () => {
311
264
  setCloseIconEnter(false);
312
265
  };
313
- var handleEditEnter = function handleEditEnter() {
266
+ const handleEditEnter = () => {
314
267
  setEditIconEnter(true);
315
268
  };
316
- var handleEditLeave = function handleEditLeave() {
269
+ const handleEditLeave = () => {
317
270
  setEditIconEnter(false);
318
271
  };
319
- var handleEditClick = function handleEditClick(e) {
272
+ const handleEditClick = e => {
320
273
  e.stopPropagation();
321
274
  onEdit && onEdit(e);
322
275
  if (e.defaultPrevented) {
@@ -327,7 +280,7 @@ var InternalTag = function InternalTag(props) {
327
280
  setInputVisible(true);
328
281
  };
329
282
  //渲染close icon
330
- var renderCloseIcon = function renderCloseIcon() {
283
+ const renderCloseIcon = () => {
331
284
  if (!closable) return null;
332
285
  return closeIcon ? jsx("span", Object.assign({
333
286
  className: 'tag-close-icon',
@@ -346,7 +299,7 @@ var InternalTag = function InternalTag(props) {
346
299
  });
347
300
  };
348
301
  // 渲染前缀icon
349
- var renderPrefixIcon = function renderPrefixIcon() {
302
+ const renderPrefixIcon = () => {
350
303
  return (editable || icon) && jsx("span", Object.assign({
351
304
  className: "tag-edit-icon ".concat(icon ? "tag-custom-icon" : ''),
352
305
  style: editIconStyle,
@@ -364,23 +317,23 @@ var InternalTag = function InternalTag(props) {
364
317
  }));
365
318
  };
366
319
  //input change
367
- var handleInputChange = function handleInputChange(e) {
320
+ const handleInputChange = e => {
368
321
  setInputValue(e.target.value);
369
322
  tagChange && tagChange(e.target.value);
370
323
  };
371
324
  //input confirm
372
- var handleInputConfirm = function handleInputConfirm() {
325
+ const handleInputConfirm = () => {
373
326
  setInputVisible(false);
374
327
  };
375
328
  //input enter
376
- var handleInputEnter = function handleInputEnter(e) {
329
+ const handleInputEnter = e => {
377
330
  if (e.keyCode === 13 || e.which === 13) {
378
331
  handleInputConfirm();
379
332
  }
380
333
  };
381
334
  //
382
- var renderNewInput = function renderNewInput() {
383
- var inputCls = clsx("".concat($prefixCls, "-tag-edit-input"), editInputClassName);
335
+ const renderNewInput = () => {
336
+ const inputCls = clsx("".concat($prefixCls, "-tag-edit-input"), editInputClassName);
384
337
  return jsx("input", {
385
338
  style: {
386
339
  width: editInputWidth || inputWidth,
@@ -414,6 +367,6 @@ var InternalTag = function InternalTag(props) {
414
367
  }))
415
368
  });
416
369
  };
417
- var Tag = InternalTag;
370
+ const Tag = InternalTag;
418
371
 
419
372
  export { Tag, TagGroup, Tag as default };