提交 f18d6d44 作者: 方治民

合并分支 '3.x' 到 'main'

3.x

查看合并请求 !21
...@@ -76,6 +76,7 @@ module.exports = { ...@@ -76,6 +76,7 @@ module.exports = {
'vue/multi-word-component-names': 'off', 'vue/multi-word-component-names': 'off',
'vue/no-reserved-component-names': 'off', 'vue/no-reserved-component-names': 'off',
'vue/no-constant-condition': 'off', 'vue/no-constant-condition': 'off',
'vue/no-setup-props-destructure': 'off',
'no-console': 'off', 'no-console': 'off',
'antfu/if-newline': 'off', 'antfu/if-newline': 'off',
'symbol-description': 'off', 'symbol-description': 'off',
......
...@@ -2,3 +2,5 @@ ...@@ -2,3 +2,5 @@
* The name of the configuration file entered in the production environment * The name of the configuration file entered in the production environment
*/ */
export const GLOB_CONFIG_FILE_NAME = '_app.config.js' export const GLOB_CONFIG_FILE_NAME = '_app.config.js'
export const OUTPUT_DIR = 'dist'
import path from 'node:path' import path from 'node:path'
import process from 'node:process'
import fs from 'fs-extra' import fs from 'fs-extra'
import inquirer from 'inquirer' import inquirer from 'inquirer'
import colors from 'picocolors' import colors from 'picocolors'
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
* Get the configuration file variable name * Get the configuration file variable name
* @param env * @param env
*/ */
export const getConfigFileName = (env: Record<string, any>) => { export function getConfigFileName(env: Record<string, any>) {
return `__PRODUCTION__${env.VITE_GLOB_APP_SHORT_NAME || '__APP'}__CONF__`.toUpperCase().replace(/\s/g, '') return `__PRODUCTION__${env.VITE_GLOB_APP_SHORT_NAME || '__APP'}__CONF__`.toUpperCase().replace(/\s/g, '')
} }
/**
* Generate additional configuration files when used for packaging. The file can be configured with some global variables, so that it can be changed directly externally without repackaging
*/
import fs, { writeFileSync } from 'fs-extra'
import colors from 'picocolors'
import { GLOB_CONFIG_FILE_NAME, OUTPUT_DIR } from '../constant'
import { getEnvConfig, getRootPath } from '../utils'
import { getConfigFileName } from '../getConfigFileName'
import pkg from '../../package.json'
interface CreateConfigParams {
configName: string
config: any
configFileName?: string
}
function createConfig(params: CreateConfigParams) {
const { configName, config, configFileName } = params
try {
const windowConf = `window.${configName}`
// Ensure that the variable will not be modified
let configStr = `${windowConf}=${JSON.stringify(config)};`
configStr += `
Object.freeze(${windowConf});
Object.defineProperty(window, "${configName}", {
configurable: false,
writable: false,
});
`.replace(/\s/g, '')
fs.mkdirp(getRootPath(OUTPUT_DIR))
writeFileSync(getRootPath(`${OUTPUT_DIR}/${configFileName}`), configStr)
console.log(`${colors.cyan(`✨ [${pkg.name}]`)} - configuration file is build successfully:`)
console.log(`${colors.gray(`${OUTPUT_DIR}/${colors.green(configFileName)}`)}\n`)
} catch (error) {
console.log(colors.red(`configuration file configuration file failed to package:\n${error}`))
}
}
export function runBuildConfig() {
const config = getEnvConfig()
const configFileName = getConfigFileName(config)
createConfig({ config, configName: configFileName, configFileName: GLOB_CONFIG_FILE_NAME })
}
// #!/usr/bin/env node
import process from 'node:process'
import colors from 'picocolors'
import pkg from '../../package.json'
import { runBuildConfig } from './buildConf'
export async function runBuild() {
try {
const argvList = process.argv.splice(2)
// Generate configuration file
if (!argvList.includes('disabled-config')) {
runBuildConfig()
}
console.log(`✨ ${colors.cyan(`[${pkg.name}]`)}` + ' - build successfully!')
} catch (error) {
console.log(colors.red(`vite build error:\n${error}`))
process.exit(1)
}
}
runBuild()
import fs from 'node:fs' import fs from 'node:fs'
import path from 'node:path' import path from 'node:path'
import process from 'node:process'
import dotenv from 'dotenv' import dotenv from 'dotenv'
export function isDevFn(mode: string): boolean { export function isDevFn(mode: string): boolean {
......
import process from 'node:process'
import type { PluginOption } from 'vite' import type { PluginOption } from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx' import vueJsx from '@vitejs/plugin-vue-jsx'
...@@ -15,7 +16,6 @@ import { configVisualizerConfig } from './visualizer' ...@@ -15,7 +16,6 @@ import { configVisualizerConfig } from './visualizer'
import { configThemePlugin } from './theme' import { configThemePlugin } from './theme'
import { configSvgIconsPlugin } from './svgSprite' import { configSvgIconsPlugin } from './svgSprite'
import { configAutoImportPlugin } from './autoImport' import { configAutoImportPlugin } from './autoImport'
import { configBuildPlugin } from './config'
export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) { export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
const { VITE_USE_MOCK, VITE_LEGACY, VITE_BUILD_COMPRESS, VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE } = viteEnv const { VITE_USE_MOCK, VITE_LEGACY, VITE_BUILD_COMPRESS, VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE } = viteEnv
...@@ -65,7 +65,7 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) { ...@@ -65,7 +65,7 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
// The following plugins only work in the production environment // The following plugins only work in the production environment
if (isBuild) { if (isBuild) {
// config // config
vitePlugins.push(configBuildPlugin()) // vitePlugins.push(configBuildPlugin())
if (process.env.RUNTIME !== 'electron') { if (process.env.RUNTIME !== 'electron') {
// rollup-plugin-gzip // rollup-plugin-gzip
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
*/ */
import path from 'node:path' import path from 'node:path'
import process from 'node:process'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons' import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
export function configSvgIconsPlugin(isBuild: boolean) { export function configSvgIconsPlugin(isBuild: boolean) {
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* https://github.com/anncwb/vite-plugin-theme * https://github.com/anncwb/vite-plugin-theme
*/ */
import path from 'node:path' import path from 'node:path'
import process from 'node:process'
import type { PluginOption } from 'vite' import type { PluginOption } from 'vite'
import { antdDarkThemePlugin, mixDarken, mixLighten, tinycolor, viteThemePlugin } from 'vite-plugin-theme' import { antdDarkThemePlugin, mixDarken, mixLighten, tinycolor, viteThemePlugin } from 'vite-plugin-theme'
import { generateColors, getThemeColors } from '../../config/themeConfig' import { generateColors, getThemeColors } from '../../config/themeConfig'
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
"bootstrap": "pnpm install", "bootstrap": "pnpm install",
"serve": "npm run dev", "serve": "npm run dev",
"dev": "vite", "dev": "vite",
"build": "vite build", "build": "vite build && esno ./build/script/postBuild.ts",
"build:test": "vite build --mode test", "build:test": "vite build --mode test",
"build:preview": "vite build --mode preview", "build:preview": "vite build --mode preview",
"build:no-cache": "pnpm clean:cache && npm run build", "build:no-cache": "pnpm clean:cache && npm run build",
...@@ -56,23 +56,23 @@ ...@@ -56,23 +56,23 @@
"dependencies": { "dependencies": {
"@ant-design/colors": "^7.0.0", "@ant-design/colors": "^7.0.0",
"@ant-design/icons-vue": "^6.1.0", "@ant-design/icons-vue": "^6.1.0",
"@iconify/iconify": "^3.1.0", "@iconify/iconify": "^3.1.1",
"@logicflow/core": "^1.2.8", "@logicflow/core": "^1.2.10",
"@logicflow/extension": "^1.2.8", "@logicflow/extension": "^1.2.10",
"@stomp/stompjs": "^7.0.0", "@stomp/stompjs": "^7.0.0",
"@vue/runtime-core": "^3.3.4", "@vue/runtime-core": "^3.3.4",
"@vue/shared": "^3.3.4", "@vue/shared": "^3.3.4",
"@vueuse/core": "^10.1.2", "@vueuse/core": "^10.3.0",
"@vueuse/shared": "^10.1.2", "@vueuse/shared": "^10.3.0",
"@zxcvbn-ts/core": "^2.2.1", "@zxcvbn-ts/core": "^2.2.1",
"ant-design-vue": "^3.2.20", "ant-design-vue": "^3.2.20",
"axios": "^0.26.1", "axios": "^0.26.1",
"codemirror": "^5.65.13", "codemirror": "^5.65.14",
"cropperjs": "^1.5.13", "cropperjs": "^1.5.13",
"crypto-js": "^4.1.1", "crypto-js": "^4.1.1",
"dayjs": "^1.11.7", "dayjs": "^1.11.9",
"default-passive-events": "^2.0.0", "default-passive-events": "^2.0.0",
"echarts": "^5.4.2", "echarts": "^5.4.3",
"intro.js": "^7.0.1", "intro.js": "^7.0.1",
"js-file-download": "^0.4.12", "js-file-download": "^0.4.12",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
"nanoid": "^4.0.2", "nanoid": "^4.0.2",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"path-to-regexp": "^6.2.1", "path-to-regexp": "^6.2.1",
"pinia": "^2.1.3", "pinia": "^2.1.6",
"print-js": "^1.6.0", "print-js": "^1.6.0",
"qrcode": "^1.5.3", "qrcode": "^1.5.3",
"qs": "^6.11.2", "qs": "^6.11.2",
...@@ -90,96 +90,96 @@ ...@@ -90,96 +90,96 @@
"sortablejs": "^1.15.0", "sortablejs": "^1.15.0",
"stompjs": "^2.3.3", "stompjs": "^2.3.3",
"tinymce": "^5.10.7", "tinymce": "^5.10.7",
"vditor": "^3.9.3", "vditor": "^3.9.4",
"vue": "^3.3.4", "vue": "^3.3.4",
"vue-i18n": "^9.2.2", "vue-i18n": "^9.2.2",
"vue-json-pretty": "^2.2.4", "vue-json-pretty": "^2.2.4",
"vue-router": "^4.2.2", "vue-router": "^4.2.4",
"vue-types": "^5.0.3", "vue-types": "^5.1.1",
"xlsx": "^0.18.5" "xlsx": "^0.18.5"
}, },
"devDependencies": { "devDependencies": {
"@antfu/eslint-config": "^0.39.4", "@antfu/eslint-config": "^0.40.2",
"@commitlint/cli": "^17.6.5", "@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.6.5", "@commitlint/config-conventional": "^17.7.0",
"@iconify/json": "^2.2.72", "@iconify/json": "^2.2.100",
"@types/codemirror": "^5.60.7", "@types/codemirror": "^5.60.8",
"@types/crypto-js": "^4.1.1", "@types/crypto-js": "^4.1.1",
"@types/fs-extra": "^11.0.1", "@types/fs-extra": "^11.0.1",
"@types/inquirer": "^9.0.3", "@types/inquirer": "^9.0.3",
"@types/intro.js": "^5.1.1", "@types/intro.js": "^5.1.1",
"@types/lodash": "^4.14.195", "@types/lodash": "^4.14.197",
"@types/lodash-es": "^4.17.7", "@types/lodash-es": "^4.17.8",
"@types/mockjs": "^1.0.7", "@types/mockjs": "^1.0.7",
"@types/node": "^18.16.16", "@types/node": "^18.17.5",
"@types/nprogress": "^0.2.0", "@types/nprogress": "^0.2.0",
"@types/qrcode": "^1.5.0", "@types/qrcode": "^1.5.1",
"@types/qs": "^6.9.7", "@types/qs": "^6.9.7",
"@types/showdown": "^2.0.1", "@types/showdown": "^2.0.1",
"@types/sockjs-client": "^1.5.1", "@types/sockjs-client": "^1.5.1",
"@types/sortablejs": "^1.15.1", "@types/sortablejs": "^1.15.1",
"@types/stompjs": "^2.3.5", "@types/stompjs": "^2.3.5",
"@typescript-eslint/eslint-plugin": "^5.59.8", "@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.59.8", "@typescript-eslint/parser": "^5.62.0",
"@vitejs/plugin-legacy": "^4.0.4", "@vitejs/plugin-legacy": "^4.1.1",
"@vitejs/plugin-vue": "^4.2.3", "@vitejs/plugin-vue": "^4.2.3",
"@vitejs/plugin-vue-jsx": "^3.0.1", "@vitejs/plugin-vue-jsx": "^3.0.1",
"@vue/compiler-dom": "^3.3.4", "@vue/compiler-dom": "^3.3.4",
"@vue/compiler-sfc": "^3.3.4", "@vue/compiler-sfc": "^3.3.4",
"@vue/test-utils": "^2.3.2", "@vue/test-utils": "^2.4.1",
"autoprefixer": "^10.4.14", "autoprefixer": "^10.4.14",
"commitizen": "^4.3.0", "commitizen": "^4.3.0",
"conventional-changelog-cli": "^2.2.2", "conventional-changelog-cli": "^2.2.2",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"cz-conventional-changelog": "^3.3.0", "cz-conventional-changelog": "^3.3.0",
"cz-git": "^1.6.1", "cz-git": "^1.7.1",
"czg": "^1.6.1", "czg": "^1.7.1",
"dotenv": "^16.1.3", "dotenv": "^16.3.1",
"eslint": "^8.41.0", "eslint": "^8.47.0",
"eslint-config-prettier": "^8.8.0", "eslint-config-prettier": "^8.10.0",
"eslint-plugin-prettier": "^4.2.1", "eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^9.14.1", "eslint-plugin-vue": "^9.17.0",
"esno": "^0.16.3", "esno": "^0.16.3",
"fs-extra": "^11.1.1", "fs-extra": "^11.1.1",
"husky": "^8.0.3", "husky": "^8.0.3",
"inquirer": "^9.2.6", "inquirer": "^9.2.10",
"less": "^4.1.3", "less": "^4.2.0",
"lint-staged": "^13.2.2", "lint-staged": "^13.2.3",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"picocolors": "^1.0.0", "picocolors": "^1.0.0",
"pont-engine": "^1.5.10", "pont-engine": "^1.5.12",
"postcss": "^8.4.24", "postcss": "^8.4.27",
"postcss-html": "^1.5.0", "postcss-html": "^1.5.0",
"postcss-less": "^6.0.0", "postcss-less": "^6.0.0",
"prettier": "^2.8.8", "prettier": "^2.8.8",
"rimraf": "^5.0.1", "rimraf": "^5.0.1",
"rollup": "^3.23.0", "rollup": "^3.28.0",
"rollup-plugin-visualizer": "^5.9.0", "rollup-plugin-visualizer": "^5.9.2",
"sort-package-json": "^2.4.1", "sort-package-json": "^2.5.1",
"stylelint": "^15.6.2", "stylelint": "^15.10.2",
"stylelint-config-recommended": "^12.0.0", "stylelint-config-recommended": "^12.0.0",
"stylelint-config-recommended-vue": "^1.4.0", "stylelint-config-recommended-vue": "^1.5.0",
"stylelint-config-standard": "^33.0.0", "stylelint-config-standard": "^33.0.0",
"stylelint-order": "^6.0.3", "stylelint-order": "^6.0.3",
"terser": "^5.17.7", "terser": "^5.19.2",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "^4.9.5", "typescript": "^4.9.5",
"unplugin-auto-import": "^0.16.4", "unplugin-auto-import": "^0.16.6",
"vite": "^4.3.9", "vite": "^4.4.9",
"vite-plugin-compression": "^0.5.1", "vite-plugin-compression": "^0.5.1",
"vite-plugin-html": "^3.2.0", "vite-plugin-html": "^3.2.0",
"vite-plugin-mkcert": "^1.15.0", "vite-plugin-mkcert": "^1.16.0",
"vite-plugin-mock": "^2.9.8", "vite-plugin-mock": "^2.9.8",
"vite-plugin-purge-icons": "^0.9.2", "vite-plugin-purge-icons": "^0.9.2",
"vite-plugin-pwa": "^0.16.1", "vite-plugin-pwa": "^0.16.4",
"vite-plugin-style-import": "^2.0.0", "vite-plugin-style-import": "^2.0.0",
"vite-plugin-svg-icons": "^2.0.1", "vite-plugin-svg-icons": "^2.0.1",
"vite-plugin-theme": "^0.8.6", "vite-plugin-theme": "^0.8.6",
"vite-plugin-vue-setup-extend": "^0.4.0", "vite-plugin-vue-setup-extend": "^0.4.0",
"vite-plugin-windicss": "^1.9.0", "vite-plugin-windicss": "^1.9.0",
"vue-eslint-parser": "^9.3.0", "vue-eslint-parser": "^9.3.1",
"vue-tsc": "^1.6.5" "vue-tsc": "^1.8.8"
}, },
"engines": { "engines": {
"node": ">=14" "node": ">=14"
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -6,7 +6,7 @@ import { isArray, isDef, isFunction, isNullOrUnDef, isObject, isString } from '/ ...@@ -6,7 +6,7 @@ import { isArray, isDef, isFunction, isNullOrUnDef, isObject, isString } from '/
import { deepMerge } from '/@/utils' import { deepMerge } from '/@/utils'
import { dateItemType, defaultValueComponents, handleInputNumberValue } from '../helper' import { dateItemType, defaultValueComponents, handleInputNumberValue } from '../helper'
import { dateUtil } from '/@/utils/dateUtil' import { dateUtil } from '/@/utils/dateUtil'
import { cloneDeep, uniqBy } from 'lodash-es' import { cloneDeep, get, uniqBy } from 'lodash-es'
import { error } from '/@/utils/log' import { error } from '/@/utils/log'
interface UseFormActionContext { interface UseFormActionContext {
...@@ -93,8 +93,7 @@ export function useFormEvents({ ...@@ -93,8 +93,7 @@ export function useFormEvents({
} else { } else {
nestKeyArray.forEach((nestKey: string) => { nestKeyArray.forEach((nestKey: string) => {
try { try {
// eslint-disable-next-line no-eval const value = get(values, nestKey)
const value = eval(`values${delimiter}${nestKey}`)
if (isDef(value)) { if (isDef(value)) {
formModel[nestKey] = value formModel[nestKey] = value
validKeys.push(nestKey) validKeys.push(nestKey)
......
...@@ -6,16 +6,16 @@ ...@@ -6,16 +6,16 @@
import Icon from '/@/components/Icon/index' import Icon from '/@/components/Icon/index'
import MenuItem from './components/MenuItem.vue' import MenuItem from './components/MenuItem.vue'
import SubMenu from './components/SubMenuItem.vue' import SubMenu from './components/SubMenuItem.vue'
import SimpleMenuTag from './SimpleMenuTag.vue'
import { propTypes } from '/@/utils/propTypes' import { propTypes } from '/@/utils/propTypes'
import { useI18n } from '/@/hooks/web/useI18n' import { useI18n } from '/@/hooks/web/useI18n'
import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent'
export default defineComponent({ export default defineComponent({
name: 'SimpleSubMenu', name: 'SimpleSubMenu',
components: { components: {
SubMenu, SubMenu,
MenuItem, MenuItem,
SimpleMenuTag: createAsyncComponent(() => import('./SimpleMenuTag.vue')), SimpleMenuTag,
Icon, Icon,
}, },
props: { props: {
......
...@@ -14,7 +14,7 @@ export const basicProps = { ...@@ -14,7 +14,7 @@ export const basicProps = {
// 最大数量的文件,Infinity不限制 // 最大数量的文件,Infinity不限制
maxNumber: { maxNumber: {
type: Number as PropType<number>, type: Number as PropType<number>,
default: Infinity, default: Number.POSITIVE_INFINITY,
}, },
// 根据后缀,或者其他 // 根据后缀,或者其他
accept: { accept: {
......
...@@ -53,7 +53,7 @@ export function useUploadType({ ...@@ -53,7 +53,7 @@ export function useUploadType({
} }
const maxNumber = unref(maxNumberRef) const maxNumber = unref(maxNumberRef)
if (maxNumber && maxNumber !== Infinity) { if (maxNumber && maxNumber !== Number.POSITIVE_INFINITY) {
helpTexts.push(t('component.upload.maxNumber', [maxNumber])) helpTexts.push(t('component.upload.maxNumber', [maxNumber]))
} }
return helpTexts.join(',') return helpTexts.join(',')
......
...@@ -22,7 +22,7 @@ export function isHexColor(color: string) { ...@@ -22,7 +22,7 @@ export function isHexColor(color: string) {
export function rgbToHex(r: number, g: number, b: number) { export function rgbToHex(r: number, g: number, b: number) {
// tslint:disable-next-line:no-bitwise // tslint:disable-next-line:no-bitwise
const hex = ((r << 16) | (g << 8) | b).toString(16) const hex = ((r << 16) | (g << 8) | b).toString(16)
return `#${new Array(Math.abs(hex.length - 7)).join('0')}${hex}` return `#${Array.from({ length: Math.abs(hex.length - 7) }).join('0')}${hex}`
} }
/** /**
......
/* eslint-disable */ /* eslint-disable */
/* prettier-ignore */ /* prettier-ignore */
// @ts-nocheck // @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import // Generated by unplugin-auto-import
export {} export {}
declare global { declare global {
......
import process from 'node:process'
import { resolve } from 'node:path' import { resolve } from 'node:path'
import type { ConfigEnv, UserConfig } from 'vite' import type { ConfigEnv, UserConfig } from 'vite'
import dayjs from 'dayjs' import dayjs from 'dayjs'
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论