version: v4.8.5

This commit is contained in:
XiaoDaiGua-Ray 2024-05-17 15:26:25 +08:00
parent 5b035815eb
commit 27db2293f3
31 changed files with 471 additions and 197 deletions

View File

@ -8,7 +8,6 @@ module.exports = {
jsxSingleQuote: false, // `jsx` 不使用单引号, 而使用双引号
trailingComma: 'all', // 尾随逗号
bracketSpacing: true, // 大括号内的首尾需要空格
jsxBracketSameLine: false, // `jsx` 标签的反尖括号需要换行
arrowParens: 'always', // 箭头函数, 只有一个参数的时候, 也需要括号
rangeStart: 0, // 每个文件格式化的范围是文件的全部内容
rangeEnd: Infinity,

View File

@ -1,5 +1,34 @@
# CHANGE LOG
## 4.8.5
## Feats
- 更新 `vue-router` 版本至 `4.3.2`
- 更新 `vue-hooks-plus` 版本至 `2.0.3`
- `usePagination` 方法
- 新增 `resetPagination` 方法,用于重置分页器
- `RBarcode` 组件,默认启用 `watchText` 配置项,用于监听 `text` 内容变化
- `RMoreDropdown` 组件,新增 `icon` 自定义配置图标,依赖 `RIcon` 组件实现
- `buildOptions` 方法现在会自动根据 `mode` 进行自动构建生成包了
- `RTable hooks`
- `UseCheckedRowKeysOptions`
- 新增 `table column` 参数,自动获取当前表格列配置是否启用了选项模式(单选、多选)
- `selectKey` 方法现在在单选模式下,只会选择一条数据,最后一次选择的会覆盖上次的
- `useTable`
- 新增 `print` 方法
- `useTheme` 方法
- `changeDarkTheme` 更名为 `darkTheme`
- `changeLightTheme` 更名为 `lightTheme`
- `getAppTheme` 方法返回值做了准确的 `ts` 签名,并且新增 `themeLabelI18n` 字段
## Fixes
- 修复 `vitest` 设置 `threads` 导致报错 `Module did not self-register...` 的问题
- 修复 `vue-router warning` 抛出 `can no longer be used directly inside...` 的警告问题
- 修复 `pre-commit` 错误的 `vue-tsc` 检查报错
- `signing logout` 方法现在会正确的清理 `menuTagOptions`
## 4.8.4
由于 `node canvas` 本身的特性(环境问题很多),故在 `v4.8.4` 版本予以移除 `RQRCode` 组件,使用 `vue3-next-qrcode` 替代。所有的使用方法保持一致。

View File

@ -4,23 +4,22 @@ import { useTheme } from '../../src/hooks/template/useTheme'
describe('useTheme', async () => {
await setupMiniApp()
const { changeDarkTheme, changeLightTheme, toggleTheme, getAppTheme } =
useTheme()
const { darkTheme, lightTheme, toggleTheme, getAppTheme } = useTheme()
it('should change to dark theme', () => {
changeDarkTheme()
darkTheme()
expect(getAppTheme().theme).toBe(true)
})
it('should change to light theme', () => {
changeLightTheme()
lightTheme()
expect(getAppTheme().theme).toBe(false)
})
it('should toggle theme', () => {
changeLightTheme()
lightTheme()
expect(getAppTheme().theme).toBe(false)
@ -30,14 +29,14 @@ describe('useTheme', async () => {
})
it('should return current theme', () => {
changeDarkTheme()
darkTheme()
const { theme: darkTheme, themeLabel: darkThemeLabel } = getAppTheme()
expect(darkTheme).toBe(true)
expect(darkThemeLabel).toBe('暗色')
changeLightTheme()
lightTheme()
const { theme: lightTheme, themeLabel: lightThemeLabel } = getAppTheme()

View File

@ -1,7 +1,7 @@
{
"name": "ray-template",
"private": false,
"version": "4.8.4",
"version": "4.8.5",
"type": "module",
"engines": {
"node": "^18.0.0 || >=20.0.0",
@ -16,7 +16,7 @@
"prepare": "husky install",
"test": "vitest",
"test:ui": "vitest --ui",
"lint": "eslint src --ext .js,.jsx,.vue && prettier --write \"src/**/*.{ts,tsx,json,.vue}\""
"lint": "vue-tsc --noEmit && eslint src --ext .js,.jsx,.vue && prettier --write \"src/**/*.{ts,tsx,json,.vue}\""
},
"husky": {
"hooks": {
@ -25,15 +25,14 @@
}
},
"lint-staged": {
"/src/**/*.{ts,tsx,vue}": [
"vue-tsc --noEmit"
],
"*.{ts,tsx,json}": [
"prettier --write"
],
".ts,.tsx,.vue": [
"vue-tsc --noEmit"
],
"*.{ts,tsx,vue}": [
"eslint src",
"prettier --parser=typescript --write"
"eslint src"
]
},
"dependencies": {
@ -54,16 +53,16 @@
"print-js": "^1.6.0",
"vue": "^3.4.26",
"vue-demi": "0.14.6",
"vue-hooks-plus": "1.9.0",
"vue-hooks-plus": "2.1.0",
"vue-i18n": "^9.13.1",
"vue-router": "^4.3.0",
"vue-router": "^4.3.2",
"vue3-next-qrcode": "2.0.10"
},
"devDependencies": {
"@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.7.0",
"@interactjs/types": "1.10.21",
"@intlify/unplugin-vue-i18n": "^2.0.0",
"@intlify/unplugin-vue-i18n": "^4.0.0",
"@types/crypto-js": "^4.1.1",
"@types/dom-to-image": "2.6.7",
"@types/jsbarcode": "3.11.4",

180
pnpm-lock.yaml generated
View File

@ -57,14 +57,14 @@ dependencies:
specifier: 0.14.6
version: 0.14.6(vue@3.4.26)
vue-hooks-plus:
specifier: 1.9.0
version: 1.9.0(vue@3.4.26)
specifier: 2.1.0
version: 2.1.0(vue@3.4.26)
vue-i18n:
specifier: ^9.13.1
version: 9.13.1(vue@3.4.26)
vue-router:
specifier: ^4.3.0
version: 4.3.0(vue@3.4.26)
specifier: ^4.3.2
version: 4.3.2(vue@3.4.26)
vue3-next-qrcode:
specifier: 2.0.10
version: 2.0.10(typescript@5.2.2)
@ -80,8 +80,8 @@ devDependencies:
specifier: 1.10.21
version: 1.10.21
'@intlify/unplugin-vue-i18n':
specifier: ^2.0.0
version: 2.0.0(vue-i18n@9.13.1)
specifier: ^4.0.0
version: 4.0.0(vue-i18n@9.13.1)
'@types/crypto-js':
specifier: ^4.1.1
version: 4.2.2
@ -245,7 +245,7 @@ packages:
engines: {node: '>=6.9.0'}
dependencies:
'@babel/highlight': 7.24.2
picocolors: 1.0.0
picocolors: 1.0.1
dev: true
/@babel/compat-data@7.24.1:
@ -429,6 +429,11 @@ packages:
/@babel/helper-validator-identifier@7.22.20:
resolution: {integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==}
engines: {node: '>=6.9.0'}
dev: true
/@babel/helper-validator-identifier@7.24.5:
resolution: {integrity: sha512-3q93SSKX2TWCG30M2G2kwaKeTYgEUp5Snjuj8qm729SObL6nbtUldAi37qbxkD5gg3xnBio+f9nqpSepGZMvxA==}
engines: {node: '>=6.9.0'}
/@babel/helper-validator-option@7.23.5:
resolution: {integrity: sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw==}
@ -453,7 +458,7 @@ packages:
'@babel/helper-validator-identifier': 7.22.20
chalk: 2.4.2
js-tokens: 4.0.0
picocolors: 1.0.0
picocolors: 1.0.1
dev: true
/@babel/parser@7.24.1:
@ -464,12 +469,12 @@ packages:
'@babel/types': 7.24.0
dev: true
/@babel/parser@7.24.4:
resolution: {integrity: sha512-zTvEBcghmeBma9QIGunWevvBAp4/Qu9Bdq+2k0Ot4fVMD6v3dsC9WOcRSKk7tRRyBM/53yKMJko9xOatGQAwSg==}
/@babel/parser@7.24.5:
resolution: {integrity: sha512-EOv5IK8arwh3LI47dz1b0tKUb/1uhHAnHJOrjgtQMIpu1uXd9mlFrJg9IUgGUgZ41Ch0K8REPTYpO7B76b4vJg==}
engines: {node: '>=6.0.0'}
hasBin: true
dependencies:
'@babel/types': 7.24.0
'@babel/types': 7.24.5
/@babel/plugin-syntax-jsx@7.24.1(@babel/core@7.24.1):
resolution: {integrity: sha512-2eCtxZXf+kbkMIsXS4poTvT4Yu5rXiRa+9xGVT56raghjmBTKMpFNc9R4IDiB4emao9eO22Ox7CxuJG7BgExqA==}
@ -545,6 +550,15 @@ packages:
'@babel/helper-string-parser': 7.24.1
'@babel/helper-validator-identifier': 7.22.20
to-fast-properties: 2.0.0
dev: true
/@babel/types@7.24.5:
resolution: {integrity: sha512-6mQNsaLeXTw0nxYUYu+NSa4Hx4BlF1x1x8/PMFbiR+GBSr+2DkECc69b8hgy2frEodNcvPffeH8YfWd3LI6jhQ==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/helper-string-parser': 7.24.1
'@babel/helper-validator-identifier': 7.24.5
to-fast-properties: 2.0.0
/@commitlint/cli@17.8.1:
resolution: {integrity: sha512-ay+WbzQesE0Rv4EQKfNbSMiJJ12KdKTDzIt0tcK4k11FdsWmtwP0Kp1NWMOUswfIWo6Eb7p7Ln721Nx9FLNBjg==}
@ -1220,8 +1234,8 @@ packages:
resolution: {integrity: sha512-DekYpdkMV3XJVd/0k3f4pJluZAsCiG86yEtVXvGLK0lS/Fj0+OzYEv7HoMpcBZSkQ8s7//yaeEBgnxy2tV81lA==}
dev: false
/@intlify/bundle-utils@7.5.0(vue-i18n@9.13.1):
resolution: {integrity: sha512-6DymqusddBQ8kVtVBsVFFF7arNfIhuLacOmmsqayT2vl427j9m0VX12mMC+cgoVIodSpRfzYPaPTdPuJq7mK0Q==}
/@intlify/bundle-utils@8.0.0(vue-i18n@9.13.1):
resolution: {integrity: sha512-1B++zykRnMwQ+20SpsZI1JCnV/YJt9Oq7AGlEurzkWJOFtFAVqaGc/oV36PBRYeiKnTbY9VYfjBimr2Vt42wLQ==}
engines: {node: '>= 14.16'}
peerDependencies:
petite-vue-i18n: '*'
@ -1232,13 +1246,12 @@ packages:
vue-i18n:
optional: true
dependencies:
'@intlify/message-compiler': 9.9.0
'@intlify/shared': 9.9.0
'@intlify/message-compiler': 9.13.1
'@intlify/shared': 9.13.1
acorn: 8.11.3
escodegen: 2.1.0
estree-walker: 2.0.2
jsonc-eslint-parser: 2.4.0
magic-string: 0.30.8
mlly: 1.6.1
source-map-js: 1.2.0
vue-i18n: 9.13.1(vue@3.4.26)
@ -1259,25 +1272,12 @@ packages:
'@intlify/shared': 9.13.1
source-map-js: 1.2.0
/@intlify/message-compiler@9.9.0:
resolution: {integrity: sha512-yDU/jdUm9KuhEzYfS+wuyja209yXgdl1XFhMlKtXEgSFTxz4COZQCRXXbbH8JrAjMsaJ7bdoPSLsKlY6mXG2iA==}
engines: {node: '>= 16'}
dependencies:
'@intlify/shared': 9.9.0
source-map-js: 1.2.0
dev: true
/@intlify/shared@9.13.1:
resolution: {integrity: sha512-u3b6BKGhE6j/JeRU6C/RL2FgyJfy6LakbtfeVF8fJXURpZZTzfh3e05J0bu0XPw447Q6/WUp3C4ajv4TMS4YsQ==}
engines: {node: '>= 16'}
/@intlify/shared@9.9.0:
resolution: {integrity: sha512-1ECUyAHRrzOJbOizyGufYP2yukqGrWXtkmTu4PcswVnWbkcjzk3YQGmJ0bLkM7JZ0ZYAaohLGdYvBYnTOGYJ9g==}
engines: {node: '>= 16'}
dev: true
/@intlify/unplugin-vue-i18n@2.0.0(vue-i18n@9.13.1):
resolution: {integrity: sha512-1oKvm92L9l2od2H9wKx2ZvR4tzn7gUtd7bPLI7AWUmm7U9H1iEypndt5d985ypxGsEs0gToDaKTrytbBIJwwSg==}
/@intlify/unplugin-vue-i18n@4.0.0(vue-i18n@9.13.1):
resolution: {integrity: sha512-q2Mhqa/mLi0tulfLFO4fMXXvEbkSZpI5yGhNNsLTNJJ41icEGUuyDe+j5zRZIKSkOJRgX6YbCyibTDJdRsukmw==}
engines: {node: '>= 14.16'}
peerDependencies:
petite-vue-i18n: '*'
@ -1291,18 +1291,18 @@ packages:
vue-i18n-bridge:
optional: true
dependencies:
'@intlify/bundle-utils': 7.5.0(vue-i18n@9.13.1)
'@intlify/shared': 9.9.0
'@intlify/bundle-utils': 8.0.0(vue-i18n@9.13.1)
'@intlify/shared': 9.13.1
'@rollup/pluginutils': 5.1.0
'@vue/compiler-sfc': 3.4.21
'@vue/compiler-sfc': 3.4.27
debug: 4.3.4
fast-glob: 3.3.2
js-yaml: 4.1.0
json5: 2.2.3
pathe: 1.1.2
picocolors: 1.0.0
picocolors: 1.0.1
source-map-js: 1.2.0
unplugin: 1.10.0
unplugin: 1.10.1
vue-i18n: 9.13.1(vue@3.4.26)
transitivePeerDependencies:
- rollup
@ -1964,8 +1964,8 @@ packages:
'@babel/core': 7.24.1
'@babel/helper-module-imports': 7.22.15
'@babel/helper-plugin-utils': 7.24.0
'@babel/parser': 7.24.1
'@vue/compiler-sfc': 3.4.21
'@babel/parser': 7.24.5
'@vue/compiler-sfc': 3.4.27
dev: true
/@vue/compiler-core@3.4.21:
@ -1981,12 +1981,22 @@ packages:
/@vue/compiler-core@3.4.26:
resolution: {integrity: sha512-N9Vil6Hvw7NaiyFUFBPXrAyETIGlQ8KcFMkyk6hW1Cl6NvoqvP+Y8p1Eqvx+UdqsnrnI9+HMUEJegzia3mhXmQ==}
dependencies:
'@babel/parser': 7.24.4
'@babel/parser': 7.24.5
'@vue/shared': 3.4.26
entities: 4.5.0
estree-walker: 2.0.2
source-map-js: 1.2.0
/@vue/compiler-core@3.4.27:
resolution: {integrity: sha512-E+RyqY24KnyDXsCuQrI+mlcdW3ALND6U7Gqa/+bVwbcpcR3BRRIckFoz7Qyd4TTlnugtwuI7YgjbvsLmxb+yvg==}
dependencies:
'@babel/parser': 7.24.5
'@vue/shared': 3.4.27
entities: 4.5.0
estree-walker: 2.0.2
source-map-js: 1.2.0
dev: true
/@vue/compiler-dom@3.4.21:
resolution: {integrity: sha512-IZC6FKowtT1sl0CR5DpXSiEB5ayw75oT2bma1BEhV7RRR1+cfwLrxc2Z8Zq/RGFzJ8w5r9QtCOvTjQgdn0IKmA==}
dependencies:
@ -2000,6 +2010,13 @@ packages:
'@vue/compiler-core': 3.4.26
'@vue/shared': 3.4.26
/@vue/compiler-dom@3.4.27:
resolution: {integrity: sha512-kUTvochG/oVgE1w5ViSr3KUBh9X7CWirebA3bezTbB5ZKBQZwR2Mwj9uoSKRMFcz4gSMzzLXBPD6KpCLb9nvWw==}
dependencies:
'@vue/compiler-core': 3.4.27
'@vue/shared': 3.4.27
dev: true
/@vue/compiler-sfc@3.4.21:
resolution: {integrity: sha512-me7epoTxYlY+2CUM7hy9PCDdpMPfIwrOvAXud2Upk10g4YLv9UBW7kL798TvMeDhPthkZ0CONNrK2GoeI1ODiQ==}
dependencies:
@ -2009,7 +2026,7 @@ packages:
'@vue/compiler-ssr': 3.4.21
'@vue/shared': 3.4.21
estree-walker: 2.0.2
magic-string: 0.30.8
magic-string: 0.30.10
postcss: 8.4.38
source-map-js: 1.2.0
dev: true
@ -2017,7 +2034,7 @@ packages:
/@vue/compiler-sfc@3.4.26:
resolution: {integrity: sha512-It1dp+FAOCgluYSVYlDn5DtZBxk1NCiJJfu2mlQqa/b+k8GL6NG/3/zRbJnHdhV2VhxFghaDq5L4K+1dakW6cw==}
dependencies:
'@babel/parser': 7.24.4
'@babel/parser': 7.24.5
'@vue/compiler-core': 3.4.26
'@vue/compiler-dom': 3.4.26
'@vue/compiler-ssr': 3.4.26
@ -2027,6 +2044,20 @@ packages:
postcss: 8.4.38
source-map-js: 1.2.0
/@vue/compiler-sfc@3.4.27:
resolution: {integrity: sha512-nDwntUEADssW8e0rrmE0+OrONwmRlegDA1pD6QhVeXxjIytV03yDqTey9SBDiALsvAd5U4ZrEKbMyVXhX6mCGA==}
dependencies:
'@babel/parser': 7.24.5
'@vue/compiler-core': 3.4.27
'@vue/compiler-dom': 3.4.27
'@vue/compiler-ssr': 3.4.27
'@vue/shared': 3.4.27
estree-walker: 2.0.2
magic-string: 0.30.10
postcss: 8.4.38
source-map-js: 1.2.0
dev: true
/@vue/compiler-ssr@3.4.21:
resolution: {integrity: sha512-M5+9nI2lPpAsgXOGQobnIueVqc9sisBFexh5yMIMRAPYLa7+5wEJs8iqOZc1WAa9WQbx9GR2twgznU8LTIiZ4Q==}
dependencies:
@ -2040,6 +2071,13 @@ packages:
'@vue/compiler-dom': 3.4.26
'@vue/shared': 3.4.26
/@vue/compiler-ssr@3.4.27:
resolution: {integrity: sha512-CVRzSJIltzMG5FcidsW0jKNQnNRYC8bT21VegyMMtHmhW3UOI7knmUehzswXLrExDLE6lQCZdrhD4ogI7c+vuw==}
dependencies:
'@vue/compiler-dom': 3.4.27
'@vue/shared': 3.4.27
dev: true
/@vue/devtools-api@6.6.1:
resolution: {integrity: sha512-LgPscpE3Vs0x96PzSSB4IGVSZXZBZHpfxs+ZA1d+VEPwHdOXowy/Y2CsvCAIFrf+ssVU1pD1jidj505EpUnfbA==}
@ -2087,8 +2125,8 @@ packages:
optional: true
dependencies:
'@volar/language-core': 2.2.0-alpha.8
'@vue/compiler-dom': 3.4.21
'@vue/shared': 3.4.21
'@vue/compiler-dom': 3.4.27
'@vue/shared': 3.4.27
computeds: 0.0.1
minimatch: 9.0.3
path-browserify: 1.0.1
@ -2130,6 +2168,10 @@ packages:
/@vue/shared@3.4.26:
resolution: {integrity: sha512-Fg4zwR0GNnjzodMt3KRy2AWGMKQXByl56+4HjN87soxLNU9P5xcJkstAlIeEF3cU6UYOzmJl1tV0dVPGIljCnQ==}
/@vue/shared@3.4.27:
resolution: {integrity: sha512-DL3NmY2OFlqmYYrzp39yi3LDkKxa5vZVwxWdQ3rG0ekuWscHraeIbnI8t+aZK7qhYqEqWKTUdijadunb9pnrgA==}
dev: true
/@vue/test-utils@2.4.3(vue@3.4.26):
resolution: {integrity: sha512-F4K7mF+ad++VlTrxMJVRnenKSJmO6fkQt2wpRDiKDesQMkfpniGWsqEi/JevxGBo2qEkwwjvTUAoiGJLNx++CA==}
peerDependencies:
@ -2842,7 +2884,7 @@ packages:
resolution: {integrity: sha512-m7pOT6CdLN7FuXUcpuz/8lfQ/L77x8SchHCF4G0RBTJO20Wzmhn5Sp4/5WsKy8OSpifBSUrmg83qEqaDHdyFuQ==}
dependencies:
inflation: 2.1.0
qs: 6.12.0
qs: 6.12.1
raw-body: 2.5.2
type-is: 1.6.18
dev: true
@ -2926,6 +2968,10 @@ packages:
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
dev: true
/confbox@0.1.7:
resolution: {integrity: sha512-uJcB/FKZtBMCJpK8MQji6bJHgu1tixKPxRLeGkNzBoOZzpnZUJm0jm2/sBDWcuBx1dYgxV4JU+g5hmNxCyAmdA==}
dev: true
/config-chain@1.1.13:
resolution: {integrity: sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==}
dependencies:
@ -4324,7 +4370,7 @@ packages:
dezalgo: 1.0.4
hexoid: 1.0.0
once: 1.4.0
qs: 6.12.0
qs: 6.12.1
dev: true
/fraction.js@4.3.7:
@ -5239,7 +5285,7 @@ packages:
acorn: 8.11.3
eslint-visitor-keys: 3.4.3
espree: 9.6.1
semver: 7.6.0
semver: 7.6.1
dev: true
/jsonc-parser@3.2.1:
@ -5679,7 +5725,7 @@ packages:
dependencies:
acorn: 8.11.3
pathe: 1.1.2
pkg-types: 1.0.3
pkg-types: 1.1.0
ufo: 1.5.3
dev: true
@ -6106,6 +6152,10 @@ packages:
/picocolors@1.0.0:
resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==}
/picocolors@1.0.1:
resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==}
dev: true
/picomatch@2.3.1:
resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==}
engines: {node: '>=8.6'}
@ -6151,6 +6201,14 @@ packages:
pathe: 1.1.2
dev: true
/pkg-types@1.1.0:
resolution: {integrity: sha512-/RpmvKdxKf8uILTtoOhAgf30wYbP2Qw+L9p3Rvshx1JZVX+XQNZQFjlbmGHEGIm4CkVPlSn+NXmIM8+9oWQaSA==}
dependencies:
confbox: 0.1.7
mlly: 1.6.1
pathe: 1.1.2
dev: true
/please-upgrade-node@3.2.0:
resolution: {integrity: sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg==}
dependencies:
@ -6290,8 +6348,8 @@ packages:
engines: {node: '>=6'}
dev: true
/qs@6.12.0:
resolution: {integrity: sha512-trVZiI6RMOkO476zLGaBIzszOdFPnCCXHPG9kn0yuS1uz6xdVxPfZdB3vUig9pxPFDM9BRAgz/YUIVQ1/vuiUg==}
/qs@6.12.1:
resolution: {integrity: sha512-zWmv4RSuB9r2mYQw3zxQuHWeU+42aKi1wWig/j4ele4ygELZ7PEO6MM7rim9oAQH2A5MWfsAVf/jPvTPgCbvUQ==}
engines: {node: '>=0.6'}
dependencies:
side-channel: 1.0.6
@ -7117,7 +7175,7 @@ packages:
css-select: 4.3.0
css-tree: 1.1.3
csso: 4.2.0
picocolors: 1.0.0
picocolors: 1.0.1
stable: 0.1.8
dev: true
@ -7132,7 +7190,7 @@ packages:
css-tree: 2.3.1
css-what: 6.1.0
csso: 5.0.5
picocolors: 1.0.0
picocolors: 1.0.1
dev: true
/synckit@0.8.8:
@ -7540,6 +7598,16 @@ packages:
webpack-virtual-modules: 0.6.1
dev: true
/unplugin@1.10.1:
resolution: {integrity: sha512-d6Mhq8RJeGA8UfKCu54Um4lFA0eSaRa3XxdAJg8tIdxbu1ubW0hBCZUL7yI2uGyYCRndvbK8FLHzqy2XKfeMsg==}
engines: {node: '>=14.0.0'}
dependencies:
acorn: 8.11.3
chokidar: 3.6.0
webpack-sources: 3.2.3
webpack-virtual-modules: 0.6.1
dev: true
/unset-value@1.0.0:
resolution: {integrity: sha512-PcA2tsuGSF9cnySLHTLSh2qrQiJ70mn+r+Glzxv2TWZblxsxCC52BDlZoPCsz7STd9pN7EZetkWZBAvk4cgZdQ==}
engines: {node: '>=0.10.0'}
@ -7975,8 +8043,8 @@ packages:
- supports-color
dev: true
/vue-hooks-plus@1.9.0(vue@3.4.26):
resolution: {integrity: sha512-LN2EClFHPPtNBlLMg1dlvywFiqex7eGrv/8xQC+EQJj1evL2hOZ1MO6CGccRucw4zkkD23y6RdIH0Ub839RYUQ==}
/vue-hooks-plus@2.1.0(vue@3.4.26):
resolution: {integrity: sha512-UkwmyoFX8WlfHgkqgDJ1jTLvVohtspRR8JFIZYCAgG01nqYVxoTiHZbEhOdIMH1Ba0CxP/xL26knT1+a2w5JpQ==}
peerDependencies:
vue: ^3.2.25
dependencies:
@ -7984,7 +8052,7 @@ packages:
'@vue/devtools-api': 6.6.1
js-cookie: 3.0.5
lodash: 4.17.21
qs: 6.12.0
qs: 6.12.1
query-string: 7.1.3
screenfull: 5.2.0
vue: 3.4.26(typescript@5.2.2)
@ -8001,8 +8069,8 @@ packages:
'@vue/devtools-api': 6.6.1
vue: 3.4.26(typescript@5.2.2)
/vue-router@4.3.0(vue@3.4.26):
resolution: {integrity: sha512-dqUcs8tUeG+ssgWhcPbjHvazML16Oga5w34uCUmsk7i0BcnskoLGwjpa15fqMr2Fa5JgVBrdL2MEgqz6XZ/6IQ==}
/vue-router@4.3.2(vue@3.4.26):
resolution: {integrity: sha512-hKQJ1vDAZ5LVkKEnHhmm1f9pMiWIBNGF5AwU67PdH7TyXCj/a4hTccuUuYCAMgJK6rO/NVYtQIEN3yL8CECa7Q==}
peerDependencies:
vue: ^3.2.0
dependencies:

View File

@ -88,13 +88,11 @@ const props = {
* @description
* text text
*
* 使text
*
* @default false
* @default true
*/
watchText: {
type: Boolean,
default: false,
default: true,
},
/**
*

View File

@ -77,7 +77,7 @@ export default defineComponent({
...this.$slots,
default: () => (
<iframe
class={['ray-iframe__container', this.wrapperClass]}
class={['ray-iframe__container', this.iframeClass]}
ref="iframeRef"
src={this.src}
allow={this.allow}

View File

@ -93,7 +93,7 @@ const props = {
type: Boolean,
default: true,
},
wrapperClass: {
iframeClass: {
type: String,
default: null,
},

View File

@ -10,6 +10,7 @@
*/
import { modalProps } from 'naive-ui'
import type { PropType } from 'vue'
const props = {
...modalProps,
@ -43,7 +44,7 @@ const props = {
* @default 600
*/
width: {
type: [String, Number],
type: [String, Number] as PropType<string | number>,
default: 600,
},
/**
@ -54,7 +55,7 @@ const props = {
* @default 600
*/
cardWidth: {
type: [String, Number],
type: [String, Number] as PropType<string | number>,
default: 600,
},
/**
@ -65,7 +66,7 @@ const props = {
* @default 446
*/
dialogWidth: {
type: [String, Number],
type: [String, Number] as PropType<string | number>,
default: 446,
},
/**

View File

@ -24,7 +24,7 @@ export interface RModalProps extends NaiveModalOptions {
*
* @default 600
*/
width?: number
width?: number | string
/**
*
* @description
@ -32,7 +32,7 @@ export interface RModalProps extends NaiveModalOptions {
*
* @default 600
*/
cardWidth?: number
cardWidth?: number | string
/**
*
* @description
@ -40,7 +40,7 @@ export interface RModalProps extends NaiveModalOptions {
*
* @default 446
*/
dialogWidth?: number
dialogWidth?: number | string
/**
*
* @description

View File

@ -19,13 +19,13 @@ export default defineComponent({
name: 'RMoreDropdown',
props,
render() {
const { iconSize, cursor } = this
const { iconSize, cursor, icon } = this
const { default: $default } = this.$slots
return (
<NDropdown {...this.$props} {...this.$attrs} placement="bottom-start">
{renderNode($default, {
defaultElement: <RIcon name="more" size={iconSize} cursor={cursor} />,
defaultElement: <RIcon name={icon} size={iconSize} cursor={cursor} />,
})}
</NDropdown>
)

View File

@ -13,6 +13,10 @@ import { dropdownProps } from 'naive-ui'
const props = {
...dropdownProps,
icon: {
type: String,
default: 'more',
},
iconSize: {
type: Number,
default: 14,

View File

@ -9,14 +9,51 @@ export interface RSegmentPopover extends ExtractPublicPropTypes<PopoverProps> {
}
export interface RSegmentOptions {
/**
*
* @description
*
*/
label: string | VNode | (() => VNodeChild)
/**
*
* @description
* key
*/
key: string | number
/**
*
* @description
*
*
* @see https://www.naiveui.com/zh-CN/dark/components/tabs#TabPane-Props
*/
displayDirective?: TabPaneProps['displayDirective']
/**
*
* @description
*
*/
disabled?: boolean
/**
*
* @description
*
*/
slots?: {
default?: () => VNode | string | number
}
/**
*
* @description
* popover
*/
popover?: string | RSegmentPopover
/**
*
* @description
*
*/
icon?: VNode
}

View File

@ -203,7 +203,11 @@ export default defineComponent({
const { onRegister } = props
if (onRegister && rTableInst.value) {
call(onRegister, rTableInst.value)
call(onRegister, rTableInst.value, {
uuidTable,
uuidWrapper,
wrapperRef,
})
}
})

View File

@ -34,7 +34,7 @@ import type { MaybeArray } from '@/types'
type FixedClick = (type: 'left' | 'right', option: C, index: number) => void
const renderSwitcherIcon = () => (
<RIcon name="draggable" size={14} cursor="all-scroll" />
<RIcon name="draggable" size={14} cursor="grab" />
)
const RowIconRender = ({

View File

@ -3,6 +3,11 @@ import { effectDispose } from '@/utils'
import type { Recordable } from '@/types'
import type { MaybeRef } from '@vueuse/core'
import type {
DataTableColumns,
DataTableColumn,
DataTableSelectionColumn,
} from 'naive-ui'
export type RowKey = string | number
@ -73,6 +78,27 @@ const findRow = (
return void 0
}
const isMultiple = (columns: MaybeRef<DataTableColumns<any> | undefined>) => {
const unrefColumns = unref(columns)
if (unrefColumns) {
const idx = unrefColumns.findIndex((column) => {
const { type, multiple } = column as DataTableSelectionColumn
if (
type === 'selection' &&
(multiple === void 0 || multiple === null || multiple === true)
) {
return true
}
})
return idx !== -1
}
return true
}
/**
*
* @param data DataTable
@ -100,16 +126,21 @@ const findRow = (
*
* const data = ref([{ ...table data }])
* const columns = [{ ...table columns }]
* const [checkedRowKeys, { checkedRowKeysBind }] = useCheckedRowKeys(data, { rowKey: 'key' })
* const [checkedRowKeys, { checkedRowKeysBind }] = useCheckedRowKeys(data, { rowKey: 'key' }, multiple: true)
* </script>
*/
const useCheckedRowKeys = <T extends Recordable>(
const useCheckedRowKeys = <
T extends Recordable,
C extends DataTableColumns<any>,
>(
data: MaybeRef<T[] | undefined>,
columns: MaybeRef<C | undefined>,
options?: UseCheckedRowKeysOptions<T>,
) => {
const keysRef = ref<RowKey[]>([])
const rowsRef = ref<any[]>([])
const { rowKey: bindRowKey = 'key', onChange } = options || {}
const currentColumnIsMultiple = computed(() => isMultiple(columns))
/**
*
@ -139,6 +170,8 @@ const useCheckedRowKeys = <T extends Recordable>(
action: Action
},
)
isMultiple(columns)
}
/**
@ -212,20 +245,23 @@ const useCheckedRowKeys = <T extends Recordable>(
*
* @description
* keys
*
* keys data rows rows rows
*
* multiple false key
* key multiple true
*/
const selectKey = (key: RowKey) => {
if (keysRef.value.includes(key)) {
return
}
keysRef.value.push(key)
const multiple = !currentColumnIsMultiple.value && keysRef.value.length >= 1
const row = findRow(unref(data) || [], bindRowKey, key)
multiple ? (keysRef.value = [key]) : keysRef.value.push(key)
if (row) {
rowsRef.value.push(row)
multiple ? (rowsRef.value = [row]) : rowsRef.value.push(row)
onChange?.(keysRef.value, rowsRef.value, {
row: row as any,

View File

@ -1,3 +1,5 @@
import { printDom } from '@/utils'
import type {
RTableInst,
CsvOptionsType,
@ -5,6 +7,8 @@ import type {
ScrollToOptions,
ColumnKey,
SortOrder,
UseTableRegister,
TableProvider,
} from '../types'
/**
@ -37,10 +41,12 @@ import type {
*/
const useTable = () => {
const tableRef = ref<RTableInst>()
let extra = {} as TableProvider
const register = (inst: RTableInst) => {
const register: UseTableRegister = (inst, extraInfo) => {
if (inst) {
tableRef.value = inst
extra = extraInfo
}
}
@ -55,6 +61,7 @@ const useTable = () => {
'[useTable]: table instance is not ready yet. if you are using useTable, please make sure you have called register method in onRegister event.',
)
}
console.log(tableRef.value)
return tableRef.value
}
@ -127,6 +134,21 @@ const useTable = () => {
const sort = (columnKey: ColumnKey, order: SortOrder) =>
getTableInstance().sort.call(null, columnKey, order)
/**
*
* @description
*
*/
const print = () => {
const { uuidWrapper } = extra
if (uuidWrapper) {
const tableWrapperElement = document.getElementById(uuidWrapper)
printDom(tableWrapperElement)
}
}
return [
register,
{
@ -138,6 +160,7 @@ const useTable = () => {
page,
scrollTo,
sort,
print,
},
] as const
}

View File

@ -19,6 +19,7 @@ import type {
PrintTableOptions,
RTableInst,
RTableCardProps,
UseTableRegister,
} from './types'
import type { Recordable } from '@/types'
@ -211,9 +212,7 @@ const props = {
* @default null
*/
onRegister: {
type: [Function, Array] as PropType<
MaybeArray<(tableInst: RTableInst) => void>
>,
type: [Function, Array] as PropType<MaybeArray<UseTableRegister>>,
default: null,
},
} as const

View File

@ -72,3 +72,8 @@ type SortParameters = Parameters<RTableInst['sort']>
export type ColumnKey = SortParameters[0]
export type SortOrder = SortParameters[1]
export type UseTableRegister = (
tableInst: RTableInst,
extra: TableProvider,
) => void

View File

@ -1,26 +1,27 @@
<template>
<!-- 这是一个魔法注释删不的如果删了会出现一个异常提示不信你试试 -->
<RouterView v-slot="{ Component, route }">
<template v-if="Component">
<Transition
:name="transitionPropName"
:mode="transitionMode"
:appear="transitionAppear"
>
<Suspense>
<KeepAlive
v-if="setupKeepAlive"
:max="maxKeepAliveLength"
:include="getKeepAliveInclude"
:exclude="keepAliveExclude"
>
<Component :is="Component" :key="route.fullPath" />
</KeepAlive>
<Component :is="Component" v-else :key="route.fullPath" />
</Suspense>
</Transition>
</template>
</RouterView>
<div>
<RouterView v-slot="{ Component, route }">
<template v-if="Component">
<Transition
:name="transitionPropName"
:mode="transitionMode"
:appear="transitionAppear"
>
<Suspense>
<KeepAlive
v-if="setupKeepAlive"
:max="maxKeepAliveLength"
:include="getKeepAliveInclude"
:exclude="keepAliveExclude"
>
<Component :is="Component" :key="route.fullPath" />
</KeepAlive>
<Component :is="Component" v-else :key="route.fullPath" />
</Suspense>
</Transition>
</template>
</RouterView>
</div>
</template>
<script lang="ts" setup>
import { useKeepAliveGetters } from '@/store'

View File

@ -46,7 +46,7 @@ export function useAppRoot() {
* @example
* setRootRoute({ path: '/your root path', name: 'your root name' })
*/
const setRootRoute = (route: AppRootRoute) => {
const setRootRoute = (route: Partial<AppRootRoute>) => {
updateSettingState(
'appRootRoute',
Object.assign({}, getAppRootRoute.value, route),

View File

@ -13,6 +13,29 @@ import { useSettingActions, useSettingGetters } from '@/store'
import { useI18n } from '@/hooks'
import { APP_THEME } from '@/app-config'
export type ThemeLabel = 'Dark' | 'Light'
export interface AppThemeInfo {
/**
*
* @description
* true false
*/
theme: boolean
/**
*
* @description
*
*/
themeLabel: ThemeLabel
/**
*
* @description
*
*/
themeI18nLabel: string
}
const setThemeOverrides = (theme: boolean) => {
const { getPrimaryColorOverride } = useSettingGetters()
const { updateSettingState } = useSettingActions()
@ -46,15 +69,16 @@ export const useTheme = () => {
* getAppTheme() // { theme: true, themeLabel: '暗色' | 'Dark' }
* getAppTheme() // { theme: false, themeLabel: '亮色' | 'Light' }
*/
const getAppTheme = () => {
const getAppTheme = (): AppThemeInfo => {
const { getAppTheme } = useSettingGetters()
const { t } = useI18n()
return {
theme: getAppTheme.value,
themeLabel: getAppTheme.value
themeI18nLabel: getAppTheme.value
? t('headerSettingOptions.ThemeOptions.Dark')
: t('headerSettingOptions.ThemeOptions.Light'),
themeLabel: getAppTheme.value ? 'Dark' : 'Light',
}
}
@ -64,9 +88,9 @@ export const useTheme = () => {
*
*
* @example
* changeDarkTheme()
* darkTheme()
*/
const changeDarkTheme = () => {
const darkTheme = () => {
const { updateSettingState } = useSettingActions()
updateSettingState('appTheme', true)
@ -79,9 +103,9 @@ export const useTheme = () => {
*
*
* @example
* changeLightTheme()
* lightTheme()
*/
const changeLightTheme = () => {
const lightTheme = () => {
const { updateSettingState } = useSettingActions()
updateSettingState('appTheme', false)
@ -110,8 +134,8 @@ export const useTheme = () => {
}
return {
changeDarkTheme,
changeLightTheme,
darkTheme,
lightTheme,
toggleTheme,
getAppTheme,
}

View File

@ -22,6 +22,15 @@ export interface DateRange {
end: dayjs.ConfigType
}
export interface StartAndEndOfDay {
today: dayjs.Dayjs
startOfDay: dayjs.Dayjs
endOfDay: dayjs.Dayjs
formatToday: string
formatStartOfDay: string
formatEndOfDay: string
}
export type LocalKey = typeof DEFAULT_DAYJS_LOCAL
const defaultDayjsFormat = 'YYYY-MM-DD HH:mm:ss'
@ -61,7 +70,7 @@ export const useDayjs = () => {
*
* @example
* isDayjs('2022-11-11') // false
* isDayjs('1699687245973) // false
* isDayjs('1699687245973') // false
* isDayjs(dayjs()) // true
*/
const isDayjs = (d: unknown) => {
@ -96,7 +105,9 @@ export const useDayjs = () => {
*
*
*/
const getStartAndEndOfDay = (formatOption?: FormatOption) => {
const getStartAndEndOfDay = (
formatOption?: FormatOption,
): Readonly<StartAndEndOfDay> => {
const { format = defaultDayjsFormat } = formatOption ?? {}
const today = dayjs()
const startOfDay = today.startOf('day')

View File

@ -154,6 +154,21 @@ export const usePagination = <T extends AnyFC>(
callbackRef.value = callback as any
}
/**
*
* @description
*
*
* 1 pageSizes
* pageSizes 10
*/
const resetPagination = () => {
const { pageSizes } = paginationRef.value
paginationRef.value.page = 1
paginationRef.value.pageSize = (pageSizes?.[0] as number) || 10
}
effectDispose(() => {
callbackRef.value = void 0
})
@ -161,8 +176,6 @@ export const usePagination = <T extends AnyFC>(
return [
paginationRef as Ref<UsePaginationOptions>,
{
updatePage,
updatePageSize,
getItemCount,
setItemCount,
getPage,
@ -172,6 +185,7 @@ export const usePagination = <T extends AnyFC>(
getPagination,
getCallback,
setCallback,
resetPagination,
},
] as const
}

View File

@ -18,7 +18,7 @@ import { useTheme } from '@/hooks'
export default defineComponent({
name: 'ThemeSwitch',
setup() {
const { changeDarkTheme, changeLightTheme } = useTheme()
const { darkTheme, lightTheme } = useTheme()
const { getAppTheme } = useSettingGetters()
const modelAppThemeRef = ref(getAppTheme.value)
@ -33,15 +33,15 @@ export default defineComponent({
}
return {
changeDarkTheme,
changeLightTheme,
darkTheme,
lightTheme,
getAppTheme,
railStyle,
modelAppThemeRef,
}
},
render() {
const { $t, changeDarkTheme, changeLightTheme, railStyle } = this
const { $t, darkTheme, lightTheme, railStyle } = this
return (
<NFlex justify="center">
@ -52,7 +52,7 @@ export default defineComponent({
v-model:value={this.modelAppThemeRef}
railStyle={railStyle.bind(this)}
onUpdateValue={(bool: boolean) =>
bool ? changeDarkTheme() : changeLightTheme()
bool ? darkTheme() : lightTheme()
}
>
{{

View File

@ -16,7 +16,8 @@ export const useSigningGetters = () => {
/**
*
* @remark
* @description
*
*/
const getSigningCallback = computed(() => variable.signingCallback)

View File

@ -22,6 +22,7 @@
import { isEmpty } from 'lodash-es'
import { removeStorage } from '@/utils'
import { APP_CATCH_KEY } from '@/app-config'
import { useSiderBar } from '@/hooks'
import type {
SigningForm,
@ -44,9 +45,9 @@ export const piniaSigningStore = defineStore(
/**
*
* @param SigningForm
* @returns
*
* @remark 0: 登陆成功, 1: 登陆失败
* @description
* 0: 登陆成功, 1: 登陆失败
*/
const signing = (SigningForm: SigningForm): Promise<SigningResponse> => {
return new Promise((resolve, reject) => {
@ -78,8 +79,11 @@ export const piniaSigningStore = defineStore(
* 300ms
*/
const logout = () => {
const { closeAll } = useSiderBar()
window.$message.info('账号退出中...')
removeStorage('__all_sessionStorage__', 'sessionStorage')
closeAll()
setTimeout(() => window.location.reload())
}

View File

@ -20,6 +20,7 @@ import {
NFlex,
NPopover,
NCard,
NAlert,
} from 'naive-ui'
import { RCollapseGrid, RTable, RIcon, RMoreDropdown } from '@/components'
@ -51,6 +52,7 @@ const TableView = defineComponent({
filters,
sort,
downloadCsv,
print,
},
] = useTable()
@ -151,13 +153,13 @@ const TableView = defineComponent({
const [
checkedRowKeys,
{ checkedRowKeysBind, getKeys, getRows, clearKey, clearAll, selectKey },
] = useCheckedRowKeys(tableData, {
] = useCheckedRowKeys(tableData, actionColumns, {
rowKey: 'key',
onChange: (keys, rows, meta) => {},
})
const createTableData = () => {
for (let i = 0; i < 20; i++) {
for (let i = 0; i < 10; i++) {
tableData.value.push({
key: uuid(),
name: i % 2 === 0 ? 'John Brown' : 'Jim Green',
@ -216,6 +218,8 @@ const TableView = defineComponent({
filters,
sort,
downloadCsv,
getTableInstance,
print,
}
},
render() {
@ -232,6 +236,10 @@ const TableView = defineComponent({
filters,
sort,
downloadCsv,
getTableInstance,
getRows,
getKeys,
print,
} = this
return (
@ -241,17 +249,32 @@ const TableView = defineComponent({
</NCard>
<NCard title="useTable">
<NFlex align="center">
<NButton onClick={clearSorter.bind(this)}></NButton>
<NButton onClick={clearFilters.bind(this)}></NButton>
<NButton
onClick={() => {
downloadCsv()
}}
>
CSV
</NButton>
<div> Naive UI </div>
<NFlex vertical style="width: 100%">
<NAlert title="DataTable Methods" type="info">
{' '}
<a
style="color: transparent"
href="https://www.naiveui.com/zh-CN/dark/components/data-table#DataTable-Methods"
>
Naive UI
</a>
</NAlert>
<NFlex>
<NButton onClick={clearSorter.bind(this)}></NButton>
<NButton onClick={clearFilters.bind(this)}></NButton>
<NButton
onClick={() => {
downloadCsv()
}}
>
CSV
</NButton>
<NButton onClick={getTableInstance.bind(this)}>
getTableInstance
</NButton>
<NButton onClick={print.bind(this)}></NButton>
</NFlex>
</NFlex>
</NCard>
<NCard title="useCheckedRowKeys">

View File

@ -40,8 +40,7 @@ export default defineComponent({
setWatermarkContent,
toggleWatermark,
} = useWatermark()
const { changeDarkTheme, changeLightTheme, toggleTheme, getAppTheme } =
useTheme()
const { darkTheme, lightTheme, toggleTheme, getAppTheme } = useTheme()
const {
hidden: badgeHidden,
show: badgeShow,
@ -61,8 +60,8 @@ export default defineComponent({
setWatermarkContent,
watermark,
toggleWatermark,
changeDarkTheme,
changeLightTheme,
darkTheme,
lightTheme,
toggleTheme,
getAppTheme,
isLayoutContentMaximized,
@ -83,8 +82,8 @@ export default defineComponent({
hiddenWatermark,
setWatermarkContent,
toggleWatermark,
changeDarkTheme,
changeLightTheme,
darkTheme,
lightTheme,
toggleTheme,
getAppTheme,
isLayoutContentMaximized,
@ -147,8 +146,8 @@ export default defineComponent({
<NFlex vertical>
<h3>getAppTheme : {getAppTheme().themeLabel}</h3>
<NFlex>
<NButton onClick={() => changeDarkTheme()}></NButton>
<NButton onClick={() => changeLightTheme()}></NButton>
<NButton onClick={() => darkTheme()}></NButton>
<NButton onClick={() => lightTheme()}></NButton>
<NButton onClick={() => toggleTheme()}></NButton>
</NFlex>
</NFlex>

View File

@ -102,37 +102,35 @@ const config: AppConfigExport = {
*
*/
buildOptions: (mode: string): BuildOptions => {
const outDirMap = {
test: 'dist/test-dist',
development: 'dist/development-dist',
production: 'dist/production-dist',
report: 'dist/report-dist',
const productionBuildOptions = {
sourcemap: false,
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true,
},
},
}
const dirPath = outDirMap[mode] || 'dist/test-dist'
const defaultOptions = {
sourcemap: true,
terserOptions: {
compress: {
drop_console: false,
drop_debugger: false,
},
},
}
const outDir = `dist/${mode}`
if (mode === 'production') {
return {
outDir: dirPath,
sourcemap: false,
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true,
},
},
}
} else {
return {
outDir: dirPath,
sourcemap: true,
terserOptions: {
compress: {
drop_console: false,
drop_debugger: false,
},
},
}
}
return mode === 'production'
? {
...productionBuildOptions,
outDir,
}
: {
...defaultOptions,
outDir,
}
},
/**
*

View File

@ -25,11 +25,9 @@ export default defineConfig((configEnv) =>
* @see https://github.com/vitest-dev/vitest/issues/740
*
*
*
* v4.8.5
*/
threads: {
maxThreads: 1,
minThreads: 0,
},
},
},
}),