提交 f3caf8ce 编写于 作者: fxy060608's avatar fxy060608

Merge branch 'dev' of https://github.com/dcloudio/uni-app into v3

# Conflicts:
#	build/build.js
#	src/platforms/app-plus-nvue/service/api/route/util.js
......@@ -41,8 +41,12 @@ service.run('build', {
entry,
clean: !process.env.UNI_VIEW,
mode: process.env.NODE_ENV
}).then(function () {
if (process.env.UNI_UI !== 'true' && process.env.UNI_VIEW !== 'true') {
}).then(function() {
if (
process.env.UNI_WATCH !== 'true' &&
process.env.UNI_UI !== 'true' &&
process.env.UNI_VIEW !== 'true'
) {
generateApiManifest(
JSON.parse(JSON.stringify(process.UNI_SERVICE_API_MANIFEST)),
JSON.parse(JSON.stringify(process.UNI_SERVICE_API_PROTOCOL))
......@@ -58,7 +62,7 @@ if (process.env.UNI_PLATFORM === 'h5' && process.env.UNI_WATCH === 'false') {
const packageJsonPath = path.join(packagePath, 'package.json')
del(path.join(packagePath, '{lib,src}'))
.then(() => {
copy([path.join(__dirname, '../{lib,src}/**/*')], packagePath, function (err, file) {
copy([path.join(__dirname, '../{lib,src}/**/*')], packagePath, function(err, file) {
if (err) {
throw err
}
......
......@@ -98,6 +98,7 @@
"wx": true,
"my": true,
"swan": true,
"tt": true,
"weex": true,
"__id__": true,
"__uniConfig": true,
......
......@@ -436,6 +436,7 @@ function wrapper (methodName, method) {
const todoApis = Object.create(null);
const TODOS = [
'onTabBarMidButtonTap',
'subscribePush',
'unsubscribePush',
'onPush',
......@@ -519,8 +520,13 @@ function wrapper$1 (webview) {
return
}
const maskColor = webview.__uniapp_mask;
let maskWebview = plus.webview.getWebviewById(webview.__uniapp_mask_id);
maskWebview = maskWebview.parent() || maskWebview;// 再次检测父
let maskWebview = webview.__uniapp_mask_id === '0' ? {
setStyle ({ mask }) {
requireNativePlugin('uni-tabview').setMask({
color: mask
});
}
} : plus.webview.getWebviewById(webview.__uniapp_mask_id);
const oldShow = webview.show;
const oldHide = webview.hide;
const oldClose = webview.close;
......
......@@ -11478,6 +11478,8 @@ Scroller.prototype.isScrolling = function () {
if (n.onTouchStart) {
n.onTouchStart();
}
event.preventDefault();
}
},
_handleTouchMove: function _handleTouchMove(event) {
......@@ -21370,6 +21372,26 @@ var Spring = __webpack_require__(42);
function onClick(dom, callback) {
var MAX_MOVE = 20;
var hasTouchSupport = navigator.maxTouchPoints;
var x = 0;
var y = 0;
dom.addEventListener(hasTouchSupport ? 'touchstart' : 'mousedown', function (event) {
var info = hasTouchSupport ? event.changedTouches[0] : event;
x = info.clientX;
y = info.clientY;
});
dom.addEventListener(hasTouchSupport ? 'touchend' : 'mouseup', function (event) {
var info = hasTouchSupport ? event.changedTouches[0] : event;
if (Math.abs(info.clientX - x) < MAX_MOVE && Math.abs(info.clientY - y) < MAX_MOVE) {
callback(info);
}
});
}
/* harmony default export */ var picker_view_columnvue_type_script_lang_js_ = ({
name: 'PickerViewColumn',
mixins: [touchtrack["a" /* default */], scroller["a" /* default */]],
......@@ -21416,7 +21438,8 @@ var Spring = __webpack_require__(42);
this.indicatorStyle = $parent.indicatorStyle;
this.indicatorClass = $parent.indicatorClass;
this.maskStyle = $parent.maskStyle;
this.maskClass = $parent.maskClass; // this.__pageRerender = this._pageRerender.bind(this)
this.maskClass = $parent.maskClass;
this.deltaY = 0;
},
mounted: function mounted() {
var _this = this;
......@@ -21428,6 +21451,7 @@ var Spring = __webpack_require__(42);
_this.update();
});
onClick(this.$el, this._handleTap.bind(this));
},
methods: {
_setItemHeight: function _setItemHeight(height) {
......@@ -21455,23 +21479,39 @@ var Spring = __webpack_require__(42);
}
}
},
_handleTap: function _handleTap(e) {
if (e.target !== e.currentTarget && !this._scroller.isScrolling()) {
var t = e.touches && e.touches[0] && e.touches[0].clientY;
var n = typeof t === 'number' ? t : e.detail.y - document.body.scrollTop;
var i = this.$el.getBoundingClientRect();
var r = n - i.top - this._height / 2;
_handleTap: function _handleTap(_ref) {
var clientY = _ref.clientY;
if (!this._scroller.isScrolling()) {
var rect = this.$el.getBoundingClientRect();
var r = clientY - rect.top - this.height / 2;
var o = this.indicatorHeight / 2;
if (!(Math.abs(r) <= o)) {
var a = Math.ceil((Math.abs(r) - o) / this.indicatorHeight);
var s = r < 0 ? -a : a;
this.current += s;
var current = Math.min(this.current + s, this.length - 1);
this.current = current = Math.max(current, 0);
this._scroller.scrollTo(this.current * this.indicatorHeight);
this._scroller.scrollTo(current * this.indicatorHeight);
}
}
},
_handleWheel: function _handleWheel($event) {
var deltaY = this.deltaY + $event.deltaY;
if (Math.abs(deltaY) > 10) {
this.deltaY = 0;
var current = Math.min(this.current + (deltaY < 0 ? -1 : 1), this.length - 1);
this.current = current = Math.max(current, 0);
this._scroller.scrollTo(current * this.indicatorHeight);
} else {
this.deltaY = deltaY;
}
$event.preventDefault();
},
setCurrent: function setCurrent(current) {
if (current !== this.current) {
this.current = current;
......@@ -21503,14 +21543,14 @@ var Spring = __webpack_require__(42);
var _this3 = this;
this.$nextTick(function () {
var index = Math.max(_this3.length - 1, 0);
var current = Math.min(_this3.current, index);
var current = Math.min(_this3.current, _this3.length - 1);
current = Math.max(current, 0);
_this3._scroller.update(current * _this3.indicatorHeight, undefined, _this3.indicatorHeight);
});
},
_resize: function _resize(_ref) {
var height = _ref.height;
_resize: function _resize(_ref2) {
var height = _ref2.height;
this.indicatorHeight = height;
}
},
......@@ -21518,7 +21558,7 @@ var Spring = __webpack_require__(42);
this.length = this.$slots.default && this.$slots.default.length || 0;
return createElement('uni-picker-view-column', {
on: {
tap: this._handleTap
wheel: this._handleWheel
}
}, [createElement('div', {
ref: 'main',
......
......@@ -53,21 +53,30 @@ function getChangedJsonFileMap (clear = true) {
}
function updateAppJson (name, jsonObj) {
updateComponentJson(name, jsonObj)
updateComponentJson(name, jsonObj, true, 'App')
}
function updatePageJson (name, jsonObj) {
pageSet.add(name)
updateComponentJson(name, jsonObj)
updateComponentJson(name, jsonObj, true, 'Page')
}
function updateProjectJson (name, jsonObj) {
updateComponentJson(name, jsonObj, false)
updateComponentJson(name, jsonObj, false, 'Project')
}
const supportGlobalUsingComponents = process.env.UNI_PLATFORM === 'mp-weixin' || process.env.UNI_PLATFORM === 'mp-qq'
function updateComponentJson (name, jsonObj, usingComponents = true) {
function updateComponentJson (name, jsonObj, usingComponents = true, type = 'Component') {
if (type === 'Component') {
jsonObj.component = true
}
if (type === 'Page') {
if (process.env.UNI_PLATFORM === 'mp-baidu') {
jsonObj.component = true
}
}
const oldJsonStr = getJsonFile(name)
if (oldJsonStr) { // update
if (usingComponents) { // merge usingComponents
......
......@@ -836,6 +836,7 @@ function wrapper (methodName, method) {
const todoApis = Object.create(null);
const TODOS = [
'onTabBarMidButtonTap',
'subscribePush',
'unsubscribePush',
'onPush',
......
......@@ -579,6 +579,7 @@ function wrapper (methodName, method) {
const todoApis = Object.create(null);
const TODOS = [
'onTabBarMidButtonTap',
'subscribePush',
'unsubscribePush',
'onPush',
......
......@@ -539,6 +539,7 @@ function wrapper (methodName, method) {
const todoApis = Object.create(null);
const TODOS = [
'onTabBarMidButtonTap',
'subscribePush',
'unsubscribePush',
'onPush',
......
......@@ -536,9 +536,10 @@ const protocols = {
timeout: false
}
},
requestPayment: {
requestPayment: {
name: tt.canIUse && tt.canIUse('pay') ? 'pay' : 'requestPayment',
args: {
orderInfo: 'data'
orderInfo: tt.canIUse && tt.canIUse('pay') ? 'orderInfo' : 'data'
}
},
getFileInfo: {
......@@ -630,6 +631,7 @@ function wrapper (methodName, method) {
const todoApis = Object.create(null);
const TODOS = [
'onTabBarMidButtonTap',
'subscribePush',
'unsubscribePush',
'onPush',
......
......@@ -474,6 +474,7 @@ function wrapper (methodName, method) {
const todoApis = Object.create(null);
const TODOS = [
'onTabBarMidButtonTap',
'subscribePush',
'unsubscribePush',
'onPush',
......
......@@ -4,6 +4,24 @@ import scroller from 'uni-mixins/scroller/index'
import { Friction } from 'uni-mixins/scroller/Friction'
import { Spring } from 'uni-mixins/scroller/Spring'
function onClick (dom, callback) {
const MAX_MOVE = 20
const hasTouchSupport = navigator.maxTouchPoints
let x = 0
let y = 0
dom.addEventListener(hasTouchSupport ? 'touchstart' : 'mousedown', (event) => {
const info = hasTouchSupport ? event.changedTouches[0] : event
x = info.clientX
y = info.clientY
})
dom.addEventListener(hasTouchSupport ? 'touchend' : 'mouseup', (event) => {
const info = hasTouchSupport ? event.changedTouches[0] : event
if (Math.abs(info.clientX - x) < MAX_MOVE && Math.abs(info.clientY - y) < MAX_MOVE) {
callback(info)
}
})
}
export default {
name: 'PickerViewColumn',
mixins: [touchtrack, scroller],
......@@ -50,7 +68,7 @@ export default {
this.indicatorClass = $parent.indicatorClass
this.maskStyle = $parent.maskStyle
this.maskClass = $parent.maskClass
// this.__pageRerender = this._pageRerender.bind(this)
this.deltaY = 0
},
mounted: function () {
this.touchtrack(this.$refs.main, '_handleTrack', true)
......@@ -59,6 +77,7 @@ export default {
this.init()
this.update()
})
onClick(this.$el, this._handleTap.bind(this))
},
methods: {
_setItemHeight (height) {
......@@ -81,21 +100,32 @@ export default {
}
}
},
_handleTap: function (e) {
if (e.target !== e.currentTarget && !this._scroller.isScrolling()) {
var t = e.touches && e.touches[0] && e.touches[0].clientY
var n = typeof t === 'number' ? t : e.detail.y - document.body.scrollTop
var i = this.$el.getBoundingClientRect()
var r = n - i.top - this._height / 2
_handleTap: function ({ clientY }) {
if (!this._scroller.isScrolling()) {
var rect = this.$el.getBoundingClientRect()
var r = clientY - rect.top - this.height / 2
var o = this.indicatorHeight / 2
if (!(Math.abs(r) <= o)) {
var a = Math.ceil((Math.abs(r) - o) / this.indicatorHeight)
var s = r < 0 ? -a : a
this.current += s
this._scroller.scrollTo(this.current * this.indicatorHeight)
var current = Math.min(this.current + s, this.length - 1)
this.current = current = Math.max(current, 0)
this._scroller.scrollTo(current * this.indicatorHeight)
}
}
},
_handleWheel ($event) {
const deltaY = this.deltaY + $event.deltaY
if (Math.abs(deltaY) > 10) {
this.deltaY = 0
var current = Math.min(this.current + (deltaY < 0 ? -1 : 1), this.length - 1)
this.current = current = Math.max(current, 0)
this._scroller.scrollTo(current * this.indicatorHeight)
} else {
this.deltaY = deltaY
}
$event.preventDefault()
},
setCurrent: function (current) {
if (current !== this.current) {
this.current = current
......@@ -122,8 +152,8 @@ export default {
},
update: function () {
this.$nextTick(() => {
var index = Math.max(this.length - 1, 0)
var current = Math.min(this.current, index)
var current = Math.min(this.current, this.length - 1)
current = Math.max(current, 0)
this._scroller.update(current * this.indicatorHeight, undefined, this.indicatorHeight)
})
},
......@@ -137,10 +167,9 @@ export default {
this.length = (this.$slots.default && this.$slots.default.length) || 0
return createElement('uni-picker-view-column', {
on: {
tap: this._handleTap
wheel: this._handleWheel
}
},
[
}, [
createElement('div', {
ref: 'main',
staticClass: 'uni-picker-view-group'
......
......@@ -46,6 +46,7 @@ export default {
if (n.onTouchStart) {
n.onTouchStart()
}
event.preventDefault()
}
},
_handleTouchMove: function (event) {
......
......@@ -319,7 +319,7 @@ export default {
}
},
_resetFormData () {
this.valueSync = ''
this.valueSync = 0
},
_createTime () {
var hours = []
......
......@@ -152,9 +152,10 @@ const protocols = {
timeout: false
}
},
requestPayment: {
requestPayment: {
name: tt.canIUse && tt.canIUse('pay') ? 'pay' : 'requestPayment',
args: {
orderInfo: 'data'
orderInfo: tt.canIUse && tt.canIUse('pay') ? 'orderInfo' : 'data'
}
},
getFileInfo: {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册