chore: 导入类型优化 解决eslint报红

This commit is contained in:
dap 2025-01-10 14:12:42 +08:00
parent 9f6bee86f0
commit 0440ac84fd
22 changed files with 75 additions and 55 deletions

View File

@ -1,4 +1,3 @@
export { default as CropperImage } from './src/cropper.vue';
export { default as CropperAvatar } from './src/cropper-avatar.vue';
export { default as CropperImage } from './src/cropper.vue';
export type { Cropper } from './src/typing';

View File

@ -1,18 +1,14 @@
<script lang="ts" setup>
import {
computed,
type CSSProperties,
type PropType,
ref,
unref,
watch,
watchEffect,
} from 'vue';
import type { ButtonProps } from 'ant-design-vue';
import type { CSSProperties, PropType } from 'vue';
import { computed, ref, unref, watch, watchEffect } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { $t as t } from '@vben/locales';
import { type ButtonProps, message } from 'ant-design-vue';
import { message } from 'ant-design-vue';
import cropperModal from './cropper-modal.vue';

View File

@ -1,7 +1,9 @@
<script lang="ts" setup>
import type { PropType } from 'vue';
import type { CropendResult, Cropper } from './typing';
import { type PropType, ref } from 'vue';
import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { $t as t } from '@vben/locales';

View File

@ -1,5 +1,6 @@
<script lang="ts" setup>
import type { CSSProperties, PropType } from 'vue';
import { computed, onMounted, onUnmounted, ref, unref, useAttrs } from 'vue';
import { useDebounceFn } from '@vueuse/core';

View File

@ -2,19 +2,11 @@
import type { CardSize } from 'ant-design-vue/es/card/Card';
import type { DescriptionsProps } from 'ant-design-vue/es/descriptions';
import type { CSSProperties, PropType, Slots } from 'vue';
import type { DescInstance, DescItem, DescriptionProps } from './typing';
import {
computed,
type CSSProperties,
defineComponent,
type PropType,
ref,
type Slots,
toRefs,
unref,
useAttrs,
} from 'vue';
import { computed, defineComponent, ref, toRefs, unref, useAttrs } from 'vue';
import { Card, Descriptions } from 'ant-design-vue';
import { get, isFunction } from 'lodash-es';

View File

