Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/testing-library/re…
Browse files Browse the repository at this point in the history
…act-14.0.0
  • Loading branch information
li-jia-nan authored Dec 10, 2023
2 parents 413115c + 026724e commit 5c056e5
Show file tree
Hide file tree
Showing 70 changed files with 1,606 additions and 1,098 deletions.
9 changes: 9 additions & 0 deletions .dumirc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from 'dumi';

export default defineConfig({
favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
themeConfig: {
name: 'Select',
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
},
});
41 changes: 41 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "CodeQL"

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
schedule:
- cron: "36 13 * * 3"

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ javascript ]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{ matrix.language }}"
14 changes: 7 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
setup:
Expand All @@ -15,7 +15,7 @@ jobs:

- uses: actions/setup-node@v1
with:
node-version: '12'
node-version: '18'

- name: cache package-lock.json
uses: actions/cache@v2
Expand All @@ -24,7 +24,7 @@ jobs:
key: lock-${{ github.sha }}

- name: create package-lock.json
run: npm i --package-lock-only
run: npm i --package-lock-only --ignore-scripts

- name: hack for singe file
run: |
Expand All @@ -43,7 +43,7 @@ jobs:
- name: install
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
run: npm ci

lint:
runs-on: ubuntu-latest
steps:
Expand All @@ -69,7 +69,7 @@ jobs:
run: npm run tsc

needs: setup

compile:
runs-on: ubuntu-latest
steps:
Expand All @@ -92,7 +92,7 @@ jobs:
run: npm run compile

needs: setup

