@rc-component/cascader 1.6.0 → 1.6.1
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/es/Cascader.js +5 -9
- package/es/OptionList/useKeyboard.d.ts +1 -1
- package/es/Panel.js +3 -5
- package/lib/Cascader.js +5 -9
- package/lib/OptionList/useKeyboard.d.ts +1 -1
- package/lib/Panel.js +2 -4
- package/package.json +2 -2
package/es/Cascader.js
CHANGED
|
@@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
2
2
|
import { BaseSelect } from '@rc-component/select';
|
|
3
3
|
import useId from "@rc-component/util/es/hooks/useId";
|
|
4
4
|
import useEvent from "@rc-component/util/es/hooks/useEvent";
|
|
5
|
-
import
|
|
5
|
+
import useControlledState from "@rc-component/util/es/hooks/useControlledState";
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import CascaderContext from "./context";
|
|
8
8
|
import useDisplayValues from "./hooks/useDisplayValues";
|
|
@@ -60,10 +60,8 @@ const Cascader = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
60
60
|
const multiple = !!checkable;
|
|
61
61
|
|
|
62
62
|
// =========================== Values ===========================
|
|
63
|
-
const [
|
|
64
|
-
|
|
65
|
-
postState: toRawValues
|
|
66
|
-
});
|
|
63
|
+
const [interanlRawValues, setRawValues] = useControlledState(defaultValue, value);
|
|
64
|
+
const rawValues = toRawValues(interanlRawValues);
|
|
67
65
|
|
|
68
66
|
// ========================= FieldNames =========================
|
|
69
67
|
const mergedFieldNames = React.useMemo(() => fillFieldNames(fieldNames), /* eslint-disable react-hooks/exhaustive-deps */
|
|
@@ -80,10 +78,8 @@ const Cascader = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
80
78
|
searchValue,
|
|
81
79
|
onSearch
|
|
82
80
|
} = searchConfig;
|
|
83
|
-
const [
|
|
84
|
-
|
|
85
|
-
postState: search => search || ''
|
|
86
|
-
});
|
|
81
|
+
const [internalSearchValue, setSearchValue] = useControlledState('', searchValue);
|
|
82
|
+
const mergedSearchValue = internalSearchValue || '';
|
|
87
83
|
const onInternalSearch = (searchText, info) => {
|
|
88
84
|
setSearchValue(searchText);
|
|
89
85
|
if (info.source !== 'blur' && onSearch) {
|
|
@@ -2,7 +2,7 @@ import type { RefOptionListProps } from '@rc-component/select/lib/OptionList';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import type { DefaultOptionType, InternalFieldNames, LegacyKey, SingleValueType } from '../Cascader';
|
|
4
4
|
declare const _default: (ref: React.Ref<RefOptionListProps>, options: DefaultOptionType[], fieldNames: InternalFieldNames, activeValueCells: LegacyKey[], setActiveValueCells: (activeValueCells: LegacyKey[]) => void, onKeyBoardSelect: (valueCells: SingleValueType, option: DefaultOptionType) => void, contextProps: {
|
|
5
|
-
direction?: "
|
|
5
|
+
direction?: "ltr" | "rtl" | undefined;
|
|
6
6
|
searchValue: string;
|
|
7
7
|
toggleOpen: (open?: boolean) => void;
|
|
8
8
|
open?: boolean | undefined;
|
package/es/Panel.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import { useEvent,
|
|
2
|
+
import { useEvent, useControlledState } from '@rc-component/util';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import CascaderContext from "./context";
|
|
5
5
|
import useMissingValues from "./hooks/useMissingValues";
|
|
@@ -37,10 +37,8 @@ export default function Panel(props) {
|
|
|
37
37
|
const multiple = !!checkable;
|
|
38
38
|
|
|
39
39
|
// ========================= Values =========================
|
|
40
|
-
const [
|
|
41
|
-
|
|
42
|
-
postState: toRawValues
|
|
43
|
-
});
|
|
40
|
+
const [interanlRawValues, setRawValues] = useControlledState(defaultValue, value);
|
|
41
|
+
const rawValues = toRawValues(interanlRawValues);
|
|
44
42
|
|
|
45
43
|
// ========================= FieldNames =========================
|
|
46
44
|
const mergedFieldNames = React.useMemo(() => fillFieldNames(fieldNames), /* eslint-disable react-hooks/exhaustive-deps */
|
package/lib/Cascader.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _select = require("@rc-component/select");
|
|
8
8
|
var _useId = _interopRequireDefault(require("@rc-component/util/lib/hooks/useId"));
|
|
9
9
|
var _useEvent = _interopRequireDefault(require("@rc-component/util/lib/hooks/useEvent"));
|
|
10
|
-
var
|
|
10
|
+
var _useControlledState = _interopRequireDefault(require("@rc-component/util/lib/hooks/useControlledState"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _context = _interopRequireDefault(require("./context"));
|
|
13
13
|
var _useDisplayValues = _interopRequireDefault(require("./hooks/useDisplayValues"));
|
|
@@ -69,10 +69,8 @@ const Cascader = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
69
69
|
const multiple = !!checkable;
|
|
70
70
|
|
|
71
71
|
// =========================== Values ===========================
|
|
72
|
-
const [
|
|
73
|
-
|
|
74
|
-
postState: _commonUtil.toRawValues
|
|
75
|
-
});
|
|
72
|
+
const [interanlRawValues, setRawValues] = (0, _useControlledState.default)(defaultValue, value);
|
|
73
|
+
const rawValues = (0, _commonUtil.toRawValues)(interanlRawValues);
|
|
76
74
|
|
|
77
75
|
// ========================= FieldNames =========================
|
|
78
76
|
const mergedFieldNames = React.useMemo(() => (0, _commonUtil.fillFieldNames)(fieldNames), /* eslint-disable react-hooks/exhaustive-deps */
|
|
@@ -89,10 +87,8 @@ const Cascader = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
89
87
|
searchValue,
|
|
90
88
|
onSearch
|
|
91
89
|
} = searchConfig;
|
|
92
|
-
const [
|
|
93
|
-
|
|
94
|
-
postState: search => search || ''
|
|
95
|
-
});
|
|
90
|
+
const [internalSearchValue, setSearchValue] = (0, _useControlledState.default)('', searchValue);
|
|
91
|
+
const mergedSearchValue = internalSearchValue || '';
|
|
96
92
|
const onInternalSearch = (searchText, info) => {
|
|
97
93
|
setSearchValue(searchText);
|
|
98
94
|
if (info.source !== 'blur' && onSearch) {
|
|
@@ -2,7 +2,7 @@ import type { RefOptionListProps } from '@rc-component/select/lib/OptionList';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import type { DefaultOptionType, InternalFieldNames, LegacyKey, SingleValueType } from '../Cascader';
|
|
4
4
|
declare const _default: (ref: React.Ref<RefOptionListProps>, options: DefaultOptionType[], fieldNames: InternalFieldNames, activeValueCells: LegacyKey[], setActiveValueCells: (activeValueCells: LegacyKey[]) => void, onKeyBoardSelect: (valueCells: SingleValueType, option: DefaultOptionType) => void, contextProps: {
|
|
5
|
-
direction?: "
|
|
5
|
+
direction?: "ltr" | "rtl" | undefined;
|
|
6
6
|
searchValue: string;
|
|
7
7
|
toggleOpen: (open?: boolean) => void;
|
|
8
8
|
open?: boolean | undefined;
|
package/lib/Panel.js
CHANGED
|
@@ -46,10 +46,8 @@ function Panel(props) {
|
|
|
46
46
|
const multiple = !!checkable;
|
|
47
47
|
|
|
48
48
|
// ========================= Values =========================
|
|
49
|
-
const [
|
|
50
|
-
|
|
51
|
-
postState: _commonUtil.toRawValues
|
|
52
|
-
});
|
|
49
|
+
const [interanlRawValues, setRawValues] = (0, _util.useControlledState)(defaultValue, value);
|
|
50
|
+
const rawValues = (0, _commonUtil.toRawValues)(interanlRawValues);
|
|
53
51
|
|
|
54
52
|
// ========================= FieldNames =========================
|
|
55
53
|
const mergedFieldNames = React.useMemo(() => (0, _commonUtil.fillFieldNames)(fieldNames), /* eslint-disable react-hooks/exhaustive-deps */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rc-component/cascader",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "cascade select ui component for react",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@rc-component/select": "~1.1.0",
|
|
47
47
|
"@rc-component/tree": "~1.0.0",
|
|
48
|
-
"@rc-component/util": "^1.
|
|
48
|
+
"@rc-component/util": "^1.3.0",
|
|
49
49
|
"classnames": "^2.3.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|