@mpxjs/webpack-plugin 2.10.17-beta.4 → 2.10.17-beta.6

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 (171) hide show
  1. package/lib/global.d.ts +240 -11
  2. package/lib/index.js +7 -0
  3. package/lib/loader.js +4 -0
  4. package/lib/platform/template/wx/component-config/button.js +1 -1
  5. package/lib/platform/template/wx/component-config/input.js +1 -1
  6. package/lib/platform/template/wx/component-config/textarea.js +1 -1
  7. package/lib/runtime/components/react/dist/animationHooks/index.d.ts +0 -1
  8. package/lib/runtime/components/react/dist/animationHooks/useAnimationAPIHooks.d.ts +0 -1
  9. package/lib/runtime/components/react/dist/animationHooks/useTransitionHooks.d.ts +0 -1
  10. package/lib/runtime/components/react/dist/animationHooks/utils.d.ts +0 -1
  11. package/lib/runtime/components/react/dist/context.d.ts +0 -1
  12. package/lib/runtime/components/react/dist/event.config.d.ts +0 -1
  13. package/lib/runtime/components/react/dist/getInnerListeners.d.ts +0 -1
  14. package/lib/runtime/components/react/dist/mpx-async-suspense.d.ts +0 -1
  15. package/lib/runtime/components/react/dist/mpx-button.d.ts +0 -1
  16. package/lib/runtime/components/react/dist/mpx-camera.d.ts +0 -1
  17. package/lib/runtime/components/react/dist/mpx-canvas/Bus.d.ts +0 -1
  18. package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.d.ts +0 -1
  19. package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.d.ts +0 -1
  20. package/lib/runtime/components/react/dist/mpx-canvas/Image.d.ts +0 -1
  21. package/lib/runtime/components/react/dist/mpx-canvas/ImageData.d.ts +0 -1
  22. package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.d.ts +0 -1
  23. package/lib/runtime/components/react/dist/mpx-canvas/html.d.ts +0 -1
  24. package/lib/runtime/components/react/dist/mpx-canvas/index.d.ts +0 -1
  25. package/lib/runtime/components/react/dist/mpx-canvas/utils.d.ts +0 -1
  26. package/lib/runtime/components/react/dist/mpx-checkbox-group.d.ts +0 -1
  27. package/lib/runtime/components/react/dist/mpx-checkbox.d.ts +0 -1
  28. package/lib/runtime/components/react/dist/mpx-form.d.ts +0 -1
  29. package/lib/runtime/components/react/dist/mpx-icon/index.d.ts +0 -1
  30. package/lib/runtime/components/react/dist/mpx-image.d.ts +0 -1
  31. package/lib/runtime/components/react/dist/mpx-inline-text.d.ts +0 -1
  32. package/lib/runtime/components/react/dist/mpx-input.d.ts +0 -1
  33. package/lib/runtime/components/react/dist/mpx-input.jsx +1 -1
  34. package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.d.ts +0 -1
  35. package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.jsx +4 -2
  36. package/lib/runtime/components/react/dist/mpx-label.d.ts +0 -1
  37. package/lib/runtime/components/react/dist/mpx-movable-area.d.ts +0 -1
  38. package/lib/runtime/components/react/dist/mpx-movable-view.d.ts +0 -1
  39. package/lib/runtime/components/react/dist/mpx-nav.d.ts +0 -1
  40. package/lib/runtime/components/react/dist/mpx-navigator.d.ts +0 -1
  41. package/lib/runtime/components/react/dist/mpx-picker/date.d.ts +0 -1
  42. package/lib/runtime/components/react/dist/mpx-picker/dateData.d.ts +0 -1
  43. package/lib/runtime/components/react/dist/mpx-picker/index.d.ts +0 -1
  44. package/lib/runtime/components/react/dist/mpx-picker/multiSelector.d.ts +0 -1
  45. package/lib/runtime/components/react/dist/mpx-picker/region.d.ts +0 -1
  46. package/lib/runtime/components/react/dist/mpx-picker/regionData.d.ts +0 -1
  47. package/lib/runtime/components/react/dist/mpx-picker/selector.d.ts +0 -1
  48. package/lib/runtime/components/react/dist/mpx-picker/time.d.ts +0 -1
  49. package/lib/runtime/components/react/dist/mpx-picker/type.d.ts +0 -1
  50. package/lib/runtime/components/react/dist/mpx-picker-view/index.d.ts +0 -1
  51. package/lib/runtime/components/react/dist/mpx-picker-view/pickerVIewContext.d.ts +0 -1
  52. package/lib/runtime/components/react/dist/mpx-picker-view-column/index.d.ts +0 -1
  53. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.d.ts +0 -1
  54. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.d.ts +0 -1
  55. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewFaces.d.ts +0 -1
  56. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewIndicator.d.ts +0 -1
  57. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewMask.d.ts +0 -1
  58. package/lib/runtime/components/react/dist/mpx-popup/index.d.ts +0 -1
  59. package/lib/runtime/components/react/dist/mpx-popup/popupBase.d.ts +0 -1
  60. package/lib/runtime/components/react/dist/mpx-portal/index.d.ts +0 -1
  61. package/lib/runtime/components/react/dist/mpx-portal/portal-host.d.ts +0 -1
  62. package/lib/runtime/components/react/dist/mpx-portal/portal-manager.d.ts +0 -1
  63. package/lib/runtime/components/react/dist/mpx-progress.d.ts +0 -1
  64. package/lib/runtime/components/react/dist/mpx-radio-group.d.ts +0 -1
  65. package/lib/runtime/components/react/dist/mpx-radio.d.ts +0 -1
  66. package/lib/runtime/components/react/dist/mpx-rich-text/html.d.ts +0 -1
  67. package/lib/runtime/components/react/dist/mpx-rich-text/index.d.ts +0 -1
  68. package/lib/runtime/components/react/dist/mpx-root-portal.d.ts +0 -1
  69. package/lib/runtime/components/react/dist/mpx-scroll-view.d.ts +0 -1
  70. package/lib/runtime/components/react/dist/mpx-simple-text.d.ts +0 -1
  71. package/lib/runtime/components/react/dist/mpx-simple-view.d.ts +0 -1
  72. package/lib/runtime/components/react/dist/mpx-slider.d.ts +0 -1
  73. package/lib/runtime/components/react/dist/mpx-sticky-header.d.ts +0 -1
  74. package/lib/runtime/components/react/dist/mpx-sticky-section.d.ts +0 -1
  75. package/lib/runtime/components/react/dist/mpx-swiper-item.d.ts +0 -1
  76. package/lib/runtime/components/react/dist/mpx-swiper.d.ts +1 -1
  77. package/lib/runtime/components/react/dist/mpx-swiper.jsx +43 -23
  78. package/lib/runtime/components/react/dist/mpx-switch.d.ts +0 -1
  79. package/lib/runtime/components/react/dist/mpx-text.d.ts +0 -1
  80. package/lib/runtime/components/react/dist/mpx-textarea.d.ts +0 -1
  81. package/lib/runtime/components/react/dist/mpx-video.d.ts +0 -1
  82. package/lib/runtime/components/react/dist/mpx-view.d.ts +0 -1
  83. package/lib/runtime/components/react/dist/mpx-view.jsx +20 -6
  84. package/lib/runtime/components/react/dist/mpx-web-view.d.ts +0 -1
  85. package/lib/runtime/components/react/dist/parser.d.ts +0 -1
  86. package/lib/runtime/components/react/dist/useNodesRef.d.ts +0 -1
  87. package/lib/runtime/components/react/dist/utils.d.ts +0 -1
  88. package/lib/runtime/components/react/mpx-input.tsx +1 -1
  89. package/lib/runtime/components/react/mpx-keyboard-avoiding-view.tsx +4 -2
  90. package/lib/runtime/components/react/mpx-swiper.tsx +43 -22
  91. package/lib/runtime/components/react/mpx-view.tsx +23 -7
  92. package/lib/runtime/components/react/tsconfig.json +26 -0
  93. package/lib/style-compiler/strip-conditional-loader.js +45 -29
  94. package/package.json +5 -4
  95. package/lib/runtime/components/react/dist/animationHooks/index.d.ts.map +0 -1
  96. package/lib/runtime/components/react/dist/animationHooks/useAnimationAPIHooks.d.ts.map +0 -1
  97. package/lib/runtime/components/react/dist/animationHooks/useTransitionHooks.d.ts.map +0 -1
  98. package/lib/runtime/components/react/dist/animationHooks/utils.d.ts.map +0 -1
  99. package/lib/runtime/components/react/dist/context.d.ts.map +0 -1
  100. package/lib/runtime/components/react/dist/event.config.d.ts.map +0 -1
  101. package/lib/runtime/components/react/dist/getInnerListeners.d.ts.map +0 -1
  102. package/lib/runtime/components/react/dist/mpx-async-suspense.d.ts.map +0 -1
  103. package/lib/runtime/components/react/dist/mpx-button.d.ts.map +0 -1
  104. package/lib/runtime/components/react/dist/mpx-camera.d.ts.map +0 -1
  105. package/lib/runtime/components/react/dist/mpx-canvas/Bus.d.ts.map +0 -1
  106. package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.d.ts.map +0 -1
  107. package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.d.ts.map +0 -1
  108. package/lib/runtime/components/react/dist/mpx-canvas/Image.d.ts.map +0 -1
  109. package/lib/runtime/components/react/dist/mpx-canvas/ImageData.d.ts.map +0 -1
  110. package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.d.ts.map +0 -1
  111. package/lib/runtime/components/react/dist/mpx-canvas/html.d.ts.map +0 -1
  112. package/lib/runtime/components/react/dist/mpx-canvas/index.d.ts.map +0 -1
  113. package/lib/runtime/components/react/dist/mpx-canvas/utils.d.ts.map +0 -1
  114. package/lib/runtime/components/react/dist/mpx-checkbox-group.d.ts.map +0 -1
  115. package/lib/runtime/components/react/dist/mpx-checkbox.d.ts.map +0 -1
  116. package/lib/runtime/components/react/dist/mpx-form.d.ts.map +0 -1
  117. package/lib/runtime/components/react/dist/mpx-icon/index.d.ts.map +0 -1
  118. package/lib/runtime/components/react/dist/mpx-image.d.ts.map +0 -1
  119. package/lib/runtime/components/react/dist/mpx-inline-text.d.ts.map +0 -1
  120. package/lib/runtime/components/react/dist/mpx-input.d.ts.map +0 -1
  121. package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.d.ts.map +0 -1
  122. package/lib/runtime/components/react/dist/mpx-label.d.ts.map +0 -1
  123. package/lib/runtime/components/react/dist/mpx-movable-area.d.ts.map +0 -1
  124. package/lib/runtime/components/react/dist/mpx-movable-view.d.ts.map +0 -1
  125. package/lib/runtime/components/react/dist/mpx-nav.d.ts.map +0 -1
  126. package/lib/runtime/components/react/dist/mpx-navigator.d.ts.map +0 -1
  127. package/lib/runtime/components/react/dist/mpx-picker/date.d.ts.map +0 -1
  128. package/lib/runtime/components/react/dist/mpx-picker/dateData.d.ts.map +0 -1
  129. package/lib/runtime/components/react/dist/mpx-picker/index.d.ts.map +0 -1
  130. package/lib/runtime/components/react/dist/mpx-picker/multiSelector.d.ts.map +0 -1
  131. package/lib/runtime/components/react/dist/mpx-picker/region.d.ts.map +0 -1
  132. package/lib/runtime/components/react/dist/mpx-picker/regionData.d.ts.map +0 -1
  133. package/lib/runtime/components/react/dist/mpx-picker/selector.d.ts.map +0 -1
  134. package/lib/runtime/components/react/dist/mpx-picker/time.d.ts.map +0 -1
  135. package/lib/runtime/components/react/dist/mpx-picker/type.d.ts.map +0 -1
  136. package/lib/runtime/components/react/dist/mpx-picker-view/index.d.ts.map +0 -1
  137. package/lib/runtime/components/react/dist/mpx-picker-view/pickerVIewContext.d.ts.map +0 -1
  138. package/lib/runtime/components/react/dist/mpx-picker-view-column/index.d.ts.map +0 -1
  139. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.d.ts.map +0 -1
  140. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.d.ts.map +0 -1
  141. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewFaces.d.ts.map +0 -1
  142. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewIndicator.d.ts.map +0 -1
  143. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewMask.d.ts.map +0 -1
  144. package/lib/runtime/components/react/dist/mpx-popup/index.d.ts.map +0 -1
  145. package/lib/runtime/components/react/dist/mpx-popup/popupBase.d.ts.map +0 -1
  146. package/lib/runtime/components/react/dist/mpx-portal/index.d.ts.map +0 -1
  147. package/lib/runtime/components/react/dist/mpx-portal/portal-host.d.ts.map +0 -1
  148. package/lib/runtime/components/react/dist/mpx-portal/portal-manager.d.ts.map +0 -1
  149. package/lib/runtime/components/react/dist/mpx-progress.d.ts.map +0 -1
  150. package/lib/runtime/components/react/dist/mpx-radio-group.d.ts.map +0 -1
  151. package/lib/runtime/components/react/dist/mpx-radio.d.ts.map +0 -1
  152. package/lib/runtime/components/react/dist/mpx-rich-text/html.d.ts.map +0 -1
  153. package/lib/runtime/components/react/dist/mpx-rich-text/index.d.ts.map +0 -1
  154. package/lib/runtime/components/react/dist/mpx-root-portal.d.ts.map +0 -1
  155. package/lib/runtime/components/react/dist/mpx-scroll-view.d.ts.map +0 -1
  156. package/lib/runtime/components/react/dist/mpx-simple-text.d.ts.map +0 -1
  157. package/lib/runtime/components/react/dist/mpx-simple-view.d.ts.map +0 -1
  158. package/lib/runtime/components/react/dist/mpx-slider.d.ts.map +0 -1
  159. package/lib/runtime/components/react/dist/mpx-sticky-header.d.ts.map +0 -1
  160. package/lib/runtime/components/react/dist/mpx-sticky-section.d.ts.map +0 -1
  161. package/lib/runtime/components/react/dist/mpx-swiper-item.d.ts.map +0 -1
  162. package/lib/runtime/components/react/dist/mpx-swiper.d.ts.map +0 -1
  163. package/lib/runtime/components/react/dist/mpx-switch.d.ts.map +0 -1
  164. package/lib/runtime/components/react/dist/mpx-text.d.ts.map +0 -1
  165. package/lib/runtime/components/react/dist/mpx-textarea.d.ts.map +0 -1
  166. package/lib/runtime/components/react/dist/mpx-video.d.ts.map +0 -1
  167. package/lib/runtime/components/react/dist/mpx-view.d.ts.map +0 -1
  168. package/lib/runtime/components/react/dist/mpx-web-view.d.ts.map +0 -1
  169. package/lib/runtime/components/react/dist/parser.d.ts.map +0 -1
  170. package/lib/runtime/components/react/dist/useNodesRef.d.ts.map +0 -1
  171. package/lib/runtime/components/react/dist/utils.d.ts.map +0 -1
