@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.
- package/LICENSE.md +9 -0
- package/lib/Button/Button.js +1 -3
- package/lib/Button/Button.thing.js +15 -17
- package/lib/Button/Button.wechat.js +15 -17
- package/lib/Button/props.js +1 -1
- package/lib/Camera/Camera.d.ts +2 -1
- package/lib/Camera/Camera.js +3 -3
- package/lib/Camera/Camera.thing.js +1 -3
- package/lib/Camera/Camera.wechat.d.ts +2 -1
- package/lib/Camera/Camera.wechat.js +2 -2
- package/lib/Checkbox/Checkbox.js +1 -3
- package/lib/Checkbox/Checkbox.thing.js +8 -9
- package/lib/Checkbox/Checkbox.wechat.js +9 -10
- package/lib/CheckboxGroup/CheckboxGroup.js +15 -19
- package/lib/CheckboxGroup/CheckboxGroup.thing.js +12 -17
- package/lib/CheckboxGroup/CheckboxGroup.wechat.js +12 -17
- package/lib/CheckboxGroup/props.d.ts +1 -1
- package/lib/CoverView/CoverView.js +1 -3
- package/lib/CoverView/CoverView.thing.js +1 -3
- package/lib/CoverView/CoverView.wechat.d.ts +2 -1
- package/lib/CoverView/CoverView.wechat.js +0 -2
- package/lib/CoverView/props.d.ts +1 -1
- package/lib/CoverView/props.js +1 -1
- package/lib/Form/Form.js +12 -12
- package/lib/Form/Form.thing.js +1 -3
- package/lib/Form/Form.wechat.js +19 -25
- package/lib/Form/props.d.ts +1 -1
- package/lib/Icon/Icon.js +10 -10
- package/lib/Icon/Icon.thing.js +10 -10
- package/lib/Icon/Icon.wechat.js +10 -10
- package/lib/Icon/iconfont/iconfont.js +13 -20
- package/lib/Icon/props.d.ts +1 -1
- package/lib/Icon/props.js +1 -1
- package/lib/Iframe/Iframe.d.ts +2 -1
- package/lib/Iframe/Iframe.js +3 -3
- package/lib/Iframe/Iframe.thing.js +1 -3
- package/lib/Iframe/Iframe.wechat.d.ts +2 -1
- package/lib/Iframe/Iframe.wechat.js +3 -3
- package/lib/Image/Image.js +6 -8
- package/lib/Image/Image.thing.js +8 -10
- package/lib/Image/Image.wechat.js +25 -32
- package/lib/Input/Input.js +28 -26
- package/lib/Input/Input.thing.js +35 -36
- package/lib/Input/Input.wechat.js +46 -47
- package/lib/Input/props.d.ts +1 -1
- package/lib/Input/props.js +1 -1
- package/lib/IpcPlayer/IpcPlayer.d.ts +2 -1
- package/lib/IpcPlayer/IpcPlayer.js +3 -3
- package/lib/IpcPlayer/IpcPlayer.thing.js +1 -3
- package/lib/IpcPlayer/IpcPlayer.wechat.d.ts +2 -1
- package/lib/IpcPlayer/IpcPlayer.wechat.js +2 -2
- package/lib/Label/Label.js +7 -8
- package/lib/Label/Label.thing.js +8 -8
- package/lib/Label/Label.wechat.js +8 -8
- package/lib/Map/Map.js +1 -3
- package/lib/Map/Map.thing.js +1 -3
- package/lib/Map/Map.wechat.js +1 -3
- package/lib/Modal/index.js +4 -2
- package/lib/Modal/index.web.js +6 -4
- package/lib/MovableArea/MovableArea.js +5 -4
- package/lib/MovableArea/MovableArea.thing.js +1 -3
- package/lib/MovableArea/MovableArea.wechat.js +1 -3
- package/lib/MovableView/MovableView.js +12 -11
- package/lib/MovableView/MovableView.thing.js +1 -3
- package/lib/MovableView/MovableView.wechat.js +1 -3
- package/lib/NativeVideo/NativeVideo.d.ts +2 -1
- package/lib/NativeVideo/NativeVideo.js +3 -3
- package/lib/NativeVideo/NativeVideo.thing.js +1 -3
- package/lib/NativeVideo/NativeVideo.wechat.d.ts +2 -1
- package/lib/NativeVideo/NativeVideo.wechat.js +2 -2
- package/lib/PageContainer/PageContainer.js +12 -19
- package/lib/PageContainer/PageContainer.thing.d.ts +2 -1
- package/lib/PageContainer/PageContainer.thing.js +0 -2
- package/lib/PageContainer/PageContainer.wechat.d.ts +2 -1
- package/lib/PageContainer/PageContainer.wechat.js +0 -2
- package/lib/PageContainer/props.d.ts +2 -2
- package/lib/PageContainer/props.js +3 -3
- package/lib/Picker/Picker.js +22 -31
- package/lib/Picker/Picker.thing.js +25 -31
- package/lib/Picker/Picker.wechat.js +25 -31
- package/lib/PickerView/PickerView.js +23 -34
- package/lib/PickerView/PickerView.thing.js +16 -19
- package/lib/PickerView/PickerView.wechat.js +16 -19
- package/lib/PickerViewColumn/PickerViewColumn.js +4 -4
- package/lib/PickerViewColumn/PickerViewColumn.thing.js +6 -7
- package/lib/PickerViewColumn/PickerViewColumn.wechat.js +6 -7
- package/lib/Progress/Progress.js +1 -3
- package/lib/Progress/Progress.thing.js +6 -7
- package/lib/Progress/Progress.wechat.js +6 -7
- package/lib/Radio/Radio.js +1 -3
- package/lib/Radio/Radio.thing.js +8 -9
- package/lib/Radio/Radio.wechat.js +9 -10
- package/lib/RadioGroup/RadioGroup.js +12 -18
- package/lib/RadioGroup/RadioGroup.thing.js +15 -21
- package/lib/RadioGroup/RadioGroup.wechat.js +12 -17
- package/lib/RadioGroup/props.d.ts +1 -1
- package/lib/RichText/RichText.js +1 -1
- package/lib/RichText/RichText.thing.js +1 -3
- package/lib/RichText/RichText.wechat.js +1 -3
- package/lib/ScrollView/ScrollView.js +12 -13
- package/lib/ScrollView/ScrollView.thing.js +6 -7
- package/lib/ScrollView/ScrollView.wechat.js +6 -7
- package/lib/Slider/Slider.js +4 -8
- package/lib/Slider/Slider.thing.js +13 -14
- package/lib/Slider/Slider.wechat.js +14 -15
- package/lib/Slider/props.js +1 -1
- package/lib/Swiper/Swiper.d.ts +1 -1
- package/lib/Swiper/Swiper.js +23 -33
- package/lib/Swiper/Swiper.thing.d.ts +1 -1
- package/lib/Swiper/Swiper.thing.js +17 -24
- package/lib/Swiper/Swiper.wechat.d.ts +1 -1
- package/lib/Swiper/Swiper.wechat.js +17 -24
- package/lib/Swiper/props.d.ts +1 -1
- package/lib/Swiper/props.js +2 -2
- package/lib/SwiperItem/SwiperItem.js +4 -4
- package/lib/SwiperItem/SwiperItem.thing.js +8 -9
- package/lib/SwiperItem/SwiperItem.wechat.js +8 -9
- package/lib/Switch/Switch.js +5 -8
- package/lib/Switch/Switch.thing.js +12 -14
- package/lib/Switch/Switch.wechat.js +12 -14
- package/lib/Switch/props.js +1 -1
- package/lib/Text/Text.js +1 -3
- package/lib/Text/Text.thing.js +1 -3
- package/lib/Text/Text.wechat.js +19 -25
- package/lib/Textarea/Textarea.js +13 -14
- package/lib/Textarea/Textarea.thing.js +25 -22
- package/lib/Textarea/Textarea.wechat.js +25 -22
- package/lib/Textarea/props.d.ts +1 -1
- package/lib/View/View.js +28 -32
- package/lib/View/View.thing.js +33 -35
- package/lib/View/View.wechat.js +33 -35
- package/lib/View/props.js +1 -1
- package/lib/WebView/WebView.js +1 -3
- package/lib/WebView/WebView.thing.js +1 -3
- package/lib/WebView/WebView.wechat.js +1 -3
- package/lib/assets/icons.js +1 -1
- package/lib/core/index.js +5 -12
- package/lib/types/event.d.ts +1 -1
- package/lib/types/index.js +1 -0
- package/lib/utils/handleProps.js +26 -41
- 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
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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:
|
15
|
+
onChange: e => {
|
17
16
|
!disabled && onChange(e);
|
18
17
|
}
|
19
|
-
},
|
20
|
-
return
|
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;
|
package/lib/RichText/RichText.js
CHANGED
@@ -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
|
-
|
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
|
-
|
11
|
-
|
12
|
-
onScrollToUpper
|
13
|
-
onScrollToLower
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
useEventListener('scroll',
|
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',
|
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',
|
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
|
-
|
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
|
-
|
9
|
-
|
10
|
-
|
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
|
-
|
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
|
-
|
10
|
-
|
11
|
-
|
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;
|
package/lib/Slider/Slider.js
CHANGED
@@ -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
|
-
|
7
|
-
|
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',
|
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
|
-
|
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
|
-
|
9
|
-
|
10
|
-
style
|
11
|
-
className
|
12
|
-
children
|
13
|
-
onChange
|
14
|
-
onChanging
|
15
|
-
|
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:
|
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:
|
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
|
-
|
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
|
-
|
9
|
-
|
10
|
-
style
|
11
|
-
className
|
12
|
-
children
|
13
|
-
onChange
|
14
|
-
onChanging
|
15
|
-
activeColor
|
16
|
-
|
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:
|
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:
|
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;
|
package/lib/Slider/props.js
CHANGED
package/lib/Swiper/Swiper.d.ts
CHANGED
@@ -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
|
}
|
package/lib/Swiper/Swiper.js
CHANGED
@@ -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
|
-
|
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
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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',
|
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)),
|
51
|
+
}, handleProps(restProps)), (() => {
|
61
52
|
return children;
|
62
|
-
}() ||
|
63
|
-
return dataSource.map(
|
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
|
-
|
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
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
var bufferCurrent = React.useRef(current);
|
31
|
-
React.useEffect(function () {
|
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(
|
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
|
-
|
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
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
var bufferCurrent = React.useRef(current);
|
31
|
-
React.useEffect(function () {
|
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(
|
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;
|
package/lib/Swiper/props.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { BaseProps } from '../types';
|
3
3
|
import { GenericEvent as WxEvent } from '@ray-core/wechat';
|
4
|
-
export
|
4
|
+
export type SwiperProps<I> = BaseProps & {
|
5
5
|
/**
|
6
6
|
* @description.en Whether to display panel points
|
7
7
|
* @description.zh 是否显示面板指示点
|
package/lib/Swiper/props.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
export
|
1
|
+
export const defaultSwiperProps = {
|
2
2
|
autoplay: false,
|
3
3
|
circular: false,
|
4
4
|
current: 0,
|
@@ -9,7 +9,7 @@ export var defaultSwiperProps = {
|
|
9
9
|
interval: 5000,
|
10
10
|
vertical: false
|
11
11
|
};
|
12
|
-
export
|
12
|
+
export const SwiperPropsAlias = {
|
13
13
|
dotActiveColor: 'indicatorActiveColor',
|
14
14
|
dotColor: 'indicatorColor',
|
15
15
|
dots: 'indicatorDots'
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import handleProps from '../utils/handleProps';
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
const SwiperItem = props => {
|
4
|
+
const {
|
5
|
+
children
|
6
|
+
} = props;
|
6
7
|
return (
|
7
8
|
/*#__PURE__*/
|
8
9
|
// @ts-ignore
|
9
10
|
React.createElement("v-swiper-item", handleProps(props), children)
|
10
11
|
);
|
11
12
|
};
|
12
|
-
|
13
13
|
SwiperItem.displayName = 'SwiperItem';
|
14
14
|
export default SwiperItem;
|