@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.
Files changed (80) hide show
  1. package/lib/Button/Button.thing.js +0 -2
  2. package/lib/CheckboxGroup/CheckboxGroup.js +0 -1
  3. package/lib/CheckboxGroup/CheckboxGroup.thing.js +0 -1
  4. package/lib/CheckboxGroup/CheckboxGroup.wechat.js +0 -1
  5. package/lib/Icon/Icon.thing.js +0 -2
  6. package/lib/Input/Input.thing.js +0 -3
  7. package/lib/Input/Input.wechat.js +0 -1
  8. package/lib/RadioGroup/RadioGroup.thing.js +0 -1
  9. package/lib/RadioGroup/RadioGroup.wechat.js +0 -1
  10. package/lib/ScrollView/ScrollView.thing.js +0 -2
  11. package/lib/Swiper/Swiper.thing.d.ts +0 -3
  12. package/lib/Swiper/Swiper.thing.js +1 -2
  13. package/lib/Textarea/Textarea.thing.js +0 -1
  14. package/lib/Textarea/Textarea.wechat.js +0 -1
  15. package/lib/View/View.thing.js +0 -2
  16. package/lib/utils/handleProps.js +0 -1
  17. package/lib/utils/index.d.ts +1 -2
  18. package/package.json +4 -4
  19. package/lib/Button/Button.native.d.ts +0 -29
  20. package/lib/Button/Button.native.js +0 -229
  21. package/lib/Checkbox/Checkbox.native.d.ts +0 -28
  22. package/lib/Checkbox/Checkbox.native.js +0 -118
  23. package/lib/CheckboxGroup/CheckboxGroup.native.d.ts +0 -18
  24. package/lib/CheckboxGroup/CheckboxGroup.native.js +0 -99
  25. package/lib/ClickableSimplified/index.native.d.ts +0 -42
  26. package/lib/ClickableSimplified/index.native.js +0 -166
  27. package/lib/DatePicker/DatePicker.native.d.ts +0 -34
  28. package/lib/DatePicker/DatePicker.native.js +0 -449
  29. package/lib/Form/Form.native.d.ts +0 -4
  30. package/lib/Form/Form.native.js +0 -8
  31. package/lib/Icon/Icon.native.d.ts +0 -15
  32. package/lib/Icon/Icon.native.js +0 -48
  33. package/lib/Image/Image.native.d.ts +0 -28
  34. package/lib/Image/Image.native.js +0 -219
  35. package/lib/Input/Input.native.d.ts +0 -32
  36. package/lib/Input/Input.native.js +0 -212
  37. package/lib/Label/Label.native.d.ts +0 -4
  38. package/lib/Label/Label.native.js +0 -29
  39. package/lib/LinearGradient/LinearGradient.native.d.ts +0 -16
  40. package/lib/LinearGradient/LinearGradient.native.js +0 -60
  41. package/lib/Modal/Modal.native.d.ts +0 -24
  42. package/lib/Modal/Modal.native.js +0 -98
  43. package/lib/Motion/Fade/index.native.d.ts +0 -2
  44. package/lib/Motion/Fade/index.native.js +0 -3
  45. package/lib/Motion/PullUp/index.native.d.ts +0 -2
  46. package/lib/Motion/PullUp/index.native.js +0 -3
  47. package/lib/Motion/PushDown/index.native.d.ts +0 -2
  48. package/lib/Motion/PushDown/index.native.js +0 -3
  49. package/lib/Motion/ScaleFadeIn/index.native.d.ts +0 -2
  50. package/lib/Motion/ScaleFadeIn/index.native.js +0 -3
  51. package/lib/Motion/ScalePullDown/index.native.d.ts +0 -2
  52. package/lib/Motion/ScalePullDown/index.native.js +0 -3
  53. package/lib/Picker/Picker.native.d.ts +0 -22
  54. package/lib/Picker/Picker.native.js +0 -181
  55. package/lib/PickerView/PickerView.native.d.ts +0 -31
  56. package/lib/PickerView/PickerView.native.js +0 -175
  57. package/lib/PickerViewColumn/PickerViewColumn.native.d.ts +0 -31
  58. package/lib/PickerViewColumn/PickerViewColumn.native.js +0 -175
  59. package/lib/RadialGradient/RadialGradient.native.d.ts +0 -17
  60. package/lib/RadialGradient/RadialGradient.native.js +0 -52
  61. package/lib/Radio/Radio.native.d.ts +0 -30
  62. package/lib/Radio/Radio.native.js +0 -132
  63. package/lib/RadioGroup/RadioGroup.native.d.ts +0 -18
  64. package/lib/RadioGroup/RadioGroup.native.js +0 -99
  65. package/lib/ScrollView/ScrollView.native.d.ts +0 -57
  66. package/lib/ScrollView/ScrollView.native.js +0 -283
  67. package/lib/Slider/Slider.native.d.ts +0 -21
  68. package/lib/Slider/Slider.native.js +0 -114
  69. package/lib/Swiper/Swiper.native.d.ts +0 -6
  70. package/lib/Swiper/Swiper.native.js +0 -68
  71. package/lib/Switch/Switch.native.d.ts +0 -25
  72. package/lib/Switch/Switch.native.js +0 -128
  73. package/lib/Text/Text.native.d.ts +0 -8
  74. package/lib/Text/Text.native.js +0 -37
  75. package/lib/Textarea/Textarea.native.d.ts +0 -4
  76. package/lib/Textarea/Textarea.native.js +0 -26
  77. package/lib/TimePicker/TimePicker.native.d.ts +0 -39
  78. package/lib/TimePicker/TimePicker.native.js +0 -319
  79. package/lib/View/View.native.d.ts +0 -2
  80. package/lib/View/View.native.js +0 -35
