@ray-js/components 1.4.0-alpha.0 → 1.4.0-alpha.10
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/LICENSE.md +0 -9
- package/lib/Modal/index.web.d.ts +0 -2
@@ -1,34 +1,29 @@
|
|
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
|
-
|
5
|
-
import "core-js/modules/
|
3
|
+
const _excluded = ["id", "style", "className", "current", "dataSource", "onAfterChange", "onChange", "renderItem", "children"];
|
4
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
6
5
|
import clsx from 'clsx';
|
7
6
|
import * as React from 'react';
|
8
7
|
import { inlineStyle } from '@ray-js/framework-shared';
|
9
8
|
import { Swiper as RemaxSwiper, SwiperItem as RemaxSwiperItem } from '@ray-core/wechat';
|
10
9
|
import { propsAlias } from '../core';
|
11
10
|
import { SwiperPropsAlias, defaultSwiperProps } from './props';
|
12
|
-
|
13
11
|
function Swiper(props) {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
var bufferCurrent = React.useRef(current);
|
31
|
-
React.useEffect(function () {
|
12
|
+
const {
|
13
|
+
id,
|
14
|
+
style,
|
15
|
+
className,
|
16
|
+
current,
|
17
|
+
dataSource,
|
18
|
+
onAfterChange,
|
19
|
+
onChange,
|
20
|
+
renderItem,
|
21
|
+
children
|
22
|
+
} = props,
|
23
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
24
|
+
const [internalCurrent, setInternalCurrent] = React.useState(current);
|
25
|
+
const bufferCurrent = React.useRef(current);
|
26
|
+
React.useEffect(() => {
|
32
27
|
if (bufferCurrent.current !== current) {
|
33
28
|
setInternalCurrent(current);
|
34
29
|
bufferCurrent.current = current;
|
@@ -48,13 +43,12 @@ function Swiper(props) {
|
|
48
43
|
}, propsAlias(restProps, SwiperPropsAlias)), function () {
|
49
44
|
return children;
|
50
45
|
}() || function () {
|
51
|
-
return dataSource.map(
|
46
|
+
return dataSource.map((item, index) => {
|
52
47
|
return /*#__PURE__*/React.createElement(RemaxSwiperItem, {
|
53
48
|
key: index
|
54
49
|
}, renderItem(item, index));
|
55
50
|
});
|
56
51
|
}());
|
57
52
|
}
|
58
|
-
|
59
53
|
Swiper.defaultProps = defaultSwiperProps;
|
60
54
|
export default Swiper;
|
package/lib/Swiper/props.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { BaseProps } from '../types';
|
3
3
|
import { GenericEvent as WxEvent } from '@ray-core/wechat';
|
4
|
-
export
|
4
|
+
export type SwiperProps<I> = BaseProps & {
|
5
5
|
/**
|
6
6
|
* @description.en Whether to display panel points
|
7
7
|
* @description.zh 是否显示面板指示点
|
package/lib/Swiper/props.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
export
|
1
|
+
export const defaultSwiperProps = {
|
2
2
|
autoplay: false,
|
3
3
|
circular: false,
|
4
4
|
current: 0,
|
@@ -9,7 +9,7 @@ export var defaultSwiperProps = {
|
|
9
9
|
interval: 5000,
|
10
10
|
vertical: false
|
11
11
|
};
|
12
|
-
export
|
12
|
+
export const SwiperPropsAlias = {
|
13
13
|
dotActiveColor: 'indicatorActiveColor',
|
14
14
|
dotColor: 'indicatorColor',
|
15
15
|
dots: 'indicatorDots'
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import handleProps from '../utils/handleProps';
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
const SwiperItem = props => {
|
4
|
+
const {
|
5
|
+
children
|
6
|
+
} = props;
|
6
7
|
return (
|
7
8
|
/*#__PURE__*/
|
8
9
|
// @ts-ignore
|
9
10
|
React.createElement("v-swiper-item", handleProps(props), children)
|
10
11
|
);
|
11
12
|
};
|
12
|
-
|
13
13
|
SwiperItem.displayName = 'SwiperItem';
|
14
14
|
export default SwiperItem;
|
@@ -1,22 +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 = ["className", "style", "id"];
|
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 { SwiperItem as RemaxSwiperItem } from '@ray-js/adapter';
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
style
|
12
|
-
id
|
13
|
-
|
14
|
-
|
8
|
+
const SwiperItem = props => {
|
9
|
+
const {
|
10
|
+
className,
|
11
|
+
style,
|
12
|
+
id
|
13
|
+
} = props,
|
14
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
15
15
|
return /*#__PURE__*/React.createElement(RemaxSwiperItem, _extends({
|
16
16
|
id: id,
|
17
17
|
style: inlineStyle(style),
|
18
18
|
className: clsx('ray-swiper', className)
|
19
19
|
}, restProps));
|
20
20
|
};
|
21
|
-
|
22
21
|
export default SwiperItem;
|
@@ -1,22 +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 = ["className", "style", "id"];
|
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 { SwiperItem as RemaxSwiperItem } from '@ray-js/adapter';
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
style
|
12
|
-
id
|
13
|
-
|
14
|
-
|
8
|
+
const SwiperItem = props => {
|
9
|
+
const {
|
10
|
+
className,
|
11
|
+
style,
|
12
|
+
id
|
13
|
+
} = props,
|
14
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
15
15
|
return /*#__PURE__*/React.createElement(RemaxSwiperItem, _extends({
|
16
16
|
id: id,
|
17
17
|
style: inlineStyle(style),
|
18
18
|
className: clsx('ray-swiper', className)
|
19
19
|
}, restProps));
|
20
20
|
};
|
21
|
-
|
22
21
|
export default SwiperItem;
|
package/lib/Switch/Switch.js
CHANGED
@@ -3,12 +3,10 @@ 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
|
-
|
9
|
-
useEventListener('change', function (e) {
|
6
|
+
const Switch = props => {
|
7
|
+
const currentNode = React.useRef(null);
|
8
|
+
useEventListener('change', e => {
|
10
9
|
var _props$onChange;
|
11
|
-
|
12
10
|
(_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, _objectSpread(_objectSpread({
|
13
11
|
type: 'change'
|
14
12
|
}, e.detail), {}, {
|
@@ -16,12 +14,11 @@ var Switch = function (props) {
|
|
16
14
|
}));
|
17
15
|
}, {
|
18
16
|
target: currentNode
|
19
|
-
});
|
20
|
-
|
17
|
+
});
|
18
|
+
// @ts-ignore
|
21
19
|
return /*#__PURE__*/React.createElement("v-switch", _extends({}, handleProps(props), {
|
22
20
|
ref: currentNode
|
23
21
|
}));
|
24
22
|
};
|
25
|
-
|
26
23
|
Switch.displayName = 'Switch';
|
27
24
|
export default Switch;
|
@@ -1,24 +1,23 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
|
-
|
3
|
+
const _excluded = ["className", "style", "id", "onChange", "type", "color"];
|
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 { Switch as RemaxSwitch } from '@ray-js/adapter';
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
style
|
12
|
-
id
|
13
|
-
onChange
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
8
|
+
const Switch = props => {
|
9
|
+
const {
|
10
|
+
className,
|
11
|
+
style,
|
12
|
+
id,
|
13
|
+
onChange,
|
14
|
+
type = 'switch',
|
15
|
+
color
|
16
|
+
} = props,
|
17
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
19
18
|
return /*#__PURE__*/React.createElement(RemaxSwitch, _extends({
|
20
19
|
id: id,
|
21
|
-
onChange:
|
20
|
+
onChange: e => {
|
22
21
|
onChange === null || onChange === void 0 ? void 0 : onChange({
|
23
22
|
type: 'change',
|
24
23
|
value: e.detail.value,
|
@@ -31,5 +30,4 @@ var Switch = function (props) {
|
|
31
30
|
type: type
|
32
31
|
}, restProps));
|
33
32
|
};
|
34
|
-
|
35
33
|
export default Switch;
|
@@ -1,25 +1,24 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
|
-
|
3
|
+
const _excluded = ["className", "style", "id", "onChange", "type", "color"];
|
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 { Switch as RemaxSwitch } from '@ray-core/wechat';
|
8
8
|
import './index.module.less';
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
style
|
13
|
-
id
|
14
|
-
onChange
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
9
|
+
const Switch = props => {
|
10
|
+
const {
|
11
|
+
className,
|
12
|
+
style,
|
13
|
+
id,
|
14
|
+
onChange,
|
15
|
+
type = 'switch',
|
16
|
+
color
|
17
|
+
} = props,
|
18
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
20
19
|
return /*#__PURE__*/React.createElement(RemaxSwitch, _extends({
|
21
20
|
id: id,
|
22
|
-
onChange:
|
21
|
+
onChange: e => {
|
23
22
|
onChange === null || onChange === void 0 ? void 0 : onChange({
|
24
23
|
type: 'change',
|
25
24
|
value: e.detail.value,
|
@@ -32,5 +31,4 @@ var Switch = function (props) {
|
|
32
31
|
color: color || '#007AFF'
|
33
32
|
}, restProps));
|
34
33
|
};
|
35
|
-
|
36
34
|
export default Switch;
|
package/lib/Switch/props.js
CHANGED
package/lib/Text/Text.js
CHANGED
@@ -1,13 +1,11 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import handleProps from '../utils/handleProps';
|
3
|
-
|
4
|
-
var Text = function (props) {
|
3
|
+
const Text = props => {
|
5
4
|
return (
|
6
5
|
/*#__PURE__*/
|
7
6
|
// @ts-ignore
|
8
7
|
React.createElement("v-text", handleProps(props))
|
9
8
|
);
|
10
9
|
};
|
11
|
-
|
12
10
|
Text.displayName = 'Text';
|
13
11
|
export default Text;
|
package/lib/Text/Text.thing.js
CHANGED
package/lib/Text/Text.wechat.js
CHANGED
@@ -1,33 +1,28 @@
|
|
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 = ["onClick", "onLongClick", "onTouchCancel", "onTouchEnd", "onTouchMove", "onTouchStart"];
|
4
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
5
5
|
import * as React from 'react';
|
6
6
|
import { Text as RemaxText } from '@ray-core/wechat';
|
7
7
|
import { useTouch } from '@ray-js/framework-shared';
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
onLongClick
|
12
|
-
onTouchCancel
|
13
|
-
onTouchEnd
|
14
|
-
onTouchMove
|
15
|
-
onTouchStart
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
onLongClick
|
20
|
-
onTouchStart
|
21
|
-
onTouchMove
|
22
|
-
onTouchEnd
|
23
|
-
onTouchCancel
|
24
|
-
onClick
|
25
|
-
})
|
26
|
-
_useTouch2 = _slicedToArray(_useTouch, 2),
|
27
|
-
touching = _useTouch2[0],
|
28
|
-
handlers = _useTouch2[1];
|
29
|
-
|
8
|
+
const Text = props => {
|
9
|
+
const {
|
10
|
+
onClick,
|
11
|
+
onLongClick,
|
12
|
+
onTouchCancel,
|
13
|
+
onTouchEnd,
|
14
|
+
onTouchMove,
|
15
|
+
onTouchStart
|
16
|
+
} = props,
|
17
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
18
|
+
const [touching, handlers] = useTouch({
|
19
|
+
onLongClick,
|
20
|
+
onTouchStart,
|
21
|
+
onTouchMove,
|
22
|
+
onTouchEnd,
|
23
|
+
onTouchCancel,
|
24
|
+
onClick
|
25
|
+
});
|
30
26
|
return /*#__PURE__*/React.createElement(RemaxText, _extends({}, restProps, handlers));
|
31
27
|
};
|
32
|
-
|
33
28
|
export default Text;
|
package/lib/Textarea/Textarea.js
CHANGED
@@ -1,22 +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 = ["className", "onInput", "onFocus", "onBlur"];
|
4
4
|
import * as React from 'react';
|
5
5
|
import clsx from 'clsx';
|
6
6
|
import { useEventListener } from 'ahooks';
|
7
7
|
import styles from './index.module.less';
|
8
8
|
import handleProps from '../utils/handleProps';
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
onInput
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
useEventListener('input', function (e) {
|
9
|
+
const Textarea = props => {
|
10
|
+
const {
|
11
|
+
className,
|
12
|
+
onInput,
|
13
|
+
onFocus,
|
14
|
+
onBlur
|
15
|
+
} = props,
|
16
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
17
|
+
const currentNode = React.useRef(null);
|
18
|
+
useEventListener('input', e => {
|
20
19
|
onInput === null || onInput === void 0 ? void 0 : onInput({
|
21
20
|
type: 'input',
|
22
21
|
value: e.detail.value,
|
@@ -25,16 +24,7 @@ var Textarea = function (props) {
|
|
25
24
|
}, {
|
26
25
|
target: currentNode
|
27
26
|
});
|
28
|
-
useEventListener('
|
29
|
-
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm({
|
30
|
-
type: 'confirm',
|
31
|
-
value: e.detail.value,
|
32
|
-
origin: e
|
33
|
-
});
|
34
|
-
}, {
|
35
|
-
target: currentNode
|
36
|
-
});
|
37
|
-
useEventListener('focus', function (e) {
|
27
|
+
useEventListener('focus', e => {
|
38
28
|
onFocus === null || onFocus === void 0 ? void 0 : onFocus({
|
39
29
|
type: 'focus',
|
40
30
|
value: e.detail.value,
|
@@ -43,7 +33,7 @@ var Textarea = function (props) {
|
|
43
33
|
}, {
|
44
34
|
target: currentNode
|
45
35
|
});
|
46
|
-
useEventListener('blur',
|
36
|
+
useEventListener('blur', e => {
|
47
37
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
48
38
|
type: 'blur',
|
49
39
|
value: e.detail.value,
|
@@ -61,6 +51,5 @@ var Textarea = function (props) {
|
|
61
51
|
}))
|
62
52
|
);
|
63
53
|
};
|
64
|
-
|
65
54
|
Textarea.displayName = 'Textarea';
|
66
55
|
export default Textarea;
|
@@ -1,32 +1,32 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
|
-
|
3
|
+
const _excluded = ["id", "className", "style", "value", "placeholderStyle", "placeholder", "onInput", "onFocus", "onLinechange", "onBlur", "maxLength", "disabled", "name", "autoHeight"];
|
4
4
|
import * as React from 'react';
|
5
5
|
import clsx from 'clsx';
|
6
6
|
import { inlineStyle } from '@ray-js/framework-shared';
|
7
7
|
import { Textarea as RemaxTextarea } from '@ray-js/adapter';
|
8
8
|
import styles from './index.module.less';
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
maxLength =
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
9
|
+
const Input = /*#__PURE__*/React.forwardRef((props, ref) => {
|
10
|
+
const {
|
11
|
+
id,
|
12
|
+
className,
|
13
|
+
style,
|
14
|
+
value,
|
15
|
+
placeholderStyle,
|
16
|
+
placeholder,
|
17
|
+
onInput,
|
18
|
+
onFocus,
|
19
|
+
onLinechange,
|
20
|
+
onBlur,
|
21
|
+
maxLength = 140,
|
22
|
+
disabled,
|
23
|
+
name,
|
24
|
+
autoHeight
|
25
|
+
} = props,
|
26
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
28
27
|
return /*#__PURE__*/React.createElement(RemaxTextarea, _extends({
|
29
|
-
name: name
|
28
|
+
name: name
|
29
|
+
// @ts-ignore
|
30
30
|
,
|
31
31
|
ref: ref,
|
32
32
|
id: id,
|
@@ -34,21 +34,17 @@ var Input = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
34
34
|
className: clsx('ray-textarea', styles.textarea, className),
|
35
35
|
autoHeight: autoHeight,
|
36
36
|
disabled: disabled,
|
37
|
-
focus: focus,
|
38
37
|
maxlength: maxLength // 小程序里是 maxlength 小写
|
39
38
|
,
|
40
39
|
onBlur: onBlur,
|
41
|
-
|
42
|
-
var value = e.detail.value;
|
43
|
-
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm({
|
44
|
-
value: value
|
45
|
-
});
|
46
|
-
},
|
40
|
+
onLinechange: onLinechange,
|
47
41
|
onFocus: onFocus,
|
48
42
|
onInput: function (e) {
|
49
|
-
|
43
|
+
const {
|
44
|
+
value
|
45
|
+
} = e.detail;
|
50
46
|
onInput === null || onInput === void 0 ? void 0 : onInput({
|
51
|
-
value
|
47
|
+
value
|
52
48
|
});
|
53
49
|
},
|
54
50
|
placeholder: placeholder,
|
@@ -1,32 +1,32 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
|
-
|
3
|
+
const _excluded = ["id", "className", "style", "value", "placeholderStyle", "placeholder", "onInput", "onFocus", "onBlur", "onLinechange", "maxLength", "disabled", "name", "autoHeight"];
|
4
4
|
import * as React from 'react';
|
5
5
|
import clsx from 'clsx';
|
6
6
|
import { inlineStyle } from '@ray-js/framework-shared';
|
7
7
|
import { Textarea as RemaxTextarea } from '@ray-core/wechat';
|
8
8
|
import styles from './index.module.less';
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
onBlur
|
20
|
-
|
21
|
-
maxLength =
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
9
|
+
const Input = /*#__PURE__*/React.forwardRef((props, ref) => {
|
10
|
+
const {
|
11
|
+
id,
|
12
|
+
className,
|
13
|
+
style,
|
14
|
+
value,
|
15
|
+
placeholderStyle,
|
16
|
+
placeholder,
|
17
|
+
onInput,
|
18
|
+
onFocus,
|
19
|
+
onBlur,
|
20
|
+
onLinechange,
|
21
|
+
maxLength = 140,
|
22
|
+
disabled,
|
23
|
+
name,
|
24
|
+
autoHeight
|
25
|
+
} = props,
|
26
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
28
27
|
return /*#__PURE__*/React.createElement(RemaxTextarea, _extends({
|
29
|
-
name: name
|
28
|
+
name: name
|
29
|
+
// @ts-ignore
|
30
30
|
,
|
31
31
|
ref: ref,
|
32
32
|
id: id,
|
@@ -34,23 +34,19 @@ var Input = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
34
34
|
className: clsx('ray-textarea', styles.textarea, className),
|
35
35
|
autoHeight: autoHeight,
|
36
36
|
disabled: disabled,
|
37
|
-
focus: focus,
|
38
37
|
maxlength: maxLength // 小程序里是 maxlength 小写
|
39
38
|
,
|
40
39
|
onBlur: onBlur,
|
41
|
-
onConfirm: function (e) {
|
42
|
-
var value = e.detail.value;
|
43
|
-
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm({
|
44
|
-
value: value
|
45
|
-
});
|
46
|
-
},
|
47
40
|
onFocus: onFocus,
|
48
41
|
onInput: function (e) {
|
49
|
-
|
42
|
+
const {
|
43
|
+
value
|
44
|
+
} = e.detail;
|
50
45
|
onInput === null || onInput === void 0 ? void 0 : onInput({
|
51
|
-
value
|
46
|
+
value
|
52
47
|
});
|
53
48
|
},
|
49
|
+
onLinechange: onLinechange,
|
54
50
|
placeholder: placeholder,
|
55
51
|
placeholderStyle: inlineStyle(placeholderStyle),
|
56
52
|
value: value
|
package/lib/Textarea/props.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { BaseProps, FormEvent } from '../types';
|
3
|
-
export
|
3
|
+
export type TextareaEvent = FormEvent<{
|
4
4
|
value: string;
|
5
5
|
}>;
|
6
6
|
export interface TextareaProps extends BaseProps {
|
@@ -40,12 +40,6 @@ export interface TextareaProps extends BaseProps {
|
|
40
40
|
* @default null
|
41
41
|
*/
|
42
42
|
maxLength?: number;
|
43
|
-
/**
|
44
|
-
* @description.en Get focus
|
45
|
-
* @description.zh 获取焦点
|
46
|
-
* @default null
|
47
|
-
*/
|
48
|
-
focus?: boolean;
|
49
43
|
/**
|
50
44
|
* @description.en Automatic increase or not
|
51
45
|
* @description.zh 是否自动增高
|
@@ -71,9 +65,9 @@ export interface TextareaProps extends BaseProps {
|
|
71
65
|
*/
|
72
66
|
onBlur?: (event: any) => void;
|
73
67
|
/**
|
74
|
-
* @description.en
|
75
|
-
* @description.zh
|
68
|
+
* @description.en Called when the number of lines in the input box changes, event.detail = {height: 0, lineCount: 0}
|
69
|
+
* @description.zh 输入框行数变化时调用,event.detail = {height: 0, lineCount: 0}
|
76
70
|
* @default null
|
77
71
|
*/
|
78
|
-
|
72
|
+
onLinechange?: (event: any) => void;
|
79
73
|
}
|