@arco-design/mobile-react 2.19.1-941e02b.7 → 2.20.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.
Files changed (130) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.en-US.md +6 -6
  3. package/README.md +6 -6
  4. package/cjs/_helpers/type.d.ts +1 -1
  5. package/cjs/avatar/group.js +1 -1
  6. package/cjs/avatar/index.js +10 -13
  7. package/cjs/avatar/style/css/index.css +96 -126
  8. package/cjs/avatar/style/index.less +54 -72
  9. package/cjs/badge/index.js +6 -8
  10. package/cjs/badge/style/css/index.css +5 -5
  11. package/cjs/badge/style/index.less +5 -5
  12. package/cjs/button/hooks.d.ts +1 -2
  13. package/cjs/button/hooks.js +5 -3
  14. package/cjs/button/index.d.ts +12 -0
  15. package/cjs/button/index.js +40 -33
  16. package/cjs/button/style/css/index.css +75 -310
  17. package/cjs/button/style/index.less +32 -38
  18. package/cjs/count-down/demo/style/mobile.less +1 -1
  19. package/cjs/dropdown/dropdown.d.ts +3 -0
  20. package/cjs/dropdown/dropdown.js +306 -0
  21. package/cjs/dropdown/index.d.ts +3 -4
  22. package/cjs/dropdown/index.js +3 -303
  23. package/cjs/dropdown/options.js +2 -1
  24. package/cjs/dropdown/type.d.ts +20 -9
  25. package/cjs/dropdown-menu/dropdown-menu.d.ts +4 -0
  26. package/cjs/dropdown-menu/dropdown-menu.js +273 -0
  27. package/cjs/dropdown-menu/helper.d.ts +1 -1
  28. package/cjs/dropdown-menu/index.d.ts +2 -3
  29. package/cjs/dropdown-menu/index.js +2 -245
  30. package/cjs/dropdown-menu/type.d.ts +21 -20
  31. package/cjs/image/index.js +4 -1
  32. package/cjs/image/style/css/index.css +2 -1
  33. package/cjs/image/style/index.less +2 -1
  34. package/cjs/image-picker/index.d.ts +11 -8
  35. package/cjs/image-picker/index.js +19 -12
  36. package/cjs/image-picker/style/index.less +1 -1
  37. package/cjs/nav-bar/index.js +7 -2
  38. package/cjs/notify/index.d.ts +1 -0
  39. package/cjs/notify/index.js +12 -0
  40. package/cjs/notify/type.d.ts +1 -0
  41. package/cjs/show-monitor/index.js +31 -3
  42. package/cjs/transition/index.js +4 -2
  43. package/dist/index.js +677 -617
  44. package/dist/index.min.js +4 -4
  45. package/dist/style.css +174 -438
  46. package/dist/style.min.css +1 -1
  47. package/esm/_helpers/type.d.ts +1 -1
  48. package/esm/avatar/group.js +1 -1
  49. package/esm/avatar/index.js +10 -13
  50. package/esm/avatar/style/css/index.css +96 -126
  51. package/esm/avatar/style/index.less +54 -72
  52. package/esm/badge/index.js +6 -8
  53. package/esm/badge/style/css/index.css +5 -5
  54. package/esm/badge/style/index.less +5 -5
  55. package/esm/button/hooks.d.ts +1 -2
  56. package/esm/button/hooks.js +5 -3
  57. package/esm/button/index.d.ts +12 -0
  58. package/esm/button/index.js +42 -35
  59. package/esm/button/style/css/index.css +75 -310
  60. package/esm/button/style/index.less +32 -38
  61. package/esm/count-down/demo/style/mobile.less +1 -1
  62. package/esm/dropdown/dropdown.d.ts +3 -0
  63. package/esm/dropdown/dropdown.js +288 -0
  64. package/esm/dropdown/index.d.ts +3 -4
  65. package/esm/dropdown/index.js +3 -293
  66. package/esm/dropdown/options.js +2 -1
  67. package/esm/dropdown/type.d.ts +20 -9
  68. package/esm/dropdown-menu/dropdown-menu.d.ts +4 -0
  69. package/esm/dropdown-menu/dropdown-menu.js +256 -0
  70. package/esm/dropdown-menu/helper.d.ts +1 -1
  71. package/esm/dropdown-menu/index.d.ts +2 -3
  72. package/esm/dropdown-menu/index.js +2 -237
  73. package/esm/dropdown-menu/type.d.ts +21 -20
  74. package/esm/image/index.js +4 -1
  75. package/esm/image/style/css/index.css +2 -1
  76. package/esm/image/style/index.less +2 -1
  77. package/esm/image-picker/index.d.ts +11 -8
  78. package/esm/image-picker/index.js +19 -12
  79. package/esm/image-picker/style/index.less +1 -1
  80. package/esm/nav-bar/index.js +6 -2
  81. package/esm/notify/index.d.ts +1 -0
  82. package/esm/notify/index.js +1 -0
  83. package/esm/notify/type.d.ts +1 -0
  84. package/esm/show-monitor/index.js +31 -3
  85. package/esm/transition/index.js +4 -2
  86. package/package.json +3 -3
  87. package/tokens/app/arcodesign/default/css-variables.less +2 -1
  88. package/tokens/app/arcodesign/default/index.d.ts +2 -1
  89. package/tokens/app/arcodesign/default/index.js +2 -1
  90. package/tokens/app/arcodesign/default/index.json +123 -47
  91. package/tokens/app/arcodesign/default/index.less +2 -1
  92. package/umd/_helpers/type.d.ts +1 -1
  93. package/umd/avatar/group.js +1 -1
  94. package/umd/avatar/index.js +10 -13
  95. package/umd/avatar/style/css/index.css +96 -126
  96. package/umd/avatar/style/index.less +54 -72
  97. package/umd/badge/index.js +6 -8
  98. package/umd/badge/style/css/index.css +5 -5
  99. package/umd/badge/style/index.less +5 -5
  100. package/umd/button/hooks.d.ts +1 -2
  101. package/umd/button/hooks.js +5 -3
  102. package/umd/button/index.d.ts +12 -0
  103. package/umd/button/index.js +40 -33
  104. package/umd/button/style/css/index.css +75 -310
  105. package/umd/button/style/index.less +32 -38
  106. package/umd/count-down/demo/style/mobile.less +1 -1
  107. package/umd/dropdown/dropdown.d.ts +3 -0
  108. package/umd/dropdown/dropdown.js +309 -0
  109. package/umd/dropdown/index.d.ts +3 -4
  110. package/umd/dropdown/index.js +5 -298
  111. package/umd/dropdown/options.js +2 -1
  112. package/umd/dropdown/type.d.ts +20 -9
  113. package/umd/dropdown-menu/dropdown-menu.d.ts +4 -0
  114. package/umd/dropdown-menu/dropdown-menu.js +278 -0
  115. package/umd/dropdown-menu/helper.d.ts +1 -1
  116. package/umd/dropdown-menu/index.d.ts +2 -3
  117. package/umd/dropdown-menu/index.js +5 -241
  118. package/umd/dropdown-menu/type.d.ts +21 -20
  119. package/umd/image/index.js +4 -1
  120. package/umd/image/style/css/index.css +2 -1
  121. package/umd/image/style/index.less +2 -1
  122. package/umd/image-picker/index.d.ts +11 -8
  123. package/umd/image-picker/index.js +19 -12
  124. package/umd/image-picker/style/index.less +1 -1
  125. package/umd/nav-bar/index.js +9 -6
  126. package/umd/notify/index.d.ts +1 -0
  127. package/umd/notify/index.js +13 -4
  128. package/umd/notify/type.d.ts +1 -0
  129. package/umd/show-monitor/index.js +31 -3
  130. package/umd/transition/index.js +4 -2
