![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/vreg/node_modules/bootstrap-vue/src/mixins/ |
/* Form control contextual state class computation * * Returned class is either 'is-valid' or 'is-invalid' based on the 'state' prop * state can be one of five values: * - true for is-valid * - false for is-invalid * - null for no contextual state */ import { Vue } from '../vue' import { PROP_TYPE_BOOLEAN } from '../constants/props' import { isBoolean } from '../utils/inspect' import { makeProp, makePropsConfigurable } from '../utils/props' // --- Props --- export const props = makePropsConfigurable( { // Tri-state prop: true, false, null (or undefined) state: makeProp(PROP_TYPE_BOOLEAN, null) }, 'formState' ) // --- Mixin --- // @vue/component export const formStateMixin = Vue.extend({ props, computed: { computedState() { // If not a boolean, ensure that value is null return isBoolean(this.state) ? this.state : null }, stateClass() { const state = this.computedState return state === true ? 'is-valid' : state === false ? 'is-invalid' : null }, computedAriaInvalid() { const { ariaInvalid } = this if (ariaInvalid === true || ariaInvalid === 'true' || ariaInvalid === '') { return 'true' } return this.computedState === false ? 'true' : ariaInvalid } } })