@mpxjs/webpack-plugin 2.8.25-alpha.2 → 2.8.25-alpha.20
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/lib/dependencies/ResolveDependency.js +2 -1
- package/lib/platform/template/wx/index.js +6 -0
- package/lib/runtime/components/tenon/getInnerListeners.js +27 -7
- package/lib/runtime/components/tenon/tenon-button.vue +4 -0
- package/lib/runtime/components/tenon/tenon-image.vue +6 -1
- package/lib/runtime/components/tenon/tenon-input.vue +73 -6
- package/lib/runtime/components/tenon/tenon-rich-text.vue +6 -1
- package/lib/runtime/components/tenon/tenon-scroll-view.vue +3 -0
- package/lib/runtime/components/tenon/tenon-switch.vue +5 -0
- package/lib/runtime/components/tenon/tenon-text.vue +6 -0
- package/lib/runtime/components/tenon/{tenon-text-area.vue → tenon-textarea.vue} +11 -2
- package/lib/template-compiler/compiler.js +1 -1
- package/lib/tenon/processJSON.js +5 -9
- package/lib/tenon/processScript.js +1 -1
- package/lib/utils/check-core-version-match.js +2 -1
- package/package.json +3 -3
|
@@ -76,7 +76,8 @@ ResolveDependency.Template = class ResolveDependencyTemplate {
|
|
|
76
76
|
const { resolved = '' } = dep
|
|
77
77
|
// for tenon
|
|
78
78
|
if (dep.compilation.__mpx__.mode === 'tenon') {
|
|
79
|
-
|
|
79
|
+
// 只支持所有产物在一个目录下的场景 进行相对路径跳转
|
|
80
|
+
return `'./${resolved}.js'`
|
|
80
81
|
}
|
|
81
82
|
// ?resolve 必定返回绝对路径
|
|
82
83
|
return JSON.stringify('/' + resolved)
|
|
@@ -61,9 +61,9 @@ function createTouch (context, hasLongTap, __mpxTapInfo) {
|
|
|
61
61
|
})
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
function processOriginEvent (listeners) {
|
|
64
|
+
function processOriginEvent (listeners, context, _input) {
|
|
65
65
|
// 给event添加_originEvent属性
|
|
66
|
-
const ignoreEvents = ['onTap', 'onFocus', 'onChange', 'onBlur', 'onConfirm']
|
|
66
|
+
const ignoreEvents = ['onTap', 'onFocus', 'onChange', 'onBlur', 'onConfirm', 'onInput']
|
|
67
67
|
Object.keys(listeners).forEach((key) => {
|
|
68
68
|
if (!ignoreEvents.includes(key)) {
|
|
69
69
|
const listener = listeners[key]
|
|
@@ -75,14 +75,32 @@ function processOriginEvent (listeners) {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
})
|
|
78
|
+
|
|
79
|
+
// 处理input输入框事件
|
|
80
|
+
if (listeners.onInput && _input) {
|
|
81
|
+
delete listeners.onInput
|
|
82
|
+
listeners.onInput = function (e) {
|
|
83
|
+
let _type
|
|
84
|
+
const { state } = e || {}
|
|
85
|
+
if (state === 1) {
|
|
86
|
+
_type = 'focus'
|
|
87
|
+
} else if (state === 2) {
|
|
88
|
+
_type = 'focus'
|
|
89
|
+
} else if (state === 3) {
|
|
90
|
+
_type = 'blur'
|
|
91
|
+
} else {
|
|
92
|
+
_type = 'confirm'
|
|
93
|
+
}
|
|
94
|
+
context.$emit(_type, { ...e, detail: e })
|
|
95
|
+
}
|
|
96
|
+
}
|
|
78
97
|
}
|
|
79
98
|
|
|
80
|
-
function processModel (listeners, context) {
|
|
99
|
+
function processModel (listeners, context, _input = false) {
|
|
81
100
|
// 该函数只有wx:model的情况下才调用,而且默认e.detail.value有值
|
|
82
101
|
// 该函数必须在产生merge前执行
|
|
83
102
|
// todo 此处对于$attrs的访问会导致父组件更新时子组件必然更新,暂时用短路效应避免影响,待优化
|
|
84
103
|
// todo 访问$listeners也会导致上述现象,但是为了事件代理还必须访问$listeners,待后续思考处理
|
|
85
|
-
|
|
86
104
|
const modelEvent = context.$attrs.mpxModelEvent
|
|
87
105
|
const modelEventId = context.$attrs.mpxModelEventId
|
|
88
106
|
if (modelEvent && modelEventId) {
|
|
@@ -278,11 +296,13 @@ export default function getInnerListeners (context, options = {}) {
|
|
|
278
296
|
mergeBefore = {},
|
|
279
297
|
mergeAfter = {},
|
|
280
298
|
defaultListeners = [],
|
|
281
|
-
ignoredListeners = []
|
|
299
|
+
ignoredListeners = [],
|
|
300
|
+
_input = false
|
|
282
301
|
} = options
|
|
283
302
|
const __mpxTapInfo = {}
|
|
284
303
|
// 从attrs里面拿到以on开头的所有绑定的事件
|
|
285
304
|
const listeners = Object.assign({}, getListeners(context))
|
|
305
|
+
|
|
286
306
|
defaultListeners.forEach((key) => {
|
|
287
307
|
if (!listeners[key]) listeners[key] = noop
|
|
288
308
|
})
|
|
@@ -302,8 +322,8 @@ export default function getInnerListeners (context, options = {}) {
|
|
|
302
322
|
mergeAfterOptions.force = mergeAfter.force
|
|
303
323
|
mergeAfter = mergeAfter.listeners
|
|
304
324
|
}
|
|
305
|
-
processOriginEvent(listeners)
|
|
306
|
-
processModel(listeners, context)
|
|
325
|
+
processOriginEvent(listeners, context, _input)
|
|
326
|
+
processModel(listeners, context, _input)
|
|
307
327
|
processTouchAndLtap(listeners, context, __mpxTapInfo)
|
|
308
328
|
mergeListeners(listeners, mergeBefore, mergeBeforeOptions, context, __mpxTapInfo)
|
|
309
329
|
mergeListeners(listeners, mergeAfter, mergeAfterOptions, context, __mpxTapInfo)
|
|
@@ -64,6 +64,9 @@ export default (function(){
|
|
|
64
64
|
},
|
|
65
65
|
},
|
|
66
66
|
computed: {
|
|
67
|
+
originRef() {
|
|
68
|
+
return this.$refs["mpx-button"]
|
|
69
|
+
},
|
|
67
70
|
className() {
|
|
68
71
|
if (this.hoverClass && this.hoverClass !== "none" && this.hover) {
|
|
69
72
|
return this.hoverClass;
|
|
@@ -109,6 +112,7 @@ export default (function(){
|
|
|
109
112
|
};
|
|
110
113
|
const data = {
|
|
111
114
|
class: ["mpx-button", ...this.classNameList],
|
|
115
|
+
ref: "mpx-button",
|
|
112
116
|
...domProps,
|
|
113
117
|
...getInnerListeners(this, {
|
|
114
118
|
mergeAfter,
|
|
@@ -38,11 +38,17 @@ export default {
|
|
|
38
38
|
}
|
|
39
39
|
return h("image", {
|
|
40
40
|
class: "mpx-image",
|
|
41
|
+
ref: "mpx-image",
|
|
41
42
|
src: this.src,
|
|
42
43
|
resize,
|
|
43
44
|
...getInnerListeners(this)
|
|
44
45
|
});
|
|
45
46
|
},
|
|
47
|
+
computed: {
|
|
48
|
+
originRef() {
|
|
49
|
+
return this.$refs["mpx-image"]
|
|
50
|
+
}
|
|
51
|
+
},
|
|
46
52
|
data() {
|
|
47
53
|
return {};
|
|
48
54
|
},
|
|
@@ -57,5 +63,4 @@ export default {
|
|
|
57
63
|
.mpx-image
|
|
58
64
|
width 300px
|
|
59
65
|
height 225px
|
|
60
|
-
display inline-block
|
|
61
66
|
</style>
|
|
@@ -37,15 +37,76 @@ export default {
|
|
|
37
37
|
type: Number,
|
|
38
38
|
default: -1,
|
|
39
39
|
},
|
|
40
|
+
style: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: '',
|
|
43
|
+
},
|
|
44
|
+
placeholderStyle: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: '',
|
|
47
|
+
},
|
|
48
|
+
confirmType: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: 'done',
|
|
51
|
+
}
|
|
40
52
|
},
|
|
41
53
|
computed: {
|
|
42
54
|
originRef() {
|
|
43
55
|
return this.$refs["mpx-input"]
|
|
44
|
-
}
|
|
56
|
+
},
|
|
57
|
+
computedStyle() {
|
|
58
|
+
let _inputWrapStyleObj = {
|
|
59
|
+
"font-size": "33hm",
|
|
60
|
+
height: "80hm",
|
|
61
|
+
"line-height": "80hm",
|
|
62
|
+
color: "#000000",
|
|
63
|
+
border: "1hm solid #999999",
|
|
64
|
+
"border-radius": "8hm",
|
|
65
|
+
"text-align": "left",
|
|
66
|
+
"background-color": "#ffffff"
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
if (typeof this.style !== 'string') {
|
|
70
|
+
console.warn('Runtime warning: PROPS style must be string')
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
let _styleObj = {};
|
|
74
|
+
|
|
75
|
+
if (typeof this.style === 'string') {
|
|
76
|
+
let _style = this.style;
|
|
77
|
+
|
|
78
|
+
if (_style[_style.length - 1] !== ";") {
|
|
79
|
+
_style += ";";
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
_style.split(";").map(item => {
|
|
83
|
+
if (item) {
|
|
84
|
+
let itemArray = item.split(":");
|
|
85
|
+
_styleObj[itemArray[0]] = itemArray[1];
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
//HACK: tenon会存在读到this.style为封装标签的样式 @曹恩泽
|
|
91
|
+
if (typeof this.style === 'object') {
|
|
92
|
+
_styleObj = Object.assign({}, _styleObj, this.style)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
let styleObj = Object.assign({}, _inputWrapStyleObj, _styleObj);
|
|
96
|
+
let style = Object.keys(styleObj)
|
|
97
|
+
.map(k => `${k}:${styleObj[k]}`)
|
|
98
|
+
.join(";");
|
|
99
|
+
|
|
100
|
+
//Tenon变更placeholderColor
|
|
101
|
+
const regex = /color/i
|
|
102
|
+
style += this.placeholderStyle.replace(regex, 'placeholderColor');
|
|
103
|
+
return style;
|
|
104
|
+
},
|
|
45
105
|
},
|
|
46
106
|
watch: {
|
|
47
|
-
value: function(newVal, oldVal) {
|
|
48
|
-
|
|
107
|
+
value: function (newVal, oldVal) {
|
|
108
|
+
console.log(newVal)
|
|
109
|
+
if (this.originRef && newVal !== this.originRef.value) {
|
|
49
110
|
this.originRef.value = newVal;
|
|
50
111
|
}
|
|
51
112
|
}
|
|
@@ -62,6 +123,9 @@ export default {
|
|
|
62
123
|
case "number":
|
|
63
124
|
inputType = "number";
|
|
64
125
|
break;
|
|
126
|
+
case "tel":
|
|
127
|
+
inputType = "tel";
|
|
128
|
+
break;
|
|
65
129
|
default:
|
|
66
130
|
inputType = "text";
|
|
67
131
|
}
|
|
@@ -69,13 +133,16 @@ export default {
|
|
|
69
133
|
|
|
70
134
|
const data = {
|
|
71
135
|
class: "mpx-input",
|
|
72
|
-
|
|
136
|
+
focused: this.focus,
|
|
73
137
|
ref: "mpx-input",
|
|
74
138
|
placeholder: this.placeholder,
|
|
75
|
-
maxLength: this.
|
|
139
|
+
maxLength: this.maxlength,
|
|
76
140
|
type: inputType,
|
|
77
141
|
disabled: this.disabled,
|
|
78
|
-
|
|
142
|
+
style: this.computedStyle,
|
|
143
|
+
returnKeyType: this.confirmType,
|
|
144
|
+
value: this.value,
|
|
145
|
+
...getInnerListeners(this, { _input: true }),
|
|
79
146
|
};
|
|
80
147
|
return h("input", data, []);
|
|
81
148
|
},
|
|
@@ -9,10 +9,15 @@ export default {
|
|
|
9
9
|
value: {}
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
|
+
computed: {
|
|
13
|
+
originRef() {
|
|
14
|
+
return this.$refs["mpx-richtext"]
|
|
15
|
+
}
|
|
16
|
+
},
|
|
12
17
|
render () {
|
|
13
|
-
|
|
14
18
|
const data = {
|
|
15
19
|
richText: this.richText,
|
|
20
|
+
ref: "mpx-richtext",
|
|
16
21
|
...getInnerListeners(this)
|
|
17
22
|
}
|
|
18
23
|
return h('text', data)
|
|
@@ -39,11 +39,17 @@ export default {
|
|
|
39
39
|
"text",
|
|
40
40
|
{
|
|
41
41
|
class: classNames,
|
|
42
|
+
ref: "mpx-text",
|
|
42
43
|
...getInnerListeners(this),
|
|
43
44
|
},
|
|
44
45
|
text
|
|
45
46
|
);
|
|
46
47
|
},
|
|
48
|
+
computed: {
|
|
49
|
+
originRef() {
|
|
50
|
+
return this.$refs["mpx-text"]
|
|
51
|
+
}
|
|
52
|
+
},
|
|
47
53
|
data() {
|
|
48
54
|
return {};
|
|
49
55
|
},
|
|
@@ -31,8 +31,15 @@ export default {
|
|
|
31
31
|
type: Number,
|
|
32
32
|
default: -1,
|
|
33
33
|
},
|
|
34
|
+
placeholderStyle: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: '',
|
|
37
|
+
},
|
|
38
|
+
confirmType: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: 'return',
|
|
41
|
+
}
|
|
34
42
|
},
|
|
35
|
-
|
|
36
43
|
computed: {
|
|
37
44
|
originRef() {
|
|
38
45
|
return this.$refs["mpx-textarea"]
|
|
@@ -51,9 +58,11 @@ export default {
|
|
|
51
58
|
class: "mpx-textarea",
|
|
52
59
|
ref: "mpx-textarea",
|
|
53
60
|
focus: this.focus,
|
|
61
|
+
value: this.value,
|
|
54
62
|
placeholder: this.placeholder,
|
|
55
|
-
maxLength: this.
|
|
63
|
+
maxLength: this.maxlength,
|
|
56
64
|
disabled: this.disabled,
|
|
65
|
+
returnKeyType: this.confirmType,
|
|
57
66
|
...getInnerListeners(this),
|
|
58
67
|
};
|
|
59
68
|
return h("textarea", data);
|
|
@@ -1918,7 +1918,7 @@ function postProcessTemplate (el) {
|
|
|
1918
1918
|
}
|
|
1919
1919
|
}
|
|
1920
1920
|
|
|
1921
|
-
const isValidMode = makeMap('wx,ali,swan,tt,qq,web,qa,jd,dd,noMode')
|
|
1921
|
+
const isValidMode = makeMap('wx,ali,swan,tt,qq,web,qa,jd,dd,tenon,noMode')
|
|
1922
1922
|
|
|
1923
1923
|
const wrapRE = /^\((.*)\)$/
|
|
1924
1924
|
|
package/lib/tenon/processJSON.js
CHANGED
|
@@ -129,16 +129,12 @@ module.exports = function (json, options, rawCallback) {
|
|
|
129
129
|
defs,
|
|
130
130
|
env
|
|
131
131
|
})
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
callback(err, result, content)
|
|
138
|
-
})
|
|
139
|
-
}
|
|
132
|
+
getJSONContent(parts.json || {}, result, loaderContext, (err, content) => {
|
|
133
|
+
callback(err, result, content)
|
|
134
|
+
})
|
|
135
|
+
} else {
|
|
136
|
+
callback(null, result, content)
|
|
140
137
|
}
|
|
141
|
-
callback(null, result, content)
|
|
142
138
|
},
|
|
143
139
|
(result, content, callback) => {
|
|
144
140
|
try {
|
|
@@ -254,7 +254,7 @@ module.exports = function (script, options, callback) {
|
|
|
254
254
|
let dynamicPageStr = ''
|
|
255
255
|
async.each(localPagesMap, (pageCfg, callback) => {
|
|
256
256
|
if (typeof pageCfg !== 'string') pageCfg.src = addQuery(pageCfg.src, { tenon: true })
|
|
257
|
-
processPage(pageCfg, loaderContext.context, '', (err, entry, { key }) => {
|
|
257
|
+
processPage(pageCfg, loaderContext.context, '', (err, entry, { key } = {}) => {
|
|
258
258
|
if (err) return callback()
|
|
259
259
|
if (pageSet.has(key)) return callback()
|
|
260
260
|
pageSet.add(key)
|
|
@@ -4,7 +4,8 @@ const coreVersion = require('@mpxjs/core/package.json').version
|
|
|
4
4
|
const packageName = require('../../package.json').name
|
|
5
5
|
const packageVersion = require('../../package.json').version
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// skip check prerelease version
|
|
8
|
+
if (!/-\w+$/.test(packageVersion) && packageVersion.slice(0, 3) !== coreVersion.slice(0, 3)) {
|
|
8
9
|
const corePath = require.resolve('@mpxjs/core')
|
|
9
10
|
const packagePath = require.resolve('../../package.json')
|
|
10
11
|
throw new Error(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.8.25-alpha.
|
|
3
|
+
"version": "2.8.25-alpha.20",
|
|
4
4
|
"description": "mpx compile core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mpx"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@better-scroll/wheel": "^2.2.1",
|
|
29
29
|
"@better-scroll/zoom": "^2.2.1",
|
|
30
30
|
"@hummer/tenon-dev-server-webpack-plugin": "0.0.2",
|
|
31
|
-
"@hummer/tenon-loader": "^1.
|
|
31
|
+
"@hummer/tenon-loader": "^1.2.0",
|
|
32
32
|
"@hummer/tenon-style-loader": "^0.2.0",
|
|
33
33
|
"acorn-walk": "^7.2.0",
|
|
34
34
|
"async": "^2.6.0",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"engines": {
|
|
86
86
|
"node": ">=14.14.0"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "349316191b4100a2abcf8286aba3ad94e6104618"
|
|
89
89
|
}
|