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AAyC,MAAM,KAA/C,CAAjB;AACD;AACF,SAvCM;AAwCP,kBAxCO,sBAwCK,KAxCL,EAwCU;AACf,kBAAM,IAAN,CAAW,QAAX,EAAqB,KAAK,aAA1B;AACA,kBAAM,IAAN,CAAW,MAAX,EAAmB,KAAK,WAAxB;AAEA,gBAAM,QAAQ,KAAK,MAAL,CAAY,SAAZ,CAAsB;AAAA,uBAAK,MAAM,KAAX;AAAA,aAAtB,CAAd;AAEA;AACA,gBAAI,QAAQ,CAAC,CAAb,EAAgB,KAAK,MAAL,CAAY,MAAZ,CAAmB,KAAnB,EAA0B,CAA1B;AACjB;AAhDM;AAnEkB,CAAd,C;AAVf","sourcesContent":["// Styles\nimport '../../stylus/components/_selection-controls.styl'\nimport '../../stylus/components/_radio-group.styl'\n\n// Components\nimport VInput from '../VInput'\n\n// Mixins\nimport Comparable from '../../mixins/comparable'\nimport {\n provide as RegistrableProvide\n} from '../../mixins/registrable'\n\n/* @vue/component */\nexport default VInput.extend({\n name: 'v-radio-group',\n\n mixins: [\n Comparable,\n RegistrableProvide('radio')\n ],\n\n model: {\n prop: 'value',\n event: 'change'\n },\n\n provide () {\n return {\n radio: this\n }\n },\n\n props: {\n column: {\n type: Boolean,\n default: true\n },\n height: {\n type: [Number, String],\n default: 'auto'\n },\n mandatory: {\n type: Boolean,\n default: true\n },\n name: String,\n row: Boolean,\n // If no value set on VRadio\n // will match valueComparator\n // force default to null\n value: {\n default: null\n }\n },\n\n data: () => ({\n internalTabIndex: -1,\n radios: []\n }),\n\n computed: {\n classes () {\n return {\n 'v-input--selection-controls v-input--radio-group': true,\n 'v-input--radio-group--column': this.column && !this.row,\n 'v-input--radio-group--row': this.row\n }\n }\n },\n\n watch: {\n hasError: 'setErrorState',\n internalValue: 'setActiveRadio'\n },\n\n mounted () {\n this.setErrorState(this.hasError)\n this.setActiveRadio()\n },\n\n methods: {\n genDefaultSlot () {\n return this.$createElement('div', {\n staticClass: 'v-input--radio-group__input',\n attrs: {\n role: 'radiogroup'\n }\n }, VInput.options.methods.genDefaultSlot.call(this))\n },\n onRadioChange (value) {\n if (this.disabled) return\n\n this.hasInput = true\n this.internalValue = value\n this.setActiveRadio()\n this.$nextTick(this.validate)\n },\n onRadioBlur (e) {\n if (!e.relatedTarget || !e.relatedTarget.classList.contains('v-radio')) {\n this.hasInput = true\n this.$emit('blur', e)\n }\n },\n register (radio) {\n radio.isActive = this.valueComparator(this.internalValue, radio.value)\n radio.$on('change', this.onRadioChange)\n radio.$on('blur', this.onRadioBlur)\n this.radios.push(radio)\n },\n setErrorState (val) {\n for (let index = this.radios.length; --index >= 0;) {\n this.radios[index].parentError = val\n }\n },\n setActiveRadio () {\n for (let index = this.radios.length; --index >= 0;) {\n const radio = this.radios[index]\n radio.isActive = this.valueComparator(this.internalValue, radio.value)\n }\n },\n unregister (radio) {\n radio.$off('change', this.onRadioChange)\n radio.$off('blur', this.onRadioBlur)\n\n const index = this.radios.findIndex(r => r === radio)\n\n /* istanbul ignore else */\n if (index > -1) this.radios.splice(index, 1)\n }\n }\n})\n"],"sourceRoot":""}
|