You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by da...@apache.org on 2017/08/03 13:43:37 UTC
[01/12] incubator-weex git commit: * [html5] add contentsize return
on getComponentRect function
Repository: incubator-weex
Updated Branches:
refs/heads/0.16-dev ec4317dca -> cf40471e6
* [html5] add contentsize return on getComponentRect function
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/d601088d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/d601088d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/d601088d
Branch: refs/heads/0.16-dev
Commit: d601088dece2c707cdb0a2d32e37d2bf9428c389
Parents: 5951404
Author: erha19 <fa...@gmail.com>
Authored: Mon Jul 31 16:23:41 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Mon Jul 31 16:23:41 2017 +0800
----------------------------------------------------------------------
html5/render/vue/modules/dom.js | 12 +++++++++++-
html5/test/render/vue/modules/dom.js | 14 ++++++++++++++
2 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d601088d/html5/render/vue/modules/dom.js
----------------------------------------------------------------------
diff --git a/html5/render/vue/modules/dom.js b/html5/render/vue/modules/dom.js
index 92d65d9..323d12e 100644
--- a/html5/render/vue/modules/dom.js
+++ b/html5/render/vue/modules/dom.js
@@ -182,7 +182,9 @@ const dom = {
function recalc (rect) {
const res = {}
rectKeys.forEach(key => {
- res[key] = rect[key] / scale
+ if (rect[key]) {
+ res[key] = rect[key] / scale
+ }
})
return res
}
@@ -197,10 +199,18 @@ const dom = {
right: document.documentElement.clientWidth,
bottom: document.documentElement.clientHeight
})
+ info.contentsize = recalc({
+ width: document.documentElement.offsetWidth,
+ height: document.documentElement.offsetHeight
+ })
}
else if (vnode && vnode.$el) {
info.result = true
info.size = recalc(vnode.$el.getBoundingClientRect())
+ info.contentsize = recalc({
+ width: vnode.$el.offsetWidth,
+ height: vnode.$el.offsetHeight
+ })
}
const message = info.result ? info : {
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d601088d/html5/test/render/vue/modules/dom.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/modules/dom.js b/html5/test/render/vue/modules/dom.js
index 5df77ba..55d8d90 100644
--- a/html5/test/render/vue/modules/dom.js
+++ b/html5/test/render/vue/modules/dom.js
@@ -69,6 +69,7 @@ describe('dom module', () => {
node.style.width = '100px'
document.body.appendChild(node)
expect(getComponentRect).to.be.a('function')
+ // while node is an element
message = getComponentRect([vnode], callback)
expect(message.result).to.be.true
expect(message.size.width).to.be.equal(recalc({
@@ -77,7 +78,14 @@ describe('dom module', () => {
expect(message.size.height).to.be.equal(recalc({
height: 100
}).height)
+ expect(message.contentsize.width).to.be.equal(recalc({
+ width: 100
+ }).width)
+ expect(message.contentsize.height).to.be.equal(recalc({
+ height: 100
+ }).height)
expect(callback.callCount).to.be.equal(1)
+ // while node is a viewport
message = getComponentRect('viewport', callback)
expect(message.result).to.be.true
expect(message.size.width).to.be.equal(recalc({
@@ -92,6 +100,12 @@ describe('dom module', () => {
expect(message.size.bottom).to.be.equal(recalc({
bottom: document.documentElement.clientHeight
}).bottom)
+ expect(message.contentsize.width).to.be.equal(recalc({
+ bottom: document.documentElement.offsetWidth
+ }).bottom)
+ expect(message.contentsize.height).to.be.equal(recalc({
+ bottom: document.documentElement.offsetHeight
+ }).bottom)
expect(callback.callCount).to.be.equal(2)
document.body.removeChild(node)
})
[10/12] incubator-weex git commit: * [html5] remove coverage of
component.js
Posted by da...@apache.org.
* [html5] remove coverage of component.js
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/10cd633e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/10cd633e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/10cd633e
Branch: refs/heads/0.16-dev
Commit: 10cd633e624c0f43ce175995be1c2cd565e6669a
Parents: 04a3944
Author: erha19 <fa...@gmail.com>
Authored: Wed Aug 2 15:50:15 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Wed Aug 2 15:50:15 2017 +0800
----------------------------------------------------------------------
build/karma.vue.conf.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/10cd633e/build/karma.vue.conf.js
----------------------------------------------------------------------
diff --git a/build/karma.vue.conf.js b/build/karma.vue.conf.js
index 31dd819..6220025 100644
--- a/build/karma.vue.conf.js
+++ b/build/karma.vue.conf.js
@@ -92,7 +92,7 @@ module.exports = function (config) {
browserDisconnectTimeout:10000,
preprocessors: {
'../html5/test/**/*.js': ['rollup'],
- '../html5/test/**/!(components|examples|core)/*.js': ['rollup', 'coverage']
+ '../html5/test/**/!(components|examples|core)/!(component).js': ['rollup', 'coverage']
},
rollupPreprocessor: rollupConfig,
[06/12] incubator-weex git commit: * [html5] bug fix for dom
getComponentRect
Posted by da...@apache.org.
* [html5] bug fix for dom getComponentRect
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/dbccd895
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/dbccd895
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/dbccd895
Branch: refs/heads/0.16-dev
Commit: dbccd895a28223c9bf3c4682df36a2c698289409
Parents: 8df4ccb
Author: erha19 <fa...@gmail.com>
Authored: Wed Aug 2 10:53:00 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Wed Aug 2 10:53:00 2017 +0800
----------------------------------------------------------------------
examples/vue/components/scroller.vue | 9 +-
.../vue/components/scrollable/scroller.js | 1 -
html5/render/vue/modules/dom.js | 107 ++++++++-----------
3 files changed, 51 insertions(+), 66 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/dbccd895/examples/vue/components/scroller.vue
----------------------------------------------------------------------
diff --git a/examples/vue/components/scroller.vue b/examples/vue/components/scroller.vue
index f829120..8336ea0 100644
--- a/examples/vue/components/scroller.vue
+++ b/examples/vue/components/scroller.vue
@@ -1,5 +1,5 @@
<template>
- <scroller class="list" append="tree">
+ <scroller class="list" append="tree" ref="scroller">
<refresh class="refresh-view" :display="refresh_display" @refresh="onrefresh" @pullingdown="pullingdown">
<img id="roate" ref="roate" src="http://gw.alicdn.com/bao/uploaded/TB1xDrVNFXXXXbEXFXXXXXXXXXX-48-48.png" style="width: 50px;height: 50px;"></img>
</refresh>
@@ -74,7 +74,14 @@
</style>
<script>
+ const dom = weex.requireModule('dom')
+ console.log(dom)
module.exports = {
+ mounted () {
+ const result = dom.getComponentRect(this.$refs.scroller, option => {
+ console.log('getComponentRect:', option)
+ })
+ },
methods: {
onrefresh: function(e) {
var self = this;
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/dbccd895/html5/render/vue/components/scrollable/scroller.js
----------------------------------------------------------------------
diff --git a/html5/render/vue/components/scrollable/scroller.js b/html5/render/vue/components/scrollable/scroller.js
index 4fe998c..56e83d4 100644
--- a/html5/render/vue/components/scrollable/scroller.js
+++ b/html5/render/vue/components/scrollable/scroller.js
@@ -43,7 +43,6 @@ function getScroller (weex) {
},
computed: {
wrapperClass () {
- console.log(this.scrollable)
const classArray = ['weex-scroller', 'weex-scroller-wrapper', 'weex-ct']
if (this.scrollDirection === 'horizontal') {
classArray.push('weex-scroller-horizontal')
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/dbccd895/html5/render/vue/modules/dom.js
----------------------------------------------------------------------
diff --git a/html5/render/vue/modules/dom.js b/html5/render/vue/modules/dom.js
index 7854150..5afa660 100644
--- a/html5/render/vue/modules/dom.js
+++ b/html5/render/vue/modules/dom.js
@@ -17,14 +17,11 @@
* under the License.
*/
import config from '../config'
-
const utils = {}
function getParentScroller (vnode) {
if (!vnode) return null
- const vm = vnode.$el
- ? vnode : vnode.elm
- ? vnode.componentInstance || vnode.context : null
+ const vm = vnode.$el ? vnode : vnode.elm ? vnode.componentInstance || vnode.context : null
if (!vm) return null
const type = vm.$el && vm.$el.getAttribute('weex-type')
if (config.scrollableTypes.indexOf(type) > -1) {
@@ -34,15 +31,13 @@ function getParentScroller (vnode) {
}
function now () {
- const now = window.performance && window.performance.now
- ? window.performance.now.bind(window.performance) : Date.now
+ const now = window.performance && window.performance.now ? window.performance.now.bind(window.performance) : Date.now
return now()
}
function scrollElement (dSuffix, position) {
this[`scroll${dSuffix}`] = position
}
-
/**
* self invoked function that, given a context, steps through scrolling
* @method step
@@ -51,32 +46,25 @@ function scrollElement (dSuffix, position) {
function step (context) {
// call method again on next available frame
context.frame = window.requestAnimationFrame(step.bind(window, context))
-
const time = now()
let elapsed = (time - context.startTime) / 468
-
- // avoid elapsed times higher than one
+ // avoid elapsed times higher than one
elapsed = elapsed > 1 ? 1 : elapsed
-
- // apply easing to elapsed time
+ // apply easing to elapsed time
const value = ease(elapsed)
-
const currentPosition = context.startPosition + (context.position - context.startPosition) * value
-
context.method.call(context.scrollable, context.dSuffix, currentPosition)
-
- // return when end points have been reached
- /**
- * NOTE: should use ~~ to parse position number into integer. Otherwise
- * this two float numbers maybe have a slicely little difference, which
- * will cause this function never to stop.
- */
+ // return when end points have been reached
+ /**
+ * NOTE: should use ~~ to parse position number into integer. Otherwise
+ * this two float numbers maybe have a slicely little difference, which
+ * will cause this function never to stop.
+ */
if (~~currentPosition === ~~context.position) {
window.cancelAnimationFrame(context.frame)
return
}
}
-
/**
* returns result of applying ease math function to a number
* @method ease
@@ -86,7 +74,6 @@ function step (context) {
function ease (k) {
return 0.5 * (1 - Math.cos(Math.PI * k))
}
-
const dom = {
/**
* scrollToElement
@@ -95,21 +82,20 @@ const dom = {
* ps: scroll-to has 'ease' and 'duration'(ms) as options.
*/
scrollToElement: function (vnode, options) {
- const { isArray } = utils
+ const {
+ isArray
+ } = utils
if (isArray(vnode)) {
if (process.env.NODE_ENV === 'development') {
console.warn('[vue-render] the ref passed to animation.transitionOnce is a array.')
}
vnode = vnode[0]
}
-
const scroller = getParentScroller(vnode)
const scrollDirection = scroller && scroller.scrollDirection || 'vertical'
-
const isWindow = !scroller
const ct = isWindow ? document.body : scroller.$el
const el = vnode.$el || vnode.elm
-
if (ct && el) {
// if it's a list, then the listVnode.scrollDirection is undefined. just
// assum it is the default value 'vertical'.
@@ -117,38 +103,28 @@ const dom = {
horizontal: 'Left',
vertical: 'Top'
})[scrollDirection]
-
const ctRect = ct.getBoundingClientRect()
let elRect = el.getBoundingClientRect()
-
- /**
- * if it's a waterfall, and you want to scroll to a header, then just
- * scroll to the top.
- */
- if (scroller
- && scroller.weexType === 'waterfall'
- && scroller._headers
- && scroller._headers.indexOf(vnode.$vnode || vnode) > -1) {
+ /**
+ * if it's a waterfall, and you want to scroll to a header, then just
+ * scroll to the top.
+ */
+ if (scroller && scroller.weexType === 'waterfall' && scroller._headers && scroller._headers.indexOf(vnode.$vnode || vnode) > -1) {
// it's in waterfall. just scroll to the top.
elRect = ct.firstElementChild.getBoundingClientRect()
}
-
const dir = dSuffix.toLowerCase()
let offset = (isWindow ? 0 : ct[`scroll${dSuffix}`]) + elRect[dir] - ctRect[dir]
-
if (options) {
offset += options.offset && options.offset * weex.config.env.scale || 0
- // offset *= weex.config.env.scale /* adapt offset to different screen scales. */
+ // offset *= weex.config.env.scale /* adapt offset to different screen scales. */
}
else if (process.env.NODE_ENV === 'development') {
- console.warn('[Vue Render] The second parameter of "scrollToElement" is required, '
- + 'otherwise it may not works well on native.')
+ console.warn('[Vue Render] The second parameter of "scrollToElement" is required, ' + 'otherwise it may not works well on native.')
}
-
if (options && options.animated === false) {
return scrollElement.call(ct, dSuffix, offset)
}
-
step({
scrollable: ct,
startTime: now(),
@@ -160,23 +136,25 @@ const dom = {
})
}
},
-
/**
* getComponentRect
* @param {String} vnode
* @param {Function} callback
*/
getComponentRect: function (vnode, callback) {
- const { isArray } = utils
+ const {
+ isArray
+ } = utils
if (isArray(vnode)) {
if (process.env.NODE_ENV === 'development') {
console.warn('[vue-render] the ref passed to animation.transitionOnce is a array.')
}
vnode = vnode[0]
}
-
const scale = window.weex.config.env.scale
- const info = { result: false }
+ const info = {
+ result: false
+ }
const rectKeys = ['width', 'height', 'top', 'bottom', 'left', 'right']
function recalc (rect) {
@@ -188,7 +166,6 @@ const dom = {
})
return res
}
-
if (vnode && vnode === 'viewport') {
info.result = true
info.size = recalc({
@@ -207,28 +184,36 @@ const dom = {
else if (vnode && vnode.$el) {
info.result = true
info.size = recalc(vnode.$el.getBoundingClientRect())
- info.contentSize = recalc({
- width: vnode.$el.offsetWidth,
- height: vnode.$el.offsetHeight
- })
+ if (vnode.$refs.inner) {
+ info.contentSize = recalc({
+ width: vnode.$refs.inner.offsetWidth,
+ height: vnode.$refs.inner.offsetHeight
+ })
+ }
+ else {
+ info.contentSize = recalc({
+ width: vnode.$el.offsetWidth,
+ height: vnode.$el.offsetHeight
+ })
+ }
}
-
const message = info.result ? info : {
result: false,
errMsg: 'Illegal parameter'
}
-
callback && callback(message)
return message
},
-
/**
* for adding fontFace
* @param {string} key fontFace
* @param {object} styles rules
*/
addRule: function (key, styles) {
- const { camelToKebab, appendCss } = utils
+ const {
+ camelToKebab,
+ appendCss
+ } = utils
key = camelToKebab(key)
let stylesText = ''
for (const k in styles) {
@@ -240,16 +225,10 @@ const dom = {
appendCss(styleText, 'dom-added-rules')
}
}
-
export default {
init (weex) {
const extendKeys = weex.utils.extendKeys
- extendKeys(utils, weex.utils, [
- 'camelToKebab',
- 'appendCss',
- 'isArray'
- ])
-
+ extendKeys(utils, weex.utils, ['camelToKebab', 'appendCss', 'isArray'])
weex.registerModule('dom', dom)
}
}
[11/12] incubator-weex git commit: * [html5] add notes for vue.html
Posted by da...@apache.org.
* [html5] add notes for vue.html
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/6be9c36a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/6be9c36a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/6be9c36a
Branch: refs/heads/0.16-dev
Commit: 6be9c36af898da42b476324f9f1e209f56194902
Parents: 10cd633
Author: erha19 <fa...@gmail.com>
Authored: Thu Aug 3 15:53:59 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Thu Aug 3 15:53:59 2017 +0800
----------------------------------------------------------------------
vue.html | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/6be9c36a/vue.html
----------------------------------------------------------------------
diff --git a/vue.html b/vue.html
index 3594474..aa8b353 100644
--- a/vue.html
+++ b/vue.html
@@ -53,7 +53,9 @@
<!--<script src="./dist/render.vue.js"></script>-->
<!--<script src="./dist/render.vue.min.js"></script>-->
<!--<script src="./packages/weex-vue-render/dist/index.min.js"></script>-->
- <script src="./node_modules/@weex-project/weex-picker/js/build/index.js"></script>
+
+ <!--This line is only used to run weex-picker example,you can remove this line when you do not need weex-picker module-->
+ <script src="./node_modules/@weex-project/weex-picker/js/build/index.js"></script>
</head>
<body>
<div id="root"></div>
[03/12] incubator-weex git commit: * [html5] update contentsize to
contentSize
Posted by da...@apache.org.
* [html5] update contentsize to contentSize
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/1cbbfe2d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/1cbbfe2d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/1cbbfe2d
Branch: refs/heads/0.16-dev
Commit: 1cbbfe2da58e826aef2bba4a19c18ecffe054e23
Parents: b0520a8
Author: erha19 <fa...@gmail.com>
Authored: Mon Jul 31 16:38:50 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Mon Jul 31 16:38:50 2017 +0800
----------------------------------------------------------------------
html5/render/vue/modules/dom.js | 4 ++--
html5/test/render/vue/modules/dom.js | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1cbbfe2d/html5/render/vue/modules/dom.js
----------------------------------------------------------------------
diff --git a/html5/render/vue/modules/dom.js b/html5/render/vue/modules/dom.js
index 323d12e..7854150 100644
--- a/html5/render/vue/modules/dom.js
+++ b/html5/render/vue/modules/dom.js
@@ -199,7 +199,7 @@ const dom = {
right: document.documentElement.clientWidth,
bottom: document.documentElement.clientHeight
})
- info.contentsize = recalc({
+ info.contentSize = recalc({
width: document.documentElement.offsetWidth,
height: document.documentElement.offsetHeight
})
@@ -207,7 +207,7 @@ const dom = {
else if (vnode && vnode.$el) {
info.result = true
info.size = recalc(vnode.$el.getBoundingClientRect())
- info.contentsize = recalc({
+ info.contentSize = recalc({
width: vnode.$el.offsetWidth,
height: vnode.$el.offsetHeight
})
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1cbbfe2d/html5/test/render/vue/modules/dom.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/modules/dom.js b/html5/test/render/vue/modules/dom.js
index 55d8d90..aa7da0f 100644
--- a/html5/test/render/vue/modules/dom.js
+++ b/html5/test/render/vue/modules/dom.js
@@ -78,10 +78,10 @@ describe('dom module', () => {
expect(message.size.height).to.be.equal(recalc({
height: 100
}).height)
- expect(message.contentsize.width).to.be.equal(recalc({
+ expect(message.contentSize.width).to.be.equal(recalc({
width: 100
}).width)
- expect(message.contentsize.height).to.be.equal(recalc({
+ expect(message.contentSize.height).to.be.equal(recalc({
height: 100
}).height)
expect(callback.callCount).to.be.equal(1)
@@ -100,10 +100,10 @@ describe('dom module', () => {
expect(message.size.bottom).to.be.equal(recalc({
bottom: document.documentElement.clientHeight
}).bottom)
- expect(message.contentsize.width).to.be.equal(recalc({
+ expect(message.contentSize.width).to.be.equal(recalc({
bottom: document.documentElement.offsetWidth
}).bottom)
- expect(message.contentsize.height).to.be.equal(recalc({
+ expect(message.contentSize.height).to.be.equal(recalc({
bottom: document.documentElement.offsetHeight
}).bottom)
expect(callback.callCount).to.be.equal(2)
[12/12] incubator-weex git commit: Merge branch '0.16-dev' of
https://github.com/erha19/incubator-weex into 0.16-dev
Posted by da...@apache.org.
Merge branch '0.16-dev' of https://github.com/erha19/incubator-weex into 0.16-dev
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/cf40471e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/cf40471e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/cf40471e
Branch: refs/heads/0.16-dev
Commit: cf40471e6bfe5242f98f0058c7a8e6beb4c537e3
Parents: ec4317d 6be9c36
Author: MrRaindrop <te...@gmail.com>
Authored: Thu Aug 3 21:41:16 2017 +0800
Committer: MrRaindrop <te...@gmail.com>
Committed: Thu Aug 3 21:41:16 2017 +0800
----------------------------------------------------------------------
build/karma.vue.conf.js | 2 +-
examples/vue/components/scroller.vue | 9 +-
examples/vue/modules/picker.vue | 149 ++++++++-----------
.../vue/components/scrollable/scroller.js | 8 +-
.../render/vue/components/scrollable/style.css | 5 +
html5/render/vue/modules/dom.js | 97 ++++++------
html5/test/render/vue/modules/dom.js | 17 ++-
package.json | 1 +
vue.html | 3 +
9 files changed, 144 insertions(+), 147 deletions(-)
----------------------------------------------------------------------
[07/12] incubator-weex git commit: * [html5] fix formate for picker
example
Posted by da...@apache.org.
* [html5] fix formate for picker example
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/8f65e4b5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/8f65e4b5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/8f65e4b5
Branch: refs/heads/0.16-dev
Commit: 8f65e4b561eb1e032d9a41900d095ca472deefdd
Parents: dbccd89
Author: erha19 <fa...@gmail.com>
Authored: Wed Aug 2 10:53:19 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Wed Aug 2 10:53:19 2017 +0800
----------------------------------------------------------------------
examples/vue/modules/picker.vue | 113 +++++++++++++++++------------------
1 file changed, 56 insertions(+), 57 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f65e4b5/examples/vue/modules/picker.vue
----------------------------------------------------------------------
diff --git a/examples/vue/modules/picker.vue b/examples/vue/modules/picker.vue
index 7ee4b60..a15ab92 100644
--- a/examples/vue/modules/picker.vue
+++ b/examples/vue/modules/picker.vue
@@ -1,65 +1,64 @@
<template>
- <div class="conatiner">
- <div style="background-color: #286090">
- <text class="title" style="height: 80px ;padding: 20px;color: white">picker</text>
- </div>
- <div @click="normalpick" style="margin: 20px;padding:20px;background-color:#1ba1e2;color:#fff;"><text style="color:#fff">normalpick{{normalpickData}}</text></div>
- <div @click="pickDate" style="margin: 20px;padding:20px;background-color:#1ba1e2;color:#fff;"><text style="color:#fff">pickDate{{pickDateData}}</text></div>
- <div @click="pickTime" style="margin: 20px;padding:20px;background-color:#1ba1e2;color:#fff;"><text style="color:#fff">pickTime{{pickTimeData}}</text></div>
- </div>
+ <div class="conatiner">
+ <div style="background-color: #286090">
+ <text class="title" style="height: 80px ;padding: 20px;color: white">picker</text>
+ </div>
+ <div @click="normalpick" style="margin: 20px;padding:20px;background-color:#1ba1e2;color:#fff;"><text style="color:#fff">normalpick{{normalpickData}}</text></div>
+ <div @click="pickDate" style="margin: 20px;padding:20px;background-color:#1ba1e2;color:#fff;"><text style="color:#fff">pickDate{{pickDateData}}</text></div>
+ <div @click="pickTime" style="margin: 20px;padding:20px;background-color:#1ba1e2;color:#fff;"><text style="color:#fff">pickTime{{pickTimeData}}</text></div>
+ </div>
</template>
<style>
- .container {
- flex: 1;
- }
+ .container {
+ flex: 1;
+ }
</style>
<script>
- const picker = weex.requireModule('picker');
- module.exports = {
- data: {
- normalpickData:'',
- pickDateData:'',
- pickTimeData:''
- },
- methods: {
- normalpick: function() {
- var self = this;
- picker.pick({
- height: '300px',
- items: [1, 2, 3, 4],
- }, function(ret) {
- var result = ret.result;
- if (result == 'success') {
- self.normalpickData = ret.data;
- }
- })
-
- },
- pickDate: function(e) {
- var self = this;
- picker.pickDate({
- 'value': '2016-12-20',
- 'max': '2016-12-30',
- 'min': '2014-12-30',
- }, function(ret) {
- var result = ret.result;
- if (result == 'success') {
- self.pickDateData = ret.data;
- }
- });
- },
- pickTime:function(){
- var self = this;
- picker.pickTime({
- }, function(ret) {
- var result = ret.result;
- if (result == 'success') {
- self.pickTimeData = ret.data;
- }
- });
- }
- }
- }
+ const picker = weex.requireModule('picker');
+ module.exports = {
+ data: {
+ normalpickData:'',
+ pickDateData:'',
+ pickTimeData:''
+ },
+ methods: {
+ normalpick: function() {
+ var self = this;
+ picker.pick({
+ height: '300px',
+ items: [1, 2, 3, 4],
+ }, function(ret) {
+ var result = ret.result;
+ if (result == 'success') {
+ self.normalpickData = ret.data;
+ }
+ })
+ },
+ pickDate: function(e) {
+ var self = this;
+ picker.pickDate({
+ 'value': '2016-12-20',
+ 'max': '2016-12-30',
+ 'min': '2014-12-30',
+ }, function(ret) {
+ var result = ret.result;
+ if (result == 'success') {
+ self.pickDateData = ret.data;
+ }
+ });
+ },
+ pickTime:function(){
+ var self = this;
+ picker.pickTime({
+ }, function(ret) {
+ var result = ret.result;
+ if (result == 'success') {
+ self.pickTimeData = ret.data;
+ }
+ });
+ }
+ }
+ }
</script>
\ No newline at end of file
[04/12] incubator-weex git commit: * [html5] update picker demo
Posted by da...@apache.org.
* [html5] update picker demo
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/7a06b88b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/7a06b88b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/7a06b88b
Branch: refs/heads/0.16-dev
Commit: 7a06b88b27bdf42f0a60d9cfc46c6646fd87a8f6
Parents: 1cbbfe2
Author: erha19 <fa...@gmail.com>
Authored: Mon Jul 31 17:33:35 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Mon Jul 31 17:33:35 2017 +0800
----------------------------------------------------------------------
examples/vue/modules/picker.vue | 149 ++++++++++++++---------------------
package.json | 1 +
vue.html | 1 +
3 files changed, 61 insertions(+), 90 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/7a06b88b/examples/vue/modules/picker.vue
----------------------------------------------------------------------
diff --git a/examples/vue/modules/picker.vue b/examples/vue/modules/picker.vue
index 0750fc3..3233073 100644
--- a/examples/vue/modules/picker.vue
+++ b/examples/vue/modules/picker.vue
@@ -1,97 +1,66 @@
<template>
- <scroller>
- <div title="picker module" type="primary">
- <text style="margin-bottom: 20px;">pick value: {{value}}</text>
- <text type="primary" class="button" @click="pick" value="single pick" style="margin-bottom: 20px;"></text>
- <text type="primary" class="button" @click="pickDate" value="pickDate" style="margin-bottom: 20px;"></text>
- <text type="primary" class="button" @click="pickTime" value="pickTime"></text>
+ <div class="conatiner">
+ <div style="background-color: #286090">
+ <text class="title" style="height: 80px ;padding: 20px;color: white">picker</text>
</div>
-
- <div title="input component" type="primary">
- <text>onchange: {{txtChange}}</text>
- <input type="date" placeholder="select date" class="input" autofocus="false" value="" @change="onchange" max="2029-11-28" min="2015-11-28"/>
- <input type="time" placeholder="select time" class="input" autofocus="false" value="" @change="onchange"/>
- </div>
- </scroller>
+ <div @click="normalpick" style="margin: 20px;padding:20px;background-color:#1ba1e2;color:#fff;"><text style="color:#fff">normalpick{{normalpickData}}</text></div>
+ <div @click="pickDate" style="margin: 20px;padding:20px;background-color:#1ba1e2;color:#fff;"><text style="color:#fff">pickDate{{pickDateData}}</text></div>
+ <div @click="pickTime" style="margin: 20px;padding:20px;background-color:#1ba1e2;color:#fff;"><text style="color:#fff">pickTime{{pickTimeData}}</text></div>
+ </div>
</template>
-<style scoped>
- .input {
- font-size: 60px;
- height: 80px;
- width: 400px;
- }
- .button {
- font-size: 36;
- width: 200;
- color: #41B883;
- text-align: center;
- padding-top: 10;
- padding-bottom: 10;
- border-width: 2;
- border-style: solid;
- margin-right: 20;
- border-color: rgb(162, 217, 192);
- background-color: rgba(162, 217, 192, 0.2);
- }
+<style>
+ .container {
+ flex: 1;
+ }
</style>
<script>
- module.exports = {
-
- data: function () {
- return {
- value: '',
- index: '',
- txtChange: ''
- };
- },
- methods: {
- pick: function () {
- var picker = require('@weex-module/picker');
- var items = new Array("Saab", "Volvo", "BMW");
- var self = this;
- picker.pick({
- 'items': items,
- 'index': self.index
- }, function (ret) {
- var result = ret.result;
- if (result == 'success') {
- self.value = items[ret.data];
- self.index = ret.data;
- }
- });
- },
- pickDate: function () {
- var picker = require('@weex-module/picker');
- var self = this;
- picker.pickDate({
- 'value': '2016-11-28',
- 'max': '2029-11-28',
- 'min': '2015-11-28'
- }, function (ret) {
- var result = ret.result;
- if (result == 'success') {
- self.value = ret.data;
- }
- });
- },
- pickTime: function () {
- var picker = require('@weex-module/picker');
- var self = this;
- picker.pickTime({
- 'value': '19:24'
- }, function (ret) {
- var result = ret.result;
- if (result == 'success') {
- self.value = ret.data;
- }
- });
- },
- onchange: function (event) {
- this.txtChange = event.value;
- console.log('onchange', event.value);
- }
- }
- };
-</script>
+ const picker = weex.requireModule('picker');
+ module.exports = {
+ data: {
+ normalpickData:'',
+ pickDateData:'',
+ pickTimeData:''
+ },
+ methods: {
+ normalpick: function() {
+ var self = this;
+ picker.pick({
+ height: '300px',
+ items: [1, 2, 3, 4],
+ }, function(ret) {
+ var result = ret.result;
+ if (result == 'success') {
+ self.normalpickData = ret.data;
+ }
+ })
+
+ },
+ pickDate: function(e) {
+ var self = this;
+ picker.pickDate({
+ 'value': '2016-12-20',
+ 'max': '2016-12-30',
+ 'min': '2014-12-30',
+ }, function(ret) {
+ var result = ret.result;
+ if (result == 'success') {
+ self.pickDateData = ret.data;
+ }
+ });
+ },
+ pickTime:function(){
+ var self = this;
+ picker.pickTime({
+ height: '300px'
+ }, function(ret) {
+ var result = ret.result;
+ if (result == 'success') {
+ self.pickTimeData = ret.data;
+ }
+ });
+ }
+ }
+ }
+</script>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/7a06b88b/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index e76c35b..5716af9 100644
--- a/package.json
+++ b/package.json
@@ -106,6 +106,7 @@
"weex-styler": "0.1.9"
},
"devDependencies": {
+ "@weex-project/weex-picker": "^0.2.2",
"babel-core": "^6.17.0",
"babel-eslint": "^7.2.1",
"babel-istanbul": "^0.11.0",
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/7a06b88b/vue.html
----------------------------------------------------------------------
diff --git a/vue.html b/vue.html
index bccdd30..3594474 100644
--- a/vue.html
+++ b/vue.html
@@ -53,6 +53,7 @@
<!--<script src="./dist/render.vue.js"></script>-->
<!--<script src="./dist/render.vue.min.js"></script>-->
<!--<script src="./packages/weex-vue-render/dist/index.min.js"></script>-->
+ <script src="./node_modules/@weex-project/weex-picker/js/build/index.js"></script>
</head>
<body>
<div id="root"></div>
[08/12] incubator-weex git commit: * [html5] fix code formate in
dom.js
Posted by da...@apache.org.
* [html5] fix code formate in dom.js
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/3a121003
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/3a121003
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/3a121003
Branch: refs/heads/0.16-dev
Commit: 3a121003090c24de716398fcf2d926247ae24593
Parents: 8f65e4b
Author: erha19 <fa...@gmail.com>
Authored: Wed Aug 2 15:37:43 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Wed Aug 2 15:37:43 2017 +0800
----------------------------------------------------------------------
html5/render/vue/modules/dom.js | 36 ++++++++++++++++++++----------------
1 file changed, 20 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/3a121003/html5/render/vue/modules/dom.js
----------------------------------------------------------------------
diff --git a/html5/render/vue/modules/dom.js b/html5/render/vue/modules/dom.js
index 5afa660..035443d 100644
--- a/html5/render/vue/modules/dom.js
+++ b/html5/render/vue/modules/dom.js
@@ -21,7 +21,9 @@ const utils = {}
function getParentScroller (vnode) {
if (!vnode) return null
- const vm = vnode.$el ? vnode : vnode.elm ? vnode.componentInstance || vnode.context : null
+ const vm = vnode.$el
+ ? vnode : vnode.elm
+ ? vnode.componentInstance || vnode.context : null
if (!vm) return null
const type = vm.$el && vm.$el.getAttribute('weex-type')
if (config.scrollableTypes.indexOf(type) > -1) {
@@ -31,7 +33,8 @@ function getParentScroller (vnode) {
}
function now () {
- const now = window.performance && window.performance.now ? window.performance.now.bind(window.performance) : Date.now
+ const now = window.performance && window.performance.now
+ ? window.performance.now.bind(window.performance) : Date.now
return now()
}
@@ -48,18 +51,18 @@ function step (context) {
context.frame = window.requestAnimationFrame(step.bind(window, context))
const time = now()
let elapsed = (time - context.startTime) / 468
- // avoid elapsed times higher than one
+ // avoid elapsed times higher than one
elapsed = elapsed > 1 ? 1 : elapsed
- // apply easing to elapsed time
+ // apply easing to elapsed time
const value = ease(elapsed)
const currentPosition = context.startPosition + (context.position - context.startPosition) * value
context.method.call(context.scrollable, context.dSuffix, currentPosition)
- // return when end points have been reached
- /**
- * NOTE: should use ~~ to parse position number into integer. Otherwise
- * this two float numbers maybe have a slicely little difference, which
- * will cause this function never to stop.
- */
+ // return when end points have been reached
+ /**
+ * NOTE: should use ~~ to parse position number into integer. Otherwise
+ * this two float numbers maybe have a slicely little difference, which
+ * will cause this function never to stop.
+ */
if (~~currentPosition === ~~context.position) {
window.cancelAnimationFrame(context.frame)
return
@@ -105,10 +108,10 @@ const dom = {
})[scrollDirection]
const ctRect = ct.getBoundingClientRect()
let elRect = el.getBoundingClientRect()
- /**
- * if it's a waterfall, and you want to scroll to a header, then just
- * scroll to the top.
- */
+ /**
+ * if it's a waterfall, and you want to scroll to a header, then just
+ * scroll to the top.
+ */
if (scroller && scroller.weexType === 'waterfall' && scroller._headers && scroller._headers.indexOf(vnode.$vnode || vnode) > -1) {
// it's in waterfall. just scroll to the top.
elRect = ct.firstElementChild.getBoundingClientRect()
@@ -117,10 +120,11 @@ const dom = {
let offset = (isWindow ? 0 : ct[`scroll${dSuffix}`]) + elRect[dir] - ctRect[dir]
if (options) {
offset += options.offset && options.offset * weex.config.env.scale || 0
- // offset *= weex.config.env.scale /* adapt offset to different screen scales. */
+ // offset *= weex.config.env.scale /* adapt offset to different screen scales. */
}
else if (process.env.NODE_ENV === 'development') {
- console.warn('[Vue Render] The second parameter of "scrollToElement" is required, ' + 'otherwise it may not works well on native.')
+ console.warn('[Vue Render] The second parameter of "scrollToElement" is required, '
+ + 'otherwise it may not works well on native.')
}
if (options && options.animated === false) {
return scrollElement.call(ct, dSuffix, offset)
[05/12] incubator-weex git commit: * [html5] update weex-picker
version
Posted by da...@apache.org.
* [html5] update weex-picker version
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/8df4ccb3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/8df4ccb3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/8df4ccb3
Branch: refs/heads/0.16-dev
Commit: 8df4ccb3939eece9c21833aba2ffc9999810f80d
Parents: 7a06b88
Author: erha19 <fa...@gmail.com>
Authored: Mon Jul 31 19:10:28 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Mon Jul 31 19:10:28 2017 +0800
----------------------------------------------------------------------
examples/vue/modules/picker.vue | 1 -
package.json | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8df4ccb3/examples/vue/modules/picker.vue
----------------------------------------------------------------------
diff --git a/examples/vue/modules/picker.vue b/examples/vue/modules/picker.vue
index 3233073..7ee4b60 100644
--- a/examples/vue/modules/picker.vue
+++ b/examples/vue/modules/picker.vue
@@ -53,7 +53,6 @@
pickTime:function(){
var self = this;
picker.pickTime({
- height: '300px'
}, function(ret) {
var result = ret.result;
if (result == 'success') {
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8df4ccb3/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 5716af9..26e38a9 100644
--- a/package.json
+++ b/package.json
@@ -106,7 +106,7 @@
"weex-styler": "0.1.9"
},
"devDependencies": {
- "@weex-project/weex-picker": "^0.2.2",
+ "@weex-project/weex-picker": "^0.2.4",
"babel-core": "^6.17.0",
"babel-eslint": "^7.2.1",
"babel-istanbul": "^0.11.0",
[09/12] incubator-weex git commit: * [html5] fix test case for dom.js
Posted by da...@apache.org.
* [html5] fix test case for dom.js
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/04a3944a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/04a3944a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/04a3944a
Branch: refs/heads/0.16-dev
Commit: 04a3944a121bdca750199f415af285f56029ff08
Parents: 3a12100
Author: erha19 <fa...@gmail.com>
Authored: Wed Aug 2 15:38:03 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Wed Aug 2 15:38:03 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/modules/dom.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/04a3944a/html5/test/render/vue/modules/dom.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/modules/dom.js b/html5/test/render/vue/modules/dom.js
index aa7da0f..5c8dbc5 100644
--- a/html5/test/render/vue/modules/dom.js
+++ b/html5/test/render/vue/modules/dom.js
@@ -53,7 +53,8 @@ describe('dom module', () => {
} = domModule
const node = document.createElement('div')
const vnode = {
- $el: node
+ $el: node,
+ $refs: {}
}
const rectKeys = ['width', 'height', 'top', 'bottom', 'left', 'right']
let message
[02/12] incubator-weex git commit: * [html5] add scrollable property
in scroller
Posted by da...@apache.org.
* [html5] add scrollable property in scroller
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/b0520a8a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/b0520a8a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/b0520a8a
Branch: refs/heads/0.16-dev
Commit: b0520a8a2d33275e52e305f217a0a5401deb14ef
Parents: d601088
Author: erha19 <fa...@gmail.com>
Authored: Mon Jul 31 16:24:44 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Mon Jul 31 16:24:44 2017 +0800
----------------------------------------------------------------------
html5/render/vue/components/scrollable/scroller.js | 9 ++++++++-
html5/render/vue/components/scrollable/style.css | 5 +++++
2 files changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b0520a8a/html5/render/vue/components/scrollable/scroller.js
----------------------------------------------------------------------
diff --git a/html5/render/vue/components/scrollable/scroller.js b/html5/render/vue/components/scrollable/scroller.js
index cda95b8..4fe998c 100644
--- a/html5/render/vue/components/scrollable/scroller.js
+++ b/html5/render/vue/components/scrollable/scroller.js
@@ -35,11 +35,15 @@ function getScroller (weex) {
validator (value) {
return ['horizontal', 'vertical'].indexOf(value) !== -1
}
+ },
+ scrollable: {
+ type: [Boolean],
+ default: true
}
},
-
computed: {
wrapperClass () {
+ console.log(this.scrollable)
const classArray = ['weex-scroller', 'weex-scroller-wrapper', 'weex-ct']
if (this.scrollDirection === 'horizontal') {
classArray.push('weex-scroller-horizontal')
@@ -47,6 +51,9 @@ function getScroller (weex) {
else {
classArray.push('weex-scroller-vertical')
}
+ if (!this.scrollable) {
+ classArray.push('weex-scroller-disabled')
+ }
return classArray.join(' ')
}
},
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b0520a8a/html5/render/vue/components/scrollable/style.css
----------------------------------------------------------------------
diff --git a/html5/render/vue/components/scrollable/style.css b/html5/render/vue/components/scrollable/style.css
index c4e1498..c90d2ea 100644
--- a/html5/render/vue/components/scrollable/style.css
+++ b/html5/render/vue/components/scrollable/style.css
@@ -58,6 +58,11 @@ body > .weex-waterfall {
overflow-y: hidden;
}
+.weex-scroller-wrapper.weex-scroller-disabled {
+ overflow-x: hidden;
+ overflow-y: hidden;
+}
+
.weex-scroller-horizontal .weex-scroller-inner {
-webkit-flex-direction: row;
-ms-flex-direction: row;