@@ -1,16 +1,16 @@
1
1
  (function (global, factory) {
2
2
  if (typeof define === "function" && define.amd) {
3
- define(["exports", "@babel/runtime/helpers/extends", "react", "@arco-design/mobile-utils", "react-transition-group", "../context-provider", "../_helpers", "../portal", "./options", "./type"], factory);
3
+ define(["exports", "@arco-design/mobile-utils", "./options", "./dropdown", "./type"], factory);
4
4
  } else if (typeof exports !== "undefined") {
5
- factory(exports, require("@babel/runtime/helpers/extends"), require("react"), require("@arco-design/mobile-utils"), require("react-transition-group"), require("../context-provider"), require("../_helpers"), require("../portal"), require("./options"), require("./type"));
5
+ factory(exports, require("@arco-design/mobile-utils"), require("./options"), require("./dropdown"), require("./type"));
6
6
  } else {
7
7
  var mod = {
8
8
  exports: {}
9
9
  };
10
- factory(mod.exports, global._extends, global.react, global.mobileUtils, global.reactTransitionGroup, global.contextProvider, global._helpers, global.portal, global.options, global.type);
10
+ factory(mod.exports, global.mobileUtils, global.options, global.dropdown, global.type);
11
11
  global.index = mod.exports;
12
12
  }
13
- })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _extends2, _react, _mobileUtils, _reactTransitionGroup, _contextProvider, _helpers, _portal, _options, _type) {
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _mobileUtils, _options, _dropdown, _type) {
14
14
  "use strict";
15
15
 
16
16
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -18,9 +18,6 @@
18
18
  _exports.__esModule = true;
19
19
  var _exportNames = {};
20
20
  _exports.default = void 0;
21
- _extends2 = _interopRequireDefault(_extends2);
22
- _react = _interopRequireWildcard(_react);
23
- _portal = _interopRequireDefault(_portal);
24
21
  _options = _interopRequireDefault(_options);
25
22
  Object.keys(_type).forEach(function (key) {
26
23
  if (key === "default" || key === "__esModule") return;
@@ -28,297 +25,7 @@
28
25
  if (key in _exports && _exports[key] === _type[key]) return;
29
26
  _exports[key] = _type[key];
30
27
  });
31
-
32
- 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); }
33
-
34
- 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; }
35
-
36
- var Dropdown = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
37
- var optionsWrapper = (0, _react.useRef)(null);
38
- var domRef = (0, _react.useRef)(null);
39
- var _props$className = props.className,
40
- className = _props$className === void 0 ? '' : _props$className,
41
- _props$style = props.style,
42
- style = _props$style === void 0 ? {} : _props$style,
43
- _props$options = props.options,
44
- options = _props$options === void 0 ? [] : _props$options,
45
- _props$showDropdown = props.showDropdown,
46
- showDropdown = _props$showDropdown === void 0 ? false : _props$showDropdown,
47
- _props$showMask = props.showMask,
48
- showMask = _props$showMask === void 0 ? true : _props$showMask,
49
- _props$direction = props.direction,
50
- direction = _props$direction === void 0 ? 'down' : _props$direction,
51
- height = props.height,
52
- _props$maxHeight = props.maxHeight,
53
- maxHeight = _props$maxHeight === void 0 ? 500 : _props$maxHeight,
54
- _props$touchToClose = props.touchToClose,
55
- touchToClose = _props$touchToClose === void 0 ? true : _props$touchToClose,
56
- useColumn = props.useColumn,
57
- multiple = props.multiple,
58
- defaultSelectedValue = props.defaultSelectedValue,
59
- onCancel = props.onCancel,
60
- getAnchorElement = props.getAnchorElement,
61
- isStopTouchEl = props.isStopTouchEl,
62
- getStopTouchElements = props.getStopTouchElements,
63
- _props$getScrollConta = props.getScrollContainer,
64
- getScrollContainer = _props$getScrollConta === void 0 ? function () {
65
- return optionsWrapper.current;
66
- } : _props$getScrollConta,
67
- getPortalContainer = props.getPortalContainer,
68
- _props$clickOtherToCl = props.clickOtherToClose,
69
- clickOtherToClose = _props$clickOtherToCl === void 0 ? true : _props$clickOtherToCl,
70
- _props$dropdownAnimat = props.dropdownAnimationTimeout,
71
- dropdownAnimationTimeout = _props$dropdownAnimat === void 0 ? 300 : _props$dropdownAnimat,
72
- _props$dropdownAnimat2 = props.dropdownAnimationFunction,
73
- dropdownAnimationFunction = _props$dropdownAnimat2 === void 0 ? 'cubic-bezier(0.32, 0.96, 0.6, 1)' : _props$dropdownAnimat2,
74
- _props$maskAnimationT = props.maskAnimationTimeout,
75
- maskAnimationTimeout = _props$maskAnimationT === void 0 ? 500 : _props$maskAnimationT,
76
- _props$maskAnimationF = props.maskAnimationFunction,
77
- maskAnimationFunction = _props$maskAnimationF === void 0 ? 'cubic-bezier(0.32, 0.96, 0.6, 1)' : _props$maskAnimationF,
78
- _props$mountOnEnter = props.mountOnEnter,
79
- mountOnEnter = _props$mountOnEnter === void 0 ? true : _props$mountOnEnter,
80
- _props$unmountOnExit = props.unmountOnExit,
81
- unmountOnExit = _props$unmountOnExit === void 0 ? true : _props$unmountOnExit,
82
- _props$preventBodyScr = props.preventBodyScroll,
83
- preventBodyScroll = _props$preventBodyScr === void 0 ? true : _props$preventBodyScr,
84
- initialBodyOverflow = props.initialBodyOverflow;
85
- var system = (0, _helpers.useSystem)();
86
-
87
- var _useWindowSize = (0, _helpers.useWindowSize)(),
88
- windowHeight = _useWindowSize.windowHeight,
89
- windowWidth = _useWindowSize.windowWidth;
90
-
91
- var _useState = (0, _react.useState)({
92
- top: '',
93
- bottom: ''
94
- }),
95
- positionStyle = _useState[0],
96
- setPositionStyle = _useState[1];
97
-
98
- var _useState2 = (0, _react.useState)(function () {
99
- var defaultValue = multiple ? [] : 0;
100
- return defaultSelectedValue !== void 0 ? defaultSelectedValue : defaultValue;
101
- }),
102
- innerValue = _useState2[0],
103
- setInnerValue = _useState2[1]; // down=0为向上展开,1为向下展开
104
- // @en down=0 is to expand upwards, 1 is to expand downwards
105
-
106
-
107
- var _useState3 = (0, _react.useState)(direction === 'down'),
108
- down = _useState3[0],
109
- setDown = _useState3[1];
110
-
111
- var maskHeight = (0, _react.useRef)(0);
112
- var optionsContainer = (0, _react.useRef)(null);
113
- var dropdownContainer = (0, _react.useRef)(null);
114
-
115
- var _useState4 = (0, _react.useState)(0),
116
- optionsWrapperHeight = _useState4[0],
117
- setOptionsWrapperHeight = _useState4[1];
118
- /**
119
- * 判断是否阻止touch事件
120
- * @en Determine whether to block touch events
121
- * */
122
-
123
-
124
- var ifStopTouch = function ifStopTouch(el) {
125
- var _dropdownContainer$cu;
126
-
127
- if (isStopTouchEl) return isStopTouchEl(el);
128
- var tempEl = el;
129
- var elements = getStopTouchElements ? getStopTouchElements() : [(_dropdownContainer$cu = dropdownContainer.current) == null ? void 0 : _dropdownContainer$cu.parentElement];
130
-
131
- for (var i = 0; i < elements.length; i++) {
132
- while (tempEl && elements[i]) {
133
- if (tempEl === elements[i]) {
134
- return true;
135
- }
136
-
137
- tempEl = tempEl.parentElement;
138
- }
139
- }
140
-
141
- return false;
142
- };
143
-
144
- (0, _helpers.usePopupScroll)(showDropdown, domRef.current, getScrollContainer);
145
- (0, _helpers.usePreventBodyScroll)(showDropdown, preventBodyScroll, initialBodyOverflow);
146
- (0, _react.useEffect)(function () {
147
- var _dropdownContainer$cu2;
148
-
149
- // 为0的时候不改变
150
- // @en Does not change when it is 0
151
- if (optionsWrapperHeight === 0) return;
152
- var tempEl = getAnchorElement ? getAnchorElement() : (_dropdownContainer$cu2 = dropdownContainer.current) == null ? void 0 : _dropdownContainer$cu2.parentElement;
153
-
154
- var _ref = (tempEl == null ? void 0 : tempEl.getBoundingClientRect()) || {
155
- bottom: 0,
156
- top: 0
157
- },
158
- bottom = _ref.bottom,
159
- top = _ref.top;
160
-
161
- var tempTop = props.top || bottom;
162
- var tempBottom = props.bottom || windowHeight - top;
163
- var tempMaskHeight = windowHeight - tempTop; // 没有指定方向,且空间足够时,或向上展开的空间不够,向下展开
164
- // @en If there is no specified direction and there is enough space, or there is not enough space to expand upward, expand downward
165
-
166
- var tempDown = direction !== 'up' && optionsWrapperHeight < tempMaskHeight || optionsWrapperHeight > tempTop;
167
-
168
- if (tempDown) {
169
- maskHeight.current = tempMaskHeight;
170
- setPositionStyle({
171
- top: tempTop + "px",
172
- bottom: ''
173
- });
174
- } else {
175
- maskHeight.current = windowHeight - tempBottom;
176
- setPositionStyle({
177
- top: '',
178
- bottom: tempBottom + "px"
179
- });
180
- }
181
-
182
- setDown(tempDown);
183
- }, [dropdownContainer, optionsWrapperHeight, props.top, props.bottom, Boolean(getAnchorElement), direction, windowHeight]);
184
- /**
185
- * 取消选择
186
- * @en Cancel selection
187
- * */
188
-
189
- var handleCancel = (0, _react.useCallback)(function (e) {
190
- var optionsWrapperDom = optionsWrapper.current;
191
-
192
- if (!e || !optionsWrapperDom) {
193
- return;
194
- }
195
-
196
- var target = e.target;
197
-
198
- if (!optionsWrapperDom.contains(target) && !ifStopTouch(target)) {
199
- onCancel();
200
- }
201
-
202
- e.stopPropagation();
203
- }, [ifStopTouch, onCancel]);
204
- /**
205
- * 当面板放下时,给body添加事件监听,面板收起时,移除
206
- * @en When the panel is down, add an event listener to the body, and when the panel is retracted, remove it
207
- * */
208
-
209
- (0, _react.useEffect)(function () {
210
- var needBind = showDropdown && clickOtherToClose;
211
- var event = touchToClose ? 'touchstart' : 'click';
212
-
213
- if (needBind) {
214
- document.addEventListener(event, handleCancel);
215
- }
216
-
217
- return function () {
218
- if (needBind) {
219
- document.removeEventListener(event, handleCancel);
220
- }
221
- };
222
- }, [showDropdown, clickOtherToClose, handleCancel]);
223
- (0, _react.useEffect)(function () {
224
- (0, _mobileUtils.nextTick)(function () {
225
- if (height !== void 0) {
226
- // 受控模式下,完全交由外层控制
227
- // @en In controlled mode, it is completely controlled by the outer layer
228
- setOptionsWrapperHeight(height);
229
- } else {
230
- if (!optionsContainer.current) return;
231
- if (!showDropdown) setOptionsWrapperHeight(0);else {
232
- setOptionsWrapperHeight(optionsContainer.current.getBoundingClientRect().height);
233
- }
234
- }
235
- });
236
- }, [showDropdown, options.length, height]);
237
- (0, _react.useImperativeHandle)(ref, function () {
238
- return {
239
- dom: domRef.current
240
- };
241
- });
242
-
243
- function getOptionsStyle() {
244
- var trans = down ? 'translateY(-100%)' : 'translateY(100%)';
245
- return (0, _helpers.getStyleWithVendor)({
246
- // height: `${optionsWrapperHeight}px`,
247
- transform: optionsWrapperHeight ? '' : trans,
248
- transition: "transform " + dropdownAnimationTimeout + "ms " + dropdownAnimationFunction,
249
- overflow: optionsWrapperHeight > maxHeight || height ? 'auto' : 'hidden',
250
- maxHeight: maxHeight + "px"
251
- });
252
- }
253
-
254
- function renderInnerOptions() {
255
- var optionProps = {
256
- options: options,
257
- useColumn: useColumn
258
- };
259
- var value = props.selectedValue !== void 0 ? props.selectedValue : innerValue;
260
- return props.multiple === true ? /*#__PURE__*/_react.default.createElement(_options.default, (0, _extends2.default)({}, optionProps, {
261
- multiple: true,
262
- selectedValue: value,
263
- onOptionClick: props.onOptionClick,
264
- onOptionChange: function onOptionChange(vals, op) {
265
- setInnerValue(vals);
266
- props.onOptionChange == null ? void 0 : props.onOptionChange(vals, op);
267
- }
268
- })) : /*#__PURE__*/_react.default.createElement(_options.default, (0, _extends2.default)({}, optionProps, {
269
- multiple: props.multiple,
270
- selectedValue: value,
271
- onOptionClick: props.onOptionClick,
272
- onOptionChange: function onOptionChange(vals, op) {
273
- setInnerValue(vals);
274
- props.onOptionChange == null ? void 0 : props.onOptionChange(vals, op);
275
- }
276
- }));
277
- }
278
-
279
- return /*#__PURE__*/_react.default.createElement(_contextProvider.ContextLayout, null, function (_ref2) {
280
- var prefixCls = _ref2.prefixCls;
281
- return /*#__PURE__*/_react.default.createElement("div", {
282
- ref: dropdownContainer
283
- }, /*#__PURE__*/_react.default.createElement(_portal.default, {
284
- getContainer: getPortalContainer
285
- }, /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.CSSTransition, {
286
- in: showDropdown,
287
- timeout: Math.max(dropdownAnimationTimeout, maskAnimationTimeout),
288
- onEnter: function onEnter(el) {
289
- el.style.visibility = 'visible';
290
- },
291
- onExited: function onExited(el) {
292
- el.style.visibility = 'hidden';
293
- },
294
- mountOnEnter: mountOnEnter,
295
- unmountOnExit: unmountOnExit
296
- }, /*#__PURE__*/_react.default.createElement("div", {
297
- className: (0, _mobileUtils.cls)(prefixCls + "-dropdown all-border-box", system, className, {
298
- 'drop-up': !down
299
- }),
300
- ref: domRef,
301
- style: (0, _extends2.default)({
302
- height: maskHeight.current + "px",
303
- maxWidth: windowWidth + "px"
304
- }, style, positionStyle)
305
- }, /*#__PURE__*/_react.default.createElement("div", {
306
- className: (0, _mobileUtils.cls)(prefixCls + "-dropdown-options"),
307
- ref: optionsWrapper,
308
- style: getOptionsStyle()
309
- }, /*#__PURE__*/_react.default.createElement("div", {
310
- className: (0, _mobileUtils.cls)(prefixCls + "-dropdown-options-container"),
311
- ref: optionsContainer
312
- }, props.children || renderInnerOptions(), props.extraNode)), showMask && /*#__PURE__*/_react.default.createElement("div", {
313
- className: (0, _mobileUtils.cls)(prefixCls + "-dropdown-mask", {
314
- 'is-show': optionsWrapperHeight
315
- }),
316
- style: {
317
- transition: "opacity " + maskAnimationTimeout + "ms " + maskAnimationFunction
318
- }
319
- })))));
320
- });
321
- });
28
+ var Dropdown = (0, _dropdown.componentGenerator)(_options.default);
322
29
  /**
323
30
  * 下拉面板,展示供选择的选择项
324
31
  * @en Dropdown panel, showing options to choose from
@@ -27,6 +27,7 @@
27
27
  var Options = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
28
28
  var options = props.options,
29
29
  useColumn = props.useColumn,
30
+ icon = props.icon,
30
31
  selectedValue = props.selectedValue,
31
32
  defaultSelectedValue = props.defaultSelectedValue,
32
33
  multiple = props.multiple;
@@ -105,7 +106,7 @@
105
106
  return handleOptionChange(e, op);
106
107
  },
107
108
  style: minWidthStyle
108
- }, op.label, /*#__PURE__*/_react.default.createElement(_IconCheck.default, {
109
+ }, op.label, icon !== void 0 ? icon : /*#__PURE__*/_react.default.createElement(_IconCheck.default, {
109
110
  className: prefixCls + "-dropdown-options-item-icon"
110
111
  }));
