|
1 | 1 | <template lang="pug">
|
2 | 2 | .radio-list(:disabled="disabled", v-attributes="'wrapper'")
|
3 | 3 | label(v-for="item in items", :class="{'is-checked': isItemChecked(item)}", v-attributes="'label'")
|
4 | | - input(:id="getFieldID(schema)", type="radio", :disabled="disabled", :name="id", @click="onSelection(item)", :value="getItemValue(item)", :checked="isItemChecked(item)", :class="schema.fieldClasses", :required="schema.required", v-attributes="'input'") |
| 4 | + input(:id="getFieldID(schema)", type="radio", :disabled="isItemDisabled(item)", :name="id", @click="onSelection(item)", :value="getItemValue(item)", :checked="isItemChecked(item)", :class="schema.fieldClasses", :required="schema.required", v-attributes="'input'") |
5 | 5 | | {{ getItemName(item) }}
|
6 | 6 |
|
7 | 7 | </template>
|
8 | 8 |
|
9 | 9 | <script>
|
10 | | -import { isObject } from "lodash"; |
| 10 | +import { isObject, isFunction, getasobjGet } from "lodash"; |
11 | 11 | import abstractField from "../abstractField";
|
12 | 12 |
|
13 | 13 | export default {
|
@@ -64,6 +64,16 @@ export default {
|
64 | 64 | isItemChecked(item) {
|
65 | 65 | let currentValue = this.getItemValue(item);
|
66 | 66 | return currentValue === this.value;
|
| 67 | + }, |
| 68 | + isItemDisabled(item) { |
| 69 | + if (this.disabled) { |
| 70 | + return true; |
| 71 | + } |
| 72 | + let disabled = objGet(item, "disabled", false); |
| 73 | + if (isFunction(disabled)) { |
| 74 | + return disabled(this.model); |
| 75 | + } |
| 76 | + return disabled; |
67 | 77 | }
|
68 | 78 | }
|
69 | 79 | };
|
|
0 commit comments