first commit
This commit is contained in:
20
frontend/node_modules/@rc-component/qrcode/LICENSE
generated
vendored
Normal file
20
frontend/node_modules/@rc-component/qrcode/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2015-present Alipay.com, https://www.alipay.com/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
79
frontend/node_modules/@rc-component/qrcode/README.md
generated
vendored
Normal file
79
frontend/node_modules/@rc-component/qrcode/README.md
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
# @rc-component/qrcode
|
||||
|
||||
React QRCode Component
|
||||
|
||||
[![NPM version][npm-image]][npm-url]
|
||||
[![npm download][download-image]][download-url]
|
||||
[![build status][github-actions-image]][github-actions-url]
|
||||
[![Test coverage][codecov-image]][codecov-url]
|
||||
[![bundle size][bundlephobia-image]][bundlephobia-url]
|
||||
[![dumi][dumi-image]][dumi-url]
|
||||
|
||||
[npm-image]: http://img.shields.io/npm/v/@rc-component/qrcode.svg?style=flat-square
|
||||
[npm-url]: http://npmjs.org/package/@rc-component/qrcode
|
||||
[travis-image]: https://img.shields.io/travis/react-component/qrcode/master?style=flat-square
|
||||
[travis-url]: https://travis-ci.com/react-component/qrcode
|
||||
[github-actions-image]: https://github.com/react-component/qrcode/workflows/CI/badge.svg
|
||||
[github-actions-url]: https://github.com/react-component/qrcode/actions
|
||||
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/qrcode/master.svg?style=flat-square
|
||||
[codecov-url]: https://app.codecov.io/gh/react-component/qrcode
|
||||
[david-url]: https://david-dm.org/react-component/qrcode
|
||||
[david-image]: https://david-dm.org/react-component/qrcode/status.svg?style=flat-square
|
||||
[david-dev-url]: https://david-dm.org/react-component/qrcode?type=dev
|
||||
[david-dev-image]: https://david-dm.org/react-component/qrcode/dev-status.svg?style=flat-square
|
||||
[download-image]: https://img.shields.io/npm/dm/@rc-component/qrcode.svg?style=flat-square
|
||||
[download-url]: https://npmjs.org/package/@rc-component/qrcode
|
||||
[bundlephobia-url]: https://bundlephobia.com/package/@rc-component/qrcode
|
||||
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@rc-component/qrcode
|
||||
[dumi-url]: https://github.com/umijs/dumi
|
||||
[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square
|
||||
|
||||
## Install
|
||||
|
||||
[](https://npmjs.org/package/@rc-component/qrcode)
|
||||
|
||||
## Usage
|
||||
|
||||
## Example
|
||||
|
||||
http://localhost:8001
|
||||
|
||||
## Development
|
||||
|
||||
```
|
||||
npm install
|
||||
npm start
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### props
|
||||
|
||||
## API
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| ---- | ---- | ------- | ----------- |
|
||||
|
||||
## Test Case
|
||||
|
||||
```
|
||||
npm test
|
||||
npm run coverage
|
||||
```
|
||||
|
||||
open coverage/ dir
|
||||
|
||||
## License
|
||||
|
||||
rc-qrcode is released under the MIT license.
|
||||
|
||||
### Refs
|
||||
|
||||
- Util part is from [qrcode.react](https://github.com/zpao/qrcode.react) under ISC license.
|
||||
- QR Code generation part is from [qrcode-generator](https://www.nayuki.io/page/qr-code-generator-library) under MIT license.
|
||||
|
||||
## 🤝 Contributing
|
||||
|
||||
<a href="https://openomy.app/github/react-component/qrcode" target="_blank" style="display: block; width: 100%;" align="center">
|
||||
<img src="https://www.openomy.app/svg?repo=react-component/qrcode&chart=bubble&latestMonth=24" target="_blank" alt="Contribution Leaderboard" style="display: block; width: 100%;" />
|
||||
</a>
|
||||
133
frontend/node_modules/@rc-component/qrcode/assets/index.css
generated
vendored
Normal file
133
frontend/node_modules/@rc-component/qrcode/assets/index.css
generated
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
.rc-trigger-popup {
|
||||
position: absolute;
|
||||
top: -9999px;
|
||||
left: -9999px;
|
||||
z-index: 1050;
|
||||
}
|
||||
.rc-trigger-popup-hidden {
|
||||
display: none;
|
||||
}
|
||||
.rc-trigger-popup-zoom-enter,
|
||||
.rc-trigger-popup-zoom-appear {
|
||||
opacity: 0;
|
||||
animation-play-state: paused;
|
||||
animation-timing-function: cubic-bezier(0.18, 0.89, 0.32, 1.28);
|
||||
animation-duration: 0.3s;
|
||||
animation-fill-mode: both;
|
||||
}
|
||||
.rc-trigger-popup-zoom-leave {
|
||||
animation-duration: 0.3s;
|
||||
animation-fill-mode: both;
|
||||
animation-play-state: paused;
|
||||
animation-timing-function: cubic-bezier(0.6, -0.3, 0.74, 0.05);
|
||||
}
|
||||
.rc-trigger-popup-zoom-enter.rc-trigger-popup-zoom-enter-active,
|
||||
.rc-trigger-popup-zoom-appear.rc-trigger-popup-zoom-appear-active {
|
||||
animation-name: rcTriggerZoomIn;
|
||||
animation-play-state: running;
|
||||
}
|
||||
.rc-trigger-popup-zoom-leave.rc-trigger-popup-zoom-leave-active {
|
||||
animation-name: rcTriggerZoomOut;
|
||||
animation-play-state: running;
|
||||
}
|
||||
.rc-trigger-popup-arrow {
|
||||
z-index: 1;
|
||||
width: 0px;
|
||||
height: 0px;
|
||||
background: #000;
|
||||
border-radius: 100vw;
|
||||
box-shadow: 0 0 0 3px black;
|
||||
}
|
||||
@keyframes rcTriggerZoomIn {
|
||||
0% {
|
||||
transform: scale(0, 0);
|
||||
transform-origin: var(--arrow-x, 50%) var(--arrow-y, 50%);
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
transform: scale(1, 1);
|
||||
transform-origin: var(--arrow-x, 50%) var(--arrow-y, 50%);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
@keyframes rcTriggerZoomOut {
|
||||
0% {
|
||||
transform: scale(1, 1);
|
||||
transform-origin: var(--arrow-x, 50%) var(--arrow-y, 50%);
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
transform: scale(0, 0);
|
||||
transform-origin: var(--arrow-x, 50%) var(--arrow-y, 50%);
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
.rc-trigger-popup-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
background-color: #373737;
|
||||
background-color: rgba(55, 55, 55, 0.6);
|
||||
height: 100%;
|
||||
filter: alpha(opacity=50);
|
||||
z-index: 1050;
|
||||
}
|
||||
.rc-trigger-popup-mask-hidden {
|
||||
display: none;
|
||||
}
|
||||
.rc-trigger-popup-fade-enter,
|
||||
.rc-trigger-popup-fade-appear {
|
||||
opacity: 0;
|
||||
animation-duration: 0.3s;
|
||||
animation-fill-mode: both;
|
||||
animation-timing-function: cubic-bezier(0.55, 0, 0.55, 0.2);
|
||||
animation-play-state: paused;
|
||||
}
|
||||
.rc-trigger-popup-fade-leave {
|
||||
animation-duration: 0.3s;
|
||||
animation-fill-mode: both;
|
||||
animation-timing-function: cubic-bezier(0.55, 0, 0.55, 0.2);
|
||||
animation-play-state: paused;
|
||||
}
|
||||
.rc-trigger-popup-fade-enter.rc-trigger-popup-fade-enter-active,
|
||||
.rc-trigger-popup-fade-appear.rc-trigger-popup-fade-appear-active {
|
||||
animation-name: rcTriggerMaskFadeIn;
|
||||
animation-play-state: running;
|
||||
}
|
||||
.rc-trigger-popup-fade-leave.rc-trigger-popup-fade-leave-active {
|
||||
animation-name: rcDialogFadeOut;
|
||||
animation-play-state: running;
|
||||
}
|
||||
@keyframes rcTriggerMaskFadeIn {
|
||||
0% {
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
@keyframes rcDialogFadeOut {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
.rc-trigger-popup-mobile {
|
||||
transition: all 0.3s;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
top: auto;
|
||||
}
|
||||
.rc-trigger-popup-mobile-fade-appear-start,
|
||||
.rc-trigger-popup-mobile-fade-enter-start {
|
||||
transform: translateY(100%);
|
||||
}
|
||||
.rc-trigger-popup-mobile-fade-leave-active {
|
||||
transform: translateY(100%);
|
||||
}
|
||||
79
frontend/node_modules/@rc-component/qrcode/assets/index.less
generated
vendored
Normal file
79
frontend/node_modules/@rc-component/qrcode/assets/index.less
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
@triggerPrefixCls: rc-trigger-popup;
|
||||
|
||||
.@{triggerPrefixCls} {
|
||||
position: absolute;
|
||||
top: -9999px;
|
||||
left: -9999px;
|
||||
z-index: 1050;
|
||||
|
||||
&-hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.effect() {
|
||||
animation-duration: 0.3s;
|
||||
animation-fill-mode: both;
|
||||
}
|
||||
|
||||
&-zoom-enter,
|
||||
&-zoom-appear {
|
||||
opacity: 0;
|
||||
animation-play-state: paused;
|
||||
animation-timing-function: cubic-bezier(0.18, 0.89, 0.32, 1.28);
|
||||
.effect();
|
||||
}
|
||||
|
||||
&-zoom-leave {
|
||||
.effect();
|
||||
animation-play-state: paused;
|
||||
animation-timing-function: cubic-bezier(0.6, -0.3, 0.74, 0.05);
|
||||
}
|
||||
|
||||
&-zoom-enter&-zoom-enter-active,
|
||||
&-zoom-appear&-zoom-appear-active {
|
||||
animation-name: rcTriggerZoomIn;
|
||||
animation-play-state: running;
|
||||
}
|
||||
|
||||
&-zoom-leave&-zoom-leave-active {
|
||||
animation-name: rcTriggerZoomOut;
|
||||
animation-play-state: running;
|
||||
}
|
||||
|
||||
&-arrow {
|
||||
z-index: 1;
|
||||
width: 0px;
|
||||
height: 0px;
|
||||
background: #000;
|
||||
border-radius: 100vw;
|
||||
box-shadow: 0 0 0 3px black;
|
||||
}
|
||||
|
||||
@keyframes rcTriggerZoomIn {
|
||||
0% {
|
||||
transform: scale(0, 0);
|
||||
transform-origin: var(--arrow-x, 50%) var(--arrow-y, 50%);
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
transform: scale(1, 1);
|
||||
transform-origin: var(--arrow-x, 50%) var(--arrow-y, 50%);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
@keyframes rcTriggerZoomOut {
|
||||
0% {
|
||||
transform: scale(1, 1);
|
||||
transform-origin: var(--arrow-x, 50%) var(--arrow-y, 50%);
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
transform: scale(0, 0);
|
||||
transform-origin: var(--arrow-x, 50%) var(--arrow-y, 50%);
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@import './index/Mask';
|
||||
@import './index/Mobile';
|
||||
63
frontend/node_modules/@rc-component/qrcode/assets/index/Mask.less
generated
vendored
Normal file
63
frontend/node_modules/@rc-component/qrcode/assets/index/Mask.less
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
.@{triggerPrefixCls} {
|
||||
&-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
background-color: rgb(55, 55, 55);
|
||||
background-color: rgba(55, 55, 55, 0.6);
|
||||
height: 100%;
|
||||
filter: alpha(opacity=50);
|
||||
z-index: 1050;
|
||||
|
||||
&-hidden {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.fade-effect() {
|
||||
animation-duration: 0.3s;
|
||||
animation-fill-mode: both;
|
||||
animation-timing-function: cubic-bezier(0.55, 0, 0.55, 0.2);
|
||||
}
|
||||
|
||||
&-fade-enter,&-fade-appear {
|
||||
opacity: 0;
|
||||
.fade-effect();
|
||||
animation-play-state: paused;
|
||||
}
|
||||
|
||||
&-fade-leave {
|
||||
.fade-effect();
|
||||
animation-play-state: paused;
|
||||
}
|
||||
|
||||
&-fade-enter&-fade-enter-active,&-fade-appear&-fade-appear-active {
|
||||
animation-name: rcTriggerMaskFadeIn;
|
||||
animation-play-state: running;
|
||||
}
|
||||
|
||||
&-fade-leave&-fade-leave-active {
|
||||
animation-name: rcDialogFadeOut;
|
||||
animation-play-state: running;
|
||||
}
|
||||
|
||||
@keyframes rcTriggerMaskFadeIn {
|
||||
0% {
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes rcDialogFadeOut {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
25
frontend/node_modules/@rc-component/qrcode/assets/index/Mobile.less
generated
vendored
Normal file
25
frontend/node_modules/@rc-component/qrcode/assets/index/Mobile.less
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
.@{triggerPrefixCls} {
|
||||
&-mobile {
|
||||
transition: all 0.3s;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
top: auto;
|
||||
|
||||
&-fade {
|
||||
&-appear,
|
||||
&-enter {
|
||||
&-start {
|
||||
transform: translateY(100%);
|
||||
}
|
||||
}
|
||||
|
||||
&-leave {
|
||||
&-active {
|
||||
transform: translateY(100%);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3
frontend/node_modules/@rc-component/qrcode/es/QRCodeCanvas.d.ts
generated
vendored
Normal file
3
frontend/node_modules/@rc-component/qrcode/es/QRCodeCanvas.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import React from 'react';
|
||||
declare const QRCodeCanvas: React.ForwardRefExoticComponent<import("./interface").QRProps & React.CanvasHTMLAttributes<HTMLCanvasElement> & React.RefAttributes<HTMLCanvasElement>>;
|
||||
export { QRCodeCanvas };
|
||||
134
frontend/node_modules/@rc-component/qrcode/es/QRCodeCanvas.js
generated
vendored
Normal file
134
frontend/node_modules/@rc-component/qrcode/es/QRCodeCanvas.js
generated
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
||||
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
||||
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
||||
var _excluded = ["value", "size", "level", "bgColor", "fgColor", "includeMargin", "minVersion", "marginSize", "style", "imageSettings", "boostLevel"];
|
||||
import React from 'react';
|
||||
import { useQRCode } from "./hooks/useQRCode";
|
||||
import { DEFAULT_BACKGROUND_COLOR, DEFAULT_FRONT_COLOR, DEFAULT_NEED_MARGIN, DEFAULT_LEVEL, DEFAULT_MINVERSION, DEFAULT_SIZE, isSupportPath2d, excavateModules, generatePath } from "./utils";
|
||||
var QRCodeCanvas = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
||||
var value = props.value,
|
||||
_props$size = props.size,
|
||||
size = _props$size === void 0 ? DEFAULT_SIZE : _props$size,
|
||||
_props$level = props.level,
|
||||
level = _props$level === void 0 ? DEFAULT_LEVEL : _props$level,
|
||||
_props$bgColor = props.bgColor,
|
||||
bgColor = _props$bgColor === void 0 ? DEFAULT_BACKGROUND_COLOR : _props$bgColor,
|
||||
_props$fgColor = props.fgColor,
|
||||
fgColor = _props$fgColor === void 0 ? DEFAULT_FRONT_COLOR : _props$fgColor,
|
||||
_props$includeMargin = props.includeMargin,
|
||||
includeMargin = _props$includeMargin === void 0 ? DEFAULT_NEED_MARGIN : _props$includeMargin,
|
||||
_props$minVersion = props.minVersion,
|
||||
minVersion = _props$minVersion === void 0 ? DEFAULT_MINVERSION : _props$minVersion,
|
||||
marginSize = props.marginSize,
|
||||
style = props.style,
|
||||
imageSettings = props.imageSettings,
|
||||
boostLevel = props.boostLevel,
|
||||
otherProps = _objectWithoutProperties(props, _excluded);
|
||||
var imgSrc = imageSettings === null || imageSettings === void 0 ? void 0 : imageSettings.src;
|
||||
var _canvas = React.useRef(null);
|
||||
var _image = React.useRef(null);
|
||||
var setCanvasRef = React.useCallback(function (node) {
|
||||
_canvas.current = node;
|
||||
if (typeof ref === 'function') {
|
||||
ref(node);
|
||||
} else if (ref) {
|
||||
ref.current = node;
|
||||
}
|
||||
}, [ref]);
|
||||
var _React$useState = React.useState(false),
|
||||
_React$useState2 = _slicedToArray(_React$useState, 2),
|
||||
setIsImageLoaded = _React$useState2[1];
|
||||
var _useQRCode = useQRCode({
|
||||
value: value,
|
||||
level: level,
|
||||
minVersion: minVersion,
|
||||
includeMargin: includeMargin,
|
||||
marginSize: marginSize,
|
||||
imageSettings: imageSettings,
|
||||
size: size,
|
||||
boostLevel: boostLevel
|
||||
}),
|
||||
margin = _useQRCode.margin,
|
||||
cells = _useQRCode.cells,
|
||||
numCells = _useQRCode.numCells,
|
||||
calculatedImageSettings = _useQRCode.calculatedImageSettings;
|
||||
React.useEffect(function () {
|
||||
if (_canvas.current) {
|
||||
var canvas = _canvas.current;
|
||||
var ctx = canvas.getContext('2d');
|
||||
if (!ctx) {
|
||||
return;
|
||||
}
|
||||
var cellsToDraw = cells;
|
||||
var image = _image.current;
|
||||
var haveImageToRender = calculatedImageSettings != null && image !== null && image.complete && image.naturalHeight !== 0 && image.naturalWidth !== 0;
|
||||
if (haveImageToRender) {
|
||||
if (calculatedImageSettings.excavation != null) {
|
||||
cellsToDraw = excavateModules(cells, calculatedImageSettings.excavation);
|
||||
}
|
||||
}
|
||||
var pixelRatio = window.devicePixelRatio || 1;
|
||||
canvas.height = canvas.width = size * pixelRatio;
|
||||
var scale = size / numCells * pixelRatio;
|
||||
ctx.scale(scale, scale);
|
||||
ctx.fillStyle = bgColor;
|
||||
ctx.fillRect(0, 0, numCells, numCells);
|
||||
ctx.fillStyle = fgColor;
|
||||
if (isSupportPath2d) {
|
||||
ctx.fill(new Path2D(generatePath(cellsToDraw, margin)));
|
||||
} else {
|
||||
cells.forEach(function (row, rdx) {
|
||||
row.forEach(function (cell, cdx) {
|
||||
if (cell) {
|
||||
ctx.fillRect(cdx + margin, rdx + margin, 1, 1);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
if (calculatedImageSettings) {
|
||||
ctx.globalAlpha = calculatedImageSettings.opacity;
|
||||
}
|
||||
if (haveImageToRender) {
|
||||
ctx.drawImage(image, calculatedImageSettings.x + margin, calculatedImageSettings.y + margin, calculatedImageSettings.w, calculatedImageSettings.h);
|
||||
}
|
||||
}
|
||||
});
|
||||
React.useEffect(function () {
|
||||
setIsImageLoaded(false);
|
||||
}, [imgSrc]);
|
||||
var canvasStyle = _objectSpread({
|
||||
height: size,
|
||||
width: size
|
||||
}, style);
|
||||
var img = null;
|
||||
if (imgSrc != null) {
|
||||
img = /*#__PURE__*/React.createElement("img", {
|
||||
alt: "QR-Code",
|
||||
src: imgSrc,
|
||||
key: imgSrc,
|
||||
style: {
|
||||
display: 'none'
|
||||
},
|
||||
onLoad: function onLoad() {
|
||||
setIsImageLoaded(true);
|
||||
},
|
||||
ref: _image
|
||||
// when crossOrigin is not set, the image will be tainted
|
||||
// and the canvas cannot be exported to an image
|
||||
,
|
||||
crossOrigin: calculatedImageSettings === null || calculatedImageSettings === void 0 ? void 0 : calculatedImageSettings.crossOrigin
|
||||
});
|
||||
}
|
||||
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("canvas", _extends({
|
||||
style: canvasStyle,
|
||||
height: size,
|
||||
width: size,
|
||||
ref: setCanvasRef,
|
||||
role: "img"
|
||||
}, otherProps)), img);
|
||||
});
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
QRCodeCanvas.displayName = 'QRCodeCanvas';
|
||||
}
|
||||
export { QRCodeCanvas };
|
||||
3
frontend/node_modules/@rc-component/qrcode/es/QRCodeSVG.d.ts
generated
vendored
Normal file
3
frontend/node_modules/@rc-component/qrcode/es/QRCodeSVG.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import React from 'react';
|
||||
declare const QRCodeSVG: React.ForwardRefExoticComponent<import("./interface").QRProps & React.SVGAttributes<SVGSVGElement> & React.RefAttributes<SVGSVGElement>>;
|
||||
export { QRCodeSVG };
|
||||
80
frontend/node_modules/@rc-component/qrcode/es/QRCodeSVG.js
generated
vendored
Normal file
80
frontend/node_modules/@rc-component/qrcode/es/QRCodeSVG.js
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
||||
var _excluded = ["value", "size", "level", "bgColor", "fgColor", "includeMargin", "minVersion", "title", "marginSize", "imageSettings", "boostLevel"];
|
||||
import React from 'react';
|
||||
import { DEFAULT_BACKGROUND_COLOR, DEFAULT_FRONT_COLOR, DEFAULT_NEED_MARGIN, DEFAULT_LEVEL, DEFAULT_MINVERSION, DEFAULT_SIZE, excavateModules, generatePath } from "./utils";
|
||||
import { useQRCode } from "./hooks/useQRCode";
|
||||
var QRCodeSVG = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
||||
var value = props.value,
|
||||
_props$size = props.size,
|
||||
size = _props$size === void 0 ? DEFAULT_SIZE : _props$size,
|
||||
_props$level = props.level,
|
||||
level = _props$level === void 0 ? DEFAULT_LEVEL : _props$level,
|
||||
_props$bgColor = props.bgColor,
|
||||
bgColor = _props$bgColor === void 0 ? DEFAULT_BACKGROUND_COLOR : _props$bgColor,
|
||||
_props$fgColor = props.fgColor,
|
||||
fgColor = _props$fgColor === void 0 ? DEFAULT_FRONT_COLOR : _props$fgColor,
|
||||
_props$includeMargin = props.includeMargin,
|
||||
includeMargin = _props$includeMargin === void 0 ? DEFAULT_NEED_MARGIN : _props$includeMargin,
|
||||
_props$minVersion = props.minVersion,
|
||||
minVersion = _props$minVersion === void 0 ? DEFAULT_MINVERSION : _props$minVersion,
|
||||
title = props.title,
|
||||
marginSize = props.marginSize,
|
||||
imageSettings = props.imageSettings,
|
||||
boostLevel = props.boostLevel,
|
||||
otherProps = _objectWithoutProperties(props, _excluded);
|
||||
var _useQRCode = useQRCode({
|
||||
value: value,
|
||||
level: level,
|
||||
minVersion: minVersion,
|
||||
includeMargin: includeMargin,
|
||||
marginSize: marginSize,
|
||||
imageSettings: imageSettings,
|
||||
size: size,
|
||||
boostLevel: boostLevel
|
||||
}),
|
||||
margin = _useQRCode.margin,
|
||||
cells = _useQRCode.cells,
|
||||
numCells = _useQRCode.numCells,
|
||||
calculatedImageSettings = _useQRCode.calculatedImageSettings;
|
||||
var cellsToDraw = cells;
|
||||
var image = null;
|
||||
if (imageSettings != null && calculatedImageSettings != null) {
|
||||
if (calculatedImageSettings.excavation != null) {
|
||||
cellsToDraw = excavateModules(cells, calculatedImageSettings.excavation);
|
||||
}
|
||||
image = /*#__PURE__*/React.createElement("image", {
|
||||
href: imageSettings.src,
|
||||
height: calculatedImageSettings.h,
|
||||
width: calculatedImageSettings.w,
|
||||
x: calculatedImageSettings.x + margin,
|
||||
y: calculatedImageSettings.y + margin,
|
||||
preserveAspectRatio: "none",
|
||||
opacity: calculatedImageSettings.opacity
|
||||
// when crossOrigin is not set, the image will be tainted
|
||||
// and the canvas cannot be exported to an image
|
||||
,
|
||||
crossOrigin: calculatedImageSettings.crossOrigin
|
||||
});
|
||||
}
|
||||
var fgPath = generatePath(cellsToDraw, margin);
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
height: size,
|
||||
width: size,
|
||||
viewBox: "0 0 ".concat(numCells, " ").concat(numCells),
|
||||
ref: ref,
|
||||
role: "img"
|
||||
}, otherProps), !!title && /*#__PURE__*/React.createElement("title", null, title), /*#__PURE__*/React.createElement("path", {
|
||||
fill: bgColor,
|
||||
d: "M0,0 h".concat(numCells, "v").concat(numCells, "H0z"),
|
||||
shapeRendering: "crispEdges"
|
||||
}), /*#__PURE__*/React.createElement("path", {
|
||||
fill: fgColor,
|
||||
d: fgPath,
|
||||
shapeRendering: "crispEdges"
|
||||
}), image);
|
||||
});
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
QRCodeSVG.displayName = 'QRCodeSVG';
|
||||
}
|
||||
export { QRCodeSVG };
|
||||
28
frontend/node_modules/@rc-component/qrcode/es/hooks/useQRCode.d.ts
generated
vendored
Normal file
28
frontend/node_modules/@rc-component/qrcode/es/hooks/useQRCode.d.ts
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import { QrCode } from '../libs/qrcodegen';
|
||||
import type { ErrorCorrectionLevel, ImageSettings } from '../interface';
|
||||
interface Options {
|
||||
value: string | string[];
|
||||
level: ErrorCorrectionLevel;
|
||||
minVersion: number;
|
||||
includeMargin: boolean;
|
||||
marginSize?: number;
|
||||
imageSettings?: ImageSettings;
|
||||
size: number;
|
||||
boostLevel?: boolean;
|
||||
}
|
||||
export declare const useQRCode: (opt: Options) => {
|
||||
cells: boolean[][];
|
||||
margin: number;
|
||||
numCells: number;
|
||||
calculatedImageSettings: {
|
||||
x: number;
|
||||
y: number;
|
||||
h: number;
|
||||
w: number;
|
||||
excavation: import("../interface").Excavation;
|
||||
opacity: number;
|
||||
crossOrigin: import("../interface").CrossOrigin;
|
||||
};
|
||||
qrcode: QrCode;
|
||||
};
|
||||
export {};
|
||||
35
frontend/node_modules/@rc-component/qrcode/es/hooks/useQRCode.js
generated
vendored
Normal file
35
frontend/node_modules/@rc-component/qrcode/es/hooks/useQRCode.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
||||
import { QrCode, QrSegment } from "../libs/qrcodegen";
|
||||
import { ERROR_LEVEL_MAP, getImageSettings, getMarginSize } from "../utils";
|
||||
import React from 'react';
|
||||
export var useQRCode = function useQRCode(opt) {
|
||||
var value = opt.value,
|
||||
level = opt.level,
|
||||
minVersion = opt.minVersion,
|
||||
includeMargin = opt.includeMargin,
|
||||
marginSize = opt.marginSize,
|
||||
imageSettings = opt.imageSettings,
|
||||
size = opt.size,
|
||||
boostLevel = opt.boostLevel;
|
||||
var memoizedQrcode = React.useMemo(function () {
|
||||
var values = Array.isArray(value) ? value : [value];
|
||||
var segments = values.reduce(function (acc, val) {
|
||||
acc.push.apply(acc, _toConsumableArray(QrSegment.makeSegments(val)));
|
||||
return acc;
|
||||
}, []);
|
||||
return QrCode.encodeSegments(segments, ERROR_LEVEL_MAP[level], minVersion, undefined, undefined, boostLevel);
|
||||
}, [value, level, minVersion, boostLevel]);
|
||||
return React.useMemo(function () {
|
||||
var cs = memoizedQrcode.getModules();
|
||||
var mg = getMarginSize(includeMargin, marginSize);
|
||||
var ncs = cs.length + mg * 2;
|
||||
var cis = getImageSettings(cs, size, mg, imageSettings);
|
||||
return {
|
||||
cells: cs,
|
||||
margin: mg,
|
||||
numCells: ncs,
|
||||
calculatedImageSettings: cis,
|
||||
qrcode: memoizedQrcode
|
||||
};
|
||||
}, [memoizedQrcode, size, imageSettings, includeMargin, marginSize]);
|
||||
};
|
||||
4
frontend/node_modules/@rc-component/qrcode/es/index.d.ts
generated
vendored
Normal file
4
frontend/node_modules/@rc-component/qrcode/es/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export type * from './interface';
|
||||
export * from './utils';
|
||||
export * from './QRCodeCanvas';
|
||||
export * from './QRCodeSVG';
|
||||
3
frontend/node_modules/@rc-component/qrcode/es/index.js
generated
vendored
Normal file
3
frontend/node_modules/@rc-component/qrcode/es/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from "./utils";
|
||||
export * from "./QRCodeCanvas";
|
||||
export * from "./QRCodeSVG";
|
||||
131
frontend/node_modules/@rc-component/qrcode/es/interface.d.ts
generated
vendored
Normal file
131
frontend/node_modules/@rc-component/qrcode/es/interface.d.ts
generated
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
import type React from 'react';
|
||||
import type { Ecc, QrCode } from './libs/qrcodegen';
|
||||
export type Modules = ReturnType<QrCode['getModules']>;
|
||||
export type Excavation = {
|
||||
x: number;
|
||||
y: number;
|
||||
w: number;
|
||||
h: number;
|
||||
};
|
||||
export type ErrorCorrectionLevel = 'L' | 'M' | 'Q' | 'H';
|
||||
export type CrossOrigin = 'anonymous' | 'use-credentials' | '' | undefined;
|
||||
export type ERROR_LEVEL_MAPPED_TYPE = {
|
||||
[index in ErrorCorrectionLevel]: Ecc;
|
||||
};
|
||||
export type ImageSettings = {
|
||||
/**
|
||||
* The URI of the embedded image.
|
||||
*/
|
||||
src: string;
|
||||
/**
|
||||
* The height, in pixels, of the image.
|
||||
*/
|
||||
height: number;
|
||||
/**
|
||||
* The width, in pixels, of the image.
|
||||
*/
|
||||
width: number;
|
||||
/**
|
||||
* Whether or not to "excavate" the modules around the embedded image. This
|
||||
* means that any modules the embedded image overlaps will use the background
|
||||
* color.
|
||||
*/
|
||||
excavate: boolean;
|
||||
/**
|
||||
* The horiztonal offset of the embedded image, starting from the top left corner.
|
||||
* Will center if not specified.
|
||||
*/
|
||||
x?: number;
|
||||
/**
|
||||
* The vertical offset of the embedded image, starting from the top left corner.
|
||||
* Will center if not specified.
|
||||
*/
|
||||
y?: number;
|
||||
/**
|
||||
* The opacity of the embedded image in the range of 0-1.
|
||||
* @defaultValue 1
|
||||
*/
|
||||
opacity?: number;
|
||||
/**
|
||||
* The cross-origin value to use when loading the image. This is used to
|
||||
* ensure compatibility with CORS, particularly when extracting image data
|
||||
* from QRCodeCanvas.
|
||||
* Note: `undefined` is treated differently than the seemingly equivalent
|
||||
* empty string. This is intended to align with HTML behavior where omitting
|
||||
* the attribute behaves differently than the empty string.
|
||||
*/
|
||||
crossOrigin?: CrossOrigin;
|
||||
};
|
||||
export type QRProps = {
|
||||
/**
|
||||
* The value to encode into the QR Code. An array of strings can be passed in
|
||||
* to represent multiple segments to further optimize the QR Code.
|
||||
*/
|
||||
value: string | string[];
|
||||
/**
|
||||
* If enabled, the Error Correction Level of the result may be higher than
|
||||
* the specified Error Correction Level option if it can be done without
|
||||
* increasing the version.
|
||||
* @defaultValue true
|
||||
*/
|
||||
boostLevel?: boolean;
|
||||
/**
|
||||
* The size, in pixels, to render the QR Code.
|
||||
* @defaultValue 128
|
||||
*/
|
||||
size?: number;
|
||||
/**
|
||||
* The Error Correction Level to use.
|
||||
* @see https://www.qrcode.com/en/about/error_correction.html
|
||||
* @defaultValue L
|
||||
*/
|
||||
level?: ErrorCorrectionLevel;
|
||||
/**
|
||||
* The background color used to render the QR Code.
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
|
||||
* @defaultValue #FFFFFF
|
||||
*/
|
||||
bgColor?: string;
|
||||
/**
|
||||
* The foregtound color used to render the QR Code.
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
|
||||
* @defaultValue #000000
|
||||
*/
|
||||
fgColor?: string;
|
||||
/**
|
||||
* The style to apply to the QR Code.
|
||||
*/
|
||||
style?: React.CSSProperties;
|
||||
/**
|
||||
* Whether or not a margin of 4 modules should be rendered as a part of the
|
||||
* QR Code.
|
||||
* @deprecated Use `marginSize` instead.
|
||||
* @defaultValue false
|
||||
*/
|
||||
includeMargin?: boolean;
|
||||
/**
|
||||
* The number of _modules_ to use for margin. The QR Code specification
|
||||
* requires `4`, however you can specify any number. Values will be turned to
|
||||
* integers with `Math.floor`. Overrides `includeMargin` when both are specified.
|
||||
* @defaultValue 0
|
||||
*/
|
||||
marginSize?: number;
|
||||
/**
|
||||
* The settings for the embedded image.
|
||||
*/
|
||||
imageSettings?: ImageSettings;
|
||||
/**
|
||||
* The title to assign to the QR Code. Used for accessibility reasons.
|
||||
*/
|
||||
title?: string;
|
||||
/**
|
||||
* The minimum version used when encoding the QR Code. Valid values are 1-40
|
||||
* with higher values resulting in more complex QR Codes. The optimal
|
||||
* (lowest) version is determined for the `value` provided, using `minVersion`
|
||||
* as the lower bound.
|
||||
* @defaultValue 1
|
||||
*/
|
||||
minVersion?: number;
|
||||
};
|
||||
export type QRPropsCanvas = QRProps & React.CanvasHTMLAttributes<HTMLCanvasElement>;
|
||||
export type QRPropsSVG = QRProps & React.SVGAttributes<SVGSVGElement>;
|
||||
1
frontend/node_modules/@rc-component/qrcode/es/interface.js
generated
vendored
Normal file
1
frontend/node_modules/@rc-component/qrcode/es/interface.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
80
frontend/node_modules/@rc-component/qrcode/es/libs/qrcodegen.d.ts
generated
vendored
Normal file
80
frontend/node_modules/@rc-component/qrcode/es/libs/qrcodegen.d.ts
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
export declare class Mode {
|
||||
static readonly NUMERIC: Mode;
|
||||
static readonly ALPHANUMERIC: Mode;
|
||||
static readonly BYTE: Mode;
|
||||
static readonly KANJI: Mode;
|
||||
static readonly ECI: Mode;
|
||||
modeBits: number;
|
||||
private numBitsCharCount;
|
||||
private constructor();
|
||||
numCharCountBits(ver: number): number;
|
||||
}
|
||||
export declare class Ecc {
|
||||
static readonly LOW: Ecc;
|
||||
static readonly MEDIUM: Ecc;
|
||||
static readonly QUARTILE: Ecc;
|
||||
static readonly HIGH: Ecc;
|
||||
ordinal: number;
|
||||
formatBits: number;
|
||||
private constructor();
|
||||
}
|
||||
export declare class QrSegment {
|
||||
static makeBytes(data: Readonly<number[]>): QrSegment;
|
||||
static makeNumeric(digits: string): QrSegment;
|
||||
static makeAlphanumeric(text: string): QrSegment;
|
||||
static makeSegments(text: string): QrSegment[];
|
||||
static makeEci(assignVal: number): QrSegment;
|
||||
static isNumeric(text: string): boolean;
|
||||
static isAlphanumeric(text: string): boolean;
|
||||
mode: Mode;
|
||||
numChars: number;
|
||||
private bitData;
|
||||
constructor(mode: Mode, numChars: number, bitData: number[]);
|
||||
getData(): number[];
|
||||
static getTotalBits(segs: Readonly<QrSegment[]>, version: number): number;
|
||||
private static toUtf8ByteArray;
|
||||
private static readonly NUMERIC_REGEX;
|
||||
private static readonly ALPHANUMERIC_REGEX;
|
||||
private static readonly ALPHANUMERIC_CHARSET;
|
||||
}
|
||||
export declare class QrCode {
|
||||
static encodeText(text: string, ecl: Ecc): QrCode;
|
||||
static encodeBinary(data: Readonly<number[]>, ecl: Ecc): QrCode;
|
||||
static encodeSegments(segs: Readonly<QrSegment[]>, oriEcl: Ecc, minVersion?: number, maxVersion?: number, mask?: number, boostEcl?: boolean): QrCode;
|
||||
readonly size: number;
|
||||
readonly mask: number;
|
||||
private readonly modules;
|
||||
private readonly isFunction;
|
||||
version: number;
|
||||
errorCorrectionLevel: Ecc;
|
||||
constructor(version: number, errorCorrectionLevel: Ecc, dataCodewords: Readonly<number[]>, oriMsk: number);
|
||||
getModule(x: number, y: number): boolean;
|
||||
getModules(): boolean[][];
|
||||
private drawFunctionPatterns;
|
||||
private drawFormatBits;
|
||||
private drawVersion;
|
||||
private drawFinderPattern;
|
||||
private drawAlignmentPattern;
|
||||
private setFunctionModule;
|
||||
private addEccAndInterleave;
|
||||
private drawCodewords;
|
||||
private applyMask;
|
||||
private getPenaltyScore;
|
||||
private getAlignmentPatternPositions;
|
||||
private static getNumRawDataModules;
|
||||
private static getNumDataCodewords;
|
||||
private static reedSolomonComputeDivisor;
|
||||
private static reedSolomonComputeRemainder;
|
||||
private static reedSolomonMultiply;
|
||||
private finderPenaltyCountPatterns;
|
||||
private finderPenaltyTerminateAndCount;
|
||||
private finderPenaltyAddHistory;
|
||||
static readonly MIN_VERSION: number;
|
||||
static readonly MAX_VERSION: number;
|
||||
private static readonly PENALTY_N1;
|
||||
private static readonly PENALTY_N2;
|
||||
private static readonly PENALTY_N3;
|
||||
private static readonly PENALTY_N4;
|
||||
private static readonly ECC_CODEWORDS_PER_BLOCK;
|
||||
private static readonly NUM_ERROR_CORRECTION_BLOCKS;
|
||||
}
|
||||
1116
frontend/node_modules/@rc-component/qrcode/es/libs/qrcodegen.js
generated
vendored
Normal file
1116
frontend/node_modules/@rc-component/qrcode/es/libs/qrcodegen.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
53
frontend/node_modules/@rc-component/qrcode/es/utils.d.ts
generated
vendored
Normal file
53
frontend/node_modules/@rc-component/qrcode/es/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
import type { CrossOrigin, ERROR_LEVEL_MAPPED_TYPE, ErrorCorrectionLevel, Excavation, ImageSettings } from './interface';
|
||||
export declare const ERROR_LEVEL_MAP: ERROR_LEVEL_MAPPED_TYPE;
|
||||
export declare const DEFAULT_SIZE = 128;
|
||||
export declare const DEFAULT_LEVEL: ErrorCorrectionLevel;
|
||||
export declare const DEFAULT_BACKGROUND_COLOR = "#FFFFFF";
|
||||
export declare const DEFAULT_FRONT_COLOR = "#000000";
|
||||
export declare const DEFAULT_NEED_MARGIN = false;
|
||||
export declare const DEFAULT_MINVERSION = 1;
|
||||
export declare const SPEC_MARGIN_SIZE = 4;
|
||||
export declare const DEFAULT_MARGIN_SIZE = 0;
|
||||
export declare const DEFAULT_IMG_SCALE = 0.1;
|
||||
/**
|
||||
* Generate a path string from modules
|
||||
* @param modules
|
||||
* @param margin
|
||||
* @returns
|
||||
*/
|
||||
export declare const generatePath: (modules: boolean[][], margin?: number) => string;
|
||||
/**
|
||||
* Excavate modules
|
||||
* @param modules
|
||||
* @param excavation
|
||||
* @returns
|
||||
*/
|
||||
export declare const excavateModules: (modules: boolean[][], excavation: Excavation) => boolean[][];
|
||||
/**
|
||||
* Get image settings
|
||||
* @param cells The modules of the QR code
|
||||
* @param size The size of the QR code
|
||||
* @param margin
|
||||
* @param imageSettings
|
||||
* @returns
|
||||
*/
|
||||
export declare const getImageSettings: (cells: boolean[][], size: number, margin: number, imageSettings?: ImageSettings) => {
|
||||
x: number;
|
||||
y: number;
|
||||
h: number;
|
||||
w: number;
|
||||
excavation: Excavation | null;
|
||||
opacity: number;
|
||||
crossOrigin: CrossOrigin;
|
||||
};
|
||||
/**
|
||||
* Get margin size
|
||||
* @param needMargin Whether need margin
|
||||
* @param marginSize Custom margin size
|
||||
* @returns
|
||||
*/
|
||||
export declare const getMarginSize: (needMargin: boolean, marginSize?: number) => number;
|
||||
/**
|
||||
* Check if Path2D is supported
|
||||
*/
|
||||
export declare const isSupportPath2d: boolean;
|
||||
152
frontend/node_modules/@rc-component/qrcode/es/utils.js
generated
vendored
Normal file
152
frontend/node_modules/@rc-component/qrcode/es/utils.js
generated
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
// Part logic is from `qrcode.react`. (ISC License)
|
||||
// https://github.com/zpao/qrcode.react
|
||||
|
||||
// ==========================================================
|
||||
|
||||
import { Ecc } from "./libs/qrcodegen";
|
||||
|
||||
// =================== ERROR_LEVEL ==========================
|
||||
export var ERROR_LEVEL_MAP = {
|
||||
L: Ecc.LOW,
|
||||
M: Ecc.MEDIUM,
|
||||
Q: Ecc.QUARTILE,
|
||||
H: Ecc.HIGH
|
||||
};
|
||||
|
||||
// =================== DEFAULT_VALUE ==========================
|
||||
export var DEFAULT_SIZE = 128;
|
||||
export var DEFAULT_LEVEL = 'L';
|
||||
export var DEFAULT_BACKGROUND_COLOR = '#FFFFFF';
|
||||
export var DEFAULT_FRONT_COLOR = '#000000';
|
||||
export var DEFAULT_NEED_MARGIN = false;
|
||||
export var DEFAULT_MINVERSION = 1;
|
||||
export var SPEC_MARGIN_SIZE = 4;
|
||||
export var DEFAULT_MARGIN_SIZE = 0;
|
||||
export var DEFAULT_IMG_SCALE = 0.1;
|
||||
|
||||
// =================== UTILS ==========================
|
||||
/**
|
||||
* Generate a path string from modules
|
||||
* @param modules
|
||||
* @param margin
|
||||
* @returns
|
||||
*/
|
||||
export var generatePath = function generatePath(modules) {
|
||||
var margin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
||||
var ops = [];
|
||||
modules.forEach(function (row, y) {
|
||||
var start = null;
|
||||
row.forEach(function (cell, x) {
|
||||
if (!cell && start !== null) {
|
||||
ops.push("M".concat(start + margin, " ").concat(y + margin, "h").concat(x - start, "v1H").concat(start + margin, "z"));
|
||||
start = null;
|
||||
return;
|
||||
}
|
||||
if (x === row.length - 1) {
|
||||
if (!cell) {
|
||||
return;
|
||||
}
|
||||
if (start === null) {
|
||||
ops.push("M".concat(x + margin, ",").concat(y + margin, " h1v1H").concat(x + margin, "z"));
|
||||
} else {
|
||||
ops.push("M".concat(start + margin, ",").concat(y + margin, " h").concat(x + 1 - start, "v1H").concat(start + margin, "z"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (cell && start === null) {
|
||||
start = x;
|
||||
}
|
||||
});
|
||||
});
|
||||
return ops.join('');
|
||||
};
|
||||
|
||||
/**
|
||||
* Excavate modules
|
||||
* @param modules
|
||||
* @param excavation
|
||||
* @returns
|
||||
*/
|
||||
export var excavateModules = function excavateModules(modules, excavation) {
|
||||
return modules.slice().map(function (row, y) {
|
||||
if (y < excavation.y || y >= excavation.y + excavation.h) {
|
||||
return row;
|
||||
}
|
||||
return row.map(function (cell, x) {
|
||||
if (x < excavation.x || x >= excavation.x + excavation.w) {
|
||||
return cell;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Get image settings
|
||||
* @param cells The modules of the QR code
|
||||
* @param size The size of the QR code
|
||||
* @param margin
|
||||
* @param imageSettings
|
||||
* @returns
|
||||
*/
|
||||
export var getImageSettings = function getImageSettings(cells, size, margin, imageSettings) {
|
||||
if (imageSettings == null) {
|
||||
return null;
|
||||
}
|
||||
var numCells = cells.length + margin * 2;
|
||||
var defaultSize = Math.floor(size * DEFAULT_IMG_SCALE);
|
||||
var scale = numCells / size;
|
||||
var w = (imageSettings.width || defaultSize) * scale;
|
||||
var h = (imageSettings.height || defaultSize) * scale;
|
||||
var x = imageSettings.x == null ? cells.length / 2 - w / 2 : imageSettings.x * scale;
|
||||
var y = imageSettings.y == null ? cells.length / 2 - h / 2 : imageSettings.y * scale;
|
||||
var opacity = imageSettings.opacity == null ? 1 : imageSettings.opacity;
|
||||
var excavation = null;
|
||||
if (imageSettings.excavate) {
|
||||
var floorX = Math.floor(x);
|
||||
var floorY = Math.floor(y);
|
||||
var ceilW = Math.ceil(w + x - floorX);
|
||||
var ceilH = Math.ceil(h + y - floorY);
|
||||
excavation = {
|
||||
x: floorX,
|
||||
y: floorY,
|
||||
w: ceilW,
|
||||
h: ceilH
|
||||
};
|
||||
}
|
||||
var crossOrigin = imageSettings.crossOrigin;
|
||||
return {
|
||||
x: x,
|
||||
y: y,
|
||||
h: h,
|
||||
w: w,
|
||||
excavation: excavation,
|
||||
opacity: opacity,
|
||||
crossOrigin: crossOrigin
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Get margin size
|
||||
* @param needMargin Whether need margin
|
||||
* @param marginSize Custom margin size
|
||||
* @returns
|
||||
*/
|
||||
export var getMarginSize = function getMarginSize(needMargin, marginSize) {
|
||||
if (marginSize != null) {
|
||||
return Math.max(Math.floor(marginSize), 0);
|
||||
}
|
||||
return needMargin ? SPEC_MARGIN_SIZE : DEFAULT_MARGIN_SIZE;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if Path2D is supported
|
||||
*/
|
||||
export var isSupportPath2d = function () {
|
||||
try {
|
||||
new Path2D().addPath(new Path2D());
|
||||
} catch (_unused) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}();
|
||||
3
frontend/node_modules/@rc-component/qrcode/lib/QRCodeCanvas.d.ts
generated
vendored
Normal file
3
frontend/node_modules/@rc-component/qrcode/lib/QRCodeCanvas.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import React from 'react';
|
||||
declare const QRCodeCanvas: React.ForwardRefExoticComponent<import("./interface").QRProps & React.CanvasHTMLAttributes<HTMLCanvasElement> & React.RefAttributes<HTMLCanvasElement>>;
|
||||
export { QRCodeCanvas };
|
||||
140
frontend/node_modules/@rc-component/qrcode/lib/QRCodeCanvas.js
generated
vendored
Normal file
140
frontend/node_modules/@rc-component/qrcode/lib/QRCodeCanvas.js
generated
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.QRCodeCanvas = void 0;
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
||||
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
||||
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
var _useQRCode2 = require("./hooks/useQRCode");
|
||||
var _utils = require("./utils");
|
||||
var _excluded = ["value", "size", "level", "bgColor", "fgColor", "includeMargin", "minVersion", "marginSize", "style", "imageSettings", "boostLevel"];
|
||||
var QRCodeCanvas = exports.QRCodeCanvas = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
||||
var value = props.value,
|
||||
_props$size = props.size,
|
||||
size = _props$size === void 0 ? _utils.DEFAULT_SIZE : _props$size,
|
||||
_props$level = props.level,
|
||||
level = _props$level === void 0 ? _utils.DEFAULT_LEVEL : _props$level,
|
||||
_props$bgColor = props.bgColor,
|
||||
bgColor = _props$bgColor === void 0 ? _utils.DEFAULT_BACKGROUND_COLOR : _props$bgColor,
|
||||
_props$fgColor = props.fgColor,
|
||||
fgColor = _props$fgColor === void 0 ? _utils.DEFAULT_FRONT_COLOR : _props$fgColor,
|
||||
_props$includeMargin = props.includeMargin,
|
||||
includeMargin = _props$includeMargin === void 0 ? _utils.DEFAULT_NEED_MARGIN : _props$includeMargin,
|
||||
_props$minVersion = props.minVersion,
|
||||
minVersion = _props$minVersion === void 0 ? _utils.DEFAULT_MINVERSION : _props$minVersion,
|
||||
marginSize = props.marginSize,
|
||||
style = props.style,
|
||||
imageSettings = props.imageSettings,
|
||||
boostLevel = props.boostLevel,
|
||||
otherProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
||||
var imgSrc = imageSettings === null || imageSettings === void 0 ? void 0 : imageSettings.src;
|
||||
var _canvas = _react.default.useRef(null);
|
||||
var _image = _react.default.useRef(null);
|
||||
var setCanvasRef = _react.default.useCallback(function (node) {
|
||||
_canvas.current = node;
|
||||
if (typeof ref === 'function') {
|
||||
ref(node);
|
||||
} else if (ref) {
|
||||
ref.current = node;
|
||||
}
|
||||
}, [ref]);
|
||||
var _React$useState = _react.default.useState(false),
|
||||
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
|
||||
setIsImageLoaded = _React$useState2[1];
|
||||
var _useQRCode = (0, _useQRCode2.useQRCode)({
|
||||
value: value,
|
||||
level: level,
|
||||
minVersion: minVersion,
|
||||
includeMargin: includeMargin,
|
||||
marginSize: marginSize,
|
||||
imageSettings: imageSettings,
|
||||
size: size,
|
||||
boostLevel: boostLevel
|
||||
}),
|
||||
margin = _useQRCode.margin,
|
||||
cells = _useQRCode.cells,
|
||||
numCells = _useQRCode.numCells,
|
||||
calculatedImageSettings = _useQRCode.calculatedImageSettings;
|
||||
_react.default.useEffect(function () {
|
||||
if (_canvas.current) {
|
||||
var canvas = _canvas.current;
|
||||
var ctx = canvas.getContext('2d');
|
||||
if (!ctx) {
|
||||
return;
|
||||
}
|
||||
var cellsToDraw = cells;
|
||||
var image = _image.current;
|
||||
var haveImageToRender = calculatedImageSettings != null && image !== null && image.complete && image.naturalHeight !== 0 && image.naturalWidth !== 0;
|
||||
if (haveImageToRender) {
|
||||
if (calculatedImageSettings.excavation != null) {
|
||||
cellsToDraw = (0, _utils.excavateModules)(cells, calculatedImageSettings.excavation);
|
||||
}
|
||||
}
|
||||
var pixelRatio = window.devicePixelRatio || 1;
|
||||
canvas.height = canvas.width = size * pixelRatio;
|
||||
var scale = size / numCells * pixelRatio;
|
||||
ctx.scale(scale, scale);
|
||||
ctx.fillStyle = bgColor;
|
||||
ctx.fillRect(0, 0, numCells, numCells);
|
||||
ctx.fillStyle = fgColor;
|
||||
if (_utils.isSupportPath2d) {
|
||||
ctx.fill(new Path2D((0, _utils.generatePath)(cellsToDraw, margin)));
|
||||
} else {
|
||||
cells.forEach(function (row, rdx) {
|
||||
row.forEach(function (cell, cdx) {
|
||||
if (cell) {
|
||||
ctx.fillRect(cdx + margin, rdx + margin, 1, 1);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
if (calculatedImageSettings) {
|
||||
ctx.globalAlpha = calculatedImageSettings.opacity;
|
||||
}
|
||||
if (haveImageToRender) {
|
||||
ctx.drawImage(image, calculatedImageSettings.x + margin, calculatedImageSettings.y + margin, calculatedImageSettings.w, calculatedImageSettings.h);
|
||||
}
|
||||
}
|
||||
});
|
||||
_react.default.useEffect(function () {
|
||||
setIsImageLoaded(false);
|
||||
}, [imgSrc]);
|
||||
var canvasStyle = (0, _objectSpread2.default)({
|
||||
height: size,
|
||||
width: size
|
||||
}, style);
|
||||
var img = null;
|
||||
if (imgSrc != null) {
|
||||
img = /*#__PURE__*/_react.default.createElement("img", {
|
||||
alt: "QR-Code",
|
||||
src: imgSrc,
|
||||
key: imgSrc,
|
||||
style: {
|
||||
display: 'none'
|
||||
},
|
||||
onLoad: function onLoad() {
|
||||
setIsImageLoaded(true);
|
||||
},
|
||||
ref: _image
|
||||
// when crossOrigin is not set, the image will be tainted
|
||||
// and the canvas cannot be exported to an image
|
||||
,
|
||||
crossOrigin: calculatedImageSettings === null || calculatedImageSettings === void 0 ? void 0 : calculatedImageSettings.crossOrigin
|
||||
});
|
||||
}
|
||||
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("canvas", (0, _extends2.default)({
|
||||
style: canvasStyle,
|
||||
height: size,
|
||||
width: size,
|
||||
ref: setCanvasRef,
|
||||
role: "img"
|
||||
}, otherProps)), img);
|
||||
});
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
QRCodeCanvas.displayName = 'QRCodeCanvas';
|
||||
}
|
||||
3
frontend/node_modules/@rc-component/qrcode/lib/QRCodeSVG.d.ts
generated
vendored
Normal file
3
frontend/node_modules/@rc-component/qrcode/lib/QRCodeSVG.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import React from 'react';
|
||||
declare const QRCodeSVG: React.ForwardRefExoticComponent<import("./interface").QRProps & React.SVGAttributes<SVGSVGElement> & React.RefAttributes<SVGSVGElement>>;
|
||||
export { QRCodeSVG };
|
||||
86
frontend/node_modules/@rc-component/qrcode/lib/QRCodeSVG.js
generated
vendored
Normal file
86
frontend/node_modules/@rc-component/qrcode/lib/QRCodeSVG.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.QRCodeSVG = void 0;
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
var _utils = require("./utils");
|
||||
var _useQRCode2 = require("./hooks/useQRCode");
|
||||
var _excluded = ["value", "size", "level", "bgColor", "fgColor", "includeMargin", "minVersion", "title", "marginSize", "imageSettings", "boostLevel"];
|
||||
var QRCodeSVG = exports.QRCodeSVG = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
||||
var value = props.value,
|
||||
_props$size = props.size,
|
||||
size = _props$size === void 0 ? _utils.DEFAULT_SIZE : _props$size,
|
||||
_props$level = props.level,
|
||||
level = _props$level === void 0 ? _utils.DEFAULT_LEVEL : _props$level,
|
||||
_props$bgColor = props.bgColor,
|
||||
bgColor = _props$bgColor === void 0 ? _utils.DEFAULT_BACKGROUND_COLOR : _props$bgColor,
|
||||
_props$fgColor = props.fgColor,
|
||||
fgColor = _props$fgColor === void 0 ? _utils.DEFAULT_FRONT_COLOR : _props$fgColor,
|
||||
_props$includeMargin = props.includeMargin,
|
||||
includeMargin = _props$includeMargin === void 0 ? _utils.DEFAULT_NEED_MARGIN : _props$includeMargin,
|
||||
_props$minVersion = props.minVersion,
|
||||
minVersion = _props$minVersion === void 0 ? _utils.DEFAULT_MINVERSION : _props$minVersion,
|
||||
title = props.title,
|
||||
marginSize = props.marginSize,
|
||||
imageSettings = props.imageSettings,
|
||||
boostLevel = props.boostLevel,
|
||||
otherProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
||||
var _useQRCode = (0, _useQRCode2.useQRCode)({
|
||||
value: value,
|
||||
level: level,
|
||||
minVersion: minVersion,
|
||||
includeMargin: includeMargin,
|
||||
marginSize: marginSize,
|
||||
imageSettings: imageSettings,
|
||||
size: size,
|
||||
boostLevel: boostLevel
|
||||
}),
|
||||
margin = _useQRCode.margin,
|
||||
cells = _useQRCode.cells,
|
||||
numCells = _useQRCode.numCells,
|
||||
calculatedImageSettings = _useQRCode.calculatedImageSettings;
|
||||
var cellsToDraw = cells;
|
||||
var image = null;
|
||||
if (imageSettings != null && calculatedImageSettings != null) {
|
||||
if (calculatedImageSettings.excavation != null) {
|
||||
cellsToDraw = (0, _utils.excavateModules)(cells, calculatedImageSettings.excavation);
|
||||
}
|
||||
image = /*#__PURE__*/_react.default.createElement("image", {
|
||||
href: imageSettings.src,
|
||||
height: calculatedImageSettings.h,
|
||||
width: calculatedImageSettings.w,
|
||||
x: calculatedImageSettings.x + margin,
|
||||
y: calculatedImageSettings.y + margin,
|
||||
preserveAspectRatio: "none",
|
||||
opacity: calculatedImageSettings.opacity
|
||||
// when crossOrigin is not set, the image will be tainted
|
||||
// and the canvas cannot be exported to an image
|
||||
,
|
||||
crossOrigin: calculatedImageSettings.crossOrigin
|
||||
});
|
||||
}
|
||||
var fgPath = (0, _utils.generatePath)(cellsToDraw, margin);
|
||||
return /*#__PURE__*/_react.default.createElement("svg", (0, _extends2.default)({
|
||||
height: size,
|
||||
width: size,
|
||||
viewBox: "0 0 ".concat(numCells, " ").concat(numCells),
|
||||
ref: ref,
|
||||
role: "img"
|
||||
}, otherProps), !!title && /*#__PURE__*/_react.default.createElement("title", null, title), /*#__PURE__*/_react.default.createElement("path", {
|
||||
fill: bgColor,
|
||||
d: "M0,0 h".concat(numCells, "v").concat(numCells, "H0z"),
|
||||
shapeRendering: "crispEdges"
|
||||
}), /*#__PURE__*/_react.default.createElement("path", {
|
||||
fill: fgColor,
|
||||
d: fgPath,
|
||||
shapeRendering: "crispEdges"
|
||||
}), image);
|
||||
});
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
QRCodeSVG.displayName = 'QRCodeSVG';
|
||||
}
|
||||
28
frontend/node_modules/@rc-component/qrcode/lib/hooks/useQRCode.d.ts
generated
vendored
Normal file
28
frontend/node_modules/@rc-component/qrcode/lib/hooks/useQRCode.d.ts
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import { QrCode } from '../libs/qrcodegen';
|
||||
import type { ErrorCorrectionLevel, ImageSettings } from '../interface';
|
||||
interface Options {
|
||||
value: string | string[];
|
||||
level: ErrorCorrectionLevel;
|
||||
minVersion: number;
|
||||
includeMargin: boolean;
|
||||
marginSize?: number;
|
||||
imageSettings?: ImageSettings;
|
||||
size: number;
|
||||
boostLevel?: boolean;
|
||||
}
|
||||
export declare const useQRCode: (opt: Options) => {
|
||||
cells: boolean[][];
|
||||
margin: number;
|
||||
numCells: number;
|
||||
calculatedImageSettings: {
|
||||
x: number;
|
||||
y: number;
|
||||
h: number;
|
||||
w: number;
|
||||
excavation: import("../interface").Excavation;
|
||||
opacity: number;
|
||||
crossOrigin: import("../interface").CrossOrigin;
|
||||
};
|
||||
qrcode: QrCode;
|
||||
};
|
||||
export {};
|
||||
42
frontend/node_modules/@rc-component/qrcode/lib/hooks/useQRCode.js
generated
vendored
Normal file
42
frontend/node_modules/@rc-component/qrcode/lib/hooks/useQRCode.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useQRCode = void 0;
|
||||
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
||||
var _qrcodegen = require("../libs/qrcodegen");
|
||||
var _utils = require("../utils");
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
var useQRCode = exports.useQRCode = function useQRCode(opt) {
|
||||
var value = opt.value,
|
||||
level = opt.level,
|
||||
minVersion = opt.minVersion,
|
||||
includeMargin = opt.includeMargin,
|
||||
marginSize = opt.marginSize,
|
||||
imageSettings = opt.imageSettings,
|
||||
size = opt.size,
|
||||
boostLevel = opt.boostLevel;
|
||||
var memoizedQrcode = _react.default.useMemo(function () {
|
||||
var values = Array.isArray(value) ? value : [value];
|
||||
var segments = values.reduce(function (acc, val) {
|
||||
acc.push.apply(acc, (0, _toConsumableArray2.default)(_qrcodegen.QrSegment.makeSegments(val)));
|
||||
return acc;
|
||||
}, []);
|
||||
return _qrcodegen.QrCode.encodeSegments(segments, _utils.ERROR_LEVEL_MAP[level], minVersion, undefined, undefined, boostLevel);
|
||||
}, [value, level, minVersion, boostLevel]);
|
||||
return _react.default.useMemo(function () {
|
||||
var cs = memoizedQrcode.getModules();
|
||||
var mg = (0, _utils.getMarginSize)(includeMargin, marginSize);
|
||||
var ncs = cs.length + mg * 2;
|
||||
var cis = (0, _utils.getImageSettings)(cs, size, mg, imageSettings);
|
||||
return {
|
||||
cells: cs,
|
||||
margin: mg,
|
||||
numCells: ncs,
|
||||
calculatedImageSettings: cis,
|
||||
qrcode: memoizedQrcode
|
||||
};
|
||||
}, [memoizedQrcode, size, imageSettings, includeMargin, marginSize]);
|
||||
};
|
||||
4
frontend/node_modules/@rc-component/qrcode/lib/index.d.ts
generated
vendored
Normal file
4
frontend/node_modules/@rc-component/qrcode/lib/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export type * from './interface';
|
||||
export * from './utils';
|
||||
export * from './QRCodeCanvas';
|
||||
export * from './QRCodeSVG';
|
||||
38
frontend/node_modules/@rc-component/qrcode/lib/index.js
generated
vendored
Normal file
38
frontend/node_modules/@rc-component/qrcode/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var _utils = require("./utils");
|
||||
Object.keys(_utils).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _utils[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _utils[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
var _QRCodeCanvas = require("./QRCodeCanvas");
|
||||
Object.keys(_QRCodeCanvas).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _QRCodeCanvas[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _QRCodeCanvas[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
var _QRCodeSVG = require("./QRCodeSVG");
|
||||
Object.keys(_QRCodeSVG).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _QRCodeSVG[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _QRCodeSVG[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
131
frontend/node_modules/@rc-component/qrcode/lib/interface.d.ts
generated
vendored
Normal file
131
frontend/node_modules/@rc-component/qrcode/lib/interface.d.ts
generated
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
import type React from 'react';
|
||||
import type { Ecc, QrCode } from './libs/qrcodegen';
|
||||
export type Modules = ReturnType<QrCode['getModules']>;
|
||||
export type Excavation = {
|
||||
x: number;
|
||||
y: number;
|
||||
w: number;
|
||||
h: number;
|
||||
};
|
||||
export type ErrorCorrectionLevel = 'L' | 'M' | 'Q' | 'H';
|
||||
export type CrossOrigin = 'anonymous' | 'use-credentials' | '' | undefined;
|
||||
export type ERROR_LEVEL_MAPPED_TYPE = {
|
||||
[index in ErrorCorrectionLevel]: Ecc;
|
||||
};
|
||||
export type ImageSettings = {
|
||||
/**
|
||||
* The URI of the embedded image.
|
||||
*/
|
||||
src: string;
|
||||
/**
|
||||
* The height, in pixels, of the image.
|
||||
*/
|
||||
height: number;
|
||||
/**
|
||||
* The width, in pixels, of the image.
|
||||
*/
|
||||
width: number;
|
||||
/**
|
||||
* Whether or not to "excavate" the modules around the embedded image. This
|
||||
* means that any modules the embedded image overlaps will use the background
|
||||
* color.
|
||||
*/
|
||||
excavate: boolean;
|
||||
/**
|
||||
* The horiztonal offset of the embedded image, starting from the top left corner.
|
||||
* Will center if not specified.
|
||||
*/
|
||||
x?: number;
|
||||
/**
|
||||
* The vertical offset of the embedded image, starting from the top left corner.
|
||||
* Will center if not specified.
|
||||
*/
|
||||
y?: number;
|
||||
/**
|
||||
* The opacity of the embedded image in the range of 0-1.
|
||||
* @defaultValue 1
|
||||
*/
|
||||
opacity?: number;
|
||||
/**
|
||||
* The cross-origin value to use when loading the image. This is used to
|
||||
* ensure compatibility with CORS, particularly when extracting image data
|
||||
* from QRCodeCanvas.
|
||||
* Note: `undefined` is treated differently than the seemingly equivalent
|
||||
* empty string. This is intended to align with HTML behavior where omitting
|
||||
* the attribute behaves differently than the empty string.
|
||||
*/
|
||||
crossOrigin?: CrossOrigin;
|
||||
};
|
||||
export type QRProps = {
|
||||
/**
|
||||
* The value to encode into the QR Code. An array of strings can be passed in
|
||||
* to represent multiple segments to further optimize the QR Code.
|
||||
*/
|
||||
value: string | string[];
|
||||
/**
|
||||
* If enabled, the Error Correction Level of the result may be higher than
|
||||
* the specified Error Correction Level option if it can be done without
|
||||
* increasing the version.
|
||||
* @defaultValue true
|
||||
*/
|
||||
boostLevel?: boolean;
|
||||
/**
|
||||
* The size, in pixels, to render the QR Code.
|
||||
* @defaultValue 128
|
||||
*/
|
||||
size?: number;
|
||||
/**
|
||||
* The Error Correction Level to use.
|
||||
* @see https://www.qrcode.com/en/about/error_correction.html
|
||||
* @defaultValue L
|
||||
*/
|
||||
level?: ErrorCorrectionLevel;
|
||||
/**
|
||||
* The background color used to render the QR Code.
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
|
||||
* @defaultValue #FFFFFF
|
||||
*/
|
||||
bgColor?: string;
|
||||
/**
|
||||
* The foregtound color used to render the QR Code.
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
|
||||
* @defaultValue #000000
|
||||
*/
|
||||
fgColor?: string;
|
||||
/**
|
||||
* The style to apply to the QR Code.
|
||||
*/
|
||||
style?: React.CSSProperties;
|
||||
/**
|
||||
* Whether or not a margin of 4 modules should be rendered as a part of the
|
||||
* QR Code.
|
||||
* @deprecated Use `marginSize` instead.
|
||||
* @defaultValue false
|
||||
*/
|
||||
includeMargin?: boolean;
|
||||
/**
|
||||
* The number of _modules_ to use for margin. The QR Code specification
|
||||
* requires `4`, however you can specify any number. Values will be turned to
|
||||
* integers with `Math.floor`. Overrides `includeMargin` when both are specified.
|
||||
* @defaultValue 0
|
||||
*/
|
||||
marginSize?: number;
|
||||
/**
|
||||
* The settings for the embedded image.
|
||||
*/
|
||||
imageSettings?: ImageSettings;
|
||||
/**
|
||||
* The title to assign to the QR Code. Used for accessibility reasons.
|
||||
*/
|
||||
title?: string;
|
||||
/**
|
||||
* The minimum version used when encoding the QR Code. Valid values are 1-40
|
||||
* with higher values resulting in more complex QR Codes. The optimal
|
||||
* (lowest) version is determined for the `value` provided, using `minVersion`
|
||||
* as the lower bound.
|
||||
* @defaultValue 1
|
||||
*/
|
||||
minVersion?: number;
|
||||
};
|
||||
export type QRPropsCanvas = QRProps & React.CanvasHTMLAttributes<HTMLCanvasElement>;
|
||||
export type QRPropsSVG = QRProps & React.SVGAttributes<SVGSVGElement>;
|
||||
5
frontend/node_modules/@rc-component/qrcode/lib/interface.js
generated
vendored
Normal file
5
frontend/node_modules/@rc-component/qrcode/lib/interface.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
80
frontend/node_modules/@rc-component/qrcode/lib/libs/qrcodegen.d.ts
generated
vendored
Normal file
80
frontend/node_modules/@rc-component/qrcode/lib/libs/qrcodegen.d.ts
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
export declare class Mode {
|
||||
static readonly NUMERIC: Mode;
|
||||
static readonly ALPHANUMERIC: Mode;
|
||||
static readonly BYTE: Mode;
|
||||
static readonly KANJI: Mode;
|
||||
static readonly ECI: Mode;
|
||||
modeBits: number;
|
||||
private numBitsCharCount;
|
||||
private constructor();
|
||||
numCharCountBits(ver: number): number;
|
||||
}
|
||||
export declare class Ecc {
|
||||
static readonly LOW: Ecc;
|
||||
static readonly MEDIUM: Ecc;
|
||||
static readonly QUARTILE: Ecc;
|
||||
static readonly HIGH: Ecc;
|
||||
ordinal: number;
|
||||
formatBits: number;
|
||||
private constructor();
|
||||
}
|
||||
export declare class QrSegment {
|
||||
static makeBytes(data: Readonly<number[]>): QrSegment;
|
||||
static makeNumeric(digits: string): QrSegment;
|
||||
static makeAlphanumeric(text: string): QrSegment;
|
||||
static makeSegments(text: string): QrSegment[];
|
||||
static makeEci(assignVal: number): QrSegment;
|
||||
static isNumeric(text: string): boolean;
|
||||
static isAlphanumeric(text: string): boolean;
|
||||
mode: Mode;
|
||||
numChars: number;
|
||||
private bitData;
|
||||
constructor(mode: Mode, numChars: number, bitData: number[]);
|
||||
getData(): number[];
|
||||
static getTotalBits(segs: Readonly<QrSegment[]>, version: number): number;
|
||||
private static toUtf8ByteArray;
|
||||
private static readonly NUMERIC_REGEX;
|
||||
private static readonly ALPHANUMERIC_REGEX;
|
||||
private static readonly ALPHANUMERIC_CHARSET;
|
||||
}
|
||||
export declare class QrCode {
|
||||
static encodeText(text: string, ecl: Ecc): QrCode;
|
||||
static encodeBinary(data: Readonly<number[]>, ecl: Ecc): QrCode;
|
||||
static encodeSegments(segs: Readonly<QrSegment[]>, oriEcl: Ecc, minVersion?: number, maxVersion?: number, mask?: number, boostEcl?: boolean): QrCode;
|
||||
readonly size: number;
|
||||
readonly mask: number;
|
||||
private readonly modules;
|
||||
private readonly isFunction;
|
||||
version: number;
|
||||
errorCorrectionLevel: Ecc;
|
||||
constructor(version: number, errorCorrectionLevel: Ecc, dataCodewords: Readonly<number[]>, oriMsk: number);
|
||||
getModule(x: number, y: number): boolean;
|
||||
getModules(): boolean[][];
|
||||
private drawFunctionPatterns;
|
||||
private drawFormatBits;
|
||||
private drawVersion;
|
||||
private drawFinderPattern;
|
||||
private drawAlignmentPattern;
|
||||
private setFunctionModule;
|
||||
private addEccAndInterleave;
|
||||
private drawCodewords;
|
||||
private applyMask;
|
||||
private getPenaltyScore;
|
||||
private getAlignmentPatternPositions;
|
||||
private static getNumRawDataModules;
|
||||
private static getNumDataCodewords;
|
||||
private static reedSolomonComputeDivisor;
|
||||
private static reedSolomonComputeRemainder;
|
||||
private static reedSolomonMultiply;
|
||||
private finderPenaltyCountPatterns;
|
||||
private finderPenaltyTerminateAndCount;
|
||||
private finderPenaltyAddHistory;
|
||||
static readonly MIN_VERSION: number;
|
||||
static readonly MAX_VERSION: number;
|
||||
private static readonly PENALTY_N1;
|
||||
private static readonly PENALTY_N2;
|
||||
private static readonly PENALTY_N3;
|
||||
private static readonly PENALTY_N4;
|
||||
private static readonly ECC_CODEWORDS_PER_BLOCK;
|
||||
private static readonly NUM_ERROR_CORRECTION_BLOCKS;
|
||||
}
|
||||
1119
frontend/node_modules/@rc-component/qrcode/lib/libs/qrcodegen.js
generated
vendored
Normal file
1119
frontend/node_modules/@rc-component/qrcode/lib/libs/qrcodegen.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
53
frontend/node_modules/@rc-component/qrcode/lib/utils.d.ts
generated
vendored
Normal file
53
frontend/node_modules/@rc-component/qrcode/lib/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
import type { CrossOrigin, ERROR_LEVEL_MAPPED_TYPE, ErrorCorrectionLevel, Excavation, ImageSettings } from './interface';
|
||||
export declare const ERROR_LEVEL_MAP: ERROR_LEVEL_MAPPED_TYPE;
|
||||
export declare const DEFAULT_SIZE = 128;
|
||||
export declare const DEFAULT_LEVEL: ErrorCorrectionLevel;
|
||||
export declare const DEFAULT_BACKGROUND_COLOR = "#FFFFFF";
|
||||
export declare const DEFAULT_FRONT_COLOR = "#000000";
|
||||
export declare const DEFAULT_NEED_MARGIN = false;
|
||||
export declare const DEFAULT_MINVERSION = 1;
|
||||
export declare const SPEC_MARGIN_SIZE = 4;
|
||||
export declare const DEFAULT_MARGIN_SIZE = 0;
|
||||
export declare const DEFAULT_IMG_SCALE = 0.1;
|
||||
/**
|
||||
* Generate a path string from modules
|
||||
* @param modules
|
||||
* @param margin
|
||||
* @returns
|
||||
*/
|
||||
export declare const generatePath: (modules: boolean[][], margin?: number) => string;
|
||||
/**
|
||||
* Excavate modules
|
||||
* @param modules
|
||||
* @param excavation
|
||||
* @returns
|
||||
*/
|
||||
export declare const excavateModules: (modules: boolean[][], excavation: Excavation) => boolean[][];
|
||||
/**
|
||||
* Get image settings
|
||||
* @param cells The modules of the QR code
|
||||
* @param size The size of the QR code
|
||||
* @param margin
|
||||
* @param imageSettings
|
||||
* @returns
|
||||
*/
|
||||
export declare const getImageSettings: (cells: boolean[][], size: number, margin: number, imageSettings?: ImageSettings) => {
|
||||
x: number;
|
||||
y: number;
|
||||
h: number;
|
||||
w: number;
|
||||
excavation: Excavation | null;
|
||||
opacity: number;
|
||||
crossOrigin: CrossOrigin;
|
||||
};
|
||||
/**
|
||||
* Get margin size
|
||||
* @param needMargin Whether need margin
|
||||
* @param marginSize Custom margin size
|
||||
* @returns
|
||||
*/
|
||||
export declare const getMarginSize: (needMargin: boolean, marginSize?: number) => number;
|
||||
/**
|
||||
* Check if Path2D is supported
|
||||
*/
|
||||
export declare const isSupportPath2d: boolean;
|
||||
157
frontend/node_modules/@rc-component/qrcode/lib/utils.js
generated
vendored
Normal file
157
frontend/node_modules/@rc-component/qrcode/lib/utils.js
generated
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.isSupportPath2d = exports.getMarginSize = exports.getImageSettings = exports.generatePath = exports.excavateModules = exports.SPEC_MARGIN_SIZE = exports.ERROR_LEVEL_MAP = exports.DEFAULT_SIZE = exports.DEFAULT_NEED_MARGIN = exports.DEFAULT_MINVERSION = exports.DEFAULT_MARGIN_SIZE = exports.DEFAULT_LEVEL = exports.DEFAULT_IMG_SCALE = exports.DEFAULT_FRONT_COLOR = exports.DEFAULT_BACKGROUND_COLOR = void 0;
|
||||
var _qrcodegen = require("./libs/qrcodegen");
|
||||
// Part logic is from `qrcode.react`. (ISC License)
|
||||
// https://github.com/zpao/qrcode.react
|
||||
|
||||
// ==========================================================
|
||||
|
||||
// =================== ERROR_LEVEL ==========================
|
||||
var ERROR_LEVEL_MAP = exports.ERROR_LEVEL_MAP = {
|
||||
L: _qrcodegen.Ecc.LOW,
|
||||
M: _qrcodegen.Ecc.MEDIUM,
|
||||
Q: _qrcodegen.Ecc.QUARTILE,
|
||||
H: _qrcodegen.Ecc.HIGH
|
||||
};
|
||||
|
||||
// =================== DEFAULT_VALUE ==========================
|
||||
var DEFAULT_SIZE = exports.DEFAULT_SIZE = 128;
|
||||
var DEFAULT_LEVEL = exports.DEFAULT_LEVEL = 'L';
|
||||
var DEFAULT_BACKGROUND_COLOR = exports.DEFAULT_BACKGROUND_COLOR = '#FFFFFF';
|
||||
var DEFAULT_FRONT_COLOR = exports.DEFAULT_FRONT_COLOR = '#000000';
|
||||
var DEFAULT_NEED_MARGIN = exports.DEFAULT_NEED_MARGIN = false;
|
||||
var DEFAULT_MINVERSION = exports.DEFAULT_MINVERSION = 1;
|
||||
var SPEC_MARGIN_SIZE = exports.SPEC_MARGIN_SIZE = 4;
|
||||
var DEFAULT_MARGIN_SIZE = exports.DEFAULT_MARGIN_SIZE = 0;
|
||||
var DEFAULT_IMG_SCALE = exports.DEFAULT_IMG_SCALE = 0.1;
|
||||
|
||||
// =================== UTILS ==========================
|
||||
/**
|
||||
* Generate a path string from modules
|
||||
* @param modules
|
||||
* @param margin
|
||||
* @returns
|
||||
*/
|
||||
var generatePath = exports.generatePath = function generatePath(modules) {
|
||||
var margin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
||||
var ops = [];
|
||||
modules.forEach(function (row, y) {
|
||||
var start = null;
|
||||
row.forEach(function (cell, x) {
|
||||
if (!cell && start !== null) {
|
||||
ops.push("M".concat(start + margin, " ").concat(y + margin, "h").concat(x - start, "v1H").concat(start + margin, "z"));
|
||||
start = null;
|
||||
return;
|
||||
}
|
||||
if (x === row.length - 1) {
|
||||
if (!cell) {
|
||||
return;
|
||||
}
|
||||
if (start === null) {
|
||||
ops.push("M".concat(x + margin, ",").concat(y + margin, " h1v1H").concat(x + margin, "z"));
|
||||
} else {
|
||||
ops.push("M".concat(start + margin, ",").concat(y + margin, " h").concat(x + 1 - start, "v1H").concat(start + margin, "z"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (cell && start === null) {
|
||||
start = x;
|
||||
}
|
||||
});
|
||||
});
|
||||
return ops.join('');
|
||||
};
|
||||
|
||||
/**
|
||||
* Excavate modules
|
||||
* @param modules
|
||||
* @param excavation
|
||||
* @returns
|
||||
*/
|
||||
var excavateModules = exports.excavateModules = function excavateModules(modules, excavation) {
|
||||
return modules.slice().map(function (row, y) {
|
||||
if (y < excavation.y || y >= excavation.y + excavation.h) {
|
||||
return row;
|
||||
}
|
||||
return row.map(function (cell, x) {
|
||||
if (x < excavation.x || x >= excavation.x + excavation.w) {
|
||||
return cell;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Get image settings
|
||||
* @param cells The modules of the QR code
|
||||
* @param size The size of the QR code
|
||||
* @param margin
|
||||
* @param imageSettings
|
||||
* @returns
|
||||
*/
|
||||
var getImageSettings = exports.getImageSettings = function getImageSettings(cells, size, margin, imageSettings) {
|
||||
if (imageSettings == null) {
|
||||
return null;
|
||||
}
|
||||
var numCells = cells.length + margin * 2;
|
||||
var defaultSize = Math.floor(size * DEFAULT_IMG_SCALE);
|
||||
var scale = numCells / size;
|
||||
var w = (imageSettings.width || defaultSize) * scale;
|
||||
var h = (imageSettings.height || defaultSize) * scale;
|
||||
var x = imageSettings.x == null ? cells.length / 2 - w / 2 : imageSettings.x * scale;
|
||||
var y = imageSettings.y == null ? cells.length / 2 - h / 2 : imageSettings.y * scale;
|
||||
var opacity = imageSettings.opacity == null ? 1 : imageSettings.opacity;
|
||||
var excavation = null;
|
||||
if (imageSettings.excavate) {
|
||||
var floorX = Math.floor(x);
|
||||
var floorY = Math.floor(y);
|
||||
var ceilW = Math.ceil(w + x - floorX);
|
||||
var ceilH = Math.ceil(h + y - floorY);
|
||||
excavation = {
|
||||
x: floorX,
|
||||
y: floorY,
|
||||
w: ceilW,
|
||||
h: ceilH
|
||||
};
|
||||
}
|
||||
var crossOrigin = imageSettings.crossOrigin;
|
||||
return {
|
||||
x: x,
|
||||
y: y,
|
||||
h: h,
|
||||
w: w,
|
||||
excavation: excavation,
|
||||
opacity: opacity,
|
||||
crossOrigin: crossOrigin
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Get margin size
|
||||
* @param needMargin Whether need margin
|
||||
* @param marginSize Custom margin size
|
||||
* @returns
|
||||
*/
|
||||
var getMarginSize = exports.getMarginSize = function getMarginSize(needMargin, marginSize) {
|
||||
if (marginSize != null) {
|
||||
return Math.max(Math.floor(marginSize), 0);
|
||||
}
|
||||
return needMargin ? SPEC_MARGIN_SIZE : DEFAULT_MARGIN_SIZE;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if Path2D is supported
|
||||
*/
|
||||
var isSupportPath2d = exports.isSupportPath2d = function () {
|
||||
try {
|
||||
new Path2D().addPath(new Path2D());
|
||||
} catch (_unused) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}();
|
||||
72
frontend/node_modules/@rc-component/qrcode/package.json
generated
vendored
Normal file
72
frontend/node_modules/@rc-component/qrcode/package.json
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"name": "@rc-component/qrcode",
|
||||
"version": "1.1.1",
|
||||
"description": "base abstract trigger component for react",
|
||||
"engines": {
|
||||
"node": ">=8.x"
|
||||
},
|
||||
"keywords": [
|
||||
"react",
|
||||
"react-component",
|
||||
"react-qrcode",
|
||||
"qrcode"
|
||||
],
|
||||
"homepage": "https://github.com/react-component/qrcode",
|
||||
"author": "",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/react-component/qrcode.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/react-component/qrcode/issues"
|
||||
},
|
||||
"files": [
|
||||
"es",
|
||||
"lib",
|
||||
"assets/**/*.css",
|
||||
"assets/**/*.less"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./lib/index",
|
||||
"module": "./es/index",
|
||||
"scripts": {
|
||||
"start": "dumi dev",
|
||||
"build": "dumi build",
|
||||
"compile": "father build && lessc assets/index.less assets/index.css",
|
||||
"prepublishOnly": "npm run compile && rc-np",
|
||||
"lint": "eslint src/ docs/examples/ --ext .tsx,.ts,.jsx,.js",
|
||||
"test": "rc-test",
|
||||
"coverage": "rc-test --coverage",
|
||||
"now-build": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.24.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ant-design/tools": "^18.0.2",
|
||||
"@rc-component/father-plugin": "^1.0.0",
|
||||
"@rc-component/np": "^1.0.0",
|
||||
"@testing-library/jest-dom": "^6.1.4",
|
||||
"@testing-library/react": "^16.0.0",
|
||||
"@types/jest": "^30.0.0",
|
||||
"@types/node": "^24.7.1",
|
||||
"@types/react": "^19.1.0",
|
||||
"@types/react-dom": "^19.1.1",
|
||||
"@umijs/fabric": "^4.0.1",
|
||||
"dumi": "^2.1.0",
|
||||
"eslint": "^8.51.0",
|
||||
"father": "^4.0.0",
|
||||
"jest-canvas-mock": "^2.5.2",
|
||||
"less": "^4.2.0",
|
||||
"rc-test": "^7.0.13",
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0",
|
||||
"ts-jest": "^29.1.4",
|
||||
"typescript": "^5.1.6"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16.9.0",
|
||||
"react-dom": ">=16.9.0"
|
||||
},
|
||||
"packageManager": "pnpm@9.8.0+sha512.8e4c3550fb500e808dbc30bb0ce4dd1eb614e30b1c55245f211591ec2cdf9c611cabd34e1364b42f564bd54b3945ed0f49d61d1bbf2ec9bd74b866fcdc723276"
|
||||
}
|
||||
Reference in New Issue
Block a user