@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.
Files changed (118) 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.js +3 -3
  6. package/lib/Camera/Camera.thing.js +1 -3
  7. package/lib/Camera/Camera.wechat.js +2 -2
  8. package/lib/Checkbox/Checkbox.js +1 -3
  9. package/lib/Checkbox/Checkbox.thing.js +8 -9
  10. package/lib/Checkbox/Checkbox.wechat.js +9 -10
  11. package/lib/CheckboxGroup/CheckboxGroup.js +15 -19
  12. package/lib/CheckboxGroup/CheckboxGroup.thing.js +12 -17
  13. package/lib/CheckboxGroup/CheckboxGroup.wechat.js +12 -17
  14. package/lib/CoverView/CoverView.js +1 -3
  15. package/lib/CoverView/CoverView.thing.js +1 -3
  16. package/lib/CoverView/CoverView.wechat.js +0 -2
  17. package/lib/CoverView/props.js +1 -1
  18. package/lib/Form/Form.js +12 -12
  19. package/lib/Form/Form.thing.js +1 -3
  20. package/lib/Form/Form.wechat.js +20 -25
  21. package/lib/Icon/Icon.js +7 -7
  22. package/lib/Icon/Icon.thing.js +7 -7
  23. package/lib/Icon/Icon.wechat.js +7 -7
  24. package/lib/Icon/iconfont/iconfont.js +13 -20
  25. package/lib/Icon/props.js +1 -1
  26. package/lib/Iframe/Iframe.js +3 -3
  27. package/lib/Iframe/Iframe.thing.js +1 -3
  28. package/lib/Iframe/Iframe.wechat.js +3 -3
  29. package/lib/Image/Image.js +6 -8
  30. package/lib/Image/Image.thing.js +8 -10
  31. package/lib/Image/Image.wechat.js +26 -32
  32. package/lib/Input/Input.js +29 -26
  33. package/lib/Input/Input.thing.js +36 -36
  34. package/lib/Input/Input.wechat.js +47 -47
  35. package/lib/Input/props.d.ts +6 -24
  36. package/lib/Input/props.js +1 -3
  37. package/lib/IpcPlayer/IpcPlayer.js +3 -3
  38. package/lib/IpcPlayer/IpcPlayer.thing.js +1 -3
  39. package/lib/IpcPlayer/IpcPlayer.wechat.js +2 -2
  40. package/lib/Label/Label.js +7 -8
  41. package/lib/Label/Label.thing.js +8 -8
  42. package/lib/Label/Label.wechat.js +8 -8
  43. package/lib/Map/Map.js +1 -3
  44. package/lib/Map/Map.thing.js +1 -3
  45. package/lib/Map/Map.wechat.js +1 -3
  46. package/lib/Modal/index.js +4 -2
  47. package/lib/Modal/index.web.js +6 -4
  48. package/lib/MovableArea/MovableArea.js +5 -4
  49. package/lib/MovableArea/MovableArea.thing.js +1 -3
  50. package/lib/MovableArea/MovableArea.wechat.js +1 -3
  51. package/lib/MovableView/MovableView.js +12 -11
  52. package/lib/MovableView/MovableView.thing.js +1 -3
  53. package/lib/MovableView/MovableView.wechat.js +1 -3
  54. package/lib/NativeVideo/NativeVideo.js +3 -3
  55. package/lib/NativeVideo/NativeVideo.thing.js +1 -3
  56. package/lib/NativeVideo/NativeVideo.wechat.js +2 -2
  57. package/lib/PageContainer/PageContainer.js +12 -19
  58. package/lib/PageContainer/PageContainer.thing.js +0 -2
  59. package/lib/PageContainer/PageContainer.wechat.js +0 -2
  60. package/lib/PageContainer/props.js +3 -3
  61. package/lib/Picker/Picker.js +23 -31
  62. package/lib/Picker/Picker.thing.js +26 -31
  63. package/lib/Picker/Picker.wechat.js +26 -31
  64. package/lib/PickerView/PickerView.js +23 -34
  65. package/lib/PickerView/PickerView.thing.js +16 -19
  66. package/lib/PickerView/PickerView.wechat.js +16 -19
  67. package/lib/PickerViewColumn/PickerViewColumn.js +4 -4
  68. package/lib/PickerViewColumn/PickerViewColumn.thing.js +6 -7
  69. package/lib/PickerViewColumn/PickerViewColumn.wechat.js +6 -7
  70. package/lib/Progress/Progress.js +1 -3
  71. package/lib/Progress/Progress.thing.js +6 -7
  72. package/lib/Progress/Progress.wechat.js +6 -7
  73. package/lib/Radio/Radio.js +1 -3
  74. package/lib/Radio/Radio.thing.js +8 -9
  75. package/lib/Radio/Radio.wechat.js +9 -10
  76. package/lib/RadioGroup/RadioGroup.js +12 -18
  77. package/lib/RadioGroup/RadioGroup.thing.js +15 -21
  78. package/lib/RadioGroup/RadioGroup.wechat.js +12 -17
  79. package/lib/RichText/RichText.js +1 -1
  80. package/lib/RichText/RichText.thing.js +1 -3
  81. package/lib/RichText/RichText.wechat.js +1 -3
  82. package/lib/ScrollView/ScrollView.js +12 -13
  83. package/lib/ScrollView/ScrollView.thing.js +6 -7
  84. package/lib/ScrollView/ScrollView.wechat.js +6 -7
  85. package/lib/Slider/Slider.js +4 -8
  86. package/lib/Slider/Slider.thing.js +13 -14
  87. package/lib/Slider/Slider.wechat.js +14 -15
  88. package/lib/Slider/props.js +1 -1
  89. package/lib/Swiper/Swiper.js +24 -33
  90. package/lib/Swiper/Swiper.thing.js +18 -24
  91. package/lib/Swiper/Swiper.wechat.js +18 -24
  92. package/lib/Swiper/props.js +2 -2
  93. package/lib/SwiperItem/SwiperItem.js +4 -4
  94. package/lib/SwiperItem/SwiperItem.thing.js +8 -9
  95. package/lib/SwiperItem/SwiperItem.wechat.js +8 -9
  96. package/lib/Switch/Switch.js +5 -8
  97. package/lib/Switch/Switch.thing.js +12 -14
  98. package/lib/Switch/Switch.wechat.js +12 -14
  99. package/lib/Switch/props.js +1 -1
  100. package/lib/Text/Text.js +1 -3
  101. package/lib/Text/Text.thing.js +1 -3
  102. package/lib/Text/Text.wechat.js +20 -25
  103. package/lib/Textarea/Textarea.js +13 -24
  104. package/lib/Textarea/Textarea.thing.js +26 -30
  105. package/lib/Textarea/Textarea.wechat.js +26 -30
  106. package/lib/Textarea/props.d.ts +3 -9
  107. package/lib/View/View.js +29 -32
  108. package/lib/View/View.thing.js +34 -35
  109. package/lib/View/View.wechat.js +34 -35
  110. package/lib/View/props.js +1 -1
  111. package/lib/WebView/WebView.js +1 -3
  112. package/lib/WebView/WebView.thing.js +1 -3
  113. package/lib/WebView/WebView.wechat.js +1 -3
  114. package/lib/assets/icons.js +1 -1
  115. package/lib/core/index.js +4 -11
  116. package/lib/types/index.js +1 -0
  117. package/lib/utils/handleProps.js +26 -40
  118. package/package.json +5 -5
