mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2024-12-25 00:11:36 +01:00
Merge branch 'fix-pdfmake' into 'dev'
Fix pdfmake. See merge request turris/reforis/foris-js!105
This commit is contained in:
commit
27a5e62d9a
8578
package-lock.json
generated
8578
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
27
package.json
27
package.json
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "foris",
|
"name": "foris",
|
||||||
"version": "4.4.0",
|
"version": "4.5.0",
|
||||||
"description": "Set of components and utils for Foris and its plugins.",
|
"description": "Set of components and utils for Foris and its plugins.",
|
||||||
"author": "CZ.NIC, z.s.p.o.",
|
"author": "CZ.NIC, z.s.p.o.",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -14,10 +14,9 @@
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"main": "./src/index.js",
|
"main": "./src/index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.19.1",
|
"axios": "^0.19.2",
|
||||||
"immutability-helper": "3.0.1",
|
"immutability-helper": "3.0.1",
|
||||||
"moment": "^2.24.0",
|
"moment": "^2.24.0",
|
||||||
"pdfmake": "^0.1.63",
|
|
||||||
"qrcode.react": "^0.9.3",
|
"qrcode.react": "^0.9.3",
|
||||||
"react-datetime": "^2.16.3",
|
"react-datetime": "^2.16.3",
|
||||||
"react-uid": "^2.2.0"
|
"react-uid": "^2.2.0"
|
||||||
|
@ -30,26 +29,26 @@
|
||||||
"react-router-dom": "^5.1.2"
|
"react-router-dom": "^5.1.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/cli": "^7.7.7",
|
"@babel/cli": "^7.8.4",
|
||||||
"@babel/core": "^7.7.7",
|
"@babel/core": "^7.9.0",
|
||||||
"@babel/plugin-transform-runtime": "^7.7.6",
|
"@babel/plugin-transform-runtime": "^7.9.0",
|
||||||
"@babel/preset-env": "^7.7.7",
|
"@babel/preset-env": "^7.9.0",
|
||||||
"@babel/preset-react": "^7.7.4",
|
"@babel/preset-react": "^7.9.4",
|
||||||
"@fortawesome/fontawesome-free": "^5.12.0",
|
"@fortawesome/fontawesome-free": "^5.13.0",
|
||||||
"@testing-library/react": "^8.0.9",
|
"@testing-library/react": "^8.0.9",
|
||||||
"babel-loader": "^8.0.6",
|
"babel-loader": "^8.1.0",
|
||||||
"babel-polyfill": "^6.26.0",
|
"babel-polyfill": "^6.26.0",
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
"eslint-config-reforis": "^1.0.0",
|
"eslint-config-reforis": "^1.0.0",
|
||||||
"jest": "^25.1.0",
|
"jest": "^25.2.0",
|
||||||
"jest-mock-axios": "^3.2.0",
|
"jest-mock-axios": "^3.2.0",
|
||||||
"moment-timezone": "^0.5.27",
|
"moment-timezone": "^0.5.28",
|
||||||
"prop-types": "15.7.2",
|
"prop-types": "15.7.2",
|
||||||
"react": "16.9.0",
|
"react": "16.9.0",
|
||||||
"react-dom": "16.9.0",
|
"react-dom": "16.9.0",
|
||||||
"react-router-dom": "^5.1.2",
|
"react-router-dom": "^5.1.2",
|
||||||
"react-styleguidist": "^10.4.2",
|
"react-styleguidist": "^10.6.2",
|
||||||
"snapshot-diff": "^0.5.1"
|
"snapshot-diff": "^0.7.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint src",
|
"lint": "eslint src",
|
||||||
|
|
|
@ -5,22 +5,36 @@
|
||||||
* See /LICENSE for more information.
|
* See /LICENSE for more information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import pdfMake from "pdfmake";
|
|
||||||
|
|
||||||
export function createAndDownloadPdf(SSID, password) {
|
export function createAndDownloadPdf(SSID, password) {
|
||||||
const docDefinition = {
|
const docDefinition = {
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
text: "Wi-Fi", style: "header", fontSize: 55, alignment: "center",
|
text: "Wi-Fi",
|
||||||
|
style: "header",
|
||||||
|
fontSize: 55,
|
||||||
|
alignment: "center",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
qr: toQRCodeContent(SSID, password), fit: "350", margin: [0, 80], alignment: "center",
|
qr: toQRCodeContent(SSID, password),
|
||||||
|
fit: "350",
|
||||||
|
margin: [0, 80],
|
||||||
|
alignment: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: `SSID: ${SSID}`,
|
||||||
|
fontSize: 25,
|
||||||
|
alignment: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: `Password: ${password}`,
|
||||||
|
fontSize: 25,
|
||||||
|
alignment: "center",
|
||||||
},
|
},
|
||||||
{ text: `SSID: ${SSID}`, fontSize: 25, alignment: "center" },
|
|
||||||
{ text: `Password: ${password}`, fontSize: 25, alignment: "center" },
|
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
pdfMake.createPdf(docDefinition).download("wifi.pdf");
|
|
||||||
|
// pdfmake is exposed by reForis main application. Thus we can use it from globals.
|
||||||
|
window.pdfMake.createPdf(docDefinition).download("wifi.pdf");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toQRCodeContent(SSID, password) {
|
export function toQRCodeContent(SSID, password) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user