first commit
This commit is contained in:
11
frontend/node_modules/antd/es/qr-code/QrcodeStatus.d.ts
generated
vendored
Normal file
11
frontend/node_modules/antd/es/qr-code/QrcodeStatus.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import React from 'react';
|
||||
import type { Locale } from '../locale';
|
||||
import type { QRCodeProps, StatusRenderInfo } from './interface';
|
||||
export type QRcodeStatusProps = {
|
||||
prefixCls: string;
|
||||
locale?: Locale['QRCode'];
|
||||
onRefresh?: QRCodeProps['onRefresh'];
|
||||
statusRender?: QRCodeProps['statusRender'];
|
||||
status: StatusRenderInfo['status'];
|
||||
};
|
||||
export default function QRcodeStatus({ prefixCls, locale, onRefresh, statusRender, status, }: QRcodeStatusProps): React.ReactNode;
|
||||
37
frontend/node_modules/antd/es/qr-code/QrcodeStatus.js
generated
vendored
Normal file
37
frontend/node_modules/antd/es/qr-code/QrcodeStatus.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
"use client";
|
||||
|
||||
import React from 'react';
|
||||
import ReloadOutlined from "@ant-design/icons/es/icons/ReloadOutlined";
|
||||
import Button from '../button';
|
||||
import Spin from '../spin';
|
||||
const defaultSpin = /*#__PURE__*/React.createElement(Spin, null);
|
||||
export default function QRcodeStatus({
|
||||
prefixCls,
|
||||
locale,
|
||||
onRefresh,
|
||||
statusRender,
|
||||
status
|
||||
}) {
|
||||
const defaultExpiredNode = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("p", {
|
||||
className: `${prefixCls}-expired`
|
||||
}, locale === null || locale === void 0 ? void 0 : locale.expired), onRefresh && (/*#__PURE__*/React.createElement(Button, {
|
||||
type: "link",
|
||||
icon: /*#__PURE__*/React.createElement(ReloadOutlined, null),
|
||||
onClick: onRefresh
|
||||
}, locale === null || locale === void 0 ? void 0 : locale.refresh)));
|
||||
const defaultScannedNode = /*#__PURE__*/React.createElement("p", {
|
||||
className: `${prefixCls}-scanned`
|
||||
}, locale === null || locale === void 0 ? void 0 : locale.scanned);
|
||||
const defaultNodes = {
|
||||
expired: defaultExpiredNode,
|
||||
loading: defaultSpin,
|
||||
scanned: defaultScannedNode
|
||||
};
|
||||
const defaultStatusRender = info => defaultNodes[info.status];
|
||||
const mergedStatusRender = statusRender !== null && statusRender !== void 0 ? statusRender : defaultStatusRender;
|
||||
return mergedStatusRender({
|
||||
status,
|
||||
locale,
|
||||
onRefresh
|
||||
});
|
||||
}
|
||||
4
frontend/node_modules/antd/es/qr-code/index.d.ts
generated
vendored
Normal file
4
frontend/node_modules/antd/es/qr-code/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import React from 'react';
|
||||
import type { QRCodeProps } from './interface';
|
||||
declare const QRCode: React.FC<QRCodeProps>;
|
||||
export default QRCode;
|
||||
108
frontend/node_modules/antd/es/qr-code/index.js
generated
vendored
Normal file
108
frontend/node_modules/antd/es/qr-code/index.js
generated
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
"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, { useContext } from 'react';
|
||||
import { QRCodeCanvas, QRCodeSVG } from '@rc-component/qrcode';
|
||||
import classNames from 'classnames';
|
||||
import omit from "rc-util/es/omit";
|
||||
import pickAttrs from "rc-util/es/pickAttrs";
|
||||
import { devUseWarning } from '../_util/warning';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
import { useLocale } from '../locale';
|
||||
import { useToken } from '../theme/internal';
|
||||
import QRcodeStatus from './QrcodeStatus';
|
||||
import useStyle from './style/index';
|
||||
const QRCode = props => {
|
||||
var _a, _b, _c, _d;
|
||||
const [, token] = useToken();
|
||||
const {
|
||||
value,
|
||||
type = 'canvas',
|
||||
icon = '',
|
||||
size = 160,
|
||||
iconSize,
|
||||
color = token.colorText,
|
||||
errorLevel = 'M',
|
||||
status = 'active',
|
||||
bordered = true,
|
||||
onRefresh,
|
||||
style,
|
||||
className,
|
||||
rootClassName,
|
||||
prefixCls: customizePrefixCls,
|
||||
bgColor = 'transparent',
|
||||
statusRender,
|
||||
boostLevel /* 👈 5.28.0+ */
|
||||
} = props,
|
||||
rest = __rest(props, ["value", "type", "icon", "size", "iconSize", "color", "errorLevel", "status", "bordered", "onRefresh", "style", "className", "rootClassName", "prefixCls", "bgColor", "statusRender", "boostLevel"]);
|
||||
const {
|
||||
getPrefixCls
|
||||
} = useContext(ConfigContext);
|
||||
const prefixCls = getPrefixCls('qrcode', customizePrefixCls);
|
||||
const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);
|
||||
const imageSettings = {
|
||||
src: icon,
|
||||
x: undefined,
|
||||
y: undefined,
|
||||
height: typeof iconSize === 'number' ? iconSize : (_a = iconSize === null || iconSize === void 0 ? void 0 : iconSize.height) !== null && _a !== void 0 ? _a : 40,
|
||||
width: typeof iconSize === 'number' ? iconSize : (_b = iconSize === null || iconSize === void 0 ? void 0 : iconSize.width) !== null && _b !== void 0 ? _b : 40,
|
||||
excavate: true,
|
||||
crossOrigin: 'anonymous'
|
||||
};
|
||||
const a11yProps = pickAttrs(rest, true);
|
||||
const restProps = omit(rest, Object.keys(a11yProps));
|
||||
const qrCodeProps = Object.assign({
|
||||
value,
|
||||
size,
|
||||
level: errorLevel,
|
||||
bgColor,
|
||||
fgColor: color,
|
||||
style: {
|
||||
width: style === null || style === void 0 ? void 0 : style.width,
|
||||
height: style === null || style === void 0 ? void 0 : style.height
|
||||
},
|
||||
imageSettings: icon ? imageSettings : undefined,
|
||||
boostLevel
|
||||
}, a11yProps);
|
||||
const [locale] = useLocale('QRCode');
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const warning = devUseWarning('QRCode');
|
||||
process.env.NODE_ENV !== "production" ? warning(!!value, 'usage', 'need to receive `value` props') : void 0;
|
||||
process.env.NODE_ENV !== "production" ? warning(!(icon && errorLevel === 'L'), 'usage', 'ErrorLevel `L` is not recommended to be used with `icon`, for scanning result would be affected by low level.') : void 0;
|
||||
}
|
||||
if (!value) {
|
||||
return null;
|
||||
}
|
||||
const mergedCls = classNames(prefixCls, className, rootClassName, hashId, cssVarCls, {
|
||||
[`${prefixCls}-borderless`]: !bordered
|
||||
});
|
||||
const mergedStyle = Object.assign(Object.assign({
|
||||
backgroundColor: bgColor
|
||||
}, style), {
|
||||
width: (_c = style === null || style === void 0 ? void 0 : style.width) !== null && _c !== void 0 ? _c : size,
|
||||
height: (_d = style === null || style === void 0 ? void 0 : style.height) !== null && _d !== void 0 ? _d : size
|
||||
});
|
||||
return wrapCSSVar(/*#__PURE__*/React.createElement("div", Object.assign({}, restProps, {
|
||||
className: mergedCls,
|
||||
style: mergedStyle
|
||||
}), status !== 'active' && (/*#__PURE__*/React.createElement("div", {
|
||||
className: `${prefixCls}-mask`
|
||||
}, /*#__PURE__*/React.createElement(QRcodeStatus, {
|
||||
prefixCls: prefixCls,
|
||||
locale: locale,
|
||||
status: status,
|
||||
onRefresh: onRefresh,
|
||||
statusRender: statusRender
|
||||
}))), type === 'canvas' ? /*#__PURE__*/React.createElement(QRCodeCanvas, Object.assign({}, qrCodeProps)) : /*#__PURE__*/React.createElement(QRCodeSVG, Object.assign({}, qrCodeProps))));
|
||||
};
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
QRCode.displayName = 'QRCode';
|
||||
}
|
||||
export default QRCode;
|
||||
29
frontend/node_modules/antd/es/qr-code/interface.d.ts
generated
vendored
Normal file
29
frontend/node_modules/antd/es/qr-code/interface.d.ts
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import type { QRProps } from '@rc-component/qrcode';
|
||||
import type { Locale } from '../locale';
|
||||
type ImageSettings = QRProps['imageSettings'];
|
||||
export type { QRProps, ImageSettings };
|
||||
export type QRPropsCanvas = QRProps & React.CanvasHTMLAttributes<HTMLCanvasElement>;
|
||||
export type QRPropsSvg = QRProps & React.SVGAttributes<SVGSVGElement>;
|
||||
export type QRStatus = 'active' | 'expired' | 'loading' | 'scanned';
|
||||
export type StatusRenderInfo = {
|
||||
status: Exclude<QRStatus, 'active'>;
|
||||
locale: Locale['QRCode'];
|
||||
onRefresh?: () => void;
|
||||
};
|
||||
export interface QRCodeProps extends QRProps, React.HTMLAttributes<HTMLDivElement> {
|
||||
type?: 'canvas' | 'svg';
|
||||
className?: string;
|
||||
rootClassName?: string;
|
||||
prefixCls?: string;
|
||||
icon?: string;
|
||||
iconSize?: number | {
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
bordered?: boolean;
|
||||
errorLevel?: 'L' | 'M' | 'Q' | 'H';
|
||||
status?: QRStatus;
|
||||
onRefresh?: () => void;
|
||||
statusRender?: (info: StatusRenderInfo) => ReactNode;
|
||||
}
|
||||
1
frontend/node_modules/antd/es/qr-code/interface.js
generated
vendored
Normal file
1
frontend/node_modules/antd/es/qr-code/interface.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
6
frontend/node_modules/antd/es/qr-code/style/index.d.ts
generated
vendored
Normal file
6
frontend/node_modules/antd/es/qr-code/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { GetDefaultToken } from '../../theme/internal';
|
||||
export interface ComponentToken {
|
||||
}
|
||||
export declare const prepareComponentToken: GetDefaultToken<'QRCode'>;
|
||||
declare const _default: (prefixCls: string, rootCls?: string) => readonly [(node: React.ReactElement) => React.ReactElement, string, string];
|
||||
export default _default;
|
||||
67
frontend/node_modules/antd/es/qr-code/style/index.js
generated
vendored
Normal file
67
frontend/node_modules/antd/es/qr-code/style/index.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
import { unit } from '@ant-design/cssinjs';
|
||||
import { FastColor } from '@ant-design/fast-color';
|
||||
import { resetComponent } from '../../style';
|
||||
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||
const genQRCodeStyle = token => {
|
||||
const {
|
||||
componentCls,
|
||||
lineWidth,
|
||||
lineType,
|
||||
colorSplit
|
||||
} = token;
|
||||
return {
|
||||
[componentCls]: Object.assign(Object.assign({}, resetComponent(token)), {
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
padding: token.paddingSM,
|
||||
backgroundColor: token.colorWhite,
|
||||
borderRadius: token.borderRadiusLG,
|
||||
border: `${unit(lineWidth)} ${lineType} ${colorSplit}`,
|
||||
position: 'relative',
|
||||
overflow: 'hidden',
|
||||
[`& > ${componentCls}-mask`]: {
|
||||
position: 'absolute',
|
||||
insetBlockStart: 0,
|
||||
insetInlineStart: 0,
|
||||
zIndex: 10,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
color: token.colorText,
|
||||
lineHeight: token.lineHeight,
|
||||
background: token.QRCodeMaskBackgroundColor,
|
||||
textAlign: 'center',
|
||||
[`& > ${componentCls}-expired, & > ${componentCls}-scanned`]: {
|
||||
color: token.QRCodeTextColor
|
||||
}
|
||||
},
|
||||
'> canvas': {
|
||||
alignSelf: 'stretch',
|
||||
flex: 'auto',
|
||||
minWidth: 0
|
||||
},
|
||||
'&-icon': {
|
||||
marginBlockEnd: token.marginXS,
|
||||
fontSize: token.controlHeight
|
||||
}
|
||||
}),
|
||||
[`${componentCls}-borderless`]: {
|
||||
borderColor: 'transparent',
|
||||
padding: 0,
|
||||
borderRadius: 0
|
||||
}
|
||||
};
|
||||
};
|
||||
export const prepareComponentToken = token => ({
|
||||
QRCodeMaskBackgroundColor: new FastColor(token.colorBgContainer).setA(0.96).toRgbString()
|
||||
});
|
||||
export default genStyleHooks('QRCode', token => {
|
||||
const mergedToken = mergeToken(token, {
|
||||
QRCodeTextColor: token.colorText
|
||||
});
|
||||
return genQRCodeStyle(mergedToken);
|
||||
}, prepareComponentToken);
|
||||
Reference in New Issue
Block a user