@@ -21,4 +21,3 @@ interface ColumnProps {
21
21
  }
22
22
  declare const _PickerViewColumn: React.ForwardRefExoticComponent<ColumnProps & React.RefAttributes<HandlerRef<ScrollView & View, ColumnProps>>>;
23
23
  export default _PickerViewColumn;
24
- //# sourceMappingURL=index.d.ts.map
@@ -12,4 +12,3 @@ interface PickerColumnItemProps {
12
12
  }
13
13
  declare const PickerViewColumnItem: React.FC<PickerColumnItemProps>;
14
14
  export default PickerViewColumnItem;
15
- //# sourceMappingURL=pickerViewColumnItem.d.ts.map
@@ -11,4 +11,3 @@ interface PickerColumnItemProps {
11
11
  }
12
12
  declare const PickerViewColumnItem: React.FC<PickerColumnItemProps>;
13
13
  export default PickerViewColumnItem;
14
- //# sourceMappingURL=pickerViewColumnItemLite.d.ts.map
@@ -14,4 +14,3 @@ export declare const degToRad: (deg: number) => number;
14
14
  export declare const calcPickerHeight: (faces: Faces[], itemHeight: number) => number;
15
15
  export declare const calcHeightOffsets: (itemHeight: number) => number[];
16
16
  export declare const createFaces: (itemHeight: number, visibleCount: number) => Faces[];
