@opendesign-plus-test/components 0.0.1-rc.48 → 0.0.1-rc.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/OHeaderSearch.vue.d.ts +2 -0
- package/dist/components.cjs.js +32 -32
- package/dist/components.css +1 -1
- package/dist/components.es.js +3843 -3840
- package/package.json +3 -3
- package/src/components/OHeaderSearch.vue +47 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opendesign-plus-test/components",
|
|
3
|
-
"version": "0.0.1-rc.
|
|
3
|
+
"version": "0.0.1-rc.49",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"dayjs": "^1.11.13",
|
|
32
32
|
"video.js": "^8.23.7",
|
|
33
33
|
"vue-dompurify-html": "^3.1.2",
|
|
34
|
-
"@opendesign-plus/
|
|
35
|
-
"@opendesign-plus/
|
|
34
|
+
"@opendesign-plus/styles": "0.0.1-rc.2",
|
|
35
|
+
"@opendesign-plus/composables": "0.0.1-rc.8"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@opensig/opendesign": ">=1.0.0"
|
|
@@ -55,6 +55,8 @@ export interface OHeaderSearchPropsT {
|
|
|
55
55
|
/** Show "no data" empty state in suggest section while typing */
|
|
56
56
|
showSuggestEmpty?: boolean;
|
|
57
57
|
allowedImageTypes?: string[];
|
|
58
|
+
/** 强制指定移动端模式,不传时由内部 lePadV 断点自动判断 */
|
|
59
|
+
mobile?: boolean;
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
const props = withDefaults(defineProps<OHeaderSearchPropsT>(), {
|
|
@@ -105,6 +107,9 @@ const emit = defineEmits<{
|
|
|
105
107
|
const { lePadV } = useScreen();
|
|
106
108
|
const { t } = useI18n();
|
|
107
109
|
|
|
110
|
+
// mobile=true → 强制移动端;未传或 false → 回退到内部断点 lePadV
|
|
111
|
+
const isMobileMode = computed(() => props.mobile === true || lePadV.value);
|
|
112
|
+
|
|
108
113
|
const wrapperRef = ref<HTMLElement | null>(null);
|
|
109
114
|
const inputRef = ref<InstanceType<typeof SearchImageInput>>();
|
|
110
115
|
const isShowDrawer = ref(false);
|
|
@@ -149,7 +154,7 @@ watch(innerValue, (val) => emitInputDebounced(val));
|
|
|
149
154
|
|
|
150
155
|
// click outside (desktop only)
|
|
151
156
|
onClickOutside(wrapperRef, () => {
|
|
152
|
-
if (
|
|
157
|
+
if (isMobileMode.value) return;
|
|
153
158
|
closeDrawer();
|
|
154
159
|
});
|
|
155
160
|
|
|
@@ -158,7 +163,7 @@ const openDrawer = () => {
|
|
|
158
163
|
};
|
|
159
164
|
|
|
160
165
|
const closeDrawer = () => {
|
|
161
|
-
if (
|
|
166
|
+
if (isMobileMode.value) return;
|
|
162
167
|
isShowDrawer.value = false;
|
|
163
168
|
};
|
|
164
169
|
|
|
@@ -284,20 +289,20 @@ defineExpose({
|
|
|
284
289
|
</script>
|
|
285
290
|
|
|
286
291
|
<template>
|
|
287
|
-
<div class="o-header-search">
|
|
292
|
+
<div class="o-header-search" :class="{ 'is-mobile-mode': isMobileMode }">
|
|
288
293
|
<div
|
|
289
294
|
ref="wrapperRef"
|
|
290
295
|
class="o-header-search-pos"
|
|
291
296
|
:class="{
|
|
292
|
-
'is-pc': !
|
|
293
|
-
'is-mobile':
|
|
297
|
+
'is-pc': !isMobileMode,
|
|
298
|
+
'is-mobile': isMobileMode,
|
|
294
299
|
'is-left': expandDirection === 'left',
|
|
295
300
|
'is-right': expandDirection === 'right',
|
|
296
301
|
'is-focus': isShowDrawer,
|
|
297
302
|
}"
|
|
298
303
|
>
|
|
299
304
|
<div class="o-header-search-row" :class="{ 'is-focus': isShowDrawer }">
|
|
300
|
-
<OIcon v-if="
|
|
305
|
+
<OIcon v-if="isMobileMode && isShowDrawer" class="o-header-search-back-icon" @click="handleBack">
|
|
301
306
|
<IconBack />
|
|
302
307
|
</OIcon>
|
|
303
308
|
|
|
@@ -334,7 +339,7 @@ defineExpose({
|
|
|
334
339
|
</template>
|
|
335
340
|
</SearchImageInput>
|
|
336
341
|
|
|
337
|
-
<span v-if="
|
|
342
|
+
<span v-if="isMobileMode && isShowDrawer" class="o-header-search-text" @click="runSearch">
|
|
338
343
|
{{ searchTextMobile ?? t('search') }}
|
|
339
344
|
</span>
|
|
340
345
|
</div>
|
|
@@ -410,7 +415,7 @@ defineExpose({
|
|
|
410
415
|
</Transition>
|
|
411
416
|
</div>
|
|
412
417
|
|
|
413
|
-
<OIcon v-if="
|
|
418
|
+
<OIcon v-if="isMobileMode" class="o-header-search-mobile-icon" @click="openDrawer">
|
|
414
419
|
<IconSearch />
|
|
415
420
|
</OIcon>
|
|
416
421
|
</div>
|
|
@@ -580,4 +585,38 @@ defineExpose({
|
|
|
580
585
|
.o-header-search-drawer-enter-from {
|
|
581
586
|
opacity: 0;
|
|
582
587
|
}
|
|
588
|
+
|
|
589
|
+
// 外部传入 mobile=true 时,复制 <=pad_v 的全部样式,不依赖媒体查询
|
|
590
|
+
.o-header-search.is-mobile-mode {
|
|
591
|
+
width: 24px;
|
|
592
|
+
height: 24px;
|
|
593
|
+
|
|
594
|
+
.o-header-search-mobile-icon {
|
|
595
|
+
display: block;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
.o-header-search-row.is-focus {
|
|
599
|
+
gap: var(--o-gap-4);
|
|
600
|
+
padding: 10px var(--o-gap-4) var(--o-gap-4) var(--o-gap-4);
|
|
601
|
+
border-radius: unset;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
.o-header-search-row.is-focus .o-header-search-input {
|
|
605
|
+
flex: 1;
|
|
606
|
+
width: auto;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
.o-header-search-drawer {
|
|
610
|
+
position: static;
|
|
611
|
+
height: calc(100vh - 50px);
|
|
612
|
+
padding-top: 0;
|
|
613
|
+
overflow-y: auto;
|
|
614
|
+
box-shadow: unset;
|
|
615
|
+
border-radius: unset;
|
|
616
|
+
|
|
617
|
+
&::before {
|
|
618
|
+
display: none;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
583
622
|
</style>
|