111
112
  }), fakeOpts.map(function (_, i) {
@@ -1,4 +1,5 @@
1
1
  import { CSSProperties, ReactNode } from 'react';
2
+ export declare type OptionValueType = number | string;
2
3
  export interface OptionsItem {
3
4
  /**
4
5
  * 选项名称
@@ -9,7 +10,7 @@ export interface OptionsItem {
9
10
  * 选项标识
10
11
  * @en option value
11
12
  * */
12
- value: number;
13
+ value: OptionValueType;
13
14
  /**
14
15
  * 选项是否可用,默认false表示可用
15
16
  * @en Whether the option is available, the default false means available
@@ -111,6 +112,11 @@ export interface DropdownCommonProps {
111
112
  * @default false
112
113
  */
113
114
  useColumn?: boolean | number;
115
+ /**
116
+ * 选项附带图标
117
+ * @en Icon in each option
118
+ */
119
+ optionIcon?: ReactNode;
114
120
  /**
115
121
  * 是否在打开下拉框时再加载内容
116
122
  * @en Whether to reload the content when the dropdown box is opened
@@ -177,29 +183,29 @@ export interface SingleOptionProps {
177
183
  * 默认选中值
178
184
  * @en Default checked value
179
185
  * */
180
- defaultSelectedValue?: number;
186
+ defaultSelectedValue?: OptionValueType;
181
187
  /**
182
188
  * 当前选择的选项标识
183
189
  * @en The currently selected option value
184
190
  * */
185
- selectedValue?: number;
191
+ selectedValue?: OptionValueType;
186
192
  /**
187
193
  * 点击选项时触发的回调函数
188
194
  * @en Callback when clicking option
189
195
  * */
190
- onOptionClick?: (val: number, op: OptionsItem) => void;
196
+ onOptionClick?: (val: OptionValueType, op: OptionsItem) => void;
191
197
  /**
192
198
  * 当选项改变时触发的回调函数
193
199
  * @en Callback when the option changes
194
200
  * */
195
- onOptionChange?: (val: number, op: OptionsItem) => void;
201
+ onOptionChange?: (val: OptionValueType, op: OptionsItem) => void;
196
202
  }
197
203
  export interface MultipleOptionProps {
198
204
  multiple: true;
199
- defaultSelectedValue?: number[];
200
- selectedValue?: number[];
201
- onOptionClick?: (selected: boolean, val: number, op: OptionsItem) => void;
202
- onOptionChange?: (vals: number[], op: OptionsItem) => void;
205
+ defaultSelectedValue?: OptionValueType[];
206
+ selectedValue?: OptionValueType[];
207
+ onOptionClick?: (selected: boolean, val: OptionValueType, op: OptionsItem) => void;
208
+ onOptionChange?: (vals: OptionValueType[], op: OptionsItem) => void;
203
209
  }
204
210
  export declare type OptionProps = SingleOptionProps | MultipleOptionProps;
205
211
  export interface DropdownBasicProps extends DropdownCommonProps {
@@ -247,6 +253,11 @@ export interface DropdownOptionsBasicProps {
247
253
  * @default false
248
254
  */
249
255
  useColumn?: DropdownCommonProps['useColumn'];
256
+ /**
257
+ * 选项列表右侧图标
258
+ * @en Icon on the right side of the options list
259
+ */
260
+ icon?: ReactNode;
250
261
  }
251
262
  export declare type DropdownOptionsProps = DropdownOptionsBasicProps & OptionProps;
252
263
  export interface DropdownOptionsRef {
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { DropdownMenuRef } from './type';
3
+ import { DropdownProps, DropdownRef } from '../dropdown';
4
+ export declare function componentGenerator<P extends DropdownProps = DropdownProps, R extends DropdownRef = DropdownRef>(Comp: React.ForwardRefExoticComponent<P & React.RefAttributes<R>>): React.ForwardRefExoticComponent<(import("./type").DropdownMenuBasicProps & import("./type").SingleOptionProps & React.RefAttributes<DropdownMenuRef>) | (import("./type").DropdownMenuBasicProps & import("./type").MultipleOptionProps & React.RefAttributes<DropdownMenuRef>)>;