@ray-js/components 0.3.29 → 0.3.30
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/lib/Button/Button.js +6 -50
- package/lib/Button/Button.web.js +6 -50
- package/lib/Button/index.md +10 -10
- package/lib/Checkbox/Checkbox.d.ts +0 -1
- package/lib/Checkbox/Checkbox.js +3 -29
- package/lib/Checkbox/Checkbox.web.js +3 -29
- package/lib/Checkbox/index.md +7 -6
- package/lib/CheckboxGroup/CheckboxGroup.js +45 -2
- package/lib/CheckboxGroup/CheckboxGroup.web.js +45 -2
- package/lib/CheckboxGroup/index.md +4 -4
- package/lib/CheckboxGroup/props.d.ts +3 -2
- package/lib/DatePicker/DatePicker.js +55 -4
- package/lib/DatePicker/DatePicker.web.js +55 -4
- package/lib/DatePicker/index.md +8 -8
- package/lib/DatePicker/props.d.ts +2 -0
- package/lib/Form/Form.android.js +1 -0
- package/lib/Form/Form.d.ts +4 -0
- package/lib/Form/Form.ios.js +1 -0
- package/lib/Form/Form.js +37 -0
- package/lib/Form/Form.native.d.ts +4 -0
- package/lib/Form/Form.tuya.d.ts +4 -0
- package/lib/Form/Form.tuya.js +8 -0
- package/lib/Form/Form.web.js +37 -0
- package/lib/Form/Form.wechat.d.ts +4 -0
- package/lib/Form/Form.wechat.js +33 -0
- package/lib/Form/index.android.js +1 -0
- package/lib/Form/index.d.ts +3 -0
- package/lib/Form/index.ios.js +1 -0
- package/lib/Form/index.js +3 -0
- package/lib/Form/index.md +30 -0
- package/lib/Form/index.tuya.js +3 -0
- package/lib/Form/index.web.js +3 -0
- package/lib/Form/index.wechat.js +3 -0
- package/lib/Form/props.android.js +1 -0
- package/lib/Form/props.d.ts +13 -0
- package/lib/Form/props.ios.js +1 -0
- package/lib/Form/props.js +1 -0
- package/lib/Form/props.tuya.js +1 -0
- package/lib/Form/props.web.js +1 -0
- package/lib/Form/props.wechat.js +1 -0
- package/lib/Icon/index.md +4 -4
- package/lib/Image/Image.js +33 -86
- package/lib/Image/Image.web.js +33 -86
- package/lib/Image/index.md +20 -20
- package/lib/Image/props.d.ts +1 -0
- package/lib/Input/Input.js +54 -78
- package/lib/Input/Input.web.js +54 -78
- package/lib/Input/index.md +14 -14
- package/lib/Label/Label.android.js +1 -1
- package/lib/Label/Label.ios.js +1 -1
- package/lib/Label/Label.js +8 -15
- package/lib/Label/Label.web.js +8 -15
- package/lib/Label/index.md +31 -0
- package/lib/Label/props.d.ts +7 -0
- package/lib/Motion/Fade/index.js +1 -1
- package/lib/Motion/Fade/index.web.js +1 -1
- package/lib/Motion/PullUp/index.js +1 -1
- package/lib/Motion/PullUp/index.web.js +1 -1
- package/lib/Motion/PushDown/index.js +1 -1
- package/lib/Motion/PushDown/index.web.js +1 -1
- package/lib/Motion/ScaleFadeIn/index.js +1 -1
- package/lib/Motion/ScaleFadeIn/index.web.js +1 -1
- package/lib/Motion/ScalePullDown/index.js +1 -1
- package/lib/Motion/ScalePullDown/index.web.js +1 -1
- package/lib/PageContainer/PageContainer.android.js +1 -1
- package/lib/PageContainer/PageContainer.d.ts +2 -4
- package/lib/PageContainer/PageContainer.ios.js +1 -1
- package/lib/PageContainer/PageContainer.js +1 -1
- package/lib/PageContainer/PageContainer.web.js +85 -5
- package/lib/PageContainer/index.md +19 -19
- package/lib/PageContainer/props.d.ts +12 -7
- package/lib/Picker/Picker.js +67 -4
- package/lib/Picker/Picker.web.js +67 -4
- package/lib/Picker/index.md +9 -9
- package/lib/Picker/props.d.ts +2 -0
- package/lib/PickerView/PickerView.js +69 -4
- package/lib/PickerView/PickerView.web.js +69 -4
- package/lib/PickerView/index.md +8 -7
- package/lib/PickerView/props.d.ts +3 -0
- package/lib/PickerViewColumn/PickerViewColumn.android.js +1 -0
- package/lib/PickerViewColumn/PickerViewColumn.d.ts +4 -0
- package/lib/PickerViewColumn/PickerViewColumn.ios.js +1 -0
- package/lib/PickerViewColumn/PickerViewColumn.js +14 -0
- package/lib/PickerViewColumn/PickerViewColumn.native.d.ts +31 -0
- package/lib/PickerViewColumn/PickerViewColumn.tuya.d.ts +4 -0
- package/lib/PickerViewColumn/PickerViewColumn.tuya.js +71 -0
- package/lib/PickerViewColumn/PickerViewColumn.web.js +14 -0
- package/lib/PickerViewColumn/PickerViewColumn.wechat.d.ts +4 -0
- package/lib/PickerViewColumn/PickerViewColumn.wechat.js +72 -0
- package/lib/PickerViewColumn/index.android.js +1 -0
- package/lib/PickerViewColumn/index.d.ts +3 -0
- package/lib/PickerViewColumn/index.ios.js +1 -0
- package/lib/PickerViewColumn/index.js +3 -0
- package/lib/PickerViewColumn/index.md +21 -0
- package/lib/PickerViewColumn/index.module.less +8 -0
- package/lib/PickerViewColumn/index.tuya.js +3 -0
- package/lib/PickerViewColumn/index.web.js +3 -0
- package/lib/PickerViewColumn/index.wechat.js +3 -0
- package/lib/PickerViewColumn/props.android.js +1 -0
- package/lib/PickerViewColumn/props.d.ts +16 -0
- package/lib/PickerViewColumn/props.ios.js +1 -0
- package/lib/PickerViewColumn/props.js +1 -0
- package/lib/PickerViewColumn/props.tuya.js +1 -0
- package/lib/PickerViewColumn/props.web.js +1 -0
- package/lib/PickerViewColumn/props.wechat.js +1 -0
- package/lib/Radio/Radio.js +3 -6
- package/lib/Radio/Radio.web.js +3 -6
- package/lib/Radio/index.md +5 -5
- package/lib/RadioGroup/RadioGroup.js +50 -2
- package/lib/RadioGroup/RadioGroup.web.js +50 -2
- package/lib/RadioGroup/index.md +7 -5
- package/lib/RadioGroup/props.d.ts +3 -1
- package/lib/RichText/RichText.android.js +1 -0
- package/lib/RichText/RichText.d.ts +3 -0
- package/lib/RichText/RichText.ios.js +1 -0
- package/lib/RichText/RichText.js +9 -0
- package/lib/RichText/RichText.tuya.js +9 -0
- package/lib/RichText/RichText.web.d.ts +4 -0
- package/lib/RichText/RichText.web.js +7 -0
- package/lib/RichText/RichText.wechat.js +9 -0
- package/lib/RichText/index.android.js +1 -0
- package/lib/RichText/index.d.ts +3 -0
- package/lib/RichText/index.ios.js +1 -0
- package/lib/RichText/index.js +3 -0
- package/lib/RichText/index.md +117 -0
- package/lib/RichText/index.tuya.js +3 -0
- package/lib/RichText/index.web.js +3 -0
- package/lib/RichText/index.wechat.js +3 -0
- package/lib/RichText/props.android.js +0 -0
- package/lib/RichText/props.d.ts +29 -0
- package/lib/RichText/props.ios.js +0 -0
- package/lib/RichText/props.js +1 -0
- package/lib/RichText/props.tuya.js +1 -0
- package/lib/RichText/props.web.js +1 -0
- package/lib/RichText/props.wechat.js +1 -0
- package/lib/ScrollView/ScrollView.d.ts +1 -1
- package/lib/ScrollView/ScrollView.js +40 -155
- package/lib/ScrollView/ScrollView.web.js +40 -155
- package/lib/ScrollView/index.md +11 -11
- package/lib/Slider/Slider.js +31 -12
- package/lib/Slider/Slider.web.js +31 -12
- package/lib/Slider/index.md +17 -17
- package/lib/Swiper/Swiper.js +61 -2
- package/lib/Swiper/Swiper.web.js +61 -2
- package/lib/Swiper/index.md +14 -14
- package/lib/Switch/Switch.js +20 -6
- package/lib/Switch/Switch.web.js +20 -6
- package/lib/Switch/index.md +6 -6
- package/lib/Text/Text.js +6 -34
- package/lib/Text/Text.web.js +6 -34
- package/lib/Text/index.md +6 -6
- package/lib/TimePicker/TimePicker.js +35 -4
- package/lib/TimePicker/TimePicker.web.js +35 -4
- package/lib/TimePicker/index.md +9 -9
- package/lib/TimePicker/props.d.ts +2 -0
- package/lib/View/View.js +6 -5
- package/lib/View/View.web.js +6 -5
- package/lib/View/index.md +10 -10
- package/lib/index.android.js +1 -1
- package/lib/index.d.ts +3 -0
- package/lib/index.ios.js +1 -1
- package/lib/index.js +3 -0
- package/lib/index.tuya.js +3 -0
- package/lib/index.web.js +3 -0
- package/lib/index.wechat.js +3 -0
- package/lib/utils/handleProps.android.js +1 -0
- package/lib/utils/handleProps.d.ts +5 -0
- package/lib/utils/handleProps.ios.js +1 -0
- package/lib/utils/handleProps.js +50 -0
- package/lib/utils/handleProps.tuya.js +50 -0
- package/lib/utils/handleProps.web.js +50 -0
- package/lib/utils/handleProps.wechat.js +50 -0
- package/package.json +7 -5
package/lib/Slider/Slider.js
CHANGED
@@ -1,20 +1,39 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
|
-
var _excluded = ["id", "style", "className", "children"];
|
4
2
|
import * as React from 'react';
|
3
|
+
import { useEventListener } from 'ahooks';
|
4
|
+
import handleProps from '../utils/handleProps';
|
5
5
|
|
6
6
|
var Slider = function (props) {
|
7
|
-
var
|
8
|
-
|
9
|
-
|
10
|
-
children = props.children,
|
11
|
-
restProps = _objectWithoutProperties(props, _excluded);
|
7
|
+
var currentNode = React.useRef(null);
|
8
|
+
useEventListener('change', function (e) {
|
9
|
+
var _props$onChange;
|
12
10
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
|
12
|
+
type: 'change',
|
13
|
+
value: e.detail.value,
|
14
|
+
origin: e
|
15
|
+
});
|
16
|
+
}, {
|
17
|
+
target: currentNode
|
18
|
+
});
|
19
|
+
useEventListener('changing', function (e) {
|
20
|
+
var _props$onChanging;
|
21
|
+
|
22
|
+
(_props$onChanging = props.onChanging) === null || _props$onChanging === void 0 ? void 0 : _props$onChanging.call(props, {
|
23
|
+
type: 'changing',
|
24
|
+
value: e.detail.value,
|
25
|
+
origin: e
|
26
|
+
});
|
27
|
+
}, {
|
28
|
+
target: currentNode
|
29
|
+
});
|
30
|
+
return (
|
31
|
+
/*#__PURE__*/
|
32
|
+
// @ts-ignore
|
33
|
+
React.createElement("ty-slider", _extends({}, handleProps(props), {
|
34
|
+
ref: currentNode
|
35
|
+
}))
|
36
|
+
);
|
18
37
|
};
|
19
38
|
|
20
39
|
export default Slider;
|
package/lib/Slider/Slider.web.js
CHANGED
@@ -1,20 +1,39 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
|
-
var _excluded = ["id", "style", "className", "children"];
|
4
2
|
import * as React from 'react';
|
3
|
+
import { useEventListener } from 'ahooks';
|
4
|
+
import handleProps from '../utils/handleProps';
|
5
5
|
|
6
6
|
var Slider = function (props) {
|
7
|
-
var
|
8
|
-
|
9
|
-
|
10
|
-
children = props.children,
|
11
|
-
restProps = _objectWithoutProperties(props, _excluded);
|
7
|
+
var currentNode = React.useRef(null);
|
8
|
+
useEventListener('change', function (e) {
|
9
|
+
var _props$onChange;
|
12
10
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
|
12
|
+
type: 'change',
|
13
|
+
value: e.detail.value,
|
14
|
+
origin: e
|
15
|
+
});
|
16
|
+
}, {
|
17
|
+
target: currentNode
|
18
|
+
});
|
19
|
+
useEventListener('changing', function (e) {
|
20
|
+
var _props$onChanging;
|
21
|
+
|
22
|
+
(_props$onChanging = props.onChanging) === null || _props$onChanging === void 0 ? void 0 : _props$onChanging.call(props, {
|
23
|
+
type: 'changing',
|
24
|
+
value: e.detail.value,
|
25
|
+
origin: e
|
26
|
+
});
|
27
|
+
}, {
|
28
|
+
target: currentNode
|
29
|
+
});
|
30
|
+
return (
|
31
|
+
/*#__PURE__*/
|
32
|
+
// @ts-ignore
|
33
|
+
React.createElement("ty-slider", _extends({}, handleProps(props), {
|
34
|
+
ref: currentNode
|
35
|
+
}))
|
36
|
+
);
|
18
37
|
};
|
19
38
|
|
20
39
|
export default Slider;
|
package/lib/Slider/index.md
CHANGED
@@ -13,14 +13,14 @@ group:
|
|
13
13
|
## 导入
|
14
14
|
|
15
15
|
```js
|
16
|
-
import { Slider } from '@ray-js/components'
|
16
|
+
import { Slider } from '@ray-js/components'
|
17
17
|
```
|
18
18
|
|
19
19
|
## 代码演示
|
20
20
|
|
21
21
|
```js
|
22
|
-
import React from 'react'
|
23
|
-
import { Slider } from '@ray-js/components'
|
22
|
+
import React from 'react'
|
23
|
+
import { Slider } from '@ray-js/components'
|
24
24
|
|
25
25
|
export default function HorizontalScroll() {
|
26
26
|
return (
|
@@ -32,10 +32,10 @@ export default function HorizontalScroll() {
|
|
32
32
|
step={5}
|
33
33
|
showValue
|
34
34
|
onChange={(e) => {
|
35
|
-
console.log('SliderChange', e)
|
35
|
+
console.log('SliderChange', e)
|
36
36
|
}}
|
37
37
|
/>
|
38
|
-
)
|
38
|
+
)
|
39
39
|
}
|
40
40
|
```
|
41
41
|
|
@@ -49,15 +49,15 @@ export default function HorizontalScroll() {
|
|
49
49
|
|
50
50
|
| 属性名 | 类型 | 默认值 | 必填 | 说明 | 支持平台 |
|
51
51
|
| --- | --- | --- | --- | --- | --- |
|
52
|
-
| min | number | 0 | 否 | 最小值 | RN
|
53
|
-
| max | number | 100 | 否 | 最大值 | RN
|
54
|
-
| step | number | 1 | 否 | 步长,取值必须大于 0,并且可被(max - min)整除 | RN
|
55
|
-
| disabled | boolean | false | 否 | 是否禁用 | RN
|
56
|
-
| value | number | 0 | 否 | 当前取值 | RN
|
57
|
-
| activeColor | color | #007aff | 否 | 已选择的颜色 | RN
|
58
|
-
| backgroundColor | color | rgba(0,0,0,.2) | 否 | 背景条的颜色 | RN
|
59
|
-
| blockSize | number | 28 | 否 | 滑块的大小,取值范围为 12 - 28 | RN
|
60
|
-
| blockColor | color | #ffffff | 否 | 滑块的颜色 | RN
|
61
|
-
| showValue | boolean | false | 否 | 是否显示当前 value | RN
|
62
|
-
| onChange | eventhandle | | 否 | 完成一次拖动后触发的事件,event.detail = {value} | RN
|
63
|
-
| onChanging | eventhandle | | 否 | 拖动过程中触发的事件,event.detail = {value} | RN
|
52
|
+
| min | number | 0 | 否 | 最小值 | RN、涂鸦、微信、Web |
|
53
|
+
| max | number | 100 | 否 | 最大值 | RN、涂鸦、微信、Web |
|
54
|
+
| step | number | 1 | 否 | 步长,取值必须大于 0,并且可被(max - min)整除 | RN、涂鸦、微信、Web |
|
55
|
+
| disabled | boolean | false | 否 | 是否禁用 | RN、涂鸦、微信、Web |
|
56
|
+
| value | number | 0 | 否 | 当前取值 | RN、涂鸦、微信、Web |
|
57
|
+
| activeColor | color | #007aff | 否 | 已选择的颜色 | RN、涂鸦、微信、Web |
|
58
|
+
| backgroundColor | color | rgba(0,0,0,.2) | 否 | 背景条的颜色 | RN、涂鸦、微信、Web |
|
59
|
+
| blockSize | number | 28 | 否 | 滑块的大小,取值范围为 12 - 28 | RN、涂鸦、微信、Web |
|
60
|
+
| blockColor | color | #ffffff | 否 | 滑块的颜色 | RN、涂鸦、微信、Web |
|
61
|
+
| showValue | boolean | false | 否 | 是否显示当前 value | RN、涂鸦、微信、Web |
|
62
|
+
| onChange | eventhandle | | 否 | 完成一次拖动后触发的事件,event.detail = {value} | RN、涂鸦、微信、Web |
|
63
|
+
| onChanging | eventhandle | | 否 | 拖动过程中触发的事件,event.detail = {value} | RN、涂鸦、微信、Web |
|
package/lib/Swiper/Swiper.js
CHANGED
@@ -1,9 +1,68 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
4
|
+
var _excluded = ["id", "style", "className", "current", "dataSource", "onAfterChange", "onChange", "renderItem"];
|
5
|
+
import "core-js/modules/es.array.map.js";
|
1
6
|
// import clsx from 'clsx';
|
2
7
|
import * as React from 'react';
|
8
|
+
import handleProps from '../utils/handleProps';
|
3
9
|
import { defaultSwiperProps } from './props';
|
10
|
+
import { useEventListener } from 'ahooks';
|
4
11
|
|
5
|
-
function Swiper() {
|
6
|
-
|
12
|
+
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
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
22
|
+
|
23
|
+
var _React$useState = React.useState(current),
|
24
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
25
|
+
internalCurrent = _React$useState2[0],
|
26
|
+
setInternalCurrent = _React$useState2[1];
|
27
|
+
|
28
|
+
var bufferCurrent = React.useRef(current);
|
29
|
+
var currentNode = React.useRef(null);
|
30
|
+
React.useEffect(function () {
|
31
|
+
if (bufferCurrent.current !== current) {
|
32
|
+
setInternalCurrent(current);
|
33
|
+
}
|
34
|
+
}, [current]);
|
35
|
+
|
36
|
+
function handleChange(event) {
|
37
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event === null || event === void 0 ? void 0 : event.detail);
|
38
|
+
}
|
39
|
+
|
40
|
+
function handleAfterChange(event) {
|
41
|
+
onAfterChange === null || onAfterChange === void 0 ? void 0 : onAfterChange(event === null || event === void 0 ? void 0 : event.detail);
|
42
|
+
}
|
43
|
+
|
44
|
+
useEventListener('change', function (e) {
|
45
|
+
handleChange(e);
|
46
|
+
}, {
|
47
|
+
target: currentNode
|
48
|
+
});
|
49
|
+
useEventListener('onanimationend', function (e) {
|
50
|
+
handleAfterChange(e);
|
51
|
+
}, {
|
52
|
+
target: currentNode
|
53
|
+
});
|
54
|
+
return (
|
55
|
+
/*#__PURE__*/
|
56
|
+
// @ts-ignore
|
57
|
+
React.createElement("ty-swiper", _extends({
|
58
|
+
ref: currentNode
|
59
|
+
}, handleProps(restProps)), dataSource.map(function (item, index) {
|
60
|
+
// @ts-ignore
|
61
|
+
return /*#__PURE__*/React.createElement("ty-swiper-item", {
|
62
|
+
key: index
|
63
|
+
}, renderItem(item, index));
|
64
|
+
}))
|
65
|
+
);
|
7
66
|
}
|
8
67
|
|
9
68
|
Swiper.defaultProps = defaultSwiperProps;
|
package/lib/Swiper/Swiper.web.js
CHANGED
@@ -1,9 +1,68 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
4
|
+
var _excluded = ["id", "style", "className", "current", "dataSource", "onAfterChange", "onChange", "renderItem"];
|
5
|
+
import "core-js/modules/es.array.map.js";
|
1
6
|
// import clsx from 'clsx';
|
2
7
|
import * as React from 'react';
|
8
|
+
import handleProps from '../utils/handleProps';
|
3
9
|
import { defaultSwiperProps } from './props';
|
10
|
+
import { useEventListener } from 'ahooks';
|
4
11
|
|
5
|
-
function Swiper() {
|
6
|
-
|
12
|
+
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
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
22
|
+
|
23
|
+
var _React$useState = React.useState(current),
|
24
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
25
|
+
internalCurrent = _React$useState2[0],
|
26
|
+
setInternalCurrent = _React$useState2[1];
|
27
|
+
|
28
|
+
var bufferCurrent = React.useRef(current);
|
29
|
+
var currentNode = React.useRef(null);
|
30
|
+
React.useEffect(function () {
|
31
|
+
if (bufferCurrent.current !== current) {
|
32
|
+
setInternalCurrent(current);
|
33
|
+
}
|
34
|
+
}, [current]);
|
35
|
+
|
36
|
+
function handleChange(event) {
|
37
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event === null || event === void 0 ? void 0 : event.detail);
|
38
|
+
}
|
39
|
+
|
40
|
+
function handleAfterChange(event) {
|
41
|
+
onAfterChange === null || onAfterChange === void 0 ? void 0 : onAfterChange(event === null || event === void 0 ? void 0 : event.detail);
|
42
|
+
}
|
43
|
+
|
44
|
+
useEventListener('change', function (e) {
|
45
|
+
handleChange(e);
|
46
|
+
}, {
|
47
|
+
target: currentNode
|
48
|
+
});
|
49
|
+
useEventListener('onanimationend', function (e) {
|
50
|
+
handleAfterChange(e);
|
51
|
+
}, {
|
52
|
+
target: currentNode
|
53
|
+
});
|
54
|
+
return (
|
55
|
+
/*#__PURE__*/
|
56
|
+
// @ts-ignore
|
57
|
+
React.createElement("ty-swiper", _extends({
|
58
|
+
ref: currentNode
|
59
|
+
}, handleProps(restProps)), dataSource.map(function (item, index) {
|
60
|
+
// @ts-ignore
|
61
|
+
return /*#__PURE__*/React.createElement("ty-swiper-item", {
|
62
|
+
key: index
|
63
|
+
}, renderItem(item, index));
|
64
|
+
}))
|
65
|
+
);
|
7
66
|
}
|
8
67
|
|
9
68
|
Swiper.defaultProps = defaultSwiperProps;
|
package/lib/Swiper/index.md
CHANGED
@@ -15,7 +15,7 @@ group:
|
|
15
15
|
## 导入
|
16
16
|
|
17
17
|
```js
|
18
|
-
import { Swiper } from '@ray-js/components'
|
18
|
+
import { Swiper } from '@ray-js/components'
|
19
19
|
```
|
20
20
|
|
21
21
|
## 代码演示
|
@@ -29,16 +29,16 @@ import { Swiper } from '@ray-js/components';
|
|
29
29
|
|
30
30
|
| 属性 | 类型 | 默认值 | 说明 | 支持平台 |
|
31
31
|
| --- | --- | --- | --- | --- |
|
32
|
-
| autoplay | boolean | false | 是否自动切换 | RN
|
33
|
-
| circular | boolean | false | 是否采用衔接滑动 | RN
|
34
|
-
| current | number | 0 | 当前所在滑块的 index | RN
|
35
|
-
| dotActiveColor | string | #666666 | 当前选中的指示点颜色 | RN
|
36
|
-
| dotColor | string | #333333 | 指示点颜色 | RN
|
37
|
-
| dots | boolean | false | 是否显示面板指示点 | RN
|
38
|
-
| duration | number | 500 | 滑动动画时长 |
|
39
|
-
| interval | number | 5000 | 自动切换时间间隔 | RN
|
40
|
-
| vertical | boolean | false | 滑动方向是否为纵向 | RN
|
41
|
-
| dataSource | P[] | | 数据源 | RN
|
42
|
-
| renderItem | func(P) | | 渲染数据成员 | RN
|
43
|
-
| onChange | func(event) | | current 改变时, event.detail = {current, source} | RN
|
44
|
-
| onAfterChange | func(event) | | 动画结束时触发,event.detail 同上 | RN
|
32
|
+
| autoplay | boolean | false | 是否自动切换 | RN、涂鸦、微信、Web |
|
33
|
+
| circular | boolean | false | 是否采用衔接滑动 | RN、涂鸦、微信、Web |
|
34
|
+
| current | number | 0 | 当前所在滑块的 index | RN、涂鸦、微信、Web |
|
35
|
+
| dotActiveColor | string | #666666 | 当前选中的指示点颜色 | RN、涂鸦、微信、Web |
|
36
|
+
| dotColor | string | #333333 | 指示点颜色 | RN、涂鸦、微信、Web |
|
37
|
+
| dots | boolean | false | 是否显示面板指示点 | RN、涂鸦、微信、Web |
|
38
|
+
| duration | number | 500 | 滑动动画时长 | 涂鸦、微信、Web |
|
39
|
+
| interval | number | 5000 | 自动切换时间间隔 | RN、涂鸦、微信、Web |
|
40
|
+
| vertical | boolean | false | 滑动方向是否为纵向 | RN、涂鸦、微信、Web |
|
41
|
+
| dataSource | P[] | | 数据源 | RN、涂鸦、微信、Web |
|
42
|
+
| renderItem | func(P) | | 渲染数据成员 | RN、涂鸦、微信、Web |
|
43
|
+
| onChange | func(event) | | current 改变时, event.detail = {current, source} | RN、涂鸦、微信、Web |
|
44
|
+
| onAfterChange | func(event) | | 动画结束时触发,event.detail 同上 | RN、涂鸦、微信、Web |
|
package/lib/Switch/Switch.js
CHANGED
@@ -1,12 +1,26 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
1
3
|
import * as React from 'react';
|
4
|
+
import { useEventListener } from 'ahooks';
|
5
|
+
import handleProps from '../utils/handleProps';
|
2
6
|
|
3
7
|
var Switch = function (props) {
|
4
|
-
var
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
var currentNode = React.useRef(null);
|
9
|
+
useEventListener('change', function (e) {
|
10
|
+
var _props$onChange;
|
11
|
+
|
12
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, _objectSpread(_objectSpread({
|
13
|
+
type: 'change'
|
14
|
+
}, e.detail), {}, {
|
15
|
+
origin: e
|
16
|
+
}));
|
17
|
+
}, {
|
18
|
+
target: currentNode
|
19
|
+
}); // @ts-ignore
|
20
|
+
|
21
|
+
return /*#__PURE__*/React.createElement("ty-switch", _extends({}, handleProps(props), {
|
22
|
+
ref: currentNode
|
23
|
+
}));
|
10
24
|
};
|
11
25
|
|
12
26
|
Switch.displayName = 'Switch';
|
package/lib/Switch/Switch.web.js
CHANGED
@@ -1,12 +1,26 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
1
3
|
import * as React from 'react';
|
4
|
+
import { useEventListener } from 'ahooks';
|
5
|
+
import handleProps from '../utils/handleProps';
|
2
6
|
|
3
7
|
var Switch = function (props) {
|
4
|
-
var
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
var currentNode = React.useRef(null);
|
9
|
+
useEventListener('change', function (e) {
|
10
|
+
var _props$onChange;
|
11
|
+
|
12
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, _objectSpread(_objectSpread({
|
13
|
+
type: 'change'
|
14
|
+
}, e.detail), {}, {
|
15
|
+
origin: e
|
16
|
+
}));
|
17
|
+
}, {
|
18
|
+
target: currentNode
|
19
|
+
}); // @ts-ignore
|
20
|
+
|
21
|
+
return /*#__PURE__*/React.createElement("ty-switch", _extends({}, handleProps(props), {
|
22
|
+
ref: currentNode
|
23
|
+
}));
|
10
24
|
};
|
11
25
|
|
12
26
|
Switch.displayName = 'Switch';
|
package/lib/Switch/index.md
CHANGED
@@ -13,7 +13,7 @@ group:
|
|
13
13
|
## 导入
|
14
14
|
|
15
15
|
```js
|
16
|
-
import { Switch } from '@ray-js/components'
|
16
|
+
import { Switch } from '@ray-js/components'
|
17
17
|
```
|
18
18
|
|
19
19
|
## 代码演示
|
@@ -24,8 +24,8 @@ import { Switch } from '@ray-js/components';
|
|
24
24
|
|
25
25
|
| 属性 | 类型 | 默认值 | 说明 | 支持平台 |
|
26
26
|
| --- | --- | --- | --- | --- |
|
27
|
-
| checked | boolean | false | 当前是否选中 | RN
|
28
|
-
| disabled | boolean | false | 是否禁用 | RN
|
29
|
-
| color | string | #007AFF | Switch 的颜色,同 css 的 color | RN
|
30
|
-
| type | string | switch | 可选值 `switch` `checkbox` | RN
|
31
|
-
| onChange | func(event) | 否 | checked 改变时触发 change 事件,event.detail={ value} | RN
|
27
|
+
| checked | boolean | false | 当前是否选中 | RN、涂鸦、微信、Web |
|
28
|
+
| disabled | boolean | false | 是否禁用 | RN、涂鸦、微信、Web |
|
29
|
+
| color | string | #007AFF | Switch 的颜色,同 css 的 color | RN、涂鸦、微信、Web |
|
30
|
+
| type | string | switch | 可选值 `switch` `checkbox` | RN、涂鸦、微信、Web |
|
31
|
+
| onChange | func(event) | 否 | checked 改变时触发 change 事件,event.detail={ value} | RN、涂鸦、微信、Web |
|
package/lib/Text/Text.js
CHANGED
@@ -1,40 +1,12 @@
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
3
1
|
import * as React from 'react';
|
4
|
-
import
|
5
|
-
import { inlineStyle } from '@ray-js/framework-shared';
|
6
|
-
import styles from './index.module.less';
|
2
|
+
import handleProps from '../utils/handleProps';
|
7
3
|
|
8
4
|
var Text = function (props) {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
className = props.className,
|
15
|
-
selectable = props.selectable,
|
16
|
-
dataset = props.dataset,
|
17
|
-
id = props.id,
|
18
|
-
style = props.style,
|
19
|
-
children = props.children;
|
20
|
-
return /*#__PURE__*/React.createElement("span", _extends({}, dataset, {
|
21
|
-
id: id,
|
22
|
-
style: inlineStyle(style),
|
23
|
-
className: clsx('ray-text', className, _defineProperty({}, styles.selectable, selectable)),
|
24
|
-
onClick: onClick,
|
25
|
-
onTouchStart: function (e) {
|
26
|
-
return onTouchStart === null || onTouchStart === void 0 ? void 0 : onTouchStart(e);
|
27
|
-
},
|
28
|
-
onTouchMove: function (e) {
|
29
|
-
return onTouchMove === null || onTouchMove === void 0 ? void 0 : onTouchMove(e);
|
30
|
-
},
|
31
|
-
onTouchEnd: function (e) {
|
32
|
-
return onTouchEnd === null || onTouchEnd === void 0 ? void 0 : onTouchEnd(e);
|
33
|
-
},
|
34
|
-
onTouchCancel: function (e) {
|
35
|
-
return onTouchCancel === null || onTouchCancel === void 0 ? void 0 : onTouchCancel(e);
|
36
|
-
}
|
37
|
-
}), children);
|
5
|
+
return (
|
6
|
+
/*#__PURE__*/
|
7
|
+
// @ts-ignore
|
8
|
+
React.createElement("ty-text", handleProps(props))
|
9
|
+
);
|
38
10
|
};
|
39
11
|
|
40
12
|
Text.displayName = 'Text';
|
package/lib/Text/Text.web.js
CHANGED
@@ -1,40 +1,12 @@
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
3
1
|
import * as React from 'react';
|
4
|
-
import
|
5
|
-
import { inlineStyle } from '@ray-js/framework-shared';
|
6
|
-
import styles from './index.module.less';
|
2
|
+
import handleProps from '../utils/handleProps';
|
7
3
|
|
8
4
|
var Text = function (props) {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
className = props.className,
|
15
|
-
selectable = props.selectable,
|
16
|
-
dataset = props.dataset,
|
17
|
-
id = props.id,
|
18
|
-
style = props.style,
|
19
|
-
children = props.children;
|
20
|
-
return /*#__PURE__*/React.createElement("span", _extends({}, dataset, {
|
21
|
-
id: id,
|
22
|
-
style: inlineStyle(style),
|
23
|
-
className: clsx('ray-text', className, _defineProperty({}, styles.selectable, selectable)),
|
24
|
-
onClick: onClick,
|
25
|
-
onTouchStart: function (e) {
|
26
|
-
return onTouchStart === null || onTouchStart === void 0 ? void 0 : onTouchStart(e);
|
27
|
-
},
|
28
|
-
onTouchMove: function (e) {
|
29
|
-
return onTouchMove === null || onTouchMove === void 0 ? void 0 : onTouchMove(e);
|
30
|
-
},
|
31
|
-
onTouchEnd: function (e) {
|
32
|
-
return onTouchEnd === null || onTouchEnd === void 0 ? void 0 : onTouchEnd(e);
|
33
|
-
},
|
34
|
-
onTouchCancel: function (e) {
|
35
|
-
return onTouchCancel === null || onTouchCancel === void 0 ? void 0 : onTouchCancel(e);
|
36
|
-
}
|
37
|
-
}), children);
|
5
|
+
return (
|
6
|
+
/*#__PURE__*/
|
7
|
+
// @ts-ignore
|
8
|
+
React.createElement("ty-text", handleProps(props))
|
9
|
+
);
|
38
10
|
};
|
39
11
|
|
40
12
|
Text.displayName = 'Text';
|
package/lib/Text/index.md
CHANGED
@@ -13,7 +13,7 @@ group:
|
|
13
13
|
## 导入
|
14
14
|
|
15
15
|
```js
|
16
|
-
import { Text } from '@ray-js/components'
|
16
|
+
import { Text } from '@ray-js/components'
|
17
17
|
```
|
18
18
|
|
19
19
|
## 代码演示
|
@@ -22,8 +22,8 @@ import { Text } from '@ray-js/components';
|
|
22
22
|
|
23
23
|
## Props
|
24
24
|
|
25
|
-
| 属性 | 类型 | 默认值 | 说明 | 支持平台
|
26
|
-
| ---------- | ------------------------------ | ------ | ------------ |
|
27
|
-
| className | string | | 样式名 | RN
|
28
|
-
| selectable | boolean | false | 文本是否可选 | RN
|
29
|
-
| onClick | (e: { type: 'click' }) => void | false | 点击事件 | RN
|
25
|
+
| 属性 | 类型 | 默认值 | 说明 | 支持平台 |
|
26
|
+
| ---------- | ------------------------------ | ------ | ------------ | ------------------- |
|
27
|
+
| className | string | | 样式名 | RN、涂鸦、微信、Web |
|
28
|
+
| selectable | boolean | false | 文本是否可选 | RN、涂鸦、微信、Web |
|
29
|
+
| onClick | (e: { type: 'click' }) => void | false | 点击事件 | RN、涂鸦、微信、Web |
|
@@ -1,9 +1,40 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
1
2
|
import * as React from 'react';
|
3
|
+
import { useEventListener } from 'ahooks';
|
4
|
+
import handleProps from '../utils/handleProps';
|
2
5
|
|
3
|
-
|
4
|
-
var
|
5
|
-
|
6
|
-
|
6
|
+
var TimePicker = function (props) {
|
7
|
+
var children = props.children;
|
8
|
+
var currentNode = React.useRef(null);
|
9
|
+
useEventListener('change', function (e) {
|
10
|
+
var _props$onChange;
|
11
|
+
|
12
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
|
13
|
+
type: e.type,
|
14
|
+
value: e.detail.value,
|
15
|
+
origin: e
|
16
|
+
});
|
17
|
+
}, {
|
18
|
+
target: currentNode
|
19
|
+
});
|
20
|
+
useEventListener('cancel', function (e) {
|
21
|
+
var _props$onCancel;
|
22
|
+
|
23
|
+
(_props$onCancel = props.onCancel) === null || _props$onCancel === void 0 ? void 0 : _props$onCancel.call(props, {
|
24
|
+
type: e.type,
|
25
|
+
origin: e
|
26
|
+
});
|
27
|
+
}, {
|
28
|
+
target: currentNode
|
29
|
+
});
|
30
|
+
return (
|
31
|
+
/*#__PURE__*/
|
32
|
+
// @ts-ignore
|
33
|
+
React.createElement("ty-picker", _extends({}, handleProps(props), {
|
34
|
+
ref: currentNode,
|
35
|
+
mode: "time"
|
36
|
+
}), children)
|
37
|
+
);
|
7
38
|
};
|
8
39
|
|
9
40
|
TimePicker.displayName = 'TimePicker';
|
@@ -1,9 +1,40 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
1
2
|
import * as React from 'react';
|
3
|
+
import { useEventListener } from 'ahooks';
|
4
|
+
import handleProps from '../utils/handleProps';
|
2
5
|
|
3
|
-
|
4
|
-
var
|
5
|
-
|
6
|
-
|
6
|
+
var TimePicker = function (props) {
|
7
|
+
var children = props.children;
|
8
|
+
var currentNode = React.useRef(null);
|
9
|
+
useEventListener('change', function (e) {
|
10
|
+
var _props$onChange;
|
11
|
+
|
12
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
|
13
|
+
type: e.type,
|
14
|
+
value: e.detail.value,
|
15
|
+
origin: e
|
16
|
+
});
|
17
|
+
}, {
|
18
|
+
target: currentNode
|
19
|
+
});
|
20
|
+
useEventListener('cancel', function (e) {
|
21
|
+
var _props$onCancel;
|
22
|
+
|
23
|
+
(_props$onCancel = props.onCancel) === null || _props$onCancel === void 0 ? void 0 : _props$onCancel.call(props, {
|
24
|
+
type: e.type,
|
25
|
+
origin: e
|
26
|
+
});
|
27
|
+
}, {
|
28
|
+
target: currentNode
|
29
|
+
});
|
30
|
+
return (
|
31
|
+
/*#__PURE__*/
|
32
|
+
// @ts-ignore
|
33
|
+
React.createElement("ty-picker", _extends({}, handleProps(props), {
|
34
|
+
ref: currentNode,
|
35
|
+
mode: "time"
|
36
|
+
}), children)
|
37
|
+
);
|
7
38
|
};
|
8
39
|
|
9
40
|
TimePicker.displayName = 'TimePicker';
|