@mpxjs/webpack-plugin 2.10.3-beta.6 → 2.10.4-beta.10
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/index.js +1 -1
- package/lib/platform/json/wx/index.js +0 -1
- package/lib/platform/style/wx/index.js +22 -21
- package/lib/platform/template/wx/component-config/button.js +1 -1
- package/lib/platform/template/wx/component-config/index.js +5 -1
- package/lib/platform/template/wx/component-config/input.js +2 -2
- package/lib/platform/template/wx/component-config/sticky-header.js +23 -0
- package/lib/platform/template/wx/component-config/sticky-section.js +23 -0
- package/lib/platform/template/wx/component-config/text.js +18 -3
- package/lib/platform/template/wx/component-config/view.js +0 -2
- package/lib/platform/template/wx/index.js +41 -93
- package/lib/react/processJSON.js +7 -6
- package/lib/react/processScript.js +1 -18
- package/lib/runtime/components/react/context.ts +12 -3
- package/lib/runtime/components/react/dist/context.js +4 -1
- package/lib/runtime/components/react/dist/event.config.js +0 -1
- package/lib/runtime/components/react/dist/getInnerListeners.js +127 -142
- package/lib/runtime/components/react/dist/mpx-button.jsx +4 -5
- package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +4 -5
- package/lib/runtime/components/react/dist/mpx-checkbox-group.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-checkbox.jsx +2 -3
- package/lib/runtime/components/react/dist/mpx-form.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-icon/index.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-image.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-inline-text.jsx +11 -0
- package/lib/runtime/components/react/dist/mpx-input.jsx +6 -10
- package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-label.jsx +2 -3
- package/lib/runtime/components/react/dist/mpx-movable-area.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-movable-view.jsx +1 -1
- package/lib/runtime/components/react/dist/mpx-navigator.jsx +11 -3
- 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 +180 -98
- 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} +5 -6
- 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-radio-group.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-radio.jsx +2 -3
- package/lib/runtime/components/react/dist/mpx-rich-text/index.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +207 -29
- package/lib/runtime/components/react/dist/mpx-simple-text.jsx +7 -5
- package/lib/runtime/components/react/dist/mpx-simple-view.jsx +11 -15
- package/lib/runtime/components/react/dist/mpx-sticky-header.jsx +115 -0
- package/lib/runtime/components/react/dist/mpx-sticky-section.jsx +45 -0
- package/lib/runtime/components/react/dist/mpx-swiper-item.jsx +4 -5
- package/lib/runtime/components/react/dist/mpx-swiper.jsx +11 -11
- package/lib/runtime/components/react/dist/mpx-switch.jsx +3 -5
- package/lib/runtime/components/react/dist/mpx-text.jsx +4 -7
- package/lib/runtime/components/react/dist/mpx-video.jsx +5 -5
- package/lib/runtime/components/react/dist/mpx-view.jsx +23 -9
- package/lib/runtime/components/react/dist/mpx-web-view.jsx +17 -17
- package/lib/runtime/components/react/dist/useAnimationHooks.js +26 -4
- package/lib/runtime/components/react/dist/utils.jsx +13 -2
- package/lib/runtime/components/react/event.config.ts +1 -6
- package/lib/runtime/components/react/getInnerListeners.ts +148 -191
- package/lib/runtime/components/react/mpx-button.tsx +7 -7
- package/lib/runtime/components/react/mpx-canvas/index.tsx +25 -17
- package/lib/runtime/components/react/mpx-checkbox-group.tsx +4 -3
- package/lib/runtime/components/react/mpx-checkbox.tsx +8 -9
- package/lib/runtime/components/react/mpx-form.tsx +25 -19
- package/lib/runtime/components/react/mpx-icon/index.tsx +4 -3
- package/lib/runtime/components/react/mpx-image.tsx +4 -3
- package/lib/runtime/components/react/mpx-inline-text.tsx +18 -0
- package/lib/runtime/components/react/mpx-input.tsx +8 -14
- package/lib/runtime/components/react/mpx-keyboard-avoiding-view.tsx +2 -2
- package/lib/runtime/components/react/mpx-label.tsx +4 -5
- package/lib/runtime/components/react/mpx-movable-area.tsx +22 -13
- package/lib/runtime/components/react/mpx-movable-view.tsx +47 -40
- package/lib/runtime/components/react/mpx-navigator.tsx +4 -6
- 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 +242 -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} +24 -21
- 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-radio-group.tsx +4 -3
- package/lib/runtime/components/react/mpx-radio.tsx +8 -9
- package/lib/runtime/components/react/mpx-rich-text/index.tsx +15 -6
- package/lib/runtime/components/react/mpx-scroll-view.tsx +326 -96
- package/lib/runtime/components/react/mpx-simple-text.tsx +17 -8
- package/lib/runtime/components/react/mpx-simple-view.tsx +17 -16
- package/lib/runtime/components/react/mpx-sticky-header.tsx +179 -0
- package/lib/runtime/components/react/mpx-sticky-section.tsx +96 -0
- package/lib/runtime/components/react/mpx-swiper-item.tsx +31 -24
- package/lib/runtime/components/react/mpx-swiper.tsx +69 -65
- package/lib/runtime/components/react/mpx-switch.tsx +19 -14
- package/lib/runtime/components/react/mpx-text.tsx +16 -13
- package/lib/runtime/components/react/mpx-video.tsx +36 -35
- package/lib/runtime/components/react/mpx-view.tsx +41 -17
- package/lib/runtime/components/react/mpx-web-view.tsx +16 -16
- package/lib/runtime/components/react/types/getInnerListeners.d.ts +69 -35
- package/lib/runtime/components/react/useAnimationHooks.ts +29 -9
- package/lib/runtime/components/react/utils.tsx +13 -2
- package/lib/runtime/components/web/mpx-input.vue +1 -1
- package/lib/runtime/components/web/mpx-scroll-view.vue +21 -4
- package/lib/runtime/components/web/mpx-sticky-header.vue +91 -0
- package/lib/runtime/components/web/mpx-sticky-section.vue +15 -0
- package/lib/runtime/stringify.wxs +2 -2
- package/lib/template-compiler/compiler.js +7 -7
- package/package.json +3 -4
- /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
package/lib/index.js
CHANGED
|
@@ -131,7 +131,7 @@ class MpxWebpackPlugin {
|
|
|
131
131
|
errors.push('MpxWebpackPlugin supports mode to be "web" only when srcMode is set to "wx"!')
|
|
132
132
|
}
|
|
133
133
|
if (isReact(options.mode) && options.srcMode !== 'wx') {
|
|
134
|
-
errors.push('MpxWebpackPlugin supports mode to be "ios"
|
|
134
|
+
errors.push('MpxWebpackPlugin supports mode to be "ios" | "android" | "harmony" only when srcMode is set to "wx"!')
|
|
135
135
|
}
|
|
136
136
|
if (options.dynamicComponentRules && !options.dynamicRuntime) {
|
|
137
137
|
errors.push('Please make sure you have set dynamicRuntime true in mpx webpack plugin config because you have use the dynamic runtime feature.')
|
|
@@ -184,8 +184,9 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
184
184
|
'border-top': ['borderTopWidth', 'borderTopStyle', 'borderTopColor'],
|
|
185
185
|
// 仅支持 width | style | color 这种排序
|
|
186
186
|
'border-bottom': ['borderBottomWidth', 'borderBottomStyle', 'borderBottomColor'],
|
|
187
|
+
// 0.76 及以上版本RN支持 box-shadow,实测0.77版本drn红米note12pro Android12 不支持内阴影,其他表现和web一致
|
|
187
188
|
// 仅支持 offset-x | offset-y | blur-radius | color 排序
|
|
188
|
-
'box-shadow': ['shadowOffset.width', 'shadowOffset.height', 'shadowRadius', 'shadowColor'],
|
|
189
|
+
// 'box-shadow': ['shadowOffset.width', 'shadowOffset.height', 'shadowRadius', 'shadowColor'],
|
|
189
190
|
// 仅支持 text-decoration-line text-decoration-style text-decoration-color 这种格式
|
|
190
191
|
'text-decoration': ['textDecorationLine', 'textDecorationStyle', 'textDecorationColor'],
|
|
191
192
|
// flex-grow | flex-shrink | flex-basis
|
|
@@ -525,20 +526,20 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
525
526
|
return { prop, value: values[0].trim() }
|
|
526
527
|
}
|
|
527
528
|
|
|
528
|
-
const formatBoxShadow = ({ prop, value, selector }, { mode }) => {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
}
|
|
529
|
+
// const formatBoxShadow = ({ prop, value, selector }, { mode }) => {
|
|
530
|
+
// value = value.trim()
|
|
531
|
+
// if (value === 'none') {
|
|
532
|
+
// return false
|
|
533
|
+
// }
|
|
534
|
+
// const cssMap = formatAbbreviation({ prop, value, selector }, { mode })
|
|
535
|
+
// if (mode === 'android' || mode === 'harmony') return cssMap
|
|
536
|
+
// // ios 阴影需要额外设置 shadowOpacity=1
|
|
537
|
+
// cssMap.push({
|
|
538
|
+
// prop: 'shadowOpacity',
|
|
539
|
+
// value: 1
|
|
540
|
+
// })
|
|
541
|
+
// return cssMap
|
|
542
|
+
// }
|
|
542
543
|
|
|
543
544
|
return {
|
|
544
545
|
supportedModes: ['ios', 'android', 'harmony'],
|
|
@@ -579,12 +580,12 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
579
580
|
android: formatFontFamily,
|
|
580
581
|
harmony: formatFontFamily
|
|
581
582
|
},
|
|
582
|
-
{
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
},
|
|
583
|
+
// {
|
|
584
|
+
// test: 'box-shadow',
|
|
585
|
+
// ios: formatBoxShadow,
|
|
586
|
+
// android: formatBoxShadow,
|
|
587
|
+
// harmony: formatBoxShadow
|
|
588
|
+
// },
|
|
588
589
|
// 通用的简写格式匹配
|
|
589
590
|
{
|
|
590
591
|
test: new RegExp('^(' + Object.keys(AbbreviationMap).join('|') + ')$'),
|
|
@@ -124,7 +124,7 @@ module.exports = function ({ print }) {
|
|
|
124
124
|
if (isMustache(value)) {
|
|
125
125
|
ttValueLog({ name, value })
|
|
126
126
|
} else {
|
|
127
|
-
const supportList = ['share', 'getPhoneNumber', 'contact', 'im', 'openSetting']
|
|
127
|
+
const supportList = ['share', 'getPhoneNumber', 'contact', 'im', 'openSetting', 'addShortcut']
|
|
128
128
|
if (value && supportList.indexOf(value) === -1) {
|
|
129
129
|
ttValueLogError({ name, value })
|
|
130
130
|
}
|
|
@@ -42,6 +42,8 @@ const wxs = require('./wxs')
|
|
|
42
42
|
const component = require('./component')
|
|
43
43
|
const fixComponentName = require('./fix-component-name')
|
|
44
44
|
const rootPortal = require('./root-portal')
|
|
45
|
+
const stickyHeader = require('./sticky-header')
|
|
46
|
+
const stickySection = require('./sticky-section')
|
|
45
47
|
|
|
46
48
|
module.exports = function getComponentConfigs ({ warn, error }) {
|
|
47
49
|
/**
|
|
@@ -125,6 +127,8 @@ module.exports = function getComponentConfigs ({ warn, error }) {
|
|
|
125
127
|
hyphenTagName({ print }),
|
|
126
128
|
label({ print }),
|
|
127
129
|
component(),
|
|
128
|
-
rootPortal({ print })
|
|
130
|
+
rootPortal({ print }),
|
|
131
|
+
stickyHeader({ print }),
|
|
132
|
+
stickySection({ print })
|
|
129
133
|
]
|
|
130
134
|
}
|
|
@@ -51,7 +51,7 @@ module.exports = function ({ print }) {
|
|
|
51
51
|
swan: baiduPropLog
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
|
-
test: /^(
|
|
54
|
+
test: /^(auto-focus|confirm-type|confirm-hold|adjust-position|hold-keyboard)$/,
|
|
55
55
|
tt: ttPropLog
|
|
56
56
|
},
|
|
57
57
|
{
|
|
@@ -62,7 +62,7 @@ module.exports = function ({ print }) {
|
|
|
62
62
|
test: 'type',
|
|
63
63
|
web (prop) {
|
|
64
64
|
let { name, value } = prop
|
|
65
|
-
if (value === 'idcard'
|
|
65
|
+
if (value === 'idcard') {
|
|
66
66
|
webValueLog(prop)
|
|
67
67
|
value = 'text'
|
|
68
68
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const TAG_NAME = 'sticky-header'
|
|
2
|
+
|
|
3
|
+
module.exports = function ({ print }) {
|
|
4
|
+
return {
|
|
5
|
+
test: TAG_NAME,
|
|
6
|
+
android (tag, { el }) {
|
|
7
|
+
el.isBuiltIn = true
|
|
8
|
+
return 'mpx-sticky-header'
|
|
9
|
+
},
|
|
10
|
+
ios (tag, { el }) {
|
|
11
|
+
el.isBuiltIn = true
|
|
12
|
+
return 'mpx-sticky-header'
|
|
13
|
+
},
|
|
14
|
+
harmony (tag, { el }) {
|
|
15
|
+
el.isBuiltIn = true
|
|
16
|
+
return 'mpx-sticky-header'
|
|
17
|
+
},
|
|
18
|
+
web (tag, { el }) {
|
|
19
|
+
el.isBuiltIn = true
|
|
20
|
+
return 'mpx-sticky-header'
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const TAG_NAME = 'sticky-section'
|
|
2
|
+
|
|
3
|
+
module.exports = function ({ print }) {
|
|
4
|
+
return {
|
|
5
|
+
test: TAG_NAME,
|
|
6
|
+
android (tag, { el }) {
|
|
7
|
+
el.isBuiltIn = true
|
|
8
|
+
return 'mpx-sticky-section'
|
|
9
|
+
},
|
|
10
|
+
ios (tag, { el }) {
|
|
11
|
+
el.isBuiltIn = true
|
|
12
|
+
return 'mpx-sticky-section'
|
|
13
|
+
},
|
|
14
|
+
harmony (tag, { el }) {
|
|
15
|
+
el.isBuiltIn = true
|
|
16
|
+
return 'mpx-sticky-section'
|
|
17
|
+
},
|
|
18
|
+
web (tag, { el }) {
|
|
19
|
+
el.isBuiltIn = true
|
|
20
|
+
return 'mpx-sticky-section'
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -25,15 +25,15 @@ module.exports = function ({ print }) {
|
|
|
25
25
|
},
|
|
26
26
|
ios (tag, { el }) {
|
|
27
27
|
el.isBuiltIn = true
|
|
28
|
-
return 'mpx-text'
|
|
28
|
+
return el.isSimple ? 'mpx-simple-text' : 'mpx-text'
|
|
29
29
|
},
|
|
30
30
|
android (tag, { el }) {
|
|
31
31
|
el.isBuiltIn = true
|
|
32
|
-
return 'mpx-text'
|
|
32
|
+
return el.isSimple ? 'mpx-simple-text' : 'mpx-text'
|
|
33
33
|
},
|
|
34
34
|
harmony (tag, { el }) {
|
|
35
35
|
el.isBuiltIn = true
|
|
36
|
-
return 'mpx-text'
|
|
36
|
+
return el.isSimple ? 'mpx-simple-text' : 'mpx-text'
|
|
37
37
|
},
|
|
38
38
|
props: [
|
|
39
39
|
{
|
|
@@ -59,6 +59,21 @@ module.exports = function ({ print }) {
|
|
|
59
59
|
el.isBuiltIn = true
|
|
60
60
|
},
|
|
61
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
|
+
}
|
|
62
77
|
}
|
|
63
78
|
]
|
|
64
79
|
}
|
|
@@ -31,12 +31,10 @@ module.exports = function ({ print }) {
|
|
|
31
31
|
android (tag, { el }) {
|
|
32
32
|
el.isBuiltIn = true
|
|
33
33
|
return el.isSimple ? 'mpx-simple-view' : 'mpx-view'
|
|
34
|
-
return 'mpx-view'
|
|
35
34
|
},
|
|
36
35
|
harmony (tag, { el }) {
|
|
37
36
|
el.isBuiltIn = true
|
|
38
37
|
return el.isSimple ? 'mpx-simple-view' : 'mpx-view'
|
|
39
|
-
return 'mpx-view'
|
|
40
38
|
},
|
|
41
39
|
qa (tag) {
|
|
42
40
|
return 'div'
|
|
@@ -8,6 +8,41 @@ 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
47
|
supportedModes: ['ali', 'swan', 'qq', 'tt', 'web', 'qa', 'jd', 'dd', 'ios', 'android', 'harmony'],
|
|
13
48
|
// props预处理
|
|
@@ -389,51 +424,9 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
389
424
|
value
|
|
390
425
|
}
|
|
391
426
|
},
|
|
392
|
-
ios (
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
const eventName = match[2]
|
|
396
|
-
const modifierStr = match[3] || ''
|
|
397
|
-
const meta = {
|
|
398
|
-
modifierStr
|
|
399
|
-
}
|
|
400
|
-
const rPrefix = runRules(spec.event.prefix, prefix, { mode: 'ios' })
|
|
401
|
-
const rEventName = runRules(eventRules, eventName, { mode: 'ios', data: { el } })
|
|
402
|
-
return {
|
|
403
|
-
name: rPrefix + rEventName + meta.modifierStr,
|
|
404
|
-
value
|
|
405
|
-
}
|
|
406
|
-
},
|
|
407
|
-
android ({ name, value }, { eventRules, el }) {
|
|
408
|
-
const match = this.test.exec(name)
|
|
409
|
-
const prefix = match[1]
|
|
410
|
-
const eventName = match[2]
|
|
411
|
-
const modifierStr = match[3] || ''
|
|
412
|
-
const meta = {
|
|
413
|
-
modifierStr
|
|
414
|
-
}
|
|
415
|
-
const rPrefix = runRules(spec.event.prefix, prefix, { mode: 'android' })
|
|
416
|
-
const rEventName = runRules(eventRules, eventName, { mode: 'android', data: { el } })
|
|
417
|
-
return {
|
|
418
|
-
name: rPrefix + rEventName + meta.modifierStr,
|
|
419
|
-
value
|
|
420
|
-
}
|
|
421
|
-
},
|
|
422
|
-
harmony ({ name, value }, { eventRules, el }) {
|
|
423
|
-
const match = this.test.exec(name)
|
|
424
|
-
const prefix = match[1]
|
|
425
|
-
const eventName = match[2]
|
|
426
|
-
const modifierStr = match[3] || ''
|
|
427
|
-
const meta = {
|
|
428
|
-
modifierStr
|
|
429
|
-
}
|
|
430
|
-
const rPrefix = runRules(spec.event.prefix, prefix, { mode: 'harmony' })
|
|
431
|
-
const rEventName = runRules(eventRules, eventName, { mode: 'harmony', data: { el } })
|
|
432
|
-
return {
|
|
433
|
-
name: rPrefix + rEventName + meta.modifierStr,
|
|
434
|
-
value
|
|
435
|
-
}
|
|
436
|
-
}
|
|
427
|
+
ios: getRnDirectiveEventHandle('ios'),
|
|
428
|
+
android: getRnDirectiveEventHandle('android'),
|
|
429
|
+
harmony: getRnDirectiveEventHandle('harmony')
|
|
437
430
|
},
|
|
438
431
|
// 无障碍
|
|
439
432
|
{
|
|
@@ -537,54 +530,9 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
537
530
|
error(`Web environment does not support [${eventName}] event!`)
|
|
538
531
|
}
|
|
539
532
|
},
|
|
540
|
-
ios
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
longtap: 'longpress',
|
|
544
|
-
longpress: 'longpress',
|
|
545
|
-
touchstart: 'touchstart',
|
|
546
|
-
touchmove: 'touchmove',
|
|
547
|
-
touchend: 'touchend',
|
|
548
|
-
touchcancel: 'touchcancel'
|
|
549
|
-
}
|
|
550
|
-
if (eventMap[eventName]) {
|
|
551
|
-
return eventMap[eventName]
|
|
552
|
-
} else {
|
|
553
|
-
error(`React native environment does not support [${eventName}] event!`)
|
|
554
|
-
}
|
|
555
|
-
},
|
|
556
|
-
android (eventName) {
|
|
557
|
-
const eventMap = {
|
|
558
|
-
tap: 'tap',
|
|
559
|
-
longtap: 'longpress',
|
|
560
|
-
longpress: 'longpress',
|
|
561
|
-
touchstart: 'touchstart',
|
|
562
|
-
touchmove: 'touchmove',
|
|
563
|
-
touchend: 'touchend',
|
|
564
|
-
touchcancel: 'touchcancel'
|
|
565
|
-
}
|
|
566
|
-
if (eventMap[eventName]) {
|
|
567
|
-
return eventMap[eventName]
|
|
568
|
-
} else {
|
|
569
|
-
error(`React native environment does not support [${eventName}] event!`)
|
|
570
|
-
}
|
|
571
|
-
},
|
|
572
|
-
harmony (eventName) {
|
|
573
|
-
const eventMap = {
|
|
574
|
-
tap: 'tap',
|
|
575
|
-
longtap: 'longpress',
|
|
576
|
-
longpress: 'longpress',
|
|
577
|
-
touchstart: 'touchstart',
|
|
578
|
-
touchmove: 'touchmove',
|
|
579
|
-
touchend: 'touchend',
|
|
580
|
-
touchcancel: 'touchcancel'
|
|
581
|
-
}
|
|
582
|
-
if (eventMap[eventName]) {
|
|
583
|
-
return eventMap[eventName]
|
|
584
|
-
} else {
|
|
585
|
-
error(`React native environment does not support [${eventName}] event!`)
|
|
586
|
-
}
|
|
587
|
-
}
|
|
533
|
+
ios: rnEventRulesHandle,
|
|
534
|
+
android: rnEventRulesHandle,
|
|
535
|
+
harmony: rnEventRulesHandle
|
|
588
536
|
},
|
|
589
537
|
// web event escape
|
|
590
538
|
{
|
package/lib/react/processJSON.js
CHANGED
|
@@ -113,13 +113,14 @@ module.exports = function (jsonContent, {
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
if (ctorType === 'page') {
|
|
116
|
-
const keysToExtract = ['navigationStyle']
|
|
116
|
+
// const keysToExtract = ['navigationStyle']
|
|
117
117
|
const configObj = {}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
118
|
+
// 暂时先不注入数据,后续如需要使用再用
|
|
119
|
+
// keysToExtract.forEach(key => {
|
|
120
|
+
// if (jsonObj[key]) {
|
|
121
|
+
// configObj[key] = jsonObj[key]
|
|
122
|
+
// }
|
|
123
|
+
// })
|
|
123
124
|
loaderContext._module.addPresentationalDependency(new RecordPageConfigsMapDependency(parseRequest(loaderContext.resource).resourcePath, configObj))
|
|
124
125
|
}
|
|
125
126
|
|
|
@@ -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' || mode === 'harmony' ? "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,5 +1,6 @@
|
|
|
1
1
|
import { createContext, Dispatch, MutableRefObject, SetStateAction } from 'react'
|
|
2
|
-
import { NativeSyntheticEvent } from 'react-native'
|
|
2
|
+
import { NativeSyntheticEvent, Animated } from 'react-native'
|
|
3
|
+
import { noop } from '@mpxjs/utils'
|
|
3
4
|
|
|
4
5
|
export type LabelContextValue = MutableRefObject<{
|
|
5
6
|
triggerChange: (evt: NativeSyntheticEvent<TouchEvent>) => void
|
|
@@ -42,7 +43,8 @@ export interface PortalContextValue {
|
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
export interface ScrollViewContextValue {
|
|
45
|
-
|
|
46
|
+
gestureRef: React.RefObject<any> | null,
|
|
47
|
+
scrollOffset: Animated.Value
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
export interface RouteContextValue {
|
|
@@ -50,6 +52,11 @@ export interface RouteContextValue {
|
|
|
50
52
|
navigation: Record<string, any>
|
|
51
53
|
}
|
|
52
54
|
|
|
55
|
+
export interface StickyContextValue {
|
|
56
|
+
registerStickyHeader: Function,
|
|
57
|
+
unregisterStickyHeader: Function
|
|
58
|
+
}
|
|
59
|
+
|
|
53
60
|
export const MovableAreaContext = createContext({ width: 0, height: 0 })
|
|
54
61
|
|
|
55
62
|
export const FormContext = createContext<FormContextValue | null>(null)
|
|
@@ -72,6 +79,8 @@ export const SwiperContext = createContext({})
|
|
|
72
79
|
|
|
73
80
|
export const KeyboardAvoidContext = createContext<KeyboardAvoidContextValue | null>(null)
|
|
74
81
|
|
|
75
|
-
export const ScrollViewContext = createContext<ScrollViewContextValue>({ gestureRef: null })
|
|
82
|
+
export const ScrollViewContext = createContext<ScrollViewContextValue>({ gestureRef: null, scrollOffset: new Animated.Value(0) })
|
|
76
83
|
|
|
77
84
|
export const PortalContext = createContext<PortalContextValue>(null as any)
|
|
85
|
+
|
|
86
|
+
export const StickyContext = createContext<StickyContextValue>({ registerStickyHeader: noop, unregisterStickyHeader: noop })
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { createContext } from 'react';
|
|
2
|
+
import { Animated } from 'react-native';
|
|
3
|
+
import { noop } from '@mpxjs/utils';
|
|
2
4
|
export const MovableAreaContext = createContext({ width: 0, height: 0 });
|
|
3
5
|
export const FormContext = createContext(null);
|
|
4
6
|
export const CheckboxGroupContext = createContext(null);
|
|
@@ -10,5 +12,6 @@ export const IntersectionObserverContext = createContext(null);
|
|
|
10
12
|
export const RouteContext = createContext(null);
|
|
11
13
|
export const SwiperContext = createContext({});
|
|
12
14
|
export const KeyboardAvoidContext = createContext(null);
|
|
13
|
-
export const ScrollViewContext = createContext({ gestureRef: null });
|
|
15
|
+
export const ScrollViewContext = createContext({ gestureRef: null, scrollOffset: new Animated.Value(0) });
|
|
14
16
|
export const PortalContext = createContext(null);
|
|
17
|
+
export const StickyContext = createContext({ registerStickyHeader: noop, unregisterStickyHeader: noop });
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export const TAP_EVENTS = ['bindtap', 'catchtap', 'capture-bindtap', 'capture-catchtap'];
|
|
2
1
|
const eventConfigMap = {
|
|
3
2
|
bindtap: { bitFlag: '0', events: ['onTouchStart', 'onTouchMove', 'onTouchEnd'] },
|
|
4
3
|
bindlongpress: { bitFlag: '1', events: ['onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel'] },
|