first commit
This commit is contained in:
1
frontend/node_modules/rc-select/es/utils/__mocks__/platformUtil.d.ts
generated
vendored
Normal file
1
frontend/node_modules/rc-select/es/utils/__mocks__/platformUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function isPlatformMac(): boolean;
|
||||
3
frontend/node_modules/rc-select/es/utils/__mocks__/platformUtil.js
generated
vendored
Normal file
3
frontend/node_modules/rc-select/es/utils/__mocks__/platformUtil.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export function isPlatformMac() {
|
||||
return true;
|
||||
}
|
||||
9
frontend/node_modules/rc-select/es/utils/commonUtil.d.ts
generated
vendored
Normal file
9
frontend/node_modules/rc-select/es/utils/commonUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { DisplayValueType } from '../BaseSelect';
|
||||
export declare function toArray<T>(value: T | T[]): T[];
|
||||
export declare const isClient: HTMLElement;
|
||||
/** Is client side and not jsdom */
|
||||
export declare const isBrowserClient: HTMLElement;
|
||||
export declare function hasValue(value: any): boolean;
|
||||
/** combo mode no value judgment function */
|
||||
export declare function isComboNoValue(value: any): boolean;
|
||||
export declare function getTitle(item: DisplayValueType): string;
|
||||
33
frontend/node_modules/rc-select/es/utils/commonUtil.js
generated
vendored
Normal file
33
frontend/node_modules/rc-select/es/utils/commonUtil.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
||||
export function toArray(value) {
|
||||
if (Array.isArray(value)) {
|
||||
return value;
|
||||
}
|
||||
return value !== undefined ? [value] : [];
|
||||
}
|
||||
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;
|
||||
export function hasValue(value) {
|
||||
return value !== undefined && value !== null;
|
||||
}
|
||||
|
||||
/** combo mode no value judgment function */
|
||||
export function isComboNoValue(value) {
|
||||
return !value && value !== 0;
|
||||
}
|
||||
function isTitleType(title) {
|
||||
return ['string', 'number'].includes(_typeof(title));
|
||||
}
|
||||
export function getTitle(item) {
|
||||
var title = undefined;
|
||||
if (item) {
|
||||
if (isTitleType(item.title)) {
|
||||
title = item.title.toString();
|
||||
} else if (isTitleType(item.label)) {
|
||||
title = item.label.toString();
|
||||
}
|
||||
}
|
||||
return title;
|
||||
}
|
||||
2
frontend/node_modules/rc-select/es/utils/keyUtil.d.ts
generated
vendored
Normal file
2
frontend/node_modules/rc-select/es/utils/keyUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/** keyCode Judgment function */
|
||||
export declare function isValidateOpenKey(currentKeyCode: number): boolean;
|
||||
16
frontend/node_modules/rc-select/es/utils/keyUtil.js
generated
vendored
Normal file
16
frontend/node_modules/rc-select/es/utils/keyUtil.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import KeyCode from "rc-util/es/KeyCode";
|
||||
|
||||
/** keyCode Judgment function */
|
||||
export function isValidateOpenKey(currentKeyCode) {
|
||||
return (
|
||||
// Undefined for Edge bug:
|
||||
// https://github.com/ant-design/ant-design/issues/51292
|
||||
currentKeyCode &&
|
||||
// Other keys
|
||||
![
|
||||
// System function button
|
||||
KeyCode.ESC, KeyCode.SHIFT, KeyCode.BACKSPACE, KeyCode.TAB, KeyCode.WIN_KEY, KeyCode.ALT, KeyCode.META, KeyCode.WIN_KEY_RIGHT, KeyCode.CTRL, KeyCode.SEMICOLON, KeyCode.EQUALS, KeyCode.CAPS_LOCK, KeyCode.CONTEXT_MENU,
|
||||
// F1-F12
|
||||
KeyCode.F1, KeyCode.F2, KeyCode.F3, KeyCode.F4, KeyCode.F5, KeyCode.F6, KeyCode.F7, KeyCode.F8, KeyCode.F9, KeyCode.F10, KeyCode.F11, KeyCode.F12].includes(currentKeyCode)
|
||||
);
|
||||
}
|
||||
3
frontend/node_modules/rc-select/es/utils/legacyUtil.d.ts
generated
vendored
Normal file
3
frontend/node_modules/rc-select/es/utils/legacyUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import type { BaseOptionType, DefaultOptionType } from '../Select';
|
||||
export declare function convertChildrenToData<OptionType extends BaseOptionType = DefaultOptionType>(nodes: React.ReactNode, optionOnly?: boolean): OptionType[];
|
||||
44
frontend/node_modules/rc-select/es/utils/legacyUtil.js
generated
vendored
Normal file
44
frontend/node_modules/rc-select/es/utils/legacyUtil.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
||||
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
||||
var _excluded = ["children", "value"],
|
||||
_excluded2 = ["children"];
|
||||
import * as React from 'react';
|
||||
import toArray from "rc-util/es/Children/toArray";
|
||||
function convertNodeToOption(node) {
|
||||
var _ref = node,
|
||||
key = _ref.key,
|
||||
_ref$props = _ref.props,
|
||||
children = _ref$props.children,
|
||||
value = _ref$props.value,
|
||||
restProps = _objectWithoutProperties(_ref$props, _excluded);
|
||||
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 (! /*#__PURE__*/React.isValidElement(node) || !node.type) {
|
||||
return null;
|
||||
}
|
||||
var _ref2 = node,
|
||||
isSelectOptGroup = _ref2.type.isSelectOptGroup,
|
||||
key = _ref2.key,
|
||||
_ref2$props = _ref2.props,
|
||||
children = _ref2$props.children,
|
||||
restProps = _objectWithoutProperties(_ref2$props, _excluded2);
|
||||
if (optionOnly || !isSelectOptGroup) {
|
||||
return convertNodeToOption(node);
|
||||
}
|
||||
return _objectSpread(_objectSpread({
|
||||
key: "__RC_SELECT_GRP__".concat(key === null ? index : key, "__"),
|
||||
label: key
|
||||
}, restProps), {}, {
|
||||
options: convertChildrenToData(children)
|
||||
});
|
||||
}).filter(function (data) {
|
||||
return data;
|
||||
});
|
||||
}
|
||||
1
frontend/node_modules/rc-select/es/utils/platformUtil.d.ts
generated
vendored
Normal file
1
frontend/node_modules/rc-select/es/utils/platformUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function isPlatformMac(): boolean;
|
||||
4
frontend/node_modules/rc-select/es/utils/platformUtil.js
generated
vendored
Normal file
4
frontend/node_modules/rc-select/es/utils/platformUtil.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/* istanbul ignore file */
|
||||
export function isPlatformMac() {
|
||||
return /(mac\sos|macintosh)/i.test(navigator.appVersion);
|
||||
}
|
||||
24
frontend/node_modules/rc-select/es/utils/valueUtil.d.ts
generated
vendored
Normal file
24
frontend/node_modules/rc-select/es/utils/valueUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import type { BaseOptionType, DefaultOptionType } from '../Select';
|
||||
import type { FieldNames } from '../Select';
|
||||
import type { FlattenOptionData } from '../interface';
|
||||
export declare function isValidCount(value?: number): boolean;
|
||||
export declare function fillFieldNames(fieldNames: FieldNames | undefined, childrenAsData: boolean): {
|
||||
label: string;
|
||||
value: string;
|
||||
options: string;
|
||||
groupLabel: string;
|
||||
};
|
||||
/**
|
||||
* 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<OptionType extends BaseOptionType = DefaultOptionType>(options: OptionType[], { fieldNames, childrenAsData }?: {
|
||||
fieldNames?: FieldNames;
|
||||
childrenAsData?: boolean;
|
||||
}): FlattenOptionData<OptionType>[];
|
||||
/**
|
||||
* Inject `props` into `option` for legacy usage
|
||||
*/
|
||||
export declare function injectPropsWithOption<T extends object>(option: T): T;
|
||||
export declare const getSeparatedContent: (text: string, tokens: string[], end?: number) => string[];
|
||||
128
frontend/node_modules/rc-select/es/utils/valueUtil.js
generated
vendored
Normal file
128
frontend/node_modules/rc-select/es/utils/valueUtil.js
generated
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
||||
import _toArray from "@babel/runtime/helpers/esm/toArray";
|
||||
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
||||
import warning from "rc-util/es/warning";
|
||||
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);
|
||||
}
|
||||
export function isValidCount(value) {
|
||||
return typeof value !== 'undefined' && !Number.isNaN(value);
|
||||
}
|
||||
export function fillFieldNames(fieldNames, childrenAsData) {
|
||||
var _ref = fieldNames || {},
|
||||
label = _ref.label,
|
||||
value = _ref.value,
|
||||
options = _ref.options,
|
||||
groupLabel = _ref.groupLabel;
|
||||
var mergedLabel = label || (childrenAsData ? 'children' : 'label');
|
||||
return {
|
||||
label: mergedLabel,
|
||||
value: value || 'value',
|
||||
options: options || 'options',
|
||||
groupLabel: groupLabel || mergedLabel
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
||||
fieldNames = _ref2.fieldNames,
|
||||
childrenAsData = _ref2.childrenAsData;
|
||||
var flattenList = [];
|
||||
var _fillFieldNames = fillFieldNames(fieldNames, false),
|
||||
fieldLabel = _fillFieldNames.label,
|
||||
fieldValue = _fillFieldNames.value,
|
||||
fieldOptions = _fillFieldNames.options,
|
||||
groupLabel = _fillFieldNames.groupLabel;
|
||||
function dig(list, isGroupOption) {
|
||||
if (!Array.isArray(list)) {
|
||||
return;
|
||||
}
|
||||
list.forEach(function (data) {
|
||||
if (isGroupOption || !(fieldOptions in data)) {
|
||||
var value = data[fieldValue];
|
||||
|
||||
// Option
|
||||
flattenList.push({
|
||||
key: getKey(data, flattenList.length),
|
||||
groupOption: isGroupOption,
|
||||
data: data,
|
||||
label: data[fieldLabel],
|
||||
value: value
|
||||
});
|
||||
} else {
|
||||
var grpLabel = data[groupLabel];
|
||||
if (grpLabel === undefined && childrenAsData) {
|
||||
grpLabel = data.label;
|
||||
}
|
||||
|
||||
// Option Group
|
||||
flattenList.push({
|
||||
key: getKey(data, flattenList.length),
|
||||
group: true,
|
||||
data: data,
|
||||
label: grpLabel
|
||||
});
|
||||
dig(data[fieldOptions], true);
|
||||
}
|
||||
});
|
||||
}
|
||||
dig(options, false);
|
||||
return flattenList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inject `props` into `option` for legacy usage
|
||||
*/
|
||||
export 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 var getSeparatedContent = function getSeparatedContent(text, tokens, end) {
|
||||
if (!tokens || !tokens.length) {
|
||||
return null;
|
||||
}
|
||||
var match = false;
|
||||
var separate = 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(Boolean);
|
||||
};
|
||||
var list = separate(text, tokens);
|
||||
if (match) {
|
||||
return typeof end !== 'undefined' ? list.slice(0, end) : list;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
4
frontend/node_modules/rc-select/es/utils/warningPropsUtil.d.ts
generated
vendored
Normal file
4
frontend/node_modules/rc-select/es/utils/warningPropsUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { DefaultOptionType, FieldNames, SelectProps } from '../Select';
|
||||
declare function warningProps(props: SelectProps): void;
|
||||
export declare function warningNullOptions(options: DefaultOptionType[], fieldNames: FieldNames): void;
|
||||
export default warningProps;
|
||||
126
frontend/node_modules/rc-select/es/utils/warningPropsUtil.js
generated
vendored
Normal file
126
frontend/node_modules/rc-select/es/utils/warningPropsUtil.js
generated
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
||||
import toNodeArray from "rc-util/es/Children/toArray";
|
||||
import warning, { noteOnce } from "rc-util/es/warning";
|
||||
import * as React from 'react';
|
||||
import { isMultiple } from "../BaseSelect";
|
||||
import { toArray } from "./commonUtil";
|
||||
import { convertChildrenToData } from "./legacyUtil";
|
||||
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 = isMultiple(mode);
|
||||
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 (! /*#__PURE__*/React.isValidElement(node) || !node.type) {
|
||||
return false;
|
||||
}
|
||||
var _ref = node,
|
||||
type = _ref.type;
|
||||
if (type.isSelectOption) {
|
||||
return false;
|
||||
}
|
||||
if (type.isSelectOptGroup) {
|
||||
var allChildrenValid = toNodeArray(node.props.children).every(function (subNode) {
|
||||
if (! /*#__PURE__*/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.');
|
||||
}
|
||||
}
|
||||
|
||||
// value in Select option should not be null
|
||||
// note: OptGroup has options too
|
||||
export function warningNullOptions(options, fieldNames) {
|
||||
if (options) {
|
||||
var recursiveOptions = function recursiveOptions(optionsList) {
|
||||
var inGroup = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
||||
for (var i = 0; i < optionsList.length; i++) {
|
||||
var option = optionsList[i];
|
||||
if (option[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value] === null) {
|
||||
warning(false, '`value` in Select options should not be `null`.');
|
||||
return true;
|
||||
}
|
||||
if (!inGroup && Array.isArray(option[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.options]) && recursiveOptions(option[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.options], true)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
recursiveOptions(options);
|
||||
}
|
||||
}
|
||||
export default warningProps;
|
||||
Reference in New Issue
Block a user