first commit
This commit is contained in:
19
frontend/node_modules/antd/es/_util/ActionButton.d.ts
generated
vendored
Normal file
19
frontend/node_modules/antd/es/_util/ActionButton.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import * as React from 'react';
|
||||
import type { ButtonProps, LegacyButtonType } from '../button/button';
|
||||
export interface ActionButtonProps {
|
||||
type?: LegacyButtonType;
|
||||
actionFn?: (...args: any[]) => any | PromiseLike<any>;
|
||||
close?: (...args: any[]) => void;
|
||||
autoFocus?: boolean;
|
||||
prefixCls: string;
|
||||
buttonProps?: ButtonProps;
|
||||
emitEvent?: boolean;
|
||||
quitOnNullishReturnValue?: boolean;
|
||||
children?: React.ReactNode;
|
||||
/**
|
||||
* Do not throw if is await mode
|
||||
*/
|
||||
isSilent?: () => boolean;
|
||||
}
|
||||
declare const ActionButton: React.FC<ActionButtonProps>;
|
||||
export default ActionButton;
|
||||
103
frontend/node_modules/antd/es/_util/ActionButton.js
generated
vendored
Normal file
103
frontend/node_modules/antd/es/_util/ActionButton.js
generated
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
"use client";
|
||||
|
||||
import * as React from 'react';
|
||||
import useState from "rc-util/es/hooks/useState";
|
||||
import Button from '../button';
|
||||
import { convertLegacyProps } from '../button/buttonHelpers';
|
||||
const isThenable = thing => {
|
||||
return typeof (thing === null || thing === void 0 ? void 0 : thing.then) === 'function';
|
||||
};
|
||||
const ActionButton = props => {
|
||||
const {
|
||||
type,
|
||||
children,
|
||||
prefixCls,
|
||||
buttonProps,
|
||||
close,
|
||||
autoFocus,
|
||||
emitEvent,
|
||||
isSilent,
|
||||
quitOnNullishReturnValue,
|
||||
actionFn
|
||||
} = props;
|
||||
const clickedRef = React.useRef(false);
|
||||
const buttonRef = React.useRef(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const onInternalClose = (...args) => {
|
||||
close === null || close === void 0 ? void 0 : close.apply(void 0, args);
|
||||
};
|
||||
React.useEffect(() => {
|
||||
let timeoutId = null;
|
||||
if (autoFocus) {
|
||||
timeoutId = setTimeout(() => {
|
||||
var _a;
|
||||
(_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.focus({
|
||||
preventScroll: true
|
||||
});
|
||||
});
|
||||
}
|
||||
return () => {
|
||||
if (timeoutId) {
|
||||
clearTimeout(timeoutId);
|
||||
}
|
||||
};
|
||||
}, [autoFocus]);
|
||||
const handlePromiseOnOk = returnValueOfOnOk => {
|
||||
if (!isThenable(returnValueOfOnOk)) {
|
||||
return;
|
||||
}
|
||||
setLoading(true);
|
||||
returnValueOfOnOk.then((...args) => {
|
||||
setLoading(false, true);
|
||||
onInternalClose.apply(void 0, args);
|
||||
clickedRef.current = false;
|
||||
}, e => {
|
||||
// See: https://github.com/ant-design/ant-design/issues/6183
|
||||
setLoading(false, true);
|
||||
clickedRef.current = false;
|
||||
// Do not throw if is `await` mode
|
||||
if (isSilent === null || isSilent === void 0 ? void 0 : isSilent()) {
|
||||
return;
|
||||
}
|
||||
return Promise.reject(e);
|
||||
});
|
||||
};
|
||||
const onClick = e => {
|
||||
if (clickedRef.current) {
|
||||
return;
|
||||
}
|
||||
clickedRef.current = true;
|
||||
if (!actionFn) {
|
||||
onInternalClose();
|
||||
return;
|
||||
}
|
||||
let returnValueOfOnOk;
|
||||
if (emitEvent) {
|
||||
returnValueOfOnOk = actionFn(e);
|
||||
if (quitOnNullishReturnValue && !isThenable(returnValueOfOnOk)) {
|
||||
clickedRef.current = false;
|
||||
onInternalClose(e);
|
||||
return;
|
||||
}
|
||||
} else if (actionFn.length) {
|
||||
returnValueOfOnOk = actionFn(close);
|
||||
// https://github.com/ant-design/ant-design/issues/23358
|
||||
clickedRef.current = false;
|
||||
} else {
|
||||
returnValueOfOnOk = actionFn();
|
||||
if (!isThenable(returnValueOfOnOk)) {
|
||||
onInternalClose();
|
||||
return;
|
||||
}
|
||||
}
|
||||
handlePromiseOnOk(returnValueOfOnOk);
|
||||
};
|
||||
return /*#__PURE__*/React.createElement(Button, Object.assign({}, convertLegacyProps(type), {
|
||||
onClick: onClick,
|
||||
loading: loading,
|
||||
prefixCls: prefixCls
|
||||
}, buttonProps, {
|
||||
ref: buttonRef
|
||||
}), children);
|
||||
};
|
||||
export default ActionButton;
|
||||
3
frontend/node_modules/antd/es/_util/ContextIsolator.d.ts
generated
vendored
Normal file
3
frontend/node_modules/antd/es/_util/ContextIsolator.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import React from 'react';
|
||||
declare const ContextIsolator: React.FC<Readonly<React.PropsWithChildren<Partial<Record<'space' | 'form', boolean>>>>>;
|
||||
export default ContextIsolator;
|
||||
27
frontend/node_modules/antd/es/_util/ContextIsolator.js
generated
vendored
Normal file
27
frontend/node_modules/antd/es/_util/ContextIsolator.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
"use client";
|
||||
|
||||
import React from 'react';
|
||||
import { NoFormStyle } from '../form/context';
|
||||
import { NoCompactStyle } from '../space/Compact';
|
||||
const ContextIsolator = props => {
|
||||
const {
|
||||
space,
|
||||
form,
|
||||
children
|
||||
} = props;
|
||||
if (children === undefined || children === null) {
|
||||
return null;
|
||||
}
|
||||
let result = children;
|
||||
if (form) {
|
||||
result = /*#__PURE__*/React.createElement(NoFormStyle, {
|
||||
override: true,
|
||||
status: true
|
||||
}, result);
|
||||
}
|
||||
if (space) {
|
||||
result = /*#__PURE__*/React.createElement(NoCompactStyle, null, result);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
export default ContextIsolator;
|
||||
9
frontend/node_modules/antd/es/_util/PurePanel.d.ts
generated
vendored
Normal file
9
frontend/node_modules/antd/es/_util/PurePanel.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import * as React from 'react';
|
||||
import type { AnyObject } from './type';
|
||||
export declare function withPureRenderTheme<T extends AnyObject = AnyObject>(Component: React.FC<T>): (props: T) => React.JSX.Element;
|
||||
export interface BaseProps {
|
||||
prefixCls?: string;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
declare const genPurePanel: <ComponentProps extends BaseProps = BaseProps>(Component: React.ComponentType<Readonly<ComponentProps>>, alignPropName?: "align" | "dropdownAlign" | "popupAlign", postProps?: (props: ComponentProps) => ComponentProps, defaultPrefixCls?: string, getDropdownCls?: (prefixCls: string) => string) => (props: AnyObject) => React.JSX.Element;
|
||||
export default genPurePanel;
|
||||
90
frontend/node_modules/antd/es/_util/PurePanel.js
generated
vendored
Normal file
90
frontend/node_modules/antd/es/_util/PurePanel.js
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
"use client";
|
||||
|
||||
import * as React from 'react';
|
||||
import useMergedState from "rc-util/es/hooks/useMergedState";
|
||||
import ConfigProvider, { ConfigContext } from '../config-provider';
|
||||
export function withPureRenderTheme(Component) {
|
||||
return props => (/*#__PURE__*/React.createElement(ConfigProvider, {
|
||||
theme: {
|
||||
token: {
|
||||
motion: false,
|
||||
zIndexPopupBase: 0
|
||||
}
|
||||
}
|
||||
}, /*#__PURE__*/React.createElement(Component, Object.assign({}, props))));
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
const genPurePanel = (Component, alignPropName, postProps, defaultPrefixCls, getDropdownCls) => {
|
||||
const PurePanel = props => {
|
||||
const {
|
||||
prefixCls: customizePrefixCls,
|
||||
style
|
||||
} = props;
|
||||
const holderRef = React.useRef(null);
|
||||
const [popupHeight, setPopupHeight] = React.useState(0);
|
||||
const [popupWidth, setPopupWidth] = React.useState(0);
|
||||
const [open, setOpen] = useMergedState(false, {
|
||||
value: props.open
|
||||
});
|
||||
const {
|
||||
getPrefixCls
|
||||
} = React.useContext(ConfigContext);
|
||||
const prefixCls = getPrefixCls(defaultPrefixCls || 'select', customizePrefixCls);
|
||||
React.useEffect(() => {
|
||||
// We do not care about ssr
|
||||
setOpen(true);
|
||||
if (typeof ResizeObserver !== 'undefined') {
|
||||
const resizeObserver = new ResizeObserver(entries => {
|
||||
const element = entries[0].target;
|
||||
setPopupHeight(element.offsetHeight + 8);
|
||||
setPopupWidth(element.offsetWidth);
|
||||
});
|
||||
const interval = setInterval(() => {
|
||||
var _a;
|
||||
const dropdownCls = getDropdownCls ? `.${getDropdownCls(prefixCls)}` : `.${prefixCls}-dropdown`;
|
||||
const popup = (_a = holderRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(dropdownCls);
|
||||
if (popup) {
|
||||
clearInterval(interval);
|
||||
resizeObserver.observe(popup);
|
||||
}
|
||||
}, 10);
|
||||
return () => {
|
||||
clearInterval(interval);
|
||||
resizeObserver.disconnect();
|
||||
};
|
||||
}
|
||||
}, [prefixCls]);
|
||||
let mergedProps = Object.assign(Object.assign({}, props), {
|
||||
style: Object.assign(Object.assign({}, style), {
|
||||
margin: 0
|
||||
}),
|
||||
open,
|
||||
visible: open,
|
||||
getPopupContainer: () => holderRef.current
|
||||
});
|
||||
if (postProps) {
|
||||
mergedProps = postProps(mergedProps);
|
||||
}
|
||||
if (alignPropName) {
|
||||
Object.assign(mergedProps, {
|
||||
[alignPropName]: {
|
||||
overflow: {
|
||||
adjustX: false,
|
||||
adjustY: false
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
const mergedStyle = {
|
||||
paddingBottom: popupHeight,
|
||||
position: 'relative',
|
||||
minWidth: popupWidth
|
||||
};
|
||||
return /*#__PURE__*/React.createElement("div", {
|
||||
ref: holderRef,
|
||||
style: mergedStyle
|
||||
}, /*#__PURE__*/React.createElement(Component, Object.assign({}, mergedProps)));
|
||||
};
|
||||
return withPureRenderTheme(PurePanel);
|
||||
};
|
||||
export default genPurePanel;
|
||||
4
frontend/node_modules/antd/es/_util/aria-data-attrs.d.ts
generated
vendored
Normal file
4
frontend/node_modules/antd/es/_util/aria-data-attrs.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import type * as React from 'react';
|
||||
export type HTMLAriaDataAttributes = React.AriaAttributes & {
|
||||
[key: `data-${string}`]: unknown;
|
||||
} & Pick<React.HTMLAttributes<HTMLDivElement>, 'role'>;
|
||||
1
frontend/node_modules/antd/es/_util/aria-data-attrs.js
generated
vendored
Normal file
1
frontend/node_modules/antd/es/_util/aria-data-attrs.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
frontend/node_modules/antd/es/_util/capitalize.d.ts
generated
vendored
Normal file
1
frontend/node_modules/antd/es/_util/capitalize.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export default function capitalize<T extends string>(str: T): Capitalize<T>;
|
||||
7
frontend/node_modules/antd/es/_util/capitalize.js
generated
vendored
Normal file
7
frontend/node_modules/antd/es/_util/capitalize.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
export default function capitalize(str) {
|
||||
if (typeof str !== 'string') {
|
||||
return str;
|
||||
}
|
||||
const ret = str.charAt(0).toUpperCase() + str.slice(1);
|
||||
return ret;
|
||||
}
|
||||
13
frontend/node_modules/antd/es/_util/colors.d.ts
generated
vendored
Normal file
13
frontend/node_modules/antd/es/_util/colors.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import type { PresetColorKey } from '../theme/interface';
|
||||
type InverseColor = `${PresetColorKey}-inverse`;
|
||||
export declare const PresetStatusColorTypes: readonly ["success", "processing", "error", "default", "warning"];
|
||||
export type PresetColorType = PresetColorKey | InverseColor;
|
||||
export type PresetStatusColorType = (typeof PresetStatusColorTypes)[number];
|
||||
/**
|
||||
* determine if the color keyword belongs to the `Ant Design` {@link PresetColors}.
|
||||
* @param color color to be judged
|
||||
* @param includeInverse whether to include reversed colors
|
||||
*/
|
||||
export declare function isPresetColor(color?: any, includeInverse?: boolean): boolean;
|
||||
export declare function isPresetStatusColor(color?: any): color is PresetStatusColorType;
|
||||
export {};
|
||||
18
frontend/node_modules/antd/es/_util/colors.js
generated
vendored
Normal file
18
frontend/node_modules/antd/es/_util/colors.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
||||
import { PresetColors } from '../theme/interface';
|
||||
const inverseColors = PresetColors.map(color => `${color}-inverse`);
|
||||
export const PresetStatusColorTypes = ['success', 'processing', 'error', 'default', 'warning'];
|
||||
/**
|
||||
* determine if the color keyword belongs to the `Ant Design` {@link PresetColors}.
|
||||
* @param color color to be judged
|
||||
* @param includeInverse whether to include reversed colors
|
||||
*/
|
||||
export function isPresetColor(color, includeInverse = true) {
|
||||
if (includeInverse) {
|
||||
return [].concat(_toConsumableArray(inverseColors), _toConsumableArray(PresetColors)).includes(color);
|
||||
}
|
||||
return PresetColors.includes(color);
|
||||
}
|
||||
export function isPresetStatusColor(color) {
|
||||
return PresetStatusColorTypes.includes(color);
|
||||
}
|
||||
4
frontend/node_modules/antd/es/_util/convertToTooltipProps.d.ts
generated
vendored
Normal file
4
frontend/node_modules/antd/es/_util/convertToTooltipProps.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import type { TooltipProps } from '../tooltip';
|
||||
declare function convertToTooltipProps<P extends TooltipProps>(tooltip: P | ReactNode): P | null;
|
||||
export default convertToTooltipProps;
|
||||
14
frontend/node_modules/antd/es/_util/convertToTooltipProps.js
generated
vendored
Normal file
14
frontend/node_modules/antd/es/_util/convertToTooltipProps.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { isValidElement } from 'react';
|
||||
function convertToTooltipProps(tooltip) {
|
||||
// isNil
|
||||
if (tooltip === undefined || tooltip === null) {
|
||||
return null;
|
||||
}
|
||||
if (typeof tooltip === 'object' && ! /*#__PURE__*/isValidElement(tooltip)) {
|
||||
return tooltip;
|
||||
}
|
||||
return {
|
||||
title: tooltip
|
||||
};
|
||||
}
|
||||
export default convertToTooltipProps;
|
||||
1
frontend/node_modules/antd/es/_util/easings.d.ts
generated
vendored
Normal file
1
frontend/node_modules/antd/es/_util/easings.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function easeInOutCubic(t: number, b: number, c: number, d: number): number;
|
||||
9
frontend/node_modules/antd/es/_util/easings.js
generated
vendored
Normal file
9
frontend/node_modules/antd/es/_util/easings.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export function easeInOutCubic(t, b, c, d) {
|
||||
const cc = c - b;
|
||||
t /= d / 2;
|
||||
if (t < 1) {
|
||||
return cc / 2 * t * t * t + b;
|
||||
}
|
||||
// biome-ignore lint: it is a common easing function
|
||||
return cc / 2 * ((t -= 2) * t * t + 2) + b;
|
||||
}
|
||||
4
frontend/node_modules/antd/es/_util/extendsObject.d.ts
generated
vendored
Normal file
4
frontend/node_modules/antd/es/_util/extendsObject.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
declare function mergeProps<A, B>(a: A, b: B): B & A;
|
||||
declare function mergeProps<A, B, C>(a: A, b: B, c: C): C & B & A;
|
||||
declare function mergeProps<A, B, C, D>(a: A, b: B, c: C, d: D): D & C & B & A;
|
||||
export default mergeProps;
|
||||
14
frontend/node_modules/antd/es/_util/extendsObject.js
generated
vendored
Normal file
14
frontend/node_modules/antd/es/_util/extendsObject.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
function mergeProps(...items) {
|
||||
const ret = {};
|
||||
items.forEach(item => {
|
||||
if (item) {
|
||||
Object.keys(item).forEach(key => {
|
||||
if (item[key] !== undefined) {
|
||||
ret[key] = item[key];
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
export default mergeProps;
|
||||
3
frontend/node_modules/antd/es/_util/gapSize.d.ts
generated
vendored
Normal file
3
frontend/node_modules/antd/es/_util/gapSize.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { SizeType } from '../config-provider/SizeContext';
|
||||
export declare function isPresetSize(size?: SizeType | string | number): size is SizeType;
|
||||
export declare function isValidGapNumber(size?: SizeType | string | number): size is number;
|
||||
10
frontend/node_modules/antd/es/_util/gapSize.js
generated
vendored
Normal file
10
frontend/node_modules/antd/es/_util/gapSize.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
export function isPresetSize(size) {
|
||||
return ['small', 'middle', 'large'].includes(size);
|
||||
}
|
||||
export function isValidGapNumber(size) {
|
||||
if (!size) {
|
||||
// The case of size = 0 is deliberately excluded here, because the default value of the gap attribute in CSS is 0, so if the user passes 0 in, we can directly ignore it.
|
||||
return false;
|
||||
}
|
||||
return typeof size === 'number' && !Number.isNaN(size);
|
||||
}
|
||||
4
frontend/node_modules/antd/es/_util/getAllowClear.d.ts
generated
vendored
Normal file
4
frontend/node_modules/antd/es/_util/getAllowClear.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { BaseInputProps } from 'rc-input/lib/interface';
|
||||
export type AllowClear = BaseInputProps['allowClear'];
|
||||
declare const getAllowClear: (allowClear: AllowClear) => AllowClear;
|
||||
export default getAllowClear;
|
||||
16
frontend/node_modules/antd/es/_util/getAllowClear.js
generated
vendored
Normal file
16
frontend/node_modules/antd/es/_util/getAllowClear.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use client";
|
||||
|
||||
import React from 'react';
|
||||
import CloseCircleFilled from "@ant-design/icons/es/icons/CloseCircleFilled";
|
||||
const getAllowClear = allowClear => {
|
||||
let mergedAllowClear;
|
||||
if (typeof allowClear === 'object' && (allowClear === null || allowClear === void 0 ? void 0 : allowClear.clearIcon)) {
|
||||
mergedAllowClear = allowClear;
|
||||
} else if (allowClear) {
|
||||
mergedAllowClear = {
|
||||
clearIcon: /*#__PURE__*/React.createElement(CloseCircleFilled, null)
|
||||
};
|
||||
}
|
||||
return mergedAllowClear;
|
||||
};
|
||||
export default getAllowClear;
|
||||
3
frontend/node_modules/antd/es/_util/getRenderPropValue.d.ts
generated
vendored
Normal file
3
frontend/node_modules/antd/es/_util/getRenderPropValue.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type * as React from 'react';
|
||||
export type RenderFunction = () => React.ReactNode;
|
||||
export declare const getRenderPropValue: (propValue?: React.ReactNode | RenderFunction) => React.ReactNode;
|
||||
6
frontend/node_modules/antd/es/_util/getRenderPropValue.js
generated
vendored
Normal file
6
frontend/node_modules/antd/es/_util/getRenderPropValue.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export const getRenderPropValue = propValue => {
|
||||
if (!propValue) {
|
||||
return null;
|
||||
}
|
||||
return typeof propValue === 'function' ? propValue() : propValue;
|
||||
};
|
||||
3
frontend/node_modules/antd/es/_util/getScroll.d.ts
generated
vendored
Normal file
3
frontend/node_modules/antd/es/_util/getScroll.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export declare function isWindow(obj: any): obj is Window;
|
||||
declare const getScroll: (target: HTMLElement | Window | Document | null) => number;
|
||||
export default getScroll;
|
||||
31
frontend/node_modules/antd/es/_util/getScroll.js
generated
vendored
Normal file
31
frontend/node_modules/antd/es/_util/getScroll.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
export function isWindow(obj) {
|
||||
return obj !== null && obj !== undefined && obj === obj.window;
|
||||
}
|
||||
const getScroll = target => {
|
||||
var _a, _b;
|
||||
if (typeof window === 'undefined') {
|
||||
/* istanbul ignore next */
|
||||
return 0;
|
||||
}
|
||||
let result = 0;
|
||||
if (isWindow(target)) {
|
||||
result = target.pageYOffset;
|
||||
} else if (target instanceof Document) {
|
||||
result = target.documentElement.scrollTop;
|
||||
} else if (target instanceof HTMLElement) {
|
||||
result = target.scrollTop;
|
||||
} else if (target) {
|
||||
// According to the type inference, the `target` is `never` type.
|
||||
// Since we configured the loose mode type checking, and supports mocking the target with such shape below::
|
||||
// `{ documentElement: { scrollLeft: 200, scrollTop: 400 } }`,
|
||||
// the program may falls into this branch.
|
||||
// Check the corresponding tests for details. Don't sure what is the real scenario this happens.
|
||||
/* biome-ignore lint/complexity/useLiteralKeys: target is a never type */ /* eslint-disable-next-line dot-notation */
|
||||
result = target['scrollTop'];
|
||||
}
|
||||
if (target && !isWindow(target) && typeof result !== 'number') {
|
||||
result = (_b = ((_a = target.ownerDocument) !== null && _a !== void 0 ? _a : target).documentElement) === null || _b === void 0 ? void 0 : _b.scrollTop;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
export default getScroll;
|
||||
8
frontend/node_modules/antd/es/_util/hooks/index.d.ts
generated
vendored
Normal file
8
frontend/node_modules/antd/es/_util/hooks/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export * from './useClosable';
|
||||
export * from './useForceUpdate';
|
||||
export * from './useMergeSemantic';
|
||||
export * from './useMultipleSelect';
|
||||
export * from './usePatchElement';
|
||||
export * from './useProxyImperativeHandle';
|
||||
export * from './useSyncState';
|
||||
export * from './useZIndex';
|
||||
8
frontend/node_modules/antd/es/_util/hooks/index.js
generated
vendored
Normal file
8
frontend/node_modules/antd/es/_util/hooks/index.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export * from './useClosable';
|
||||
export * from './useForceUpdate';
|
||||
export * from './useMergeSemantic';
|
||||
export * from './useMultipleSelect';
|
||||
export * from './usePatchElement';
|
||||
export * from './useProxyImperativeHandle';
|
||||
export * from './useSyncState';
|
||||
export * from './useZIndex';
|
||||
33
frontend/node_modules/antd/es/_util/hooks/useClosable.d.ts
generated
vendored
Normal file
33
frontend/node_modules/antd/es/_util/hooks/useClosable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import React from 'react';
|
||||
import type { DialogProps } from 'rc-dialog';
|
||||
import type { HTMLAriaDataAttributes } from '../aria-data-attrs';
|
||||
export type ClosableType = DialogProps['closable'];
|
||||
export type BaseContextClosable = {
|
||||
closable?: ClosableType;
|
||||
closeIcon?: ReactNode;
|
||||
};
|
||||
export type ContextClosable<T extends BaseContextClosable = any> = Partial<Pick<T, 'closable' | 'closeIcon'>>;
|
||||
export declare function pickClosable<T extends BaseContextClosable>(context?: ContextClosable<T>): ContextClosable<T> | undefined;
|
||||
export type UseClosableParams = {
|
||||
closable?: ClosableType;
|
||||
closeIcon?: ReactNode;
|
||||
defaultClosable?: boolean;
|
||||
defaultCloseIcon?: ReactNode;
|
||||
customCloseIconRender?: (closeIcon: ReactNode) => ReactNode;
|
||||
context?: ContextClosable;
|
||||
};
|
||||
/** Collection contains the all the props related with closable. e.g. `closable`, `closeIcon` */
|
||||
interface ClosableCollection {
|
||||
closable?: ClosableType;
|
||||
closeIcon?: ReactNode;
|
||||
}
|
||||
interface FallbackCloseCollection extends ClosableCollection {
|
||||
/**
|
||||
* Some components need to wrap CloseIcon twice,
|
||||
* this method will be executed once after the final CloseIcon is calculated
|
||||
*/
|
||||
closeIconRender?: (closeIcon: ReactNode) => ReactNode;
|
||||
}
|
||||
export declare const useClosable: (propCloseCollection?: ClosableCollection, contextCloseCollection?: ClosableCollection | null, fallbackCloseCollection?: FallbackCloseCollection) => [closable: boolean, closeIcon: React.ReactNode, closeBtnIsDisabled: boolean, ariaOrDataProps?: HTMLAriaDataAttributes];
|
||||
export {};
|
||||
106
frontend/node_modules/antd/es/_util/hooks/useClosable.js
generated
vendored
Normal file
106
frontend/node_modules/antd/es/_util/hooks/useClosable.js
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
"use client";
|
||||
|
||||
import React from 'react';
|
||||
import CloseOutlined from "@ant-design/icons/es/icons/CloseOutlined";
|
||||
import pickAttrs from "rc-util/es/pickAttrs";
|
||||
import { useLocale } from '../../locale';
|
||||
import defaultLocale from '../../locale/en_US';
|
||||
import extendsObject from '../extendsObject';
|
||||
export function pickClosable(context) {
|
||||
if (!context) {
|
||||
return undefined;
|
||||
}
|
||||
const {
|
||||
closable,
|
||||
closeIcon
|
||||
} = context;
|
||||
return {
|
||||
closable,
|
||||
closeIcon
|
||||
};
|
||||
}
|
||||
/** Convert `closable` and `closeIcon` to config object */
|
||||
function useClosableConfig(closableCollection) {
|
||||
const {
|
||||
closable,
|
||||
closeIcon
|
||||
} = closableCollection || {};
|
||||
return React.useMemo(() => {
|
||||
if (
|
||||
// If `closable`, whatever rest be should be true
|
||||
!closable && (closable === false || closeIcon === false || closeIcon === null)) {
|
||||
return false;
|
||||
}
|
||||
if (closable === undefined && closeIcon === undefined) {
|
||||
return null;
|
||||
}
|
||||
let closableConfig = {
|
||||
closeIcon: typeof closeIcon !== 'boolean' && closeIcon !== null ? closeIcon : undefined
|
||||
};
|
||||
if (closable && typeof closable === 'object') {
|
||||
closableConfig = Object.assign(Object.assign({}, closableConfig), closable);
|
||||
}
|
||||
return closableConfig;
|
||||
}, [closable, closeIcon]);
|
||||
}
|
||||
/** Use same object to support `useMemo` optimization */
|
||||
const EmptyFallbackCloseCollection = {};
|
||||
export const useClosable = (propCloseCollection, contextCloseCollection, fallbackCloseCollection = EmptyFallbackCloseCollection) => {
|
||||
// Align the `props`, `context` `fallback` to config object first
|
||||
const propCloseConfig = useClosableConfig(propCloseCollection);
|
||||
const contextCloseConfig = useClosableConfig(contextCloseCollection);
|
||||
const [contextLocale] = useLocale('global', defaultLocale.global);
|
||||
const closeBtnIsDisabled = typeof propCloseConfig !== 'boolean' ? !!(propCloseConfig === null || propCloseConfig === void 0 ? void 0 : propCloseConfig.disabled) : false;
|
||||
const mergedFallbackCloseCollection = React.useMemo(() => Object.assign({
|
||||
closeIcon: /*#__PURE__*/React.createElement(CloseOutlined, null)
|
||||
}, fallbackCloseCollection), [fallbackCloseCollection]);
|
||||
// Use fallback logic to fill the config
|
||||
const mergedClosableConfig = React.useMemo(() => {
|
||||
// ================ Props First ================
|
||||
// Skip if prop is disabled
|
||||
if (propCloseConfig === false) {
|
||||
return false;
|
||||
}
|
||||
if (propCloseConfig) {
|
||||
return extendsObject(mergedFallbackCloseCollection, contextCloseConfig, propCloseConfig);
|
||||
}
|
||||
// =============== Context Second ==============
|
||||
// Skip if context is disabled
|
||||
if (contextCloseConfig === false) {
|
||||
return false;
|
||||
}
|
||||
if (contextCloseConfig) {
|
||||
return extendsObject(mergedFallbackCloseCollection, contextCloseConfig);
|
||||
}
|
||||
// ============= Fallback Default ==============
|
||||
return !mergedFallbackCloseCollection.closable ? false : mergedFallbackCloseCollection;
|
||||
}, [propCloseConfig, contextCloseConfig, mergedFallbackCloseCollection]);
|
||||
// Calculate the final closeIcon
|
||||
return React.useMemo(() => {
|
||||
var _a, _b;
|
||||
if (mergedClosableConfig === false) {
|
||||
return [false, null, closeBtnIsDisabled, {}];
|
||||
}
|
||||
const {
|
||||
closeIconRender
|
||||
} = mergedFallbackCloseCollection;
|
||||
const {
|
||||
closeIcon
|
||||
} = mergedClosableConfig;
|
||||
let mergedCloseIcon = closeIcon;
|
||||
// Wrap the closeIcon with aria props
|
||||
const ariaOrDataProps = pickAttrs(mergedClosableConfig, true);
|
||||
if (mergedCloseIcon !== null && mergedCloseIcon !== undefined) {
|
||||
// Wrap the closeIcon if needed
|
||||
if (closeIconRender) {
|
||||
mergedCloseIcon = closeIconRender(closeIcon);
|
||||
}
|
||||
mergedCloseIcon = /*#__PURE__*/React.isValidElement(mergedCloseIcon) ? (/*#__PURE__*/React.cloneElement(mergedCloseIcon, Object.assign(Object.assign(Object.assign({}, mergedCloseIcon.props), {
|
||||
'aria-label': (_b = (_a = mergedCloseIcon.props) === null || _a === void 0 ? void 0 : _a['aria-label']) !== null && _b !== void 0 ? _b : contextLocale.close
|
||||
}), ariaOrDataProps))) : (/*#__PURE__*/React.createElement("span", Object.assign({
|
||||
"aria-label": contextLocale.close
|
||||
}, ariaOrDataProps), mergedCloseIcon));
|
||||
}
|
||||
return [true, mergedCloseIcon, closeBtnIsDisabled, ariaOrDataProps];
|
||||
}, [closeBtnIsDisabled, contextLocale.close, mergedClosableConfig, mergedFallbackCloseCollection]);
|
||||
};
|
||||
2
frontend/node_modules/antd/es/_util/hooks/useForceUpdate.d.ts
generated
vendored
Normal file
2
frontend/node_modules/antd/es/_util/hooks/useForceUpdate.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import React from 'react';
|
||||
export declare const useForceUpdate: () => [number, React.ActionDispatch<[]>];
|
||||
4
frontend/node_modules/antd/es/_util/hooks/useForceUpdate.js
generated
vendored
Normal file
4
frontend/node_modules/antd/es/_util/hooks/useForceUpdate.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import React from 'react';
|
||||
export const useForceUpdate = () => {
|
||||
return React.useReducer(ori => ori + 1, 0);
|
||||
};
|
||||
14
frontend/node_modules/antd/es/_util/hooks/useMergeSemantic.d.ts
generated
vendored
Normal file
14
frontend/node_modules/antd/es/_util/hooks/useMergeSemantic.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import type { ValidChar } from '../type';
|
||||
type TemplateSemanticClassNames<T extends string> = Partial<Record<T, string>>;
|
||||
export type SemanticSchema = {
|
||||
_default?: string;
|
||||
} & {
|
||||
[key: `${ValidChar}${string}`]: SemanticSchema;
|
||||
};
|
||||
export declare function mergeClassNames<T extends string, SemanticClassNames extends Partial<Record<T, any>> = TemplateSemanticClassNames<T>>(schema?: SemanticSchema, ...classNames: (SemanticClassNames | undefined)[]): any;
|
||||
/**
|
||||
* Merge classNames and styles from multiple sources.
|
||||
* When `schema` is provided, it will **must** provide the nest object structure.
|
||||
*/
|
||||
export declare const useMergeSemantic: <ClassNamesType extends object, StylesType extends object>(classNamesList: (ClassNamesType | undefined)[], stylesList: (StylesType | undefined)[], schema?: SemanticSchema) => readonly [ClassNamesType, StylesType];
|
||||
export {};
|
||||
70
frontend/node_modules/antd/es/_util/hooks/useMergeSemantic.js
generated
vendored
Normal file
70
frontend/node_modules/antd/es/_util/hooks/useMergeSemantic.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
||||
import * as React from 'react';
|
||||
import classnames from 'classnames';
|
||||
// ========================= ClassNames =========================
|
||||
export function mergeClassNames(schema, ...classNames) {
|
||||
const mergedSchema = schema || {};
|
||||
return classNames.reduce((acc, cur) => {
|
||||
// Loop keys of the current classNames
|
||||
Object.keys(cur || {}).forEach(key => {
|
||||
const keySchema = mergedSchema[key];
|
||||
const curVal = cur[key];
|
||||
if (keySchema && typeof keySchema === 'object') {
|
||||
if (curVal && typeof curVal === 'object') {
|
||||
// Loop fill
|
||||
acc[key] = mergeClassNames(keySchema, acc[key], curVal);
|
||||
} else {
|
||||
// Covert string to object structure
|
||||
const {
|
||||
_default: defaultField
|
||||
} = keySchema;
|
||||
if (defaultField) {
|
||||
acc[key] = acc[key] || {};
|
||||
acc[key][defaultField] = classnames(acc[key][defaultField], curVal);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Flatten fill
|
||||
acc[key] = classnames(acc[key], curVal);
|
||||
}
|
||||
});
|
||||
return acc;
|
||||
}, {});
|
||||
}
|
||||
function useSemanticClassNames(schema, ...classNames) {
|
||||
return React.useMemo(() => mergeClassNames.apply(void 0, [schema].concat(classNames)), [classNames, schema]);
|
||||
}
|
||||
// =========================== Styles ===========================
|
||||
function useSemanticStyles(...styles) {
|
||||
return React.useMemo(() => {
|
||||
return styles.reduce((acc, cur = {}) => {
|
||||
Object.keys(cur).forEach(key => {
|
||||
acc[key] = Object.assign(Object.assign({}, acc[key]), cur[key]);
|
||||
});
|
||||
return acc;
|
||||
}, {});
|
||||
}, [styles]);
|
||||
}
|
||||
// =========================== Export ===========================
|
||||
function fillObjectBySchema(obj, schema) {
|
||||
const newObj = Object.assign({}, obj);
|
||||
Object.keys(schema).forEach(key => {
|
||||
if (key !== '_default') {
|
||||
const nestSchema = schema[key];
|
||||
const nextValue = newObj[key] || {};
|
||||
newObj[key] = nestSchema ? fillObjectBySchema(nextValue, nestSchema) : nextValue;
|
||||
}
|
||||
});
|
||||
return newObj;
|
||||
}
|
||||
/**
|
||||
* Merge classNames and styles from multiple sources.
|
||||
* When `schema` is provided, it will **must** provide the nest object structure.
|
||||
*/
|
||||
export const useMergeSemantic = (classNamesList, stylesList, schema) => {
|
||||
const mergedClassNames = useSemanticClassNames.apply(void 0, [schema].concat(_toConsumableArray(classNamesList)));
|
||||
const mergedStyles = useSemanticStyles.apply(void 0, _toConsumableArray(stylesList));
|
||||
return React.useMemo(() => {
|
||||
return [fillObjectBySchema(mergedClassNames, schema), fillObjectBySchema(mergedStyles, schema)];
|
||||
}, [mergedClassNames, mergedStyles, schema]);
|
||||
};
|
||||
6
frontend/node_modules/antd/es/_util/hooks/useMultipleSelect.d.ts
generated
vendored
Normal file
6
frontend/node_modules/antd/es/_util/hooks/useMultipleSelect.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export type PrevSelectedIndex = null | number;
|
||||
/**
|
||||
* @title multipleSelect hooks
|
||||
* @description multipleSelect by hold down shift key
|
||||
*/
|
||||
export declare const useMultipleSelect: <T, K>(getKey: (item: T, index: number, array: T[]) => K) => readonly [(currentSelectedIndex: number, data: T[], selectedKeys: Set<K>) => K[], import("react").Dispatch<import("react").SetStateAction<PrevSelectedIndex>>];
|
||||
31
frontend/node_modules/antd/es/_util/hooks/useMultipleSelect.js
generated
vendored
Normal file
31
frontend/node_modules/antd/es/_util/hooks/useMultipleSelect.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import { useCallback, useState } from 'react';
|
||||
/**
|
||||
* @title multipleSelect hooks
|
||||
* @description multipleSelect by hold down shift key
|
||||
*/
|
||||
export const useMultipleSelect = getKey => {
|
||||
const [prevSelectedIndex, setPrevSelectedIndex] = useState(null);
|
||||
const multipleSelect = useCallback((currentSelectedIndex, data, selectedKeys) => {
|
||||
const configPrevSelectedIndex = prevSelectedIndex !== null && prevSelectedIndex !== void 0 ? prevSelectedIndex : currentSelectedIndex;
|
||||
// add/delete the selected range
|
||||
const startIndex = Math.min(configPrevSelectedIndex || 0, currentSelectedIndex);
|
||||
const endIndex = Math.max(configPrevSelectedIndex || 0, currentSelectedIndex);
|
||||
const rangeKeys = data.slice(startIndex, endIndex + 1).map(getKey);
|
||||
const shouldSelected = rangeKeys.some(rangeKey => !selectedKeys.has(rangeKey));
|
||||
const changedKeys = [];
|
||||
rangeKeys.forEach(item => {
|
||||
if (shouldSelected) {
|
||||
if (!selectedKeys.has(item)) {
|
||||
changedKeys.push(item);
|
||||
}
|
||||
selectedKeys.add(item);
|
||||
} else {
|
||||
selectedKeys.delete(item);
|
||||
changedKeys.push(item);
|
||||
}
|
||||
});
|
||||
setPrevSelectedIndex(shouldSelected ? endIndex : null);
|
||||
return changedKeys;
|
||||
}, [prevSelectedIndex]);
|
||||
return [multipleSelect, setPrevSelectedIndex];
|
||||
};
|
||||
2
frontend/node_modules/antd/es/_util/hooks/usePatchElement.d.ts
generated
vendored
Normal file
2
frontend/node_modules/antd/es/_util/hooks/usePatchElement.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import * as React from 'react';
|
||||
export declare const usePatchElement: () => [React.ReactElement[], (element: React.ReactElement) => () => void];
|
||||
15
frontend/node_modules/antd/es/_util/hooks/usePatchElement.js
generated
vendored
Normal file
15
frontend/node_modules/antd/es/_util/hooks/usePatchElement.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
||||
import * as React from 'react';
|
||||
export const usePatchElement = () => {
|
||||
const [elements, setElements] = React.useState([]);
|
||||
const patchElement = React.useCallback(element => {
|
||||
// append a new element to elements (and create a new ref)
|
||||
setElements(originElements => [].concat(_toConsumableArray(originElements), [element]));
|
||||
// return a function that removes the new element out of elements (and create a new ref)
|
||||
// it works a little like useEffect
|
||||
return () => {
|
||||
setElements(originElements => originElements.filter(ele => ele !== element));
|
||||
};
|
||||
}, []);
|
||||
return [elements, patchElement];
|
||||
};
|
||||
4
frontend/node_modules/antd/es/_util/hooks/useProxyImperativeHandle.d.ts
generated
vendored
Normal file
4
frontend/node_modules/antd/es/_util/hooks/useProxyImperativeHandle.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { Ref } from 'react';
|
||||
export declare const useProxyImperativeHandle: <NativeELementType extends HTMLElement, ReturnRefType extends {
|
||||
nativeElement: NativeELementType;
|
||||
}>(ref: Ref<any> | undefined, init: () => ReturnRefType) => void;
|
||||
34
frontend/node_modules/antd/es/_util/hooks/useProxyImperativeHandle.js
generated
vendored
Normal file
34
frontend/node_modules/antd/es/_util/hooks/useProxyImperativeHandle.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
// Proxy the dom ref with `{ nativeElement, otherFn }` type
|
||||
// ref: https://github.com/ant-design/ant-design/discussions/45242
|
||||
import { useImperativeHandle } from 'react';
|
||||
function fillProxy(element, handler) {
|
||||
element._antProxy = element._antProxy || {};
|
||||
Object.keys(handler).forEach(key => {
|
||||
if (!(key in element._antProxy)) {
|
||||
const ori = element[key];
|
||||
element._antProxy[key] = ori;
|
||||
element[key] = handler[key];
|
||||
}
|
||||
});
|
||||
return element;
|
||||
}
|
||||
export const useProxyImperativeHandle = (ref, init) => {
|
||||
return useImperativeHandle(ref, () => {
|
||||
const refObj = init();
|
||||
const {
|
||||
nativeElement
|
||||
} = refObj;
|
||||
if (typeof Proxy !== 'undefined') {
|
||||
return new Proxy(nativeElement, {
|
||||
get(obj, prop) {
|
||||
if (refObj[prop]) {
|
||||
return refObj[prop];
|
||||
}
|
||||
return Reflect.get(obj, prop);
|
||||
}
|
||||
});
|
||||
}
|
||||
// Fallback of IE
|
||||
return fillProxy(nativeElement, refObj);
|
||||
});
|
||||
};
|
||||
3
frontend/node_modules/antd/es/_util/hooks/useSyncState.d.ts
generated
vendored
Normal file
3
frontend/node_modules/antd/es/_util/hooks/useSyncState.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
type UseSyncStateProps<T> = readonly [() => T, (newValue: T) => void];
|
||||
export declare const useSyncState: <T>(initialValue: T) => UseSyncStateProps<T>;
|
||||
export {};
|
||||
11
frontend/node_modules/antd/es/_util/hooks/useSyncState.js
generated
vendored
Normal file
11
frontend/node_modules/antd/es/_util/hooks/useSyncState.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import * as React from 'react';
|
||||
import { useForceUpdate } from './useForceUpdate';
|
||||
export const useSyncState = initialValue => {
|
||||
const ref = React.useRef(initialValue);
|
||||
const [, forceUpdate] = useForceUpdate();
|
||||
return [() => ref.current, newValue => {
|
||||
ref.current = newValue;
|
||||
// re-render
|
||||
forceUpdate();
|
||||
}];
|
||||
};
|
||||
8
frontend/node_modules/antd/es/_util/hooks/useZIndex.d.ts
generated
vendored
Normal file
8
frontend/node_modules/antd/es/_util/hooks/useZIndex.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export type ZIndexContainer = 'Modal' | 'Drawer' | 'Popover' | 'Popconfirm' | 'Tooltip' | 'Tour' | 'FloatButton';
|
||||
export type ZIndexConsumer = 'SelectLike' | 'Dropdown' | 'DatePicker' | 'Menu' | 'ImagePreview';
|
||||
export declare const CONTAINER_MAX_OFFSET: number;
|
||||
export declare const containerBaseZIndexOffset: Record<ZIndexContainer, number>;
|
||||
export declare const consumerBaseZIndexOffset: Record<ZIndexConsumer, number>;
|
||||
type ReturnResult = [zIndex: number | undefined, contextZIndex: number];
|
||||
export declare const useZIndex: (componentType: ZIndexContainer | ZIndexConsumer, customZIndex?: number) => ReturnResult;
|
||||
export {};
|
||||
64
frontend/node_modules/antd/es/_util/hooks/useZIndex.js
generated
vendored
Normal file
64
frontend/node_modules/antd/es/_util/hooks/useZIndex.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
import React from 'react';
|
||||
import useToken from '../../theme/useToken';
|
||||
import { devUseWarning } from '../warning';
|
||||
import zIndexContext from '../zindexContext';
|
||||
// Z-Index control range
|
||||
// Container: 1000 + offset 100 (max base + 10 * offset = 2000)
|
||||
// Popover: offset 50
|
||||
// Notification: Container Max zIndex + componentOffset
|
||||
const CONTAINER_OFFSET = 100;
|
||||
const CONTAINER_OFFSET_MAX_COUNT = 10;
|
||||
export const CONTAINER_MAX_OFFSET = CONTAINER_OFFSET * CONTAINER_OFFSET_MAX_COUNT;
|
||||
/**
|
||||
* Static function will default be the `CONTAINER_MAX_OFFSET`.
|
||||
* But it still may have children component like Select, Dropdown.
|
||||
* So the warning zIndex should exceed the `CONTAINER_MAX_OFFSET`.
|
||||
*/
|
||||
const CONTAINER_MAX_OFFSET_WITH_CHILDREN = CONTAINER_MAX_OFFSET + CONTAINER_OFFSET;
|
||||
export const containerBaseZIndexOffset = {
|
||||
Modal: CONTAINER_OFFSET,
|
||||
Drawer: CONTAINER_OFFSET,
|
||||
Popover: CONTAINER_OFFSET,
|
||||
Popconfirm: CONTAINER_OFFSET,
|
||||
Tooltip: CONTAINER_OFFSET,
|
||||
Tour: CONTAINER_OFFSET,
|
||||
FloatButton: CONTAINER_OFFSET
|
||||
};
|
||||
export const consumerBaseZIndexOffset = {
|
||||
SelectLike: 50,
|
||||
Dropdown: 50,
|
||||
DatePicker: 50,
|
||||
Menu: 50,
|
||||
ImagePreview: 1
|
||||
};
|
||||
function isContainerType(type) {
|
||||
return type in containerBaseZIndexOffset;
|
||||
}
|
||||
export const useZIndex = (componentType, customZIndex) => {
|
||||
const [, token] = useToken();
|
||||
const parentZIndex = React.useContext(zIndexContext);
|
||||
const isContainer = isContainerType(componentType);
|
||||
let result;
|
||||
if (customZIndex !== undefined) {
|
||||
result = [customZIndex, customZIndex];
|
||||
} else {
|
||||
let zIndex = parentZIndex !== null && parentZIndex !== void 0 ? parentZIndex : 0;
|
||||
if (isContainer) {
|
||||
zIndex +=
|
||||
// Use preset token zIndex by default but not stack when has parent container
|
||||
(parentZIndex ? 0 : token.zIndexPopupBase) +
|
||||
// Container offset
|
||||
containerBaseZIndexOffset[componentType];
|
||||
} else {
|
||||
zIndex += consumerBaseZIndexOffset[componentType];
|
||||
}
|
||||
result = [parentZIndex === undefined ? customZIndex : zIndex, zIndex];
|
||||
}
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const warning = devUseWarning(componentType);
|
||||
const maxZIndex = token.zIndexPopupBase + CONTAINER_MAX_OFFSET_WITH_CHILDREN;
|
||||
const currentZIndex = result[0] || 0;
|
||||
process.env.NODE_ENV !== "production" ? warning(customZIndex !== undefined || currentZIndex <= maxZIndex, 'usage', '`zIndex` is over design token `zIndexPopupBase` too much. It may cause unexpected override.') : void 0;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
2
frontend/node_modules/antd/es/_util/isPrimitive.d.ts
generated
vendored
Normal file
2
frontend/node_modules/antd/es/_util/isPrimitive.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
declare const isPrimitive: (value: unknown) => boolean;
|
||||
export default isPrimitive;
|
||||
2
frontend/node_modules/antd/es/_util/isPrimitive.js
generated
vendored
Normal file
2
frontend/node_modules/antd/es/_util/isPrimitive.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
const isPrimitive = value => typeof value !== 'object' && typeof value !== 'function' || value === null;
|
||||
export default isPrimitive;
|
||||
4
frontend/node_modules/antd/es/_util/mediaQueryUtil.d.ts
generated
vendored
Normal file
4
frontend/node_modules/antd/es/_util/mediaQueryUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
type MQListenerHandler = (mql: MediaQueryList, handler: (e: MediaQueryListEvent) => void) => void;
|
||||
export declare const addMediaQueryListener: MQListenerHandler;
|
||||
export declare const removeMediaQueryListener: MQListenerHandler;
|
||||
export {};
|
||||
16
frontend/node_modules/antd/es/_util/mediaQueryUtil.js
generated
vendored
Normal file
16
frontend/node_modules/antd/es/_util/mediaQueryUtil.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
export const addMediaQueryListener = (mql, handler) => {
|
||||
// Don't delete here, please keep the code compatible
|
||||
if (typeof (mql === null || mql === void 0 ? void 0 : mql.addEventListener) !== 'undefined') {
|
||||
mql.addEventListener('change', handler);
|
||||
} else if (typeof (mql === null || mql === void 0 ? void 0 : mql.addListener) !== 'undefined') {
|
||||
mql.addListener(handler);
|
||||
}
|
||||
};
|
||||
export const removeMediaQueryListener = (mql, handler) => {
|
||||
// Don't delete here, please keep the code compatible
|
||||
if (typeof (mql === null || mql === void 0 ? void 0 : mql.removeEventListener) !== 'undefined') {
|
||||
mql.removeEventListener('change', handler);
|
||||
} else if (typeof (mql === null || mql === void 0 ? void 0 : mql.removeListener) !== 'undefined') {
|
||||
mql.removeListener(handler);
|
||||
}
|
||||
};
|
||||
7
frontend/node_modules/antd/es/_util/motion.d.ts
generated
vendored
Normal file
7
frontend/node_modules/antd/es/_util/motion.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { CSSMotionProps } from 'rc-motion';
|
||||
declare const initCollapseMotion: (rootCls?: string) => CSSMotionProps;
|
||||
declare const _SelectPlacements: readonly ["bottomLeft", "bottomRight", "topLeft", "topRight"];
|
||||
export type SelectCommonPlacement = (typeof _SelectPlacements)[number];
|
||||
declare const getTransitionName: (rootPrefixCls: string, motion: string, transitionName?: string) => string;
|
||||
export { getTransitionName };
|
||||
export default initCollapseMotion;
|
||||
41
frontend/node_modules/antd/es/_util/motion.js
generated
vendored
Normal file
41
frontend/node_modules/antd/es/_util/motion.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
import { defaultPrefixCls } from '../config-provider';
|
||||
// ================== Collapse Motion ==================
|
||||
const getCollapsedHeight = () => ({
|
||||
height: 0,
|
||||
opacity: 0
|
||||
});
|
||||
const getRealHeight = node => {
|
||||
const {
|
||||
scrollHeight
|
||||
} = node;
|
||||
return {
|
||||
height: scrollHeight,
|
||||
opacity: 1
|
||||
};
|
||||
};
|
||||
const getCurrentHeight = node => ({
|
||||
height: node ? node.offsetHeight : 0
|
||||
});
|
||||
const skipOpacityTransition = (_, event) => (event === null || event === void 0 ? void 0 : event.deadline) === true || event.propertyName === 'height';
|
||||
const initCollapseMotion = (rootCls = defaultPrefixCls) => ({
|
||||
motionName: `${rootCls}-motion-collapse`,
|
||||
onAppearStart: getCollapsedHeight,
|
||||
onEnterStart: getCollapsedHeight,
|
||||
onAppearActive: getRealHeight,
|
||||
onEnterActive: getRealHeight,
|
||||
onLeaveStart: getCurrentHeight,
|
||||
onLeaveActive: getCollapsedHeight,
|
||||
onAppearEnd: skipOpacityTransition,
|
||||
onEnterEnd: skipOpacityTransition,
|
||||
onLeaveEnd: skipOpacityTransition,
|
||||
motionDeadline: 500
|
||||
});
|
||||
const _SelectPlacements = ['bottomLeft', 'bottomRight', 'topLeft', 'topRight'];
|
||||
const getTransitionName = (rootPrefixCls, motion, transitionName) => {
|
||||
if (transitionName !== undefined) {
|
||||
return transitionName;
|
||||
}
|
||||
return `${rootPrefixCls}-${motion}`;
|
||||
};
|
||||
export { getTransitionName };
|
||||
export default initCollapseMotion;
|
||||
21
frontend/node_modules/antd/es/_util/placements.d.ts
generated
vendored
Normal file
21
frontend/node_modules/antd/es/_util/placements.d.ts
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import type { BuildInPlacements } from '@rc-component/trigger';
|
||||
import { getArrowOffsetToken } from '../style/placementArrow';
|
||||
export interface AdjustOverflow {
|
||||
adjustX?: 0 | 1;
|
||||
adjustY?: 0 | 1;
|
||||
}
|
||||
export interface PlacementsConfig {
|
||||
arrowWidth: number;
|
||||
arrowPointAtCenter?: boolean;
|
||||
autoAdjustOverflow?: boolean | AdjustOverflow;
|
||||
offset: number;
|
||||
borderRadius: number;
|
||||
visibleFirst?: boolean;
|
||||
}
|
||||
export declare function getOverflowOptions(placement: string, arrowOffset: ReturnType<typeof getArrowOffsetToken>, arrowWidth: number, autoAdjustOverflow?: boolean | AdjustOverflow): {
|
||||
adjustX?: boolean | number;
|
||||
adjustY?: boolean | number;
|
||||
shiftX?: boolean | number;
|
||||
shiftY?: boolean | number;
|
||||
};
|
||||
export default function getPlacements(config: PlacementsConfig): BuildInPlacements;
|
||||
178
frontend/node_modules/antd/es/_util/placements.js
generated
vendored
Normal file
178
frontend/node_modules/antd/es/_util/placements.js
generated
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
import { getArrowOffsetToken } from '../style/placementArrow';
|
||||
export function getOverflowOptions(placement, arrowOffset, arrowWidth, autoAdjustOverflow) {
|
||||
if (autoAdjustOverflow === false) {
|
||||
return {
|
||||
adjustX: false,
|
||||
adjustY: false
|
||||
};
|
||||
}
|
||||
const overflow = autoAdjustOverflow && typeof autoAdjustOverflow === 'object' ? autoAdjustOverflow : {};
|
||||
const baseOverflow = {};
|
||||
switch (placement) {
|
||||
case 'top':
|
||||
case 'bottom':
|
||||
baseOverflow.shiftX = arrowOffset.arrowOffsetHorizontal * 2 + arrowWidth;
|
||||
baseOverflow.shiftY = true;
|
||||
baseOverflow.adjustY = true;
|
||||
break;
|
||||
case 'left':
|
||||
case 'right':
|
||||
baseOverflow.shiftY = arrowOffset.arrowOffsetVertical * 2 + arrowWidth;
|
||||
baseOverflow.shiftX = true;
|
||||
baseOverflow.adjustX = true;
|
||||
break;
|
||||
}
|
||||
const mergedOverflow = Object.assign(Object.assign({}, baseOverflow), overflow);
|
||||
// Support auto shift
|
||||
if (!mergedOverflow.shiftX) {
|
||||
mergedOverflow.adjustX = true;
|
||||
}
|
||||
if (!mergedOverflow.shiftY) {
|
||||
mergedOverflow.adjustY = true;
|
||||
}
|
||||
return mergedOverflow;
|
||||
}
|
||||
const PlacementAlignMap = {
|
||||
left: {
|
||||
points: ['cr', 'cl']
|
||||
},
|
||||
right: {
|
||||
points: ['cl', 'cr']
|
||||
},
|
||||
top: {
|
||||
points: ['bc', 'tc']
|
||||
},
|
||||
bottom: {
|
||||
points: ['tc', 'bc']
|
||||
},
|
||||
topLeft: {
|
||||
points: ['bl', 'tl']
|
||||
},
|
||||
leftTop: {
|
||||
points: ['tr', 'tl']
|
||||
},
|
||||
topRight: {
|
||||
points: ['br', 'tr']
|
||||
},
|
||||
rightTop: {
|
||||
points: ['tl', 'tr']
|
||||
},
|
||||
bottomRight: {
|
||||
points: ['tr', 'br']
|
||||
},
|
||||
rightBottom: {
|
||||
points: ['bl', 'br']
|
||||
},
|
||||
bottomLeft: {
|
||||
points: ['tl', 'bl']
|
||||
},
|
||||
leftBottom: {
|
||||
points: ['br', 'bl']
|
||||
}
|
||||
};
|
||||
const ArrowCenterPlacementAlignMap = {
|
||||
topLeft: {
|
||||
points: ['bl', 'tc']
|
||||
},
|
||||
leftTop: {
|
||||
points: ['tr', 'cl']
|
||||
},
|
||||
topRight: {
|
||||
points: ['br', 'tc']
|
||||
},
|
||||
rightTop: {
|
||||
points: ['tl', 'cr']
|
||||
},
|
||||
bottomRight: {
|
||||
points: ['tr', 'bc']
|
||||
},
|
||||
rightBottom: {
|
||||
points: ['bl', 'cr']
|
||||
},
|
||||
bottomLeft: {
|
||||
points: ['tl', 'bc']
|
||||
},
|
||||
leftBottom: {
|
||||
points: ['br', 'cl']
|
||||
}
|
||||
};
|
||||
const DisableAutoArrowList = new Set(['topLeft', 'topRight', 'bottomLeft', 'bottomRight', 'leftTop', 'leftBottom', 'rightTop', 'rightBottom']);
|
||||
export default function getPlacements(config) {
|
||||
const {
|
||||
arrowWidth,
|
||||
autoAdjustOverflow,
|
||||
arrowPointAtCenter,
|
||||
offset,
|
||||
borderRadius,
|
||||
visibleFirst
|
||||
} = config;
|
||||
const halfArrowWidth = arrowWidth / 2;
|
||||
const placementMap = {};
|
||||
// Dynamic offset
|
||||
const arrowOffset = getArrowOffsetToken({
|
||||
contentRadius: borderRadius,
|
||||
limitVerticalRadius: true
|
||||
});
|
||||
Object.keys(PlacementAlignMap).forEach(key => {
|
||||
const template = arrowPointAtCenter && ArrowCenterPlacementAlignMap[key] || PlacementAlignMap[key];
|
||||
const placementInfo = Object.assign(Object.assign({}, template), {
|
||||
offset: [0, 0],
|
||||
dynamicInset: true
|
||||
});
|
||||
placementMap[key] = placementInfo;
|
||||
// Disable autoArrow since design is fixed position
|
||||
if (DisableAutoArrowList.has(key)) {
|
||||
placementInfo.autoArrow = false;
|
||||
}
|
||||
// Static offset
|
||||
switch (key) {
|
||||
case 'top':
|
||||
case 'topLeft':
|
||||
case 'topRight':
|
||||
placementInfo.offset[1] = -halfArrowWidth - offset;
|
||||
break;
|
||||
case 'bottom':
|
||||
case 'bottomLeft':
|
||||
case 'bottomRight':
|
||||
placementInfo.offset[1] = halfArrowWidth + offset;
|
||||
break;
|
||||
case 'left':
|
||||
case 'leftTop':
|
||||
case 'leftBottom':
|
||||
placementInfo.offset[0] = -halfArrowWidth - offset;
|
||||
break;
|
||||
case 'right':
|
||||
case 'rightTop':
|
||||
case 'rightBottom':
|
||||
placementInfo.offset[0] = halfArrowWidth + offset;
|
||||
break;
|
||||
}
|
||||
if (arrowPointAtCenter) {
|
||||
switch (key) {
|
||||
case 'topLeft':
|
||||
case 'bottomLeft':
|
||||
placementInfo.offset[0] = -arrowOffset.arrowOffsetHorizontal - halfArrowWidth;
|
||||
break;
|
||||
case 'topRight':
|
||||
case 'bottomRight':
|
||||
placementInfo.offset[0] = arrowOffset.arrowOffsetHorizontal + halfArrowWidth;
|
||||
break;
|
||||
case 'leftTop':
|
||||
case 'rightTop':
|
||||
placementInfo.offset[1] = -arrowOffset.arrowOffsetHorizontal * 2 + halfArrowWidth;
|
||||
break;
|
||||
case 'leftBottom':
|
||||
case 'rightBottom':
|
||||
placementInfo.offset[1] = arrowOffset.arrowOffsetHorizontal * 2 - halfArrowWidth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Overflow
|
||||
placementInfo.overflow = getOverflowOptions(key, arrowOffset, arrowWidth, autoAdjustOverflow);
|
||||
// VisibleFirst
|
||||
if (visibleFirst) {
|
||||
placementInfo.htmlRegion = 'visibleFirst';
|
||||
}
|
||||
});
|
||||
return placementMap;
|
||||
}
|
||||
7
frontend/node_modules/antd/es/_util/reactNode.d.ts
generated
vendored
Normal file
7
frontend/node_modules/antd/es/_util/reactNode.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import React from 'react';
|
||||
import type { AnyObject } from './type';
|
||||
export declare function isFragment(child: any): boolean;
|
||||
type RenderProps = AnyObject | ((originProps: AnyObject) => AnyObject | undefined);
|
||||
export declare const replaceElement: <P>(element: React.ReactNode, replacement: React.ReactNode, props?: RenderProps) => React.ReactNode;
|
||||
export declare function cloneElement<P>(element: React.ReactNode, props?: RenderProps): React.ReactElement<P>;
|
||||
export {};
|
||||
13
frontend/node_modules/antd/es/_util/reactNode.js
generated
vendored
Normal file
13
frontend/node_modules/antd/es/_util/reactNode.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import React from 'react';
|
||||
export function isFragment(child) {
|
||||
return child && /*#__PURE__*/React.isValidElement(child) && child.type === React.Fragment;
|
||||
}
|
||||
export const replaceElement = (element, replacement, props) => {
|
||||
if (! /*#__PURE__*/React.isValidElement(element)) {
|
||||
return replacement;
|
||||
}
|
||||
return /*#__PURE__*/React.cloneElement(element, typeof props === 'function' ? props(element.props || {}) : props);
|
||||
};
|
||||
export function cloneElement(element, props) {
|
||||
return replaceElement(element, element, props);
|
||||
}
|
||||
21
frontend/node_modules/antd/es/_util/responsiveObserver.d.ts
generated
vendored
Normal file
21
frontend/node_modules/antd/es/_util/responsiveObserver.d.ts
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
export type Breakpoint = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
|
||||
export type BreakpointMap = Record<Breakpoint, string>;
|
||||
export type ScreenMap = Partial<Record<Breakpoint, boolean>>;
|
||||
export type ScreenSizeMap = Partial<Record<Breakpoint, number>>;
|
||||
export declare const responsiveArray: Breakpoint[];
|
||||
type SubscribeFunc = (screens: ScreenMap) => void;
|
||||
export declare const matchScreen: (screens: ScreenMap, screenSizes?: ScreenSizeMap) => number | undefined;
|
||||
interface ResponsiveObserverType {
|
||||
responsiveMap: BreakpointMap;
|
||||
dispatch: (map: ScreenMap) => boolean;
|
||||
subscribe: (func: SubscribeFunc) => number;
|
||||
unsubscribe: (token: number) => void;
|
||||
register: () => void;
|
||||
unregister: () => void;
|
||||
matchHandlers: Record<PropertyKey, {
|
||||
mql: MediaQueryList;
|
||||
listener: (this: MediaQueryList, ev: MediaQueryListEvent) => void;
|
||||
}>;
|
||||
}
|
||||
declare const useResponsiveObserver: () => ResponsiveObserverType;
|
||||
export default useResponsiveObserver;
|
||||
110
frontend/node_modules/antd/es/_util/responsiveObserver.js
generated
vendored
Normal file
110
frontend/node_modules/antd/es/_util/responsiveObserver.js
generated
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
import React from 'react';
|
||||
import { useToken } from '../theme/internal';
|
||||
import { addMediaQueryListener, removeMediaQueryListener } from './mediaQueryUtil';
|
||||
export const responsiveArray = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
|
||||
const getResponsiveMap = token => ({
|
||||
xs: `(max-width: ${token.screenXSMax}px)`,
|
||||
sm: `(min-width: ${token.screenSM}px)`,
|
||||
md: `(min-width: ${token.screenMD}px)`,
|
||||
lg: `(min-width: ${token.screenLG}px)`,
|
||||
xl: `(min-width: ${token.screenXL}px)`,
|
||||
xxl: `(min-width: ${token.screenXXL}px)`
|
||||
});
|
||||
/**
|
||||
* Ensures that the breakpoints token are valid, in good order
|
||||
* For each breakpoint : screenMin <= screen <= screenMax and screenMax <= nextScreenMin
|
||||
*/
|
||||
const validateBreakpoints = token => {
|
||||
const indexableToken = token;
|
||||
const revBreakpoints = [].concat(responsiveArray).reverse();
|
||||
revBreakpoints.forEach((breakpoint, i) => {
|
||||
const breakpointUpper = breakpoint.toUpperCase();
|
||||
const screenMin = `screen${breakpointUpper}Min`;
|
||||
const screen = `screen${breakpointUpper}`;
|
||||
if (!(indexableToken[screenMin] <= indexableToken[screen])) {
|
||||
throw new Error(`${screenMin}<=${screen} fails : !(${indexableToken[screenMin]}<=${indexableToken[screen]})`);
|
||||
}
|
||||
if (i < revBreakpoints.length - 1) {
|
||||
const screenMax = `screen${breakpointUpper}Max`;
|
||||
if (!(indexableToken[screen] <= indexableToken[screenMax])) {
|
||||
throw new Error(`${screen}<=${screenMax} fails : !(${indexableToken[screen]}<=${indexableToken[screenMax]})`);
|
||||
}
|
||||
const nextBreakpointUpperMin = revBreakpoints[i + 1].toUpperCase();
|
||||
const nextScreenMin = `screen${nextBreakpointUpperMin}Min`;
|
||||
if (!(indexableToken[screenMax] <= indexableToken[nextScreenMin])) {
|
||||
throw new Error(`${screenMax}<=${nextScreenMin} fails : !(${indexableToken[screenMax]}<=${indexableToken[nextScreenMin]})`);
|
||||
}
|
||||
}
|
||||
});
|
||||
return token;
|
||||
};
|
||||
export const matchScreen = (screens, screenSizes) => {
|
||||
if (!screenSizes) {
|
||||
return;
|
||||
}
|
||||
for (const breakpoint of responsiveArray) {
|
||||
if (screens[breakpoint] && (screenSizes === null || screenSizes === void 0 ? void 0 : screenSizes[breakpoint]) !== undefined) {
|
||||
return screenSizes[breakpoint];
|
||||
}
|
||||
}
|
||||
};
|
||||
const useResponsiveObserver = () => {
|
||||
const [, token] = useToken();
|
||||
const responsiveMap = getResponsiveMap(validateBreakpoints(token));
|
||||
// To avoid repeat create instance, we add `useMemo` here.
|
||||
return React.useMemo(() => {
|
||||
const subscribers = new Map();
|
||||
let subUid = -1;
|
||||
let screens = {};
|
||||
return {
|
||||
responsiveMap,
|
||||
matchHandlers: {},
|
||||
dispatch(pointMap) {
|
||||
screens = pointMap;
|
||||
subscribers.forEach(func => func(screens));
|
||||
return subscribers.size >= 1;
|
||||
},
|
||||
subscribe(func) {
|
||||
if (!subscribers.size) {
|
||||
this.register();
|
||||
}
|
||||
subUid += 1;
|
||||
subscribers.set(subUid, func);
|
||||
func(screens);
|
||||
return subUid;
|
||||
},
|
||||
unsubscribe(paramToken) {
|
||||
subscribers.delete(paramToken);
|
||||
if (!subscribers.size) {
|
||||
this.unregister();
|
||||
}
|
||||
},
|
||||
register() {
|
||||
Object.entries(responsiveMap).forEach(([screen, mediaQuery]) => {
|
||||
const listener = ({
|
||||
matches
|
||||
}) => {
|
||||
this.dispatch(Object.assign(Object.assign({}, screens), {
|
||||
[screen]: matches
|
||||
}));
|
||||
};
|
||||
const mql = window.matchMedia(mediaQuery);
|
||||
addMediaQueryListener(mql, listener);
|
||||
this.matchHandlers[mediaQuery] = {
|
||||
mql,
|
||||
listener
|
||||
};
|
||||
listener(mql);
|
||||
});
|
||||
},
|
||||
unregister() {
|
||||
Object.values(responsiveMap).forEach(mediaQuery => {
|
||||
const handler = this.matchHandlers[mediaQuery];
|
||||
removeMediaQueryListener(handler === null || handler === void 0 ? void 0 : handler.mql, handler === null || handler === void 0 ? void 0 : handler.listener);
|
||||
});
|
||||
subscribers.clear();
|
||||
}
|
||||
};
|
||||
}, [responsiveMap]);
|
||||
};
|
||||
export default useResponsiveObserver;
|
||||
10
frontend/node_modules/antd/es/_util/scrollTo.d.ts
generated
vendored
Normal file
10
frontend/node_modules/antd/es/_util/scrollTo.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
interface ScrollToOptions {
|
||||
/** Scroll container, default as window */
|
||||
getContainer?: () => HTMLElement | Window | Document;
|
||||
/** Scroll end callback */
|
||||
callback?: () => void;
|
||||
/** Animation duration, default as 450 */
|
||||
duration?: number;
|
||||
}
|
||||
export default function scrollTo(y: number, options?: ScrollToOptions): void;
|
||||
export {};
|
||||
31
frontend/node_modules/antd/es/_util/scrollTo.js
generated
vendored
Normal file
31
frontend/node_modules/antd/es/_util/scrollTo.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import raf from "rc-util/es/raf";
|
||||
import { easeInOutCubic } from './easings';
|
||||
import getScroll, { isWindow } from './getScroll';
|
||||
export default function scrollTo(y, options = {}) {
|
||||
const {
|
||||
getContainer = () => window,
|
||||
callback,
|
||||
duration = 450
|
||||
} = options;
|
||||
const container = getContainer();
|
||||
const scrollTop = getScroll(container);
|
||||
const startTime = Date.now();
|
||||
const frameFunc = () => {
|
||||
const timestamp = Date.now();
|
||||
const time = timestamp - startTime;
|
||||
const nextScrollTop = easeInOutCubic(time > duration ? duration : time, scrollTop, y, duration);
|
||||
if (isWindow(container)) {
|
||||
container.scrollTo(window.pageXOffset, nextScrollTop);
|
||||
} else if (container instanceof Document || container.constructor.name === 'HTMLDocument') {
|
||||
container.documentElement.scrollTop = nextScrollTop;
|
||||
} else {
|
||||
container.scrollTop = nextScrollTop;
|
||||
}
|
||||
if (time < duration) {
|
||||
raf(frameFunc);
|
||||
} else if (typeof callback === 'function') {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
raf(frameFunc);
|
||||
}
|
||||
6
frontend/node_modules/antd/es/_util/statusUtils.d.ts
generated
vendored
Normal file
6
frontend/node_modules/antd/es/_util/statusUtils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { ValidateStatus } from '../form/FormItem';
|
||||
declare const _InputStatuses: readonly ["warning", "error", ""];
|
||||
export type InputStatus = (typeof _InputStatuses)[number];
|
||||
export declare function getStatusClassNames(prefixCls: string, status?: ValidateStatus, hasFeedback?: boolean): string;
|
||||
export declare const getMergedStatus: (contextStatus?: ValidateStatus, customStatus?: InputStatus) => "" | "success" | "warning" | "error" | "validating" | undefined;
|
||||
export {};
|
||||
12
frontend/node_modules/antd/es/_util/statusUtils.js
generated
vendored
Normal file
12
frontend/node_modules/antd/es/_util/statusUtils.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import classNames from 'classnames';
|
||||
const _InputStatuses = ['warning', 'error', ''];
|
||||
export function getStatusClassNames(prefixCls, status, hasFeedback) {
|
||||
return classNames({
|
||||
[`${prefixCls}-status-success`]: status === 'success',
|
||||
[`${prefixCls}-status-warning`]: status === 'warning',
|
||||
[`${prefixCls}-status-error`]: status === 'error',
|
||||
[`${prefixCls}-status-validating`]: status === 'validating',
|
||||
[`${prefixCls}-has-feedback`]: hasFeedback
|
||||
});
|
||||
}
|
||||
export const getMergedStatus = (contextStatus, customStatus) => customStatus || contextStatus;
|
||||
3
frontend/node_modules/antd/es/_util/styleChecker.d.ts
generated
vendored
Normal file
3
frontend/node_modules/antd/es/_util/styleChecker.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { isStyleSupport } from 'rc-util/lib/Dom/styleChecker';
|
||||
export declare const canUseDocElement: () => false | HTMLElement;
|
||||
export { isStyleSupport };
|
||||
4
frontend/node_modules/antd/es/_util/styleChecker.js
generated
vendored
Normal file
4
frontend/node_modules/antd/es/_util/styleChecker.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import canUseDom from "rc-util/es/Dom/canUseDom";
|
||||
import { isStyleSupport } from "rc-util/es/Dom/styleChecker";
|
||||
export const canUseDocElement = () => canUseDom() && window.document.documentElement;
|
||||
export { isStyleSupport };
|
||||
5
frontend/node_modules/antd/es/_util/throttleByAnimationFrame.d.ts
generated
vendored
Normal file
5
frontend/node_modules/antd/es/_util/throttleByAnimationFrame.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
declare function throttleByAnimationFrame<T extends any[]>(fn: (...args: T) => void): {
|
||||
(...args: T): void;
|
||||
cancel(): void;
|
||||
};
|
||||
export default throttleByAnimationFrame;
|
||||
20
frontend/node_modules/antd/es/_util/throttleByAnimationFrame.js
generated
vendored
Normal file
20
frontend/node_modules/antd/es/_util/throttleByAnimationFrame.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
||||
import raf from "rc-util/es/raf";
|
||||
function throttleByAnimationFrame(fn) {
|
||||
let requestId = null;
|
||||
const later = args => () => {
|
||||
requestId = null;
|
||||
fn.apply(void 0, _toConsumableArray(args));
|
||||
};
|
||||
const throttled = (...args) => {
|
||||
if (requestId === null) {
|
||||
requestId = raf(later(args));
|
||||
}
|
||||
};
|
||||
throttled.cancel = () => {
|
||||
raf.cancel(requestId);
|
||||
requestId = null;
|
||||
};
|
||||
return throttled;
|
||||
}
|
||||
export default throttleByAnimationFrame;
|
||||
2
frontend/node_modules/antd/es/_util/toList.d.ts
generated
vendored
Normal file
2
frontend/node_modules/antd/es/_util/toList.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
declare const toList: <T>(candidate: T | T[], skipEmpty?: boolean) => T[];
|
||||
export default toList;
|
||||
7
frontend/node_modules/antd/es/_util/toList.js
generated
vendored
Normal file
7
frontend/node_modules/antd/es/_util/toList.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
const toList = (candidate, skipEmpty = false) => {
|
||||
if (skipEmpty && (candidate === undefined || candidate === null)) {
|
||||
return [];
|
||||
}
|
||||
return Array.isArray(candidate) ? candidate : [candidate];
|
||||
};
|
||||
export default toList;
|
||||
3
frontend/node_modules/antd/es/_util/transKeys.d.ts
generated
vendored
Normal file
3
frontend/node_modules/antd/es/_util/transKeys.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { TransferKey } from '../transfer/interface';
|
||||
export declare const groupKeysMap: (keys: TransferKey[]) => Map<import("react").Key, number>;
|
||||
export declare const groupDisabledKeysMap: <RecordType extends any[]>(dataSource: RecordType) => Map<import("react").Key, number>;
|
||||
19
frontend/node_modules/antd/es/_util/transKeys.js
generated
vendored
Normal file
19
frontend/node_modules/antd/es/_util/transKeys.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
export const groupKeysMap = keys => {
|
||||
const map = new Map();
|
||||
keys.forEach((key, index) => {
|
||||
map.set(key, index);
|
||||
});
|
||||
return map;
|
||||
};
|
||||
export const groupDisabledKeysMap = dataSource => {
|
||||
const map = new Map();
|
||||
dataSource.forEach(({
|
||||
disabled,
|
||||
key
|
||||
}, index) => {
|
||||
if (disabled) {
|
||||
map.set(key, index);
|
||||
}
|
||||
});
|
||||
return map;
|
||||
};
|
||||
57
frontend/node_modules/antd/es/_util/type.d.ts
generated
vendored
Normal file
57
frontend/node_modules/antd/es/_util/type.d.ts
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
import type React from 'react';
|
||||
export type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
||||
/** https://github.com/Microsoft/TypeScript/issues/29729 */
|
||||
export type LiteralUnion<T, U extends Primitive = string> = T | (U & Record<never, never>);
|
||||
export type AnyObject = Record<PropertyKey, any>;
|
||||
export type EmptyObject = Record<never, never>;
|
||||
export type CustomComponent<P = AnyObject> = React.ComponentType<P> | string;
|
||||
/**
|
||||
* Get component props
|
||||
* @example
|
||||
* ```ts
|
||||
* import { Checkbox } from 'antd'
|
||||
* import type { GetProps } from 'antd';
|
||||
*
|
||||
* type CheckboxGroupProps = GetProps<typeof Checkbox.Group>
|
||||
* ```
|
||||
* @since 5.13.0
|
||||
*/
|
||||
export type GetProps<T extends React.ComponentType<any> | object> = T extends React.ComponentType<infer P> ? P : T extends object ? T : never;
|
||||
/**
|
||||
* Get component props by component name
|
||||
* @example
|
||||
* ```ts
|
||||
* import { Select } from 'antd';
|
||||
* import type { GetProp, SelectProps } from 'antd';
|
||||
*
|
||||
* type SelectOption1 = GetProp<SelectProps, 'options'>[number];
|
||||
* // or
|
||||
* type SelectOption2 = GetProp<typeof Select, 'options'>[number];
|
||||
*
|
||||
* const onChange: GetProp<typeof Select, 'onChange'> = (value, option) => {
|
||||
* // Do something
|
||||
* };
|
||||
* ```
|
||||
* @since 5.13.0
|
||||
*/
|
||||
export type GetProp<T extends React.ComponentType<any> | object, PropName extends keyof GetProps<T>> = NonNullable<GetProps<T>[PropName]>;
|
||||
type ReactRefComponent<Props extends {
|
||||
ref?: React.Ref<any> | string;
|
||||
}> = (props: Props) => React.ReactNode;
|
||||
type ExtractRefAttributesRef<T> = T extends React.RefAttributes<infer P> ? P : never;
|
||||
/**
|
||||
* Get component ref
|
||||
* @example
|
||||
* ```ts
|
||||
* import { Input } from 'antd';
|
||||
* import type { GetRef } from 'antd';
|
||||
*
|
||||
* type InputRef = GetRef<typeof Input>;
|
||||
* ```
|
||||
* @since 5.13.0
|
||||
*/
|
||||
export type GetRef<T extends ReactRefComponent<any> | React.Component<any>> = T extends React.Component<any> ? T : T extends React.ComponentType<infer P> ? ExtractRefAttributesRef<P> : never;
|
||||
export type GetContextProps<T> = T extends React.Context<infer P> ? P : never;
|
||||
export type GetContextProp<T extends React.Context<any>, PropName extends keyof GetContextProps<T>> = NonNullable<GetContextProps<T>[PropName]>;
|
||||
export type ValidChar = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z';
|
||||
export {};
|
||||
1
frontend/node_modules/antd/es/_util/type.js
generated
vendored
Normal file
1
frontend/node_modules/antd/es/_util/type.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
31
frontend/node_modules/antd/es/_util/warning.d.ts
generated
vendored
Normal file
31
frontend/node_modules/antd/es/_util/warning.d.ts
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import * as React from 'react';
|
||||
export declare function noop(): void;
|
||||
export declare function resetWarned(): void;
|
||||
type Warning = (valid: boolean, component: string, message?: string) => void;
|
||||
declare const warning: Warning;
|
||||
type BaseTypeWarning = (valid: boolean,
|
||||
/**
|
||||
* - deprecated: Some API will be removed in future but still support now.
|
||||
* - usage: Some API usage is not correct.
|
||||
* - breaking: Breaking change like API is removed.
|
||||
*/
|
||||
type: 'deprecated' | 'usage' | 'breaking', message?: string) => void;
|
||||
type TypeWarning = BaseTypeWarning & {
|
||||
deprecated: (valid: boolean, oldProp: string, newProp: string, message?: string) => void;
|
||||
};
|
||||
export interface WarningContextProps {
|
||||
/**
|
||||
* @descCN 设置警告等级,设置 `false` 时会将废弃相关信息聚合为单条信息。
|
||||
* @descEN Set the warning level. When set to `false`, discard related information will be aggregated into a single message.
|
||||
* @since 5.10.0
|
||||
*/
|
||||
strict?: boolean;
|
||||
}
|
||||
export declare const WarningContext: React.Context<WarningContextProps>;
|
||||
/**
|
||||
* This is a hook but we not named as `useWarning`
|
||||
* since this is only used in development.
|
||||
* We should always wrap this in `if (process.env.NODE_ENV !== 'production')` condition
|
||||
*/
|
||||
export declare const devUseWarning: (component: string) => TypeWarning;
|
||||
export default warning;
|
||||
59
frontend/node_modules/antd/es/_util/warning.js
generated
vendored
Normal file
59
frontend/node_modules/antd/es/_util/warning.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
import * as React from 'react';
|
||||
import rcWarning, { resetWarned as rcResetWarned } from "rc-util/es/warning";
|
||||
export function noop() {}
|
||||
let deprecatedWarnList = null;
|
||||
export function resetWarned() {
|
||||
deprecatedWarnList = null;
|
||||
rcResetWarned();
|
||||
}
|
||||
let _warning = noop;
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
_warning = (valid, component, message) => {
|
||||
rcWarning(valid, `[antd: ${component}] ${message}`);
|
||||
// StrictMode will inject console which will not throw warning in React 17.
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
resetWarned();
|
||||
}
|
||||
};
|
||||
}
|
||||
const warning = _warning;
|
||||
export const WarningContext = /*#__PURE__*/React.createContext({});
|
||||
/**
|
||||
* This is a hook but we not named as `useWarning`
|
||||
* since this is only used in development.
|
||||
* We should always wrap this in `if (process.env.NODE_ENV !== 'production')` condition
|
||||
*/
|
||||
export const devUseWarning = process.env.NODE_ENV !== 'production' ? component => {
|
||||
const {
|
||||
strict
|
||||
} = React.useContext(WarningContext);
|
||||
const typeWarning = (valid, type, message) => {
|
||||
if (!valid) {
|
||||
if (strict === false && type === 'deprecated') {
|
||||
const existWarning = deprecatedWarnList;
|
||||
if (!deprecatedWarnList) {
|
||||
deprecatedWarnList = {};
|
||||
}
|
||||
deprecatedWarnList[component] = deprecatedWarnList[component] || [];
|
||||
if (!deprecatedWarnList[component].includes(message || '')) {
|
||||
deprecatedWarnList[component].push(message || '');
|
||||
}
|
||||
// Warning for the first time
|
||||
if (!existWarning) {
|
||||
console.warn('[antd] There exists deprecated usage in your code:', deprecatedWarnList);
|
||||
}
|
||||
} else {
|
||||
process.env.NODE_ENV !== "production" ? warning(valid, component, message) : void 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
typeWarning.deprecated = (valid, oldProp, newProp, message) => {
|
||||
typeWarning(valid, 'deprecated', `\`${oldProp}\` is deprecated. Please use \`${newProp}\` instead.${message ? ` ${message}` : ''}`);
|
||||
};
|
||||
return typeWarning;
|
||||
} : () => {
|
||||
const noopWarning = () => {};
|
||||
noopWarning.deprecated = noop;
|
||||
return noopWarning;
|
||||
};
|
||||
export default warning;
|
||||
10
frontend/node_modules/antd/es/_util/wave/WaveEffect.d.ts
generated
vendored
Normal file
10
frontend/node_modules/antd/es/_util/wave/WaveEffect.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import type { UnmountType } from '../../config-provider/UnstableContext';
|
||||
import type { ShowWaveEffect } from './interface';
|
||||
export interface WaveEffectProps {
|
||||
className: string;
|
||||
target: HTMLElement;
|
||||
component?: string;
|
||||
registerUnmount: () => UnmountType | null;
|
||||
}
|
||||
declare const showWaveEffect: ShowWaveEffect;
|
||||
export default showWaveEffect;
|
||||
142
frontend/node_modules/antd/es/_util/wave/WaveEffect.js
generated
vendored
Normal file
142
frontend/node_modules/antd/es/_util/wave/WaveEffect.js
generated
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
"use client";
|
||||
|
||||
import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import CSSMotion from 'rc-motion';
|
||||
import raf from "rc-util/es/raf";
|
||||
import { composeRef } from "rc-util/es/ref";
|
||||
import { unstableSetRender } from '../../config-provider/UnstableContext';
|
||||
import { TARGET_CLS } from './interface';
|
||||
import { getTargetWaveColor } from './util';
|
||||
function validateNum(value) {
|
||||
return Number.isNaN(value) ? 0 : value;
|
||||
}
|
||||
const WaveEffect = props => {
|
||||
const {
|
||||
className,
|
||||
target,
|
||||
component,
|
||||
registerUnmount
|
||||
} = props;
|
||||
const divRef = React.useRef(null);
|
||||
// ====================== Refs ======================
|
||||
const unmountRef = React.useRef(null);
|
||||
React.useEffect(() => {
|
||||
unmountRef.current = registerUnmount();
|
||||
}, []);
|
||||
// ===================== Effect =====================
|
||||
const [color, setWaveColor] = React.useState(null);
|
||||
const [borderRadius, setBorderRadius] = React.useState([]);
|
||||
const [left, setLeft] = React.useState(0);
|
||||
const [top, setTop] = React.useState(0);
|
||||
const [width, setWidth] = React.useState(0);
|
||||
const [height, setHeight] = React.useState(0);
|
||||
const [enabled, setEnabled] = React.useState(false);
|
||||
const waveStyle = {
|
||||
left,
|
||||
top,
|
||||
width,
|
||||
height,
|
||||
borderRadius: borderRadius.map(radius => `${radius}px`).join(' ')
|
||||
};
|
||||
if (color) {
|
||||
waveStyle['--wave-color'] = color;
|
||||
}
|
||||
function syncPos() {
|
||||
const nodeStyle = getComputedStyle(target);
|
||||
// Get wave color from target
|
||||
setWaveColor(getTargetWaveColor(target));
|
||||
const isStatic = nodeStyle.position === 'static';
|
||||
// Rect
|
||||
const {
|
||||
borderLeftWidth,
|
||||
borderTopWidth
|
||||
} = nodeStyle;
|
||||
setLeft(isStatic ? target.offsetLeft : validateNum(-Number.parseFloat(borderLeftWidth)));
|
||||
setTop(isStatic ? target.offsetTop : validateNum(-Number.parseFloat(borderTopWidth)));
|
||||
setWidth(target.offsetWidth);
|
||||
setHeight(target.offsetHeight);
|
||||
// Get border radius
|
||||
const {
|
||||
borderTopLeftRadius,
|
||||
borderTopRightRadius,
|
||||
borderBottomLeftRadius,
|
||||
borderBottomRightRadius
|
||||
} = nodeStyle;
|
||||
setBorderRadius([borderTopLeftRadius, borderTopRightRadius, borderBottomRightRadius, borderBottomLeftRadius].map(radius => validateNum(Number.parseFloat(radius))));
|
||||
}
|
||||
React.useEffect(() => {
|
||||
if (target) {
|
||||
// We need delay to check position here
|
||||
// since UI may change after click
|
||||
const id = raf(() => {
|
||||
syncPos();
|
||||
setEnabled(true);
|
||||
});
|
||||
// Add resize observer to follow size
|
||||
let resizeObserver;
|
||||
if (typeof ResizeObserver !== 'undefined') {
|
||||
resizeObserver = new ResizeObserver(syncPos);
|
||||
resizeObserver.observe(target);
|
||||
}
|
||||
return () => {
|
||||
raf.cancel(id);
|
||||
resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
|
||||
};
|
||||
}
|
||||
}, [target]);
|
||||
if (!enabled) {
|
||||
return null;
|
||||
}
|
||||
const isSmallComponent = (component === 'Checkbox' || component === 'Radio') && (target === null || target === void 0 ? void 0 : target.classList.contains(TARGET_CLS));
|
||||
return /*#__PURE__*/React.createElement(CSSMotion, {
|
||||
visible: true,
|
||||
motionAppear: true,
|
||||
motionName: "wave-motion",
|
||||
motionDeadline: 5000,
|
||||
onAppearEnd: (_, event) => {
|
||||
var _a, _b;
|
||||
if (event.deadline || event.propertyName === 'opacity') {
|
||||
const holder = (_a = divRef.current) === null || _a === void 0 ? void 0 : _a.parentElement;
|
||||
(_b = unmountRef.current) === null || _b === void 0 ? void 0 : _b.call(unmountRef).then(() => {
|
||||
holder === null || holder === void 0 ? void 0 : holder.remove();
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}, ({
|
||||
className: motionClassName
|
||||
}, ref) => (/*#__PURE__*/React.createElement("div", {
|
||||
ref: composeRef(divRef, ref),
|
||||
className: classNames(className, motionClassName, {
|
||||
'wave-quick': isSmallComponent
|
||||
}),
|
||||
style: waveStyle
|
||||
})));
|
||||
};
|
||||
const showWaveEffect = (target, info) => {
|
||||
var _a;
|
||||
const {
|
||||
component
|
||||
} = info;
|
||||
// Skip for unchecked checkbox
|
||||
if (component === 'Checkbox' && !((_a = target.querySelector('input')) === null || _a === void 0 ? void 0 : _a.checked)) {
|
||||
return;
|
||||
}
|
||||
// Create holder
|
||||
const holder = document.createElement('div');
|
||||
holder.style.position = 'absolute';
|
||||
holder.style.left = '0px';
|
||||
holder.style.top = '0px';
|
||||
target === null || target === void 0 ? void 0 : target.insertBefore(holder, target === null || target === void 0 ? void 0 : target.firstChild);
|
||||
const reactRender = unstableSetRender();
|
||||
let unmountCallback = null;
|
||||
function registerUnmount() {
|
||||
return unmountCallback;
|
||||
}
|
||||
unmountCallback = reactRender(/*#__PURE__*/React.createElement(WaveEffect, Object.assign({}, info, {
|
||||
target: target,
|
||||
registerUnmount: registerUnmount
|
||||
})), holder);
|
||||
};
|
||||
export default showWaveEffect;
|
||||
9
frontend/node_modules/antd/es/_util/wave/index.d.ts
generated
vendored
Normal file
9
frontend/node_modules/antd/es/_util/wave/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import React from 'react';
|
||||
import type { WaveComponent } from './interface';
|
||||
export interface WaveProps {
|
||||
disabled?: boolean;
|
||||
children?: React.ReactNode;
|
||||
component?: WaveComponent;
|
||||
}
|
||||
declare const Wave: React.FC<WaveProps>;
|
||||
export default Wave;
|
||||
58
frontend/node_modules/antd/es/_util/wave/index.js
generated
vendored
Normal file
58
frontend/node_modules/antd/es/_util/wave/index.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
import React, { useContext, useRef } from 'react';
|
||||
import classNames from 'classnames';
|
||||
import isVisible from "rc-util/es/Dom/isVisible";
|
||||
import { composeRef, getNodeRef, supportRef } from "rc-util/es/ref";
|
||||
import { ConfigContext } from '../../config-provider';
|
||||
import { cloneElement } from '../reactNode';
|
||||
import useStyle from './style';
|
||||
import useWave from './useWave';
|
||||
const Wave = props => {
|
||||
const {
|
||||
children,
|
||||
disabled,
|
||||
component
|
||||
} = props;
|
||||
const {
|
||||
getPrefixCls
|
||||
} = useContext(ConfigContext);
|
||||
const containerRef = useRef(null);
|
||||
// ============================== Style ===============================
|
||||
const prefixCls = getPrefixCls('wave');
|
||||
const [, hashId] = useStyle(prefixCls);
|
||||
// =============================== Wave ===============================
|
||||
const showWave = useWave(containerRef, classNames(prefixCls, hashId), component);
|
||||
// ============================== Effect ==============================
|
||||
React.useEffect(() => {
|
||||
const node = containerRef.current;
|
||||
if (!node || node.nodeType !== window.Node.ELEMENT_NODE || disabled) {
|
||||
return;
|
||||
}
|
||||
// Click handler
|
||||
const onClick = e => {
|
||||
// Fix radio button click twice
|
||||
if (!isVisible(e.target) ||
|
||||
// No need wave
|
||||
!node.getAttribute || node.getAttribute('disabled') || node.disabled || node.className.includes('disabled') && !node.className.includes('disabled:') || node.getAttribute('aria-disabled') === 'true' || node.className.includes('-leave')) {
|
||||
return;
|
||||
}
|
||||
showWave(e);
|
||||
};
|
||||
// Bind events
|
||||
node.addEventListener('click', onClick, true);
|
||||
return () => {
|
||||
node.removeEventListener('click', onClick, true);
|
||||
};
|
||||
}, [disabled]);
|
||||
// ============================== Render ==============================
|
||||
if (! /*#__PURE__*/React.isValidElement(children)) {
|
||||
return children !== null && children !== void 0 ? children : null;
|
||||
}
|
||||
const ref = supportRef(children) ? composeRef(getNodeRef(children), containerRef) : containerRef;
|
||||
return cloneElement(children, {
|
||||
ref
|
||||
});
|
||||
};
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
Wave.displayName = 'Wave';
|
||||
}
|
||||
export default Wave;
|
||||
11
frontend/node_modules/antd/es/_util/wave/interface.d.ts
generated
vendored
Normal file
11
frontend/node_modules/antd/es/_util/wave/interface.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import type { GlobalToken } from '../../theme/internal';
|
||||
export declare const TARGET_CLS = "ant-wave-target";
|
||||
export type ShowWaveEffect = (element: HTMLElement, info: {
|
||||
className: string;
|
||||
token: GlobalToken;
|
||||
component?: WaveComponent;
|
||||
event: MouseEvent;
|
||||
hashId: string;
|
||||
}) => void;
|
||||
export type ShowWave = (event: MouseEvent) => void;
|
||||
export type WaveComponent = 'Tag' | 'Button' | 'Checkbox' | 'Radio' | 'Switch';
|
||||
2
frontend/node_modules/antd/es/_util/wave/interface.js
generated
vendored
Normal file
2
frontend/node_modules/antd/es/_util/wave/interface.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { defaultPrefixCls } from '../../config-provider';
|
||||
export const TARGET_CLS = `${defaultPrefixCls}-wave-target`;
|
||||
7
frontend/node_modules/antd/es/_util/wave/style.d.ts
generated
vendored
Normal file
7
frontend/node_modules/antd/es/_util/wave/style.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { FullToken } from '../../theme/internal';
|
||||
export interface ComponentToken {
|
||||
}
|
||||
export interface WaveToken extends FullToken<'Wave'> {
|
||||
}
|
||||
declare const _default: (prefixCls: string, rootCls?: string) => import("@ant-design/cssinjs-utils/lib/interface").UseComponentStyleResult;
|
||||
export default _default;
|
||||
30
frontend/node_modules/antd/es/_util/wave/style.js
generated
vendored
Normal file
30
frontend/node_modules/antd/es/_util/wave/style.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import { genComponentStyleHook } from '../../theme/internal';
|
||||
const genWaveStyle = token => {
|
||||
const {
|
||||
componentCls,
|
||||
colorPrimary
|
||||
} = token;
|
||||
return {
|
||||
[componentCls]: {
|
||||
position: 'absolute',
|
||||
background: 'transparent',
|
||||
pointerEvents: 'none',
|
||||
boxSizing: 'border-box',
|
||||
color: `var(--wave-color, ${colorPrimary})`,
|
||||
boxShadow: `0 0 0 0 currentcolor`,
|
||||
opacity: 0.2,
|
||||
// =================== Motion ===================
|
||||
'&.wave-motion-appear': {
|
||||
transition: [`box-shadow 0.4s ${token.motionEaseOutCirc}`, `opacity 2s ${token.motionEaseOutCirc}`].join(','),
|
||||
'&-active': {
|
||||
boxShadow: `0 0 0 6px currentcolor`,
|
||||
opacity: 0
|
||||
},
|
||||
'&.wave-quick': {
|
||||
transition: [`box-shadow ${token.motionDurationSlow} ${token.motionEaseInOut}`, `opacity ${token.motionDurationSlow} ${token.motionEaseInOut}`].join(',')
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
export default genComponentStyleHook('Wave', genWaveStyle);
|
||||
4
frontend/node_modules/antd/es/_util/wave/useWave.d.ts
generated
vendored
Normal file
4
frontend/node_modules/antd/es/_util/wave/useWave.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import * as React from 'react';
|
||||
import type { ShowWave, WaveComponent } from './interface';
|
||||
declare const useWave: (nodeRef: React.RefObject<HTMLElement | null>, className: string, component?: WaveComponent) => ShowWave;
|
||||
export default useWave;
|
||||
41
frontend/node_modules/antd/es/_util/wave/useWave.js
generated
vendored
Normal file
41
frontend/node_modules/antd/es/_util/wave/useWave.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
import * as React from 'react';
|
||||
import useEvent from "rc-util/es/hooks/useEvent";
|
||||
import raf from "rc-util/es/raf";
|
||||
import { ConfigContext } from '../../config-provider';
|
||||
import useToken from '../../theme/useToken';
|
||||
import { TARGET_CLS } from './interface';
|
||||
import showWaveEffect from './WaveEffect';
|
||||
const useWave = (nodeRef, className, component) => {
|
||||
const {
|
||||
wave
|
||||
} = React.useContext(ConfigContext);
|
||||
const [, token, hashId] = useToken();
|
||||
const showWave = useEvent(event => {
|
||||
const node = nodeRef.current;
|
||||
if ((wave === null || wave === void 0 ? void 0 : wave.disabled) || !node) {
|
||||
return;
|
||||
}
|
||||
const targetNode = node.querySelector(`.${TARGET_CLS}`) || node;
|
||||
const {
|
||||
showEffect
|
||||
} = wave || {};
|
||||
// Customize wave effect
|
||||
(showEffect || showWaveEffect)(targetNode, {
|
||||
className,
|
||||
token,
|
||||
component,
|
||||
event,
|
||||
hashId
|
||||
});
|
||||
});
|
||||
const rafId = React.useRef(null);
|
||||
// Merge trigger event into one for each frame
|
||||
const showDebounceWave = event => {
|
||||
raf.cancel(rafId.current);
|
||||
rafId.current = raf(() => {
|
||||
showWave(event);
|
||||
});
|
||||
};
|
||||
return showDebounceWave;
|
||||
};
|
||||
export default useWave;
|
||||
2
frontend/node_modules/antd/es/_util/wave/util.d.ts
generated
vendored
Normal file
2
frontend/node_modules/antd/es/_util/wave/util.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare function isValidWaveColor(color: string): boolean | "";
|
||||
export declare function getTargetWaveColor(node: HTMLElement): string | null;
|
||||
14
frontend/node_modules/antd/es/_util/wave/util.js
generated
vendored
Normal file
14
frontend/node_modules/antd/es/_util/wave/util.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
export function isValidWaveColor(color) {
|
||||
return color && color !== '#fff' && color !== '#ffffff' && color !== 'rgb(255, 255, 255)' && color !== 'rgba(255, 255, 255, 1)' && !/rgba\((?:\d*, ){3}0\)/.test(color) &&
|
||||
// any transparent rgba color
|
||||
color !== 'transparent' && color !== 'canvastext';
|
||||
}
|
||||
export function getTargetWaveColor(node) {
|
||||
var _a;
|
||||
const {
|
||||
borderTopColor,
|
||||
borderColor,
|
||||
backgroundColor
|
||||
} = getComputedStyle(node);
|
||||
return (_a = [borderTopColor, borderColor, backgroundColor].find(isValidWaveColor)) !== null && _a !== void 0 ? _a : null;
|
||||
}
|
||||
3
frontend/node_modules/antd/es/_util/zindexContext.d.ts
generated
vendored
Normal file
3
frontend/node_modules/antd/es/_util/zindexContext.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import React from 'react';
|
||||
declare const zIndexContext: React.Context<number | undefined>;
|
||||
export default zIndexContext;
|
||||
6
frontend/node_modules/antd/es/_util/zindexContext.js
generated
vendored
Normal file
6
frontend/node_modules/antd/es/_util/zindexContext.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import React from 'react';
|
||||
const zIndexContext = /*#__PURE__*/React.createContext(undefined);
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
zIndexContext.displayName = 'zIndexContext';
|
||||
}
|
||||
export default zIndexContext;
|
||||
25
frontend/node_modules/antd/es/affix/index.d.ts
generated
vendored
Normal file
25
frontend/node_modules/antd/es/affix/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
import React from 'react';
|
||||
import throttleByAnimationFrame from '../_util/throttleByAnimationFrame';
|
||||
export interface AffixProps {
|
||||
/** Triggered when the specified offset is reached from the top of the window */
|
||||
offsetTop?: number;
|
||||
/** Triggered when the specified offset is reached from the bottom of the window */
|
||||
offsetBottom?: number;
|
||||
style?: React.CSSProperties;
|
||||
/** Callback function triggered when fixed state changes */
|
||||
onChange?: (affixed?: boolean) => void;
|
||||
/** Set the element that Affix needs to listen to its scroll event, the value is a function that returns the corresponding DOM element */
|
||||
target?: () => Window | HTMLElement | null;
|
||||
prefixCls?: string;
|
||||
className?: string;
|
||||
rootClassName?: string;
|
||||
children: React.ReactNode;
|
||||
}
|
||||
export interface AffixRef {
|
||||
updatePosition: ReturnType<typeof throttleByAnimationFrame>;
|
||||
}
|
||||
interface InternalAffixProps extends AffixProps {
|
||||
onTestUpdatePosition?: () => void;
|
||||
}
|
||||
declare const Affix: React.ForwardRefExoticComponent<InternalAffixProps & React.RefAttributes<AffixRef>>;
|
||||
export default Affix;
|
||||
207
frontend/node_modules/antd/es/affix/index.js
generated
vendored
Normal file
207
frontend/node_modules/antd/es/affix/index.js
generated
vendored
Normal file
@@ -0,0 +1,207 @@
|
||||
"use client";
|
||||
|
||||
var __rest = this && this.__rest || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import ResizeObserver from 'rc-resize-observer';
|
||||
import throttleByAnimationFrame from '../_util/throttleByAnimationFrame';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
import useStyle from './style';
|
||||
import { getFixedBottom, getFixedTop, getTargetRect } from './utils';
|
||||
const TRIGGER_EVENTS = ['resize', 'scroll', 'touchstart', 'touchmove', 'touchend', 'pageshow', 'load'];
|
||||
function getDefaultTarget() {
|
||||
return typeof window !== 'undefined' ? window : null;
|
||||
}
|
||||
const AFFIX_STATUS_NONE = 0;
|
||||
const AFFIX_STATUS_PREPARE = 1;
|
||||
const Affix = /*#__PURE__*/React.forwardRef((props, ref) => {
|
||||
var _a;
|
||||
const {
|
||||
style,
|
||||
offsetTop,
|
||||
offsetBottom,
|
||||
prefixCls,
|
||||
className,
|
||||
rootClassName,
|
||||
children,
|
||||
target,
|
||||
onChange,
|
||||
onTestUpdatePosition
|
||||
} = props,
|
||||
restProps = __rest(props, ["style", "offsetTop", "offsetBottom", "prefixCls", "className", "rootClassName", "children", "target", "onChange", "onTestUpdatePosition"]);
|
||||
const {
|
||||
getPrefixCls,
|
||||
getTargetContainer
|
||||
} = React.useContext(ConfigContext);
|
||||
const affixPrefixCls = getPrefixCls('affix', prefixCls);
|
||||
const [lastAffix, setLastAffix] = React.useState(false);
|
||||
const [affixStyle, setAffixStyle] = React.useState();
|
||||
const [placeholderStyle, setPlaceholderStyle] = React.useState();
|
||||
const status = React.useRef(AFFIX_STATUS_NONE);
|
||||
const prevTarget = React.useRef(null);
|
||||
const prevListener = React.useRef(null);
|
||||
const placeholderNodeRef = React.useRef(null);
|
||||
const fixedNodeRef = React.useRef(null);
|
||||
const timer = React.useRef(null);
|
||||
const targetFunc = (_a = target !== null && target !== void 0 ? target : getTargetContainer) !== null && _a !== void 0 ? _a : getDefaultTarget;
|
||||
const internalOffsetTop = offsetBottom === undefined && offsetTop === undefined ? 0 : offsetTop;
|
||||
// =================== Measure ===================
|
||||
const measure = () => {
|
||||
if (status.current !== AFFIX_STATUS_PREPARE || !fixedNodeRef.current || !placeholderNodeRef.current || !targetFunc) {
|
||||
return;
|
||||
}
|
||||
const targetNode = targetFunc();
|
||||
if (targetNode) {
|
||||
const newState = {
|
||||
status: AFFIX_STATUS_NONE
|
||||
};
|
||||
const placeholderRect = getTargetRect(placeholderNodeRef.current);
|
||||
if (placeholderRect.top === 0 && placeholderRect.left === 0 && placeholderRect.width === 0 && placeholderRect.height === 0) {
|
||||
return;
|
||||
}
|
||||
const targetRect = getTargetRect(targetNode);
|
||||
const fixedTop = getFixedTop(placeholderRect, targetRect, internalOffsetTop);
|
||||
const fixedBottom = getFixedBottom(placeholderRect, targetRect, offsetBottom);
|
||||
if (fixedTop !== undefined) {
|
||||
newState.affixStyle = {
|
||||
position: 'fixed',
|
||||
top: fixedTop,
|
||||
width: placeholderRect.width,
|
||||
height: placeholderRect.height
|
||||
};
|
||||
newState.placeholderStyle = {
|
||||
width: placeholderRect.width,
|
||||
height: placeholderRect.height
|
||||
};
|
||||
} else if (fixedBottom !== undefined) {
|
||||
newState.affixStyle = {
|
||||
position: 'fixed',
|
||||
bottom: fixedBottom,
|
||||
width: placeholderRect.width,
|
||||
height: placeholderRect.height
|
||||
};
|
||||
newState.placeholderStyle = {
|
||||
width: placeholderRect.width,
|
||||
height: placeholderRect.height
|
||||
};
|
||||
}
|
||||
newState.lastAffix = !!newState.affixStyle;
|
||||
if (lastAffix !== newState.lastAffix) {
|
||||
onChange === null || onChange === void 0 ? void 0 : onChange(newState.lastAffix);
|
||||
}
|
||||
status.current = newState.status;
|
||||
setAffixStyle(newState.affixStyle);
|
||||
setPlaceholderStyle(newState.placeholderStyle);
|
||||
setLastAffix(newState.lastAffix);
|
||||
}
|
||||
};
|
||||
const prepareMeasure = () => {
|
||||
status.current = AFFIX_STATUS_PREPARE;
|
||||
measure();
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
onTestUpdatePosition === null || onTestUpdatePosition === void 0 ? void 0 : onTestUpdatePosition();
|
||||
}
|
||||
};
|
||||
const updatePosition = throttleByAnimationFrame(() => {
|
||||
prepareMeasure();
|
||||
});
|
||||
const lazyUpdatePosition = throttleByAnimationFrame(() => {
|
||||
// Check position change before measure to make Safari smooth
|
||||
if (targetFunc && affixStyle) {
|
||||
const targetNode = targetFunc();
|
||||
if (targetNode && placeholderNodeRef.current) {
|
||||
const targetRect = getTargetRect(targetNode);
|
||||
const placeholderRect = getTargetRect(placeholderNodeRef.current);
|
||||
const fixedTop = getFixedTop(placeholderRect, targetRect, internalOffsetTop);
|
||||
const fixedBottom = getFixedBottom(placeholderRect, targetRect, offsetBottom);
|
||||
if (fixedTop !== undefined && affixStyle.top === fixedTop || fixedBottom !== undefined && affixStyle.bottom === fixedBottom) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Directly call prepare measure since it's already throttled.
|
||||
prepareMeasure();
|
||||
});
|
||||
const addListeners = () => {
|
||||
const listenerTarget = targetFunc === null || targetFunc === void 0 ? void 0 : targetFunc();
|
||||
if (!listenerTarget) {
|
||||
return;
|
||||
}
|
||||
TRIGGER_EVENTS.forEach(eventName => {
|
||||
var _a;
|
||||
if (prevListener.current) {
|
||||
(_a = prevTarget.current) === null || _a === void 0 ? void 0 : _a.removeEventListener(eventName, prevListener.current);
|
||||
}
|
||||
listenerTarget === null || listenerTarget === void 0 ? void 0 : listenerTarget.addEventListener(eventName, lazyUpdatePosition);
|
||||
});
|
||||
prevTarget.current = listenerTarget;
|
||||
prevListener.current = lazyUpdatePosition;
|
||||
};
|
||||
const removeListeners = () => {
|
||||
const newTarget = targetFunc === null || targetFunc === void 0 ? void 0 : targetFunc();
|
||||
TRIGGER_EVENTS.forEach(eventName => {
|
||||
var _a;
|
||||
newTarget === null || newTarget === void 0 ? void 0 : newTarget.removeEventListener(eventName, lazyUpdatePosition);
|
||||
if (prevListener.current) {
|
||||
(_a = prevTarget.current) === null || _a === void 0 ? void 0 : _a.removeEventListener(eventName, prevListener.current);
|
||||
}
|
||||
});
|
||||
updatePosition.cancel();
|
||||
lazyUpdatePosition.cancel();
|
||||
};
|
||||
React.useImperativeHandle(ref, () => ({
|
||||
updatePosition
|
||||
}));
|
||||
// mount & unmount
|
||||
React.useEffect(() => {
|
||||
// [Legacy] Wait for parent component ref has its value.
|
||||
// We should use target as directly element instead of function which makes element check hard.
|
||||
timer.current = setTimeout(addListeners);
|
||||
return () => {
|
||||
if (timer.current) {
|
||||
clearTimeout(timer.current);
|
||||
timer.current = null;
|
||||
}
|
||||
removeListeners();
|
||||
};
|
||||
}, []);
|
||||
React.useEffect(() => {
|
||||
addListeners();
|
||||
return () => removeListeners();
|
||||
}, [target, affixStyle, lastAffix, offsetTop, offsetBottom]);
|
||||
React.useEffect(() => {
|
||||
updatePosition();
|
||||
}, [target, offsetTop, offsetBottom]);
|
||||
const [wrapCSSVar, hashId, cssVarCls] = useStyle(affixPrefixCls);
|
||||
const rootCls = classNames(rootClassName, hashId, affixPrefixCls, cssVarCls);
|
||||
const mergedCls = classNames({
|
||||
[rootCls]: affixStyle
|
||||
});
|
||||
return wrapCSSVar(/*#__PURE__*/React.createElement(ResizeObserver, {
|
||||
onResize: updatePosition
|
||||
}, /*#__PURE__*/React.createElement("div", Object.assign({
|
||||
style: style,
|
||||
className: className,
|
||||
ref: placeholderNodeRef
|
||||
}, restProps), affixStyle && /*#__PURE__*/React.createElement("div", {
|
||||
style: placeholderStyle,
|
||||
"aria-hidden": "true"
|
||||
}), /*#__PURE__*/React.createElement("div", {
|
||||
className: mergedCls,
|
||||
ref: fixedNodeRef,
|
||||
style: affixStyle
|
||||
}, /*#__PURE__*/React.createElement(ResizeObserver, {
|
||||
onResize: updatePosition
|
||||
}, children)))));
|
||||
});
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
Affix.displayName = 'Affix';
|
||||
}
|
||||
export default Affix;
|
||||
11
frontend/node_modules/antd/es/affix/style/index.d.ts
generated
vendored
Normal file
11
frontend/node_modules/antd/es/affix/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import type { GetDefaultToken } from '../../theme/internal';
|
||||
export interface ComponentToken {
|
||||
/**
|
||||
* @desc 弹出层的 z-index
|
||||
* @descEN z-index of popup
|
||||
*/
|
||||
zIndexPopup: number;
|
||||
}
|
||||
export declare const prepareComponentToken: GetDefaultToken<'Affix'>;
|
||||
declare const _default: (prefixCls: string, rootCls?: string) => readonly [(node: React.ReactElement) => React.ReactElement, string, string];
|
||||
export default _default;
|
||||
18
frontend/node_modules/antd/es/affix/style/index.js
generated
vendored
Normal file
18
frontend/node_modules/antd/es/affix/style/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { genStyleHooks } from '../../theme/internal';
|
||||
// ============================== Shared ==============================
|
||||
const genSharedAffixStyle = token => {
|
||||
const {
|
||||
componentCls
|
||||
} = token;
|
||||
return {
|
||||
[componentCls]: {
|
||||
position: 'fixed',
|
||||
zIndex: token.zIndexPopup
|
||||
}
|
||||
};
|
||||
};
|
||||
export const prepareComponentToken = token => ({
|
||||
zIndexPopup: token.zIndexBase + 10
|
||||
});
|
||||
// ============================== Export ==============================
|
||||
export default genStyleHooks('Affix', genSharedAffixStyle, prepareComponentToken);
|
||||
4
frontend/node_modules/antd/es/affix/utils.d.ts
generated
vendored
Normal file
4
frontend/node_modules/antd/es/affix/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export type BindElement = HTMLElement | Window | null | undefined;
|
||||
export declare function getTargetRect(target: BindElement): DOMRect;
|
||||
export declare function getFixedTop(placeholderRect: DOMRect, targetRect: DOMRect, offsetTop?: number): number | undefined;
|
||||
export declare function getFixedBottom(placeholderRect: DOMRect, targetRect: DOMRect, offsetBottom?: number): number | undefined;
|
||||
19
frontend/node_modules/antd/es/affix/utils.js
generated
vendored
Normal file
19
frontend/node_modules/antd/es/affix/utils.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
export function getTargetRect(target) {
|
||||
return target !== window ? target.getBoundingClientRect() : {
|
||||
top: 0,
|
||||
bottom: window.innerHeight
|
||||
};
|
||||
}
|
||||
export function getFixedTop(placeholderRect, targetRect, offsetTop) {
|
||||
if (offsetTop !== undefined && Math.round(targetRect.top) > Math.round(placeholderRect.top) - offsetTop) {
|
||||
return offsetTop + targetRect.top;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
export function getFixedBottom(placeholderRect, targetRect, offsetBottom) {
|
||||
if (offsetBottom !== undefined && Math.round(targetRect.bottom) < Math.round(placeholderRect.bottom) + offsetBottom) {
|
||||
const targetBottomOffset = window.innerHeight - targetRect.bottom;
|
||||
return offsetBottom + targetBottomOffset;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
42
frontend/node_modules/antd/es/alert/Alert.d.ts
generated
vendored
Normal file
42
frontend/node_modules/antd/es/alert/Alert.d.ts
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
import * as React from 'react';
|
||||
import type { ClosableType } from '../_util/hooks';
|
||||
export interface AlertRef {
|
||||
nativeElement: HTMLDivElement;
|
||||
}
|
||||
export interface AlertProps {
|
||||
/** Type of Alert styles, options:`success`, `info`, `warning`, `error` */
|
||||
type?: 'success' | 'info' | 'warning' | 'error';
|
||||
/** Whether Alert can be closed */
|
||||
closable?: ClosableType;
|
||||
/**
|
||||
* @deprecated please use `closable.closeIcon` instead.
|
||||
* Close text to show
|
||||
*/
|
||||
closeText?: React.ReactNode;
|
||||
/** Content of Alert */
|
||||
message?: React.ReactNode;
|
||||
/** Additional content of Alert */
|
||||
description?: React.ReactNode;
|
||||
/** Callback when close Alert */
|
||||
onClose?: React.MouseEventHandler<HTMLButtonElement>;
|
||||
/** Trigger when animation ending of Alert */
|
||||
afterClose?: () => void;
|
||||
/** Whether to show icon */
|
||||
showIcon?: boolean;
|
||||
/** https://www.w3.org/TR/2014/REC-html5-20141028/dom.html#aria-role-attribute */
|
||||
role?: string;
|
||||
style?: React.CSSProperties;
|
||||
prefixCls?: string;
|
||||
className?: string;
|
||||
rootClassName?: string;
|
||||
banner?: boolean;
|
||||
icon?: React.ReactNode;
|
||||
closeIcon?: React.ReactNode;
|
||||
action?: React.ReactNode;
|
||||
onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
|
||||
onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
|
||||
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
||||
id?: string;
|
||||
}
|
||||
declare const Alert: React.ForwardRefExoticComponent<AlertProps & React.RefAttributes<AlertRef>>;
|
||||
export default Alert;
|
||||
218
frontend/node_modules/antd/es/alert/Alert.js
generated
vendored
Normal file
218
frontend/node_modules/antd/es/alert/Alert.js
generated
vendored
Normal file
@@ -0,0 +1,218 @@
|
||||
"use client";
|
||||
|
||||
var __rest = this && this.__rest || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
import * as React from 'react';
|
||||
import CheckCircleFilled from "@ant-design/icons/es/icons/CheckCircleFilled";
|
||||
import CloseCircleFilled from "@ant-design/icons/es/icons/CloseCircleFilled";
|
||||
import CloseOutlined from "@ant-design/icons/es/icons/CloseOutlined";
|
||||
import ExclamationCircleFilled from "@ant-design/icons/es/icons/ExclamationCircleFilled";
|
||||
import InfoCircleFilled from "@ant-design/icons/es/icons/InfoCircleFilled";
|
||||
import classNames from 'classnames';
|
||||
import CSSMotion from 'rc-motion';
|
||||
import pickAttrs from "rc-util/es/pickAttrs";
|
||||
import { composeRef } from "rc-util/es/ref";
|
||||
import { replaceElement } from '../_util/reactNode';
|
||||
import { devUseWarning } from '../_util/warning';
|
||||
import { useComponentConfig } from '../config-provider/context';
|
||||
import useStyle from './style';
|
||||
const iconMapFilled = {
|
||||
success: CheckCircleFilled,
|
||||
info: InfoCircleFilled,
|
||||
error: CloseCircleFilled,
|
||||
warning: ExclamationCircleFilled
|
||||
};
|
||||
const IconNode = props => {
|
||||
const {
|
||||
icon,
|
||||
prefixCls,
|
||||
type
|
||||
} = props;
|
||||
const iconType = iconMapFilled[type] || null;
|
||||
if (icon) {
|
||||
return replaceElement(icon, /*#__PURE__*/React.createElement("span", {
|
||||
className: `${prefixCls}-icon`
|
||||
}, icon), () => ({
|
||||
className: classNames(`${prefixCls}-icon`, icon.props.className)
|
||||
}));
|
||||
}
|
||||
return /*#__PURE__*/React.createElement(iconType, {
|
||||
className: `${prefixCls}-icon`
|
||||
});
|
||||
};
|
||||
const CloseIconNode = props => {
|
||||
const {
|
||||
isClosable,
|
||||
prefixCls,
|
||||
closeIcon,
|
||||
handleClose,
|
||||
ariaProps
|
||||
} = props;
|
||||
const mergedCloseIcon = closeIcon === true || closeIcon === undefined ? /*#__PURE__*/React.createElement(CloseOutlined, null) : closeIcon;
|
||||
return isClosable ? (/*#__PURE__*/React.createElement("button", Object.assign({
|
||||
type: "button",
|
||||
onClick: handleClose,
|
||||
className: `${prefixCls}-close-icon`,
|
||||
tabIndex: 0
|
||||
}, ariaProps), mergedCloseIcon)) : null;
|
||||
};
|
||||
const Alert = /*#__PURE__*/React.forwardRef((props, ref) => {
|
||||
const {
|
||||
description,
|
||||
prefixCls: customizePrefixCls,
|
||||
message,
|
||||
banner,
|
||||
className,
|
||||
rootClassName,
|
||||
style,
|
||||
onMouseEnter,
|
||||
onMouseLeave,
|
||||
onClick,
|
||||
afterClose,
|
||||
showIcon,
|
||||
closable,
|
||||
closeText,
|
||||
closeIcon,
|
||||
action,
|
||||
id
|
||||
} = props,
|
||||
otherProps = __rest(props, ["description", "prefixCls", "message", "banner", "className", "rootClassName", "style", "onMouseEnter", "onMouseLeave", "onClick", "afterClose", "showIcon", "closable", "closeText", "closeIcon", "action", "id"]);
|
||||
const [closed, setClosed] = React.useState(false);
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const warning = devUseWarning('Alert');
|
||||
warning.deprecated(!closeText, 'closeText', 'closable.closeIcon');
|
||||
}
|
||||
const internalRef = React.useRef(null);
|
||||
React.useImperativeHandle(ref, () => ({
|
||||
nativeElement: internalRef.current
|
||||
}));
|
||||
const {
|
||||
getPrefixCls,
|
||||
direction,
|
||||
closable: contextClosable,
|
||||
closeIcon: contextCloseIcon,
|
||||
className: contextClassName,
|
||||
style: contextStyle
|
||||
} = useComponentConfig('alert');
|
||||
const prefixCls = getPrefixCls('alert', customizePrefixCls);
|
||||
const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);
|
||||
const handleClose = e => {
|
||||
var _a;
|
||||
setClosed(true);
|
||||
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
||||
};
|
||||
const type = React.useMemo(() => {
|
||||
if (props.type !== undefined) {
|
||||
return props.type;
|
||||
}
|
||||
// banner mode defaults to 'warning'
|
||||
return banner ? 'warning' : 'info';
|
||||
}, [props.type, banner]);
|
||||
// closeable when closeText or closeIcon is assigned
|
||||
const isClosable = React.useMemo(() => {
|
||||
if (typeof closable === 'object' && closable.closeIcon) {
|
||||
return true;
|
||||
}
|
||||
if (closeText) {
|
||||
return true;
|
||||
}
|
||||
if (typeof closable === 'boolean') {
|
||||
return closable;
|
||||
}
|
||||
// should be true when closeIcon is 0 or ''
|
||||
if (closeIcon !== false && closeIcon !== null && closeIcon !== undefined) {
|
||||
return true;
|
||||
}
|
||||
return !!contextClosable;
|
||||
}, [closeText, closeIcon, closable, contextClosable]);
|
||||
// banner mode defaults to Icon
|
||||
const isShowIcon = banner && showIcon === undefined ? true : showIcon;
|
||||
const alertCls = classNames(prefixCls, `${prefixCls}-${type}`, {
|
||||
[`${prefixCls}-with-description`]: !!description,
|
||||
[`${prefixCls}-no-icon`]: !isShowIcon,
|
||||
[`${prefixCls}-banner`]: !!banner,
|
||||
[`${prefixCls}-rtl`]: direction === 'rtl'
|
||||
}, contextClassName, className, rootClassName, cssVarCls, hashId);
|
||||
const restProps = pickAttrs(otherProps, {
|
||||
aria: true,
|
||||
data: true
|
||||
});
|
||||
const mergedCloseIcon = React.useMemo(() => {
|
||||
if (typeof closable === 'object' && closable.closeIcon) {
|
||||
return closable.closeIcon;
|
||||
}
|
||||
if (closeText) {
|
||||
return closeText;
|
||||
}
|
||||
if (closeIcon !== undefined) {
|
||||
return closeIcon;
|
||||
}
|
||||
if (typeof contextClosable === 'object' && contextClosable.closeIcon) {
|
||||
return contextClosable.closeIcon;
|
||||
}
|
||||
return contextCloseIcon;
|
||||
}, [closeIcon, closable, contextClosable, closeText, contextCloseIcon]);
|
||||
const mergedAriaProps = React.useMemo(() => {
|
||||
const merged = closable !== null && closable !== void 0 ? closable : contextClosable;
|
||||
if (typeof merged === 'object') {
|
||||
const {
|
||||
closeIcon: _
|
||||
} = merged,
|
||||
ariaProps = __rest(merged, ["closeIcon"]);
|
||||
return ariaProps;
|
||||
}
|
||||
return {};
|
||||
}, [closable, contextClosable]);
|
||||
return wrapCSSVar(/*#__PURE__*/React.createElement(CSSMotion, {
|
||||
visible: !closed,
|
||||
motionName: `${prefixCls}-motion`,
|
||||
motionAppear: false,
|
||||
motionEnter: false,
|
||||
onLeaveStart: node => ({
|
||||
maxHeight: node.offsetHeight
|
||||
}),
|
||||
onLeaveEnd: afterClose
|
||||
}, ({
|
||||
className: motionClassName,
|
||||
style: motionStyle
|
||||
}, setRef) => (/*#__PURE__*/React.createElement("div", Object.assign({
|
||||
id: id,
|
||||
ref: composeRef(internalRef, setRef),
|
||||
"data-show": !closed,
|
||||
className: classNames(alertCls, motionClassName),
|
||||
style: Object.assign(Object.assign(Object.assign({}, contextStyle), style), motionStyle),
|
||||
onMouseEnter: onMouseEnter,
|
||||
onMouseLeave: onMouseLeave,
|
||||
onClick: onClick,
|
||||
role: "alert"
|
||||
}, restProps), isShowIcon ? (/*#__PURE__*/React.createElement(IconNode, {
|
||||
description: description,
|
||||
icon: props.icon,
|
||||
prefixCls: prefixCls,
|
||||
type: type
|
||||
})) : null, /*#__PURE__*/React.createElement("div", {
|
||||
className: `${prefixCls}-content`
|
||||
}, message ? /*#__PURE__*/React.createElement("div", {
|
||||
className: `${prefixCls}-message`
|
||||
}, message) : null, description ? /*#__PURE__*/React.createElement("div", {
|
||||
className: `${prefixCls}-description`
|
||||
}, description) : null), action ? /*#__PURE__*/React.createElement("div", {
|
||||
className: `${prefixCls}-action`
|
||||
}, action) : null, /*#__PURE__*/React.createElement(CloseIconNode, {
|
||||
isClosable: isClosable,
|
||||
prefixCls: prefixCls,
|
||||
closeIcon: mergedCloseIcon,
|
||||
handleClose: handleClose,
|
||||
ariaProps: mergedAriaProps
|
||||
})))));
|
||||
});
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
Alert.displayName = 'Alert';
|
||||
}
|
||||
export default Alert;
|
||||
24
frontend/node_modules/antd/es/alert/ErrorBoundary.d.ts
generated
vendored
Normal file
24
frontend/node_modules/antd/es/alert/ErrorBoundary.d.ts
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import * as React from 'react';
|
||||
interface ErrorBoundaryProps {
|
||||
message?: React.ReactNode;
|
||||
description?: React.ReactNode;
|
||||
children?: React.ReactNode;
|
||||
id?: string;
|
||||
}
|
||||
interface ErrorBoundaryStates {
|
||||
error?: Error | null;
|
||||
info?: {
|
||||
componentStack?: string;
|
||||
};
|
||||
}
|
||||
declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryStates> {
|
||||
state: {
|
||||
error: undefined;
|
||||
info: {
|
||||
componentStack: string;
|
||||
};
|
||||
};
|
||||
componentDidCatch(error: Error | null, info: object): void;
|
||||
render(): React.ReactNode;
|
||||
}
|
||||
export default ErrorBoundary;
|
||||
64
frontend/node_modules/antd/es/alert/ErrorBoundary.js
generated
vendored
Normal file
64
frontend/node_modules/antd/es/alert/ErrorBoundary.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
"use client";
|
||||
|
||||
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
||||
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
||||
import _callSuper from "@babel/runtime/helpers/esm/callSuper";
|
||||
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
||||
import * as React from 'react';
|
||||
import Alert from './Alert';
|
||||
let ErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
||||
function ErrorBoundary() {
|
||||
var _this;
|
||||
_classCallCheck(this, ErrorBoundary);
|
||||
_this = _callSuper(this, ErrorBoundary, arguments);
|
||||
_this.state = {
|
||||
error: undefined,
|
||||
info: {
|
||||
componentStack: ''
|
||||
}
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
_inherits(ErrorBoundary, _React$Component);
|
||||
return _createClass(ErrorBoundary, [{
|
||||
key: "componentDidCatch",
|
||||
value: function componentDidCatch(error, info) {
|
||||
this.setState({
|
||||
error,
|
||||
info
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
const {
|
||||
message,
|
||||
description,
|
||||
id,
|
||||
children
|
||||
} = this.props;
|
||||
const {
|
||||
error,
|
||||
info
|
||||
} = this.state;
|
||||
const componentStack = (info === null || info === void 0 ? void 0 : info.componentStack) || null;
|
||||
const errorMessage = typeof message === 'undefined' ? (error || '').toString() : message;
|
||||
const errorDescription = typeof description === 'undefined' ? componentStack : description;
|
||||
if (error) {
|
||||
return /*#__PURE__*/React.createElement(Alert, {
|
||||
id: id,
|
||||
type: "error",
|
||||
message: errorMessage,
|
||||
description: /*#__PURE__*/React.createElement("pre", {
|
||||
style: {
|
||||
fontSize: '0.9em',
|
||||
overflowX: 'auto'
|
||||
}
|
||||
}, errorDescription)
|
||||
});
|
||||
}
|
||||
return children;
|
||||
}
|
||||
}]);
|
||||
}(React.Component);
|
||||
export default ErrorBoundary;
|
||||
8
frontend/node_modules/antd/es/alert/index.d.ts
generated
vendored
Normal file
8
frontend/node_modules/antd/es/alert/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import InternalAlert from './Alert';
|
||||
import ErrorBoundary from './ErrorBoundary';
|
||||
export type { AlertProps } from './Alert';
|
||||
type CompoundedComponent = typeof InternalAlert & {
|
||||
ErrorBoundary: typeof ErrorBoundary;
|
||||
};
|
||||
declare const Alert: CompoundedComponent;
|
||||
export default Alert;
|
||||
7
frontend/node_modules/antd/es/alert/index.js
generated
vendored
Normal file
7
frontend/node_modules/antd/es/alert/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import InternalAlert from './Alert';
|
||||
import ErrorBoundary from './ErrorBoundary';
|
||||
const Alert = InternalAlert;
|
||||
Alert.ErrorBoundary = ErrorBoundary;
|
||||
export default Alert;
|
||||
26
frontend/node_modules/antd/es/alert/style/index.d.ts
generated
vendored
Normal file
26
frontend/node_modules/antd/es/alert/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { CSSProperties } from 'react';
|
||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||
export interface ComponentToken {
|
||||
/**
|
||||
* @desc 默认内间距
|
||||
* @descEN Default padding
|
||||
*/
|
||||
defaultPadding: CSSProperties['padding'];
|
||||
/**
|
||||
* @desc 带有描述的内间距
|
||||
* @descEN Padding with description
|
||||
*/
|
||||
withDescriptionPadding: CSSProperties['padding'];
|
||||
/**
|
||||
* @desc 带有描述时的图标尺寸
|
||||
* @descEN Icon size with description
|
||||
*/
|
||||
withDescriptionIconSize: number;
|
||||
}
|
||||
type AlertToken = FullToken<'Alert'> & {};
|
||||
export declare const genBaseStyle: GenerateStyle<AlertToken>;
|
||||
export declare const genTypeStyle: GenerateStyle<AlertToken>;
|
||||
export declare const genActionStyle: GenerateStyle<AlertToken>;
|
||||
export declare const prepareComponentToken: GetDefaultToken<'Alert'>;
|
||||
declare const _default: (prefixCls: string, rootCls?: string) => readonly [(node: React.ReactElement) => React.ReactElement, string, string];
|
||||
export default _default;
|
||||
177
frontend/node_modules/antd/es/alert/style/index.js
generated
vendored
Normal file
177
frontend/node_modules/antd/es/alert/style/index.js
generated
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
import { unit } from '@ant-design/cssinjs';
|
||||
import { resetComponent } from '../../style';
|
||||
import { genStyleHooks } from '../../theme/internal';
|
||||
const genAlertTypeStyle = (bgColor, borderColor, iconColor, token, alertCls) => ({
|
||||
background: bgColor,
|
||||
border: `${unit(token.lineWidth)} ${token.lineType} ${borderColor}`,
|
||||
[`${alertCls}-icon`]: {
|
||||
color: iconColor
|
||||
}
|
||||
});
|
||||
export const genBaseStyle = token => {
|
||||
const {
|
||||
componentCls,
|
||||
motionDurationSlow: duration,
|
||||
marginXS,
|
||||
marginSM,
|
||||
fontSize,
|
||||
fontSizeLG,
|
||||
lineHeight,
|
||||
borderRadiusLG: borderRadius,
|
||||
motionEaseInOutCirc,
|
||||
withDescriptionIconSize,
|
||||
colorText,
|
||||
colorTextHeading,
|
||||
withDescriptionPadding,
|
||||
defaultPadding
|
||||
} = token;
|
||||
return {
|
||||
[componentCls]: Object.assign(Object.assign({}, resetComponent(token)), {
|
||||
position: 'relative',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
padding: defaultPadding,
|
||||
wordWrap: 'break-word',
|
||||
borderRadius,
|
||||
[`&${componentCls}-rtl`]: {
|
||||
direction: 'rtl'
|
||||
},
|
||||
[`${componentCls}-content`]: {
|
||||
flex: 1,
|
||||
minWidth: 0
|
||||
},
|
||||
[`${componentCls}-icon`]: {
|
||||
marginInlineEnd: marginXS,
|
||||
lineHeight: 0
|
||||
},
|
||||
'&-description': {
|
||||
display: 'none',
|
||||
fontSize,
|
||||
lineHeight
|
||||
},
|
||||
'&-message': {
|
||||
color: colorTextHeading
|
||||
},
|
||||
[`&${componentCls}-motion-leave`]: {
|
||||
overflow: 'hidden',
|
||||
opacity: 1,
|
||||
transition: `max-height ${duration} ${motionEaseInOutCirc}, opacity ${duration} ${motionEaseInOutCirc},
|
||||
padding-top ${duration} ${motionEaseInOutCirc}, padding-bottom ${duration} ${motionEaseInOutCirc},
|
||||
margin-bottom ${duration} ${motionEaseInOutCirc}`
|
||||
},
|
||||
[`&${componentCls}-motion-leave-active`]: {
|
||||
maxHeight: 0,
|
||||
marginBottom: '0 !important',
|
||||
paddingTop: 0,
|
||||
paddingBottom: 0,
|
||||
opacity: 0
|
||||
}
|
||||
}),
|
||||
[`${componentCls}-with-description`]: {
|
||||
alignItems: 'flex-start',
|
||||
padding: withDescriptionPadding,
|
||||
[`${componentCls}-icon`]: {
|
||||
marginInlineEnd: marginSM,
|
||||
fontSize: withDescriptionIconSize,
|
||||
lineHeight: 0
|
||||
},
|
||||
[`${componentCls}-message`]: {
|
||||
display: 'block',
|
||||
marginBottom: marginXS,
|
||||
color: colorTextHeading,
|
||||
fontSize: fontSizeLG
|
||||
},
|
||||
[`${componentCls}-description`]: {
|
||||
display: 'block',
|
||||
color: colorText
|
||||
}
|
||||
},
|
||||
[`${componentCls}-banner`]: {
|
||||
marginBottom: 0,
|
||||
border: '0 !important',
|
||||
borderRadius: 0
|
||||
}
|
||||
};
|
||||
};
|
||||
export const genTypeStyle = token => {
|
||||
const {
|
||||
componentCls,
|
||||
colorSuccess,
|
||||
colorSuccessBorder,
|
||||
colorSuccessBg,
|
||||
colorWarning,
|
||||
colorWarningBorder,
|
||||
colorWarningBg,
|
||||
colorError,
|
||||
colorErrorBorder,
|
||||
colorErrorBg,
|
||||
colorInfo,
|
||||
colorInfoBorder,
|
||||
colorInfoBg
|
||||
} = token;
|
||||
return {
|
||||
[componentCls]: {
|
||||
'&-success': genAlertTypeStyle(colorSuccessBg, colorSuccessBorder, colorSuccess, token, componentCls),
|
||||
'&-info': genAlertTypeStyle(colorInfoBg, colorInfoBorder, colorInfo, token, componentCls),
|
||||
'&-warning': genAlertTypeStyle(colorWarningBg, colorWarningBorder, colorWarning, token, componentCls),
|
||||
'&-error': Object.assign(Object.assign({}, genAlertTypeStyle(colorErrorBg, colorErrorBorder, colorError, token, componentCls)), {
|
||||
[`${componentCls}-description > pre`]: {
|
||||
margin: 0,
|
||||
padding: 0
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
};
|
||||
export const genActionStyle = token => {
|
||||
const {
|
||||
componentCls,
|
||||
iconCls,
|
||||
motionDurationMid,
|
||||
marginXS,
|
||||
fontSizeIcon,
|
||||
colorIcon,
|
||||
colorIconHover
|
||||
} = token;
|
||||
return {
|
||||
[componentCls]: {
|
||||
'&-action': {
|
||||
marginInlineStart: marginXS
|
||||
},
|
||||
[`${componentCls}-close-icon`]: {
|
||||
marginInlineStart: marginXS,
|
||||
padding: 0,
|
||||
overflow: 'hidden',
|
||||
fontSize: fontSizeIcon,
|
||||
lineHeight: unit(fontSizeIcon),
|
||||
backgroundColor: 'transparent',
|
||||
border: 'none',
|
||||
outline: 'none',
|
||||
cursor: 'pointer',
|
||||
[`${iconCls}-close`]: {
|
||||
color: colorIcon,
|
||||
transition: `color ${motionDurationMid}`,
|
||||
'&:hover': {
|
||||
color: colorIconHover
|
||||
}
|
||||
}
|
||||
},
|
||||
'&-close-text': {
|
||||
color: colorIcon,
|
||||
transition: `color ${motionDurationMid}`,
|
||||
'&:hover': {
|
||||
color: colorIconHover
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
export const prepareComponentToken = token => {
|
||||
const paddingHorizontal = 12; // Fixed value here.
|
||||
return {
|
||||
withDescriptionIconSize: token.fontSizeHeading3,
|
||||
defaultPadding: `${token.paddingContentVerticalSM}px ${paddingHorizontal}px`,
|
||||
withDescriptionPadding: `${token.paddingMD}px ${token.paddingContentHorizontalLG}px`
|
||||
};
|
||||
};
|
||||
export default genStyleHooks('Alert', token => [genBaseStyle(token), genTypeStyle(token), genActionStyle(token)], prepareComponentToken);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user