version: v4.9.6

This commit is contained in:
XiaoDaiGua-Ray 2024-09-27 15:59:01 +08:00
parent d12fcd18b6
commit 7394e0bf30
6 changed files with 236 additions and 209 deletions

View File

@ -1,5 +1,23 @@
# CHANGE LOG
## 4.9.6
由于 `cdn` 厂商更新 `cdn` 资源太慢的缘故,所以目前 `vue` 的版本只有 `3.5.3` 会导致构建线上生产环境报错的问题。
## Feats
- 更新 `vue` 版本至 `3.5.8`
- `useDomToImage` 相关
- 使用 `html-to-image` 替换 `dom-to-image` 底层依赖库
- 同步补全 `html-to-image` 所有新特性至该方法
- 同步修改 `printDom` 方法
- 类型提示现在会更加友好,`create` 方法会根据 `imageType` 自动推导转换结果的类型
- 移除 `DomToImageResult` 类型
## Fixes
- 修复 `RCollapseGrid` 组件折叠失败的问题
## 4.9.5
天元突破,红莲螺岩。

View File

@ -1,7 +1,7 @@
{
"name": "ray-template",
"private": false,
"version": "4.9.5",
"version": "4.9.6",
"type": "module",
"engines": {
"node": "^18.0.0 || >=20.0.0",
@ -38,8 +38,8 @@
"clipboard": "^2.0.11",
"currency.js": "^2.0.4",
"dayjs": "^1.11.10",
"dom-to-image": "2.6.0",
"echarts": "^5.5.0",
"html-to-image": "1.11.11",
"interactjs": "1.10.26",
"jsbarcode": "3.11.6",
"lodash-es": "^4.17.21",
@ -48,7 +48,7 @@
"pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^4.0.1",
"print-js": "^1.6.0",
"vue": "^3.5.6",
"vue": "^3.5.8",
"vue-demi": "0.14.6",
"vue-hooks-plus": "2.2.1",
"vue-i18n": "^9.13.1",

292
pnpm-lock.yaml generated
View File

@ -7,7 +7,7 @@ settings:
dependencies:
'@vueuse/core':
specifier: ^10.9.0
version: 10.9.0(vue@3.5.6)
version: 10.9.0(vue@3.5.8)
axios:
specifier: ^1.7.5
version: 1.7.5
@ -20,12 +20,12 @@ dependencies:
dayjs:
specifier: ^1.11.10
version: 1.11.10
dom-to-image:
specifier: 2.6.0
version: 2.6.0
echarts:
specifier: ^5.5.0
version: 5.5.0
html-to-image:
specifier: 1.11.11
version: 1.11.11
interactjs:
specifier: 1.10.26
version: 1.10.26
@ -40,10 +40,10 @@ dependencies:
version: 1.1.0
naive-ui:
specifier: ^2.39.0
version: 2.39.0(vue@3.5.6)
version: 2.39.0(vue@3.5.8)
pinia:
specifier: ^2.1.7
version: 2.1.7(typescript@5.2.2)(vue@3.5.6)
version: 2.1.7(typescript@5.2.2)(vue@3.5.8)
pinia-plugin-persistedstate:
specifier: ^4.0.1
version: 4.0.1(pinia@2.1.7)
@ -51,20 +51,20 @@ dependencies:
specifier: ^1.6.0
version: 1.6.0
vue:
specifier: ^3.5.6
version: 3.5.6(typescript@5.2.2)
specifier: ^3.5.8
version: 3.5.8(typescript@5.2.2)
vue-demi:
specifier: 0.14.6
version: 0.14.6(vue@3.5.6)
version: 0.14.6(vue@3.5.8)
vue-hooks-plus:
specifier: 2.2.1
version: 2.2.1(vue@3.5.6)
version: 2.2.1(vue@3.5.8)
vue-i18n:
specifier: ^9.13.1
version: 9.13.1(vue@3.5.6)
version: 9.13.1(vue@3.5.8)
vue-router:
specifier: ^4.3.2
version: 4.3.2(vue@3.5.6)
version: 4.3.2(vue@3.5.8)
vue3-next-qrcode:
specifier: 2.0.10
version: 2.0.10(typescript@5.2.2)
@ -105,10 +105,10 @@ devDependencies:
version: 6.21.0(eslint@8.57.0)(typescript@5.2.2)
'@vitejs/plugin-vue':
specifier: ^5.1.0
version: 5.1.0(vite@5.4.3)(vue@3.5.6)
version: 5.1.0(vite@5.4.3)(vue@3.5.8)
'@vitejs/plugin-vue-jsx':
specifier: ^4.0.0
version: 4.0.0(vite@5.4.3)(vue@3.5.6)
version: 4.0.0(vite@5.4.3)(vue@3.5.8)
'@vitest/ui':
specifier: 1.4.0
version: 1.4.0(vitest@1.5.2)
@ -120,7 +120,7 @@ devDependencies:
version: 12.0.0(eslint-plugin-vue@9.25.0)(eslint@8.57.0)(typescript@5.2.2)
'@vue/test-utils':
specifier: 2.4.3
version: 2.4.3(vue@3.5.6)
version: 2.4.3(vue@3.5.8)
autoprefixer:
specifier: ^10.4.16
version: 10.4.16(postcss@8.4.38)
@ -135,7 +135,7 @@ devDependencies:
version: 9.1.0(eslint@8.57.0)
eslint-config-standard-with-typescript:
specifier: ^43.0.0
version: 43.0.0(@typescript-eslint/eslint-plugin@6.21.0)(eslint-plugin-import@2.29.1)(eslint-plugin-n@16.6.2)(eslint-plugin-promise@6.1.1)(eslint@8.57.0)(typescript@5.2.2)
version: 43.0.0(@typescript-eslint/eslint-plugin@6.21.0)(eslint-plugin-import@2.30.0)(eslint-plugin-n@16.6.2)(eslint-plugin-promise@6.1.1)(eslint@8.57.0)(typescript@5.2.2)
eslint-plugin-prettier:
specifier: ^5.1.3
version: 5.1.3(eslint-config-prettier@9.1.0)(eslint@8.57.0)(prettier@3.2.5)
@ -177,7 +177,7 @@ devDependencies:
version: 0.18.2(@vueuse/core@10.9.0)
unplugin-vue-components:
specifier: ^0.27.4
version: 0.27.4(vue@3.5.6)
version: 0.27.4(vue@3.5.8)
vite:
specifier: ^5.4.3
version: 5.4.3(@types/node@20.5.1)(sass@1.71.1)
@ -843,12 +843,12 @@ packages:
css-render: 0.15.14
dev: false
/@css-render/vue3-ssr@0.15.14(vue@3.5.6):
/@css-render/vue3-ssr@0.15.14(vue@3.5.8):
resolution: {integrity: sha512-//8027GSbxE9n3QlD73xFY6z4ZbHbvrOVB7AO6hsmrEzGbg+h2A09HboUyDgu+xsmj7JnvJD39Irt+2D0+iV8g==}
peerDependencies:
vue: ^3.0.11
dependencies:
vue: 3.5.6(typescript@5.2.2)
vue: 3.5.8(typescript@5.2.2)
dev: false
/@emotion/hash@0.8.0:
@ -1284,6 +1284,11 @@ packages:
engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}
dev: true
/@eslint-community/regexpp@4.11.1:
resolution: {integrity: sha512-m4DVN9ZqskZoLU5GlWZadwDnYo3vAEydiUayB9widCl9ffWx2IvPnp6n3on5rJmziJSw9Bv+Z3ChDVdMwXCY8Q==}
engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}
dev: true
/@eslint/eslintrc@2.1.4:
resolution: {integrity: sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
@ -1354,7 +1359,7 @@ packages:
jsonc-eslint-parser: 2.4.0
mlly: 1.6.1
source-map-js: 1.2.0
vue-i18n: 9.13.1(vue@3.5.6)
vue-i18n: 9.13.1(vue@3.5.8)
yaml-eslint-parser: 1.2.2
dev: true
@ -1403,7 +1408,7 @@ packages:
picocolors: 1.0.1
source-map-js: 1.2.0
unplugin: 1.10.1
vue-i18n: 9.13.1(vue@3.5.6)
vue-i18n: 9.13.1(vue@3.5.8)
transitivePeerDependencies:
- rollup
- supports-color
@ -1710,6 +1715,10 @@ packages:
dev: true
optional: true
/@rtsao/scc@1.1.0:
resolution: {integrity: sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==}
dev: true
/@sinclair/typebox@0.27.8:
resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==}
dev: true
@ -1971,7 +1980,7 @@ packages:
resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==}
dev: true
/@vitejs/plugin-vue-jsx@4.0.0(vite@5.4.3)(vue@3.5.6):
/@vitejs/plugin-vue-jsx@4.0.0(vite@5.4.3)(vue@3.5.8):
resolution: {integrity: sha512-A+6wL2AdQhDsLsDnY+2v4rRDI1HLJGIMc97a8FURO9tqKsH5QvjWrzsa5DH3NlZsM742W2wODl2fF+bfcTWtXw==}
engines: {node: ^18.0.0 || >=20.0.0}
peerDependencies:
@ -1982,12 +1991,12 @@ packages:
'@babel/plugin-transform-typescript': 7.24.8(@babel/core@7.24.7)
'@vue/babel-plugin-jsx': 1.2.2(@babel/core@7.24.7)
vite: 5.4.3(@types/node@20.5.1)(sass@1.71.1)
vue: 3.5.6(typescript@5.2.2)
vue: 3.5.8(typescript@5.2.2)
transitivePeerDependencies:
- supports-color
dev: true
/@vitejs/plugin-vue@5.1.0(vite@5.4.3)(vue@3.5.6):
/@vitejs/plugin-vue@5.1.0(vite@5.4.3)(vue@3.5.8):
resolution: {integrity: sha512-QMRxARyrdiwi1mj3AW4fLByoHTavreXq0itdEW696EihXglf1MB3D4C2gBvE0jMPH29ZjC3iK8aIaUMLf4EOGA==}
engines: {node: ^18.0.0 || >=20.0.0}
peerDependencies:
@ -1995,7 +2004,7 @@ packages:
vue: ^3.2.25
dependencies:
vite: 5.4.3(@types/node@20.5.1)(sass@1.71.1)
vue: 3.5.6(typescript@5.2.2)
vue: 3.5.8(typescript@5.2.2)
dev: true
/@vitest/expect@1.5.2:
@ -2151,14 +2160,14 @@ packages:
source-map-js: 1.2.0
dev: true
/@vue/compiler-core@3.5.6:
resolution: {integrity: sha512-r+gNu6K4lrvaQLQGmf+1gc41p3FO2OUJyWmNqaIITaJU6YFiV5PtQSFZt8jfztYyARwqhoCayjprC7KMvT3nRA==}
/@vue/compiler-core@3.5.8:
resolution: {integrity: sha512-Uzlxp91EPjfbpeO5KtC0KnXPkuTfGsNDeaKQJxQN718uz+RqDYarEf7UhQJGK+ZYloD2taUbHTI2J4WrUaZQNA==}
dependencies:
'@babel/parser': 7.25.3
'@vue/shared': 3.5.6
'@vue/shared': 3.5.8
entities: 4.5.0
estree-walker: 2.0.2
source-map-js: 1.2.0
source-map-js: 1.2.1
/@vue/compiler-dom@3.4.21:
resolution: {integrity: sha512-IZC6FKowtT1sl0CR5DpXSiEB5ayw75oT2bma1BEhV7RRR1+cfwLrxc2Z8Zq/RGFzJ8w5r9QtCOvTjQgdn0IKmA==}
@ -2181,11 +2190,11 @@ packages:
'@vue/shared': 3.4.36
dev: true
/@vue/compiler-dom@3.5.6:
resolution: {integrity: sha512-xRXqxDrIqK8v8sSScpistyYH0qYqxakpsIvqMD2e5sV/PXQ1mTwtXp4k42yHK06KXxKSmitop9e45Ui/3BrTEw==}
/@vue/compiler-dom@3.5.8:
resolution: {integrity: sha512-GUNHWvoDSbSa5ZSHT9SnV5WkStWfzJwwTd6NMGzilOE/HM5j+9EB9zGXdtu/fCNEmctBqMs6C9SvVPpVPuk1Eg==}
dependencies:
'@vue/compiler-core': 3.5.6
'@vue/shared': 3.5.6
'@vue/compiler-core': 3.5.8
'@vue/shared': 3.5.8
/@vue/compiler-sfc@3.4.21:
resolution: {integrity: sha512-me7epoTxYlY+2CUM7hy9PCDdpMPfIwrOvAXud2Upk10g4YLv9UBW7kL798TvMeDhPthkZ0CONNrK2GoeI1ODiQ==}
@ -2229,18 +2238,18 @@ packages:
source-map-js: 1.2.0
dev: true
/@vue/compiler-sfc@3.5.6:
resolution: {integrity: sha512-pjWJ8Kj9TDHlbF5LywjVso+BIxCY5wVOLhkEXRhuCHDxPFIeX1zaFefKs8RYoHvkSMqRWt93a0f2gNJVJixHwg==}
/@vue/compiler-sfc@3.5.8:
resolution: {integrity: sha512-taYpngQtSysrvO9GULaOSwcG5q821zCoIQBtQQSx7Uf7DxpR6CIHR90toPr9QfDD2mqHQPCSgoWBvJu0yV9zjg==}
dependencies:
'@babel/parser': 7.25.3
'@vue/compiler-core': 3.5.6
'@vue/compiler-dom': 3.5.6
'@vue/compiler-ssr': 3.5.6
'@vue/shared': 3.5.6
'@vue/compiler-core': 3.5.8
'@vue/compiler-dom': 3.5.8
'@vue/compiler-ssr': 3.5.8
'@vue/shared': 3.5.8
estree-walker: 2.0.2
magic-string: 0.30.11
postcss: 8.4.47
source-map-js: 1.2.0
source-map-js: 1.2.1
/@vue/compiler-ssr@3.4.21:
resolution: {integrity: sha512-M5+9nI2lPpAsgXOGQobnIueVqc9sisBFexh5yMIMRAPYLa7+5wEJs8iqOZc1WAa9WQbx9GR2twgznU8LTIiZ4Q==}
@ -2263,11 +2272,11 @@ packages:
'@vue/shared': 3.4.36
dev: true
/@vue/compiler-ssr@3.5.6:
resolution: {integrity: sha512-VpWbaZrEOCqnmqjE83xdwegtr5qO/2OPUC6veWgvNqTJ3bYysz6vY3VqMuOijubuUYPRpG3OOKIh9TD0Stxb9A==}
/@vue/compiler-ssr@3.5.8:
resolution: {integrity: sha512-W96PtryNsNG9u0ZnN5Q5j27Z/feGrFV6zy9q5tzJVyJaLiwYxvC0ek4IXClZygyhjm+XKM7WD9pdKi/wIRVC/Q==}
dependencies:
'@vue/compiler-dom': 3.5.6
'@vue/shared': 3.5.6
'@vue/compiler-dom': 3.5.8
'@vue/shared': 3.5.8
/@vue/devtools-api@6.6.1:
resolution: {integrity: sha512-LgPscpE3Vs0x96PzSSB4IGVSZXZBZHpfxs+ZA1d+VEPwHdOXowy/Y2CsvCAIFrf+ssVU1pD1jidj505EpUnfbA==}
@ -2329,33 +2338,33 @@ packages:
vue-template-compiler: 2.7.16
dev: true
/@vue/reactivity@3.5.6:
resolution: {integrity: sha512-shZ+KtBoHna5GyUxWfoFVBCVd7k56m6lGhk5e+J9AKjheHF6yob5eukssHRI+rzvHBiU1sWs/1ZhNbLExc5oYQ==}
/@vue/reactivity@3.5.8:
resolution: {integrity: sha512-mlgUyFHLCUZcAYkqvzYnlBRCh0t5ZQfLYit7nukn1GR96gc48Bp4B7OIcSfVSvlG1k3BPfD+p22gi1t2n9tsXg==}
dependencies:
'@vue/shared': 3.5.6
'@vue/shared': 3.5.8
/@vue/runtime-core@3.5.6:
resolution: {integrity: sha512-FpFULR6+c2lI+m1fIGONLDqPQO34jxV8g6A4wBOgne8eSRHP6PQL27+kWFIx5wNhhjkO7B4rgtsHAmWv7qKvbg==}
/@vue/runtime-core@3.5.8:
resolution: {integrity: sha512-fJuPelh64agZ8vKkZgp5iCkPaEqFJsYzxLk9vSC0X3G8ppknclNDr61gDc45yBGTaN5Xqc1qZWU3/NoaBMHcjQ==}
dependencies:
'@vue/reactivity': 3.5.6
'@vue/shared': 3.5.6
'@vue/reactivity': 3.5.8
'@vue/shared': 3.5.8
/@vue/runtime-dom@3.5.6:
resolution: {integrity: sha512-SDPseWre45G38ENH2zXRAHL1dw/rr5qp91lS4lt/nHvMr0MhsbCbihGAWLXNB/6VfFOJe2O+RBRkXU+CJF7/sw==}
/@vue/runtime-dom@3.5.8:
resolution: {integrity: sha512-DpAUz+PKjTZPUOB6zJgkxVI3GuYc2iWZiNeeHQUw53kdrparSTG6HeXUrYDjaam8dVsCdvQxDz6ZWxnyjccUjQ==}
dependencies:
'@vue/reactivity': 3.5.6
'@vue/runtime-core': 3.5.6
'@vue/shared': 3.5.6
'@vue/reactivity': 3.5.8
'@vue/runtime-core': 3.5.8
'@vue/shared': 3.5.8
csstype: 3.1.3
/@vue/server-renderer@3.5.6(vue@3.5.6):
resolution: {integrity: sha512-zivnxQnOnwEXVaT9CstJ64rZFXMS5ZkKxCjDQKiMSvUhXRzFLWZVbaBiNF4HGDqGNNsTgmjcCSmU6TB/0OOxLA==}
/@vue/server-renderer@3.5.8(vue@3.5.8):
resolution: {integrity: sha512-7AmC9/mEeV9mmXNVyUIm1a1AjUhyeeGNbkLh39J00E7iPeGks8OGRB5blJiMmvqSh8SkaS7jkLWSpXtxUCeagA==}
peerDependencies:
vue: 3.5.6
vue: 3.5.8
dependencies:
'@vue/compiler-ssr': 3.5.6
'@vue/shared': 3.5.6
vue: 3.5.6(typescript@5.2.2)
'@vue/compiler-ssr': 3.5.8
'@vue/shared': 3.5.8
vue: 3.5.8(typescript@5.2.2)
/@vue/shared@3.4.21:
resolution: {integrity: sha512-PuJe7vDIi6VYSinuEbUIQgMIRZGgM8e4R+G+/dQTk0X1NEdvgvvgv7m+rfmDH1gZzyA1OjjoWskvHlfRNfQf3g==}
@ -2369,10 +2378,10 @@ packages:
resolution: {integrity: sha512-fdPLStwl1sDfYuUftBaUVn2pIrVFDASYerZSrlBvVBfylObPA1gtcWJHy5Ox8jLEJ524zBibss488Q3SZtU1uA==}
dev: true
/@vue/shared@3.5.6:
resolution: {integrity: sha512-eidH0HInnL39z6wAt6SFIwBrvGOpDWsDxlw3rCgo1B+CQ1781WzQUSU3YjxgdkcJo9Q8S6LmXTkvI+cLHGkQfA==}
/@vue/shared@3.5.8:
resolution: {integrity: sha512-mJleSWbAGySd2RJdX1RBtcrUBX6snyOc0qHpgk3lGi4l9/P/3ny3ELqFWqYdkXIwwNN/kdm8nD9ky8o6l/Lx2A==}
/@vue/test-utils@2.4.3(vue@3.5.6):
/@vue/test-utils@2.4.3(vue@3.5.8):
resolution: {integrity: sha512-F4K7mF+ad++VlTrxMJVRnenKSJmO6fkQt2wpRDiKDesQMkfpniGWsqEi/JevxGBo2qEkwwjvTUAoiGJLNx++CA==}
peerDependencies:
'@vue/server-renderer': ^3.0.1
@ -2382,17 +2391,17 @@ packages:
optional: true
dependencies:
js-beautify: 1.14.11
vue: 3.5.6(typescript@5.2.2)
vue: 3.5.8(typescript@5.2.2)
vue-component-type-helpers: 1.8.26
dev: true
/@vueuse/core@10.9.0(vue@3.5.6):
/@vueuse/core@10.9.0(vue@3.5.8):
resolution: {integrity: sha512-/1vjTol8SXnx6xewDEKfS0Ra//ncg4Hb0DaZiwKf7drgfMsKFExQ+FnnENcN6efPen+1kIzhLQoGSy0eDUVOMg==}
dependencies:
'@types/web-bluetooth': 0.0.20
'@vueuse/metadata': 10.9.0
'@vueuse/shared': 10.9.0(vue@3.5.6)
vue-demi: 0.14.7(vue@3.5.6)
'@vueuse/shared': 10.9.0(vue@3.5.8)
vue-demi: 0.14.7(vue@3.5.8)
transitivePeerDependencies:
- '@vue/composition-api'
- vue
@ -2400,10 +2409,10 @@ packages:
/@vueuse/metadata@10.9.0:
resolution: {integrity: sha512-iddNbg3yZM0X7qFY2sAotomgdHK7YJ6sKUvQqbvwnf7TmaVPxS4EJydcNsVejNdS8iWCtDk+fYXr7E32nyTnGA==}
/@vueuse/shared@10.9.0(vue@3.5.6):
/@vueuse/shared@10.9.0(vue@3.5.8):
resolution: {integrity: sha512-Uud2IWncmAfJvRaFYzv5OHDli+FbOzxiVEQdLCKQKLyhz94PIyFC3CHcH7EDMwIn8NPtD06+PNbC/PiO0LGLtw==}
dependencies:
vue-demi: 0.14.7(vue@3.5.6)
vue-demi: 0.14.7(vue@3.5.8)
transitivePeerDependencies:
- '@vue/composition-api'
- vue
@ -3747,10 +3756,6 @@ packages:
entities: 4.5.0
dev: true
/dom-to-image@2.6.0:
resolution: {integrity: sha512-Dt0QdaHmLpjURjU7Tnu3AgYSF2LuOmksSGsUcE6ItvJoCWTBEmiMXcqBdNSAm9+QbbwD7JMoVsuuKX6ZVQv1qA==}
dev: false
/domelementtype@1.3.1:
resolution: {integrity: sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==}
dev: true
@ -3918,7 +3923,7 @@ packages:
function.prototype.name: 1.1.6
get-intrinsic: 1.2.4
get-symbol-description: 1.0.2
globalthis: 1.0.3
globalthis: 1.0.4
gopd: 1.0.1
has-property-descriptors: 1.0.2
has-proto: 1.0.3
@ -3934,7 +3939,7 @@ packages:
is-string: 1.0.7
is-typed-array: 1.1.13
is-weakref: 1.0.2
object-inspect: 1.13.1
object-inspect: 1.13.2
object-keys: 1.1.1
object.assign: 4.1.5
regexp.prototype.flags: 1.5.2
@ -4102,7 +4107,7 @@ packages:
eslint: 8.57.0
dev: true
/eslint-config-standard-with-typescript@43.0.0(@typescript-eslint/eslint-plugin@6.21.0)(eslint-plugin-import@2.29.1)(eslint-plugin-n@16.6.2)(eslint-plugin-promise@6.1.1)(eslint@8.57.0)(typescript@5.2.2):
/eslint-config-standard-with-typescript@43.0.0(@typescript-eslint/eslint-plugin@6.21.0)(eslint-plugin-import@2.30.0)(eslint-plugin-n@16.6.2)(eslint-plugin-promise@6.1.1)(eslint@8.57.0)(typescript@5.2.2):
resolution: {integrity: sha512-AT0qK01M5bmsWiE3UZvaQO5da1y1n6uQckAKqGNe6zPW5IOzgMLXZxw77nnFm+C11nxAZXsCPrbsgJhSrGfX6Q==}
peerDependencies:
'@typescript-eslint/eslint-plugin': ^6.4.0
@ -4115,8 +4120,8 @@ packages:
'@typescript-eslint/eslint-plugin': 6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.57.0)(typescript@5.2.2)
'@typescript-eslint/parser': 6.21.0(eslint@8.57.0)(typescript@5.2.2)
eslint: 8.57.0
eslint-config-standard: 17.1.0(eslint-plugin-import@2.29.1)(eslint-plugin-n@16.6.2)(eslint-plugin-promise@6.1.1)(eslint@8.57.0)
eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.21.0)(eslint@8.57.0)
eslint-config-standard: 17.1.0(eslint-plugin-import@2.30.0)(eslint-plugin-n@16.6.2)(eslint-plugin-promise@6.1.1)(eslint@8.57.0)
eslint-plugin-import: 2.30.0(@typescript-eslint/parser@6.21.0)(eslint@8.57.0)
eslint-plugin-n: 16.6.2(eslint@8.57.0)
eslint-plugin-promise: 6.1.1(eslint@8.57.0)
typescript: 5.2.2
@ -4124,7 +4129,7 @@ packages:
- supports-color
dev: true
/eslint-config-standard@17.1.0(eslint-plugin-import@2.29.1)(eslint-plugin-n@16.6.2)(eslint-plugin-promise@6.1.1)(eslint@8.57.0):
/eslint-config-standard@17.1.0(eslint-plugin-import@2.30.0)(eslint-plugin-n@16.6.2)(eslint-plugin-promise@6.1.1)(eslint@8.57.0):
resolution: {integrity: sha512-IwHwmaBNtDK4zDHQukFDW5u/aTb8+meQWZvNFWkiGmbWjD6bqyuSSBxxXKkCftCUzc1zwCH2m/baCNDLGmuO5Q==}
engines: {node: '>=12.0.0'}
peerDependencies:
@ -4134,7 +4139,7 @@ packages:
eslint-plugin-promise: ^6.0.0
dependencies:
eslint: 8.57.0
eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.21.0)(eslint@8.57.0)
eslint-plugin-import: 2.30.0(@typescript-eslint/parser@6.21.0)(eslint@8.57.0)
eslint-plugin-n: 16.6.2(eslint@8.57.0)
eslint-plugin-promise: 6.1.1(eslint@8.57.0)
dev: true
@ -4143,14 +4148,14 @@ packages:
resolution: {integrity: sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==}
dependencies:
debug: 3.2.7
is-core-module: 2.15.0
is-core-module: 2.15.1
resolve: 1.22.8
transitivePeerDependencies:
- supports-color
dev: true
/eslint-module-utils@2.8.1(@typescript-eslint/parser@6.21.0)(eslint-import-resolver-node@0.3.9)(eslint@8.57.0):
resolution: {integrity: sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q==}
/eslint-module-utils@2.11.0(@typescript-eslint/parser@6.21.0)(eslint-import-resolver-node@0.3.9)(eslint@8.57.0):
resolution: {integrity: sha512-gbBE5Hitek/oG6MUVj6sFuzEjA/ClzNflVrLovHi/JgLdC7fiN5gLAY1WIPW1a0V5I999MnsrvVrCOGmmVqDBQ==}
engines: {node: '>=4'}
peerDependencies:
'@typescript-eslint/parser': '*'
@ -4185,13 +4190,13 @@ packages:
eslint: '>=8'
dependencies:
'@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0)
'@eslint-community/regexpp': 4.10.0
'@eslint-community/regexpp': 4.11.1
eslint: 8.57.0
eslint-compat-utils: 0.5.0(eslint@8.57.0)
dev: true
/eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.21.0)(eslint@8.57.0):
resolution: {integrity: sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==}
/eslint-plugin-import@2.30.0(@typescript-eslint/parser@6.21.0)(eslint@8.57.0):
resolution: {integrity: sha512-/mHNE9jINJfiD2EKkg1BKyPyUk4zdnT54YgbOgfjSakWT5oyX/qQLVNTkehyfpcMxZXMy1zyonZ2v7hZTX43Yw==}
engines: {node: '>=4'}
peerDependencies:
'@typescript-eslint/parser': '*'
@ -4200,6 +4205,7 @@ packages:
'@typescript-eslint/parser':
optional: true
dependencies:
'@rtsao/scc': 1.1.0
'@typescript-eslint/parser': 6.21.0(eslint@8.57.0)(typescript@5.2.2)
array-includes: 3.1.8
array.prototype.findlastindex: 1.2.5
@ -4209,9 +4215,9 @@ packages:
doctrine: 2.1.0
eslint: 8.57.0
eslint-import-resolver-node: 0.3.9
eslint-module-utils: 2.8.1(@typescript-eslint/parser@6.21.0)(eslint-import-resolver-node@0.3.9)(eslint@8.57.0)
eslint-module-utils: 2.11.0(@typescript-eslint/parser@6.21.0)(eslint-import-resolver-node@0.3.9)(eslint@8.57.0)
hasown: 2.0.2
is-core-module: 2.15.0
is-core-module: 2.15.1
is-glob: 4.0.3
minimatch: 3.1.2
object.fromentries: 2.0.8
@ -4235,11 +4241,11 @@ packages:
builtins: 5.1.0
eslint: 8.57.0
eslint-plugin-es-x: 7.6.0(eslint@8.57.0)
get-tsconfig: 4.7.3
get-tsconfig: 4.8.1
globals: 13.24.0
ignore: 5.3.2
is-builtin-module: 3.2.1
is-core-module: 2.15.0
is-core-module: 2.15.1
minimatch: 3.1.2
resolve: 1.22.8
semver: 7.6.3
@ -4761,8 +4767,8 @@ packages:
get-intrinsic: 1.2.4
dev: true
/get-tsconfig@4.7.3:
resolution: {integrity: sha512-ZvkrzoUA0PQZM6fy6+/Hce561s+faD1rsNwhnO5FelNjyy7EMGJ3Rz1AQ8GYDWjhRs/7dBLOEJvhK8MiEJOAFg==}
/get-tsconfig@4.8.1:
resolution: {integrity: sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg==}
dependencies:
resolve-pkg-maps: 1.0.0
dev: true
@ -4872,11 +4878,12 @@ packages:
type-fest: 0.20.2
dev: true
/globalthis@1.0.3:
resolution: {integrity: sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==}
/globalthis@1.0.4:
resolution: {integrity: sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==}
engines: {node: '>= 0.4'}
dependencies:
define-properties: 1.2.1
gopd: 1.0.1
dev: true
/globby@11.1.0:
@ -5068,6 +5075,10 @@ packages:
engines: {node: '>=8'}
dev: true
/html-to-image@1.11.11:
resolution: {integrity: sha512-9gux8QhvjRO/erSnDPv28noDZcPZmYE7e1vFsBLKLlRlKDSqNJYebj6Qz1TGd5lsRV+X+xYyjCKjuZdABinWjA==}
dev: false
/htmlparser2@3.10.1:
resolution: {integrity: sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==}
dependencies:
@ -5250,8 +5261,8 @@ packages:
hasown: 2.0.2
dev: true
/is-core-module@2.15.0:
resolution: {integrity: sha512-Dd+Lb2/zvk9SKy1TGCt1wFJFo/MWBPMX5x7KcvLajWTGuomczdQX61PvY5yK6SVACwpoexWo81IfFyoKY2QnTA==}
/is-core-module@2.15.1:
resolution: {integrity: sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==}
engines: {node: '>= 0.4'}
dependencies:
hasown: 2.0.2
@ -6129,13 +6140,13 @@ packages:
minimatch: 3.1.2
dev: true
/naive-ui@2.39.0(vue@3.5.6):
/naive-ui@2.39.0(vue@3.5.8):
resolution: {integrity: sha512-5oUJzRG+rtLSH8eRU+fJvVYiQids2BxF9jp+fwGoAqHOptEINrBlgBu9uy+95RHE5FLJ7Q/z41o+qkoGnUrKxQ==}
peerDependencies:
vue: ^3.0.0
dependencies:
'@css-render/plugin-bem': 0.15.14(css-render@0.15.14)
'@css-render/vue3-ssr': 0.15.14(vue@3.5.6)
'@css-render/vue3-ssr': 0.15.14(vue@3.5.8)
'@types/katex': 0.16.7
'@types/lodash': 4.17.6
'@types/lodash-es': 4.17.12
@ -6150,10 +6161,10 @@ packages:
lodash-es: 4.17.21
seemly: 0.3.8
treemate: 0.3.11
vdirs: 0.1.8(vue@3.5.6)
vooks: 0.2.12(vue@3.5.6)
vue: 3.5.6(typescript@5.2.2)
vueuc: 0.4.58(vue@3.5.6)
vdirs: 0.1.8(vue@3.5.8)
vooks: 0.2.12(vue@3.5.8)
vue: 3.5.8(typescript@5.2.2)
vueuc: 0.4.58(vue@3.5.8)
dev: false
/nanoid@3.3.7:
@ -6276,6 +6287,11 @@ packages:
/object-inspect@1.13.1:
resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==}
/object-inspect@1.13.2:
resolution: {integrity: sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==}
engines: {node: '>= 0.4'}
dev: true
/object-keys@1.1.1:
resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==}
engines: {node: '>= 0.4'}
@ -6542,7 +6558,7 @@ packages:
deep-pick-omit: 1.2.0
defu: 6.1.4
destr: 2.0.3
pinia: 2.1.7(typescript@5.2.2)(vue@3.5.6)
pinia: 2.1.7(typescript@5.2.2)(vue@3.5.8)
transitivePeerDependencies:
- magicast
- rollup
@ -6550,7 +6566,7 @@ packages:
- webpack-sources
dev: false
/pinia@2.1.7(typescript@5.2.2)(vue@3.5.6):
/pinia@2.1.7(typescript@5.2.2)(vue@3.5.8):
resolution: {integrity: sha512-+C2AHFtcFqjPih0zpYuvof37SFxMQ7OEG2zV9jRI12i9BOy3YQVAHwdKtyyc8pDcDyIc33WCIsZaCFWU7WWxGQ==}
peerDependencies:
'@vue/composition-api': ^1.4.0
@ -6564,8 +6580,8 @@ packages:
dependencies:
'@vue/devtools-api': 6.6.1
typescript: 5.2.2
vue: 3.5.6(typescript@5.2.2)
vue-demi: 0.14.6(vue@3.5.6)
vue: 3.5.8(typescript@5.2.2)
vue-demi: 0.14.6(vue@3.5.8)
dev: false
/pkg-types@1.2.0:
@ -7979,7 +7995,7 @@ packages:
dependencies:
'@antfu/utils': 0.7.10
'@rollup/pluginutils': 5.1.0
'@vueuse/core': 10.9.0(vue@3.5.6)
'@vueuse/core': 10.9.0(vue@3.5.8)
fast-glob: 3.3.2
local-pkg: 0.5.0
magic-string: 0.30.11
@ -7991,7 +8007,7 @@ packages:
- webpack-sources
dev: true
/unplugin-vue-components@0.27.4(vue@3.5.6):
/unplugin-vue-components@0.27.4(vue@3.5.8):
resolution: {integrity: sha512-1XVl5iXG7P1UrOMnaj2ogYa5YTq8aoh5jwDPQhemwO/OrXW+lPQKDXd1hMz15qxQPxgb/XXlbgo3HQ2rLEbmXQ==}
engines: {node: '>=14'}
peerDependencies:
@ -8014,7 +8030,7 @@ packages:
minimatch: 9.0.5
mlly: 1.7.1
unplugin: 1.13.1
vue: 3.5.6(typescript@5.2.2)
vue: 3.5.8(typescript@5.2.2)
transitivePeerDependencies:
- rollup
- supports-color
@ -8129,13 +8145,13 @@ packages:
engines: {node: '>= 0.8'}
dev: true
/vdirs@0.1.8(vue@3.5.6):
/vdirs@0.1.8(vue@3.5.8):
resolution: {integrity: sha512-H9V1zGRLQZg9b+GdMk8MXDN2Lva0zx72MPahDKc30v+DtwKjfyOSXWRIX4t2mhDubM1H09gPhWeth/BJWPHGUw==}
peerDependencies:
vue: ^3.0.11
dependencies:
evtd: 0.2.4
vue: 3.5.6(typescript@5.2.2)
vue: 3.5.8(typescript@5.2.2)
dev: false
/vite-bundle-analyzer@0.9.4:
@ -8413,20 +8429,20 @@ packages:
- terser
dev: true
/vooks@0.2.12(vue@3.5.6):
/vooks@0.2.12(vue@3.5.8):
resolution: {integrity: sha512-iox0I3RZzxtKlcgYaStQYKEzWWGAduMmq+jS7OrNdQo1FgGfPMubGL3uGHOU9n97NIvfFDBGnpSvkWyb/NSn/Q==}
peerDependencies:
vue: ^3.0.0
dependencies:
evtd: 0.2.4
vue: 3.5.6(typescript@5.2.2)
vue: 3.5.8(typescript@5.2.2)
dev: false
/vue-component-type-helpers@1.8.26:
resolution: {integrity: sha512-CIwb7s8cqUuPpHDk+0DY8EJ/x8tzdzqw8ycX8hhw1GnbngTgSsIceHAqrrLjmv8zXi+j5XaiqYRQMw8sKyyjkw==}
dev: true
/vue-demi@0.14.6(vue@3.5.6):
/vue-demi@0.14.6(vue@3.5.8):
resolution: {integrity: sha512-8QA7wrYSHKaYgUxDA5ZC24w+eHm3sYCbp0EzcDwKqN3p6HqtTCGR/GVsPyZW92unff4UlcSh++lmqDWN3ZIq4w==}
engines: {node: '>=12'}
hasBin: true
@ -8438,10 +8454,10 @@ packages:
'@vue/composition-api':
optional: true
dependencies:
vue: 3.5.6(typescript@5.2.2)
vue: 3.5.8(typescript@5.2.2)
dev: false
/vue-demi@0.14.7(vue@3.5.6):
/vue-demi@0.14.7(vue@3.5.8):
resolution: {integrity: sha512-EOG8KXDQNwkJILkx/gPcoL/7vH+hORoBaKgGe+6W7VFMvCYJfmF2dGbvgDroVnI8LU7/kTu8mbjRZGBU1z9NTA==}
engines: {node: '>=12'}
hasBin: true
@ -8453,7 +8469,7 @@ packages:
'@vue/composition-api':
optional: true
dependencies:
vue: 3.5.6(typescript@5.2.2)
vue: 3.5.8(typescript@5.2.2)
/vue-eslint-parser@9.3.2(eslint@8.57.0):
resolution: {integrity: sha512-q7tWyCVaV9f8iQyIA5Mkj/S6AoJ9KBN8IeUSf3XEmBrOtxOZnfTg5s4KClbZBCK3GtnT/+RyCLZyDHuZwTuBjg==}
@ -8491,7 +8507,7 @@ packages:
- supports-color
dev: true
/vue-hooks-plus@2.2.1(vue@3.5.6):
/vue-hooks-plus@2.2.1(vue@3.5.8):
resolution: {integrity: sha512-YfZ+xwzeoTXpuXrCwu4zOe2kmc3hcOxD3eY9eoc5r+T8grCMQl25li0W9o8uY1/UA75sgLcE6B7KfKd2e3OURg==}
peerDependencies:
vue: ^3.2.25
@ -8503,10 +8519,10 @@ packages:
qs: 6.12.1
query-string: 7.1.3
screenfull: 5.2.0
vue: 3.5.6(typescript@5.2.2)
vue: 3.5.8(typescript@5.2.2)
dev: false
/vue-i18n@9.13.1(vue@3.5.6):
/vue-i18n@9.13.1(vue@3.5.8):
resolution: {integrity: sha512-mh0GIxx0wPtPlcB1q4k277y0iKgo25xmDPWioVVYanjPufDBpvu5ySTjP5wOrSvlYQ2m1xI+CFhGdauv/61uQg==}
engines: {node: '>= 16'}
peerDependencies:
@ -8515,15 +8531,15 @@ packages:
'@intlify/core-base': 9.13.1
'@intlify/shared': 9.13.1
'@vue/devtools-api': 6.6.1
vue: 3.5.6(typescript@5.2.2)
vue: 3.5.8(typescript@5.2.2)
/vue-router@4.3.2(vue@3.5.6):
/vue-router@4.3.2(vue@3.5.8):
resolution: {integrity: sha512-hKQJ1vDAZ5LVkKEnHhmm1f9pMiWIBNGF5AwU67PdH7TyXCj/a4hTccuUuYCAMgJK6rO/NVYtQIEN3yL8CECa7Q==}
peerDependencies:
vue: ^3.2.0
dependencies:
'@vue/devtools-api': 6.6.1
vue: 3.5.6(typescript@5.2.2)
vue: 3.5.8(typescript@5.2.2)
dev: false
/vue-template-compiler@2.7.16:
@ -8549,39 +8565,39 @@ packages:
resolution: {integrity: sha512-YwdQ1YjbHzcUsA7Vj5ziQLoX7oQZGWDZNaAadLu7EZzV9UU8Dd2IXAxGobF7dIHamgz5mPiOgH1Xb3qO8bCGDA==}
dependencies:
js-binary-schema-parser: 2.0.3
vue: 3.5.6(typescript@5.2.2)
vue: 3.5.8(typescript@5.2.2)
transitivePeerDependencies:
- typescript
dev: false
/vue@3.5.6(typescript@5.2.2):
resolution: {integrity: sha512-zv+20E2VIYbcJOzJPUWp03NOGFhMmpCKOfSxVTmCYyYFFko48H9tmuQFzYj7tu4qX1AeXlp9DmhIP89/sSxxhw==}
/vue@3.5.8(typescript@5.2.2):
resolution: {integrity: sha512-hvuvuCy51nP/1fSRvrrIqTLSvrSyz2Pq+KQ8S8SXCxTWVE0nMaOnSDnSOxV1eYmGfvK7mqiwvd1C59CEEz7dAQ==}
peerDependencies:
typescript: '*'
peerDependenciesMeta:
typescript:
optional: true
dependencies:
'@vue/compiler-dom': 3.5.6
'@vue/compiler-sfc': 3.5.6
'@vue/runtime-dom': 3.5.6
'@vue/server-renderer': 3.5.6(vue@3.5.6)
'@vue/shared': 3.5.6
'@vue/compiler-dom': 3.5.8
'@vue/compiler-sfc': 3.5.8
'@vue/runtime-dom': 3.5.8
'@vue/server-renderer': 3.5.8(vue@3.5.8)
'@vue/shared': 3.5.8
typescript: 5.2.2
/vueuc@0.4.58(vue@3.5.6):
/vueuc@0.4.58(vue@3.5.8):
resolution: {integrity: sha512-Wnj/N8WbPRSxSt+9ji1jtDHPzda5h2OH/0sFBhvdxDRuyCZbjGg3/cKMaKqEoe+dErTexG2R+i6Q8S/Toq1MYg==}
peerDependencies:
vue: ^3.0.11
dependencies:
'@css-render/vue3-ssr': 0.15.14(vue@3.5.6)
'@css-render/vue3-ssr': 0.15.14(vue@3.5.8)
'@juggle/resize-observer': 3.4.0
css-render: 0.15.14
evtd: 0.2.4
seemly: 0.3.8
vdirs: 0.1.8(vue@3.5.6)
vooks: 0.2.12(vue@3.5.6)
vue: 3.5.6(typescript@5.2.2)
vdirs: 0.1.8(vue@3.5.8)
vooks: 0.2.12(vue@3.5.8)
vue: 3.5.8(typescript@5.2.2)
dev: false
/webidl-conversions@7.0.0:

