@fy-/fws-vue 0.9.7 → 0.9.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.
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { LinkIcon } from "@heroicons/vue/24/solid";
|
|
3
|
-
import { computed, ref, toRef } from "vue";
|
|
3
|
+
import { computed, onMounted, 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";
|
|
7
|
+
import Datepicker from "flowbite-datepicker/Datepicker";
|
|
8
|
+
|
|
7
9
|
type modelValueType = string | number | string[] | number[] | undefined;
|
|
8
10
|
|
|
9
11
|
type checkboxValueType = any[] | Set<any> | undefined | boolean;
|
|
@@ -23,6 +25,7 @@ const props = withDefaults(
|
|
|
23
25
|
modelValue?: modelValueType;
|
|
24
26
|
checkboxValue?: checkboxValueType;
|
|
25
27
|
options?: string[][];
|
|
28
|
+
dpOptions?: Record<string, any>;
|
|
26
29
|
help?: string;
|
|
27
30
|
error?: string;
|
|
28
31
|
color?: string;
|
|
@@ -39,13 +42,14 @@ const props = withDefaults(
|
|
|
39
42
|
checkboxFalseValue: false,
|
|
40
43
|
disabled: false,
|
|
41
44
|
maxLengthPerTag: 0,
|
|
45
|
+
dpOptions: () => ({}),
|
|
42
46
|
},
|
|
43
47
|
);
|
|
44
48
|
const translate = useTranslation();
|
|
45
49
|
const inputRef = ref<HTMLInputElement>();
|
|
46
50
|
const errorProps = toRef(props, "error");
|
|
47
51
|
const errorVuelidateProps = toRef(props, "errorVuelidate");
|
|
48
|
-
|
|
52
|
+
const dpRef = ref<Datepicker | null>(null);
|
|
49
53
|
const checkErrors = computed(() => {
|
|
50
54
|
if (errorProps.value) return errorProps.value;
|
|
51
55
|
if (errorVuelidateProps.value && errorVuelidateProps.value.length > 0) {
|
|
@@ -92,6 +96,16 @@ const modelCheckbox = computed({
|
|
|
92
96
|
},
|
|
93
97
|
});
|
|
94
98
|
defineExpose({ focus, blur, getInputRef });
|
|
99
|
+
|
|
100
|
+
onMounted(() => {
|
|
101
|
+
if (props.type === "datepicker" && inputRef.value) {
|
|
102
|
+
dpRef.value = new Datepicker(inputRef.value, {
|
|
103
|
+
format: "dd/mm/yyyy",
|
|
104
|
+
autohide: true,
|
|
105
|
+
...props.dpOptions,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
});
|
|
95
109
|
</script>
|
|
96
110
|
<template>
|
|
97
111
|
<div>
|
|
@@ -191,6 +205,7 @@ defineExpose({ focus, blur, getInputRef });
|
|
|
191
205
|
@focus="handleFocus"
|
|
192
206
|
@blur="handleBlur"
|
|
193
207
|
v-model="model"
|
|
208
|
+
ref="inputRef"
|
|
194
209
|
/>
|
|
195
210
|
</div>
|
|
196
211
|
</div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fy-/fws-vue",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9",
|
|
4
4
|
"author": "Florian 'Fy' Gasquez <m@fy.to>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
"pinia": "2.x.x",
|
|
39
39
|
"timeago.js": "^4.0.x",
|
|
40
40
|
"vue": "^3.3.x",
|
|
41
|
+
"vue-picture-cropper": "^0.7.x",
|
|
41
42
|
"vue-router": "^4.1.x",
|
|
42
|
-
"
|
|
43
|
+
"flowbite-datepicker": "^1.2.x"
|
|
43
44
|
}
|
|
44
45
|
}
|