@ray-js/components 1.3.21 → 1.3.23

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/LICENSE.md +9 -0
  2. package/lib/Button/Button.js +1 -3
  3. package/lib/Button/Button.thing.js +15 -17
  4. package/lib/Button/Button.wechat.js +15 -17
  5. package/lib/Button/props.js +1 -1
  6. package/lib/Camera/Camera.d.ts +2 -1
  7. package/lib/Camera/Camera.js +3 -3
  8. package/lib/Camera/Camera.thing.js +1 -3
  9. package/lib/Camera/Camera.wechat.d.ts +2 -1
  10. package/lib/Camera/Camera.wechat.js +2 -2
  11. package/lib/Checkbox/Checkbox.js +1 -3
  12. package/lib/Checkbox/Checkbox.thing.js +8 -9
  13. package/lib/Checkbox/Checkbox.wechat.js +9 -10
  14. package/lib/CheckboxGroup/CheckboxGroup.js +15 -19
  15. package/lib/CheckboxGroup/CheckboxGroup.thing.js +12 -17
  16. package/lib/CheckboxGroup/CheckboxGroup.wechat.js +12 -17
  17. package/lib/CheckboxGroup/props.d.ts +1 -1
  18. package/lib/CoverView/CoverView.js +1 -3
  19. package/lib/CoverView/CoverView.thing.js +1 -3
  20. package/lib/CoverView/CoverView.wechat.d.ts +2 -1
  21. package/lib/CoverView/CoverView.wechat.js +0 -2
  22. package/lib/CoverView/props.d.ts +1 -1
  23. package/lib/CoverView/props.js +1 -1
  24. package/lib/Form/Form.js +12 -12
  25. package/lib/Form/Form.thing.js +1 -3
  26. package/lib/Form/Form.wechat.js +19 -25
  27. package/lib/Form/props.d.ts +1 -1
  28. package/lib/Icon/Icon.js +10 -10
  29. package/lib/Icon/Icon.thing.js +10 -10
  30. package/lib/Icon/Icon.wechat.js +10 -10
  31. package/lib/Icon/iconfont/iconfont.js +13 -20
  32. package/lib/Icon/props.d.ts +1 -1
  33. package/lib/Icon/props.js +1 -1
  34. package/lib/Iframe/Iframe.d.ts +2 -1
  35. package/lib/Iframe/Iframe.js +3 -3
  36. package/lib/Iframe/Iframe.thing.js +1 -3
  37. package/lib/Iframe/Iframe.wechat.d.ts +2 -1
  38. package/lib/Iframe/Iframe.wechat.js +3 -3
  39. package/lib/Image/Image.js +6 -8
  40. package/lib/Image/Image.thing.js +8 -10
  41. package/lib/Image/Image.wechat.js +25 -32
  42. package/lib/Input/Input.js +28 -26
  43. package/lib/Input/Input.thing.js +35 -36
  44. package/lib/Input/Input.wechat.js +46 -47
  45. package/lib/Input/props.d.ts +1 -1
  46. package/lib/Input/props.js +1 -1
  47. package/lib/IpcPlayer/IpcPlayer.d.ts +2 -1
  48. package/lib/IpcPlayer/IpcPlayer.js +3 -3
  49. package/lib/IpcPlayer/IpcPlayer.thing.js +1 -3
  50. package/lib/IpcPlayer/IpcPlayer.wechat.d.ts +2 -1
  51. package/lib/IpcPlayer/IpcPlayer.wechat.js +2 -2
  52. package/lib/Label/Label.js +7 -8
  53. package/lib/Label/Label.thing.js +8 -8
  54. package/lib/Label/Label.wechat.js +8 -8
  55. package/lib/Map/Map.js +1 -3
  56. package/lib/Map/Map.thing.js +1 -3
  57. package/lib/Map/Map.wechat.js +1 -3
  58. package/lib/Modal/index.js +4 -2
  59. package/lib/Modal/index.web.js +6 -4
  60. package/lib/MovableArea/MovableArea.js +5 -4
  61. package/lib/MovableArea/MovableArea.thing.js +1 -3
  62. package/lib/MovableArea/MovableArea.wechat.js +1 -3
  63. package/lib/MovableView/MovableView.js +12 -11
  64. package/lib/MovableView/MovableView.thing.js +1 -3
  65. package/lib/MovableView/MovableView.wechat.js +1 -3
  66. package/lib/NativeVideo/NativeVideo.d.ts +2 -1
  67. package/lib/NativeVideo/NativeVideo.js +3 -3
  68. package/lib/NativeVideo/NativeVideo.thing.js +1 -3
  69. package/lib/NativeVideo/NativeVideo.wechat.d.ts +2 -1
  70. package/lib/NativeVideo/NativeVideo.wechat.js +2 -2
  71. package/lib/PageContainer/PageContainer.js +12 -19
  72. package/lib/PageContainer/PageContainer.thing.d.ts +2 -1
  73. package/lib/PageContainer/PageContainer.thing.js +0 -2
  74. package/lib/PageContainer/PageContainer.wechat.d.ts +2 -1
  75. package/lib/PageContainer/PageContainer.wechat.js +0 -2
  76. package/lib/PageContainer/props.d.ts +2 -2
  77. package/lib/PageContainer/props.js +3 -3
  78. package/lib/Picker/Picker.js +22 -31
  79. package/lib/Picker/Picker.thing.js +25 -31
  80. package/lib/Picker/Picker.wechat.js +25 -31
  81. package/lib/PickerView/PickerView.js +23 -34
  82. package/lib/PickerView/PickerView.thing.js +16 -19
  83. package/lib/PickerView/PickerView.wechat.js +16 -19
  84. package/lib/PickerViewColumn/PickerViewColumn.js +4 -4
  85. package/lib/PickerViewColumn/PickerViewColumn.thing.js +6 -7
  86. package/lib/PickerViewColumn/PickerViewColumn.wechat.js +6 -7
  87. package/lib/Progress/Progress.js +1 -3
  88. package/lib/Progress/Progress.thing.js +6 -7
  89. package/lib/Progress/Progress.wechat.js +6 -7
  90. package/lib/Radio/Radio.js +1 -3
  91. package/lib/Radio/Radio.thing.js +8 -9
  92. package/lib/Radio/Radio.wechat.js +9 -10
  93. package/lib/RadioGroup/RadioGroup.js +12 -18
  94. package/lib/RadioGroup/RadioGroup.thing.js +15 -21
  95. package/lib/RadioGroup/RadioGroup.wechat.js +12 -17
  96. package/lib/RadioGroup/props.d.ts +1 -1
  97. package/lib/RichText/RichText.js +1 -1
  98. package/lib/RichText/RichText.thing.js +1 -3
  99. package/lib/RichText/RichText.wechat.js +1 -3
  100. package/lib/ScrollView/ScrollView.js +12 -13
  101. package/lib/ScrollView/ScrollView.thing.js +6 -7
  102. package/lib/ScrollView/ScrollView.wechat.js +6 -7
  103. package/lib/Slider/Slider.js +4 -8
  104. package/lib/Slider/Slider.thing.js +13 -14
  105. package/lib/Slider/Slider.wechat.js +14 -15
  106. package/lib/Slider/props.js +1 -1
  107. package/lib/Swiper/Swiper.d.ts +1 -1
  108. package/lib/Swiper/Swiper.js +23 -33
  109. package/lib/Swiper/Swiper.thing.d.ts +1 -1
  110. package/lib/Swiper/Swiper.thing.js +17 -24
  111. package/lib/Swiper/Swiper.wechat.d.ts +1 -1
  112. package/lib/Swiper/Swiper.wechat.js +17 -24
  113. package/lib/Swiper/props.d.ts +1 -1
  114. package/lib/Swiper/props.js +2 -2
  115. package/lib/SwiperItem/SwiperItem.js +4 -4
  116. package/lib/SwiperItem/SwiperItem.thing.js +8 -9
  117. package/lib/SwiperItem/SwiperItem.wechat.js +8 -9
  118. package/lib/Switch/Switch.js +5 -8
  119. package/lib/Switch/Switch.thing.js +12 -14
  120. package/lib/Switch/Switch.wechat.js +12 -14
  121. package/lib/Switch/props.js +1 -1
  122. package/lib/Text/Text.js +1 -3
  123. package/lib/Text/Text.thing.js +1 -3
  124. package/lib/Text/Text.wechat.js +19 -25
  125. package/lib/Textarea/Textarea.js +13 -14
  126. package/lib/Textarea/Textarea.thing.js +25 -22
  127. package/lib/Textarea/Textarea.wechat.js +25 -22
  128. package/lib/Textarea/props.d.ts +1 -1
  129. package/lib/View/View.js +28 -32
  130. package/lib/View/View.thing.js +33 -35
  131. package/lib/View/View.wechat.js +33 -35
  132. package/lib/View/props.js +1 -1
  133. package/lib/WebView/WebView.js +1 -3
  134. package/lib/WebView/WebView.thing.js +1 -3
  135. package/lib/WebView/WebView.wechat.js +1 -3
  136. package/lib/assets/icons.js +1 -1
  137. package/lib/core/index.js +5 -12
  138. package/lib/types/event.d.ts +1 -1
  139. package/lib/types/index.js +1 -0
  140. package/lib/utils/handleProps.js +26 -41
  141. package/package.json +7 -7
