@mpxjs/webpack-plugin 2.9.59 → 2.9.62

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.
Files changed (106) hide show
  1. package/lib/platform/style/wx/index.js +314 -254
  2. package/lib/platform/template/wx/component-config/checkbox-group.js +8 -0
  3. package/lib/platform/template/wx/component-config/checkbox.js +8 -0
  4. package/lib/platform/template/wx/component-config/cover-image.js +15 -0
  5. package/lib/platform/template/wx/component-config/cover-view.js +9 -0
  6. package/lib/platform/template/wx/component-config/form.js +13 -1
  7. package/lib/platform/template/wx/component-config/icon.js +8 -0
  8. package/lib/platform/template/wx/component-config/index.js +5 -1
  9. package/lib/platform/template/wx/component-config/label.js +15 -0
  10. package/lib/platform/template/wx/component-config/movable-area.js +18 -1
  11. package/lib/platform/template/wx/component-config/movable-view.js +18 -1
  12. package/lib/platform/template/wx/component-config/navigator.js +8 -0
  13. package/lib/platform/template/wx/component-config/picker-view-column.js +8 -0
  14. package/lib/platform/template/wx/component-config/picker-view.js +18 -2
  15. package/lib/platform/template/wx/component-config/picker.js +14 -1
  16. package/lib/platform/template/wx/component-config/radio-group.js +8 -0
  17. package/lib/platform/template/wx/component-config/radio.js +8 -0
  18. package/lib/platform/template/wx/component-config/root-portal.js +15 -0
  19. package/lib/platform/template/wx/component-config/switch.js +8 -0
  20. package/lib/platform/template/wx/component-config/unsupported.js +1 -3
  21. package/lib/react/processScript.js +2 -0
  22. package/lib/runtime/components/react/context.ts +38 -0
  23. package/lib/runtime/components/react/dist/context.js +7 -0
  24. package/lib/runtime/components/react/dist/getInnerListeners.js +22 -11
  25. package/lib/runtime/components/react/dist/mpx-button.jsx +67 -45
  26. package/lib/runtime/components/react/dist/mpx-checkbox-group.jsx +81 -0
  27. package/lib/runtime/components/react/dist/mpx-checkbox.jsx +152 -0
  28. package/lib/runtime/components/react/dist/mpx-form.jsx +59 -0
  29. package/lib/runtime/components/react/dist/mpx-icon.jsx +51 -0
  30. package/lib/runtime/components/react/dist/mpx-image/index.jsx +17 -22
  31. package/lib/runtime/components/react/dist/mpx-image/svg.jsx +0 -1
  32. package/lib/runtime/components/react/dist/mpx-input.jsx +38 -16
  33. package/lib/runtime/components/react/dist/mpx-label.jsx +63 -0
  34. package/lib/runtime/components/react/dist/mpx-movable-area.jsx +46 -0
  35. package/lib/runtime/components/react/dist/mpx-movable-view.jsx +346 -0
  36. package/lib/runtime/components/react/dist/mpx-navigator.jsx +35 -0
  37. package/lib/runtime/components/react/dist/mpx-picker/date.jsx +69 -0
  38. package/lib/runtime/components/react/dist/mpx-picker/index.jsx +138 -0
  39. package/lib/runtime/components/react/dist/mpx-picker/multiSelector.jsx +139 -0
  40. package/lib/runtime/components/react/dist/mpx-picker/region.jsx +90 -0
  41. package/lib/runtime/components/react/dist/mpx-picker/regionData.js +6099 -0
  42. package/lib/runtime/components/react/dist/mpx-picker/selector.jsx +76 -0
  43. package/lib/runtime/components/react/dist/mpx-picker/time.jsx +244 -0
  44. package/lib/runtime/components/react/dist/mpx-picker/type.js +1 -0
  45. package/lib/runtime/components/react/dist/mpx-picker-view-column.jsx +15 -0
  46. package/lib/runtime/components/react/dist/mpx-picker-view.jsx +68 -0
  47. package/lib/runtime/components/react/dist/mpx-radio-group.jsx +79 -0
  48. package/lib/runtime/components/react/dist/mpx-radio.jsx +169 -0
  49. package/lib/runtime/components/react/dist/mpx-root-portal.jsx +11 -0
  50. package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +66 -50
  51. package/lib/runtime/components/react/dist/mpx-swiper/carouse.jsx +206 -147
  52. package/lib/runtime/components/react/dist/mpx-swiper/index.jsx +9 -7
  53. package/lib/runtime/components/react/dist/mpx-swiper-item.jsx +3 -3
  54. package/lib/runtime/components/react/dist/mpx-switch.jsx +76 -0
  55. package/lib/runtime/components/react/dist/mpx-text.jsx +7 -19
  56. package/lib/runtime/components/react/dist/mpx-textarea.jsx +1 -1
  57. package/lib/runtime/components/react/dist/mpx-view.jsx +326 -96
  58. package/lib/runtime/components/react/dist/mpx-web-view.jsx +9 -15
  59. package/lib/runtime/components/react/dist/types/common.js +1 -0
  60. package/lib/runtime/components/react/dist/useNodesRef.js +3 -8
  61. package/lib/runtime/components/react/dist/utils.js +82 -14
  62. package/lib/runtime/components/react/getInnerListeners.ts +25 -13
  63. package/lib/runtime/components/react/mpx-button.tsx +87 -67
  64. package/lib/runtime/components/react/mpx-checkbox-group.tsx +147 -0
  65. package/lib/runtime/components/react/mpx-checkbox.tsx +245 -0
  66. package/lib/runtime/components/react/mpx-form.tsx +89 -0
  67. package/lib/runtime/components/react/mpx-icon.tsx +103 -0
  68. package/lib/runtime/components/react/mpx-image/index.tsx +20 -32
  69. package/lib/runtime/components/react/mpx-image/svg.tsx +2 -2
  70. package/lib/runtime/components/react/mpx-input.tsx +54 -26
  71. package/lib/runtime/components/react/mpx-label.tsx +115 -0
  72. package/lib/runtime/components/react/mpx-movable-area.tsx +67 -0
  73. package/lib/runtime/components/react/mpx-movable-view.tsx +425 -0
  74. package/lib/runtime/components/react/mpx-navigator.tsx +67 -0
  75. package/lib/runtime/components/react/mpx-picker/date.tsx +83 -0
  76. package/lib/runtime/components/react/mpx-picker/index.tsx +155 -0
  77. package/lib/runtime/components/react/mpx-picker/multiSelector.tsx +153 -0
  78. package/lib/runtime/components/react/mpx-picker/region.tsx +104 -0
  79. package/lib/runtime/components/react/mpx-picker/regionData.ts +6101 -0
  80. package/lib/runtime/components/react/mpx-picker/selector.tsx +92 -0
  81. package/lib/runtime/components/react/mpx-picker/time.tsx +274 -0
  82. package/lib/runtime/components/react/mpx-picker/type.ts +107 -0
  83. package/lib/runtime/components/react/mpx-picker-view-column.tsx +28 -0
  84. package/lib/runtime/components/react/mpx-picker-view.tsx +104 -0
  85. package/lib/runtime/components/react/mpx-radio-group.tsx +147 -0
  86. package/lib/runtime/components/react/mpx-radio.tsx +246 -0
  87. package/lib/runtime/components/react/mpx-root-portal.tsx +25 -0
  88. package/lib/runtime/components/react/mpx-scroll-view.tsx +82 -58
  89. package/lib/runtime/components/react/mpx-swiper/carouse.tsx +203 -156
  90. package/lib/runtime/components/react/mpx-swiper/index.tsx +12 -13
  91. package/lib/runtime/components/react/mpx-swiper/type.ts +11 -4
  92. package/lib/runtime/components/react/mpx-swiper-item.tsx +5 -3
  93. package/lib/runtime/components/react/mpx-switch.tsx +127 -0
  94. package/lib/runtime/components/react/mpx-text.tsx +52 -68
  95. package/lib/runtime/components/react/mpx-textarea.tsx +2 -2
  96. package/lib/runtime/components/react/mpx-view.tsx +373 -140
  97. package/lib/runtime/components/react/mpx-web-view.tsx +24 -28
  98. package/lib/runtime/components/react/types/common.ts +12 -0
  99. package/lib/runtime/components/react/types/getInnerListeners.ts +2 -1
  100. package/lib/runtime/components/react/types/global.d.ts +4 -0
  101. package/lib/runtime/components/react/useNodesRef.ts +3 -8
  102. package/lib/runtime/components/react/utils.ts +93 -15
  103. package/lib/runtime/optionProcessor.js +19 -17
  104. package/lib/template-compiler/compiler.js +56 -41
  105. package/lib/template-compiler/gen-node-react.js +7 -7
  106. package/package.json +6 -3
