quasar-ui-danx 0.4.29 → 0.4.30

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quasar-ui-danx",
3
- "version": "0.4.29",
3
+ "version": "0.4.30",
4
4
  "author": "Dan <dan@flytedesk.com>",
5
5
  "description": "DanX Vue / Quasar component library",
6
6
  "license": "MIT",
@@ -6,6 +6,8 @@
6
6
  :style="{minWidth, minHeight}"
7
7
  :class="contentClass"
8
8
  @input="onInput"
9
+ @focusin="hasFocus = true"
10
+ @focusout="hasFocus = false"
9
11
  >
10
12
  {{ text }}
11
13
  </div>
@@ -21,7 +23,7 @@
21
23
 
22
24
  <script setup lang="ts">
23
25
  import { useDebounceFn } from "@vueuse/core";
24
- import { computed, onMounted, ref } from "vue";
26
+ import { computed, onMounted, ref, watch } from "vue";
25
27
 
26
28
  const emit = defineEmits(["update:model-value", "change"]);
27
29
  const props = withDefaults(defineProps<{
@@ -42,6 +44,7 @@ const text = ref(props.modelValue);
42
44
  const placeholderDiv = ref(null);
43
45
  const minWidth = ref(0);
44
46
  const minHeight = ref(0);
47
+ const hasFocus = ref(false);
45
48
 
46
49
  onMounted(() => {
47
50
  // Set the min-width to the width of the placeholder
@@ -51,6 +54,11 @@ onMounted(() => {
51
54
  }
52
55
  });
53
56
 
57
+ watch(() => props.modelValue, (value) => {
58
+ if (!hasFocus.value)
59
+ text.value = value;
60
+ });
61
+
54
62
  const debouncedChange = useDebounceFn(() => {
55
63
  emit("update:model-value", text.value);
56
64
  emit("change", text.value);