coverage:
runs-on: ubuntu-latest
steps:
Expand Down
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ src/*.map
tslint.json
tsconfig.test.json
.prettierignore
.storybook
storybook/index.js
.doc
.umi
.umi
.dumi/tmp
.dumi/tmp-test
.dumi/tmp-production
54 changes: 30 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@

React Select

<!-- prettier-ignore -->
[![NPM version][npm-image]][npm-url]
[![npm download][download-image]][download-url]
[![build status][github-actions-image]][github-actions-url]
[![Test coverage][codecov-image]][codecov-url]
[![Codecov][codecov-image]][codecov-url]
[![bundle size][bundlephobia-image]][bundlephobia-url]
[![dumi][dumi-image]][dumi-url]

[npm-image]: http://img.shields.io/npm/v/rc-select.svg?style=flat-square
[npm-url]: http://npmjs.org/package/rc-select
Expand All @@ -26,6 +28,8 @@ React Select
[download-url]: https://npmjs.org/package/rc-select
[bundlephobia-url]: https://bundlephobia.com/package/rc-select
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/rc-select
[dumi-url]: https://github.com/umijs/dumi
[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square

## Screenshots

Expand All @@ -50,6 +54,7 @@ React Select

```jsx | pure
import Select, { Option } from 'rc-select';
import 'rc-select/assets/index.css';

export default () => (
<Select>
Expand All @@ -64,6 +69,7 @@ export default () => (

### Select props

<!-- prettier-ignore -->
| name | description | type | default |
| --- | --- | --- | --- |
| id | html id to set on the component wrapper | String | '' |
Expand All @@ -73,35 +79,34 @@ export default () => (
| animation | dropdown animation name. only support slide-up now | String | '' |
| transitionName | dropdown css animation name | String | '' |
| choiceTransitionName | css animation name for selected items at multiple mode | String | '' |
| dropdownMatchSelectWidth | whether dropdown's width is same with select | bool | true |
| dropdownMatchSelectWidth | whether dropdown's width is same with select | boolean | true |
| dropdownClassName | additional className applied to dropdown | String | - |
| dropdownStyle | additional style applied to dropdown | Object | {} |
| dropdownAlign | additional align applied to dropdown | Object | {} |
| dropdownMenuStyle | additional style applied to dropdown menu | Object | {} |
| dropdownStyle | additional style applied to dropdown | React.CSSProperties | {} |
| dropdownAlign | additional align applied to dropdown | [AlignType](https://github.com/react-component/trigger/blob/728d7e92394aa4b3214650f743fc47e1382dfa68/src/interface.ts#L25-L80) | {} |
| dropdownMenuStyle | additional style applied to dropdown menu | Object | React.CSSProperties |
| notFoundContent | specify content to show when no result matches. | ReactNode | 'Not Found' |
| tokenSeparators | separator used to tokenize on tag/multiple mode | string[]? | |
| open | control select open | bool | |
| defaultOpen | control select default open | bool | |
| open | control select open | boolean | |
| defaultOpen | control select default open | boolean | |
| placeholder | select placeholder | React Node | |
| showSearch | whether show search input in single mode | bool | true |
| showArrow | whether show arrow | bool | true (single mode), false (multiple mode) |
| allowClear | whether allowClear | bool | false |
| tags | when tagging is enabled the user can select from pre-existing options or create a new tag by picking the first choice, which is what the user has typed into the search box so far. | bool | false |
| showSearch | whether show search input in single mode | boolean | true |
| allowClear | whether allowClear | boolean | { clearIcon?: ReactNode } | false |
| tags | when tagging is enabled the user can select from pre-existing options or create a new tag by picking the first choice, which is what the user has typed into the search box so far. | boolean | false |
| tagRender | render custom tags. | (props: CustomTagProps) => ReactNode | - |
| maxTagTextLength | max tag text length to show | number | - |
| maxTagCount | max tag count to show | number | - |
| maxTagPlaceholder | placeholder for omitted values | ReactNode/function(omittedValues) | - |
| combobox | enable combobox mode(can not set multiple at the same time) | bool | false |
| multiple | whether multiple select | bool | false |
| disabled | whether disabled select | bool | false |
| filterOption | whether filter options by input value. default filter by option's optionFilterProp prop's value | bool | true/Function(inputValue:string, option:Option) |
| combobox | enable combobox mode(can not set multiple at the same time) | boolean | false |
| multiple | whether multiple select | boolean | false |
| disabled | whether disabled select | boolean | false |
| filterOption | whether filter options by input value. default filter by option's optionFilterProp prop's value | boolean | true/Function(inputValue:string, option:Option) |
| optionFilterProp | which prop value of option will be used for filter if filterOption is true | String | 'value' |
| filterSort | Sort function for search options sorting, see [Array.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)'s compareFunction. | Function(optionA:Option, optionB: Option) | - |
| optionLabelProp | render option value or option children as content of select | String: 'value'/'children' | 'value' |
| defaultValue | initial selected option(s) | String \| String[] | - |
| value | current selected option(s) | String \| String[] \| {key:String, label:React.Node} \| {key:String, label:React.Node}[] | - |
| labelInValue | whether to embed label in value, see above value type. Not support `combobox` mode | Bool | false |
| backfill | whether backfill select option to search input (Only works in single and combobox mode) | Bool | false |
| labelInValue | whether to embed label in value, see above value type. Not support `combobox` mode | boolean | false |
| backfill | whether backfill select option to search input (Only works in single and combobox mode) | boolean | false |
| onChange | called when select an option or input value change(combobox) | function(value, option:Option \| Option[]) | - |
| onSearch | called when input changed | function | - |
| onBlur | called when blur | function | - |
Expand All @@ -110,20 +115,21 @@ export default () => (
| onSelect | called when a option is selected. param is option's value and option instance | Function(value, option:Option) | - |
| onDeselect | called when a option is deselected. param is option's value. only called for multiple or tags | Function(value, option:Option) | - |
| onInputKeyDown | called when key down on input | Function(event) | - |
| defaultActiveFirstOption | whether active first option by default | bool | true |
| defaultActiveFirstOption | whether active first option by default | boolean | true |
| getPopupContainer | container which popup select menu rendered into | function(trigger:Node):Node | function(){return document.body;} |
| getInputElement | customize input element | function(): Element | - |
| showAction | actions trigger the dropdown to show | String[]? | - |
| autoFocus | focus select after mount | Bool | - |
| autoFocus | focus select after mount | boolean | - |
| autoClearSearchValue | auto clear search input value when multiple select is selected/deselected | boolean | true |
| inputIcon | specify the select arrow icon | ReactNode | - |
| suffixIcon | specify the select arrow icon | ReactNode | - |
| clearIcon | specify the clear icon | ReactNode | - |
| removeIcon | specify the remove icon | ReactNode | - |
| menuItemSelectedIcon | specify the item selected icon | ReactNode \| (props: MenuItemProps) => ReactNode | - |
| dropdownRender | render custom dropdown menu | (menu: React.Node, props: MenuProps) => ReactNode | - |
| loading | show loading icon in arrow | Boolean | false |
| virtual | Disable virtual scroll | Boolean | true |
| dropdownRender | render custom dropdown menu | (menu: React.Node) => ReactNode | - |
| loading | show loading icon in arrow | boolean | false |
| virtual | Disable virtual scroll | boolean | true |
| direction | direction of dropdown | 'ltr' \| 'rtl' | 'ltr' |
| optionRender | Custom rendering options | (oriOption: FlattenOptionData\<BaseOptionType\> , info: { index: number }) => React.ReactNode | - |

### Methods

Expand All @@ -137,7 +143,7 @@ export default () => (
| name | description | type | default |
| --- | --- | --- | --- |
| className | additional class to option | String | '' |
| disabled | no effect for click or keydown for this item | bool | false |
| disabled | no effect for click or keydown for this item | boolean | false |
| key | if react want you to set key, then key is same as value, you can omit value | String/number | - |
| value | default filter by this attribute. if react want you to set key, then key is same as value, you can omit value | String/number | - |
| title | if you are not satisfied with auto-generated `title` which is show while hovering on selected value, you can customize it with this property | String | - |
Expand Down
10 changes: 8 additions & 2 deletions docs/demo/auto-adjust-dropdown.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
## auto-adjust-dropdown
<code src="../examples/auto-adjust-dropdown.tsx">
---
title: auto-adjust-dropdown
nav:
title: Demo
path: /demo
---

<code src="../examples/auto-adjust-dropdown.tsx"></code>
10 changes: 8 additions & 2 deletions docs/demo/combobox.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
## combobox
<code src="../examples/combobox.tsx">
---
title: combobox
nav:
title: Demo
path: /demo
---

<code src="../examples/combobox.tsx"></code>
10 changes: 8 additions & 2 deletions docs/demo/controlled.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
## controlled
<code src="../examples/controlled.tsx">
---
title: controlled
nav:
title: Demo
path: /demo
---

<code src="../examples/controlled.tsx"></code>
10 changes: 8 additions & 2 deletions docs/demo/custom-icon.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
## custom-icon
<code src="../examples/custom-icon.tsx">
---
title: custom-icon
nav:
title: Demo
path: /demo
---

<code src="../examples/custom-icon.tsx"></code>
10 changes: 8 additions & 2 deletions docs/demo/custom-selector.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
## custom-selector
<code src="../examples/custom-selector.tsx">
---
title: custom-selector
nav:
title: Demo
path: /demo
---

<code src="../examples/custom-selector.tsx"></code>
10 changes: 8 additions & 2 deletions docs/demo/custom-tags.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
## custom-tags
<code src="../examples/custom-tags.tsx">
---
title: custom-tags
nav:
title: Demo
path: /demo
---

<code src="../examples/custom-tags.tsx"></code>
10 changes: 8 additions & 2 deletions docs/demo/dropdownRender.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
## dropdownRender
<code src="../examples/dropdownRender.tsx">
---
title: dropdownRender
nav:
title: Demo
path: /demo
---

<code src="../examples/dropdownRender.tsx"></code>
10 changes: 8 additions & 2 deletions docs/demo/email.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
## email
<code src="../examples/email.tsx">
---
title: email
nav:
title: Demo
path: /demo
---

<code src="../examples/email.tsx"></code>
10 changes: 8 additions & 2 deletions docs/demo/filterSort.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
## filterSort
<code src="../examples/filterSort.tsx">
---
title: filterSort
nav:
title: Demo
path: /demo
---

<code src="../examples/filterSort.tsx"></code>
10 changes: 8 additions & 2 deletions docs/demo/force-suggest.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
## force-suggest
<code src="../examples/force-suggest.tsx">
---
title: force-suggest
nav:
title: Demo
path: /demo
---

<code src="../examples/force-suggest.tsx"></code>
10 changes: 8 additions & 2 deletions docs/demo/getPopupContainer.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
## getPopupContainer
<code src="../examples/getPopupContainer.tsx">
---
title: getPopupContainer
nav:
title: Demo
path: /demo
---

<code src="../examples/getPopupContainer.tsx"></code>
10 changes: 8 additions & 2 deletions docs/demo/loading.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
## loading
<code src="../examples/loading.tsx">
---
title: loading
nav:
title: Demo
path: /demo
---

<code src="../examples/loading.tsx"></code>
10 changes: 8 additions & 2 deletions docs/demo/mul-suggest.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
## mul-suggest
<code src="../examples/mul-suggest.tsx">
---
title: mul-suggest
nav:
title: Demo
path: /demo
---

<code src="../examples/mul-suggest.tsx"></code>
Loading

0 comments on commit 5c056e5

Please sign in to comment.