first commit
This commit is contained in:
6
frontend/node_modules/antd/es/flex/index.d.ts
generated
vendored
Normal file
6
frontend/node_modules/antd/es/flex/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import React from 'react';
|
||||
import type { FlexProps } from './interface';
|
||||
declare const Flex: React.ForwardRefExoticComponent<FlexProps<import("../_util/type").AnyObject> & {
|
||||
children?: React.ReactNode | undefined;
|
||||
} & React.RefAttributes<HTMLElement>>;
|
||||
export default Flex;
|
||||
60
frontend/node_modules/antd/es/flex/index.js
generated
vendored
Normal file
60
frontend/node_modules/antd/es/flex/index.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
"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 omit from "rc-util/es/omit";
|
||||
import { isPresetSize } from '../_util/gapSize';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
import useStyle from './style';
|
||||
import createFlexClassNames from './utils';
|
||||
const Flex = /*#__PURE__*/React.forwardRef((props, ref) => {
|
||||
const {
|
||||
prefixCls: customizePrefixCls,
|
||||
rootClassName,
|
||||
className,
|
||||
style,
|
||||
flex,
|
||||
gap,
|
||||
vertical = false,
|
||||
component: Component = 'div',
|
||||
children
|
||||
} = props,
|
||||
othersProps = __rest(props, ["prefixCls", "rootClassName", "className", "style", "flex", "gap", "vertical", "component", "children"]);
|
||||
const {
|
||||
flex: ctxFlex,
|
||||
direction: ctxDirection,
|
||||
getPrefixCls
|
||||
} = React.useContext(ConfigContext);
|
||||
const prefixCls = getPrefixCls('flex', customizePrefixCls);
|
||||
const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);
|
||||
const mergedVertical = vertical !== null && vertical !== void 0 ? vertical : ctxFlex === null || ctxFlex === void 0 ? void 0 : ctxFlex.vertical;
|
||||
const mergedCls = classNames(className, rootClassName, ctxFlex === null || ctxFlex === void 0 ? void 0 : ctxFlex.className, prefixCls, hashId, cssVarCls, createFlexClassNames(prefixCls, props), {
|
||||
[`${prefixCls}-rtl`]: ctxDirection === 'rtl',
|
||||
[`${prefixCls}-gap-${gap}`]: isPresetSize(gap),
|
||||
[`${prefixCls}-vertical`]: mergedVertical
|
||||
});
|
||||
const mergedStyle = Object.assign(Object.assign({}, ctxFlex === null || ctxFlex === void 0 ? void 0 : ctxFlex.style), style);
|
||||
if (flex) {
|
||||
mergedStyle.flex = flex;
|
||||
}
|
||||
if (gap && !isPresetSize(gap)) {
|
||||
mergedStyle.gap = gap;
|
||||
}
|
||||
return wrapCSSVar(/*#__PURE__*/React.createElement(Component, Object.assign({
|
||||
ref: ref,
|
||||
className: mergedCls,
|
||||
style: mergedStyle
|
||||
}, omit(othersProps, ['justify', 'wrap', 'align'])), children));
|
||||
});
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
Flex.displayName = 'Flex';
|
||||
}
|
||||
export default Flex;
|
||||
14
frontend/node_modules/antd/es/flex/interface.d.ts
generated
vendored
Normal file
14
frontend/node_modules/antd/es/flex/interface.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import type React from 'react';
|
||||
import type { AnyObject, CustomComponent, LiteralUnion } from '../_util/type';
|
||||
import type { SizeType } from '../config-provider/SizeContext';
|
||||
export interface FlexProps<P = AnyObject> extends React.HTMLAttributes<HTMLElement> {
|
||||
prefixCls?: string;
|
||||
rootClassName?: string;
|
||||
vertical?: boolean;
|
||||
wrap?: boolean | React.CSSProperties['flexWrap'];
|
||||
justify?: React.CSSProperties['justifyContent'];
|
||||
align?: React.CSSProperties['alignItems'];
|
||||
flex?: React.CSSProperties['flex'];
|
||||
gap?: LiteralUnion<SizeType, React.CSSProperties['gap']>;
|
||||
component?: CustomComponent<P>;
|
||||
}
|
||||
1
frontend/node_modules/antd/es/flex/interface.js
generated
vendored
Normal file
1
frontend/node_modules/antd/es/flex/interface.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
30
frontend/node_modules/antd/es/flex/style/index.d.ts
generated
vendored
Normal file
30
frontend/node_modules/antd/es/flex/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import type { FullToken, GetDefaultToken } from '../../theme/internal';
|
||||
/** Component only token. Which will handle additional calculation of alias token */
|
||||
export interface ComponentToken {
|
||||
}
|
||||
export interface FlexToken extends FullToken<'Flex'> {
|
||||
/**
|
||||
* @nameZH 小间隙
|
||||
* @nameEN Small Gap
|
||||
* @desc 控制元素的小间隙。
|
||||
* @descEN Control the small gap of the element.
|
||||
*/
|
||||
flexGapSM: number;
|
||||
/**
|
||||
* @nameZH 间隙
|
||||
* @nameEN Gap
|
||||
* @desc 控制元素的间隙。
|
||||
* @descEN Control the gap of the element.
|
||||
*/
|
||||
flexGap: number;
|
||||
/**
|
||||
* @nameZH 大间隙
|
||||
* @nameEN Large Gap
|
||||
* @desc 控制元素的大间隙。
|
||||
* @descEN Control the large gap of the element.
|
||||
*/
|
||||
flexGapLG: number;
|
||||
}
|
||||
export declare const prepareComponentToken: GetDefaultToken<'Flex'>;
|
||||
declare const _default: (prefixCls: string, rootCls?: string) => readonly [(node: React.ReactElement) => React.ReactElement, string, string];
|
||||
export default _default;
|
||||
95
frontend/node_modules/antd/es/flex/style/index.js
generated
vendored
Normal file
95
frontend/node_modules/antd/es/flex/style/index.js
generated
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||
import { alignItemsValues, flexWrapValues, justifyContentValues } from '../utils';
|
||||
const genFlexStyle = token => {
|
||||
const {
|
||||
componentCls
|
||||
} = token;
|
||||
return {
|
||||
[componentCls]: {
|
||||
display: 'flex',
|
||||
margin: 0,
|
||||
padding: 0,
|
||||
'&-vertical': {
|
||||
flexDirection: 'column'
|
||||
},
|
||||
'&-rtl': {
|
||||
direction: 'rtl'
|
||||
},
|
||||
'&:empty': {
|
||||
display: 'none'
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
const genFlexGapStyle = token => {
|
||||
const {
|
||||
componentCls
|
||||
} = token;
|
||||
return {
|
||||
[componentCls]: {
|
||||
'&-gap-small': {
|
||||
gap: token.flexGapSM
|
||||
},
|
||||
'&-gap-middle': {
|
||||
gap: token.flexGap
|
||||
},
|
||||
'&-gap-large': {
|
||||
gap: token.flexGapLG
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
const genFlexWrapStyle = token => {
|
||||
const {
|
||||
componentCls
|
||||
} = token;
|
||||
const wrapStyle = {};
|
||||
flexWrapValues.forEach(value => {
|
||||
wrapStyle[`${componentCls}-wrap-${value}`] = {
|
||||
flexWrap: value
|
||||
};
|
||||
});
|
||||
return wrapStyle;
|
||||
};
|
||||
const genAlignItemsStyle = token => {
|
||||
const {
|
||||
componentCls
|
||||
} = token;
|
||||
const alignStyle = {};
|
||||
alignItemsValues.forEach(value => {
|
||||
alignStyle[`${componentCls}-align-${value}`] = {
|
||||
alignItems: value
|
||||
};
|
||||
});
|
||||
return alignStyle;
|
||||
};
|
||||
const genJustifyContentStyle = token => {
|
||||
const {
|
||||
componentCls
|
||||
} = token;
|
||||
const justifyStyle = {};
|
||||
justifyContentValues.forEach(value => {
|
||||
justifyStyle[`${componentCls}-justify-${value}`] = {
|
||||
justifyContent: value
|
||||
};
|
||||
});
|
||||
return justifyStyle;
|
||||
};
|
||||
export const prepareComponentToken = () => ({});
|
||||
export default genStyleHooks('Flex', token => {
|
||||
const {
|
||||
paddingXS,
|
||||
padding,
|
||||
paddingLG
|
||||
} = token;
|
||||
const flexToken = mergeToken(token, {
|
||||
flexGapSM: paddingXS,
|
||||
flexGap: padding,
|
||||
flexGapLG: paddingLG
|
||||
});
|
||||
return [genFlexStyle(flexToken), genFlexGapStyle(flexToken), genFlexWrapStyle(flexToken), genAlignItemsStyle(flexToken), genJustifyContentStyle(flexToken)];
|
||||
}, prepareComponentToken, {
|
||||
// Flex component don't apply extra font style
|
||||
// https://github.com/ant-design/ant-design/issues/46403
|
||||
resetStyle: false
|
||||
});
|
||||
6
frontend/node_modules/antd/es/flex/utils.d.ts
generated
vendored
Normal file
6
frontend/node_modules/antd/es/flex/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { FlexProps } from './interface';
|
||||
export declare const flexWrapValues: React.CSSProperties['flexWrap'][];
|
||||
export declare const justifyContentValues: React.CSSProperties['justifyContent'][];
|
||||
export declare const alignItemsValues: React.CSSProperties['alignItems'][];
|
||||
declare function createFlexClassNames(prefixCls: string, props: FlexProps): string;
|
||||
export default createFlexClassNames;
|
||||
29
frontend/node_modules/antd/es/flex/utils.js
generated
vendored
Normal file
29
frontend/node_modules/antd/es/flex/utils.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
import classNames from 'classnames';
|
||||
export const flexWrapValues = ['wrap', 'nowrap', 'wrap-reverse'];
|
||||
export const justifyContentValues = ['flex-start', 'flex-end', 'start', 'end', 'center', 'space-between', 'space-around', 'space-evenly', 'stretch', 'normal', 'left', 'right'];
|
||||
export const alignItemsValues = ['center', 'start', 'end', 'flex-start', 'flex-end', 'self-start', 'self-end', 'baseline', 'normal', 'stretch'];
|
||||
const genClsWrap = (prefixCls, props) => {
|
||||
const wrap = props.wrap === true ? 'wrap' : props.wrap;
|
||||
return {
|
||||
[`${prefixCls}-wrap-${wrap}`]: wrap && flexWrapValues.includes(wrap)
|
||||
};
|
||||
};
|
||||
const genClsAlign = (prefixCls, props) => {
|
||||
const alignCls = {};
|
||||
alignItemsValues.forEach(cssKey => {
|
||||
alignCls[`${prefixCls}-align-${cssKey}`] = props.align === cssKey;
|
||||
});
|
||||
alignCls[`${prefixCls}-align-stretch`] = !props.align && !!props.vertical;
|
||||
return alignCls;
|
||||
};
|
||||
const genClsJustify = (prefixCls, props) => {
|
||||
const justifyCls = {};
|
||||
justifyContentValues.forEach(cssKey => {
|
||||
justifyCls[`${prefixCls}-justify-${cssKey}`] = props.justify === cssKey;
|
||||
});
|
||||
return justifyCls;
|
||||
};
|
||||
function createFlexClassNames(prefixCls, props) {
|
||||
return classNames(Object.assign(Object.assign(Object.assign({}, genClsWrap(prefixCls, props)), genClsAlign(prefixCls, props)), genClsJustify(prefixCls, props)));
|
||||
}
|
||||
export default createFlexClassNames;
|
||||
Reference in New Issue
Block a user