rsuite 5.23.0 → 5.23.2
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 +16 -0
- package/FormHelpText/styles/index.less +2 -2
- package/Tooltip/styles/index.less +0 -1
- package/cjs/AutoComplete/AutoComplete.js +9 -2
- package/cjs/Menu/Menu.js +1 -0
- package/cjs/MultiCascader/utils.js +3 -3
- package/cjs/Nav/NavDropdownMenu.d.ts +2 -0
- package/cjs/Nav/NavDropdownMenu.js +4 -2
- package/cjs/Picker/utils.js +81 -5
- package/dist/rsuite-rtl.css +2 -3
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +2 -3
- package/dist/rsuite.js +5 -5
- package/dist/rsuite.min.css +1 -1
- package/dist/rsuite.min.css.map +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/AutoComplete/AutoComplete.js +9 -3
- package/esm/Menu/Menu.js +1 -0
- package/esm/MultiCascader/utils.js +3 -3
- package/esm/Nav/NavDropdownMenu.d.ts +2 -0
- package/esm/Nav/NavDropdownMenu.js +4 -2
- package/esm/Picker/utils.js +80 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## [5.23.2](https://github.com/rsuite/rsuite/compare/v5.23.1...v5.23.2) (2022-12-09)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- **Form.HelpText:** change font size to 12px ([#2968](https://github.com/rsuite/rsuite/issues/2968)) ([5c3898e](https://github.com/rsuite/rsuite/commit/5c3898ed2726beb81c09accd4d91963849d0dd31))
|
|
6
|
+
- **Nav.Menu:** fix noCaret has No Effect on a Sub-menu ([#2960](https://github.com/rsuite/rsuite/issues/2960)) ([e51fb6b](https://github.com/rsuite/rsuite/commit/e51fb6b593f0221f2ac3288b55658d540db214f9))
|
|
7
|
+
- **pickers:** the focused item should be within the container's viewport ([#2957](https://github.com/rsuite/rsuite/issues/2957)) ([cab5c63](https://github.com/rsuite/rsuite/commit/cab5c63ffde3963c72363adf00531ef3ab9d9e83))
|
|
8
|
+
- **Tooltip:** should use the default text alignment ([#2965](https://github.com/rsuite/rsuite/issues/2965)) ([3280775](https://github.com/rsuite/rsuite/commit/3280775a699a3683b2c45b543fbd8e6576206142))
|
|
9
|
+
|
|
10
|
+
## [5.23.1](https://github.com/rsuite/rsuite/compare/v5.23.0...v5.23.1) (2022-12-02)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **AutoComplete:** fix animation props being passed on Input ([#2950](https://github.com/rsuite/rsuite/issues/2950)) ([4c21993](https://github.com/rsuite/rsuite/commit/4c21993531ef775e9b505d8d1d1fafce04e1b49b))
|
|
15
|
+
- **MultiCascader:** fix unable to search for child items when `childKey` is set a value other than "children" ([#2926](https://github.com/rsuite/rsuite/issues/2926)) ([5d35f6c](https://github.com/rsuite/rsuite/commit/5d35f6c1639a49174274ccabf2edd3b40a388c32))
|
|
16
|
+
|
|
1
17
|
# [5.23.0](https://github.com/rsuite/rsuite/compare/v5.22.2...v5.23.0) (2022-11-25)
|
|
2
18
|
|
|
3
19
|
### Bug Fixes
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
color: var(--rs-text-secondary); // lighten the text some for contrast
|
|
11
11
|
//Sometimes help info is more than one line,so height can't set a fixed value
|
|
12
12
|
min-height: @line-height-computed;
|
|
13
|
-
line-height: @line-height-
|
|
14
|
-
font-size: @font-size-
|
|
13
|
+
line-height: @line-height-small;
|
|
14
|
+
font-size: @font-size-small;
|
|
15
15
|
|
|
16
16
|
&-tooltip {
|
|
17
17
|
display: inline-flex;
|
|
@@ -17,6 +17,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
17
17
|
|
|
18
18
|
var _pick = _interopRequireDefault(require("lodash/pick"));
|
|
19
19
|
|
|
20
|
+
var _omit = _interopRequireDefault(require("lodash/omit"));
|
|
21
|
+
|
|
20
22
|
var _Input = _interopRequireDefault(require("../Input"));
|
|
21
23
|
|
|
22
24
|
var _utils = require("../utils");
|
|
@@ -174,6 +176,11 @@ var AutoComplete = /*#__PURE__*/_react.default.forwardRef(function (props, ref)
|
|
|
174
176
|
disabled: disabled
|
|
175
177
|
}));
|
|
176
178
|
var triggerRef = (0, _react.useRef)(null);
|
|
179
|
+
|
|
180
|
+
var _partitionHTMLProps = (0, _utils.partitionHTMLProps)((0, _omit.default)(rest, _Picker.pickTriggerPropKeys)),
|
|
181
|
+
htmlInputProps = _partitionHTMLProps[0],
|
|
182
|
+
restProps = _partitionHTMLProps[1];
|
|
183
|
+
|
|
177
184
|
(0, _Picker.usePublicMethods)(ref, {
|
|
178
185
|
triggerRef: triggerRef,
|
|
179
186
|
overlayRef: overlayRef
|
|
@@ -217,10 +224,10 @@ var AutoComplete = /*#__PURE__*/_react.default.forwardRef(function (props, ref)
|
|
|
217
224
|
trigger: ['click', 'focus'],
|
|
218
225
|
open: open || focus && hasItems,
|
|
219
226
|
speaker: renderDropdownMenu
|
|
220
|
-
}, /*#__PURE__*/_react.default.createElement(Component, {
|
|
227
|
+
}, /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({
|
|
221
228
|
className: classes,
|
|
222
229
|
style: style
|
|
223
|
-
}, /*#__PURE__*/_react.default.createElement(_Input.default, (0, _extends2.default)({},
|
|
230
|
+
}, restProps), /*#__PURE__*/_react.default.createElement(_Input.default, (0, _extends2.default)({}, htmlInputProps, {
|
|
224
231
|
id: id,
|
|
225
232
|
disabled: disabled,
|
|
226
233
|
value: value,
|
package/cjs/Menu/Menu.js
CHANGED
|
@@ -381,6 +381,7 @@ function Menu(_ref) {
|
|
|
381
381
|
}, [disabled, closeMenu]);
|
|
382
382
|
var rootElementRef = (0, _react.useRef)(null);
|
|
383
383
|
var handleContainerBlur = (0, _react.useCallback)(function (event) {
|
|
384
|
+
/* istanbul ignore else */
|
|
384
385
|
if ((0, _events.isFocusLeaving)(event)) {
|
|
385
386
|
closeMenu(event, false);
|
|
386
387
|
}
|
|
@@ -192,7 +192,7 @@ exports.removeAllChildrenValue = removeAllChildrenValue;
|
|
|
192
192
|
function useFlattenData(data, itemKeys) {
|
|
193
193
|
var childrenKey = itemKeys.childrenKey;
|
|
194
194
|
|
|
195
|
-
var _useState = (0, _react.useState)((0, _treeUtils.flattenTree)(data)),
|
|
195
|
+
var _useState = (0, _react.useState)((0, _treeUtils.flattenTree)(data, itemKeys.childrenKey)),
|
|
196
196
|
flattenData = _useState[0],
|
|
197
197
|
setFlattenData = _useState[1];
|
|
198
198
|
|
|
@@ -204,8 +204,8 @@ function useFlattenData(data, itemKeys) {
|
|
|
204
204
|
setFlattenData([].concat(flattenData, nodes));
|
|
205
205
|
}, [childrenKey, flattenData]);
|
|
206
206
|
(0, _react.useEffect)(function () {
|
|
207
|
-
setFlattenData((0, _treeUtils.flattenTree)(data));
|
|
208
|
-
}, [data]);
|
|
207
|
+
setFlattenData((0, _treeUtils.flattenTree)(data, itemKeys.childrenKey));
|
|
208
|
+
}, [data, itemKeys.childrenKey]);
|
|
209
209
|
return {
|
|
210
210
|
addFlattenData: addFlattenData,
|
|
211
211
|
flattenData: flattenData
|
|
@@ -17,6 +17,8 @@ export interface NavDropdownMenuProps<T = any> extends StandardProps {
|
|
|
17
17
|
* @default 'end'
|
|
18
18
|
*/
|
|
19
19
|
openDirection?: 'start' | 'end';
|
|
20
|
+
/** No caret variation */
|
|
21
|
+
noCaret?: boolean;
|
|
20
22
|
/**
|
|
21
23
|
* Only used for setting the default expand state when it's a submenu.
|
|
22
24
|
*/
|
|
@@ -55,7 +55,8 @@ var NavDropdownMenu = /*#__PURE__*/_react.default.forwardRef(function (props, re
|
|
|
55
55
|
children = props.children,
|
|
56
56
|
_props$openDirection = props.openDirection,
|
|
57
57
|
openDirection = _props$openDirection === void 0 ? 'end' : _props$openDirection,
|
|
58
|
-
|
|
58
|
+
noCaret = props.noCaret,
|
|
59
|
+
rest = (0, _objectWithoutPropertiesLoose2.default)(props, ["onToggle", "eventKey", "title", "classPrefix", "children", "openDirection", "noCaret"]);
|
|
59
60
|
|
|
60
61
|
var _useCustom = (0, _useCustom2.default)('DropdownMenu'),
|
|
61
62
|
rtl = _useCustom.rtl;
|
|
@@ -110,7 +111,7 @@ var NavDropdownMenu = /*#__PURE__*/_react.default.forwardRef(function (props, re
|
|
|
110
111
|
"data-event-key-type": typeof eventKey
|
|
111
112
|
}, menuitem, (0, _omit2.default)(menuButtonProps, ['role'])), icon && /*#__PURE__*/_react.default.cloneElement(icon, {
|
|
112
113
|
className: prefix('menu-icon')
|
|
113
|
-
}), title, /*#__PURE__*/_react.default.createElement(Icon, {
|
|
114
|
+
}), title, !noCaret && /*#__PURE__*/_react.default.createElement(Icon, {
|
|
114
115
|
className: prefix(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteralLoose2.default)(["toggle-icon"])))
|
|
115
116
|
}));
|
|
116
117
|
});
|
|
@@ -151,6 +152,7 @@ NavDropdownMenu.propTypes = {
|
|
|
151
152
|
classPrefix: _propTypes.default.string,
|
|
152
153
|
pullLeft: (0, _deprecatePropType.default)(_propTypes.default.bool, 'Use openDirection="start" instead.'),
|
|
153
154
|
openDirection: _propTypes.default.oneOf(['start', 'end']),
|
|
155
|
+
noCaret: _propTypes.default.bool,
|
|
154
156
|
title: _propTypes.default.node,
|
|
155
157
|
open: _propTypes.default.bool,
|
|
156
158
|
eventKey: _propTypes.default.any,
|
package/cjs/Picker/utils.js
CHANGED
|
@@ -33,6 +33,8 @@ var _treeUtils = require("../utils/treeUtils");
|
|
|
33
33
|
|
|
34
34
|
var _utils = require("../utils");
|
|
35
35
|
|
|
36
|
+
var _domLib = require("dom-lib");
|
|
37
|
+
|
|
36
38
|
var defaultNodeKeys = {
|
|
37
39
|
valueKey: 'value',
|
|
38
40
|
childrenKey: 'children'
|
|
@@ -162,11 +164,51 @@ function onMenuKeyDown(event, events) {
|
|
|
162
164
|
}
|
|
163
165
|
}
|
|
164
166
|
|
|
167
|
+
/**
|
|
168
|
+
* Checks if the element has a vertical scrollbar.
|
|
169
|
+
*/
|
|
170
|
+
function hasVerticalScroll(element) {
|
|
171
|
+
var scrollHeight = element.scrollHeight,
|
|
172
|
+
clientHeight = element.clientHeight;
|
|
173
|
+
return scrollHeight > clientHeight;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Checks if the element is within the visible area of the container
|
|
177
|
+
*/
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
function isVisible(element, container, direction) {
|
|
181
|
+
if (!hasVerticalScroll(container)) {
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
var _element$getBoundingC = element.getBoundingClientRect(),
|
|
186
|
+
top = _element$getBoundingC.top,
|
|
187
|
+
bottom = _element$getBoundingC.bottom,
|
|
188
|
+
height = _element$getBoundingC.height;
|
|
189
|
+
|
|
190
|
+
var _container$getBoundin = container.getBoundingClientRect(),
|
|
191
|
+
containerTop = _container$getBoundin.top,
|
|
192
|
+
containerBottom = _container$getBoundin.bottom;
|
|
193
|
+
|
|
194
|
+
if (direction === 'top') {
|
|
195
|
+
return top + height > containerTop;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return bottom - height < containerBottom;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function scrollTo(container, direction, step) {
|
|
202
|
+
var scrollTop = container.scrollTop;
|
|
203
|
+
container.scrollTop = direction === 'top' ? scrollTop - step : scrollTop + step;
|
|
204
|
+
}
|
|
165
205
|
/**
|
|
166
206
|
* A hook that manages the focus state of the option.
|
|
167
207
|
* @param defaultFocusItemValue
|
|
168
208
|
* @param props
|
|
169
209
|
*/
|
|
210
|
+
|
|
211
|
+
|
|
170
212
|
var useFocusItemValue = function useFocusItemValue(defaultFocusItemValue, props) {
|
|
171
213
|
var _props$valueKey = props.valueKey,
|
|
172
214
|
valueKey = _props$valueKey === void 0 ? 'value' : _props$valueKey,
|
|
@@ -190,11 +232,23 @@ var useFocusItemValue = function useFocusItemValue(defaultFocusItemValue, props)
|
|
|
190
232
|
var _useState3 = (0, _react.useState)([]),
|
|
191
233
|
keys = _useState3[0],
|
|
192
234
|
setKeys = _useState3[1];
|
|
235
|
+
|
|
236
|
+
var getScrollContainer = (0, _react.useCallback)(function () {
|
|
237
|
+
var menu = (0, _isFunction.default)(target) ? target() : target; // For Cascader and MutiCascader
|
|
238
|
+
|
|
239
|
+
var subMenu = menu === null || menu === void 0 ? void 0 : menu.querySelector("[data-layer=\"" + layer + "\"]");
|
|
240
|
+
|
|
241
|
+
if (subMenu) {
|
|
242
|
+
return subMenu;
|
|
243
|
+
} // For SelectPicker、CheckPicker、Autocomplete、InputPicker、TagPicker
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
return menu === null || menu === void 0 ? void 0 : menu.querySelector('[role="listbox"]');
|
|
247
|
+
}, [layer, target]);
|
|
193
248
|
/**
|
|
194
249
|
* Get the elements visible in all options.
|
|
195
250
|
*/
|
|
196
251
|
|
|
197
|
-
|
|
198
252
|
var getFocusableMenuItems = (0, _react.useCallback)(function () {
|
|
199
253
|
if (!target) {
|
|
200
254
|
return [];
|
|
@@ -251,28 +305,50 @@ var useFocusItemValue = function useFocusItemValue(defaultFocusItemValue, props)
|
|
|
251
305
|
|
|
252
306
|
callback(items, -1);
|
|
253
307
|
}, [focusItemValue, getFocusableMenuItems, valueKey]);
|
|
308
|
+
var scrollListItem = (0, _react.useCallback)(function (direction, itemValue, willOverflow) {
|
|
309
|
+
var container = getScrollContainer();
|
|
310
|
+
var item = container === null || container === void 0 ? void 0 : container.querySelector("[data-key=\"" + itemValue + "\"]");
|
|
311
|
+
|
|
312
|
+
if (willOverflow && container) {
|
|
313
|
+
var scrollHeight = container.scrollHeight,
|
|
314
|
+
clientHeight = container.clientHeight;
|
|
315
|
+
container.scrollTop = direction === 'top' ? scrollHeight - clientHeight : 0;
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if (item && container) {
|
|
320
|
+
if (!isVisible(item, container, direction)) {
|
|
321
|
+
var height = (0, _domLib.getHeight)(item);
|
|
322
|
+
scrollTo(container, direction, height);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}, [getScrollContainer]);
|
|
254
326
|
var focusNextMenuItem = (0, _react.useCallback)(function (event) {
|
|
255
327
|
findFocusItemIndex(function (items, index) {
|
|
256
|
-
var
|
|
328
|
+
var willOverflow = index + 2 > items.length;
|
|
329
|
+
var nextIndex = willOverflow ? 0 : index + 1;
|
|
257
330
|
var focusItem = items[nextIndex];
|
|
258
331
|
|
|
259
332
|
if (!(0, _isUndefined.default)(focusItem)) {
|
|
260
333
|
setFocusItemValue(focusItem[valueKey]);
|
|
261
334
|
callback === null || callback === void 0 ? void 0 : callback(focusItem[valueKey], event);
|
|
335
|
+
scrollListItem('bottom', focusItem[valueKey], willOverflow);
|
|
262
336
|
}
|
|
263
337
|
});
|
|
264
|
-
}, [callback, findFocusItemIndex, valueKey]);
|
|
338
|
+
}, [callback, findFocusItemIndex, scrollListItem, valueKey]);
|
|
265
339
|
var focusPrevMenuItem = (0, _react.useCallback)(function (event) {
|
|
266
340
|
findFocusItemIndex(function (items, index) {
|
|
267
|
-
var
|
|
341
|
+
var willOverflow = index === 0;
|
|
342
|
+
var nextIndex = willOverflow ? items.length - 1 : index - 1;
|
|
268
343
|
var focusItem = items[nextIndex];
|
|
269
344
|
|
|
270
345
|
if (!(0, _isUndefined.default)(focusItem)) {
|
|
271
346
|
setFocusItemValue(focusItem[valueKey]);
|
|
272
347
|
callback === null || callback === void 0 ? void 0 : callback(focusItem[valueKey], event);
|
|
348
|
+
scrollListItem('top', focusItem[valueKey], willOverflow);
|
|
273
349
|
}
|
|
274
350
|
});
|
|
275
|
-
}, [callback, findFocusItemIndex, valueKey]);
|
|
351
|
+
}, [callback, findFocusItemIndex, scrollListItem, valueKey]);
|
|
276
352
|
var getSubMenuKeys = (0, _react.useCallback)(function (nextLayer) {
|
|
277
353
|
var menu = (0, _isFunction.default)(target) ? target() : target;
|
|
278
354
|
var subMenu = menu === null || menu === void 0 ? void 0 : menu.querySelector("[data-layer=\"" + nextLayer + "\"]");
|
package/dist/rsuite-rtl.css
CHANGED
|
@@ -7741,8 +7741,8 @@ label:hover .rs-checkbox-wrapper .rs-checkbox-inner::before {
|
|
|
7741
7741
|
color: #8e8e93;
|
|
7742
7742
|
color: var(--rs-text-secondary);
|
|
7743
7743
|
min-height: 20px;
|
|
7744
|
-
line-height: 1.
|
|
7745
|
-
font-size:
|
|
7744
|
+
line-height: 1.66666667;
|
|
7745
|
+
font-size: 12px;
|
|
7746
7746
|
}
|
|
7747
7747
|
.rs-form-help-text-tooltip {
|
|
7748
7748
|
display: -webkit-inline-box;
|
|
@@ -15278,7 +15278,6 @@ textarea.rs-picker-menu .rs-picker-search-bar .rs-picker-search-bar-input {
|
|
|
15278
15278
|
padding: 2px 10px;
|
|
15279
15279
|
color: #fff;
|
|
15280
15280
|
color: var(--rs-tooltip-text);
|
|
15281
|
-
text-align: center;
|
|
15282
15281
|
background-color: #272c36;
|
|
15283
15282
|
background-color: var(--rs-tooltip-bg);
|
|
15284
15283
|
border-radius: 4px;
|