perf: enable strict ts type checking (#4045)
This commit is contained in:
@@ -22,17 +22,19 @@ function generatorColorVariables(colorItems: ColorItem[]) {
|
||||
colorKeys.forEach((key) => {
|
||||
const colorValue = colorsMap[key];
|
||||
|
||||
const hslColor = convertToHslCssVar(colorValue);
|
||||
colorVariables[`--${name}-${key}`] = hslColor;
|
||||
if (alias) {
|
||||
colorVariables[`--${alias}-${key}`] = hslColor;
|
||||
}
|
||||
if (colorValue) {
|
||||
const hslColor = convertToHslCssVar(colorValue);
|
||||
colorVariables[`--${name}-${key}`] = hslColor;
|
||||
if (alias) {
|
||||
colorVariables[`--${alias}-${key}`] = hslColor;
|
||||
}
|
||||
|
||||
if (key === '500') {
|
||||
mainColor = hslColor;
|
||||
if (key === '500') {
|
||||
mainColor = hslColor;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (alias) {
|
||||
if (alias && mainColor) {
|
||||
colorVariables[`--${alias}`] = mainColor;
|
||||
}
|
||||
}
|
||||
|
@@ -89,10 +89,9 @@ function updateMainColorVariables(preference: Preferences) {
|
||||
]);
|
||||
|
||||
if (colorPrimary) {
|
||||
document.documentElement.style.setProperty(
|
||||
'--primary',
|
||||
colorVariables['--primary-500'],
|
||||
);
|
||||
const mainColor = colorVariables['--primary-500'];
|
||||
mainColor &&
|
||||
document.documentElement.style.setProperty('--primary', mainColor);
|
||||
}
|
||||
|
||||
if (colorVariables['--green-500']) {
|
||||
|
@@ -1,4 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { VbenLayoutProps } from './vben-layout';
|
||||
|
||||
import type { CSSProperties } from 'vue';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
|
||||
@@ -11,7 +13,6 @@ import {
|
||||
LayoutSidebar,
|
||||
LayoutTabbar,
|
||||
} from './components';
|
||||
import { VbenLayoutProps } from './vben-layout';
|
||||
|
||||
interface Props extends VbenLayoutProps {}
|
||||
|
||||
|
@@ -1,4 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import type { UseResizeObserverReturn } from '@vueuse/core';
|
||||
|
||||
import type {
|
||||
MenuItemClicked,
|
||||
MenuItemRegistered,
|
||||
@@ -22,7 +24,7 @@ import { useNamespace } from '@vben-core/composables';
|
||||
import { Ellipsis } from '@vben-core/icons';
|
||||
import { isHttpUrl } from '@vben-core/shared';
|
||||
|
||||
import { useResizeObserver, UseResizeObserverReturn } from '@vueuse/core';
|
||||
import { useResizeObserver } from '@vueuse/core';
|
||||
|
||||
import {
|
||||
createMenuContext,
|
||||
@@ -273,7 +275,7 @@ function close(path: string) {
|
||||
*/
|
||||
function closeMenu(path: string, parentPaths: string[]) {
|
||||
if (props.accordion) {
|
||||
openedMenus.value = subMenus.value[path]?.parentPaths;
|
||||
openedMenus.value = subMenus.value[path]?.parentPaths ?? [];
|
||||
}
|
||||
|
||||
close(path);
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import type { SubMenuProvider } from '../interface';
|
||||
|
||||
import { computed, getCurrentInstance } from 'vue';
|
||||
|
||||
import { SubMenuProvider } from '../interface';
|
||||
import { findComponentUpward } from '../utils';
|
||||
|
||||
function useMenu() {
|
||||
|
@@ -1,10 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import type { MenuRecordRaw } from '@vben-core/typings';
|
||||
|
||||
import type { MenuProps } from './interface';
|
||||
|
||||
import { useForwardProps } from '@vben-core/composables';
|
||||
|
||||
import { Menu } from './components';
|
||||
import { MenuProps } from './interface';
|
||||
import SubMenu from './sub-menu.vue';
|
||||
|
||||
interface Props extends MenuProps {
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import type { ButtonVariants } from '@vben-core/shadcn-ui/components/ui/button';
|
||||
|
||||
import { computed, type HTMLAttributes, useSlots } from 'vue';
|
||||
|
||||
import { VbenTooltip } from '@vben-core/shadcn-ui/components/tooltip';
|
||||
import { ButtonVariants } from '@vben-core/shadcn-ui/components/ui/button';
|
||||
import { cn } from '@vben-core/shared';
|
||||
|
||||
import { type PrimitiveProps } from 'radix-vue';
|
||||
|
@@ -94,7 +94,7 @@ function formatNumber(num: number | string) {
|
||||
const x2 = x.length > 1 ? decimal + x[1] : '';
|
||||
|
||||
const rgx = /(\d+)(\d{3})/;
|
||||
if (separator && !isNumber(separator)) {
|
||||
if (separator && !isNumber(separator) && x1) {
|
||||
while (rgx.test(x1)) {
|
||||
x1 = x1.replace(rgx, `$1${separator}$2`);
|
||||
}
|
||||
|
@@ -1,7 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import type { HoverCardRootEmits, HoverCardRootProps } from 'radix-vue';
|
||||
import type {
|
||||
HoverCardContentProps,
|
||||
HoverCardRootEmits,
|
||||
HoverCardRootProps,
|
||||
} from 'radix-vue';
|
||||
|
||||
import { computed, HTMLAttributes } from 'vue';
|
||||
import type { HTMLAttributes } from 'vue';
|
||||
import { computed } from 'vue';
|
||||
|
||||
import {
|
||||
HoverCard,
|
||||
@@ -9,7 +14,7 @@ import {
|
||||
HoverCardTrigger,
|
||||
} from '@vben-core/shadcn-ui/components/ui/hover-card';
|
||||
|
||||
import { HoverCardContentProps, useForwardPropsEmits } from 'radix-vue';
|
||||
import { useForwardPropsEmits } from 'radix-vue';
|
||||
|
||||
const props = defineProps<
|
||||
{
|
||||
|
@@ -5,7 +5,8 @@ import type {
|
||||
PopoverRootProps,
|
||||
} from 'radix-vue';
|
||||
|
||||
import { computed, HTMLAttributes } from 'vue';
|
||||
import type { HTMLAttributes } from 'vue';
|
||||
import { computed } from 'vue';
|
||||
|
||||
import {
|
||||
PopoverContent,
|
||||
|
@@ -6,7 +6,10 @@ defineOptions({
|
||||
});
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{ content: Component | string; props?: Record<string, any> }>(),
|
||||
defineProps<{
|
||||
content: Component | string | undefined;
|
||||
props?: Record<string, any>;
|
||||
}>(),
|
||||
{
|
||||
props: () => ({}),
|
||||
},
|
||||
|
@@ -1,4 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { TooltipContentProps } from 'radix-vue';
|
||||
|
||||
import type { HTMLAttributes } from 'vue';
|
||||
|
||||
import {
|
||||
@@ -8,8 +10,6 @@ import {
|
||||
TooltipTrigger,
|
||||
} from '@vben-core/shadcn-ui/components/ui/tooltip';
|
||||
|
||||
import { TooltipContentProps } from 'radix-vue';
|
||||
|
||||
interface Props {
|
||||
contentClass?: HTMLAttributes['class'];
|
||||
delayDuration?: number;
|
||||
|
@@ -1,11 +1,12 @@
|
||||
<script lang="ts" setup>
|
||||
import type { TabDefinition } from '@vben-core/typings';
|
||||
|
||||
import type { TabConfig, TabsProps } from '../../types';
|
||||
|
||||
import { computed, watch } from 'vue';
|
||||
|
||||
import { MdiPin, X } from '@vben-core/icons';
|
||||
import { VbenContextMenu, VbenIcon, VbenScrollbar } from '@vben-core/shadcn-ui';
|
||||
import { TabDefinition } from '@vben-core/typings';
|
||||
|
||||
interface Props extends TabsProps {}
|
||||
|
||||
@@ -37,7 +38,7 @@ const typeWithClass = computed(() => {
|
||||
},
|
||||
};
|
||||
|
||||
return typeClasses[props.styleType || 'plain'];
|
||||
return typeClasses[props.styleType || 'plain'] || { content: '' };
|
||||
});
|
||||
|
||||
const tabsView = computed((): TabConfig[] => {
|
||||
|
@@ -2,12 +2,13 @@
|
||||
import type { Sortable } from '@vben-core/composables';
|
||||
import type { TabDefinition } from '@vben-core/typings';
|
||||
|
||||
import type { TabsProps } from './types';
|
||||
|
||||
import { nextTick, onMounted, onUnmounted, ref, watch } from 'vue';
|
||||
|
||||
import { useForwardPropsEmits, useSortable } from '@vben-core/composables';
|
||||
|
||||
import { Tabs, TabsChrome } from './components';
|
||||
import { TabsProps } from './types';
|
||||
|
||||
interface Props extends TabsProps {}
|
||||
|
||||
|
Reference in New Issue
Block a user