add all frontend files

This commit is contained in:
2026-01-17 15:16:36 -05:00
parent ff16ae7858
commit e40287e4aa
25704 changed files with 1935289 additions and 0 deletions

8
node_modules/rc-select/es/hooks/useAllowClear.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import type { DisplayValueType, Mode, RenderNode } from '../interface';
import React from 'react';
export declare const useAllowClear: (prefixCls: string, onClearMouseDown: React.MouseEventHandler<HTMLSpanElement>, displayValues: DisplayValueType[], allowClear?: boolean | {
clearIcon?: RenderNode;
}, clearIcon?: RenderNode, disabled?: boolean, mergedSearchValue?: string, mode?: Mode) => {
allowClear: boolean;
clearIcon: React.JSX.Element;
};

30
node_modules/rc-select/es/hooks/useAllowClear.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
import _typeof from "@babel/runtime/helpers/esm/typeof";
import TransBtn from "../TransBtn";
import React from 'react';
export var useAllowClear = function useAllowClear(prefixCls, onClearMouseDown, displayValues, allowClear, clearIcon) {
var disabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
var mergedSearchValue = arguments.length > 6 ? arguments[6] : undefined;
var mode = arguments.length > 7 ? arguments[7] : undefined;
var mergedClearIcon = React.useMemo(function () {
if (_typeof(allowClear) === 'object') {
return allowClear.clearIcon;
}
if (clearIcon) {
return clearIcon;
}
}, [allowClear, clearIcon]);
var mergedAllowClear = React.useMemo(function () {
if (!disabled && !!allowClear && (displayValues.length || mergedSearchValue) && !(mode === 'combobox' && mergedSearchValue === '')) {
return true;
}
return false;
}, [allowClear, disabled, displayValues.length, mergedSearchValue, mode]);
return {
allowClear: mergedAllowClear,
clearIcon: /*#__PURE__*/React.createElement(TransBtn, {
className: "".concat(prefixCls, "-clear"),
onMouseDown: onClearMouseDown,
customizeIcon: mergedClearIcon
}, "\xD7")
};
};

13
node_modules/rc-select/es/hooks/useBaseProps.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
/**
* BaseSelect provide some parsed data into context.
* You can use this hooks to get them.
*/
import * as React from 'react';
import type { BaseSelectProps } from '../BaseSelect';
export interface BaseSelectContextProps extends BaseSelectProps {
triggerOpen: boolean;
multiple: boolean;
toggleOpen: (open?: boolean) => void;
}
export declare const BaseSelectContext: React.Context<BaseSelectContextProps>;
export default function useBaseProps(): BaseSelectContextProps;

10
node_modules/rc-select/es/hooks/useBaseProps.js generated vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* BaseSelect provide some parsed data into context.
* You can use this hooks to get them.
*/
import * as React from 'react';
export var BaseSelectContext = /*#__PURE__*/React.createContext(null);
export default function useBaseProps() {
return React.useContext(BaseSelectContext);
}

7
node_modules/rc-select/es/hooks/useCache.d.ts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
import type { RawValueType } from '../BaseSelect';
import type { DefaultOptionType, LabelInValueType } from '../Select';
/**
* Cache `value` related LabeledValue & options.
*/
declare const _default: (labeledValues: LabelInValueType[], valueOptions: Map<RawValueType, DefaultOptionType>) => [LabelInValueType[], (val: RawValueType) => DefaultOptionType];
export default _default;

42
node_modules/rc-select/es/hooks/useCache.js generated vendored Normal file
View File

