first commit
This commit is contained in:
13
frontend/node_modules/antd/es/tree/utils/dictUtil.d.ts
generated
vendored
Normal file
13
frontend/node_modules/antd/es/tree/utils/dictUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import type { DataNode, Key } from 'rc-tree/lib/interface';
|
||||
import type { TreeProps } from '../Tree';
|
||||
type FieldNames = TreeProps['fieldNames'];
|
||||
/** 计算选中范围,只考虑expanded情况以优化性能 */
|
||||
export declare function calcRangeKeys({ treeData, expandedKeys, startKey, endKey, fieldNames, }: {
|
||||
treeData: DataNode[];
|
||||
expandedKeys: Key[];
|
||||
startKey?: Key;
|
||||
endKey?: Key;
|
||||
fieldNames?: FieldNames;
|
||||
}): Key[];
|
||||
export declare function convertDirectoryKeysToNodes(treeData: DataNode[], keys: Key[], fieldNames?: FieldNames): DataNode[];
|
||||
export {};
|
||||
72
frontend/node_modules/antd/es/tree/utils/dictUtil.js
generated
vendored
Normal file
72
frontend/node_modules/antd/es/tree/utils/dictUtil.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
||||
import { fillFieldNames } from "rc-tree/es/utils/treeUtil";
|
||||
const RECORD_NONE = 0;
|
||||
const RECORD_START = 1;
|
||||
const RECORD_END = 2;
|
||||
function traverseNodesKey(treeData, callback, fieldNames) {
|
||||
const {
|
||||
key: fieldKey,
|
||||
children: fieldChildren
|
||||
} = fieldNames;
|
||||
function processNode(dataNode) {
|
||||
const key = dataNode[fieldKey];
|
||||
const children = dataNode[fieldChildren];
|
||||
if (callback(key, dataNode) !== false) {
|
||||
traverseNodesKey(children || [], callback, fieldNames);
|
||||
}
|
||||
}
|
||||
treeData.forEach(processNode);
|
||||
}
|
||||
/** 计算选中范围,只考虑expanded情况以优化性能 */
|
||||
export function calcRangeKeys({
|
||||
treeData,
|
||||
expandedKeys,
|
||||
startKey,
|
||||
endKey,
|
||||
fieldNames
|
||||
}) {
|
||||
const keys = [];
|
||||
let record = RECORD_NONE;
|
||||
if (startKey && startKey === endKey) {
|
||||
return [startKey];
|
||||
}
|
||||
if (!startKey || !endKey) {
|
||||
return [];
|
||||
}
|
||||
function matchKey(key) {
|
||||
return key === startKey || key === endKey;
|
||||
}
|
||||
traverseNodesKey(treeData, key => {
|
||||
if (record === RECORD_END) {
|
||||
return false;
|
||||
}
|
||||
if (matchKey(key)) {
|
||||
// Match test
|
||||
keys.push(key);
|
||||
if (record === RECORD_NONE) {
|
||||
record = RECORD_START;
|
||||
} else if (record === RECORD_START) {
|
||||
record = RECORD_END;
|
||||
return false;
|
||||
}
|
||||
} else if (record === RECORD_START) {
|
||||
// Append selection
|
||||
keys.push(key);
|
||||
}
|
||||
return expandedKeys.includes(key);
|
||||
}, fillFieldNames(fieldNames));
|
||||
return keys;
|
||||
}
|
||||
export function convertDirectoryKeysToNodes(treeData, keys, fieldNames) {
|
||||
const restKeys = _toConsumableArray(keys);
|
||||
const nodes = [];
|
||||
traverseNodesKey(treeData, (key, node) => {
|
||||
const index = restKeys.indexOf(key);
|
||||
if (index !== -1) {
|
||||
nodes.push(node);
|
||||
restKeys.splice(index, 1);
|
||||
}
|
||||
return !!restKeys.length;
|
||||
}, fillFieldNames(fieldNames));
|
||||
return nodes;
|
||||
}
|
||||
11
frontend/node_modules/antd/es/tree/utils/dropIndicator.d.ts
generated
vendored
Normal file
11
frontend/node_modules/antd/es/tree/utils/dropIndicator.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import React from 'react';
|
||||
import type { DirectionType } from '../../config-provider';
|
||||
export declare const offset = 4;
|
||||
declare function dropIndicatorRender(props: {
|
||||
dropPosition: -1 | 0 | 1;
|
||||
dropLevelOffset: number;
|
||||
indent: number;
|
||||
prefixCls: string;
|
||||
direction: DirectionType;
|
||||
}): React.JSX.Element;
|
||||
export default dropIndicatorRender;
|
||||
37
frontend/node_modules/antd/es/tree/utils/dropIndicator.js
generated
vendored
Normal file
37
frontend/node_modules/antd/es/tree/utils/dropIndicator.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
"use client";
|
||||
|
||||
import React from 'react';
|
||||
export const offset = 4;
|
||||
function dropIndicatorRender(props) {
|
||||
const {
|
||||
dropPosition,
|
||||
dropLevelOffset,
|
||||
prefixCls,
|
||||
indent,
|
||||
direction = 'ltr'
|
||||
} = props;
|
||||
const startPosition = direction === 'ltr' ? 'left' : 'right';
|
||||
const endPosition = direction === 'ltr' ? 'right' : 'left';
|
||||
const style = {
|
||||
[startPosition]: -dropLevelOffset * indent + offset,
|
||||
[endPosition]: 0
|
||||
};
|
||||
switch (dropPosition) {
|
||||
case -1:
|
||||
style.top = -3;
|
||||
break;
|
||||
case 1:
|
||||
style.bottom = -3;
|
||||
break;
|
||||
default:
|
||||
// dropPosition === 0
|
||||
style.bottom = -3;
|
||||
style[startPosition] = indent + offset;
|
||||
break;
|
||||
}
|
||||
return /*#__PURE__*/React.createElement("div", {
|
||||
style: style,
|
||||
className: `${prefixCls}-drop-indicator`
|
||||
});
|
||||
}
|
||||
export default dropIndicatorRender;
|
||||
13
frontend/node_modules/antd/es/tree/utils/iconUtil.d.ts
generated
vendored
Normal file
13
frontend/node_modules/antd/es/tree/utils/iconUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import * as React from 'react';
|
||||
import type { AntTreeNodeProps, SwitcherIcon, TreeLeafIcon } from '../Tree';
|
||||
interface SwitcherIconProps {
|
||||
prefixCls: string;
|
||||
treeNodeProps: AntTreeNodeProps;
|
||||
switcherIcon?: SwitcherIcon;
|
||||
switcherLoadingIcon?: React.ReactNode;
|
||||
showLine?: boolean | {
|
||||
showLeafIcon: boolean | TreeLeafIcon;
|
||||
};
|
||||
}
|
||||
declare const SwitcherIconCom: React.FC<SwitcherIconProps>;
|
||||
export default SwitcherIconCom;
|
||||
78
frontend/node_modules/antd/es/tree/utils/iconUtil.js
generated
vendored
Normal file
78
frontend/node_modules/antd/es/tree/utils/iconUtil.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
"use client";
|
||||
|
||||
import * as React from 'react';
|
||||
import CaretDownFilled from "@ant-design/icons/es/icons/CaretDownFilled";
|
||||
import FileOutlined from "@ant-design/icons/es/icons/FileOutlined";
|
||||
import LoadingOutlined from "@ant-design/icons/es/icons/LoadingOutlined";
|
||||
import MinusSquareOutlined from "@ant-design/icons/es/icons/MinusSquareOutlined";
|
||||
import PlusSquareOutlined from "@ant-design/icons/es/icons/PlusSquareOutlined";
|
||||
import classNames from 'classnames';
|
||||
import { cloneElement } from '../../_util/reactNode';
|
||||
const SwitcherIconCom = props => {
|
||||
var _a, _b;
|
||||
const {
|
||||
prefixCls,
|
||||
switcherIcon,
|
||||
treeNodeProps,
|
||||
showLine,
|
||||
switcherLoadingIcon
|
||||
} = props;
|
||||
const {
|
||||
isLeaf,
|
||||
expanded,
|
||||
loading
|
||||
} = treeNodeProps;
|
||||
if (loading) {
|
||||
if (/*#__PURE__*/React.isValidElement(switcherLoadingIcon)) {
|
||||
return switcherLoadingIcon;
|
||||
}
|
||||
return /*#__PURE__*/React.createElement(LoadingOutlined, {
|
||||
className: `${prefixCls}-switcher-loading-icon`
|
||||
});
|
||||
}
|
||||
let showLeafIcon;
|
||||
if (showLine && typeof showLine === 'object') {
|
||||
showLeafIcon = showLine.showLeafIcon;
|
||||
}
|
||||
if (isLeaf) {
|
||||
if (!showLine) {
|
||||
return null;
|
||||
}
|
||||
if (typeof showLeafIcon !== 'boolean' && !!showLeafIcon) {
|
||||
const leafIcon = typeof showLeafIcon === 'function' ? showLeafIcon(treeNodeProps) : showLeafIcon;
|
||||
const leafCls = `${prefixCls}-switcher-line-custom-icon`;
|
||||
if (/*#__PURE__*/React.isValidElement(leafIcon)) {
|
||||
return cloneElement(leafIcon, {
|
||||
className: classNames((_a = leafIcon.props) === null || _a === void 0 ? void 0 : _a.className, leafCls)
|
||||
});
|
||||
}
|
||||
return leafIcon;
|
||||
}
|
||||
return showLeafIcon ? (/*#__PURE__*/React.createElement(FileOutlined, {
|
||||
className: `${prefixCls}-switcher-line-icon`
|
||||
})) : (/*#__PURE__*/React.createElement("span", {
|
||||
className: `${prefixCls}-switcher-leaf-line`
|
||||
}));
|
||||
}
|
||||
const switcherCls = `${prefixCls}-switcher-icon`;
|
||||
const switcher = typeof switcherIcon === 'function' ? switcherIcon(treeNodeProps) : switcherIcon;
|
||||
if (/*#__PURE__*/React.isValidElement(switcher)) {
|
||||
return cloneElement(switcher, {
|
||||
className: classNames((_b = switcher.props) === null || _b === void 0 ? void 0 : _b.className, switcherCls)
|
||||
});
|
||||
}
|
||||
if (switcher !== undefined) {
|
||||
return switcher;
|
||||
}
|
||||
if (showLine) {
|
||||
return expanded ? (/*#__PURE__*/React.createElement(MinusSquareOutlined, {
|
||||
className: `${prefixCls}-switcher-line-icon`
|
||||
})) : (/*#__PURE__*/React.createElement(PlusSquareOutlined, {
|
||||
className: `${prefixCls}-switcher-line-icon`
|
||||
}));
|
||||
}
|
||||
return /*#__PURE__*/React.createElement(CaretDownFilled, {
|
||||
className: switcherCls
|
||||
});
|
||||
};
|
||||
export default SwitcherIconCom;
|
||||
Reference in New Issue
Block a user