@mpxjs/webpack-plugin 2.10.14-beta.6 → 2.10.14-beta.7
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/platform/template/wx/component-config/button.js +12 -3
- package/lib/runtime/components/react/dist/context.d.ts +3 -5
- package/lib/runtime/components/react/dist/context.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/context.js +1 -1
- package/lib/runtime/components/react/dist/event.config.d.ts +1 -0
- package/lib/runtime/components/react/dist/event.config.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/getInnerListeners.d.ts +1 -0
- package/lib/runtime/components/react/dist/getInnerListeners.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/getInnerListeners.js +35 -21
- package/lib/runtime/components/react/dist/mpx-async-suspense.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-async-suspense.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-async-suspense.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-button.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-button.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-camera.d.ts +27 -0
- package/lib/runtime/components/react/dist/mpx-camera.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-camera.jsx +197 -0
- package/lib/runtime/components/react/dist/mpx-canvas/Bus.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-canvas/Bus.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-canvas/Image.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-canvas/Image.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-canvas/ImageData.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-canvas/ImageData.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-canvas/html.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-canvas/html.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-canvas/index.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-canvas/index.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-canvas/utils.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-canvas/utils.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-checkbox-group.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-checkbox-group.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-checkbox.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-checkbox.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-form.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-form.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-icon/index.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-icon/index.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-image.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-image.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-image.jsx +81 -37
- package/lib/runtime/components/react/dist/mpx-inline-text.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-inline-text.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-input.d.ts +2 -0
- package/lib/runtime/components/react/dist/mpx-input.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-input.jsx +19 -12
- package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.jsx +12 -21
- package/lib/runtime/components/react/dist/mpx-label.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-label.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-movable-area.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-movable-area.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-movable-view.d.ts +5 -2
- package/lib/runtime/components/react/dist/mpx-movable-view.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-movable-view.jsx +102 -34
- package/lib/runtime/components/react/dist/{nav.d.ts → mpx-nav.d.ts} +1 -0
- package/lib/runtime/components/react/dist/mpx-nav.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/{nav.jsx → mpx-nav.jsx} +1 -6
- package/lib/runtime/components/react/dist/mpx-navigator.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-navigator.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-picker/date.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-picker/date.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-picker/dateData.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-picker/dateData.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-picker/index.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-picker/index.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-picker/multiSelector.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-picker/multiSelector.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-picker/region.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-picker/region.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-picker/regionData.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-picker/regionData.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-picker/selector.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-picker/selector.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-picker/time.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-picker/time.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-picker/type.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-picker/type.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-picker-view/index.d.ts +2 -0
- package/lib/runtime/components/react/dist/mpx-picker-view/index.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-picker-view/index.jsx +4 -3
- package/lib/runtime/components/react/dist/mpx-picker-view/pickerVIewContext.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-picker-view/pickerVIewContext.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/index.d.ts +2 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/index.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/index.jsx +15 -21
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.jsx +8 -11
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.d.ts +14 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.jsx +20 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewFaces.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewFaces.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewIndicator.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewIndicator.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewMask.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewMask.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-popup/index.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-popup/index.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-popup/popupBase.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-popup/popupBase.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-portal/index.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-portal/index.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-portal/index.jsx +5 -1
- package/lib/runtime/components/react/dist/mpx-portal/portal-host.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-portal/portal-host.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-portal/portal-manager.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-portal/portal-manager.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-portal/portal-manager.jsx +3 -5
- package/lib/runtime/components/react/dist/mpx-progress.d.ts +24 -0
- package/lib/runtime/components/react/dist/mpx-progress.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-progress.jsx +163 -0
- package/lib/runtime/components/react/dist/mpx-radio-group.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-radio-group.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-radio.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-radio.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-rich-text/html.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-rich-text/html.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-rich-text/index.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-rich-text/index.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-root-portal.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-root-portal.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-scroll-view.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-scroll-view.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +69 -51
- package/lib/runtime/components/react/dist/mpx-simple-text.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-simple-text.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-simple-view.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-simple-view.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-slider.d.ts +31 -0
- package/lib/runtime/components/react/dist/mpx-slider.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-slider.jsx +321 -0
- package/lib/runtime/components/react/dist/mpx-sticky-header.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-sticky-header.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-sticky-section.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-sticky-section.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-swiper-item.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-swiper-item.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-swiper.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-swiper.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-swiper.jsx +9 -16
- package/lib/runtime/components/react/dist/mpx-switch.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-switch.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-text.d.ts +3 -1
- package/lib/runtime/components/react/dist/mpx-text.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-text.jsx +33 -5
- package/lib/runtime/components/react/dist/mpx-textarea.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-textarea.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-video.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-video.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-view.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-view.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-view.jsx +1 -1
- package/lib/runtime/components/react/dist/mpx-web-view.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-web-view.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-web-view.jsx +21 -2
- package/lib/runtime/components/react/dist/parser.d.ts +1 -0
- package/lib/runtime/components/react/dist/parser.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/useAnimationHooks.d.ts +1 -0
- package/lib/runtime/components/react/dist/useAnimationHooks.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/useNodesRef.d.ts +1 -0
- package/lib/runtime/components/react/dist/useNodesRef.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/utils.d.ts +1 -0
- package/lib/runtime/components/react/dist/utils.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/utils.jsx +16 -6
- package/package.json +1 -1
- package/lib/runtime/components/react/dist/mpx-nav-container.d.ts +0 -9
- package/lib/runtime/components/react/dist/mpx-nav-container.jsx +0 -23
- package/lib/runtime/components/react/dist/useNavShared.d.ts +0 -2
- package/lib/runtime/components/react/dist/useNavShared.js +0 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pickerViewIndicator.d.ts","sourceRoot":"","sources":["../../mpx-picker-view-column/pickerViewIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,SAAS,EAAoB,SAAS,EAAE,MAAM,cAAc,CAAA;AAErE,KAAK,cAAc,GAAG;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,kBAAkB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IACzC,uBAAuB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAC/C,CAAA;AAED,QAAA,MAAM,oBAAoB;kEAAiE,cAAc;;CAMxG,CAAA;AAkBD,eAAe,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pickerViewMask.d.ts","sourceRoot":"","sources":["../../mpx-picker-view-column/pickerViewMask.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,SAAS,EAAoB,SAAS,EAAE,MAAM,cAAc,CAAA;AAGrE,KAAK,SAAS,GAAG;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,kBAAkB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAC1C,CAAA;AAED,QAAA,MAAM,eAAe;yCAGlB,SAAS;;CAQX,CAAA;AASD,eAAe,eAAe,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../mpx-popup/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAE,MAAM,OAAO,CAAA;AAElD,OAAkB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEvD,0BAAkB,SAAS;IACzB,MAAM,WAAW;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,CAAA;IAC3C,IAAI,CAAC,EAAE,SAAS,CAAA;CACjB;AAaD;;GAEG;AACH,QAAA,MAAM,kBAAkB,aAAa,gBAAgB;2BAiBjC,MAAM,SAAS,UACvB,MAAM,GAAG,SAAS,YAChB;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE;;;2BAaR,YAAY,GAAG,IAAI;;CAwBlD,CAAA;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popupBase.d.ts","sourceRoot":"","sources":["../../mpx-popup/popupBase.tsx"],"names":[],"mappings":";AAUA,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,IAAI,CAAC,EAAE,MAAM,IAAI,CAAA;IACjB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAmCD;;;GAGG;AACH,QAAA,MAAM,SAAS;aAAW,cAAc;;CAwEvC,CAAA;AAGD,eAAe,SAAS,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../mpx-portal/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAiC,MAAM,OAAO,CAAA;AAIhE,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CAAA;AAED,QAAA,MAAM,MAAM;mBAAkB,WAAW,GAAG,IAAI;;;;;;;;CA6B/C,CAAA;AAOD,eAAe,MAAM,CAAA"}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { useContext, useEffect, useRef } from 'react';
|
|
2
|
-
import { PortalContext, RouteContext, VarContext } from '../context';
|
|
2
|
+
import { PortalContext, ProviderContext, RouteContext, VarContext } from '../context';
|
|
3
3
|
import PortalHost, { portal } from './portal-host';
|
|
4
4
|
const Portal = ({ children }) => {
|
|
5
5
|
const manager = useContext(PortalContext);
|
|
6
6
|
const keyRef = useRef(null);
|
|
7
7
|
const { pageId } = useContext(RouteContext) || {};
|
|
8
8
|
const varContext = useContext(VarContext);
|
|
9
|
+
const parentProvides = useContext(ProviderContext);
|
|
9
10
|
if (varContext) {
|
|
10
11
|
children = (<VarContext.Provider value={varContext} key='varContextWrap'>{children}</VarContext.Provider>);
|
|
11
12
|
}
|
|
13
|
+
if (parentProvides) {
|
|
14
|
+
children = (<ProviderContext.Provider value={parentProvides} key='providerContextWrap'>{children}</ProviderContext.Provider>);
|
|
15
|
+
}
|
|
12
16
|
useEffect(() => {
|
|
13
17
|
manager.update(keyRef.current, children);
|
|
14
18
|
}, [children]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portal-host.d.ts","sourceRoot":"","sources":["../../mpx-portal/portal-host.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,SAAS,EAAuB,MAAM,OAAO,CAAA;AAUzE,KAAK,eAAe,GAAG;IACrB,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAQD,MAAM,MAAM,SAAS,GACjB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,GACnD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,GACpD;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AAepC,cAAM,WAAW;IACf,OAAO,CAAC,OAAO,CAAQ;IACvB,GAAG,MAAO,SAAS,MAAM,MAAM,GAAC,IAAI,YAInC;IAED,MAAM,QAAS,MAAM,UAEpB;IAED,MAAM,QAAS,MAAM,KAAK,SAAS,UAElC;CACF;AACD;;GAEG;AACH,eAAO,MAAM,MAAM,aAAoB,CAAA;AAEvC,QAAA,MAAM,UAAU,iBAAkB,eAAe,KAAG,WA8EnD,CAAA;AAED,eAAe,UAAU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portal-manager.d.ts","sourceRoot":"","sources":["../../mpx-portal/portal-manager.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwE,SAAS,EAA0B,MAAM,OAAO,CAAA;AAE/H,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,EAAE,KAAK,CAAC;QACb,GAAG,EAAE,MAAM,CAAA;QACX,QAAQ,EAAE,SAAS,CAAA;KACpB,CAAC,CAAA;CACH,CAAA;AAKD,QAAA,MAAM,cAAc,mFA4ClB,CAAA;AAEF,eAAe,cAAc,CAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { useState, useCallback, forwardRef, useImperativeHandle } from 'react';
|
|
2
|
-
import { View, StyleSheet } from 'react-native';
|
|
1
|
+
import { useState, useCallback, forwardRef, useImperativeHandle, Fragment } from 'react';
|
|
3
2
|
const _PortalManager = forwardRef((props, ref) => {
|
|
4
3
|
const [state, setState] = useState({
|
|
5
4
|
portals: []
|
|
@@ -31,10 +30,9 @@ const _PortalManager = forwardRef((props, ref) => {
|
|
|
31
30
|
portals: state.portals
|
|
32
31
|
}));
|
|
33
32
|
return (<>
|
|
34
|
-
{state.portals.map(({ key, children }
|
|
35
|
-
style={[StyleSheet.absoluteFill, { zIndex: 1000 + i, pointerEvents: 'box-none' }]}>
|
|
33
|
+
{state.portals.map(({ key, children }) => (<Fragment key={key}>
|
|
36
34
|
{children}
|
|
37
|
-
</
|
|
35
|
+
</Fragment>))}
|
|
38
36
|
</>);
|
|
39
37
|
});
|
|
40
38
|
export default _PortalManager;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { View, ViewStyle } from 'react-native';
|
|
3
|
+
import { HandlerRef } from './useNodesRef';
|
|
4
|
+
export interface ProgressProps {
|
|
5
|
+
percent?: number;
|
|
6
|
+
'stroke-width'?: number | string;
|
|
7
|
+
color?: string;
|
|
8
|
+
activeColor?: string;
|
|
9
|
+
backgroundColor?: string;
|
|
10
|
+
active?: boolean;
|
|
11
|
+
'active-mode'?: 'backwards' | 'forwards';
|
|
12
|
+
duration?: number;
|
|
13
|
+
bindactiveend?: (event: any) => void;
|
|
14
|
+
style?: ViewStyle & Record<string, any>;
|
|
15
|
+
'enable-offset'?: boolean;
|
|
16
|
+
'enable-var'?: boolean;
|
|
17
|
+
'external-var-context'?: Record<string, any>;
|
|
18
|
+
'parent-font-size'?: number;
|
|
19
|
+
'parent-width'?: number;
|
|
20
|
+
'parent-height'?: number;
|
|
21
|
+
}
|
|
22
|
+
declare const Progress: import("react").ForwardRefExoticComponent<ProgressProps & import("react").RefAttributes<HandlerRef<View, ProgressProps>>>;
|
|
23
|
+
export default Progress;
|
|
24
|
+
//# sourceMappingURL=mpx-progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mpx-progress.d.ts","sourceRoot":"","sources":["../mpx-progress.tsx"],"names":[],"mappings":";AAuBA,OAAO,EACL,IAAI,EACJ,SAAS,EACV,MAAM,cAAc,CAAA;AAUrB,OAAoB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAIvD,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,aAAa,CAAC,EAAE,WAAW,GAAG,UAAU,CAAA;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAA;IACpC,KAAK,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACvC,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5C,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,QAAA,MAAM,QAAQ,2HAoMZ,CAAA;AAGF,eAAe,QAAQ,CAAA"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ✔ percent 进度百分比 0-100
|
|
3
|
+
* ✘ show-info 在进度条右侧显示百分比
|
|
4
|
+
* ✘ border-radius 圆角大小
|
|
5
|
+
* ✘ font-size 右侧百分比字体大小
|
|
6
|
+
* ✔ stroke-width 进度条线的宽度
|
|
7
|
+
* ✔ color 进度条颜色(请使用activeColor)
|
|
8
|
+
* ✔ activeColor 已选择的进度条的颜色
|
|
9
|
+
* ✔ backgroundColor 未选择的进度条的颜色
|
|
10
|
+
* ✔ active 进度条从左往右的动画
|
|
11
|
+
* ✔ active-mode backwards: 动画从头播;forwards:动画从上次结束点接着播
|
|
12
|
+
* ✔ duration 进度增加1%所需毫秒数
|
|
13
|
+
* ✔ bindactiveend 动画完成事件
|
|
14
|
+
*/
|
|
15
|
+
import { useRef, forwardRef, useEffect, useState, createElement } from 'react';
|
|
16
|
+
import { View } from 'react-native';
|
|
17
|
+
import Animated, { useSharedValue, useAnimatedStyle, withTiming, Easing, runOnJS } from 'react-native-reanimated';
|
|
18
|
+
import useInnerProps from './getInnerListeners';
|
|
19
|
+
import useNodesRef from './useNodesRef';
|
|
20
|
+
import { useLayout, useTransformStyle, extendObject, useRunOnJSCallback } from './utils';
|
|
21
|
+
import Portal from './mpx-portal';
|
|
22
|
+
const Progress = forwardRef((props, ref) => {
|
|
23
|
+
const { percent = 0, 'stroke-width': strokeWidth = 6, color, activeColor = color || '#09BB07', backgroundColor = '#EBEBEB', active = false, 'active-mode': activeMode = 'backwards', duration = 30, style = {}, 'enable-var': enableVar, 'external-var-context': externalVarContext, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight } = props;
|
|
24
|
+
const nodeRef = useRef(null);
|
|
25
|
+
const propsRef = useRef(props);
|
|
26
|
+
propsRef.current = props;
|
|
27
|
+
// 进度值状态
|
|
28
|
+
const [lastPercent, setLastPercent] = useState(0);
|
|
29
|
+
const progressWidth = useSharedValue(0);
|
|
30
|
+
const { normalStyle, hasSelfPercent, setWidth, setHeight, hasPositionFixed } = useTransformStyle(style, {
|
|
31
|
+
enableVar,
|
|
32
|
+
externalVarContext,
|
|
33
|
+
parentFontSize,
|
|
34
|
+
parentWidth,
|
|
35
|
+
parentHeight
|
|
36
|
+
});
|
|
37
|
+
const { layoutRef, layoutStyle, layoutProps } = useLayout({
|
|
38
|
+
props,
|
|
39
|
+
hasSelfPercent,
|
|
40
|
+
setWidth,
|
|
41
|
+
setHeight,
|
|
42
|
+
nodeRef
|
|
43
|
+
});
|
|
44
|
+
useNodesRef(props, ref, nodeRef, {
|
|
45
|
+
style: normalStyle
|
|
46
|
+
});
|
|
47
|
+
// 使用 useRunOnJSCallback 处理动画回调
|
|
48
|
+
const runOnJSCallbackRef = useRef({
|
|
49
|
+
triggerActiveEnd: (percent) => {
|
|
50
|
+
const currentProps = propsRef.current;
|
|
51
|
+
if (currentProps.bindactiveend) {
|
|
52
|
+
currentProps.bindactiveend({
|
|
53
|
+
type: 'activeend',
|
|
54
|
+
detail: {
|
|
55
|
+
percent: percent
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const runOnJSCallback = useRunOnJSCallback(runOnJSCallbackRef);
|
|
62
|
+
// 进度条动画函数
|
|
63
|
+
const startProgressAnimation = (targetPercent, startPercent, animationDuration, onFinished) => {
|
|
64
|
+
// 根据 active-mode 设置起始位置
|
|
65
|
+
progressWidth.value = startPercent;
|
|
66
|
+
progressWidth.value = withTiming(targetPercent, {
|
|
67
|
+
duration: animationDuration,
|
|
68
|
+
easing: Easing.linear
|
|
69
|
+
}, (finished) => {
|
|
70
|
+
if (finished && onFinished) {
|
|
71
|
+
// 在动画回调中,执行传入的worklet函数
|
|
72
|
+
onFinished();
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
// 进度变化时的动画效果
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
const targetPercent = Math.max(0, Math.min(100, percent));
|
|
79
|
+
if (active) {
|
|
80
|
+
// 根据 active-mode 确定起始位置
|
|
81
|
+
let startPercent;
|
|
82
|
+
if (activeMode === 'backwards') {
|
|
83
|
+
startPercent = 0;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
// forwards 模式:使用上次记录的百分比作为起始位置
|
|
87
|
+
startPercent = lastPercent;
|
|
88
|
+
}
|
|
89
|
+
// 计算动画持续时间
|
|
90
|
+
const percentDiff = Math.abs(targetPercent - startPercent);
|
|
91
|
+
const animationDuration = percentDiff * duration;
|
|
92
|
+
// 执行动画
|
|
93
|
+
startProgressAnimation(targetPercent, startPercent, animationDuration, () => {
|
|
94
|
+
'worklet';
|
|
95
|
+
// 在worklet函数内部执行runOnJS调用runOnJSCallback
|
|
96
|
+
runOnJS(runOnJSCallback)('triggerActiveEnd', targetPercent);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
progressWidth.value = targetPercent;
|
|
101
|
+
}
|
|
102
|
+
setLastPercent(targetPercent);
|
|
103
|
+
}, [percent, active, activeMode, duration]);
|
|
104
|
+
// 初始化时设置进度值
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
if (!active) {
|
|
107
|
+
progressWidth.value = Math.max(0, Math.min(100, percent));
|
|
108
|
+
}
|
|
109
|
+
}, []);
|
|
110
|
+
// 进度条动画样式
|
|
111
|
+
const animatedProgressStyle = useAnimatedStyle(() => {
|
|
112
|
+
return {
|
|
113
|
+
width: `${progressWidth.value}%`
|
|
114
|
+
};
|
|
115
|
+
});
|
|
116
|
+
// 确保数值类型正确
|
|
117
|
+
const strokeWidthNum = typeof strokeWidth === 'number' ? strokeWidth : parseInt(strokeWidth, 10) || 6;
|
|
118
|
+
// 容器样式
|
|
119
|
+
const containerStyle = extendObject({}, {
|
|
120
|
+
flexDirection: 'row',
|
|
121
|
+
alignItems: 'center',
|
|
122
|
+
width: '100%',
|
|
123
|
+
minHeight: Math.max(strokeWidthNum, 20)
|
|
124
|
+
}, normalStyle, layoutStyle);
|
|
125
|
+
// 进度条背景样式
|
|
126
|
+
const progressBgStyle = {
|
|
127
|
+
width: '100%',
|
|
128
|
+
height: strokeWidthNum,
|
|
129
|
+
backgroundColor,
|
|
130
|
+
overflow: 'hidden'
|
|
131
|
+
};
|
|
132
|
+
// 进度条填充样式
|
|
133
|
+
const progressFillStyle = {
|
|
134
|
+
height: '100%',
|
|
135
|
+
backgroundColor: activeColor
|
|
136
|
+
};
|
|
137
|
+
const innerProps = useInnerProps(extendObject({}, props, layoutProps, {
|
|
138
|
+
ref: nodeRef
|
|
139
|
+
}), [
|
|
140
|
+
'percent',
|
|
141
|
+
'stroke-width',
|
|
142
|
+
'color',
|
|
143
|
+
'activeColor',
|
|
144
|
+
'backgroundColor',
|
|
145
|
+
'active',
|
|
146
|
+
'active-mode',
|
|
147
|
+
'duration',
|
|
148
|
+
'bindactiveend'
|
|
149
|
+
], { layoutRef });
|
|
150
|
+
const progressComponent = createElement(View, extendObject({}, innerProps, { style: containerStyle }),
|
|
151
|
+
// 进度条背景
|
|
152
|
+
createElement(View, { style: progressBgStyle },
|
|
153
|
+
// 进度条填充
|
|
154
|
+
createElement(Animated.View, {
|
|
155
|
+
style: [progressFillStyle, animatedProgressStyle]
|
|
156
|
+
})));
|
|
157
|
+
if (hasPositionFixed) {
|
|
158
|
+
return createElement(Portal, null, progressComponent);
|
|
159
|
+
}
|
|
160
|
+
return progressComponent;
|
|
161
|
+
});
|
|
162
|
+
Progress.displayName = 'MpxProgress';
|
|
163
|
+
export default Progress;
|
|
@@ -18,3 +18,4 @@ 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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mpx-radio-group.d.ts","sourceRoot":"","sources":["../mpx-radio-group.tsx"],"names":[],"m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AAM,CAAA;IACd,KAAK,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACvC,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5C,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,EAAE,SAAS,CAAA;IACnB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,oBAAoB,CAAC,UAAU,CAAC,GAAG,OAAO,KAAK,IAAI,CAAA;CACpE;AAoCD,QAAA,MAAM,KAAK,qHA8JV,CAAA;AAID,eAAe,KAAK,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../mpx-rich-text/html.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,YAAY,SAAU,MAAM,WAsCxC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../mpx-rich-text/index.tsx"],"names":[],"mappings":";AACA;;GAEG;AACH,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAGzD,OAAoB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAMxD,KAAK,IAAI,GAAG;IACV,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,QAAQ,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;IACtB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,UAAU,cAAe,SAAQ,SAAS;IACxC,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAA;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5C,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAyBD,QAAA,MAAM,SAAS,6HA4Eb,CAAA;AAIF,eAAe,SAAS,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mpx-root-portal.d.ts","sourceRoot":"","sources":["../mpx-root-portal.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,SAAS,EAA2B,MAAM,OAAO,CAAA;AAG1D,UAAU,eAAe;IACvB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,SAAS,CAAA;IACnB,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CACjB;AAED,QAAA,MAAM,WAAW;YAAW,eAAe;;CAQ1C,CAAA;AAID,eAAe,WAAW,CAAA"}
|
|
@@ -52,3 +52,4 @@ 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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mpx-scroll-view.d.ts","sourceRoot":"","sources":["../mpx-scroll-view.tsx"],"names":[],"mappings":"AAkCA,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,iBAAiB,EAAqB,SAAS,EAA0B,MAAM,cAAc,CAAA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AC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,WAAW,EAAE,GAAG,CAAC,EAAE,OAAO,KAAK,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;CACxG;AAyBD,QAAA,MAAM,WAAW;;4MAutBf,CAAA;AAIF,eAAe,WAAW,CAAA"}
|
|
@@ -48,8 +48,6 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
48
48
|
const scrollOffset = useRef(new RNAnimated.Value(0)).current;
|
|
49
49
|
const simultaneousHandlers = flatGesture(originSimultaneousHandlers);
|
|
50
50
|
const waitForHandlers = flatGesture(waitFor);
|
|
51
|
-
const snapScrollTop = useRef(0);
|
|
52
|
-
const snapScrollLeft = useRef(0);
|
|
53
51
|
const [refreshing, setRefreshing] = useState(false);
|
|
54
52
|
const [enableScroll, setEnableScroll] = useState(true);
|
|
55
53
|
const enableScrollValue = useSharedValue(true);
|
|
@@ -74,6 +72,7 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
74
72
|
black: ['#000'],
|
|
75
73
|
white: ['#fff']
|
|
76
74
|
};
|
|
75
|
+
const isContentSizeChange = useRef(false);
|
|
77
76
|
const { refresherContent, otherContent } = getRefresherContent(props.children);
|
|
78
77
|
const hasRefresher = refresherContent && refresherEnabled;
|
|
79
78
|
const { normalStyle, hasVarDec, varContextRef, hasSelfPercent, hasPositionFixed, setWidth, setHeight } = useTransformStyle(style, { enableVar, externalVarContext, parentFontSize, parentWidth, parentHeight });
|
|
@@ -126,14 +125,12 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
126
125
|
warn('scroll-x and scroll-y cannot be set to true at the same time, Mpx will use the value of scroll-y as the criterion');
|
|
127
126
|
}
|
|
128
127
|
useEffect(() => {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
};
|
|
136
|
-
}
|
|
128
|
+
initialTimeout.current = setTimeout(() => {
|
|
129
|
+
scrollToOffset(scrollLeft, scrollTop);
|
|
130
|
+
}, 0);
|
|
131
|
+
return () => {
|
|
132
|
+
initialTimeout.current && clearTimeout(initialTimeout.current);
|
|
133
|
+
};
|
|
137
134
|
}, [scrollTop, scrollLeft]);
|
|
138
135
|
useEffect(() => {
|
|
139
136
|
if (scrollIntoView && __selectRef) {
|
|
@@ -223,7 +220,22 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
223
220
|
}
|
|
224
221
|
}
|
|
225
222
|
function onContentSizeChange(width, height) {
|
|
226
|
-
|
|
223
|
+
isContentSizeChange.current = true;
|
|
224
|
+
const newContentLength = selectLength({ height, width });
|
|
225
|
+
const oldContentLength = scrollOptions.current.contentLength;
|
|
226
|
+
scrollOptions.current.contentLength = newContentLength;
|
|
227
|
+
// 内容高度变化时,Animated.event 的映射可能会有不生效的场景,所以需要手动设置一下 scrollOffset 的值
|
|
228
|
+
if (enableSticky && (__mpx_mode__ === 'android' || __mpx_mode__ === 'ios')) {
|
|
229
|
+
// 当内容变少时,检查当前滚动位置是否超出新的内容范围
|
|
230
|
+
if (newContentLength < oldContentLength) {
|
|
231
|
+
const { visibleLength, offset } = scrollOptions.current;
|
|
232
|
+
const maxOffset = Math.max(0, newContentLength - visibleLength);
|
|
233
|
+
// 如果当前滚动位置超出了新的内容范围,调整滚动offset
|
|
234
|
+
if (offset > maxOffset && scrollY) {
|
|
235
|
+
scrollOffset.setValue(maxOffset);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
227
239
|
}
|
|
228
240
|
function onLayout(e) {
|
|
229
241
|
const layout = e.nativeEvent.layout || {};
|
|
@@ -243,8 +255,9 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
243
255
|
}
|
|
244
256
|
function onScroll(e) {
|
|
245
257
|
const { bindscroll } = props;
|
|
246
|
-
const {
|
|
247
|
-
const {
|
|
258
|
+
const { contentOffset, layoutMeasurement, contentSize } = e.nativeEvent;
|
|
259
|
+
const { x: scrollLeft, y: scrollTop } = contentOffset;
|
|
260
|
+
const { width: scrollWidth, height: scrollHeight } = contentSize;
|
|
248
261
|
isAtTop.value = scrollTop <= 0;
|
|
249
262
|
bindscroll &&
|
|
250
263
|
bindscroll(getCustomEvent('scroll', e, {
|
|
@@ -254,7 +267,8 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
254
267
|
scrollHeight,
|
|
255
268
|
scrollWidth,
|
|
256
269
|
deltaX: scrollLeft - scrollOptions.current.scrollLeft,
|
|
257
|
-
deltaY: scrollTop - scrollOptions.current.scrollTop
|
|
270
|
+
deltaY: scrollTop - scrollOptions.current.scrollTop,
|
|
271
|
+
layoutMeasurement
|
|
258
272
|
},
|
|
259
273
|
layoutRef
|
|
260
274
|
}, props));
|
|
@@ -267,8 +281,9 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
267
281
|
}
|
|
268
282
|
function onScrollEnd(e) {
|
|
269
283
|
const { bindscrollend } = props;
|
|
270
|
-
const {
|
|
271
|
-
const {
|
|
284
|
+
const { contentOffset, layoutMeasurement, contentSize } = e.nativeEvent;
|
|
285
|
+
const { x: scrollLeft, y: scrollTop } = contentOffset;
|
|
286
|
+
const { width: scrollWidth, height: scrollHeight } = contentSize;
|
|
272
287
|
isAtTop.value = scrollTop <= 0;
|
|
273
288
|
bindscrollend &&
|
|
274
289
|
bindscrollend(getCustomEvent('scrollend', e, {
|
|
@@ -276,7 +291,8 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
276
291
|
scrollLeft,
|
|
277
292
|
scrollTop,
|
|
278
293
|
scrollHeight,
|
|
279
|
-
scrollWidth
|
|
294
|
+
scrollWidth,
|
|
295
|
+
layoutMeasurement
|
|
280
296
|
},
|
|
281
297
|
layoutRef
|
|
282
298
|
}, props));
|
|
@@ -296,24 +312,6 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
296
312
|
function scrollToOffset(x = 0, y = 0, animated = scrollWithAnimation) {
|
|
297
313
|
if (scrollViewRef.current) {
|
|
298
314
|
scrollViewRef.current.scrollTo({ x, y, animated });
|
|
299
|
-
scrollOptions.current.scrollLeft = x;
|
|
300
|
-
scrollOptions.current.scrollTop = y;
|
|
301
|
-
snapScrollLeft.current = x;
|
|
302
|
-
snapScrollTop.current = y;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
function onScrollTouchStart(e) {
|
|
306
|
-
const { bindtouchstart } = props;
|
|
307
|
-
bindtouchstart && bindtouchstart(e);
|
|
308
|
-
if (enhanced) {
|
|
309
|
-
binddragstart &&
|
|
310
|
-
binddragstart(getCustomEvent('dragstart', e, {
|
|
311
|
-
detail: {
|
|
312
|
-
scrollLeft: scrollOptions.current.scrollLeft,
|
|
313
|
-
scrollTop: scrollOptions.current.scrollTop
|
|
314
|
-
},
|
|
315
|
-
layoutRef
|
|
316
|
-
}, props));
|
|
317
315
|
}
|
|
318
316
|
}
|
|
319
317
|
function onScrollTouchMove(e) {
|
|
@@ -329,19 +327,6 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
329
327
|
}, props));
|
|
330
328
|
}
|
|
331
329
|
}
|
|
332
|
-
function onScrollTouchEnd(e) {
|
|
333
|
-
bindtouchend && bindtouchend(e);
|
|
334
|
-
if (enhanced) {
|
|
335
|
-
binddragend &&
|
|
336
|
-
binddragend(getCustomEvent('dragend', e, {
|
|
337
|
-
detail: {
|
|
338
|
-
scrollLeft: scrollOptions.current.scrollLeft || 0,
|
|
339
|
-
scrollTop: scrollOptions.current.scrollTop || 0
|
|
340
|
-
},
|
|
341
|
-
layoutRef
|
|
342
|
-
}, props));
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
330
|
function onScrollDrag(e) {
|
|
346
331
|
const { x: scrollLeft, y: scrollTop } = e.nativeEvent.contentOffset;
|
|
347
332
|
updateScrollOptions(e, { scrollLeft, scrollTop });
|
|
@@ -350,6 +335,16 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
350
335
|
const scrollHandler = RNAnimated.event([{ nativeEvent: { contentOffset: { y: scrollOffset } } }], {
|
|
351
336
|
useNativeDriver: true,
|
|
352
337
|
listener: (event) => {
|
|
338
|
+
const y = event.nativeEvent.contentOffset.y || 0;
|
|
339
|
+
// 内容高度变化时,鸿蒙中 listener 回调通过scrollOffset.__getValue获取值一直等于event.nativeEvent.contentOffset.y,值是正确的,但是无法触发 sticky 动画执行,所以需要手动再 set 一次
|
|
340
|
+
if (__mpx_mode__ === 'harmony') {
|
|
341
|
+
if (isContentSizeChange.current) {
|
|
342
|
+
scrollOffset.setValue(y);
|
|
343
|
+
setTimeout(() => {
|
|
344
|
+
isContentSizeChange.current = false;
|
|
345
|
+
}, 100);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
353
348
|
onScroll(event);
|
|
354
349
|
}
|
|
355
350
|
});
|
|
@@ -357,6 +352,30 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
357
352
|
hasCallScrollToLower.current = false;
|
|
358
353
|
hasCallScrollToUpper.current = false;
|
|
359
354
|
onScrollDrag(e);
|
|
355
|
+
if (enhanced) {
|
|
356
|
+
binddragstart &&
|
|
357
|
+
binddragstart(getCustomEvent('dragstart', e, {
|
|
358
|
+
detail: {
|
|
359
|
+
scrollLeft: scrollOptions.current.scrollLeft,
|
|
360
|
+
scrollTop: scrollOptions.current.scrollTop
|
|
361
|
+
},
|
|
362
|
+
layoutRef
|
|
363
|
+
}, props));
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
function onScrollDragEnd(e) {
|
|
367
|
+
onScrollDrag(e);
|
|
368
|
+
if (enhanced) {
|
|
369
|
+
// 安卓上如果触发了默认的下拉刷新,binddragend可能不触发,只会触发 binddragstart
|
|
370
|
+
binddragend &&
|
|
371
|
+
binddragend(getCustomEvent('dragend', e, {
|
|
372
|
+
detail: {
|
|
373
|
+
scrollLeft: scrollOptions.current.scrollLeft || 0,
|
|
374
|
+
scrollTop: scrollOptions.current.scrollTop || 0
|
|
375
|
+
},
|
|
376
|
+
layoutRef
|
|
377
|
+
}, props));
|
|
378
|
+
}
|
|
360
379
|
}
|
|
361
380
|
// 处理刷新
|
|
362
381
|
function onRefresh() {
|
|
@@ -513,14 +532,13 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
513
532
|
showsVerticalScrollIndicator: scrollY && showScrollbar,
|
|
514
533
|
scrollEnabled: !enableScroll ? false : !!(scrollX || scrollY),
|
|
515
534
|
bounces: false,
|
|
535
|
+
overScrollMode: 'never',
|
|
516
536
|
ref: scrollViewRef,
|
|
517
537
|
onScroll: enableSticky ? scrollHandler : onScroll,
|
|
518
538
|
onContentSizeChange: onContentSizeChange,
|
|
519
|
-
bindtouchstart: ((enhanced && binddragstart) || bindtouchstart) && onScrollTouchStart,
|
|
520
539
|
bindtouchmove: ((enhanced && binddragging) || bindtouchmove) && onScrollTouchMove,
|
|
521
|
-
bindtouchend: ((enhanced && binddragend) || bindtouchend) && onScrollTouchEnd,
|
|
522
540
|
onScrollBeginDrag: onScrollDragStart,
|
|
523
|
-
onScrollEndDrag:
|
|
541
|
+
onScrollEndDrag: onScrollDragEnd,
|
|
524
542
|
onMomentumScrollEnd: onScrollEnd
|
|
525
543
|
}, (simultaneousHandlers ? { simultaneousHandlers } : {}), (waitForHandlers ? { waitFor: waitForHandlers } : {}), layoutProps);
|
|
526
544
|
if (enhanced) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mpx-simple-text.d.ts","sourceRoot":"","sources":["../mpx-simple-text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,GAAG,EAAiB,MAAM,OAAO,CAAA;AAI1C,QAAA,MAAM,UAAU;YAAW,SAAS,GAAG,WAAW;;CAiBjD,CAAA;AAID,eAAe,UAAU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mpx-simple-view.d.ts","sourceRoot":"","sources":["../mpx-simple-view.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAQ,SAAS,EAAa,MAAM,cAAc,CAAA;AAKzD,QAAA,MAAM,UAAU;sBAAqB,SAAS,GAAG,WAAW;;CAuB3D,CAAA;AAID,eAAe,UAAU,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { View, ViewStyle } from 'react-native';
|
|
3
|
+
import { HandlerRef } from './useNodesRef';
|
|
4
|
+
export interface SliderProps {
|
|
5
|
+
min?: number;
|
|
6
|
+
max?: number;
|
|
7
|
+
step?: number;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
value?: number;
|
|
10
|
+
color?: string;
|
|
11
|
+
'selected-color'?: string;
|
|
12
|
+
activeColor?: string;
|
|
13
|
+
backgroundColor?: string;
|
|
14
|
+
'block-size'?: number;
|
|
15
|
+
'block-color'?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
bindchange?: (event: any) => void;
|
|
18
|
+
catchchange?: (event: any) => void;
|
|
19
|
+
bindchanging?: (event: any) => void;
|
|
20
|
+
catchchanging?: (event: any) => void;
|
|
21
|
+
style?: ViewStyle & Record<string, any>;
|
|
22
|
+
'enable-offset'?: boolean;
|
|
23
|
+
'enable-var'?: boolean;
|
|
24
|
+
'external-var-context'?: Record<string, any>;
|
|
25
|
+
'parent-font-size'?: number;
|
|
26
|
+
'parent-width'?: number;
|
|
27
|
+
'parent-height'?: number;
|
|
28
|
+
}
|
|
29
|
+
declare const Slider: import("react").ForwardRefExoticComponent<SliderProps & import("react").RefAttributes<HandlerRef<View, SliderProps>>>;
|
|
30
|
+
export default Slider;
|
|
31
|
+
//# sourceMappingURL=mpx-slider.d.ts.map
|