@ray-js/components 0.5.8-beta-1 → 0.5.9
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.d.ts → Button.tuya.d.ts} +0 -0
- package/lib/Button/{Button.thing.js → Button.tuya.js} +1 -1
- package/lib/Checkbox/{Checkbox.thing.d.ts → Checkbox.tuya.d.ts} +0 -0
- package/lib/Checkbox/{Checkbox.thing.js → Checkbox.tuya.js} +1 -1
- package/lib/CheckboxGroup/{CheckboxGroup.thing.d.ts → CheckboxGroup.tuya.d.ts} +0 -0
- package/lib/CheckboxGroup/{CheckboxGroup.thing.js → CheckboxGroup.tuya.js} +1 -1
- package/lib/CoverView/{CoverView.thing.d.ts → CoverView.tuya.d.ts} +0 -0
- package/lib/CoverView/{CoverView.thing.js → CoverView.tuya.js} +1 -1
- package/lib/DatePicker/{DatePicker.thing.d.ts → DatePicker.tuya.d.ts} +0 -0
- package/lib/DatePicker/{DatePicker.thing.js → DatePicker.tuya.js} +1 -1
- package/lib/Form/{Form.native.d.ts → Form.tuya.d.ts} +0 -0
- package/lib/Form/{Form.thing.js → Form.tuya.js} +1 -1
- package/lib/Icon/{Icon.thing.d.ts → Icon.tuya.d.ts} +0 -0
- package/lib/Icon/{Icon.thing.js → Icon.tuya.js} +0 -0
- package/lib/Image/{Image.thing.d.ts → Image.tuya.d.ts} +0 -0
- package/lib/Image/{Image.thing.js → Image.tuya.js} +1 -1
- package/lib/Input/{Input.thing.d.ts → Input.tuya.d.ts} +0 -0
- package/lib/Input/{Input.thing.js → Input.tuya.js} +1 -1
- package/lib/IpcPlayer/{IpcPlayer.thing.d.ts → IpcPlayer.tuya.d.ts} +0 -0
- package/lib/IpcPlayer/{IpcPlayer.thing.js → IpcPlayer.tuya.js} +1 -1
- package/lib/IpcPlayer/props.d.ts +1 -1
- package/lib/Label/{Label.thing.d.ts → Label.tuya.d.ts} +0 -0
- package/lib/Label/{Label.thing.js → Label.tuya.js} +1 -1
- package/lib/LinearGradient/{LinearGradient.thing.d.ts → LinearGradient.tuya.d.ts} +0 -0
- package/lib/LinearGradient/{LinearGradient.thing.js → LinearGradient.tuya.js} +0 -0
- package/lib/Modal/{Modal.thing.d.ts → Modal.tuya.d.ts} +0 -0
- package/lib/Modal/{Modal.thing.js → Modal.tuya.js} +0 -0
- package/lib/Motion/Fade/{index.thing.d.ts → index.tuya.d.ts} +0 -0
- package/lib/Motion/Fade/{index.thing.js → index.tuya.js} +0 -0
- package/lib/Motion/PullUp/{index.thing.d.ts → index.tuya.d.ts} +0 -0
- package/lib/Motion/PullUp/{index.thing.js → index.tuya.js} +0 -0
- package/lib/Motion/PushDown/{index.thing.d.ts → index.tuya.d.ts} +0 -0
- package/lib/Motion/PushDown/{index.thing.js → index.tuya.js} +0 -0
- package/lib/Motion/ScaleFadeIn/{index.thing.d.ts → index.tuya.d.ts} +0 -0
- package/lib/Motion/ScaleFadeIn/{index.thing.js → index.tuya.js} +0 -0
- package/lib/Motion/ScalePullDown/{index.thing.d.ts → index.tuya.d.ts} +0 -0
- package/lib/Motion/ScalePullDown/{index.thing.js → index.tuya.js} +0 -0
- package/lib/PageContainer/{PageContainer.thing.d.ts → PageContainer.tuya.d.ts} +0 -0
- package/lib/PageContainer/{PageContainer.thing.js → PageContainer.tuya.js} +1 -1
- package/lib/PageContainer/props.d.ts +1 -1
- package/lib/Picker/{Picker.thing.d.ts → Picker.tuya.d.ts} +0 -0
- package/lib/Picker/{Picker.thing.js → Picker.tuya.js} +1 -1
- package/lib/PickerView/{PickerView.thing.d.ts → PickerView.tuya.d.ts} +0 -0
- package/lib/PickerView/{PickerView.thing.js → PickerView.tuya.js} +1 -1
- package/lib/PickerViewColumn/{PickerViewColumn.thing.d.ts → PickerViewColumn.tuya.d.ts} +0 -0
- package/lib/PickerViewColumn/{PickerViewColumn.thing.js → PickerViewColumn.tuya.js} +1 -1
- package/lib/PickerViewColumn/PickerViewColumn.wechat.js +1 -1
- package/lib/RadialGradient/{RadialGradient.thing.d.ts → RadialGradient.tuya.d.ts} +0 -0
- package/lib/RadialGradient/{RadialGradient.thing.js → RadialGradient.tuya.js} +0 -0
- package/lib/Radio/{Radio.thing.d.ts → Radio.tuya.d.ts} +0 -0
- package/lib/Radio/{Radio.thing.js → Radio.tuya.js} +1 -1
- package/lib/RadioGroup/{RadioGroup.thing.d.ts → RadioGroup.tuya.d.ts} +0 -0
- package/lib/RadioGroup/{RadioGroup.thing.js → RadioGroup.tuya.js} +1 -1
- package/lib/ScrollView/{ScrollView.thing.d.ts → ScrollView.tuya.d.ts} +0 -0
- package/lib/ScrollView/{ScrollView.thing.js → ScrollView.tuya.js} +1 -1
- package/lib/Slider/{Slider.thing.d.ts → Slider.tuya.d.ts} +0 -0
- package/lib/Slider/{Slider.thing.js → Slider.tuya.js} +1 -1
- package/lib/Swiper/{Swiper.thing.d.ts → Swiper.tuya.d.ts} +0 -0
- package/lib/Swiper/{Swiper.thing.js → Swiper.tuya.js} +1 -1
- package/lib/SwiperItem/{SwiperItem.thing.d.ts → SwiperItem.tuya.d.ts} +0 -0
- package/lib/SwiperItem/{SwiperItem.thing.js → SwiperItem.tuya.js} +1 -1
- package/lib/SwiperItem/SwiperItem.wechat.js +1 -1
- package/lib/Switch/{Switch.thing.d.ts → Switch.tuya.d.ts} +0 -0
- package/lib/Switch/{Switch.thing.js → Switch.tuya.js} +1 -1
- package/lib/Text/{Text.thing.d.ts → Text.tuya.d.ts} +0 -0
- package/lib/Text/{Text.thing.js → Text.tuya.js} +1 -1
- package/lib/Textarea/{Textarea.thing.d.ts → Textarea.tuya.d.ts} +0 -0
- package/lib/Textarea/{Textarea.thing.js → Textarea.tuya.js} +1 -1
- package/lib/TimePicker/{TimePicker.thing.d.ts → TimePicker.tuya.d.ts} +0 -0
- package/lib/TimePicker/{TimePicker.thing.js → TimePicker.tuya.js} +1 -1
- package/lib/View/{View.thing.d.ts → View.tuya.d.ts} +0 -0
- package/lib/View/{View.thing.js → View.tuya.js} +1 -1
- package/lib/utils/index.d.ts +1 -2
- package/package.json +5 -5
- 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.js +0 -8
- package/lib/Form/Form.thing.d.ts +0 -4
- 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,229 +0,0 @@
|
|
1
|
-
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
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
|
-
import "core-js/modules/es.array.concat.js";
|
9
|
-
import "core-js/modules/es.array.map.js";
|
10
|
-
import "core-js/modules/es.array.index-of.js";
|
11
|
-
import React from 'react';
|
12
|
-
import { Animated, Image, Easing, StyleSheet, View, Text, TouchableWithoutFeedback } from 'react-native';
|
13
|
-
import { iconList } from '../assets/icons';
|
14
|
-
import { defaultButtonProps } from './props';
|
15
|
-
import { extracteTextStyle } from '../utils';
|
16
|
-
|
17
|
-
var Loading = function (props) {
|
18
|
-
var rotate = React.useRef(new Animated.Value(0)).current;
|
19
|
-
var tintColor = props.tintColor;
|
20
|
-
React.useEffect(function () {
|
21
|
-
var animation = Animated.loop(Animated.timing(rotate, {
|
22
|
-
toValue: 1,
|
23
|
-
duration: 1000,
|
24
|
-
easing: Easing.linear,
|
25
|
-
useNativeDriver: true,
|
26
|
-
isInteraction: false
|
27
|
-
}));
|
28
|
-
animation.start();
|
29
|
-
return function () {
|
30
|
-
animation.stop();
|
31
|
-
};
|
32
|
-
}, []);
|
33
|
-
var rotateDeg = rotate.interpolate({
|
34
|
-
inputRange: [0, 1],
|
35
|
-
outputRange: ['0deg', '360deg']
|
36
|
-
});
|
37
|
-
return /*#__PURE__*/React.createElement(Animated.View, {
|
38
|
-
style: [styles.loading, {
|
39
|
-
transform: [{
|
40
|
-
rotate: rotateDeg
|
41
|
-
}]
|
42
|
-
}]
|
43
|
-
}, /*#__PURE__*/React.createElement(Image, {
|
44
|
-
source: iconList.loading,
|
45
|
-
style: [styles.loadingImg, {
|
46
|
-
tintColor: tintColor
|
47
|
-
}]
|
48
|
-
}));
|
49
|
-
};
|
50
|
-
|
51
|
-
var Button = /*#__PURE__*/function (_React$Component) {
|
52
|
-
_inherits(Button, _React$Component);
|
53
|
-
|
54
|
-
var _super = _createSuper(Button);
|
55
|
-
|
56
|
-
function Button() {
|
57
|
-
var _this;
|
58
|
-
|
59
|
-
_classCallCheck(this, Button);
|
60
|
-
|
61
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
62
|
-
args[_key] = arguments[_key];
|
63
|
-
}
|
64
|
-
|
65
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
66
|
-
|
67
|
-
_defineProperty(_assertThisInitialized(_this), "$touchable", /*#__PURE__*/React.createRef());
|
68
|
-
|
69
|
-
_defineProperty(_assertThisInitialized(_this), "isTouchEnd", false);
|
70
|
-
|
71
|
-
_defineProperty(_assertThisInitialized(_this), "pressInTimer", null);
|
72
|
-
|
73
|
-
_defineProperty(_assertThisInitialized(_this), "pressOutTimer", null);
|
74
|
-
|
75
|
-
_defineProperty(_assertThisInitialized(_this), "state", {
|
76
|
-
isHover: false
|
77
|
-
});
|
78
|
-
|
79
|
-
_defineProperty(_assertThisInitialized(_this), "onPress", function () {
|
80
|
-
var _this$props = _this.props,
|
81
|
-
disabled = _this$props.disabled,
|
82
|
-
onClick = _this$props.onClick;
|
83
|
-
!disabled && typeof onClick === 'function' && onClick({
|
84
|
-
type: 'click'
|
85
|
-
});
|
86
|
-
});
|
87
|
-
|
88
|
-
_defineProperty(_assertThisInitialized(_this), "onPressIn", function () {
|
89
|
-
var _this$props2 = _this.props,
|
90
|
-
hoverStartTime = _this$props2.hoverStartTime,
|
91
|
-
hoverStyle = _this$props2.hoverStyle;
|
92
|
-
_this.isTouchEnd = false;
|
93
|
-
|
94
|
-
if (hoverStyle) {
|
95
|
-
_this.pressInTimer = setTimeout(function () {
|
96
|
-
_this.setState({
|
97
|
-
isHover: true
|
98
|
-
}, function () {
|
99
|
-
if (_this.isTouchEnd) {
|
100
|
-
_this.stopHover();
|
101
|
-
}
|
102
|
-
});
|
103
|
-
|
104
|
-
clearTimeout(_this.pressInTimer);
|
105
|
-
}, hoverStartTime);
|
106
|
-
}
|
107
|
-
});
|
108
|
-
|
109
|
-
_defineProperty(_assertThisInitialized(_this), "stopHover", function () {
|
110
|
-
var hoverStayTime = _this.props.hoverStayTime;
|
111
|
-
_this.pressOutTimer = setTimeout(function () {
|
112
|
-
_this.setState({
|
113
|
-
isHover: false
|
114
|
-
});
|
115
|
-
|
116
|
-
clearTimeout(_this.pressOutTimer);
|
117
|
-
}, hoverStayTime);
|
118
|
-
});
|
119
|
-
|
120
|
-
_defineProperty(_assertThisInitialized(_this), "onPressOut", function () {
|
121
|
-
var hoverStyle = _this.props.hoverStyle;
|
122
|
-
var isHover = _this.state.isHover;
|
123
|
-
_this.isTouchEnd = true;
|
124
|
-
|
125
|
-
if (hoverStyle && isHover) {
|
126
|
-
_this.stopHover();
|
127
|
-
}
|
128
|
-
});
|
129
|
-
|
130
|
-
_defineProperty(_assertThisInitialized(_this), "_simulateNativePress", function (evt) {
|
131
|
-
var node = _this.$touchable.current;
|
132
|
-
node && node.props.onPress && node.props.onPress(evt);
|
133
|
-
});
|
134
|
-
|
135
|
-
return _this;
|
136
|
-
}
|
137
|
-
|
138
|
-
_createClass(Button, [{
|
139
|
-
key: "componentWillUnmount",
|
140
|
-
value: function componentWillUnmount() {
|
141
|
-
clearTimeout(this.pressOutTimer);
|
142
|
-
clearTimeout(this.pressInTimer);
|
143
|
-
}
|
144
|
-
}, {
|
145
|
-
key: "render",
|
146
|
-
value: function render() {
|
147
|
-
var _this$props3 = this.props,
|
148
|
-
loading = _this$props3.loading,
|
149
|
-
style = _this$props3.style,
|
150
|
-
size = _this$props3.size,
|
151
|
-
children = _this$props3.children,
|
152
|
-
disabled = _this$props3.disabled,
|
153
|
-
type = _this$props3.type,
|
154
|
-
plain = _this$props3.plain,
|
155
|
-
hoverStyle = _this$props3.hoverStyle;
|
156
|
-
var isDefaultSize = size === 'default';
|
157
|
-
var isDefaultType = type === 'default';
|
158
|
-
var isPrimaryType = type === 'primary';
|
159
|
-
var borderColor = isPrimaryType ? '#007AFF' : isDefaultType ? 'rgba(0, 0, 0, 0.2)' : '#FF4444';
|
160
|
-
var backgroundColor = disabled ? 'rgba(0, 0, 0, 0.2)' : plain ? 'transparent' : isPrimaryType ? '#007AFF' : '#FFF';
|
161
|
-
var textColor = disabled ? '#FFF' : plain ? borderColor : isDefaultType ? '#007AFF' : type === 'warn' ? '#FF4444' : '#FFFFFF';
|
162
|
-
var textHoverStyle = this.state.isHover ? extracteTextStyle(hoverStyle) : {};
|
163
|
-
return /*#__PURE__*/React.createElement(TouchableWithoutFeedback, {
|
164
|
-
onPress: this.onPress,
|
165
|
-
onLongPress: this.onPress,
|
166
|
-
onPressIn: this.onPressIn,
|
167
|
-
onPressOut: this.onPressOut,
|
168
|
-
ref: this.$touchable,
|
169
|
-
disabled: disabled
|
170
|
-
}, /*#__PURE__*/React.createElement(View, {
|
171
|
-
style: [styles.btn, !isDefaultSize && styles.btnMini, {
|
172
|
-
backgroundColor: backgroundColor
|
173
|
-
}, plain && {
|
174
|
-
borderWidth: 1,
|
175
|
-
borderColor: borderColor
|
176
|
-
}, style, this.state.isHover && hoverStyle]
|
177
|
-
}, loading && /*#__PURE__*/React.createElement(Loading, {
|
178
|
-
tintColor: textColor
|
179
|
-
}), Array.isArray(children) ? children.map(function (c, i) {
|
180
|
-
return /*#__PURE__*/React.createElement(Text, {
|
181
|
-
key: i,
|
182
|
-
style: [styles.btnText, !isDefaultSize && styles.btnTextMini, {
|
183
|
-
color: textColor
|
184
|
-
}, textHoverStyle]
|
185
|
-
}, c);
|
186
|
-
}) : ['string', 'number'].indexOf(_typeof(children)) > -1 ? /*#__PURE__*/React.createElement(Text, {
|
187
|
-
style: [styles.btnText, !isDefaultSize && styles.btnTextMini, {
|
188
|
-
color: textColor
|
189
|
-
}, textHoverStyle]
|
190
|
-
}, children) : children));
|
191
|
-
}
|
192
|
-
}]);
|
193
|
-
|
194
|
-
return Button;
|
195
|
-
}(React.Component);
|
196
|
-
|
197
|
-
_defineProperty(Button, "displayName", '_Button');
|
198
|
-
|
199
|
-
_defineProperty(Button, "defaultProps", defaultButtonProps);
|
200
|
-
|
201
|
-
export default Button;
|
202
|
-
var styles = StyleSheet.create({
|
203
|
-
btn: {
|
204
|
-
flexDirection: 'row',
|
205
|
-
justifyContent: 'center',
|
206
|
-
alignItems: 'center',
|
207
|
-
paddingHorizontal: 14,
|
208
|
-
height: 46,
|
209
|
-
backgroundColor: '#F8F8F8',
|
210
|
-
borderRadius: 5
|
211
|
-
},
|
212
|
-
loading: {
|
213
|
-
marginRight: 5
|
214
|
-
},
|
215
|
-
loadingImg: {
|
216
|
-
width: 20,
|
217
|
-
height: 20
|
218
|
-
},
|
219
|
-
btnMini: {
|
220
|
-
height: 30
|
221
|
-
},
|
222
|
-
btnText: {
|
223
|
-
fontSize: 18,
|
224
|
-
color: '#000'
|
225
|
-
},
|
226
|
-
btnTextMini: {
|
227
|
-
fontSize: 13
|
228
|
-
}
|
229
|
-
});
|
@@ -1,28 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { TouchableWithoutFeedback, GestureResponderEvent } from 'react-native';
|
3
|
-
import { CheckboxProps } from './props';
|
4
|
-
export declare type EventOnChange = {
|
5
|
-
value: string;
|
6
|
-
checked: boolean;
|
7
|
-
type: 'change';
|
8
|
-
};
|
9
|
-
export interface CheckboxNativeProps extends CheckboxProps {
|
10
|
-
onChange?: (evt: EventOnChange) => void;
|
11
|
-
}
|
12
|
-
export interface CheckboxState {
|
13
|
-
checked: boolean;
|
14
|
-
}
|
15
|
-
declare class Checkbox extends React.Component<CheckboxNativeProps, CheckboxState> {
|
16
|
-
static displayName: string;
|
17
|
-
static defaultProps: {
|
18
|
-
value: string;
|
19
|
-
color: string;
|
20
|
-
};
|
21
|
-
$touchable: React.RefObject<TouchableWithoutFeedback>;
|
22
|
-
constructor(props: CheckboxNativeProps);
|
23
|
-
componentDidUpdate(prevProps: CheckboxNativeProps): void;
|
24
|
-
_simulateNativePress: (evt: GestureResponderEvent) => void;
|
25
|
-
onPress: () => void;
|
26
|
-
render(): JSX.Element;
|
27
|
-
}
|
28
|
-
export default Checkbox;
|
@@ -1,118 +0,0 @@
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
4
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
5
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
6
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
7
|
-
import React from 'react';
|
8
|
-
import { TouchableWithoutFeedback, StyleSheet, View } from 'react-native';
|
9
|
-
import Icon from '../Icon';
|
10
|
-
|
11
|
-
var Checkbox = /*#__PURE__*/function (_React$Component) {
|
12
|
-
_inherits(Checkbox, _React$Component);
|
13
|
-
|
14
|
-
var _super = _createSuper(Checkbox);
|
15
|
-
|
16
|
-
function Checkbox(props) {
|
17
|
-
var _this;
|
18
|
-
|
19
|
-
_classCallCheck(this, Checkbox);
|
20
|
-
|
21
|
-
_this = _super.call(this, props);
|
22
|
-
|
23
|
-
_defineProperty(_assertThisInitialized(_this), "$touchable", /*#__PURE__*/React.createRef());
|
24
|
-
|
25
|
-
_defineProperty(_assertThisInitialized(_this), "_simulateNativePress", function (evt) {
|
26
|
-
var node = _this.$touchable.current;
|
27
|
-
node && node.props.onPress && node.props.onPress(evt);
|
28
|
-
});
|
29
|
-
|
30
|
-
_defineProperty(_assertThisInitialized(_this), "onPress", function () {
|
31
|
-
var _this$props = _this.props,
|
32
|
-
disabled = _this$props.disabled,
|
33
|
-
onChange = _this$props.onChange,
|
34
|
-
value = _this$props.value;
|
35
|
-
if (disabled) return;
|
36
|
-
var checked = !_this.state.checked;
|
37
|
-
typeof onChange === 'function' && onChange({
|
38
|
-
value: value,
|
39
|
-
checked: checked,
|
40
|
-
type: 'change'
|
41
|
-
});
|
42
|
-
|
43
|
-
_this.setState({
|
44
|
-
checked: checked
|
45
|
-
});
|
46
|
-
});
|
47
|
-
|
48
|
-
_this.state = {
|
49
|
-
checked: props.checked
|
50
|
-
};
|
51
|
-
return _this;
|
52
|
-
}
|
53
|
-
|
54
|
-
_createClass(Checkbox, [{
|
55
|
-
key: "componentDidUpdate",
|
56
|
-
value: function componentDidUpdate(prevProps) {
|
57
|
-
if (prevProps.checked !== this.props.checked) {
|
58
|
-
this.setState({
|
59
|
-
checked: !!this.props.checked
|
60
|
-
});
|
61
|
-
}
|
62
|
-
}
|
63
|
-
}, {
|
64
|
-
key: "render",
|
65
|
-
value: function render() {
|
66
|
-
var _this$props2 = this.props,
|
67
|
-
style = _this$props2.style,
|
68
|
-
color = _this$props2.color,
|
69
|
-
disabled = _this$props2.disabled;
|
70
|
-
var checked = this.state.checked;
|
71
|
-
return /*#__PURE__*/React.createElement(TouchableWithoutFeedback, {
|
72
|
-
onPress: this.onPress,
|
73
|
-
ref: this.$touchable
|
74
|
-
}, /*#__PURE__*/React.createElement(View, {
|
75
|
-
style: [styles.wrapper, {
|
76
|
-
backgroundColor: disabled ? 'rgba(0,0,0,0.2)' : checked ? '#007AFF' : '#FFF',
|
77
|
-
borderColor: disabled ? 'rgba(0,0,0,0.2)' : checked ? '#007AFF' : 'rgba(0,0,0,0.2)'
|
78
|
-
}, style]
|
79
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
80
|
-
type: "success_no_circle",
|
81
|
-
size: 12,
|
82
|
-
color: color,
|
83
|
-
style: [styles.wrapperIcon, checked && styles.wrapperCheckedIcon]
|
84
|
-
}), /*#__PURE__*/React.createElement(View, {
|
85
|
-
style: {
|
86
|
-
flexGrow: 0
|
87
|
-
}
|
88
|
-
}, this.props.children)));
|
89
|
-
}
|
90
|
-
}]);
|
91
|
-
|
92
|
-
return Checkbox;
|
93
|
-
}(React.Component);
|
94
|
-
|
95
|
-
_defineProperty(Checkbox, "displayName", '_Checkbox');
|
96
|
-
|
97
|
-
_defineProperty(Checkbox, "defaultProps", {
|
98
|
-
value: '',
|
99
|
-
color: '#FFF'
|
100
|
-
});
|
101
|
-
|
102
|
-
export default Checkbox;
|
103
|
-
var styles = StyleSheet.create({
|
104
|
-
wrapper: {
|
105
|
-
alignItems: 'center',
|
106
|
-
justifyContent: 'center',
|
107
|
-
width: 18,
|
108
|
-
height: 18,
|
109
|
-
borderWidth: 1,
|
110
|
-
borderRadius: 4
|
111
|
-
},
|
112
|
-
wrapperIcon: {
|
113
|
-
opacity: 0
|
114
|
-
},
|
115
|
-
wrapperCheckedIcon: {
|
116
|
-
opacity: 1
|
117
|
-
}
|
118
|
-
});
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { ViewStyle, StyleProp } from 'react-native';
|
3
|
-
import { CheckboxGroupProps, CheckboxGroupOption } from './props';
|
4
|
-
export interface IProps extends Omit<CheckboxGroupProps, 'style'> {
|
5
|
-
style?: StyleProp<ViewStyle>;
|
6
|
-
}
|
7
|
-
export interface IState {
|
8
|
-
options: CheckboxGroupOption[];
|
9
|
-
}
|
10
|
-
export default class CheckboxGroup extends React.Component<IProps, IState> {
|
11
|
-
constructor(props: IProps);
|
12
|
-
getValueData: (options: CheckboxGroupOption[]) => string[];
|
13
|
-
_handleChange: (event: {
|
14
|
-
value: string;
|
15
|
-
checked: boolean;
|
16
|
-
}, index: number) => void;
|
17
|
-
render(): JSX.Element;
|
18
|
-
}
|
@@ -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;
|