Skip to content

Commit

Permalink
fix(dropdown-item): remove tooltip in dropdown-item (#1735)
Browse files Browse the repository at this point in the history
  • Loading branch information
shenjunjian authored Jul 9, 2024
1 parent 88a092c commit 735de0a
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 70 deletions.
27 changes: 13 additions & 14 deletions packages/vue/src/dropdown-item/package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
{
"name": "@opentiny/vue-dropdown-item",
"version": "3.16.0",
"type": "module",
"version": "3.16.0-prod.0",
"description": "",
"license": "MIT",
"sideEffects": false,
"main": "lib/index.js",
"module": "index.ts",
"sideEffects": false,
"type": "module",
"devDependencies": {
"@opentiny-internal/vue-test-utils": "workspace:*",
"vitest": "^0.31.0"
},
"scripts": {
"build": "pnpm -w build:ui $npm_package_name",
"//postversion": "pnpm build"
},
"dependencies": {
"@opentiny/vue-button": "workspace:~",
"@opentiny/vue-common": "workspace:~",
"@opentiny/vue-icon": "workspace:~",
"@opentiny/vue-renderless": "workspace:~",
"@opentiny/vue-popup": "workspace:~",
"@opentiny/vue-button": "workspace:~",
"@opentiny/vue-tooltip": "workspace:~",
"@opentiny/vue-theme-mobile": "workspace:~",
"@opentiny/vue-theme": "workspace:~"
"@opentiny/vue-renderless": "workspace:~",
"@opentiny/vue-theme": "workspace:~",
"@opentiny/vue-theme-mobile": "workspace:~"
},
"license": "MIT"
}
"devDependencies": {
"@opentiny-internal/vue-test-utils": "workspace:*",
"vitest": "^0.31.0"
}
}
104 changes: 48 additions & 56 deletions packages/vue/src/dropdown-item/src/pc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,68 +12,61 @@

<template>
<!-- TINY-TODO: tiny-dropdown-menu__item命名不规范,后续统一有个迭代去掉 -->
<tiny-tooltip :content="getTip" :placement="tipPosition">
<li
class="tiny-dropdown-item tiny-dropdown-menu__item"
:class="{
'is-disabled': disabled,
'tiny-dropdown-item--divided tiny-dropdown-menu__item--divided': divided,
'tiny-dropdown-item--check-status': state.checkedStatus && selected,
'has-children': itemData.children && itemData.children.length
}"
ref="dropdownItem"
@click.stop="handleClick"
@mousedown.stop
:aria-disabled="disabled"
:tabindex="disabled ? null : -1"
>
<div class="tiny-dropdown-item__wrap">
<span
v-if="itemData.children && itemData.children.length"
class="tiny-dropdown-item__expand tiny-dropdown-menu__item-expand"
>
<component :is="state.getIcon"></component>
<li
class="tiny-dropdown-item tiny-dropdown-menu__item"
:class="{
'is-disabled': disabled,
'tiny-dropdown-item--divided tiny-dropdown-menu__item--divided': divided,
'tiny-dropdown-item--check-status': state.checkedStatus && selected,
'has-children': itemData.children && itemData.children.length
}"
ref="dropdownItem"
@click.stop="handleClick"
@mousedown.stop
:aria-disabled="disabled"
:tabindex="disabled ? null : -1"
>
<div class="tiny-dropdown-item__wrap">
<span
v-if="itemData.children && itemData.children.length"
class="tiny-dropdown-item__expand tiny-dropdown-menu__item-expand"
>
<component :is="state.getIcon"></component>
</span>
<div class="tiny-dropdown-item__content tiny-dropdown-menu__item-content">
<component v-if="icon" :is="icon" class="tiny-svg-size"></component>
<span class="tiny-dropdown-item__label">
<slot :item-data="itemData">
<span>{{ label }}</span>
</slot>
</span>
<div class="tiny-dropdown-item__content tiny-dropdown-menu__item-content">
<component v-if="icon" :is="icon" class="tiny-svg-size"></component>
<span class="tiny-dropdown-item__label">
<slot :item-data="itemData">
<span>{{ label }}</span>
</slot>
</span>
</div>
<ul
v-if="itemData.children && itemData.children.length"
:class="[
'tiny-dropdown-menu',
'tiny-dropdown-item--child tiny-dropdown-menu__item--child',
state.popperClass
]"
>
<tiny-dropdown-item
v-for="(item, index) in itemData.children"
:key="index"
:label="item[state.textField]"
:item-data="item"
:icon="item.icon"
:disabled="item.disabled"
:divided="item.divided"
:tip="item.tip"
:tip-position="item.tipPosition"
>
<slot :item-data="item"></slot>
</tiny-dropdown-item>
</ul>
</div>
</li>
</tiny-tooltip>
<ul
v-if="itemData.children && itemData.children.length"
:class="['tiny-dropdown-menu', 'tiny-dropdown-item--child tiny-dropdown-menu__item--child', state.popperClass]"
>
<tiny-dropdown-item
v-for="(item, index) in itemData.children"
:key="index"
:label="item[state.textField]"
:item-data="item"
:icon="item.icon"
:disabled="item.disabled"
:divided="item.divided"
:tip="item.tip"
:tip-position="item.tipPosition"
>
<slot :item-data="item"></slot>
</tiny-dropdown-item>
</ul>
</div>
</li>
</template>

<script lang="ts">
import { props, setup, $prefix, defineComponent } from '@opentiny/vue-common'
import { renderless, api } from '@opentiny/vue-renderless/dropdown-item/vue'
import { iconDeltaLeft } from '@opentiny/vue-icon'
import TinyTooltip from '@opentiny/vue-tooltip'
import '@opentiny/vue-theme/dropdown-item/index.less'
import type { IDropdownItemApi } from '@opentiny/vue-renderless/types/dropdown-item.type'

Expand Down Expand Up @@ -103,8 +96,7 @@ export default defineComponent({
'tipPosition'
],
components: {
IconDeltaLeft: iconDeltaLeft(),
TinyTooltip
IconDeltaLeft: iconDeltaLeft()
},
setup(props, context) {
return setup({ props, context, renderless, api }) as unknown as IDropdownItemApi
Expand Down

0 comments on commit 735de0a

Please sign in to comment.