Skip to content

Commit a6b0bfb

Browse files
authored
fix: fix form item not align when set display-only (#2950)
* fix: fix form item not align when set display-only * fix: set numeric input background style
1 parent 47050d0 commit a6b0bfb

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@
2626
v-if="slots.label || label"
2727
:class="
2828
m(
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',
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',
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)]'
3333
: 'min-h-[theme(spacing.9)]',
3434
state.labelPosition === 'right' ? 'text-right sm:text-right' : '',
3535
state.labelPosition === 'left' ? 'text-left sm:text-left' : '',
3636
state.formInline && state.labelPosition === 'top' ? 'block' : '',
37-
state.isDisplayOnly ? 'leading-none h-auto align-[inherit] pr-4' : '',
37+
state.isDisplayOnly ? 'h-auto align-[inherit] pr-4' : '',
3838
tipContent ? 'pr-5 sm:pr-7' : '',
3939
state.labelPosition === 'top' && !state.hideRequiredAsterisk
4040
? 'overflow-visible relative before:absolute before:-left-2.5'
@@ -49,11 +49,11 @@
4949
<span
5050
:class="
5151
m(
52-
'max-h-[theme(spacing.10)] line-clamp-2 inline-block relative top-px leading-normal sm:leading-5.5',
52+
'max-h-[theme(spacing.12)] line-clamp-2 inline-block relative leading-normal',
5353
(state.isRequired || required) && !state.hideRequiredAsterisk
5454
? `before:content-['*'] before:text-color-error before:relative before:mr-1`
5555
: '',
56-
state.isDisplayOnly ? 'pl-0 before:hidden' : ''
56+
state.isDisplayOnly ? 'pl-0 before:hidden sm:leading-5.5' : 'sm:leading-7'
5757
)
5858
"
5959
>
@@ -73,10 +73,11 @@
7373
data-tag="tiny-form-item-inline"
7474
:class="
7575
m(
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`,
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`,
7777
'[&_[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' : '',
80+
state.isDisplayOnly ? '[&_[data-tag=tiny-rate]]:h-[22px]' : '[&_[data-tag=tiny-rate]]:h-7',
8081
state.labelPosition === 'top' && !state.hideRequiredAsterisk
8182
? state.isDisplayOnly
8283
? 'pl-0'
@@ -108,8 +109,8 @@
108109
'[&_[class^=tiny-autocomplete]]:w-full',
109110
'[&_[class^=tiny-cascader]]:w-full',
110111
state.isDisplayOnly
111-
? '[&_>*:not([data-tag^=tiny-],[class^=tiny-])]:leading-8 [&_>*:not([data-tag^=tiny-],[class^=tiny-])]:sm:leading-normal'
112-
: ''
112+
? 'sm:leading-5.5 [&_>*:not([data-tag^=tiny-],[class^=tiny-])]:leading-8 [&_>*:not([data-tag^=tiny-],[class^=tiny-])]:sm:leading-normal'
113+
: '[&_[data-tag=tiny-checkbox]]:h-7 [&_[data-tag=tiny-radio]]:h-7'
113114
]"
114115
>
115116
<slot></slot>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
<div
104104
data-tag="numeric-display-only"
105105
v-if="state.isDisplayOnly"
106-
class="sm:leading-normal text-color-text-primary"
106+
class="sm:leading-5.5 text-color-text-primary"
107107
:class="state.inputSize !== 'mini' ? 'text-sm' : 'text-xs'"
108108
>
109109
<span>{{ state.displayOnlyText }}</span

