@ray-js/components 0.5.8-beta-1 → 0.5.10

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 (136) hide show
  1. package/lib/Button/{Button.thing.d.ts → Button.tuya.d.ts} +0 -0
  2. package/lib/Button/{Button.thing.js → Button.tuya.js} +1 -1
  3. package/lib/Checkbox/{Checkbox.thing.d.ts → Checkbox.tuya.d.ts} +0 -0
  4. package/lib/Checkbox/{Checkbox.thing.js → Checkbox.tuya.js} +1 -1
  5. package/lib/CheckboxGroup/{CheckboxGroup.thing.d.ts → CheckboxGroup.tuya.d.ts} +0 -0
  6. package/lib/CheckboxGroup/{CheckboxGroup.thing.js → CheckboxGroup.tuya.js} +1 -1
  7. package/lib/CoverView/{CoverView.thing.d.ts → CoverView.tuya.d.ts} +0 -0
  8. package/lib/CoverView/{CoverView.thing.js → CoverView.tuya.js} +1 -1
  9. package/lib/DatePicker/{DatePicker.thing.d.ts → DatePicker.tuya.d.ts} +0 -0
  10. package/lib/DatePicker/{DatePicker.thing.js → DatePicker.tuya.js} +1 -1
  11. package/lib/Form/{Form.native.d.ts → Form.tuya.d.ts} +0 -0
  12. package/lib/Form/{Form.thing.js → Form.tuya.js} +1 -1
  13. package/lib/Icon/{Icon.thing.d.ts → Icon.tuya.d.ts} +0 -0
  14. package/lib/Icon/{Icon.thing.js → Icon.tuya.js} +0 -0
  15. package/lib/Image/{Image.thing.d.ts → Image.tuya.d.ts} +0 -0
  16. package/lib/Image/{Image.thing.js → Image.tuya.js} +1 -1
  17. package/lib/Input/{Input.thing.d.ts → Input.tuya.d.ts} +0 -0
  18. package/lib/Input/{Input.thing.js → Input.tuya.js} +1 -1
  19. package/lib/IpcPlayer/{IpcPlayer.thing.d.ts → IpcPlayer.tuya.d.ts} +0 -0
  20. package/lib/IpcPlayer/{IpcPlayer.thing.js → IpcPlayer.tuya.js} +1 -1
  21. package/lib/IpcPlayer/props.d.ts +1 -1
  22. package/lib/Label/{Label.thing.d.ts → Label.tuya.d.ts} +0 -0
  23. package/lib/Label/{Label.thing.js → Label.tuya.js} +1 -1
  24. package/lib/LinearGradient/{LinearGradient.thing.d.ts → LinearGradient.tuya.d.ts} +0 -0
  25. package/lib/LinearGradient/{LinearGradient.thing.js → LinearGradient.tuya.js} +0 -0
  26. package/lib/Modal/{Modal.thing.d.ts → Modal.tuya.d.ts} +0 -0
  27. package/lib/Modal/{Modal.thing.js → Modal.tuya.js} +0 -0
  28. package/lib/Motion/Fade/{index.thing.d.ts → index.tuya.d.ts} +0 -0
  29. package/lib/Motion/Fade/{index.thing.js → index.tuya.js} +0 -0
  30. package/lib/Motion/PullUp/{index.thing.d.ts → index.tuya.d.ts} +0 -0
  31. package/lib/Motion/PullUp/{index.thing.js → index.tuya.js} +0 -0
  32. package/lib/Motion/PushDown/{index.thing.d.ts → index.tuya.d.ts} +0 -0
  33. package/lib/Motion/PushDown/{index.thing.js → index.tuya.js} +0 -0
  34. package/lib/Motion/ScaleFadeIn/{index.thing.d.ts → index.tuya.d.ts} +0 -0
  35. package/lib/Motion/ScaleFadeIn/{index.thing.js → index.tuya.js} +0 -0
  36. package/lib/Motion/ScalePullDown/{index.thing.d.ts → index.tuya.d.ts} +0 -0
  37. package/lib/Motion/ScalePullDown/{index.thing.js → index.tuya.js} +0 -0
  38. package/lib/PageContainer/{PageContainer.thing.d.ts → PageContainer.tuya.d.ts} +0 -0
  39. package/lib/PageContainer/{PageContainer.thing.js → PageContainer.tuya.js} +1 -1
  40. package/lib/PageContainer/props.d.ts +1 -1
  41. package/lib/Picker/{Picker.thing.d.ts → Picker.tuya.d.ts} +0 -0
  42. package/lib/Picker/{Picker.thing.js → Picker.tuya.js} +1 -1
  43. package/lib/PickerView/{PickerView.thing.d.ts → PickerView.tuya.d.ts} +0 -0
  44. package/lib/PickerView/{PickerView.thing.js → PickerView.tuya.js} +1 -1
  45. package/lib/PickerViewColumn/{PickerViewColumn.thing.d.ts → PickerViewColumn.tuya.d.ts} +0 -0
  46. package/lib/PickerViewColumn/{PickerViewColumn.thing.js → PickerViewColumn.tuya.js} +1 -1
  47. package/lib/PickerViewColumn/PickerViewColumn.wechat.js +1 -1
  48. package/lib/RadialGradient/{RadialGradient.thing.d.ts → RadialGradient.tuya.d.ts} +0 -0
  49. package/lib/RadialGradient/{RadialGradient.thing.js → RadialGradient.tuya.js} +0 -0
  50. package/lib/Radio/{Radio.thing.d.ts → Radio.tuya.d.ts} +0 -0
  51. package/lib/Radio/{Radio.thing.js → Radio.tuya.js} +1 -1
  52. package/lib/RadioGroup/{RadioGroup.thing.d.ts → RadioGroup.tuya.d.ts} +0 -0
  53. package/lib/RadioGroup/{RadioGroup.thing.js → RadioGroup.tuya.js} +1 -1
  54. package/lib/ScrollView/{ScrollView.thing.d.ts → ScrollView.tuya.d.ts} +0 -0
  55. package/lib/ScrollView/{ScrollView.thing.js → ScrollView.tuya.js} +1 -1
  56. package/lib/Slider/{Slider.thing.d.ts → Slider.tuya.d.ts} +0 -0
  57. package/lib/Slider/{Slider.thing.js → Slider.tuya.js} +1 -1
  58. package/lib/Swiper/{Swiper.thing.d.ts → Swiper.tuya.d.ts} +0 -0
  59. package/lib/Swiper/{Swiper.thing.js → Swiper.tuya.js} +1 -1
  60. package/lib/SwiperItem/{SwiperItem.thing.d.ts → SwiperItem.tuya.d.ts} +0 -0
  61. package/lib/SwiperItem/{SwiperItem.thing.js → SwiperItem.tuya.js} +1 -1
  62. package/lib/SwiperItem/SwiperItem.wechat.js +1 -1
  63. package/lib/Switch/{Switch.thing.d.ts → Switch.tuya.d.ts} +0 -0
  64. package/lib/Switch/{Switch.thing.js → Switch.tuya.js} +1 -1
  65. package/lib/Text/{Text.thing.d.ts → Text.tuya.d.ts} +0 -0
  66. package/lib/Text/{Text.thing.js → Text.tuya.js} +1 -1
  67. package/lib/Textarea/{Textarea.thing.d.ts → Textarea.tuya.d.ts} +0 -0
  68. package/lib/Textarea/{Textarea.thing.js → Textarea.tuya.js} +1 -1
  69. package/lib/TimePicker/{TimePicker.thing.d.ts → TimePicker.tuya.d.ts} +0 -0
  70. package/lib/TimePicker/{TimePicker.thing.js → TimePicker.tuya.js} +1 -1
  71. package/lib/View/{View.thing.d.ts → View.tuya.d.ts} +0 -0
  72. package/lib/View/{View.thing.js → View.tuya.js} +1 -1
  73. package/lib/utils/index.d.ts +1 -2
  74. package/package.json +5 -5
  75. package/lib/Button/Button.native.d.ts +0 -29
  76. package/lib/Button/Button.native.js +0 -229
  77. package/lib/Checkbox/Checkbox.native.d.ts +0 -28
  78. package/lib/Checkbox/Checkbox.native.js +0 -118
  79. package/lib/CheckboxGroup/CheckboxGroup.native.d.ts +0 -18
  80. package/lib/CheckboxGroup/CheckboxGroup.native.js +0 -99
  81. package/lib/ClickableSimplified/index.native.d.ts +0 -42
  82. package/lib/ClickableSimplified/index.native.js +0 -166
  83. package/lib/DatePicker/DatePicker.native.d.ts +0 -34
  84. package/lib/DatePicker/DatePicker.native.js +0 -449
  85. package/lib/Form/Form.native.js +0 -8
  86. package/lib/Form/Form.thing.d.ts +0 -4
  87. package/lib/Icon/Icon.native.d.ts +0 -15
  88. package/lib/Icon/Icon.native.js +0 -48
  89. package/lib/Image/Image.native.d.ts +0 -28
  90. package/lib/Image/Image.native.js +0 -219
  91. package/lib/Input/Input.native.d.ts +0 -32
  92. package/lib/Input/Input.native.js +0 -212
  93. package/lib/Label/Label.native.d.ts +0 -4
  94. package/lib/Label/Label.native.js +0 -29
  95. package/lib/LinearGradient/LinearGradient.native.d.ts +0 -16
  96. package/lib/LinearGradient/LinearGradient.native.js +0 -60
  97. package/lib/Modal/Modal.native.d.ts +0 -24
  98. package/lib/Modal/Modal.native.js +0 -98
  99. package/lib/Motion/Fade/index.native.d.ts +0 -2
  100. package/lib/Motion/Fade/index.native.js +0 -3
  101. package/lib/Motion/PullUp/index.native.d.ts +0 -2
  102. package/lib/Motion/PullUp/index.native.js +0 -3
  103. package/lib/Motion/PushDown/index.native.d.ts +0 -2
  104. package/lib/Motion/PushDown/index.native.js +0 -3
  105. package/lib/Motion/ScaleFadeIn/index.native.d.ts +0 -2
  106. package/lib/Motion/ScaleFadeIn/index.native.js +0 -3
  107. package/lib/Motion/ScalePullDown/index.native.d.ts +0 -2
  108. package/lib/Motion/ScalePullDown/index.native.js +0 -3
  109. package/lib/Picker/Picker.native.d.ts +0 -22
  110. package/lib/Picker/Picker.native.js +0 -181
  111. package/lib/PickerView/PickerView.native.d.ts +0 -31
  112. package/lib/PickerView/PickerView.native.js +0 -175
  113. package/lib/PickerViewColumn/PickerViewColumn.native.d.ts +0 -31
  114. package/lib/PickerViewColumn/PickerViewColumn.native.js +0 -175
  115. package/lib/RadialGradient/RadialGradient.native.d.ts +0 -17
  116. package/lib/RadialGradient/RadialGradient.native.js +0 -52
  117. package/lib/Radio/Radio.native.d.ts +0 -30
  118. package/lib/Radio/Radio.native.js +0 -132
  119. package/lib/RadioGroup/RadioGroup.native.d.ts +0 -18
  120. package/lib/RadioGroup/RadioGroup.native.js +0 -99
  121. package/lib/ScrollView/ScrollView.native.d.ts +0 -57
  122. package/lib/ScrollView/ScrollView.native.js +0 -283
  123. package/lib/Slider/Slider.native.d.ts +0 -21
  124. package/lib/Slider/Slider.native.js +0 -114
  125. package/lib/Swiper/Swiper.native.d.ts +0 -6
  126. package/lib/Swiper/Swiper.native.js +0 -68
  127. package/lib/Switch/Switch.native.d.ts +0 -25
  128. package/lib/Switch/Switch.native.js +0 -128
  129. package/lib/Text/Text.native.d.ts +0 -8
  130. package/lib/Text/Text.native.js +0 -37
  131. package/lib/Textarea/Textarea.native.d.ts +0 -4
  132. package/lib/Textarea/Textarea.native.js +0 -26
  133. package/lib/TimePicker/TimePicker.native.d.ts +0 -39
  134. package/lib/TimePicker/TimePicker.native.js +0 -319
  135. package/lib/View/View.native.d.ts +0 -2
  136. package/lib/View/View.native.js +0 -35
