Skip to content

Commit

Permalink
refactor: remove the adapter bucket introduction pattern and improve …
Browse files Browse the repository at this point in the history
…potential introduction timing (#4635)

* refactor: remove the adapter bucket introduction pattern and improve potential introduction timing

* chore: update deps
  • Loading branch information
anncwb authored Oct 14, 2024
1 parent 45987fc commit 6c4a742
Show file tree
Hide file tree
Showing 36 changed files with 344 additions and 273 deletions.
2 changes: 0 additions & 2 deletions apps/web-antd/src/adapter/index.ts

This file was deleted.

2 changes: 0 additions & 2 deletions apps/web-ele/src/adapter/index.ts

This file was deleted.

3 changes: 0 additions & 3 deletions apps/web-naive/src/adapter/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion apps/web-naive/src/api/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from '@vben/request';
import { useAccessStore } from '@vben/stores';

import { message } from '#/adapter';
import { message } from '#/adapter/naive';
import { useAuthStore } from '#/store';

import { refreshTokenApi } from './core';
Expand Down
2 changes: 1 addition & 1 deletion apps/web-naive/src/router/access.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {
import { generateAccessible } from '@vben/access';
import { preferences } from '@vben/preferences';

import { message } from '#/adapter';
import { message } from '#/adapter/naive';
import { getAllMenusApi } from '#/api';
import { BasicLayout, IFrameView } from '#/layouts';
import { $t } from '#/locales';
Expand Down
2 changes: 1 addition & 1 deletion apps/web-naive/src/store/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { resetAllStores, useAccessStore, useUserStore } from '@vben/stores';

import { defineStore } from 'pinia';

import { notification } from '#/adapter';
import { notification } from '#/adapter/naive';
import { getAccessCodesApi, getUserInfoApi, loginApi, logoutApi } from '#/api';
import { $t } from '#/locales';

Expand Down
4 changes: 2 additions & 2 deletions docs/src/components/common-ui/vben-form.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ _注意_ 需要指定 `dependencies` 的 `triggerFields` 属性,设置由谁

```vue
<script setup lang="ts">
import { useVbenForm } from '#/adapter';
import { useVbenForm } from '#/adapter/form';
// Form 为弹窗组件
// formApi 为弹窗的方法
Expand Down Expand Up @@ -475,7 +475,7 @@ rules的值可以是一个字符串,也可以是一个zod的schema。
rules也支持 zod 的 schema,可以进行更复杂的校验,zod 的使用请查看 [zod文档](https://zod.dev/)

```ts
import { z } from '#/adapter';
import { z } from '#/adapter/form';

// 基础类型
{
Expand Down
2 changes: 1 addition & 1 deletion docs/src/demos/vben-form/api/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { Button, message, Space } from 'ant-design-vue';
import { useVbenForm } from '#/adapter';
import { useVbenForm } from '#/adapter/form';
const [BaseForm, formApi] = useVbenForm({
// 所有表单项共用,可单独在表单内覆盖
Expand Down
2 changes: 1 addition & 1 deletion docs/src/demos/vben-form/basic/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter';
import { useVbenForm } from '#/adapter/form';
const [BaseForm] = useVbenForm({
// 所有表单项共用,可单独在表单内覆盖
Expand Down
2 changes: 1 addition & 1 deletion docs/src/demos/vben-form/custom/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { h } from 'vue';
import { Input, message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter';
import { useVbenForm } from '#/adapter/form';
const [Form] = useVbenForm({
// 所有表单项共用,可单独在表单内覆盖
Expand Down
2 changes: 1 addition & 1 deletion docs/src/demos/vben-form/dynamic/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter';
import { useVbenForm } from '#/adapter/form';
const [Form] = useVbenForm({
// 提交函数
Expand Down
2 changes: 1 addition & 1 deletion docs/src/demos/vben-form/query/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter';
import { useVbenForm } from '#/adapter/form';
const [QueryForm] = useVbenForm({
// 默认展开
Expand Down
2 changes: 1 addition & 1 deletion docs/src/demos/vben-form/rules/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { message } from 'ant-design-vue';
import { useVbenForm, z } from '#/adapter';
import { useVbenForm, z } from '#/adapter/form';
const [Form] = useVbenForm({
// 所有表单项共用,可单独在表单内覆盖
Expand Down
1 change: 1 addition & 0 deletions internal/lint-configs/eslint-config/src/custom-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ const customConfig: Linter.Config[] = [
],
},
},

{
// 不能引入@vben/*里面的包
files: [
Expand Down
6 changes: 4 additions & 2 deletions packages/effects/layouts/src/authentication/toolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import type { ToolbarType } from './types';
import { computed } from 'vue';
import { preferences } from '@vben/preferences';
import {
AuthenticationColorToggle,
AuthenticationLayoutToggle,
Expand Down Expand Up @@ -41,7 +43,7 @@ const showTheme = computed(() => props.toolbarList.includes('theme'));
<AuthenticationLayoutToggle v-if="showLayout" />
</div>
<!-- Always show Language and Theme toggles -->
<LanguageToggle v-if="showLanguage" />
<ThemeToggle v-if="showTheme" />
<LanguageToggle v-if="showLanguage && preferences.widget.languageToggle" />
<ThemeToggle v-if="showTheme && preferences.widget.themeToggle" />
</div>
</template>
2 changes: 0 additions & 2 deletions playground/src/adapter/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion playground/src/views/examples/drawer/form-drawer-demo.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { useVbenDrawer } from '@vben/common-ui';
import { useVbenForm } from '#/adapter';
import { useVbenForm } from '#/adapter/form';
defineOptions({
name: 'FormDrawerDemo',
Expand Down
2 changes: 1 addition & 1 deletion playground/src/views/examples/form/api.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Page } from '@vben/common-ui';
import { Button, Card, message, Space } from 'ant-design-vue';
import { useVbenForm } from '#/adapter';
import { useVbenForm } from '#/adapter/form';
const [BaseForm, formApi] = useVbenForm({
// 所有表单项共用,可单独在表单内覆盖
Expand Down
2 changes: 1 addition & 1 deletion playground/src/views/examples/form/basic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Page } from '@vben/common-ui';
import { Button, Card, message } from 'ant-design-vue';
import dayjs from 'dayjs';
import { useVbenForm } from '#/adapter';
import { useVbenForm } from '#/adapter/form';
import DocButton from '../doc-button.vue';
Expand Down
2 changes: 1 addition & 1 deletion playground/src/views/examples/form/custom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Page } from '@vben/common-ui';
import { Card, Input, message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter';
import { useVbenForm } from '#/adapter/form';
const [Form] = useVbenForm({
// 所有表单项共用,可单独在表单内覆盖
Expand Down
2 changes: 1 addition & 1 deletion playground/src/views/examples/form/dynamic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Page } from '@vben/common-ui';
import { Button, Card, message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter';
import { useVbenForm } from '#/adapter/form';
const [Form, formApi] = useVbenForm({
// 提交函数
Expand Down
2 changes: 1 addition & 1 deletion playground/src/views/examples/form/merge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Page } from '@vben/common-ui';
import { Button, Card, message, Step, Steps, Switch } from 'ant-design-vue';
import { useVbenForm } from '#/adapter';
import { useVbenForm } from '#/adapter/form';
const currentTab = ref(0);
function onFirstSubmit(values: Record<string, any>) {
Expand Down
2 changes: 1 addition & 1 deletion playground/src/views/examples/form/query.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Page } from '@vben/common-ui';
import { Card, message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter';
import { useVbenForm } from '#/adapter/form';
const [QueryForm] = useVbenForm({
// 默认展开
Expand Down
2 changes: 1 addition & 1 deletion playground/src/views/examples/form/rules.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Page } from '@vben/common-ui';
import { Button, Card, message } from 'ant-design-vue';
import { useVbenForm, z } from '#/adapter';
import { useVbenForm, z } from '#/adapter/form';
const [Form, formApi] = useVbenForm({
// 所有表单项共用,可单独在表单内覆盖
Expand Down
2 changes: 1 addition & 1 deletion playground/src/views/examples/modal/form-model-demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useVbenModal } from '@vben/common-ui';
import { message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter';
import { useVbenForm } from '#/adapter/form';
defineOptions({
name: 'FormModelDemo',
Expand Down
4 changes: 2 additions & 2 deletions playground/src/views/examples/vxe-table/basic.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script lang="ts" setup>
import type { VxeGridListeners, VxeGridProps } from '#/adapter';
import type { VxeGridListeners, VxeGridProps } from '#/adapter/vxe-table';
import { Page } from '@vben/common-ui';
import { Button, message } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import DocButton from '../doc-button.vue';
import { MOCK_TABLE_DATA } from './table-data';
Expand Down
4 changes: 2 additions & 2 deletions playground/src/views/examples/vxe-table/custom-cell.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script lang="ts" setup>
import type { VxeGridProps } from '#/adapter';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { Page } from '@vben/common-ui';
import { Button, Image, Switch, Tag } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getExampleTableApi } from '#/api';
interface RowType {
Expand Down
4 changes: 2 additions & 2 deletions playground/src/views/examples/vxe-table/edit-cell.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script lang="ts" setup>
import type { VxeGridProps } from '#/adapter';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { Page } from '@vben/common-ui';
import { useVbenVxeGrid } from '#/adapter';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getExampleTableApi } from '#/api';
interface RowType {
Expand Down
4 changes: 2 additions & 2 deletions playground/src/views/examples/vxe-table/edit-row.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script lang="ts" setup>
import type { VxeGridProps } from '#/adapter';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { Page } from '@vben/common-ui';
import { Button, message } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getExampleTableApi } from '#/api';
interface RowType {
Expand Down
4 changes: 2 additions & 2 deletions playground/src/views/examples/vxe-table/fixed.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script lang="ts" setup>
import type { VxeGridProps } from '#/adapter';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { Page } from '@vben/common-ui';
import { Button } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getExampleTableApi } from '#/api';
interface RowType {
Expand Down
5 changes: 3 additions & 2 deletions playground/src/views/examples/vxe-table/form.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<script lang="ts" setup>
import type { VbenFormProps, VxeGridProps } from '#/adapter';
import type { VbenFormProps } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { Page } from '@vben/common-ui';
import { message } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getExampleTableApi } from '#/api';
interface RowType {
Expand Down
4 changes: 2 additions & 2 deletions playground/src/views/examples/vxe-table/remote.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script lang="ts" setup>
import type { VxeGridProps } from '#/adapter';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { Page } from '@vben/common-ui';
import { Button } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getExampleTableApi } from '#/api';
interface RowType {
Expand Down
4 changes: 2 additions & 2 deletions playground/src/views/examples/vxe-table/tree.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script lang="ts" setup>
import type { VxeGridProps } from '#/adapter';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { Page } from '@vben/common-ui';
import { Button } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { MOCK_TREE_TABLE_DATA } from './table-data';
Expand Down
4 changes: 2 additions & 2 deletions playground/src/views/examples/vxe-table/virtual.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script lang="ts" setup>
import type { VxeGridProps } from '#/adapter';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { onMounted } from 'vue';
import { Page } from '@vben/common-ui';
import { useVbenVxeGrid } from '#/adapter';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
interface RowType {
id: number;
Expand Down
Loading

0 comments on commit 6c4a742

Please sign in to comment.