vue-devui 1.0.1 → 1.0.2

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/README.md CHANGED
@@ -169,6 +169,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
169
169
  <td align="center"><a href="https://github.com/qinwencheng"><img src="https://avatars.githubusercontent.com/u/24841685?v=4?s=100" width="100px;" alt=""/><br /><sub><b>qinwencheng</b></sub></a><br /><a href="https://github.com/DevCloudFE/vue-devui/commits?author=qinwencheng" title="Code">💻</a></td>
170
170
  <td align="center"><a href="https://github.com/angelanana"><img src="https://avatars.githubusercontent.com/u/63281354?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Angelanana</b></sub></a><br /><a href="https://github.com/DevCloudFE/vue-devui/commits?author=angelanana" title="Code">💻</a></td>
171
171
  <td align="center"><a href="https://github.com/joo1es"><img src="https://avatars.githubusercontent.com/u/76929557?v=4?s=100" width="100px;" alt=""/><br /><sub><b>joo1es</b></sub></a><br /><a href="https://github.com/DevCloudFE/vue-devui/commits?author=joo1es" title="Code">💻</a></td>
172
+ <td align="center"><a href="https://github.com/handsomezyw"><img src="https://avatars.githubusercontent.com/u/34366225?v=4?s=100" width="100px;" alt=""/><br /><sub><b>handsomezyw</b></sub></a><br /><a href="https://github.com/DevCloudFE/vue-devui/commits?author=handsomezyw" title="Code">💻</a></td>
172
173
  </tr>
173
174
  </table>
174
175
 
@@ -8206,10 +8206,16 @@ var Mention = defineComponent({
8206
8206
  }
8207
8207
  emit("change", val.slice(1));
8208
8208
  }, 300);
8209
- const handleBlur = () => {
8210
- setTimeout(() => {
8211
- showSuggestions.value = false;
8212
- }, 100);
8209
+ const handleBlur = (e) => {
8210
+ const {
8211
+ target
8212
+ } = e;
8213
+ const ele = document.querySelector(".devui-mention");
8214
+ if (!(ele == null ? void 0 : ele.contains(target))) {
8215
+ setTimeout(() => {
8216
+ showSuggestions.value = false;
8217
+ }, 100);
8218
+ }
8213
8219
  };
8214
8220
  const handleFocus = () => {
8215
8221
  if (props.trigger.includes(textContext.value)) {
@@ -8221,7 +8227,7 @@ var Mention = defineComponent({
8221
8227
  e.stopPropagation();
8222
8228
  e.preventDefault();
8223
8229
  showSuggestions.value = false;
8224
- textContext.value += item[props.dmValueParse.value];
8230
+ textContext.value = textContext.value.substring(0, 1) + item[props.dmValueParse.value];
8225
8231
  };
8226
8232
  const arrowKeyDown = (e) => {
8227
8233
  var _a, _b, _c;
@@ -8255,7 +8261,7 @@ var Mention = defineComponent({
8255
8261
  e.stopPropagation();
8256
8262
  e.preventDefault();
8257
8263
  showSuggestions.value = false;
8258
- textContext.value += filteredSuggestions.value[currentIndex.value][props.dmValueParse.value];
8264
+ textContext.value = textContext.value.substring(0, 1) + filteredSuggestions.value[currentIndex.value][props.dmValueParse.value];
8259
8265
  emit("select", filteredSuggestions.value[currentIndex.value]);
8260
8266
  }
8261
8267
  }
@@ -8270,10 +8276,12 @@ var Mention = defineComponent({
8270
8276
  onMounted(() => {
8271
8277
  window.addEventListener("keydown", arrowKeyDown);
8272
8278
  window.addEventListener("keydown", enterKeyDown);
8279
+ document.addEventListener("click", handleBlur);
8273
8280
  });
8274
8281
  onUnmounted(() => {
8275
8282
  window.removeEventListener("keydown", arrowKeyDown);
8276
8283
  window.removeEventListener("keydown", enterKeyDown);
8284
+ document.removeEventListener("click", handleBlur);
8277
8285
  });
8278
8286
  return () => {
8279
8287
  var _a;
@@ -8283,7 +8291,6 @@ var Mention = defineComponent({
8283
8291
  "modelValue": textContext.value,
8284
8292
  "onUpdate:modelValue": ($event) => textContext.value = $event,
8285
8293
  "onUpdate": handleUpdate,
8286
- "onBlur": handleBlur,
8287
8294
  "onFocus": handleFocus
8288
8295
  }, null), showSuggestions.value ? loading.value ? createVNode("div", {
8289
8296
  "class": [`${ns2.e("suggestions")} ${ns2.e("suggestions-loading")}`]