vue-formular
Advanced tools
Comparing version 0.1.0 to 0.1.1
30
index.js
@@ -46,2 +46,15 @@ String.prototype.ucfirst = require('./lib/helpers/ucfirst'); | ||
globalOptions = globalOptions?globalOptions:{}; | ||
var defaultOptions = require('./lib/options/options')(); | ||
var options = merge.recursive(defaultOptions, globalOptions); | ||
this.options = merge.recursive(options, this.options); | ||
if (!this.ajax) { | ||
var payload = this.options.additionalPayload; | ||
for (key in payload) { | ||
this.additionalValues.push({name:key,value:payload[key]}); | ||
} | ||
} | ||
if (!this.validation || !this.validation.rules) | ||
@@ -60,20 +73,3 @@ return; | ||
} | ||
}, | ||
ready: function() { | ||
globalOptions = globalOptions?globalOptions:{}; | ||
var defaultOptions = require('./lib/options/options')(); | ||
var options = merge.recursive(defaultOptions, globalOptions); | ||
this.options = merge.recursive(options, this.options); | ||
if (!this.ajax) { | ||
var payload = this.options.additionalPayload; | ||
for (key in payload) { | ||
this.additionalValues.push({name:key,value:payload[key]}); | ||
} | ||
} | ||
}, | ||
data: function() { | ||
@@ -80,0 +76,0 @@ return { |
@@ -17,5 +17,9 @@ // Types: text, email, number | ||
checked: { | ||
type: Boolean, | ||
required: false, | ||
default: false | ||
type: Boolean | ||
}, | ||
notChecked: { | ||
type: Boolean | ||
}, | ||
value: { | ||
type:Boolean | ||
} | ||
@@ -25,4 +29,10 @@ }, | ||
this.value = this.checked; | ||
if (!this.checked && !this.notChecked) { | ||
this.dirty = true; | ||
} | ||
if (this.checked) | ||
this.value = true; | ||
}, | ||
@@ -29,0 +39,0 @@ data: function() { |
@@ -9,2 +9,3 @@ // Types: text, email, number | ||
var ready = require('../mixins/ready'); | ||
var merge = require('merge'); | ||
@@ -16,4 +17,25 @@ module.exports = { | ||
}), | ||
props: { | ||
options: { | ||
type: Object, | ||
required:false, | ||
default: function() { | ||
return {}; | ||
} | ||
}, | ||
ajax: { | ||
type: Boolean | ||
} | ||
}, | ||
ready: function() { | ||
if (!this.ajax) return; | ||
var options = merge.recursive(this.$parent.options.files, this.options); | ||
$(this.$el).find("input[type=file]").fileupload(options); | ||
}, | ||
mixins:[props,data, methods, computed,ready] | ||
} | ||
@@ -25,4 +25,3 @@ var render_template = require('../../helpers/render-template'); | ||
select2: { | ||
required: false, | ||
default: false | ||
required: false | ||
}, | ||
@@ -39,3 +38,3 @@ placeholder: { | ||
if (this.select2 && typeof $!='undefined') { | ||
if (typeof this.select2!='undefined' && typeof $!='undefined') { | ||
@@ -42,0 +41,0 @@ var options = { |
@@ -7,4 +7,5 @@ module.exports = { | ||
validationError:require('../computed/validation-error'), | ||
success:require('../computed/success') | ||
success:require('../computed/success'), | ||
hasLabel:require('../computed/has-label') | ||
} | ||
} |
@@ -15,2 +15,5 @@ module.exports = { | ||
}, | ||
hideLabel: { | ||
type:Boolean | ||
}, | ||
rules: { | ||
@@ -17,0 +20,0 @@ type: Object, |
@@ -12,5 +12,5 @@ module.exports = { | ||
disabled: function() { | ||
return this.$parent.pristine || this.$parent.errors.length; | ||
return this.$parent.pristine; | ||
} | ||
} | ||
} |
@@ -9,2 +9,3 @@ module.exports = function() { | ||
customRules:{}, | ||
files: {}, | ||
texts: { | ||
@@ -11,0 +12,0 @@ sending:'Sending Form...', |
{ | ||
"name": "vue-formular", | ||
"description": "a comprehensive vue.js form component", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "vue", |
@@ -103,3 +103,6 @@ # Vue Formular | ||
* `vf-file` - Presentation only. For funcitonality you can use an ajax file uploader, such as [AjaxFileUpload](https://github.com/davgothic/AjaxFileUpload) | ||
* `vf-file` - | ||
* `ajax` `boolean` `optional` - use [JQuery File Upload](https://github.com/blueimp/jQuery-File-Upload) | ||
* `options` `object` `optional` - plugin options for this field. merged with the `files` form-level option. | ||
* `vf-submit` - Submit button in a row wrapper, floated to the right. Will be disabled when the form is in pristine state | ||
@@ -243,2 +246,3 @@ | ||
* `additionalPayload` `object` Custom data you want to send along with the form. Serves a similar purpose to that of a hidden input field | ||
* `files` `object` - Options for [JQuery File Upload](https://github.com/blueimp/jQuery-File-Upload), to be used on `vf-file` with an `ajax` prop. | ||
* `customRules` `object` See [above](#custom-rules) | ||
@@ -245,0 +249,0 @@ * `messages` `object` see [above](#messages) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45215
69
957
257