pull/48/MERGE
xingyu4j 2024-11-21 10:28:40 +08:00
commit c4628fb1e4
11 changed files with 856 additions and 1655 deletions

View File

@ -18,7 +18,7 @@
- **Permission Validation**: Comprehensive permission validation solutions, including button-level permission control.
- **Multi-Theme**: Built-in multiple theme configurations & dark mode to meet personalized needs.
- **Dynamic Menu**: Supports dynamic menus that can display based on permissions.
- **Mock Data**: High-performance local Mock data solution based on Nitro.
- **Mock Data**: High-performance local Mock data solution based on `Nitro`.
- **Rich Components**: Provides a wide range of components to meet most business needs.
- **Standardization**: Code quality is ensured with tools like `ESLint`, `Prettier`, `Stylelint`, `Publint`, and `CSpell`.
- **Engineering**: Development efficiency is improved with tools like `Pnpm Monorepo`, `TurboRepo`, and `Changeset`.
@ -26,9 +26,9 @@
## Browser Support
**Local development** is recommended using the **latest version of Chrome**. **Versions below Chrome 80 are not supported**.
- **Local development** is recommended using the **latest version of Chrome**. **Versions below Chrome 80 are not supported**.
**Production environment** supports modern browsers, IE is not supported.
- **Production environment** supports modern browsers, IE is not supported.
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/archive/internet-explorer_9-11/internet-explorer_9-11_48x48.png" alt="IE" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)IE | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt=" Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)Safari |
| :-: | :-: | :-: | :-: | :-: |
@ -37,12 +37,10 @@
## Contribution
- [Vben Admin](https://github.com/vbenjs/vue-vben-admin) is still being actively updated. Contributions are welcome to help maintain and improve the project, aiming to create a better mid- to backend solution.
- If you wish to join us, you can provide suggestions or submit pull requests. We will invite you to join based on your activity.
- If you wish to join us, you can start by contributing in the following ways, and we will invite you to join based on your activity.
::: info Join Us
If you wish to join us, you can start by contributing in the following ways, and we will invite you to join based on your activity:
- Regularly submit `PRs`.
- Provide valuable suggestions.
- Participate in discussions and help resolve some `issues`.

View File

@ -18,7 +18,7 @@
- **权限验证**:完善的权限验证方案,按钮级别权限控制。
- **多主题**:内置多种主题配置和黑暗模式,满足个性化需求。
- **动态菜单**:支持动态菜单,可以根据权限配置显示菜单。
- **Mock 数据**:基于 Nitro 的本地高性能 Mock 数据方案。
- **Mock 数据**:基于 `Nitro` 的本地高性能 Mock 数据方案。
- **组件丰富**:提供了丰富的组件,可以满足大部分的业务需求。
- **规范**:代码规范,使用 `ESLint`、`Prettier`、`Stylelint`、`Publint`、`CSpell` 等工具保证代码质量。
- **工程化**:使用 `Pnpm Monorepo`、`TurboRepo`、`Changeset` 等工具,提高开发效率。
@ -26,9 +26,9 @@
## 浏览器支持
**本地开发**推荐使用`Chrome 最新版`浏览器,**不支持**`Chrome 80`以下版本。
- **本地开发**推荐使用`Chrome 最新版`浏览器,**不支持**`Chrome 80`以下版本。
**生产环境**支持现代浏览器,不支持 IE。
- **生产环境**支持现代浏览器,不支持 IE。
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/archive/internet-explorer_9-11/internet-explorer_9-11_48x48.png" alt="IE" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)IE | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt=" Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)Safari |
| :-: | :-: | :-: | :-: | :-: |
@ -37,13 +37,13 @@
## 贡献
- [Vben Admin](https://github.com/vbenjs/vue-vben-admin) 还在持续更新中,本项目欢迎您的参与,共同维护,逐步完善,打造更好的中后台解决方案。
- 如果你想加入我们,可以提供有价值的建议或者参与讨论,协助解决 issue- 如果你想加入我们,可以提供有价值的建议或者参与讨论,协助解决 issue,我们会根据你的活跃度邀请你加入。
- 如果你有兴趣加入我们,可以通过以下方式开始,我们会根据你的活跃度邀请你加入。
::: info 加入我们
- 长期提交 `PR`
- 提供一些好的建议。
- 参与讨论,帮助解决一些 `issue`
- 提供有价值的建议。
- 参与讨论,帮助解决 `issue`
- 共同维护文档。
:::

View File

@ -18,6 +18,7 @@ export async function unicorn(): Promise<Linter.Config[]> {
'unicorn/better-regex': 'off',
'unicorn/consistent-destructuring': 'off',
'unicorn/consistent-function-scoping': 'off',
'unicorn/expiring-todo-comments': 'off',
'unicorn/filename-case': 'off',
'unicorn/import-style': 'off',
'unicorn/no-array-for-each': 'off',

View File

@ -99,7 +99,7 @@
"node": ">=20.10.0",
"pnpm": ">=9.12.0"
},
"packageManager": "pnpm@9.13.0",
"packageManager": "pnpm@9.13.2",
"pnpm": {
"peerDependencyRules": {
"allowedVersions": {

View File

@ -91,6 +91,11 @@ function handleRangeTimeValue(values: Record<string, any>) {
fieldMappingTime.forEach(
([field, [startTimeKey, endTimeKey], format = 'YYYY-MM-DD']) => {
if (startTimeKey && endTimeKey && values[field] === null) {
delete values[startTimeKey];
delete values[endTimeKey];
}
if (!values[field]) {
delete values[field];
return;

View File

@ -13,13 +13,13 @@ import { toRaw } from 'vue';
import { Store } from '@vben-core/shared/store';
import {
bindMethods,
createMerge,
isFunction,
isObject,
mergeWithArrayOverride,
StateHandler,
} from '@vben-core/shared/utils';
import { objectPick } from '@vueuse/core';
function getDefaultState(): VbenFormProps {
return {
actionWrapperClass: '',
@ -250,8 +250,17 @@ export class FormApi {
form.setValues(fields, shouldValidate);
return;
}
const fieldNames = this.state?.schema?.map((item) => item.fieldName) ?? [];
const filteredFields = objectPick(fields, fieldNames);
const fieldMergeFn = createMerge((obj, key, value) => {
if (key in obj) {
obj[key] =
!Array.isArray(obj[key]) && isObject(obj[key])
? fieldMergeFn(obj[key], value)
: value;
}
return true;
});
const filteredFields = fieldMergeFn(fields, form.values);
form.setValues(filteredFields, shouldValidate);
}

View File

@ -209,8 +209,9 @@ function fieldBindEvent(slotProps: Record<string, any>) {
if (modelValue && isObject(modelValue) && bindEventField) {
value = isEventObjectLike(modelValue)
? modelValue?.target?.[bindEventField]
: modelValue;
: (modelValue?.[bindEventField] ?? modelValue);
}
if (bindEventField) {
return {
[`onUpdate:${bindEventField}`]: handler,
@ -223,6 +224,7 @@ function fieldBindEvent(slotProps: Record<string, any>) {
if (!shouldUnwrap) {
return onChange?.(e);
}
return onChange?.(e?.target?.[bindEventField] ?? e);
},
onInput: () => {},

View File

@ -48,11 +48,14 @@ const delegatedProps = computed(() => {
const forwarded = useForwardPropsEmits(delegatedProps, emits);
const contentRef = ref<InstanceType<typeof DialogContent> | null>(null);
function onAnimationEnd() {
if (props.open) {
emits('opened');
} else {
emits('closed');
function onAnimationEnd(event: AnimationEvent) {
// contentRef opened/closed
if (event.target === contentRef.value?.$el) {
if (props.open) {
emits('opened');
} else {
emits('closed');
}
}
}
defineExpose({

View File

@ -3,42 +3,56 @@ import { ref } from 'vue';
import { Page, VResize } from '@vben/common-ui';
const width = ref(200);
const height = ref(200);
const top = ref(200);
const left = ref(200);
const colorMap = ['red', 'green', 'yellow', 'gray'];
const resize = (newRect: {
type TSize = {
height: number;
left: number;
top: number;
width: number;
}) => {
width.value = newRect.width;
height.value = newRect.height;
top.value = newRect.top;
left.value = newRect.left;
};
const sizeList = ref<TSize[]>([
{ height: 200, left: 200, top: 200, width: 200 },
{ height: 300, left: 300, top: 300, width: 300 },
{ height: 400, left: 400, top: 400, width: 400 },
{ height: 500, left: 500, top: 500, width: 500 },
]);
const resize = (size?: TSize, rect?: TSize) => {
if (!size || !rect) return;
size.height = rect.height;
size.left = rect.left;
size.top = rect.top;
size.width = rect.width;
};
</script>
<template>
<Page description="Resize组件基础示例" title="Resize组件">
<div class="m-4 bg-blue-500 p-48 text-xl">
{{
`width: ${width}px, height: ${height}px, top: ${top}px, left: ${left}px`
}}
<div v-for="size in sizeList" :key="size.width">
{{
`width: ${size.width}px, height: ${size.height}px, top: ${size.top}px, left: ${size.left}px`
}}
</div>
</div>
<VResize
:h="200"
:is-active="true"
:w="200"
:x="200"
:y="200"
@dragging="resize"
@resizing="resize"
>
<div class="h-full w-full bg-red-500"></div>
</VResize>
<template v-for="(_, idx) of 4" :key="idx">
<VResize
:h="100 * (idx + 1)"
:w="100 * (idx + 1)"
:x="100 * (idx + 1)"
:y="100 * (idx + 1)"
@dragging="(rect) => resize(sizeList[idx], rect)"
@resizing="(rect) => resize(sizeList[idx], rect)"
>
<div
:style="{ backgroundColor: colorMap[idx] }"
class="h-full w-full"
></div>
</VResize>
</template>
</Page>
</template>

File diff suppressed because it is too large Load Diff

View File

@ -17,17 +17,17 @@ catalog:
'@changesets/changelog-github': ^0.5.0
'@changesets/cli': ^2.27.9
'@changesets/git': ^3.0.1
'@clack/prompts': ^0.7.0
'@clack/prompts': ^0.8.1
'@commitlint/cli': ^19.5.0
'@commitlint/config-conventional': ^19.5.0
'@ctrl/tinycolor': ^4.1.0
'@eslint/js': ^9.14.0
'@eslint/js': ^9.15.0
'@faker-js/faker': ^9.2.0
'@iconify/json': ^2.2.271
'@iconify/json': ^2.2.273
'@iconify/tailwind': ^1.1.3
'@iconify/vue': ^4.1.2
'@intlify/core-base': ^10.0.4
'@intlify/unplugin-vue-i18n': ^5.3.1
'@intlify/unplugin-vue-i18n': ^6.0.0
'@jspm/generator': ^2.4.1
'@manypkg/get-packages': ^2.2.2
'@nolebase/vitepress-plugin-git-changelog': ^2.9.0
@ -36,7 +36,7 @@ catalog:
'@stylistic/stylelint-plugin': ^3.1.1
'@tailwindcss/nesting': 0.0.0-insiders.565cd3e
'@tailwindcss/typography': ^0.5.15
'@tanstack/vue-query': ^5.59.20
'@tanstack/vue-query': ^5.60.5
'@tanstack/vue-store': ^0.5.7
'@types/archiver': ^6.0.3
'@types/eslint': ^9.6.1
@ -55,8 +55,8 @@ catalog:
'@vite-pwa/vitepress': ^0.5.3
'@vitejs/plugin-vue': ^5.2.0
'@vitejs/plugin-vue-jsx': ^4.1.0
'@vue/reactivity': ^3.5.12
'@vue/shared': ^3.5.12
'@vue/reactivity': ^3.5.13
'@vue/shared': ^3.5.13
'@vue/test-utils': ^2.4.6
'@vueuse/core': ^11.2.0
'@vueuse/integrations': ^11.2.0
@ -83,19 +83,19 @@ catalog:
depcheck: ^1.4.7
dotenv: ^16.4.5
echarts: ^5.5.1
element-plus: ^2.8.7
eslint: ^9.14.0
eslint-config-turbo: ^2.2.3
element-plus: ^2.8.8
eslint: ^9.15.0
eslint-config-turbo: ^2.3.0
eslint-plugin-command: ^0.2.6
eslint-plugin-eslint-comments: ^3.2.0
eslint-plugin-import-x: ^4.4.2
eslint-plugin-jsdoc: ^50.5.0
eslint-plugin-jsonc: ^2.18.1
eslint-plugin-n: ^17.13.1
eslint-plugin-n: ^17.13.2
eslint-plugin-no-only-tests: ^3.3.0
eslint-plugin-perfectionist: ^3.9.1
eslint-plugin-prettier: ^5.2.1
eslint-plugin-regexp: ^2.6.0
eslint-plugin-regexp: ^2.7.0
eslint-plugin-unicorn: ^56.0.0
eslint-plugin-unused-imports: ^4.1.4
eslint-plugin-vitest: ^0.5.4
@ -105,7 +105,7 @@ catalog:
get-port: ^7.1.0
globals: ^15.12.0
h3: ^1.13.0
happy-dom: ^15.11.4
happy-dom: ^15.11.6
html-minifier-terser: ^7.2.0
husky: ^9.1.6
is-ci: ^3.0.1
@ -114,7 +114,7 @@ catalog:
lint-staged: ^15.2.10
lodash.clonedeep: ^4.5.0
lodash.get: ^4.4.2
lucide-vue-next: ^0.456.0
lucide-vue-next: ^0.460.0
medium-zoom: ^1.1.0
naive-ui: ^2.40.1
nitropack: ^2.10.4
@ -137,7 +137,7 @@ catalog:
radix-vue: ^1.9.9
resolve.exports: ^2.0.2
rimraf: ^6.0.1
rollup: ^4.26.0
rollup: ^4.27.2
rollup-plugin-visualizer: ^5.12.0
sass: 1.80.6
sortablejs: ^1.15.3
@ -151,10 +151,10 @@ catalog:
stylelint-prettier: ^5.0.2
stylelint-scss: ^6.9.0
tailwind-merge: ^2.5.4
tailwindcss: ^3.4.14
tailwindcss: ^3.4.15
tailwindcss-animate: ^1.0.7
theme-colors: ^0.1.0
turbo: ^2.2.3
turbo: ^2.3.0
typescript: ^5.6.3
unbuild: ^3.0.0-rc.11
unplugin-element-plus: ^0.8.0
@ -168,13 +168,13 @@ catalog:
vite-plugin-vue-devtools: ^7.6.4
vitepress: ^1.5.0
vitepress-plugin-group-icons: ^1.3.0
vitest: ^2.1.4
vue: ^3.5.12
vitest: ^2.1.5
vue: ^3.5.13
vue-eslint-parser: ^9.4.3
vue-i18n: ^10.0.4
vue-router: ^4.4.5
vue-tsc: ^2.1.10
vxe-pc-ui: ^4.2.53
vxe-pc-ui: ^4.2.55
vxe-table: ^4.8.14
watermark-js-plus: ^1.5.7
zod: ^3.23.8