@ctzy-web-client/plugin-component-vue 1.0.31 → 1.0.33

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.
@@ -18,9 +18,8 @@
18
18
  ref="advanceSelectRef"
19
19
  >
20
20
  <template #reference-content="{ selected }">
21
- <!-- 多选模式 -->
22
- <div v-if="multiple" :class="ns.e('content')" @click="handleContentClick">
23
- <div v-if="selected && selected.length > 0" style="display: flex; align-items: center; flex-wrap: wrap; gap: 4px;">
21
+ <div :class="ns.e('content')" v-if="multiple">
22
+ <div v-if="selected && selected.length > 0">
24
23
  <ElTooltip :content="selected[0].label" placement="top" effect="light" append-to=".bwa-application">
25
24
  <el-tag :class="ns.e('tag')" closable @close="handleClose(selected[0])" type="info">{{selected[0].label}}
26
25
  </el-tag>
@@ -39,47 +38,13 @@
39
38
  </el-tag>
40
39
  </template>
41
40
  </div>
41
+
42
42
  </template>
43
43
  <el-tag :class="ns.e('tag')" type="info" v-if="selected.length > 1">+{{selected.length - 1}}</el-tag>
44
44
  </ElTooltip>
45
- <!-- 搜索输入区域 -->
46
- <div v-if="props.showSearch && !column.componentProps?.options" style="flex: 1; min-width: 80px; position: relative;">
47
- <span v-if="!isSearchActive && !search" style="color: #999; cursor: text;">{{searchPlaceholderStr || '搜索'}}</span>
48
- <span v-else style="color: #333;">{{search}}</span>
49
- <!-- 闪烁光标 -->
50
- <span v-if="isSearchActive" class="cursor-blink"></span>
51
- <!-- 隐藏的输入框 -->
52
- <input
53
- v-if="props.showSearch && !column.componentProps?.options"
54
- ref="inputRef"
55
- v-model="search"
56
- type="text"
57
- style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: text;"
58
- @focus="handleInputFocus"
59
- @blur="handleInputBlur"
60
- @click.stop
61
- />
62
- </div>
63
- </div>
64
- <div v-else style="display: flex; align-items: center; justify-content: space-between; width: 100%;">
65
- <div style="flex: 1; position: relative; cursor: text;" @click="handleContentClick">
66
- <span v-if="!isSearchActive && !search" :class="ns.e('contentBox_placeholder')">{{placeholderStr}}</span>
67
- <span v-else style="color: #333;">{{search}}</span>
68
- <!-- 闪烁光标 -->
69
- <span v-if="isSearchActive" class="cursor-blink"></span>
70
- <!-- 隐藏的输入框 -->
71
- <input
72
- v-if="props.showSearch && !column.componentProps?.options"
73
- ref="inputRef"
74
- v-model="search"
75
- type="text"
76
- style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: text;"
77
- @focus="handleInputFocus"
78
- @blur="handleInputBlur"
79
- @click.stop
80
- />
81
- </div>
45
+
82
46
  </div>
47
+ <div v-else :class="ns.e('contentBox_placeholder')">{{placeholderStr}}</div>
83
48
  <ElIcon
84
49
  @mouseenter="isHoverIcon = true"
85
50
  @mouseleave="isHoverIcon = false"
@@ -94,30 +59,11 @@
94
59
  <ArrowDown v-else />
95
60
  </ElIcon>
96
61
  </div>
97
- <!-- 单选模式 -->
98
- <div v-else :class="ns.e('content')" @click="handleContentClick">
99
- <div style="flex: 1; position: relative; cursor: text;">
100
- <ElTooltip :disabled="!selected.label" :content="selected.label" placement="top" effect="light" append-to=".bwa-application">
101
- <div v-if="selected.label" :class="[ns.e('contentBox'), ns.e('contentBox_label')]">{{selected.label || placeholderStr}}</div>
102
- <div v-else style="display: flex; align-items: center; width: 100%;">
103
- <span v-if="!isSearchActive && !search" :class="ns.e('contentBox_placeholder')">{{placeholderStr}}</span>
104
- <span v-else style="color: #333;">{{search}}</span>
105
- <!-- 闪烁光标 -->
106
- <span v-if="isSearchActive" class="cursor-blink"></span>
107
- </div>
108
- </ElTooltip>
109
- <!-- 隐藏的输入框 -->
110
- <input
111
- v-if="props.showSearch && !column.componentProps?.options"
112
- ref="inputRef"
113
- v-model="search"
114
- type="text"
115
- style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: text;"
116
- @focus="handleInputFocus"
117
- @blur="handleInputBlur"
118
- @click.stop
119
- />
120
- </div>
62
+ <div v-else :class="ns.e('content')">
63
+ <ElTooltip :disabled="!selected.label" :content="selected.label" placement="top" effect="light" append-to=".bwa-application">
64
+ <div :class="[ns.e('contentBox'), ns.e('contentBox_label')]" v-if="selected.label">{{selected.label || placeholderStr}}</div>
65
+ <div :class="[ns.e('contentBox'), ns.e('contentBox_placeholder')]" v-else>{{placeholderStr}}</div>
66
+ </ElTooltip>
121
67
  <ElIcon
122
68
  :class="ns.be('option', 'selected')"
123
69
  >
@@ -126,6 +72,19 @@
126
72
  </ElIcon>
127
73
  </div>
128
74
  </template>
