@ray-js/components 0.5.8-beta-1 → 0.5.9-beta-1
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.thing.js +0 -2
- package/lib/CheckboxGroup/CheckboxGroup.js +0 -1
- package/lib/CheckboxGroup/CheckboxGroup.thing.js +0 -1
- package/lib/CheckboxGroup/CheckboxGroup.wechat.js +0 -1
- package/lib/Icon/Icon.thing.js +0 -2
- package/lib/Input/Input.thing.js +0 -3
- package/lib/Input/Input.wechat.js +0 -1
- package/lib/RadioGroup/RadioGroup.thing.js +0 -1
- package/lib/RadioGroup/RadioGroup.wechat.js +0 -1
- package/lib/ScrollView/ScrollView.thing.js +0 -2
- package/lib/Swiper/Swiper.thing.d.ts +0 -3
- package/lib/Swiper/Swiper.thing.js +1 -2
- package/lib/Textarea/Textarea.thing.js +0 -1
- package/lib/Textarea/Textarea.wechat.js +0 -1
- package/lib/View/View.thing.js +0 -2
- package/lib/utils/handleProps.js +0 -1
- package/lib/utils/index.d.ts +1 -2
- package/package.json +4 -4
- package/lib/Button/Button.native.d.ts +0 -29
- package/lib/Button/Button.native.js +0 -229
- package/lib/Checkbox/Checkbox.native.d.ts +0 -28
- package/lib/Checkbox/Checkbox.native.js +0 -118
- package/lib/CheckboxGroup/CheckboxGroup.native.d.ts +0 -18
- package/lib/CheckboxGroup/CheckboxGroup.native.js +0 -99
- package/lib/ClickableSimplified/index.native.d.ts +0 -42
- package/lib/ClickableSimplified/index.native.js +0 -166
- package/lib/DatePicker/DatePicker.native.d.ts +0 -34
- package/lib/DatePicker/DatePicker.native.js +0 -449
- package/lib/Form/Form.native.d.ts +0 -4
- package/lib/Form/Form.native.js +0 -8
- package/lib/Icon/Icon.native.d.ts +0 -15
- package/lib/Icon/Icon.native.js +0 -48
- package/lib/Image/Image.native.d.ts +0 -28
- package/lib/Image/Image.native.js +0 -219
- package/lib/Input/Input.native.d.ts +0 -32
- package/lib/Input/Input.native.js +0 -212
- package/lib/Label/Label.native.d.ts +0 -4
- package/lib/Label/Label.native.js +0 -29
- package/lib/LinearGradient/LinearGradient.native.d.ts +0 -16
- package/lib/LinearGradient/LinearGradient.native.js +0 -60
- package/lib/Modal/Modal.native.d.ts +0 -24
- package/lib/Modal/Modal.native.js +0 -98
- package/lib/Motion/Fade/index.native.d.ts +0 -2
- package/lib/Motion/Fade/index.native.js +0 -3
- package/lib/Motion/PullUp/index.native.d.ts +0 -2
- package/lib/Motion/PullUp/index.native.js +0 -3
- package/lib/Motion/PushDown/index.native.d.ts +0 -2
- package/lib/Motion/PushDown/index.native.js +0 -3
- package/lib/Motion/ScaleFadeIn/index.native.d.ts +0 -2
- package/lib/Motion/ScaleFadeIn/index.native.js +0 -3
- package/lib/Motion/ScalePullDown/index.native.d.ts +0 -2
- package/lib/Motion/ScalePullDown/index.native.js +0 -3
- package/lib/Picker/Picker.native.d.ts +0 -22
- package/lib/Picker/Picker.native.js +0 -181
- package/lib/PickerView/PickerView.native.d.ts +0 -31
- package/lib/PickerView/PickerView.native.js +0 -175
- package/lib/PickerViewColumn/PickerViewColumn.native.d.ts +0 -31
- package/lib/PickerViewColumn/PickerViewColumn.native.js +0 -175
- package/lib/RadialGradient/RadialGradient.native.d.ts +0 -17
- package/lib/RadialGradient/RadialGradient.native.js +0 -52
- package/lib/Radio/Radio.native.d.ts +0 -30
- package/lib/Radio/Radio.native.js +0 -132
- package/lib/RadioGroup/RadioGroup.native.d.ts +0 -18
- package/lib/RadioGroup/RadioGroup.native.js +0 -99
- package/lib/ScrollView/ScrollView.native.d.ts +0 -57
- package/lib/ScrollView/ScrollView.native.js +0 -283
- package/lib/Slider/Slider.native.d.ts +0 -21
- package/lib/Slider/Slider.native.js +0 -114
- package/lib/Swiper/Swiper.native.d.ts +0 -6
- package/lib/Swiper/Swiper.native.js +0 -68
- package/lib/Switch/Switch.native.d.ts +0 -25
- package/lib/Switch/Switch.native.js +0 -128
- package/lib/Text/Text.native.d.ts +0 -8
- package/lib/Text/Text.native.js +0 -37
- package/lib/Textarea/Textarea.native.d.ts +0 -4
- package/lib/Textarea/Textarea.native.js +0 -26
- package/lib/TimePicker/TimePicker.native.d.ts +0 -39
- package/lib/TimePicker/TimePicker.native.js +0 -319
- package/lib/View/View.native.d.ts +0 -2
- package/lib/View/View.native.js +0 -35
@@ -1,99 +0,0 @@
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
3
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
4
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
5
|
-
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
6
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
7
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
8
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
9
|
-
import "core-js/modules/es.array.map.js";
|
10
|
-
import "core-js/modules/es.array.filter.js";
|
11
|
-
import "core-js/modules/es.object.to-string.js";
|
12
|
-
import "core-js/modules/es.array.concat.js";
|
13
|
-
import React from 'react';
|
14
|
-
import { View, Text } from 'react-native';
|
15
|
-
import Checkbox from '../Checkbox';
|
16
|
-
|
17
|
-
var CheckboxGroup = /*#__PURE__*/function (_React$Component) {
|
18
|
-
_inherits(CheckboxGroup, _React$Component);
|
19
|
-
|
20
|
-
var _super = _createSuper(CheckboxGroup);
|
21
|
-
|
22
|
-
function CheckboxGroup(props) {
|
23
|
-
var _this;
|
24
|
-
|
25
|
-
_classCallCheck(this, CheckboxGroup);
|
26
|
-
|
27
|
-
_this = _super.call(this, props);
|
28
|
-
|
29
|
-
_defineProperty(_assertThisInitialized(_this), "getValueData", function (options) {
|
30
|
-
return options.filter(function (item) {
|
31
|
-
return item.checked;
|
32
|
-
}).map(function (item) {
|
33
|
-
return item.value;
|
34
|
-
});
|
35
|
-
});
|
36
|
-
|
37
|
-
_defineProperty(_assertThisInitialized(_this), "_handleChange", function (event, index) {
|
38
|
-
var onChange = _this.props.onChange;
|
39
|
-
var options = _this.state.options;
|
40
|
-
var newOptions = options.concat([]);
|
41
|
-
newOptions[index] = _objectSpread(_objectSpread({}, newOptions[index]), event);
|
42
|
-
|
43
|
-
_this.setState({
|
44
|
-
options: newOptions
|
45
|
-
});
|
46
|
-
|
47
|
-
typeof onChange === 'function' && onChange({
|
48
|
-
type: 'change',
|
49
|
-
value: _this.getValueData(newOptions)
|
50
|
-
});
|
51
|
-
});
|
52
|
-
|
53
|
-
_this.state = {
|
54
|
-
options: props.options
|
55
|
-
};
|
56
|
-
return _this;
|
57
|
-
}
|
58
|
-
|
59
|
-
_createClass(CheckboxGroup, [{
|
60
|
-
key: "render",
|
61
|
-
value: function render() {
|
62
|
-
var _this2 = this;
|
63
|
-
|
64
|
-
var _this$props = this.props,
|
65
|
-
style = _this$props.style,
|
66
|
-
disabled = _this$props.disabled;
|
67
|
-
var options = this.state.options;
|
68
|
-
return /*#__PURE__*/React.createElement(View, {
|
69
|
-
style: [{
|
70
|
-
flexDirection: 'row'
|
71
|
-
}, style]
|
72
|
-
}, options.length && options.map(function (item, index) {
|
73
|
-
var data = disabled ? _objectSpread(_objectSpread({}, item), {}, {
|
74
|
-
disabled: disabled
|
75
|
-
}) : item;
|
76
|
-
return /*#__PURE__*/React.createElement(View, {
|
77
|
-
style: {
|
78
|
-
flexDirection: 'row',
|
79
|
-
alignItems: 'center',
|
80
|
-
paddingLeft: index ? 5 : 0
|
81
|
-
},
|
82
|
-
key: Math.random()
|
83
|
-
}, /*#__PURE__*/React.createElement(Checkbox, _extends({}, data, {
|
84
|
-
onChange: function onChange(event) {
|
85
|
-
return _this2._handleChange(event, index);
|
86
|
-
}
|
87
|
-
})), item.label && /*#__PURE__*/React.createElement(Text, {
|
88
|
-
style: {
|
89
|
-
marginLeft: 5
|
90
|
-
}
|
91
|
-
}, item.label));
|
92
|
-
}));
|
93
|
-
}
|
94
|
-
}]);
|
95
|
-
|
96
|
-
return CheckboxGroup;
|
97
|
-
}(React.Component);
|
98
|
-
|
99
|
-
export { CheckboxGroup as default };
|
@@ -1,42 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* ✔ hoverStyle: Convert hoverClass to hoverStyle.
|
3
|
-
* ✔ hoverStartTime
|
4
|
-
* ✔ hoverStayTime
|
5
|
-
* ✔ onClick
|
6
|
-
* ✔ onLongClick
|
7
|
-
* ✔ onTouchStart
|
8
|
-
* ✔ onTouchEnd
|
9
|
-
*/
|
10
|
-
import React from 'react';
|
11
|
-
import { GestureResponderEvent, StyleProp, ViewStyle } from 'react-native';
|
12
|
-
export declare type NativeEvent = {
|
13
|
-
identifier: string;
|
14
|
-
pageX: number;
|
15
|
-
pageY: number;
|
16
|
-
};
|
17
|
-
export declare type TouchEventRet = {
|
18
|
-
type: 'touchstart' | 'touchend';
|
19
|
-
timeStamp: number;
|
20
|
-
touches: NativeEvent[];
|
21
|
-
changedTouches: NativeEvent[];
|
22
|
-
origin: GestureResponderEvent;
|
23
|
-
};
|
24
|
-
export declare type ClickEventRet = {
|
25
|
-
type: 'click' | 'longclick';
|
26
|
-
timeStamp: number;
|
27
|
-
pageX: number;
|
28
|
-
pageY: number;
|
29
|
-
origin: GestureResponderEvent;
|
30
|
-
};
|
31
|
-
export interface ClickableProps {
|
32
|
-
className?: string;
|
33
|
-
style?: StyleProp<ViewStyle>;
|
34
|
-
hoverStyle?: StyleProp<ViewStyle>;
|
35
|
-
hoverStartTime?: number;
|
36
|
-
hoverStayTime?: number;
|
37
|
-
onClick?: (event: ClickEventRet) => void;
|
38
|
-
onLongClick?: (event: ClickEventRet) => void;
|
39
|
-
onTouchStart?: (event: TouchEventRet) => void;
|
40
|
-
onTouchEnd?: (event: TouchEventRet) => void;
|
41
|
-
}
|
42
|
-
export default function ClickableSimplified<P extends Record<string, any>>(WrappedComponent: React.ComponentType<Record<string, any>>): React.ReactNode;
|
@@ -1,166 +0,0 @@
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
3
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
4
|
-
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
5
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
6
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
7
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
8
|
-
|
9
|
-
/**
|
10
|
-
* ✔ hoverStyle: Convert hoverClass to hoverStyle.
|
11
|
-
* ✔ hoverStartTime
|
12
|
-
* ✔ hoverStayTime
|
13
|
-
* ✔ onClick
|
14
|
-
* ✔ onLongClick
|
15
|
-
* ✔ onTouchStart
|
16
|
-
* ✔ onTouchEnd
|
17
|
-
*/
|
18
|
-
import React from 'react';
|
19
|
-
import { PanResponder } from 'react-native';
|
20
|
-
import { omit, getClickEvent, getTouchEvent } from '../utils';
|
21
|
-
export default function ClickableSimplified(WrappedComponent) {
|
22
|
-
var _class;
|
23
|
-
|
24
|
-
return _class = /*#__PURE__*/function (_React$Component) {
|
25
|
-
_inherits(_Clickable, _React$Component);
|
26
|
-
|
27
|
-
var _super = _createSuper(_Clickable);
|
28
|
-
|
29
|
-
function _Clickable(props) {
|
30
|
-
var _this;
|
31
|
-
|
32
|
-
_classCallCheck(this, _Clickable);
|
33
|
-
|
34
|
-
_this = _super.call(this, props);
|
35
|
-
|
36
|
-
_defineProperty(_assertThisInitialized(_this), "startTimestamp", 0);
|
37
|
-
|
38
|
-
_defineProperty(_assertThisInitialized(_this), "setStartTimer", function () {
|
39
|
-
var _this$props = _this.props,
|
40
|
-
hoverStyle = _this$props.hoverStyle,
|
41
|
-
hoverStartTime = _this$props.hoverStartTime;
|
42
|
-
|
43
|
-
if (hoverStyle) {
|
44
|
-
_this.startTimer && clearTimeout(_this.startTimer);
|
45
|
-
_this.startTimer = setTimeout(function () {
|
46
|
-
_this.setState({
|
47
|
-
hoverable: true
|
48
|
-
});
|
49
|
-
}, hoverStartTime);
|
50
|
-
}
|
51
|
-
});
|
52
|
-
|
53
|
-
_defineProperty(_assertThisInitialized(_this), "setStayTimer", function () {
|
54
|
-
var _this$props2 = _this.props,
|
55
|
-
hoverStyle = _this$props2.hoverStyle,
|
56
|
-
hoverStayTime = _this$props2.hoverStayTime;
|
57
|
-
|
58
|
-
if (hoverStyle) {
|
59
|
-
_this.stayTimer && clearTimeout(_this.stayTimer);
|
60
|
-
_this.stayTimer = setTimeout(function () {
|
61
|
-
_this.state.hoverable && _this.setState({
|
62
|
-
hoverable: false
|
63
|
-
});
|
64
|
-
}, hoverStayTime);
|
65
|
-
}
|
66
|
-
});
|
67
|
-
|
68
|
-
_defineProperty(_assertThisInitialized(_this), "handleStartShouldSetPanResponder", function () {
|
69
|
-
var _this$props3 = _this.props,
|
70
|
-
hoverStyle = _this$props3.hoverStyle,
|
71
|
-
onClick = _this$props3.onClick,
|
72
|
-
onLongClick = _this$props3.onLongClick,
|
73
|
-
onTouchStart = _this$props3.onTouchStart,
|
74
|
-
onTouchEnd = _this$props3.onTouchEnd;
|
75
|
-
return !!(hoverStyle || onClick || onLongClick || onTouchStart || onTouchEnd);
|
76
|
-
});
|
77
|
-
|
78
|
-
_defineProperty(_assertThisInitialized(_this), "handlePanResponderGrant", function (evt) {
|
79
|
-
var onTouchStart = _this.props.onTouchStart;
|
80
|
-
onTouchStart && onTouchStart(getTouchEvent(evt, 'touchstart'));
|
81
|
-
_this.startTimestamp = evt.nativeEvent.timestamp;
|
82
|
-
|
83
|
-
_this.setStartTimer();
|
84
|
-
});
|
85
|
-
|
86
|
-
_defineProperty(_assertThisInitialized(_this), "handlePanResponderRelease", function (evt, gestureState) {
|
87
|
-
var _this$props4 = _this.props,
|
88
|
-
onClick = _this$props4.onClick,
|
89
|
-
onLongClick = _this$props4.onLongClick,
|
90
|
-
onTouchEnd = _this$props4.onTouchEnd;
|
91
|
-
onTouchEnd && onTouchEnd(getTouchEvent(evt, 'touchend'));
|
92
|
-
var endTimestamp = evt.nativeEvent.timestamp;
|
93
|
-
var gapTime = endTimestamp - _this.startTimestamp;
|
94
|
-
var hasMove = Math.abs(gestureState.dx) >= 1 || Math.abs(gestureState.dy) >= 1;
|
95
|
-
|
96
|
-
if (!hasMove) {
|
97
|
-
if (gapTime <= 350) {
|
98
|
-
onClick && onClick(getClickEvent(evt, 'click'));
|
99
|
-
} else {
|
100
|
-
onLongClick && onLongClick(getClickEvent(evt, 'longclick'));
|
101
|
-
}
|
102
|
-
}
|
103
|
-
|
104
|
-
_this.setStayTimer();
|
105
|
-
});
|
106
|
-
|
107
|
-
_this.state = {
|
108
|
-
hoverable: false
|
109
|
-
};
|
110
|
-
_this.panResponder = PanResponder.create({
|
111
|
-
onStartShouldSetPanResponder: _this.handleStartShouldSetPanResponder,
|
112
|
-
onShouldBlockNativeResponder: function onShouldBlockNativeResponder() {
|
113
|
-
return false;
|
114
|
-
},
|
115
|
-
onPanResponderGrant: function onPanResponderGrant(evt) {
|
116
|
-
return _this.handlePanResponderGrant(evt);
|
117
|
-
},
|
118
|
-
onPanResponderTerminationRequest: function onPanResponderTerminationRequest() {
|
119
|
-
return true;
|
120
|
-
},
|
121
|
-
onPanResponderRelease: function onPanResponderRelease(evt, gestureState) {
|
122
|
-
return _this.handlePanResponderRelease(evt, gestureState);
|
123
|
-
},
|
124
|
-
onPanResponderTerminate: function onPanResponderTerminate() {
|
125
|
-
_this.setStayTimer();
|
126
|
-
}
|
127
|
-
});
|
128
|
-
return _this;
|
129
|
-
}
|
130
|
-
|
131
|
-
_createClass(_Clickable, [{
|
132
|
-
key: "componentWillUnmount",
|
133
|
-
value: function componentWillUnmount() {
|
134
|
-
this.startTimer && clearTimeout(this.startTimer);
|
135
|
-
this.stayTimer && clearTimeout(this.stayTimer);
|
136
|
-
}
|
137
|
-
}, {
|
138
|
-
key: "render",
|
139
|
-
value: function render() {
|
140
|
-
var _this$props5 = this.props,
|
141
|
-
style = _this$props5.style,
|
142
|
-
hoverStyle = _this$props5.hoverStyle,
|
143
|
-
onClick = _this$props5.onClick,
|
144
|
-
onLongClick = _this$props5.onLongClick,
|
145
|
-
onTouchStart = _this$props5.onTouchStart,
|
146
|
-
onTouchEnd = _this$props5.onTouchEnd;
|
147
|
-
var hoverable = this.state.hoverable;
|
148
|
-
|
149
|
-
if (!hoverStyle && !onClick && !onLongClick && !onTouchStart && !onTouchEnd) {
|
150
|
-
return /*#__PURE__*/React.createElement(WrappedComponent, this.props);
|
151
|
-
}
|
152
|
-
|
153
|
-
return /*#__PURE__*/React.createElement(WrappedComponent, _extends({}, omit(this.props, ['style', 'hoverStyle', 'hoverStartTime', 'hoverStayTime', 'onClick', 'onLongClick', 'onTouchStart', 'onTouchEnd']), this.panResponder.panHandlers, {
|
154
|
-
style: [{
|
155
|
-
backgroundColor: 'transparent'
|
156
|
-
}, style, hoverable && hoverStyle]
|
157
|
-
}));
|
158
|
-
}
|
159
|
-
}]);
|
160
|
-
|
161
|
-
return _Clickable;
|
162
|
-
}(React.Component), _defineProperty(_class, "defaultProps", {
|
163
|
-
hoverStartTime: 20,
|
164
|
-
hoverStayTime: 70
|
165
|
-
}), _class;
|
166
|
-
}
|
@@ -1,34 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { DatePickerProps, IState } from './props';
|
3
|
-
export default class DatePicker extends React.Component<DatePickerProps, IState> {
|
4
|
-
static displayName: string;
|
5
|
-
static defaultProps: DatePickerProps;
|
6
|
-
constructor(props: DatePickerProps);
|
7
|
-
componentDidUpdate(prevProps: Readonly<DatePickerProps>): void;
|
8
|
-
format: (time: Date) => {
|
9
|
-
year: number;
|
10
|
-
month: number;
|
11
|
-
day: number;
|
12
|
-
};
|
13
|
-
getDateListArr: () => any[];
|
14
|
-
getCurrentValue: (value: string) => {
|
15
|
-
currentYear: number;
|
16
|
-
currentMonth: number;
|
17
|
-
currentDay: number;
|
18
|
-
};
|
19
|
-
calculateValue: (value: number) => string;
|
20
|
-
getRangeAndValue: (value: string) => {
|
21
|
-
range: any[];
|
22
|
-
currentValue: number[] | number;
|
23
|
-
dateListArr: any[];
|
24
|
-
};
|
25
|
-
_handleCancel: () => void;
|
26
|
-
_handleConfirm: () => void;
|
27
|
-
_handlePickerChange: (event: {
|
28
|
-
column: number;
|
29
|
-
value: number | number[];
|
30
|
-
type: 'change';
|
31
|
-
}) => void;
|
32
|
-
renderTitleView: () => JSX.Element;
|
33
|
-
render(): JSX.Element;
|
34
|
-
}
|