@fy-/fws-vue 1.0.9 → 1.1.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.
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { LinkIcon } from "@heroicons/vue/24/solid";
3
- import { computed, onMounted, ref, toRef } from "vue";
3
+ import { computed, onMounted, onUnmounted, ref, toRef } from "vue";
4
4
  import type { ErrorObject } from "@vuelidate/core";
5
5
  import { useTranslation } from "../../composables/translations";
6
6
  import DefaultTagInput from "./DefaultTagInput.vue";
@@ -97,15 +97,23 @@ const modelCheckbox = computed({
97
97
  });
98
98
  defineExpose({ focus, blur, getInputRef });
99
99
 
100
+ function setDpValue(e: any) {
101
+ model.value = e.detail.date.toISOString().split("T")[0];
102
+ }
103
+
100
104
  onMounted(() => {
101
105
  if (props.type === "datepicker" && inputRef.value) {
102
106
  dpRef.value = new Datepicker(inputRef.value, {
103
107
  autohide: true,
104
108
  ...props.dpOptions,
105
109
  });
106
- inputRef.value.addEventListener("changeDate", (e: any) => {
107
- model.value = e.detail.date.toISOString().split("T")[0];
108
- });
110
+ inputRef.value.addEventListener("changeDate", setDpValue);
111
+ }
112
+ });
113
+ onUnmounted(() => {
114
+ if (dpRef.value) {
115
+ dpRef.value.destroy();
116
+ inputRef.value?.removeEventListener("changeDate", setDpValue);
109
117
  }
110
118
  });
111
119
  </script>
@@ -204,7 +212,6 @@ onMounted(() => {
204
212
  :disabled="disabled"
205
213
  :aria-describedby="help ? `${id}-help` : id"
206
214
  :required="req"
207
- v-model="model"
208
215
  ref="inputRef"
209
216
  />
210
217
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fy-/fws-vue",
3
- "version": "1.0.9",
3
+ "version": "1.1.2",
4
4
  "author": "Florian 'Fy' Gasquez <m@fy.to>",
5
5
  "license": "MIT",
6
6
  "repository": {