@a-vision-software/vue-input-components 1.4.3 → 1.4.6
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/src/components/Modal.vue.d.ts +2 -0
- package/dist/src/types/modal.d.ts +1 -0
- package/dist/vue-input-components.cjs.js +1 -1
- package/dist/vue-input-components.css +1 -1
- package/dist/vue-input-components.es.js +492 -489
- package/dist/vue-input-components.umd.js +1 -1
- package/package.json +2 -2
- package/src/components/Modal.vue +2 -1
- package/src/components/TextInput.vue +11 -5
- package/src/types/modal.ts +1 -0
- package/src/views/ModalTestView.vue +1 -1
- package/src/views/TextInputTestView.vue +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a-vision-software/vue-input-components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.6",
|
|
4
4
|
"description": "A collection of reusable Vue 3 input components with TypeScript support",
|
|
5
5
|
"author": "A-Vision Software",
|
|
6
6
|
"license": "MIT",
|
|
@@ -85,4 +85,4 @@
|
|
|
85
85
|
"publishConfig": {
|
|
86
86
|
"access": "public"
|
|
87
87
|
}
|
|
88
|
-
}
|
|
88
|
+
}
|
package/src/components/Modal.vue
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Teleport to="body">
|
|
3
3
|
<transition name="modal-fade">
|
|
4
|
-
<div v-if="modelValue" class="modal-backdrop">
|
|
4
|
+
<div v-if="modelValue" class="modal-backdrop" :class="modalClass">
|
|
5
5
|
<div class="modal" :style="modalStyle" role="dialog" aria-labelledby="modalTitle"
|
|
6
6
|
aria-describedby="modalContent">
|
|
7
7
|
<div v-if="props.isLargeIcon && props.icon" class="modal-large-icon">
|
|
@@ -39,6 +39,7 @@ import { ModalProps, ModalEmits } from '../types/modal'
|
|
|
39
39
|
|
|
40
40
|
const props = withDefaults(defineProps<ModalProps>(), {
|
|
41
41
|
modelValue: false,
|
|
42
|
+
class: '',
|
|
42
43
|
title: '',
|
|
43
44
|
minWidth: '300px',
|
|
44
45
|
maxWidth: '800px',
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
</template>
|
|
55
55
|
|
|
56
56
|
<script setup lang="ts">
|
|
57
|
-
import { computed, ref, onUnmounted, onMounted } from 'vue'
|
|
57
|
+
import { computed, ref, onUnmounted, onMounted, watch } from 'vue'
|
|
58
58
|
import { TextInputProps } from '../types/textinput'
|
|
59
59
|
import Datepicker from '@vuepic/vue-datepicker'
|
|
60
60
|
import '@vuepic/vue-datepicker/dist/main.css'
|
|
@@ -115,12 +115,12 @@ const formatDateForModel = (date: Date | null): string => {
|
|
|
115
115
|
const day = String(date.getDate()).padStart(2, '0')
|
|
116
116
|
const month = String(date.getMonth() + 1).padStart(2, '0')
|
|
117
117
|
const year = date.getFullYear()
|
|
118
|
-
return `${
|
|
118
|
+
return `${year}-${month}-${day}`
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
const parseDateFromModel = (dateStr: string): Date | null => {
|
|
122
122
|
if (!dateStr) return null
|
|
123
|
-
const [
|
|
123
|
+
const [year, month, day] = dateStr.split('-').map(Number)
|
|
124
124
|
return new Date(year, month - 1, day)
|
|
125
125
|
}
|
|
126
126
|
|
|
@@ -150,7 +150,7 @@ const debounceAutosave = (value: string) => {
|
|
|
150
150
|
clearTimeout(changedTimer.value)
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
if (!props.error) {
|
|
153
|
+
if (!props.error && props.autosave) {
|
|
154
154
|
showChanged.value = true
|
|
155
155
|
}
|
|
156
156
|
|
|
@@ -210,12 +210,18 @@ onUnmounted(() => {
|
|
|
210
210
|
})
|
|
211
211
|
|
|
212
212
|
onMounted(() => {
|
|
213
|
-
id.value = `text-input-${Math.random().toString(36).
|
|
213
|
+
id.value = `text-input-${Math.random().toString(36).substring(2, 9)}`
|
|
214
214
|
if (props.type === 'date' && props.modelValue) {
|
|
215
215
|
dateValue.value = parseDateFromModel(props.modelValue)
|
|
216
216
|
}
|
|
217
217
|
})
|
|
218
218
|
|
|
219
|
+
watch(() => props.modelValue, (newValue) => {
|
|
220
|
+
if (props.type === 'date' && newValue) {
|
|
221
|
+
dateValue.value = parseDateFromModel(newValue)
|
|
222
|
+
}
|
|
223
|
+
})
|
|
224
|
+
|
|
219
225
|
defineExpose({
|
|
220
226
|
focus: () => inputRef.value?.focus(),
|
|
221
227
|
blur: () => inputRef.value?.blur(),
|
package/src/types/modal.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
<Action label="Open Basic Modal" @click="showBasicModal = true" />
|
|
11
11
|
|
|
12
|
-
<Modal v-model="showBasicModal" title="Basic Modal Example" icon="info-circle">
|
|
12
|
+
<Modal v-model="showBasicModal" title="Basic Modal Example" icon="info-circle" modal-class="basic-modal">
|
|
13
13
|
<p>This is a basic modal example with default styling.</p>
|
|
14
14
|
<p>The modal can be closed by clicking the X button in the top right corner.</p>
|
|
15
15
|
</Modal>
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
max-height="8rem" />
|
|
28
28
|
</div>
|
|
29
29
|
</div>
|
|
30
|
-
<div class="column">
|
|
30
|
+
<div class="column" @click.prevent="birthDate = '1974-03-12'">
|
|
31
31
|
<div class="input-group">
|
|
32
32
|
<h2>Address Information</h2>
|
|
33
33
|
<TextInput v-model="street" label="Street Address" type="text" icon="road"
|
|
@@ -64,7 +64,7 @@ const street = ref('')
|
|
|
64
64
|
const city = ref('')
|
|
65
65
|
const postalCode = ref('')
|
|
66
66
|
const country = ref('')
|
|
67
|
-
const birthDate = ref('')
|
|
67
|
+
const birthDate = ref('1967-08-22')
|
|
68
68
|
const comment = ref('')
|
|
69
69
|
const bio = ref('')
|
|
70
70
|
const feedback = ref('')
|