diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 154922b3f08..b82fee1a0e6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,13 @@ permissions: jobs: post-update: # if: ${{ github.actor == 'dependabot[bot]' }} - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + # - macos-latest + - windows-latest steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/apps/web-antd/package.json b/apps/web-antd/package.json index c7386a3afad..490816016da 100644 --- a/apps/web-antd/package.json +++ b/apps/web-antd/package.json @@ -1,6 +1,6 @@ { "name": "@vben/web-antd", - "version": "5.2.2", + "version": "5.3.0-beta.2", "homepage": "https://vben.pro", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "repository": { @@ -44,7 +44,7 @@ "ant-design-vue": "^4.2.3", "dayjs": "^1.11.13", "pinia": "2.2.2", - "vue": "^3.5.3", - "vue-router": "^4.4.3" + "vue": "^3.5.4", + "vue-router": "^4.4.4" } } diff --git a/apps/web-antd/src/adapter/form.ts b/apps/web-antd/src/adapter/form.ts new file mode 100644 index 00000000000..06e8cf1348b --- /dev/null +++ b/apps/web-antd/src/adapter/form.ts @@ -0,0 +1,114 @@ +import type { + BaseFormComponentType, + VbenFormSchema as FormSchema, + VbenFormProps, +} from '@vben/common-ui'; + +import { h } from 'vue'; + +import { setupVbenForm, useVbenForm as useForm, z } from '@vben/common-ui'; +import { $t } from '@vben/locales'; + +import { + AutoComplete, + Button, + Checkbox, + CheckboxGroup, + DatePicker, + Divider, + Input, + InputNumber, + InputPassword, + Mentions, + Radio, + RadioGroup, + RangePicker, + Rate, + Select, + Space, + Switch, + TimePicker, + TreeSelect, + Upload, +} from 'ant-design-vue'; + +// 业务表单组件适配 + +export type FormComponentType = + | 'AutoComplete' + | 'Checkbox' + | 'CheckboxGroup' + | 'DatePicker' + | 'Divider' + | 'Input' + | 'InputNumber' + | 'InputPassword' + | 'Mentions' + | 'Radio' + | 'RadioGroup' + | 'RangePicker' + | 'Rate' + | 'Select' + | 'Space' + | 'Switch' + | 'TimePicker' + | 'TreeSelect' + | 'Upload' + | BaseFormComponentType; + +// 初始化表单组件,并注册到form组件内部 +setupVbenForm({ + components: { + AutoComplete, + Checkbox, + CheckboxGroup, + DatePicker, + // 自定义默认的重置按钮 + DefaultResetActionButton: (props, { attrs, slots }) => { + return h(Button, { ...props, attrs, type: 'default' }, slots); + }, + // 自定义默认的提交按钮 + DefaultSubmitActionButton: (props, { attrs, slots }) => { + return h(Button, { ...props, attrs, type: 'primary' }, slots); + }, + Divider, + Input, + InputNumber, + InputPassword, + Mentions, + Radio, + RadioGroup, + RangePicker, + Rate, + Select, + Space, + Switch, + TimePicker, + TreeSelect, + Upload, + }, + config: { + baseModelPropName: 'value', + modelPropNameMap: { + Checkbox: 'checked', + Radio: 'checked', + Switch: 'checked', + Upload: 'fileList', + }, + }, + defineRules: { + required: (value, _params, ctx) => { + if ((!value && value !== 0) || value.length === 0) { + return $t('formRules.required', [ctx.label]); + } + return true; + }, + }, +}); + +const useVbenForm = useForm; + +export { useVbenForm, z }; + +export type VbenFormSchema = FormSchema; +export type { VbenFormProps }; diff --git a/apps/web-antd/src/adapter/index.ts b/apps/web-antd/src/adapter/index.ts new file mode 100644 index 00000000000..698d687b924 --- /dev/null +++ b/apps/web-antd/src/adapter/index.ts @@ -0,0 +1 @@ +export * from './form'; diff --git a/apps/web-antd/src/layouts/basic.vue b/apps/web-antd/src/layouts/basic.vue index 9e25d99f3d5..3c302634b82 100644 --- a/apps/web-antd/src/layouts/basic.vue +++ b/apps/web-antd/src/layouts/basic.vue @@ -13,11 +13,12 @@ import { UserDropdown, } from '@vben/layouts'; import { preferences } from '@vben/preferences'; -import { storeToRefs, useAccessStore, useUserStore } from '@vben/stores'; +import { useAccessStore, useUserStore } from '@vben/stores'; import { openWindow } from '@vben/utils'; import { $t } from '#/locales'; import { useAuthStore } from '#/store'; +import LoginForm from '#/views/_core/authentication/login.vue'; const notifications = ref([ { @@ -87,8 +88,6 @@ const menus = computed(() => [ }, ]); -const { loginLoading } = storeToRefs(authStore); - const avatar = computed(() => { return userStore.userInfo?.avatar ?? preferences.app.defaultAvatar; }); @@ -130,11 +129,9 @@ function handleMakeAll() { + > + +