@mpxjs/webpack-plugin 2.10.24-test.1 → 2.11.0

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 (128) hide show
  1. package/LICENSE +433 -0
  2. package/lib/index.js +4 -1
  3. package/lib/platform/style/wx/index.js +44 -38
  4. package/lib/platform/template/wx/component-config/picker.js +0 -6
  5. package/lib/resolver/AddEnvPlugin.js +1 -1
  6. package/lib/resolver/AddModePlugin.js +1 -1
  7. package/lib/resolver/ExtendComponentsPlugin.js +68 -0
  8. package/lib/runtime/components/extends/section-list.mpx +14 -0
  9. package/lib/runtime/components/react/dist/mpx-button.d.ts +0 -1
  10. package/lib/runtime/components/react/dist/mpx-button.jsx +2 -2
  11. package/lib/runtime/components/react/dist/mpx-camera.d.ts +0 -1
  12. package/lib/runtime/components/react/dist/mpx-camera.jsx +36 -4
  13. package/lib/runtime/components/react/dist/mpx-canvas/index.d.ts +0 -1
  14. package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +1 -2
  15. package/lib/runtime/components/react/dist/mpx-checkbox-group.d.ts +0 -1
  16. package/lib/runtime/components/react/dist/mpx-checkbox-group.jsx +2 -2
  17. package/lib/runtime/components/react/dist/mpx-checkbox.d.ts +0 -1
  18. package/lib/runtime/components/react/dist/mpx-checkbox.jsx +2 -2
  19. package/lib/runtime/components/react/dist/mpx-form.d.ts +0 -1
  20. package/lib/runtime/components/react/dist/mpx-form.jsx +2 -2
  21. package/lib/runtime/components/react/dist/mpx-icon/index.d.ts +0 -1
  22. package/lib/runtime/components/react/dist/mpx-icon/index.jsx +2 -2
  23. package/lib/runtime/components/react/dist/mpx-image.d.ts +0 -1
  24. package/lib/runtime/components/react/dist/mpx-image.jsx +2 -2
  25. package/lib/runtime/components/react/dist/mpx-inline-text.jsx +13 -4
  26. package/lib/runtime/components/react/dist/mpx-input.d.ts +0 -1
  27. package/lib/runtime/components/react/dist/mpx-input.jsx +16 -8
  28. package/lib/runtime/components/react/dist/mpx-label.d.ts +0 -1
  29. package/lib/runtime/components/react/dist/mpx-label.jsx +2 -2
  30. package/lib/runtime/components/react/dist/mpx-movable-area.d.ts +0 -1
  31. package/lib/runtime/components/react/dist/mpx-movable-area.jsx +2 -2
  32. package/lib/runtime/components/react/dist/mpx-movable-view.d.ts +0 -1
  33. package/lib/runtime/components/react/dist/mpx-movable-view.jsx +2 -2
  34. package/lib/runtime/components/react/dist/mpx-nav.jsx +1 -1
  35. package/lib/runtime/components/react/dist/mpx-picker/index.jsx +72 -23
  36. package/lib/runtime/components/react/dist/mpx-picker/multiSelector.jsx +2 -2
  37. package/lib/runtime/components/react/dist/mpx-picker/type.d.ts +4 -0
  38. package/lib/runtime/components/react/dist/mpx-picker-view/index.jsx +6 -8
  39. package/lib/runtime/components/react/dist/mpx-picker-view/pickerVIewContext.d.ts +0 -2
  40. package/lib/runtime/components/react/dist/mpx-picker-view/pickerVIewContext.js +0 -5
  41. package/lib/runtime/components/react/dist/mpx-picker-view-column/index.d.ts +1 -0
  42. package/lib/runtime/components/react/dist/mpx-picker-view-column/index.jsx +34 -14
  43. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.d.ts +0 -2
  44. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.jsx +4 -5
  45. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.d.ts +0 -2
  46. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.jsx +3 -5
  47. package/lib/runtime/components/react/dist/mpx-popup/index.d.ts +5 -4
  48. package/lib/runtime/components/react/dist/mpx-popup/index.jsx +2 -2
  49. package/lib/runtime/components/react/dist/mpx-popup/popupBase.jsx +3 -2
  50. package/lib/runtime/components/react/dist/mpx-progress.d.ts +0 -1
  51. package/lib/runtime/components/react/dist/mpx-progress.jsx +1 -2
  52. package/lib/runtime/components/react/dist/mpx-radio-group.d.ts +0 -1
  53. package/lib/runtime/components/react/dist/mpx-radio-group.jsx +2 -2
  54. package/lib/runtime/components/react/dist/mpx-radio.d.ts +0 -1
  55. package/lib/runtime/components/react/dist/mpx-radio.jsx +2 -2
  56. package/lib/runtime/components/react/dist/mpx-rich-text/index.d.ts +0 -1
  57. package/lib/runtime/components/react/dist/mpx-rich-text/index.jsx +1 -2
  58. package/lib/runtime/components/react/dist/mpx-scroll-view.d.ts +0 -1
  59. package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +2 -2
  60. package/lib/runtime/components/react/dist/mpx-section-list.d.ts +51 -0
  61. package/lib/runtime/components/react/dist/mpx-section-list.jsx +376 -0
  62. package/lib/runtime/components/react/dist/mpx-simple-text.jsx +27 -14
  63. package/lib/runtime/components/react/dist/mpx-simple-view.d.ts +1 -0
  64. package/lib/runtime/components/react/dist/mpx-slider.d.ts +0 -1
  65. package/lib/runtime/components/react/dist/mpx-slider.jsx +1 -2
  66. package/lib/runtime/components/react/dist/mpx-sticky-header.d.ts +0 -1
  67. package/lib/runtime/components/react/dist/mpx-sticky-header.jsx +2 -2
  68. package/lib/runtime/components/react/dist/mpx-sticky-section.d.ts +0 -1
  69. package/lib/runtime/components/react/dist/mpx-sticky-section.jsx +2 -2
  70. package/lib/runtime/components/react/dist/mpx-swiper-item.d.ts +0 -1
  71. package/lib/runtime/components/react/dist/mpx-swiper.d.ts +0 -1
  72. package/lib/runtime/components/react/dist/mpx-swiper.jsx +1 -2
  73. package/lib/runtime/components/react/dist/mpx-switch.d.ts +0 -1
  74. package/lib/runtime/components/react/dist/mpx-switch.jsx +1 -2
  75. package/lib/runtime/components/react/dist/mpx-text.d.ts +0 -1
  76. package/lib/runtime/components/react/dist/mpx-text.jsx +22 -8
  77. package/lib/runtime/components/react/dist/mpx-video.d.ts +0 -1
  78. package/lib/runtime/components/react/dist/mpx-video.jsx +1 -2
  79. package/lib/runtime/components/react/dist/mpx-view.d.ts +0 -1
  80. package/lib/runtime/components/react/dist/mpx-view.jsx +1 -2
  81. package/lib/runtime/components/react/dist/mpx-web-view.d.ts +2 -1
  82. package/lib/runtime/components/react/dist/utils.d.ts +6 -9
  83. package/lib/runtime/components/react/dist/utils.jsx +70 -84
  84. package/lib/runtime/components/react/mpx-button.tsx +1 -3
  85. package/lib/runtime/components/react/mpx-camera.tsx +40 -5
  86. package/lib/runtime/components/react/mpx-canvas/index.tsx +5 -5
  87. package/lib/runtime/components/react/mpx-checkbox-group.tsx +1 -3
  88. package/lib/runtime/components/react/mpx-checkbox.tsx +1 -3
  89. package/lib/runtime/components/react/mpx-form.tsx +1 -3
  90. package/lib/runtime/components/react/mpx-icon/index.tsx +1 -3
  91. package/lib/runtime/components/react/mpx-image.tsx +2 -5
  92. package/lib/runtime/components/react/mpx-inline-text.tsx +13 -4
  93. package/lib/runtime/components/react/mpx-input.tsx +19 -10
  94. package/lib/runtime/components/react/mpx-label.tsx +1 -3
  95. package/lib/runtime/components/react/mpx-movable-area.tsx +2 -3
  96. package/lib/runtime/components/react/mpx-movable-view.tsx +1 -3
  97. package/lib/runtime/components/react/mpx-nav.tsx +1 -1
  98. package/lib/runtime/components/react/mpx-picker/index.tsx +100 -29
  99. package/lib/runtime/components/react/mpx-picker/multiSelector.tsx +3 -3
  100. package/lib/runtime/components/react/mpx-picker/selector.tsx +1 -1
  101. package/lib/runtime/components/react/mpx-picker/type.ts +4 -0
  102. package/lib/runtime/components/react/mpx-picker-view/index.tsx +12 -17
  103. package/lib/runtime/components/react/mpx-picker-view/pickerVIewContext.ts +0 -9
  104. package/lib/runtime/components/react/mpx-picker-view-column/index.tsx +44 -21
  105. package/lib/runtime/components/react/mpx-picker-view-column/pickerViewColumnItem.tsx +1 -9
  106. package/lib/runtime/components/react/mpx-picker-view-column/pickerViewColumnItemLite.tsx +0 -9
  107. package/lib/runtime/components/react/mpx-popup/index.tsx +7 -3
  108. package/lib/runtime/components/react/mpx-popup/popupBase.tsx +3 -2
  109. package/lib/runtime/components/react/mpx-progress.tsx +0 -3
  110. package/lib/runtime/components/react/mpx-radio-group.tsx +1 -3
  111. package/lib/runtime/components/react/mpx-radio.tsx +1 -3
  112. package/lib/runtime/components/react/mpx-rich-text/index.tsx +0 -3
  113. package/lib/runtime/components/react/mpx-scroll-view.tsx +1 -3
  114. package/lib/runtime/components/react/mpx-section-list.tsx +557 -0
  115. package/lib/runtime/components/react/mpx-simple-text.tsx +26 -13
  116. package/lib/runtime/components/react/mpx-slider.tsx +0 -3
  117. package/lib/runtime/components/react/mpx-sticky-header.tsx +1 -3
  118. package/lib/runtime/components/react/mpx-sticky-section.tsx +1 -3
  119. package/lib/runtime/components/react/mpx-swiper-item.tsx +0 -1
  120. package/lib/runtime/components/react/mpx-swiper.tsx +0 -3
  121. package/lib/runtime/components/react/mpx-switch.tsx +0 -3
  122. package/lib/runtime/components/react/mpx-text.tsx +21 -9
  123. package/lib/runtime/components/react/mpx-video.tsx +0 -3
  124. package/lib/runtime/components/react/mpx-view.tsx +0 -3
  125. package/lib/runtime/components/react/mpx-web-view.tsx +4 -3
  126. package/lib/runtime/components/react/utils.tsx +82 -88
  127. package/lib/template-compiler/compiler.js +6 -0
  128. package/package.json +5 -5
