Merge branch 'main' of https://github.com/vbenjs/vue-vben-admin into dev
This commit is contained in:
14
.vscode/settings.json
vendored
14
.vscode/settings.json
vendored
@@ -224,10 +224,20 @@
|
|||||||
"commentTranslate.multiLineMerge": true,
|
"commentTranslate.multiLineMerge": true,
|
||||||
"vue.server.hybridMode": true,
|
"vue.server.hybridMode": true,
|
||||||
"vitest.disableWorkspaceWarning": true,
|
"vitest.disableWorkspaceWarning": true,
|
||||||
"cSpell.words": ["tinymce", "vditor"],
|
|
||||||
"typescript.tsdk": "node_modules/typescript/lib",
|
"typescript.tsdk": "node_modules/typescript/lib",
|
||||||
"editor.linkedEditing": true, // 自动同步更改html标签,
|
"editor.linkedEditing": true, // 自动同步更改html标签,
|
||||||
"vscodeCustomCodeColor.highlightValue": "v-access", // v-access显示的颜色
|
"vscodeCustomCodeColor.highlightValue": "v-access", // v-access显示的颜色
|
||||||
"vscodeCustomCodeColor.highlightValueColor": "#CCFFFF",
|
"vscodeCustomCodeColor.highlightValueColor": "#CCFFFF",
|
||||||
"oxc.enable": false
|
"oxc.enable": false,
|
||||||
|
"cSpell.words": [
|
||||||
|
"archiver",
|
||||||
|
"axios",
|
||||||
|
"dotenv",
|
||||||
|
"isequal",
|
||||||
|
"jspm",
|
||||||
|
"napi",
|
||||||
|
"nolebase",
|
||||||
|
"rollup",
|
||||||
|
"vitest"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
@@ -8,40 +8,70 @@ import type { Component } from 'vue';
|
|||||||
import type { BaseFormComponentType } from '@vben/common-ui';
|
import type { BaseFormComponentType } from '@vben/common-ui';
|
||||||
import type { Recordable } from '@vben/types';
|
import type { Recordable } from '@vben/types';
|
||||||
|
|
||||||
import { computed, defineComponent, getCurrentInstance, h, ref } from 'vue';
|
import {
|
||||||
|
computed,
|
||||||
|
defineAsyncComponent,
|
||||||
|
defineComponent,
|
||||||
|
getCurrentInstance,
|
||||||
|
h,
|
||||||
|
ref,
|
||||||
|
} from 'vue';
|
||||||
|
|
||||||
import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui';
|
import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui';
|
||||||
import { $t } from '@vben/locales';
|
import { $t } from '@vben/locales';
|
||||||
|
|
||||||
import {
|
import { notification } from 'ant-design-vue';
|
||||||
AutoComplete,
|
|
||||||
Button,
|
|
||||||
Checkbox,
|
|
||||||
CheckboxGroup,
|
|
||||||
DatePicker,
|
|
||||||
Divider,
|
|
||||||
Input,
|
|
||||||
InputNumber,
|
|
||||||
InputPassword,
|
|
||||||
Mentions,
|
|
||||||
notification,
|
|
||||||
Radio,
|
|
||||||
RadioGroup,
|
|
||||||
RangePicker,
|
|
||||||
Rate,
|
|
||||||
Select,
|
|
||||||
Space,
|
|
||||||
Switch,
|
|
||||||
Textarea,
|
|
||||||
TimePicker,
|
|
||||||
TreeSelect,
|
|
||||||
Upload,
|
|
||||||
} from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { Tinymce as RichTextarea } from '#/components/tinymce';
|
import { Tinymce as RichTextarea } from '#/components/tinymce';
|
||||||
import { FileUpload, ImageUpload } from '#/components/upload';
|
import { FileUpload, ImageUpload } from '#/components/upload';
|
||||||
import { FileUploadOld, ImageUploadOld } from '#/components/upload-old';
|
import { FileUploadOld, ImageUploadOld } from '#/components/upload-old';
|
||||||
|
|
||||||
|
const AutoComplete = defineAsyncComponent(
|
||||||
|
() => import('ant-design-vue/es/auto-complete'),
|
||||||
|
);
|
||||||
|
const Button = defineAsyncComponent(() => import('ant-design-vue/es/button'));
|
||||||
|
const Checkbox = defineAsyncComponent(
|
||||||
|
() => import('ant-design-vue/es/checkbox'),
|
||||||
|
);
|
||||||
|
const CheckboxGroup = defineAsyncComponent(() =>
|
||||||
|
import('ant-design-vue/es/checkbox').then((res) => res.CheckboxGroup),
|
||||||
|
);
|
||||||
|
const DatePicker = defineAsyncComponent(
|
||||||
|
() => import('ant-design-vue/es/date-picker'),
|
||||||
|
);
|
||||||
|
const Divider = defineAsyncComponent(() => import('ant-design-vue/es/divider'));
|
||||||
|
const Input = defineAsyncComponent(() => import('ant-design-vue/es/input'));
|
||||||
|
const InputNumber = defineAsyncComponent(
|
||||||
|
() => import('ant-design-vue/es/input-number'),
|
||||||
|
);
|
||||||
|
const InputPassword = defineAsyncComponent(() =>
|
||||||
|
import('ant-design-vue/es/input').then((res) => res.InputPassword),
|
||||||
|
);
|
||||||
|
const Mentions = defineAsyncComponent(
|
||||||
|
() => import('ant-design-vue/es/mentions'),
|
||||||
|
);
|
||||||
|
const Radio = defineAsyncComponent(() => import('ant-design-vue/es/radio'));
|
||||||
|
const RadioGroup = defineAsyncComponent(() =>
|
||||||
|
import('ant-design-vue/es/radio').then((res) => res.RadioGroup),
|
||||||
|
);
|
||||||
|
const RangePicker = defineAsyncComponent(() =>
|
||||||
|
import('ant-design-vue/es/date-picker').then((res) => res.RangePicker),
|
||||||
|
);
|
||||||
|
const Rate = defineAsyncComponent(() => import('ant-design-vue/es/rate'));
|
||||||
|
const Select = defineAsyncComponent(() => import('ant-design-vue/es/select'));
|
||||||
|
const Space = defineAsyncComponent(() => import('ant-design-vue/es/space'));
|
||||||
|
const Switch = defineAsyncComponent(() => import('ant-design-vue/es/switch'));
|
||||||
|
const Textarea = defineAsyncComponent(() =>
|
||||||
|
import('ant-design-vue/es/input').then((res) => res.Textarea),
|
||||||
|
);
|
||||||
|
const TimePicker = defineAsyncComponent(
|
||||||
|
() => import('ant-design-vue/es/time-picker'),
|
||||||
|
);
|
||||||
|
const TreeSelect = defineAsyncComponent(
|
||||||
|
() => import('ant-design-vue/es/tree-select'),
|
||||||
|
);
|
||||||
|
const Upload = defineAsyncComponent(() => import('ant-design-vue/es/upload'));
|
||||||
|
|
||||||
const withDefaultPlaceholder = <T extends Component>(
|
const withDefaultPlaceholder = <T extends Component>(
|
||||||
component: T,
|
component: T,
|
||||||
type: 'input' | 'select',
|
type: 'input' | 'select',
|
||||||
|
@@ -1,8 +1,7 @@
|
|||||||
import { createApp, watchEffect } from 'vue';
|
import { createApp, watchEffect } from 'vue';
|
||||||
|
|
||||||
import { registerAccessDirective } from '@vben/access';
|
import { registerAccessDirective } from '@vben/access';
|
||||||
import { initTippy, registerLoadingDirective } from '@vben/common-ui';
|
import { registerLoadingDirective } from '@vben/common-ui/es/loading';
|
||||||
import { MotionPlugin } from '@vben/plugins/motion';
|
|
||||||
import { preferences } from '@vben/preferences';
|
import { preferences } from '@vben/preferences';
|
||||||
import { initStores } from '@vben/stores';
|
import { initStores } from '@vben/stores';
|
||||||
import '@vben/styles';
|
import '@vben/styles';
|
||||||
@@ -50,12 +49,14 @@ async function bootstrap(namespace: string) {
|
|||||||
registerAccessDirective(app);
|
registerAccessDirective(app);
|
||||||
|
|
||||||
// 初始化 tippy
|
// 初始化 tippy
|
||||||
|
const { initTippy } = await import('@vben/common-ui/es/tippy');
|
||||||
initTippy(app);
|
initTippy(app);
|
||||||
|
|
||||||
// 配置路由及路由守卫
|
// 配置路由及路由守卫
|
||||||
app.use(router);
|
app.use(router);
|
||||||
|
|
||||||
// 配置Motion插件
|
// 配置Motion插件
|
||||||
|
const { MotionPlugin } = await import('@vben/plugins/motion');
|
||||||
app.use(MotionPlugin);
|
app.use(MotionPlugin);
|
||||||
|
|
||||||
// 动态更新标题
|
// 动态更新标题
|
||||||
|
@@ -2,10 +2,10 @@ import type { RouteRecordRaw } from 'vue-router';
|
|||||||
|
|
||||||
import { DEFAULT_HOME_PATH, LOGIN_PATH } from '@vben/constants';
|
import { DEFAULT_HOME_PATH, LOGIN_PATH } from '@vben/constants';
|
||||||
|
|
||||||
import { AuthPageLayout, BasicLayout } from '#/layouts';
|
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
import Login from '#/views/_core/authentication/login.vue';
|
|
||||||
|
|
||||||
|
const BasicLayout = () => import('#/layouts/basic.vue');
|
||||||
|
const AuthPageLayout = () => import('#/layouts/auth.vue');
|
||||||
/** 全局404页面 */
|
/** 全局404页面 */
|
||||||
const fallbackNotFoundRoute: RouteRecordRaw = {
|
const fallbackNotFoundRoute: RouteRecordRaw = {
|
||||||
component: () => import('#/views/_core/fallback/not-found.vue'),
|
component: () => import('#/views/_core/fallback/not-found.vue'),
|
||||||
@@ -58,7 +58,7 @@ const coreRoutes: RouteRecordRaw[] = [
|
|||||||
{
|
{
|
||||||
name: 'Login',
|
name: 'Login',
|
||||||
path: 'login',
|
path: 'login',
|
||||||
component: Login,
|
component: () => import('#/views/_core/authentication/login.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
title: $t('page.auth.login'),
|
title: $t('page.auth.login'),
|
||||||
},
|
},
|
||||||
|
@@ -43,6 +43,9 @@ export type BeforeCloseScope = {
|
|||||||
isConfirm: boolean;
|
isConfirm: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* alert 属性
|
||||||
|
*/
|
||||||
export type AlertProps = {
|
export type AlertProps = {
|
||||||
/** 关闭前的回调,如果返回false,则终止关闭 */
|
/** 关闭前的回调,如果返回false,则终止关闭 */
|
||||||
beforeClose?: (
|
beforeClose?: (
|
||||||
@@ -50,6 +53,8 @@ export type AlertProps = {
|
|||||||
) => boolean | Promise<boolean | undefined> | undefined;
|
) => boolean | Promise<boolean | undefined> | undefined;
|
||||||
/** 边框 */
|
/** 边框 */
|
||||||
bordered?: boolean;
|
bordered?: boolean;
|
||||||
|
/** 按钮对齐方式 */
|
||||||
|
buttonAlign?: 'center' | 'end' | 'start';
|
||||||
/** 取消按钮的标题 */
|
/** 取消按钮的标题 */
|
||||||
cancelText?: string;
|
cancelText?: string;
|
||||||
/** 是否居中显示 */
|
/** 是否居中显示 */
|
||||||
@@ -62,6 +67,8 @@ export type AlertProps = {
|
|||||||
content: Component | string;
|
content: Component | string;
|
||||||
/** 弹窗内容的额外样式 */
|
/** 弹窗内容的额外样式 */
|
||||||
contentClass?: string;
|
contentClass?: string;
|
||||||
|
/** 执行beforeClose回调期间,在内容区域显示一个loading遮罩*/
|
||||||
|
contentMasking?: boolean;
|
||||||
/** 弹窗的图标(在标题的前面) */
|
/** 弹窗的图标(在标题的前面) */
|
||||||
icon?: Component | IconType;
|
icon?: Component | IconType;
|
||||||
/** 是否显示取消按钮 */
|
/** 是否显示取消按钮 */
|
||||||
@@ -70,6 +77,25 @@ export type AlertProps = {
|
|||||||
title?: string;
|
title?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** prompt 属性 */
|
||||||
|
export type PromptProps<T = any> = {
|
||||||
|
/** 关闭前的回调,如果返回false,则终止关闭 */
|
||||||
|
beforeClose?: (scope: {
|
||||||
|
isConfirm: boolean;
|
||||||
|
value: T | undefined;
|
||||||
|
}) => boolean | Promise<boolean | undefined> | undefined;
|
||||||
|
/** 用于接受用户输入的组件 */
|
||||||
|
component?: Component;
|
||||||
|
/** 输入组件的属性 */
|
||||||
|
componentProps?: Recordable<any>;
|
||||||
|
/** 输入组件的插槽 */
|
||||||
|
componentSlots?: Recordable<Component>;
|
||||||
|
/** 默认值 */
|
||||||
|
defaultValue?: T;
|
||||||
|
/** 输入组件的值属性名 */
|
||||||
|
modelPropName?: string;
|
||||||
|
} & Omit<AlertProps, 'beforeClose'>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 函数签名
|
* 函数签名
|
||||||
* alert和confirm的函数签名相同。
|
* alert和confirm的函数签名相同。
|
||||||
|
@@ -167,6 +167,23 @@ vxeUI.renderer.add('CellLink', {
|
|||||||
|
|
||||||
当启用了表单搜索时,可以在toolbarConfig中配置`search`为`true`来让表格在工具栏区域显示一个搜索表单控制按钮。表格的所有以`form-`开头的命名插槽都会被传递给搜索表单。
|
当启用了表单搜索时,可以在toolbarConfig中配置`search`为`true`来让表格在工具栏区域显示一个搜索表单控制按钮。表格的所有以`form-`开头的命名插槽都会被传递给搜索表单。
|
||||||
|
|
||||||
|
### 定制分隔条
|
||||||
|
|
||||||
|
当你启用表单搜索时,在表单和表格之间会显示一个分隔条。这个分隔条使用了默认的组件背景色,并且横向贯穿整个Vben Vxe Table在视觉上融入了页面的默认背景中。如果你在Vben Vxe Table的外层包裹了一个不同背景色的容器(如将其放在一个Card内),默认的表单和表格之间的分隔条可能就显得格格不入了,下面的代码演示了如何定制这个分隔条。
|
||||||
|
|
||||||
|
```ts
|
||||||
|
const [Grid] = useVbenVxeGrid({
|
||||||
|
formOptions: {},
|
||||||
|
gridOptions: {},
|
||||||
|
// 完全移除分隔条
|
||||||
|
separator: false,
|
||||||
|
// 你也可以使用下面的代码来移除分隔条
|
||||||
|
// separator: { show: false },
|
||||||
|
// 或者使用下面的代码来改变分隔条的颜色
|
||||||
|
// separator: { backgroundColor: 'rgba(100,100,0,0.5)' },
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
<DemoPreview dir="demos/vben-vxe-table/form" />
|
<DemoPreview dir="demos/vben-vxe-table/form" />
|
||||||
|
|
||||||
## 单元格编辑
|
## 单元格编辑
|
||||||
@@ -231,15 +248,16 @@ useVbenVxeGrid 返回的第二个参数,是一个对象,包含了一些表
|
|||||||
|
|
||||||
所有属性都可以传入 `useVbenVxeGrid` 的第一个参数中。
|
所有属性都可以传入 `useVbenVxeGrid` 的第一个参数中。
|
||||||
|
|
||||||
| 属性名 | 描述 | 类型 |
|
| 属性名 | 描述 | 类型 | 版本要求 |
|
||||||
| -------------- | -------------------- | ------------------- |
|
| --- | --- | --- | --- |
|
||||||
| tableTitle | 表格标题 | `string` |
|
| tableTitle | 表格标题 | `string` | - |
|
||||||
| tableTitleHelp | 表格标题帮助信息 | `string` |
|
| tableTitleHelp | 表格标题帮助信息 | `string` | - |
|
||||||
| gridClass | grid组件的class | `string` |
|
| gridClass | grid组件的class | `string` | - |
|
||||||
| gridOptions | grid组件的参数 | `VxeTableGridProps` |
|
| gridOptions | grid组件的参数 | `VxeTableGridProps` | - |
|
||||||
| gridEvents | grid组件的触发的事件 | `VxeGridListeners` |
|
| gridEvents | grid组件的触发的事件 | `VxeGridListeners` | - |
|
||||||
| formOptions | 表单参数 | `VbenFormProps` |
|
| formOptions | 表单参数 | `VbenFormProps` | - |
|
||||||
| showSearchForm | 是否显示搜索表单 | `boolean` |
|
| showSearchForm | 是否显示搜索表单 | `boolean` | - |
|
||||||
|
| separator | 搜索表单与表格主体之间的分隔条 | `boolean\|SeparatorOptions` | >5.5.4 |
|
||||||
|
|
||||||
## Slots
|
## Slots
|
||||||
|
|
||||||
|
@@ -3,7 +3,7 @@ import { h } from 'vue';
|
|||||||
|
|
||||||
import { alert, VbenButton } from '@vben/common-ui';
|
import { alert, VbenButton } from '@vben/common-ui';
|
||||||
|
|
||||||
import { Empty } from 'ant-design-vue';
|
import { Result } from 'ant-design-vue';
|
||||||
|
|
||||||
function showAlert() {
|
function showAlert() {
|
||||||
alert('This is an alert message');
|
alert('This is an alert message');
|
||||||
@@ -18,7 +18,12 @@ function showIconAlert() {
|
|||||||
|
|
||||||
function showCustomAlert() {
|
function showCustomAlert() {
|
||||||
alert({
|
alert({
|
||||||
content: h(Empty, { description: '什么都没有' }),
|
buttonAlign: 'center',
|
||||||
|
content: h(Result, {
|
||||||
|
status: 'success',
|
||||||
|
subTitle: '已成功创建订单。订单ID:2017182818828182881',
|
||||||
|
title: '操作成功',
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@@ -1,7 +1,10 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { h } from 'vue';
|
||||||
|
|
||||||
import { alert, prompt, VbenButton } from '@vben/common-ui';
|
import { alert, prompt, VbenButton } from '@vben/common-ui';
|
||||||
|
|
||||||
import { VbenSelect } from '@vben-core/shadcn-ui';
|
import { Input, RadioGroup } from 'ant-design-vue';
|
||||||
|
import { BadgeJapaneseYen } from 'lucide-vue-next';
|
||||||
|
|
||||||
function showPrompt() {
|
function showPrompt() {
|
||||||
prompt({
|
prompt({
|
||||||
@@ -17,25 +20,62 @@ function showPrompt() {
|
|||||||
|
|
||||||
function showSelectPrompt() {
|
function showSelectPrompt() {
|
||||||
prompt({
|
prompt({
|
||||||
component: VbenSelect,
|
component: Input,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
placeholder: '请输入',
|
||||||
|
prefix: '充值金额',
|
||||||
|
type: 'number',
|
||||||
|
},
|
||||||
|
componentSlots: {
|
||||||
|
addonAfter: () => h(BadgeJapaneseYen),
|
||||||
|
},
|
||||||
|
content: '此弹窗演示了如何使用componentSlots传递自定义插槽',
|
||||||
|
icon: 'question',
|
||||||
|
modelPropName: 'value',
|
||||||
|
}).then((val) => {
|
||||||
|
if (val) alert(`你输入的是${val}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function sleep(ms: number) {
|
||||||
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
|
}
|
||||||
|
|
||||||
|
function showAsyncPrompt() {
|
||||||
|
prompt({
|
||||||
|
async beforeClose(scope) {
|
||||||
|
console.log(scope);
|
||||||
|
if (scope.isConfirm) {
|
||||||
|
if (scope.value) {
|
||||||
|
// 模拟异步操作,如果不成功,可以返回false
|
||||||
|
await sleep(2000);
|
||||||
|
} else {
|
||||||
|
alert('请选择一个选项');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
component: RadioGroup,
|
||||||
|
componentProps: {
|
||||||
|
class: 'flex flex-col',
|
||||||
options: [
|
options: [
|
||||||
{ label: 'Option 1', value: 'option1' },
|
{ label: 'Option 1', value: 'option1' },
|
||||||
{ label: 'Option 2', value: 'option2' },
|
{ label: 'Option 2', value: 'option2' },
|
||||||
{ label: 'Option 3', value: 'option3' },
|
{ label: 'Option 3', value: 'option3' },
|
||||||
],
|
],
|
||||||
placeholder: '请选择',
|
|
||||||
},
|
},
|
||||||
content: 'This is an alert message with icon',
|
content: '选择一个选项后再点击[确认]',
|
||||||
icon: 'question',
|
icon: 'question',
|
||||||
|
modelPropName: 'value',
|
||||||
}).then((val) => {
|
}).then((val) => {
|
||||||
alert(`你选择的是${val}`);
|
alert(`${val} 已设置。`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="flex gap-4">
|
<div class="flex gap-4">
|
||||||
<VbenButton @click="showPrompt">Prompt</VbenButton>
|
<VbenButton @click="showPrompt">Prompt</VbenButton>
|
||||||
<VbenButton @click="showSelectPrompt">Confirm With Select</VbenButton>
|
<VbenButton @click="showSelectPrompt">Prompt With Select</VbenButton>
|
||||||
|
<VbenButton @click="showAsyncPrompt">Prompt With Async</VbenButton>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import type { Component } from 'vue';
|
import type { Component, VNode } from 'vue';
|
||||||
|
|
||||||
import type { Recordable } from '@vben-core/typings';
|
import type { Recordable } from '@vben-core/typings';
|
||||||
|
|
||||||
import type { AlertProps, BeforeCloseScope } from './alert';
|
import type { AlertProps, BeforeCloseScope, PromptProps } from './alert';
|
||||||
|
|
||||||
import { h, ref, render } from 'vue';
|
import { h, nextTick, ref, render } from 'vue';
|
||||||
|
|
||||||
import { useSimpleLocale } from '@vben-core/composables';
|
import { useSimpleLocale } from '@vben-core/composables';
|
||||||
import { Input } from '@vben-core/shadcn-ui';
|
import { Input } from '@vben-core/shadcn-ui';
|
||||||
@@ -130,40 +130,58 @@ export function vbenConfirm(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function vbenPrompt<T = any>(
|
export async function vbenPrompt<T = any>(
|
||||||
options: Omit<AlertProps, 'beforeClose'> & {
|
options: PromptProps<T>,
|
||||||
beforeClose?: (scope: {
|
|
||||||
isConfirm: boolean;
|
|
||||||
value: T | undefined;
|
|
||||||
}) => boolean | Promise<boolean | undefined> | undefined;
|
|
||||||
component?: Component;
|
|
||||||
componentProps?: Recordable<any>;
|
|
||||||
defaultValue?: T;
|
|
||||||
modelPropName?: string;
|
|
||||||
},
|
|
||||||
): Promise<T | undefined> {
|
): Promise<T | undefined> {
|
||||||
const {
|
const {
|
||||||
component: _component,
|
component: _component,
|
||||||
componentProps: _componentProps,
|
componentProps: _componentProps,
|
||||||
|
componentSlots,
|
||||||
content,
|
content,
|
||||||
defaultValue,
|
defaultValue,
|
||||||
modelPropName: _modelPropName,
|
modelPropName: _modelPropName,
|
||||||
...delegated
|
...delegated
|
||||||
} = options;
|
} = options;
|
||||||
const contents: Component[] = [];
|
|
||||||
const modelValue = ref<T | undefined>(defaultValue);
|
const modelValue = ref<T | undefined>(defaultValue);
|
||||||
|
const inputComponentRef = ref<null | VNode>(null);
|
||||||
|
const staticContents: Component[] = [];
|
||||||
|
|
||||||
if (isString(content)) {
|
if (isString(content)) {
|
||||||
contents.push(h('span', content));
|
staticContents.push(h('span', content));
|
||||||
} else {
|
} else if (content) {
|
||||||
contents.push(content);
|
staticContents.push(content as Component);
|
||||||
}
|
}
|
||||||
const componentProps = _componentProps || {};
|
|
||||||
const modelPropName = _modelPropName || 'modelValue';
|
const modelPropName = _modelPropName || 'modelValue';
|
||||||
componentProps[modelPropName] = modelValue.value;
|
const componentProps = { ..._componentProps };
|
||||||
componentProps[`onUpdate:${modelPropName}`] = (val: any) => {
|
|
||||||
modelValue.value = val;
|
// 每次渲染时都会重新计算的内容函数
|
||||||
|
const contentRenderer = () => {
|
||||||
|
const currentProps = { ...componentProps };
|
||||||
|
|
||||||
|
// 设置当前值
|
||||||
|
currentProps[modelPropName] = modelValue.value;
|
||||||
|
|
||||||
|
// 设置更新处理函数
|
||||||
|
currentProps[`onUpdate:${modelPropName}`] = (val: T) => {
|
||||||
|
modelValue.value = val;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 创建输入组件
|
||||||
|
inputComponentRef.value = h(
|
||||||
|
_component || Input,
|
||||||
|
currentProps,
|
||||||
|
componentSlots,
|
||||||
|
);
|
||||||
|
|
||||||
|
// 返回包含静态内容和输入组件的数组
|
||||||
|
return h(
|
||||||
|
'div',
|
||||||
|
{ class: 'flex flex-col gap-2' },
|
||||||
|
{ default: () => [...staticContents, inputComponentRef.value] },
|
||||||
|
);
|
||||||
};
|
};
|
||||||
const componentRef = h(_component || Input, componentProps);
|
|
||||||
contents.push(componentRef);
|
|
||||||
const props: AlertProps & Recordable<any> = {
|
const props: AlertProps & Recordable<any> = {
|
||||||
...delegated,
|
...delegated,
|
||||||
async beforeClose(scope: BeforeCloseScope) {
|
async beforeClose(scope: BeforeCloseScope) {
|
||||||
@@ -174,23 +192,46 @@ export async function vbenPrompt<T = any>(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
content: h(
|
// 使用函数形式,每次渲染都会重新计算内容
|
||||||
'div',
|
content: contentRenderer,
|
||||||
{ class: 'flex flex-col gap-2' },
|
contentMasking: true,
|
||||||
{ default: () => contents },
|
async onOpened() {
|
||||||
),
|
await nextTick();
|
||||||
onOpened() {
|
const componentRef: null | VNode = inputComponentRef.value;
|
||||||
// 组件挂载完成后,自动聚焦到输入组件
|
if (componentRef) {
|
||||||
if (
|
if (
|
||||||
componentRef.component?.exposed &&
|
componentRef.component?.exposed &&
|
||||||
isFunction(componentRef.component.exposed.focus)
|
isFunction(componentRef.component.exposed.focus)
|
||||||
) {
|
) {
|
||||||
componentRef.component.exposed.focus();
|
componentRef.component.exposed.focus();
|
||||||
} else if (componentRef.el && isFunction(componentRef.el.focus)) {
|
} else {
|
||||||
componentRef.el.focus();
|
if (componentRef.el) {
|
||||||
|
if (
|
||||||
|
isFunction(componentRef.el.focus) &&
|
||||||
|
['BUTTON', 'INPUT', 'SELECT', 'TEXTAREA'].includes(
|
||||||
|
componentRef.el.tagName,
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
componentRef.el.focus();
|
||||||
|
} else if (isFunction(componentRef.el.querySelector)) {
|
||||||
|
const focusableElement = componentRef.el.querySelector(
|
||||||
|
'input, select, textarea, button',
|
||||||
|
);
|
||||||
|
if (focusableElement && isFunction(focusableElement.focus)) {
|
||||||
|
focusableElement.focus();
|
||||||
|
}
|
||||||
|
} else if (
|
||||||
|
componentRef.el.nextElementSibling &&
|
||||||
|
isFunction(componentRef.el.nextElementSibling.focus)
|
||||||
|
) {
|
||||||
|
componentRef.el.nextElementSibling.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
await vbenConfirm(props);
|
await vbenConfirm(props);
|
||||||
return modelValue.value;
|
return modelValue.value;
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
import type { Component } from 'vue';
|
import type { Component, VNode, VNodeArrayChildren } from 'vue';
|
||||||
|
|
||||||
|
import type { Recordable } from '@vben-core/typings';
|
||||||
|
|
||||||
export type IconType = 'error' | 'info' | 'question' | 'success' | 'warning';
|
export type IconType = 'error' | 'info' | 'question' | 'success' | 'warning';
|
||||||
|
|
||||||
@@ -13,6 +15,11 @@ export type AlertProps = {
|
|||||||
) => boolean | Promise<boolean | undefined> | undefined;
|
) => boolean | Promise<boolean | undefined> | undefined;
|
||||||
/** 边框 */
|
/** 边框 */
|
||||||
bordered?: boolean;
|
bordered?: boolean;
|
||||||
|
/**
|
||||||
|
* 按钮对齐方式
|
||||||
|
* @default 'end'
|
||||||
|
*/
|
||||||
|
buttonAlign?: 'center' | 'end' | 'start';
|
||||||
/** 取消按钮的标题 */
|
/** 取消按钮的标题 */
|
||||||
cancelText?: string;
|
cancelText?: string;
|
||||||
/** 是否居中显示 */
|
/** 是否居中显示 */
|
||||||
@@ -25,6 +32,8 @@ export type AlertProps = {
|
|||||||
content: Component | string;
|
content: Component | string;
|
||||||
/** 弹窗内容的额外样式 */
|
/** 弹窗内容的额外样式 */
|
||||||
contentClass?: string;
|
contentClass?: string;
|
||||||
|
/** 执行beforeClose回调期间,在内容区域显示一个loading遮罩*/
|
||||||
|
contentMasking?: boolean;
|
||||||
/** 弹窗的图标(在标题的前面) */
|
/** 弹窗的图标(在标题的前面) */
|
||||||
icon?: Component | IconType;
|
icon?: Component | IconType;
|
||||||
/** 是否显示取消按钮 */
|
/** 是否显示取消按钮 */
|
||||||
@@ -32,3 +41,26 @@ export type AlertProps = {
|
|||||||
/** 弹窗标题 */
|
/** 弹窗标题 */
|
||||||
title?: string;
|
title?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Prompt属性 */
|
||||||
|
export type PromptProps<T = any> = {
|
||||||
|
/** 关闭前的回调,如果返回false,则终止关闭 */
|
||||||
|
beforeClose?: (scope: {
|
||||||
|
isConfirm: boolean;
|
||||||
|
value: T | undefined;
|
||||||
|
}) => boolean | Promise<boolean | undefined> | undefined;
|
||||||
|
/** 用于接受用户输入的组件 */
|
||||||
|
component?: Component;
|
||||||
|
/** 输入组件的属性 */
|
||||||
|
componentProps?: Recordable<any>;
|
||||||
|
/** 输入组件的插槽 */
|
||||||
|
componentSlots?:
|
||||||
|
| (() => any)
|
||||||
|
| Recordable<unknown>
|
||||||
|
| VNode
|
||||||
|
| VNodeArrayChildren;
|
||||||
|
/** 默认值 */
|
||||||
|
defaultValue?: T;
|
||||||
|
/** 输入组件的值属性名 */
|
||||||
|
modelPropName?: string;
|
||||||
|
} & Omit<AlertProps, 'beforeClose'>;
|
||||||
|
@@ -30,6 +30,7 @@ import { cn } from '@vben-core/shared/utils';
|
|||||||
|
|
||||||
const props = withDefaults(defineProps<AlertProps>(), {
|
const props = withDefaults(defineProps<AlertProps>(), {
|
||||||
bordered: true,
|
bordered: true,
|
||||||
|
buttonAlign: 'end',
|
||||||
centered: true,
|
centered: true,
|
||||||
containerClass: 'w-[520px]',
|
containerClass: 'w-[520px]',
|
||||||
});
|
});
|
||||||
@@ -154,9 +155,9 @@ async function handleOpenChange(val: boolean) {
|
|||||||
<div class="m-4 mb-6 min-h-[30px]">
|
<div class="m-4 mb-6 min-h-[30px]">
|
||||||
<VbenRenderContent :content="content" render-br />
|
<VbenRenderContent :content="content" render-br />
|
||||||
</div>
|
</div>
|
||||||
<VbenLoading v-if="loading" :spinning="loading" />
|
<VbenLoading v-if="loading && contentMasking" :spinning="loading" />
|
||||||
</AlertDialogDescription>
|
</AlertDialogDescription>
|
||||||
<div class="flex justify-end gap-x-2">
|
<div class="flex justify-end gap-x-2" :class="`justify-${buttonAlign}`">
|
||||||
<AlertDialogCancel v-if="showCancel" :disabled="loading">
|
<AlertDialogCancel v-if="showCancel" :disabled="loading">
|
||||||
<component
|
<component
|
||||||
:is="components.DefaultButton || VbenButton"
|
:is="components.DefaultButton || VbenButton"
|
||||||
|
@@ -6,11 +6,11 @@ import type { ValueType, VbenButtonGroupProps } from './button';
|
|||||||
import { computed, ref, watch } from 'vue';
|
import { computed, ref, watch } from 'vue';
|
||||||
|
|
||||||
import { Circle, CircleCheckBig, LoaderCircle } from '@vben-core/icons';
|
import { Circle, CircleCheckBig, LoaderCircle } from '@vben-core/icons';
|
||||||
import { VbenRenderContent } from '@vben-core/shadcn-ui';
|
|
||||||
import { cn, isFunction } from '@vben-core/shared/utils';
|
import { cn, isFunction } from '@vben-core/shared/utils';
|
||||||
|
|
||||||
import { objectOmit } from '@vueuse/core';
|
import { objectOmit } from '@vueuse/core';
|
||||||
|
|
||||||
|
import { VbenRenderContent } from '../render-content';
|
||||||
import VbenButtonGroup from './button-group.vue';
|
import VbenButtonGroup from './button-group.vue';
|
||||||
import Button from './button.vue';
|
import Button from './button.vue';
|
||||||
|
|
||||||
|
@@ -17,6 +17,14 @@
|
|||||||
".": {
|
".": {
|
||||||
"types": "./src/index.ts",
|
"types": "./src/index.ts",
|
||||||
"default": "./src/index.ts"
|
"default": "./src/index.ts"
|
||||||
|
},
|
||||||
|
"./es/tippy": {
|
||||||
|
"types": "./src/components/tippy/index.ts",
|
||||||
|
"default": "./src/components/tippy/index.ts"
|
||||||
|
},
|
||||||
|
"./es/loading": {
|
||||||
|
"types": "./src/components/loading/index.ts",
|
||||||
|
"default": "./src/components/loading/index.ts"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@@ -5,9 +5,11 @@ import type {
|
|||||||
RouteLocationNormalizedLoadedGeneric,
|
RouteLocationNormalizedLoadedGeneric,
|
||||||
} from 'vue-router';
|
} from 'vue-router';
|
||||||
|
|
||||||
|
import { computed } from 'vue';
|
||||||
|
import { RouterView } from 'vue-router';
|
||||||
|
|
||||||
import { preferences, usePreferences } from '@vben/preferences';
|
import { preferences, usePreferences } from '@vben/preferences';
|
||||||
import { storeToRefs, useTabbarStore } from '@vben/stores';
|
import { storeToRefs, useTabbarStore } from '@vben/stores';
|
||||||
import { RouterView } from 'vue-router';
|
|
||||||
|
|
||||||
import { IFrameRouterView } from '../../iframe';
|
import { IFrameRouterView } from '../../iframe';
|
||||||
|
|
||||||
@@ -19,6 +21,15 @@ const { keepAlive } = usePreferences();
|
|||||||
const { getCachedTabs, getExcludeCachedTabs, renderRouteView } =
|
const { getCachedTabs, getExcludeCachedTabs, renderRouteView } =
|
||||||
storeToRefs(tabbarStore);
|
storeToRefs(tabbarStore);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否使用动画
|
||||||
|
*/
|
||||||
|
const getEnabledTransition = computed(() => {
|
||||||
|
const { transition } = preferences;
|
||||||
|
const transitionName = transition.name;
|
||||||
|
return transitionName && transition.enable;
|
||||||
|
});
|
||||||
|
|
||||||
// 页面切换动画
|
// 页面切换动画
|
||||||
function getTransitionName(_route: RouteLocationNormalizedLoaded) {
|
function getTransitionName(_route: RouteLocationNormalizedLoaded) {
|
||||||
// 如果偏好设置未设置,则不使用动画
|
// 如果偏好设置未设置,则不使用动画
|
||||||
@@ -89,7 +100,12 @@ function transformComponent(
|
|||||||
<div class="relative h-full">
|
<div class="relative h-full">
|
||||||
<IFrameRouterView />
|
<IFrameRouterView />
|
||||||
<RouterView v-slot="{ Component, route }">
|
<RouterView v-slot="{ Component, route }">
|
||||||
<Transition :name="getTransitionName(route)" appear mode="out-in">
|
<Transition
|
||||||
|
v-if="getEnabledTransition"
|
||||||
|
:name="getTransitionName(route)"
|
||||||
|
appear
|
||||||
|
mode="out-in"
|
||||||
|
>
|
||||||
<KeepAlive
|
<KeepAlive
|
||||||
v-if="keepAlive"
|
v-if="keepAlive"
|
||||||
:exclude="getExcludeCachedTabs"
|
:exclude="getExcludeCachedTabs"
|
||||||
@@ -108,6 +124,25 @@ function transformComponent(
|
|||||||
:key="route.fullPath"
|
:key="route.fullPath"
|
||||||
/>
|
/>
|
||||||
</Transition>
|
</Transition>
|
||||||
|
<template v-else>
|
||||||
|
<KeepAlive
|
||||||
|
v-if="keepAlive"
|
||||||
|
:exclude="getExcludeCachedTabs"
|
||||||
|
:include="getCachedTabs"
|
||||||
|
>
|
||||||
|
<component
|
||||||
|
:is="transformComponent(Component, route)"
|
||||||
|
v-if="renderRouteView"
|
||||||
|
v-show="!route.meta.iframeSrc"
|
||||||
|
:key="route.fullPath"
|
||||||
|
/>
|
||||||
|
</KeepAlive>
|
||||||
|
<component
|
||||||
|
:is="Component"
|
||||||
|
v-else-if="renderRouteView"
|
||||||
|
:key="route.fullPath"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
</RouterView>
|
</RouterView>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@@ -1,6 +1,3 @@
|
|||||||
import type { ClassType, DeepPartial } from '@vben/types';
|
|
||||||
import type { VbenFormProps } from '@vben-core/form-ui';
|
|
||||||
import type { Ref } from 'vue';
|
|
||||||
import type {
|
import type {
|
||||||
VxeGridListeners,
|
VxeGridListeners,
|
||||||
VxeGridPropTypes,
|
VxeGridPropTypes,
|
||||||
@@ -8,6 +5,12 @@ import type {
|
|||||||
VxeUIExport,
|
VxeUIExport,
|
||||||
} from 'vxe-table';
|
} from 'vxe-table';
|
||||||
|
|
||||||
|
import type { Ref } from 'vue';
|
||||||
|
|
||||||
|
import type { ClassType, DeepPartial } from '@vben/types';
|
||||||
|
|
||||||
|
import type { VbenFormProps } from '@vben-core/form-ui';
|
||||||
|
|
||||||
import type { VxeGridApi } from './api';
|
import type { VxeGridApi } from './api';
|
||||||
|
|
||||||
import { useVbenForm } from '@vben-core/form-ui';
|
import { useVbenForm } from '@vben-core/form-ui';
|
||||||
@@ -28,6 +31,10 @@ export interface VxeTableGridOptions<T = any> extends VxeTableGridProps<T> {
|
|||||||
toolbarConfig?: ToolbarConfigOptions;
|
toolbarConfig?: ToolbarConfigOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SeparatorOptions {
|
||||||
|
show?: boolean;
|
||||||
|
backgroundColor?: string;
|
||||||
|
}
|
||||||
export interface VxeGridProps {
|
export interface VxeGridProps {
|
||||||
/**
|
/**
|
||||||
* 标题
|
* 标题
|
||||||
@@ -61,13 +68,17 @@ export interface VxeGridProps {
|
|||||||
* 显示搜索表单
|
* 显示搜索表单
|
||||||
*/
|
*/
|
||||||
showSearchForm?: boolean;
|
showSearchForm?: boolean;
|
||||||
|
/**
|
||||||
|
* 搜索表单与表格主体之间的分隔条
|
||||||
|
*/
|
||||||
|
separator?: boolean | SeparatorOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ExtendedVxeGridApi = {
|
export type ExtendedVxeGridApi = VxeGridApi & {
|
||||||
useStore: <T = NoInfer<VxeGridProps>>(
|
useStore: <T = NoInfer<VxeGridProps>>(
|
||||||
selector?: (state: NoInfer<VxeGridProps>) => T,
|
selector?: (state: NoInfer<VxeGridProps>) => T,
|
||||||
) => Readonly<Ref<T>>;
|
) => Readonly<Ref<T>>;
|
||||||
} & VxeGridApi;
|
};
|
||||||
|
|
||||||
export interface SetupVxeTable {
|
export interface SetupVxeTable {
|
||||||
configVxeTable: (ui: VxeUIExport) => void;
|
configVxeTable: (ui: VxeUIExport) => void;
|
||||||
|
@@ -29,7 +29,13 @@ import { usePriorityValues } from '@vben/hooks';
|
|||||||
import { EmptyIcon } from '@vben/icons';
|
import { EmptyIcon } from '@vben/icons';
|
||||||
import { $t } from '@vben/locales';
|
import { $t } from '@vben/locales';
|
||||||
import { usePreferences } from '@vben/preferences';
|
import { usePreferences } from '@vben/preferences';
|
||||||
import { cloneDeep, cn, isEqual, mergeWithArrayOverride } from '@vben/utils';
|
import {
|
||||||
|
cloneDeep,
|
||||||
|
cn,
|
||||||
|
isBoolean,
|
||||||
|
isEqual,
|
||||||
|
mergeWithArrayOverride,
|
||||||
|
} from '@vben/utils';
|
||||||
|
|
||||||
import { VbenHelpTooltip, VbenLoading } from '@vben-core/shadcn-ui';
|
import { VbenHelpTooltip, VbenLoading } from '@vben-core/shadcn-ui';
|
||||||
|
|
||||||
@@ -67,10 +73,30 @@ const {
|
|||||||
tableTitle,
|
tableTitle,
|
||||||
tableTitleHelp,
|
tableTitleHelp,
|
||||||
showSearchForm,
|
showSearchForm,
|
||||||
|
separator,
|
||||||
} = usePriorityValues(props, state);
|
} = usePriorityValues(props, state);
|
||||||
|
|
||||||
const { isMobile } = usePreferences();
|
const { isMobile } = usePreferences();
|
||||||
|
const isSeparator = computed(() => {
|
||||||
|
if (
|
||||||
|
!formOptions.value ||
|
||||||
|
showSearchForm.value === false ||
|
||||||
|
separator.value === false
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (separator.value === true || separator.value === undefined) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return separator.value.show !== false;
|
||||||
|
});
|
||||||
|
const separatorBg = computed(() => {
|
||||||
|
return !separator.value ||
|
||||||
|
isBoolean(separator.value) ||
|
||||||
|
!separator.value.backgroundColor
|
||||||
|
? undefined
|
||||||
|
: separator.value.backgroundColor;
|
||||||
|
});
|
||||||
const slots: SetupContext['slots'] = useSlots();
|
const slots: SetupContext['slots'] = useSlots();
|
||||||
|
|
||||||
const [Form, formApi] = useTableForm({
|
const [Form, formApi] = useTableForm({
|
||||||
@@ -380,7 +406,18 @@ onUnmounted(() => {
|
|||||||
<div
|
<div
|
||||||
v-if="formOptions"
|
v-if="formOptions"
|
||||||
v-show="showSearchForm !== false"
|
v-show="showSearchForm !== false"
|
||||||
:class="cn('relative rounded py-3', isCompactForm ? 'pb-8' : 'pb-4')"
|
:class="
|
||||||
|
cn(
|
||||||
|
'relative rounded py-3',
|
||||||
|
isCompactForm
|
||||||
|
? isSeparator
|
||||||
|
? 'pb-8'
|
||||||
|
: 'pb-4'
|
||||||
|
: isSeparator
|
||||||
|
? 'pb-4'
|
||||||
|
: 'pb-0',
|
||||||
|
)
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<slot name="form">
|
<slot name="form">
|
||||||
<Form>
|
<Form>
|
||||||
@@ -409,6 +446,10 @@ onUnmounted(() => {
|
|||||||
</Form>
|
</Form>
|
||||||
</slot>
|
</slot>
|
||||||
<div
|
<div
|
||||||
|
v-if="isSeparator"
|
||||||
|
:style="{
|
||||||
|
...(separatorBg ? { backgroundColor: separatorBg } : undefined),
|
||||||
|
}"
|
||||||
class="bg-background-deep z-100 absolute -left-2 bottom-1 h-2 w-[calc(100%+1rem)] overflow-hidden md:bottom-2 md:h-3"
|
class="bg-background-deep z-100 absolute -left-2 bottom-1 h-2 w-[calc(100%+1rem)] overflow-hidden md:bottom-2 md:h-3"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -8,35 +8,64 @@ import type { Component } from 'vue';
|
|||||||
import type { BaseFormComponentType } from '@vben/common-ui';
|
import type { BaseFormComponentType } from '@vben/common-ui';
|
||||||
import type { Recordable } from '@vben/types';
|
import type { Recordable } from '@vben/types';
|
||||||
|
|
||||||
import { defineComponent, getCurrentInstance, h, ref } from 'vue';
|
import {
|
||||||
|
defineAsyncComponent,
|
||||||
|
defineComponent,
|
||||||
|
getCurrentInstance,
|
||||||
|
h,
|
||||||
|
ref,
|
||||||
|
} from 'vue';
|
||||||
|
|
||||||
import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui';
|
import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui';
|
||||||
import { $t } from '@vben/locales';
|
import { $t } from '@vben/locales';
|
||||||
|
|
||||||
import {
|
import { notification } from 'ant-design-vue';
|
||||||
AutoComplete,
|
|
||||||
Button,
|
const AutoComplete = defineAsyncComponent(
|
||||||
Checkbox,
|
() => import('ant-design-vue/es/auto-complete'),
|
||||||
CheckboxGroup,
|
);
|
||||||
DatePicker,
|
const Button = defineAsyncComponent(() => import('ant-design-vue/es/button'));
|
||||||
Divider,
|
const Checkbox = defineAsyncComponent(
|
||||||
Input,
|
() => import('ant-design-vue/es/checkbox'),
|
||||||
InputNumber,
|
);
|
||||||
InputPassword,
|
const CheckboxGroup = defineAsyncComponent(() =>
|
||||||
Mentions,
|
import('ant-design-vue/es/checkbox').then((res) => res.CheckboxGroup),
|
||||||
notification,
|
);
|
||||||
Radio,
|
const DatePicker = defineAsyncComponent(
|
||||||
RadioGroup,
|
() => import('ant-design-vue/es/date-picker'),
|
||||||
RangePicker,
|
);
|
||||||
Rate,
|
const Divider = defineAsyncComponent(() => import('ant-design-vue/es/divider'));
|
||||||
Select,
|
const Input = defineAsyncComponent(() => import('ant-design-vue/es/input'));
|
||||||
Space,
|
const InputNumber = defineAsyncComponent(
|
||||||
Switch,
|
() => import('ant-design-vue/es/input-number'),
|
||||||
Textarea,
|
);
|
||||||
TimePicker,
|
const InputPassword = defineAsyncComponent(() =>
|
||||||
TreeSelect,
|
import('ant-design-vue/es/input').then((res) => res.InputPassword),
|
||||||
Upload,
|
);
|
||||||
} from 'ant-design-vue';
|
const Mentions = defineAsyncComponent(
|
||||||
|
() => import('ant-design-vue/es/mentions'),
|
||||||
|
);
|
||||||
|
const Radio = defineAsyncComponent(() => import('ant-design-vue/es/radio'));
|
||||||
|
const RadioGroup = defineAsyncComponent(() =>
|
||||||
|
import('ant-design-vue/es/radio').then((res) => res.RadioGroup),
|
||||||
|
);
|
||||||
|
const RangePicker = defineAsyncComponent(() =>
|
||||||
|
import('ant-design-vue/es/date-picker').then((res) => res.RangePicker),
|
||||||
|
);
|
||||||
|
const Rate = defineAsyncComponent(() => import('ant-design-vue/es/rate'));
|
||||||
|
const Select = defineAsyncComponent(() => import('ant-design-vue/es/select'));
|
||||||
|
const Space = defineAsyncComponent(() => import('ant-design-vue/es/space'));
|
||||||
|
const Switch = defineAsyncComponent(() => import('ant-design-vue/es/switch'));
|
||||||
|
const Textarea = defineAsyncComponent(() =>
|
||||||
|
import('ant-design-vue/es/input').then((res) => res.Textarea),
|
||||||
|
);
|
||||||
|
const TimePicker = defineAsyncComponent(
|
||||||
|
() => import('ant-design-vue/es/time-picker'),
|
||||||
|
);
|
||||||
|
const TreeSelect = defineAsyncComponent(
|
||||||
|
() => import('ant-design-vue/es/tree-select'),
|
||||||
|
);
|
||||||
|
const Upload = defineAsyncComponent(() => import('ant-design-vue/es/upload'));
|
||||||
|
|
||||||
const withDefaultPlaceholder = <T extends Component>(
|
const withDefaultPlaceholder = <T extends Component>(
|
||||||
component: T,
|
component: T,
|
||||||
|
@@ -1,14 +1,12 @@
|
|||||||
import { createApp, watchEffect } from 'vue';
|
import { createApp, watchEffect } from 'vue';
|
||||||
|
|
||||||
import { registerAccessDirective } from '@vben/access';
|
import { registerAccessDirective } from '@vben/access';
|
||||||
import { initTippy, registerLoadingDirective } from '@vben/common-ui';
|
import { registerLoadingDirective } from '@vben/common-ui';
|
||||||
import { MotionPlugin } from '@vben/plugins/motion';
|
|
||||||
import { preferences } from '@vben/preferences';
|
import { preferences } from '@vben/preferences';
|
||||||
import { initStores } from '@vben/stores';
|
import { initStores } from '@vben/stores';
|
||||||
import '@vben/styles';
|
import '@vben/styles';
|
||||||
import '@vben/styles/antd';
|
import '@vben/styles/antd';
|
||||||
|
|
||||||
import { VueQueryPlugin } from '@tanstack/vue-query';
|
|
||||||
import { useTitle } from '@vueuse/core';
|
import { useTitle } from '@vueuse/core';
|
||||||
|
|
||||||
import { $t, setupI18n } from '#/locales';
|
import { $t, setupI18n } from '#/locales';
|
||||||
@@ -21,13 +19,13 @@ async function bootstrap(namespace: string) {
|
|||||||
// 初始化组件适配器
|
// 初始化组件适配器
|
||||||
await initComponentAdapter();
|
await initComponentAdapter();
|
||||||
|
|
||||||
// // 设置弹窗的默认配置
|
// 设置弹窗的默认配置
|
||||||
// setDefaultModalProps({
|
// setDefaultModalProps({
|
||||||
// fullscreenButton: false,
|
// fullscreenButton: false,
|
||||||
// });
|
// });
|
||||||
// // 设置抽屉的默认配置
|
// 设置抽屉的默认配置
|
||||||
// setDefaultDrawerProps({
|
// setDefaultDrawerProps({
|
||||||
// // zIndex: 1020,
|
// zIndex: 1020,
|
||||||
// });
|
// });
|
||||||
|
|
||||||
const app = createApp(App);
|
const app = createApp(App);
|
||||||
@@ -48,15 +46,18 @@ async function bootstrap(namespace: string) {
|
|||||||
registerAccessDirective(app);
|
registerAccessDirective(app);
|
||||||
|
|
||||||
// 初始化 tippy
|
// 初始化 tippy
|
||||||
|
const { initTippy } = await import('@vben/common-ui/es/tippy');
|
||||||
initTippy(app);
|
initTippy(app);
|
||||||
|
|
||||||
// 配置路由及路由守卫
|
// 配置路由及路由守卫
|
||||||
app.use(router);
|
app.use(router);
|
||||||
|
|
||||||
// 配置@tanstack/vue-query
|
// 配置@tanstack/vue-query
|
||||||
|
const { VueQueryPlugin } = await import('@tanstack/vue-query');
|
||||||
app.use(VueQueryPlugin);
|
app.use(VueQueryPlugin);
|
||||||
|
|
||||||
// 配置Motion插件
|
// 配置Motion插件
|
||||||
|
const { MotionPlugin } = await import('@vben/plugins/motion');
|
||||||
app.use(MotionPlugin);
|
app.use(MotionPlugin);
|
||||||
|
|
||||||
// 动态更新标题
|
// 动态更新标题
|
||||||
|
@@ -2,10 +2,10 @@ import type { RouteRecordRaw } from 'vue-router';
|
|||||||
|
|
||||||
import { DEFAULT_HOME_PATH, LOGIN_PATH } from '@vben/constants';
|
import { DEFAULT_HOME_PATH, LOGIN_PATH } from '@vben/constants';
|
||||||
|
|
||||||
import { AuthPageLayout, BasicLayout } from '#/layouts';
|
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
import Login from '#/views/_core/authentication/login.vue';
|
|
||||||
|
|
||||||
|
const BasicLayout = () => import('#/layouts/basic.vue');
|
||||||
|
const AuthPageLayout = () => import('#/layouts/auth.vue');
|
||||||
/** 全局404页面 */
|
/** 全局404页面 */
|
||||||
const fallbackNotFoundRoute: RouteRecordRaw = {
|
const fallbackNotFoundRoute: RouteRecordRaw = {
|
||||||
component: () => import('#/views/_core/fallback/not-found.vue'),
|
component: () => import('#/views/_core/fallback/not-found.vue'),
|
||||||
@@ -50,7 +50,7 @@ const coreRoutes: RouteRecordRaw[] = [
|
|||||||
{
|
{
|
||||||
name: 'Login',
|
name: 'Login',
|
||||||
path: 'login',
|
path: 'login',
|
||||||
component: Login,
|
component: () => import('#/views/_core/authentication/login.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
title: $t('page.auth.login'),
|
title: $t('page.auth.login'),
|
||||||
},
|
},
|
||||||
|
@@ -21,22 +21,22 @@ catalog:
|
|||||||
'@commitlint/cli': ^19.8.0
|
'@commitlint/cli': ^19.8.0
|
||||||
'@commitlint/config-conventional': ^19.8.0
|
'@commitlint/config-conventional': ^19.8.0
|
||||||
'@ctrl/tinycolor': ^4.1.0
|
'@ctrl/tinycolor': ^4.1.0
|
||||||
'@eslint/js': ^9.23.0
|
'@eslint/js': ^9.24.0
|
||||||
'@faker-js/faker': ^9.6.0
|
'@faker-js/faker': ^9.6.0
|
||||||
'@iconify/json': ^2.2.323
|
'@iconify/json': ^2.2.324
|
||||||
'@iconify/tailwind': ^1.2.0
|
'@iconify/tailwind': ^1.2.0
|
||||||
'@iconify/vue': ^4.3.0
|
'@iconify/vue': ^4.3.0
|
||||||
'@intlify/core-base': ^11.1.2
|
'@intlify/core-base': ^11.1.3
|
||||||
'@intlify/unplugin-vue-i18n': ^6.0.5
|
'@intlify/unplugin-vue-i18n': ^6.0.5
|
||||||
'@jspm/generator': ^2.5.1
|
'@jspm/generator': ^2.5.1
|
||||||
'@manypkg/get-packages': ^2.2.2
|
'@manypkg/get-packages': ^2.2.2
|
||||||
'@nolebase/vitepress-plugin-git-changelog': ^2.15.1
|
'@nolebase/vitepress-plugin-git-changelog': ^2.16.0
|
||||||
'@playwright/test': ^1.51.1
|
'@playwright/test': ^1.51.1
|
||||||
'@pnpm/workspace.read-manifest': ^1000.1.2
|
'@pnpm/workspace.read-manifest': ^1000.1.3
|
||||||
'@stylistic/stylelint-plugin': ^3.1.2
|
'@stylistic/stylelint-plugin': ^3.1.2
|
||||||
'@tailwindcss/nesting': 0.0.0-insiders.565cd3e
|
'@tailwindcss/nesting': 0.0.0-insiders.565cd3e
|
||||||
'@tailwindcss/typography': ^0.5.16
|
'@tailwindcss/typography': ^0.5.16
|
||||||
'@tanstack/vue-query': ^5.71.1
|
'@tanstack/vue-query': ^5.72.0
|
||||||
'@tanstack/vue-store': ^0.7.0
|
'@tanstack/vue-store': ^0.7.0
|
||||||
'@types/archiver': ^6.0.3
|
'@types/archiver': ^6.0.3
|
||||||
'@types/eslint': ^9.6.1
|
'@types/eslint': ^9.6.1
|
||||||
@@ -46,14 +46,14 @@ catalog:
|
|||||||
'@types/lodash.get': ^4.4.9
|
'@types/lodash.get': ^4.4.9
|
||||||
'@types/lodash.isequal': ^4.5.8
|
'@types/lodash.isequal': ^4.5.8
|
||||||
'@types/lodash.set': ^4.3.9
|
'@types/lodash.set': ^4.3.9
|
||||||
'@types/node': ^22.13.17
|
'@types/node': ^22.14.0
|
||||||
'@types/nprogress': ^0.2.3
|
'@types/nprogress': ^0.2.3
|
||||||
'@types/postcss-import': ^14.0.3
|
'@types/postcss-import': ^14.0.3
|
||||||
'@types/qrcode': ^1.5.5
|
'@types/qrcode': ^1.5.5
|
||||||
'@types/qs': ^6.9.18
|
'@types/qs': ^6.9.18
|
||||||
'@types/sortablejs': ^1.15.8
|
'@types/sortablejs': ^1.15.8
|
||||||
'@typescript-eslint/eslint-plugin': ^8.29.0
|
'@typescript-eslint/eslint-plugin': ^8.29.1
|
||||||
'@typescript-eslint/parser': ^8.29.0
|
'@typescript-eslint/parser': ^8.29.1
|
||||||
'@vee-validate/zod': ^4.15.0
|
'@vee-validate/zod': ^4.15.0
|
||||||
'@vite-pwa/vitepress': ^0.5.4
|
'@vite-pwa/vitepress': ^0.5.4
|
||||||
'@vitejs/plugin-vue': ^5.2.3
|
'@vitejs/plugin-vue': ^5.2.3
|
||||||
@@ -88,17 +88,17 @@ catalog:
|
|||||||
dotenv: ^16.4.7
|
dotenv: ^16.4.7
|
||||||
echarts: ^5.6.0
|
echarts: ^5.6.0
|
||||||
element-plus: ^2.9.7
|
element-plus: ^2.9.7
|
||||||
eslint: ^9.23.0
|
eslint: ^9.24.0
|
||||||
eslint-config-turbo: ^2.4.4
|
eslint-config-turbo: ^2.5.0
|
||||||
eslint-plugin-command: ^0.2.7
|
eslint-plugin-command: ^0.2.7
|
||||||
eslint-plugin-eslint-comments: ^3.2.0
|
eslint-plugin-eslint-comments: ^3.2.0
|
||||||
eslint-plugin-import-x: ^4.10.0
|
eslint-plugin-import-x: ^4.10.2
|
||||||
eslint-plugin-jsdoc: ^50.6.9
|
eslint-plugin-jsdoc: ^50.6.9
|
||||||
eslint-plugin-jsonc: ^2.20.0
|
eslint-plugin-jsonc: ^2.20.0
|
||||||
eslint-plugin-n: ^17.17.0
|
eslint-plugin-n: ^17.17.0
|
||||||
eslint-plugin-no-only-tests: ^3.3.0
|
eslint-plugin-no-only-tests: ^3.3.0
|
||||||
eslint-plugin-perfectionist: ^4.11.0
|
eslint-plugin-perfectionist: ^4.11.0
|
||||||
eslint-plugin-prettier: ^5.2.5
|
eslint-plugin-prettier: ^5.2.6
|
||||||
eslint-plugin-regexp: ^2.7.0
|
eslint-plugin-regexp: ^2.7.0
|
||||||
eslint-plugin-unicorn: ^56.0.1
|
eslint-plugin-unicorn: ^56.0.1
|
||||||
eslint-plugin-unused-imports: ^4.1.4
|
eslint-plugin-unused-imports: ^4.1.4
|
||||||
@@ -146,9 +146,9 @@ catalog:
|
|||||||
rimraf: ^6.0.1
|
rimraf: ^6.0.1
|
||||||
rollup: ^4.39.0
|
rollup: ^4.39.0
|
||||||
rollup-plugin-visualizer: ^5.14.0
|
rollup-plugin-visualizer: ^5.14.0
|
||||||
sass: ^1.86.1
|
sass: ^1.86.3
|
||||||
sortablejs: ^1.15.6
|
sortablejs: ^1.15.6
|
||||||
stylelint: ^16.17.0
|
stylelint: ^16.18.0
|
||||||
stylelint-config-recess-order: ^5.1.1
|
stylelint-config-recess-order: ^5.1.1
|
||||||
stylelint-config-recommended: ^14.0.1
|
stylelint-config-recommended: ^14.0.1
|
||||||
stylelint-config-recommended-scss: ^14.1.0
|
stylelint-config-recommended-scss: ^14.1.0
|
||||||
@@ -162,12 +162,12 @@ catalog:
|
|||||||
tailwindcss-animate: ^1.0.7
|
tailwindcss-animate: ^1.0.7
|
||||||
theme-colors: ^0.1.0
|
theme-colors: ^0.1.0
|
||||||
tippy.js: ^6.2.5
|
tippy.js: ^6.2.5
|
||||||
turbo: ^2.4.4
|
turbo: ^2.5.0
|
||||||
typescript: ^5.8.2
|
typescript: ^5.8.3
|
||||||
unbuild: ^3.5.0
|
unbuild: ^3.5.0
|
||||||
unplugin-element-plus: ^0.9.1
|
unplugin-element-plus: ^0.9.1
|
||||||
vee-validate: ^4.15.0
|
vee-validate: ^4.15.0
|
||||||
vite: ^6.2.4
|
vite: ^6.2.5
|
||||||
vite-plugin-compression: ^0.5.1
|
vite-plugin-compression: ^0.5.1
|
||||||
vite-plugin-dts: ^4.5.3
|
vite-plugin-dts: ^4.5.3
|
||||||
vite-plugin-html: ^3.2.2
|
vite-plugin-html: ^3.2.2
|
||||||
@@ -179,12 +179,12 @@ catalog:
|
|||||||
vitest: ^2.1.9
|
vitest: ^2.1.9
|
||||||
vue: ^3.5.13
|
vue: ^3.5.13
|
||||||
vue-eslint-parser: ^9.4.3
|
vue-eslint-parser: ^9.4.3
|
||||||
vue-i18n: ^11.1.2
|
vue-i18n: ^11.1.3
|
||||||
vue-json-viewer: ^3.0.4
|
vue-json-viewer: ^3.0.4
|
||||||
vue-router: ^4.5.0
|
vue-router: ^4.5.0
|
||||||
vue-tippy: ^6.7.0
|
vue-tippy: ^6.7.0
|
||||||
vue-tsc: 2.1.10
|
vue-tsc: 2.1.10
|
||||||
vxe-pc-ui: ^4.5.11
|
vxe-pc-ui: ^4.5.14
|
||||||
vxe-table: ^4.12.5
|
vxe-table: ^4.12.5
|
||||||
watermark-js-plus: ^1.5.8
|
watermark-js-plus: ^1.5.8
|
||||||
zod: ^3.24.2
|
zod: ^3.24.2
|
||||||
|
Reference in New Issue
Block a user