first commit
This commit is contained in:
18
frontend/node_modules/rc-cascader/es/utils/commonUtil.d.ts
generated
vendored
Normal file
18
frontend/node_modules/rc-cascader/es/utils/commonUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import type { DefaultOptionType, FieldNames, InternalFieldNames, InternalValueType, SingleValueType } from '../Cascader';
|
||||
export declare const VALUE_SPLIT = "__RC_CASCADER_SPLIT__";
|
||||
export declare const SHOW_PARENT = "SHOW_PARENT";
|
||||
export declare const SHOW_CHILD = "SHOW_CHILD";
|
||||
/**
|
||||
* Will convert value to string, and join with `VALUE_SPLIT`
|
||||
*/
|
||||
export declare function toPathKey(value: SingleValueType): string;
|
||||
/**
|
||||
* Batch convert value to string, and join with `VALUE_SPLIT`
|
||||
*/
|
||||
export declare function toPathKeys(value: SingleValueType[]): string[];
|
||||
export declare function toPathValueStr(pathKey: string): string[];
|
||||
export declare function fillFieldNames(fieldNames?: FieldNames): InternalFieldNames;
|
||||
export declare function isLeaf(option: DefaultOptionType, fieldNames: FieldNames): any;
|
||||
export declare function scrollIntoParentView(element: HTMLElement): void;
|
||||
export declare function getFullPathKeys(options: DefaultOptionType[], fieldNames: FieldNames): any[];
|
||||
export declare function toRawValues(value?: InternalValueType): SingleValueType[];
|
||||
76
frontend/node_modules/rc-cascader/es/utils/commonUtil.js
generated
vendored
Normal file
76
frontend/node_modules/rc-cascader/es/utils/commonUtil.js
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
import { SEARCH_MARK } from "../hooks/useSearchOptions";
|
||||
export var VALUE_SPLIT = '__RC_CASCADER_SPLIT__';
|
||||
export var SHOW_PARENT = 'SHOW_PARENT';
|
||||
export var SHOW_CHILD = 'SHOW_CHILD';
|
||||
|
||||
/**
|
||||
* Will convert value to string, and join with `VALUE_SPLIT`
|
||||
*/
|
||||
export function toPathKey(value) {
|
||||
return value.join(VALUE_SPLIT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch convert value to string, and join with `VALUE_SPLIT`
|
||||
*/
|
||||
export function toPathKeys(value) {
|
||||
return value.map(toPathKey);
|
||||
}
|
||||
export function toPathValueStr(pathKey) {
|
||||
return pathKey.split(VALUE_SPLIT);
|
||||
}
|
||||
export function fillFieldNames(fieldNames) {
|
||||
var _ref = fieldNames || {},
|
||||
label = _ref.label,
|
||||
value = _ref.value,
|
||||
children = _ref.children;
|
||||
var val = value || 'value';
|
||||
return {
|
||||
label: label || 'label',
|
||||
value: val,
|
||||
key: val,
|
||||
children: children || 'children'
|
||||
};
|
||||
}
|
||||
export function isLeaf(option, fieldNames) {
|
||||
var _option$isLeaf, _option;
|
||||
return (_option$isLeaf = option.isLeaf) !== null && _option$isLeaf !== void 0 ? _option$isLeaf : !((_option = option[fieldNames.children]) !== null && _option !== void 0 && _option.length);
|
||||
}
|
||||
export function scrollIntoParentView(element) {
|
||||
var parent = element.parentElement;
|
||||
if (!parent) {
|
||||
return;
|
||||
}
|
||||
var elementToParent = element.offsetTop - parent.offsetTop; // offsetParent may not be parent.
|
||||
if (elementToParent - parent.scrollTop < 0) {
|
||||
parent.scrollTo({
|
||||
top: elementToParent
|
||||
});
|
||||
} else if (elementToParent + element.offsetHeight - parent.scrollTop > parent.offsetHeight) {
|
||||
parent.scrollTo({
|
||||
top: elementToParent + element.offsetHeight - parent.offsetHeight
|
||||
});
|
||||
}
|
||||
}
|
||||
export function getFullPathKeys(options, fieldNames) {
|
||||
return options.map(function (item) {
|
||||
var _item$SEARCH_MARK;
|
||||
return (_item$SEARCH_MARK = item[SEARCH_MARK]) === null || _item$SEARCH_MARK === void 0 ? void 0 : _item$SEARCH_MARK.map(function (opt) {
|
||||
return opt[fieldNames.value];
|
||||
});
|
||||
});
|
||||
}
|
||||
function isMultipleValue(value) {
|
||||
return Array.isArray(value) && Array.isArray(value[0]);
|
||||
}
|
||||
export function toRawValues(value) {
|
||||
if (!value) {
|
||||
return [];
|
||||
}
|
||||
if (isMultipleValue(value)) {
|
||||
return value;
|
||||
}
|
||||
return (value.length === 0 ? [] : [value]).map(function (val) {
|
||||
return Array.isArray(val) ? val : [val];
|
||||
});
|
||||
}
|
||||
9
frontend/node_modules/rc-cascader/es/utils/treeUtil.d.ts
generated
vendored
Normal file
9
frontend/node_modules/rc-cascader/es/utils/treeUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/// <reference types="react" />
|
||||
import type { SingleValueType, DefaultOptionType, InternalFieldNames, ShowCheckedStrategy } from '../Cascader';
|
||||
import type { GetEntities } from '../hooks/useEntities';
|
||||
export declare function formatStrategyValues(pathKeys: React.Key[], getKeyPathEntities: GetEntities, showCheckedStrategy?: ShowCheckedStrategy): import("react").Key[];
|
||||
export declare function toPathOptions(valueCells: SingleValueType, options: DefaultOptionType[], fieldNames: InternalFieldNames, stringMode?: boolean): {
|
||||
value: SingleValueType[number];
|
||||
index: number;
|
||||
option: DefaultOptionType;
|
||||
}[];
|
||||
40
frontend/node_modules/rc-cascader/es/utils/treeUtil.js
generated
vendored
Normal file
40
frontend/node_modules/rc-cascader/es/utils/treeUtil.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
import { SHOW_CHILD } from "./commonUtil";
|
||||
export function formatStrategyValues(pathKeys, getKeyPathEntities, showCheckedStrategy) {
|
||||
var valueSet = new Set(pathKeys);
|
||||
var keyPathEntities = getKeyPathEntities();
|
||||
return pathKeys.filter(function (key) {
|
||||
var entity = keyPathEntities[key];
|
||||
var parent = entity ? entity.parent : null;
|
||||
var children = entity ? entity.children : null;
|
||||
if (entity && entity.node.disabled) {
|
||||
return true;
|
||||
}
|
||||
return showCheckedStrategy === SHOW_CHILD ? !(children && children.some(function (child) {
|
||||
return child.key && valueSet.has(child.key);
|
||||
})) : !(parent && !parent.node.disabled && valueSet.has(parent.key));
|
||||
});
|
||||
}
|
||||
export function toPathOptions(valueCells, options, fieldNames) {
|
||||
var stringMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
||||
var currentList = options;
|
||||
var valueOptions = [];
|
||||
var _loop = function _loop() {
|
||||
var _currentList, _currentList2, _foundOption$fieldNam;
|
||||
var valueCell = valueCells[i];
|
||||
var foundIndex = (_currentList = currentList) === null || _currentList === void 0 ? void 0 : _currentList.findIndex(function (option) {
|
||||
var val = option[fieldNames.value];
|
||||
return stringMode ? String(val) === String(valueCell) : val === valueCell;
|
||||
});
|
||||
var foundOption = foundIndex !== -1 ? (_currentList2 = currentList) === null || _currentList2 === void 0 ? void 0 : _currentList2[foundIndex] : null;
|
||||
valueOptions.push({
|
||||
value: (_foundOption$fieldNam = foundOption === null || foundOption === void 0 ? void 0 : foundOption[fieldNames.value]) !== null && _foundOption$fieldNam !== void 0 ? _foundOption$fieldNam : valueCell,
|
||||
index: foundIndex,
|
||||
option: foundOption
|
||||
});
|
||||
currentList = foundOption === null || foundOption === void 0 ? void 0 : foundOption[fieldNames.children];
|
||||
};
|
||||
for (var i = 0; i < valueCells.length; i += 1) {
|
||||
_loop();
|
||||
}
|
||||
return valueOptions;
|
||||
}
|
||||
4
frontend/node_modules/rc-cascader/es/utils/warningPropsUtil.d.ts
generated
vendored
Normal file
4
frontend/node_modules/rc-cascader/es/utils/warningPropsUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { DefaultOptionType, FieldNames, InternalCascaderProps } from '../Cascader';
|
||||
declare function warningProps(props: InternalCascaderProps): void;
|
||||
export declare function warningNullOptions(options: DefaultOptionType[], fieldNames: FieldNames): void;
|
||||
export default warningProps;
|
||||
33
frontend/node_modules/rc-cascader/es/utils/warningPropsUtil.js
generated
vendored
Normal file
33
frontend/node_modules/rc-cascader/es/utils/warningPropsUtil.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import warning from "rc-util/es/warning";
|
||||
function warningProps(props) {
|
||||
var onPopupVisibleChange = props.onPopupVisibleChange,
|
||||
popupVisible = props.popupVisible,
|
||||
popupClassName = props.popupClassName,
|
||||
popupPlacement = props.popupPlacement,
|
||||
onDropdownVisibleChange = props.onDropdownVisibleChange;
|
||||
warning(!onPopupVisibleChange, '`onPopupVisibleChange` is deprecated. Please use `onOpenChange` instead.');
|
||||
warning(!onDropdownVisibleChange, '`onDropdownVisibleChange` is deprecated. Please use `onOpenChange` instead.');
|
||||
warning(popupVisible === undefined, '`popupVisible` is deprecated. Please use `open` instead.');
|
||||
warning(popupClassName === undefined, '`popupClassName` is deprecated. Please use `dropdownClassName` instead.');
|
||||
warning(popupPlacement === undefined, '`popupPlacement` is deprecated. Please use `placement` instead.');
|
||||
}
|
||||
|
||||
// value in Cascader options should not be null
|
||||
export function warningNullOptions(options, fieldNames) {
|
||||
if (options) {
|
||||
var recursiveOptions = function recursiveOptions(optionsList) {
|
||||
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 Cascader options should not be `null`.');
|
||||
return true;
|
||||
}
|
||||
if (Array.isArray(option[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children]) && recursiveOptions(option[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
};
|
||||
recursiveOptions(options);
|
||||
}
|
||||
}
|
||||
export default warningProps;
|
||||
Reference in New Issue
Block a user