Builds in support for disabled buttons fields and button content slots
This commit is contained in:
parent
cec35a834a
commit
21a83d0d50
6
dist/index.js
vendored
6
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -4,6 +4,7 @@
|
|||||||
class="formulate-element-input-wrapper"
|
class="formulate-element-input-wrapper"
|
||||||
:data-type="type"
|
:data-type="type"
|
||||||
:data-classification="classification"
|
:data-classification="classification"
|
||||||
|
:data-is-disabled="disabled"
|
||||||
>
|
>
|
||||||
<!-- TEXT STYLE INPUTS -->
|
<!-- TEXT STYLE INPUTS -->
|
||||||
<label
|
<label
|
||||||
@ -20,6 +21,7 @@
|
|||||||
v-bind="attributes"
|
v-bind="attributes"
|
||||||
v-if="isTextInput"
|
v-if="isTextInput"
|
||||||
@blur="errorBlurState = true"
|
@blur="errorBlurState = true"
|
||||||
|
:disabled="disabled"
|
||||||
>
|
>
|
||||||
<textarea
|
<textarea
|
||||||
ref="textarea"
|
ref="textarea"
|
||||||
@ -30,15 +32,24 @@
|
|||||||
v-bind="attributes"
|
v-bind="attributes"
|
||||||
v-if="isTextareaInput"
|
v-if="isTextareaInput"
|
||||||
@blur="errorBlurState = true"
|
@blur="errorBlurState = true"
|
||||||
|
:disabled="disabled"
|
||||||
/>
|
/>
|
||||||
<!-- BUTTON INPUTS -->
|
<!-- BUTTON INPUTS -->
|
||||||
<button
|
<button
|
||||||
:type="type"
|
:type="type"
|
||||||
:class="elementClasses"
|
:class="elementClasses"
|
||||||
v-text="label || name"
|
|
||||||
v-if="isButtonInput"
|
v-if="isButtonInput"
|
||||||
:disabled="type === 'submit' && (form.hasErrors && form.behavior === 'live')"
|
:disabled="disabled || (type === 'submit' && (form.hasErrors && form.behavior === 'live'))"
|
||||||
|
>
|
||||||
|
<slot
|
||||||
|
v-if="$slots.button"
|
||||||
|
name="button"
|
||||||
/>
|
/>
|
||||||
|
<span
|
||||||
|
v-text="label || name"
|
||||||
|
v-else
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
<!-- SELECT INPUTS -->
|
<!-- SELECT INPUTS -->
|
||||||
<select
|
<select
|
||||||
v-bind="attributes"
|
v-bind="attributes"
|
||||||
@ -47,6 +58,7 @@
|
|||||||
:name="name"
|
:name="name"
|
||||||
v-model="val"
|
v-model="val"
|
||||||
@blur="errorBlurState = true"
|
@blur="errorBlurState = true"
|
||||||
|
:disabled="disabled"
|
||||||
>
|
>
|
||||||
<option
|
<option
|
||||||
v-for="option in optionList"
|
v-for="option in optionList"
|
||||||
@ -73,6 +85,7 @@
|
|||||||
v-model="val"
|
v-model="val"
|
||||||
v-if="type === 'radio'"
|
v-if="type === 'radio'"
|
||||||
@blur="errorBlurState = true"
|
@blur="errorBlurState = true"
|
||||||
|
:disabled="disabled"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
@ -85,6 +98,7 @@
|
|||||||
v-model="val"
|
v-model="val"
|
||||||
v-if="type === 'checkbox'"
|
v-if="type === 'checkbox'"
|
||||||
@blur="errorBlurState = true"
|
@blur="errorBlurState = true"
|
||||||
|
:disabled="disabled"
|
||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
:for="option.id"
|
:for="option.id"
|
||||||
@ -187,6 +201,10 @@ export default {
|
|||||||
elementClasses: {
|
elementClasses: {
|
||||||
type: [String, Array, Object],
|
type: [String, Array, Object],
|
||||||
default: () => {}
|
default: () => {}
|
||||||
|
},
|
||||||
|
disabled: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user