17
- //# sourceMappingURL=pickerViewFaces.d.ts.map
@@ -10,4 +10,3 @@ declare const _PickerViewIndicator: {
10
10
  displayName: string;
11
11
  };
12
12
  export default _PickerViewIndicator;
13
- //# sourceMappingURL=pickerViewIndicator.d.ts.map
@@ -9,4 +9,3 @@ declare const _PickerViewMask: {
9
9
  displayName: string;
10
10
  };
11
11
  export default _PickerViewMask;
12
- //# sourceMappingURL=pickerViewMask.d.ts.map
@@ -20,4 +20,3 @@ declare const createPopupManager: (options?: IUsePopupOptions) => {
20
20
  remove: () => void;
21
21
  };
22
22
  export { createPopupManager };
23
- //# sourceMappingURL=index.d.ts.map
@@ -14,4 +14,3 @@ declare const PopupBase: {
14
14
  displayName: string;
15
15
  };
16
16
  export default PopupBase;
17
- //# sourceMappingURL=popupBase.d.ts.map
@@ -13,4 +13,3 @@ declare const Portal: {
13
13
  update: (key: number, e: ReactNode) => void;
14
14
  };
15
15
  export default Portal;
16
- //# sourceMappingURL=index.d.ts.map
@@ -27,4 +27,3 @@ declare class PortalGuard {
27
27
  export declare const portal: PortalGuard;
28
28
  declare const PortalHost: ({ children }: PortalHostProps) => JSX.Element;
29
29
  export default PortalHost;
30
- //# sourceMappingURL=portal-host.d.ts.map
@@ -7,4 +7,3 @@ export type State = {
7
7
  };
8
8
  declare const _PortalManager: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
9
9
  export default _PortalManager;
10
- //# sourceMappingURL=portal-manager.d.ts.map
@@ -21,4 +21,3 @@ export interface ProgressProps {
21
21
  }
22
22
  declare const Progress: import("react").ForwardRefExoticComponent<ProgressProps & import("react").RefAttributes<HandlerRef<View, ProgressProps>>>;
23
23
  export default Progress;
24
- //# sourceMappingURL=mpx-progress.d.ts.map
@@ -18,4 +18,3 @@ export interface RadioGroupProps {
18
18
  }
19
19
  declare const radioGroup: import("react").ForwardRefExoticComponent<RadioGroupProps & import("react").RefAttributes<HandlerRef<View, RadioGroupProps>>>;
20
20
  export default radioGroup;
21
- //# sourceMappingURL=mpx-radio-group.d.ts.map
@@ -24,4 +24,3 @@ export interface RadioProps {
24
24
  }
25
25
  declare const Radio: import("react").ForwardRefExoticComponent<RadioProps & import("react").RefAttributes<HandlerRef<View, RadioProps>>>;
26
26
  export default Radio;
27
- //# sourceMappingURL=mpx-radio.d.ts.map
@@ -1,2 +1 @@
1
1
  export declare const generateHTML: (html: string) => string;
2
- //# sourceMappingURL=html.d.ts.map
@@ -22,4 +22,3 @@ interface _RichTextProps extends ViewProps {
22
22
  }
23
23
  declare const _RichText: import("react").ForwardRefExoticComponent<_RichTextProps & import("react").RefAttributes<HandlerRef<View, _RichTextProps>>>;
24
24
  export default _RichText;
25
- //# sourceMappingURL=index.d.ts.map
@@ -12,4 +12,3 @@ declare const _RootPortal: {
12
12
  displayName: string;
13
13
  };
14
14
  export default _RootPortal;
15
- //# sourceMappingURL=mpx-root-portal.d.ts.map
@@ -52,4 +52,3 @@ declare const _ScrollView: import("react").ForwardRefExoticComponent<ScrollViewP
52
52
  children?: ReactNode;
53
53
  } & import("react-native-gesture-handler").NativeViewGestureHandlerProps & import("react").RefAttributes<import("react").ComponentType<any>>> & import("react-native").ScrollView & View, ScrollViewProps>>>;
