@dolphinweex/weex-vue-render 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.common.js +100 -14
- package/package.json +1 -1
package/dist/index.common.js
CHANGED
|
@@ -2966,33 +2966,68 @@ var scaleStyles = [
|
|
|
2966
2966
|
'bottom',
|
|
2967
2967
|
'border',
|
|
2968
2968
|
'borderRadius',
|
|
2969
|
+
'border-radius',
|
|
2969
2970
|
'borderWidth',
|
|
2971
|
+
'border-width',
|
|
2970
2972
|
'borderLeft',
|
|
2973
|
+
'border-left',
|
|
2971
2974
|
'borderRight',
|
|
2975
|
+
'border-right',
|
|
2972
2976
|
'borderTop',
|
|
2977
|
+
'border-top',
|
|
2973
2978
|
'borderBottom',
|
|
2979
|
+
'border-bottom',
|
|
2974
2980
|
'borderLeftWidth',
|
|
2981
|
+
'border-left-width',
|
|
2975
2982
|
'borderRightWidth',
|
|
2983
|
+
'border-right-width',
|
|
2976
2984
|
'borderTopWidth',
|
|
2985
|
+
'border-top-width',
|
|
2977
2986
|
'borderBottomWidth',
|
|
2987
|
+
'border-bottom-width',
|
|
2988
|
+
'borderTopLeftRadius',
|
|
2989
|
+
'border-top-left-radius',
|
|
2990
|
+
'borderTopRightRadius',
|
|
2991
|
+
'border-top-right-radius',
|
|
2992
|
+
'borderBottomLeftRadius',
|
|
2993
|
+
'border-bottom-left-radius' ,
|
|
2994
|
+
'borderBottomRightRadius',
|
|
2995
|
+
'border-bottom-right-radius',
|
|
2978
2996
|
'margin',
|
|
2979
2997
|
'marginLeft',
|
|
2998
|
+
'margin-left',
|
|
2980
2999
|
'marginRight',
|
|
3000
|
+
'margin-right',
|
|
2981
3001
|
'marginTop',
|
|
3002
|
+
'margin-top',
|
|
2982
3003
|
'marginBottom',
|
|
3004
|
+
'margin-bottom',
|
|
2983
3005
|
'padding',
|
|
2984
3006
|
'paddingLeft',
|
|
3007
|
+
'padding-left',
|
|
2985
3008
|
'paddingRight',
|
|
3009
|
+
'padding-right',
|
|
2986
3010
|
'paddingTop',
|
|
3011
|
+
'padding-top',
|
|
2987
3012
|
'paddingBottom',
|
|
2988
|
-
'
|
|
3013
|
+
'padding-bottom',
|
|
3014
|
+
'fontSize',
|
|
3015
|
+
'font-size',
|
|
2989
3016
|
'lineHeight',
|
|
3017
|
+
'line-height',
|
|
2990
3018
|
'transform',
|
|
2991
3019
|
'webkitTransform',
|
|
3020
|
+
'webkit-transform',
|
|
2992
3021
|
'WebkitTransform',
|
|
2993
3022
|
'mozTransform',
|
|
3023
|
+
'moz-transform',
|
|
2994
3024
|
'MozTransform',
|
|
2995
|
-
'itemSize'
|
|
3025
|
+
'itemSize',
|
|
3026
|
+
'item-size',
|
|
3027
|
+
'min-height',
|
|
3028
|
+
'minHeight',
|
|
3029
|
+
'max-height',
|
|
3030
|
+
'maxHeight'
|
|
2996
3031
|
];
|
|
2997
3032
|
|
|
2998
3033
|
var vendorReg = /webkit|moz/i;
|
|
@@ -3034,7 +3069,37 @@ var config = {
|
|
|
3034
3069
|
'a'
|
|
3035
3070
|
],
|
|
3036
3071
|
bindingStyleNamesForPx2Rem: allStyles,
|
|
3037
|
-
|
|
3072
|
+
|
|
3073
|
+
bindingStyleNamesForPv2Px: ["fontSize", "lineHeight", "letterSpacing"],
|
|
3074
|
+
|
|
3075
|
+
bindingStyleNamesForNumber2Px: [
|
|
3076
|
+
"top",
|
|
3077
|
+
"left",
|
|
3078
|
+
"right",
|
|
3079
|
+
"bottom",
|
|
3080
|
+
"width",
|
|
3081
|
+
"height",
|
|
3082
|
+
"minWidth",
|
|
3083
|
+
"minHeight",
|
|
3084
|
+
"maxWidth",
|
|
3085
|
+
"maxHeight",
|
|
3086
|
+
"margin",
|
|
3087
|
+
"marginTop",
|
|
3088
|
+
"marginBottom",
|
|
3089
|
+
"marginRight",
|
|
3090
|
+
"marginLeft",
|
|
3091
|
+
"borderWidth",
|
|
3092
|
+
"borderTopWidth",
|
|
3093
|
+
"borderLeftWidth",
|
|
3094
|
+
"borderBottomWidth",
|
|
3095
|
+
"borderRightWidth",
|
|
3096
|
+
"padding",
|
|
3097
|
+
"paddingTop",
|
|
3098
|
+
"paddingLeft",
|
|
3099
|
+
"paddingBottom",
|
|
3100
|
+
"paddingRight",
|
|
3101
|
+
|
|
3102
|
+
]
|
|
3038
3103
|
};
|
|
3039
3104
|
|
|
3040
3105
|
/*
|
|
@@ -3410,7 +3475,7 @@ function applySrc (item, src, placeholderSrc) {
|
|
|
3410
3475
|
* 1. apply src immediately in case javscript blocks the image loading
|
|
3411
3476
|
* before next tick.
|
|
3412
3477
|
*/
|
|
3413
|
-
item.style.backgroundImage = "url(" + (src
|
|
3478
|
+
item.style.backgroundImage = "url(" + (src ? encodeURI(src) : '') + ")";
|
|
3414
3479
|
item.removeAttribute(lazyloadAttr);
|
|
3415
3480
|
/**
|
|
3416
3481
|
* 2. then load the img src with Image constructor (but would not post
|
|
@@ -3418,7 +3483,7 @@ function applySrc (item, src, placeholderSrc) {
|
|
|
3418
3483
|
*/
|
|
3419
3484
|
item._src_loading = src;
|
|
3420
3485
|
preLoadImg(src, function (evt) {
|
|
3421
|
-
item.style.backgroundImage = "url(" + (src
|
|
3486
|
+
item.style.backgroundImage = "url(" + (src ? encodeURI(src) : '') + ")";
|
|
3422
3487
|
var ref = this;
|
|
3423
3488
|
var naturalWidth = ref.width;
|
|
3424
3489
|
var naturalHeight = ref.height;
|
|
@@ -3436,7 +3501,7 @@ function applySrc (item, src, placeholderSrc) {
|
|
|
3436
3501
|
dispatchNativeEvent(item, 'load', params);
|
|
3437
3502
|
if (placeholderSrc) {
|
|
3438
3503
|
preLoadImg(placeholderSrc, function () {
|
|
3439
|
-
item.style.backgroundImage = "url(" + (placeholderSrc
|
|
3504
|
+
item.style.backgroundImage = "url(" + (placeholderSrc ? encodeURI(placeholderSrc) : '') + ")";
|
|
3440
3505
|
});
|
|
3441
3506
|
}
|
|
3442
3507
|
finallCb();
|
|
@@ -3535,6 +3600,7 @@ function getThrottleLazyload (wait, el) {
|
|
|
3535
3600
|
|
|
3536
3601
|
var bindingStyleNamesForPx2Rem = config.bindingStyleNamesForPx2Rem;
|
|
3537
3602
|
var bindingStyleNamesForPv2Px = config.bindingStyleNamesForPv2Px;
|
|
3603
|
+
var bindingStyleNamesForNumber2Px = config.bindingStyleNamesForNumber2Px;
|
|
3538
3604
|
|
|
3539
3605
|
// whether to support using 0.5px to paint 1px width border.
|
|
3540
3606
|
var _supportHairlines;
|
|
@@ -3741,11 +3807,11 @@ function styleObject2rem (style, rootValue) {
|
|
|
3741
3807
|
var camK = camelize(k);
|
|
3742
3808
|
|
|
3743
3809
|
if (bindingStyleNamesForPv2Px.indexOf(camK) > -1 && typeof obj[camK] =='string'
|
|
3744
|
-
&& obj[camK].endsWith('wx')
|
|
3810
|
+
&& obj[camK].endsWith('wx')) {
|
|
3745
3811
|
|
|
3746
3812
|
obj[camK] = px2px(style[k]);
|
|
3747
3813
|
} else if (bindingStyleNamesForPx2Rem.indexOf(camK) > -1) {
|
|
3748
|
-
|
|
3814
|
+
obj[camK] = px2rem(style[k] + '', rootValue);
|
|
3749
3815
|
}
|
|
3750
3816
|
else {
|
|
3751
3817
|
obj[camK] = style[k];
|
|
@@ -3917,16 +3983,31 @@ function initEnv (viewportInfo, envInfo) {
|
|
|
3917
3983
|
osName = 'android';
|
|
3918
3984
|
}
|
|
3919
3985
|
var osVersion = envInfo.os.version.val;
|
|
3986
|
+
|
|
3987
|
+
var device_display = $midea_harmony_native.getHarmoryDeviceDisplay() || {};
|
|
3988
|
+
|
|
3989
|
+
|
|
3920
3990
|
var env = {
|
|
3921
3991
|
platform: 'harmony',
|
|
3922
3992
|
weexVersion: '1.0.36',
|
|
3923
3993
|
layoutDirection: 'ltr',
|
|
3924
3994
|
userAgent: navigator.userAgent,
|
|
3925
3995
|
appName: browserName,
|
|
3926
|
-
appVersion:
|
|
3996
|
+
appVersion: device_display.appVersion,
|
|
3927
3997
|
osName: osName,
|
|
3928
3998
|
osVersion: osVersion,
|
|
3929
|
-
|
|
3999
|
+
|
|
4000
|
+
deviceModel: device_display.deviceModel || null,
|
|
4001
|
+
appEnv: device_display.appEnv,
|
|
4002
|
+
versionCode: device_display.versionCode,
|
|
4003
|
+
idfa: device_display.idfa,
|
|
4004
|
+
isFullScreen: device_display.isFullScreen,
|
|
4005
|
+
weexVersion: device_display.weexVersion,
|
|
4006
|
+
osName: device_display.osName,
|
|
4007
|
+
statusBarHeight: device_display.statusBarHeight,
|
|
4008
|
+
safeAreaBottomHeight: device_display.safeAreaBottomHeight,
|
|
4009
|
+
isImmersion: device_display.isImmersion,
|
|
4010
|
+
|
|
3930
4011
|
};
|
|
3931
4012
|
/**
|
|
3932
4013
|
* viewportInfo: scale, deviceWidth, deviceHeight. dpr
|
|
@@ -4890,7 +4971,7 @@ var style = {
|
|
|
4890
4971
|
}
|
|
4891
4972
|
return t;
|
|
4892
4973
|
},
|
|
4893
|
-
_px2rem: function _px2rem (value, rootValue) {
|
|
4974
|
+
_px2rem: function _px2rem (value, rootValue, propKey) {
|
|
4894
4975
|
var this$1 = this;
|
|
4895
4976
|
if (typeof value === 'string') {
|
|
4896
4977
|
return (value + '').replace(/[+-]?\d+(?:.\d*)?[pw]x/gi, function ($0) {
|
|
@@ -4898,20 +4979,25 @@ var style = {
|
|
|
4898
4979
|
})
|
|
4899
4980
|
}
|
|
4900
4981
|
if (typeof value === 'number') {
|
|
4901
|
-
|
|
4982
|
+
if (bindingStyleNamesForNumber2Px.indexOf(propKey) > -1) {
|
|
4983
|
+
const scale = weex.config.env.scale
|
|
4984
|
+
return (scale * value) + 'px';
|
|
4985
|
+
}else{
|
|
4986
|
+
return weex.utils.px2rem(value + '', rootValue)
|
|
4987
|
+
}
|
|
4902
4988
|
}
|
|
4903
4989
|
if (isPlainObject(value)) {
|
|
4904
4990
|
let cloneObj = this._deepClone(value)
|
|
4905
4991
|
for (var k in cloneObj) {
|
|
4906
4992
|
// 如果是"fontSize", "lineHeight", "letterSpacing"并且值包含wx则按照vp来转化为px使用
|
|
4907
4993
|
if (
|
|
4908
|
-
bindingStyleNamesForPv2Px$1.indexOf(k) > -1 &&typeof cloneObj[k] == "string" && cloneObj[k].endsWith('wx')
|
|
4994
|
+
bindingStyleNamesForPv2Px$1.indexOf(k) > -1 &&typeof cloneObj[k] == "string" && cloneObj[k].endsWith('wx')) {
|
|
4909
4995
|
cloneObj[k] = px2px(cloneObj[k]);
|
|
4910
4996
|
}else if (
|
|
4911
4997
|
cloneObj.hasOwnProperty(k)
|
|
4912
4998
|
&& bindingStyleNamesForPx2Rem$1.indexOf(k) > -1
|
|
4913
4999
|
) {
|
|
4914
|
-
|
|
5000
|
+
cloneObj[k] = weex.utils.px2rem(cloneObj[k] + '', rootValue);
|
|
4915
5001
|
}
|
|
4916
5002
|
}
|
|
4917
5003
|
return cloneObj
|
package/package.json
CHANGED