View File

@ -33,20 +33,7 @@ export default defineComponent({
name: 'RCollapseGrid',
props,
setup(props) {
const modelCollapsed = computed({
get: () => !props.open,
set: (val) => {
const { onUpdateValue, 'onUpdate:value': _onUpdateValue } = props
if (onUpdateValue) {
call(onUpdateValue, val)
}
if (_onUpdateValue) {
call(_onUpdateValue, val)
}
},
})
const modelCollapsed = ref(!props.open)
const cssVars = computed(() => {
const cssVar = {
'--r-collapse-grid-action-align': props.actionAlign,
@ -56,7 +43,17 @@ export default defineComponent({
})
const collapseClick = () => {
const { onUpdateValue, 'onUpdate:value': _onUpdateValue } = props
modelCollapsed.value = !modelCollapsed.value
if (onUpdateValue) {
call(onUpdateValue, modelCollapsed.value)
}
if (_onUpdateValue) {
call(_onUpdateValue, modelCollapsed.value)
}
}
const CollapseIcon = () => (

View File

@ -1,41 +1,36 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-12-14
*
* @workspace ray-template
*
* @remark
*/
import domToImage from 'dom-to-image'
import { unrefElement } from '@/utils'
import {
toPng,
toJpeg,
toBlob,
toPixelData,
toSvg,
toCanvas,
} from 'html-to-image'
import type { Options as ReDomToImageOptions } from 'dom-to-image'
import type { BasicTarget, TargetType } from '@/types'
export type ImageType = keyof typeof domToImageMethods
type HtmlToImageOptions = Partial<NonNullable<Parameters<typeof toPng>[1]>>
export type DomToImageResult = string | Blob | Uint8ClampedArray | undefined
export interface UseDomToImageOptions<T extends TargetType = Element>
extends ReDomToImageOptions {
interface Options<
T extends TargetType = Element,
ImageType extends DomToImageMethodKeys = 'jpeg',
> {
/**
*
*
* imageType
* @description
* imageType
*
* @default jpeg
*/
imageType?: ImageType
imageType?: DomToImageReturnType<ImageType>
/**
*
*
* dom
*
* @param element current dom
*
* @description
* dom
*
* @default undefined
*/
beforeCreate?: (element: T | null | undefined) => void
@ -44,11 +39,12 @@ export interface UseDomToImageOptions<T extends TargetType = Element>
* @param element current dom
* @param result dom to image result
*
* dom
* @description
* dom
*
* @default undefined
*/
created?: (result: DomToImageResult, element: T) => void
created?: (result: DomToImageReturnType<ImageType>, element: T) => void
/**
*
* @param error dom to image error
@ -62,30 +58,40 @@ export interface UseDomToImageOptions<T extends TargetType = Element>
*
* @param element current dom
*
* dom
* @description
* dom
*
* @default undefined
*/
finally?: () => void
finally?: (element: T) => void
}
export type UseDomToImageOptions<T extends TargetType = Element> = Options<T> &
HtmlToImageOptions
export type DomToImageMethodKeys = keyof typeof domToImageMethods
type DomToImageReturnType<ImageType extends DomToImageMethodKeys = 'jpeg'> =
Awaited<ReturnType<(typeof domToImageMethods)[ImageType]>>
const domToImageMethods = {
svg: domToImage.toSvg,
png: domToImage.toPng,
jpeg: domToImage.toJpeg,
blob: domToImage.toBlob,
pixelData: domToImage.toPixelData,
}
svg: toSvg,
png: toPng,
jpeg: toJpeg,
blob: toBlob,
pixelData: toPixelData,
canvas: toCanvas,
} as const
/**
*
* @param target ref dom
* @param options dom-to-image options
* @param options html-to-image options
*
* @see https://github.com/tsayen/dom-to-image
* @see https://github.com/bubkoo/html-to-image
*
* @description
* 使 dom-to-image dom dom-to-image v2.6.0
* 使 html-to-image dom
* imageType
*
* create imageType options.imageType
@ -113,9 +119,9 @@ export const useDomToImage = <T extends HTMLElement>(
imageType: _imageType,
} = options ?? {}
const run = (
imageType?: UseDomToImageOptions['imageType'],
): Promise<DomToImageResult> => {
const run = <ImageType extends DomToImageMethodKeys = 'jpeg'>(
imageType?: ImageType,
): Promise<DomToImageReturnType<ImageType>> => {
return new Promise((resolve, reject) => {
const element = unrefElement(target)
@ -128,7 +134,8 @@ export const useDomToImage = <T extends HTMLElement>(
}
domToImageMethods[imageType ?? _imageType ?? 'jpeg']?.(element, options)
.then((res) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
.then((res: any) => {
created?.(res, element)
return resolve(res)
@ -139,7 +146,7 @@ export const useDomToImage = <T extends HTMLElement>(
return reject(error)
})
.finally(() => {
_finally?.()
_finally?.(element)
})
})
}

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-12-14
*
* @workspace ray-template
*
* @remark
*/
import { useDomToImage, usePrint } from '@/hooks'
import { omit } from 'lodash-es'
@ -63,7 +52,7 @@ export const printDom = <T extends HTMLElement>(
domToImageOptions?.createdError?.(error)
window.$loadingBar?.error()
},
})
} as UseDomToImageOptions)
create('jpeg')?.then((res) => {
const { print } = usePrint(res, {