@@ -0,0 +1,42 @@
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import * as React from 'react';
/**
* Cache `value` related LabeledValue & options.
*/
export default (function (labeledValues, valueOptions) {
var cacheRef = React.useRef({
values: new Map(),
options: new Map()
});
var filledLabeledValues = React.useMemo(function () {
var _cacheRef$current = cacheRef.current,
prevValueCache = _cacheRef$current.values,
prevOptionCache = _cacheRef$current.options;
// Fill label by cache
var patchedValues = labeledValues.map(function (item) {
if (item.label === undefined) {
var _prevValueCache$get;
return _objectSpread(_objectSpread({}, item), {}, {
label: (_prevValueCache$get = prevValueCache.get(item.value)) === null || _prevValueCache$get === void 0 ? void 0 : _prevValueCache$get.label
});
}
return item;
});
// Refresh cache
var valueCache = new Map();
var optionCache = new Map();
patchedValues.forEach(function (item) {
valueCache.set(item.value, item);
optionCache.set(item.value, valueOptions.get(item.value) || prevOptionCache.get(item.value));
});
cacheRef.current.values = valueCache;
cacheRef.current.options = optionCache;
return patchedValues;
}, [labeledValues, valueOptions]);
var getOption = React.useCallback(function (val) {
return valueOptions.get(val) || cacheRef.current.options.get(val);
}, [valueOptions]);
return [filledLabeledValues, getOption];
});

5
node_modules/rc-select/es/hooks/useDelayReset.d.ts generated vendored Normal file
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];

31
node_modules/rc-select/es/hooks/useDelayReset.js generated vendored Normal file
View File

@@ -0,0 +1,31 @@
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
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,3 @@
import type { FieldNames, DefaultOptionType, SelectProps } from '../Select';
declare const _default: (options: DefaultOptionType[], fieldNames: FieldNames, searchValue?: string, filterOption?: SelectProps['filterOption'], optionFilterProp?: string) => DefaultOptionType[];
export default _default;

62
node_modules/rc-select/es/hooks/useFilterOptions.js generated vendored Normal file
View File

@@ -0,0 +1,62 @@
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import * as React from 'react';
import { toArray } from "../utils/commonUtil";
import { injectPropsWithOption } from "../utils/valueUtil";
function includes(test, search) {
return toArray(test).join('').toUpperCase().includes(search);
}
export default (function (options, fieldNames, searchValue, filterOption, optionFilterProp) {
return React.useMemo(function () {
if (!searchValue || filterOption === false) {
return options;
}
var fieldOptions = fieldNames.options,
fieldLabel = fieldNames.label,
fieldValue = fieldNames.value;
var filteredOptions = [];
var customizeFilter = typeof filterOption === 'function';
var upperSearch = searchValue.toUpperCase();
var filterFunc = customizeFilter ? filterOption : function (_, option) {
// Use provided `optionFilterProp`
if (optionFilterProp) {
return includes(option[optionFilterProp], upperSearch);
}
// Auto select `label` or `value` by option type
if (option[fieldOptions]) {
// hack `fieldLabel` since `OptionGroup` children is not `label`
return includes(option[fieldLabel !== 'children' ? fieldLabel : 'label'], upperSearch);
}
return includes(option[fieldValue], upperSearch);
};
var wrapOption = customizeFilter ? function (opt) {
return injectPropsWithOption(opt);
} : function (opt) {
return opt;
};
options.forEach(function (item) {
// Group should check child options
if (item[fieldOptions]) {
// Check group first
var matchGroup = filterFunc(searchValue, wrapOption(item));
if (matchGroup) {
filteredOptions.push(item);
} else {
// Check option
var subOptions = item[fieldOptions].filter(function (subItem) {
return filterFunc(searchValue, wrapOption(subItem));
});
if (subOptions.length) {
filteredOptions.push(_objectSpread(_objectSpread({}, item), {}, _defineProperty({}, fieldOptions, subOptions)));
}
}
return;
}
if (filterFunc(searchValue, wrapOption(item))) {
filteredOptions.push(item);
}
});
return filteredOptions;
}, [options, filterOption, optionFilterProp, searchValue, fieldNames]);
});

5
node_modules/rc-select/es/hooks/useId.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
/** Is client side and not jsdom */
export declare const isBrowserClient: boolean;
/** Get unique id for accessibility usage */
export declare function getUUID(): number | string;
export default function useId(id?: string): string;

33
node_modules/rc-select/es/hooks/useId.js generated vendored Normal file
View File

