diff --git a/CHANGELOG.zh_CN.md b/CHANGELOG.zh_CN.md index 3181b20d..dac4fa4a 100644 --- a/CHANGELOG.zh_CN.md +++ b/CHANGELOG.zh_CN.md @@ -1,3 +1,30 @@ +### ✨ Features + +- **其它** + - `.env`文件中的`VITE_PROXY`配置支持单引号 + - 移除 build 过程中的警告 + +### 🐛 Bug Fixes + +- **BasicTable** + - 修复可编辑单元格某些情况下无法提交的问题 + - 修复`inset`属性不起作用的问题 + - 修复`useTable`与`BasicTable`实例的`reload`方法`await`表现不一致的问题 + - 修复`clickToRowSelect`会无视行选择框 disabled 状态的问题 + - 修复`BasicTable`在某些情况下,分页会被重置的问题 + - 修改 `deleteTableDataRecord` 方法 +- **BasicModal** + - 修复点击遮罩、按下`Esc`键都不能关闭`Modal`的问题 + - 修复点击关闭按钮、最大化按钮旁边的空白区域也会导致`Modal`关闭的问题 +- **BasicTree** 修复节点插槽不起作用的问题 +- **CodeEditor** 修复可能会造成的`Build`失败的问题 +- **BasicForm** 修复自定义 FormItem 组件的内容宽度可能超出范围的问题 +- **ApiTreeSelect** 修复`params`变化未能触发重新请求 api 数据的问题 +- **其它** + - 修复多标签在某些情况下关闭页签不会跳转路由的问题 + - 修复部分组件可能会造成热更新异常的问题 + - 修复直接`import`部分`antdv`子组件时会在 build 过程中报错的问题,如:TabPane、RadioGroup + ## 2.7.2(2021-09-14) ### ✨ Features diff --git a/build/script/buildConf.ts b/build/script/buildConf.ts index 48ed4d9b..342c1541 100644 --- a/build/script/buildConf.ts +++ b/build/script/buildConf.ts @@ -5,18 +5,19 @@ import { GLOB_CONFIG_FILE_NAME, OUTPUT_DIR } from '../constant'; import fs, { writeFileSync } from 'fs-extra'; import chalk from 'chalk'; -import { getRootPath, getEnvConfig } from '../utils'; +import { getEnvConfig, getRootPath } from '../utils'; import { getConfigFileName } from '../getConfigFileName'; import pkg from '../../package.json'; -function createConfig( - { - configName, - config, - configFileName = GLOB_CONFIG_FILE_NAME, - }: { configName: string; config: any; configFileName?: string } = { configName: '', config: {} }, -) { +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 @@ -40,5 +41,5 @@ function createConfig( export function runBuildConfig() { const config = getEnvConfig(); const configFileName = getConfigFileName(config); - createConfig({ config, configName: configFileName }); + createConfig({ config, configName: configFileName, configFileName: GLOB_CONFIG_FILE_NAME }); } diff --git a/build/utils.ts b/build/utils.ts index 58694077..c201514f 100644 --- a/build/utils.ts +++ b/build/utils.ts @@ -28,9 +28,9 @@ export function wrapperEnv(envConf: Recordable): ViteEnv { if (envName === 'VITE_PORT') { realName = Number(realName); } - if (envName === 'VITE_PROXY') { + if (envName === 'VITE_PROXY' && realName) { try { - realName = JSON.parse(realName); + realName = JSON.parse(realName.replace(/'/g, '"')); } catch (error) { realName = ''; } diff --git a/build/vite/plugin/styleImport.ts b/build/vite/plugin/styleImport.ts index 786580f8..982f2d73 100644 --- a/build/vite/plugin/styleImport.ts +++ b/build/vite/plugin/styleImport.ts @@ -14,7 +14,52 @@ export function configStyleImportPlugin(isBuild: boolean) { libraryName: 'ant-design-vue', esModule: true, resolveStyle: (name) => { - return `ant-design-vue/es/${name}/style/index`; + // 这里是“子组件”列表,无需额外引入样式文件 + const ignoreList = [ + 'typography-text', + 'typography-title', + 'typography-paragraph', + 'typography-link', + 'anchor-link', + 'sub-menu', + 'menu-item', + 'menu-item-group', + 'dropdown-button', + 'breadcrumb-item', + 'breadcrumb-separator', + 'input-password', + 'input-search', + 'input-group', + 'form-item', + 'radio-group', + 'checkbox-group', + 'layout-sider', + 'layout-content', + 'layout-footer', + 'layout-header', + 'step', + 'select-option', + 'select-opt-group', + 'card-grid', + 'card-meta', + 'collapse-panel', + 'descriptions-item', + 'list-item', + 'list-item-meta', + 'table-column', + 'table-column-group', + 'tab-pane', + 'tab-content', + 'timeline-item', + 'tree-node', + 'skeleton-input', + 'skeleton-avatar', + 'skeleton-title', + 'skeleton-paragraph', + 'skeleton-image', + 'skeleton-button', + ]; + return ignoreList.includes(name) ? '' : `ant-design-vue/es/${name}/style/index`; }, }, ], diff --git a/build/vite/proxy.ts b/build/vite/proxy.ts index dc23646d..8525397b 100644 --- a/build/vite/proxy.ts +++ b/build/vite/proxy.ts @@ -7,7 +7,7 @@ type ProxyItem = [string, string]; type ProxyList = ProxyItem[]; -type ProxyTargetList = Record string }>; +type ProxyTargetList = Record; const httpsRE = /^https:\/\//; diff --git a/mock/demo/account.ts b/mock/demo/account.ts index 4ba247d1..a3924931 100644 --- a/mock/demo/account.ts +++ b/mock/demo/account.ts @@ -1,5 +1,6 @@ import { MockMethod } from 'vite-plugin-mock'; import { resultSuccess, resultError } from '../_util'; +import { ResultEnum } from '../../src/enums/httpEnum'; const userInfo = { name: 'Vben', @@ -59,4 +60,12 @@ export default [ return resultError(); }, }, + { + url: '/basic-api/user/tokenExpired', + method: 'post', + statusCode: 200, + response: () => { + return resultError('Token Expired!', { code: ResultEnum.TIMEOUT as number }); + }, + }, ] as MockMethod[]; diff --git a/mock/demo/select-demo.ts b/mock/demo/select-demo.ts index fc35a395..631c6bb0 100644 --- a/mock/demo/select-demo.ts +++ b/mock/demo/select-demo.ts @@ -1,11 +1,11 @@ import { MockMethod } from 'vite-plugin-mock'; import { resultSuccess } from '../_util'; -const demoList = (keyword) => { +const demoList = (keyword, count = 20) => { const result = { list: [] as any[], }; - for (let index = 0; index < 20; index++) { + for (let index = 0; index < count; index++) { result.list.push({ name: `${keyword ?? ''}选项${index}`, id: `${index}`, @@ -20,9 +20,9 @@ export default [ timeout: 1000, method: 'get', response: ({ query }) => { - const { keyword } = query; + const { keyword, count } = query; console.log(keyword); - return resultSuccess(demoList(keyword)); + return resultSuccess(demoList(keyword, count)); }, }, ] as MockMethod[]; diff --git a/mock/demo/table-demo.ts b/mock/demo/table-demo.ts index 2fae797f..f3a0f16f 100644 --- a/mock/demo/table-demo.ts +++ b/mock/demo/table-demo.ts @@ -12,7 +12,7 @@ function getRandomPics(count = 10): string[] { const demoList = (() => { const result: any[] = []; - for (let index = 0; index < 60; index++) { + for (let index = 0; index < 200; index++) { result.push({ id: `${index}`, beginTime: '@datetime', diff --git a/package.json b/package.json index 9de2a6b8..9c93a611 100644 --- a/package.json +++ b/package.json @@ -35,98 +35,100 @@ }, "dependencies": { "@iconify/iconify": "^2.0.4", - "@vueuse/core": "^6.3.3", + "@vueuse/core": "^6.6.2", "@zxcvbn-ts/core": "^1.0.0-beta.0", - "ant-design-vue": "2.2.7", - "axios": "^0.21.4", + "ant-design-vue": "2.2.8", + "axios": "^0.23.0", "crypto-js": "^4.1.1", - "echarts": "^5.2.0", + "echarts": "^5.2.1", "lodash-es": "^4.17.21", "mockjs": "^1.1.0", "nprogress": "^0.2.0", "path-to-regexp": "^6.2.0", - "pinia": "2.0.0-rc.9", + "pinia": "2.0.0-rc.14", + "print-js": "^1.6.0", "qrcode": "^1.4.4", "resize-observer-polyfill": "^1.5.1", "sortablejs": "^1.14.0", - "vue": "3.2.11", - "vue-i18n": "9.1.7", - "vue-router": "^4.0.11", - "vue-types": "^4.1.0" + "vue": "^3.2.20", + "vue-i18n": "^9.1.9", + "vue-json-pretty": "^2.0.4", + "vue-router": "^4.0.12", + "vue-types": "^4.1.1" }, "devDependencies": { - "@commitlint/cli": "^13.1.0", - "@commitlint/config-conventional": "^13.1.0", - "@iconify/json": "^1.1.401", + "@commitlint/cli": "^13.2.1", + "@commitlint/config-conventional": "^13.2.0", + "@iconify/json": "^1.1.416", "@purge-icons/generated": "^0.7.0", - "@types/codemirror": "^5.60.2", + "@types/codemirror": "^5.60.5", "@types/crypto-js": "^4.0.2", - "@types/fs-extra": "^9.0.12", - "@types/inquirer": "^8.1.1", + "@types/fs-extra": "^9.0.13", + "@types/inquirer": "^8.1.3", "@types/intro.js": "^3.0.2", - "@types/jest": "^27.0.1", + "@types/jest": "^27.0.2", "@types/lodash-es": "^4.17.5", "@types/mockjs": "^1.0.4", - "@types/node": "^16.9.1", + "@types/node": "^16.11.1", "@types/nprogress": "^0.2.0", "@types/qrcode": "^1.4.1", "@types/qs": "^6.9.7", "@types/showdown": "^1.9.4", "@types/sortablejs": "^1.10.7", - "@typescript-eslint/eslint-plugin": "^4.31.0", - "@typescript-eslint/parser": "^4.31.0", - "@vitejs/plugin-legacy": "^1.5.3", - "@vitejs/plugin-vue": "^1.6.2", - "@vitejs/plugin-vue-jsx": "^1.1.8", - "@vue/compiler-sfc": "3.2.11", - "@vue/test-utils": "^2.0.0-rc.14", - "autoprefixer": "^10.3.4", + "@typescript-eslint/eslint-plugin": "^5.1.0", + "@typescript-eslint/parser": "^5.1.0", + "@vitejs/plugin-legacy": "^1.6.2", + "@vitejs/plugin-vue": "^1.9.3", + "@vitejs/plugin-vue-jsx": "^1.2.0", + "@vue/compiler-sfc": "3.2.20", + "@vue/test-utils": "^2.0.0-rc.16", + "autoprefixer": "^10.3.7", "commitizen": "^4.2.4", "conventional-changelog-cli": "^2.1.1", "cross-env": "^7.0.3", "dotenv": "^10.0.0", - "eslint": "^7.32.0", + "eslint": "^8.0.1", "eslint-config-prettier": "^8.3.0", - "eslint-define-config": "^1.0.9", - "eslint-plugin-jest": "^24.4.0", + "eslint-define-config": "^1.1.1", + "eslint-plugin-jest": "^25.2.2", "eslint-plugin-prettier": "^4.0.0", - "eslint-plugin-vue": "^7.17.0", - "esno": "^0.9.1", + "eslint-plugin-vue": "^7.19.1", + "esno": "^0.10.1", "fs-extra": "^10.0.0", - "http-server": "^13.0.1", + "http-server": "^14.0.0", "husky": "^7.0.2", - "inquirer": "^8.1.2", + "inquirer": "^8.2.0", "is-ci": "^3.0.0", - "jest": "^27.2.0", - "less": "^4.1.1", - "lint-staged": "^11.1.2", + "jest": "^27.3.1", + "less": "^4.1.2", + "lint-staged": "^11.2.3", "npm-run-all": "^4.1.5", - "postcss": "^8.3.6", - "prettier": "^2.4.0", + "postcss": "^8.3.9", + "prettier": "^2.4.1", "pretty-quick": "^3.1.1", "rimraf": "^3.0.2", - "rollup-plugin-visualizer": "5.5.2", + "rollup-plugin-visualizer": "^5.5.2", "stylelint": "^13.13.1", - "stylelint-config-prettier": "^8.0.2", + "stylelint-config-prettier": "^9.0.3", "stylelint-config-standard": "^22.0.0", "stylelint-order": "^4.1.0", - "ts-jest": "^27.0.5", - "ts-node": "^10.2.1", - "typescript": "4.4.3", - "vite": "2.5.7", + "ts-jest": "^27.0.7", + "ts-node": "^10.3.0", + "typescript": "^4.4.4", + "vite": "^2.6.10", "vite-plugin-compression": "^0.3.5", - "vite-plugin-html": "^2.1.0", - "vite-plugin-imagemin": "^0.4.5", + "vite-plugin-html": "^2.1.1", + "vite-plugin-imagemin": "^0.4.6", "vite-plugin-mock": "^2.9.6", "vite-plugin-purge-icons": "^0.7.0", - "vite-plugin-pwa": "^0.11.2", + "vite-plugin-pwa": "^0.11.3", "vite-plugin-style-import": "^1.2.1", - "vite-plugin-svg-icons": "^1.0.4", + "vite-plugin-svg-icons": "^1.0.5", "vite-plugin-theme": "^0.8.1", "vite-plugin-vue-setup-extend": "^0.1.0", - "vite-plugin-windicss": "^1.4.2", - "vue-eslint-parser": "^7.11.0", - "vue-tsc": "^0.3.0" + "vite-plugin-windicss": "^1.4.12", + "vue-eslint-parser": "^8.0.0", + "vue-tsc": "^0.28.7" }, "resolutions": { "//": "Used to install imagemin dependencies, because imagemin may not be installed in China. If it is abroad, you can delete it", diff --git a/src/components/Application/src/AppLogo.vue b/src/components/Application/src/AppLogo.vue index 359688cb..86aaf76a 100644 --- a/src/components/Application/src/AppLogo.vue +++ b/src/components/Application/src/AppLogo.vue @@ -87,6 +87,7 @@ font-size: 16px; font-weight: 700; transition: all 0.5s; + line-height: normal; } } diff --git a/src/components/CodeEditor/index.ts b/src/components/CodeEditor/index.ts index a9b0c30e..872bfedf 100644 --- a/src/components/CodeEditor/index.ts +++ b/src/components/CodeEditor/index.ts @@ -4,3 +4,5 @@ import jsonPreview from './src/json-preview/JsonPreview.vue'; export const CodeEditor = withInstall(codeEditor); export const JsonPreview = withInstall(jsonPreview); + +export * from './src/typing'; diff --git a/src/components/CodeEditor/src/CodeEditor.vue b/src/components/CodeEditor/src/CodeEditor.vue index 7bf58220..db9042b5 100644 --- a/src/components/CodeEditor/src/CodeEditor.vue +++ b/src/components/CodeEditor/src/CodeEditor.vue @@ -8,22 +8,22 @@ /> - - diff --git a/src/components/Excel/src/ImportExcel.vue b/src/components/Excel/src/ImportExcel.vue index 546347bc..c94d07b1 100644 --- a/src/components/Excel/src/ImportExcel.vue +++ b/src/components/Excel/src/ImportExcel.vue @@ -15,12 +15,25 @@ diff --git a/src/components/Form/src/components/ApiSelect.vue b/src/components/Form/src/components/ApiSelect.vue index 26a79f89..7b6bad16 100644 --- a/src/components/Form/src/components/ApiSelect.vue +++ b/src/components/Form/src/components/ApiSelect.vue @@ -77,9 +77,9 @@ if (next) { const value = next[valueField]; prev.push({ + ...omit(next, [labelField, valueField]), label: next[labelField], value: numberToString ? `${value}` : value, - ...omit(next, [labelField, valueField]), }); } return prev; diff --git a/src/components/Form/src/components/ApiTreeSelect.vue b/src/components/Form/src/components/ApiTreeSelect.vue index da4318c0..3f073d34 100644 --- a/src/components/Form/src/components/ApiTreeSelect.vue +++ b/src/components/Form/src/components/ApiTreeSelect.vue @@ -44,7 +44,7 @@ watch( () => props.params, () => { - isFirstLoaded.value && fetch(); + !unref(isFirstLoaded) && fetch(); }, { deep: true }, ); diff --git a/src/components/Form/src/components/FormItem.vue b/src/components/Form/src/components/FormItem.vue index 63074024..e34e4b33 100644 --- a/src/components/Form/src/components/FormItem.vue +++ b/src/components/Form/src/components/FormItem.vue @@ -340,7 +340,7 @@ wrapperCol={wrapperCol} >
-
{getContent()}
+
{getContent()}
{showSuffix && {getSuffix}}
diff --git a/src/components/Form/src/types/form.ts b/src/components/Form/src/types/form.ts index f4aa6ddc..ac85a74f 100644 --- a/src/components/Form/src/types/form.ts +++ b/src/components/Form/src/types/form.ts @@ -129,7 +129,7 @@ export interface FormSchema { // Variable name bound to v-model Default value valueField?: string; // Label name - label: string; + label: string | VNode; // Auxiliary text subLabel?: string; // Help text on the right side of the text diff --git a/src/components/Form/src/types/index.ts b/src/components/Form/src/types/index.ts index 1cd6a02c..c63b3408 100644 --- a/src/components/Form/src/types/index.ts +++ b/src/components/Form/src/types/index.ts @@ -92,6 +92,7 @@ export type ComponentType = | 'ApiSelect' | 'TreeSelect' | 'ApiTreeSelect' + | 'ApiRadioGroup' | 'RadioButtonGroup' | 'RadioGroup' | 'Checkbox' diff --git a/src/components/Icon/src/IconPicker.vue b/src/components/Icon/src/IconPicker.vue index afb9204a..e939c226 100644 --- a/src/components/Icon/src/IconPicker.vue +++ b/src/components/Icon/src/IconPicker.vue @@ -7,7 +7,7 @@ v-model:value="currentSelect" > @@ -71,16 +71,14 @@ - + - diff --git a/src/components/Menu/src/BasicMenu.vue b/src/components/Menu/src/BasicMenu.vue index 80cfd70a..0d0e20fb 100644 --- a/src/components/Menu/src/BasicMenu.vue +++ b/src/components/Menu/src/BasicMenu.vue @@ -134,7 +134,9 @@ isClickGo.value = false; return; } - const path = (route || unref(currentRoute)).path; + const path = + (route || unref(currentRoute)).meta?.currentActiveMenu || + (route || unref(currentRoute)).path; setOpenKeys(path); if (unref(currentActiveMenu)) return; if (props.isHorizontal && unref(getSplit)) { diff --git a/src/components/Modal/src/BasicModal.vue b/src/components/Modal/src/BasicModal.vue index c1650994..89bc8798 100644 --- a/src/components/Modal/src/BasicModal.vue +++ b/src/components/Modal/src/BasicModal.vue @@ -1,5 +1,5 @@