Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(steps): resolve text overflow no tooltip #1629

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Steps as TinySteps, Modal } from '@opentiny/vue'
const advancedActive = ref(1)
const data = ref([
{ name: 'Basic Info', count: 3, status: 'doing' },
{ name: 'BOQ Info', count: 0, status: 'done' },
{ name: 'BOQ Info. So long that overflow', count: 0, status: 'done' },
{ name: 'Involved Parties', count: 10, status: 'doing' },
{ name: 'Billing', count: 0, status: 'done' },
{ name: 'Appraise', count: 0 }
Expand Down
4 changes: 2 additions & 2 deletions examples/sites/demos/pc/app/steps/advanced-steps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export default {
advancedActive: 1,
data: [
{ name: 'Basic Info', count: 3, status: 'done' },
{ name: 'BOQ Info', count: 0, status: 'doing' },
{ name: 'Involved Parties', count: 10, status: 'error' },
{ name: 'BOQ Info. So long that overflow', count: 0, status: 'doing' },
{ name: 'Involved Parties ', count: 10, status: 'error' },
{ name: 'Billing', count: 0, status: 'disabled' },
{ name: 'Appraise', count: 3 }
]
Expand Down
24 changes: 18 additions & 6 deletions packages/theme/src/steps/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -960,9 +960,10 @@
}

.label {
display: flex;
align-items: center;
border: solid 1px var(--ti-steps-advanced-border-color);
border-right: none;
display: block;
text-align: center;
position: relative;
text-decoration: none;
Expand Down Expand Up @@ -1001,6 +1002,17 @@
border-left-color: var(--ti-steps-advanced-li-hover-bg-color);
}
}

span {
flex: 1;
display: block;
width: 100%;
height: 100%;
margin: 0 var(--ti-steps-label-margin-horizontal);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}

&:first-child {
Expand Down Expand Up @@ -1030,12 +1042,12 @@
height: var(--ti-steps-advanced-dot-height);
width: var(--ti-steps-advanced-dot-width);
margin-right: 8px;
padding: 0;
right: 0;
top: 50%;
transform: translateY(-50%);
// padding: 0;
// right: 0;
// top: 50%;
// transform: translateY(-50%);
Comment on lines +1045 to +1048
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// padding: 0;
// right: 0;
// top: 50%;
// transform: translateY(-50%);

这一段也许删掉会更好

display: flex;
position: absolute;
// position: absolute;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// position: absolute;

这一段也许删掉会更好


svg {
width: 100%;
Expand Down
2 changes: 2 additions & 0 deletions packages/theme/src/steps/vars.less
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
--ti-steps-custom-icon-bg-color: var(--ti-common-color-bg-white-normal, #fff);
// 自定义图标大小(hide)
--ti-steps-custom-icon-width-height: var(--ti-common-space-3x, 12px);
// 名称水平外边距(hide)
--ti-steps-label-margin-horizontal: var(--ti-common-space-4x, 16px);

// 活跃节点背景色
--ti-steps-advanced-active-bg-color: var(--ti-common-color-bg-emphasize, #5e7ce0);
Expand Down
16 changes: 10 additions & 6 deletions packages/vue/src/steps/src/pc/pc-standard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@
@click="$emit('click', index, node)"
>
<slot name="item" :slot-scope="node" :index="index">
<div class="label" :title="node[nameField]">
<span>{{ node[nameField] }}</span>
<div class="label">
<tiny-tooltip :content="node[nameField]" visible="auto">
<span>{{ node[nameField] }}</span>
</tiny-tooltip>
<div v-if="['doing', 'done'].includes(node[statusField])" :class="['dot', node[statusField]]">
<icon-refres v-if="node[statusField] === 'doing'"></icon-refres>
<icon-yes v-else-if="node[statusField] === 'done'"></icon-yes>
</div>
</div>
<div v-if="node[countField]" class="count">
{{ node[countField] }}
</div>
<div v-if="node[statusField]" :class="['dot', node[statusField]]">
<icon-refres v-if="node[statusField] === 'doing'"></icon-refres>
<icon-yes v-else-if="node[statusField] === 'done'"></icon-yes>
</div>
</slot>
</li>
</ul>
Expand All @@ -31,11 +33,13 @@
<script lang="ts">
import { renderless, api } from '@opentiny/vue-renderless/steps/vue'
import { props, setup, defineComponent } from '@opentiny/vue-common'
import ToolTip from '@opentiny/vue-tooltip'
import { iconRefres, iconYes } from '@opentiny/vue-icon'

export default defineComponent({
emits: ['click'],
components: {
TinyTooltip: ToolTip,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct the registration of IconRefres and IconYes components.

-    IconRefres: iconRefres(),
-    IconYes: iconYes()
+    IconRefres: iconRefres,
+    IconYes: iconYes

This change ensures that the components are correctly registered without invoking them as functions.


Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
TinyTooltip: ToolTip,
TinyTooltip: ToolTip,
IconRefres: iconRefres,
IconYes: iconYes

IconRefres: iconRefres(),
IconYes: iconYes()
},
Expand Down
Loading