Skip to content

Commit 45c656f

Browse files
committed
Fix jitter of filter items (#110)
1 parent 6a91508 commit 45c656f

File tree

4 files changed

+24
-15
lines changed

4 files changed

+24
-15
lines changed

src/app/components/common/switch-filter-item.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const _default = defineComponent({
2121
emits: ["change"],
2222
setup(props, ctx) {
2323
const modelValue: Ref<boolean> = ref(props.defaultValue)
24-
return () => h("span", {}, [
24+
return () => h("span", { class: "filter-switch" }, [
2525
h('a', { class: 'filter-name' }, props.label),
2626
h(ElSwitch, {
2727
class: 'filter-item',

src/app/components/report/filter/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ const _default = defineComponent({
120120
}
121121
}),
122122
// Float right
123-
h("div", { style: { float: "right" } }, [
123+
h("div", { class: "filter-item-right-group" }, [
124124
h(ElButton, {
125125
class: "batch-delete-button",
126126
disabled: mergeHost.value,

src/app/components/trend/components/filter.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,18 @@ const _default = defineComponent({
7878
placeholder: HOST_PLACEHOLDER,
7979
class: 'filter-item',
8080
modelValue: domainKey.value,
81+
clearable: true,
8182
filterable: true,
8283
remote: true,
8384
loading: trendSearching.value,
8485
remoteMethod: (query: string) => handleRemoteSearch(query, trendDomainOptions, trendSearching),
8586
onChange: (key: string) => {
8687
domainKey.value = key
8788
handleChange()
89+
},
90+
onClear: () => {
91+
domainKey.value = ''
92+
handleChange()
8893
}
8994
}, () => trendDomainOptions.value?.map(renderOption) || []),
9095
h(DateRangeFilterItem, {

src/app/styles/index.sass

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,17 @@ a
5555
.el-card__body
5656
padding-bottom: 10px
5757
padding-top: 18px
58+
margin-bottom: 10px
59+
display: flex
5860

5961
.filter-name
6062
margin-right: 4px
6163

6264
.filter-item
63-
display: inline-block
64-
vertical-align: middle
65-
margin-bottom: 10px
6665
padding-right: 20px
6766

68-
&
6967
.el-input__suffix
70-
right: 30px !important
68+
width: 20px
7169

7270
.el-picker-panel__sidebar
7371
width: 130px !important
@@ -80,19 +78,25 @@ a
8078

8179
.filter-item.el-switch
8280
display: inline-flex !important
83-
margin-bottom: 7px
8481

85-
.filter-name
86-
color: #909399
87-
font-weight: bold
88-
font-size: 14px
89-
pointer-events: none
82+
.filter-switch
83+
display: inline-flex
84+
align-items: center
85+
.filter-name
86+
display: inline-flex
87+
color: #909399
88+
font-weight: bold
89+
font-size: 14px
90+
pointer-events: none
9091

91-
.filter-item-right
92-
float: right
92+
.filter-item-right,.filter-item-right-group
93+
display: inline-flex
94+
margin-left: auto
9395

9496
.filter-item.el-input
9597
width: 225px
98+
.el-select.filter-item
99+
display: inline-flex
96100

97101
.pagination-container
98102
display: flex

0 commit comments

Comments
 (0)