@rc-component/cascader 1.7.0 → 1.9.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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # rc-cascader
1
+ # @rc-component/cascader
2
2
 
3
3
  React Cascader Component.
4
4
 
@@ -9,22 +9,22 @@ React Cascader Component.
9
9
  [![bundle size][bundlephobia-image]][bundlephobia-url]
10
10
  [![dumi][dumi-image]][dumi-url]
11
11
 
12
- [npm-image]: http://img.shields.io/npm/v/rc-cascader.svg?style=flat-square
13
- [npm-url]: http://npmjs.org/package/rc-cascader
12
+ [npm-image]: https://img.shields.io/npm/v/@rc-component/cascader.svg?style=flat-square
13
+ [npm-url]: https://npmjs.org/package/@rc-component/cascader
14
14
  [travis-image]: https://img.shields.io/travis/react-component/cascader/master?style=flat-square
15
15
  [travis-url]: https://travis-ci.com/react-component/cascader
16
- [github-actions-image]: https://github.com/react-component/cascader/workflows/CI/badge.svg
17
- [github-actions-url]: https://github.com/react-component/cascader/actions
16
+ [github-actions-image]: https://github.com/react-component/cascader/actions/workflows/main.yml/badge.svg
17
+ [github-actions-url]: https://github.com/react-component/cascader/actions/workflows/main.yml
18
18
  [codecov-image]: https://img.shields.io/codecov/c/github/react-component/cascader/master.svg?style=flat-square
19
19
  [codecov-url]: https://app.codecov.io/gh/react-component/cascader
20
20
  [david-url]: https://david-dm.org/react-component/cascader
21
21
  [david-image]: https://david-dm.org/react-component/cascader/status.svg?style=flat-square
22
22
  [david-dev-url]: https://david-dm.org/react-component/cascader?type=dev
23
23
  [david-dev-image]: https://david-dm.org/react-component/cascader/dev-status.svg?style=flat-square
