@ray-js/components 1.4.0-alpha.1 → 1.4.0-alpha.11
Sign up to get free protection for your applications and to get access to all the features.
- 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 +20 -25
- package/lib/Form/props.d.ts +1 -1
- package/lib/Icon/Icon.js +7 -7
- package/lib/Icon/Icon.thing.js +7 -7
- package/lib/Icon/Icon.wechat.js +7 -7
- 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 +26 -32
- package/lib/Input/Input.js +29 -26
- package/lib/Input/Input.thing.js +36 -36
- package/lib/Input/Input.wechat.js +47 -47
- package/lib/Input/props.d.ts +11 -21
- package/lib/Input/props.js +1 -3
- 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 +23 -31
- package/lib/Picker/Picker.thing.js +26 -31
- package/lib/Picker/Picker.wechat.js +26 -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 +24 -33
- package/lib/Swiper/Swiper.thing.d.ts +1 -1
- package/lib/Swiper/Swiper.thing.js +18 -24
- package/lib/Swiper/Swiper.wechat.d.ts +1 -1
- package/lib/Swiper/Swiper.wechat.js +18 -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 +20 -25
- package/lib/Textarea/Textarea.js +13 -24
- package/lib/Textarea/Textarea.thing.js +26 -30
- package/lib/Textarea/Textarea.wechat.js +26 -30
- package/lib/Textarea/props.d.ts +4 -10
- package/lib/View/View.js +29 -32
- package/lib/View/View.thing.js +34 -35
- package/lib/View/View.wechat.js +34 -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 +4 -11
- package/lib/types/event.d.ts +1 -1
- package/lib/types/index.js +1 -0
- package/lib/utils/handleProps.js +26 -40
- package/package.json +25 -25
- package/lib/Modal/index.web.d.ts +0 -2
@@ -1,17 +1,16 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
-
import "core-js/modules/es.array.map.js";
|
3
2
|
import * as React from 'react';
|
4
3
|
import { useEventListener } from 'ahooks';
|
5
4
|
import handleProps from '../utils/handleProps';
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
5
|
+
const RadioGroup = props => {
|
6
|
+
const {
|
7
|
+
options,
|
8
|
+
disabled,
|
9
|
+
children
|
10
|
+
} = props;
|
11
|
+
const currentNode = React.useRef(null);
|
12
|
+
useEventListener('change', e => {
|
13
13
|
var _props$onChange;
|
14
|
-
|
15
14
|
!disabled && ((_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
|
16
15
|
type: 'change',
|
17
16
|
value: e.detail.value
|
@@ -24,23 +23,19 @@ var RadioGroup = function (props) {
|
|
24
23
|
// @ts-ignore
|
25
24
|
React.createElement("v-radio-group", _extends({}, handleProps(props), {
|
26
25
|
ref: currentNode
|
27
|
-
}), children ||
|
28
|
-
return options.map(
|
26
|
+
}), children || (() => {
|
27
|
+
return options.map((item, index) => {
|
29
28
|
var _item$checked;
|
30
|
-
|
31
|
-
var radioProps = {
|
29
|
+
const radioProps = {
|
32
30
|
value: item.value,
|
33
31
|
color: item.color
|
34
32
|
};
|
35
|
-
|
36
33
|
if ((_item$checked = item.checked) !== null && _item$checked !== void 0 ? _item$checked : false) {
|
37
34
|
radioProps.checked = true;
|
38
35
|
}
|
39
|
-
|
40
36
|
if (disabled || item.disabled || false) {
|
41
37
|
radioProps.disabled = true;
|
42
38
|
}
|
43
|
-
|
44
39
|
return (
|
45
40
|
/*#__PURE__*/
|
46
41
|
// @ts-ignore
|
@@ -49,9 +44,8 @@ var RadioGroup = function (props) {
|
|
49
44
|
}, /*#__PURE__*/React.createElement("v-radio", radioProps), item.label)
|
50
45
|
);
|
51
46
|
});
|
52
|
-
}())
|
47
|
+
})())
|
53
48
|
);
|
54
49
|
};
|
55
|
-
|
56
50
|
RadioGroup.displayName = 'RadioGroup';
|
57
51
|
export default RadioGroup;
|
@@ -1,39 +1,34 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
|
-
|
4
|
-
import "core-js/modules/es.array.map.js";
|
3
|
+
const _excluded = ["options", "name", "disabled", "onChange", "children", "style"];
|
5
4
|
import * as React from 'react';
|
6
5
|
import { RadioGroup as RemaxRadioGroup } from '@ray-js/adapter';
|
7
6
|
import Radio from '../Radio';
|
8
7
|
import Label from '../Label';
|
9
8
|
import { inlineStyle } from '@ray-js/framework-shared';
|
10
|
-
|
11
|
-
var RadioGroup = function (props) {
|
9
|
+
const RadioGroup = props => {
|
12
10
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
onChange =
|
18
|
-
children
|
19
|
-
style
|
20
|
-
|
21
|
-
|
11
|
+
const {
|
12
|
+
options,
|
13
|
+
name,
|
14
|
+
disabled,
|
15
|
+
onChange = () => {},
|
16
|
+
children,
|
17
|
+
style
|
18
|
+
} = props,
|
19
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
22
20
|
return (
|
23
21
|
/*#__PURE__*/
|
24
22
|
// @ts-ignore
|
25
23
|
React.createElement(RemaxRadioGroup, _extends({
|
26
24
|
style: inlineStyle(style),
|
27
25
|
name: name,
|
28
|
-
onChange:
|
26
|
+
onChange: e => {
|
29
27
|
!disabled && onChange(e);
|
30
28
|
}
|
31
|
-
}, restProps),
|
32
|
-
return
|
33
|
-
}() || function renderOptions() {
|
34
|
-
return options.map(function (item, index) {
|
29
|
+
}, restProps), (() => children)() || (() => {
|
30
|
+
return options.map((item, index) => {
|
35
31
|
var _item$checked;
|
36
|
-
|
37
32
|
return /*#__PURE__*/React.createElement(Label, {
|
38
33
|
key: index + '_' + item.value
|
39
34
|
}, /*#__PURE__*/React.createElement(Radio, {
|
@@ -43,8 +38,7 @@ var RadioGroup = function (props) {
|
|
43
38
|
color: item.color
|
44
39
|
}), item.label);
|
45
40
|
});
|
46
|
-
}())
|
41
|
+
})())
|
47
42
|
);
|
48
43
|
};
|
49
|
-
|
50
44
|
export default RadioGroup;
|
@@ -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,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
|
-
|
5
|
-
import "core-js/modules/
|
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
|
-
|
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 () {
|
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',
|
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)),
|
52
|
+
}, handleProps(restProps)), (() => {
|
61
53
|
return children;
|
62
|
-
}() ||
|
63
|
-
return dataSource.map(
|
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,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,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
|
-
|
5
|
-
import "core-js/modules/
|
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
|
-
|
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 () {
|
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(
|
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,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
|
}
|