@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,20 +1,20 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- var _excluded = ["onScroll", "onScrollToUpper", "onScrollToLower"];
4
+ const _excluded = ["onScroll", "onScrollToUpper", "onScrollToLower"];
5
5
  import React from 'react';
6
6
  import { useEventListener } from 'ahooks';
7
7
  import { ScrollView as ScrollViewDef } from '@ray-js/adapter';
8
8
  import handleProps from '../utils/handleProps';
9
-
10
- var ScrollView = function (props) {
11
- var onScroll = props.onScroll,
12
- onScrollToUpper = props.onScrollToUpper,
13
- onScrollToLower = props.onScrollToLower,
14
- restProps = _objectWithoutProperties(props, _excluded);
15
-
16
- var currentNode = React.useRef(null);
17
- useEventListener('scroll', function (e) {
9
+ const ScrollView = props => {
10
+ const {
11
+ onScroll,
12
+ onScrollToUpper,
13
+ onScrollToLower
14
+ } = props,
15
+ restProps = _objectWithoutProperties(props, _excluded);
16
+ const currentNode = React.useRef(null);
17
+ useEventListener('scroll', e => {
18
18
  onScroll === null || onScroll === void 0 ? void 0 : onScroll(_objectSpread(_objectSpread({
19
19
  type: 'scroll'
20
20
  }, e.detail), {}, {
@@ -23,7 +23,7 @@ var ScrollView = function (props) {
23
23
  }, {
24
24
  target: currentNode
25
25
  });
26
- useEventListener('scrolltoupper', function (e) {
26
+ useEventListener('scrolltoupper', e => {
27
27
  onScrollToUpper === null || onScrollToUpper === void 0 ? void 0 : onScrollToUpper(_objectSpread(_objectSpread({
28
28
  type: 'scrolltoupper'
29
29
  }, e.detail), {}, {
@@ -32,7 +32,7 @@ var ScrollView = function (props) {
32
32
  }, {
33
33
  target: currentNode
34
34
  });
35
- useEventListener('scrolltolower', function (e) {
35
+ useEventListener('scrolltolower', e => {
36
36
  onScrollToLower === null || onScrollToLower === void 0 ? void 0 : onScrollToLower(_objectSpread(_objectSpread({
37
37
  type: 'scrolltolower'
38
38
  }, e.detail), {}, {
@@ -49,6 +49,5 @@ var ScrollView = function (props) {
49
49
  }), props.children)
50
50
  );
51
51
  };
52
-
53
52
  ScrollView.defaultProps = ScrollViewDef.defaultProps;
54
53
  export default ScrollView;
@@ -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
- var _excluded = ["style"];
3
+ const _excluded = ["style"];
4
4
  import * as React from 'react';
5
5
  import { inlineStyle } from '@ray-js/framework-shared';
6
6
  import { ScrollView as RemaxScrollView } from '@ray-js/adapter';
7
-
8
- var ScrollView = function (props) {
9
- var style = props.style,
10
- restProps = _objectWithoutProperties(props, _excluded);
11
-
7
+ const ScrollView = props => {
8
+ const {
9
+ style
10
+ } = props,
11
+ restProps = _objectWithoutProperties(props, _excluded);
12
12
  return /*#__PURE__*/React.createElement(RemaxScrollView, _extends({
13
13
  style: inlineStyle(style)
14
14
  }, restProps));
15
15
  };
16
-
17
16
  export default ScrollView;
@@ -1,20 +1,19 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["style"];
3
+ const _excluded = ["style"];
4
4
  import * as React from 'react';
5
5
  import { inlineStyle } from '@ray-js/framework-shared';
6
6
  import { ScrollView as RemaxScrollView } from '@ray-core/wechat';
7
7
  import { ScrollView as ScrollViewDef } from '@ray-js/adapter';
8
-
9
- var ScrollView = function (props) {
10
- var style = props.style,
11
- restProps = _objectWithoutProperties(props, _excluded);
12
-
8
+ const ScrollView = props => {
9
+ const {
10
+ style
11
+ } = props,
12
+ restProps = _objectWithoutProperties(props, _excluded);
13
13
  return /*#__PURE__*/React.createElement(RemaxScrollView, _extends({
14
14
  style: inlineStyle(style),
15
15
  enhanced: true
16
16
  }, restProps));
17
17
  };
18
-
19
18
  ScrollView.defaultProps = ScrollViewDef.defaultProps;
20
19
  export default ScrollView;
@@ -2,12 +2,10 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { useEventListener } from 'ahooks';
4
4
  import handleProps from '../utils/handleProps';
5
-
6
- var Slider = function (props) {
7
- var currentNode = React.useRef(null);
8
- useEventListener('change', function (e) {
5
+ const Slider = props => {
6
+ const currentNode = React.useRef(null);
7
+ useEventListener('change', e => {
9
8
  var _props$onChange;
10
-
11
9
  (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
12
10
  type: 'change',
13
11
  value: e.detail.value,
@@ -16,9 +14,8 @@ var Slider = function (props) {
16
14
  }, {
17
15
  target: currentNode
18
16
  });
19
- useEventListener('changing', function (e) {
17
+ useEventListener('changing', e => {
20
18
  var _props$onChanging;
21
-
22
19
  (_props$onChanging = props.onChanging) === null || _props$onChanging === void 0 ? void 0 : _props$onChanging.call(props, {
23
20
  type: 'changing',
24
21
  value: e.detail.value,
@@ -35,5 +32,4 @@ var Slider = function (props) {
35
32
  }))
36
33
  );
37
34
  };
38
-
39
35
  export default Slider;
@@ -1,30 +1,30 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["id", "style", "className", "children", "onChange", "onChanging"];
3
+ const _excluded = ["id", "style", "className", "children", "onChange", "onChanging"];
4
4
  import * as React from 'react';
5
5
  import { inlineStyle } from '@ray-js/framework-shared';
6
6
  import { Slider as RemaxSlider } from '@ray-js/adapter';
7
-
8
- var Slider = function (props) {
9
- var id = props.id,
10
- style = props.style,
11
- className = props.className,
12
- children = props.children,
13
- onChange = props.onChange,
14
- onChanging = props.onChanging,
15
- restProps = _objectWithoutProperties(props, _excluded);
16
-
7
+ const Slider = props => {
8
+ const {
9
+ id,
10
+ style,
11
+ className,
12
+ children,
13
+ onChange,
14
+ onChanging
15
+ } = props,
16
+ restProps = _objectWithoutProperties(props, _excluded);
17
17
  return /*#__PURE__*/React.createElement(RemaxSlider, _extends({
18
18
  id: id,
19
19
  style: inlineStyle(style),
20
- onChange: function handleChange(e) {
20
+ onChange: e => {
21
21
  typeof onChange === 'function' && onChange({
22
22
  type: 'change',
23
23
  value: e.detail.value,
24
24
  origin: e
25
25
  });
26
26
  },
27
- onChanging: function handleChanging(e) {
27
+ onChanging: e => {
28
28
  typeof onChanging === 'function' && onChanging({
29
29
  type: 'changing',
30
30
  value: e.detail.value,
@@ -33,5 +33,4 @@ var Slider = function (props) {
33
33
  }
34
34
  }, restProps));
35
35
  };
36
-
37
36
  export default Slider;
@@ -1,31 +1,31 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["id", "style", "className", "children", "onChange", "onChanging", "activeColor"];
3
+ const _excluded = ["id", "style", "className", "children", "onChange", "onChanging", "activeColor"];
4
4
  import * as React from 'react';
5
5
  import { inlineStyle } from '@ray-js/framework-shared';
6
6
  import { Slider as RemaxSlider } from '@ray-core/wechat';
7
-
8
- var Slider = function (props) {
9
- var id = props.id,
10
- style = props.style,
11
- className = props.className,
12
- children = props.children,
13
- onChange = props.onChange,
14
- onChanging = props.onChanging,
15
- activeColor = props.activeColor,
16
- restProps = _objectWithoutProperties(props, _excluded);
17
-
7
+ const Slider = props => {
8
+ const {
9
+ id,
10
+ style,
11
+ className,
12
+ children,
13
+ onChange,
14
+ onChanging,
15
+ activeColor
16
+ } = props,
17
+ restProps = _objectWithoutProperties(props, _excluded);
18
18
  return /*#__PURE__*/React.createElement(RemaxSlider, _extends({
19
19
  id: id,
20
20
  style: inlineStyle(style),
21
- onChange: function handleChange(e) {
21
+ onChange: e => {
22
22
  typeof onChange === 'function' && onChange({
23
23
  type: 'change',
24
24
  value: e.detail.value,
25
25
  origin: e
26
26
  });
27
27
  },
28
- onChanging: function handleChanging(e) {
28
+ onChanging: e => {
29
29
  typeof onChanging === 'function' && onChanging({
30
30
  type: 'changing',
31
31
  value: e.detail.value,
@@ -36,5 +36,4 @@ var Slider = function (props) {
36
36
  activeColor: '#007aff' || activeColor
37
37
  }, restProps));
38
38
  };
39
-
40
39
  export default Slider;
@@ -1,4 +1,4 @@
1
- export var sliderDefault = {
1
+ export const sliderDefault = {
2
2
  blockSize: 28,
3
3
  activeColor: '#007AFF',
4
4
  backgroundColor: 'rgba(0, 0, 0, 0.2)',
@@ -1,53 +1,45 @@
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 handleProps from '../utils/handleProps';
9
8
  import { defaultSwiperProps } from './props';
10
9
  import { useEventListener } from 'ahooks';
11
-
12
10
  function Swiper(props) {
13
- var id = props.id,
14
- style = props.style,
15
- className = props.className,
16
- current = props.current,
17
- dataSource = props.dataSource,
18
- onAfterChange = props.onAfterChange,
19
- onChange = props.onChange,
20
- renderItem = props.renderItem,
21
- children = props.children,
22
- restProps = _objectWithoutProperties(props, _excluded);
23
-
24
- var _React$useState = React.useState(current),
25
- _React$useState2 = _slicedToArray(_React$useState, 2),
26
- internalCurrent = _React$useState2[0],
27
- setInternalCurrent = _React$useState2[1];
28
-
29
- var bufferCurrent = React.useRef(current);
30
- var currentNode = React.useRef(null);
31
- React.useEffect(function () {
11
+ const {
12
+ id,
13
+ style,
14
+ className,
15
+ current,
16
+ dataSource,
17
+ onAfterChange,
18
+ onChange,
19
+ renderItem,
20
+ children
21
+ } = props,
22
+ restProps = _objectWithoutProperties(props, _excluded);
23
+ const [internalCurrent, setInternalCurrent] = React.useState(current);
24
+ const bufferCurrent = React.useRef(current);
25
+ const currentNode = React.useRef(null);
26
+ React.useEffect(() => {
32
27
  if (bufferCurrent.current !== current) {
33
28
  setInternalCurrent(current);
34
29
  }
35
30
  }, [current]);
36
-
37
31
  function handleChange(event) {
38
32
  onChange === null || onChange === void 0 ? void 0 : onChange(event === null || event === void 0 ? void 0 : event.detail);
39
33
  }
40
-
41
34
  function handleAfterChange(event) {
42
35
  onAfterChange === null || onAfterChange === void 0 ? void 0 : onAfterChange(event === null || event === void 0 ? void 0 : event.detail);
43
36
  }
44
-
45
- useEventListener('change', function (e) {
37
+ useEventListener('change', e => {
46
38
  handleChange(e);
47
39
  }, {
48
40
  target: currentNode
49
41
  });
50
- useEventListener('onanimationend', function (e) {
42
+ useEventListener('onanimationend', e => {
51
43
  handleAfterChange(e);
52
44
  }, {
53
45
  target: currentNode
@@ -57,18 +49,17 @@ function Swiper(props) {
57
49
  // @ts-ignore
58
50
  React.createElement("v-swiper", _extends({
59
51
  ref: currentNode
60
- }, handleProps(restProps)), function renderChildren() {
52
+ }, handleProps(restProps)), (() => {
61
53
  return children;
62
- }() || function renderSwiperItem() {
63
- return dataSource.map(function (item, index) {
54
+ })() || (() => {
55
+ return dataSource.map((item, index) => {
64
56
  // @ts-ignore
65
57
  return /*#__PURE__*/React.createElement("v-swiper-item", {
66
58
  key: index
67
59
  }, renderItem(item, index));
68
60
  });
69
- }())
61
+ })())
70
62
  );
71
63
  }
72
-
73
64
  Swiper.defaultProps = defaultSwiperProps;
74
65
  export default Swiper;
@@ -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-js/adapter';
10
9
  import { propsAlias } from '../core';
11
10
  import { SwiperPropsAlias } 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,12 +43,11 @@ 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
  export default Swiper;
@@ -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,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;