24
- [download-image]: https://img.shields.io/npm/dm/rc-cascader.svg?style=flat-square
25
- [download-url]: https://npmjs.org/package/rc-cascader
26
- [bundlephobia-url]: https://bundlephobia.com/package/rc-cascader
27
- [bundlephobia-image]: https://badgen.net/bundlephobia/minzip/rc-cascader
24
+ [download-image]: https://img.shields.io/npm/dm/@rc-component/cascader.svg?style=flat-square
25
+ [download-url]: https://npmjs.org/package/@rc-component/cascader
26
+ [bundlephobia-url]: https://bundlephobia.com/package/@rc-component/cascader
27
+ [bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@rc-component/cascader
28
28
  [dumi-url]: https://github.com/umijs/dumi
29
29
  [dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square
30
30
 
@@ -44,10 +44,10 @@ https://cascader-react-component.vercel.app
44
44
 
45
45
  ## Install
46
46
 
47
- [![rc-cascader](https://nodei.co/npm/rc-cascader.png)](https://npmjs.org/package/rc-cascader)
47
+ [![@rc-component/cascader](https://nodei.co/npm/@rc-component/cascader.png)](https://npmjs.org/package/@rc-component/cascader)
48
48
 
49
49
  ```bash
50
- $ npm install rc-cascader --save
50
+ $ npm install @rc-component/cascader --save
51
51
  ```
52
52
 
53
53
  ## Usage
@@ -310,10 +310,10 @@ $ npm run coverage
310
310
 
311
311
  ## License
312
312
 
313
- rc-cascader is released under the MIT license.
313
+ @rc-component/cascader is released under the MIT license.
314
314
 
315
315
  ## 🤝 Contributing
316
316
 
317
317
  <a href="https://openomy.app/github/react-component/cascader" target="_blank" style="display: block; width: 100%;" align="center">
318
318
  <img src="https://www.openomy.app/svg?repo=react-component/cascader&chart=bubble&latestMonth=24" target="_blank" alt="Contribution Leaderboard" style="display: block; width: 100%;" />
319
- </a>
319
+ </a>
package/es/Cascader.js CHANGED
@@ -164,7 +164,7 @@ const Cascader = /*#__PURE__*/React.forwardRef((props, ref) => {
164
164
  loadingIcon,
165
165
  popupMenuColumnStyle,
166
166
  optionRender
167
- }), [mergedOptions, mergedFieldNames, checkedValues, halfCheckedValues, changeOnSelect, onInternalSelect, checkable, searchOptions, popupPrefixCls, loadData, expandTrigger, expandIcon, loadingIcon, popupMenuColumnStyle, optionRender]);
167
+ }), [classNames, styles, mergedOptions, mergedFieldNames, checkedValues, halfCheckedValues, changeOnSelect, onInternalSelect, checkable, searchOptions, popupPrefixCls, loadData, expandTrigger, expandIcon, loadingIcon, popupMenuColumnStyle, optionRender]);
168
168
 
169
169
  // ==============================================================
170
170
  // == Render ==
@@ -4,7 +4,7 @@ import * as React from 'react';
4
4
  import pickAttrs from "@rc-component/util/es/pickAttrs";
5
5
  import CascaderContext from "../context";
6
6
  import { SEARCH_MARK } from "../hooks/useSearchOptions";
7
- import { isLeaf, toPathKey } from "../utils/commonUtil";
7
+ import { isLeaf, scrollIntoParentView, toPathKey } from "../utils/commonUtil";
8
8
  import Checkbox from "./Checkbox";
9
9
  export const FIX_LABEL = '__cascader_fix_label__';
10
10
  export default function Column({
@@ -79,10 +79,7 @@ export default function Column({
79
79
  const selector = `.${menuItemPrefixCls}-active`;
80
80
  const activeElement = menuRef.current.querySelector(selector);
81
81
  if (activeElement) {
82
- activeElement.scrollIntoView({
83
- block: 'nearest',
84
- inline: 'nearest'
85
- });
82
+ scrollIntoParentView(activeElement);
86
83
  }
87
84
  }
88
85
  }, [activeValue, menuItemPrefixCls]);
@@ -1,4 +1,4 @@
1
- import { LegacyKey } from "../Cascader";
1
+ import type { LegacyKey } from '../Cascader';
2
2
  /**
3
3
  * Control the active open options path.
4
4
  */
@@ -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?: "rtl" | "ltr" | undefined;
5
+ direction?: "ltr" | "rtl" | undefined;
6
6
  searchValue: string;
7
7
  toggleOpen: (open?: boolean) => void;
8
8
  open?: boolean | undefined;
package/lib/Cascader.js CHANGED
@@ -173,7 +173,7 @@ const Cascader = /*#__PURE__*/React.forwardRef((props, ref) => {
173
173
  loadingIcon,
174
174
  popupMenuColumnStyle,
175
175
  optionRender
176
- }), [mergedOptions, mergedFieldNames, checkedValues, halfCheckedValues, changeOnSelect, onInternalSelect, checkable, searchOptions, popupPrefixCls, loadData, expandTrigger, expandIcon, loadingIcon, popupMenuColumnStyle, optionRender]);
176
+ }), [classNames, styles, mergedOptions, mergedFieldNames, checkedValues, halfCheckedValues, changeOnSelect, onInternalSelect, checkable, searchOptions, popupPrefixCls, loadData, expandTrigger, expandIcon, loadingIcon, popupMenuColumnStyle, optionRender]);
177
177
 
178
178
  // ==============================================================
179
179
  // == Render ==
@@ -89,10 +89,7 @@ function Column({
89
89
  const selector = `.${menuItemPrefixCls}-active`;
90
90
  const activeElement = menuRef.current.querySelector(selector);
91
91
  if (activeElement) {
92
- activeElement.scrollIntoView({
93
- block: 'nearest',
94
- inline: 'nearest'
95
- });
92
+ (0, _commonUtil.scrollIntoParentView)(activeElement);
96
93
  }
97
94
  }
98
95
  }, [activeValue, menuItemPrefixCls]);
