@ray-js/components 1.4.0-alpha.3 → 1.4.0-alpha.5

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.
Files changed (141) hide show
  1. package/lib/Button/Button.js +1 -3
  2. package/lib/Button/Button.thing.js +15 -17
  3. package/lib/Button/Button.wechat.js +15 -17
  4. package/lib/Button/props.js +1 -1
  5. package/lib/Camera/Camera.d.ts +2 -1
  6. package/lib/Camera/Camera.js +3 -3
  7. package/lib/Camera/Camera.thing.js +1 -3
  8. package/lib/Camera/Camera.wechat.d.ts +2 -1
  9. package/lib/Camera/Camera.wechat.js +2 -2
  10. package/lib/Checkbox/Checkbox.js +1 -3
  11. package/lib/Checkbox/Checkbox.thing.js +8 -9
  12. package/lib/Checkbox/Checkbox.wechat.js +9 -10
  13. package/lib/CheckboxGroup/CheckboxGroup.js +15 -19
  14. package/lib/CheckboxGroup/CheckboxGroup.thing.js +12 -17
  15. package/lib/CheckboxGroup/CheckboxGroup.wechat.js +12 -17
  16. package/lib/CheckboxGroup/props.d.ts +1 -1
  17. package/lib/CoverView/CoverView.js +1 -3
  18. package/lib/CoverView/CoverView.thing.js +1 -3
  19. package/lib/CoverView/CoverView.wechat.d.ts +2 -1
  20. package/lib/CoverView/CoverView.wechat.js +0 -2
  21. package/lib/CoverView/props.d.ts +1 -1
  22. package/lib/CoverView/props.js +1 -1
  23. package/lib/Form/Form.js +12 -12
  24. package/lib/Form/Form.thing.js +1 -3
  25. package/lib/Form/Form.wechat.js +20 -25
  26. package/lib/Form/props.d.ts +1 -1
  27. package/lib/Icon/Icon.js +7 -7
  28. package/lib/Icon/Icon.thing.js +7 -7
  29. package/lib/Icon/Icon.wechat.js +7 -7
  30. package/lib/Icon/iconfont/iconfont.js +13 -20
  31. package/lib/Icon/props.d.ts +1 -1
  32. package/lib/Icon/props.js +1 -1
  33. package/lib/Iframe/Iframe.d.ts +2 -1
  34. package/lib/Iframe/Iframe.js +3 -3
  35. package/lib/Iframe/Iframe.thing.js +1 -3
  36. package/lib/Iframe/Iframe.wechat.d.ts +2 -1
  37. package/lib/Iframe/Iframe.wechat.js +3 -3
  38. package/lib/Image/Image.js +6 -8
  39. package/lib/Image/Image.thing.js +8 -10
  40. package/lib/Image/Image.wechat.js +26 -32
  41. package/lib/Input/Input.js +29 -26
  42. package/lib/Input/Input.thing.js +36 -36
  43. package/lib/Input/Input.wechat.js +47 -47
  44. package/lib/Input/props.d.ts +11 -21
  45. package/lib/Input/props.js +1 -3
  46. package/lib/IpcPlayer/IpcPlayer.d.ts +2 -1
  47. package/lib/IpcPlayer/IpcPlayer.js +3 -3
  48. package/lib/IpcPlayer/IpcPlayer.thing.js +1 -3
  49. package/lib/IpcPlayer/IpcPlayer.wechat.d.ts +2 -1
  50. package/lib/IpcPlayer/IpcPlayer.wechat.js +2 -2
  51. package/lib/Label/Label.js +7 -8
  52. package/lib/Label/Label.thing.js +8 -8
  53. package/lib/Label/Label.wechat.js +8 -8
  54. package/lib/Map/Map.js +1 -3
  55. package/lib/Map/Map.thing.js +1 -3
  56. package/lib/Map/Map.wechat.js +1 -3
  57. package/lib/Modal/index.js +4 -2
  58. package/lib/Modal/index.web.js +6 -4
  59. package/lib/MovableArea/MovableArea.js +5 -4
  60. package/lib/MovableArea/MovableArea.thing.js +1 -3
  61. package/lib/MovableArea/MovableArea.wechat.js +1 -3
  62. package/lib/MovableView/MovableView.js +12 -11
  63. package/lib/MovableView/MovableView.thing.js +1 -3
  64. package/lib/MovableView/MovableView.wechat.js +1 -3
  65. package/lib/NativeVideo/NativeVideo.d.ts +2 -1
  66. package/lib/NativeVideo/NativeVideo.js +3 -3
  67. package/lib/NativeVideo/NativeVideo.thing.js +1 -3
  68. package/lib/NativeVideo/NativeVideo.wechat.d.ts +2 -1
  69. package/lib/NativeVideo/NativeVideo.wechat.js +2 -2
  70. package/lib/PageContainer/PageContainer.js +12 -19
  71. package/lib/PageContainer/PageContainer.thing.d.ts +2 -1
  72. package/lib/PageContainer/PageContainer.thing.js +0 -2
  73. package/lib/PageContainer/PageContainer.wechat.d.ts +2 -1
  74. package/lib/PageContainer/PageContainer.wechat.js +0 -2
  75. package/lib/PageContainer/props.d.ts +2 -2
  76. package/lib/PageContainer/props.js +3 -3
  77. package/lib/Picker/Picker.js +23 -31
  78. package/lib/Picker/Picker.thing.js +26 -31
  79. package/lib/Picker/Picker.wechat.js +26 -31
  80. package/lib/PickerView/PickerView.js +23 -34
  81. package/lib/PickerView/PickerView.thing.js +16 -19
  82. package/lib/PickerView/PickerView.wechat.js +16 -19
  83. package/lib/PickerViewColumn/PickerViewColumn.js +4 -4
  84. package/lib/PickerViewColumn/PickerViewColumn.thing.js +6 -7
  85. package/lib/PickerViewColumn/PickerViewColumn.wechat.js +6 -7
  86. package/lib/Progress/Progress.js +1 -3
  87. package/lib/Progress/Progress.thing.js +6 -7
  88. package/lib/Progress/Progress.wechat.js +6 -7
  89. package/lib/Radio/Radio.js +1 -3
  90. package/lib/Radio/Radio.thing.js +8 -9
  91. package/lib/Radio/Radio.wechat.js +9 -10
  92. package/lib/RadioGroup/RadioGroup.js +12 -18
  93. package/lib/RadioGroup/RadioGroup.thing.js +15 -21
  94. package/lib/RadioGroup/RadioGroup.wechat.js +12 -17
  95. package/lib/RadioGroup/props.d.ts +1 -1
  96. package/lib/RichText/RichText.js +1 -1
  97. package/lib/RichText/RichText.thing.js +1 -3
  98. package/lib/RichText/RichText.wechat.js +1 -3
  99. package/lib/ScrollView/ScrollView.js +12 -13
  100. package/lib/ScrollView/ScrollView.thing.js +6 -7
  101. package/lib/ScrollView/ScrollView.wechat.js +6 -7
  102. package/lib/Slider/Slider.js +4 -8
  103. package/lib/Slider/Slider.thing.js +13 -14
  104. package/lib/Slider/Slider.wechat.js +14 -15
  105. package/lib/Slider/props.js +1 -1
  106. package/lib/Swiper/Swiper.d.ts +1 -1
  107. package/lib/Swiper/Swiper.js +24 -33
  108. package/lib/Swiper/Swiper.thing.d.ts +1 -1
  109. package/lib/Swiper/Swiper.thing.js +18 -24
  110. package/lib/Swiper/Swiper.wechat.d.ts +1 -1
  111. package/lib/Swiper/Swiper.wechat.js +18 -24
  112. package/lib/Swiper/props.d.ts +1 -1
  113. package/lib/Swiper/props.js +2 -2
  114. package/lib/SwiperItem/SwiperItem.js +4 -4
  115. package/lib/SwiperItem/SwiperItem.thing.js +8 -9
  116. package/lib/SwiperItem/SwiperItem.wechat.js +8 -9
  117. package/lib/Switch/Switch.js +5 -8
  118. package/lib/Switch/Switch.thing.js +12 -14
  119. package/lib/Switch/Switch.wechat.js +12 -14
  120. package/lib/Switch/props.js +1 -1
  121. package/lib/Text/Text.js +1 -3
  122. package/lib/Text/Text.thing.js +1 -3
  123. package/lib/Text/Text.wechat.js +20 -25
  124. package/lib/Textarea/Textarea.js +13 -24
  125. package/lib/Textarea/Textarea.thing.js +26 -30
  126. package/lib/Textarea/Textarea.wechat.js +26 -30
  127. package/lib/Textarea/props.d.ts +4 -10
  128. package/lib/View/View.js +29 -32
  129. package/lib/View/View.thing.js +34 -35
  130. package/lib/View/View.wechat.js +34 -35
  131. package/lib/View/props.js +1 -1
  132. package/lib/WebView/WebView.js +1 -3
  133. package/lib/WebView/WebView.thing.js +1 -3
  134. package/lib/WebView/WebView.wechat.js +1 -3
  135. package/lib/assets/icons.js +1 -1
  136. package/lib/core/index.js +4 -11
  137. package/lib/types/event.d.ts +1 -1
  138. package/lib/types/index.js +1 -0
  139. package/lib/utils/handleProps.js +26 -40
  140. package/package.json +10 -10
  141. package/LICENSE.md +0 -9
