framework7-vue
Advanced tools
Comparing version 3.4.2 to 3.4.3
@@ -58,4 +58,9 @@ import Utils from '../utils/utils'; | ||
const state = (() => { | ||
const { | ||
value, | ||
defaultValue | ||
} = props; | ||
return { | ||
inputFocused: false | ||
inputFocused: false, | ||
currentInputValue: typeof value === 'undefined' ? defaultValue : value | ||
}; | ||
@@ -69,2 +74,21 @@ })(); | ||
computed: { | ||
inputWithValue() { | ||
const self = this; | ||
const { | ||
value, | ||
defaultValue | ||
} = self.props; | ||
const { | ||
currentInputValue | ||
} = self.state; | ||
return typeof value === 'undefined' ? defaultValue || defaultValue === 0 || currentInputValue : value || value === 0; | ||
}, | ||
props() { | ||
return __vueComponentProps(this); | ||
} | ||
}, | ||
render() { | ||
@@ -126,3 +150,3 @@ const _h = this.$createElement; | ||
'input-invalid': errorMessage && errorMessageForce, | ||
'input-with-value': typeof value === 'undefined' ? defaultValue || defaultValue === 0 : value || value === 0, | ||
'input-with-value': self.inputWithValue, | ||
'input-focused': self.state.inputFocused | ||
@@ -137,3 +161,3 @@ }); | ||
domProps: { | ||
value: needsValue ? value : undefined, | ||
value: needsValue ? value || self.state.currentInputValue : undefined, | ||
checked, | ||
@@ -254,6 +278,10 @@ disabled, | ||
const { | ||
type | ||
type, | ||
value | ||
} = self.props; | ||
if (type === 'range' || type === 'toggle') return; | ||
if (!self.$f7) return; | ||
self.setState({ | ||
currentInputValue: value | ||
}); | ||
self.updateInputOnDidUpdate = true; | ||
@@ -380,2 +408,5 @@ } | ||
this.dispatchEvent('input', event); | ||
this.setState({ | ||
currentInputValue: event.target.value | ||
}); | ||
}, | ||
@@ -409,9 +440,3 @@ | ||
}, | ||
computed: { | ||
props() { | ||
return __vueComponentProps(this); | ||
} | ||
} | ||
}; |
@@ -142,8 +142,8 @@ import Utils from '../utils/utils'; | ||
if (child.data && (typeof child.data.value === 'undefined' ? child.data.defaultValue || child.data.defaultValue === 0 : child.data.value || child.data.value === 0)) { | ||
hasInputValue = true; | ||
} else if (child.componentOptions && child.componentOptions.propsData && (typeof child.componentOptions.propsData.value === 'undefined' ? child.componentOptions.propsData.defaultValue || child.componentOptions.propsData.defaultValue === 0 : child.componentOptions.propsData.value || child.componentOptions.propsData.value === 0)) { | ||
hasInputValue = true; | ||
} else { | ||
hasInputValue = false; | ||
if (!hasInputValue) { | ||
if (child.data && (typeof child.data.value === 'undefined' ? child.data.defaultValue || child.data.defaultValue === 0 : child.data.value || child.data.value === 0)) { | ||
hasInputValue = true; | ||
} else if (child.componentOptions && child.componentOptions.propsData && (typeof child.componentOptions.propsData.value === 'undefined' ? child.componentOptions.propsData.defaultValue || child.componentOptions.propsData.defaultValue === 0 : child.componentOptions.propsData.value || child.componentOptions.propsData.value === 0)) { | ||
hasInputValue = true; | ||
} | ||
} | ||
@@ -311,2 +311,4 @@ } | ||
self.onBlurBound = self.onBlur.bind(self); | ||
self.onEmptyBound = self.onEmpty.bind(self); | ||
self.onNotEmptyBound = self.onNotEmpty.bind(self); | ||
}, | ||
@@ -346,2 +348,4 @@ | ||
el.addEventListener('blur', self.onBlurBound, true); | ||
el.addEventListener('input:empty', self.onEmptyBound); | ||
el.addEventListener('input:notempty', self.onNotEmptyBound); | ||
} | ||
@@ -417,2 +421,6 @@ | ||
} = self.$refs; | ||
el.removeEventListener('input:empty', self.onEmptyBound); | ||
el.removeEventListener('input:notempty', self.onNotEmptyBound); | ||
el.removeEventListener('focus', self.onFocusBound, true); | ||
el.removeEventListener('blur', self.onBlurBound, true); | ||
@@ -422,7 +430,2 @@ if (inputEl) { | ||
} | ||
if (self.state.hasInput) { | ||
el.removeEventListener('focus', self.onFocusBound, true); | ||
el.removeEventListener('blur', self.onBlurBound, true); | ||
} | ||
}, | ||
@@ -501,2 +504,14 @@ | ||
onEmpty() { | ||
this.setState({ | ||
hasInputValue: false | ||
}); | ||
}, | ||
onNotEmpty() { | ||
this.setState({ | ||
hasInputValue: true | ||
}); | ||
}, | ||
dispatchEvent(events, ...args) { | ||
@@ -503,0 +518,0 @@ __vueComponentDispatchEvent(this, events, ...args); |
@@ -27,3 +27,6 @@ import Utils from '../utils/utils'; | ||
maxHeight: Number, | ||
resizePage: Boolean, | ||
resizePage: { | ||
type: Boolean, | ||
default: true | ||
}, | ||
sendLink: String, | ||
@@ -30,0 +33,0 @@ value: [String, Number, Array], |
/** | ||
* Framework7 Vue 3.4.2 | ||
* Framework7 Vue 3.4.3 | ||
* Build full featured iOS & Android apps using Framework7 & Vue | ||
@@ -10,3 +10,3 @@ * http://framework7.io/vue/ | ||
* | ||
* Released on: October 12, 2018 | ||
* Released on: October 19, 2018 | ||
*/ | ||
@@ -235,2 +235,5 @@ import Vue from 'vue'; | ||
if ('vue' === 'vue') { | ||
if (self.$vnode && self.$vnode.data && self.$vnode.data.props && self.$vnode.data.props.f7route) { | ||
route = self.$vnode.data.props.f7route; | ||
} | ||
let parent = self; | ||
@@ -259,2 +262,5 @@ while (parent && !route) { | ||
if ('vue' === 'vue') { | ||
if (self.$vnode && self.$vnode.data && self.$vnode.data.props && self.$vnode.data.props.f7route) { | ||
router = self.$vnode.data.props.f7router; | ||
} | ||
let parent = self; | ||
@@ -261,0 +267,0 @@ while (parent && !router) { |
/** | ||
* Framework7 Vue 3.4.2 | ||
* Framework7 Vue 3.4.3 | ||
* Build full featured iOS & Android apps using Framework7 & Vue | ||
@@ -10,3 +10,3 @@ * http://framework7.io/vue/ | ||
* | ||
* Released on: October 12, 2018 | ||
* Released on: October 19, 2018 | ||
*/ | ||
@@ -13,0 +13,0 @@ |
{ | ||
"name": "framework7-vue", | ||
"version": "3.4.2", | ||
"version": "3.4.3", | ||
"description": "Build full featured iOS & Android apps using Framework7 & Vue", | ||
@@ -5,0 +5,0 @@ "main": "framework7-vue.js", |
@@ -60,2 +60,5 @@ import Vue from 'vue'; | ||
if ('vue' === 'vue') { | ||
if (self.$vnode && self.$vnode.data && self.$vnode.data.props && self.$vnode.data.props.f7route) { | ||
route = self.$vnode.data.props.f7route; | ||
} | ||
let parent = self; | ||
@@ -84,2 +87,5 @@ while (parent && !route) { | ||
if ('vue' === 'vue') { | ||
if (self.$vnode && self.$vnode.data && self.$vnode.data.props && self.$vnode.data.props.f7route) { | ||
router = self.$vnode.data.props.f7router; | ||
} | ||
let parent = self; | ||
@@ -86,0 +92,0 @@ while (parent && !router) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1223380
19861