@@ -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
- }
@@ -1,449 +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.object.to-string.js";
8
- import "core-js/modules/web.dom-collections.for-each.js";
9
- import "core-js/modules/es.array.index-of.js";
10
- import "core-js/modules/es.array.concat.js";
11
- import "core-js/modules/es.number.constructor.js";
12
- import React from 'react';
13
- import { View, TouchableOpacity, Platform, Text, StyleSheet } from 'react-native';
14
- import { defaultProps } from './props';
15
- import Modal from '../Modal';
16
- import PickerView from '../PickerView';
17
-
18
- var DatePicker = /*#__PURE__*/function (_React$Component) {
19
- _inherits(DatePicker, _React$Component);
20
-
21
- var _super = _createSuper(DatePicker);
22
-
23
- function DatePicker(props) {
24
- var _this;
25
-
26
- _classCallCheck(this, DatePicker);
27
-
28
- _this = _super.call(this, props);
29
-
30
- _defineProperty(_assertThisInitialized(_this), "format", function (time) {
31
- var year = time.getFullYear(); //获取年份。
32
-
33
- var month = time.getMonth() + 1; //获取月份。
34
-
35
- var day = time.getDate(); //获取天
36
-
37
- return {
38
- year: year,
39
- month: month,
40
- day: day
41
- };
42
- });
43
-
44
- _defineProperty(_assertThisInitialized(_this), "getDateListArr", function () {
45
- var _this$props = _this.props,
46
- start = _this$props.start,
47
- end = _this$props.end; //获取开始时间和结束时间的时间戳
48
-
49
- var startTime = new Date(start).getTime();
50
- var endTime = new Date(end).getTime();
51
- var dateArr = []; // 存放区间数据的数组
52
-
53
- var stamp;
54
-
55
- for (stamp = startTime; stamp <= endTime;) {
56
- dateArr.push(_this.format(new Date(stamp)));
57
- stamp += 24 * 60 * 60 * 1000;
58
- } //此时的dateArr 格式为[{year: 2020, month: 10, day: 1},{year: 2020, month: 10, day: 2},....] 可以在这里打印下看看
59
-
60
-
61
- var listArr = []; // 存放转换后的数组 把扁平化的数据转换为 层级结构的
62
-
63
- dateArr.forEach(function (item, index) {
64
- if (index === 0) {
65
- listArr.push({
66
- year: item.year,
67
- monthArr: [{
68
- yearItem: item.year,
69
- month: item.month,
70
- dayArr: [item.day]
71
- }]
72
- });
73
- } else {
74
- // 不是第一次,就需要两个数组对比如果有一样的就再对比
75
- //some()函数 用于检测数组中的元素是否满足指定条件.
76
- // 如果有一个元素满足条件,则表达式返回true , 剩余的元素不会再执行检测
77
- var yearFlag = listArr.some(function (listItem) {
78
- // 如果年份相等,就要循环月份数组
79
- if (listItem.year == item.year) {
80
- // 如果有一个元素满足条件,则表达式返回true , 剩余的元素不会再执行检测
81
- var monthFlag = listItem.monthArr.some(function (monthItem) {
82
- // 如果月份相等,就把天push进去,return true
83
- if (monthItem.month == item.month) {
84
- monthItem.dayArr.push(item.day);
85
- return true;
86
- }
87
- }); // 如果月开关是fasle 就代表月份没有一样的 push就行了
88
-
89
- if (!monthFlag) {
90
- listItem.monthArr.push({
91
- yearItem: item.year,
92
- month: item.month,
93
- dayArr: [item.day]
94
- });
95
- }
96
-
97
- return true;
98
- }
99
- }); // 如果年开关是fasle 就代表年份没有一样的 push就行了
100
-
101
- if (!yearFlag) {
102
- // 如果年份不相等,年份数组push
103
- listArr.push({
104
- year: item.year,
105
- monthArr: [{
106
- yearItem: item.year,
107
- month: item.month,
108
- dayArr: [item.day]
109
- }]
110
- });
111
- }
112
- }
113
- });
114
- return listArr;
115
- });
116
-
117
- _defineProperty(_assertThisInitialized(_this), "getCurrentValue", function (value) {
118
- var valueTime = new Date(value).getTime();
119
-
120
- var _this$format = _this.format(new Date(valueTime)),
121
- year = _this$format.year,
122
- month = _this$format.month,
123
- day = _this$format.day;
124
-
125
- return {
126
- currentYear: year,
127
- currentMonth: month,
128
- currentDay: day
129
- };
130
- });
131
-
132
- _defineProperty(_assertThisInitialized(_this), "calculateValue", function (value) {
133
- if (value < 10) {
134
- return "0".concat(value);
135
- } else {
136
- return "".concat(value);
137
- }
138
- });
139
-
140
- _defineProperty(_assertThisInitialized(_this), "getRangeAndValue", function (value) {
141
- var fields = _this.props.fields;
142
-
143
- var dateListArr = _this.getDateListArr();
144
-
145
- var _this$getCurrentValue = _this.getCurrentValue(value),
146
- currentYear = _this$getCurrentValue.currentYear,
147
- currentMonth = _this$getCurrentValue.currentMonth,
148
- currentDay = _this$getCurrentValue.currentDay;
149
-
150
- var yearArr = [];
151
- var monthArr = [];
152
- var dayArr = [];
153
- var range = [];
154
- dateListArr.forEach(function (item) {
155
- yearArr.push("".concat(item.year));
156
-
157
- if (item.year === currentYear) {
158
- item.monthArr.forEach(function (monthItem) {
159
- monthArr.push(_this.calculateValue(monthItem.month));
160
-
161
- if (monthItem.month === currentMonth) {
162
- monthItem.dayArr.forEach(function (dayItem) {
163
- dayArr.push(_this.calculateValue(dayItem));
164
- });
165
- }
166
- });
167
- }
168
- });
169
-
170
- switch (fields) {
171
- case 'year':
172
- range.push.apply(range, yearArr);
173
- return {
174
- range: range,
175
- currentValue: yearArr.indexOf("".concat(currentYear)),
176
- dateListArr: dateListArr
177
- };
178
-
179
- case 'month':
180
- range.push(yearArr, monthArr);
181
- return {
182
- range: range,
183
- currentValue: [yearArr.indexOf("".concat(currentYear)), monthArr.indexOf(_this.calculateValue(currentMonth))],
184
- dateListArr: dateListArr
185
- };
186
-
187
- case 'day':
188
- range.push(yearArr, monthArr, dayArr);
189
- return {
190
- range: range,
191
- currentValue: [yearArr.indexOf("".concat(currentYear)), monthArr.indexOf(_this.calculateValue(currentMonth)), dayArr.indexOf(_this.calculateValue(currentDay))],
192
- dateListArr: dateListArr
193
- };
194
-
195
- default:
196
- return {
197
- range: [],
198
- currentValue: [],
199
- dateListArr: dateListArr
200
- };
201
- }
202
- });
203
-
204
- _defineProperty(_assertThisInitialized(_this), "_handleCancel", function () {
205
- var onCancel = _this.props.onCancel;
206
- typeof onCancel === 'function' && onCancel({
207
- type: 'cancel',
208
- origin: null
209
- });
210
-
211
- _this.setState({
212
- visible: false
213
- });
214
- });
215
-
216
- _defineProperty(_assertThisInitialized(_this), "_handleConfirm", function () {
217
- var _this$state = _this.state,
218
- changeValue = _this$state.changeValue,
219
- range = _this$state.range;
220
- var _this$props2 = _this.props,
221
- onChange = _this$props2.onChange,
222
- fields = _this$props2.fields;
223
- var result = '';
224
-
225
- if (fields === 'day') {
226
- result = range[0][changeValue[0]] + '-' + range[1][changeValue[1]] + '-' + range[2][changeValue[2]];
227
- } else if (fields === 'month') {
228
- result = range[0][changeValue[0]] + '-' + range[1][changeValue[1]];
229
- } else {
230
- result = range[changeValue];
231
- }
232
-
233
- console.log('result', result);
234
- typeof onChange === 'function' && onChange({
235
- type: 'change',
236
- value: result,
237
- origin: null
238
- });
239
-
240
- _this.setState({
241
- visible: false,
242
- value: changeValue
243
- });
244
- });
245
-
246
- _defineProperty(_assertThisInitialized(_this), "_handlePickerChange", function (event) {
247
- var value = event.value,
248
- column = event.column;
249
- var fields = _this.props.fields;
250
- var range = _this.state.range;
251
-
252
- if (fields === 'year') {
253
- _this.setState({
254
- changeValue: value
255
- });
256
- } else if (fields === 'month') {
257
- var year = "".concat(range[0][value[0]]);
258
- var month = "".concat(range[1][value[1]]);
259
- var endYear = range[0][range[0].length - 1];
260
-
261
- var _this$getRangeAndValu = _this.getRangeAndValue(year),
262
- newRange = _this$getRangeAndValu.range;
263
-
264
- var monthIndex = newRange[1].indexOf(month);
265
- value[1] = monthIndex === -1 ? year === endYear ? newRange[1].length - 1 : 0 : monthIndex;
266
-
267
- if (column === 0) {
268
- _this.setState({
269
- changeValue: value,
270
- range: newRange
271
- });
272
- } else {
273
- _this.setState({
274
- changeValue: value,
275
- range: newRange
276
- });
277
- }
278
- } else {
279
- var _year = "".concat(range[0][value[0]]);
280
-
281
- var _month = "".concat(range[1][value[1]]);
282
-
283
- var day = "".concat(range[2][value[2]]);
284
-
285
- if (column === 0) {
286
- var _this$getRangeAndValu2 = _this.getRangeAndValue("".concat(_year, "-").concat(_month, "-").concat(day)),
287
- _newRange = _this$getRangeAndValu2.range;
288
-
289
- var _monthIndex = _newRange[1].indexOf(_month);
290
-
291
- var startMonth = _newRange[1][0];
292
- value[1] = _monthIndex === -1 ? Number(_month) < Number(startMonth) ? 0 : _newRange[1].length - 1 : _monthIndex; // 订正月份
293
-
294
- _month = "".concat(_newRange[1][value[1]]);
295
-
296
- var _this$getRangeAndValu3 = _this.getRangeAndValue("".concat(_year, "-").concat(_month, "-").concat(day)),
297
- modifiedRange = _this$getRangeAndValu3.range;
298
-
299
- var dayIndex = modifiedRange[2].indexOf(day);
300
- var startDay = modifiedRange[2][0];
301
- value[2] = dayIndex === -1 ? Number(day) < Number(startDay) ? 0 : modifiedRange[2].length - 1 : dayIndex;
302
-
303
- _this.setState({
304
- changeValue: value,
305
- range: modifiedRange
306
- });
307
- } else if (column === 1) {
308
- var _this$getRangeAndValu4 = _this.getRangeAndValue("".concat(_year, "-").concat(_month)),
309
- _newRange2 = _this$getRangeAndValu4.range;
310
-
311
- var _dayIndex = _newRange2[2].indexOf(day);
312
-
313
- var _startDay = _newRange2[2][0];
314
- value[2] = _dayIndex === -1 ? Number(day) < Number(_startDay) ? 0 : _newRange2[2].length - 1 : _dayIndex;
315
-
316
- _this.setState({
317
- changeValue: value,
318
- range: _newRange2
319
- });
320
- } else {
321
- _this.setState({
322
- changeValue: value
323
- });
324
- }
325
- }
326
- });
327
-
328
- _defineProperty(_assertThisInitialized(_this), "renderTitleView", function () {
329
- var _this$props3 = _this.props,
330
- confirmText = _this$props3.confirmText,
331
- cancelText = _this$props3.cancelText;
332
- return /*#__PURE__*/React.createElement(View, {
333
- style: styles.title
334
- }, /*#__PURE__*/React.createElement(TouchableOpacity, {
335
- style: styles.button,
336
- activeOpacity: 0.8,
337
- onPress: _this._handleCancel
338
- }, /*#__PURE__*/React.createElement(Text, {
339
- style: styles.text
340
- }, cancelText)), /*#__PURE__*/React.createElement(TouchableOpacity, {
341
- style: styles.button,
342
- activeOpacity: 0.8,
343
- onPress: _this._handleConfirm
344
- }, /*#__PURE__*/React.createElement(Text, {
345
- style: [styles.text, {
346
- color: '#007AFF'
347
- }]
348
- }, confirmText)));
349
- });
350
-
351
- var _this$getRangeAndValu5 = _this.getRangeAndValue(props.value || props.start),
352
- _range = _this$getRangeAndValu5.range,
353
- currentValue = _this$getRangeAndValu5.currentValue,
354
- _dateListArr = _this$getRangeAndValu5.dateListArr;
355
-
356
- _this.state = {
357
- visible: false,
358
- value: currentValue,
359
- changeValue: currentValue,
360
- dateListArr: _dateListArr,
361
- range: _range
362
- };
363
- return _this;
364
- }
365
-
366
- _createClass(DatePicker, [{
367
- key: "componentDidUpdate",
368
- value: function componentDidUpdate(prevProps) {
369
- var _this$props4 = this.props,
370
- value = _this$props4.value,
371
- start = _this$props4.start;
372
-
373
- var _this$getRangeAndValu6 = this.getRangeAndValue(value || start),
374
- range = _this$getRangeAndValu6.range,
375
- currentValue = _this$getRangeAndValu6.currentValue;
376
-
377
- if (value !== prevProps.value) {
378
- this.setState({
379
- value: currentValue,
380
- range: range
381
- });
382
- }
383
- }
384
- }, {
385
- key: "render",
386
- value: function render() {
387
- var _this2 = this;
388
-
389
- var _this$props5 = this.props,
390
- children = _this$props5.children,
391
- disabled = _this$props5.disabled;
392
- var _this$state2 = this.state,
393
- visible = _this$state2.visible,
394
- value = _this$state2.value,
395
- range = _this$state2.range;
396
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TouchableOpacity, {
397
- onPress: function onPress() {
398
- return _this2.setState({
399
- visible: true
400
- });
401
- },
402
- disabled: disabled,
403
- activeOpacity: 0.8
404
- }, children), /*#__PURE__*/React.createElement(Modal, {
405
- show: visible,
406
- position: 'bottom'
407
- }, this.renderTitleView(), Platform.OS === 'android' && /*#__PURE__*/React.createElement(View, {
408
- style: {
409
- backgroundColor: '#fff',
410
- height: 2
411
- }
412
- }), /*#__PURE__*/React.createElement(PickerView, {
413
- range: range,
414
- value: value,
415
- style: {
416
- backgroundColor: '#fff'
417
- },
418
- onChange: this._handlePickerChange
419
- })));
420
- }
421
- }]);
422
-
423
- return DatePicker;
424
- }(React.Component);
425
-
426
- _defineProperty(DatePicker, "displayName", '_DatePicker');
427
-
428
- _defineProperty(DatePicker, "defaultProps", defaultProps);
429
-
430
- export { DatePicker as default };
431
- var styles = StyleSheet.create({
432
- button: {
433
- height: 54,
434
- width: 68,
435
- alignItems: 'center',
436
- justifyContent: 'center'
437
- },
438
- title: {
439
- flexDirection: 'row',
440
- justifyContent: 'space-between',
441
- backgroundColor: '#fff',
442
- borderBottomColor: 'rgba(0, 0, 0, 0.05)',
443
- borderBottomWidth: StyleSheet.hairlineWidth
444
- },
445
- text: {
446
- fontSize: 18,
447
- color: '#333'
448
- }
449
- });
@@ -1,8 +0,0 @@
1
- import * as React from 'react';
2
- import { Text } from 'react-native';
3
-
4
- var Form = function () {
5
- return /*#__PURE__*/React.createElement(Text, null, "\u6682\u672A\u5B9E\u73B0");
6
- };
7
-
8
- export default Form;
@@ -1,4 +0,0 @@
1
- import * as React from 'react';
2
- import { FormProps } from './props';
3
- declare const Form: React.FC<FormProps>;
4
- export default Form;
@@ -1,15 +0,0 @@
1
- /**
2
- * ✔ type
3
- * ✔ size
4
- * ✔ color
5
- */
6
- import React from 'react';
7
- import { StyleProp, ViewStyle } from 'react-native';
8
- export interface IconProps {
9
- style?: StyleProp<ViewStyle>;
10
- type: string;
11
- size?: number;
12
- color?: string;
13
- }
14
- declare const _Icon: React.FC<IconProps>;
15
- export default _Icon;