Skip to content

Commit

Permalink
Merge branch 'gavin/v4-dev' into gavin/v4-dev-customrouter-merge1
Browse files Browse the repository at this point in the history
* gavin/v4-dev: (68 commits)
  feat: 组建修改
  fix:修复气泡确认框的底部按钮换行的问题 (vbenjs#3413)
  style: tabs bottom double line fix (vbenjs#3415)
  feat(IconPicker): IconPicker could allowClear and readonly for form (vbenjs#3414)
  fix(FormTable): Invert select bug (vbenjs#3412)
  chore: 自定义组件默认rule校验默认触发逻辑为blur
  chore(ApiRadioGroup): 移除多余的change事件
  fix(ApiSelect): 修复监听不到params的变动
  fix(BasicForm->ApiRadioGroup): when options click, duplicate requests. resolve vbenjs#3387
  Revert "feat: table搜索表单值发生改变可以触发reload (vbenjs#3378)" (vbenjs#3407)
  fix(BasicTable): ColumnSetting mistake when use setColumns (vbenjs#3408)
  fix: navigator.clipboard 兼容问题 vbenjs#3372 (vbenjs#3403)
  feat: ColumnSetting and SizeSetting persist (vbenjs#3398)
  fix(BasicDrawer): remove toRaw props (vbenjs#3399)
  feat(hooks): useWatermark添加水印防篡改功能(vbenjs#3395) (vbenjs#3397)
  fix: table height calc when fullcontent and footer visible change (vbenjs#3392)
  fix(BasicTable): table表格宽度自适应,隐藏的列导致宽度增加 (vbenjs#3388)
  fix: 使用suffix时,label没有垂直居中 (vbenjs#3384)
  feat: table搜索表单值发生改变可以触发reload (vbenjs#3378)
  feat(treeTable): add function collapseRows and demo (vbenjs#3375)
  ...

# Conflicts:
#	pnpm-lock.yaml
#	src/components/Application/src/AppProvider.vue
#	src/components/Container/src/ScrollContainer.vue
#	src/components/Drawer/src/BasicDrawer.vue
#	src/components/Form/src/BasicForm.vue
#	src/components/Form/src/componentMap.ts
#	src/components/Form/src/components/FormAction.vue
#	src/components/Form/src/hooks/useFormEvents.ts
#	src/components/Modal/src/BasicModal.vue
#	src/components/Modal/src/components/ModalWrapper.vue
#	src/components/Scrollbar/src/Scrollbar.vue
#	src/components/SimpleMenu/src/SimpleSubMenu.vue
#	src/hooks/web/usePermission.ts
#	src/layouts/default/content/index.vue
#	src/layouts/default/header/MultipleHeader.vue
#	src/layouts/default/menu/index.vue
#	src/layouts/default/tabs/components/TabContent.vue
#	src/layouts/default/tabs/index.vue
#	src/layouts/page/index.vue
#	src/locales/lang/en/common.json
#	src/locales/lang/en/sys.json
#	src/locales/lang/zh-CN/sys.json
#	src/router/guard/permissionGuard.ts
#	src/router/helper/routeHelper.ts
#	src/router/routes/basic.ts
#	src/router/routes/index.ts
#	src/router/routes/modules/about.ts
#	src/router/routes/modules/dashboard.ts
#	src/router/routes/modules/demo/charts.ts
#	src/router/routes/modules/demo/comp.ts
#	src/router/routes/modules/demo/feat.ts
#	src/router/routes/modules/demo/flow.ts
#	src/router/routes/modules/demo/iframe.ts
#	src/router/routes/modules/demo/level.ts
#	src/router/routes/modules/demo/page.ts
#	src/router/routes/modules/demo/permission.ts
#	src/router/routes/modules/demo/setup.ts
#	src/router/routes/modules/demo/system.ts
#	src/store/modules/multipleTab.ts
#	src/store/modules/permission.ts
#	src/store/modules/user.ts
#	src/utils/auth/index.ts
#	src/utils/env.ts
#	src/views/demo/form/UseForm.vue
#	src/views/demo/system/account/DeptTree.vue
#	src/views/sys/login/LoginForm.vue
  • Loading branch information
gavinZhang001 committed Dec 15, 2023
2 parents 76ae165 + e3d59f7 commit 0cd0667
Show file tree
Hide file tree
Showing 597 changed files with 12,828 additions and 16,240 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ dist
.local
/bin
Dockerfile
package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@ jobs:
- name: Install dependencies
run: pnpm install

- name: Run type:check
run: pnpm run type:check

- name: Build
run: pnpm build
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"mrmlnc.vscode-less",
"lokalise.i18n-ally",
"antfu.iconify",
"antfu.unocss",
"mikestead.dotenv",
"heybourn.headwind",
"vue.vscode-typescript-vue-plugin"
]
}
55 changes: 28 additions & 27 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"stylelint.enable": true,
"stylelint.validate": ["css", "less", "postcss", "scss", "vue", "sass"],
"path-intellisense.mappings": {
"/@/": "${workspaceRoot}/src"
"@/": "${workspaceRoot}/src"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
Expand Down Expand Up @@ -104,38 +104,38 @@
"i18n-ally.displayLanguage": "zh-CN",
"i18n-ally.enabledFrameworks": ["vue", "react"],
"cSpell.words": [
"vben",
"antd",
"antv",
"brotli",
"browserslist",
"tailwindcss",
"codemirror",
"commitlint",
"cropperjs",
"echarts",
"esnext",
"antv",
"tinymce",
"qrcode",
"sider",
"esno",
"iconify",
"INTLIFY",
"lintstagedrc",
"logicflow",
"mockjs",
"nprogress",
"pinia",
"pnpm",
"qrcode",
"sider",
"nprogress",
"INTLIFY",
"stylelint",
"esno",
"vitejs",
"sortablejs",
"mockjs",
"codemirror",
"iconify",
"commitlint",
"stylelint",
"tailwindcss",
"tinymce",
"unocss",
"unref",
"vben",
"vditor",
"echarts",
"cropperjs",
"logicflow",
"Vite",
"vitejs",
"vueuse",
"zxcvbn",
"lintstagedrc",
"brotli",
"tailwindcss",
"sider",
"pnpm",
"antd"
"zxcvbn"
],
"vetur.format.scriptInitialIndent": true,
"vetur.format.styleInitialIndent": true,
Expand Down Expand Up @@ -169,5 +169,6 @@
"package.json": "pnpm-lock.yaml,pnpm-workspace.yaml,LICENSE,.gitattributes,.gitignore,.gitpod.yml,CNAME,README*,.npmrc,.browserslistrc",
".eslintrc.js": ".eslintignore,.prettierignore,.stylelintignore,.commitlintrc.js,.prettierrc.js,.stylelintrc.js"
},
"terminal.integrated.scrollback": 10000
"terminal.integrated.scrollback": 10000,
"nuxt.isNuxtApp": false
}
5 changes: 5 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
<body>
<div id="app">
<style>
html {
/* same as ant-design-vue/dist/reset.css setting, avoid the title line-height changed */
line-height: 1.15;
}

html[data-theme='dark'] .app-loading {
background-color: #2c344a;
}
Expand Down
8 changes: 8 additions & 0 deletions internal/eslint-config/.eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
dist
*.sh
node_modules
*.md
*.woff
*.ttf
.turbo
dist
package.json
8 changes: 8 additions & 0 deletions internal/stylelint-config/.eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
dist
*.sh
node_modules
*.md
*.woff
*.ttf
.turbo
dist
package.json
8 changes: 8 additions & 0 deletions internal/vite-config/.eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
dist
*.sh
node_modules
*.md
*.woff
*.ttf
.turbo
dist
package.json
5 changes: 2 additions & 3 deletions internal/vite-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@vitejs/plugin-vue": "^4.2.3",
"@gz/eslint-config": "workspace:*",
"@vitejs/plugin-vue-jsx": "^3.0.1",
"ant-design-vue": "^4.0.3",
"ant-design-vue": "^4.0.6",
"dayjs": "^1.11.9",
"dotenv": "^16.3.1",
"fs-extra": "^11.1.1",
Expand All @@ -39,8 +39,7 @@
"pkg-types": "^1.0.3",
"rollup-plugin-visualizer": "^5.9.2",
"sass": "^1.63.6",
"unocss": "^0.53.4",
"unplugin-config": "^0.1.3",
"unocss": "0.53.4",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-dts": "^3.1.0",
"vite-plugin-html": "^3.2.0",
Expand Down
10 changes: 0 additions & 10 deletions internal/vite-config/src/config/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,6 @@ function defineApplicationConfig(defineOptions: DefineOptions = {}) {
find: 'vue-i18n',
replacement: 'vue-i18n/dist/vue-i18n.cjs.js',
},
// /@/xxxx => src/xxxx
{
find: /\/@\//,
replacement: pathResolve('src') + '/',
},
// /#/xxxx => types/xxxx
{
find: /\/#\//,
replacement: pathResolve('types') + '/',
},
// @/xxxx => src/xxxx
{
find: /@\//,
Expand Down
7 changes: 1 addition & 6 deletions internal/vite-config/src/config/common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { presetTypography, presetUno } from 'unocss';
import UnoCSS from 'unocss/vite';
import { type UserConfig } from 'vite';

Expand All @@ -18,11 +17,7 @@ const commonConfig: (mode: string) => UserConfig = () => ({
maxParallelFileOps: 3,
},
},
plugins: [
UnoCSS({
presets: [presetUno(), presetTypography()],
}),
],
plugins: [UnoCSS()],
});

export { commonConfig };
117 changes: 95 additions & 22 deletions internal/vite-config/src/plugins/appConfig.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,104 @@
import GenerateConfig from 'unplugin-config/vite';
import colors from 'picocolors';
import { readPackageJSON } from 'pkg-types';
import { type PluginOption } from 'vite';

import { getEnvConfig } from '../utils/env';
import { strToHex } from '../utils/hash';
import { createContentHash } from '../utils/hash';

const GLOBAL_CONFIG_FILE_NAME = '_app.config.js';
// This constant sets the output directory for the Vite package
const OUTPUT_DIR = 'dist';
export async function createConfigPluginConfig(
shouldGenerateConfig: boolean,
): Promise<PluginOption> {
const config = await getEnvConfig();
// LINK /src/utils/env.ts -> getVariableName
const APP_NAME = strToHex(config?.VITE_GLOB_APP_TITLE ?? '__APP');
// https://github.com/kirklin/unplugin-config
return GenerateConfig({
appName: APP_NAME,
envVariables: {
prefix: 'VITE_GLOB_',
const PLUGIN_NAME = 'app-config';

async function createAppConfigPlugin({
root,
isBuild,
}: {
root: string;
isBuild: boolean;
}): Promise<PluginOption> {
let publicPath: string;
let source: string;
if (!isBuild) {
return {
name: PLUGIN_NAME,
};
}
const { version = '' } = await readPackageJSON(root);

return {
name: PLUGIN_NAME,
async configResolved(_config) {
const appTitle = _config?.env?.VITE_GLOB_APP_TITLE ?? '';
// appTitle = appTitle.replace(/\s/g, '_').replace(/-/g, '_');
publicPath = _config.base;
source = await getConfigSource(appTitle);
},
configFile: {
generate: shouldGenerateConfig,
fileName: GLOBAL_CONFIG_FILE_NAME,
outputDir: OUTPUT_DIR,
async transformIndexHtml(html) {
publicPath = publicPath.endsWith('/') ? publicPath : `${publicPath}/`;

const appConfigSrc = `${
publicPath || '/'
}${GLOBAL_CONFIG_FILE_NAME}?v=${version}-${createContentHash(source)}`;

return {
html,
tags: [
{
tag: 'script',
attrs: {
src: appConfigSrc,
},
},
],
};
},
htmlInjection: {
decodeEntities: true,
async generateBundle() {
try {
this.emitFile({
type: 'asset',
fileName: GLOBAL_CONFIG_FILE_NAME,
source,
});

console.log(colors.cyan(`✨configuration file is build successfully!`));
} catch (error) {
console.log(
colors.red('configuration file configuration file failed to package:\n' + error),
);
}
},
});
};
}

/**
* Get the configuration file variable name
* @param env
*/
const getVariableName = (title: string) => {
function strToHex(str: string) {
const result: string[] = [];
for (let i = 0; i < str.length; ++i) {
const hex = str.charCodeAt(i).toString(16);
result.push(('000' + hex).slice(-4));
}
return result.join('').toUpperCase();
}
return `__PRODUCTION__${strToHex(title) || '__APP'}__CONF__`.toUpperCase().replace(/\s/g, '');
};

async function getConfigSource(appTitle: string) {
const config = await getEnvConfig();
const variableName = getVariableName(appTitle);
const windowVariable = `window.${variableName}`;
// Ensure that the variable will not be modified
let source = `${windowVariable}=${JSON.stringify(config)};`;
source += `
Object.freeze(${windowVariable});
Object.defineProperty(window, "${variableName}", {
configurable: false,
writable: false,
});
`.replace(/\s/g, '');
return source;
}

export { createAppConfigPlugin };
6 changes: 3 additions & 3 deletions internal/vite-config/src/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import vueJsx from '@vitejs/plugin-vue-jsx';
import { type PluginOption } from 'vite';
import purgeIcons from 'vite-plugin-purge-icons';

import { createConfigPluginConfig } from './appConfig';
import { createAppConfigPlugin } from './appConfig';
import { configCompressPlugin } from './compress';
import { configHtmlPlugin } from './html';
import { configMockPlugin } from './mock';
Expand All @@ -18,10 +18,10 @@ interface Options {
enableAnalyze?: boolean;
}

async function createPlugins({ isBuild, enableMock, compress, enableAnalyze }: Options) {
async function createPlugins({ isBuild, root, enableMock, compress, enableAnalyze }: Options) {
const vitePlugins: (PluginOption | PluginOption[])[] = [vue(), vueJsx()];

const appConfigPlugin = await createConfigPluginConfig(isBuild);
const appConfigPlugin = await createAppConfigPlugin({ root, isBuild });
vitePlugins.push(appConfigPlugin);

// vite-plugin-html
Expand Down
2 changes: 1 addition & 1 deletion mock/_util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Interface data format used to return a unified format
import { ResultEnum } from '/@/enums/httpEnum';
import { ResultEnum } from '@/enums/httpEnum';

export function resultSuccess<T = Recordable>(result: T, { message = 'ok' } = {}) {
return {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"showdown": "^2.1.0",
"sortablejs": "^1.15.0",
"tinymce": "^5.10.7",
"unocss": "0.53.4",
"vditor": "^3.9.4",
"vue": "^3.3.4",
"vue-i18n": "^9.6.4",
Expand Down Expand Up @@ -136,7 +137,7 @@
"husky": "^8.0.3",
"lint-staged": "13.2.3",
"prettier": "^2.8.8",
"prettier-plugin-packagejson": "^2.4.4",
"prettier-plugin-packagejson": "^2.4.6",
"rimraf": "^5.0.1",
"turbo": "^1.10.7",
"typescript": "^5.2.2",
Expand Down
1 change: 1 addition & 0 deletions packages/request/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"qs": "^6.11.0"
},
"devDependencies": {
"@types/node": "^20.10.4",
"@gz/eslint-config": "workspace:*",
"@gz/cli": "workspace:*",
"@types/qs": "^6.9.7",
Expand Down
Loading

0 comments on commit 0cd0667

Please sign in to comment.