-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: update right menu and shortcut keys (doocs#353)
- Loading branch information
Showing
23 changed files
with
481 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
按Ctrl/Command+F可格式化 | ||
按 Alt/Option + Shift + F 可格式化 | ||
*/ | ||
/* 一级标题样式 */ | ||
h1 { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<script setup lang="ts"> | ||
import { ContextMenuRoot, useForwardPropsEmits } from 'radix-vue' | ||
import type { ContextMenuRootEmits, ContextMenuRootProps } from 'radix-vue' | ||
const props = defineProps<ContextMenuRootProps>() | ||
const emits = defineEmits<ContextMenuRootEmits>() | ||
const forwarded = useForwardPropsEmits(props, emits) | ||
</script> | ||
|
||
<template> | ||
<ContextMenuRoot v-bind="forwarded"> | ||
<slot /> | ||
</ContextMenuRoot> | ||
</template> |
40 changes: 40 additions & 0 deletions
40
src/components/ui/context-menu/ContextMenuCheckboxItem.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<script setup lang="ts"> | ||
import { type HTMLAttributes, computed } from 'vue' | ||
import { | ||
ContextMenuCheckboxItem, | ||
type ContextMenuCheckboxItemEmits, | ||
type ContextMenuCheckboxItemProps, | ||
ContextMenuItemIndicator, | ||
useForwardPropsEmits, | ||
} from 'radix-vue' | ||
import { Check } from 'lucide-vue-next' | ||
import { cn } from '@/lib/utils' | ||
const props = defineProps<ContextMenuCheckboxItemProps & { class?: HTMLAttributes['class'] }>() | ||
const emits = defineEmits<ContextMenuCheckboxItemEmits>() | ||
const delegatedProps = computed(() => { | ||
const { class: _, ...delegated } = props | ||
return delegated | ||
}) | ||
const forwarded = useForwardPropsEmits(delegatedProps, emits) | ||
</script> | ||
|
||
<template> | ||
<ContextMenuCheckboxItem | ||
v-bind="forwarded" | ||
:class="cn( | ||
'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50', | ||
props.class, | ||
)" | ||
> | ||
<span class="absolute left-2 flex h-3.5 w-3.5 items-center justify-center"> | ||
<ContextMenuItemIndicator> | ||
<Check class="h-4 w-4" /> | ||
</ContextMenuItemIndicator> | ||
</span> | ||
<slot /> | ||
</ContextMenuCheckboxItem> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<script setup lang="ts"> | ||
import { type HTMLAttributes, computed } from 'vue' | ||
import { | ||
ContextMenuContent, | ||
type ContextMenuContentEmits, | ||
type ContextMenuContentProps, | ||
ContextMenuPortal, | ||
useForwardPropsEmits, | ||
} from 'radix-vue' | ||
import { cn } from '@/lib/utils' | ||
const props = defineProps<ContextMenuContentProps & { class?: HTMLAttributes['class'] }>() | ||
const emits = defineEmits<ContextMenuContentEmits>() | ||
const delegatedProps = computed(() => { | ||
const { class: _, ...delegated } = props | ||
return delegated | ||
}) | ||
const forwarded = useForwardPropsEmits(delegatedProps, emits) | ||
</script> | ||
|
||
<template> | ||
<ContextMenuPortal> | ||
<ContextMenuContent | ||
v-bind="forwarded" | ||
:class="cn( | ||
'z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2', | ||
props.class, | ||
)" | ||
> | ||
<slot /> | ||
</ContextMenuContent> | ||
</ContextMenuPortal> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script setup lang="ts"> | ||
import { ContextMenuGroup, type ContextMenuGroupProps } from 'radix-vue' | ||
const props = defineProps<ContextMenuGroupProps>() | ||
</script> | ||
|
||
<template> | ||
<ContextMenuGroup v-bind="props"> | ||
<slot /> | ||
</ContextMenuGroup> | ||
</template> |
Oops, something went wrong.