@ray-js/components 1.4.0-alpha.3 → 1.4.0-alpha.4
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/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.js +3 -3
- package/lib/Camera/Camera.thing.js +1 -3
- 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/CoverView/CoverView.js +1 -3
- package/lib/CoverView/CoverView.thing.js +1 -3
- package/lib/CoverView/CoverView.wechat.js +0 -2
- 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/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.js +1 -1
- package/lib/Iframe/Iframe.js +3 -3
- package/lib/Iframe/Iframe.thing.js +1 -3
- 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 +6 -24
- package/lib/Input/props.js +1 -3
- package/lib/IpcPlayer/IpcPlayer.js +3 -3
- package/lib/IpcPlayer/IpcPlayer.thing.js +1 -3
- 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.js +3 -3
- package/lib/NativeVideo/NativeVideo.thing.js +1 -3
- package/lib/NativeVideo/NativeVideo.wechat.js +2 -2
- package/lib/PageContainer/PageContainer.js +12 -19
- package/lib/PageContainer/PageContainer.thing.js +0 -2
- package/lib/PageContainer/PageContainer.wechat.js +0 -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/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.js +24 -33
- package/lib/Swiper/Swiper.thing.js +18 -24
- package/lib/Swiper/Swiper.wechat.js +18 -24
- 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 +3 -9
- 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/index.js +1 -0
- package/lib/utils/handleProps.js +26 -40
- package/package.json +5 -5
package/lib/Icon/props.js
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
@@ -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,36 +44,12 @@ 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'时生效
|
50
50
|
* @default done
|
51
51
|
*/
|
52
52
|
confirmType?: 'send' | 'search' | 'next' | 'go' | 'done';
|
53
|
-
/**
|
54
|
-
* @description.en Start position of the cursor. This parameter is valid for automatic clustering and must be used with Selection End
|
55
|
-
* @description.zh 光标起始位置,自动聚集时有效,需与 selectionEnd 搭配使用
|
56
|
-
* @default -1
|
57
|
-
*/
|
58
|
-
selectionStart?: number;
|
59
|
-
/**
|
60
|
-
* @description.en End cursor position. This parameter is valid for automatic clustering and must be used with Selection Start
|
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
|
69
|
-
*/
|
70
|
-
cursor?: number;
|
71
53
|
/**
|
72
54
|
* @description.en Input events
|
73
55
|
* @description.zh 输入事件
|
package/lib/Input/props.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 IpcPlayer = () => {
|
4
5
|
return /*#__PURE__*/React.createElement("div", null, "web\u7AEF\u6682\u672A\u5B9E\u73B0");
|
5
6
|
};
|
6
|
-
|
7
7
|
export default IpcPlayer;
|
@@ -1,8 +1,6 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { IpcPlayer as RemaxIpcPlayer } from '@ray-js/adapter';
|
3
|
-
|
4
|
-
var IpcPlayer = function (props) {
|
3
|
+
const IpcPlayer = props => {
|
5
4
|
return /*#__PURE__*/React.createElement(RemaxIpcPlayer, props);
|
6
5
|
};
|
7
|
-
|
8
6
|
export default IpcPlayer;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import { View } from '@ray-js/components';
|
2
|
+
import { View } from '@ray-js/components';
|
3
3
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
4
5
|
function IpcPlayer() {
|
5
6
|
return /*#__PURE__*/React.createElement(View, null, "\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F\u7AEF\u6682\u672A\u5B9E\u73B0");
|
6
7
|
}
|
7
|
-
|
8
8
|
export default IpcPlayer;
|
package/lib/Label/Label.js
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
|
-
|
3
|
+
const _excluded = ["htmlFor"];
|
4
4
|
import * as React from 'react';
|
5
5
|
import handleProps from '../utils/handleProps';
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
const Label = props => {
|
7
|
+
const {
|
8
|
+
htmlFor
|
9
|
+
} = props,
|
10
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
11
|
+
// @ts-ignore
|
12
12
|
return /*#__PURE__*/React.createElement("v-label", _extends({
|
13
13
|
for: htmlFor
|
14
14
|
}, handleProps(restProps)));
|
15
15
|
};
|
16
|
-
|
17
16
|
export default Label;
|