Skip to content

Commit 1957cbf

Browse files
authored
fix: fix form item not align when set display-only (#2927)
1 parent 2fb6814 commit 1957cbf

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

packages/theme-saas/src/form-item/index.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
.@{form-item-prefix-cls} {
2020
@apply relative;
21-
@apply mb-5;
21+
@apply mb-4;
2222
.clearfix();
2323

2424
.@{form-item-prefix-cls}__content-muti-children {

packages/vue/src/checkbox/src/mobile-first.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
data-tag="tiny-checkbox"
44
:class="
55
m(
6-
'inline-flex sm:items-center text-sm leading-5 cursor-pointer',
6+
'inline-flex sm:items-center text-sm leading-5.5 cursor-pointer',
77
state.size !== 'mini' ? 'sm:text-sm' : 'sm:text-xs',
88
{ 'sm:py-2': state.vertical },
99
state.isDisplayOnly || state.isGroupDisplayOnly

packages/vue/src/form-item/src/mobile-first.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
data-tag="tiny-form-item"
44
:class="
55
m(
6-
`flex min-h-[theme(spacing.12)] sm:min-h-[theme(spacing.7)] mb-0 p-0 sm:mb-4 box-border after:content-[''] after:table after:clear-both before:content-[''] before:table border-b-0.5 border-color-border-separator sm:border-none`,
6+
`flex min-h-[theme(spacing.12)] sm:min-h-[theme(spacing.5)] mb-0 p-0 sm:mb-4 box-border after:content-[''] after:table after:clear-both before:content-[''] before:table border-b-0.5 border-color-border-separator sm:border-none`,
77
state.validateState === 'error' && state.validateType === 'text' ? 'mb-0 sm:mb-5' : '',
88
state.formInline ? 'align-sub' : '',
99
state.labelPosition === 'top' ? 'block mb-4' : '',
@@ -12,7 +12,7 @@
1212
: '',
1313
state.labelPosition === 'top' && !state.hideRequiredAsterisk ? 'pl-0' : '',
1414
!slots.label && !label ? 'border-none' : '',
15-
state.isDisplayOnly ? 'border-none py-0.5' : ''
15+
state.isDisplayOnly ? 'border-none py-0.5 sm:py-0' : ''
1616
)
1717
"
1818
>
@@ -26,7 +26,7 @@
2626
v-if="slots.label || label"
2727
:class="
2828
m(
29-
'py-3 sm:py-1.5 sm:min-h-[theme(spacing.7)] relative align-bottom float-left text-sm pr-3 sm:pr-4 box-border leading-5',
29+
'py-3 sm:py-0 sm:min-h-[theme(spacing.5)] relative align-bottom float-left text-sm pr-3 sm:pr-4 box-border leading-5',
3030
'overflow-hidden text-ellipsis',
3131
state.labelPosition === 'top'
3232
? 'float-none inline-block text-left sm:text-left leading-none px-0 pt-0 pb-1.5 h-auto min-h-0 sm:py-0 sm:pb-1 sm:min-h-[theme(spacing.0)]'
@@ -49,7 +49,7 @@
4949
<span
5050
:class="
5151
m(
52-
'max-h-[theme(spacing.10)] line-clamp-2 inline-block relative top-px leading-normal',
52+
'max-h-[theme(spacing.10)] line-clamp-2 inline-block relative top-px leading-normal sm:leading-5.5',
5353
(state.isRequired || required) && !state.hideRequiredAsterisk
5454
? `before:content-['*'] before:text-color-error before:relative before:mr-1`
5555
: '',
@@ -73,8 +73,8 @@
7373
data-tag="tiny-form-item-inline"
7474
:class="
7575
m(
76-
`flex-1 m-0 sm:m-auto relative sm:pt-0 sm:top-auto text-sm after:content-[''] after:table after:clear-both before:content-[''] before:table [&_button:not(:last-child)]:mr-2`,
77-
'[&_[data-tag=tiny-checkbox]]:py-0 [&_[data-tag=tiny-input]]:w-full',
76+
`flex-1 m-0 relative sm:pt-0 sm:top-auto text-sm after:content-[''] after:table after:clear-both before:content-[''] before:table [&_button:not(:last-child)]:mr-2 [&_[data-tag=tiny-rate]]:h-6`,
77+
'[&_[data-tag=tiny-checkbox]]:py-0 [&_[data-tag=tiny-input]]:w-full [&_[data-tag=tiny-input]]:block [&_[data-tag=tiny-input-inner]]:block [&_[data-tag=tiny-input-inner]]:leading-5',
7878
'[&_[data-tag=tiny-input]_textarea]:px-0 sm:[&_[data-tag=tiny-input]_textarea]:px-3 [&_[data-tag=tiny-input]_textarea]:w-full [&_[data-tag=tiny-input]_textarea]:pt-1 sm:[&_[data-tag=tiny-input]_textarea]:pt-2',
7979
state.formInline ? 'align-sub leading-none' : '',
8080
state.labelPosition === 'top' && !state.hideRequiredAsterisk

packages/vue/src/input/src/mobile-first.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
@mouseenter.native="handleEnterDisplayOnlyContent"
5252
>
5353
<span
54-
class="absolute top-0 left-0 max-w-full overflow-hidden text-ellipsis whitespace-nowrap leading-7 sm:leading-normal text-color-text-primary"
54+
class="absolute top-0 left-0 max-w-full overflow-hidden text-ellipsis whitespace-nowrap leading-7 sm:leading-5.5 text-color-text-primary"
5555
v-if="type === 'password'"
5656
>{{ state.hiddenPassword }}</span
5757
>
@@ -68,7 +68,7 @@
6868
></component>
6969
</span>
7070
<span
71-
class="absolute top-0 left-0 max-w-full overflow-hidden text-ellipsis whitespace-nowrap leading-7 sm:leading-normal text-color-text-primary"
71+
class="absolute top-0 left-0 max-w-full overflow-hidden text-ellipsis whitespace-nowrap leading-7 sm:leading-5.5 text-color-text-primary"
7272
v-else
7373
>
7474
{{ state.displayOnlyText }}
@@ -279,6 +279,7 @@
279279
effect="light"
280280
:content="state.displayOnlyTooltip"
281281
placement="top"
282+
pre
282283
:popper-class="state.tooltipConfig.popperClass || ''"
283284
:popper-options="{ bubbling: true }"
284285
@mouseenter.native="handleEnterDisplayOnlyContent($event, 'textarea')"

packages/vue/src/tooltip/src/mobile-first.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export default defineComponent({
114114
if (vm.renderContent) {
115115
attrContent = vm.renderContent(h, vm.content)
116116
} else if (vm.pre) {
117-
attrContent = vm.content ? h('pre', { class: 'whitespace-pre-wrap' }, vm.content) : null
117+
attrContent = vm.content ? h('pre', { class: 'tiny-tooltip-text-pre whitespace-pre-wrap' }, vm.content) : null
118118
} else {
119119
attrContent = vm.content
120120
}

0 commit comments

Comments
 (0)