54
54
  export default _ScrollView;
55
- //# sourceMappingURL=mpx-scroll-view.d.ts.map
@@ -5,4 +5,3 @@ declare const SimpleText: {
5
5
  displayName: string;
6
6
  };
7
7
  export default SimpleText;
8
- //# sourceMappingURL=mpx-simple-text.d.ts.map
@@ -5,4 +5,3 @@ declare const SimpleView: {
5
5
  displayName: string;
6
6
  };
7
7
  export default SimpleView;
8
- //# sourceMappingURL=mpx-simple-view.d.ts.map
@@ -28,4 +28,3 @@ export interface SliderProps {
28
28
  }
29
29
  declare const Slider: import("react").ForwardRefExoticComponent<SliderProps & import("react").RefAttributes<HandlerRef<View, SliderProps>>>;
30
30
  export default Slider;
31
- //# sourceMappingURL=mpx-slider.d.ts.map
@@ -15,4 +15,3 @@ interface StickyHeaderProps {
15
15
  }
16
16
  declare const _StickyHeader: import("react").ForwardRefExoticComponent<StickyHeaderProps & import("react").RefAttributes<HandlerRef<View, StickyHeaderProps>>>;
17
17
  export default _StickyHeader;
18
- //# sourceMappingURL=mpx-sticky-header.d.ts.map
@@ -13,4 +13,3 @@ interface StickySectionProps {
13
13
  }
14
14
  declare const _StickySection: import("react").ForwardRefExoticComponent<StickySectionProps & import("react").RefAttributes<HandlerRef<View, StickySectionProps>>>;
15
15
  export default _StickySection;
16
- //# sourceMappingURL=mpx-sticky-section.d.ts.map
@@ -16,4 +16,3 @@ interface SwiperItemProps {
16
16
  }
17
17
  declare const _SwiperItem: import("react").ForwardRefExoticComponent<SwiperItemProps & import("react").RefAttributes<HandlerRef<View, SwiperItemProps>>>;
18
18
  export default _SwiperItem;
19
- //# sourceMappingURL=mpx-swiper-item.d.ts.map
@@ -56,8 +56,8 @@ interface SwiperProps {
56
56
  'wait-for'?: Array<GestureHandler>;
57
57
  'simultaneous-handlers'?: Array<GestureHandler>;
58
58
  disableGesture?: boolean;
59
+ 'display-multiple-items'?: number;
59
60
  bindchange?: (event: NativeSyntheticEvent<TouchEvent> | unknown) => void;
60
61
  }
61
62
  declare const SwiperWrapper: React.ForwardRefExoticComponent<SwiperProps & React.RefAttributes<HandlerRef<View, SwiperProps>>>;
62
63
  export default SwiperWrapper;
