cd-personselector 1.3.7 → 1.3.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cd-personselector",
3
- "version": "1.3.7",
3
+ "version": "1.3.9",
4
4
  "description": "人员选择器组件 - 支持多Tab、树形结构、搜索、懒加载、输入框选择模式",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -3,7 +3,7 @@
3
3
  <t-select-input
4
4
  :value="selectedTags"
5
5
  v-model:inputValue="inputValue"
6
- v-model:popup-visible="popupVisible"
6
+ :popup-visible="popupVisible"
7
7
  :input-props="{
8
8
  readonly: false,
9
9
  disabled: false
@@ -25,7 +25,7 @@
25
25
  @tag-change="handleTagChange"
26
26
  >
27
27
  <template #panel>
28
- <div v-if="currentSearchResults.length > 0" class="cd-input-select__panel" @mousedown.stop>
28
+ <div v-if="currentSearchResults.length > 0" class="cd-input-select__panel" @mousedown.stop @click.stop>
29
29
  <div class="cd-input-select__grid">
30
30
  <t-checkbox
31
31
  v-for="result in paginatedSearchResults"
@@ -226,11 +226,19 @@ const updateSelectedUsers = (users: UserItem[]) => {
226
226
  selectedOptions.value = users;
227
227
  };
228
228
  // 事件处理
229
- const handleVisibleChange = (visible: boolean) => {
230
- if (!visible) {
231
- currentSearchResults.value = [];
232
- inputValue.value = '';
229
+ const handleVisibleChange = (visible: boolean, context?: { trigger?: string }) => {
230
+ if (visible) {
231
+ popupVisible.value = true;
232
+ return;
233
233
  }
234
+ // 多选模式下有搜索结果时,只允许点击外部或 ESC 关闭
235
+ const trigger = context?.trigger || '';
236
+ if (props.multiple && currentSearchResults.value.length > 0 && trigger !== 'document' && trigger !== 'keydown-esc') {
237
+ return; // 不关闭
238
+ }
239
+ popupVisible.value = false;
240
+ currentSearchResults.value = [];
241
+ inputValue.value = '';
234
242
  };
235
243
  const handleCheckboxChange = (checked: boolean, user: UserItem) => {
236
244
  if (checked) {
@@ -7,8 +7,10 @@
7
7
  placement="center"
8
8
  destroy-on-close
9
9
  attach="body"
10
+ :close-on-overlay-click="true"
10
11
  @confirm="handleConfirm"
11
12
  @close="handleClose"
13
+ @cancel="handleClose"
12
14
  >
13
15
  <div class="cd-ps-container">
14
16
  <div v-if="showSearch" class="cd-ps-search">
@@ -448,7 +450,7 @@ const handleConfirm = () => {
448
450
  emit('confirm', selectedItems.value);
449
451
  dialogVisible.value = false;
450
452
  };
451
- const handleClose = () => { dialogVisible.value = false; };
453
+ const handleClose = () => { dialogVisible.value = false; emit('close'); };
452
454
  defineExpose({
453
455
  clearSelection,
454
456
  appendUsers: (tabKey: string, nodeId: number | string, users: User[]) => {