@@ -3,16 +3,14 @@ import { LayoutChangeEvent } from 'react-native'
3
3
  import Reanimated, { Extrapolation, interpolate, useAnimatedStyle } from 'react-native-reanimated'
4
4
  import { extendObject } from '../utils'
5
5
  import { createFaces } from './pickerViewFaces'
6
- import { usePickerViewColumnAnimationContext, usePickerViewStyleContext } from '../mpx-picker-view/pickerVIewContext'
6
+ import { usePickerViewColumnAnimationContext } from '../mpx-picker-view/pickerVIewContext'
7
7
 
8
8
  interface PickerColumnItemProps {
9
9
  item: React.ReactElement
10
10
  index: number
11
11
  itemHeight: number
12
12
  itemWidth?: number | '100%'
13
- textStyle: Record<string, any>
14
13
  visibleCount: number
15
- textProps?: any
16
14
  onItemLayout?: (e: LayoutChangeEvent) => void
17
15
  }
18
16
 
@@ -21,12 +19,9 @@ const PickerViewColumnItem: React.FC<PickerColumnItemProps> = ({
21
19
  index,
22
20
  itemHeight,
23
21
  itemWidth = '100%',
24
- textStyle,
25
- textProps,
26
22
  visibleCount,
27
23
  onItemLayout
28
24
  }) => {
29
- const textStyleFromAncestor = usePickerViewStyleContext()
30
25
  const offsetYShared = usePickerViewColumnAnimationContext()
31
26
  const facesShared = useMemo(() => createFaces(itemHeight, visibleCount), [itemHeight, visibleCount])
32
27
 
@@ -48,12 +43,9 @@ const PickerViewColumnItem: React.FC<PickerColumnItemProps> = ({
48
43
  {
49
44
  style: extendObject(
50
45
  { height: itemHeight, width: '100%' },
51
- textStyleFromAncestor,
52
- textStyle,
53
46
  item.props.style
54
47
  )
55
48
  },
56
- textProps,
57
49
  restProps
58
50
  )
59
51
  const realItem = React.cloneElement(item, itemProps)
@@ -1,15 +1,12 @@
1
1
  import React from 'react'
2
2
  import { LayoutChangeEvent, View } from 'react-native'
3
3
  import { extendObject } from '../utils'
4
- import { usePickerViewStyleContext } from '../mpx-picker-view/pickerVIewContext'
5
4
 
6
5
  interface PickerColumnItemProps {
7
6
  item: React.ReactElement
8
7
  index: number
9
8
  itemHeight: number
10
9
  itemWidth?: number | '100%'
11
- textStyle: Record<string, any>
12
- textProps?: any
13
10
  onItemLayout?: (e: LayoutChangeEvent) => void
14
11
  }
15
12
 
@@ -18,23 +15,17 @@ const PickerViewColumnItem: React.FC<PickerColumnItemProps> = ({
18
15
  index,
19
16
  itemHeight,
20
17
  itemWidth = '100%',
21
- textStyle,
22
- textProps,
23
18
  onItemLayout
24
19
  }) => {
25
- const textStyleFromAncestor = usePickerViewStyleContext()
26
20
  const strKey = `picker-column-item-${index}`
27
21
  const restProps = index === 0 ? { onLayout: onItemLayout } : {}
28
22
  const itemProps = extendObject(
29
23
  {
30
24
  style: extendObject(
31
25
  { height: itemHeight, width: '100%' },
32
- textStyleFromAncestor,
33
- textStyle,
34
26
  item.props.style
35
27
  )
36
28
  },
37
- textProps,
38
29
  restProps
39
30
  )
40
31
  const realItem = React.cloneElement(item, itemProps)
@@ -11,6 +11,10 @@ export interface IUsePopupOptions {
11
11
  type?: PopupType
12
12
  }
13
13
 
14
+ type PopupOptions = {
15
+ contentHeight?: number
16
+ }
17
+
14
18
  /**
15
19
  * 根据 type 返回对应的弹窗壳子组件
16
20
  */
@@ -44,7 +48,7 @@ const createPopupManager = (options: IUsePopupOptions = {}) => {
44
48
  const open = (
45
49
  childComponent: React.ReactNode,
46
50
  pageId: number | undefined,
47
- options?: { contentHeight?: number }
51
+ options?: PopupOptions
48
52
  ) => {
49
53
  if (!isOpen && pageId != null) {
50
54
  isOpen = true
@@ -57,9 +61,9 @@ const createPopupManager = (options: IUsePopupOptions = {}) => {
57
61
  }
58
62
  }
59
63
 
60
- const update = (updatedChild: ReactElement | null) => {
64
+ const update = (updatedChild: ReactElement | null, options?: PopupOptions) => {
61
65
  if (popupKey !== null && child !== null && updatedChild !== null) {
62
- child = cloneElement(child, { children: updatedChild })
66
+ child = cloneElement(child, Object.assign({ children: updatedChild }, options))
63
67
  Portal.update(popupKey, child)
64
68
  }
65
69
  }
@@ -59,8 +59,9 @@ const PopupBase = (props: PopupBaseProps = {}) => {
59
59
  contentHeight = MOVEOUT_HEIGHT,
60
60
  visible = false
61
61
  } = props
62
+ const moveoutHeight = contentHeight + bottom
62
63
  const fade = useSharedValue<number>(MASK_OFF)
63
- const slide = useSharedValue<number>(contentHeight)
64
+ const slide = useSharedValue<number>(moveoutHeight)
64
65
 
65
66
  const animatedStylesMask = useAnimatedStyle(() => ({
66
67
  opacity: fade.value
@@ -87,7 +88,7 @@ const PopupBase = (props: PopupBaseProps = {}) => {
87
88
  duration: 300
88
89
  })
89
90
  slide.value = withTiming(
90
- contentHeight,
91
+ moveoutHeight,
91
92
  {
92
93
  easing: Easing.inOut(Easing.poly(3)),
93
94
  duration: 300
@@ -51,7 +51,6 @@ export interface ProgressProps {
51
51
  style?: ViewStyle & Record<string, any>
52
52
  'enable-offset'?: boolean
53
53
  'enable-var'?: boolean
54
- 'parent-font-size'?: number
55
54
  'parent-width'?: number
56
55
  'parent-height'?: number
57
56
  }
@@ -71,7 +70,6 @@ const Progress = forwardRef<
71
70
  duration = 30,
72
71
  style = {},
73
72
  'enable-var': enableVar,
74
- 'parent-font-size': parentFontSize,
75
73
  'parent-width': parentWidth,
76
74
  'parent-height': parentHeight
77
75
  } = props
@@ -92,7 +90,6 @@ const Progress = forwardRef<
92
90
  hasPositionFixed
93
91
  } = useTransformStyle(style, {
94
92
  enableVar,
95
- parentFontSize,
96
93
  parentWidth,
97
94
  parentHeight
98
95
  })
@@ -29,7 +29,6 @@ export interface RadioGroupProps {
29
29
  style?: ViewStyle & Record<string, any>
30
30
  'enable-offset'?: boolean
31
31
  'enable-var'?: boolean
32
- 'parent-font-size'?: number
33
32
  'parent-width'?: number
34
33
  'parent-height'?: number
35
34
  children: ReactNode
@@ -43,7 +42,6 @@ const radioGroup = forwardRef<
43
42
  const {
44
43
  style = {},
45
44
  'enable-var': enableVar,
46
- 'parent-font-size': parentFontSize,
47
45
  'parent-width': parentWidth,
48
46
  'parent-height': parentHeight
49
47
  } = props
@@ -75,7 +73,7 @@ const radioGroup = forwardRef<
75
73
  varContextRef,
76
74
  setWidth,
77
75
  setHeight
78
- } = useTransformStyle(style, { enableVar, parentFontSize, parentWidth, parentHeight, defaultStyle })
76
+ } = useTransformStyle(style, { enableVar, parentWidth, parentHeight, defaultStyle })
79
77
 
80
78
  const nodeRef = useRef(null)
81
79
  useNodesRef(props, ref, nodeRef, { style: normalStyle })
@@ -23,7 +23,6 @@ export interface RadioProps {
23
23
  'enable-offset'?: boolean
24
24
  'enable-var'?: boolean
25
25
  'enable-text-pass-through'?: boolean
26
- 'parent-font-size'?: number
27
26
  'parent-width'?: number
28
27
  'parent-height'?: number
29
28
  children: ReactNode
@@ -76,7 +75,6 @@ const Radio = forwardRef<HandlerRef<View, RadioProps>, RadioProps>(
76
75
  style = [],
77
76
  'enable-var': enableVar,
78
77
  'enable-text-pass-through': enableTextPassThrough,
79
- 'parent-font-size': parentFontSize,
80
78
  'parent-width': parentWidth,
81
79
  'parent-height': parentHeight,
82
80
  bindtap
@@ -123,7 +121,7 @@ const Radio = forwardRef<HandlerRef<View, RadioProps>, RadioProps>(
123
121
  varContextRef,
124
122
  setWidth,
125
123
  setHeight
126
- } = useTransformStyle(style, { enableVar, parentFontSize, parentWidth, parentHeight, defaultStyle: styles.container })
124
+ } = useTransformStyle(style, { enableVar, parentWidth, parentHeight, defaultStyle: styles.container })
127
125
 
128
126
  const { textStyle, backgroundStyle, innerStyle = {} } = splitStyle(normalStyle)
129
127
  const textPassThrough = useTextPassThrough(textStyle, textProps, { enableTextPassThrough })
@@ -23,7 +23,6 @@ interface _RichTextProps extends ViewProps {
23
23
  style?: ViewStyle
24
24
  nodes: string | Array<Node>
25
25
  'enable-var'?: boolean
26
- 'parent-font-size'?: number
27
26
  'parent-width'?: number
28
27
  'parent-height'?: number
29
28
  }
@@ -56,7 +55,6 @@ const _RichText = forwardRef<HandlerRef<View, _RichTextProps>, _RichTextProps>((
56
55
  style = {},
57
56
  nodes,
58
57
  'enable-var': enableVar,
59
- 'parent-font-size': parentFontSize,
60
58
  'parent-width': parentWidth,
61
59
  'parent-height': parentHeight
62
60
  } = props
@@ -75,7 +73,6 @@ const _RichText = forwardRef<HandlerRef<View, _RichTextProps>, _RichTextProps>((
75
73
  height: webViewHeight
76
74
  }, style), {
77
75
  enableVar,
78
- parentFontSize,
79
76
  parentWidth,
80
77
  parentHeight
81
78
  })
@@ -67,7 +67,6 @@ interface ScrollViewProps {
67
67
  'enable-trigger-intersection-observer'?: boolean;
68
68
  'enable-var'?: boolean;
69
69
  'enable-text-pass-through'?: boolean;
70
- 'parent-font-size'?: number;
71
70
  'parent-width'?: number;
72
71
  'parent-height'?: number;
73
72
  'enable-sticky'?: boolean;
@@ -146,7 +145,6 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
146
145
  'refresher-triggered': refresherTriggered,
147
146
  'enable-var': enableVar,
148
147
  'enable-text-pass-through': enableTextPassThrough,
149
- 'parent-font-size': parentFontSize,
150
148
  'parent-width': parentWidth,
151
149
  'parent-height': parentHeight,
152
150
  'simultaneous-handlers': originSimultaneousHandlers,
@@ -200,7 +198,7 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
200
198
  hasPositionFixed,
201
199
  setWidth,
202
200
  setHeight
203
- } = useTransformStyle(style, { enableVar, parentFontSize, parentWidth, parentHeight })
201
+ } = useTransformStyle(style, { enableVar, parentWidth, parentHeight })
204
202
 
205
203
  const { textStyle, innerStyle = {} } = splitStyle(normalStyle)
206
204
  const textPassThrough = useTextPassThrough(textStyle, textProps, { enableTextPassThrough })