@@ -0,0 +1,33 @@
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import * as React from 'react';
import canUseDom from "rc-util/es/Dom/canUseDom";
var uuid = 0;
/** Is client side and not jsdom */
export var isBrowserClient = process.env.NODE_ENV !== 'test' && canUseDom();
/** 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;
}
export default function useId(id) {
// 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()));
}, []);
return id || innerId;
}

5
node_modules/rc-select/es/hooks/useLayoutEffect.d.ts generated vendored Normal file
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
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
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];

32
node_modules/rc-select/es/hooks/useLock.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
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];
}

12
node_modules/rc-select/es/hooks/useOptions.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
import * as React from 'react';
import type { FieldNames, RawValueType } from '../Select';
/**
* Parse `children` to `options` if `options` is not provided.
* Then flatten the `options`.
*/
declare const useOptions: <OptionType>(options: OptionType[], children: React.ReactNode, fieldNames: FieldNames, optionFilterProp: string, optionLabelProp: string) => {
options: OptionType[];
valueOptions: Map<RawValueType, OptionType>;
labelOptions: Map<React.ReactNode, OptionType>;
};
export default useOptions;

46
node_modules/rc-select/es/hooks/useOptions.js generated vendored Normal file
View File

@@ -0,0 +1,46 @@
import * as React from 'react';
import { convertChildrenToData } from "../utils/legacyUtil";
/**
* Parse `children` to `options` if `options` is not provided.
* Then flatten the `options`.
*/
var useOptions = function useOptions(options, children, fieldNames, optionFilterProp, optionLabelProp) {
return React.useMemo(function () {
var mergedOptions = options;
var childrenAsData = !options;
if (childrenAsData) {
mergedOptions = convertChildrenToData(children);
}
var valueOptions = new Map();
var labelOptions = new Map();
var setLabelOptions = function setLabelOptions(labelOptionsMap, option, key) {
if (key && typeof key === 'string') {
labelOptionsMap.set(option[key], option);
}
};
var dig = function dig(optionList) {
var isChildren = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
// for loop to speed up collection speed
for (var i = 0; i < optionList.length; i += 1) {
var option = optionList[i];
if (!option[fieldNames.options] || isChildren) {
valueOptions.set(option[fieldNames.value], option);
setLabelOptions(labelOptions, option, fieldNames.label);
// https://github.com/ant-design/ant-design/issues/35304
setLabelOptions(labelOptions, option, optionFilterProp);
setLabelOptions(labelOptions, option, optionLabelProp);
} else {
dig(option[fieldNames.options], true);
}
}
};
dig(mergedOptions);
return {
options: mergedOptions,
valueOptions: valueOptions,
labelOptions: labelOptions
};
}, [options, children, fieldNames, optionFilterProp, optionLabelProp]);
};
export default useOptions;

5
node_modules/rc-select/es/hooks/useRefFunc.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
/**
* Same as `React.useCallback` but always return a memoized function
* but redirect to real function.
*/
export default function useRefFunc<T extends (...args: any[]) => any>(callback: T): T;

14
node_modules/rc-select/es/hooks/useRefFunc.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import * as React from 'react';
/**
* Same as `React.useCallback` but always return a memoized function
* but redirect to real function.
*/
export default function useRefFunc(callback) {
var funcRef = React.useRef();
funcRef.current = callback;
var cacheFn = React.useCallback(function () {
return funcRef.current.apply(funcRef, arguments);
}, []);
return cacheFn;
}

View File

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

View File

@@ -0,0 +1,34 @@
import * as React from 'react';
export default function useSelectTriggerControl(elements, open, triggerOpen, customizedTrigger) {
var propsRef = React.useRef(null);
propsRef.current = {
open: open,
triggerOpen: triggerOpen,
customizedTrigger: customizedTrigger
};
React.useEffect(function () {
function onGlobalMouseDown(event) {
var _propsRef$current;
// If trigger is customized, Trigger will take control of popupVisible
if ((_propsRef$current = propsRef.current) !== null && _propsRef$current !== void 0 && _propsRef$current.customizedTrigger) {
return;
}
var target = event.target;
if (target.shadowRoot && event.composed) {
target = event.composedPath()[0] || target;
}
if (propsRef.current.open && elements().filter(function (element) {
return element;
}).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);
};
}, []);
}