@mpxjs/webpack-plugin 2.10.14-beta.7 → 2.10.14-beta.8
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/style/wx/index.js +7 -1
- package/lib/runtime/components/react/dist/context.d.ts +5 -3
- package/lib/runtime/components/react/dist/context.js +1 -1
- package/lib/runtime/components/react/dist/event.config.d.ts +0 -1
- package/lib/runtime/components/react/dist/getInnerListeners.d.ts +0 -1
- package/lib/runtime/components/react/dist/getInnerListeners.js +21 -35
- package/lib/runtime/components/react/dist/mpx-async-suspense.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-async-suspense.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-button.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/Bus.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/Image.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/ImageData.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/html.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/index.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/utils.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-checkbox-group.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-checkbox.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-form.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-icon/index.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-image.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-image.jsx +37 -81
- package/lib/runtime/components/react/dist/mpx-inline-text.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-input.d.ts +0 -2
- package/lib/runtime/components/react/dist/mpx-input.jsx +12 -19
- package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.jsx +21 -12
- package/lib/runtime/components/react/dist/mpx-label.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-movable-area.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-movable-view.d.ts +2 -5
- package/lib/runtime/components/react/dist/mpx-movable-view.jsx +34 -102
- package/lib/runtime/components/react/dist/mpx-nav-container.d.ts +9 -0
- package/lib/runtime/components/react/dist/mpx-nav-container.jsx +23 -0
- package/lib/runtime/components/react/dist/mpx-navigator.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/date.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/dateData.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/index.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/multiSelector.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/region.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/regionData.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/selector.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/time.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/type.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view/index.d.ts +0 -2
- package/lib/runtime/components/react/dist/mpx-picker-view/index.jsx +3 -4
- package/lib/runtime/components/react/dist/mpx-picker-view/pickerVIewContext.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/index.d.ts +0 -2
- package/lib/runtime/components/react/dist/mpx-picker-view-column/index.jsx +21 -15
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.jsx +11 -8
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewFaces.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewIndicator.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewMask.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-popup/index.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-popup/popupBase.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-portal/index.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-portal/index.jsx +1 -5
- package/lib/runtime/components/react/dist/mpx-portal/portal-host.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-portal/portal-manager.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-portal/portal-manager.jsx +5 -3
- package/lib/runtime/components/react/dist/mpx-radio-group.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-radio.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-rich-text/html.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-rich-text/index.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-root-portal.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-scroll-view.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +51 -69
- package/lib/runtime/components/react/dist/mpx-simple-text.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-simple-view.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-sticky-header.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-sticky-section.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-swiper-item.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-swiper.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-swiper.jsx +16 -9
- package/lib/runtime/components/react/dist/mpx-switch.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-text.d.ts +1 -3
- package/lib/runtime/components/react/dist/mpx-text.jsx +5 -33
- package/lib/runtime/components/react/dist/mpx-textarea.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-video.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-view.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-web-view.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-web-view.jsx +2 -21
- package/lib/runtime/components/react/dist/{mpx-nav.d.ts → nav.d.ts} +0 -1
- package/lib/runtime/components/react/dist/{mpx-nav.jsx → nav.jsx} +6 -1
- package/lib/runtime/components/react/dist/parser.d.ts +0 -1
- package/lib/runtime/components/react/dist/useAnimationHooks.d.ts +0 -1
- package/lib/runtime/components/react/dist/useNavShared.d.ts +2 -0
- package/lib/runtime/components/react/dist/useNavShared.js +6 -0
- package/lib/runtime/components/react/dist/useNodesRef.d.ts +0 -1
- package/lib/runtime/components/react/dist/utils.d.ts +0 -1
- package/lib/runtime/components/react/dist/utils.jsx +6 -16
- package/lib/runtime/components/react/mpx-view.tsx +1 -1
- package/package.json +1 -1
- package/lib/runtime/components/react/dist/context.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/event.config.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/getInnerListeners.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-async-suspense.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-button.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-camera.d.ts +0 -27
- package/lib/runtime/components/react/dist/mpx-camera.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-camera.jsx +0 -197
- package/lib/runtime/components/react/dist/mpx-canvas/Bus.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/Image.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/ImageData.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/html.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/utils.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-checkbox-group.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-checkbox.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-form.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-icon/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-image.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-inline-text.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-input.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-label.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-movable-area.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-movable-view.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-nav.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-navigator.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/date.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/dateData.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/multiSelector.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/region.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/regionData.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/selector.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/time.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/type.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view/pickerVIewContext.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.d.ts +0 -14
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.jsx +0 -20
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewFaces.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewIndicator.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewMask.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-popup/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-popup/popupBase.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-portal/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-portal/portal-host.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-portal/portal-manager.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-progress.d.ts +0 -24
- package/lib/runtime/components/react/dist/mpx-progress.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-progress.jsx +0 -163
- package/lib/runtime/components/react/dist/mpx-radio-group.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-radio.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-rich-text/html.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-rich-text/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-root-portal.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-scroll-view.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-simple-text.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-simple-view.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-slider.d.ts +0 -31
- package/lib/runtime/components/react/dist/mpx-slider.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-slider.jsx +0 -321
- package/lib/runtime/components/react/dist/mpx-sticky-header.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-sticky-section.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-swiper-item.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-swiper.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-switch.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-text.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-textarea.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-video.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-view.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-web-view.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/parser.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/useAnimationHooks.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/useNodesRef.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/utils.d.ts.map +0 -1
|
@@ -315,7 +315,7 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
315
315
|
switch (prop) {
|
|
316
316
|
case bgPropMap.image: {
|
|
317
317
|
// background-image 支持背景图/渐变/css var
|
|
318
|
-
if (cssVariableExp.test(value) || urlExp.test(value) || linearExp.test(value)) {
|
|
318
|
+
if (cssVariableExp.test(value) || urlExp.test(value) || linearExp.test(value) || value === 'none') {
|
|
319
319
|
return { prop, value }
|
|
320
320
|
} else {
|
|
321
321
|
error(`Value of ${prop} in ${selector} selector only support value <url()> or <linear-gradient()>, received ${value}, please check again!`)
|
|
@@ -359,6 +359,12 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
359
359
|
error(`Property [${bgPropMap.all}] in ${selector} is abbreviated property and does not support CSS var`)
|
|
360
360
|
return false
|
|
361
361
|
}
|
|
362
|
+
if (value === 'none') {
|
|
363
|
+
return [
|
|
364
|
+
{ prop: bgPropMap.image, value },
|
|
365
|
+
{ prop: bgPropMap.color, value: 'transparent' }
|
|
366
|
+
]
|
|
367
|
+
}
|
|
362
368
|
const bgMap = []
|
|
363
369
|
const values = parseValues(value)
|
|
364
370
|
values.forEach(item => {
|
|
@@ -7,7 +7,6 @@ export type KeyboardAvoidContextValue = MutableRefObject<{
|
|
|
7
7
|
cursorSpacing: number;
|
|
8
8
|
ref: MutableRefObject<any>;
|
|
9
9
|
adjustPosition: boolean;
|
|
10
|
-
holdKeyboard?: boolean;
|
|
11
10
|
keyboardHeight?: number;
|
|
12
11
|
onKeyboardShow?: () => void;
|
|
13
12
|
} | null>;
|
|
@@ -55,6 +54,10 @@ export interface StickyContextValue {
|
|
|
55
54
|
registerStickyHeader: Function;
|
|
56
55
|
unregisterStickyHeader: Function;
|
|
57
56
|
}
|
|
57
|
+
export interface NavSharedValue {
|
|
58
|
+
customNav?: React.ReactNode;
|
|
59
|
+
setCustomNav: (value: React.ReactNode) => void;
|
|
60
|
+
}
|
|
58
61
|
export declare const MovableAreaContext: import("react").Context<{
|
|
59
62
|
width: number;
|
|
60
63
|
height: number;
|
|
@@ -72,5 +75,4 @@ export declare const KeyboardAvoidContext: import("react").Context<KeyboardAvoid
|
|
|
72
75
|
export declare const ScrollViewContext: import("react").Context<ScrollViewContextValue>;
|
|
73
76
|
export declare const PortalContext: import("react").Context<PortalContextValue>;
|
|
74
77
|
export declare const StickyContext: import("react").Context<StickyContextValue>;
|
|
75
|
-
export declare const
|
|
76
|
-
//# sourceMappingURL=context.d.ts.map
|
|
78
|
+
export declare const NavSharedContext: import("react").Context<NavSharedValue>;
|
|
@@ -15,4 +15,4 @@ export const KeyboardAvoidContext = createContext(null);
|
|
|
15
15
|
export const ScrollViewContext = createContext({ gestureRef: null, scrollOffset: new Animated.Value(0) });
|
|
16
16
|
export const PortalContext = createContext(null);
|
|
17
17
|
export const StickyContext = createContext({ registerStickyHeader: noop, unregisterStickyHeader: noop });
|
|
18
|
-
export const
|
|
18
|
+
export const NavSharedContext = createContext(null);
|
|
@@ -5,4 +5,3 @@ export declare const getCustomEvent: (type: string | undefined, oe: any, { detai
|
|
|
5
5
|
}, props?: Props) => any;
|
|
6
6
|
declare const useInnerProps: (props?: Props, userRemoveProps?: RemoveProps, rawConfig?: RawConfig) => Record<string, (e: ExtendedNativeTouchEvent) => void> & Omit<Props, string>;
|
|
7
7
|
export default useInnerProps;
|
|
8
|
-
//# sourceMappingURL=getInnerListeners.d.ts.map
|
|
@@ -3,8 +3,7 @@ import { collectDataset } from '@mpxjs/utils';
|
|
|
3
3
|
import { omit, extendObject, useNavigation } from './utils';
|
|
4
4
|
import eventConfigMap from './event.config';
|
|
5
5
|
const globalEventState = {
|
|
6
|
-
needPress: true
|
|
7
|
-
identifier: null
|
|
6
|
+
needPress: true
|
|
8
7
|
};
|
|
9
8
|
const getTouchEvent = (type, event, config) => {
|
|
10
9
|
const { navigation, propsRef, layoutRef } = config;
|
|
@@ -95,48 +94,36 @@ function checkIsNeedPress(e, type, ref) {
|
|
|
95
94
|
ref.current.startTimer[type] = null;
|
|
96
95
|
}
|
|
97
96
|
}
|
|
98
|
-
function shouldHandleTapEvent(e, eventConfig) {
|
|
99
|
-
const { identifier } = e.nativeEvent.changedTouches[0];
|
|
100
|
-
return eventConfig.tap && globalEventState.identifier === identifier;
|
|
101
|
-
}
|
|
102
97
|
function handleTouchstart(e, type, eventConfig) {
|
|
98
|
+
// 阻止事件被释放放回对象池,导致对象复用 _stoppedEventTypes 状态被保留
|
|
103
99
|
e.persist();
|
|
104
100
|
const { innerRef } = eventConfig;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
globalEventState.identifier = identifier;
|
|
111
|
-
globalEventState.needPress = true;
|
|
112
|
-
innerRef.current.mpxPressInfo.detail = {
|
|
113
|
-
x: touch.pageX,
|
|
114
|
-
y: touch.pageY
|
|
115
|
-
};
|
|
116
|
-
}
|
|
101
|
+
globalEventState.needPress = true;
|
|
102
|
+
innerRef.current.mpxPressInfo.detail = {
|
|
103
|
+
x: e.nativeEvent.changedTouches[0].pageX,
|
|
104
|
+
y: e.nativeEvent.changedTouches[0].pageY
|
|
105
|
+
};
|
|
117
106
|
handleEmitEvent('touchstart', e, type, eventConfig);
|
|
118
107
|
if (eventConfig.longpress) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
e._stoppedEventTypes = e._stoppedEventTypes || new Set();
|
|
126
|
-
e._stoppedEventTypes.add('longpress');
|
|
127
|
-
}
|
|
128
|
-
innerRef.current.startTimer[type] && clearTimeout(innerRef.current.startTimer[type]);
|
|
129
|
-
innerRef.current.startTimer[type] = setTimeout(() => {
|
|
130
|
-
globalEventState.needPress = false;
|
|
131
|
-
handleEmitEvent('longpress', e, type, eventConfig);
|
|
132
|
-
}, 350);
|
|
108
|
+
if (e._stoppedEventTypes?.has('longpress')) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (eventConfig.longpress.hasCatch) {
|
|
112
|
+
e._stoppedEventTypes = e._stoppedEventTypes || new Set();
|
|
113
|
+
e._stoppedEventTypes.add('longpress');
|
|
133
114
|
}
|
|
115
|
+
innerRef.current.startTimer[type] && clearTimeout(innerRef.current.startTimer[type]);
|
|
116
|
+
innerRef.current.startTimer[type] = setTimeout(() => {
|
|
117
|
+
// 只要触发过longpress, 全局就不再触发tap
|
|
118
|
+
globalEventState.needPress = false;
|
|
119
|
+
handleEmitEvent('longpress', e, type, eventConfig);
|
|
120
|
+
}, 350);
|
|
134
121
|
}
|
|
135
122
|
}
|
|
136
123
|
function handleTouchmove(e, type, eventConfig) {
|
|
137
124
|
const { innerRef } = eventConfig;
|
|
138
125
|
handleEmitEvent('touchmove', e, type, eventConfig);
|
|
139
|
-
if (
|
|
126
|
+
if (eventConfig.tap) {
|
|
140
127
|
checkIsNeedPress(e, type, innerRef);
|
|
141
128
|
}
|
|
142
129
|
}
|
|
@@ -144,8 +131,7 @@ function handleTouchend(e, type, eventConfig) {
|
|
|
144
131
|
const { innerRef, disableTap } = eventConfig;
|
|
145
132
|
handleEmitEvent('touchend', e, type, eventConfig);
|
|
146
133
|
innerRef.current.startTimer[type] && clearTimeout(innerRef.current.startTimer[type]);
|
|
147
|
-
|
|
148
|
-
if (shouldHandleTapEvent(e, eventConfig)) {
|
|
134
|
+
if (eventConfig.tap) {
|
|
149
135
|
checkIsNeedPress(e, type, innerRef);
|
|
150
136
|
if (!globalEventState.needPress || (type === 'bubble' && disableTap) || e._stoppedEventTypes?.has('tap')) {
|
|
151
137
|
return;
|
|
@@ -100,8 +100,8 @@ const AsyncSuspense = ({ type, chunkName, moduleId, innerProps, getLoading, getF
|
|
|
100
100
|
});
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
-
if (type === 'page' && typeof mpxGlobal.__mpx.config?.rnConfig?.
|
|
104
|
-
mpxGlobal.__mpx.config.rnConfig.
|
|
103
|
+
if (type === 'page' && typeof mpxGlobal.__mpx.config?.rnConfig?.lazyLoadPageErrorHandler === 'function') {
|
|
104
|
+
mpxGlobal.__mpx.config.rnConfig.lazyLoadPageErrorHandler({
|
|
105
105
|
subpackage: chunkName,
|
|
106
106
|
errType: e.type
|
|
107
107
|
});
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
declare const _default: "<html><head>\n <meta content=\"width=device-width, initial-scale=1, maximum-scale=1, user-scaleable=no\" name=\"viewport\">\n <style>\n html {\n -ms-content-zooming: none;\n -ms-touch-action: pan-x pan-y;\n }\n body {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n margin: 0;\n padding: 0;\n overflow: hidden;\n }\n * {\n user-select: none;\n -ms-user-select: none;\n -moz-user-select: none;\n -webkit-user-select: none;\n }\n </style>\n </head>\n <body>\n <script>\n var scale = function (ratio) {\n return function (item) {\n if (typeof item === \"number\") {\n return item * ratio;\n }\n return item;\n };\n};\nfunction autoScaleCanvas(canvas) {\n var ctx = canvas.getContext(\"2d\");\n var ratio = window.devicePixelRatio || 1;\n if (ratio !== 1) {\n canvas.width *= ratio;\n canvas.height *= ratio;\n ctx.scale(ratio, ratio);\n ctx.isPointInPath = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return CanvasRenderingContext2D.prototype.isPointInPath.apply(ctx, args.map(scale(ratio)));\n };\n }\n return canvas;\n}\nwindow.autoScaleCanvas = autoScaleCanvas;\n</script>\n<script>\n\nvar WEBVIEW_TARGET = '@@WEBVIEW_TARGET';\n\nvar ID = function () {\n return Math.random().toString(32).slice(2);\n};\n\nvar flattenObjectCopyValue = function (flatObj, srcObj, key) {\n var value = srcObj[key];\n if (typeof value === 'function') {\n return;\n }\n if (typeof value === 'object' && value instanceof Node) {\n return;\n }\n flatObj[key] = flattenObject(value);\n};\n\nvar flattenObject = function (object) {\n if (typeof object !== 'object' || object === null) {\n return object;\n }\n // Handle TypedArray\n if (object instanceof Uint8ClampedArray) {\n return Array.from(object);\n }\n var flatObject = {};\n for (var key in object) {\n flattenObjectCopyValue(flatObject, object, key);\n }\n for (var key in Object.getOwnPropertyNames(object)) {\n flattenObjectCopyValue(flatObject, object, key);\n }\n return flatObject;\n};\n\nvar AutoScaledCanvas = function (element) {\n this.element = element;\n};\n\nAutoScaledCanvas.prototype.toDataURL = function () {\n return this.element.toDataURL.apply(this.element, arguments);\n};\n\nAutoScaledCanvas.prototype.autoScale = function () {\n if (this.savedHeight !== undefined) {\n this.element.height = this.savedHeight;\n }\n if (this.savedWidth !== undefined) {\n this.element.width = this.savedWidth;\n }\n window.autoScaleCanvas(this.element);\n};\n\nObject.defineProperty(AutoScaledCanvas.prototype, 'width', {\n get: function () {\n return this.element.width;\n },\n set: function (value) {\n this.savedWidth = value;\n this.autoScale();\n return value;\n },\n});\n\nObject.defineProperty(AutoScaledCanvas.prototype, 'height', {\n get: function () {\n return this.element.height;\n },\n set: function (value) {\n this.savedHeight = value;\n this.autoScale();\n return value;\n },\n});\nvar toMessage = function (result) {\n if (result instanceof Blob) {\n return {\n type: 'blob',\n payload: btoa(result),\n meta: {},\n };\n }\n if (result instanceof Object) {\n if (!result[WEBVIEW_TARGET]) {\n var id = ID();\n result[WEBVIEW_TARGET] = id;\n targets[id] = result;\n }\n return {\n type: 'json',\n payload: flattenObject(result),\n args: toArgs(flattenObject(result)),\n meta: {\n target: result[WEBVIEW_TARGET],\n constructor: result.__constructorName__ || result.constructor.name,\n },\n };\n }\n return {\n type: 'json',\n payload: typeof result === 'string' ? result : JSON.stringify(result),\n meta: {},\n };\n};\nvar toArgs = function (result) {\n var args = [];\n for (var key in result) {\n if (result[key] !== undefined && key !== '@@WEBVIEW_TARGET') {\n args.push(result[key]);\n }\n }\n return args;\n};\n\nvar createObjectsFromArgs = function (args) {\n for (var index = 0; index < args.length; index += 1) {\n var currentArg = args[index];\n if (currentArg && currentArg.className !== undefined) {\n var className = currentArg.className, classArgs = currentArg.classArgs;\n // new ImageData,第一个参数需要是 Uint8ClampedArray\n var object = new (Function.prototype.bind.apply(constructors[className], [null].concat(classArgs)))();\n args[index] = object;\n }\n }\n return args;\n};\n\nvar canvas = document.createElement('canvas');\ncanvas.style.width = '100%';\ncanvas.style.height = '100%';\nvar autoScaledCanvas = new AutoScaledCanvas(canvas);\n\nvar targets = {\n canvas: autoScaledCanvas,\n context2D: canvas.getContext('2d'),\n};\n\nvar constructors = {\n CanvasGradient: CanvasGradient,\n Image: Image,\n ImageData: ImageData,\n Uint8ClampedArray: Uint8ClampedArray,\n};\n\nImage.bind =\n Image.bind ||\n function () {\n return Image;\n };\n\nImageData.bind =\n ImageData.bind ||\n function () {\n return ImageData;\n };\nUint8ClampedArray.bind =\n Uint8ClampedArray.bind ||\n function () {\n return Uint8ClampedArray;\n };\n\nvar populateRefs = function (arg) {\n if (arg && arg.__ref__) {\n return targets[arg.__ref__];\n }\n return arg;\n};\ndocument.body.appendChild(canvas);\n\nvar mergeObjects = function (target, source) {\n for (var key in source) {\n if (source.hasOwnProperty(key)) {\n target[key] = source[key];\n }\n }\n return target;\n};\n\nfunction handleMessage(message) {\n var id = message.id,\n type = message.type,\n payload = message.payload;\n\n switch (type) {\n case 'exec': {\n var target = payload.target,\n method = payload.method,\n args = payload.args;\n var result = targets[target][method].apply(targets[target], args.map(populateRefs));\n var msg = toMessage(result);\n\n if (typeof result === 'object' && !msg.meta.constructor) {\n for (var constructorName in constructors) {\n if (result instanceof constructors[constructorName]) {\n msg.meta.constructor = constructorName;\n }\n }\n }\n window.ReactNativeWebView.postMessage(JSON.stringify(mergeObjects({ id: id }, msg)));\n break;\n }\n case 'set': {\n var target = payload.target,\n key = payload.key,\n value = payload.value;\n targets[target][key] = populateRefs(value);\n break;\n }\n case 'construct': {\n var constructor = payload.constructor,\n target = payload.id,\n args = payload.args || [];\n var newArgs = createObjectsFromArgs(args);\n var object;\n try {\n object = new (Function.prototype.bind.apply(constructors[constructor], [null].concat(newArgs)))();\n }\n catch (error) {\n throw new Error('Error while constructing '.concat(constructor, ' ').concat(error.message));\n }\n object.__constructorName__ = constructor;\n var msg = toMessage({});\n targets[target] = object;\n window.ReactNativeWebView.postMessage(JSON.stringify(mergeObjects({ id: id }, msg)));\n break;\n }\n case 'listen': {\n var types = payload.types,\n target = payload.target;\n for (var i = 0; i < types.length; i++) {\n var eventType = types[i];\n targets[target].addEventListener(eventType, function (e) {\n const message = toMessage({\n type: 'event',\n payload: {\n type: e.type,\n target: mergeObjects(flattenObject(targets[target]), {\n [WEBVIEW_TARGET]: target,\n }),\n },\n });\n window.ReactNativeWebView.postMessage(\n JSON.stringify(mergeObjects({ id: id }, message))\n );\n });\n }\n break;\n}\n }\n}\nvar handleError = function (err, message) {\n window.ReactNativeWebView.postMessage(JSON.stringify({\n id: message.id,\n type: 'error',\n payload: {\n message: err.message,\n stack: err.stack,\n },\n }));\n document.removeEventListener('message', handleIncomingMessage);\n};\n\nfunction handleIncomingMessage(data) {\n if (Array.isArray(data)) {\n for (var i = 0; i < data.length; i++) {\n try {\n handleMessage(data[i]);\n } catch (err) {\n handleError(err, data[i]);\n }\n }\n } else {\n try {\n handleMessage(data);\n } catch (err) {\n handleError(err, data);\n }\n }\n}\n\nwindow.mpxWebviewMessageCallback = handleIncomingMessage\n</script>\n \n\n</body></html>";
|
|
2
2
|
export default _default;
|
|
3
|
-
//# sourceMappingURL=html.d.ts.map
|
|
@@ -18,4 +18,3 @@ export interface CheckboxGroupProps {
|
|
|
18
18
|
}
|
|
19
19
|
declare const CheckboxGroup: import("react").ForwardRefExoticComponent<CheckboxGroupProps & import("react").RefAttributes<HandlerRef<View, CheckboxGroupProps>>>;
|
|
20
20
|
export default CheckboxGroup;
|
|
21
|
-
//# sourceMappingURL=mpx-checkbox-group.d.ts.map
|
|
@@ -30,4 +30,3 @@ export interface CheckboxProps extends Selection {
|
|
|
30
30
|
}
|
|
31
31
|
declare const Checkbox: import("react").ForwardRefExoticComponent<CheckboxProps & import("react").RefAttributes<HandlerRef<View, CheckboxProps>>>;
|
|
32
32
|
export default Checkbox;
|
|
33
|
-
//# sourceMappingURL=mpx-checkbox.d.ts.map
|
|
@@ -40,16 +40,7 @@ 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) =>
|
|
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
|
-
}
|
|
43
|
+
const relativeCenteredSize = (viewSize, imageSize) => (viewSize - imageSize) / 2;
|
|
53
44
|
function noMeetCalcRule(isSvg, mode, viewWidth, viewHeight, ratio) {
|
|
54
45
|
const isMeetSize = viewWidth && viewHeight && ratio;
|
|
55
46
|
if (isSvg && !isMeetSize)
|
|
@@ -58,16 +49,6 @@ function noMeetCalcRule(isSvg, mode, viewWidth, viewHeight, ratio) {
|
|
|
58
49
|
return true;
|
|
59
50
|
return false;
|
|
60
51
|
}
|
|
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
|
-
};
|
|
71
52
|
const Image = forwardRef((props, ref) => {
|
|
72
53
|
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;
|
|
73
54
|
const defaultStyle = {
|
|
@@ -75,6 +56,7 @@ const Image = forwardRef((props, ref) => {
|
|
|
75
56
|
height: DEFAULT_IMAGE_HEIGHT
|
|
76
57
|
};
|
|
77
58
|
const styleObj = extendObject({}, defaultStyle, style, { overflow: 'hidden' });
|
|
59
|
+
const state = useRef({});
|
|
78
60
|
const nodeRef = useRef(null);
|
|
79
61
|
useNodesRef(props, ref, nodeRef, {
|
|
80
62
|
defaultStyle
|
|
@@ -88,19 +70,13 @@ const Image = forwardRef((props, ref) => {
|
|
|
88
70
|
const onLayout = ({ nativeEvent: { layout: { width, height } } }) => {
|
|
89
71
|
state.current.viewWidth = width;
|
|
90
72
|
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
|
-
}
|
|
99
73
|
if (state.current.imageWidth && state.current.imageHeight && state.current.ratio) {
|
|
74
|
+
setViewWidth(width);
|
|
75
|
+
setViewHeight(height);
|
|
100
76
|
setRatio(state.current.ratio);
|
|
101
77
|
setImageWidth(state.current.imageWidth);
|
|
102
78
|
setImageHeight(state.current.imageHeight);
|
|
103
|
-
|
|
79
|
+
state.current = {};
|
|
104
80
|
setLoaded(true);
|
|
105
81
|
}
|
|
106
82
|
};
|
|
@@ -120,56 +96,43 @@ const Image = forwardRef((props, ref) => {
|
|
|
120
96
|
const [imageHeight, setImageHeight] = useState(0);
|
|
121
97
|
const [ratio, setRatio] = useState(0);
|
|
122
98
|
const [loaded, setLoaded] = useState(!isLayoutMode);
|
|
123
|
-
const
|
|
124
|
-
viewWidth
|
|
125
|
-
viewHeight
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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
|
-
}
|
|
99
|
+
const fixedHeight = useMemo(() => {
|
|
100
|
+
const fixed = viewWidth * ratio;
|
|
101
|
+
return !fixed ? viewHeight : fixed;
|
|
102
|
+
}, [ratio, viewWidth, viewHeight]);
|
|
103
|
+
const fixedWidth = useMemo(() => {
|
|
104
|
+
if (!ratio)
|
|
105
|
+
return viewWidth;
|
|
106
|
+
const fixed = viewHeight / ratio;
|
|
107
|
+
return !fixed ? viewWidth : fixed;
|
|
108
|
+
}, [ratio, viewWidth, viewHeight]);
|
|
148
109
|
const modeStyle = useMemo(() => {
|
|
149
110
|
if (noMeetCalcRule(isSvg, mode, viewWidth, viewHeight, ratio))
|
|
150
111
|
return {};
|
|
151
112
|
switch (mode) {
|
|
152
|
-
case 'scaleToFill':
|
|
113
|
+
case 'scaleToFill':
|
|
153
114
|
case 'aspectFit':
|
|
154
115
|
if (isSvg) {
|
|
155
|
-
const scale =
|
|
116
|
+
const scale = ratio <= 1
|
|
117
|
+
? imageWidth >= viewWidth ? viewWidth / imageWidth : imageWidth / viewWidth
|
|
118
|
+
: imageHeight >= viewHeight ? viewHeight / imageHeight : imageHeight / viewHeight;
|
|
156
119
|
return {
|
|
157
120
|
transform: [
|
|
158
|
-
{
|
|
159
|
-
{ translateX:
|
|
160
|
-
{ scale }
|
|
121
|
+
{ scale },
|
|
122
|
+
ratio <= 1 ? { translateY: -(imageHeight * scale - viewHeight) / 2 / scale } : { translateX: -(imageWidth * scale - viewWidth) / 2 / scale }
|
|
161
123
|
]
|
|
162
124
|
};
|
|
163
125
|
}
|
|
164
126
|
return {};
|
|
165
127
|
case 'aspectFill':
|
|
166
128
|
if (isSvg) {
|
|
167
|
-
const scale =
|
|
129
|
+
const scale = ratio >= 1
|
|
130
|
+
? imageWidth >= viewWidth ? viewWidth / imageWidth : imageWidth / viewWidth
|
|
131
|
+
: imageHeight >= viewHeight ? viewHeight / imageHeight : imageHeight / viewHeight;
|
|
168
132
|
return {
|
|
169
133
|
transform: [
|
|
170
|
-
{
|
|
171
|
-
{ translateX:
|
|
172
|
-
{ scale }
|
|
134
|
+
{ scale },
|
|
135
|
+
ratio >= 1 ? { translateY: -(imageHeight * scale - viewHeight) / 2 / scale } : { translateX: -(imageWidth * scale - viewWidth) / 2 / scale }
|
|
173
136
|
]
|
|
174
137
|
};
|
|
175
138
|
}
|
|
@@ -177,7 +140,9 @@ const Image = forwardRef((props, ref) => {
|
|
|
177
140
|
case 'widthFix':
|
|
178
141
|
case 'heightFix':
|
|
179
142
|
if (isSvg) {
|
|
180
|
-
const scale =
|
|
143
|
+
const scale = ratio >= 1
|
|
144
|
+
? imageWidth >= fixedWidth ? fixedWidth / imageWidth : imageWidth / fixedWidth
|
|
145
|
+
: imageHeight >= fixedHeight ? fixedHeight / imageHeight : imageHeight / fixedHeight;
|
|
181
146
|
return {
|
|
182
147
|
transform: [{ scale }]
|
|
183
148
|
};
|
|
@@ -240,23 +205,12 @@ const Image = forwardRef((props, ref) => {
|
|
|
240
205
|
default:
|
|
241
206
|
return {};
|
|
242
207
|
}
|
|
243
|
-
}, [isSvg, mode, viewWidth, viewHeight, imageWidth, imageHeight, ratio]);
|
|
208
|
+
}, [isSvg, mode, viewWidth, viewHeight, imageWidth, imageHeight, ratio, fixedWidth, fixedHeight]);
|
|
244
209
|
const onSvgLoad = (evt) => {
|
|
245
210
|
const { width, height } = evt.nativeEvent.layout;
|
|
246
|
-
|
|
211
|
+
setRatio(!width ? 0 : height / width);
|
|
212
|
+
setImageWidth(width);
|
|
247
213
|
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
|
-
}
|
|
260
214
|
bindload && bindload(getCustomEvent('load', evt, {
|
|
261
215
|
detail: { width, height },
|
|
262
216
|
layoutRef
|
|
@@ -294,10 +248,12 @@ const Image = forwardRef((props, ref) => {
|
|
|
294
248
|
: isHeightFixMode
|
|
295
249
|
? state.current.viewHeight
|
|
296
250
|
: state.current.viewWidth && state.current.viewHeight) {
|
|
297
|
-
|
|
251
|
+
state.current.viewWidth && setViewWidth(state.current.viewWidth);
|
|
252
|
+
state.current.viewHeight && setViewHeight(state.current.viewHeight);
|
|
253
|
+
setRatio(!width ? 0 : height / width);
|
|
298
254
|
setImageWidth(width);
|
|
299
255
|
setImageHeight(height);
|
|
300
|
-
|
|
256
|
+
state.current = {};
|
|
301
257
|
setLoaded(true);
|
|
302
258
|
}
|
|
303
259
|
}, () => {
|
|
@@ -307,7 +263,7 @@ const Image = forwardRef((props, ref) => {
|
|
|
307
263
|
}, [src, isSvg, isLayoutMode]);
|
|
308
264
|
const innerProps = useInnerProps(extendObject({}, props, layoutProps, {
|
|
309
265
|
ref: nodeRef,
|
|
310
|
-
style: extendObject({}, normalStyle, layoutStyle, isHeightFixMode ? { width:
|
|
266
|
+
style: extendObject({}, normalStyle, layoutStyle, isHeightFixMode ? { width: fixedWidth } : {}, isWidthFixMode ? { height: fixedHeight } : {})
|
|
311
267
|
}), [
|
|
312
268
|
'src',
|
|
313
269
|
'mode',
|
|
@@ -32,7 +32,6 @@ export interface InputProps {
|
|
|
32
32
|
'parent-width'?: number;
|
|
33
33
|
'parent-height'?: number;
|
|
34
34
|
'adjust-position': boolean;
|
|
35
|
-
'hold-keyboard'?: boolean;
|
|
36
35
|
bindinput?: (evt: NativeSyntheticEvent<TextInputTextInputEventData> | unknown) => void;
|
|
37
36
|
bindfocus?: (evt: NativeSyntheticEvent<TextInputFocusEventData> | unknown) => void;
|
|
38
37
|
bindblur?: (evt: NativeSyntheticEvent<TextInputFocusEventData> | unknown) => void;
|
|
@@ -48,4 +47,3 @@ export interface PrivateInputProps {
|
|
|
48
47
|
type FinalInputProps = InputProps & PrivateInputProps;
|
|
49
48
|
declare const Input: import("react").ForwardRefExoticComponent<InputProps & PrivateInputProps & import("react").RefAttributes<HandlerRef<TextInput, FinalInputProps>>>;
|
|
50
49
|
export default Input;
|
|
51
|
-
//# sourceMappingURL=mpx-input.d.ts.map
|
|
@@ -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,
|
|
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,
|
|
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 };
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
151
|
const onTouchStart = () => {
|
|
@@ -159,34 +159,27 @@ const Input = forwardRef((props, ref) => {
|
|
|
159
159
|
if (!keyboardAvoid?.current) {
|
|
160
160
|
setKeyboardAvoidContext();
|
|
161
161
|
}
|
|
162
|
-
if (bindfocus) {
|
|
162
|
+
if (bindfocus && keyboardAvoid?.current) {
|
|
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
|
-
|
|
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
|
-
}
|
|
175
|
+
if (keyboardAvoid.current.keyboardHeight) {
|
|
176
|
+
// iOS: keyboard 获取高度时机 keyboardWillShow 在 input focus 之前,可以立即执行
|
|
177
|
+
focusAction();
|
|
186
178
|
}
|
|
187
179
|
else {
|
|
188
|
-
//
|
|
189
|
-
|
|
180
|
+
// Android,Harmony: keyboard 获取高度时机 keyboardDidShow 在 input focus 之后,需要延迟回调
|
|
181
|
+
evt.persist();
|
|
182
|
+
keyboardAvoid.current.onKeyboardShow = focusAction;
|
|
190
183
|
}
|
|
191
184
|
}
|
|
192
185
|
};
|