Skip to content

Commit 744d960

Browse files
committed
added error class for bootstrap 4
1 parent e47f897 commit 744d960

File tree

6 files changed

+6
-5
lines changed

6 files changed

+6
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-formly-bootstrap",
3-
"version": "2.2.0",
3+
"version": "2.2.1",
44
"description": "A bootstrap based form input bundle for Vue Formly",
55
"main": "dist/vue-formly-bootstrap.js",
66
"scripts": {

src/fields/fieldInput.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="form-group formly-input" :class="[ to.inputType, {'formly-has-value': model[field.key], 'formly-has-focus': form[field.key].$active, 'has-error': hasError}]">
2+
<div class="form-group formly-input" :class="[ to.inputType, {'formly-has-value': model[field.key], 'formly-has-focus': form[field.key].$active, 'has-error has-danger': hasError}]">
33
<label v-if="to.label" :for="to.id ? to.id : null">{{to.label}}</label>
44
<input class="form-control" :class="to.classes" :id="to.id ? to.id : null" type="text" v-model="model[field.key]" @blur="onBlur" @focus="onFocus" @click="onClick" @change="onChange" @keyup="onKeyup" @keydown="onKeydown" v-formly-atts="to.atts" v-formly-input-type="to.inputType">
55
<error-display :form="form" :field="field.key"></error-display>

src/fields/fieldList.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="checkbox formly-list" :id="to.id" :class="[to.classes, {'has-error': hasError}]">
2+
<div class="checkbox formly-list" :id="to.id" :class="[to.classes, {'has-error has-danger': hasError}]">
33

44
<label v-for="option in field.options">
55
<input v-if="!to.inputType || to.inputType == 'checkbox'" type="checkbox" v-model="model[field.key]" :value="option.value || option" @blur="onBlur" @focus="onFocus" @click="onClick" @change="onChange" @keyup="onKeyup" @keydown="onKeydown" v-formly-atts="to.atts">

src/fields/fieldSelect.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="form-group formly-select" :class="{'has-error': hasError}">
2+
<div class="form-group formly-select" :class="{'has-error has-danger': hasError}">
33
<label v-if="to.label" :for="to.id ? to.id : null">{{to.label}}</label>
44
<select class="form-control" :class="to.classes" :id="to.id ? to.id : null" v-model="model[field.key]" @blur="onBlur" @focus="onFocus" @click="onClick" @change="onChange" @keyup="onKeyup" @keydown="onKeydown" v-formly-atts="to.atts">
55
<option v-for="option in field.options" :value="option.value || option">{{option.label || option}}</option>

src/fields/fieldTextarea.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="form-group formly-textarea" :class="{'formly-has-value': model[field.key], 'formly-has-focus': form[field.key].$active, 'has-error': hasError}">
2+
<div class="form-group formly-textarea" :class="{'formly-has-value': model[field.key], 'formly-has-focus': form[field.key].$active, 'has-error has-danger': hasError}">
33
<label v-if="to.label" :for="to.id ? to.id : null">{{to.label}}</label>
44
<textarea class="form-control" :class="to.classes" :id="to.id ? to.id : null" v-model="model[field.key]" @blur="onBlur" @focus="onFocus" @click="onClick" @change="onChange" @keyup="onKeyup" @keydown="onKeydown" v-formly-atts="to.atts"></textarea>
55
<error-display :form="form" :field="field.key"></error-display>

test/unit/specs/index.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ describe('Bootstrap Field Inputs', () => {
195195
setTimeout( () => {
196196
expect(data.form['test'].$hasError).to.be.true;
197197
expect(vm.$el.querySelectorAll('.has-error')).to.be.length(1);
198+
expect(vm.$el.querySelectorAll('.has-danger')).to.be.length(1);
198199
done();
199200
}, 0);
200201
});

0 commit comments

Comments
 (0)