@ray-js/components 1.4.0-alpha.1 → 1.4.0-alpha.11
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/Button/Button.js +1 -3
- package/lib/Button/Button.thing.js +15 -17
- package/lib/Button/Button.wechat.js +15 -17
- package/lib/Button/props.js +1 -1
- package/lib/Camera/Camera.d.ts +2 -1
- package/lib/Camera/Camera.js +3 -3
- package/lib/Camera/Camera.thing.js +1 -3
- package/lib/Camera/Camera.wechat.d.ts +2 -1
- package/lib/Camera/Camera.wechat.js +2 -2
- package/lib/Checkbox/Checkbox.js +1 -3
- package/lib/Checkbox/Checkbox.thing.js +8 -9
- package/lib/Checkbox/Checkbox.wechat.js +9 -10
- package/lib/CheckboxGroup/CheckboxGroup.js +15 -19
- package/lib/CheckboxGroup/CheckboxGroup.thing.js +12 -17
- package/lib/CheckboxGroup/CheckboxGroup.wechat.js +12 -17
- package/lib/CheckboxGroup/props.d.ts +1 -1
- package/lib/CoverView/CoverView.js +1 -3
- package/lib/CoverView/CoverView.thing.js +1 -3
- package/lib/CoverView/CoverView.wechat.d.ts +2 -1
- package/lib/CoverView/CoverView.wechat.js +0 -2
- package/lib/CoverView/props.d.ts +1 -1
- package/lib/CoverView/props.js +1 -1
- package/lib/Form/Form.js +12 -12
- package/lib/Form/Form.thing.js +1 -3
- package/lib/Form/Form.wechat.js +20 -25
- package/lib/Form/props.d.ts +1 -1
- package/lib/Icon/Icon.js +7 -7
- package/lib/Icon/Icon.thing.js +7 -7
- package/lib/Icon/Icon.wechat.js +7 -7
- package/lib/Icon/iconfont/iconfont.js +13 -20
- package/lib/Icon/props.d.ts +1 -1
- package/lib/Icon/props.js +1 -1
- package/lib/Iframe/Iframe.d.ts +2 -1
- package/lib/Iframe/Iframe.js +3 -3
- package/lib/Iframe/Iframe.thing.js +1 -3
- package/lib/Iframe/Iframe.wechat.d.ts +2 -1
- package/lib/Iframe/Iframe.wechat.js +3 -3
- package/lib/Image/Image.js +6 -8
- package/lib/Image/Image.thing.js +8 -10
- package/lib/Image/Image.wechat.js +26 -32
- package/lib/Input/Input.js +29 -26
- package/lib/Input/Input.thing.js +36 -36
- package/lib/Input/Input.wechat.js +47 -47
- package/lib/Input/props.d.ts +11 -21
- package/lib/Input/props.js +1 -3
- package/lib/IpcPlayer/IpcPlayer.d.ts +2 -1
- package/lib/IpcPlayer/IpcPlayer.js +3 -3
- package/lib/IpcPlayer/IpcPlayer.thing.js +1 -3
- package/lib/IpcPlayer/IpcPlayer.wechat.d.ts +2 -1
- package/lib/IpcPlayer/IpcPlayer.wechat.js +2 -2
- package/lib/Label/Label.js +7 -8
- package/lib/Label/Label.thing.js +8 -8
- package/lib/Label/Label.wechat.js +8 -8
- package/lib/Map/Map.js +1 -3
- package/lib/Map/Map.thing.js +1 -3
- package/lib/Map/Map.wechat.js +1 -3
- package/lib/Modal/index.js +4 -2
- package/lib/Modal/index.web.js +6 -4
- package/lib/MovableArea/MovableArea.js +5 -4
- package/lib/MovableArea/MovableArea.thing.js +1 -3
- package/lib/MovableArea/MovableArea.wechat.js +1 -3
- package/lib/MovableView/MovableView.js +12 -11
- package/lib/MovableView/MovableView.thing.js +1 -3
- package/lib/MovableView/MovableView.wechat.js +1 -3
- package/lib/NativeVideo/NativeVideo.d.ts +2 -1
- package/lib/NativeVideo/NativeVideo.js +3 -3
- package/lib/NativeVideo/NativeVideo.thing.js +1 -3
- package/lib/NativeVideo/NativeVideo.wechat.d.ts +2 -1
- package/lib/NativeVideo/NativeVideo.wechat.js +2 -2
- package/lib/PageContainer/PageContainer.js +12 -19
- package/lib/PageContainer/PageContainer.thing.d.ts +2 -1
- package/lib/PageContainer/PageContainer.thing.js +0 -2
- package/lib/PageContainer/PageContainer.wechat.d.ts +2 -1
- package/lib/PageContainer/PageContainer.wechat.js +0 -2
- package/lib/PageContainer/props.d.ts +2 -2
- package/lib/PageContainer/props.js +3 -3
- package/lib/Picker/Picker.js +23 -31
- package/lib/Picker/Picker.thing.js +26 -31
- package/lib/Picker/Picker.wechat.js +26 -31
- package/lib/PickerView/PickerView.js +23 -34
- package/lib/PickerView/PickerView.thing.js +16 -19
- package/lib/PickerView/PickerView.wechat.js +16 -19
- package/lib/PickerViewColumn/PickerViewColumn.js +4 -4
- package/lib/PickerViewColumn/PickerViewColumn.thing.js +6 -7
- package/lib/PickerViewColumn/PickerViewColumn.wechat.js +6 -7
- package/lib/Progress/Progress.js +1 -3
- package/lib/Progress/Progress.thing.js +6 -7
- package/lib/Progress/Progress.wechat.js +6 -7
- package/lib/Radio/Radio.js +1 -3
- package/lib/Radio/Radio.thing.js +8 -9
- package/lib/Radio/Radio.wechat.js +9 -10
- package/lib/RadioGroup/RadioGroup.js +12 -18
- package/lib/RadioGroup/RadioGroup.thing.js +15 -21
- package/lib/RadioGroup/RadioGroup.wechat.js +12 -17
- package/lib/RadioGroup/props.d.ts +1 -1
- package/lib/RichText/RichText.js +1 -1
- package/lib/RichText/RichText.thing.js +1 -3
- package/lib/RichText/RichText.wechat.js +1 -3
- package/lib/ScrollView/ScrollView.js +12 -13
- package/lib/ScrollView/ScrollView.thing.js +6 -7
- package/lib/ScrollView/ScrollView.wechat.js +6 -7
- package/lib/Slider/Slider.js +4 -8
- package/lib/Slider/Slider.thing.js +13 -14
- package/lib/Slider/Slider.wechat.js +14 -15
- package/lib/Slider/props.js +1 -1
- package/lib/Swiper/Swiper.d.ts +1 -1
- package/lib/Swiper/Swiper.js +24 -33
- package/lib/Swiper/Swiper.thing.d.ts +1 -1
- package/lib/Swiper/Swiper.thing.js +18 -24
- package/lib/Swiper/Swiper.wechat.d.ts +1 -1
- package/lib/Swiper/Swiper.wechat.js +18 -24
- package/lib/Swiper/props.d.ts +1 -1
- package/lib/Swiper/props.js +2 -2
- package/lib/SwiperItem/SwiperItem.js +4 -4
- package/lib/SwiperItem/SwiperItem.thing.js +8 -9
- package/lib/SwiperItem/SwiperItem.wechat.js +8 -9
- package/lib/Switch/Switch.js +5 -8
- package/lib/Switch/Switch.thing.js +12 -14
- package/lib/Switch/Switch.wechat.js +12 -14
- package/lib/Switch/props.js +1 -1
- package/lib/Text/Text.js +1 -3
- package/lib/Text/Text.thing.js +1 -3
- package/lib/Text/Text.wechat.js +20 -25
- package/lib/Textarea/Textarea.js +13 -24
- package/lib/Textarea/Textarea.thing.js +26 -30
- package/lib/Textarea/Textarea.wechat.js +26 -30
- package/lib/Textarea/props.d.ts +4 -10
- package/lib/View/View.js +29 -32
- package/lib/View/View.thing.js +34 -35
- package/lib/View/View.wechat.js +34 -35
- package/lib/View/props.js +1 -1
- package/lib/WebView/WebView.js +1 -3
- package/lib/WebView/WebView.thing.js +1 -3
- package/lib/WebView/WebView.wechat.js +1 -3
- package/lib/assets/icons.js +1 -1
- package/lib/core/index.js +4 -11
- package/lib/types/event.d.ts +1 -1
- package/lib/types/index.js +1 -0
- package/lib/utils/handleProps.js +26 -40
- package/package.json +25 -25
- package/lib/Modal/index.web.d.ts +0 -2
package/lib/Icon/props.d.ts
CHANGED
@@ -20,4 +20,4 @@ export interface IconProps extends BaseProps {
|
|
20
20
|
color?: string;
|
21
21
|
}
|
22
22
|
export declare const defaultIconProps: IconProps;
|
23
|
-
export
|
23
|
+
export type IconFontName = 'icon-warning' | 'icon-right' | 'icon-up' | 'icon-down' | 'icon-right-copy' | 'icon-right-copy1' | 'icon-a-cloudsunboltfill' | 'icon-a-cloudhailfill' | 'icon-a-cloudrainfill' | 'icon-deskclock' | 'icon-a-cloudsleetfill' | 'icon-a-arrowtrianglecapsulepath' | 'icon-a-cloudfogfill' | 'icon-a-clouddrizzlefill' | 'icon-a-cloudsunrainfill' | 'icon-a-crownfill' | 'icon-a-deskclockfill' | 'icon-a-envelopeopenfill' | 'icon-a-desktopcomputerandarrowdown' | 'icon-a-ferryfill' | 'icon-a-dropfill' | 'icon-a-cloudmoonfill' | 'icon-a-icloudandarrowdownfill' | 'icon-a-heartfill' | 'icon-a-icloudcirclefill' | 'icon-a-giftfill' | 'icon-a-handpointupleftfill' | 'icon-icon' | 'icon-a-exclamationmarkicloudfill' | 'icon-a-facesmilingfill' | 'icon-a-cloudsunfill' | 'icon-a-figurewalk' | 'icon-a-envelopebadge' | 'icon-a-locationnorthfill' | 'icon-a-minussquarefill' | 'icon-a-icloudslashfill' | 'icon-a-lockicloudfill' | 'icon-a-flamefill' | 'icon-left' | 'icon-a-linkicloudfill' | 'icon-a-micfill' | 'icon-icon-2' | 'icon-a-latch2casefill' | 'icon-a-exclamationmarkbubblefill' | 'icon-a-pausefill' | 'icon-a-paintbrushfill' | 'icon-a-moonfill' | 'icon-a-keyicloudfill' | 'icon-a-messagefill' | 'icon-a-envelopefill' | 'icon-a-moonstarsfill' | 'icon-a-icloudandarrowupfill' | 'icon-checkmark-3' | 'icon-a-locationcirclefill' | 'icon-a-forwardendaltfill' | 'icon-a-clockfill' | 'icon-bonjour' | 'icon-a-icloudcircle' | 'icon-a-leaffill' | 'icon-a-paintbrushpointedfill' | 'icon-a-cloudsnowfill' | 'icon-a-playfill' | 'icon-a-plussquarefill' | 'icon-a-minuscirclefill' | 'icon-a-personicloudfill' | 'icon-a-phonefill' | 'icon-a-pawprintfill' | 'icon-plus' | 'icon-a-scribblevariable' | 'icon-a-phoneandwaveformfill' | 'icon-a-phonedownfill' | 'icon-a-pluscirclefill' | 'icon-a-repeat1' | 'icon-a-printerfillandpaperfill' | 'icon-a-scrollfill' | 'icon-snow' | 'icon-a-speakerwave1fill' | 'icon-scissors' | 'icon-a-playrectanglefill' | 'icon-a-globeamericasfill' | 'icon-a-dotradiowavesleftandright' | 'icon-minus' | 'icon-a-stopfill' | 'icon-a-suitcasefill' | 'icon-a-sunrisefill' | 'icon-a-thermometersunfill' | 'icon-a-trainsidefrontcar' | 'icon-a-speakerwave3fill' | 'icon-a-cloudheavyrainfill' | 'icon-a-eyedropperhalffull' | 'icon-a-sunminfill' | 'icon-a-sunsetfill' | 'icon-a-timersquare' | 'icon-stopwatch' | 'icon-thermometer' | 'icon-repeat' | 'icon-a-stopwatchfill' | 'icon-a-sunmaxfill' | 'icon-a-icloudfill' | 'icon-a-tramfill' | 'icon-tornado' | 'icon-a-videoslashfill' | 'icon-personalhotspot' | 'icon-a-thermometersnowflake' | 'icon-a-sunhazefill' | 'icon-a-videofill' | 'icon-sparkles' | 'icon-a-facemaskfill' | 'icon-a-wave3backwardcirclefill' | 'icon-a-wave3leftcirclefill' | 'icon-a-wandandstarsinverse' | 'icon-a-wave3rightcirclefill' | 'icon-xmark' | 'icon-a-wave3right' | 'icon-a-waveformandmic' | 'icon-a-wifiexclamationmark' | 'icon-wifi' | 'icon-a-xmarkicloudfill' | 'icon-wind' | 'icon-timer' | 'icon-a-wrenchandscrewdriverfill' | 'icon-a-wave3forwardcirclefill' | 'icon-a-lockfill' | 'icon-a-wifislash' | 'icon-a-windsnow' | 'icon-a-wave3forward' | 'icon-cancel' | 'icon-a-arrowbackward' | 'icon-a-arrowdown' | 'icon-alarm' | 'icon-a-alarmfill' | 'icon-a-airplanedeparture' | 'icon-a-arrowlefttolinealt' | 'icon-a-arrowforward' | 'icon-airplane' | 'icon-a-arrow2squarepath' | 'icon-a-antennaradiowavesleftandright' | 'icon-a-arrowshapeturnuprightfill' | 'icon-a-arrowcounterclockwise' | 'icon-a-arrowturndownleft' | 'icon-a-arrowturnupleft' | 'icon-a-airplanearrival' | 'icon-a-boltfill' | 'icon-a-arrowturnrightup' | 'icon-a-arrowcounterclockwiseicloudfill' | 'icon-a-bellfill' | 'icon-a-arrowupanddownandarrowleftandright' | 'icon-a-beddoublefill' | 'icon-a-arrowshapeturnupleft2fill' | 'icon-a-arrowtrianglerightfillandlineverticalandarr' | 'icon-a-bolthorizontalicloudfill' | 'icon-a-boltheartfill' | 'icon-a-arrowupleftanddownrightandarrowuprightan' | 'icon-a-arrowclockwiseicloudfill' | 'icon-a-arrowupbackwardandarrowdownforward' | 'icon-a-arrowturndownright' | 'icon-bold' | 'icon-a-arrowleftarrowright' | 'icon-a-bolthorizontalfill' | 'icon-checkmark' | 'icon-a-arrowrighttolinealt' | 'icon-a-bubblerightfill' | 'icon-checkmark-2' | 'icon-clock' | 'icon-a-carfill' | 'icon-a-backwardendaltfill' | 'icon-checkmark-4' | 'icon-a-chevronright2' | 'icon-a-cloudboltrainfill' | 'icon-a-bolthorizontalcirclefill' | 'icon-a-chevronleft2' | 'icon-a-chevroncompactdown' | 'icon-a-briefcasefill' | 'icon-a-arrowturnupright' | 'icon-a-cloudboltfill' | 'icon-a-cloudfill' | 'icon-a-bubbleleftandbubblerightfill' | 'icon-a-bellbadgefill' | 'icon-checkmark-1' | 'icon-a-cloudmoonrainfill' | 'icon-a-chevroncompactright' | 'icon-a-crossfill' | 'icon-a-busfill' | 'icon-a-arrowturnleftup' | 'icon-a-cloudmoonboltfill' | 'icon-a-arrowtriangleleftfillandlineverticalandarro' | 'icon-a-checkmarkicloudfill';
|
package/lib/Icon/props.js
CHANGED
package/lib/Iframe/Iframe.d.ts
CHANGED
package/lib/Iframe/Iframe.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import React from 'react';
|
1
|
+
import React from 'react';
|
2
2
|
|
3
|
-
|
3
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
4
|
+
const Iframe = () => {
|
4
5
|
return /*#__PURE__*/React.createElement("div", null, "web \u7AEF\u6682\u672A\u5B9E\u73B0");
|
5
6
|
};
|
6
|
-
|
7
7
|
export default Iframe;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { View as RemaxView } from '@ray-core/wechat';
|
2
|
+
import { View as RemaxView } from '@ray-core/wechat';
|
3
3
|
|
4
|
-
|
4
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
5
|
+
const Iframe = () => {
|
5
6
|
return /*#__PURE__*/React.createElement(RemaxView, null, "wechat \u7AEF\u4E0D\u652F\u6301");
|
6
7
|
};
|
7
|
-
|
8
8
|
export default Iframe;
|
package/lib/Image/Image.js
CHANGED
@@ -3,26 +3,24 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
3
|
import * as React from 'react';
|
4
4
|
import { useEventListener } from 'ahooks';
|
5
5
|
import handleProps from '../utils/handleProps';
|
6
|
-
|
7
|
-
|
8
|
-
useEventListener('load',
|
6
|
+
const Image = /*#__PURE__*/React.forwardRef((props, ref) => {
|
7
|
+
const currentNode = ref || React.useRef(null);
|
8
|
+
useEventListener('load', e => {
|
9
9
|
var _props$onLoad;
|
10
|
-
|
11
10
|
(_props$onLoad = props.onLoad) === null || _props$onLoad === void 0 ? void 0 : _props$onLoad.call(props, _objectSpread(_objectSpread({
|
12
11
|
type: e.type
|
13
12
|
}, e.detail), {}, {
|
14
|
-
origin
|
13
|
+
origin
|
15
14
|
}));
|
16
15
|
}, {
|
17
16
|
target: currentNode
|
18
17
|
});
|
19
|
-
useEventListener('error',
|
18
|
+
useEventListener('error', e => {
|
20
19
|
var _props$onError;
|
21
|
-
|
22
20
|
(_props$onError = props.onError) === null || _props$onError === void 0 ? void 0 : _props$onError.call(props, _objectSpread(_objectSpread({
|
23
21
|
type: e.type
|
24
22
|
}, e.detail), {}, {
|
25
|
-
origin
|
23
|
+
origin
|
26
24
|
}));
|
27
25
|
}, {
|
28
26
|
target: currentNode
|
package/lib/Image/Image.thing.js
CHANGED
@@ -1,23 +1,21 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
|
-
|
3
|
+
const _excluded = ["style", "className", "mode"];
|
4
4
|
import clsx from 'clsx';
|
5
5
|
import * as React from 'react';
|
6
6
|
import { inlineStyle } from '@ray-js/framework-shared';
|
7
7
|
import { Image as RemaxImage } from '@ray-js/adapter';
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
className
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
8
|
+
const Image = props => {
|
9
|
+
const {
|
10
|
+
style,
|
11
|
+
className,
|
12
|
+
mode = 'scaleToFill'
|
13
|
+
} = props,
|
14
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
16
15
|
return /*#__PURE__*/React.createElement(RemaxImage, _extends({
|
17
16
|
style: inlineStyle(style),
|
18
17
|
className: clsx('ray-image', className),
|
19
18
|
mode: mode
|
20
19
|
}, restProps));
|
21
20
|
};
|
22
|
-
|
23
21
|
export default Image;
|
@@ -1,44 +1,39 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
3
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
4
|
-
|
3
|
+
const _excluded = ["style", "className", "onClick", "onLongClick", "onTouchCancel", "onTouchEnd", "onTouchMove", "onTouchStart", "onLoad", "onError", "mode"];
|
4
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
5
5
|
import clsx from 'clsx';
|
6
6
|
import * as React from 'react';
|
7
7
|
import { inlineStyle, useTouch } from '@ray-js/framework-shared';
|
8
8
|
import { Image as RemaxImage } from '@ray-core/wechat';
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
className
|
13
|
-
onClick
|
14
|
-
onLongClick
|
15
|
-
onTouchCancel
|
16
|
-
onTouchEnd
|
17
|
-
onTouchMove
|
18
|
-
onTouchStart
|
19
|
-
onLoad
|
20
|
-
onError
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
}),
|
33
|
-
_useTouch2 = _slicedToArray(_useTouch, 2),
|
34
|
-
touching = _useTouch2[0],
|
35
|
-
handlers = _useTouch2[1];
|
36
|
-
|
9
|
+
const Image = props => {
|
10
|
+
const {
|
11
|
+
style,
|
12
|
+
className,
|
13
|
+
onClick,
|
14
|
+
onLongClick,
|
15
|
+
onTouchCancel,
|
16
|
+
onTouchEnd,
|
17
|
+
onTouchMove,
|
18
|
+
onTouchStart,
|
19
|
+
onLoad,
|
20
|
+
onError,
|
21
|
+
mode = 'scaleToFill'
|
22
|
+
} = props,
|
23
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
24
|
+
const [touching, handlers] = useTouch({
|
25
|
+
onLongClick,
|
26
|
+
onTouchStart,
|
27
|
+
onTouchMove,
|
28
|
+
onTouchEnd,
|
29
|
+
onTouchCancel,
|
30
|
+
onClick
|
31
|
+
});
|
37
32
|
return /*#__PURE__*/React.createElement(RemaxImage, _extends({
|
38
33
|
style: inlineStyle(style),
|
39
34
|
className: clsx('ray-image', className),
|
40
35
|
mode: mode,
|
41
|
-
onLoad:
|
36
|
+
onLoad: e => {
|
42
37
|
onLoad === null || onLoad === void 0 ? void 0 : onLoad({
|
43
38
|
width: e.detail.width,
|
44
39
|
height: e.detail.height,
|
@@ -47,5 +42,4 @@ var Image = function (props) {
|
|
47
42
|
}
|
48
43
|
}, handlers, restProps));
|
49
44
|
};
|
50
|
-
|
51
45
|
export default Image;
|
package/lib/Input/Input.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
3
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
4
|
-
|
3
|
+
const _excluded = ["placeholderStyle", "className", "maxLength", "onBlur", "onFocus", "onConfirm"];
|
4
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
5
5
|
import * as React from 'react';
|
6
6
|
import clsx from 'clsx';
|
7
7
|
import { useEventListener } from 'ahooks';
|
@@ -9,21 +9,19 @@ import { inlineStyle, useStylesheet } from '@ray-js/framework-shared';
|
|
9
9
|
import { defaultInputProps } from './props';
|
10
10
|
import styles from './index.module.less';
|
11
11
|
import handleProps from '../utils/handleProps';
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
var currentNode = ref || React.useRef(null);
|
26
|
-
useEventListener('focus', function (e) {
|
12
|
+
const Input = /*#__PURE__*/React.forwardRef((props, ref) => {
|
13
|
+
const {
|
14
|
+
placeholderStyle,
|
15
|
+
className,
|
16
|
+
maxLength,
|
17
|
+
onBlur,
|
18
|
+
onFocus,
|
19
|
+
onConfirm
|
20
|
+
} = props,
|
21
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
22
|
+
const [placeholderStyleClassName] = useStylesheet(inlineStyle(placeholderStyle));
|
23
|
+
const currentNode = ref || React.useRef(null);
|
24
|
+
useEventListener('focus', e => {
|
27
25
|
onFocus === null || onFocus === void 0 ? void 0 : onFocus({
|
28
26
|
type: 'focus',
|
29
27
|
value: e.detail.value,
|
@@ -32,21 +30,25 @@ var Input = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
32
30
|
}, {
|
33
31
|
target: currentNode
|
34
32
|
});
|
35
|
-
useEventListener('blur',
|
36
|
-
|
33
|
+
useEventListener('blur', e => {
|
34
|
+
const {
|
35
|
+
value
|
36
|
+
} = e.target;
|
37
37
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
38
38
|
type: 'blur',
|
39
|
-
value
|
39
|
+
value,
|
40
40
|
origin: e
|
41
41
|
});
|
42
42
|
}, {
|
43
43
|
target: currentNode
|
44
44
|
});
|
45
|
-
useEventListener('confirm',
|
46
|
-
|
45
|
+
useEventListener('confirm', e => {
|
46
|
+
const {
|
47
|
+
value
|
48
|
+
} = e.target;
|
47
49
|
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm({
|
48
50
|
type: 'confirm',
|
49
|
-
value
|
51
|
+
value,
|
50
52
|
origin: e
|
51
53
|
});
|
52
54
|
}, {
|
@@ -59,11 +61,12 @@ var Input = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
59
61
|
maxlength: maxLength,
|
60
62
|
onInput: function (e) {
|
61
63
|
var _props$onInput;
|
62
|
-
|
63
|
-
|
64
|
+
const {
|
65
|
+
value
|
66
|
+
} = e.target;
|
64
67
|
(_props$onInput = props.onInput) === null || _props$onInput === void 0 ? void 0 : _props$onInput.call(props, {
|
65
68
|
type: 'input',
|
66
|
-
value
|
69
|
+
value,
|
67
70
|
origin: e
|
68
71
|
});
|
69
72
|
},
|
package/lib/Input/Input.thing.js
CHANGED
@@ -1,55 +1,52 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
3
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
4
|
-
|
3
|
+
const _excluded = ["name", "id", "className", "style", "disabled", "type", "value", "focus", "maxLength", "onBlur", "onConfirm", "onFocus", "onInput", "password", "placeholder", "placeholderStyle"];
|
4
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
5
5
|
import * as React from 'react';
|
6
6
|
import clsx from 'clsx';
|
7
7
|
import { Input as RemaxInput } from '@ray-js/adapter';
|
8
8
|
import { inlineStyle } from '@ray-js/framework-shared';
|
9
9
|
import { nextFrame } from '../core';
|
10
10
|
import styles from './index.module.less';
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
type =
|
19
|
-
value
|
20
|
-
focus
|
21
|
-
maxLength
|
22
|
-
onBlur
|
23
|
-
onConfirm
|
24
|
-
onFocus
|
25
|
-
onInput
|
26
|
-
password
|
27
|
-
placeholder
|
28
|
-
placeholderStyle
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
setInternalValue = _React$useState2[1];
|
35
|
-
|
36
|
-
var bufferValue = React.useRef(value);
|
37
|
-
React.useEffect(function () {
|
11
|
+
const Input = /*#__PURE__*/React.forwardRef((props, ref) => {
|
12
|
+
const {
|
13
|
+
name,
|
14
|
+
id,
|
15
|
+
className,
|
16
|
+
style,
|
17
|
+
disabled,
|
18
|
+
type = 'text',
|
19
|
+
value,
|
20
|
+
focus,
|
21
|
+
maxLength,
|
22
|
+
onBlur,
|
23
|
+
onConfirm,
|
24
|
+
onFocus,
|
25
|
+
onInput,
|
26
|
+
password,
|
27
|
+
placeholder,
|
28
|
+
placeholderStyle
|
29
|
+
} = props,
|
30
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
31
|
+
const [internalValue, setInternalValue] = React.useState(value);
|
32
|
+
const bufferValue = React.useRef(value);
|
33
|
+
React.useEffect(() => {
|
38
34
|
if (value !== bufferValue.current) {
|
39
35
|
// HACK: 避免重复设置相同 value 不渲染的问题
|
40
36
|
setInternalValue(bufferValue.current);
|
41
|
-
nextFrame(1).then(
|
37
|
+
nextFrame(1).then(() => {
|
42
38
|
bufferValue.current = value;
|
43
39
|
setInternalValue(value);
|
44
40
|
});
|
45
41
|
}
|
46
42
|
}, [value]);
|
47
|
-
|
43
|
+
const selection = focus ? {
|
48
44
|
selectionStart: (internalValue === null || internalValue === void 0 ? void 0 : internalValue.length) || -1,
|
49
45
|
selectionEnd: (internalValue === null || internalValue === void 0 ? void 0 : internalValue.length) || -1
|
50
46
|
} : undefined;
|
51
47
|
return /*#__PURE__*/React.createElement(RemaxInput, _extends({
|
52
|
-
name: name
|
48
|
+
name: name
|
49
|
+
//@ts-ignore
|
53
50
|
,
|
54
51
|
ref: ref,
|
55
52
|
id: id,
|
@@ -63,16 +60,19 @@ var Input = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
63
60
|
placeholderStyle: inlineStyle(placeholderStyle),
|
64
61
|
maxlength: maxLength,
|
65
62
|
onInput: function (event) {
|
66
|
-
|
67
|
-
|
63
|
+
const {
|
64
|
+
value
|
65
|
+
} = event.detail;
|
66
|
+
// 内部 value 管控
|
68
67
|
bufferValue.current = value;
|
69
68
|
event.value = value;
|
70
69
|
onInput === null || onInput === void 0 ? void 0 : onInput(event);
|
71
70
|
},
|
72
71
|
onBlur: onBlur,
|
73
72
|
onConfirm: function (event) {
|
74
|
-
|
75
|
-
|
73
|
+
const {
|
74
|
+
value = ''
|
75
|
+
} = event.detail;
|
76
76
|
setInternalValue(value);
|
77
77
|
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm(event);
|
78
78
|
},
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
3
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
4
|
-
|
3
|
+
const _excluded = ["name", "id", "className", "style", "disabled", "type", "value", "focus", "maxLength", "onBlur", "onConfirm", "onFocus", "onInput", "password", "placeholder", "placeholderStyle"];
|
4
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
5
5
|
import * as React from 'react';
|
6
6
|
import clsx from 'clsx';
|
7
7
|
import { Input as RemaxInput } from '@ray-core/wechat';
|
@@ -9,48 +9,45 @@ import { inlineStyle } from '@ray-js/framework-shared';
|
|
9
9
|
import { defaultInputProps } from './props';
|
10
10
|
import { nextFrame } from '../core';
|
11
11
|
import styles from './index.module.less';
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
type =
|
20
|
-
value
|
21
|
-
focus
|
22
|
-
maxLength
|
23
|
-
onBlur
|
24
|
-
onConfirm
|
25
|
-
onFocus
|
26
|
-
onInput
|
27
|
-
password
|
28
|
-
placeholder
|
29
|
-
placeholderStyle
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
setInternalValue = _React$useState2[1];
|
36
|
-
|
37
|
-
var bufferValue = React.useRef(value);
|
38
|
-
React.useEffect(function () {
|
12
|
+
const Input = /*#__PURE__*/React.forwardRef((props, ref) => {
|
13
|
+
const {
|
14
|
+
name,
|
15
|
+
id,
|
16
|
+
className,
|
17
|
+
style,
|
18
|
+
disabled,
|
19
|
+
type = 'text',
|
20
|
+
value,
|
21
|
+
focus,
|
22
|
+
maxLength,
|
23
|
+
onBlur,
|
24
|
+
onConfirm,
|
25
|
+
onFocus,
|
26
|
+
onInput,
|
27
|
+
password,
|
28
|
+
placeholder,
|
29
|
+
placeholderStyle
|
30
|
+
} = props,
|
31
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
32
|
+
const [internalValue, setInternalValue] = React.useState(value);
|
33
|
+
const bufferValue = React.useRef(value);
|
34
|
+
React.useEffect(() => {
|
39
35
|
if (value !== bufferValue.current) {
|
40
36
|
// HACK: 避免重复设置相同 value 不渲染的问题
|
41
37
|
setInternalValue(bufferValue.current);
|
42
|
-
nextFrame(1).then(
|
38
|
+
nextFrame(1).then(() => {
|
43
39
|
bufferValue.current = value;
|
44
40
|
setInternalValue(value);
|
45
41
|
});
|
46
42
|
}
|
47
43
|
}, [value]);
|
48
|
-
|
44
|
+
const selection = focus ? {
|
49
45
|
selectionStart: (internalValue === null || internalValue === void 0 ? void 0 : internalValue.length) || -1,
|
50
46
|
selectionEnd: (internalValue === null || internalValue === void 0 ? void 0 : internalValue.length) || -1
|
51
47
|
} : undefined;
|
52
48
|
return /*#__PURE__*/React.createElement(RemaxInput, _extends({
|
53
|
-
name: name
|
49
|
+
name: name
|
50
|
+
//@ts-ignore
|
54
51
|
,
|
55
52
|
ref: ref,
|
56
53
|
id: id,
|
@@ -64,41 +61,44 @@ var Input = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
64
61
|
placeholderStyle: inlineStyle(placeholderStyle),
|
65
62
|
maxlength: maxLength,
|
66
63
|
onInput: function (event) {
|
67
|
-
|
68
|
-
|
64
|
+
const {
|
65
|
+
value
|
66
|
+
} = event.detail;
|
67
|
+
// 内部 value 管控
|
69
68
|
bufferValue.current = value;
|
70
69
|
onInput === null || onInput === void 0 ? void 0 : onInput({
|
71
70
|
type: 'input',
|
72
|
-
value
|
71
|
+
value,
|
73
72
|
origin: event
|
74
73
|
});
|
75
74
|
},
|
76
75
|
onBlur: function (event) {
|
77
|
-
|
78
|
-
|
76
|
+
const {
|
77
|
+
value = ''
|
78
|
+
} = event.detail;
|
79
79
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
80
80
|
type: 'blur',
|
81
|
-
value
|
81
|
+
value,
|
82
82
|
origin: event
|
83
83
|
});
|
84
84
|
},
|
85
85
|
onConfirm: function (event) {
|
86
|
-
|
87
|
-
|
86
|
+
const {
|
87
|
+
value = ''
|
88
|
+
} = event.detail;
|
88
89
|
setInternalValue(value);
|
89
90
|
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm(event);
|
90
91
|
},
|
91
92
|
onFocus: function (event) {
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
height = _event$detail$height === void 0 ? 0 : _event$detail$height;
|
93
|
+
const {
|
94
|
+
value = '',
|
95
|
+
height = 0
|
96
|
+
} = event.detail;
|
97
97
|
setInternalValue(value);
|
98
98
|
onFocus === null || onFocus === void 0 ? void 0 : onFocus({
|
99
99
|
type: 'focus',
|
100
|
-
value
|
101
|
-
height
|
100
|
+
value,
|
101
|
+
height,
|
102
102
|
origin: event
|
103
103
|
});
|
104
104
|
},
|
package/lib/Input/props.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { BaseProps } from '../types';
|
2
2
|
import { GenericEvent as WxEvent } from '@ray-core/wechat';
|
3
|
-
export
|
3
|
+
export type InputType = 'text' | 'number' | 'digit' | 'idcard';
|
4
4
|
export interface InputProps extends BaseProps {
|
5
5
|
/**
|
6
6
|
* @description.en content
|
@@ -26,6 +26,12 @@ export interface InputProps extends BaseProps {
|
|
26
26
|
* @default undefined
|
27
27
|
*/
|
28
28
|
placeholder?: string;
|
29
|
+
/**
|
30
|
+
* @description.en placeholder
|
31
|
+
* @description.zh 占位符的样式
|
32
|
+
* @default undefined
|
33
|
+
*/
|
34
|
+
placeholderStyle?: string;
|
29
35
|
/**
|
30
36
|
* @description.en disabled
|
31
37
|
* @description.zh 是否禁用
|
@@ -38,12 +44,6 @@ export interface InputProps extends BaseProps {
|
|
38
44
|
* @default undefined
|
39
45
|
*/
|
40
46
|
maxLength?: number;
|
41
|
-
/**
|
42
|
-
* @description.en 获Get focus取焦点
|
43
|
-
* @description.zh 获取焦点
|
44
|
-
* @default false
|
45
|
-
*/
|
46
|
-
focus?: boolean;
|
47
47
|
/**
|
48
48
|
* @description.en Set the text of the button in the lower right corner of the keyboard, effective only when type='text'
|
49
49
|
* @description.zh 设置键盘右下角按钮的文字,仅在type='text'时生效
|
@@ -51,23 +51,13 @@ export interface InputProps extends BaseProps {
|
|
51
51
|
*/
|
52
52
|
confirmType?: 'send' | 'search' | 'next' | 'go' | 'done';
|
53
53
|
/**
|
54
|
-
* @description
|
55
|
-
* @description.zh 光标起始位置,自动聚集时有效,需与 selectionEnd 搭配使用
|
56
|
-
* @default -1
|
54
|
+
* @description 输入框内容左侧内容缩进,仅在涂鸦小程序有效
|
57
55
|
*/
|
58
|
-
|
56
|
+
indentStart?: string | number;
|
59
57
|
/**
|
60
|
-
* @description
|
61
|
-
* @description.zh 光标结束位置,自动聚集时有效,需与 selectionStart 搭配使用
|
62
|
-
* @default -1
|
63
|
-
*/
|
64
|
-
selectionEnd?: number;
|
65
|
-
/**
|
66
|
-
* @description.en Specifies the cursor position for focus
|
67
|
-
* @description.zh 指定 focus 时的光标位置
|
68
|
-
* @default false
|
58
|
+
* @description 输入框内容右侧内容缩进,仅在涂鸦小程序有效
|
69
59
|
*/
|
70
|
-
|
60
|
+
indentEnd?: string | number;
|
71
61
|
/**
|
72
62
|
* @description.en Input events
|
73
63
|
* @description.zh 输入事件
|