Latest updates from IceHrmPro

This commit is contained in:
Thilina Pituwala
2020-05-20 18:47:29 +02:00
parent 60c92d7935
commit 7453a58aad
18012 changed files with 2089245 additions and 10173 deletions

12
web/node_modules/rc-select/es/OptGroup.d.ts generated vendored Normal file
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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;

View 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;

View 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;

View 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;

View 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
View 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
View 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
View 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
View 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
View 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
View 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;
}

View 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
View 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];
}

View 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
View 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
View 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
View 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];
}

View File

@@ -0,0 +1 @@
export default function useSelectTriggerControl(elements: (HTMLElement | undefined)[], open: boolean, triggerOpen: (open: boolean) => void): void;

View 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
View 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
View 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
View 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
View 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
View 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
View File

30
web/node_modules/rc-select/es/utils/commonUtil.d.ts generated vendored Normal file
View 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
View 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
View 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
View 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
View 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
View 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;
}

View 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
View 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;