@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":"mpx-image.d.ts","sourceRoot":"","sources":["../mpx-image.tsx"],"names":[],"mappings":";AAaA,OAAO,EACL,KAAK,IAAI,OAAO,EAEhB,UAAU,EAEV,oBAAoB,EACpB,mBAAmB,EAGnB,kBAAkB,EACnB,MAAM,cAAc,CAAA;AAIrB,OAAoB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAIvD,MAAM,MAAM,IAAI,GACZ,aAAa,GACb,WAAW,GACX,YAAY,GACZ,UAAU,GACV,WAAW,GACX,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,OAAO,GACP,UAAU,GACV,WAAW,GACX,aAAa,GACb,cAAc,CAAA;AAElB,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,KAAK,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACxC,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,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,oBAAoB,CAAC,kBAAkB,CAAC,GAAG,OAAO,KAAK,IAAI,CAAA;IAC5E,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,oBAAoB,CAAC,mBAAmB,CAAC,GAAG,OAAO,KAAK,IAAI,CAAA;CAC/E;AAmED,QAAA,MAAM,KAAK,wHA8XT,CAAA;AAIF,eAAe,KAAK,CAAA"}
|
|
@@ -40,7 +40,16 @@ const ModeMap = new Map([
|
|
|
40
40
|
...cropMode.map(mode => [mode, 'stretch'])
|
|
41
41
|
]);
|
|
42
42
|
const isNumber = (value) => typeof value === 'number';
|
|
43
|
-
const relativeCenteredSize = (viewSize, imageSize) =>
|
|
43
|
+
const relativeCenteredSize = (viewSize, imageSize) => {
|
|
44
|
+
return (viewSize - imageSize) / 2;
|
|
45
|
+
};
|
|
46
|
+
// 获取能完全显示图片的缩放比例:长宽方向的缩放比例最小值即为能完全展示的比例
|
|
47
|
+
function getFitScale(width1, height1, width2, height2) {
|
|
48
|
+
return Math.min(width2 / width1, height2 / height1);
|
|
49
|
+
}
|
|
50
|
+
function getFillScale(width1, height1, width2, height2) {
|
|
51
|
+
return Math.max(width2 / width1, height2 / height1);
|
|
52
|
+
}
|
|
44
53
|
function noMeetCalcRule(isSvg, mode, viewWidth, viewHeight, ratio) {
|
|
45
54
|
const isMeetSize = viewWidth && viewHeight && ratio;
|
|
46
55
|
if (isSvg && !isMeetSize)
|
|
@@ -49,6 +58,16 @@ function noMeetCalcRule(isSvg, mode, viewWidth, viewHeight, ratio) {
|
|
|
49
58
|
return true;
|
|
50
59
|
return false;
|
|
51
60
|
}
|
|
61
|
+
const getFixedWidth = (viewWidth, viewHeight, ratio) => {
|
|
62
|
+
if (!ratio)
|
|
63
|
+
return viewWidth;
|
|
64
|
+
const fixed = viewHeight / ratio;
|
|
65
|
+
return !fixed ? viewWidth : fixed;
|
|
66
|
+
};
|
|
67
|
+
const getFixedHeight = (viewWidth, viewHeight, ratio) => {
|
|
68
|
+
const fixed = viewWidth * ratio;
|
|
69
|
+
return !fixed ? viewHeight : fixed;
|
|
70
|
+
};
|
|
52
71
|
const Image = forwardRef((props, ref) => {
|
|
53
72
|
const { src = '', mode = 'scaleToFill', style = {}, 'enable-var': enableVar, 'external-var-context': externalVarContext, 'parent-font-size': parentFontSize, 'enable-fast-image': enableFastImage, 'parent-width': parentWidth, 'parent-height': parentHeight, bindload, binderror } = props;
|
|
54
73
|
const defaultStyle = {
|
|
@@ -56,7 +75,6 @@ const Image = forwardRef((props, ref) => {
|
|
|
56
75
|
height: DEFAULT_IMAGE_HEIGHT
|
|
57
76
|
};
|
|
58
77
|
const styleObj = extendObject({}, defaultStyle, style, { overflow: 'hidden' });
|
|
59
|
-
const state = useRef({});
|
|
60
78
|
const nodeRef = useRef(null);
|
|
61
79
|
useNodesRef(props, ref, nodeRef, {
|
|
62
80
|
defaultStyle
|
|
@@ -70,13 +88,19 @@ const Image = forwardRef((props, ref) => {
|
|
|
70
88
|
const onLayout = ({ nativeEvent: { layout: { width, height } } }) => {
|
|
71
89
|
state.current.viewWidth = width;
|
|
72
90
|
state.current.viewHeight = height;
|
|
91
|
+
// 实际渲染尺寸可能会指定的值不一致,误差低于 0.5 则认为没有变化
|
|
92
|
+
if (Math.abs(viewHeight - height) < 0.5 && Math.abs(viewWidth - width) < 0.5) {
|
|
93
|
+
if (state.current.imageWidth && state.current.imageHeight && state.current.ratio) {
|
|
94
|
+
if (!loaded)
|
|
95
|
+
setLoaded(true);
|
|
96
|
+
}
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
73
99
|
if (state.current.imageWidth && state.current.imageHeight && state.current.ratio) {
|
|
74
|
-
setViewWidth(width);
|
|
75
|
-
setViewHeight(height);
|
|
76
100
|
setRatio(state.current.ratio);
|
|
77
101
|
setImageWidth(state.current.imageWidth);
|
|
78
102
|
setImageHeight(state.current.imageHeight);
|
|
79
|
-
state.current
|
|
103
|
+
setViewSize(state.current.viewWidth, state.current.viewHeight, state.current.ratio);
|
|
80
104
|
setLoaded(true);
|
|
81
105
|
}
|
|
82
106
|
};
|
|
@@ -96,43 +120,56 @@ const Image = forwardRef((props, ref) => {
|
|
|
96
120
|
const [imageHeight, setImageHeight] = useState(0);
|
|
97
121
|
const [ratio, setRatio] = useState(0);
|
|
98
122
|
const [loaded, setLoaded] = useState(!isLayoutMode);
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
123
|
+
const state = useRef({
|
|
124
|
+
viewWidth,
|
|
125
|
+
viewHeight
|
|
126
|
+
});
|
|
127
|
+
function setViewSize(viewWidth, viewHeight, ratio) {
|
|
128
|
+
// 在特定模式下可预测 view 的变化,在onLayout触发时能以此避免重复render
|
|
129
|
+
switch (mode) {
|
|
130
|
+
case 'widthFix': {
|
|
131
|
+
setViewWidth(viewWidth);
|
|
132
|
+
const fixedHeight = getFixedHeight(viewWidth, viewHeight, ratio);
|
|
133
|
+
setViewHeight(fixedHeight);
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
case 'heightFix': {
|
|
137
|
+
setViewHeight(viewHeight);
|
|
138
|
+
const fixedWidth = getFixedWidth(viewWidth, viewHeight, ratio);
|
|
139
|
+
setViewWidth(fixedWidth);
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
default:
|
|
143
|
+
setViewHeight(viewHeight);
|
|
144
|
+
setViewWidth(viewWidth);
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
109
148
|
const modeStyle = useMemo(() => {
|
|
110
149
|
if (noMeetCalcRule(isSvg, mode, viewWidth, viewHeight, ratio))
|
|
111
150
|
return {};
|
|
112
151
|
switch (mode) {
|
|
113
|
-
case 'scaleToFill':
|
|
152
|
+
case 'scaleToFill': // wx 中 svg 图片的 scaleToFill 模式效果与 aspectFit 一致,不会就行图片缩放,此处保持一致
|
|
114
153
|
case 'aspectFit':
|
|
115
154
|
if (isSvg) {
|
|
116
|
-
const scale =
|
|
117
|
-
? imageWidth >= viewWidth ? viewWidth / imageWidth : imageWidth / viewWidth
|
|
118
|
-
: imageHeight >= viewHeight ? viewHeight / imageHeight : imageHeight / viewHeight;
|
|
155
|
+
const scale = getFitScale(imageWidth, imageHeight, viewWidth, viewHeight);
|
|
119
156
|
return {
|
|
120
157
|
transform: [
|
|
121
|
-
{ scale },
|
|
122
|
-
|
|
158
|
+
{ translateY: relativeCenteredSize(viewHeight, imageHeight * scale) },
|
|
159
|
+
{ translateX: relativeCenteredSize(viewWidth, imageWidth * scale) },
|
|
160
|
+
{ scale }
|
|
123
161
|
]
|
|
124
162
|
};
|
|
125
163
|
}
|
|
126
164
|
return {};
|
|
127
165
|
case 'aspectFill':
|
|
128
166
|
if (isSvg) {
|
|
129
|
-
const scale =
|
|
130
|
-
? imageWidth >= viewWidth ? viewWidth / imageWidth : imageWidth / viewWidth
|
|
131
|
-
: imageHeight >= viewHeight ? viewHeight / imageHeight : imageHeight / viewHeight;
|
|
167
|
+
const scale = getFillScale(imageWidth, imageHeight, viewWidth, viewHeight);
|
|
132
168
|
return {
|
|
133
169
|
transform: [
|
|
134
|
-
{ scale },
|
|
135
|
-
|
|
170
|
+
{ translateY: relativeCenteredSize(viewHeight, imageHeight * scale) },
|
|
171
|
+
{ translateX: relativeCenteredSize(viewWidth, imageWidth * scale) },
|
|
172
|
+
{ scale }
|
|
136
173
|
]
|
|
137
174
|
};
|
|
138
175
|
}
|
|
@@ -140,9 +177,7 @@ const Image = forwardRef((props, ref) => {
|
|
|
140
177
|
case 'widthFix':
|
|
141
178
|
case 'heightFix':
|
|
142
179
|
if (isSvg) {
|
|
143
|
-
const scale =
|
|
144
|
-
? imageWidth >= fixedWidth ? fixedWidth / imageWidth : imageWidth / fixedWidth
|
|
145
|
-
: imageHeight >= fixedHeight ? fixedHeight / imageHeight : imageHeight / fixedHeight;
|
|
180
|
+
const scale = getFitScale(imageWidth, imageHeight, viewWidth, viewHeight);
|
|
146
181
|
return {
|
|
147
182
|
transform: [{ scale }]
|
|
148
183
|
};
|
|
@@ -205,12 +240,23 @@ const Image = forwardRef((props, ref) => {
|
|
|
205
240
|
default:
|
|
206
241
|
return {};
|
|
207
242
|
}
|
|
208
|
-
}, [isSvg, mode, viewWidth, viewHeight, imageWidth, imageHeight, ratio
|
|
243
|
+
}, [isSvg, mode, viewWidth, viewHeight, imageWidth, imageHeight, ratio]);
|
|
209
244
|
const onSvgLoad = (evt) => {
|
|
210
245
|
const { width, height } = evt.nativeEvent.layout;
|
|
211
|
-
|
|
212
|
-
setImageWidth(width);
|
|
246
|
+
state.current.imageHeight = height;
|
|
213
247
|
setImageHeight(height);
|
|
248
|
+
state.current.ratio = !width ? 0 : height / width;
|
|
249
|
+
if (isWidthFixMode
|
|
250
|
+
? state.current.viewWidth
|
|
251
|
+
: isHeightFixMode
|
|
252
|
+
? state.current.viewHeight
|
|
253
|
+
: state.current.viewWidth && state.current.viewHeight) {
|
|
254
|
+
setRatio(state.current.ratio);
|
|
255
|
+
setImageWidth(width);
|
|
256
|
+
setImageHeight(height);
|
|
257
|
+
setViewSize(state.current.viewWidth, state.current.viewHeight, state.current.ratio);
|
|
258
|
+
setLoaded(true);
|
|
259
|
+
}
|
|
214
260
|
bindload && bindload(getCustomEvent('load', evt, {
|
|
215
261
|
detail: { width, height },
|
|
216
262
|
layoutRef
|
|
@@ -248,12 +294,10 @@ const Image = forwardRef((props, ref) => {
|
|
|
248
294
|
: isHeightFixMode
|
|
249
295
|
? state.current.viewHeight
|
|
250
296
|
: state.current.viewWidth && state.current.viewHeight) {
|
|
251
|
-
|
|
252
|
-
state.current.viewHeight && setViewHeight(state.current.viewHeight);
|
|
253
|
-
setRatio(!width ? 0 : height / width);
|
|
297
|
+
setRatio(state.current.ratio);
|
|
254
298
|
setImageWidth(width);
|
|
255
299
|
setImageHeight(height);
|
|
256
|
-
state.current
|
|
300
|
+
setViewSize(state.current.viewWidth, state.current.viewHeight, state.current.ratio);
|
|
257
301
|
setLoaded(true);
|
|
258
302
|
}
|
|
259
303
|
}, () => {
|
|
@@ -263,7 +307,7 @@ const Image = forwardRef((props, ref) => {
|
|
|
263
307
|
}, [src, isSvg, isLayoutMode]);
|
|
264
308
|
const innerProps = useInnerProps(extendObject({}, props, layoutProps, {
|
|
265
309
|
ref: nodeRef,
|
|
266
|
-
style: extendObject({}, normalStyle, layoutStyle, isHeightFixMode ? { width:
|
|
310
|
+
style: extendObject({}, normalStyle, layoutStyle, isHeightFixMode ? { width: viewWidth } : {}, isWidthFixMode ? { height: viewHeight } : {})
|
|
267
311
|
}), [
|
|
268
312
|
'src',
|
|
269
313
|
'mode',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mpx-inline-text.d.ts","sourceRoot":"","sources":["../mpx-inline-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;;CAQjD,CAAA;AAID,eAAe,UAAU,CAAA"}
|
|
@@ -32,6 +32,7 @@ export interface InputProps {
|
|
|
32
32
|
'parent-width'?: number;
|
|
33
33
|
'parent-height'?: number;
|
|
34
34
|
'adjust-position': boolean;
|
|
35
|
+
'hold-keyboard'?: boolean;
|
|
35
36
|
bindinput?: (evt: NativeSyntheticEvent<TextInputTextInputEventData> | unknown) => void;
|
|
36
37
|
bindfocus?: (evt: NativeSyntheticEvent<TextInputFocusEventData> | unknown) => void;
|
|
37
38
|
bindblur?: (evt: NativeSyntheticEvent<TextInputFocusEventData> | unknown) => void;
|
|
@@ -47,3 +48,4 @@ export interface PrivateInputProps {
|
|
|
47
48
|
type FinalInputProps = InputProps & PrivateInputProps;
|
|
48
49
|
declare const Input: import("react").ForwardRefExoticComponent<InputProps & PrivateInputProps & import("react").RefAttributes<HandlerRef<TextInput, FinalInputProps>>>;
|
|
49
50
|
export default Input;
|
|
51
|
+
//# sourceMappingURL=mpx-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mpx-input.d.ts","sourceRoot":"","sources":["../mpx-input.tsx"],"names":[],"mappings":";AAwCA,OAAO,EACL,SAAS,EACT,SAAS,EACT,SAAS,EACT,oBAAoB,EACpB,2BAA2B,EAC3B,0BAA0B,EAC1B,mCAAmC,EACnC,SAAS,EACT,iCAAiC,EACjC,uBAAuB,EAEvB,+BAA+B,EAEhC,MAAM,cAAc,CAAA;AAIrB,OAAoB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAIvD,KAAK,UAAU,GAAG,IAAI,CACpB,SAAS,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,EAClD,iBAAiB,GACjB,gBAAgB,GAChB,kBAAkB,GAClB,mBAAmB,GACnB,qBAAqB,GACrB,sBAAsB,GACtB,yBAAyB,GACzB,wBAAwB,CAC3B,CAAA;AAED,KAAK,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAA;AAElD,KAAK,W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CAAC,2BAA2B,CAAC,GAAG,OAAO,KAAK,IAAI,CAAA;IACtF,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,oBAAoB,CAAC,uBAAuB,CAAC,GAAG,OAAO,KAAK,IAAI,CAAA;IAClF,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,oBAAoB,CAAC,uBAAuB,CAAC,GAAG,OAAO,KAAK,IAAI,CAAA;IACjF,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,oBAAoB,CAAC,+BAA+B,GAAG,0BAA0B,CAAC,GAAG,OAAO,KAAK,IAAI,CAAA;IACzH,mBAAmB,CAAC,EAAE,CAAC,GAAG,EAAE,oBAAoB,CAAC,iCAAiC,CAAC,GAAG,OAAO,KAAK,IAAI,CAAA;CACvG;AAED,MAAM,WAAW,iBAAiB;IAChC,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,oBAAoB,CAAC,mCAAmC,CAAC,GAAG,OAAO,KAAK,IAAI,CAAA;CACpG;AAED,KAAK,eAAe,GAAG,UAAU,GAAG,iBAAiB,CAAA;AASrD,QAAA,MAAM,KAAK,mJAwYT,CAAA;AAIF,eAAe,KAAK,CAAA"}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* ✔ selection-start
|
|
19
19
|
* ✔ selection-end
|
|
20
20
|
* ✔ adjust-position
|
|
21
|
-
*
|
|
21
|
+
* ✔ hold-keyboard
|
|
22
22
|
* ✘ safe-password-cert-path
|
|
23
23
|
* ✘ safe-password-length
|
|
24
24
|
* ✘ safe-password-time-stamp
|
|
@@ -52,7 +52,7 @@ const keyboardTypeMap = {
|
|
|
52
52
|
digit: isIOS ? 'decimal-pad' : 'numeric'
|
|
53
53
|
};
|
|
54
54
|
const Input = forwardRef((props, ref) => {
|
|
55
|
-
const { style = {}, allowFontScaling = false, type = 'text', value, password, 'placeholder-style': placeholderStyle = {}, disabled, maxlength = 140, 'cursor-spacing': cursorSpacing = 0, 'auto-focus': autoFocus, focus, 'confirm-type': confirmType = 'done', 'confirm-hold': confirmHold = false, cursor, 'cursor-color': cursorColor, 'selection-start': selectionStart = -1, 'selection-end': selectionEnd = -1, 'enable-var': enableVar, 'external-var-context': externalVarContext, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight, 'adjust-position': adjustPosition = true, bindinput, bindfocus, bindblur, bindconfirm, bindselectionchange,
|
|
55
|
+
const { style = {}, allowFontScaling = false, type = 'text', value, password, 'placeholder-style': placeholderStyle = {}, disabled, maxlength = 140, 'cursor-spacing': cursorSpacing = 0, 'auto-focus': autoFocus, focus, 'confirm-type': confirmType = 'done', 'confirm-hold': confirmHold = false, cursor, 'cursor-color': cursorColor, 'selection-start': selectionStart = -1, 'selection-end': selectionEnd = -1, 'enable-var': enableVar, 'external-var-context': externalVarContext, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight, 'adjust-position': adjustPosition = true, 'hold-keyboard': holdKeyboard = false, bindinput, bindfocus, bindblur, bindconfirm, bindselectionchange,
|
|
56
56
|
// private
|
|
57
57
|
multiline, 'auto-height': autoHeight, bindlinechange } = props;
|
|
58
58
|
const formContext = useContext(FormContext);
|
|
@@ -145,7 +145,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
145
145
|
};
|
|
146
146
|
const setKeyboardAvoidContext = () => {
|
|
147
147
|
if (keyboardAvoid) {
|
|
148
|
-
keyboardAvoid.current = { cursorSpacing, ref: nodeRef, adjustPosition };
|
|
148
|
+
keyboardAvoid.current = { cursorSpacing, ref: nodeRef, adjustPosition, holdKeyboard };
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
151
|
const onTouchStart = () => {
|
|
@@ -159,27 +159,34 @@ const Input = forwardRef((props, ref) => {
|
|
|
159
159
|
if (!keyboardAvoid?.current) {
|
|
160
160
|
setKeyboardAvoidContext();
|
|
161
161
|
}
|
|
162
|
-
if (bindfocus
|
|
162
|
+
if (bindfocus) {
|
|
163
163
|
const focusAction = () => {
|
|
164
164
|
bindfocus(getCustomEvent('focus', evt, {
|
|
165
165
|
detail: {
|
|
166
166
|
value: tmpValue.current || '',
|
|
167
|
-
height: keyboardAvoid
|
|
167
|
+
height: keyboardAvoid?.current?.keyboardHeight
|
|
168
168
|
},
|
|
169
169
|
layoutRef
|
|
170
170
|
}, props));
|
|
171
|
-
if (keyboardAvoid
|
|
171
|
+
if (keyboardAvoid?.current?.onKeyboardShow) {
|
|
172
172
|
keyboardAvoid.current.onKeyboardShow = undefined;
|
|
173
173
|
}
|
|
174
174
|
};
|
|
175
|
-
if (keyboardAvoid
|
|
176
|
-
//
|
|
177
|
-
|
|
175
|
+
if (keyboardAvoid?.current) {
|
|
176
|
+
// 有 keyboardAvoiding
|
|
177
|
+
if (keyboardAvoid.current.keyboardHeight) {
|
|
178
|
+
// iOS: keyboard 获取高度时机 keyboardWillShow 在 input focus 之前,可以立即执行
|
|
179
|
+
focusAction();
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
// Android,Harmony: keyboard 获取高度时机 keyboardDidShow 在 input focus 之后,需要延迟回调
|
|
183
|
+
evt.persist();
|
|
184
|
+
keyboardAvoid.current.onKeyboardShow = focusAction;
|
|
185
|
+
}
|
|
178
186
|
}
|
|
179
187
|
else {
|
|
180
|
-
//
|
|
181
|
-
|
|
182
|
-
keyboardAvoid.current.onKeyboardShow = focusAction;
|
|
188
|
+
// 无 keyboardAvoiding,直接执行 focus 回调
|
|
189
|
+
focusAction();
|
|
183
190
|
}
|
|
184
191
|
}
|
|
185
192
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mpx-keyboard-avoiding-view.d.ts","sourceRoot":"","sources":["../mpx-keyboard-avoiding-view.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAiC,MAAM,OAAO,CAAA;AACvE,OAAO,EAAuD,SAAS,EAA0C,MAAM,cAAc,CAAA;AAKrI,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,qBAAqB,CAAC,EAAE,SAAS,CAAA;CAClC,CAAA;AAED,QAAA,MAAM,oBAAoB;iDAAgD,sBAAsB;;CAiH/F,CAAA;AAID,eAAe,oBAAoB,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable space-before-function-paren */
|
|
1
2
|
import React, { useContext, useEffect, useRef } from 'react';
|
|
2
3
|
import { Keyboard, View } from 'react-native';
|
|
3
4
|
import Animated, { useSharedValue, useAnimatedStyle, withTiming, Easing, cancelAnimation } from 'react-native-reanimated';
|
|
@@ -11,9 +12,8 @@ const KeyboardAvoidingView = ({ children, style, contentContainerStyle }) => {
|
|
|
11
12
|
const keyboardAvoid = useContext(KeyboardAvoidContext);
|
|
12
13
|
// fix: 某些特殊机型下隐藏键盘可能会先触发一次 keyboardWillShow,
|
|
13
14
|
// 比如机型 iPhone 11 Pro,可能会导致显隐动画冲突
|
|
14
|
-
// 因此增加状态标记 +
|
|
15
|
+
// 因此增加状态标记 + cancelAnimation 来优化
|
|
15
16
|
const isShow = useRef(false);
|
|
16
|
-
const timerRef = useRef(null);
|
|
17
17
|
const animatedStyle = useAnimatedStyle(() => ({
|
|
18
18
|
// translate/position top可能会导致底部渲染区域缺失
|
|
19
19
|
marginTop: -offset.value,
|
|
@@ -24,7 +24,6 @@ const KeyboardAvoidingView = ({ children, style, contentContainerStyle }) => {
|
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
isShow.current = false;
|
|
27
|
-
timerRef.current && clearTimeout(timerRef.current);
|
|
28
27
|
if (keyboardAvoid?.current) {
|
|
29
28
|
const inputRef = keyboardAvoid.current.ref?.current;
|
|
30
29
|
if (inputRef && inputRef.isFocused()) {
|
|
@@ -39,19 +38,19 @@ const KeyboardAvoidingView = ({ children, style, contentContainerStyle }) => {
|
|
|
39
38
|
};
|
|
40
39
|
const onTouchEnd = ({ nativeEvent }) => {
|
|
41
40
|
if (nativeEvent.origin !== 'input') {
|
|
41
|
+
if (keyboardAvoid?.current?.holdKeyboard) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
42
44
|
Keyboard.isVisible() && Keyboard.dismiss();
|
|
43
45
|
}
|
|
44
46
|
};
|
|
45
47
|
useEffect(() => {
|
|
46
48
|
let subscriptions = [];
|
|
47
|
-
function keybaordAvoding(evt
|
|
49
|
+
function keybaordAvoding(evt) {
|
|
48
50
|
if (!keyboardAvoid?.current || isShow.current) {
|
|
49
51
|
return;
|
|
50
52
|
}
|
|
51
53
|
isShow.current = true;
|
|
52
|
-
if (ios) {
|
|
53
|
-
timerRef.current && clearTimeout(timerRef.current);
|
|
54
|
-
}
|
|
55
54
|
const { endCoordinates } = evt;
|
|
56
55
|
const { ref, cursorSpacing = 0, adjustPosition, onKeyboardShow } = keyboardAvoid.current;
|
|
57
56
|
keyboardAvoid.current.keyboardHeight = endCoordinates.height;
|
|
@@ -64,9 +63,10 @@ const KeyboardAvoidingView = ({ children, style, contentContainerStyle }) => {
|
|
|
64
63
|
function calculateOffset() {
|
|
65
64
|
// enableNativeKeyboardAvoding 默认开启
|
|
66
65
|
if (enableNativeKeyboardAvoiding && isAndroid) {
|
|
67
|
-
const aboveOffset =
|
|
66
|
+
const aboveOffset = pageY + height - endCoordinates.screenY;
|
|
67
|
+
const belowOffset = endCoordinates.height - aboveOffset;
|
|
68
68
|
const aboveValue = -aboveOffset >= cursorSpacing ? 0 : aboveOffset + cursorSpacing;
|
|
69
|
-
const belowValue = Math.min(
|
|
69
|
+
const belowValue = Math.min(belowOffset, cursorSpacing);
|
|
70
70
|
return aboveOffset > 0 ? belowValue : aboveValue;
|
|
71
71
|
}
|
|
72
72
|
const aboveOffset = offset.value + pageY + height - endCoordinates.screenY;
|
|
@@ -83,26 +83,17 @@ const KeyboardAvoidingView = ({ children, style, contentContainerStyle }) => {
|
|
|
83
83
|
});
|
|
84
84
|
});
|
|
85
85
|
};
|
|
86
|
-
(isIOS ? () =>
|
|
86
|
+
(isIOS ? () => setTimeout(callback) : callback)();
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
if (isIOS) {
|
|
90
|
-
subscriptions = [
|
|
91
|
-
Keyboard.addListener('keyboardWillShow', (evt) => {
|
|
92
|
-
keybaordAvoding(evt, true);
|
|
93
|
-
}),
|
|
94
|
-
Keyboard.addListener('keyboardWillHide', resetKeyboard)
|
|
95
|
-
];
|
|
90
|
+
subscriptions = [Keyboard.addListener('keyboardWillShow', keybaordAvoding), Keyboard.addListener('keyboardWillHide', resetKeyboard)];
|
|
96
91
|
}
|
|
97
92
|
else {
|
|
98
|
-
subscriptions = [
|
|
99
|
-
Keyboard.addListener('keyboardDidShow', keybaordAvoding),
|
|
100
|
-
Keyboard.addListener('keyboardDidHide', resetKeyboard)
|
|
101
|
-
];
|
|
93
|
+
subscriptions = [Keyboard.addListener('keyboardDidShow', keybaordAvoding), Keyboard.addListener('keyboardDidHide', resetKeyboard)];
|
|
102
94
|
}
|
|
103
95
|
return () => {
|
|
104
96
|
subscriptions.forEach(subscription => subscription.remove());
|
|
105
|
-
timerRef.current && clearTimeout(timerRef.current);
|
|
106
97
|
};
|
|
107
98
|
}, [keyboardAvoid]);
|
|
108
99
|
return (<View style={style} onTouchEnd={onTouchEnd} onTouchMove={onTouchEnd}>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mpx-label.d.ts","sourceRoot":"","sources":["../mpx-label.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAA2B,SAAS,EAA8B,MAAM,OAAO,CAAA;AACtF,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAGpE,OAAoB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAKvD,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,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;AAED,QAAA,MAAM,KAAK,qHA0FV,CAAA;AAID,eAAe,KAAK,CAAA"}
|
|
@@ -18,3 +18,4 @@ interface MovableAreaProps {
|
|
|
18
18
|
}
|
|
19
19
|
declare const _MovableArea: import("react").ForwardRefExoticComponent<MovableAreaProps & import("react").RefAttributes<HandlerRef<View, MovableAreaProps>>>;
|
|
20
20
|
export default _MovableArea;
|
|
21
|
+
//# sourceMappingURL=mpx-movable-area.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mpx-movable-area.d.ts","sourceRoot":"","sources":["../mpx-movable-area.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAmB,SAAS,EAAkC,MAAM,OAAO,CAAA;AAClF,OAAoB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAMvD,UAAU,gBAAgB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3B,QAAQ,EAAE,SAAS,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,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,YAAY,iIAsDhB,CAAA;AAIF,eAAe,YAAY,CAAA"}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* ✔ out-of-bounds
|
|
5
5
|
* ✔ x
|
|
6
6
|
* ✔ y
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* ✔ damping
|
|
8
|
+
* ✔ friction
|
|
9
9
|
* ✔ disabled
|
|
10
10
|
* ✘ scale
|
|
11
11
|
* ✘ scale-min
|
|
@@ -30,6 +30,8 @@ interface MovableViewProps {
|
|
|
30
30
|
y?: number;
|
|
31
31
|
disabled?: boolean;
|
|
32
32
|
animation?: boolean;
|
|
33
|
+
damping?: number;
|
|
34
|
+
friction?: number;
|
|
33
35
|
id?: string;
|
|
34
36
|
changeThrottleTime?: number;
|
|
35
37
|
bindchange?: (event: unknown) => void;
|
|
@@ -61,3 +63,4 @@ interface MovableViewProps {
|
|
|
61
63
|
}
|
|
62
64
|
declare const _MovableView: import("react").ForwardRefExoticComponent<MovableViewProps & import("react").RefAttributes<HandlerRef<View, MovableViewProps>>>;
|
|
63
65
|
export default _MovableView;
|
|
66
|
+
//# sourceMappingURL=mpx-movable-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mpx-movable-view.d.ts","sourceRoot":"","sources":["../mpx-movable-view.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAyB,SAAS,EAA2D,MAAM,OAAO,CAAA;AAC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