-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6cdfd2d
commit b6abee6
Showing
10 changed files
with
331 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<template> | ||
<CustomInput :id="id" :label="label" :description="description" class="flex flex-col"> | ||
<template #input> | ||
<select | ||
:id="id" | ||
v-model="internalValue" | ||
class="border border-gray-300 rounded focus:outline-none focus:shadow-outline focus:border-indigo-300" | ||
:name="id" | ||
:placeholder="placeholder" | ||
:disabled="typeof options === undefined" | ||
> | ||
<option value="" :disabled="required">Maak een keuze</option> | ||
<option v-for="option of options" :key="option.value" :value="option.value"> | ||
{{ option.text }} | ||
</option> | ||
</select> | ||
</template> | ||
</CustomInput> | ||
</template> | ||
|
||
<script> | ||
import CustomInput from '~/components/form/CustomInput.vue' | ||
export default { | ||
components: { CustomInput }, | ||
props: { | ||
id: { | ||
required: true, | ||
type: String, | ||
}, | ||
label: { | ||
required: true, | ||
type: String, | ||
}, | ||
description: { | ||
required: false, | ||
type: String, | ||
default: null, | ||
}, | ||
placeholder: { | ||
required: false, | ||
type: String, | ||
default: null, | ||
}, | ||
options: { | ||
required: false, | ||
default() { | ||
return [] | ||
}, | ||
type: Array, | ||
}, | ||
value: { | ||
required: false, | ||
type: [String, Number], | ||
default: null, | ||
}, | ||
required: { | ||
required: false, | ||
type: Boolean, | ||
default: false, | ||
}, | ||
}, | ||
computed: { | ||
internalValue: { | ||
get() { | ||
return this.value | ||
}, | ||
set(value) { | ||
this.$emit('input', value) | ||
}, | ||
}, | ||
}, | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<template> | ||
<CustomInput :id="id" :label="label" :description="description" class="flex flex-col"> | ||
<template #input> | ||
<input | ||
:id="id" | ||
v-model="internalValue" | ||
:type="type" | ||
class="border border-gray-300 rounded focus:outline-none focus:shadow-outline focus:border-indigo-300" | ||
:name="id" | ||
:placeholder="placeholder" | ||
@keypress.enter="$emit('keypress', $event)" | ||
/> | ||
</template> | ||
|
||
<template v-if="minLength || maxLength" #bottom> | ||
{{ charLengthMessage }} | ||
</template> | ||
</CustomInput> | ||
</template> | ||
|
||
<script> | ||
import CustomInput from '~/components/form/CustomInput.vue' | ||
export default { | ||
components: { CustomInput }, | ||
props: { | ||
id: { | ||
required: true, | ||
type: String, | ||
}, | ||
label: { | ||
required: true, | ||
type: String, | ||
}, | ||
description: { | ||
required: false, | ||
type: String, | ||
default: null, | ||
}, | ||
placeholder: { | ||
required: false, | ||
type: String, | ||
default: null, | ||
}, | ||
type: { | ||
required: false, | ||
type: String, | ||
default: 'text', | ||
validator(value) { | ||
// The value must match one of these strings | ||
return ['text', 'number', 'email', 'password'].includes(value) | ||
}, | ||
}, | ||
value: { | ||
required: false, | ||
type: [String, Number], | ||
default: null, | ||
}, | ||
minLength: { | ||
required: false, | ||
type: Number, | ||
default: null, | ||
}, | ||
maxLength: { | ||
required: false, | ||
type: Number, | ||
default: null, | ||
}, | ||
}, | ||
computed: { | ||
internalValue: { | ||
get() { | ||
return this.value | ||
}, | ||
set(value) { | ||
this.$emit('input', value) | ||
}, | ||
}, | ||
charLengthMessage() { | ||
let m = `Karakters: ${this.value.length}, ` | ||
if (this.minLength) { | ||
m += `Min: ${this.minLength}` | ||
} | ||
if (this.minLength) { | ||
m += ` / ` | ||
} | ||
if (this.minLength) { | ||
m += `Max: ${this.maxLength}` | ||
} | ||
return m | ||
}, | ||
}, | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<template> | ||
<CustomInput :id="id" :label="label" :description="description" class="flex flex-col"> | ||
<template #input> | ||
<input | ||
:id="id" | ||
v-model="internalValue" | ||
type="text" | ||
class="border border-gray-300 rounded focus:outline-none focus:shadow-outline focus:border-indigo-300" | ||
:name="id" | ||
:placeholder="placeholder" | ||
/> | ||
</template> | ||
</CustomInput> | ||
</template> | ||
|
||
<script> | ||
import CustomInput from '~/components/form/CustomInput.vue' | ||
export default { | ||
components: { CustomInput }, | ||
props: { | ||
id: { | ||
required: true, | ||
type: String, | ||
}, | ||
label: { | ||
required: true, | ||
type: String, | ||
}, | ||
description: { | ||
required: false, | ||
type: String, | ||
default: null, | ||
}, | ||
placeholder: { | ||
required: false, | ||
type: String, | ||
default: null, | ||
}, | ||
value: { | ||
required: false, | ||
type: [String, Number], | ||
default: null, | ||
}, | ||
}, | ||
computed: { | ||
internalValue: { | ||
get() { | ||
return this.value | ||
}, | ||
set(value) { | ||
const slug = value | ||
.toLowerCase() | ||
.replace(/[^\w\s-]/g, '') | ||
.replace(/[\s_-]+/g, '-') | ||
.replace(/^-+|-+$/g, '') | ||
this.$emit('input', slug) | ||
}, | ||
}, | ||
}, | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
b6abee6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.