chore: code format

This commit is contained in:
xiaojunnuo
2025-06-29 14:09:09 +08:00
parent 04422a4637
commit 4fcfd089d8
644 changed files with 10845 additions and 13184 deletions
@@ -2,7 +2,7 @@
import type { RendererElement } from "vue";
defineOptions({
name: "CollapseTransition"
name: "CollapseTransition",
});
const reset = (el: RendererElement) => {
@@ -85,7 +85,7 @@ const on = {
leaveCancelled(el: RendererElement) {
reset(el);
}
},
};
</script>
@@ -8,7 +8,7 @@ interface Props {
withDefaults(defineProps<Props>(), {
dotClass: "",
dotStyle: () => ({})
dotStyle: () => ({}),
});
</script>
<template>
@@ -18,7 +18,7 @@ const variantsMap: Record<string, string> = {
destructive: "bg-destructive",
primary: "bg-primary",
success: "bg-green-500",
warning: "bg-yellow-500"
warning: "bg-yellow-500",
};
const isDot = computed(() => props.badgeType === "dot");
@@ -36,7 +36,7 @@ const badgeClass = computed(() => {
const badgeStyle = computed(() => {
if (badgeClass.value && isValidColor(badgeClass.value)) {
return {
backgroundColor: badgeClass.value
backgroundColor: badgeClass.value,
};
}
return {};
@@ -14,7 +14,7 @@ interface Props extends MenuItemProps {}
defineOptions({ name: "MenuItem" });
const props = withDefaults(defineProps<Props>(), {
disabled: false
disabled: false,
});
const emit = defineEmits<{ click: [MenuItemRegistered] }>();
@@ -38,7 +38,7 @@ const showTooltip = computed(() => rootMenu.props.mode === "vertical" && isTopLe
const item: MenuItemRegistered = reactive({
active,
parentPaths: parentPaths.value,
path: props.path || ""
path: props.path || "",
});
/**
@@ -54,7 +54,7 @@ function handleClick() {
}
rootMenu?.handleMenuItemClick?.({
parentPaths: parentPaths.value,
path: props.path
path: props.path,
});
emit("click", item);
}
@@ -28,7 +28,7 @@ const props = withDefaults(defineProps<Props>(), {
collapse: false,
mode: "vertical",
rounded: true,
theme: "dark"
theme: "dark",
});
const emit = defineEmits<{
@@ -66,7 +66,7 @@ const getSlot = computed(() => {
watch(
() => props.collapse,
(value) => {
value => {
if (value) openedMenus.value = [];
}
);
@@ -109,7 +109,7 @@ createMenuContext(
removeSubMenu,
subMenus,
theme: toRef(props, "theme"),
items
items,
})
);
@@ -117,7 +117,7 @@ createSubMenuContext({
addSubMenu,
level: 1,
mouseInChild,
removeSubMenu
removeSubMenu,
});
function calcMenuItemWidth(menuItem: HTMLElement) {
@@ -132,7 +132,7 @@ function calcSliceIndex() {
return -1;
}
const items = [...(menu.value?.childNodes ?? [])].filter(
(item) =>
item =>
// remove comment type node #12634
item.nodeName !== "#comment" && (item.nodeName !== "#text" || item.nodeValue)
) as HTMLElement[];
@@ -198,7 +198,7 @@ function initMenu() {
// 展开该菜单项的路径上所有子菜单
// expand all subMenus of the menu item
parentPaths.forEach((path) => {
parentPaths.forEach(path => {
const subMenu = subMenus.value[path];
subMenu && openMenu(path, subMenu.parentPaths);
});
@@ -9,14 +9,14 @@ import { VbenIcon } from "../../../shadcn-ui";
interface Props extends NormalMenuProps {}
defineOptions({
name: "NormalMenu"
name: "NormalMenu",
});
const props = withDefaults(defineProps<Props>(), {
activePath: "",
collapse: false,
menus: () => [],
theme: "dark"
theme: "dark",
});
const emit = defineEmits<{
@@ -19,7 +19,7 @@ defineOptions({ name: "SubMenuContent" });
const props = withDefaults(defineProps<Props>(), {
isMenuMore: false,
level: 0
level: 0,
});
const rootMenu = useMenuContext();
@@ -20,7 +20,7 @@ defineOptions({ name: "SubMenu" });
const props = withDefaults(defineProps<Props>(), {
disabled: false,
isSubMenuMore: false
isSubMenuMore: false,
});
const { parentMenu, parentPaths } = useMenu();
@@ -41,7 +41,7 @@ createSubMenuContext({
handleMouseleave,
level: (subMenu?.level ?? 0) + 1,
mouseInChild,
removeSubMenu
removeSubMenu,
});
const opened = computed(() => {
@@ -61,20 +61,20 @@ const contentProps = computed((): HoverCardContentProps => {
return {
collisionPadding: { top: 20 },
side,
sideOffset: isHorizontal ? 5 : 10
sideOffset: isHorizontal ? 5 : 10,
};
});
const active = computed(() => {
let isActive = false;
Object.values(items.value).forEach((item) => {
Object.values(items.value).forEach(item => {
if (item.active) {
isActive = true;
}
});
Object.values(subMenus.value).forEach((subItem) => {
Object.values(subMenus.value).forEach(subItem => {
if (subItem.active) {
isActive = true;
}
@@ -108,7 +108,7 @@ function handleClick() {
rootMenu?.handleSubMenuClick({
active: active.value,
parentPaths: parentPaths.value,
path: props.path
path: props.path,
});
}
@@ -159,7 +159,7 @@ const menuIcon = computed(() => (active.value ? props.activeIcon || props.icon :
const item = reactive({
active,
parentPaths,
path: props.path
path: props.path,
});
onMounted(() => {
@@ -183,7 +183,7 @@ onBeforeUnmount(() => {
</template>
</SubMenuContent>
</template>
<div :class="[nsMenu.is(mode, true), nsMenu.e('popup')]" @focus="(e) => handleMouseenter(e, 100)" @mouseenter="(e) => handleMouseenter(e, 100)" @mouseleave="() => handleMouseleave(true)">
<div :class="[nsMenu.is(mode, true), nsMenu.e('popup')]" @focus="e => handleMouseenter(e, 100)" @mouseenter="e => handleMouseenter(e, 100)" @mouseleave="() => handleMouseleave(true)">
<ul :class="[nsMenu.b(), is('rounded', rounded)]" :style="subMenuStyle">
<slot></slot>
</ul>