Skip to content
This repository has been archived by the owner on Jul 14, 2020. It is now read-only.

Commit

Permalink
Fix check list validatkion
Browse files Browse the repository at this point in the history
ref #24
  • Loading branch information
Sneki committed Jun 29, 2018
1 parent e1e4b92 commit 2729adf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dev/data/page.json
Original file line number Diff line number Diff line change
Expand Up @@ -533,8 +533,8 @@
"hint": null,
"persistentHint": false,
"hideDetails": false,
"color": "red",
"theme": "light",
"color": "",
"theme": "",
"disabled": false,
"value": [],
"validateOn": "blur",
Expand Down
13 changes: 12 additions & 1 deletion src/components/CCheckList/CCheckList.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { isNil, map, filter } from 'lodash';
import { fieldable, validatable } from '@mixins';
import { validator } from '@validators';
import Element from '../Element';

const createErrorMessage = (createElement, context) => {
Expand Down Expand Up @@ -40,6 +41,14 @@ const getItemListeners = (context) => {
return listeners;
};

const getPropRequired = (config) => {
if (config.validation) {
return !!config.validation.required;
}

return false;
};

const getItemProps = (context, item) => {
const config = context.config;

Expand All @@ -57,6 +66,8 @@ const getItemProps = (context, item) => {
hint: config.hint,
disabled: config.disabled,
color: config.color,
required: getPropRequired(config),
rules: validator.getRules(config, context.validators),
value,
};

Expand Down Expand Up @@ -110,7 +121,7 @@ export default {
item => createElement('v-checkbox',
{
attrs: getItemAttrs(this),
staticlass: 'mt-0',
staticClass: 'mt-0',
props: getItemProps(this, item),
on: getItemListeners(this, item),
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/CRating/CRating.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export default {
input(e) {
if (isNil(e)) {
self.value = null;
self.setRating(0, true);
self.setRating(0, false);
}
},
},
Expand Down

0 comments on commit 2729adf

Please sign in to comment.