vue-formular
Advanced tools
Comparing version 1.2.60 to 1.2.61
@@ -64,5 +64,5 @@ var merge = require('merge'); | ||
if (!this.value && this.noDefault) { | ||
setTimeout(function(){ | ||
this.value = this.filteredItems[0].id; | ||
}.bind(this),0); | ||
setTimeout(function(){ | ||
this.value = this.filteredItems[0].id; | ||
}.bind(this),0); | ||
} | ||
@@ -133,28 +133,6 @@ | ||
if (that.ajaxUrl) { | ||
var value = $(this).val(); | ||
that.value = that.multiple?unique(value):value; | ||
var items = $(this).select2('data').map(function(item) { | ||
return { | ||
id:item.id, | ||
text:item.text | ||
}; | ||
}); | ||
var ids = []; | ||
items = items.filter(function(item) { | ||
if (ids.indexOf(item.id)==-1) { | ||
ids.push(item.id); | ||
return true; | ||
} | ||
return false; | ||
}); | ||
that.items = items; | ||
} | ||
var value = $(this).val(); | ||
that.value = that.multiple?unique(value):value; | ||
}).on("select2:unselecting", function(e) { | ||
}).on("select2:unselecting", function(e) { | ||
if (that.multiple) { | ||
@@ -171,86 +149,86 @@ var $this = $(this); | ||
this.el.select2('val',this.value); | ||
this.el.select2('val',this.value); | ||
setTimeout(function() { | ||
this.el.trigger('change'); | ||
}.bind(this),0); | ||
setTimeout(function() { | ||
this.el.trigger('change'); | ||
}.bind(this),0); | ||
if (this.containerClass) { | ||
this.el.data('select2').$container.addClass("container-" + this.containerClass); | ||
this.el.data('select2').$dropdown.addClass("dropdown-" + this.containerClass); | ||
} | ||
if (this.containerClass) { | ||
this.el.data('select2').$container.addClass("container-" + this.containerClass); | ||
this.el.data('select2').$dropdown.addClass("dropdown-" + this.containerClass); | ||
} | ||
} | ||
}, | ||
computed: { | ||
arraySymbol: require('../computed/array-symbol'), | ||
filterValue: function() { | ||
return this.filteringField?this.filteringField.value:null; | ||
}, | ||
computed: { | ||
arraySymbol: require('../computed/array-symbol'), | ||
filterValue: function() { | ||
return this.filteringField?this.filteringField.value:null; | ||
}, | ||
filteredItems: function() { | ||
if (this.select2 && !this.ajaxUrl && !this.html) | ||
return []; | ||
if (!this.filterBy) return this.items; | ||
filteredItems: function() { | ||
if (this.select2 && !this.ajaxUrl && !this.html) | ||
return []; | ||
if (!this.filterBy) return this.items; | ||
if (this.select2) | ||
setTimeout(function() { | ||
$(this.$el).find("select").val(this.value).trigger("change"); | ||
}.bind(this), 0); | ||
if (this.select2) | ||
setTimeout(function() { | ||
$(this.$el).find("select").val(this.value).trigger("change"); | ||
}.bind(this), 0); | ||
return this.items.filter(function(item) { | ||
return this.passesFilter(item); | ||
}.bind(this)) | ||
} | ||
}, | ||
data: function(){ | ||
return { | ||
filteringField:null, | ||
fieldType:'select', | ||
tagName:'select' | ||
} | ||
}, | ||
methods: { | ||
setValue: function(value) { | ||
this.value = value; | ||
this.dirty = true; | ||
return this.items.filter(function(item) { | ||
return this.passesFilter(item); | ||
}.bind(this)) | ||
} | ||
}, | ||
data: function(){ | ||
return { | ||
filteringField:null, | ||
fieldType:'select', | ||
tagName:'select' | ||
} | ||
}, | ||
methods: { | ||
setValue: function(value) { | ||
this.value = value; | ||
this.dirty = true; | ||
if (this.multiple) | ||
this.value = unique(this.value); | ||
if (this.select2) | ||
this.el.select2('val',value); | ||
}, | ||
reset: function() { | ||
var value = this.multiple?[]:''; | ||
this.wasReset = true; | ||
this.value = value; | ||
if (this.multiple) | ||
this.value = unique(this.value); | ||
if (this.select2) | ||
this.el.select2('val',value); | ||
}, | ||
reset: function() { | ||
var value = this.multiple?[]:''; | ||
this.wasReset = true; | ||
this.value = value; | ||
if (this.select2) | ||
this.el.select2('val', value); | ||
if (this.select2) | ||
this.el.select2('val', value); | ||
}, | ||
passesFilter:function(item) { | ||
if (!this.filterBy || !this.filterValue || !item[this.filterBy]) | ||
return true; | ||
}, | ||
passesFilter:function(item) { | ||
if (!this.filterBy || !this.filterValue || !item[this.filterBy]) | ||
return true; | ||
return (item[this.filterBy]==this.filterValue); | ||
return (item[this.filterBy]==this.filterValue); | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
}); | ||
} | ||
function unique(arr){ | ||
var u = {}, a = []; | ||
for(var i = 0, l = arr.length; i < l; ++i){ | ||
if(u.hasOwnProperty(arr[i])) { | ||
continue; | ||
} | ||
a.push(arr[i]); | ||
u[arr[i]] = 1; | ||
} | ||
return a; | ||
var u = {}, a = []; | ||
for(var i = 0, l = arr.length; i < l; ++i){ | ||
if(u.hasOwnProperty(arr[i])) { | ||
continue; | ||
} | ||
a.push(arr[i]); | ||
u[arr[i]] = 1; | ||
} | ||
return a; | ||
} |
{ | ||
"name": "vue-formular", | ||
"description": "a comprehensive vue.js form component", | ||
"version": "1.2.60", | ||
"version": "1.2.61", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "vue", |
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
69234
1932