|
|
@@ -1,5 +1,5 @@
|
|
|
/**
|
|
|
- * Vue.js v0.11.7
|
|
|
+ * Vue.js v0.11.8
|
|
|
* (c) 2015 Evan You
|
|
|
* Released under the MIT License.
|
|
|
*/
|
|
|
@@ -364,6 +364,10 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
// attached/detached hooks on them.
|
|
|
this._transCpnts = null
|
|
|
|
|
|
+ // props used in v-repeat diffing
|
|
|
+ this._new = true
|
|
|
+ this._reused = false
|
|
|
+
|
|
|
// merge options.
|
|
|
options = this.$options = mergeOptions(
|
|
|
this.constructor.options,
|
|
|
@@ -6011,7 +6015,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
|
|
var _ = __webpack_require__(11)
|
|
|
- var config = __webpack_require__(15)
|
|
|
var isObject = _.isObject
|
|
|
var isPlainObject = _.isPlainObject
|
|
|
var textParser = __webpack_require__(19)
|
|
|
@@ -6061,7 +6064,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
this._checkParam('track-by') ||
|
|
|
this._checkParam('trackby') // 0.11.0 compat
|
|
|
this.cache = Object.create(null)
|
|
|
- this.checkUpdateStrategy()
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
@@ -6102,8 +6104,10 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
var id = _.attr(this.el, 'component')
|
|
|
var options = this.vm.$options
|
|
|
if (!id) {
|
|
|
- this.Ctor = _.Vue // default constructor
|
|
|
- this.inherit = true // inline repeats should inherit
|
|
|
+ // default constructor
|
|
|
+ this.Ctor = _.Vue
|
|
|
+ // inline repeats should inherit
|
|
|
+ this.inherit = true
|
|
|
// important: transclude with no options, just
|
|
|
// to ensure block start and block end
|
|
|
this.template = transclude(this.template)
|
|
|
@@ -6142,30 +6146,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- /**
|
|
|
- * Check what strategy to use for updates.
|
|
|
- *
|
|
|
- * If the repeat is simple enough we can use in-place
|
|
|
- * updates which simply overwrites existing instances'
|
|
|
- * data. This strategy reuses DOM nodes and instances
|
|
|
- * as much as possible.
|
|
|
- *
|
|
|
- * There are two situations where we have to use the
|
|
|
- * more complex but more accurate diff algorithm:
|
|
|
- * 1. We are using components with or inside v-repeat.
|
|
|
- * The components could have private state that needs
|
|
|
- * to be preserved across updates.
|
|
|
- * 2. We have transitions on the list, which requires
|
|
|
- * precise DOM re-positioning.
|
|
|
- */
|
|
|
-
|
|
|
- checkUpdateStrategy: function () {
|
|
|
- this.needDiff =
|
|
|
- this.asComponent ||
|
|
|
- this.el.hasAttribute(config.prefix + 'transition') ||
|
|
|
- this.template.querySelector('[' + config.prefix + 'component]')
|
|
|
- },
|
|
|
-
|
|
|
/**
|
|
|
* Update.
|
|
|
* This is called whenever the Array mutates.
|
|
|
@@ -6181,9 +6161,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
} else if (type === 'string') {
|
|
|
data = _.toArray(data)
|
|
|
}
|
|
|
- this.vms = this.needDiff
|
|
|
- ? this.diff(data, this.vms)
|
|
|
- : this.inplaceUpdate(data, this.vms)
|
|
|
+ this.vms = this.diff(data, this.vms)
|
|
|
// update v-ref
|
|
|
if (this.refID) {
|
|
|
this.vm.$[this.refID] = this.vms
|
|
|
@@ -6195,43 +6173,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- /**
|
|
|
- * Inplace update that maximally reuses existing vm
|
|
|
- * instances and DOM nodes by simply swapping data into
|
|
|
- * existing vms.
|
|
|
- *
|
|
|
- * @param {Array} data
|
|
|
- * @param {Array} oldVms
|
|
|
- * @return {Array}
|
|
|
- */
|
|
|
-
|
|
|
- inplaceUpdate: function (data, oldVms) {
|
|
|
- oldVms = oldVms || []
|
|
|
- var vms
|
|
|
- var dir = this
|
|
|
- var alias = dir.arg
|
|
|
- var converted = dir.converted
|
|
|
- if (data.length < oldVms.length) {
|
|
|
- oldVms.slice(data.length).forEach(function (vm) {
|
|
|
- vm.$destroy(true)
|
|
|
- })
|
|
|
- vms = oldVms.slice(0, data.length)
|
|
|
- overwrite(data, vms, alias, converted)
|
|
|
- } else if (data.length > oldVms.length) {
|
|
|
- var newVms = data.slice(oldVms.length).map(function (data, i) {
|
|
|
- var vm = dir.build(data, i + oldVms.length)
|
|
|
- vm.$before(dir.ref)
|
|
|
- return vm
|
|
|
- })
|
|
|
- overwrite(data.slice(0, oldVms.length), oldVms, alias, converted)
|
|
|
- vms = oldVms.concat(newVms)
|
|
|
- } else {
|
|
|
- overwrite(data, oldVms, alias, converted)
|
|
|
- vms = oldVms
|
|
|
- }
|
|
|
- return vms
|
|
|
- },
|
|
|
-
|
|
|
/**
|
|
|
* Diff, based on new data and old data, determine the
|
|
|
* minimum amount of DOM manipulations needed to make the
|
|
|
@@ -6440,9 +6381,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
var vm
|
|
|
while (i--) {
|
|
|
vm = this.vms[i]
|
|
|
- if (this.needDiff) {
|
|
|
- this.uncacheVm(vm)
|
|
|
- }
|
|
|
+ this.uncacheVm(vm)
|
|
|
vm.$destroy()
|
|
|
}
|
|
|
}
|
|
|
@@ -6615,35 +6554,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
return ret
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Helper function to overwrite new data Array on to
|
|
|
- * existing vms. Used in `inplaceUpdate`.
|
|
|
- *
|
|
|
- * @param {Array} arr
|
|
|
- * @param {Array} vms
|
|
|
- * @param {String|undefined} alias
|
|
|
- * @param {Boolean} converted
|
|
|
- */
|
|
|
-
|
|
|
- function overwrite (arr, vms, alias, converted) {
|
|
|
- var vm, data, raw
|
|
|
- for (var i = 0, l = arr.length; i < l; i++) {
|
|
|
- vm = vms[i]
|
|
|
- data = raw = arr[i]
|
|
|
- if (converted) {
|
|
|
- vm.$key = data.$key
|
|
|
- raw = data.$value
|
|
|
- }
|
|
|
- if (alias) {
|
|
|
- vm[alias] = raw
|
|
|
- } else if (!isObject(raw)) {
|
|
|
- vm.$value = raw
|
|
|
- } else {
|
|
|
- vm._setData(raw)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/***/ },
|
|
|
/* 45 */
|
|
|
/***/ function(module, exports, __webpack_require__) {
|