rsuite 5.53.1 → 5.54.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/AutoComplete/styles/index.css +0 -2
- package/CHANGELOG.md +28 -0
- package/Cascader/styles/index.css +0 -2
- package/CheckPicker/styles/index.css +0 -2
- package/CheckTree/styles/index.css +0 -2
- package/CheckTreePicker/styles/index.css +0 -2
- package/DatePicker/styles/index.css +0 -2
- package/DateRangePicker/styles/index.css +0 -2
- package/FormGroup/styles/index.css +3 -0
- package/FormGroup/styles/index.less +2 -0
- package/InlineEdit/package.json +7 -0
- package/InlineEdit/styles/index.css +112 -0
- package/InlineEdit/styles/index.less +48 -0
- package/InputGroup/styles/index.css +0 -2
- package/InputGroup/styles/index.less +0 -2
- package/InputNumber/styles/index.css +0 -2
- package/InputPicker/styles/index.css +0 -2
- package/MultiCascader/styles/index.css +0 -2
- package/Pagination/styles/index.css +0 -2
- package/SelectPicker/styles/index.css +0 -2
- package/TagInput/styles/index.css +1 -4
- package/TagPicker/styles/index.css +1 -4
- package/TagPicker/styles/index.less +1 -2
- package/cjs/CheckTreePicker/CheckTreePicker.js +20 -10
- package/cjs/DatePicker/DatePicker.js +1 -1
- package/cjs/DateRangePicker/DateRangePicker.js +5 -0
- package/cjs/InlineEdit/EditableControls.d.ts +8 -0
- package/cjs/InlineEdit/EditableControls.js +34 -0
- package/cjs/InlineEdit/InlineEdit.d.ts +56 -0
- package/cjs/InlineEdit/InlineEdit.js +98 -0
- package/cjs/InlineEdit/index.d.ts +3 -0
- package/cjs/InlineEdit/index.js +9 -0
- package/cjs/InlineEdit/renderChildren.d.ts +12 -0
- package/cjs/InlineEdit/renderChildren.js +40 -0
- package/cjs/InlineEdit/useEditState.d.ts +22 -0
- package/cjs/InlineEdit/useEditState.js +82 -0
- package/cjs/InlineEdit/useFocusEvent.d.ts +14 -0
- package/cjs/InlineEdit/useFocusEvent.js +61 -0
- package/cjs/Input/Input.js +6 -3
- package/cjs/InputPicker/InputPicker.js +6 -5
- package/cjs/Slider/Slider.d.ts +2 -0
- package/cjs/Slider/Slider.js +4 -2
- package/cjs/TreePicker/TreePicker.js +20 -11
- package/cjs/index.d.ts +2 -0
- package/cjs/index.js +3 -1
- package/cjs/internals/Picker/ListCheckItem.js +0 -1
- package/cjs/internals/Picker/Listbox.d.ts +5 -1
- package/cjs/internals/Picker/Listbox.js +6 -5
- package/cjs/internals/Picker/hooks/usePickerRef.js +2 -0
- package/cjs/internals/Picker/types.d.ts +2 -0
- package/cjs/internals/symbols.d.ts +2 -0
- package/cjs/internals/symbols.js +9 -0
- package/cjs/utils/getDataGroupBy.d.ts +0 -1
- package/cjs/utils/getDataGroupBy.js +3 -5
- package/dist/rsuite-no-reset-rtl.css +91 -4
- package/dist/rsuite-no-reset-rtl.min.css +1 -1
- package/dist/rsuite-no-reset-rtl.min.css.map +1 -1
- package/dist/rsuite-no-reset.css +91 -4
- package/dist/rsuite-no-reset.min.css +1 -1
- package/dist/rsuite-no-reset.min.css.map +1 -1
- package/dist/rsuite-rtl.css +91 -4
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +91 -4
- package/dist/rsuite.js +89 -12
- package/dist/rsuite.js.map +1 -1
- 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/CheckTreePicker/CheckTreePicker.js +20 -10
- package/esm/DatePicker/DatePicker.js +1 -1
- package/esm/DateRangePicker/DateRangePicker.js +5 -0
- package/esm/InlineEdit/EditableControls.d.ts +8 -0
- package/esm/InlineEdit/EditableControls.js +28 -0
- package/esm/InlineEdit/InlineEdit.d.ts +56 -0
- package/esm/InlineEdit/InlineEdit.js +92 -0
- package/esm/InlineEdit/index.d.ts +3 -0
- package/esm/InlineEdit/index.js +3 -0
- package/esm/InlineEdit/renderChildren.d.ts +12 -0
- package/esm/InlineEdit/renderChildren.js +34 -0
- package/esm/InlineEdit/useEditState.d.ts +22 -0
- package/esm/InlineEdit/useEditState.js +76 -0
- package/esm/InlineEdit/useFocusEvent.d.ts +14 -0
- package/esm/InlineEdit/useFocusEvent.js +56 -0
- package/esm/Input/Input.js +6 -3
- package/esm/InputPicker/InputPicker.js +6 -5
- package/esm/Slider/Slider.d.ts +2 -0
- package/esm/Slider/Slider.js +4 -2
- package/esm/TreePicker/TreePicker.js +20 -11
- package/esm/index.d.ts +2 -0
- package/esm/index.js +1 -0
- package/esm/internals/Picker/ListCheckItem.js +0 -1
- package/esm/internals/Picker/Listbox.d.ts +5 -1
- package/esm/internals/Picker/Listbox.js +7 -6
- package/esm/internals/Picker/hooks/usePickerRef.js +2 -0
- package/esm/internals/Picker/types.d.ts +2 -0
- package/esm/internals/symbols.d.ts +2 -0
- package/esm/internals/symbols.js +3 -0
- package/esm/utils/getDataGroupBy.d.ts +0 -1
- package/esm/utils/getDataGroupBy.js +2 -3
- package/package.json +1 -1
- package/styles/color-modes/dark.less +3 -0
- package/styles/color-modes/high-contrast.less +3 -0
- package/styles/color-modes/light.less +3 -0
- package/styles/index.less +1 -0
package/esm/index.js
CHANGED
|
@@ -57,6 +57,7 @@ export { default as Uploader } from './Uploader';
|
|
|
57
57
|
export { default as Slider } from './Slider';
|
|
58
58
|
export { default as RangeSlider } from './RangeSlider';
|
|
59
59
|
export { default as Rate } from './Rate';
|
|
60
|
+
export { default as InlineEdit } from './InlineEdit';
|
|
60
61
|
// Data display
|
|
61
62
|
export { default as Tree } from './Tree';
|
|
62
63
|
export { default as CheckTree } from './CheckTree';
|
|
@@ -65,7 +65,6 @@ var ListCheckItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
65
65
|
onClick: handleSelectItem,
|
|
66
66
|
onCheckboxClick: handleCheck
|
|
67
67
|
};
|
|
68
|
-
console.log(className, 'className');
|
|
69
68
|
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
70
69
|
role: "option",
|
|
71
70
|
"aria-selected": active,
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ListProps, ListHandle } from '../../internals/Windowing';
|
|
3
3
|
import { StandardProps, ItemDataType } from '../../@types/common';
|
|
4
|
+
import { RSUITE_PICKER_GROUP_KEY } from '../../internals/symbols';
|
|
5
|
+
interface InnerItemDataType extends ItemDataType {
|
|
6
|
+
[RSUITE_PICKER_GROUP_KEY]?: boolean;
|
|
7
|
+
}
|
|
4
8
|
export interface ListboxProps<Multiple = false> extends StandardProps, Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> {
|
|
5
9
|
classPrefix: string;
|
|
6
|
-
data?:
|
|
10
|
+
data?: InnerItemDataType[];
|
|
7
11
|
group?: boolean;
|
|
8
12
|
groupBy?: string;
|
|
9
13
|
disabledItemValues?: any[];
|
|
@@ -17,8 +17,9 @@ import { List, AutoSizer, VariableSizeList } from '../../internals/Windowing';
|
|
|
17
17
|
import shallowEqual from '../../utils/shallowEqual';
|
|
18
18
|
import { mergeRefs, useClassNames, useMount, useEventCallback } from '../../utils';
|
|
19
19
|
import ListItemGroup from './ListItemGroup';
|
|
20
|
-
import {
|
|
20
|
+
import { KEY_GROUP_TITLE } from '../../utils/getDataGroupBy';
|
|
21
21
|
import useCombobox from './hooks/useCombobox';
|
|
22
|
+
import { RSUITE_PICKER_GROUP_KEY } from '../../internals/symbols';
|
|
22
23
|
var Listbox = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
23
24
|
var _props$data = props.data,
|
|
24
25
|
data = _props$data === void 0 ? [] : _props$data,
|
|
@@ -86,7 +87,7 @@ var Listbox = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
86
87
|
});
|
|
87
88
|
var getRowHeight = function getRowHeight(list, index) {
|
|
88
89
|
var item = list[index];
|
|
89
|
-
if (group && item[
|
|
90
|
+
if (group && item[RSUITE_PICKER_GROUP_KEY] && index !== 0) {
|
|
90
91
|
return rowGroupHeight;
|
|
91
92
|
}
|
|
92
93
|
return rowHeight;
|
|
@@ -115,7 +116,7 @@ var Listbox = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
115
116
|
var filteredItems = group ? data.filter(function (item) {
|
|
116
117
|
var _item$parent;
|
|
117
118
|
// Display group title items
|
|
118
|
-
if (item[
|
|
119
|
+
if (item[RSUITE_PICKER_GROUP_KEY]) return true;
|
|
119
120
|
|
|
120
121
|
// Display items under the unfolded group
|
|
121
122
|
// FIXME-Doma
|
|
@@ -139,7 +140,7 @@ var Listbox = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
139
140
|
var item = itemData || data[index];
|
|
140
141
|
var value = item[valueKey];
|
|
141
142
|
var label = item[labelKey];
|
|
142
|
-
if (isUndefined(label) && !item[
|
|
143
|
+
if (isUndefined(label) && !item[RSUITE_PICKER_GROUP_KEY]) {
|
|
143
144
|
throw Error("labelKey \"" + labelKey + "\" is not defined in \"data\" : " + index);
|
|
144
145
|
}
|
|
145
146
|
|
|
@@ -150,7 +151,7 @@ var Listbox = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
150
151
|
* Render <ListboxGroup>
|
|
151
152
|
* when if `group` is enabled
|
|
152
153
|
*/
|
|
153
|
-
if (group && item[
|
|
154
|
+
if (group && item[RSUITE_PICKER_GROUP_KEY]) {
|
|
154
155
|
var groupValue = item[KEY_GROUP_TITLE];
|
|
155
156
|
// TODO: grouped options should be owned by group
|
|
156
157
|
return /*#__PURE__*/React.createElement(ListItemGroup, {
|
|
@@ -164,7 +165,7 @@ var Listbox = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
164
165
|
key: "group-" + groupValue,
|
|
165
166
|
onClick: handleGroupTitleClick.bind(null, groupValue)
|
|
166
167
|
}, renderMenuGroup ? renderMenuGroup(groupValue, item) : groupValue);
|
|
167
|
-
} else if (isUndefined(value) && !isUndefined(item[
|
|
168
|
+
} else if (isUndefined(value) && !isUndefined(item[RSUITE_PICKER_GROUP_KEY])) {
|
|
168
169
|
throw Error("valueKey \"" + valueKey + "\" is not defined in \"data\" : " + index + " ");
|
|
169
170
|
}
|
|
170
171
|
var disabled = disabledItemValues === null || disabledItemValues === void 0 ? void 0 : disabledItemValues.some(function (disabledValue) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useImperativeHandle, useRef } from 'react';
|
|
3
3
|
import useEventCallback from '../../../utils/useEventCallback';
|
|
4
|
+
import { RSUITE_PICKER_TYPE } from '../../../internals/symbols';
|
|
4
5
|
/**
|
|
5
6
|
* A hook of the exposed method of Picker
|
|
6
7
|
*/
|
|
@@ -64,6 +65,7 @@ function usePickerRef(ref, parmas) {
|
|
|
64
65
|
}
|
|
65
66
|
return list === null || list === void 0 ? void 0 : list.current;
|
|
66
67
|
},
|
|
68
|
+
type: RSUITE_PICKER_TYPE,
|
|
67
69
|
updatePosition: handleUpdatePosition,
|
|
68
70
|
open: handleOpen,
|
|
69
71
|
close: handleClose
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { RsRefForwardingComponent } from '../../@types/common';
|
|
3
3
|
import type { ListHandle } from '../../internals/Windowing';
|
|
4
|
+
import { RSUITE_PICKER_TYPE } from '../../internals/symbols';
|
|
4
5
|
export interface PickerHandle {
|
|
6
|
+
type?: typeof RSUITE_PICKER_TYPE;
|
|
5
7
|
root: HTMLElement | null;
|
|
6
8
|
list?: ListHandle;
|
|
7
9
|
overlay?: HTMLElement | null;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import _groupBy from "lodash/groupBy";
|
|
3
3
|
import { WalkTreeStrategy, flattenTree } from '../utils/treeUtils';
|
|
4
|
-
|
|
5
|
-
export var KEY_GROUP = hasSymbol ? Symbol('_$grouped') : '_$grouped';
|
|
4
|
+
import { RSUITE_PICKER_GROUP_KEY } from '../internals/symbols';
|
|
6
5
|
export var KEY_GROUP_TITLE = 'groupTitle';
|
|
7
6
|
export function getDataGroupBy(data, key, sort) {
|
|
8
7
|
var groupMap = _groupBy(data, key);
|
|
@@ -13,7 +12,7 @@ export function getDataGroupBy(data, key, sort) {
|
|
|
13
12
|
children = _ref[1];
|
|
14
13
|
return _ref2 = {
|
|
15
14
|
children: isSort ? children.sort(sort(false)) : children
|
|
16
|
-
}, _ref2[KEY_GROUP_TITLE] = groupTitle, _ref2[
|
|
15
|
+
}, _ref2[KEY_GROUP_TITLE] = groupTitle, _ref2[RSUITE_PICKER_GROUP_KEY] = true, _ref2;
|
|
17
16
|
});
|
|
18
17
|
if (isSort) {
|
|
19
18
|
groups.sort(sort(true));
|
package/package.json
CHANGED
|
@@ -242,6 +242,9 @@
|
|
|
242
242
|
--rs-input-focus-border: var(--rs-primary-500);
|
|
243
243
|
--rs-input-disabled-bg: var(--rs-gray-700);
|
|
244
244
|
|
|
245
|
+
// InlineEdit
|
|
246
|
+
--rs-inline-edit-hover-bg: var(--rs-gray-500);
|
|
247
|
+
|
|
245
248
|
// ARIA Listboxes
|
|
246
249
|
--rs-listbox-option-hover-bg: var(--rs-gray-600);
|
|
247
250
|
--rs-listbox-option-hover-text: currentColor;
|
|
@@ -247,6 +247,9 @@
|
|
|
247
247
|
--rs-input-focus-border: var(--rs-primary-500);
|
|
248
248
|
--rs-input-disabled-bg: var(--rs-gray-700);
|
|
249
249
|
|
|
250
|
+
// InlineEdit
|
|
251
|
+
--rs-inline-edit-hover-bg: transparent;
|
|
252
|
+
|
|
250
253
|
// ARIA Listboxes
|
|
251
254
|
--rs-listbox-option-hover-bg: transparent;
|
|
252
255
|
--rs-listbox-option-hover-text: var(--rs-primary-500);
|
|
@@ -253,6 +253,9 @@
|
|
|
253
253
|
--rs-input-focus-border: var(--rs-primary-500);
|
|
254
254
|
--rs-input-disabled-bg: var(--rs-gray-50);
|
|
255
255
|
|
|
256
|
+
// InlineEdit
|
|
257
|
+
--rs-inline-edit-hover-bg: var(--rs-gray-200);
|
|
258
|
+
|
|
256
259
|
// ARIA Listboxes
|
|
257
260
|
--rs-listbox-option-hover-bg: rgb(from var(--rs-primary-100) r g b / 50%);
|
|
258
261
|
--rs-listbox-option-hover-text: var(--rs-primary-700);
|
package/styles/index.less
CHANGED
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
@import '../InputGroup/styles/index';
|
|
42
42
|
@import '../InputNumber/styles/index';
|
|
43
43
|
@import '../InputPicker/styles/index';
|
|
44
|
+
@import '../InlineEdit/styles/index';
|
|
44
45
|
@import '../List/styles/index';
|
|
45
46
|
@import '../Loader/styles/index';
|
|
46
47
|
@import '../Message/styles/index';
|