添加列表激活图标

pull/1053/head
lyswhut 2022-11-14 20:22:35 +08:00
parent e79f8b357c
commit ab37817d26
7 changed files with 114 additions and 6 deletions

View File

@ -570,3 +570,27 @@ table {
.color-picker { .color-picker {
border-radius: @radius-border !important; border-radius: @radius-border !important;
} }
.list-active-enter-active,
.list-active-leave-active {
transition: .13s ease;
transition-property: width, opacity;
}
.list-active-enter-from,
.list-active-leave-to {
width: 0.25em !important;
opacity: 0;
}
.play-active-enter-active,
.play-active-leave-active {
transition: .13s ease;
transition-property: transform, opacity;
}
.play-active-enter-from,
.play-active-leave-to {
transform: scale(0.8);
opacity: 0;
}

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--! Font Awesome Pro 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M278.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-160 160c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L210.7 256 73.4 118.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l160 160z"/></svg>

After

Width:  |  Height:  |  Size: 417 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" class="ionicon" viewBox="0 0 512 512"><title>Play</title><path d="M112 111v290c0 17.44 17 28.52 31 20.16l247.9-148.37c12.12-7.25 12.12-26.33 0-33.58L143 90.84c-14-8.36-31 2.72-31 20.16z" fill="none" stroke="currentColor" stroke-miterlimit="10" stroke-width="32"/></svg>

After

Width:  |  Height:  |  Size: 309 B

View File

@ -5,7 +5,12 @@
:key="item.id" :class="[$style.listsItem, { [$style.active]: item.id == boardId }, { [$style.clicked]: rightClickItemIndex == index }]" :key="item.id" :class="[$style.listsItem, { [$style.active]: item.id == boardId }, { [$style.clicked]: rightClickItemIndex == index }]"
:aria-label="item.name" @click="handleToggleList(item.id)" @contextmenu="handleRigthClick($event, index)" :aria-label="item.name" @click="handleToggleList(item.id)" @contextmenu="handleRigthClick($event, index)"
> >
<span :class="$style.listsLabel">{{ item.name }}</span> <span :class="$style.listsLabel">
<transition name="list-active">
<svg-icon v-if="item.id == boardId" name="angle-right-solid" :class="$style.activeIcon" />
</transition>
{{ item.name }}
</span>
</li> </li>
</ul> </ul>
<base-menu <base-menu
@ -122,6 +127,12 @@ defineExpose({ hideMenu: handleMenuClick })
} }
} }
} }
.activeIcon {
height: .9em;
width: .9em;
margin-left: -0.45em;
vertical-align: -0.05em;
}
.listsLabel { .listsLabel {
display: block; display: block;
height: 100%; height: 100%;

View File

@ -31,7 +31,14 @@
class="list-item" :class="[{ [$style.active]: playerInfo.isPlayList && playerInfo.playIndex === index }, { selected: selectedIndex == index || rightClickSelectedIndex == index }, { active: selectedList.includes(item) }, { disabled: !assertApiSupport(item.source) }]" class="list-item" :class="[{ [$style.active]: playerInfo.isPlayList && playerInfo.playIndex === index }, { selected: selectedIndex == index || rightClickSelectedIndex == index }, { active: selectedList.includes(item) }, { disabled: !assertApiSupport(item.source) }]"
@click="handleListItemClick($event, index)" @contextmenu="handleListItemRightClick($event, index)" @click="handleListItemClick($event, index)" @contextmenu="handleListItemRightClick($event, index)"
> >
<div class="list-item-cell no-select num" style="flex: 0 0 5%;" @click.stop>{{ index + 1 }}</div> <div class="list-item-cell no-select" :class="$style.num" style="flex: 0 0 5%;">
<div v-if="playerInfo.isPlayList && playerInfo.playIndex === index" :class="$style.playIcon">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xlink="http://www.w3.org/1999/xlink" width="50%" viewBox="0 0 512 512" space="preserve">
<use xlink:href="#icon-play-outline" />
</svg>
</div>
<div v-else class="num">{{ index + 1 }}</div>
</div>
<div class="list-item-cell auto name" :aria-label="item.name"> <div class="list-item-cell auto name" :aria-label="item.name">
<span class="select name">{{ item.name }}</span> <span class="select name">{{ item.name }}</span>
<span v-if="isShowSource" class="no-select label-source">{{ item.source }}</span> <span v-if="isShowSource" class="no-select label-source">{{ item.source }}</span>
@ -54,7 +61,16 @@
:class="[{ [$style.active]: playerInfo.isPlayList && playerInfo.playIndex === index }, { selected: selectedIndex == index || rightClickSelectedIndex == index }, { active: selectedList.includes(item) }, { disabled: !assertApiSupport(item.source) }]" :class="[{ [$style.active]: playerInfo.isPlayList && playerInfo.playIndex === index }, { selected: selectedIndex == index || rightClickSelectedIndex == index }, { active: selectedList.includes(item) }, { disabled: !assertApiSupport(item.source) }]"
@click="handleListItemClick($event, index)" @contextmenu="handleListItemRightClick($event, index)" @click="handleListItemClick($event, index)" @contextmenu="handleListItemRightClick($event, index)"
> >
<div class="list-item-cell no-select num" style="flex: 0 0 5%;" @click.stop>{{ index + 1 }}</div> <div class="list-item-cell no-select" :class="$style.num" style="flex: 0 0 5%;">
<transition name="play-active">
<div v-if="playerInfo.isPlayList && playerInfo.playIndex === index" :class="$style.playIcon">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xlink="http://www.w3.org/1999/xlink" width="50%" viewBox="0 0 512 512" space="preserve">
<use xlink:href="#icon-play-outline" />
</svg>
</div>
<div v-else class="num">{{ index + 1 }}</div>
</transition>
</div>
<div class="list-item-cell auto name"> <div class="list-item-cell auto name">
<span class="select name" :aria-label="item.name">{{ item.name }}</span> <span class="select name" :aria-label="item.name">{{ item.name }}</span>
<span v-if="isShowSource" class="no-select label-source">{{ item.source }}</span> <span v-if="isShowSource" class="no-select label-source">{{ item.source }}</span>
@ -350,6 +366,26 @@ export default {
} }
} }
} }
.num {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
.playIcon {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
color: var(--color-button-font);
opacity: .7;
}
.content { .content {
min-height: 0; min-height: 0;
font-size: 14px; font-size: 14px;

View File

@ -21,14 +21,29 @@
:aria-label="defaultList.name" :aria-selected="defaultList.id == listId" :aria-label="defaultList.name" :aria-selected="defaultList.id == listId"
@contextmenu="handleListsItemRigthClick($event, -2)" @click="handleListToggle(defaultList.id)" @contextmenu="handleListsItemRigthClick($event, -2)" @click="handleListToggle(defaultList.id)"
> >
<span :class="$style.listsLabel">{{ defaultList.name }}</span> <!-- <div v-if="defaultList.id == listId" :class="$style.activeIcon">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xlink="http://www.w3.org/1999/xlink" height="40%" viewBox="0 0 451.846 451.847" space="preserve">
<use xlink:href="#icon-right" />
</svg>
</div> -->
<span :class="$style.listsLabel">
<transition name="list-active">
<svg-icon v-if="defaultList.id == listId" name="angle-right-solid" :class="$style.activeIcon" />
</transition>
{{ defaultList.name }}
</span>
</li> </li>
<li <li
class="default-list" :class="[$style.listsItem, {[$style.active]: loveList.id == listId}, {[$style.clicked]: rightClickItemIndex == -1}, {[$style.fetching]: fetchingListStatus[loveList.id]}]" class="default-list" :class="[$style.listsItem, {[$style.active]: loveList.id == listId}, {[$style.clicked]: rightClickItemIndex == -1}, {[$style.fetching]: fetchingListStatus[loveList.id]}]"
:aria-label="loveList.name" :aria-selected="loveList.id == listId" :aria-label="loveList.name" :aria-selected="loveList.id == listId"
@contextmenu="handleListsItemRigthClick($event, -1)" @click="handleListToggle(loveList.id)" @contextmenu="handleListsItemRigthClick($event, -1)" @click="handleListToggle(loveList.id)"
> >
<span :class="$style.listsLabel">{{ loveList.name }}</span> <span :class="$style.listsLabel">
<transition name="list-active">
<svg-icon v-if="loveList.id == listId" name="angle-right-solid" :class="$style.activeIcon" />
</transition>
{{ loveList.name }}
</span>
</li> </li>
<li <li
v-for="(item, index) in userLists" v-for="(item, index) in userLists"
@ -36,7 +51,12 @@
:class="[$style.listsItem, {[$style.active]: item.id == listId}, {[$style.clicked]: rightClickItemIndex == index}, {[$style.fetching]: fetchingListStatus[item.id]}]" :class="[$style.listsItem, {[$style.active]: item.id == listId}, {[$style.clicked]: rightClickItemIndex == index}, {[$style.fetching]: fetchingListStatus[item.id]}]"
:data-index="index" :aria-label="item.name" :aria-selected="defaultList.id == listId" @contextmenu="handleListsItemRigthClick($event, index)" :data-index="index" :aria-label="item.name" :aria-selected="defaultList.id == listId" @contextmenu="handleListsItemRigthClick($event, index)"
> >
<span :class="$style.listsLabel" @click="handleListToggle(item.id, index + 2)">{{ item.name }}</span> <span :class="$style.listsLabel" @click="handleListToggle(item.id, index + 2)">
<transition name="list-active">
<svg-icon v-if="item.id == listId" name="angle-right-solid" :class="$style.activeIcon" />
</transition>
{{ item.name }}
</span>
<input <input
:class="$style.listsInput" type="text" :value="item.name" :class="$style.listsInput" type="text" :value="item.name"
:placeholder="item.name" @contextmenu.stop @keyup.enter="handleSaveListName(index, $event)" @blur="handleSaveListName(index, $event)" :placeholder="item.name" @contextmenu.stop @keyup.enter="handleSaveListName(index, $event)" @blur="handleSaveListName(index, $event)"
@ -341,6 +361,12 @@ export default {
} }
} }
} }
.activeIcon {
height: .9em;
width: .9em;
margin-left: -0.45em;
vertical-align: -0.05em;
}
.listsLabel { .listsLabel {
display: block; display: block;
height: @lists-item-height; height: @lists-item-height;

View File

@ -8,6 +8,9 @@
role="tab" :aria-selected="avtiveComponentName == h2.id" role="tab" :aria-selected="avtiveComponentName == h2.id"
:aria-label="h2.title" ignore-tip @click="toggleTab(h2.id)" :aria-label="h2.title" ignore-tip @click="toggleTab(h2.id)"
> >
<transition name="list-active">
<svg-icon v-if="avtiveComponentName == h2.id" name="angle-right-solid" :class="$style.activeIcon" />
</transition>
{{ h2.title }} {{ h2.title }}
</h2> </h2>
<!-- <ul v-if="h2.children.length" :class="$style.tocList"> <!-- <ul v-if="h2.children.length" :class="$style.tocList">
@ -202,6 +205,12 @@ export default {
color: var(--color-primary); color: var(--color-primary);
} }
} }
.activeIcon {
height: .9em;
width: .9em;
margin-left: -0.45em;
vertical-align: -0.05em;
}
// .tocH3 { // .tocH3 {
// font-size: 13px; // font-size: 13px;
// opacity: .8; // opacity: .8;