@ -1,9 +1,10 @@
import type { Recordable } from '@vben/types';
import type { DescriptionsProps } from 'ant-design-vue/es/descriptions';
import type { JSX } from 'vue/jsx-runtime';
import type { CSSProperties, VNode } from 'vue';
import type { Recordable } from '@vben/types';
export interface DescItem {
labelMinWidth?: number;
contentMinWidth?: number;

View File

@ -1,4 +1,4 @@
import { type VNode } from 'vue';
import type { VNode } from 'vue';
import { Tag } from 'ant-design-vue';

View File

@ -2,6 +2,10 @@
import type { IPropTypes } from '@tinymce/tinymce-vue/lib/cjs/main/ts/components/EditorPropTypes';
import type { Editor as EditorType } from 'tinymce/tinymce';
import type { PropType } from 'vue';
import type { UploadResult } from '#/api/core/upload';
import {
computed,
nextTick,
@ -9,7 +13,6 @@ import {
onBeforeUnmount,
onDeactivated,
onMounted,
type PropType,
ref,
unref,
useAttrs,
@ -22,7 +25,7 @@ import { buildShortUUID } from '@vben/utils';
import Editor from '@tinymce/tinymce-vue';
import { isNumber } from 'lodash-es';
import { uploadApi, type UploadResult } from '#/api/core/upload';
import { uploadApi } from '#/api/core/upload';
import { bindHandlers } from './helper';
import ImgUpload from './img-upload.vue';

View File

@ -4,9 +4,9 @@ const validEvents = new Set([
'onBeforeAddUndo',
'onBeforeExecCommand',
'onBeforeGetContent',
'onBeforePaste',
'onBeforeRenderUI',
'onBeforeSetContent',
'onBeforePaste',
'onBlur',
'onChange',
'onClearUndos',
@ -42,8 +42,8 @@ const validEvents = new Set([
'onMouseOver',
'onMouseUp',
'onNodeChange',
'onObjectResizeStart',
'onObjectResized',
'onObjectResizeStart',
'onObjectSelected',
'onPaste',
'onPostProcess',

View File

@ -3,9 +3,9 @@ import type { CheckboxChangeEvent } from 'ant-design-vue/es/checkbox/interface';
import type { DataNode } from 'ant-design-vue/es/tree';
import type { CheckInfo } from 'ant-design-vue/es/vc-tree/props';
import type { PropType } from 'vue';
import type { PropType, SetupContext } from 'vue';
import { computed, nextTick, onMounted, ref, watch } from 'vue';
import { computed, nextTick, onMounted, ref, useSlots, watch } from 'vue';
import { findGroupParentIds, treeToList } from '@vben/utils';
@ -159,6 +159,8 @@ onMounted(async () => {
expandedKeys.value = allKeys.value;
}
});
const slots = useSlots() as SetupContext['slots'];
</script>
<template>
@ -207,7 +209,7 @@ onMounted(async () => {
@check="handleChecked"
>
<template
v-for="slotName in Object.keys($slots)"
v-for="slotName in Object.keys(slots)"
:key="slotName"
#[slotName]="data"
>

View File

@ -2,13 +2,16 @@
import type { UploadFile, UploadProps } from 'ant-design-vue';
import type { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface';
import { uploadApi } from '#/api';
import { ossInfo } from '#/api/system/oss';
import { PlusOutlined } from '@ant-design/icons-vue';
import { ref, toRefs, watch } from 'vue';
import { $t } from '@vben/locales';
import { PlusOutlined } from '@ant-design/icons-vue';
import { message, Modal, Upload } from 'ant-design-vue';
import { isArray, isFunction, isObject, isString, uniqueId } from 'lodash-es';
import { ref, toRefs, watch } from 'vue';
import { uploadApi } from '#/api';
import { ossInfo } from '#/api/system/oss';
import { checkImageFileType, defaultImageAccept } from './helper';
import { UploadResultStatus } from './typing';

View File

@ -15,7 +15,7 @@ export interface FileItem {
percent: number;
file: File;
status?: UploadResultStatus;
response?: { fileName: string; ossId: string; url: string } | Recordable<any>;
response?: Recordable<any> | { fileName: string; ossId: string; url: string };
uuid: string;
}

View File

@ -1,6 +1,7 @@
import { computed, unref } from 'vue';
import type { Ref } from 'vue';
import { computed, unref } from 'vue';
import { $t } from '@vben/locales';
export function useUploadType({

View File

@ -1,17 +1,21 @@
import type { LocaleSetupOptions, SupportedLanguagesType } from '@vben/locales';
import type { Locale } from 'ant-design-vue/es/locale';
import type { App } from 'vue';
import type { LocaleSetupOptions, SupportedLanguagesType } from '@vben/locales';
import { ref } from 'vue';
import {
$t,
setupI18n as coreSetup,
loadLocalesMapFromDir,
} from '@vben/locales';
import { preferences } from '@vben/preferences';
import antdEnLocale from 'ant-design-vue/es/locale/en_US';
import antdDefaultLocale from 'ant-design-vue/es/locale/zh_CN';
import dayjs from 'dayjs';
import { ref } from 'vue';
const antdLocale = ref<Locale>(antdDefaultLocale);
@ -28,7 +32,8 @@ const localesMap = loadLocalesMapFromDir(
*/
async function loadMessages(lang: SupportedLanguagesType) {
const [appLocaleMessages] = await Promise.all([
localesMap[lang](),
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
localesMap[lang]!(),
loadThirdPartyMessage(lang),
]);
return appLocaleMessages.default;

View File

@ -4,13 +4,15 @@ import type {
RouteRecordStringComponent,
} from '@vben/types';
import type { Menu } from '#/api';
import { generateAccessible } from '@vben/access';
import { preferences } from '@vben/preferences';
import { message } from 'ant-design-vue';
import { cloneDeep } from 'lodash-es';
import { getAllMenusApi, type Menu } from '#/api';
import { getAllMenusApi } from '#/api';
import { BasicLayout, IFrameView } from '#/layouts';
import { $t } from '#/locales';

View File

@ -1,11 +1,10 @@
import type { TenantOption } from '#/api/core/auth';
import { ref } from 'vue';
import { defineStore } from 'pinia';
import {
tenantList as tenantListApi,
type TenantOption,
} from '#/api/core/auth';
import { tenantList as tenantListApi } from '#/api/core/auth';
/**
*

View File

@ -1,8 +1,9 @@
import type { ModalFuncProps } from 'ant-design-vue';
import type { Rule } from 'ant-design-vue/es/form';
import { reactive } from 'vue';
import { Alert, Form, Input, Modal, type ModalFuncProps } from 'ant-design-vue';
import { Alert, Form, Input, Modal } from 'ant-design-vue';
import { isFunction } from 'lodash-es';
export interface ConfirmModalProps extends Omit<ModalFuncProps, 'visible'> {

View File

@ -1,6 +1,8 @@
<script lang="ts" setup>
import type { LoginCodeParams, VbenFormSchema } from '@vben/common-ui';
import type { TenantResp } from '#/api';
import { computed, onMounted, ref, useTemplateRef } from 'vue';
import { AuthenticationCodeLogin, z } from '@vben/common-ui';
@ -8,7 +10,7 @@ import { $t } from '@vben/locales';
import { Alert, message } from 'ant-design-vue';
import { tenantList, type TenantResp } from '#/api';
import { tenantList } from '#/api';
import { sendSmsCode } from '#/api/core/captcha';
import { useAuthStore } from '#/store';

View File

@ -1,6 +1,9 @@
<script lang="ts" setup>
import type { LoginAndRegisterParams, VbenFormSchema } from '@vben/common-ui';
import type { TenantResp } from '#/api';
import type { CaptchaResponse } from '#/api/core/captcha';
import { computed, onMounted, ref, useTemplateRef } from 'vue';
import { AuthenticationLogin, z } from '@vben/common-ui';
@ -8,8 +11,8 @@ import { $t } from '@vben/locales';
import { omit } from 'lodash-es';
import { tenantList, type TenantResp } from '#/api';
import { captchaImage, type CaptchaResponse } from '#/api/core/captcha';
import { tenantList } from '#/api';
import { captchaImage } from '#/api/core/captcha';
import { useAuthStore } from '#/store';
import OAuthLogin from './oauth-login.vue';

View File

@ -1,7 +1,11 @@
<script setup lang="tsx">
import type { VxeGridProps } from '@vben/plugins/vxe-table';
import type { BindItem } from '../../oauth-common';
import { computed, ref, unref } from 'vue';
import { useVbenVxeGrid, type VxeGridProps } from '@vben/plugins/vxe-table';
import { useVbenVxeGrid } from '@vben/plugins/vxe-table';
import {
Alert,
@ -16,7 +20,7 @@ import {
import { authUnbinding } from '#/api';
import { socialList } from '#/api/system/social';
import { accountBindList, type BindItem } from '../../oauth-common';
import { accountBindList } from '../../oauth-common';
/**
* 没有传递action事件则不支持绑定 弹出默认提示

View File

@ -1,9 +1,11 @@
<script setup lang="ts">
import type { Recordable } from '@vben/types';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { Popconfirm } from 'ant-design-vue';
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { forceLogout2, onlineDeviceList } from '#/api/monitor/online';
import { columns } from '#/views/monitor/online/data';

View File

@ -1,4 +1,6 @@
<script setup lang="ts">
import type { AuthApi } from '#/api';
import { onMounted } from 'vue';
import { useRoute, useRouter } from 'vue-router';
@ -7,7 +9,7 @@ import { useAccessStore } from '@vben/stores';
import { message } from 'ant-design-vue';
import { type AuthApi, authCallback } from '#/api';
import { authCallback } from '#/api';
import { useAuthStore } from '#/store';
import { accountBindList } from '../oauth-common';