@@ -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
@@ -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
  }
package/lib/View/View.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
- var _excluded = ["id", "className", "style", "children", "hoverClassName", "hoverStartTime", "hoverStayTime", "hoverable", "onClick", "onLongClick", "onTouchCancel", "onTouchEnd", "onTouchMove", "onTouchStart", "onTransitionEnd"];
3
+ const _excluded = ["id", "className", "style", "children", "hoverClassName", "hoverStartTime", "hoverStayTime", "hoverable", "onClick", "onLongClick", "onTouchCancel", "onTouchEnd", "onTouchMove", "onTouchStart", "onTransitionEnd"];
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 PropTypes from 'prop-types';
@@ -9,38 +9,35 @@ import handleProps from '../utils/handleProps';
9
9
  import { filterProps, inlineStyle, useTouch } from '@ray-js/framework-shared';
10
10
  import { defaultViewProps } from './props';
11
11
  import styles from './index.module.less';
12
- var View = /*#__PURE__*/React.forwardRef(function (props, ref) {
13
- var id = props.id,
14
- className = props.className,
15
- style = props.style,
16
- children = props.children,
17
- hoverClassName = props.hoverClassName,
18
- hoverStartTime = props.hoverStartTime,
19
- hoverStayTime = props.hoverStayTime,
20
- hoverable = props.hoverable,
21
- onClick = props.onClick,
22
- onLongClick = props.onLongClick,
23
- onTouchCancel = props.onTouchCancel,
24
- onTouchEnd = props.onTouchEnd,
25
- onTouchMove = props.onTouchMove,
26
- onTouchStart = props.onTouchStart,
27
- onTransitionEnd = props.onTransitionEnd,
28
- restProps = _objectWithoutProperties(props, _excluded);
29
-
30
- var _useTouch = useTouch({
12
+ const View = /*#__PURE__*/React.forwardRef((props, ref) => {
13
+ const {
14
+ id,
15
+ className,
16
+ style,
17
+ children,
18
+ hoverClassName,
19
+ hoverStartTime,
20
+ hoverStayTime,
21
+ hoverable,
22
+ onClick,
23
+ onLongClick,
24
+ onTouchCancel,
25
+ onTouchEnd,
26
+ onTouchMove,
27
+ onTouchStart,
28
+ onTransitionEnd
29
+ } = props,
30
+ restProps = _objectWithoutProperties(props, _excluded);
31
+ const [touching, handlers] = useTouch({
31
32
  hoverDelay: hoverStartTime,
32
33
  hoverDuration: hoverStayTime,
33
- onLongClick: onLongClick,
34
- onTouchStart: onTouchStart,
35
- onTouchMove: onTouchMove,
36
- onTouchEnd: onTouchEnd,
37
- onTouchCancel: onTouchCancel,
38
- onClick: onClick
39
- }),
40
- _useTouch2 = _slicedToArray(_useTouch, 2),
41
- touching = _useTouch2[0],
42
- handlers = _useTouch2[1];
43
-
34
+ onLongClick,
35
+ onTouchStart,
36
+ onTouchMove,
37
+ onTouchEnd,
38
+ onTouchCancel,
39
+ onClick
40
+ });
44
41
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("v-view", _extends({}, handleProps(props), {
45
42
  ref: ref,
46
43
  id: id,
@@ -1,53 +1,52 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
- var _excluded = ["id", "className", "style", "hoverClassName", "hoverStartTime", "hoverStayTime", "children", "onLongClick", "onTouchStart", "onTouchMove", "onTouchEnd", "onTouchCancel", "onClick", "hoverable", "onTransitionEnd"];
3
+ const _excluded = ["id", "className", "style", "hoverClassName", "hoverStartTime", "hoverStayTime", "children", "onLongClick", "onTouchStart", "onTouchMove", "onTouchEnd", "onTouchCancel", "onClick", "hoverable", "onTransitionEnd"];
4
+ import "core-js/modules/web.dom-collections.iterator.js";
6
5
  import * as React from 'react';
7
6
  import clsx from 'clsx';
8
7
  import PropTypes from 'prop-types';
9
8
  import { inlineStyle, useTouch } from '@ray-js/framework-shared';
10
9
  import { View as RemaxView } from '@ray-js/adapter';
11
10
  import styles from './index.module.less';
12
- var View = /*#__PURE__*/React.forwardRef(function (props, ref) {
13
- var id = props.id,
14
- className = props.className,
15
- style = props.style,
16
- hoverClassName = props.hoverClassName,
17
- hoverStartTime = props.hoverStartTime,
18
- hoverStayTime = props.hoverStayTime,
19
- children = props.children,
20
- onLongClick = props.onLongClick,
21
- onTouchStart = props.onTouchStart,
22
- onTouchMove = props.onTouchMove,
23
- onTouchEnd = props.onTouchEnd,
24
- onTouchCancel = props.onTouchCancel,
25
- onClick = props.onClick,
26
- hoverable = props.hoverable,
27
- onTransitionEnd = props.onTransitionEnd,
28
- restProps = _objectWithoutProperties(props, _excluded);
29
-
30
- var _useTouch = useTouch({
11
+ const View = /*#__PURE__*/React.forwardRef((props, ref) => {
12
+ const {
13
+ id,
14
+ className,
15
+ style,
16
+ hoverClassName,
17
+ hoverStartTime,
18
+ hoverStayTime,
19
+ children,
20
+ onLongClick,
21
+ onTouchStart,
22
+ onTouchMove,
23
+ onTouchEnd,
24
+ onTouchCancel,
25
+ onClick,
26
+ hoverable,
27
+ onTransitionEnd
28
+ } = props,
29
+ restProps = _objectWithoutProperties(props, _excluded);
30
+ const [touching, handlers] = useTouch({
31
31
  hoverDelay: hoverStartTime,
32
32
  hoverDuration: hoverStayTime,
33
- onLongClick: onLongClick,
34
- onTouchStart: onTouchStart,
35
- onTouchMove: onTouchMove,
36
- onTouchEnd: onTouchEnd,
37
- onTouchCancel: onTouchCancel,
38
- onClick: onClick
39
- }),
40
- _useTouch2 = _slicedToArray(_useTouch, 2),
41
- touching = _useTouch2[0],
42
- handlers = _useTouch2[1];
43
-
44
- return /*#__PURE__*/React.createElement(RemaxView // @ts-ignore
33
+ onLongClick,
34
+ onTouchStart,
35
+ onTouchMove,
36
+ onTouchEnd,
37
+ onTouchCancel,
38
+ onClick
39
+ });
40
+ return /*#__PURE__*/React.createElement(RemaxView
41
+ // @ts-ignore
45
42
  , _extends({
46
43
  ref: ref,
47
44
  id: id,
48
45
  className: className,
49
46
  style: inlineStyle(style),
50
- hoverClassName: clsx(_defineProperty({}, styles.hover, hoverable), hoverClassName),
47
+ hoverClassName: clsx({
48
+ [styles.hover]: hoverable
49
+ }, hoverClassName),
51
50
  hoverStartTime: hoverStartTime,
52
51
  hoverStayTime: hoverStayTime,
53
52
  onTransitionEnd: onTransitionEnd
@@ -1,8 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
- var _excluded = ["id", "className", "style", "hoverClassName", "hoverStartTime", "hoverStayTime", "children", "onLongClick", "onTouchStart", "onTouchMove", "onTouchEnd", "onTouchCancel", "onClick", "hoverable", "onTransitionEnd"];
3
+ const _excluded = ["id", "className", "style", "hoverClassName", "hoverStartTime", "hoverStayTime", "children", "onLongClick", "onTouchStart", "onTouchMove", "onTouchEnd", "onTouchCancel", "onClick", "hoverable", "onTransitionEnd"];
4
+ import "core-js/modules/web.dom-collections.iterator.js";
6
5
  import * as React from 'react';
7
6
  import clsx from 'clsx';
8
7
  import { inlineStyle, useTouch } from '@ray-js/framework-shared';
@@ -10,45 +9,45 @@ import { View as RemaxView } from '@ray-core/wechat';
10
9
  import PropTypes from 'prop-types';
11
10
  import { defaultViewProps } from './props';
12
11
  import styles from './index.module.less';
13
- var View = /*#__PURE__*/React.forwardRef(function (props, ref) {
14
- var id = props.id,
15
- className = props.className,
16
- style = props.style,
17
- hoverClassName = props.hoverClassName,
18
- hoverStartTime = props.hoverStartTime,
19
- hoverStayTime = props.hoverStayTime,
20
- children = props.children,
21
- onLongClick = props.onLongClick,
22
- onTouchStart = props.onTouchStart,
23
- onTouchMove = props.onTouchMove,
24
- onTouchEnd = props.onTouchEnd,
25
- onTouchCancel = props.onTouchCancel,
26
- onClick = props.onClick,
27
- hoverable = props.hoverable,
28
- onTransitionEnd = props.onTransitionEnd,
29
- restProps = _objectWithoutProperties(props, _excluded);
30
-
31
- var _useTouch = useTouch({
12
+ const View = /*#__PURE__*/React.forwardRef((props, ref) => {
13
+ const {
14
+ id,
15
+ className,
16
+ style,
17
+ hoverClassName,
18
+ hoverStartTime,
19
+ hoverStayTime,
20
+ children,
21
+ onLongClick,
22
+ onTouchStart,
23
+ onTouchMove,
24
+ onTouchEnd,
25
+ onTouchCancel,
26
+ onClick,
27
+ hoverable,
28
+ onTransitionEnd
29
+ } = props,
30
+ restProps = _objectWithoutProperties(props, _excluded);
31
+ const [touching, handlers] = useTouch({
32
32
  hoverDelay: hoverStartTime,
33
33
  hoverDuration: hoverStayTime,
34
- onLongClick: onLongClick,
35
- onTouchStart: onTouchStart,
36
- onTouchMove: onTouchMove,
37
- onTouchEnd: onTouchEnd,
38
- onTouchCancel: onTouchCancel,
39
- onClick: onClick
40
- }),
41
- _useTouch2 = _slicedToArray(_useTouch, 2),
42
- touching = _useTouch2[0],
43
- handlers = _useTouch2[1];
44
-
45
- return /*#__PURE__*/React.createElement(RemaxView // @ts-ignore
34
+ onLongClick,
35
+ onTouchStart,
36
+ onTouchMove,
37
+ onTouchEnd,
38
+ onTouchCancel,
39
+ onClick
40
+ });
41
+ return /*#__PURE__*/React.createElement(RemaxView
42
+ // @ts-ignore
46
43
  , _extends({
47
44
  ref: ref,
48
45
  id: id,
49
46
  className: className,
50
47
  style: inlineStyle(style),
51
- hoverClassName: clsx(_defineProperty({}, styles.hover, hoverable), hoverClassName),
48
+ hoverClassName: clsx({
49
+ [styles.hover]: hoverable
50
+ }, hoverClassName),
52
51
  hoverStartTime: hoverStartTime,
53
52
  hoverStayTime: hoverStayTime,
54
53
  onTransitionEnd: onTransitionEnd
package/lib/View/props.js CHANGED
@@ -1,4 +1,4 @@
1
- export var defaultViewProps = {
1
+ export const defaultViewProps = {
2
2
  hoverStartTime: 20,
3
3
  hoverStayTime: 70
4
4
  };