@stonecrop/aform 0.58.0 → 0.58.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/dist/aform.js CHANGED
@@ -3123,7 +3123,10 @@ var AFormLink_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
3123
3123
  searchText.value = displayedText.value;
3124
3124
  return;
3125
3125
  }
3126
- if (!id) return;
3126
+ if (!id) {
3127
+ searchText.value = "";
3128
+ return;
3129
+ }
3127
3130
  try {
3128
3131
  let match;
3129
3132
  let displayText;
@@ -3171,8 +3174,15 @@ var AFormLink_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
3171
3174
  activeIndex.value = null;
3172
3175
  searchText.value = hasValidId.value ? displayedText.value : "";
3173
3176
  };
3177
+ const leaveField = () => {
3178
+ if (hasValidId.value && searchText.value.trim() === "" && __props.mode !== "read" && !__props.disabled) {
3179
+ modelValue.value = null;
3180
+ knownLink.value = void 0;
3181
+ }
3182
+ closeDropdown();
3183
+ };
3174
3184
  const onClickOutside = () => {
3175
- if (dropdownOpen.value) closeDropdown();
3185
+ if (dropdownOpen.value) leaveField();
3176
3186
  };
3177
3187
  const onFocus = () => openDropdown(searchText.value);
3178
3188
  const onInput = () => openDropdown(searchText.value);
@@ -3212,12 +3222,13 @@ var AFormLink_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
3212
3222
  disabled: __props.disabled || __props.mode === "read",
3213
3223
  onInput,
3214
3224
  onFocus,
3225
+ onBlur: leaveField,
3215
3226
  onKeydown: [
3216
3227
  withKeys(withModifiers(selectNext, ["prevent"]), ["down"]),
3217
3228
  withKeys(withModifiers(selectPrev, ["prevent"]), ["up"]),
3218
3229
  withKeys(withModifiers(selectCurrent, ["prevent"]), ["enter"]),
3219
3230
  withKeys(closeDropdown, ["esc"]),
3220
- withKeys(closeDropdown, ["tab"])
3231
+ withKeys(leaveField, ["tab"])
3221
3232
  ]
3222
3233
  }, null, 42, _hoisted_5$6), [[vModelText, searchText.value]]), hasValidId.value && !__props.disabled && !__props.embedded ? (openBlock(), createElementBlock("button", {
3223
3234
  key: 0,
@@ -3262,7 +3273,7 @@ var AFormLink_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
3262
3273
  ])) : createCommentVNode("", true)])), [[unref(vOnClickOutside), onClickOutside]]), __props.label && !__props.embedded ? (openBlock(), createElementBlock("label", _hoisted_13, toDisplayString(__props.label), 1)) : createCommentVNode("", true)], 64))], 2);
3263
3274
  };
3264
3275
  }
3265
- }), [["__scopeId", "data-v-7e0002c9"]]);
3276
+ }), [["__scopeId", "data-v-98ee7f65"]]);
3266
3277
  // src/components/form/ANumericInput.vue?vue&type=script&setup=true&lang.ts
3267
3278
  var _hoisted_1$11 = { class: "aform_form-element" };
3268
3279
  var _hoisted_2$7 = { class: "aform_display-value" };