-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
67 additions
and
10 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
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 @@ | ||
export { default as BaseInput } from './BaseInput.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,35 @@ | ||
<script setup lang="ts"> | ||
import { ref, computed, type PropType } from 'vue' | ||
import type { IListItem } from './types' | ||
defineOptions({ name: 'TList' }) | ||
defineProps({ | ||
current: String, | ||
items: Array as PropType<IListItem[]>, | ||
deep: { type: Number, default: 0 }, | ||
itemClass: String, | ||
}) | ||
const emit = defineEmits<{ select: [item: IListItem, deep: number] }>() | ||
const slots = defineSlots<{ item(props: { item: IListItem; deep: number; active: boolean }): any }>() | ||
const selectHandler = (item: IListItem, deep: number) => { | ||
emit('select', item, deep) | ||
} | ||
</script> | ||
<template> | ||
<ul> | ||
<li v-for="item in items" :key="item.key" @click="selectHandler(item, deep)"> | ||
<slot name="item" :item="item" :deep="deep" :active="current === item.key"></slot> | ||
<TList | ||
v-if="item.children && item.children.length > 0" | ||
:items="item.children" | ||
:deep="deep + 1" | ||
@select="selectHandler" | ||
> | ||
<template #item="props"> | ||
<slot name="item" v-bind="props" /> | ||
</template> | ||
</TList> | ||
</li> | ||
</ul> | ||
</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,2 @@ | ||
export { default as List } from './List.vue' | ||
export type { IListItem, IListItemLink } from './types' |
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,13 @@ | ||
import type { Component } from 'vue' | ||
|
||
export type IListItemLink = string | { href: string; target: string } | ||
|
||
export type IListItem = { | ||
key: string | ||
icon?: Component | ||
label?: string | ||
disable?: boolean | ||
link?: IListItemLink | ||
onClick?: (item: IListItem) => void | ||
children?: IListItem[] | ||
} |
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,2 +1,3 @@ | ||
export { default as Popper } from './Popper.vue' | ||
|
||
export type { PopperPlacement, PopperSizeMode, PopperTrigger, PopperVirtualElement } from './core' |
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,3 @@ | ||
export * from './BaseInput' | ||
export * from './Popper' | ||
export * from './List' |
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
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