@dolphinweex/weex-vue-render 0.2.83 → 0.2.85
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 +73 -11
- package/package.json +1 -1
package/dist/index.common.js
CHANGED
|
@@ -5201,6 +5201,35 @@ var findEnterKeyType = function (key) {
|
|
|
5201
5201
|
};
|
|
5202
5202
|
|
|
5203
5203
|
var inputCommon = {
|
|
5204
|
+
mounted: function mounted () {
|
|
5205
|
+
var this$1 = this;
|
|
5206
|
+
|
|
5207
|
+
if (this.autofocus !== 'false' && this.autofocus !== false) {
|
|
5208
|
+
this.focus(this.autofocus)
|
|
5209
|
+
}
|
|
5210
|
+
|
|
5211
|
+
// 监听键盘高度变化,当键盘收起时(height为0)主动失焦
|
|
5212
|
+
var globalEvent = weex.requireModule('globalEvent');
|
|
5213
|
+
this._keyboardHeightChangeHandler = function(data) {
|
|
5214
|
+
if (data && data.messageType === 'keyboardHeightChange' &&
|
|
5215
|
+
data.messageBody && data.messageBody.height === 0) {
|
|
5216
|
+
// 键盘收起,主动失焦
|
|
5217
|
+
this$1.blur && this$1.blur();
|
|
5218
|
+
}
|
|
5219
|
+
};
|
|
5220
|
+
globalEvent && globalEvent.addEventListener &&
|
|
5221
|
+
globalEvent.addEventListener('receiveMessageFromApp', this._keyboardHeightChangeHandler);
|
|
5222
|
+
},
|
|
5223
|
+
|
|
5224
|
+
beforeDestroy: function beforeDestroy () {
|
|
5225
|
+
// 移除键盘高度变化监听
|
|
5226
|
+
if (this._keyboardHeightChangeHandler) {
|
|
5227
|
+
var globalEvent = weex.requireModule('globalEvent');
|
|
5228
|
+
globalEvent && globalEvent.removeEventListener &&
|
|
5229
|
+
globalEvent.removeEventListener('receiveMessageFromApp', this._keyboardHeightChangeHandler);
|
|
5230
|
+
}
|
|
5231
|
+
},
|
|
5232
|
+
|
|
5204
5233
|
methods: {
|
|
5205
5234
|
focus: function focus (autofocus) {
|
|
5206
5235
|
// 当是自动聚焦时才需要主动弹出键盘,否则会导致键盘弹出但是组件失去焦点
|
|
@@ -9579,12 +9608,6 @@ function getTextarea (weex) {
|
|
|
9579
9608
|
returnKeyType: String
|
|
9580
9609
|
},
|
|
9581
9610
|
|
|
9582
|
-
mounted: function mounted () {
|
|
9583
|
-
if (this.autofocus !== 'false' && this.autofocus !== false) {
|
|
9584
|
-
this.focus(this.autofocus)
|
|
9585
|
-
}
|
|
9586
|
-
},
|
|
9587
|
-
|
|
9588
9611
|
render: function render (createElement) {
|
|
9589
9612
|
/* istanbul ignore next */
|
|
9590
9613
|
// if ("production" === 'development') {
|
|
@@ -11061,15 +11084,44 @@ function transitionOnce (vnode, config, callback) {
|
|
|
11061
11084
|
callback && callback();
|
|
11062
11085
|
}, totalMs);
|
|
11063
11086
|
nextFrame(function () {
|
|
11064
|
-
// 修改 transform:translate让它支持传3
|
|
11087
|
+
// 修改 transform:translate让它支持传3개参数,且第三个参数无效
|
|
11065
11088
|
if (config.styles["transform"]) {
|
|
11066
11089
|
config.styles["transform"] = config.styles["transform"].replace(/(translate\([^,]+,[^,]+),[^)]+\)/, '$1)')
|
|
11067
11090
|
}
|
|
11068
11091
|
var toCss = toCSSText(styleObject2rem(config.styles, DESIGN_ROOT_VALUE) || {})
|
|
11069
|
-
|
|
11070
|
-
|
|
11071
|
-
|
|
11072
|
-
|
|
11092
|
+
// 劫持该 DOM 的样式更新行为
|
|
11093
|
+
if (dom && !dom._hijacked) {
|
|
11094
|
+
dom._hijacked = true;
|
|
11095
|
+
var observer = new MutationObserver(function(mutations) {
|
|
11096
|
+
try {
|
|
11097
|
+
mutations.forEach(function(mutation) {
|
|
11098
|
+
if (mutation.type === 'attributes' && mutation.attributeName === 'style') {
|
|
11099
|
+
var currentCss = dom.style.cssText;
|
|
11100
|
+
var needAppend = "";
|
|
11101
|
+
for (var key in dom._ani_lock) {
|
|
11102
|
+
var val = dom._ani_lock[key];
|
|
11103
|
+
// 使用正则匹配,确保值和单位完全一致(包括括号转义)
|
|
11104
|
+
var escapedVal = val.toString().replace(/([()])/g, "\\$1");
|
|
11105
|
+
var valueRegex = new RegExp("(^|;)\\s*" + key + "\\s*:\\s*" + escapedVal + "\\s*(;|$)", "i");
|
|
11106
|
+
|
|
11107
|
+
if (!valueRegex.test(currentCss)) {
|
|
11108
|
+
needAppend += key + ":" + val + ";";
|
|
11109
|
+
}
|
|
11110
|
+
}
|
|
11111
|
+
|
|
11112
|
+
if (needAppend) {
|
|
11113
|
+
observer.disconnect();
|
|
11114
|
+
dom.style.cssText += needAppend;
|
|
11115
|
+
observer.observe(dom, { attributes: true, attributeFilter: ['style'] });
|
|
11116
|
+
}
|
|
11117
|
+
}
|
|
11118
|
+
});
|
|
11119
|
+
} catch (err) {
|
|
11120
|
+
console.error('[weex-vue-render] MutationObserver Protect Error:', err);
|
|
11121
|
+
}
|
|
11122
|
+
});
|
|
11123
|
+
observer.observe(dom, { attributes: true, attributeFilter: ['style'] });
|
|
11124
|
+
}
|
|
11073
11125
|
|
|
11074
11126
|
dom.style.cssText += toCss;
|
|
11075
11127
|
});
|
|
@@ -11084,6 +11136,16 @@ var animation = {
|
|
|
11084
11136
|
*/
|
|
11085
11137
|
transition: function transition (vnode, config, callback) {
|
|
11086
11138
|
if (!vnode || !config.styles) { return }
|
|
11139
|
+
|
|
11140
|
+
var dom = vnode instanceof HTMLElement ? vnode : vnode.$el;
|
|
11141
|
+
if (dom) {
|
|
11142
|
+
var processed = hyphenateStyleKeys(styleObject2rem(config.styles, DESIGN_ROOT_VALUE) || {});
|
|
11143
|
+
if (!dom._ani_lock) dom._ani_lock = {};
|
|
11144
|
+
for (var k in processed) {
|
|
11145
|
+
dom._ani_lock[k] = processed[k];
|
|
11146
|
+
}
|
|
11147
|
+
}
|
|
11148
|
+
|
|
11087
11149
|
return transitionOnce(vnode, config, function () {
|
|
11088
11150
|
callback && callback();
|
|
11089
11151
|
})
|
package/package.json
CHANGED