@mpxjs/webpack-plugin 2.10.3 → 2.10.4
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/config.js +2 -1
- package/lib/index.js +1 -1
- package/lib/platform/json/wx/index.js +6 -3
- package/lib/platform/style/wx/index.js +23 -12
- package/lib/platform/template/wx/component-config/button.js +19 -2
- package/lib/platform/template/wx/component-config/canvas.js +4 -0
- package/lib/platform/template/wx/component-config/checkbox-group.js +4 -0
- package/lib/platform/template/wx/component-config/checkbox.js +4 -0
- package/lib/platform/template/wx/component-config/cover-image.js +7 -1
- package/lib/platform/template/wx/component-config/cover-view.js +4 -0
- package/lib/platform/template/wx/component-config/fix-component-name.js +3 -2
- package/lib/platform/template/wx/component-config/form.js +7 -1
- package/lib/platform/template/wx/component-config/icon.js +4 -0
- package/lib/platform/template/wx/component-config/image.js +7 -1
- package/lib/platform/template/wx/component-config/input.js +18 -3
- package/lib/platform/template/wx/component-config/label.js +4 -0
- package/lib/platform/template/wx/component-config/movable-area.js +7 -1
- package/lib/platform/template/wx/component-config/movable-view.js +12 -3
- package/lib/platform/template/wx/component-config/navigator.js +4 -0
- package/lib/platform/template/wx/component-config/picker-view-column.js +4 -0
- package/lib/platform/template/wx/component-config/picker-view.js +7 -1
- package/lib/platform/template/wx/component-config/picker.js +7 -1
- package/lib/platform/template/wx/component-config/radio-group.js +4 -0
- package/lib/platform/template/wx/component-config/radio.js +4 -0
- package/lib/platform/template/wx/component-config/rich-text.js +4 -0
- package/lib/platform/template/wx/component-config/root-portal.js +4 -0
- package/lib/platform/template/wx/component-config/scroll-view.js +10 -2
- package/lib/platform/template/wx/component-config/swiper-item.js +7 -1
- package/lib/platform/template/wx/component-config/swiper.js +12 -3
- package/lib/platform/template/wx/component-config/switch.js +4 -0
- package/lib/platform/template/wx/component-config/text.js +24 -3
- package/lib/platform/template/wx/component-config/textarea.js +17 -2
- package/lib/platform/template/wx/component-config/unsupported.js +7 -0
- package/lib/platform/template/wx/component-config/video.js +10 -2
- package/lib/platform/template/wx/component-config/view.js +11 -1
- package/lib/platform/template/wx/component-config/web-view.js +4 -0
- package/lib/platform/template/wx/index.js +42 -75
- package/lib/react/processScript.js +1 -18
- package/lib/runtime/components/react/dist/event.config.js +1 -0
- package/lib/runtime/components/react/dist/getInnerListeners.js +18 -7
- package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +1 -1
- package/lib/runtime/components/react/dist/mpx-inline-text.jsx +11 -0
- package/lib/runtime/components/react/dist/mpx-input.jsx +3 -6
- package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-picker/date.jsx +194 -68
- package/lib/runtime/components/react/dist/mpx-picker/dateData.js +17 -0
- package/lib/runtime/components/react/dist/mpx-picker/index.jsx +178 -96
- package/lib/runtime/components/react/dist/mpx-picker/multiSelector.jsx +79 -139
- package/lib/runtime/components/react/dist/mpx-picker/region.jsx +190 -90
- package/lib/runtime/components/react/dist/mpx-picker/selector.jsx +60 -75
- package/lib/runtime/components/react/dist/mpx-picker/time.jsx +100 -228
- package/lib/runtime/components/react/dist/{mpx-picker-view.jsx → mpx-picker-view/index.jsx} +3 -3
- package/lib/runtime/components/react/dist/{mpx-picker-view-column.jsx → mpx-picker-view-column/index.jsx} +64 -16
- package/lib/runtime/components/react/dist/{mpx-picker-view-column-item.jsx → mpx-picker-view-column/pickerViewColumnItem.jsx} +8 -5
- package/lib/runtime/components/react/dist/{pickerFaces.js → mpx-picker-view-column/pickerViewFaces.js} +6 -0
- package/lib/runtime/components/react/dist/mpx-popup/index.jsx +61 -0
- package/lib/runtime/components/react/dist/mpx-popup/popupBase.jsx +92 -0
- package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +192 -25
- package/lib/runtime/components/react/dist/mpx-simple-text.jsx +8 -7
- package/lib/runtime/components/react/dist/mpx-simple-view.jsx +11 -15
- package/lib/runtime/components/react/dist/mpx-video.jsx +3 -3
- package/lib/runtime/components/react/dist/mpx-web-view.jsx +7 -4
- package/lib/runtime/components/react/dist/utils.jsx +2 -1
- package/lib/runtime/components/react/event.config.ts +2 -0
- package/lib/runtime/components/react/getInnerListeners.ts +28 -25
- package/lib/runtime/components/react/mpx-canvas/index.tsx +2 -2
- package/lib/runtime/components/react/mpx-inline-text.tsx +18 -0
- package/lib/runtime/components/react/mpx-input.tsx +2 -6
- package/lib/runtime/components/react/mpx-keyboard-avoiding-view.tsx +1 -1
- package/lib/runtime/components/react/mpx-picker/date.tsx +226 -69
- package/lib/runtime/components/react/mpx-picker/dateData.ts +22 -0
- package/lib/runtime/components/react/mpx-picker/index.tsx +239 -118
- package/lib/runtime/components/react/mpx-picker/multiSelector.tsx +96 -139
- package/lib/runtime/components/react/mpx-picker/region.tsx +217 -89
- package/lib/runtime/components/react/mpx-picker/selector.tsx +75 -80
- package/lib/runtime/components/react/mpx-picker/time.tsx +119 -236
- package/lib/runtime/components/react/mpx-picker/type.ts +85 -71
- package/lib/runtime/components/react/{mpx-picker-view.tsx → mpx-picker-view/index.tsx} +7 -7
- package/lib/runtime/components/react/{mpx-picker-view-column.tsx → mpx-picker-view-column/index.tsx} +70 -19
- package/lib/runtime/components/react/{mpx-picker-view-column-item.tsx → mpx-picker-view-column/pickerViewColumnItem.tsx} +8 -5
- package/lib/runtime/components/react/{pickerFaces.ts → mpx-picker-view-column/pickerViewFaces.ts} +7 -0
- package/lib/runtime/components/react/mpx-popup/index.tsx +86 -0
- package/lib/runtime/components/react/mpx-popup/popupBase.tsx +130 -0
- package/lib/runtime/components/react/mpx-scroll-view.tsx +249 -43
- package/lib/runtime/components/react/mpx-simple-text.tsx +10 -8
- package/lib/runtime/components/react/mpx-simple-view.tsx +11 -16
- package/lib/runtime/components/react/mpx-video.tsx +2 -2
- package/lib/runtime/components/react/mpx-web-view.tsx +7 -4
- package/lib/runtime/components/react/types/getInnerListeners.d.ts +5 -1
- package/lib/runtime/components/react/types/global.d.ts +1 -1
- package/lib/runtime/components/react/utils.tsx +3 -2
- package/lib/runtime/components/web/mini-video-controls.min.js +1 -1
- package/lib/runtime/components/web/mpx-input.vue +1 -1
- package/lib/runtime/stringify.wxs +2 -2
- package/lib/template-compiler/compiler.js +8 -8
- package/lib/utils/env.js +1 -1
- package/package.json +4 -5
- /package/lib/runtime/components/react/dist/{pickerVIewContext.js → mpx-picker-view/pickerVIewContext.js} +0 -0
- /package/lib/runtime/components/react/dist/{pickerViewIndicator.jsx → mpx-picker-view-column/pickerViewIndicator.jsx} +0 -0
- /package/lib/runtime/components/react/dist/{pickerViewMask.jsx → mpx-picker-view-column/pickerViewMask.jsx} +0 -0
- /package/lib/runtime/components/react/{pickerVIewContext.ts → mpx-picker-view/pickerVIewContext.ts} +0 -0
- /package/lib/runtime/components/react/{pickerViewIndicator.tsx → mpx-picker-view-column/pickerViewIndicator.tsx} +0 -0
- /package/lib/runtime/components/react/{pickerViewMask.tsx → mpx-picker-view-column/pickerViewMask.tsx} +0 -0
|
@@ -14,6 +14,8 @@ module.exports = function ({ print }) {
|
|
|
14
14
|
const qqPropLog = print({ platform: 'qq', tag: TAG_NAME, isError: false })
|
|
15
15
|
const androidEventLog = print({ platform: 'android', tag: TAG_NAME, isError: false, type: 'event' })
|
|
16
16
|
const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
|
|
17
|
+
const harmonyEventLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false, type: 'event' })
|
|
18
|
+
const harmonyPropLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false })
|
|
17
19
|
const iosEventLog = print({ platform: 'ios', tag: TAG_NAME, isError: false, type: 'event' })
|
|
18
20
|
const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
|
|
19
21
|
|
|
@@ -27,6 +29,10 @@ module.exports = function ({ print }) {
|
|
|
27
29
|
el.isBuiltIn = true
|
|
28
30
|
return 'mpx-scroll-view'
|
|
29
31
|
},
|
|
32
|
+
harmony (tag, { el }) {
|
|
33
|
+
el.isBuiltIn = true
|
|
34
|
+
return 'mpx-scroll-view'
|
|
35
|
+
},
|
|
30
36
|
ios (tag, { el }) {
|
|
31
37
|
el.isBuiltIn = true
|
|
32
38
|
return 'mpx-scroll-view'
|
|
@@ -55,7 +61,8 @@ module.exports = function ({ print }) {
|
|
|
55
61
|
{
|
|
56
62
|
test: /^(refresher-threshold|enable-passive|scroll-anchoring|using-sticky|fast-deceleration|enable-flex)$/,
|
|
57
63
|
android: androidPropLog,
|
|
58
|
-
ios: iosPropLog
|
|
64
|
+
ios: iosPropLog,
|
|
65
|
+
harmony: harmonyPropLog
|
|
59
66
|
},
|
|
60
67
|
{
|
|
61
68
|
test: /^(refresher-default-style|refresher-background)$/,
|
|
@@ -88,7 +95,8 @@ module.exports = function ({ print }) {
|
|
|
88
95
|
{
|
|
89
96
|
test: /^(refresherpulling|refresherrestore|refresherabort)$/,
|
|
90
97
|
android: androidEventLog,
|
|
91
|
-
ios: iosEventLog
|
|
98
|
+
ios: iosEventLog,
|
|
99
|
+
harmony: harmonyEventLog
|
|
92
100
|
}
|
|
93
101
|
]
|
|
94
102
|
}
|
|
@@ -8,6 +8,7 @@ module.exports = function ({ print }) {
|
|
|
8
8
|
const qqPropLog = print({ platform: 'qq', tag: TAG_NAME, isError: false })
|
|
9
9
|
const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
|
|
10
10
|
const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
|
|
11
|
+
const harmonyPropLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false })
|
|
11
12
|
|
|
12
13
|
return {
|
|
13
14
|
test: TAG_NAME,
|
|
@@ -23,12 +24,17 @@ module.exports = function ({ print }) {
|
|
|
23
24
|
el.isBuiltIn = true
|
|
24
25
|
return 'mpx-swiper-item'
|
|
25
26
|
},
|
|
27
|
+
harmony (tag, { el }) {
|
|
28
|
+
el.isBuiltIn = true
|
|
29
|
+
return 'mpx-swiper-item'
|
|
30
|
+
},
|
|
26
31
|
props: [
|
|
27
32
|
{
|
|
28
33
|
test: /^(item-id)$/,
|
|
29
34
|
ali: aliPropLog,
|
|
30
35
|
ios: iosPropLog,
|
|
31
|
-
android: androidPropLog
|
|
36
|
+
android: androidPropLog,
|
|
37
|
+
harmony: harmonyPropLog
|
|
32
38
|
},
|
|
33
39
|
{
|
|
34
40
|
test: /^(skip-hidden-item-layout)$/,
|
|
@@ -14,6 +14,8 @@ module.exports = function ({ print }) {
|
|
|
14
14
|
const iosEventLog = print({ platform: 'ios', tag: TAG_NAME, isError: false, type: 'event' })
|
|
15
15
|
const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
|
|
16
16
|
const androidEventLog = print({ platform: 'android', tag: TAG_NAME, isError: false, type: 'event' })
|
|
17
|
+
const harmonyPropLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false })
|
|
18
|
+
const harmonyEventLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false, type: 'event' })
|
|
17
19
|
|
|
18
20
|
return {
|
|
19
21
|
test: TAG_NAME,
|
|
@@ -29,6 +31,10 @@ module.exports = function ({ print }) {
|
|
|
29
31
|
el.isBuiltIn = true
|
|
30
32
|
return 'mpx-swiper'
|
|
31
33
|
},
|
|
34
|
+
harmony (tag, { el }) {
|
|
35
|
+
el.isBuiltIn = true
|
|
36
|
+
return 'mpx-swiper'
|
|
37
|
+
},
|
|
32
38
|
props: [
|
|
33
39
|
{
|
|
34
40
|
test: /^(display-multiple-items|skip-hidden-item-layout)$/,
|
|
@@ -61,7 +67,8 @@ module.exports = function ({ print }) {
|
|
|
61
67
|
{
|
|
62
68
|
test: /^(display-multiple-items|snap-to-edge|easing-function)$/,
|
|
63
69
|
ios: iosPropLog,
|
|
64
|
-
android: androidPropLog
|
|
70
|
+
android: androidPropLog,
|
|
71
|
+
harmony: harmonyPropLog
|
|
65
72
|
}
|
|
66
73
|
],
|
|
67
74
|
event: [
|
|
@@ -80,12 +87,14 @@ module.exports = function ({ print }) {
|
|
|
80
87
|
swan: baiduEventLog,
|
|
81
88
|
jd: jdEventLog,
|
|
82
89
|
ios: iosEventLog,
|
|
83
|
-
android: androidEventLog
|
|
90
|
+
android: androidEventLog,
|
|
91
|
+
harmony: harmonyEventLog
|
|
84
92
|
},
|
|
85
93
|
{
|
|
86
94
|
test: /^(animationfinish)$/,
|
|
87
95
|
ios: iosEventLog,
|
|
88
|
-
android: androidEventLog
|
|
96
|
+
android: androidEventLog,
|
|
97
|
+
harmony: harmonyEventLog
|
|
89
98
|
}
|
|
90
99
|
]
|
|
91
100
|
}
|
|
@@ -8,6 +8,7 @@ module.exports = function ({ print }) {
|
|
|
8
8
|
const qqPropLog = print({ platform: 'qq', tag: TAG_NAME, isError: false })
|
|
9
9
|
const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
|
|
10
10
|
const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
|
|
11
|
+
const harmonyPropLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false })
|
|
11
12
|
|
|
12
13
|
return {
|
|
13
14
|
test: TAG_NAME,
|
|
@@ -24,11 +25,15 @@ module.exports = function ({ print }) {
|
|
|
24
25
|
},
|
|
25
26
|
ios (tag, { el }) {
|
|
26
27
|
el.isBuiltIn = true
|
|
27
|
-
return 'mpx-text'
|
|
28
|
+
return el.isSimple ? 'mpx-simple-text' : 'mpx-text'
|
|
28
29
|
},
|
|
29
30
|
android (tag, { el }) {
|
|
30
31
|
el.isBuiltIn = true
|
|
31
|
-
return 'mpx-text'
|
|
32
|
+
return el.isSimple ? 'mpx-simple-text' : 'mpx-text'
|
|
33
|
+
},
|
|
34
|
+
harmony (tag, { el }) {
|
|
35
|
+
el.isBuiltIn = true
|
|
36
|
+
return el.isSimple ? 'mpx-simple-text' : 'mpx-text'
|
|
32
37
|
},
|
|
33
38
|
props: [
|
|
34
39
|
{
|
|
@@ -45,7 +50,8 @@ module.exports = function ({ print }) {
|
|
|
45
50
|
{
|
|
46
51
|
test: /^(space|decode)$/,
|
|
47
52
|
ios: iosPropLog,
|
|
48
|
-
android: androidPropLog
|
|
53
|
+
android: androidPropLog,
|
|
54
|
+
harmony: harmonyPropLog
|
|
49
55
|
},
|
|
50
56
|
{
|
|
51
57
|
test: /^(selectable|space|decode|use-built-in)$/,
|
|
@@ -53,6 +59,21 @@ module.exports = function ({ print }) {
|
|
|
53
59
|
el.isBuiltIn = true
|
|
54
60
|
},
|
|
55
61
|
qa: qaPropLog
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
test: /^(is-simple)$/,
|
|
65
|
+
android (prop, { el }) {
|
|
66
|
+
el.isSimple = true
|
|
67
|
+
return false
|
|
68
|
+
},
|
|
69
|
+
harmony (prop, { el }) {
|
|
70
|
+
el.isSimple = true
|
|
71
|
+
return false
|
|
72
|
+
},
|
|
73
|
+
ios (prop, { el }) {
|
|
74
|
+
el.isSimple = true
|
|
75
|
+
return false
|
|
76
|
+
}
|
|
56
77
|
}
|
|
57
78
|
]
|
|
58
79
|
}
|
|
@@ -20,6 +20,9 @@ module.exports = function ({ print }) {
|
|
|
20
20
|
const androidValueLogError = print({ platform: 'android', tag: TAG_NAME, isError: true, type: 'value' })
|
|
21
21
|
const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
|
|
22
22
|
const androidEventLog = print({ platform: 'android', tag: TAG_NAME, isError: false, type: 'event' })
|
|
23
|
+
const harmonyValueLogError = print({ platform: 'harmony', tag: TAG_NAME, isError: true, type: 'value' })
|
|
24
|
+
const harmonyPropLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false })
|
|
25
|
+
const harmonyEventLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false, type: 'event' })
|
|
23
26
|
|
|
24
27
|
return {
|
|
25
28
|
test: TAG_NAME,
|
|
@@ -36,6 +39,10 @@ module.exports = function ({ print }) {
|
|
|
36
39
|
el.isBuiltIn = true
|
|
37
40
|
return 'mpx-textarea'
|
|
38
41
|
},
|
|
42
|
+
harmony (tag, { el }) {
|
|
43
|
+
el.isBuiltIn = true
|
|
44
|
+
return 'mpx-textarea'
|
|
45
|
+
},
|
|
39
46
|
props: [
|
|
40
47
|
{
|
|
41
48
|
test: /^(auto-focus|fixed|cursor-spacing|cursor|show-confirm-bar|selection-start|selection-end|adjust-position|hold-keyboard|disable-default-padding|confirm-type)$/,
|
|
@@ -75,12 +82,19 @@ module.exports = function ({ print }) {
|
|
|
75
82
|
if (notSupported.includes(value)) {
|
|
76
83
|
androidValueLogError({ name, value })
|
|
77
84
|
}
|
|
85
|
+
},
|
|
86
|
+
harmony ({ name, value }) {
|
|
87
|
+
const notSupported = ['return']
|
|
88
|
+
if (notSupported.includes(value)) {
|
|
89
|
+
harmonyValueLogError({ name, value })
|
|
90
|
+
}
|
|
78
91
|
}
|
|
79
92
|
},
|
|
80
93
|
{
|
|
81
94
|
test: /^(always-embed|hold-keyboard|disable-default-padding|adjust-keyboard-to|fixed|show-confirm-bar)$/,
|
|
82
95
|
ios: iosPropLog,
|
|
83
|
-
android: androidPropLog
|
|
96
|
+
android: androidPropLog,
|
|
97
|
+
harmony: harmonyPropLog
|
|
84
98
|
}
|
|
85
99
|
],
|
|
86
100
|
event: [
|
|
@@ -109,7 +123,8 @@ module.exports = function ({ print }) {
|
|
|
109
123
|
{
|
|
110
124
|
test: /^keyboard.+$/,
|
|
111
125
|
ios: iosEventLog,
|
|
112
|
-
android: androidEventLog
|
|
126
|
+
android: androidEventLog,
|
|
127
|
+
harmony: harmonyEventLog
|
|
113
128
|
}
|
|
114
129
|
]
|
|
115
130
|
}
|
|
@@ -26,6 +26,7 @@ module.exports = function ({ print }) {
|
|
|
26
26
|
const qaUnsupportedTagError = print({ platform: 'qa', isError: true, type: 'tag' })
|
|
27
27
|
const iosUnsupportedTagError = print({ platform: 'ios', isError: true, type: 'tag' })
|
|
28
28
|
const androidUnsupportedTagError = print({ platform: 'android', isError: true, type: 'tag' })
|
|
29
|
+
const harmonyUnsupportedTagError = print({ platform: 'harmony', isError: true, type: 'tag' })
|
|
29
30
|
|
|
30
31
|
const aliUnsupportedExp = new RegExp('^(' + ALI_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
31
32
|
const baiduUnsupportedExp = new RegExp('^(' + BAIDU_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
@@ -35,6 +36,7 @@ module.exports = function ({ print }) {
|
|
|
35
36
|
const qaUnsupportedExp = new RegExp('^(' + QA_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
36
37
|
const iosUnsupportedExp = new RegExp('^(' + RN_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
37
38
|
const androidUnsupportedExp = new RegExp('^(' + RN_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
39
|
+
const harmonyUnsupportedExp = new RegExp('^(' + RN_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
38
40
|
|
|
39
41
|
return [
|
|
40
42
|
{
|
|
@@ -76,6 +78,11 @@ module.exports = function ({ print }) {
|
|
|
76
78
|
supportedModes: ['android'],
|
|
77
79
|
test: androidUnsupportedExp,
|
|
78
80
|
android: androidUnsupportedTagError
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
supportedModes: ['harmony'],
|
|
84
|
+
test: harmonyUnsupportedExp,
|
|
85
|
+
harmony: harmonyUnsupportedTagError
|
|
79
86
|
}
|
|
80
87
|
]
|
|
81
88
|
}
|
|
@@ -15,6 +15,8 @@ module.exports = function ({ print }) {
|
|
|
15
15
|
const iosEventLogError = print({ platform: 'ios', tag: TAG_NAME, isError: false, type: 'event' })
|
|
16
16
|
const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
|
|
17
17
|
const androidEventLogError = print({ platform: 'android', tag: TAG_NAME, isError: false, type: 'event' })
|
|
18
|
+
const harmonyPropLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false })
|
|
19
|
+
const harmonyEventLogError = print({ platform: 'harmony', tag: TAG_NAME, isError: false, type: 'event' })
|
|
18
20
|
return {
|
|
19
21
|
test: TAG_NAME,
|
|
20
22
|
web (tag, { el }) {
|
|
@@ -25,6 +27,10 @@ module.exports = function ({ print }) {
|
|
|
25
27
|
el.isBuiltIn = true
|
|
26
28
|
return 'mpx-video'
|
|
27
29
|
},
|
|
30
|
+
harmony (tag, { el }) {
|
|
31
|
+
el.isBuiltIn = true
|
|
32
|
+
return 'mpx-video'
|
|
33
|
+
},
|
|
28
34
|
ios (tag, { el }) {
|
|
29
35
|
el.isBuiltIn = true
|
|
30
36
|
return 'mpx-video'
|
|
@@ -66,7 +72,8 @@ module.exports = function ({ print }) {
|
|
|
66
72
|
},
|
|
67
73
|
{
|
|
68
74
|
test: /^(duration|enable-danmu|danmu-btn|page-gesture|direction|show-progress|show-fullscreen-btn|show-center-play-btn|enable-progress-gesture|show-mute-btn|title|play-btn-position|enable-play-gesture|auto-pause-if-navigate|auto-pause-if-open-native|vslide-gesture|vslide-gesture-in-fullscreen|show-bottom-progress|ad-unit-id|poster-for-crawler|show-casting-button|picture-in-picture-mode|picture-in-picture-show-progress| picture-in-picture-init-position|enable-auto-rotation|show-snapshot-button|show-screen-lock-button|show-background-playback-button|background-poster|referrer-policy|is-live)$/,
|
|
69
|
-
android: androidPropLog
|
|
75
|
+
android: androidPropLog,
|
|
76
|
+
harmony: harmonyPropLog
|
|
70
77
|
}
|
|
71
78
|
],
|
|
72
79
|
event: [
|
|
@@ -108,7 +115,8 @@ module.exports = function ({ print }) {
|
|
|
108
115
|
},
|
|
109
116
|
{
|
|
110
117
|
test: /^(progress|enterpictureinpicture|leavepictureinpicture|castinguserselect|castingstatechange|castinginterrupt)$/,
|
|
111
|
-
android: androidEventLogError
|
|
118
|
+
android: androidEventLogError,
|
|
119
|
+
harmony: harmonyEventLogError
|
|
112
120
|
}
|
|
113
121
|
]
|
|
114
122
|
}
|
|
@@ -5,6 +5,7 @@ module.exports = function ({ print }) {
|
|
|
5
5
|
const qaEventLogError = print({ platform: 'qa', tag: TAG_NAME, isError: false, type: 'event' })
|
|
6
6
|
const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
|
|
7
7
|
const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
|
|
8
|
+
const harmonyPropLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false })
|
|
8
9
|
|
|
9
10
|
return {
|
|
10
11
|
// 匹配标签名,可传递正则
|
|
@@ -31,6 +32,10 @@ module.exports = function ({ print }) {
|
|
|
31
32
|
el.isBuiltIn = true
|
|
32
33
|
return el.isSimple ? 'mpx-simple-view' : 'mpx-view'
|
|
33
34
|
},
|
|
35
|
+
harmony (tag, { el }) {
|
|
36
|
+
el.isBuiltIn = true
|
|
37
|
+
return el.isSimple ? 'mpx-simple-view' : 'mpx-view'
|
|
38
|
+
},
|
|
34
39
|
qa (tag) {
|
|
35
40
|
return 'div'
|
|
36
41
|
},
|
|
@@ -46,13 +51,18 @@ module.exports = function ({ print }) {
|
|
|
46
51
|
}, {
|
|
47
52
|
test: /^(hover-stop-propagation)$/,
|
|
48
53
|
android: androidPropLog,
|
|
49
|
-
ios: iosPropLog
|
|
54
|
+
ios: iosPropLog,
|
|
55
|
+
harmony: harmonyPropLog
|
|
50
56
|
}, {
|
|
51
57
|
test: /^(is-simple)$/,
|
|
52
58
|
android (prop, { el }) {
|
|
53
59
|
el.isSimple = true
|
|
54
60
|
return false
|
|
55
61
|
},
|
|
62
|
+
harmony (prop, { el }) {
|
|
63
|
+
el.isSimple = true
|
|
64
|
+
return false
|
|
65
|
+
},
|
|
56
66
|
ios (prop, { el }) {
|
|
57
67
|
el.isSimple = true
|
|
58
68
|
return false
|
|
@@ -8,8 +8,43 @@ const normalize = require('../../../utils/normalize')
|
|
|
8
8
|
const { dash2hump } = require('../../../utils/hump-dash')
|
|
9
9
|
|
|
10
10
|
module.exports = function getSpec ({ warn, error }) {
|
|
11
|
+
function getRnDirectiveEventHandle (mode) {
|
|
12
|
+
return function ({ name, value }, { eventRules, el }) {
|
|
13
|
+
const match = this.test.exec(name)
|
|
14
|
+
const prefix = match[1]
|
|
15
|
+
const eventName = match[2]
|
|
16
|
+
const modifierStr = match[3] || ''
|
|
17
|
+
const meta = {
|
|
18
|
+
modifierStr
|
|
19
|
+
}
|
|
20
|
+
const rPrefix = runRules(spec.event.prefix, prefix, { mode })
|
|
21
|
+
const rEventName = runRules(eventRules, eventName, { mode, data: { el } })
|
|
22
|
+
return {
|
|
23
|
+
name: rPrefix + rEventName + meta.modifierStr,
|
|
24
|
+
value
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function rnEventRulesHandle (eventName) {
|
|
30
|
+
const eventMap = {
|
|
31
|
+
tap: 'tap',
|
|
32
|
+
longtap: 'longpress',
|
|
33
|
+
longpress: 'longpress',
|
|
34
|
+
touchstart: 'touchstart',
|
|
35
|
+
touchmove: 'touchmove',
|
|
36
|
+
touchend: 'touchend',
|
|
37
|
+
touchcancel: 'touchcancel'
|
|
38
|
+
}
|
|
39
|
+
if (eventMap[eventName]) {
|
|
40
|
+
return eventMap[eventName]
|
|
41
|
+
} else {
|
|
42
|
+
error(`React native environment does not support [${eventName}] event!`)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
11
46
|
const spec = {
|
|
12
|
-
supportedModes: ['ali', 'swan', 'qq', 'tt', 'web', 'qa', 'jd', 'dd', 'ios', 'android'],
|
|
47
|
+
supportedModes: ['ali', 'swan', 'qq', 'tt', 'web', 'qa', 'jd', 'dd', 'ios', 'android', 'harmony'],
|
|
13
48
|
// props预处理
|
|
14
49
|
preProps: [],
|
|
15
50
|
// props后处理
|
|
@@ -347,18 +382,6 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
347
382
|
value
|
|
348
383
|
}
|
|
349
384
|
},
|
|
350
|
-
// tt ({ name, value }, { eventRules }) {
|
|
351
|
-
// const match = this.test.exec(name)
|
|
352
|
-
// const prefix = match[1]
|
|
353
|
-
// const eventName = match[2]
|
|
354
|
-
// const modifierStr = match[3] || ''
|
|
355
|
-
// const rEventName = runRules(eventRules, eventName, { mode: 'tt' })
|
|
356
|
-
// return {
|
|
357
|
-
// // 字节将所有事件转为小写
|
|
358
|
-
// name: prefix + rEventName.toLowerCase() + modifierStr,
|
|
359
|
-
// value
|
|
360
|
-
// }
|
|
361
|
-
// },
|
|
362
385
|
tt ({ name, value }, { eventRules }) {
|
|
363
386
|
const match = this.test.exec(name)
|
|
364
387
|
const prefix = match[1]
|
|
@@ -401,36 +424,9 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
401
424
|
value
|
|
402
425
|
}
|
|
403
426
|
},
|
|
404
|
-
ios (
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
const eventName = match[2]
|
|
408
|
-
const modifierStr = match[3] || ''
|
|
409
|
-
const meta = {
|
|
410
|
-
modifierStr
|
|
411
|
-
}
|
|
412
|
-
const rPrefix = runRules(spec.event.prefix, prefix, { mode: 'ios' })
|
|
413
|
-
const rEventName = runRules(eventRules, eventName, { mode: 'ios', data: { el } })
|
|
414
|
-
return {
|
|
415
|
-
name: rPrefix + rEventName + meta.modifierStr,
|
|
416
|
-
value
|
|
417
|
-
}
|
|
418
|
-
},
|
|
419
|
-
android ({ name, value }, { eventRules, el }) {
|
|
420
|
-
const match = this.test.exec(name)
|
|
421
|
-
const prefix = match[1]
|
|
422
|
-
const eventName = match[2]
|
|
423
|
-
const modifierStr = match[3] || ''
|
|
424
|
-
const meta = {
|
|
425
|
-
modifierStr
|
|
426
|
-
}
|
|
427
|
-
const rPrefix = runRules(spec.event.prefix, prefix, { mode: 'android' })
|
|
428
|
-
const rEventName = runRules(eventRules, eventName, { mode: 'android', data: { el } })
|
|
429
|
-
return {
|
|
430
|
-
name: rPrefix + rEventName + meta.modifierStr,
|
|
431
|
-
value
|
|
432
|
-
}
|
|
433
|
-
}
|
|
427
|
+
ios: getRnDirectiveEventHandle('ios'),
|
|
428
|
+
android: getRnDirectiveEventHandle('android'),
|
|
429
|
+
harmony: getRnDirectiveEventHandle('harmony')
|
|
434
430
|
},
|
|
435
431
|
// 无障碍
|
|
436
432
|
{
|
|
@@ -534,38 +530,9 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
534
530
|
error(`Web environment does not support [${eventName}] event!`)
|
|
535
531
|
}
|
|
536
532
|
},
|
|
537
|
-
ios
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
longtap: 'longpress',
|
|
541
|
-
longpress: 'longpress',
|
|
542
|
-
touchstart: 'touchstart',
|
|
543
|
-
touchmove: 'touchmove',
|
|
544
|
-
touchend: 'touchend',
|
|
545
|
-
touchcancel: 'touchcancel'
|
|
546
|
-
}
|
|
547
|
-
if (eventMap[eventName]) {
|
|
548
|
-
return eventMap[eventName]
|
|
549
|
-
} else {
|
|
550
|
-
error(`React native environment does not support [${eventName}] event!`)
|
|
551
|
-
}
|
|
552
|
-
},
|
|
553
|
-
android (eventName) {
|
|
554
|
-
const eventMap = {
|
|
555
|
-
tap: 'tap',
|
|
556
|
-
longtap: 'longpress',
|
|
557
|
-
longpress: 'longpress',
|
|
558
|
-
touchstart: 'touchstart',
|
|
559
|
-
touchmove: 'touchmove',
|
|
560
|
-
touchend: 'touchend',
|
|
561
|
-
touchcancel: 'touchcancel'
|
|
562
|
-
}
|
|
563
|
-
if (eventMap[eventName]) {
|
|
564
|
-
return eventMap[eventName]
|
|
565
|
-
} else {
|
|
566
|
-
error(`React native environment does not support [${eventName}] event!`)
|
|
567
|
-
}
|
|
568
|
-
}
|
|
533
|
+
ios: rnEventRulesHandle,
|
|
534
|
+
android: rnEventRulesHandle,
|
|
535
|
+
harmony: rnEventRulesHandle
|
|
569
536
|
},
|
|
570
537
|
// web event escape
|
|
571
538
|
{
|
|
@@ -17,7 +17,6 @@ module.exports = function (script, {
|
|
|
17
17
|
genericsInfo
|
|
18
18
|
}, callback) {
|
|
19
19
|
let scriptSrcMode = srcMode
|
|
20
|
-
const mode = loaderContext.getMpx().mode
|
|
21
20
|
if (script) {
|
|
22
21
|
scriptSrcMode = script.mode || scriptSrcMode
|
|
23
22
|
} else {
|
|
@@ -28,23 +27,7 @@ module.exports = function (script, {
|
|
|
28
27
|
if (ctorType === 'app') {
|
|
29
28
|
output += `
|
|
30
29
|
import { getComponent } from ${stringifyRequest(loaderContext, optionProcessorPath)}
|
|
31
|
-
|
|
32
|
-
${mode === 'ios' ? "import { createNativeStackNavigator as createStackNavigator } from '@react-navigation/native-stack'" : "import { createStackNavigator } from '@react-navigation/stack'"}
|
|
33
|
-
import PortalHost from '@mpxjs/webpack-plugin/lib/runtime/components/react/dist/mpx-portal/portal-host'
|
|
34
|
-
import { useHeaderHeight } from '@react-navigation/elements';
|
|
35
|
-
import { SafeAreaProvider, useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
36
|
-
import { GestureHandlerRootView } from 'react-native-gesture-handler'
|
|
37
|
-
|
|
38
|
-
global.__navigationHelper = {
|
|
39
|
-
NavigationContainer: NavigationContainer,
|
|
40
|
-
createStackNavigator: createStackNavigator,
|
|
41
|
-
useHeaderHeight: useHeaderHeight,
|
|
42
|
-
StackActions: StackActions,
|
|
43
|
-
GestureHandlerRootView: GestureHandlerRootView,
|
|
44
|
-
PortalHost: PortalHost,
|
|
45
|
-
SafeAreaProvider: SafeAreaProvider,
|
|
46
|
-
useSafeAreaInsets: useSafeAreaInsets
|
|
47
|
-
}\n`
|
|
30
|
+
\n`
|
|
48
31
|
const { pagesMap, firstPage } = buildPagesMap({
|
|
49
32
|
localPagesMap,
|
|
50
33
|
loaderContext,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export const TAP_EVENTS = ['bindtap', 'catchtap', 'capture-bindtap', 'capture-catchtap'];
|
|
2
|
+
export const LONGPRESS_EVENTS = ['bindlongpress', 'catchlongpress', 'capture-bindlongpress', 'capture-catchlongpress'];
|
|
2
3
|
const eventConfigMap = {
|
|
3
4
|
bindtap: { bitFlag: '0', events: ['onTouchStart', 'onTouchMove', 'onTouchEnd'] },
|
|
4
5
|
bindlongpress: { bitFlag: '1', events: ['onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel'] },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useRef, useMemo } from 'react';
|
|
2
2
|
import { hasOwn, collectDataset } from '@mpxjs/utils';
|
|
3
3
|
import { omit, extendObject, useNavigation } from './utils';
|
|
4
|
-
import eventConfigMap, { TAP_EVENTS } from './event.config';
|
|
4
|
+
import eventConfigMap, { TAP_EVENTS, LONGPRESS_EVENTS } from './event.config';
|
|
5
5
|
const globalEventState = {
|
|
6
6
|
needPress: true
|
|
7
7
|
};
|
|
@@ -74,8 +74,23 @@ function handleEmitEvent(events, type, oe, propsRef, config, navigation) {
|
|
|
74
74
|
events.forEach((event) => {
|
|
75
75
|
if (propsRef.current[event]) {
|
|
76
76
|
const match = /^(catch|capture-catch):?(.*?)(?:\.(.*))?$/.exec(event);
|
|
77
|
+
// 检查是否已经被上层的 catch 阻止
|
|
78
|
+
if ((type === 'tap' || type === 'longpress') && oe._stoppedEventTypes?.has(type)) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
77
81
|
if (match) {
|
|
78
|
-
|
|
82
|
+
const eventBase = match[2] || '';
|
|
83
|
+
if (eventBase === 'tap' || eventBase === 'longpress') {
|
|
84
|
+
// 为 tap、longpress 添加标记,影响后续的冒泡
|
|
85
|
+
if (!oe._stoppedEventTypes) {
|
|
86
|
+
oe._stoppedEventTypes = new Set();
|
|
87
|
+
}
|
|
88
|
+
oe._stoppedEventTypes.add(eventBase);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
// 原生 touch 事件使用 stopPropagation
|
|
92
|
+
oe.stopPropagation();
|
|
93
|
+
}
|
|
79
94
|
}
|
|
80
95
|
propsRef.current[event](getTouchEvent(type, oe, propsRef.current, config, navigation));
|
|
81
96
|
}
|
|
@@ -116,11 +131,7 @@ function handleTouchstart(e, type, ref, propsRef, config, navigation) {
|
|
|
116
131
|
const currentTouchEvent = type === 'bubble' ? bubbleTouchEvent : captureTouchEvent;
|
|
117
132
|
const currentPressEvent = type === 'bubble' ? bubblePressEvent : capturePressEvent;
|
|
118
133
|
handleEmitEvent(currentTouchEvent, 'touchstart', e, propsRef, config, navigation);
|
|
119
|
-
|
|
120
|
-
if (catchlongpress ||
|
|
121
|
-
bindlongpress ||
|
|
122
|
-
captureCatchlongpress ||
|
|
123
|
-
captureBindlongpress) {
|
|
134
|
+
if (LONGPRESS_EVENTS.some(eventName => propsRef.current[eventName])) {
|
|
124
135
|
ref.current.startTimer[type] = setTimeout(() => {
|
|
125
136
|
// 只要触发过longpress, 全局就不再触发tap
|
|
126
137
|
globalEventState.needPress = false;
|
|
@@ -193,7 +193,7 @@ const _Canvas = forwardRef((props = {}, ref) => {
|
|
|
193
193
|
node: canvasRef.current,
|
|
194
194
|
context: context2D
|
|
195
195
|
});
|
|
196
|
-
if (
|
|
196
|
+
if (__mpx_mode__ !== 'ios') {
|
|
197
197
|
const isAndroid9 = Platform.Version >= 28;
|
|
198
198
|
return createElement(View, innerProps, createElement(WebView, {
|
|
199
199
|
ref: (element) => {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Text } from 'react-native';
|
|
2
|
+
import { createElement } from 'react';
|
|
3
|
+
import { extendObject } from './utils';
|
|
4
|
+
const InlineText = (props) => {
|
|
5
|
+
const { allowFontScaling = false } = props;
|
|
6
|
+
return createElement(Text, extendObject({}, props, {
|
|
7
|
+
allowFontScaling
|
|
8
|
+
}));
|
|
9
|
+
};
|
|
10
|
+
InlineText.displayName = 'MpxInlineText';
|
|
11
|
+
export default InlineText;
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
* ✘ bind:onkeyboardheightchange
|
|
39
39
|
*/
|
|
40
40
|
import { forwardRef, useRef, useState, useContext, useEffect, createElement } from 'react';
|
|
41
|
-
import {
|
|
41
|
+
import { TextInput } from 'react-native';
|
|
42
42
|
import { warn } from '@mpxjs/utils';
|
|
43
|
-
import { useUpdateEffect, useTransformStyle, useLayout, extendObject } from './utils';
|
|
43
|
+
import { useUpdateEffect, useTransformStyle, useLayout, extendObject, isIOS } from './utils';
|
|
44
44
|
import useInnerProps, { getCustomEvent } from './getInnerListeners';
|
|
45
45
|
import useNodesRef from './useNodesRef';
|
|
46
46
|
import { FormContext, KeyboardAvoidContext } from './context';
|
|
@@ -48,10 +48,7 @@ const keyboardTypeMap = {
|
|
|
48
48
|
text: 'default',
|
|
49
49
|
number: 'numeric',
|
|
50
50
|
idcard: 'default',
|
|
51
|
-
digit:
|
|
52
|
-
ios: 'decimal-pad',
|
|
53
|
-
android: 'numeric'
|
|
54
|
-
}) || ''
|
|
51
|
+
digit: isIOS ? 'decimal-pad' : 'numeric'
|
|
55
52
|
};
|
|
56
53
|
const Input = forwardRef((props, ref) => {
|
|
57
54
|
const { style = {}, allowFontScaling = false, type = 'text', value, password, 'placeholder-style': placeholderStyle = {}, disabled, maxlength = 140, 'cursor-spacing': cursorSpacing = 0, 'auto-focus': autoFocus, focus, 'confirm-type': confirmType = 'done', 'confirm-hold': confirmHold = false, cursor, 'cursor-color': cursorColor, 'selection-start': selectionStart = -1, 'selection-end': selectionEnd = -1, 'enable-var': enableVar, 'external-var-context': externalVarContext, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight, 'adjust-position': adjustPosition = true, bindinput, bindfocus, bindblur, bindconfirm, bindselectionchange,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useContext, useEffect, useMemo } from 'react';
|
|
2
|
-
import { Keyboard,
|
|
2
|
+
import { Keyboard, View } from 'react-native';
|
|
3
3
|
import Animated, { useSharedValue, useAnimatedStyle, withTiming, Easing } from 'react-native-reanimated';
|
|
4
4
|
import { GestureDetector, Gesture } from 'react-native-gesture-handler';
|
|
5
5
|
import { KeyboardAvoidContext } from './context';
|
|
6
|
+
import { isIOS } from './utils';
|
|
6
7
|
const KeyboardAvoidingView = ({ children, style, contentContainerStyle }) => {
|
|
7
|
-
const isIOS = Platform.OS === 'ios';
|
|
8
8
|
const duration = isIOS ? 250 : 300;
|
|
9
9
|
const easing = isIOS ? Easing.inOut(Easing.ease) : Easing.out(Easing.quad);
|
|
10
10
|
const offset = useSharedValue(0);
|