Skip to content

Commit c4b2297

Browse files
committed
quickSearch && laySet style optimize
1 parent afe0a39 commit c4b2297

File tree

2 files changed

+38
-20
lines changed

2 files changed

+38
-20
lines changed

src/Skeleton.vue

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,21 +85,24 @@ onMounted(async () => {
8585
<div
8686
:class="`${tableBasicConf.styles.headerClass} iw-tt-header flex justify-between p-0 min-h-0`"
8787
>
88-
<div class="tablist iw-tabs iw-tabs-sm iw-tabs-boxed">
89-
<a
90-
v-for="layout in tableLayoutsConf"
91-
:key="layout.id"
92-
:data-layout-id="layout.id"
93-
role="tab"
94-
class="iw-tt-header__item iw-tab"
95-
:class="currentLayoutId === layout.id ? 'iw-tab-active' : ''"
96-
>
97-
<i :class="`${layout.icon}`" class="mr-1" /> {{ layout.title }}
98-
</a>
99-
</div>
100-
<div>
88+
<ScrollableComp class="flex-1">
89+
<div class="tablist iw-tabs iw-tabs-sm iw-tabs-boxed">
90+
<a
91+
v-for="layout in tableLayoutsConf"
92+
:key="layout.id"
93+
:data-layout-id="layout.id"
94+
role="tab"
95+
class="iw-tt-header__item iw-tab flex flex-nowrap"
96+
:class="currentLayoutId === layout.id ? 'iw-tab-active' : ''"
97+
>
98+
<i :class="`${layout.icon}`" class="mr-1" /> {{ layout.title }}
99+
</a>
100+
</div>
101+
</ScrollableComp>
102+
<div class="flex items-center">
101103
<QuickSearchComp
102104
v-if="props.layouts.find(layout => layout.id === currentLayoutId)?.quickSearch"
105+
class="mx-2"
103106
:placeholder="props.layouts.find(layout => layout.id === currentLayoutId)?.quickSearch?.placeholder!"
104107
:search-content="tableLayoutsConf.find(layout => layout.id === currentLayoutId)?.quickSearchContent"
105108
/>
Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,39 @@
11
<script setup lang="ts">
2-
import * as eb from '../eventbus';
2+
import { ref } from 'vue'
3+
import * as eb from '../eventbus'
34
45
const props = defineProps<{
56
placeholder: string
67
searchContent?: string
78
}>()
89
10+
const quickSearchRef = ref()
11+
const showInput = ref(false)
12+
913
async function setQuickSearchContent(e: Event) {
1014
const target = e.target as HTMLInputElement
1115
await eb.modifyLayout({
1216
quickSearchContent: target.value,
1317
})
1418
}
19+
20+
function handleQuickShow() {
21+
showInput.value = !showInput.value
22+
}
1523
</script>
1624

1725
<template>
18-
<input
19-
class="iw-input iw-input-bordered iw-input-xs"
20-
:value="props.searchContent || ''"
21-
:placeholder="props.placeholder"
22-
@change="setQuickSearchContent"
23-
>
26+
<label class="iw-input iw-input-xs flex items-center" :class="`${showInput && 'iw-input-bordered'}`">
27+
<input
28+
ref="quickSearchRef"
29+
type="text"
30+
class="iw-grow border-none"
31+
:class="`${showInput ? 'w-[150px]' : 'w-0'}`"
32+
:value="props.searchContent || ''"
33+
:placeholder="props.placeholder"
34+
style="transition: all 0.2s ease-in-out"
35+
@change="setQuickSearchContent"
36+
>
37+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="w-4 h-4 opacity-70 cursor-pointer" @click="handleQuickShow"><path fill-rule="evenodd" d="M9.965 11.026a5 5 0 1 1 1.06-1.06l2.755 2.754a.75.75 0 1 1-1.06 1.06l-2.755-2.754ZM10.5 7a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0Z" clip-rule="evenodd" /></svg>
38+
</label>
2439
</template>

0 commit comments

Comments
 (0)