3fafa3656d86b5e0987d2be9b706977c6dd13599b5c5a2207d1ae0b4fa025930.json 15 KB

1
  1. {"ast":null,"code":"\"use client\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport React, { useContext } from 'react';\nimport { QRCodeCanvas, QRCodeSVG } from '@rc-component/qrcode';\nimport classNames from 'classnames';\nimport omit from \"rc-util/es/omit\";\nimport pickAttrs from \"rc-util/es/pickAttrs\";\nimport { devUseWarning } from '../_util/warning';\nimport { ConfigContext } from '../config-provider';\nimport { useLocale } from '../locale';\nimport { useToken } from '../theme/internal';\nimport QRcodeStatus from './QrcodeStatus';\nimport useStyle from './style/index';\nconst QRCode = props => {\n var _a, _b, _c, _d;\n const [, token] = useToken();\n const {\n value,\n type = 'canvas',\n icon = '',\n size = 160,\n iconSize,\n color = token.colorText,\n errorLevel = 'M',\n status = 'active',\n bordered = true,\n onRefresh,\n style,\n className,\n rootClassName,\n prefixCls: customizePrefixCls,\n bgColor = 'transparent',\n statusRender\n } = props,\n rest = __rest(props, [\"value\", \"type\", \"icon\", \"size\", \"iconSize\", \"color\", \"errorLevel\", \"status\", \"bordered\", \"onRefresh\", \"style\", \"className\", \"rootClassName\", \"prefixCls\", \"bgColor\", \"statusRender\"]);\n const {\n getPrefixCls\n } = useContext(ConfigContext);\n const prefixCls = getPrefixCls('qrcode', customizePrefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n const imageSettings = {\n src: icon,\n x: undefined,\n y: undefined,\n height: typeof iconSize === 'number' ? iconSize : (_a = iconSize === null || iconSize === void 0 ? void 0 : iconSize.height) !== null && _a !== void 0 ? _a : 40,\n width: typeof iconSize === 'number' ? iconSize : (_b = iconSize === null || iconSize === void 0 ? void 0 : iconSize.width) !== null && _b !== void 0 ? _b : 40,\n excavate: true,\n crossOrigin: 'anonymous'\n };\n const a11yProps = pickAttrs(rest, true);\n const restProps = omit(rest, Object.keys(a11yProps));\n const qrCodeProps = Object.assign({\n value,\n size,\n level: errorLevel,\n bgColor,\n fgColor: color,\n style: {\n width: style === null || style === void 0 ? void 0 : style.width,\n height: style === null || style === void 0 ? void 0 : style.height\n },\n imageSettings: icon ? imageSettings : undefined\n }, a11yProps);\n const [locale] = useLocale('QRCode');\n if (process.env.NODE_ENV !== 'production') {\n const warning = devUseWarning('QRCode');\n process.env.NODE_ENV !== \"production\" ? warning(!!value, 'usage', 'need to receive `value` props') : void 0;\n 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;\n }\n if (!value) {\n return null;\n }\n const mergedCls = classNames(prefixCls, className, rootClassName, hashId, cssVarCls, {\n [`${prefixCls}-borderless`]: !bordered\n });\n const mergedStyle = Object.assign(Object.assign({\n backgroundColor: bgColor\n }, style), {\n width: (_c = style === null || style === void 0 ? void 0 : style.width) !== null && _c !== void 0 ? _c : size,\n height: (_d = style === null || style === void 0 ? void 0 : style.height) !== null && _d !== void 0 ? _d : size\n });\n return wrapCSSVar(/*#__PURE__*/React.createElement(\"div\", Object.assign({}, restProps, {\n className: mergedCls,\n style: mergedStyle\n }), status !== 'active' && (/*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-mask`\n }, /*#__PURE__*/React.createElement(QRcodeStatus, {\n prefixCls: prefixCls,\n locale: locale,\n status: status,\n onRefresh: onRefresh,\n statusRender: statusRender\n }))), type === 'canvas' ? /*#__PURE__*/React.createElement(QRCodeCanvas, Object.assign({}, qrCodeProps)) : /*#__PURE__*/React.createElement(QRCodeSVG, Object.assign({}, qrCodeProps))));\n};\nif (process.env.NODE_ENV !== 'production') {\n QRCode.displayName = 'QRCode';\n}\nexport default QRCode;","map":{"version":3,"names":["__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","React","useContext","QRCodeCanvas","QRCodeSVG","classNames","omit","pickAttrs","devUseWarning","ConfigContext","useLocale","useToken","QRcodeStatus","useStyle","QRCode","props","_a","_b","_c","_d","token","value","type","icon","size","iconSize","color","colorText","errorLevel","status","bordered","onRefresh","style","className","rootClassName","prefixCls","customizePrefixCls","bgColor","statusRender","rest","getPrefixCls","wrapCSSVar","hashId","cssVarCls","imageSettings","src","x","undefined","y","height","width","excavate","crossOrigin","a11yProps","restProps","keys","qrCodeProps","assign","level","fgColor","locale","process","env","NODE_ENV","warning","mergedCls","mergedStyle","backgroundColor","createElement","displayName"],"sources":["/Users/max_liu/max_liu/company/tools_auto_pt/node_modules/antd/es/qr-code/index.js"],"sourcesContent":["\"use client\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport React, { useContext } from 'react';\nimport { QRCodeCanvas, QRCodeSVG } from '@rc-component/qrcode';\nimport classNames from 'classnames';\nimport omit from \"rc-util/es/omit\";\nimport pickAttrs from \"rc-util/es/pickAttrs\";\nimport { devUseWarning } from '../_util/warning';\nimport { ConfigContext } from '../config-provider';\nimport { useLocale } from '../locale';\nimport { useToken } from '../theme/internal';\nimport QRcodeStatus from './QrcodeStatus';\nimport useStyle from './style/index';\nconst QRCode = props => {\n var _a, _b, _c, _d;\n const [, token] = useToken();\n const {\n value,\n type = 'canvas',\n icon = '',\n size = 160,\n iconSize,\n color = token.colorText,\n errorLevel = 'M',\n status = 'active',\n bordered = true,\n onRefresh,\n style,\n className,\n rootClassName,\n prefixCls: customizePrefixCls,\n bgColor = 'transparent',\n statusRender\n } = props,\n rest = __rest(props, [\"value\", \"type\", \"icon\", \"size\", \"iconSize\", \"color\", \"errorLevel\", \"status\", \"bordered\", \"onRefresh\", \"style\", \"className\", \"rootClassName\", \"prefixCls\", \"bgColor\", \"statusRender\"]);\n const {\n getPrefixCls\n } = useContext(ConfigContext);\n const prefixCls = getPrefixCls('qrcode', customizePrefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n const imageSettings = {\n src: icon,\n x: undefined,\n y: undefined,\n height: typeof iconSize === 'number' ? iconSize : (_a = iconSize === null || iconSize === void 0 ? void 0 : iconSize.height) !== null && _a !== void 0 ? _a : 40,\n width: typeof iconSize === 'number' ? iconSize : (_b = iconSize === null || iconSize === void 0 ? void 0 : iconSize.width) !== null && _b !== void 0 ? _b : 40,\n excavate: true,\n crossOrigin: 'anonymous'\n };\n const a11yProps = pickAttrs(rest, true);\n const restProps = omit(rest, Object.keys(a11yProps));\n const qrCodeProps = Object.assign({\n value,\n size,\n level: errorLevel,\n bgColor,\n fgColor: color,\n style: {\n width: style === null || style === void 0 ? void 0 : style.width,\n height: style === null || style === void 0 ? void 0 : style.height\n },\n imageSettings: icon ? imageSettings : undefined\n }, a11yProps);\n const [locale] = useLocale('QRCode');\n if (process.env.NODE_ENV !== 'production') {\n const warning = devUseWarning('QRCode');\n process.env.NODE_ENV !== \"production\" ? warning(!!value, 'usage', 'need to receive `value` props') : void 0;\n 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;\n }\n if (!value) {\n return null;\n }\n const mergedCls = classNames(prefixCls, className, rootClassName, hashId, cssVarCls, {\n [`${prefixCls}-borderless`]: !bordered\n });\n const mergedStyle = Object.assign(Object.assign({\n backgroundColor: bgColor\n }, style), {\n width: (_c = style === null || style === void 0 ? void 0 : style.width) !== null && _c !== void 0 ? _c : size,\n height: (_d = style === null || style === void 0 ? void 0 : style.height) !== null && _d !== void 0 ? _d : size\n });\n return wrapCSSVar(/*#__PURE__*/React.createElement(\"div\", Object.assign({}, restProps, {\n className: mergedCls,\n style: mergedStyle\n }), status !== 'active' && (/*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-mask`\n }, /*#__PURE__*/React.createElement(QRcodeStatus, {\n prefixCls: prefixCls,\n locale: locale,\n status: status,\n onRefresh: onRefresh,\n statusRender: statusRender\n }))), type === 'canvas' ? /*#__PURE__*/React.createElement(QRCodeCanvas, Object.assign({}, qrCodeProps)) : /*#__PURE__*/React.createElement(QRCodeSVG, Object.assign({}, qrCodeProps))));\n};\nif (process.env.NODE_ENV !== 'production') {\n QRCode.displayName = 'QRCode';\n}\nexport default QRCode;"],"mappings":"AAAA,YAAY;;AAEZ,IAAIA,MAAM,GAAG,IAAI,IAAI,IAAI,CAACA,MAAM,IAAI,UAAUC,CAAC,EAAEC,CAAC,EAAE;EAClD,IAAIC,CAAC,GAAG,CAAC,CAAC;EACV,KAAK,IAAIC,CAAC,IAAIH,CAAC,EAAE,IAAII,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACP,CAAC,EAAEG,CAAC,CAAC,IAAIF,CAAC,CAACO,OAAO,CAACL,CAAC,CAAC,GAAG,CAAC,EAAED,CAAC,CAACC,CAAC,CAAC,GAAGH,CAAC,CAACG,CAAC,CAAC;EAChG,IAAIH,CAAC,IAAI,IAAI,IAAI,OAAOI,MAAM,CAACK,qBAAqB,KAAK,UAAU,EAAE,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEP,CAAC,GAAGC,MAAM,CAACK,qBAAqB,CAACT,CAAC,CAAC,EAAEU,CAAC,GAAGP,CAAC,CAACQ,MAAM,EAAED,CAAC,EAAE,EAAE;IAC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