@@ -1,27 +1,23 @@
1
- import "core-js/modules/es.array.map.js";
2
1
  import * as React from 'react';
3
2
  import { RadioGroup as RemaxRadioGroup } from '@ray-core/wechat';
4
3
  import Radio from '../Radio';
5
4
  import Label from '../Label';
6
-
7
- var RadioGroup = function (props) {
8
- var options = props.options,
9
- name = props.name,
10
- disabled = props.disabled,
11
- _props$onChange = props.onChange,
12
- onChange = _props$onChange === void 0 ? function () {} : _props$onChange,
13
- children = props.children;
5
+ const RadioGroup = props => {
6
+ const {
7
+ options,
8
+ name,
9
+ disabled,
10
+ onChange = () => {},
11
+ children
12
+ } = props;
14
13
  return /*#__PURE__*/React.createElement(RemaxRadioGroup, {
15
14
  name: name,
16
- onChange: function handleOnChange(e) {
15
+ onChange: e => {
17
16
  !disabled && onChange(e);
18
17
  }
19
- }, function renderChildren() {
20
- return children;
21
- }() || function renderOptions() {
22
- return options.map(function (item, index) {
18
+ }, (() => children)() || (() => {
19
+ return options.map((item, index) => {
23
20
  var _item$checked;
24
-
25
21
  return /*#__PURE__*/React.createElement(Label, {
26
22
  key: index + '_' + item.value
27
23
  }, /*#__PURE__*/React.createElement(Radio, {
@@ -31,7 +27,6 @@ var RadioGroup = function (props) {
31
27
  color: item.color
32
28
  }), item.label);
33
29
  });
34
- }());
30
+ })());
35
31
  };
36
-
37
32
  export default RadioGroup;
@@ -1,6 +1,6 @@
1
1
  import { BaseProps } from '../types';
2
2
  import { RadioProps } from '../Radio/props';
3
- export declare type RadioGroupOption = RadioProps & {
3
+ export type RadioGroupOption = RadioProps & {
4
4
  label: string;
5
5
  };
6
6
  export interface RadioGroupProps extends BaseProps {
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import handleProps from '../utils/handleProps';
3
- export var RichText = function (props) {
3
+ export const RichText = props => {
4
4
  // @ts-ignore
5
5
  return /*#__PURE__*/React.createElement("v-rich-text", handleProps(props));
6
6
  };
@@ -1,8 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { RichText as RemaxRichText } from '@ray-js/adapter';
3
-
4
- var RichText = function (props) {
3
+ const RichText = props => {
5
4
  return /*#__PURE__*/React.createElement(RemaxRichText, props);
6
5
  };
7
-
8
6
  export default RichText;
@@ -1,8 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { RichText as RemaxRichText } from '@ray-js/adapter';
3
-
4
- var RichText = function (props) {
3
+ const RichText = props => {
5
4
  return /*#__PURE__*/React.createElement(RemaxRichText, props);
6
5
  };
7
-
8
6
  export default RichText;
@@ -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,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { SwiperProps } from './props';
3
- declare function Swiper<I, C extends React.FC>(props: SwiperProps<I>): JSX.Element;
3
+ declare function Swiper<I, C extends React.FC>(props: SwiperProps<I>): React.JSX.Element;
4
4
  declare namespace Swiper {
5
5
  var defaultProps: Partial<SwiperProps<any>>;
6
6
  }
@@ -1,53 +1,44 @@
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"];
6
4
  // import clsx from 'clsx';
7
5
  import * as React from 'react';
8
6
  import handleProps from '../utils/handleProps';
9
7
  import { defaultSwiperProps } from './props';
10
8
  import { useEventListener } from 'ahooks';
11
-
12
9
  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 () {
10
+ const {
11
+ id,
12
+ style,
13
+ className,
14
+ current,
15
+ dataSource,
16
+ onAfterChange,
17
+ onChange,
18
+ renderItem,
19
+ children
20
+ } = props,
21
+ restProps = _objectWithoutProperties(props, _excluded);
22
+ const [internalCurrent, setInternalCurrent] = React.useState(current);
23
+ const bufferCurrent = React.useRef(current);
24
+ const currentNode = React.useRef(null);
25
+ React.useEffect(() => {
32
26
  if (bufferCurrent.current !== current) {
33
27
  setInternalCurrent(current);
34
28
  }
35
29
  }, [current]);
36
-
37
30
  function handleChange(event) {
38
31
  onChange === null || onChange === void 0 ? void 0 : onChange(event === null || event === void 0 ? void 0 : event.detail);
39
32
  }
40
-
41
33
  function handleAfterChange(event) {
42
34
  onAfterChange === null || onAfterChange === void 0 ? void 0 : onAfterChange(event === null || event === void 0 ? void 0 : event.detail);
43
35
  }
44
-
45
- useEventListener('change', function (e) {
36
+ useEventListener('change', e => {
46
37
  handleChange(e);
47
38
  }, {
48
39
  target: currentNode
49
40
  });
50
- useEventListener('onanimationend', function (e) {
41
+ useEventListener('onanimationend', e => {
51
42
  handleAfterChange(e);
52
43
  }, {
53
44
  target: currentNode
@@ -57,18 +48,17 @@ function Swiper(props) {
57
48
  // @ts-ignore
58
49
  React.createElement("v-swiper", _extends({
59
50
  ref: currentNode
60
- }, handleProps(restProps)), function renderChildren() {
51
+ }, handleProps(restProps)), (() => {
61
52
  return children;
62
- }() || function renderSwiperItem() {
63
- return dataSource.map(function (item, index) {
53
+ })() || (() => {
54
+ return dataSource.map((item, index) => {
64
55
  // @ts-ignore
65
56
  return /*#__PURE__*/React.createElement("v-swiper-item", {
66
57
  key: index
67
58
  }, renderItem(item, index));
68
59
  });
69
- }())
60
+ })())
70
61
  );
71
62
  }
72
-
73
63
  Swiper.defaultProps = defaultSwiperProps;
74
64
  export default Swiper;
@@ -1,4 +1,4 @@
1
1
  import * as React from 'react';
2
2
  import { SwiperProps } from './props';
3
- declare function Swiper<I, C extends React.FC>(props: SwiperProps<I>): JSX.Element;
3
+ declare function Swiper<I, C extends React.FC>(props: SwiperProps<I>): React.JSX.Element;
4
4
  export default Swiper;
@@ -1,34 +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 = ["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"];
6
4
  import clsx from 'clsx';
7
5
  import * as React from 'react';
8
6
  import { inlineStyle } from '@ray-js/framework-shared';
9
7
  import { Swiper as RemaxSwiper, SwiperItem as RemaxSwiperItem } from '@ray-js/adapter';
10
8
  import { propsAlias } from '../core';
11
9
  import { SwiperPropsAlias } from './props';
12
-
13
10
  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 () {
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
+ React.useEffect(() => {
32
26
  if (bufferCurrent.current !== current) {
33
27
  setInternalCurrent(current);
34
28
  bufferCurrent.current = current;
@@ -48,12 +42,11 @@ function Swiper(props) {
48
42
  }, propsAlias(restProps, SwiperPropsAlias)), function () {
49
43
  return children;
50
44
  }() || function () {
51
- return dataSource.map(function (item, index) {
45
+ return dataSource.map((item, index) => {
52
46
  return /*#__PURE__*/React.createElement(RemaxSwiperItem, {
53
47
  key: index
54
48
  }, renderItem(item, index));
55
49
  });
56
50
  }());
57
51
  }
58
-
59
52
  export default Swiper;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { SwiperProps } from './props';
3
- declare function Swiper<I, C extends React.FC>(props: SwiperProps<I>): JSX.Element;
3
+ declare function Swiper<I, C extends React.FC>(props: SwiperProps<I>): React.JSX.Element;
4
4
  declare namespace Swiper {
5
5
  var defaultProps: Partial<SwiperProps<any>>;
6
6
  }
@@ -1,34 +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 = ["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"];
6
4
  import clsx from 'clsx';
7
5
  import * as React from 'react';
8
6
  import { inlineStyle } from '@ray-js/framework-shared';
9
7
  import { Swiper as RemaxSwiper, SwiperItem as RemaxSwiperItem } from '@ray-core/wechat';
10
8
  import { propsAlias } from '../core';
11
9
  import { SwiperPropsAlias, defaultSwiperProps } from './props';
12
-
13
10
  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 () {
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
+ React.useEffect(() => {
32
26
  if (bufferCurrent.current !== current) {
33
27
  setInternalCurrent(current);
34
28
  bufferCurrent.current = current;
@@ -48,13 +42,12 @@ function Swiper(props) {
48
42
  }, propsAlias(restProps, SwiperPropsAlias)), function () {
49
43
  return children;
50
44
  }() || function () {
51
- return dataSource.map(function (item, index) {
45
+ return dataSource.map((item, index) => {
52
46
  return /*#__PURE__*/React.createElement(RemaxSwiperItem, {
53
47
  key: index
54
48
  }, renderItem(item, index));
55
49
  });
56
50
  }());
57
51
  }
58
-
59
52
  Swiper.defaultProps = defaultSwiperProps;
60
53
  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;