packages/vue/src/numeric/src/token.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const classes = {
2525
'numeric_input-disabled':
2626
'bg-inherit sm:bg-color-bg-6 sm:[&_input]:bg-transparent cursor-not-allowed sm:border border-0.5 border-solid rounded border-color-border-separator text-color-text-disabled sm:text-color-text-secondary',
2727

28-
'numeric_input_inner': 'w-full z-10 leading-7 sm:text-sm inline-block overflow-hidden outline-0',
28+
'numeric_input_inner': 'w-full z-10 leading-7 sm:text-sm inline-block overflow-hidden outline-0 bg-color-bg-1',
2929
'numeric-text-center': 'text-center',
3030
'numeric-text-left': 'text-left',
3131
'numeric_input_inner_size': 'leading-7 text-sm',

packages/vue/src/radio/src/token.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export const classes = {
2-
'radio-default':
3-
'radio inline-flex items-center align-middle leading-4 cursor-pointer sm:flex-row py-px sm:py-0 h-fit',
2+
'radio-default': 'radio inline-flex items-center leading-4 cursor-pointer sm:flex-row py-px sm:py-0 h-fit',
43
'radio-label-common': 'relative text-center w-7 h-7 mr-2 sm:mr-0',
54
'radio-label-size-common': 'sm:w-4 sm:h-4',
65
'radio-label-size-medium': 'sm:w-6 sm:h-6',
@@ -38,9 +37,9 @@ export const classes = {
3837
'label-disabled': 'text-color-text-secondary cursor-not-allowed',
3938
'pc-show': 'hidden sm:block',
4039
'mobile-show': 'block sm:hidden',
41-
'readonly-is-checked': 'sm:m-0',
42-
'readonly-is-not-checked': 'sm:hidden',
43-
'not-readonly-common': 'mr-5 sm:[&:last-child]:mr-0',
40+
'readonly-is-checked': 'sm:m-0 cursor-default',
41+
'readonly-is-not-checked': 'sm:hidden cursor-default',
42+
'not-readonly-common': 'mr-5 align-middle sm:[&:last-child]:mr-0',
4443
'hidden-radio': 'sm:hidden',
4544
'not-readly-common-label': 'sm:py-0 sm:pl-2 -ml-0.5 sm:ml-0',
4645
'readonly-checked-label': 'sm:pl-0 text-color-text-primary',

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
gcls(`switch-${size ? size : 'small'}`),
77
gcls(
88
`${state.currentValue === trueValue ? 'switch-true' : 'switch-false'}${
9-
disabled || types === 'loading' ? '-disabled' : '-not-disabled'
9+
state.disabled || types === 'loading' ? '-disabled' : '-not-disabled'
1010
}`
1111
)
1212
)
@@ -25,8 +25,8 @@
2525
gcls(
2626
`${
2727
state.currentValue === trueValue
28-
? `switch-handle-true-${size ? size : 'small'}${disabled || types === 'loading' ? '-disabled' : ''}`
29-
: `switch-handle-false-${size ? size : 'small'}${disabled || types === 'loading' ? '-disabled' : ''}`
28+
? `switch-handle-true-${size ? size : 'small'}${state.disabled || types === 'loading' ? '-disabled' : ''}`
29+
: `switch-handle-false-${size ? size : 'small'}${state.disabled || types === 'loading' ? '-disabled' : ''}`
3030
}`
3131
)
3232
)
@@ -62,7 +62,7 @@
6262
viewBox="0 0 24 24"
6363
:class="[
6464
gcls(`switch-icon-${size ? size : 'small'}`),
65-
gcls(`switch-icon-true-${disabled ? 'disabled' : 'default'}`)
65+
gcls(`switch-icon-true-${state.disabled ? 'disabled' : 'default'}`)
6666
]"
6767
>
6868
<path
@@ -75,7 +75,7 @@
7575
viewBox="0 0 24 24"
7676
:class="[
7777
gcls(`switch-icon-${size ? size : 'small'}`),
78-
gcls(`switch-icon-false-${disabled ? 'disabled' : 'default'}`)
78+
gcls(`switch-icon-false-${state.disabled ? 'disabled' : 'default'}`)
7979
]"
8080
>
8181
<path

0 commit comments

Comments
 (0)