75
+
76
+ <template #contentTop>
77
+ <div :class="ns.e('contentTop')" v-if="showSearch && !column.componentProps?.options">
78
+ <ElInput
79
+ v-model="search"
80
+ :class="ns.e('select')"
81
+ :placeholder="searchPlaceholderStr"
82
+ type="text"
83
+ prefix-icon="Search"
84
+ clearable
85
+ />
86
+ </div>
87
+ </template>
129
88
  <slot>
130
89
  <BwaAdvanceOption
131
90
  v-for="item in data"
@@ -233,8 +192,6 @@ onMounted(() => {
233
192
  const ns = useNamespace('pctfilterpanel-item');
234
193
  const isShowPopper = ref(false)
235
194
  const isHoverIcon = ref(false)
236
- const isSearchActive = ref(false)
237
- const inputRef = ref(null)
238
195
 
239
196
  const attrs = useAttrs();
240
197
  const showTitle = computed(() => attrs.showTitle)
@@ -287,44 +244,6 @@ modelValue.value = currentModelValue.filter(item =>
287
244
  // 原有逻辑:切换下拉显隐
288
245
  isShowPopper.value = !isShowPopper.value;
289
246
  };
290
-
291
- // 处理选择框点击事件
292
- const handleContentClick = (event) => {
293
- event.stopPropagation();
294
- // 显示下拉菜单
295
- isShowPopper.value = true;
296
- // 如果支持搜索,聚焦输入框
297
- if (props.showSearch && !column.value?.componentProps?.options) {
298
- nextTick(() => {
299
- if (inputRef.value) {
300
- inputRef.value.focus();
301
- isSearchActive.value = true;
302
- }
303
- });
304
- }
305
- };
306
-
307
- // 处理输入框聚焦事件
308
- const handleInputFocus = () => {
309
- isSearchActive.value = true;
310
- // 确保下拉菜单显示
311
- isShowPopper.value = true;
312
- };
313
-
314
- // 处理输入框失焦事件
315
- const handleInputBlur = (event) => {
316
- // 检查是否点击了下拉菜单内部
317
- const target = event.relatedTarget;
318
- if (target && target.closest('.bwa-advance-select__popper')) {
319
- // 点击了下拉菜单内部,保持搜索状态
320
- return;
321
- }
322
- // 延迟处理,以便点击标签等操作能够正常执行
323
- setTimeout(() => {
324
- isSearchActive.value = false;
325
- // 不清空搜索内容,保持用户输入
326
- }, 200);
327
- };
328
247
  const getData = async (query) => {
329
248
  loading.value = true
330
249
  const { itfInfo, searchAttr } = column.value.componentProps
@@ -359,22 +278,8 @@ const handleFieldSearch = (query) => {
359
278
  }
360
279
 
361
280
  const search = ref('')
362
- let searchTimeout = null
363
281
  watch(() => search.value, val => {
364
282
  handleFieldSearch(val)
365
- // 清除之前的定时器
366
- if (searchTimeout) {
367
- clearTimeout(searchTimeout)
368
- }
369
- // 设置新的定时器,0.5秒后唤起下拉菜单并获取数据
370
- searchTimeout = setTimeout(() => {
371
- if (val && props.showSearch && !column.value?.componentProps?.options) {
372
- isShowPopper.value = true
373
- if (column.value.componentProps) {
374
- getData(val)
375
- }
376
- }
377
- }, 500)
378
283
  })
379
284
 
380
285
  const modelValue = computed({
@@ -403,23 +308,4 @@ const handleClearClick = () => {
403
308
  defineExpose({
404
309
  data
405
310
  })
406
- </script>
407
-
408
- <style scoped>
409
- @keyframes blink {
410
- 0%, 100% {
411
- opacity: 1;
412
- }
413
- 50% {
414
- opacity: 0;
415
- }
416
- }
417
-
418
- .cursor-blink {
419
- display: inline-block;
420
- width: 1px;
421
- height: 16px;
422
- background-color: #333;
423
- animation: blink 1s infinite;
424
- }
425
- </style>
311
+ </script>
package/es/components.css DELETED
@@ -1 +0,0 @@
1
- .letter-circle[data-v-4c0fde1d]{align-items:center;border-radius:50%;color:#fff;display:flex;font-size:14px;height:24px;justify-content:center;margin-right:8px;width:24px}@keyframes blink-ca1affd9{0%,to{opacity:1}50%{opacity:0}}.cursor-blink[data-v-ca1affd9]{animation:blink-ca1affd9 1s infinite;background-color:#333;display:inline-block;height:16px;width:1px}
@@ -1,13 +0,0 @@
1
- // Inject __name helper
2
- if (typeof __name === 'undefined') {
3
- function __name(obj, name) {
4
- Object.defineProperty(obj, "name", {
5
- value: name,
6
- configurable: true
7
- });
8
- }
9
- }
10
-
11
- var undefined$1 = undefined;
12
-
13
- export { undefined$1 as default };
@@ -1 +0,0 @@
1
- .letter-circle[data-v-4c0fde1d]{align-items:center;border-radius:50%;color:#fff;display:flex;font-size:14px;height:24px;justify-content:center;margin-right:8px;width:24px}@keyframes blink-ca1affd9{0%,to{opacity:1}50%{opacity:0}}.cursor-blink[data-v-ca1affd9]{animation:blink-ca1affd9 1s infinite;background-color:#333;display:inline-block;height:16px;width:1px}
@@ -1,17 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- // Inject __name helper
6
- if (typeof __name === 'undefined') {
7
- function __name(obj, name) {
8
- Object.defineProperty(obj, "name", {
9
- value: name,
10
- configurable: true
11
- });
12
- }
13
- }
14
-
15
- var undefined$1 = undefined;
16
-
17
- exports["default"] = undefined$1;