63
- //# sourceMappingURL=mpx-swiper.d.ts.map
@@ -72,6 +72,7 @@ const SwiperWrapper = forwardRef((props, ref) => {
72
72
  marginBottom: dotSpacing,
73
73
  zIndex: 98
74
74
  };
75
+ const displayMultipleItems = props['display-multiple-items'] || 1;
75
76
  const easeingFunc = props['easing-function'] || 'default';
76
77
  const easeDuration = props.duration || 500;
77
78
  const horizontal = props.vertical !== undefined ? !props.vertical : true;
@@ -97,18 +98,19 @@ const SwiperWrapper = forwardRef((props, ref) => {
97
98
  const preMarginShared = useSharedValue(preMargin);
98
99
  const nextMarginShared = useSharedValue(nextMargin);
99
100
  const autoplayShared = useSharedValue(autoplay);
101
+ const children = Array.isArray(props.children) ? props.children.filter(child => child) : (props.children ? [props.children] : []);
100
102
  // 默认前后补位的元素个数
101
- const patchElmNum = circular ? (preMargin ? 2 : 1) : 0;
103
+ const patchElmNum = (circular && children.length > 1) ? displayMultipleItems + 1 : 0;
102
104
  const patchElmNumShared = useSharedValue(patchElmNum);
105
+ const displayMultipleItemsShared = useSharedValue(displayMultipleItems);
103
106
  const circularShared = useSharedValue(circular);
104
- const children = Array.isArray(props.children) ? props.children.filter(child => child) : (props.children ? [props.children] : []);
105
107
  // 对有变化的变量,在worklet中只能使用sharedValue变量,useRef不能更新
106
108
  const childrenLength = useSharedValue(children.length);
107
109
  const initWidth = typeof normalStyle?.width === 'number' ? normalStyle.width - preMargin - nextMargin : normalStyle.width;
108
110
  const initHeight = typeof normalStyle?.height === 'number' ? normalStyle.height - preMargin - nextMargin : normalStyle.height;
109
111
  const dir = horizontal === false ? 'y' : 'x';
110
112
  const pstep = dir === 'x' ? initWidth : initHeight;
111
- const initStep = isNaN(pstep) ? 0 : pstep;
113
+ const initStep = isNaN(pstep) ? 0 : pstep / displayMultipleItems;
112
114
  // 每个元素的宽度 or 高度,有固定值直接初始化无则0
113
115
  const step = useSharedValue(initStep);
114
116
  // 记录选中元素的索引值
@@ -168,7 +170,7 @@ const SwiperWrapper = forwardRef((props, ref) => {
168
170
  const { width, height } = e.nativeEvent.layout;
169
171
  const realWidth = dir === 'x' ? width - preMargin - nextMargin : width;
170
172
  const realHeight = dir === 'y' ? height - preMargin - nextMargin : height;
171
- const iStep = dir === 'x' ? realWidth : realHeight;
173
+ const iStep = (dir === 'x' ? realWidth : realHeight) / displayMultipleItems;
172
174
  if (iStep !== step.value) {
173
175
  step.value = iStep;
174
176
  updateCurrent(propCurrent, iStep);
@@ -224,19 +226,35 @@ const SwiperWrapper = forwardRef((props, ref) => {
224
226
  function renderItems() {
225
227
  const intLen = children.length;
226
228
  let renderChild = children.slice();
229
+ // if (circular && intLen > 1) {
230
+ // // 最前面加最后一个元素
231
+ // const lastChild = React.cloneElement(children[intLen - 1] as ReactElement, { key: 'clone0' })
232
+ // // 最后面加第一个元素
233
+ // const firstChild = React.cloneElement(children[0] as ReactElement, { key: 'clone1' })
234
+ // if (preMargin) {
235
+ // const lastChild1 = React.cloneElement(children[intLen - 2] as ReactElement, { key: 'clone2' })
236
+ // const firstChild1 = React.cloneElement(children[1] as ReactElement, { key: 'clone3' })
237
+ // renderChild = [lastChild1, lastChild].concat(renderChild).concat([firstChild, firstChild1])
238
+ // } else {
239
+ // renderChild = [lastChild].concat(renderChild).concat([firstChild])
240
+ // }
241
+ // }
227
242
  if (circular && intLen > 1) {
228
- // 最前面加最后一个元素
229
- const lastChild = React.cloneElement(children[intLen - 1], { key: 'clone0' });
230
- // 最后面加第一个元素
231
- const firstChild = React.cloneElement(children[0], { key: 'clone1' });
232
- if (preMargin) {
233
- const lastChild1 = React.cloneElement(children[intLen - 2], { key: 'clone2' });
234
- const firstChild1 = React.cloneElement(children[1], { key: 'clone3' });
235
- renderChild = [lastChild1, lastChild].concat(renderChild).concat([firstChild, firstChild1]);
236
- }
237
- else {
238
- renderChild = [lastChild].concat(renderChild).concat([firstChild]);
239
- }
243
+ // 动态生成前置补位元素
244
+ const frontClones = [];
245
+ // 计算补位序列的起始索引。例如 len=3, patch=2 -> start=1 (即从B开始)
246
+ const startIndex = intLen - (patchElmNum % intLen);
247
+ for (let i = 0; i < patchElmNum; i++) {
248
+ const sourceIndex = (startIndex + i) % intLen;
249
+ frontClones.push(React.cloneElement(children[sourceIndex], { key: `clone_front_${i}` }));
250
+ }
251
+ // 动态生成后置补位元素
252
+ const backClones = [];
253
+ for (let i = 0; i < patchElmNum; i++) {
254
+ const sourceIndex = i % intLen;
255
+ backClones.push(React.cloneElement(children[sourceIndex], { key: `clone_back_${i}` }));
256
+ }
257
+ renderChild = [...frontClones, ...renderChild, ...backClones];
240
258
  }
241
259
  const arrChildren = renderChild.map((child, index) => {
242
260
  const extraStyle = {};
@@ -271,7 +289,7 @@ const SwiperWrapper = forwardRef((props, ref) => {
271
289
  let nextIndex = currentIndex.value;
272
290
  if (!circularShared.value) {
273
291
  // 获取下一个位置的坐标, 循环到最后一个元素,直接停止, 取消定时器
274
- if (currentIndex.value === childrenLength.value - 1) {
292
+ if (currentIndex.value === childrenLength.value - displayMultipleItemsShared.value) {
275
293
  pauseLoop();
276
294
  return;
277
295
  }
@@ -438,12 +456,13 @@ const SwiperWrapper = forwardRef((props, ref) => {
438
456
  };
439
457
  }, [autoplay]);
440
458
  useEffect(() => {
441
- if (circular !== circularShared.value) {
459
+ if (circular !== circularShared.value || patchElmNum !== patchElmNumShared.value || displayMultipleItems !== displayMultipleItemsShared.value) {
442
460
  circularShared.value = circular;
443
- patchElmNumShared.value = circular ? (preMargin ? 2 : 1) : 0;
461
+ patchElmNumShared.value = patchElmNum;
462
+ displayMultipleItemsShared.value = displayMultipleItems;
444
463
  offset.value = getOffset(currentIndex.value, step.value);
445
464
  }
446
- }, [circular, preMargin]);
465
+ }, [circular, patchElmNum, displayMultipleItems]);
447
466
  const { gestureHandler } = useMemo(() => {
448
467
  function getTargetPosition(eventData) {
449
468
  'worklet';
@@ -461,7 +480,8 @@ const SwiperWrapper = forwardRef((props, ref) => {
461
480
  const moveToIndex = transdir < 0 ? Math.ceil(computedIndex) : Math.floor(computedIndex);
462
481
  // 实际应该定位的索引值
463
482
  if (!circularShared.value) {
464
- selectedIndex = moveToIndex;
483
+ const maxIndex = Math.max(0, childrenLength.value - displayMultipleItemsShared.value);
484
+ selectedIndex = Math.min(Math.max(moveToIndex, 0), maxIndex);
465
485
  moveToTargetPos = selectedIndex * step.value;
466
486
  }
467
487
  else {
@@ -497,7 +517,7 @@ const SwiperWrapper = forwardRef((props, ref) => {
497
517
  const gestureMovePos = offset.value + translation;
498
518
  if (!circularShared.value) {
499
519
  // 如果只判断区间,中间非滑动状态(handleResistanceMove)向左滑动,突然改为向右滑动,但是还在非滑动态,本应该可滑动判断为了不可滑动
500
- const posEnd = -step.value * (childrenLength.value - 1);
520
+ const posEnd = -step.value * (childrenLength.value - displayMultipleItemsShared.value);
501
521
  if (transdir < 0) {
502
522
  return gestureMovePos > posEnd;
503
523
  }
@@ -627,7 +647,7 @@ const SwiperWrapper = forwardRef((props, ref) => {
627
647
  const { translation, transdir } = eventData;
628
648
  const moveToOffset = offset.value + translation;
629
649
  const maxOverDrag = Math.floor(step.value / 2);
630
- const maxOffset = translation < 0 ? -(childrenLength.value - 1) * step.value : 0;
650
+ const maxOffset = translation < 0 ? -(childrenLength.value - displayMultipleItemsShared.value) * step.value : 0;
631
651
  let resistance = 0.1;
632
652
  let overDrag = 0;
633
653
  let finalOffset = 0;
@@ -24,4 +24,3 @@ interface _SwitchProps extends SwitchProps {
24
24
  }
25
25
  declare const _Switch: import("react").ForwardRefExoticComponent<_SwitchProps & import("react").RefAttributes<HandlerRef<Switch, _SwitchProps>>>;
26
26
  export default _Switch;
27
- //# sourceMappingURL=mpx-switch.d.ts.map
@@ -20,4 +20,3 @@ interface _TextProps extends TextProps {
20
20
  }
21
21
  declare const _Text: import("react").ForwardRefExoticComponent<_TextProps & import("react").RefAttributes<HandlerRef<Text, _TextProps>>>;
22
22
  export default _Text;
23
- //# sourceMappingURL=mpx-text.d.ts.map
@@ -5,4 +5,3 @@ import { HandlerRef } from './useNodesRef';
5
5
  export type TextareProps = Omit<InputProps & PrivateInputProps, 'type' | 'password' | 'multiline' | 'confirm-hold'>;
6
6
  declare const Textarea: import("react").ForwardRefExoticComponent<TextareProps & import("react").RefAttributes<HandlerRef<TextInput, TextareProps>>>;
7
7
  export default Textarea;
8
- //# sourceMappingURL=mpx-textarea.d.ts.map
@@ -99,4 +99,3 @@ interface VideoProps {
99
99
  }
100
100
  declare const MpxVideo: import("react").ForwardRefExoticComponent<VideoProps & import("react").RefAttributes<HandlerRef<View, VideoProps>>>;
101
101
  export default MpxVideo;
102
- //# sourceMappingURL=mpx-video.d.ts.map
@@ -33,4 +33,3 @@ export interface _ViewProps extends ViewProps {
33
33
  }
34
34
  declare const _View: import("react").ForwardRefExoticComponent<_ViewProps & import("react").RefAttributes<HandlerRef<View, _ViewProps>>>;
35
35
  export default _View;
36
- //# sourceMappingURL=mpx-view.d.ts.map
@@ -274,6 +274,18 @@ function normalizeBackgroundPosition(parts) {
274
274
  let hOffset = 0;
275
275
  let vStart = 'top';
276
276
  let vOffset = 0;
277
+ if (!Array.isArray(parts)) {
278
+ // 模板 style 属性传入单个数值时不会和 class 一样转成数组,需要手动转换
279
+ parts = [parts];
280
+ }
281
+ // 模板 style 属性传入时, 需要额外转换处理单位 px/rpx/vh 以及 center 转化为 50%
282
+ parts = parts.map((part) => {
283
+ if (typeof part !== 'string')
284
+ return part;
285
+ if (part === 'center')
286
+ return '50%';
287
+ return global.__formatValue(part);
288
+ });
277
289
  if (parts.length === 4)
278
290
  return parts;
279
291
  // 归一化
@@ -415,14 +427,16 @@ function normalizeBackgroundSize(backgroundSize, type) {
415
427
  const sizeList = backgroundSize.slice();
416
428
  if (sizeList.length === 1)
417
429
  sizeList.push('auto');
418
- if (type === 'linear') {
430
+ return sizeList.map((val) => {
431
+ if (typeof val !== 'string')
432
+ return val;
419
433
  // 处理当使用渐变的时候,background-size出现cover, contain, auto,当作100%处理
420
- for (const i in sizeList) {
421
- const val = sizeList[i];
422
- sizeList[i] = /^cover|contain|auto$/.test(val) ? '100%' : val;
434
+ if (type === 'linear' && /^cover|contain|auto$/.test(val)) {
435
+ val = '100%';
423
436
  }
424
- }
425
- return sizeList;
437
+ // 模板 style 属性传入时, 需要额外转换处理单位 px/rpx/vh
438
+ return global.__formatValue(val);
439
+ });
426
440
  }
427
441
  function preParseImage(imageStyle) {
428
442
  const { backgroundImage = '', backgroundSize = ['auto'], backgroundPosition = [0, 0] } = normalizeStyle(imageStyle) || {};
@@ -20,4 +20,3 @@ interface WebViewProps {
20
20
  }
21
21
  declare const _WebView: import("react").ForwardRefExoticComponent<Omit<WebViewProps, "ref"> & import("react").RefAttributes<HandlerRef<WebView<{}>, WebViewProps>>>;
22
22
  export default _WebView;
23
- //# sourceMappingURL=mpx-web-view.d.ts.map
@@ -37,4 +37,3 @@ export declare class ReplaceSource {
37
37
  source(): string;
38
38
  }
39
39
  export {};
40
- //# sourceMappingURL=parser.d.ts.map
@@ -9,4 +9,3 @@ export type HandlerRef<T, P> = {
9
9
  };
10
10
  export default function useNodesRef<T, P>(props: P, ref: ForwardedRef<HandlerRef<T, P>>, nodeRef: RefObject<T>, instance?: Obj): void;
11
11
  export {};
12
- //# sourceMappingURL=useNodesRef.d.ts.map
@@ -121,4 +121,3 @@ export declare function useHover({ enableHover, hoverStartTime, hoverStayTime, d
121
121
  };
122
122
  export declare function useRunOnJSCallback(callbackMapRef: MutableRefObject<Record<string, AnyFunc>>): (key: string, ...args: any) => any;
123
123
  export {};
124
- //# sourceMappingURL=utils.d.ts.map
@@ -285,11 +285,11 @@ const Input = forwardRef<HandlerRef<TextInput, FinalInputProps>, FinalInputProps
285
285
 
286
286
  const setKeyboardAvoidContext = () => {
287
287
  if (keyboardAvoid) {
288
- keyboardAvoid.current = { cursorSpacing, ref: nodeRef, adjustPosition, holdKeyboard }
289
288
  keyboardAvoid.current = {
290
289
  cursorSpacing,
291
290
  ref: nodeRef,
292
291
  adjustPosition,
292
+ holdKeyboard,
293
293
  // fix: iOS 会在 onFocus 之前触发 keyboardWillShow 并且赋值 keyboardHeight
294
294
  // 这里手动同步下 keyboardHeight,防止 onFocus setKeyboardAvoidContext 删掉 keyboardHeight
295
295
  keyboardHeight: keyboardAvoid?.current?.keyboardHeight
@@ -25,8 +25,10 @@ const KeyboardAvoidingView = ({ children, style, contentContainerStyle }: Keyboa
25
25
  const isShow = useRef<boolean>(false)
26
26
 
27
27
  const animatedStyle = useAnimatedStyle(() => ({
28
- // translate/position top可能会导致底部渲染区域缺失
29
- marginTop: -offset.value,
28
+ // translate/position top+ overflow hidden 在 android 上时因为键盘顶起让页面高度变小,同时元素位置上移
29
+ // 此时最底部的区域是超出了页面高度的,hidden生效就被隐藏掉,因此需要 android 配置聚焦时禁用高度缩小
30
+ // margin-top 因为在 react-native 上和 flex 1 同时存在时,负值只会让容器高度整体变高,不会让元素上移
31
+ transform: [{ translateY: -offset.value }],
30
32
  flexBasis: basic.value as DimensionValue
31
33
  }))
32
34
 
@@ -73,6 +73,7 @@ interface SwiperProps {
73
73
  'wait-for'?: Array<GestureHandler>
74
74
  'simultaneous-handlers'?: Array<GestureHandler>
75
75
  disableGesture?: boolean
76
+ 'display-multiple-items'?: number
76
77
  bindchange?: (event: NativeSyntheticEvent<TouchEvent> | unknown) => void
77
78
  }
78
79
 
@@ -167,6 +168,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
167
168
  marginBottom: dotSpacing,
168
169
  zIndex: 98
169
170
  }
171
+ const displayMultipleItems = props['display-multiple-items'] || 1
170
172
  const easeingFunc = props['easing-function'] || 'default'
171
173
  const easeDuration = props.duration || 500
172
174
  const horizontal = props.vertical !== undefined ? !props.vertical : true
@@ -200,18 +202,19 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
200
202
  const preMarginShared = useSharedValue(preMargin)
201
203
  const nextMarginShared = useSharedValue(nextMargin)
202
204
  const autoplayShared = useSharedValue(autoplay)
205
+ const children = Array.isArray(props.children) ? props.children.filter(child => child) : (props.children ? [props.children] : [])
203
206
  // 默认前后补位的元素个数
204
- const patchElmNum = circular ? (preMargin ? 2 : 1) : 0
207
+ const patchElmNum = (circular && children.length > 1) ? displayMultipleItems + 1 : 0
205
208
  const patchElmNumShared = useSharedValue(patchElmNum)
209
+ const displayMultipleItemsShared = useSharedValue(displayMultipleItems)
206
210
  const circularShared = useSharedValue(circular)
207
- const children = Array.isArray(props.children) ? props.children.filter(child => child) : (props.children ? [props.children] : [])
208
211
  // 对有变化的变量,在worklet中只能使用sharedValue变量,useRef不能更新
209
212
  const childrenLength = useSharedValue(children.length)
210
213
  const initWidth = typeof normalStyle?.width === 'number' ? normalStyle.width - preMargin - nextMargin : normalStyle.width
211
214
  const initHeight = typeof normalStyle?.height === 'number' ? normalStyle.height - preMargin - nextMargin : normalStyle.height
212
215
  const dir = horizontal === false ? 'y' : 'x'
213
216
  const pstep = dir === 'x' ? initWidth : initHeight
214
- const initStep: number = isNaN(pstep) ? 0 : pstep
217
+ const initStep: number = isNaN(pstep) ? 0 : pstep / displayMultipleItems
215
218
  // 每个元素的宽度 or 高度,有固定值直接初始化无则0
216
219
  const step = useSharedValue(initStep)
217
220
  // 记录选中元素的索引值
@@ -285,7 +288,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
285
288
  const { width, height } = e.nativeEvent.layout
286
289
  const realWidth = dir === 'x' ? width - preMargin - nextMargin : width
287
290
  const realHeight = dir === 'y' ? height - preMargin - nextMargin : height
288
- const iStep = dir === 'x' ? realWidth : realHeight
291
+ const iStep = (dir === 'x' ? realWidth : realHeight) / displayMultipleItems
289
292
  if (iStep !== step.value) {
290
293
  step.value = iStep
291
294
  updateCurrent(propCurrent, iStep)
@@ -344,18 +347,35 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
344
347
  function renderItems () {
345
348
  const intLen = children.length
346
349
  let renderChild = children.slice()
350
+ // if (circular && intLen > 1) {
351
+ // // 最前面加最后一个元素
352
+ // const lastChild = React.cloneElement(children[intLen - 1] as ReactElement, { key: 'clone0' })
353
+ // // 最后面加第一个元素
354
+ // const firstChild = React.cloneElement(children[0] as ReactElement, { key: 'clone1' })
355
+ // if (preMargin) {
356
+ // const lastChild1 = React.cloneElement(children[intLen - 2] as ReactElement, { key: 'clone2' })
357
+ // const firstChild1 = React.cloneElement(children[1] as ReactElement, { key: 'clone3' })
358
+ // renderChild = [lastChild1, lastChild].concat(renderChild).concat([firstChild, firstChild1])
359
+ // } else {
360
+ // renderChild = [lastChild].concat(renderChild).concat([firstChild])
361
+ // }
362
+ // }
347
363
  if (circular && intLen > 1) {
348
- // 最前面加最后一个元素
349
- const lastChild = React.cloneElement(children[intLen - 1] as ReactElement, { key: 'clone0' })
350
- // 最后面加第一个元素
351
- const firstChild = React.cloneElement(children[0] as ReactElement, { key: 'clone1' })
352
- if (preMargin) {
353
- const lastChild1 = React.cloneElement(children[intLen - 2] as ReactElement, { key: 'clone2' })
354
- const firstChild1 = React.cloneElement(children[1] as ReactElement, { key: 'clone3' })
355
- renderChild = [lastChild1, lastChild].concat(renderChild).concat([firstChild, firstChild1])
356
- } else {
357
- renderChild = [lastChild].concat(renderChild).concat([firstChild])
364
+ // 动态生成前置补位元素
365
+ const frontClones = []
366
+ // 计算补位序列的起始索引。例如 len=3, patch=2 -> start=1 (即从B开始)
367
+ const startIndex = intLen - (patchElmNum % intLen)
368
+ for (let i = 0; i < patchElmNum; i++) {
369
+ const sourceIndex = (startIndex + i) % intLen
370
+ frontClones.push(React.cloneElement(children[sourceIndex], { key: `clone_front_${i}` }))
358
371
  }
372
+ // 动态生成后置补位元素
373
+ const backClones = []
374
+ for (let i = 0; i < patchElmNum; i++) {
375
+ const sourceIndex = i % intLen
376
+ backClones.push(React.cloneElement(children[sourceIndex], { key: `clone_back_${i}` }))
377
+ }
378
+ renderChild = [...frontClones, ...renderChild, ...backClones]
359
379
  }
360
380
  const arrChildren = renderChild.map((child, index) => {
361
381
  const extraStyle = {} as { [key: string]: any }
@@ -390,7 +410,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
390
410
  let nextIndex = currentIndex.value
391
411
  if (!circularShared.value) {
392
412
  // 获取下一个位置的坐标, 循环到最后一个元素,直接停止, 取消定时器
393
- if (currentIndex.value === childrenLength.value - 1) {
413
+ if (currentIndex.value === childrenLength.value - displayMultipleItemsShared.value) {
394
414
  pauseLoop()
395
415
  return
396
416
  }
@@ -560,14 +580,14 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
560
580
  }
561
581
  }
562
582
  }, [autoplay])
563
-
564
583
  useEffect(() => {
565
- if (circular !== circularShared.value) {
584
+ if (circular !== circularShared.value || patchElmNum !== patchElmNumShared.value || displayMultipleItems !== displayMultipleItemsShared.value) {
566
585
  circularShared.value = circular
567
- patchElmNumShared.value = circular ? (preMargin ? 2 : 1) : 0
586
+ patchElmNumShared.value = patchElmNum
587
+ displayMultipleItemsShared.value = displayMultipleItems
568
588
  offset.value = getOffset(currentIndex.value, step.value)
569
589
  }
570
- }, [circular, preMargin])
590
+ }, [circular, patchElmNum, displayMultipleItems])
571
591
  const { gestureHandler } = useMemo(() => {
572
592
  function getTargetPosition (eventData: EventDataType) {
573
593
  'worklet'
@@ -585,7 +605,8 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
585
605
  const moveToIndex = transdir < 0 ? Math.ceil(computedIndex) : Math.floor(computedIndex)
586
606
  // 实际应该定位的索引值
587
607
  if (!circularShared.value) {
588
- selectedIndex = moveToIndex
608
+ const maxIndex = Math.max(0, childrenLength.value - displayMultipleItemsShared.value)
609
+ selectedIndex = Math.min(Math.max(moveToIndex, 0), maxIndex)
589
610
  moveToTargetPos = selectedIndex * step.value
590
611
  } else {
591
612
  if (moveToIndex >= childrenLength.value + patchElmNumShared.value) {
@@ -618,7 +639,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
618
639
  const gestureMovePos = offset.value + translation
619
640
  if (!circularShared.value) {
620
641
  // 如果只判断区间,中间非滑动状态(handleResistanceMove)向左滑动,突然改为向右滑动,但是还在非滑动态,本应该可滑动判断为了不可滑动
621
- const posEnd = -step.value * (childrenLength.value - 1)
642
+ const posEnd = -step.value * (childrenLength.value - displayMultipleItemsShared.value)
622
643
  if (transdir < 0) {
623
644
  return gestureMovePos > posEnd
624
645
  } else {
@@ -742,7 +763,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
742
763
  const { translation, transdir } = eventData
743
764
  const moveToOffset = offset.value + translation
744
765
  const maxOverDrag = Math.floor(step.value / 2)
745
- const maxOffset = translation < 0 ? -(childrenLength.value - 1) * step.value : 0
766
+ const maxOffset = translation < 0 ? -(childrenLength.value - displayMultipleItemsShared.value) * step.value : 0
746
767
  let resistance = 0.1
747
768
  let overDrag = 0
748
769
  let finalOffset = 0
@@ -369,6 +369,17 @@ function normalizeBackgroundPosition (parts: PositionVal[]): backgroundPositionL
369
369
  let vStart: 'top' | 'bottom' = 'top'
370
370
  let vOffset: PositionVal = 0
371
371
 
372
+ if (!Array.isArray(parts)) {
373
+ // 模板 style 属性传入单个数值时不会和 class 一样转成数组,需要手动转换
374
+ parts = [parts]
375
+ }
376
+ // 模板 style 属性传入时, 需要额外转换处理单位 px/rpx/vh 以及 center 转化为 50%
377
+ parts = (parts as (PositionVal | string)[]).map((part) => {
378
+ if (typeof part !== 'string') return part
379
+ if (part === 'center') return '50%'
380
+ return global.__formatValue(part) as PositionVal
381
+ })
382
+
372
383
  if (parts.length === 4) return parts as backgroundPositionList
373
384
 
374
385
  // 归一化
@@ -514,19 +525,24 @@ function parseBgImage (text: string): {
514
525
  }
515
526
  }
516
527
 
517
- function normalizeBackgroundSize (backgroundSize: Exclude<ExtendedViewStyle['backgroundSize'], undefined>, type: 'image' | 'linear' | undefined) {
528
+ function normalizeBackgroundSize (
529
+ backgroundSize: NonNullable<ExtendedViewStyle['backgroundSize']>,
530
+ type: 'image' | 'linear' | undefined
531
+ ): DimensionValue[] {
518
532
  const sizeList = backgroundSize.slice()
519
533
  if (sizeList.length === 1) sizeList.push('auto')
520
534
 
521
- if (type === 'linear') {
535
+ return sizeList.map((val) => {
536
+ if (typeof val !== 'string') return val
537
+
522
538
  // 处理当使用渐变的时候,background-size出现cover, contain, auto,当作100%处理
523
- for (const i in sizeList) {
524
- const val = sizeList[i]
525
- sizeList[i] = /^cover|contain|auto$/.test(val as string) ? '100%' : val
539
+ if (type === 'linear' && /^cover|contain|auto$/.test(val)) {
540
+ val = '100%'
526
541
  }
527
- }
528
542
 
529
- return sizeList
543
+ // 模板 style 属性传入时, 需要额外转换处理单位 px/rpx/vh
544
+ return global.__formatValue(val) as DimensionValue
545
+ })
530
546
  }
531
547
 
532
548
  function preParseImage (imageStyle?: ExtendedViewStyle) {