@@ -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
- var _excluded = ["id", "style", "className", "current", "dataSource", "onAfterChange", "onChange", "renderItem", "children"];
5
- import "core-js/modules/es.array.map.js";
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
- var id = props.id,
15
- style = props.style,
16
- className = props.className,
17
- current = props.current,
18
- dataSource = props.dataSource,
19
- onAfterChange = props.onAfterChange,
20
- onChange = props.onChange,
21
- renderItem = props.renderItem,
22
- children = props.children,
23
- restProps = _objectWithoutProperties(props, _excluded);
24
-
25
- var _React$useState = React.useState(current),
26
- _React$useState2 = _slicedToArray(_React$useState, 2),
27
- internalCurrent = _React$useState2[0],
28
- setInternalCurrent = _React$useState2[1];
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(function (item, index) {
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;
@@ -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 declare type SwiperProps<I> = BaseProps & {
4
+ export type SwiperProps<I> = BaseProps & {
5
5
  /**
6
6
  * @description.en Whether to display panel points
7
7
  * @description.zh 是否显示面板指示点
@@ -1,4 +1,4 @@
1
- export var defaultSwiperProps = {
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 var SwiperPropsAlias = {
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
- var SwiperItem = function (props) {
5
- var children = props.children;
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
- var _excluded = ["className", "style", "id"];
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
- var SwiperItem = function (props) {
10
- var className = props.className,
11
- style = props.style,
12
- id = props.id,
13
- restProps = _objectWithoutProperties(props, _excluded);
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
- var _excluded = ["className", "style", "id"];
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
- var SwiperItem = function (props) {
10
- var className = props.className,
11
- style = props.style,
12
- id = props.id,
13
- restProps = _objectWithoutProperties(props, _excluded);
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;
@@ -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
- var Switch = function (props) {
8
- var currentNode = React.useRef(null);
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
- }); // @ts-ignore
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
- var _excluded = ["className", "style", "id", "onChange", "type", "color"];
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
- var Switch = function (props) {
10
- var className = props.className,
11
- style = props.style,
12
- id = props.id,
13
- onChange = props.onChange,
14
- _props$type = props.type,
15
- type = _props$type === void 0 ? 'switch' : _props$type,
16
- color = props.color,
17
- restProps = _objectWithoutProperties(props, _excluded);
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: function handleChange(e) {
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
- var _excluded = ["className", "style", "id", "onChange", "type", "color"];
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
- var Switch = function (props) {
11
- var className = props.className,
12
- style = props.style,
13
- id = props.id,
14
- onChange = props.onChange,
15
- _props$type = props.type,
16
- type = _props$type === void 0 ? 'switch' : _props$type,
17
- color = props.color,
18
- restProps = _objectWithoutProperties(props, _excluded);
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: function handleChange(e) {
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;
@@ -1,4 +1,4 @@
1
- export var defaultSwitchProps = {
1
+ export const defaultSwitchProps = {
2
2
  type: 'switch',
3
3
  color: '#007AFF',
4
4
  disabled: false
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;
@@ -1,8 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { Text as RemaxText } from '@ray-js/adapter';
3
-
4
- var Text = function (props) {
3
+ const Text = props => {
5
4
  return /*#__PURE__*/React.createElement(RemaxText, props);
6
5
  };
7
-
8
6
  export default Text;
@@ -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
- var _excluded = ["onClick", "onLongClick", "onTouchCancel", "onTouchEnd", "onTouchMove", "onTouchStart"];
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
- var Text = function (props) {
10
- var onClick = props.onClick,
11
- onLongClick = props.onLongClick,
12
- onTouchCancel = props.onTouchCancel,
13
- onTouchEnd = props.onTouchEnd,
14
- onTouchMove = props.onTouchMove,
15
- onTouchStart = props.onTouchStart,
16
- restProps = _objectWithoutProperties(props, _excluded);
17
-
18
- var _useTouch = useTouch({
19
- onLongClick: onLongClick,
20
- onTouchStart: onTouchStart,
21
- onTouchMove: onTouchMove,
22
- onTouchEnd: onTouchEnd,
23
- onTouchCancel: onTouchCancel,
24
- onClick: 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;
@@ -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
- var _excluded = ["className", "onInput", "onConfirm", "onFocus", "onBlur"];
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
- var Textarea = function (props) {
11
- var className = props.className,
12
- onInput = props.onInput,
13
- onConfirm = props.onConfirm,
14
- onFocus = props.onFocus,
15
- onBlur = props.onBlur,
16
- restProps = _objectWithoutProperties(props, _excluded);
17
-
18
- var currentNode = React.useRef(null);
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('confirm', function (e) {
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', function (e) {
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
- var _excluded = ["id", "className", "style", "value", "placeholderStyle", "placeholder", "onInput", "onFocus", "onConfirm", "onBlur", "maxLength", "focus", "disabled", "name", "autoHeight"];
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
- var Input = /*#__PURE__*/React.forwardRef(function (props, ref) {
10
- var id = props.id,
11
- className = props.className,
12
- style = props.style,
13
- value = props.value,
14
- placeholderStyle = props.placeholderStyle,
15
- placeholder = props.placeholder,
16
- onInput = props.onInput,
17
- onFocus = props.onFocus,
18
- onConfirm = props.onConfirm,
19
- onBlur = props.onBlur,
20
- _props$maxLength = props.maxLength,
21
- maxLength = _props$maxLength === void 0 ? 140 : _props$maxLength,
22
- focus = props.focus,
23
- disabled = props.disabled,
24
- name = props.name,
25
- autoHeight = props.autoHeight,
26
- restProps = _objectWithoutProperties(props, _excluded);
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 // @ts-ignore
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
- onConfirm: function (e) {
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
- var value = e.detail.value;
43
+ const {
44
+ value
45
+ } = e.detail;
50
46
  onInput === null || onInput === void 0 ? void 0 : onInput({
51
- value: 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
- var _excluded = ["id", "className", "style", "value", "placeholderStyle", "placeholder", "onInput", "onFocus", "onConfirm", "onBlur", "maxLength", "focus", "disabled", "name", "autoHeight"];
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
- var Input = /*#__PURE__*/React.forwardRef(function (props, ref) {
10
- var id = props.id,
11
- className = props.className,
12
- style = props.style,
13
- value = props.value,
14
- placeholderStyle = props.placeholderStyle,
15
- placeholder = props.placeholder,
16
- onInput = props.onInput,
17
- onFocus = props.onFocus,
18
- onConfirm = props.onConfirm,
19
- onBlur = props.onBlur,
20
- _props$maxLength = props.maxLength,
21
- maxLength = _props$maxLength === void 0 ? 140 : _props$maxLength,
22
- focus = props.focus,
23
- disabled = props.disabled,
24
- name = props.name,
25
- autoHeight = props.autoHeight,
26
- restProps = _objectWithoutProperties(props, _excluded);
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 // @ts-ignore
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
- var value = e.detail.value;
42
+ const {
43
+ value
44
+ } = e.detail;
50
45
  onInput === null || onInput === void 0 ? void 0 : onInput({
51
- value: value
46
+ value
52
47
  });
53
48
  },
49
+ onLinechange: onLinechange,
54
50
  placeholder: placeholder,
55
51
  placeholderStyle: inlineStyle(placeholderStyle),
56
52
  value: value
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { BaseProps, FormEvent } from '../types';
3
- export declare type TextareaEvent = FormEvent<{
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 Click Finish when triggered
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
- onConfirm?: (event: any) => void;
72
+ onLinechange?: (event: any) => void;
79
73
  }