@@ -6,6 +6,14 @@ module.exports = function () {
6
6
  web (tag, { el }) {
7
7
  el.isBuiltIn = true
8
8
  return 'mpx-checkbox-group'
9
+ },
10
+ ios (tag, { el }) {
11
+ el.isBuiltIn = true
12
+ return 'mpx-checkbox-group'
13
+ },
14
+ android (tag, { el }) {
15
+ el.isBuiltIn = true
16
+ return 'mpx-checkbox-group'
9
17
  }
10
18
  }
11
19
  }
@@ -7,6 +7,14 @@ module.exports = function () {
7
7
  el.isBuiltIn = true
8
8
  return 'mpx-checkbox'
9
9
  },
10
+ ios (tag, { el }) {
11
+ el.isBuiltIn = true
12
+ return 'mpx-checkbox'
13
+ },
14
+ android (tag, { el }) {
15
+ el.isBuiltIn = true
16
+ return 'mpx-checkbox'
17
+ },
10
18
  event: [
11
19
  {
12
20
  test: 'tap',
@@ -2,6 +2,8 @@ const TAG_NAME = 'cover-image'
2
2
 
3
3
  module.exports = function ({ print }) {
4
4
  const aliEventLog = print({ platform: 'ali', tag: TAG_NAME, isError: false, type: 'event' })
5
+ const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
6
+ const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
5
7
  return {
6
8
  test: TAG_NAME,
7
9
  web (tag, { el }) {
@@ -11,12 +13,25 @@ module.exports = function ({ print }) {
11
13
  tt () {
12
14
  return 'image'
13
15
  },
16
+ ios (tag, { el }) {
17
+ el.isBuiltIn = true
18
+ return 'mpx-image'
19
+ },
20
+ android (tag, { el }) {
21
+ el.isBuiltIn = true
22
+ return 'mpx-image'
23
+ },
14
24
  props: [
15
25
  {
16
26
  test: 'use-built-in',
17
27
  web (prop, { el }) {
18
28
  el.isBuiltIn = true
19
29
  }
30
+ },
31
+ {
32
+ test: /^(referrer-policy)$/,
33
+ ios: iosPropLog,
34
+ android: androidPropLog
20
35
  }
21
36
  ],
22
37
  event: [
@@ -4,6 +4,7 @@ module.exports = function ({ print }) {
4
4
  const aliPropLog = print({ platform: 'ali', tag: TAG_NAME, isError: false })
5
5
  const baiduValueLogError = print({ platform: 'baidu', tag: TAG_NAME, isError: true, type: 'value' })
6
6
  const webPropLog = print({ platform: 'web', tag: TAG_NAME, isError: false })
7
+
7
8
  return {
8
9
  test: TAG_NAME,
9
10
  web (tag, { el }) {
@@ -19,6 +20,14 @@ module.exports = function ({ print }) {
19
20
  tt () {
20
21
  return 'view'
21
22
  },
23
+ ios (tag, { el }) {
24
+ el.isBuiltIn = true
25
+ return 'mpx-view'
26
+ },
27
+ android (tag, { el }) {
28
+ el.isBuiltIn = true
29
+ return 'mpx-view'
30
+ },
22
31
  props: [
23
32
  {
24
33
  test: 'scroll-top',
@@ -7,6 +7,8 @@ module.exports = function ({ print }) {
7
7
  const jdPropLog = print({ platform: 'jd', tag: TAG_NAME, isError: false })
8
8
  const webPropLog = print({ platform: 'web', tag: TAG_NAME, isError: false })
9
9
  const qaPropLog = print({ platform: 'qa', tag: TAG_NAME, isError: false })
10
+ const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
11
+ const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
10
12
 
11
13
  return {
12
14
  test: TAG_NAME,
@@ -15,6 +17,14 @@ module.exports = function ({ print }) {
15
17
  el.isBuiltIn = true
16
18
  return 'mpx-form'
17
19
  },
20
+ ios (tag, { el }) {
21
+ el.isBuiltIn = true
22
+ return 'mpx-form'
23
+ },
24
+ android (tag, { el }) {
25
+ el.isBuiltIn = true
26
+ return 'mpx-form'
27
+ },
18
28
  props: [
19
29
  {
20
30
  test: /^(report-submit-timeout)$/,
@@ -26,7 +36,9 @@ module.exports = function ({ print }) {
26
36
  {
27
37
  test: /^(report-submit|report-submit-timeout)$/,
28
38
  web: webPropLog,
29
- qa: qaPropLog
39
+ qa: qaPropLog,
40
+ ios: iosPropLog,
41
+ android: androidPropLog
30
42
  }
31
43
  ]
32
44
  }
@@ -6,6 +6,14 @@ module.exports = function () {
6
6
  web (tag, { el }) {
7
7
  el.isBuiltIn = true
8
8
  return 'mpx-icon'
9
+ },
10
+ ios (tag, { el }) {
11
+ el.isBuiltIn = true
12
+ return 'mpx-icon'
13
+ },
14
+ android (tag, { el }) {
15
+ el.isBuiltIn = true
16
+ return 'mpx-icon'
9
17
  }
10
18
  }
11
19
  }
@@ -37,9 +37,11 @@ const unsupported = require('./unsupported')
37
37
  const video = require('./video')
38
38
  const view = require('./view')
39
39
  const webView = require('./web-view')
40
+ const label = require('./label')
40
41
  const wxs = require('./wxs')
41
42
  const component = require('./component')
42
43
  const fixComponentName = require('./fix-component-name')
44
+ const rootPortal = require('./root-portal')
43
45
 
44
46
  module.exports = function getComponentConfigs ({ warn, error }) {
45
47
  /**
@@ -121,6 +123,8 @@ module.exports = function getComponentConfigs ({ warn, error }) {
121
123
  livePlayer({ print }),
122
124
  livePusher({ print }),
123
125
  hyphenTagName({ print }),
124
- component()
126
+ label({ print }),
127
+ component(),
128
+ rootPortal({ print })
125
129
  ]
126
130
  }
@@ -0,0 +1,15 @@
1
+ const TAG_NAME = 'label'
2
+
3
+ module.exports = function () {
4
+ return {
5
+ test: TAG_NAME,
6
+ ios (tag, { el }) {
7
+ el.isBuiltIn = true
8
+ return 'mpx-label'
9
+ },
10
+ android (tag, { el }) {
11
+ el.isBuiltIn = true
12
+ return 'mpx-label'
13
+ }
14
+ }
15
+ }
@@ -1,11 +1,28 @@
1
1
  const TAG_NAME = 'movable-area'
2
2
 
3
3
  module.exports = function ({ print }) {
4
+ const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
5
+ const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
4
6
  return {
5
7
  test: TAG_NAME,
6
8
  web (tag, { el }) {
7
9
  el.isBuiltIn = true
8
10
  return 'mpx-movable-area'
9
- }
11
+ },
12
+ android (tag, { el }) {
13
+ el.isBuiltIn = true
14
+ return 'mpx-movable-area'
15
+ },
16
+ ios (tag, { el }) {
17
+ el.isBuiltIn = true
18
+ return 'mpx-movable-area'
19
+ },
20
+ props: [
21
+ {
22
+ test: /^(scale-area)$/,
23
+ ios: iosPropLog,
24
+ android: androidPropLog
25
+ }
26
+ ]
10
27
  }
11
28
  }
@@ -3,16 +3,33 @@ const TAG_NAME = 'movable-view'
3
3
  module.exports = function ({ print }) {
4
4
  const aliEventLog = print({ platform: 'ali', tag: TAG_NAME, isError: false, type: 'event' })
5
5
  const qaPropLog = print({ platform: 'qa', tag: TAG_NAME, isError: false })
6
+ const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
7
+ const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
6
8
  return {
7
9
  test: TAG_NAME,
8
10
  web (tag, { el }) {
9
11
  el.isBuiltIn = true
10
12
  return 'mpx-movable-view'
11
13
  },
14
+ android (tag, { el }) {
15
+ el.isBuiltIn = true
16
+ return 'mpx-movable-view'
17
+ },
18
+ ios (tag, { el }) {
19
+ el.isBuiltIn = true
20
+ return 'mpx-movable-view'
21
+ },
12
22
  props: [
13
23
  {
14
24
  test: /^(out-of-bounds)$/,
15
- ali: qaPropLog
25
+ ali: qaPropLog,
26
+ ios: iosPropLog,
27
+ android: androidPropLog
28
+ },
29
+ {
30
+ test: /^(inertia|damping|animation)$/,
31
+ ios: iosPropLog,
32
+ android: androidPropLog
16
33
  }
17
34
  ],
18
35
  event: [
@@ -28,6 +28,14 @@ module.exports = function ({ print }) {
28
28
  el.isBuiltIn = true
29
29
  return 'mpx-navigator'
30
30
  },
31
+ ios (tag, { el }) {
32
+ el.isBuiltIn = true
33
+ return 'mpx-navigator'
34
+ },
35
+ android (tag, { el }) {
36
+ el.isBuiltIn = true
37
+ return 'mpx-navigator'
38
+ },
31
39
  props: [
32
40
  {
33
41
  test: /^(target|delta|app-id|path|extra-data|version|hover-stop-propagation)$/,
@@ -6,6 +6,14 @@ module.exports = function () {
6
6
  web (tag, { el }) {
7
7
  el.isBuiltIn = true
8
8
  return 'mpx-picker-view-column'
9
+ },
10
+ ios (tag, { el }) {
11
+ el.isBuiltIn = true
12
+ return 'mpx-picker-view-column'
13
+ },
14
+ android (tag, { el }) {
15
+ el.isBuiltIn = true
16
+ return 'mpx-picker-view-column'
9
17
  }
10
18
  }
11
19
  }
@@ -6,6 +6,10 @@ module.exports = function ({ print }) {
6
6
  const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false })
7
7
  const ttEventLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false, type: 'event' })
8
8
  const jdEventLog = print({ platform: 'jd', tag: TAG_NAME, isError: false, type: 'event' })
9
+ const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
10
+ const iosEventLog = print({ platform: 'ios', tag: TAG_NAME, isError: false, type: 'event' })
11
+ const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
12
+ const androidEventLog = print({ platform: 'android', tag: TAG_NAME, isError: false, type: 'event' })
9
13
 
10
14
  return {
11
15
  test: TAG_NAME,
@@ -13,10 +17,20 @@ module.exports = function ({ print }) {
13
17
  el.isBuiltIn = true
14
18
  return 'mpx-picker-view'
15
19
  },
20
+ ios (tag, { el }) {
21
+ el.isBuiltIn = true
22
+ return 'mpx-picker-view'
23
+ },
24
+ android (tag, { el }) {
25
+ el.isBuiltIn = true
26
+ return 'mpx-picker-view'
27
+ },
16
28
  props: [
17
29
  {
18
30
  test: /^(indicator-class|mask-class)$/,
19
- tt: ttPropLog
31
+ tt: ttPropLog,
32
+ ios: iosPropLog,
33
+ android: androidPropLog
20
34
  }
21
35
  ],
22
36
  event: [
@@ -25,7 +39,9 @@ module.exports = function ({ print }) {
25
39
  ali: aliEventLog,
26
40
  swan: baiduEventLog,
27
41
  tt: ttEventLog,
28
- jd: jdEventLog
42
+ jd: jdEventLog,
43
+ ios: iosEventLog,
44
+ android: androidEventLog
29
45
  }
30
46
  ]
31
47
  }
@@ -8,12 +8,23 @@ module.exports = function ({ print }) {
8
8
  const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false })
9
9
  const baiduPropLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false })
10
10
  const qaPropLog = print({ platform: 'qa', tag: TAG_NAME, isError: false })
11
+ const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
12
+ const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
13
+
11
14
  return {
12
15
  test: TAG_NAME,
13
16
  web (tag, { el }) {
14
17
  el.isBuiltIn = true
15
18
  return 'mpx-picker'
16
19
  },
20
+ ios (tag, { el }) {
21
+ el.isBuiltIn = true
22
+ return 'mpx-picker'
23
+ },
24
+ android (tag, { el }) {
25
+ el.isBuiltIn = true
26
+ return 'mpx-picker'
27
+ },
17
28
  props: [
18
29
  {
19
30
  test: 'mode',
@@ -30,7 +41,9 @@ module.exports = function ({ print }) {
30
41
  swan: baiduPropLog,
31
42
  ali: aliPropLog,
32
43
  jd: jdPropLog,
33
- qa: qaPropLog
44
+ qa: qaPropLog,
45
+ ios: iosPropLog,
46
+ android: androidPropLog
34
47
  }
35
48
  ],
36
49
  event: [
@@ -6,6 +6,14 @@ module.exports = function () {
6
6
  web (tag, { el }) {
7
7
  el.isBuiltIn = true
8
8
  return 'mpx-radio-group'
9
+ },
10
+ ios (tag, { el }) {
11
+ el.isBuiltIn = true
12
+ return 'mpx-radio-group'
13
+ },
14
+ android (tag, { el }) {
15
+ el.isBuiltIn = true
16
+ return 'mpx-radio-group'
9
17
  }
10
18
  }
11
19
  }
@@ -7,6 +7,14 @@ module.exports = function () {
7
7
  el.isBuiltIn = true
8
8
  return 'mpx-radio'
9
9
  },
10
+ ios (tag, { el }) {
11
+ el.isBuiltIn = true
12
+ return 'mpx-radio'
13
+ },
14
+ android (tag, { el }) {
15
+ el.isBuiltIn = true
16
+ return 'mpx-radio'
17
+ },
10
18
  event: [
11
19
  {
12
20
  test: 'tap',
@@ -0,0 +1,15 @@
1
+ const TAG_NAME = 'root-portal'
2
+
3
+ module.exports = function ({ print }) {
4
+ return {
5
+ test: TAG_NAME,
6
+ ios (tag, { el }) {
7
+ el.isBuiltIn = true
8
+ return 'mpx-root-portal'
9
+ },
10
+ android (tag, { el }) {
11
+ el.isBuiltIn = true
12
+ return 'mpx-root-portal'
13
+ }
14
+ }
15
+ }
@@ -10,6 +10,14 @@ module.exports = function ({ print }) {
10
10
  el.isBuiltIn = true
11
11
  return 'mpx-switch'
12
12
  },
13
+ ios (tag, { el }) {
14
+ el.isBuiltIn = true
15
+ return 'mpx-switch'
16
+ },
17
+ android (tag, { el }) {
18
+ el.isBuiltIn = true
19
+ return 'mpx-switch'
20
+ },
13
21
  props: [
14
22
  {
15
23
  test: /^type$/,
@@ -11,9 +11,7 @@ const JD_UNSUPPORTED_TAG_NAME_ARR = ['functional-page-navigator', 'live-pusher',
11
11
  // 快应用不支持的标签集合
12
12
  const QA_UNSUPPORTED_TAG_NAME_ARR = ['movable-view', 'movable-area', 'open-data', 'official-account', 'editor', 'functional-page-navigator', 'live-player', 'live-pusher', 'ad', 'cover-image']
13
13
  // RN不支持的标签集合
14
- const RN_UNSUPPORTED_TAG_NAME_ARR = ['movable-view', 'movable-area', 'open-data', 'official-account', 'editor', 'functional-page-navigator', 'live-player', 'live-pusher', 'ad', 'cover-image',
15
- 'checkbox', 'checkbox-group', 'radio', 'radio-group', 'switch', 'movable-area', 'movable-view', 'icon', 'progress', 'rich-text', 'form', 'label', 'picker', 'picker-view', 'picker-view-column', 'slider',
16
- 'audio', 'camera', 'video', 'canvas', 'cover-image', 'cover-view', 'match-media', 'page-container', 'root-portal', 'editor', 'keyboard-accessory', 'navigator', 'map']
14
+ const RN_UNSUPPORTED_TAG_NAME_ARR = ['open-data', 'official-account', 'editor', 'functional-page-navigator', 'live-player', 'live-pusher', 'ad', 'progress', 'rich-text', 'slider', 'audio', 'camera', 'video', 'canvas', 'match-media', 'page-container', 'editor', 'keyboard-accessory', 'map']
17
15
 
18
16
  /**
19
17
  * @param {function(object): function} print
@@ -28,12 +28,14 @@ import { NavigationContainer, createNavigationContainerRef, StackActions } from
28
28
  import { createNativeStackNavigator } from '@react-navigation/native-stack'
29
29
  import { Provider } from '@ant-design/react-native'
30
30
  import { SafeAreaProvider, useSafeAreaInsets } from 'react-native-safe-area-context'
31
+ import { GestureHandlerRootView } from 'react-native-gesture-handler'
31
32
 
32
33
  global.__navigationHelper = {
33
34
  NavigationContainer: NavigationContainer,
34
35
  createNavigationContainerRef: createNavigationContainerRef,
35
36
  createNativeStackNavigator: createNativeStackNavigator,
36
37
  StackActions: StackActions,
38
+ GestureHandlerRootView: GestureHandlerRootView,
37
39
  Provider: Provider,
38
40
  SafeAreaProvider: SafeAreaProvider,
39
41
  useSafeAreaInsets: useSafeAreaInsets
@@ -0,0 +1,38 @@
1
+ import { createContext, Dispatch, MutableRefObject, SetStateAction } from 'react';
2
+ import { NativeSyntheticEvent } from 'react-native'
3
+
4
+ export type LabelContextValue = MutableRefObject<{
5
+ triggerChange: (evt: NativeSyntheticEvent<TouchEvent>) => void
6
+ }>
7
+
8
+ export interface GroupValue {
9
+ [key: string]: { checked: boolean; setValue: Dispatch<SetStateAction<boolean>> }
10
+ }
11
+
12
+ export interface GroupContextValue {
13
+ groupValue: GroupValue
14
+ notifyChange: (evt: NativeSyntheticEvent<TouchEvent>) => void
15
+ }
16
+
17
+ export interface FormFieldValue {
18
+ getValue: () => any;
19
+ resetValue: ({ newVal, type }: { newVal?: any; type?: string }) => void;
20
+ }
21
+
22
+ export interface FormContextValue {
23
+ formValuesMap: Map<string, FormFieldValue>;
24
+ submit: () => void;
25
+ reset: () => void;
26
+ }
27
+
28
+ export const MovableAreaContext = createContext({ width: 0, height: 0 })
29
+
30
+ export const FormContext = createContext<FormContextValue | null>(null)
31
+
32
+ export const CheckboxGroupContext = createContext<GroupContextValue | null>(null)
33
+
34
+ export const RadioGroupContext = createContext<GroupContextValue | null>(null)
35
+
36
+ export const LabelContext = createContext<LabelContextValue | null>(null)
37
+
38
+ export const PickerContext = createContext(null)
@@ -0,0 +1,7 @@
1
+ import { createContext } from 'react';
2
+ export const MovableAreaContext = createContext({ width: 0, height: 0 });
3
+ export const FormContext = createContext(null);
4
+ export const CheckboxGroupContext = createContext(null);
5
+ export const RadioGroupContext = createContext(null);
6
+ export const LabelContext = createContext(null);
7
+ export const PickerContext = createContext(null);
@@ -65,7 +65,10 @@ export const getCustomEvent = (type = '', oe = {}, { detail = {}, layoutRef }, p
65
65
  dataset: getDataSet(props),
66
66
  offsetLeft: layoutRef?.current?.offsetLeft || 0,
67
67
  offsetTop: layoutRef?.current?.offsetTop || 0
68
- }
68
+ },
69
+ persist: oe.persist,
70
+ stopPropagation: oe.stopPropagation,
71
+ preventDefault: oe.preventDefault
69
72
  };
70
73
  };
71
74
  const useInnerProps = (props = {}, additionalProps = {}, removeProps = [], rawConfig) => {
@@ -87,7 +90,7 @@ const useInnerProps = (props = {}, additionalProps = {}, removeProps = [], rawCo
87
90
  });
88
91
  const propsRef = useRef({});
89
92
  const eventConfig = {};
90
- const config = rawConfig || {};
93
+ const config = rawConfig || { layoutRef: { current: {} }, disableTouch: false, disableTap: false };
91
94
  propsRef.current = { ...props, ...additionalProps };
92
95
  for (const key in eventConfigMap) {
93
96
  if (propsRef.current[key]) {
@@ -108,6 +111,17 @@ const useInnerProps = (props = {}, additionalProps = {}, removeProps = [], rawCo
108
111
  }
109
112
  });
110
113
  }
114
+ function checkIsNeedPress(e, type) {
115
+ const tapDetailInfo = ref.current.mpxPressInfo.detail || { x: 0, y: 0 };
116
+ const nativeEvent = e.nativeEvent;
117
+ const currentPageX = nativeEvent.changedTouches[0].pageX;
118
+ const currentPageY = nativeEvent.changedTouches[0].pageY;
119
+ if (Math.abs(currentPageX - tapDetailInfo.x) > 1 || Math.abs(currentPageY - tapDetailInfo.y) > 1) {
120
+ ref.current.needPress[type] = false;
121
+ ref.current.startTimer[type] && clearTimeout(ref.current.startTimer[type]);
122
+ ref.current.startTimer[type] = null;
123
+ }
124
+ }
111
125
  function handleTouchstart(e, type) {
112
126
  e.persist();
113
127
  const bubbleTouchEvent = ['catchtouchstart', 'bindtouchstart'];
@@ -135,19 +149,13 @@ const useInnerProps = (props = {}, additionalProps = {}, removeProps = [], rawCo
135
149
  function handleTouchmove(e, type) {
136
150
  const bubbleTouchEvent = ['catchtouchmove', 'bindtouchmove'];
137
151
  const captureTouchEvent = ['capture-catchtouchmove', 'capture-bindtouchmove'];
138
- const tapDetailInfo = ref.current.mpxPressInfo.detail || { x: 0, y: 0 };
139
- const nativeEvent = e.nativeEvent;
140
- const currentPageX = nativeEvent.changedTouches[0].pageX;
141
- const currentPageY = nativeEvent.changedTouches[0].pageY;
142
152
  const currentTouchEvent = type === 'bubble' ? bubbleTouchEvent : captureTouchEvent;
143
- if (Math.abs(currentPageX - tapDetailInfo.x) > 1 || Math.abs(currentPageY - tapDetailInfo.y) > 1) {
144
- ref.current.needPress[type] = false;
145
- ref.current.startTimer[type] && clearTimeout(ref.current.startTimer[type]);
146
- ref.current.startTimer[type] = null;
147
- }
148
153
  handleEmitEvent(currentTouchEvent, 'touchmove', e);
154
+ checkIsNeedPress(e, type);
149
155
  }
150
156
  function handleTouchend(e, type) {
157
+ // move event may not be triggered
158
+ checkIsNeedPress(e, type);
151
159
  const bubbleTouchEvent = ['catchtouchend', 'bindtouchend'];
152
160
  const bubbleTapEvent = ['catchtap', 'bindtap'];
153
161
  const captureTouchEvent = ['capture-catchtouchend', 'capture-bindtouchend'];
@@ -158,6 +166,9 @@ const useInnerProps = (props = {}, additionalProps = {}, removeProps = [], rawCo
158
166
  ref.current.startTimer[type] = null;
159
167
  handleEmitEvent(currentTouchEvent, 'touchend', e);
160
168
  if (ref.current.needPress[type]) {
169
+ if (type === 'bubble' && config.disableTap) {
170
+ return;
171
+ }
161
172
  handleEmitEvent(currentTapEvent, 'tap', e);
162
173
  }
163
174
  }