@@ -1,4 +1,4 @@
1
- import { LegacyKey } from "../Cascader";
1
+ import type { LegacyKey } from '../Cascader';
2
2
  /**
3
3
  * Control the active open options path.
4
4
  */
@@ -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?: "rtl" | "ltr" | undefined;
5
+ direction?: "ltr" | "rtl" | undefined;
6
6
  searchValue: string;
7
7
  toggleOpen: (open?: boolean) => void;
8
8
  open?: boolean | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rc-component/cascader",
3
- "version": "1.7.0",
3
+ "version": "1.9.0",
4
4
  "description": "cascade select ui component for react",
5
5
  "keywords": [
6
6
  "react",
@@ -35,7 +35,7 @@
35
35
  "coverage": "father test --coverage",
36
36
  "tsc": "bunx tsc --noEmit",
37
37
  "deploy": "UMI_ENV=gh npm run build && gh-pages -d dist",
38
- "lint": "eslint src/ examples/ --ext .tsx,.ts,.jsx,.jsx",
38
+ "lint": "eslint src/ examples/ tests/ --ext .tsx,.ts,.jsx,.jsx",
39
39
  "now-build": "npm run build",
40
40
  "prepublishOnly": "npm run compile && rc-np",
41
41
  "lint:tsc": "tsc -p tsconfig.json --noEmit",
@@ -43,17 +43,17 @@
43
43
  "test": "rc-test"
44
44
  },
45
45
  "dependencies": {
46
- "@rc-component/select": "~1.2.0",
47
- "@rc-component/tree": "~1.0.0",
48
- "@rc-component/util": "^1.3.0",
46
+ "@rc-component/select": "~1.3.0",
47
+ "@rc-component/tree": "~1.1.0",
48
+ "@rc-component/util": "^1.4.0",
49
49
  "clsx": "^2.1.1"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@rc-component/father-plugin": "^2.0.2",
53
+ "@rc-component/form": "^1.4.0",
53
54
  "@rc-component/np": "^1.0.3",
54
55
  "@rc-component/trigger": "^3.0.0",
55
- "@testing-library/react": "^12.1.5",
56
- "@types/enzyme": "^3.1.15",
56
+ "@testing-library/react": "^16.3.0",
57
57
  "@types/jest": "^29.4.0",
58
58
  "@types/node": "^24.5.2",
59
59
  "@types/react": "^19.0.0",
@@ -65,9 +65,6 @@
65
65
  "core-js": "^3.40.0",
66
66
  "cross-env": "^7.0.0",
67
67
  "dumi": "^2.1.10",
68
- "enzyme": "^3.3.0",
69
- "enzyme-adapter-react-16": "^1.15.6",
70
- "enzyme-to-json": "^3.2.1",
71
68
  "eslint": "^8.54.0",
72
69
  "eslint-plugin-jest": "^28.8.3",
73
70
  "eslint-plugin-unicorn": "^56.0.1",
@@ -76,14 +73,13 @@
76
73
  "glob": "^7.1.6",
77
74
  "less": "^4.2.0",
78
75
  "prettier": "^3.1.0",
79
- "rc-field-form": "^1.44.0",
80
76
  "rc-test": "^7.1.2",
81
- "react": "^16.0.0",
82
- "react-dom": "^16.0.0",
77
+ "react": "^19.0.0",
78
+ "react-dom": "^19.0.0",
83
79
  "typescript": "^5.3.2"
84
80
  },
85
81
  "peerDependencies": {
86
- "react": ">=16.9.0",
87
- "react-dom": ">=16.9.0"
82
+ "react": ">=18.0.0",
83
+ "react-dom": ">=18.0.0"
88
84
  }
89
85
  }