@mpxjs/webpack-plugin 2.9.69 → 2.9.70-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/config.js +14 -0
- package/lib/dependencies/AddEntryDependency.js +24 -0
- package/lib/dependencies/ResolveDependency.js +5 -0
- package/lib/index.js +38 -7
- package/lib/json-compiler/helper.js +3 -3
- package/lib/loader.js +53 -0
- package/lib/platform/template/wx/component-config/button.js +14 -2
- package/lib/platform/template/wx/component-config/image.js +4 -0
- package/lib/platform/template/wx/component-config/input.js +5 -1
- package/lib/platform/template/wx/component-config/rich-text.js +4 -0
- package/lib/platform/template/wx/component-config/scroll-view.js +4 -0
- package/lib/platform/template/wx/component-config/swiper.js +1 -1
- package/lib/platform/template/wx/component-config/switch.js +4 -0
- package/lib/platform/template/wx/component-config/text.js +4 -0
- package/lib/platform/template/wx/component-config/textarea.js +6 -1
- package/lib/platform/template/wx/component-config/view.js +4 -0
- package/lib/platform/template/wx/index.js +127 -1
- package/lib/react/processTemplate.js +3 -0
- package/lib/resolve-loader.js +4 -1
- package/lib/runtime/components/react/context.ts +4 -0
- package/lib/runtime/components/react/dist/context.js +1 -0
- package/lib/runtime/components/react/dist/event.config.js +24 -24
- package/lib/runtime/components/react/dist/getInnerListeners.js +183 -165
- package/lib/runtime/components/react/dist/mpx-button.jsx +35 -42
- package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +30 -12
- package/lib/runtime/components/react/dist/mpx-checkbox-group.jsx +13 -19
- package/lib/runtime/components/react/dist/mpx-checkbox.jsx +29 -38
- package/lib/runtime/components/react/dist/mpx-form.jsx +16 -19
- package/lib/runtime/components/react/dist/mpx-icon.jsx +8 -16
- package/lib/runtime/components/react/dist/mpx-image.jsx +291 -0
- package/lib/runtime/components/react/dist/mpx-input.jsx +54 -27
- package/lib/runtime/components/react/dist/mpx-label.jsx +15 -22
- package/lib/runtime/components/react/dist/mpx-movable-area.jsx +13 -16
- package/lib/runtime/components/react/dist/mpx-movable-view.jsx +13 -13
- package/lib/runtime/components/react/dist/mpx-navigator.jsx +2 -4
- package/lib/runtime/components/react/dist/mpx-picker/date.jsx +6 -2
- package/lib/runtime/components/react/dist/mpx-picker/index.jsx +5 -3
- package/lib/runtime/components/react/dist/mpx-picker/multiSelector.jsx +6 -2
- package/lib/runtime/components/react/dist/mpx-picker/region.jsx +6 -2
- package/lib/runtime/components/react/dist/mpx-picker/selector.jsx +6 -2
- package/lib/runtime/components/react/dist/mpx-picker/time.jsx +10 -15
- package/lib/runtime/components/react/dist/mpx-picker-view-column-item.jsx +39 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column.jsx +110 -97
- package/lib/runtime/components/react/dist/mpx-picker-view.jsx +32 -29
- package/lib/runtime/components/react/dist/mpx-radio-group.jsx +11 -19
- package/lib/runtime/components/react/dist/mpx-radio.jsx +27 -42
- package/lib/runtime/components/react/dist/mpx-rich-text/html.js +39 -0
- package/lib/runtime/components/react/dist/mpx-rich-text/index.jsx +63 -0
- package/lib/runtime/components/react/dist/mpx-root-portal.jsx +6 -4
- package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +47 -41
- package/lib/runtime/components/react/dist/mpx-simple-text.jsx +11 -0
- package/lib/runtime/components/react/dist/mpx-swiper-item.jsx +4 -2
- package/lib/runtime/components/react/dist/mpx-swiper.jsx +606 -0
- package/lib/runtime/components/react/dist/mpx-switch.jsx +20 -10
- package/lib/runtime/components/react/dist/mpx-text.jsx +11 -10
- package/lib/runtime/components/react/dist/mpx-textarea.jsx +8 -3
- package/lib/runtime/components/react/dist/mpx-view.jsx +29 -44
- package/lib/runtime/components/react/dist/mpx-web-view.jsx +105 -42
- package/lib/runtime/components/react/dist/pickerFaces.js +12 -6
- package/lib/runtime/components/react/dist/pickerVIewContext.js +9 -0
- package/lib/runtime/components/react/dist/pickerViewMask.jsx +18 -0
- package/lib/runtime/components/react/dist/{pickerOverlay.jsx → pickerViewOverlay.jsx} +5 -3
- package/lib/runtime/components/react/dist/useAnimationHooks.js +35 -9
- package/lib/runtime/components/react/dist/utils.jsx +20 -24
- package/lib/runtime/components/react/getInnerListeners.ts +35 -28
- package/lib/runtime/components/react/mpx-button.tsx +55 -36
- package/lib/runtime/components/react/mpx-canvas/index.tsx +2 -2
- package/lib/runtime/components/react/mpx-checkbox-group.tsx +13 -12
- package/lib/runtime/components/react/mpx-checkbox.tsx +28 -28
- package/lib/runtime/components/react/mpx-form.tsx +10 -8
- package/lib/runtime/components/react/mpx-icon.tsx +10 -15
- package/lib/runtime/components/react/mpx-image.tsx +396 -0
- package/lib/runtime/components/react/mpx-input.tsx +61 -33
- package/lib/runtime/components/react/mpx-label.tsx +14 -13
- package/lib/runtime/components/react/mpx-movable-area.tsx +8 -7
- package/lib/runtime/components/react/mpx-movable-view.tsx +1 -1
- package/lib/runtime/components/react/mpx-picker/date.tsx +5 -2
- package/lib/runtime/components/react/mpx-picker/index.tsx +3 -2
- package/lib/runtime/components/react/mpx-picker/multiSelector.tsx +5 -2
- package/lib/runtime/components/react/mpx-picker/region.tsx +5 -2
- package/lib/runtime/components/react/mpx-picker/selector.tsx +5 -2
- package/lib/runtime/components/react/mpx-picker/time.tsx +10 -15
- package/lib/runtime/components/react/mpx-picker/type.ts +48 -43
- package/lib/runtime/components/react/mpx-picker-view-column.tsx +4 -1
- package/lib/runtime/components/react/mpx-picker-view.tsx +7 -1
- package/lib/runtime/components/react/mpx-radio-group.tsx +11 -12
- package/lib/runtime/components/react/mpx-radio.tsx +26 -29
- package/lib/runtime/components/react/mpx-scroll-view.tsx +32 -30
- package/lib/runtime/components/react/mpx-simple-text.tsx +18 -0
- package/lib/runtime/components/react/mpx-swiper/carouse.tsx +4 -2
- package/lib/runtime/components/react/mpx-swiper-item.tsx +3 -2
- package/lib/runtime/components/react/mpx-switch.tsx +10 -8
- package/lib/runtime/components/react/mpx-text.tsx +6 -2
- package/lib/runtime/components/react/mpx-view.tsx +37 -45
- package/lib/runtime/components/react/mpx-web-view.tsx +25 -15
- package/lib/runtime/components/react/types/global.d.ts +1 -16
- package/lib/runtime/components/react/utils.tsx +24 -24
- package/lib/runtime/components/tenon/getInnerListeners.js +334 -0
- package/lib/runtime/components/tenon/tenon-button.vue +309 -0
- package/lib/runtime/components/tenon/tenon-image.vue +66 -0
- package/lib/runtime/components/tenon/tenon-input.vue +171 -0
- package/lib/runtime/components/tenon/tenon-rich-text.vue +26 -0
- package/lib/runtime/components/tenon/tenon-scroll-view.vue +127 -0
- package/lib/runtime/components/tenon/tenon-switch.vue +96 -0
- package/lib/runtime/components/tenon/tenon-text.vue +70 -0
- package/lib/runtime/components/tenon/tenon-textarea.vue +86 -0
- package/lib/runtime/components/tenon/tenon-view.vue +93 -0
- package/lib/runtime/components/web/getInnerListeners.js +6 -6
- package/lib/runtime/components/web/mpx-movable-view.vue +334 -344
- package/lib/runtime/components/web/mpx-picker-view-column.vue +75 -75
- package/lib/runtime/components/web/mpx-picker.vue +382 -385
- package/lib/runtime/components/web/mpx-web-view.vue +162 -162
- package/lib/runtime/optionProcessor.js +7 -16
- package/lib/runtime/optionProcessor.tenon.js +84 -0
- package/lib/runtime/utils.js +2 -0
- package/lib/style-compiler/index.js +1 -1
- package/lib/style-compiler/plugins/hm.js +20 -0
- package/lib/template-compiler/bind-this.js +7 -2
- package/lib/template-compiler/compiler.js +67 -40
- package/lib/template-compiler/gen-node-react.js +2 -2
- package/lib/tenon/index.js +117 -0
- package/lib/tenon/processJSON.js +352 -0
- package/lib/tenon/processScript.js +203 -0
- package/lib/tenon/processStyles.js +21 -0
- package/lib/tenon/processTemplate.js +126 -0
- package/lib/tenon/script-helper.js +223 -0
- package/lib/utils/env.js +6 -1
- package/lib/utils/get-relative-path.js +25 -0
- package/package.json +7 -3
- package/LICENSE +0 -433
- package/lib/runtime/components/react/dist/mpx-image/index.jsx +0 -226
- package/lib/runtime/components/react/dist/mpx-image/svg.jsx +0 -7
- package/lib/runtime/components/react/dist/mpx-swiper/carouse.jsx +0 -478
- package/lib/runtime/components/react/dist/mpx-swiper/index.jsx +0 -68
- package/lib/runtime/components/react/dist/mpx-swiper/type.js +0 -1
- package/lib/runtime/components/react/mpx-image/index.tsx +0 -345
- package/lib/runtime/components/react/mpx-image/svg.tsx +0 -22
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ✔ src
|
|
3
|
+
* ✔ mode
|
|
4
|
+
* ✘ show-menu-by-longpress
|
|
5
|
+
* ✔ binderror
|
|
6
|
+
* ✔ bindload
|
|
7
|
+
* ✘ fade-in
|
|
8
|
+
* ✔ webp
|
|
9
|
+
* ✘ lazy-load
|
|
10
|
+
* ✔ bindtap
|
|
11
|
+
* ✔ DEFAULT_SIZE
|
|
12
|
+
*/
|
|
13
|
+
import { useEffect, useMemo, useState, useRef, forwardRef, createElement } from 'react';
|
|
14
|
+
import { Image as RNImage, View } from 'react-native';
|
|
15
|
+
import { noop } from '@mpxjs/utils';
|
|
16
|
+
import { SvgCssUri } from 'react-native-svg/css';
|
|
17
|
+
import useInnerProps, { getCustomEvent } from './getInnerListeners';
|
|
18
|
+
import useNodesRef from './useNodesRef';
|
|
19
|
+
import { SVG_REGEXP, useLayout, useTransformStyle, renderImage, extendObject } from './utils';
|
|
20
|
+
const DEFAULT_IMAGE_WIDTH = 320;
|
|
21
|
+
const DEFAULT_IMAGE_HEIGHT = 240;
|
|
22
|
+
const cropMode = [
|
|
23
|
+
'top',
|
|
24
|
+
'bottom',
|
|
25
|
+
'center',
|
|
26
|
+
'right',
|
|
27
|
+
'left',
|
|
28
|
+
'top left',
|
|
29
|
+
'top right',
|
|
30
|
+
'bottom left',
|
|
31
|
+
'bottom right'
|
|
32
|
+
];
|
|
33
|
+
const ModeMap = new Map([
|
|
34
|
+
['scaleToFill', 'stretch'],
|
|
35
|
+
['aspectFit', 'contain'],
|
|
36
|
+
['aspectFill', 'cover'],
|
|
37
|
+
['widthFix', 'stretch'],
|
|
38
|
+
['heightFix', 'stretch'],
|
|
39
|
+
...cropMode.map(mode => [mode, 'stretch'])
|
|
40
|
+
]);
|
|
41
|
+
const isNumber = (value) => typeof value === 'number';
|
|
42
|
+
const relativeCenteredSize = (viewSize, imageSize) => (viewSize - imageSize) / 2;
|
|
43
|
+
function noMeetCalcRule(isSvg, mode, viewWidth, viewHeight, ratio) {
|
|
44
|
+
const isMeetSize = viewWidth && viewHeight && ratio;
|
|
45
|
+
if (isSvg && !isMeetSize)
|
|
46
|
+
return true;
|
|
47
|
+
if (!isSvg && !['scaleToFill', 'aspectFit', 'aspectFill'].includes(mode) && !isMeetSize)
|
|
48
|
+
return true;
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
const Image = forwardRef((props, ref) => {
|
|
52
|
+
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;
|
|
53
|
+
const defaultStyle = {
|
|
54
|
+
width: DEFAULT_IMAGE_WIDTH,
|
|
55
|
+
height: DEFAULT_IMAGE_HEIGHT
|
|
56
|
+
};
|
|
57
|
+
const styleObj = extendObject({}, defaultStyle, style, { overflow: 'hidden' });
|
|
58
|
+
const state = useRef({});
|
|
59
|
+
const nodeRef = useRef(null);
|
|
60
|
+
useNodesRef(props, ref, nodeRef, {
|
|
61
|
+
defaultStyle
|
|
62
|
+
});
|
|
63
|
+
const isSvg = SVG_REGEXP.test(src);
|
|
64
|
+
const isWidthFixMode = mode === 'widthFix';
|
|
65
|
+
const isHeightFixMode = mode === 'heightFix';
|
|
66
|
+
const isCropMode = cropMode.includes(mode);
|
|
67
|
+
const isLayoutMode = isWidthFixMode || isHeightFixMode || isCropMode;
|
|
68
|
+
const resizeMode = ModeMap.get(mode) || 'stretch';
|
|
69
|
+
const onLayout = ({ nativeEvent: { layout: { width, height } } }) => {
|
|
70
|
+
state.current.viewWidth = width;
|
|
71
|
+
state.current.viewHeight = height;
|
|
72
|
+
if (state.current.imageWidth && state.current.imageHeight && state.current.ratio) {
|
|
73
|
+
setViewWidth(width);
|
|
74
|
+
setViewHeight(height);
|
|
75
|
+
setRatio(state.current.ratio);
|
|
76
|
+
setImageWidth(state.current.imageWidth);
|
|
77
|
+
setImageHeight(state.current.imageHeight);
|
|
78
|
+
state.current = {};
|
|
79
|
+
setLoaded(true);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const { normalStyle, hasSelfPercent, setWidth, setHeight } = useTransformStyle(styleObj, { enableVar, externalVarContext, parentFontSize, parentWidth, parentHeight });
|
|
83
|
+
const { layoutRef, layoutStyle, layoutProps } = useLayout({
|
|
84
|
+
props,
|
|
85
|
+
hasSelfPercent,
|
|
86
|
+
setWidth,
|
|
87
|
+
setHeight,
|
|
88
|
+
nodeRef,
|
|
89
|
+
onLayout: isLayoutMode ? onLayout : noop
|
|
90
|
+
});
|
|
91
|
+
const { width, height } = normalStyle;
|
|
92
|
+
const [viewWidth, setViewWidth] = useState(isNumber(width) ? width : 0);
|
|
93
|
+
const [viewHeight, setViewHeight] = useState(isNumber(height) ? height : 0);
|
|
94
|
+
const [imageWidth, setImageWidth] = useState(0);
|
|
95
|
+
const [imageHeight, setImageHeight] = useState(0);
|
|
96
|
+
const [ratio, setRatio] = useState(0);
|
|
97
|
+
const [loaded, setLoaded] = useState(!isLayoutMode);
|
|
98
|
+
const fixedHeight = useMemo(() => {
|
|
99
|
+
const fixed = viewWidth * ratio;
|
|
100
|
+
return !fixed ? viewHeight : fixed;
|
|
101
|
+
}, [ratio, viewWidth, viewHeight]);
|
|
102
|
+
const fixedWidth = useMemo(() => {
|
|
103
|
+
if (!ratio)
|
|
104
|
+
return viewWidth;
|
|
105
|
+
const fixed = viewHeight / ratio;
|
|
106
|
+
return !fixed ? viewWidth : fixed;
|
|
107
|
+
}, [ratio, viewWidth, viewHeight]);
|
|
108
|
+
const modeStyle = useMemo(() => {
|
|
109
|
+
if (noMeetCalcRule(isSvg, mode, viewWidth, viewHeight, ratio))
|
|
110
|
+
return {};
|
|
111
|
+
switch (mode) {
|
|
112
|
+
case 'scaleToFill':
|
|
113
|
+
case 'aspectFit':
|
|
114
|
+
if (isSvg) {
|
|
115
|
+
const scale = ratio <= 1
|
|
116
|
+
? imageWidth >= viewWidth ? viewWidth / imageWidth : imageWidth / viewWidth
|
|
117
|
+
: imageHeight >= viewHeight ? viewHeight / imageHeight : imageHeight / viewHeight;
|
|
118
|
+
return {
|
|
119
|
+
transform: [
|
|
120
|
+
{ scale },
|
|
121
|
+
ratio <= 1 ? { translateY: -(imageHeight * scale - viewHeight) / 2 / scale } : { translateX: -(imageWidth * scale - viewWidth) / 2 / scale }
|
|
122
|
+
]
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
return {};
|
|
126
|
+
case 'aspectFill':
|
|
127
|
+
if (isSvg) {
|
|
128
|
+
const scale = ratio >= 1
|
|
129
|
+
? imageWidth >= viewWidth ? viewWidth / imageWidth : imageWidth / viewWidth
|
|
130
|
+
: imageHeight >= viewHeight ? viewHeight / imageHeight : imageHeight / viewHeight;
|
|
131
|
+
return {
|
|
132
|
+
transform: [
|
|
133
|
+
{ scale },
|
|
134
|
+
ratio >= 1 ? { translateY: -(imageHeight * scale - viewHeight) / 2 / scale } : { translateX: -(imageWidth * scale - viewWidth) / 2 / scale }
|
|
135
|
+
]
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
return {};
|
|
139
|
+
case 'widthFix':
|
|
140
|
+
case 'heightFix':
|
|
141
|
+
if (isSvg) {
|
|
142
|
+
const scale = ratio >= 1
|
|
143
|
+
? imageWidth >= fixedWidth ? fixedWidth / imageWidth : imageWidth / fixedWidth
|
|
144
|
+
: imageHeight >= fixedHeight ? fixedHeight / imageHeight : imageHeight / fixedHeight;
|
|
145
|
+
return {
|
|
146
|
+
transform: [{ scale }]
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
return {};
|
|
150
|
+
case 'top':
|
|
151
|
+
return {
|
|
152
|
+
transform: [
|
|
153
|
+
{ translateX: relativeCenteredSize(viewWidth, imageWidth) }
|
|
154
|
+
]
|
|
155
|
+
};
|
|
156
|
+
case 'bottom':
|
|
157
|
+
return {
|
|
158
|
+
transform: [
|
|
159
|
+
{ translateY: viewHeight - imageHeight },
|
|
160
|
+
{ translateX: relativeCenteredSize(viewWidth, imageWidth) }
|
|
161
|
+
]
|
|
162
|
+
};
|
|
163
|
+
case 'center':
|
|
164
|
+
return {
|
|
165
|
+
transform: [
|
|
166
|
+
{ translateY: relativeCenteredSize(viewHeight, imageHeight) },
|
|
167
|
+
{ translateX: relativeCenteredSize(viewWidth, imageWidth) }
|
|
168
|
+
]
|
|
169
|
+
};
|
|
170
|
+
case 'left':
|
|
171
|
+
return {
|
|
172
|
+
transform: [
|
|
173
|
+
{ translateY: relativeCenteredSize(viewHeight, imageHeight) }
|
|
174
|
+
]
|
|
175
|
+
};
|
|
176
|
+
case 'right':
|
|
177
|
+
return {
|
|
178
|
+
transform: [
|
|
179
|
+
{ translateY: relativeCenteredSize(viewHeight, imageHeight) },
|
|
180
|
+
{ translateX: viewWidth - imageWidth }
|
|
181
|
+
]
|
|
182
|
+
};
|
|
183
|
+
case 'top left':
|
|
184
|
+
return {};
|
|
185
|
+
case 'top right':
|
|
186
|
+
return {
|
|
187
|
+
transform: [
|
|
188
|
+
{ translateX: viewWidth - imageWidth }
|
|
189
|
+
]
|
|
190
|
+
};
|
|
191
|
+
case 'bottom left':
|
|
192
|
+
return {
|
|
193
|
+
transform: [
|
|
194
|
+
{ translateY: viewHeight - imageHeight }
|
|
195
|
+
]
|
|
196
|
+
};
|
|
197
|
+
case 'bottom right':
|
|
198
|
+
return {
|
|
199
|
+
transform: [
|
|
200
|
+
{ translateY: viewHeight - imageHeight },
|
|
201
|
+
{ translateX: viewWidth - imageWidth }
|
|
202
|
+
]
|
|
203
|
+
};
|
|
204
|
+
default:
|
|
205
|
+
return {};
|
|
206
|
+
}
|
|
207
|
+
}, [isSvg, mode, viewWidth, viewHeight, imageWidth, imageHeight, ratio, fixedWidth, fixedHeight]);
|
|
208
|
+
const onSvgLoad = (evt) => {
|
|
209
|
+
const { width, height } = evt.nativeEvent.layout;
|
|
210
|
+
setRatio(!width ? 0 : height / width);
|
|
211
|
+
setImageWidth(width);
|
|
212
|
+
setImageHeight(height);
|
|
213
|
+
bindload && bindload(getCustomEvent('load', evt, {
|
|
214
|
+
detail: { width, height },
|
|
215
|
+
layoutRef
|
|
216
|
+
}, props));
|
|
217
|
+
};
|
|
218
|
+
const onSvgError = (evt) => {
|
|
219
|
+
binderror(getCustomEvent('error', evt, {
|
|
220
|
+
detail: { errMsg: evt?.message },
|
|
221
|
+
layoutRef
|
|
222
|
+
}, props));
|
|
223
|
+
};
|
|
224
|
+
const onImageLoad = (evt) => {
|
|
225
|
+
evt.persist();
|
|
226
|
+
RNImage.getSize(src, (width, height) => {
|
|
227
|
+
bindload(getCustomEvent('load', evt, {
|
|
228
|
+
detail: { width, height },
|
|
229
|
+
layoutRef
|
|
230
|
+
}, props));
|
|
231
|
+
});
|
|
232
|
+
};
|
|
233
|
+
const onImageError = (evt) => {
|
|
234
|
+
binderror(getCustomEvent('error', evt, {
|
|
235
|
+
detail: { errMsg: evt.nativeEvent.error },
|
|
236
|
+
layoutRef
|
|
237
|
+
}, props));
|
|
238
|
+
};
|
|
239
|
+
useEffect(() => {
|
|
240
|
+
if (!isSvg && isLayoutMode) {
|
|
241
|
+
RNImage.getSize(src, (width, height) => {
|
|
242
|
+
state.current.imageWidth = width;
|
|
243
|
+
state.current.imageHeight = height;
|
|
244
|
+
state.current.ratio = !width ? 0 : height / width;
|
|
245
|
+
if (isWidthFixMode
|
|
246
|
+
? state.current.viewWidth
|
|
247
|
+
: isHeightFixMode
|
|
248
|
+
? state.current.viewHeight
|
|
249
|
+
: state.current.viewWidth && state.current.viewHeight) {
|
|
250
|
+
state.current.viewWidth && setViewWidth(state.current.viewWidth);
|
|
251
|
+
state.current.viewHeight && setViewHeight(state.current.viewHeight);
|
|
252
|
+
setRatio(!width ? 0 : height / width);
|
|
253
|
+
setImageWidth(width);
|
|
254
|
+
setImageHeight(height);
|
|
255
|
+
state.current = {};
|
|
256
|
+
setLoaded(true);
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
}, [src, isSvg, isLayoutMode]);
|
|
261
|
+
const innerProps = useInnerProps(props, extendObject({
|
|
262
|
+
ref: nodeRef,
|
|
263
|
+
style: extendObject({}, normalStyle, layoutStyle, isHeightFixMode ? { width: fixedWidth } : {}, isWidthFixMode ? { height: fixedHeight } : {})
|
|
264
|
+
}, layoutProps), [
|
|
265
|
+
'src',
|
|
266
|
+
'mode',
|
|
267
|
+
'svg'
|
|
268
|
+
], {
|
|
269
|
+
layoutRef
|
|
270
|
+
});
|
|
271
|
+
return createElement(View, innerProps, isSvg
|
|
272
|
+
? createElement(SvgCssUri, {
|
|
273
|
+
uri: src,
|
|
274
|
+
onLayout: onSvgLoad,
|
|
275
|
+
onError: binderror && onSvgError,
|
|
276
|
+
style: extendObject({ transformOrigin: 'top left' }, modeStyle)
|
|
277
|
+
})
|
|
278
|
+
: loaded && renderImage({
|
|
279
|
+
source: { uri: src },
|
|
280
|
+
resizeMode: resizeMode,
|
|
281
|
+
onLoad: bindload && onImageLoad,
|
|
282
|
+
onError: binderror && onImageError,
|
|
283
|
+
style: extendObject({
|
|
284
|
+
transformOrigin: 'top left',
|
|
285
|
+
width: isCropMode ? imageWidth : '100%',
|
|
286
|
+
height: isCropMode ? imageHeight : '100%'
|
|
287
|
+
}, isCropMode ? modeStyle : {})
|
|
288
|
+
}, enableFastImage));
|
|
289
|
+
});
|
|
290
|
+
Image.displayName = 'mpx-image';
|
|
291
|
+
export default Image;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* ✔ cursor-color
|
|
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
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
* ✘ bind:keyboardcompositionend
|
|
38
38
|
* ✘ bind:onkeyboardheightchange
|
|
39
39
|
*/
|
|
40
|
-
import { forwardRef, useMemo, useRef, useState, useContext, useEffect } from 'react';
|
|
40
|
+
import { forwardRef, useMemo, useRef, useState, useContext, useEffect, createElement } from 'react';
|
|
41
41
|
import { Platform, TextInput } from 'react-native';
|
|
42
42
|
import { warn } from '@mpxjs/utils';
|
|
43
|
-
import { parseInlineStyle, useUpdateEffect, useTransformStyle, useLayout } from './utils';
|
|
43
|
+
import { parseInlineStyle, useUpdateEffect, useTransformStyle, useLayout, extendObject } from './utils';
|
|
44
44
|
import useInnerProps, { getCustomEvent } from './getInnerListeners';
|
|
45
45
|
import useNodesRef from './useNodesRef';
|
|
46
|
-
import { FormContext } from './context';
|
|
46
|
+
import { FormContext, KeyboardAvoidContext } from './context';
|
|
47
47
|
const keyboardTypeMap = {
|
|
48
48
|
text: 'default',
|
|
49
49
|
number: 'numeric',
|
|
@@ -54,10 +54,11 @@ const keyboardTypeMap = {
|
|
|
54
54
|
}) || ''
|
|
55
55
|
};
|
|
56
56
|
const Input = forwardRef((props, ref) => {
|
|
57
|
-
const { style = {}, type = 'text', value, password, 'placeholder-style': placeholderStyle, disabled, maxlength = 140, '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, bindinput, bindfocus, bindblur, bindconfirm, bindselectionchange,
|
|
57
|
+
const { style = {}, allowFontScaling = false, type = 'text', value, password, 'placeholder-style': placeholderStyle, disabled, maxlength = 140, '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,
|
|
58
58
|
// private
|
|
59
59
|
multiline, 'auto-height': autoHeight, bindlinechange } = props;
|
|
60
60
|
const formContext = useContext(FormContext);
|
|
61
|
+
const setKeyboardAvoidEnabled = useContext(KeyboardAvoidContext);
|
|
61
62
|
let formValuesMap;
|
|
62
63
|
if (formContext) {
|
|
63
64
|
formValuesMap = formContext.formValuesMap;
|
|
@@ -66,21 +67,19 @@ const Input = forwardRef((props, ref) => {
|
|
|
66
67
|
const defaultValue = type === 'number' && value ? value + '' : value;
|
|
67
68
|
const placeholderTextColor = parseInlineStyle(placeholderStyle)?.color;
|
|
68
69
|
const textAlignVertical = multiline ? 'top' : 'auto';
|
|
69
|
-
const tmpValue = useRef();
|
|
70
|
+
const tmpValue = useRef(defaultValue);
|
|
70
71
|
const cursorIndex = useRef(0);
|
|
71
72
|
const lineCount = useRef(0);
|
|
72
73
|
const [inputValue, setInputValue] = useState(defaultValue);
|
|
73
74
|
const [contentHeight, setContentHeight] = useState(0);
|
|
74
|
-
const styleObj = {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
...multiline && autoHeight && {
|
|
78
|
-
height: Math.max(style?.minHeight || 35, contentHeight)
|
|
79
|
-
}
|
|
80
|
-
};
|
|
75
|
+
const styleObj = extendObject({ padding: 0, backgroundColor: '#fff' }, style, multiline && autoHeight
|
|
76
|
+
? { minHeight: Math.max(style?.minHeight || 35, contentHeight) }
|
|
77
|
+
: {});
|
|
81
78
|
const { hasSelfPercent, normalStyle, setWidth, setHeight } = useTransformStyle(styleObj, { enableVar, externalVarContext, parentFontSize, parentWidth, parentHeight });
|
|
82
79
|
const nodeRef = useRef(null);
|
|
83
|
-
useNodesRef(props, ref, nodeRef
|
|
80
|
+
useNodesRef(props, ref, nodeRef, {
|
|
81
|
+
style: normalStyle
|
|
82
|
+
});
|
|
84
83
|
const { layoutRef, layoutStyle, layoutProps } = useLayout({ props, hasSelfPercent, setWidth, setHeight, nodeRef });
|
|
85
84
|
useEffect(() => {
|
|
86
85
|
if (inputValue !== value) {
|
|
@@ -203,6 +202,9 @@ const Input = forwardRef((props, ref) => {
|
|
|
203
202
|
}
|
|
204
203
|
};
|
|
205
204
|
}, []);
|
|
205
|
+
useEffect(() => {
|
|
206
|
+
setKeyboardAvoidEnabled?.(adjustPosition);
|
|
207
|
+
}, [adjustPosition]);
|
|
206
208
|
useUpdateEffect(() => {
|
|
207
209
|
if (!nodeRef?.current) {
|
|
208
210
|
return;
|
|
@@ -211,26 +213,51 @@ const Input = forwardRef((props, ref) => {
|
|
|
211
213
|
? nodeRef.current?.focus()
|
|
212
214
|
: nodeRef.current?.blur();
|
|
213
215
|
}, [focus]);
|
|
214
|
-
const
|
|
215
|
-
const innerProps = useInnerProps(props, {
|
|
216
|
+
const innerProps = useInnerProps(props, extendObject({
|
|
216
217
|
ref: nodeRef,
|
|
217
|
-
style: {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
218
|
+
style: extendObject({}, normalStyle, layoutStyle),
|
|
219
|
+
allowFontScaling,
|
|
220
|
+
keyboardType: keyboardType,
|
|
221
|
+
secureTextEntry: !!password,
|
|
222
|
+
defaultValue: defaultValue,
|
|
223
|
+
value: inputValue,
|
|
224
|
+
maxLength: maxlength === -1 ? undefined : maxlength,
|
|
225
|
+
editable: !disabled,
|
|
226
|
+
autoFocus: !!autoFocus || !!focus,
|
|
227
|
+
returnKeyType: confirmType,
|
|
228
|
+
selection: selection,
|
|
229
|
+
selectionColor: cursorColor,
|
|
230
|
+
blurOnSubmit: !multiline && !confirmHold,
|
|
231
|
+
underlineColorAndroid: 'rgba(0,0,0,0)',
|
|
232
|
+
textAlignVertical: textAlignVertical,
|
|
233
|
+
placeholderTextColor: placeholderTextColor,
|
|
234
|
+
multiline: !!multiline
|
|
235
|
+
}, layoutProps, {
|
|
225
236
|
onFocus: bindfocus && onInputFocus,
|
|
226
237
|
onBlur: bindblur && onInputBlur,
|
|
227
238
|
onKeyPress: bindconfirm && onKeyPress,
|
|
228
239
|
onSubmitEditing: bindconfirm && multiline && onSubmitEditing,
|
|
229
|
-
onSelectionChange: bindselectionchange && onSelectionChange
|
|
230
|
-
|
|
240
|
+
onSelectionChange: bindselectionchange && onSelectionChange,
|
|
241
|
+
onTextInput: onTextInput,
|
|
242
|
+
onChange: onChange,
|
|
243
|
+
onContentSizeChange: onContentSizeChange
|
|
244
|
+
}), [
|
|
245
|
+
'type',
|
|
246
|
+
'password',
|
|
247
|
+
'placeholder-style',
|
|
248
|
+
'disabled',
|
|
249
|
+
'auto-focus',
|
|
250
|
+
'focus',
|
|
251
|
+
'confirm-type',
|
|
252
|
+
'confirm-hold',
|
|
253
|
+
'cursor',
|
|
254
|
+
'cursor-color',
|
|
255
|
+
'selection-start',
|
|
256
|
+
'selection-end'
|
|
257
|
+
], {
|
|
231
258
|
layoutRef
|
|
232
259
|
});
|
|
233
|
-
return (
|
|
260
|
+
return createElement(TextInput, innerProps);
|
|
234
261
|
});
|
|
235
262
|
Input.displayName = 'MpxInput';
|
|
236
263
|
export default Input;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ✘ for
|
|
3
3
|
*/
|
|
4
|
-
import { useRef, forwardRef, useCallback } from 'react';
|
|
4
|
+
import { useRef, forwardRef, useCallback, createElement } from 'react';
|
|
5
5
|
import { View } from 'react-native';
|
|
6
6
|
import { noop, warn } from '@mpxjs/utils';
|
|
7
7
|
import useInnerProps, { getCustomEvent } from './getInnerListeners';
|
|
8
8
|
import useNodesRef from './useNodesRef';
|
|
9
|
-
import { splitProps, splitStyle, useLayout, useTransformStyle, wrapChildren } from './utils';
|
|
9
|
+
import { splitProps, splitStyle, useLayout, useTransformStyle, wrapChildren, extendObject } from './utils';
|
|
10
10
|
import { LabelContext } from './context';
|
|
11
11
|
const Label = forwardRef((labelProps, ref) => {
|
|
12
12
|
const { textProps, innerProps: props = {} } = splitProps(labelProps);
|
|
@@ -16,15 +16,12 @@ const Label = forwardRef((labelProps, ref) => {
|
|
|
16
16
|
const defaultStyle = {
|
|
17
17
|
flexDirection: 'row'
|
|
18
18
|
};
|
|
19
|
-
const styleObj = {
|
|
20
|
-
...defaultStyle,
|
|
21
|
-
...style
|
|
22
|
-
};
|
|
19
|
+
const styleObj = extendObject({}, defaultStyle, style);
|
|
23
20
|
const { hasSelfPercent, normalStyle, hasVarDec, varContextRef, setWidth, setHeight } = useTransformStyle(styleObj, { enableVar, externalVarContext, parentFontSize, parentWidth, parentHeight });
|
|
24
21
|
const nodeRef = useRef(null);
|
|
25
|
-
useNodesRef(props, ref, nodeRef, {
|
|
22
|
+
useNodesRef(props, ref, nodeRef, { style: normalStyle });
|
|
26
23
|
const { layoutRef, layoutStyle, layoutProps } = useLayout({ props, hasSelfPercent, setWidth, setHeight, nodeRef });
|
|
27
|
-
const { textStyle, backgroundStyle, innerStyle } = splitStyle(normalStyle);
|
|
24
|
+
const { textStyle, backgroundStyle, innerStyle = {} } = splitStyle(normalStyle);
|
|
28
25
|
if (backgroundStyle) {
|
|
29
26
|
warn('Label does not support background image-related styles!');
|
|
30
27
|
}
|
|
@@ -36,24 +33,20 @@ const Label = forwardRef((labelProps, ref) => {
|
|
|
36
33
|
bindtap && bindtap(getCustomEvent('tap', evt, { layoutRef }, { props: propsRef.current }));
|
|
37
34
|
contextRef.current.triggerChange(evt);
|
|
38
35
|
}, []);
|
|
39
|
-
const innerProps = useInnerProps(props, {
|
|
36
|
+
const innerProps = useInnerProps(props, extendObject({
|
|
40
37
|
ref: nodeRef,
|
|
41
|
-
style: {
|
|
42
|
-
|
|
38
|
+
style: extendObject({}, innerStyle, layoutStyle)
|
|
39
|
+
}, layoutProps, {
|
|
43
40
|
bindtap: onTap
|
|
44
|
-
}, [], {
|
|
41
|
+
}), [], {
|
|
45
42
|
layoutRef
|
|
46
43
|
});
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
textProps
|
|
54
|
-
})}
|
|
55
|
-
</LabelContext.Provider>
|
|
56
|
-
</View>;
|
|
44
|
+
return createElement(View, innerProps, createElement(LabelContext.Provider, { value: contextRef }, wrapChildren(props, {
|
|
45
|
+
hasVarDec,
|
|
46
|
+
varContext: varContextRef.current,
|
|
47
|
+
textStyle,
|
|
48
|
+
textProps
|
|
49
|
+
})));
|
|
57
50
|
});
|
|
58
51
|
Label.displayName = 'MpxLabel';
|
|
59
52
|
export default Label;
|
|
@@ -2,34 +2,31 @@
|
|
|
2
2
|
* ✘ scale-area
|
|
3
3
|
*/
|
|
4
4
|
import { View } from 'react-native';
|
|
5
|
-
import { forwardRef, useRef, useMemo } from 'react';
|
|
5
|
+
import { forwardRef, useRef, useMemo, createElement } from 'react';
|
|
6
6
|
import useNodesRef from './useNodesRef';
|
|
7
7
|
import useInnerProps from './getInnerListeners';
|
|
8
8
|
import { MovableAreaContext } from './context';
|
|
9
|
-
import { useTransformStyle, wrapChildren, useLayout } from './utils';
|
|
9
|
+
import { useTransformStyle, wrapChildren, useLayout, extendObject } from './utils';
|
|
10
10
|
const _MovableArea = forwardRef((props, ref) => {
|
|
11
11
|
const { style = {}, 'enable-var': enableVar, 'external-var-context': externalVarContext, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight } = props;
|
|
12
12
|
const { hasSelfPercent, normalStyle, hasVarDec, varContextRef, setWidth, setHeight } = useTransformStyle(style, { enableVar, externalVarContext, parentFontSize, parentWidth, parentHeight });
|
|
13
13
|
const movableViewRef = useRef(null);
|
|
14
|
-
useNodesRef(props, ref, movableViewRef
|
|
14
|
+
useNodesRef(props, ref, movableViewRef, {
|
|
15
|
+
style: normalStyle
|
|
16
|
+
});
|
|
15
17
|
const contextValue = useMemo(() => ({
|
|
16
18
|
height: normalStyle.height || 10,
|
|
17
19
|
width: normalStyle.width || 10
|
|
18
20
|
}), [normalStyle.width, normalStyle.height]);
|
|
19
21
|
const { layoutRef, layoutStyle, layoutProps } = useLayout({ props, hasSelfPercent, setWidth, setHeight, nodeRef: movableViewRef });
|
|
20
|
-
const innerProps = useInnerProps(props, {
|
|
21
|
-
style: { height: contextValue.height, width: contextValue.width, overflow: 'hidden',
|
|
22
|
-
ref: movableViewRef
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
hasVarDec,
|
|
29
|
-
varContext: varContextRef.current
|
|
30
|
-
})}
|
|
31
|
-
</View>
|
|
32
|
-
</MovableAreaContext.Provider>);
|
|
22
|
+
const innerProps = useInnerProps(props, extendObject({
|
|
23
|
+
style: extendObject({ height: contextValue.height, width: contextValue.width, overflow: 'hidden' }, normalStyle, layoutStyle),
|
|
24
|
+
ref: movableViewRef
|
|
25
|
+
}, layoutProps), [], { layoutRef });
|
|
26
|
+
return createElement(MovableAreaContext.Provider, { value: contextValue }, createElement(View, innerProps, wrapChildren(props, {
|
|
27
|
+
hasVarDec,
|
|
28
|
+
varContext: varContextRef.current
|
|
29
|
+
})));
|
|
33
30
|
});
|
|
34
31
|
_MovableArea.displayName = 'MpxMovableArea';
|
|
35
32
|
export default _MovableArea;
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
* ✔ htouchmove
|
|
18
18
|
* ✔ vtouchmove
|
|
19
19
|
*/
|
|
20
|
-
import { useEffect, forwardRef, useContext, useCallback, useRef, useMemo } from 'react';
|
|
20
|
+
import { useEffect, forwardRef, useContext, useCallback, useRef, useMemo, createElement } from 'react';
|
|
21
21
|
import { StyleSheet } from 'react-native';
|
|
22
22
|
import { getCustomEvent } from './getInnerListeners';
|
|
23
23
|
import useNodesRef from './useNodesRef';
|
|
24
24
|
import { MovableAreaContext } from './context';
|
|
25
|
-
import { useTransformStyle, splitProps, splitStyle, HIDDEN_STYLE, wrapChildren, flatGesture } from './utils';
|
|
25
|
+
import { useTransformStyle, splitProps, splitStyle, HIDDEN_STYLE, wrapChildren, flatGesture, extendObject } from './utils';
|
|
26
26
|
import { GestureDetector, Gesture } from 'react-native-gesture-handler';
|
|
27
27
|
import Animated, { useSharedValue, useAnimatedStyle, withDecay, runOnJS, runOnUI, useAnimatedReaction, withSpring } from 'react-native-reanimated';
|
|
28
28
|
const styles = StyleSheet.create({
|
|
@@ -64,7 +64,7 @@ const _MovableView = forwardRef((movableViewProps, ref) => {
|
|
|
64
64
|
const waitForHandlers = flatGesture(waitFor);
|
|
65
65
|
const nodeRef = useRef(null);
|
|
66
66
|
useNodesRef(props, ref, nodeRef, {
|
|
67
|
-
|
|
67
|
+
style: normalStyle,
|
|
68
68
|
gestureRef: movableGestureRef
|
|
69
69
|
});
|
|
70
70
|
const hasSimultaneousHandlersChanged = prevSimultaneousHandlersRef.current.length !== (originSimultaneousHandlers?.length || 0) ||
|
|
@@ -416,16 +416,16 @@ const _MovableView = forwardRef((movableViewProps, ref) => {
|
|
|
416
416
|
};
|
|
417
417
|
const catchEventHandlers = injectCatchEvent(props);
|
|
418
418
|
const layoutStyle = !hasLayoutRef.current && hasSelfPercent ? HIDDEN_STYLE : {};
|
|
419
|
-
return (
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
419
|
+
return createElement(GestureDetector, { gesture: gesture }, createElement(Animated.View, extendObject({
|
|
420
|
+
ref: nodeRef,
|
|
421
|
+
onLayout: onLayout,
|
|
422
|
+
style: [innerStyle, animatedStyles, layoutStyle]
|
|
423
|
+
}, catchEventHandlers), wrapChildren(props, {
|
|
424
|
+
hasVarDec,
|
|
425
|
+
varContext: varContextRef.current,
|
|
426
|
+
textStyle,
|
|
427
|
+
textProps
|
|
428
|
+
})));
|
|
429
429
|
});
|
|
430
430
|
_MovableView.displayName = 'MpxMovableView';
|
|
431
431
|
export default _MovableView;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback, forwardRef } from 'react';
|
|
1
|
+
import { useCallback, forwardRef, createElement } from 'react';
|
|
2
2
|
import useInnerProps from './getInnerListeners';
|
|
3
3
|
import { redirectTo, navigateTo, navigateBack, reLaunch, switchTab } from '@mpxjs/api-proxy';
|
|
4
4
|
import MpxView from './mpx-view';
|
|
@@ -27,9 +27,7 @@ const _Navigator = forwardRef((props, ref) => {
|
|
|
27
27
|
ref,
|
|
28
28
|
bindtap: handleClick
|
|
29
29
|
});
|
|
30
|
-
return (
|
|
31
|
-
{children}
|
|
32
|
-
</MpxView>);
|
|
30
|
+
return createElement(MpxView, innerProps, children);
|
|
33
31
|
});
|
|
34
32
|
_Navigator.displayName = 'MpxNavigator';
|
|
35
33
|
export default _Navigator;
|
|
@@ -23,12 +23,15 @@ function dateToString(date, fields = 'day') {
|
|
|
23
23
|
return ret;
|
|
24
24
|
}
|
|
25
25
|
const _DatePicker = forwardRef((props, ref) => {
|
|
26
|
-
const { children, start = '1970-01-01', end = '2999-01-01', value, bindchange, bindcancel, disabled, fields } = props;
|
|
26
|
+
const { children, start = '1970-01-01', end = '2999-01-01', value, bindchange, bindcancel, disabled, fields, style } = props;
|
|
27
27
|
const [datevalue, setDateValue] = useState(value);
|
|
28
28
|
// 存储layout布局信息
|
|
29
29
|
const layoutRef = useRef({});
|
|
30
30
|
const viewRef = useRef(null);
|
|
31
|
-
|
|
31
|
+
const nodeRef = useRef(null);
|
|
32
|
+
useNodesRef(props, ref, nodeRef, {
|
|
33
|
+
style
|
|
34
|
+
});
|
|
32
35
|
useEffect(() => {
|
|
33
36
|
value && setDateValue(value);
|
|
34
37
|
}, [value]);
|
|
@@ -48,6 +51,7 @@ const _DatePicker = forwardRef((props, ref) => {
|
|
|
48
51
|
});
|
|
49
52
|
};
|
|
50
53
|
const dateProps = {
|
|
54
|
+
ref: nodeRef,
|
|
51
55
|
precision: fields,
|
|
52
56
|
value: formatTimeStr(datevalue),
|
|
53
57
|
minDate: formatTimeStr(start),
|
|
@@ -28,10 +28,12 @@ import { FormContext } from '../context';
|
|
|
28
28
|
* ✘ bindcolumnchange
|
|
29
29
|
*/
|
|
30
30
|
const _Picker = forwardRef((props, ref) => {
|
|
31
|
-
const { mode = 'selector', value, bindcancel, bindchange, children, bindcolumnchange } = props;
|
|
31
|
+
const { mode = 'selector', value, bindcancel, bindchange, children, bindcolumnchange, style } = props;
|
|
32
32
|
const innerLayout = useRef({});
|
|
33
33
|
const nodeRef = useRef(null);
|
|
34
|
-
useNodesRef(props, ref, nodeRef, {
|
|
34
|
+
useNodesRef(props, ref, nodeRef, {
|
|
35
|
+
style
|
|
36
|
+
});
|
|
35
37
|
const innerProps = useInnerProps(props, {
|
|
36
38
|
ref: nodeRef
|
|
37
39
|
}, [], { layoutRef: innerLayout });
|
|
@@ -78,7 +80,7 @@ const _Picker = forwardRef((props, ref) => {
|
|
|
78
80
|
bindcolumnchange && bindcolumnchange(eventData);
|
|
79
81
|
};
|
|
80
82
|
const commonProps = {
|
|
81
|
-
...
|
|
83
|
+
...innerProps,
|
|
82
84
|
mode,
|
|
83
85
|
children,
|
|
84
86
|
bindchange: onChange,
|