Skip to content

Commit

Permalink
Build and empty formfield
Browse files Browse the repository at this point in the history
  • Loading branch information
sietse85 committed May 19, 2022
1 parent 447e2a5 commit f8e8bd0
Show file tree
Hide file tree
Showing 6 changed files with 5,282 additions and 40 deletions.
1 change: 1 addition & 0 deletions dist/css/field.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions dist/js/field.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions dist/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"/js/field.js": "/js/field.js",
"/css/field.css": "/css/field.css"
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@vue/compiler-sfc": "^3.2.22",
"form-backend-validation": "^2.3.3",
"laravel-mix": "^6.0.41",
"laravel-nova": "^1.12.3",
"lodash": "^4.17.21",
"postcss": "^8.3.11",
"vue-loader": "^16.8.3"
Expand Down
41 changes: 1 addition & 40 deletions resources/js/components/FormField.vue
Original file line number Diff line number Diff line change
@@ -1,40 +1 @@
<template>
<DefaultField :field="field" :errors="errors" :show-help-text="showHelpText">
<template #field>
<input
:id="field.attribute"
type="text"
class="w-full form-control form-input form-input-bordered"
:class="errorClasses"
:placeholder="field.name"
v-model="value"
/>
</template>
</DefaultField>
</template>

<script>
import { FormField, HandlesValidationErrors } from 'laravel-nova'
export default {
mixins: [FormField, HandlesValidationErrors],
props: ['resourceName', 'resourceId', 'field'],
methods: {
/*
* Set the initial, internal value for the field.
*/
setInitialValue() {
this.value = this.field.value || ''
},
/**
* Fill the given FormData object with the field's internal value.
*/
fill(formData) {
formData.append(this.field.attribute, this.value || '')
},
},
}
</script>
<template></template>
Loading

0 comments on commit f8e8bd0

Please sign in to comment.