Latest updates from IceHrmPro
This commit is contained in:
203
web/node_modules/rc-select/HISTORY.md
generated
vendored
Normal file
203
web/node_modules/rc-select/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
# History
|
||||
----
|
||||
|
||||
## 9.2.0 / 2019-07-16
|
||||
|
||||
- Adjust trigger order of `onChange` & `onSelect`
|
||||
|
||||
## 9.0.0 / 2019-02-27
|
||||
|
||||
- Multiple mode also support `showArrow`
|
||||
- Add loading className
|
||||
|
||||
## 8.8.0 / 2019-01-29
|
||||
|
||||
- Add an additional className when popup is empty
|
||||
|
||||
## 8.6.0 / 2018-11-27
|
||||
|
||||
- Added `loading` prop.
|
||||
- Allow search Option Group title.
|
||||
|
||||
## 8.5.0 / 2018-11-26
|
||||
|
||||
- Added `dropdownRender` prop.
|
||||
|
||||
## 8.4.0 / 2018-10-08
|
||||
|
||||
- Adjust focus / blur logic
|
||||
- Space support open select
|
||||
|
||||
## 8.3.0 / 2018-09-28
|
||||
|
||||
- `open` support controlled
|
||||
|
||||
## 8.2.0 / 2018-08-07
|
||||
|
||||
- Add inputIcon, clearIcon, removeIcon.
|
||||
|
||||
## 8.1.0 / 2018-06-24
|
||||
|
||||
- Add id prop.
|
||||
- Support data attributes. https://github.com/react-component/select/pull/305
|
||||
|
||||
## 8.0.2 / 2018-05-03
|
||||
|
||||
- Refactoring: Migrate to new lifecycle methods https://github.com/react-component/select/pull/291
|
||||
|
||||
## 8.0.0 / 2018-04-28
|
||||
|
||||
- Upgrade rc-menu to 7.0.1
|
||||
- Add prop `autoClearSearchValue`.
|
||||
|
||||
## 7.7.8 / 2018-04-19
|
||||
|
||||
- Fix: value is wrong when blur https://github.com/react-component/select/pull/290
|
||||
|
||||
## 7.7.6 / 2018-03-30
|
||||
|
||||
- Refactoring: update state.value format https://github.com/react-component/select/pull/277
|
||||
|
||||
## 7.7.5 / 2018-03-13
|
||||
|
||||
- Fire change on blur for tags mode https://github.com/react-component/select/pull/271
|
||||
- Fix defaultFilter can not filter array children https://github.com/react-component/select/pull/276
|
||||
|
||||
## 7.5.0 / 2017-12-11
|
||||
|
||||
- Add onInputKeydown
|
||||
|
||||
## 7.2.0 / 2017-11-16
|
||||
|
||||
- Add onPopupScroll.
|
||||
|
||||
## 7.0.0 / 2017-10-30
|
||||
|
||||
- Allow numbe value in Option
|
||||
- Add maxTagCount and maxTagTextLength https://github.com/react-component/select/pull/224
|
||||
- Add showAction https://github.com/react-component/select/pull/224
|
||||
- Add onMouseEnter and onMouseLeave https://github.com/react-component/select/pull/238
|
||||
- Add focus() and autoFocus
|
||||
|
||||
## 6.9.0 / 2017-09-01
|
||||
|
||||
- add backfill in single/combobox mode
|
||||
|
||||
## 6.8.0 / 2017-03-24
|
||||
|
||||
- support allowClear in multiple/tags mode
|
||||
|
||||
## 6.7.0 / 2017-01-03
|
||||
|
||||
- support getInputElement https://github.com/react-component/select/pull/145
|
||||
|
||||
## 6.6.0 / 2016-11-01
|
||||
|
||||
- add tokenSeparators for multiple and tag mode
|
||||
|
||||
## 6.4.0 / 2016-05-26
|
||||
|
||||
- auto expand input in ie10/11 https://github.com/react-component/select/pull/93
|
||||
- realign when value change. https://github.com/react-component/select/pull/92
|
||||
|
||||
## 6.3.0 / 2016-04-28
|
||||
|
||||
- support onBlur
|
||||
|
||||
## 6.2.0 / 2016-04-20
|
||||
|
||||
- remove searchPlaceholder
|
||||
|
||||
## 6.1.0 / 2016-04-18
|
||||
|
||||
- go with http://semantic-ui.com/modules/dropdown.html#search-selection
|
||||
|
||||
## 6.0.0 / 2016-03-16
|
||||
|
||||
- remove defaultLabel/label
|
||||
- add labelInValue prop to control label
|
||||
- support dropdownAlign
|
||||
|
||||
## 5.8.0 / 2016-01-11
|
||||
|
||||
- support value type to be number
|
||||
|
||||
## 5.7.0 / 2016-01-06
|
||||
|
||||
- add getPopupContainer prop
|
||||
|
||||
## 5.6.0 / 2016-01-01
|
||||
|
||||
- scroll to active item when open menu on single mode
|
||||
|
||||
## 5.5.0 / 2015-12-22
|
||||
|
||||
- add defaultActiveFirstOption prop
|
||||
|
||||
## 5.4.0 / 2015-12-01
|
||||
|
||||
- fix disabled for old ie
|
||||
|
||||
## 5.3.0 / 2015-11-30
|
||||
|
||||
- add choiceTransitionName prop
|
||||
|
||||
## 5.2.0 / 2015-11-24
|
||||
|
||||
- do not hide dropdown on multiple or tag mode
|
||||
|
||||
## 5.0.0 / 2015-10-22
|
||||
|
||||
- only support react 0.14+
|
||||
- auto adjust position if visible region is not enough
|
||||
|
||||
## 4.9.0 / 2015-09-10
|
||||
|
||||
- add label for onChange listener
|
||||
|
||||
## 4.8.0 / 2015-08-20
|
||||
|
||||
- make value a controlled value
|
||||
- add defaultValue prop
|
||||
- remove renderDropdownToBody prop. defaults to true
|
||||
|
||||
## 4.7.0 / 2015-08-18
|
||||
|
||||
implement searchPlaceholder to prevent bug for ie10
|
||||
|
||||
## 4.5.0 / 2015-07-30
|
||||
|
||||
use rc-animate & rc-align. (assets change)
|
||||
|
||||
## 4.4.0 / 2015-07-15
|
||||
|
||||
`new` support dropdownStyle dropdownMenuStyle prop
|
||||
|
||||
## 4.3.0 / 2015-07-14
|
||||
|
||||
`new` [#17](https://github.com/react-component/select/issues/17) support render dropdown to body
|
||||
|
||||
## 4.2.0 / 2015-07-07
|
||||
|
||||
`improved` [#15](https://github.com/react-component/select/issues/15) fix input in multiple mode
|
||||
|
||||
## 4.1.0 / 2015-07-01
|
||||
|
||||
`new` [#13](https://github.com/react-component/select/issues/13) add maxTagTextLength
|
||||
|
||||
## 4.0.0 / 2015-06-26
|
||||
|
||||
https://github.com/react-component/select/issues/11
|
||||
|
||||
## 3.5.0 / 2015-06-17
|
||||
|
||||
`new` [#6](https://github.com/react-component/select/issues/6) add OptGroup
|
||||
|
||||
|
||||
## 3.4.0 / 2015-06-15
|
||||
|
||||
`new` support showSearch/animation/transitionName/disabled props
|
||||
|
||||
## 3.1.0 / 2015-03-23
|
||||
|
||||
`new` [#2](https://github.com/react-component/select/pull/2) support tags config
|
||||
9
web/node_modules/rc-select/LICENSE.md
generated
vendored
Normal file
9
web/node_modules/rc-select/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-present alipay.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
170
web/node_modules/rc-select/README.md
generated
vendored
Normal file
170
web/node_modules/rc-select/README.md
generated
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
# rc-select
|
||||
|
||||
---
|
||||
|
||||
React Select
|
||||
|
||||
[![NPM version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![Test coverage][coveralls-image]][coveralls-url] [](https://david-dm.org/react-component/select) [](https://david-dm.org/react-component/select?type=dev) [![npm download][download-image]][download-url] [](https://github.com/react-component/select)
|
||||
|
||||
[storybook]: https://github.com/storybooks/press/blob/master/badges/storybook.svg
|
||||
[npm-image]: http://img.shields.io/npm/v/rc-select.svg?style=flat-square
|
||||
[npm-url]: http://npmjs.org/package/rc-select
|
||||
[travis-image]: https://img.shields.io/travis/react-component/select.svg?style=flat-square
|
||||
[travis-url]: https://travis-ci.org/react-component/select
|
||||
[coveralls-image]: https://img.shields.io/coveralls/react-component/select.svg?style=flat-square
|
||||
[coveralls-url]: https://coveralls.io/r/react-component/select?branch=maste
|
||||
[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square
|
||||
[node-url]: http://nodejs.org/download/
|
||||
[download-image]: https://img.shields.io/npm/dm/rc-select.svg?style=flat-square
|
||||
[download-url]: https://npmjs.org/package/rc-select
|
||||
|
||||
## Screenshots
|
||||
|
||||
<img src="https://gw.alipayobjects.com/zos/antfincdn/d13eUZlgdJ/tupian.png" />
|
||||
|
||||
## Feature
|
||||
|
||||
- support ie9,ie9+,chrome,firefox,safari
|
||||
|
||||
### Keyboard
|
||||
|
||||
- Open select (focus input || focus and click)
|
||||
- KeyDown/KeyUp/Enter to navigate menu
|
||||
|
||||
## install
|
||||
|
||||
[](https://npmjs.org/package/rc-select)
|
||||
|
||||
## Usage
|
||||
|
||||
### basic use
|
||||
|
||||
```js
|
||||
import Select, { Option, OptGroup } from 'rc-select';
|
||||
|
||||
export default () => (
|
||||
<Select>
|
||||
<Option value="jack">jack</Option>
|
||||
<Option value="lucy">lucy</Option>
|
||||
<Option value="yiminghe">yiminghe</Option>
|
||||
</Select>
|
||||
);
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### Select props
|
||||
|
||||
| name | description | type | default |
|
||||
| --- | --- | --- | --- |
|
||||
| id | html id to set on the component wrapper | String | '' |
|
||||
| className | additional css class of root dom node | String | '' |
|
||||
| data-\* | html data attributes to set on the component wrapper | String | '' |
|
||||
| prefixCls | prefix class | String | '' |
|
||||
| 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 with is same with select | bool | 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 | {} |
|
||||
| notFoundContent | specify content to show when no result matches. | String | 'Not Found' |
|
||||
| tokenSeparators | separator used to tokenize on tag/multiple mode | string[]? | |
|
||||
| open | control select open | bool | |
|
||||
| defaultOpen | control select default open | bool | |
|
||||
| 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 |
|
||||
| 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) |
|
||||
| optionFilterProp | which prop value of option will be used for filter if filterOption is true | String | 'value' |
|
||||
| optionLabelProp | render option value or option children as content of select | String: 'value'/'children' | 'value' |
|
||||
| defaultValue | initial selected option(s) | String/Array<String> | - |
|
||||
| value | current selected option(s) | String/Array<String>/{key:String, label:React.Node}/Array<{key, label}> | - |
|
||||
| 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 |
|
||||
| onChange | called when select an option or input value change(combobox) | function(value, option:Option/Array<Option>) | - |
|
||||
| onSearch | called when input changed | function | - |
|
||||
| onBlur | called when blur | function | - |
|
||||
| onFocus | called when focus | function | - |
|
||||
| onPopupScroll | called when menu is scrolled | function | - |
|
||||
| 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 |
|
||||
| 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 | - |
|
||||
| autoClearSearchValue | auto clear search input value when multiple select is selected/deselected | boolean | true |
|
||||
| inputIcon | specify the select arrow icon | ReactNode | - |
|
||||
| clearIcon | specify the clear icon | ReactNode | - |
|
||||
| removeIcon | specify the remove icon | ReactNode | - |
|
||||
| menuItemSelectedIcon | specify the remove 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 |
|
||||
| direction | direction of dropdown | 'ltr' \| 'rtl' | 'ltr' |
|
||||
|
||||
### Methods
|
||||
|
||||
| name | description | parameters | return |
|
||||
| ----- | ------------------------- | ---------- | ------ |
|
||||
| focus | focus select programmably | - | - |
|
||||
| blur | blur select programmably | - | - |
|
||||
|
||||
### Option props
|
||||
|
||||
| name | description | type | default |
|
||||
| --- | --- | --- | --- |
|
||||
| className | additional class to option | String | '' |
|
||||
| disabled | no effect for click or keydown for this item | bool | 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 | - |
|
||||
|
||||
### OptGroup props
|
||||
|
||||
| name | description | type | default |
|
||||
| --- | --- | --- | --- |
|
||||
| label | group label | String/React.Element | - |
|
||||
| key | - | String | - |
|
||||
| value | default filter by this attribute. if react want you to set key, then key is same as value, you can omit value | String | - |
|
||||
|
||||
## Development
|
||||
|
||||
```
|
||||
npm install
|
||||
npm start
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
http://localhost:9001/
|
||||
|
||||
online example: http://react-component.github.io/select/
|
||||
|
||||
## Test Case
|
||||
|
||||
```
|
||||
npm test
|
||||
```
|
||||
|
||||
## Coverage
|
||||
|
||||
```
|
||||
npm run coverage
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
rc-select is released under the MIT license.
|
||||
335
web/node_modules/rc-select/assets/index.less
generated
vendored
Normal file
335
web/node_modules/rc-select/assets/index.less
generated
vendored
Normal file
@@ -0,0 +1,335 @@
|
||||
@select-prefix: ~'rc-select';
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.search-input-without-border() {
|
||||
.@{select-prefix}-selection-search-input {
|
||||
border: none;
|
||||
outline: none;
|
||||
background: rgba(255, 0, 0, 0.2);
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.@{select-prefix} {
|
||||
display: inline-block;
|
||||
font-size: 12px;
|
||||
width: 100px;
|
||||
position: relative;
|
||||
|
||||
&-disabled {
|
||||
&,
|
||||
& input {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.@{select-prefix}-selector {
|
||||
opacity: 0.3;
|
||||
}
|
||||
}
|
||||
|
||||
&-show-arrow&-loading {
|
||||
.@{select-prefix}-arrow {
|
||||
&-icon::after {
|
||||
box-sizing: border-box;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: 100%;
|
||||
border: 2px solid #999;
|
||||
border-top-color: transparent;
|
||||
border-bottom-color: transparent;
|
||||
transform: none;
|
||||
margin-top: 4px;
|
||||
|
||||
animation: rcSelectLoadingIcon 0.5s infinite;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ============== Selector ===============
|
||||
.@{select-prefix}-selection-placeholder {
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
// --------------- Single ----------------
|
||||
&-single {
|
||||
.@{select-prefix}-selector {
|
||||
display: flex;
|
||||
position: relative;
|
||||
|
||||
.@{select-prefix}-selection-search {
|
||||
width: 100%;
|
||||
|
||||
&-input {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.@{select-prefix}-selection-item,
|
||||
.@{select-prefix}-selection-placeholder {
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
left: 3px;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
// Not customize
|
||||
&:not(.@{select-prefix}-customize-input) {
|
||||
.@{select-prefix}-selector {
|
||||
padding: 1px;
|
||||
border: 1px solid #000;
|
||||
|
||||
.search-input-without-border();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -------------- Multiple ---------------
|
||||
&-multiple .@{select-prefix}-selector {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding: 1px;
|
||||
border: 1px solid #000;
|
||||
|
||||
.@{select-prefix}-selection-item {
|
||||
flex: none;
|
||||
background: #bbb;
|
||||
border-radius: 4px;
|
||||
margin-right: 2px;
|
||||
padding: 0 8px;
|
||||
|
||||
&-disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
.@{select-prefix}-selection-search {
|
||||
position: relative;
|
||||
|
||||
&-input,
|
||||
&-mirror {
|
||||
padding: 1px;
|
||||
font-family: system-ui;
|
||||
}
|
||||
|
||||
&-mirror {
|
||||
position: absolute;
|
||||
z-index: 999;
|
||||
white-space: nowrap;
|
||||
position: none;
|
||||
left: 0;
|
||||
top: 0;
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.search-input-without-border();
|
||||
}
|
||||
|
||||
// ================ Icons ================
|
||||
&-allow-clear {
|
||||
&.@{select-prefix}-multiple .@{select-prefix}-selector {
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.@{select-prefix}-clear {
|
||||
position: absolute;
|
||||
right: 20px;
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&-show-arrow {
|
||||
&.@{select-prefix}-multiple .@{select-prefix}-selector {
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.@{select-prefix}-arrow {
|
||||
pointer-events: none;
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
top: 0;
|
||||
|
||||
&-icon::after {
|
||||
content: '';
|
||||
border: 5px solid transparent;
|
||||
width: 0;
|
||||
height: 0;
|
||||
display: inline-block;
|
||||
border-top-color: #999;
|
||||
transform: translateY(5px);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// =============== Focused ===============
|
||||
&-focused {
|
||||
.@{select-prefix}-selector {
|
||||
border-color: blue !important;
|
||||
}
|
||||
}
|
||||
|
||||
// ============== Dropdown ===============
|
||||
&-dropdown {
|
||||
border: 1px solid green;
|
||||
min-height: 100px;
|
||||
position: absolute;
|
||||
background: #fff;
|
||||
|
||||
&-hidden {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
// =============== Option ================
|
||||
&-item {
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
padding: 4px 16px;
|
||||
|
||||
// >>> Group
|
||||
&-group {
|
||||
color: #999;
|
||||
font-weight: bold;
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
// >>> Option
|
||||
&-option {
|
||||
position: relative;
|
||||
|
||||
&-grouped {
|
||||
padding-left: 24px;
|
||||
}
|
||||
|
||||
.@{select-prefix}-item-option-state {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 4px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
// ------- Active -------
|
||||
&-active {
|
||||
background: green;
|
||||
}
|
||||
|
||||
// ------ Disabled ------
|
||||
&-disabled {
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
// >>> Empty
|
||||
&-empty {
|
||||
text-align: center;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.@{select-prefix}-selection__choice-zoom {
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.@{select-prefix}-selection__choice-zoom-appear {
|
||||
opacity: 0;
|
||||
transform: scale(0.5);
|
||||
|
||||
&&-active {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
.@{select-prefix}-selection__choice-zoom-leave {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
|
||||
&&-active {
|
||||
opacity: 0;
|
||||
transform: scale(0.5);
|
||||
}
|
||||
}
|
||||
|
||||
.effect() {
|
||||
animation-duration: 0.3s;
|
||||
animation-fill-mode: both;
|
||||
transform-origin: 0 0;
|
||||
}
|
||||
|
||||
.@{select-prefix}-dropdown {
|
||||
&-slide-up-enter,
|
||||
&-slide-up-appear {
|
||||
.effect();
|
||||
opacity: 0;
|
||||
animation-timing-function: cubic-bezier(0.08, 0.82, 0.17, 1);
|
||||
animation-play-state: paused;
|
||||
}
|
||||
|
||||
&-slide-up-leave {
|
||||
.effect();
|
||||
opacity: 1;
|
||||
animation-timing-function: cubic-bezier(0.6, 0.04, 0.98, 0.34);
|
||||
animation-play-state: paused;
|
||||
}
|
||||
|
||||
&-slide-up-enter&-slide-up-enter-active&-placement-bottomLeft,
|
||||
&-slide-up-appear&-slide-up-appear-active&-placement-bottomLeft {
|
||||
animation-name: rcSelectDropdownSlideUpIn;
|
||||
animation-play-state: running;
|
||||
}
|
||||
|
||||
&-slide-up-leave&-slide-up-leave-active&-placement-bottomLeft {
|
||||
animation-name: rcSelectDropdownSlideUpOut;
|
||||
animation-play-state: running;
|
||||
}
|
||||
|
||||
&-slide-up-enter&-slide-up-enter-active&-placement-topLeft,
|
||||
&-slide-up-appear&-slide-up-appear-active&-placement-topLeft {
|
||||
animation-name: rcSelectDropdownSlideDownIn;
|
||||
animation-play-state: running;
|
||||
}
|
||||
|
||||
&-slide-up-leave&-slide-up-leave-active&-placement-topLeft {
|
||||
animation-name: rcSelectDropdownSlideDownOut;
|
||||
animation-play-state: running;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes rcSelectDropdownSlideUpIn {
|
||||
0% {
|
||||
opacity: 0;
|
||||
transform-origin: 0% 0%;
|
||||
transform: scaleY(0);
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
transform-origin: 0% 0%;
|
||||
transform: scaleY(1);
|
||||
}
|
||||
}
|
||||
@keyframes rcSelectDropdownSlideUpOut {
|
||||
0% {
|
||||
opacity: 1;
|
||||
transform-origin: 0% 0%;
|
||||
transform: scaleY(1);
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
transform-origin: 0% 0%;
|
||||
transform: scaleY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes rcSelectLoadingIcon {
|
||||
0% {
|
||||
transform: rotate(0);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
12
web/node_modules/rc-select/es/OptGroup.d.ts
generated
vendored
Normal file
12
web/node_modules/rc-select/es/OptGroup.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import * as React from 'react';
|
||||
import { OptionGroupData } from './interface';
|
||||
export interface OptGroupProps extends Omit<OptionGroupData, 'options'> {
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
export interface OptionGroupFC extends React.FC<OptGroupProps> {
|
||||
/** Legacy for check if is a Option Group */
|
||||
isSelectOptGroup: boolean;
|
||||
}
|
||||
/** This is a placeholder, not real render in dom */
|
||||
declare const OptGroup: OptionGroupFC;
|
||||
export default OptGroup;
|
||||
7
web/node_modules/rc-select/es/OptGroup.js
generated
vendored
Normal file
7
web/node_modules/rc-select/es/OptGroup.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/** This is a placeholder, not real render in dom */
|
||||
var OptGroup = function OptGroup() {
|
||||
return null;
|
||||
};
|
||||
|
||||
OptGroup.isSelectOptGroup = true;
|
||||
export default OptGroup;
|
||||
14
web/node_modules/rc-select/es/Option.d.ts
generated
vendored
Normal file
14
web/node_modules/rc-select/es/Option.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import * as React from 'react';
|
||||
import { OptionCoreData } from './interface';
|
||||
export interface OptionProps extends Omit<OptionCoreData, 'label'> {
|
||||
children: React.ReactNode;
|
||||
/** Save for customize data */
|
||||
[prop: string]: any;
|
||||
}
|
||||
export interface OptionFC extends React.FC<OptionProps> {
|
||||
/** Legacy for check if is a Option Group */
|
||||
isSelectOption: boolean;
|
||||
}
|
||||
/** This is a placeholder, not real render in dom */
|
||||
declare const Option: OptionFC;
|
||||
export default Option;
|
||||
7
web/node_modules/rc-select/es/Option.js
generated
vendored
Normal file
7
web/node_modules/rc-select/es/Option.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/** This is a placeholder, not real render in dom */
|
||||
var Option = function Option() {
|
||||
return null;
|
||||
};
|
||||
|
||||
Option.isSelectOption = true;
|
||||
export default Option;
|
||||
34
web/node_modules/rc-select/es/OptionList.d.ts
generated
vendored
Normal file
34
web/node_modules/rc-select/es/OptionList.d.ts
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
import * as React from 'react';
|
||||
import { OptionsType as SelectOptionsType, RenderNode } from './interface';
|
||||
import { RawValueType, FlattenOptionsType } from './interface/generator';
|
||||
export interface OptionListProps<OptionsType extends object[]> {
|
||||
prefixCls: string;
|
||||
id: string;
|
||||
options: OptionsType;
|
||||
flattenOptions: FlattenOptionsType<OptionsType>;
|
||||
height: number;
|
||||
itemHeight: number;
|
||||
values: Set<RawValueType>;
|
||||
multiple: boolean;
|
||||
open: boolean;
|
||||
defaultActiveFirstOption?: boolean;
|
||||
notFoundContent?: React.ReactNode;
|
||||
menuItemSelectedIcon?: RenderNode;
|
||||
childrenAsData: boolean;
|
||||
searchValue: string;
|
||||
virtual: boolean;
|
||||
onSelect: (value: RawValueType, option: {
|
||||
selected: boolean;
|
||||
}) => void;
|
||||
onToggleOpen: (open?: boolean) => void;
|
||||
/** Tell Select that some value is now active to make accessibility work */
|
||||
onActiveValue: (value: RawValueType, index: number) => void;
|
||||
onScroll: React.UIEventHandler<HTMLDivElement>;
|
||||
}
|
||||
export interface RefOptionListProps {
|
||||
onKeyDown: React.KeyboardEventHandler;
|
||||
onKeyUp: React.KeyboardEventHandler;
|
||||
scrollTo?: (index: number) => void;
|
||||
}
|
||||
declare const RefOptionList: React.ForwardRefExoticComponent<OptionListProps<SelectOptionsType> & React.RefAttributes<RefOptionListProps>>;
|
||||
export default RefOptionList;
|
||||
307
web/node_modules/rc-select/es/OptionList.js
generated
vendored
Normal file
307
web/node_modules/rc-select/es/OptionList.js
generated
vendored
Normal file
@@ -0,0 +1,307 @@
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
import * as React from 'react';
|
||||
import KeyCode from "rc-util/es/KeyCode";
|
||||
import useMemo from "rc-util/es/hooks/useMemo";
|
||||
import classNames from 'classnames';
|
||||
import List from 'rc-virtual-list';
|
||||
import TransBtn from './TransBtn';
|
||||
/**
|
||||
* Using virtual list of option display.
|
||||
* Will fallback to dom if use customize render.
|
||||
*/
|
||||
|
||||
var OptionList = function OptionList(_ref, ref) {
|
||||
var prefixCls = _ref.prefixCls,
|
||||
id = _ref.id,
|
||||
flattenOptions = _ref.flattenOptions,
|
||||
childrenAsData = _ref.childrenAsData,
|
||||
values = _ref.values,
|
||||
searchValue = _ref.searchValue,
|
||||
multiple = _ref.multiple,
|
||||
defaultActiveFirstOption = _ref.defaultActiveFirstOption,
|
||||
height = _ref.height,
|
||||
itemHeight = _ref.itemHeight,
|
||||
notFoundContent = _ref.notFoundContent,
|
||||
open = _ref.open,
|
||||
menuItemSelectedIcon = _ref.menuItemSelectedIcon,
|
||||
virtual = _ref.virtual,
|
||||
onSelect = _ref.onSelect,
|
||||
onToggleOpen = _ref.onToggleOpen,
|
||||
onActiveValue = _ref.onActiveValue,
|
||||
onScroll = _ref.onScroll;
|
||||
var itemPrefixCls = "".concat(prefixCls, "-item");
|
||||
var memoFlattenOptions = useMemo(function () {
|
||||
return flattenOptions;
|
||||
}, [open, flattenOptions], function (prev, next) {
|
||||
return next[0] && prev[1] !== next[1];
|
||||
}); // =========================== List ===========================
|
||||
|
||||
var listRef = React.useRef(null);
|
||||
|
||||
var onListMouseDown = function onListMouseDown(event) {
|
||||
event.preventDefault();
|
||||
};
|
||||
|
||||
var scrollIntoView = function scrollIntoView(index) {
|
||||
if (listRef.current) {
|
||||
listRef.current.scrollTo({
|
||||
index: index
|
||||
});
|
||||
}
|
||||
}; // ========================== Active ==========================
|
||||
|
||||
|
||||
var getEnabledActiveIndex = function getEnabledActiveIndex(index) {
|
||||
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
||||
var len = memoFlattenOptions.length;
|
||||
|
||||
for (var i = 0; i < len; i += 1) {
|
||||
var current = (index + i * offset + len) % len;
|
||||
var _memoFlattenOptions$c = memoFlattenOptions[current],
|
||||
group = _memoFlattenOptions$c.group,
|
||||
data = _memoFlattenOptions$c.data;
|
||||
|
||||
if (!group && !data.disabled) {
|
||||
return current;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
};
|
||||
|
||||
var _React$useState = React.useState(function () {
|
||||
return getEnabledActiveIndex(0);
|
||||
}),
|
||||
_React$useState2 = _slicedToArray(_React$useState, 2),
|
||||
activeIndex = _React$useState2[0],
|
||||
setActiveIndex = _React$useState2[1];
|
||||
|
||||
var setActive = function setActive(index) {
|
||||
setActiveIndex(index); // Trigger active event
|
||||
|
||||
var flattenItem = memoFlattenOptions[index];
|
||||
|
||||
if (!flattenItem) {
|
||||
onActiveValue(null, -1);
|
||||
return;
|
||||
}
|
||||
|
||||
onActiveValue(flattenItem.data.value, index);
|
||||
}; // Auto active first item when list length or searchValue changed
|
||||
|
||||
|
||||
React.useEffect(function () {
|
||||
setActive(defaultActiveFirstOption !== false ? getEnabledActiveIndex(0) : -1);
|
||||
}, [memoFlattenOptions.length, searchValue]); // Auto scroll to item position in single mode
|
||||
|
||||
React.useEffect(function () {
|
||||
/**
|
||||
* React will skip `onChange` when component update.
|
||||
* `setActive` function will call root accessibility state update which makes re-render.
|
||||
* So we need to delay to let Input component trigger onChange first.
|
||||
*/
|
||||
var timeoutId = setTimeout(function () {
|
||||
if (!multiple && open && values.size === 1) {
|
||||
var value = Array.from(values)[0];
|
||||
var index = memoFlattenOptions.findIndex(function (_ref2) {
|
||||
var data = _ref2.data;
|
||||
return data.value === value;
|
||||
});
|
||||
setActive(index);
|
||||
scrollIntoView(index);
|
||||
}
|
||||
});
|
||||
return function () {
|
||||
return clearTimeout(timeoutId);
|
||||
};
|
||||
}, [open]); // ========================== Values ==========================
|
||||
|
||||
var onSelectValue = function onSelectValue(value) {
|
||||
if (value !== undefined) {
|
||||
onSelect(value, {
|
||||
selected: !values.has(value)
|
||||
});
|
||||
} // Single mode should always close by select
|
||||
|
||||
|
||||
if (!multiple) {
|
||||
onToggleOpen(false);
|
||||
}
|
||||
}; // ========================= Keyboard =========================
|
||||
|
||||
|
||||
React.useImperativeHandle(ref, function () {
|
||||
return {
|
||||
onKeyDown: function onKeyDown(event) {
|
||||
var which = event.which;
|
||||
|
||||
switch (which) {
|
||||
// >>> Arrow keys
|
||||
case KeyCode.UP:
|
||||
case KeyCode.DOWN:
|
||||
{
|
||||
var offset = 0;
|
||||
|
||||
if (which === KeyCode.UP) {
|
||||
offset = -1;
|
||||
} else if (which === KeyCode.DOWN) {
|
||||
offset = 1;
|
||||
}
|
||||
|
||||
if (offset !== 0) {
|
||||
var nextActiveIndex = getEnabledActiveIndex(activeIndex + offset, offset);
|
||||
scrollIntoView(nextActiveIndex);
|
||||
setActive(nextActiveIndex);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
// >>> Select
|
||||
|
||||
case KeyCode.ENTER:
|
||||
{
|
||||
// value
|
||||
var item = memoFlattenOptions[activeIndex];
|
||||
|
||||
if (item && !item.data.disabled) {
|
||||
onSelectValue(item.data.value);
|
||||
} else {
|
||||
onSelectValue(undefined);
|
||||
}
|
||||
|
||||
if (open) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
// >>> Close
|
||||
|
||||
case KeyCode.ESC:
|
||||
{
|
||||
onToggleOpen(false);
|
||||
}
|
||||
}
|
||||
},
|
||||
onKeyUp: function onKeyUp() {},
|
||||
scrollTo: function scrollTo(index) {
|
||||
scrollIntoView(index);
|
||||
}
|
||||
};
|
||||
}); // ========================== Render ==========================
|
||||
|
||||
if (memoFlattenOptions.length === 0) {
|
||||
return React.createElement("div", {
|
||||
role: "listbox",
|
||||
id: "".concat(id, "_list"),
|
||||
className: "".concat(itemPrefixCls, "-empty"),
|
||||
onMouseDown: onListMouseDown
|
||||
}, notFoundContent);
|
||||
}
|
||||
|
||||
function renderItem(index) {
|
||||
var item = memoFlattenOptions[index];
|
||||
var value = item && item.data.value;
|
||||
return item ? React.createElement("div", {
|
||||
key: index,
|
||||
role: "option",
|
||||
id: "".concat(id, "_list_").concat(index),
|
||||
"aria-selected": values.has(value)
|
||||
}, value) : null;
|
||||
}
|
||||
|
||||
return React.createElement(React.Fragment, null, React.createElement("div", {
|
||||
role: "listbox",
|
||||
id: "".concat(id, "_list"),
|
||||
style: {
|
||||
height: 0,
|
||||
overflow: 'hidden'
|
||||
}
|
||||
}, renderItem(activeIndex - 1), renderItem(activeIndex), renderItem(activeIndex + 1)), React.createElement(List, {
|
||||
itemKey: "key",
|
||||
ref: listRef,
|
||||
data: memoFlattenOptions,
|
||||
height: height,
|
||||
itemHeight: itemHeight,
|
||||
fullHeight: false,
|
||||
onMouseDown: onListMouseDown,
|
||||
onScroll: onScroll,
|
||||
virtual: virtual
|
||||
}, function (_ref3, itemIndex) {
|
||||
var _classNames;
|
||||
|
||||
var group = _ref3.group,
|
||||
groupOption = _ref3.groupOption,
|
||||
data = _ref3.data;
|
||||
var label = data.label,
|
||||
key = data.key; // Group
|
||||
|
||||
if (group) {
|
||||
return React.createElement("div", {
|
||||
className: classNames(itemPrefixCls, "".concat(itemPrefixCls, "-group"))
|
||||
}, label !== undefined ? label : key);
|
||||
}
|
||||
|
||||
var disabled = data.disabled,
|
||||
value = data.value,
|
||||
title = data.title,
|
||||
children = data.children,
|
||||
style = data.style,
|
||||
className = data.className,
|
||||
otherProps = _objectWithoutProperties(data, ["disabled", "value", "title", "children", "style", "className"]); // Option
|
||||
|
||||
|
||||
var selected = values.has(value);
|
||||
var optionPrefixCls = "".concat(itemPrefixCls, "-option");
|
||||
var optionClassName = classNames(itemPrefixCls, optionPrefixCls, className, (_classNames = {}, _defineProperty(_classNames, "".concat(optionPrefixCls, "-grouped"), groupOption), _defineProperty(_classNames, "".concat(optionPrefixCls, "-active"), activeIndex === itemIndex && !disabled), _defineProperty(_classNames, "".concat(optionPrefixCls, "-disabled"), disabled), _defineProperty(_classNames, "".concat(optionPrefixCls, "-selected"), selected), _classNames));
|
||||
var mergedLabel = childrenAsData ? children : label;
|
||||
var iconVisible = !menuItemSelectedIcon || typeof menuItemSelectedIcon === 'function' || selected;
|
||||
return React.createElement("div", Object.assign({}, otherProps, {
|
||||
"aria-selected": selected,
|
||||
className: optionClassName,
|
||||
title: title,
|
||||
onMouseMove: function onMouseMove() {
|
||||
if (activeIndex === itemIndex || disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
setActive(itemIndex);
|
||||
},
|
||||
onClick: function onClick() {
|
||||
if (!disabled) {
|
||||
onSelectValue(value);
|
||||
}
|
||||
},
|
||||
style: style
|
||||
}), React.createElement("div", {
|
||||
className: "".concat(optionPrefixCls, "-content")
|
||||
}, mergedLabel || value), React.isValidElement(menuItemSelectedIcon) || selected, iconVisible && React.createElement(TransBtn, {
|
||||
className: "".concat(itemPrefixCls, "-option-state"),
|
||||
customizeIcon: menuItemSelectedIcon,
|
||||
customizeIconProps: {
|
||||
isSelected: selected
|
||||
}
|
||||
}, selected ? '✓' : null));
|
||||
}));
|
||||
};
|
||||
|
||||
var RefOptionList = React.forwardRef(OptionList);
|
||||
RefOptionList.displayName = 'OptionList';
|
||||
export default RefOptionList;
|
||||
50
web/node_modules/rc-select/es/Select.d.ts
generated
vendored
Normal file
50
web/node_modules/rc-select/es/Select.d.ts
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* To match accessibility requirement, we always provide an input in the component.
|
||||
* Other element will not set `tabIndex` to avoid `onBlur` sequence problem.
|
||||
* For focused select, we set `aria-live="polite"` to update the accessibility content.
|
||||
*
|
||||
* ref:
|
||||
* - keyboard: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role#Keyboard_interactions
|
||||
*
|
||||
* New api:
|
||||
* - listHeight
|
||||
* - listItemHeight
|
||||
* - component
|
||||
*
|
||||
* Remove deprecated api:
|
||||
* - multiple
|
||||
* - tags
|
||||
* - combobox
|
||||
* - firstActiveValue
|
||||
* - dropdownMenuStyle
|
||||
* - openClassName (Not list in api)
|
||||
*
|
||||
* Update:
|
||||
* - `backfill` only support `combobox` mode
|
||||
* - `combobox` mode not support `labelInValue` since it's meaningless
|
||||
* - `getInputElement` only support `combobox` mode
|
||||
* - `onChange` return OptionData instead of ReactNode
|
||||
* - `filterOption` `onChange` `onSelect` accept OptionData instead of ReactNode
|
||||
* - `combobox` mode trigger `onChange` will get `undefined` if no `value` match in Option
|
||||
* - `combobox` mode not support `optionLabelProp`
|
||||
*/
|
||||
import React from 'react';
|
||||
import { OptionsType as SelectOptionsType } from './interface';
|
||||
import Option from './Option';
|
||||
import OptGroup from './OptGroup';
|
||||
import { SelectProps, RefSelectProps } from './generate';
|
||||
import { DefaultValueType } from './interface/generator';
|
||||
export declare type ExportedSelectProps<ValueType extends DefaultValueType = DefaultValueType> = SelectProps<SelectOptionsType, ValueType>;
|
||||
/**
|
||||
* Typescript not support generic with function component,
|
||||
* we have to wrap an class component to handle this.
|
||||
*/
|
||||
declare class Select<VT> extends React.Component<SelectProps<SelectOptionsType, VT>> {
|
||||
static Option: typeof Option;
|
||||
static OptGroup: typeof OptGroup;
|
||||
selectRef: React.RefObject<RefSelectProps>;
|
||||
focus: () => void;
|
||||
blur: () => void;
|
||||
render(): JSX.Element;
|
||||
}
|
||||
export default Select;
|
||||
118
web/node_modules/rc-select/es/Select.js
generated
vendored
Normal file
118
web/node_modules/rc-select/es/Select.js
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
/**
|
||||
* To match accessibility requirement, we always provide an input in the component.
|
||||
* Other element will not set `tabIndex` to avoid `onBlur` sequence problem.
|
||||
* For focused select, we set `aria-live="polite"` to update the accessibility content.
|
||||
*
|
||||
* ref:
|
||||
* - keyboard: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role#Keyboard_interactions
|
||||
*
|
||||
* New api:
|
||||
* - listHeight
|
||||
* - listItemHeight
|
||||
* - component
|
||||
*
|
||||
* Remove deprecated api:
|
||||
* - multiple
|
||||
* - tags
|
||||
* - combobox
|
||||
* - firstActiveValue
|
||||
* - dropdownMenuStyle
|
||||
* - openClassName (Not list in api)
|
||||
*
|
||||
* Update:
|
||||
* - `backfill` only support `combobox` mode
|
||||
* - `combobox` mode not support `labelInValue` since it's meaningless
|
||||
* - `getInputElement` only support `combobox` mode
|
||||
* - `onChange` return OptionData instead of ReactNode
|
||||
* - `filterOption` `onChange` `onSelect` accept OptionData instead of ReactNode
|
||||
* - `combobox` mode trigger `onChange` will get `undefined` if no `value` match in Option
|
||||
* - `combobox` mode not support `optionLabelProp`
|
||||
*/
|
||||
import React from 'react';
|
||||
import SelectOptionList from './OptionList';
|
||||
import Option from './Option';
|
||||
import OptGroup from './OptGroup';
|
||||
import { convertChildrenToData as convertSelectChildrenToData } from './utils/legacyUtil';
|
||||
import { getLabeledValue as getSelectLabeledValue, filterOptions as selectDefaultFilterOptions, isValueDisabled as isSelectValueDisabled, findValueOption as findSelectValueOption, flattenOptions, fillOptionsWithMissingValue } from './utils/valueUtil';
|
||||
import generateSelector from './generate';
|
||||
import warningProps from './utils/warningPropsUtil';
|
||||
var RefSelect = generateSelector({
|
||||
prefixCls: 'rc-select',
|
||||
components: {
|
||||
optionList: SelectOptionList
|
||||
},
|
||||
convertChildrenToData: convertSelectChildrenToData,
|
||||
flattenOptions: flattenOptions,
|
||||
getLabeledValue: getSelectLabeledValue,
|
||||
filterOptions: selectDefaultFilterOptions,
|
||||
isValueDisabled: isSelectValueDisabled,
|
||||
findValueOption: findSelectValueOption,
|
||||
warningProps: warningProps,
|
||||
fillOptionsWithMissingValue: fillOptionsWithMissingValue
|
||||
});
|
||||
/**
|
||||
* Typescript not support generic with function component,
|
||||
* we have to wrap an class component to handle this.
|
||||
*/
|
||||
|
||||
var Select = /*#__PURE__*/function (_React$Component) {
|
||||
_inherits(Select, _React$Component);
|
||||
|
||||
var _super = _createSuper(Select);
|
||||
|
||||
function Select() {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, Select);
|
||||
|
||||
_this = _super.apply(this, arguments);
|
||||
_this.selectRef = React.createRef();
|
||||
|
||||
_this.focus = function () {
|
||||
_this.selectRef.current.focus();
|
||||
};
|
||||
|
||||
_this.blur = function () {
|
||||
_this.selectRef.current.blur();
|
||||
};
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(Select, [{
|
||||
key: "render",
|
||||
value: function render() {
|
||||
return React.createElement(RefSelect, Object.assign({
|
||||
ref: this.selectRef
|
||||
}, this.props));
|
||||
}
|
||||
}]);
|
||||
|
||||
return Select;
|
||||
}(React.Component);
|
||||
|
||||
Select.Option = Option;
|
||||
Select.OptGroup = OptGroup;
|
||||
export default Select;
|
||||
26
web/node_modules/rc-select/es/SelectTrigger.d.ts
generated
vendored
Normal file
26
web/node_modules/rc-select/es/SelectTrigger.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import * as React from 'react';
|
||||
import { RenderDOMFunc } from './interface';
|
||||
export interface RefTriggerProps {
|
||||
getPopupElement: () => HTMLDivElement;
|
||||
}
|
||||
export interface SelectTriggerProps {
|
||||
prefixCls: string;
|
||||
children: React.ReactElement;
|
||||
disabled: boolean;
|
||||
visible: boolean;
|
||||
popupElement: React.ReactElement;
|
||||
animation?: string;
|
||||
transitionName?: string;
|
||||
containerWidth: number;
|
||||
dropdownStyle: React.CSSProperties;
|
||||
dropdownClassName: string;
|
||||
direction: string;
|
||||
dropdownMatchSelectWidth?: boolean | number;
|
||||
dropdownRender?: (menu: React.ReactElement) => React.ReactElement;
|
||||
getPopupContainer?: RenderDOMFunc;
|
||||
dropdownAlign: object;
|
||||
empty: boolean;
|
||||
getTriggerDOMNode: () => HTMLElement;
|
||||
}
|
||||
declare const RefSelectTrigger: React.ForwardRefExoticComponent<SelectTriggerProps & React.RefAttributes<RefTriggerProps>>;
|
||||
export default RefSelectTrigger;
|
||||
129
web/node_modules/rc-select/es/SelectTrigger.js
generated
vendored
Normal file
129
web/node_modules/rc-select/es/SelectTrigger.js
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
|
||||
import * as React from 'react';
|
||||
import Trigger from 'rc-trigger';
|
||||
import classNames from 'classnames';
|
||||
|
||||
var getBuiltInPlacements = function getBuiltInPlacements(dropdownMatchSelectWidth) {
|
||||
// Enable horizontal overflow auto-adjustment when a custom dropdown width is provided
|
||||
var adjustX = typeof dropdownMatchSelectWidth !== 'number' ? 0 : 1;
|
||||
return {
|
||||
bottomLeft: {
|
||||
points: ['tl', 'bl'],
|
||||
offset: [0, 4],
|
||||
overflow: {
|
||||
adjustX: adjustX,
|
||||
adjustY: 1
|
||||
}
|
||||
},
|
||||
bottomRight: {
|
||||
points: ['tr', 'br'],
|
||||
offset: [0, 4],
|
||||
overflow: {
|
||||
adjustX: adjustX,
|
||||
adjustY: 1
|
||||
}
|
||||
},
|
||||
topLeft: {
|
||||
points: ['bl', 'tl'],
|
||||
offset: [0, -4],
|
||||
overflow: {
|
||||
adjustX: adjustX,
|
||||
adjustY: 1
|
||||
}
|
||||
},
|
||||
topRight: {
|
||||
points: ['br', 'tr'],
|
||||
offset: [0, -4],
|
||||
overflow: {
|
||||
adjustX: adjustX,
|
||||
adjustY: 1
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var SelectTrigger = function SelectTrigger(props, ref) {
|
||||
var prefixCls = props.prefixCls,
|
||||
disabled = props.disabled,
|
||||
visible = props.visible,
|
||||
children = props.children,
|
||||
popupElement = props.popupElement,
|
||||
containerWidth = props.containerWidth,
|
||||
animation = props.animation,
|
||||
transitionName = props.transitionName,
|
||||
dropdownStyle = props.dropdownStyle,
|
||||
dropdownClassName = props.dropdownClassName,
|
||||
_props$direction = props.direction,
|
||||
direction = _props$direction === void 0 ? 'ltr' : _props$direction,
|
||||
_props$dropdownMatchS = props.dropdownMatchSelectWidth,
|
||||
dropdownMatchSelectWidth = _props$dropdownMatchS === void 0 ? true : _props$dropdownMatchS,
|
||||
dropdownRender = props.dropdownRender,
|
||||
dropdownAlign = props.dropdownAlign,
|
||||
getPopupContainer = props.getPopupContainer,
|
||||
empty = props.empty,
|
||||
getTriggerDOMNode = props.getTriggerDOMNode,
|
||||
restProps = _objectWithoutProperties(props, ["prefixCls", "disabled", "visible", "children", "popupElement", "containerWidth", "animation", "transitionName", "dropdownStyle", "dropdownClassName", "direction", "dropdownMatchSelectWidth", "dropdownRender", "dropdownAlign", "getPopupContainer", "empty", "getTriggerDOMNode"]);
|
||||
|
||||
var dropdownPrefixCls = "".concat(prefixCls, "-dropdown");
|
||||
var popupNode = popupElement;
|
||||
|
||||
if (dropdownRender) {
|
||||
popupNode = dropdownRender(popupElement);
|
||||
}
|
||||
|
||||
var builtInPlacements = React.useMemo(function () {
|
||||
return getBuiltInPlacements(dropdownMatchSelectWidth);
|
||||
}, [dropdownMatchSelectWidth]); // ===================== Motion ======================
|
||||
|
||||
var mergedTransitionName = animation ? "".concat(dropdownPrefixCls, "-").concat(animation) : transitionName; // ======================= Ref =======================
|
||||
|
||||
var popupRef = React.useRef(null);
|
||||
React.useImperativeHandle(ref, function () {
|
||||
return {
|
||||
getPopupElement: function getPopupElement() {
|
||||
return popupRef.current;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
var popupStyle = _objectSpread({
|
||||
minWidth: containerWidth
|
||||
}, dropdownStyle);
|
||||
|
||||
if (typeof dropdownMatchSelectWidth === 'number') {
|
||||
popupStyle.width = dropdownMatchSelectWidth;
|
||||
} else if (dropdownMatchSelectWidth) {
|
||||
popupStyle.width = containerWidth;
|
||||
}
|
||||
|
||||
return React.createElement(Trigger, Object.assign({}, restProps, {
|
||||
showAction: [],
|
||||
hideAction: [],
|
||||
popupPlacement: direction === 'rtl' ? 'bottomRight' : 'bottomLeft',
|
||||
builtinPlacements: builtInPlacements,
|
||||
prefixCls: dropdownPrefixCls,
|
||||
popupTransitionName: mergedTransitionName,
|
||||
popup: React.createElement("div", {
|
||||
ref: popupRef
|
||||
}, popupNode),
|
||||
popupAlign: dropdownAlign,
|
||||
popupVisible: visible,
|
||||
getPopupContainer: getPopupContainer,
|
||||
popupClassName: classNames(dropdownClassName, _defineProperty({}, "".concat(dropdownPrefixCls, "-empty"), empty)),
|
||||
popupStyle: popupStyle,
|
||||
getTriggerDOMNode: getTriggerDOMNode
|
||||
}), children);
|
||||
};
|
||||
|
||||
var RefSelectTrigger = React.forwardRef(SelectTrigger);
|
||||
RefSelectTrigger.displayName = 'SelectTrigger';
|
||||
export default RefSelectTrigger;
|
||||
21
web/node_modules/rc-select/es/Selector/Input.d.ts
generated
vendored
Normal file
21
web/node_modules/rc-select/es/Selector/Input.d.ts
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import React from 'react';
|
||||
declare type InputRef = HTMLInputElement | HTMLTextAreaElement;
|
||||
interface InputProps {
|
||||
prefixCls: string;
|
||||
id: string;
|
||||
inputElement: React.ReactElement;
|
||||
disabled: boolean;
|
||||
autoFocus: boolean;
|
||||
autoComplete: string;
|
||||
editable: boolean;
|
||||
accessibilityIndex: number;
|
||||
value: string;
|
||||
open: boolean;
|
||||
tabIndex: number;
|
||||
onKeyDown: React.KeyboardEventHandler<HTMLInputElement | HTMLTextAreaElement | HTMLElement>;
|
||||
onMouseDown: React.MouseEventHandler<HTMLInputElement | HTMLTextAreaElement | HTMLElement>;
|
||||
onChange: React.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement | HTMLElement>;
|
||||
onPaste: React.ClipboardEventHandler<HTMLInputElement | HTMLTextAreaElement | HTMLElement>;
|
||||
}
|
||||
declare const RefInput: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<InputRef>>;
|
||||
export default RefInput;
|
||||
82
web/node_modules/rc-select/es/Selector/Input.js
generated
vendored
Normal file
82
web/node_modules/rc-select/es/Selector/Input.js
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
import React from 'react';
|
||||
import { composeRef } from "rc-util/es/ref";
|
||||
|
||||
var Input = function Input(_ref, ref) {
|
||||
var prefixCls = _ref.prefixCls,
|
||||
id = _ref.id,
|
||||
inputElement = _ref.inputElement,
|
||||
disabled = _ref.disabled,
|
||||
tabIndex = _ref.tabIndex,
|
||||
autoFocus = _ref.autoFocus,
|
||||
autoComplete = _ref.autoComplete,
|
||||
editable = _ref.editable,
|
||||
accessibilityIndex = _ref.accessibilityIndex,
|
||||
value = _ref.value,
|
||||
_onKeyDown = _ref.onKeyDown,
|
||||
_onMouseDown = _ref.onMouseDown,
|
||||
_onChange = _ref.onChange,
|
||||
onPaste = _ref.onPaste,
|
||||
open = _ref.open;
|
||||
var inputNode = inputElement || React.createElement("input", null);
|
||||
var _inputNode = inputNode,
|
||||
originRef = _inputNode.ref,
|
||||
_inputNode$props = _inputNode.props,
|
||||
onOriginKeyDown = _inputNode$props.onKeyDown,
|
||||
onOriginChange = _inputNode$props.onChange,
|
||||
onOriginMouseDown = _inputNode$props.onMouseDown,
|
||||
style = _inputNode$props.style;
|
||||
inputNode = React.cloneElement(inputNode, {
|
||||
id: id,
|
||||
ref: composeRef(ref, originRef),
|
||||
disabled: disabled,
|
||||
tabIndex: tabIndex,
|
||||
autoComplete: autoComplete || 'off',
|
||||
autoFocus: autoFocus,
|
||||
className: "".concat(prefixCls, "-selection-search-input"),
|
||||
style: _objectSpread({}, style, {
|
||||
opacity: editable ? null : 0
|
||||
}),
|
||||
role: 'combobox',
|
||||
'aria-expanded': open,
|
||||
'aria-haspopup': 'listbox',
|
||||
'aria-owns': "".concat(id, "_list"),
|
||||
'aria-autocomplete': 'list',
|
||||
'aria-controls': "".concat(id, "_list"),
|
||||
'aria-activedescendant': "".concat(id, "_list_").concat(accessibilityIndex),
|
||||
value: editable ? value : '',
|
||||
readOnly: !editable,
|
||||
onKeyDown: function onKeyDown(event) {
|
||||
_onKeyDown(event);
|
||||
|
||||
if (onOriginKeyDown) {
|
||||
onOriginKeyDown(event);
|
||||
}
|
||||
},
|
||||
onMouseDown: function onMouseDown(event) {
|
||||
_onMouseDown(event);
|
||||
|
||||
if (onOriginMouseDown) {
|
||||
onOriginMouseDown(event);
|
||||
}
|
||||
},
|
||||
onChange: function onChange(event) {
|
||||
_onChange(event);
|
||||
|
||||
if (onOriginChange) {
|
||||
onOriginChange(event);
|
||||
}
|
||||
},
|
||||
onPaste: onPaste
|
||||
});
|
||||
return inputNode;
|
||||
};
|
||||
|
||||
var RefInput = React.forwardRef(Input);
|
||||
RefInput.displayName = 'Input';
|
||||
export default RefInput;
|
||||
18
web/node_modules/rc-select/es/Selector/MultipleSelector.d.ts
generated
vendored
Normal file
18
web/node_modules/rc-select/es/Selector/MultipleSelector.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import React from 'react';
|
||||
import { LabelValueType, RawValueType, CustomTagProps } from '../interface/generator';
|
||||
import { RenderNode } from '../interface';
|
||||
import { InnerSelectorProps } from '.';
|
||||
interface SelectorProps extends InnerSelectorProps {
|
||||
removeIcon?: RenderNode;
|
||||
maxTagCount?: number;
|
||||
maxTagTextLength?: number;
|
||||
maxTagPlaceholder?: React.ReactNode | ((omittedValues: LabelValueType[]) => React.ReactNode);
|
||||
tokenSeparators?: string[];
|
||||
tagRender?: (props: CustomTagProps) => React.ReactElement;
|
||||
choiceTransitionName?: string;
|
||||
onSelect: (value: RawValueType, option: {
|
||||
selected: boolean;
|
||||
}) => void;
|
||||
}
|
||||
declare const SelectSelector: React.FC<SelectorProps>;
|
||||
export default SelectSelector;
|
||||
206
web/node_modules/rc-select/es/Selector/MultipleSelector.js
generated
vendored
Normal file
206
web/node_modules/rc-select/es/Selector/MultipleSelector.js
generated
vendored
Normal file
@@ -0,0 +1,206 @@
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import CSSMotionList from "rc-animate/es/CSSMotionList";
|
||||
import TransBtn from '../TransBtn';
|
||||
import Input from './Input';
|
||||
import useLayoutEffect from '../hooks/useLayoutEffect';
|
||||
var REST_TAG_KEY = '__RC_SELECT_MAX_REST_COUNT__';
|
||||
|
||||
var SelectSelector = function SelectSelector(_ref) {
|
||||
var id = _ref.id,
|
||||
prefixCls = _ref.prefixCls,
|
||||
values = _ref.values,
|
||||
open = _ref.open,
|
||||
searchValue = _ref.searchValue,
|
||||
inputRef = _ref.inputRef,
|
||||
placeholder = _ref.placeholder,
|
||||
disabled = _ref.disabled,
|
||||
mode = _ref.mode,
|
||||
showSearch = _ref.showSearch,
|
||||
autoFocus = _ref.autoFocus,
|
||||
autoComplete = _ref.autoComplete,
|
||||
accessibilityIndex = _ref.accessibilityIndex,
|
||||
tabIndex = _ref.tabIndex,
|
||||
removeIcon = _ref.removeIcon,
|
||||
choiceTransitionName = _ref.choiceTransitionName,
|
||||
maxTagCount = _ref.maxTagCount,
|
||||
maxTagTextLength = _ref.maxTagTextLength,
|
||||
_ref$maxTagPlaceholde = _ref.maxTagPlaceholder,
|
||||
maxTagPlaceholder = _ref$maxTagPlaceholde === void 0 ? function (omittedValues) {
|
||||
return "+ ".concat(omittedValues.length, " ...");
|
||||
} : _ref$maxTagPlaceholde,
|
||||
tagRender = _ref.tagRender,
|
||||
onSelect = _ref.onSelect,
|
||||
onInputChange = _ref.onInputChange,
|
||||
onInputPaste = _ref.onInputPaste,
|
||||
onInputKeyDown = _ref.onInputKeyDown,
|
||||
onInputMouseDown = _ref.onInputMouseDown;
|
||||
|
||||
var _React$useState = React.useState(false),
|
||||
_React$useState2 = _slicedToArray(_React$useState, 2),
|
||||
motionAppear = _React$useState2[0],
|
||||
setMotionAppear = _React$useState2[1];
|
||||
|
||||
var measureRef = React.useRef(null);
|
||||
|
||||
var _React$useState3 = React.useState(0),
|
||||
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
||||
inputWidth = _React$useState4[0],
|
||||
setInputWidth = _React$useState4[1]; // ===================== Motion ======================
|
||||
|
||||
|
||||
React.useEffect(function () {
|
||||
setMotionAppear(true);
|
||||
}, []); // ===================== Search ======================
|
||||
|
||||
var inputValue = open ? searchValue : '';
|
||||
var inputEditable = mode === 'tags' || open && showSearch; // We measure width and set to the input immediately
|
||||
|
||||
useLayoutEffect(function () {
|
||||
setInputWidth(measureRef.current.scrollWidth);
|
||||
}, [inputValue]); // ==================== Selection ====================
|
||||
|
||||
var displayValues = values; // Cut by `maxTagCount`
|
||||
|
||||
var restCount;
|
||||
|
||||
if (typeof maxTagCount === 'number') {
|
||||
restCount = values.length - maxTagCount;
|
||||
displayValues = values.slice(0, maxTagCount);
|
||||
} // Update by `maxTagTextLength`
|
||||
|
||||
|
||||
if (typeof maxTagTextLength === 'number') {
|
||||
displayValues = displayValues.map(function (_ref2) {
|
||||
var label = _ref2.label,
|
||||
rest = _objectWithoutProperties(_ref2, ["label"]);
|
||||
|
||||
var displayLabel = label;
|
||||
|
||||
if (typeof label === 'string' || typeof label === 'number') {
|
||||
var strLabel = String(displayLabel);
|
||||
|
||||
if (strLabel.length > maxTagTextLength) {
|
||||
displayLabel = "".concat(strLabel.slice(0, maxTagTextLength), "...");
|
||||
}
|
||||
}
|
||||
|
||||
return _objectSpread({}, rest, {
|
||||
label: displayLabel
|
||||
});
|
||||
});
|
||||
} // Fill rest
|
||||
|
||||
|
||||
if (restCount > 0) {
|
||||
displayValues.push({
|
||||
key: REST_TAG_KEY,
|
||||
label: typeof maxTagPlaceholder === 'function' ? maxTagPlaceholder(values.slice(maxTagCount)) : maxTagPlaceholder
|
||||
});
|
||||
}
|
||||
|
||||
var selectionNode = React.createElement(CSSMotionList, {
|
||||
component: false,
|
||||
keys: displayValues,
|
||||
motionName: choiceTransitionName,
|
||||
motionAppear: motionAppear
|
||||
}, function (_ref3) {
|
||||
var key = _ref3.key,
|
||||
label = _ref3.label,
|
||||
value = _ref3.value,
|
||||
itemDisabled = _ref3.disabled,
|
||||
className = _ref3.className,
|
||||
style = _ref3.style;
|
||||
var mergedKey = key || value;
|
||||
var closable = key !== REST_TAG_KEY && !itemDisabled;
|
||||
|
||||
var onMouseDown = function onMouseDown(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
};
|
||||
|
||||
var onClose = function onClose(event) {
|
||||
if (event) event.stopPropagation();
|
||||
onSelect(value, {
|
||||
selected: false
|
||||
});
|
||||
};
|
||||
|
||||
return typeof tagRender === 'function' ? React.createElement("span", {
|
||||
key: mergedKey,
|
||||
onMouseDown: onMouseDown,
|
||||
className: className,
|
||||
style: style
|
||||
}, tagRender({
|
||||
label: label,
|
||||
value: value,
|
||||
disabled: itemDisabled,
|
||||
closable: closable,
|
||||
onClose: onClose
|
||||
})) : React.createElement("span", {
|
||||
key: mergedKey,
|
||||
className: classNames(className, "".concat(prefixCls, "-selection-item"), _defineProperty({}, "".concat(prefixCls, "-selection-item-disabled"), itemDisabled)),
|
||||
style: style
|
||||
}, React.createElement("span", {
|
||||
className: "".concat(prefixCls, "-selection-item-content")
|
||||
}, label), closable && React.createElement(TransBtn, {
|
||||
className: "".concat(prefixCls, "-selection-item-remove"),
|
||||
onMouseDown: onMouseDown,
|
||||
onClick: onClose,
|
||||
customizeIcon: removeIcon
|
||||
}, "\xD7"));
|
||||
});
|
||||
return React.createElement(React.Fragment, null, selectionNode, React.createElement("span", {
|
||||
className: "".concat(prefixCls, "-selection-search"),
|
||||
style: {
|
||||
width: inputWidth
|
||||
}
|
||||
}, React.createElement(Input, {
|
||||
ref: inputRef,
|
||||
open: open,
|
||||
prefixCls: prefixCls,
|
||||
id: id,
|
||||
inputElement: null,
|
||||
disabled: disabled,
|
||||
autoFocus: autoFocus,
|
||||
autoComplete: autoComplete,
|
||||
editable: inputEditable,
|
||||
accessibilityIndex: accessibilityIndex,
|
||||
value: inputValue,
|
||||
onKeyDown: onInputKeyDown,
|
||||
onMouseDown: onInputMouseDown,
|
||||
onChange: onInputChange,
|
||||
onPaste: onInputPaste,
|
||||
tabIndex: tabIndex
|
||||
}), React.createElement("span", {
|
||||
ref: measureRef,
|
||||
className: "".concat(prefixCls, "-selection-search-mirror"),
|
||||
"aria-hidden": true
|
||||
}, inputValue, "\xA0")), !values.length && !inputValue && React.createElement("span", {
|
||||
className: "".concat(prefixCls, "-selection-placeholder")
|
||||
}, placeholder));
|
||||
};
|
||||
|
||||
export default SelectSelector;
|
||||
9
web/node_modules/rc-select/es/Selector/SingleSelector.d.ts
generated
vendored
Normal file
9
web/node_modules/rc-select/es/Selector/SingleSelector.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import React from 'react';
|
||||
import { InnerSelectorProps } from '.';
|
||||
interface SelectorProps extends InnerSelectorProps {
|
||||
inputElement: React.ReactElement;
|
||||
activeValue: string;
|
||||
backfill?: boolean;
|
||||
}
|
||||
declare const SingleSelector: React.FC<SelectorProps>;
|
||||
export default SingleSelector;
|
||||
67
web/node_modules/rc-select/es/Selector/SingleSelector.js
generated
vendored
Normal file
67
web/node_modules/rc-select/es/Selector/SingleSelector.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
import React from 'react';
|
||||
import Input from './Input';
|
||||
|
||||
var SingleSelector = function SingleSelector(_ref) {
|
||||
var inputElement = _ref.inputElement,
|
||||
prefixCls = _ref.prefixCls,
|
||||
id = _ref.id,
|
||||
inputRef = _ref.inputRef,
|
||||
disabled = _ref.disabled,
|
||||
autoFocus = _ref.autoFocus,
|
||||
autoComplete = _ref.autoComplete,
|
||||
accessibilityIndex = _ref.accessibilityIndex,
|
||||
mode = _ref.mode,
|
||||
open = _ref.open,
|
||||
values = _ref.values,
|
||||
placeholder = _ref.placeholder,
|
||||
tabIndex = _ref.tabIndex,
|
||||
showSearch = _ref.showSearch,
|
||||
searchValue = _ref.searchValue,
|
||||
activeValue = _ref.activeValue,
|
||||
onInputKeyDown = _ref.onInputKeyDown,
|
||||
onInputMouseDown = _ref.onInputMouseDown,
|
||||
onInputChange = _ref.onInputChange,
|
||||
onInputPaste = _ref.onInputPaste;
|
||||
var combobox = mode === 'combobox';
|
||||
var inputEditable = combobox || showSearch && open;
|
||||
var item = values[0];
|
||||
|
||||
var getDisplayValue = function getDisplayValue(value) {
|
||||
return value === null ? '' : String(value);
|
||||
};
|
||||
|
||||
var inputValue = searchValue;
|
||||
|
||||
if (combobox) {
|
||||
inputValue = item ? getDisplayValue(item.value) : activeValue || searchValue;
|
||||
} // Not show text when closed expect combobox mode
|
||||
|
||||
|
||||
var hasTextInput = mode !== 'combobox' && !open ? false : !!inputValue;
|
||||
return React.createElement(React.Fragment, null, React.createElement("span", {
|
||||
className: "".concat(prefixCls, "-selection-search")
|
||||
}, React.createElement(Input, {
|
||||
ref: inputRef,
|
||||
prefixCls: prefixCls,
|
||||
id: id,
|
||||
open: open,
|
||||
inputElement: inputElement,
|
||||
disabled: disabled,
|
||||
autoFocus: autoFocus,
|
||||
autoComplete: autoComplete,
|
||||
editable: inputEditable,
|
||||
accessibilityIndex: accessibilityIndex,
|
||||
value: inputValue,
|
||||
onKeyDown: onInputKeyDown,
|
||||
onMouseDown: onInputMouseDown,
|
||||
onChange: onInputChange,
|
||||
onPaste: onInputPaste,
|
||||
tabIndex: tabIndex
|
||||
})), !combobox && item && !hasTextInput && React.createElement("span", {
|
||||
className: "".concat(prefixCls, "-selection-item")
|
||||
}, item.label), !item && !hasTextInput && React.createElement("span", {
|
||||
className: "".concat(prefixCls, "-selection-placeholder")
|
||||
}, placeholder));
|
||||
};
|
||||
|
||||
export default SingleSelector;
|
||||
74
web/node_modules/rc-select/es/Selector/index.d.ts
generated
vendored
Normal file
74
web/node_modules/rc-select/es/Selector/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* Cursor rule:
|
||||
* 1. Only `showSearch` enabled
|
||||
* 2. Only `open` is `true`
|
||||
* 3. When typing, set `open` to `true` which hit rule of 2
|
||||
*
|
||||
* Accessibility:
|
||||
* - https://www.w3.org/TR/wai-aria-practices/examples/combobox/aria1.1pattern/listbox-combo.html
|
||||
*/
|
||||
import * as React from 'react';
|
||||
import { LabelValueType, RawValueType, CustomTagProps } from '../interface/generator';
|
||||
import { RenderNode, Mode } from '../interface';
|
||||
export interface InnerSelectorProps {
|
||||
prefixCls: string;
|
||||
id: string;
|
||||
mode: Mode;
|
||||
inputRef: React.Ref<HTMLInputElement | HTMLTextAreaElement>;
|
||||
placeholder?: React.ReactNode;
|
||||
disabled?: boolean;
|
||||
autoFocus?: boolean;
|
||||
autoComplete?: string;
|
||||
values: LabelValueType[];
|
||||
showSearch?: boolean;
|
||||
searchValue: string;
|
||||
accessibilityIndex: number;
|
||||
open: boolean;
|
||||
tabIndex?: number;
|
||||
onInputKeyDown: React.KeyboardEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
||||
onInputMouseDown: React.MouseEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
||||
onInputChange: React.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
||||
onInputPaste: React.ClipboardEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
||||
}
|
||||
export interface RefSelectorProps {
|
||||
focus: () => void;
|
||||
blur: () => void;
|
||||
}
|
||||
export interface SelectorProps {
|
||||
id: string;
|
||||
prefixCls: string;
|
||||
showSearch?: boolean;
|
||||
open: boolean;
|
||||
/** Display in the Selector value, it's not same as `value` prop */
|
||||
values: LabelValueType[];
|
||||
multiple: boolean;
|
||||
mode: Mode;
|
||||
searchValue: string;
|
||||
activeValue: string;
|
||||
inputElement: JSX.Element;
|
||||
autoFocus?: boolean;
|
||||
accessibilityIndex: number;
|
||||
tabIndex?: number;
|
||||
disabled?: boolean;
|
||||
placeholder?: React.ReactNode;
|
||||
removeIcon?: RenderNode;
|
||||
maxTagCount?: number;
|
||||
maxTagTextLength?: number;
|
||||
maxTagPlaceholder?: React.ReactNode | ((omittedValues: LabelValueType[]) => React.ReactNode);
|
||||
tagRender?: (props: CustomTagProps) => React.ReactElement;
|
||||
choiceTransitionName?: string;
|
||||
onToggleOpen: (open?: boolean) => void;
|
||||
/** `onSearch` returns go next step boolean to check if need do toggle open */
|
||||
onSearch: (searchValue: string) => boolean;
|
||||
onSelect: (value: RawValueType, option: {
|
||||
selected: boolean;
|
||||
}) => void;
|
||||
onInputKeyDown?: React.KeyboardEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
||||
/**
|
||||
* @private get real dom for trigger align.
|
||||
* This may be removed after React provides replacement of `findDOMNode`
|
||||
*/
|
||||
domRef: React.Ref<HTMLDivElement>;
|
||||
}
|
||||
declare const ForwardSelector: React.ForwardRefExoticComponent<SelectorProps & React.RefAttributes<RefSelectorProps>>;
|
||||
export default ForwardSelector;
|
||||
157
web/node_modules/rc-select/es/Selector/index.js
generated
vendored
Normal file
157
web/node_modules/rc-select/es/Selector/index.js
generated
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
/**
|
||||
* Cursor rule:
|
||||
* 1. Only `showSearch` enabled
|
||||
* 2. Only `open` is `true`
|
||||
* 3. When typing, set `open` to `true` which hit rule of 2
|
||||
*
|
||||
* Accessibility:
|
||||
* - https://www.w3.org/TR/wai-aria-practices/examples/combobox/aria1.1pattern/listbox-combo.html
|
||||
*/
|
||||
import * as React from 'react';
|
||||
import KeyCode from "rc-util/es/KeyCode";
|
||||
import MultipleSelector from './MultipleSelector';
|
||||
import SingleSelector from './SingleSelector';
|
||||
import useLock from '../hooks/useLock';
|
||||
|
||||
var Selector = function Selector(props, ref) {
|
||||
var inputRef = React.useRef(null);
|
||||
var prefixCls = props.prefixCls,
|
||||
multiple = props.multiple,
|
||||
open = props.open,
|
||||
mode = props.mode,
|
||||
showSearch = props.showSearch,
|
||||
onSearch = props.onSearch,
|
||||
onToggleOpen = props.onToggleOpen,
|
||||
onInputKeyDown = props.onInputKeyDown,
|
||||
domRef = props.domRef; // ======================= Ref =======================
|
||||
|
||||
React.useImperativeHandle(ref, function () {
|
||||
return {
|
||||
focus: function focus() {
|
||||
inputRef.current.focus();
|
||||
},
|
||||
blur: function blur() {
|
||||
inputRef.current.blur();
|
||||
}
|
||||
};
|
||||
}); // ====================== Input ======================
|
||||
|
||||
var _useLock = useLock(0),
|
||||
_useLock2 = _slicedToArray(_useLock, 2),
|
||||
getInputMouseDown = _useLock2[0],
|
||||
setInputMouseDown = _useLock2[1];
|
||||
|
||||
var onInternalInputKeyDown = function onInternalInputKeyDown(event) {
|
||||
var which = event.which;
|
||||
|
||||
if (which === KeyCode.UP || which === KeyCode.DOWN) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
if (onInputKeyDown) {
|
||||
onInputKeyDown(event);
|
||||
}
|
||||
|
||||
if (![KeyCode.SHIFT, KeyCode.TAB, KeyCode.BACKSPACE, KeyCode.ESC].includes(which)) {
|
||||
onToggleOpen(true);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* We can not use `findDOMNode` sine it will get warning,
|
||||
* have to use timer to check if is input element.
|
||||
*/
|
||||
|
||||
|
||||
var onInternalInputMouseDown = function onInternalInputMouseDown() {
|
||||
setInputMouseDown(true);
|
||||
}; // When paste come, ignore next onChange
|
||||
|
||||
|
||||
var pasteClearRef = React.useRef(false);
|
||||
|
||||
var triggerOnSearch = function triggerOnSearch(value) {
|
||||
if (onSearch(value) !== false) {
|
||||
onToggleOpen(true);
|
||||
}
|
||||
};
|
||||
|
||||
var onInputChange = function onInputChange(_ref) {
|
||||
var value = _ref.target.value;
|
||||
|
||||
if (pasteClearRef.current) {
|
||||
pasteClearRef.current = false;
|
||||
return;
|
||||
}
|
||||
|
||||
triggerOnSearch(value);
|
||||
};
|
||||
|
||||
var onInputPaste = function onInputPaste(e) {
|
||||
var clipboardData = e.clipboardData;
|
||||
var value = clipboardData.getData('text'); // Block next onChange
|
||||
|
||||
pasteClearRef.current = true;
|
||||
setTimeout(function () {
|
||||
pasteClearRef.current = false;
|
||||
});
|
||||
triggerOnSearch(value);
|
||||
}; // ====================== Focus ======================
|
||||
// Should focus input if click the selector
|
||||
|
||||
|
||||
var onClick = function onClick(_ref2) {
|
||||
var target = _ref2.target;
|
||||
|
||||
if (target !== inputRef.current) {
|
||||
inputRef.current.focus();
|
||||
}
|
||||
};
|
||||
|
||||
var onMouseDown = function onMouseDown(event) {
|
||||
var inputMouseDown = getInputMouseDown();
|
||||
|
||||
if (event.target !== inputRef.current && !inputMouseDown) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
if (mode !== 'combobox' && (!showSearch || !inputMouseDown) || !open) {
|
||||
if (open) {
|
||||
onSearch('');
|
||||
}
|
||||
|
||||
onToggleOpen();
|
||||
}
|
||||
}; // ================= Inner Selector ==================
|
||||
|
||||
|
||||
var sharedProps = {
|
||||
inputRef: inputRef,
|
||||
onInputKeyDown: onInternalInputKeyDown,
|
||||
onInputMouseDown: onInternalInputMouseDown,
|
||||
onInputChange: onInputChange,
|
||||
onInputPaste: onInputPaste
|
||||
};
|
||||
var selectNode = multiple ? React.createElement(MultipleSelector, Object.assign({}, props, sharedProps)) : React.createElement(SingleSelector, Object.assign({}, props, sharedProps));
|
||||
return React.createElement("div", {
|
||||
ref: domRef,
|
||||
className: "".concat(prefixCls, "-selector"),
|
||||
onClick: onClick,
|
||||
onMouseDown: onMouseDown
|
||||
}, selectNode);
|
||||
};
|
||||
|
||||
var ForwardSelector = React.forwardRef(Selector);
|
||||
ForwardSelector.displayName = 'Selector';
|
||||
export default ForwardSelector;
|
||||
12
web/node_modules/rc-select/es/TransBtn.d.ts
generated
vendored
Normal file
12
web/node_modules/rc-select/es/TransBtn.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import * as React from 'react';
|
||||
import { RenderNode } from './interface';
|
||||
export interface TransBtnProps {
|
||||
className: string;
|
||||
customizeIcon: RenderNode;
|
||||
customizeIconProps?: any;
|
||||
onMouseDown?: React.MouseEventHandler<HTMLSpanElement>;
|
||||
onClick?: React.MouseEventHandler<HTMLSpanElement>;
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
declare const TransBtn: React.FC<TransBtnProps>;
|
||||
export default TransBtn;
|
||||
42
web/node_modules/rc-select/es/TransBtn.js
generated
vendored
Normal file
42
web/node_modules/rc-select/es/TransBtn.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
|
||||
var TransBtn = function TransBtn(_ref) {
|
||||
var className = _ref.className,
|
||||
customizeIcon = _ref.customizeIcon,
|
||||
customizeIconProps = _ref.customizeIconProps,
|
||||
_onMouseDown = _ref.onMouseDown,
|
||||
onClick = _ref.onClick,
|
||||
children = _ref.children;
|
||||
var icon;
|
||||
|
||||
if (typeof customizeIcon === 'function') {
|
||||
icon = customizeIcon(customizeIconProps);
|
||||
} else {
|
||||
icon = customizeIcon;
|
||||
}
|
||||
|
||||
return React.createElement("span", {
|
||||
className: className,
|
||||
onMouseDown: function onMouseDown(event) {
|
||||
event.preventDefault();
|
||||
|
||||
if (_onMouseDown) {
|
||||
_onMouseDown(event);
|
||||
}
|
||||
},
|
||||
style: {
|
||||
userSelect: 'none',
|
||||
WebkitUserSelect: 'none'
|
||||
},
|
||||
unselectable: "on",
|
||||
onClick: onClick,
|
||||
"aria-hidden": true
|
||||
}, icon !== undefined ? icon : React.createElement("span", {
|
||||
className: classNames(className.split(/\s+/).map(function (cls) {
|
||||
return "".concat(cls, "-icon");
|
||||
}))
|
||||
}, children));
|
||||
};
|
||||
|
||||
export default TransBtn;
|
||||
134
web/node_modules/rc-select/es/generate.d.ts
generated
vendored
Normal file
134
web/node_modules/rc-select/es/generate.d.ts
generated
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
/**
|
||||
* To match accessibility requirement, we always provide an input in the component.
|
||||
* Other element will not set `tabIndex` to avoid `onBlur` sequence problem.
|
||||
* For focused select, we set `aria-live="polite"` to update the accessibility content.
|
||||
*
|
||||
* ref:
|
||||
* - keyboard: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role#Keyboard_interactions
|
||||
*/
|
||||
import * as React from 'react';
|
||||
import { RenderNode, Mode, RenderDOMFunc } from './interface';
|
||||
import { GetLabeledValue, FilterOptions, FilterFunc, DefaultValueType, RawValueType, LabelValueType, Key, FlattenOptionsType, SingleType, OnClear, SelectSource, CustomTagProps } from './interface/generator';
|
||||
import { OptionListProps, RefOptionListProps } from './OptionList';
|
||||
export interface RefSelectProps {
|
||||
focus: () => void;
|
||||
blur: () => void;
|
||||
}
|
||||
export interface SelectProps<OptionsType extends object[], ValueType> extends React.AriaAttributes {
|
||||
prefixCls?: string;
|
||||
id?: string;
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
options?: OptionsType;
|
||||
children?: React.ReactNode;
|
||||
mode?: Mode;
|
||||
value?: ValueType;
|
||||
defaultValue?: ValueType;
|
||||
labelInValue?: boolean;
|
||||
inputValue?: string;
|
||||
searchValue?: string;
|
||||
optionFilterProp?: string;
|
||||
/**
|
||||
* In Select, `false` means do nothing.
|
||||
* In TreeSelect, `false` will highlight match item.
|
||||
* It's by design.
|
||||
*/
|
||||
filterOption?: boolean | FilterFunc<OptionsType[number]>;
|
||||
showSearch?: boolean;
|
||||
autoClearSearchValue?: boolean;
|
||||
onSearch?: (value: string) => void;
|
||||
allowClear?: boolean;
|
||||
clearIcon?: React.ReactNode;
|
||||
showArrow?: boolean;
|
||||
inputIcon?: RenderNode;
|
||||
removeIcon?: React.ReactNode;
|
||||
menuItemSelectedIcon?: RenderNode;
|
||||
open?: boolean;
|
||||
defaultOpen?: boolean;
|
||||
listHeight?: number;
|
||||
listItemHeight?: number;
|
||||
dropdownStyle?: React.CSSProperties;
|
||||
dropdownClassName?: string;
|
||||
dropdownMatchSelectWidth?: boolean | number;
|
||||
virtual?: boolean;
|
||||
dropdownRender?: (menu: React.ReactElement) => React.ReactElement;
|
||||
dropdownAlign?: any;
|
||||
animation?: string;
|
||||
transitionName?: string;
|
||||
getPopupContainer?: RenderDOMFunc;
|
||||
direction?: string;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
autoFocus?: boolean;
|
||||
defaultActiveFirstOption?: boolean;
|
||||
notFoundContent?: React.ReactNode;
|
||||
placeholder?: React.ReactNode;
|
||||
backfill?: boolean;
|
||||
getInputElement?: () => JSX.Element;
|
||||
optionLabelProp?: string;
|
||||
maxTagTextLength?: number;
|
||||
maxTagCount?: number;
|
||||
maxTagPlaceholder?: React.ReactNode | ((omittedValues: LabelValueType[]) => React.ReactNode);
|
||||
tokenSeparators?: string[];
|
||||
tagRender?: (props: CustomTagProps) => React.ReactElement;
|
||||
showAction?: ('focus' | 'click')[];
|
||||
tabIndex?: number;
|
||||
onKeyUp?: React.KeyboardEventHandler<HTMLDivElement>;
|
||||
onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
|
||||
onPopupScroll?: React.UIEventHandler<HTMLDivElement>;
|
||||
onDropdownVisibleChange?: (open: boolean) => void;
|
||||
onSelect?: (value: SingleType<ValueType>, option: OptionsType[number]) => void;
|
||||
onDeselect?: (value: SingleType<ValueType>, option: OptionsType[number]) => void;
|
||||
onInputKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
||||
onClick?: React.MouseEventHandler;
|
||||
onChange?: (value: ValueType, option: OptionsType[number] | OptionsType) => void;
|
||||
onBlur?: React.FocusEventHandler<HTMLElement>;
|
||||
onFocus?: React.FocusEventHandler<HTMLElement>;
|
||||
onMouseDown?: React.MouseEventHandler<HTMLDivElement>;
|
||||
onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
|
||||
onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
|
||||
choiceTransitionName?: string;
|
||||
/**
|
||||
* Only used in current version for internal event process.
|
||||
* Do not use in production environment.
|
||||
*/
|
||||
internalProps?: {
|
||||
mark?: string;
|
||||
onClear?: OnClear;
|
||||
skipTriggerChange?: boolean;
|
||||
skipTriggerSelect?: boolean;
|
||||
onRawSelect?: (value: RawValueType, option: OptionsType[number], source: SelectSource) => void;
|
||||
onRawDeselect?: (value: RawValueType, option: OptionsType[number], source: SelectSource) => void;
|
||||
};
|
||||
}
|
||||
export interface GenerateConfig<OptionsType extends object[]> {
|
||||
prefixCls: string;
|
||||
components: {
|
||||
optionList: React.ForwardRefExoticComponent<React.PropsWithoutRef<Omit<OptionListProps<OptionsType>, 'options'> & {
|
||||
options: OptionsType;
|
||||
}> & React.RefAttributes<RefOptionListProps>>;
|
||||
};
|
||||
/** Convert jsx tree into `OptionsType` */
|
||||
convertChildrenToData: (children: React.ReactNode) => OptionsType;
|
||||
/** Flatten nest options into raw option list */
|
||||
flattenOptions: (options: OptionsType, props: any) => FlattenOptionsType<OptionsType>;
|
||||
/** Convert single raw value into { label, value } format. Will be called by each value */
|
||||
getLabeledValue: GetLabeledValue<FlattenOptionsType<OptionsType>>;
|
||||
filterOptions: FilterOptions<OptionsType>;
|
||||
findValueOption: (values: RawValueType[], options: FlattenOptionsType<OptionsType>) => OptionsType;
|
||||
/** Check if a value is disabled */
|
||||
isValueDisabled: (value: RawValueType, options: FlattenOptionsType<OptionsType>) => boolean;
|
||||
warningProps?: (props: any) => void;
|
||||
fillOptionsWithMissingValue?: (options: OptionsType, value: DefaultValueType, optionLabelProp: string, labelInValue: boolean) => OptionsType;
|
||||
omitDOMProps?: (props: object) => object;
|
||||
}
|
||||
/**
|
||||
* This function is in internal usage.
|
||||
* Do not use it in your prod env since we may refactor this.
|
||||
*/
|
||||
export default function generateSelector<OptionsType extends {
|
||||
value?: RawValueType;
|
||||
label?: React.ReactNode;
|
||||
key?: Key;
|
||||
disabled?: boolean;
|
||||
}[]>(config: GenerateConfig<OptionsType>): React.ForwardRefExoticComponent<SelectProps<OptionsType, DefaultValueType> & React.RefAttributes<RefSelectProps>>;
|
||||
820
web/node_modules/rc-select/es/generate.js
generated
vendored
Normal file
820
web/node_modules/rc-select/es/generate.js
generated
vendored
Normal file
@@ -0,0 +1,820 @@
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
||||
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
|
||||
/**
|
||||
* To match accessibility requirement, we always provide an input in the component.
|
||||
* Other element will not set `tabIndex` to avoid `onBlur` sequence problem.
|
||||
* For focused select, we set `aria-live="polite"` to update the accessibility content.
|
||||
*
|
||||
* ref:
|
||||
* - keyboard: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role#Keyboard_interactions
|
||||
*/
|
||||
import * as React from 'react';
|
||||
import KeyCode from "rc-util/es/KeyCode";
|
||||
import classNames from 'classnames';
|
||||
import useMergedState from "rc-util/es/hooks/useMergedState";
|
||||
import Selector from './Selector';
|
||||
import SelectTrigger from './SelectTrigger';
|
||||
import { INTERNAL_PROPS_MARK } from './interface/generator';
|
||||
import { toInnerValue, toOuterValues, removeLastEnabledValue, getUUID } from './utils/commonUtil';
|
||||
import TransBtn from './TransBtn';
|
||||
import useLock from './hooks/useLock';
|
||||
import useDelayReset from './hooks/useDelayReset';
|
||||
import useLayoutEffect from './hooks/useLayoutEffect';
|
||||
import { getSeparatedContent } from './utils/valueUtil';
|
||||
import useSelectTriggerControl from './hooks/useSelectTriggerControl';
|
||||
var DEFAULT_OMIT_PROPS = ['removeIcon', 'placeholder', 'autoFocus', 'maxTagCount', 'maxTagTextLength', 'maxTagPlaceholder', 'choiceTransitionName', 'onInputKeyDown'];
|
||||
/**
|
||||
* This function is in internal usage.
|
||||
* Do not use it in your prod env since we may refactor this.
|
||||
*/
|
||||
|
||||
export default function generateSelector(config) {
|
||||
var defaultPrefixCls = config.prefixCls,
|
||||
OptionList = config.components.optionList,
|
||||
convertChildrenToData = config.convertChildrenToData,
|
||||
flattenOptions = config.flattenOptions,
|
||||
getLabeledValue = config.getLabeledValue,
|
||||
filterOptions = config.filterOptions,
|
||||
isValueDisabled = config.isValueDisabled,
|
||||
findValueOption = config.findValueOption,
|
||||
warningProps = config.warningProps,
|
||||
fillOptionsWithMissingValue = config.fillOptionsWithMissingValue,
|
||||
omitDOMProps = config.omitDOMProps; // Use raw define since `React.FC` not support generic
|
||||
|
||||
function Select(props, ref) {
|
||||
var _classNames2;
|
||||
|
||||
var _props$prefixCls = props.prefixCls,
|
||||
prefixCls = _props$prefixCls === void 0 ? defaultPrefixCls : _props$prefixCls,
|
||||
className = props.className,
|
||||
id = props.id,
|
||||
open = props.open,
|
||||
defaultOpen = props.defaultOpen,
|
||||
options = props.options,
|
||||
children = props.children,
|
||||
mode = props.mode,
|
||||
value = props.value,
|
||||
defaultValue = props.defaultValue,
|
||||
labelInValue = props.labelInValue,
|
||||
showSearch = props.showSearch,
|
||||
inputValue = props.inputValue,
|
||||
searchValue = props.searchValue,
|
||||
filterOption = props.filterOption,
|
||||
_props$optionFilterPr = props.optionFilterProp,
|
||||
optionFilterProp = _props$optionFilterPr === void 0 ? 'value' : _props$optionFilterPr,
|
||||
_props$autoClearSearc = props.autoClearSearchValue,
|
||||
autoClearSearchValue = _props$autoClearSearc === void 0 ? true : _props$autoClearSearc,
|
||||
onSearch = props.onSearch,
|
||||
allowClear = props.allowClear,
|
||||
clearIcon = props.clearIcon,
|
||||
showArrow = props.showArrow,
|
||||
inputIcon = props.inputIcon,
|
||||
menuItemSelectedIcon = props.menuItemSelectedIcon,
|
||||
disabled = props.disabled,
|
||||
loading = props.loading,
|
||||
defaultActiveFirstOption = props.defaultActiveFirstOption,
|
||||
_props$notFoundConten = props.notFoundContent,
|
||||
notFoundContent = _props$notFoundConten === void 0 ? 'Not Found' : _props$notFoundConten,
|
||||
optionLabelProp = props.optionLabelProp,
|
||||
backfill = props.backfill,
|
||||
getInputElement = props.getInputElement,
|
||||
getPopupContainer = props.getPopupContainer,
|
||||
_props$listHeight = props.listHeight,
|
||||
listHeight = _props$listHeight === void 0 ? 200 : _props$listHeight,
|
||||
_props$listItemHeight = props.listItemHeight,
|
||||
listItemHeight = _props$listItemHeight === void 0 ? 20 : _props$listItemHeight,
|
||||
animation = props.animation,
|
||||
transitionName = props.transitionName,
|
||||
virtual = props.virtual,
|
||||
dropdownStyle = props.dropdownStyle,
|
||||
dropdownClassName = props.dropdownClassName,
|
||||
dropdownMatchSelectWidth = props.dropdownMatchSelectWidth,
|
||||
dropdownRender = props.dropdownRender,
|
||||
dropdownAlign = props.dropdownAlign,
|
||||
_props$showAction = props.showAction,
|
||||
showAction = _props$showAction === void 0 ? [] : _props$showAction,
|
||||
direction = props.direction,
|
||||
tokenSeparators = props.tokenSeparators,
|
||||
tagRender = props.tagRender,
|
||||
onPopupScroll = props.onPopupScroll,
|
||||
onDropdownVisibleChange = props.onDropdownVisibleChange,
|
||||
onFocus = props.onFocus,
|
||||
onBlur = props.onBlur,
|
||||
onKeyUp = props.onKeyUp,
|
||||
onKeyDown = props.onKeyDown,
|
||||
onMouseDown = props.onMouseDown,
|
||||
onChange = props.onChange,
|
||||
onSelect = props.onSelect,
|
||||
onDeselect = props.onDeselect,
|
||||
_props$internalProps = props.internalProps,
|
||||
internalProps = _props$internalProps === void 0 ? {} : _props$internalProps,
|
||||
restProps = _objectWithoutProperties(props, ["prefixCls", "className", "id", "open", "defaultOpen", "options", "children", "mode", "value", "defaultValue", "labelInValue", "showSearch", "inputValue", "searchValue", "filterOption", "optionFilterProp", "autoClearSearchValue", "onSearch", "allowClear", "clearIcon", "showArrow", "inputIcon", "menuItemSelectedIcon", "disabled", "loading", "defaultActiveFirstOption", "notFoundContent", "optionLabelProp", "backfill", "getInputElement", "getPopupContainer", "listHeight", "listItemHeight", "animation", "transitionName", "virtual", "dropdownStyle", "dropdownClassName", "dropdownMatchSelectWidth", "dropdownRender", "dropdownAlign", "showAction", "direction", "tokenSeparators", "tagRender", "onPopupScroll", "onDropdownVisibleChange", "onFocus", "onBlur", "onKeyUp", "onKeyDown", "onMouseDown", "onChange", "onSelect", "onDeselect", "internalProps"]);
|
||||
|
||||
var useInternalProps = internalProps.mark === INTERNAL_PROPS_MARK;
|
||||
var domProps = omitDOMProps ? omitDOMProps(restProps) : restProps;
|
||||
DEFAULT_OMIT_PROPS.forEach(function (prop) {
|
||||
delete domProps[prop];
|
||||
});
|
||||
var containerRef = React.useRef(null);
|
||||
var triggerRef = React.useRef(null);
|
||||
var selectorRef = React.useRef(null);
|
||||
var listRef = React.useRef(null);
|
||||
/** Used for component focused management */
|
||||
|
||||
var _useDelayReset = useDelayReset(),
|
||||
_useDelayReset2 = _slicedToArray(_useDelayReset, 3),
|
||||
mockFocused = _useDelayReset2[0],
|
||||
setMockFocused = _useDelayReset2[1],
|
||||
cancelSetMockFocused = _useDelayReset2[2]; // Inner id for accessibility usage. Only work in client side
|
||||
|
||||
|
||||
var _React$useState = React.useState(),
|
||||
_React$useState2 = _slicedToArray(_React$useState, 2),
|
||||
innerId = _React$useState2[0],
|
||||
setInnerId = _React$useState2[1];
|
||||
|
||||
React.useEffect(function () {
|
||||
setInnerId("rc_select_".concat(getUUID()));
|
||||
}, []);
|
||||
var mergedId = id || innerId; // optionLabelProp
|
||||
|
||||
var mergedOptionLabelProp = optionLabelProp;
|
||||
|
||||
if (mergedOptionLabelProp === undefined) {
|
||||
mergedOptionLabelProp = options ? 'label' : 'children';
|
||||
} // labelInValue
|
||||
|
||||
|
||||
var mergedLabelInValue = mode === 'combobox' ? false : labelInValue;
|
||||
var isMultiple = mode === 'tags' || mode === 'multiple';
|
||||
var mergedShowSearch = showSearch !== undefined ? showSearch : isMultiple || mode === 'combobox'; // ============================== Ref ===============================
|
||||
|
||||
var selectorDomRef = React.useRef(null);
|
||||
React.useImperativeHandle(ref, function () {
|
||||
return {
|
||||
focus: selectorRef.current.focus,
|
||||
blur: selectorRef.current.blur
|
||||
};
|
||||
}); // ============================= Value ==============================
|
||||
|
||||
var _React$useState3 = React.useState(value || defaultValue),
|
||||
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
||||
innerValue = _React$useState4[0],
|
||||
setInnerValue = _React$useState4[1];
|
||||
|
||||
var baseValue = value !== undefined ? value : innerValue; // Should reset when controlled to be uncontrolled
|
||||
|
||||
var prevValueRef = React.useRef(value);
|
||||
React.useEffect(function () {
|
||||
if (prevValueRef.current !== value && (value === undefined || value === null)) {
|
||||
setInnerValue(undefined);
|
||||
}
|
||||
|
||||
prevValueRef.current = value;
|
||||
}, [value]);
|
||||
/** Unique raw values */
|
||||
|
||||
var mergedRawValue = React.useMemo(function () {
|
||||
return toInnerValue(baseValue, {
|
||||
labelInValue: mergedLabelInValue,
|
||||
combobox: mode === 'combobox'
|
||||
});
|
||||
}, [baseValue, mergedLabelInValue]);
|
||||
/** We cache a set of raw values to speed up check */
|
||||
|
||||
var rawValues = React.useMemo(function () {
|
||||
return new Set(mergedRawValue);
|
||||
}, [mergedRawValue]); // ============================= Option =============================
|
||||
// Set by option list active, it will merge into search input when mode is `combobox`
|
||||
|
||||
var _React$useState5 = React.useState(null),
|
||||
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
||||
activeValue = _React$useState6[0],
|
||||
setActiveValue = _React$useState6[1];
|
||||
|
||||
var _React$useState7 = React.useState(''),
|
||||
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
||||
innerSearchValue = _React$useState8[0],
|
||||
setInnerSearchValue = _React$useState8[1];
|
||||
|
||||
var mergedSearchValue = innerSearchValue;
|
||||
|
||||
if (mode === 'combobox' && value !== undefined) {
|
||||
mergedSearchValue = value;
|
||||
} else if (searchValue !== undefined) {
|
||||
mergedSearchValue = searchValue;
|
||||
} else if (inputValue) {
|
||||
mergedSearchValue = inputValue;
|
||||
}
|
||||
|
||||
var mergedOptions = React.useMemo(function () {
|
||||
var newOptions = options;
|
||||
|
||||
if (newOptions === undefined) {
|
||||
newOptions = convertChildrenToData(children);
|
||||
}
|
||||
/**
|
||||
* `tags` should fill un-list item.
|
||||
* This is not cool here since TreeSelect do not need this
|
||||
*/
|
||||
|
||||
|
||||
if (mode === 'tags' && fillOptionsWithMissingValue) {
|
||||
newOptions = fillOptionsWithMissingValue(newOptions, baseValue, mergedOptionLabelProp, labelInValue);
|
||||
}
|
||||
|
||||
return newOptions || [];
|
||||
}, [options, children, mode, baseValue]);
|
||||
var mergedFlattenOptions = React.useMemo(function () {
|
||||
return flattenOptions(mergedOptions, props);
|
||||
}, [mergedOptions]); // Display options for OptionList
|
||||
|
||||
var displayOptions = React.useMemo(function () {
|
||||
if (!mergedSearchValue || !mergedShowSearch) {
|
||||
return _toConsumableArray(mergedOptions);
|
||||
}
|
||||
|
||||
var filteredOptions = filterOptions(mergedSearchValue, mergedOptions, {
|
||||
optionFilterProp: optionFilterProp,
|
||||
filterOption: mode === 'combobox' && filterOption === undefined ? function () {
|
||||
return true;
|
||||
} : filterOption
|
||||
});
|
||||
|
||||
if (mode === 'tags' && filteredOptions.every(function (opt) {
|
||||
return opt.value !== mergedSearchValue;
|
||||
})) {
|
||||
filteredOptions.unshift({
|
||||
value: mergedSearchValue,
|
||||
label: mergedSearchValue,
|
||||
key: '__RC_SELECT_TAG_PLACEHOLDER__'
|
||||
});
|
||||
}
|
||||
|
||||
return filteredOptions;
|
||||
}, [mergedOptions, mergedSearchValue, mode, mergedShowSearch]);
|
||||
var displayFlattenOptions = React.useMemo(function () {
|
||||
return flattenOptions(displayOptions, props);
|
||||
}, [displayOptions]);
|
||||
React.useEffect(function () {
|
||||
if (listRef.current && listRef.current.scrollTo) {
|
||||
listRef.current.scrollTo(0);
|
||||
}
|
||||
}, [mergedSearchValue]); // ============================ Selector ============================
|
||||
|
||||
var displayValues = React.useMemo(function () {
|
||||
return mergedRawValue.map(function (val) {
|
||||
var displayValue = getLabeledValue(val, {
|
||||
options: mergedFlattenOptions,
|
||||
prevValue: baseValue,
|
||||
labelInValue: mergedLabelInValue,
|
||||
optionLabelProp: mergedOptionLabelProp
|
||||
});
|
||||
return _objectSpread({}, displayValue, {
|
||||
disabled: isValueDisabled(val, mergedFlattenOptions)
|
||||
});
|
||||
});
|
||||
}, [baseValue, mergedOptions]);
|
||||
|
||||
var triggerSelect = function triggerSelect(newValue, isSelect, source) {
|
||||
var outOption = findValueOption([newValue], mergedFlattenOptions)[0];
|
||||
|
||||
if (!internalProps.skipTriggerSelect) {
|
||||
// Skip trigger `onSelect` or `onDeselect` if configured
|
||||
var selectValue = mergedLabelInValue ? getLabeledValue(newValue, {
|
||||
options: mergedFlattenOptions,
|
||||
prevValue: baseValue,
|
||||
labelInValue: mergedLabelInValue,
|
||||
optionLabelProp: mergedOptionLabelProp
|
||||
}) : newValue;
|
||||
|
||||
if (isSelect && onSelect) {
|
||||
onSelect(selectValue, outOption);
|
||||
} else if (!isSelect && onDeselect) {
|
||||
onDeselect(selectValue, outOption);
|
||||
}
|
||||
} // Trigger internal event
|
||||
|
||||
|
||||
if (useInternalProps) {
|
||||
if (isSelect && internalProps.onRawSelect) {
|
||||
internalProps.onRawSelect(newValue, outOption, source);
|
||||
} else if (!isSelect && internalProps.onRawDeselect) {
|
||||
internalProps.onRawDeselect(newValue, outOption, source);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var triggerChange = function triggerChange(newRawValues) {
|
||||
if (useInternalProps && internalProps.skipTriggerChange) {
|
||||
return;
|
||||
}
|
||||
|
||||
var outValues = toOuterValues(Array.from(newRawValues), {
|
||||
labelInValue: mergedLabelInValue,
|
||||
options: mergedFlattenOptions,
|
||||
getLabeledValue: getLabeledValue,
|
||||
prevValue: baseValue,
|
||||
optionLabelProp: mergedOptionLabelProp
|
||||
});
|
||||
var outValue = isMultiple ? outValues : outValues[0]; // Skip trigger if prev & current value is both empty
|
||||
|
||||
if (onChange && (mergedRawValue.length !== 0 || outValues.length !== 0)) {
|
||||
var outOptions = findValueOption(newRawValues, mergedFlattenOptions);
|
||||
onChange(outValue, isMultiple ? outOptions : outOptions[0]);
|
||||
}
|
||||
|
||||
setInnerValue(outValue);
|
||||
};
|
||||
|
||||
var onInternalSelect = function onInternalSelect(newValue, _ref) {
|
||||
var selected = _ref.selected,
|
||||
source = _ref.source;
|
||||
|
||||
if (disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
var newRawValue;
|
||||
|
||||
if (isMultiple) {
|
||||
newRawValue = new Set(mergedRawValue);
|
||||
|
||||
if (selected) {
|
||||
newRawValue.add(newValue);
|
||||
} else {
|
||||
newRawValue.delete(newValue);
|
||||
}
|
||||
} else {
|
||||
newRawValue = new Set();
|
||||
newRawValue.add(newValue);
|
||||
} // Multiple always trigger change and single should change if value changed
|
||||
|
||||
|
||||
if (isMultiple || !isMultiple && Array.from(mergedRawValue)[0] !== newValue) {
|
||||
triggerChange(Array.from(newRawValue));
|
||||
} // Trigger `onSelect`. Single mode always trigger select
|
||||
|
||||
|
||||
triggerSelect(newValue, !isMultiple || selected, source); // Clean search value if single or configured
|
||||
|
||||
if (mode === 'combobox') {
|
||||
setInnerSearchValue(String(newValue));
|
||||
setActiveValue('');
|
||||
} else if (!isMultiple || autoClearSearchValue) {
|
||||
setInnerSearchValue('');
|
||||
setActiveValue('');
|
||||
}
|
||||
};
|
||||
|
||||
var onInternalOptionSelect = function onInternalOptionSelect(newValue, info) {
|
||||
onInternalSelect(newValue, _objectSpread({}, info, {
|
||||
source: 'option'
|
||||
}));
|
||||
};
|
||||
|
||||
var onInternalSelectionSelect = function onInternalSelectionSelect(newValue, info) {
|
||||
onInternalSelect(newValue, _objectSpread({}, info, {
|
||||
source: 'selection'
|
||||
}));
|
||||
}; // ============================= Input ==============================
|
||||
// Only works in `combobox`
|
||||
|
||||
|
||||
var customizeInputElement = mode === 'combobox' && getInputElement && getInputElement() || null; // ============================== Open ==============================
|
||||
|
||||
var _useMergedState = useMergedState(undefined, {
|
||||
defaultValue: defaultOpen,
|
||||
value: open
|
||||
}),
|
||||
_useMergedState2 = _slicedToArray(_useMergedState, 2),
|
||||
innerOpen = _useMergedState2[0],
|
||||
setInnerOpen = _useMergedState2[1];
|
||||
|
||||
var mergedOpen = innerOpen; // Not trigger `open` in `combobox` when `notFoundContent` is empty
|
||||
|
||||
var emptyListContent = !notFoundContent && !displayOptions.length;
|
||||
|
||||
if (disabled || emptyListContent && mergedOpen && mode === 'combobox') {
|
||||
mergedOpen = false;
|
||||
}
|
||||
|
||||
var triggerOpen = emptyListContent ? false : mergedOpen;
|
||||
|
||||
var onToggleOpen = function onToggleOpen(newOpen) {
|
||||
var nextOpen = newOpen !== undefined ? newOpen : !mergedOpen;
|
||||
|
||||
if (innerOpen !== nextOpen && !disabled) {
|
||||
setInnerOpen(nextOpen);
|
||||
|
||||
if (onDropdownVisibleChange) {
|
||||
onDropdownVisibleChange(nextOpen);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
useSelectTriggerControl([containerRef.current, triggerRef.current && triggerRef.current.getPopupElement()], triggerOpen, onToggleOpen); // ============================= Search =============================
|
||||
|
||||
var triggerSearch = function triggerSearch(searchText) {
|
||||
var fromTyping = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
||||
var ret = true;
|
||||
var newSearchText = searchText;
|
||||
setActiveValue(null); // Check if match the `tokenSeparators`
|
||||
|
||||
var patchLabels = getSeparatedContent(searchText, tokenSeparators);
|
||||
var patchRawValues = patchLabels;
|
||||
|
||||
if (mode === 'combobox') {
|
||||
// Only typing will trigger onChange
|
||||
if (fromTyping) {
|
||||
triggerChange([newSearchText]);
|
||||
}
|
||||
} else if (patchLabels) {
|
||||
newSearchText = '';
|
||||
|
||||
if (mode !== 'tags') {
|
||||
patchRawValues = patchLabels.map(function (label) {
|
||||
var item = mergedFlattenOptions.find(function (_ref2) {
|
||||
var data = _ref2.data;
|
||||
return data[mergedOptionLabelProp] === label;
|
||||
});
|
||||
return item ? item.data.value : null;
|
||||
}).filter(function (val) {
|
||||
return val !== null;
|
||||
});
|
||||
}
|
||||
|
||||
var newRawValues = Array.from(new Set([].concat(_toConsumableArray(mergedRawValue), _toConsumableArray(patchRawValues))));
|
||||
triggerChange(newRawValues);
|
||||
newRawValues.forEach(function (newRawValue) {
|
||||
triggerSelect(newRawValue, true, 'input');
|
||||
}); // Should close when paste finish
|
||||
|
||||
onToggleOpen(false); // Tell Selector that break next actions
|
||||
|
||||
ret = false;
|
||||
}
|
||||
|
||||
setInnerSearchValue(newSearchText);
|
||||
|
||||
if (onSearch && mergedSearchValue !== newSearchText) {
|
||||
onSearch(newSearchText);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}; // Close dropdown when disabled change
|
||||
|
||||
|
||||
React.useEffect(function () {
|
||||
if (innerOpen && !!disabled) {
|
||||
setInnerOpen(false);
|
||||
}
|
||||
}, [disabled]); // Close will clean up single mode search text
|
||||
|
||||
React.useEffect(function () {
|
||||
if (!mergedOpen && !isMultiple && mode !== 'combobox') {
|
||||
triggerSearch('', false);
|
||||
}
|
||||
}, [mergedOpen]); // ============================ Keyboard ============================
|
||||
|
||||
/**
|
||||
* We record input value here to check if can press to clean up by backspace
|
||||
* - null: Key is not down, this is reset by key up
|
||||
* - true: Search text is empty when first time backspace down
|
||||
* - false: Search text is not empty when first time backspace down
|
||||
*/
|
||||
|
||||
var _useLock = useLock(),
|
||||
_useLock2 = _slicedToArray(_useLock, 2),
|
||||
getClearLock = _useLock2[0],
|
||||
setClearLock = _useLock2[1]; // KeyDown
|
||||
|
||||
|
||||
var onInternalKeyDown = function onInternalKeyDown(event) {
|
||||
var clearLock = getClearLock();
|
||||
var which = event.which; // We only manage open state here, close logic should handle by list component
|
||||
|
||||
if (!mergedOpen && which === KeyCode.ENTER) {
|
||||
onToggleOpen(true);
|
||||
}
|
||||
|
||||
setClearLock(!!mergedSearchValue); // Remove value by `backspace`
|
||||
|
||||
if (which === KeyCode.BACKSPACE && !clearLock && isMultiple && !mergedSearchValue && mergedRawValue.length) {
|
||||
var removeInfo = removeLastEnabledValue(displayValues, mergedRawValue);
|
||||
|
||||
if (removeInfo.removedValue !== null) {
|
||||
triggerChange(removeInfo.values);
|
||||
triggerSelect(removeInfo.removedValue, false, 'input');
|
||||
}
|
||||
}
|
||||
|
||||
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
rest[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
if (mergedOpen && listRef.current) {
|
||||
var _listRef$current;
|
||||
|
||||
(_listRef$current = listRef.current).onKeyDown.apply(_listRef$current, [event].concat(rest));
|
||||
}
|
||||
|
||||
if (onKeyDown) {
|
||||
onKeyDown.apply(void 0, [event].concat(rest));
|
||||
}
|
||||
}; // KeyUp
|
||||
|
||||
|
||||
var onInternalKeyUp = function onInternalKeyUp(event) {
|
||||
for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
||||
rest[_key2 - 1] = arguments[_key2];
|
||||
}
|
||||
|
||||
if (mergedOpen && listRef.current) {
|
||||
var _listRef$current2;
|
||||
|
||||
(_listRef$current2 = listRef.current).onKeyUp.apply(_listRef$current2, [event].concat(rest));
|
||||
}
|
||||
|
||||
if (onKeyUp) {
|
||||
onKeyUp.apply(void 0, [event].concat(rest));
|
||||
}
|
||||
}; // ========================== Focus / Blur ==========================
|
||||
|
||||
/** Record real focus status */
|
||||
|
||||
|
||||
var focusRef = React.useRef(false);
|
||||
|
||||
var onContainerFocus = function onContainerFocus() {
|
||||
setMockFocused(true);
|
||||
|
||||
if (!disabled) {
|
||||
if (onFocus && !focusRef.current) {
|
||||
onFocus.apply(void 0, arguments);
|
||||
} // `showAction` should handle `focus` if set
|
||||
|
||||
|
||||
if (showAction.includes('focus')) {
|
||||
onToggleOpen(true);
|
||||
}
|
||||
}
|
||||
|
||||
focusRef.current = true;
|
||||
};
|
||||
|
||||
var onContainerBlur = function onContainerBlur() {
|
||||
setMockFocused(false, function () {
|
||||
focusRef.current = false;
|
||||
onToggleOpen(false);
|
||||
});
|
||||
|
||||
if (disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mergedSearchValue) {
|
||||
// `tags` mode should move `searchValue` into values
|
||||
if (mode === 'tags') {
|
||||
triggerSearch('', false);
|
||||
triggerChange(Array.from(new Set([].concat(_toConsumableArray(mergedRawValue), [mergedSearchValue]))));
|
||||
} else if (mode === 'multiple') {
|
||||
// `multiple` mode only clean the search value but not trigger event
|
||||
setInnerSearchValue('');
|
||||
}
|
||||
}
|
||||
|
||||
if (onBlur) {
|
||||
onBlur.apply(void 0, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
var activeTimeoutIds = [];
|
||||
React.useEffect(function () {
|
||||
return function () {
|
||||
activeTimeoutIds.forEach(function (timeoutId) {
|
||||
return clearTimeout(timeoutId);
|
||||
});
|
||||
activeTimeoutIds.splice(0, activeTimeoutIds.length);
|
||||
};
|
||||
}, []);
|
||||
|
||||
var onInternalMouseDown = function onInternalMouseDown(event) {
|
||||
var target = event.target;
|
||||
var popupElement = triggerRef.current && triggerRef.current.getPopupElement(); // We should give focus back to selector if clicked item is not focusable
|
||||
|
||||
if (popupElement && popupElement.contains(target)) {
|
||||
var timeoutId = setTimeout(function () {
|
||||
var index = activeTimeoutIds.indexOf(timeoutId);
|
||||
|
||||
if (index !== -1) {
|
||||
activeTimeoutIds.splice(index, 1);
|
||||
}
|
||||
|
||||
cancelSetMockFocused();
|
||||
|
||||
if (!popupElement.contains(document.activeElement)) {
|
||||
selectorRef.current.focus();
|
||||
}
|
||||
});
|
||||
activeTimeoutIds.push(timeoutId);
|
||||
}
|
||||
|
||||
if (onMouseDown) {
|
||||
for (var _len3 = arguments.length, restArgs = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
||||
restArgs[_key3 - 1] = arguments[_key3];
|
||||
}
|
||||
|
||||
onMouseDown.apply(void 0, [event].concat(restArgs));
|
||||
}
|
||||
}; // ========================= Accessibility ==========================
|
||||
|
||||
|
||||
var _React$useState9 = React.useState(0),
|
||||
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
||||
accessibilityIndex = _React$useState10[0],
|
||||
setAccessibilityIndex = _React$useState10[1];
|
||||
|
||||
var mergedDefaultActiveFirstOption = defaultActiveFirstOption !== undefined ? defaultActiveFirstOption : mode !== 'combobox';
|
||||
|
||||
var onActiveValue = function onActiveValue(active, index) {
|
||||
setAccessibilityIndex(index);
|
||||
|
||||
if (backfill && mode === 'combobox' && active !== null) {
|
||||
setActiveValue(String(active));
|
||||
}
|
||||
}; // ============================= Popup ==============================
|
||||
|
||||
|
||||
var _React$useState11 = React.useState(null),
|
||||
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
||||
containerWidth = _React$useState12[0],
|
||||
setContainerWidth = _React$useState12[1];
|
||||
|
||||
useLayoutEffect(function () {
|
||||
if (triggerOpen) {
|
||||
var newWidth = Math.ceil(containerRef.current.offsetWidth);
|
||||
|
||||
if (containerWidth !== newWidth) {
|
||||
setContainerWidth(newWidth);
|
||||
}
|
||||
}
|
||||
}, [triggerOpen]);
|
||||
var popupNode = React.createElement(OptionList, {
|
||||
ref: listRef,
|
||||
prefixCls: prefixCls,
|
||||
id: mergedId,
|
||||
open: mergedOpen,
|
||||
childrenAsData: !options,
|
||||
options: displayOptions,
|
||||
flattenOptions: displayFlattenOptions,
|
||||
multiple: isMultiple,
|
||||
values: rawValues,
|
||||
height: listHeight,
|
||||
itemHeight: listItemHeight,
|
||||
onSelect: onInternalOptionSelect,
|
||||
onToggleOpen: onToggleOpen,
|
||||
onActiveValue: onActiveValue,
|
||||
defaultActiveFirstOption: mergedDefaultActiveFirstOption,
|
||||
notFoundContent: notFoundContent,
|
||||
onScroll: onPopupScroll,
|
||||
searchValue: mergedSearchValue,
|
||||
menuItemSelectedIcon: menuItemSelectedIcon,
|
||||
virtual: virtual !== false && dropdownMatchSelectWidth !== false
|
||||
}); // ============================= Clear ==============================
|
||||
|
||||
var clearNode;
|
||||
|
||||
var onClearMouseDown = function onClearMouseDown() {
|
||||
// Trigger internal `onClear` event
|
||||
if (useInternalProps && internalProps.onClear) {
|
||||
internalProps.onClear();
|
||||
}
|
||||
|
||||
triggerChange([]);
|
||||
triggerSearch('', false);
|
||||
};
|
||||
|
||||
if (!disabled && allowClear && (mergedRawValue.length || mergedSearchValue)) {
|
||||
clearNode = React.createElement(TransBtn, {
|
||||
className: "".concat(prefixCls, "-clear"),
|
||||
onMouseDown: onClearMouseDown,
|
||||
customizeIcon: clearIcon
|
||||
}, "\xD7");
|
||||
} // ============================= Arrow ==============================
|
||||
|
||||
|
||||
var mergedShowArrow = showArrow !== undefined ? showArrow : loading || !isMultiple && mode !== 'combobox';
|
||||
var arrowNode;
|
||||
|
||||
if (mergedShowArrow) {
|
||||
arrowNode = React.createElement(TransBtn, {
|
||||
className: classNames("".concat(prefixCls, "-arrow"), _defineProperty({}, "".concat(prefixCls, "-arrow-loading"), loading)),
|
||||
customizeIcon: inputIcon,
|
||||
customizeIconProps: {
|
||||
loading: loading,
|
||||
searchValue: mergedSearchValue,
|
||||
open: mergedOpen,
|
||||
focused: mockFocused,
|
||||
showSearch: mergedShowSearch
|
||||
}
|
||||
});
|
||||
} // ============================ Warning =============================
|
||||
|
||||
|
||||
if (process.env.NODE_ENV !== 'production' && warningProps) {
|
||||
warningProps(props);
|
||||
} // ============================= Render =============================
|
||||
|
||||
|
||||
var mergedClassName = classNames(prefixCls, className, (_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefixCls, "-focused"), mockFocused), _defineProperty(_classNames2, "".concat(prefixCls, "-multiple"), isMultiple), _defineProperty(_classNames2, "".concat(prefixCls, "-single"), !isMultiple), _defineProperty(_classNames2, "".concat(prefixCls, "-allow-clear"), allowClear), _defineProperty(_classNames2, "".concat(prefixCls, "-show-arrow"), mergedShowArrow), _defineProperty(_classNames2, "".concat(prefixCls, "-disabled"), disabled), _defineProperty(_classNames2, "".concat(prefixCls, "-loading"), loading), _defineProperty(_classNames2, "".concat(prefixCls, "-open"), mergedOpen), _defineProperty(_classNames2, "".concat(prefixCls, "-customize-input"), customizeInputElement), _defineProperty(_classNames2, "".concat(prefixCls, "-show-search"), mergedShowSearch), _classNames2));
|
||||
return React.createElement("div", Object.assign({
|
||||
className: mergedClassName
|
||||
}, domProps, {
|
||||
ref: containerRef,
|
||||
onMouseDown: onInternalMouseDown,
|
||||
onKeyDown: onInternalKeyDown,
|
||||
onKeyUp: onInternalKeyUp,
|
||||
onFocus: onContainerFocus,
|
||||
onBlur: onContainerBlur
|
||||
}), mockFocused && !mergedOpen && React.createElement("span", {
|
||||
style: {
|
||||
width: 0,
|
||||
height: 0,
|
||||
display: 'flex',
|
||||
overflow: 'hidden',
|
||||
opacity: 0
|
||||
},
|
||||
"aria-live": "polite"
|
||||
}, "".concat(mergedRawValue.join(', '))), React.createElement(SelectTrigger, {
|
||||
ref: triggerRef,
|
||||
disabled: disabled,
|
||||
prefixCls: prefixCls,
|
||||
visible: triggerOpen,
|
||||
popupElement: popupNode,
|
||||
containerWidth: containerWidth,
|
||||
animation: animation,
|
||||
transitionName: transitionName,
|
||||
dropdownStyle: dropdownStyle,
|
||||
dropdownClassName: dropdownClassName,
|
||||
direction: direction,
|
||||
dropdownMatchSelectWidth: dropdownMatchSelectWidth,
|
||||
dropdownRender: dropdownRender,
|
||||
dropdownAlign: dropdownAlign,
|
||||
getPopupContainer: getPopupContainer,
|
||||
empty: !mergedOptions.length,
|
||||
getTriggerDOMNode: function getTriggerDOMNode() {
|
||||
return selectorDomRef.current;
|
||||
}
|
||||
}, React.createElement(Selector, Object.assign({}, props, {
|
||||
domRef: selectorDomRef,
|
||||
prefixCls: prefixCls,
|
||||
inputElement: customizeInputElement,
|
||||
ref: selectorRef,
|
||||
id: mergedId,
|
||||
showSearch: mergedShowSearch,
|
||||
mode: mode,
|
||||
accessibilityIndex: accessibilityIndex,
|
||||
multiple: isMultiple,
|
||||
tagRender: tagRender,
|
||||
values: displayValues,
|
||||
open: mergedOpen,
|
||||
onToggleOpen: onToggleOpen,
|
||||
searchValue: mergedSearchValue,
|
||||
activeValue: activeValue,
|
||||
onSearch: triggerSearch,
|
||||
onSelect: onInternalSelectionSelect
|
||||
}))), arrowNode, clearNode);
|
||||
}
|
||||
|
||||
var RefSelect = React.forwardRef(Select);
|
||||
return RefSelect;
|
||||
}
|
||||
5
web/node_modules/rc-select/es/hooks/useDelayReset.d.ts
generated
vendored
Normal file
5
web/node_modules/rc-select/es/hooks/useDelayReset.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* Similar with `useLock`, but this hook will always execute last value.
|
||||
* When set to `true`, it will keep `true` for a short time even if `false` is set.
|
||||
*/
|
||||
export default function useDelayReset(timeout?: number): [boolean, (val: boolean, callback?: () => void) => void, () => void];
|
||||
49
web/node_modules/rc-select/es/hooks/useDelayReset.js
generated
vendored
Normal file
49
web/node_modules/rc-select/es/hooks/useDelayReset.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
import * as React from 'react';
|
||||
/**
|
||||
* Similar with `useLock`, but this hook will always execute last value.
|
||||
* When set to `true`, it will keep `true` for a short time even if `false` is set.
|
||||
*/
|
||||
|
||||
export default function useDelayReset() {
|
||||
var timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
|
||||
|
||||
var _React$useState = React.useState(false),
|
||||
_React$useState2 = _slicedToArray(_React$useState, 2),
|
||||
bool = _React$useState2[0],
|
||||
setBool = _React$useState2[1];
|
||||
|
||||
var delayRef = React.useRef(null);
|
||||
|
||||
var cancelLatest = function cancelLatest() {
|
||||
window.clearTimeout(delayRef.current);
|
||||
};
|
||||
|
||||
React.useEffect(function () {
|
||||
return cancelLatest;
|
||||
}, []);
|
||||
|
||||
var delaySetBool = function delaySetBool(value, callback) {
|
||||
cancelLatest();
|
||||
delayRef.current = window.setTimeout(function () {
|
||||
setBool(value);
|
||||
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
}, timeout);
|
||||
};
|
||||
|
||||
return [bool, delaySetBool, cancelLatest];
|
||||
}
|
||||
5
web/node_modules/rc-select/es/hooks/useLayoutEffect.d.ts
generated
vendored
Normal file
5
web/node_modules/rc-select/es/hooks/useLayoutEffect.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import * as React from 'react';
|
||||
/**
|
||||
* Wrap `React.useLayoutEffect` which will not throw warning message in test env
|
||||
*/
|
||||
export default function useLayoutEffect(effect: React.EffectCallback, deps?: React.DependencyList): void;
|
||||
17
web/node_modules/rc-select/es/hooks/useLayoutEffect.js
generated
vendored
Normal file
17
web/node_modules/rc-select/es/hooks/useLayoutEffect.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/* eslint-disable react-hooks/rules-of-hooks */
|
||||
import * as React from 'react';
|
||||
import { isBrowserClient } from '../utils/commonUtil';
|
||||
/**
|
||||
* Wrap `React.useLayoutEffect` which will not throw warning message in test env
|
||||
*/
|
||||
|
||||
export default function useLayoutEffect(effect, deps) {
|
||||
// Never happen in test env
|
||||
if (isBrowserClient) {
|
||||
/* istanbul ignore next */
|
||||
React.useLayoutEffect(effect, deps);
|
||||
} else {
|
||||
React.useEffect(effect, deps);
|
||||
}
|
||||
}
|
||||
/* eslint-enable */
|
||||
7
web/node_modules/rc-select/es/hooks/useLock.d.ts
generated
vendored
Normal file
7
web/node_modules/rc-select/es/hooks/useLock.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Locker return cached mark.
|
||||
* If set to `true`, will return `true` in a short time even if set `false`.
|
||||
* If set to `false` and then set to `true`, will change to `true`.
|
||||
* And after time duration, it will back to `null` automatically.
|
||||
*/
|
||||
export default function useLock(duration?: number): [() => boolean, (lock: boolean) => void];
|
||||
34
web/node_modules/rc-select/es/hooks/useLock.js
generated
vendored
Normal file
34
web/node_modules/rc-select/es/hooks/useLock.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
import * as React from 'react';
|
||||
/**
|
||||
* Locker return cached mark.
|
||||
* If set to `true`, will return `true` in a short time even if set `false`.
|
||||
* If set to `false` and then set to `true`, will change to `true`.
|
||||
* And after time duration, it will back to `null` automatically.
|
||||
*/
|
||||
|
||||
export default function useLock() {
|
||||
var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 250;
|
||||
var lockRef = React.useRef(null);
|
||||
var timeoutRef = React.useRef(null); // Clean up
|
||||
|
||||
React.useEffect(function () {
|
||||
return function () {
|
||||
window.clearTimeout(timeoutRef.current);
|
||||
};
|
||||
}, []);
|
||||
|
||||
function doLock(locked) {
|
||||
if (locked || lockRef.current === null) {
|
||||
lockRef.current = locked;
|
||||
}
|
||||
|
||||
window.clearTimeout(timeoutRef.current);
|
||||
timeoutRef.current = window.setTimeout(function () {
|
||||
lockRef.current = null;
|
||||
}, duration);
|
||||
}
|
||||
|
||||
return [function () {
|
||||
return lockRef.current;
|
||||
}, doLock];
|
||||
}
|
||||
1
web/node_modules/rc-select/es/hooks/useSelectTriggerControl.d.ts
generated
vendored
Normal file
1
web/node_modules/rc-select/es/hooks/useSelectTriggerControl.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export default function useSelectTriggerControl(elements: (HTMLElement | undefined)[], open: boolean, triggerOpen: (open: boolean) => void): void;
|
||||
28
web/node_modules/rc-select/es/hooks/useSelectTriggerControl.js
generated
vendored
Normal file
28
web/node_modules/rc-select/es/hooks/useSelectTriggerControl.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import * as React from 'react';
|
||||
export default function useSelectTriggerControl(elements, open, triggerOpen) {
|
||||
var propsRef = React.useRef(null);
|
||||
propsRef.current = {
|
||||
elements: elements.filter(function (e) {
|
||||
return e;
|
||||
}),
|
||||
open: open,
|
||||
triggerOpen: triggerOpen
|
||||
};
|
||||
React.useEffect(function () {
|
||||
function onGlobalMouseDown(event) {
|
||||
var target = event.target;
|
||||
|
||||
if (propsRef.current.open && propsRef.current.elements.every(function (element) {
|
||||
return !element.contains(target) && element !== target;
|
||||
})) {
|
||||
// Should trigger close
|
||||
propsRef.current.triggerOpen(false);
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('mousedown', onGlobalMouseDown);
|
||||
return function () {
|
||||
return window.removeEventListener('mousedown', onGlobalMouseDown);
|
||||
};
|
||||
}, []);
|
||||
}
|
||||
6
web/node_modules/rc-select/es/index.d.ts
generated
vendored
Normal file
6
web/node_modules/rc-select/es/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import Select, { ExportedSelectProps as SelectProps } from './Select';
|
||||
import { RefSelectProps } from './generate';
|
||||
import Option from './Option';
|
||||
import OptGroup from './OptGroup';
|
||||
export { Option, OptGroup, SelectProps, RefSelectProps };
|
||||
export default Select;
|
||||
5
web/node_modules/rc-select/es/index.js
generated
vendored
Normal file
5
web/node_modules/rc-select/es/index.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import Select from './Select';
|
||||
import Option from './Option';
|
||||
import OptGroup from './OptGroup';
|
||||
export { Option, OptGroup };
|
||||
export default Select;
|
||||
44
web/node_modules/rc-select/es/interface/generator.d.ts
generated
vendored
Normal file
44
web/node_modules/rc-select/es/interface/generator.d.ts
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
/// <reference types="react" />
|
||||
import { SelectProps, RefSelectProps } from '../generate';
|
||||
export declare type SelectSource = 'option' | 'selection' | 'input';
|
||||
export declare const INTERNAL_PROPS_MARK = "RC_SELECT_INTERNAL_PROPS_MARK";
|
||||
export declare type Key = string | number;
|
||||
export declare type RawValueType = string | number;
|
||||
export interface LabelValueType {
|
||||
key?: Key;
|
||||
value?: RawValueType;
|
||||
label?: React.ReactNode;
|
||||
}
|
||||
export declare type DefaultValueType = RawValueType | RawValueType[] | LabelValueType | LabelValueType[];
|
||||
export interface DisplayLabelValueType extends LabelValueType {
|
||||
disabled?: boolean;
|
||||
}
|
||||
export declare type SingleType<MixType> = MixType extends (infer Single)[] ? Single : MixType;
|
||||
export declare type OnClear = () => void;
|
||||
export declare type CustomTagProps = {
|
||||
label: DefaultValueType;
|
||||
value: DefaultValueType;
|
||||
disabled: boolean;
|
||||
onClose: (event?: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
||||
closable: boolean;
|
||||
};
|
||||
export declare type GetLabeledValue<FOT extends FlattenOptionsType> = (value: RawValueType, config: {
|
||||
options: FOT;
|
||||
prevValue: DefaultValueType;
|
||||
labelInValue: boolean;
|
||||
optionLabelProp: string;
|
||||
}) => LabelValueType;
|
||||
export declare type FilterOptions<OptionsType extends object[]> = (searchValue: string, options: OptionsType,
|
||||
/** Component props, since Select & TreeSelect use different prop name, use any here */
|
||||
config: {
|
||||
optionFilterProp: string;
|
||||
filterOption: boolean | FilterFunc<OptionsType[number]>;
|
||||
}) => OptionsType;
|
||||
export declare type FilterFunc<OptionType> = (inputValue: string, option?: OptionType) => boolean;
|
||||
export declare function RefSelectFunc<OptionsType extends object[], ValueType>(Component: React.RefForwardingComponent<RefSelectProps, SelectProps<OptionsType, ValueType>>): React.ForwardRefExoticComponent<React.PropsWithoutRef<SelectProps<OptionsType, ValueType>> & React.RefAttributes<RefSelectProps>>;
|
||||
export declare type FlattenOptionsType<OptionsType extends object[] = object[]> = {
|
||||
key: Key;
|
||||
data: OptionsType[number];
|
||||
/** Used for customize data */
|
||||
[name: string]: any;
|
||||
}[];
|
||||
1
web/node_modules/rc-select/es/interface/generator.js
generated
vendored
Normal file
1
web/node_modules/rc-select/es/interface/generator.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export var INTERNAL_PROPS_MARK = 'RC_SELECT_INTERNAL_PROPS_MARK';
|
||||
36
web/node_modules/rc-select/es/interface/index.d.ts
generated
vendored
Normal file
36
web/node_modules/rc-select/es/interface/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
import * as React from 'react';
|
||||
import { Key } from './generator';
|
||||
export declare type RenderDOMFunc = (props: any) => HTMLElement;
|
||||
export declare type RenderNode = React.ReactNode | ((props: any) => React.ReactNode);
|
||||
export declare type Mode = 'multiple' | 'tags' | 'combobox';
|
||||
export interface OptionCoreData {
|
||||
key?: Key;
|
||||
disabled?: boolean;
|
||||
value: Key;
|
||||
title?: string;
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
label?: React.ReactNode;
|
||||
/** @deprecated Only works when use `children` as option data */
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
export interface OptionData extends OptionCoreData {
|
||||
/** Save for customize data */
|
||||
[prop: string]: any;
|
||||
}
|
||||
export interface OptionGroupData {
|
||||
key?: Key;
|
||||
label?: React.ReactNode;
|
||||
options: OptionData[];
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
/** Save for customize data */
|
||||
[prop: string]: any;
|
||||
}
|
||||
export declare type OptionsType = (OptionData | OptionGroupData)[];
|
||||
export interface FlattenOptionData {
|
||||
group?: boolean;
|
||||
groupOption?: boolean;
|
||||
key: string | number;
|
||||
data: OptionData | OptionGroupData;
|
||||
}
|
||||
0
web/node_modules/rc-select/es/interface/index.js
generated
vendored
Normal file
0
web/node_modules/rc-select/es/interface/index.js
generated
vendored
Normal file
30
web/node_modules/rc-select/es/utils/commonUtil.d.ts
generated
vendored
Normal file
30
web/node_modules/rc-select/es/utils/commonUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import { RawValueType, GetLabeledValue, LabelValueType, DefaultValueType, FlattenOptionsType } from '../interface/generator';
|
||||
export declare function toArray<T>(value: T | T[]): T[];
|
||||
/**
|
||||
* Convert outer props value into internal value
|
||||
*/
|
||||
export declare function toInnerValue(value: DefaultValueType, { labelInValue, combobox }: {
|
||||
labelInValue: boolean;
|
||||
combobox: boolean;
|
||||
}): RawValueType[];
|
||||
/**
|
||||
* Convert internal value into out event value
|
||||
*/
|
||||
export declare function toOuterValues<FOT extends FlattenOptionsType>(valueList: RawValueType[], { optionLabelProp, labelInValue, prevValue, options, getLabeledValue, }: {
|
||||
optionLabelProp: string;
|
||||
labelInValue: boolean;
|
||||
getLabeledValue: GetLabeledValue<FOT>;
|
||||
options: FOT;
|
||||
prevValue: DefaultValueType;
|
||||
}): RawValueType[] | LabelValueType[];
|
||||
export declare function removeLastEnabledValue<T extends {
|
||||
disabled?: boolean;
|
||||
}, P extends RawValueType | object>(measureValues: T[], values: P[]): {
|
||||
values: P[];
|
||||
removedValue: P;
|
||||
};
|
||||
export declare const isClient: HTMLElement;
|
||||
/** Is client side and not jsdom */
|
||||
export declare const isBrowserClient: HTMLElement;
|
||||
/** Get unique id for accessibility usage */
|
||||
export declare function getUUID(): number | string;
|
||||
112
web/node_modules/rc-select/es/utils/commonUtil.js
generated
vendored
Normal file
112
web/node_modules/rc-select/es/utils/commonUtil.js
generated
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
||||
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
export function toArray(value) {
|
||||
if (Array.isArray(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return value !== undefined ? [value] : [];
|
||||
}
|
||||
/**
|
||||
* Convert outer props value into internal value
|
||||
*/
|
||||
|
||||
export function toInnerValue(value, _ref) {
|
||||
var labelInValue = _ref.labelInValue,
|
||||
combobox = _ref.combobox;
|
||||
|
||||
if (value === undefined || value === '' && combobox) {
|
||||
return [];
|
||||
}
|
||||
|
||||
var values = Array.isArray(value) ? value : [value];
|
||||
|
||||
if (labelInValue) {
|
||||
return values.map(function (_ref2) {
|
||||
var key = _ref2.key,
|
||||
val = _ref2.value;
|
||||
return val !== undefined ? val : key;
|
||||
});
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
/**
|
||||
* Convert internal value into out event value
|
||||
*/
|
||||
|
||||
export function toOuterValues(valueList, _ref3) {
|
||||
var optionLabelProp = _ref3.optionLabelProp,
|
||||
labelInValue = _ref3.labelInValue,
|
||||
prevValue = _ref3.prevValue,
|
||||
options = _ref3.options,
|
||||
getLabeledValue = _ref3.getLabeledValue;
|
||||
var values = valueList;
|
||||
|
||||
if (labelInValue) {
|
||||
values = values.map(function (val) {
|
||||
return getLabeledValue(val, {
|
||||
options: options,
|
||||
prevValue: prevValue,
|
||||
labelInValue: labelInValue,
|
||||
optionLabelProp: optionLabelProp
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
export function removeLastEnabledValue(measureValues, values) {
|
||||
var newValues = _toConsumableArray(values);
|
||||
|
||||
var removeIndex;
|
||||
|
||||
for (removeIndex = measureValues.length - 1; removeIndex >= 0; removeIndex -= 1) {
|
||||
if (!measureValues[removeIndex].disabled) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var removedValue = null;
|
||||
|
||||
if (removeIndex !== -1) {
|
||||
removedValue = newValues[removeIndex];
|
||||
newValues.splice(removeIndex, 1);
|
||||
}
|
||||
|
||||
return {
|
||||
values: newValues,
|
||||
removedValue: removedValue
|
||||
};
|
||||
}
|
||||
export var isClient = typeof window !== 'undefined' && window.document && window.document.documentElement;
|
||||
/** Is client side and not jsdom */
|
||||
|
||||
export var isBrowserClient = process.env.NODE_ENV !== 'test' && isClient;
|
||||
var uuid = 0;
|
||||
/** Get unique id for accessibility usage */
|
||||
|
||||
export function getUUID() {
|
||||
var retId; // Test never reach
|
||||
|
||||
/* istanbul ignore if */
|
||||
|
||||
if (isBrowserClient) {
|
||||
retId = uuid;
|
||||
uuid += 1;
|
||||
} else {
|
||||
retId = 'TEST_OR_SSR';
|
||||
}
|
||||
|
||||
return retId;
|
||||
}
|
||||
3
web/node_modules/rc-select/es/utils/legacyUtil.d.ts
generated
vendored
Normal file
3
web/node_modules/rc-select/es/utils/legacyUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { OptionsType } from '../interface';
|
||||
export declare function convertChildrenToData(nodes: React.ReactNode, optionOnly?: boolean): OptionsType;
|
||||
54
web/node_modules/rc-select/es/utils/legacyUtil.js
generated
vendored
Normal file
54
web/node_modules/rc-select/es/utils/legacyUtil.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
|
||||
import * as React from 'react';
|
||||
import toArray from "rc-util/es/Children/toArray";
|
||||
|
||||
function convertNodeToOption(node) {
|
||||
var key = node.key,
|
||||
_node$props = node.props,
|
||||
children = _node$props.children,
|
||||
value = _node$props.value,
|
||||
restProps = _objectWithoutProperties(_node$props, ["children", "value"]);
|
||||
|
||||
return _objectSpread({
|
||||
key: key,
|
||||
value: value !== undefined ? value : key,
|
||||
children: children
|
||||
}, restProps);
|
||||
}
|
||||
|
||||
export function convertChildrenToData(nodes) {
|
||||
var optionOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
||||
return toArray(nodes).map(function (node, index) {
|
||||
if (!React.isValidElement(node) || !node.type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var isSelectOptGroup = node.type.isSelectOptGroup,
|
||||
key = node.key,
|
||||
_node$props2 = node.props,
|
||||
children = _node$props2.children,
|
||||
restProps = _objectWithoutProperties(_node$props2, ["children"]);
|
||||
|
||||
if (optionOnly || !isSelectOptGroup) {
|
||||
return convertNodeToOption(node);
|
||||
}
|
||||
|
||||
return _objectSpread({
|
||||
key: "__RC_SELECT_GRP__".concat(key === null ? index : key, "__"),
|
||||
label: key
|
||||
}, restProps, {
|
||||
options: convertChildrenToData(children)
|
||||
});
|
||||
}).filter(function (data) {
|
||||
return data;
|
||||
});
|
||||
}
|
||||
21
web/node_modules/rc-select/es/utils/valueUtil.d.ts
generated
vendored
Normal file
21
web/node_modules/rc-select/es/utils/valueUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import { OptionsType as SelectOptionsType, OptionData, FlattenOptionData } from '../interface';
|
||||
import { FilterFunc, RawValueType, GetLabeledValue, DefaultValueType } from '../interface/generator';
|
||||
/**
|
||||
* Flat options into flatten list.
|
||||
* We use `optionOnly` here is aim to avoid user use nested option group.
|
||||
* Here is simply set `key` to the index if not provided.
|
||||
*/
|
||||
export declare function flattenOptions(options: SelectOptionsType): FlattenOptionData[];
|
||||
export declare function findValueOption(values: RawValueType[], options: FlattenOptionData[]): OptionData[];
|
||||
export declare const getLabeledValue: GetLabeledValue<FlattenOptionData[]>;
|
||||
/** Filter options and return a new options by the search text */
|
||||
export declare function filterOptions(searchValue: string, options: SelectOptionsType, { optionFilterProp, filterOption, }: {
|
||||
optionFilterProp: string;
|
||||
filterOption: boolean | FilterFunc<SelectOptionsType[number]>;
|
||||
}): SelectOptionsType;
|
||||
export declare function getSeparatedContent(text: string, tokens: string[]): string[];
|
||||
export declare function isValueDisabled(value: RawValueType, options: FlattenOptionData[]): boolean;
|
||||
/**
|
||||
* `tags` mode should fill un-list item into the option list
|
||||
*/
|
||||
export declare function fillOptionsWithMissingValue(options: SelectOptionsType, value: DefaultValueType, optionLabelProp: string, labelInValue: boolean): SelectOptionsType;
|
||||
288
web/node_modules/rc-select/es/utils/valueUtil.js
generated
vendored
Normal file
288
web/node_modules/rc-select/es/utils/valueUtil.js
generated
vendored
Normal file
@@ -0,0 +1,288 @@
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
|
||||
function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
import warning from "rc-util/es/warning";
|
||||
import { toArray } from './commonUtil';
|
||||
|
||||
function getKey(data, index) {
|
||||
var key = data.key;
|
||||
var value;
|
||||
|
||||
if ('value' in data) {
|
||||
value = data.value;
|
||||
}
|
||||
|
||||
if (key !== null && key !== undefined) {
|
||||
return key;
|
||||
}
|
||||
|
||||
if (value !== undefined) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return "rc-index-key-".concat(index);
|
||||
}
|
||||
/**
|
||||
* Flat options into flatten list.
|
||||
* We use `optionOnly` here is aim to avoid user use nested option group.
|
||||
* Here is simply set `key` to the index if not provided.
|
||||
*/
|
||||
|
||||
|
||||
export function flattenOptions(options) {
|
||||
var flattenList = [];
|
||||
|
||||
function dig(list, isGroupOption) {
|
||||
list.forEach(function (data) {
|
||||
if (isGroupOption || !('options' in data)) {
|
||||
// Option
|
||||
flattenList.push({
|
||||
key: getKey(data, flattenList.length),
|
||||
groupOption: isGroupOption,
|
||||
data: data
|
||||
});
|
||||
} else {
|
||||
// Option Group
|
||||
flattenList.push({
|
||||
key: getKey(data, flattenList.length),
|
||||
group: true,
|
||||
data: data
|
||||
});
|
||||
dig(data.options, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
dig(options, false);
|
||||
return flattenList;
|
||||
}
|
||||
/**
|
||||
* Inject `props` into `option` for legacy usage
|
||||
*/
|
||||
|
||||
function injectPropsWithOption(option) {
|
||||
var newOption = _objectSpread({}, option);
|
||||
|
||||
if (!('props' in newOption)) {
|
||||
Object.defineProperty(newOption, 'props', {
|
||||
get: function get() {
|
||||
warning(false, 'Return type is option instead of Option instance. Please read value directly instead of reading from `props`.');
|
||||
return newOption;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return newOption;
|
||||
}
|
||||
|
||||
export function findValueOption(values, options) {
|
||||
var optionMap = new Map();
|
||||
options.forEach(function (flattenItem) {
|
||||
if (!flattenItem.group) {
|
||||
var data = flattenItem.data; // Check if match
|
||||
|
||||
optionMap.set(data.value, data);
|
||||
}
|
||||
});
|
||||
return values.map(function (val) {
|
||||
return injectPropsWithOption(optionMap.get(val));
|
||||
});
|
||||
}
|
||||
export var getLabeledValue = function getLabeledValue(value, _ref) {
|
||||
var options = _ref.options,
|
||||
prevValue = _ref.prevValue,
|
||||
labelInValue = _ref.labelInValue,
|
||||
optionLabelProp = _ref.optionLabelProp;
|
||||
var item = findValueOption([value], options)[0];
|
||||
var result = {
|
||||
value: value
|
||||
};
|
||||
var prevValItem;
|
||||
var prevValues = toArray(prevValue);
|
||||
|
||||
if (labelInValue) {
|
||||
prevValItem = prevValues.find(function (prevItem) {
|
||||
if (_typeof(prevItem) === 'object' && 'value' in prevItem) {
|
||||
return prevItem.value === value;
|
||||
} // [Legacy] Support `key` as `value`
|
||||
|
||||
|
||||
return prevItem.key === value;
|
||||
});
|
||||
}
|
||||
|
||||
if (prevValItem && _typeof(prevValItem) === 'object' && 'label' in prevValItem) {
|
||||
result.label = prevValItem.label;
|
||||
|
||||
if (item && typeof prevValItem.label === 'string' && typeof item[optionLabelProp] === 'string' && prevValItem.label.trim() !== item[optionLabelProp].trim()) {
|
||||
warning(false, '`label` of `value` is not same as `label` in Select options.');
|
||||
}
|
||||
} else if (item && optionLabelProp in item) {
|
||||
result.label = item[optionLabelProp];
|
||||
} else {
|
||||
result.label = value;
|
||||
} // [Legacy] We need fill `key` as `value` to compatible old code usage
|
||||
|
||||
|
||||
result.key = result.value;
|
||||
return result;
|
||||
};
|
||||
|
||||
function toRawString(content) {
|
||||
return toArray(content).join('');
|
||||
}
|
||||
/** Filter single option if match the search text */
|
||||
|
||||
|
||||
function getFilterFunction(optionFilterProp) {
|
||||
return function (searchValue, option) {
|
||||
var lowerSearchText = searchValue.toLowerCase(); // Group label search
|
||||
|
||||
if ('options' in option) {
|
||||
return toRawString(option.label).toLowerCase().includes(lowerSearchText);
|
||||
} // Option value search
|
||||
|
||||
|
||||
var rawValue = option[optionFilterProp];
|
||||
var value = toRawString(rawValue).toLowerCase();
|
||||
return value.includes(lowerSearchText) && !option.disabled;
|
||||
};
|
||||
}
|
||||
/** Filter options and return a new options by the search text */
|
||||
|
||||
|
||||
export function filterOptions(searchValue, options, _ref2) {
|
||||
var optionFilterProp = _ref2.optionFilterProp,
|
||||
filterOption = _ref2.filterOption;
|
||||
var filteredOptions = [];
|
||||
var filterFunc;
|
||||
|
||||
if (filterOption === false) {
|
||||
return options;
|
||||
}
|
||||
|
||||
if (typeof filterOption === 'function') {
|
||||
filterFunc = filterOption;
|
||||
} else {
|
||||
filterFunc = getFilterFunction(optionFilterProp);
|
||||
}
|
||||
|
||||
options.forEach(function (item) {
|
||||
// Group should check child options
|
||||
if ('options' in item) {
|
||||
// Check group first
|
||||
var matchGroup = filterFunc(searchValue, item);
|
||||
|
||||
if (matchGroup) {
|
||||
filteredOptions.push(item);
|
||||
} else {
|
||||
// Check option
|
||||
var subOptions = item.options.filter(function (subItem) {
|
||||
return filterFunc(searchValue, subItem);
|
||||
});
|
||||
|
||||
if (subOptions.length) {
|
||||
filteredOptions.push(_objectSpread({}, item, {
|
||||
options: subOptions
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (filterFunc(searchValue, injectPropsWithOption(item))) {
|
||||
filteredOptions.push(item);
|
||||
}
|
||||
});
|
||||
return filteredOptions;
|
||||
}
|
||||
export function getSeparatedContent(text, tokens) {
|
||||
if (!tokens || !tokens.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var match = false;
|
||||
|
||||
function separate(str, _ref3) {
|
||||
var _ref4 = _toArray(_ref3),
|
||||
token = _ref4[0],
|
||||
restTokens = _ref4.slice(1);
|
||||
|
||||
if (!token) {
|
||||
return [str];
|
||||
}
|
||||
|
||||
var list = str.split(token);
|
||||
match = match || list.length > 1;
|
||||
return list.reduce(function (prevList, unitStr) {
|
||||
return [].concat(_toConsumableArray(prevList), _toConsumableArray(separate(unitStr, restTokens)));
|
||||
}, []).filter(function (unit) {
|
||||
return unit;
|
||||
});
|
||||
}
|
||||
|
||||
var list = separate(text, tokens);
|
||||
return match ? list : null;
|
||||
}
|
||||
export function isValueDisabled(value, options) {
|
||||
var option = findValueOption([value], options)[0];
|
||||
return option.disabled;
|
||||
}
|
||||
/**
|
||||
* `tags` mode should fill un-list item into the option list
|
||||
*/
|
||||
|
||||
export function fillOptionsWithMissingValue(options, value, optionLabelProp, labelInValue) {
|
||||
var values = toArray(value).slice().sort();
|
||||
|
||||
var cloneOptions = _toConsumableArray(options); // Convert options value to set
|
||||
|
||||
|
||||
var optionValues = new Set();
|
||||
options.forEach(function (opt) {
|
||||
if (opt.options) {
|
||||
opt.options.forEach(function (subOpt) {
|
||||
optionValues.add(subOpt.value);
|
||||
});
|
||||
} else {
|
||||
optionValues.add(opt.value);
|
||||
}
|
||||
}); // Fill missing value
|
||||
|
||||
values.forEach(function (item) {
|
||||
var val = labelInValue ? item.value : item;
|
||||
|
||||
if (!optionValues.has(val)) {
|
||||
var _ref5;
|
||||
|
||||
cloneOptions.push(labelInValue ? (_ref5 = {}, _defineProperty(_ref5, optionLabelProp, item.label), _defineProperty(_ref5, "value", val), _ref5) : {
|
||||
value: val
|
||||
});
|
||||
}
|
||||
});
|
||||
return cloneOptions;
|
||||
}
|
||||
3
web/node_modules/rc-select/es/utils/warningPropsUtil.d.ts
generated
vendored
Normal file
3
web/node_modules/rc-select/es/utils/warningPropsUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { SelectProps } from '..';
|
||||
declare function warningProps(props: SelectProps): void;
|
||||
export default warningProps;
|
||||
112
web/node_modules/rc-select/es/utils/warningPropsUtil.js
generated
vendored
Normal file
112
web/node_modules/rc-select/es/utils/warningPropsUtil.js
generated
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
import React from 'react';
|
||||
import warning, { noteOnce } from "rc-util/es/warning";
|
||||
import toNodeArray from "rc-util/es/Children/toArray";
|
||||
import { convertChildrenToData } from './legacyUtil';
|
||||
import { toArray } from './commonUtil';
|
||||
|
||||
function warningProps(props) {
|
||||
var mode = props.mode,
|
||||
options = props.options,
|
||||
children = props.children,
|
||||
backfill = props.backfill,
|
||||
allowClear = props.allowClear,
|
||||
placeholder = props.placeholder,
|
||||
getInputElement = props.getInputElement,
|
||||
showSearch = props.showSearch,
|
||||
onSearch = props.onSearch,
|
||||
defaultOpen = props.defaultOpen,
|
||||
autoFocus = props.autoFocus,
|
||||
labelInValue = props.labelInValue,
|
||||
value = props.value,
|
||||
inputValue = props.inputValue,
|
||||
optionLabelProp = props.optionLabelProp;
|
||||
var multiple = mode === 'multiple' || mode === 'tags';
|
||||
var mergedShowSearch = showSearch !== undefined ? showSearch : multiple || mode === 'combobox';
|
||||
var mergedOptions = options || convertChildrenToData(children); // `tags` should not set option as disabled
|
||||
|
||||
warning(mode !== 'tags' || mergedOptions.every(function (opt) {
|
||||
return !opt.disabled;
|
||||
}), 'Please avoid setting option to disabled in tags mode since user can always type text as tag.'); // `combobox` & `tags` should option be `string` type
|
||||
|
||||
if (mode === 'tags' || mode === 'combobox') {
|
||||
var hasNumberValue = mergedOptions.some(function (item) {
|
||||
if (item.options) {
|
||||
return item.options.some(function (opt) {
|
||||
return typeof ('value' in opt ? opt.value : opt.key) === 'number';
|
||||
});
|
||||
}
|
||||
|
||||
return typeof ('value' in item ? item.value : item.key) === 'number';
|
||||
});
|
||||
warning(!hasNumberValue, '`value` of Option should not use number type when `mode` is `tags` or `combobox`.');
|
||||
} // `combobox` should not use `optionLabelProp`
|
||||
|
||||
|
||||
warning(mode !== 'combobox' || !optionLabelProp, '`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly.'); // Only `combobox` support `backfill`
|
||||
|
||||
warning(mode === 'combobox' || !backfill, '`backfill` only works with `combobox` mode.'); // Only `combobox` support `getInputElement`
|
||||
|
||||
warning(mode === 'combobox' || !getInputElement, '`getInputElement` only work with `combobox` mode.'); // Customize `getInputElement` should not use `allowClear` & `placeholder`
|
||||
|
||||
noteOnce(mode !== 'combobox' || !getInputElement || !allowClear || !placeholder, 'Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`.'); // `onSearch` should use in `combobox` or `showSearch`
|
||||
|
||||
if (onSearch && !mergedShowSearch && mode !== 'combobox' && mode !== 'tags') {
|
||||
warning(false, '`onSearch` should work with `showSearch` instead of use alone.');
|
||||
}
|
||||
|
||||
noteOnce(!defaultOpen || autoFocus, '`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed.');
|
||||
|
||||
if (value !== undefined && value !== null) {
|
||||
var values = toArray(value);
|
||||
warning(!labelInValue || values.every(function (val) {
|
||||
return _typeof(val) === 'object' && ('key' in val || 'value' in val);
|
||||
}), '`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`');
|
||||
warning(!multiple || Array.isArray(value), '`value` should be array when `mode` is `multiple` or `tags`');
|
||||
} // Syntactic sugar should use correct children type
|
||||
|
||||
|
||||
if (children) {
|
||||
var invalidateChildType = null;
|
||||
toNodeArray(children).some(function (node) {
|
||||
if (!React.isValidElement(node) || !node.type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var type = node.type;
|
||||
|
||||
if (type.isSelectOption) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (type.isSelectOptGroup) {
|
||||
var allChildrenValid = toNodeArray(node.props.children).every(function (subNode) {
|
||||
if (!React.isValidElement(subNode) || !node.type || subNode.type.isSelectOption) {
|
||||
return true;
|
||||
}
|
||||
|
||||
invalidateChildType = subNode.type;
|
||||
return false;
|
||||
});
|
||||
|
||||
if (allChildrenValid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
invalidateChildType = type;
|
||||
return true;
|
||||
});
|
||||
|
||||
if (invalidateChildType) {
|
||||
warning(false, "`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(invalidateChildType.displayName || invalidateChildType.name || invalidateChildType, "`."));
|
||||
}
|
||||
|
||||
warning(inputValue === undefined, '`inputValue` is deprecated, please use `searchValue` instead.');
|
||||
}
|
||||
}
|
||||
|
||||
export default warningProps;
|
||||
12
web/node_modules/rc-select/lib/OptGroup.d.ts
generated
vendored
Normal file
12
web/node_modules/rc-select/lib/OptGroup.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import * as React from 'react';
|
||||
import { OptionGroupData } from './interface';
|
||||
export interface OptGroupProps extends Omit<OptionGroupData, 'options'> {
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
export interface OptionGroupFC extends React.FC<OptGroupProps> {
|
||||
/** Legacy for check if is a Option Group */
|
||||
isSelectOptGroup: boolean;
|
||||
}
|
||||
/** This is a placeholder, not real render in dom */
|
||||
declare const OptGroup: OptionGroupFC;
|
||||
export default OptGroup;
|
||||
15
web/node_modules/rc-select/lib/OptGroup.js
generated
vendored
Normal file
15
web/node_modules/rc-select/lib/OptGroup.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
/** This is a placeholder, not real render in dom */
|
||||
var OptGroup = function OptGroup() {
|
||||
return null;
|
||||
};
|
||||
|
||||
OptGroup.isSelectOptGroup = true;
|
||||
var _default = OptGroup;
|
||||
exports.default = _default;
|
||||
14
web/node_modules/rc-select/lib/Option.d.ts
generated
vendored
Normal file
14
web/node_modules/rc-select/lib/Option.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import * as React from 'react';
|
||||
import { OptionCoreData } from './interface';
|
||||
export interface OptionProps extends Omit<OptionCoreData, 'label'> {
|
||||
children: React.ReactNode;
|
||||
/** Save for customize data */
|
||||
[prop: string]: any;
|
||||
}
|
||||
export interface OptionFC extends React.FC<OptionProps> {
|
||||
/** Legacy for check if is a Option Group */
|
||||
isSelectOption: boolean;
|
||||
}
|
||||
/** This is a placeholder, not real render in dom */
|
||||
declare const Option: OptionFC;
|
||||
export default Option;
|
||||
15
web/node_modules/rc-select/lib/Option.js
generated
vendored
Normal file
15
web/node_modules/rc-select/lib/Option.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
/** This is a placeholder, not real render in dom */
|
||||
var Option = function Option() {
|
||||
return null;
|
||||
};
|
||||
|
||||
Option.isSelectOption = true;
|
||||
var _default = Option;
|
||||
exports.default = _default;
|
||||
34
web/node_modules/rc-select/lib/OptionList.d.ts
generated
vendored
Normal file
34
web/node_modules/rc-select/lib/OptionList.d.ts
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
import * as React from 'react';
|
||||
import { OptionsType as SelectOptionsType, RenderNode } from './interface';
|
||||
import { RawValueType, FlattenOptionsType } from './interface/generator';
|
||||
export interface OptionListProps<OptionsType extends object[]> {
|
||||
prefixCls: string;
|
||||
id: string;
|
||||
options: OptionsType;
|
||||
flattenOptions: FlattenOptionsType<OptionsType>;
|
||||
height: number;
|
||||
itemHeight: number;
|
||||
values: Set<RawValueType>;
|
||||
multiple: boolean;
|
||||
open: boolean;
|
||||
defaultActiveFirstOption?: boolean;
|
||||
notFoundContent?: React.ReactNode;
|
||||
menuItemSelectedIcon?: RenderNode;
|
||||
childrenAsData: boolean;
|
||||
searchValue: string;
|
||||
virtual: boolean;
|
||||
onSelect: (value: RawValueType, option: {
|
||||
selected: boolean;
|
||||
}) => void;
|
||||
onToggleOpen: (open?: boolean) => void;
|
||||
/** Tell Select that some value is now active to make accessibility work */
|
||||
onActiveValue: (value: RawValueType, index: number) => void;
|
||||
onScroll: React.UIEventHandler<HTMLDivElement>;
|
||||
}
|
||||
export interface RefOptionListProps {
|
||||
onKeyDown: React.KeyboardEventHandler;
|
||||
onKeyUp: React.KeyboardEventHandler;
|
||||
scrollTo?: (index: number) => void;
|
||||
}
|
||||
declare const RefOptionList: React.ForwardRefExoticComponent<OptionListProps<SelectOptionsType> & React.RefAttributes<RefOptionListProps>>;
|
||||
export default RefOptionList;
|
||||
328
web/node_modules/rc-select/lib/OptionList.js
generated
vendored
Normal file
328
web/node_modules/rc-select/lib/OptionList.js
generated
vendored
Normal file
@@ -0,0 +1,328 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _KeyCode = _interopRequireDefault(require("rc-util/lib/KeyCode"));
|
||||
|
||||
var _useMemo = _interopRequireDefault(require("rc-util/lib/hooks/useMemo"));
|
||||
|
||||
var _classnames = _interopRequireDefault(require("classnames"));
|
||||
|
||||
var _rcVirtualList = _interopRequireDefault(require("rc-virtual-list"));
|
||||
|
||||
var _TransBtn = _interopRequireDefault(require("./TransBtn"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
/**
|
||||
* Using virtual list of option display.
|
||||
* Will fallback to dom if use customize render.
|
||||
*/
|
||||
var OptionList = function OptionList(_ref, ref) {
|
||||
var prefixCls = _ref.prefixCls,
|
||||
id = _ref.id,
|
||||
flattenOptions = _ref.flattenOptions,
|
||||
childrenAsData = _ref.childrenAsData,
|
||||
values = _ref.values,
|
||||
searchValue = _ref.searchValue,
|
||||
multiple = _ref.multiple,
|
||||
defaultActiveFirstOption = _ref.defaultActiveFirstOption,
|
||||
height = _ref.height,
|
||||
itemHeight = _ref.itemHeight,
|
||||
notFoundContent = _ref.notFoundContent,
|
||||
open = _ref.open,
|
||||
menuItemSelectedIcon = _ref.menuItemSelectedIcon,
|
||||
virtual = _ref.virtual,
|
||||
onSelect = _ref.onSelect,
|
||||
onToggleOpen = _ref.onToggleOpen,
|
||||
onActiveValue = _ref.onActiveValue,
|
||||
onScroll = _ref.onScroll;
|
||||
var itemPrefixCls = "".concat(prefixCls, "-item");
|
||||
var memoFlattenOptions = (0, _useMemo.default)(function () {
|
||||
return flattenOptions;
|
||||
}, [open, flattenOptions], function (prev, next) {
|
||||
return next[0] && prev[1] !== next[1];
|
||||
}); // =========================== List ===========================
|
||||
|
||||
var listRef = React.useRef(null);
|
||||
|
||||
var onListMouseDown = function onListMouseDown(event) {
|
||||
event.preventDefault();
|
||||
};
|
||||
|
||||
var scrollIntoView = function scrollIntoView(index) {
|
||||
if (listRef.current) {
|
||||
listRef.current.scrollTo({
|
||||
index: index
|
||||
});
|
||||
}
|
||||
}; // ========================== Active ==========================
|
||||
|
||||
|
||||
var getEnabledActiveIndex = function getEnabledActiveIndex(index) {
|
||||
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
||||
var len = memoFlattenOptions.length;
|
||||
|
||||
for (var i = 0; i < len; i += 1) {
|
||||
var current = (index + i * offset + len) % len;
|
||||
var _memoFlattenOptions$c = memoFlattenOptions[current],
|
||||
group = _memoFlattenOptions$c.group,
|
||||
data = _memoFlattenOptions$c.data;
|
||||
|
||||
if (!group && !data.disabled) {
|
||||
return current;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
};
|
||||
|
||||
var _React$useState = React.useState(function () {
|
||||
return getEnabledActiveIndex(0);
|
||||
}),
|
||||
_React$useState2 = _slicedToArray(_React$useState, 2),
|
||||
activeIndex = _React$useState2[0],
|
||||
setActiveIndex = _React$useState2[1];
|
||||
|
||||
var setActive = function setActive(index) {
|
||||
setActiveIndex(index); // Trigger active event
|
||||
|
||||
var flattenItem = memoFlattenOptions[index];
|
||||
|
||||
if (!flattenItem) {
|
||||
onActiveValue(null, -1);
|
||||
return;
|
||||
}
|
||||
|
||||
onActiveValue(flattenItem.data.value, index);
|
||||
}; // Auto active first item when list length or searchValue changed
|
||||
|
||||
|
||||
React.useEffect(function () {
|
||||
setActive(defaultActiveFirstOption !== false ? getEnabledActiveIndex(0) : -1);
|
||||
}, [memoFlattenOptions.length, searchValue]); // Auto scroll to item position in single mode
|
||||
|
||||
React.useEffect(function () {
|
||||
/**
|
||||
* React will skip `onChange` when component update.
|
||||
* `setActive` function will call root accessibility state update which makes re-render.
|
||||
* So we need to delay to let Input component trigger onChange first.
|
||||
*/
|
||||
var timeoutId = setTimeout(function () {
|
||||
if (!multiple && open && values.size === 1) {
|
||||
var value = Array.from(values)[0];
|
||||
var index = memoFlattenOptions.findIndex(function (_ref2) {
|
||||
var data = _ref2.data;
|
||||
return data.value === value;
|
||||
});
|
||||
setActive(index);
|
||||
scrollIntoView(index);
|
||||
}
|
||||
});
|
||||
return function () {
|
||||
return clearTimeout(timeoutId);
|
||||
};
|
||||
}, [open]); // ========================== Values ==========================
|
||||
|
||||
var onSelectValue = function onSelectValue(value) {
|
||||
if (value !== undefined) {
|
||||
onSelect(value, {
|
||||
selected: !values.has(value)
|
||||
});
|
||||
} // Single mode should always close by select
|
||||
|
||||
|
||||
if (!multiple) {
|
||||
onToggleOpen(false);
|
||||
}
|
||||
}; // ========================= Keyboard =========================
|
||||
|
||||
|
||||
React.useImperativeHandle(ref, function () {
|
||||
return {
|
||||
onKeyDown: function onKeyDown(event) {
|
||||
var which = event.which;
|
||||
|
||||
switch (which) {
|
||||
// >>> Arrow keys
|
||||
case _KeyCode.default.UP:
|
||||
case _KeyCode.default.DOWN:
|
||||
{
|
||||
var offset = 0;
|
||||
|
||||
if (which === _KeyCode.default.UP) {
|
||||
offset = -1;
|
||||
} else if (which === _KeyCode.default.DOWN) {
|
||||
offset = 1;
|
||||
}
|
||||
|
||||
if (offset !== 0) {
|
||||
var nextActiveIndex = getEnabledActiveIndex(activeIndex + offset, offset);
|
||||
scrollIntoView(nextActiveIndex);
|
||||
setActive(nextActiveIndex);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
// >>> Select
|
||||
|
||||
case _KeyCode.default.ENTER:
|
||||
{
|
||||
// value
|
||||
var item = memoFlattenOptions[activeIndex];
|
||||
|
||||
if (item && !item.data.disabled) {
|
||||
onSelectValue(item.data.value);
|
||||
} else {
|
||||
onSelectValue(undefined);
|
||||
}
|
||||
|
||||
if (open) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
// >>> Close
|
||||
|
||||
case _KeyCode.default.ESC:
|
||||
{
|
||||
onToggleOpen(false);
|
||||
}
|
||||
}
|
||||
},
|
||||
onKeyUp: function onKeyUp() {},
|
||||
scrollTo: function scrollTo(index) {
|
||||
scrollIntoView(index);
|
||||
}
|
||||
};
|
||||
}); // ========================== Render ==========================
|
||||
|
||||
if (memoFlattenOptions.length === 0) {
|
||||
return React.createElement("div", {
|
||||
role: "listbox",
|
||||
id: "".concat(id, "_list"),
|
||||
className: "".concat(itemPrefixCls, "-empty"),
|
||||
onMouseDown: onListMouseDown
|
||||
}, notFoundContent);
|
||||
}
|
||||
|
||||
function renderItem(index) {
|
||||
var item = memoFlattenOptions[index];
|
||||
var value = item && item.data.value;
|
||||
return item ? React.createElement("div", {
|
||||
key: index,
|
||||
role: "option",
|
||||
id: "".concat(id, "_list_").concat(index),
|
||||
"aria-selected": values.has(value)
|
||||
}, value) : null;
|
||||
}
|
||||
|
||||
return React.createElement(React.Fragment, null, React.createElement("div", {
|
||||
role: "listbox",
|
||||
id: "".concat(id, "_list"),
|
||||
style: {
|
||||
height: 0,
|
||||
overflow: 'hidden'
|
||||
}
|
||||
}, renderItem(activeIndex - 1), renderItem(activeIndex), renderItem(activeIndex + 1)), React.createElement(_rcVirtualList.default, {
|
||||
itemKey: "key",
|
||||
ref: listRef,
|
||||
data: memoFlattenOptions,
|
||||
height: height,
|
||||
itemHeight: itemHeight,
|
||||
fullHeight: false,
|
||||
onMouseDown: onListMouseDown,
|
||||
onScroll: onScroll,
|
||||
virtual: virtual
|
||||
}, function (_ref3, itemIndex) {
|
||||
var _classNames;
|
||||
|
||||
var group = _ref3.group,
|
||||
groupOption = _ref3.groupOption,
|
||||
data = _ref3.data;
|
||||
var label = data.label,
|
||||
key = data.key; // Group
|
||||
|
||||
if (group) {
|
||||
return React.createElement("div", {
|
||||
className: (0, _classnames.default)(itemPrefixCls, "".concat(itemPrefixCls, "-group"))
|
||||
}, label !== undefined ? label : key);
|
||||
}
|
||||
|
||||
var disabled = data.disabled,
|
||||
value = data.value,
|
||||
title = data.title,
|
||||
children = data.children,
|
||||
style = data.style,
|
||||
className = data.className,
|
||||
otherProps = _objectWithoutProperties(data, ["disabled", "value", "title", "children", "style", "className"]); // Option
|
||||
|
||||
|
||||
var selected = values.has(value);
|
||||
var optionPrefixCls = "".concat(itemPrefixCls, "-option");
|
||||
var optionClassName = (0, _classnames.default)(itemPrefixCls, optionPrefixCls, className, (_classNames = {}, _defineProperty(_classNames, "".concat(optionPrefixCls, "-grouped"), groupOption), _defineProperty(_classNames, "".concat(optionPrefixCls, "-active"), activeIndex === itemIndex && !disabled), _defineProperty(_classNames, "".concat(optionPrefixCls, "-disabled"), disabled), _defineProperty(_classNames, "".concat(optionPrefixCls, "-selected"), selected), _classNames));
|
||||
var mergedLabel = childrenAsData ? children : label;
|
||||
var iconVisible = !menuItemSelectedIcon || typeof menuItemSelectedIcon === 'function' || selected;
|
||||
return React.createElement("div", Object.assign({}, otherProps, {
|
||||
"aria-selected": selected,
|
||||
className: optionClassName,
|
||||
title: title,
|
||||
onMouseMove: function onMouseMove() {
|
||||
if (activeIndex === itemIndex || disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
setActive(itemIndex);
|
||||
},
|
||||
onClick: function onClick() {
|
||||
if (!disabled) {
|
||||
onSelectValue(value);
|
||||
}
|
||||
},
|
||||
style: style
|
||||
}), React.createElement("div", {
|
||||
className: "".concat(optionPrefixCls, "-content")
|
||||
}, mergedLabel || value), React.isValidElement(menuItemSelectedIcon) || selected, iconVisible && React.createElement(_TransBtn.default, {
|
||||
className: "".concat(itemPrefixCls, "-option-state"),
|
||||
customizeIcon: menuItemSelectedIcon,
|
||||
customizeIconProps: {
|
||||
isSelected: selected
|
||||
}
|
||||
}, selected ? '✓' : null));
|
||||
}));
|
||||
};
|
||||
|
||||
var RefOptionList = React.forwardRef(OptionList);
|
||||
RefOptionList.displayName = 'OptionList';
|
||||
var _default = RefOptionList;
|
||||
exports.default = _default;
|
||||
50
web/node_modules/rc-select/lib/Select.d.ts
generated
vendored
Normal file
50
web/node_modules/rc-select/lib/Select.d.ts
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* To match accessibility requirement, we always provide an input in the component.
|
||||
* Other element will not set `tabIndex` to avoid `onBlur` sequence problem.
|
||||
* For focused select, we set `aria-live="polite"` to update the accessibility content.
|
||||
*
|
||||
* ref:
|
||||
* - keyboard: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role#Keyboard_interactions
|
||||
*
|
||||
* New api:
|
||||
* - listHeight
|
||||
* - listItemHeight
|
||||
* - component
|
||||
*
|
||||
* Remove deprecated api:
|
||||
* - multiple
|
||||
* - tags
|
||||
* - combobox
|
||||
* - firstActiveValue
|
||||
* - dropdownMenuStyle
|
||||
* - openClassName (Not list in api)
|
||||
*
|
||||
* Update:
|
||||
* - `backfill` only support `combobox` mode
|
||||
* - `combobox` mode not support `labelInValue` since it's meaningless
|
||||
* - `getInputElement` only support `combobox` mode
|
||||
* - `onChange` return OptionData instead of ReactNode
|
||||
* - `filterOption` `onChange` `onSelect` accept OptionData instead of ReactNode
|
||||
* - `combobox` mode trigger `onChange` will get `undefined` if no `value` match in Option
|
||||
* - `combobox` mode not support `optionLabelProp`
|
||||
*/
|
||||
import React from 'react';
|
||||
import { OptionsType as SelectOptionsType } from './interface';
|
||||
import Option from './Option';
|
||||
import OptGroup from './OptGroup';
|
||||
import { SelectProps, RefSelectProps } from './generate';
|
||||
import { DefaultValueType } from './interface/generator';
|
||||
export declare type ExportedSelectProps<ValueType extends DefaultValueType = DefaultValueType> = SelectProps<SelectOptionsType, ValueType>;
|
||||
/**
|
||||
* Typescript not support generic with function component,
|
||||
* we have to wrap an class component to handle this.
|
||||
*/
|
||||
declare class Select<VT> extends React.Component<SelectProps<SelectOptionsType, VT>> {
|
||||
static Option: typeof Option;
|
||||
static OptGroup: typeof OptGroup;
|
||||
selectRef: React.RefObject<RefSelectProps>;
|
||||
focus: () => void;
|
||||
blur: () => void;
|
||||
render(): JSX.Element;
|
||||
}
|
||||
export default Select;
|
||||
106
web/node_modules/rc-select/lib/Select.js
generated
vendored
Normal file
106
web/node_modules/rc-select/lib/Select.js
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
|
||||
var _OptionList = _interopRequireDefault(require("./OptionList"));
|
||||
|
||||
var _Option = _interopRequireDefault(require("./Option"));
|
||||
|
||||
var _OptGroup = _interopRequireDefault(require("./OptGroup"));
|
||||
|
||||
var _legacyUtil = require("./utils/legacyUtil");
|
||||
|
||||
var _valueUtil = require("./utils/valueUtil");
|
||||
|
||||
var _generate = _interopRequireDefault(require("./generate"));
|
||||
|
||||
var _warningPropsUtil = _interopRequireDefault(require("./utils/warningPropsUtil"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
var RefSelect = (0, _generate.default)({
|
||||
prefixCls: 'rc-select',
|
||||
components: {
|
||||
optionList: _OptionList.default
|
||||
},
|
||||
convertChildrenToData: _legacyUtil.convertChildrenToData,
|
||||
flattenOptions: _valueUtil.flattenOptions,
|
||||
getLabeledValue: _valueUtil.getLabeledValue,
|
||||
filterOptions: _valueUtil.filterOptions,
|
||||
isValueDisabled: _valueUtil.isValueDisabled,
|
||||
findValueOption: _valueUtil.findValueOption,
|
||||
warningProps: _warningPropsUtil.default,
|
||||
fillOptionsWithMissingValue: _valueUtil.fillOptionsWithMissingValue
|
||||
});
|
||||
/**
|
||||
* Typescript not support generic with function component,
|
||||
* we have to wrap an class component to handle this.
|
||||
*/
|
||||
|
||||
var Select = /*#__PURE__*/function (_React$Component) {
|
||||
_inherits(Select, _React$Component);
|
||||
|
||||
var _super = _createSuper(Select);
|
||||
|
||||
function Select() {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, Select);
|
||||
|
||||
_this = _super.apply(this, arguments);
|
||||
_this.selectRef = _react.default.createRef();
|
||||
|
||||
_this.focus = function () {
|
||||
_this.selectRef.current.focus();
|
||||
};
|
||||
|
||||
_this.blur = function () {
|
||||
_this.selectRef.current.blur();
|
||||
};
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(Select, [{
|
||||
key: "render",
|
||||
value: function render() {
|
||||
return _react.default.createElement(RefSelect, Object.assign({
|
||||
ref: this.selectRef
|
||||
}, this.props));
|
||||
}
|
||||
}]);
|
||||
|
||||
return Select;
|
||||
}(_react.default.Component);
|
||||
|
||||
Select.Option = _Option.default;
|
||||
Select.OptGroup = _OptGroup.default;
|
||||
var _default = Select;
|
||||
exports.default = _default;
|
||||
26
web/node_modules/rc-select/lib/SelectTrigger.d.ts
generated
vendored
Normal file
26
web/node_modules/rc-select/lib/SelectTrigger.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import * as React from 'react';
|
||||
import { RenderDOMFunc } from './interface';
|
||||
export interface RefTriggerProps {
|
||||
getPopupElement: () => HTMLDivElement;
|
||||
}
|
||||
export interface SelectTriggerProps {
|
||||
prefixCls: string;
|
||||
children: React.ReactElement;
|
||||
disabled: boolean;
|
||||
visible: boolean;
|
||||
popupElement: React.ReactElement;
|
||||
animation?: string;
|
||||
transitionName?: string;
|
||||
containerWidth: number;
|
||||
dropdownStyle: React.CSSProperties;
|
||||
dropdownClassName: string;
|
||||
direction: string;
|
||||
dropdownMatchSelectWidth?: boolean | number;
|
||||
dropdownRender?: (menu: React.ReactElement) => React.ReactElement;
|
||||
getPopupContainer?: RenderDOMFunc;
|
||||
dropdownAlign: object;
|
||||
empty: boolean;
|
||||
getTriggerDOMNode: () => HTMLElement;
|
||||
}
|
||||
declare const RefSelectTrigger: React.ForwardRefExoticComponent<SelectTriggerProps & React.RefAttributes<RefTriggerProps>>;
|
||||
export default RefSelectTrigger;
|
||||
147
web/node_modules/rc-select/lib/SelectTrigger.js
generated
vendored
Normal file
147
web/node_modules/rc-select/lib/SelectTrigger.js
generated
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _rcTrigger = _interopRequireDefault(require("rc-trigger"));
|
||||
|
||||
var _classnames = _interopRequireDefault(require("classnames"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
|
||||
var getBuiltInPlacements = function getBuiltInPlacements(dropdownMatchSelectWidth) {
|
||||
// Enable horizontal overflow auto-adjustment when a custom dropdown width is provided
|
||||
var adjustX = typeof dropdownMatchSelectWidth !== 'number' ? 0 : 1;
|
||||
return {
|
||||
bottomLeft: {
|
||||
points: ['tl', 'bl'],
|
||||
offset: [0, 4],
|
||||
overflow: {
|
||||
adjustX: adjustX,
|
||||
adjustY: 1
|
||||
}
|
||||
},
|
||||
bottomRight: {
|
||||
points: ['tr', 'br'],
|
||||
offset: [0, 4],
|
||||
overflow: {
|
||||
adjustX: adjustX,
|
||||
adjustY: 1
|
||||
}
|
||||
},
|
||||
topLeft: {
|
||||
points: ['bl', 'tl'],
|
||||
offset: [0, -4],
|
||||
overflow: {
|
||||
adjustX: adjustX,
|
||||
adjustY: 1
|
||||
}
|
||||
},
|
||||
topRight: {
|
||||
points: ['br', 'tr'],
|
||||
offset: [0, -4],
|
||||
overflow: {
|
||||
adjustX: adjustX,
|
||||
adjustY: 1
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var SelectTrigger = function SelectTrigger(props, ref) {
|
||||
var prefixCls = props.prefixCls,
|
||||
disabled = props.disabled,
|
||||
visible = props.visible,
|
||||
children = props.children,
|
||||
popupElement = props.popupElement,
|
||||
containerWidth = props.containerWidth,
|
||||
animation = props.animation,
|
||||
transitionName = props.transitionName,
|
||||
dropdownStyle = props.dropdownStyle,
|
||||
dropdownClassName = props.dropdownClassName,
|
||||
_props$direction = props.direction,
|
||||
direction = _props$direction === void 0 ? 'ltr' : _props$direction,
|
||||
_props$dropdownMatchS = props.dropdownMatchSelectWidth,
|
||||
dropdownMatchSelectWidth = _props$dropdownMatchS === void 0 ? true : _props$dropdownMatchS,
|
||||
dropdownRender = props.dropdownRender,
|
||||
dropdownAlign = props.dropdownAlign,
|
||||
getPopupContainer = props.getPopupContainer,
|
||||
empty = props.empty,
|
||||
getTriggerDOMNode = props.getTriggerDOMNode,
|
||||
restProps = _objectWithoutProperties(props, ["prefixCls", "disabled", "visible", "children", "popupElement", "containerWidth", "animation", "transitionName", "dropdownStyle", "dropdownClassName", "direction", "dropdownMatchSelectWidth", "dropdownRender", "dropdownAlign", "getPopupContainer", "empty", "getTriggerDOMNode"]);
|
||||
|
||||
var dropdownPrefixCls = "".concat(prefixCls, "-dropdown");
|
||||
var popupNode = popupElement;
|
||||
|
||||
if (dropdownRender) {
|
||||
popupNode = dropdownRender(popupElement);
|
||||
}
|
||||
|
||||
var builtInPlacements = React.useMemo(function () {
|
||||
return getBuiltInPlacements(dropdownMatchSelectWidth);
|
||||
}, [dropdownMatchSelectWidth]); // ===================== Motion ======================
|
||||
|
||||
var mergedTransitionName = animation ? "".concat(dropdownPrefixCls, "-").concat(animation) : transitionName; // ======================= Ref =======================
|
||||
|
||||
var popupRef = React.useRef(null);
|
||||
React.useImperativeHandle(ref, function () {
|
||||
return {
|
||||
getPopupElement: function getPopupElement() {
|
||||
return popupRef.current;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
var popupStyle = _objectSpread({
|
||||
minWidth: containerWidth
|
||||
}, dropdownStyle);
|
||||
|
||||
if (typeof dropdownMatchSelectWidth === 'number') {
|
||||
popupStyle.width = dropdownMatchSelectWidth;
|
||||
} else if (dropdownMatchSelectWidth) {
|
||||
popupStyle.width = containerWidth;
|
||||
}
|
||||
|
||||
return React.createElement(_rcTrigger.default, Object.assign({}, restProps, {
|
||||
showAction: [],
|
||||
hideAction: [],
|
||||
popupPlacement: direction === 'rtl' ? 'bottomRight' : 'bottomLeft',
|
||||
builtinPlacements: builtInPlacements,
|
||||
prefixCls: dropdownPrefixCls,
|
||||
popupTransitionName: mergedTransitionName,
|
||||
popup: React.createElement("div", {
|
||||
ref: popupRef
|
||||
}, popupNode),
|
||||
popupAlign: dropdownAlign,
|
||||
popupVisible: visible,
|
||||
getPopupContainer: getPopupContainer,
|
||||
popupClassName: (0, _classnames.default)(dropdownClassName, _defineProperty({}, "".concat(dropdownPrefixCls, "-empty"), empty)),
|
||||
popupStyle: popupStyle,
|
||||
getTriggerDOMNode: getTriggerDOMNode
|
||||
}), children);
|
||||
};
|
||||
|
||||
var RefSelectTrigger = React.forwardRef(SelectTrigger);
|
||||
RefSelectTrigger.displayName = 'SelectTrigger';
|
||||
var _default = RefSelectTrigger;
|
||||
exports.default = _default;
|
||||
21
web/node_modules/rc-select/lib/Selector/Input.d.ts
generated
vendored
Normal file
21
web/node_modules/rc-select/lib/Selector/Input.d.ts
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import React from 'react';
|
||||
declare type InputRef = HTMLInputElement | HTMLTextAreaElement;
|
||||
interface InputProps {
|
||||
prefixCls: string;
|
||||
id: string;
|
||||
inputElement: React.ReactElement;
|
||||
disabled: boolean;
|
||||
autoFocus: boolean;
|
||||
autoComplete: string;
|
||||
editable: boolean;
|
||||
accessibilityIndex: number;
|
||||
value: string;
|
||||
open: boolean;
|
||||
tabIndex: number;
|
||||
onKeyDown: React.KeyboardEventHandler<HTMLInputElement | HTMLTextAreaElement | HTMLElement>;
|
||||
onMouseDown: React.MouseEventHandler<HTMLInputElement | HTMLTextAreaElement | HTMLElement>;
|
||||
onChange: React.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement | HTMLElement>;
|
||||
onPaste: React.ClipboardEventHandler<HTMLInputElement | HTMLTextAreaElement | HTMLElement>;
|
||||
}
|
||||
declare const RefInput: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<InputRef>>;
|
||||
export default RefInput;
|
||||
96
web/node_modules/rc-select/lib/Selector/Input.js
generated
vendored
Normal file
96
web/node_modules/rc-select/lib/Selector/Input.js
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
|
||||
var _ref2 = require("rc-util/lib/ref");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
var Input = function Input(_ref, ref) {
|
||||
var prefixCls = _ref.prefixCls,
|
||||
id = _ref.id,
|
||||
inputElement = _ref.inputElement,
|
||||
disabled = _ref.disabled,
|
||||
tabIndex = _ref.tabIndex,
|
||||
autoFocus = _ref.autoFocus,
|
||||
autoComplete = _ref.autoComplete,
|
||||
editable = _ref.editable,
|
||||
accessibilityIndex = _ref.accessibilityIndex,
|
||||
value = _ref.value,
|
||||
_onKeyDown = _ref.onKeyDown,
|
||||
_onMouseDown = _ref.onMouseDown,
|
||||
_onChange = _ref.onChange,
|
||||
onPaste = _ref.onPaste,
|
||||
open = _ref.open;
|
||||
|
||||
var inputNode = inputElement || _react.default.createElement("input", null);
|
||||
|
||||
var _inputNode = inputNode,
|
||||
originRef = _inputNode.ref,
|
||||
_inputNode$props = _inputNode.props,
|
||||
onOriginKeyDown = _inputNode$props.onKeyDown,
|
||||
onOriginChange = _inputNode$props.onChange,
|
||||
onOriginMouseDown = _inputNode$props.onMouseDown,
|
||||
style = _inputNode$props.style;
|
||||
inputNode = _react.default.cloneElement(inputNode, {
|
||||
id: id,
|
||||
ref: (0, _ref2.composeRef)(ref, originRef),
|
||||
disabled: disabled,
|
||||
tabIndex: tabIndex,
|
||||
autoComplete: autoComplete || 'off',
|
||||
autoFocus: autoFocus,
|
||||
className: "".concat(prefixCls, "-selection-search-input"),
|
||||
style: _objectSpread({}, style, {
|
||||
opacity: editable ? null : 0
|
||||
}),
|
||||
role: 'combobox',
|
||||
'aria-expanded': open,
|
||||
'aria-haspopup': 'listbox',
|
||||
'aria-owns': "".concat(id, "_list"),
|
||||
'aria-autocomplete': 'list',
|
||||
'aria-controls': "".concat(id, "_list"),
|
||||
'aria-activedescendant': "".concat(id, "_list_").concat(accessibilityIndex),
|
||||
value: editable ? value : '',
|
||||
readOnly: !editable,
|
||||
onKeyDown: function onKeyDown(event) {
|
||||
_onKeyDown(event);
|
||||
|
||||
if (onOriginKeyDown) {
|
||||
onOriginKeyDown(event);
|
||||
}
|
||||
},
|
||||
onMouseDown: function onMouseDown(event) {
|
||||
_onMouseDown(event);
|
||||
|
||||
if (onOriginMouseDown) {
|
||||
onOriginMouseDown(event);
|
||||
}
|
||||
},
|
||||
onChange: function onChange(event) {
|
||||
_onChange(event);
|
||||
|
||||
if (onOriginChange) {
|
||||
onOriginChange(event);
|
||||
}
|
||||
},
|
||||
onPaste: onPaste
|
||||
});
|
||||
return inputNode;
|
||||
};
|
||||
|
||||
var RefInput = _react.default.forwardRef(Input);
|
||||
|
||||
RefInput.displayName = 'Input';
|
||||
var _default = RefInput;
|
||||
exports.default = _default;
|
||||
18
web/node_modules/rc-select/lib/Selector/MultipleSelector.d.ts
generated
vendored
Normal file
18
web/node_modules/rc-select/lib/Selector/MultipleSelector.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import React from 'react';
|
||||
import { LabelValueType, RawValueType, CustomTagProps } from '../interface/generator';
|
||||
import { RenderNode } from '../interface';
|
||||
import { InnerSelectorProps } from '.';
|
||||
interface SelectorProps extends InnerSelectorProps {
|
||||
removeIcon?: RenderNode;
|
||||
maxTagCount?: number;
|
||||
maxTagTextLength?: number;
|
||||
maxTagPlaceholder?: React.ReactNode | ((omittedValues: LabelValueType[]) => React.ReactNode);
|
||||
tokenSeparators?: string[];
|
||||
tagRender?: (props: CustomTagProps) => React.ReactElement;
|
||||
choiceTransitionName?: string;
|
||||
onSelect: (value: RawValueType, option: {
|
||||
selected: boolean;
|
||||
}) => void;
|
||||
}
|
||||
declare const SelectSelector: React.FC<SelectorProps>;
|
||||
export default SelectSelector;
|
||||
224
web/node_modules/rc-select/lib/Selector/MultipleSelector.js
generated
vendored
Normal file
224
web/node_modules/rc-select/lib/Selector/MultipleSelector.js
generated
vendored
Normal file
@@ -0,0 +1,224 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
|
||||
var _classnames = _interopRequireDefault(require("classnames"));
|
||||
|
||||
var _CSSMotionList = _interopRequireDefault(require("rc-animate/lib/CSSMotionList"));
|
||||
|
||||
var _TransBtn = _interopRequireDefault(require("../TransBtn"));
|
||||
|
||||
var _Input = _interopRequireDefault(require("./Input"));
|
||||
|
||||
var _useLayoutEffect = _interopRequireDefault(require("../hooks/useLayoutEffect"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
var REST_TAG_KEY = '__RC_SELECT_MAX_REST_COUNT__';
|
||||
|
||||
var SelectSelector = function SelectSelector(_ref) {
|
||||
var id = _ref.id,
|
||||
prefixCls = _ref.prefixCls,
|
||||
values = _ref.values,
|
||||
open = _ref.open,
|
||||
searchValue = _ref.searchValue,
|
||||
inputRef = _ref.inputRef,
|
||||
placeholder = _ref.placeholder,
|
||||
disabled = _ref.disabled,
|
||||
mode = _ref.mode,
|
||||
showSearch = _ref.showSearch,
|
||||
autoFocus = _ref.autoFocus,
|
||||
autoComplete = _ref.autoComplete,
|
||||
accessibilityIndex = _ref.accessibilityIndex,
|
||||
tabIndex = _ref.tabIndex,
|
||||
removeIcon = _ref.removeIcon,
|
||||
choiceTransitionName = _ref.choiceTransitionName,
|
||||
maxTagCount = _ref.maxTagCount,
|
||||
maxTagTextLength = _ref.maxTagTextLength,
|
||||
_ref$maxTagPlaceholde = _ref.maxTagPlaceholder,
|
||||
maxTagPlaceholder = _ref$maxTagPlaceholde === void 0 ? function (omittedValues) {
|
||||
return "+ ".concat(omittedValues.length, " ...");
|
||||
} : _ref$maxTagPlaceholde,
|
||||
tagRender = _ref.tagRender,
|
||||
onSelect = _ref.onSelect,
|
||||
onInputChange = _ref.onInputChange,
|
||||
onInputPaste = _ref.onInputPaste,
|
||||
onInputKeyDown = _ref.onInputKeyDown,
|
||||
onInputMouseDown = _ref.onInputMouseDown;
|
||||
|
||||
var _React$useState = _react.default.useState(false),
|
||||
_React$useState2 = _slicedToArray(_React$useState, 2),
|
||||
motionAppear = _React$useState2[0],
|
||||
setMotionAppear = _React$useState2[1];
|
||||
|
||||
var measureRef = _react.default.useRef(null);
|
||||
|
||||
var _React$useState3 = _react.default.useState(0),
|
||||
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
||||
inputWidth = _React$useState4[0],
|
||||
setInputWidth = _React$useState4[1]; // ===================== Motion ======================
|
||||
|
||||
|
||||
_react.default.useEffect(function () {
|
||||
setMotionAppear(true);
|
||||
}, []); // ===================== Search ======================
|
||||
|
||||
|
||||
var inputValue = open ? searchValue : '';
|
||||
var inputEditable = mode === 'tags' || open && showSearch; // We measure width and set to the input immediately
|
||||
|
||||
(0, _useLayoutEffect.default)(function () {
|
||||
setInputWidth(measureRef.current.scrollWidth);
|
||||
}, [inputValue]); // ==================== Selection ====================
|
||||
|
||||
var displayValues = values; // Cut by `maxTagCount`
|
||||
|
||||
var restCount;
|
||||
|
||||
if (typeof maxTagCount === 'number') {
|
||||
restCount = values.length - maxTagCount;
|
||||
displayValues = values.slice(0, maxTagCount);
|
||||
} // Update by `maxTagTextLength`
|
||||
|
||||
|
||||
if (typeof maxTagTextLength === 'number') {
|
||||
displayValues = displayValues.map(function (_ref2) {
|
||||
var label = _ref2.label,
|
||||
rest = _objectWithoutProperties(_ref2, ["label"]);
|
||||
|
||||
var displayLabel = label;
|
||||
|
||||
if (typeof label === 'string' || typeof label === 'number') {
|
||||
var strLabel = String(displayLabel);
|
||||
|
||||
if (strLabel.length > maxTagTextLength) {
|
||||
displayLabel = "".concat(strLabel.slice(0, maxTagTextLength), "...");
|
||||
}
|
||||
}
|
||||
|
||||
return _objectSpread({}, rest, {
|
||||
label: displayLabel
|
||||
});
|
||||
});
|
||||
} // Fill rest
|
||||
|
||||
|
||||
if (restCount > 0) {
|
||||
displayValues.push({
|
||||
key: REST_TAG_KEY,
|
||||
label: typeof maxTagPlaceholder === 'function' ? maxTagPlaceholder(values.slice(maxTagCount)) : maxTagPlaceholder
|
||||
});
|
||||
}
|
||||
|
||||
var selectionNode = _react.default.createElement(_CSSMotionList.default, {
|
||||
component: false,
|
||||
keys: displayValues,
|
||||
motionName: choiceTransitionName,
|
||||
motionAppear: motionAppear
|
||||
}, function (_ref3) {
|
||||
var key = _ref3.key,
|
||||
label = _ref3.label,
|
||||
value = _ref3.value,
|
||||
itemDisabled = _ref3.disabled,
|
||||
className = _ref3.className,
|
||||
style = _ref3.style;
|
||||
var mergedKey = key || value;
|
||||
var closable = key !== REST_TAG_KEY && !itemDisabled;
|
||||
|
||||
var onMouseDown = function onMouseDown(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
};
|
||||
|
||||
var onClose = function onClose(event) {
|
||||
if (event) event.stopPropagation();
|
||||
onSelect(value, {
|
||||
selected: false
|
||||
});
|
||||
};
|
||||
|
||||
return typeof tagRender === 'function' ? _react.default.createElement("span", {
|
||||
key: mergedKey,
|
||||
onMouseDown: onMouseDown,
|
||||
className: className,
|
||||
style: style
|
||||
}, tagRender({
|
||||
label: label,
|
||||
value: value,
|
||||
disabled: itemDisabled,
|
||||
closable: closable,
|
||||
onClose: onClose
|
||||
})) : _react.default.createElement("span", {
|
||||
key: mergedKey,
|
||||
className: (0, _classnames.default)(className, "".concat(prefixCls, "-selection-item"), _defineProperty({}, "".concat(prefixCls, "-selection-item-disabled"), itemDisabled)),
|
||||
style: style
|
||||
}, _react.default.createElement("span", {
|
||||
className: "".concat(prefixCls, "-selection-item-content")
|
||||
}, label), closable && _react.default.createElement(_TransBtn.default, {
|
||||
className: "".concat(prefixCls, "-selection-item-remove"),
|
||||
onMouseDown: onMouseDown,
|
||||
onClick: onClose,
|
||||
customizeIcon: removeIcon
|
||||
}, "\xD7"));
|
||||
});
|
||||
|
||||
return _react.default.createElement(_react.default.Fragment, null, selectionNode, _react.default.createElement("span", {
|
||||
className: "".concat(prefixCls, "-selection-search"),
|
||||
style: {
|
||||
width: inputWidth
|
||||
}
|
||||
}, _react.default.createElement(_Input.default, {
|
||||
ref: inputRef,
|
||||
open: open,
|
||||
prefixCls: prefixCls,
|
||||
id: id,
|
||||
inputElement: null,
|
||||
disabled: disabled,
|
||||
autoFocus: autoFocus,
|
||||
autoComplete: autoComplete,
|
||||
editable: inputEditable,
|
||||
accessibilityIndex: accessibilityIndex,
|
||||
value: inputValue,
|
||||
onKeyDown: onInputKeyDown,
|
||||
onMouseDown: onInputMouseDown,
|
||||
onChange: onInputChange,
|
||||
onPaste: onInputPaste,
|
||||
tabIndex: tabIndex
|
||||
}), _react.default.createElement("span", {
|
||||
ref: measureRef,
|
||||
className: "".concat(prefixCls, "-selection-search-mirror"),
|
||||
"aria-hidden": true
|
||||
}, inputValue, "\xA0")), !values.length && !inputValue && _react.default.createElement("span", {
|
||||
className: "".concat(prefixCls, "-selection-placeholder")
|
||||
}, placeholder));
|
||||
};
|
||||
|
||||
var _default = SelectSelector;
|
||||
exports.default = _default;
|
||||
9
web/node_modules/rc-select/lib/Selector/SingleSelector.d.ts
generated
vendored
Normal file
9
web/node_modules/rc-select/lib/Selector/SingleSelector.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import React from 'react';
|
||||
import { InnerSelectorProps } from '.';
|
||||
interface SelectorProps extends InnerSelectorProps {
|
||||
inputElement: React.ReactElement;
|
||||
activeValue: string;
|
||||
backfill?: boolean;
|
||||
}
|
||||
declare const SingleSelector: React.FC<SelectorProps>;
|
||||
export default SingleSelector;
|
||||
78
web/node_modules/rc-select/lib/Selector/SingleSelector.js
generated
vendored
Normal file
78
web/node_modules/rc-select/lib/Selector/SingleSelector.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
|
||||
var _Input = _interopRequireDefault(require("./Input"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var SingleSelector = function SingleSelector(_ref) {
|
||||
var inputElement = _ref.inputElement,
|
||||
prefixCls = _ref.prefixCls,
|
||||
id = _ref.id,
|
||||
inputRef = _ref.inputRef,
|
||||
disabled = _ref.disabled,
|
||||
autoFocus = _ref.autoFocus,
|
||||
autoComplete = _ref.autoComplete,
|
||||
accessibilityIndex = _ref.accessibilityIndex,
|
||||
mode = _ref.mode,
|
||||
open = _ref.open,
|
||||
values = _ref.values,
|
||||
placeholder = _ref.placeholder,
|
||||
tabIndex = _ref.tabIndex,
|
||||
showSearch = _ref.showSearch,
|
||||
searchValue = _ref.searchValue,
|
||||
activeValue = _ref.activeValue,
|
||||
onInputKeyDown = _ref.onInputKeyDown,
|
||||
onInputMouseDown = _ref.onInputMouseDown,
|
||||
onInputChange = _ref.onInputChange,
|
||||
onInputPaste = _ref.onInputPaste;
|
||||
var combobox = mode === 'combobox';
|
||||
var inputEditable = combobox || showSearch && open;
|
||||
var item = values[0];
|
||||
|
||||
var getDisplayValue = function getDisplayValue(value) {
|
||||
return value === null ? '' : String(value);
|
||||
};
|
||||
|
||||
var inputValue = searchValue;
|
||||
|
||||
if (combobox) {
|
||||
inputValue = item ? getDisplayValue(item.value) : activeValue || searchValue;
|
||||
} // Not show text when closed expect combobox mode
|
||||
|
||||
|
||||
var hasTextInput = mode !== 'combobox' && !open ? false : !!inputValue;
|
||||
return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement("span", {
|
||||
className: "".concat(prefixCls, "-selection-search")
|
||||
}, _react.default.createElement(_Input.default, {
|
||||
ref: inputRef,
|
||||
prefixCls: prefixCls,
|
||||
id: id,
|
||||
open: open,
|
||||
inputElement: inputElement,
|
||||
disabled: disabled,
|
||||
autoFocus: autoFocus,
|
||||
autoComplete: autoComplete,
|
||||
editable: inputEditable,
|
||||
accessibilityIndex: accessibilityIndex,
|
||||
value: inputValue,
|
||||
onKeyDown: onInputKeyDown,
|
||||
onMouseDown: onInputMouseDown,
|
||||
onChange: onInputChange,
|
||||
onPaste: onInputPaste,
|
||||
tabIndex: tabIndex
|
||||
})), !combobox && item && !hasTextInput && _react.default.createElement("span", {
|
||||
className: "".concat(prefixCls, "-selection-item")
|
||||
}, item.label), !item && !hasTextInput && _react.default.createElement("span", {
|
||||
className: "".concat(prefixCls, "-selection-placeholder")
|
||||
}, placeholder));
|
||||
};
|
||||
|
||||
var _default = SingleSelector;
|
||||
exports.default = _default;
|
||||
74
web/node_modules/rc-select/lib/Selector/index.d.ts
generated
vendored
Normal file
74
web/node_modules/rc-select/lib/Selector/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* Cursor rule:
|
||||
* 1. Only `showSearch` enabled
|
||||
* 2. Only `open` is `true`
|
||||
* 3. When typing, set `open` to `true` which hit rule of 2
|
||||
*
|
||||
* Accessibility:
|
||||
* - https://www.w3.org/TR/wai-aria-practices/examples/combobox/aria1.1pattern/listbox-combo.html
|
||||
*/
|
||||
import * as React from 'react';
|
||||
import { LabelValueType, RawValueType, CustomTagProps } from '../interface/generator';
|
||||
import { RenderNode, Mode } from '../interface';
|
||||
export interface InnerSelectorProps {
|
||||
prefixCls: string;
|
||||
id: string;
|
||||
mode: Mode;
|
||||
inputRef: React.Ref<HTMLInputElement | HTMLTextAreaElement>;
|
||||
placeholder?: React.ReactNode;
|
||||
disabled?: boolean;
|
||||
autoFocus?: boolean;
|
||||
autoComplete?: string;
|
||||
values: LabelValueType[];
|
||||
showSearch?: boolean;
|
||||
searchValue: string;
|
||||
accessibilityIndex: number;
|
||||
open: boolean;
|
||||
tabIndex?: number;
|
||||
onInputKeyDown: React.KeyboardEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
||||
onInputMouseDown: React.MouseEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
||||
onInputChange: React.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
||||
onInputPaste: React.ClipboardEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
||||
}
|
||||
export interface RefSelectorProps {
|
||||
focus: () => void;
|
||||
blur: () => void;
|
||||
}
|
||||
export interface SelectorProps {
|
||||
id: string;
|
||||
prefixCls: string;
|
||||
showSearch?: boolean;
|
||||
open: boolean;
|
||||
/** Display in the Selector value, it's not same as `value` prop */
|
||||
values: LabelValueType[];
|
||||
multiple: boolean;
|
||||
mode: Mode;
|
||||
searchValue: string;
|
||||
activeValue: string;
|
||||
inputElement: JSX.Element;
|
||||
autoFocus?: boolean;
|
||||
accessibilityIndex: number;
|
||||
tabIndex?: number;
|
||||
disabled?: boolean;
|
||||
placeholder?: React.ReactNode;
|
||||
removeIcon?: RenderNode;
|
||||
maxTagCount?: number;
|
||||
maxTagTextLength?: number;
|
||||
maxTagPlaceholder?: React.ReactNode | ((omittedValues: LabelValueType[]) => React.ReactNode);
|
||||
tagRender?: (props: CustomTagProps) => React.ReactElement;
|
||||
choiceTransitionName?: string;
|
||||
onToggleOpen: (open?: boolean) => void;
|
||||
/** `onSearch` returns go next step boolean to check if need do toggle open */
|
||||
onSearch: (searchValue: string) => boolean;
|
||||
onSelect: (value: RawValueType, option: {
|
||||
selected: boolean;
|
||||
}) => void;
|
||||
onInputKeyDown?: React.KeyboardEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
||||
/**
|
||||
* @private get real dom for trigger align.
|
||||
* This may be removed after React provides replacement of `findDOMNode`
|
||||
*/
|
||||
domRef: React.Ref<HTMLDivElement>;
|
||||
}
|
||||
declare const ForwardSelector: React.ForwardRefExoticComponent<SelectorProps & React.RefAttributes<RefSelectorProps>>;
|
||||
export default ForwardSelector;
|
||||
168
web/node_modules/rc-select/lib/Selector/index.js
generated
vendored
Normal file
168
web/node_modules/rc-select/lib/Selector/index.js
generated
vendored
Normal file
@@ -0,0 +1,168 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _KeyCode = _interopRequireDefault(require("rc-util/lib/KeyCode"));
|
||||
|
||||
var _MultipleSelector = _interopRequireDefault(require("./MultipleSelector"));
|
||||
|
||||
var _SingleSelector = _interopRequireDefault(require("./SingleSelector"));
|
||||
|
||||
var _useLock3 = _interopRequireDefault(require("../hooks/useLock"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
var Selector = function Selector(props, ref) {
|
||||
var inputRef = React.useRef(null);
|
||||
var prefixCls = props.prefixCls,
|
||||
multiple = props.multiple,
|
||||
open = props.open,
|
||||
mode = props.mode,
|
||||
showSearch = props.showSearch,
|
||||
onSearch = props.onSearch,
|
||||
onToggleOpen = props.onToggleOpen,
|
||||
onInputKeyDown = props.onInputKeyDown,
|
||||
domRef = props.domRef; // ======================= Ref =======================
|
||||
|
||||
React.useImperativeHandle(ref, function () {
|
||||
return {
|
||||
focus: function focus() {
|
||||
inputRef.current.focus();
|
||||
},
|
||||
blur: function blur() {
|
||||
inputRef.current.blur();
|
||||
}
|
||||
};
|
||||
}); // ====================== Input ======================
|
||||
|
||||
var _useLock = (0, _useLock3.default)(0),
|
||||
_useLock2 = _slicedToArray(_useLock, 2),
|
||||
getInputMouseDown = _useLock2[0],
|
||||
setInputMouseDown = _useLock2[1];
|
||||
|
||||
var onInternalInputKeyDown = function onInternalInputKeyDown(event) {
|
||||
var which = event.which;
|
||||
|
||||
if (which === _KeyCode.default.UP || which === _KeyCode.default.DOWN) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
if (onInputKeyDown) {
|
||||
onInputKeyDown(event);
|
||||
}
|
||||
|
||||
if (![_KeyCode.default.SHIFT, _KeyCode.default.TAB, _KeyCode.default.BACKSPACE, _KeyCode.default.ESC].includes(which)) {
|
||||
onToggleOpen(true);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* We can not use `findDOMNode` sine it will get warning,
|
||||
* have to use timer to check if is input element.
|
||||
*/
|
||||
|
||||
|
||||
var onInternalInputMouseDown = function onInternalInputMouseDown() {
|
||||
setInputMouseDown(true);
|
||||
}; // When paste come, ignore next onChange
|
||||
|
||||
|
||||
var pasteClearRef = React.useRef(false);
|
||||
|
||||
var triggerOnSearch = function triggerOnSearch(value) {
|
||||
if (onSearch(value) !== false) {
|
||||
onToggleOpen(true);
|
||||
}
|
||||
};
|
||||
|
||||
var onInputChange = function onInputChange(_ref) {
|
||||
var value = _ref.target.value;
|
||||
|
||||
if (pasteClearRef.current) {
|
||||
pasteClearRef.current = false;
|
||||
return;
|
||||
}
|
||||
|
||||
triggerOnSearch(value);
|
||||
};
|
||||
|
||||
var onInputPaste = function onInputPaste(e) {
|
||||
var clipboardData = e.clipboardData;
|
||||
var value = clipboardData.getData('text'); // Block next onChange
|
||||
|
||||
pasteClearRef.current = true;
|
||||
setTimeout(function () {
|
||||
pasteClearRef.current = false;
|
||||
});
|
||||
triggerOnSearch(value);
|
||||
}; // ====================== Focus ======================
|
||||
// Should focus input if click the selector
|
||||
|
||||
|
||||
var onClick = function onClick(_ref2) {
|
||||
var target = _ref2.target;
|
||||
|
||||
if (target !== inputRef.current) {
|
||||
inputRef.current.focus();
|
||||
}
|
||||
};
|
||||
|
||||
var onMouseDown = function onMouseDown(event) {
|
||||
var inputMouseDown = getInputMouseDown();
|
||||
|
||||
if (event.target !== inputRef.current && !inputMouseDown) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
if (mode !== 'combobox' && (!showSearch || !inputMouseDown) || !open) {
|
||||
if (open) {
|
||||
onSearch('');
|
||||
}
|
||||
|
||||
onToggleOpen();
|
||||
}
|
||||
}; // ================= Inner Selector ==================
|
||||
|
||||
|
||||
var sharedProps = {
|
||||
inputRef: inputRef,
|
||||
onInputKeyDown: onInternalInputKeyDown,
|
||||
onInputMouseDown: onInternalInputMouseDown,
|
||||
onInputChange: onInputChange,
|
||||
onInputPaste: onInputPaste
|
||||
};
|
||||
var selectNode = multiple ? React.createElement(_MultipleSelector.default, Object.assign({}, props, sharedProps)) : React.createElement(_SingleSelector.default, Object.assign({}, props, sharedProps));
|
||||
return React.createElement("div", {
|
||||
ref: domRef,
|
||||
className: "".concat(prefixCls, "-selector"),
|
||||
onClick: onClick,
|
||||
onMouseDown: onMouseDown
|
||||
}, selectNode);
|
||||
};
|
||||
|
||||
var ForwardSelector = React.forwardRef(Selector);
|
||||
ForwardSelector.displayName = 'Selector';
|
||||
var _default = ForwardSelector;
|
||||
exports.default = _default;
|
||||
12
web/node_modules/rc-select/lib/TransBtn.d.ts
generated
vendored
Normal file
12
web/node_modules/rc-select/lib/TransBtn.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import * as React from 'react';
|
||||
import { RenderNode } from './interface';
|
||||
export interface TransBtnProps {
|
||||
className: string;
|
||||
customizeIcon: RenderNode;
|
||||
customizeIconProps?: any;
|
||||
onMouseDown?: React.MouseEventHandler<HTMLSpanElement>;
|
||||
onClick?: React.MouseEventHandler<HTMLSpanElement>;
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
declare const TransBtn: React.FC<TransBtnProps>;
|
||||
export default TransBtn;
|
||||
59
web/node_modules/rc-select/lib/TransBtn.js
generated
vendored
Normal file
59
web/node_modules/rc-select/lib/TransBtn.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _classnames = _interopRequireDefault(require("classnames"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
var TransBtn = function TransBtn(_ref) {
|
||||
var className = _ref.className,
|
||||
customizeIcon = _ref.customizeIcon,
|
||||
customizeIconProps = _ref.customizeIconProps,
|
||||
_onMouseDown = _ref.onMouseDown,
|
||||
onClick = _ref.onClick,
|
||||
children = _ref.children;
|
||||
var icon;
|
||||
|
||||
if (typeof customizeIcon === 'function') {
|
||||
icon = customizeIcon(customizeIconProps);
|
||||
} else {
|
||||
icon = customizeIcon;
|
||||
}
|
||||
|
||||
return React.createElement("span", {
|
||||
className: className,
|
||||
onMouseDown: function onMouseDown(event) {
|
||||
event.preventDefault();
|
||||
|
||||
if (_onMouseDown) {
|
||||
_onMouseDown(event);
|
||||
}
|
||||
},
|
||||
style: {
|
||||
userSelect: 'none',
|
||||
WebkitUserSelect: 'none'
|
||||
},
|
||||
unselectable: "on",
|
||||
onClick: onClick,
|
||||
"aria-hidden": true
|
||||
}, icon !== undefined ? icon : React.createElement("span", {
|
||||
className: (0, _classnames.default)(className.split(/\s+/).map(function (cls) {
|
||||
return "".concat(cls, "-icon");
|
||||
}))
|
||||
}, children));
|
||||
};
|
||||
|
||||
var _default = TransBtn;
|
||||
exports.default = _default;
|
||||
134
web/node_modules/rc-select/lib/generate.d.ts
generated
vendored
Normal file
134
web/node_modules/rc-select/lib/generate.d.ts
generated
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
/**
|
||||
* To match accessibility requirement, we always provide an input in the component.
|
||||
* Other element will not set `tabIndex` to avoid `onBlur` sequence problem.
|
||||
* For focused select, we set `aria-live="polite"` to update the accessibility content.
|
||||
*
|
||||
* ref:
|
||||
* - keyboard: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role#Keyboard_interactions
|
||||
*/
|
||||
import * as React from 'react';
|
||||
import { RenderNode, Mode, RenderDOMFunc } from './interface';
|
||||
import { GetLabeledValue, FilterOptions, FilterFunc, DefaultValueType, RawValueType, LabelValueType, Key, FlattenOptionsType, SingleType, OnClear, SelectSource, CustomTagProps } from './interface/generator';
|
||||
import { OptionListProps, RefOptionListProps } from './OptionList';
|
||||
export interface RefSelectProps {
|
||||
focus: () => void;
|
||||
blur: () => void;
|
||||
}
|
||||
export interface SelectProps<OptionsType extends object[], ValueType> extends React.AriaAttributes {
|
||||
prefixCls?: string;
|
||||
id?: string;
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
options?: OptionsType;
|
||||
children?: React.ReactNode;
|
||||
mode?: Mode;
|
||||
value?: ValueType;
|
||||
defaultValue?: ValueType;
|
||||
labelInValue?: boolean;
|
||||
inputValue?: string;
|
||||
searchValue?: string;
|
||||
optionFilterProp?: string;
|
||||
/**
|
||||
* In Select, `false` means do nothing.
|
||||
* In TreeSelect, `false` will highlight match item.
|
||||
* It's by design.
|
||||
*/
|
||||
filterOption?: boolean | FilterFunc<OptionsType[number]>;
|
||||
showSearch?: boolean;
|
||||
autoClearSearchValue?: boolean;
|
||||
onSearch?: (value: string) => void;
|
||||
allowClear?: boolean;
|
||||
clearIcon?: React.ReactNode;
|
||||
showArrow?: boolean;
|
||||
inputIcon?: RenderNode;
|
||||
removeIcon?: React.ReactNode;
|
||||
menuItemSelectedIcon?: RenderNode;
|
||||
open?: boolean;
|
||||
defaultOpen?: boolean;
|
||||
listHeight?: number;
|
||||
listItemHeight?: number;
|
||||
dropdownStyle?: React.CSSProperties;
|
||||
dropdownClassName?: string;
|
||||
dropdownMatchSelectWidth?: boolean | number;
|
||||
virtual?: boolean;
|
||||
dropdownRender?: (menu: React.ReactElement) => React.ReactElement;
|
||||
dropdownAlign?: any;
|
||||
animation?: string;
|
||||
transitionName?: string;
|
||||
getPopupContainer?: RenderDOMFunc;
|
||||
direction?: string;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
autoFocus?: boolean;
|
||||
defaultActiveFirstOption?: boolean;
|
||||
notFoundContent?: React.ReactNode;
|
||||
placeholder?: React.ReactNode;
|
||||
backfill?: boolean;
|
||||
getInputElement?: () => JSX.Element;
|
||||
optionLabelProp?: string;
|
||||
maxTagTextLength?: number;
|
||||
maxTagCount?: number;
|
||||
maxTagPlaceholder?: React.ReactNode | ((omittedValues: LabelValueType[]) => React.ReactNode);
|
||||
tokenSeparators?: string[];
|
||||
tagRender?: (props: CustomTagProps) => React.ReactElement;
|
||||
showAction?: ('focus' | 'click')[];
|
||||
tabIndex?: number;
|
||||
onKeyUp?: React.KeyboardEventHandler<HTMLDivElement>;
|
||||
onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
|
||||
onPopupScroll?: React.UIEventHandler<HTMLDivElement>;
|
||||
onDropdownVisibleChange?: (open: boolean) => void;
|
||||
onSelect?: (value: SingleType<ValueType>, option: OptionsType[number]) => void;
|
||||
onDeselect?: (value: SingleType<ValueType>, option: OptionsType[number]) => void;
|
||||
onInputKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
||||
onClick?: React.MouseEventHandler;
|
||||
onChange?: (value: ValueType, option: OptionsType[number] | OptionsType) => void;
|
||||
onBlur?: React.FocusEventHandler<HTMLElement>;
|
||||
onFocus?: React.FocusEventHandler<HTMLElement>;
|
||||
onMouseDown?: React.MouseEventHandler<HTMLDivElement>;
|
||||
onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
|
||||
onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
|
||||
choiceTransitionName?: string;
|
||||
/**
|
||||
* Only used in current version for internal event process.
|
||||
* Do not use in production environment.
|
||||
*/
|
||||
internalProps?: {
|
||||
mark?: string;
|
||||
onClear?: OnClear;
|
||||
skipTriggerChange?: boolean;
|
||||
skipTriggerSelect?: boolean;
|
||||
onRawSelect?: (value: RawValueType, option: OptionsType[number], source: SelectSource) => void;
|
||||
onRawDeselect?: (value: RawValueType, option: OptionsType[number], source: SelectSource) => void;
|
||||
};
|
||||
}
|
||||
export interface GenerateConfig<OptionsType extends object[]> {
|
||||
prefixCls: string;
|
||||
components: {
|
||||
optionList: React.ForwardRefExoticComponent<React.PropsWithoutRef<Omit<OptionListProps<OptionsType>, 'options'> & {
|
||||
options: OptionsType;
|
||||
}> & React.RefAttributes<RefOptionListProps>>;
|
||||
};
|
||||
/** Convert jsx tree into `OptionsType` */
|
||||
convertChildrenToData: (children: React.ReactNode) => OptionsType;
|
||||
/** Flatten nest options into raw option list */
|
||||
flattenOptions: (options: OptionsType, props: any) => FlattenOptionsType<OptionsType>;
|
||||
/** Convert single raw value into { label, value } format. Will be called by each value */
|
||||
getLabeledValue: GetLabeledValue<FlattenOptionsType<OptionsType>>;
|
||||
filterOptions: FilterOptions<OptionsType>;
|
||||
findValueOption: (values: RawValueType[], options: FlattenOptionsType<OptionsType>) => OptionsType;
|
||||
/** Check if a value is disabled */
|
||||
isValueDisabled: (value: RawValueType, options: FlattenOptionsType<OptionsType>) => boolean;
|
||||
warningProps?: (props: any) => void;
|
||||
fillOptionsWithMissingValue?: (options: OptionsType, value: DefaultValueType, optionLabelProp: string, labelInValue: boolean) => OptionsType;
|
||||
omitDOMProps?: (props: object) => object;
|
||||
}
|
||||
/**
|
||||
* This function is in internal usage.
|
||||
* Do not use it in your prod env since we may refactor this.
|
||||
*/
|
||||
export default function generateSelector<OptionsType extends {
|
||||
value?: RawValueType;
|
||||
label?: React.ReactNode;
|
||||
key?: Key;
|
||||
disabled?: boolean;
|
||||
}[]>(config: GenerateConfig<OptionsType>): React.ForwardRefExoticComponent<SelectProps<OptionsType, DefaultValueType> & React.RefAttributes<RefSelectProps>>;
|
||||
841
web/node_modules/rc-select/lib/generate.js
generated
vendored
Normal file
841
web/node_modules/rc-select/lib/generate.js
generated
vendored
Normal file
@@ -0,0 +1,841 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = generateSelector;
|
||||
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _KeyCode = _interopRequireDefault(require("rc-util/lib/KeyCode"));
|
||||
|
||||
var _classnames = _interopRequireDefault(require("classnames"));
|
||||
|
||||
var _useMergedState3 = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState"));
|
||||
|
||||
var _Selector = _interopRequireDefault(require("./Selector"));
|
||||
|
||||
var _SelectTrigger = _interopRequireDefault(require("./SelectTrigger"));
|
||||
|
||||
var _generator = require("./interface/generator");
|
||||
|
||||
var _commonUtil = require("./utils/commonUtil");
|
||||
|
||||
var _TransBtn = _interopRequireDefault(require("./TransBtn"));
|
||||
|
||||
var _useLock3 = _interopRequireDefault(require("./hooks/useLock"));
|
||||
|
||||
var _useDelayReset3 = _interopRequireDefault(require("./hooks/useDelayReset"));
|
||||
|
||||
var _useLayoutEffect = _interopRequireDefault(require("./hooks/useLayoutEffect"));
|
||||
|
||||
var _valueUtil = require("./utils/valueUtil");
|
||||
|
||||
var _useSelectTriggerControl = _interopRequireDefault(require("./hooks/useSelectTriggerControl"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
||||
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
|
||||
var DEFAULT_OMIT_PROPS = ['removeIcon', 'placeholder', 'autoFocus', 'maxTagCount', 'maxTagTextLength', 'maxTagPlaceholder', 'choiceTransitionName', 'onInputKeyDown'];
|
||||
/**
|
||||
* This function is in internal usage.
|
||||
* Do not use it in your prod env since we may refactor this.
|
||||
*/
|
||||
|
||||
function generateSelector(config) {
|
||||
var defaultPrefixCls = config.prefixCls,
|
||||
OptionList = config.components.optionList,
|
||||
convertChildrenToData = config.convertChildrenToData,
|
||||
flattenOptions = config.flattenOptions,
|
||||
getLabeledValue = config.getLabeledValue,
|
||||
filterOptions = config.filterOptions,
|
||||
isValueDisabled = config.isValueDisabled,
|
||||
findValueOption = config.findValueOption,
|
||||
warningProps = config.warningProps,
|
||||
fillOptionsWithMissingValue = config.fillOptionsWithMissingValue,
|
||||
omitDOMProps = config.omitDOMProps; // Use raw define since `React.FC` not support generic
|
||||
|
||||
function Select(props, ref) {
|
||||
var _classNames2;
|
||||
|
||||
var _props$prefixCls = props.prefixCls,
|
||||
prefixCls = _props$prefixCls === void 0 ? defaultPrefixCls : _props$prefixCls,
|
||||
className = props.className,
|
||||
id = props.id,
|
||||
open = props.open,
|
||||
defaultOpen = props.defaultOpen,
|
||||
options = props.options,
|
||||
children = props.children,
|
||||
mode = props.mode,
|
||||
value = props.value,
|
||||
defaultValue = props.defaultValue,
|
||||
labelInValue = props.labelInValue,
|
||||
showSearch = props.showSearch,
|
||||
inputValue = props.inputValue,
|
||||
searchValue = props.searchValue,
|
||||
filterOption = props.filterOption,
|
||||
_props$optionFilterPr = props.optionFilterProp,
|
||||
optionFilterProp = _props$optionFilterPr === void 0 ? 'value' : _props$optionFilterPr,
|
||||
_props$autoClearSearc = props.autoClearSearchValue,
|
||||
autoClearSearchValue = _props$autoClearSearc === void 0 ? true : _props$autoClearSearc,
|
||||
onSearch = props.onSearch,
|
||||
allowClear = props.allowClear,
|
||||
clearIcon = props.clearIcon,
|
||||
showArrow = props.showArrow,
|
||||
inputIcon = props.inputIcon,
|
||||
menuItemSelectedIcon = props.menuItemSelectedIcon,
|
||||
disabled = props.disabled,
|
||||
loading = props.loading,
|
||||
defaultActiveFirstOption = props.defaultActiveFirstOption,
|
||||
_props$notFoundConten = props.notFoundContent,
|
||||
notFoundContent = _props$notFoundConten === void 0 ? 'Not Found' : _props$notFoundConten,
|
||||
optionLabelProp = props.optionLabelProp,
|
||||
backfill = props.backfill,
|
||||
getInputElement = props.getInputElement,
|
||||
getPopupContainer = props.getPopupContainer,
|
||||
_props$listHeight = props.listHeight,
|
||||
listHeight = _props$listHeight === void 0 ? 200 : _props$listHeight,
|
||||
_props$listItemHeight = props.listItemHeight,
|
||||
listItemHeight = _props$listItemHeight === void 0 ? 20 : _props$listItemHeight,
|
||||
animation = props.animation,
|
||||
transitionName = props.transitionName,
|
||||
virtual = props.virtual,
|
||||
dropdownStyle = props.dropdownStyle,
|
||||
dropdownClassName = props.dropdownClassName,
|
||||
dropdownMatchSelectWidth = props.dropdownMatchSelectWidth,
|
||||
dropdownRender = props.dropdownRender,
|
||||
dropdownAlign = props.dropdownAlign,
|
||||
_props$showAction = props.showAction,
|
||||
showAction = _props$showAction === void 0 ? [] : _props$showAction,
|
||||
direction = props.direction,
|
||||
tokenSeparators = props.tokenSeparators,
|
||||
tagRender = props.tagRender,
|
||||
onPopupScroll = props.onPopupScroll,
|
||||
onDropdownVisibleChange = props.onDropdownVisibleChange,
|
||||
onFocus = props.onFocus,
|
||||
onBlur = props.onBlur,
|
||||
onKeyUp = props.onKeyUp,
|
||||
onKeyDown = props.onKeyDown,
|
||||
onMouseDown = props.onMouseDown,
|
||||
onChange = props.onChange,
|
||||
onSelect = props.onSelect,
|
||||
onDeselect = props.onDeselect,
|
||||
_props$internalProps = props.internalProps,
|
||||
internalProps = _props$internalProps === void 0 ? {} : _props$internalProps,
|
||||
restProps = _objectWithoutProperties(props, ["prefixCls", "className", "id", "open", "defaultOpen", "options", "children", "mode", "value", "defaultValue", "labelInValue", "showSearch", "inputValue", "searchValue", "filterOption", "optionFilterProp", "autoClearSearchValue", "onSearch", "allowClear", "clearIcon", "showArrow", "inputIcon", "menuItemSelectedIcon", "disabled", "loading", "defaultActiveFirstOption", "notFoundContent", "optionLabelProp", "backfill", "getInputElement", "getPopupContainer", "listHeight", "listItemHeight", "animation", "transitionName", "virtual", "dropdownStyle", "dropdownClassName", "dropdownMatchSelectWidth", "dropdownRender", "dropdownAlign", "showAction", "direction", "tokenSeparators", "tagRender", "onPopupScroll", "onDropdownVisibleChange", "onFocus", "onBlur", "onKeyUp", "onKeyDown", "onMouseDown", "onChange", "onSelect", "onDeselect", "internalProps"]);
|
||||
|
||||
var useInternalProps = internalProps.mark === _generator.INTERNAL_PROPS_MARK;
|
||||
var domProps = omitDOMProps ? omitDOMProps(restProps) : restProps;
|
||||
DEFAULT_OMIT_PROPS.forEach(function (prop) {
|
||||
delete domProps[prop];
|
||||
});
|
||||
var containerRef = React.useRef(null);
|
||||
var triggerRef = React.useRef(null);
|
||||
var selectorRef = React.useRef(null);
|
||||
var listRef = React.useRef(null);
|
||||
/** Used for component focused management */
|
||||
|
||||
var _useDelayReset = (0, _useDelayReset3.default)(),
|
||||
_useDelayReset2 = _slicedToArray(_useDelayReset, 3),
|
||||
mockFocused = _useDelayReset2[0],
|
||||
setMockFocused = _useDelayReset2[1],
|
||||
cancelSetMockFocused = _useDelayReset2[2]; // Inner id for accessibility usage. Only work in client side
|
||||
|
||||
|
||||
var _React$useState = React.useState(),
|
||||
_React$useState2 = _slicedToArray(_React$useState, 2),
|
||||
innerId = _React$useState2[0],
|
||||
setInnerId = _React$useState2[1];
|
||||
|
||||
React.useEffect(function () {
|
||||
setInnerId("rc_select_".concat((0, _commonUtil.getUUID)()));
|
||||
}, []);
|
||||
var mergedId = id || innerId; // optionLabelProp
|
||||
|
||||
var mergedOptionLabelProp = optionLabelProp;
|
||||
|
||||
if (mergedOptionLabelProp === undefined) {
|
||||
mergedOptionLabelProp = options ? 'label' : 'children';
|
||||
} // labelInValue
|
||||
|
||||
|
||||
var mergedLabelInValue = mode === 'combobox' ? false : labelInValue;
|
||||
var isMultiple = mode === 'tags' || mode === 'multiple';
|
||||
var mergedShowSearch = showSearch !== undefined ? showSearch : isMultiple || mode === 'combobox'; // ============================== Ref ===============================
|
||||
|
||||
var selectorDomRef = React.useRef(null);
|
||||
React.useImperativeHandle(ref, function () {
|
||||
return {
|
||||
focus: selectorRef.current.focus,
|
||||
blur: selectorRef.current.blur
|
||||
};
|
||||
}); // ============================= Value ==============================
|
||||
|
||||
var _React$useState3 = React.useState(value || defaultValue),
|
||||
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
||||
innerValue = _React$useState4[0],
|
||||
setInnerValue = _React$useState4[1];
|
||||
|
||||
var baseValue = value !== undefined ? value : innerValue; // Should reset when controlled to be uncontrolled
|
||||
|
||||
var prevValueRef = React.useRef(value);
|
||||
React.useEffect(function () {
|
||||
if (prevValueRef.current !== value && (value === undefined || value === null)) {
|
||||
setInnerValue(undefined);
|
||||
}
|
||||
|
||||
prevValueRef.current = value;
|
||||
}, [value]);
|
||||
/** Unique raw values */
|
||||
|
||||
var mergedRawValue = React.useMemo(function () {
|
||||
return (0, _commonUtil.toInnerValue)(baseValue, {
|
||||
labelInValue: mergedLabelInValue,
|
||||
combobox: mode === 'combobox'
|
||||
});
|
||||
}, [baseValue, mergedLabelInValue]);
|
||||
/** We cache a set of raw values to speed up check */
|
||||
|
||||
var rawValues = React.useMemo(function () {
|
||||
return new Set(mergedRawValue);
|
||||
}, [mergedRawValue]); // ============================= Option =============================
|
||||
// Set by option list active, it will merge into search input when mode is `combobox`
|
||||
|
||||
var _React$useState5 = React.useState(null),
|
||||
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
||||
activeValue = _React$useState6[0],
|
||||
setActiveValue = _React$useState6[1];
|
||||
|
||||
var _React$useState7 = React.useState(''),
|
||||
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
||||
innerSearchValue = _React$useState8[0],
|
||||
setInnerSearchValue = _React$useState8[1];
|
||||
|
||||
var mergedSearchValue = innerSearchValue;
|
||||
|
||||
if (mode === 'combobox' && value !== undefined) {
|
||||
mergedSearchValue = value;
|
||||
} else if (searchValue !== undefined) {
|
||||
mergedSearchValue = searchValue;
|
||||
} else if (inputValue) {
|
||||
mergedSearchValue = inputValue;
|
||||
}
|
||||
|
||||
var mergedOptions = React.useMemo(function () {
|
||||
var newOptions = options;
|
||||
|
||||
if (newOptions === undefined) {
|
||||
newOptions = convertChildrenToData(children);
|
||||
}
|
||||
/**
|
||||
* `tags` should fill un-list item.
|
||||
* This is not cool here since TreeSelect do not need this
|
||||
*/
|
||||
|
||||
|
||||
if (mode === 'tags' && fillOptionsWithMissingValue) {
|
||||
newOptions = fillOptionsWithMissingValue(newOptions, baseValue, mergedOptionLabelProp, labelInValue);
|
||||
}
|
||||
|
||||
return newOptions || [];
|
||||
}, [options, children, mode, baseValue]);
|
||||
var mergedFlattenOptions = React.useMemo(function () {
|
||||
return flattenOptions(mergedOptions, props);
|
||||
}, [mergedOptions]); // Display options for OptionList
|
||||
|
||||
var displayOptions = React.useMemo(function () {
|
||||
if (!mergedSearchValue || !mergedShowSearch) {
|
||||
return _toConsumableArray(mergedOptions);
|
||||
}
|
||||
|
||||
var filteredOptions = filterOptions(mergedSearchValue, mergedOptions, {
|
||||
optionFilterProp: optionFilterProp,
|
||||
filterOption: mode === 'combobox' && filterOption === undefined ? function () {
|
||||
return true;
|
||||
} : filterOption
|
||||
});
|
||||
|
||||
if (mode === 'tags' && filteredOptions.every(function (opt) {
|
||||
return opt.value !== mergedSearchValue;
|
||||
})) {
|
||||
filteredOptions.unshift({
|
||||
value: mergedSearchValue,
|
||||
label: mergedSearchValue,
|
||||
key: '__RC_SELECT_TAG_PLACEHOLDER__'
|
||||
});
|
||||
}
|
||||
|
||||
return filteredOptions;
|
||||
}, [mergedOptions, mergedSearchValue, mode, mergedShowSearch]);
|
||||
var displayFlattenOptions = React.useMemo(function () {
|
||||
return flattenOptions(displayOptions, props);
|
||||
}, [displayOptions]);
|
||||
React.useEffect(function () {
|
||||
if (listRef.current && listRef.current.scrollTo) {
|
||||
listRef.current.scrollTo(0);
|
||||
}
|
||||
}, [mergedSearchValue]); // ============================ Selector ============================
|
||||
|
||||
var displayValues = React.useMemo(function () {
|
||||
return mergedRawValue.map(function (val) {
|
||||
var displayValue = getLabeledValue(val, {
|
||||
options: mergedFlattenOptions,
|
||||
prevValue: baseValue,
|
||||
labelInValue: mergedLabelInValue,
|
||||
optionLabelProp: mergedOptionLabelProp
|
||||
});
|
||||
return _objectSpread({}, displayValue, {
|
||||
disabled: isValueDisabled(val, mergedFlattenOptions)
|
||||
});
|
||||
});
|
||||
}, [baseValue, mergedOptions]);
|
||||
|
||||
var triggerSelect = function triggerSelect(newValue, isSelect, source) {
|
||||
var outOption = findValueOption([newValue], mergedFlattenOptions)[0];
|
||||
|
||||
if (!internalProps.skipTriggerSelect) {
|
||||
// Skip trigger `onSelect` or `onDeselect` if configured
|
||||
var selectValue = mergedLabelInValue ? getLabeledValue(newValue, {
|
||||
options: mergedFlattenOptions,
|
||||
prevValue: baseValue,
|
||||
labelInValue: mergedLabelInValue,
|
||||
optionLabelProp: mergedOptionLabelProp
|
||||
}) : newValue;
|
||||
|
||||
if (isSelect && onSelect) {
|
||||
onSelect(selectValue, outOption);
|
||||
} else if (!isSelect && onDeselect) {
|
||||
onDeselect(selectValue, outOption);
|
||||
}
|
||||
} // Trigger internal event
|
||||
|
||||
|
||||
if (useInternalProps) {
|
||||
if (isSelect && internalProps.onRawSelect) {
|
||||
internalProps.onRawSelect(newValue, outOption, source);
|
||||
} else if (!isSelect && internalProps.onRawDeselect) {
|
||||
internalProps.onRawDeselect(newValue, outOption, source);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var triggerChange = function triggerChange(newRawValues) {
|
||||
if (useInternalProps && internalProps.skipTriggerChange) {
|
||||
return;
|
||||
}
|
||||
|
||||
var outValues = (0, _commonUtil.toOuterValues)(Array.from(newRawValues), {
|
||||
labelInValue: mergedLabelInValue,
|
||||
options: mergedFlattenOptions,
|
||||
getLabeledValue: getLabeledValue,
|
||||
prevValue: baseValue,
|
||||
optionLabelProp: mergedOptionLabelProp
|
||||
});
|
||||
var outValue = isMultiple ? outValues : outValues[0]; // Skip trigger if prev & current value is both empty
|
||||
|
||||
if (onChange && (mergedRawValue.length !== 0 || outValues.length !== 0)) {
|
||||
var outOptions = findValueOption(newRawValues, mergedFlattenOptions);
|
||||
onChange(outValue, isMultiple ? outOptions : outOptions[0]);
|
||||
}
|
||||
|
||||
setInnerValue(outValue);
|
||||
};
|
||||
|
||||
var onInternalSelect = function onInternalSelect(newValue, _ref) {
|
||||
var selected = _ref.selected,
|
||||
source = _ref.source;
|
||||
|
||||
if (disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
var newRawValue;
|
||||
|
||||
if (isMultiple) {
|
||||
newRawValue = new Set(mergedRawValue);
|
||||
|
||||
if (selected) {
|
||||
newRawValue.add(newValue);
|
||||
} else {
|
||||
newRawValue.delete(newValue);
|
||||
}
|
||||
} else {
|
||||
newRawValue = new Set();
|
||||
newRawValue.add(newValue);
|
||||
} // Multiple always trigger change and single should change if value changed
|
||||
|
||||
|
||||
if (isMultiple || !isMultiple && Array.from(mergedRawValue)[0] !== newValue) {
|
||||
triggerChange(Array.from(newRawValue));
|
||||
} // Trigger `onSelect`. Single mode always trigger select
|
||||
|
||||
|
||||
triggerSelect(newValue, !isMultiple || selected, source); // Clean search value if single or configured
|
||||
|
||||
if (mode === 'combobox') {
|
||||
setInnerSearchValue(String(newValue));
|
||||
setActiveValue('');
|
||||
} else if (!isMultiple || autoClearSearchValue) {
|
||||
setInnerSearchValue('');
|
||||
setActiveValue('');
|
||||
}
|
||||
};
|
||||
|
||||
var onInternalOptionSelect = function onInternalOptionSelect(newValue, info) {
|
||||
onInternalSelect(newValue, _objectSpread({}, info, {
|
||||
source: 'option'
|
||||
}));
|
||||
};
|
||||
|
||||
var onInternalSelectionSelect = function onInternalSelectionSelect(newValue, info) {
|
||||
onInternalSelect(newValue, _objectSpread({}, info, {
|
||||
source: 'selection'
|
||||
}));
|
||||
}; // ============================= Input ==============================
|
||||
// Only works in `combobox`
|
||||
|
||||
|
||||
var customizeInputElement = mode === 'combobox' && getInputElement && getInputElement() || null; // ============================== Open ==============================
|
||||
|
||||
var _useMergedState = (0, _useMergedState3.default)(undefined, {
|
||||
defaultValue: defaultOpen,
|
||||
value: open
|
||||
}),
|
||||
_useMergedState2 = _slicedToArray(_useMergedState, 2),
|
||||
innerOpen = _useMergedState2[0],
|
||||
setInnerOpen = _useMergedState2[1];
|
||||
|
||||
var mergedOpen = innerOpen; // Not trigger `open` in `combobox` when `notFoundContent` is empty
|
||||
|
||||
var emptyListContent = !notFoundContent && !displayOptions.length;
|
||||
|
||||
if (disabled || emptyListContent && mergedOpen && mode === 'combobox') {
|
||||
mergedOpen = false;
|
||||
}
|
||||
|
||||
var triggerOpen = emptyListContent ? false : mergedOpen;
|
||||
|
||||
var onToggleOpen = function onToggleOpen(newOpen) {
|
||||
var nextOpen = newOpen !== undefined ? newOpen : !mergedOpen;
|
||||
|
||||
if (innerOpen !== nextOpen && !disabled) {
|
||||
setInnerOpen(nextOpen);
|
||||
|
||||
if (onDropdownVisibleChange) {
|
||||
onDropdownVisibleChange(nextOpen);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
(0, _useSelectTriggerControl.default)([containerRef.current, triggerRef.current && triggerRef.current.getPopupElement()], triggerOpen, onToggleOpen); // ============================= Search =============================
|
||||
|
||||
var triggerSearch = function triggerSearch(searchText) {
|
||||
var fromTyping = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
||||
var ret = true;
|
||||
var newSearchText = searchText;
|
||||
setActiveValue(null); // Check if match the `tokenSeparators`
|
||||
|
||||
var patchLabels = (0, _valueUtil.getSeparatedContent)(searchText, tokenSeparators);
|
||||
var patchRawValues = patchLabels;
|
||||
|
||||
if (mode === 'combobox') {
|
||||
// Only typing will trigger onChange
|
||||
if (fromTyping) {
|
||||
triggerChange([newSearchText]);
|
||||
}
|
||||
} else if (patchLabels) {
|
||||
newSearchText = '';
|
||||
|
||||
if (mode !== 'tags') {
|
||||
patchRawValues = patchLabels.map(function (label) {
|
||||
var item = mergedFlattenOptions.find(function (_ref2) {
|
||||
var data = _ref2.data;
|
||||
return data[mergedOptionLabelProp] === label;
|
||||
});
|
||||
return item ? item.data.value : null;
|
||||
}).filter(function (val) {
|
||||
return val !== null;
|
||||
});
|
||||
}
|
||||
|
||||
var newRawValues = Array.from(new Set([].concat(_toConsumableArray(mergedRawValue), _toConsumableArray(patchRawValues))));
|
||||
triggerChange(newRawValues);
|
||||
newRawValues.forEach(function (newRawValue) {
|
||||
triggerSelect(newRawValue, true, 'input');
|
||||
}); // Should close when paste finish
|
||||
|
||||
onToggleOpen(false); // Tell Selector that break next actions
|
||||
|
||||
ret = false;
|
||||
}
|
||||
|
||||
setInnerSearchValue(newSearchText);
|
||||
|
||||
if (onSearch && mergedSearchValue !== newSearchText) {
|
||||
onSearch(newSearchText);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}; // Close dropdown when disabled change
|
||||
|
||||
|
||||
React.useEffect(function () {
|
||||
if (innerOpen && !!disabled) {
|
||||
setInnerOpen(false);
|
||||
}
|
||||
}, [disabled]); // Close will clean up single mode search text
|
||||
|
||||
React.useEffect(function () {
|
||||
if (!mergedOpen && !isMultiple && mode !== 'combobox') {
|
||||
triggerSearch('', false);
|
||||
}
|
||||
}, [mergedOpen]); // ============================ Keyboard ============================
|
||||
|
||||
/**
|
||||
* We record input value here to check if can press to clean up by backspace
|
||||
* - null: Key is not down, this is reset by key up
|
||||
* - true: Search text is empty when first time backspace down
|
||||
* - false: Search text is not empty when first time backspace down
|
||||
*/
|
||||
|
||||
var _useLock = (0, _useLock3.default)(),
|
||||
_useLock2 = _slicedToArray(_useLock, 2),
|
||||
getClearLock = _useLock2[0],
|
||||
setClearLock = _useLock2[1]; // KeyDown
|
||||
|
||||
|
||||
var onInternalKeyDown = function onInternalKeyDown(event) {
|
||||
var clearLock = getClearLock();
|
||||
var which = event.which; // We only manage open state here, close logic should handle by list component
|
||||
|
||||
if (!mergedOpen && which === _KeyCode.default.ENTER) {
|
||||
onToggleOpen(true);
|
||||
}
|
||||
|
||||
setClearLock(!!mergedSearchValue); // Remove value by `backspace`
|
||||
|
||||
if (which === _KeyCode.default.BACKSPACE && !clearLock && isMultiple && !mergedSearchValue && mergedRawValue.length) {
|
||||
var removeInfo = (0, _commonUtil.removeLastEnabledValue)(displayValues, mergedRawValue);
|
||||
|
||||
if (removeInfo.removedValue !== null) {
|
||||
triggerChange(removeInfo.values);
|
||||
triggerSelect(removeInfo.removedValue, false, 'input');
|
||||
}
|
||||
}
|
||||
|
||||
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
rest[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
if (mergedOpen && listRef.current) {
|
||||
var _listRef$current;
|
||||
|
||||
(_listRef$current = listRef.current).onKeyDown.apply(_listRef$current, [event].concat(rest));
|
||||
}
|
||||
|
||||
if (onKeyDown) {
|
||||
onKeyDown.apply(void 0, [event].concat(rest));
|
||||
}
|
||||
}; // KeyUp
|
||||
|
||||
|
||||
var onInternalKeyUp = function onInternalKeyUp(event) {
|
||||
for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
||||
rest[_key2 - 1] = arguments[_key2];
|
||||
}
|
||||
|
||||
if (mergedOpen && listRef.current) {
|
||||
var _listRef$current2;
|
||||
|
||||
(_listRef$current2 = listRef.current).onKeyUp.apply(_listRef$current2, [event].concat(rest));
|
||||
}
|
||||
|
||||
if (onKeyUp) {
|
||||
onKeyUp.apply(void 0, [event].concat(rest));
|
||||
}
|
||||
}; // ========================== Focus / Blur ==========================
|
||||
|
||||
/** Record real focus status */
|
||||
|
||||
|
||||
var focusRef = React.useRef(false);
|
||||
|
||||
var onContainerFocus = function onContainerFocus() {
|
||||
setMockFocused(true);
|
||||
|
||||
if (!disabled) {
|
||||
if (onFocus && !focusRef.current) {
|
||||
onFocus.apply(void 0, arguments);
|
||||
} // `showAction` should handle `focus` if set
|
||||
|
||||
|
||||
if (showAction.includes('focus')) {
|
||||
onToggleOpen(true);
|
||||
}
|
||||
}
|
||||
|
||||
focusRef.current = true;
|
||||
};
|
||||
|
||||
var onContainerBlur = function onContainerBlur() {
|
||||
setMockFocused(false, function () {
|
||||
focusRef.current = false;
|
||||
onToggleOpen(false);
|
||||
});
|
||||
|
||||
if (disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mergedSearchValue) {
|
||||
// `tags` mode should move `searchValue` into values
|
||||
if (mode === 'tags') {
|
||||
triggerSearch('', false);
|
||||
triggerChange(Array.from(new Set([].concat(_toConsumableArray(mergedRawValue), [mergedSearchValue]))));
|
||||
} else if (mode === 'multiple') {
|
||||
// `multiple` mode only clean the search value but not trigger event
|
||||
setInnerSearchValue('');
|
||||
}
|
||||
}
|
||||
|
||||
if (onBlur) {
|
||||
onBlur.apply(void 0, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
var activeTimeoutIds = [];
|
||||
React.useEffect(function () {
|
||||
return function () {
|
||||
activeTimeoutIds.forEach(function (timeoutId) {
|
||||
return clearTimeout(timeoutId);
|
||||
});
|
||||
activeTimeoutIds.splice(0, activeTimeoutIds.length);
|
||||
};
|
||||
}, []);
|
||||
|
||||
var onInternalMouseDown = function onInternalMouseDown(event) {
|
||||
var target = event.target;
|
||||
var popupElement = triggerRef.current && triggerRef.current.getPopupElement(); // We should give focus back to selector if clicked item is not focusable
|
||||
|
||||
if (popupElement && popupElement.contains(target)) {
|
||||
var timeoutId = setTimeout(function () {
|
||||
var index = activeTimeoutIds.indexOf(timeoutId);
|
||||
|
||||
if (index !== -1) {
|
||||
activeTimeoutIds.splice(index, 1);
|
||||
}
|
||||
|
||||
cancelSetMockFocused();
|
||||
|
||||
if (!popupElement.contains(document.activeElement)) {
|
||||
selectorRef.current.focus();
|
||||
}
|
||||
});
|
||||
activeTimeoutIds.push(timeoutId);
|
||||
}
|
||||
|
||||
if (onMouseDown) {
|
||||
for (var _len3 = arguments.length, restArgs = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
||||
restArgs[_key3 - 1] = arguments[_key3];
|
||||
}
|
||||
|
||||
onMouseDown.apply(void 0, [event].concat(restArgs));
|
||||
}
|
||||
}; // ========================= Accessibility ==========================
|
||||
|
||||
|
||||
var _React$useState9 = React.useState(0),
|
||||
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
||||
accessibilityIndex = _React$useState10[0],
|
||||
setAccessibilityIndex = _React$useState10[1];
|
||||
|
||||
var mergedDefaultActiveFirstOption = defaultActiveFirstOption !== undefined ? defaultActiveFirstOption : mode !== 'combobox';
|
||||
|
||||
var onActiveValue = function onActiveValue(active, index) {
|
||||
setAccessibilityIndex(index);
|
||||
|
||||
if (backfill && mode === 'combobox' && active !== null) {
|
||||
setActiveValue(String(active));
|
||||
}
|
||||
}; // ============================= Popup ==============================
|
||||
|
||||
|
||||
var _React$useState11 = React.useState(null),
|
||||
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
||||
containerWidth = _React$useState12[0],
|
||||
setContainerWidth = _React$useState12[1];
|
||||
|
||||
(0, _useLayoutEffect.default)(function () {
|
||||
if (triggerOpen) {
|
||||
var newWidth = Math.ceil(containerRef.current.offsetWidth);
|
||||
|
||||
if (containerWidth !== newWidth) {
|
||||
setContainerWidth(newWidth);
|
||||
}
|
||||
}
|
||||
}, [triggerOpen]);
|
||||
var popupNode = React.createElement(OptionList, {
|
||||
ref: listRef,
|
||||
prefixCls: prefixCls,
|
||||
id: mergedId,
|
||||
open: mergedOpen,
|
||||
childrenAsData: !options,
|
||||
options: displayOptions,
|
||||
flattenOptions: displayFlattenOptions,
|
||||
multiple: isMultiple,
|
||||
values: rawValues,
|
||||
height: listHeight,
|
||||
itemHeight: listItemHeight,
|
||||
onSelect: onInternalOptionSelect,
|
||||
onToggleOpen: onToggleOpen,
|
||||
onActiveValue: onActiveValue,
|
||||
defaultActiveFirstOption: mergedDefaultActiveFirstOption,
|
||||
notFoundContent: notFoundContent,
|
||||
onScroll: onPopupScroll,
|
||||
searchValue: mergedSearchValue,
|
||||
menuItemSelectedIcon: menuItemSelectedIcon,
|
||||
virtual: virtual !== false && dropdownMatchSelectWidth !== false
|
||||
}); // ============================= Clear ==============================
|
||||
|
||||
var clearNode;
|
||||
|
||||
var onClearMouseDown = function onClearMouseDown() {
|
||||
// Trigger internal `onClear` event
|
||||
if (useInternalProps && internalProps.onClear) {
|
||||
internalProps.onClear();
|
||||
}
|
||||
|
||||
triggerChange([]);
|
||||
triggerSearch('', false);
|
||||
};
|
||||
|
||||
if (!disabled && allowClear && (mergedRawValue.length || mergedSearchValue)) {
|
||||
clearNode = React.createElement(_TransBtn.default, {
|
||||
className: "".concat(prefixCls, "-clear"),
|
||||
onMouseDown: onClearMouseDown,
|
||||
customizeIcon: clearIcon
|
||||
}, "\xD7");
|
||||
} // ============================= Arrow ==============================
|
||||
|
||||
|
||||
var mergedShowArrow = showArrow !== undefined ? showArrow : loading || !isMultiple && mode !== 'combobox';
|
||||
var arrowNode;
|
||||
|
||||
if (mergedShowArrow) {
|
||||
arrowNode = React.createElement(_TransBtn.default, {
|
||||
className: (0, _classnames.default)("".concat(prefixCls, "-arrow"), _defineProperty({}, "".concat(prefixCls, "-arrow-loading"), loading)),
|
||||
customizeIcon: inputIcon,
|
||||
customizeIconProps: {
|
||||
loading: loading,
|
||||
searchValue: mergedSearchValue,
|
||||
open: mergedOpen,
|
||||
focused: mockFocused,
|
||||
showSearch: mergedShowSearch
|
||||
}
|
||||
});
|
||||
} // ============================ Warning =============================
|
||||
|
||||
|
||||
if (process.env.NODE_ENV !== 'production' && warningProps) {
|
||||
warningProps(props);
|
||||
} // ============================= Render =============================
|
||||
|
||||
|
||||
var mergedClassName = (0, _classnames.default)(prefixCls, className, (_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefixCls, "-focused"), mockFocused), _defineProperty(_classNames2, "".concat(prefixCls, "-multiple"), isMultiple), _defineProperty(_classNames2, "".concat(prefixCls, "-single"), !isMultiple), _defineProperty(_classNames2, "".concat(prefixCls, "-allow-clear"), allowClear), _defineProperty(_classNames2, "".concat(prefixCls, "-show-arrow"), mergedShowArrow), _defineProperty(_classNames2, "".concat(prefixCls, "-disabled"), disabled), _defineProperty(_classNames2, "".concat(prefixCls, "-loading"), loading), _defineProperty(_classNames2, "".concat(prefixCls, "-open"), mergedOpen), _defineProperty(_classNames2, "".concat(prefixCls, "-customize-input"), customizeInputElement), _defineProperty(_classNames2, "".concat(prefixCls, "-show-search"), mergedShowSearch), _classNames2));
|
||||
return React.createElement("div", Object.assign({
|
||||
className: mergedClassName
|
||||
}, domProps, {
|
||||
ref: containerRef,
|
||||
onMouseDown: onInternalMouseDown,
|
||||
onKeyDown: onInternalKeyDown,
|
||||
onKeyUp: onInternalKeyUp,
|
||||
onFocus: onContainerFocus,
|
||||
onBlur: onContainerBlur
|
||||
}), mockFocused && !mergedOpen && React.createElement("span", {
|
||||
style: {
|
||||
width: 0,
|
||||
height: 0,
|
||||
display: 'flex',
|
||||
overflow: 'hidden',
|
||||
opacity: 0
|
||||
},
|
||||
"aria-live": "polite"
|
||||
}, "".concat(mergedRawValue.join(', '))), React.createElement(_SelectTrigger.default, {
|
||||
ref: triggerRef,
|
||||
disabled: disabled,
|
||||
prefixCls: prefixCls,
|
||||
visible: triggerOpen,
|
||||
popupElement: popupNode,
|
||||
containerWidth: containerWidth,
|
||||
animation: animation,
|
||||
transitionName: transitionName,
|
||||
dropdownStyle: dropdownStyle,
|
||||
dropdownClassName: dropdownClassName,
|
||||
direction: direction,
|
||||
dropdownMatchSelectWidth: dropdownMatchSelectWidth,
|
||||
dropdownRender: dropdownRender,
|
||||
dropdownAlign: dropdownAlign,
|
||||
getPopupContainer: getPopupContainer,
|
||||
empty: !mergedOptions.length,
|
||||
getTriggerDOMNode: function getTriggerDOMNode() {
|
||||
return selectorDomRef.current;
|
||||
}
|
||||
}, React.createElement(_Selector.default, Object.assign({}, props, {
|
||||
domRef: selectorDomRef,
|
||||
prefixCls: prefixCls,
|
||||
inputElement: customizeInputElement,
|
||||
ref: selectorRef,
|
||||
id: mergedId,
|
||||
showSearch: mergedShowSearch,
|
||||
mode: mode,
|
||||
accessibilityIndex: accessibilityIndex,
|
||||
multiple: isMultiple,
|
||||
tagRender: tagRender,
|
||||
values: displayValues,
|
||||
open: mergedOpen,
|
||||
onToggleOpen: onToggleOpen,
|
||||
searchValue: mergedSearchValue,
|
||||
activeValue: activeValue,
|
||||
onSearch: triggerSearch,
|
||||
onSelect: onInternalSelectionSelect
|
||||
}))), arrowNode, clearNode);
|
||||
}
|
||||
|
||||
var RefSelect = React.forwardRef(Select);
|
||||
return RefSelect;
|
||||
}
|
||||
5
web/node_modules/rc-select/lib/hooks/useDelayReset.d.ts
generated
vendored
Normal file
5
web/node_modules/rc-select/lib/hooks/useDelayReset.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* Similar with `useLock`, but this hook will always execute last value.
|
||||
* When set to `true`, it will keep `true` for a short time even if `false` is set.
|
||||
*/
|
||||
export default function useDelayReset(timeout?: number): [boolean, (val: boolean, callback?: () => void) => void, () => void];
|
||||
62
web/node_modules/rc-select/lib/hooks/useDelayReset.js
generated
vendored
Normal file
62
web/node_modules/rc-select/lib/hooks/useDelayReset.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = useDelayReset;
|
||||
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
/**
|
||||
* Similar with `useLock`, but this hook will always execute last value.
|
||||
* When set to `true`, it will keep `true` for a short time even if `false` is set.
|
||||
*/
|
||||
function useDelayReset() {
|
||||
var timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
|
||||
|
||||
var _React$useState = React.useState(false),
|
||||
_React$useState2 = _slicedToArray(_React$useState, 2),
|
||||
bool = _React$useState2[0],
|
||||
setBool = _React$useState2[1];
|
||||
|
||||
var delayRef = React.useRef(null);
|
||||
|
||||
var cancelLatest = function cancelLatest() {
|
||||
window.clearTimeout(delayRef.current);
|
||||
};
|
||||
|
||||
React.useEffect(function () {
|
||||
return cancelLatest;
|
||||
}, []);
|
||||
|
||||
var delaySetBool = function delaySetBool(value, callback) {
|
||||
cancelLatest();
|
||||
delayRef.current = window.setTimeout(function () {
|
||||
setBool(value);
|
||||
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
}, timeout);
|
||||
};
|
||||
|
||||
return [bool, delaySetBool, cancelLatest];
|
||||
}
|
||||
5
web/node_modules/rc-select/lib/hooks/useLayoutEffect.d.ts
generated
vendored
Normal file
5
web/node_modules/rc-select/lib/hooks/useLayoutEffect.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import * as React from 'react';
|
||||
/**
|
||||
* Wrap `React.useLayoutEffect` which will not throw warning message in test env
|
||||
*/
|
||||
export default function useLayoutEffect(effect: React.EffectCallback, deps?: React.DependencyList): void;
|
||||
32
web/node_modules/rc-select/lib/hooks/useLayoutEffect.js
generated
vendored
Normal file
32
web/node_modules/rc-select/lib/hooks/useLayoutEffect.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = useLayoutEffect;
|
||||
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _commonUtil = require("../utils/commonUtil");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
/* eslint-disable react-hooks/rules-of-hooks */
|
||||
|
||||
/**
|
||||
* Wrap `React.useLayoutEffect` which will not throw warning message in test env
|
||||
*/
|
||||
function useLayoutEffect(effect, deps) {
|
||||
// Never happen in test env
|
||||
if (_commonUtil.isBrowserClient) {
|
||||
/* istanbul ignore next */
|
||||
React.useLayoutEffect(effect, deps);
|
||||
} else {
|
||||
React.useEffect(effect, deps);
|
||||
}
|
||||
}
|
||||
/* eslint-enable */
|
||||
7
web/node_modules/rc-select/lib/hooks/useLock.d.ts
generated
vendored
Normal file
7
web/node_modules/rc-select/lib/hooks/useLock.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Locker return cached mark.
|
||||
* If set to `true`, will return `true` in a short time even if set `false`.
|
||||
* If set to `false` and then set to `true`, will change to `true`.
|
||||
* And after time duration, it will back to `null` automatically.
|
||||
*/
|
||||
export default function useLock(duration?: number): [() => boolean, (lock: boolean) => void];
|
||||
47
web/node_modules/rc-select/lib/hooks/useLock.js
generated
vendored
Normal file
47
web/node_modules/rc-select/lib/hooks/useLock.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = useLock;
|
||||
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
/**
|
||||
* Locker return cached mark.
|
||||
* If set to `true`, will return `true` in a short time even if set `false`.
|
||||
* If set to `false` and then set to `true`, will change to `true`.
|
||||
* And after time duration, it will back to `null` automatically.
|
||||
*/
|
||||
function useLock() {
|
||||
var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 250;
|
||||
var lockRef = React.useRef(null);
|
||||
var timeoutRef = React.useRef(null); // Clean up
|
||||
|
||||
React.useEffect(function () {
|
||||
return function () {
|
||||
window.clearTimeout(timeoutRef.current);
|
||||
};
|
||||
}, []);
|
||||
|
||||
function doLock(locked) {
|
||||
if (locked || lockRef.current === null) {
|
||||
lockRef.current = locked;
|
||||
}
|
||||
|
||||
window.clearTimeout(timeoutRef.current);
|
||||
timeoutRef.current = window.setTimeout(function () {
|
||||
lockRef.current = null;
|
||||
}, duration);
|
||||
}
|
||||
|
||||
return [function () {
|
||||
return lockRef.current;
|
||||
}, doLock];
|
||||
}
|
||||
1
web/node_modules/rc-select/lib/hooks/useSelectTriggerControl.d.ts
generated
vendored
Normal file
1
web/node_modules/rc-select/lib/hooks/useSelectTriggerControl.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export default function useSelectTriggerControl(elements: (HTMLElement | undefined)[], open: boolean, triggerOpen: (open: boolean) => void): void;
|
||||
42
web/node_modules/rc-select/lib/hooks/useSelectTriggerControl.js
generated
vendored
Normal file
42
web/node_modules/rc-select/lib/hooks/useSelectTriggerControl.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = useSelectTriggerControl;
|
||||
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function useSelectTriggerControl(elements, open, triggerOpen) {
|
||||
var propsRef = React.useRef(null);
|
||||
propsRef.current = {
|
||||
elements: elements.filter(function (e) {
|
||||
return e;
|
||||
}),
|
||||
open: open,
|
||||
triggerOpen: triggerOpen
|
||||
};
|
||||
React.useEffect(function () {
|
||||
function onGlobalMouseDown(event) {
|
||||
var target = event.target;
|
||||
|
||||
if (propsRef.current.open && propsRef.current.elements.every(function (element) {
|
||||
return !element.contains(target) && element !== target;
|
||||
})) {
|
||||
// Should trigger close
|
||||
propsRef.current.triggerOpen(false);
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('mousedown', onGlobalMouseDown);
|
||||
return function () {
|
||||
return window.removeEventListener('mousedown', onGlobalMouseDown);
|
||||
};
|
||||
}, []);
|
||||
}
|
||||
6
web/node_modules/rc-select/lib/index.d.ts
generated
vendored
Normal file
6
web/node_modules/rc-select/lib/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import Select, { ExportedSelectProps as SelectProps } from './Select';
|
||||
import { RefSelectProps } from './generate';
|
||||
import Option from './Option';
|
||||
import OptGroup from './OptGroup';
|
||||
export { Option, OptGroup, SelectProps, RefSelectProps };
|
||||
export default Select;
|
||||
29
web/node_modules/rc-select/lib/index.js
generated
vendored
Normal file
29
web/node_modules/rc-select/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "Option", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Option.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "OptGroup", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _OptGroup.default;
|
||||
}
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _Select = _interopRequireDefault(require("./Select"));
|
||||
|
||||
var _Option = _interopRequireDefault(require("./Option"));
|
||||
|
||||
var _OptGroup = _interopRequireDefault(require("./OptGroup"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var _default = _Select.default;
|
||||
exports.default = _default;
|
||||
44
web/node_modules/rc-select/lib/interface/generator.d.ts
generated
vendored
Normal file
44
web/node_modules/rc-select/lib/interface/generator.d.ts
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
/// <reference types="react" />
|
||||
import { SelectProps, RefSelectProps } from '../generate';
|
||||
export declare type SelectSource = 'option' | 'selection' | 'input';
|
||||
export declare const INTERNAL_PROPS_MARK = "RC_SELECT_INTERNAL_PROPS_MARK";
|
||||
export declare type Key = string | number;
|
||||
export declare type RawValueType = string | number;
|
||||
export interface LabelValueType {
|
||||
key?: Key;
|
||||
value?: RawValueType;
|
||||
label?: React.ReactNode;
|
||||
}
|
||||
export declare type DefaultValueType = RawValueType | RawValueType[] | LabelValueType | LabelValueType[];
|
||||
export interface DisplayLabelValueType extends LabelValueType {
|
||||
disabled?: boolean;
|
||||
}
|
||||
export declare type SingleType<MixType> = MixType extends (infer Single)[] ? Single : MixType;
|
||||
export declare type OnClear = () => void;
|
||||
export declare type CustomTagProps = {
|
||||
label: DefaultValueType;
|
||||
value: DefaultValueType;
|
||||
disabled: boolean;
|
||||
onClose: (event?: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
||||
closable: boolean;
|
||||
};
|
||||
export declare type GetLabeledValue<FOT extends FlattenOptionsType> = (value: RawValueType, config: {
|
||||
options: FOT;
|
||||
prevValue: DefaultValueType;
|
||||
labelInValue: boolean;
|
||||
optionLabelProp: string;
|
||||
}) => LabelValueType;
|
||||
export declare type FilterOptions<OptionsType extends object[]> = (searchValue: string, options: OptionsType,
|
||||
/** Component props, since Select & TreeSelect use different prop name, use any here */
|
||||
config: {
|
||||
optionFilterProp: string;
|
||||
filterOption: boolean | FilterFunc<OptionsType[number]>;
|
||||
}) => OptionsType;
|
||||
export declare type FilterFunc<OptionType> = (inputValue: string, option?: OptionType) => boolean;
|
||||
export declare function RefSelectFunc<OptionsType extends object[], ValueType>(Component: React.RefForwardingComponent<RefSelectProps, SelectProps<OptionsType, ValueType>>): React.ForwardRefExoticComponent<React.PropsWithoutRef<SelectProps<OptionsType, ValueType>> & React.RefAttributes<RefSelectProps>>;
|
||||
export declare type FlattenOptionsType<OptionsType extends object[] = object[]> = {
|
||||
key: Key;
|
||||
data: OptionsType[number];
|
||||
/** Used for customize data */
|
||||
[name: string]: any;
|
||||
}[];
|
||||
8
web/node_modules/rc-select/lib/interface/generator.js
generated
vendored
Normal file
8
web/node_modules/rc-select/lib/interface/generator.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.INTERNAL_PROPS_MARK = void 0;
|
||||
var INTERNAL_PROPS_MARK = 'RC_SELECT_INTERNAL_PROPS_MARK';
|
||||
exports.INTERNAL_PROPS_MARK = INTERNAL_PROPS_MARK;
|
||||
36
web/node_modules/rc-select/lib/interface/index.d.ts
generated
vendored
Normal file
36
web/node_modules/rc-select/lib/interface/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
import * as React from 'react';
|
||||
import { Key } from './generator';
|
||||
export declare type RenderDOMFunc = (props: any) => HTMLElement;
|
||||
export declare type RenderNode = React.ReactNode | ((props: any) => React.ReactNode);
|
||||
export declare type Mode = 'multiple' | 'tags' | 'combobox';
|
||||
export interface OptionCoreData {
|
||||
key?: Key;
|
||||
disabled?: boolean;
|
||||
value: Key;
|
||||
title?: string;
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
label?: React.ReactNode;
|
||||
/** @deprecated Only works when use `children` as option data */
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
export interface OptionData extends OptionCoreData {
|
||||
/** Save for customize data */
|
||||
[prop: string]: any;
|
||||
}
|
||||
export interface OptionGroupData {
|
||||
key?: Key;
|
||||
label?: React.ReactNode;
|
||||
options: OptionData[];
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
/** Save for customize data */
|
||||
[prop: string]: any;
|
||||
}
|
||||
export declare type OptionsType = (OptionData | OptionGroupData)[];
|
||||
export interface FlattenOptionData {
|
||||
group?: boolean;
|
||||
groupOption?: boolean;
|
||||
key: string | number;
|
||||
data: OptionData | OptionGroupData;
|
||||
}
|
||||
1
web/node_modules/rc-select/lib/interface/index.js
generated
vendored
Normal file
1
web/node_modules/rc-select/lib/interface/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";
|
||||
30
web/node_modules/rc-select/lib/utils/commonUtil.d.ts
generated
vendored
Normal file
30
web/node_modules/rc-select/lib/utils/commonUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import { RawValueType, GetLabeledValue, LabelValueType, DefaultValueType, FlattenOptionsType } from '../interface/generator';
|
||||
export declare function toArray<T>(value: T | T[]): T[];
|
||||
/**
|
||||
* Convert outer props value into internal value
|
||||
*/
|
||||
export declare function toInnerValue(value: DefaultValueType, { labelInValue, combobox }: {
|
||||
labelInValue: boolean;
|
||||
combobox: boolean;
|
||||
}): RawValueType[];
|
||||
/**
|
||||
* Convert internal value into out event value
|
||||
*/
|
||||
export declare function toOuterValues<FOT extends FlattenOptionsType>(valueList: RawValueType[], { optionLabelProp, labelInValue, prevValue, options, getLabeledValue, }: {
|
||||
optionLabelProp: string;
|
||||
labelInValue: boolean;
|
||||
getLabeledValue: GetLabeledValue<FOT>;
|
||||
options: FOT;
|
||||
prevValue: DefaultValueType;
|
||||
}): RawValueType[] | LabelValueType[];
|
||||
export declare function removeLastEnabledValue<T extends {
|
||||
disabled?: boolean;
|
||||
}, P extends RawValueType | object>(measureValues: T[], values: P[]): {
|
||||
values: P[];
|
||||
removedValue: P;
|
||||
};
|
||||
export declare const isClient: HTMLElement;
|
||||
/** Is client side and not jsdom */
|
||||
export declare const isBrowserClient: HTMLElement;
|
||||
/** Get unique id for accessibility usage */
|
||||
export declare function getUUID(): number | string;
|
||||
130
web/node_modules/rc-select/lib/utils/commonUtil.js
generated
vendored
Normal file
130
web/node_modules/rc-select/lib/utils/commonUtil.js
generated
vendored
Normal file
@@ -0,0 +1,130 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toArray = toArray;
|
||||
exports.toInnerValue = toInnerValue;
|
||||
exports.toOuterValues = toOuterValues;
|
||||
exports.removeLastEnabledValue = removeLastEnabledValue;
|
||||
exports.getUUID = getUUID;
|
||||
exports.isBrowserClient = exports.isClient = void 0;
|
||||
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
||||
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function toArray(value) {
|
||||
if (Array.isArray(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return value !== undefined ? [value] : [];
|
||||
}
|
||||
/**
|
||||
* Convert outer props value into internal value
|
||||
*/
|
||||
|
||||
|
||||
function toInnerValue(value, _ref) {
|
||||
var labelInValue = _ref.labelInValue,
|
||||
combobox = _ref.combobox;
|
||||
|
||||
if (value === undefined || value === '' && combobox) {
|
||||
return [];
|
||||
}
|
||||
|
||||
var values = Array.isArray(value) ? value : [value];
|
||||
|
||||
if (labelInValue) {
|
||||
return values.map(function (_ref2) {
|
||||
var key = _ref2.key,
|
||||
val = _ref2.value;
|
||||
return val !== undefined ? val : key;
|
||||
});
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
/**
|
||||
* Convert internal value into out event value
|
||||
*/
|
||||
|
||||
|
||||
function toOuterValues(valueList, _ref3) {
|
||||
var optionLabelProp = _ref3.optionLabelProp,
|
||||
labelInValue = _ref3.labelInValue,
|
||||
prevValue = _ref3.prevValue,
|
||||
options = _ref3.options,
|
||||
getLabeledValue = _ref3.getLabeledValue;
|
||||
var values = valueList;
|
||||
|
||||
if (labelInValue) {
|
||||
values = values.map(function (val) {
|
||||
return getLabeledValue(val, {
|
||||
options: options,
|
||||
prevValue: prevValue,
|
||||
labelInValue: labelInValue,
|
||||
optionLabelProp: optionLabelProp
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
function removeLastEnabledValue(measureValues, values) {
|
||||
var newValues = _toConsumableArray(values);
|
||||
|
||||
var removeIndex;
|
||||
|
||||
for (removeIndex = measureValues.length - 1; removeIndex >= 0; removeIndex -= 1) {
|
||||
if (!measureValues[removeIndex].disabled) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var removedValue = null;
|
||||
|
||||
if (removeIndex !== -1) {
|
||||
removedValue = newValues[removeIndex];
|
||||
newValues.splice(removeIndex, 1);
|
||||
}
|
||||
|
||||
return {
|
||||
values: newValues,
|
||||
removedValue: removedValue
|
||||
};
|
||||
}
|
||||
|
||||
var isClient = typeof window !== 'undefined' && window.document && window.document.documentElement;
|
||||
/** Is client side and not jsdom */
|
||||
|
||||
exports.isClient = isClient;
|
||||
var isBrowserClient = process.env.NODE_ENV !== 'test' && isClient;
|
||||
exports.isBrowserClient = isBrowserClient;
|
||||
var uuid = 0;
|
||||
/** Get unique id for accessibility usage */
|
||||
|
||||
function getUUID() {
|
||||
var retId; // Test never reach
|
||||
|
||||
/* istanbul ignore if */
|
||||
|
||||
if (isBrowserClient) {
|
||||
retId = uuid;
|
||||
uuid += 1;
|
||||
} else {
|
||||
retId = 'TEST_OR_SSR';
|
||||
}
|
||||
|
||||
return retId;
|
||||
}
|
||||
3
web/node_modules/rc-select/lib/utils/legacyUtil.d.ts
generated
vendored
Normal file
3
web/node_modules/rc-select/lib/utils/legacyUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { OptionsType } from '../interface';
|
||||
export declare function convertChildrenToData(nodes: React.ReactNode, optionOnly?: boolean): OptionsType;
|
||||
70
web/node_modules/rc-select/lib/utils/legacyUtil.js
generated
vendored
Normal file
70
web/node_modules/rc-select/lib/utils/legacyUtil.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.convertChildrenToData = convertChildrenToData;
|
||||
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _toArray = _interopRequireDefault(require("rc-util/lib/Children/toArray"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
|
||||
function convertNodeToOption(node) {
|
||||
var key = node.key,
|
||||
_node$props = node.props,
|
||||
children = _node$props.children,
|
||||
value = _node$props.value,
|
||||
restProps = _objectWithoutProperties(_node$props, ["children", "value"]);
|
||||
|
||||
return _objectSpread({
|
||||
key: key,
|
||||
value: value !== undefined ? value : key,
|
||||
children: children
|
||||
}, restProps);
|
||||
}
|
||||
|
||||
function convertChildrenToData(nodes) {
|
||||
var optionOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
||||
return (0, _toArray.default)(nodes).map(function (node, index) {
|
||||
if (!React.isValidElement(node) || !node.type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var isSelectOptGroup = node.type.isSelectOptGroup,
|
||||
key = node.key,
|
||||
_node$props2 = node.props,
|
||||
children = _node$props2.children,
|
||||
restProps = _objectWithoutProperties(_node$props2, ["children"]);
|
||||
|
||||
if (optionOnly || !isSelectOptGroup) {
|
||||
return convertNodeToOption(node);
|
||||
}
|
||||
|
||||
return _objectSpread({
|
||||
key: "__RC_SELECT_GRP__".concat(key === null ? index : key, "__"),
|
||||
label: key
|
||||
}, restProps, {
|
||||
options: convertChildrenToData(children)
|
||||
});
|
||||
}).filter(function (data) {
|
||||
return data;
|
||||
});
|
||||
}
|
||||
21
web/node_modules/rc-select/lib/utils/valueUtil.d.ts
generated
vendored
Normal file
21
web/node_modules/rc-select/lib/utils/valueUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import { OptionsType as SelectOptionsType, OptionData, FlattenOptionData } from '../interface';
|
||||
import { FilterFunc, RawValueType, GetLabeledValue, DefaultValueType } from '../interface/generator';
|
||||
/**
|
||||
* Flat options into flatten list.
|
||||
* We use `optionOnly` here is aim to avoid user use nested option group.
|
||||
* Here is simply set `key` to the index if not provided.
|
||||
*/
|
||||
export declare function flattenOptions(options: SelectOptionsType): FlattenOptionData[];
|
||||
export declare function findValueOption(values: RawValueType[], options: FlattenOptionData[]): OptionData[];
|
||||
export declare const getLabeledValue: GetLabeledValue<FlattenOptionData[]>;
|
||||
/** Filter options and return a new options by the search text */
|
||||
export declare function filterOptions(searchValue: string, options: SelectOptionsType, { optionFilterProp, filterOption, }: {
|
||||
optionFilterProp: string;
|
||||
filterOption: boolean | FilterFunc<SelectOptionsType[number]>;
|
||||
}): SelectOptionsType;
|
||||
export declare function getSeparatedContent(text: string, tokens: string[]): string[];
|
||||
export declare function isValueDisabled(value: RawValueType, options: FlattenOptionData[]): boolean;
|
||||
/**
|
||||
* `tags` mode should fill un-list item into the option list
|
||||
*/
|
||||
export declare function fillOptionsWithMissingValue(options: SelectOptionsType, value: DefaultValueType, optionLabelProp: string, labelInValue: boolean): SelectOptionsType;
|
||||
311
web/node_modules/rc-select/lib/utils/valueUtil.js
generated
vendored
Normal file
311
web/node_modules/rc-select/lib/utils/valueUtil.js
generated
vendored
Normal file
@@ -0,0 +1,311 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.flattenOptions = flattenOptions;
|
||||
exports.findValueOption = findValueOption;
|
||||
exports.filterOptions = filterOptions;
|
||||
exports.getSeparatedContent = getSeparatedContent;
|
||||
exports.isValueDisabled = isValueDisabled;
|
||||
exports.fillOptionsWithMissingValue = fillOptionsWithMissingValue;
|
||||
exports.getLabeledValue = void 0;
|
||||
|
||||
var _warning = _interopRequireDefault(require("rc-util/lib/warning"));
|
||||
|
||||
var _commonUtil = require("./commonUtil");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
|
||||
function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function getKey(data, index) {
|
||||
var key = data.key;
|
||||
var value;
|
||||
|
||||
if ('value' in data) {
|
||||
value = data.value;
|
||||
}
|
||||
|
||||
if (key !== null && key !== undefined) {
|
||||
return key;
|
||||
}
|
||||
|
||||
if (value !== undefined) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return "rc-index-key-".concat(index);
|
||||
}
|
||||
/**
|
||||
* Flat options into flatten list.
|
||||
* We use `optionOnly` here is aim to avoid user use nested option group.
|
||||
* Here is simply set `key` to the index if not provided.
|
||||
*/
|
||||
|
||||
|
||||
function flattenOptions(options) {
|
||||
var flattenList = [];
|
||||
|
||||
function dig(list, isGroupOption) {
|
||||
list.forEach(function (data) {
|
||||
if (isGroupOption || !('options' in data)) {
|
||||
// Option
|
||||
flattenList.push({
|
||||
key: getKey(data, flattenList.length),
|
||||
groupOption: isGroupOption,
|
||||
data: data
|
||||
});
|
||||
} else {
|
||||
// Option Group
|
||||
flattenList.push({
|
||||
key: getKey(data, flattenList.length),
|
||||
group: true,
|
||||
data: data
|
||||
});
|
||||
dig(data.options, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
dig(options, false);
|
||||
return flattenList;
|
||||
}
|
||||
/**
|
||||
* Inject `props` into `option` for legacy usage
|
||||
*/
|
||||
|
||||
|
||||
function injectPropsWithOption(option) {
|
||||
var newOption = _objectSpread({}, option);
|
||||
|
||||
if (!('props' in newOption)) {
|
||||
Object.defineProperty(newOption, 'props', {
|
||||
get: function get() {
|
||||
(0, _warning.default)(false, 'Return type is option instead of Option instance. Please read value directly instead of reading from `props`.');
|
||||
return newOption;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return newOption;
|
||||
}
|
||||
|
||||
function findValueOption(values, options) {
|
||||
var optionMap = new Map();
|
||||
options.forEach(function (flattenItem) {
|
||||
if (!flattenItem.group) {
|
||||
var data = flattenItem.data; // Check if match
|
||||
|
||||
optionMap.set(data.value, data);
|
||||
}
|
||||
});
|
||||
return values.map(function (val) {
|
||||
return injectPropsWithOption(optionMap.get(val));
|
||||
});
|
||||
}
|
||||
|
||||
var getLabeledValue = function getLabeledValue(value, _ref) {
|
||||
var options = _ref.options,
|
||||
prevValue = _ref.prevValue,
|
||||
labelInValue = _ref.labelInValue,
|
||||
optionLabelProp = _ref.optionLabelProp;
|
||||
var item = findValueOption([value], options)[0];
|
||||
var result = {
|
||||
value: value
|
||||
};
|
||||
var prevValItem;
|
||||
var prevValues = (0, _commonUtil.toArray)(prevValue);
|
||||
|
||||
if (labelInValue) {
|
||||
prevValItem = prevValues.find(function (prevItem) {
|
||||
if (_typeof(prevItem) === 'object' && 'value' in prevItem) {
|
||||
return prevItem.value === value;
|
||||
} // [Legacy] Support `key` as `value`
|
||||
|
||||
|
||||
return prevItem.key === value;
|
||||
});
|
||||
}
|
||||
|
||||
if (prevValItem && _typeof(prevValItem) === 'object' && 'label' in prevValItem) {
|
||||
result.label = prevValItem.label;
|
||||
|
||||
if (item && typeof prevValItem.label === 'string' && typeof item[optionLabelProp] === 'string' && prevValItem.label.trim() !== item[optionLabelProp].trim()) {
|
||||
(0, _warning.default)(false, '`label` of `value` is not same as `label` in Select options.');
|
||||
}
|
||||
} else if (item && optionLabelProp in item) {
|
||||
result.label = item[optionLabelProp];
|
||||
} else {
|
||||
result.label = value;
|
||||
} // [Legacy] We need fill `key` as `value` to compatible old code usage
|
||||
|
||||
|
||||
result.key = result.value;
|
||||
return result;
|
||||
};
|
||||
|
||||
exports.getLabeledValue = getLabeledValue;
|
||||
|
||||
function toRawString(content) {
|
||||
return (0, _commonUtil.toArray)(content).join('');
|
||||
}
|
||||
/** Filter single option if match the search text */
|
||||
|
||||
|
||||
function getFilterFunction(optionFilterProp) {
|
||||
return function (searchValue, option) {
|
||||
var lowerSearchText = searchValue.toLowerCase(); // Group label search
|
||||
|
||||
if ('options' in option) {
|
||||
return toRawString(option.label).toLowerCase().includes(lowerSearchText);
|
||||
} // Option value search
|
||||
|
||||
|
||||
var rawValue = option[optionFilterProp];
|
||||
var value = toRawString(rawValue).toLowerCase();
|
||||
return value.includes(lowerSearchText) && !option.disabled;
|
||||
};
|
||||
}
|
||||
/** Filter options and return a new options by the search text */
|
||||
|
||||
|
||||
function filterOptions(searchValue, options, _ref2) {
|
||||
var optionFilterProp = _ref2.optionFilterProp,
|
||||
filterOption = _ref2.filterOption;
|
||||
var filteredOptions = [];
|
||||
var filterFunc;
|
||||
|
||||
if (filterOption === false) {
|
||||
return options;
|
||||
}
|
||||
|
||||
if (typeof filterOption === 'function') {
|
||||
filterFunc = filterOption;
|
||||
} else {
|
||||
filterFunc = getFilterFunction(optionFilterProp);
|
||||
}
|
||||
|
||||
options.forEach(function (item) {
|
||||
// Group should check child options
|
||||
if ('options' in item) {
|
||||
// Check group first
|
||||
var matchGroup = filterFunc(searchValue, item);
|
||||
|
||||
if (matchGroup) {
|
||||
filteredOptions.push(item);
|
||||
} else {
|
||||
// Check option
|
||||
var subOptions = item.options.filter(function (subItem) {
|
||||
return filterFunc(searchValue, subItem);
|
||||
});
|
||||
|
||||
if (subOptions.length) {
|
||||
filteredOptions.push(_objectSpread({}, item, {
|
||||
options: subOptions
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (filterFunc(searchValue, injectPropsWithOption(item))) {
|
||||
filteredOptions.push(item);
|
||||
}
|
||||
});
|
||||
return filteredOptions;
|
||||
}
|
||||
|
||||
function getSeparatedContent(text, tokens) {
|
||||
if (!tokens || !tokens.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var match = false;
|
||||
|
||||
function separate(str, _ref3) {
|
||||
var _ref4 = _toArray(_ref3),
|
||||
token = _ref4[0],
|
||||
restTokens = _ref4.slice(1);
|
||||
|
||||
if (!token) {
|
||||
return [str];
|
||||
}
|
||||
|
||||
var list = str.split(token);
|
||||
match = match || list.length > 1;
|
||||
return list.reduce(function (prevList, unitStr) {
|
||||
return [].concat(_toConsumableArray(prevList), _toConsumableArray(separate(unitStr, restTokens)));
|
||||
}, []).filter(function (unit) {
|
||||
return unit;
|
||||
});
|
||||
}
|
||||
|
||||
var list = separate(text, tokens);
|
||||
return match ? list : null;
|
||||
}
|
||||
|
||||
function isValueDisabled(value, options) {
|
||||
var option = findValueOption([value], options)[0];
|
||||
return option.disabled;
|
||||
}
|
||||
/**
|
||||
* `tags` mode should fill un-list item into the option list
|
||||
*/
|
||||
|
||||
|
||||
function fillOptionsWithMissingValue(options, value, optionLabelProp, labelInValue) {
|
||||
var values = (0, _commonUtil.toArray)(value).slice().sort();
|
||||
|
||||
var cloneOptions = _toConsumableArray(options); // Convert options value to set
|
||||
|
||||
|
||||
var optionValues = new Set();
|
||||
options.forEach(function (opt) {
|
||||
if (opt.options) {
|
||||
opt.options.forEach(function (subOpt) {
|
||||
optionValues.add(subOpt.value);
|
||||
});
|
||||
} else {
|
||||
optionValues.add(opt.value);
|
||||
}
|
||||
}); // Fill missing value
|
||||
|
||||
values.forEach(function (item) {
|
||||
var val = labelInValue ? item.value : item;
|
||||
|
||||
if (!optionValues.has(val)) {
|
||||
var _ref5;
|
||||
|
||||
cloneOptions.push(labelInValue ? (_ref5 = {}, _defineProperty(_ref5, optionLabelProp, item.label), _defineProperty(_ref5, "value", val), _ref5) : {
|
||||
value: val
|
||||
});
|
||||
}
|
||||
});
|
||||
return cloneOptions;
|
||||
}
|
||||
3
web/node_modules/rc-select/lib/utils/warningPropsUtil.d.ts
generated
vendored
Normal file
3
web/node_modules/rc-select/lib/utils/warningPropsUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { SelectProps } from '..';
|
||||
declare function warningProps(props: SelectProps): void;
|
||||
export default warningProps;
|
||||
130
web/node_modules/rc-select/lib/utils/warningPropsUtil.js
generated
vendored
Normal file
130
web/node_modules/rc-select/lib/utils/warningPropsUtil.js
generated
vendored
Normal file
@@ -0,0 +1,130 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
|
||||
var _warning = _interopRequireWildcard(require("rc-util/lib/warning"));
|
||||
|
||||
var _toArray = _interopRequireDefault(require("rc-util/lib/Children/toArray"));
|
||||
|
||||
var _legacyUtil = require("./legacyUtil");
|
||||
|
||||
var _commonUtil = require("./commonUtil");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function warningProps(props) {
|
||||
var mode = props.mode,
|
||||
options = props.options,
|
||||
children = props.children,
|
||||
backfill = props.backfill,
|
||||
allowClear = props.allowClear,
|
||||
placeholder = props.placeholder,
|
||||
getInputElement = props.getInputElement,
|
||||
showSearch = props.showSearch,
|
||||
onSearch = props.onSearch,
|
||||
defaultOpen = props.defaultOpen,
|
||||
autoFocus = props.autoFocus,
|
||||
labelInValue = props.labelInValue,
|
||||
value = props.value,
|
||||
inputValue = props.inputValue,
|
||||
optionLabelProp = props.optionLabelProp;
|
||||
var multiple = mode === 'multiple' || mode === 'tags';
|
||||
var mergedShowSearch = showSearch !== undefined ? showSearch : multiple || mode === 'combobox';
|
||||
var mergedOptions = options || (0, _legacyUtil.convertChildrenToData)(children); // `tags` should not set option as disabled
|
||||
|
||||
(0, _warning.default)(mode !== 'tags' || mergedOptions.every(function (opt) {
|
||||
return !opt.disabled;
|
||||
}), 'Please avoid setting option to disabled in tags mode since user can always type text as tag.'); // `combobox` & `tags` should option be `string` type
|
||||
|
||||
if (mode === 'tags' || mode === 'combobox') {
|
||||
var hasNumberValue = mergedOptions.some(function (item) {
|
||||
if (item.options) {
|
||||
return item.options.some(function (opt) {
|
||||
return typeof ('value' in opt ? opt.value : opt.key) === 'number';
|
||||
});
|
||||
}
|
||||
|
||||
return typeof ('value' in item ? item.value : item.key) === 'number';
|
||||
});
|
||||
(0, _warning.default)(!hasNumberValue, '`value` of Option should not use number type when `mode` is `tags` or `combobox`.');
|
||||
} // `combobox` should not use `optionLabelProp`
|
||||
|
||||
|
||||
(0, _warning.default)(mode !== 'combobox' || !optionLabelProp, '`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly.'); // Only `combobox` support `backfill`
|
||||
|
||||
(0, _warning.default)(mode === 'combobox' || !backfill, '`backfill` only works with `combobox` mode.'); // Only `combobox` support `getInputElement`
|
||||
|
||||
(0, _warning.default)(mode === 'combobox' || !getInputElement, '`getInputElement` only work with `combobox` mode.'); // Customize `getInputElement` should not use `allowClear` & `placeholder`
|
||||
|
||||
(0, _warning.noteOnce)(mode !== 'combobox' || !getInputElement || !allowClear || !placeholder, 'Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`.'); // `onSearch` should use in `combobox` or `showSearch`
|
||||
|
||||
if (onSearch && !mergedShowSearch && mode !== 'combobox' && mode !== 'tags') {
|
||||
(0, _warning.default)(false, '`onSearch` should work with `showSearch` instead of use alone.');
|
||||
}
|
||||
|
||||
(0, _warning.noteOnce)(!defaultOpen || autoFocus, '`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed.');
|
||||
|
||||
if (value !== undefined && value !== null) {
|
||||
var values = (0, _commonUtil.toArray)(value);
|
||||
(0, _warning.default)(!labelInValue || values.every(function (val) {
|
||||
return _typeof(val) === 'object' && ('key' in val || 'value' in val);
|
||||
}), '`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`');
|
||||
(0, _warning.default)(!multiple || Array.isArray(value), '`value` should be array when `mode` is `multiple` or `tags`');
|
||||
} // Syntactic sugar should use correct children type
|
||||
|
||||
|
||||
if (children) {
|
||||
var invalidateChildType = null;
|
||||
(0, _toArray.default)(children).some(function (node) {
|
||||
if (!_react.default.isValidElement(node) || !node.type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var type = node.type;
|
||||
|
||||
if (type.isSelectOption) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (type.isSelectOptGroup) {
|
||||
var allChildrenValid = (0, _toArray.default)(node.props.children).every(function (subNode) {
|
||||
if (!_react.default.isValidElement(subNode) || !node.type || subNode.type.isSelectOption) {
|
||||
return true;
|
||||
}
|
||||
|
||||
invalidateChildType = subNode.type;
|
||||
return false;
|
||||
});
|
||||
|
||||
if (allChildrenValid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
invalidateChildType = type;
|
||||
return true;
|
||||
});
|
||||
|
||||
if (invalidateChildType) {
|
||||
(0, _warning.default)(false, "`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(invalidateChildType.displayName || invalidateChildType.name || invalidateChildType, "`."));
|
||||
}
|
||||
|
||||
(0, _warning.default)(inputValue === undefined, '`inputValue` is deprecated, please use `searchValue` instead.');
|
||||
}
|
||||
}
|
||||
|
||||
var _default = warningProps;
|
||||
exports.default = _default;
|
||||
92
web/node_modules/rc-select/package.json
generated
vendored
Normal file
92
web/node_modules/rc-select/package.json
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
{
|
||||
"_from": "rc-select@~10.2.0",
|
||||
"_id": "rc-select@10.2.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-PtfAHQRXof5gX1qEYQc8GIgroajtzU3mcMGbqM1aE1jqaZ4r+p0GJy3rabXoNANsKH7jUV5+zYJb5VhTxj2vmQ==",
|
||||
"_location": "/rc-select",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "rc-select@~10.2.0",
|
||||
"name": "rc-select",
|
||||
"escapedName": "rc-select",
|
||||
"rawSpec": "~10.2.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~10.2.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/antd",
|
||||
"/rc-tree-select"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/rc-select/-/rc-select-10.2.4.tgz",
|
||||
"_shasum": "f293c93982c530e54e244d23f5c1dd8451189550",
|
||||
"_spec": "rc-select@~10.2.0",
|
||||
"_where": "/Users/thilina/TestProjects/icehrm-pro/web/node_modules/antd",
|
||||
"bugs": {
|
||||
"url": "http://github.com/react-component/select/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"classnames": "2.x",
|
||||
"rc-animate": "^2.10.0",
|
||||
"rc-trigger": "^4.0.0",
|
||||
"rc-util": "^4.20.0",
|
||||
"rc-virtual-list": "^1.1.2",
|
||||
"warning": "^4.0.3"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "React Select",
|
||||
"devDependencies": {
|
||||
"@types/jest": "^25.1.0",
|
||||
"@types/react": "^16.8.19",
|
||||
"@types/react-dom": "^16.8.4",
|
||||
"@types/warning": "^3.0.0",
|
||||
"cross-env": "^7.0.0",
|
||||
"enzyme": "^3.3.0",
|
||||
"enzyme-to-json": "^3.4.0",
|
||||
"father": "^2.13.2",
|
||||
"jsonp": "^0.2.1",
|
||||
"np": "^6.0.0",
|
||||
"rc-dialog": "^7.5.5",
|
||||
"typescript": "^3.5.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.x"
|
||||
},
|
||||
"files": [
|
||||
"assets/*.css",
|
||||
"assets/*.less",
|
||||
"es",
|
||||
"lib"
|
||||
],
|
||||
"homepage": "http://github.com/react-component/select",
|
||||
"keywords": [
|
||||
"react",
|
||||
"react-component",
|
||||
"react-select",
|
||||
"select"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./lib/index",
|
||||
"module": "./es/index",
|
||||
"name": "rc-select",
|
||||
"peerDependencies": {
|
||||
"react": "*",
|
||||
"react-dom": "*"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/react-component/select.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "father doc build --storybook",
|
||||
"compile": "father build",
|
||||
"lint": "eslint src/ examples/ --ext .tsx,.ts,.jsx,.js",
|
||||
"now-build": "npm run build",
|
||||
"prepublishOnly": "npm run compile && np --no-cleanup --yolo --no-publish",
|
||||
"start": "cross-env NODE_ENV=development father doc dev --storybook",
|
||||
"test": "father test"
|
||||
},
|
||||
"version": "10.2.4"
|
||||
}
|
||||
Reference in New Issue
Block a user