@@ -1,319 +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 "core-js/modules/es.regexp.exec.js";
8
- import "core-js/modules/es.string.split.js";
9
- import "core-js/modules/es.number.constructor.js";
10
- import "core-js/modules/es.array.index-of.js";
11
- import "core-js/modules/es.array.concat.js";
12
- import React from 'react';
13
- import { View, Text, TouchableOpacity, StyleSheet, Platform } from 'react-native';
14
- import { IDefaultTimePickerProps } from './props';
15
- import Modal from '../Modal';
16
- import PickerView from '../PickerView';
17
-
18
- var TimerPicker = /*#__PURE__*/function (_React$Component) {
19
- _inherits(TimerPicker, _React$Component);
20
-
21
- var _super = _createSuper(TimerPicker);
22
-
23
- function TimerPicker(props) {
24
- var _this;
25
-
26
- _classCallCheck(this, TimerPicker);
27
-
28
- _this = _super.call(this, props);
29
-
30
- _defineProperty(_assertThisInitialized(_this), "getTimeRange", function () {
31
- var _this$props = _this.props,
32
- start = _this$props.start,
33
- end = _this$props.end;
34
- var startArr = start.split(':');
35
- var endArr = end.split(':');
36
- var startHour = Number(startArr[0]);
37
- var startMinute = Number(startArr[1]);
38
- var endHour = Number(endArr[0]);
39
- var endMinute = Number(endArr[1]);
40
- return {
41
- startHour: startHour,
42
- startMinute: startMinute,
43
- endHour: endHour,
44
- endMinute: endMinute
45
- };
46
- });
47
-
48
- _defineProperty(_assertThisInitialized(_this), "getRange", function (value) {
49
- var rangeObj = {};
50
- var range = [];
51
- var valueArr = value.split(':');
52
- var hour = valueArr[0];
53
- var hourRange = [];
54
-
55
- var _this$getTimeRange = _this.getTimeRange(),
56
- startHour = _this$getTimeRange.startHour,
57
- startMinute = _this$getTimeRange.startMinute,
58
- endHour = _this$getTimeRange.endHour,
59
- endMinute = _this$getTimeRange.endMinute;
60
-
61
- for (var i = startHour; endMinute === 0 ? i < endHour : i <= endHour; i++) {
62
- var minuteRange = [];
63
-
64
- if (i === startHour) {
65
- for (var j = startMinute; j <= 59; j++) {
66
- minuteRange.push(_this.calculateValue(j));
67
- }
68
- } else if (i === endHour) {
69
- for (var _j = 0; _j <= endMinute; _j++) {
70
- minuteRange.push(_this.calculateValue(_j));
71
- }
72
- } else if (i < endHour && i > startHour) {
73
- for (var _j2 = 0; _j2 <= 59; _j2++) {
74
- minuteRange.push(_this.calculateValue(_j2));
75
- }
76
- }
77
-
78
- hourRange.push(_this.calculateValue(i));
79
- rangeObj[_this.calculateValue(i)] = minuteRange;
80
- }
81
-
82
- range.push(hourRange, rangeObj[hour]);
83
- return {
84
- range: range,
85
- rangeObj: rangeObj
86
- };
87
- });
88
-
89
- _defineProperty(_assertThisInitialized(_this), "calculateValue", function (value) {
90
- if (value < 10) {
91
- return "0".concat(value);
92
- } else {
93
- return "".concat(value);
94
- }
95
- });
96
-
97
- _defineProperty(_assertThisInitialized(_this), "valueToIndex", function () {
98
- var _this$state = _this.state,
99
- changeValue = _this$state.changeValue,
100
- range = _this$state.range;
101
- var valueArr = changeValue.split(':');
102
- var hour = valueArr[0];
103
- var Minute = valueArr[1];
104
- var hourIndex = range[0].indexOf(hour);
105
- var minuteIndex = range[1].indexOf(Minute);
106
- return [hourIndex, minuteIndex];
107
- });
108
-
109
- _defineProperty(_assertThisInitialized(_this), "_handleCancel", function () {
110
- var onCancel = _this.props.onCancel;
111
- var value = _this.state.value;
112
-
113
- var _this$getRange = _this.getRange(value),
114
- range = _this$getRange.range;
115
-
116
- typeof onCancel === 'function' && onCancel({
117
- type: 'cancel',
118
- origin: null
119
- });
120
-
121
- _this.setState({
122
- visible: false,
123
- changeValue: value,
124
- range: range
125
- });
126
- });
127
-
128
- _defineProperty(_assertThisInitialized(_this), "_handleConfirm", function () {
129
- var onChange = _this.props.onChange;
130
- var changeValue = _this.state.changeValue;
131
- typeof onChange === 'function' && onChange({
132
- type: 'change',
133
- value: changeValue,
134
- origin: null
135
- });
136
-
137
- _this.setState({
138
- visible: false
139
- });
140
- });
141
-
142
- _defineProperty(_assertThisInitialized(_this), "_handlePickerChange", function (event, range) {
143
- var value = event.value,
144
- column = event.column; // 滑动之前的时间
145
-
146
- var changeValue = _this.state.changeValue; // 初始时间 - 结束时间的对象{ hour: minute[]}
147
-
148
- var _this$getRange2 = _this.getRange(changeValue),
149
- rangeObj = _this$getRange2.rangeObj;
150
-
151
- var valueArr = changeValue.split(':'); // 滑动操作前的小时
152
-
153
- Number(valueArr[0]); // 滑动操作前的分钟
154
-
155
- var beforeMinute = Number(valueArr[1]);
156
-
157
- var _this$getTimeRange2 = _this.getTimeRange(),
158
- startHour = _this$getTimeRange2.startHour,
159
- startMinute = _this$getTimeRange2.startMinute,
160
- endHour = _this$getTimeRange2.endHour,
161
- endMinute = _this$getTimeRange2.endMinute; // 滑动后的小时(字符串)
162
-
163
-
164
- var hourString = range[0][value[0]]; // 滑动后的小时(数字)
165
-
166
- var hour = Number(hourString); // 滑动后的分钟(数字)
167
-
168
- var minute; // 滑动的是小时轴(第一列)
169
-
170
- if (column === 0) {
171
- if (hour === startHour) {
172
- // 分钟选择 Max[初始时间的分钟, 滑动前的分钟]
173
- minute = Math.max(startMinute, beforeMinute);
174
- } else if (hour === endHour) {
175
- // 分钟选择 Min[结束时间的分钟, 滑动前的分钟]
176
- minute = Math.min(endMinute, beforeMinute);
177
- } else {
178
- minute = beforeMinute;
179
- }
180
- } else {
181
- // 滑动的是分钟轴(第二列)
182
- // 滑动后小时对应的分钟数组
183
- var minuteArr = rangeObj[range[0][value[0]]];
184
- minute = Number(minuteArr[value[1]]);
185
- }
186
-
187
- var newValue = "".concat(_this.calculateValue(hour), ":").concat(_this.calculateValue(minute));
188
-
189
- var _this$getRange3 = _this.getRange(newValue),
190
- newRange = _this$getRange3.range;
191
-
192
- _this.setState({
193
- changeValue: newValue,
194
- range: newRange
195
- });
196
- });
197
-
198
- _defineProperty(_assertThisInitialized(_this), "renderTitleView", function () {
199
- var _this$props2 = _this.props,
200
- confirmText = _this$props2.confirmText,
201
- cancelText = _this$props2.cancelText;
202
- return /*#__PURE__*/React.createElement(View, {
203
- style: styles.title
204
- }, /*#__PURE__*/React.createElement(TouchableOpacity, {
205
- style: styles.button,
206
- activeOpacity: 0.8,
207
- onPress: _this._handleCancel
208
- }, /*#__PURE__*/React.createElement(Text, {
209
- style: styles.text
210
- }, cancelText)), /*#__PURE__*/React.createElement(TouchableOpacity, {
211
- style: styles.button,
212
- activeOpacity: 0.8,
213
- onPress: _this._handleConfirm
214
- }, /*#__PURE__*/React.createElement(Text, {
215
- style: [styles.text, {
216
- color: '#007AFF'
217
- }]
218
- }, confirmText)));
219
- });
220
-
221
- var _value = props.value || props.start;
222
-
223
- var _this$getRange4 = _this.getRange(_value),
224
- _range = _this$getRange4.range;
225
-
226
- _this.state = {
227
- visible: false,
228
- value: _value,
229
- changeValue: _value,
230
- range: _range
231
- };
232
- return _this;
233
- }
234
-
235
- _createClass(TimerPicker, [{
236
- key: "componentDidUpdate",
237
- value: function componentDidUpdate(prevProps) {
238
- var value = this.props.value;
239
-
240
- if (value !== prevProps.value) {
241
- var _this$getRange5 = this.getRange(value),
242
- range = _this$getRange5.range;
243
-
244
- this.setState({
245
- value: value,
246
- changeValue: value,
247
- range: range
248
- });
249
- }
250
- } // 获取开始时间 - 结束时间范围
251
-
252
- }, {
253
- key: "render",
254
- value: function render() {
255
- var _this2 = this;
256
-
257
- var _this$props3 = this.props,
258
- children = _this$props3.children,
259
- disabled = _this$props3.disabled;
260
- var _this$state2 = this.state,
261
- visible = _this$state2.visible,
262
- range = _this$state2.range;
263
- var newValue = this.valueToIndex();
264
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TouchableOpacity, {
265
- onPress: function onPress() {
266
- return _this2.setState({
267
- visible: true
268
- });
269
- },
270
- disabled: disabled,
271
- activeOpacity: 0.8
272
- }, children), /*#__PURE__*/React.createElement(Modal, {
273
- show: visible,
274
- position: 'bottom'
275
- }, this.renderTitleView(), Platform.OS === 'android' && /*#__PURE__*/React.createElement(View, {
276
- style: {
277
- backgroundColor: '#fff',
278
- height: 2
279
- }
280
- }), /*#__PURE__*/React.createElement(PickerView, {
281
- range: range,
282
- value: newValue,
283
- style: {
284
- backgroundColor: '#fff'
285
- },
286
- onChange: function onChange(e) {
287
- return _this2._handlePickerChange(e, range);
288
- }
289
- })));
290
- }
291
- }]);
292
-
293
- return TimerPicker;
294
- }(React.Component);
295
-
296
- _defineProperty(TimerPicker, "displayName", '_TimerPicker');
297
-
298
- _defineProperty(TimerPicker, "defaultProps", IDefaultTimePickerProps);
299
-
300
- export { TimerPicker as default };
301
- var styles = StyleSheet.create({
302
- button: {
303
- height: 54,
304
- width: 68,
305
- alignItems: 'center',
306
- justifyContent: 'center'
307
- },
308
- title: {
309
- flexDirection: 'row',
310
- justifyContent: 'space-between',
311
- backgroundColor: '#fff',
312
- borderBottomColor: 'rgba(0, 0, 0, 0.05)',
313
- borderBottomWidth: StyleSheet.hairlineWidth
314
- },
315
- text: {
316
- fontSize: 18,
317
- color: '#333'
318
- }
319
- });
@@ -1,2 +0,0 @@
1
- declare const _default: any;
2
- export default _default;
@@ -1,35 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- var _excluded = ["style"];
5
- import "core-js/modules/es.array.map.js";
6
- import React from 'react';
7
- import { View, Text } from 'react-native';
8
- import ClickableSimplified from '../ClickableSimplified';
9
- import { extracteTextStyle } from '../utils';
10
-
11
- var stringToText = function (child, props) {
12
- return typeof child === 'string' || typeof child === 'number' ? /*#__PURE__*/React.createElement(Text, props, child) : child;
13
- };
14
-
15
- var _View = function (props) {
16
- var style = props.style,
17
- rest = _objectWithoutProperties(props, _excluded);
18
-
19
- var textStyle = extracteTextStyle(props.style);
20
- var child = Array.isArray(props.children) ? props.children.map(function (c, i) {
21
- return stringToText(c, _objectSpread(_objectSpread({
22
- key: i
23
- }, props), {}, {
24
- style: textStyle
25
- }));
26
- }) : stringToText(props.children, _objectSpread(_objectSpread({}, props), {}, {
27
- style: textStyle
28
- }));
29
- return /*#__PURE__*/React.createElement(View, _extends({}, rest, {
30
- style: style
31
- }), child);
32
- };
33
-
34
- _View.displayName = 'View';
35
- export default ClickableSimplified(_View);